nx-kv 0.35.0 → 0.36.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/CHANGELOG.md +9 -0
- package/package.json +1 -1
- package/src/web/frontend/page/repos/index.jsx +6 -6
- package/src/web/public/assets/{Introduction-DO6_gTk-.js → Introduction-EDM3eqXe.js} +1 -1
- package/src/web/public/assets/{bar-DoiwB4eA.js → bar-P_ky_qA9.js} +1 -1
- package/src/web/public/assets/{cloud-DSu1a2Dn.js → cloud-Bl7EJoQ_.js} +1 -1
- package/src/web/public/assets/{composer-launch-D-b7HKk5.js → composer-launch-DOB0Hm0B.js} +1 -1
- package/src/web/public/assets/{composer-panel-CJuaj0Jp.js → composer-panel-DCV7JGNt.js} +1 -1
- package/src/web/public/assets/{dag-_5FWJlq5.js → dag-NSMkkWrt.js} +1 -1
- package/src/web/public/assets/{dir-GUpDi0kq.js → dir-ClkYDLql.js} +1 -1
- package/src/web/public/assets/{group-BzC_R2k-.js → group-DqBGGAEA.js} +1 -1
- package/src/web/public/assets/{index-B_HPAoNR.js → index-CLsU9Lad.js} +2 -2
- package/src/web/public/assets/{md-panes-BvQXV_C9.js → md-panes-DMs3KANu.js} +1 -1
- package/src/web/public/assets/{overview-sLaedHVZ.js → overview-CFGcpG_m.js} +1 -1
- package/src/web/public/assets/{progress-DOI2YFEi.js → progress-B0fipz7a.js} +1 -1
- package/src/web/public/assets/{refs-D97SxNRW.js → refs-DLThlN46.js} +1 -1
- package/src/web/public/assets/{repos-fp0D_GDq.js → repos-BygXrPSp.js} +2 -2
- package/src/web/public/assets/{route-crumb-C5LPu1Qx.js → route-crumb-Cyesq6KK.js} +1 -1
- package/src/web/public/assets/{settings-D13mfwe0.js → settings-KHM4F3Sy.js} +1 -1
- package/src/web/public/assets/{status-tag-D4wxIj1q.js → status-tag-Bts7p2cp.js} +1 -1
- package/src/web/public/assets/{task-Cu-rh5jA.js → task-BoJGRYpA.js} +1 -1
- package/src/web/public/assets/{templates-xbR-qZMs.js → templates-CdPNcDxd.js} +1 -1
- package/src/web/public/assets/{tool-bar-CHoZSF6T.js → tool-bar-Bh3XH8MU.js} +1 -1
- package/src/web/public/index.html +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dir-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dir-ClkYDLql.js","assets/task-status-BP6y8MVu.js","assets/task-status-BZrdOH46.css","assets/md-parse-C2bDc3IZ.js","assets/board-view-t8CKtq17.js","assets/route-crumb-Cyesq6KK.js","assets/graph-DM-zDRdL.js","assets/reopen-text-BylkngqC.js","assets/Introduction-EDM3eqXe.js","assets/md-panes-DMs3KANu.js","assets/upload-L1g-pfvZ.js","assets/status-tag-Bts7p2cp.js","assets/tool-bar-Bh3XH8MU.js","assets/tool-bar-1h2zairf.css","assets/md-history-Uo6U7hYS.js","assets/Introduction-BcPrmROW.css","assets/bar-P_ky_qA9.js","assets/task-BoJGRYpA.js","assets/composer-launch-DOB0Hm0B.js","assets/progress-B0fipz7a.js","assets/refs-DLThlN46.js","assets/refs-CY4i7PoC.css","assets/group-DqBGGAEA.js","assets/member-picker--32VkTmv.js","assets/repos-BygXrPSp.js","assets/button-M9TUn-AR.js","assets/button-DA4lNJeC.css","assets/repos-ZPiaK93i.css","assets/cloud-Bl7EJoQ_.js","assets/overview-CFGcpG_m.js","assets/templates-CdPNcDxd.js","assets/settings-KHM4F3Sy.js","assets/settings-BBKNCMHm.css","assets/dag-NSMkkWrt.js","assets/composer-panel-DCV7JGNt.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{S as e,_ as t,b as n,f as r,g as i,i as a,m as o,n as s,p as c,r as l,t as u,u as d,v as f,y as p}from"./task-status-BP6y8MVu.js";import{_ as m,n as h,t as g}from"./md-parse-C2bDc3IZ.js";import{a as _,c as v,i as y,n as b,o as x,r as S}from"./board-view-t8CKtq17.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var C=n((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,D());else{var t=n(l);t!==null&&A(x,t.startTime-e)}}}var S=!1,C=-1,w=5,ee=-1;function T(){return g?!0:!(e.unstable_now()-ee<w)}function E(){if(g=!1,S){var t=e.unstable_now();ee=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&T());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&A(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?D():S=!1}}}var D;if(typeof y==`function`)D=function(){y(E)};else if(typeof MessageChannel<`u`){var O=new MessageChannel,k=O.port2;O.port1.onmessage=E,D=function(){k.postMessage(null)}}else D=function(){_(E,0)};function A(t,n){C=_(function(){t(e.unstable_now())},n)}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(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,A(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,D()))),r},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),w=n(((e,t)=>{t.exports=C()})),ee=n((e=>{var t=p();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`),o=Symbol.for(`react.recoverable`),s=Symbol.for(`react.optimistic_key`);function c(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:r===s?s:``+r,children:e,containerInfo:t,implementation:n}}var l=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.browser=function(e){return{$$typeof:o,_reason:e}},e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return c(e,t,null,r)},e.flushSync=function(e){var t=l.T,n=i.p;try{if(l.T=null,i.p=2,e)return e()}finally{l.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=u(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=u(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=u(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=u(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return l.H.useFormState(e,t,n)},e.useFormStatus=function(){return l.H.useHostTransitionStatus()},e.version=`19.3.0`})),T=n(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=ee()})),E=n((e=>{var t=w(),n=p(),r=T();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}function f(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&f(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function m(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function h(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function g(e){var t=[null,null],n=m(e);return n===null||_(t,e,n.child,{foundSelf:!1}),t}function _(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&_(e,t,n.child,r))return!0;n=n.sibling}return!1}function v(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var y=null,b=null;function x(e,t,n){return e===n||e===t&&(y=e,!0)}function S(e,t,n){return e===n?(b=e,!1):e===t&&(b!==null&&(y=e),!0)}function C(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function ee(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var E=Object.assign,D=Symbol.for(`react.element`),O=Symbol.for(`react.transitional.element`),k=Symbol.for(`react.portal`),A=Symbol.for(`react.fragment`),j=Symbol.for(`react.strict_mode`),te=Symbol.for(`react.profiler`),ne=Symbol.for(`react.consumer`),re=Symbol.for(`react.context`),ie=Symbol.for(`react.forward_ref`),ae=Symbol.for(`react.suspense`),M=Symbol.for(`react.suspense_list`),N=Symbol.for(`react.memo`),P=Symbol.for(`react.lazy`),F=Symbol.for(`react.activity`),I=Symbol.for(`react.legacy_hidden`),L=Symbol.for(`react.memo_cache_sentinel`),R=Symbol.for(`react.view_transition`),z=Symbol.for(`react.recoverable`),oe=Symbol.iterator;function se(e){return typeof e!=`object`||!e?null:(e=oe&&e[oe]||e[`@@iterator`],typeof e==`function`?e:null)}var ce=Symbol.for(`react.client.reference`);function le(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ce?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case A:return`Fragment`;case te:return`Profiler`;case j:return`StrictMode`;case ae:return`Suspense`;case M:return`SuspenseList`;case F:return`Activity`;case R:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case k:return`Portal`;case re:return e.displayName||`Context`;case ne:return(e._context.displayName||`Context`)+`.Consumer`;case ie:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case N:return t=e.displayName||null,t===null?le(e.type)||`Memo`:t;case P:t=e._payload,e=e._init;try{return le(e(t))}catch{}}return null}var ue=Array.isArray,B=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,de={pending:!1,data:null,method:null,action:null},fe=[],pe=-1;function me(e){return{current:e}}function he(e){0>pe||(e.current=fe[pe],fe[pe]=null,pe--)}function ge(e,t){pe++,fe[pe]=e.current,e.current=t}var _e=me(null),ve=me(null),ye=me(null),be=me(null);function H(e,t){switch(ge(ye,t),ge(ve,e),ge(_e,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?up(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=up(t),e=dp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}he(_e),ge(_e,e)}function xe(){he(_e),he(ve),he(ye)}function Se(e){var t=e.memoizedState;t!==null&&(sh._currentValue=t.memoizedState,ge(be,e)),t=_e.current;var n=dp(t,e.type);t!==n&&(ge(ve,e),ge(_e,n))}function Ce(e){ve.current===e&&(he(_e),he(ve)),be.current===e&&(he(be),sh._currentValue=de)}var we,Te;function Ee(e){if(we===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);we=t&&t[1]||``,Te=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+we+e+Te}var U=!1;function De(e,t){if(!e||U)return``;U=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
@@ -27,4 +27,4 @@ Error generating stack: `+e.message+`
|
|
|
27
27
|
Set via Actions.setTabPinned. Only applies to tabs in tabsets (not borders); pinned tabs should be
|
|
28
28
|
listed first in the json`),t.addInherited(`enableClose`,`tabEnableClose`).setDescription(`whether the tab can be closed by the user via its close button`),t.addInherited(`closeType`,`tabCloseType`).setDescription(`when the tab's close button is active: Visible (default) active if selected or hovered (note: mobile doesnt support hovered), Always: always active, Selected only active on selected tab (clicking on the x button on a non-selected tab will just select it)`),t.addInherited(`enableDrag`,`tabEnableDrag`).setDescription(`whether the user can drag the tab to a new location`),t.addInherited(`enableRename`,`tabEnableRename`).setDescription(`whether the user can rename the tab by double clicking`),t.addInherited(`enablePin`,`tabEnablePin`).setDescription(`whether the user can pin/unpin the tab via the context menu`),t.addInherited(`className`,`tabClassName`).setDescription(`class applied to tab button`),t.addInherited(`contentClassName`,`tabContentClassName`).setDescription(`class applied to tab content`),t.addInherited(`icon`,`tabIcon`).setDescription(`the tab icon`),t.addInherited(`enableRenderOnDemand`,`tabEnableRenderOnDemand`).setDescription(`whether to avoid rendering component until tab is visible`),t.addInherited(`enablePopout`,`tabEnablePopout`).setDescription(`enable window popout (in popout capable browser), to show an icon in the tabset header also set the enablePopoutIcon attribute`),t.addInherited(`enableFloat`,`tabEnableFloat`).setDescription(`whether the user can move the tab to a floating window via the context menu`),t.addInherited(`enablePopoutIcon`,`tabEnablePopoutIcon`).setDescription(`whether to show the popout icon in the tabset header if this tab enables popouts`),t.addInherited(`enableFloatIcon`,`tabEnableFloatIcon`).setAlias(`enablePopoutFloatIcon`).setDescription(`whether to show the float icon in the tabset header if this tab enables floating`),t.addInherited(`enablePopoutOverlay`,`tabEnablePopoutOverlay`).setDescription(`if this tab will not work correctly in a popout window when the main window is backgrounded (inactive)
|
|
29
29
|
then enabling this option will gray out this tab`),t.addInherited(`borderWidth`,`tabBorderWidth`).setDescription(`the width of this tab when shown in a border; -1 uses the border's default size`),t.addInherited(`borderHeight`,`tabBorderHeight`).setDescription(`the height of this tab when shown in a border; -1 uses the border's default size`),t.addInherited(`minWidth`,`tabMinWidth`).setDescription(`the minimum width (in px) of this tab`),t.addInherited(`minHeight`,`tabMinHeight`).setDescription(`the minimum height (in px) of this tab`),t.addInherited(`maxWidth`,`tabMaxWidth`).setDescription(`the maximum width (in px) of this tab`),t.addInherited(`maxHeight`,`tabMaxHeight`).setDescription(`the maximum height (in px) of this tab`),t.addInherited(`enableScrollbars`,`tabEnableScrollbars`).setDescription(`whether the tab will be hosted in a scrollable container`),t}},K=function(e){return e.Close_Tab=`flexlayout.ui.close.tab`,e.Pinned_Tab=`flexlayout.ui.pinned.tab`,e.Rename_Tab=`flexlayout.ui.rename.tab`,e.Close_Tabset=`flexlayout.ui.close.tabset`,e.Active_Tabset=`flexlayout.ui.active.tabset`,e.Move_Tabset=`flexlayout.ui.move.tabset`,e.Move_Tabs=`flexlayout.ui.move.tabs (?)`,e.Move_Group=`flexlayout.ui.move.group (?)`,e.Maximize=`flexlayout.ui.maximize.tabset`,e.Restore=`flexlayout.ui.restore.tabset`,e.Popout_Tab=`flexlayout.ui.popout.tab`,e.Popout_Tab_Float=`flexlayout.ui.popout.tab.float`,e.Popout_Float_To_Window=`flexlayout.ui.popout.float.to.window`,e.Dock_Float_To_Layout=`flexlayout.ui.dock.float.to.layout`,e.Dock_Float_Tabs=`flexlayout.ui.dock.float.tabs (?)`,e.Overflow_Menu_Tooltip=`flexlayout.ui.overflow.menu.tooltip`,e.Splitter=`flexlayout.ui.splitter`,e.Error_rendering_component=`flexlayout.ui.error.rendering.component`,e.Error_rendering_component_retry=`flexlayout.ui.error.rendering.component.retry`,e.Popout_Window_Name=`flexlayout.ui.popout.window.name`,e.Menu_Rename=`flexlayout.ui.menu.rename`,e.Menu_Pin=`flexlayout.ui.menu.pin`,e.Menu_Unpin=`flexlayout.ui.menu.unpin`,e.Menu_Popout=`flexlayout.ui.menu.popout`,e.Menu_Float=`flexlayout.ui.menu.float`,e.Menu_Popout_Tabset=`flexlayout.ui.menu.popout.tabset`,e.Menu_Float_Tabset=`flexlayout.ui.menu.float.tabset`,e.Menu_Maximize=`flexlayout.ui.menu.maximize`,e.Menu_Restore=`flexlayout.ui.menu.restore`,e.Menu_Overlay=`flexlayout.ui.menu.overlay`,e.Menu_Split=`flexlayout.ui.menu.split`,e.Menu_Close_All=`flexlayout.ui.menu.close.all`,e.Menu_Close_Right=`flexlayout.ui.menu.close.right`,e.Menu_Close_Others=`flexlayout.ui.menu.close.others`,e.Menu_Add_To_New_Group=`flexlayout.ui.menu.add.to.new.group`,e.Menu_Add_To_Group=`flexlayout.ui.menu.add.to.group`,e.Menu_Remove_From_Group=`flexlayout.ui.menu.remove.from.group`,e.Menu_Ungroup=`flexlayout.ui.menu.ungroup`,e.Menu_Expand=`flexlayout.ui.menu.expand`,e.Menu_Collapse=`flexlayout.ui.menu.collapse`,e.Rename_Group=`flexlayout.ui.rename.group`,e.Group_Color=`flexlayout.ui.group.color`,e.Group_Pill_Tooltip=`flexlayout.ui.group.pill.tooltip`,e.Group_Name_Label=`flexlayout.ui.group.name.label`,e.Group_Name_Placeholder=`flexlayout.ui.group.name.placeholder`,e.Group_Color_N=`flexlayout.ui.group.color.n`,e.Group_Default_Name=`flexlayout.ui.group.default.name`,e}({}),Oe={"flexlayout.ui.close.tab":`Close`,"flexlayout.ui.pinned.tab":`Pinned`,"flexlayout.ui.rename.tab":`Rename tab`,"flexlayout.ui.close.tabset":`Close tabset`,"flexlayout.ui.active.tabset":`Active tabset`,"flexlayout.ui.move.tabset":`Move tabset`,"flexlayout.ui.move.tabs (?)":`Move tabs (?)`,"flexlayout.ui.move.group (?)":`Move group (?)`,"flexlayout.ui.maximize.tabset":`Maximize tabset`,"flexlayout.ui.restore.tabset":`Restore tabset`,"flexlayout.ui.popout.tab":`Popout selected tab`,"flexlayout.ui.popout.tab.float":`Float selected tab`,"flexlayout.ui.popout.float.to.window":`Popout panel`,"flexlayout.ui.dock.float.to.layout":`Drag into another layout`,"flexlayout.ui.dock.float.tabs (?)":`Dock tabs (?)`,"flexlayout.ui.overflow.menu.tooltip":`Hidden tabs`,"flexlayout.ui.splitter":`Resize`,"flexlayout.ui.error.rendering.component":`Error rendering component`,"flexlayout.ui.error.rendering.component.retry":`Retry`,"flexlayout.ui.popout.window.name":`Popout Window`,"flexlayout.ui.menu.rename":`Rename`,"flexlayout.ui.menu.pin":`Pin`,"flexlayout.ui.menu.unpin":`Unpin`,"flexlayout.ui.menu.popout":`Popout`,"flexlayout.ui.menu.float":`Float`,"flexlayout.ui.menu.popout.tabset":`Pop out tabset`,"flexlayout.ui.menu.float.tabset":`Float tabset`,"flexlayout.ui.menu.maximize":`Maximize`,"flexlayout.ui.menu.restore":`Restore`,"flexlayout.ui.menu.overlay":`Overlay`,"flexlayout.ui.menu.split":`Split`,"flexlayout.ui.menu.close.all":`Close All`,"flexlayout.ui.menu.close.right":`Close to the Right`,"flexlayout.ui.menu.close.others":`Close Others`,"flexlayout.ui.menu.add.to.new.group":`Add to new group`,"flexlayout.ui.menu.add.to.group":`Add to group`,"flexlayout.ui.menu.remove.from.group":`Remove from group`,"flexlayout.ui.menu.ungroup":`Ungroup`,"flexlayout.ui.menu.expand":`Expand`,"flexlayout.ui.menu.collapse":`Collapse`,"flexlayout.ui.rename.group":`Rename group`,"flexlayout.ui.group.color":`Group color`,"flexlayout.ui.group.pill.tooltip":`Tab Group, click to expand/collapse`,"flexlayout.ui.group.name.label":`Name`,"flexlayout.ui.group.name.placeholder":`Group Name`,"flexlayout.ui.group.color.n":`Group color ?`,"flexlayout.ui.group.default.name":`Group`},ke={closeTab:`Ctrl+Delete`,renameTab:`F2`,focusTabToggle:void 0,focusNextTabset:void 0,focusPreviousTabset:void 0,closeOverlayBorder:`Escape`};function Ae(){return typeof window<`u`&&window.matchMedia&&window.matchMedia(`(hover: hover) and (pointer: fine)`).matches}function je(e,t,n){let r,i=t.getName(),a=t.getName();n===void 0&&(n=0),r===void 0&&t.getIcon()!==void 0&&(r=n===0?(0,k.jsx)(`img`,{style:{width:`1em`,height:`1em`},src:t.getIcon(),alt:``}):(0,k.jsx)(`img`,{style:{width:`1em`,height:`1em`,transform:`rotate(`+n+`deg)`},src:t.getIcon(),alt:``}));let o={leading:r,content:i,name:a,buttons:[]};return e.customizeTab(t,o),t.setRenderedName(o.name),o}function Me(e,t){return e+t.replace(/\s/g,`_`)}function Ne(e){return e.getPath().replace(/\/t(\d+)$/,`/tb$1`)}function Pe(e,t){if(!t||typeof e.key!=`string`)return!1;let n=t.split(`+`),r=n.pop(),i=e=>n.some(t=>t.toLowerCase()===e);return e.key.toLowerCase()===r.toLowerCase()&&e.ctrlKey===i(`ctrl`)&&e.shiftKey===i(`shift`)&&e.altKey===i(`alt`)&&e.metaKey===i(`meta`)}function Fe(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey}function Ie(e){return{...ke,...e}}function Le(e){return e?.replace(/\bctrl\b/i,`Control`)}function Re(e){e&&(e.querySelector(`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`)??e).focus()}function ze(e){let t=!1;return e.nativeEvent instanceof MouseEvent&&(e.nativeEvent.button!==0||e.ctrlKey||e.altKey||e.metaKey||e.shiftKey)&&(t=!0),t}function Be(e,t){let n=[...Ve(`iframe`,t),...Ve(`webview`,t)];for(let t of n)t.style.pointerEvents=e?`auto`:`none`}function Ve(e,t){return[...t.getElementsByTagName(e)]}var He=!1;function Ue(e,t,n,r,i){He=!0,t.preventDefault(),t.currentTarget&&typeof t.currentTarget.setPointerCapture==`function`&&t.currentTarget.setPointerCapture(t.pointerId);let a=e=>{e.preventDefault(),n(e.clientX,e.clientY)},o=()=>{e.removeEventListener(`pointermove`,a),e.removeEventListener(`pointerup`,c),e.removeEventListener(`pointercancel`,s)},s=e=>{e.preventDefault(),o(),He=!1,i()},c=()=>{o(),He=!1,r()};e.addEventListener(`pointermove`,a),e.addEventListener(`pointerup`,c),e.addEventListener(`pointercancel`,s)}function We(e,t){let n=e.getAttribute(`style`);return n!==t.getAttribute(`style`)&&(n?t.setAttribute(`style`,n):t.removeAttribute(`style`),!0)}function Ge(){let e=navigator.userAgent;return e.includes(`Safari`)&&!e.includes(`Chrome`)&&!e.includes(`Chromium`)}function Ke(e=window){let t=e.document;return{scrollTop:e.pageYOffset||t.documentElement.scrollTop||t.body.scrollTop||0,scrollLeft:e.pageXOffset||t.documentElement.scrollLeft||t.body.scrollLeft||0,fullHeight:Math.max(t.body.scrollHeight,t.documentElement.scrollHeight,t.body.offsetHeight,t.documentElement.offsetHeight,t.body.clientHeight,t.documentElement.clientHeight),fullWidth:Math.max(t.body.scrollWidth,t.documentElement.scrollWidth,t.body.offsetWidth,t.documentElement.offsetWidth,t.body.clientWidth,t.documentElement.clientWidth),viewportHeight:e.innerHeight||t.documentElement.clientHeight,viewportWidth:e.innerWidth||t.documentElement.clientWidth}}var qe=e=>{let{controller:t,show:n}=e;return(0,k.jsx)(`div`,{"aria-hidden":`true`,className:t.getClassName(L.FLEXLAYOUT__LAYOUT_OVERLAY),style:{display:n?`flex`:`none`}})};qe.displayName=`Overlay`;var Je=2e3,Ye=750,Xe=e=>{let{title:t,controller:n,layout:r,url:i,onCloseLayout:a,children:o}=e,s=O.useRef(null),[c,l]=O.useState(void 0),[u,d]=O.useState(void 0),[f,p]=O.useState(void 0),m=O.useMemo(()=>new Map,[]),h=O.useRef(!1),g=O.useRef(null),_=O.useRef(null),v=O.useRef(null),y=O.useRef(new Map);if(O.useLayoutEffect(()=>{!h.current&&c&&(h.current=!0,n.redrawLayout(),nt(m))},[c,n,m]),O.useLayoutEffect(()=>{let e=()=>{if(s.current){let e=s.current;s.current=null,e.close()}};if(!s.current){let o=r.getLayoutId(),c=r.getRect();s.current=window.open(i,o,`left=${c.x},top=${c.y},width=${c.width},height=${c.height}`),s.current?(window.addEventListener(`beforeunload`,e),s.current.addEventListener(`load`,()=>{if(s.current){v.current?.(),h.current=!1;let e=s.current;s.current.focus(),s.current.resizeTo(c.width,c.height),s.current.moveTo(c.x,c.y);let i=s.current;i.resizeBy(c.width-i.outerWidth,c.height-i.outerHeight),i.moveBy(c.x-i.screenLeft,c.y-i.screenTop);let o=s.current.document;d(s.current),p(o),o.title=t,document.documentElement.lang&&(o.documentElement.lang=document.documentElement.lang),document.documentElement.dir&&(o.documentElement.dir=document.documentElement.dir);let u=o.createElement(`div`);u.className=L.FLEXLAYOUT__FLOATING_WINDOW_CONTENT,o.body.appendChild(u),n.getProps().onPopoutOpen?.(r,s.current,o),$e(o,m).then(()=>{l(u)}),g.current=new MutationObserver(e=>Ze(e,o,m)),g.current.observe(document.head,{childList:!0,subtree:!0,characterData:!0}),_.current=o.defaultView?.setInterval(()=>{rt(m,y.current)},Ye)??null;let f=()=>{s.current&&(n.getProps().onPopoutClose?.(r,s.current,o),a(r),s.current=null,v.current?.())};e.addEventListener(`beforeunload`,f),v.current=()=>{g.current?.disconnect(),g.current=null,_.current!=null&&(o.defaultView?.clearInterval(_.current),_.current=null),e.removeEventListener(`beforeunload`,f)}}})):(console.warn(`Unable to open window ${i}`),a(r))}return()=>{window.removeEventListener(`beforeunload`,e),s.current?.close(),s.current=null,v.current?.()}},[]),c!==void 0){let e=n.getProps().renderPopoutContent,t=o;return e&&f&&(t=e({children:o,layout:r,popoutWindow:u??window,popoutDocument:f})),(0,A.createPortal)(t,c)}return null};function Ze(e,t,n){for(let r of e)if(r.type===`childList`&&r.target===document.head){for(let e of r.addedNodes)(e instanceof HTMLLinkElement||e instanceof HTMLStyleElement)&&et(t,e,n);for(let e of r.removedNodes)if(e instanceof HTMLLinkElement||e instanceof HTMLStyleElement){let t=n.get(e);t&&(t.remove(),n.delete(e))}}else{let e=Qe(r.target),t=e&&n.get(e);e&&t&&tt(e,t)}}function Qe(e){let t=e instanceof HTMLElement?e:e.parentNode;for(;t&&!(t instanceof HTMLStyleElement);)t=t.parentNode;return t instanceof HTMLStyleElement?t:void 0}function $e(e,t){let n=[],r=document.querySelectorAll(`style, link[rel="stylesheet"]`);for(let i of r)et(e,i,t,n);return Promise.all(n)}function et(e,t,n,r){if(t instanceof HTMLLinkElement){let i=t.cloneNode(!0);e.head.appendChild(i),n.set(t,i),r&&r.push(new Promise(t=>{let n=!1,r=e=>{n||(n=!0,t(e))};i.onload=()=>r(!0),i.onerror=()=>r(!1),e.defaultView?.setTimeout(()=>r(!1),Je)}))}else if(t instanceof HTMLStyleElement)try{let r=t.cloneNode(!0);e.head.appendChild(r),tt(t,r),n.set(t,r)}catch{}}function tt(e,t){let n=e.textContent??``;if(n.trim()!==``)t.textContent=n;else try{t.textContent=``;let n=e.sheet?.cssRules;if(n)for(let e of n)t.sheet.insertRule(e.cssText,t.sheet.cssRules.length)}catch{}}function nt(e){for(let[t,n]of e)t instanceof HTMLStyleElement&&tt(t,n)}function rt(e,t){for(let[n,r]of e){if(!(n instanceof HTMLStyleElement)||(n.textContent??``).trim()!==``)continue;let e=0;try{e=n.sheet?.cssRules.length??0}catch{}e!==t.get(n)&&(t.set(n,e),tt(n,r))}}Xe.displayName=`PopoutWindow`;var it=10,at=-4,ot=8,st=12,ct=150,lt=25,ut=e=>{let{controller:t,layout:n,children:r}=e,[i,a]=O.useState(n.getRect()),o=O.useRef(N.empty()),s=t.getClassName,c=O.useRef(null),l=O.useRef(null),u=O.useRef(null),d=O.useRef(null),f=O.useRef(null),p=O.useRef(null),m=O.useRef(null),h=O.useRef(null),g=O.useRef(null),_=O.useRef(null),v=O.useRef(!1),y=O.useRef(void 0);O.useEffect(()=>{o.current=i},[i]),O.useEffect(()=>{let e=requestAnimationFrame(()=>{a(n.getRect())});return()=>cancelAnimationFrame(e)},[n]);let b=O.useCallback(e=>{let n=t.getCurrentWindow()??window,r=N.fromDomRect(t.getRootDiv().getBoundingClientRect()),i;if(t.getProps().constrainFloatPanels)i=new N(0,0,r.width,r.height);else{let e=Ke(n),t=Math.max(e.fullWidth,n.innerWidth),a=Math.max(e.fullHeight,n.innerHeight);i=new N(-r.x,-r.y,t,a)}let a=e.clone();return a.clamp(i),a},[t]),x=O.useCallback(e=>{e.preventDefault(),e.stopImmediatePropagation()},[]);O.useEffect(()=>{let e=[l,u,d,f,p,m,h,g,_].map(e=>e.current).filter(e=>e!==null);return e.forEach(e=>e.addEventListener(`touchstart`,x,{passive:!1})),()=>{e.forEach(e=>e.removeEventListener(`touchstart`,x))}},[x]);let S=O.useRef(!1);O.useLayoutEffect(()=>{if(!S.current){S.current=!0;let e=b(i);e.equals(i)||(a(e),n.setRect(e))}},[b,i,n]),O.useEffect(()=>{let e=()=>{let e=[...t.getModel().getLayouts()],r=e[e.length-1][1];n!==r&&(v.current=!0)},r=t.getCurrentWindow()??window,i=()=>{v.current&&=(y.current=r.setTimeout(()=>{y.current=void 0,t.moveWindowToFront(n.getLayoutId())},10),!1)},a=c.current;return a&&(a.addEventListener(`pointerdown`,e,{capture:!0}),a.addEventListener(`pointerup`,i)),()=>{a&&(a.removeEventListener(`pointerdown`,e,{capture:!0}),a.removeEventListener(`pointerup`,i)),y.current!==void 0&&(r.clearTimeout(y.current),y.current=void 0)}},[t,n]);let C=e=>{e.stopPropagation();let r={x:e.clientX-i.x,y:e.clientY-i.y};t.showOverlayOnAllWindows(!0),Ue(t.getCurrentDocument()??document,e,(e,o)=>{v.current&&=(t.moveWindowToFront(n.getLayoutId()),!1);let s=new N(e-r.x,o-r.y,i.width,i.height),c=b(s);a(c),t.doAction(R.moveFloat(n.getLayoutId(),c).setAdjusting(!0))},()=>{t.doAction(R.moveFloat(n.getLayoutId(),o.current).setAdjusting(!1)),t.redrawLayout(),t.showOverlayOnAllWindows(!1)},()=>{t.doAction(R.moveFloat(n.getLayoutId(),o.current).setAdjusting(!1)),t.redrawLayout(),t.showOverlayOnAllWindows(!1)})},w=t.getIcons(),ee=t.isSupportsPopout()&&n.getRootRow()?.isAllowedInWindow()===!0,T=e=>{e.stopPropagation(),n.getRootRow()?.getChildren().length?t.getDragDropManager().startDockLayoutDrag(e.nativeEvent,n,c.current??void 0):e.preventDefault()},E=e=>{t.getDragDropManager().onDragEnded()},D=e=>{e.stopPropagation()},A=e=>{e.stopPropagation();let r=t.getScreenRect(n.getRect());t.doAction(R.popoutFloat(n.getLayoutId(),r.toJson()))},j=(e,r)=>{let s=i,c={x:e.clientX,y:e.clientY};t.showOverlayOnAllWindows(!0),Ue(t.getCurrentDocument()??document,e,(e,i)=>{let o=e-c.x,l=i-c.y,u=s.x,d=s.y,f=s.width,p=s.height;r.includes(`n`)&&(d+=l,p-=l),r.includes(`s`)&&(p+=l),r.includes(`w`)&&(u+=o,f-=o),r.includes(`e`)&&(f+=o);let m=new N(u,d,Math.max(ct,f),Math.max(lt,p)),h=b(m);a(h),t.doAction(R.moveFloat(n.getLayoutId(),h).setAdjusting(!0))},()=>{t.doAction(R.moveFloat(n.getLayoutId(),o.current).setAdjusting(!1)),t.redrawLayout(),t.showOverlayOnAllWindows(!1)},()=>{t.doAction(R.moveFloat(n.getLayoutId(),o.current).setAdjusting(!1)),t.redrawLayout(),t.showOverlayOnAllWindows(!1)}),e.stopPropagation()};return(0,k.jsxs)(`div`,{ref:c,className:s(L.FLEXLAYOUT__FLOAT_WINDOW),style:{left:i.x,top:i.y,width:i.width,height:i.height,position:`absolute`},children:[(0,k.jsxs)(`div`,{ref:l,className:s(L.FLEXLAYOUT__FLOAT_WINDOW_HEADER),onPointerDown:C,children:[(0,k.jsx)(`div`,{"data-layout-path":`/floatwindow/drag-handle`,className:s(L.FLEXLAYOUT__FLOAT_WINDOW_DRAG_HANDLE),draggable:!0,title:t.i18nName(K.Dock_Float_To_Layout),"aria-label":t.i18nName(K.Dock_Float_To_Layout),onDragStart:T,onDragEnd:E,onPointerDown:D,children:w.dragToDock}),(0,k.jsx)(`div`,{style:{flexGrow:1,display:`flex`,justifyContent:`center`,alignItems:`center`,minWidth:0,overflow:`hidden`},children:n.getName()===void 0?(0,k.jsx)(`div`,{style:{width:50,height:8,display:`flex`,flexDirection:`column`,justifyContent:`space-around`,opacity:.5},children:(0,k.jsx)(`div`,{style:{height:2,backgroundColor:`gray`,borderRadius:1}})}):(0,k.jsx)(`span`,{"data-layout-path":`/floatwindow/title`,className:s(L.FLEXLAYOUT__FLOAT_WINDOW_HEADER_TITLE),title:n.getName(),children:n.getName()})}),ee&&(0,k.jsx)(`button`,{type:`button`,"data-layout-path":`/floatwindow/button/popout`,className:s(L.FLEXLAYOUT__FLOAT_WINDOW_BUTTON),title:t.i18nName(K.Popout_Float_To_Window),"aria-label":t.i18nName(K.Popout_Float_To_Window),onClick:A,onPointerDown:D,children:w.popoutFloatWindow})]}),(0,k.jsx)(`div`,{className:s(L.FLEXLAYOUT__FLOAT_WINDOW_CONTENT),children:r}),(0,k.jsx)(`div`,{ref:u,style:{position:`absolute`,zIndex:it,top:at,left:ot,right:ot,height:ot,cursor:`ns-resize`},onPointerDown:e=>j(e,`n`)}),(0,k.jsx)(`div`,{ref:m,style:{position:`absolute`,zIndex:it,bottom:at,left:ot,right:ot,height:ot,cursor:`ns-resize`},onPointerDown:e=>j(e,`s`)}),(0,k.jsx)(`div`,{ref:f,style:{position:`absolute`,zIndex:it,top:ot,bottom:ot,right:at,width:ot,cursor:`ew-resize`},onPointerDown:e=>j(e,`e`)}),(0,k.jsx)(`div`,{ref:g,style:{position:`absolute`,zIndex:it,top:ot,bottom:ot,left:at,width:ot,cursor:`ew-resize`},onPointerDown:e=>j(e,`w`)}),(0,k.jsx)(`div`,{ref:_,style:{position:`absolute`,zIndex:it,top:at,left:at,width:st,height:st,cursor:`nwse-resize`},onPointerDown:e=>j(e,`nw`)}),(0,k.jsx)(`div`,{ref:d,style:{position:`absolute`,zIndex:it,top:at,right:at,width:st,height:st,cursor:`nesw-resize`},onPointerDown:e=>j(e,`ne`)}),(0,k.jsx)(`div`,{ref:h,style:{position:`absolute`,zIndex:it,bottom:at,left:at,width:st,height:st,cursor:`nesw-resize`},onPointerDown:e=>j(e,`sw`)}),(0,k.jsx)(`div`,{ref:p,style:{position:`absolute`,zIndex:it,bottom:0,right:0,width:st,height:st,cursor:`nwse-resize`},onPointerDown:e=>j(e,`se`)})]})},dt=({controller:e})=>{let t=[],n=e.getModel().getLayouts(),r=2e3;for(let[i,a]of n)a.isMainLayout()||(a.getType()===`window`&&e.isSupportsPopout()?t.push((0,k.jsx)(Xe,{controller:e,layout:a,title:e.getPopoutWindowName()+` `+i,url:e.getPopoutURL()+`?id=`+encodeURIComponent(i),onCloseLayout:e.onCloseLayout,children:(0,k.jsx)(`div`,{className:e.getProps().popoutClassName,children:(0,k.jsx)(nn,{...e.getProps(),layoutId:i,path:a.getPath(),mainLayoutController:e})})},i)):a.getType()===`float`&&(t.push((0,k.jsx)(ut,{controller:e,layout:a,zIndex:r,onCloseLayout:e.onCloseLayout,children:(0,k.jsx)(nn,{...e.getProps(),layoutId:i,path:a.getPath(),mainLayoutController:e})},i+`float`)),r++));return(0,k.jsx)(k.Fragment,{children:t})};dt.displayName=`FloatingWindowContainer`;var ft=e=>{let{controller:t,tabNode:n,selected:r,border:i,icons:a,path:o}=e,s=O.useRef(null),c=O.useRef(null),l=t.getKeyMap(),u=e=>{n.isEnableDrag()?(e.stopPropagation(),t.getDragDropManager().setDragNode(e.nativeEvent,n)):e.preventDefault()},d=e=>{e.stopPropagation(),t.getDragDropManager().onDragEnded()},f=e=>{ze(e)&&t.auxMouseClick(n,e)},p=e=>{t.showContextMenu(n,e)},m=()=>{t.doAction(R.selectTab(n.getId()))},h=e=>{let t=s.current?.closest(`[role="tablist"]`);if(t){let n=Array.from(t.querySelectorAll(`[role="tab"]`));n[n.indexOf(s.current)+e]?.focus()}},g=()=>{let e=s.current.ownerDocument,t=()=>Re(e.getElementById(Me(`flexlayout-tab-`,n.getId())));r?t():(m(),requestAnimationFrame(t))},_=e=>{t.getEditingTab()!==n&&(Pe(e,l.focusTabToggle)?(g(),e.preventDefault()):e.key===`Enter`||e.key===` `?(m(),e.preventDefault()):(e.key===`ArrowLeft`||e.key===`ArrowUp`)&&!Fe(e)?(h(-1),e.preventDefault()):(e.key===`ArrowRight`||e.key===`ArrowDown`)&&!Fe(e)?(h(1),e.preventDefault()):Pe(e,l.closeTab)&&n.isCloseable()&&(h(1),t.doAction(R.deleteTab(n.getId())),e.preventDefault()))},v=()=>{let e=n.getCloseType();return!!(r||e===ce.Always||e===ce.Visible&&t.getCurrentWindow()?.matchMedia(`(hover: hover) and (pointer: fine)`).matches)},y=e=>{v()&&(t.doAction(R.deleteTab(n.getId())),e.stopPropagation())},b=e=>{e.stopPropagation()},x=()=>{if(r)return!0;let e=n.getTabContainer();return e instanceof W&&e.getSelected()===-1&&e.getTabNodes()[0]===n},S=t.getEditingTab()===n,C=O.useCallback(e=>{s.current=e,t.registerMeasurable(n,`tabbutton`,e)},[t,n]);O.useLayoutEffect(()=>{S&&c.current.select()},[S]),O.useEffect(()=>{if(S){let e=t.getCurrentDocument().body,n=e=>{e.target!==c.current&&t.setEditingTab(void 0)};return e.addEventListener(`pointerdown`,n),()=>e.removeEventListener(`pointerdown`,n)}},[S,t]);let w=e=>{e.stopPropagation()},ee=e=>{e.code===`Escape`?(t.setEditingTab(void 0),s.current?.focus()):(e.code===`Enter`||e.code===`NumpadEnter`)&&(t.setEditingTab(void 0),t.doAction(R.renameTab(n.getId(),e.target.value)),s.current?.focus())},T=t.getClassName,E=T(L.FLEXLAYOUT__BORDER_BUTTON)+` `+T(L.FLEXLAYOUT__BORDER_BUTTON_+i);E+=r?` `+T(L.FLEXLAYOUT__BORDER_BUTTON__SELECTED):` `+T(L.FLEXLAYOUT__BORDER_BUTTON__UNSELECTED);let D=n.getParent()instanceof U?n.getParent():void 0;D!==void 0&&(E+=` `+T(L.FLEXLAYOUT__TAB_BUTTON_GROUPED),n.getModel().getTabGroupType()===`underline`&&(E+=` `+T(L.FLEXLAYOUT__TAB_BUTTON_GROUPED_UNDERLINE))),n.getClassName()!==void 0&&(E+=` `+n.getClassName());let A=0;n.getModel().isEnableRotateBorderIcons()===!1&&(i===`left`?A=n.getModel().getBorderLeftTabDirection()===`down`?-90:90:i===`right`&&(A=-90));let j=je(t,n,A),te=j.content?(0,k.jsx)(`div`,{className:T(L.FLEXLAYOUT__BORDER_BUTTON_CONTENT),children:j.content}):null,ne=j.leading?(0,k.jsx)(`div`,{className:T(L.FLEXLAYOUT__BORDER_BUTTON_LEADING),children:j.leading}):null;if(S&&(te=(0,k.jsx)(`input`,{ref:c,className:T(L.FLEXLAYOUT__TAB_BUTTON_TEXTBOX),"data-layout-path":o+`/textbox`,type:`text`,"aria-label":t.i18nName(K.Rename_Tab),autoFocus:!0,defaultValue:n.getName(),onKeyDown:ee,onPointerDown:w})),n.isCloseable()){let e=t.i18nName(K.Close_Tab);j.buttons.push((0,k.jsx)(`div`,{"data-layout-path":o+`/button/close`,title:e,"aria-hidden":`true`,className:T(L.FLEXLAYOUT__BORDER_BUTTON_TRAILING),onPointerDown:b,onClick:y,children:typeof a.close==`function`?a.close(n):a.close},`close`))}let re=[Le(l.focusTabToggle),n.isCloseable()?Le(l.closeTab):void 0].filter(Boolean).join(` `)||void 0,ie={};return D!==void 0&&(ie[`--flexlayout-group-color`]=D.getColor()),(0,k.jsxs)(`div`,{ref:C,id:Me(`flexlayout-tabbutton-`,n.getId()),role:S?void 0:`tab`,"aria-selected":S?void 0:r,"aria-controls":S?void 0:Me(`flexlayout-tab-`,n.getId()),"aria-label":S?void 0:j.name,"aria-keyshortcuts":S?void 0:re,tabIndex:S?-1:x()?0:-1,onKeyDown:_,"data-layout-path":o,className:E,style:ie,onClick:m,onAuxClick:f,onContextMenu:p,title:n.getHelpText(),draggable:!0,onDragStart:u,onDragEnd:d,children:[ne,te,j.buttons]})};ft.displayName=`BorderButton`;var pt=e=>{let{controller:t,groupNode:n,path:r}=e,i=O.useRef(null),a=O.useCallback(e=>{i.current=e,t.registerMeasurable(n,`grouppill`,e)},[t,n]),o=e=>{n.isEnableDrag()?(e.stopPropagation(),t.getDragDropManager().setDragNode(e.nativeEvent,n)):e.preventDefault()},s=e=>{t.getDragDropManager().onDragEnded()},c=e=>{t.showContextMenu(n,e)},l=()=>{t.doAction(R.updateNodeAttributes(n.getId(),{opened:!n.isOpened()}))},u=e=>{l(),e.stopPropagation()},d=e=>{if(e.key===`Enter`||e.key===` `)l(),e.preventDefault();else if(e.key===`ContextMenu`||e.shiftKey&&e.key===`F10`){let t=i.current.getBoundingClientRect();i.current.dispatchEvent(new MouseEvent(`contextmenu`,{bubbles:!0,cancelable:!0,clientX:t.x+t.width/2,clientY:t.y+t.height/2})),e.preventDefault()}},f=t.getClassName,p=f(L.FLEXLAYOUT__GROUP_PILL);n.isOpened()?t.getModel().getTabGroupType()===`underline`&&(p+=` `+f(L.FLEXLAYOUT__GROUP_PILL_UNDERLINE)):p+=` `+f(L.FLEXLAYOUT__GROUP_PILL_COLLAPSED);let m=n.getColor(),h={backgroundColor:m,borderColor:m},g=t.i18nName(K.Group_Pill_Tooltip);return(0,k.jsxs)(`div`,{ref:a,"data-layout-path":r,role:`button`,"aria-label":n.getName(),"aria-expanded":n.isOpened(),tabIndex:0,title:g,className:p,style:h,draggable:!0,onDragStart:o,onDragEnd:s,onClick:u,onKeyDown:d,onContextMenu:c,children:[(0,k.jsx)(`span`,{className:f(L.FLEXLAYOUT__GROUP_PILL_NAME),children:n.getName()}),!n.isOpened()&&(0,k.jsx)(`span`,{"aria-hidden":`true`,className:f(L.FLEXLAYOUT__GROUP_PILL_COUNT),children:n.getChildren().length})]})};pt.displayName=`GroupPill`;var mt=e=>{let{controller:t,groupNode:n,path:r}=e,i=O.useRef(null),a=O.useCallback(e=>{i.current=e,t.registerMeasurable(n,`groupendmarker`,e)},[t,n]),o=e=>{t.doAction(R.updateNodeAttributes(n.getId(),{opened:!n.isOpened()})),e.stopPropagation()},s=n.getColor(),c={backgroundColor:s,borderColor:s};return(0,k.jsx)(`div`,{ref:a,"data-layout-path":r,title:n.getName(),"aria-hidden":!0,className:t.getClassName(L.FLEXLAYOUT__GROUP_END_MARKER),style:c,onClick:o})};mt.displayName=`GroupEndMarker`;var ht=e=>{let{controller:t,tabNode:n}=e,r=t.getClassName,i=r(L.FLEXLAYOUT__TAB_BUTTON_STAMP),a=je(t,n),o=a.content?(0,k.jsx)(`div`,{className:r(L.FLEXLAYOUT__TAB_BUTTON_CONTENT),children:a.content}):n.getNameForOverflowMenu(),s=a.leading?(0,k.jsx)(`div`,{className:r(L.FLEXLAYOUT__TAB_BUTTON_LEADING),children:a.leading}):null;return(0,k.jsxs)(`div`,{className:i,title:n.getHelpText(),children:[s,o]})};ht.displayName=`TabButtonStamp`;var gt=500;function _t(e){return typeof e.getBoundingClientRect==`function`}function vt(e){return e.container?e.container:_t(e.anchor)?e.anchor.ownerDocument.body:document.body}function yt(e){if(_t(e))return e.getBoundingClientRect();if(`right`in e&&`bottom`in e)return e;let t=e;return new DOMRect(t.x,t.y,0,0)}function bt(e,t){let n=t,{left:r,right:i,top:a,bottom:o}=e,s={};return(r+i)/2<n.left+n.width/2?s.left=r-n.left:s.right=n.right-i,(a+o)/2<n.top+n.height/2?s.top=a-n.top:s.bottom=n.bottom-o,s}var xt=e=>{let{anchor:t,items:n,onSelect:r,onClose:i,renderItem:a,title:o}=e,s=e.classNameMapper??(e=>e),c=vt(e),l=O.useRef(null),u=O.useRef(null),d=O.useRef({buffer:``,timer:void 0});O.useEffect(()=>()=>{d.current.timer&&clearTimeout(d.current.timer)},[]);let f=O.useCallback(e=>{e.disabled||((e.onSelect??r)?.(e),i())},[r,i]);O.useEffect(()=>{let n=c.ownerDocument;u.current?.contains(n.activeElement)||(u.current?.querySelector(`[role="menuitem"]:not([aria-disabled="true"])`)??u.current)?.focus();let r=e.returnFocusTo??(_t(t)?t:void 0);return()=>{r?.focus?.()}},[]),O.useEffect(()=>{let e=c.ownerDocument,t=e=>{l.current?.contains(e.target)||i()};return e.addEventListener(`pointerdown`,t),()=>e.removeEventListener(`pointerdown`,t)},[c,i]);let p=e=>{let t=Array.from(u.current?.querySelectorAll(`[role="menuitem"]:not([aria-disabled="true"])`)??[]),n=e.target.closest?.(`[role="menuitem"]`),r=n?t.indexOf(n):-1;if(e.key===`Escape`||e.key===`Tab`)i(),e.preventDefault();else if(e.key===`ArrowDown`||e.key===`ArrowUp`)t.length>0&&t[(r+(e.key===`ArrowDown`?1:-1)+t.length)%t.length]?.focus(),e.preventDefault();else if(e.key===`Home`||e.key===`End`)(e.key===`Home`?t[0]:t[t.length-1])?.focus(),e.preventDefault();else if(e.key.length===1&&e.key!==` `&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let n=d.current;n.timer&&clearTimeout(n.timer),n.buffer+=e.key.toLowerCase(),n.timer=setTimeout(()=>{n.buffer=``},gt);let i=[...n.buffer].every(e=>e===n.buffer[0]),a=i?n.buffer[0]:n.buffer,o=i?r+1:Math.max(r,0);for(let e=0;e<t.length;e++){let n=(o+e)%t.length;if((t[n].textContent??``).trim().toLowerCase().startsWith(a)){t[n].focus();break}}e.preventDefault()}else(e.key===`Enter`||e.key===` `)&&n&&(n.click(),e.preventDefault())},m=e=>({select:()=>f(e),close:i}),h=e=>(0,k.jsx)(`div`,{className:s(L.FLEXLAYOUT__POPUP_MENU_ITEM)+(e.disabled?` `+s(L.FLEXLAYOUT__POPUP_MENU_ITEM__DISABLED):``),role:`menuitem`,tabIndex:-1,"aria-disabled":e.disabled||void 0,onClick:t=>{f(e),t.stopPropagation()},children:e.content??(0,k.jsxs)(k.Fragment,{children:[e.icon,e.label]})},e.key),g=(0,k.jsx)(`div`,{ref:l,className:s(L.FLEXLAYOUT__POPUP_MENU_CONTAINER),style:bt(yt(t),c.getBoundingClientRect()),children:(0,k.jsx)(`div`,{ref:u,className:s(L.FLEXLAYOUT__POPUP_MENU),role:`menu`,"aria-label":o,tabIndex:0,onKeyDown:p,"data-layout-path":`/popup-menu`,children:n.map((e,t)=>e.type===`divider`?(0,k.jsx)(`div`,{className:s(L.FLEXLAYOUT__POPUP_MENU_DIVIDER),role:`separator`},e.key):a?a(e,t,m(e)):h(e))})});return(0,A.createPortal)(g,c)};function St(e){let t=vt(e),n=_t(e.anchor)?e.anchor.getBoundingClientRect():e.anchor,r=t.ownerDocument.createElement(`div`);t.appendChild(r);let i=(0,j.createRoot)(r),a=!1,o=()=>{a||(a=!0,i.unmount(),r.remove(),e.onClose())};return i.render((0,k.jsx)(xt,{...e,anchor:n,container:t,onClose:o})),o}function Ct(e,t,n,r,i,a){let o=i.getClassName,s=n.map(e=>({key:e.node.getId()}));return i.showOverlayOnAllWindows(!0),St({anchor:e,container:i.getRootDiv()??void 0,classNameMapper:o,returnFocusTo:e,title:i.i18nName(K.Overflow_Menu_Tooltip),items:s,onSelect:e=>{let t=s.indexOf(e);t>=0&&r(n[t])},renderItem:(e,r,a)=>{let s=n[r],c=s.node.getParent()instanceof U?s.node.getParent():void 0,l=c!==void 0,u=o(L.FLEXLAYOUT__POPUP_MENU_ITEM);l&&(u+=` `+o(L.FLEXLAYOUT__POPUP_MENU_ITEM_GROUPED)),t.getSelected()===s.index&&(u+=` `+o(L.FLEXLAYOUT__POPUP_MENU_ITEM__SELECTED));let d={};return l&&(d[`--flexlayout-group-color`]=c.getColor()),(0,k.jsx)(`div`,{className:u,role:`menuitem`,"aria-label":s.node.getNameForOverflowMenu(),tabIndex:-1,"data-layout-path":`/popup-menu/tb`+r,style:d,onClick:e=>{a.select(),e.stopPropagation()},draggable:!0,onDragStart:e=>{e.stopPropagation(),i.getDragDropManager().setDragNode(e.nativeEvent,s.node)},onDragEnd:()=>{i.getDragDropManager().onDragEnded(),a.close()},title:s.node.getHelpText(),children:(0,k.jsx)(ht,{tabNode:s.node,controller:i})},e.key)},onClose:()=>{i.showOverlayOnAllWindows(!1),a?.()}})}xt.displayName=`PopupMenu`;var wt=(e,t,n,r,i,a,o,s)=>{let[c,l]=O.useState([]),[u,d]=O.useState(!1),[f,p]=O.useState(!1),m=O.useRef(!1),h=O.useRef(void 0),g=O.useRef([]),_=O.useRef(0),v=O.useRef(!1),y=O.useRef(0);O.useEffect(()=>()=>{h.current!==void 0&&clearTimeout(h.current)},[]),O.useLayoutEffect(()=>{g.current=c});let b=O.useCallback(e=>{n===P.HORZ?r.current.scrollLeft=e:r.current.scrollTop=e},[n,r]),x=O.useCallback(e=>n===P.HORZ?e.scrollLeft:e.scrollTop,[n]),S=O.useCallback(e=>n===P.HORZ?e.clientWidth:e.clientHeight,[n]),C=O.useCallback(e=>n===P.HORZ?e.scrollWidth:e.scrollHeight,[n]),w=O.useCallback(e=>n===P.HORZ?e.width:e.height,[n]),ee=O.useCallback(e=>n===P.HORZ?e.x:e.y,[n]),T=O.useCallback(e=>n===P.HORZ?e.right:e.bottom,[n]),E=O.useCallback(()=>{let e=[];if(r.current){let t=r.current,n=t.getBoundingClientRect(),i=ee(n)-1,a=T(n)+1,s=t.firstElementChild,c=0;Array.from(s.children).forEach(t=>{let n=t.getBoundingClientRect();t.classList.contains(o)&&((ee(n)<i||T(n)>a)&&e.push(c),c++)})}return e},[o,r,ee,T]),D=O.useCallback(()=>{if(r.current&&i.current){let e=r.current,t=i.current,a=S(e),o=C(e),s=x(e);if(o>a&&o>0){let e=a*a/o,r=0;e<20&&(r=20-e,e=20);let i=s*(a-r)/o;n===P.HORZ?(t.style.width=e+`px`,t.style.left=i+`px`):(t.style.height=e+`px`,t.style.top=i+`px`),t.style.display=`block`}else t.style.display=`none`;n===P.HORZ?t.style.bottom=`0px`:t.style.right=`0px`}},[n,r,i,S,C,x]),k=O.useCallback((e=!1)=>{let t=E(),n=t.length>0;n!==u&&d(n),e?l(t):h.current===void 0&&(h.current=setTimeout(()=>{let e=E();Tt(e,g.current)||l(e),h.current=void 0},100))},[E,u]),A=O.useCallback(()=>{let n=t.getSelectedNode();if(n&&r.current){let t=e.getBoundingClientRect(r.current),i=r.current.ownerDocument.getElementById(Me(`flexlayout-tabbutton-`,n.getId()));if(!i)return;let a=e.getBoundingClientRect(i),o=ee(t)-ee(a);o>0||w(a)>w(t)?(b(x(r.current)-o),v.current=!0):(o=T(a)-T(t),o>0&&(b(x(r.current)+o),v.current=!0))}},[t,e,r,ee,T,w,x,b]),j=O.useCallback(()=>{if(r.current){let e=r.current,t=0;for(let n of Array.from(e.children))t+=S(n);if(s?.current){let e=S(s.current);e>0&&(y.current=e)}let n=y.current,i=t+(f?n:0)>S(r.current);i!==f&&p(i)}},[r,s,f,S]),te=O.useCallback(()=>{v.current||(m.current=!0),v.current=!1,D(),k()},[D,k]),ne=O.useCallback((e,t)=>{if(r.current&&i.current){let a=r.current,o=i.current,s=S(a),c=C(a),l=S(o),u=a.getBoundingClientRect(),d;if(d=n===P.HORZ?e-u.x-_.current:t-u.y-_.current,d=Math.max(0,Math.min(c-l,d)),s>0){let e=d*c/s;b(e)}}},[r,i,n,S,C,b]),re=O.useCallback(()=>{},[]),ie=O.useCallback(()=>{},[]),ae=O.useCallback(e=>{e.stopPropagation(),i.current.setPointerCapture(e.pointerId);let t=i.current.getBoundingClientRect();n===P.HORZ?_.current=e.clientX-t.x:_.current=e.clientY-t.y,Ue(e.currentTarget.ownerDocument,e,ne,re,ie)},[i,n,ne,re,ie]),M=O.useCallback(e=>{if(!r.current||t.getChildren().length===0)return;let i=Math.abs(e.deltaX),a=Math.abs(e.deltaY);if(i===0&&a===0)return;let o;o=n===P.HORZ?i>a?e.deltaX:e.deltaY:a>i?e.deltaY:e.deltaX,e.deltaMode===1&&(o*=40);let s=C(r.current)-S(r.current);if(s<=0)return;let c=x(r.current)+o;b(Math.max(0,Math.min(s,c))),e.stopPropagation()},[t,r,n,x,C,S,b]),N=O.useCallback(e=>{let t=r.current;t&&(C(t)-S(t)<=0||e.preventDefault())},[r,C,S]),F=t.getId(),I=t.getSelectedNode();return O.useLayoutEffect(()=>{r.current&&b(0)},[F,r,b]),O.useLayoutEffect(()=>{m.current=!1},[I]),O.useLayoutEffect(()=>{j(),m.current===!1&&A(),D(),k(!0);let e=requestAnimationFrame(()=>{k()});return()=>cancelAnimationFrame(e)},[j,A,D,k,n,I]),O.useLayoutEffect(()=>{let t=r.current;if(!t)return;let n=t.ownerDocument.defaultView,i=new n.ResizeObserver(()=>{j();let t=e.isSplitterDragging();(!m.current||t)&&(t&&(m.current=!1),A()),D(),k()});i.observe(t);let a=t.firstElementChild,o=new n.MutationObserver(()=>{k()});return a&&o.observe(a,{childList:!0,subtree:!0}),()=>{i.disconnect(),o.disconnect()}},[j,A,D,k,r,e]),O.useLayoutEffect(()=>{let e=s?.current;if(!e)return;let t=new e.ownerDocument.defaultView.ResizeObserver(()=>{j()});return t.observe(e),()=>t.disconnect()},[j,s,f]),O.useEffect(()=>{if(t instanceof H&&t.isEnableTabWrap())return;let e=a.current;return e?.addEventListener(`wheel`,N,{passive:!1}),()=>{e?.removeEventListener(`wheel`,N)}}),{userControlledPositionRef:m,onScroll:te,onScrollPointerDown:ae,hiddenTabs:c,onMouseWheel:M,isDockStickyButtons:f,isShowHiddenTabs:u}};function Tt(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}var Et=e=>{let{borderNode:t,controller:n,size:r}=e,i=O.useRef(null),a=O.useRef(null),o=O.useRef(null),s=O.useRef(null),c=O.useRef(null),l=O.useRef(null),[u,d]=O.useState(!1),f=O.useRef(null),p=n.getIcons();O.useEffect(()=>()=>f.current?.(),[]);let{userControlledPositionRef:m,onScroll:h,onScrollPointerDown:g,hiddenTabs:_,onMouseWheel:v,isDockStickyButtons:y,isShowHiddenTabs:b}=wt(n,t,P.flip(t.getOrientation()),l,o,i,n.getClassName(L.FLEXLAYOUT__BORDER_BUTTON),c),x=O.useCallback(e=>{i.current=e,n.registerMeasurable(t,`borderheader`,e)},[n,t]),S=e=>{ze(e)&&n.auxMouseClick(t,e)},C=e=>{n.showContextMenu(t,e)},w=e=>{e.stopPropagation()},ee=e=>{let r=n.getShowOverflowMenu(),i=t.getTabNodes(),a=_.map(e=>({index:e,node:i[e]}));if(r!==void 0)r(t,e,a,T);else{let e=s.current;d(!0),f.current=Ct(e,t,a,T,n,()=>{d(!1),f.current=null})}e.stopPropagation()},T=e=>{n.doAction(R.selectTab(e.node.getId())),m.current=!1},E=e=>{let r=t.getSelectedNode();r!==void 0&&n.doAction(R.popoutTab(r.getId(),`window`)),e.stopPropagation()},D=e=>{let r=t.getSelectedNode();r!==void 0&&n.doAction(R.popoutTab(r.getId(),`float`)),e.stopPropagation()},A=n.getClassName,j=()=>{let e=[],r=n.getModel().getTabGroupType()===`splitpill`,i=0,a=!1,o=0,s=()=>(0,k.jsx)(`div`,{className:A(L.FLEXLAYOUT__BORDER_TAB_DIVIDER)},`divider`+o++),c=t.getLocation()===F.LEFT&&n.getModel().getBorderLeftTabDirection()!==`down`;for(let o of t.getChildren()){if(o instanceof U){let l=o.getChildren();if(c&&o.isOpened()){a&&e.push(s()),r&&e.push((0,k.jsx)(mt,{controller:n,groupNode:o,path:o.getPath()+`/end`},o.getId()+`/end`));let c=i;for(let r=l.length-1;r>=0;r--){let i=t.getSelected()===c+r;r<l.length-1&&e.push(s()),e.push((0,k.jsx)(ft,{controller:n,border:t.getLocation().getName(),tabNode:l[r],path:Ne(l[r]),selected:i,icons:p},l[r].getId()))}i+=l.length,e.push((0,k.jsx)(pt,{controller:n,groupNode:o,path:o.getPath()},o.getId())),a=!0}else if(a&&e.push(s()),e.push((0,k.jsx)(pt,{controller:n,groupNode:o,path:o.getPath()},o.getId())),a=!0,o.isOpened()){for(let r=0;r<l.length;r++){let a=t.getSelected()===i;r>0&&e.push(s()),e.push((0,k.jsx)(ft,{controller:n,border:t.getLocation().getName(),tabNode:l[r],path:Ne(l[r]),selected:a,icons:p},l[r].getId())),i++}r&&e.push((0,k.jsx)(mt,{controller:n,groupNode:o,path:o.getPath()+`/end`},o.getId()+`/end`))}continue}let l=o,u=t.getSelected()===i;a&&e.push(s()),e.push((0,k.jsx)(ft,{controller:n,border:t.getLocation().getName(),tabNode:l,path:Ne(l),selected:u,icons:p},l.getId())),a=!0,i++}return e},te=()=>{let e,r=[],i=[],o,l={leading:e,buttons:r,stickyButtons:i,overflowPosition:void 0};if(n.customizeTabSet(t,l),e=l.leading,i=l.stickyButtons,r=l.buttons,l.overflowPosition===void 0&&(l.overflowPosition=i.length),i.length>0&&(y?r=[...i,...r]:o=(0,k.jsx)(`div`,{ref:c,onPointerDown:w,onDragStart:e=>{e.preventDefault()},className:A(L.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER),children:i},`sticky_buttons_container`)),b){let e=n.i18nName(K.Overflow_Menu_Tooltip),i;if(typeof p.more==`function`){let e=t.getTabNodes(),n=_.map(t=>({index:t,node:e[t]}));i=p.more(t,n)}else i=(0,k.jsxs)(k.Fragment,{children:[p.more,(0,k.jsx)(`div`,{className:A(L.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT),children:_.length>0?_.length:``})]});r.splice(Math.min(l.overflowPosition,r.length),0,(0,k.jsx)(`button`,{tabIndex:0,"aria-haspopup":`menu`,"aria-expanded":u,"aria-label":e,ref:s,className:A(L.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON)+` `+A(L.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW)+` `+A(L.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW_+t.getLocation().getName()),title:e,onClick:ee,onPointerDown:w,children:i},`overflowbutton`))}if(t.getSelected()!==-1){let e=t.getSelectedNode();if(e!==void 0&&n.isMainLayout()){if(e.isEnableFloat()&&e.isEnableFloatIcon()){let t=n.i18nName(K.Popout_Tab_Float);r.push((0,k.jsx)(`button`,{tabIndex:0,title:t,"aria-label":t,className:A(L.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON)+` `+A(L.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT),onClick:D,onPointerDown:w,children:typeof p.popoutFloat==`function`?p.popoutFloat(e):p.popoutFloat},`popout-float`))}if(n.isSupportsPopout()&&e.isEnablePopoutIcon()&&e.isAllowedInWindow()){let t=n.i18nName(K.Popout_Tab);r.push((0,k.jsx)(`button`,{tabIndex:0,title:t,"aria-label":t,className:A(L.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON)+` `+A(L.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT),onClick:E,onPointerDown:w,children:typeof p.popout==`function`?p.popout(e):p.popout},`popout`))}}}let d=(0,k.jsx)(`div`,{ref:a,className:A(L.FLEXLAYOUT__BORDER_TOOLBAR)+` `+A(L.FLEXLAYOUT__BORDER_TOOLBAR_+t.getLocation().getName()),children:r},`toolbar`);return{leading:e,toolbar:d,stickyBar:o}},ne=j(),{leading:re,toolbar:ie,stickyBar:ae}=te(),M=A(L.FLEXLAYOUT__BORDER)+` `+A(L.FLEXLAYOUT__BORDER_+t.getLocation().getName());t.getClassName()!==void 0&&(M+=` `+t.getClassName());let N,I,z=r-1;t.getLocation()===F.LEFT?(N=n.getModel().getBorderLeftTabDirection()===`down`?{left:`100%`,top:0}:{right:`100%`,top:0},I={width:z,overflowY:`auto`}):t.getLocation()===F.RIGHT?(N={left:`100%`,top:0},I={width:z,overflowY:`auto`}):(N={left:0},I={height:z,overflowX:`auto`});let oe;t.isEnableTabScrollbar()&&(oe=(0,k.jsx)(`div`,{ref:o,"aria-hidden":`true`,className:A(L.FLEXLAYOUT__MINI_SCROLLBAR),onPointerDown:g}));let se;re&&(se=(0,k.jsx)(`div`,{className:A(L.FLEXLAYOUT__BORDER_LEADING),children:re}));let ce=A(L.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER)+` `+A(L.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER_+t.getLocation().getName())+(t.getLocation()===F.LEFT&&n.getModel().getBorderLeftTabDirection()===`down`?` `+A(L.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER_LEFT_DOWN):``);return(0,k.jsxs)(`div`,{ref:x,style:{display:`flex`,flexDirection:t.getOrientation()===P.VERT?`row`:`column`},className:M,"data-layout-path":t.getPath(),onClick:S,onAuxClick:S,onContextMenu:C,onWheel:v,children:[se,(0,k.jsxs)(`div`,{className:A(L.FLEXLAYOUT__MINI_SCROLLBAR_CONTAINER),children:[(0,k.jsxs)(`div`,{ref:l,className:A(L.FLEXLAYOUT__BORDER_INNER)+` `+A(L.FLEXLAYOUT__BORDER_INNER_+t.getLocation().getName()),style:I,onScroll:h,children:[(0,k.jsx)(`div`,{style:N,role:n.getEditingTab()?.getParent()===t?void 0:`tablist`,"aria-orientation":n.getEditingTab()?.getParent()!==t&&(t.getLocation()===F.LEFT||t.getLocation()===F.RIGHT)?`vertical`:void 0,className:ce,children:ne}),ae]}),oe]}),ie]})};Et.displayName=`BorderTabSet`;var Dt=e=>{let{controller:t,node:n,index:r,horizontal:i}=e,a=O.useRef(null),o=O.useRef([]),s=O.useRef(void 0),c=O.useRef(void 0),l=O.useRef(0),u=O.useRef(0),d=O.useRef({initialSizes:[],sum:0,startPosition:0}),f=O.useRef(void 0),p=O.useCallback(e=>{e.preventDefault(),e.stopImmediatePropagation()},[]);O.useEffect(()=>{let e=a.current;return e?.addEventListener(`touchstart`,p,{passive:!1}),()=>{e?.removeEventListener(`touchstart`,p),f.current!==void 0&&(clearTimeout(f.current),f.current=void 0),s.current&&(t.getRootDiv()?.removeChild(s.current),s.current=void 0,Be(!0,t.getCurrentDocument()),t.setSplitterDragging(!1))}},[p,t]);let m=e=>{e.stopPropagation(),n instanceof xe&&(d.current=n.getSplitterInitials(r)),t.setSplitterDragging(!0),Be(!1,t.getCurrentDocument()),Ue(e.currentTarget.ownerDocument,e,_,v,g),o.current=n instanceof W?n.getSplitterBounds(!0):n.getSplitterBounds(r);let f=t.getRootDiv();s.current=t.getCurrentDocument().createElement(`div`),s.current.style.flexDirection=i?`row`:`column`,s.current.className=t.getClassName(L.FLEXLAYOUT__SPLITTER_DRAG)+(n instanceof W?` `+t.getClassName(L.FLEXLAYOUT__SPLITTER_BORDER):``),s.current.style.cursor=n.getOrientation()===P.VERT?`ns-resize`:`ew-resize`,c.current=t.getCurrentDocument().createElement(`div`),c.current.className=x(L.FLEXLAYOUT__SPLITTER_HANDLE)+` `+x(i?L.FLEXLAYOUT__SPLITTER_HANDLE_HORZ:L.FLEXLAYOUT__SPLITTER_HANDLE_VERT),s.current.appendChild(c.current);let p=a.current.getBoundingClientRect(),m=new N(p.x-t.getDomRect().x,p.y-t.getDomRect().y,p.width,p.height);l.current=e.clientX-p.x,u.current=e.clientY-p.y,m.positionElement(s.current),f&&f.appendChild(s.current)},h=e=>{if(Fe(e))return;let a=0;if(i?(e.key===`ArrowLeft`&&(a=-10),e.key===`ArrowRight`&&(a=10)):(e.key===`ArrowUp`&&(a=-10),e.key===`ArrowDown`&&(a=10)),a!==0){if(e.preventDefault(),t.setSplitterDragging(!0),n instanceof W){let e=n.getLocation(),r=e===F.BOTTOM||e===F.RIGHT?-a:a,i=Math.max(n.getMinSize(),Math.min(n.getMaxSize(),n.getSize()+r));t.doAction(R.adjustBorderSplit(n.getId(),i))}else{let e=n.getSplitterInitials(r);if(e.sum<=0){t.setSplitterDragging(!1);return}let i=n.getSplitterBounds(r),o=Math.max(i[0],Math.min(i[1],e.startPosition+a)),s=n.calculateSplit(r,o,e.initialSizes,e.sum,e.startPosition);t.doAction(R.adjustWeights(n.getId(),s))}setTimeout(()=>t.setSplitterDragging(!1),300)}},g=()=>{if(s.current){t.isRealtimeResize()&&y(!1);let e=t.getRootDiv();e&&s.current&&e.removeChild(s.current),s.current=void 0}f.current=window.setTimeout(()=>t.setSplitterDragging(!1),300),Be(!0,t.getCurrentDocument())},_=(e,r)=>{if(s.current){let i=t.getDomRect();if(!i)return;n.getOrientation()===P.VERT?s.current.style.top=b(r-i.y-u.current)+`px`:s.current.style.left=b(e-i.x-l.current)+`px`,t.isRealtimeResize()&&y(!0)}},v=()=>{if(s.current){y(!1);let e=t.getRootDiv();e&&s.current&&e.removeChild(s.current),s.current=void 0}f.current=window.setTimeout(()=>t.setSplitterDragging(!1),300),Be(!0,t.getCurrentDocument())},y=e=>{(()=>{if(s.current){let i;if(i=n.getOrientation()===P.VERT?s.current.offsetTop:s.current.offsetLeft,n instanceof W){let r=n.calculateSplit(n,i);t.doAction(R.adjustBorderSplit(n.getId(),r).setAdjusting(e))}else{let a=d.current;if(a.sum<=0)return;let o=n.calculateSplit(r,i,a.initialSizes,a.sum,a.startPosition);t.doAction(R.adjustWeights(n.getId(),o).setAdjusting(e))}}})()},b=e=>{let t=o.current,n=e;return e<t[0]&&(n=t[0]),e>t[1]&&(n=t[1]),n},x=t.getClassName,S={cursor:i?`ew-resize`:`ns-resize`,flexDirection:i?`column`:`row`},C=x(L.FLEXLAYOUT__SPLITTER)+` `+x(L.FLEXLAYOUT__SPLITTER_+n.getOrientation().getName());n instanceof W?C+=` `+x(L.FLEXLAYOUT__SPLITTER_BORDER):n.getModel().getMaximizedTabset(t.getLayoutId())!==void 0&&(S.display=`none`),Ae()||(S[`--fl-splitter-active-size`]=`30px`);let w,ee,T,E;if(n instanceof xe){let e=n.getRect(),t=n.getChildren()[r-1],a=i?e.width:e.height;if(t&&a>0){let n=t.getRect();w=Math.round((i?n.getRight()-e.x:n.getBottom()-e.y)/a*100),ee=0,T=100,E=w+`%`}}else w=Math.round(n.getSize()),ee=Math.round(n.getMinSize()),T=Math.round(n.getMaxSize()),E=w+`px`;return(0,k.jsx)(`div`,{className:C,style:S,ref:a,role:`separator`,"aria-label":t.i18nName(K.Splitter),"aria-orientation":i?`vertical`:`horizontal`,"aria-valuenow":w,"aria-valuemin":ee,"aria-valuemax":T,"aria-valuetext":E,tabIndex:0,onKeyDown:h,"data-layout-path":n.getPath()+`/s`+(r-1),onPointerDown:m,children:(0,k.jsx)(`div`,{className:x(L.FLEXLAYOUT__SPLITTER_HANDLE)+` `+x(i?L.FLEXLAYOUT__SPLITTER_HANDLE_HORZ:L.FLEXLAYOUT__SPLITTER_HANDLE_VERT)})})};Dt.displayName=`Splitter`;function Ot(e){let{controller:t,borderNode:n,show:r}=e,i=O.useRef(null),a=O.useCallback(e=>{i.current=e,t.registerMeasurable(n,`bordercontent`,e)},[t,n]),o=!0,s={};n.getOrientation()===P.HORZ?(s.width=n.getSize(),s.minWidth=n.getMinSize(),s.maxWidth=n.getMaxSize()):(s.height=n.getSize(),s.minHeight=n.getMinSize(),s.maxHeight=n.getMaxSize(),o=!1);let c=t.getClassName(L.FLEXLAYOUT__BORDER_TAB_CONTENTS),l=n.getLocation()===F.LEFT||n.getLocation()===F.TOP;if(n.isOverlay()){s.display=`flex`;let e={display:r?`flex`:`none`};if(o){let r=t.getModel();for(let t of r.getBorderSet().getBorders())if(t!==n&&t.isOverlay()&&t.isShowing()&&t.getSelected()!==-1){let n=t.getSize()+r.getSplitterSize();t.getLocation()===F.TOP?e.top=n:t.getLocation()===F.BOTTOM&&(e.bottom=n)}}let i=t.getClassName(L.FLEXLAYOUT__BORDER_TAB_OVERLAY)+` `+t.getClassName(L.FLEXLAYOUT__BORDER_TAB_OVERLAY_+n.getLocation().getName());return(0,k.jsxs)(`div`,{className:i,style:e,children:[l&&(0,k.jsx)(`div`,{ref:a,style:s,className:c}),r&&(0,k.jsx)(Dt,{controller:t,node:n,index:0,horizontal:o}),!l&&(0,k.jsx)(`div`,{ref:a,style:s,className:c})]})}return s.display=r?`flex`:`none`,l?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`div`,{ref:a,style:s,className:c}),r&&(0,k.jsx)(Dt,{controller:t,node:n,index:0,horizontal:o})]}):(0,k.jsxs)(k.Fragment,{children:[r&&(0,k.jsx)(Dt,{controller:t,node:n,index:0,horizontal:o}),(0,k.jsx)(`div`,{ref:a,style:s,className:c})]})}Ot.displayName=`BorderTab`;var kt=({controller:e,inner:t})=>{let n=e.getClassName(L.FLEXLAYOUT__LAYOUT_MAIN),r=e.getModel().getBorderSet().getBorderMap();if(e.isMainLayout()&&r.size>0){let i=(0,k.jsx)(`div`,{className:n,ref:e.getMainRef(),children:t}),a=new Map,o=new Map;for(let[t,n]of F.values){let t=r.get(n);t&&t.isShowing()&&(!t.isAutoHide()||t.isAutoHide()&&(t.getChildren().length>0||e.getState().showHiddenBorder===n))&&(a.set(n,(0,k.jsx)(Et,{controller:e,borderNode:t,size:e.getState().calculatedBorderBarSize})),o.set(n,(0,k.jsx)(Ot,{controller:e,borderNode:t,show:t.getSelected()!==-1})))}let s=e.getClassName(L.FLEXLAYOUT__LAYOUT_BORDER_CONTAINER),c=e.getClassName(L.FLEXLAYOUT__LAYOUT_BORDER_CONTAINER_INNER),l=(0,k.jsxs)(`div`,{className:c,style:{flexDirection:`column`},children:[o.get(F.TOP),(0,k.jsxs)(`div`,{className:c,style:{flexDirection:`row`},children:[o.get(F.LEFT),i,o.get(F.RIGHT)]}),o.get(F.BOTTOM)]});return(0,k.jsxs)(`div`,{className:s,style:{flexDirection:`column`},children:[a.get(F.TOP),(0,k.jsxs)(`div`,{className:c,style:{flexDirection:`row`},children:[a.get(F.LEFT),l,a.get(F.RIGHT)]}),a.get(F.BOTTOM)]})}return(0,k.jsx)(`div`,{className:n,ref:e.getMainRef(),style:{position:`absolute`,top:0,left:0,bottom:0,right:0,display:`flex`},children:t})};kt.displayName=`BorderContainer`;var At={width:`1em`,height:`1em`,display:`flex`,alignItems:`center`},jt=()=>(0,k.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:At,viewBox:`0 0 24 24`,children:[(0,k.jsx)(`path`,{fill:`none`,d:`M0 0h24v24H0z`}),(0,k.jsx)(`path`,{stroke:`var(--fl-color-icon)`,fill:`var(--fl-color-icon)`,d:`M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z`})]});jt.displayName=`CloseIcon`;var Mt=()=>(0,k.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:At,viewBox:`0 0 24 24`,fill:`var(--fl-color-icon)`,children:[(0,k.jsx)(`path`,{fill:`none`,d:`M0 0h24v24H0z`}),(0,k.jsx)(`path`,{transform:`rotate(45 12 12)`,d:`M16 9V4h1a1 1 0 000-2H7a1 1 0 000 2h1v5c0 1.66-1.34 3-3 3v2h5.97v7l1 1 1-1v-7H19v-2c-1.66 0-3-1.34-3-3z`})]});Mt.displayName=`PinIcon`;var Nt=()=>(0,k.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:At,viewBox:`0 0 24 24`,fill:`var(--fl-color-icon)`,children:[(0,k.jsx)(`path`,{d:`M0 0h24v24H0z`,fill:`none`}),(0,k.jsx)(`path`,{stroke:`var(--fl-color-icon)`,d:`M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z`})]});Nt.displayName=`MaximizeIcon`;var Pt=()=>(0,k.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:At,viewBox:`0 0 24 24`,fill:`var(--fl-color-icon)`,children:[(0,k.jsx)(`path`,{d:`M0 0h24v24H0z`,fill:`none`}),(0,k.jsx)(`path`,{stroke:`var(--fl-color-icon)`,d:`M7 10l5 5 5-5z`})]});Pt.displayName=`OverflowIcon`;var Ft=()=>(0,k.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:{display:`block`,width:10,height:10},preserveAspectRatio:`none`,viewBox:`0 0 100 100`,children:(0,k.jsx)(`path`,{fill:`var(--fl-color-edge-icon)`,stroke:`var(--fl-color-edge-icon)`,d:`M10 30 L90 30 l-40 40 Z`})});Ft.displayName=`EdgeIcon`;var It=()=>(0,k.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:At,viewBox:`0 0 20 20`,fill:`var(--fl-color-icon)`,children:[(0,k.jsx)(`path`,{d:`M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z`}),(0,k.jsx)(`path`,{d:`M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z`})]});It.displayName=`PopoutIcon`;var Lt=()=>(0,k.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 -960 960 960`,style:At,fill:`var(--fl-color-icon)`,children:(0,k.jsx)(`path`,{d:`M360-280q-33 0-56.5-23.5T280-360v-400q0-33 23.5-56.5T360-840h400q33 0 56.5 23.5T840-760v400q0 33-23.5 56.5T760-280H360Zm0-80h400v-400H360v400ZM200-200v80q-33 0-56.5-23.5T120-200h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z`})});Lt.displayName=`PopoutFloatIcon`;var q=()=>(0,k.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,style:At,fill:`var(--fl-color-icon)`,children:(0,k.jsx)(`path`,{d:`M4 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm0 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm0 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm6-12a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm0 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm0 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm6-12a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm0 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm0 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z`})});q.displayName=`GripIcon`;var Rt=()=>(0,k.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:At,viewBox:`0 0 24 24`,fill:`var(--fl-color-icon)`,children:[(0,k.jsx)(`path`,{d:`M0 0h24v24H0z`,fill:`none`}),(0,k.jsx)(`path`,{stroke:`var(--fl-color-icon)`,d:`M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z`})]});Rt.displayName=`RestoreIcon`;var zt=()=>(0,k.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:At,height:`24px`,viewBox:`0 -960 960 960`,width:`24px`,children:(0,k.jsx)(`path`,{fill:`var(--fl-color-icon)`,stroke:`var(--fl-color-icon)`,d:`M440-120v-264L254-197l-57-57 187-186H120v-80h264L197-706l57-57 186 187v-264h80v264l186-187 57 57-187 186h264v80H576l187 186-57 57-186-187v264h-80Z`})});zt.displayName=`AsterickIcon`;var Bt=e=>{let{controller:t,tabNode:n,selected:r,path:i}=e,a=O.useRef(null),o=O.useRef(null),s=t.getIcons(),c=t.getKeyMap(),l=t.getEditingTab()===n,u=O.useCallback(e=>{a.current=e,t.registerMeasurable(n,`tabbutton`,e)},[t,n]);O.useLayoutEffect(()=>{l&&o.current.select()},[l]),O.useEffect(()=>{if(l){let e=t.getCurrentDocument().body,n=e=>{e.target!==o.current&&t.setEditingTab(void 0)};return e.addEventListener(`pointerdown`,n),()=>e.removeEventListener(`pointerdown`,n)}},[l,t]);let d=e=>{n.isEnableDrag()?(e.stopPropagation(),t.getDragDropManager().setDragNode(e.nativeEvent,n)):e.preventDefault()},f=e=>{t.getDragDropManager().onDragEnded()},p=e=>{ze(e)&&t.auxMouseClick(n,e)},m=e=>{t.showContextMenu(n,e)},h=()=>{n.isSelected()||t.doAction(R.selectTab(n.getId()))},g=e=>{let t=a.current?.closest(`[role="tablist"]`);if(t){let n=Array.from(t.querySelectorAll(`[role="tab"]`));n[n.indexOf(a.current)+e]?.focus()}},_=()=>{let e=a.current.ownerDocument,t=()=>Re(e.getElementById(Me(`flexlayout-tab-`,n.getId())));r?t():(h(),requestAnimationFrame(t))},v=e=>{l||(Pe(e,c.focusTabToggle)?(_(),e.preventDefault()):e.key===`Enter`||e.key===` `?(r?_():h(),e.preventDefault()):(e.key===`ArrowLeft`||e.key===`ArrowUp`)&&!Fe(e)?(g(-1),e.preventDefault()):(e.key===`ArrowRight`||e.key===`ArrowDown`)&&!Fe(e)?(g(1),e.preventDefault()):Pe(e,c.closeTab)&&n.isCloseable()?(g(1),t.doAction(R.deleteTab(n.getId())),e.preventDefault()):Pe(e,c.renameTab)&&n.isEnableRename()&&(b(),e.preventDefault()))},y=e=>{n.isEnableRename()&&(b(),e.stopPropagation())},b=()=>{t.setEditingTab(n)},x=()=>{let e=n.getCloseType();return!!(r||e===ce.Always||e===ce.Visible&&t.getCurrentWindow()?.matchMedia(`(hover: hover) and (pointer: fine)`).matches)},S=e=>{x()&&(t.doAction(R.deleteTab(n.getId())),e.stopPropagation())},C=e=>{e.stopPropagation()},w=e=>{e.stopPropagation()},ee=e=>{e.code===`Escape`?(t.setEditingTab(void 0),a.current?.focus()):(e.code===`Enter`||e.code===`NumpadEnter`)&&(t.setEditingTab(void 0),t.doAction(R.renameTab(n.getId(),e.target.value)),a.current?.focus())},T=t.getClassName,E=n.getTabContainer(),D=n.getParent()instanceof U?n.getParent():void 0,A=E.isEnableSingleTabStretch()&&E.getChildren().length===1&&E.getChildren()[0]===n,j=A?L.FLEXLAYOUT__TAB_BUTTON_STRETCH:L.FLEXLAYOUT__TAB_BUTTON,te=T(j);te+=` `+T(j+`_`+E.getTabLocation()),A||(te+=r?` `+T(j+`--selected`):` `+T(j+`--unselected`)),n.isPinned()&&(te+=` `+T(j+`--pinned`)),D!==void 0&&(te+=` `+T(L.FLEXLAYOUT__TAB_BUTTON_GROUPED),n.getModel().getTabGroupType()===`underline`&&(te+=` `+T(L.FLEXLAYOUT__TAB_BUTTON_GROUPED_UNDERLINE))),n.getClassName()!==void 0&&(te+=` `+n.getClassName());let ne=je(t,n),re=r||E.getSelectedNode()===void 0&&E.getTabNodes()[0]===n,ie=[Le(c.focusTabToggle),n.isCloseable()?Le(c.closeTab):void 0,n.isEnableRename()?Le(c.renameTab):void 0].filter(Boolean).join(` `)||void 0,ae=ne.content?(0,k.jsx)(`div`,{className:T(L.FLEXLAYOUT__TAB_BUTTON_CONTENT),children:ne.content}):null,M=ne.leading?(0,k.jsx)(`div`,{className:T(L.FLEXLAYOUT__TAB_BUTTON_LEADING),children:ne.leading}):null;if(l&&(ae=(0,k.jsx)(`input`,{ref:o,className:T(L.FLEXLAYOUT__TAB_BUTTON_TEXTBOX),"data-layout-path":i+`/textbox`,type:`text`,"aria-label":t.i18nName(K.Rename_Tab),autoFocus:!0,defaultValue:n.getName(),onKeyDown:ee,onPointerDown:w})),n.isPinned()){let e=t.i18nName(K.Pinned_Tab);ne.buttons.push((0,k.jsx)(`div`,{"data-layout-path":i+`/button/pin`,title:e,"aria-hidden":`true`,className:T(L.FLEXLAYOUT__TAB_BUTTON_PIN),children:typeof s.pin==`function`?s.pin(n):s.pin},`pin`))}if(n.isCloseable()&&!A){let e=t.i18nName(K.Close_Tab);ne.buttons.push((0,k.jsx)(`div`,{"data-layout-path":i+`/button/close`,title:e,"aria-hidden":`true`,className:T(L.FLEXLAYOUT__TAB_BUTTON_TRAILING),onPointerDown:C,onClick:S,children:typeof s.close==`function`?s.close(n):s.close},`close`))}let N={};return D!==void 0&&(N[`--flexlayout-group-color`]=D.getColor()),(0,k.jsxs)(`div`,{ref:u,id:Me(`flexlayout-tabbutton-`,n.getId()),role:l?void 0:`tab`,"aria-selected":l?void 0:r,"aria-controls":l?void 0:Me(`flexlayout-tab-`,n.getId()),"aria-label":l?void 0:n.isPinned()?ne.name+` (`+t.i18nName(K.Pinned_Tab)+`)`:ne.name,"aria-keyshortcuts":l?void 0:ie,tabIndex:l?-1:re?0:-1,onKeyDown:v,"data-layout-path":i,className:te,style:N,onClick:h,onAuxClick:p,onContextMenu:m,title:n.getHelpText(),draggable:!0,onDragStart:d,onDragEnd:f,onDoubleClick:y,children:[M,ae,ne.buttons]})};Bt.displayName=`TabButton`;var Vt=e=>{let{tabsetNode:t,controller:n}=e,r=O.useRef(null),i=O.useRef(null),a=O.useRef(null),o=O.useRef(null),s=O.useRef(null),c=O.useRef(null),l=O.useRef(null),u=O.useRef(null),[d,f]=O.useState(!1),p=O.useRef(null),m=n.getIcons();O.useEffect(()=>()=>p.current?.(),[]);let{userControlledPositionRef:h,onScroll:g,onScrollPointerDown:_,hiddenTabs:v,onMouseWheel:y,isDockStickyButtons:b,isShowHiddenTabs:x}=wt(n,t,P.HORZ,o,a,i,n.getClassName(L.FLEXLAYOUT__TAB_BUTTON),u),S=O.useCallback(e=>{r.current=e,n.registerMeasurable(t,`tabset`,e)},[n,t]),C=O.useCallback(e=>{i.current=e,n.registerMeasurable(t,`tabstrip`,e)},[n,t]),w=O.useCallback(e=>{s.current=e,n.registerMeasurable(t,`tabsetcontent`,e)},[n,t]),ee=e=>{let r=n.getShowOverflowMenu(),i=t.getTabNodes(),a=v.map(e=>({index:e,node:i[e]}));if(r!==void 0)r(t,e,a,T);else{let e=l.current;f(!0),p.current=Ct(e,t,a,T,n,()=>{f(!1),p.current=null})}e.stopPropagation()},T=e=>{n.doAction(R.selectTab(e.node.getId())),h.current=!1},E=e=>{n.getEditingTab()?e.preventDefault():t.isEnableDrag()?(e.stopPropagation(),n.getDragDropManager().setDragNode(e.nativeEvent,t)):e.preventDefault()},D=e=>{n.getDragDropManager().onDragEnded()},j=e=>{!ze(e)&&!t.isActive()&&n.doAction(R.setActiveTabset(t.getId(),n.getLayoutId()))},te=e=>{ze(e)&&n.auxMouseClick(t,e)},ne=e=>{n.showContextMenu(t,e)},re=e=>{e.stopPropagation()},ie=e=>{t.canMaximize()&&n.maximize(t),e.stopPropagation()},ae=e=>{n.doAction(R.deleteTabset(t.getId())),e.stopPropagation()},M=e=>{n.doAction(R.deleteTab(t.getChildren()[0].getId())),e.stopPropagation()},N=e=>{oe!==void 0&&n.doAction(R.popoutTab(oe.getId(),`window`)),e.stopPropagation()},F=e=>{oe!==void 0&&n.doAction(R.popoutTab(oe.getId(),`float`)),e.stopPropagation()},I=e=>{t.canMaximize()&&n.maximize(t)},z=n.getClassName,oe=t.getSelectedNode(),se=t.getPath(),ce=t.getChildren(),le=t.isEnableSingleTabStretch()&&ce.length===1&&ce[0]instanceof G,ue=(e,n,r,i)=>{let a=z(L.FLEXLAYOUT__TABSET_TAB_SPACER);return i&&(a+=` `+z(L.FLEXLAYOUT__TABSET_TAB_DIVIDER)),!t.isEnableTabWrap()&&!le&&(n?a+=` `+z(L.FLEXLAYOUT__TABSET_TAB_DIVIDER_SELECTED_BEFORE):r&&(a+=` `+z(L.FLEXLAYOUT__TABSET_TAB_DIVIDER_SELECTED_AFTER))),(0,k.jsx)(`div`,{className:a,children:(0,k.jsx)(`div`,{className:z(L.FLEXLAYOUT__TABSET_TAB_DIVIDER_INNER)})},`divider`+e)},B=()=>{let e=[],r=n.getModel().getTabGroupType()===`splitpill`,i=0,a=0,o=!1,s=!1,c=!1;if(t.isEnableTabStrip()){for(let l of ce){if(l instanceof U){if(e.push(ue(a++,!1,o,c)),e.push((0,k.jsx)(pt,{controller:n,groupNode:l,path:l.getPath()},l.getId())),c=!0,s=!1,l.isOpened()){let u=l.getChildren();for(let r=0;r<u.length;r++){let l=u[r],d=t.getSelected()===i;e.push(ue(a++,d,o,r>0)),e.push((0,k.jsx)(Bt,{controller:n,tabNode:l,path:Ne(l),selected:d},l.getId())),o=d,s=!0,c=!0,i++}r&&(e.push(ue(a++,!1,o,!1)),e.push((0,k.jsx)(mt,{controller:n,groupNode:l,path:l.getPath()+`/end`},l.getId()+`/end`)),o=!1)}continue}let u=l,d=t.getSelected()===i;e.push(ue(a++,d,o,c)),e.push((0,k.jsx)(Bt,{controller:n,tabNode:u,path:Ne(u),selected:d},u.getId())),o=d,s=!0,c=!0,i++}if(s){let n=z(L.FLEXLAYOUT__TABSET_TAB_SPACER);!t.isEnableTabWrap()&&!le&&o&&(n+=` `+z(L.FLEXLAYOUT__TABSET_TAB_DIVIDER_SELECTED_AFTER)),e.push((0,k.jsx)(`div`,{className:n,children:(0,k.jsx)(`div`,{className:z(L.FLEXLAYOUT__TABSET_TAB_DIVIDER_INNER)})},`divider`+a))}}return e},V=()=>{let e,r=[],i=[],a={leading:e,stickyButtons:r,buttons:i,overflowPosition:void 0};n.customizeTabSet(t,a),e=a.leading,r=a.stickyButtons,i=a.buttons;let o=le,s=o&&t.getChildren()[0].isCloseable()||t.isCloseable();s&&=t.isEnableCloseButton(),a.overflowPosition===void 0&&(a.overflowPosition=r.length);let f;if(r.length>0&&(!t.isEnableTabWrap()&&(b||o)?i=[...r,...i]:f=(0,k.jsx)(`div`,{ref:u,onPointerDown:re,onDragStart:e=>{e.preventDefault()},className:z(L.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER),children:r},`sticky_buttons_container`)),!t.isEnableTabWrap()&&x){let e=n.i18nName(K.Overflow_Menu_Tooltip),r;if(typeof m.more==`function`){let e=t.getTabNodes(),n=v.map(t=>({index:t,node:e[t]}));r=m.more(t,n)}else r=(0,k.jsxs)(k.Fragment,{children:[m.more,(0,k.jsx)(`div`,{className:z(L.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT),children:v.length>0?v.length:``})]});i.splice(Math.min(a.overflowPosition,i.length),0,(0,k.jsx)(`button`,{tabIndex:0,"data-layout-path":se+`/button/overflow`,"aria-haspopup":`menu`,"aria-expanded":d,"aria-label":e,ref:l,className:z(L.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+` `+z(L.FLEXLAYOUT__TAB_BUTTON_OVERFLOW),title:e,onClick:ee,onPointerDown:re,children:r},`overflowbutton`))}if(oe!==void 0&&!oe.isPinned()){if(oe.isEnableFloat()&&oe.isEnableFloatIcon()){let e=n.i18nName(K.Popout_Tab_Float);i.push((0,k.jsx)(`button`,{tabIndex:0,"data-layout-path":se+`/button/popout-float`,title:e,"aria-label":e,className:z(L.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+` `+z(L.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_FLOAT),onClick:F,onPointerDown:re,children:typeof m.popoutFloat==`function`?m.popoutFloat(oe):m.popoutFloat},`popout-float`))}if(n.isSupportsPopout()&&oe.isAllowedInWindow()&&oe.isEnablePopoutIcon()){let e=n.i18nName(K.Popout_Tab);i.push((0,k.jsx)(`button`,{tabIndex:0,"data-layout-path":se+`/button/popout`,title:e,"aria-label":e,className:z(L.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+` `+z(L.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_FLOAT),onClick:N,onPointerDown:re,children:typeof m.popout==`function`?m.popout(oe):m.popout},`popout`))}}if(t.canMaximize()){let e=n.i18nName(K.Restore),r=n.i18nName(K.Maximize);i.push((0,k.jsx)(`button`,{tabIndex:0,"data-layout-path":se+`/button/max`,title:t.isMaximized()?e:r,"aria-label":t.isMaximized()?e:r,"aria-pressed":t.isMaximized(),className:z(L.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+` `+z(L.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_+(t.isMaximized()?`max`:`min`)),onClick:ie,onPointerDown:re,children:t.isMaximized()?typeof m.restore==`function`?m.restore(t):m.restore:typeof m.maximize==`function`?m.maximize(t):m.maximize},`max`))}if(!t.isMaximized()&&s){let e=o?n.i18nName(K.Close_Tab):n.i18nName(K.Close_Tabset);i.push((0,k.jsx)(`button`,{tabIndex:0,"data-layout-path":se+`/button/close`,title:e,"aria-label":e,className:z(L.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+` `+z(L.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_CLOSE),onClick:o?M:ae,onPointerDown:re,children:typeof m.closeTabset==`function`?m.closeTabset(t):m.closeTabset},`close`))}if(t.isActive()&&t.isEnableActiveIcon()){let e=n.i18nName(K.Active_Tabset);i.push((0,k.jsx)(`div`,{"data-layout-path":se+`/button/active`,title:e,"aria-hidden":`true`,className:z(L.FLEXLAYOUT__TAB_TOOLBAR_ICON),children:typeof m.activeTabset==`function`?m.activeTabset(t):m.activeTabset},`active`))}let p=(0,k.jsx)(`div`,{ref:c,className:z(L.FLEXLAYOUT__TAB_TOOLBAR),onPointerDown:re,onDragStart:e=>{e.preventDefault()},children:i},`buttonbar`);return{leading:e,buttonbar:p,stickyBar:f}},de=(e,r,i,s)=>{let c,l=n.getKeyMap(),u=[Le(l.focusNextTabset),Le(l.focusPreviousTabset)].filter(Boolean).join(` `)||void 0,d=n.getEditingTab()?.getParent()===t,f=d?void 0:`tablist`,p=z(L.FLEXLAYOUT__TABSET_TABBAR_OUTER);t.getClassNameTabStrip()!==void 0&&(p+=` `+t.getClassNameTabStrip()),p+=` `+z(L.FLEXLAYOUT__TABSET_TABBAR_OUTER_+t.getTabLocation()),t.isActive()&&(p+=` `+z(L.FLEXLAYOUT__TABSET_SELECTED)),t.isMaximized()&&(p+=` `+z(L.FLEXLAYOUT__TABSET_MAXIMIZED));let m=le;if(m){let e=t.getChildren()[0];e.getTabSetClassName()!==void 0&&(p+=` `+e.getTabSetClassName())}let h;if(r&&(h=(0,k.jsx)(`div`,{className:z(L.FLEXLAYOUT__TABSET_LEADING),children:r})),t.isEnableTabWrap())t.isEnableTabStrip()&&(c=(0,k.jsxs)(`div`,{className:p,style:{flexWrap:`wrap`,gap:`1px`,marginTop:`2px`},ref:C,"data-layout-path":se+`/tabstrip`,onPointerDown:j,onDoubleClick:I,onContextMenu:ne,onClick:te,onAuxClick:te,draggable:!0,onDragStart:E,onDragEnd:D,children:[h,(0,k.jsx)(`div`,{role:f,"aria-orientation":d?void 0:`horizontal`,"aria-label":d?void 0:t.getName(),"aria-keyshortcuts":d?void 0:u,style:{display:`contents`},children:e}),s,(0,k.jsx)(`div`,{style:{flexGrow:1,display:`flex`,justifyContent:`flex-end`},children:i})]}));else if(t.isEnableTabStrip()){let n;t.isEnableTabScrollbar()&&(n=(0,k.jsx)(`div`,{ref:a,"aria-hidden":`true`,className:z(L.FLEXLAYOUT__MINI_SCROLLBAR),onPointerDown:_})),c=(0,k.jsxs)(`div`,{className:p,ref:C,"data-layout-path":se+`/tabstrip`,onPointerDown:j,onDoubleClick:I,onContextMenu:ne,onClick:te,onAuxClick:te,draggable:!0,onWheel:y,onDragStart:E,onDragEnd:D,children:[h,(0,k.jsxs)(`div`,{className:z(L.FLEXLAYOUT__MINI_SCROLLBAR_CONTAINER),children:[(0,k.jsxs)(`div`,{ref:o,className:z(L.FLEXLAYOUT__TABSET_TABBAR_INNER)+` `+z(L.FLEXLAYOUT__TABSET_TABBAR_INNER_+t.getTabLocation()),style:{overflowX:`auto`,overflowY:`hidden`},onScroll:g,children:[(0,k.jsx)(`div`,{style:{width:m?`100%`:`none`},role:f,"aria-orientation":d?void 0:`horizontal`,"aria-label":d?void 0:t.getName(),"aria-keyshortcuts":d?void 0:u,className:z(L.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER)+` `+z(L.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER_+t.getTabLocation()),children:e}),s]}),n]}),i]})}return c},fe=e=>{let r;if(t.getTabNodes().length===0){let e=n.getTabSetPlaceHolderCallback();e&&(r=e(t))}let i=(0,k.jsx)(`div`,{ref:w,className:z(L.FLEXLAYOUT__TABSET_CONTENT),children:r});return i=t.getTabLocation()===`top`?(0,k.jsxs)(k.Fragment,{children:[e,i]}):(0,k.jsxs)(k.Fragment,{children:[i,e]}),i},pe=B(),{leading:me,buttonbar:he,stickyBar:ge}=V(),_e=fe(de(pe,me,he,ge)),ve={flexGrow:Math.max(1,t.getWeight()*1e3),minWidth:t.getMinWidth(),minHeight:t.getMinHeight(),maxWidth:t.getMaxWidth(),maxHeight:t.getMaxHeight()};t.getModel().getMaximizedTabset(n.getLayoutId())!==void 0&&!t.isMaximized()&&(ve.display=`none`);let ye=(0,k.jsx)(`div`,{ref:S,className:z(L.FLEXLAYOUT__TABSET_CONTAINER),style:ve,children:(0,k.jsx)(`div`,{className:z(L.FLEXLAYOUT__TABSET),"data-layout-path":se,children:_e})});return t.isMaximized()&&n.getMainElement()?(0,A.createPortal)((0,k.jsx)(`div`,{style:{position:`absolute`,display:`flex`,top:0,left:0,bottom:0,right:0},children:ye}),n.getMainElement()):ye};Vt.displayName=`TabSet`;var Ht=e=>{let{controller:t,rowNode:n}=e,r=O.useRef(null),i=n.getOrientation()===P.HORZ,a=O.useCallback(e=>{r.current=e,t.registerMeasurable(n,`row`,e)},[t,n]),o=[],s=0;for(let e of n.getChildren())s>0&&o.push((0,k.jsx)(Dt,{controller:t,node:n,index:s,horizontal:i},`splitter`+s)),e instanceof xe?o.push((0,k.jsx)(Ht,{controller:t,rowNode:e},e.getId())):e instanceof H&&o.push((0,k.jsx)(Vt,{controller:t,tabsetNode:e},e.getId())),s++;let c={flexGrow:Math.max(1,n.getWeight()*1e3),minWidth:n.getMinWidth(),minHeight:n.getMinHeight(),maxWidth:n.getMaxWidth(),maxHeight:n.getMaxHeight()};return c.flexDirection=i?`row`:`column`,(0,k.jsx)(`div`,{ref:a,className:t.getClassName(L.FLEXLAYOUT__ROW),style:c,children:o})};Ht.displayName=`Row`;var Ut=e=>{let{controller:t,selected:n,tabNode:r}=e,i=O.useRef(null),a=O.useRef(!0),o=O.useCallback(()=>{let e=r.getParent();e instanceof H&&(e.isActive()||t.doAction(R.setActiveTabset(e.getId(),t.getLayoutId())))},[r,t]),s=r.getParent(),c=t.getKeyMap().focusTabToggle,l=e=>{if(Pe(e,c)){let t=e.currentTarget.ownerDocument.getElementById(Me(`flexlayout-tabbutton-`,r.getId()));t&&(t.focus(),e.preventDefault(),e.stopPropagation())}};O.useLayoutEffect(()=>{let e=r.getMoveableElement(),n=i.current.ownerDocument,a=e.ownerDocument!==n;a&&n.adoptNode(e),e.parentElement!==i.current&&i.current.appendChild(e),a&&t.redrawLayoutAndTabContent();let s=()=>{r.saveScrollPosition()};e.addEventListener(`scroll`,s);let c=i.current;return c&&c.addEventListener(`pointerdown`,o),()=>{c&&c.removeEventListener(`pointerdown`,o),e.removeEventListener(`scroll`,s),e.isConnected||(t.getModel().getNodeById(r.getId())&&(r.isEnableWindowReMount()||t.getMainController()?.getMoveablesHome()?.appendChild(e)),r.setVisible(!1))}},[r,t,o]),O.useEffect(()=>{r.isSelected()&&(a.current&&=(r.restoreScrollPosition(),!1))}),O.useLayoutEffect(()=>(t.registerTabPanel(r,i.current),()=>{t.registerTabPanel(r,null)}),[t,r]);let u=t.getClassName,d=null;if(n&&document.hidden&&r.isEnablePopoutOverlay()){let e={};s.getContentRect().styleWithPosition(e);let t=u(L.FLEXLAYOUT__TAB_OVERLAY);s instanceof W&&s.isOverlay()&&(t+=` `+u(L.FLEXLAYOUT__TAB_OVERLAY_RAISED)),d=(0,k.jsx)(`div`,{style:e,className:t})}let f=u(L.FLEXLAYOUT__TAB);return s instanceof W&&(f+=` `+u(L.FLEXLAYOUT__TAB_BORDER),f+=` `+u(L.FLEXLAYOUT__TAB_BORDER_+s.getLocation().getName()),s.isOverlay()&&(f+=` `+u(L.FLEXLAYOUT__TAB_BORDER_OVERLAY))),r.getContentClassName()!==void 0&&(f+=` `+r.getContentClassName()),(0,k.jsxs)(k.Fragment,{children:[d,(0,k.jsx)(`div`,{ref:i,id:Me(`flexlayout-tab-`,r.getId()),role:`tabpanel`,"aria-labelledby":Me(`flexlayout-tabbutton-`,r.getId()),"aria-keyshortcuts":Le(c),tabIndex:-1,onKeyDown:c?l:void 0,className:f,"data-layout-path":r.getPath()})]})};Ut.displayName=`Tab`;var Wt=class extends O.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0}}componentDidCatch(e,t){}retry=()=>{this.setState({hasError:!1})};render(){return this.state.hasError?(0,k.jsx)(`div`,{className:L.FLEXLAYOUT__ERROR_BOUNDARY_CONTAINER,children:(0,k.jsx)(`div`,{role:`alert`,className:L.FLEXLAYOUT__ERROR_BOUNDARY_CONTENT,children:(0,k.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`},children:[this.props.message,(0,k.jsx)(`p`,{children:(0,k.jsx)(`button`,{tabIndex:0,onClick:this.retry,children:this.props.retryText})})]})})}):this.props.children}},Gt=O.memo(({controller:e,tabNode:t})=>{let n;if(t.getComponent())n=e.getFactory()(t);else if(t.getSubLayoutId()){let r=t.getModel().getLayouts().get(t.getSubLayoutId());n=(0,k.jsx)(`div`,{className:e.getClassName(L.FLEXLAYOUT__TAB_LAYOUT_CONTAINER),children:(0,k.jsx)(nn,{...e.getProps(),layoutId:t.getSubLayoutId(),path:t.getPath()+r.getPath(),mainLayoutController:e.getMainController()})})}return(0,k.jsx)(Wt,{message:e.i18nName(K.Error_rendering_component),retryText:e.i18nName(K.Error_rendering_component_retry),children:n})},Kt);Gt.displayName=`TabContentRenderer`;function Kt(e,t){return!t.visible||e.windowId===t.windowId&&e.fullRedrawRevision===t.fullRedrawRevision&&e.parentRedrawRevision===t.parentRedrawRevision&&e.tabNode===t.tabNode&&t.tabNode.getSubLayoutId()===void 0}var qt=class e{static dragState=void 0;_controller;_dragEnterCount=0;_dragging=!1;_active=!1;_dropInfo;_outlineDiv;_mainController;constructor(e){this._controller=e,this._mainController=e.getMainController()}isDockTarget(){return this._controller.getLayout().getLayoutId()!==e.dragState?.floatLayoutId}isExcludeCenter(){if(e.dragState?.dockFloatToMain)return!0;let t=e.dragState?.dragNode;return t instanceof H?!t.isEnableClose()||t.getPinnedRunLength()>0:!1}addTabWithDragAndDrop(t,n,r){let i=G.fromJson(n,this._controller.getModel(),!1);e.dragState=new Jt(this._controller.getMainController(),`add`,i,n,r)}onDragEnded(){this.clearDragMain(),e.dragState=void 0}moveTabWithDragAndDrop(e,t){this.setDragNode(e,t)}startDockLayoutDrag(t,n,r){let i=n.getRootRow();e.dragState=new Jt(this._controller.getMainController(),`float`,i,void 0,void 0,!0,n.getLayoutId(),r),t.dataTransfer.setData(`text/plain`,`--flexlayout--`),t.dataTransfer.effectAllowed=`copyMove`,t.dataTransfer.dropEffect=`move`,this._dragEnterCount=0,this._controller.getModel().sortLayouts();let a=0;n.getRootRow()?.forEachNode(e=>{e instanceof G&&a++},0);let o=this._controller.i18nName(K.Dock_Float_Tabs).replace(`?`,String(a)),s=!1;if(this._controller.getProps().onRenderDragRect){let e=this._controller.getProps().onRenderDragRect(o,i,void 0);e&&(this.setDragComponent(t,e,10,10),s=!0)}s||this.setDragComponent(t,o,10,10)}setDragNode=(t,n)=>{if(e.dragState=new Jt(this._controller.getMainController(),`internal`,n,void 0,void 0),t.dataTransfer.setData(`text/plain`,`--flexlayout--`),t.dataTransfer.effectAllowed=`copyMove`,t.dataTransfer.dropEffect=`move`,this._dragEnterCount=0,this._controller.getModel().sortLayouts(),n instanceof H){let e=!1,r=this._controller.i18nName(K.Move_Tabset);if(n.getChildren().length>0&&(r=this._controller.i18nName(K.Move_Tabs).replace(`?`,String(n.getChildren().length))),this._controller.getProps().onRenderDragRect){let i=this._controller.getProps().onRenderDragRect(r,n,void 0);i&&(this.setDragComponent(t,i,10,10),e=!0)}e||this.setDragComponent(t,r,10,10)}else if(n instanceof U){let e=!1,r=this._controller.i18nName(K.Move_Group).replace(`?`,String(n.getChildren().length));if(this._controller.getProps().onRenderDragRect){let i=this._controller.getProps().onRenderDragRect(r,n,void 0);i&&(this.setDragComponent(t,i,10,10),e=!0)}e||this.setDragComponent(t,r,10,10)}else{let e=t.target;if(e&&typeof e.getBoundingClientRect==`function`){let r=e.getBoundingClientRect(),i=t.clientX-r.left,a=t.clientY-r.top,o=n?.getParent(),s=o instanceof W&&o.getOrientation()===P.HORZ,c=s?10:i,l=s?10:a,u=!1;if(this._controller.getProps().onRenderDragRect){let e=(0,k.jsx)(ht,{controller:this._controller,tabNode:n},n.getId()),r=this._controller.getProps().onRenderDragRect(e,n,void 0);r&&(this.setDragComponent(t,r,c,l),u=!0)}u||(Ge()?this.setDragComponent(t,(0,k.jsx)(ht,{tabNode:n,controller:this._controller}),c,l):t.dataTransfer.setDragImage(n.getTabStamp(),c,l))}}};setDragComponent(e,t,n,r){let i=(0,k.jsx)(`div`,{style:{position:`unset`},className:this._controller.getClassName(L.FLEXLAYOUT__LAYOUT)+` `+this._controller.getClassName(L.FLEXLAYOUT__DRAG_RECT),children:t}),a=this._controller.getCurrentDocument(),o=a.createElement(`div`);o.setAttribute(`data-layout-path`,`/drag-rectangle`),o.style.position=`absolute`,o.style.left=`-10000px`,o.style.top=`-10000px`,a.body.appendChild(o);let s=(0,j.createRoot)(o);(0,A.flushSync)(()=>s.render(i)),e.dataTransfer.setDragImage(o,n,r),setTimeout(()=>{s.unmount(),a.body.removeChild(o)},0)}updateActive(t){let n=Array.from(this._controller.getModel().getLayouts().values()),r=e.dragState?.dockFloatToMain===!0,i,a;for(let t=n.length-1;t>=0;t--){let o=n[t];if(r&&o.getLayoutId()===e.dragState?.floatLayoutId)continue;let s=tn(o)?.getDragDropManager();s&&s.getDragEnterCount()>0&&(o.getType()===`tab`?a=o:!i&&!a&&(i=o))}if(a){let e=a.findParentLayout();(i===e||!i)&&(i=a)}i&&tn(i).getDragDropManager().setActive(!0,t);for(let e of n)e!==i&&tn(e)?.getDragDropManager().setActive(!1,t)}setActive(e,t){this._active!==e&&(this._active=e,this._active?this.onDragEnter(t):this.onDragLeave(t))}onDragEnterRaw=e=>{this._dragEnterCount++,this.updateActive(e)};onDragLeaveRaw=e=>{this._dragEnterCount--,this.updateActive(e)};clearDragMain(){this._controller.showOverlayOnAllWindows(!1);for(let[,e]of this._controller.getModel().getLayouts()){let t=tn(e);t&&t.getDragDropManager().clearDragLocal()}}clearDragLocal(){this._dragEnterCount=0,this._active=!1,this.clearDragLocalVisuals()}clearDragLocalVisuals(){this._controller.setState({showEdges:!1}),this._dragging=!1,this._outlineDiv&&=(this._controller.getRootDiv().removeChild(this._outlineDiv),void 0)}onDragEnter=t=>{if(!e.dragState&&this._controller.getProps().onExternalDrag){let n=this._controller.getProps().onExternalDrag(t);if(n){let t=G.fromJson(n.json,this._controller.getModel(),!1);e.dragState=new Jt(this._controller.getMainController(),`external`,t,n.json,n.onDrop)}}if(this._mainController===e.dragState?.mainLayoutController&&(!e.dragState?.dockFloatToMain||this.isDockTarget())&&e.dragState){t.preventDefault(),this._dropInfo=void 0;let e=this._controller.getRootDiv(),n=this._controller.getCurrentDocument();this._outlineDiv=n.createElement(`div`),this._outlineDiv.className=this._controller.getClassName(L.FLEXLAYOUT__OUTLINE_RECT),this._outlineDiv.style.visibility=`hidden`;let r=this._controller.getTabDragSpeed();this._outlineDiv.style.transition=`top ${r}s, left ${r}s, width ${r}s, height ${r}s`,e.appendChild(this._outlineDiv),this._dragging=!0,this._controller.showOverlayOnAllWindows(!0),this._controller.getModel().getMaximizedTabset(this._controller.getLayoutId())===void 0&&this._controller.setState({showEdges:this._controller.getModel().isEnableEdgeDock()});let i=this._controller.getRootDiv().getBoundingClientRect();new N(t.clientX-i.left,t.clientY-i.top,1,1).positionElement(this._outlineDiv)}};onDragOver=t=>{if(this._mainController===e.dragState?.mainLayoutController&&(!e.dragState?.dockFloatToMain||this.isDockTarget())&&this._active){if(e.dragState?.dockFloatToMain){let n=t.target;if(n&&e.dragState.sourceFloatElement?.contains(n)){this._dropInfo=void 0;return}}let n=this._controller.getRootDiv()?.getBoundingClientRect(),r={x:t.clientX-(n?.left??0),y:t.clientY-(n?.top??0)};e.dragState.dockFloatToMain||this._controller.checkForBorderToShow(r.x,r.y);let i=this._controller.getModel().findDropTargetNode(this._controller.getLayoutId(),e.dragState.dragNode,r.x,r.y,this.isExcludeCenter());if(i){if(e.dragState.dockFloatToMain&&(i.location===F.CENTER||!(i.node instanceof H)&&!(i.node instanceof xe)))return;t.preventDefault(),this._dropInfo=i,this._outlineDiv&&(this._outlineDiv.className=this._controller.getClassName(i.className),i.rect.positionElement(this._outlineDiv),this._outlineDiv.style.visibility=`visible`)}}};onDragLeave=t=>{if(this._mainController===e.dragState?.mainLayoutController&&(this.clearDragLocalVisuals(),this._controller.isMainLayout())){let e=!1;for(let[,t]of this._controller.getModel().getLayouts()){let n=tn(t);if(n&&n.getDragDropManager().isDragging()){e=!0;break}}e===!1&&this.clearDragMain()}};onDrop=t=>{if(this._mainController!==e.dragState?.mainLayoutController){this.clearDragLocal();return}if(!e.dragState?.dockFloatToMain||this.isDockTarget()){if(this._active){t.preventDefault();let n=e.dragState;if(this._dropInfo&&n.dockFloatToMain){let e=t.target;e&&n.sourceFloatElement?.contains(e)&&(this._dropInfo=void 0)}if(this._dropInfo){if(n.dragJson!==void 0){let e=this._controller.doAction(R.addTab(n.dragJson,this._dropInfo.node.getId(),this._dropInfo.location,this._dropInfo.index));n.fnNewNodeDropped!==void 0&&n.fnNewNodeDropped(e,t)}else n.dragNode!==void 0&&(n.dockFloatToMain?this._controller.doAction(R.dockFloatToLayout(n.floatLayoutId,this._dropInfo.node.getId(),this._dropInfo.location,this._dropInfo.index)):this._controller.doAction(R.moveNode(n.dragNode.getId(),this._dropInfo.node.getId(),this._dropInfo.location,this._dropInfo.index)))}this.clearDragMain(),e.dragState=void 0}this._dragEnterCount=0}};getDragEnterCount(){return this._dragEnterCount}isDragging(){return this._dragging}},Jt=class{mainLayoutController;dragSource;dragNode;dragJson;fnNewNodeDropped;dockFloatToMain;floatLayoutId;sourceFloatElement;constructor(e,t,n,r,i,a=!1,o=void 0,s=void 0){this.mainLayoutController=e,this.dragSource=t,this.dragNode=n,this.dragJson=r,this.fnNewNodeDropped=i,this.dockFloatToMain=a,this.floatLayoutId=o,this.sourceFloatElement=s}},Yt=({controller:e})=>{let t=[],n=e.getIcons().edgeArrow;if(e.getState().showEdges&&e.getModel().isEnableEdgeDockIndicators()){let r=e.getModel().getRootRow(e.getLayoutId()).getRect(),i=e.getClassName(L.FLEXLAYOUT__EDGE_RECT);t.push((0,k.jsx)(`div`,{"aria-hidden":`true`,style:{top:0,left:r.width/2-50,width:100,height:10,borderBottomLeftRadius:50,borderBottomRightRadius:50},className:i+` `+e.getClassName(L.FLEXLAYOUT__EDGE_RECT_TOP),children:(0,k.jsx)(`div`,{style:{transform:`rotate(180deg)`},children:n})},`North`)),t.push((0,k.jsx)(`div`,{"aria-hidden":`true`,style:{top:r.height/2-50,left:0,width:10,height:100,borderTopRightRadius:50,borderBottomRightRadius:50},className:i+` `+e.getClassName(L.FLEXLAYOUT__EDGE_RECT_LEFT),children:(0,k.jsx)(`div`,{style:{transform:`rotate(90deg)`},children:n})},`West`)),t.push((0,k.jsx)(`div`,{"aria-hidden":`true`,style:{top:r.height-10,left:r.width/2-50,width:100,height:10,borderTopLeftRadius:50,borderTopRightRadius:50},className:i+` `+e.getClassName(L.FLEXLAYOUT__EDGE_RECT_BOTTOM),children:(0,k.jsx)(`div`,{children:n})},`South`)),t.push((0,k.jsx)(`div`,{"aria-hidden":`true`,style:{top:r.height/2-50,left:r.width-10,width:10,height:100,borderTopLeftRadius:50,borderBottomLeftRadius:50},className:i+` `+e.getClassName(L.FLEXLAYOUT__EDGE_RECT_RIGHT),children:(0,k.jsx)(`div`,{style:{transform:`rotate(-90deg)`},children:n})},`East`))}return(0,k.jsx)(k.Fragment,{children:t})};Yt.displayName=`EdgeIndicators`;var Xt=O.memo(e=>{Xt.displayName=`DragTabButton`;let{controller:t,tabNode:n}=e,r=O.useRef(null);O.useEffect(()=>(n.setTabStamp(r.current),()=>{n.setTabStamp(null)}),[n]);let i=t.getClassName,a=i(L.FLEXLAYOUT__DRAG_RECT);return(0,k.jsx)(`div`,{ref:r,className:a,children:(0,k.jsx)(ht,{controller:t,tabNode:n},n.getId())})},Zt);function Zt(e,t){return t.dragging}var Qt=class e{static Windows=new WeakMap;_props;_state;_setState;_layoutRef;_moveablesHomeRef;_findBorderBarSizeRef;_findSplitterSizeRef;_mainRef;_orderedTabIds;_orderedTabMoveableIds;_currentDocument;_currentWindow;_showOverlay=!1;_supportsPopout;_popoutURL;_icons;_dragDropManager;_layoutId;_layout;_mainController;_popoutWindowName;_cachedLayoutDOMRect;_reLayout;_measurables=new Map;_tabPanels=new Map;_lastRect=N.empty();_lastSplitterSize=8;_geometryResizeObserver;_splitterDragging=!1;constructor(e,t,n){this._props=e,this._state=t,this._setState=n,this._orderedTabIds=[],this._orderedTabMoveableIds=[],this._supportsPopout=e.supportsPopout===void 0?en:e.supportsPopout,this._popoutURL=e.popoutURL?e.popoutURL:`popout.html`,this._icons={...$t,...e.icons},this._layoutId=e.layoutId?e.layoutId:Te.MAIN_LAYOUT_ID,this._mainController=e.mainLayoutController?e.mainLayoutController:this,this._dragDropManager=new qt(this),this._layout=e.model.getLayouts().get(this._layoutId),this._layout.setController(this),this._popoutWindowName=e.popoutWindowName,this._reLayout=!1}renderLayout(){return this._cachedLayoutDOMRect=void 0,(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(Ht,{controller:this,rowNode:this._props.model.getRootRow(this._layoutId)},`__row__`),(0,k.jsx)(Yt,{controller:this})]})}renderTabContainers(){let e=new Map;return this._props.model.visitLayoutNodes(this._layoutId,t=>{if(t instanceof G){let n=t,r=n.isSelected(),i=n.isRendered(),a=n.isEnableRenderOnDemand();(i||r||!a)&&e.set(n.getId(),(0,k.jsx)(Ut,{controller:this,tabNode:n,selected:r},n.getId()))}}),e}renderTabContents(){let e=new Map;for(let[t,n]of this._props.model.getLayouts())this._props.model.visitLayoutNodes(t,t=>{if(t instanceof G){let r=t,i=r.isSelected(),a=r.isRendered(),o=r.isEnableRenderOnDemand(),s=r.getTabContainer().getContentRect(),c=i||!o;if(a||c&&s.width>0&&s.height>0){let t=r.getMoveableElement();t.style.overflow=r.isEnableScrollbars()?`auto`:`hidden`;let i=n.getWindowId()||``,a=r.getId()+(r.isEnableWindowReMount()?i:``);e.set(r.getId(),(0,A.createPortal)((0,k.jsx)(Gt,{controller:this,tabNode:r,windowId:i,visible:c,fullRedrawRevision:this._state.fullRedrawRevision,parentRedrawRevision:this._props.parentRedrawRevision},a),t,a)),r.setRendered(!0)}}});return e}renderDragTabButtons(){let e=[];return this._props.model.visitNodes(t=>{if(t instanceof G){let n=t;e.push((0,k.jsx)(Xt,{controller:this,tabNode:n,dragging:He},n.getId()))}}),e}redrawLayout(){this._mainController?.setState(e=>({layoutRedrawRevision:e.layoutRedrawRevision+1}))}redrawLayoutAndTabContent(){this._mainController?.setState(e=>({fullRedrawRevision:e.fullRedrawRevision+1}))}doAction(e){if(this._props.onAction!==void 0){let t=this._props.onAction(e);return t===void 0?void 0:this._props.model.doAction(t)}return this._props.model.doAction(e)}updateRect=()=>{if(this._layoutRef.current){let e=this._layoutRef.current;if(!this._layout.isMainLayout()&&this._layout.getType()===`float`){let t=e.closest(`.`+this.getClassName(L.FLEXLAYOUT__FLOAT_WINDOW));t instanceof HTMLDivElement&&(e=t)}let t=N.fromDomRect(e.getBoundingClientRect());if(!this._layout.isMainLayout()&&this._layout.getType()===`float`){let e=this._mainController.getDomRect();t=t.relativeTo(e)}!t.equalsWhenRounded(this._lastRect)&&t.width!==0&&t.height!==0&&(this._lastRect=t,this._layout.setRect(t),this.redrawLayout())}};onModelChange=e=>{let t=e instanceof oe?e.actions:[e];for(let e of t)if(e.type==R.DELETE_TAB&&this._state.showHiddenBorder!==F.CENTER){let e=this._props.model.getBorderSet().getBorderMap().get(this._state.showHiddenBorder);if(!e||e.getChildren().length===0){this._setState({showHiddenBorder:F.CENTER});break}}if(e.isAdjusting()&&(e.type===R.ADJUST_WEIGHTS||e.type===R.ADJUST_BORDER_SPLIT)){e.type===R.ADJUST_WEIGHTS?this.applyAdjustingWeights(e):this.applyAdjustingBorderSplit(e),this._props.onModelChange&&this._props.onModelChange(this._props.model,e);return}this.redrawLayout(),this._props.onModelChange&&this._props.onModelChange(this._props.model,e)};applyMeasuredGeometry(){this.syncLayoutMetrics(),this.positionTabPanels(),this.isReLayout()&&(this.redrawLayout(),this.setReLayout(!1))}applyAdjustingWeights(e){let t=this._props.model.getNodeById(e.data.nodeId);if(!(t instanceof xe)){this.redrawLayout();return}let n=e.data.weights,r=t.getChildren();for(let e=0;e<r.length;e++){let t=r[e];if(typeof n?.[e]!=`number`||!Number.isFinite(n[e]))continue;let i=t instanceof xe?`row`:`tabset`,a=this._measurables.get(i+`:`+t.getId())?.element;if(!a){this.redrawLayout();return}a.style.flexGrow=String(Math.max(1,n[e]*1e3))}this.applyMeasuredGeometry()}applyAdjustingBorderSplit(e){let t=this._props.model.getNodeById(e.data.node);if(!(t instanceof W)){this.redrawLayout();return}if(t.isOverlay()){this.redrawLayout();return}let n=this._measurables.get(`bordercontent:`+t.getId())?.element;if(!n){this.redrawLayout();return}let r=t.getSize();t.isHorizontal()?(n.style.width=r+`px`,n.style.minWidth=t.getMinSize()+`px`,n.style.maxWidth=t.getMaxSize()+`px`):(n.style.height=r+`px`,n.style.minHeight=t.getMinSize()+`px`,n.style.maxHeight=t.getMaxSize()+`px`),this.applyMeasuredGeometry()}reorderComponents(e,t){let n=t.filter(t=>e.has(t)),r=new Set(n);for(let t of e.keys())r.has(t)||n.push(t);return t===this._orderedTabIds?this._orderedTabIds=n:t===this._orderedTabMoveableIds&&(this._orderedTabMoveableIds=n),n.map(t=>e.get(t))}checkForBorderToShow(e,t){let n=this.getBoundingClientRect(this._mainRef.current),r=n.getCenter(),i=!1;this._props.model.isEnableEdgeDock()&&this._state.showHiddenBorder===F.CENTER&&(t>r.y-50&&t<r.y+50||e>r.x-50&&e<r.x+50)&&(i=!0);let a=F.CENTER;i||(e<=n.x+10?a=F.LEFT:e>=n.getRight()-10?a=F.RIGHT:t<=n.y+10?a=F.TOP:t>=n.getBottom()-10&&(a=F.BOTTOM)),a!==F.CENTER&&!this._props.model.getBorderSet().getBorderMap().has(a)&&(a=F.CENTER),a!==this._state.showHiddenBorder&&this.setState({showHiddenBorder:a})}onOverlayBorderPointerDown=e=>{let t=this._props.model.getBorderSet().getBorders().filter(e=>e.isOverlay()&&e.getSelected()!==-1);if(t.length===0||e.target?.closest?.(`.`+this.getClassName(L.FLEXLAYOUT__POPUP_MENU_CONTAINER)+`,.`+this.getClassName(L.FLEXLAYOUT__FLOAT_WINDOW)+`,.`+this.getClassName(L.FLEXLAYOUT__FLOATING_WINDOW_CONTENT)+`,.`+this.getClassName(L.FLEXLAYOUT__BORDER_TAB_OVERLAY)))return;let n=this.getDomRect();if(!n)return;let r=e.clientX-n.x,i=e.clientY-n.y,a=this._props.model.getRootRow(Te.MAIN_LAYOUT_ID)?.getRect();if(a&&a.contains(r,i))for(let e of t)e.getContentRect()?.contains(r,i)||this.closeOverlayBorder(e)};closeOverlayBorder(e){let t=e.getSelectedNode();if(t===void 0)return;let n=this._currentDocument,r=n?.getElementById(Me(`flexlayout-tab-`,t.getId())),i=!!n&&!!r&&r.contains(n.activeElement);this.doAction(R.selectTab(t.getId())),i&&n.getElementById(Me(`flexlayout-tabbutton-`,t.getId()))?.focus()}onOverlayBorderKeyDown=e=>{if(!Pe(e,this.getKeyMap().closeOverlayBorder))return;let t=this._currentDocument?.activeElement;if(!t)return;let n=this._props.model.getBorderSet().getBorders().filter(e=>e.isOverlay()&&e.getSelected()!==-1);for(let r of n){let n=r.getSelectedNode(),i=this._currentDocument.getElementById(Me(`flexlayout-tab-`,n.getId())),a=this._currentDocument.getElementById(Me(`flexlayout-tabbutton-`,n.getId()));if(i&&i.contains(t)||t===a){this.closeOverlayBorder(r),e.preventDefault();break}}};onTabsetNavKeyDown=e=>{if(e.defaultPrevented)return;let t=this.getKeyMap(),n;if(Pe(e,t.focusNextTabset))n=1;else if(Pe(e,t.focusPreviousTabset))n=-1;else return;this.focusAdjacentTabset(n)&&e.preventDefault()};focusAdjacentTabset(e){let t=this._currentDocument,n=t?.activeElement;if(!t||!n||!this.getRootDiv()?.contains(n))return!1;let r=n.tagName;if(r===`INPUT`||r===`TEXTAREA`||n.isContentEditable||n.closest(`[role="menu"]`)||this._props.model.getMaximizedTabset(this._layoutId)!==void 0)return!1;let i=[];if(this._props.model.visitLayoutNodes(this._layoutId,e=>{e instanceof H&&e.getSelectedNode()!==void 0&&i.push(e)}),i.length<2)return!1;let a=i.findIndex(e=>this._measurables.get(`tabset:`+e.getId())?.element.contains(n)?!0:!!t.getElementById(Me(`flexlayout-tab-`,e.getSelectedNode().getId()))?.contains(n));if(a===-1){let e=this._props.model.getActiveTabset(this._layoutId);a=e===void 0?0:i.indexOf(e),a===-1&&(a=0)}let o=i[(a+e+i.length)%i.length];return t.getElementById(Me(`flexlayout-tabbutton-`,o.getSelectedNode().getId()))?.focus(),this.doAction(R.setActiveTabset(o.getId(),this._layoutId)),!0}registerMeasurable(e,t,n){let r=t+`:`+e.getId(),i=this._measurables.get(r);n?this._measurables.set(r,{kind:t,node:e,element:n}):(this._measurables.delete(r),t===`grouppill`?e.setPillRect(N.empty()):t===`groupendmarker`&&e.setEndMarkerRect(N.empty())),t!==`tabbutton`&&(i&&this._geometryResizeObserver?.unobserve(i.element),n&&this._geometryResizeObserver?.observe(n))}setGeometryResizeObserver(e){if(this._geometryResizeObserver=e,e)for(let{kind:t,element:n}of this._measurables.values())t!==`tabbutton`&&e.observe(n)}syncLayoutMetrics(){this._cachedLayoutDOMRect=void 0;let e=!1;for(let{kind:t,node:n,element:r}of this._measurables.values()){if(!r.isConnected)continue;let i=this.getBoundingClientRect(r);switch(t){case`row`:case`tabset`:i.equalsWhenRounded(n.getRect())||(n.setRect(i),e=!0);break;case`tabstrip`:i.equalsWhenRounded(n.getTabStripRect())||(n.setTabStripRect(i),e=!0);break;case`tabsetcontent`:{let t=n;if(!isNaN(i.x)&&!t.getContentRect().equalsWhenRounded(i)){let n=t.getContentRect().width>0&&t.getContentRect().height>0;t.setContentRect(i),e=!0,!n&&i.width>0&&i.height>0&&this.setReLayout(!0)}break}case`tabbutton`:i.equalsWhenRounded(n.getTabRect())||(n.setTabRect(i),e=!0);break;case`grouppill`:i.equalsWhenRounded(n.getPillRect())||(n.setPillRect(i),e=!0);break;case`groupendmarker`:i.equalsWhenRounded(n.getEndMarkerRect())||(n.setEndMarkerRect(i),e=!0);break;case`borderheader`:i.equalsWhenRounded(n.getRect())||(n.setTabHeaderRect(i),e=!0);break;case`bordercontent`:{let t=n;if(!isNaN(i.x)&&i.width>0&&!t.getContentRect().equalsWhenRounded(i)){let n=t.getContentRect().width>0&&t.getContentRect().height>0;t.setContentRect(i),e=!0,!n&&i.height>0&&this.setReLayout(!0)}break}}}for(let{kind:t,node:n}of this._measurables.values())if(t===`grouppill`){let t=n,r=t.getDropRegion();r.equalsWhenRounded(t.getRect())||(t.setRect(r),e=!0)}return e}registerTabPanel(e,t){t?this._tabPanels.set(e.getId(),{node:e,element:t}):this._tabPanels.delete(e.getId())}positionTabPanels(){for(let{node:e,element:t}of this._tabPanels.values()){let n=e.getTabContainer(),r=n.getContentRect(),i=e.isSelected();n instanceof H?this._props.model.getMaximizedTabset(this._layoutId)!==void 0&&!n.isMaximized()&&(i=!1):n instanceof W&&(n.isShowing()||(i=!1)),r.positionElement(t),t.style.display=i?``:`none`,e.setRect(r),e.setVisible(i)}}updateLayoutMetrics=()=>{if(this._findBorderBarSizeRef.current){let e=this._findBorderBarSizeRef.current.getBoundingClientRect().height;Math.abs(e-this._state.calculatedBorderBarSize)>.5&&this.setState({calculatedBorderBarSize:e})}if(this._findSplitterSizeRef.current){let e=this._findSplitterSizeRef.current.getBoundingClientRect().width;Math.abs(e-this._lastSplitterSize)>.5&&(this._lastSplitterSize=e,this._props.model.setSplitterSize(e),this.redrawLayout())}};addTabWithDragAndDrop(e,t,n){this._dragDropManager.addTabWithDragAndDrop(e,t,n)}moveTabWithDragAndDrop(e,t){this._dragDropManager.moveTabWithDragAndDrop(e,t)}setDragComponent(e,t,n,r){this._dragDropManager.setDragComponent(e,t,n,r)}getMoveablesHome(){return this._moveablesHomeRef.current}getProps(){return this._props}getKeyMap(){return Ie(this._props.keyMap)}setProps(e){this._props=e}getState(){return this._state}setStateRaw(e){this._state=e}setState(e){this._setState(e)}setSetState(e){this._setState=e}setLayoutRef(e){this._layoutRef=e}setMoveablesHomeRef(e){this._moveablesHomeRef=e}setFindBorderBarSizeRef(e){this._findBorderBarSizeRef=e}setFindSplitterSizeRef(e){this._findSplitterSizeRef=e}getMainRef(){return this._mainRef}setMainRef(e){this._mainRef=e}getOrderedTabIds(){return this._orderedTabIds}getOrderedTabMoveableIds(){return this._orderedTabMoveableIds}getCurrentDocument(){return this._currentDocument}setCurrentDocument(e){this._currentDocument=e}getCurrentWindow(){return this._currentWindow}setCurrentWindow(t){this._currentWindow=t,t&&!e.Windows.has(t)&&e.Windows.set(t,be())}getWindowId(){if(this.getCurrentWindow())return e.Windows.get(this.getCurrentWindow())}isSupportsPopout(){return this._supportsPopout}getPopoutURL(){return this._popoutURL}getIcons(){return this._icons}getDragDropManager(){return this._dragDropManager}getLayoutId(){return this._layoutId}getLayout(){return this._layout}setLayout(e){this._layout=e}getMainController(){return this._mainController}isMainLayout(){return this._layout.isMainLayout()}getPopoutWindowName(){return this._popoutWindowName??this.i18nName(K.Popout_Window_Name)}isReLayout(){return this._reLayout}setReLayout(e){this._reLayout=e}getBoundingClientRect(e){let t=this.getDomRect();return t?N.getBoundingClientRect(e).relativeTo(t):N.empty()}getClassName=e=>this._props.classNameMapper===void 0?e:this._props.classNameMapper(e);getLayoutRef(){return this._layoutRef.current}getDomRect(){return this._cachedLayoutDOMRect===void 0?this._layoutRef.current?(this._cachedLayoutDOMRect=N.fromDomRect(this._layoutRef.current.getBoundingClientRect()),this._cachedLayoutDOMRect):N.empty():this._cachedLayoutDOMRect}getRootDiv(){return this._layoutRef.current}getMainElement(){return this._mainRef.current}getFactory(){return this._props.factory}isRealtimeResize(){return this._props.realtimeResize??!0}isSplitterDragging(){return this._mainController?this._mainController._splitterDragging:this._splitterDragging}setSplitterDragging(e){let t=this._mainController??this;t._splitterDragging=e}setEditingTab(e){this.setState({editingTab:e})}getEditingTab(){return this._state.editingTab}getModel(){return this._props.model}getTabDragSpeed(){return this._props.tabDragSpeed?this._props.tabDragSpeed:.3}onCloseLayout=e=>{this.doAction(R.closePopout(e.getLayoutId()))};getScreenRect(e){let t=e.clone(),n=this.getDomRect(),r=this._currentWindow.outerHeight-this._currentWindow.innerHeight,i=this._currentWindow.outerWidth-this._currentWindow.innerWidth,a=r>=0&&r<=200?r:60,o=i>=0&&i<=100?i:2;return t.x=this._currentWindow.screenX+this._currentWindow.scrollX+o/2+n.x+t.x,t.y=this._currentWindow.screenY+this._currentWindow.scrollY+(a-o/2)+n.y+t.y,t.height+=a,t.width+=o,t}getRelativeRect(e){let t=e.clone();if(!this._layout.isMainLayout()){let e=this._layout.getRect();t.x+=e.x,t.y+=e.y}return t}moveWindowToFront(e){this.doAction(R.movePopoutToFront(e))}addTabToTabSet(e,t){if(this._props.model.getNodeById(e)!==void 0)return this.doAction(R.addTab(t,e,F.CENTER,-1))}addTabToActiveTabSet(e){let t=this._props.model.getActiveTabset(this._layoutId);if(t!==void 0)return this.doAction(R.addTab(e,t.getId(),F.CENTER,-1))}maximize(e){this.doAction(R.maximizeToggle(e.getId(),this.getLayoutId()))}customizeTab(e,t){this._props.onRenderTab&&this._props.onRenderTab(e,t)}customizeTabSet(e,t){this._props.onRenderTabSet&&this._props.onRenderTabSet(e,t)}i18nName(e,t){let n=this._props.model.translate(e);return n===e&&(n=Oe[e]??e),n===void 0&&(n=e+(t===void 0?``:t)),n}getShowOverflowMenu(){return this._props.onShowOverflowMenu}getTabSetPlaceHolderCallback(){return this._props.onTabSetPlaceHolder}showContextMenu(e,t){this._props.onContextMenu&&this._props.onContextMenu(e,t)}auxMouseClick(e,t){this._props.onAuxMouseClick&&this._props.onAuxMouseClick(e,t)}showOverlay(e){this._showOverlay!==e&&(this._showOverlay=e,this.setState({showOverlay:e}),Be(!e,this._currentDocument))}showOverlayOnAllWindows(e){for(let[,t]of this._props.model.getLayouts()){let n=tn(t);n&&n.showOverlay(e)}}},$t={close:(0,k.jsx)(jt,{}),pin:(0,k.jsx)(Mt,{}),closeTabset:(0,k.jsx)(jt,{}),closeFloatPopout:(0,k.jsx)(jt,{}),popout:(0,k.jsx)(It,{}),popoutFloat:(0,k.jsx)(Lt,{}),maximize:(0,k.jsx)(Nt,{}),restore:(0,k.jsx)(Rt,{}),more:(0,k.jsx)(Pt,{}),edgeArrow:(0,k.jsx)(Ft,{}),activeTabset:(0,k.jsx)(zt,{}),dragToDock:(0,k.jsx)(q,{}),popoutFloatWindow:(0,k.jsx)(It,{})},en=Ae();function tn(e){return e.getController()}var nn=O.forwardRef((e,t)=>{let[n,r]=O.useState({editingTab:void 0,showEdges:!1,showOverlay:!1,calculatedBorderBarSize:29,layoutRedrawRevision:0,fullRedrawRevision:0,showHiddenBorder:F.CENTER}),i=O.useCallback(t=>{r(n=>({...n,...typeof t==`function`?t(n,e):t}))},[e]),a=O.useRef(null),[o,s]=O.useState(0),c=O.useRef(null),l=O.useRef(null),u=O.useRef(null),d=O.useRef(null),f=O.useMemo(()=>new Qt(e,n,i),[]);f.setProps(e),f.setStateRaw(n),f.setSetState(i),f.setLayoutRef(a),f.setMoveablesHomeRef(c),f.setFindBorderBarSizeRef(l),f.setFindSplitterSizeRef(u),f.setMainRef(d);let p=e.model.getLayouts().get(f.getLayoutId());p.setController(f),O.useImperativeHandle(t,()=>f,[f]),O.useLayoutEffect(()=>{let e=f.syncLayoutMetrics();if(f.positionTabPanels(),f.isMainLayout()&&f.updateLayoutMetrics(),f.isReLayout()&&(f.redrawLayout(),f.setReLayout(!1)),a.current&&f.getCurrentDocument()!==void 0&&f.getCurrentDocument()!==a.current.ownerDocument&&s(e=>e+1),e){let e=a.current?.ownerDocument.defaultView??window,t=e.requestAnimationFrame(()=>{f.syncLayoutMetrics(),f.positionTabPanels(),f.isReLayout()&&(f.redrawLayout(),f.setReLayout(!1))});return()=>e.cancelAnimationFrame(t)}}),O.useEffect(()=>{let e=a.current.ownerDocument,t=e.defaultView;f.setCurrentDocument(e),f.setCurrentWindow(t);let n=new t.ResizeObserver(()=>{f.updateRect(),f.syncLayoutMetrics(),f.positionTabPanels(),f.updateLayoutMetrics(),f.isReLayout()&&(f.redrawLayout(),f.setReLayout(!1))});n.observe(a.current),f.setGeometryResizeObserver(n),l.current&&n.observe(l.current),u.current&&n.observe(u.current);let r=()=>{f.updateRect()};t.addEventListener(`resize`,r);let i=()=>{for(let[e,t]of f.getProps().model.getLayouts()){let e=t.getController();e&&e.redrawLayout()}};return f.isMainLayout()&&(e.addEventListener(`visibilitychange`,i),e.addEventListener(`pointerdown`,f.onOverlayBorderPointerDown,!0),e.addEventListener(`keydown`,f.onOverlayBorderKeyDown)),(f.isMainLayout()||f.getLayout()?.getType()===`window`)&&e.addEventListener(`keydown`,f.onTabsetNavKeyDown),()=>{f.setGeometryResizeObserver(void 0),n.disconnect(),t.removeEventListener(`resize`,r),e.removeEventListener(`visibilitychange`,i),e.removeEventListener(`pointerdown`,f.onOverlayBorderPointerDown,!0),e.removeEventListener(`keydown`,f.onOverlayBorderKeyDown),e.removeEventListener(`keydown`,f.onTabsetNavKeyDown)}},[f,o]),O.useEffect(()=>{let e;if(!f.isMainLayout()&&f.getLayout().getType()===`window`){let t=f.getProps().mainLayoutController?.getRootDiv();if(t){let n=t,r=a.current;We(n,r),e=new MutationObserver(()=>{We(n,r)&&f.redrawLayout()}),e.observe(n,{attributeFilter:[`style`]})}}return()=>{e&&e.disconnect()}},[f]),O.useEffect(()=>{let t=e.model;if(p.setToExportRectFunction((e,t)=>t===`window`?f.getScreenRect(e):f.getRelativeRect(e)),f.setLayout(p),f.isMainLayout()){let e={onAfterAction:f.onModelChange};return t.addChangeListener(e),()=>{t.removeChangeListener(e)}}},[e.model,f,p]);let m=f.isMainLayout()?(0,k.jsxs)(`div`,{className:f.getClassName(L.FLEXLAYOUT__LAYOUT_METRICS),children:[(0,k.jsx)(`div`,{ref:l,className:f.getClassName(L.FLEXLAYOUT__BORDER_SIZER),children:`FindBorderBarSize`},`findBorderBarSize`),(0,k.jsx)(`div`,{ref:u,className:f.getClassName(L.FLEXLAYOUT__SPLITTER_+`horz`)},`findSplitterSize`)]}):null;if(!a.current)return(0,k.jsx)(`div`,{ref:a,className:f.getClassName(L.FLEXLAYOUT__LAYOUT),children:m});let h=e.model,g=f.getLayoutId();h.getRootRow(g).calcMinMaxSize(),h.getRootRow(g).setPaths(e.path||``),f.isMainLayout()&&h.getBorderSet().setPaths();let _=(0,k.jsx)(qe,{controller:f,show:n.showOverlay},`__overlay__`),v=f.renderLayout(),y=(0,k.jsx)(kt,{controller:f,inner:v}),b=f.renderTabContainers(),x=f.reorderComponents(b,f.getOrderedTabIds()),S=null,C=null,w=null,ee=null;return f.isMainLayout()&&(S=(0,k.jsx)(dt,{controller:f}),C=f.reorderComponents(f.renderTabContents(),f.getOrderedTabMoveableIds()),w=(0,k.jsx)(`div`,{"aria-hidden":`true`,className:f.getClassName(L.FLEXLAYOUT__LAYOUT_TAB_STAMPS),children:f.renderDragTabButtons()},`__dragTabButtons__`),ee=(0,k.jsx)(`div`,{ref:c,className:f.getClassName(L.FLEXLAYOUT__LAYOUT_MOVEABLES_HOME)},`__moveables_home__`)),(0,k.jsxs)(`div`,{ref:a,className:f.getClassName(L.FLEXLAYOUT__LAYOUT),onDragEnter:f.getDragDropManager().onDragEnterRaw,onDragLeave:f.getDragDropManager().onDragLeaveRaw,onDragOver:f.getDragDropManager().onDragOver,onDrop:f.getDragDropManager().onDrop,children:[m,ee,_,y,x,C,S,w]})});nn.displayName=`LayoutInternal`;var rn=O.forwardRef((e,t)=>{let n=(0,O.useRef)(null),r=(0,O.useRef)(e.model),i=(0,O.useRef)(0);r.current!==e.model&&(e.model.getAdoptedFromModel()!==r.current&&i.current++,r.current=e.model),(0,O.useEffect)(()=>(e.model.setI18nDefaults(Oe),e.model.setI18nTranslator(e.i18nTranslator),()=>{e.model.setI18nDefaults(void 0),e.model.setI18nTranslator(void 0)}),[e.model,e.i18nTranslator]),rn.displayName=`Layout`,(0,O.useImperativeHandle)(t,()=>({redraw:()=>{n.current?.redrawLayoutAndTabContent()},addTabToTabSet:(e,t)=>n.current?.addTabToTabSet(e,t),addTabWithDragAndDrop:(e,t,r)=>{n.current?.addTabWithDragAndDrop(e,t,r)},moveTabWithDragAndDrop:(e,t)=>{n.current?.moveTabWithDragAndDrop(e,t)},addTabToActiveTabSet:e=>n.current?.addTabToActiveTabSet(e),setDragComponent:(e,t,r,i)=>{n.current?.setDragComponent(e,t,r,i)},editTabName:e=>{let t=n.current?.getModel().getNodeById(e);t instanceof G&&t.isEnableRename()&&tn(t.getLayout())?.setEditingTab(t)},getRootDiv:()=>n.current.getRootDiv()}));let a=(0,O.useRef)({}),o=e.invalidateTabContentOnParentRender===!1?a.current:{};return(0,k.jsx)(nn,{ref:n,...e,parentRedrawRevision:o},i.current)});R.SET_ACTIVE_TABSET;var an=`nx-kv-ui`,on={view:`todo`,topic:``};function sn(){try{let e=localStorage.getItem(an);return e?{...on,...JSON.parse(e)}:{...on}}catch{return{...on}}}var cn=(0,O.createContext)(null);function ln({children:e}){let[n,r]=(0,O.useState)(null),[i,a]=(0,O.useState)(null),[o,s]=(0,O.useState)(sn);(0,O.useEffect)(()=>{try{localStorage.setItem(an,JSON.stringify(o))}catch{}},[o]);let c=(0,O.useCallback)(async()=>{let e=await t(`/api/bootstrap`);return r(e),e},[]),l=(0,O.useCallback)(async()=>{a(await t(`/api/bundled`).catch(()=>null))},[]);(0,O.useEffect)(()=>{c(),l()},[c,l]);let u=(0,O.useCallback)(e=>{s(t=>typeof e==`function`?{...t,...e(t)}:{...t,...e})},[]),d=(0,O.useCallback)((e,t)=>{s(n=>{let r=new Set(n[e]);return r.has(t)?r.delete(t):r.add(t),{...n,[e]:[...r]}})},[]),f=(0,O.useMemo)(()=>({boot:n,bundled:i,ui:o,patchUi:u,toggleSel:d,refreshBoot:c,refreshBundled:l}),[n,i,o,u,d,c,l]);return(0,k.jsx)(cn.Provider,{value:f,children:e})}function un(){let e=(0,O.useContext)(cn);if(!e)throw Error(`useStore 必须在 StoreProvider 内使用`);return e}function dn({text:e,className:t=``,title:n,children:r}){let a=i();return(0,k.jsx)(`span`,{className:`copyable`+(t?` `+t:``),title:n||`点击复制`,onClick:async()=>{let t=String(e??``);try{await navigator.clipboard.writeText(t),a(`已复制: `+(t.length>60?t.slice(0,57)+`...`:t))}catch{try{let e=document.createElement(`textarea`);e.value=t,e.style.cssText=`position:fixed;opacity:0`,document.body.appendChild(e),e.select(),document.execCommand(`copy`),e.remove(),a(`已复制: `+(t.length>60?t.slice(0,57)+`...`:t))}catch{a(`复制失败(剪贴板不可用)`)}}},children:r===void 0?e:r})}var fn=class extends O.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[nx-kv] 视图渲染失败:`,e,t)}render(){return this.state.error?(0,k.jsxs)(`div`,{className:`card`,style:{padding:16},children:[(0,k.jsx)(`div`,{className:`colhead`,children:(0,k.jsx)(`h3`,{children:`这个面板出错了`})}),(0,k.jsx)(`div`,{style:{whiteSpace:`pre-wrap`,wordBreak:`break-all`,marginBottom:10},children:String(this.state.error?.message||this.state.error)}),(0,k.jsx)(`div`,{className:`muted`,style:{marginBottom:10},children:`其他面板不受影响,可以切到别的 tab 继续操作;控制台有完整堆栈。`}),(0,k.jsx)(`button`,{className:`btn`,onClick:()=>this.setState({error:null}),children:`重试`})]}):this.props.children}},pn=(0,O.createContext)(null);function mn(){return(0,O.useContext)(pn)}var hn=1.2,gn=2.5;function _n(e){let t=Number(e);return!Number.isFinite(t)||t<=0?`expanded`:t<2?`closed`:t<8?`collapsed`:`expanded`}function vn(e){let t=Number(e);return!Number.isFinite(t)||t<=0?16:t<.5?hn:yn(_n(t)).weight}function yn(e){return{weight:e===`closed`?hn:e===`collapsed`?gn:16,enableTabStrip:!1}}var bn={SIDEBAR:`sidebar`,MAIN:`maincontent`,RIGHT:`rightSidebar`,FLOAT:`float`},xn={sidebar:bn.SIDEBAR,dir:bn.MAIN,page:bn.MAIN,group:bn.MAIN,repos:bn.MAIN,cloud:bn.MAIN,overview:bn.MAIN,templates:bn.MAIN,doc:bn.MAIN,dag:bn.MAIN,compose:bn.MAIN,progress:bn.RIGHT,refs:bn.RIGHT,settings:bn.FLOAT},Sn=new Set([`sidebar`,`repos`,`cloud`,`overview`,`progress`,`refs`,`settings`]);function Cn(e){return xn[e]||bn.MAIN}function wn(e){return Sn.has(e)}var Tn=`nx-kv-ui.workspace`,En={tabEnableClose:!0,tabEnableDrag:!0,tabEnableRename:!1,tabEnablePopout:!1,tabEnablePopoutIcon:!1,tabEnableFloat:!0,tabEnableFloatIcon:!1,tabEnablePin:!1,tabSetEnableClose:!1,tabSetEnableCloseButton:!0,tabSetEnableMaximize:!1,tabSetEnableDrag:!0,tabSetEnableDrop:!0,tabSetEnableTabGroups:!1,tabSetAutoSelectTab:!0,borderEnableClose:!0,enableEdgeDock:!0,enableEdgeDockIndicators:!0,rootOrientationVertical:!1};function Dn(){return{global:{...En},borders:[],layout:{type:`row`,children:[{type:`tabset`,id:`ts_sidebar`,weight:16,enableTabStrip:!1,children:[{type:`tab`,id:`t_sidebar`,name:`目录`,component:`sidebar`,enableClose:!1}]},{type:`tabset`,id:`ts_main`,weight:68,enableTabStrip:!1,children:[{type:`tab`,id:`t_welcome`,name:`开始`,component:`welcome`}]},{type:`tabset`,id:`ts_right`,weight:16,enableTabStrip:!1,children:[]}]}}}function On(e){return e.updateAttrs({...En}),e}function kn(e){if(!e||e.type!==`row`||!Array.isArray(e.children))return e;let t=e=>(e.type===`row`&&(e.children=(e.children||[]).map(e=>e.type===`row`?t(e):e).filter(e=>e.type===`tabset`||e.type===`row`?(e.children||[]).length>0:!0)),e);return t(e).children.length?e:null}function An(e){if(!e||typeof e!=`object`)return e;if(Array.isArray(e.borders)&&(e.borders=e.borders.filter(e=>Array.isArray(e.children)&&e.children.length>0)),e.subLayouts&&typeof e.subLayouts==`object`){for(let t of Object.keys(e.subLayouts)){let n=e.subLayouts[t],r=n&&n.layout;(!r||!Array.isArray(r.children)||r.children.length===0||r.children.length===1&&r.children[0]&&r.children[0].type===`tabset`&&(r.children[0].children||[]).length===0)&&delete e.subLayouts[t]}Object.keys(e.subLayouts).length===0&&delete e.subLayouts}return e}function jn(e){if(!e||!e.layout)return!1;let t=!1,n=null,r=null,i=(e,t)=>{if(e&&(e.type===`tab`&&e.component===`sidebar`&&(n=e,t&&t.type===`tabset`&&(r=t)),Array.isArray(e.children)))for(let t of e.children)i(t,e)};i(e.layout,null);let a=e.layout,o=a&&a.type===`row`&&Array.isArray(a.children);if(!n)return o&&(a.children.unshift({type:`tabset`,id:`ts_sidebar`,weight:yn(`expanded`).weight,enableTabStrip:!1,children:[{type:`tab`,id:`t_sidebar`,name:`目录`,component:`sidebar`,enableClose:!1}]}),t=!0),t;if(n.enableClose!==!1&&(n.enableClose=!1,t=!0),r&&Array.isArray(r.children)&&r.children.some(e=>e&&e.component!==`sidebar`)&&o){let e=r.children,i=e.indexOf(n);i>=0&&e.splice(i,1),typeof r.selected==`number`&&(i>=0&&r.selected>i?--r.selected:i>=0&&r.selected===i&&(r.selected=Math.max(0,Math.min(e.length-1,i))),e.length===0?delete r.selected:r.selected>=e.length&&(r.selected=e.length-1)),r.enableTabStrip=!0;let o=Number(r.weight);return(!Number.isFinite(o)||o<8)&&(r.weight=84),a.children.unshift({type:`tabset`,id:`ts_sidebar`,weight:yn(`expanded`).weight,enableTabStrip:!1,children:[n]}),t=!0,t}if(r){let e=Number(r.weight);if(!Number.isFinite(e)||e<2){let e=yn(`expanded`);(r.weight!==e.weight||r.enableTabStrip!==e.enableTabStrip)&&(r.weight=e.weight,r.enableTabStrip=e.enableTabStrip,t=!0)}else{let n=vn(e);e!==n&&(r.weight=n,r.enableTabStrip=yn(n<8?`collapsed`:`expanded`).enableTabStrip,t=!0)}}return t}function Mn(e){if(!e||!e.layout)return!1;let t=!1,n=e=>{if(e.type===`tabset`&&e.enableTabStrip!==!1&&(e.enableTabStrip=!1,t=!0),Array.isArray(e.children))for(let t of e.children)n(t)};n(e.layout);let r=e.layout;return r&&r.type===`row`&&Array.isArray(r.children)&&!r.children.some(e=>e&&e.id===`ts_right`)&&(r.children.push({type:`tabset`,id:`ts_right`,weight:16,enableTabStrip:!1,children:[]}),t=!0),t}function Nn(e){if(!e||!e.layout||e.layout.type!==`row`||!Array.isArray(e.layout.children))return!1;let t=!1,n=e=>{if(!t&&(e.type===`tabset`&&(e.children||[]).some(e=>e&&e.component!==`sidebar`)&&(t=!0),Array.isArray(e.children)))for(let t of e.children)n(t)};if(n(e.layout),t)return!1;let r={type:`tabset`,id:`ts_main`,weight:68,enableTabStrip:!1,children:[{type:`tab`,id:`t_welcome`,name:`开始`,component:`welcome`}]},i=e.layout,a=i.children.findIndex(e=>e&&e.id===`ts_right`);return a>=0?i.children.splice(a,0,r):i.children.push(r),!0}function Pn(){try{let e=localStorage.getItem(Tn);if(!e)return On(Te.fromJson(Dn()));let t=JSON.parse(e);return!t||!t.layout||!kn(t.layout)?On(Te.fromJson(Dn())):(An(t),jn(t),Mn(t),Nn(t),On(Te.fromJson(t)))}catch{return On(Te.fromJson(Dn()))}}function Fn(e){try{let t=e.toJson();t.layout&&kn(t.layout)&&(An(t),localStorage.setItem(Tn,JSON.stringify(t)))}catch{}}function In(e){if(!e)return 0;let t=[];e.visitNodes(e=>{e.getType()===`tabset`&&(e.getChildren()||[]).length===0&&t.push(e.getId())});for(let n of t)e.doAction(R.deleteTabset(n));return t.length}function Ln(){try{localStorage.removeItem(Tn)}catch{}}function Rn(e){let t=e||{};return Object.keys(t).filter(e=>t[e]!==void 0).sort().map(e=>`${e}=${String(t[e])}`).join(`|`)}function zn(e,t,n){let r=Rn(n),i=null;return e.visitNodes(e=>{i||e.getType()===`tab`&&e.getComponent()===t&&Rn(e.getConfig()||{})===r&&(i=e)}),i}function Bn(e){let t=[];return e.visitNodes(e=>{e.getType()===`tabset`&&t.push(e)}),t}function Vn(e,t){let n=null;return e.visitNodes(e=>{n||e.getType()===`tab`&&e.getComponent()===t&&(n=e)}),n}function Hn(e){if(!e)return null;let t=Gn(e);if(!t)return null;let n=e.getNodeById?e.getNodeById(t):null;if(!n)return null;let r=typeof n.getSelectedTab==`function`?n.getSelectedTab():null,i=n.getTabNodes&&n.getTabNodes()||[],a=r||i[i.length-1]||null;return a?{component:a.getComponent(),name:a.getName(),config:a.getConfig()||{}}:null}function Un(e,t){return!t||!t.length?!1:(e.getTabNodes()||[]).some(e=>t.includes(e.getComponent()))}function Wn(e,t=[]){let n=e.getActiveTabset()||e.getFirstTabSet();if(n&&!Un(n,t))return n.getId();let r=[...Bn(e)].reverse().find(e=>!Un(e,t));return r?r.getId():n?n.getId():void 0}function Gn(e){if(!e)return null;let t=null;return e.visitNodes(e=>{if(t||e.getType()!==`tabset`)return;let n=e.getId();if(n===`ts_main`){t=n;return}n!==`ts_sidebar`&&n!==`ts_right`&&!Un(e,[`sidebar`])&&(t=n)}),t}var Kn=[`progress`,`refs`];function qn(e){if(!e)return null;let t=null;return e.visitNodes(e=>{if(!t){if(e.getType()===`tabset`&&e.getId()===`ts_right`){t=e.getId();return}e.getType()===`tabset`&&typeof e.getTabNodes==`function`&&(e.getTabNodes()||[]).some(e=>Kn.includes(e.getComponent()))&&(t=e.getId())}}),t}var Jn=16,Yn=0;function Xn(e,t){let n=qn(e);return n?cr(e,n,{weight:t?Jn:Yn,enableTabStrip:!1}):!1}function Zn(e){if(!e)return;let t=[];e.visitNodes(e=>{e.getType()===`tab`&&e.getComponent()===`progress`&&t.push(e.getId())});for(let n of t)e.doAction(R.deleteTab(n));Xn(e,!1)}function Qn(e,t){if(!e)return 0;let n=qn(e),r=[];e.visitNodes(e=>{if(e.getType()!==`tab`||t&&e.getComponent()===t)return;let i=e.getParent&&e.getParent();i&&i.getId()===n&&r.push(e.getId())});for(let t of r)e.doAction(R.deleteTab(t));return r.length}function $n(e,t){if(!e)return;let n=[];e.visitNodes(e=>{e.getType()===`tab`&&e.getComponent()===t&&n.push(e.getId())});for(let t of n)e.doAction(R.deleteTab(t));let r=qn(e),i=r&&e.getNodeById?e.getNodeById(r):null;i&&i.getTabNodes&&(i.getTabNodes()||[]).length||Xn(e,!1)}function er(e,{dirKey:t,groupId:n,task:r}={}){if(!e)return;let i=Vn(e,`progress`);if(!i)return;Qn(e,`progress`);let a=i.getConfig()||{},o=n?{groupKey:n}:{dirKey:t||``};r!=null&&String(r)!==``&&(o.task=String(r)),JSON.stringify(a)!==JSON.stringify(o)&&(e.doAction(R.updateNodeAttributes(i.getId(),{config:o})),(t||n)&&Xn(e,!0))}function tr(e,t=null){if(!e)return 0;let n=qn(e),r=[];e.visitNodes(e=>{if(e.getType()!==`tab`||t&&e.getId()===t)return;let i=e.getComponent();if(i===`sidebar`||Kn.includes(i))return;let a=e.getParent&&e.getParent();if(!a||a.getType()!==`tabset`)return;let o=a.getId();o===`ts_sidebar`||n&&o===n||(typeof e.getWindowId!=`function`||e.getWindowId()!==`float`)&&r.push(e.getId())});for(let t of r)e.doAction(R.deleteTab(t));return r.length}function nr(e){if(!e)return 0;let t=[];e.visitNodes(e=>{e.getType()===`tab`&&(e.getConfig()||{}).beside&&t.push(e.getId())});for(let n of t)e.doAction(R.deleteTab(n));return t.length}function rr(e,t){let{component:n,name:r,config:i={}}=t||{};if(!e||!n)return{tabId:null,reused:!1};let a=Gn(e);if(!a)return{tabId:null,reused:!1};let o={...i,beside:!0},s=zn(e,n,o);if(s)return e.doAction(R.selectTab(s.getId())),r&&s.getName()!==r&&e.doAction(R.renameTab(s.getId(),r)),{tabId:s.getId(),reused:!0};nr(e),e.doAction(R.addTab({type:`tab`,name:r||n,component:n,config:o,enableClose:!0},a,F.getByName(`right`),-1,!0));let c=zn(e,n,o);return{tabId:c?c.getId():null,reused:!1}}function ir(e,t){let{component:n,name:r,config:i={}}=t;if(!e)return{tabId:null,reused:!1};let a=t.area||Cn(n),o=zn(e,n,i);if(o)return e.doAction(R.selectTab(o.getId())),r&&o.getName()!==r&&e.doAction(R.renameTab(o.getId(),r)),a===bn.RIGHT&&Xn(e,!0),a===bn.MAIN&&(n===`page`||n===`dir`)&&er(e,{dirKey:i.dirKey,groupId:i.groupId,task:i.task}),{tabId:o.getId(),reused:!0};if(a===bn.RIGHT&&wn(n)){Qn(e,n);let t=Vn(e,n);if(t)return e.doAction(R.updateNodeAttributes(t.getId(),{config:i})),e.doAction(R.selectTab(t.getId())),r&&t.getName()!==r&&e.doAction(R.renameTab(t.getId(),r)),Xn(e,!0),{tabId:t.getId(),reused:!0}}if(a===bn.MAIN){let a=Gn(e);if(!a)return{tabId:null,reused:!1};e.doAction(R.addTab({type:`tab`,name:r,component:n,config:i},a,F.getByName(`center`),-1,!0));let o=zn(e,n,i);return o&&!t._float&&tr(e,o.getId()),o&&!t._float&&(n===`page`||n===`dir`)&&er(e,{dirKey:i.dirKey,groupId:i.groupId,task:i.task}),{tabId:o?o.getId():null,reused:!1}}if(a===bn.RIGHT){let t=qn(e);if(t){Qn(e,n),Xn(e,!0),e.doAction(R.addTab({type:`tab`,name:r,component:n,config:i},t,F.getByName(`center`),-1,!0));let a=zn(e,n,i);return{tabId:a?a.getId():null,reused:!1}}let a=e.getRootRow?e.getRootRow():null;if(a){e.doAction(R.addTab({type:`tab`,name:r,component:n,config:i},a.getId(),F.getByName(`right`),-1,!0));let t=zn(e,n,i);return Xn(e,!0),{tabId:t?t.getId():null,reused:!1}}}if(a===bn.FLOAT)return ar(e,{...t,component:n,name:r,config:i});let s=Wn(e,[`sidebar`]);if(!s)return{tabId:null,reused:!1};let c=F.getByName(t.location||`center`);e.doAction(R.addTab({type:`tab`,name:r,component:n,config:i},s,c,-1,!0));let l=zn(e,n,i);return{tabId:l?l.getId():null,reused:!1}}function ar(e,t){let n=zn(e,t.component,t.config||{});if(n)return e.doAction(R.selectTab(n.getId())),{tabId:n.getId(),reused:!0};let r=Gn(e);if(!r)return{tabId:null,reused:!1};let i=e.nextUniqueId(),a=[R.addTab({type:`tab`,id:i,name:t.name||t.component,component:t.component,config:t.config||{}},r,F.getByName(`center`),-1,!0),R.popoutTab(i,`float`)];e.doAction(R.group(a));let o=typeof window<`u`?window.innerWidth:1280,s=typeof window<`u`?window.innerHeight:800,c=Math.min(760,Math.max(560,o-160)),l=Math.min(700,Math.max(460,s-160));for(let[,t]of e.getLayouts()){if(t.getType()!==`float`)continue;let n=t.getRect(),r=new N(Math.round(n.x+(n.width-c)/2),Math.round(n.y+(n.height-l)/2),c,l);e.doAction(R.moveFloat(t.getLayoutId(),r))}return{tabId:i,reused:!1}}function or(e,t){if(!e)return null;let n=null;return e.visitNodes(e=>{if(n||e.getType()!==`tab`||e.getComponent()!==t)return;let r=e.getParent();r&&r.getType()===`tabset`&&(n=r)}),n?n.getId():null}function sr(e,t){if(!e||!t)return null;let n=null;return e.visitNodes(e=>{n===null&&e.getType()===`tabset`&&e.getId()===t&&(n=e.getWeight())}),n}function cr(e,t,n){if(!e||!t)return!1;let r=!1;return e.visitNodes(e=>{r||e.getType()===`tabset`&&e.getId()===t&&(r=!0)}),r?(e.doAction(R.updateNodeAttributes(t,n)),!0):!1}function lr(e){if(!e)return null;let t=or(e,`sidebar`);if(t)return t;let n=e.getFirstTabSet&&e.getFirstTabSet(),r=n?n.getId():null;if(!r)return null;e.doAction(R.addTab({type:`tab`,id:`t_sidebar`,name:`目录`,component:`sidebar`,enableClose:!1},r,F.getByName(`left`),-1,!0));let i=or(e,`sidebar`);return i&&cr(e,i,yn(`expanded`)),i}function ur(e){let t=e&&e.getActiveTabset();return t&&t.getSelectedNode()||null}var dr=`__GLOBAL__`;function fr(e,t,n,r,i=``){let a=String(i||``).trim().toLowerCase(),o=new Set(r.hidden||[]),s=new Map;for(let e of n||[]){if(e.isGlobal)continue;let t=e.repo&&e.repo.id;t&&(s.has(t)||s.set(t,[]),s.get(t).push(e))}let c=(e||[]).filter(e=>!o.has(e.key||e.id)).map(e=>{let t=s.get(e.id)||[];return{type:`repo`,key:e.key||e.id,repoId:e.id,topicKey:t.length?t[0].key:``,name:e.name,icon:e.icon||``,cwd:e.path||``,desc:e.desc||``,boards:e.boards||[],summary:t.map(e=>e.summary).filter(Boolean).join(` / `),pending:t.reduce((e,t)=>e+_(t.tasks),0),waiting:t.some(e=>e.waiting),topics:t}}),l=new Map(c.map(e=>[e.key,e])),u=e=>!a||String(e.name||``).toLowerCase().includes(a)||String(e.key||``).toLowerCase().includes(a)||String(e.cwd||``).toLowerCase().includes(a)||String(e.desc||``).toLowerCase().includes(a)||String(e.summary||``).toLowerCase().includes(a),d=c.filter(u),f=[],p=t||[];for(let e of p){if(o.has(e.key||e.id))continue;let t=(e.repos||[]).map(e=>l.get(e.key)).filter(Boolean),n=t.some(u);(!a||u(e)||n)&&f.push({type:`board`,id:e.id,key:e.key||e.id,name:e.name,desc:e.desc||``,count:(e.repos||[]).length,pending:t.reduce((t,n)=>t+(n.topics||[]).reduce((t,n)=>t+(n.tasks||[]).filter(t=>v(t,e)).filter(y).length,0),0),waiting:t.some(e=>e.waiting),members:(e.repos||[]).map(e=>e.key)})}for(let e of d)f.push({...e,groupId:``});let m=new Map((r.order||[]).map((e,t)=>[e,t])),h=new Map;p.forEach((e,t)=>h.set(e.id,t));let g=p.length,b=e=>e.type===`board`?h.has(e.id)?h.get(e.id):g:e.groupId&&h.has(e.groupId)?h.get(e.groupId):g,x=f.map((e,t)=>({r:e,i:t})).sort((e,t)=>{let n=m.has(pr(e.r))?m.get(pr(e.r)):1/0,r=m.has(pr(t.r))?m.get(pr(t.r)):1/0;if(n!==r)return n-r;let i=b(e.r),a=b(t.r);if(i!==a)return i-a;let o=e.r.type===`board`?0:1,s=t.r.type===`board`?0:1;return o===s?String(e.r.name||``).localeCompare(String(t.r.name||``)):o-s}).map(e=>e.r),S=(n||[]).find(e=>e.isGlobal),C=[];return S&&C.push({type:`global`,key:dr,name:S.name||`全局任务`,topic:S,pending:S.pending||0,waiting:!!S.waiting,topics:(S.tasks||[]).filter(e=>!e.deletedAt)}),C.push(...x),{rows:C,matchCount:a?C.filter(e=>e.type===`board`||e.type===`repo`&&!e.groupId).length:0}}function pr(e){return e.type===`board`?`board:`+e.id:e.key}function mr(e){let t=m(String(e?.text||``)),n=t.match(/^#\s+(.+)$/m);return n?n[1].trim().slice(0,40):(t.split(`
|
|
30
|
-
`).find(e=>e.trim())||`#${e?.id}`).trim().slice(0,40)}function hr(e,t){let n=t.getBoundingClientRect(),r=e.clientY-n.top,i=n.height;return r<i*.3?`before`:r>i*.7?`after`:`into`}function gr(e,t,n){return e?e.type===`repo`?t.type===`board`?n===`into`:t.type===`repo`?n===`before`||n===`after`:!1:e.type===`board`&&t.type===`board`&&t.id!==e.id&&(n===`before`||n===`after`):!1}function _r(e,t,n,r){let i=[...e.order||[]],a=e=>e.type===`board`?`board:`+e.id:e.key;if(t.type===`repo`&&n.type===`repo`){let e=i.filter(e=>e!==a(t)),o=e.indexOf(a(n));return o<0?{order:i}:(e.splice(r===`before`?o:o+1,0,a(t)),{order:e})}if(t.type===`board`&&n.type===`board`){let e=i.filter(e=>e!==a(t)),o=e.indexOf(a(n));return o<0?{order:i}:(e.splice(r===`before`?o:o+1,0,a(t)),{order:e})}return{}}async function vr({row:e,onNavigate:n,refreshLocal:r,toast:i,draft:a=!1}){let o=e=>a?`${e}?task=draft`:e;if(e.type===`global`||e.topicKey){n(o(e.type===`global`?`#/global`:`#/dir/${encodeURIComponent(e.topicKey)}`));return}if(!e.cwd){i&&i(`「${e.name}」没有目录路径,无法创建任务队列`);return}try{let a=await t(`/api/localtasks/topic`,{method:`POST`,body:{cwd:e.cwd}});await r?.(),a&&a.existed===!1&&i&&i(`已为「${e.name}」创建任务队列`),n(o(`#/dir/${encodeURIComponent(a.key)}`))}catch(e){i&&i(`创建任务队列失败: `+(e.message||e))}}function yr({row:e,prefs:n,patchPrefs:r,onNavigate:i,boards:a,onDataChanged:o,refreshLocal:s,toast:c,dialog:l}){if(e.type===`repo`){let l=a||[],u=t=>(e.boards||[]).some(e=>e.key===t.key||e.id===t.id),d=async(n,r)=>{try{await t(`/api/boards/assign`,{method:`POST`,body:r?{key:e.key,board:n.key||n.id,remove:!0}:{key:e.key,board:n.key||n.id}}),o&&o()}catch(e){c(`归属变更失败: `+e.message)}};return[{label:`打开详情`,icon:`folder`,onClick:()=>vr({row:e,onNavigate:i,refreshLocal:s,toast:c})},{label:`置顶`,icon:`pin`,onClick:()=>r({order:[e.key,...(n.order||[]).filter(t=>t!==e.key)]})},`sep`,...l.map(e=>({label:(u(e)?`✓ `:``)+(u(e)?`移出「`:`归入「`)+e.name+`」`,icon:`folder`,onClick:()=>d(e,u(e))})),`sep`,{label:`从侧边栏隐藏(不删登记)`,icon:`x`,onClick:()=>r(t=>({hidden:[...t.hidden||[],e.key]}))}]}return e.type===`board`?[{label:`在仓库页打开该看板`,icon:`repo`,onClick:()=>i(`#/repos`)},`sep`,{label:`删除看板(成员仓库回到未分组)`,icon:`trash`,danger:!0,onClick:async()=>{if(await l({title:`删除看板「${e.name}」`,message:`它的 ${e.count} 个仓库会回到未分组(登记不动)。`,danger:!0,okText:`删除`}))try{await t(`/api/boards/${encodeURIComponent(e.id)}`,{method:`DELETE`,body:{}}),o&&o()}catch(e){c(`删除失败: `+e.message)}}}]:[{label:`打开全局任务池`,icon:`globe`,onClick:()=>i(`#/global`)}]}function br({dialog:e,toast:n,onDataChanged:r}){return[{label:`登记仓库…`,icon:`folder`,onClick:async()=>{let i=await e({title:`登记仓库`,input:!0,placeholder:`仓库绝对路径,如 D:/a_js/js_proj/nx-kv`});if(i)try{await t(`/api/repos`,{method:`POST`,body:{path:i.trim()}}),n(`已登记仓库 `+i.trim()),r&&r()}catch(e){n(`登记失败: `+e.message)}}},{label:`新建看板(项目组)…`,icon:`plus`,onClick:async()=>{let i=await e({title:`新建看板`,input:!0,placeholder:`看板名,如 前端 / nx 家族`});if(i)try{await t(`/api/boards`,{method:`POST`,body:{name:i.trim()}}),n(`已新建看板 `+i.trim()),r&&r()}catch(e){n(`新建失败: `+e.message)}}}]}function xr(e){return!e||e.deletedAt||e.migratedTo?`gone`:a(e)?`done`:l(e)?`doing`:s(e)?`gone`:`pending`}function Sr(e){return e?e.deletedAt?`已删除`:e.migratedTo?`已迁移`:u[e.status]||String(e.status??``):``}var Cr={pending:`等`,doing:`跑`,done:`完`,gone:`档`};function wr(e){return Cr[xr(e)]||`等`}function Tr(e,t){let n=Array.isArray(e)?e:[],[r,i]=(0,O.useState)(0),a=Math.max(1,Number(t)||1),o=Math.max(1,Math.ceil(n.length/a)),s=Math.min(Math.max(0,r),o-1),c=s*a;return{page:s,pageCount:o,total:n.length,items:n.slice(c,c+a),setPage:i}}function Er({page:e=0,pageCount:t=1,total:n=0,onPage:r,unit:i=`条`}){let a=e=>r&&r(Math.max(0,Math.min(e,t-1)));return t<=1?(0,k.jsxs)(`span`,{className:`pager-n`,children:[`共 `,n,` `,i]}):(0,k.jsxs)(`span`,{className:`pager`,children:[(0,k.jsx)(`button`,{type:`button`,className:`pager-btn`,disabled:e<=0,onClick:()=>a(e-1),"aria-label":`上一页`,title:`上一页`,children:`‹`}),(0,k.jsxs)(`span`,{className:`pager-n`,children:[`第 `,e+1,`/`,t,` 页 · 共 `,n,` `,i]}),(0,k.jsx)(`button`,{type:`button`,className:`pager-btn`,disabled:e>=t-1,onClick:()=>a(e+1),"aria-label":`下一页`,title:`下一页`,children:`›`})]})}var Dr=12;function Or({row:e,onNavigate:t,refreshLocal:n,limit:r=Dr}){let a=i(),o=Tr((0,O.useMemo)(()=>{let t=e.type===`global`?e.tasks||[]:(e.topics||[]).flatMap(e=>(e.tasks||[]).filter(e=>!e.deletedAt&&!S(e)));return x(t)},[e]),r),s=o.items,l=e.type===`global`?`#/global`:`#/dir/${encodeURIComponent(e.topicKey||e.key)}`;return(0,k.jsxs)(k.Fragment,{children:[s.map(n=>(0,k.jsxs)(`button`,{type:`button`,className:`trow child task-child`,title:String(n.text||``).slice(0,200),onClick:e=>{e.stopPropagation(),t(`${l}?task=${encodeURIComponent(n.id)}`)},children:[(0,k.jsx)(`span`,{className:`gico`,children:(0,k.jsx)(c,{name:`list`,size:12})}),(0,k.jsx)(`span`,{className:`nm`,children:mr(n)}),(0,k.jsx)(`span`,{className:`cnt ${xr(n)}`,children:wr(n)})]},`${e.topicKey||e.key}:t:${n.id}`)),o.pageCount>1&&(0,k.jsx)(`div`,{className:`trow child task-pager`,children:(0,k.jsx)(Er,{page:o.page,pageCount:o.pageCount,total:o.total,onPage:o.setPage,unit:`条任务`})}),(0,k.jsxs)(`button`,{type:`button`,className:`trow child task-new`,title:`新建一页 MD(新页签打开;仓库还没有任务队列时先创建队列)`,onClick:r=>{r.stopPropagation(),vr({row:e,onNavigate:t,refreshLocal:n,toast:a,draft:!0})},children:[(0,k.jsx)(`span`,{className:`gico`,children:(0,k.jsx)(c,{name:`plus`,size:12})}),(0,k.jsx)(`span`,{className:`nm`,children:`新建页`})]})]})}function kr({repos:e,boards:t,topics:n,route:a,onNavigate:o,refreshLocal:s,waitingCount:l,prefs:u,patchPrefs:f,refreshRepos:p,onCollapse:m,onClose:h,shell:g}){let _=i(),{dialog:v,node:y}=r(),[b,x]=(0,O.useState)(``),[S,C]=(0,O.useState)(null),[w,ee]=(0,O.useState)(-1),[T,E]=(0,O.useState)(()=>new Set),D=(0,O.useRef)(null),[A,j]=(0,O.useState)(null),te=(0,O.useRef)(null),{rows:ne,matchCount:re}=(0,O.useMemo)(()=>fr(e,t,n,u,b),[e,t,n,u,b]),ie=e=>e.type===`global`?a.view===`global`:e.type===`repo`?a.view===`dir`&&a.key===e.topicKey:e.type===`board`&&a.view===`group`&&a.key===e.id;(0,O.useEffect)(()=>{a.view===`dir`&&a.key&&E(e=>{if(e.has(a.key))return e;let t=new Set(e);return t.add(a.key),t})},[a.view,a.key]);let ae=(0,O.useCallback)(e=>{E(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),M=(0,O.useCallback)(e=>{e.type===`board`?o(`#/group/`+encodeURIComponent(e.id)):e.type===`global`?o(`#/global`):e.topicKey?o(`#/dir/`+encodeURIComponent(e.topicKey)):vr({row:e,onNavigate:o,refreshLocal:s,toast:_})},[o,s,_]),N=(0,O.useCallback)(e=>{e.type===`global`?o(`#/global`):ae(e.topicKey||e.key)},[o,ae]),P=e=>{S||(e.key===`ArrowDown`||e.key===`ArrowUp`?(e.preventDefault(),ee(t=>t<0?e.key===`ArrowDown`?0:ne.length-1:Math.min(ne.length-1,Math.max(0,t+(e.key===`ArrowDown`?1:-1))))):e.key===`Home`?(e.preventDefault(),ee(0)):e.key===`End`?(e.preventDefault(),ee(ne.length-1)):e.key===`Enter`?w>=0&&ne[w]&&M(ne[w]):e.key===`Escape`&&ee(-1))},F=(e,t)=>{D.current={type:t.type,key:t.key,id:t.id,name:t.name},e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,t.type+`:`+(t.key||t.id)),e.currentTarget.classList.add(`dragging`)},I=e=>{D.current=null,j(null),e.currentTarget?.classList?.remove(`dragging`)},L=(e,t)=>{if(!D.current)return;e.preventDefault();let n=hr(e,e.currentTarget);gr(D.current,t,n)?(e.dataTransfer.dropEffect=`move`,j({id:t.key||t.id,zone:n})):j(null)},R=()=>j(e=>e&&null),z=(e,t)=>{e.preventDefault();let n=D.current;if(D.current=null,j(null),!n)return;let r=hr(e,e.currentTarget);gr(n,t,r)&&f(_r(u,n,t,r))},oe=e=>{let t=D.current;if(D.current=null,j(null),!t||t.type!==`repo`)return;e.preventDefault();let n=t.key,r=(u.order||[]).filter(e=>e!==n);r.push(n),f({order:r})},se=(e,n)=>{e.preventDefault(),e.stopPropagation(),C({x:e.clientX,y:e.clientY,items:yr({row:n,prefs:u,patchPrefs:f,onNavigate:o,boards:t,onDataChanged:p,refreshLocal:s,toast:_,dialog:v})})},ce=e=>{C({x:e.clientX,y:e.clientY,items:br({dialog:v,toast:_,onDataChanged:p})})},le=(e,t,n)=>(0,k.jsxs)(`button`,{className:`trow`+(a.view===e.replace(`#/`,``)?` active`:``),onClick:()=>o(e),children:[(0,k.jsx)(`span`,{className:`gico`,children:(0,k.jsx)(c,{name:t})}),(0,k.jsx)(`span`,{className:`nm`,children:n})]});return(0,k.jsxs)(`aside`,{id:`side`,children:[(0,k.jsxs)(`div`,{className:`shead`,children:[(0,k.jsxs)(`div`,{className:`brandrow`,children:[(0,k.jsx)(`span`,{className:`nx-logo`,"aria-hidden":!0,children:`nx`}),(0,k.jsx)(`span`,{className:`nx-title`,children:`nx-kv`}),(0,k.jsx)(`span`,{className:`grow`}),(0,k.jsx)(`button`,{className:`iconbtn`,title:`设置(浮动面板)`,"aria-label":`设置`,onClick:()=>g&&g.openSettings(),children:(0,k.jsx)(c,{name:`gear`,size:15})}),(0,k.jsx)(`button`,{className:`iconbtn collapse`,title:`收起目录(变窄轨;点窄轨可展开)`,"aria-label":`收起目录`,onClick:m,children:(0,k.jsx)(c,{name:`back`,size:15})}),(0,k.jsx)(`button`,{className:`iconbtn collapse`,title:`关闭目录(完全隐藏,左缘把手可展开)`,"aria-label":`关闭目录`,onClick:h,children:(0,k.jsx)(c,{name:`x`,size:14})})]}),(0,k.jsxs)(`div`,{className:`searchrow`,children:[(0,k.jsxs)(`label`,{className:`sbox`,children:[(0,k.jsx)(c,{name:`search`}),(0,k.jsx)(`input`,{value:b,placeholder:`搜索仓库(命中自动展开)`,onChange:e=>x(e.target.value),onKeyDown:e=>{e.key===`Escape`&&x(``)}})]}),b&&(0,k.jsxs)(`span`,{className:`kwcount`,children:[re,` 个匹配`]}),(0,k.jsx)(`button`,{className:`iconbtn add`,title:`添加目录 / 新建分组`,"aria-label":`添加目录或新建分组`,onClick:ce,children:(0,k.jsx)(c,{name:`plus`})})]})]}),(0,k.jsxs)(`div`,{id:`tree`,ref:te,tabIndex:0,onKeyDown:P,onDragOver:e=>{D.current?.type===`repo`&&e.preventDefault()},onDrop:oe,children:[ne.map((e,t)=>e.type===`board`?(0,k.jsxs)(`button`,{className:`trow group`+(ie(e)?` active`:``)+(w===t?` kb-focus`:``),onClick:()=>M(e),onContextMenu:t=>se(t,e),draggable:!0,onDragStart:t=>F(t,e),onDragEnd:I,onDragOver:t=>L(t,e),onDragLeave:R,onDrop:t=>z(t,e),"data-drop":A?.id===e.id?A.zone:void 0,title:`${e.name} · ${e.count} 个目录\n${e.desc||`项目组:点进去操作组下的项目`}`,children:[(0,k.jsx)(`span`,{className:`tw`,"aria-hidden":!0}),(0,k.jsx)(`span`,{className:`gico`,children:(0,k.jsx)(c,{name:`folder`})}),(0,k.jsxs)(`span`,{className:`nm`,children:[e.name,e.waiting?(0,k.jsx)(`span`,{className:`wdot`,title:`组内有 agent 等待回填`}):null]}),(0,k.jsx)(`span`,{className:`cnt`,title:`待领取 ${e.pending} · 成员 ${e.count} 个`,children:e.pending>0?e.pending:e.count}),(0,k.jsx)(`span`,{className:`more`,role:`button`,tabIndex:-1,"aria-label":`看板菜单`,onClick:t=>se(t,e),children:(0,k.jsx)(c,{name:`dots`,size:13})})]},`b:`+e.id):(0,k.jsxs)(`div`,{className:`tblock`,children:[(0,k.jsxs)(`button`,{className:`trow`+(e.type===`repo`&&e.groupId?` child`:``)+(e.type===`repo`&&T.has(e.topicKey)?` open`:``)+(ie(e)?` active`:``)+(e.pending>0?` pinned`:``)+(w===t?` kb-focus`:``),onClick:()=>M(e),onContextMenu:t=>se(t,e),title:e.cwd?`${e.name}\n${e.cwd}\n${e.desc||e.summary||``}`:e.name,draggable:!0,onDragStart:t=>F(t,e),onDragEnd:I,onDragOver:t=>L(t,e),onDragLeave:R,onDrop:t=>z(t,e),"data-drop":A?.id===e.key?A.zone:void 0,children:[(0,k.jsx)(`span`,{className:`tw`,role:`button`,tabIndex:-1,"aria-label":`展开子任务`,onClick:t=>{t.stopPropagation(),N(e)},children:(0,k.jsx)(c,{name:`chevron`,size:10})}),(0,k.jsx)(`span`,{className:`gico`,children:e.icon?(0,k.jsx)(`span`,{className:`trow-icon`,"aria-hidden":!0,children:e.icon}):(0,k.jsx)(c,{name:e.type===`global`?`globe`:`folder`})}),(0,k.jsxs)(`span`,{className:`nm`,children:[e.name,e.type===`global`&&e.waiting?(0,k.jsx)(`span`,{className:`wdot`,title:`有等待中的主题`}):null]}),e.pending>0&&(0,k.jsx)(`span`,{className:`cnt`,children:e.pending}),e.type===`repo`&&e.waiting&&(0,k.jsx)(`span`,{className:`wdot`,title:`agent 等待回填中`}),(0,k.jsx)(`span`,{className:`more`,role:`button`,tabIndex:-1,"aria-label":`行菜单`,onClick:t=>se(t,e),children:(0,k.jsx)(c,{name:`dots`,size:13})})]}),(e.type===`global`?ie(e):T.has(e.topicKey||e.key))&&(0,k.jsx)(Or,{row:e,onNavigate:o,refreshLocal:s})]},e.type+`:`+e.key)),!ne.length&&(0,k.jsx)(`div`,{className:`tree-empty`,children:b?`没有匹配的仓库`:`还没有登记仓库:点右上 + 登记,或去「仓库管理」`}),(0,k.jsx)(`div`,{className:`droptail`,"aria-hidden":`true`})]}),(0,k.jsxs)(`div`,{className:`sfoot`,children:[le(`#/overview`,`overview`,`全部目录总览`),le(`#/cloud`,`cloud`,`云端总览`),le(`#/repos`,`repo`,`仓库管理`),l>0&&(0,k.jsxs)(`button`,{className:`trow`,onClick:()=>o(`#/overview`),title:`有 agent 正在等待回填`,children:[(0,k.jsx)(`span`,{className:`gico`,children:(0,k.jsx)(c,{name:`warn`})}),(0,k.jsxs)(`span`,{className:`nm`,children:[l,` 个 agent 等待回填`]})]})]}),S&&(0,k.jsx)(d,{x:S.x,y:S.y,items:S.items,onClose:()=>C(null)}),y]})}var Ar=46,jr=120;function Mr(e){let t=e&&or(e,`sidebar`);if(!t)return`expanded`;let n=e.getNodeById?e.getNodeById(t):null;return _n(n?typeof n.getWeight==`function`?n.getWeight():Number(n.getAttributes()?.weight)||0:0)}function Nr(){let e=mn()||{},{model:t}=e,[n,r]=(0,O.useState)(()=>Mr(t)),[i,a]=(0,O.useState)(null),o=(0,O.useCallback)(e=>a(e),[]),s=(0,O.useRef)(null),l=(0,O.useCallback)(e=>{if(!t)return;let n=or(t,`sidebar`);n&&cr(t,n,yn(e))},[t]),u=(0,O.useCallback)(e=>{s.current={state:e,until:Date.now()+600},l(e),r(e)},[l]),d=(0,O.useCallback)(()=>u(`collapsed`),[u]),f=(0,O.useCallback)(()=>u(`expanded`),[u]),p=(0,O.useCallback)(()=>u(`closed`),[u]);(0,O.useEffect)(()=>{if(!i||window.ResizeObserver===void 0)return;let e=new window.ResizeObserver(e=>{for(let t of e){let e=Math.round(t.contentRect.width);r(t=>{let n=s.current;if(n){if(Date.now()>n.until)s.current=null;else if(n.state===`closed`)return`closed`;else if(n.state===`expanded`)return e>=jr&&(s.current=null),`expanded`;else if(n.state===`collapsed`)return e<Ar&&(s.current=null),`collapsed`}return t===`closed`?t:e<Ar?`collapsed`:e>=jr?`expanded`:t})}});return e.observe(i),()=>e.disconnect()},[i]),(0,O.useEffect)(()=>{if(n!==`closed`||!t)return;let e=setInterval(()=>{let e=or(t,`sidebar`),n=e&&t.getNodeById?t.getNodeById(e):null;_n(n?typeof n.getWeight==`function`?n.getWeight():Number(n.getAttributes()?.weight)||0:0)===`expanded`&&(s.current=null,r(`expanded`))},200);return()=>clearInterval(e)},[n,t]);let m=(0,O.useRef)(null);return(0,O.useEffect)(()=>{if(m.current===null){m.current=n;return}m.current!==n&&(m.current=n,l(n))},[n,l]),(0,O.useEffect)(()=>(document.body.classList.toggle(`nx-side-is-closed`,n===`closed`),()=>document.body.classList.remove(`nx-side-is-closed`)),[n]),n===`closed`?(0,k.jsx)(`div`,{ref:o,className:`nx-side-closed-host`,"aria-hidden":!0}):n===`collapsed`?(0,k.jsxs)(`div`,{ref:o,className:`nx-rail-host`,children:[(0,k.jsxs)(`button`,{className:`nx-rail`,title:`展开目录`,"aria-label":`展开目录`,onClick:f,children:[(0,k.jsx)(`span`,{className:`nx-rail-btn`,"aria-hidden":!0,children:`»`}),(0,k.jsx)(`span`,{className:`nx-rail-label`,children:`目录`})]}),(0,k.jsxs)(`div`,{className:`nx-rail-acts`,children:[(0,k.jsx)(`button`,{className:`nx-rail-act`,title:`关闭目录(完全隐藏,左缘把手可展开)`,"aria-label":`关闭目录`,onClick:p,children:(0,k.jsx)(c,{name:`x`,size:14})}),(0,k.jsx)(`button`,{className:`nx-rail-act`,title:`设置(浮动面板)`,"aria-label":`设置`,onClick:()=>e.shell&&e.shell.openSettings(),children:(0,k.jsx)(c,{name:`gear`,size:15})})]})]}):(0,k.jsx)(`div`,{ref:o,className:`nx-side-host`,children:(0,k.jsx)(kr,{repos:e.repoData?e.repoData.repos:[],boards:e.repoData?e.repoData.boards:[],topics:e.rows||[],route:e.route,onNavigate:e.onNavigate,refreshLocal:e.refreshLocal,refreshRepos:e.refreshRepos,prefs:e.prefs,patchPrefs:e.patchPrefs,onCollapse:d,onClose:p,shell:e.shell})})}var Pr=0,Fr={docs:{}},Ir=new Set,Lr=()=>{for(let e of Ir)e()},Rr=e=>(Ir.add(e),()=>Ir.delete(e)),zr=()=>Fr.docs,Br=e=>e||`__GLOBAL__`,Vr=(e,t)=>`${e}::${t}`,Hr=e=>/^draft/.test(String(e||``)),Ur=()=>`draft-${++Pr}`;function Wr(){return(0,O.useSyncExternalStore)(Rr,zr,zr)}function Gr(e,t){return Fr.docs[e]||(Fr={...Fr,docs:{...Fr.docs,[e]:{title:``,body:``,attachments:[],mode:`split`,...t||{}}}},Lr()),Fr.docs[e]}function Kr(e){return Fr.docs[e]||null}function qr(e,t){let n=Fr.docs[e]||{title:``,body:``,attachments:[],mode:`split`};Fr={...Fr,docs:{...Fr.docs,[e]:{...n,...t}}},Lr()}function Jr(e,t,n){let r=Fr.docs[e]||{},i={...Fr.docs,[t]:{...r,...n||{}}};delete i[e],Fr={...Fr,docs:i},Lr()}function Yr(e){let t=String(e||``),n=t.indexOf(`:`);return n<0?encodeURIComponent(t):t.slice(0,n)+`:`+encodeURIComponent(t.slice(n+1))}function Xr(e){let t=String(e||``),n=t.indexOf(`:`);if(n<0)try{return decodeURIComponent(t)}catch{return t}try{return t.slice(0,n)+`:`+decodeURIComponent(t.slice(n+1))}catch{return t}}function Zr(e){return(String(e||``).replace(/^(rel|path):/,``).split(/[\\/]/).filter(Boolean).pop()||``).replace(/\.md$/i,``)||`文档`}function Qr(e){if(!e)return null;let t=e.getConfig()||{};switch(e.getComponent()){case`page`:return t.beside?null:t.groupId?`#/group/${encodeURIComponent(t.groupId)}?task=${encodeURIComponent(t.task||``)}`:`#/dir/${encodeURIComponent(t.dirKey||``)}?task=${encodeURIComponent(t.task||``)}`;case`dir`:return t.dirKey===`__GLOBAL__`?`#/global`:`#/dir/${encodeURIComponent(t.dirKey||``)}`;case`group`:return`#/group/${encodeURIComponent(t.boardId||``)}`;case`repos`:return`#/repos`;case`cloud`:return`#/cloud`;case`overview`:return`#/overview`;case`templates`:{let e=String(t.mode||``);if(e===`edit`&&t.id)return`#/templates/edit/${encodeURIComponent(t.id)}`;if(e===`new`){let e=[];return t.topic&&e.push(`topic=${encodeURIComponent(t.topic)}`),Array.isArray(t.scope)&&t.scope.length&&e.push(`scope=${encodeURIComponent(t.scope.join(`,`))}`),e.length?`#/templates/new?${e.join(`&`)}`:`#/templates/new`}return`#/templates`}case`doc`:{if(!t.docId)return null;let e=[`ref=${Yr(t.docId)}`];return t.repoKey?e.push(`repo=${encodeURIComponent(t.repoKey)}`):t.boardKey&&(e.push(`board=${encodeURIComponent(t.boardKey)}`),t.boardName&&e.push(`name=${encodeURIComponent(t.boardName)}`)),`#/doc?${e.join(`&`)}`}default:return null}}function $r(e){let t=String(e&&e.task||``);if(!t.startsWith(`draft`))return``;let n=Kr(Vr(Br(e.key),t));return String(n&&n.title||``).trim()}function ei(e,t={}){if(!e)return null;switch(e.view){case`dir`:return e.task?{component:`page`,name:t.pageTitle||$r(e)||`页 ${e.task}`,config:{dirKey:e.key,task:e.task}}:{component:`dir`,name:t.dirName||`目录`,config:{dirKey:e.key}};case`group`:return e.task?{component:`page`,name:t.pageTitle||`页 ${e.task}`,config:{groupId:e.key,task:e.task}}:{component:`group`,name:t.boardName||`项目组`,config:{boardId:e.key}};case`repos`:return{component:`repos`,name:`仓库管理`,config:{}};case`cloud`:return{component:`cloud`,name:`云端总览`,config:{}};case`overview`:return{component:`overview`,name:`全部目录总览`,config:{}};case`templates`:if(e.mode===`edit`&&e.id)return{component:`templates`,name:`编辑模板`,config:{mode:`edit`,id:String(e.id),name:``,topic:``,scope:[]}};if(e.mode===`new`){let t=String(e.scope||``).split(`,`).map(e=>e.trim()).filter(Boolean);return{component:`templates`,name:`新建模板`,config:{mode:`new`,id:``,name:``,topic:String(e.topic||``),scope:t}}}return{component:`templates`,name:`任务模板`,config:{}};case`doc`:{if(!e.key)return null;let n={docId:e.key};return e.repoKey?n.repoKey=e.repoKey:e.boardKey&&(n.boardKey=e.boardKey,n.boardName=e.boardName||``),{component:`doc`,name:t.docTitle||t.pageTitle||Zr(e.key),config:n}}default:return null}}var ti=`modulepreload`,ni=function(e){return`/`+e},ri={},ii=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=ni(t,n),t=s(t),t in ri)return;ri[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:ti,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},ai=(0,O.lazy)(()=>ii(()=>import(`./dir-GUpDi0kq.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]))),oi=(0,O.lazy)(()=>ii(()=>import(`./task-Cu-rh5jA.js`),__vite__mapDeps([17,1,2,3,4,9,10,11,18,5,7,12,13,14]))),si=(0,O.lazy)(()=>ii(()=>import(`./progress-DOI2YFEi.js`),__vite__mapDeps([19,1,2,3,4]))),ci=(0,O.lazy)(()=>ii(()=>import(`./refs-D97SxNRW.js`),__vite__mapDeps([20,1,2,8,3,9,10,11,5,4,12,13,14,15,21]))),li=(0,O.lazy)(()=>ii(()=>import(`./group-BzC_R2k-.js`),__vite__mapDeps([22,1,2,3,11,5,4,8,9,10,12,13,14,15,16,23]))),ui=(0,O.lazy)(()=>ii(()=>import(`./repos-fp0D_GDq.js`),__vite__mapDeps([24,1,2,5,4,8,3,9,10,11,12,13,14,15,16,23,25,26,27]))),di=(0,O.lazy)(()=>ii(()=>import(`./cloud-DSu1a2Dn.js`),__vite__mapDeps([28,1,2,10,5,4]))),fi=(0,O.lazy)(()=>ii(()=>import(`./overview-sLaedHVZ.js`),__vite__mapDeps([29,1,2,3,4,11,5]))),pi=(0,O.lazy)(()=>ii(()=>import(`./templates-xbR-qZMs.js`),__vite__mapDeps([30,1,2,3,9,10,11,5,4,14]))),mi=(0,O.lazy)(()=>ii(()=>import(`./Introduction-DO6_gTk-.js`).then(e=>e.r),__vite__mapDeps([8,1,2,3,9,10,11,5,4,12,13,14,15]))),hi=(0,O.lazy)(()=>ii(()=>import(`./settings-D13mfwe0.js`),__vite__mapDeps([31,1,2,25,26,32]))),gi=(0,O.lazy)(()=>ii(()=>import(`./dag-_5FWJlq5.js`),__vite__mapDeps([33,1,2,3,4,6]))),_i=(0,O.lazy)(()=>ii(()=>import(`./composer-panel-CJuaj0Jp.js`),__vite__mapDeps([34,1,2,3,9,10,11,18]))),vi=e=>(0,k.jsx)(O.Suspense,{fallback:(0,k.jsx)(`div`,{className:`pad muted`,children:`加载中…`}),children:e});function yi(){return(0,k.jsxs)(`div`,{className:`pad stack welcome`,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`strong`,{children:`从左边目录选一个项目组或目录`}),`——选中的内容显示在中间主内容区。`]}),(0,k.jsx)(`div`,{className:`hint`,children:`主内容区一次只放一块面板(顶部面包屑告诉你现在在哪);设置这类临时面板以浮窗形式出现。`}),(0,k.jsx)(`div`,{className:`hint`,children:`目录在左、并发进程在右;两边都能收起或关掉,需要时再开。`})]})}function bi({dirKey:e}){return vi((0,k.jsx)(ai,{dirKey:e}))}function xi({dirKey:e,groupId:t,task:n,beside:r,tabId:i,model:a,historyId:o}){return vi((0,k.jsx)(oi,{dirKey:e,groupId:t,task:n,beside:!!r,tabId:i,model:a,historyId:o==null?null:Number(o)}))}function Si({dirKey:e,task:t,groupKey:n}){let r=mn()||{},i=n&&(r.repoData&&r.repoData.boards||[]).find(e=>e&&(e.id===n||e.key===n))||null;return vi((0,k.jsx)(si,{dirKey:e,task:t,group:i,rows:r.rows,refreshLocal:r.refreshLocal,model:r.model,onOpenTask:(t,i)=>n?r.openPage&&r.openPage({groupId:n,task:String(t),name:`#${t}`}):r.openPage&&r.openPage({dirKey:i||e,task:String(t),name:`#${t}`}),onClosePage:e=>r.closePanel&&r.closePanel(e)}))}function Ci({boardId:e,model:t}){let n=mn()||{};return vi((0,k.jsx)(li,{dirKey:e,rows:n.rows,repoData:n.repoData,refreshLocal:n.refreshLocal,model:t||n.model}))}function wi(){let e=mn()||{};return vi((0,k.jsx)(fi,{rows:e.rows,onNavigate:e.onNavigate,refreshLocal:e.refreshLocal}))}var Ti={sidebar:{title:`目录`,render:()=>(0,k.jsx)(Nr,{})},welcome:{title:`开始`,render:()=>(0,k.jsx)(yi,{})},dir:{title:`目录`,render:e=>(0,k.jsx)(bi,{dirKey:e&&e.dirKey})},page:{title:`页面`,render:(e,t)=>(0,k.jsx)(xi,{dirKey:e&&e.dirKey,groupId:e&&e.groupId,task:e&&e.task,beside:e&&e.beside,historyId:e&&e.historyId,tabId:t&&t.tabId,model:t&&t.model})},progress:{title:`进程`,render:e=>(0,k.jsx)(Si,{dirKey:e&&e.dirKey,task:e&&e.task,groupKey:e&&e.groupKey})},refs:{title:`文档列表`,render:(e,t)=>vi((0,k.jsx)(ci,{repoKey:e&&e.repoKey,boardKey:e&&e.boardKey,boardName:e&&e.boardName,model:t&&t.model}))},group:{title:`项目组`,render:(e,t)=>(0,k.jsx)(Ci,{boardId:e&&e.boardId,model:t&&t.model})},repos:{title:`仓库管理`,render:()=>vi((0,k.jsx)(ui,{}))},cloud:{title:`云端总览`,render:()=>vi((0,k.jsx)(di,{}))},overview:{title:`全部目录总览`,render:()=>(0,k.jsx)(wi,{})},templates:{title:`任务模板`,render:(e,t)=>vi((0,k.jsx)(pi,{config:e,model:t&&t.model,tabId:t&&t.tabId}))},doc:{title:`文档`,render:(e,t)=>vi((0,k.jsx)(mi,{docId:e&&e.docId,repoKey:e&&e.repoKey,boardKey:e&&e.boardKey,boardName:e&&e.boardName,tabId:t&&t.tabId,model:t&&t.model}))},settings:{title:`设置`,render:()=>vi((0,k.jsx)(hi,{}))},compose:{title:`评论`,render:e=>vi((0,k.jsx)(_i,{token:e&&e.token,mode:e&&e.mode,quote:e&&e.quote,prevQuote:e&&e.prevQuote,taskLabel:e&&e.taskLabel,taskTitle:e&&e.taskTitle,src:e&&e.src}))},dag:{title:`编排`,render:e=>vi((0,k.jsx)(gi,{dirKey:e&&e.dirKey,groupId:e&&e.groupId}))}};function Ei(e){return e?ar(e,{component:`settings`,name:`设置`,config:{}}):null}function Di(e,t={}){if(!e)return null;let n=t.mode||(t.id?`edit`:`new`),r={mode:n,id:t.id||``,name:t.name||``,topic:t.topic||``,scope:Array.isArray(t.scope)?t.scope:[]};return ir(e,{component:`templates`,name:n===`new`?`新建模板`:t.name||`编辑模板`,config:r,location:`center`})}function Oi(e){let t=Ti[e.getComponent()];return t?t.render(e.getConfig()||{},{tabId:e.getId(),model:e.getModel(),node:e}):(0,k.jsxs)(`div`,{className:`muted`,style:{padding:12},children:[`未知面板:`,e.getComponent()]})}[{label:`任务`,items:[{token:`task.id`,desc:`任务号`},{token:`task.text`,desc:`任务正文`},{token:`task.title`,desc:`任务标题`}]},{label:`时间目标`,items:[{token:`goal.name`,desc:`目标名`},{token:`goal.deadline`,desc:`截止时间`},{token:`goal.remainingHuman`,desc:`剩余时长(人话)`},{token:`goal.prompt`,desc:`目标的附加要求`}]},{label:`本次上下文`,items:[{token:`source`,desc:`来源(local/global)`},{token:`summary`,desc:`本轮现状`},{token:`cwd`,desc:`工作目录`},{token:`name`,desc:`主题名`}]}].flatMap(e=>e.items.map(e=>[e.token,e.desc])).reduce((e,[t,n])=>Object.assign(e,{[t]:n}),{});function ki(e,t){let n=t&&typeof t==`object`?t:{};return String(e??``).replace(/\{\{\s*([^}{\s][^{}]*?)\s*\}\}/g,(e,t)=>{let r=String(t).trim(),i=n[r];return i==null?``:String(i)})}function Ai(){let[e,n]=(0,O.useState)({defaultId:``,templates:null,unsupported:!1}),r=(0,O.useCallback)(async()=>{try{let e=await t(`/api/templates`);n({defaultId:e.defaultId,templates:e.templates,unsupported:!1})}catch(e){n(t=>({...t,templates:null,unsupported:String(e.message||e).includes(`接口不存在`)}))}},[]);(0,O.useEffect)(()=>{r()},[r]);let i=(0,O.useCallback)(()=>{let t=(e.templates||[]).find(t=>t.id===e.defaultId);return t?ki(t.body,{...h,...t.values||{}}):ki(g,h)},[e]),a=(0,O.useCallback)(async(e,n,i,a={})=>{let o=await t(`/api/templates`,{method:`POST`,body:{name:e,body:n,setDefault:i,...a.topic?{topic:a.topic}:{},...a.scope===void 0?{}:{scope:a.scope}}});return await r(),o},[r]),o=(0,O.useCallback)(async e=>{let n=await t(`/api/templates/${encodeURIComponent(e)}`,{method:`DELETE`,body:{}});return await r(),n},[r]),s=(0,O.useCallback)(async(e,n)=>{let i=await t(`/api/templates/${encodeURIComponent(e)}`,{method:`PATCH`,body:{id:e,...n}});return await r(),i},[r]),c=(0,O.useCallback)(async e=>{let n=await t(`/api/templates/default`,{method:`PATCH`,body:{id:e}});return await r(),n},[r]);return{defaultId:e.defaultId,templates:e.templates,unsupported:e.unsupported,defaultBody:i,refetch:r,add:a,remove:o,update:s,setDefault:c}}function ji(e){let n=e&&typeof e==`object`?e:{topic:e||``},r=String(n.topic||``).trim(),i=String(n.group||``).trim(),a=String(n.repo||``).trim(),[o,s]=(0,O.useState)({templates:null,scoped:!1}),c=mn()||{},l=c.tpl&&c.tpl.templates||null,u=Array.isArray(l)?l.map(e=>`${e.id}:${(e.scope||[]).join(`,`)}`).join(`|`):``,d=(0,O.useCallback)(async()=>{if(!r&&!i&&!a){s({templates:null,scoped:!1});return}try{let e=new URLSearchParams;r&&e.set(`topic`,r),i&&e.set(`group`,i),a&&e.set(`repo`,a);let n=await t(`/api/templates?${e}`);s({templates:n.templates||[],scoped:!!n.scoped})}catch{s({templates:null,scoped:!1})}},[r,i,a]);return(0,O.useEffect)(()=>{d()},[d,u]),{templates:o.templates,scoped:o.scoped,refetch:d}}function Mi(){if(window.__mdAttPreview)return window.__mdAttPreview.uninstall;let e=document.createElement(`div`);e.className=`md-lightbox`,e.hidden=!0;let t=document.createElement(`img`);t.className=`md-lightbox-img`,t.alt=``;let n=document.createElement(`iframe`);n.className=`md-lightbox-frame`,n.title=`附件预览`;let r=document.createElement(`div`);r.className=`md-lightbox-bar`;let i=document.createElement(`span`);i.className=`md-lightbox-name`;let a=document.createElement(`a`);a.className=`md-lightbox-dl`,a.textContent=`下载`,a.setAttribute(`download`,``),r.append(i,a),e.append(t,n,r);function o({src:r,kind:o,label:s}){i.textContent=s||``,a.href=r,a.setAttribute(`download`,s||``),a.hidden=o!==`pdf`,t.hidden=o!==`img`,n.hidden=o!==`pdf`,o===`img`?t.src=r:n.src=r,e.hidden=!1,document.addEventListener(`keydown`,c)}function s(){e.hidden=!0,t.src=``,n.src=`about:blank`,document.removeEventListener(`keydown`,c)}function c(e){e.key===`Escape`&&s()}e.addEventListener(`click`,t=>{t.target===e&&s()}),document.addEventListener(`click`,e=>{let t=e.target;if(!t||!t.closest)return;let n=t.closest(`img.md-att-img`);if(n){e.preventDefault(),o({src:n.getAttribute(`src`)||n.src,kind:`img`,label:n.alt||``});return}let r=t.closest(`a.md-att`);if(r){let t=String(r.getAttribute(`download`)||r.textContent||``).trim();/\.pdf$/i.test(t)&&(e.preventDefault(),o({src:r.getAttribute(`href`),kind:`pdf`,label:t}))}},!0),document.body.appendChild(e);let l=()=>{s(),e.remove(),delete window.__mdAttPreview};return window.__mdAttPreview={uninstall:l},l}var Ni=`nx-kv-sidebar-v1`,Pi={order:[],hidden:[],folded:!1,defaultFolded:!1};function Fi(e){if(!e||typeof e!=`object`)return e;let{groups:t,dirGroups:n,...r}=e;return r}function Ii(){try{let e=localStorage.getItem(Ni);if(!e)return{...Pi};let t=Fi(JSON.parse(e)),n={...Pi,...t};if(t&&typeof t==`object`&&(`groups`in t||`dirGroups`in t))try{localStorage.setItem(Ni,JSON.stringify(n))}catch{}return n}catch{return{...Pi}}}function Li(e){try{localStorage.setItem(Ni,JSON.stringify(e))}catch{}}function Ri(e){let t={...Ii(),...typeof e==`function`?e(Ii()):e};return Li(t),t}function zi({model:e}){let t=mn()||{},[n,r]=(0,O.useState)(!1),i=(0,O.useCallback)(()=>{if(!e){r(!1);return}if(!Vn(e,`sidebar`)){r(!0);return}let t=sr(e,or(e,`sidebar`));r(_n(t)===`closed`)},[e]);(0,O.useEffect)(()=>{if(!e)return;i();let t={onAfterAction:()=>i()};e.addChangeListener(t);let n=setInterval(i,400);return()=>{e.removeChangeListener(t),clearInterval(n)}},[e,i]);let a=(0,O.useCallback)(()=>{if(!e)return;let t=or(e,`sidebar`);t||=lr(e),t&&(cr(e,t,yn(`expanded`)),Fn(e))},[e]);return!n||typeof document>`u`?null:(0,A.createPortal)((0,k.jsxs)(`div`,{className:`nx-side-fab-layer nx-side-fab-fixed`,role:`navigation`,"aria-label":`目录已关闭`,children:[(0,k.jsx)(`button`,{type:`button`,className:`nx-side-fab`,title:`展开目录`,"aria-label":`展开目录`,onClick:a,children:(0,k.jsx)(c,{name:`sidebar`,size:14})}),(0,k.jsx)(`button`,{type:`button`,className:`nx-side-fab-gear`,title:`设置(浮动面板)`,"aria-label":`设置`,onClick:()=>t.shell&&t.shell.openSettings(),children:(0,k.jsx)(c,{name:`gear`,size:14})})]}),document.body)}var Bi=[];function Vi(e){e&&(Bi[Bi.length-1]!==e&&Bi.push(e),Bi.length>30&&Bi.shift())}function Hi(){return Bi.length>1?(Bi.pop(),Bi[Bi.length-1]):``}function Ui(){let[e,t]=(location.hash||``).replace(/^#\/?/,``).split(`?`),n=new URLSearchParams(t||``),r=n.get(`task`)||``;if(e.startsWith(`dir/`))return{view:`dir`,key:decodeURIComponent(e.slice(4)),task:r};if(e.startsWith(`group/`))return{view:`group`,key:decodeURIComponent(e.slice(6)),task:r};if(e===`doc`){let e=n.get(`ref`)||``,t=n.get(`repo`)||``,r=n.get(`board`)||``,i=n.get(`name`)||``;return{view:`doc`,key:e?Xr(e):``,task:``,repoKey:t,boardKey:r,boardName:i}}if(e===`templates`||e.startsWith(`templates/`)){let t=e===`templates`?``:e.slice(10);return t.startsWith(`edit/`)?{view:`templates`,key:``,task:``,mode:`edit`,id:decodeURIComponent(t.slice(5)),topic:``,scope:``}:t===`new`?{view:`templates`,key:``,task:``,mode:`new`,id:``,topic:n.get(`topic`)||``,scope:n.get(`scope`)||``}:{view:`templates`,key:``,task:``,mode:``,id:``,topic:``,scope:``}}return[`global`,`overview`,`cloud`,`todo`,`repos`].includes(e)?{view:e===`todo`?`cloud`:e,key:e===`global`?`__GLOBAL__`:``,task:e===`global`?r:``}:{view:`overview`,key:``,task:``}}var Wi={close:`关闭`,rename:`重命名`,float:`浮窗`,dock:`停靠`,popout:`弹出到新窗口`,Close:`关闭`,Rename:`重命名`,Float:`浮窗`,Dock:`停靠`,Popout:`弹出到新窗口`,"flexlayout.ui.dock.float.tabs (?)":`迁回 ? 个页签`},Gi=e=>Wi[e]||e;function Ki(){let{boot:e}=un(),n=i(),[a,o]=(0,O.useState)(Ui),[s,l]=(0,O.useState)(Ii),[,u]=(0,O.useState)(0),[d,f]=(0,O.useState)(null),p=Ai(),m=(0,O.useRef)(null),[h,g]=(0,O.useState)(()=>Pn());(0,O.useEffect)(()=>{h&&(window.__nxkv={model:h,Actions:R,DockLocation:F})},[h]);let _=(0,O.useCallback)(e=>l(Ri(e)),[]);(0,O.useEffect)(()=>{let e=()=>o(Ui());return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]),(0,O.useEffect)(()=>Mi(),[]);let v=(0,O.useCallback)(e=>{location.hash!==e&&(location.hash=e),o(e=>{let t=Ui();return e.view===t.view&&e.key===t.key&&e.task===t.task?e:t})},[]),y=(0,O.useCallback)(async()=>{try{f(await t(`/api/localtasks`))}catch{}},[]);(0,O.useEffect)(()=>{y();let e=setInterval(y,15e3);return()=>clearInterval(e)},[y]);let[x,S]=(0,O.useState)({repos:[],boards:[]}),C=(0,O.useCallback)(async()=>{try{let[e,n]=await Promise.all([t(`/api/repos`),t(`/api/boards`)]);S({repos:(e||[]).filter(e=>(e.type||`dev`)!==`ref`),boards:n&&n.boards||[]})}catch{}},[]);(0,O.useEffect)(()=>{C();let e=setInterval(C,3e4);return()=>clearInterval(e)},[C]),(0,O.useEffect)(()=>{let e=!1,r=async()=>{try{let r=await t(`/api/localtasks/presence`),i=Math.max(0,Number(r&&r.waiting)||0);if(e)return;u(e=>(e===0&&i>0&&n(`有 agent 正在等待回填,请查看对应目录`),i))}catch{}};r();let i=setInterval(r,15e3);return()=>{e=!0,clearInterval(i)}},[n]),(0,O.useEffect)(()=>{let e=!1,n=()=>{e||t(`/api/ping`).catch(()=>{})};n();let r=setInterval(n,15e3);return()=>{e=!0,clearInterval(r)}},[]);let w=(0,O.useMemo)(()=>d?.topics||[],[d]),ee=(0,O.useRef)(!1);(0,O.useEffect)(()=>{if(!h)return;let e={onAfterAction:()=>{if(!ee.current){ee.current=!0;try{In(h),Fn(h)}finally{ee.current=!1}}}};return h.addChangeListener(e),()=>h.removeChangeListener(e)},[h]);let T=(0,O.useCallback)(e=>{if(!h)return;let t=[...h.getLayouts().entries()].filter(([,e])=>e.getType()===`float`);if(!t.length)return;let n=e.currentTarget.closest(`.flexlayout__float_window`),r=t[0][0];if(t.length>1&&n){let e=n.offsetParent?n.offsetParent.getBoundingClientRect():{left:0,top:0},i=n.getBoundingClientRect(),a=null;for(let[n,r]of t){let t=r.getRect(),o=Math.abs(t.x-(i.left-e.left))+Math.abs(t.y-(i.top-e.top));(!a||o<a.d)&&(a={id:n,d:o})}r=a.id}let i=h.getLayouts().get(r);if(!i)return;let a=null;i.visitNodes(e=>{!a&&typeof e.getSelectedNode==`function`&&(a=e.getSelectedNode()||null)}),a&&a.isCloseable()&&h.doAction(R.deleteTab(a.getId()))},[h]),E=(0,O.useMemo)(()=>{if(a.view===`group`){let e=b(w,x.boards||[],a.key,a.task);return{boardName:e.board&&e.board.name||``,dirName:e.topic?e.topic.name:``,pageTitle:e.taskRow?`#${e.taskRow.id}`:``}}let e=(x.boards||[]).find(e=>e.id===a.key),t=w.find(e=>e.key===a.key),n=t&&a.task?(t.tasks||[]).find(e=>String(e.id)===String(a.task)):null;if(a.view===`doc`){let e=String(a.key||``).replace(/^(rel|path):/,``).split(/[\\/]/).filter(Boolean).pop()||``,t=(x.repos||[]).find(e=>e.key===a.repoKey),n=(x.boards||[]).find(e=>e.id===a.boardKey||e.key===a.boardKey);return{boardName:a.boardName||n&&n.name||``,dirName:``,pageTitle:e.replace(/\.md$/i,``),repoName:t&&t.name||``}}return{boardName:e&&e.name||``,dirName:t?t.name:``,pageTitle:n?`#${n.id}`:``}},[x.boards,x.repos,w,a.view,a.key,a.task,a.repoKey,a.boardKey,a.boardName]);(0,O.useEffect)(()=>{Vi(location.hash)},[a.view,a.key,a.task,a.repoKey,a.boardKey]);let D=(0,O.useRef)(h);(0,O.useEffect)(()=>{D.current=h},[h]);let A=(0,O.useRef)(E);(0,O.useEffect)(()=>{A.current=E},[E]);let j=`${E.boardName}|${E.dirName}|${E.pageTitle}`,te=(0,O.useRef)({route:``,key:``});(0,O.useEffect)(()=>{let e=D.current;if(!e)return;let t=ei(a,A.current);if(!t)return;let n=`${a.view}|${a.key}|${a.task}|${a.repoKey||``}|${a.boardKey||``}|${a.mode||``}|${a.id||``}|${a.topic||``}|${a.scope||``}`,r=te.current;(r.route!==n||r.key!==j)&&(te.current={route:n,key:j},ir(e,t))},[a,j]);let ne=(0,O.useCallback)(e=>{h&&ir(h,{component:`page`,name:e.name||`页面`,config:e.groupId?{groupId:e.groupId,task:e.task}:{dirKey:e.dirKey,task:e.task},location:e.location||`center`})},[h]),re=(0,O.useCallback)(e=>{h&&e&&h.doAction(R.deleteTab(e))},[h]),ie=(0,O.useRef)(null),ae=(0,O.useCallback)(()=>{if(!h)return;let e=ur(h);if(!e)return;let t=e.getId(),n=ie.current;if(ie.current=t,n===t)return;let r=Qr(e);if(!r)return;let i=ei(Ui(),E);if(i&&i.component===e.getComponent()&&Rn(i.config||{})===Rn(e.getConfig()||{}))return;history.replaceState(null,``,r);let a=Ui();o(e=>e.view===a.view&&e.key===a.key&&e.task===a.task&&e.repoKey===a.repoKey&&e.boardKey===a.boardKey&&e.boardName===a.boardName&&e.mode===a.mode&&e.id===a.id&&e.topic===a.topic&&e.scope===a.scope?e:a)},[h,E]),{dialog:M,node:N}=r(),P=(0,O.useCallback)(async()=>{await M({title:`重置为初始两栏`,message:`丢掉存下来的布局,回到初始的两栏(目录 + 开始)?`,okText:`重置`})&&(Ln(),g(Pn()))},[M,g]),I=(0,O.useMemo)(()=>({resetLayout:P,openSettings:()=>Ei(h)}),[P,h]),L=(0,O.useMemo)(()=>({boot:e,rows:w,repoData:x,prefs:s,patchPrefs:_,onNavigate:v,refreshLocal:y,refreshRepos:C,tpl:p,model:h,route:a,localReady:d!==null,openPage:ne,closePanel:re,shell:I}),[e,w,x,s,_,v,y,C,p,h,a,ne,re,I]);return(0,k.jsx)(pn.Provider,{value:L,children:(0,k.jsx)(`div`,{id:`app-shell`,className:`nx-shell`,children:(0,k.jsx)(`div`,{className:`nx-workarea`,children:h?(0,k.jsxs)(fn,{children:[(0,k.jsx)(rn,{ref:m,model:h,factory:Oi,onAction:e=>e,onModelChange:ae,i18nTranslator:Gi,keyMap:{...ke,focusTabToggle:`F6`,focusNextTabset:`Ctrl+F6`,focusPreviousTabset:`Ctrl+Shift+F6`},icons:{dragToDock:(0,k.jsx)(`button`,{type:`button`,className:`flx-float-close`,title:`关闭浮窗`,"aria-label":`关闭浮窗`,onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation(),T(e)},children:(0,k.jsx)(c,{name:`x`,size:14})})}}),(0,k.jsx)(zi,{model:h}),N]},`workspace`):(0,k.jsx)(`div`,{className:`pad muted`,children:`正在装载工作区…`})})})})}(0,j.createRoot)(document.getElementById(`root`)).render((0,k.jsx)(O.StrictMode,{children:(0,k.jsx)(ln,{children:(0,k.jsx)(o,{children:(0,k.jsx)(Ki,{})})})}));export{dn as A,Zn as C,ar as D,rr as E,R as M,T as N,ir as O,$n as S,zn as T,Tr as _,Ei as a,xr as b,Gr as c,Kr as d,Jr as f,Er as g,Wr as h,ki as i,un as j,mn as k,Hr as l,Br as m,Ai as n,Di as o,qr as p,ji as r,Vr as s,Hi as t,Ur as u,Sr as v,Hn as w,mr as x,wr as y};
|
|
30
|
+
`).find(e=>e.trim())||`#${e?.id}`).trim().slice(0,40)}function hr(e,t){let n=t.getBoundingClientRect(),r=e.clientY-n.top,i=n.height;return r<i*.3?`before`:r>i*.7?`after`:`into`}function gr(e,t,n){return e?e.type===`repo`?t.type===`board`?n===`into`:t.type===`repo`?n===`before`||n===`after`:!1:e.type===`board`&&t.type===`board`&&t.id!==e.id&&(n===`before`||n===`after`):!1}function _r(e,t,n,r){let i=[...e.order||[]],a=e=>e.type===`board`?`board:`+e.id:e.key;if(t.type===`repo`&&n.type===`repo`){let e=i.filter(e=>e!==a(t)),o=e.indexOf(a(n));return o<0?{order:i}:(e.splice(r===`before`?o:o+1,0,a(t)),{order:e})}if(t.type===`board`&&n.type===`board`){let e=i.filter(e=>e!==a(t)),o=e.indexOf(a(n));return o<0?{order:i}:(e.splice(r===`before`?o:o+1,0,a(t)),{order:e})}return{}}async function vr({row:e,onNavigate:n,refreshLocal:r,toast:i,draft:a=!1}){let o=e=>a?`${e}?task=draft`:e;if(e.type===`global`||e.topicKey){n(o(e.type===`global`?`#/global`:`#/dir/${encodeURIComponent(e.topicKey)}`));return}if(!e.cwd){i&&i(`「${e.name}」没有目录路径,无法创建任务队列`);return}try{let a=await t(`/api/localtasks/topic`,{method:`POST`,body:{cwd:e.cwd}});await r?.(),a&&a.existed===!1&&i&&i(`已为「${e.name}」创建任务队列`),n(o(`#/dir/${encodeURIComponent(a.key)}`))}catch(e){i&&i(`创建任务队列失败: `+(e.message||e))}}function yr({row:e,prefs:n,patchPrefs:r,onNavigate:i,boards:a,onDataChanged:o,refreshLocal:s,toast:c,dialog:l}){if(e.type===`repo`){let l=a||[],u=t=>(e.boards||[]).some(e=>e.key===t.key||e.id===t.id),d=async(n,r)=>{try{await t(`/api/boards/assign`,{method:`POST`,body:r?{key:e.key,board:n.key||n.id,remove:!0}:{key:e.key,board:n.key||n.id}}),o&&o()}catch(e){c(`归属变更失败: `+e.message)}};return[{label:`打开详情`,icon:`folder`,onClick:()=>vr({row:e,onNavigate:i,refreshLocal:s,toast:c})},{label:`置顶`,icon:`pin`,onClick:()=>r({order:[e.key,...(n.order||[]).filter(t=>t!==e.key)]})},`sep`,...l.map(e=>({label:(u(e)?`✓ `:``)+(u(e)?`移出「`:`归入「`)+e.name+`」`,icon:`folder`,onClick:()=>d(e,u(e))})),`sep`,{label:`从侧边栏隐藏(不删登记)`,icon:`x`,onClick:()=>r(t=>({hidden:[...t.hidden||[],e.key]}))}]}return e.type===`board`?[{label:`在仓库页打开该看板`,icon:`repo`,onClick:()=>i(`#/repos`)},`sep`,{label:`删除看板(成员仓库回到未分组)`,icon:`trash`,danger:!0,onClick:async()=>{if(await l({title:`删除看板「${e.name}」`,message:`它的 ${e.count} 个仓库会回到未分组(登记不动)。`,danger:!0,okText:`删除`}))try{await t(`/api/boards/${encodeURIComponent(e.id)}`,{method:`DELETE`,body:{}}),o&&o()}catch(e){c(`删除失败: `+e.message)}}}]:[{label:`打开全局任务池`,icon:`globe`,onClick:()=>i(`#/global`)}]}function br({dialog:e,toast:n,onDataChanged:r}){return[{label:`登记仓库…`,icon:`folder`,onClick:async()=>{let i=await e({title:`登记仓库`,input:!0,placeholder:`仓库绝对路径,如 D:/a_js/js_proj/nx-kv`});if(i)try{await t(`/api/repos`,{method:`POST`,body:{path:i.trim()}}),n(`已登记仓库 `+i.trim()),r&&r()}catch(e){n(`登记失败: `+e.message)}}},{label:`新建看板(项目组)…`,icon:`plus`,onClick:async()=>{let i=await e({title:`新建看板`,input:!0,placeholder:`看板名,如 前端 / nx 家族`});if(i)try{await t(`/api/boards`,{method:`POST`,body:{name:i.trim()}}),n(`已新建看板 `+i.trim()),r&&r()}catch(e){n(`新建失败: `+e.message)}}}]}function xr(e){return!e||e.deletedAt||e.migratedTo?`gone`:a(e)?`done`:l(e)?`doing`:s(e)?`gone`:`pending`}function Sr(e){return e?e.deletedAt?`已删除`:e.migratedTo?`已迁移`:u[e.status]||String(e.status??``):``}var Cr={pending:`等`,doing:`跑`,done:`完`,gone:`档`};function wr(e){return Cr[xr(e)]||`等`}function Tr(e,t){let n=Array.isArray(e)?e:[],[r,i]=(0,O.useState)(0),a=Math.max(1,Number(t)||1),o=Math.max(1,Math.ceil(n.length/a)),s=Math.min(Math.max(0,r),o-1),c=s*a;return{page:s,pageCount:o,total:n.length,items:n.slice(c,c+a),setPage:i}}function Er({page:e=0,pageCount:t=1,total:n=0,onPage:r,unit:i=`条`}){let a=e=>r&&r(Math.max(0,Math.min(e,t-1)));return t<=1?(0,k.jsxs)(`span`,{className:`pager-n`,children:[`共 `,n,` `,i]}):(0,k.jsxs)(`span`,{className:`pager`,children:[(0,k.jsx)(`button`,{type:`button`,className:`pager-btn`,disabled:e<=0,onClick:()=>a(e-1),"aria-label":`上一页`,title:`上一页`,children:`‹`}),(0,k.jsxs)(`span`,{className:`pager-n`,children:[`第 `,e+1,`/`,t,` 页 · 共 `,n,` `,i]}),(0,k.jsx)(`button`,{type:`button`,className:`pager-btn`,disabled:e>=t-1,onClick:()=>a(e+1),"aria-label":`下一页`,title:`下一页`,children:`›`})]})}var Dr=12;function Or({row:e,onNavigate:t,refreshLocal:n,limit:r=Dr}){let a=i(),o=Tr((0,O.useMemo)(()=>{let t=e.type===`global`?e.tasks||[]:(e.topics||[]).flatMap(e=>(e.tasks||[]).filter(e=>!e.deletedAt&&!S(e)));return x(t)},[e]),r),s=o.items,l=e.type===`global`?`#/global`:`#/dir/${encodeURIComponent(e.topicKey||e.key)}`;return(0,k.jsxs)(k.Fragment,{children:[s.map(n=>(0,k.jsxs)(`button`,{type:`button`,className:`trow child task-child`,title:String(n.text||``).slice(0,200),onClick:e=>{e.stopPropagation(),t(`${l}?task=${encodeURIComponent(n.id)}`)},children:[(0,k.jsx)(`span`,{className:`gico`,children:(0,k.jsx)(c,{name:`list`,size:12})}),(0,k.jsx)(`span`,{className:`nm`,children:mr(n)}),(0,k.jsx)(`span`,{className:`cnt ${xr(n)}`,children:wr(n)})]},`${e.topicKey||e.key}:t:${n.id}`)),o.pageCount>1&&(0,k.jsx)(`div`,{className:`trow child task-pager`,children:(0,k.jsx)(Er,{page:o.page,pageCount:o.pageCount,total:o.total,onPage:o.setPage,unit:`条任务`})}),(0,k.jsxs)(`button`,{type:`button`,className:`trow child task-new`,title:`新建一页 MD(新页签打开;仓库还没有任务队列时先创建队列)`,onClick:r=>{r.stopPropagation(),vr({row:e,onNavigate:t,refreshLocal:n,toast:a,draft:!0})},children:[(0,k.jsx)(`span`,{className:`gico`,children:(0,k.jsx)(c,{name:`plus`,size:12})}),(0,k.jsx)(`span`,{className:`nm`,children:`新建页`})]})]})}function kr({repos:e,boards:t,topics:n,route:a,onNavigate:o,refreshLocal:s,waitingCount:l,prefs:u,patchPrefs:f,refreshRepos:p,onCollapse:m,onClose:h,shell:g}){let _=i(),{dialog:v,node:y}=r(),[b,x]=(0,O.useState)(``),[S,C]=(0,O.useState)(null),[w,ee]=(0,O.useState)(-1),[T,E]=(0,O.useState)(()=>new Set),D=(0,O.useRef)(null),[A,j]=(0,O.useState)(null),te=(0,O.useRef)(null),{rows:ne,matchCount:re}=(0,O.useMemo)(()=>fr(e,t,n,u,b),[e,t,n,u,b]),ie=e=>e.type===`global`?a.view===`global`:e.type===`repo`?a.view===`dir`&&a.key===e.topicKey:e.type===`board`&&a.view===`group`&&a.key===e.id;(0,O.useEffect)(()=>{a.view===`dir`&&a.key&&E(e=>{if(e.has(a.key))return e;let t=new Set(e);return t.add(a.key),t})},[a.view,a.key]);let ae=(0,O.useCallback)(e=>{E(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),M=(0,O.useCallback)(e=>{e.type===`board`?o(`#/group/`+encodeURIComponent(e.id)):e.type===`global`?o(`#/global`):e.topicKey?o(`#/dir/`+encodeURIComponent(e.topicKey)):vr({row:e,onNavigate:o,refreshLocal:s,toast:_})},[o,s,_]),N=(0,O.useCallback)(e=>{e.type===`global`?o(`#/global`):ae(e.topicKey||e.key)},[o,ae]),P=e=>{S||(e.key===`ArrowDown`||e.key===`ArrowUp`?(e.preventDefault(),ee(t=>t<0?e.key===`ArrowDown`?0:ne.length-1:Math.min(ne.length-1,Math.max(0,t+(e.key===`ArrowDown`?1:-1))))):e.key===`Home`?(e.preventDefault(),ee(0)):e.key===`End`?(e.preventDefault(),ee(ne.length-1)):e.key===`Enter`?w>=0&&ne[w]&&M(ne[w]):e.key===`Escape`&&ee(-1))},F=(e,t)=>{D.current={type:t.type,key:t.key,id:t.id,name:t.name},e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,t.type+`:`+(t.key||t.id)),e.currentTarget.classList.add(`dragging`)},I=e=>{D.current=null,j(null),e.currentTarget?.classList?.remove(`dragging`)},L=(e,t)=>{if(!D.current)return;e.preventDefault();let n=hr(e,e.currentTarget);gr(D.current,t,n)?(e.dataTransfer.dropEffect=`move`,j({id:t.key||t.id,zone:n})):j(null)},R=()=>j(e=>e&&null),z=(e,t)=>{e.preventDefault();let n=D.current;if(D.current=null,j(null),!n)return;let r=hr(e,e.currentTarget);gr(n,t,r)&&f(_r(u,n,t,r))},oe=e=>{let t=D.current;if(D.current=null,j(null),!t||t.type!==`repo`)return;e.preventDefault();let n=t.key,r=(u.order||[]).filter(e=>e!==n);r.push(n),f({order:r})},se=(e,n)=>{e.preventDefault(),e.stopPropagation(),C({x:e.clientX,y:e.clientY,items:yr({row:n,prefs:u,patchPrefs:f,onNavigate:o,boards:t,onDataChanged:p,refreshLocal:s,toast:_,dialog:v})})},ce=e=>{C({x:e.clientX,y:e.clientY,items:br({dialog:v,toast:_,onDataChanged:p})})},le=(e,t,n)=>(0,k.jsxs)(`button`,{className:`trow`+(a.view===e.replace(`#/`,``)?` active`:``),onClick:()=>o(e),children:[(0,k.jsx)(`span`,{className:`gico`,children:(0,k.jsx)(c,{name:t})}),(0,k.jsx)(`span`,{className:`nm`,children:n})]});return(0,k.jsxs)(`aside`,{id:`side`,children:[(0,k.jsxs)(`div`,{className:`shead`,children:[(0,k.jsxs)(`div`,{className:`brandrow`,children:[(0,k.jsx)(`span`,{className:`nx-logo`,"aria-hidden":!0,children:`nx`}),(0,k.jsx)(`span`,{className:`nx-title`,children:`nx-kv`}),(0,k.jsx)(`span`,{className:`grow`}),(0,k.jsx)(`button`,{className:`iconbtn`,title:`设置(浮动面板)`,"aria-label":`设置`,onClick:()=>g&&g.openSettings(),children:(0,k.jsx)(c,{name:`gear`,size:15})}),(0,k.jsx)(`button`,{className:`iconbtn collapse`,title:`收起目录(变窄轨;点窄轨可展开)`,"aria-label":`收起目录`,onClick:m,children:(0,k.jsx)(c,{name:`back`,size:15})}),(0,k.jsx)(`button`,{className:`iconbtn collapse`,title:`关闭目录(完全隐藏,左缘把手可展开)`,"aria-label":`关闭目录`,onClick:h,children:(0,k.jsx)(c,{name:`x`,size:14})})]}),(0,k.jsxs)(`div`,{className:`searchrow`,children:[(0,k.jsxs)(`label`,{className:`sbox`,children:[(0,k.jsx)(c,{name:`search`}),(0,k.jsx)(`input`,{value:b,placeholder:`搜索仓库(命中自动展开)`,onChange:e=>x(e.target.value),onKeyDown:e=>{e.key===`Escape`&&x(``)}})]}),b&&(0,k.jsxs)(`span`,{className:`kwcount`,children:[re,` 个匹配`]}),(0,k.jsx)(`button`,{className:`iconbtn add`,title:`添加目录 / 新建分组`,"aria-label":`添加目录或新建分组`,onClick:ce,children:(0,k.jsx)(c,{name:`plus`})})]})]}),(0,k.jsxs)(`div`,{id:`tree`,ref:te,tabIndex:0,onKeyDown:P,onDragOver:e=>{D.current?.type===`repo`&&e.preventDefault()},onDrop:oe,children:[ne.map((e,t)=>e.type===`board`?(0,k.jsxs)(`button`,{className:`trow group`+(ie(e)?` active`:``)+(w===t?` kb-focus`:``),onClick:()=>M(e),onContextMenu:t=>se(t,e),draggable:!0,onDragStart:t=>F(t,e),onDragEnd:I,onDragOver:t=>L(t,e),onDragLeave:R,onDrop:t=>z(t,e),"data-drop":A?.id===e.id?A.zone:void 0,title:`${e.name} · ${e.count} 个目录\n${e.desc||`项目组:点进去操作组下的项目`}`,children:[(0,k.jsx)(`span`,{className:`tw`,"aria-hidden":!0}),(0,k.jsx)(`span`,{className:`gico`,children:(0,k.jsx)(c,{name:`folder`})}),(0,k.jsxs)(`span`,{className:`nm`,children:[e.name,e.waiting?(0,k.jsx)(`span`,{className:`wdot`,title:`组内有 agent 等待回填`}):null]}),(0,k.jsx)(`span`,{className:`cnt`,title:`待领取 ${e.pending} · 成员 ${e.count} 个`,children:e.pending>0?e.pending:e.count}),(0,k.jsx)(`span`,{className:`more`,role:`button`,tabIndex:-1,"aria-label":`看板菜单`,onClick:t=>se(t,e),children:(0,k.jsx)(c,{name:`dots`,size:13})})]},`b:`+e.id):(0,k.jsxs)(`div`,{className:`tblock`,children:[(0,k.jsxs)(`button`,{className:`trow`+(e.type===`repo`&&e.groupId?` child`:``)+(e.type===`repo`&&T.has(e.topicKey)?` open`:``)+(ie(e)?` active`:``)+(e.pending>0?` pinned`:``)+(w===t?` kb-focus`:``),onClick:()=>M(e),onContextMenu:t=>se(t,e),title:e.cwd?`${e.name}\n${e.cwd}\n${e.desc||e.summary||``}`:e.name,draggable:!0,onDragStart:t=>F(t,e),onDragEnd:I,onDragOver:t=>L(t,e),onDragLeave:R,onDrop:t=>z(t,e),"data-drop":A?.id===e.key?A.zone:void 0,children:[(0,k.jsx)(`span`,{className:`tw`,role:`button`,tabIndex:-1,"aria-label":`展开子任务`,onClick:t=>{t.stopPropagation(),N(e)},children:(0,k.jsx)(c,{name:`chevron`,size:10})}),(0,k.jsx)(`span`,{className:`gico`,children:e.icon?(0,k.jsx)(`span`,{className:`trow-icon`,"aria-hidden":!0,children:e.icon}):(0,k.jsx)(c,{name:e.type===`global`?`globe`:`folder`})}),(0,k.jsxs)(`span`,{className:`nm`,children:[e.name,e.type===`global`&&e.waiting?(0,k.jsx)(`span`,{className:`wdot`,title:`有等待中的主题`}):null]}),e.pending>0&&(0,k.jsx)(`span`,{className:`cnt`,children:e.pending}),e.type===`repo`&&e.waiting&&(0,k.jsx)(`span`,{className:`wdot`,title:`agent 等待回填中`}),(0,k.jsx)(`span`,{className:`more`,role:`button`,tabIndex:-1,"aria-label":`行菜单`,onClick:t=>se(t,e),children:(0,k.jsx)(c,{name:`dots`,size:13})})]}),(e.type===`global`?ie(e):T.has(e.topicKey||e.key))&&(0,k.jsx)(Or,{row:e,onNavigate:o,refreshLocal:s})]},e.type+`:`+e.key)),!ne.length&&(0,k.jsx)(`div`,{className:`tree-empty`,children:b?`没有匹配的仓库`:`还没有登记仓库:点右上 + 登记,或去「仓库管理」`}),(0,k.jsx)(`div`,{className:`droptail`,"aria-hidden":`true`})]}),(0,k.jsxs)(`div`,{className:`sfoot`,children:[le(`#/overview`,`overview`,`全部目录总览`),le(`#/cloud`,`cloud`,`云端总览`),le(`#/repos`,`repo`,`仓库管理`),l>0&&(0,k.jsxs)(`button`,{className:`trow`,onClick:()=>o(`#/overview`),title:`有 agent 正在等待回填`,children:[(0,k.jsx)(`span`,{className:`gico`,children:(0,k.jsx)(c,{name:`warn`})}),(0,k.jsxs)(`span`,{className:`nm`,children:[l,` 个 agent 等待回填`]})]})]}),S&&(0,k.jsx)(d,{x:S.x,y:S.y,items:S.items,onClose:()=>C(null)}),y]})}var Ar=46,jr=120;function Mr(e){let t=e&&or(e,`sidebar`);if(!t)return`expanded`;let n=e.getNodeById?e.getNodeById(t):null;return _n(n?typeof n.getWeight==`function`?n.getWeight():Number(n.getAttributes()?.weight)||0:0)}function Nr(){let e=mn()||{},{model:t}=e,[n,r]=(0,O.useState)(()=>Mr(t)),[i,a]=(0,O.useState)(null),o=(0,O.useCallback)(e=>a(e),[]),s=(0,O.useRef)(null),l=(0,O.useCallback)(e=>{if(!t)return;let n=or(t,`sidebar`);n&&cr(t,n,yn(e))},[t]),u=(0,O.useCallback)(e=>{s.current={state:e,until:Date.now()+600},l(e),r(e)},[l]),d=(0,O.useCallback)(()=>u(`collapsed`),[u]),f=(0,O.useCallback)(()=>u(`expanded`),[u]),p=(0,O.useCallback)(()=>u(`closed`),[u]);(0,O.useEffect)(()=>{if(!i||window.ResizeObserver===void 0)return;let e=new window.ResizeObserver(e=>{for(let t of e){let e=Math.round(t.contentRect.width);r(t=>{let n=s.current;if(n){if(Date.now()>n.until)s.current=null;else if(n.state===`closed`)return`closed`;else if(n.state===`expanded`)return e>=jr&&(s.current=null),`expanded`;else if(n.state===`collapsed`)return e<Ar&&(s.current=null),`collapsed`}return t===`closed`?t:e<Ar?`collapsed`:e>=jr?`expanded`:t})}});return e.observe(i),()=>e.disconnect()},[i]),(0,O.useEffect)(()=>{if(n!==`closed`||!t)return;let e=setInterval(()=>{let e=or(t,`sidebar`),n=e&&t.getNodeById?t.getNodeById(e):null;_n(n?typeof n.getWeight==`function`?n.getWeight():Number(n.getAttributes()?.weight)||0:0)===`expanded`&&(s.current=null,r(`expanded`))},200);return()=>clearInterval(e)},[n,t]);let m=(0,O.useRef)(null);return(0,O.useEffect)(()=>{if(m.current===null){m.current=n;return}m.current!==n&&(m.current=n,l(n))},[n,l]),(0,O.useEffect)(()=>(document.body.classList.toggle(`nx-side-is-closed`,n===`closed`),()=>document.body.classList.remove(`nx-side-is-closed`)),[n]),n===`closed`?(0,k.jsx)(`div`,{ref:o,className:`nx-side-closed-host`,"aria-hidden":!0}):n===`collapsed`?(0,k.jsxs)(`div`,{ref:o,className:`nx-rail-host`,children:[(0,k.jsxs)(`button`,{className:`nx-rail`,title:`展开目录`,"aria-label":`展开目录`,onClick:f,children:[(0,k.jsx)(`span`,{className:`nx-rail-btn`,"aria-hidden":!0,children:`»`}),(0,k.jsx)(`span`,{className:`nx-rail-label`,children:`目录`})]}),(0,k.jsxs)(`div`,{className:`nx-rail-acts`,children:[(0,k.jsx)(`button`,{className:`nx-rail-act`,title:`关闭目录(完全隐藏,左缘把手可展开)`,"aria-label":`关闭目录`,onClick:p,children:(0,k.jsx)(c,{name:`x`,size:14})}),(0,k.jsx)(`button`,{className:`nx-rail-act`,title:`设置(浮动面板)`,"aria-label":`设置`,onClick:()=>e.shell&&e.shell.openSettings(),children:(0,k.jsx)(c,{name:`gear`,size:15})})]})]}):(0,k.jsx)(`div`,{ref:o,className:`nx-side-host`,children:(0,k.jsx)(kr,{repos:e.repoData?e.repoData.repos:[],boards:e.repoData?e.repoData.boards:[],topics:e.rows||[],route:e.route,onNavigate:e.onNavigate,refreshLocal:e.refreshLocal,refreshRepos:e.refreshRepos,prefs:e.prefs,patchPrefs:e.patchPrefs,onCollapse:d,onClose:p,shell:e.shell})})}var Pr=0,Fr={docs:{}},Ir=new Set,Lr=()=>{for(let e of Ir)e()},Rr=e=>(Ir.add(e),()=>Ir.delete(e)),zr=()=>Fr.docs,Br=e=>e||`__GLOBAL__`,Vr=(e,t)=>`${e}::${t}`,Hr=e=>/^draft/.test(String(e||``)),Ur=()=>`draft-${++Pr}`;function Wr(){return(0,O.useSyncExternalStore)(Rr,zr,zr)}function Gr(e,t){return Fr.docs[e]||(Fr={...Fr,docs:{...Fr.docs,[e]:{title:``,body:``,attachments:[],mode:`split`,...t||{}}}},Lr()),Fr.docs[e]}function Kr(e){return Fr.docs[e]||null}function qr(e,t){let n=Fr.docs[e]||{title:``,body:``,attachments:[],mode:`split`};Fr={...Fr,docs:{...Fr.docs,[e]:{...n,...t}}},Lr()}function Jr(e,t,n){let r=Fr.docs[e]||{},i={...Fr.docs,[t]:{...r,...n||{}}};delete i[e],Fr={...Fr,docs:i},Lr()}function Yr(e){let t=String(e||``),n=t.indexOf(`:`);return n<0?encodeURIComponent(t):t.slice(0,n)+`:`+encodeURIComponent(t.slice(n+1))}function Xr(e){let t=String(e||``),n=t.indexOf(`:`);if(n<0)try{return decodeURIComponent(t)}catch{return t}try{return t.slice(0,n)+`:`+decodeURIComponent(t.slice(n+1))}catch{return t}}function Zr(e){return(String(e||``).replace(/^(rel|path):/,``).split(/[\\/]/).filter(Boolean).pop()||``).replace(/\.md$/i,``)||`文档`}function Qr(e){if(!e)return null;let t=e.getConfig()||{};switch(e.getComponent()){case`page`:return t.beside?null:t.groupId?`#/group/${encodeURIComponent(t.groupId)}?task=${encodeURIComponent(t.task||``)}`:`#/dir/${encodeURIComponent(t.dirKey||``)}?task=${encodeURIComponent(t.task||``)}`;case`dir`:return t.dirKey===`__GLOBAL__`?`#/global`:`#/dir/${encodeURIComponent(t.dirKey||``)}`;case`group`:return`#/group/${encodeURIComponent(t.boardId||``)}`;case`repos`:return`#/repos`;case`cloud`:return`#/cloud`;case`overview`:return`#/overview`;case`templates`:{let e=String(t.mode||``);if(e===`edit`&&t.id)return`#/templates/edit/${encodeURIComponent(t.id)}`;if(e===`new`){let e=[];return t.topic&&e.push(`topic=${encodeURIComponent(t.topic)}`),Array.isArray(t.scope)&&t.scope.length&&e.push(`scope=${encodeURIComponent(t.scope.join(`,`))}`),e.length?`#/templates/new?${e.join(`&`)}`:`#/templates/new`}return`#/templates`}case`doc`:{if(!t.docId)return null;let e=[`ref=${Yr(t.docId)}`];return t.repoKey?e.push(`repo=${encodeURIComponent(t.repoKey)}`):t.boardKey&&(e.push(`board=${encodeURIComponent(t.boardKey)}`),t.boardName&&e.push(`name=${encodeURIComponent(t.boardName)}`)),`#/doc?${e.join(`&`)}`}default:return null}}function $r(e){let t=String(e&&e.task||``);if(!t.startsWith(`draft`))return``;let n=Kr(Vr(Br(e.key),t));return String(n&&n.title||``).trim()}function ei(e,t={}){if(!e)return null;switch(e.view){case`dir`:return e.task?{component:`page`,name:t.pageTitle||$r(e)||`页 ${e.task}`,config:{dirKey:e.key,task:e.task}}:{component:`dir`,name:t.dirName||`目录`,config:{dirKey:e.key}};case`group`:return e.task?{component:`page`,name:t.pageTitle||`页 ${e.task}`,config:{groupId:e.key,task:e.task}}:{component:`group`,name:t.boardName||`项目组`,config:{boardId:e.key}};case`repos`:return{component:`repos`,name:`仓库管理`,config:{}};case`cloud`:return{component:`cloud`,name:`云端总览`,config:{}};case`overview`:return{component:`overview`,name:`全部目录总览`,config:{}};case`templates`:if(e.mode===`edit`&&e.id)return{component:`templates`,name:`编辑模板`,config:{mode:`edit`,id:String(e.id),name:``,topic:``,scope:[]}};if(e.mode===`new`){let t=String(e.scope||``).split(`,`).map(e=>e.trim()).filter(Boolean);return{component:`templates`,name:`新建模板`,config:{mode:`new`,id:``,name:``,topic:String(e.topic||``),scope:t}}}return{component:`templates`,name:`任务模板`,config:{}};case`doc`:{if(!e.key)return null;let n={docId:e.key};return e.repoKey?n.repoKey=e.repoKey:e.boardKey&&(n.boardKey=e.boardKey,n.boardName=e.boardName||``),{component:`doc`,name:t.docTitle||t.pageTitle||Zr(e.key),config:n}}default:return null}}var ti=`modulepreload`,ni=function(e){return`/`+e},ri={},ii=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=ni(t,n),t=s(t),t in ri)return;ri[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:ti,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},ai=(0,O.lazy)(()=>ii(()=>import(`./dir-ClkYDLql.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]))),oi=(0,O.lazy)(()=>ii(()=>import(`./task-BoJGRYpA.js`),__vite__mapDeps([17,1,2,3,4,9,10,11,18,5,7,12,13,14]))),si=(0,O.lazy)(()=>ii(()=>import(`./progress-B0fipz7a.js`),__vite__mapDeps([19,1,2,3,4]))),ci=(0,O.lazy)(()=>ii(()=>import(`./refs-DLThlN46.js`),__vite__mapDeps([20,1,2,8,3,9,10,11,5,4,12,13,14,15,21]))),li=(0,O.lazy)(()=>ii(()=>import(`./group-DqBGGAEA.js`),__vite__mapDeps([22,1,2,3,11,5,4,8,9,10,12,13,14,15,16,23]))),ui=(0,O.lazy)(()=>ii(()=>import(`./repos-BygXrPSp.js`),__vite__mapDeps([24,1,2,5,4,8,3,9,10,11,12,13,14,15,16,23,25,26,27]))),di=(0,O.lazy)(()=>ii(()=>import(`./cloud-Bl7EJoQ_.js`),__vite__mapDeps([28,1,2,10,5,4]))),fi=(0,O.lazy)(()=>ii(()=>import(`./overview-CFGcpG_m.js`),__vite__mapDeps([29,1,2,3,4,11,5]))),pi=(0,O.lazy)(()=>ii(()=>import(`./templates-CdPNcDxd.js`),__vite__mapDeps([30,1,2,3,9,10,11,5,4,14]))),mi=(0,O.lazy)(()=>ii(()=>import(`./Introduction-EDM3eqXe.js`).then(e=>e.r),__vite__mapDeps([8,1,2,3,9,10,11,5,4,12,13,14,15]))),hi=(0,O.lazy)(()=>ii(()=>import(`./settings-KHM4F3Sy.js`),__vite__mapDeps([31,1,2,25,26,32]))),gi=(0,O.lazy)(()=>ii(()=>import(`./dag-NSMkkWrt.js`),__vite__mapDeps([33,1,2,3,4,6]))),_i=(0,O.lazy)(()=>ii(()=>import(`./composer-panel-DCV7JGNt.js`),__vite__mapDeps([34,1,2,3,9,10,11,18]))),vi=e=>(0,k.jsx)(O.Suspense,{fallback:(0,k.jsx)(`div`,{className:`pad muted`,children:`加载中…`}),children:e});function yi(){return(0,k.jsxs)(`div`,{className:`pad stack welcome`,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`strong`,{children:`从左边目录选一个项目组或目录`}),`——选中的内容显示在中间主内容区。`]}),(0,k.jsx)(`div`,{className:`hint`,children:`主内容区一次只放一块面板(顶部面包屑告诉你现在在哪);设置这类临时面板以浮窗形式出现。`}),(0,k.jsx)(`div`,{className:`hint`,children:`目录在左、并发进程在右;两边都能收起或关掉,需要时再开。`})]})}function bi({dirKey:e}){return vi((0,k.jsx)(ai,{dirKey:e}))}function xi({dirKey:e,groupId:t,task:n,beside:r,tabId:i,model:a,historyId:o}){return vi((0,k.jsx)(oi,{dirKey:e,groupId:t,task:n,beside:!!r,tabId:i,model:a,historyId:o==null?null:Number(o)}))}function Si({dirKey:e,task:t,groupKey:n}){let r=mn()||{},i=n&&(r.repoData&&r.repoData.boards||[]).find(e=>e&&(e.id===n||e.key===n))||null;return vi((0,k.jsx)(si,{dirKey:e,task:t,group:i,rows:r.rows,refreshLocal:r.refreshLocal,model:r.model,onOpenTask:(t,i)=>n?r.openPage&&r.openPage({groupId:n,task:String(t),name:`#${t}`}):r.openPage&&r.openPage({dirKey:i||e,task:String(t),name:`#${t}`}),onClosePage:e=>r.closePanel&&r.closePanel(e)}))}function Ci({boardId:e,model:t}){let n=mn()||{};return vi((0,k.jsx)(li,{dirKey:e,rows:n.rows,repoData:n.repoData,refreshLocal:n.refreshLocal,model:t||n.model}))}function wi(){let e=mn()||{};return vi((0,k.jsx)(fi,{rows:e.rows,onNavigate:e.onNavigate,refreshLocal:e.refreshLocal}))}var Ti={sidebar:{title:`目录`,render:()=>(0,k.jsx)(Nr,{})},welcome:{title:`开始`,render:()=>(0,k.jsx)(yi,{})},dir:{title:`目录`,render:e=>(0,k.jsx)(bi,{dirKey:e&&e.dirKey})},page:{title:`页面`,render:(e,t)=>(0,k.jsx)(xi,{dirKey:e&&e.dirKey,groupId:e&&e.groupId,task:e&&e.task,beside:e&&e.beside,historyId:e&&e.historyId,tabId:t&&t.tabId,model:t&&t.model})},progress:{title:`进程`,render:e=>(0,k.jsx)(Si,{dirKey:e&&e.dirKey,task:e&&e.task,groupKey:e&&e.groupKey})},refs:{title:`文档列表`,render:(e,t)=>vi((0,k.jsx)(ci,{repoKey:e&&e.repoKey,boardKey:e&&e.boardKey,boardName:e&&e.boardName,model:t&&t.model}))},group:{title:`项目组`,render:(e,t)=>(0,k.jsx)(Ci,{boardId:e&&e.boardId,model:t&&t.model})},repos:{title:`仓库管理`,render:()=>vi((0,k.jsx)(ui,{}))},cloud:{title:`云端总览`,render:()=>vi((0,k.jsx)(di,{}))},overview:{title:`全部目录总览`,render:()=>(0,k.jsx)(wi,{})},templates:{title:`任务模板`,render:(e,t)=>vi((0,k.jsx)(pi,{config:e,model:t&&t.model,tabId:t&&t.tabId}))},doc:{title:`文档`,render:(e,t)=>vi((0,k.jsx)(mi,{docId:e&&e.docId,repoKey:e&&e.repoKey,boardKey:e&&e.boardKey,boardName:e&&e.boardName,tabId:t&&t.tabId,model:t&&t.model}))},settings:{title:`设置`,render:()=>vi((0,k.jsx)(hi,{}))},compose:{title:`评论`,render:e=>vi((0,k.jsx)(_i,{token:e&&e.token,mode:e&&e.mode,quote:e&&e.quote,prevQuote:e&&e.prevQuote,taskLabel:e&&e.taskLabel,taskTitle:e&&e.taskTitle,src:e&&e.src}))},dag:{title:`编排`,render:e=>vi((0,k.jsx)(gi,{dirKey:e&&e.dirKey,groupId:e&&e.groupId}))}};function Ei(e){return e?ar(e,{component:`settings`,name:`设置`,config:{}}):null}function Di(e,t={}){if(!e)return null;let n=t.mode||(t.id?`edit`:`new`),r={mode:n,id:t.id||``,name:t.name||``,topic:t.topic||``,scope:Array.isArray(t.scope)?t.scope:[]};return ir(e,{component:`templates`,name:n===`new`?`新建模板`:t.name||`编辑模板`,config:r,location:`center`})}function Oi(e){let t=Ti[e.getComponent()];return t?t.render(e.getConfig()||{},{tabId:e.getId(),model:e.getModel(),node:e}):(0,k.jsxs)(`div`,{className:`muted`,style:{padding:12},children:[`未知面板:`,e.getComponent()]})}[{label:`任务`,items:[{token:`task.id`,desc:`任务号`},{token:`task.text`,desc:`任务正文`},{token:`task.title`,desc:`任务标题`}]},{label:`时间目标`,items:[{token:`goal.name`,desc:`目标名`},{token:`goal.deadline`,desc:`截止时间`},{token:`goal.remainingHuman`,desc:`剩余时长(人话)`},{token:`goal.prompt`,desc:`目标的附加要求`}]},{label:`本次上下文`,items:[{token:`source`,desc:`来源(local/global)`},{token:`summary`,desc:`本轮现状`},{token:`cwd`,desc:`工作目录`},{token:`name`,desc:`主题名`}]}].flatMap(e=>e.items.map(e=>[e.token,e.desc])).reduce((e,[t,n])=>Object.assign(e,{[t]:n}),{});function ki(e,t){let n=t&&typeof t==`object`?t:{};return String(e??``).replace(/\{\{\s*([^}{\s][^{}]*?)\s*\}\}/g,(e,t)=>{let r=String(t).trim(),i=n[r];return i==null?``:String(i)})}function Ai(){let[e,n]=(0,O.useState)({defaultId:``,templates:null,unsupported:!1}),r=(0,O.useCallback)(async()=>{try{let e=await t(`/api/templates`);n({defaultId:e.defaultId,templates:e.templates,unsupported:!1})}catch(e){n(t=>({...t,templates:null,unsupported:String(e.message||e).includes(`接口不存在`)}))}},[]);(0,O.useEffect)(()=>{r()},[r]);let i=(0,O.useCallback)(()=>{let t=(e.templates||[]).find(t=>t.id===e.defaultId);return t?ki(t.body,{...h,...t.values||{}}):ki(g,h)},[e]),a=(0,O.useCallback)(async(e,n,i,a={})=>{let o=await t(`/api/templates`,{method:`POST`,body:{name:e,body:n,setDefault:i,...a.topic?{topic:a.topic}:{},...a.scope===void 0?{}:{scope:a.scope}}});return await r(),o},[r]),o=(0,O.useCallback)(async e=>{let n=await t(`/api/templates/${encodeURIComponent(e)}`,{method:`DELETE`,body:{}});return await r(),n},[r]),s=(0,O.useCallback)(async(e,n)=>{let i=await t(`/api/templates/${encodeURIComponent(e)}`,{method:`PATCH`,body:{id:e,...n}});return await r(),i},[r]),c=(0,O.useCallback)(async e=>{let n=await t(`/api/templates/default`,{method:`PATCH`,body:{id:e}});return await r(),n},[r]);return{defaultId:e.defaultId,templates:e.templates,unsupported:e.unsupported,defaultBody:i,refetch:r,add:a,remove:o,update:s,setDefault:c}}function ji(e){let n=e&&typeof e==`object`?e:{topic:e||``},r=String(n.topic||``).trim(),i=String(n.group||``).trim(),a=String(n.repo||``).trim(),[o,s]=(0,O.useState)({templates:null,scoped:!1}),c=mn()||{},l=c.tpl&&c.tpl.templates||null,u=Array.isArray(l)?l.map(e=>`${e.id}:${(e.scope||[]).join(`,`)}`).join(`|`):``,d=(0,O.useCallback)(async()=>{if(!r&&!i&&!a){s({templates:null,scoped:!1});return}try{let e=new URLSearchParams;r&&e.set(`topic`,r),i&&e.set(`group`,i),a&&e.set(`repo`,a);let n=await t(`/api/templates?${e}`);s({templates:n.templates||[],scoped:!!n.scoped})}catch{s({templates:null,scoped:!1})}},[r,i,a]);return(0,O.useEffect)(()=>{d()},[d,u]),{templates:o.templates,scoped:o.scoped,refetch:d}}function Mi(){if(window.__mdAttPreview)return window.__mdAttPreview.uninstall;let e=document.createElement(`div`);e.className=`md-lightbox`,e.hidden=!0;let t=document.createElement(`img`);t.className=`md-lightbox-img`,t.alt=``;let n=document.createElement(`iframe`);n.className=`md-lightbox-frame`,n.title=`附件预览`;let r=document.createElement(`div`);r.className=`md-lightbox-bar`;let i=document.createElement(`span`);i.className=`md-lightbox-name`;let a=document.createElement(`a`);a.className=`md-lightbox-dl`,a.textContent=`下载`,a.setAttribute(`download`,``),r.append(i,a),e.append(t,n,r);function o({src:r,kind:o,label:s}){i.textContent=s||``,a.href=r,a.setAttribute(`download`,s||``),a.hidden=o!==`pdf`,t.hidden=o!==`img`,n.hidden=o!==`pdf`,o===`img`?t.src=r:n.src=r,e.hidden=!1,document.addEventListener(`keydown`,c)}function s(){e.hidden=!0,t.src=``,n.src=`about:blank`,document.removeEventListener(`keydown`,c)}function c(e){e.key===`Escape`&&s()}e.addEventListener(`click`,t=>{t.target===e&&s()}),document.addEventListener(`click`,e=>{let t=e.target;if(!t||!t.closest)return;let n=t.closest(`img.md-att-img`);if(n){e.preventDefault(),o({src:n.getAttribute(`src`)||n.src,kind:`img`,label:n.alt||``});return}let r=t.closest(`a.md-att`);if(r){let t=String(r.getAttribute(`download`)||r.textContent||``).trim();/\.pdf$/i.test(t)&&(e.preventDefault(),o({src:r.getAttribute(`href`),kind:`pdf`,label:t}))}},!0),document.body.appendChild(e);let l=()=>{s(),e.remove(),delete window.__mdAttPreview};return window.__mdAttPreview={uninstall:l},l}var Ni=`nx-kv-sidebar-v1`,Pi={order:[],hidden:[],folded:!1,defaultFolded:!1};function Fi(e){if(!e||typeof e!=`object`)return e;let{groups:t,dirGroups:n,...r}=e;return r}function Ii(){try{let e=localStorage.getItem(Ni);if(!e)return{...Pi};let t=Fi(JSON.parse(e)),n={...Pi,...t};if(t&&typeof t==`object`&&(`groups`in t||`dirGroups`in t))try{localStorage.setItem(Ni,JSON.stringify(n))}catch{}return n}catch{return{...Pi}}}function Li(e){try{localStorage.setItem(Ni,JSON.stringify(e))}catch{}}function Ri(e){let t={...Ii(),...typeof e==`function`?e(Ii()):e};return Li(t),t}function zi({model:e}){let t=mn()||{},[n,r]=(0,O.useState)(!1),i=(0,O.useCallback)(()=>{if(!e){r(!1);return}if(!Vn(e,`sidebar`)){r(!0);return}let t=sr(e,or(e,`sidebar`));r(_n(t)===`closed`)},[e]);(0,O.useEffect)(()=>{if(!e)return;i();let t={onAfterAction:()=>i()};e.addChangeListener(t);let n=setInterval(i,400);return()=>{e.removeChangeListener(t),clearInterval(n)}},[e,i]);let a=(0,O.useCallback)(()=>{if(!e)return;let t=or(e,`sidebar`);t||=lr(e),t&&(cr(e,t,yn(`expanded`)),Fn(e))},[e]);return!n||typeof document>`u`?null:(0,A.createPortal)((0,k.jsxs)(`div`,{className:`nx-side-fab-layer nx-side-fab-fixed`,role:`navigation`,"aria-label":`目录已关闭`,children:[(0,k.jsx)(`button`,{type:`button`,className:`nx-side-fab`,title:`展开目录`,"aria-label":`展开目录`,onClick:a,children:(0,k.jsx)(c,{name:`sidebar`,size:14})}),(0,k.jsx)(`button`,{type:`button`,className:`nx-side-fab-gear`,title:`设置(浮动面板)`,"aria-label":`设置`,onClick:()=>t.shell&&t.shell.openSettings(),children:(0,k.jsx)(c,{name:`gear`,size:14})})]}),document.body)}var Bi=[];function Vi(e){e&&(Bi[Bi.length-1]!==e&&Bi.push(e),Bi.length>30&&Bi.shift())}function Hi(){return Bi.length>1?(Bi.pop(),Bi[Bi.length-1]):``}function Ui(){let[e,t]=(location.hash||``).replace(/^#\/?/,``).split(`?`),n=new URLSearchParams(t||``),r=n.get(`task`)||``;if(e.startsWith(`dir/`))return{view:`dir`,key:decodeURIComponent(e.slice(4)),task:r};if(e.startsWith(`group/`))return{view:`group`,key:decodeURIComponent(e.slice(6)),task:r};if(e===`doc`){let e=n.get(`ref`)||``,t=n.get(`repo`)||``,r=n.get(`board`)||``,i=n.get(`name`)||``;return{view:`doc`,key:e?Xr(e):``,task:``,repoKey:t,boardKey:r,boardName:i}}if(e===`templates`||e.startsWith(`templates/`)){let t=e===`templates`?``:e.slice(10);return t.startsWith(`edit/`)?{view:`templates`,key:``,task:``,mode:`edit`,id:decodeURIComponent(t.slice(5)),topic:``,scope:``}:t===`new`?{view:`templates`,key:``,task:``,mode:`new`,id:``,topic:n.get(`topic`)||``,scope:n.get(`scope`)||``}:{view:`templates`,key:``,task:``,mode:``,id:``,topic:``,scope:``}}return[`global`,`overview`,`cloud`,`todo`,`repos`].includes(e)?{view:e===`todo`?`cloud`:e,key:e===`global`?`__GLOBAL__`:``,task:e===`global`?r:``}:{view:`overview`,key:``,task:``}}var Wi={close:`关闭`,rename:`重命名`,float:`浮窗`,dock:`停靠`,popout:`弹出到新窗口`,Close:`关闭`,Rename:`重命名`,Float:`浮窗`,Dock:`停靠`,Popout:`弹出到新窗口`,"flexlayout.ui.dock.float.tabs (?)":`迁回 ? 个页签`},Gi=e=>Wi[e]||e;function Ki(){let{boot:e}=un(),n=i(),[a,o]=(0,O.useState)(Ui),[s,l]=(0,O.useState)(Ii),[,u]=(0,O.useState)(0),[d,f]=(0,O.useState)(null),p=Ai(),m=(0,O.useRef)(null),[h,g]=(0,O.useState)(()=>Pn());(0,O.useEffect)(()=>{h&&(window.__nxkv={model:h,Actions:R,DockLocation:F})},[h]);let _=(0,O.useCallback)(e=>l(Ri(e)),[]);(0,O.useEffect)(()=>{let e=()=>o(Ui());return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]),(0,O.useEffect)(()=>Mi(),[]);let v=(0,O.useCallback)(e=>{location.hash!==e&&(location.hash=e),o(e=>{let t=Ui();return e.view===t.view&&e.key===t.key&&e.task===t.task?e:t})},[]),y=(0,O.useCallback)(async()=>{try{f(await t(`/api/localtasks`))}catch{}},[]);(0,O.useEffect)(()=>{y();let e=setInterval(y,15e3);return()=>clearInterval(e)},[y]);let[x,S]=(0,O.useState)({repos:[],boards:[]}),C=(0,O.useCallback)(async()=>{try{let[e,n]=await Promise.all([t(`/api/repos`),t(`/api/boards`)]);S({repos:(e||[]).filter(e=>(e.type||`dev`)!==`ref`),boards:n&&n.boards||[]})}catch{}},[]);(0,O.useEffect)(()=>{C();let e=setInterval(C,3e4);return()=>clearInterval(e)},[C]),(0,O.useEffect)(()=>{let e=!1,r=async()=>{try{let r=await t(`/api/localtasks/presence`),i=Math.max(0,Number(r&&r.waiting)||0);if(e)return;u(e=>(e===0&&i>0&&n(`有 agent 正在等待回填,请查看对应目录`),i))}catch{}};r();let i=setInterval(r,15e3);return()=>{e=!0,clearInterval(i)}},[n]),(0,O.useEffect)(()=>{let e=!1,n=()=>{e||t(`/api/ping`).catch(()=>{})};n();let r=setInterval(n,15e3);return()=>{e=!0,clearInterval(r)}},[]);let w=(0,O.useMemo)(()=>d?.topics||[],[d]),ee=(0,O.useRef)(!1);(0,O.useEffect)(()=>{if(!h)return;let e={onAfterAction:()=>{if(!ee.current){ee.current=!0;try{In(h),Fn(h)}finally{ee.current=!1}}}};return h.addChangeListener(e),()=>h.removeChangeListener(e)},[h]);let T=(0,O.useCallback)(e=>{if(!h)return;let t=[...h.getLayouts().entries()].filter(([,e])=>e.getType()===`float`);if(!t.length)return;let n=e.currentTarget.closest(`.flexlayout__float_window`),r=t[0][0];if(t.length>1&&n){let e=n.offsetParent?n.offsetParent.getBoundingClientRect():{left:0,top:0},i=n.getBoundingClientRect(),a=null;for(let[n,r]of t){let t=r.getRect(),o=Math.abs(t.x-(i.left-e.left))+Math.abs(t.y-(i.top-e.top));(!a||o<a.d)&&(a={id:n,d:o})}r=a.id}let i=h.getLayouts().get(r);if(!i)return;let a=null;i.visitNodes(e=>{!a&&typeof e.getSelectedNode==`function`&&(a=e.getSelectedNode()||null)}),a&&a.isCloseable()&&h.doAction(R.deleteTab(a.getId()))},[h]),E=(0,O.useMemo)(()=>{if(a.view===`group`){let e=b(w,x.boards||[],a.key,a.task);return{boardName:e.board&&e.board.name||``,dirName:e.topic?e.topic.name:``,pageTitle:e.taskRow?`#${e.taskRow.id}`:``}}let e=(x.boards||[]).find(e=>e.id===a.key),t=w.find(e=>e.key===a.key),n=t&&a.task?(t.tasks||[]).find(e=>String(e.id)===String(a.task)):null;if(a.view===`doc`){let e=String(a.key||``).replace(/^(rel|path):/,``).split(/[\\/]/).filter(Boolean).pop()||``,t=(x.repos||[]).find(e=>e.key===a.repoKey),n=(x.boards||[]).find(e=>e.id===a.boardKey||e.key===a.boardKey);return{boardName:a.boardName||n&&n.name||``,dirName:``,pageTitle:e.replace(/\.md$/i,``),repoName:t&&t.name||``}}return{boardName:e&&e.name||``,dirName:t?t.name:``,pageTitle:n?`#${n.id}`:``}},[x.boards,x.repos,w,a.view,a.key,a.task,a.repoKey,a.boardKey,a.boardName]);(0,O.useEffect)(()=>{Vi(location.hash)},[a.view,a.key,a.task,a.repoKey,a.boardKey]);let D=(0,O.useRef)(h);(0,O.useEffect)(()=>{D.current=h},[h]);let A=(0,O.useRef)(E);(0,O.useEffect)(()=>{A.current=E},[E]);let j=`${E.boardName}|${E.dirName}|${E.pageTitle}`,te=(0,O.useRef)({route:``,key:``});(0,O.useEffect)(()=>{let e=D.current;if(!e)return;let t=ei(a,A.current);if(!t)return;let n=`${a.view}|${a.key}|${a.task}|${a.repoKey||``}|${a.boardKey||``}|${a.mode||``}|${a.id||``}|${a.topic||``}|${a.scope||``}`,r=te.current;(r.route!==n||r.key!==j)&&(te.current={route:n,key:j},ir(e,t))},[a,j]);let ne=(0,O.useCallback)(e=>{h&&ir(h,{component:`page`,name:e.name||`页面`,config:e.groupId?{groupId:e.groupId,task:e.task}:{dirKey:e.dirKey,task:e.task},location:e.location||`center`})},[h]),re=(0,O.useCallback)(e=>{h&&e&&h.doAction(R.deleteTab(e))},[h]),ie=(0,O.useRef)(null),ae=(0,O.useCallback)(()=>{if(!h)return;let e=ur(h);if(!e)return;let t=e.getId(),n=ie.current;if(ie.current=t,n===t)return;let r=Qr(e);if(!r)return;let i=ei(Ui(),E);if(i&&i.component===e.getComponent()&&Rn(i.config||{})===Rn(e.getConfig()||{}))return;history.replaceState(null,``,r);let a=Ui();o(e=>e.view===a.view&&e.key===a.key&&e.task===a.task&&e.repoKey===a.repoKey&&e.boardKey===a.boardKey&&e.boardName===a.boardName&&e.mode===a.mode&&e.id===a.id&&e.topic===a.topic&&e.scope===a.scope?e:a)},[h,E]),{dialog:M,node:N}=r(),P=(0,O.useCallback)(async()=>{await M({title:`重置为初始两栏`,message:`丢掉存下来的布局,回到初始的两栏(目录 + 开始)?`,okText:`重置`})&&(Ln(),g(Pn()))},[M,g]),I=(0,O.useMemo)(()=>({resetLayout:P,openSettings:()=>Ei(h)}),[P,h]),L=(0,O.useMemo)(()=>({boot:e,rows:w,repoData:x,prefs:s,patchPrefs:_,onNavigate:v,refreshLocal:y,refreshRepos:C,tpl:p,model:h,route:a,localReady:d!==null,openPage:ne,closePanel:re,shell:I}),[e,w,x,s,_,v,y,C,p,h,a,ne,re,I]);return(0,k.jsx)(pn.Provider,{value:L,children:(0,k.jsx)(`div`,{id:`app-shell`,className:`nx-shell`,children:(0,k.jsx)(`div`,{className:`nx-workarea`,children:h?(0,k.jsxs)(fn,{children:[(0,k.jsx)(rn,{ref:m,model:h,factory:Oi,onAction:e=>e,onModelChange:ae,i18nTranslator:Gi,keyMap:{...ke,focusTabToggle:`F6`,focusNextTabset:`Ctrl+F6`,focusPreviousTabset:`Ctrl+Shift+F6`},icons:{dragToDock:(0,k.jsx)(`button`,{type:`button`,className:`flx-float-close`,title:`关闭浮窗`,"aria-label":`关闭浮窗`,onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation(),T(e)},children:(0,k.jsx)(c,{name:`x`,size:14})})}}),(0,k.jsx)(zi,{model:h}),N]},`workspace`):(0,k.jsx)(`div`,{className:`pad muted`,children:`正在装载工作区…`})})})})}(0,j.createRoot)(document.getElementById(`root`)).render((0,k.jsx)(O.StrictMode,{children:(0,k.jsx)(ln,{children:(0,k.jsx)(o,{children:(0,k.jsx)(Ki,{})})})}));export{dn as A,Zn as C,ar as D,rr as E,R as M,T as N,ir as O,$n as S,zn as T,Tr as _,Ei as a,xr as b,Gr as c,Kr as d,Jr as f,Er as g,Wr as h,ki as i,un as j,mn as k,Hr as l,Br as m,Ai as n,Di as o,qr as p,ji as r,Vr as s,Hi as t,Ur as u,Sr as v,Hn as w,mr as x,wr as y};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{S as e,_ as t,l as n,o as r,v as i,y as a}from"./task-status-BP6y8MVu.js";import{a as o,c as s,l as c,o as l,s as u,u as d}from"./md-parse-C2bDc3IZ.js";import{E as f,N as p,k as m}from"./index-
|
|
1
|
+
import{S as e,_ as t,l as n,o as r,v as i,y as a}from"./task-status-BP6y8MVu.js";import{a as o,c as s,l as c,o as l,s as u,u as d}from"./md-parse-C2bDc3IZ.js";import{E as f,N as p,k as m}from"./index-CLsU9Lad.js";import{n as h,o as g,r as _,t as v}from"./upload-L1g-pfvZ.js";import{t as y}from"./status-tag-Bts7p2cp.js";var b=e(a(),1),x=p(),S={inline:`正文内嵌`,area:`附件区`},C=e=>e===`attach`||e===`doc`?`area`:`inline`,w=/\.(png|jpe?g|gif|webp|bmp|svg)$/i;function T(e){let t=Number(e)||0;return t?t<1024?`${t} B`:t<1048576?`${(t/1024).toFixed(0)} KB`:`${(t/1024/1024).toFixed(1)} MB`:``}function E(e){return`/api/file/content/${encodeURIComponent(String(e))}`}function D(e){let t=String(e||``).replace(/\\/g,`/`);return/^(rel|path):/.test(t)?t:/^\/|[A-Za-z]:\//.test(t)?`path:${t}`:t?`rel:${t}`:``}function O(e){let t=String(e.role||`inline`),n=e.kind===`file`&&(e.isImage===!0||/^image\//i.test(e.mime||``)||w.test(e.name||``)),r=typeof e.url==`string`?e.url:e.url&&e.url.href?e.url.href:``;return{...e,role:t,area:C(t),areaLabel:S[C(t)],kind:e.kind===`file`&&n?`image`:e.kind,sizeText:T(e.size),href:e.kind===`file`?E(e.id):e.href||r,targetSeq:e.targetSeq??(e.meta&&e.meta.seq)??null,targetKey:e.targetKey||e.meta&&e.meta.topicKey||``,targetRef:e.targetKey||e.meta&&e.meta.refId||``,locator:e.locator||e.relPath||e.meta&&e.meta.locator||``}}var k={image:`图片`,file:`文件`,url:`链接`,task:`任务`,ref:`文档`},A=e=>k[e]||`附件`;function j(e,{hostId:n,hostKey:r,hostCwd:i,refId:a}){if(e===`task`){let e=r?{key:r}:i?{cwd:i}:{},a=new URLSearchParams({id:String(n)});return r?a.set(`key`,r):i&&a.set(`cwd`,i),{list:()=>t(`/api/localtasks/attachments?${a.toString()}`),attach:r=>t(`/api/localtasks/attach`,{method:`POST`,body:{id:Number(n),...e,...r,noEmbed:!0}}),detach:(r,i)=>t(`/api/localtasks/attach`,{method:`DELETE`,body:{id:Number(n),...e,attachment:r,purge:i}})}}let o=new URLSearchParams({ref:String(a||``)});return{list:()=>t(`/api/docs/attachments?${o.toString()}`),attach:e=>t(`/api/docs/attach`,{method:`POST`,body:{ref:a,...e,noEmbed:!0}}),detach:(e,n)=>t(`/api/docs/attach`,{method:`DELETE`,body:{ref:a,attachment:e,purge:n}})}}function M(e){return e.source===`file`?{fileId:e.fileId,name:e.name}:e.source===`url`?{url:e.url,name:e.name}:e.source===`task`?{task:String(e.seq),name:e.name}:e.source===`ref`?{doc:e.docRef,name:e.name}:{}}function N(e,t,n){return{value:e,start:t,end:n}}function P(e,t,n=t,r=``){if(!e)return null;let{value:i,selectionStart:a,selectionEnd:o}=e,s=i.slice(a,o)||r,c=i.slice(0,a)+t+s+n+i.slice(o),l=a+t.length;return N(c,l,l+s.length)}function F(e,t){if(!e)return null;let{value:n,selectionStart:r,selectionEnd:i}=e,a=n.lastIndexOf(`
|
|
2
2
|
`,r-1)+1,o=(()=>{let e=n.indexOf(`
|
|
3
3
|
`,i);return e===-1?n.length:e})(),s=n.slice(a,o),c=s.split(`
|
|
4
4
|
`),l=c.every(e=>e.startsWith(t)||e===``),u=c.map(e=>!e&&c.length>1?e:l?e.startsWith(t)?e.slice(t.length):e:e.startsWith(t)?e:t+e).join(`
|