@fieldwangai/agentflow 0.1.103 → 0.1.105
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/bin/lib/prd-workflow-collaboration.mjs +180 -0
- package/bin/lib/ui-server.mjs +574 -95
- package/builtin/web-ui/dist/assets/index-CC1ceU6X.css +1 -0
- package/builtin/web-ui/dist/assets/index-DuSU9kCW.js +348 -0
- package/builtin/web-ui/dist/index.html +2 -2
- package/package.json +1 -1
- package/builtin/web-ui/dist/assets/index-CjR04ruh.js +0 -348
- package/builtin/web-ui/dist/assets/index-DhNqbtUT.css +0 -1
|
@@ -1,348 +0,0 @@
|
|
|
1
|
-
var C$=Object.defineProperty;var _$=(e,t,n)=>t in e?C$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Rn=(e,t,n)=>_$(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var Vu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function qo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ZC={exports:{}},Zh={},e_={exports:{}},At={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react.production.min.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Pd=Symbol.for("react.element"),E$=Symbol.for("react.portal"),A$=Symbol.for("react.fragment"),P$=Symbol.for("react.strict_mode"),I$=Symbol.for("react.profiler"),R$=Symbol.for("react.provider"),T$=Symbol.for("react.context"),M$=Symbol.for("react.forward_ref"),$$=Symbol.for("react.suspense"),L$=Symbol.for("react.memo"),O$=Symbol.for("react.lazy"),YS=Symbol.iterator;function D$(e){return e===null||typeof e!="object"?null:(e=YS&&e[YS]||e["@@iterator"],typeof e=="function"?e:null)}var t_={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},n_=Object.assign,r_={};function gc(e,t,n){this.props=e,this.context=t,this.refs=r_,this.updater=n||t_}gc.prototype.isReactComponent={};gc.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};gc.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function s_(){}s_.prototype=gc.prototype;function Vw(e,t,n){this.props=e,this.context=t,this.refs=r_,this.updater=n||t_}var Kw=Vw.prototype=new s_;Kw.constructor=Vw;n_(Kw,gc.prototype);Kw.isPureReactComponent=!0;var GS=Array.isArray,i_=Object.prototype.hasOwnProperty,Uw={current:null},o_={key:!0,ref:!0,__self:!0,__source:!0};function a_(e,t,n){var r,s={},i=null,a=null;if(t!=null)for(r in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(i=""+t.key),t)i_.call(t,r)&&!o_.hasOwnProperty(r)&&(s[r]=t[r]);var l=arguments.length-2;if(l===1)s.children=n;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];s.children=c}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)s[r]===void 0&&(s[r]=l[r]);return{$$typeof:Pd,type:e,key:i,ref:a,props:s,_owner:Uw.current}}function F$(e,t){return{$$typeof:Pd,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function qw(e){return typeof e=="object"&&e!==null&&e.$$typeof===Pd}function z$(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var JS=/\/+/g;function Ng(e,t){return typeof e=="object"&&e!==null&&e.key!=null?z$(""+e.key):t.toString(36)}function kp(e,t,n,r,s){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(i){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case Pd:case E$:a=!0}}if(a)return a=e,s=s(a),e=r===""?"."+Ng(a,0):r,GS(s)?(n="",e!=null&&(n=e.replace(JS,"$&/")+"/"),kp(s,t,n,"",function(u){return u})):s!=null&&(qw(s)&&(s=F$(s,n+(!s.key||a&&a.key===s.key?"":(""+s.key).replace(JS,"$&/")+"/")+e)),t.push(s)),1;if(a=0,r=r===""?".":r+":",GS(e))for(var l=0;l<e.length;l++){i=e[l];var c=r+Ng(i,l);a+=kp(i,t,n,c,s)}else if(c=D$(e),typeof c=="function")for(e=c.call(e),l=0;!(i=e.next()).done;)i=i.value,c=r+Ng(i,l++),a+=kp(i,t,n,c,s);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return a}function _f(e,t,n){if(e==null)return e;var r=[],s=0;return kp(e,r,"","",function(i){return t.call(n,i,s++)}),r}function B$(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Ar={current:null},vp={transition:null},H$={ReactCurrentDispatcher:Ar,ReactCurrentBatchConfig:vp,ReactCurrentOwner:Uw};function l_(){throw Error("act(...) is not supported in production builds of React.")}At.Children={map:_f,forEach:function(e,t,n){_f(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return _f(e,function(){t++}),t},toArray:function(e){return _f(e,function(t){return t})||[]},only:function(e){if(!qw(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};At.Component=gc;At.Fragment=A$;At.Profiler=I$;At.PureComponent=Vw;At.StrictMode=P$;At.Suspense=$$;At.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=H$;At.act=l_;At.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=n_({},e.props),s=e.key,i=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,a=Uw.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)i_.call(t,c)&&!o_.hasOwnProperty(c)&&(r[c]=t[c]===void 0&&l!==void 0?l[c]:t[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];r.children=l}return{$$typeof:Pd,type:e.type,key:s,ref:i,props:r,_owner:a}};At.createContext=function(e){return e={$$typeof:T$,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:R$,_context:e},e.Consumer=e};At.createElement=a_;At.createFactory=function(e){var t=a_.bind(null,e);return t.type=e,t};At.createRef=function(){return{current:null}};At.forwardRef=function(e){return{$$typeof:M$,render:e}};At.isValidElement=qw;At.lazy=function(e){return{$$typeof:O$,_payload:{_status:-1,_result:e},_init:B$}};At.memo=function(e,t){return{$$typeof:L$,type:e,compare:t===void 0?null:t}};At.startTransition=function(e){var t=vp.transition;vp.transition={};try{e()}finally{vp.transition=t}};At.unstable_act=l_;At.useCallback=function(e,t){return Ar.current.useCallback(e,t)};At.useContext=function(e){return Ar.current.useContext(e)};At.useDebugValue=function(){};At.useDeferredValue=function(e){return Ar.current.useDeferredValue(e)};At.useEffect=function(e,t){return Ar.current.useEffect(e,t)};At.useId=function(){return Ar.current.useId()};At.useImperativeHandle=function(e,t,n){return Ar.current.useImperativeHandle(e,t,n)};At.useInsertionEffect=function(e,t){return Ar.current.useInsertionEffect(e,t)};At.useLayoutEffect=function(e,t){return Ar.current.useLayoutEffect(e,t)};At.useMemo=function(e,t){return Ar.current.useMemo(e,t)};At.useReducer=function(e,t,n){return Ar.current.useReducer(e,t,n)};At.useRef=function(e){return Ar.current.useRef(e)};At.useState=function(e){return Ar.current.useState(e)};At.useSyncExternalStore=function(e,t,n){return Ar.current.useSyncExternalStore(e,t,n)};At.useTransition=function(){return Ar.current.useTransition()};At.version="18.3.1";e_.exports=At;var m=e_.exports;const ot=qo(m);/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.production.min.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var W$=m,V$=Symbol.for("react.element"),K$=Symbol.for("react.fragment"),U$=Object.prototype.hasOwnProperty,q$=W$.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Y$={key:!0,ref:!0,__self:!0,__source:!0};function c_(e,t,n){var r,s={},i=null,a=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(a=t.ref);for(r in t)U$.call(t,r)&&!Y$.hasOwnProperty(r)&&(s[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)s[r]===void 0&&(s[r]=t[r]);return{$$typeof:V$,type:e,key:i,ref:a,props:s,_owner:q$.current}}Zh.Fragment=K$;Zh.jsx=c_;Zh.jsxs=c_;ZC.exports=Zh;var o=ZC.exports,Uy={},u_={exports:{}},ls={},d_={exports:{}},f_={};/**
|
|
18
|
-
* @license React
|
|
19
|
-
* scheduler.production.min.js
|
|
20
|
-
*
|
|
21
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
-
*
|
|
23
|
-
* This source code is licensed under the MIT license found in the
|
|
24
|
-
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/(function(e){function t(R,B){var _=R.length;R.push(B);e:for(;0<_;){var X=_-1>>>1,z=R[X];if(0<s(z,B))R[X]=B,R[_]=z,_=X;else break e}}function n(R){return R.length===0?null:R[0]}function r(R){if(R.length===0)return null;var B=R[0],_=R.pop();if(_!==B){R[0]=_;e:for(var X=0,z=R.length,T=z>>>1;X<T;){var Z=2*(X+1)-1,ae=R[Z],J=Z+1,se=R[J];if(0>s(ae,_))J<z&&0>s(se,ae)?(R[X]=se,R[J]=_,X=J):(R[X]=ae,R[Z]=_,X=Z);else if(J<z&&0>s(se,_))R[X]=se,R[J]=_,X=J;else break e}}return B}function s(R,B){var _=R.sortIndex-B.sortIndex;return _!==0?_:R.id-B.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}var c=[],u=[],f=1,d=null,p=3,h=!1,g=!1,k=!1,w=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function b(R){for(var B=n(u);B!==null;){if(B.callback===null)r(u);else if(B.startTime<=R)r(u),B.sortIndex=B.expirationTime,t(c,B);else break;B=n(u)}}function C(R){if(k=!1,b(R),!g)if(n(c)!==null)g=!0,W(N);else{var B=n(u);B!==null&&$(C,B.startTime-R)}}function N(R,B){g=!1,k&&(k=!1,y(I),I=-1),h=!0;var _=p;try{for(b(B),d=n(c);d!==null&&(!(d.expirationTime>B)||R&&!V());){var X=d.callback;if(typeof X=="function"){d.callback=null,p=d.priorityLevel;var z=X(d.expirationTime<=B);B=e.unstable_now(),typeof z=="function"?d.callback=z:d===n(c)&&r(c),b(B)}else r(c);d=n(c)}if(d!==null)var T=!0;else{var Z=n(u);Z!==null&&$(C,Z.startTime-B),T=!1}return T}finally{d=null,p=_,h=!1}}var j=!1,A=null,I=-1,D=5,H=-1;function V(){return!(e.unstable_now()-H<D)}function F(){if(A!==null){var R=e.unstable_now();H=R;var B=!0;try{B=A(!0,R)}finally{B?L():(j=!1,A=null)}}else j=!1}var L;if(typeof v=="function")L=function(){v(F)};else if(typeof MessageChannel<"u"){var M=new MessageChannel,K=M.port2;M.port1.onmessage=F,L=function(){K.postMessage(null)}}else L=function(){w(F,0)};function W(R){A=R,j||(j=!0,L())}function $(R,B){I=w(function(){R(e.unstable_now())},B)}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(R){R.callback=null},e.unstable_continueExecution=function(){g||h||(g=!0,W(N))},e.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<R?Math.floor(1e3/R):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(R){switch(p){case 1:case 2:case 3:var B=3;break;default:B=p}var _=p;p=B;try{return R()}finally{p=_}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(R,B){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var _=p;p=R;try{return B()}finally{p=_}},e.unstable_scheduleCallback=function(R,B,_){var X=e.unstable_now();switch(typeof _=="object"&&_!==null?(_=_.delay,_=typeof _=="number"&&0<_?X+_:X):_=X,R){case 1:var z=-1;break;case 2:z=250;break;case 5:z=1073741823;break;case 4:z=1e4;break;default:z=5e3}return z=_+z,R={id:f++,callback:B,priorityLevel:R,startTime:_,expirationTime:z,sortIndex:-1},_>X?(R.sortIndex=_,t(u,R),n(c)===null&&R===n(u)&&(k?(y(I),I=-1):k=!0,$(C,_-X))):(R.sortIndex=z,t(c,R),g||h||(g=!0,W(N))),R},e.unstable_shouldYield=V,e.unstable_wrapCallback=function(R){var B=p;return function(){var _=p;p=B;try{return R.apply(this,arguments)}finally{p=_}}}})(f_);d_.exports=f_;var G$=d_.exports;/**
|
|
26
|
-
* @license React
|
|
27
|
-
* react-dom.production.min.js
|
|
28
|
-
*
|
|
29
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
-
*
|
|
31
|
-
* This source code is licensed under the MIT license found in the
|
|
32
|
-
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var J$=m,os=G$;function Ne(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;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."}var p_=new Set,Ku={};function Ka(e,t){Zl(e,t),Zl(e+"Capture",t)}function Zl(e,t){for(Ku[e]=t,e=0;e<t.length;e++)p_.add(t[e])}var Gi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),qy=Object.prototype.hasOwnProperty,X$=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,XS={},QS={};function Q$(e){return qy.call(QS,e)?!0:qy.call(XS,e)?!1:X$.test(e)?QS[e]=!0:(XS[e]=!0,!1)}function Z$(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function e2(e,t,n,r){if(t===null||typeof t>"u"||Z$(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Pr(e,t,n,r,s,i,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=a}var dr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){dr[e]=new Pr(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];dr[t]=new Pr(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){dr[e]=new Pr(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){dr[e]=new Pr(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){dr[e]=new Pr(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){dr[e]=new Pr(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){dr[e]=new Pr(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){dr[e]=new Pr(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){dr[e]=new Pr(e,5,!1,e.toLowerCase(),null,!1,!1)});var Yw=/[\-:]([a-z])/g;function Gw(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Yw,Gw);dr[t]=new Pr(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Yw,Gw);dr[t]=new Pr(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Yw,Gw);dr[t]=new Pr(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){dr[e]=new Pr(e,1,!1,e.toLowerCase(),null,!1,!1)});dr.xlinkHref=new Pr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){dr[e]=new Pr(e,1,!1,e.toLowerCase(),null,!0,!0)});function Jw(e,t,n,r){var s=dr.hasOwnProperty(t)?dr[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(e2(t,n,s,r)&&(n=null),r||s===null?Q$(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):s.mustUseProperty?e[s.propertyName]=n===null?s.type===3?!1:"":n:(t=s.attributeName,r=s.attributeNamespace,n===null?e.removeAttribute(t):(s=s.type,n=s===3||s===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var to=J$.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Ef=Symbol.for("react.element"),Sl=Symbol.for("react.portal"),Nl=Symbol.for("react.fragment"),Xw=Symbol.for("react.strict_mode"),Yy=Symbol.for("react.profiler"),h_=Symbol.for("react.provider"),m_=Symbol.for("react.context"),Qw=Symbol.for("react.forward_ref"),Gy=Symbol.for("react.suspense"),Jy=Symbol.for("react.suspense_list"),Zw=Symbol.for("react.memo"),bo=Symbol.for("react.lazy"),g_=Symbol.for("react.offscreen"),ZS=Symbol.iterator;function Jc(e){return e===null||typeof e!="object"?null:(e=ZS&&e[ZS]||e["@@iterator"],typeof e=="function"?e:null)}var An=Object.assign,jg;function mu(e){if(jg===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);jg=t&&t[1]||""}return`
|
|
34
|
-
`+jg+e}var Cg=!1;function _g(e,t){if(!e||Cg)return"";Cg=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var r=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){r=u}e.call(t.prototype)}else{try{throw Error()}catch(u){r=u}e()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var s=u.stack.split(`
|
|
35
|
-
`),i=r.stack.split(`
|
|
36
|
-
`),a=s.length-1,l=i.length-1;1<=a&&0<=l&&s[a]!==i[l];)l--;for(;1<=a&&0<=l;a--,l--)if(s[a]!==i[l]){if(a!==1||l!==1)do if(a--,l--,0>l||s[a]!==i[l]){var c=`
|
|
37
|
-
`+s[a].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=a&&0<=l);break}}}finally{Cg=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?mu(e):""}function t2(e){switch(e.tag){case 5:return mu(e.type);case 16:return mu("Lazy");case 13:return mu("Suspense");case 19:return mu("SuspenseList");case 0:case 2:case 15:return e=_g(e.type,!1),e;case 11:return e=_g(e.type.render,!1),e;case 1:return e=_g(e.type,!0),e;default:return""}}function Xy(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Nl:return"Fragment";case Sl:return"Portal";case Yy:return"Profiler";case Xw:return"StrictMode";case Gy:return"Suspense";case Jy:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case m_:return(e.displayName||"Context")+".Consumer";case h_:return(e._context.displayName||"Context")+".Provider";case Qw:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Zw:return t=e.displayName||null,t!==null?t:Xy(e.type)||"Memo";case bo:t=e._payload,e=e._init;try{return Xy(e(t))}catch{}}return null}function n2(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Xy(t);case 8:return t===Xw?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function zo(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function y_(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function r2(e){var t=y_(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(a){r=""+a,i.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Af(e){e._valueTracker||(e._valueTracker=r2(e))}function x_(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=y_(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function qp(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Qy(e,t){var n=t.checked;return An({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function e0(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=zo(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function w_(e,t){t=t.checked,t!=null&&Jw(e,"checked",t,!1)}function Zy(e,t){w_(e,t);var n=zo(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?ex(e,t.type,n):t.hasOwnProperty("defaultValue")&&ex(e,t.type,zo(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function t0(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function ex(e,t,n){(t!=="number"||qp(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var gu=Array.isArray;function zl(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s<n.length;s++)t["$"+n[s]]=!0;for(n=0;n<e.length;n++)s=t.hasOwnProperty("$"+e[n].value),e[n].selected!==s&&(e[n].selected=s),s&&r&&(e[n].defaultSelected=!0)}else{for(n=""+zo(n),t=null,s=0;s<e.length;s++){if(e[s].value===n){e[s].selected=!0,r&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function tx(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(Ne(91));return An({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function n0(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(Ne(92));if(gu(n)){if(1<n.length)throw Error(Ne(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:zo(n)}}function b_(e,t){var n=zo(t.value),r=zo(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function r0(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function k_(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function nx(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?k_(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Pf,v_=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,s){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,s)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Pf=Pf||document.createElement("div"),Pf.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Pf.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Uu(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ju={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},s2=["Webkit","ms","Moz","O"];Object.keys(ju).forEach(function(e){s2.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ju[t]=ju[e]})});function S_(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||ju.hasOwnProperty(e)&&ju[e]?(""+t).trim():t+"px"}function N_(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=S_(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var i2=An({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function rx(e,t){if(t){if(i2[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Ne(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Ne(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Ne(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Ne(62))}}function sx(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ix=null;function eb(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ox=null,Bl=null,Hl=null;function s0(e){if(e=Td(e)){if(typeof ox!="function")throw Error(Ne(280));var t=e.stateNode;t&&(t=sm(t),ox(e.stateNode,e.type,t))}}function j_(e){Bl?Hl?Hl.push(e):Hl=[e]:Bl=e}function C_(){if(Bl){var e=Bl,t=Hl;if(Hl=Bl=null,s0(e),t)for(e=0;e<t.length;e++)s0(t[e])}}function __(e,t){return e(t)}function E_(){}var Eg=!1;function A_(e,t,n){if(Eg)return e(t,n);Eg=!0;try{return __(e,t,n)}finally{Eg=!1,(Bl!==null||Hl!==null)&&(E_(),C_())}}function qu(e,t){var n=e.stateNode;if(n===null)return null;var r=sm(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(Ne(231,t,typeof n));return n}var ax=!1;if(Gi)try{var Xc={};Object.defineProperty(Xc,"passive",{get:function(){ax=!0}}),window.addEventListener("test",Xc,Xc),window.removeEventListener("test",Xc,Xc)}catch{ax=!1}function o2(e,t,n,r,s,i,a,l,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(f){this.onError(f)}}var Cu=!1,Yp=null,Gp=!1,lx=null,a2={onError:function(e){Cu=!0,Yp=e}};function l2(e,t,n,r,s,i,a,l,c){Cu=!1,Yp=null,o2.apply(a2,arguments)}function c2(e,t,n,r,s,i,a,l,c){if(l2.apply(this,arguments),Cu){if(Cu){var u=Yp;Cu=!1,Yp=null}else throw Error(Ne(198));Gp||(Gp=!0,lx=u)}}function Ua(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function P_(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 i0(e){if(Ua(e)!==e)throw Error(Ne(188))}function u2(e){var t=e.alternate;if(!t){if(t=Ua(e),t===null)throw Error(Ne(188));return t!==e?null:e}for(var n=e,r=t;;){var s=n.return;if(s===null)break;var i=s.alternate;if(i===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===n)return i0(s),e;if(i===r)return i0(s),t;i=i.sibling}throw Error(Ne(188))}if(n.return!==r.return)n=s,r=i;else{for(var a=!1,l=s.child;l;){if(l===n){a=!0,n=s,r=i;break}if(l===r){a=!0,r=s,n=i;break}l=l.sibling}if(!a){for(l=i.child;l;){if(l===n){a=!0,n=i,r=s;break}if(l===r){a=!0,r=i,n=s;break}l=l.sibling}if(!a)throw Error(Ne(189))}}if(n.alternate!==r)throw Error(Ne(190))}if(n.tag!==3)throw Error(Ne(188));return n.stateNode.current===n?e:t}function I_(e){return e=u2(e),e!==null?R_(e):null}function R_(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=R_(e);if(t!==null)return t;e=e.sibling}return null}var T_=os.unstable_scheduleCallback,o0=os.unstable_cancelCallback,d2=os.unstable_shouldYield,f2=os.unstable_requestPaint,Fn=os.unstable_now,p2=os.unstable_getCurrentPriorityLevel,tb=os.unstable_ImmediatePriority,M_=os.unstable_UserBlockingPriority,Jp=os.unstable_NormalPriority,h2=os.unstable_LowPriority,$_=os.unstable_IdlePriority,em=null,gi=null;function m2(e){if(gi&&typeof gi.onCommitFiberRoot=="function")try{gi.onCommitFiberRoot(em,e,void 0,(e.current.flags&128)===128)}catch{}}var Us=Math.clz32?Math.clz32:x2,g2=Math.log,y2=Math.LN2;function x2(e){return e>>>=0,e===0?32:31-(g2(e)/y2|0)|0}var If=64,Rf=4194304;function yu(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Xp(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,i=e.pingedLanes,a=n&268435455;if(a!==0){var l=a&~s;l!==0?r=yu(l):(i&=a,i!==0&&(r=yu(i)))}else a=n&~s,a!==0?r=yu(a):i!==0&&(r=yu(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,i=t&-t,s>=i||s===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-Us(t),s=1<<n,r|=e[n],t&=~s;return r}function w2(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function b2(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes;0<i;){var a=31-Us(i),l=1<<a,c=s[a];c===-1?(!(l&n)||l&r)&&(s[a]=w2(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}}function cx(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function L_(){var e=If;return If<<=1,!(If&4194240)&&(If=64),e}function Ag(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Id(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Us(t),e[t]=n}function k2(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var s=31-Us(n),i=1<<s;t[s]=0,r[s]=-1,e[s]=-1,n&=~i}}function nb(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Us(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}var Qt=0;function O_(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var D_,rb,F_,z_,B_,ux=!1,Tf=[],Po=null,Io=null,Ro=null,Yu=new Map,Gu=new Map,So=[],v2="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function a0(e,t){switch(e){case"focusin":case"focusout":Po=null;break;case"dragenter":case"dragleave":Io=null;break;case"mouseover":case"mouseout":Ro=null;break;case"pointerover":case"pointerout":Yu.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Gu.delete(t.pointerId)}}function Qc(e,t,n,r,s,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[s]},t!==null&&(t=Td(t),t!==null&&rb(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function S2(e,t,n,r,s){switch(t){case"focusin":return Po=Qc(Po,e,t,n,r,s),!0;case"dragenter":return Io=Qc(Io,e,t,n,r,s),!0;case"mouseover":return Ro=Qc(Ro,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return Yu.set(i,Qc(Yu.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,Gu.set(i,Qc(Gu.get(i)||null,e,t,n,r,s)),!0}return!1}function H_(e){var t=ga(e.target);if(t!==null){var n=Ua(t);if(n!==null){if(t=n.tag,t===13){if(t=P_(n),t!==null){e.blockedOn=t,B_(e.priority,function(){F_(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Sp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=dx(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);ix=r,n.target.dispatchEvent(r),ix=null}else return t=Td(n),t!==null&&rb(t),e.blockedOn=n,!1;t.shift()}return!0}function l0(e,t,n){Sp(e)&&n.delete(t)}function N2(){ux=!1,Po!==null&&Sp(Po)&&(Po=null),Io!==null&&Sp(Io)&&(Io=null),Ro!==null&&Sp(Ro)&&(Ro=null),Yu.forEach(l0),Gu.forEach(l0)}function Zc(e,t){e.blockedOn===t&&(e.blockedOn=null,ux||(ux=!0,os.unstable_scheduleCallback(os.unstable_NormalPriority,N2)))}function Ju(e){function t(s){return Zc(s,e)}if(0<Tf.length){Zc(Tf[0],e);for(var n=1;n<Tf.length;n++){var r=Tf[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Po!==null&&Zc(Po,e),Io!==null&&Zc(Io,e),Ro!==null&&Zc(Ro,e),Yu.forEach(t),Gu.forEach(t),n=0;n<So.length;n++)r=So[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<So.length&&(n=So[0],n.blockedOn===null);)H_(n),n.blockedOn===null&&So.shift()}var Wl=to.ReactCurrentBatchConfig,Qp=!0;function j2(e,t,n,r){var s=Qt,i=Wl.transition;Wl.transition=null;try{Qt=1,sb(e,t,n,r)}finally{Qt=s,Wl.transition=i}}function C2(e,t,n,r){var s=Qt,i=Wl.transition;Wl.transition=null;try{Qt=4,sb(e,t,n,r)}finally{Qt=s,Wl.transition=i}}function sb(e,t,n,r){if(Qp){var s=dx(e,t,n,r);if(s===null)Fg(e,t,r,Zp,n),a0(e,r);else if(S2(s,e,t,n,r))r.stopPropagation();else if(a0(e,r),t&4&&-1<v2.indexOf(e)){for(;s!==null;){var i=Td(s);if(i!==null&&D_(i),i=dx(e,t,n,r),i===null&&Fg(e,t,r,Zp,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else Fg(e,t,r,null,n)}}var Zp=null;function dx(e,t,n,r){if(Zp=null,e=eb(r),e=ga(e),e!==null)if(t=Ua(e),t===null)e=null;else if(n=t.tag,n===13){if(e=P_(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Zp=e,null}function W_(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(p2()){case tb:return 1;case M_:return 4;case Jp:case h2:return 16;case $_:return 536870912;default:return 16}default:return 16}}var Co=null,ib=null,Np=null;function V_(){if(Np)return Np;var e,t=ib,n=t.length,r,s="value"in Co?Co.value:Co.textContent,i=s.length;for(e=0;e<n&&t[e]===s[e];e++);var a=n-e;for(r=1;r<=a&&t[n-r]===s[i-r];r++);return Np=s.slice(e,1<r?1-r:void 0)}function jp(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Mf(){return!0}function c0(){return!1}function cs(e){function t(n,r,s,i,a){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=i,this.target=a,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Mf:c0,this.isPropagationStopped=c0,this}return An(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Mf)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Mf)},persist:function(){},isPersistent:Mf}),t}var yc={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ob=cs(yc),Rd=An({},yc,{view:0,detail:0}),_2=cs(Rd),Pg,Ig,eu,tm=An({},Rd,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ab,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==eu&&(eu&&e.type==="mousemove"?(Pg=e.screenX-eu.screenX,Ig=e.screenY-eu.screenY):Ig=Pg=0,eu=e),Pg)},movementY:function(e){return"movementY"in e?e.movementY:Ig}}),u0=cs(tm),E2=An({},tm,{dataTransfer:0}),A2=cs(E2),P2=An({},Rd,{relatedTarget:0}),Rg=cs(P2),I2=An({},yc,{animationName:0,elapsedTime:0,pseudoElement:0}),R2=cs(I2),T2=An({},yc,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),M2=cs(T2),$2=An({},yc,{data:0}),d0=cs($2),L2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},O2={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},D2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function F2(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=D2[e])?!!t[e]:!1}function ab(){return F2}var z2=An({},Rd,{key:function(e){if(e.key){var t=L2[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=jp(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?O2[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ab,charCode:function(e){return e.type==="keypress"?jp(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?jp(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),B2=cs(z2),H2=An({},tm,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),f0=cs(H2),W2=An({},Rd,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ab}),V2=cs(W2),K2=An({},yc,{propertyName:0,elapsedTime:0,pseudoElement:0}),U2=cs(K2),q2=An({},tm,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Y2=cs(q2),G2=[9,13,27,32],lb=Gi&&"CompositionEvent"in window,_u=null;Gi&&"documentMode"in document&&(_u=document.documentMode);var J2=Gi&&"TextEvent"in window&&!_u,K_=Gi&&(!lb||_u&&8<_u&&11>=_u),p0=" ",h0=!1;function U_(e,t){switch(e){case"keyup":return G2.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function q_(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var jl=!1;function X2(e,t){switch(e){case"compositionend":return q_(t);case"keypress":return t.which!==32?null:(h0=!0,p0);case"textInput":return e=t.data,e===p0&&h0?null:e;default:return null}}function Q2(e,t){if(jl)return e==="compositionend"||!lb&&U_(e,t)?(e=V_(),Np=ib=Co=null,jl=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return K_&&t.locale!=="ko"?null:t.data;default:return null}}var Z2={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function m0(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Z2[e.type]:t==="textarea"}function Y_(e,t,n,r){j_(r),t=eh(t,"onChange"),0<t.length&&(n=new ob("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Eu=null,Xu=null;function eL(e){iE(e,0)}function nm(e){var t=El(e);if(x_(t))return e}function tL(e,t){if(e==="change")return t}var G_=!1;if(Gi){var Tg;if(Gi){var Mg="oninput"in document;if(!Mg){var g0=document.createElement("div");g0.setAttribute("oninput","return;"),Mg=typeof g0.oninput=="function"}Tg=Mg}else Tg=!1;G_=Tg&&(!document.documentMode||9<document.documentMode)}function y0(){Eu&&(Eu.detachEvent("onpropertychange",J_),Xu=Eu=null)}function J_(e){if(e.propertyName==="value"&&nm(Xu)){var t=[];Y_(t,Xu,e,eb(e)),A_(eL,t)}}function nL(e,t,n){e==="focusin"?(y0(),Eu=t,Xu=n,Eu.attachEvent("onpropertychange",J_)):e==="focusout"&&y0()}function rL(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return nm(Xu)}function sL(e,t){if(e==="click")return nm(t)}function iL(e,t){if(e==="input"||e==="change")return nm(t)}function oL(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Gs=typeof Object.is=="function"?Object.is:oL;function Qu(e,t){if(Gs(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var s=n[r];if(!qy.call(t,s)||!Gs(e[s],t[s]))return!1}return!0}function x0(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function w0(e,t){var n=x0(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=x0(n)}}function X_(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?X_(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Q_(){for(var e=window,t=qp();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=qp(e.document)}return t}function cb(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function aL(e){var t=Q_(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&X_(n.ownerDocument.documentElement,n)){if(r!==null&&cb(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!e.extend&&i>r&&(s=r,r=i,i=s),s=w0(n,i);var a=w0(n,r);s&&a&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var lL=Gi&&"documentMode"in document&&11>=document.documentMode,Cl=null,fx=null,Au=null,px=!1;function b0(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;px||Cl==null||Cl!==qp(r)||(r=Cl,"selectionStart"in r&&cb(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Au&&Qu(Au,r)||(Au=r,r=eh(fx,"onSelect"),0<r.length&&(t=new ob("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Cl)))}function $f(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var _l={animationend:$f("Animation","AnimationEnd"),animationiteration:$f("Animation","AnimationIteration"),animationstart:$f("Animation","AnimationStart"),transitionend:$f("Transition","TransitionEnd")},$g={},Z_={};Gi&&(Z_=document.createElement("div").style,"AnimationEvent"in window||(delete _l.animationend.animation,delete _l.animationiteration.animation,delete _l.animationstart.animation),"TransitionEvent"in window||delete _l.transitionend.transition);function rm(e){if($g[e])return $g[e];if(!_l[e])return e;var t=_l[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Z_)return $g[e]=t[n];return e}var eE=rm("animationend"),tE=rm("animationiteration"),nE=rm("animationstart"),rE=rm("transitionend"),sE=new Map,k0="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Yo(e,t){sE.set(e,t),Ka(t,[e])}for(var Lg=0;Lg<k0.length;Lg++){var Og=k0[Lg],cL=Og.toLowerCase(),uL=Og[0].toUpperCase()+Og.slice(1);Yo(cL,"on"+uL)}Yo(eE,"onAnimationEnd");Yo(tE,"onAnimationIteration");Yo(nE,"onAnimationStart");Yo("dblclick","onDoubleClick");Yo("focusin","onFocus");Yo("focusout","onBlur");Yo(rE,"onTransitionEnd");Zl("onMouseEnter",["mouseout","mouseover"]);Zl("onMouseLeave",["mouseout","mouseover"]);Zl("onPointerEnter",["pointerout","pointerover"]);Zl("onPointerLeave",["pointerout","pointerover"]);Ka("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Ka("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Ka("onBeforeInput",["compositionend","keypress","textInput","paste"]);Ka("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Ka("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Ka("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var xu="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),dL=new Set("cancel close invalid load scroll toggle".split(" ").concat(xu));function v0(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,c2(r,t,void 0,e),e.currentTarget=null}function iE(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],s=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var a=r.length-1;0<=a;a--){var l=r[a],c=l.instance,u=l.currentTarget;if(l=l.listener,c!==i&&s.isPropagationStopped())break e;v0(s,l,u),i=c}else for(a=0;a<r.length;a++){if(l=r[a],c=l.instance,u=l.currentTarget,l=l.listener,c!==i&&s.isPropagationStopped())break e;v0(s,l,u),i=c}}}if(Gp)throw e=lx,Gp=!1,lx=null,e}function mn(e,t){var n=t[xx];n===void 0&&(n=t[xx]=new Set);var r=e+"__bubble";n.has(r)||(oE(t,e,2,!1),n.add(r))}function Dg(e,t,n){var r=0;t&&(r|=4),oE(n,e,r,t)}var Lf="_reactListening"+Math.random().toString(36).slice(2);function Zu(e){if(!e[Lf]){e[Lf]=!0,p_.forEach(function(n){n!=="selectionchange"&&(dL.has(n)||Dg(n,!1,e),Dg(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Lf]||(t[Lf]=!0,Dg("selectionchange",!1,t))}}function oE(e,t,n,r){switch(W_(t)){case 1:var s=j2;break;case 4:s=C2;break;default:s=sb}n=s.bind(null,t,n,e),s=void 0,!ax||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),r?s!==void 0?e.addEventListener(t,n,{capture:!0,passive:s}):e.addEventListener(t,n,!0):s!==void 0?e.addEventListener(t,n,{passive:s}):e.addEventListener(t,n,!1)}function Fg(e,t,n,r,s){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var a=r.tag;if(a===3||a===4){var l=r.stateNode.containerInfo;if(l===s||l.nodeType===8&&l.parentNode===s)break;if(a===4)for(a=r.return;a!==null;){var c=a.tag;if((c===3||c===4)&&(c=a.stateNode.containerInfo,c===s||c.nodeType===8&&c.parentNode===s))return;a=a.return}for(;l!==null;){if(a=ga(l),a===null)return;if(c=a.tag,c===5||c===6){r=i=a;continue e}l=l.parentNode}}r=r.return}A_(function(){var u=i,f=eb(n),d=[];e:{var p=sE.get(e);if(p!==void 0){var h=ob,g=e;switch(e){case"keypress":if(jp(n)===0)break e;case"keydown":case"keyup":h=B2;break;case"focusin":g="focus",h=Rg;break;case"focusout":g="blur",h=Rg;break;case"beforeblur":case"afterblur":h=Rg;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":h=u0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=A2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=V2;break;case eE:case tE:case nE:h=R2;break;case rE:h=U2;break;case"scroll":h=_2;break;case"wheel":h=Y2;break;case"copy":case"cut":case"paste":h=M2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=f0}var k=(t&4)!==0,w=!k&&e==="scroll",y=k?p!==null?p+"Capture":null:p;k=[];for(var v=u,b;v!==null;){b=v;var C=b.stateNode;if(b.tag===5&&C!==null&&(b=C,y!==null&&(C=qu(v,y),C!=null&&k.push(ed(v,C,b)))),w)break;v=v.return}0<k.length&&(p=new h(p,g,null,n,f),d.push({event:p,listeners:k}))}}if(!(t&7)){e:{if(p=e==="mouseover"||e==="pointerover",h=e==="mouseout"||e==="pointerout",p&&n!==ix&&(g=n.relatedTarget||n.fromElement)&&(ga(g)||g[Ji]))break e;if((h||p)&&(p=f.window===f?f:(p=f.ownerDocument)?p.defaultView||p.parentWindow:window,h?(g=n.relatedTarget||n.toElement,h=u,g=g?ga(g):null,g!==null&&(w=Ua(g),g!==w||g.tag!==5&&g.tag!==6)&&(g=null)):(h=null,g=u),h!==g)){if(k=u0,C="onMouseLeave",y="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(k=f0,C="onPointerLeave",y="onPointerEnter",v="pointer"),w=h==null?p:El(h),b=g==null?p:El(g),p=new k(C,v+"leave",h,n,f),p.target=w,p.relatedTarget=b,C=null,ga(f)===u&&(k=new k(y,v+"enter",g,n,f),k.target=b,k.relatedTarget=w,C=k),w=C,h&&g)t:{for(k=h,y=g,v=0,b=k;b;b=dl(b))v++;for(b=0,C=y;C;C=dl(C))b++;for(;0<v-b;)k=dl(k),v--;for(;0<b-v;)y=dl(y),b--;for(;v--;){if(k===y||y!==null&&k===y.alternate)break t;k=dl(k),y=dl(y)}k=null}else k=null;h!==null&&S0(d,p,h,k,!1),g!==null&&w!==null&&S0(d,w,g,k,!0)}}e:{if(p=u?El(u):window,h=p.nodeName&&p.nodeName.toLowerCase(),h==="select"||h==="input"&&p.type==="file")var N=tL;else if(m0(p))if(G_)N=iL;else{N=rL;var j=nL}else(h=p.nodeName)&&h.toLowerCase()==="input"&&(p.type==="checkbox"||p.type==="radio")&&(N=sL);if(N&&(N=N(e,u))){Y_(d,N,n,f);break e}j&&j(e,p,u),e==="focusout"&&(j=p._wrapperState)&&j.controlled&&p.type==="number"&&ex(p,"number",p.value)}switch(j=u?El(u):window,e){case"focusin":(m0(j)||j.contentEditable==="true")&&(Cl=j,fx=u,Au=null);break;case"focusout":Au=fx=Cl=null;break;case"mousedown":px=!0;break;case"contextmenu":case"mouseup":case"dragend":px=!1,b0(d,n,f);break;case"selectionchange":if(lL)break;case"keydown":case"keyup":b0(d,n,f)}var A;if(lb)e:{switch(e){case"compositionstart":var I="onCompositionStart";break e;case"compositionend":I="onCompositionEnd";break e;case"compositionupdate":I="onCompositionUpdate";break e}I=void 0}else jl?U_(e,n)&&(I="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(I="onCompositionStart");I&&(K_&&n.locale!=="ko"&&(jl||I!=="onCompositionStart"?I==="onCompositionEnd"&&jl&&(A=V_()):(Co=f,ib="value"in Co?Co.value:Co.textContent,jl=!0)),j=eh(u,I),0<j.length&&(I=new d0(I,e,null,n,f),d.push({event:I,listeners:j}),A?I.data=A:(A=q_(n),A!==null&&(I.data=A)))),(A=J2?X2(e,n):Q2(e,n))&&(u=eh(u,"onBeforeInput"),0<u.length&&(f=new d0("onBeforeInput","beforeinput",null,n,f),d.push({event:f,listeners:u}),f.data=A))}iE(d,t)})}function ed(e,t,n){return{instance:e,listener:t,currentTarget:n}}function eh(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=qu(e,n),i!=null&&r.unshift(ed(e,i,s)),i=qu(e,t),i!=null&&r.push(ed(e,i,s))),e=e.return}return r}function dl(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function S0(e,t,n,r,s){for(var i=t._reactName,a=[];n!==null&&n!==r;){var l=n,c=l.alternate,u=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&u!==null&&(l=u,s?(c=qu(n,i),c!=null&&a.unshift(ed(n,c,l))):s||(c=qu(n,i),c!=null&&a.push(ed(n,c,l)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var fL=/\r\n?/g,pL=/\u0000|\uFFFD/g;function N0(e){return(typeof e=="string"?e:""+e).replace(fL,`
|
|
38
|
-
`).replace(pL,"")}function Of(e,t,n){if(t=N0(t),N0(e)!==t&&n)throw Error(Ne(425))}function th(){}var hx=null,mx=null;function gx(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var yx=typeof setTimeout=="function"?setTimeout:void 0,hL=typeof clearTimeout=="function"?clearTimeout:void 0,j0=typeof Promise=="function"?Promise:void 0,mL=typeof queueMicrotask=="function"?queueMicrotask:typeof j0<"u"?function(e){return j0.resolve(null).then(e).catch(gL)}:yx;function gL(e){setTimeout(function(){throw e})}function zg(e,t){var n=t,r=0;do{var s=n.nextSibling;if(e.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(r===0){e.removeChild(s),Ju(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);Ju(t)}function To(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function C0(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var xc=Math.random().toString(36).slice(2),ui="__reactFiber$"+xc,td="__reactProps$"+xc,Ji="__reactContainer$"+xc,xx="__reactEvents$"+xc,yL="__reactListeners$"+xc,xL="__reactHandles$"+xc;function ga(e){var t=e[ui];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Ji]||n[ui]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=C0(e);e!==null;){if(n=e[ui])return n;e=C0(e)}return t}e=n,n=e.parentNode}return null}function Td(e){return e=e[ui]||e[Ji],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function El(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(Ne(33))}function sm(e){return e[td]||null}var wx=[],Al=-1;function Go(e){return{current:e}}function yn(e){0>Al||(e.current=wx[Al],wx[Al]=null,Al--)}function cn(e,t){Al++,wx[Al]=e.current,e.current=t}var Bo={},br=Go(Bo),Hr=Go(!1),Ea=Bo;function ec(e,t){var n=e.type.contextTypes;if(!n)return Bo;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Wr(e){return e=e.childContextTypes,e!=null}function nh(){yn(Hr),yn(br)}function _0(e,t,n){if(br.current!==Bo)throw Error(Ne(168));cn(br,t),cn(Hr,n)}function aE(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(Ne(108,n2(e)||"Unknown",s));return An({},n,r)}function rh(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Bo,Ea=br.current,cn(br,e),cn(Hr,Hr.current),!0}function E0(e,t,n){var r=e.stateNode;if(!r)throw Error(Ne(169));n?(e=aE(e,t,Ea),r.__reactInternalMemoizedMergedChildContext=e,yn(Hr),yn(br),cn(br,e)):yn(Hr),cn(Hr,n)}var Di=null,im=!1,Bg=!1;function lE(e){Di===null?Di=[e]:Di.push(e)}function wL(e){im=!0,lE(e)}function Jo(){if(!Bg&&Di!==null){Bg=!0;var e=0,t=Qt;try{var n=Di;for(Qt=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Di=null,im=!1}catch(s){throw Di!==null&&(Di=Di.slice(e+1)),T_(tb,Jo),s}finally{Qt=t,Bg=!1}}return null}var Pl=[],Il=0,sh=null,ih=0,gs=[],ys=0,Aa=null,zi=1,Bi="";function ca(e,t){Pl[Il++]=ih,Pl[Il++]=sh,sh=e,ih=t}function cE(e,t,n){gs[ys++]=zi,gs[ys++]=Bi,gs[ys++]=Aa,Aa=e;var r=zi;e=Bi;var s=32-Us(r)-1;r&=~(1<<s),n+=1;var i=32-Us(t)+s;if(30<i){var a=s-s%5;i=(r&(1<<a)-1).toString(32),r>>=a,s-=a,zi=1<<32-Us(t)+s|n<<s|r,Bi=i+e}else zi=1<<i|n<<s|r,Bi=e}function ub(e){e.return!==null&&(ca(e,1),cE(e,1,0))}function db(e){for(;e===sh;)sh=Pl[--Il],Pl[Il]=null,ih=Pl[--Il],Pl[Il]=null;for(;e===Aa;)Aa=gs[--ys],gs[ys]=null,Bi=gs[--ys],gs[ys]=null,zi=gs[--ys],gs[ys]=null}var ss=null,ns=null,wn=!1,Bs=null;function uE(e,t){var n=bs(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function A0(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,ss=e,ns=To(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,ss=e,ns=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Aa!==null?{id:zi,overflow:Bi}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=bs(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,ss=e,ns=null,!0):!1;default:return!1}}function bx(e){return(e.mode&1)!==0&&(e.flags&128)===0}function kx(e){if(wn){var t=ns;if(t){var n=t;if(!A0(e,t)){if(bx(e))throw Error(Ne(418));t=To(n.nextSibling);var r=ss;t&&A0(e,t)?uE(r,n):(e.flags=e.flags&-4097|2,wn=!1,ss=e)}}else{if(bx(e))throw Error(Ne(418));e.flags=e.flags&-4097|2,wn=!1,ss=e}}}function P0(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;ss=e}function Df(e){if(e!==ss)return!1;if(!wn)return P0(e),wn=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!gx(e.type,e.memoizedProps)),t&&(t=ns)){if(bx(e))throw dE(),Error(Ne(418));for(;t;)uE(e,t),t=To(t.nextSibling)}if(P0(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Ne(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){ns=To(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}ns=null}}else ns=ss?To(e.stateNode.nextSibling):null;return!0}function dE(){for(var e=ns;e;)e=To(e.nextSibling)}function tc(){ns=ss=null,wn=!1}function fb(e){Bs===null?Bs=[e]:Bs.push(e)}var bL=to.ReactCurrentBatchConfig;function tu(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(Ne(309));var r=n.stateNode}if(!r)throw Error(Ne(147,e));var s=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(a){var l=s.refs;a===null?delete l[i]:l[i]=a},t._stringRef=i,t)}if(typeof e!="string")throw Error(Ne(284));if(!n._owner)throw Error(Ne(290,e))}return e}function Ff(e,t){throw e=Object.prototype.toString.call(t),Error(Ne(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function I0(e){var t=e._init;return t(e._payload)}function fE(e){function t(y,v){if(e){var b=y.deletions;b===null?(y.deletions=[v],y.flags|=16):b.push(v)}}function n(y,v){if(!e)return null;for(;v!==null;)t(y,v),v=v.sibling;return null}function r(y,v){for(y=new Map;v!==null;)v.key!==null?y.set(v.key,v):y.set(v.index,v),v=v.sibling;return y}function s(y,v){return y=Oo(y,v),y.index=0,y.sibling=null,y}function i(y,v,b){return y.index=b,e?(b=y.alternate,b!==null?(b=b.index,b<v?(y.flags|=2,v):b):(y.flags|=2,v)):(y.flags|=1048576,v)}function a(y){return e&&y.alternate===null&&(y.flags|=2),y}function l(y,v,b,C){return v===null||v.tag!==6?(v=Yg(b,y.mode,C),v.return=y,v):(v=s(v,b),v.return=y,v)}function c(y,v,b,C){var N=b.type;return N===Nl?f(y,v,b.props.children,C,b.key):v!==null&&(v.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===bo&&I0(N)===v.type)?(C=s(v,b.props),C.ref=tu(y,v,b),C.return=y,C):(C=Rp(b.type,b.key,b.props,null,y.mode,C),C.ref=tu(y,v,b),C.return=y,C)}function u(y,v,b,C){return v===null||v.tag!==4||v.stateNode.containerInfo!==b.containerInfo||v.stateNode.implementation!==b.implementation?(v=Gg(b,y.mode,C),v.return=y,v):(v=s(v,b.children||[]),v.return=y,v)}function f(y,v,b,C,N){return v===null||v.tag!==7?(v=va(b,y.mode,C,N),v.return=y,v):(v=s(v,b),v.return=y,v)}function d(y,v,b){if(typeof v=="string"&&v!==""||typeof v=="number")return v=Yg(""+v,y.mode,b),v.return=y,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Ef:return b=Rp(v.type,v.key,v.props,null,y.mode,b),b.ref=tu(y,null,v),b.return=y,b;case Sl:return v=Gg(v,y.mode,b),v.return=y,v;case bo:var C=v._init;return d(y,C(v._payload),b)}if(gu(v)||Jc(v))return v=va(v,y.mode,b,null),v.return=y,v;Ff(y,v)}return null}function p(y,v,b,C){var N=v!==null?v.key:null;if(typeof b=="string"&&b!==""||typeof b=="number")return N!==null?null:l(y,v,""+b,C);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case Ef:return b.key===N?c(y,v,b,C):null;case Sl:return b.key===N?u(y,v,b,C):null;case bo:return N=b._init,p(y,v,N(b._payload),C)}if(gu(b)||Jc(b))return N!==null?null:f(y,v,b,C,null);Ff(y,b)}return null}function h(y,v,b,C,N){if(typeof C=="string"&&C!==""||typeof C=="number")return y=y.get(b)||null,l(v,y,""+C,N);if(typeof C=="object"&&C!==null){switch(C.$$typeof){case Ef:return y=y.get(C.key===null?b:C.key)||null,c(v,y,C,N);case Sl:return y=y.get(C.key===null?b:C.key)||null,u(v,y,C,N);case bo:var j=C._init;return h(y,v,b,j(C._payload),N)}if(gu(C)||Jc(C))return y=y.get(b)||null,f(v,y,C,N,null);Ff(v,C)}return null}function g(y,v,b,C){for(var N=null,j=null,A=v,I=v=0,D=null;A!==null&&I<b.length;I++){A.index>I?(D=A,A=null):D=A.sibling;var H=p(y,A,b[I],C);if(H===null){A===null&&(A=D);break}e&&A&&H.alternate===null&&t(y,A),v=i(H,v,I),j===null?N=H:j.sibling=H,j=H,A=D}if(I===b.length)return n(y,A),wn&&ca(y,I),N;if(A===null){for(;I<b.length;I++)A=d(y,b[I],C),A!==null&&(v=i(A,v,I),j===null?N=A:j.sibling=A,j=A);return wn&&ca(y,I),N}for(A=r(y,A);I<b.length;I++)D=h(A,y,I,b[I],C),D!==null&&(e&&D.alternate!==null&&A.delete(D.key===null?I:D.key),v=i(D,v,I),j===null?N=D:j.sibling=D,j=D);return e&&A.forEach(function(V){return t(y,V)}),wn&&ca(y,I),N}function k(y,v,b,C){var N=Jc(b);if(typeof N!="function")throw Error(Ne(150));if(b=N.call(b),b==null)throw Error(Ne(151));for(var j=N=null,A=v,I=v=0,D=null,H=b.next();A!==null&&!H.done;I++,H=b.next()){A.index>I?(D=A,A=null):D=A.sibling;var V=p(y,A,H.value,C);if(V===null){A===null&&(A=D);break}e&&A&&V.alternate===null&&t(y,A),v=i(V,v,I),j===null?N=V:j.sibling=V,j=V,A=D}if(H.done)return n(y,A),wn&&ca(y,I),N;if(A===null){for(;!H.done;I++,H=b.next())H=d(y,H.value,C),H!==null&&(v=i(H,v,I),j===null?N=H:j.sibling=H,j=H);return wn&&ca(y,I),N}for(A=r(y,A);!H.done;I++,H=b.next())H=h(A,y,I,H.value,C),H!==null&&(e&&H.alternate!==null&&A.delete(H.key===null?I:H.key),v=i(H,v,I),j===null?N=H:j.sibling=H,j=H);return e&&A.forEach(function(F){return t(y,F)}),wn&&ca(y,I),N}function w(y,v,b,C){if(typeof b=="object"&&b!==null&&b.type===Nl&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case Ef:e:{for(var N=b.key,j=v;j!==null;){if(j.key===N){if(N=b.type,N===Nl){if(j.tag===7){n(y,j.sibling),v=s(j,b.props.children),v.return=y,y=v;break e}}else if(j.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===bo&&I0(N)===j.type){n(y,j.sibling),v=s(j,b.props),v.ref=tu(y,j,b),v.return=y,y=v;break e}n(y,j);break}else t(y,j);j=j.sibling}b.type===Nl?(v=va(b.props.children,y.mode,C,b.key),v.return=y,y=v):(C=Rp(b.type,b.key,b.props,null,y.mode,C),C.ref=tu(y,v,b),C.return=y,y=C)}return a(y);case Sl:e:{for(j=b.key;v!==null;){if(v.key===j)if(v.tag===4&&v.stateNode.containerInfo===b.containerInfo&&v.stateNode.implementation===b.implementation){n(y,v.sibling),v=s(v,b.children||[]),v.return=y,y=v;break e}else{n(y,v);break}else t(y,v);v=v.sibling}v=Gg(b,y.mode,C),v.return=y,y=v}return a(y);case bo:return j=b._init,w(y,v,j(b._payload),C)}if(gu(b))return g(y,v,b,C);if(Jc(b))return k(y,v,b,C);Ff(y,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,v!==null&&v.tag===6?(n(y,v.sibling),v=s(v,b),v.return=y,y=v):(n(y,v),v=Yg(b,y.mode,C),v.return=y,y=v),a(y)):n(y,v)}return w}var nc=fE(!0),pE=fE(!1),oh=Go(null),ah=null,Rl=null,pb=null;function hb(){pb=Rl=ah=null}function mb(e){var t=oh.current;yn(oh),e._currentValue=t}function vx(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Vl(e,t){ah=e,pb=Rl=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Fr=!0),e.firstContext=null)}function vs(e){var t=e._currentValue;if(pb!==e)if(e={context:e,memoizedValue:t,next:null},Rl===null){if(ah===null)throw Error(Ne(308));Rl=e,ah.dependencies={lanes:0,firstContext:e}}else Rl=Rl.next=e;return t}var ya=null;function gb(e){ya===null?ya=[e]:ya.push(e)}function hE(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,gb(t)):(n.next=s.next,s.next=n),t.interleaved=n,Xi(e,r)}function Xi(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var ko=!1;function yb(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function mE(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Ui(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Mo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Dt&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,Xi(e,n)}return s=r.interleaved,s===null?(t.next=t,gb(r)):(t.next=s.next,s.next=t),r.interleaved=t,Xi(e,n)}function Cp(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,nb(e,n)}}function R0(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=a:i=i.next=a,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function lh(e,t,n,r){var s=e.updateQueue;ko=!1;var i=s.firstBaseUpdate,a=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,u=c.next;c.next=null,a===null?i=u:a.next=u,a=c;var f=e.alternate;f!==null&&(f=f.updateQueue,l=f.lastBaseUpdate,l!==a&&(l===null?f.firstBaseUpdate=u:l.next=u,f.lastBaseUpdate=c))}if(i!==null){var d=s.baseState;a=0,f=u=c=null,l=i;do{var p=l.lane,h=l.eventTime;if((r&p)===p){f!==null&&(f=f.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var g=e,k=l;switch(p=t,h=n,k.tag){case 1:if(g=k.payload,typeof g=="function"){d=g.call(h,d,p);break e}d=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=k.payload,p=typeof g=="function"?g.call(h,d,p):g,p==null)break e;d=An({},d,p);break e;case 2:ko=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,p=s.effects,p===null?s.effects=[l]:p.push(l))}else h={eventTime:h,lane:p,tag:l.tag,payload:l.payload,callback:l.callback,next:null},f===null?(u=f=h,c=d):f=f.next=h,a|=p;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;p=l,l=p.next,p.next=null,s.lastBaseUpdate=p,s.shared.pending=null}}while(!0);if(f===null&&(c=d),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=f,t=s.shared.interleaved,t!==null){s=t;do a|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);Ia|=a,e.lanes=a,e.memoizedState=d}}function T0(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],s=r.callback;if(s!==null){if(r.callback=null,r=n,typeof s!="function")throw Error(Ne(191,s));s.call(r)}}}var Md={},yi=Go(Md),nd=Go(Md),rd=Go(Md);function xa(e){if(e===Md)throw Error(Ne(174));return e}function xb(e,t){switch(cn(rd,t),cn(nd,e),cn(yi,Md),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:nx(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=nx(t,e)}yn(yi),cn(yi,t)}function rc(){yn(yi),yn(nd),yn(rd)}function gE(e){xa(rd.current);var t=xa(yi.current),n=nx(t,e.type);t!==n&&(cn(nd,e),cn(yi,n))}function wb(e){nd.current===e&&(yn(yi),yn(nd))}var Cn=Go(0);function ch(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Hg=[];function bb(){for(var e=0;e<Hg.length;e++)Hg[e]._workInProgressVersionPrimary=null;Hg.length=0}var _p=to.ReactCurrentDispatcher,Wg=to.ReactCurrentBatchConfig,Pa=0,En=null,Jn=null,nr=null,uh=!1,Pu=!1,sd=0,kL=0;function mr(){throw Error(Ne(321))}function kb(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Gs(e[n],t[n]))return!1;return!0}function vb(e,t,n,r,s,i){if(Pa=i,En=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,_p.current=e===null||e.memoizedState===null?jL:CL,e=n(r,s),Pu){i=0;do{if(Pu=!1,sd=0,25<=i)throw Error(Ne(301));i+=1,nr=Jn=null,t.updateQueue=null,_p.current=_L,e=n(r,s)}while(Pu)}if(_p.current=dh,t=Jn!==null&&Jn.next!==null,Pa=0,nr=Jn=En=null,uh=!1,t)throw Error(Ne(300));return e}function Sb(){var e=sd!==0;return sd=0,e}function oi(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return nr===null?En.memoizedState=nr=e:nr=nr.next=e,nr}function Ss(){if(Jn===null){var e=En.alternate;e=e!==null?e.memoizedState:null}else e=Jn.next;var t=nr===null?En.memoizedState:nr.next;if(t!==null)nr=t,Jn=e;else{if(e===null)throw Error(Ne(310));Jn=e,e={memoizedState:Jn.memoizedState,baseState:Jn.baseState,baseQueue:Jn.baseQueue,queue:Jn.queue,next:null},nr===null?En.memoizedState=nr=e:nr=nr.next=e}return nr}function id(e,t){return typeof t=="function"?t(e):t}function Vg(e){var t=Ss(),n=t.queue;if(n===null)throw Error(Ne(311));n.lastRenderedReducer=e;var r=Jn,s=r.baseQueue,i=n.pending;if(i!==null){if(s!==null){var a=s.next;s.next=i.next,i.next=a}r.baseQueue=s=i,n.pending=null}if(s!==null){i=s.next,r=r.baseState;var l=a=null,c=null,u=i;do{var f=u.lane;if((Pa&f)===f)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var d={lane:f,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=d,a=r):c=c.next=d,En.lanes|=f,Ia|=f}u=u.next}while(u!==null&&u!==i);c===null?a=r:c.next=l,Gs(r,t.memoizedState)||(Fr=!0),t.memoizedState=r,t.baseState=a,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){s=e;do i=s.lane,En.lanes|=i,Ia|=i,s=s.next;while(s!==e)}else s===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Kg(e){var t=Ss(),n=t.queue;if(n===null)throw Error(Ne(311));n.lastRenderedReducer=e;var r=n.dispatch,s=n.pending,i=t.memoizedState;if(s!==null){n.pending=null;var a=s=s.next;do i=e(i,a.action),a=a.next;while(a!==s);Gs(i,t.memoizedState)||(Fr=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function yE(){}function xE(e,t){var n=En,r=Ss(),s=t(),i=!Gs(r.memoizedState,s);if(i&&(r.memoizedState=s,Fr=!0),r=r.queue,Nb(kE.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||nr!==null&&nr.memoizedState.tag&1){if(n.flags|=2048,od(9,bE.bind(null,n,r,s,t),void 0,null),sr===null)throw Error(Ne(349));Pa&30||wE(n,t,s)}return s}function wE(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=En.updateQueue,t===null?(t={lastEffect:null,stores:null},En.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function bE(e,t,n,r){t.value=n,t.getSnapshot=r,vE(t)&&SE(e)}function kE(e,t,n){return n(function(){vE(t)&&SE(e)})}function vE(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Gs(e,n)}catch{return!0}}function SE(e){var t=Xi(e,1);t!==null&&qs(t,e,1,-1)}function M0(e){var t=oi();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:id,lastRenderedState:e},t.queue=e,e=e.dispatch=NL.bind(null,En,e),[t.memoizedState,e]}function od(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=En.updateQueue,t===null?(t={lastEffect:null,stores:null},En.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function NE(){return Ss().memoizedState}function Ep(e,t,n,r){var s=oi();En.flags|=e,s.memoizedState=od(1|t,n,void 0,r===void 0?null:r)}function om(e,t,n,r){var s=Ss();r=r===void 0?null:r;var i=void 0;if(Jn!==null){var a=Jn.memoizedState;if(i=a.destroy,r!==null&&kb(r,a.deps)){s.memoizedState=od(t,n,i,r);return}}En.flags|=e,s.memoizedState=od(1|t,n,i,r)}function $0(e,t){return Ep(8390656,8,e,t)}function Nb(e,t){return om(2048,8,e,t)}function jE(e,t){return om(4,2,e,t)}function CE(e,t){return om(4,4,e,t)}function _E(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function EE(e,t,n){return n=n!=null?n.concat([e]):null,om(4,4,_E.bind(null,t,e),n)}function jb(){}function AE(e,t){var n=Ss();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&kb(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function PE(e,t){var n=Ss();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&kb(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function IE(e,t,n){return Pa&21?(Gs(n,t)||(n=L_(),En.lanes|=n,Ia|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Fr=!0),e.memoizedState=n)}function vL(e,t){var n=Qt;Qt=n!==0&&4>n?n:4,e(!0);var r=Wg.transition;Wg.transition={};try{e(!1),t()}finally{Qt=n,Wg.transition=r}}function RE(){return Ss().memoizedState}function SL(e,t,n){var r=Lo(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},TE(e))ME(t,n);else if(n=hE(e,t,n,r),n!==null){var s=Er();qs(n,e,r,s),$E(n,t,r)}}function NL(e,t,n){var r=Lo(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(TE(e))ME(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var a=t.lastRenderedState,l=i(a,n);if(s.hasEagerState=!0,s.eagerState=l,Gs(l,a)){var c=t.interleaved;c===null?(s.next=s,gb(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}n=hE(e,t,s,r),n!==null&&(s=Er(),qs(n,e,r,s),$E(n,t,r))}}function TE(e){var t=e.alternate;return e===En||t!==null&&t===En}function ME(e,t){Pu=uh=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function $E(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,nb(e,n)}}var dh={readContext:vs,useCallback:mr,useContext:mr,useEffect:mr,useImperativeHandle:mr,useInsertionEffect:mr,useLayoutEffect:mr,useMemo:mr,useReducer:mr,useRef:mr,useState:mr,useDebugValue:mr,useDeferredValue:mr,useTransition:mr,useMutableSource:mr,useSyncExternalStore:mr,useId:mr,unstable_isNewReconciler:!1},jL={readContext:vs,useCallback:function(e,t){return oi().memoizedState=[e,t===void 0?null:t],e},useContext:vs,useEffect:$0,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Ep(4194308,4,_E.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ep(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ep(4,2,e,t)},useMemo:function(e,t){var n=oi();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=oi();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=SL.bind(null,En,e),[r.memoizedState,e]},useRef:function(e){var t=oi();return e={current:e},t.memoizedState=e},useState:M0,useDebugValue:jb,useDeferredValue:function(e){return oi().memoizedState=e},useTransition:function(){var e=M0(!1),t=e[0];return e=vL.bind(null,e[1]),oi().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=En,s=oi();if(wn){if(n===void 0)throw Error(Ne(407));n=n()}else{if(n=t(),sr===null)throw Error(Ne(349));Pa&30||wE(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,$0(kE.bind(null,r,i,e),[e]),r.flags|=2048,od(9,bE.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=oi(),t=sr.identifierPrefix;if(wn){var n=Bi,r=zi;n=(r&~(1<<32-Us(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=sd++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=kL++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},CL={readContext:vs,useCallback:AE,useContext:vs,useEffect:Nb,useImperativeHandle:EE,useInsertionEffect:jE,useLayoutEffect:CE,useMemo:PE,useReducer:Vg,useRef:NE,useState:function(){return Vg(id)},useDebugValue:jb,useDeferredValue:function(e){var t=Ss();return IE(t,Jn.memoizedState,e)},useTransition:function(){var e=Vg(id)[0],t=Ss().memoizedState;return[e,t]},useMutableSource:yE,useSyncExternalStore:xE,useId:RE,unstable_isNewReconciler:!1},_L={readContext:vs,useCallback:AE,useContext:vs,useEffect:Nb,useImperativeHandle:EE,useInsertionEffect:jE,useLayoutEffect:CE,useMemo:PE,useReducer:Kg,useRef:NE,useState:function(){return Kg(id)},useDebugValue:jb,useDeferredValue:function(e){var t=Ss();return Jn===null?t.memoizedState=e:IE(t,Jn.memoizedState,e)},useTransition:function(){var e=Kg(id)[0],t=Ss().memoizedState;return[e,t]},useMutableSource:yE,useSyncExternalStore:xE,useId:RE,unstable_isNewReconciler:!1};function Ds(e,t){if(e&&e.defaultProps){t=An({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Sx(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:An({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var am={isMounted:function(e){return(e=e._reactInternals)?Ua(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Er(),s=Lo(e),i=Ui(r,s);i.payload=t,n!=null&&(i.callback=n),t=Mo(e,i,s),t!==null&&(qs(t,e,s,r),Cp(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Er(),s=Lo(e),i=Ui(r,s);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Mo(e,i,s),t!==null&&(qs(t,e,s,r),Cp(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Er(),r=Lo(e),s=Ui(n,r);s.tag=2,t!=null&&(s.callback=t),t=Mo(e,s,r),t!==null&&(qs(t,e,r,n),Cp(t,e,r))}};function L0(e,t,n,r,s,i,a){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,a):t.prototype&&t.prototype.isPureReactComponent?!Qu(n,r)||!Qu(s,i):!0}function LE(e,t,n){var r=!1,s=Bo,i=t.contextType;return typeof i=="object"&&i!==null?i=vs(i):(s=Wr(t)?Ea:br.current,r=t.contextTypes,i=(r=r!=null)?ec(e,s):Bo),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=am,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=i),t}function O0(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&am.enqueueReplaceState(t,t.state,null)}function Nx(e,t,n,r){var s=e.stateNode;s.props=n,s.state=e.memoizedState,s.refs={},yb(e);var i=t.contextType;typeof i=="object"&&i!==null?s.context=vs(i):(i=Wr(t)?Ea:br.current,s.context=ec(e,i)),s.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Sx(e,t,i,n),s.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(t=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),t!==s.state&&am.enqueueReplaceState(s,s.state,null),lh(e,n,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function sc(e,t){try{var n="",r=t;do n+=t2(r),r=r.return;while(r);var s=n}catch(i){s=`
|
|
39
|
-
Error generating stack: `+i.message+`
|
|
40
|
-
`+i.stack}return{value:e,source:t,stack:s,digest:null}}function Ug(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function jx(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var EL=typeof WeakMap=="function"?WeakMap:Map;function OE(e,t,n){n=Ui(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){ph||(ph=!0,$x=r),jx(e,t)},n}function DE(e,t,n){n=Ui(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var s=t.value;n.payload=function(){return r(s)},n.callback=function(){jx(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){jx(e,t),typeof r!="function"&&($o===null?$o=new Set([this]):$o.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function D0(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new EL;var s=new Set;r.set(t,s)}else s=r.get(t),s===void 0&&(s=new Set,r.set(t,s));s.has(n)||(s.add(n),e=HL.bind(null,e,t,n),t.then(e,e))}function F0(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function z0(e,t,n,r,s){return e.mode&1?(e.flags|=65536,e.lanes=s,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Ui(-1,1),t.tag=2,Mo(n,t,1))),n.lanes|=1),e)}var AL=to.ReactCurrentOwner,Fr=!1;function _r(e,t,n,r){t.child=e===null?pE(t,null,n,r):nc(t,e.child,n,r)}function B0(e,t,n,r,s){n=n.render;var i=t.ref;return Vl(t,s),r=vb(e,t,n,r,i,s),n=Sb(),e!==null&&!Fr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Qi(e,t,s)):(wn&&n&&ub(t),t.flags|=1,_r(e,t,r,s),t.child)}function H0(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!Tb(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,FE(e,t,i,r,s)):(e=Rp(n.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&s)){var a=i.memoizedProps;if(n=n.compare,n=n!==null?n:Qu,n(a,r)&&e.ref===t.ref)return Qi(e,t,s)}return t.flags|=1,e=Oo(i,r),e.ref=t.ref,e.return=t,t.child=e}function FE(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(Qu(i,r)&&e.ref===t.ref)if(Fr=!1,t.pendingProps=r=i,(e.lanes&s)!==0)e.flags&131072&&(Fr=!0);else return t.lanes=e.lanes,Qi(e,t,s)}return Cx(e,t,n,r,s)}function zE(e,t,n){var r=t.pendingProps,s=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},cn(Ml,Zr),Zr|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,cn(Ml,Zr),Zr|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,cn(Ml,Zr),Zr|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,cn(Ml,Zr),Zr|=r;return _r(e,t,s,n),t.child}function BE(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Cx(e,t,n,r,s){var i=Wr(n)?Ea:br.current;return i=ec(t,i),Vl(t,s),n=vb(e,t,n,r,i,s),r=Sb(),e!==null&&!Fr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Qi(e,t,s)):(wn&&r&&ub(t),t.flags|=1,_r(e,t,n,s),t.child)}function W0(e,t,n,r,s){if(Wr(n)){var i=!0;rh(t)}else i=!1;if(Vl(t,s),t.stateNode===null)Ap(e,t),LE(t,n,r),Nx(t,n,r,s),r=!0;else if(e===null){var a=t.stateNode,l=t.memoizedProps;a.props=l;var c=a.context,u=n.contextType;typeof u=="object"&&u!==null?u=vs(u):(u=Wr(n)?Ea:br.current,u=ec(t,u));var f=n.getDerivedStateFromProps,d=typeof f=="function"||typeof a.getSnapshotBeforeUpdate=="function";d||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==r||c!==u)&&O0(t,a,r,u),ko=!1;var p=t.memoizedState;a.state=p,lh(t,r,a,s),c=t.memoizedState,l!==r||p!==c||Hr.current||ko?(typeof f=="function"&&(Sx(t,n,f,r),c=t.memoizedState),(l=ko||L0(t,n,l,r,p,c,u))?(d||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),a.props=r,a.state=c,a.context=u,r=l):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,mE(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:Ds(t.type,l),a.props=u,d=t.pendingProps,p=a.context,c=n.contextType,typeof c=="object"&&c!==null?c=vs(c):(c=Wr(n)?Ea:br.current,c=ec(t,c));var h=n.getDerivedStateFromProps;(f=typeof h=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==d||p!==c)&&O0(t,a,r,c),ko=!1,p=t.memoizedState,a.state=p,lh(t,r,a,s);var g=t.memoizedState;l!==d||p!==g||Hr.current||ko?(typeof h=="function"&&(Sx(t,n,h,r),g=t.memoizedState),(u=ko||L0(t,n,u,r,p,g,c)||!1)?(f||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,g,c),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,g,c)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=g),a.props=r,a.state=g,a.context=c,r=u):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),r=!1)}return _x(e,t,n,r,i,s)}function _x(e,t,n,r,s,i){BE(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return s&&E0(t,n,!1),Qi(e,t,i);r=t.stateNode,AL.current=t;var l=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=nc(t,e.child,null,i),t.child=nc(t,null,l,i)):_r(e,t,l,i),t.memoizedState=r.state,s&&E0(t,n,!0),t.child}function HE(e){var t=e.stateNode;t.pendingContext?_0(e,t.pendingContext,t.pendingContext!==t.context):t.context&&_0(e,t.context,!1),xb(e,t.containerInfo)}function V0(e,t,n,r,s){return tc(),fb(s),t.flags|=256,_r(e,t,n,r),t.child}var Ex={dehydrated:null,treeContext:null,retryLane:0};function Ax(e){return{baseLanes:e,cachePool:null,transitions:null}}function WE(e,t,n){var r=t.pendingProps,s=Cn.current,i=!1,a=(t.flags&128)!==0,l;if((l=a)||(l=e!==null&&e.memoizedState===null?!1:(s&2)!==0),l?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),cn(Cn,s&1),e===null)return kx(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(a=r.children,e=r.fallback,i?(r=t.mode,i=t.child,a={mode:"hidden",children:a},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=a):i=um(a,r,0,null),e=va(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Ax(n),t.memoizedState=Ex,e):Cb(t,a));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return PL(e,t,a,r,l,s,n);if(i){i=r.fallback,a=t.mode,s=e.child,l=s.sibling;var c={mode:"hidden",children:r.children};return!(a&1)&&t.child!==s?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Oo(s,c),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?i=Oo(l,i):(i=va(i,a,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,a=e.child.memoizedState,a=a===null?Ax(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=e.childLanes&~n,t.memoizedState=Ex,r}return i=e.child,e=i.sibling,r=Oo(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Cb(e,t){return t=um({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function zf(e,t,n,r){return r!==null&&fb(r),nc(t,e.child,null,n),e=Cb(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function PL(e,t,n,r,s,i,a){if(n)return t.flags&256?(t.flags&=-257,r=Ug(Error(Ne(422))),zf(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,s=t.mode,r=um({mode:"visible",children:r.children},s,0,null),i=va(i,s,a,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&nc(t,e.child,null,a),t.child.memoizedState=Ax(a),t.memoizedState=Ex,i);if(!(t.mode&1))return zf(e,t,a,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(Ne(419)),r=Ug(i,r,void 0),zf(e,t,a,r)}if(l=(a&e.childLanes)!==0,Fr||l){if(r=sr,r!==null){switch(a&-a){case 4:s=2;break;case 16:s=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|a)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,Xi(e,s),qs(r,e,s,-1))}return Rb(),r=Ug(Error(Ne(421))),zf(e,t,a,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=WL.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,ns=To(s.nextSibling),ss=t,wn=!0,Bs=null,e!==null&&(gs[ys++]=zi,gs[ys++]=Bi,gs[ys++]=Aa,zi=e.id,Bi=e.overflow,Aa=t),t=Cb(t,r.children),t.flags|=4096,t)}function K0(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),vx(e.return,t,n)}function qg(e,t,n,r,s){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=s)}function VE(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;if(_r(e,t,r.children,n),r=Cn.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&K0(e,n,t);else if(e.tag===19)K0(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(cn(Cn,r),!(t.mode&1))t.memoizedState=null;else switch(s){case"forwards":for(n=t.child,s=null;n!==null;)e=n.alternate,e!==null&&ch(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),qg(t,!1,s,n,i);break;case"backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&ch(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}qg(t,!0,n,null,i);break;case"together":qg(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Ap(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Qi(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ia|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(Ne(153));if(t.child!==null){for(e=t.child,n=Oo(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Oo(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function IL(e,t,n){switch(t.tag){case 3:HE(t),tc();break;case 5:gE(t);break;case 1:Wr(t.type)&&rh(t);break;case 4:xb(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;cn(oh,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(cn(Cn,Cn.current&1),t.flags|=128,null):n&t.child.childLanes?WE(e,t,n):(cn(Cn,Cn.current&1),e=Qi(e,t,n),e!==null?e.sibling:null);cn(Cn,Cn.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return VE(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),cn(Cn,Cn.current),r)break;return null;case 22:case 23:return t.lanes=0,zE(e,t,n)}return Qi(e,t,n)}var KE,Px,UE,qE;KE=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Px=function(){};UE=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,xa(yi.current);var i=null;switch(n){case"input":s=Qy(e,s),r=Qy(e,r),i=[];break;case"select":s=An({},s,{value:void 0}),r=An({},r,{value:void 0}),i=[];break;case"textarea":s=tx(e,s),r=tx(e,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=th)}rx(n,r);var a;n=null;for(u in s)if(!r.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var l=s[u];for(a in l)l.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Ku.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var c=r[u];if(l=s!=null?s[u]:void 0,r.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(a in l)!l.hasOwnProperty(a)||c&&c.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in c)c.hasOwnProperty(a)&&l[a]!==c[a]&&(n||(n={}),n[a]=c[a])}else n||(i||(i=[]),i.push(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(i=i||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Ku.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&mn("scroll",e),i||l===c||(i=[])):(i=i||[]).push(u,c))}n&&(i=i||[]).push("style",n);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};qE=function(e,t,n,r){n!==r&&(t.flags|=4)};function nu(e,t){if(!wn)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function gr(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function RL(e,t,n){var r=t.pendingProps;switch(db(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return gr(t),null;case 1:return Wr(t.type)&&nh(),gr(t),null;case 3:return r=t.stateNode,rc(),yn(Hr),yn(br),bb(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Df(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Bs!==null&&(Dx(Bs),Bs=null))),Px(e,t),gr(t),null;case 5:wb(t);var s=xa(rd.current);if(n=t.type,e!==null&&t.stateNode!=null)UE(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(Ne(166));return gr(t),null}if(e=xa(yi.current),Df(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[ui]=t,r[td]=i,e=(t.mode&1)!==0,n){case"dialog":mn("cancel",r),mn("close",r);break;case"iframe":case"object":case"embed":mn("load",r);break;case"video":case"audio":for(s=0;s<xu.length;s++)mn(xu[s],r);break;case"source":mn("error",r);break;case"img":case"image":case"link":mn("error",r),mn("load",r);break;case"details":mn("toggle",r);break;case"input":e0(r,i),mn("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},mn("invalid",r);break;case"textarea":n0(r,i),mn("invalid",r)}rx(n,i),s=null;for(var a in i)if(i.hasOwnProperty(a)){var l=i[a];a==="children"?typeof l=="string"?r.textContent!==l&&(i.suppressHydrationWarning!==!0&&Of(r.textContent,l,e),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&Of(r.textContent,l,e),s=["children",""+l]):Ku.hasOwnProperty(a)&&l!=null&&a==="onScroll"&&mn("scroll",r)}switch(n){case"input":Af(r),t0(r,i,!0);break;case"textarea":Af(r),r0(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=th)}r=s,t.updateQueue=r,r!==null&&(t.flags|=4)}else{a=s.nodeType===9?s:s.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=k_(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=a.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[ui]=t,e[td]=r,KE(e,t,!1,!1),t.stateNode=e;e:{switch(a=sx(n,r),n){case"dialog":mn("cancel",e),mn("close",e),s=r;break;case"iframe":case"object":case"embed":mn("load",e),s=r;break;case"video":case"audio":for(s=0;s<xu.length;s++)mn(xu[s],e);s=r;break;case"source":mn("error",e),s=r;break;case"img":case"image":case"link":mn("error",e),mn("load",e),s=r;break;case"details":mn("toggle",e),s=r;break;case"input":e0(e,r),s=Qy(e,r),mn("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=An({},r,{value:void 0}),mn("invalid",e);break;case"textarea":n0(e,r),s=tx(e,r),mn("invalid",e);break;default:s=r}rx(n,s),l=s;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?N_(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&v_(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Uu(e,c):typeof c=="number"&&Uu(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Ku.hasOwnProperty(i)?c!=null&&i==="onScroll"&&mn("scroll",e):c!=null&&Jw(e,i,c,a))}switch(n){case"input":Af(e),t0(e,r,!1);break;case"textarea":Af(e),r0(e);break;case"option":r.value!=null&&e.setAttribute("value",""+zo(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?zl(e,!!r.multiple,i,!1):r.defaultValue!=null&&zl(e,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=th)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return gr(t),null;case 6:if(e&&t.stateNode!=null)qE(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(Ne(166));if(n=xa(rd.current),xa(yi.current),Df(t)){if(r=t.stateNode,n=t.memoizedProps,r[ui]=t,(i=r.nodeValue!==n)&&(e=ss,e!==null))switch(e.tag){case 3:Of(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Of(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[ui]=t,t.stateNode=r}return gr(t),null;case 13:if(yn(Cn),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(wn&&ns!==null&&t.mode&1&&!(t.flags&128))dE(),tc(),t.flags|=98560,i=!1;else if(i=Df(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(Ne(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(Ne(317));i[ui]=t}else tc(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;gr(t),i=!1}else Bs!==null&&(Dx(Bs),Bs=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||Cn.current&1?Xn===0&&(Xn=3):Rb())),t.updateQueue!==null&&(t.flags|=4),gr(t),null);case 4:return rc(),Px(e,t),e===null&&Zu(t.stateNode.containerInfo),gr(t),null;case 10:return mb(t.type._context),gr(t),null;case 17:return Wr(t.type)&&nh(),gr(t),null;case 19:if(yn(Cn),i=t.memoizedState,i===null)return gr(t),null;if(r=(t.flags&128)!==0,a=i.rendering,a===null)if(r)nu(i,!1);else{if(Xn!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=ch(e),a!==null){for(t.flags|=128,nu(i,!1),r=a.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,a=i.alternate,a===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=a.childLanes,i.lanes=a.lanes,i.child=a.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=a.memoizedProps,i.memoizedState=a.memoizedState,i.updateQueue=a.updateQueue,i.type=a.type,e=a.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return cn(Cn,Cn.current&1|2),t.child}e=e.sibling}i.tail!==null&&Fn()>ic&&(t.flags|=128,r=!0,nu(i,!1),t.lanes=4194304)}else{if(!r)if(e=ch(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),nu(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!wn)return gr(t),null}else 2*Fn()-i.renderingStartTime>ic&&n!==1073741824&&(t.flags|=128,r=!0,nu(i,!1),t.lanes=4194304);i.isBackwards?(a.sibling=t.child,t.child=a):(n=i.last,n!==null?n.sibling=a:t.child=a,i.last=a)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Fn(),t.sibling=null,n=Cn.current,cn(Cn,r?n&1|2:n&1),t):(gr(t),null);case 22:case 23:return Ib(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Zr&1073741824&&(gr(t),t.subtreeFlags&6&&(t.flags|=8192)):gr(t),null;case 24:return null;case 25:return null}throw Error(Ne(156,t.tag))}function TL(e,t){switch(db(t),t.tag){case 1:return Wr(t.type)&&nh(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return rc(),yn(Hr),yn(br),bb(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return wb(t),null;case 13:if(yn(Cn),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Ne(340));tc()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return yn(Cn),null;case 4:return rc(),null;case 10:return mb(t.type._context),null;case 22:case 23:return Ib(),null;case 24:return null;default:return null}}var Bf=!1,yr=!1,ML=typeof WeakSet=="function"?WeakSet:Set,qe=null;function Tl(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Tn(e,t,r)}else n.current=null}function Ix(e,t,n){try{n()}catch(r){Tn(e,t,r)}}var U0=!1;function $L(e,t){if(hx=Qp,e=Q_(),cb(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var a=0,l=-1,c=-1,u=0,f=0,d=e,p=null;t:for(;;){for(var h;d!==n||s!==0&&d.nodeType!==3||(l=a+s),d!==i||r!==0&&d.nodeType!==3||(c=a+r),d.nodeType===3&&(a+=d.nodeValue.length),(h=d.firstChild)!==null;)p=d,d=h;for(;;){if(d===e)break t;if(p===n&&++u===s&&(l=a),p===i&&++f===r&&(c=a),(h=d.nextSibling)!==null)break;d=p,p=d.parentNode}d=h}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(mx={focusedElem:e,selectionRange:n},Qp=!1,qe=t;qe!==null;)if(t=qe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,qe=e;else for(;qe!==null;){t=qe;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var k=g.memoizedProps,w=g.memoizedState,y=t.stateNode,v=y.getSnapshotBeforeUpdate(t.elementType===t.type?k:Ds(t.type,k),w);y.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var b=t.stateNode.containerInfo;b.nodeType===1?b.textContent="":b.nodeType===9&&b.documentElement&&b.removeChild(b.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Ne(163))}}catch(C){Tn(t,t.return,C)}if(e=t.sibling,e!==null){e.return=t.return,qe=e;break}qe=t.return}return g=U0,U0=!1,g}function Iu(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&Ix(t,n,i)}s=s.next}while(s!==r)}}function lm(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Rx(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function YE(e){var t=e.alternate;t!==null&&(e.alternate=null,YE(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ui],delete t[td],delete t[xx],delete t[yL],delete t[xL])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function GE(e){return e.tag===5||e.tag===3||e.tag===4}function q0(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||GE(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Tx(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=th));else if(r!==4&&(e=e.child,e!==null))for(Tx(e,t,n),e=e.sibling;e!==null;)Tx(e,t,n),e=e.sibling}function Mx(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Mx(e,t,n),e=e.sibling;e!==null;)Mx(e,t,n),e=e.sibling}var lr=null,Fs=!1;function ho(e,t,n){for(n=n.child;n!==null;)JE(e,t,n),n=n.sibling}function JE(e,t,n){if(gi&&typeof gi.onCommitFiberUnmount=="function")try{gi.onCommitFiberUnmount(em,n)}catch{}switch(n.tag){case 5:yr||Tl(n,t);case 6:var r=lr,s=Fs;lr=null,ho(e,t,n),lr=r,Fs=s,lr!==null&&(Fs?(e=lr,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):lr.removeChild(n.stateNode));break;case 18:lr!==null&&(Fs?(e=lr,n=n.stateNode,e.nodeType===8?zg(e.parentNode,n):e.nodeType===1&&zg(e,n),Ju(e)):zg(lr,n.stateNode));break;case 4:r=lr,s=Fs,lr=n.stateNode.containerInfo,Fs=!0,ho(e,t,n),lr=r,Fs=s;break;case 0:case 11:case 14:case 15:if(!yr&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,a=i.destroy;i=i.tag,a!==void 0&&(i&2||i&4)&&Ix(n,t,a),s=s.next}while(s!==r)}ho(e,t,n);break;case 1:if(!yr&&(Tl(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){Tn(n,t,l)}ho(e,t,n);break;case 21:ho(e,t,n);break;case 22:n.mode&1?(yr=(r=yr)||n.memoizedState!==null,ho(e,t,n),yr=r):ho(e,t,n);break;default:ho(e,t,n)}}function Y0(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new ML),t.forEach(function(r){var s=VL.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function $s(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];try{var i=e,a=t,l=a;e:for(;l!==null;){switch(l.tag){case 5:lr=l.stateNode,Fs=!1;break e;case 3:lr=l.stateNode.containerInfo,Fs=!0;break e;case 4:lr=l.stateNode.containerInfo,Fs=!0;break e}l=l.return}if(lr===null)throw Error(Ne(160));JE(i,a,s),lr=null,Fs=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(u){Tn(s,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)XE(t,e),t=t.sibling}function XE(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if($s(t,e),ri(e),r&4){try{Iu(3,e,e.return),lm(3,e)}catch(k){Tn(e,e.return,k)}try{Iu(5,e,e.return)}catch(k){Tn(e,e.return,k)}}break;case 1:$s(t,e),ri(e),r&512&&n!==null&&Tl(n,n.return);break;case 5:if($s(t,e),ri(e),r&512&&n!==null&&Tl(n,n.return),e.flags&32){var s=e.stateNode;try{Uu(s,"")}catch(k){Tn(e,e.return,k)}}if(r&4&&(s=e.stateNode,s!=null)){var i=e.memoizedProps,a=n!==null?n.memoizedProps:i,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&w_(s,i),sx(l,a);var u=sx(l,i);for(a=0;a<c.length;a+=2){var f=c[a],d=c[a+1];f==="style"?N_(s,d):f==="dangerouslySetInnerHTML"?v_(s,d):f==="children"?Uu(s,d):Jw(s,f,d,u)}switch(l){case"input":Zy(s,i);break;case"textarea":b_(s,i);break;case"select":var p=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var h=i.value;h!=null?zl(s,!!i.multiple,h,!1):p!==!!i.multiple&&(i.defaultValue!=null?zl(s,!!i.multiple,i.defaultValue,!0):zl(s,!!i.multiple,i.multiple?[]:"",!1))}s[td]=i}catch(k){Tn(e,e.return,k)}}break;case 6:if($s(t,e),ri(e),r&4){if(e.stateNode===null)throw Error(Ne(162));s=e.stateNode,i=e.memoizedProps;try{s.nodeValue=i}catch(k){Tn(e,e.return,k)}}break;case 3:if($s(t,e),ri(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Ju(t.containerInfo)}catch(k){Tn(e,e.return,k)}break;case 4:$s(t,e),ri(e);break;case 13:$s(t,e),ri(e),s=e.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(Ab=Fn())),r&4&&Y0(e);break;case 22:if(f=n!==null&&n.memoizedState!==null,e.mode&1?(yr=(u=yr)||f,$s(t,e),yr=u):$s(t,e),ri(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!f&&e.mode&1)for(qe=e,f=e.child;f!==null;){for(d=qe=f;qe!==null;){switch(p=qe,h=p.child,p.tag){case 0:case 11:case 14:case 15:Iu(4,p,p.return);break;case 1:Tl(p,p.return);var g=p.stateNode;if(typeof g.componentWillUnmount=="function"){r=p,n=p.return;try{t=r,g.props=t.memoizedProps,g.state=t.memoizedState,g.componentWillUnmount()}catch(k){Tn(r,n,k)}}break;case 5:Tl(p,p.return);break;case 22:if(p.memoizedState!==null){J0(d);continue}}h!==null?(h.return=p,qe=h):J0(d)}f=f.sibling}e:for(f=null,d=e;;){if(d.tag===5){if(f===null){f=d;try{s=d.stateNode,u?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=d.stateNode,c=d.memoizedProps.style,a=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=S_("display",a))}catch(k){Tn(e,e.return,k)}}}else if(d.tag===6){if(f===null)try{d.stateNode.nodeValue=u?"":d.memoizedProps}catch(k){Tn(e,e.return,k)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===e)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===e)break e;for(;d.sibling===null;){if(d.return===null||d.return===e)break e;f===d&&(f=null),d=d.return}f===d&&(f=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:$s(t,e),ri(e),r&4&&Y0(e);break;case 21:break;default:$s(t,e),ri(e)}}function ri(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(GE(n)){var r=n;break e}n=n.return}throw Error(Ne(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(Uu(s,""),r.flags&=-33);var i=q0(e);Mx(e,i,s);break;case 3:case 4:var a=r.stateNode.containerInfo,l=q0(e);Tx(e,l,a);break;default:throw Error(Ne(161))}}catch(c){Tn(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function LL(e,t,n){qe=e,QE(e)}function QE(e,t,n){for(var r=(e.mode&1)!==0;qe!==null;){var s=qe,i=s.child;if(s.tag===22&&r){var a=s.memoizedState!==null||Bf;if(!a){var l=s.alternate,c=l!==null&&l.memoizedState!==null||yr;l=Bf;var u=yr;if(Bf=a,(yr=c)&&!u)for(qe=s;qe!==null;)a=qe,c=a.child,a.tag===22&&a.memoizedState!==null?X0(s):c!==null?(c.return=a,qe=c):X0(s);for(;i!==null;)qe=i,QE(i),i=i.sibling;qe=s,Bf=l,yr=u}G0(e)}else s.subtreeFlags&8772&&i!==null?(i.return=s,qe=i):G0(e)}}function G0(e){for(;qe!==null;){var t=qe;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:yr||lm(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!yr)if(n===null)r.componentDidMount();else{var s=t.elementType===t.type?n.memoizedProps:Ds(t.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&T0(t,i,r);break;case 3:var a=t.updateQueue;if(a!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}T0(t,a,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var f=u.memoizedState;if(f!==null){var d=f.dehydrated;d!==null&&Ju(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Ne(163))}yr||t.flags&512&&Rx(t)}catch(p){Tn(t,t.return,p)}}if(t===e){qe=null;break}if(n=t.sibling,n!==null){n.return=t.return,qe=n;break}qe=t.return}}function J0(e){for(;qe!==null;){var t=qe;if(t===e){qe=null;break}var n=t.sibling;if(n!==null){n.return=t.return,qe=n;break}qe=t.return}}function X0(e){for(;qe!==null;){var t=qe;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{lm(4,t)}catch(c){Tn(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(c){Tn(t,s,c)}}var i=t.return;try{Rx(t)}catch(c){Tn(t,i,c)}break;case 5:var a=t.return;try{Rx(t)}catch(c){Tn(t,a,c)}}}catch(c){Tn(t,t.return,c)}if(t===e){qe=null;break}var l=t.sibling;if(l!==null){l.return=t.return,qe=l;break}qe=t.return}}var OL=Math.ceil,fh=to.ReactCurrentDispatcher,_b=to.ReactCurrentOwner,ks=to.ReactCurrentBatchConfig,Dt=0,sr=null,Vn=null,ur=0,Zr=0,Ml=Go(0),Xn=0,ad=null,Ia=0,cm=0,Eb=0,Ru=null,Dr=null,Ab=0,ic=1/0,Oi=null,ph=!1,$x=null,$o=null,Hf=!1,_o=null,hh=0,Tu=0,Lx=null,Pp=-1,Ip=0;function Er(){return Dt&6?Fn():Pp!==-1?Pp:Pp=Fn()}function Lo(e){return e.mode&1?Dt&2&&ur!==0?ur&-ur:bL.transition!==null?(Ip===0&&(Ip=L_()),Ip):(e=Qt,e!==0||(e=window.event,e=e===void 0?16:W_(e.type)),e):1}function qs(e,t,n,r){if(50<Tu)throw Tu=0,Lx=null,Error(Ne(185));Id(e,n,r),(!(Dt&2)||e!==sr)&&(e===sr&&(!(Dt&2)&&(cm|=n),Xn===4&&No(e,ur)),Vr(e,r),n===1&&Dt===0&&!(t.mode&1)&&(ic=Fn()+500,im&&Jo()))}function Vr(e,t){var n=e.callbackNode;b2(e,t);var r=Xp(e,e===sr?ur:0);if(r===0)n!==null&&o0(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&o0(n),t===1)e.tag===0?wL(Q0.bind(null,e)):lE(Q0.bind(null,e)),mL(function(){!(Dt&6)&&Jo()}),n=null;else{switch(O_(r)){case 1:n=tb;break;case 4:n=M_;break;case 16:n=Jp;break;case 536870912:n=$_;break;default:n=Jp}n=oA(n,ZE.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function ZE(e,t){if(Pp=-1,Ip=0,Dt&6)throw Error(Ne(327));var n=e.callbackNode;if(Kl()&&e.callbackNode!==n)return null;var r=Xp(e,e===sr?ur:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=mh(e,r);else{t=r;var s=Dt;Dt|=2;var i=tA();(sr!==e||ur!==t)&&(Oi=null,ic=Fn()+500,ka(e,t));do try{zL();break}catch(l){eA(e,l)}while(!0);hb(),fh.current=i,Dt=s,Vn!==null?t=0:(sr=null,ur=0,t=Xn)}if(t!==0){if(t===2&&(s=cx(e),s!==0&&(r=s,t=Ox(e,s))),t===1)throw n=ad,ka(e,0),No(e,r),Vr(e,Fn()),n;if(t===6)No(e,r);else{if(s=e.current.alternate,!(r&30)&&!DL(s)&&(t=mh(e,r),t===2&&(i=cx(e),i!==0&&(r=i,t=Ox(e,i))),t===1))throw n=ad,ka(e,0),No(e,r),Vr(e,Fn()),n;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(Ne(345));case 2:ua(e,Dr,Oi);break;case 3:if(No(e,r),(r&130023424)===r&&(t=Ab+500-Fn(),10<t)){if(Xp(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){Er(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=yx(ua.bind(null,e,Dr,Oi),t);break}ua(e,Dr,Oi);break;case 4:if(No(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var a=31-Us(r);i=1<<a,a=t[a],a>s&&(s=a),r&=~i}if(r=s,r=Fn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*OL(r/1960))-r,10<r){e.timeoutHandle=yx(ua.bind(null,e,Dr,Oi),r);break}ua(e,Dr,Oi);break;case 5:ua(e,Dr,Oi);break;default:throw Error(Ne(329))}}}return Vr(e,Fn()),e.callbackNode===n?ZE.bind(null,e):null}function Ox(e,t){var n=Ru;return e.current.memoizedState.isDehydrated&&(ka(e,t).flags|=256),e=mh(e,t),e!==2&&(t=Dr,Dr=n,t!==null&&Dx(t)),e}function Dx(e){Dr===null?Dr=e:Dr.push.apply(Dr,e)}function DL(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var s=n[r],i=s.getSnapshot;s=s.value;try{if(!Gs(i(),s))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function No(e,t){for(t&=~Eb,t&=~cm,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Us(t),r=1<<n;e[n]=-1,t&=~r}}function Q0(e){if(Dt&6)throw Error(Ne(327));Kl();var t=Xp(e,0);if(!(t&1))return Vr(e,Fn()),null;var n=mh(e,t);if(e.tag!==0&&n===2){var r=cx(e);r!==0&&(t=r,n=Ox(e,r))}if(n===1)throw n=ad,ka(e,0),No(e,t),Vr(e,Fn()),n;if(n===6)throw Error(Ne(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,ua(e,Dr,Oi),Vr(e,Fn()),null}function Pb(e,t){var n=Dt;Dt|=1;try{return e(t)}finally{Dt=n,Dt===0&&(ic=Fn()+500,im&&Jo())}}function Ra(e){_o!==null&&_o.tag===0&&!(Dt&6)&&Kl();var t=Dt;Dt|=1;var n=ks.transition,r=Qt;try{if(ks.transition=null,Qt=1,e)return e()}finally{Qt=r,ks.transition=n,Dt=t,!(Dt&6)&&Jo()}}function Ib(){Zr=Ml.current,yn(Ml)}function ka(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,hL(n)),Vn!==null)for(n=Vn.return;n!==null;){var r=n;switch(db(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&nh();break;case 3:rc(),yn(Hr),yn(br),bb();break;case 5:wb(r);break;case 4:rc();break;case 13:yn(Cn);break;case 19:yn(Cn);break;case 10:mb(r.type._context);break;case 22:case 23:Ib()}n=n.return}if(sr=e,Vn=e=Oo(e.current,null),ur=Zr=t,Xn=0,ad=null,Eb=cm=Ia=0,Dr=Ru=null,ya!==null){for(t=0;t<ya.length;t++)if(n=ya[t],r=n.interleaved,r!==null){n.interleaved=null;var s=r.next,i=n.pending;if(i!==null){var a=i.next;i.next=s,r.next=a}n.pending=r}ya=null}return e}function eA(e,t){do{var n=Vn;try{if(hb(),_p.current=dh,uh){for(var r=En.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}uh=!1}if(Pa=0,nr=Jn=En=null,Pu=!1,sd=0,_b.current=null,n===null||n.return===null){Xn=1,ad=t,Vn=null;break}e:{var i=e,a=n.return,l=n,c=t;if(t=ur,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,f=l,d=f.tag;if(!(f.mode&1)&&(d===0||d===11||d===15)){var p=f.alternate;p?(f.updateQueue=p.updateQueue,f.memoizedState=p.memoizedState,f.lanes=p.lanes):(f.updateQueue=null,f.memoizedState=null)}var h=F0(a);if(h!==null){h.flags&=-257,z0(h,a,l,i,t),h.mode&1&&D0(i,u,t),t=h,c=u;var g=t.updateQueue;if(g===null){var k=new Set;k.add(c),t.updateQueue=k}else g.add(c);break e}else{if(!(t&1)){D0(i,u,t),Rb();break e}c=Error(Ne(426))}}else if(wn&&l.mode&1){var w=F0(a);if(w!==null){!(w.flags&65536)&&(w.flags|=256),z0(w,a,l,i,t),fb(sc(c,l));break e}}i=c=sc(c,l),Xn!==4&&(Xn=2),Ru===null?Ru=[i]:Ru.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var y=OE(i,c,t);R0(i,y);break e;case 1:l=c;var v=i.type,b=i.stateNode;if(!(i.flags&128)&&(typeof v.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&($o===null||!$o.has(b)))){i.flags|=65536,t&=-t,i.lanes|=t;var C=DE(i,l,t);R0(i,C);break e}}i=i.return}while(i!==null)}rA(n)}catch(N){t=N,Vn===n&&n!==null&&(Vn=n=n.return);continue}break}while(!0)}function tA(){var e=fh.current;return fh.current=dh,e===null?dh:e}function Rb(){(Xn===0||Xn===3||Xn===2)&&(Xn=4),sr===null||!(Ia&268435455)&&!(cm&268435455)||No(sr,ur)}function mh(e,t){var n=Dt;Dt|=2;var r=tA();(sr!==e||ur!==t)&&(Oi=null,ka(e,t));do try{FL();break}catch(s){eA(e,s)}while(!0);if(hb(),Dt=n,fh.current=r,Vn!==null)throw Error(Ne(261));return sr=null,ur=0,Xn}function FL(){for(;Vn!==null;)nA(Vn)}function zL(){for(;Vn!==null&&!d2();)nA(Vn)}function nA(e){var t=iA(e.alternate,e,Zr);e.memoizedProps=e.pendingProps,t===null?rA(e):Vn=t,_b.current=null}function rA(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=TL(n,t),n!==null){n.flags&=32767,Vn=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Xn=6,Vn=null;return}}else if(n=RL(n,t,Zr),n!==null){Vn=n;return}if(t=t.sibling,t!==null){Vn=t;return}Vn=t=e}while(t!==null);Xn===0&&(Xn=5)}function ua(e,t,n){var r=Qt,s=ks.transition;try{ks.transition=null,Qt=1,BL(e,t,n,r)}finally{ks.transition=s,Qt=r}return null}function BL(e,t,n,r){do Kl();while(_o!==null);if(Dt&6)throw Error(Ne(327));n=e.finishedWork;var s=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(Ne(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(k2(e,i),e===sr&&(Vn=sr=null,ur=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Hf||(Hf=!0,oA(Jp,function(){return Kl(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=ks.transition,ks.transition=null;var a=Qt;Qt=1;var l=Dt;Dt|=4,_b.current=null,$L(e,n),XE(n,e),aL(mx),Qp=!!hx,mx=hx=null,e.current=n,LL(n),f2(),Dt=l,Qt=a,ks.transition=i}else e.current=n;if(Hf&&(Hf=!1,_o=e,hh=s),i=e.pendingLanes,i===0&&($o=null),m2(n.stateNode),Vr(e,Fn()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)s=t[n],r(s.value,{componentStack:s.stack,digest:s.digest});if(ph)throw ph=!1,e=$x,$x=null,e;return hh&1&&e.tag!==0&&Kl(),i=e.pendingLanes,i&1?e===Lx?Tu++:(Tu=0,Lx=e):Tu=0,Jo(),null}function Kl(){if(_o!==null){var e=O_(hh),t=ks.transition,n=Qt;try{if(ks.transition=null,Qt=16>e?16:e,_o===null)var r=!1;else{if(e=_o,_o=null,hh=0,Dt&6)throw Error(Ne(331));var s=Dt;for(Dt|=4,qe=e.current;qe!==null;){var i=qe,a=i.child;if(qe.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(qe=u;qe!==null;){var f=qe;switch(f.tag){case 0:case 11:case 15:Iu(8,f,i)}var d=f.child;if(d!==null)d.return=f,qe=d;else for(;qe!==null;){f=qe;var p=f.sibling,h=f.return;if(YE(f),f===u){qe=null;break}if(p!==null){p.return=h,qe=p;break}qe=h}}}var g=i.alternate;if(g!==null){var k=g.child;if(k!==null){g.child=null;do{var w=k.sibling;k.sibling=null,k=w}while(k!==null)}}qe=i}}if(i.subtreeFlags&2064&&a!==null)a.return=i,qe=a;else e:for(;qe!==null;){if(i=qe,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Iu(9,i,i.return)}var y=i.sibling;if(y!==null){y.return=i.return,qe=y;break e}qe=i.return}}var v=e.current;for(qe=v;qe!==null;){a=qe;var b=a.child;if(a.subtreeFlags&2064&&b!==null)b.return=a,qe=b;else e:for(a=v;qe!==null;){if(l=qe,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:lm(9,l)}}catch(N){Tn(l,l.return,N)}if(l===a){qe=null;break e}var C=l.sibling;if(C!==null){C.return=l.return,qe=C;break e}qe=l.return}}if(Dt=s,Jo(),gi&&typeof gi.onPostCommitFiberRoot=="function")try{gi.onPostCommitFiberRoot(em,e)}catch{}r=!0}return r}finally{Qt=n,ks.transition=t}}return!1}function Z0(e,t,n){t=sc(n,t),t=OE(e,t,1),e=Mo(e,t,1),t=Er(),e!==null&&(Id(e,1,t),Vr(e,t))}function Tn(e,t,n){if(e.tag===3)Z0(e,e,n);else for(;t!==null;){if(t.tag===3){Z0(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&($o===null||!$o.has(r))){e=sc(n,e),e=DE(t,e,1),t=Mo(t,e,1),e=Er(),t!==null&&(Id(t,1,e),Vr(t,e));break}}t=t.return}}function HL(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Er(),e.pingedLanes|=e.suspendedLanes&n,sr===e&&(ur&n)===n&&(Xn===4||Xn===3&&(ur&130023424)===ur&&500>Fn()-Ab?ka(e,0):Eb|=n),Vr(e,t)}function sA(e,t){t===0&&(e.mode&1?(t=Rf,Rf<<=1,!(Rf&130023424)&&(Rf=4194304)):t=1);var n=Er();e=Xi(e,t),e!==null&&(Id(e,t,n),Vr(e,n))}function WL(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),sA(e,n)}function VL(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(Ne(314))}r!==null&&r.delete(t),sA(e,n)}var iA;iA=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Hr.current)Fr=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Fr=!1,IL(e,t,n);Fr=!!(e.flags&131072)}else Fr=!1,wn&&t.flags&1048576&&cE(t,ih,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Ap(e,t),e=t.pendingProps;var s=ec(t,br.current);Vl(t,n),s=vb(null,t,r,e,s,n);var i=Sb();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Wr(r)?(i=!0,rh(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,yb(t),s.updater=am,t.stateNode=s,s._reactInternals=t,Nx(t,r,e,n),t=_x(null,t,r,!0,i,n)):(t.tag=0,wn&&i&&ub(t),_r(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Ap(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=UL(r),e=Ds(r,e),s){case 0:t=Cx(null,t,r,e,n);break e;case 1:t=W0(null,t,r,e,n);break e;case 11:t=B0(null,t,r,e,n);break e;case 14:t=H0(null,t,r,Ds(r.type,e),n);break e}throw Error(Ne(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Ds(r,s),Cx(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Ds(r,s),W0(e,t,r,s,n);case 3:e:{if(HE(t),e===null)throw Error(Ne(387));r=t.pendingProps,i=t.memoizedState,s=i.element,mE(e,t),lh(t,r,null,n);var a=t.memoizedState;if(r=a.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=sc(Error(Ne(423)),t),t=V0(e,t,r,n,s);break e}else if(r!==s){s=sc(Error(Ne(424)),t),t=V0(e,t,r,n,s);break e}else for(ns=To(t.stateNode.containerInfo.firstChild),ss=t,wn=!0,Bs=null,n=pE(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(tc(),r===s){t=Qi(e,t,n);break e}_r(e,t,r,n)}t=t.child}return t;case 5:return gE(t),e===null&&kx(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,a=s.children,gx(r,s)?a=null:i!==null&&gx(r,i)&&(t.flags|=32),BE(e,t),_r(e,t,a,n),t.child;case 6:return e===null&&kx(t),null;case 13:return WE(e,t,n);case 4:return xb(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=nc(t,null,r,n):_r(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Ds(r,s),B0(e,t,r,s,n);case 7:return _r(e,t,t.pendingProps,n),t.child;case 8:return _r(e,t,t.pendingProps.children,n),t.child;case 12:return _r(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,i=t.memoizedProps,a=s.value,cn(oh,r._currentValue),r._currentValue=a,i!==null)if(Gs(i.value,a)){if(i.children===s.children&&!Hr.current){t=Qi(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){a=i.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=Ui(-1,n&-n),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var f=u.pending;f===null?c.next=c:(c.next=f.next,f.next=c),u.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),vx(i.return,n,t),l.lanes|=n;break}c=c.next}}else if(i.tag===10)a=i.type===t.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error(Ne(341));a.lanes|=n,l=a.alternate,l!==null&&(l.lanes|=n),vx(a,n,t),a=i.sibling}else a=i.child;if(a!==null)a.return=i;else for(a=i;a!==null;){if(a===t){a=null;break}if(i=a.sibling,i!==null){i.return=a.return,a=i;break}a=a.return}i=a}_r(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,Vl(t,n),s=vs(s),r=r(s),t.flags|=1,_r(e,t,r,n),t.child;case 14:return r=t.type,s=Ds(r,t.pendingProps),s=Ds(r.type,s),H0(e,t,r,s,n);case 15:return FE(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Ds(r,s),Ap(e,t),t.tag=1,Wr(r)?(e=!0,rh(t)):e=!1,Vl(t,n),LE(t,r,s),Nx(t,r,s,n),_x(null,t,r,!0,e,n);case 19:return VE(e,t,n);case 22:return zE(e,t,n)}throw Error(Ne(156,t.tag))};function oA(e,t){return T_(e,t)}function KL(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function bs(e,t,n,r){return new KL(e,t,n,r)}function Tb(e){return e=e.prototype,!(!e||!e.isReactComponent)}function UL(e){if(typeof e=="function")return Tb(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Qw)return 11;if(e===Zw)return 14}return 2}function Oo(e,t){var n=e.alternate;return n===null?(n=bs(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Rp(e,t,n,r,s,i){var a=2;if(r=e,typeof e=="function")Tb(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Nl:return va(n.children,s,i,t);case Xw:a=8,s|=8;break;case Yy:return e=bs(12,n,t,s|2),e.elementType=Yy,e.lanes=i,e;case Gy:return e=bs(13,n,t,s),e.elementType=Gy,e.lanes=i,e;case Jy:return e=bs(19,n,t,s),e.elementType=Jy,e.lanes=i,e;case g_:return um(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case h_:a=10;break e;case m_:a=9;break e;case Qw:a=11;break e;case Zw:a=14;break e;case bo:a=16,r=null;break e}throw Error(Ne(130,e==null?e:typeof e,""))}return t=bs(a,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function va(e,t,n,r){return e=bs(7,e,r,t),e.lanes=n,e}function um(e,t,n,r){return e=bs(22,e,r,t),e.elementType=g_,e.lanes=n,e.stateNode={isHidden:!1},e}function Yg(e,t,n){return e=bs(6,e,null,t),e.lanes=n,e}function Gg(e,t,n){return t=bs(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function qL(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ag(0),this.expirationTimes=Ag(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ag(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Mb(e,t,n,r,s,i,a,l,c){return e=new qL(e,t,n,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=bs(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},yb(i),e}function YL(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Sl,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function aA(e){if(!e)return Bo;e=e._reactInternals;e:{if(Ua(e)!==e||e.tag!==1)throw Error(Ne(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Wr(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(Ne(171))}if(e.tag===1){var n=e.type;if(Wr(n))return aE(e,n,t)}return t}function lA(e,t,n,r,s,i,a,l,c){return e=Mb(n,r,!0,e,s,i,a,l,c),e.context=aA(null),n=e.current,r=Er(),s=Lo(n),i=Ui(r,s),i.callback=t??null,Mo(n,i,s),e.current.lanes=s,Id(e,s,r),Vr(e,r),e}function dm(e,t,n,r){var s=t.current,i=Er(),a=Lo(s);return n=aA(n),t.context===null?t.context=n:t.pendingContext=n,t=Ui(i,a),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Mo(s,t,a),e!==null&&(qs(e,s,a,i),Cp(e,s,a)),a}function gh(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function eN(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function $b(e,t){eN(e,t),(e=e.alternate)&&eN(e,t)}function GL(){return null}var cA=typeof reportError=="function"?reportError:function(e){console.error(e)};function Lb(e){this._internalRoot=e}fm.prototype.render=Lb.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Ne(409));dm(e,t,null,null)};fm.prototype.unmount=Lb.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ra(function(){dm(null,e,null,null)}),t[Ji]=null}};function fm(e){this._internalRoot=e}fm.prototype.unstable_scheduleHydration=function(e){if(e){var t=z_();e={blockedOn:null,target:e,priority:t};for(var n=0;n<So.length&&t!==0&&t<So[n].priority;n++);So.splice(n,0,e),n===0&&H_(e)}};function Ob(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function pm(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function tN(){}function JL(e,t,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var u=gh(a);i.call(u)}}var a=lA(t,r,e,0,null,!1,!1,"",tN);return e._reactRootContainer=a,e[Ji]=a.current,Zu(e.nodeType===8?e.parentNode:e),Ra(),a}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var u=gh(c);l.call(u)}}var c=Mb(e,0,!1,null,null,!1,!1,"",tN);return e._reactRootContainer=c,e[Ji]=c.current,Zu(e.nodeType===8?e.parentNode:e),Ra(function(){dm(t,c,n,r)}),c}function hm(e,t,n,r,s){var i=n._reactRootContainer;if(i){var a=i;if(typeof s=="function"){var l=s;s=function(){var c=gh(a);l.call(c)}}dm(t,a,e,s)}else a=JL(n,t,e,s,r);return gh(a)}D_=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=yu(t.pendingLanes);n!==0&&(nb(t,n|1),Vr(t,Fn()),!(Dt&6)&&(ic=Fn()+500,Jo()))}break;case 13:Ra(function(){var r=Xi(e,1);if(r!==null){var s=Er();qs(r,e,1,s)}}),$b(e,1)}};rb=function(e){if(e.tag===13){var t=Xi(e,134217728);if(t!==null){var n=Er();qs(t,e,134217728,n)}$b(e,134217728)}};F_=function(e){if(e.tag===13){var t=Lo(e),n=Xi(e,t);if(n!==null){var r=Er();qs(n,e,t,r)}$b(e,t)}};z_=function(){return Qt};B_=function(e,t){var n=Qt;try{return Qt=e,t()}finally{Qt=n}};ox=function(e,t,n){switch(t){case"input":if(Zy(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var s=sm(r);if(!s)throw Error(Ne(90));x_(r),Zy(r,s)}}}break;case"textarea":b_(e,n);break;case"select":t=n.value,t!=null&&zl(e,!!n.multiple,t,!1)}};__=Pb;E_=Ra;var XL={usingClientEntryPoint:!1,Events:[Td,El,sm,j_,C_,Pb]},ru={findFiberByHostInstance:ga,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},QL={bundleType:ru.bundleType,version:ru.version,rendererPackageName:ru.rendererPackageName,rendererConfig:ru.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:to.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=I_(e),e===null?null:e.stateNode},findFiberByHostInstance:ru.findFiberByHostInstance||GL,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Wf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Wf.isDisabled&&Wf.supportsFiber)try{em=Wf.inject(QL),gi=Wf}catch{}}ls.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=XL;ls.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Ob(t))throw Error(Ne(200));return YL(e,t,null,n)};ls.createRoot=function(e,t){if(!Ob(e))throw Error(Ne(299));var n=!1,r="",s=cA;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=Mb(e,1,!1,null,null,n,!1,r,s),e[Ji]=t.current,Zu(e.nodeType===8?e.parentNode:e),new Lb(t)};ls.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(Ne(188)):(e=Object.keys(e).join(","),Error(Ne(268,e)));return e=I_(t),e=e===null?null:e.stateNode,e};ls.flushSync=function(e){return Ra(e)};ls.hydrate=function(e,t,n){if(!pm(t))throw Error(Ne(200));return hm(null,e,t,!0,n)};ls.hydrateRoot=function(e,t,n){if(!Ob(e))throw Error(Ne(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",a=cA;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=lA(t,null,e,1,n??null,s,!1,i,a),e[Ji]=t.current,Zu(e),r)for(e=0;e<r.length;e++)n=r[e],s=n._getVersion,s=s(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,s]:t.mutableSourceEagerHydrationData.push(n,s);return new fm(t)};ls.render=function(e,t,n){if(!pm(t))throw Error(Ne(200));return hm(null,e,t,!1,n)};ls.unmountComponentAtNode=function(e){if(!pm(e))throw Error(Ne(40));return e._reactRootContainer?(Ra(function(){hm(null,null,e,!1,function(){e._reactRootContainer=null,e[Ji]=null})}),!0):!1};ls.unstable_batchedUpdates=Pb;ls.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!pm(n))throw Error(Ne(200));if(e==null||e._reactInternals===void 0)throw Error(Ne(38));return hm(e,t,n,!1,r)};ls.version="18.3.1-next-f1338f8080-20240426";function uA(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(uA)}catch(e){console.error(e)}}uA(),u_.exports=ls;var cr=u_.exports,nN=cr;Uy.createRoot=nN.createRoot,Uy.hydrateRoot=nN.hydrateRoot;const dA=m.createContext(null);function Fx(e){let t=e||"/";return t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t||"/"}function ZL(){const e=Fx(window.location.pathname);return e==="/"?(window.history.replaceState({},"","/projects"),"/projects"):e}function eO({children:e}){const[t,n]=m.useState(ZL);m.useEffect(()=>{const i=()=>n(Fx(window.location.pathname));return window.addEventListener("popstate",i),()=>window.removeEventListener("popstate",i)},[]);const r=m.useCallback(i=>{const a=i.startsWith("/")?i:`/${i}`;let l;try{l=new URL(a,window.location.origin)}catch{l=new URL("/",window.location.origin)}const c=Fx(l.pathname),u=l.search||"";window.history.pushState({},"",c+u),n(c)},[]),s=m.useMemo(()=>({path:t,navigate:r}),[t,r]);return o.jsx(dA.Provider,{value:s,children:e})}function Ni(){const e=m.useContext(dA);if(!e)throw new Error("useRoute must be used within RouteProvider");return e}function tO(){if(console&&console.warn){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];typeof t[0]=="string"&&(t[0]=`react-i18next:: ${t[0]}`),console.warn(...t)}}const rN={};function zx(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];typeof t[0]=="string"&&rN[t[0]]||(typeof t[0]=="string"&&(rN[t[0]]=new Date),tO(...t))}const fA=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}};function sN(e,t,n){e.loadNamespaces(t,fA(e,n))}function iN(e,t,n,r){typeof n=="string"&&(n=[n]),n.forEach(s=>{e.options.ns.indexOf(s)<0&&e.options.ns.push(s)}),e.loadLanguages(t,fA(e,r))}function nO(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=t.languages[0],s=t.options?t.options.fallbackLng:!1,i=t.languages[t.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(l,c)=>{const u=t.services.backendConnector.state[`${l}|${c}`];return u===-1||u===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!a(t.isLanguageChangingTo,e)?!1:!!(t.hasResourceBundle(r,e)||!t.services.backendConnector.backend||t.options.resources&&!t.options.partialBundledLanguages||a(r,e)&&(!s||a(i,e)))}function rO(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(zx("i18n.languages were undefined or empty",t.languages),!0):t.options.ignoreJSONStructure!==void 0?t.hasLoadedNamespace(e,{lng:n.lng,precheck:(s,i)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&s.services.backendConnector.backend&&s.isLanguageChangingTo&&!i(s.isLanguageChangingTo,e))return!1}}):nO(e,t,n)}const sO=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,iO={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},oO=e=>iO[e],aO=e=>e.replace(sO,oO);let Bx={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:aO};function lO(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Bx={...Bx,...e}}function cO(){return Bx}let pA;function uO(e){pA=e}function dO(){return pA}const fO={type:"3rdParty",init(e){lO(e.options.react),uO(e)}},pO=m.createContext();class hO{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const mO=(e,t)=>{const n=m.useRef();return m.useEffect(()=>{n.current=e},[e,t]),n.current};function Ir(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=t,{i18n:r,defaultNS:s}=m.useContext(pO)||{},i=n||r||dO();if(i&&!i.reportNamespaces&&(i.reportNamespaces=new hO),!i){zx("You will need to pass in an i18next instance by using initReactI18next");const b=(N,j)=>typeof j=="string"?j:j&&typeof j=="object"&&typeof j.defaultValue=="string"?j.defaultValue:Array.isArray(N)?N[N.length-1]:N,C=[b,{},!1];return C.t=b,C.i18n={},C.ready=!1,C}i.options.react&&i.options.react.wait!==void 0&&zx("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const a={...cO(),...i.options.react,...t},{useSuspense:l,keyPrefix:c}=a;let u=e||s||i.options&&i.options.defaultNS;u=typeof u=="string"?[u]:u||["translation"],i.reportNamespaces.addUsedNamespaces&&i.reportNamespaces.addUsedNamespaces(u);const f=(i.isInitialized||i.initializedStoreOnce)&&u.every(b=>rO(b,i,a));function d(){return i.getFixedT(t.lng||null,a.nsMode==="fallback"?u:u[0],c)}const[p,h]=m.useState(d);let g=u.join();t.lng&&(g=`${t.lng}${g}`);const k=mO(g),w=m.useRef(!0);m.useEffect(()=>{const{bindI18n:b,bindI18nStore:C}=a;w.current=!0,!f&&!l&&(t.lng?iN(i,t.lng,u,()=>{w.current&&h(d)}):sN(i,u,()=>{w.current&&h(d)})),f&&k&&k!==g&&w.current&&h(d);function N(){w.current&&h(d)}return b&&i&&i.on(b,N),C&&i&&i.store.on(C,N),()=>{w.current=!1,b&&i&&b.split(" ").forEach(j=>i.off(j,N)),C&&i&&C.split(" ").forEach(j=>i.store.off(j,N))}},[i,g]);const y=m.useRef(!0);m.useEffect(()=>{w.current&&!y.current&&h(d),y.current=!1},[i,c]);const v=[p,i,f];if(v.t=p,v.i18n=i,v.ready=f,f||!f&&!l)return v;throw new Promise(b=>{t.lng?iN(i,t.lng,u,()=>b()):sN(i,u,()=>b())})}const hA="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2032%2032'%20fill='none'%20role='img'%20aria-label='AgentFlow'%3e%3ctitle%3eAgentFlow%3c/title%3e%3crect%20width='32'%20height='32'%20rx='9'%20fill='%23131313'/%3e%3crect%20x='4.5'%20y='11'%20width='10.5'%20height='10'%20rx='3'%20fill='%232a2a2a'%20stroke='%237c4dff'%20stroke-width='1.2'/%3e%3cpath%20d='M15.25%2014.25C17.8%2012.2%2019.2%209.8%2022.25%209.25'%20stroke='%23cdbdff'%20stroke-width='1.65'%20stroke-linecap='round'%20/%3e%3cpath%20d='M15.25%2017.75C17.8%2019.8%2019.2%2022.2%2022.25%2022.75'%20stroke='%237c4dff'%20stroke-width='1.65'%20stroke-linecap='round'%20opacity='0.92'%20/%3e%3crect%20x='21.75'%20y='6'%20width='7.25'%20height='7'%20rx='2.25'%20fill='%23353534'%20stroke='%23e8deff'%20stroke-width='0.95'%20opacity='0.95'/%3e%3crect%20x='21.75'%20y='19'%20width='7.25'%20height='7'%20rx='2.25'%20fill='%23353534'%20stroke='%239ecaff'%20stroke-width='0.95'%20opacity='0.9'/%3e%3c/svg%3e",gO=[{to:"/projects",labelKey:"common:nav.projects",icon:"folder_open"},{to:"/workspaces",label:"知识库",icon:"folder_managed"},{to:"/nodes",labelKey:"common:nav.nodes",icon:"account_tree"},{to:"/my-flows",labelKey:"common:nav.myFlows",icon:"schema"},{to:"/skills",labelKey:"common:nav.skills",icon:"extension"},{to:"/mcps",labelKey:"common:nav.mcps",icon:"hub"},{to:"/node-studio",label:"节点编辑器",icon:"draw"},{to:"/schedules",label:"定时任务",icon:"event_busy"},{to:"/admin/usage",label:"管理看板",icon:"query_stats",adminOnly:!0},{to:"/feedback",labelKey:"common:nav.feedback",icon:"rate_review"},{to:"/settings",labelKey:"common:nav.settings",icon:"settings"}],yO=[{href:"https://agentflow-hub.com",icon:"hub",labelKey:"common:links.hub"},{href:"https://docs.agentflow-hub.com",icon:"menu_book",labelKey:"common:links.docs"},{href:"https://github.com/pproject-github/agentflow",icon:"code",labelKey:"common:links.github"}];function xO(e,t){return t==="/projects"?e==="/projects"||e==="/":t==="/nodes"?e==="/nodes"||e==="/my-nodes":e===t||e.startsWith(t+"/")}function wO({authUser:e,onLogout:t}){const{path:n,navigate:r}=Ni(),{t:s}=Ir(),[i,a]=m.useState(!1);return m.useEffect(()=>{let l=!1;return fetch("/api/ui-context").then(c=>c.json()).then(c=>{l||a(!!c.hideCommunityLinks)}).catch(()=>{}),()=>{l=!0}},[]),o.jsxs("aside",{className:"af-sidebar","aria-label":s("flow:sidebar.mainNav"),children:[o.jsxs("div",{className:"af-brand",children:[o.jsx("div",{className:"af-brand-mark","aria-hidden":!0,children:o.jsx("img",{src:hA,alt:"",width:"36",height:"36",decoding:"async"})}),o.jsxs("div",{children:[o.jsx("h1",{className:"af-brand-title",children:"Agentflow"}),o.jsx("p",{className:"af-brand-tag",children:"Orchestration Engine"})]})]}),o.jsx("nav",{className:"af-nav",children:gO.filter(l=>!l.adminOnly||(e==null?void 0:e.isAdmin)).map(l=>o.jsxs("button",{type:"button",className:"af-nav-link"+(xO(n,l.to)?" af-nav-link--active":""),onClick:()=>r(l.to),children:[o.jsx("span",{className:"material-symbols-outlined",children:l.icon}),o.jsx("span",{children:l.label||s(l.labelKey)})]},l.to))}),o.jsxs("div",{className:"af-sidebar-footer",children:[o.jsxs("div",{className:"af-sidebar-user",title:(e==null?void 0:e.username)||(e==null?void 0:e.userId)||"",children:[o.jsx("span",{className:"material-symbols-outlined",children:"person"}),o.jsx("span",{children:(e==null?void 0:e.username)||(e==null?void 0:e.userId)||""}),e!=null&&e.isAdmin?o.jsx("span",{className:"af-sidebar-admin-badge",children:"Admin"}):null,o.jsx("button",{type:"button",className:"af-sidebar-logout",onClick:t,"aria-label":"Logout",title:"Logout",children:o.jsx("span",{className:"material-symbols-outlined",children:"logout"})})]}),!i&&yO.map(l=>{const c=s(l.labelKey);return o.jsx("a",{className:"af-sidebar-ext",href:l.href,target:"_blank",rel:"noopener noreferrer","aria-label":c,title:c,children:o.jsx("span",{className:"material-symbols-outlined",children:l.icon})},l.href)})]})]})}const bO="agentflow.pipelineRecent",kO=15;function vO(e){try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function SO(){if(typeof localStorage>"u")return[];const e=localStorage.getItem(bO);return e?vO(e).filter(t=>t&&typeof t.flowId=="string"&&(t.flowSource==="user"||t.flowSource==="builtin"||t.flowSource==="admin"||t.flowSource==="workspace")&&t.kind==="opened"&&typeof t.at=="number"):[]}function NO(e,t){const n=e.filter(r=>r.id===t);return n.length===0||n.some(r=>(r.source??"user")==="user")?"user":n.some(r=>r.source==="workspace")?"workspace":n.some(r=>r.source==="admin")?"admin":n.some(r=>r.source==="builtin")?"builtin":n[0].source??"user"}function oN(e,t){const n=Date.now(),r=Math.max(0,n-e),s=Math.floor(r/1e3);if(s<60)return t("flow:time.justNow");const i=Math.floor(s/60);if(i<60)return t("flow:time.minutesAgo",{n:i});const a=Math.floor(i/60);if(a<24)return t("flow:time.hoursAgo",{n:a});const l=new Date(e),c=new Date,u=new Date(c);if(u.setDate(u.getDate()-1),l.toDateString()===u.toDateString())return t("flow:time.yesterday");const f=Math.floor(a/24);return f<7?t("flow:time.daysAgo",{n:f}):`${l.getMonth()+1}/${l.getDate()}`}function jO(e,t,n){const r=[];for(const s of e)!s||typeof s.flowId!="string"||typeof s.at!="number"||r.push({flowId:s.flowId,flowSource:NO(n,s.flowId),kind:"executed",at:s.at});for(const s of t)r.push({flowId:s.flowId,flowSource:s.flowSource,kind:"opened",at:s.at});return r.sort((s,i)=>i.at-s.at),r.slice(0,kO)}var es=Uint8Array,$l=Uint16Array,CO=Int32Array,mA=new es([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),gA=new es([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),_O=new es([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),yA=function(e,t){for(var n=new $l(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var s=new CO(n[30]),r=1;r<30;++r)for(var i=n[r];i<n[r+1];++i)s[i]=i-n[r]<<5|r;return{b:n,r:s}},xA=yA(mA,2),wA=xA.b,EO=xA.r;wA[28]=258,EO[258]=28;var AO=yA(gA,0),PO=AO.b,Hx=new $l(32768);for(var gn=0;gn<32768;++gn){var mo=(gn&43690)>>1|(gn&21845)<<1;mo=(mo&52428)>>2|(mo&13107)<<2,mo=(mo&61680)>>4|(mo&3855)<<4,Hx[gn]=((mo&65280)>>8|(mo&255)<<8)>>1}var Mu=function(e,t,n){for(var r=e.length,s=0,i=new $l(t);s<r;++s)e[s]&&++i[e[s]-1];var a=new $l(t);for(s=1;s<t;++s)a[s]=a[s-1]+i[s-1]<<1;var l;if(n){l=new $l(1<<t);var c=15-t;for(s=0;s<r;++s)if(e[s])for(var u=s<<4|e[s],f=t-e[s],d=a[e[s]-1]++<<f,p=d|(1<<f)-1;d<=p;++d)l[Hx[d]>>c]=u}else for(l=new $l(r),s=0;s<r;++s)e[s]&&(l[s]=Hx[a[e[s]-1]++]>>15-e[s]);return l},$d=new es(288);for(var gn=0;gn<144;++gn)$d[gn]=8;for(var gn=144;gn<256;++gn)$d[gn]=9;for(var gn=256;gn<280;++gn)$d[gn]=7;for(var gn=280;gn<288;++gn)$d[gn]=8;var bA=new es(32);for(var gn=0;gn<32;++gn)bA[gn]=5;var IO=Mu($d,9,1),RO=Mu(bA,5,1),Jg=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Ls=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},Xg=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},TO=function(e){return(e+7)/8|0},Db=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new es(e.subarray(t,n))},MO=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],ms=function(e,t,n){var r=new Error(t||MO[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,ms),!n)throw r;return r},$O=function(e,t,n,r){var s=e.length,i=r?r.length:0;if(!s||t.f&&!t.l)return n||new es(0);var a=!n,l=a||t.i!=2,c=t.i;a&&(n=new es(s*3));var u=function(ue){var de=n.length;if(ue>de){var xe=new es(Math.max(de*2,ue));xe.set(n),n=xe}},f=t.f||0,d=t.p||0,p=t.b||0,h=t.l,g=t.d,k=t.m,w=t.n,y=s*8;do{if(!h){f=Ls(e,d,1);var v=Ls(e,d+1,3);if(d+=3,v)if(v==1)h=IO,g=RO,k=9,w=5;else if(v==2){var j=Ls(e,d,31)+257,A=Ls(e,d+10,15)+4,I=j+Ls(e,d+5,31)+1;d+=14;for(var D=new es(I),H=new es(19),V=0;V<A;++V)H[_O[V]]=Ls(e,d+V*3,7);d+=A*3;for(var F=Jg(H),L=(1<<F)-1,M=Mu(H,F,1),V=0;V<I;){var K=M[Ls(e,d,L)];d+=K&15;var b=K>>4;if(b<16)D[V++]=b;else{var W=0,$=0;for(b==16?($=3+Ls(e,d,3),d+=2,W=D[V-1]):b==17?($=3+Ls(e,d,7),d+=3):b==18&&($=11+Ls(e,d,127),d+=7);$--;)D[V++]=W}}var R=D.subarray(0,j),B=D.subarray(j);k=Jg(R),w=Jg(B),h=Mu(R,k,1),g=Mu(B,w,1)}else ms(1);else{var b=TO(d)+4,C=e[b-4]|e[b-3]<<8,N=b+C;if(N>s){c&&ms(0);break}l&&u(p+C),n.set(e.subarray(b,N),p),t.b=p+=C,t.p=d=N*8,t.f=f;continue}if(d>y){c&&ms(0);break}}l&&u(p+131072);for(var _=(1<<k)-1,X=(1<<w)-1,z=d;;z=d){var W=h[Xg(e,d)&_],T=W>>4;if(d+=W&15,d>y){c&&ms(0);break}if(W||ms(2),T<256)n[p++]=T;else if(T==256){z=d,h=null;break}else{var Z=T-254;if(T>264){var V=T-257,ae=mA[V];Z=Ls(e,d,(1<<ae)-1)+wA[V],d+=ae}var J=g[Xg(e,d)&X],se=J>>4;J||ms(3),d+=J&15;var B=PO[se];if(se>3){var ae=gA[se];B+=Xg(e,d)&(1<<ae)-1,d+=ae}if(d>y){c&&ms(0);break}l&&u(p+131072);var ee=p+Z;if(p<B){var re=i-B,ne=Math.min(B,ee);for(re+p<0&&ms(3);p<ne;++p)n[p]=r[re+p]}for(;p<ee;++p)n[p]=n[p-B]}}t.l=h,t.p=z,t.b=p,t.f=f,h&&(f=1,t.m=k,t.d=g,t.n=w)}while(!f);return p!=n.length&&a?Db(n,0,p):n.subarray(0,p)},LO=new es(0),di=function(e,t){return e[t]|e[t+1]<<8},Hs=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},Qg=function(e,t){return Hs(e,t)+Hs(e,t+4)*4294967296};function OO(e,t){return $O(e,{i:2},t&&t.out,t&&t.dictionary)}var Wx=typeof TextDecoder<"u"&&new TextDecoder,DO=0;try{Wx.decode(LO,{stream:!0}),DO=1}catch{}var FO=function(e){for(var t="",n=0;;){var r=e[n++],s=(r>127)+(r>223)+(r>239);if(n+s>e.length)return{s:t,r:Db(e,n-1)};s?s==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):s&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r)}};function zO(e,t){if(t){for(var n="",r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}else{if(Wx)return Wx.decode(e);var s=FO(e),i=s.s,n=s.r;return n.length&&ms(8),i}}var BO=function(e,t){return t+30+di(e,t+26)+di(e,t+28)},HO=function(e,t,n){var r=di(e,t+28),s=zO(e.subarray(t+46,t+46+r),!(di(e,t+8)&2048)),i=t+46+r,a=Hs(e,t+20),l=n&&a==4294967295?WO(e,i):[a,Hs(e,t+24),Hs(e,t+42)],c=l[0],u=l[1],f=l[2];return[di(e,t+10),c,u,s,i+di(e,t+30)+di(e,t+32),f]},WO=function(e,t){for(;di(e,t)!=1;t+=4+di(e,t+2));return[Qg(e,t+12),Qg(e,t+4),Qg(e,t+20)]};function VO(e,t){for(var n={},r=e.length-22;Hs(e,r)!=101010256;--r)(!r||e.length-r>65558)&&ms(13);var s=di(e,r+8);if(!s)return{};var i=Hs(e,r+16),a=i==4294967295||s==65535;if(a){var l=Hs(e,r-12);a=Hs(e,l)==101075792,a&&(s=Hs(e,l+32),i=Hs(e,l+48))}for(var c=0;c<s;++c){var u=HO(e,i,a),f=u[0],d=u[1],p=u[2],h=u[3],g=u[4],k=u[5],w=BO(e,k);i=g,f?f==8?n[h]=OO(e.subarray(w,w+d),{out:new es(p)}):ms(14,"unknown compression type "+f):n[h]=Db(e,w,w+d)}return n}const KO=8*1024*1024,UO=500;function qO(e){if(e==null||typeof e!="string")return null;let t=e.replace(/\\/g,"/").replace(/^\uFEFF/,"");for(;t.startsWith("/");)t=t.slice(1);if(!t||t.includes("\0")||/^[a-zA-Z]:/.test(t))return null;const n=t.split("/").filter(r=>r.length>0);for(const r of n)if(r==="."||r==="..")return null;return n.join("/")}function YO(e){return e?e.split("/").some(n=>n==="__MACOSX"||n.startsWith("._")):!0}function GO(e){const t=e.toLowerCase();if(t==="flow.yaml"||t==="flow.yml")return"";const n="/flow.yaml",r="/flow.yml";let s=null;if(t.endsWith(n))s=e.slice(0,-n.length);else if(t.endsWith(r))s=e.slice(0,-r.length);else return null;return s.includes("/")?null:s}const JO=/^[a-zA-Z][a-zA-Z0-9_-]*$/;async function XO(e){try{const t=new Uint8Array(await e.arrayBuffer()),n=VO(t),r=new Map;let s=0,i=0;for(const[c,u]of Object.entries(n)){if(c.endsWith("/"))continue;const f=qO(c);if(!f||YO(f))continue;const d=(u==null?void 0:u.length)??0;if(s+=d,s>KO||(i+=1,i>UO))return null;r.set(f,d)}if(r.size===0)return null;const a=new Set;for(const c of r.keys()){const u=GO(c);u!==null&&a.add(u)}if(a.size!==1)return null;const[l]=[...a];if(l==="")return null;for(const c of r.keys())if(!(c===l||c.startsWith(`${l}/`)))return null;return JO.test(l)?l:null}catch{return null}}const Zg=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function QO({file:e,onClose:t,onImported:n}){const{t:r}=Ir(),s=m.useId(),i=m.useRef(null),a=m.useRef(null),[l,c]=m.useState(""),[u,f]=m.useState("user"),[d,p]=m.useState(!1),[h,g]=m.useState(""),[k,w]=m.useState(null),y=k??e;m.useEffect(()=>{const N=requestAnimationFrame(()=>{var j;return(j=i.current)==null?void 0:j.focus()});return()=>cancelAnimationFrame(N)},[]),m.useEffect(()=>{let N=!1;return(async()=>{const j=y.name||"",A=j.toLowerCase();let I="";if(A.endsWith(".zip")){if(I=await XO(y)||"",!I){const D=j.replace(/\.zip$/i,"");Zg.test(D)&&(I=D)}}else if(A.endsWith(".yaml")||A.endsWith(".yml")){const D=j.replace(/\.ya?ml$/i,"");Zg.test(D)&&(I=D)}N||c(I)})(),()=>{N=!0}},[y]);const v=l.trim(),b=v.length>0&&Zg.test(v);async function C(N){if(N.preventDefault(),!(!b||d)){p(!0),g("");try{const j=new FormData;j.set("flowId",v),j.set("targetSpace",u),j.set("file",y,y.name);const A=await fetch("/api/flows/import",{method:"POST",body:j}),I=await A.json().catch(()=>({}));if(!A.ok){g(typeof I.error=="string"?I.error:r("project:importModal.importFailed"));return}n({id:I.flowId,source:I.flowSource??"user"})}catch(j){g(String((j==null?void 0:j.message)||j))}finally{p(!1)}}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:N=>{N.target===N.currentTarget&&t()},children:o.jsxs("div",{ref:i,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":s,tabIndex:-1,onMouseDown:N=>N.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:s,className:"af-shortcuts-panel__title",children:r("project:importModal.title")}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":r("project:importModal.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:C,children:[o.jsx("p",{className:"af-new-pipeline-lead",children:r("project:importModal.lead",{filename:y.name})}),o.jsx("input",{ref:a,type:"file",className:"af-import-file-input",accept:".yaml,.yml,.zip,application/zip","aria-hidden":!0,tabIndex:-1,onChange:N=>{var A;const j=(A=N.target.files)==null?void 0:A[0];j&&w(j),N.target.value=""}}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:r("project:importModal.nameLabel")}),o.jsx("input",{className:"af-new-pipeline-input",type:"text",name:"importFlowId",autoComplete:"off",spellCheck:!1,placeholder:r("project:importModal.namePlaceholder"),value:l,onChange:N=>c(N.target.value),"aria-invalid":v.length>0&&!b}),o.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-hint",children:r("project:importModal.nameHint")})]}),o.jsx("div",{className:"af-import-repick",children:o.jsx("button",{type:"button",className:"af-btn-secondary af-import-repick-btn",onClick:()=>{var N;return(N=a.current)==null?void 0:N.click()},children:r("project:importModal.changeFile")})}),h?o.jsx("p",{className:"af-err af-new-pipeline-err",children:h}):null,o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:d,children:r("project:importModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!b||d,children:r(d?"project:importModal.importing":"project:importModal.importAndOpen")})]})]})]})})}const ZO=/^[a-zA-Z][a-zA-Z0-9_-]*$/,aN="af:newPipelineGuide";function eD({open:e,onClose:t,onCreated:n}){const{t:r}=Ir(),s=m.useId(),i=m.useRef(null),[a,l]=m.useState(""),[c,u]=m.useState(""),[f,d]=m.useState("user"),[p,h]=m.useState(!1),[g,k]=m.useState(""),[w,y]=m.useState(!1);m.useEffect(()=>{if(!e)return;l(""),u(""),d("user"),k(""),h(!1),localStorage.getItem(aN)==="true"&&y(!0);const A=requestAnimationFrame(()=>{var I;return(I=i.current)==null?void 0:I.focus()});return()=>cancelAnimationFrame(A)},[e]);const v=()=>{localStorage.removeItem(aN),y(!1)};if(!e)return null;const b=a.trim(),C=b.length>0&&ZO.test(b);async function N(j){if(j.preventDefault(),!(!C||p)){h(!0),k(""),v();try{const A=await fetch("/api/flows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:b,description:c.trim(),targetSpace:f})}),I=await A.json().catch(()=>({}));if(!A.ok){k(typeof I.error=="string"?I.error:r("project:newPipelineModal.createFailed"));return}n({id:I.flowId,source:I.flowSource??"user"})}catch(A){k(String((A==null?void 0:A.message)||A))}finally{h(!1)}}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:j=>{j.target===j.currentTarget&&(v(),t())},children:o.jsxs("div",{ref:i,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":s,tabIndex:-1,onMouseDown:j=>j.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:s,className:"af-shortcuts-panel__title",children:r("project:newPipelineModal.title")}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:()=>{v(),t()},"aria-label":r("project:newPipelineModal.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),w?o.jsx("div",{className:"af-new-pipeline-guide",children:o.jsxs("div",{className:"af-new-pipeline-guide-content",children:[o.jsx("span",{className:"material-symbols-outlined af-new-pipeline-guide-icon",children:"lightbulb"}),o.jsxs("div",{className:"af-new-pipeline-guide-text",children:[o.jsx("p",{children:o.jsx("strong",{children:r("onboarding:newPipeline.guideTitle")})}),o.jsx("p",{children:r("onboarding:newPipeline.guideDesc")})]}),o.jsx("button",{type:"button",className:"af-new-pipeline-guide-close",onClick:v,children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]})}):null,o.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:N,children:[o.jsx("p",{className:"af-new-pipeline-lead",children:r("project:newPipelineModal.lead")}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:r("project:newPipelineModal.nameLabel")}),o.jsx("input",{className:"af-new-pipeline-input",type:"text",name:"pipelineName",autoComplete:"off",spellCheck:!1,placeholder:r("project:newPipelineModal.namePlaceholder"),value:a,onChange:j=>l(j.target.value),"aria-invalid":b.length>0&&!C}),o.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-hint",children:r(w?"onboarding:newPipeline.nameHintGuide":"project:newPipelineModal.nameHint")})]}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:r("project:newPipelineModal.descLabel")}),o.jsx("textarea",{className:"af-pipeline-drawer-textarea af-new-pipeline-textarea",name:"pipelineDescription",rows:3,placeholder:r(w?"onboarding:newPipeline.descPlaceholderGuide":"project:newPipelineModal.descPlaceholder"),value:c,onChange:j=>u(j.target.value)}),w?o.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-guide-hint",children:r("onboarding:newPipeline.descHintGuide")}):null]}),g?o.jsx("p",{className:"af-err af-new-pipeline-err",children:g}):null,o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:()=>{v(),t()},disabled:p,children:r("project:newPipelineModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!C||p,children:r(p?"project:newPipelineModal.creating":w?"onboarding:newPipeline.createGuide":"project:newPipelineModal.createAndOpen")})]})]})]})})}const kA="agentflow.pipelineViewPreference";function vA(e,t="user",n=!1){return`${String(t||"user")}:${String(e||"")}:${n?"archived":"active"}`}function SA(){if(typeof localStorage>"u")return{};try{const e=JSON.parse(localStorage.getItem(kA)||"{}");return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}catch{return{}}}function tD(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(kA,JSON.stringify(e))}catch{}}function Fb(e){return e==="display"?"display":"workspace"}function nD(e){const t=String(e||"").toLowerCase();return t==="builtin"||t==="admin"}function NA(e,t){const n=Fb(t);return n==="pipeline"&&nD(e==null?void 0:e.source)?"workspace":n}function rD(e){return(e==null?void 0:e.hasPipeline)!==!1&&(e==null?void 0:e.hasFlow)!==!1&&(e==null?void 0:e.flowYaml)!==!1}function sD(e,t,n,r=!1){if(!e)return;const s=SA();s[vA(e,t,r)]={view:Fb(n),at:Date.now()},tD(s)}function iD(e,t="workspace"){if(!(e!=null&&e.id))return Fb(t);const r=SA()[vA(e.id,e.source??"user",!!e.archived)],s=NA(e,(r==null?void 0:r.view)||t);return s==="pipeline"&&!rD(e)?"workspace":s}function oD(e,t="workspace"){var s;const n=NA(e,t);if(!(e!=null&&e.id))return n==="display"?"/workspace?view=display":"/workspace";const r=new URLSearchParams({flowId:e.id,flowSource:e.source??"user"});return(s=e.collaboration)!=null&&s.id&&r.set("workspaceId",e.collaboration.id),e.archived&&r.set("archived","1"),n==="display"&&r.set("view","display"),`/workspace?${r.toString()}`}function Vf(e,t="workspace"){return oD(e,iD(e,t))}function aD(e,t){const n=String(e||"").split(/[.-]/).map(i=>Number.parseInt(i,10)),r=String(t||"").split(/[.-]/).map(i=>Number.parseInt(i,10)),s=Math.max(n.length,r.length);for(let i=0;i<s;i+=1){const a=Number.isFinite(n[i])?n[i]:0,l=Number.isFinite(r[i])?r[i]:0;if(a!==l)return a>l?1:-1}return 0}function Vx(e){return String((e==null?void 0:e.version)||"").trim()}function lD(e){const t=Vx(e),n=[(e==null?void 0:e.agent)||"codex",(e==null?void 0:e.kind)||"skill"];return t&&n.push(`v${t}`),n.join(" · ")}function cD({onChanged:e,canManage:t=!1}){const[n,r]=m.useState({available:!1,version:"",loggedIn:!1,user:"",error:""}),[s,i]=m.useState([]),[a,l]=m.useState(""),[c,u]=m.useState(""),[f,d]=m.useState("keyword"),[p,h]=m.useState([]),[g,k]=m.useState({}),[w,y]=m.useState(""),[v,b]=m.useState(""),[C,N]=m.useState(""),j=m.useCallback(async()=>{b("");try{const[F,L]=await Promise.all([fetch("/api/skillhub/status"),fetch("/api/skillhub/list?target=agentflow&agent=codex")]),M=await F.json().catch(()=>({}));F.ok&&r({available:!!M.available,version:typeof M.version=="string"?M.version:"",loggedIn:!!M.loggedIn,user:typeof M.user=="string"?M.user:"",error:typeof M.error=="string"?M.error:""});const K=await L.json().catch(()=>({}));if(!L.ok)throw new Error(typeof K.error=="string"?K.error:"HTTP "+L.status);i(Array.isArray(K.skills)?K.skills:[]),l(typeof K.skillsRoot=="string"?K.skillsRoot:""),k({})}catch(F){b(String(F.message||F))}},[]);m.useEffect(()=>{j()},[j]);const A=m.useCallback(async()=>{const F=c.trim();if(F){y("search"),b(""),N("");try{const L=await fetch(`/api/skillhub/search?q=${encodeURIComponent(F)}&mode=${encodeURIComponent(f)}`),M=await L.json().catch(()=>({}));if(!L.ok)throw new Error(typeof M.error=="string"?M.error:"HTTP "+L.status);h(Array.isArray(M.items)?M.items:[])}catch(L){b(String(L.message||L))}finally{y("")}}},[c,f]),I=m.useCallback(async(F,L=!1)=>{if(!t)return;const M=F&&typeof F=="object"?F:null,K=String(M?M.slug||M.name||M.collection||M.skillId||M.id:F||"").trim();if(K){y(`install:${K}`),b(""),N("");try{const W=M?{slug:M.slug||"",skillId:M.skillId||"",collection:M.collection||"",collectionName:M.collection&&M.name||"",target:"agentflow",agent:"codex",force:L}:{slug:K,target:"agentflow",agent:"codex",force:L},$=await fetch("/api/skillhub/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(W)}),R=await $.json().catch(()=>({}));if(!$.ok)throw new Error(typeof R.error=="string"?R.error:"HTTP "+$.status);N(L?`已更新 ${K}`:`已安装 ${K}`),await j(),typeof e=="function"&&await e()}catch(W){b(String(W.message||W))}finally{y("")}}},[t,j,e]),D=m.useCallback(async()=>{if(t&&s.length!==0){y("check-updates"),b(""),N("");try{const F=await Promise.all(s.map(async K=>{const W=String(K.name||"").trim();if(!W)return null;try{const $=await fetch(`/api/skillhub/search?q=${encodeURIComponent(W)}&mode=keyword`),R=await $.json().catch(()=>({}));if(!$.ok)throw new Error(typeof R.error=="string"?R.error:"HTTP "+$.status);const B=Array.isArray(R.items)?R.items:[],_=B.find(Z=>Z.slug===W||Z.name===W||Z.id===W)||B[0],X=Vx(K),z=String((_==null?void 0:_.version)||"").trim();let T="unknown";return _?X&&z?T=aD(X,z)<0?"update":"current":z&&(T="remote-only"):T="missing",[W,{state:T,latestVersion:z,installedVersion:X,summary:(_==null?void 0:_.summary)||""}]}catch($){return[W,{state:"error",error:String($.message||$),installedVersion:Vx(K)}]}})),L={};for(const K of F)K&&(L[K[0]]=K[1]);k(L);const M=Object.values(L).filter(K=>K.state==="update").length;N(M>0?`发现 ${M} 个可更新 skill`:"已检查,暂无明确可更新项")}finally{y("")}}},[t,s]),H=m.useCallback(async F=>{if(!t)return;const L=String(F||"").trim();if(L){y(`uninstall:${L}`),b(""),N("");try{const M=await fetch("/api/skillhub/uninstall",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:L,target:"agentflow",agent:"codex"})}),K=await M.json().catch(()=>({}));if(!M.ok)throw new Error(typeof K.error=="string"?K.error:"HTTP "+M.status);N(`已卸载 ${L}`),await j(),typeof e=="function"&&await e()}catch(M){b(String(M.message||M))}finally{y("")}}},[t,j,e]),V=m.useCallback(async()=>{if(t){y("update-cli"),b(""),N("");try{const F=await fetch("/api/skillhub/update",{method:"POST"}),L=await F.json().catch(()=>({}));if(!F.ok)throw new Error(typeof L.error=="string"?L.error:"HTTP "+F.status);N("SkillHub CLI 已更新"),await j()}catch(F){b(String(F.message||F))}finally{y("")}}},[t,j]);return o.jsxs("section",{className:"af-set-card af-set-card--span-all af-set-skillhub",children:[o.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"af-set-h2",children:"SkillHub"}),o.jsx("p",{className:"af-set-p af-set-p--tight",children:t?"搜索、安装、更新和卸载 AgentFlow 共享 skills。":"查看 AgentFlow 共享 skills;使用时在 Workspace 中通过 Load Skills 加载。"}),a?o.jsxs("p",{className:"af-set-hint af-set-hint--inline",children:["Skills Root:",o.jsx("code",{children:a})]}):null]}),o.jsxs("div",{className:"af-set-skillhub-head-actions",children:[o.jsxs("div",{className:"af-set-skillhub-status",children:[o.jsx("span",{className:"material-symbols-outlined af-set-icon--tertiary",children:"extension"}),o.jsx("span",{children:n.loggedIn?`已登录 ${n.user}`:"未登录 SkillHub"}),o.jsx("span",{className:"af-set-badge"+(n.available?" af-set-badge--ok":" af-set-badge--err"),children:n.available?`v${n.version}`:"not found"})]}),o.jsxs("div",{className:"af-set-skillhub-toolbar",children:[o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:j,disabled:!!w,children:"刷新"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:D,disabled:!t||!!w||s.length===0,children:w==="check-updates"?"检查中…":"检查更新"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:V,disabled:!t||!!w,children:w==="update-cli"?"更新中…":"更新 CLI"})]})]})]}),o.jsxs("div",{className:"af-set-skillhub-search",children:[o.jsxs("select",{className:"af-set-input af-set-input--sm af-set-skillhub-search-mode",value:f,onChange:F=>{d(F.target.value),h([])},children:[o.jsx("option",{value:"keyword",children:"关键词"}),o.jsx("option",{value:"skillId",children:"Skill ID"}),o.jsx("option",{value:"collectionId",children:"Collection ID"})]}),o.jsx("input",{className:"af-set-input af-set-input--sm",value:c,onChange:F=>u(F.target.value),onKeyDown:F=>{F.key==="Enter"&&A()},placeholder:f==="collectionId"?"输入 collection id,例如 1":f==="skillId"?"输入 skill id":"搜索 skill slug / 关键词,例如 android、issue-tracker"}),o.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:()=>A(),disabled:!c.trim()||w==="search",children:[o.jsx("span",{className:"material-symbols-outlined",children:"search"}),w==="search"?"搜索中…":"搜索"]})]}),v?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:v}):null,C?o.jsx("p",{className:"af-set-hint af-set-hint--inline",children:C}):null,o.jsxs("div",{className:"af-set-skillhub-grid",children:[o.jsxs("div",{className:"af-set-skillhub-pane",children:[o.jsxs("div",{className:"af-set-skillhub-pane-head",children:[o.jsx("h3",{children:"已安装"}),o.jsx("span",{children:s.length})]}),o.jsx("div",{className:"af-set-skillhub-list",children:s.length===0?o.jsx("div",{className:"af-set-skillhub-empty",children:"暂无 AgentFlow 共享 skills"}):s.map(F=>{const L=g[F.name],M=!L||L.state==="update"||L.state==="remote-only"||L.state==="unknown"||L.state==="error",K=w===`install:${F.name}`?"更新中…":(L==null?void 0:L.state)==="current"?"已最新":(L==null?void 0:L.state)==="update"&&L.latestVersion?`更新到 v${L.latestVersion}`:(L==null?void 0:L.state)==="remote-only"&&L.latestVersion?`安装 v${L.latestVersion}`:"重装";return o.jsxs("div",{className:"af-set-skillhub-item",children:[o.jsxs("div",{children:[o.jsx("div",{className:"af-set-skillhub-title",children:F.displayName||F.name}),o.jsx("div",{className:"af-set-skillhub-meta",children:lD(F)}),o.jsx("div",{className:"af-set-skillhub-version-row",children:L?L.state==="update"?o.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--warn",children:["可更新 ",L.installedVersion?`v${L.installedVersion} -> `:"","v",L.latestVersion]}):L.state==="current"?o.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--ok",children:["已最新 v",L.latestVersion||L.installedVersion]}):L.state==="remote-only"?o.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:["远端 v",L.latestVersion,",本地版本未知"]}):L.state==="missing"?o.jsx("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:"未找到远端匹配项"}):L.state==="error"?o.jsx("span",{className:"af-set-skillhub-version af-set-skillhub-version--err",children:"检查失败"}):o.jsx("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:"状态未知"}):o.jsx("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:"未检查远端版本"})})]}),o.jsxs("div",{className:"af-set-skillhub-actions",children:[o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>I(F.name,!0),disabled:!t||!!w||!M,children:K}),o.jsx("button",{type:"button",className:"af-set-btn-mini af-set-btn-mini--danger",onClick:()=>H(F.name),disabled:!t||!!w,children:"卸载"})]})]},`${F.agent}:${F.path}:${F.name}`)})})]}),o.jsxs("div",{className:"af-set-skillhub-pane",children:[o.jsxs("div",{className:"af-set-skillhub-pane-head",children:[o.jsx("h3",{children:"搜索结果"}),o.jsx("span",{children:p.length})]}),o.jsx("div",{className:"af-set-skillhub-list",children:p.length===0?o.jsx("div",{className:"af-set-skillhub-empty",children:"输入关键词后搜索 SkillHub"}):p.map(F=>{const L=F.slug||F.name,M=F.kind==="collection"||F.collection,K=!M&&s.some(W=>W.name===L||W.name===F.name);return o.jsxs("div",{className:"af-set-skillhub-item",children:[o.jsxs("div",{children:[o.jsx("div",{className:"af-set-skillhub-title",children:F.name||L}),o.jsxs("div",{className:"af-set-skillhub-meta",children:[M?`collection:${F.collection}`:L,F.skillId?` · id:${F.skillId}`:"",F.version?` · ${F.version}`:""]}),F.summary?o.jsx("p",{className:"af-set-skillhub-summary",children:F.summary}):null]}),o.jsx("button",{type:"button",className:K?"af-set-btn-mini":"af-set-btn-add af-set-btn-add--compact",onClick:()=>I(F,K),disabled:!t||!!w,children:K?"更新":M?"安装合集":"安装"})]},F.id||L)})})]})]})]})}function Sa(e){return(Array.isArray(e==null?void 0:e.collections)?e.collections:[]).filter(n=>n&&typeof n=="object").map(n=>({id:String(n.id||n.name||"").trim(),name:String(n.name||n.id||"").trim(),skillKeys:Array.from(new Set((Array.isArray(n.skillKeys)?n.skillKeys:[]).map(r=>String(r||"").trim()).filter(Boolean))),builtin:!!n.builtin,createdAt:Number.isFinite(n.createdAt)?Number(n.createdAt):Date.now(),updatedAt:Number.isFinite(n.updatedAt)?Number(n.updatedAt):Date.now()})).filter(n=>n.id&&n.name)}function uD(e){return{version:1,collections:Sa({collections:e})}}function dD(e){const t=String(e||"").trim(),n=t.indexOf(":");return n>=0?t.slice(n+1).trim():t}function jA(e){const t=new Map,n=new Map;for(const r of Array.isArray(e)?e:[])r!=null&&r.key&&t.set(r.key,r.key),r!=null&&r.name&&(r!=null&&r.key)&&!n.has(r.name)&&n.set(r.name,r.key);return r=>{const s=String(r||"").trim();return s&&(t.get(s)||n.get(dD(s)))||""}}function Ho(e,t){const n=jA(t);return Array.from(new Set((Array.isArray(e==null?void 0:e.skillKeys)?e.skillKeys:[]).map(r=>n(r)).filter(Boolean)))}function fD(e,t){const n=new Set(Array.isArray(e)?e:[]);for(const r of Array.isArray(t)?t:[])r&&n.add(r);return Array.from(n)}function pD(e,t){const n=new Set(Array.isArray(t)?t:[]);return(Array.isArray(e)?e:[]).filter(r=>!n.has(r))}function hD(e,t,n){const r=Ho(e,n);if(r.length===0)return"empty";const s=r.filter(i=>t.has(i)).length;return s===0?"none":s===r.length?"all":"partial"}function mD(e,t,n){const r=String(e).trim().toLowerCase(),s=Sa({collections:n}).find(i=>i.id===r||i.name.toLowerCase()===r);return Ho(s,t)}function gD(e,t,n,r){const s=(Array.isArray(n)?n:[]).map(u=>u.key).filter(Boolean),i=String(t).trim().toLowerCase(),a=Sa({collections:r}),l=mD(t,n,r),c=l.length>0?l:s;if(!e)return c;try{const u=localStorage.getItem(e);if(u!==null){const f=JSON.parse(u);if(Array.isArray(f)){const d=jA(n),p=Array.from(new Set(f.map(d).filter(Boolean)));if(s.length>0&&p.length===s.length)return c;const h=new Set(p),g=new Set(l),k=l.length>0&&l.every(y=>h.has(y)),w=a.some(y=>{if(!y.builtin||y.id===i||y.name.toLowerCase()===i)return!1;const v=Ho(y,n);return v.length>0&&v.every(b=>h.has(b))});return l.length>0&&w&&!k?c:p}}}catch{}return c}function fl(e){return e==="builtin"?"af-proj-badge af-proj-badge--builtin":e==="secondary"?"af-proj-badge af-proj-badge--secondary":e==="primary"?"af-proj-badge af-proj-badge--primary":e==="muted"?"af-proj-badge af-proj-badge--muted":"af-proj-badge"}function yD(e){const t=e??"user";return t==="builtin"||t==="admin"?"af-project-card af-project-card--builtin":"af-project-card"}function xD(e){return e==="executed"?"material-symbols-outlined af-act-icon af-act-icon--executed":"material-symbols-outlined af-act-icon af-act-icon--opened"}function Kx(e,t){return e==="builtin"?{label:t("project:sourceBadge.builtin"),tone:"builtin"}:e==="admin"?{label:t("project:sourceBadge.builtin"),tone:"builtin"}:e==="workspace"?{label:t("project:sourceBadge.workspace"),tone:"secondary"}:{label:t("project:sourceBadge.user"),tone:"primary"}}function CA(e){var n;if((n=e.collaboration)!=null&&n.role&&e.collaboration.role!=="owner")return`共享 Project / ${e.collaboration.ownerUsername||e.collaboration.ownerId} / ${e.id}`;const t=e.source??"user";return t==="builtin"?`builtin/pipelines / ${e.id}`:t==="admin"?`admin builtin / ${e.ownerUserId||"-"} / ${e.id}`:t==="workspace"?e.archived?`.workspace/agentflow/pipelines/_archived / ${e.id}`:`.workspace/agentflow/pipelines / ${e.id}`:e.archived?`~/agentflow/pipelines/_archived / ${e.id}`:`~/agentflow/pipelines / ${e.id}`}const wD="project:defaultCardDesc";function _A(e,t){const n=e.description!=null?String(e.description).trim():"";return n!==""?n:t(wD)}function bD(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function On({children:e,className:t="",query:n}){const r=n.trim(),s=String(e);if(!r)return o.jsx("span",{className:t,children:s});const i=new RegExp(`(${bD(r)})`,"gi"),a=s.split(i);return o.jsx("span",{className:t,children:a.map((l,c)=>c%2===1?o.jsx("mark",{className:"af-search-hit",children:l},c):o.jsx("span",{children:l},c))})}function kD(e,t,n){const r=[String(e.id),_A(e,n),CA(e),Kx(e.source,n).label];return e.archived&&r.push(n("project:archived")),r.join(`
|
|
41
|
-
`).toLowerCase()}function vD(e,t,n){return t?kD(e,t,n).includes(t):!0}function SD(e,t){const n=e.trim().toLowerCase();if(!n)return!0;const r=String(t.flowId).toLowerCase(),s=String(t.flowSource??"user").toLowerCase();return r.includes(n)||s.includes(n)}function ey(e,t){const n=e.trim().toLowerCase();return n?t.filter(Boolean).join(`
|
|
42
|
-
`).toLowerCase().includes(n):!0}function lN(e,t){return e==="flow"?t("project:resourceSource.flow"):e==="marketplace"?t("project:resourceSource.marketplace"):e==="project"?t("project:resourceSource.global"):e||t("project:resourceSource.global")}function cN(e){return e!=null&&e.packageDir?e.packageDir:`marketplace/flow-snippets / ${(e==null?void 0:e.id)||""}`}const ND=["all","agent","control","provide","marketplace"],jD=["all","agent","control","provide"],EA="agentflow.projects.activityPanelOpen",Ux="agentflow.projects.activitySelected";function CD(){if(typeof localStorage>"u")return!0;const e=localStorage.getItem(EA);return e!=="0"}function uN(e){return`${(e==null?void 0:e.flowSource)||"user"}:${(e==null?void 0:e.flowId)||""}`}function _D(){return typeof localStorage>"u"?"":localStorage.getItem(Ux)||""}function Kf(e){return!e||typeof e!="object"?[]:Object.entries(e).map(([t,n])=>({key:t,...n&&typeof n=="object"?n:{}}))}function Dn(e){return(e==null?void 0:e.key)||`${(e==null?void 0:e.id)||(e==null?void 0:e.name)||""}:${(e==null?void 0:e.source)||""}:${(e==null?void 0:e.packageId)||""}`}function ED(e,t){if((e==null?void 0:e.source)!=="marketplace")return!1;const n=String((e==null?void 0:e.ownerUserId)||(e==null?void 0:e.createdBy)||"").trim();return n?new Set([String((t==null?void 0:t.userId)||"").trim(),String((t==null?void 0:t.username)||"").trim()].filter(Boolean)).has(n):!0}function go(e){return`${(e==null?void 0:e.id)||""}:${(e==null?void 0:e.version)||""}:${(e==null?void 0:e.packageDir)||""}`}function AA(e){var n;const t=(n=e==null?void 0:e.snippet)==null?void 0:n.instances;return Array.isArray(t)?t.filter(r=>r&&typeof r=="object"):t&&typeof t=="object"?Object.entries(t).map(([r,s])=>({...s&&typeof s=="object"?s:{},instanceId:(s==null?void 0:s.instanceId)||r})):[]}function PA(e){var n;const t=(n=e==null?void 0:e.snippet)==null?void 0:n.edges;return Array.isArray(t)?t.filter(r=>r&&typeof r=="object"):[]}function qx(e,t){return String((e==null?void 0:e.instanceId)||(e==null?void 0:e.id)||(e==null?void 0:e.nodeId)||`node_${t+1}`)}function dN(e,t){return String((e==null?void 0:e.label)||(e==null?void 0:e.displayName)||(e==null?void 0:e.name)||qx(e,t))}function AD(e){return String((e==null?void 0:e.definitionId)||(e==null?void 0:e.type)||(e==null?void 0:e.runtimeType)||"").replace(/^marketplace:/,"")}function fN(e,t){return String(t==="source"?(e==null?void 0:e.source)||(e==null?void 0:e.from)||(e==null?void 0:e.sourceId)||(e==null?void 0:e.fromNode)||(e==null?void 0:e.fromInstanceId)||"":(e==null?void 0:e.target)||(e==null?void 0:e.to)||(e==null?void 0:e.targetId)||(e==null?void 0:e.toNode)||(e==null?void 0:e.toInstanceId)||"")}function PD(e){const t=(e==null?void 0:e.sourceHandle)||(e==null?void 0:e.fromHandle)||(e==null?void 0:e.output)||(e==null?void 0:e.outputName),n=(e==null?void 0:e.targetHandle)||(e==null?void 0:e.toHandle)||(e==null?void 0:e.input)||(e==null?void 0:e.inputName);return t&&n?`${t} -> ${n}`:String(t||n||"")}function ty(e,t=16){const n=String(e||"").trim();return n.length<=t?n:`${n.slice(0,t-1)}…`}function ID(e){const t=Number(e==null?void 0:e.x),n=Number(e==null?void 0:e.y);return!Number.isFinite(t)||!Number.isFinite(n)?null:{x:t,y:n}}function RD(e,t){const n=e.map(f=>f.id),r=new Set(n),s=new Map(n.map(f=>[f,0])),i=new Map(n.map(f=>[f,[]]));t.forEach(f=>{var d;!r.has(f.sourceId)||!r.has(f.targetId)||(s.set(f.targetId,(s.get(f.targetId)||0)+1),(d=i.get(f.sourceId))==null||d.push(f.targetId))});const a=new Map,l=n.filter(f=>(s.get(f)||0)===0);l.length===0&&n[0]&&l.push(n[0]),l.forEach(f=>a.set(f,0));for(let f=0;f<l.length;f+=1){const d=l[f],p=(a.get(d)||0)+1;for(const h of i.get(d)||[])(!a.has(h)||p>a.get(h))&&(a.set(h,p),l.push(h))}n.forEach((f,d)=>{a.has(f)||a.set(f,d%3)});const c=new Map,u=new Map;return n.forEach(f=>{const d=a.get(f)||0,p=c.get(d)||0;c.set(d,p+1),u.set(f,{x:d*190,y:p*86})}),u}function TD(e){var k,w,y,v;const t=AA(e),n=PA(e),r=new Map(t.map((b,C)=>[qx(b,C),dN(b,C)])),s=t.map((b,C)=>({id:qx(b,C),title:dN(b,C),meta:AD(b)})),i=n.map((b,C)=>{const N=fN(b,"source"),j=fN(b,"target");return{key:(b==null?void 0:b.id)||`${N}-${j}-${C}`,sourceId:N,targetId:j,source:r.get(N)||N||"?",target:r.get(j)||j||"?",label:PD(b)}}),a=(w=(k=e==null?void 0:e.snippet)==null?void 0:k.ui)!=null&&w.nodePositions&&typeof e.snippet.ui.nodePositions=="object"?e.snippet.ui.nodePositions:{},l=(v=(y=e==null?void 0:e.snippet)==null?void 0:y.ui)!=null&&v.nodeSizes&&typeof e.snippet.ui.nodeSizes=="object"?e.snippet.ui.nodeSizes:{},c=RD(s,i),u=s.map(b=>{const C=ID(a[b.id])||c.get(b.id)||{x:0,y:0},N=l[b.id]&&typeof l[b.id]=="object"?l[b.id]:{},j=Number(N.width),A=Number(N.height),I=Math.max(132,Math.min(210,Number.isFinite(j)?j*.62:150)),D=Math.max(48,Math.min(76,Number.isFinite(A)?A*.46:54));return{...b,x:C.x,y:C.y,width:I,height:D}}),f=new Map(u.map(b=>[b.id,b])),d=i.map(b=>{const C=f.get(b.sourceId),N=f.get(b.targetId);if(!C||!N)return null;const j=C.x+C.width,A=C.y+C.height/2,I=N.x,D=N.y+N.height/2,H=Math.max(48,Math.abs(I-j)*.45);return{...b,path:`M ${j} ${A} C ${j+H} ${A}, ${I-H} ${D}, ${I} ${D}`,labelX:(j+I)/2,labelY:(A+D)/2}}).filter(Boolean),p=u.reduce((b,C)=>({minX:Math.min(b.minX,C.x),minY:Math.min(b.minY,C.y),maxX:Math.max(b.maxX,C.x+C.width),maxY:Math.max(b.maxY,C.y+C.height)}),{minX:0,minY:0,maxX:420,maxY:220}),h=36,g=`${p.minX-h} ${p.minY-h} ${Math.max(360,p.maxX-p.minX+h*2)} ${Math.max(180,p.maxY-p.minY+h*2)}`;return{nodes:s,edges:i,diagram:{nodes:u,edges:d,viewBox:g}}}function pl({resourceKind:e="",authUser:t=null}){var Se,xt,Kt,or,rn,hr;const{t:n}=Ir(),{navigate:r,path:s}=Ni(),i=!!(t!=null&&t.isAdmin),[a,l]=m.useState(e||"all"),[c,u]=m.useState([]),[f,d]=m.useState([]),[p,h]=m.useState([]),[g,k]=m.useState([]),[w,y]=m.useState([]),[v,b]=m.useState(""),[C,N]=m.useState(!1),[j,A]=m.useState([]),[I,D]=m.useState(""),[H,V]=m.useState(""),[F,L]=m.useState(!1),[M,K]=m.useState(!1),[W,$]=m.useState(!1),[R,B]=m.useState(null),[_,X]=m.useState(!1),[z,T]=m.useState(""),[Z,ae]=m.useState(CD),[J,se]=m.useState(_D),[ee,re]=m.useState("all"),[ne,ue]=m.useState(""),[de,xe]=m.useState("overview"),[ze,Te]=m.useState({}),[Le,nt]=m.useState(""),[wt,mt]=m.useState({}),[Re,it]=m.useState(""),[Nt,qt]=m.useState(""),[Zt,rt]=m.useState({}),[fe,ve]=m.useState(""),[He,Ge]=m.useState(""),[je,Tt]=m.useState(""),[kn,dn]=m.useState(""),[en,Pn]=m.useState(""),[te,Ee]=m.useState(!1),[We,Ke]=m.useState(""),[bt,jt]=m.useState({hiddenBuiltins:[],promoted:[]}),qn=m.useRef(0),Ht=m.useRef(0),gt=m.useRef(0),Mn=m.useCallback(async()=>{var ge,Me;const U=++Ht.current;D("");try{const oe=await fetch("/api/flows");if(U!==Ht.current)return;if(!oe.ok)throw new Error("HTTP "+oe.status);const Je=await oe.json();if(U!==Ht.current)return;u(Array.isArray(Je)?Je:[])}catch(oe){if(U!==Ht.current)return;u([]),D(String(oe.message||oe))}try{const oe=await fetch("/api/pipeline-recent-runs");if(U!==Ht.current)return;if(oe.ok){const Je=await oe.json();if(U!==Ht.current)return;A(Array.isArray(Je.runs)?Je.runs:[])}else A([])}catch{if(U!==Ht.current)return;A([])}if(t!=null&&t.isAdmin)try{const oe=await fetch("/api/admin/builtin-flows");if(U!==Ht.current)return;const Je=await oe.json().catch(()=>({}));oe.ok&&jt({hiddenBuiltins:Array.isArray((ge=Je==null?void 0:Je.config)==null?void 0:ge.hiddenBuiltins)?Je.config.hiddenBuiltins:[],promoted:Array.isArray((Me=Je==null?void 0:Je.config)==null?void 0:Me.promoted)?Je.config.promoted:[]})}catch{if(U!==Ht.current)return;jt({hiddenBuiltins:[],promoted:[]})}else jt({hiddenBuiltins:[],promoted:[]});L(!0)},[t==null?void 0:t.isAdmin]),Pt=m.useCallback(async(U,ge)=>{if(!(t!=null&&t.isAdmin)||!(U!=null&&U.id))return;const Me=`${ge}:${U.source}:${U.id}`;Ke(Me),D("");try{const oe=await fetch("/api/admin/builtin-flows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:ge,flowId:U.id,ownerUserId:U.ownerUserId||t.userId})}),Je=await oe.json().catch(()=>({}));if(!oe.ok)throw new Error(Je.error||"更新内置配置失败");await Mn()}catch(oe){D(String(oe.message||oe))}finally{Ke("")}},[t==null?void 0:t.isAdmin,t==null?void 0:t.userId,Mn]),fn=m.useCallback(async()=>{const U=++gt.current;V(""),K(!1);const ge="/api/nodes",Me=e==="my-flows"?"/api/marketplace/flow-snippets?scope=owned":"/api/marketplace/flow-snippets";d([]),k([]),ue("");try{const[oe,Je,dt,_t]=await Promise.all([fetch(ge),fetch("/api/skills"),fetch("/api/skill-collections"),fetch(Me)]),pn=await oe.json().catch(()=>({})),Gr=await Je.json().catch(()=>({})),_i=await dt.json().catch(()=>({})),io=await _t.json().catch(()=>({}));if(!oe.ok)throw new Error(pn.error||"Nodes HTTP "+oe.status);if(!Je.ok)throw new Error(Gr.error||"Skills HTTP "+Je.status);if(!dt.ok)throw new Error(_i.error||"Collections HTTP "+dt.status);if(!_t.ok)throw new Error(io.error||"Flow snippets HTTP "+_t.status);if(U!==gt.current)return;d(Array.isArray(pn.nodes)?pn.nodes:Array.isArray(pn)?pn:[]),h(Array.isArray(Gr.skills)?Gr.skills:[]),y(Sa(_i)),k(Array.isArray(io.snippets)?io.snippets:[])}catch(oe){if(U!==gt.current)return;d([]),h([]),k([]),y([]),V(String(oe.message||oe))}finally{if(U!==gt.current)return;K(!0)}},[e]);m.useEffect(()=>{L(!1),Mn(),fn()},[Mn,fn]),m.useEffect(()=>{try{localStorage.setItem(EA,Z?"1":"0")}catch{}},[Z]),m.useEffect(()=>{try{J?localStorage.setItem(Ux,J):localStorage.removeItem(Ux)}catch{}},[J]),m.useEffect(()=>{let U=!1;return fetch("/api/ui-context").then(ge=>ge.json()).then(ge=>{U||Ee(!!ge.hideCommunityLinks)}).catch(()=>{}),()=>{U=!0}},[]);const Yn=m.useCallback(async U=>{if(!i)return;const ge=Sa({collections:U});N(!0),V("");try{const Me=await fetch("/api/skill-collections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(uD(ge))}),oe=await Me.json().catch(()=>({}));if(!Me.ok)throw new Error(oe.error||"Collections HTTP "+Me.status);y(Sa(oe))}catch(Me){V(String(Me.message||Me))}finally{N(!1)}},[i]),ei=m.useCallback(()=>{if(!i)return;const U=v.trim();if(!U)return;const ge=U.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"collection",Me=new Set(w.map(_t=>_t.id));let oe=ge,Je=2;for(;Me.has(oe);)oe=`${ge}-${Je++}`;const dt=Date.now();Yn([...w,{id:oe,name:U,skillKeys:[],createdAt:dt,updatedAt:dt}]),b(""),re(`collection:${oe}`)},[i,v,Yn,w]),qr=m.useCallback(U=>{if(!i)return;const ge=w.find(oe=>oe.id===U);if(ge!=null&&ge.builtin)return;const Me=w.filter(oe=>oe.id!==U);ee===`collection:${U}`&&re("all"),Yn(Me)},[i,ee,Yn,w]),Yr=m.useCallback((U,ge,Me)=>{if(!i)return;const oe=String(ge||"").trim();if(!oe)return;const Je=Date.now(),dt=w.map(_t=>{if(_t.id!==U)return _t;const pn=new Set(_t.skillKeys||[]);return Me?pn.add(oe):pn.delete(oe),{..._t,skillKeys:Array.from(pn),updatedAt:Je}});Yn(dt)},[i,Yn,w]),pr=m.useCallback(async U=>{const ge=U==null?void 0:U.packageId,Me=U==null?void 0:U.version;if(!ge||!Me||!window.confirm(n("project:deleteMyNodeConfirm",{id:ge,version:Me})))return;const oe=Dn(U);Ge(oe),Tt(""),V("");try{const Je=new URLSearchParams({id:ge,version:Me}),dt=await fetch(`/api/marketplace/node?${Je.toString()}`,{method:"DELETE"}),_t=await dt.json().catch(()=>({}));if(!dt.ok||(_t==null?void 0:_t.ok)===!1){const pn=Array.isArray(_t==null?void 0:_t.usage)&&_t.usage.length>0?` ${n("project:deleteMyNodeUsedBy",{count:_t.usage.length})}`:"";throw new Error(((_t==null?void 0:_t.error)||"Delete failed")+pn)}Tt(n("project:deleteMyNodeSuccess",{id:ge,version:Me})),mt(pn=>{const Gr={...pn};return delete Gr[oe],Gr}),rt(pn=>{const Gr={};for(const[_i,io]of Object.entries(pn))_i.startsWith(`${oe}:`)||(Gr[_i]=io);return Gr}),ue(""),await fn()}catch(Je){Tt(String(Je.message||Je))}finally{Ge("")}},[fn,n]),on=m.useCallback(async U=>{const ge=U==null?void 0:U.id,Me=(U==null?void 0:U.version)||"1.0.0";if(!ge||!Me||!window.confirm(n("project:deleteMyFlowConfirm",{id:ge,version:Me})))return;const oe=go(U);dn(oe),Pn(""),V("");try{const Je=new URLSearchParams({id:ge,version:Me}),dt=await fetch(`/api/marketplace/flow-snippet?${Je.toString()}`,{method:"DELETE"}),_t=await dt.json().catch(()=>({}));if(!dt.ok||(_t==null?void 0:_t.ok)===!1)throw new Error((_t==null?void 0:_t.error)||"Delete failed");Pn(n("project:deleteMyFlowSuccess",{id:ge,version:Me})),ue(""),await fn()}catch(Je){Pn(String(Je.message||Je))}finally{dn("")}},[fn,n]);m.useEffect(()=>{if(e==="nodes"||e==="my-nodes"||e==="my-flows"||e==="skills"){l(e),re("all"),ue(""),xe("overview");return}l(U=>U==="archived"?"archived":"all")},[e]),m.useEffect(()=>{if(s!=="/projects"&&s!=="/")return;const U=new URLSearchParams(window.location.search),ge=U.get("tab");let Me=!1;if(ge==="nodes"){r("/nodes");return}if(ge==="my-nodes"){r("/my-nodes");return}if(ge==="my-flows"){r("/my-flows");return}if(ge==="skills"){r("/skills");return}if(ge==="archived"?(l("archived"),U.delete("tab"),Me=!0):ge&&(l("all"),U.delete("tab"),Me=!0),U.get("new")==="1"&&($(!0),U.delete("new"),Me=!0),Me){const oe=U.toString();window.history.replaceState({},"",oe?`/projects?${oe}`:"/projects")}},[s,r]);const zn=m.useMemo(()=>jO(j,SO(),c),[j,c,s]),Rr=m.useMemo(()=>zn.filter(U=>SD(z,U)),[zn,z]),In=z.trim().toLowerCase(),Qn=m.useMemo(()=>a==="archived"?c.filter(U=>U.archived):c.filter(U=>!U.archived),[c,a]),vr=m.useMemo(()=>Qn.filter(U=>vD(U,In,n)),[Qn,In,n]),Ns=m.useMemo(()=>new Set((bt.promoted||[]).map(U=>String((U==null?void 0:U.id)||"").trim()).filter(Boolean)),[bt.promoted]),Sr=m.useMemo(()=>(bt.hiddenBuiltins||[]).map(U=>String(U||"").trim()).filter(Boolean),[bt.hiddenBuiltins]),Ft=a==="nodes"||a==="my-nodes",ce=a==="my-nodes",ke=a==="my-flows",tt=m.useMemo(()=>f.filter(U=>ce&&!ED(U,t)?!1:(ee==="all"||(ee==="marketplace"?U.source==="marketplace":U.type===ee))&&ey(z,[U.id,U.label,U.displayName,U.description,U.type,U.source,U.packageId,U.version])),[t,f,ce,z,ee]),yt=m.useMemo(()=>{const U=new Map;for(const ge of w)U.set(ge.id,new Set(Ho(ge,p)));return U},[p,w]),vn=m.useMemo(()=>[{id:"all",label:"全部"},...w.map(U=>{var ge;return{id:`collection:${U.id}`,label:U.name,count:((ge=yt.get(U.id))==null?void 0:ge.size)||0,collection:U}}),{id:"ungrouped",label:"未分组"}],[yt,w]),Jt=m.useMemo(()=>p.filter(U=>{var oe;const ge=Dn(U);let Me=ee==="all";if(ee.startsWith("collection:")){const Je=ee.slice(11);Me=!!((oe=yt.get(Je))!=null&&oe.has(ge))}else ee==="ungrouped"&&(Me=!Array.from(yt.values()).some(Je=>Je.has(ge)));return Me&&ey(z,[U.name,U.id,U.description,U.sourceLabel,U.source,U.path])}),[p,z,ee,yt]),Bn=m.useMemo(()=>g.filter(U=>ey(z,[U.id,U.name,U.displayName,U.description,U.version,U.packageDir,Array.isArray(U.tags)?U.tags.join(" "):""])),[g,z]),us=Ft||ke||a==="skills",ut=m.useMemo(()=>tt.find(U=>Dn(U)===ne)||tt[0]||null,[tt,ne]),Wt=m.useMemo(()=>Jt.find(U=>Dn(U)===ne)||Jt[0]||null,[Jt,ne]),Vt=m.useMemo(()=>Bn.find(U=>go(U)===ne)||Bn[0]||null,[Bn,ne]),$n=Wt?ze[Dn(Wt)]:null,Fe=ut?wt[Dn(ut)]:null,ir=ut&&Nt?Zt[`${Dn(ut)}:${Nt}`]:null,Tr=n(Ft?"project:searchNodes":ke?"project:searchFlows":a==="skills"?"project:searchSkills":"project:searchPipelines");m.useEffect(()=>{if(a!=="skills"||!Wt)return;const U=Dn(Wt);if(ze[U])return;let ge=!1;return nt(U),fetch(`/api/skills/detail?key=${encodeURIComponent(U)}`).then(Me=>Me.json().then(oe=>({ok:Me.ok,json:oe}))).then(({ok:Me,json:oe})=>{ge||Me&&oe.skill&&Te(Je=>({...Je,[U]:oe.skill}))}).catch(()=>{}).finally(()=>{ge||nt("")}),()=>{ge=!0}},[a,Wt,ze]),m.useEffect(()=>{if(!Ft||!ut)return;const U=Dn(ut);if(wt[U])return;let ge=!1;return it(U),fetch(`/api/nodes/detail?id=${encodeURIComponent(ut.id)}`).then(Me=>Me.json().then(oe=>({ok:Me.ok,json:oe}))).then(({ok:Me,json:oe})=>{ge||Me&&mt(Je=>({...Je,[U]:oe}))}).catch(()=>{}).finally(()=>{ge||it("")}),()=>{ge=!0}},[Ft,ut,wt]),m.useEffect(()=>{if(!Ft)return;const U=Array.isArray(Fe==null?void 0:Fe.files)?Fe.files:[];qt(ge=>{var Me;return ge&&U.some(oe=>oe.path===ge)?ge:((Me=U[0])==null?void 0:Me.path)||""})},[Ft,Fe]),m.useEffect(()=>{if(!Ft||!ut||!Nt)return;const U=`${Dn(ut)}:${Nt}`;if(Zt[U])return;let ge=!1;return ve(U),fetch(`/api/nodes/file?id=${encodeURIComponent(ut.id)}&path=${encodeURIComponent(Nt)}`).then(Me=>Me.json().then(oe=>({ok:Me.ok,json:oe}))).then(({ok:Me,json:oe})=>{ge||Me&&rt(Je=>({...Je,[U]:oe}))}).catch(()=>{}).finally(()=>{ge||ve("")}),()=>{ge=!0}},[Ft,ut,Nt,Zt]),m.useEffect(()=>{Tt("")},[ne,a]);const ti=U=>{r(Vf(U,"workspace"))},js=U=>{se(uN(U)),r(Vf({id:U.flowId,source:U.flowSource,archived:!!U.archived},"workspace"))},Mr=m.useCallback(U=>{var ge,Me;U.preventDefault(),U.stopPropagation(),(Me=(ge=U.dataTransfer)==null?void 0:ge.types)!=null&&Me.includes("Files")&&(qn.current+=1,X(!0))},[]),ie=m.useCallback(U=>{U.preventDefault(),U.stopPropagation(),qn.current-=1,qn.current<=0&&(qn.current=0,X(!1))},[]),be=m.useCallback(U=>{U.preventDefault(),U.stopPropagation()},[]),Pe=m.useCallback(U=>{var oe,Je;U.preventDefault(),U.stopPropagation(),qn.current=0,X(!1);const ge=(Je=(oe=U.dataTransfer)==null?void 0:oe.files)==null?void 0:Je[0];if(!ge)return;const Me=ge.name.toLowerCase();!Me.endsWith(".yaml")&&!Me.endsWith(".yml")&&!Me.endsWith(".zip")||B(ge)},[]);return o.jsxs("div",{className:"af-projects"+(_?" af-projects--drop-target":""),onDragEnter:Mr,onDragLeave:ie,onDragOver:be,onDrop:Pe,children:[o.jsxs("header",{className:"af-projects-top",children:[e?o.jsx("div",{className:"af-projects-tabs af-projects-tabs--empty","aria-hidden":!0}):o.jsxs("div",{className:"af-projects-tabs",children:[o.jsx("button",{type:"button",className:a==="all"?"af-tab af-tab--active":"af-tab",onClick:()=>l("all"),children:n("project:all")}),o.jsx("button",{type:"button",className:a==="archived"?"af-tab af-tab--active":"af-tab",onClick:()=>l("archived"),children:n("project:archived")})]}),o.jsxs("div",{className:"af-projects-top-right",children:[o.jsxs("div",{className:"af-search-wrap",children:[o.jsx("span",{className:"material-symbols-outlined af-search-icon",children:"search"}),o.jsx("input",{className:"af-search"+(z.trim()?" af-search--has-clear":""),type:"search",placeholder:Tr,"aria-label":Tr,autoComplete:"off",value:z,onChange:U=>T(U.target.value),onKeyDown:U=>{U.key==="Escape"&&(T(""),U.currentTarget.blur())}}),z.trim()?o.jsx("button",{type:"button",className:"af-search-clear","aria-label":"Clear search",onClick:()=>T(""),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),us?o.jsx("button",{type:"button",className:"af-btn-primary af-create-btn",onClick:()=>fn(),children:n("project:refreshResources")}):o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-icon-btn"+(Z?" af-icon-btn--active":""),"aria-label":n("flow:palette.toggleRecentActivity"),"aria-expanded":Z,"aria-controls":"af-recent-activity-panel",onClick:()=>ae(U=>!U),children:o.jsx("span",{className:"material-symbols-outlined",children:"notifications"})}),o.jsx("button",{type:"button",className:"af-btn-primary af-create-btn",onClick:()=>$(!0),children:n("project:createNew")})]})]})]}),o.jsxs("div",{className:"af-projects-body",children:[o.jsxs("section",{className:"af-projects-main",children:[o.jsxs("header",{className:"af-projects-section-head",children:[o.jsx("h2",{className:"af-projects-h2",children:n(a==="my-nodes"?"project:myNodes":a==="my-flows"?"project:myFlows":a==="nodes"?"project:nodes":a==="skills"?"project:globalSkills":a==="archived"?"project:archivedPipelines":"project:activeProjects")}),o.jsx("p",{className:"af-projects-sub",children:In?n("project:filterResult",{count:a==="nodes"||a==="my-nodes"?tt.length:a==="my-flows"?Bn.length:a==="skills"?Jt.length:vr.length}):a==="my-nodes"?n("project:myNodesHint",{count:tt.length}):a==="my-flows"?n("project:myFlowsHint",{count:Bn.length}):a==="nodes"?n("project:nodesHint",{count:f.length}):a==="skills"?n("project:skillsHint",{count:p.length}):n(a==="archived"?"project:archivedHint":"project:activeHint")}),I?o.jsx("p",{className:"af-err af-projects-api-hint",children:I}):null,H&&us?o.jsx("p",{className:"af-err af-projects-api-hint",children:H}):null]}),us?o.jsxs("div",{className:"af-resource-toolbar",children:[a==="skills"?o.jsx(cD,{onChanged:fn,canManage:!!(t!=null&&t.isAdmin)}):null,o.jsxs("div",{className:"af-resource-purpose",children:[o.jsx("span",{className:"material-symbols-outlined",children:ke?"schema":Ft?ce?"deployed_code":"account_tree":"extension"}),o.jsxs("div",{children:[o.jsx("h3",{children:n(ke?"project:myFlowsPurposeTitle":ce?"project:myNodesPurposeTitle":Ft?"project:nodesPurposeTitle":"project:skillsPurposeTitle")}),o.jsx("p",{children:n(ke?"project:myFlowsPurposeDesc":ce?"project:myNodesPurposeDesc":Ft?"project:nodesPurposeDesc":"project:skillsPurposeDesc")})]})]}),ke?null:o.jsxs(o.Fragment,{children:[Ft?o.jsxs("div",{className:"af-resource-filter-row",children:[o.jsx("button",{type:"button",className:"af-resource-filter"+(ce?"":" af-resource-filter--active"),onClick:()=>{l("nodes"),re("all"),ue("")},children:n("project:nodeScopeAll")}),o.jsx("button",{type:"button",className:"af-resource-filter"+(ce?" af-resource-filter--active":""),onClick:()=>{l("my-nodes"),re("all"),ue("")},children:n("project:nodeScopeMine")})]}):null,o.jsx("div",{className:"af-resource-filter-row",children:(Ft?(ce?jD:ND).map(U=>({id:U,label:n(`project:resourceFilter.${U}`)})):vn).map(U=>U.collection?o.jsxs("span",{className:"af-resource-filter-chip"+(ee===U.id?" af-resource-filter-chip--active":""),children:[o.jsxs("button",{type:"button",className:"af-resource-filter af-resource-filter--embedded",onClick:()=>{re(U.id),ue("")},children:[U.label,o.jsx("em",{children:U.count}),U.collection.builtin?o.jsx("strong",{children:"built-in"}):null]}),i&&!U.collection.builtin?o.jsx("button",{type:"button",className:"af-resource-filter-chip__delete",disabled:C,"aria-label":`删除 ${U.collection.name}`,onClick:()=>qr(U.collection.id),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})}):null]},U.id):o.jsx("button",{type:"button",className:"af-resource-filter"+(ee===U.id?" af-resource-filter--active":""),onClick:()=>{re(U.id),ue("")},children:U.label},U.id))})]}),a==="skills"&&i?o.jsx("div",{className:"af-skill-collections-manager",children:o.jsxs("div",{className:"af-skill-collections-create",children:[o.jsx("input",{className:"af-set-input af-set-input--sm",value:v,onChange:U=>b(U.target.value),onKeyDown:U=>{U.key==="Enter"&&ei()},placeholder:"新建 skill collection"}),o.jsxs("button",{type:"button",className:"af-set-btn-add af-set-btn-add--compact",disabled:!v.trim()||C,onClick:()=>ei(),children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),"新建"]})]})}):null]}):null,Ft?o.jsx("div",{className:"af-resource-grid",children:tt.length>0?tt.map(U=>o.jsxs("button",{type:"button",className:"af-resource-card"+(ut&&Dn(U)===Dn(ut)?" af-resource-card--active":""),onClick:()=>ue(Dn(U)),children:[o.jsxs("div",{className:"af-resource-card-head",children:[o.jsx("span",{className:fl(U.type==="control"?"secondary":U.type==="provide"?"primary":"muted"),children:o.jsx(On,{query:z,children:U.type||"node"})}),o.jsx("span",{className:"af-resource-source",children:o.jsx(On,{query:z,children:lN(U.source,n)})})]}),o.jsx("h3",{className:"af-project-title",children:o.jsx(On,{query:z,children:U.label||U.displayName||U.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(On,{query:z,children:U.description||n("project:noDescription")})}),o.jsxs("div",{className:"af-resource-meta-row",children:[o.jsx("span",{children:o.jsx(On,{query:z,children:U.id})}),o.jsx("span",{children:n("project:nodeSlots",{inputs:Object.keys(U.inputs||{}).length,outputs:Object.keys(U.outputs||{}).length})})]}),U.packageId?o.jsxs("div",{className:"af-project-path",children:[o.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"deployed_code"}),o.jsx("span",{className:"af-path-text",children:o.jsx(On,{query:z,children:`${U.packageId}${U.version?` / ${U.version}`:""}`})})]}):null]},`${U.id}:${U.source||""}:${U.packageId||""}`)):M?o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:In?n("project:noNodeMatch",{query:z.trim()}):n(ce?"project:noMyNodes":"project:noNodes")})}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:n("project:loadingResources")})})}):ke?o.jsx("div",{className:"af-resource-grid",children:Bn.length>0?Bn.map(U=>{const ge=AA(U),Me=PA(U),oe=Number.isFinite(Number(U.nodeCount))?Number(U.nodeCount):ge.length,Je=Number.isFinite(Number(U.edgeCount))?Number(U.edgeCount):Me.length;return o.jsxs("button",{type:"button",className:"af-resource-card"+(Vt&&go(U)===go(Vt)?" af-resource-card--active":""),onClick:()=>ue(go(U)),children:[o.jsxs("div",{className:"af-resource-card-head",children:[o.jsx("span",{className:fl("primary"),children:o.jsx(On,{query:z,children:U.version?`v${U.version}`:"flow"})}),o.jsx("span",{className:"af-resource-source",children:n("project:flowSnippet")})]}),o.jsx("h3",{className:"af-project-title",children:o.jsx(On,{query:z,children:U.displayName||U.name||U.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(On,{query:z,children:U.description||n("project:noDescription")})}),o.jsxs("div",{className:"af-resource-meta-row",children:[o.jsx("span",{children:n("project:flowSnippetNodes",{nodes:oe,edges:Je})}),o.jsx("span",{children:o.jsx(On,{query:z,children:U.id})})]}),o.jsxs("div",{className:"af-project-path",children:[o.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"schema"}),o.jsx("span",{className:"af-path-text",children:o.jsx(On,{query:z,children:cN(U)})})]})]},go(U))}):M?o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:In?n("project:noFlowSnippetMatch",{query:z.trim()}):n("project:noMyFlows")})}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:n("project:loadingResources")})})}):a==="skills"?o.jsx("div",{className:"af-resource-grid",children:Jt.length>0?Jt.map(U=>{const ge=Dn(U),Me=w.filter(oe=>{var Je;return(Je=yt.get(oe.id))==null?void 0:Je.has(ge)});return o.jsxs("button",{type:"button",className:"af-resource-card"+(Wt&&ge===Dn(Wt)?" af-resource-card--active":""),onClick:()=>ue(ge),children:[o.jsxs("div",{className:"af-resource-card-head",children:[o.jsx("span",{className:fl(U.source==="builtin"?"muted":"primary"),children:o.jsx(On,{query:z,children:U.sourceLabel||U.source||"skill"})}),o.jsx("span",{className:"af-resource-source",children:n("project:skill")})]}),o.jsx("h3",{className:"af-project-title",children:o.jsx(On,{query:z,children:U.name||U.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(On,{query:z,children:U.description||n("project:noDescription")})}),o.jsxs("div",{className:"af-project-path",children:[o.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"extension"}),o.jsx("span",{className:"af-path-text",children:o.jsx(On,{query:z,children:U.path||U.key||""})})]}),o.jsxs("div",{className:"af-skill-card-collections",children:[Me.slice(0,3).map(oe=>o.jsx("span",{children:oe.name},oe.id)),Me.length===0?o.jsx("span",{className:"af-skill-card-collection-empty",children:"未分组"}):null]})]},U.key||`${U.source}:${U.name}`)}):M?o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:In?n("project:noSkillMatch",{query:z.trim()}):n("project:noSkills")})}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:n("project:loadingResources")})})}):o.jsxs(o.Fragment,{children:[t!=null&&t.isAdmin&&a==="all"&&Sr.length>0?o.jsxs("div",{className:"af-project-admin-panel",children:[o.jsxs("div",{children:[o.jsx("strong",{children:"已隐藏内置"}),o.jsx("span",{children:"这些包内置流水线不会出现在普通项目列表中。"})]}),o.jsx("div",{className:"af-project-admin-hidden-list",children:Sr.map(U=>{const ge=We===`show-builtin:builtin:${U}`;return o.jsxs("button",{type:"button",disabled:ge,onClick:()=>Pt({id:U,source:"builtin"},"show-builtin"),children:[o.jsx("span",{children:U}),o.jsx("em",{children:ge?"恢复中":"恢复"})]},U)})})]}):null,o.jsxs("div",{className:"af-project-grid",children:[vr.length>0?vr.map(U=>{var dt,_t;const ge=(t==null?void 0:t.isAdmin)&&U.source==="user"&&!U.archived&&!Ns.has(U.id),Me=(t==null?void 0:t.isAdmin)&&U.source==="admin",oe=(t==null?void 0:t.isAdmin)&&U.source==="builtin",Je=We.endsWith(`:${U.source}:${U.id}`);return o.jsx("div",{className:yD(U.source),role:"button",tabIndex:0,onClick:()=>ti(U),onKeyDown:pn=>{(pn.key==="Enter"||pn.key===" ")&&(pn.preventDefault(),ti(U))},children:o.jsxs("div",{className:"af-project-card-body",children:[o.jsx("span",{className:fl(Kx(U.source,n).tone),children:o.jsx(On,{query:z,children:Kx(U.source,n).label})}),U.source==="workspace"&&((dt=U.collaboration)!=null&&dt.role)?o.jsx("span",{className:fl(U.collaboration.role==="owner"?"primary":"muted"),children:U.collaboration.role==="owner"?"我创建的":`${U.collaboration.ownerUsername||U.collaboration.ownerId} 分享`}):null,U.archived?o.jsx("span",{className:fl("muted"),children:o.jsx(On,{query:z,children:n("project:archived")})}):null,o.jsx("h3",{className:"af-project-title",children:o.jsx(On,{query:z,children:U.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(On,{query:z,children:_A(U,n)})}),o.jsxs("div",{className:"af-project-path",children:[o.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"database"}),o.jsx("span",{className:"af-path-text",children:o.jsx(On,{query:z,children:CA(U)})})]}),t!=null&&t.isAdmin?o.jsxs("div",{className:"af-project-admin-actions",onClick:pn=>pn.stopPropagation(),onKeyDown:pn=>pn.stopPropagation(),children:[ge?o.jsx("button",{type:"button",disabled:Je,onClick:()=>Pt(U,"promote"),children:"设为内置"}):null,Me?o.jsx("button",{type:"button",disabled:Je,onClick:()=>Pt(U,"unpromote"),children:"取消内置"}):null,oe?o.jsx("button",{type:"button",disabled:Je,onClick:()=>Pt(U,"hide-builtin"),children:"隐藏内置"}):null]}):null]})},`${U.id}:${U.source??"user"}:${U.archived?"a":""}:${((_t=U.collaboration)==null?void 0:_t.id)||"own"}`)}):F?Qn.length===0?o.jsxs("div",{className:"af-projects-empty-block",children:[o.jsx("p",{className:"af-projects-empty",children:a==="archived"?n("project:noArchived"):c.length>0?n("project:noActive"):n(I?"project:loadFailed":"project:noPipelines")}),!I&&c.length===0&&a==="all"?o.jsx("p",{className:"af-projects-empty-hint",children:n("project:emptyHint",{code1:"agentflow ui",code2:".agentflow/pipelines"})}):null]}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:n("project:noMatch",{query:z.trim()})})}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:n("project:loadingPipelines")})}),o.jsxs("button",{type:"button",className:"af-project-add",onClick:()=>$(!0),children:[o.jsx("span",{className:"material-symbols-outlined af-project-add-icon",children:"add_circle"}),o.jsx("span",{className:"af-project-add-label",children:n("project:newPipeline")})]}),te?null:o.jsxs("a",{className:"af-hub-card",href:"https://agentflow-hub.com",target:"_blank",rel:"noopener noreferrer",children:[o.jsx("div",{className:"af-hub-card__glow","aria-hidden":!0}),o.jsxs("span",{className:"af-hub-card__eyebrow",children:[o.jsx("span",{className:"material-symbols-outlined af-hub-card__eyebrow-icon",children:"hub"}),n("project:hubCard.eyebrow")]}),o.jsx("h3",{className:"af-hub-card__title",children:n("project:hubCard.title")}),o.jsx("p",{className:"af-hub-card__desc",children:n("project:hubCard.desc")}),o.jsxs("span",{className:"af-hub-card__cta",children:[n("project:hubCard.cta"),o.jsx("span",{className:"material-symbols-outlined af-hub-card__cta-icon",children:"arrow_outward"})]}),o.jsx("code",{className:"af-hub-card__cli",children:n("project:hubCard.cliHint")})]})]})]})]}),us?o.jsx("aside",{className:"af-resource-detail","aria-label":n(Ft?"project:nodeDetail":ke?"project:flowDetail":"project:skillDetail"),children:Ft&&ut?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-resource-detail-head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"account_tree"}),o.jsxs("div",{children:[o.jsx("h3",{children:ut.label||ut.displayName||ut.id}),o.jsx("p",{children:ut.id})]})]}),o.jsx("div",{className:"af-resource-detail-tabs",children:["overview","schema","runtime","files","usage"].map(U=>o.jsx("button",{type:"button",className:"af-resource-detail-tab"+(de===U?" af-resource-detail-tab--active":""),onClick:()=>xe(U),children:n(`project:nodeDetailTabs.${U}`)},U))}),Re===Dn(ut)?o.jsx("p",{className:"af-resource-detail-desc",children:n("project:loadingResources")}):de==="overview"?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"af-resource-detail-desc",children:ut.description||((Se=Fe==null?void 0:Fe.node)==null?void 0:Se.description)||n("project:noDescription")}),o.jsxs("dl",{className:"af-resource-detail-kv",children:[o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailType")}),o.jsx("dd",{children:ut.type||((xt=Fe==null?void 0:Fe.node)==null?void 0:xt.type)||"node"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailSource")}),o.jsx("dd",{children:lN(ut.source,n)})]}),ut.packageId?o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPackage")}),o.jsx("dd",{children:ut.packageId})]}):null,ut.version?o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailVersion")}),o.jsx("dd",{children:ut.version})]}):null,ut.packageDir||Fe!=null&&Fe.baseDir?o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPath")}),o.jsx("dd",{children:ut.packageDir||(Fe==null?void 0:Fe.baseDir)})]}):null,o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailEditable")}),o.jsx("dd",{children:(Fe==null?void 0:Fe.readOnly)===!1?n("project:editable"):n("project:readOnly")})]})]}),ce&&ut.source==="marketplace"?o.jsxs("div",{className:"af-resource-detail-section af-resource-danger-zone",children:[o.jsx("h4",{children:n("project:myNodeManagement")}),o.jsx("p",{children:n("project:deleteMyNodeHint")}),o.jsxs("button",{type:"button",className:"af-btn-secondary af-btn-danger",disabled:He===Dn(ut),onClick:()=>pr(ut),children:[o.jsx("span",{className:"material-symbols-outlined",children:"delete"}),He===Dn(ut)?n("project:deletingMyNode"):n("project:deleteMyNode")]}),je?o.jsx("p",{className:"af-resource-action-message",children:je}):null]}):null,o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:n("project:resourceMeaning")}),o.jsx("p",{children:n("project:nodesMeaning")})]})]}):de==="schema"?o.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[o.jsx("h4",{children:n("project:nodeSchema")}),o.jsxs("div",{className:"af-resource-slot-group",children:[o.jsx("span",{children:n("project:nodeInputs")}),Kf(((Kt=Fe==null?void 0:Fe.node)==null?void 0:Kt.inputs)||ut.inputs).length>0?Kf(((or=Fe==null?void 0:Fe.node)==null?void 0:or.inputs)||ut.inputs).map(U=>o.jsxs("code",{children:[U.name||U.key,U.type?`: ${U.type}`:""]},U.key)):o.jsx("em",{children:n("project:noSlots")})]}),o.jsxs("div",{className:"af-resource-slot-group",children:[o.jsx("span",{children:n("project:nodeOutputs")}),Kf(((rn=Fe==null?void 0:Fe.node)==null?void 0:rn.outputs)||ut.outputs).length>0?Kf(((hr=Fe==null?void 0:Fe.node)==null?void 0:hr.outputs)||ut.outputs).map(U=>o.jsxs("code",{children:[U.name||U.key,U.type?`: ${U.type}`:""]},U.key)):o.jsx("em",{children:n("project:noSlots")})]})]}):de==="runtime"?o.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[o.jsx("h4",{children:n("project:nodeRuntime")}),Fe!=null&&Fe.runtime?o.jsx("pre",{className:"af-resource-skill-preview",children:JSON.stringify(Fe.runtime,null,2)}):o.jsx("p",{children:n("project:noRuntimeManifest")}),Fe!=null&&Fe.body?o.jsxs(o.Fragment,{children:[o.jsx("h4",{className:"af-resource-detail-subtitle",children:n("project:nodeBody")}),o.jsx("pre",{className:"af-resource-skill-preview",children:Fe.body})]}):o.jsx("p",{children:n("project:noNodeBody")})]}):de==="files"?o.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[o.jsx("h4",{children:n("project:nodeFiles")}),Array.isArray(Fe==null?void 0:Fe.files)&&Fe.files.length>0?o.jsxs("div",{className:"af-node-file-browser",children:[o.jsx("div",{className:"af-node-file-list",children:Fe.files.map(U=>o.jsxs("button",{type:"button",className:"af-node-file-item"+(Nt===U.path?" af-node-file-item--active":""),onClick:()=>qt(U.path),children:[o.jsx("span",{className:"material-symbols-outlined",children:"description"}),o.jsx("span",{children:U.path})]},U.path))}),o.jsxs("pre",{className:"af-resource-skill-preview",children:[fe===`${Dn(ut)}:${Nt}`?n("project:loadingResources"):ir!=null&&ir.binary?n("project:binaryFile"):(ir==null?void 0:ir.content)||n("project:selectNodeFile"),ir!=null&&ir.truncated?`
|
|
43
|
-
|
|
44
|
-
${n("project:fileTruncated")}`:""]})]}):o.jsx("p",{children:n("project:noNodeFiles")})]}):o.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[o.jsx("h4",{children:n("project:nodeUsage")}),Array.isArray(Fe==null?void 0:Fe.usage)&&Fe.usage.length>0?o.jsx("div",{className:"af-node-usage-list",children:Fe.usage.map(U=>o.jsxs("div",{className:"af-node-usage-item",children:[o.jsx("strong",{children:U.flowId}),o.jsxs("span",{children:[U.flowSource,U.archived?` · ${n("project:archived")}`:""]}),o.jsx("em",{children:U.instances.map(ge=>ge.label||ge.instanceId).join(", ")})]},`${U.flowSource}:${U.flowId}:${U.archived?"a":""}`))}):o.jsx("p",{children:n("project:noNodeUsage")})]})]}):ke&&Vt?(()=>{const U=TD(Vt);return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-resource-detail-head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"schema"}),o.jsxs("div",{children:[o.jsx("h3",{children:Vt.displayName||Vt.name||Vt.id}),o.jsx("p",{children:Vt.id})]})]}),o.jsx("p",{className:"af-resource-detail-desc",children:Vt.description||n("project:noDescription")}),o.jsxs("dl",{className:"af-resource-detail-kv",children:[o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailVersion")}),o.jsx("dd",{children:Vt.version||"1.0.0"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPath")}),o.jsx("dd",{children:cN(Vt)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:flowSnippetScale")}),o.jsx("dd",{children:n("project:flowSnippetNodes",{nodes:Number.isFinite(Number(Vt.nodeCount))?Number(Vt.nodeCount):U.nodes.length,edges:Number.isFinite(Number(Vt.edgeCount))?Number(Vt.edgeCount):U.edges.length})})]})]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:n("project:resourceMeaning")}),o.jsx("p",{children:n("project:myFlowsMeaning")})]}),o.jsxs("div",{className:"af-resource-detail-section af-resource-danger-zone",children:[o.jsx("h4",{children:n("project:myFlowManagement")}),o.jsx("p",{children:n("project:deleteMyFlowHint")}),o.jsxs("button",{type:"button",className:"af-btn-secondary af-btn-danger",disabled:kn===go(Vt),onClick:()=>on(Vt),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"delete"}),kn===go(Vt)?n("project:deletingMyFlow"):n("project:deleteMyFlow")]}),en?o.jsx("p",{className:"af-resource-action-message",children:en}):null]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:n("project:flowSnippetPreview")}),U.diagram.nodes.length>0?o.jsx("div",{className:"af-flow-snippet-map",children:o.jsxs("svg",{viewBox:U.diagram.viewBox,role:"img","aria-label":n("project:flowSnippetPreview"),children:[o.jsx("defs",{children:o.jsx("marker",{id:"af-flow-snippet-arrow",markerWidth:"8",markerHeight:"8",refX:"7",refY:"4",orient:"auto",markerUnits:"strokeWidth",children:o.jsx("path",{d:"M 0 0 L 8 4 L 0 8 z"})})}),o.jsx("g",{className:"af-flow-snippet-map__edges",children:U.diagram.edges.map(ge=>o.jsxs("g",{children:[o.jsx("path",{d:ge.path}),ge.label?o.jsx("text",{x:ge.labelX,y:ge.labelY-5,textAnchor:"middle",children:ty(ge.label,18)}):null]},ge.key))}),o.jsx("g",{className:"af-flow-snippet-map__nodes",children:U.diagram.nodes.map((ge,Me)=>o.jsxs("g",{transform:`translate(${ge.x} ${ge.y})`,children:[o.jsx("rect",{width:ge.width,height:ge.height,rx:"10"}),o.jsx("circle",{cx:"19",cy:ge.height/2,r:"12"}),o.jsx("text",{className:"af-flow-snippet-map__node-index",x:"19",y:ge.height/2+4,textAnchor:"middle",children:Me+1}),o.jsx("text",{className:"af-flow-snippet-map__node-title",x:"40",y:ge.height/2-3,children:ty(ge.title)}),o.jsx("text",{className:"af-flow-snippet-map__node-meta",x:"40",y:ge.height/2+16,children:ty(ge.meta||ge.id,20)})]},ge.id))})]})}):o.jsx("p",{className:"af-resource-detail-desc",children:n("project:noFlowSnippetPreview")}),o.jsxs("details",{className:"af-flow-snippet-json",children:[o.jsx("summary",{children:n("project:flowSnippetJson")}),o.jsx("pre",{className:"af-resource-skill-preview",children:JSON.stringify(Vt.snippet||{},null,2)})]})]})]})})():a==="skills"&&Wt?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-resource-detail-head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"extension"}),o.jsxs("div",{children:[o.jsx("h3",{children:Wt.name||Wt.id}),o.jsx("p",{children:Wt.sourceLabel||Wt.source})]})]}),o.jsx("p",{className:"af-resource-detail-desc",children:Wt.description||n("project:noDescription")}),o.jsxs("dl",{className:"af-resource-detail-kv",children:[o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailSource")}),o.jsx("dd",{children:Wt.sourceLabel||Wt.source})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPath")}),o.jsx("dd",{children:Wt.path||Wt.key})]})]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:"Collections"}),w.length===0?o.jsx("p",{children:"暂无 collection。可在左侧新建后再添加。"}):o.jsx("div",{className:"af-skill-detail-collections",children:w.map(U=>{const ge=Dn(Wt),Me=yt.get(U.id)||new Set,oe=Me.has(ge);return o.jsxs("label",{className:"af-composer-skill-option af-skill-detail-collection-option",children:[o.jsx("input",{type:"checkbox",checked:oe,disabled:C||!i,onChange:Je=>Yr(U.id,ge,Je.target.checked)}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:U.name}),o.jsxs("span",{className:"af-composer-skill-option-desc",children:[Me.size," skills"]})]})]},U.id)})})]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:n("project:resourceMeaning")}),o.jsx("p",{children:n("project:skillsMeaning")})]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:n("project:skillPreview")}),o.jsx("pre",{className:"af-resource-skill-preview",children:Le===Dn(Wt)?n("project:loadingResources"):($n==null?void 0:$n.body)||($n==null?void 0:$n.content)||n("project:skillPreviewEmpty")})]})]}):o.jsx("p",{className:"af-activity-empty",children:n("project:selectResource")})}):o.jsxs("aside",{id:"af-recent-activity-panel",className:"af-activity"+(Z?"":" af-activity--hidden"),"aria-hidden":!Z,"aria-label":n("project:recentActivity"),children:[o.jsxs("h2",{className:"af-activity-title",children:[o.jsx("span",{className:"af-activity-bullet"}),n("project:recentActivity")]}),o.jsx("div",{className:"af-activity-list",children:Rr.length===0?o.jsx("p",{className:"af-activity-empty",children:zn.length===0?n("project:noRecentActivity"):n("project:noMatchRecent")}):Rr.map(U=>{const ge=J===uN(U);return o.jsxs("button",{type:"button",className:"af-activity-row af-activity-row--action"+(ge?" af-activity-row--active":""),"aria-current":ge?"page":void 0,onClick:()=>js(U),children:[o.jsxs("div",{className:"af-activity-row-top",children:[o.jsx("h4",{className:"af-activity-name",children:o.jsx(On,{query:z,children:U.flowId})}),o.jsx("span",{className:"af-activity-time",children:oN(U.at,n)})]}),o.jsxs("div",{className:"af-activity-meta",children:[o.jsx("span",{className:xD(U.kind),children:U.kind==="executed"?"play_arrow":"visibility"}),o.jsxs("p",{className:"af-activity-text",children:[U.kind==="executed"?n("project:recentRun"):n("project:recentOpen")," · ",oN(U.at,n)]})]})]},`${U.kind}-${U.flowId}-${U.flowSource}-${U.at}`)})})]})]}),o.jsx(eD,{open:W,onClose:()=>$(!1),onCreated:async U=>{$(!1),await Mn();const ge=U.source??"user";r(Vf({id:U.id,source:ge},"workspace"))}}),R?o.jsx(QO,{file:R,onClose:()=>B(null),onImported:async U=>{B(null),await Mn();const ge=U.source??"user";r(Vf({id:U.id,source:ge},"workspace"))}},`${R.name}-${R.size}-${R.lastModified}`):null]})}function Un(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=Un(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var MD={value:()=>{}};function mm(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Tp(n)}function Tp(e){this._=e}function $D(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",s=n.indexOf(".");if(s>=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Tp.prototype=mm.prototype={constructor:Tp,on:function(e,t){var n=this._,r=$D(e+"",n),s,i=-1,a=r.length;if(arguments.length<2){for(;++i<a;)if((s=(e=r[i]).type)&&(s=LD(n[s],e.name)))return s;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<a;)if(s=(e=r[i]).type)n[s]=pN(n[s],e.name,t);else if(t==null)for(s in n)n[s]=pN(n[s],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Tp(e)},call:function(e,t){if((s=arguments.length-2)>0)for(var n=new Array(s),r=0,s,i;r<s;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,s=i.length;r<s;++r)i[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],s=0,i=r.length;s<i;++s)r[s].value.apply(t,n)}};function LD(e,t){for(var n=0,r=e.length,s;n<r;++n)if((s=e[n]).name===t)return s.value}function pN(e,t,n){for(var r=0,s=e.length;r<s;++r)if(e[r].name===t){e[r]=MD,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Yx="http://www.w3.org/1999/xhtml";const hN={svg:"http://www.w3.org/2000/svg",xhtml:Yx,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function gm(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),hN.hasOwnProperty(t)?{space:hN[t],local:e}:e}function OD(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Yx&&t.documentElement.namespaceURI===Yx?t.createElement(e):t.createElementNS(n,e)}}function DD(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function IA(e){var t=gm(e);return(t.local?DD:OD)(t)}function FD(){}function zb(e){return e==null?FD:function(){return this.querySelector(e)}}function zD(e){typeof e!="function"&&(e=zb(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],a=i.length,l=r[s]=new Array(a),c,u,f=0;f<a;++f)(c=i[f])&&(u=e.call(c,c.__data__,f,i))&&("__data__"in c&&(u.__data__=c.__data__),l[f]=u);return new as(r,this._parents)}function BD(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function HD(){return[]}function RA(e){return e==null?HD:function(){return this.querySelectorAll(e)}}function WD(e){return function(){return BD(e.apply(this,arguments))}}function VD(e){typeof e=="function"?e=WD(e):e=RA(e);for(var t=this._groups,n=t.length,r=[],s=[],i=0;i<n;++i)for(var a=t[i],l=a.length,c,u=0;u<l;++u)(c=a[u])&&(r.push(e.call(c,c.__data__,u,a)),s.push(c));return new as(r,s)}function TA(e){return function(){return this.matches(e)}}function MA(e){return function(t){return t.matches(e)}}var KD=Array.prototype.find;function UD(e){return function(){return KD.call(this.children,e)}}function qD(){return this.firstElementChild}function YD(e){return this.select(e==null?qD:UD(typeof e=="function"?e:MA(e)))}var GD=Array.prototype.filter;function JD(){return Array.from(this.children)}function XD(e){return function(){return GD.call(this.children,e)}}function QD(e){return this.selectAll(e==null?JD:XD(typeof e=="function"?e:MA(e)))}function ZD(e){typeof e!="function"&&(e=TA(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],a=i.length,l=r[s]=[],c,u=0;u<a;++u)(c=i[u])&&e.call(c,c.__data__,u,i)&&l.push(c);return new as(r,this._parents)}function $A(e){return new Array(e.length)}function eF(){return new as(this._enter||this._groups.map($A),this._parents)}function yh(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}yh.prototype={constructor:yh,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function tF(e){return function(){return e}}function nF(e,t,n,r,s,i){for(var a=0,l,c=t.length,u=i.length;a<u;++a)(l=t[a])?(l.__data__=i[a],r[a]=l):n[a]=new yh(e,i[a]);for(;a<c;++a)(l=t[a])&&(s[a]=l)}function rF(e,t,n,r,s,i,a){var l,c,u=new Map,f=t.length,d=i.length,p=new Array(f),h;for(l=0;l<f;++l)(c=t[l])&&(p[l]=h=a.call(c,c.__data__,l,t)+"",u.has(h)?s[l]=c:u.set(h,c));for(l=0;l<d;++l)h=a.call(e,i[l],l,i)+"",(c=u.get(h))?(r[l]=c,c.__data__=i[l],u.delete(h)):n[l]=new yh(e,i[l]);for(l=0;l<f;++l)(c=t[l])&&u.get(p[l])===c&&(s[l]=c)}function sF(e){return e.__data__}function iF(e,t){if(!arguments.length)return Array.from(this,sF);var n=t?rF:nF,r=this._parents,s=this._groups;typeof e!="function"&&(e=tF(e));for(var i=s.length,a=new Array(i),l=new Array(i),c=new Array(i),u=0;u<i;++u){var f=r[u],d=s[u],p=d.length,h=oF(e.call(f,f&&f.__data__,u,r)),g=h.length,k=l[u]=new Array(g),w=a[u]=new Array(g),y=c[u]=new Array(p);n(f,d,k,w,y,h,t);for(var v=0,b=0,C,N;v<g;++v)if(C=k[v]){for(v>=b&&(b=v+1);!(N=w[b])&&++b<g;);C._next=N||null}}return a=new as(a,r),a._enter=l,a._exit=c,a}function oF(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function aF(){return new as(this._exit||this._groups.map($A),this._parents)}function lF(e,t,n){var r=this.enter(),s=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(s=t(s),s&&(s=s.selection())),n==null?i.remove():n(i),r&&s?r.merge(s).order():s}function cF(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,s=n.length,i=r.length,a=Math.min(s,i),l=new Array(s),c=0;c<a;++c)for(var u=n[c],f=r[c],d=u.length,p=l[c]=new Array(d),h,g=0;g<d;++g)(h=u[g]||f[g])&&(p[g]=h);for(;c<s;++c)l[c]=n[c];return new as(l,this._parents)}function uF(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],s=r.length-1,i=r[s],a;--s>=0;)(a=r[s])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function dF(e){e||(e=fF);function t(d,p){return d&&p?e(d.__data__,p.__data__):!d-!p}for(var n=this._groups,r=n.length,s=new Array(r),i=0;i<r;++i){for(var a=n[i],l=a.length,c=s[i]=new Array(l),u,f=0;f<l;++f)(u=a[f])&&(c[f]=u);c.sort(t)}return new as(s,this._parents).order()}function fF(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function pF(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function hF(){return Array.from(this)}function mF(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,i=r.length;s<i;++s){var a=r[s];if(a)return a}return null}function gF(){let e=0;for(const t of this)++e;return e}function yF(){return!this.node()}function xF(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var s=t[n],i=0,a=s.length,l;i<a;++i)(l=s[i])&&e.call(l,l.__data__,i,s);return this}function wF(e){return function(){this.removeAttribute(e)}}function bF(e){return function(){this.removeAttributeNS(e.space,e.local)}}function kF(e,t){return function(){this.setAttribute(e,t)}}function vF(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function SF(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function NF(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function jF(e,t){var n=gm(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?bF:wF:typeof t=="function"?n.local?NF:SF:n.local?vF:kF)(n,t))}function LA(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function CF(e){return function(){this.style.removeProperty(e)}}function _F(e,t,n){return function(){this.style.setProperty(e,t,n)}}function EF(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function AF(e,t,n){return arguments.length>1?this.each((t==null?CF:typeof t=="function"?EF:_F)(e,t,n??"")):oc(this.node(),e)}function oc(e,t){return e.style.getPropertyValue(t)||LA(e).getComputedStyle(e,null).getPropertyValue(t)}function PF(e){return function(){delete this[e]}}function IF(e,t){return function(){this[e]=t}}function RF(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function TF(e,t){return arguments.length>1?this.each((t==null?PF:typeof t=="function"?RF:IF)(e,t)):this.node()[e]}function OA(e){return e.trim().split(/^|\s+/)}function Bb(e){return e.classList||new DA(e)}function DA(e){this._node=e,this._names=OA(e.getAttribute("class")||"")}DA.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function FA(e,t){for(var n=Bb(e),r=-1,s=t.length;++r<s;)n.add(t[r])}function zA(e,t){for(var n=Bb(e),r=-1,s=t.length;++r<s;)n.remove(t[r])}function MF(e){return function(){FA(this,e)}}function $F(e){return function(){zA(this,e)}}function LF(e,t){return function(){(t.apply(this,arguments)?FA:zA)(this,e)}}function OF(e,t){var n=OA(e+"");if(arguments.length<2){for(var r=Bb(this.node()),s=-1,i=n.length;++s<i;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof t=="function"?LF:t?MF:$F)(n,t))}function DF(){this.textContent=""}function FF(e){return function(){this.textContent=e}}function zF(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function BF(e){return arguments.length?this.each(e==null?DF:(typeof e=="function"?zF:FF)(e)):this.node().textContent}function HF(){this.innerHTML=""}function WF(e){return function(){this.innerHTML=e}}function VF(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function KF(e){return arguments.length?this.each(e==null?HF:(typeof e=="function"?VF:WF)(e)):this.node().innerHTML}function UF(){this.nextSibling&&this.parentNode.appendChild(this)}function qF(){return this.each(UF)}function YF(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function GF(){return this.each(YF)}function JF(e){var t=typeof e=="function"?e:IA(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function XF(){return null}function QF(e,t){var n=typeof e=="function"?e:IA(e),r=t==null?XF:typeof t=="function"?t:zb(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function ZF(){var e=this.parentNode;e&&e.removeChild(this)}function ez(){return this.each(ZF)}function tz(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function nz(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function rz(e){return this.select(e?nz:tz)}function sz(e){return arguments.length?this.property("__data__",e):this.node().__data__}function iz(e){return function(t){e.call(this,t,this.__data__)}}function oz(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function az(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,s=t.length,i;n<s;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function lz(e,t,n){return function(){var r=this.__on,s,i=iz(t);if(r){for(var a=0,l=r.length;a<l;++a)if((s=r[a]).type===e.type&&s.name===e.name){this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=i,s.options=n),s.value=t;return}}this.addEventListener(e.type,i,n),s={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(s):this.__on=[s]}}function cz(e,t,n){var r=oz(e+""),s,i=r.length,a;if(arguments.length<2){var l=this.node().__on;if(l){for(var c=0,u=l.length,f;c<u;++c)for(s=0,f=l[c];s<i;++s)if((a=r[s]).type===f.type&&a.name===f.name)return f.value}return}for(l=t?lz:az,s=0;s<i;++s)this.each(l(r[s],t,n));return this}function BA(e,t,n){var r=LA(e),s=r.CustomEvent;typeof s=="function"?s=new s(t,n):(s=r.document.createEvent("Event"),n?(s.initEvent(t,n.bubbles,n.cancelable),s.detail=n.detail):s.initEvent(t,!1,!1)),e.dispatchEvent(s)}function uz(e,t){return function(){return BA(this,e,t)}}function dz(e,t){return function(){return BA(this,e,t.apply(this,arguments))}}function fz(e,t){return this.each((typeof t=="function"?dz:uz)(e,t))}function*pz(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,i=r.length,a;s<i;++s)(a=r[s])&&(yield a)}var HA=[null];function as(e,t){this._groups=e,this._parents=t}function Ld(){return new as([[document.documentElement]],HA)}function hz(){return this}as.prototype=Ld.prototype={constructor:as,select:zD,selectAll:VD,selectChild:YD,selectChildren:QD,filter:ZD,data:iF,enter:eF,exit:aF,join:lF,merge:cF,selection:hz,order:uF,sort:dF,call:pF,nodes:hF,node:mF,size:gF,empty:yF,each:xF,attr:jF,style:AF,property:TF,classed:OF,text:BF,html:KF,raise:qF,lower:GF,append:JF,insert:QF,remove:ez,clone:rz,datum:sz,on:cz,dispatch:fz,[Symbol.iterator]:pz};function ts(e){return typeof e=="string"?new as([[document.querySelector(e)]],[document.documentElement]):new as([[e]],HA)}function mz(e){let t;for(;t=e.sourceEvent;)e=t;return e}function zs(e,t){if(e=mz(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}}return[e.pageX,e.pageY]}const gz={passive:!1},ld={capture:!0,passive:!1};function ny(e){e.stopImmediatePropagation()}function Ul(e){e.preventDefault(),e.stopImmediatePropagation()}function WA(e){var t=e.document.documentElement,n=ts(e).on("dragstart.drag",Ul,ld);"onselectstart"in t?n.on("selectstart.drag",Ul,ld):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function VA(e,t){var n=e.document.documentElement,r=ts(e).on("dragstart.drag",null);t&&(r.on("click.drag",Ul,ld),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Uf=e=>()=>e;function Gx(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:i,x:a,y:l,dx:c,dy:u,dispatch:f}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:f}})}Gx.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function yz(e){return!e.ctrlKey&&!e.button}function xz(){return this.parentNode}function wz(e,t){return t??{x:e.x,y:e.y}}function bz(){return navigator.maxTouchPoints||"ontouchstart"in this}function KA(){var e=yz,t=xz,n=wz,r=bz,s={},i=mm("start","drag","end"),a=0,l,c,u,f,d=0;function p(C){C.on("mousedown.drag",h).filter(r).on("touchstart.drag",w).on("touchmove.drag",y,gz).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(C,N){if(!(f||!e.call(this,C,N))){var j=b(this,t.call(this,C,N),C,N,"mouse");j&&(ts(C.view).on("mousemove.drag",g,ld).on("mouseup.drag",k,ld),WA(C.view),ny(C),u=!1,l=C.clientX,c=C.clientY,j("start",C))}}function g(C){if(Ul(C),!u){var N=C.clientX-l,j=C.clientY-c;u=N*N+j*j>d}s.mouse("drag",C)}function k(C){ts(C.view).on("mousemove.drag mouseup.drag",null),VA(C.view,u),Ul(C),s.mouse("end",C)}function w(C,N){if(e.call(this,C,N)){var j=C.changedTouches,A=t.call(this,C,N),I=j.length,D,H;for(D=0;D<I;++D)(H=b(this,A,C,N,j[D].identifier,j[D]))&&(ny(C),H("start",C,j[D]))}}function y(C){var N=C.changedTouches,j=N.length,A,I;for(A=0;A<j;++A)(I=s[N[A].identifier])&&(Ul(C),I("drag",C,N[A]))}function v(C){var N=C.changedTouches,j=N.length,A,I;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),A=0;A<j;++A)(I=s[N[A].identifier])&&(ny(C),I("end",C,N[A]))}function b(C,N,j,A,I,D){var H=i.copy(),V=zs(D||j,N),F,L,M;if((M=n.call(C,new Gx("beforestart",{sourceEvent:j,target:p,identifier:I,active:a,x:V[0],y:V[1],dx:0,dy:0,dispatch:H}),A))!=null)return F=M.x-V[0]||0,L=M.y-V[1]||0,function K(W,$,R){var B=V,_;switch(W){case"start":s[I]=K,_=a++;break;case"end":delete s[I],--a;case"drag":V=zs(R||$,N),_=a;break}H.call(W,C,new Gx(W,{sourceEvent:$,subject:M,target:p,identifier:I,active:_,x:V[0]+F,y:V[1]+L,dx:V[0]-B[0],dy:V[1]-B[1],dispatch:H}),A)}}return p.filter=function(C){return arguments.length?(e=typeof C=="function"?C:Uf(!!C),p):e},p.container=function(C){return arguments.length?(t=typeof C=="function"?C:Uf(C),p):t},p.subject=function(C){return arguments.length?(n=typeof C=="function"?C:Uf(C),p):n},p.touchable=function(C){return arguments.length?(r=typeof C=="function"?C:Uf(!!C),p):r},p.on=function(){var C=i.on.apply(i,arguments);return C===i?p:C},p.clickDistance=function(C){return arguments.length?(d=(C=+C)*C,p):Math.sqrt(d)},p}function Hb(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function UA(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Od(){}var cd=.7,xh=1/cd,ql="\\s*([+-]?\\d+)\\s*",ud="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",xi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",kz=/^#([0-9a-f]{3,8})$/,vz=new RegExp(`^rgb\\(${ql},${ql},${ql}\\)$`),Sz=new RegExp(`^rgb\\(${xi},${xi},${xi}\\)$`),Nz=new RegExp(`^rgba\\(${ql},${ql},${ql},${ud}\\)$`),jz=new RegExp(`^rgba\\(${xi},${xi},${xi},${ud}\\)$`),Cz=new RegExp(`^hsl\\(${ud},${xi},${xi}\\)$`),_z=new RegExp(`^hsla\\(${ud},${xi},${xi},${ud}\\)$`),mN={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Hb(Od,Ta,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:gN,formatHex:gN,formatHex8:Ez,formatHsl:Az,formatRgb:yN,toString:yN});function gN(){return this.rgb().formatHex()}function Ez(){return this.rgb().formatHex8()}function Az(){return qA(this).formatHsl()}function yN(){return this.rgb().formatRgb()}function Ta(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=kz.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?xN(t):n===3?new zr(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?qf(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?qf(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=vz.exec(e))?new zr(t[1],t[2],t[3],1):(t=Sz.exec(e))?new zr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Nz.exec(e))?qf(t[1],t[2],t[3],t[4]):(t=jz.exec(e))?qf(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Cz.exec(e))?kN(t[1],t[2]/100,t[3]/100,1):(t=_z.exec(e))?kN(t[1],t[2]/100,t[3]/100,t[4]):mN.hasOwnProperty(e)?xN(mN[e]):e==="transparent"?new zr(NaN,NaN,NaN,0):null}function xN(e){return new zr(e>>16&255,e>>8&255,e&255,1)}function qf(e,t,n,r){return r<=0&&(e=t=n=NaN),new zr(e,t,n,r)}function Pz(e){return e instanceof Od||(e=Ta(e)),e?(e=e.rgb(),new zr(e.r,e.g,e.b,e.opacity)):new zr}function Jx(e,t,n,r){return arguments.length===1?Pz(e):new zr(e,t,n,r??1)}function zr(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Hb(zr,Jx,UA(Od,{brighter(e){return e=e==null?xh:Math.pow(xh,e),new zr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?cd:Math.pow(cd,e),new zr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new zr(Na(this.r),Na(this.g),Na(this.b),wh(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:wN,formatHex:wN,formatHex8:Iz,formatRgb:bN,toString:bN}));function wN(){return`#${wa(this.r)}${wa(this.g)}${wa(this.b)}`}function Iz(){return`#${wa(this.r)}${wa(this.g)}${wa(this.b)}${wa((isNaN(this.opacity)?1:this.opacity)*255)}`}function bN(){const e=wh(this.opacity);return`${e===1?"rgb(":"rgba("}${Na(this.r)}, ${Na(this.g)}, ${Na(this.b)}${e===1?")":`, ${e})`}`}function wh(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Na(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function wa(e){return e=Na(e),(e<16?"0":"")+e.toString(16)}function kN(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ws(e,t,n,r)}function qA(e){if(e instanceof Ws)return new Ws(e.h,e.s,e.l,e.opacity);if(e instanceof Od||(e=Ta(e)),!e)return new Ws;if(e instanceof Ws)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),i=Math.max(t,n,r),a=NaN,l=i-s,c=(i+s)/2;return l?(t===i?a=(n-r)/l+(n<r)*6:n===i?a=(r-t)/l+2:a=(t-n)/l+4,l/=c<.5?i+s:2-i-s,a*=60):l=c>0&&c<1?0:a,new Ws(a,l,c,e.opacity)}function Rz(e,t,n,r){return arguments.length===1?qA(e):new Ws(e,t,n,r??1)}function Ws(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Hb(Ws,Rz,UA(Od,{brighter(e){return e=e==null?xh:Math.pow(xh,e),new Ws(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?cd:Math.pow(cd,e),new Ws(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,s=2*n-r;return new zr(ry(e>=240?e-240:e+120,s,r),ry(e,s,r),ry(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new Ws(vN(this.h),Yf(this.s),Yf(this.l),wh(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=wh(this.opacity);return`${e===1?"hsl(":"hsla("}${vN(this.h)}, ${Yf(this.s)*100}%, ${Yf(this.l)*100}%${e===1?")":`, ${e})`}`}}));function vN(e){return e=(e||0)%360,e<0?e+360:e}function Yf(e){return Math.max(0,Math.min(1,e||0))}function ry(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Wb=e=>()=>e;function Tz(e,t){return function(n){return e+n*t}}function Mz(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function $z(e){return(e=+e)==1?YA:function(t,n){return n-t?Mz(t,n,e):Wb(isNaN(t)?n:t)}}function YA(e,t){var n=t-e;return n?Tz(e,n):Wb(isNaN(e)?t:e)}const bh=function e(t){var n=$z(t);function r(s,i){var a=n((s=Jx(s)).r,(i=Jx(i)).r),l=n(s.g,i.g),c=n(s.b,i.b),u=YA(s.opacity,i.opacity);return function(f){return s.r=a(f),s.g=l(f),s.b=c(f),s.opacity=u(f),s+""}}return r.gamma=e,r}(1);function Lz(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),s;return function(i){for(s=0;s<n;++s)r[s]=e[s]*(1-i)+t[s]*i;return r}}function Oz(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Dz(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,s=new Array(r),i=new Array(n),a;for(a=0;a<r;++a)s[a]=$u(e[a],t[a]);for(;a<n;++a)i[a]=t[a];return function(l){for(a=0;a<r;++a)i[a]=s[a](l);return i}}function Fz(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function li(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function zz(e,t){var n={},r={},s;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(s in t)s in e?n[s]=$u(e[s],t[s]):r[s]=t[s];return function(i){for(s in n)r[s]=n[s](i);return r}}var Xx=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,sy=new RegExp(Xx.source,"g");function Bz(e){return function(){return e}}function Hz(e){return function(t){return e(t)+""}}function GA(e,t){var n=Xx.lastIndex=sy.lastIndex=0,r,s,i,a=-1,l=[],c=[];for(e=e+"",t=t+"";(r=Xx.exec(e))&&(s=sy.exec(t));)(i=s.index)>n&&(i=t.slice(n,i),l[a]?l[a]+=i:l[++a]=i),(r=r[0])===(s=s[0])?l[a]?l[a]+=s:l[++a]=s:(l[++a]=null,c.push({i:a,x:li(r,s)})),n=sy.lastIndex;return n<t.length&&(i=t.slice(n),l[a]?l[a]+=i:l[++a]=i),l.length<2?c[0]?Hz(c[0].x):Bz(t):(t=c.length,function(u){for(var f=0,d;f<t;++f)l[(d=c[f]).i]=d.x(u);return l.join("")})}function $u(e,t){var n=typeof t,r;return t==null||n==="boolean"?Wb(t):(n==="number"?li:n==="string"?(r=Ta(t))?(t=r,bh):GA:t instanceof Ta?bh:t instanceof Date?Fz:Oz(t)?Lz:Array.isArray(t)?Dz:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?zz:li)(e,t)}var SN=180/Math.PI,Qx={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function JA(e,t,n,r,s,i){var a,l,c;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(l=Math.sqrt(n*n+r*r))&&(n/=l,r/=l,c/=l),e*r<t*n&&(e=-e,t=-t,c=-c,a=-a),{translateX:s,translateY:i,rotate:Math.atan2(t,e)*SN,skewX:Math.atan(c)*SN,scaleX:a,scaleY:l}}var Gf;function Wz(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Qx:JA(t.a,t.b,t.c,t.d,t.e,t.f)}function Vz(e){return e==null||(Gf||(Gf=document.createElementNS("http://www.w3.org/2000/svg","g")),Gf.setAttribute("transform",e),!(e=Gf.transform.baseVal.consolidate()))?Qx:(e=e.matrix,JA(e.a,e.b,e.c,e.d,e.e,e.f))}function XA(e,t,n,r){function s(u){return u.length?u.pop()+" ":""}function i(u,f,d,p,h,g){if(u!==d||f!==p){var k=h.push("translate(",null,t,null,n);g.push({i:k-4,x:li(u,d)},{i:k-2,x:li(f,p)})}else(d||p)&&h.push("translate("+d+t+p+n)}function a(u,f,d,p){u!==f?(u-f>180?f+=360:f-u>180&&(u+=360),p.push({i:d.push(s(d)+"rotate(",null,r)-2,x:li(u,f)})):f&&d.push(s(d)+"rotate("+f+r)}function l(u,f,d,p){u!==f?p.push({i:d.push(s(d)+"skewX(",null,r)-2,x:li(u,f)}):f&&d.push(s(d)+"skewX("+f+r)}function c(u,f,d,p,h,g){if(u!==d||f!==p){var k=h.push(s(h)+"scale(",null,",",null,")");g.push({i:k-4,x:li(u,d)},{i:k-2,x:li(f,p)})}else(d!==1||p!==1)&&h.push(s(h)+"scale("+d+","+p+")")}return function(u,f){var d=[],p=[];return u=e(u),f=e(f),i(u.translateX,u.translateY,f.translateX,f.translateY,d,p),a(u.rotate,f.rotate,d,p),l(u.skewX,f.skewX,d,p),c(u.scaleX,u.scaleY,f.scaleX,f.scaleY,d,p),u=f=null,function(h){for(var g=-1,k=p.length,w;++g<k;)d[(w=p[g]).i]=w.x(h);return d.join("")}}}var Kz=XA(Wz,"px, ","px)","deg)"),Uz=XA(Vz,", ",")",")"),qz=1e-12;function NN(e){return((e=Math.exp(e))+1/e)/2}function Yz(e){return((e=Math.exp(e))-1/e)/2}function Gz(e){return((e=Math.exp(2*e))-1)/(e+1)}const Mp=function e(t,n,r){function s(i,a){var l=i[0],c=i[1],u=i[2],f=a[0],d=a[1],p=a[2],h=f-l,g=d-c,k=h*h+g*g,w,y;if(k<qz)y=Math.log(p/u)/t,w=function(A){return[l+A*h,c+A*g,u*Math.exp(t*A*y)]};else{var v=Math.sqrt(k),b=(p*p-u*u+r*k)/(2*u*n*v),C=(p*p-u*u-r*k)/(2*p*n*v),N=Math.log(Math.sqrt(b*b+1)-b),j=Math.log(Math.sqrt(C*C+1)-C);y=(j-N)/t,w=function(A){var I=A*y,D=NN(N),H=u/(n*v)*(D*Gz(t*I+N)-Yz(N));return[l+H*h,c+H*g,u*D/NN(t*I+N)]}}return w.duration=y*1e3*t/Math.SQRT2,w}return s.rho=function(i){var a=Math.max(.001,+i),l=a*a,c=l*l;return e(a,l,c)},s}(Math.SQRT2,2,4);var ac=0,wu=0,su=0,QA=1e3,kh,bu,vh=0,Ma=0,ym=0,dd=typeof performance=="object"&&performance.now?performance:Date,ZA=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Vb(){return Ma||(ZA(Jz),Ma=dd.now()+ym)}function Jz(){Ma=0}function Sh(){this._call=this._time=this._next=null}Sh.prototype=eP.prototype={constructor:Sh,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Vb():+n)+(t==null?0:+t),!this._next&&bu!==this&&(bu?bu._next=this:kh=this,bu=this),this._call=e,this._time=n,Zx()},stop:function(){this._call&&(this._call=null,this._time=1/0,Zx())}};function eP(e,t,n){var r=new Sh;return r.restart(e,t,n),r}function Xz(){Vb(),++ac;for(var e=kh,t;e;)(t=Ma-e._time)>=0&&e._call.call(void 0,t),e=e._next;--ac}function jN(){Ma=(vh=dd.now())+ym,ac=wu=0;try{Xz()}finally{ac=0,Zz(),Ma=0}}function Qz(){var e=dd.now(),t=e-vh;t>QA&&(ym-=t,vh=e)}function Zz(){for(var e,t=kh,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:kh=n);bu=e,Zx(r)}function Zx(e){if(!ac){wu&&(wu=clearTimeout(wu));var t=e-Ma;t>24?(e<1/0&&(wu=setTimeout(jN,e-dd.now()-ym)),su&&(su=clearInterval(su))):(su||(vh=dd.now(),su=setInterval(Qz,QA)),ac=1,ZA(jN))}}function CN(e,t,n){var r=new Sh;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var e3=mm("start","end","cancel","interrupt"),t3=[],tP=0,_N=1,ew=2,$p=3,EN=4,tw=5,Lp=6;function xm(e,t,n,r,s,i){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;n3(e,n,{name:t,index:r,group:s,on:e3,tween:t3,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:tP})}function Kb(e,t){var n=Qs(e,t);if(n.state>tP)throw new Error("too late; already scheduled");return n}function ji(e,t){var n=Qs(e,t);if(n.state>$p)throw new Error("too late; already running");return n}function Qs(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function n3(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=eP(i,0,n.time);function i(u){n.state=_N,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var f,d,p,h;if(n.state!==_N)return c();for(f in r)if(h=r[f],h.name===n.name){if(h.state===$p)return CN(a);h.state===EN?(h.state=Lp,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[f]):+f<t&&(h.state=Lp,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[f])}if(CN(function(){n.state===$p&&(n.state=EN,n.timer.restart(l,n.delay,n.time),l(u))}),n.state=ew,n.on.call("start",e,e.__data__,n.index,n.group),n.state===ew){for(n.state=$p,s=new Array(p=n.tween.length),f=0,d=-1;f<p;++f)(h=n.tween[f].value.call(e,e.__data__,n.index,n.group))&&(s[++d]=h);s.length=d+1}}function l(u){for(var f=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=tw,1),d=-1,p=s.length;++d<p;)s[d].call(e,f);n.state===tw&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Lp,n.timer.stop(),delete r[t];for(var u in r)return;delete e.__transition}}function Op(e,t){var n=e.__transition,r,s,i=!0,a;if(n){t=t==null?null:t+"";for(a in n){if((r=n[a]).name!==t){i=!1;continue}s=r.state>ew&&r.state<tw,r.state=Lp,r.timer.stop(),r.on.call(s?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[a]}i&&delete e.__transition}}function r3(e){return this.each(function(){Op(this,e)})}function s3(e,t){var n,r;return function(){var s=ji(this,e),i=s.tween;if(i!==n){r=n=i;for(var a=0,l=r.length;a<l;++a)if(r[a].name===t){r=r.slice(),r.splice(a,1);break}}s.tween=r}}function i3(e,t,n){var r,s;if(typeof n!="function")throw new Error;return function(){var i=ji(this,e),a=i.tween;if(a!==r){s=(r=a).slice();for(var l={name:t,value:n},c=0,u=s.length;c<u;++c)if(s[c].name===t){s[c]=l;break}c===u&&s.push(l)}i.tween=s}}function o3(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Qs(this.node(),n).tween,s=0,i=r.length,a;s<i;++s)if((a=r[s]).name===e)return a.value;return null}return this.each((t==null?s3:i3)(n,e,t))}function Ub(e,t,n){var r=e._id;return e.each(function(){var s=ji(this,r);(s.value||(s.value={}))[t]=n.apply(this,arguments)}),function(s){return Qs(s,r).value[t]}}function nP(e,t){var n;return(typeof t=="number"?li:t instanceof Ta?bh:(n=Ta(t))?(t=n,bh):GA)(e,t)}function a3(e){return function(){this.removeAttribute(e)}}function l3(e){return function(){this.removeAttributeNS(e.space,e.local)}}function c3(e,t,n){var r,s=n+"",i;return function(){var a=this.getAttribute(e);return a===s?null:a===r?i:i=t(r=a,n)}}function u3(e,t,n){var r,s=n+"",i;return function(){var a=this.getAttributeNS(e.space,e.local);return a===s?null:a===r?i:i=t(r=a,n)}}function d3(e,t,n){var r,s,i;return function(){var a,l=n(this),c;return l==null?void this.removeAttribute(e):(a=this.getAttribute(e),c=l+"",a===c?null:a===r&&c===s?i:(s=c,i=t(r=a,l)))}}function f3(e,t,n){var r,s,i;return function(){var a,l=n(this),c;return l==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),c=l+"",a===c?null:a===r&&c===s?i:(s=c,i=t(r=a,l)))}}function p3(e,t){var n=gm(e),r=n==="transform"?Uz:nP;return this.attrTween(e,typeof t=="function"?(n.local?f3:d3)(n,r,Ub(this,"attr."+e,t)):t==null?(n.local?l3:a3)(n):(n.local?u3:c3)(n,r,t))}function h3(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function m3(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function g3(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&m3(e,i)),n}return s._value=t,s}function y3(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&h3(e,i)),n}return s._value=t,s}function x3(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=gm(e);return this.tween(n,(r.local?g3:y3)(r,t))}function w3(e,t){return function(){Kb(this,e).delay=+t.apply(this,arguments)}}function b3(e,t){return t=+t,function(){Kb(this,e).delay=t}}function k3(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?w3:b3)(t,e)):Qs(this.node(),t).delay}function v3(e,t){return function(){ji(this,e).duration=+t.apply(this,arguments)}}function S3(e,t){return t=+t,function(){ji(this,e).duration=t}}function N3(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?v3:S3)(t,e)):Qs(this.node(),t).duration}function j3(e,t){if(typeof t!="function")throw new Error;return function(){ji(this,e).ease=t}}function C3(e){var t=this._id;return arguments.length?this.each(j3(t,e)):Qs(this.node(),t).ease}function _3(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;ji(this,e).ease=n}}function E3(e){if(typeof e!="function")throw new Error;return this.each(_3(this._id,e))}function A3(e){typeof e!="function"&&(e=TA(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],a=i.length,l=r[s]=[],c,u=0;u<a;++u)(c=i[u])&&e.call(c,c.__data__,u,i)&&l.push(c);return new Zi(r,this._parents,this._name,this._id)}function P3(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,s=n.length,i=Math.min(r,s),a=new Array(r),l=0;l<i;++l)for(var c=t[l],u=n[l],f=c.length,d=a[l]=new Array(f),p,h=0;h<f;++h)(p=c[h]||u[h])&&(d[h]=p);for(;l<r;++l)a[l]=t[l];return new Zi(a,this._parents,this._name,this._id)}function I3(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function R3(e,t,n){var r,s,i=I3(t)?Kb:ji;return function(){var a=i(this,e),l=a.on;l!==r&&(s=(r=l).copy()).on(t,n),a.on=s}}function T3(e,t){var n=this._id;return arguments.length<2?Qs(this.node(),n).on.on(e):this.each(R3(n,e,t))}function M3(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function $3(){return this.on("end.remove",M3(this._id))}function L3(e){var t=this._name,n=this._id;typeof e!="function"&&(e=zb(e));for(var r=this._groups,s=r.length,i=new Array(s),a=0;a<s;++a)for(var l=r[a],c=l.length,u=i[a]=new Array(c),f,d,p=0;p<c;++p)(f=l[p])&&(d=e.call(f,f.__data__,p,l))&&("__data__"in f&&(d.__data__=f.__data__),u[p]=d,xm(u[p],t,n,p,u,Qs(f,n)));return new Zi(i,this._parents,t,n)}function O3(e){var t=this._name,n=this._id;typeof e!="function"&&(e=RA(e));for(var r=this._groups,s=r.length,i=[],a=[],l=0;l<s;++l)for(var c=r[l],u=c.length,f,d=0;d<u;++d)if(f=c[d]){for(var p=e.call(f,f.__data__,d,c),h,g=Qs(f,n),k=0,w=p.length;k<w;++k)(h=p[k])&&xm(h,t,n,k,p,g);i.push(p),a.push(f)}return new Zi(i,a,t,n)}var D3=Ld.prototype.constructor;function F3(){return new D3(this._groups,this._parents)}function z3(e,t){var n,r,s;return function(){var i=oc(this,e),a=(this.style.removeProperty(e),oc(this,e));return i===a?null:i===n&&a===r?s:s=t(n=i,r=a)}}function rP(e){return function(){this.style.removeProperty(e)}}function B3(e,t,n){var r,s=n+"",i;return function(){var a=oc(this,e);return a===s?null:a===r?i:i=t(r=a,n)}}function H3(e,t,n){var r,s,i;return function(){var a=oc(this,e),l=n(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(e),oc(this,e))),a===c?null:a===r&&c===s?i:(s=c,i=t(r=a,l))}}function W3(e,t){var n,r,s,i="style."+t,a="end."+i,l;return function(){var c=ji(this,e),u=c.on,f=c.value[i]==null?l||(l=rP(t)):void 0;(u!==n||s!==f)&&(r=(n=u).copy()).on(a,s=f),c.on=r}}function V3(e,t,n){var r=(e+="")=="transform"?Kz:nP;return t==null?this.styleTween(e,z3(e,r)).on("end.style."+e,rP(e)):typeof t=="function"?this.styleTween(e,H3(e,r,Ub(this,"style."+e,t))).each(W3(this._id,e)):this.styleTween(e,B3(e,r,t),n).on("end.style."+e,null)}function K3(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function U3(e,t,n){var r,s;function i(){var a=t.apply(this,arguments);return a!==s&&(r=(s=a)&&K3(e,a,n)),r}return i._value=t,i}function q3(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,U3(e,t,n??""))}function Y3(e){return function(){this.textContent=e}}function G3(e){return function(){var t=e(this);this.textContent=t??""}}function J3(e){return this.tween("text",typeof e=="function"?G3(Ub(this,"text",e)):Y3(e==null?"":e+""))}function X3(e){return function(t){this.textContent=e.call(this,t)}}function Q3(e){var t,n;function r(){var s=e.apply(this,arguments);return s!==n&&(t=(n=s)&&X3(s)),t}return r._value=e,r}function Z3(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,Q3(e))}function eB(){for(var e=this._name,t=this._id,n=sP(),r=this._groups,s=r.length,i=0;i<s;++i)for(var a=r[i],l=a.length,c,u=0;u<l;++u)if(c=a[u]){var f=Qs(c,t);xm(c,e,n,u,a,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new Zi(r,this._parents,e,n)}function tB(){var e,t,n=this,r=n._id,s=n.size();return new Promise(function(i,a){var l={value:a},c={value:function(){--s===0&&i()}};n.each(function(){var u=ji(this,r),f=u.on;f!==e&&(t=(e=f).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(c)),u.on=t}),s===0&&i()})}var nB=0;function Zi(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function sP(){return++nB}var Mi=Ld.prototype;Zi.prototype={constructor:Zi,select:L3,selectAll:O3,selectChild:Mi.selectChild,selectChildren:Mi.selectChildren,filter:A3,merge:P3,selection:F3,transition:eB,call:Mi.call,nodes:Mi.nodes,node:Mi.node,size:Mi.size,empty:Mi.empty,each:Mi.each,on:T3,attr:p3,attrTween:x3,style:V3,styleTween:q3,text:J3,textTween:Z3,remove:$3,tween:o3,delay:k3,duration:N3,ease:C3,easeVarying:E3,end:tB,[Symbol.iterator]:Mi[Symbol.iterator]};function rB(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var sB={time:null,delay:0,duration:250,ease:rB};function iB(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function oB(e){var t,n;e instanceof Zi?(t=e._id,e=e._name):(t=sP(),(n=sB).time=Vb(),e=e==null?null:e+"");for(var r=this._groups,s=r.length,i=0;i<s;++i)for(var a=r[i],l=a.length,c,u=0;u<l;++u)(c=a[u])&&xm(c,e,t,u,a,n||iB(c,t));return new Zi(r,this._parents,e,t)}Ld.prototype.interrupt=r3;Ld.prototype.transition=oB;const Jf=e=>()=>e;function aB(e,{sourceEvent:t,target:n,transform:r,dispatch:s}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:s}})}function Hi(e,t,n){this.k=e,this.x=t,this.y=n}Hi.prototype={constructor:Hi,scale:function(e){return e===1?this:new Hi(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Hi(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var wm=new Hi(1,0,0);iP.prototype=Hi.prototype;function iP(e){for(;!e.__zoom;)if(!(e=e.parentNode))return wm;return e.__zoom}function iy(e){e.stopImmediatePropagation()}function iu(e){e.preventDefault(),e.stopImmediatePropagation()}function lB(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function cB(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function AN(){return this.__zoom||wm}function uB(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function dB(){return navigator.maxTouchPoints||"ontouchstart"in this}function fB(e,t,n){var r=e.invertX(t[0][0])-n[0][0],s=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}function oP(){var e=lB,t=cB,n=fB,r=uB,s=dB,i=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=Mp,u=mm("start","zoom","end"),f,d,p,h=500,g=150,k=0,w=10;function y(M){M.property("__zoom",AN).on("wheel.zoom",I,{passive:!1}).on("mousedown.zoom",D).on("dblclick.zoom",H).filter(s).on("touchstart.zoom",V).on("touchmove.zoom",F).on("touchend.zoom touchcancel.zoom",L).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(M,K,W,$){var R=M.selection?M.selection():M;R.property("__zoom",AN),M!==R?N(M,K,W,$):R.interrupt().each(function(){j(this,arguments).event($).start().zoom(null,typeof K=="function"?K.apply(this,arguments):K).end()})},y.scaleBy=function(M,K,W,$){y.scaleTo(M,function(){var R=this.__zoom.k,B=typeof K=="function"?K.apply(this,arguments):K;return R*B},W,$)},y.scaleTo=function(M,K,W,$){y.transform(M,function(){var R=t.apply(this,arguments),B=this.__zoom,_=W==null?C(R):typeof W=="function"?W.apply(this,arguments):W,X=B.invert(_),z=typeof K=="function"?K.apply(this,arguments):K;return n(b(v(B,z),_,X),R,a)},W,$)},y.translateBy=function(M,K,W,$){y.transform(M,function(){return n(this.__zoom.translate(typeof K=="function"?K.apply(this,arguments):K,typeof W=="function"?W.apply(this,arguments):W),t.apply(this,arguments),a)},null,$)},y.translateTo=function(M,K,W,$,R){y.transform(M,function(){var B=t.apply(this,arguments),_=this.__zoom,X=$==null?C(B):typeof $=="function"?$.apply(this,arguments):$;return n(wm.translate(X[0],X[1]).scale(_.k).translate(typeof K=="function"?-K.apply(this,arguments):-K,typeof W=="function"?-W.apply(this,arguments):-W),B,a)},$,R)};function v(M,K){return K=Math.max(i[0],Math.min(i[1],K)),K===M.k?M:new Hi(K,M.x,M.y)}function b(M,K,W){var $=K[0]-W[0]*M.k,R=K[1]-W[1]*M.k;return $===M.x&&R===M.y?M:new Hi(M.k,$,R)}function C(M){return[(+M[0][0]+ +M[1][0])/2,(+M[0][1]+ +M[1][1])/2]}function N(M,K,W,$){M.on("start.zoom",function(){j(this,arguments).event($).start()}).on("interrupt.zoom end.zoom",function(){j(this,arguments).event($).end()}).tween("zoom",function(){var R=this,B=arguments,_=j(R,B).event($),X=t.apply(R,B),z=W==null?C(X):typeof W=="function"?W.apply(R,B):W,T=Math.max(X[1][0]-X[0][0],X[1][1]-X[0][1]),Z=R.__zoom,ae=typeof K=="function"?K.apply(R,B):K,J=c(Z.invert(z).concat(T/Z.k),ae.invert(z).concat(T/ae.k));return function(se){if(se===1)se=ae;else{var ee=J(se),re=T/ee[2];se=new Hi(re,z[0]-ee[0]*re,z[1]-ee[1]*re)}_.zoom(null,se)}})}function j(M,K,W){return!W&&M.__zooming||new A(M,K)}function A(M,K){this.that=M,this.args=K,this.active=0,this.sourceEvent=null,this.extent=t.apply(M,K),this.taps=0}A.prototype={event:function(M){return M&&(this.sourceEvent=M),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(M,K){return this.mouse&&M!=="mouse"&&(this.mouse[1]=K.invert(this.mouse[0])),this.touch0&&M!=="touch"&&(this.touch0[1]=K.invert(this.touch0[0])),this.touch1&&M!=="touch"&&(this.touch1[1]=K.invert(this.touch1[0])),this.that.__zoom=K,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(M){var K=ts(this.that).datum();u.call(M,this.that,new aB(M,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:u}),K)}};function I(M,...K){if(!e.apply(this,arguments))return;var W=j(this,K).event(M),$=this.__zoom,R=Math.max(i[0],Math.min(i[1],$.k*Math.pow(2,r.apply(this,arguments)))),B=zs(M);if(W.wheel)(W.mouse[0][0]!==B[0]||W.mouse[0][1]!==B[1])&&(W.mouse[1]=$.invert(W.mouse[0]=B)),clearTimeout(W.wheel);else{if($.k===R)return;W.mouse=[B,$.invert(B)],Op(this),W.start()}iu(M),W.wheel=setTimeout(_,g),W.zoom("mouse",n(b(v($,R),W.mouse[0],W.mouse[1]),W.extent,a));function _(){W.wheel=null,W.end()}}function D(M,...K){if(p||!e.apply(this,arguments))return;var W=M.currentTarget,$=j(this,K,!0).event(M),R=ts(M.view).on("mousemove.zoom",z,!0).on("mouseup.zoom",T,!0),B=zs(M,W),_=M.clientX,X=M.clientY;WA(M.view),iy(M),$.mouse=[B,this.__zoom.invert(B)],Op(this),$.start();function z(Z){if(iu(Z),!$.moved){var ae=Z.clientX-_,J=Z.clientY-X;$.moved=ae*ae+J*J>k}$.event(Z).zoom("mouse",n(b($.that.__zoom,$.mouse[0]=zs(Z,W),$.mouse[1]),$.extent,a))}function T(Z){R.on("mousemove.zoom mouseup.zoom",null),VA(Z.view,$.moved),iu(Z),$.event(Z).end()}}function H(M,...K){if(e.apply(this,arguments)){var W=this.__zoom,$=zs(M.changedTouches?M.changedTouches[0]:M,this),R=W.invert($),B=W.k*(M.shiftKey?.5:2),_=n(b(v(W,B),$,R),t.apply(this,K),a);iu(M),l>0?ts(this).transition().duration(l).call(N,_,$,M):ts(this).call(y.transform,_,$,M)}}function V(M,...K){if(e.apply(this,arguments)){var W=M.touches,$=W.length,R=j(this,K,M.changedTouches.length===$).event(M),B,_,X,z;for(iy(M),_=0;_<$;++_)X=W[_],z=zs(X,this),z=[z,this.__zoom.invert(z),X.identifier],R.touch0?!R.touch1&&R.touch0[2]!==z[2]&&(R.touch1=z,R.taps=0):(R.touch0=z,B=!0,R.taps=1+!!f);f&&(f=clearTimeout(f)),B&&(R.taps<2&&(d=z[0],f=setTimeout(function(){f=null},h)),Op(this),R.start())}}function F(M,...K){if(this.__zooming){var W=j(this,K).event(M),$=M.changedTouches,R=$.length,B,_,X,z;for(iu(M),B=0;B<R;++B)_=$[B],X=zs(_,this),W.touch0&&W.touch0[2]===_.identifier?W.touch0[0]=X:W.touch1&&W.touch1[2]===_.identifier&&(W.touch1[0]=X);if(_=W.that.__zoom,W.touch1){var T=W.touch0[0],Z=W.touch0[1],ae=W.touch1[0],J=W.touch1[1],se=(se=ae[0]-T[0])*se+(se=ae[1]-T[1])*se,ee=(ee=J[0]-Z[0])*ee+(ee=J[1]-Z[1])*ee;_=v(_,Math.sqrt(se/ee)),X=[(T[0]+ae[0])/2,(T[1]+ae[1])/2],z=[(Z[0]+J[0])/2,(Z[1]+J[1])/2]}else if(W.touch0)X=W.touch0[0],z=W.touch0[1];else return;W.zoom("touch",n(b(_,X,z),W.extent,a))}}function L(M,...K){if(this.__zooming){var W=j(this,K).event(M),$=M.changedTouches,R=$.length,B,_;for(iy(M),p&&clearTimeout(p),p=setTimeout(function(){p=null},h),B=0;B<R;++B)_=$[B],W.touch0&&W.touch0[2]===_.identifier?delete W.touch0:W.touch1&&W.touch1[2]===_.identifier&&delete W.touch1;if(W.touch1&&!W.touch0&&(W.touch0=W.touch1,delete W.touch1),W.touch0)W.touch0[1]=this.__zoom.invert(W.touch0[0]);else if(W.end(),W.taps===2&&(_=zs(_,this),Math.hypot(d[0]-_[0],d[1]-_[1])<w)){var X=ts(this).on("dblclick.zoom");X&&X.apply(this,arguments)}}}return y.wheelDelta=function(M){return arguments.length?(r=typeof M=="function"?M:Jf(+M),y):r},y.filter=function(M){return arguments.length?(e=typeof M=="function"?M:Jf(!!M),y):e},y.touchable=function(M){return arguments.length?(s=typeof M=="function"?M:Jf(!!M),y):s},y.extent=function(M){return arguments.length?(t=typeof M=="function"?M:Jf([[+M[0][0],+M[0][1]],[+M[1][0],+M[1][1]]]),y):t},y.scaleExtent=function(M){return arguments.length?(i[0]=+M[0],i[1]=+M[1],y):[i[0],i[1]]},y.translateExtent=function(M){return arguments.length?(a[0][0]=+M[0][0],a[1][0]=+M[1][0],a[0][1]=+M[0][1],a[1][1]=+M[1][1],y):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},y.constrain=function(M){return arguments.length?(n=M,y):n},y.duration=function(M){return arguments.length?(l=+M,y):l},y.interpolate=function(M){return arguments.length?(c=M,y):c},y.on=function(){var M=u.on.apply(u,arguments);return M===u?y:M},y.clickDistance=function(M){return arguments.length?(k=(M=+M)*M,y):Math.sqrt(k)},y.tapDistance=function(M){return arguments.length?(w=+M,y):w},y}const vi={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},fd=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],aP=["Enter"," ","Escape"],lP={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var lc;(function(e){e.Strict="strict",e.Loose="loose"})(lc||(lc={}));var ja;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(ja||(ja={}));var pd;(function(e){e.Partial="partial",e.Full="full"})(pd||(pd={}));const cP={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var jo;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(jo||(jo={}));var fi;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(fi||(fi={}));var Be;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Be||(Be={}));const PN={[Be.Left]:Be.Right,[Be.Right]:Be.Left,[Be.Top]:Be.Bottom,[Be.Bottom]:Be.Top};function uP(e){return e===null?null:e?"valid":"invalid"}const dP=e=>"id"in e&&"source"in e&&"target"in e,pB=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),qb=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Dd=(e,t=[0,0])=>{const{width:n,height:r}=no(e),s=e.origin??t,i=n*s[0],a=r*s[1];return{x:e.position.x-i,y:e.position.y-a}},hB=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,s)=>{const i=typeof s=="string";let a=!t.nodeLookup&&!i?s:void 0;t.nodeLookup&&(a=i?t.nodeLookup.get(s):qb(s)?s:t.nodeLookup.get(s.id));const l=a?Nh(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return bm(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return km(n)},Fd=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(s=>{(t.filter===void 0||t.filter(s))&&(n=bm(n,Nh(s)),r=!0)}),r?km(n):{x:0,y:0,width:0,height:0}},Yb=(e,t,[n,r,s]=[0,0,1],i=!1,a=!1)=>{const l={...Bd(t,[n,r,s]),width:t.width/s,height:t.height/s},c=[];for(const u of e.values()){const{measured:f,selectable:d=!0,hidden:p=!1}=u;if(a&&!d||p)continue;const h=f.width??u.width??u.initialWidth??null,g=f.height??u.height??u.initialHeight??null,k=hd(l,uc(u)),w=(h??0)*(g??0),y=i&&k>0;(!u.internals.handleBounds||y||k>=w||u.dragging)&&c.push(u)}return c},mB=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function gB(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(s=>s.id)):null;return e.forEach(s=>{s.measured.width&&s.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!s.hidden)&&(!r||r.has(s.id))&&n.set(s.id,s)}),n}async function yB({nodes:e,width:t,height:n,panZoom:r,minZoom:s,maxZoom:i},a){if(e.size===0)return Promise.resolve(!0);const l=gB(e,a),c=Fd(l),u=Gb(c,t,n,(a==null?void 0:a.minZoom)??s,(a==null?void 0:a.maxZoom)??i,(a==null?void 0:a.padding)??.1);return await r.setViewport(u,{duration:a==null?void 0:a.duration,ease:a==null?void 0:a.ease,interpolate:a==null?void 0:a.interpolate}),Promise.resolve(!0)}function fP({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:s,onError:i}){const a=n.get(e),l=a.parentId?n.get(a.parentId):void 0,{x:c,y:u}=l?l.internals.positionAbsolute:{x:0,y:0},f=a.origin??r;let d=a.extent||s;if(a.extent==="parent"&&!a.expandParent)if(!l)i==null||i("005",vi.error005());else{const h=l.measured.width,g=l.measured.height;h&&g&&(d=[[c,u],[c+h,u+g]])}else l&&dc(a.extent)&&(d=[[a.extent[0][0]+c,a.extent[0][1]+u],[a.extent[1][0]+c,a.extent[1][1]+u]]);const p=dc(d)?$a(t,d,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(i==null||i("015",vi.error015())),{position:{x:p.x-c+(a.measured.width??0)*f[0],y:p.y-u+(a.measured.height??0)*f[1]},positionAbsolute:p}}async function xB({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:s}){const i=new Set(e.map(p=>p.id)),a=[];for(const p of n){if(p.deletable===!1)continue;const h=i.has(p.id),g=!h&&p.parentId&&a.find(k=>k.id===p.parentId);(h||g)&&a.push(p)}const l=new Set(t.map(p=>p.id)),c=r.filter(p=>p.deletable!==!1),f=mB(a,c);for(const p of c)l.has(p.id)&&!f.find(g=>g.id===p.id)&&f.push(p);if(!s)return{edges:f,nodes:a};const d=await s({nodes:a,edges:f});return typeof d=="boolean"?d?{edges:f,nodes:a}:{edges:[],nodes:[]}:d}const cc=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),$a=(e={x:0,y:0},t,n)=>({x:cc(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:cc(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function pP(e,t,n){const{width:r,height:s}=no(n),{x:i,y:a}=n.internals.positionAbsolute;return $a(e,[[i,a],[i+r,a+s]],t)}const IN=(e,t,n)=>e<t?cc(Math.abs(e-t),1,t)/t:e>n?-cc(Math.abs(e-n),1,t)/t:0,hP=(e,t,n=15,r=40)=>{const s=IN(e.x,r,t.width-r)*n,i=IN(e.y,r,t.height-r)*n;return[s,i]},bm=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),nw=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),km=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),uc=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=qb(e)?e.internals.positionAbsolute:Dd(e,t);return{x:n,y:r,width:((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},Nh=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=qb(e)?e.internals.positionAbsolute:Dd(e,t);return{x:n,y:r,x2:n+(((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0),y2:r+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},mP=(e,t)=>km(bm(nw(e),nw(t))),hd=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},RN=e=>Vs(e.width)&&Vs(e.height)&&Vs(e.x)&&Vs(e.y),Vs=e=>!isNaN(e)&&isFinite(e),wB=(e,t)=>{},zd=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Bd=({x:e,y:t},[n,r,s],i=!1,a=[1,1])=>{const l={x:(e-n)/s,y:(t-r)/s};return i?zd(l,a):l},jh=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r});function hl(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function bB(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=hl(e,n),s=hl(e,t);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof e=="object"){const r=hl(e.top??e.y??0,n),s=hl(e.bottom??e.y??0,n),i=hl(e.left??e.x??0,t),a=hl(e.right??e.x??0,t);return{top:r,right:a,bottom:s,left:i,x:i+a,y:r+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function kB(e,t,n,r,s,i){const{x:a,y:l}=jh(e,[t,n,r]),{x:c,y:u}=jh({x:e.x+e.width,y:e.y+e.height},[t,n,r]),f=s-c,d=i-u;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(f),bottom:Math.floor(d)}}const Gb=(e,t,n,r,s,i)=>{const a=bB(i,t,n),l=(t-a.x)/e.width,c=(n-a.y)/e.height,u=Math.min(l,c),f=cc(u,r,s),d=e.x+e.width/2,p=e.y+e.height/2,h=t/2-d*f,g=n/2-p*f,k=kB(e,h,g,f,t,n),w={left:Math.min(k.left-a.left,0),top:Math.min(k.top-a.top,0),right:Math.min(k.right-a.right,0),bottom:Math.min(k.bottom-a.bottom,0)};return{x:h-w.left+w.right,y:g-w.top+w.bottom,zoom:f}},md=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function dc(e){return e!=null&&e!=="parent"}function no(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function gP(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function yP(e,t={width:0,height:0},n,r,s){const i={...e},a=r.get(n);if(a){const l=a.origin||s;i.x+=a.internals.positionAbsolute.x-(t.width??0)*l[0],i.y+=a.internals.positionAbsolute.y-(t.height??0)*l[1]}return i}function TN(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function vB(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}function SB(e){return{...lP,...e||{}}}function Lu(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:i,y:a}=Ks(e),l=Bd({x:i-((s==null?void 0:s.left)??0),y:a-((s==null?void 0:s.top)??0)},r),{x:c,y:u}=n?zd(l,t):l;return{xSnapped:c,ySnapped:u,...l}}const Jb=e=>({width:e.offsetWidth,height:e.offsetHeight}),xP=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},NB=["INPUT","SELECT","TEXTAREA"];function wP(e){var r,s;const t=((s=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:s[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:NB.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const bP=e=>"clientX"in e,Ks=(e,t)=>{var i,a;const n=bP(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,s=n?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:s-((t==null?void 0:t.top)??0)}},MN=(e,t,n,r,s)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(a=>{const l=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:s,position:a.getAttribute("data-handlepos"),x:(l.left-n.left)/r,y:(l.top-n.top)/r,...Jb(a)}})};function kP({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:s,sourceControlY:i,targetControlX:a,targetControlY:l}){const c=e*.125+s*.375+a*.375+n*.125,u=t*.125+i*.375+l*.375+r*.125,f=Math.abs(c-e),d=Math.abs(u-t);return[c,u,f,d]}function Xf(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function $N({pos:e,x1:t,y1:n,x2:r,y2:s,c:i}){switch(e){case Be.Left:return[t-Xf(t-r,i),n];case Be.Right:return[t+Xf(r-t,i),n];case Be.Top:return[t,n-Xf(n-s,i)];case Be.Bottom:return[t,n+Xf(s-n,i)]}}function vP({sourceX:e,sourceY:t,sourcePosition:n=Be.Bottom,targetX:r,targetY:s,targetPosition:i=Be.Top,curvature:a=.25}){const[l,c]=$N({pos:n,x1:e,y1:t,x2:r,y2:s,c:a}),[u,f]=$N({pos:i,x1:r,y1:s,x2:e,y2:t,c:a}),[d,p,h,g]=kP({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:f});return[`M${e},${t} C${l},${c} ${u},${f} ${r},${s}`,d,p,h,g]}function SP({sourceX:e,sourceY:t,targetX:n,targetY:r}){const s=Math.abs(n-e)/2,i=n<e?n+s:n-s,a=Math.abs(r-t)/2,l=r<t?r+a:r-a;return[i,l,s,a]}function jB({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:s=!1,zIndexMode:i="basic"}){if(i==="manual")return r;const a=s&&n?r+1e3:r,l=Math.max(e.parentId||s&&e.selected?e.internals.z:0,t.parentId||s&&t.selected?t.internals.z:0);return a+l}function CB({sourceNode:e,targetNode:t,width:n,height:r,transform:s}){const i=bm(Nh(e),Nh(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const a={x:-s[0]/s[2],y:-s[1]/s[2],width:n/s[2],height:r/s[2]};return hd(a,km(i))>0}const _B=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,EB=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Dp=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||_B;let s;return dP(e)?s={...e}:s={...e,id:r(e)},EB(s,t)?t:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,t.concat(s))};function NP({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,i,a,l]=SP({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,i,a,l]}const LN={[Be.Left]:{x:-1,y:0},[Be.Right]:{x:1,y:0},[Be.Top]:{x:0,y:-1},[Be.Bottom]:{x:0,y:1}},AB=({source:e,sourcePosition:t=Be.Bottom,target:n})=>t===Be.Left||t===Be.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},ON=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function PB({source:e,sourcePosition:t=Be.Bottom,target:n,targetPosition:r=Be.Top,center:s,offset:i,stepPosition:a}){const l=LN[t],c=LN[r],u={x:e.x+l.x*i,y:e.y+l.y*i},f={x:n.x+c.x*i,y:n.y+c.y*i},d=AB({source:u,sourcePosition:t,target:f}),p=d.x!==0?"x":"y",h=d[p];let g=[],k,w;const y={x:0,y:0},v={x:0,y:0},[,,b,C]=SP({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[p]*c[p]===-1){p==="x"?(k=s.x??u.x+(f.x-u.x)*a,w=s.y??(u.y+f.y)/2):(k=s.x??(u.x+f.x)/2,w=s.y??u.y+(f.y-u.y)*a);const I=[{x:k,y:u.y},{x:k,y:f.y}],D=[{x:u.x,y:w},{x:f.x,y:w}];l[p]===h?g=p==="x"?I:D:g=p==="x"?D:I}else{const I=[{x:u.x,y:f.y}],D=[{x:f.x,y:u.y}];if(p==="x"?g=l.x===h?D:I:g=l.y===h?I:D,t===r){const M=Math.abs(e[p]-n[p]);if(M<=i){const K=Math.min(i-1,i-M);l[p]===h?y[p]=(u[p]>e[p]?-1:1)*K:v[p]=(f[p]>n[p]?-1:1)*K}}if(t!==r){const M=p==="x"?"y":"x",K=l[p]===c[M],W=u[M]>f[M],$=u[M]<f[M];(l[p]===1&&(!K&&W||K&&$)||l[p]!==1&&(!K&&$||K&&W))&&(g=p==="x"?I:D)}const H={x:u.x+y.x,y:u.y+y.y},V={x:f.x+v.x,y:f.y+v.y},F=Math.max(Math.abs(H.x-g[0].x),Math.abs(V.x-g[0].x)),L=Math.max(Math.abs(H.y-g[0].y),Math.abs(V.y-g[0].y));F>=L?(k=(H.x+V.x)/2,w=g[0].y):(k=g[0].x,w=(H.y+V.y)/2)}const N={x:u.x+y.x,y:u.y+y.y},j={x:f.x+v.x,y:f.y+v.y};return[[e,...N.x!==g[0].x||N.y!==g[0].y?[N]:[],...g,...j.x!==g[g.length-1].x||j.y!==g[g.length-1].y?[j]:[],n],k,w,b,C]}function IB(e,t,n,r){const s=Math.min(ON(e,t)/2,ON(t,n)/2,r),{x:i,y:a}=t;if(e.x===i&&i===n.x||e.y===a&&a===n.y)return`L${i} ${a}`;if(e.y===a){const u=e.x<n.x?-1:1,f=e.y<n.y?1:-1;return`L ${i+s*u},${a}Q ${i},${a} ${i},${a+s*f}`}const l=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${a+s*c}Q ${i},${a} ${i+s*l},${a}`}function rw({sourceX:e,sourceY:t,sourcePosition:n=Be.Bottom,targetX:r,targetY:s,targetPosition:i=Be.Top,borderRadius:a=5,centerX:l,centerY:c,offset:u=20,stepPosition:f=.5}){const[d,p,h,g,k]=PB({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:s},targetPosition:i,center:{x:l,y:c},offset:u,stepPosition:f});let w=`M${d[0].x} ${d[0].y}`;for(let y=1;y<d.length-1;y++)w+=IB(d[y-1],d[y],d[y+1],a);return w+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[w,p,h,g,k]}function DN(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function RB(e){var d;const{sourceNode:t,targetNode:n}=e;if(!DN(t)||!DN(n))return null;const r=t.internals.handleBounds||FN(t.handles),s=n.internals.handleBounds||FN(n.handles),i=zN((r==null?void 0:r.source)??[],e.sourceHandle),a=zN(e.connectionMode===lc.Strict?(s==null?void 0:s.target)??[]:((s==null?void 0:s.target)??[]).concat((s==null?void 0:s.source)??[]),e.targetHandle);if(!i||!a)return(d=e.onError)==null||d.call(e,"008",vi.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=(i==null?void 0:i.position)||Be.Bottom,c=(a==null?void 0:a.position)||Be.Top,u=La(t,i,l),f=La(n,a,c);return{sourceX:u.x,sourceY:u.y,targetX:f.x,targetY:f.y,sourcePosition:l,targetPosition:c}}function FN(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function La(e,t,n=Be.Left,r=!1){const s=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,i=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:a,height:l}=t??no(e);if(r)return{x:s+a/2,y:i+l/2};switch((t==null?void 0:t.position)??n){case Be.Top:return{x:s+a/2,y:i};case Be.Right:return{x:s+a,y:i+l/2};case Be.Bottom:return{x:s+a/2,y:i+l};case Be.Left:return{x:s,y:i+l/2}}}function zN(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function sw(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function TB(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:s}){const i=new Set;return e.reduce((a,l)=>([l.markerStart||r,l.markerEnd||s].forEach(c=>{if(c&&typeof c=="object"){const u=sw(c,t);i.has(u)||(a.push({id:u,color:c.color||n,...c}),i.add(u))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))}const jP=1e3,MB=10,Xb={nodeOrigin:[0,0],nodeExtent:fd,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},$B={...Xb,checkEquality:!0};function Qb(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function LB(e,t,n){const r=Qb(Xb,n);for(const s of e.values())if(s.parentId)ek(s,e,t,r);else{const i=Dd(s,r.nodeOrigin),a=dc(s.extent)?s.extent:r.nodeExtent,l=$a(i,a,no(s));s.internals.positionAbsolute=l}}function OB(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const s of e.handles){const i={id:s.id,width:s.width??1,height:s.height??1,nodeId:e.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?n.push(i):s.type==="target"&&r.push(i)}return{source:n,target:r}}function Zb(e){return e==="manual"}function iw(e,t,n,r={}){var f,d;const s=Qb($B,r),i={i:0},a=new Map(t),l=s!=null&&s.elevateNodesOnSelect&&!Zb(s.zIndexMode)?jP:0;let c=e.length>0,u=!1;t.clear(),n.clear();for(const p of e){let h=a.get(p.id);if(s.checkEquality&&p===(h==null?void 0:h.internals.userNode))t.set(p.id,h);else{const g=Dd(p,s.nodeOrigin),k=dc(p.extent)?p.extent:s.nodeExtent,w=$a(g,k,no(p));h={...s.defaults,...p,measured:{width:(f=p.measured)==null?void 0:f.width,height:(d=p.measured)==null?void 0:d.height},internals:{positionAbsolute:w,handleBounds:OB(p,h),z:CP(p,l,s.zIndexMode),userNode:p}},t.set(p.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),p.parentId&&ek(h,t,n,r,i),u||(u=p.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function DB(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function ek(e,t,n,r,s){const{elevateNodesOnSelect:i,nodeOrigin:a,nodeExtent:l,zIndexMode:c}=Qb(Xb,r),u=e.parentId,f=t.get(u);if(!f){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}DB(e,n),s&&!f.parentId&&f.internals.rootParentIndex===void 0&&c==="auto"&&(f.internals.rootParentIndex=++s.i,f.internals.z=f.internals.z+s.i*MB),s&&f.internals.rootParentIndex!==void 0&&(s.i=f.internals.rootParentIndex);const d=i&&!Zb(c)?jP:0,{x:p,y:h,z:g}=FB(e,f,a,l,d,c),{positionAbsolute:k}=e.internals,w=p!==k.x||h!==k.y;(w||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:w?{x:p,y:h}:k,z:g}})}function CP(e,t,n){const r=Vs(e.zIndex)?e.zIndex:0;return Zb(n)?r:r+(e.selected?t:0)}function FB(e,t,n,r,s,i){const{x:a,y:l}=t.internals.positionAbsolute,c=no(e),u=Dd(e,n),f=dc(e.extent)?$a(u,e.extent,c):u;let d=$a({x:a+f.x,y:l+f.y},r,c);e.extent==="parent"&&(d=pP(d,c,t));const p=CP(e,s,i),h=t.internals.z??0;return{x:d.x,y:d.y,z:h>=p?h+1:p}}function tk(e,t,n,r=[0,0]){var a;const s=[],i=new Map;for(const l of e){const c=t.get(l.parentId);if(!c)continue;const u=((a=i.get(l.parentId))==null?void 0:a.expandedRect)??uc(c),f=mP(u,l.rect);i.set(l.parentId,{expandedRect:f,parent:c})}return i.size>0&&i.forEach(({expandedRect:l,parent:c},u)=>{var b;const f=c.internals.positionAbsolute,d=no(c),p=c.origin??r,h=l.x<f.x?Math.round(Math.abs(f.x-l.x)):0,g=l.y<f.y?Math.round(Math.abs(f.y-l.y)):0,k=Math.max(d.width,Math.round(l.width)),w=Math.max(d.height,Math.round(l.height)),y=(k-d.width)*p[0],v=(w-d.height)*p[1];(h>0||g>0||y||v)&&(s.push({id:u,type:"position",position:{x:c.position.x-h+y,y:c.position.y-g+v}}),(b=n.get(u))==null||b.forEach(C=>{e.some(N=>N.id===C.id)||s.push({id:C.id,type:"position",position:{x:C.position.x+h,y:C.position.y+g}})})),(d.width<l.width||d.height<l.height||h||g)&&s.push({id:u,type:"dimensions",setAttributes:!0,dimensions:{width:k+(h?p[0]*h-y:0),height:w+(g?p[1]*g-v:0)}})}),s}function zB(e,t,n,r,s,i,a){const l=r==null?void 0:r.querySelector(".xyflow__viewport");let c=!1;if(!l)return{changes:[],updatedInternals:c};const u=[],f=window.getComputedStyle(l),{m22:d}=new window.DOMMatrixReadOnly(f.transform),p=[];for(const h of e.values()){const g=t.get(h.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const k=Jb(h.nodeElement),w=g.measured.width!==k.width||g.measured.height!==k.height;if(!!(k.width&&k.height&&(w||!g.internals.handleBounds||h.force))){const v=h.nodeElement.getBoundingClientRect(),b=dc(g.extent)?g.extent:i;let{positionAbsolute:C}=g.internals;g.parentId&&g.extent==="parent"?C=pP(C,k,t.get(g.parentId)):b&&(C=$a(C,b,k));const N={...g,measured:k,internals:{...g.internals,positionAbsolute:C,handleBounds:{source:MN("source",h.nodeElement,v,d,g.id),target:MN("target",h.nodeElement,v,d,g.id)}}};t.set(g.id,N),g.parentId&&ek(N,t,n,{nodeOrigin:s,zIndexMode:a}),c=!0,w&&(u.push({id:g.id,type:"dimensions",dimensions:k}),g.expandParent&&g.parentId&&p.push({id:g.id,parentId:g.parentId,rect:uc(N,s)}))}}if(p.length>0){const h=tk(p,t,n,s);u.push(...h)}return{changes:u,updatedInternals:c}}async function BB({delta:e,panZoom:t,transform:n,translateExtent:r,width:s,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const a=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[s,i]],r),l=!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2]);return Promise.resolve(l)}function BN(e,t,n,r,s,i){let a=s;const l=r.get(a)||new Map;r.set(a,l.set(n,t)),a=`${s}-${e}`;const c=r.get(a)||new Map;if(r.set(a,c.set(n,t)),i){a=`${s}-${e}-${i}`;const u=r.get(a)||new Map;r.set(a,u.set(n,t))}}function _P(e,t,n){e.clear(),t.clear();for(const r of n){const{source:s,target:i,sourceHandle:a=null,targetHandle:l=null}=r,c={edgeId:r.id,source:s,target:i,sourceHandle:a,targetHandle:l},u=`${s}-${a}--${i}-${l}`,f=`${i}-${l}--${s}-${a}`;BN("source",c,f,e,s,a),BN("target",c,u,e,i,l),t.set(r.id,r)}}function EP(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:EP(n,t):!1}function HN(e,t,n){var s;let r=e;do{if((s=r==null?void 0:r.matches)!=null&&s.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function HB(e,t,n,r){const s=new Map;for(const[i,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!EP(a,e))&&(a.draggable||t&&typeof a.draggable>"u")){const l=e.get(i);l&&s.set(i,{id:i,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return s}function oy({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var a,l,c;const s=[];for(const[u,f]of t){const d=(a=n.get(u))==null?void 0:a.internals.userNode;d&&s.push({...d,position:f.position,dragging:r})}if(!e)return[s[0],s];const i=(l=n.get(e))==null?void 0:l.internals.userNode;return[i?{...i,position:((c=t.get(e))==null?void 0:c.position)||i.position,dragging:r}:s[0],s]}function WB({dragItems:e,snapGrid:t,x:n,y:r}){const s=e.values().next().value;if(!s)return null;const i={x:n-s.distance.x,y:r-s.distance.y},a=zd(i,t);return{x:a.x-i.x,y:a.y-i.y}}function VB({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:s}){let i={x:null,y:null},a=0,l=new Map,c=!1,u={x:0,y:0},f=null,d=!1,p=null,h=!1,g=!1,k=null;function w({noDragClassName:v,handleSelector:b,domNode:C,isSelectable:N,nodeId:j,nodeClickDistance:A=0}){p=ts(C);function I({x:F,y:L}){const{nodeLookup:M,nodeExtent:K,snapGrid:W,snapToGrid:$,nodeOrigin:R,onNodeDrag:B,onSelectionDrag:_,onError:X,updateNodePositions:z}=t();i={x:F,y:L};let T=!1;const Z=l.size>1,ae=Z&&K?nw(Fd(l)):null,J=Z&&$?WB({dragItems:l,snapGrid:W,x:F,y:L}):null;for(const[se,ee]of l){if(!M.has(se))continue;let re={x:F-ee.distance.x,y:L-ee.distance.y};$&&(re=J?{x:Math.round(re.x+J.x),y:Math.round(re.y+J.y)}:zd(re,W));let ne=null;if(Z&&K&&!ee.extent&&ae){const{positionAbsolute:xe}=ee.internals,ze=xe.x-ae.x+K[0][0],Te=xe.x+ee.measured.width-ae.x2+K[1][0],Le=xe.y-ae.y+K[0][1],nt=xe.y+ee.measured.height-ae.y2+K[1][1];ne=[[ze,Le],[Te,nt]]}const{position:ue,positionAbsolute:de}=fP({nodeId:se,nextPosition:re,nodeLookup:M,nodeExtent:ne||K,nodeOrigin:R,onError:X});T=T||ee.position.x!==ue.x||ee.position.y!==ue.y,ee.position=ue,ee.internals.positionAbsolute=de}if(g=g||T,!!T&&(z(l,!0),k&&(r||B||!j&&_))){const[se,ee]=oy({nodeId:j,dragItems:l,nodeLookup:M});r==null||r(k,l,se,ee),B==null||B(k,se,ee),j||_==null||_(k,ee)}}async function D(){if(!f)return;const{transform:F,panBy:L,autoPanSpeed:M,autoPanOnNodeDrag:K}=t();if(!K){c=!1,cancelAnimationFrame(a);return}const[W,$]=hP(u,f,M);(W!==0||$!==0)&&(i.x=(i.x??0)-W/F[2],i.y=(i.y??0)-$/F[2],await L({x:W,y:$})&&I(i)),a=requestAnimationFrame(D)}function H(F){var Z;const{nodeLookup:L,multiSelectionActive:M,nodesDraggable:K,transform:W,snapGrid:$,snapToGrid:R,selectNodesOnDrag:B,onNodeDragStart:_,onSelectionDragStart:X,unselectNodesAndEdges:z}=t();d=!0,(!B||!N)&&!M&&j&&((Z=L.get(j))!=null&&Z.selected||z()),N&&B&&j&&(e==null||e(j));const T=Lu(F.sourceEvent,{transform:W,snapGrid:$,snapToGrid:R,containerBounds:f});if(i=T,l=HB(L,K,T,j),l.size>0&&(n||_||!j&&X)){const[ae,J]=oy({nodeId:j,dragItems:l,nodeLookup:L});n==null||n(F.sourceEvent,l,ae,J),_==null||_(F.sourceEvent,ae,J),j||X==null||X(F.sourceEvent,J)}}const V=KA().clickDistance(A).on("start",F=>{const{domNode:L,nodeDragThreshold:M,transform:K,snapGrid:W,snapToGrid:$}=t();f=(L==null?void 0:L.getBoundingClientRect())||null,h=!1,g=!1,k=F.sourceEvent,M===0&&H(F),i=Lu(F.sourceEvent,{transform:K,snapGrid:W,snapToGrid:$,containerBounds:f}),u=Ks(F.sourceEvent,f)}).on("drag",F=>{const{autoPanOnNodeDrag:L,transform:M,snapGrid:K,snapToGrid:W,nodeDragThreshold:$,nodeLookup:R}=t(),B=Lu(F.sourceEvent,{transform:M,snapGrid:K,snapToGrid:W,containerBounds:f});if(k=F.sourceEvent,(F.sourceEvent.type==="touchmove"&&F.sourceEvent.touches.length>1||j&&!R.has(j))&&(h=!0),!h){if(!c&&L&&d&&(c=!0,D()),!d){const _=Ks(F.sourceEvent,f),X=_.x-u.x,z=_.y-u.y;Math.sqrt(X*X+z*z)>$&&H(F)}(i.x!==B.xSnapped||i.y!==B.ySnapped)&&l&&d&&(u=Ks(F.sourceEvent,f),I(B))}}).on("end",F=>{if(!(!d||h)&&(c=!1,d=!1,cancelAnimationFrame(a),l.size>0)){const{nodeLookup:L,updateNodePositions:M,onNodeDragStop:K,onSelectionDragStop:W}=t();if(g&&(M(l,!1),g=!1),s||K||!j&&W){const[$,R]=oy({nodeId:j,dragItems:l,nodeLookup:L,dragging:!1});s==null||s(F.sourceEvent,l,$,R),K==null||K(F.sourceEvent,$,R),j||W==null||W(F.sourceEvent,R)}}}).filter(F=>{const L=F.target;return!F.button&&(!v||!HN(L,`.${v}`,C))&&(!b||HN(L,b,C))});p.call(V)}function y(){p==null||p.on(".drag",null)}return{update:w,destroy:y}}function KB(e,t,n){const r=[],s={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())hd(s,uc(i))>0&&r.push(i);return r}const UB=250;function qB(e,t,n,r){var l,c;let s=[],i=1/0;const a=KB(e,n,t+UB);for(const u of a){const f=[...((l=u.internals.handleBounds)==null?void 0:l.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const d of f){if(r.nodeId===d.nodeId&&r.type===d.type&&r.id===d.id)continue;const{x:p,y:h}=La(u,d,d.position,!0),g=Math.sqrt(Math.pow(p-e.x,2)+Math.pow(h-e.y,2));g>t||(g<i?(s=[{...d,x:p,y:h}],i=g):g===i&&s.push({...d,x:p,y:h}))}}if(!s.length)return null;if(s.length>1){const u=r.type==="source"?"target":"source";return s.find(f=>f.type===u)??s[0]}return s[0]}function AP(e,t,n,r,s,i=!1){var u,f,d;const a=r.get(e);if(!a)return null;const l=s==="strict"?(u=a.internals.handleBounds)==null?void 0:u[t]:[...((f=a.internals.handleBounds)==null?void 0:f.source)??[],...((d=a.internals.handleBounds)==null?void 0:d.target)??[]],c=(n?l==null?void 0:l.find(p=>p.id===n):l==null?void 0:l[0])??null;return c&&i?{...c,...La(a,c,c.position,!0)}:c}function PP(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function YB(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const IP=()=>!0;function GB(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:s,edgeUpdaterType:i,isTarget:a,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:f,flowId:d,panBy:p,cancelConnection:h,onConnectStart:g,onConnect:k,onConnectEnd:w,isValidConnection:y=IP,onReconnectEnd:v,updateConnection:b,getTransform:C,getFromHandle:N,autoPanSpeed:j,dragThreshold:A=1,handleDomNode:I}){const D=xP(e.target);let H=0,V;const{x:F,y:L}=Ks(e),M=PP(i,I),K=l==null?void 0:l.getBoundingClientRect();let W=!1;if(!K||!M)return;const $=AP(s,M,r,c,t);if(!$)return;let R=Ks(e,K),B=!1,_=null,X=!1,z=null;function T(){if(!f||!K)return;const[ue,de]=hP(R,K,j);p({x:ue,y:de}),H=requestAnimationFrame(T)}const Z={...$,nodeId:s,type:M,position:$.position},ae=c.get(s);let se={inProgress:!0,isValid:null,from:La(ae,Z,Be.Left,!0),fromHandle:Z,fromPosition:Z.position,fromNode:ae,to:R,toHandle:null,toPosition:PN[Z.position],toNode:null,pointer:R};function ee(){W=!0,b(se),g==null||g(e,{nodeId:s,handleId:r,handleType:M})}A===0&&ee();function re(ue){if(!W){const{x:nt,y:wt}=Ks(ue),mt=nt-F,Re=wt-L;if(!(mt*mt+Re*Re>A*A))return;ee()}if(!N()||!Z){ne(ue);return}const de=C();R=Ks(ue,K),V=qB(Bd(R,de,!1,[1,1]),n,c,Z),B||(T(),B=!0);const xe=RP(ue,{handle:V,connectionMode:t,fromNodeId:s,fromHandleId:r,fromType:a?"target":"source",isValidConnection:y,doc:D,lib:u,flowId:d,nodeLookup:c});z=xe.handleDomNode,_=xe.connection,X=YB(!!V,xe.isValid);const ze=c.get(s),Te=ze?La(ze,Z,Be.Left,!0):se.from,Le={...se,from:Te,isValid:X,to:xe.toHandle&&X?jh({x:xe.toHandle.x,y:xe.toHandle.y},de):R,toHandle:xe.toHandle,toPosition:X&&xe.toHandle?xe.toHandle.position:PN[Z.position],toNode:xe.toHandle?c.get(xe.toHandle.nodeId):null,pointer:R};b(Le),se=Le}function ne(ue){if(!("touches"in ue&&ue.touches.length>0)){if(W){(V||z)&&_&&X&&(k==null||k(_));const{inProgress:de,...xe}=se,ze={...xe,toPosition:se.toHandle?se.toPosition:null};w==null||w(ue,ze),i&&(v==null||v(ue,ze))}h(),cancelAnimationFrame(H),B=!1,X=!1,_=null,z=null,D.removeEventListener("mousemove",re),D.removeEventListener("mouseup",ne),D.removeEventListener("touchmove",re),D.removeEventListener("touchend",ne)}}D.addEventListener("mousemove",re),D.addEventListener("mouseup",ne),D.addEventListener("touchmove",re),D.addEventListener("touchend",ne)}function RP(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:i,doc:a,lib:l,flowId:c,isValidConnection:u=IP,nodeLookup:f}){const d=i==="target",p=t?a.querySelector(`.${l}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:h,y:g}=Ks(e),k=a.elementFromPoint(h,g),w=k!=null&&k.classList.contains(`${l}-flow__handle`)?k:p,y={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const v=PP(void 0,w),b=w.getAttribute("data-nodeid"),C=w.getAttribute("data-handleid"),N=w.classList.contains("connectable"),j=w.classList.contains("connectableend");if(!b||!v)return y;const A={source:d?b:r,sourceHandle:d?C:s,target:d?r:b,targetHandle:d?s:C};y.connection=A;const D=N&&j&&(n===lc.Strict?d&&v==="source"||!d&&v==="target":b!==r||C!==s);y.isValid=D&&u(A),y.toHandle=AP(b,v,C,f,n,!0)}return y}const ow={onPointerDown:GB,isValid:RP};function JB({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const s=ts(e);function i({translateExtent:l,width:c,height:u,zoomStep:f=1,pannable:d=!0,zoomable:p=!0,inversePan:h=!1}){const g=b=>{if(b.sourceEvent.type!=="wheel"||!t)return;const C=n(),N=b.sourceEvent.ctrlKey&&md()?10:1,j=-b.sourceEvent.deltaY*(b.sourceEvent.deltaMode===1?.05:b.sourceEvent.deltaMode?1:.002)*f,A=C[2]*Math.pow(2,j*N);t.scaleTo(A)};let k=[0,0];const w=b=>{(b.sourceEvent.type==="mousedown"||b.sourceEvent.type==="touchstart")&&(k=[b.sourceEvent.clientX??b.sourceEvent.touches[0].clientX,b.sourceEvent.clientY??b.sourceEvent.touches[0].clientY])},y=b=>{const C=n();if(b.sourceEvent.type!=="mousemove"&&b.sourceEvent.type!=="touchmove"||!t)return;const N=[b.sourceEvent.clientX??b.sourceEvent.touches[0].clientX,b.sourceEvent.clientY??b.sourceEvent.touches[0].clientY],j=[N[0]-k[0],N[1]-k[1]];k=N;const A=r()*Math.max(C[2],Math.log(C[2]))*(h?-1:1),I={x:C[0]-j[0]*A,y:C[1]-j[1]*A},D=[[0,0],[c,u]];t.setViewportConstrained({x:I.x,y:I.y,zoom:C[2]},D,l)},v=oP().on("start",w).on("zoom",d?y:null).on("zoom.wheel",p?g:null);s.call(v,{})}function a(){s.on("zoom",null)}return{update:i,destroy:a,pointer:zs}}const vm=e=>({x:e.x,y:e.y,zoom:e.k}),ay=({x:e,y:t,zoom:n})=>wm.translate(e,t).scale(n),Ll=(e,t)=>e.target.closest(`.${t}`),TP=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),XB=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,ly=(e,t=0,n=XB,r=()=>{})=>{const s=typeof t=="number"&&t>0;return s||r(),s?e.transition().duration(t).ease(n).on("end",r):e},MP=e=>{const t=e.ctrlKey&&md()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function QB({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:i,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return f=>{if(Ll(f,t))return f.ctrlKey&&f.preventDefault(),!1;f.preventDefault(),f.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(f.ctrlKey&&a){const w=zs(f),y=MP(f),v=d*Math.pow(2,y);r.scaleTo(n,v,w,f);return}const p=f.deltaMode===1?20:1;let h=s===ja.Vertical?0:f.deltaX*p,g=s===ja.Horizontal?0:f.deltaY*p;!md()&&f.shiftKey&&s!==ja.Vertical&&(h=f.deltaY*p,g=0),r.translateBy(n,-(h/d)*i,-(g/d)*i,{internal:!0});const k=vm(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(f,k),e.panScrollTimeout=setTimeout(()=>{u==null||u(f,k),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(f,k))}}function ZB({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,s){const i=r.type==="wheel",a=!t&&i&&!r.ctrlKey,l=Ll(r,e);if(r.ctrlKey&&i&&l&&r.preventDefault(),a||l)return null;r.preventDefault(),n.call(this,r,s)}}function e4({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,a,l;if((i=r.sourceEvent)!=null&&i.internal)return;const s=vm(r.transform);e.mouseButton=((a=r.sourceEvent)==null?void 0:a.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=s,((l=r.sourceEvent)==null?void 0:l.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,s))}}function t4({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return i=>{var a,l;e.usedRightMouseButton=!!(n&&TP(t,e.mouseButton??0)),(a=i.sourceEvent)!=null&&a.sync||r([i.transform.x,i.transform.y,i.transform.k]),s&&!((l=i.sourceEvent)!=null&&l.internal)&&(s==null||s(i.sourceEvent,vm(i.transform)))}}function n4({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:s,onPaneContextMenu:i}){return a=>{var l;if(!((l=a.sourceEvent)!=null&&l.internal)&&(e.isZoomingOrPanning=!1,i&&TP(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&i(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),s)){const c=vm(a.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(a.sourceEvent,c)},n?150:0)}}}function r4({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:i,userSelectionActive:a,noWheelClassName:l,noPanClassName:c,lib:u,connectionInProgress:f}){return d=>{var w;const p=e||t,h=n&&d.ctrlKey,g=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(Ll(d,`${u}-flow__node`)||Ll(d,`${u}-flow__edge`)))return!0;if(!r&&!p&&!s&&!i&&!n||a||f&&!g||Ll(d,l)&&g||Ll(d,c)&&(!g||s&&g&&!e)||!n&&d.ctrlKey&&g)return!1;if(!n&&d.type==="touchstart"&&((w=d.touches)==null?void 0:w.length)>1)return d.preventDefault(),!1;if(!p&&!s&&!h&&g||!r&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(r)&&!r.includes(d.button)&&d.type==="mousedown")return!1;const k=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||g)&&k}}function s4({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:s,onPanZoom:i,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=e.getBoundingClientRect(),d=oP().scaleExtent([t,n]).translateExtent(r),p=ts(e).call(d);v({x:s.x,y:s.y,zoom:cc(s.zoom,t,n)},[[0,0],[f.width,f.height]],r);const h=p.on("wheel.zoom"),g=p.on("dblclick.zoom");d.wheelDelta(MP);function k(V,F){return p?new Promise(L=>{d==null||d.interpolate((F==null?void 0:F.interpolate)==="linear"?$u:Mp).transform(ly(p,F==null?void 0:F.duration,F==null?void 0:F.ease,()=>L(!0)),V)}):Promise.resolve(!1)}function w({noWheelClassName:V,noPanClassName:F,onPaneContextMenu:L,userSelectionActive:M,panOnScroll:K,panOnDrag:W,panOnScrollMode:$,panOnScrollSpeed:R,preventScrolling:B,zoomOnPinch:_,zoomOnScroll:X,zoomOnDoubleClick:z,zoomActivationKeyPressed:T,lib:Z,onTransformChange:ae,connectionInProgress:J,paneClickDistance:se,selectionOnDrag:ee}){M&&!u.isZoomingOrPanning&&y();const re=K&&!T&&!M;d.clickDistance(ee?1/0:!Vs(se)||se<0?0:se);const ne=re?QB({zoomPanValues:u,noWheelClassName:V,d3Selection:p,d3Zoom:d,panOnScrollMode:$,panOnScrollSpeed:R,zoomOnPinch:_,onPanZoomStart:a,onPanZoom:i,onPanZoomEnd:l}):ZB({noWheelClassName:V,preventScrolling:B,d3ZoomHandler:h});if(p.on("wheel.zoom",ne,{passive:!1}),!M){const de=e4({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});d.on("start",de);const xe=t4({zoomPanValues:u,panOnDrag:W,onPaneContextMenu:!!L,onPanZoom:i,onTransformChange:ae});d.on("zoom",xe);const ze=n4({zoomPanValues:u,panOnDrag:W,panOnScroll:K,onPaneContextMenu:L,onPanZoomEnd:l,onDraggingChange:c});d.on("end",ze)}const ue=r4({zoomActivationKeyPressed:T,panOnDrag:W,zoomOnScroll:X,panOnScroll:K,zoomOnDoubleClick:z,zoomOnPinch:_,userSelectionActive:M,noPanClassName:F,noWheelClassName:V,lib:Z,connectionInProgress:J});d.filter(ue),z?p.on("dblclick.zoom",g):p.on("dblclick.zoom",null)}function y(){d.on("zoom",null)}async function v(V,F,L){const M=ay(V),K=d==null?void 0:d.constrain()(M,F,L);return K&&await k(K),new Promise(W=>W(K))}async function b(V,F){const L=ay(V);return await k(L,F),new Promise(M=>M(L))}function C(V){if(p){const F=ay(V),L=p.property("__zoom");(L.k!==V.zoom||L.x!==V.x||L.y!==V.y)&&(d==null||d.transform(p,F,null,{sync:!0}))}}function N(){const V=p?iP(p.node()):{x:0,y:0,k:1};return{x:V.x,y:V.y,zoom:V.k}}function j(V,F){return p?new Promise(L=>{d==null||d.interpolate((F==null?void 0:F.interpolate)==="linear"?$u:Mp).scaleTo(ly(p,F==null?void 0:F.duration,F==null?void 0:F.ease,()=>L(!0)),V)}):Promise.resolve(!1)}function A(V,F){return p?new Promise(L=>{d==null||d.interpolate((F==null?void 0:F.interpolate)==="linear"?$u:Mp).scaleBy(ly(p,F==null?void 0:F.duration,F==null?void 0:F.ease,()=>L(!0)),V)}):Promise.resolve(!1)}function I(V){d==null||d.scaleExtent(V)}function D(V){d==null||d.translateExtent(V)}function H(V){const F=!Vs(V)||V<0?0:V;d==null||d.clickDistance(F)}return{update:w,destroy:y,setViewport:b,setViewportConstrained:v,getViewport:N,scaleTo:j,scaleBy:A,setScaleExtent:I,setTranslateExtent:D,syncViewport:C,setClickDistance:H}}var fc;(function(e){e.Line="line",e.Handle="handle"})(fc||(fc={}));function i4({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:s,affectsY:i}){const a=e-t,l=n-r,c=[a>0?1:a<0?-1:0,l>0?1:l<0?-1:0];return a&&s&&(c[0]=c[0]*-1),l&&i&&(c[1]=c[1]*-1),c}function WN(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),s=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:s}}function yo(e,t){return Math.max(0,t-e)}function xo(e,t){return Math.max(0,e-t)}function Qf(e,t,n){return Math.max(0,t-e,e-n)}function VN(e,t){return e?!t:t}function o4(e,t,n,r,s,i,a,l){let{affectsX:c,affectsY:u}=t;const{isHorizontal:f,isVertical:d}=t,p=f&&d,{xSnapped:h,ySnapped:g}=n,{minWidth:k,maxWidth:w,minHeight:y,maxHeight:v}=r,{x:b,y:C,width:N,height:j,aspectRatio:A}=e;let I=Math.floor(f?h-e.pointerX:0),D=Math.floor(d?g-e.pointerY:0);const H=N+(c?-I:I),V=j+(u?-D:D),F=-i[0]*N,L=-i[1]*j;let M=Qf(H,k,w),K=Qf(V,y,v);if(a){let R=0,B=0;c&&I<0?R=yo(b+I+F,a[0][0]):!c&&I>0&&(R=xo(b+H+F,a[1][0])),u&&D<0?B=yo(C+D+L,a[0][1]):!u&&D>0&&(B=xo(C+V+L,a[1][1])),M=Math.max(M,R),K=Math.max(K,B)}if(l){let R=0,B=0;c&&I>0?R=xo(b+I,l[0][0]):!c&&I<0&&(R=yo(b+H,l[1][0])),u&&D>0?B=xo(C+D,l[0][1]):!u&&D<0&&(B=yo(C+V,l[1][1])),M=Math.max(M,R),K=Math.max(K,B)}if(s){if(f){const R=Qf(H/A,y,v)*A;if(M=Math.max(M,R),a){let B=0;!c&&!u||c&&!u&&p?B=xo(C+L+H/A,a[1][1])*A:B=yo(C+L+(c?I:-I)/A,a[0][1])*A,M=Math.max(M,B)}if(l){let B=0;!c&&!u||c&&!u&&p?B=yo(C+H/A,l[1][1])*A:B=xo(C+(c?I:-I)/A,l[0][1])*A,M=Math.max(M,B)}}if(d){const R=Qf(V*A,k,w)/A;if(K=Math.max(K,R),a){let B=0;!c&&!u||u&&!c&&p?B=xo(b+V*A+F,a[1][0])/A:B=yo(b+(u?D:-D)*A+F,a[0][0])/A,K=Math.max(K,B)}if(l){let B=0;!c&&!u||u&&!c&&p?B=yo(b+V*A,l[1][0])/A:B=xo(b+(u?D:-D)*A,l[0][0])/A,K=Math.max(K,B)}}}D=D+(D<0?K:-K),I=I+(I<0?M:-M),s&&(p?H>V*A?D=(VN(c,u)?-I:I)/A:I=(VN(c,u)?-D:D)*A:f?(D=I/A,u=c):(I=D*A,c=u));const W=c?b+I:b,$=u?C+D:C;return{width:N+(c?-I:I),height:j+(u?-D:D),x:i[0]*I*(c?-1:1)+W,y:i[1]*D*(u?-1:1)+$}}const $P={width:0,height:0,x:0,y:0},a4={...$P,pointerX:0,pointerY:0,aspectRatio:1};function l4(e){return[[0,0],[e.measured.width,e.measured.height]]}function c4(e,t,n){const r=t.position.x+e.position.x,s=t.position.y+e.position.y,i=e.measured.width??0,a=e.measured.height??0,l=n[0]*i,c=n[1]*a;return[[r-l,s-c],[r+i-l,s+a-c]]}function u4({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:s}){const i=ts(e);let a={controlDirection:WN("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:u,boundaries:f,keepAspectRatio:d,resizeDirection:p,onResizeStart:h,onResize:g,onResizeEnd:k,shouldResize:w}){let y={...$P},v={...a4};a={boundaries:f,resizeDirection:p,keepAspectRatio:d,controlDirection:WN(u)};let b,C=null,N=[],j,A,I,D=!1;const H=KA().on("start",V=>{const{nodeLookup:F,transform:L,snapGrid:M,snapToGrid:K,nodeOrigin:W,paneDomNode:$}=n();if(b=F.get(t),!b)return;C=($==null?void 0:$.getBoundingClientRect())??null;const{xSnapped:R,ySnapped:B}=Lu(V.sourceEvent,{transform:L,snapGrid:M,snapToGrid:K,containerBounds:C});y={width:b.measured.width??0,height:b.measured.height??0,x:b.position.x??0,y:b.position.y??0},v={...y,pointerX:R,pointerY:B,aspectRatio:y.width/y.height},j=void 0,b.parentId&&(b.extent==="parent"||b.expandParent)&&(j=F.get(b.parentId),A=j&&b.extent==="parent"?l4(j):void 0),N=[],I=void 0;for(const[_,X]of F)if(X.parentId===t&&(N.push({id:_,position:{...X.position},extent:X.extent}),X.extent==="parent"||X.expandParent)){const z=c4(X,b,X.origin??W);I?I=[[Math.min(z[0][0],I[0][0]),Math.min(z[0][1],I[0][1])],[Math.max(z[1][0],I[1][0]),Math.max(z[1][1],I[1][1])]]:I=z}h==null||h(V,{...y})}).on("drag",V=>{const{transform:F,snapGrid:L,snapToGrid:M,nodeOrigin:K}=n(),W=Lu(V.sourceEvent,{transform:F,snapGrid:L,snapToGrid:M,containerBounds:C}),$=[];if(!b)return;const{x:R,y:B,width:_,height:X}=y,z={},T=b.origin??K,{width:Z,height:ae,x:J,y:se}=o4(v,a.controlDirection,W,a.boundaries,a.keepAspectRatio,T,A,I),ee=Z!==_,re=ae!==X,ne=J!==R&&ee,ue=se!==B&&re;if(!ne&&!ue&&!ee&&!re)return;if((ne||ue||T[0]===1||T[1]===1)&&(z.x=ne?J:y.x,z.y=ue?se:y.y,y.x=z.x,y.y=z.y,N.length>0)){const Te=J-R,Le=se-B;for(const nt of N)nt.position={x:nt.position.x-Te+T[0]*(Z-_),y:nt.position.y-Le+T[1]*(ae-X)},$.push(nt)}if((ee||re)&&(z.width=ee&&(!a.resizeDirection||a.resizeDirection==="horizontal")?Z:y.width,z.height=re&&(!a.resizeDirection||a.resizeDirection==="vertical")?ae:y.height,y.width=z.width,y.height=z.height),j&&b.expandParent){const Te=T[0]*(z.width??0);z.x&&z.x<Te&&(y.x=Te,v.x=v.x-(z.x-Te));const Le=T[1]*(z.height??0);z.y&&z.y<Le&&(y.y=Le,v.y=v.y-(z.y-Le))}const de=i4({width:y.width,prevWidth:_,height:y.height,prevHeight:X,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),xe={...y,direction:de};(w==null?void 0:w(V,xe))!==!1&&(D=!0,g==null||g(V,xe),r(z,$))}).on("end",V=>{D&&(k==null||k(V,{...y}),s==null||s({...y}),D=!1)});i.call(H)}function c(){i.on(".drag",null)}return{update:l,destroy:c}}var LP={exports:{}},OP={},DP={exports:{}},FP={};/**
|
|
45
|
-
* @license React
|
|
46
|
-
* use-sync-external-store-shim.production.js
|
|
47
|
-
*
|
|
48
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
49
|
-
*
|
|
50
|
-
* This source code is licensed under the MIT license found in the
|
|
51
|
-
* LICENSE file in the root directory of this source tree.
|
|
52
|
-
*/var pc=m;function d4(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var f4=typeof Object.is=="function"?Object.is:d4,p4=pc.useState,h4=pc.useEffect,m4=pc.useLayoutEffect,g4=pc.useDebugValue;function y4(e,t){var n=t(),r=p4({inst:{value:n,getSnapshot:t}}),s=r[0].inst,i=r[1];return m4(function(){s.value=n,s.getSnapshot=t,cy(s)&&i({inst:s})},[e,n,t]),h4(function(){return cy(s)&&i({inst:s}),e(function(){cy(s)&&i({inst:s})})},[e]),g4(n),n}function cy(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!f4(e,n)}catch{return!0}}function x4(e,t){return t()}var w4=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?x4:y4;FP.useSyncExternalStore=pc.useSyncExternalStore!==void 0?pc.useSyncExternalStore:w4;DP.exports=FP;var zP=DP.exports;/**
|
|
53
|
-
* @license React
|
|
54
|
-
* use-sync-external-store-shim/with-selector.production.js
|
|
55
|
-
*
|
|
56
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
57
|
-
*
|
|
58
|
-
* This source code is licensed under the MIT license found in the
|
|
59
|
-
* LICENSE file in the root directory of this source tree.
|
|
60
|
-
*/var Sm=m,b4=zP;function k4(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var v4=typeof Object.is=="function"?Object.is:k4,S4=b4.useSyncExternalStore,N4=Sm.useRef,j4=Sm.useEffect,C4=Sm.useMemo,_4=Sm.useDebugValue;OP.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var i=N4(null);if(i.current===null){var a={hasValue:!1,value:null};i.current=a}else a=i.current;i=C4(function(){function c(h){if(!u){if(u=!0,f=h,h=r(h),s!==void 0&&a.hasValue){var g=a.value;if(s(g,h))return d=g}return d=h}if(g=d,v4(f,h))return g;var k=r(h);return s!==void 0&&s(g,k)?(f=h,g):(f=h,d=k)}var u=!1,f,d,p=n===void 0?null:n;return[function(){return c(t())},p===null?void 0:function(){return c(p())}]},[t,n,r,s]);var l=S4(e,i[0],i[1]);return j4(function(){a.hasValue=!0,a.value=l},[l]),_4(l),l};LP.exports=OP;var E4=LP.exports;const A4=qo(E4),P4={},KN=e=>{let t;const n=new Set,r=(f,d)=>{const p=typeof f=="function"?f(t):f;if(!Object.is(p,t)){const h=t;t=d??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(g=>g(t,h))}},s=()=>t,c={setState:r,getState:s,getInitialState:()=>u,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(P4?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=t=e(r,s,c);return c},I4=e=>e?KN(e):KN,{useDebugValue:R4}=ot,{useSyncExternalStoreWithSelector:T4}=A4,M4=e=>e;function BP(e,t=M4,n){const r=T4(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return R4(r),r}const UN=(e,t)=>{const n=I4(e),r=(s,i=t)=>BP(n,s,i);return Object.assign(r,n),r},$4=(e,t)=>e?UN(e,t):UN;function bn(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,s]of e)if(!Object.is(s,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const Nm=m.createContext(null),L4=Nm.Provider,HP=vi.error001();function Lt(e,t){const n=m.useContext(Nm);if(n===null)throw new Error(HP);return BP(n,e,t)}function xn(){const e=m.useContext(Nm);if(e===null)throw new Error(HP);return m.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const qN={display:"none"},O4={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},WP="react-flow__node-desc",VP="react-flow__edge-desc",D4="react-flow__aria-live",F4=e=>e.ariaLiveMessage,z4=e=>e.ariaLabelConfig;function B4({rfId:e}){const t=Lt(F4);return o.jsx("div",{id:`${D4}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:O4,children:t})}function H4({rfId:e,disableKeyboardA11y:t}){const n=Lt(z4);return o.jsxs(o.Fragment,{children:[o.jsx("div",{id:`${WP}-${e}`,style:qN,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),o.jsx("div",{id:`${VP}-${e}`,style:qN,children:n["edge.a11yDescription.default"]}),!t&&o.jsx(B4,{rfId:e})]})}const jm=m.forwardRef(({position:e="top-left",children:t,className:n,style:r,...s},i)=>{const a=`${e}`.split("-");return o.jsx("div",{className:Un(["react-flow__panel",n,...a]),style:r,ref:i,...s,children:t})});jm.displayName="Panel";function W4({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:o.jsx(jm,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:o.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const V4=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},Zf=e=>e.id;function K4(e,t){return bn(e.selectedNodes.map(Zf),t.selectedNodes.map(Zf))&&bn(e.selectedEdges.map(Zf),t.selectedEdges.map(Zf))}function U4({onSelectionChange:e}){const t=xn(),{selectedNodes:n,selectedEdges:r}=Lt(V4,K4);return m.useEffect(()=>{const s={nodes:n,edges:r};e==null||e(s),t.getState().onSelectionChangeHandlers.forEach(i=>i(s))},[n,r,e]),null}const q4=e=>!!e.onSelectionChangeHandlers;function Y4({onSelectionChange:e}){const t=Lt(q4);return e||t?o.jsx(U4,{onSelectionChange:e}):null}const aw=typeof window<"u"?m.useLayoutEffect:m.useEffect,KP=[0,0],G4={x:0,y:0,zoom:1},J4=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],YN=[...J4,"rfId"],X4=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),GN={translateExtent:fd,nodeOrigin:KP,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Q4(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:s,setTranslateExtent:i,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:c}=Lt(X4,bn),u=xn();aw(()=>(c(e.defaultNodes,e.defaultEdges),()=>{f.current=GN,l()}),[]);const f=m.useRef(GN);return aw(()=>{for(const d of YN){const p=e[d],h=f.current[d];p!==h&&(typeof e[d]>"u"||(d==="nodes"?t(p):d==="edges"?n(p):d==="minZoom"?r(p):d==="maxZoom"?s(p):d==="translateExtent"?i(p):d==="nodeExtent"?a(p):d==="ariaLabelConfig"?u.setState({ariaLabelConfig:SB(p)}):d==="fitView"?u.setState({fitViewQueued:p}):d==="fitViewOptions"?u.setState({fitViewOptions:p}):u.setState({[d]:p})))}f.current=e},YN.map(d=>e[d])),null}function JN(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Z4(e){var r;const[t,n]=m.useState(e==="system"?null:e);return m.useEffect(()=>{if(e!=="system"){n(e);return}const s=JN(),i=()=>n(s!=null&&s.matches?"dark":"light");return i(),s==null||s.addEventListener("change",i),()=>{s==null||s.removeEventListener("change",i)}},[e]),t!==null?t:(r=JN())!=null&&r.matches?"dark":"light"}const XN=typeof document<"u"?document:null;function gd(e=null,t={target:XN,actInsideInputWithModifier:!0}){const[n,r]=m.useState(!1),s=m.useRef(!1),i=m.useRef(new Set([])),[a,l]=m.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",`
|
|
61
|
-
`).replace(`
|
|
62
|
-
|
|
63
|
-
`,`
|
|
64
|
-
+`).split(`
|
|
65
|
-
`)),f=u.reduce((d,p)=>d.concat(...p),[]);return[u,f]}return[[],[]]},[e]);return m.useEffect(()=>{const c=(t==null?void 0:t.target)??XN,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const f=h=>{var w,y;if(s.current=h.ctrlKey||h.metaKey||h.shiftKey||h.altKey,(!s.current||s.current&&!u)&&wP(h))return!1;const k=ZN(h.code,l);if(i.current.add(h[k]),QN(a,i.current,!1)){const v=((y=(w=h.composedPath)==null?void 0:w.call(h))==null?void 0:y[0])||h.target,b=(v==null?void 0:v.nodeName)==="BUTTON"||(v==null?void 0:v.nodeName)==="A";t.preventDefault!==!1&&(s.current||!b)&&h.preventDefault(),r(!0)}},d=h=>{const g=ZN(h.code,l);QN(a,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(h[g]),h.key==="Meta"&&i.current.clear(),s.current=!1},p=()=>{i.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",f),c==null||c.addEventListener("keyup",d),window.addEventListener("blur",p),window.addEventListener("contextmenu",p),()=>{c==null||c.removeEventListener("keydown",f),c==null||c.removeEventListener("keyup",d),window.removeEventListener("blur",p),window.removeEventListener("contextmenu",p)}}},[e,r]),n}function QN(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function ZN(e,t){return t.includes(e)?"code":"key"}const eH=()=>{const e=xn();return m.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,s,i],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??r,y:t.y??s,zoom:t.zoom??i},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:s,minZoom:i,maxZoom:a,panZoom:l}=e.getState(),c=Gb(t,r,s,i,a,(n==null?void 0:n.padding)??.1);return l?(await l.setViewport(c,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:s,snapToGrid:i,domNode:a}=e.getState();if(!a)return t;const{x:l,y:c}=a.getBoundingClientRect(),u={x:t.x-l,y:t.y-c},f=n.snapGrid??s,d=n.snapToGrid??i;return Bd(u,r,d,f)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:s,y:i}=r.getBoundingClientRect(),a=jh(t,n);return{x:a.x+s,y:a.y+i}}}),[])};function UP(e,t){const n=[],r=new Map,s=[];for(const i of e)if(i.type==="add"){s.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const a=r.get(i.id);a?a.push(i):r.set(i.id,[i])}for(const i of t){const a=r.get(i.id);if(!a){n.push(i);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){n.push({...a[0].item});continue}const l={...i};for(const c of a)tH(c,l);n.push(l)}return s.length&&s.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function tH(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function Ch(e,t){return UP(e,t)}function _h(e,t){return UP(e,t)}function da(e,t){return{id:e,type:"select",selected:t}}function Ol(e,t=new Set,n=!1){const r=[];for(const[s,i]of e){const a=t.has(s);!(i.selected===void 0&&!a)&&i.selected!==a&&(n&&(i.selected=a),r.push(da(i.id,a)))}return r}function ej({items:e=[],lookup:t}){var s;const n=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,a]of e.entries()){const l=t.get(a.id),c=((s=l==null?void 0:l.internals)==null?void 0:s.userNode)??l;c!==void 0&&c!==a&&n.push({id:a.id,item:a,type:"replace"}),c===void 0&&n.push({item:a,type:"add",index:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function tj(e){return{id:e.id,type:"remove"}}const nj=e=>pB(e),nH=e=>dP(e);function qP(e){return m.forwardRef(e)}function rj(e){const[t,n]=m.useState(BigInt(0)),[r]=m.useState(()=>rH(()=>n(s=>s+BigInt(1))));return aw(()=>{const s=r.get();s.length&&(e(s),r.reset())},[t]),r}function rH(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const YP=m.createContext(null);function sH({children:e}){const t=xn(),n=m.useCallback(l=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:f,onNodesChange:d,nodeLookup:p,fitViewQueued:h,onNodesChangeMiddlewareMap:g}=t.getState();let k=c;for(const y of l)k=typeof y=="function"?y(k):y;let w=ej({items:k,lookup:p});for(const y of g.values())w=y(w);f&&u(k),w.length>0?d==null||d(w):h&&window.requestAnimationFrame(()=>{const{fitViewQueued:y,nodes:v,setNodes:b}=t.getState();y&&b(v)})},[]),r=rj(n),s=m.useCallback(l=>{const{edges:c=[],setEdges:u,hasDefaultEdges:f,onEdgesChange:d,edgeLookup:p}=t.getState();let h=c;for(const g of l)h=typeof g=="function"?g(h):g;f?u(h):d&&d(ej({items:h,lookup:p}))},[]),i=rj(s),a=m.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return o.jsx(YP.Provider,{value:a,children:e})}function iH(){const e=m.useContext(YP);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const oH=e=>!!e.panZoom;function wc(){const e=eH(),t=xn(),n=iH(),r=Lt(oH),s=m.useMemo(()=>{const i=d=>t.getState().nodeLookup.get(d),a=d=>{n.nodeQueue.push(d)},l=d=>{n.edgeQueue.push(d)},c=d=>{var y,v;const{nodeLookup:p,nodeOrigin:h}=t.getState(),g=nj(d)?d:p.get(d.id),k=g.parentId?yP(g.position,g.measured,g.parentId,p,h):g.position,w={...g,position:k,width:((y=g.measured)==null?void 0:y.width)??g.width,height:((v=g.measured)==null?void 0:v.height)??g.height};return uc(w)},u=(d,p,h={replace:!1})=>{a(g=>g.map(k=>{if(k.id===d){const w=typeof p=="function"?p(k):p;return h.replace&&nj(w)?w:{...k,...w}}return k}))},f=(d,p,h={replace:!1})=>{l(g=>g.map(k=>{if(k.id===d){const w=typeof p=="function"?p(k):p;return h.replace&&nH(w)?w:{...k,...w}}return k}))};return{getNodes:()=>t.getState().nodes.map(d=>({...d})),getNode:d=>{var p;return(p=i(d))==null?void 0:p.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:d=[]}=t.getState();return d.map(p=>({...p}))},getEdge:d=>t.getState().edgeLookup.get(d),setNodes:a,setEdges:l,addNodes:d=>{const p=Array.isArray(d)?d:[d];n.nodeQueue.push(h=>[...h,...p])},addEdges:d=>{const p=Array.isArray(d)?d:[d];n.edgeQueue.push(h=>[...h,...p])},toObject:()=>{const{nodes:d=[],edges:p=[],transform:h}=t.getState(),[g,k,w]=h;return{nodes:d.map(y=>({...y})),edges:p.map(y=>({...y})),viewport:{x:g,y:k,zoom:w}}},deleteElements:async({nodes:d=[],edges:p=[]})=>{const{nodes:h,edges:g,onNodesDelete:k,onEdgesDelete:w,triggerNodeChanges:y,triggerEdgeChanges:v,onDelete:b,onBeforeDelete:C}=t.getState(),{nodes:N,edges:j}=await xB({nodesToRemove:d,edgesToRemove:p,nodes:h,edges:g,onBeforeDelete:C}),A=j.length>0,I=N.length>0;if(A){const D=j.map(tj);w==null||w(j),v(D)}if(I){const D=N.map(tj);k==null||k(N),y(D)}return(I||A)&&(b==null||b({nodes:N,edges:j})),{deletedNodes:N,deletedEdges:j}},getIntersectingNodes:(d,p=!0,h)=>{const g=RN(d),k=g?d:c(d),w=h!==void 0;return k?(h||t.getState().nodes).filter(y=>{const v=t.getState().nodeLookup.get(y.id);if(v&&!g&&(y.id===d.id||!v.internals.positionAbsolute))return!1;const b=uc(w?y:v),C=hd(b,k);return p&&C>0||C>=b.width*b.height||C>=k.width*k.height}):[]},isNodeIntersecting:(d,p,h=!0)=>{const k=RN(d)?d:c(d);if(!k)return!1;const w=hd(k,p);return h&&w>0||w>=p.width*p.height||w>=k.width*k.height},updateNode:u,updateNodeData:(d,p,h={replace:!1})=>{u(d,g=>{const k=typeof p=="function"?p(g):p;return h.replace?{...g,data:k}:{...g,data:{...g.data,...k}}},h)},updateEdge:f,updateEdgeData:(d,p,h={replace:!1})=>{f(d,g=>{const k=typeof p=="function"?p(g):p;return h.replace?{...g,data:k}:{...g,data:{...g.data,...k}}},h)},getNodesBounds:d=>{const{nodeLookup:p,nodeOrigin:h}=t.getState();return hB(d,{nodeLookup:p,nodeOrigin:h})},getHandleConnections:({type:d,id:p,nodeId:h})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${h}-${d}${p?`-${p}`:""}`))==null?void 0:g.values())??[])},getNodeConnections:({type:d,handleId:p,nodeId:h})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${h}${d?p?`-${d}-${p}`:`-${d}`:""}`))==null?void 0:g.values())??[])},fitView:async d=>{const p=t.getState().fitViewResolver??vB();return t.setState({fitViewQueued:!0,fitViewOptions:d,fitViewResolver:p}),n.nodeQueue.push(h=>[...h]),p.promise}}},[]);return m.useMemo(()=>({...s,...e,viewportInitialized:r}),[r])}const sj=e=>e.selected,aH=typeof window<"u"?window:void 0;function lH({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=xn(),{deleteElements:r}=wc(),s=gd(e,{actInsideInputWithModifier:!1}),i=gd(t,{target:aH});m.useEffect(()=>{if(s){const{edges:a,nodes:l}=n.getState();r({nodes:l.filter(sj),edges:a.filter(sj)}),n.setState({nodesSelectionActive:!1})}},[s]),m.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function cH(e){const t=xn();m.useEffect(()=>{const n=()=>{var s,i,a,l;if(!e.current||!(((i=(s=e.current).checkVisibility)==null?void 0:i.call(s))??!0))return!1;const r=Jb(e.current);(r.height===0||r.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",vi.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const Cm={position:"absolute",width:"100%",height:"100%",top:0,left:0},uH=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function dH({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:i=ja.Free,zoomOnDoubleClick:a=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:u,minZoom:f,maxZoom:d,zoomActivationKeyCode:p,preventScrolling:h=!0,children:g,noWheelClassName:k,noPanClassName:w,onViewportChange:y,isControlledViewport:v,paneClickDistance:b,selectionOnDrag:C}){const N=xn(),j=m.useRef(null),{userSelectionActive:A,lib:I,connectionInProgress:D}=Lt(uH,bn),H=gd(p),V=m.useRef();cH(j);const F=m.useCallback(L=>{y==null||y({x:L[0],y:L[1],zoom:L[2]}),v||N.setState({transform:L})},[y,v]);return m.useEffect(()=>{if(j.current){V.current=s4({domNode:j.current,minZoom:f,maxZoom:d,translateExtent:u,viewport:c,onDraggingChange:W=>N.setState($=>$.paneDragging===W?$:{paneDragging:W}),onPanZoomStart:(W,$)=>{const{onViewportChangeStart:R,onMoveStart:B}=N.getState();B==null||B(W,$),R==null||R($)},onPanZoom:(W,$)=>{const{onViewportChange:R,onMove:B}=N.getState();B==null||B(W,$),R==null||R($)},onPanZoomEnd:(W,$)=>{const{onViewportChangeEnd:R,onMoveEnd:B}=N.getState();B==null||B(W,$),R==null||R($)}});const{x:L,y:M,zoom:K}=V.current.getViewport();return N.setState({panZoom:V.current,transform:[L,M,K],domNode:j.current.closest(".react-flow")}),()=>{var W;(W=V.current)==null||W.destroy()}}},[]),m.useEffect(()=>{var L;(L=V.current)==null||L.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:i,zoomOnDoubleClick:a,panOnDrag:l,zoomActivationKeyPressed:H,preventScrolling:h,noPanClassName:w,userSelectionActive:A,noWheelClassName:k,lib:I,onTransformChange:F,connectionInProgress:D,selectionOnDrag:C,paneClickDistance:b})},[e,t,n,r,s,i,a,l,H,h,w,A,k,I,F,D,C,b]),o.jsx("div",{className:"react-flow__renderer",ref:j,style:Cm,children:g})}const fH=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function pH(){const{userSelectionActive:e,userSelectionRect:t}=Lt(fH,bn);return e&&t?o.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const uy=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},hH=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function mH({isSelecting:e,selectionKeyPressed:t,selectionMode:n=pd.Full,panOnDrag:r,paneClickDistance:s,selectionOnDrag:i,onSelectionStart:a,onSelectionEnd:l,onPaneClick:c,onPaneContextMenu:u,onPaneScroll:f,onPaneMouseEnter:d,onPaneMouseMove:p,onPaneMouseLeave:h,children:g}){const k=xn(),{userSelectionActive:w,elementsSelectable:y,dragging:v,connectionInProgress:b}=Lt(hH,bn),C=y&&(e||w),N=m.useRef(null),j=m.useRef(),A=m.useRef(new Set),I=m.useRef(new Set),D=m.useRef(!1),H=R=>{if(D.current||b){D.current=!1;return}c==null||c(R),k.getState().resetSelectedElements(),k.setState({nodesSelectionActive:!1})},V=R=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){R.preventDefault();return}u==null||u(R)},F=f?R=>f(R):void 0,L=R=>{D.current&&(R.stopPropagation(),D.current=!1)},M=R=>{var ae,J;const{domNode:B}=k.getState();if(j.current=B==null?void 0:B.getBoundingClientRect(),!j.current)return;const _=R.target===N.current;if(!_&&!!R.target.closest(".nokey")||!e||!(i&&_||t)||R.button!==0||!R.isPrimary)return;(J=(ae=R.target)==null?void 0:ae.setPointerCapture)==null||J.call(ae,R.pointerId),D.current=!1;const{x:T,y:Z}=Ks(R.nativeEvent,j.current);k.setState({userSelectionRect:{width:0,height:0,startX:T,startY:Z,x:T,y:Z}}),_||(R.stopPropagation(),R.preventDefault())},K=R=>{const{userSelectionRect:B,transform:_,nodeLookup:X,edgeLookup:z,connectionLookup:T,triggerNodeChanges:Z,triggerEdgeChanges:ae,defaultEdgeOptions:J,resetSelectedElements:se}=k.getState();if(!j.current||!B)return;const{x:ee,y:re}=Ks(R.nativeEvent,j.current),{startX:ne,startY:ue}=B;if(!D.current){const Le=t?0:s;if(Math.hypot(ee-ne,re-ue)<=Le)return;se(),a==null||a(R)}D.current=!0;const de={startX:ne,startY:ue,x:ee<ne?ee:ne,y:re<ue?re:ue,width:Math.abs(ee-ne),height:Math.abs(re-ue)},xe=A.current,ze=I.current;A.current=new Set(Yb(X,de,_,n===pd.Partial,!0).map(Le=>Le.id)),I.current=new Set;const Te=(J==null?void 0:J.selectable)??!0;for(const Le of A.current){const nt=T.get(Le);if(nt)for(const{edgeId:wt}of nt.values()){const mt=z.get(wt);mt&&(mt.selectable??Te)&&I.current.add(wt)}}if(!TN(xe,A.current)){const Le=Ol(X,A.current,!0);Z(Le)}if(!TN(ze,I.current)){const Le=Ol(z,I.current);ae(Le)}k.setState({userSelectionRect:de,userSelectionActive:!0,nodesSelectionActive:!1})},W=R=>{var B,_;R.button===0&&((_=(B=R.target)==null?void 0:B.releasePointerCapture)==null||_.call(B,R.pointerId),!w&&R.target===N.current&&k.getState().userSelectionRect&&(H==null||H(R)),k.setState({userSelectionActive:!1,userSelectionRect:null}),D.current&&(l==null||l(R),k.setState({nodesSelectionActive:A.current.size>0})))},$=r===!0||Array.isArray(r)&&r.includes(0);return o.jsxs("div",{className:Un(["react-flow__pane",{draggable:$,dragging:v,selection:e}]),onClick:C?void 0:uy(H,N),onContextMenu:uy(V,N),onWheel:uy(F,N),onPointerEnter:C?void 0:d,onPointerMove:C?K:p,onPointerUp:C?W:void 0,onPointerDownCapture:C?M:void 0,onClickCapture:C?L:void 0,onPointerLeave:h,ref:N,style:Cm,children:[g,o.jsx(pH,{})]})}function lw({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:a,nodeLookup:l,onError:c}=t.getState(),u=l.get(e);if(!u){c==null||c("012",vi.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&a)&&(i({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var f;return(f=r==null?void 0:r.current)==null?void 0:f.blur()})):s([e])}function GP({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,nodeClickDistance:a}){const l=xn(),[c,u]=m.useState(!1),f=m.useRef();return m.useEffect(()=>{f.current=VB({getStoreItems:()=>l.getState(),onNodeMouseDown:d=>{lw({id:d,store:l,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),m.useEffect(()=>{if(!(t||!e.current||!f.current))return f.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:s,nodeClickDistance:a}),()=>{var d;(d=f.current)==null||d.destroy()}},[n,r,t,i,e,s,a]),c}const gH=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function JP(){const e=xn();return m.useCallback(n=>{const{nodeExtent:r,snapToGrid:s,snapGrid:i,nodesDraggable:a,onError:l,updateNodePositions:c,nodeLookup:u,nodeOrigin:f}=e.getState(),d=new Map,p=gH(a),h=s?i[0]:5,g=s?i[1]:5,k=n.direction.x*h*n.factor,w=n.direction.y*g*n.factor;for(const[,y]of u){if(!p(y))continue;let v={x:y.internals.positionAbsolute.x+k,y:y.internals.positionAbsolute.y+w};s&&(v=zd(v,i));const{position:b,positionAbsolute:C}=fP({nodeId:y.id,nextPosition:v,nodeLookup:u,nodeExtent:r,nodeOrigin:f,onError:l});y.position=b,y.internals.positionAbsolute=C,d.set(y.id,y)}c(d)},[])}const nk=m.createContext(null),yH=nk.Provider;nk.Consumer;const XP=()=>m.useContext(nk),xH=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),wH=(e,t,n)=>r=>{const{connectionClickStartHandle:s,connectionMode:i,connection:a}=r,{fromHandle:l,toHandle:c,isValid:u}=a,f=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===t&&(l==null?void 0:l.type)===n,connectingTo:f,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===n,isPossibleEndHandle:i===lc.Strict?(l==null?void 0:l.type)!==n:e!==(l==null?void 0:l.nodeId)||t!==(l==null?void 0:l.id),connectionInProcess:!!l,clickConnectionInProcess:!!s,valid:f&&u}};function bH({type:e="source",position:t=Be.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:a,onConnect:l,children:c,className:u,onMouseDown:f,onTouchStart:d,...p},h){var K,W;const g=a||null,k=e==="target",w=xn(),y=XP(),{connectOnClick:v,noPanClassName:b,rfId:C}=Lt(xH,bn),{connectingFrom:N,connectingTo:j,clickConnecting:A,isPossibleEndHandle:I,connectionInProcess:D,clickConnectionInProcess:H,valid:V}=Lt(wH(y,g,e),bn);y||(W=(K=w.getState()).onError)==null||W.call(K,"010",vi.error010());const F=$=>{const{defaultEdgeOptions:R,onConnect:B,hasDefaultEdges:_}=w.getState(),X={...R,...$};if(_){const{edges:z,setEdges:T}=w.getState();T(Dp(X,z))}B==null||B(X),l==null||l(X)},L=$=>{if(!y)return;const R=bP($.nativeEvent);if(s&&(R&&$.button===0||!R)){const B=w.getState();ow.onPointerDown($.nativeEvent,{handleDomNode:$.currentTarget,autoPanOnConnect:B.autoPanOnConnect,connectionMode:B.connectionMode,connectionRadius:B.connectionRadius,domNode:B.domNode,nodeLookup:B.nodeLookup,lib:B.lib,isTarget:k,handleId:g,nodeId:y,flowId:B.rfId,panBy:B.panBy,cancelConnection:B.cancelConnection,onConnectStart:B.onConnectStart,onConnectEnd:(..._)=>{var X,z;return(z=(X=w.getState()).onConnectEnd)==null?void 0:z.call(X,..._)},updateConnection:B.updateConnection,onConnect:F,isValidConnection:n||((..._)=>{var X,z;return((z=(X=w.getState()).isValidConnection)==null?void 0:z.call(X,..._))??!0}),getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,autoPanSpeed:B.autoPanSpeed,dragThreshold:B.connectionDragThreshold})}R?f==null||f($):d==null||d($)},M=$=>{const{onClickConnectStart:R,onClickConnectEnd:B,connectionClickStartHandle:_,connectionMode:X,isValidConnection:z,lib:T,rfId:Z,nodeLookup:ae,connection:J}=w.getState();if(!y||!_&&!s)return;if(!_){R==null||R($.nativeEvent,{nodeId:y,handleId:g,handleType:e}),w.setState({connectionClickStartHandle:{nodeId:y,type:e,id:g}});return}const se=xP($.target),ee=n||z,{connection:re,isValid:ne}=ow.isValid($.nativeEvent,{handle:{nodeId:y,id:g,type:e},connectionMode:X,fromNodeId:_.nodeId,fromHandleId:_.id||null,fromType:_.type,isValidConnection:ee,flowId:Z,doc:se,lib:T,nodeLookup:ae});ne&&re&&F(re);const ue=structuredClone(J);delete ue.inProgress,ue.toPosition=ue.toHandle?ue.toHandle.position:null,B==null||B($,ue),w.setState({connectionClickStartHandle:null})};return o.jsx("div",{"data-handleid":g,"data-nodeid":y,"data-handlepos":t,"data-id":`${C}-${y}-${g}-${e}`,className:Un(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",b,u,{source:!k,target:k,connectable:r,connectablestart:s,connectableend:i,clickconnecting:A,connectingfrom:N,connectingto:j,valid:V,connectionindicator:r&&(!D||I)&&(D||H?i:s)}]),onMouseDown:L,onTouchStart:L,onClick:v?M:void 0,ref:h,...p,children:c})}const Kn=m.memo(qP(bH));function kH({data:e,isConnectable:t,sourcePosition:n=Be.Bottom}){return o.jsxs(o.Fragment,{children:[e==null?void 0:e.label,o.jsx(Kn,{type:"source",position:n,isConnectable:t})]})}function vH({data:e,isConnectable:t,targetPosition:n=Be.Top,sourcePosition:r=Be.Bottom}){return o.jsxs(o.Fragment,{children:[o.jsx(Kn,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,o.jsx(Kn,{type:"source",position:r,isConnectable:t})]})}function SH(){return null}function NH({data:e,isConnectable:t,targetPosition:n=Be.Top}){return o.jsxs(o.Fragment,{children:[o.jsx(Kn,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Eh={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},ij={input:kH,default:vH,output:NH,group:SH};function jH(e){var t,n,r,s;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((s=e.style)==null?void 0:s.height)}}const CH=e=>{const{width:t,height:n,x:r,y:s}=Fd(e.nodeLookup,{filter:i=>!!i.selected});return{width:Vs(t)?t:null,height:Vs(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${s}px)`}};function _H({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=xn(),{width:s,height:i,transformString:a,userSelectionActive:l}=Lt(CH,bn),c=JP(),u=m.useRef(null);m.useEffect(()=>{var h;n||(h=u.current)==null||h.focus({preventScroll:!0})},[n]);const f=!l&&s!==null&&i!==null;if(GP({nodeRef:u,disabled:!f}),!f)return null;const d=e?h=>{const g=r.getState().nodes.filter(k=>k.selected);e(h,g)}:void 0,p=h=>{Object.prototype.hasOwnProperty.call(Eh,h.key)&&(h.preventDefault(),c({direction:Eh[h.key],factor:h.shiftKey?4:1}))};return o.jsx("div",{className:Un(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:o.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:p,style:{width:s,height:i}})})}const oj=typeof window<"u"?window:void 0,EH=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function QP({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,paneClickDistance:l,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:f,selectionMode:d,onSelectionStart:p,onSelectionEnd:h,multiSelectionKeyCode:g,panActivationKeyCode:k,zoomActivationKeyCode:w,elementsSelectable:y,zoomOnScroll:v,zoomOnPinch:b,panOnScroll:C,panOnScrollSpeed:N,panOnScrollMode:j,zoomOnDoubleClick:A,panOnDrag:I,defaultViewport:D,translateExtent:H,minZoom:V,maxZoom:F,preventScrolling:L,onSelectionContextMenu:M,noWheelClassName:K,noPanClassName:W,disableKeyboardA11y:$,onViewportChange:R,isControlledViewport:B}){const{nodesSelectionActive:_,userSelectionActive:X}=Lt(EH,bn),z=gd(u,{target:oj}),T=gd(k,{target:oj}),Z=T||I,ae=T||C,J=f&&Z!==!0,se=z||X||J;return lH({deleteKeyCode:c,multiSelectionKeyCode:g}),o.jsx(dH,{onPaneContextMenu:i,elementsSelectable:y,zoomOnScroll:v,zoomOnPinch:b,panOnScroll:ae,panOnScrollSpeed:N,panOnScrollMode:j,zoomOnDoubleClick:A,panOnDrag:!z&&Z,defaultViewport:D,translateExtent:H,minZoom:V,maxZoom:F,zoomActivationKeyCode:w,preventScrolling:L,noWheelClassName:K,noPanClassName:W,onViewportChange:R,isControlledViewport:B,paneClickDistance:l,selectionOnDrag:J,children:o.jsxs(mH,{onSelectionStart:p,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,panOnDrag:Z,isSelecting:!!se,selectionMode:d,selectionKeyPressed:z,paneClickDistance:l,selectionOnDrag:J,children:[e,_&&o.jsx(_H,{onSelectionContextMenu:M,noPanClassName:W,disableKeyboardA11y:$})]})})}QP.displayName="FlowRenderer";const AH=m.memo(QP),PH=e=>t=>e?Yb(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function IH(e){return Lt(m.useCallback(PH(e),[e]),bn)}const RH=e=>e.updateNodeInternals;function TH(){const e=Lt(RH),[t]=m.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(s=>{const i=s.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:s.target,force:!0})}),e(r)}));return m.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function MH({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const s=xn(),i=m.useRef(null),a=m.useRef(null),l=m.useRef(e.sourcePosition),c=m.useRef(e.targetPosition),u=m.useRef(t),f=n&&!!e.internals.handleBounds;return m.useEffect(()=>{i.current&&!e.hidden&&(!f||a.current!==i.current)&&(a.current&&(r==null||r.unobserve(a.current)),r==null||r.observe(i.current),a.current=i.current)},[f,e.hidden]),m.useEffect(()=>()=>{a.current&&(r==null||r.unobserve(a.current),a.current=null)},[]),m.useEffect(()=>{if(i.current){const d=u.current!==t,p=l.current!==e.sourcePosition,h=c.current!==e.targetPosition;(d||p||h)&&(u.current=t,l.current=e.sourcePosition,c.current=e.targetPosition,s.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function $H({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:s,onContextMenu:i,onDoubleClick:a,nodesDraggable:l,elementsSelectable:c,nodesConnectable:u,nodesFocusable:f,resizeObserver:d,noDragClassName:p,noPanClassName:h,disableKeyboardA11y:g,rfId:k,nodeTypes:w,nodeClickDistance:y,onError:v}){const{node:b,internals:C,isParent:N}=Lt(ee=>{const re=ee.nodeLookup.get(e),ne=ee.parentLookup.has(e);return{node:re,internals:re.internals,isParent:ne}},bn);let j=b.type||"default",A=(w==null?void 0:w[j])||ij[j];A===void 0&&(v==null||v("003",vi.error003(j)),j="default",A=(w==null?void 0:w.default)||ij.default);const I=!!(b.draggable||l&&typeof b.draggable>"u"),D=!!(b.selectable||c&&typeof b.selectable>"u"),H=!!(b.connectable||u&&typeof b.connectable>"u"),V=!!(b.focusable||f&&typeof b.focusable>"u"),F=xn(),L=gP(b),M=MH({node:b,nodeType:j,hasDimensions:L,resizeObserver:d}),K=GP({nodeRef:M,disabled:b.hidden||!I,noDragClassName:p,handleSelector:b.dragHandle,nodeId:e,isSelectable:D,nodeClickDistance:y}),W=JP();if(b.hidden)return null;const $=no(b),R=jH(b),B=D||I||t||n||r||s,_=n?ee=>n(ee,{...C.userNode}):void 0,X=r?ee=>r(ee,{...C.userNode}):void 0,z=s?ee=>s(ee,{...C.userNode}):void 0,T=i?ee=>i(ee,{...C.userNode}):void 0,Z=a?ee=>a(ee,{...C.userNode}):void 0,ae=ee=>{const{selectNodesOnDrag:re,nodeDragThreshold:ne}=F.getState();D&&(!re||!I||ne>0)&&lw({id:e,store:F,nodeRef:M}),t&&t(ee,{...C.userNode})},J=ee=>{if(!(wP(ee.nativeEvent)||g)){if(aP.includes(ee.key)&&D){const re=ee.key==="Escape";lw({id:e,store:F,unselect:re,nodeRef:M})}else if(I&&b.selected&&Object.prototype.hasOwnProperty.call(Eh,ee.key)){ee.preventDefault();const{ariaLabelConfig:re}=F.getState();F.setState({ariaLiveMessage:re["node.a11yDescription.ariaLiveMessage"]({direction:ee.key.replace("Arrow","").toLowerCase(),x:~~C.positionAbsolute.x,y:~~C.positionAbsolute.y})}),W({direction:Eh[ee.key],factor:ee.shiftKey?4:1})}}},se=()=>{var ze;if(g||!((ze=M.current)!=null&&ze.matches(":focus-visible")))return;const{transform:ee,width:re,height:ne,autoPanOnNodeFocus:ue,setCenter:de}=F.getState();if(!ue)return;Yb(new Map([[e,b]]),{x:0,y:0,width:re,height:ne},ee,!0).length>0||de(b.position.x+$.width/2,b.position.y+$.height/2,{zoom:ee[2]})};return o.jsx("div",{className:Un(["react-flow__node",`react-flow__node-${j}`,{[h]:I},b.className,{selected:b.selected,selectable:D,parent:N,draggable:I,dragging:K}]),ref:M,style:{zIndex:C.z,transform:`translate(${C.positionAbsolute.x}px,${C.positionAbsolute.y}px)`,pointerEvents:B?"all":"none",visibility:L?"visible":"hidden",...b.style,...R},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:_,onMouseMove:X,onMouseLeave:z,onContextMenu:T,onClick:ae,onDoubleClick:Z,onKeyDown:V?J:void 0,tabIndex:V?0:void 0,onFocus:V?se:void 0,role:b.ariaRole??(V?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${WP}-${k}`,"aria-label":b.ariaLabel,...b.domAttributes,children:o.jsx(yH,{value:e,children:o.jsx(A,{id:e,data:b.data,type:j,positionAbsoluteX:C.positionAbsolute.x,positionAbsoluteY:C.positionAbsolute.y,selected:b.selected??!1,selectable:D,draggable:I,deletable:b.deletable??!0,isConnectable:H,sourcePosition:b.sourcePosition,targetPosition:b.targetPosition,dragging:K,dragHandle:b.dragHandle,zIndex:C.z,parentId:b.parentId,...$})})})}var LH=m.memo($H);const OH=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function ZP(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,onError:i}=Lt(OH,bn),a=IH(e.onlyRenderVisibleElements),l=TH();return o.jsx("div",{className:"react-flow__nodes",style:Cm,children:a.map(c=>o.jsx(LH,{id:c,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:l,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,nodeClickDistance:e.nodeClickDistance,onError:i},c))})}ZP.displayName="NodeRenderer";const DH=m.memo(ZP);function FH(e){return Lt(m.useCallback(n=>{if(!e)return n.edges.map(s=>s.id);const r=[];if(n.width&&n.height)for(const s of n.edges){const i=n.nodeLookup.get(s.source),a=n.nodeLookup.get(s.target);i&&a&&CB({sourceNode:i,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[e]),bn)}const zH=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return o.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},BH=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return o.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},aj={[fi.Arrow]:zH,[fi.ArrowClosed]:BH};function HH(e){const t=xn();return m.useMemo(()=>{var s,i;return Object.prototype.hasOwnProperty.call(aj,e)?aj[e]:((i=(s=t.getState()).onError)==null||i.call(s,"009",vi.error009(e)),null)},[e])}const WH=({id:e,type:t,color:n,width:r=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:a,orient:l="auto-start-reverse"})=>{const c=HH(t);return c?o.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:l,refX:"0",refY:"0",children:o.jsx(c,{color:n,strokeWidth:a})}):null},eI=({defaultColor:e,rfId:t})=>{const n=Lt(i=>i.edges),r=Lt(i=>i.defaultEdgeOptions),s=m.useMemo(()=>TB(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return s.length?o.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:o.jsx("defs",{children:s.map(i=>o.jsx(WH,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};eI.displayName="MarkerDefinitions";var VH=m.memo(eI);function tI({x:e,y:t,label:n,labelStyle:r,labelShowBg:s=!0,labelBgStyle:i,labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:c,className:u,...f}){const[d,p]=m.useState({x:1,y:0,width:0,height:0}),h=Un(["react-flow__edge-textwrapper",u]),g=m.useRef(null);return m.useEffect(()=>{if(g.current){const k=g.current.getBBox();p({x:k.x,y:k.y,width:k.width,height:k.height})}},[n]),n?o.jsxs("g",{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:h,visibility:d.width?"visible":"hidden",...f,children:[s&&o.jsx("rect",{width:d.width+2*a[0],x:-a[0],y:-a[1],height:d.height+2*a[1],className:"react-flow__edge-textbg",style:i,rx:l,ry:l}),o.jsx("text",{className:"react-flow__edge-text",y:d.height/2,dy:"0.3em",ref:g,style:r,children:n}),c]}):null}tI.displayName="EdgeText";const KH=m.memo(tI);function _m({path:e,labelX:t,labelY:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,interactionWidth:u=20,...f}){return o.jsxs(o.Fragment,{children:[o.jsx("path",{...f,d:e,fill:"none",className:Un(["react-flow__edge-path",f.className])}),u?o.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,r&&Vs(t)&&Vs(n)?o.jsx(KH,{x:t,y:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function lj({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===Be.Left||e===Be.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function nI({sourceX:e,sourceY:t,sourcePosition:n=Be.Bottom,targetX:r,targetY:s,targetPosition:i=Be.Top}){const[a,l]=lj({pos:n,x1:e,y1:t,x2:r,y2:s}),[c,u]=lj({pos:i,x1:r,y1:s,x2:e,y2:t}),[f,d,p,h]=kP({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${l} ${c},${u} ${r},${s}`,f,d,p,h]}function rI(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:a,targetPosition:l,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:h,style:g,markerEnd:k,markerStart:w,interactionWidth:y})=>{const[v,b,C]=nI({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:l}),N=e.isInternal?void 0:t;return o.jsx(_m,{id:N,path:v,labelX:b,labelY:C,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:h,style:g,markerEnd:k,markerStart:w,interactionWidth:y})})}const UH=rI({isInternal:!1}),sI=rI({isInternal:!0});UH.displayName="SimpleBezierEdge";sI.displayName="SimpleBezierEdgeInternal";function iI(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:d,style:p,sourcePosition:h=Be.Bottom,targetPosition:g=Be.Top,markerEnd:k,markerStart:w,pathOptions:y,interactionWidth:v})=>{const[b,C,N]=rw({sourceX:n,sourceY:r,sourcePosition:h,targetX:s,targetY:i,targetPosition:g,borderRadius:y==null?void 0:y.borderRadius,offset:y==null?void 0:y.offset,stepPosition:y==null?void 0:y.stepPosition}),j=e.isInternal?void 0:t;return o.jsx(_m,{id:j,path:b,labelX:C,labelY:N,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:d,style:p,markerEnd:k,markerStart:w,interactionWidth:v})})}const oI=iI({isInternal:!1}),aI=iI({isInternal:!0});oI.displayName="SmoothStepEdge";aI.displayName="SmoothStepEdgeInternal";function lI(e){return m.memo(({id:t,...n})=>{var s;const r=e.isInternal?void 0:t;return o.jsx(oI,{...n,id:r,pathOptions:m.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(s=n.pathOptions)==null?void 0:s.offset])})})}const qH=lI({isInternal:!1}),cI=lI({isInternal:!0});qH.displayName="StepEdge";cI.displayName="StepEdgeInternal";function uI(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:d,style:p,markerEnd:h,markerStart:g,interactionWidth:k})=>{const[w,y,v]=NP({sourceX:n,sourceY:r,targetX:s,targetY:i}),b=e.isInternal?void 0:t;return o.jsx(_m,{id:b,path:w,labelX:y,labelY:v,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:d,style:p,markerEnd:h,markerStart:g,interactionWidth:k})})}const YH=uI({isInternal:!1}),dI=uI({isInternal:!0});YH.displayName="StraightEdge";dI.displayName="StraightEdgeInternal";function fI(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:a=Be.Bottom,targetPosition:l=Be.Top,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:h,style:g,markerEnd:k,markerStart:w,pathOptions:y,interactionWidth:v})=>{const[b,C,N]=vP({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:l,curvature:y==null?void 0:y.curvature}),j=e.isInternal?void 0:t;return o.jsx(_m,{id:j,path:b,labelX:C,labelY:N,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:h,style:g,markerEnd:k,markerStart:w,interactionWidth:v})})}const GH=fI({isInternal:!1}),pI=fI({isInternal:!0});GH.displayName="BezierEdge";pI.displayName="BezierEdgeInternal";const cj={default:pI,straight:dI,step:cI,smoothstep:aI,simplebezier:sI},uj={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},JH=(e,t,n)=>n===Be.Left?e-t:n===Be.Right?e+t:e,XH=(e,t,n)=>n===Be.Top?e-t:n===Be.Bottom?e+t:e,dj="react-flow__edgeupdater";function fj({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:i,onMouseOut:a,type:l}){return o.jsx("circle",{onMouseDown:s,onMouseEnter:i,onMouseOut:a,className:Un([dj,`${dj}-${l}`]),cx:JH(t,r,e),cy:XH(n,r,e),r,stroke:"transparent",fill:"transparent"})}function QH({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:s,targetX:i,targetY:a,sourcePosition:l,targetPosition:c,onReconnect:u,onReconnectStart:f,onReconnectEnd:d,setReconnecting:p,setUpdateHover:h}){const g=xn(),k=(C,N)=>{if(C.button!==0)return;const{autoPanOnConnect:j,domNode:A,connectionMode:I,connectionRadius:D,lib:H,onConnectStart:V,cancelConnection:F,nodeLookup:L,rfId:M,panBy:K,updateConnection:W}=g.getState(),$=N.type==="target",R=(X,z)=>{p(!1),d==null||d(X,n,N.type,z)},B=X=>u==null?void 0:u(n,X),_=(X,z)=>{p(!0),f==null||f(C,n,N.type),V==null||V(X,z)};ow.onPointerDown(C.nativeEvent,{autoPanOnConnect:j,connectionMode:I,connectionRadius:D,domNode:A,handleId:N.id,nodeId:N.nodeId,nodeLookup:L,isTarget:$,edgeUpdaterType:N.type,lib:H,flowId:M,cancelConnection:F,panBy:K,isValidConnection:(...X)=>{var z,T;return((T=(z=g.getState()).isValidConnection)==null?void 0:T.call(z,...X))??!0},onConnect:B,onConnectStart:_,onConnectEnd:(...X)=>{var z,T;return(T=(z=g.getState()).onConnectEnd)==null?void 0:T.call(z,...X)},onReconnectEnd:R,updateConnection:W,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:C.currentTarget})},w=C=>k(C,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),y=C=>k(C,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),v=()=>h(!0),b=()=>h(!1);return o.jsxs(o.Fragment,{children:[(e===!0||e==="source")&&o.jsx(fj,{position:l,centerX:r,centerY:s,radius:t,onMouseDown:w,onMouseEnter:v,onMouseOut:b,type:"source"}),(e===!0||e==="target")&&o.jsx(fj,{position:c,centerX:i,centerY:a,radius:t,onMouseDown:y,onMouseEnter:v,onMouseOut:b,type:"target"})]})}function ZH({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:s,onDoubleClick:i,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,reconnectRadius:f,onReconnect:d,onReconnectStart:p,onReconnectEnd:h,rfId:g,edgeTypes:k,noPanClassName:w,onError:y,disableKeyboardA11y:v}){let b=Lt(de=>de.edgeLookup.get(e));const C=Lt(de=>de.defaultEdgeOptions);b=C?{...C,...b}:b;let N=b.type||"default",j=(k==null?void 0:k[N])||cj[N];j===void 0&&(y==null||y("011",vi.error011(N)),N="default",j=(k==null?void 0:k.default)||cj.default);const A=!!(b.focusable||t&&typeof b.focusable>"u"),I=typeof d<"u"&&(b.reconnectable||n&&typeof b.reconnectable>"u"),D=!!(b.selectable||r&&typeof b.selectable>"u"),H=m.useRef(null),[V,F]=m.useState(!1),[L,M]=m.useState(!1),K=xn(),{zIndex:W,sourceX:$,sourceY:R,targetX:B,targetY:_,sourcePosition:X,targetPosition:z}=Lt(m.useCallback(de=>{const xe=de.nodeLookup.get(b.source),ze=de.nodeLookup.get(b.target);if(!xe||!ze)return{zIndex:b.zIndex,...uj};const Te=RB({id:e,sourceNode:xe,targetNode:ze,sourceHandle:b.sourceHandle||null,targetHandle:b.targetHandle||null,connectionMode:de.connectionMode,onError:y});return{zIndex:jB({selected:b.selected,zIndex:b.zIndex,sourceNode:xe,targetNode:ze,elevateOnSelect:de.elevateEdgesOnSelect,zIndexMode:de.zIndexMode}),...Te||uj}},[b.source,b.target,b.sourceHandle,b.targetHandle,b.selected,b.zIndex]),bn),T=m.useMemo(()=>b.markerStart?`url('#${sw(b.markerStart,g)}')`:void 0,[b.markerStart,g]),Z=m.useMemo(()=>b.markerEnd?`url('#${sw(b.markerEnd,g)}')`:void 0,[b.markerEnd,g]);if(b.hidden||$===null||R===null||B===null||_===null)return null;const ae=de=>{var Le;const{addSelectedEdges:xe,unselectNodesAndEdges:ze,multiSelectionActive:Te}=K.getState();D&&(K.setState({nodesSelectionActive:!1}),b.selected&&Te?(ze({nodes:[],edges:[b]}),(Le=H.current)==null||Le.blur()):xe([e])),s&&s(de,b)},J=i?de=>{i(de,{...b})}:void 0,se=a?de=>{a(de,{...b})}:void 0,ee=l?de=>{l(de,{...b})}:void 0,re=c?de=>{c(de,{...b})}:void 0,ne=u?de=>{u(de,{...b})}:void 0,ue=de=>{var xe;if(!v&&aP.includes(de.key)&&D){const{unselectNodesAndEdges:ze,addSelectedEdges:Te}=K.getState();de.key==="Escape"?((xe=H.current)==null||xe.blur(),ze({edges:[b]})):Te([e])}};return o.jsx("svg",{style:{zIndex:W},children:o.jsxs("g",{className:Un(["react-flow__edge",`react-flow__edge-${N}`,b.className,w,{selected:b.selected,animated:b.animated,inactive:!D&&!s,updating:V,selectable:D}]),onClick:ae,onDoubleClick:J,onContextMenu:se,onMouseEnter:ee,onMouseMove:re,onMouseLeave:ne,onKeyDown:A?ue:void 0,tabIndex:A?0:void 0,role:b.ariaRole??(A?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":b.ariaLabel===null?void 0:b.ariaLabel||`Edge from ${b.source} to ${b.target}`,"aria-describedby":A?`${VP}-${g}`:void 0,ref:H,...b.domAttributes,children:[!L&&o.jsx(j,{id:e,source:b.source,target:b.target,type:b.type,selected:b.selected,animated:b.animated,selectable:D,deletable:b.deletable??!0,label:b.label,labelStyle:b.labelStyle,labelShowBg:b.labelShowBg,labelBgStyle:b.labelBgStyle,labelBgPadding:b.labelBgPadding,labelBgBorderRadius:b.labelBgBorderRadius,sourceX:$,sourceY:R,targetX:B,targetY:_,sourcePosition:X,targetPosition:z,data:b.data,style:b.style,sourceHandleId:b.sourceHandle,targetHandleId:b.targetHandle,markerStart:T,markerEnd:Z,pathOptions:"pathOptions"in b?b.pathOptions:void 0,interactionWidth:b.interactionWidth}),I&&o.jsx(QH,{edge:b,isReconnectable:I,reconnectRadius:f,onReconnect:d,onReconnectStart:p,onReconnectEnd:h,sourceX:$,sourceY:R,targetX:B,targetY:_,sourcePosition:X,targetPosition:z,setUpdateHover:F,setReconnecting:M})]})})}var e5=m.memo(ZH);const t5=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function hI({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:s,onReconnect:i,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:f,reconnectRadius:d,onEdgeDoubleClick:p,onReconnectStart:h,onReconnectEnd:g,disableKeyboardA11y:k}){const{edgesFocusable:w,edgesReconnectable:y,elementsSelectable:v,onError:b}=Lt(t5,bn),C=FH(t);return o.jsxs("div",{className:"react-flow__edges",children:[o.jsx(VH,{defaultColor:e,rfId:n}),C.map(N=>o.jsx(e5,{id:N,edgesFocusable:w,edgesReconnectable:y,elementsSelectable:v,noPanClassName:s,onReconnect:i,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,onClick:f,reconnectRadius:d,onDoubleClick:p,onReconnectStart:h,onReconnectEnd:g,rfId:n,onError:b,edgeTypes:r,disableKeyboardA11y:k},N))]})}hI.displayName="EdgeRenderer";const n5=m.memo(hI),r5=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function s5({children:e}){const t=Lt(r5);return o.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function i5(e){const t=wc(),n=m.useRef(!1);m.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const o5=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function a5(e){const t=Lt(o5),n=xn();return m.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function l5(e){return e.connection.inProgress?{...e.connection,to:Bd(e.connection.to,e.transform)}:{...e.connection}}function c5(e){return l5}function u5(e){const t=c5();return Lt(t,bn)}const d5=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function f5({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:s,width:i,height:a,isValid:l,inProgress:c}=Lt(d5,bn);return!(i&&s&&c)?null:o.jsx("svg",{style:e,width:i,height:a,className:"react-flow__connectionline react-flow__container",children:o.jsx("g",{className:Un(["react-flow__connection",uP(l)]),children:o.jsx(mI,{style:t,type:n,CustomComponent:r,isValid:l})})})}const mI=({style:e,type:t=jo.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:s,from:i,fromNode:a,fromHandle:l,fromPosition:c,to:u,toNode:f,toHandle:d,toPosition:p,pointer:h}=u5();if(!s)return;if(n)return o.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:a,fromHandle:l,fromX:i.x,fromY:i.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:p,connectionStatus:uP(r),toNode:f,toHandle:d,pointer:h});let g="";const k={sourceX:i.x,sourceY:i.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:p};switch(t){case jo.Bezier:[g]=vP(k);break;case jo.SimpleBezier:[g]=nI(k);break;case jo.Step:[g]=rw({...k,borderRadius:0});break;case jo.SmoothStep:[g]=rw(k);break;default:[g]=NP(k)}return o.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};mI.displayName="ConnectionLine";const p5={};function pj(e=p5){m.useRef(e),xn(),m.useEffect(()=>{},[e])}function h5(){xn(),m.useRef(!1),m.useEffect(()=>{},[])}function gI({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:i,onEdgeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:f,onSelectionContextMenu:d,onSelectionStart:p,onSelectionEnd:h,connectionLineType:g,connectionLineStyle:k,connectionLineComponent:w,connectionLineContainerStyle:y,selectionKeyCode:v,selectionOnDrag:b,selectionMode:C,multiSelectionKeyCode:N,panActivationKeyCode:j,zoomActivationKeyCode:A,deleteKeyCode:I,onlyRenderVisibleElements:D,elementsSelectable:H,defaultViewport:V,translateExtent:F,minZoom:L,maxZoom:M,preventScrolling:K,defaultMarkerColor:W,zoomOnScroll:$,zoomOnPinch:R,panOnScroll:B,panOnScrollSpeed:_,panOnScrollMode:X,zoomOnDoubleClick:z,panOnDrag:T,onPaneClick:Z,onPaneMouseEnter:ae,onPaneMouseMove:J,onPaneMouseLeave:se,onPaneScroll:ee,onPaneContextMenu:re,paneClickDistance:ne,nodeClickDistance:ue,onEdgeContextMenu:de,onEdgeMouseEnter:xe,onEdgeMouseMove:ze,onEdgeMouseLeave:Te,reconnectRadius:Le,onReconnect:nt,onReconnectStart:wt,onReconnectEnd:mt,noDragClassName:Re,noWheelClassName:it,noPanClassName:Nt,disableKeyboardA11y:qt,nodeExtent:Zt,rfId:rt,viewport:fe,onViewportChange:ve}){return pj(e),pj(t),h5(),i5(n),a5(fe),o.jsx(AH,{onPaneClick:Z,onPaneMouseEnter:ae,onPaneMouseMove:J,onPaneMouseLeave:se,onPaneContextMenu:re,onPaneScroll:ee,paneClickDistance:ne,deleteKeyCode:I,selectionKeyCode:v,selectionOnDrag:b,selectionMode:C,onSelectionStart:p,onSelectionEnd:h,multiSelectionKeyCode:N,panActivationKeyCode:j,zoomActivationKeyCode:A,elementsSelectable:H,zoomOnScroll:$,zoomOnPinch:R,zoomOnDoubleClick:z,panOnScroll:B,panOnScrollSpeed:_,panOnScrollMode:X,panOnDrag:T,defaultViewport:V,translateExtent:F,minZoom:L,maxZoom:M,onSelectionContextMenu:d,preventScrolling:K,noDragClassName:Re,noWheelClassName:it,noPanClassName:Nt,disableKeyboardA11y:qt,onViewportChange:ve,isControlledViewport:!!fe,children:o.jsxs(s5,{children:[o.jsx(n5,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:a,onReconnect:nt,onReconnectStart:wt,onReconnectEnd:mt,onlyRenderVisibleElements:D,onEdgeContextMenu:de,onEdgeMouseEnter:xe,onEdgeMouseMove:ze,onEdgeMouseLeave:Te,reconnectRadius:Le,defaultMarkerColor:W,noPanClassName:Nt,disableKeyboardA11y:qt,rfId:rt}),o.jsx(f5,{style:k,type:g,component:w,containerStyle:y}),o.jsx("div",{className:"react-flow__edgelabel-renderer"}),o.jsx(DH,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:f,nodeClickDistance:ue,onlyRenderVisibleElements:D,noPanClassName:Nt,noDragClassName:Re,disableKeyboardA11y:qt,nodeExtent:Zt,rfId:rt}),o.jsx("div",{className:"react-flow__viewport-portal"})]})})}gI.displayName="GraphView";const m5=m.memo(gI),hj=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:l,minZoom:c=.5,maxZoom:u=2,nodeOrigin:f,nodeExtent:d,zIndexMode:p="basic"}={})=>{const h=new Map,g=new Map,k=new Map,w=new Map,y=r??t??[],v=n??e??[],b=f??[0,0],C=d??fd;_P(k,w,y);const{nodesInitialized:N}=iw(v,h,g,{nodeOrigin:b,nodeExtent:C,zIndexMode:p});let j=[0,0,1];if(a&&s&&i){const A=Fd(h,{filter:V=>!!((V.width||V.initialWidth)&&(V.height||V.initialHeight))}),{x:I,y:D,zoom:H}=Gb(A,s,i,c,u,(l==null?void 0:l.padding)??.1);j=[I,D,H]}return{rfId:"1",width:s??0,height:i??0,transform:j,nodes:v,nodesInitialized:N,nodeLookup:h,parentLookup:g,edges:y,edgeLookup:w,connectionLookup:k,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:fd,nodeExtent:C,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:lc.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:b,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:a??!1,fitViewOptions:l,fitViewResolver:null,connection:{...cP},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:wB,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:lP,zIndexMode:p,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},g5=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:f,nodeExtent:d,zIndexMode:p})=>$4((h,g)=>{async function k(){const{nodeLookup:w,panZoom:y,fitViewOptions:v,fitViewResolver:b,width:C,height:N,minZoom:j,maxZoom:A}=g();y&&(await yB({nodes:w,width:C,height:N,panZoom:y,minZoom:j,maxZoom:A},v),b==null||b.resolve(!0),h({fitViewResolver:null}))}return{...hj({nodes:e,edges:t,width:s,height:i,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:f,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:p}),setNodes:w=>{const{nodeLookup:y,parentLookup:v,nodeOrigin:b,elevateNodesOnSelect:C,fitViewQueued:N,zIndexMode:j,nodesSelectionActive:A}=g(),{nodesInitialized:I,hasSelectedNodes:D}=iw(w,y,v,{nodeOrigin:b,nodeExtent:d,elevateNodesOnSelect:C,checkEquality:!0,zIndexMode:j}),H=A&&D;N&&I?(k(),h({nodes:w,nodesInitialized:I,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:H})):h({nodes:w,nodesInitialized:I,nodesSelectionActive:H})},setEdges:w=>{const{connectionLookup:y,edgeLookup:v}=g();_P(y,v,w),h({edges:w})},setDefaultNodesAndEdges:(w,y)=>{if(w){const{setNodes:v}=g();v(w),h({hasDefaultNodes:!0})}if(y){const{setEdges:v}=g();v(y),h({hasDefaultEdges:!0})}},updateNodeInternals:w=>{const{triggerNodeChanges:y,nodeLookup:v,parentLookup:b,domNode:C,nodeOrigin:N,nodeExtent:j,debug:A,fitViewQueued:I,zIndexMode:D}=g(),{changes:H,updatedInternals:V}=zB(w,v,b,C,N,j,D);V&&(LB(v,b,{nodeOrigin:N,nodeExtent:j,zIndexMode:D}),I?(k(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),(H==null?void 0:H.length)>0&&(A&&console.log("React Flow: trigger node changes",H),y==null||y(H)))},updateNodePositions:(w,y=!1)=>{const v=[];let b=[];const{nodeLookup:C,triggerNodeChanges:N,connection:j,updateConnection:A,onNodesChangeMiddlewareMap:I}=g();for(const[D,H]of w){const V=C.get(D),F=!!(V!=null&&V.expandParent&&(V!=null&&V.parentId)&&(H!=null&&H.position)),L={id:D,type:"position",position:F?{x:Math.max(0,H.position.x),y:Math.max(0,H.position.y)}:H.position,dragging:y};if(V&&j.inProgress&&j.fromNode.id===V.id){const M=La(V,j.fromHandle,Be.Left,!0);A({...j,from:M})}F&&V.parentId&&v.push({id:D,parentId:V.parentId,rect:{...H.internals.positionAbsolute,width:H.measured.width??0,height:H.measured.height??0}}),b.push(L)}if(v.length>0){const{parentLookup:D,nodeOrigin:H}=g(),V=tk(v,C,D,H);b.push(...V)}for(const D of I.values())b=D(b);N(b)},triggerNodeChanges:w=>{const{onNodesChange:y,setNodes:v,nodes:b,hasDefaultNodes:C,debug:N}=g();if(w!=null&&w.length){if(C){const j=Ch(w,b);v(j)}N&&console.log("React Flow: trigger node changes",w),y==null||y(w)}},triggerEdgeChanges:w=>{const{onEdgesChange:y,setEdges:v,edges:b,hasDefaultEdges:C,debug:N}=g();if(w!=null&&w.length){if(C){const j=_h(w,b);v(j)}N&&console.log("React Flow: trigger edge changes",w),y==null||y(w)}},addSelectedNodes:w=>{const{multiSelectionActive:y,edgeLookup:v,nodeLookup:b,triggerNodeChanges:C,triggerEdgeChanges:N}=g();if(y){const j=w.map(A=>da(A,!0));C(j);return}C(Ol(b,new Set([...w]),!0)),N(Ol(v))},addSelectedEdges:w=>{const{multiSelectionActive:y,edgeLookup:v,nodeLookup:b,triggerNodeChanges:C,triggerEdgeChanges:N}=g();if(y){const j=w.map(A=>da(A,!0));N(j);return}N(Ol(v,new Set([...w]))),C(Ol(b,new Set,!0))},unselectNodesAndEdges:({nodes:w,edges:y}={})=>{const{edges:v,nodes:b,nodeLookup:C,triggerNodeChanges:N,triggerEdgeChanges:j}=g(),A=w||b,I=y||v,D=[];for(const V of A){if(!V.selected)continue;const F=C.get(V.id);F&&(F.selected=!1),D.push(da(V.id,!1))}const H=[];for(const V of I)V.selected&&H.push(da(V.id,!1));N(D),j(H)},setMinZoom:w=>{const{panZoom:y,maxZoom:v}=g();y==null||y.setScaleExtent([w,v]),h({minZoom:w})},setMaxZoom:w=>{const{panZoom:y,minZoom:v}=g();y==null||y.setScaleExtent([v,w]),h({maxZoom:w})},setTranslateExtent:w=>{var y;(y=g().panZoom)==null||y.setTranslateExtent(w),h({translateExtent:w})},resetSelectedElements:()=>{const{edges:w,nodes:y,triggerNodeChanges:v,triggerEdgeChanges:b,elementsSelectable:C}=g();if(!C)return;const N=y.reduce((A,I)=>I.selected?[...A,da(I.id,!1)]:A,[]),j=w.reduce((A,I)=>I.selected?[...A,da(I.id,!1)]:A,[]);v(N),b(j)},setNodeExtent:w=>{const{nodes:y,nodeLookup:v,parentLookup:b,nodeOrigin:C,elevateNodesOnSelect:N,nodeExtent:j,zIndexMode:A}=g();w[0][0]===j[0][0]&&w[0][1]===j[0][1]&&w[1][0]===j[1][0]&&w[1][1]===j[1][1]||(iw(y,v,b,{nodeOrigin:C,nodeExtent:w,elevateNodesOnSelect:N,checkEquality:!1,zIndexMode:A}),h({nodeExtent:w}))},panBy:w=>{const{transform:y,width:v,height:b,panZoom:C,translateExtent:N}=g();return BB({delta:w,panZoom:C,transform:y,translateExtent:N,width:v,height:b})},setCenter:async(w,y,v)=>{const{width:b,height:C,maxZoom:N,panZoom:j}=g();if(!j)return Promise.resolve(!1);const A=typeof(v==null?void 0:v.zoom)<"u"?v.zoom:N;return await j.setViewport({x:b/2-w*A,y:C/2-y*A,zoom:A},{duration:v==null?void 0:v.duration,ease:v==null?void 0:v.ease,interpolate:v==null?void 0:v.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{h({connection:{...cP}})},updateConnection:w=>{h({connection:w})},reset:()=>h({...hj()})}},Object.is);function rk({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:i,initialMinZoom:a,initialMaxZoom:l,initialFitViewOptions:c,fitView:u,nodeOrigin:f,nodeExtent:d,zIndexMode:p,children:h}){const[g]=m.useState(()=>g5({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:u,minZoom:a,maxZoom:l,fitViewOptions:c,nodeOrigin:f,nodeExtent:d,zIndexMode:p}));return o.jsx(L4,{value:g,children:o.jsx(sH,{children:h})})}function y5({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:s,width:i,height:a,fitView:l,fitViewOptions:c,minZoom:u,maxZoom:f,nodeOrigin:d,nodeExtent:p,zIndexMode:h}){return m.useContext(Nm)?o.jsx(o.Fragment,{children:e}):o.jsx(rk,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:s,initialWidth:i,initialHeight:a,fitView:l,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:f,nodeOrigin:d,nodeExtent:p,zIndexMode:h,children:e})}const x5={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function w5({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i,edgeTypes:a,onNodeClick:l,onEdgeClick:c,onInit:u,onMove:f,onMoveStart:d,onMoveEnd:p,onConnect:h,onConnectStart:g,onConnectEnd:k,onClickConnectStart:w,onClickConnectEnd:y,onNodeMouseEnter:v,onNodeMouseMove:b,onNodeMouseLeave:C,onNodeContextMenu:N,onNodeDoubleClick:j,onNodeDragStart:A,onNodeDrag:I,onNodeDragStop:D,onNodesDelete:H,onEdgesDelete:V,onDelete:F,onSelectionChange:L,onSelectionDragStart:M,onSelectionDrag:K,onSelectionDragStop:W,onSelectionContextMenu:$,onSelectionStart:R,onSelectionEnd:B,onBeforeDelete:_,connectionMode:X,connectionLineType:z=jo.Bezier,connectionLineStyle:T,connectionLineComponent:Z,connectionLineContainerStyle:ae,deleteKeyCode:J="Backspace",selectionKeyCode:se="Shift",selectionOnDrag:ee=!1,selectionMode:re=pd.Full,panActivationKeyCode:ne="Space",multiSelectionKeyCode:ue=md()?"Meta":"Control",zoomActivationKeyCode:de=md()?"Meta":"Control",snapToGrid:xe,snapGrid:ze,onlyRenderVisibleElements:Te=!1,selectNodesOnDrag:Le,nodesDraggable:nt,autoPanOnNodeFocus:wt,nodesConnectable:mt,nodesFocusable:Re,nodeOrigin:it=KP,edgesFocusable:Nt,edgesReconnectable:qt,elementsSelectable:Zt=!0,defaultViewport:rt=G4,minZoom:fe=.5,maxZoom:ve=2,translateExtent:He=fd,preventScrolling:Ge=!0,nodeExtent:je,defaultMarkerColor:Tt="#b1b1b7",zoomOnScroll:kn=!0,zoomOnPinch:dn=!0,panOnScroll:en=!1,panOnScrollSpeed:Pn=.5,panOnScrollMode:te=ja.Free,zoomOnDoubleClick:Ee=!0,panOnDrag:We=!0,onPaneClick:Ke,onPaneMouseEnter:bt,onPaneMouseMove:jt,onPaneMouseLeave:qn,onPaneScroll:Ht,onPaneContextMenu:gt,paneClickDistance:Mn=1,nodeClickDistance:Pt=0,children:fn,onReconnect:Yn,onReconnectStart:ei,onReconnectEnd:qr,onEdgeContextMenu:Yr,onEdgeDoubleClick:pr,onEdgeMouseEnter:on,onEdgeMouseMove:zn,onEdgeMouseLeave:Rr,reconnectRadius:In=10,onNodesChange:Qn,onEdgesChange:vr,noDragClassName:Ns="nodrag",noWheelClassName:Sr="nowheel",noPanClassName:Ft="nopan",fitView:ce,fitViewOptions:ke,connectOnClick:tt,attributionPosition:yt,proOptions:vn,defaultEdgeOptions:Jt,elevateNodesOnSelect:Bn=!0,elevateEdgesOnSelect:us=!1,disableKeyboardA11y:ut=!1,autoPanOnConnect:Wt,autoPanOnNodeDrag:Vt,autoPanSpeed:$n,connectionRadius:Fe,isValidConnection:ir,onError:Tr,style:ti,id:js,nodeDragThreshold:Mr,connectionDragThreshold:ie,viewport:be,onViewportChange:Pe,width:Se,height:xt,colorMode:Kt="light",debug:or,onScroll:rn,ariaLabelConfig:hr,zIndexMode:U="basic",...ge},Me){const oe=js||"1",Je=Z4(Kt),dt=m.useCallback(_t=>{_t.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),rn==null||rn(_t)},[rn]);return o.jsx("div",{"data-testid":"rf__wrapper",...ge,onScroll:dt,style:{...ti,...x5},ref:Me,className:Un(["react-flow",s,Je]),id:js,role:"application",children:o.jsxs(y5,{nodes:e,edges:t,width:Se,height:xt,fitView:ce,fitViewOptions:ke,minZoom:fe,maxZoom:ve,nodeOrigin:it,nodeExtent:je,zIndexMode:U,children:[o.jsx(Q4,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:g,onConnectEnd:k,onClickConnectStart:w,onClickConnectEnd:y,nodesDraggable:nt,autoPanOnNodeFocus:wt,nodesConnectable:mt,nodesFocusable:Re,edgesFocusable:Nt,edgesReconnectable:qt,elementsSelectable:Zt,elevateNodesOnSelect:Bn,elevateEdgesOnSelect:us,minZoom:fe,maxZoom:ve,nodeExtent:je,onNodesChange:Qn,onEdgesChange:vr,snapToGrid:xe,snapGrid:ze,connectionMode:X,translateExtent:He,connectOnClick:tt,defaultEdgeOptions:Jt,fitView:ce,fitViewOptions:ke,onNodesDelete:H,onEdgesDelete:V,onDelete:F,onNodeDragStart:A,onNodeDrag:I,onNodeDragStop:D,onSelectionDrag:K,onSelectionDragStart:M,onSelectionDragStop:W,onMove:f,onMoveStart:d,onMoveEnd:p,noPanClassName:Ft,nodeOrigin:it,rfId:oe,autoPanOnConnect:Wt,autoPanOnNodeDrag:Vt,autoPanSpeed:$n,onError:Tr,connectionRadius:Fe,isValidConnection:ir,selectNodesOnDrag:Le,nodeDragThreshold:Mr,connectionDragThreshold:ie,onBeforeDelete:_,debug:or,ariaLabelConfig:hr,zIndexMode:U}),o.jsx(m5,{onInit:u,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:b,onNodeMouseLeave:C,onNodeContextMenu:N,onNodeDoubleClick:j,nodeTypes:i,edgeTypes:a,connectionLineType:z,connectionLineStyle:T,connectionLineComponent:Z,connectionLineContainerStyle:ae,selectionKeyCode:se,selectionOnDrag:ee,selectionMode:re,deleteKeyCode:J,multiSelectionKeyCode:ue,panActivationKeyCode:ne,zoomActivationKeyCode:de,onlyRenderVisibleElements:Te,defaultViewport:rt,translateExtent:He,minZoom:fe,maxZoom:ve,preventScrolling:Ge,zoomOnScroll:kn,zoomOnPinch:dn,zoomOnDoubleClick:Ee,panOnScroll:en,panOnScrollSpeed:Pn,panOnScrollMode:te,panOnDrag:We,onPaneClick:Ke,onPaneMouseEnter:bt,onPaneMouseMove:jt,onPaneMouseLeave:qn,onPaneScroll:Ht,onPaneContextMenu:gt,paneClickDistance:Mn,nodeClickDistance:Pt,onSelectionContextMenu:$,onSelectionStart:R,onSelectionEnd:B,onReconnect:Yn,onReconnectStart:ei,onReconnectEnd:qr,onEdgeContextMenu:Yr,onEdgeDoubleClick:pr,onEdgeMouseEnter:on,onEdgeMouseMove:zn,onEdgeMouseLeave:Rr,reconnectRadius:In,defaultMarkerColor:Tt,noDragClassName:Ns,noWheelClassName:Sr,noPanClassName:Ft,rfId:oe,disableKeyboardA11y:ut,nodeExtent:je,viewport:be,onViewportChange:Pe}),o.jsx(Y4,{onSelectionChange:L}),fn,o.jsx(W4,{proOptions:vn,position:yt}),o.jsx(H4,{rfId:oe,disableKeyboardA11y:ut})]})})}var yI=qP(w5);function b5(){const e=xn();return m.useCallback(t=>{const{domNode:n,updateNodeInternals:r}=e.getState(),s=Array.isArray(t)?t:[t],i=new Map;s.forEach(a=>{const l=n==null?void 0:n.querySelector(`.react-flow__node[data-id="${a}"]`);l&&i.set(a,{id:a,nodeElement:l,force:!0})}),requestAnimationFrame(()=>r(i,{triggerFitView:!1}))},[])}function k5(e){const[t,n]=m.useState(e),r=m.useCallback(s=>n(i=>Ch(s,i)),[]);return[t,n,r]}function v5(e){const[t,n]=m.useState(e),r=m.useCallback(s=>n(i=>_h(s,i)),[]);return[t,n,r]}function S5({dimensions:e,lineWidth:t,variant:n,className:r}){return o.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Un(["react-flow__background-pattern",n,r])})}function N5({radius:e,className:t}){return o.jsx("circle",{cx:e,cy:e,r:e,className:Un(["react-flow__background-pattern","dots",t])})}var Do;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Do||(Do={}));const j5={[Do.Dots]:1,[Do.Lines]:1,[Do.Cross]:6},C5=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function xI({id:e,variant:t=Do.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=0,color:a,bgColor:l,style:c,className:u,patternClassName:f}){const d=m.useRef(null),{transform:p,patternId:h}=Lt(C5,bn),g=r||j5[t],k=t===Do.Dots,w=t===Do.Cross,y=Array.isArray(n)?n:[n,n],v=[y[0]*p[2]||1,y[1]*p[2]||1],b=g*p[2],C=Array.isArray(i)?i:[i,i],N=w?[b,b]:v,j=[C[0]*p[2]||1+N[0]/2,C[1]*p[2]||1+N[1]/2],A=`${h}${e||""}`;return o.jsxs("svg",{className:Un(["react-flow__background",u]),style:{...c,...Cm,"--xy-background-color-props":l,"--xy-background-pattern-color-props":a},ref:d,"data-testid":"rf__background",children:[o.jsx("pattern",{id:A,x:p[0]%v[0],y:p[1]%v[1],width:v[0],height:v[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${j[0]},-${j[1]})`,children:k?o.jsx(N5,{radius:b/2,className:f}):o.jsx(S5,{dimensions:N,lineWidth:s,variant:t,className:f})}),o.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${A})`})]})}xI.displayName="Background";const wI=m.memo(xI);function _5(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:o.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function E5(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:o.jsx("path",{d:"M0 0h32v4.2H0z"})})}function A5(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:o.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function P5(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:o.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function I5(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:o.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function ep({children:e,className:t,...n}){return o.jsx("button",{type:"button",className:Un(["react-flow__controls-button",t]),...n,children:e})}const R5=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function bI({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:a,onFitView:l,onInteractiveChange:c,className:u,children:f,position:d="bottom-left",orientation:p="vertical","aria-label":h}){const g=xn(),{isInteractive:k,minZoomReached:w,maxZoomReached:y,ariaLabelConfig:v}=Lt(R5,bn),{zoomIn:b,zoomOut:C,fitView:N}=wc(),j=()=>{b(),i==null||i()},A=()=>{C(),a==null||a()},I=()=>{N(s),l==null||l()},D=()=>{g.setState({nodesDraggable:!k,nodesConnectable:!k,elementsSelectable:!k}),c==null||c(!k)},H=p==="horizontal"?"horizontal":"vertical";return o.jsxs(jm,{className:Un(["react-flow__controls",H,u]),position:d,style:e,"data-testid":"rf__controls","aria-label":h??v["controls.ariaLabel"],children:[t&&o.jsxs(o.Fragment,{children:[o.jsx(ep,{onClick:j,className:"react-flow__controls-zoomin",title:v["controls.zoomIn.ariaLabel"],"aria-label":v["controls.zoomIn.ariaLabel"],disabled:y,children:o.jsx(_5,{})}),o.jsx(ep,{onClick:A,className:"react-flow__controls-zoomout",title:v["controls.zoomOut.ariaLabel"],"aria-label":v["controls.zoomOut.ariaLabel"],disabled:w,children:o.jsx(E5,{})})]}),n&&o.jsx(ep,{className:"react-flow__controls-fitview",onClick:I,title:v["controls.fitView.ariaLabel"],"aria-label":v["controls.fitView.ariaLabel"],children:o.jsx(A5,{})}),r&&o.jsx(ep,{className:"react-flow__controls-interactive",onClick:D,title:v["controls.interactive.ariaLabel"],"aria-label":v["controls.interactive.ariaLabel"],children:k?o.jsx(I5,{}):o.jsx(P5,{})}),f]})}bI.displayName="Controls";m.memo(bI);function T5({id:e,x:t,y:n,width:r,height:s,style:i,color:a,strokeColor:l,strokeWidth:c,className:u,borderRadius:f,shapeRendering:d,selected:p,onClick:h}){const{background:g,backgroundColor:k}=i||{},w=a||g||k;return o.jsx("rect",{className:Un(["react-flow__minimap-node",{selected:p},u]),x:t,y:n,rx:f,ry:f,width:r,height:s,style:{fill:w,stroke:l,strokeWidth:c},shapeRendering:d,onClick:h?y=>h(y,e):void 0})}const M5=m.memo(T5),$5=e=>e.nodes.map(t=>t.id),dy=e=>e instanceof Function?e:()=>e;function L5({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:i=M5,onClick:a}){const l=Lt($5,bn),c=dy(t),u=dy(e),f=dy(n),d=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return o.jsx(o.Fragment,{children:l.map(p=>o.jsx(D5,{id:p,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:f,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:i,onClick:a,shapeRendering:d},p))})}function O5({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:i,shapeRendering:a,NodeComponent:l,onClick:c}){const{node:u,x:f,y:d,width:p,height:h}=Lt(g=>{const k=g.nodeLookup.get(e);if(!k)return{node:void 0,x:0,y:0,width:0,height:0};const w=k.internals.userNode,{x:y,y:v}=k.internals.positionAbsolute,{width:b,height:C}=no(w);return{node:w,x:y,y:v,width:b,height:C}},bn);return!u||u.hidden||!gP(u)?null:o.jsx(l,{x:f,y:d,width:p,height:h,style:u.style,selected:!!u.selected,className:r(u),color:t(u),borderRadius:s,strokeColor:n(u),strokeWidth:i,shapeRendering:a,onClick:c,id:u.id})}const D5=m.memo(O5);var F5=m.memo(L5);const z5=200,B5=150,H5=e=>!e.hidden,W5=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?mP(Fd(e.nodeLookup,{filter:H5}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},V5="react-flow__minimap-desc";function kI({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:a,nodeComponent:l,bgColor:c,maskColor:u,maskStrokeColor:f,maskStrokeWidth:d,position:p="bottom-right",onClick:h,onNodeClick:g,pannable:k=!1,zoomable:w=!1,ariaLabel:y,inversePan:v,zoomStep:b=1,offsetScale:C=5}){const N=xn(),j=m.useRef(null),{boundingRect:A,viewBB:I,rfId:D,panZoom:H,translateExtent:V,flowWidth:F,flowHeight:L,ariaLabelConfig:M}=Lt(W5,bn),K=(e==null?void 0:e.width)??z5,W=(e==null?void 0:e.height)??B5,$=A.width/K,R=A.height/W,B=Math.max($,R),_=B*K,X=B*W,z=C*B,T=A.x-(_-A.width)/2-z,Z=A.y-(X-A.height)/2-z,ae=_+z*2,J=X+z*2,se=`${V5}-${D}`,ee=m.useRef(0),re=m.useRef();ee.current=B,m.useEffect(()=>{if(j.current&&H)return re.current=JB({domNode:j.current,panZoom:H,getTransform:()=>N.getState().transform,getViewScale:()=>ee.current}),()=>{var xe;(xe=re.current)==null||xe.destroy()}},[H]),m.useEffect(()=>{var xe;(xe=re.current)==null||xe.update({translateExtent:V,width:F,height:L,inversePan:v,pannable:k,zoomStep:b,zoomable:w})},[k,w,v,b,V,F,L]);const ne=h?xe=>{var Le;const[ze,Te]=((Le=re.current)==null?void 0:Le.pointer(xe))||[0,0];h(xe,{x:ze,y:Te})}:void 0,ue=g?m.useCallback((xe,ze)=>{const Te=N.getState().nodeLookup.get(ze).internals.userNode;g(xe,Te)},[]):void 0,de=y??M["minimap.ariaLabel"];return o.jsx(jm,{position:p,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-stroke-width-props":typeof d=="number"?d*B:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof a=="number"?a:void 0},className:Un(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:o.jsxs("svg",{width:K,height:W,viewBox:`${T} ${Z} ${ae} ${J}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":se,ref:j,onClick:ne,children:[de&&o.jsx("title",{id:se,children:de}),o.jsx(F5,{onClick:ue,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:a,nodeComponent:l}),o.jsx("path",{className:"react-flow__minimap-mask",d:`M${T-z},${Z-z}h${ae+z*2}v${J+z*2}h${-ae-z*2}z
|
|
66
|
-
M${I.x},${I.y}h${I.width}v${I.height}h${-I.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}kI.displayName="MiniMap";m.memo(kI);const K5=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,U5={[fc.Line]:"right",[fc.Handle]:"bottom-right"};function q5({nodeId:e,position:t,variant:n=fc.Handle,className:r,style:s=void 0,children:i,color:a,minWidth:l=10,minHeight:c=10,maxWidth:u=Number.MAX_VALUE,maxHeight:f=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:p,autoScale:h=!0,shouldResize:g,onResizeStart:k,onResize:w,onResizeEnd:y}){const v=XP(),b=typeof e=="string"?e:v,C=xn(),N=m.useRef(null),j=n===fc.Handle,A=Lt(m.useCallback(K5(j&&h),[j,h]),bn),I=m.useRef(null),D=t??U5[n];m.useEffect(()=>{if(!(!N.current||!b))return I.current||(I.current=u4({domNode:N.current,nodeId:b,getStoreItems:()=>{const{nodeLookup:V,transform:F,snapGrid:L,snapToGrid:M,nodeOrigin:K,domNode:W}=C.getState();return{nodeLookup:V,transform:F,snapGrid:L,snapToGrid:M,nodeOrigin:K,paneDomNode:W}},onChange:(V,F)=>{const{triggerNodeChanges:L,nodeLookup:M,parentLookup:K,nodeOrigin:W}=C.getState(),$=[],R={x:V.x,y:V.y},B=M.get(b);if(B&&B.expandParent&&B.parentId){const _=B.origin??W,X=V.width??B.measured.width??0,z=V.height??B.measured.height??0,T={id:B.id,parentId:B.parentId,rect:{width:X,height:z,...yP({x:V.x??B.position.x,y:V.y??B.position.y},{width:X,height:z},B.parentId,M,_)}},Z=tk([T],M,K,W);$.push(...Z),R.x=V.x?Math.max(_[0]*X,V.x):void 0,R.y=V.y?Math.max(_[1]*z,V.y):void 0}if(R.x!==void 0&&R.y!==void 0){const _={id:b,type:"position",position:{...R}};$.push(_)}if(V.width!==void 0&&V.height!==void 0){const X={id:b,type:"dimensions",resizing:!0,setAttributes:p?p==="horizontal"?"width":"height":!0,dimensions:{width:V.width,height:V.height}};$.push(X)}for(const _ of F){const X={..._,type:"position"};$.push(X)}L($)},onEnd:({width:V,height:F})=>{const L={id:b,type:"dimensions",resizing:!1,dimensions:{width:V,height:F}};C.getState().triggerNodeChanges([L])}})),I.current.update({controlPosition:D,boundaries:{minWidth:l,minHeight:c,maxWidth:u,maxHeight:f},keepAspectRatio:d,resizeDirection:p,onResizeStart:k,onResize:w,onResizeEnd:y,shouldResize:g}),()=>{var V;(V=I.current)==null||V.destroy()}},[D,l,c,u,f,d,k,w,y,g]);const H=D.split("-");return o.jsx("div",{className:Un(["react-flow__resize-control","nodrag",...H,n,r]),ref:N,style:{...s,scale:A,...a&&{[j?"backgroundColor":"borderColor"]:a}},children:i})}const sk=m.memo(q5),Y5="modulepreload",G5=function(e){return"/"+e},mj={},J5=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=Promise.allSettled(n.map(c=>{if(c=G5(c),c in mj)return;mj[c]=!0;const u=c.endsWith(".css"),f=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const d=document.createElement("link");if(d.rel=u?"stylesheet":Y5,u||(d.as="script"),d.crossOrigin="",d.href=c,l&&d.setAttribute("nonce",l),document.head.appendChild(d),u)return new Promise((p,h)=>{d.addEventListener("load",p),d.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return s.then(a=>{for(const l of a||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})};function X5(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Q5=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Z5=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,eW={};function gj(e,t){return(eW.jsx?Z5:Q5).test(e)}const tW=/[ \t\n\f\r]/g;function nW(e){return typeof e=="object"?e.type==="text"?yj(e.value):!1:yj(e)}function yj(e){return e.replace(tW,"")===""}class Hd{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Hd.prototype.normal={};Hd.prototype.property={};Hd.prototype.space=void 0;function vI(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new Hd(n,r,t)}function cw(e){return e.toLowerCase()}class Ur{constructor(t,n){this.attribute=n,this.property=t}}Ur.prototype.attribute="";Ur.prototype.booleanish=!1;Ur.prototype.boolean=!1;Ur.prototype.commaOrSpaceSeparated=!1;Ur.prototype.commaSeparated=!1;Ur.prototype.defined=!1;Ur.prototype.mustUseProperty=!1;Ur.prototype.number=!1;Ur.prototype.overloadedBoolean=!1;Ur.prototype.property="";Ur.prototype.spaceSeparated=!1;Ur.prototype.space=void 0;let rW=0;const vt=qa(),Wn=qa(),uw=qa(),Ce=qa(),ln=qa(),Yl=qa(),Qr=qa();function qa(){return 2**++rW}const dw=Object.freeze(Object.defineProperty({__proto__:null,boolean:vt,booleanish:Wn,commaOrSpaceSeparated:Qr,commaSeparated:Yl,number:Ce,overloadedBoolean:uw,spaceSeparated:ln},Symbol.toStringTag,{value:"Module"})),fy=Object.keys(dw);class ik extends Ur{constructor(t,n,r,s){let i=-1;if(super(t,n),xj(this,"space",s),typeof r=="number")for(;++i<fy.length;){const a=fy[i];xj(this,fy[i],(r&dw[a])===dw[a])}}}ik.prototype.defined=!0;function xj(e,t,n){n&&(e[t]=n)}function bc(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new ik(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[cw(r)]=r,n[cw(i.attribute)]=r}return new Hd(t,n,e.space)}const SI=bc({properties:{ariaActiveDescendant:null,ariaAtomic:Wn,ariaAutoComplete:null,ariaBusy:Wn,ariaChecked:Wn,ariaColCount:Ce,ariaColIndex:Ce,ariaColSpan:Ce,ariaControls:ln,ariaCurrent:null,ariaDescribedBy:ln,ariaDetails:null,ariaDisabled:Wn,ariaDropEffect:ln,ariaErrorMessage:null,ariaExpanded:Wn,ariaFlowTo:ln,ariaGrabbed:Wn,ariaHasPopup:null,ariaHidden:Wn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ln,ariaLevel:Ce,ariaLive:null,ariaModal:Wn,ariaMultiLine:Wn,ariaMultiSelectable:Wn,ariaOrientation:null,ariaOwns:ln,ariaPlaceholder:null,ariaPosInSet:Ce,ariaPressed:Wn,ariaReadOnly:Wn,ariaRelevant:null,ariaRequired:Wn,ariaRoleDescription:ln,ariaRowCount:Ce,ariaRowIndex:Ce,ariaRowSpan:Ce,ariaSelected:Wn,ariaSetSize:Ce,ariaSort:null,ariaValueMax:Ce,ariaValueMin:Ce,ariaValueNow:Ce,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function NI(e,t){return t in e?e[t]:t}function jI(e,t){return NI(e,t.toLowerCase())}const sW=bc({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Yl,acceptCharset:ln,accessKey:ln,action:null,allow:null,allowFullScreen:vt,allowPaymentRequest:vt,allowUserMedia:vt,alt:null,as:null,async:vt,autoCapitalize:null,autoComplete:ln,autoFocus:vt,autoPlay:vt,blocking:ln,capture:null,charSet:null,checked:vt,cite:null,className:ln,cols:Ce,colSpan:null,content:null,contentEditable:Wn,controls:vt,controlsList:ln,coords:Ce|Yl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:vt,defer:vt,dir:null,dirName:null,disabled:vt,download:uw,draggable:Wn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:vt,formTarget:null,headers:ln,height:Ce,hidden:uw,high:Ce,href:null,hrefLang:null,htmlFor:ln,httpEquiv:ln,id:null,imageSizes:null,imageSrcSet:null,inert:vt,inputMode:null,integrity:null,is:null,isMap:vt,itemId:null,itemProp:ln,itemRef:ln,itemScope:vt,itemType:ln,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:vt,low:Ce,manifest:null,max:null,maxLength:Ce,media:null,method:null,min:null,minLength:Ce,multiple:vt,muted:vt,name:null,nonce:null,noModule:vt,noValidate:vt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:vt,optimum:Ce,pattern:null,ping:ln,placeholder:null,playsInline:vt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:vt,referrerPolicy:null,rel:ln,required:vt,reversed:vt,rows:Ce,rowSpan:Ce,sandbox:ln,scope:null,scoped:vt,seamless:vt,selected:vt,shadowRootClonable:vt,shadowRootDelegatesFocus:vt,shadowRootMode:null,shape:null,size:Ce,sizes:null,slot:null,span:Ce,spellCheck:Wn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ce,step:null,style:null,tabIndex:Ce,target:null,title:null,translate:null,type:null,typeMustMatch:vt,useMap:null,value:Wn,width:Ce,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ln,axis:null,background:null,bgColor:null,border:Ce,borderColor:null,bottomMargin:Ce,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:vt,declare:vt,event:null,face:null,frame:null,frameBorder:null,hSpace:Ce,leftMargin:Ce,link:null,longDesc:null,lowSrc:null,marginHeight:Ce,marginWidth:Ce,noResize:vt,noHref:vt,noShade:vt,noWrap:vt,object:null,profile:null,prompt:null,rev:null,rightMargin:Ce,rules:null,scheme:null,scrolling:Wn,standby:null,summary:null,text:null,topMargin:Ce,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ce,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:vt,disableRemotePlayback:vt,prefix:null,property:null,results:Ce,security:null,unselectable:null},space:"html",transform:jI}),iW=bc({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Qr,accentHeight:Ce,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ce,amplitude:Ce,arabicForm:null,ascent:Ce,attributeName:null,attributeType:null,azimuth:Ce,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ce,by:null,calcMode:null,capHeight:Ce,className:ln,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Ce,diffuseConstant:Ce,direction:null,display:null,dur:null,divisor:Ce,dominantBaseline:null,download:vt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ce,enableBackground:null,end:null,event:null,exponent:Ce,externalResourcesRequired:null,fill:null,fillOpacity:Ce,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Yl,g2:Yl,glyphName:Yl,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ce,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ce,horizOriginX:Ce,horizOriginY:Ce,id:null,ideographic:Ce,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ce,k:Ce,k1:Ce,k2:Ce,k3:Ce,k4:Ce,kernelMatrix:Qr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ce,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Ce,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Ce,overlineThickness:Ce,paintOrder:null,panose1:null,path:null,pathLength:Ce,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ln,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ce,pointsAtY:Ce,pointsAtZ:Ce,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Qr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Qr,rev:Qr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Qr,requiredFeatures:Qr,requiredFonts:Qr,requiredFormats:Qr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Ce,specularExponent:Ce,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ce,strikethroughThickness:Ce,string:null,stroke:null,strokeDashArray:Qr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ce,strokeOpacity:Ce,strokeWidth:null,style:null,surfaceScale:Ce,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Qr,tabIndex:Ce,tableValues:null,target:null,targetX:Ce,targetY:Ce,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Qr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ce,underlineThickness:Ce,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ce,values:null,vAlphabetic:Ce,vMathematical:Ce,vectorEffect:null,vHanging:Ce,vIdeographic:Ce,version:null,vertAdvY:Ce,vertOriginX:Ce,vertOriginY:Ce,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ce,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:NI}),CI=bc({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),_I=bc({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:jI}),EI=bc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),oW={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},aW=/[A-Z]/g,wj=/-[a-z]/g,lW=/^data[-\w.:]+$/i;function cW(e,t){const n=cw(t);let r=t,s=Ur;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&lW.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(wj,dW);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!wj.test(i)){let a=i.replace(aW,uW);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}s=ik}return new s(r,t)}function uW(e){return"-"+e.toLowerCase()}function dW(e){return e.charAt(1).toUpperCase()}const fW=vI([SI,sW,CI,_I,EI],"html"),ok=vI([SI,iW,CI,_I,EI],"svg");function pW(e){return e.join(" ").trim()}var ak={},bj=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,hW=/\n/g,mW=/^\s*/,gW=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,yW=/^:\s*/,xW=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,wW=/^[;\s]*/,bW=/^\s+|\s+$/g,kW=`
|
|
67
|
-
`,kj="/",vj="*",pa="",vW="comment",SW="declaration";function NW(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function s(g){var k=g.match(hW);k&&(n+=k.length);var w=g.lastIndexOf(kW);r=~w?g.length-w:r+g.length}function i(){var g={line:n,column:r};return function(k){return k.position=new a(g),u(),k}}function a(g){this.start=g,this.end={line:n,column:r},this.source=t.source}a.prototype.content=e;function l(g){var k=new Error(t.source+":"+n+":"+r+": "+g);if(k.reason=g,k.filename=t.source,k.line=n,k.column=r,k.source=e,!t.silent)throw k}function c(g){var k=g.exec(e);if(k){var w=k[0];return s(w),e=e.slice(w.length),k}}function u(){c(mW)}function f(g){var k;for(g=g||[];k=d();)k!==!1&&g.push(k);return g}function d(){var g=i();if(!(kj!=e.charAt(0)||vj!=e.charAt(1))){for(var k=2;pa!=e.charAt(k)&&(vj!=e.charAt(k)||kj!=e.charAt(k+1));)++k;if(k+=2,pa===e.charAt(k-1))return l("End of comment missing");var w=e.slice(2,k-2);return r+=2,s(w),e=e.slice(k),r+=2,g({type:vW,comment:w})}}function p(){var g=i(),k=c(gW);if(k){if(d(),!c(yW))return l("property missing ':'");var w=c(xW),y=g({type:SW,property:Sj(k[0].replace(bj,pa)),value:w?Sj(w[0].replace(bj,pa)):pa});return c(wW),y}}function h(){var g=[];f(g);for(var k;k=p();)k!==!1&&(g.push(k),f(g));return g}return u(),h()}function Sj(e){return e?e.replace(bW,pa):pa}var jW=NW,CW=Vu&&Vu.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ak,"__esModule",{value:!0});ak.default=EW;const _W=CW(jW);function EW(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,_W.default)(e),s=typeof t=="function";return r.forEach(i=>{if(i.type!=="declaration")return;const{property:a,value:l}=i;s?t(a,l,i):l&&(n=n||{},n[a]=l)}),n}var Em={};Object.defineProperty(Em,"__esModule",{value:!0});Em.camelCase=void 0;var AW=/^--[a-zA-Z0-9_-]+$/,PW=/-([a-z])/g,IW=/^[^-]+$/,RW=/^-(webkit|moz|ms|o|khtml)-/,TW=/^-(ms)-/,MW=function(e){return!e||IW.test(e)||AW.test(e)},$W=function(e,t){return t.toUpperCase()},Nj=function(e,t){return"".concat(t,"-")},LW=function(e,t){return t===void 0&&(t={}),MW(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(TW,Nj):e=e.replace(RW,Nj),e.replace(PW,$W))};Em.camelCase=LW;var OW=Vu&&Vu.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},DW=OW(ak),FW=Em;function fw(e,t){var n={};return!e||typeof e!="string"||(0,DW.default)(e,function(r,s){r&&s&&(n[(0,FW.camelCase)(r,t)]=s)}),n}fw.default=fw;var zW=fw;const BW=qo(zW),AI=PI("end"),lk=PI("start");function PI(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function HW(e){const t=lk(e),n=AI(e);if(t&&n)return{start:t,end:n}}function Ou(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?jj(e.position):"start"in e||"end"in e?jj(e):"line"in e||"column"in e?pw(e):""}function pw(e){return Cj(e&&e.line)+":"+Cj(e&&e.column)}function jj(e){return pw(e&&e.start)+"-"+pw(e&&e.end)}function Cj(e){return e&&typeof e=="number"?e:1}class kr extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},a=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?s=t:!i.cause&&t&&(a=!0,s=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=l?l.line:void 0,this.name=Ou(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}kr.prototype.file="";kr.prototype.name="";kr.prototype.reason="";kr.prototype.message="";kr.prototype.stack="";kr.prototype.column=void 0;kr.prototype.line=void 0;kr.prototype.ancestors=void 0;kr.prototype.cause=void 0;kr.prototype.fatal=void 0;kr.prototype.place=void 0;kr.prototype.ruleId=void 0;kr.prototype.source=void 0;const ck={}.hasOwnProperty,WW=new Map,VW=/[A-Z]/g,KW=new Set(["table","tbody","thead","tfoot","tr"]),UW=new Set(["td","th"]),II="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function qW(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=t6(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=e6(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?ok:fW,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=RI(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function RI(e,t,n){if(t.type==="element")return YW(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return GW(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return XW(e,t,n);if(t.type==="mdxjsEsm")return JW(e,t);if(t.type==="root")return QW(e,t,n);if(t.type==="text")return ZW(e,t)}function YW(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=ok,e.schema=s),e.ancestors.push(t);const i=MI(e,t.tagName,!1),a=n6(e,t);let l=dk(e,t);return KW.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!nW(c):!0})),TI(e,a,i,t),uk(a,l),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function GW(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}yd(e,t.position)}function JW(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);yd(e,t.position)}function XW(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=ok,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:MI(e,t.name,!0),a=r6(e,t),l=dk(e,t);return TI(e,a,i,t),uk(a,l),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function QW(e,t,n){const r={};return uk(r,dk(e,t)),e.create(t,e.Fragment,r,n)}function ZW(e,t){return t.value}function TI(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function uk(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function e6(e,t,n){return r;function r(s,i,a,l){const u=Array.isArray(a.children)?n:t;return l?u(i,a,l):u(i,a)}}function t6(e,t){return n;function n(r,s,i,a){const l=Array.isArray(i.children),c=lk(r);return t(s,i,a,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function n6(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&ck.call(t.properties,s)){const i=s6(e,s,t.properties[s]);if(i){const[a,l]=i;e.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&UW.has(t.tagName)?r=l:n[a]=l}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function r6(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const a=i.expression;a.type;const l=a.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else yd(e,t.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,i=e.evaluater.evaluateExpression(l.expression)}else yd(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function dk(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:WW;for(;++r<t.children.length;){const i=t.children[r];let a;if(e.passKeys){const c=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(c){const u=s.get(c)||0;a=c+"-"+u,s.set(c,u+1)}}const l=RI(e,i,a);l!==void 0&&n.push(l)}return n}function s6(e,t,n){const r=cW(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?X5(n):pW(n)),r.property==="style"){let s=typeof n=="object"?n:i6(e,String(n));return e.stylePropertyNameCase==="css"&&(s=o6(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?oW[r.property]||r.property:r.attribute,n]}}function i6(e,t){try{return BW(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new kr("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=II+"#cannot-parse-style-attribute",s}}function MI(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let i=-1,a;for(;++i<s.length;){const l=gj(s[i])?{type:"Identifier",name:s[i]}:{type:"Literal",value:s[i]};a=a?{type:"MemberExpression",object:a,property:l,computed:!!(i&&l.type==="Literal"),optional:!1}:l}r=a}else r=gj(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return ck.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);yd(e)}function yd(e,t){const n=new kr("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=II+"#cannot-handle-mdx-estrees-without-createevaluater",n}function o6(e){const t={};let n;for(n in e)ck.call(e,n)&&(t[a6(n)]=e[n]);return t}function a6(e){let t=e.replace(VW,l6);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function l6(e){return"-"+e.toLowerCase()}const py={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},c6={};function u6(e,t){const n=c6,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return $I(e,r,s)}function $I(e,t,n){if(d6(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return _j(e.children,t,n)}return Array.isArray(e)?_j(e,t,n):""}function _j(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=$I(e[s],t,n);return r.join("")}function d6(e){return!!(e&&typeof e=="object")}const Ej=document.createElement("i");function fk(e){const t="&"+e+";";Ej.innerHTML=t;const n=Ej.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Si(e,t,n,r){const s=e.length;let i=0,a;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);i<r.length;)a=r.slice(i,i+1e4),a.unshift(t,0),e.splice(...a),i+=1e4,t+=1e4}function xs(e,t){return e.length>0?(Si(e,e.length,0,t),e):t}const Aj={}.hasOwnProperty;function f6(e){const t={};let n=-1;for(;++n<e.length;)p6(t,e[n]);return t}function p6(e,t){let n;for(n in t){const s=(Aj.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let a;if(i)for(a in i){Aj.call(s,a)||(s[a]=[]);const l=i[a];h6(s[a],Array.isArray(l)?l:l?[l]:[])}}}function h6(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Si(e,0,0,r)}function LI(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Gl(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const pi=Xo(/[A-Za-z]/),rs=Xo(/[\dA-Za-z]/),m6=Xo(/[#-'*+\--9=?A-Z^-~]/);function hw(e){return e!==null&&(e<32||e===127)}const mw=Xo(/\d/),g6=Xo(/[\dA-Fa-f]/),y6=Xo(/[!-/:-@[-`{-~]/);function ft(e){return e!==null&&e<-2}function Kr(e){return e!==null&&(e<0||e===32)}function Ut(e){return e===-2||e===-1||e===32}const x6=Xo(new RegExp("\\p{P}|\\p{S}","u")),w6=Xo(/\s/);function Xo(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function kc(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const i=e.charCodeAt(n);let a="";if(i===37&&rs(e.charCodeAt(n+1))&&rs(e.charCodeAt(n+2)))s=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(a=String.fromCharCode(i));else if(i>55295&&i<57344){const l=e.charCodeAt(n+1);i<56320&&l>56319&&l<57344?(a=String.fromCharCode(i,l),s=1):a="�"}else a=String.fromCharCode(i);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+s+1,a=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function un(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(c){return Ut(c)?(e.enter(n),l(c)):t(c)}function l(c){return Ut(c)&&i++<s?(e.consume(c),l):(e.exit(n),t(c))}}const b6={tokenize:k6};function k6(e){const t=e.attempt(this.parser.constructs.contentInitial,r,s);let n;return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),un(e,t,"linePrefix")}function s(l){return e.enter("paragraph"),i(l)}function i(l){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,a(l)}function a(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return ft(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),a)}}const v6={tokenize:S6},Pj={tokenize:N6};function S6(e){const t=this,n=[];let r=0,s,i,a;return l;function l(b){if(r<n.length){const C=n[r];return t.containerState=C[1],e.attempt(C[0].continuation,c,u)(b)}return u(b)}function c(b){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&v();const C=t.events.length;let N=C,j;for(;N--;)if(t.events[N][0]==="exit"&&t.events[N][1].type==="chunkFlow"){j=t.events[N][1].end;break}y(r);let A=C;for(;A<t.events.length;)t.events[A][1].end={...j},A++;return Si(t.events,N+1,0,t.events.slice(C)),t.events.length=A,u(b)}return l(b)}function u(b){if(r===n.length){if(!s)return p(b);if(s.currentConstruct&&s.currentConstruct.concrete)return g(b);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Pj,f,d)(b)}function f(b){return s&&v(),y(r),p(b)}function d(b){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,g(b)}function p(b){return t.containerState={},e.attempt(Pj,h,g)(b)}function h(b){return r++,n.push([t.currentConstruct,t.containerState]),p(b)}function g(b){if(b===null){s&&v(),y(0),e.consume(b);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),k(b)}function k(b){if(b===null){w(e.exit("chunkFlow"),!0),y(0),e.consume(b);return}return ft(b)?(e.consume(b),w(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(b),k)}function w(b,C){const N=t.sliceStream(b);if(C&&N.push(null),b.previous=i,i&&(i.next=b),i=b,s.defineSkip(b.start),s.write(N),t.parser.lazy[b.start.line]){let j=s.events.length;for(;j--;)if(s.events[j][1].start.offset<a&&(!s.events[j][1].end||s.events[j][1].end.offset>a))return;const A=t.events.length;let I=A,D,H;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){if(D){H=t.events[I][1].end;break}D=!0}for(y(r),j=A;j<t.events.length;)t.events[j][1].end={...H},j++;Si(t.events,I+1,0,t.events.slice(A)),t.events.length=j}}function y(b){let C=n.length;for(;C-- >b;){const N=n[C];t.containerState=N[1],N[0].exit.call(t,e)}n.length=b}function v(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function N6(e,t,n){return un(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ij(e){if(e===null||Kr(e)||w6(e))return 1;if(x6(e))return 2}function pk(e,t,n){const r=[];let s=-1;for(;++s<e.length;){const i=e[s].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const gw={name:"attention",resolveAll:j6,tokenize:C6};function j6(e,t){let n=-1,r,s,i,a,l,c,u,f;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},p={...e[n][1].start};Rj(d,-c),Rj(p,c),a={type:c>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},i={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:c>1?"strong":"emphasis",start:{...a.start},end:{...l.end}},e[r][1].end={...a.start},e[n][1].start={...l.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=xs(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=xs(u,[["enter",s,t],["enter",a,t],["exit",a,t],["enter",i,t]]),u=xs(u,pk(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=xs(u,[["exit",i,t],["enter",l,t],["exit",l,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(f=2,u=xs(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):f=0,Si(e,r-1,n-r+3,u),n=r+u.length-f-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function C6(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=Ij(r);let i;return a;function a(c){return i=c,e.enter("attentionSequence"),l(c)}function l(c){if(c===i)return e.consume(c),l;const u=e.exit("attentionSequence"),f=Ij(c),d=!f||f===2&&s||n.includes(c),p=!s||s===2&&f||n.includes(r);return u._open=!!(i===42?d:d&&(s||!p)),u._close=!!(i===42?p:p&&(f||!d)),t(c)}}function Rj(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const _6={name:"autolink",tokenize:E6};function E6(e,t,n){let r=0;return s;function s(h){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(h){return pi(h)?(e.consume(h),a):h===64?n(h):u(h)}function a(h){return h===43||h===45||h===46||rs(h)?(r=1,l(h)):u(h)}function l(h){return h===58?(e.consume(h),r=0,c):(h===43||h===45||h===46||rs(h))&&r++<32?(e.consume(h),l):(r=0,u(h))}function c(h){return h===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):h===null||h===32||h===60||hw(h)?n(h):(e.consume(h),c)}function u(h){return h===64?(e.consume(h),f):m6(h)?(e.consume(h),u):n(h)}function f(h){return rs(h)?d(h):n(h)}function d(h){return h===46?(e.consume(h),r=0,f):h===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):p(h)}function p(h){if((h===45||rs(h))&&r++<63){const g=h===45?p:d;return e.consume(h),g}return n(h)}}const Am={partial:!0,tokenize:A6};function A6(e,t,n){return r;function r(i){return Ut(i)?un(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||ft(i)?t(i):n(i)}}const OI={continuation:{tokenize:I6},exit:R6,name:"blockQuote",tokenize:P6};function P6(e,t,n){const r=this;return s;function s(a){if(a===62){const l=r.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),i}return n(a)}function i(a){return Ut(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function I6(e,t,n){const r=this;return s;function s(a){return Ut(a)?un(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):i(a)}function i(a){return e.attempt(OI,t,n)(a)}}function R6(e){e.exit("blockQuote")}const DI={name:"characterEscape",tokenize:T6};function T6(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),s}function s(i){return y6(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const FI={name:"characterReference",tokenize:M6};function M6(e,t,n){const r=this;let s=0,i,a;return l;function l(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),c}function c(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,a=rs,f(d))}function u(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,a=g6,f):(e.enter("characterReferenceValue"),i=7,a=mw,f(d))}function f(d){if(d===59&&s){const p=e.exit("characterReferenceValue");return a===rs&&!fk(r.sliceSerialize(p))?n(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(d)&&s++<i?(e.consume(d),f):n(d)}}const Tj={partial:!0,tokenize:L6},Mj={concrete:!0,name:"codeFenced",tokenize:$6};function $6(e,t,n){const r=this,s={partial:!0,tokenize:N};let i=0,a=0,l;return c;function c(j){return u(j)}function u(j){const A=r.events[r.events.length-1];return i=A&&A[1].type==="linePrefix"?A[2].sliceSerialize(A[1],!0).length:0,l=j,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),f(j)}function f(j){return j===l?(a++,e.consume(j),f):a<3?n(j):(e.exit("codeFencedFenceSequence"),Ut(j)?un(e,d,"whitespace")(j):d(j))}function d(j){return j===null||ft(j)?(e.exit("codeFencedFence"),r.interrupt?t(j):e.check(Tj,k,C)(j)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(j))}function p(j){return j===null||ft(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(j)):Ut(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),un(e,h,"whitespace")(j)):j===96&&j===l?n(j):(e.consume(j),p)}function h(j){return j===null||ft(j)?d(j):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(j))}function g(j){return j===null||ft(j)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(j)):j===96&&j===l?n(j):(e.consume(j),g)}function k(j){return e.attempt(s,C,w)(j)}function w(j){return e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),y}function y(j){return i>0&&Ut(j)?un(e,v,"linePrefix",i+1)(j):v(j)}function v(j){return j===null||ft(j)?e.check(Tj,k,C)(j):(e.enter("codeFlowValue"),b(j))}function b(j){return j===null||ft(j)?(e.exit("codeFlowValue"),v(j)):(e.consume(j),b)}function C(j){return e.exit("codeFenced"),t(j)}function N(j,A,I){let D=0;return H;function H(K){return j.enter("lineEnding"),j.consume(K),j.exit("lineEnding"),V}function V(K){return j.enter("codeFencedFence"),Ut(K)?un(j,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(K):F(K)}function F(K){return K===l?(j.enter("codeFencedFenceSequence"),L(K)):I(K)}function L(K){return K===l?(D++,j.consume(K),L):D>=a?(j.exit("codeFencedFenceSequence"),Ut(K)?un(j,M,"whitespace")(K):M(K)):I(K)}function M(K){return K===null||ft(K)?(j.exit("codeFencedFence"),A(K)):I(K)}}}function L6(e,t,n){const r=this;return s;function s(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i)}function i(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const hy={name:"codeIndented",tokenize:D6},O6={partial:!0,tokenize:F6};function D6(e,t,n){const r=this;return s;function s(u){return e.enter("codeIndented"),un(e,i,"linePrefix",5)(u)}function i(u){const f=r.events[r.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?a(u):n(u)}function a(u){return u===null?c(u):ft(u)?e.attempt(O6,a,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||ft(u)?(e.exit("codeFlowValue"),a(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function F6(e,t,n){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?n(a):ft(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):un(e,i,"linePrefix",5)(a)}function i(a){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(a):ft(a)?s(a):n(a)}}const z6={name:"codeText",previous:H6,resolve:B6,tokenize:W6};function B6(e){let t=e.length-4,n=3,r,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)s===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(s=r):(r===t||e[r][1].type==="lineEnding")&&(e[s][1].type="codeTextData",r!==s+2&&(e[s][1].end=e[r-1][1].end,e.splice(s+2,r-s-2),t-=r-s-2,r=s+2),s=void 0);return e}function H6(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function W6(e,t,n){let r=0,s,i;return a;function a(d){return e.enter("codeText"),e.enter("codeTextSequence"),l(d)}function l(d){return d===96?(e.consume(d),r++,l):(e.exit("codeTextSequence"),c(d))}function c(d){return d===null?n(d):d===32?(e.enter("space"),e.consume(d),e.exit("space"),c):d===96?(i=e.enter("codeTextSequence"),s=0,f(d)):ft(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(d))}function u(d){return d===null||d===32||d===96||ft(d)?(e.exit("codeTextData"),c(d)):(e.consume(d),u)}function f(d){return d===96?(e.consume(d),s++,f):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(d)):(i.type="codeTextData",u(d))}}class V6{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const s=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&ou(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),ou(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),ou(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);ou(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);ou(this.left,n.reverse())}}}function ou(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function zI(e){const t={};let n=-1,r,s,i,a,l,c,u;const f=new V6(e);for(;++n<f.length;){for(;n in t;)n=t[n];if(r=f.get(n),n&&r[1].type==="chunkFlow"&&f.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type==="lineEndingBlank"&&(i+=2),i<c.length&&c[i][1].type==="content"))for(;++i<c.length&&c[i][1].type!=="content";)c[i][1].type==="chunkText"&&(c[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,K6(f,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,s=void 0;i--;)if(a=f.get(i),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(s&&(f.get(s)[1].type="lineEndingBlank"),a[1].type="lineEnding",s=i);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;s&&(r[1].end={...f.get(s)[1].start},l=f.slice(s,n),l.unshift(r),f.splice(s,n-s+1,l))}}return Si(e,0,Number.POSITIVE_INFINITY,f.slice(0)),!u}function K6(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const i=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const l=a.events,c=[],u={};let f,d,p=-1,h=n,g=0,k=0;const w=[k];for(;h;){for(;e.get(++s)[1]!==h;);i.push(s),h._tokenizer||(f=r.sliceStream(h),h.next||f.push(null),d&&a.defineSkip(h.start),h._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(f),h._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),d=h,h=h.next}for(h=n;++p<l.length;)l[p][0]==="exit"&&l[p-1][0]==="enter"&&l[p][1].type===l[p-1][1].type&&l[p][1].start.line!==l[p][1].end.line&&(k=p+1,w.push(k),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(a.events=[],h?(h._tokenizer=void 0,h.previous=void 0):w.pop(),p=w.length;p--;){const y=l.slice(w[p],w[p+1]),v=i.pop();c.push([v,v+y.length-1]),e.splice(v,2,y)}for(c.reverse(),p=-1;++p<c.length;)u[g+c[p][0]]=g+c[p][1],g+=c[p][1]-c[p][0]-1;return u}const U6={resolve:Y6,tokenize:G6},q6={partial:!0,tokenize:J6};function Y6(e){return zI(e),e}function G6(e,t){let n;return r;function r(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(l)}function s(l){return l===null?i(l):ft(l)?e.check(q6,a,i)(l):(e.consume(l),s)}function i(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function a(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function J6(e,t,n){const r=this;return s;function s(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),un(e,i,"linePrefix")}function i(a){if(a===null||ft(a))return n(a);const l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function BI(e,t,n,r,s,i,a,l,c){const u=c||Number.POSITIVE_INFINITY;let f=0;return d;function d(y){return y===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(y),e.exit(i),p):y===null||y===32||y===41||hw(y)?n(y):(e.enter(r),e.enter(a),e.enter(l),e.enter("chunkString",{contentType:"string"}),k(y))}function p(y){return y===62?(e.enter(i),e.consume(y),e.exit(i),e.exit(s),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),h(y))}function h(y){return y===62?(e.exit("chunkString"),e.exit(l),p(y)):y===null||y===60||ft(y)?n(y):(e.consume(y),y===92?g:h)}function g(y){return y===60||y===62||y===92?(e.consume(y),h):h(y)}function k(y){return!f&&(y===null||y===41||Kr(y))?(e.exit("chunkString"),e.exit(l),e.exit(a),e.exit(r),t(y)):f<u&&y===40?(e.consume(y),f++,k):y===41?(e.consume(y),f--,k):y===null||y===32||y===40||hw(y)?n(y):(e.consume(y),y===92?w:k)}function w(y){return y===40||y===41||y===92?(e.consume(y),k):k(y)}}function HI(e,t,n,r,s,i){const a=this;let l=0,c;return u;function u(h){return e.enter(r),e.enter(s),e.consume(h),e.exit(s),e.enter(i),f}function f(h){return l>999||h===null||h===91||h===93&&!c||h===94&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(h):h===93?(e.exit(i),e.enter(s),e.consume(h),e.exit(s),e.exit(r),t):ft(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),f):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===null||h===91||h===93||ft(h)||l++>999?(e.exit("chunkString"),f(h)):(e.consume(h),c||(c=!Ut(h)),h===92?p:d)}function p(h){return h===91||h===92||h===93?(e.consume(h),l++,d):d(h)}}function WI(e,t,n,r,s,i){let a;return l;function l(p){return p===34||p===39||p===40?(e.enter(r),e.enter(s),e.consume(p),e.exit(s),a=p===40?41:p,c):n(p)}function c(p){return p===a?(e.enter(s),e.consume(p),e.exit(s),e.exit(r),t):(e.enter(i),u(p))}function u(p){return p===a?(e.exit(i),c(a)):p===null?n(p):ft(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),un(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===a||p===null||ft(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?d:f)}function d(p){return p===a||p===92?(e.consume(p),f):f(p)}}function Du(e,t){let n;return r;function r(s){return ft(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):Ut(s)?un(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const X6={name:"definition",tokenize:Z6},Q6={partial:!0,tokenize:e8};function Z6(e,t,n){const r=this;let s;return i;function i(h){return e.enter("definition"),a(h)}function a(h){return HI.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function l(h){return s=Gl(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),c):n(h)}function c(h){return Kr(h)?Du(e,u)(h):u(h)}function u(h){return BI(e,f,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function f(h){return e.attempt(Q6,d,d)(h)}function d(h){return Ut(h)?un(e,p,"whitespace")(h):p(h)}function p(h){return h===null||ft(h)?(e.exit("definition"),r.parser.defined.push(s),t(h)):n(h)}}function e8(e,t,n){return r;function r(l){return Kr(l)?Du(e,s)(l):n(l)}function s(l){return WI(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return Ut(l)?un(e,a,"whitespace")(l):a(l)}function a(l){return l===null||ft(l)?t(l):n(l)}}const t8={name:"hardBreakEscape",tokenize:n8};function n8(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return ft(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const r8={name:"headingAtx",resolve:s8,tokenize:i8};function s8(e,t){let n=e.length-2,r=3,s,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Si(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function i8(e,t,n){let r=0;return s;function s(f){return e.enter("atxHeading"),i(f)}function i(f){return e.enter("atxHeadingSequence"),a(f)}function a(f){return f===35&&r++<6?(e.consume(f),a):f===null||Kr(f)?(e.exit("atxHeadingSequence"),l(f)):n(f)}function l(f){return f===35?(e.enter("atxHeadingSequence"),c(f)):f===null||ft(f)?(e.exit("atxHeading"),t(f)):Ut(f)?un(e,l,"whitespace")(f):(e.enter("atxHeadingText"),u(f))}function c(f){return f===35?(e.consume(f),c):(e.exit("atxHeadingSequence"),l(f))}function u(f){return f===null||f===35||Kr(f)?(e.exit("atxHeadingText"),l(f)):(e.consume(f),u)}}const o8=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],$j=["pre","script","style","textarea"],a8={concrete:!0,name:"htmlFlow",resolveTo:u8,tokenize:d8},l8={partial:!0,tokenize:p8},c8={partial:!0,tokenize:f8};function u8(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function d8(e,t,n){const r=this;let s,i,a,l,c;return u;function u(T){return f(T)}function f(T){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(T),d}function d(T){return T===33?(e.consume(T),p):T===47?(e.consume(T),i=!0,k):T===63?(e.consume(T),s=3,r.interrupt?t:_):pi(T)?(e.consume(T),a=String.fromCharCode(T),w):n(T)}function p(T){return T===45?(e.consume(T),s=2,h):T===91?(e.consume(T),s=5,l=0,g):pi(T)?(e.consume(T),s=4,r.interrupt?t:_):n(T)}function h(T){return T===45?(e.consume(T),r.interrupt?t:_):n(T)}function g(T){const Z="CDATA[";return T===Z.charCodeAt(l++)?(e.consume(T),l===Z.length?r.interrupt?t:F:g):n(T)}function k(T){return pi(T)?(e.consume(T),a=String.fromCharCode(T),w):n(T)}function w(T){if(T===null||T===47||T===62||Kr(T)){const Z=T===47,ae=a.toLowerCase();return!Z&&!i&&$j.includes(ae)?(s=1,r.interrupt?t(T):F(T)):o8.includes(a.toLowerCase())?(s=6,Z?(e.consume(T),y):r.interrupt?t(T):F(T)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(T):i?v(T):b(T))}return T===45||rs(T)?(e.consume(T),a+=String.fromCharCode(T),w):n(T)}function y(T){return T===62?(e.consume(T),r.interrupt?t:F):n(T)}function v(T){return Ut(T)?(e.consume(T),v):H(T)}function b(T){return T===47?(e.consume(T),H):T===58||T===95||pi(T)?(e.consume(T),C):Ut(T)?(e.consume(T),b):H(T)}function C(T){return T===45||T===46||T===58||T===95||rs(T)?(e.consume(T),C):N(T)}function N(T){return T===61?(e.consume(T),j):Ut(T)?(e.consume(T),N):b(T)}function j(T){return T===null||T===60||T===61||T===62||T===96?n(T):T===34||T===39?(e.consume(T),c=T,A):Ut(T)?(e.consume(T),j):I(T)}function A(T){return T===c?(e.consume(T),c=null,D):T===null||ft(T)?n(T):(e.consume(T),A)}function I(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||Kr(T)?N(T):(e.consume(T),I)}function D(T){return T===47||T===62||Ut(T)?b(T):n(T)}function H(T){return T===62?(e.consume(T),V):n(T)}function V(T){return T===null||ft(T)?F(T):Ut(T)?(e.consume(T),V):n(T)}function F(T){return T===45&&s===2?(e.consume(T),W):T===60&&s===1?(e.consume(T),$):T===62&&s===4?(e.consume(T),X):T===63&&s===3?(e.consume(T),_):T===93&&s===5?(e.consume(T),B):ft(T)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(l8,z,L)(T)):T===null||ft(T)?(e.exit("htmlFlowData"),L(T)):(e.consume(T),F)}function L(T){return e.check(c8,M,z)(T)}function M(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),K}function K(T){return T===null||ft(T)?L(T):(e.enter("htmlFlowData"),F(T))}function W(T){return T===45?(e.consume(T),_):F(T)}function $(T){return T===47?(e.consume(T),a="",R):F(T)}function R(T){if(T===62){const Z=a.toLowerCase();return $j.includes(Z)?(e.consume(T),X):F(T)}return pi(T)&&a.length<8?(e.consume(T),a+=String.fromCharCode(T),R):F(T)}function B(T){return T===93?(e.consume(T),_):F(T)}function _(T){return T===62?(e.consume(T),X):T===45&&s===2?(e.consume(T),_):F(T)}function X(T){return T===null||ft(T)?(e.exit("htmlFlowData"),z(T)):(e.consume(T),X)}function z(T){return e.exit("htmlFlow"),t(T)}}function f8(e,t,n){const r=this;return s;function s(a){return ft(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):n(a)}function i(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function p8(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Am,t,n)}}const h8={name:"htmlText",tokenize:m8};function m8(e,t,n){const r=this;let s,i,a;return l;function l(_){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(_),c}function c(_){return _===33?(e.consume(_),u):_===47?(e.consume(_),N):_===63?(e.consume(_),b):pi(_)?(e.consume(_),I):n(_)}function u(_){return _===45?(e.consume(_),f):_===91?(e.consume(_),i=0,g):pi(_)?(e.consume(_),v):n(_)}function f(_){return _===45?(e.consume(_),h):n(_)}function d(_){return _===null?n(_):_===45?(e.consume(_),p):ft(_)?(a=d,$(_)):(e.consume(_),d)}function p(_){return _===45?(e.consume(_),h):d(_)}function h(_){return _===62?W(_):_===45?p(_):d(_)}function g(_){const X="CDATA[";return _===X.charCodeAt(i++)?(e.consume(_),i===X.length?k:g):n(_)}function k(_){return _===null?n(_):_===93?(e.consume(_),w):ft(_)?(a=k,$(_)):(e.consume(_),k)}function w(_){return _===93?(e.consume(_),y):k(_)}function y(_){return _===62?W(_):_===93?(e.consume(_),y):k(_)}function v(_){return _===null||_===62?W(_):ft(_)?(a=v,$(_)):(e.consume(_),v)}function b(_){return _===null?n(_):_===63?(e.consume(_),C):ft(_)?(a=b,$(_)):(e.consume(_),b)}function C(_){return _===62?W(_):b(_)}function N(_){return pi(_)?(e.consume(_),j):n(_)}function j(_){return _===45||rs(_)?(e.consume(_),j):A(_)}function A(_){return ft(_)?(a=A,$(_)):Ut(_)?(e.consume(_),A):W(_)}function I(_){return _===45||rs(_)?(e.consume(_),I):_===47||_===62||Kr(_)?D(_):n(_)}function D(_){return _===47?(e.consume(_),W):_===58||_===95||pi(_)?(e.consume(_),H):ft(_)?(a=D,$(_)):Ut(_)?(e.consume(_),D):W(_)}function H(_){return _===45||_===46||_===58||_===95||rs(_)?(e.consume(_),H):V(_)}function V(_){return _===61?(e.consume(_),F):ft(_)?(a=V,$(_)):Ut(_)?(e.consume(_),V):D(_)}function F(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(e.consume(_),s=_,L):ft(_)?(a=F,$(_)):Ut(_)?(e.consume(_),F):(e.consume(_),M)}function L(_){return _===s?(e.consume(_),s=void 0,K):_===null?n(_):ft(_)?(a=L,$(_)):(e.consume(_),L)}function M(_){return _===null||_===34||_===39||_===60||_===61||_===96?n(_):_===47||_===62||Kr(_)?D(_):(e.consume(_),M)}function K(_){return _===47||_===62||Kr(_)?D(_):n(_)}function W(_){return _===62?(e.consume(_),e.exit("htmlTextData"),e.exit("htmlText"),t):n(_)}function $(_){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),R}function R(_){return Ut(_)?un(e,B,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):B(_)}function B(_){return e.enter("htmlTextData"),a(_)}}const hk={name:"labelEnd",resolveAll:w8,resolveTo:b8,tokenize:k8},g8={tokenize:v8},y8={tokenize:S8},x8={tokenize:N8};function w8(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const s=r.type==="labelImage"?4:2;r.type="data",t+=s}}return e.length!==n.length&&Si(e,0,e.length,n),e}function b8(e,t){let n=e.length,r=0,s,i,a,l;for(;n--;)if(s=e[n][1],i){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(a){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(i=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(a=n);const c={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[i][1].start},end:{...e[a][1].end}},f={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[a-2][1].start}};return l=[["enter",c,t],["enter",u,t]],l=xs(l,e.slice(i+1,i+r+3)),l=xs(l,[["enter",f,t]]),l=xs(l,pk(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),l=xs(l,[["exit",f,t],e[a-2],e[a-1],["exit",u,t]]),l=xs(l,e.slice(a+1)),l=xs(l,[["exit",c,t]]),Si(e,i,e.length,l),e}function k8(e,t,n){const r=this;let s=r.events.length,i,a;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){i=r.events[s][1];break}return l;function l(p){return i?i._inactive?d(p):(a=r.parser.defined.includes(Gl(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),c):n(p)}function c(p){return p===40?e.attempt(g8,f,a?f:d)(p):p===91?e.attempt(y8,f,a?u:d)(p):a?f(p):d(p)}function u(p){return e.attempt(x8,f,d)(p)}function f(p){return t(p)}function d(p){return i._balanced=!0,n(p)}}function v8(e,t,n){return r;function r(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),s}function s(d){return Kr(d)?Du(e,i)(d):i(d)}function i(d){return d===41?f(d):BI(e,a,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function a(d){return Kr(d)?Du(e,c)(d):f(d)}function l(d){return n(d)}function c(d){return d===34||d===39||d===40?WI(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):f(d)}function u(d){return Kr(d)?Du(e,f)(d):f(d)}function f(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):n(d)}}function S8(e,t,n){const r=this;return s;function s(l){return HI.call(r,e,i,a,"reference","referenceMarker","referenceString")(l)}function i(l){return r.parser.defined.includes(Gl(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function a(l){return n(l)}}function N8(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),s}function s(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const j8={name:"labelStartImage",resolveAll:hk.resolveAll,tokenize:C8};function C8(e,t,n){const r=this;return s;function s(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),i}function i(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),a):n(l)}function a(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const _8={name:"labelStartLink",resolveAll:hk.resolveAll,tokenize:E8};function E8(e,t,n){const r=this;return s;function s(a){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelLink"),i}function i(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const my={name:"lineEnding",tokenize:A8};function A8(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),un(e,t,"linePrefix")}}const Fp={name:"thematicBreak",tokenize:P8};function P8(e,t,n){let r=0,s;return i;function i(u){return e.enter("thematicBreak"),a(u)}function a(u){return s=u,l(u)}function l(u){return u===s?(e.enter("thematicBreakSequence"),c(u)):r>=3&&(u===null||ft(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===s?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),Ut(u)?un(e,l,"whitespace")(u):l(u))}}const Or={continuation:{tokenize:M8},exit:L8,name:"list",tokenize:T8},I8={partial:!0,tokenize:O8},R8={partial:!0,tokenize:$8};function T8(e,t,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,a=0;return l;function l(h){const g=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:mw(h)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(Fp,n,u)(h):u(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(h)}return n(h)}function c(h){return mw(h)&&++a<10?(e.consume(h),c):(!r.interrupt||a<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),u(h)):n(h)}function u(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check(Am,r.interrupt?n:f,e.attempt(I8,p,d))}function f(h){return r.containerState.initialBlankLine=!0,i++,p(h)}function d(h){return Ut(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),p):n(h)}function p(h){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function M8(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Am,s,i);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,un(e,t,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!Ut(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(R8,t,a)(l))}function a(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,un(e,e.attempt(Or,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function $8(e,t,n){const r=this;return un(e,s,"listItemIndent",r.containerState.size+1);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(i):n(i)}}function L8(e){e.exit(this.containerState.type)}function O8(e,t,n){const r=this;return un(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const a=r.events[r.events.length-1];return!Ut(i)&&a&&a[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const Lj={name:"setextUnderline",resolveTo:D8,tokenize:F8};function D8(e,t){let n=e.length,r,s,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",i?(e.splice(s,0,["enter",a,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function F8(e,t,n){const r=this;let s;return i;function i(u){let f=r.events.length,d;for(;f--;)if(r.events[f][1].type!=="lineEnding"&&r.events[f][1].type!=="linePrefix"&&r.events[f][1].type!=="content"){d=r.events[f][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),s=u,a(u)):n(u)}function a(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===s?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),Ut(u)?un(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||ft(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const z8={tokenize:B8};function B8(e){const t=this,n=e.attempt(Am,r,e.attempt(this.parser.constructs.flowInitial,s,un(e,e.attempt(this.parser.constructs.flow,s,e.attempt(U6,s)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const H8={resolveAll:KI()},W8=VI("string"),V8=VI("text");function VI(e){return{resolveAll:KI(e==="text"?K8:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],i=n.attempt(s,a,l);return a;function a(f){return u(f)?i(f):l(f)}function l(f){if(f===null){n.consume(f);return}return n.enter("data"),n.consume(f),c}function c(f){return u(f)?(n.exit("data"),i(f)):(n.consume(f),c)}function u(f){if(f===null)return!0;const d=s[f];let p=-1;if(d)for(;++p<d.length;){const h=d[p];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function KI(e){return t;function t(n,r){let s=-1,i;for(;++s<=n.length;)i===void 0?n[s]&&n[s][1].type==="data"&&(i=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==i+2&&(n[i][1].end=n[s-1][1].end,n.splice(i+2,s-i-2),s=i+2),i=void 0);return e?e(n,r):n}}function K8(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],s=t.sliceStream(r);let i=s.length,a=-1,l=0,c;for(;i--;){const u=s[i];if(typeof u=="string"){for(a=u.length;u.charCodeAt(a-1)===32;)l++,a--;if(a)break;a=-1}else if(u===-2)c=!0,l++;else if(u!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const u={type:n===e.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?a:r.start._bufferIndex+a,_index:r.start._index+i,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const U8={42:Or,43:Or,45:Or,48:Or,49:Or,50:Or,51:Or,52:Or,53:Or,54:Or,55:Or,56:Or,57:Or,62:OI},q8={91:X6},Y8={[-2]:hy,[-1]:hy,32:hy},G8={35:r8,42:Fp,45:[Lj,Fp],60:a8,61:Lj,95:Fp,96:Mj,126:Mj},J8={38:FI,92:DI},X8={[-5]:my,[-4]:my,[-3]:my,33:j8,38:FI,42:gw,60:[_6,h8],91:_8,92:[t8,DI],93:hk,95:gw,96:z6},Q8={null:[gw,H8]},Z8={null:[42,95]},e9={null:[]},t9=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Z8,contentInitial:q8,disable:e9,document:U8,flow:G8,flowInitial:Y8,insideSpan:Q8,string:J8,text:X8},Symbol.toStringTag,{value:"Module"}));function n9(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},i=[];let a=[],l=[];const c={attempt:A(N),check:A(j),consume:v,enter:b,exit:C,interrupt:A(j,{interrupt:!0})},u={code:null,containerState:{},defineSkip:k,events:[],now:g,parser:e,previous:null,sliceSerialize:p,sliceStream:h,write:d};let f=t.tokenize.call(u,c);return t.resolveAll&&i.push(t),u;function d(V){return a=xs(a,V),w(),a[a.length-1]!==null?[]:(I(t,0),u.events=pk(i,u.events,u),u.events)}function p(V,F){return s9(h(V),F)}function h(V){return r9(a,V)}function g(){const{_bufferIndex:V,_index:F,line:L,column:M,offset:K}=r;return{_bufferIndex:V,_index:F,line:L,column:M,offset:K}}function k(V){s[V.line]=V.column,H()}function w(){let V;for(;r._index<a.length;){const F=a[r._index];if(typeof F=="string")for(V=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===V&&r._bufferIndex<F.length;)y(F.charCodeAt(r._bufferIndex));else y(F)}}function y(V){f=f(V)}function v(V){ft(V)?(r.line++,r.column=1,r.offset+=V===-3?2:1,H()):V!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=V}function b(V,F){const L=F||{};return L.type=V,L.start=g(),u.events.push(["enter",L,u]),l.push(L),L}function C(V){const F=l.pop();return F.end=g(),u.events.push(["exit",F,u]),F}function N(V,F){I(V,F.from)}function j(V,F){F.restore()}function A(V,F){return L;function L(M,K,W){let $,R,B,_;return Array.isArray(M)?z(M):"tokenize"in M?z([M]):X(M);function X(J){return se;function se(ee){const re=ee!==null&&J[ee],ne=ee!==null&&J.null,ue=[...Array.isArray(re)?re:re?[re]:[],...Array.isArray(ne)?ne:ne?[ne]:[]];return z(ue)(ee)}}function z(J){return $=J,R=0,J.length===0?W:T(J[R])}function T(J){return se;function se(ee){return _=D(),B=J,J.partial||(u.currentConstruct=J),J.name&&u.parser.constructs.disable.null.includes(J.name)?ae():J.tokenize.call(F?Object.assign(Object.create(u),F):u,c,Z,ae)(ee)}}function Z(J){return V(B,_),K}function ae(J){return _.restore(),++R<$.length?T($[R]):W}}}function I(V,F){V.resolveAll&&!i.includes(V)&&i.push(V),V.resolve&&Si(u.events,F,u.events.length-F,V.resolve(u.events.slice(F),u)),V.resolveTo&&(u.events=V.resolveTo(u.events,u))}function D(){const V=g(),F=u.previous,L=u.currentConstruct,M=u.events.length,K=Array.from(l);return{from:M,restore:W};function W(){r=V,u.previous=F,u.currentConstruct=L,u.events.length=M,l=K,H()}}function H(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function r9(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,i=t.end._bufferIndex;let a;if(n===s)a=[e[n].slice(r,i)];else{if(a=e.slice(n,s),r>-1){const l=a[0];typeof l=="string"?a[0]=l.slice(r):a.shift()}i>0&&a.push(e[s].slice(0,i))}return a}function s9(e,t){let n=-1;const r=[];let s;for(;++n<e.length;){const i=e[n];let a;if(typeof i=="string")a=i;else switch(i){case-5:{a="\r";break}case-4:{a=`
|
|
68
|
-
`;break}case-3:{a=`\r
|
|
69
|
-
`;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&s)continue;a=" ";break}default:a=String.fromCharCode(i)}s=i===-2,r.push(a)}return r.join("")}function i9(e){const r={constructs:f6([t9,...(e||{}).extensions||[]]),content:s(b6),defined:[],document:s(v6),flow:s(z8),lazy:{},string:s(W8),text:s(V8)};return r;function s(i){return a;function a(l){return n9(r,i,l)}}}function o9(e){for(;!zI(e););return e}const Oj=/[\0\t\n\r]/g;function a9(){let e=1,t="",n=!0,r;return s;function s(i,a,l){const c=[];let u,f,d,p,h;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(a||void 0).decode(i)),d=0,t="",n&&(i.charCodeAt(0)===65279&&d++,n=void 0);d<i.length;){if(Oj.lastIndex=d,u=Oj.exec(i),p=u&&u.index!==void 0?u.index:i.length,h=i.charCodeAt(p),!u){t=i.slice(d);break}if(h===10&&d===p&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),d<p&&(c.push(i.slice(d,p)),e+=p-d),h){case 0:{c.push(65533),e++;break}case 9:{for(f=Math.ceil(e/4)*4,c.push(-2);e++<f;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}d=p+1}return l&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const l9=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function c9(e){return e.replace(l9,u9)}function u9(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return LI(n.slice(i?2:1),i?16:10)}return fk(n)||e}const UI={}.hasOwnProperty;function d9(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),f9(n)(o9(i9(n).document().write(a9()(e,t,!0))))}function f9(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(mt),autolinkProtocol:D,autolinkEmail:D,atxHeading:i(Te),blockQuote:i(ne),characterEscape:D,characterReference:D,codeFenced:i(ue),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:i(ue,a),codeText:i(de,a),codeTextData:D,data:D,codeFlowValue:D,definition:i(xe),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:i(ze),hardBreakEscape:i(Le),hardBreakTrailing:i(Le),htmlFlow:i(nt,a),htmlFlowData:D,htmlText:i(nt,a),htmlTextData:D,image:i(wt),label:a,link:i(mt),listItem:i(it),listItemValue:p,listOrdered:i(Re,d),listUnordered:i(Re),paragraph:i(Nt),reference:T,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:i(Te),strong:i(qt),thematicBreak:i(rt)},exit:{atxHeading:c(),atxHeadingSequence:N,autolink:c(),autolinkEmail:re,autolinkProtocol:ee,blockQuote:c(),characterEscapeValue:H,characterReferenceMarkerHexadecimal:ae,characterReferenceMarkerNumeric:ae,characterReferenceValue:J,characterReference:se,codeFenced:c(w),codeFencedFence:k,codeFencedFenceInfo:h,codeFencedFenceMeta:g,codeFlowValue:H,codeIndented:c(y),codeText:c(K),codeTextData:H,data:H,definition:c(),definitionDestinationString:C,definitionLabelString:v,definitionTitleString:b,emphasis:c(),hardBreakEscape:c(F),hardBreakTrailing:c(F),htmlFlow:c(L),htmlFlowData:H,htmlText:c(M),htmlTextData:H,image:c($),label:B,labelText:R,lineEnding:V,link:c(W),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:Z,resourceDestinationString:_,resourceTitleString:X,resource:z,setextHeading:c(I),setextHeadingLineSequence:A,setextHeadingText:j,strong:c(),thematicBreak:c()}};qI(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(fe){let ve={type:"root",children:[]};const He={stack:[ve],tokenStack:[],config:t,enter:l,exit:u,buffer:a,resume:f,data:n},Ge=[];let je=-1;for(;++je<fe.length;)if(fe[je][1].type==="listOrdered"||fe[je][1].type==="listUnordered")if(fe[je][0]==="enter")Ge.push(je);else{const Tt=Ge.pop();je=s(fe,Tt,je)}for(je=-1;++je<fe.length;){const Tt=t[fe[je][0]];UI.call(Tt,fe[je][1].type)&&Tt[fe[je][1].type].call(Object.assign({sliceSerialize:fe[je][2].sliceSerialize},He),fe[je][1])}if(He.tokenStack.length>0){const Tt=He.tokenStack[He.tokenStack.length-1];(Tt[1]||Dj).call(He,void 0,Tt[0])}for(ve.position={start:wo(fe.length>0?fe[0][1].start:{line:1,column:1,offset:0}),end:wo(fe.length>0?fe[fe.length-2][1].end:{line:1,column:1,offset:0})},je=-1;++je<t.transforms.length;)ve=t.transforms[je](ve)||ve;return ve}function s(fe,ve,He){let Ge=ve-1,je=-1,Tt=!1,kn,dn,en,Pn;for(;++Ge<=He;){const te=fe[Ge];switch(te[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{te[0]==="enter"?je++:je--,Pn=void 0;break}case"lineEndingBlank":{te[0]==="enter"&&(kn&&!Pn&&!je&&!en&&(en=Ge),Pn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Pn=void 0}if(!je&&te[0]==="enter"&&te[1].type==="listItemPrefix"||je===-1&&te[0]==="exit"&&(te[1].type==="listUnordered"||te[1].type==="listOrdered")){if(kn){let Ee=Ge;for(dn=void 0;Ee--;){const We=fe[Ee];if(We[1].type==="lineEnding"||We[1].type==="lineEndingBlank"){if(We[0]==="exit")continue;dn&&(fe[dn][1].type="lineEndingBlank",Tt=!0),We[1].type="lineEnding",dn=Ee}else if(!(We[1].type==="linePrefix"||We[1].type==="blockQuotePrefix"||We[1].type==="blockQuotePrefixWhitespace"||We[1].type==="blockQuoteMarker"||We[1].type==="listItemIndent"))break}en&&(!dn||en<dn)&&(kn._spread=!0),kn.end=Object.assign({},dn?fe[dn][1].start:te[1].end),fe.splice(dn||Ge,0,["exit",kn,te[2]]),Ge++,He++}if(te[1].type==="listItemPrefix"){const Ee={type:"listItem",_spread:!1,start:Object.assign({},te[1].start),end:void 0};kn=Ee,fe.splice(Ge,0,["enter",Ee,te[2]]),Ge++,He++,en=void 0,Pn=!0}}}return fe[ve][1]._spread=Tt,He}function i(fe,ve){return He;function He(Ge){l.call(this,fe(Ge),Ge),ve&&ve.call(this,Ge)}}function a(){this.stack.push({type:"fragment",children:[]})}function l(fe,ve,He){this.stack[this.stack.length-1].children.push(fe),this.stack.push(fe),this.tokenStack.push([ve,He||void 0]),fe.position={start:wo(ve.start),end:void 0}}function c(fe){return ve;function ve(He){fe&&fe.call(this,He),u.call(this,He)}}function u(fe,ve){const He=this.stack.pop(),Ge=this.tokenStack.pop();if(Ge)Ge[0].type!==fe.type&&(ve?ve.call(this,fe,Ge[0]):(Ge[1]||Dj).call(this,fe,Ge[0]));else throw new Error("Cannot close `"+fe.type+"` ("+Ou({start:fe.start,end:fe.end})+"): it’s not open");He.position.end=wo(fe.end)}function f(){return u6(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function p(fe){if(this.data.expectingFirstListItemValue){const ve=this.stack[this.stack.length-2];ve.start=Number.parseInt(this.sliceSerialize(fe),10),this.data.expectingFirstListItemValue=void 0}}function h(){const fe=this.resume(),ve=this.stack[this.stack.length-1];ve.lang=fe}function g(){const fe=this.resume(),ve=this.stack[this.stack.length-1];ve.meta=fe}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const fe=this.resume(),ve=this.stack[this.stack.length-1];ve.value=fe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const fe=this.resume(),ve=this.stack[this.stack.length-1];ve.value=fe.replace(/(\r?\n|\r)$/g,"")}function v(fe){const ve=this.resume(),He=this.stack[this.stack.length-1];He.label=ve,He.identifier=Gl(this.sliceSerialize(fe)).toLowerCase()}function b(){const fe=this.resume(),ve=this.stack[this.stack.length-1];ve.title=fe}function C(){const fe=this.resume(),ve=this.stack[this.stack.length-1];ve.url=fe}function N(fe){const ve=this.stack[this.stack.length-1];if(!ve.depth){const He=this.sliceSerialize(fe).length;ve.depth=He}}function j(){this.data.setextHeadingSlurpLineEnding=!0}function A(fe){const ve=this.stack[this.stack.length-1];ve.depth=this.sliceSerialize(fe).codePointAt(0)===61?1:2}function I(){this.data.setextHeadingSlurpLineEnding=void 0}function D(fe){const He=this.stack[this.stack.length-1].children;let Ge=He[He.length-1];(!Ge||Ge.type!=="text")&&(Ge=Zt(),Ge.position={start:wo(fe.start),end:void 0},He.push(Ge)),this.stack.push(Ge)}function H(fe){const ve=this.stack.pop();ve.value+=this.sliceSerialize(fe),ve.position.end=wo(fe.end)}function V(fe){const ve=this.stack[this.stack.length-1];if(this.data.atHardBreak){const He=ve.children[ve.children.length-1];He.position.end=wo(fe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ve.type)&&(D.call(this,fe),H.call(this,fe))}function F(){this.data.atHardBreak=!0}function L(){const fe=this.resume(),ve=this.stack[this.stack.length-1];ve.value=fe}function M(){const fe=this.resume(),ve=this.stack[this.stack.length-1];ve.value=fe}function K(){const fe=this.resume(),ve=this.stack[this.stack.length-1];ve.value=fe}function W(){const fe=this.stack[this.stack.length-1];if(this.data.inReference){const ve=this.data.referenceType||"shortcut";fe.type+="Reference",fe.referenceType=ve,delete fe.url,delete fe.title}else delete fe.identifier,delete fe.label;this.data.referenceType=void 0}function $(){const fe=this.stack[this.stack.length-1];if(this.data.inReference){const ve=this.data.referenceType||"shortcut";fe.type+="Reference",fe.referenceType=ve,delete fe.url,delete fe.title}else delete fe.identifier,delete fe.label;this.data.referenceType=void 0}function R(fe){const ve=this.sliceSerialize(fe),He=this.stack[this.stack.length-2];He.label=c9(ve),He.identifier=Gl(ve).toLowerCase()}function B(){const fe=this.stack[this.stack.length-1],ve=this.resume(),He=this.stack[this.stack.length-1];if(this.data.inReference=!0,He.type==="link"){const Ge=fe.children;He.children=Ge}else He.alt=ve}function _(){const fe=this.resume(),ve=this.stack[this.stack.length-1];ve.url=fe}function X(){const fe=this.resume(),ve=this.stack[this.stack.length-1];ve.title=fe}function z(){this.data.inReference=void 0}function T(){this.data.referenceType="collapsed"}function Z(fe){const ve=this.resume(),He=this.stack[this.stack.length-1];He.label=ve,He.identifier=Gl(this.sliceSerialize(fe)).toLowerCase(),this.data.referenceType="full"}function ae(fe){this.data.characterReferenceType=fe.type}function J(fe){const ve=this.sliceSerialize(fe),He=this.data.characterReferenceType;let Ge;He?(Ge=LI(ve,He==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ge=fk(ve);const je=this.stack[this.stack.length-1];je.value+=Ge}function se(fe){const ve=this.stack.pop();ve.position.end=wo(fe.end)}function ee(fe){H.call(this,fe);const ve=this.stack[this.stack.length-1];ve.url=this.sliceSerialize(fe)}function re(fe){H.call(this,fe);const ve=this.stack[this.stack.length-1];ve.url="mailto:"+this.sliceSerialize(fe)}function ne(){return{type:"blockquote",children:[]}}function ue(){return{type:"code",lang:null,meta:null,value:""}}function de(){return{type:"inlineCode",value:""}}function xe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ze(){return{type:"emphasis",children:[]}}function Te(){return{type:"heading",depth:0,children:[]}}function Le(){return{type:"break"}}function nt(){return{type:"html",value:""}}function wt(){return{type:"image",title:null,url:"",alt:null}}function mt(){return{type:"link",title:null,url:"",children:[]}}function Re(fe){return{type:"list",ordered:fe.type==="listOrdered",start:null,spread:fe._spread,children:[]}}function it(fe){return{type:"listItem",spread:fe._spread,checked:null,children:[]}}function Nt(){return{type:"paragraph",children:[]}}function qt(){return{type:"strong",children:[]}}function Zt(){return{type:"text",value:""}}function rt(){return{type:"thematicBreak"}}}function wo(e){return{line:e.line,column:e.column,offset:e.offset}}function qI(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?qI(e,r):p9(e,r)}}function p9(e,t){let n;for(n in t)if(UI.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function Dj(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ou({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ou({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ou({start:t.start,end:t.end})+") is still open")}function h9(e){const t=this;t.parser=n;function n(r){return d9(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function m9(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function g9(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
70
|
-
`}]}function y9(e,t){const n=t.value?t.value+`
|
|
71
|
-
`:"",r={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(r.className=["language-"+s[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function x9(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function w9(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function b9(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=kc(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let a,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=i+1,l+=1,e.footnoteCounts.set(r,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function k9(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function v9(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function YI(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const s=e.all(t),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const a=s[s.length-1];return a&&a.type==="text"?a.value+=r:s.push({type:"text",value:r}),s}function S9(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return YI(e,t);const s={src:kc(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,i),e.applyData(t,i)}function N9(e,t){const n={src:kc(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function j9(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function C9(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return YI(e,t);const s={href:kc(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function _9(e,t){const n={href:kc(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function E9(e,t,n){const r=e.all(t),s=n?A9(n):GI(t),i={},a=[];if(typeof t.checked=="boolean"){const f=r[0];let d;f&&f.type==="element"&&f.tagName==="p"?d=f:(d={type:"element",tagName:"p",properties:{},children:[]},r.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const f=r[l];(s||l!==0||f.type!=="element"||f.tagName!=="p")&&a.push({type:"text",value:`
|
|
72
|
-
`}),f.type==="element"&&f.tagName==="p"&&!s?a.push(...f.children):a.push(f)}const c=r[r.length-1];c&&(s||c.type!=="element"||c.tagName!=="p")&&a.push({type:"text",value:`
|
|
73
|
-
`});const u={type:"element",tagName:"li",properties:i,children:a};return e.patch(t,u),e.applyData(t,u)}function A9(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=GI(n[r])}return t}function GI(e){const t=e.spread;return t??e.children.length>1}function P9(e,t){const n={},r=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<r.length;){const a=r[s];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function I9(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function R9(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function T9(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function M9(e,t){const n=e.all(t),r=n.shift(),s=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],a),s.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=lk(t.children[1]),c=AI(t.children[t.children.length-1]);l&&c&&(a.position={start:l,end:c}),s.push(a)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function $9(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,l=a?a.length:t.children.length;let c=-1;const u=[];for(;++c<l;){const d=t.children[c],p={},h=a?a[c]:void 0;h&&(p.align=h);let g={type:"element",tagName:i,properties:p,children:[]};d&&(g.children=e.all(d),e.patch(d,g),g=e.applyData(d,g)),u.push(g)}const f={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,f),e.applyData(t,f)}function L9(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Fj=9,zj=32;function O9(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const i=[];for(;r;)i.push(Bj(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(Bj(t.slice(s),s>0,!1)),i.join("")}function Bj(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===Fj||i===zj;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===Fj||i===zj;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function D9(e,t){const n={type:"text",value:O9(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function F9(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const z9={blockquote:m9,break:g9,code:y9,delete:x9,emphasis:w9,footnoteReference:b9,heading:k9,html:v9,imageReference:S9,image:N9,inlineCode:j9,linkReference:C9,link:_9,listItem:E9,list:P9,paragraph:I9,root:R9,strong:T9,table:M9,tableCell:L9,tableRow:$9,text:D9,thematicBreak:F9,toml:tp,yaml:tp,definition:tp,footnoteDefinition:tp};function tp(){}const JI=-1,Pm=0,Fu=1,Ah=2,mk=3,gk=4,yk=5,xk=6,XI=7,QI=8,Hj=typeof self=="object"?self:globalThis,B9=(e,t)=>{const n=(s,i)=>(e.set(i,s),s),r=s=>{if(e.has(s))return e.get(s);const[i,a]=t[s];switch(i){case Pm:case JI:return n(a,s);case Fu:{const l=n([],s);for(const c of a)l.push(r(c));return l}case Ah:{const l=n({},s);for(const[c,u]of a)l[r(c)]=r(u);return l}case mk:return n(new Date(a),s);case gk:{const{source:l,flags:c}=a;return n(new RegExp(l,c),s)}case yk:{const l=n(new Map,s);for(const[c,u]of a)l.set(r(c),r(u));return l}case xk:{const l=n(new Set,s);for(const c of a)l.add(r(c));return l}case XI:{const{name:l,message:c}=a;return n(new Hj[l](c),s)}case QI:return n(BigInt(a),s);case"BigInt":return n(Object(BigInt(a)),s);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:l}=new Uint8Array(a);return n(new DataView(l),a)}}return n(new Hj[i](a),s)};return r},Wj=e=>B9(new Map,e)(0),ml="",{toString:H9}={},{keys:W9}=Object,au=e=>{const t=typeof e;if(t!=="object"||!e)return[Pm,t];const n=H9.call(e).slice(8,-1);switch(n){case"Array":return[Fu,ml];case"Object":return[Ah,ml];case"Date":return[mk,ml];case"RegExp":return[gk,ml];case"Map":return[yk,ml];case"Set":return[xk,ml];case"DataView":return[Fu,n]}return n.includes("Array")?[Fu,n]:n.includes("Error")?[XI,n]:[Ah,n]},np=([e,t])=>e===Pm&&(t==="function"||t==="symbol"),V9=(e,t,n,r)=>{const s=(a,l)=>{const c=r.push(a)-1;return n.set(l,c),c},i=a=>{if(n.has(a))return n.get(a);let[l,c]=au(a);switch(l){case Pm:{let f=a;switch(c){case"bigint":l=QI,f=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);f=null;break;case"undefined":return s([JI],a)}return s([l,f],a)}case Fu:{if(c){let p=a;return c==="DataView"?p=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(p=new Uint8Array(a)),s([c,[...p]],a)}const f=[],d=s([l,f],a);for(const p of a)f.push(i(p));return d}case Ah:{if(c)switch(c){case"BigInt":return s([c,a.toString()],a);case"Boolean":case"Number":case"String":return s([c,a.valueOf()],a)}if(t&&"toJSON"in a)return i(a.toJSON());const f=[],d=s([l,f],a);for(const p of W9(a))(e||!np(au(a[p])))&&f.push([i(p),i(a[p])]);return d}case mk:return s([l,a.toISOString()],a);case gk:{const{source:f,flags:d}=a;return s([l,{source:f,flags:d}],a)}case yk:{const f=[],d=s([l,f],a);for(const[p,h]of a)(e||!(np(au(p))||np(au(h))))&&f.push([i(p),i(h)]);return d}case xk:{const f=[],d=s([l,f],a);for(const p of a)(e||!np(au(p)))&&f.push(i(p));return d}}const{message:u}=a;return s([l,{name:c,message:u}],a)};return i},Vj=(e,{json:t,lossy:n}={})=>{const r=[];return V9(!(t||n),!!t,new Map,r)(e),r},Ph=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Wj(Vj(e,t)):structuredClone(e):(e,t)=>Wj(Vj(e,t));function K9(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function U9(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function q9(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||K9,r=e.options.footnoteBackLabel||U9,s=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[c]);if(!u)continue;const f=e.all(u),d=String(u.identifier).toUpperCase(),p=kc(d.toLowerCase());let h=0;const g=[],k=e.footnoteCounts.get(d);for(;k!==void 0&&++h<=k;){g.length>0&&g.push({type:"text",value:" "});let v=typeof n=="string"?n:n(c,h);typeof v=="string"&&(v={type:"text",value:v}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+p+(h>1?"-"+h:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,h),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const w=f[f.length-1];if(w&&w.type==="element"&&w.tagName==="p"){const v=w.children[w.children.length-1];v&&v.type==="text"?v.value+=" ":w.children.push({type:"text",value:" "}),w.children.push(...g)}else f.push(...g);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+p},children:e.wrap(f,!0)};e.patch(u,y),l.push(y)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Ph(a),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
|
|
74
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
|
|
75
|
-
`}]}}const ZI=function(e){if(e==null)return X9;if(typeof e=="function")return Im(e);if(typeof e=="object")return Array.isArray(e)?Y9(e):G9(e);if(typeof e=="string")return J9(e);throw new Error("Expected function, string, or object as test")};function Y9(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=ZI(e[n]);return Im(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function G9(e){const t=e;return Im(n);function n(r){const s=r;let i;for(i in e)if(s[i]!==t[i])return!1;return!0}}function J9(e){return Im(t);function t(n){return n&&n.type===e}}function Im(e){return t;function t(n,r,s){return!!(Q9(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function X9(){return!0}function Q9(e){return e!==null&&typeof e=="object"&&"type"in e}const eR=[],Z9=!0,Kj=!1,eV="skip";function tV(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const i=ZI(s),a=r?-1:1;l(e,void 0,[])();function l(c,u,f){const d=c&&typeof c=="object"?c:{};if(typeof d.type=="string"){const h=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(c.type+(h?"<"+h+">":""))+")"})}return p;function p(){let h=eR,g,k,w;if((!t||i(c,u,f[f.length-1]||void 0))&&(h=nV(n(c,f)),h[0]===Kj))return h;if("children"in c&&c.children){const y=c;if(y.children&&h[0]!==eV)for(k=(r?y.children.length:-1)+a,w=f.concat(y);k>-1&&k<y.children.length;){const v=y.children[k];if(g=l(v,k,w)(),g[0]===Kj)return g;k=typeof g[1]=="number"?g[1]:k+a}}return h}}}function nV(e){return Array.isArray(e)?e:typeof e=="number"?[Z9,e]:e==null?eR:[e]}function tR(e,t,n,r){let s,i,a;typeof t=="function"&&typeof n!="function"?(i=void 0,a=t,s=n):(i=t,a=n,s=r),tV(e,i,l,s);function l(c,u){const f=u[u.length-1],d=f?f.children.indexOf(c):void 0;return a(c,d,f)}}const yw={}.hasOwnProperty,rV={};function sV(e,t){const n=t||rV,r=new Map,s=new Map,i=new Map,a={...z9,...n.handlers},l={all:u,applyData:oV,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:a,one:c,options:n,patch:iV,wrap:lV};return tR(e,function(f){if(f.type==="definition"||f.type==="footnoteDefinition"){const d=f.type==="definition"?r:s,p=String(f.identifier).toUpperCase();d.has(p)||d.set(p,f)}}),l;function c(f,d){const p=f.type,h=l.handlers[p];if(yw.call(l.handlers,p)&&h)return h(l,f,d);if(l.options.passThrough&&l.options.passThrough.includes(p)){if("children"in f){const{children:k,...w}=f,y=Ph(w);return y.children=l.all(f),y}return Ph(f)}return(l.options.unknownHandler||aV)(l,f,d)}function u(f){const d=[];if("children"in f){const p=f.children;let h=-1;for(;++h<p.length;){const g=l.one(p[h],f);if(g){if(h&&p[h-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=Uj(g.value)),!Array.isArray(g)&&g.type==="element")){const k=g.children[0];k&&k.type==="text"&&(k.value=Uj(k.value))}Array.isArray(g)?d.push(...g):d.push(g)}}}return d}}function iV(e,t){e.position&&(t.position=HW(e))}function oV(e,t){let n=t;if(e&&e.data){const r=e.data.hName,s=e.data.hChildren,i=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const a="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:a}}n.type==="element"&&i&&Object.assign(n.properties,Ph(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function aV(e,t){const n=t.data||{},r="value"in t&&!(yw.call(n,"hProperties")||yw.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function lV(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
76
|
-
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
77
|
-
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
78
|
-
`}),n}function Uj(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function qj(e,t){const n=sV(e,t),r=n.one(e,void 0),s=q9(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
|
|
79
|
-
`},s),i}function cV(e,t){return e&&"run"in e?async function(n,r){const s=qj(n,{file:r,...t});await e.run(s,r)}:function(n,r){return qj(n,{file:r,...e||t})}}function Yj(e){if(e)throw e}var zp=Object.prototype.hasOwnProperty,nR=Object.prototype.toString,Gj=Object.defineProperty,Jj=Object.getOwnPropertyDescriptor,Xj=function(t){return typeof Array.isArray=="function"?Array.isArray(t):nR.call(t)==="[object Array]"},Qj=function(t){if(!t||nR.call(t)!=="[object Object]")return!1;var n=zp.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&zp.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||zp.call(t,s)},Zj=function(t,n){Gj&&n.name==="__proto__"?Gj(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},e1=function(t,n){if(n==="__proto__")if(zp.call(t,n)){if(Jj)return Jj(t,n).value}else return;return t[n]},uV=function e(){var t,n,r,s,i,a,l=arguments[0],c=1,u=arguments.length,f=!1;for(typeof l=="boolean"&&(f=l,l=arguments[1]||{},c=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});c<u;++c)if(t=arguments[c],t!=null)for(n in t)r=e1(l,n),s=e1(t,n),l!==s&&(f&&s&&(Qj(s)||(i=Xj(s)))?(i?(i=!1,a=r&&Xj(r)?r:[]):a=r&&Qj(r)?r:{},Zj(l,{name:n,newValue:e(f,a,s)})):typeof s<"u"&&Zj(l,{name:n,newValue:s}));return l};const gy=qo(uV);function xw(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function dV(){const e=[],t={run:n,use:r};return t;function n(...s){let i=-1;const a=s.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);l(null,...s);function l(c,...u){const f=e[++i];let d=-1;if(c){a(c);return}for(;++d<s.length;)(u[d]===null||u[d]===void 0)&&(u[d]=s[d]);s=u,f?fV(f,l)(...u):a(null,...u)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function fV(e,t){let n;return r;function r(...a){const l=e.length>a.length;let c;l&&a.push(s);try{c=e.apply(this,a)}catch(u){const f=u;if(l&&n)throw f;return s(f)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,s):c instanceof Error?s(c):i(c))}function s(a,...l){n||(n=!0,t(a,...l))}function i(a){s(null,a)}}const ai={basename:pV,dirname:hV,extname:mV,join:gV,sep:"/"};function pV(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Wd(e);let n=0,r=-1,s=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,l=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else a<0&&(i=!0,a=s+1),l>-1&&(e.codePointAt(s)===t.codePointAt(l--)?l<0&&(r=s):(l=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function hV(e){if(Wd(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function mV(e){Wd(e);let t=e.length,n=-1,r=0,s=-1,i=0,a;for(;t--;){const l=e.codePointAt(t);if(l===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),l===46?s<0?s=t:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function gV(...e){let t=-1,n;for(;++t<e.length;)Wd(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":yV(n)}function yV(e){Wd(e);const t=e.codePointAt(0)===47;let n=xV(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function xV(e,t){let n="",r=0,s=-1,i=0,a=-1,l,c;for(;++a<=e.length;){if(a<e.length)l=e.codePointAt(a);else{if(l===47)break;l=47}if(l===47){if(!(s===a-1||i===1))if(s!==a-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),s=a,i=0;continue}}else if(n.length>0){n="",r=0,s=a,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,a):n=e.slice(s+1,a),r=a-s-1;s=a,i=0}else l===46&&i>-1?i++:i=-1}return n}function Wd(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const wV={cwd:bV};function bV(){return"/"}function ww(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function kV(e){if(typeof e=="string")e=new URL(e);else if(!ww(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return vV(e)}function vV(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const yy=["history","path","basename","stem","extname","dirname"];class rR{constructor(t){let n;t?ww(t)?n={path:t}:typeof t=="string"||SV(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":wV.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<yy.length;){const i=yy[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let s;for(s in n)yy.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?ai.basename(this.path):void 0}set basename(t){wy(t,"basename"),xy(t,"basename"),this.path=ai.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?ai.dirname(this.path):void 0}set dirname(t){t1(this.basename,"dirname"),this.path=ai.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?ai.extname(this.path):void 0}set extname(t){if(xy(t,"extname"),t1(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ai.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){ww(t)&&(t=kV(t)),wy(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?ai.basename(this.path,this.extname):void 0}set stem(t){wy(t,"stem"),xy(t,"stem"),this.path=ai.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const s=this.message(t,n,r);throw s.fatal=!0,s}info(t,n,r){const s=this.message(t,n,r);return s.fatal=void 0,s}message(t,n,r){const s=new kr(t,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function xy(e,t){if(e&&e.includes(ai.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ai.sep+"`")}function wy(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function t1(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function SV(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const NV=function(e){const r=this.constructor.prototype,s=r[e],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},jV={}.hasOwnProperty;class wk extends NV{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=dV()}copy(){const t=new wk;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(gy(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(vy("data",this.frozen),this.namespace[t]=n,this):jV.call(this.namespace,t)&&this.namespace[t]||void 0:t?(vy("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const s=n.call(t,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=rp(t),r=this.parser||this.Parser;return by("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),by("process",this.parser||this.Parser),ky("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,a){const l=rp(t),c=r.parse(l);r.run(c,l,function(f,d,p){if(f||!d||!p)return u(f);const h=d,g=r.stringify(h,p);EV(g)?p.value=g:p.result=g,u(f,p)});function u(f,d){f||!d?a(f):i?i(d):n(void 0,d)}}}processSync(t){let n=!1,r;return this.freeze(),by("processSync",this.parser||this.Parser),ky("processSync",this.compiler||this.Compiler),this.process(t,s),r1("processSync","process",n),r;function s(i,a){n=!0,Yj(i),r=a}}run(t,n,r){n1(t),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(a,l){const c=rp(n);s.run(t,c,u);function u(f,d,p){const h=d||t;f?l(f):a?a(h):r(void 0,h,p)}}}runSync(t,n){let r=!1,s;return this.run(t,n,i),r1("runSync","run",r),s;function i(a,l){Yj(a),s=l,r=!0}}stringify(t,n){this.freeze();const r=rp(n),s=this.compiler||this.Compiler;return ky("stringify",s),n1(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(vy("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):a(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[f,...d]=u;c(f,d)}else a(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function a(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(u.plugins),u.settings&&(s.settings=gy(!0,s.settings,u.settings))}function l(u){let f=-1;if(u!=null)if(Array.isArray(u))for(;++f<u.length;){const d=u[f];i(d)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,f){let d=-1,p=-1;for(;++d<r.length;)if(r[d][0]===u){p=d;break}if(p===-1)r.push([u,...f]);else if(f.length>0){let[h,...g]=f;const k=r[p][1];xw(k)&&xw(h)&&(h=gy(!0,k,h)),r[p]=[u,h,...g]}}}}const CV=new wk().freeze();function by(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function ky(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function vy(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function n1(e){if(!xw(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function r1(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function rp(e){return _V(e)?e:new rR(e)}function _V(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function EV(e){return typeof e=="string"||AV(e)}function AV(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const PV="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",s1=[],i1={allowDangerousHtml:!0},IV=/^(https?|ircs?|mailto|xmpp)$/i,RV=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function sR(e){const t=TV(e),n=MV(e);return $V(t.runSync(t.parse(n),n),e)}function TV(e){const t=e.rehypePlugins||s1,n=e.remarkPlugins||s1,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...i1}:i1;return CV().use(h9).use(n).use(cV,r).use(t)}function MV(e){const t=e.children||"",n=new rR;return typeof t=="string"&&(n.value=t),n}function $V(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,a=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||LV;for(const f of RV)Object.hasOwn(t,f.from)&&(""+f.from+(f.to?"use `"+f.to+"` instead":"remove it")+PV+f.id,void 0);return tR(e,u),qW(e,{Fragment:o.Fragment,components:s,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function u(f,d,p){if(f.type==="raw"&&p&&typeof d=="number")return a?p.children.splice(d,1):p.children[d]={type:"text",value:f.value},d;if(f.type==="element"){let h;for(h in py)if(Object.hasOwn(py,h)&&Object.hasOwn(f.properties,h)){const g=f.properties[h],k=py[h];(k===null||k.includes(f.tagName))&&(f.properties[h]=c(String(g||""),h,f))}}if(f.type==="element"){let h=n?!n.includes(f.tagName):i?i.includes(f.tagName):!1;if(!h&&r&&typeof d=="number"&&(h=!r(f,d,p)),h&&p&&typeof d=="number")return l&&f.children?p.children.splice(d,1,...f.children):p.children.splice(d,1),d}}}function LV(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||r!==-1&&t>r||IV.test(e.slice(0,t))?e:""}const OV=new Set(["echarts"]),DV=new Set(["line","bar","pie","scatter","radar","heatmap","tree","treemap","sunburst","sankey","graph","gauge","funnel"]),FV=new Set(["onclick","ondblclick","onmousedown","onmouseup","onmouseover","onmouseout","onmousemove","onmouseenter","onmouseleave","oncontextmenu","onkeydown","onkeyup","onkeypress","onload","onerror"]),zV=["#7c9cff","#a8e66f","#ffcf5c","#68d8d6","#ff8fb3","#b79cff","#f59e73","#8bd17c"];function Fo(e){return e&&typeof e=="object"&&!Array.isArray(e)}function Oa(e,t){if(!Fo(e))return{...t};const n={...e};for(const[r,s]of Object.entries(t))n[r]==null?n[r]=s:Fo(n[r])&&Fo(s)&&(n[r]=Oa(n[r],s));return n}function Rm(e,t){return e==null?e:Array.isArray(e)?e.map(n=>Fo(n)?Oa(n,t):n):Fo(e)?Oa(e,t):e}function BV(e){let t=String(e||"").trim();if(!t)return"";const n=t.match(/```(?:json|chart|echarts)?\s*\n?([\s\S]*?)```/i);if(n!=null&&n[1])t=n[1].trim();else{const r=t.indexOf("{"),s=t.lastIndexOf("}");r>=0&&s>r&&(t=t.slice(r,s+1).trim())}return t.replace(/^json\s*\n/i,"").trim()}function bw(e,t="$"){if(e!=null){if(typeof e=="string"){if(/<\s*(script|iframe|object|embed|link|meta)\b/i.test(e))throw new Error(`${t} contains unsafe HTML`);if(/\bjavascript\s*:/i.test(e)||/\bdata\s*:\s*text\/html/i.test(e))throw new Error(`${t} contains unsafe URL text`);return}if(Array.isArray(e)){e.forEach((n,r)=>bw(n,`${t}[${r}]`));return}if(typeof e=="object")for(const[n,r]of Object.entries(e)){if(/^on[A-Z]/.test(n)||FV.has(n.toLowerCase()))throw new Error(`${t}.${n} is not allowed`);bw(r,`${t}.${n}`)}}}function HV(e){const t=Array.isArray(e)?e:[e].filter(Boolean);if(!t.length)throw new Error("option.series is required");for(const n of t){const r=String((n==null?void 0:n.type)||"").trim();if(!DV.has(r))throw new Error(`series.type "${r||"(empty)"}" is not allowed`)}return t}function WV(e){const t={trigger:"item",renderMode:"richText",backgroundColor:"rgba(20, 22, 28, 0.96)",borderColor:"rgba(124, 156, 255, 0.28)",textStyle:{color:"rgba(255, 255, 255, 0.92)"}};return!e||typeof e!="object"||Array.isArray(e)?t:Oa(e,t)}function VV(e,t){const n={left:"center",top:12,textStyle:{color:"rgba(255, 255, 255, 0.9)",fontSize:15,fontWeight:700},subtextStyle:{color:"rgba(255, 255, 255, 0.52)"}};return Array.isArray(e)?e.map((r,s)=>{if(!Fo(r))return r;const i=s===0&&t&&r.text==null?{...r,text:t}:r;return Oa(i,n)}):Fo(e)?Oa(t&&e.text==null?{...e,text:t}:e,n):t?{...n,text:t}:e}function KV(e,t){const n={top:t?42:14,textStyle:{color:"rgba(255, 255, 255, 0.72)"},itemGap:14};return e==null?e:Rm(e,n)}function o1(e,t="rgba(255, 255, 255, 0.62)"){return Rm(e,{nameTextStyle:{color:t},axisLabel:{color:"rgba(255, 255, 255, 0.58)"},axisLine:{lineStyle:{color:"rgba(255, 255, 255, 0.22)"}},axisTick:{lineStyle:{color:"rgba(255, 255, 255, 0.18)"}},splitLine:{lineStyle:{color:"rgba(255, 255, 255, 0.12)"}}})}function UV(e,t){const n={left:52,right:42,top:t?78:42,bottom:42,containLabel:!0};return e==null?n:Rm(e,n)}function qV(e){const t={axisName:{color:"rgba(255, 255, 255, 0.68)"},splitLine:{lineStyle:{color:"rgba(255, 255, 255, 0.12)"}},splitArea:{areaStyle:{color:["rgba(255, 255, 255, 0.025)","rgba(255, 255, 255, 0.045)"]}},axisLine:{lineStyle:{color:"rgba(255, 255, 255, 0.16)"}}};return e==null?e:Rm(e,t)}function YV(e,t,n){const r=VV(e.title,n),s=!!(Array.isArray(r)?r:[r]).filter(Boolean).some(a=>Fo(a)&&a.text),i=e.legend!=null&&e.legend!==!1;return{...e,backgroundColor:e.backgroundColor??"transparent",color:e.color??zV,textStyle:Oa(e.textStyle,{color:"rgba(255, 255, 255, 0.78)"}),title:r,tooltip:WV(e.tooltip),legend:KV(e.legend,s),grid:e.xAxis!=null||e.yAxis!=null?UV(e.grid,s||i):e.grid,xAxis:o1(e.xAxis),yAxis:o1(e.yAxis),radar:qV(e.radar),series:t}}function GV(e){const t=BV(e);if(!t)return{ok:!1,error:"No chart content"};try{const n=JSON.parse(t);if(!n||typeof n!="object"||Array.isArray(n))throw new Error("ChartSpec must be a JSON object");if(n.type!=="chart")throw new Error('type must be "chart"');if(n.version!=="1.0")throw new Error('version must be "1.0"');if(!OV.has(n.renderer))throw new Error('renderer must be "echarts"');if(!n.option||typeof n.option!="object"||Array.isArray(n.option))throw new Error("option must be an ECharts option object");bw(n);const r=HV(n.option.series),s=n.title==null?"":String(n.title),i=YV(n.option,r,s);return{ok:!0,spec:{...n,title:s,option:i}}}catch(n){return{ok:!1,error:String((n==null?void 0:n.message)||n)}}}function sp(e,t){let n=0;for(let r=t-1;r>=0&&e[r]==="\\";r-=1)n+=1;return n%2===1}function JV(e,t){let n=t;for(;n<e.length&&e[n]==="`";)n+=1;return n-t}function Wi(e){let t=String(e||"").trim();if(!t.includes("|"))return[];t.startsWith("|")&&(t=t.slice(1)),t.endsWith("|")&&!sp(t,t.length-1)&&(t=t.slice(0,-1));const n=[];let r="",s=0;for(let i=0;i<t.length;i+=1){const a=t[i];if(a==="`"&&!sp(t,i)){const l=JV(t,i);r+=t.slice(i,i+l),s===0?s=l:s===l&&(s=0),i+=l-1;continue}if(s===0&&a==="|"&&!sp(t,i)){n.push(r.trim()),r="";continue}if(s===0&&a==="\\"&&t[i+1]==="|"&&sp(t,i+1)){r+="|",i+=1;continue}r+=a}return n.push(r.trim()),n}function iR(e,t){if(!t)return e;const n=e.slice(0,t);for(e.length>t&&(n[t-1]=[e[t-1],...e.slice(t)].filter(Boolean).join(" | "));n.length<t;)n.push("");return n}function oR(e){const t=Wi(e);return t.length>1&&t.every(n=>/^:?-{3,}:?$/.test(n))}function aR(e){return Wi(e).map(t=>t.startsWith(":")&&t.endsWith(":")?"center":t.endsWith(":")?"right":"left")}function XV(e){return/^\s*(sequenceDiagram|flowchart\s+(?:TD|TB|BT|LR|RL)|graph\s+(?:TD|TB|BT|LR|RL))\b/i.test(String(e||""))}function QV(e){const t=String(e||"").split(/\r?\n/).map(l=>l.replace(/%%.*$/,"").trim()).filter(Boolean),n=new Map,r=[];let s="TD";const i=(l,c="")=>{const u=String(l||"").replace(/[^A-Za-z0-9_]/g,"_")||`N${n.size+1}`;return n.has(u)?c&&(n.get(u).label=c):n.set(u,{id:u,label:c||u}),u},a=l=>{const c=String(l||"").trim().replace(/[;,]+$/,""),u=c.match(/^([A-Za-z][A-Za-z0-9_]*)(?:\[(.+?)\]|\((.+?)\)|\{(.+?)\})?$/);return u?i(u[1],u[2]||u[3]||u[4]||u[1]):i(c.replace(/[^A-Za-z0-9_]/g,"_"),c)};for(const l of t){const c=l.match(/^(graph|flowchart)\s+(TD|TB|BT|LR|RL)\b/i);if(c){s=c[2].toUpperCase();continue}const u=l.match(/^(.+?)\s*-{1,2}>+\s*(.+)$/);if(u){r.push({from:a(u[1]),to:a(u[2])});continue}a(l)}return{nodes:Array.from(n.values()),edges:r,direction:s}}function ZV({code:e}){const t=m.useMemo(()=>QV(e),[e]),n=t.direction==="LR"||t.direction==="RL",r=150,s=46,i=n?102:38,a=n?34:72,l=new Map;t.nodes.forEach((f,d)=>{l.set(f.id,{x:28+(n?d*(r+i):d%3*(r+i)),y:28+(n?d%3*(s+a):d*(s+a))})});const c=Math.max(520,...Array.from(l.values()).map(f=>f.x+r+28)),u=Math.max(220,...Array.from(l.values()).map(f=>f.y+s+28));return o.jsxs("svg",{viewBox:`0 0 ${c} ${u}`,role:"img","aria-label":"Mermaid flowchart preview",children:[o.jsx("defs",{children:o.jsx("marker",{id:"af-md-mermaid-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:o.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z"})})}),t.edges.map((f,d)=>{const p=l.get(f.from),h=l.get(f.to);if(!p||!h)return null;const g=n?`M ${p.x+r} ${p.y+s/2} C ${(p.x+h.x+r)/2} ${p.y+s/2}, ${(p.x+h.x+r)/2} ${h.y+s/2}, ${h.x} ${h.y+s/2}`:`M ${p.x+r/2} ${p.y+s} C ${p.x+r/2} ${p.y+s+28}, ${h.x+r/2} ${h.y-28}, ${h.x+r/2} ${h.y}`;return o.jsx("path",{className:"af-md-mermaid-edge",d:g,markerEnd:"url(#af-md-mermaid-arrow)"},`${f.from}-${f.to}-${d}`)}),t.nodes.map(f=>{const d=l.get(f.id);return o.jsxs("g",{children:[o.jsx("rect",{className:"af-md-mermaid-box",x:d.x,y:d.y,width:r,height:s,rx:"8"}),o.jsx("text",{className:"af-md-mermaid-text",x:d.x+r/2,y:d.y+s/2+5,textAnchor:"middle",children:f.label.slice(0,24)})]},f.id)})]})}function eK(e){const t=String(e||"").split(/\r?\n/).map(i=>i.replace(/%%.*$/,"").trim()).filter(Boolean),n=new Map,r=[],s=(i,a="")=>{const l=String(i||"").trim();l&&(n.has(l)||n.set(l,a||l))};for(const i of t){if(/^sequenceDiagram\b/i.test(i))continue;const a=i.match(/^(participant|actor)\s+([A-Za-z0-9_]+)(?:\s+as\s+(.+))?$/i);if(a){s(a[2],a[3]||a[2]);continue}const l=i.match(/^([A-Za-z0-9_]+)\s*[-=]+>>\+?\s*([A-Za-z0-9_]+)\s*:\s*(.+)$/);if(l){s(l[1]),s(l[2]),r.push({type:"message",from:l[1],to:l[2],text:l[3]});continue}const c=i.match(/^note\s+(?:over|right of|left of)\s+([^:]+):\s*(.+)$/i);r.push({type:"note",text:c?c[2]:i})}return{participants:Array.from(n,([i,a])=>({id:i,label:a})),rows:r}}function tK({code:e}){const t=m.useMemo(()=>eK(e),[e]),n=t.participants.length?t.participants:[{id:"A",label:"A"},{id:"B",label:"B"}],r=190,s=48,i=26,a=44,l=48,c=Math.max(620,s*2+n.length*r),u=Math.max(220,i+a+Math.max(1,t.rows.length)*l+34),f=d=>{const p=Math.max(0,n.findIndex(h=>h.id===d));return s+p*r+r/2};return o.jsxs("svg",{viewBox:`0 0 ${c} ${u}`,role:"img","aria-label":"Mermaid sequence diagram preview",children:[o.jsx("defs",{children:o.jsx("marker",{id:"af-md-sequence-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:o.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z"})})}),n.map((d,p)=>{const h=s+p*r+r/2;return o.jsxs("g",{children:[o.jsx("rect",{className:"af-md-mermaid-box",x:h-68,y:i,width:"136",height:"34",rx:"8"}),o.jsx("text",{className:"af-md-mermaid-text",x:h,y:i+22,textAnchor:"middle",children:d.label.slice(0,18)}),o.jsx("line",{className:"af-md-sequence-life",x1:h,y1:i+a,x2:h,y2:u-18})]},d.id)}),t.rows.map((d,p)=>{const h=i+a+p*l+24;if(d.type!=="message")return o.jsxs("g",{children:[o.jsx("rect",{className:"af-md-sequence-note",x:s,y:h-17,width:c-s*2,height:"30",rx:"7"}),o.jsx("text",{className:"af-md-mermaid-text",x:s+12,y:h+4,children:d.text.slice(0,120)})]},`note-${p}`);const g=f(d.from),k=f(d.to),w=(g+k)/2;return o.jsxs("g",{children:[o.jsx("line",{className:"af-md-mermaid-edge",x1:g,y1:h,x2:k,y2:h,markerEnd:"url(#af-md-sequence-arrow)"}),o.jsx("text",{className:"af-md-sequence-label",x:w,y:h-8,textAnchor:"middle",children:d.text.slice(0,72)})]},`msg-${p}`)})]})}function lR({code:e}){const t=String(e||"").trim();if(!t)return null;const n=/^sequenceDiagram\b/i.test(t);return o.jsx("div",{className:"af-md-mermaid-preview",children:n?o.jsx(tK,{code:t}):o.jsx(ZV,{code:t})})}function nK(e){const t=String(e||"").replace(/\r\n/g,`
|
|
80
|
-
`).split(`
|
|
81
|
-
`),n=[];let r=[],s=!1;const i=()=>{r.length&&(n.push({type:"markdown",text:r.join(`
|
|
82
|
-
`)}),r=[])};for(let a=0;a<t.length;){const l=t[a]||"",c=l.match(/^\s*```\s*(mermaid|mmd)\s*$/i);if(!s&&c){i();const u=[];for(a++;a<t.length&&!/^\s*```\s*$/.test(t[a]||"");)u.push(t[a]||""),a++;a<t.length&&a++,n.push({type:"mermaid",text:u.join(`
|
|
83
|
-
`)});continue}if(!s&&XV(l)){i();const u=[];for(;a<t.length;){const f=t[a]||"";if(u.length>0&&(!f.trim()||/^-{3,}\s*$/.test(f)||/^#{1,6}\s+/.test(f)))break;u.push(f),a++}n.push({type:"mermaid",text:u.join(`
|
|
84
|
-
`)});continue}if(/^\s*```/.test(l)){s=!s,r.push(l),a++;continue}if(!s&&a+1<t.length&&Wi(l).length>1&&oR(t[a+1])){i();const u=Wi(l),f=aR(t[a+1]),d=[];for(a+=2;a<t.length&&t[a].trim()&&Wi(t[a]).length>1;)d.push(iR(Wi(t[a]),u.length)),a++;n.push({type:"table",headers:u,align:f,rows:d});continue}r.push(l),a++}return i(),n}function a1(e,t=""){const n=String(e||"").trim();if(!n||/^(?:https?:|data:|blob:|file:|javascript:|mailto:|tel:)/i.test(n)||n.startsWith("/")||n.startsWith("#")||!t||n.startsWith("outputs/"))return n;const r=String(t||"").split("/").filter(Boolean);r.pop();const s=[...r,...n.split("/")].filter(Boolean),i=[];for(const a of s)if(a!=="."){if(a===".."){if(i.length===0)return n;i.pop();continue}i.push(a)}return i.join("/")}function cR(e){const t=String(e||"").replace(/\r\n/g,`
|
|
85
|
-
`).split(`
|
|
86
|
-
`);let n=!1;return t.map(r=>{if(/^\s*```/.test(r))return n=!n,r;if(n)return r;let s="",i=0,a=!1;for(;i<r.length;){const l=r[i];if(l==="`"){a=!a,s+=l,i+=1;continue}if(!(!a&&/^https?:\/\//i.test(r.slice(i)))){s+=l,i+=1;continue}if((i>0?r[i-1]:"")==="("){s+=l,i+=1;continue}let f=i;for(;f<r.length&&!/\s|<|>/.test(r[f]);)f+=1;let d=r.slice(i,f),p="";for(;/[.,;:!?)}\]]$/.test(d);)p=d.slice(-1)+p,d=d.slice(0,-1);d?s+=`[${d}](${d})${p}`:s+=r.slice(i,f),i=f}return s}).join(`
|
|
87
|
-
`)}function uR(e,t=!1,n=""){const r=i=>{const a=String(i||"").trim();if(!a)return"";if(/^(?:https?:|data:|blob:|file:|javascript:|mailto:|tel:)/i.test(a)||a.startsWith("#"))return a;const l=a1(a,n);return e?e(l,{kind:"link",download:!0}):l},s=(i,a)=>{const l=r(a);!l||l.startsWith("#")||/^(?:javascript):/i.test(l)||(i.stopPropagation(),!(i.defaultPrevented||i.button!==0)&&(i.preventDefault(),window.open(l,"_blank","noopener,noreferrer")))};return{...t?{p:({children:i})=>o.jsx(o.Fragment,{children:i})}:{},code:({inline:i,className:a,children:l})=>{var f;const c=((f=String(a||"").match(/language-(\w+)/i))==null?void 0:f[1])||"",u=String(l||"").replace(/\n$/,"");return!i&&/^(mermaid|mmd)$/i.test(c)?o.jsx(lR,{code:u}):i?o.jsx("code",{className:a,children:l}):o.jsx("code",{className:a,children:l})},img:({src:i,alt:a})=>o.jsx("img",{src:e?e(a1(i,n)):i||"",alt:a||"",loading:"lazy"}),a:({href:i,children:a})=>o.jsx("a",{href:r(i),target:"_blank",rel:"noopener noreferrer",onClick:l=>s(l,i),children:a})}}function l1({children:e,resolveSrc:t,basePath:n=""}){return o.jsx(sR,{components:uR(t,!0,n),children:cR(e)})}function bk({content:e,resolveSrc:t,basePath:n=""}){const r=m.useMemo(()=>nK(e),[e]),s=m.useMemo(()=>uR(t,!1,n),[n,t]);return o.jsx(o.Fragment,{children:r.map((i,a)=>i.type==="mermaid"?o.jsx(lR,{code:i.text},`mermaid-${a}`):i.type!=="table"?o.jsx(sR,{components:s,children:cR(i.text)},`md-${a}`):o.jsx("div",{className:"af-work-display-table-wrap",children:o.jsxs("table",{className:"af-work-display-table",children:[o.jsx("thead",{children:o.jsx("tr",{children:i.headers.map((l,c)=>o.jsx("th",{style:{textAlign:i.align[c]||"left"},children:o.jsx(l1,{resolveSrc:t,basePath:n,children:l})},c))})}),o.jsx("tbody",{children:i.rows.map((l,c)=>o.jsx("tr",{children:i.headers.map((u,f)=>o.jsx("td",{style:{textAlign:i.align[f]||"left"},children:o.jsx(l1,{resolveSrc:t,basePath:n,children:l[f]||""})},f))},c))})]})},`table-${a}`))})}function rK(e,t=","){const n=[];let r=[],s="",i=!1;const a=String(e||"").replace(/\r\n/g,`
|
|
88
|
-
`);for(let l=0;l<a.length;l+=1){const c=a[l],u=a[l+1];if(i){c==='"'&&u==='"'?(s+='"',l+=1):c==='"'?i=!1:s+=c;continue}c==='"'?i=!0:c===t?(r.push(s.trim()),s=""):c===`
|
|
89
|
-
`?(r.push(s.trim()),n.push(r),r=[],s=""):s+=c}return(s||r.length)&&(r.push(s.trim()),n.push(r)),n.filter(l=>l.some(c=>String(c||"").trim()))}function ii(e){if(e==null)return"";if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function sK(e){if(Array.isArray(e)){if(e.every(s=>s&&typeof s=="object"&&!Array.isArray(s))){const s=Array.from(new Set(e.flatMap(i=>Object.keys(i))));return{columns:s.map(i=>({key:i,label:i,align:"left"})),rows:e.map(i=>s.map(a=>ii(i[a])))}}if(e.every(Array.isArray)&&e.length>0){const s=e[0].map((i,a)=>ii(i)||`Column ${a+1}`);return{columns:s.map((i,a)=>({key:String(a),label:i,align:"left"})),rows:e.slice(1).map(i=>s.map((a,l)=>ii(i[l])))}}}if(!e||typeof e!="object")return null;const t=Array.isArray(e.columns)?e.columns:Array.isArray(e.headers)?e.headers:[],n=Array.isArray(e.rows)?e.rows:Array.isArray(e.data)?e.data:[];let r=t.map((s,i)=>s&&typeof s=="object"?{key:String(s.key||s.name||s.field||i),label:String(s.label||s.title||s.name||s.key||`Column ${i+1}`),align:["left","center","right"].includes(s.align)?s.align:"left"}:{key:String(i),label:ii(s)||`Column ${i+1}`,align:"left"});return r.length===0&&n.every(s=>s&&typeof s=="object"&&!Array.isArray(s))&&(r=Array.from(new Set(n.flatMap(s=>Object.keys(s)))).map(s=>({key:s,label:s,align:"left"}))),r.length===0&&n.every(Array.isArray)&&n.length>0?(r=n[0].map((s,i)=>({key:String(i),label:ii(s)||`Column ${i+1}`,align:"left"})),{columns:r,rows:n.slice(1).map(s=>r.map((i,a)=>ii(s[a])))}):{columns:r,rows:n.map(s=>Array.isArray(s)?r.map((i,a)=>ii(s[a])):s&&typeof s=="object"?r.map(i=>ii(s[i.key])):r.map((i,a)=>a===0?ii(s):""))}}function iK(e){const t=String(e||"").trim();if(!t)return{columns:[],rows:[],error:""};const n=t.match(/^```(?:json|table|csv|tsv|markdown|md)?\s*\n?([\s\S]*?)```\s*$/i),r=n?n[1].trim():t;try{const l=sK(JSON.parse(r));if(l&&l.columns.length)return{...l,error:""}}catch{}const s=r.replace(/\r\n/g,`
|
|
90
|
-
`).split(`
|
|
91
|
-
`).filter(l=>l.trim());if(s.length>=2&&Wi(s[0]).length>1&&oR(s[1])){const l=Wi(s[0]),c=aR(s[1]);return{columns:l.map((u,f)=>({key:String(f),label:u,align:c[f]||"left"})),rows:s.slice(2).map(u=>iR(Wi(u),l.length)),error:""}}const i=r.includes(" ")?" ":",",a=rK(r,i);return a.length>0&&a[0].length>1?{columns:a[0].map((c,u)=>c||`Column ${u+1}`).map((c,u)=>({key:String(u),label:c,align:"left"})),rows:a.slice(1),error:""}:{columns:[],rows:[],error:"No table data detected"}}function kk({content:e}){const t=m.useMemo(()=>iK(e),[e]);return t.error||t.columns.length===0?o.jsxs("div",{className:"af-work-display-table-empty",children:[o.jsx("strong",{children:"Table data error"}),o.jsx("span",{children:t.error||"No columns found"})]}):o.jsx("div",{className:"af-work-display-table-wrap af-work-display-table-wrap--standalone",children:o.jsxs("table",{className:"af-work-display-table",children:[o.jsx("thead",{children:o.jsx("tr",{children:t.columns.map((n,r)=>o.jsx("th",{style:{textAlign:n.align||"left"},children:n.label},`${n.key}-${r}`))})}),o.jsx("tbody",{children:t.rows.map((n,r)=>o.jsx("tr",{children:t.columns.map((s,i)=>o.jsx("td",{style:{textAlign:s.align||"left"},children:ii(n[i])},`${s.key}-${i}`))},r))})]})})}function vk({content:e}){const t=m.useRef(null),n=m.useMemo(()=>GV(e),[e]),[r,s]=m.useState({loading:!1,error:""});return m.useEffect(()=>{if(!n.ok){s({loading:!1,error:n.error||"Invalid chart spec"});return}let i=!1,a=null,l=null,c=null;return s({loading:!0,error:""}),J5(()=>import("./index-DgQRkS4v.js"),[]).then(u=>{i||!t.current||(a=u.init(t.current,"dark",{renderer:"canvas"}),a.setOption(n.spec.option,!0),c=()=>a==null?void 0:a.resize(),typeof ResizeObserver<"u"&&(l=new ResizeObserver(c),l.observe(t.current)),window.addEventListener("resize",c),window.requestAnimationFrame(c),i||s({loading:!1,error:""}))}).catch(u=>{i||s({loading:!1,error:String((u==null?void 0:u.message)||u)})}),()=>{var u,f;i=!0,c&&window.removeEventListener("resize",c),(u=l==null?void 0:l.disconnect)==null||u.call(l),(f=a==null?void 0:a.dispose)==null||f.call(a)}},[n]),!n.ok||r.error?o.jsxs("div",{className:"af-work-display-chart-error",children:[o.jsx("strong",{children:"Chart configuration error"}),o.jsx("span",{children:r.error||n.error})]}):o.jsxs("div",{className:"af-work-display-chart",children:[o.jsx("div",{ref:t,className:"af-work-display-chart__canvas"}),r.loading?o.jsx("div",{className:"af-work-display-chart__loading",children:"Loading chart..."}):null]})}/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */function dR(e){return typeof e>"u"||e===null}function oK(e){return typeof e=="object"&&e!==null}function aK(e){return Array.isArray(e)?e:dR(e)?[]:[e]}function lK(e,t){var n,r,s,i;if(t)for(i=Object.keys(t),n=0,r=i.length;n<r;n+=1)s=i[n],e[s]=t[s];return e}function cK(e,t){var n="",r;for(r=0;r<t;r+=1)n+=e;return n}function uK(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var dK=dR,fK=oK,pK=aK,hK=cK,mK=uK,gK=lK,Sk={isNothing:dK,isObject:fK,toArray:pK,repeat:hK,isNegativeZero:mK,extend:gK};function fR(e,t){var n="",r=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(n+=`
|
|
92
|
-
|
|
93
|
-
`+e.mark.snippet),r+" "+n):r}function xd(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=fR(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}xd.prototype=Object.create(Error.prototype);xd.prototype.constructor=xd;xd.prototype.toString=function(t){return this.name+": "+fR(this,t)};var ha=xd,yK=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],xK=["scalar","sequence","mapping"];function wK(e){var t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(r){t[String(r)]=n})}),t}function bK(e,t){if(t=t||{},Object.keys(t).forEach(function(n){if(yK.indexOf(n)===-1)throw new ha('Unknown option "'+n+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(n){return n},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=wK(t.styleAliases||null),xK.indexOf(this.kind)===-1)throw new ha('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var xr=bK;function c1(e,t){var n=[];return e[t].forEach(function(r){var s=n.length;n.forEach(function(i,a){i.tag===r.tag&&i.kind===r.kind&&i.multi===r.multi&&(s=a)}),n[s]=r}),n}function kK(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},t,n;function r(s){s.multi?(e.multi[s.kind].push(s),e.multi.fallback.push(s)):e[s.kind][s.tag]=e.fallback[s.tag]=s}for(t=0,n=arguments.length;t<n;t+=1)arguments[t].forEach(r);return e}function kw(e){return this.extend(e)}kw.prototype.extend=function(t){var n=[],r=[];if(t instanceof xr)r.push(t);else if(Array.isArray(t))r=r.concat(t);else if(t&&(Array.isArray(t.implicit)||Array.isArray(t.explicit)))t.implicit&&(n=n.concat(t.implicit)),t.explicit&&(r=r.concat(t.explicit));else throw new ha("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(i){if(!(i instanceof xr))throw new ha("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(i.loadKind&&i.loadKind!=="scalar")throw new ha("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(i.multi)throw new ha("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),r.forEach(function(i){if(!(i instanceof xr))throw new ha("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var s=Object.create(kw.prototype);return s.implicit=(this.implicit||[]).concat(n),s.explicit=(this.explicit||[]).concat(r),s.compiledImplicit=c1(s,"implicit"),s.compiledExplicit=c1(s,"explicit"),s.compiledTypeMap=kK(s.compiledImplicit,s.compiledExplicit),s};var vK=kw,SK=new xr("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),NK=new xr("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),jK=new xr("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),CK=new vK({explicit:[SK,NK,jK]});function _K(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function EK(){return null}function AK(e){return e===null}var PK=new xr("tag:yaml.org,2002:null",{kind:"scalar",resolve:_K,construct:EK,predicate:AK,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function IK(e){if(e===null)return!1;var t=e.length;return t===4&&(e==="true"||e==="True"||e==="TRUE")||t===5&&(e==="false"||e==="False"||e==="FALSE")}function RK(e){return e==="true"||e==="True"||e==="TRUE"}function TK(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var MK=new xr("tag:yaml.org,2002:bool",{kind:"scalar",resolve:IK,construct:RK,predicate:TK,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function $K(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function LK(e){return 48<=e&&e<=55}function OK(e){return 48<=e&&e<=57}function DK(e){if(e===null)return!1;var t=e.length,n=0,r=!1,s;if(!t)return!1;if(s=e[n],(s==="-"||s==="+")&&(s=e[++n]),s==="0"){if(n+1===t)return!0;if(s=e[++n],s==="b"){for(n++;n<t;n++)if(s=e[n],s!=="_"){if(s!=="0"&&s!=="1")return!1;r=!0}return r&&s!=="_"}if(s==="x"){for(n++;n<t;n++)if(s=e[n],s!=="_"){if(!$K(e.charCodeAt(n)))return!1;r=!0}return r&&s!=="_"}if(s==="o"){for(n++;n<t;n++)if(s=e[n],s!=="_"){if(!LK(e.charCodeAt(n)))return!1;r=!0}return r&&s!=="_"}}if(s==="_")return!1;for(;n<t;n++)if(s=e[n],s!=="_"){if(!OK(e.charCodeAt(n)))return!1;r=!0}return!(!r||s==="_")}function FK(e){var t=e,n=1,r;if(t.indexOf("_")!==-1&&(t=t.replace(/_/g,"")),r=t[0],(r==="-"||r==="+")&&(r==="-"&&(n=-1),t=t.slice(1),r=t[0]),t==="0")return 0;if(r==="0"){if(t[1]==="b")return n*parseInt(t.slice(2),2);if(t[1]==="x")return n*parseInt(t.slice(2),16);if(t[1]==="o")return n*parseInt(t.slice(2),8)}return n*parseInt(t,10)}function zK(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!Sk.isNegativeZero(e)}var BK=new xr("tag:yaml.org,2002:int",{kind:"scalar",resolve:DK,construct:FK,predicate:zK,represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),HK=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function WK(e){return!(e===null||!HK.test(e)||e[e.length-1]==="_")}function VK(e){var t,n;return t=e.replace(/_/g,"").toLowerCase(),n=t[0]==="-"?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),t===".inf"?n===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:t===".nan"?NaN:n*parseFloat(t,10)}var KK=/^[-+]?[0-9]+e/;function UK(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(Sk.isNegativeZero(e))return"-0.0";return n=e.toString(10),KK.test(n)?n.replace("e",".e"):n}function qK(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||Sk.isNegativeZero(e))}var YK=new xr("tag:yaml.org,2002:float",{kind:"scalar",resolve:WK,construct:VK,predicate:qK,represent:UK,defaultStyle:"lowercase"}),GK=CK.extend({implicit:[PK,MK,BK,YK]}),JK=GK,pR=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),hR=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function XK(e){return e===null?!1:pR.exec(e)!==null||hR.exec(e)!==null}function QK(e){var t,n,r,s,i,a,l,c=0,u=null,f,d,p;if(t=pR.exec(e),t===null&&(t=hR.exec(e)),t===null)throw new Error("Date resolve error");if(n=+t[1],r=+t[2]-1,s=+t[3],!t[4])return new Date(Date.UTC(n,r,s));if(i=+t[4],a=+t[5],l=+t[6],t[7]){for(c=t[7].slice(0,3);c.length<3;)c+="0";c=+c}return t[9]&&(f=+t[10],d=+(t[11]||0),u=(f*60+d)*6e4,t[9]==="-"&&(u=-u)),p=new Date(Date.UTC(n,r,s,i,a,l,c)),u&&p.setTime(p.getTime()-u),p}function ZK(e){return e.toISOString()}var e7=new xr("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:XK,construct:QK,instanceOf:Date,represent:ZK});function t7(e){return e==="<<"||e===null}var n7=new xr("tag:yaml.org,2002:merge",{kind:"scalar",resolve:t7}),Nk=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
94
|
-
\r`;function r7(e){if(e===null)return!1;var t,n,r=0,s=e.length,i=Nk;for(n=0;n<s;n++)if(t=i.indexOf(e.charAt(n)),!(t>64)){if(t<0)return!1;r+=6}return r%8===0}function s7(e){var t,n,r=e.replace(/[\r\n=]/g,""),s=r.length,i=Nk,a=0,l=[];for(t=0;t<s;t++)t%4===0&&t&&(l.push(a>>16&255),l.push(a>>8&255),l.push(a&255)),a=a<<6|i.indexOf(r.charAt(t));return n=s%4*6,n===0?(l.push(a>>16&255),l.push(a>>8&255),l.push(a&255)):n===18?(l.push(a>>10&255),l.push(a>>2&255)):n===12&&l.push(a>>4&255),new Uint8Array(l)}function i7(e){var t="",n=0,r,s,i=e.length,a=Nk;for(r=0;r<i;r++)r%3===0&&r&&(t+=a[n>>18&63],t+=a[n>>12&63],t+=a[n>>6&63],t+=a[n&63]),n=(n<<8)+e[r];return s=i%3,s===0?(t+=a[n>>18&63],t+=a[n>>12&63],t+=a[n>>6&63],t+=a[n&63]):s===2?(t+=a[n>>10&63],t+=a[n>>4&63],t+=a[n<<2&63],t+=a[64]):s===1&&(t+=a[n>>2&63],t+=a[n<<4&63],t+=a[64],t+=a[64]),t}function o7(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var a7=new xr("tag:yaml.org,2002:binary",{kind:"scalar",resolve:r7,construct:s7,predicate:o7,represent:i7}),l7=Object.prototype.hasOwnProperty,c7=Object.prototype.toString;function u7(e){if(e===null)return!0;var t=[],n,r,s,i,a,l=e;for(n=0,r=l.length;n<r;n+=1){if(s=l[n],a=!1,c7.call(s)!=="[object Object]")return!1;for(i in s)if(l7.call(s,i))if(!a)a=!0;else return!1;if(!a)return!1;if(t.indexOf(i)===-1)t.push(i);else return!1}return!0}function d7(e){return e!==null?e:[]}var f7=new xr("tag:yaml.org,2002:omap",{kind:"sequence",resolve:u7,construct:d7}),p7=Object.prototype.toString;function h7(e){if(e===null)return!0;var t,n,r,s,i,a=e;for(i=new Array(a.length),t=0,n=a.length;t<n;t+=1){if(r=a[t],p7.call(r)!=="[object Object]"||(s=Object.keys(r),s.length!==1))return!1;i[t]=[s[0],r[s[0]]]}return!0}function m7(e){if(e===null)return[];var t,n,r,s,i,a=e;for(i=new Array(a.length),t=0,n=a.length;t<n;t+=1)r=a[t],s=Object.keys(r),i[t]=[s[0],r[s[0]]];return i}var g7=new xr("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:h7,construct:m7}),y7=Object.prototype.hasOwnProperty;function x7(e){if(e===null)return!0;var t,n=e;for(t in n)if(y7.call(n,t)&&n[t]!==null)return!1;return!0}function w7(e){return e!==null?e:{}}var b7=new xr("tag:yaml.org,2002:set",{kind:"mapping",resolve:x7,construct:w7});JK.extend({implicit:[e7,n7],explicit:[a7,f7,g7,b7]});function u1(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
|
|
95
|
-
`:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"
":e===95?" ":e===76?"\u2028":e===80?"\u2029":""}var k7=new Array(256),v7=new Array(256);for(var gl=0;gl<256;gl++)k7[gl]=u1(gl)?1:0,v7[gl]=u1(gl);const wd=["requirement","planning","code","test","normal"],d1={普通:"normal",技术规划:"planning",代码执行:"code",测试回归:"test",需求拆解:"requirement"};function jk(e,t){var s,i,a,l,c,u,f,d,p,h,g,k,w,y;const n=v=>{const b={type:(v==null?void 0:v.type)??"node",name:(v==null?void 0:v.name)??"",value:(v==null?void 0:v.value)??(v==null?void 0:v.default)??""};return(v==null?void 0:v.required)===!0&&(b.required=!0),(v==null?void 0:v.description)!=null&&String(v.description).trim()&&(b.description=String(v.description)),(v==null?void 0:v.showOnNode)!=null&&(b.showOnNode=!!v.showOnNode),b},r={};for(const v of e){if((s=v==null?void 0:v.data)!=null&&s.isWorkspaceGroup)continue;const b=t[v.id]&&typeof t[v.id]=="object"?{...t[v.id]}:{},C=((i=v.data)==null?void 0:i.definitionId)||v.id,N=((a=v.data)==null?void 0:a.inputs)??[],j=((l=v.data)==null?void 0:l.outputs)??[],A=((c=v.data)==null?void 0:c.role)!=null?String(v.data.role).trim():"",I=b.role!=null?String(b.role).trim():"",D=d1[A]||A,H=d1[I]||I,V=wd.includes(D)?D:wd.includes(H)?H:"normal",F=Array.isArray(N)?N.map(n):Array.isArray(b.input)?b.input.map(ae=>n(ae)):[],L=Array.isArray(j)?j.map(n):Array.isArray(b.output)?b.output.map(ae=>n(ae)):[],M=((u=v.data)==null?void 0:u.label)!=null?String(v.data.label):b.label!=null?String(b.label):v.id,K=(f=v.data)==null?void 0:f.body,W=K!=null?String(K):b.body!=null?String(b.body):"";let $=((d=v.data)==null?void 0:d.model)!=null&&String(v.data.model).trim()!==""?String(v.data.model).trim():b.model!=null&&String(b.model).trim()!==""?String(b.model).trim():void 0;($===""||$==="default")&&($=void 0);const R={...b,definitionId:C,label:M,role:V,model:$,input:F,output:L},B=((p=v.data)==null?void 0:p.marketplaceRef)||b.marketplaceRef;B?R.marketplaceRef=String(B):delete R.marketplaceRef;const _=((h=v.data)==null?void 0:h.marketplacePackageId)||b.marketplacePackageId;_?R.marketplacePackageId=String(_):delete R.marketplacePackageId;const X=((g=v.data)==null?void 0:g.marketplaceVersion)||b.marketplaceVersion;X?R.marketplaceVersion=String(X):delete R.marketplaceVersion,C.startsWith("provide_")||W.trim()===""?delete R.body:R.body=W;const z=Array.isArray((k=v.data)==null?void 0:k.images)?v.data.images:Array.isArray(b.images)?b.images:[];z.length>0?R.images=z:delete R.images;const T=(w=v.data)==null?void 0:w.script,Z=T!=null?String(T):b.script!=null?String(b.script):"";Z.trim()===""?delete R.script:R.script=Z;for(const ae of["scriptRef","implementationRef","implementationMode"]){const J=(y=v.data)==null?void 0:y[ae],se=J!=null?String(J):b[ae]!=null?String(b[ae]):"";se.trim()===""?delete R[ae]:R[ae]=se.trim()}delete R.temperature,delete R.maxTokens,delete R.description,r[v.id]=R}return r}function zu(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function S7(e,t){const n=String(e||"node").replace(/_copy(?:_\d+)?$/i,"");let r=`${n}_copy`,s=2;for(;t.has(r);)r=`${n}_copy_${s}`,s+=1;return t.add(r),r}function N7(e,t,n){const r=(e||[]).filter(a=>a==null?void 0:a.selected);if(r.length===0)return null;const s=new Set(r.map(a=>a.id)),i=(t||[]).filter(a=>s.has(a.source)&&s.has(a.target));return{version:1,nodes:r.map(a=>zu(a)),edges:i.map(a=>zu(a)),instances:jk(r,n||{})}}function j7(e,t,n,r,s={}){var d;if(!e||!Array.isArray(e.nodes)||e.nodes.length===0)return null;const i=s.offset||{x:48,y:48},a=new Set((t||[]).map(p=>p.id)),l=new Map;for(const p of e.nodes)l.set(p.id,S7(p.id,a));const c=e.nodes.map(p=>{var g,k;const h=l.get(p.id);return{...zu(p),id:h,selected:!0,dragging:!1,position:{x:Number(((g=p.position)==null?void 0:g.x)||0)+i.x,y:Number(((k=p.position)==null?void 0:k.y)||0)+i.y}}}),u=(e.edges||[]).filter(p=>l.has(p.source)&&l.has(p.target)).map((p,h)=>{const g=l.get(p.source),k=l.get(p.target);return{...zu(p),id:`e-${g}-${k}-${Date.now()}-${h}`,source:g,target:k,selected:!1}}),f={...r||{}};for(const[p,h]of l.entries()){const g=(d=e.instances)==null?void 0:d[p];g&&(f[h]={...zu(g),label:g.label!=null?String(g.label):h})}return{nodes:[...(t||[]).map(p=>({...p,selected:!1})),...c],edges:[...(n||[]).map(p=>({...p,selected:!1})),...u],instances:f,pastedNodeIds:c.map(p=>p.id)}}function _n(e){switch(Ih(e)){case"text":return"#2196f3";case"file":return"#4caf50";case"node":return"#ff9800";case"bool":return"#9c27b0";default:return"#9e9e9e"}}function Ih(e){const t=String(e??"").trim().toLowerCase();return t==="文本"||t==="str"||t==="string"?"text":t==="文件"||t==="path"?"file":t==="节点"||t==="flow"||t==="control"?"node":t==="boolean"||t==="布尔"?"bool":t||"node"}function C7(e,t){const n=Ih(e),r=Ih(t);return!n||!r?!1:n==="any"||r==="any"?!0:n===r}const _7=new Set(["knowledgeContext","workspaceContext","skillsContext","mcpContext"]);function vw(e){const t=Ih(e==null?void 0:e.type),n=String((e==null?void 0:e.name)||(e==null?void 0:e.id)||"").trim();return t==="text"&&_7.has(n)?`${t}+${n}`:t}function E7(e){return vw(e)}function bd(e,t){if(!e||!t||!C7(e.type,t.type))return!1;const n=vw(e),r=vw(t),s=n.includes("+"),i=r.includes("+");return s||i?n===r:!0}function A7(e,t){const n=new RegExp(`^${t}-(\\d+)$`).exec(String(e||""));if(!n)return-1;const r=Number.parseInt(n[1],10);return Number.isFinite(r)?r:-1}function Sw(e,t,n){var l;const r=n==="source"?"outputs":"inputs",i=A7(t,n==="source"?"output":"input");return i<0?null:(Array.isArray((l=e==null?void 0:e.data)==null?void 0:l[r])?e.data[r]:[])[i]||null}const Rh=/\[image\s+(\d+)\]/gi;function ro(e){return Array.isArray(e)?e.filter(t=>t&&typeof t=="object").map((t,n)=>({id:String(t.id||`image-${n+1}`),label:String(t.label||`image ${n+1}`),name:String(t.name||`image-${n+1}`),mimeType:String(t.mimeType||t.type||"image/png"),dataUrl:String(t.dataUrl||t.data||"")})).filter(t=>t.dataUrl.startsWith("data:image/")):[]}function P7(e){return`image ${ro(e).length+1}`}function I7(e,t){const n=String(e||""),r=`[${t}]`;return n.trim()?`${n.replace(/[ \t]+$/u,"")} ${r}`:r}function R7(e,t){const n=ro(e),r=String(t||""),s=new Set;Rh.lastIndex=0;let i;for(;i=Rh.exec(r);)s.add(`image ${i[1]}`.toLowerCase());return s.size===0?[]:n.filter(a=>s.has(String(a.label||"").toLowerCase()))}function T7(e){return new Promise((t,n)=>{if(!e||!String(e.type||"").startsWith("image/")){n(new Error("Only image files are supported"));return}const r=new FileReader;r.onload=()=>{t({name:e.name||"image",mimeType:e.type||"image/png",dataUrl:String(r.result||"")})},r.onerror=()=>n(r.error||new Error("Failed to read image")),r.readAsDataURL(e)})}function mR(e){var n;return Array.from(((n=e==null?void 0:e.clipboardData)==null?void 0:n.items)||[]).filter(r=>r.kind==="file"&&String(r.type||"").startsWith("image/")).map(r=>r.getAsFile()).filter(Boolean)}function Bu(e){var t;return Array.from(((t=e==null?void 0:e.dataTransfer)==null?void 0:t.files)||[]).filter(n=>String(n.type||"").startsWith("image/"))}async function gR({files:e,body:t,images:n}){const r=Array.from(e||[]);if(r.length===0)return null;let s=String(t||"");const i=ro(n);for(const a of r){const l=await T7(a),c=P7(i);i.push({id:`${Date.now().toString(36)}-${i.length+1}`,label:c,...l}),s=I7(s,c)}return{body:s,images:i}}function ps(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function M7(e){var r;const t=(r=e==null?void 0:e.definitionId)==null?void 0:r.trim();if(t&&t!=="普通")return t;const n=((e==null?void 0:e.schemaType)??"agent").toLowerCase();return n&&n!=="普通"?n:"agent"}function $7(e){return["true","1","yes","on"].includes(String((e==null?void 0:e.value)??(e==null?void 0:e.default)??"").trim().toLowerCase())}function Gt(e){e.stopPropagation()}function L7(e){return String(e||"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function O7(e,t){const n=`\\[${L7(t)}\\]`;return String(e||"").replace(new RegExp(`[ \\t]*${n}`,"gi"),"").replace(/[ \t]+\n/g,`
|
|
96
|
-
`).replace(/\n{3,}/g,`
|
|
97
|
-
|
|
98
|
-
`).trimEnd()}function Sy(e){return String(e||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function D7(e){const t=String(e||"");let n="",r=0;Rh.lastIndex=0;let s;for(;s=Rh.exec(t);)n+=Sy(t.slice(r,s.index)),n+=`<span class="af-flow-node__image-token">${Sy(s[0])}</span>`,r=s.index+s[0].length;return n+=Sy(t.slice(r)),n||" "}function F7(e,t){const n=window.getComputedStyle(e),r=Number.parseFloat(n.lineHeight)||18,s=Number.parseFloat(n.paddingTop)||0,i=Number.parseFloat(n.paddingBottom)||0,a=Number.parseFloat(n.borderTopWidth)||0,l=Number.parseFloat(n.borderBottomWidth)||0,c=String(t||"").split(/\r\n|\r|\n/).length,u=Math.min(Math.max(c,2),8);return Math.ceil(u*r+s+i+a+l)}function z7({data:e,selected:t,id:n,deleteNode:r,onProvideExpand:s,onProvideValueChange:i,onNodeBodyChange:a,onNodeImagesChange:l,modelLists:c,onModelChange:u}){var Sr,Ft;const{t:f}=Ir(),d=(e==null?void 0:e.inputs)??[],p=(e==null?void 0:e.outputs)??[],h=((e==null?void 0:e.schemaType)??"agent").toLowerCase(),g=M7(e),k=(e==null?void 0:e.isRunMode)??!1,w=!!(e!=null&&e.readOnly),y=(e==null?void 0:e.isExecuting)??!1,v=(e==null?void 0:e.isDim)??!1,b=(e==null?void 0:e.nodeStatus)??null,C=(e==null?void 0:e.nodeElapsed)??null,N=(e==null?void 0:e.definitionId)||"",j=N.startsWith("provide_"),A=N==="provide_bool",I=N==="provide_str",D=N==="provide_file",H=N==="provide_password",V=N==="agent_subAgent",F=N==="control_agent_toBool",L=(V||F)&&!k,M=A?$7(p[0]):!1,K=j?String(((Sr=p[0])==null?void 0:Sr.value)??((Ft=p[0])==null?void 0:Ft.default)??(e==null?void 0:e.body)??""):"",W=String((e==null?void 0:e.body)||""),$=(e==null?void 0:e.displayLabel)||(e==null?void 0:e.label)||f("flow:node.fallbackLabel"),R=!j&&!L&&(e!=null&&e.showBodyPreview)?String((e==null?void 0:e.body)||"").trim():"",B=ro(e==null?void 0:e.images),_=A||I||D||H||L||!!R,X=m.useRef(!1),z=m.useRef(!1),T=m.useRef(null),Z=m.useRef(null),ae=m.useRef(null),J=m.useRef(null),se=m.useRef(null),[ee,re]=m.useState(K),[ne,ue]=m.useState(!1),[de,xe]=m.useState(W),[ze,Te]=m.useState(!1),[Le,nt]=m.useState({visible:!1,top:0,height:100}),[wt,mt]=m.useState(!1),Re=m.useCallback(()=>{const ce=Z.current;if(!ce)return;const ke=Math.max(1,ce.scrollHeight),tt=Math.max(1,ce.clientHeight),yt=ke>tt+1,vn=yt?Math.max(12,tt/ke*100):100,Jt=Math.max(0,100-vn),Bn=yt?Math.min(Jt,ce.scrollTop/Math.max(1,ke-tt)*Jt):0;nt({visible:yt,top:Bn,height:vn})},[]);m.useEffect(()=>{X.current||re(K)},[n,K]),m.useEffect(()=>{z.current||xe(W)},[n,W]),m.useEffect(()=>{const ce=Z.current;if(!ce)return;if(L){ce.style.minHeight="",ce.style.height="",ae.current&&(ae.current.style.minHeight="",ae.current.style.height="");return}const ke=F7(ce,de);ce.style.minHeight=`${ke}px`,ce.style.height="",ae.current&&(ae.current.style.minHeight=`${ke}px`,ae.current.style.height="")},[de,L]),m.useEffect(()=>{if(!L)return;const ce=window.requestAnimationFrame(Re),ke=Z.current;if(!ke||typeof ResizeObserver>"u")return()=>window.cancelAnimationFrame(ce);const tt=new ResizeObserver(Re);return tt.observe(ke),()=>{window.cancelAnimationFrame(ce),tt.disconnect()}},[de,L,Re]),m.useEffect(()=>{const ce=T.current,ke=e==null?void 0:e.onNodeContentResize;if(!L||!ce||!ke||typeof ResizeObserver>"u")return;let tt=0;const yt=()=>{window.cancelAnimationFrame(tt),tt=window.requestAnimationFrame(()=>ke(n))},vn=new ResizeObserver(yt);return vn.observe(ce),yt(),()=>{window.cancelAnimationFrame(tt),vn.disconnect()}},[e==null?void 0:e.onNodeContentResize,L,n]),m.useEffect(()=>{if(!wt)return;const ce=window.setTimeout(()=>{const ke=se.current;if(!ke)return;ke.focus();const tt=ke.value.length;ke.setSelectionRange(tt,tt)},0);return()=>window.clearTimeout(ce)},[wt]);const it=Array.isArray(c==null?void 0:c.cursor)?c.cursor:[],Nt=Array.isArray(c==null?void 0:c.opencode)?c.opencode:[],qt=Array.isArray(c==null?void 0:c.claudeCode)?c.claudeCode:[],Zt=Array.isArray(c==null?void 0:c.codex)?c.codex:[],rt=((e==null?void 0:e.model)??"").trim(),fe=h==="agent"&&!N.startsWith("tool_nodejs"),ve=new Set(it.map(ps)),He=new Set(Nt.map(ps)),Ge=new Set(qt.map(ps)),je=new Set(Zt.map(ps)),Tt=rt?rt.startsWith("cursor:")||rt.startsWith("opencode:")||rt.startsWith("codex:")||rt.startsWith("claude-code:")?rt:Ge.has(rt)?`claude-code:${rt}`:je.has(rt)?`codex:${rt}`:He.has(rt)?`opencode:${rt}`:ve.has(rt)?`cursor:${rt}`:rt:"",kn=rt&&!Tt.startsWith("cursor:")&&!Tt.startsWith("opencode:")&&!Tt.startsWith("codex:")&&!Tt.startsWith("claude-code:")&&!ve.has(rt)&&!He.has(rt)&&!Ge.has(rt)&&!je.has(rt),dn=rt.startsWith("cursor:")?rt.slice(7):rt.startsWith("opencode:")?rt.slice(9):rt.startsWith("codex:")?rt.slice(6):rt.startsWith("claude-code:")?rt.slice(12):rt,en=ce=>{if(w)return;const ke=ce.target.value;u&&u(n,ke)},Pn=ce=>{ce.stopPropagation(),!w&&r&&r(n)},te=ce=>{ce.stopPropagation(),s&&s()},Ee=ce=>{ce.stopPropagation(),!w&&(i==null||i(n,ce.target.value==="true"?"true":"false"))},We=ce=>{if(ce.stopPropagation(),w)return;const ke=ce.target.value;re(ke),X.current||i==null||i(n,ke)},Ke=ce=>{ce.stopPropagation(),X.current=!0},bt=ce=>{if(ce.stopPropagation(),w)return;X.current=!1;const ke=ce.currentTarget.value;re(ke),i==null||i(n,ke)},jt=()=>{w||i==null||i(n,ee)},qn=ce=>{if(ce.stopPropagation(),w)return;if(typeof(e==null?void 0:e.onOpenProvideFilePicker)=="function"){e.onOpenProvideFilePicker(n,ee);return}const ke=window.prompt("文件路径",ee);ke!=null&&(re(ke),i==null||i(n,ke))},Ht=ce=>{ce.stopPropagation(),ue(ke=>!ke)},gt=ce=>{if(xe(ce),a==null||a(n,ce),l){const ke=R7(B,ce);(ke.length!==B.length||ke.some((tt,yt)=>{var vn;return tt.id!==((vn=B[yt])==null?void 0:vn.id)}))&&l(n,ke)}},Mn=ce=>{if(ce.stopPropagation(),w)return;const ke=ce.target.value;z.current?xe(ke):gt(ke)},Pt=ce=>{ce.stopPropagation(),!w&&(z.current=!0,Te(!0))},fn=ce=>{if(ce.stopPropagation(),w)return;z.current=!1,Te(!1);const ke=ce.currentTarget.value;gt(ke)},Yn=()=>{w||(z.current=!1,Te(!1),gt(de))},ei=ce=>{ce.stopPropagation(),ce.preventDefault(),!w&&mt(!0)},qr=()=>{mt(!1),Yn()},Yr=ce=>{ce.stopPropagation(),ce.key==="Escape"&&(ce.preventDefault(),qr())},pr=m.useCallback(ce=>{const ke=Z.current;if(!ke)return;const tt=Math.max(0,ke.scrollHeight-ke.clientHeight);ke.scrollTop=Math.min(1,Math.max(0,ce))*tt,Re()},[Re]),on=m.useCallback((ce,ke=0)=>{const tt=J.current;if(!tt)return 0;const yt=tt.getBoundingClientRect(),vn=Le.height/100*yt.height,Jt=Math.max(1,yt.height-vn);return(ce-yt.top-ke)/Jt},[Le.height]),zn=m.useCallback(ce=>{var Vt,$n;if(!Le.visible)return;ce.preventDefault(),ce.stopPropagation();const ke=J.current;if(!ke)return;const tt=ke.getBoundingClientRect(),yt=Le.top/100*tt.height,vn=Le.height/100*tt.height,Bn=ce.clientY>=tt.top+yt&&ce.clientY<=tt.top+yt+vn?ce.clientY-tt.top-yt:vn/2;pr(on(ce.clientY,Bn));const us=ce.pointerId;($n=(Vt=ce.currentTarget).setPointerCapture)==null||$n.call(Vt,us);const ut=Fe=>{Fe.preventDefault(),pr(on(Fe.clientY,Bn))},Wt=()=>{window.removeEventListener("pointermove",ut),window.removeEventListener("pointerup",Wt),window.removeEventListener("pointercancel",Wt)};window.addEventListener("pointermove",ut),window.addEventListener("pointerup",Wt),window.addEventListener("pointercancel",Wt)},[on,Le.height,Le.top,Le.visible,pr]),Rr=async ce=>{if(w)return;const ke=await gR({files:ce,body:de,images:B});ke&&(xe(ke.body),a==null||a(n,ke.body),l==null||l(n,ke.images))},In=(ce,ke)=>{if(ce.stopPropagation(),w)return;const tt=B.filter(vn=>vn.id!==ke.id),yt=O7(de,ke.label);xe(yt),a==null||a(n,yt),l==null||l(n,tt)},Qn=ce=>{if(w)return;const ke=mR(ce);ke.length!==0&&(ce.preventDefault(),ce.stopPropagation(),Rr(ke).catch(()=>{}))},vr=ce=>{if(w)return;const ke=Bu(ce);ke.length!==0&&(ce.preventDefault(),ce.stopPropagation(),Rr(ke).catch(()=>{}))},Ns=()=>{const ce=Z.current,ke=ae.current;!ce||!ke||(ke.scrollTop=ce.scrollTop,ke.scrollLeft=ce.scrollLeft)};return o.jsxs("div",{className:"af-flow-node"+(t?" af-flow-node--selected":"")+(y?" af-flow-node--executing":"")+(b==="success"?" af-flow-node--done":"")+(b==="failed"?" af-flow-node--failed":"")+(b==="running"&&!y?" af-flow-node--running-disk":"")+(v?" af-flow-node--dim":"")+(L?" af-flow-node--inline-body-editor":"")+(I?" af-flow-node--provide-text":"")+(H?" af-flow-node--provide-password":"")+" af-flow-node--"+h.replace(/[^a-z0-9_-]/g,""),"data-schema":h,children:[o.jsxs("div",{className:"af-flow-node__chrome",children:[o.jsx("span",{className:"af-flow-node__title af-flow-node__title--chrome",title:`${$}${n?` (${n})`:""}${g?` · ${g}`:""}`,children:$}),!k&&fe&&o.jsxs("div",{className:"af-flow-node__model-wrap nodrag",onPointerDown:Gt,onMouseDown:Gt,onClick:Gt,children:[o.jsxs("select",{className:"af-flow-node__model nodrag",value:Tt,onChange:en,onPointerDown:Gt,onMouseDown:Gt,onClick:Gt,"aria-label":f("flow:node.model"),title:dn||f("flow:node.defaultModel"),disabled:w,children:[o.jsx("option",{value:"",children:f("flow:node.defaultModel")}),kn&&o.jsx("option",{value:rt,children:rt}),it.length>0&&o.jsx("optgroup",{label:"Cursor",children:it.map(ce=>o.jsx("option",{value:`cursor:${ps(ce)}`,children:ps(ce)},`c-${ce}`))}),Nt.length>0&&o.jsx("optgroup",{label:"OpenCode",children:Nt.map(ce=>o.jsx("option",{value:`opencode:${ps(ce)}`,children:ps(ce)},`o-${ce}`))}),Zt.length>0&&o.jsx("optgroup",{label:"Codex",children:Zt.map(ce=>o.jsx("option",{value:`codex:${ps(ce)}`,children:ps(ce)},`codex-${ce}`))}),qt.length>0&&o.jsx("optgroup",{label:"Claude Code",children:qt.map(ce=>o.jsx("option",{value:`claude-code:${ps(ce)}`,children:ps(ce)},`cc-${ce}`))})]}),o.jsx("span",{className:"af-flow-node__model-arrow material-symbols-outlined",children:"expand_more"})]}),y&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--executing",children:"EXECUTING"}),b==="running"&&!y&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--running-disk",title:f("flow:node.diskRunning"),children:"RUNNING"}),b==="success"&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--done",children:C!=null&&String(C).trim()!==""?C:"--"}),b==="failed"&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--failed",children:"FAILED"}),!k&&j&&!A&&!I&&!D&&!H&&o.jsx("button",{type:"button",className:"af-flow-node__expand",onClick:te,"aria-label":f("flow:node.expandProvide"),title:f("flow:node.expandProvide"),children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})}),!k&&o.jsx("button",{type:"button",className:"af-flow-node__delete",disabled:w,onClick:Pn,"aria-label":f("flow:node.deleteNode"),title:f("flow:node.deleteNode"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-flow-node__body",children:[o.jsx("div",{className:"af-flow-node__ports af-flow-node__ports--in",children:d.map((ce,ke)=>{if(ce.showOnNode===!1)return null;const tt=f("flow:node.inputTooltip",{name:ce.name||`#${ke}`,type:ce.type})+(ce.default!=null&&ce.default!==""?f("flow:node.defaultSuffix",{value:ce.default}):""),yt=ce.name||`#${ke+1}`;return o.jsxs("div",{className:"af-flow-node__port-row",title:tt,children:[o.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--in",children:[yt,ce.required?o.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),o.jsx(Kn,{type:"target",position:Be.Left,id:`input-${ke}`,className:"af-flow-node__handle",style:{background:_n(ce.type)},title:tt})]},`in-${ke}`)})}),o.jsxs("div",{className:"af-flow-node__title-wrap",children:[A?o.jsxs("select",{className:"af-flow-node__bool-select nodrag"+(M?" af-flow-node__bool-select--true":""),value:M?"true":"false",onChange:Ee,onPointerDown:Gt,onMouseDown:Gt,onClick:Gt,"aria-label":"Boolean value",title:M?"true":"false",disabled:w,children:[o.jsx("option",{value:"false",children:"false"}),o.jsx("option",{value:"true",children:"true"})]}):I?o.jsx("textarea",{className:"af-flow-node__inline-text nodrag",value:ee,onChange:We,onCompositionStart:Ke,onCompositionEnd:bt,onBlur:jt,onPointerDown:Gt,onMouseDown:Gt,onClick:Gt,placeholder:"输入文本",rows:2,readOnly:w}):D?o.jsxs("div",{className:"af-flow-node__file-value nodrag",onPointerDown:Gt,onMouseDown:Gt,onClick:Gt,children:[o.jsx("input",{className:"af-flow-node__file-input nodrag",value:ee,onChange:We,onCompositionStart:Ke,onCompositionEnd:bt,onBlur:jt,placeholder:"选择或输入文件路径",title:ee||"选择或输入文件路径",readOnly:w}),o.jsx("button",{type:"button",className:"af-flow-node__file-picker nodrag",disabled:w,onClick:qn,"aria-label":"选择文件",title:"选择文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"folder_open"})})]}):H?o.jsxs("div",{className:"af-flow-node__password-value nodrag",onPointerDown:Gt,onMouseDown:Gt,onClick:Gt,children:[o.jsx("input",{className:"af-flow-node__password-input nodrag",type:ne?"text":"password",value:ee,onChange:We,onCompositionStart:Ke,onCompositionEnd:bt,onBlur:jt,placeholder:"输入密码或密钥",title:ne?ee:"密码已隐藏",autoComplete:"off",readOnly:w}),o.jsx("button",{type:"button",className:"af-flow-node__password-toggle nodrag",disabled:w,onClick:Ht,"aria-label":ne?"隐藏密码":"预览密码",title:ne?"隐藏密码":"预览密码",children:o.jsx("span",{className:"material-symbols-outlined",children:ne?"visibility_off":"visibility"})})]}):L?o.jsxs("div",{ref:T,className:"af-flow-node__prompt-stack nodrag"+(ze?" af-flow-node__prompt-stack--composing":""),children:[o.jsx("pre",{ref:ae,className:"af-flow-node__prompt-backdrop","aria-hidden":"true",dangerouslySetInnerHTML:{__html:D7(de)+`
|
|
99
|
-
`}}),o.jsx("textarea",{ref:Z,className:"af-flow-node__prompt-editor nodrag",value:de,onChange:Mn,onCompositionStart:Pt,onCompositionEnd:fn,onBlur:Yn,onPaste:Qn,onDrop:vr,onScroll:ce=>{Ns(),Re()},onPointerDown:Gt,onMouseDown:Gt,onClick:Gt,onKeyDown:Gt,onDragOver:ce=>{Bu(ce).length>0&&ce.preventDefault()},placeholder:F?"输入判断条件 / prompt":"输入 prompt",rows:2,readOnly:w}),!w&&o.jsx("button",{type:"button",className:"af-flow-node__prompt-expand nodrag",onPointerDown:Gt,onMouseDown:Gt,onClick:ei,"aria-label":"放大编辑",title:"放大编辑",children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})}),o.jsx("div",{ref:J,className:"af-flow-node__prompt-scrollbar"+(Le.visible?" af-flow-node__prompt-scrollbar--visible":""),onPointerDown:zn,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${Le.height}%`,top:`${Le.top}%`}})})]}):null,L&&B.length>0?o.jsx("div",{className:"af-flow-node__image-chips",children:B.map((ce,ke)=>o.jsxs("span",{className:"af-flow-node__image-chip",title:ce.name,children:[o.jsx("img",{src:ce.dataUrl,alt:""}),o.jsxs("span",{children:["[",ce.label||`image ${ke+1}`,"]"]}),o.jsx("button",{type:"button",className:"af-flow-node__image-remove nodrag",disabled:w,onClick:tt=>In(tt,ce),onPointerDown:Gt,onMouseDown:Gt,"aria-label":`删除 ${ce.label||`image ${ke+1}`}`,title:"删除图片",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},ce.id||ke))}):null,R?o.jsx("span",{className:"af-flow-node__prompt-preview",title:R,children:R}):null,_?null:o.jsx("span",{className:"af-flow-node__body-title",title:$,children:$})]}),o.jsx("div",{className:"af-flow-node__ports af-flow-node__ports--out",children:p.map((ce,ke)=>{if(ce.showOnNode===!1)return null;const tt=f("flow:node.outputTooltip",{name:ce.name||`#${ke}`,type:ce.type})+(ce.default!=null&&ce.default!==""?f("flow:node.defaultSuffix",{value:ce.default}):""),yt=ce.name||`#${ke+1}`;return o.jsxs("div",{className:"af-flow-node__port-row",title:tt,children:[o.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--out",children:[yt,ce.required?o.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),o.jsx(Kn,{type:"source",position:Be.Right,id:`output-${ke}`,className:"af-flow-node__handle",style:{background:_n(ce.type)},title:tt})]},`out-${ke}`)})})]}),wt?cr.createPortal(o.jsx("div",{className:"af-flow-node-full-editor nodrag",onPointerDown:Gt,onMouseDown:Gt,onClick:Gt,onWheel:Gt,children:o.jsxs("div",{className:"af-flow-node-full-editor__panel",children:[o.jsxs("div",{className:"af-flow-node-full-editor__header",children:[o.jsxs("div",{children:[o.jsx("div",{className:"af-flow-node-full-editor__title",children:$}),o.jsx("div",{className:"af-flow-node-full-editor__hint",children:"编辑 prompt,Esc 关闭"})]}),o.jsx("button",{type:"button",className:"af-flow-node-full-editor__close",onClick:qr,"aria-label":"关闭",title:"关闭",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx("textarea",{ref:se,className:"af-flow-node-full-editor__textarea",value:de,onChange:Mn,onCompositionStart:Pt,onCompositionEnd:fn,onPaste:Qn,onDrop:vr,onKeyDown:Yr,onDragOver:ce=>{Bu(ce).length>0&&ce.preventDefault()},placeholder:F?"输入判断条件 / prompt":"输入 prompt",readOnly:w})]})}),document.body):null]})}const Jl="flowNode";function Nw(e){const t=e.type||"node",n=e.showOnNode!=null,r={type:t,name:e.name||"",default:e.value!==void 0&&e.value!==null?String(e.value):e.default!==void 0?String(e.default):""};return e.required!=null&&(r.required=!!e.required),e.description!=null&&(r.description=String(e.description)),r.showOnNode=n?!!e.showOnNode:!!r.required||String(t).trim().toLowerCase()==="node",r._showOnNodeExplicit=n,r}const B7={agent_subAgent:["SubAgent"],control_start:["Start"],control_end:["End"],control_agent_toBool:["Agent ToBool"],control_anyOne:["Any One"],control_cancelled:["Cancelled","Cancel Check"],control_cd_workspace:["CD Workspace","Load Workspace"],control_delay:["Delay"],control_if:["If Branch"],control_interval_loop:["Interval Loop"],control_load_skills:["Load Skills"],control_load_mcp:["Load MCP"],workspace_scheduled_run:["Scheduled Run"],workspace_run:["Run"],control_user_workspace:["User Workspace"],control_toBool:["To Bool","Code ToBool"],control_wait_until:["Wait Until"],tool_git_checkout:["Git Checkout"],tool_get_env:["Get Env"],tool_load_key:["Load Key"],tool_set_run_env:["Set Run Env","Set Env"],tool_display_share_link:["Display Share Link","Share Link"],tool_nodejs:["Node.js Script"],tool_print:["Print"],tool_save_key:["Save Key"],tool_user_ask:["UserAsk"],tool_user_check:["User Confirm"],provide_file:["File"],provide_password:["Password"],provide_bool:["Boolean"],provide_text:["Text"],provide_str:["Text"],display_markdown:["Markdown Display"],display_react_app:["React App"],display_mermaid:["Mermaid Display"],display_ascii:["ASCII Display"],display_chart:["Chart Display"],display_table:["Table Display"]};function H7(e,t,n){const r=String((n==null?void 0:n.displayName)||"").trim(),s=String(t||"").trim();return!r||!s||r===s?s:(B7[e]||[]).includes(s)?r:s}const W7={tool_git_checkout:new Set(["targetDir","pullIfExists","includeSubmodules","workspaceContext","commit","changed"]),control_load_skills:new Set(["mergeMode","workspaceContext","skillsContext","loadedCount","summary"]),control_load_mcp:new Set(["workspaceContext","mcpContext","loadedCount","summary"]),agent_subAgent:new Set(["workspaceContext","skillsContext","mcpContext"])},V7={control_cd_workspace:new Set(["mode","label","workspaceContext","cwd","previous"]),control_user_workspace:new Set(["cwd"]),display_markdown:new Set(["prev","next"]),display_mermaid:new Set(["prev","next"]),display_ascii:new Set(["prev","next"]),display_html:new Set(["prev","next"]),display_react_app:new Set(["prev","next"]),display_image:new Set(["prev","next"]),display_chart:new Set(["prev","next"]),display_table:new Set(["prev","next"]),tool_git_checkout:new Set(["branch","targetDir","pullIfExists","includeSubmodules","repoPath","commit","changed"]),tool_gitlab_create_mr:new Set(["repoPath","workspaceContext","sourceBranch","targetBranch","title","description","draft","labels","push","remote","tokenEnv","gitlabApiBase","removeSourceBranch","squash","created","mrIid","projectId","message"])},K7={agent_subAgent:new Set(["knowledgeContext","skillsContext"])},U7=new Set(["display_markdown","display_mermaid","display_ascii","display_html","display_react_app","display_image","display_chart","display_table"]);function q7(e,t){if(!U7.has(String(e||"")))return!1;const n=String((t==null?void 0:t.name)||"");return n==="content"||n==="src"}function Y7(e){const t=String((e==null?void 0:e.marketplaceDefinitionId)||(e==null?void 0:e.id)||"").trim();return t.startsWith("marketplace:")?t:""}function G7(e,t){const n=String((e==null?void 0:e.baseDefinitionId)||"").trim();return n||t}function yR(e){const t=String(e??"");return/^[A-Za-z0-9_@%+=:,./-]+$/.test(t)?t:"'"+t.replace(/'/g,"'\\''")+"'"}function J7(e,t){const n=String((e==null?void 0:e.language)||"").trim().toLowerCase(),r=String(t||"").trim().toLowerCase();return n.includes("python")||r.endsWith(".py")?"python3":n.includes("shell")||n==="bash"||r.endsWith(".sh")||r.endsWith(".bash")?"bash":"node"}function X7(e){const t=String(e??"").trim();return t?t.includes("${")?t:yR(t):""}function Q7(e){if(String((e==null?void 0:e.baseDefinitionId)||"").trim()!=="tool_nodejs")return"";const t=e!=null&&e.runtime&&typeof e.runtime=="object"?e.runtime:{},n=String(t.entry||"").trim().replace(/^\/+/,"");if(n){const r=String((e==null?void 0:e.packageDir)||"").trim().replace(/\/+$/,""),s=r?`${r}/${n}`:`\${flowDir}/${n}`,i=Array.isArray(t.args)?t.args.map(X7).filter(Boolean):[];return[J7(t,n),yR(s),...i].join(" ")}return String(t.command||"").trim()}function f1(e,t,n){return!Array.isArray(t)||!Array.isArray(n)||n.length===0?t:t.map((r,s)=>{var u,f,d;const i=n[s],l=n.find(p=>(p==null?void 0:p.name)&&p.name===r.name)||i;if(!l)return r;const c=r.showOnNode===!1&&l.showOnNode==null&&((u=W7[e])==null?void 0:u.has(r.name));return{...r,...r.required==null&&l.required!=null?{required:!!l.required}:{},...r.description==null&&l.description!=null?{description:String(l.description)}:{},...c?{showOnNode:!0}:{},...!r._showOnNodeExplicit&&l.showOnNode!=null?{showOnNode:!!l.showOnNode}:{},...!r._showOnNodeExplicit&&l.showOnNode==null?{showOnNode:!!r.required||String(r.type||"").trim().toLowerCase()==="node"}:{},...!r._showOnNodeExplicit&&q7(e,r)?{showOnNode:!0}:{},...(f=K7[e])!=null&&f.has(r.name)?{showOnNode:!0}:{},...(d=V7[e])!=null&&d.has(r.name)?{showOnNode:!1}:{}}})}function Z7(e){var s,i;const t=Array.isArray((s=e==null?void 0:e.data)==null?void 0:s.inputs)?e.data.inputs:[],n=Array.isArray((i=e==null?void 0:e.data)==null?void 0:i.outputs)?e.data.outputs:[],r=a=>a.map(l=>{const c=Nw(l);return{type:String(c.type||"node"),name:String(c.name??""),default:String(c.default??""),required:!!c.required,description:String(c.description??""),showOnNode:c.showOnNode!=null?c.showOnNode!==!1:!!c.required||String(c.type||"").trim().toLowerCase()==="node"}});return{inputs:r(t),outputs:r(n)}}function jw(e,t,n,r,s){var R,B,_,X,z,T,Z,ae,J,se,ee,re,ne,ue,de,xe,ze,Te,Le,nt,wt,mt;const i=((R=e.data)==null?void 0:R.definitionId)||String(e.id).replace(/-\d+$/,""),a=n.find(Re=>Re.id===i),l=t[e.id];let c=[],u=[],f=((B=e.data)==null?void 0:B.label)??e.id,d,p,h,g,k;const w=!!l;l&&(Array.isArray(l.input)&&(c=l.input.map(Nw)),Array.isArray(l.output)&&(u=l.output.map(Nw)),l.label&&(f=String(l.label)),l.role&&typeof l.role=="string"&&(d=l.role),l.model!=null&&(p=String(l.model).trim()),l.body!=null&&(h=String(l.body)),Array.isArray(l.images)&&(g=l.images),l.script!=null&&(k=String(l.script)));const y=d??(typeof((_=e.data)==null?void 0:_.role)=="string"?e.data.role:"普通"),v=p??((X=e.data)==null?void 0:X.model)??void 0,b=(a==null?void 0:a.description)!=null?String(a.description).trim():"",C=b!==""?b:void 0,N=h??((z=e.data)==null?void 0:z.body)??"",j=Array.isArray(g)?g:Array.isArray((T=e.data)==null?void 0:T.images)?e.data.images:[],A=Q7(a),I=k!==void 0?k:((Z=e.data)==null?void 0:Z.script)!=null?String(e.data.script):A,D=String(e.id),H=(ae=r==null?void 0:r[s])==null?void 0:ae[D],V=(J=H==null?void 0:H.label)==null?void 0:J.label,F=H==null?void 0:H.body,L=H==null?void 0:H.description;w||(c.length===0&&((se=a==null?void 0:a.inputs)!=null&&se.length)&&(c=a.inputs.map(Re=>({...Re}))),u.length===0&&((ee=a==null?void 0:a.outputs)!=null&&ee.length)&&(u=a.outputs.map(Re=>({...Re}))));const M=G7(a,(a==null?void 0:a.id)??i),K=(l==null?void 0:l.marketplaceRef)||((re=e.data)==null?void 0:re.marketplaceRef)||Y7(a);if(M==="agent_subAgent"&&!u.some(Re=>(Re==null?void 0:Re.name)==="result")){const Re=(ne=a==null?void 0:a.outputs)==null?void 0:ne.find(it=>(it==null?void 0:it.name)==="result");u=[...u,Re?{...Re}:{type:"text",name:"result",default:""}]}if(M==="agent_subAgent"&&!c.some(Re=>(Re==null?void 0:Re.name)==="knowledgeContext")){const Re=(ue=a==null?void 0:a.inputs)==null?void 0:ue.find(it=>(it==null?void 0:it.name)==="knowledgeContext");c=[...c,Re?{...Re}:{type:"text",name:"knowledgeContext",default:"",showOnNode:!0}]}if((M==="display_markdown"||M==="display_mermaid"||M==="display_ascii"||M==="display_chart"||M==="display_table")&&!u.some(Re=>(Re==null?void 0:Re.name)==="next")){const Re=(de=a==null?void 0:a.outputs)==null?void 0:de.find(it=>(it==null?void 0:it.name)==="next");u=[...u,Re?{...Re}:{type:"node",name:"next",default:""}]}if(M==="workspace_run"){if(!c.some(Re=>(Re==null?void 0:Re.name)==="prev")){const Re=(xe=a==null?void 0:a.inputs)==null?void 0:xe.find(it=>(it==null?void 0:it.name)==="prev");c=[Re?{...Re}:{type:"node",name:"prev",default:""},...c]}if(!u.some(Re=>(Re==null?void 0:Re.name)==="next")){const Re=(ze=a==null?void 0:a.outputs)==null?void 0:ze.find(it=>(it==null?void 0:it.name)==="next");u=[...u,Re?{...Re}:{type:"node",name:"next",default:""}]}}c=f1(M,c,a==null?void 0:a.inputs),u=f1(M,u,a==null?void 0:a.outputs),M.startsWith("provide_")&&u[0]&&String(u[0].default??u[0].value??"").trim()===""&&String(N).trim()!==""&&(u=u.map((Re,it)=>it===0?{...Re,default:N,value:N}:Re));const W=H7(M,f,a),$=M==="tool_nodejs"||String(I).trim()!=="";return{...e,type:"flowNode",data:{...e.data,label:V||f,displayLabel:W,definitionDisplayName:a==null?void 0:a.displayName,definitionId:M,...K?{marketplaceRef:K}:{},...l!=null&&l.marketplacePackageId||(Te=e.data)!=null&&Te.marketplacePackageId||a!=null&&a.packageId?{marketplacePackageId:(l==null?void 0:l.marketplacePackageId)||((Le=e.data)==null?void 0:Le.marketplacePackageId)||(a==null?void 0:a.packageId)}:{},...l!=null&&l.marketplaceVersion||(nt=e.data)!=null&&nt.marketplaceVersion||a!=null&&a.version?{marketplaceVersion:(l==null?void 0:l.marketplaceVersion)||((wt=e.data)==null?void 0:wt.marketplaceVersion)||(a==null?void 0:a.version)}:{},schemaType:((mt=e.data)==null?void 0:mt.schemaType)??e.type??"agent",role:y,model:v,body:F||N,images:j,script:I,inputs:c,outputs:u,description:L||C,originalLabel:f,originalBody:N,...$?{script:I}:{}}}}function eU(e,t){const n=new Map(t.map(r=>[r.id,r]));return e.filter(r=>{var f,d,p,h;const s=n.get(r.source),i=n.get(r.target),a=((d=(f=s==null?void 0:s.data)==null?void 0:f.outputs)==null?void 0:d.length)??0,l=((h=(p=i==null?void 0:i.data)==null?void 0:p.inputs)==null?void 0:h.length)??0,c=r.sourceHandle?parseInt(String(r.sourceHandle).replace("output-",""),10):0,u=r.targetHandle?parseInt(String(r.targetHandle).replace("input-",""),10):0;return s&&i&&c>=0&&c<a&&u>=0&&u<l})}function p1(e,t){const n=new RegExp(`^${t}-(\\d+)$`).exec(String(e||""));if(!n)return 0;const r=Number.parseInt(n[1],10);return Number.isFinite(r)&&r>=0?r:0}function h1(e,t){return!Array.isArray(e)||!e[t]||e[t].showOnNode===!0?e:e.map((n,r)=>r===t?{...n,showOnNode:!0}:n)}function Ny(e,t){const n=String((t==null?void 0:t.source)||""),r=String((t==null?void 0:t.target)||"");if(!n||!r)return e;const s=p1(t==null?void 0:t.sourceHandle,"output"),i=p1(t==null?void 0:t.targetHandle,"input");let a=!1;const l=(e||[]).map(c=>{var u,f,d,p;if(c.id===n){const h=h1((u=c.data)==null?void 0:u.outputs,s);if(h!==((f=c.data)==null?void 0:f.outputs))return a=!0,{...c,data:{...c.data,outputs:h}}}if(c.id===r){const h=h1((d=c.data)==null?void 0:d.inputs,i);if(h!==((p=c.data)==null?void 0:p.inputs))return a=!0,{...c,data:{...c.data,inputs:h}}}return c});return a?l:e}function tU(e){if(!e||!(e instanceof Element))return!1;if(e.closest('[contenteditable="true"]'))return!0;const t=e.tagName;return!!(t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable)}function m1(e){return e.key==="?"||e.key==="/"&&e.shiftKey}function nU(){return typeof navigator>"u"?!1:/Mac|iPhone|iPod|iPad/i.test(navigator.platform||navigator.userAgent||"")}function rU({children:e}){return o.jsx("kbd",{className:"af-kbd",children:e})}function Os({keys:e}){return o.jsx("span",{className:"af-shortcuts-keys",children:e.map((t,n)=>o.jsxs("span",{children:[n>0?o.jsx("span",{className:"af-shortcuts-keys__plus",children:"+"}):null,o.jsx(rU,{children:t})]},n))})}function sU({open:e,onClose:t}){const{t:n}=Ir(),r=m.useRef(null);if(m.useEffect(()=>{if(!e)return;const a=requestAnimationFrame(()=>{var l;return(l=r.current)==null?void 0:l.focus()});return()=>cancelAnimationFrame(a)},[e]),!e)return null;const i=nU()?"⌘":"Ctrl";return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:a=>{a.target===a.currentTarget&&t()},children:o.jsxs("div",{ref:r,className:"af-shortcuts-panel",role:"dialog","aria-modal":"true","aria-labelledby":"af-shortcuts-title",tabIndex:-1,onMouseDown:a=>a.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:"af-shortcuts-title",className:"af-shortcuts-panel__title",children:n("flow:shortcuts.title")}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":n("common:common.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-shortcuts-panel__body",children:[o.jsxs("section",{className:"af-shortcuts-section",children:[o.jsx("h3",{className:"af-shortcuts-cat",children:n("flow:shortcuts.general")}),o.jsxs("ul",{className:"af-shortcuts-list",children:[o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.saveDesc")}),o.jsx(Os,{keys:[i,"S"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.shortcutsLabel")}),o.jsx(Os,{keys:["?"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.jumpToNode")}),o.jsx(Os,{keys:[i,"K"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.openNodePalette")}),o.jsx(Os,{keys:["A"]})]})]})]}),o.jsxs("section",{className:"af-shortcuts-section",children:[o.jsx("h3",{className:"af-shortcuts-cat",children:n("flow:shortcuts.canvas")}),o.jsxs("ul",{className:"af-shortcuts-list",children:[o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.selectTool")}),o.jsx(Os,{keys:["V"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.panTool")}),o.jsx(Os,{keys:["H"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.holdSpacePan")}),o.jsx(Os,{keys:["Space"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.saveViewport")}),o.jsx(Os,{keys:["F"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.selectAll")}),o.jsx(Os,{keys:[i,"A"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.undo")}),o.jsx(Os,{keys:[i,"Z"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.redo")}),o.jsx(Os,{keys:[i,"Shift","Z"]})]})]})]})]})]})})}function iU(e,t){if(!t)return 1;const n=t.toLowerCase(),r=(e.id||"").toLowerCase(),s=(e.label||"").toLowerCase(),i=(e.definitionId||"").toLowerCase();return r===n?100:r.startsWith(n)?80:r.includes(n)?60:s.startsWith(n)?40:s.includes(n)?30:i.includes(n)?15:0}function oU({open:e,onClose:t,onJump:n,nodes:r}){const{t:s}=Ir(),[i,a]=m.useState(""),[l,c]=m.useState(0),u=m.useRef(null),f=m.useRef(null);m.useEffect(()=>{if(!e)return;a(""),c(0);const g=requestAnimationFrame(()=>{var k;return(k=u.current)==null?void 0:k.focus()});return()=>cancelAnimationFrame(g)},[e]);const d=m.useMemo(()=>{const g=(r||[]).map(y=>{var v,b,C;return{id:y.id,label:((v=y.data)==null?void 0:v.label)||"",definitionId:((b=y.data)==null?void 0:b.definitionId)||"",schemaType:((C=y.data)==null?void 0:C.schemaType)||""}}),k=i.trim(),w=g.map(y=>({e:y,s:iU(y,k)})).filter(y=>y.s>0);return w.sort((y,v)=>v.s-y.s||y.e.id.localeCompare(v.e.id)),w.slice(0,50).map(y=>y.e)},[r,i]);if(m.useEffect(()=>{l>=d.length&&c(0)},[d.length,l]),m.useEffect(()=>{var k;const g=(k=f.current)==null?void 0:k.querySelector(`[data-idx="${l}"]`);g&&g.scrollIntoView({block:"nearest"})},[l]),!e)return null;const p=g=>{const k=d[g];k&&(n(k.id),t())},h=g=>{if(g.key==="Escape"){g.preventDefault(),t();return}if(g.key==="ArrowDown"){g.preventDefault(),c(k=>Math.min(d.length-1,k+1));return}if(g.key==="ArrowUp"){g.preventDefault(),c(k=>Math.max(0,k-1));return}g.key==="Enter"&&(g.preventDefault(),p(l))};return o.jsx("div",{className:"af-jump-overlay",role:"presentation",onMouseDown:g=>{g.target===g.currentTarget&&t()},children:o.jsxs("div",{className:"af-jump-panel",role:"dialog","aria-modal":"true","aria-label":s("flow:jumpPalette.title"),onMouseDown:g=>g.stopPropagation(),children:[o.jsxs("div",{className:"af-jump-panel__input-wrap",children:[o.jsx("span",{className:"af-jump-panel__icon material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{ref:u,type:"text",className:"af-jump-panel__input",placeholder:s("flow:jumpPalette.placeholder"),value:i,onChange:g=>{a(g.target.value),c(0)},onKeyDown:h,spellCheck:!1,autoComplete:"off"}),o.jsx("span",{className:"af-jump-panel__count",children:d.length})]}),d.length===0?o.jsx("div",{className:"af-jump-panel__empty",children:s("flow:jumpPalette.empty")}):o.jsx("ul",{ref:f,className:"af-jump-panel__list",role:"listbox",children:d.map((g,k)=>o.jsxs("li",{"data-idx":k,role:"option","aria-selected":k===l,className:"af-jump-panel__item"+(k===l?" af-jump-panel__item--active":""),onMouseEnter:()=>c(k),onMouseDown:w=>{w.preventDefault(),p(k)},children:[o.jsx("span",{className:"af-jump-panel__id",children:g.id}),g.label&&g.label!==g.id&&o.jsx("span",{className:"af-jump-panel__label",children:g.label}),g.definitionId&&o.jsx("span",{className:"af-jump-panel__tag",children:g.definitionId})]},g.id))}),o.jsxs("div",{className:"af-jump-panel__hint",children:[o.jsxs("span",{children:[o.jsx("kbd",{className:"af-kbd",children:"↑"}),o.jsx("kbd",{className:"af-kbd",children:"↓"})," ",s("flow:jumpPalette.hintNavigate")]}),o.jsxs("span",{children:[o.jsx("kbd",{className:"af-kbd",children:"Enter"})," ",s("flow:jumpPalette.hintJump")]}),o.jsxs("span",{children:[o.jsx("kbd",{className:"af-kbd",children:"Esc"})," ",s("flow:jumpPalette.hintClose")]})]})]})})}function g1(e){const t=Number(e||0);if(!Number.isFinite(t)||t<=0)return"-";const n=new Date(t),r=s=>String(s).padStart(2,"0");return`${r(n.getMonth()+1)}-${r(n.getDate())} ${r(n.getHours())}:${r(n.getMinutes())}:${r(n.getSeconds())}`}function aU(e){const t=Number(e||0);if(!Number.isFinite(t)||t<=0)return"-";if(t<1e3)return`${Math.round(t)}ms`;const n=Math.round(t/1e3);if(n<60)return`${n}s`;const r=Math.floor(n/60),s=n%60;return`${r}m${String(s).padStart(2,"0")}s`}function y1(e){if(!e||typeof e!="object")return"";if(e.line)return String(e.line);if(e.text)return String(e.text);if(e.error)return String(e.error);if(e.message)return String(e.message);if(e.status)return String(e.status);if(e.type==="graph"){const n=Array.isArray(e.displayNodeIds)?e.displayNodeIds.join(", "):"";return n?`graph updated: ${n}`:"graph updated"}const t=JSON.stringify(e);return t.length>4e3?`${t.slice(0,4e3)}
|
|
100
|
-
... [truncated]`:t}function jy(e){return String((e==null?void 0:e.nodeId)||(e==null?void 0:e.runNodeId)||"")}function x1(e){const t=String(e||"").toLowerCase();return t.includes("success")?"success":t.includes("fail")||t.includes("error")?"failed":t.includes("skip")||t.includes("disabled")?"skipped":t.includes("running")?"running":t.includes("stop")?"stopped":"idle"}function lU({flowParams:e,scheduleNodeId:t="",runNodeId:n="",lastRunId:r="",label:s="",onClose:i}){const[a,l]=m.useState([]),[c,u]=m.useState(""),[f,d]=m.useState(null),[p,h]=m.useState(!1),[g,k]=m.useState(!1),[w,y]=m.useState(""),[v,b]=m.useState(""),C=m.useCallback(async()=>{if(e!=null&&e.flowId){h(!0),y("");try{const I=new URLSearchParams;I.set("flowId",e.flowId),I.set("flowSource",e.flowSource||"user"),t?I.set("scheduleNodeId",t):n&&I.set("runNodeId",n),I.set("limit","80");const D=await fetch(`/api/workspace/run-logs?${I.toString()}`),H=await D.json().catch(()=>({}));if(!D.ok)throw new Error(H.error||"读取日志失败");const V=Array.isArray(H.runs)?H.runs:[];l(V),u(F=>{const L=V[0]||null;return L&&String(L.status||"")==="running"&&L.runId!==F?L.runId:F&&V.some(M=>M.runId===F)?F:r&&V.some(M=>M.runId===r)?r:(L==null?void 0:L.runId)||""})}catch(I){y(String(I.message||I)),l([])}finally{h(!1)}}},[e==null?void 0:e.flowId,e==null?void 0:e.flowSource,r,n,t]),N=m.useCallback(async I=>{if(!I){d(null);return}k(!0);try{const D=new URLSearchParams({flowId:(e==null?void 0:e.flowId)||"",flowSource:(e==null?void 0:e.flowSource)||"user"});e!=null&&e.archived&&D.set("archived","1");const H=await fetch(`/api/workspace/run-logs/${encodeURIComponent(I)}?${D.toString()}`),V=await H.json().catch(()=>({}));if(!H.ok)throw new Error(V.error||"读取日志详情失败");d(V)}catch(D){d({error:String(D.message||D),events:[]})}finally{k(!1)}},[e==null?void 0:e.archived,e==null?void 0:e.flowId,e==null?void 0:e.flowSource]);m.useEffect(()=>{C()},[C]),m.useEffect(()=>{N(c)},[N,c]),m.useEffect(()=>{const I=a.find(H=>H.runId===c),D=window.setInterval(()=>{C(),(!I||I.status==="running")&&c&&N(c)},2e3);return()=>window.clearInterval(D)},[N,C,a,c]);const j=m.useMemo(()=>{const I=Array.isArray(f==null?void 0:f.events)?f.events:[],D=v.trim().toLowerCase();return D?I.filter(H=>String(H.type||"").toLowerCase().includes(D)||jy(H).toLowerCase().includes(D)||y1(H).toLowerCase().includes(D)):I},[f==null?void 0:f.events,v]),A=(f==null?void 0:f.run)||a.find(I=>I.runId===c)||null;return o.jsxs("div",{className:"af-work-run-logs",children:[o.jsxs("div",{className:"af-pipeline-drawer-head",children:[o.jsx("h2",{className:"af-pipeline-drawer-title",children:"执行日志"}),o.jsx("button",{type:"button",className:"af-pipeline-drawer-close af-icon-btn",onClick:i,"aria-label":"关闭日志侧栏",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-work-run-logs__meta",children:[o.jsx("span",{children:s||t||n||"Workspace Run"}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>void C(),title:"刷新日志","aria-label":"刷新日志",children:o.jsx("span",{className:"material-symbols-outlined",children:"refresh"})})]}),w?o.jsx("div",{className:"af-work-run-logs__error",children:w}):null,o.jsxs("div",{className:"af-work-run-logs__body",children:[o.jsxs("div",{className:"af-work-run-logs__list",children:[o.jsx("div",{className:"af-work-run-logs__section-title",children:"最近执行"}),p?o.jsx("div",{className:"af-work-run-logs__empty",children:"Loading..."}):null,!p&&a.length===0?o.jsx("div",{className:"af-work-run-logs__empty",children:"暂无执行日志"}):null,a.map(I=>o.jsxs("button",{type:"button",className:"af-work-run-logs__run"+(I.runId===c?" af-work-run-logs__run--active":""),onClick:()=>u(I.runId),title:I.runId,children:[o.jsx("span",{className:`af-work-run-logs__status af-work-run-logs__status--${x1(I.status)}`,children:I.status||"unknown"}),o.jsx("span",{className:"af-work-run-logs__run-label",children:I.label||I.runNodeId||I.scheduleNodeId||"Workspace Run"}),o.jsx("span",{children:g1(I.startedAt)}),o.jsx("span",{children:aU(I.durationMs)})]},I.runId))]}),o.jsxs("div",{className:"af-work-run-logs__detail",children:[o.jsxs("div",{className:"af-work-run-logs__detail-head",children:[o.jsxs("div",{children:[o.jsx("div",{className:"af-work-run-logs__section-title",children:"详情"}),A!=null&&A.label?o.jsx("div",{className:"af-work-run-logs__detail-label",children:A.label}):null,o.jsx("div",{className:"af-work-run-logs__run-id",children:(A==null?void 0:A.runId)||"-"})]}),A?o.jsx("span",{className:`af-work-run-logs__status af-work-run-logs__status--${x1(A.status)}`,children:A.status}):null]}),o.jsxs("label",{className:"af-work-run-logs__search",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{value:v,onChange:I=>b(I.target.value),placeholder:"搜索事件、节点、错误"})]}),g?o.jsx("div",{className:"af-work-run-logs__empty",children:"Loading..."}):null,f!=null&&f.error?o.jsx("div",{className:"af-work-run-logs__error",children:f.error}):null,!g&&!j.length?o.jsx("div",{className:"af-work-run-logs__empty",children:"暂无事件"}):null,o.jsx("div",{className:"af-work-run-logs__events",children:j.map((I,D)=>o.jsxs("div",{className:"af-work-run-logs__event",children:[o.jsx("span",{className:"af-work-run-logs__event-time",children:g1(I.ts)}),o.jsx("span",{className:"af-work-run-logs__event-type",children:I.type||"event"}),jy(I)?o.jsx("span",{className:"af-work-run-logs__event-node",children:jy(I)}):null,o.jsx("pre",{children:y1(I)})]},`${I.ts||D}-${D}`))})]})]})]})}function cU(e){let t=String(e||"").trim();const n=t.match(/```(?:json|jsx|tsx|javascript|js)?\s*\n?([\s\S]*?)```/i);if(n&&n[1])t=n[1].trim();else{const r=t.match(/```(?:json|jsx|tsx|javascript|js)?\s*\n?([\s\S]*)$/i);r&&r[1]&&(t=r[1].trim())}return t.replace(/```\s*$/g,"").trim()}function xR(e){const t=cU(e);if(!t)return{title:"React App",entry:"src/App.jsx",files:{"src/App.jsx":"export default function App() { return <main><h1>React App</h1><p>No project files yet.</p></main>; }"},inputs:{}};try{const n=JSON.parse(t);if(n&&typeof n=="object"&&!Array.isArray(n)){const r=n.files&&typeof n.files=="object"&&!Array.isArray(n.files)?n.files:{};return{title:String(n.title||n.name||"React App"),entry:String(n.entry||n.main||"src/App.jsx"),files:Object.fromEntries(Object.entries(r).map(([s,i])=>[String(s),String(i??"")])),packageJson:n.packageJson&&typeof n.packageJson=="object"?n.packageJson:null,inputs:n.inputs&&typeof n.inputs=="object"&&!Array.isArray(n.inputs)?n.inputs:{}}}}catch{}return{title:"React App",entry:"src/App.jsx",files:{"src/App.jsx":t},inputs:{}}}function uU(e){let t=String(e||"");return t=t.replace(/^\s*import\s+[^;]+;\s*$/gm,""),t=t.replace(/^\s*import\s+["'][^"']+["'];\s*$/gm,""),t=t.replace(/\bexport\s+default\s+function\s+([A-Za-z_$][\w$]*)\s*\(/g,"const __AgentFlowDefault = function $1("),t=t.replace(/\bexport\s+default\s+function\s*\(/g,"const __AgentFlowDefault = function App("),t=t.replace(/\bexport\s+default\s+class\s+([A-Za-z_$][\w$]*)\s+extends/g,"const __AgentFlowDefault = class $1 extends"),t=t.replace(/\bexport\s+default\s+class\s+extends/g,"const __AgentFlowDefault = class extends"),t=t.replace(/\bexport\s+default\s+(\([^)]*\)\s*=>)/g,"const __AgentFlowDefault = $1"),t=t.replace(/\bexport\s+default\s+([A-Za-z_$][\w$]*\s*=>)/g,"const __AgentFlowDefault = $1"),t=t.replace(/\bexport\s+default\s+([A-Za-z_$][\w$]*)\s*;?/g,"const __AgentFlowDefault = $1;"),t=t.replace(/\bexport\s+(const|let|var|function|class)\s+/g,"$1 "),t=t.replace(/^\s*export\s+\{[^}]+\};?\s*$/gm,""),t.trim()}function dU(e){return String(e).replace(/<\/script/gi,"<\\/script")}function Tm(e){const t=xR(e);return JSON.stringify({title:t.title,entry:t.entry,packageJson:t.packageJson||{scripts:{dev:"vite --host 0.0.0.0",build:"vite build"},dependencies:{"@vitejs/plugin-react":"latest",vite:"latest",react:"latest","react-dom":"latest"},devDependencies:{}},files:t.files,inputs:t.inputs},null,2)}function Ck(e,t=""){const n=xR(e),r=n.files||{},s=r[n.entry]!=null?n.entry:Object.keys(r).find(p=>/(?:^|\/)App\.[jt]sx$/i.test(p))||Object.keys(r).find(p=>/\.[jt]sx?$/i.test(p))||n.entry,i=uU(r[s]||""),a=Object.entries(r).filter(([p])=>/\.css$/i.test(p)).map(([,p])=>String(p||"")).join(`
|
|
101
|
-
|
|
102
|
-
`),l=String(n.title||"React App"),c=JSON.stringify(String(t||"")),u=JSON.stringify(n.inputs||{}),f=dU(i||"function App() { return <main><h1>React App</h1><p>No entry file content.</p></main>; }"),d=a||`
|
|
103
|
-
* { box-sizing: border-box; }
|
|
104
|
-
body { margin: 0; min-height: 100vh; background: #111112; color: #f4f0ff; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
|
|
105
|
-
main { min-height: 100vh; padding: 24px; }
|
|
106
|
-
button, input, select, textarea { font: inherit; }
|
|
107
|
-
`;return`<!doctype html>
|
|
108
|
-
<html>
|
|
109
|
-
<head>
|
|
110
|
-
<meta charset="utf-8" />
|
|
111
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
112
|
-
<base target="_blank" />
|
|
113
|
-
<title>${l.replace(/[<&>]/g,p=>({"<":"<",">":">","&":"&"})[p])}</title>
|
|
114
|
-
<style>${d.replace(/<\/style/gi,"<\\/style")}</style>
|
|
115
|
-
</head>
|
|
116
|
-
<body>
|
|
117
|
-
<div id="root"></div>
|
|
118
|
-
<script crossorigin src="https://unpkg.com/react@18/umd/react.production.min.js"><\/script>
|
|
119
|
-
<script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"><\/script>
|
|
120
|
-
<script crossorigin src="https://unpkg.com/@babel/standalone/babel.min.js"><\/script>
|
|
121
|
-
<script>
|
|
122
|
-
window.AGENTFLOW_INPUTS = ${u};
|
|
123
|
-
window.addEventListener("error", (event) => {
|
|
124
|
-
const root = document.getElementById("root");
|
|
125
|
-
if (root && !root.__agentflowRendered) {
|
|
126
|
-
root.innerHTML = '<pre style="margin:16px;padding:16px;border:1px solid rgba(255,117,117,.35);border-radius:8px;background:rgba(127,29,29,.18);color:#ffb8b8;white-space:pre-wrap;">' + String(event.message || event.error || 'React app failed').replace(/[<>&]/g, (ch) => ({'<':'<','>':'>','&':'&'}[ch])) + '</pre>';
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
document.addEventListener("click", (event) => {
|
|
130
|
-
const link = event.target && event.target.closest ? event.target.closest("a[href]") : null;
|
|
131
|
-
if (!link) return;
|
|
132
|
-
const rawHref = String(link.getAttribute("href") || "").trim();
|
|
133
|
-
if (!rawHref || rawHref.startsWith("#")) return;
|
|
134
|
-
if (/^javascript:/i.test(rawHref)) {
|
|
135
|
-
event.preventDefault();
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
event.preventDefault();
|
|
139
|
-
window.open(link.href, "_blank", "noopener,noreferrer");
|
|
140
|
-
}, true);
|
|
141
|
-
<\/script>
|
|
142
|
-
<script type="text/babel">
|
|
143
|
-
const { useCallback, useEffect, useMemo, useRef, useState } = React;
|
|
144
|
-
${f}
|
|
145
|
-
const RootComponent = typeof __AgentFlowDefault !== "undefined" ? __AgentFlowDefault : (typeof App !== "undefined" ? App : function MissingApp() {
|
|
146
|
-
return <main><h1>React App</h1><p>Entry file must export or define an App component.</p></main>;
|
|
147
|
-
});
|
|
148
|
-
ReactDOM.createRoot(document.getElementById("root")).render(<RootComponent inputs={window.AGENTFLOW_INPUTS} />);
|
|
149
|
-
document.getElementById("root").__agentflowRendered = true;
|
|
150
|
-
<\/script>
|
|
151
|
-
<script>
|
|
152
|
-
(() => {
|
|
153
|
-
const frameId = ${c};
|
|
154
|
-
const postSize = () => {
|
|
155
|
-
const doc = document.documentElement;
|
|
156
|
-
const body = document.body;
|
|
157
|
-
const height = Math.ceil(Math.max(
|
|
158
|
-
doc ? doc.scrollHeight : 0,
|
|
159
|
-
doc ? doc.offsetHeight : 0,
|
|
160
|
-
doc ? doc.clientHeight : 0,
|
|
161
|
-
body ? body.scrollHeight : 0,
|
|
162
|
-
body ? body.offsetHeight : 0,
|
|
163
|
-
body ? body.clientHeight : 0,
|
|
164
|
-
window.innerHeight || 0
|
|
165
|
-
));
|
|
166
|
-
window.parent.postMessage({ source: "agentflow-html-display-size", frameId, height }, "*");
|
|
167
|
-
};
|
|
168
|
-
window.addEventListener("load", postSize);
|
|
169
|
-
window.addEventListener("resize", postSize);
|
|
170
|
-
requestAnimationFrame(postSize);
|
|
171
|
-
setTimeout(postSize, 300);
|
|
172
|
-
setTimeout(postSize, 1000);
|
|
173
|
-
if (typeof ResizeObserver !== "undefined") {
|
|
174
|
-
const resizeObserver = new ResizeObserver(postSize);
|
|
175
|
-
resizeObserver.observe(document.documentElement);
|
|
176
|
-
if (document.body) resizeObserver.observe(document.body);
|
|
177
|
-
}
|
|
178
|
-
})();
|
|
179
|
-
<\/script>
|
|
180
|
-
</body>
|
|
181
|
-
</html>`}const wR=new Set(["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"]),fU=["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"];function pU(e,t){const n=e.slice(0,t),r=n.lastIndexOf("${");if(r<0)return null;const s=n.slice(r+2);return s.includes("}")?null:{atIndex:r,query:s}}function hU(e){const t=/\$\{([^}]*)\}/g,n=[];let r;for(;(r=t.exec(e))!==null;)n.push({start:r.index,end:r.index+r[0].length,key:r[1]});return n}function w1(e){const t=new Set;if(!Array.isArray(e))return t;for(const n of e){const r=(n==null?void 0:n.name)!=null?String(n.name).trim():"";r&&t.add(r)}return t}function bR(e,{inputNames:t,outputNames:n}){const r=e.trim();if(!r)return!1;if(r.startsWith("input.")){const s=r.slice(6).trim();return s!==""&&t.has(s)}if(r.startsWith("output.")){const s=r.slice(7).trim();return s!==""&&n.has(s)}if(wR.has(r)||t.has(r)||n.has(r))return!0;if(!r.includes(".")){const s=`${r}.md`;if(t.has(s)||n.has(s))return!0}return!1}function kR(e){return{inputNames:w1(e==null?void 0:e.inputs),outputNames:w1(e==null?void 0:e.outputs)}}function mU(e,t,n){const r=kR(t),s=hU(e),i=[];for(const a of s)if(!bR(a.key,r)){const l=a.key.trim()===""?n("flow:placeholder.empty"):a.key.trim();i.push({start:a.start,end:a.end,message:n("flow:placeholder.invalidPlaceholder",{hint:l})})}return i}function gU(e,t){const n=kR(t),r=/\$\{([^}]*)\}/g,s=[];let i=0,a;for(;(a=r.exec(e))!==null;){a.index>i&&s.push({kind:"plain",text:e.slice(i,a.index)});const l=a[0],c=bR(a[1],n);s.push({kind:c?"ph-valid":"ph-invalid",text:l}),i=a.index+l.length}return i<e.length&&s.push({kind:"plain",text:e.slice(i)}),s}function yU(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function xU(e){return e.map(t=>{const n=yU(t.text);return t.kind==="ph-invalid"?`<span class="af-body-ph-invalid">${n}</span>`:t.kind==="ph-valid"?`<span class="af-body-ph-valid">${n}</span>`:n}).join("")}function wU(e,t){const n=[];for(const r of(e==null?void 0:e.inputs)??[]){const s=(r==null?void 0:r.name)!=null?String(r.name).trim():"";if(!s)continue;const i=(r==null?void 0:r.type)!=null?String(r.type):"";n.push({section:"input",insert:`input.${s}`,label:s,subtitle:i?t("flow:placeholder.inputSubtitle",{type:i}):t("flow:placeholder.inputSubtitleNoType")})}for(const r of(e==null?void 0:e.outputs)??[]){const s=(r==null?void 0:r.name)!=null?String(r.name).trim():"";if(!s)continue;const i=(r==null?void 0:r.type)!=null?String(r.type):"";n.push({section:"output",insert:`output.${s}`,label:s,subtitle:i?t("flow:placeholder.outputSubtitle",{type:i}):t("flow:placeholder.outputSubtitleNoType")})}for(const r of fU)wR.has(r)&&n.push({section:"runtime",insert:r,label:r,subtitle:t("flow:placeholder.runtimeConst")});return n}function bU(e,t){const n=t.toLowerCase();return n?e.filter(r=>[r.insert,r.label,r.subtitle??""].map(i=>String(i).toLowerCase()).some(i=>i.includes(n))):e}function kU(e,t){if(!e||t<0)return null;const n=Math.min(t,e.value.length),r=getComputedStyle(e),s=document.createElement("div");s.setAttribute("aria-hidden","true"),s.style.visibility="hidden",s.style.position="fixed",s.style.top="0",s.style.left="-99999px",s.style.whiteSpace="pre-wrap",s.style.wordWrap="break-word",s.style.overflow="hidden";const i=e.clientWidth;if(i<=0)return null;s.style.width=`${i}px`,s.style.font=r.font,s.style.lineHeight=r.lineHeight,s.style.padding=r.padding,s.style.border=r.border,s.style.boxSizing=r.boxSizing,s.style.letterSpacing=r.letterSpacing,s.style.textIndent=r.textIndent,s.style.tabSize=r.tabSize||"8",s.textContent=e.value.slice(0,n);const a=document.createElement("span");a.textContent="",s.appendChild(a),document.body.appendChild(s);const l=a.getBoundingClientRect(),c=parseFloat(r.lineHeight),u=Number.isFinite(c)&&c>0?c:l.height||16;return document.body.removeChild(s),{top:l.top,left:l.left,bottom:l.bottom,height:u}}function ip({value:e,onChange:t,disabled:n,placeholder:r,rows:s=8,textareaClassName:i,ioSlots:a,variant:l="drawer",images:c,onImagesChange:u}){const{t:f}=Ir(),d=m.useId(),p=m.useRef(null),h=m.useRef(null),[g,k]=m.useState(0),[w,y]=m.useState(0),[v,b]=m.useState(null),C=m.useMemo(()=>ro(c),[c]),N=m.useMemo(()=>mU(e,a,f),[e,a,f]),j=N.length>0,A=m.useMemo(()=>gU(e,a),[e,a]),I=m.useMemo(()=>xU(A),[A]),D=m.useMemo(()=>n?null:pU(e,g),[e,g,n]),H=m.useMemo(()=>{if(!D)return[];const W=wU(a,f);return bU(W,D.query)},[D,a,f]);m.useEffect(()=>{y(W=>{const $=Math.max(0,H.length-1);return Math.min(Math.max(0,W),$)})},[H.length]);const V=m.useCallback(()=>{const W=p.current;if(!W||!D||H.length===0){b(null);return}const $=kU(W,g);if(!$){b(null);return}const R=4,B=44,_=13.5*16,X=Math.min(H.length*B+8,_);let z=$.bottom+R;z+X>window.innerHeight-8&&(z=Math.max(8,$.top-X-R));const T=288;let Z=$.left;Z=Math.max(8,Math.min(Z,window.innerWidth-T-8)),b({top:z,left:Z})},[D,H.length,g]);m.useLayoutEffect(()=>{if(!D||H.length===0){b(null);return}const W=requestAnimationFrame(()=>V());return()=>cancelAnimationFrame(W)},[D,H.length,g,e,V]),m.useEffect(()=>{if(!D||H.length===0)return;const W=()=>V();return window.addEventListener("scroll",W,!0),window.addEventListener("resize",W),()=>{window.removeEventListener("scroll",W,!0),window.removeEventListener("resize",W)}},[D,H.length,V]);const F=m.useCallback(W=>{if(!D)return;const{atIndex:$}=D,R=e.slice(0,$)+"${"+W+"}"+e.slice(g);t(R);const B=$+W.length+3;queueMicrotask(()=>{const _=p.current;_&&(_.focus(),_.setSelectionRange(B,B)),k(B)})},[D,e,g,t]),L=m.useCallback(()=>{const W=p.current,$=h.current;!W||!$||($.scrollTop=W.scrollTop,$.scrollLeft=W.scrollLeft,D&&H.length>0&&queueMicrotask(()=>V()))},[D,H.length,V]),M=m.useCallback(W=>{if(!n&&D&&H.length>0&&(W.key==="ArrowDown"||W.key==="ArrowUp"||W.key==="Enter")){if(W.key==="ArrowDown")W.preventDefault(),y($=>($+1)%H.length);else if(W.key==="ArrowUp")W.preventDefault(),y($=>($-1+H.length)%H.length);else if(W.key==="Enter"&&!W.shiftKey){W.preventDefault();const $=H[w];$&&F($.insert)}}},[n,D,H,w,F]),K=m.useCallback(async W=>{if(n||typeof u!="function")return!1;const $=await gR({files:W,body:e,images:C});return $?(t($.body),u($.images),queueMicrotask(()=>{const R=p.current;if(!R)return;R.focus();const B=$.body.length;R.setSelectionRange(B,B),k(B)}),!0):!1},[n,C,t,u,e]);return o.jsxs("div",{className:"af-body-prompt-editor"+(l==="expand"?" af-body-prompt-editor--expand":""),children:[C.length>0?o.jsx("div",{className:"af-body-image-list","aria-label":"image attachments",children:C.map((W,$)=>o.jsxs("span",{className:"af-body-image-chip",title:W.name,children:[o.jsx("img",{src:W.dataUrl,alt:""}),o.jsxs("span",{children:["[",W.label||`image ${$+1}`,"]"]})]},W.id||$))}):null,o.jsxs("div",{className:"af-body-prompt-stack",children:[o.jsx("pre",{ref:h,className:"af-body-prompt-backdrop "+i,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:I+`
|
|
182
|
-
`}}),o.jsx("textarea",{ref:p,className:"af-body-prompt-textarea "+i,rows:s,value:e,disabled:n,placeholder:r,spellCheck:!1,"aria-invalid":j,"aria-describedby":j?d:void 0,onChange:W=>{t(W.target.value),k(W.target.selectionStart??W.target.value.length)},onSelect:W=>{const $=W.target;$ instanceof HTMLTextAreaElement&&k($.selectionStart??0)},onClick:W=>{const $=W.target;$ instanceof HTMLTextAreaElement&&k($.selectionStart??0)},onKeyUp:W=>{const $=W.target;$ instanceof HTMLTextAreaElement&&k($.selectionStart??$.value.length)},onKeyDown:M,onPaste:W=>{const $=mR(W);$.length!==0&&(W.preventDefault(),K($).catch(()=>{}))},onDragOver:W=>{Bu(W).length>0&&W.preventDefault()},onDrop:W=>{const $=Bu(W);$.length!==0&&(W.preventDefault(),K($).catch(()=>{}))},onScroll:L})]}),D&&H.length>0&&v?cr.createPortal(o.jsx("ul",{className:"af-body-ph-menu af-body-ph-menu--pop af-composer-mention-menu",role:"listbox","aria-label":f("flow:nodeProps.placeholderSlots"),style:{position:"fixed",top:v.top,left:v.left,right:"auto",bottom:"auto",margin:0,zIndex:2e4},children:H.map((W,$)=>o.jsx("li",{role:"option","aria-selected":$===w,children:o.jsxs("button",{type:"button",className:"af-composer-mention-item"+($===w?" af-composer-mention-item--active":""),onMouseDown:R=>R.preventDefault(),onMouseEnter:()=>y($),onClick:()=>F(W.insert),children:[o.jsx("span",{className:"af-composer-mention-id",children:`\${${W.insert}}`}),W.subtitle?o.jsx("span",{className:"af-composer-mention-sub",children:W.subtitle}):null]})},`${W.section}-${W.insert}`))}),document.body):null,j?o.jsx("p",{id:d,className:"af-body-ph-issues",role:"status",children:N.map(W=>W.message).join(" · ")}):null]})}const vU=/^[a-zA-Z_][a-zA-Z0-9_-]*$/;function lu(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function b1({kind:e,label:t,slots:n,onSlotsChange:r,disabled:s,requiredReadonly:i=!0}){const{t:a}=Ir(),l=()=>r([...n,{type:"text",name:"",default:"",required:!1,showOnNode:!1}]),c=d=>r(n.filter((p,h)=>h!==d)),u=(d,p,h)=>{const g=n.map((k,w)=>{if(w!==d)return k;const y={...k,[p]:h};return p==="required"&&h===!0&&(y.showOnNode=!0),y});r(g)},f=e==="input"?"input":"output";return o.jsxs("div",{className:"af-node-props-field af-node-props-field--io",children:[o.jsxs("div",{className:"af-node-props-io-head",children:[o.jsx("span",{className:"af-node-props-label",children:t}),o.jsx("button",{type:"button",className:"af-btn-ghost af-node-props-io-add",onClick:l,disabled:s,"aria-label":a("flow:nodeProps.addPinAriaLabel",{label:t}),children:a("flow:nodeProps.addPin")})]}),o.jsx("p",{className:"af-node-props-io-hint",children:a("flow:nodeProps.handleHint",{prefix:f})}),n.length===0?o.jsx("p",{className:"af-node-props-io-empty",children:a(e==="input"?"flow:nodeProps.noInputPins":"flow:nodeProps.noOutputPins")}):null,n.length>0?o.jsxs("div",{className:"af-node-props-io-table",role:"group","aria-label":t,children:[o.jsxs("div",{className:"af-node-props-io-table-head","aria-hidden":!0,children:[o.jsx("span",{children:a("flow:nodeProps.handle")}),o.jsx("span",{children:a("flow:nodeProps.type")}),o.jsx("span",{children:a("flow:nodeProps.name")}),o.jsx("span",{children:a("flow:nodeProps.defaultValue")}),o.jsx("span",{children:a("flow:nodeProps.description")}),o.jsx("span",{children:a("flow:nodeProps.required")}),o.jsx("span",{children:a("flow:nodeProps.showOnNode")}),o.jsx("span",{})]}),n.map((d,p)=>o.jsxs("div",{className:"af-node-props-io-row",children:[o.jsxs("span",{className:"af-node-props-io-handle",title:`${f}-${p}`,children:[f,"-",p]}),o.jsx("select",{className:"af-node-props-input af-node-props-io-cell",value:d.type,onChange:h=>u(p,"type",h.target.value),disabled:s,"aria-label":a("flow:nodeProps.pinTypeAriaLabel",{label:t,index:p}),children:["node","text","file","bool"].map(h=>o.jsx("option",{value:h,children:h},h))}),o.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:d.name,onChange:h=>u(p,"name",h.target.value),disabled:s,spellCheck:!1,autoComplete:"off","aria-label":a("flow:nodeProps.pinNameAriaLabel",{label:t,index:p})}),o.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:d.default,onChange:h=>u(p,"default",h.target.value),disabled:s,spellCheck:!1,autoComplete:"off","aria-label":a("flow:nodeProps.pinDefaultAriaLabel",{label:t,index:p})}),o.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:d.description||"",onChange:h=>u(p,"description",h.target.value),disabled:s,spellCheck:!1,autoComplete:"off","aria-label":a("flow:nodeProps.pinDescriptionAriaLabel",{label:t,index:p})}),o.jsx("label",{className:"af-node-props-io-flag",title:a("flow:nodeProps.requiredHint"),children:o.jsx("input",{type:"checkbox",checked:!!d.required,onChange:h=>{i||u(p,"required",h.target.checked)},disabled:s||i,"aria-label":a("flow:nodeProps.pinRequiredAriaLabel",{label:t,index:p})})}),o.jsx("label",{className:"af-node-props-io-flag",title:a("flow:nodeProps.showOnNodeHint"),children:o.jsx("input",{type:"checkbox",checked:d.showOnNode!==!1,onChange:h=>u(p,"showOnNode",h.target.checked),disabled:s,"aria-label":a("flow:nodeProps.pinShowOnNodeAriaLabel",{label:t,index:p})})}),o.jsx("button",{type:"button",className:"af-icon-btn af-node-props-io-remove",onClick:()=>c(p),disabled:s,"aria-label":a("flow:nodeProps.deletePinAriaLabel",{label:t,index:p}),title:a("flow:nodeProps.deletePin"),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete"})})]},`${f}-${p}`))]}):null]})}function SU({draft:e,setDraft:t,definitionId:n,systemPromptReadonly:r,modelLists:s,disabled:i,onIdBlur:a,onClose:l,onPublishToMarketplace:c,allowEditRequiredPins:u=!1,error:f,ioSlots:d}){const{t:p}=Ir(),[h,g]=m.useState(!1),[k,w]=m.useState(!1),[y,v]=m.useState({status:"idle",message:""}),b=m.useCallback(L=>{t(M=>M&&{...M,...L})},[t]),{cursorList:C,opencodeList:N,claudeCodeList:j,codexList:A,currentNotInLists:I}=m.useMemo(()=>{const L=Array.isArray(s==null?void 0:s.cursor)?s.cursor:[],M=Array.isArray(s==null?void 0:s.opencode)?s.opencode:[],K=Array.isArray(s==null?void 0:s.claudeCode)?s.claudeCode:[],W=Array.isArray(s==null?void 0:s.codex)?s.codex:[],$=new Set([...L,...M,...K,...W].map(lu)),R=((e==null?void 0:e.model)??"").trim(),B=R.startsWith("cursor:")?R.slice(7):R.startsWith("opencode:")?R.slice(9):R.startsWith("codex:")?R.slice(6):R.startsWith("claude-code:")?R.slice(12):R,_=R&&!$.has(B)?R:"";return{cursorList:L,opencodeList:M,claudeCodeList:K,codexList:W,currentNotInLists:_}},[s,e==null?void 0:e.model]);if(!e)return null;const D=String(e.script??""),H=n==="tool_nodejs"||D.trim()!=="",V=typeof c=="function"&&!i&&(e==null?void 0:e.newId),F=async()=>{if(V){v({status:"running",message:p("flow:nodeProps.publishRunning")});try{const L=await c(e,n);v({status:"success",message:L!=null&&L.definitionId?p("flow:nodeProps.publishSuccessWithId",{id:L.definitionId}):p("flow:nodeProps.publishSuccess")})}catch(L){v({status:"error",message:String((L==null?void 0:L.message)||L)})}}};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-pipeline-drawer-head af-node-props-head",children:[o.jsx("h2",{className:"af-pipeline-drawer-title",children:p("flow:nodeProps.title")}),o.jsxs("div",{className:"af-node-props-head-actions",children:[o.jsxs("button",{type:"button",className:"af-btn-ghost af-node-props-market-btn",onClick:F,disabled:!V||y.status==="running",title:p("flow:nodeProps.publishToMarketplaceHint"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"inventory_2"}),y.status==="running"?p("flow:nodeProps.publishing"):p("flow:nodeProps.publishToMarketplace")]}),o.jsx("button",{type:"button",className:"af-btn-ghost af-node-props-close-secondary",onClick:l,children:p("common:common.close")})]})]}),o.jsxs("div",{className:"af-pipeline-drawer-body af-node-props-body",children:[f?o.jsx("p",{className:"af-err af-node-props-err",children:f}):null,y.message?o.jsx("p",{className:`af-node-props-market-status af-node-props-market-status--${y.status}`,children:y.message}):null,o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsx("span",{className:"af-node-props-label",children:p("flow:node.nodeType")}),o.jsx("div",{className:"af-pipeline-drawer-readonly af-node-props-readonly-mono",children:n})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsxs("span",{className:"af-node-props-label",children:[p("flow:nodeProps.instanceId"),o.jsx("span",{className:"af-node-props-hint",children:p("flow:node.displayNameHint")})]}),o.jsx("input",{type:"text",className:"af-node-props-input",value:e.newId,onChange:L=>b({newId:L.target.value}),onBlur:a,disabled:i,spellCheck:!1,autoComplete:"off","aria-label":p("flow:nodeProps.instanceId")})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsxs("span",{className:"af-node-props-label",children:[p("flow:node.displayName"),"(LABEL)"]}),o.jsx("input",{type:"text",className:"af-node-props-input",value:e.label,onChange:L=>b({label:L.target.value}),disabled:i,spellCheck:!1})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsxs("span",{className:"af-node-props-label",children:[p("flow:node.role"),"(ROLE)"]}),o.jsx("select",{className:"af-node-props-select",value:wd.includes(e.role)?e.role:p("flow:roles.normal"),onChange:L=>b({role:L.target.value}),disabled:i,children:wd.map(L=>o.jsx("option",{value:L,children:L},L))})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsxs("span",{className:"af-node-props-label",children:[p("flow:node.model"),"(MODEL)"]}),o.jsx("span",{className:"af-node-props-sublabel",children:p("flow:node.modelHint")}),o.jsxs("select",{className:"af-node-props-select",value:(()=>{const L=(e.model||"").trim();return L?I||L:""})(),onChange:L=>b({model:L.target.value}),disabled:i,"aria-label":p("flow:nodeProps.modelAriaLabel"),children:[o.jsx("option",{value:"",children:p("flow:node.defaultModel")}),I?o.jsxs("option",{value:I,children:[I,p("flow:nodeProps.yamlValueNotInList")]}):null,C.length>0?o.jsx("optgroup",{label:"Cursor",children:C.map(L=>o.jsx("option",{value:lu(L),children:L},`c-${L}`))}):null,N.length>0?o.jsx("optgroup",{label:"OpenCode",children:N.map(L=>o.jsx("option",{value:`opencode:${lu(L)}`,children:L},`o-${L}`))}):null,A.length>0?o.jsx("optgroup",{label:"Codex",children:A.map(L=>o.jsx("option",{value:`codex:${lu(L)}`,children:L},`codex-${L}`))}):null,j.length>0?o.jsx("optgroup",{label:"Claude Code",children:j.map(L=>o.jsx("option",{value:`claude-code:${lu(L)}`,children:L},`cc-${L}`))}):null]})]}),o.jsx(b1,{kind:"input",label:p("flow:nodeProps.inputPins"),slots:Array.isArray(e.inputs)?e.inputs:[],onSlotsChange:L=>b({inputs:L}),disabled:i,requiredReadonly:!u}),o.jsx(b1,{kind:"output",label:p("flow:nodeProps.outputPins"),slots:Array.isArray(e.outputs)?e.outputs:[],onSlotsChange:L=>b({outputs:L}),disabled:i,requiredReadonly:!u}),H?o.jsxs("div",{className:"af-pipeline-drawer-field af-node-props-field af-node-props-field--prompt",children:[o.jsxs("div",{className:"af-node-props-prompt-head",children:[o.jsxs("span",{className:"af-node-props-label",children:[p("flow:node.directCommand"),"(script)",o.jsx("span",{className:"af-node-props-hint",children:p("flow:node.scriptHint")})]}),o.jsx("button",{type:"button",className:"af-icon-btn af-node-props-expand",onClick:()=>w(!0),"aria-label":p("flow:nodeProps.expandEditScript"),title:p("flow:nodeProps.expand"),disabled:i,children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),o.jsx(ip,{value:D,onChange:L=>b({script:L}),disabled:i,placeholder:p("flow:nodeProps.scriptPlaceholder"),rows:6,textareaClassName:"af-pipeline-drawer-textarea af-node-props-body-textarea af-node-props-script-textarea",ioSlots:d,variant:"drawer"})]}):null,o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsx("span",{className:"af-node-props-label",children:"Script file(scriptRef)"}),o.jsxs("span",{className:"af-node-props-sublabel",children:["Relative path under this flow, for example nodes/",e.id,"/script.mjs"]}),o.jsx("input",{type:"text",className:"af-node-props-input",value:e.scriptRef||"",onChange:L=>b({scriptRef:L.target.value}),disabled:i,spellCheck:!1,autoComplete:"off"})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsx("span",{className:"af-node-props-label",children:"Implementation file(implementationRef)"}),o.jsxs("span",{className:"af-node-props-sublabel",children:["Relative path under this flow, for example nodes/",e.id,"/implementation.md"]}),o.jsx("input",{type:"text",className:"af-node-props-input",value:e.implementationRef||"",onChange:L=>b({implementationRef:L.target.value}),disabled:i,spellCheck:!1,autoComplete:"off"})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsx("span",{className:"af-node-props-label",children:"Implementation mode"}),o.jsxs("select",{className:"af-node-props-select",value:e.implementationMode||"",onChange:L=>b({implementationMode:L.target.value}),disabled:i,children:[o.jsx("option",{value:"",children:"auto"}),o.jsx("option",{value:"script",children:"script"}),o.jsx("option",{value:"steps",children:"steps"}),o.jsx("option",{value:"hybrid",children:"hybrid"})]})]}),o.jsxs("div",{className:"af-pipeline-drawer-field af-node-props-field af-node-props-field--prompt",children:[o.jsxs("div",{className:"af-node-props-prompt-head",children:[o.jsx("span",{className:"af-node-props-label",children:p("flow:node.userPrompt")}),o.jsx("button",{type:"button",className:"af-icon-btn af-node-props-expand",onClick:()=>g(!0),"aria-label":p("flow:nodeProps.expandEdit"),title:p("flow:nodeProps.expand"),disabled:i,children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),o.jsx(ip,{value:e.body,onChange:L=>b({body:L}),images:e.images,onImagesChange:L=>b({images:L}),disabled:i,placeholder:p("flow:nodeProps.bodyPlaceholder"),rows:8,textareaClassName:"af-pipeline-drawer-textarea af-node-props-body-textarea",ioSlots:d,variant:"drawer"})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsx("span",{className:"af-node-props-label",children:p("flow:node.systemDescription")}),o.jsx("textarea",{className:"af-pipeline-drawer-textarea af-node-props-system-readonly",rows:4,readOnly:!0,value:r||p("flow:nodeProps.noDescription"),spellCheck:!1})]})]}),k?o.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":p("flow:nodeProps.editScript"),onMouseDown:L=>{L.target===L.currentTarget&&w(!1)},children:o.jsxs("div",{className:"af-node-props-expand-panel",children:[o.jsxs("div",{className:"af-node-props-expand-head",children:[o.jsx("span",{className:"af-node-props-expand-title",children:p("flow:node.directCommand")}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>w(!1),"aria-label":p("flow:nodeProps.collapse"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx(ip,{value:D,onChange:L=>b({script:L}),disabled:i,placeholder:p("flow:nodeProps.scriptPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:d,variant:"expand"})]})}):null,h?o.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":p("flow:nodeProps.editUserPrompt"),onMouseDown:L=>{L.target===L.currentTarget&&g(!1)},children:o.jsxs("div",{className:"af-node-props-expand-panel",children:[o.jsxs("div",{className:"af-node-props-expand-head",children:[o.jsx("span",{className:"af-node-props-expand-title",children:p("flow:node.body")}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>g(!1),"aria-label":p("flow:nodeProps.collapse"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx(ip,{value:e.body,onChange:L=>b({body:L}),images:e.images,onImagesChange:L=>b({images:L}),disabled:i,placeholder:p("flow:nodeProps.bodyPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:d,variant:"expand"})]})}):null]})}function NU({open:e,onClose:t,flowId:n,flowSource:r,onArchived:s}){const{t:i}=Ir(),a=m.useId(),l=m.useRef(null),[c,u]=m.useState(""),[f,d]=m.useState(!1),[p,h]=m.useState("");if(m.useEffect(()=>{if(!e)return;u(""),h(""),d(!1);const y=requestAnimationFrame(()=>{var v;return(v=l.current)==null?void 0:v.focus()});return()=>cancelAnimationFrame(y)},[e,n]),!e)return null;const g=c.trim(),k=g===n;async function w(y){if(y.preventDefault(),!(!k||f)){d(!0),h("");try{const v=await fetch("/api/flow/archive",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:n,flowSource:r,confirmFlowId:g})}),b=await v.json().catch(()=>({}));if(!v.ok){h(typeof b.error=="string"?b.error:i("project:archiveModal.archiveFailed"));return}s()}catch(v){h(String((v==null?void 0:v.message)||v))}finally{d(!1)}}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:y=>{y.target===y.currentTarget&&t()},children:o.jsxs("div",{ref:l,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":a,tabIndex:-1,onMouseDown:y=>y.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:a,className:"af-shortcuts-panel__title",children:i("project:archiveModal.title")}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":i("project:archiveModal.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:w,children:[o.jsx("p",{className:"af-new-pipeline-lead",children:i("project:archiveModal.lead",{flowId:n})}),o.jsxs("label",{className:"af-new-pipeline-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:i("project:archiveModal.confirmLabel")}),o.jsx("input",{type:"text",className:"af-new-pipeline-input",value:c,onChange:y=>u(y.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":g.length>0&&!k})]}),p?o.jsx("p",{className:"af-err af-new-pipeline-err",children:p}):null,o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:f,children:i("project:archiveModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!k||f,children:i(f?"project:archiveModal.archiving":"project:archiveModal.confirmArchive")})]})]})]})})}function jU({open:e,onClose:t,flowId:n,flowSource:r,flowArchived:s=!1,workspaceId:i="",leaveShared:a=!1,onDeleted:l}){const{t:c}=Ir(),u=m.useId(),f=m.useRef(null),[d,p]=m.useState(""),[h,g]=m.useState(!1),[k,w]=m.useState("");if(m.useEffect(()=>{if(!e)return;p(""),w(""),g(!1);const C=requestAnimationFrame(()=>{var N;return(N=f.current)==null?void 0:N.focus()});return()=>cancelAnimationFrame(C)},[e,n]),!e)return null;const y=d.trim(),v=a||y===n;async function b(C){if(C.preventDefault(),!v||h)return;g(!0),w("");let N=null;try{const j=new AbortController;N=setTimeout(()=>j.abort(),15e3);const A=await fetch("/api/flow/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:n,flowSource:r,confirmFlowId:a?n:y,flowArchived:s,workspaceId:i}),signal:j.signal}),I=await A.json().catch(()=>({}));if(!A.ok){w(typeof I.error=="string"?I.error:c("project:deleteModal.deleteFailed"));return}try{for(let D=localStorage.length-1;D>=0;D--){const H=localStorage.key(D);H&&(H.startsWith(`af:composer-sessions:${n}:${r}`)||H.startsWith(`af:composer-active-session:${n}:${r}`)||H.startsWith(`af:workspace-composer:${n}:${r}`))&&localStorage.removeItem(H)}}catch{}await l()}catch(j){if((j==null?void 0:j.name)==="AbortError"){w(c("project:deleteModal.deleteTimeout"));return}w(String((j==null?void 0:j.message)||j))}finally{N&&clearTimeout(N),g(!1)}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:C=>{C.target===C.currentTarget&&t()},children:o.jsxs("div",{ref:f,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":u,tabIndex:-1,onMouseDown:C=>C.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:u,className:"af-shortcuts-panel__title",children:a?"退出共享 Workspace":c("project:deleteModal.title")}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":c("project:deleteModal.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:b,children:[o.jsx("p",{className:"af-new-pipeline-lead",children:a?`退出后,${n} 将从你的项目列表移除;源项目和其他成员的数据不会被删除。`:c("project:deleteModal.lead",{flowId:n})}),a?null:o.jsxs("label",{className:"af-new-pipeline-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:c("project:deleteModal.confirmLabel")}),o.jsx("input",{type:"text",className:"af-new-pipeline-input",value:d,onChange:C=>p(C.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":y.length>0&&!v})]}),k?o.jsx("p",{className:"af-err af-new-pipeline-err",children:k}):null,o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:h,children:c("project:deleteModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary af-btn-destructive",disabled:!v||h,children:h?a?"退出中...":c("project:deleteModal.deleting"):a?"确认退出":c("project:deleteModal.confirmDelete")})]})]})]})})}const k1=80,CU=220;function _U(e){if(!e||typeof e!="object")return e;const{selected:t,dragging:n,resizing:r,className:s,positionAbsolute:i,measured:a,internals:l,...c}=e;return c}function EU(e){if(!e||typeof e!="object")return e;const{selected:t,className:n,...r}=e;return r}function op(e,t,n){const r={nodes:Array.isArray(e)?e.map(_U):[],edges:Array.isArray(t)?t.map(EU):[],extra:n&&typeof n=="object"?n:{}},s=JSON.stringify(r);return{value:JSON.parse(s),signature:s}}function Cy(e,t){const n=[...e,t];return n.length>k1?n.slice(n.length-k1):n}function AU({nodes:e,edges:t,extra:n,enabled:r=!0,onRestore:s}){const[i,a]=m.useState(0),l=m.useRef([]),c=m.useRef([]),u=m.useRef(null),f=m.useRef(null),d=m.useRef(null),p=m.useRef(null),h=m.useRef(!1),g=m.useCallback(()=>a(N=>N+1),[]),k=m.useCallback(()=>{p.current&&(window.clearTimeout(p.current),p.current=null)},[]),w=m.useCallback(()=>{k();const N=f.current,j=d.current;return f.current=null,d.current=null,!N||!j||N.signature===j.signature?(j&&(u.current=j),!1):(l.current=Cy(l.current,N),c.current=[],u.current=j,g(),!0)},[g,k]),y=m.useCallback((N=[],j=[],A={})=>{k(),l.current=[],c.current=[],f.current=null,d.current=null,u.current=op(N,j,A),h.current=!1,g()},[g,k]),v=m.useCallback(N=>{h.current=!0,u.current=N,f.current=null,d.current=null,k(),s==null||s(N.value),g()},[g,k,s]),b=m.useCallback(()=>{w();const N=u.current||op(e,t,n),j=l.current.pop();return j?(c.current=Cy(c.current,N),v(j),!0):(g(),!1)},[g,t,n,w,e,v]),C=m.useCallback(()=>{w();const N=u.current||op(e,t,n),j=c.current.pop();return j?(l.current=Cy(l.current,N),v(j),!0):(g(),!1)},[g,t,n,w,e,v]);return m.useEffect(()=>()=>k(),[k]),m.useEffect(()=>{if(!r)return;const N=op(e,t,n);if(!u.current){u.current=N;return}if(h.current){h.current=!1,u.current=N;return}N.signature!==u.current.signature&&(f.current||(f.current=u.current),d.current=N,k(),p.current=window.setTimeout(()=>{w()},CU))},[k,t,r,n,w,e]),{canUndo:l.current.length>0||!!f.current,canRedo:c.current.length>0,resetHistory:y,undo:b,redo:C,version:i}}function PU({background:e=!1,requestId:t=0,currentRequestId:n=0,dirty:r=!1,startedEditVersion:s=0,currentEditVersion:i=0,startedRevision:a="",currentRevision:l=""}={}){return t!==n?"superseded":e&&(r||i!==s||l!==a)?"local-edits":""}function IU({savedGraph:e,sentGraph:t,savedRevision:n="",currentRevision:r=""}={}){return{graph:e||t||null,revision:String(n||r||"")}}const RU="af:workspace-graph:v2",v1="agentflow.workspace.sidebarCollapsed",bl=["DISPLAY","CONTROL","TOOL","PROVIDE","AGENT"],TU=new Set(["control_start","control_end","control_load_skills","control_load_mcp","control_cd_workspace","control_user_workspace"]),MU={id:"workspace_run",displayName:"Run",label:"Run",description:"Run the downstream workspace subgraph connected from this node.",type:"control",inputs:[{type:"node",name:"prev",default:""}],outputs:[{type:"node",name:"next",default:""}]},$U={id:"workspace_scheduled_run",displayName:"Scheduled Run",label:"Scheduled Run",description:"Run the downstream workspace subgraph on a schedule.",type:"control",inputs:[{type:"node",name:"prev",default:""}],outputs:[{type:"node",name:"next",default:""}]},LU={id:"control_load_skills",displayName:"Load Skills",label:"Load Skills",description:"Load the currently selected Workspace skill collection for downstream agent nodes.",type:"control",inputs:[{type:"node",name:"prev",default:""},{type:"text",name:"skillKeys",default:"",showOnNode:!1}],outputs:[{type:"node",name:"next",default:""},{type:"text",name:"skillsContext",default:"",showOnNode:!0}]},OU={id:"control_load_mcp",displayName:"Load MCP",label:"Load MCP",description:"Load selected Cursor MCP server tool manifests for downstream agent nodes.",type:"control",inputs:[{type:"node",name:"prev",default:""},{type:"text",name:"serverNames",default:"",showOnNode:!1}],outputs:[{type:"node",name:"next",default:""},{type:"text",name:"mcpContext",default:"",showOnNode:!0}]},DU={id:"control_cd_workspace",displayName:"加载知识库",label:"加载知识库",description:"Select one or more knowledge sources and pass knowledgeContext to downstream nodes.",type:"control",inputs:[{type:"node",name:"prev",default:""},{type:"text",name:"path",default:"",showOnNode:!1},{type:"text",name:"label",default:"",showOnNode:!1},{type:"text",name:"knowledgeContext",default:"",showOnNode:!1},{type:"text",name:"workspaceContext",default:"",showOnNode:!1}],outputs:[{type:"node",name:"next",default:""},{type:"text",name:"knowledgeContext",default:"",showOnNode:!0},{type:"text",name:"workspaceContext",default:"",showOnNode:!1},{type:"file",name:"cwd",default:"",showOnNode:!1}]},FU={id:"workspace_one_click_task",displayName:"一键任务",label:"一键任务",description:"输入任务,选择 Skills、workspace 上下文和输出类型后直接运行。",type:"agent",inputs:[{type:"node",name:"prev",default:""},{type:"text",name:"skillKeys",default:"",showOnNode:!1},{type:"bool",name:"includeWorkspaceContext",default:"true",showOnNode:!1},{type:"text",name:"displayType",default:"markdown",showOnNode:!1},{type:"text",name:"knowledgeContext",default:"",showOnNode:!1},{type:"text",name:"workspaceContext",default:"",showOnNode:!1}],outputs:[{type:"node",name:"next",default:""},{type:"text",name:"content",default:"",showOnNode:!0},{type:"text",name:"displayType",default:"markdown",showOnNode:!1}]},zU=new Set(["png","jpg","jpeg","gif","webp","svg"]),vR=320,SR=180,NR=960,Th=96,jR=900,Cw=520,_w=320,ap=52,Da=240,Fa=160,Ew="display-ref:",kd="0 9 * * *",BU="Asia/Shanghai",HU="0.1.103";function WU(){const e=new URLSearchParams(window.location.search);return{flowId:e.get("flowId")||"",flowSource:e.get("flowSource")||"user",workspaceId:e.get("workspaceId")||"",archived:e.get("archived")==="1"||e.get("flowArchived")==="1"}}function Cr(e){const t=new URLSearchParams;return e.flowId&&t.set("flowId",e.flowId),e.flowSource&&t.set("flowSource",e.flowSource),e.workspaceId&&t.set("workspaceId",e.workspaceId),e.archived&&t.set("archived","1"),t}function _k(e,t=4e3){const n=String(e??"").trim();return n?n.length>t?`${n.slice(0,t)}
|
|
183
|
-
...[truncated ${n.length-t} chars]`:n:""}function VU(e){const t=_k(e==null?void 0:e.text,4e3);return t?{role:(e==null?void 0:e.role)==="user"?"user":"assistant",...e!=null&&e.kind?{kind:String(e.kind)}:{},text:t,...e!=null&&e.error?{error:!0}:{},at:Number.isFinite(Number(e==null?void 0:e.at))?Number(e.at):Date.now()}:null}function Ek(e,t=80){return(Array.isArray(e)?e:[]).map(VU).filter(Boolean).slice(-t)}function KU(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n={};for(const[r,s]of Object.entries(t).slice(-80)){const i=String(r||"").trim();if(!i||!s||typeof s!="object")continue;const a=Ek(s.messages,40),l=_k(s.draft||"",2e3);!a.length&&!l||(n[i]={sessionId:String(s.sessionId||`nodechat_${i}`),messages:a,...l?{draft:l}:{},candidateContent:"",running:!1,error:""})}return n}function UU(e){return(Array.isArray(e)?e:[]).map(t=>{const n=String((t==null?void 0:t.id)||"").trim();if(!n)return null;const r=Ek(t==null?void 0:t.messages,80);if(!r.length)return null;const s=String((t==null?void 0:t.status)||"done");return{id:n,label:_k((t==null?void 0:t.label)||n,120),status:s==="failed"?"failed":"done",messages:r}}).filter(Boolean).slice(-20)}function S1(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=t.composer&&typeof t.composer=="object"&&!Array.isArray(t.composer)?t.composer:{};return{composer:{activeSessionId:String(n.activeSessionId||"workspace").trim()||"workspace",messages:Ek(n.messages,100),runSessions:UU(n.runSessions)},nodeChats:KU(t.nodeChats)}}function Mh(e){if(!e)return!1;const t=String(e.type||"");if(t&&/^image\//i.test(t))return!0;const n=String(e.name||"").toLowerCase().split(".").pop();return zU.has(n)}function vd(e,t,n={}){const r=String(e||"").trim();if(!r)return"";if(/^(?:https?:|data:|blob:|file:)/i.test(r)||r.startsWith("/"))return r;const s=Cr(t||{});return s.set("path",r),n.download&&s.set("download","1"),`/api/workspace/file/raw?${s.toString()}`}function qU(e){const t=String((e==null?void 0:e.flowId)||"").trim();if(!t)return"";const n=String((e==null?void 0:e.flowSource)||"user").trim()||"user";return`af:composer-skills:workspace:${t}:${n}${e!=null&&e.archived?":archived":""}`}function YU(e){const t=String((e==null?void 0:e.username)||(e==null?void 0:e.userId)||"").trim();return t?`${v1}:${t}`:v1}function GU(e){try{const t=window.localStorage.getItem(e);if(t==="false")return!1;if(t==="true")return!0}catch{}return!0}function N1(e){return!e||typeof e.closest!="function"?!1:!!e.closest("input, textarea, select, [contenteditable='true']")}function JU(e){var t;if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)return Number(e.selectionStart??0)!==Number(e.selectionEnd??0);if(e instanceof Element&&e.closest('[contenteditable="true"]')){const n=(t=window.getSelection)==null?void 0:t.call(window);return!!(n&&!n.isCollapsed)}return!1}function XU(e){return!e||typeof e.closest!="function"?!1:!!e.closest(".af-flow-node__prompt-stack")&&!JU(e)}function QU(e){const t=String(e||"").trim();if(!t||ZU(t))return"";if(/^运行完成/.test(t))return"运行完成";if(/^运行暂停/.test(t))return"运行暂停";if(/^运行停止/.test(t))return"运行停止";if(/^思考中/.test(t))return"模型正在思考";if(/^生成回复中/.test(t))return"模型正在生成回复";if(/^Timing\s+(.+?):\s+(\d+)ms/i.test(t)){const n=t.match(/^Timing\s+(.+?):\s+(\d+)ms/i);return`耗时:${(n==null?void 0:n[1])||"step"} ${(n==null?void 0:n[2])||"0"}ms`}if(/^工具\s+(.+?)(?:\s+\((started|completed)\))?$/i.test(t)){const n=t.match(/^工具\s+(.+?)(?:\s+\((started|completed)\))?$/i),r=String((n==null?void 0:n[1])||"tool").trim(),s=String((n==null?void 0:n[2])||"").toLowerCase();if(r==="thinking")return"模型正在思考";const i=r==="readToolCall"?"读取文件/上下文":r==="grepToolCall"?"搜索代码":r==="editToolCall"?"编辑文件":r;return s==="completed"?`完成:${i}`:`执行:${i}`}return/^\[stderr\]/.test(t)?t:""}function ZU(e){return/^\[stderr\]/.test(e)?/Reading additional input from stdin/i.test(e)||/rmcp::transport::worker/i.test(e)||/Transport channel closed/i.test(e)||/http\/request failed/i.test(e)||/AuthRequiredError/i.test(e)||/No access token was provided/i.test(e)||/api\.githubcopilot\.com/i.test(e):!1}function eq(e){const t=String(e||"").trim();return t?/^模型/.test(t)?"model":/^(执行|完成|耗时):/.test(t)?"tool":/^运行/.test(t)?"run":/^\[stderr\]/.test(t)?"error":"other":"other"}function _y(e,t,n,r="Workspace Run"){var c;const s=String(n||"").trim(),i=Array.isArray(e)?e.find(u=>String((u==null?void 0:u.id)||"")===s):null,a=t&&typeof t=="object"?t[s]:null;return String(((c=i==null?void 0:i.data)==null?void 0:c.label)||(a==null?void 0:a.label)||"").trim()||s||r}function Ey(e,t,n="Workspace Run"){const r=String(e||"").trim()||n,s=String(t||"").trim();return!s||r===s?r:`${r} (${s})`}function ma(e){const t=Math.max(0,Number(e)||0);if(t<1e3)return`${t}ms`;if(t<6e4)return`${(t/1e3).toFixed(t<1e4?1:0)}s`;const n=Math.floor(t/6e4),r=Math.round(t%6e4/1e3);return`${n}m${r?`${r}s`:""}`}function j1(e){const t=String(e||"").trim().toLowerCase();return{unselected:"未选择需求",unavailable:"未连接",json_unsupported:"待升级",command_failed:"读取失败",uninitialized:"未初始化",preflight_blocked:"环境阻塞",tech_design_missing:"缺技术方案",tech_design_draft_review:"方案待确认",tech_design_confirmed:"方案已确认",baseline_missing:"缺基线",plan_missing:"缺计划",plan_draft_review:"计划待确认",issue_binding_missing:"待绑定 Issue",ready_for_implementation:"待实现",implementation_ready:"待实现",implementing:"实现中",implementation_in_progress:"实现中",implementation_review:"实现待审",self_test_ready:"待自测",bugfix:"修 Bug",fix_ready:"待修复",fix_in_progress:"修复中",testing:"已提测",done:"完成",blocked:"阻塞",conflict:"冲突",requirement_changed:"需求变更"}[t]||t||"未知"}function tq(e){const t=String(e||"").trim().toLowerCase();return!t||["unselected","unavailable","json_unsupported","command_failed","uninitialized","preflight_blocked"].includes(t)?-1:/done|complete|closed|finished/.test(t)?3:/bug|fix|testing|test|self_test|submit_test/.test(t)?2:/implement|development|ready_for_implementation|issue_binding|gitlab|mr/.test(t)?1:0}function nq(e){const t=tq(e);return["方案确定","开发","Bug 修复","完成"].map((n,r)=>{let s="pending";return t>r?s="done":t===r&&(s=r===3?"done":"current"),{label:n,status:s}})}function CR(e){const t=String(e||"").trim();if(!/^https?:\/\//i.test(t))return t;try{const n=new URL(t);if(n.hostname==="0.0.0.0"||n.hostname==="::"||n.hostname==="[::]"){const r=window.location.hostname;n.hostname=r&&r!=="0.0.0.0"&&r!=="::"?r:"127.0.0.1"}return n.href}catch{return t}}function $h(e){const t=String((e==null?void 0:e.url)||(e==null?void 0:e.href)||"").trim();if(t)return CR(t);const n=String((e==null?void 0:e.path)||"").trim();return n?`file://${n}`:""}function Qo(e){const t=String(e||"").trim().toLowerCase();return["done","success","completed","passed"].includes(t)?"done":["current","running","active","next"].includes(t)?"current":["observed","observation"].includes(t)?"observed":["superseded","stale","replaced"].includes(t)?"superseded":["blocked","failed","error","conflict"].includes(t)?"blocked":"pending"}function za(e){if(!e||typeof e!="object")return"";const t=String(e.truth||e.stateTruth||e.state_truth||"").trim().toLowerCase();return t||(String(e.idempotencyKey||e.idempotency_key||"").trim().startsWith("snapshot-action:")||String(e.source||"")==="prd-flow-client"&&String(e.type||"")==="workflow-action"?"observation":String(e.type||"")==="review-link"?"runtime_event":"")}function Ak(e){return Qo(e==null?void 0:e.status)==="done"&&za(e)!=="observation"}function qi(e,t){return!e||typeof e!="object"?`Action ${t+1}`:String(e.title||e.label||e.name||e.actionLabel||e.action_label||e.id||e.action||`Action ${t+1}`)}function Bp(e){return!e||typeof e!="object"?"":String(e.detail||e.description||e.summary||e.message||e.reason||"")}function Pk(e){return!e||typeof e!="object"?"":[e.code,e.action,e.actionId,e.action_id,e.stage,e.stageKey,e.stage_key,e.type,e.title].map(t=>String(t||"")).join(" ").toLowerCase()}function rq(e,t="当前任务"){const r=[e==null?void 0:e.issueLabel,e==null?void 0:e.issue_label,e==null?void 0:e.title,e==null?void 0:e.label,e==null?void 0:e.name].map(s=>String(s||"")).join(" ").match(/\b(Issue\d+|Bug\d+)\b/i);return r?r[1].replace(/^issue/i,"Issue").replace(/^bug/i,"Bug"):t}function sq(e,t){const n=qi(e,t),r=Qo(e==null?void 0:e.status),s=Ak(e),a=`${Ba(e)} ${Pk(e)}`,l=rq(e);if(/issue-plan:|plan_draft_local|submit-plan|plan-doc|plan_doc_confirmed/.test(a)){if(s)return`${l} 方案已确认`;if(r==="observed"||r==="superseded"||za(e)==="observation")return`${l} 方案状态已观察`;if(r==="current"&&/^确认\s+/.test(n))return n}if(/issue-gitlab:|gitlab_issue_missing|ensure-gitlab-issue/.test(a)){if(s)return`已为 ${l} 创建/绑定 GitLab Issue`;if(r==="observed"||r==="superseded"||za(e)==="observation")return`${l} GitLab Issue 状态已观察`}return/implementation_in_progress|impl_in_progress/.test(a)?`正在实现 ${l}`:/implementation_ready/.test(a)?`可以开始实现 ${l}`:n}function iq(e){if(!e||typeof e!="object")return"";const t=Qo(e.status),n=za(e),r=Ak(e),i=`${Ba(e)} ${Pk(e)}`,a=Mm(e),l=a.some(d=>/方案|plan|markdown|review|预览/i.test(String(d.label||""))),c=a.some(d=>/gitlab issue/i.test(String(d.label||""))),u=a.some(d=>/gitlab epic/i.test(String(d.label||"")));if(/issue-plan:|plan_draft_local|submit-plan|plan-doc|plan_doc_confirmed/.test(i))return r?l?"方案已确认并归档;可从下方打开方案文档预览。":"方案已确认并归档。":n==="observation"||t==="observed"?"客户端上报了当前方案阶段;这不是 ai-doc 确认结果。":t==="superseded"?"该客户端观察已被更新状态替代,仅保留为运行态记录。":t==="current"?"方案草稿已生成,等待确认;确认后会归档为正式方案。":"方案草稿已生成,等待确认。";if(/issue-gitlab:|gitlab_issue_missing|ensure-gitlab-issue/.test(i))return r?c&&u?"GitLab Issue 和 Epic 已绑定;可从下方打开关联链接。":c?"GitLab Issue 已绑定;可从下方打开关联链接。":"GitLab Issue 绑定步骤已完成。":n==="observation"||t==="observed"?"客户端上报了 GitLab Issue 阶段;是否已绑定以 GitLab/ai-doc 事实为准。":t==="superseded"?"该客户端观察已被更新状态替代,仅保留为运行态记录。":"方案文档已归档,等待创建或绑定 GitLab Issue。";if(/implementation_in_progress|impl_in_progress/.test(i))return"需求分支已就绪,当前处于实现中;实现 MR 创建后会记录到本 Issue。";if(/implementation_ready/.test(i))return"方案文档和 GitLab Issue 已就绪,等待开始实现。";const f=Bp(e);return f?f.length>180&&a.length?"相关结果和产物已更新;可从下方链接查看。":f:""}function Lh(e){return!e||typeof e!="object"?"":String(e.time||e.at||e.observedAt||e.observed_at||e.reportedAt||e.reported_at||e.startedAt||e.started_at||e.completedAt||e.completed_at||e.updatedAt||e.updated_at||e.createdAt||e.created_at||"")}const _R="Asia/Shanghai",oq=new Intl.DateTimeFormat("zh-CN",{timeZone:_R,year:"numeric",month:"2-digit",day:"2-digit"}),aq=new Intl.DateTimeFormat("zh-CN",{timeZone:_R,hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1});function ER(e){const t=Lh(e);if(!t)return null;const n=Date.parse(t);return Number.isFinite(n)?new Date(n):null}function lq(e){const t=ER(e);return t?oq.format(t).replace(/\//g,"-"):"无时间"}function cq(e){const t=ER(e);return t?aq.format(t):""}function uq(e=[]){const t=[];return(Array.isArray(e)?e:[]).forEach((n,r)=>{const s=lq(n);let i=t[t.length-1];(!i||i.day!==s)&&(i={day:s,items:[]},t.push(i)),i.items.push({item:n,index:r})}),t}function AR(e){const t=Qo(e);return t==="done"?"完成":t==="current"?"当前":t==="observed"?"已观察":t==="superseded"?"已更新":t==="blocked"?"阻塞":"待处理"}function Oh(e){const t=String(e||"").trim(),n=t.toLowerCase();return n==="android"?"Android":n==="ios"?"iOS":["all","both","cross-platform","cross_platform"].includes(n)?"双端":t}function dq(e){const t=Qo(e==null?void 0:e.status);return za(e)==="observation"&&t==="done"?"已观察":AR(t)}function PR(e){if(!e||typeof e!="object")return[];const t=[],n=(i,a,l)=>{const c=String(l||"").trim();c&&t.push({key:`${i}:${c}`,type:i,label:String(a||c),value:c})},r=Qo(e.status),s=za(e)==="observation"&&r==="done"?"observed":r;return n("status",AR(s),s),n("issue",e.issueKey||e.issue_key||e.issue,e.issueKey||e.issue_key||e.issue),n("platform",Oh(e.platform),e.platform),t}function fq(e=[]){const t=new Map;return(Array.isArray(e)?e:[]).forEach(n=>{PR(n).forEach(r=>{const s=t.get(r.key);t.set(r.key,{...r,count:((s==null?void 0:s.count)||0)+1})})}),Array.from(t.values()).sort((n,r)=>{const s={status:0,issue:1,platform:2,source:3,actor:4};return(s[n.type]??9)-(s[r.type]??9)||r.count-n.count||n.label.localeCompare(r.label)})}function pq(e,t){const n=String(t||"all");return!n||n==="all"?!0:PR(e).some(r=>r.key===n)}function hq(e){if(!e||typeof e!="object")return[];const t=[],n=(r,s)=>{const i=String(s||"").trim();i&&t.push({label:r,value:i})};return n("Issue",e.issueKey||e.issue_key||e.issue),n("平台",Oh(e.platform)),t}function Mm(e){const t=[],n=(c,u)=>{const f=CR(u);f&&t.push({label:String(c||f).trim()||f,href:f})},r=(c,u="链接",f=0)=>{if(f>3||c==null)return;if(typeof c=="string"){(/^(https?:\/\/|file:\/\/)/i.test(c)||c.startsWith("/"))&&n(u,c);return}if(Array.isArray(c)){c.forEach((p,h)=>r(p,`${u} ${h+1}`,f+1));return}if(typeof c!="object")return;const d=c.label||c.title||c.name||c.kind||c.type||u;n(d,c.url||c.href||c.path||c.file||c.filePath||c.file_path);for(const p of["links","urls","artifacts","outputs","output","results","result","files"])c[p]!=null&&r(c[p],p,f+1)},s=Array.isArray(e==null?void 0:e.links)?e.links:[];for(const c of s)typeof c=="string"?n("链接",c):n((c==null?void 0:c.label)||(c==null?void 0:c.title)||(c==null?void 0:c.kind)||"链接",(c==null?void 0:c.url)||(c==null?void 0:c.href));for(const c of Array.isArray(e==null?void 0:e.artifacts)?e.artifacts:[])n((c==null?void 0:c.label)||(c==null?void 0:c.title)||(c==null?void 0:c.kind)||"Artifact",$h(c));n("TAPD",(e==null?void 0:e.tapdUrl)||(e==null?void 0:e.tapd_url)),n("ai-doc",(e==null?void 0:e.docUrl)||(e==null?void 0:e.doc_url)||(e==null?void 0:e.aiDocUrl)||(e==null?void 0:e.ai_doc_url)),n("Plan",(e==null?void 0:e.planDocUrl)||(e==null?void 0:e.plan_doc_url)||(e==null?void 0:e.planUrl)||(e==null?void 0:e.plan_url)),n("Issue",(e==null?void 0:e.issueUrl)||(e==null?void 0:e.issue_url)),n("GitLab Issue",(e==null?void 0:e.gitlabIssue)||(e==null?void 0:e.gitlab_issue)),n("GitLab Epic",(e==null?void 0:e.gitlabEpic)||(e==null?void 0:e.gitlab_epic)),n("MR",(e==null?void 0:e.mrUrl)||(e==null?void 0:e.mr_url)||(e==null?void 0:e.mergeRequestUrl)||(e==null?void 0:e.merge_request_url)),n("实现 MR",(e==null?void 0:e.implMr)||(e==null?void 0:e.impl_mr)),n("修复 MR",(e==null?void 0:e.fixMr)||(e==null?void 0:e.fix_mr)),n("提测 MR",(e==null?void 0:e.testMr)||(e==null?void 0:e.test_mr)),n("集成 MR",(e==null?void 0:e.integrationMr)||(e==null?void 0:e.integration_mr)),n("Jenkins",(e==null?void 0:e.jenkinsUrl)||(e==null?void 0:e.jenkins_url)||(e==null?void 0:e.jenkinsBuildUrl)||(e==null?void 0:e.jenkins_build_url)),n("安装包",(e==null?void 0:e.jenkinsPackageUrl)||(e==null?void 0:e.jenkins_package_url)),n("二维码",(e==null?void 0:e.jenkinsQrUrl)||(e==null?void 0:e.jenkins_qr_url)),n("调整",(e==null?void 0:e.editUrl)||(e==null?void 0:e.edit_url)||(e==null?void 0:e.adjustUrl)||(e==null?void 0:e.adjust_url)),n("链接",(e==null?void 0:e.url)||(e==null?void 0:e.href)),r(e==null?void 0:e.urls,"URL"),r(e==null?void 0:e.outputs,"产物"),r(e==null?void 0:e.output,"产物"),r(e==null?void 0:e.results,"结果"),r(e==null?void 0:e.result,"结果"),r(e==null?void 0:e.files,"文件");const i=c=>{const u=String(c||"").trim();try{const f=new URL(u,window.location.origin);return`${f.origin}${f.pathname}`}catch{return u.split(/[?#]/)[0]}},a=c=>{const u=String(c||"");return/方案文档/.test(u)?50:/临时/.test(u)?40:/Markdown Review/i.test(u)?20:/预览|review/i.test(u)?10:0},l=new Map;for(const c of t){const u=/\/api\/prd-workflow\/review\//.test(String(c.href||"")),f=u?`review:${i(c.href)}`:`${c.label}
|
|
184
|
-
${c.href}`,d=l.get(f);if(!d){l.set(f,c);continue}if(u){const p=a(d.label),h=a(c.label);(h>p||h===p&&String(c.label||"").length>String(d.label||"").length)&&l.set(f,c)}}return Array.from(l.values())}function IR(e){const t=String((e==null?void 0:e.href)||(e==null?void 0:e.url)||"").trim(),n=[e==null?void 0:e.label,e==null?void 0:e.title,e==null?void 0:e.kind,e==null?void 0:e.type,e==null?void 0:e.source,t].map(r=>String(r||"")).join(" ");return/gitlab|merge[_ -]?request|jenkins|tapd/i.test(n)?!1:/ai[-_ ]?doc|方案文档|技术方案|设计文档|代码审查|code review|markdown review|文档预览|\/api\/prd-workflow\/review\//i.test(n)}function mq(e,t=[]){const n=[],r=(l,c={})=>{const u=f=>{const d={label:String(f.label||"ai-doc").trim()||"ai-doc",href:String(f.href||f.url||"").trim(),kind:String(f.kind||f.type||"").trim()};d.href&&IR(d)&&n.push({...c,...d,kind:c.displayKind||d.kind||"ai-doc"})};for(const f of Array.isArray(l==null?void 0:l.artifacts)?l.artifacts:[])!f||typeof f!="object"||u({...f,label:f.label||f.title||f.kind||"ai-doc",href:$h(f)});for(const f of Mm(l))u(f)};r(e,{displayKind:"ai-doc"});for(const l of Array.isArray(t)?t:[])r(l,{issueKey:String((l==null?void 0:l.issueKey)||(l==null?void 0:l.issue_key)||(l==null?void 0:l.issue)||"").trim(),platform:Oh(l==null?void 0:l.platform),displayKind:"Workflow 文档"});for(const l of RR(e))r(l,{issueKey:Vi(l),platform:Oh(l==null?void 0:l.platform),displayKind:"Issue 文档"});const s=l=>{try{const c=new URL(String(l||""),window.location.origin);return`${c.origin}${c.pathname}`}catch{return String(l||"").split(/[?#]/)[0]}},i=l=>{const c=String(l||"");return/技术方案|方案文档/.test(c)?50:/代码审查|code review/i.test(c)?40:/设计文档/.test(c)?30:/markdown review|文档预览/i.test(c)?20:10},a=new Map;for(const l of n){const c=s(l.href),u=a.get(c);if(!u||i(l.label)>i(u.label)){const{displayKind:f,...d}=l;a.set(c,d)}}return Array.from(a.values())}function gq(e){return!e||typeof e!="object"?{}:{marker:e.marker||e.flag||"",command:e.command||e.nextCommand||e.next_command||"",runtimeOnly:e.runtimeOnly===!0||e.runtime_only===!0,markerOnly:e.markerOnly===!0||e.marker_only===!0,url:e.url||e.href||e.mrUrl||e.mr_url||e.mergeRequestUrl||e.merge_request_url||"",mr:e.mr||e.mrUrl||e.mr_url||e.mergeRequestUrl||e.merge_request_url||"",testEnv:e.testEnv||e.test_environment||"",summary:e.summary||e.detail||e.description||"",links:Array.isArray(e.links)?e.links:[],artifacts:Array.isArray(e.artifacts)?e.artifacts:[],outputs:Array.isArray(e.outputs)?e.outputs:[],results:Array.isArray(e.results)?e.results:[]}}function Vi(e,t=0){return String((e==null?void 0:e.key)||(e==null?void 0:e.issueKey)||(e==null?void 0:e.issue_key)||(e==null?void 0:e.id)||(e==null?void 0:e.iid)||(e==null?void 0:e.title)||`issue-${t+1}`).trim()}function C1(e,t=0){return String((e==null?void 0:e.title)||(e==null?void 0:e.name)||(e==null?void 0:e.label)||(e==null?void 0:e.summary)||Vi(e,t)||`Issue ${t+1}`).trim()}function yq(e){return String((e==null?void 0:e.epicKey)||(e==null?void 0:e.epic_key)||(e==null?void 0:e.epic)||(e==null?void 0:e.epicTitle)||(e==null?void 0:e.epic_title)||(e==null?void 0:e.parentEpic)||(e==null?void 0:e.parent_epic)||"未归类").trim()}function xq(e){return String((e==null?void 0:e.parentKey)||(e==null?void 0:e.parent_key)||(e==null?void 0:e.parent)||(e==null?void 0:e.parentIssue)||(e==null?void 0:e.parent_issue)||"").trim()}function _1(e){const t=Mm(e),n=(s,i)=>{if(Array.isArray(s)){for(const a of s)if(a)if(typeof a=="string")t.push({label:i,href:a});else{const l=a.url||a.href||a.webUrl||a.web_url||a.mrUrl||a.mr_url||a.issueUrl||a.issue_url;l&&t.push({label:a.label||a.title||a.platform||a.kind||i,href:l})}}};n(e==null?void 0:e.mrs,"MR"),n(e==null?void 0:e.mergeRequests,"MR"),n(e==null?void 0:e.merge_requests,"MR"),n(e==null?void 0:e.implMrs,"MR"),n(e==null?void 0:e.impl_mrs,"MR"),n(e==null?void 0:e.platformMrs,"MR"),n(e==null?void 0:e.platform_mrs,"MR");const r=new Set;return t.filter(s=>{const i=String(s.href||"").trim();if(!i)return!1;const a=`${s.label}
|
|
185
|
-
${i}`;return r.has(a)?!1:(r.add(a),!0)})}function wq(e){const t=Array.isArray(e==null?void 0:e.epics)?e.epics:Array.isArray(e==null?void 0:e.epicGroups)?e.epicGroups:Array.isArray(e==null?void 0:e.epic_groups)?e.epic_groups:[],n=[],r=new Map,s=(a,l="")=>{const c=String(a||"未归类").trim()||"未归类";return r.has(c)?l&&r.get(c).title===c&&(r.get(c).title=String(l)):r.set(c,{key:c,title:String(l||c),issues:[]}),r.get(c)};for(const a of t){const l=String((a==null?void 0:a.key)||(a==null?void 0:a.id)||(a==null?void 0:a.title)||(a==null?void 0:a.name)||"未归类").trim(),c=s(l,(a==null?void 0:a.title)||(a==null?void 0:a.name)||l),u=Array.isArray(a==null?void 0:a.issues)?a.issues:Array.isArray(a==null?void 0:a.children)?a.children:Array.isArray(a==null?void 0:a.items)?a.items:[];for(const f of u)f&&typeof f=="object"&&c.issues.push({...f,epicKey:l})}for(const a of Array.isArray(e==null?void 0:e.issues)?e.issues:[])a&&typeof a=="object"&&n.push(a);for(const a of n)s(yq(a)).issues.push(a);const i=a=>{const l=new Map,c=[];return a.forEach((u,f)=>{const d=Vi(u,f);l.set(d,{issue:u,children:[]})}),a.forEach((u,f)=>{const d=Vi(u,f),p=xq(u),h=l.get(d);p&&l.has(p)?l.get(p).children.push(h):c.push(h)}),c};return Array.from(r.values()).map(a=>({...a,issues:i(a.issues)}))}function Sd(e){return String((e==null?void 0:e.actionId)||(e==null?void 0:e.action_id)||(e==null?void 0:e.action)||(e==null?void 0:e.id)||"").trim()}function Ba(e){if(!e||typeof e!="object")return"";const t=String(e.issueKey||e.issue_key||e.issue||"").trim(),n=String(e.action||e.actionId||e.action_id||Sd(e)||"").trim(),r=String(e.stageKey||e.stage_key||e.stage||e.phase||e.code||e.pointer||n).trim(),s=[r,n,e.code,e.type,e.title].map(i=>String(i||"")).join(" ").toLowerCase();if(t){if(/plan_draft_local|submit-plan|plan-doc/.test(s))return`issue-plan:${t}`;if(/gitlab_issue_missing|ensure-gitlab-issue/.test(s))return`issue-gitlab:${t}`}return r}function Dh(e){const t=Lh(e)||String((e==null?void 0:e.startedAt)||(e==null?void 0:e.started_at)||(e==null?void 0:e.createdAt)||(e==null?void 0:e.created_at)||(e==null?void 0:e.updatedAt)||(e==null?void 0:e.updated_at)||""),n=Date.parse(t);return Number.isFinite(n)?n:NaN}function RR(e){var s,i,a,l,c,u,f,d,p,h,g,k;const t=[],n=w=>{w&&typeof w=="object"&&!Array.isArray(w)&&t.push(w)},r=w=>{if(!w||typeof w!="object"||Array.isArray(w))return;const y=Array.isArray(w.issues)?w.issues:Array.isArray(w.children)?w.children:Array.isArray(w.items)?w.items:[];for(const v of y)!v||typeof v!="object"||Array.isArray(v)||(v.issue&&typeof v.issue=="object"?(n(v.issue),Array.isArray(v.children)&&v.children.forEach(b=>n((b==null?void 0:b.issue)||b))):n(v))};return[e==null?void 0:e.issues,(s=e==null?void 0:e.raw)==null?void 0:s.issues,(a=(i=e==null?void 0:e.raw)==null?void 0:i.prd)==null?void 0:a.issues].forEach(w=>{Array.isArray(w)&&w.forEach(n)}),[e==null?void 0:e.epics,e==null?void 0:e.epicGroups,e==null?void 0:e.epic_groups,(l=e==null?void 0:e.raw)==null?void 0:l.epics,(c=e==null?void 0:e.raw)==null?void 0:c.epicGroups,(u=e==null?void 0:e.raw)==null?void 0:u.epic_groups,(d=(f=e==null?void 0:e.raw)==null?void 0:f.prd)==null?void 0:d.epics,(h=(p=e==null?void 0:e.raw)==null?void 0:p.prd)==null?void 0:h.epicGroups,(k=(g=e==null?void 0:e.raw)==null?void 0:g.prd)==null?void 0:k.epic_groups].forEach(w=>{Array.isArray(w)&&w.forEach(r)}),t}function bq(e,t){const n=String(t||"").trim();return n&&RR(e).find((r,s)=>Vi(r,s)===n)||null}function kq(e){var t,n,r,s,i,a,l,c;return String((e==null?void 0:e.gitlabEpic)||(e==null?void 0:e.gitlab_epic)||((t=e==null?void 0:e.prd)==null?void 0:t.gitlabEpic)||((n=e==null?void 0:e.prd)==null?void 0:n.gitlab_epic)||((r=e==null?void 0:e.raw)==null?void 0:r.gitlabEpic)||((s=e==null?void 0:e.raw)==null?void 0:s.gitlab_epic)||((a=(i=e==null?void 0:e.raw)==null?void 0:i.prd)==null?void 0:a.gitlabEpic)||((c=(l=e==null?void 0:e.raw)==null?void 0:l.prd)==null?void 0:c.gitlab_epic)||"").trim()}function vq(e,t){if(!t||typeof t!="object")return t;const n=String(t.issueKey||t.issue_key||t.issue||"").trim(),r=bq(e,n),s=String(t.platform||(r==null?void 0:r.platform)||"").trim(),i=s&&!t.platform?{...t,platform:s}:t,a=String((r==null?void 0:r.gitlabIssue)||(r==null?void 0:r.gitlab_issue)||i.gitlabIssue||i.gitlab_issue||"").trim(),l=kq(e);if(!a&&!l)return i;const c=Ba(i),u=`${c} ${Pk(i)}`;if(!/issue-gitlab:|gitlab_issue_missing|ensure-gitlab-issue|implementation|impl_|fix_|testing|submit-test|self-test/i.test(u))return i;const d=[];a&&d.push({label:"GitLab Issue",kind:"gitlab-issue",durability:"durable",url:a}),l&&d.push({label:"GitLab Epic",kind:"gitlab-epic",durability:"durable",url:l});const p=Qo(i.status),h=a&&p==="done"&&/^issue-gitlab:/.test(c)&&/需要.*GitLab Issue/.test(String(i.title||i.label||""));return{...i,...a?{gitlabIssue:a,gitlab_issue:a}:{},...l?{gitlabEpic:l,gitlab_epic:l}:{},...h?{title:String(i.title||i.label||"GitLab Issue 已绑定").replace(/^需要为/,"已为").replace("创建或绑定","创建/绑定"),label:String(i.label||i.title||"GitLab Issue 已绑定").replace(/^需要为/,"已为").replace("创建或绑定","创建/绑定")}:{},artifacts:hi(i.artifacts,d)}}function hi(e,t){const n=[],r=new Set,s=i=>{if(!i)return;const a=typeof i=="string"?i:JSON.stringify(i);r.has(a)||(r.add(a),n.push(i))};return(Array.isArray(e)?e:[]).forEach(s),(Array.isArray(t)?t:[]).forEach(s),n}function E1(e,t){const n=Dh(t),r=Dh(e),s=Number.isFinite(n)&&(!Number.isFinite(r)||n>=r)?t:e,i=(s==null?void 0:s.status)||(t==null?void 0:t.status)||(e==null?void 0:e.status);return{...e,...t,title:qi(s,0)||qi(t,0)||qi(e,0),detail:Bp(s)||Bp(t)||Bp(e),status:i,links:hi(e==null?void 0:e.links,t==null?void 0:t.links),artifacts:hi(e==null?void 0:e.artifacts,t==null?void 0:t.artifacts),outputs:hi(e==null?void 0:e.outputs,t==null?void 0:t.outputs),results:hi(e==null?void 0:e.results,t==null?void 0:t.results),events:hi(e==null?void 0:e.events,t==null?void 0:t.events),createdAt:(e==null?void 0:e.createdAt)||(e==null?void 0:e.created_at)||(t==null?void 0:t.createdAt)||(t==null?void 0:t.created_at),startedAt:(e==null?void 0:e.startedAt)||(e==null?void 0:e.started_at)||(t==null?void 0:t.startedAt)||(t==null?void 0:t.started_at),updatedAt:(s==null?void 0:s.updatedAt)||(s==null?void 0:s.updated_at)||(t==null?void 0:t.updatedAt)||(t==null?void 0:t.updated_at)||(e==null?void 0:e.updatedAt)||(e==null?void 0:e.updated_at)}}function Sq(e,t){const n=[],r=new Map,s=new Map,i=new Map,a=d=>{var p,h;return!!(!d||typeof d!="object"||d.auxiliary===!0||d.auxiliary_event===!0||String(d.type||"")==="review-link"||String(d.type||"")==="action-preview"||d.preview===!0||String(d.type||"")==="same-platform-stage-conflict"&&/\/api\/prd-workflow\/review\//.test(String(((p=d.conflict)==null?void 0:p.previousArtifact)||((h=d.conflict)==null?void 0:h.incomingArtifact)||"")))},l=(d,p)=>({...d,links:hi(d==null?void 0:d.links,p==null?void 0:p.links),artifacts:hi(d==null?void 0:d.artifacts,p==null?void 0:p.artifacts),outputs:hi(d==null?void 0:d.outputs,p==null?void 0:p.outputs),results:hi(d==null?void 0:d.results,p==null?void 0:p.results)}),c=(d,p)=>{if(!d)return;const h=r.get(d);if(h!=null){n[h]=l(n[h],p);return}i.set(d,l(i.get(d)||{},p))},u=(d,p)=>d&&i.has(d)?l(p,i.get(d)):p,f=d=>{if(Array.isArray(d))for(const p of d){const h=Ba(p);if(a(p)){c(h,p);continue}const g=String(p.id||p.eventId||p.event_id||p.actionId||p.action_id||"").trim(),k=h||g,w=k?r.get(k)??s.get(g):null;k&&w!=null?(n[w]=u(h,E1(n[w],p)),h&&r.set(h,w),g&&s.set(g,w)):(k&&r.set(k,n.length),g&&s.set(g,n.length),n.push(u(h,p)))}};if(f(e==null?void 0:e.actions),f(e==null?void 0:e.workflowActions),f(e==null?void 0:e.workflow_actions),f(e==null?void 0:e.timeline),f(e==null?void 0:e.history),f(e==null?void 0:e.events),f(e==null?void 0:e.runtimeEvents),f(e==null?void 0:e.runtime_events),t&&typeof t=="object"){const d=Sd(t),p=Ba(t),h=p?r.get(p):d?s.get(d):null,g={...t,status:t.status||"next",kind:"next_action"};h!=null&&(n[h]=E1(n[h],g))}return n.map((d,p)=>({item:d,index:p,ts:Dh(d)})).filter(d=>Number.isFinite(d.ts)).sort((d,p)=>p.ts-d.ts||d.index-p.index).map(d=>vq(e,d.item))}function Nq(e){return(Array.isArray(e==null?void 0:e.runtimeEvents)?e.runtimeEvents:Array.isArray(e==null?void 0:e.runtime_events)?e.runtime_events:[]).filter(n=>n&&typeof n=="object").map((n,r)=>({item:n,index:r,ts:Dh(n)})).sort((n,r)=>{const s=Number.isFinite(n.ts),i=Number.isFinite(r.ts);return s&&i?r.ts-n.ts||r.index-n.index:s?-1:i?1:r.index-n.index}).slice(0,8).map(n=>n.item)}function jq(e,t){const n=String(t||"all");if(n==="all")return!0;const r=[e==null?void 0:e.status,e==null?void 0:e.type,e==null?void 0:e.kind,e==null?void 0:e.title,e==null?void 0:e.detail,e==null?void 0:e.error,JSON.stringify((e==null?void 0:e.links)||[]),JSON.stringify((e==null?void 0:e.artifacts)||[])].join(" ").toLowerCase();return n==="errors"?/error|failed|conflict|blocked|stale|revision|冲突|失败/.test(r):n==="review"?/review|temporary-review|临时/.test(r):n==="external"?/mr|merge request|gitlab|jenkins|package|build|tapd/.test(r):!0}function Cq(e,t){const n=typeof e=="string"?e:String((e==null?void 0:e.text)||""),r=typeof e=="object"?Number(e==null?void 0:e.stepMs):NaN,s=typeof e=="object"?Number(e==null?void 0:e.totalMs):NaN,i=Number.isFinite(r)&&Number.isFinite(s)?`(+${ma(r)} / 总 ${ma(s)})`:"";return`${t+1}. ${n}${i}`}function TR(e){if(String((e==null?void 0:e.type)||"")!=="raw")return null;const t=String((e==null?void 0:e.text)||"").trim();if(!t)return null;try{return JSON.parse(t)}catch{return null}}function kl(...e){for(const t of e){const n=Number(t);if(Number.isFinite(n))return n}return NaN}function _q(e){const t=e!=null&&e.tool_call&&typeof e.tool_call=="object"?e.tool_call:{},n=Object.keys(t).find(r=>/ToolCall$/i.test(r))||"";return n||String((e==null?void 0:e.name)||(e==null?void 0:e.tool)||"tool_call")}function Eq(e){const t=e!=null&&e.tool_call&&typeof e.tool_call=="object"?e.tool_call:{},n=Object.keys(t).find(r=>/ToolCall$/i.test(r))||"";return n&&t[n]&&typeof t[n]=="object"?t[n]:{}}function Aq(e,t){var s;const n=String(((s=t==null?void 0:t.args)==null?void 0:s.command)||"");return/ck_fetch\.py/.test(n)?"CK 查询":/collect_important_mails\.py|list_mails_by_date\.py|read_mail_content\.py/.test(n)?"邮件脚本":/npm\s+run\s+build|build:web-ui/.test(n)?"前端构建":/python3/.test(n)?"Python 脚本":{shellToolCall:"Shell 命令",readToolCall:"读取文件/上下文",grepToolCall:"搜索代码",globToolCall:"查找文件",editToolCall:"编辑文件",writeToolCall:"写入文件"}[e]||e||"工具调用"}function Pq(e){var i,a,l;const t=TR(e);if(!t||typeof t!="object")return null;const n=String(t.type||""),r=String(t.subtype||""),s=kl(t.timestamp_ms,t.completedAtMs,t.startedAtMs,e==null?void 0:e.ts,Date.now());if(n==="tool_call"&&r==="completed"){const c=Eq(t),u=_q(t),f=kl(t.startedAtMs,c==null?void 0:c.startedAtMs),d=kl(t.completedAtMs,c==null?void 0:c.completedAtMs),p=((i=c==null?void 0:c.result)==null?void 0:i.success)||((a=c==null?void 0:c.result)==null?void 0:a.failure)||{},h=Number.isFinite(f)&&Number.isFinite(d)?Math.max(0,d-f):kl(p.executionTime,p.localExecutionTimeMs),g=String(((l=c==null?void 0:c.args)==null?void 0:l.command)||p.command||"").trim(),k=g?g.split(`
|
|
186
|
-
`).find(Boolean)||g:"";return{kind:"tool",label:Aq(u,c),durationMs:Number.isFinite(h)?h:null,at:s,detail:k?k.slice(0,90):""}}if(n==="result"){const c=kl(t.duration_ms,t.duration_api_ms);return{kind:"total",label:"运行总耗时",durationMs:Number.isFinite(c)?c:null,at:s,detail:t.is_error?"失败结束":"成功结束"}}return n==="connection"?{kind:"network",label:r==="reconnecting"?"连接重连":r==="reconnected"?"连接恢复":"连接事件",durationMs:null,at:s,detail:""}:n==="retry"?{kind:"network",label:r==="resuming"?"会话恢复":r==="starting"?"开始重试":"重试事件",durationMs:null,at:s,detail:""}:null}function A1(e,t,n,r){const s=(Array.isArray(e)?e:[]).map(w=>typeof w=="string"?{text:w}:w).filter(w=>w&&String(w.text||"").trim()),i=Array.isArray(t)?t:[],a=[...i].reverse().find(w=>(w==null?void 0:w.kind)==="total"&&Number.isFinite(Number(w.durationMs))),l=[...s].reverse().find(w=>Number.isFinite(Number(w.totalMs))),c=Number.isFinite(Number(r))&&Number.isFinite(Number(n))?Math.max(0,Number(r)-Number(n)):NaN,u=kl(a==null?void 0:a.durationMs,l==null?void 0:l.totalMs,c),f=s.filter(w=>w.kind==="model").reduce((w,y)=>w+(Number(y.stepMs)||0),0),d=i.filter(w=>(w==null?void 0:w.kind)==="tool"),p=d.reduce((w,y)=>w+(Number(y.durationMs)||0),0),h=i.filter(w=>(w==null?void 0:w.kind)==="network").length,g=[...s.filter(w=>Number(w.stepMs)>=1e3).map(w=>({label:w.text,durationMs:Number(w.stepMs),detail:"Activity 间隔"})),...d.filter(w=>Number(w.durationMs)>=1e3).map(w=>({label:w.label,durationMs:Number(w.durationMs),detail:w.detail||"工具实际执行"}))].sort((w,y)=>y.durationMs-w.durationMs).slice(0,6),k=["耗时概览"];return Number.isFinite(u)&&k.push(`- 当前总耗时:${ma(u)}`),f>0&&k.push(`- 模型相关间隔:约 ${ma(f)}(按 Activity 间隔估算)`),d.length>0&&k.push(`- 工具实际执行:${ma(p)}(${d.length} 次完成事件)`),h>0&&k.push(`- 网络/会话恢复事件:${h} 次`),g.length>0&&(k.push(""),k.push("慢步骤"),g.forEach((w,y)=>{const v=w.detail?` · ${w.detail}`:"";k.push(`${y+1}. ${w.label}:${ma(w.durationMs)}${v}`)})),s.length>0&&(k.push(""),k.push("最近 Activity"),s.slice(-10).forEach((w,y)=>{k.push(Cq(w,y))})),d.length>0&&(k.push(""),k.push("最近工具完成"),d.slice(-8).forEach((w,y)=>{const v=Number.isFinite(Number(w.durationMs))?` ${ma(w.durationMs)}`:"",b=w.detail?` · ${w.detail}`:"";k.push(`${y+1}. ${w.label}${v}${b}`)})),k.join(`
|
|
187
|
-
`)}function P1(e){if(String((e==null?void 0:e.type)||"")!=="raw"||String((e==null?void 0:e.eventType)||"")!=="thinking")return"";const t=TR(e);if((t==null?void 0:t.type)!=="thinking")return"";const n=String((t==null?void 0:t.subtype)||"");return n&&n!=="delta"?"":String((t==null?void 0:t.text)||(t==null?void 0:t.delta)||(t==null?void 0:t.thinking)||"").trim()}function MR(e,t){const n=String(e||(t==null?void 0:t.id)||"").toLowerCase();return n.startsWith("control_")?"control":n.startsWith("provide_")?"provide":n.startsWith("tool_")?"agent":(t==null?void 0:t.type)||"agent"}function $R(e){const t=String((e==null?void 0:e.marketplaceDefinitionId)||(e==null?void 0:e.id)||"").trim();return t.startsWith("marketplace:")?t:""}function Ik(e){if(!e)return"";const t=String(e.baseDefinitionId||"").trim();return t||String(e.id||"").trim()}function LR(e){const t=String(e??"");return/^[A-Za-z0-9_@%+=:,./-]+$/.test(t)?t:"'"+t.replace(/'/g,"'\\''")+"'"}function Iq(e,t){const n=String((e==null?void 0:e.language)||"").trim().toLowerCase(),r=String(t||"").trim().toLowerCase();return n.includes("python")||r.endsWith(".py")?"python3":n.includes("shell")||n==="bash"||r.endsWith(".sh")||r.endsWith(".bash")?"bash":"node"}function Rq(e){const t=String(e??"").trim();return t?t.includes("${")?t:LR(t):""}function OR(e){if(String((e==null?void 0:e.baseDefinitionId)||"").trim()!=="tool_nodejs")return"";const t=e!=null&&e.runtime&&typeof e.runtime=="object"?e.runtime:{},n=String(t.entry||"").trim().replace(/^\/+/,"");if(n){const s=String((e==null?void 0:e.packageDir)||"").trim().replace(/\/+$/,""),i=s?`${s}/${n}`:`\${flowDir}/${n}`,a=Array.isArray(t.args)?t.args.map(Rq).filter(Boolean):[];return[Iq(t,n),LR(i),...a].join(" ")}return String(t.command||"").trim()}function ku(e){const t=String(Ik(e)||(e==null?void 0:e.id)||"");return t==="workspace_run"||t==="workspace_scheduled_run"?"CONTROL":t.startsWith("display_")?"DISPLAY":/^control/i.test(t)?"CONTROL":/^tool/i.test(t)?"TOOL":/^provide/i.test(t)?"PROVIDE":"AGENT"}function I1(e){return e==="DISPLAY"?"preview":e==="CONTROL"?"account_tree":e==="TOOL"?"build":e==="PROVIDE"?"database":"smart_toy"}function Fh(e){return String((e==null?void 0:e.displayName)||(e==null?void 0:e.label)||(e==null?void 0:e.id)||"Node")}function vu(e){return Fh(e)}function Aw(e){return String((e==null?void 0:e.description)||(e==null?void 0:e.body)||"").replace(/\s+/g," ").trim()}function lp(e,t){const n=String((e==null?void 0:e.name)||(e==null?void 0:e.id)||"").trim(),r=String((e==null?void 0:e.type)||"").trim();return n||r||`#${t+1}`}function R1(e,t,n){const r=String((t==null?void 0:t.name)||(t==null?void 0:t.id)||`#${n+1}`).trim(),s=String((t==null?void 0:t.type)||"").trim(),i=String((t==null?void 0:t.default)??(t==null?void 0:t.value)??"").trim();return[e,r,s?`type: ${s}`:"",i?`default: ${i}`:""].filter(Boolean).join(" · ")}function T1(e,t){const n=Array.isArray(e)?e:[],r=n.slice(0,4),s=Math.max(0,n.length-r.length);return{list:n,shown:r,hidden:s,kind:t}}function Ay(e,t){const n=String((e==null?void 0:e.source)||""),r=String((e==null?void 0:e.target)||"");if(!n||!r)return!1;const s=new Map(t.map(l=>[l.id,l])),i=Sw(s.get(n),e.sourceHandle||"output-0","source"),a=Sw(s.get(r),e.targetHandle||"input-0","target");return!!(i&&a&&bd(i,a))}function Tq(e,t){const n=String((e==null?void 0:e.nodeId)||""),r=String((e==null?void 0:e.handleId)||""),s=(e==null?void 0:e.handleType)==="target"?"target":(e==null?void 0:e.handleType)==="source"?"source":"";if(!n||!r||!s)return null;const i=t.find(l=>l.id===n),a=Sw(i,r,s);return a?{nodeId:n,handleId:r,handleType:s,slot:a,slotType:E7(a)}:null}function Mq(e,t){return t?e.map((n,r)=>{const s=Array.isArray(t.handleType==="source"?n.inputs:n.outputs)?t.handleType==="source"?n.inputs:n.outputs:[];for(let i=0;i<s.length;i+=1){const a=s[i];if(!(t.handleType==="source"?bd(t.slot,a):bd(a,t.slot)))continue;const c=ku(n);return{def:n,order:r,category:c,categoryRank:bl.indexOf(c),slot:a,slotIndex:i,displayLabel:vu(n),description:Aw(n)}}return null}).filter(Boolean).sort((n,r)=>{var a,l;const s=(a=n.slot)!=null&&a.required?0:1,i=(l=r.slot)!=null&&l.required?0:1;return s-i||n.slotIndex-r.slotIndex||n.categoryRank-r.categoryRank||n.order-r.order}):[]}function $q(e,t,n){var i,a,l,c;if(!n)return[];const r=[],s=n.handleType==="source";for(const u of e||[]){if(!u||u.id===n.nodeId)continue;const f=Array.isArray(s?(i=u.data)==null?void 0:i.inputs:(a=u.data)==null?void 0:a.outputs)?s?u.data.inputs:u.data.outputs:[];for(let d=0;d<f.length;d+=1){const p=f[d];if((p==null?void 0:p.showOnNode)===!1||!(s?bd(n.slot,p):bd(p,n.slot)))continue;const g=s?{source:n.nodeId,sourceHandle:n.handleId,target:u.id,targetHandle:`input-${d}`}:{source:u.id,sourceHandle:`output-${d}`,target:n.nodeId,targetHandle:n.handleId},k=(t||[]).some(w=>w.target===g.target&&w.targetHandle===g.targetHandle);r.push({node:u,nodeId:u.id,nodeLabel:((l=u.data)==null?void 0:l.label)||u.id,definitionId:((c=u.data)==null?void 0:c.definitionId)||"",slot:p,slotIndex:d,handleId:s?g.targetHandle:g.sourceHandle,connection:g,occupied:k})}}return r.sort((u,f)=>{var k,w,y,v,b,C,N,j;const d=Number(((w=(k=u.node)==null?void 0:k.position)==null?void 0:w.y)||0),p=Number(((v=(y=f.node)==null?void 0:y.position)==null?void 0:v.y)||0),h=Number(((C=(b=u.node)==null?void 0:b.position)==null?void 0:C.x)||0),g=Number(((j=(N=f.node)==null?void 0:N.position)==null?void 0:j.x)||0);return d-p||h-g||u.slotIndex-f.slotIndex||String(u.nodeId).localeCompare(String(f.nodeId))})}function Dl(e,t=!1){if(t)return"folder";const n=String(e||"").toLowerCase().split(".").pop();return n==="md"||n==="markdown"?"article":n==="html"?"web":["csv","tsv"].includes(n)?"table":["js","jsx","ts","tsx","mjs","cjs"].includes(n)?"code":["yaml","yml","json"].includes(n)?"data_object":"draft"}function Lq(e,t){const n=String(e||"node").replace(/^(agent|control|provide|tool|display)_/i,"").replace(/[^a-zA-Z0-9_]+/g,"_").replace(/^_+|_+$/g,"")||"node",r=new Set(t.map(s=>s.id));for(let s=1;s<1e4;s++){const i=`${n}_${s}`;if(!r.has(i))return i}return`${n}_${Date.now().toString(36)}`}function Oq(e){return(e==null?void 0:e.default)!=null?String(e.default):(e==null?void 0:e.value)!=null?String(e.value):""}function Dq(e){const t=Number(e);if(!Number.isFinite(t)||t<=0)return kd;const n=Math.max(1,Math.min(1440,Math.round(t)));return n<60?`*/${n} * * * *`:n===60?"0 * * * *":n<1440&&n%60===0?`0 */${n/60} * * *`:kd}function Eo(e,t=0,n=0,r=59){const s=Math.max(n,Math.min(r,Number.parseInt(String(e??t),10)||t));return String(s).padStart(2,"0")}function Rk(e){const t=String(e||"").trim().match(/^(\d{1,2}):(\d{1,2})$/);return t?`${Eo(t[1],9,0,23)}:${Eo(t[2],0,0,59)}`:"09:00"}function Su(e,t,n,r,s){const i=Rk(t),[a,l]=i.split(":").map(u=>Number.parseInt(u,10)),c=String(e||"daily");if(c==="weekly"){const u=Math.max(0,Math.min(6,Number.parseInt(String(n??1),10)||1));return`${l} ${a} * * ${u}`}if(c==="monthly"){const u=Math.max(1,Math.min(31,Number.parseInt(String(r??1),10)||1));return`${l} ${a} ${u} * *`}return c==="custom"?String(s||"").trim()||kd:`${l} ${a} * * *`}function Fq(e){const n=String(e||kd).trim().split(/\s+/);if(n.length!==5)return{scheduleType:"custom",time:"09:00",weekday:1,monthDay:1};const[r,s,i,a,l]=n,c=Number.parseInt(r,10),u=Number.parseInt(s,10),f=Number.isFinite(c)&&Number.isFinite(u)&&r===String(c)&&s===String(u),d=f?`${Eo(u,9,0,23)}:${Eo(c,0,0,59)}`:"09:00";return f&&i==="*"&&a==="*"&&l==="*"?{scheduleType:"daily",time:d,weekday:1,monthDay:1}:f&&i==="*"&&a==="*"&&/^\d+$/.test(l)?{scheduleType:"weekly",time:d,weekday:Math.max(0,Math.min(6,Number.parseInt(l,10))),monthDay:1}:f&&/^\d+$/.test(i)&&a==="*"&&l==="*"?{scheduleType:"monthly",time:d,weekday:1,monthDay:Math.max(1,Math.min(31,Number.parseInt(i,10)))}:{scheduleType:"custom",time:d,weekday:1,monthDay:1}}function Tk(e){let t={};const n=String(e||"").trim();if(n)try{t=JSON.parse(n)}catch{t={}}const r=Number(t.intervalMinutes),s=Dq(r),i=typeof t.cron=="string"&&t.cron.trim()?t.cron.trim():s,a=Fq(i),l=["daily","weekly","monthly","custom"].includes(t.scheduleType)?t.scheduleType:a.scheduleType,c=Rk(t.time||a.time||"09:00"),u=Math.max(0,Math.min(6,Number.parseInt(String(t.weekday??a.weekday??1),10)||1)),f=Math.max(1,Math.min(31,Number.parseInt(String(t.monthDay??a.monthDay??1),10)||1)),d=Su(l,c,u,f,i);return{enabled:t.enabled===!0,scheduleType:l,time:c,weekday:u,monthDay:f,cron:d,timezone:BU,targetRunNodeId:typeof t.targetRunNodeId=="string"?t.targetRunNodeId.trim():"",overlapPolicy:"skip"}}function zq(e){const t=Tk(JSON.stringify(e||{}));return JSON.stringify(t)}function Bq(e){const t=Number(e||0);return!Number.isFinite(t)||t<=0?"-":new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function Hq(e){return e==="weekly"?"每周":e==="monthly"?"每月":e==="custom"?"高级 Cron":"每天"}function M1(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"&&e.trim()){const t=Date.parse(e);if(Number.isFinite(t))return t}return 0}function cp(e){const t={};for(const n of Array.isArray(e)?e:[]){const r=String((n==null?void 0:n.scheduleNodeId)||(n==null?void 0:n.runNodeId)||"").trim();r&&(t[r]={nextAt:M1(n.nextRunAt),lastAt:M1(n.lastTriggeredAt),lastStatus:String(n.lastStatus||(n.enabled?"armed":"disabled")),lastError:String(n.lastError||""),lastRunId:String(n.lastRunId||""),targetRunNodeId:String(n.targetRunNodeId||n.runNodeId||""),cron:String(n.cron||""),timezone:String(n.timezone||"")})}return t}function Hu(e){var t;return!!((t=e==null?void 0:e.data)!=null&&t.isWorkspaceGroup)}function zh(e){return e>0?`Group ${e+1}`:"Group"}function Wq(e){return(Array.isArray(e)?e:[]).map((n,r)=>{const s=String((n==null?void 0:n.id)||`group_${r+1}`).trim(),i=Number(n==null?void 0:n.x),a=Number(n==null?void 0:n.y),l=Number(n==null?void 0:n.width),c=Number(n==null?void 0:n.height);return!s||!Number.isFinite(i)||!Number.isFinite(a)||!Number.isFinite(l)||!Number.isFinite(c)?null:{id:s,title:String((n==null?void 0:n.title)||zh(r)).trim()||zh(r),color:String((n==null?void 0:n.color)||"purple").trim()||"purple",x:i,y:a,width:Math.max(Da,Math.round(l)),height:Math.max(Fa,Math.round(c))}}).filter(Boolean)}function Vq(e){var n;return Wq((n=e==null?void 0:e.ui)==null?void 0:n.groups).map(r=>({id:r.id,type:Jl,position:{x:r.x,y:r.y},width:r.width,height:r.height,selected:!1,draggable:!0,selectable:!0,zIndex:0,data:{isWorkspaceGroup:!0,label:r.title,title:r.title,color:r.color,nodeSize:{width:r.width,height:r.height}}}))}function Pw(e){const t=Number(e==null?void 0:e.width),n=Number(e==null?void 0:e.height);return!Number.isFinite(t)||!Number.isFinite(n)?null:{width:Math.max(Da,Math.round(t)),height:Math.max(Fa,Math.round(n))}}function Nu(e){return(Array.isArray(e)?e:[]).map(t=>({type:(t==null?void 0:t.type)||"node",name:(t==null?void 0:t.name)||"",default:Oq(t),required:!!(t!=null&&t.required),description:String((t==null?void 0:t.description)||""),showOnNode:(t==null?void 0:t.showOnNode)!=null?t.showOnNode!==!1:!!(t!=null&&t.required)||String((t==null?void 0:t.type)||"node").trim().toLowerCase()==="node"}))}function DR(e){const t=(e==null?void 0:e.data)||{},n=r=>(Array.isArray(r)?r:[]).map((s,i)=>(s==null?void 0:s.showOnNode)===!1?"":[i,String((s==null?void 0:s.type)||""),String((s==null?void 0:s.name)||""),s!=null&&s.required?"1":"0"].join(":")).filter(Boolean).join("|");return`${n(t.inputs)}=>${n(t.outputs)}`}function Kq(e){var i,a,l,c;const t=(e==null?void 0:e.data)||{},n=t!=null&&t.displaySize&&typeof t.displaySize=="object"?t.displaySize:{},r=t!=null&&t.nodeSize&&typeof t.nodeSize=="object"?t.nodeSize:{},s=$m(t);return[DR(e),jn(t)||"",s?"has-result":"",(t==null?void 0:t.contextRunResultNonce)||"",Number((e==null?void 0:e.width)||0)||"",Number((e==null?void 0:e.height)||0)||"",Number(((i=e==null?void 0:e.measured)==null?void 0:i.width)||0)||"",Number(((a=e==null?void 0:e.measured)==null?void 0:a.height)||0)||"",Number(r.width||0)||"",Number(r.height||0)||"",Number(n.width||0)||"",Number(n.height||0)||"",t!=null&&t.isExecuting?"executing":"",(t==null?void 0:t.nodeStatus)||"",(c=(l=t==null?void 0:t.runningRunNodeIds)==null?void 0:l.has)!=null&&c.call(l,e==null?void 0:e.id)?"running-run":""].join("::")}function Uq(e,t){return!e||!t?!1:e.selected===t.selected&&e.isExecuting===t.isExecuting&&e.nodeStatus===t.nodeStatus&&e.nodeElapsed===t.nodeElapsed&&e.optimizingRun===t.optimizingRun&&e.scheduledRunState===t.scheduledRunState&&e.nodeChatActive===t.nodeChatActive&&e.nodeChat===t.nodeChat}function cu(e,t){var h,g;const n=e!=null&&e.instances&&typeof e.instances=="object"?e.instances:{},r=BR(n),s=Array.isArray(e==null?void 0:e.edges)?e.edges:[],i=(h=e==null?void 0:e.ui)!=null&&h.nodePositions&&typeof e.ui.nodePositions=="object"?e.ui.nodePositions:{},a=(g=e==null?void 0:e.ui)!=null&&g.nodeSizes&&typeof e.ui.nodeSizes=="object"?e.ui.nodeSizes:{},l=new Set(Object.keys(r));for(const k of s)k!=null&&k.source&&l.add(String(k.source)),k!=null&&k.target&&l.add(String(k.target));const u=Array.from(l).map(k=>{const w=r[k]||{},y=w.definitionId||k,v=t.find(F=>F.id===y),b=Ik(v)||y,C=t.find(F=>F.id===b)||v,N=w.marketplaceRef||$R(v),j=OR(v),A=i[k]&&typeof i[k].x=="number"&&typeof i[k].y=="number"?i[k]:{x:320+l.size*20,y:180+l.size*12},I=!!jn({definitionId:b,inputs:w.input,outputs:w.output}),D=a[k]&&typeof a[k].width=="number"&&typeof a[k].height=="number"?{width:a[k].width,height:a[k].height}:null,H=Ca(D,{display:I}),V=H&&!Ys(b);return{id:k,type:Jl,position:A,...V?{width:H.width,height:H.height}:{},data:{label:w.label||Fh(v)||Fh(C)||k,definitionId:b,...N?{marketplaceRef:N}:{},...v!=null&&v.packageId?{marketplacePackageId:v.packageId}:{},...v!=null&&v.version?{marketplaceVersion:v.version}:{},schemaType:MR(b,C||v),role:w.role||"normal",model:w.model||void 0,body:w.body||"",script:w.script||j||"",scriptRef:w.scriptRef||"",implementationRef:w.implementationRef||"",implementationMode:w.implementationMode||"",displayReloadKey:w.displayReloadKey||"",...V?{nodeSize:H}:{},...I&&V?{displaySize:H}:{}}}}).map(k=>jw(k,r,t)),f=Vq(e),d=s.filter(k=>(k==null?void 0:k.source)&&(k==null?void 0:k.target)).filter(k=>!f.some(w=>w.id===String(k.source)||w.id===String(k.target))).map((k,w)=>({id:k.id||`we-${k.source}-${k.target}-${w}`,source:String(k.source),target:String(k.target),sourceHandle:k.sourceHandle??void 0,targetHandle:k.targetHandle??void 0,markerEnd:{type:fi.ArrowClosed}})),p=[...f,...u];return{nodes:p,edges:eU(d,p),instances:r}}function $1(e){return`${Ew}${e}`}function Py(e){const t=String(e||"");return t.startsWith(Ew)?t.slice(Ew.length):t}function Iw(e){if(!e||typeof e!="object")return null;const t=Number(e.x),n=Number(e.y),r=Number(e.zoom);return!Number.isFinite(t)||!Number.isFinite(n)||!Number.isFinite(r)?null:{x:t,y:n,zoom:Math.min(Math.max(r,.1),4)}}function Hp(e,t=[]){const n=new Map((Array.isArray(t)?t:[]).filter(d=>{var p;return Ha((p=d==null?void 0:d.data)==null?void 0:p.definitionId)}).map(d=>[d.id,d])),r=Array.isArray(e==null?void 0:e.nodeIds)?e.nodeIds:[],s=[],i=new Set;for(const d of r){const p=String(d||"").trim();!p||i.has(p)||!n.has(p)||(i.add(p),s.push(p))}const a={},l=e!=null&&e.nodePositions&&typeof e.nodePositions=="object"?e.nodePositions:{};s.forEach((d,p)=>{const h=l[d];a[d]=h&&typeof h.x=="number"&&typeof h.y=="number"?{x:h.x,y:h.y}:{x:180+p*36,y:120+p*28}});const c={},u=e!=null&&e.nodeSizes&&typeof e.nodeSizes=="object"?e.nodeSizes:{};s.forEach(d=>{const p=Ca(u[d],{display:!0});p&&(c[d]=p)});const f=Iw(e==null?void 0:e.viewport);return{nodeIds:s,nodePositions:a,nodeSizes:c,...f?{viewport:f}:{}}}function L1(e,t=[]){return Hp(e,t)}const Iy=[{value:"1",label:"1 天"},{value:"7",label:"7 天"},{value:"30",label:"30 天"},{value:"90",label:"90 天"},{value:"365",label:"1 年"},{value:"permanent",label:"永久"}];function Ry(e={}){return{title:"",layout:"gallery",nodeIds:[],expiresInDays:30,permanent:!1,...e}}function O1(e={}){return e.permanent?"permanent":String(e.expiresInDays||30)}function D1(e={}){if(e.permanent)return{expiresMode:"permanent",permanent:!0};const t=Number(e.expiresInDays||30);return{expiresMode:"days",expiresInDays:Number.isFinite(t)?t:30}}function qq(e={}){if(!e.expiresAt)return"永久有效";const t=Date.parse(String(e.expiresAt||""));return Number.isFinite(t)?`有效期至 ${new Date(t).toLocaleString()}`:"永久有效"}function F1(e={}){return new URL(e.url||`/display/${e.id||""}`,window.location.origin).href}const FR="af:workspace:canvas-clipboard",zR="agentflow.workspace.canvas-clipboard";function Yq(e){return JSON.stringify({type:zR,version:1,clipboard:e})}function Gq(e){try{const t=JSON.parse(String(e||""));if((t==null?void 0:t.type)!==zR)return null;const n=t.clipboard;return!n||!Array.isArray(n.nodes)||n.nodes.length===0?null:n}catch{return null}}function Jq(e){try{localStorage.setItem(FR,Yq(e))}catch{}}function Xq(){try{return Gq(localStorage.getItem(FR))}catch{return null}}function Qq(e){const t=Number.isFinite(e)?e:1;return Math.min(Math.max(t,.75),1)}async function z1(e){var n;const t=String(e||"");if(!t)return!1;try{if((n=navigator.clipboard)!=null&&n.writeText)return await navigator.clipboard.writeText(t),!0}catch{}try{const r=document.createElement("textarea");r.value=t,r.setAttribute("readonly",""),r.style.position="fixed",r.style.left="-9999px",r.style.top="0",document.body.appendChild(r),r.focus(),r.select();const s=document.execCommand("copy");return document.body.removeChild(r),s}catch{return!1}}function B1(e,t,n){const r=Number(e);return!Number.isFinite(r)||r<=0?0:Math.min(n,Math.max(t,Math.round(r)))}function Ca(e,{display:t=!1}={}){if(!e||typeof e!="object")return null;const n=Number(e.width),r=Number(e.height);return!Number.isFinite(n)||!Number.isFinite(r)||n<=0||r<=0?null:t?{width:Math.round(n),height:Math.round(r)}:{width:B1(n,SR,NR)||vR,height:B1(r,Th,jR)||Th}}function Bh(e){const t=Ca(e,{display:!0});return t?{width:Math.max(320,Math.round(t.width)),height:Math.max(180,Math.round(t.height))}:null}function Zq(e){const t=String(e||"").trim().toLowerCase();return t==="html"||t==="react"?{width:720,height:520}:t==="table"||t==="chart"?{width:640,height:380}:t==="image"?{width:520,height:360}:{width:Cw,height:_w}}function eY(e,t=""){const n=Bh(e==null?void 0:e.displaySize);if(n)return n;const r=Bh(e==null?void 0:e.nodeSize);if(r)return r;const s=Ha(t)||Vd(Vo((e==null?void 0:e.inputs)||(e==null?void 0:e.input)||[],"displayType","markdown"));return Zq(s)}function vl(e){var s,i,a,l,c,u,f,d,p,h,g;if(Ys((s=e==null?void 0:e.data)==null?void 0:s.definitionId))return null;const t=!!jn(e==null?void 0:e.data),n=Number(((a=(i=e==null?void 0:e.data)==null?void 0:i.displaySize)==null?void 0:a.width)||((c=(l=e==null?void 0:e.data)==null?void 0:l.nodeSize)==null?void 0:c.width)||(e==null?void 0:e.width)||(t?(u=e==null?void 0:e.measured)==null?void 0:u.width:0)||0),r=Number(((d=(f=e==null?void 0:e.data)==null?void 0:f.displaySize)==null?void 0:d.height)||((h=(p=e==null?void 0:e.data)==null?void 0:p.nodeSize)==null?void 0:h.height)||(e==null?void 0:e.height)||(t?(g=e==null?void 0:e.measured)==null?void 0:g.height:0)||0);return Ca({width:n,height:r},{display:t})}function yl(e,t,n){var f,d,p,h,g,k,w,y,v,b,C,N,j;const r=(e||[]).filter(A=>!Hu(A)),s=(e||[]).filter(Hu),i=BR(jk(r,n||{})),a=t.map(A=>({source:A.source,target:A.target,sourceHandle:A.sourceHandle??null,targetHandle:A.targetHandle??null})).filter(A=>!s.some(I=>I.id===A.source||I.id===A.target)),l={},c={},u=[];for(const A of r){l[A.id]={x:((f=A.position)==null?void 0:f.x)||0,y:((d=A.position)==null?void 0:d.y)||0};const I=vl(A);I&&(c[A.id]=I)}for(const A of s){const I=Number(((h=(p=A.data)==null?void 0:p.nodeSize)==null?void 0:h.width)||A.width||((g=A.measured)==null?void 0:g.width)||0),D=Number(((w=(k=A.data)==null?void 0:k.nodeSize)==null?void 0:w.height)||A.height||((y=A.measured)==null?void 0:y.height)||0);u.push({id:A.id,title:String(((v=A.data)==null?void 0:v.title)||((b=A.data)==null?void 0:b.label)||"Group"),color:String(((C=A.data)==null?void 0:C.color)||"purple"),x:Number(((N=A.position)==null?void 0:N.x)||0),y:Number(((j=A.position)==null?void 0:j.y)||0),width:Math.max(Da,Math.round(I||Da)),height:Math.max(Fa,Math.round(D||Fa))})}return{version:1,instances:i,edges:a,ui:{nodePositions:l,nodeSizes:c,groups:u}}}function BR(e){const t={};for(const[n,r]of Object.entries(e||{})){const s=String((r==null?void 0:r.definitionId)||n);if(!!Ha(s)||s.startsWith("provide_")||!Array.isArray(r==null?void 0:r.output)){t[n]=r;continue}t[n]={...r,output:r.output.map(a=>({...a,value:"",default:""}))}}return t}function Ha(e){const t=String(e||"");return t==="display_markdown"?"markdown":t==="display_mermaid"?"mermaid":t==="display_ascii"?"ascii":t==="display_html"?"html":t==="display_react_app"?"react":t==="display_image"?"image":t==="display_chart"?"chart":t==="display_table"?"table":""}function jn(e){const t=Ha(e==null?void 0:e.definitionId);return t||(Ys(e==null?void 0:e.definitionId)&&$m(e)?Vd(Vo((e==null?void 0:e.inputs)||(e==null?void 0:e.input)||[],"displayType","markdown")):"")}function Yi(e){const t=[...(e==null?void 0:e.inputs)||[],...(e==null?void 0:e.outputs)||[]],n=jn(e),r=Ys(e==null?void 0:e.definitionId),s=n==="image"?"src":"content",i=u=>String((u==null?void 0:u.value)??(u==null?void 0:u.default)??""),a=u=>i(u).trim(),l=t.find(u=>(u==null?void 0:u.name)===s&&a(u))||t.find(u=>(u==null?void 0:u.name)==="filePath"&&a(u))||t.find(u=>(u==null?void 0:u.type)==="text"&&a(u)),c=l?i(l):"";return String(r?c:(e==null?void 0:e.body)||c)}function Wo(e,t=""){const n=String(e||"").trim();if(!n||n.length>260||/[\r\n<>]/.test(n)||/^(?:https?:|data:|blob:|file:|javascript:|mailto:|tel:)/i.test(n))return"";const r=n.replace(/^\/+/,"");if(r.includes("..")||r.startsWith("."))return"";const s=r.split("?")[0].split("#")[0].toLowerCase().split(".").pop()||"";return({html:new Set(["html","htm"]),react:new Set(["json","jsx","tsx","js","txt"]),markdown:new Set(["md","markdown","txt"]),mermaid:new Set(["mmd","mermaid","txt"]),ascii:new Set(["txt","log"]),chart:new Set(["json"]),table:new Set(["json","csv","tsv"])}[t]||new Set(["html","htm","md","markdown","txt","json","csv","tsv"])).has(s)?r:""}function tY(e){let t=String(e||"").replace(/\r\n/g,`
|
|
188
|
-
`).trim();return t.includes(`
|
|
189
|
-
`)||(t=t.replace(/\s+(resultFile|result|outParams|outParams\.[A-Za-z_][A-Za-z0-9_-]*)\s*:/g,`
|
|
190
|
-
$1:`).replace(/(^|\n)outParams:\s+([A-Za-z_][A-Za-z0-9_-]*\s*:)/g,`$1outParams:
|
|
191
|
-
$2`)),t}function wi(e){const t=String(e||"").trim();if(!t)return String(e||"");const n=t.match(/---agentflow\b([\s\S]*?)---end/i);if(n!=null&&n[1]){const a=tY(n[1]),l=a.match(/^resultFile\s*:\s*["']?([^"'\n]+)["']?/m);if(l!=null&&l[1])return l[1].trim();const c=a.match(/^result\s*:\s*(.*)$/m);if(c){const f=String(c[1]||"").trim();return f==="|"||f===">"?a.slice((c.index||0)+c[0].length).split(`
|
|
192
|
-
`).filter(p=>/^\s+/.test(p)||!p.trim()).map(p=>p.replace(/^\s{2}/,"")).join(`
|
|
193
|
-
`).replace(/\s+$/g,""):f.replace(/^["']|["']$/g,"")}const u=t.replace(n[0],"").trim();if(u)return u}if(!/["']result["']\s*:|["']outParams["']\s*:|["']resultFile["']\s*:/i.test(t))return String(e||"");const r=[t],s=t.indexOf("{"),i=t.lastIndexOf("}");s>=0&&i>s&&r.unshift(t.slice(s,i+1));for(const a of r)try{const l=JSON.parse(a);if(l&&typeof l=="object"&&!Array.isArray(l)&&(Object.prototype.hasOwnProperty.call(l,"result")||Object.prototype.hasOwnProperty.call(l,"resultFile"))){const c=l.resultFile||l.result;return typeof c=="string"?c:JSON.stringify(c,null,2)}}catch{}return String(e||"")}async function Wa(e,t){const n=Cr(e);n.set("path",t);const r=await fetch(`/api/workspace/file?${n.toString()}`),s=await r.json().catch(()=>({}));if(!r.ok)throw new Error(s.error||`读取文件失败:${t}`);return String(s.content||"")}async function Rw(e,t,n){const r=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e,path:t,content:String(n||"")})}),s=await r.json().catch(()=>({}));if(!r.ok)throw new Error(s.error||`写入文件失败:${t}`);return s.path||t}function nY(e,t=[],n=[]){const r=String(e||"");if(!r)return"";const s=new Map(t.map(i=>[i.id,i]));return(Array.isArray(n)?n:[]).filter(i=>String((i==null?void 0:i.target)||"")===r).slice(0,4).map(i=>{const a=s.get(String((i==null?void 0:i.source)||""));if(!a)return"";const l=a.data||{},c=String(l.body||"").trim(),u=[`- upstreamId: ${a.id}`,` label: ${String(l.label||a.id).trim()}`,` definitionId: ${String(l.definitionId||"").trim()}`];return c&&u.push(` task: ${c.slice(0,4e3)}`),u.join(`
|
|
194
|
-
`)}).filter(Boolean).join(`
|
|
195
|
-
|
|
196
|
-
`)}function vc(e){let t=wi(e).trim();if(!t)return"";const n=t.match(/```(?:html|HTML)?\s*\n?([\s\S]*?)```/);if(n&&n[1])t=n[1].trim();else{const i=t.match(/```(?:html|HTML)?\s*\n?([\s\S]*)$/);i&&i[1]&&(t=i[1].trim())}t=t.replace(/^html\s*\n/i,"").replace(/```\s*$/g,"").trim();const s=[/<!doctype\b/i,/<html\b/i,/<head\b/i,/<body\b/i,/<style\b/i,/<script\b/i,/<main\b/i,/<section\b/i,/<article\b/i,/<div\b/i,/<svg\b/i,/<canvas\b/i].reduce((i,a)=>{const l=a.exec(t);return l?i<0?l.index:Math.min(i,l.index):i},-1);return s>0&&(t=t.slice(s).trim()),t}function rY(e){const t=vc(e);return t.trim()?/<[^>]*$/g.test(t)?"HTML 内容末尾存在未闭合标签,可能是生成或保存时被截断。":/^(?:<!doctype\b|<html\b)/i.test(t)&&!/<\/html\s*>/i.test(t)?"完整 HTML 文档缺少 </html> 结束标签,可能是生成或保存时被截断。":"":""}function ba(e,t){return e==="html"?rY(t):""}function HR(e,t=""){const n=vc(e);if(!n.trim())return"";const s=`<base target="_blank"><script data-agentflow-display-link-guard="1">
|
|
197
|
-
(() => {
|
|
198
|
-
const frameId = ${JSON.stringify(String(t||""))};
|
|
199
|
-
const postSize = () => {
|
|
200
|
-
const doc = document.documentElement;
|
|
201
|
-
const body = document.body;
|
|
202
|
-
const height = Math.ceil(Math.max(
|
|
203
|
-
doc ? doc.scrollHeight : 0,
|
|
204
|
-
doc ? doc.offsetHeight : 0,
|
|
205
|
-
doc ? doc.clientHeight : 0,
|
|
206
|
-
body ? body.scrollHeight : 0,
|
|
207
|
-
body ? body.offsetHeight : 0,
|
|
208
|
-
body ? body.clientHeight : 0,
|
|
209
|
-
window.innerHeight || 0
|
|
210
|
-
));
|
|
211
|
-
window.parent.postMessage({ source: "agentflow-html-display-size", frameId, height }, "*");
|
|
212
|
-
};
|
|
213
|
-
document.addEventListener("click", (event) => {
|
|
214
|
-
const link = event.target && event.target.closest ? event.target.closest("a[href]") : null;
|
|
215
|
-
if (!link) return;
|
|
216
|
-
const rawHref = String(link.getAttribute("href") || "").trim();
|
|
217
|
-
if (!rawHref || rawHref.startsWith("#")) return;
|
|
218
|
-
if (/^javascript:/i.test(rawHref)) {
|
|
219
|
-
event.preventDefault();
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
event.preventDefault();
|
|
223
|
-
window.open(link.href, "_blank", "noopener,noreferrer");
|
|
224
|
-
}, true);
|
|
225
|
-
window.addEventListener("load", postSize);
|
|
226
|
-
window.addEventListener("resize", postSize);
|
|
227
|
-
requestAnimationFrame(postSize);
|
|
228
|
-
setTimeout(postSize, 60);
|
|
229
|
-
setTimeout(postSize, 300);
|
|
230
|
-
if (typeof ResizeObserver !== "undefined") {
|
|
231
|
-
const resizeObserver = new ResizeObserver(postSize);
|
|
232
|
-
resizeObserver.observe(document.documentElement);
|
|
233
|
-
if (document.body) resizeObserver.observe(document.body);
|
|
234
|
-
}
|
|
235
|
-
if (typeof MutationObserver !== "undefined") {
|
|
236
|
-
const mutationObserver = new MutationObserver(postSize);
|
|
237
|
-
mutationObserver.observe(document.documentElement, { childList: true, subtree: true, attributes: true, characterData: true });
|
|
238
|
-
}
|
|
239
|
-
})();
|
|
240
|
-
<\/script>`;return/data-agentflow-display-link-guard=["']1["']/i.test(n)?n:/<head\b[^>]*>/i.test(n)?n.replace(/<head\b([^>]*)>/i,`<head$1>${s}`):/<html\b[^>]*>/i.test(n)?n.replace(/<html\b([^>]*)>/i,`<html$1><head>${s}</head>`):`<!doctype html><html><head>${s}</head><body>${n}</body></html>`}function sY(e,t){const n=String(e).trim().replace(/[\\/:*?"<>|]+/g,"-").replace(/\s+/g,"-").replace(/^-+|-+$/g,"")||"html-render",r=String(t).replace(/^\.+/,"")||"png";return`${n}.${r}`}function iY(e,t){const n=document.createElement("a");n.href=e,n.download=t,document.body.appendChild(n),n.click(),n.remove()}function oY(e,t){const n=URL.createObjectURL(e);try{iY(n,t)}finally{window.setTimeout(()=>URL.revokeObjectURL(n),1e3)}}function WR(e){var t;try{return(e==null?void 0:e.contentDocument)||((t=e==null?void 0:e.contentWindow)==null?void 0:t.document)||null}catch{return null}}function aY(e){const t=WR(e);return t!=null&&t.documentElement?`${t.doctype?`<!DOCTYPE ${t.doctype.name}${t.doctype.publicId?` PUBLIC "${t.doctype.publicId}"`:""}${t.doctype.systemId?` "${t.doctype.systemId}"`:""}>`:"<!DOCTYPE html>"}
|
|
241
|
-
${t.documentElement.outerHTML}`:""}function Ty(e){var n;if(!e)return null;const t=(n=e.getBoundingClientRect)==null?void 0:n.call(e);return{rectWidth:t!=null&&t.width?Math.round(t.width):null,rectHeight:t!=null&&t.height?Math.round(t.height):null,clientWidth:e.clientWidth||null,clientHeight:e.clientHeight||null,scrollWidth:e.scrollWidth||null,scrollHeight:e.scrollHeight||null,offsetWidth:e.offsetWidth||null,offsetHeight:e.offsetHeight||null}}function lY(e,t,n,r={}){var w;const s=(w=e==null?void 0:e.getBoundingClientRect)==null?void 0:w.call(e),i=WR(e),a=i==null?void 0:i.documentElement,l=i==null?void 0:i.body,c=(r==null?void 0:r.card)||null,u=(r==null?void 0:r.displayBody)||null,f=(r==null?void 0:r.scroller)||null,d=(r==null?void 0:r.displaySize)||null,p={fallbackWidth:Number(t)||null,fallbackHeight:Number(n)||null,displaySizeWidth:Number((d==null?void 0:d.width)||0)||null,displaySizeHeight:Number((d==null?void 0:d.height)||0)||null,rectWidth:s!=null&&s.width?Math.round(s.width):null,rectHeight:s!=null&&s.height?Math.round(s.height):null,iframeClientWidth:(e==null?void 0:e.clientWidth)||null,iframeClientHeight:(e==null?void 0:e.clientHeight)||null,docScrollWidth:(a==null?void 0:a.scrollWidth)||null,docScrollHeight:(a==null?void 0:a.scrollHeight)||null,bodyScrollWidth:(l==null?void 0:l.scrollWidth)||null,bodyScrollHeight:(l==null?void 0:l.scrollHeight)||null,docOffsetWidth:(a==null?void 0:a.offsetWidth)||null,bodyOffsetWidth:(l==null?void 0:l.offsetWidth)||null,card:Ty(c),displayBody:Ty(u),scroller:Ty(f)},h=[Number(t)||0,Number((d==null?void 0:d.width)||0),Number((c==null?void 0:c.clientWidth)||0),Number((c==null?void 0:c.scrollWidth)||0),Number((u==null?void 0:u.clientWidth)||0),Number((u==null?void 0:u.scrollWidth)||0),Number((f==null?void 0:f.clientWidth)||0),Number((f==null?void 0:f.scrollWidth)||0),Number(s==null?void 0:s.width)||0,Number(e==null?void 0:e.clientWidth)||0,Number((a==null?void 0:a.scrollWidth)||0),Number((l==null?void 0:l.scrollWidth)||0),Number((a==null?void 0:a.offsetWidth)||0),Number((l==null?void 0:l.offsetWidth)||0)].map(y=>Math.ceil(y)).filter(y=>y>0),g=Math.max(1,...h.length?h:[960]),k=Math.max(1,Math.round(Number(n)||(s==null?void 0:s.height)||(e==null?void 0:e.clientHeight)||640),Math.ceil(Number((a==null?void 0:a.scrollHeight)||0)),Math.ceil(Number((l==null?void 0:l.scrollHeight)||0)));return{width:g,height:k,debug:p}}async function cY({flowParams:e,content:t,sourceFilePath:n,iframe:r,width:s,height:i,filename:a,snapshotElements:l,displaySize:c}){const u=lY(r,s,i,{...l||{},displaySize:c}),f=aY(r),d=await fetch("/api/workspace/html-screenshot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e,content:f||t,sourceFilePath:n||"",width:u.width,height:u.height,filename:a})});if(!d.ok){const h=await d.json().catch(()=>({}));throw new Error(h.error||"截图失败")}const p=await d.blob();oY(p,a)}function uY(e){const n=[...(e==null?void 0:e.inputs)||[],...(e==null?void 0:e.outputs)||[]].find(r=>(r==null?void 0:r.name)==="alt");return String((n==null?void 0:n.value)||(n==null?void 0:n.default)||(e==null?void 0:e.label)||"Image preview")}function VR(e){return e==="mermaid"?"account_tree":e==="ascii"?"notes":e==="html"?"html":e==="react"?"deployed_code":e==="image"?"image":e==="chart"?"bar_chart":e==="table"?"table":"article"}function dY(e){const t=String(e||"").split(/\r?\n/).map(l=>l.replace(/%%.*$/,"").trim()).filter(Boolean),n=new Map,r=[];let s="TD";const i=(l,c="")=>{const u=String(l||"").replace(/[^A-Za-z0-9_]/g,"_")||`N${n.size+1}`;return n.has(u)?c&&(n.get(u).label=c):n.set(u,{id:u,label:c||u}),u},a=l=>{const c=String(l||"").trim().replace(/[;,]+$/,""),u=c.match(/^([A-Za-z][A-Za-z0-9_]*)(?:\[(.+?)\]|\((.+?)\)|\{(.+?)\})?$/);return u?i(u[1],u[2]||u[3]||u[4]||u[1]):i(c.replace(/[^A-Za-z0-9_]/g,"_"),c)};for(const l of t){const c=l.match(/^(graph|flowchart)\s+(TD|TB|BT|LR|RL)\b/i);if(c){s=c[2].toUpperCase();continue}const u=l.match(/^(.+?)\s*-{1,2}>+\s*(.+)$/);if(u){r.push({from:a(u[1]),to:a(u[2])});continue}a(l)}return{nodes:Array.from(n.values()),edges:r,direction:s}}function KR({code:e}){const t=m.useMemo(()=>dY(e),[e]);if(!String(e||"").trim())return null;const n=t.direction==="LR"||t.direction==="RL",r=142,s=44,i=n?96:32,a=n?30:68,l=new Map;t.nodes.forEach((f,d)=>{l.set(f.id,{x:24+(n?d*(r+i):d%3*(r+i)),y:24+(n?d%3*(s+a):d*(s+a))})});const c=Math.max(360,...Array.from(l.values()).map(f=>f.x+r+24)),u=Math.max(180,...Array.from(l.values()).map(f=>f.y+s+24));return o.jsx("div",{className:"af-work-node__mermaid-preview",children:o.jsxs("svg",{viewBox:`0 0 ${c} ${u}`,role:"img","aria-label":"Mermaid preview",children:[o.jsx("defs",{children:o.jsx("marker",{id:"af-work-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:o.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z"})})}),t.edges.map((f,d)=>{const p=l.get(f.from),h=l.get(f.to);if(!p||!h)return null;const g=n?`M ${p.x+r} ${p.y+s/2} C ${(p.x+h.x+r)/2} ${p.y+s/2}, ${(p.x+h.x+r)/2} ${h.y+s/2}, ${h.x} ${h.y+s/2}`:`M ${p.x+r/2} ${p.y+s} C ${p.x+r/2} ${p.y+s+28}, ${h.x+r/2} ${h.y-28}, ${h.x+r/2} ${h.y}`;return o.jsx("path",{className:"af-work-node__mermaid-edge",d:g,markerEnd:"url(#af-work-arrow)"},`${f.from}-${f.to}-${d}`)}),t.nodes.map(f=>{const d=l.get(f.id);return o.jsxs("g",{children:[o.jsx("rect",{className:"af-work-node__mermaid-box",x:d.x,y:d.y,width:r,height:s,rx:"8"}),o.jsx("text",{className:"af-work-node__mermaid-text",x:d.x+r/2,y:d.y+s/2+5,textAnchor:"middle",children:f.label.slice(0,22)})]},f.id)})]})})}function si({className:e="",children:t}){const n=m.useRef(null),r=m.useRef(null),[s,i]=m.useState({visible:!1,top:0,height:100}),a=m.useCallback(()=>{const f=n.current;if(!f)return;const d=Math.max(1,f.scrollHeight),p=Math.max(1,f.clientHeight),h=d>p+1,g=h?Math.max(12,p/d*100):100,k=Math.max(0,100-g),w=h?Math.min(k,f.scrollTop/Math.max(1,d-p)*k):0;i({visible:h,top:w,height:g})},[]);m.useEffect(()=>{const f=requestAnimationFrame(a),d=n.current;if(!d||typeof ResizeObserver>"u")return()=>cancelAnimationFrame(f);const p=new ResizeObserver(a);p.observe(d);for(const h of Array.from(d.children))p.observe(h);return()=>{cancelAnimationFrame(f),p.disconnect()}},[t,a]);const l=m.useCallback(f=>{const d=n.current;if(!d)return;const p=Math.max(0,d.scrollHeight-d.clientHeight);d.scrollTop=Math.min(1,Math.max(0,f))*p,a()},[a]),c=m.useCallback((f,d=0)=>{const p=r.current;if(!p)return 0;const h=p.getBoundingClientRect(),g=s.height/100*h.height,k=Math.max(1,h.height-g);return(f-h.top-d)/k},[s.height]),u=m.useCallback(f=>{var C,N;if(!s.visible)return;f.preventDefault(),f.stopPropagation();const d=r.current;if(!d)return;const p=d.getBoundingClientRect(),h=s.top/100*p.height,g=s.height/100*p.height,w=f.clientY>=p.top+h&&f.clientY<=p.top+h+g?f.clientY-p.top-h:g/2;l(c(f.clientY,w));const y=f.pointerId;(N=(C=f.currentTarget).setPointerCapture)==null||N.call(C,y);const v=j=>{j.preventDefault(),l(c(j.clientY,w))},b=()=>{window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",b)};window.addEventListener("pointermove",v),window.addEventListener("pointerup",b),window.addEventListener("pointercancel",b)},[c,l,s.height,s.top,s.visible]);return o.jsxs("div",{className:`af-visible-scroll-frame ${e}`,children:[o.jsx("div",{ref:n,className:`af-visible-scroll-frame__scroller ${e}`,onScroll:a,children:t}),o.jsx("div",{ref:r,className:"af-visible-scrollbar"+(s.visible?" af-visible-scrollbar--visible":""),onPointerDown:u,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${s.height}%`,top:`${s.top}%`}})})]})}function UR({data:e,flowParams:t,htmlFrameRef:n,htmlFrameVersion:r=0}){const s=jn(e),i=Yi(e),a=s==="image"?i:wi(i),l=s==="image"?"":Wo(a,s),[c,u]=m.useState(""),[f,d]=m.useState(""),[p,h]=m.useState(!1);m.useEffect(()=>{let v=!1;return l?(h(!0),d(""),u(""),Wa(t,l).then(b=>{v||u(b)}).catch(b=>{v||d(String(b.message||b))}).finally(()=>{v||h(!1)}),()=>{v=!0}):(u(""),d(""),h(!1),()=>{v=!0})},[l,t==null?void 0:t.flowId,t==null?void 0:t.flowSource,t==null?void 0:t.archived,e==null?void 0:e.displayReloadKey]);const g=l?c:a,k=s==="html"?vc(g):s==="react"?Tm(g):wi(g),w=m.useRef("");if(w.current||(w.current=`html-display-${Math.random().toString(36).slice(2,10)}`),!s)return null;const y=ba(s,k);if(p)return o.jsxs(si,{className:"af-work-display-empty",children:["Loading ",l,"..."]});if(f)return o.jsx(si,{className:"af-work-display-empty",children:f});if(y)return o.jsx(si,{className:"af-work-display-empty",children:y});if(!k.trim())return o.jsx(si,{className:"af-work-display-empty",children:"No display content"});if(s==="html"||s==="react")return o.jsx("div",{className:"af-work-display-body af-work-display-body--html",children:o.jsx("iframe",{ref:n,className:"af-work-display-html-frame",title:(e==null?void 0:e.label)||(s==="react"?"React app preview":"HTML preview"),sandbox:"allow-scripts allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox",srcDoc:s==="react"?Ck(k,w.current):HR(k,w.current)},r)});if(s==="image"){const v=vd(k,t);return o.jsx(si,{className:"af-work-display-body af-work-display-body--image",children:o.jsx("img",{className:"af-work-display-image",src:v,alt:uY(e),loading:"lazy"})})}return s==="markdown"?o.jsx(si,{className:"af-work-display-body af-work-display-body--markdown",children:o.jsx(bk,{content:k,basePath:l,resolveSrc:(v,b)=>vd(v,t,b)})}):s==="chart"?o.jsx(si,{className:"af-work-display-body af-work-display-body--chart",children:o.jsx(vk,{content:k})}):s==="table"?o.jsx(si,{className:"af-work-display-body af-work-display-body--table",children:o.jsx(kk,{content:k})}):s==="mermaid"?o.jsxs(si,{className:"af-work-display-body",children:[o.jsx(KR,{code:k}),o.jsx("pre",{className:"af-work-node__diagram af-work-node__diagram--mermaid",children:k})]}):o.jsx(si,{className:"af-work-display-body af-work-display-body--ascii",children:o.jsx("pre",{className:"af-work-node__diagram af-work-node__diagram--ascii",children:k})})}function fY({node:e,onClose:t}){var v,b,C,N,j,A,I,D,H,V,F;const n=m.useRef(null),r=jn(e==null?void 0:e.data),s=((v=e==null?void 0:e.data)==null?void 0:v.label)||(r==="html"?"HTML 展示":r==="markdown"?"Markdown 展示":"Display 预览"),i=!!((b=e==null?void 0:e.data)!=null&&b.readOnly),[a,l]=m.useState(!1),[c,u]=m.useState(""),[f,d]=m.useState(""),[p,h]=m.useState(!1),g=Yi(e==null?void 0:e.data),k=r==="markdown"?wi(g):"",w=r==="markdown"?Wo(k,"markdown"):"",y=r==="markdown"?w?f:k:"";return m.useEffect(()=>{const L=M=>{if(M.key==="Escape"){if(a){u(String(y||"")),l(!1);return}t==null||t()}};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[y,a,t]),m.useEffect(()=>{var M;let L=!1;return r!=="markdown"||!w?(d(""),h(!1),()=>{L=!0}):(h(!0),Wa(((M=e==null?void 0:e.data)==null?void 0:M.flowParams)||{},w).then(K=>{L||d(K)}).catch(K=>{var W,$;L||(d(""),($=(W=e==null?void 0:e.data)==null?void 0:W.onStatus)==null||$.call(W,String(K.message||K)))}).finally(()=>{L||h(!1)}),()=>{L=!0})},[r,w,(N=(C=e==null?void 0:e.data)==null?void 0:C.flowParams)==null?void 0:N.flowId,(A=(j=e==null?void 0:e.data)==null?void 0:j.flowParams)==null?void 0:A.flowSource,(D=(I=e==null?void 0:e.data)==null?void 0:I.flowParams)==null?void 0:D.archived,(H=e==null?void 0:e.data)==null?void 0:H.displayReloadKey]),m.useEffect(()=>{a||u(String(y||""))},[y,a]),e?cr.createPortal(o.jsx("div",{className:"af-display-preview-overlay",role:"dialog","aria-modal":"true","aria-label":"全屏预览",children:o.jsxs("div",{className:"af-display-preview-shell",children:[o.jsxs("div",{className:"af-display-preview-head",children:[o.jsxs("div",{className:"af-display-preview-title",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:VR(r)}),o.jsx("strong",{children:s}),o.jsx("span",{children:e.id})]}),o.jsxs("div",{className:"af-display-preview-actions",children:[r==="markdown"?a?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-display-preview-action",disabled:i||p,onClick:async()=>{var L,M;try{await YR({nodeId:e.id,data:e.data,filePath:w,content:c,setFileContent:d}),l(!1)}catch(K){(M=(L=e==null?void 0:e.data)==null?void 0:L.onStatus)==null||M.call(L,String(K.message||K))}},"aria-label":"保存并预览",title:"保存并预览",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"done"})}),o.jsx("button",{type:"button",className:"af-display-preview-action",onClick:()=>{u(String(y||"")),l(!1)},"aria-label":"取消编辑",title:"取消编辑",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}):o.jsx("button",{type:"button",className:"af-display-preview-action",disabled:i||p,onClick:()=>{u(String(y||"")),l(!0)},"aria-label":"编辑 Markdown",title:"编辑 Markdown",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"edit"})}):null,o.jsx("button",{type:"button",className:"af-display-preview-action",onClick:t,"aria-label":"关闭全屏预览",title:"关闭",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close_fullscreen"})})]})]}),o.jsx("div",{className:"af-display-preview-content",children:r==="markdown"&&a?o.jsx(qR,{value:c,onChange:u,onUploadImage:(V=e.data)==null?void 0:V.onUploadWorkspaceImage,readOnly:i}):o.jsx(UR,{data:e.data,flowParams:(F=e.data)==null?void 0:F.flowParams,htmlFrameRef:n})})]})}),document.body):null}function pY({node:e}){var p,h,g,k,w,y,v,b,C,N;const t=jn(e==null?void 0:e.data),n=Yi(e==null?void 0:e.data),r=t==="image"?n:wi(n),s=t==="image"?"":Wo(r,t),[i,a]=m.useState(""),[l,c]=m.useState(!1);m.useEffect(()=>{var A;let j=!1;return s?(c(!0),a(""),Wa(((A=e==null?void 0:e.data)==null?void 0:A.flowParams)||{},s).then(I=>{j||a(I)}).catch(()=>{j||a("")}).finally(()=>{j||c(!1)}),()=>{j=!0}):(a(""),c(!1),()=>{j=!0})},[s,(h=(p=e==null?void 0:e.data)==null?void 0:p.flowParams)==null?void 0:h.flowId,(k=(g=e==null?void 0:e.data)==null?void 0:g.flowParams)==null?void 0:k.flowSource,(y=(w=e==null?void 0:e.data)==null?void 0:w.flowParams)==null?void 0:y.archived,(v=e==null?void 0:e.data)==null?void 0:v.displayReloadKey]);const u=s?i:r,f=t==="html"?vc(u):t==="react"?Tm(u):wi(u),d=ba(t,f);return l?o.jsx("div",{className:"af-display-picker-preview__empty",children:"Loading"}):d?o.jsx("div",{className:"af-display-picker-preview__empty",children:d}):f.trim()?t==="html"||t==="react"?o.jsx("iframe",{title:((b=e==null?void 0:e.data)==null?void 0:b.label)||(e==null?void 0:e.id),sandbox:"allow-scripts allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox",srcDoc:t==="react"?Ck(f):HR(f)}):t==="image"?o.jsx("img",{src:vd(f,(C=e==null?void 0:e.data)==null?void 0:C.flowParams),alt:((N=e==null?void 0:e.data)==null?void 0:N.label)||(e==null?void 0:e.id),loading:"lazy"}):t==="markdown"?o.jsx("div",{className:"af-display-picker-preview__markdown",children:o.jsx(bk,{content:f,basePath:s,resolveSrc:(j,A)=>{var I;return vd(j,(I=e==null?void 0:e.data)==null?void 0:I.flowParams,A)}})}):t==="chart"?o.jsx(vk,{content:f}):t==="table"?o.jsx(kk,{content:f}):t==="mermaid"?o.jsxs("div",{className:"af-display-picker-preview__diagram",children:[o.jsx(KR,{code:f}),o.jsx("pre",{children:f})]}):o.jsx("pre",{className:"af-display-picker-preview__pre",children:f}):o.jsx("div",{className:"af-display-picker-preview__empty",children:"No content"})}function qR({value:e,onChange:t,onUploadImage:n,readOnly:r=!1}){const s=m.useRef(null),i=m.useRef(null),a=m.useRef(null),[l,c]=m.useState(!1),[u,f]=m.useState({visible:!1,top:0,height:100}),d=m.useCallback(()=>{const y=s.current;if(!y)return;const v=Math.max(1,y.scrollHeight),b=Math.max(1,y.clientHeight),C=v>b+1,N=C?Math.max(12,b/v*100):100,j=Math.max(0,100-N),A=C?Math.min(j,y.scrollTop/Math.max(1,v-b)*j):0;f({visible:C,top:A,height:N})},[]);m.useEffect(()=>{const y=requestAnimationFrame(d),v=s.current;if(!v||typeof ResizeObserver>"u")return()=>cancelAnimationFrame(y);const b=new ResizeObserver(d);return b.observe(v),()=>{cancelAnimationFrame(y),b.disconnect()}},[d,e]);const p=m.useCallback(y=>{const v=s.current;if(!v)return;const b=Math.max(0,v.scrollHeight-v.clientHeight);v.scrollTop=Math.min(1,Math.max(0,y))*b,d()},[d]),h=m.useCallback((y,v=0)=>{const b=a.current;if(!b)return 0;const C=b.getBoundingClientRect(),N=u.height/100*C.height,j=Math.max(1,C.height-N);return(y-C.top-v)/j},[u.height]),g=m.useCallback(y=>{if(!u.visible)return;y.preventDefault(),y.stopPropagation();const v=a.current;if(!v)return;const b=v.getBoundingClientRect(),C=u.top/100*b.height,N=u.height/100*b.height,A=y.clientY>=b.top+C&&y.clientY<=b.top+C+N?y.clientY-b.top-C:N/2;p(h(y.clientY,A));const I=H=>{H.preventDefault(),p(h(H.clientY,A))},D=()=>{window.removeEventListener("pointermove",I),window.removeEventListener("pointerup",D),window.removeEventListener("pointercancel",D)};window.addEventListener("pointermove",I),window.addEventListener("pointerup",D),window.addEventListener("pointercancel",D)},[h,p,u.height,u.top,u.visible]),k=m.useCallback(y=>{const v=String(e||""),b=s.current,C=Number((b==null?void 0:b.selectionStart)??v.length),N=Number((b==null?void 0:b.selectionEnd)??C),j=v.slice(0,C),A=v.slice(N),I=j&&!j.endsWith(`
|
|
242
|
-
`)?`
|
|
243
|
-
`:"",D=A&&!A.startsWith(`
|
|
244
|
-
`)?`
|
|
245
|
-
`:"",H=`${j}${I}${y}${D}${A}`;t==null||t(H),window.requestAnimationFrame(()=>{var F,L;const V=j.length+I.length+y.length;(F=s.current)==null||F.focus(),(L=s.current)==null||L.setSelectionRange(V,V)})},[t,e]),w=m.useCallback(async y=>{if(!r&&!(!y||l)){c(!0);try{const v=await(n==null?void 0:n(y)),b=String(v||"").trim();if(b){const C=String(y.name||"image").replace(/\.[^.]+$/g,"").trim()||"image";k(``)}}finally{c(!1)}}},[k,n,r,l]);return o.jsxs("div",{className:"af-work-display-editor nodrag nopan",onClick:y=>y.stopPropagation(),onDragOver:y=>{var b;Array.from(((b=y.dataTransfer)==null?void 0:b.items)||[]).some(C=>String((C==null?void 0:C.type)||"").startsWith("image/"))&&(y.preventDefault(),y.dataTransfer.dropEffect="copy")},onDrop:y=>{var b;const v=Array.from(((b=y.dataTransfer)==null?void 0:b.files)||[]).find(Mh);v&&(y.preventDefault(),w(v))},children:[o.jsxs("div",{className:"af-work-display-editor__toolbar",children:[o.jsx("button",{type:"button",className:"af-work-display-card__action",disabled:l||r,onClick:()=>{var y;return(y=i.current)==null?void 0:y.click()},"aria-label":"上传图片",title:"上传图片",children:o.jsx("span",{className:"material-symbols-outlined",children:l?"hourglass_top":"add_photo_alternate"})}),o.jsx("input",{ref:i,className:"af-hidden-file-input",type:"file",accept:"image/*",onChange:y=>{var b;const v=(b=y.target.files)==null?void 0:b[0];y.target.value="",v&&w(v)}})]}),o.jsx("textarea",{ref:s,className:"af-work-display-editor__textarea",value:e,onChange:y=>t==null?void 0:t(y.target.value),onScroll:d,onKeyDown:y=>{y.key==="Escape"&&y.stopPropagation()},placeholder:"输入 Markdown 内容",spellCheck:!1,readOnly:r}),o.jsx("div",{ref:a,className:"af-work-display-editor__scrollbar"+(u.visible?" af-work-display-editor__scrollbar--visible":""),onPointerDown:g,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${u.height}%`,top:`${u.top}%`}})})]})}function hY({nodeId:e,data:t}){const n=t==null?void 0:t.nodeChatActive,r=!!(t!=null&&t.selected),s=(t==null?void 0:t.nodeChat)||{},i=Array.isArray(s.messages)?s.messages:[],a=String(s.draft||""),[l,c]=m.useState(a),u=m.useRef(!1),f=String(s.candidateContent||""),d=!!s.running,p=!!(t!=null&&t.readOnly),h=String(s.error||""),g=i.slice(-2);return m.useEffect(()=>{u.current||c(a)},[a]),!n&&!r?null:n?o.jsxs("div",{className:"af-work-node-chat nodrag nopan",onClick:k=>k.stopPropagation(),children:[o.jsxs("div",{className:"af-work-node-chat__head",children:[o.jsxs("div",{children:[o.jsx("strong",{children:"继续微调"}),o.jsx("span",{children:(t==null?void 0:t.label)||e})]}),o.jsx("button",{type:"button",onClick:()=>{var k;return(k=t==null?void 0:t.onCloseNodeChat)==null?void 0:k.call(t)},"aria-label":"关闭节点微调",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),i.length>0||d||h?o.jsxs("div",{className:"af-work-node-chat__messages",children:[g.map((k,w)=>o.jsxs("div",{className:`af-work-node-chat__msg af-work-node-chat__msg--${k.role==="assistant"?"assistant":"user"}`,children:[o.jsx("span",{children:k.role==="assistant"?"AI":"你"}),o.jsx("p",{children:k.text})]},`${k.at||w}-${w}`)),d?o.jsx("div",{className:"af-work-node-chat__pending",children:"生成中..."}):null,h?o.jsx("div",{className:"af-work-node-chat__error",children:h}):null]}):null,o.jsxs("div",{className:"af-work-node-chat__composer",children:[o.jsx("button",{type:"button",className:"af-work-node-chat__add",disabled:d||p,"aria-label":"添加上下文",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add"})}),o.jsx("textarea",{className:"af-work-node-chat__input",rows:2,value:l,disabled:d||p,placeholder:"描述你想怎么调整这个展示",onCompositionStart:()=>{u.current=!0},onCompositionEnd:k=>{var y;u.current=!1;const w=k.currentTarget.value;c(w),(y=t==null?void 0:t.onUpdateNodeChatDraft)==null||y.call(t,e,w)},onChange:k=>{var y;const w=k.target.value;c(w),u.current||(y=t==null?void 0:t.onUpdateNodeChatDraft)==null||y.call(t,e,w)},onKeyDown:k=>{var w,y;k.isComposing||(w=k.nativeEvent)!=null&&w.isComposing||k.keyCode===229||(k.metaKey||k.ctrlKey)&&k.key==="Enter"&&(k.preventDefault(),(y=t==null?void 0:t.onSendNodeChat)==null||y.call(t,e,l))}}),o.jsx("button",{type:"button",className:"af-work-node-chat__send",disabled:d||p||!l.trim(),onClick:()=>{var k;return(k=t==null?void 0:t.onSendNodeChat)==null?void 0:k.call(t,e,l)},"aria-label":"发送",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_upward"})})]}),f.trim()?o.jsx("div",{className:"af-work-node-chat__messages",children:o.jsxs("div",{className:"af-work-node-chat__msg af-work-node-chat__msg--assistant",children:[o.jsx("span",{children:"AI"}),o.jsx("p",{children:f})]})}):null]}):o.jsxs("button",{type:"button",className:"af-work-node-chat-anchor nodrag nopan",onClick:k=>{var w;k.stopPropagation(),(w=t==null?void 0:t.onToggleNodeChat)==null||w.call(t,e)},title:"微调这个节点","aria-label":"微调这个节点",children:[o.jsx("span",{className:"material-symbols-outlined af-work-node-chat-anchor__plus","aria-hidden":!0,children:"add"}),o.jsx("span",{className:"af-work-node-chat-anchor__label",children:"继续微调这个展示"}),o.jsx("span",{className:"material-symbols-outlined af-work-node-chat-anchor__expand","aria-hidden":!0,children:"open_in_full"})]})}function mY(e){return e==="mermaid"?"mmd":e==="ascii"?"txt":e==="html"?"html":e==="react"?"json":e==="image"?"txt":e==="chart"||e==="table"?"json":"md"}function gY(e){return String(e).trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)||"display"}function yY(e){return String(e||"node").trim().replace(/[^a-zA-Z0-9._-]+/g,"_").replace(/^_+|_+$/g,"").slice(0,120)||"node"}function H1(e,t=""){const n=Wo(e,t).replace(/^\/+/,"");return n.startsWith("outputs/")?n:""}function xY(e,t){const n=yY(e),r=new Set,s=jn(t)||"";Ys(t==null?void 0:t.definitionId)&&r.add(`outputs/${n}`);const i=H1(Yi(t),s);return i&&r.add(i),(Array.isArray(t==null?void 0:t.outputs)?t.outputs:[]).some(c=>{const u=String((c==null?void 0:c.value)??(c==null?void 0:c.default)??"").trim().replace(/^\/+/,""),f=H1(u,s);return f&&r.add(f),u===`outputs/${n}`||u.startsWith(`outputs/${n}/`)})&&r.add(`outputs/${n}`),Array.from(r)}function W1(e,t){const n=jn(t)||"markdown";return`outputs/${gY((t==null?void 0:t.label)||e||n)}.${mY(n)}`}async function YR({nodeId:e,data:t,filePath:n,content:r,setFileContent:s}){var i,a;if(n){const l=await Rw((t==null?void 0:t.flowParams)||{},n,r);s==null||s(r),(i=t==null?void 0:t.onSetDisplayNodeContent)==null||i.call(t,e,l,"replace",{logChat:!1,reloadDisplay:!0,statusMessage:`已更新 ${l}`});return}(a=t==null?void 0:t.onSetDisplayNodeContent)==null||a.call(t,e,r,"replace",{logChat:!1,statusMessage:"已更新 Markdown 内容"})}function GR({id:e,data:t,selected:n,deleteNode:r}){var se,ee,re;const s=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],a=(Array.isArray(t==null?void 0:t.outputs)?t.outputs:[]).map((ne,ue)=>({slot:ne,idx:ue})).sort((ne,ue)=>{var Le,nt,wt,mt;const de=String(((Le=ne.slot)==null?void 0:Le.name)||"").trim(),xe=String(((nt=ue.slot)==null?void 0:nt.name)||"").trim();if(de==="next"&&xe!=="next")return-1;if(xe==="next"&&de!=="next")return 1;const ze=String(((wt=ne.slot)==null?void 0:wt.type)||"").trim(),Te=String(((mt=ue.slot)==null?void 0:mt.type)||"").trim();return ze==="node"&&Te!=="node"?-1:Te==="node"&&ze!=="node"?1:ne.idx-ue.idx}),l=jn(t),c=m.useRef(null),u=m.useRef(null),[f,d]=m.useState(0),[p,h]=m.useState(!1),[g,k]=m.useState(!1),[w,y]=m.useState(!1),[v,b]=m.useState(""),[C,N]=m.useState(""),[j,A]=m.useState(!1),[I,D]=m.useState(!1),H=m.useRef(null),V=Yi(t),F=l==="markdown"?wi(V):"",L=l==="markdown"?Wo(F,"markdown"):"",M=l==="markdown"?L?C:F:"",K=!!(t!=null&&t.readOnly),W=!!(t!=null&&t.displayPageMode);m.useEffect(()=>{let ne=!1;return l!=="markdown"||!L?(N(""),A(!1),()=>{ne=!0}):(A(!0),Wa((t==null?void 0:t.flowParams)||{},L).then(ue=>{ne||N(ue)}).catch(ue=>{var de;ne||(N(""),(de=t==null?void 0:t.onStatus)==null||de.call(t,String(ue.message||ue)))}).finally(()=>{ne||A(!1)}),()=>{ne=!0})},[l,L,(se=t==null?void 0:t.flowParams)==null?void 0:se.flowId,(ee=t==null?void 0:t.flowParams)==null?void 0:ee.flowSource,(re=t==null?void 0:t.flowParams)==null?void 0:re.archived,t==null?void 0:t.displayReloadKey]),m.useEffect(()=>{if(!g)return;const ne=()=>k(!1);return window.addEventListener("pointerup",ne,!0),window.addEventListener("pointercancel",ne,!0),window.addEventListener("mouseup",ne,!0),window.addEventListener("blur",ne),()=>{window.removeEventListener("pointerup",ne,!0),window.removeEventListener("pointercancel",ne,!0),window.removeEventListener("mouseup",ne,!0),window.removeEventListener("blur",ne)}},[g]),m.useEffect(()=>{w||b(String(M||""))},[M,w]);const $=(t==null?void 0:t.label)||(l==="mermaid"?"Mermaid":l==="ascii"?"ASCII":l==="html"?"HTML":l==="react"?"React App":l==="image"?"Image":l==="chart"?"Chart":l==="table"?"Table":"Markdown"),R=String((t==null?void 0:t.sourceNodeId)||e),B=(t==null?void 0:t.sharingDisplayNodeId)===R,_=t!=null&&t.displaySize&&Number(t.displaySize.width)>0&&Number(t.displaySize.height)>0?{width:Number(t.displaySize.width),height:Number(t.displaySize.height)}:null,X=m.useCallback(async()=>{var Re,it,Nt,qt,Zt,rt,fe,ve,He,Ge;if(l!=="html"||p)return;const ne=Yi(t),ue=Wo(ne,l);let de=ne;if(ue)try{de=await Wa((t==null?void 0:t.flowParams)||{},ue)}catch(je){h(!1),console.warn("Failed to read HTML display file before saving image.",je);return}const xe=vc(de);if(!xe.trim())return;const ze=ba(l,xe);if(ze){console.warn(ze);return}const Te=(it=(Re=u.current)==null?void 0:Re.getBoundingClientRect)==null?void 0:it.call(Re),Le=(qt=(Nt=c.current)==null?void 0:Nt.querySelector)==null?void 0:qt.call(Nt,".af-work-display-body"),nt=(rt=(Zt=c.current)==null?void 0:Zt.querySelector)==null?void 0:rt.call(Zt,".af-visible-scroll-frame__scroller"),wt=Math.round(Math.max(Number((Te==null?void 0:Te.width)||0),Number((_==null?void 0:_.width)||0),Number(((fe=c.current)==null?void 0:fe.clientWidth)||0),Number((Le==null?void 0:Le.clientWidth)||0),Number((nt==null?void 0:nt.clientWidth)||0),Math.max(320,Number((_==null?void 0:_.width)||960)-2))),mt=Math.round(Math.max(Number((Te==null?void 0:Te.height)||0),Number((_==null?void 0:_.height)||0),Number(((ve=c.current)==null?void 0:ve.clientHeight)||0),Number((Le==null?void 0:Le.clientHeight)||0),Number((nt==null?void 0:nt.clientHeight)||0),Math.max(180,Number((_==null?void 0:_.height)||640)-46)));h(!0);try{await cY({flowParams:(t==null?void 0:t.flowParams)||{},content:xe,sourceFilePath:ue,iframe:u.current,width:wt,height:mt,filename:sY((t==null?void 0:t.label)||e||"html-render","png"),snapshotElements:{card:c.current,displayBody:Le,scroller:nt},displaySize:_}),(He=t==null?void 0:t.onStatus)==null||He.call(t,"已导出 HTML 展示截图")}catch(je){const Tt=String((je==null?void 0:je.message)||je||"截图失败");(Ge=t==null?void 0:t.onStatus)==null||Ge.call(t,`HTML 截图失败:${Tt}`),console.warn("Failed to save HTML display as PNG.",je)}finally{h(!1)}},[t,_==null?void 0:_.height,_==null?void 0:_.width,e,l,p]),z=m.useCallback(ne=>{var ue;K||!ne||l!=="image"||(ue=t==null?void 0:t.onUploadImageToDisplayNode)==null||ue.call(t,e,ne)},[t,e,l,K]),T=m.useCallback(ne=>{var ue,de;(ue=ne==null?void 0:ne.stopPropagation)==null||ue.call(ne),!K&&((de=t==null?void 0:t.onSetDisplayNodeContent)==null||de.call(t,e,"","replace",{logChat:!1,reloadDisplay:!0,statusMessage:"已清空 Display 内容"}),l==="markdown"&&(b(""),y(!1)))},[t,e,l,K]),Z=m.useCallback(ne=>{var xe,ze;K||l!=="image"||!(Array.from(((xe=ne.dataTransfer)==null?void 0:xe.files)||[]).some(Mh)||Array.from(((ze=ne.dataTransfer)==null?void 0:ze.items)||[]).some(Te=>String((Te==null?void 0:Te.type)||"").startsWith("image/")))||(ne.preventDefault(),ne.stopPropagation(),ne.dataTransfer.dropEffect="copy",D(!0))},[l,K]),ae=m.useCallback(ne=>{l==="image"&&(ne.currentTarget.contains(ne.relatedTarget)||D(!1))},[l]),J=m.useCallback(ne=>{var de;if(l!=="image")return;const ue=Array.from(((de=ne.dataTransfer)==null?void 0:de.files)||[]).find(Mh);ue&&(ne.preventDefault(),ne.stopPropagation(),D(!1),z(ue))},[l,z]);return o.jsxs("div",{className:"af-work-display-card"+(_?" af-work-display-card--sized":"")+(n?" af-work-display-card--selected":"")+(g?" af-work-display-card--resizing":"")+(I?" af-work-display-card--image-drop":"")+(W?" af-work-display-card--presentation":"")+(t!=null&&t.isExecuting?" af-work-display-card--executing":"")+((t==null?void 0:t.nodeStatus)==="success"?" af-work-display-card--done":"")+((t==null?void 0:t.nodeStatus)==="failed"?" af-work-display-card--failed":""),style:_?{width:_.width,height:_.height}:void 0,ref:c,onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,onDragOver:Z,onDragLeave:ae,onDrop:J,children:[o.jsx(sk,{className:"af-work-display-resize nodrag",position:"bottom-right",minWidth:320,minHeight:180,onResizeStart:()=>k(!0),onResizeEnd:()=>k(!1),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_full"})}),s.map((ne,ue)=>{if(ne.showOnNode===!1)return null;const de=`${4.15+ue*1.75}rem`,xe=ne.name||`#${ue+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:de},children:xe}),o.jsx(Kn,{type:"target",position:Be.Left,id:`input-${ue}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:de,background:_n(ne.type)},title:`${xe} · ${ne.type}`})]},`in-${ue}`)}),a.map(({slot:ne,idx:ue},de)=>{if(ne.showOnNode===!1)return null;const xe=`${4.15+de*1.75}rem`,ze=ne.name||`#${ue+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:xe},children:ze}),o.jsx(Kn,{type:"source",position:Be.Right,id:`output-${ue}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:xe,background:_n(ne.type)},title:`${ze} · ${ne.type}`})]},`out-${ue}`)}),o.jsxs("div",{className:"af-work-display-card__head",children:[o.jsxs("div",{className:"af-work-display-card__title",children:[o.jsx("span",{className:"material-symbols-outlined",children:VR(l)}),o.jsx("strong",{children:$}),o.jsx("span",{children:(t==null?void 0:t.definitionId)||"display"})]}),l==="html"?o.jsxs("div",{className:"af-work-display-card__html-controls nodrag",onClick:ne=>ne.stopPropagation(),children:[o.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>{var ne,ue,de,xe;try{(xe=(de=(ue=(ne=u.current)==null?void 0:ne.contentWindow)==null?void 0:ue.history)==null?void 0:de.back)==null||xe.call(de)}catch{}},"aria-label":"后退",title:"后退",children:o.jsx("span",{className:"material-symbols-outlined",children:"arrow_back"})}),o.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>{var ne,ue,de,xe;try{(xe=(de=(ue=(ne=u.current)==null?void 0:ne.contentWindow)==null?void 0:ue.history)==null?void 0:de.forward)==null||xe.call(de)}catch{}},"aria-label":"前进",title:"前进",children:o.jsx("span",{className:"material-symbols-outlined",children:"arrow_forward"})}),o.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>d(ne=>ne+1),"aria-label":"刷新",title:"刷新",children:o.jsx("span",{className:"material-symbols-outlined",children:"refresh"})}),o.jsx("button",{type:"button",className:"af-work-display-card__action",disabled:p,onClick:X,"aria-label":"截图另存为图片",title:"截图另存为图片",children:o.jsx("span",{className:"material-symbols-outlined",children:p?"hourglass_empty":"photo_camera"})})]}):null,l==="markdown"?w?o.jsxs("div",{className:"af-work-display-card__html-controls nodrag",onClick:ne=>ne.stopPropagation(),children:[o.jsx("button",{type:"button",className:"af-work-display-card__action",disabled:K||j,onClick:async()=>{var ne;try{await YR({nodeId:e,data:t,filePath:L,content:v,setFileContent:N}),y(!1)}catch(ue){(ne=t==null?void 0:t.onStatus)==null||ne.call(t,String(ue.message||ue))}},"aria-label":"保存并预览",title:"保存并预览",children:o.jsx("span",{className:"material-symbols-outlined",children:"done"})}),o.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>{b(String(M||"")),y(!1)},"aria-label":"取消编辑",title:"取消编辑",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}):o.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:K||j,onClick:ne=>{ne.stopPropagation(),b(String(M||"")),y(!0)},"aria-label":"编辑 Markdown",title:"编辑 Markdown",children:o.jsx("span",{className:"material-symbols-outlined",children:"edit"})}):null,l==="image"?o.jsxs(o.Fragment,{children:[o.jsx("input",{ref:H,className:"af-hidden-file-input",type:"file",accept:"image/*",onChange:ne=>{var de;const ue=(de=ne.target.files)==null?void 0:de[0];ne.target.value="",ue&&z(ue)}}),o.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:K,onClick:ne=>{var ue;ne.stopPropagation(),(ue=H.current)==null||ue.click()},"aria-label":"上传图片",title:"上传图片",children:o.jsx("span",{className:"material-symbols-outlined",children:"upload"})})]}):null,o.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",onClick:ne=>{var ue;ne.stopPropagation(),(ue=t==null?void 0:t.onOpenDisplayPreview)==null||ue.call(t,R)},"aria-label":"全屏预览",title:"全屏预览",children:o.jsx("span",{className:"material-symbols-outlined",children:"fullscreen"})}),o.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:B,onClick:ne=>{var ue;ne.stopPropagation(),(ue=t==null?void 0:t.onShareDisplayNode)==null||ue.call(t,R)},"aria-label":"分享展示",title:"分享展示",children:o.jsx("span",{className:"material-symbols-outlined",children:B?"hourglass_empty":"ios_share"})}),o.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:K,onClick:T,"aria-label":"清空内容",title:"清空内容",children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_sweep"})}),o.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:K,onClick:()=>{var ne;return(ne=t==null?void 0:t.onSaveDisplayNodeToFile)==null?void 0:ne.call(t,e,t)},"aria-label":"另存为文件",title:"另存为文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"save"})}),o.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",disabled:K,onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),l==="markdown"&&w?o.jsx(qR,{value:v,onChange:b,onUploadImage:t==null?void 0:t.onUploadWorkspaceImage,readOnly:K}):o.jsx(UR,{data:t,flowParams:t==null?void 0:t.flowParams,htmlFrameRef:u,htmlFrameVersion:f}),o.jsx(hY,{nodeId:e,data:t})]})}function wY({id:e,data:t,selected:n,deleteNode:r}){var f,d,p;const s=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],i=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],a=((d=(f=t==null?void 0:t.runningRunNodeIds)==null?void 0:f.has)==null?void 0:d.call(f,e))||((p=t==null?void 0:t.runningRunNodeIds)==null?void 0:p[e])===!0||(t==null?void 0:t.isExecuting)||(t==null?void 0:t.nodeStatus)==="running",l=(t==null?void 0:t.optimizingRun)===!0,c=(t==null?void 0:t.nodeStatus)==="stopped",u=!!(t!=null&&t.readOnly);return o.jsxs("div",{className:"af-work-run-card"+(n?" af-work-run-card--selected":"")+(a?" af-work-run-card--running":"")+(t!=null&&t.isExecuting?" af-work-run-card--executing":"")+((t==null?void 0:t.nodeStatus)==="success"?" af-work-run-card--done":"")+((t==null?void 0:t.nodeStatus)==="failed"?" af-work-run-card--failed":"")+(c?" af-work-run-card--stopped":""),onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,children:[s.map((h,g)=>{if(h.showOnNode===!1)return null;const k=`${2.25+g*1.75}rem`,w=h.name||`#${g+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:k},children:w}),o.jsx(Kn,{type:"target",position:Be.Left,id:`input-${g}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:k,background:_n(h.type)},title:`${w} · ${h.type}`})]},`in-${g}`)}),i.map((h,g)=>{if(h.showOnNode===!1)return null;const k=`${2.25+g*1.75}rem`,w=h.name||`#${g+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:k},children:w}),o.jsx(Kn,{type:"source",position:Be.Right,id:`output-${g}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:k,background:_n(h.type)},title:`${w} · ${h.type}`})]},`out-${g}`)}),o.jsxs("div",{className:"af-work-run-card__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"play_circle"}),o.jsx("strong",{children:(t==null?void 0:t.label)||"Run"}),o.jsx("span",{children:(t==null?void 0:t.definitionId)||"workspace_run"}),o.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",disabled:u,onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-work-run-card__actions",children:[o.jsxs("button",{type:"button",className:"af-work-run-card__button nodrag"+(a?" af-work-run-card__button--stop":""),disabled:u||l,onClick:h=>{var g,k;h.stopPropagation(),a?(g=t==null?void 0:t.onStopWorkspaceNode)==null||g.call(t,e):(k=t==null?void 0:t.onRunWorkspaceNode)==null||k.call(t,e)},children:[o.jsx("span",{className:"material-symbols-outlined",children:a?"stop_circle":"play_arrow"}),o.jsx("span",{children:a?"Stop":"Run line"})]}),o.jsx("button",{type:"button",className:"af-work-run-card__button af-work-run-card__optimize nodrag"+(l?" af-work-run-card__optimize--running":""),disabled:u||a||l,title:l?"正在优化":"为下游节点提前生成 implementation","aria-label":l?"正在优化":"优化",onClick:h=>{var g;h.stopPropagation(),(g=t==null?void 0:t.onOptimizeWorkspaceRun)==null||g.call(t,e)},children:o.jsx("span",{className:"material-symbols-outlined",children:l?"sync":"auto_fix_high"})}),o.jsx("button",{type:"button",className:"af-work-run-card__button af-work-run-card__logs nodrag",title:"查看执行日志","aria-label":"查看执行日志",onClick:h=>{var g;h.stopPropagation(),(g=t==null?void 0:t.onOpenWorkspaceRunLogs)==null||g.call(t,{nodeId:e,runNodeId:e,scheduleNodeId:"",label:(t==null?void 0:t.label)||"Run"})},children:o.jsx("span",{className:"material-symbols-outlined",children:"article"})})]})]})}function bY({id:e,data:t,selected:n,deleteNode:r,skills:s,skillCollections:i,workspaces:a}){var Ge,je,Tt,kn,dn,en,Pn;const l=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],c=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],u=LY(t),[f,d]=m.useState(u.task),p=m.useRef(!1),h=m.useRef(u.task),g=((je=(Ge=t==null?void 0:t.runningRunNodeIds)==null?void 0:Ge.has)==null?void 0:je.call(Ge,e))||((Tt=t==null?void 0:t.runningRunNodeIds)==null?void 0:Tt[e])===!0||(t==null?void 0:t.isExecuting)||(t==null?void 0:t.nodeStatus)==="running",k=(t==null?void 0:t.nodeStatus)==="stopped",w=!!(t!=null&&t.readOnly),y=Array.isArray(s)?s:[],v=Array.isArray(i)?i:[],b=m.useMemo(()=>(Array.isArray(a)?a:[]).map(te=>({id:String((te==null?void 0:te.id)||""),label:String((te==null?void 0:te.label)||(te==null?void 0:te.name)||"知识库"),kind:(te==null?void 0:te.kind)==="git"?"git":"local",path:String((te==null?void 0:te.path)||""),repoUrl:String((te==null?void 0:te.repoUrl)||""),branch:String((te==null?void 0:te.branch)||""),mountPath:String((te==null?void 0:te.mountPath)||""),builtin:(te==null?void 0:te.builtin)===!0,exists:(te==null?void 0:te.exists)!==!1,type:String((te==null?void 0:te.type)||"")})).filter(te=>te.path),[a]),[C,N]=m.useState(!1),[j,A]=m.useState(""),[I,D]=m.useState(()=>new Set),[H,V]=m.useState(!1),[F,L]=m.useState(""),[M,K]=m.useState("config"),W=$m(t),$=!!W,R=nT(u.displayType),B=m.useMemo(()=>eY(t,R),[t==null?void 0:t.displaySize,t==null?void 0:t.nodeSize,t==null?void 0:t.inputs,t==null?void 0:t.input,R]),_=m.useMemo(()=>({...t,sourceNodeId:e,label:t!=null&&t.label&&t.label!=="Context Run"?t.label:"一键任务",definitionId:R,displaySize:B,nodeSize:B,body:W,inputs:[{type:"text",name:R==="display_image"?"src":"content",value:W,default:W}],outputs:c.length?c:[{type:"node",name:"next",default:""}]}),[t,R,e,W,c,B]),X=Array.isArray((kn=t==null?void 0:t.modelLists)==null?void 0:kn.cursor)?t.modelLists.cursor:[],z=Array.isArray((dn=t==null?void 0:t.modelLists)==null?void 0:dn.opencode)?t.modelLists.opencode:[],T=Array.isArray((en=t==null?void 0:t.modelLists)==null?void 0:en.claudeCode)?t.modelLists.claudeCode:[],Z=Array.isArray((Pn=t==null?void 0:t.modelLists)==null?void 0:Pn.codex)?t.modelLists.codex:[],ae=m.useMemo(()=>new Set(X.map(hs)),[X]),J=m.useMemo(()=>new Set(z.map(hs)),[z]),se=m.useMemo(()=>new Set(T.map(hs)),[T]),ee=m.useMemo(()=>new Set(Z.map(hs)),[Z]),re=u.model,ne=m.useMemo(()=>re?re.startsWith("cursor:")||re.startsWith("opencode:")||re.startsWith("codex:")||re.startsWith("claude-code:")?re:se.has(re)?`claude-code:${re}`:ee.has(re)?`codex:${re}`:J.has(re)?`opencode:${re}`:ae.has(re)?`cursor:${re}`:re:"",[se,ee,ae,J,re]),ue=re.startsWith("cursor:")?re.slice(7):re.startsWith("opencode:")?re.slice(9):re.startsWith("codex:")?re.slice(6):re.startsWith("claude-code:")?re.slice(12):re,de=ue,xe=!!re&&!ae.has(de)&&!J.has(de)&&!se.has(de)&&!ee.has(de),ze=m.useMemo(()=>new Set(u.skillKeys),[u.skillKeys]),Te=m.useMemo(()=>new Map(y.map(te=>[te.key,te])),[y]),Le=m.useMemo(()=>{const te=new Set,Ee=v.map(Ke=>{const bt=Ho(Ke,y).map(jt=>Te.get(jt)).filter(Boolean);for(const jt of bt)te.add(jt.key);return{...Ke,skills:bt}}).filter(Ke=>Ke.skills.length>0),We=y.filter(Ke=>!te.has(Ke.key));return{collectionGroups:Ee,ungrouped:We}},[v,Te,y]);m.useEffect(()=>{D(te=>{let Ee=!1;const We=new Set(te);for(const Ke of Le.collectionGroups)We.has(Ke.id)||(We.add(Ke.id),Ee=!0);return Ee?We:te})},[Le.collectionGroups]);const nt=m.useMemo(()=>{const te=j.trim().toLowerCase();if(!te)return Le;const Ee=Ke=>[Ke==null?void 0:Ke.key,Ke==null?void 0:Ke.name,Ke==null?void 0:Ke.description].map(bt=>String(bt||"").toLowerCase()).join(" ").includes(te);return{collectionGroups:Le.collectionGroups.map(Ke=>{const bt=[Ke==null?void 0:Ke.id,Ke==null?void 0:Ke.name,Ke==null?void 0:Ke.description].map(jt=>String(jt||"").toLowerCase()).join(" ").includes(te);return{...Ke,skills:bt?Ke.skills:Ke.skills.filter(Ee)}}).filter(Ke=>Ke.skills.length>0),ungrouped:Le.ungrouped.filter(Ee)}},[Le,j]),wt=Tw(C,[nt.collectionGroups.length,nt.ungrouped.length,I.size,u.skillKeys.length,j]),mt=m.useMemo(()=>{const te=F.trim().toLowerCase();return te?b.filter(Ee=>[Ee.id,Ee.label,Ee.path,Ee.repoUrl,Ee.branch,Ee.mountPath,Ee.type].join(" ").toLowerCase().includes(te)):b},[b,F]),Re=m.useMemo(()=>oT(u.knowledgeContext),[u.knowledgeContext]),it=m.useMemo(()=>new Set(Re.map(te=>te.id||te.path||te.repoPath).filter(Boolean)),[Re]),Nt=Tw(H,[mt.length,Re.length,F]);m.useEffect(()=>{u.task!==h.current&&(h.current=u.task,p.current||d(u.task))},[u.task]),m.useEffect(()=>{if(!$){K("config");return}g||K("result")},[$,W,g]),m.useEffect(()=>{var Ee,We;if(!(M==="result"&&$))return;(Ee=t==null?void 0:t.onEnsureWorkspaceNodeDisplaySize)==null||Ee.call(t,e,B),(We=t==null?void 0:t.onRefreshNodeInternals)==null||We.call(t,e);const te=window.setTimeout(()=>{var Ke;return(Ke=t==null?void 0:t.onRefreshNodeInternals)==null?void 0:Ke.call(t,e)},120);return()=>window.clearTimeout(te)},[t==null?void 0:t.onEnsureWorkspaceNodeDisplaySize,t==null?void 0:t.onRefreshNodeInternals,R,$,e,W,B,M]);const qt=te=>{var Ee;(Ee=t==null?void 0:t.onChangeContextRunConfig)==null||Ee.call(t,e,{...u,task:f,...te})},Zt=(te=f)=>{var We;const Ee=String(te??"");Ee!==u.task&&(h.current=Ee,(We=t==null?void 0:t.onChangeContextRunConfig)==null||We.call(t,e,{...u,task:Ee}))},rt=(te,Ee)=>{const We=new Set(u.skillKeys);for(const Ke of te){const bt=String(Ke||"").trim();bt&&(Ee?We.add(bt):We.delete(bt))}qt({skillKeys:Array.from(We)})},fe=te=>{D(Ee=>{const We=new Set(Ee);return We.has(te)?We.delete(te):We.add(te),We})},ve=(te,Ee)=>{const We=(te==null?void 0:te.id)||(te==null?void 0:te.path)||"";if(!We)return;const Ke=b.filter(bt=>{const jt=bt.id||bt.path||"";return jt===We?Ee:it.has(jt)});qt({knowledgeContext:Lm(Ke)})},He=()=>{qt({knowledgeContext:null})};return M==="result"&&$?o.jsx(GR,{id:e,data:{..._,selected:t==null?void 0:t.selected,onSelectNodePointerDown:t==null?void 0:t.onSelectNodePointerDown},selected:n,deleteNode:r}):o.jsxs("div",{className:"af-work-context-run-card"+(n?" af-work-context-run-card--selected":"")+(M==="result"&&$?" af-work-context-run-card--result":"")+(g?" af-work-context-run-card--running":"")+((t==null?void 0:t.nodeStatus)==="success"?" af-work-context-run-card--done":"")+((t==null?void 0:t.nodeStatus)==="failed"?" af-work-context-run-card--failed":"")+(k?" af-work-context-run-card--stopped":""),onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,children:[l.map((te,Ee)=>{if(te.showOnNode===!1)return null;const We=`${2.25+Ee*1.75}rem`,Ke=te.name||`#${Ee+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:We},children:Ke}),o.jsx(Kn,{type:"target",position:Be.Left,id:`input-${Ee}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:We,background:_n(te.type)},title:`${Ke} · ${te.type}`})]},`in-${Ee}`)}),c.map((te,Ee)=>{if(te.showOnNode===!1)return null;const We=`${2.25+Ee*1.75}rem`,Ke=te.name||`#${Ee+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:We},children:Ke}),o.jsx(Kn,{type:"source",position:Be.Right,id:`output-${Ee}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:We,background:_n(te.type)},title:`${Ke} · ${te.type}`})]},`out-${Ee}`)}),o.jsxs("div",{className:"af-work-context-run-card__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"automation"}),o.jsx("strong",{children:t!=null&&t.label&&t.label!=="Context Run"?t.label:"一键任务"}),o.jsxs("div",{className:"af-work-context-run-card__model-wrap nodrag",onPointerDown:te=>te.stopPropagation(),onMouseDown:te=>te.stopPropagation(),onClick:te=>te.stopPropagation(),children:[o.jsxs("select",{className:"af-work-context-run-card__model",value:ne,disabled:w,"aria-label":"模型",title:ue||"默认模型",onChange:te=>qt({model:te.target.value}),children:[o.jsx("option",{value:"",children:"默认"}),xe?o.jsx("option",{value:re,children:re}):null,X.length?o.jsx("optgroup",{label:"Cursor",children:X.map(te=>o.jsx("option",{value:`cursor:${hs(te)}`,children:hs(te)},`context-cursor-${te}`))}):null,z.length?o.jsx("optgroup",{label:"OpenCode",children:z.map(te=>o.jsx("option",{value:`opencode:${hs(te)}`,children:hs(te)},`context-opencode-${te}`))}):null,Z.length?o.jsx("optgroup",{label:"Codex",children:Z.map(te=>o.jsx("option",{value:`codex:${hs(te)}`,children:hs(te)},`context-codex-${te}`))}):null,T.length?o.jsx("optgroup",{label:"Claude Code",children:T.map(te=>o.jsx("option",{value:`claude-code:${hs(te)}`,children:hs(te)},`context-claude-${te}`))}):null]}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"expand_more"})]}),o.jsx("span",{className:"af-work-context-run-card__kind",children:Ys(t==null?void 0:t.definitionId)?"workspace_one_click_task":(t==null?void 0:t.definitionId)||"workspace_one_click_task"}),$?o.jsxs("div",{className:"af-work-context-run-card__view-switch nodrag",onClick:te=>te.stopPropagation(),children:[o.jsx("button",{type:"button",className:M==="config"?"is-active":"",onClick:()=>K("config"),"aria-label":"切换到任务配置",children:o.jsx("span",{className:"material-symbols-outlined",children:"tune"})}),o.jsx("button",{type:"button",className:M==="result"?"is-active":"",onClick:()=>K("result"),"aria-label":"切换到展示结果",children:o.jsx("span",{className:"material-symbols-outlined",children:"preview"})})]}):null,o.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",disabled:w,onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-work-context-run-card__body nodrag",children:[o.jsxs(o.Fragment,{children:[o.jsx("textarea",{value:f,disabled:w,placeholder:"输入任务,例如:基于选中的知识库总结需求并生成展示页",onCompositionStart:()=>{p.current=!0},onCompositionEnd:te=>{p.current=!1,d(te.currentTarget.value),Zt(te.currentTarget.value)},onChange:te=>{d(te.target.value)},onBlur:te=>Zt(te.currentTarget.value)}),o.jsxs("div",{className:"af-work-context-run-card__grid",children:[o.jsxs("div",{className:"af-work-context-run-card__skills",children:[o.jsxs("button",{type:"button",disabled:w,className:"af-work-context-run-card__select",onClick:te=>{var Ee;te.stopPropagation(),C||(Ee=t==null?void 0:t.onRefreshSkills)==null||Ee.call(t),N(We=>!We)},children:[o.jsx("span",{className:"material-symbols-outlined",children:"extension"}),o.jsx("span",{children:u.skillKeys.length?`${u.skillKeys.length} skills`:"Skills"}),o.jsx("span",{className:"material-symbols-outlined",children:"expand_more"})]}),C?o.jsxs("div",{className:"af-work-context-run-card__skills-menu",onClick:te=>te.stopPropagation(),children:[o.jsxs("div",{className:"af-work-load-skills-search",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{type:"search",value:j,onChange:te=>A(te.target.value),placeholder:"搜索 Skills...",spellCheck:!1,autoComplete:"off","aria-label":"搜索 Skills"}),j?o.jsx("button",{type:"button",onClick:()=>A(""),"aria-label":"清空搜索",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),o.jsxs("div",{ref:wt.menuRef,className:"af-work-load-skills-menu af-work-context-run-card__menu-scroll",onScroll:wt.updateMenuScrollbar,children:[nt.collectionGroups.map(te=>{const Ee=te.skills.map(jt=>jt.key),We=Ee.filter(jt=>ze.has(jt)).length,Ke=Ee.length>0&&We===Ee.length,bt=I.has(te.id);return o.jsxs("section",{className:"af-work-load-skills-menu__group"+(bt?" af-work-load-skills-menu__group--collapsed":""),children:[o.jsxs("div",{className:"af-work-load-skills-menu__group-head",children:[o.jsx("input",{type:"checkbox",checked:Ke,disabled:w,onChange:jt=>rt(Ee,jt.target.checked),"aria-label":`选择 ${te.name}`}),o.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-toggle",onClick:()=>fe(te.id),"aria-expanded":!bt,children:o.jsxs("span",{className:"af-work-load-skills-menu__group-main",children:[o.jsx("span",{children:te.name}),te.description?o.jsx("em",{children:te.description}):null]})}),o.jsxs("small",{children:[We,"/",Ee.length]}),o.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-arrow",onClick:()=>fe(te.id),"aria-label":bt?`展开 ${te.name}`:`收起 ${te.name}`,children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:bt?"chevron_right":"expand_more"})})]}),bt?null:o.jsx("div",{className:"af-work-load-skills-menu__options",children:te.skills.map(jt=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:ze.has(jt.key),disabled:w,onChange:qn=>rt([jt.key],qn.target.checked)}),o.jsxs("span",{className:"af-work-load-skills-menu__option-main",children:[o.jsx("span",{className:"af-work-load-skills-menu__option-title",children:jt.name}),jt.description?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:jt.description}):null]})]},`${te.id}:${jt.key}`))})]},te.id)}),nt.ungrouped.length>0?o.jsxs("section",{className:"af-work-load-skills-menu__group",children:[o.jsxs("div",{className:"af-work-load-skills-menu__group-head af-work-load-skills-menu__group-head--plain",children:[o.jsx("span",{children:"Ungrouped"}),o.jsx("small",{children:nt.ungrouped.length})]}),o.jsx("div",{className:"af-work-load-skills-menu__options",children:nt.ungrouped.map(te=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:ze.has(te.key),disabled:w,onChange:Ee=>rt([te.key],Ee.target.checked)}),o.jsxs("span",{className:"af-work-load-skills-menu__option-main",children:[o.jsx("span",{className:"af-work-load-skills-menu__option-title",children:te.name}),te.description?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:te.description}):null]})]},`ungrouped:${te.key}`))})]}):null,nt.collectionGroups.length===0&&nt.ungrouped.length===0?o.jsx("div",{className:"af-work-load-skills-menu__empty",children:"没有匹配的 Skills"}):null,o.jsx("button",{type:"button",className:"af-work-load-skills-menu__clear",onClick:()=>qt({skillKeys:[]}),children:"清空"})]}),o.jsx("div",{ref:wt.scrollbarTrackRef,className:"af-work-load-skills-scrollbar"+(wt.scrollbar.visible?" af-work-load-skills-scrollbar--visible":""),onPointerDown:wt.handleScrollbarPointerDown,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${wt.scrollbar.height}%`,top:`${wt.scrollbar.top}%`}})})]}):null]}),o.jsxs("div",{className:"af-work-context-run-card__workspace",children:[o.jsxs("button",{type:"button",disabled:w,className:"af-work-context-run-card__select",onClick:te=>{var Ee;te.stopPropagation(),H||(Ee=t==null?void 0:t.onRefreshWorkspaces)==null||Ee.call(t),V(We=>!We)},children:[o.jsx("span",{className:"material-symbols-outlined",children:Re.length?"folder_open":"folder_off"}),o.jsx("span",{children:Re.length?`${Re.length} 知识库`:"知识库"}),o.jsx("span",{className:"material-symbols-outlined",children:"expand_more"})]}),H?o.jsxs("div",{className:"af-work-context-run-card__workspace-menu",onClick:te=>te.stopPropagation(),children:[o.jsxs("div",{className:"af-work-load-skills-search",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{type:"search",value:F,onChange:te=>L(te.target.value),placeholder:"搜索知识库...",spellCheck:!1,autoComplete:"off","aria-label":"搜索知识库"}),F?o.jsx("button",{type:"button",onClick:()=>L(""),"aria-label":"清空搜索",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),o.jsxs("div",{ref:Nt.menuRef,className:"af-work-load-skills-menu af-work-context-run-card__menu-scroll",onScroll:Nt.updateMenuScrollbar,children:[o.jsxs("section",{className:"af-work-load-skills-menu__group",children:[o.jsxs("div",{className:"af-work-load-skills-menu__group-head af-work-load-skills-menu__group-head--plain",children:[o.jsx("span",{children:"知识库"}),o.jsx("small",{children:mt.length})]}),o.jsx("div",{className:"af-work-load-skills-menu__options",children:mt.map(te=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:it.has(te.id||te.path),disabled:w,onChange:Ee=>ve(te,Ee.target.checked)}),o.jsxs("span",{className:"af-work-load-skills-menu__option-main",children:[o.jsx("span",{className:"af-work-load-skills-menu__option-title",children:te.label}),o.jsxs("span",{className:"af-work-load-skills-menu__option-desc",children:[te.kind==="git"&&te.repoUrl?`${te.repoUrl}${te.branch?` · ${te.branch}`:""}${te.mountPath?` · ${te.mountPath}`:""}`:te.path,te.exists?"":" · 路径未就绪"]})]})]},`${te.id}:${te.path}`))})]}),mt.length===0?o.jsx("div",{className:"af-work-load-skills-menu__empty",children:"没有匹配的知识库"}):null,o.jsx("button",{type:"button",className:"af-work-load-skills-menu__clear",onClick:He,children:"清空知识库"})]}),o.jsx("div",{ref:Nt.scrollbarTrackRef,className:"af-work-load-skills-scrollbar"+(Nt.scrollbar.visible?" af-work-load-skills-scrollbar--visible":""),onPointerDown:Nt.handleScrollbarPointerDown,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${Nt.scrollbar.height}%`,top:`${Nt.scrollbar.top}%`}})})]}):null]}),o.jsxs("select",{value:u.displayType,disabled:w,onChange:te=>qt({displayType:te.target.value}),children:[o.jsx("option",{value:"markdown",children:"Markdown"}),o.jsx("option",{value:"html",children:"HTML"}),o.jsx("option",{value:"react",children:"React"}),o.jsx("option",{value:"table",children:"Table"}),o.jsx("option",{value:"chart",children:"Chart"}),o.jsx("option",{value:"ascii",children:"ASCII"}),o.jsx("option",{value:"mermaid",children:"Mermaid"})]})]}),W?o.jsx("pre",{className:"af-work-context-run-card__preview",children:W.slice(0,520)}):null]}),o.jsxs("div",{className:"af-work-context-run-card__actions",children:[o.jsxs("button",{type:"button",className:"af-work-run-card__button af-work-context-run-card__run nodrag"+(g?" af-work-run-card__button--stop":""),disabled:w,onClick:te=>{var Ee,We;te.stopPropagation(),Zt(),g?(Ee=t==null?void 0:t.onStopWorkspaceNode)==null||Ee.call(t,e):(We=t==null?void 0:t.onRunWorkspaceNode)==null||We.call(t,e)},children:[o.jsx("span",{className:"material-symbols-outlined",children:g?"stop_circle":"play_arrow"}),o.jsx("span",{children:g?"Stop":"Run"})]}),o.jsx("button",{type:"button",className:"af-work-run-card__button af-work-context-run-card__logs nodrag",onClick:te=>{var Ee;te.stopPropagation(),(Ee=t==null?void 0:t.onOpenWorkspaceRunLogs)==null||Ee.call(t,{nodeId:e,runNodeId:e,scheduleNodeId:"",label:t!=null&&t.label&&t.label!=="Context Run"?t.label:"一键任务"})},children:o.jsx("span",{className:"material-symbols-outlined",children:"article"})})]})]})]})}function kY({id:e,data:t,selected:n,deleteNode:r}){var C,N,j;const s=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],i=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],a=Tk((t==null?void 0:t.body)||""),l=(t==null?void 0:t.scheduledRunState)||{},c=((N=(C=t==null?void 0:t.runningRunNodeIds)==null?void 0:C.has)==null?void 0:N.call(C,e))||((j=t==null?void 0:t.runningRunNodeIds)==null?void 0:j[e])===!0||(t==null?void 0:t.isExecuting)||(t==null?void 0:t.nodeStatus)==="running",u=(t==null?void 0:t.optimizingRun)===!0,f=(t==null?void 0:t.nodeStatus)==="stopped",d=!!(t!=null&&t.readOnly),p=A=>{var I;(I=t==null?void 0:t.onChangeScheduledRunConfig)==null||I.call(t,e,{...a,...A})},h=A=>{p({scheduleType:A,cron:Su(A,a.time,a.weekday,a.monthDay,a.cron)})},g=A=>{p({time:A,cron:Su(a.scheduleType,A,a.weekday,a.monthDay,a.cron)})},[k,w]=Rk(a.time).split(":"),y=(A,I)=>{g(`${Eo(A,9,0,23)}:${Eo(I,0,0,59)}`)},v=A=>{p({weekday:A,cron:Su(a.scheduleType,a.time,A,a.monthDay,a.cron)})},b=A=>{p({monthDay:A,cron:Su(a.scheduleType,a.time,a.weekday,A,a.cron)})};return o.jsxs("div",{className:"af-work-run-card af-work-schedule-card"+(n?" af-work-run-card--selected":"")+(a.enabled?" af-work-schedule-card--enabled":"")+(c?" af-work-run-card--running":"")+(t!=null&&t.isExecuting?" af-work-run-card--executing":"")+((t==null?void 0:t.nodeStatus)==="success"?" af-work-run-card--done":"")+((t==null?void 0:t.nodeStatus)==="failed"?" af-work-run-card--failed":"")+(f?" af-work-run-card--stopped":""),onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,children:[s.map((A,I)=>{if(A.showOnNode===!1)return null;const D=`${2.25+I*1.75}rem`,H=A.name||`#${I+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:D},children:H}),o.jsx(Kn,{type:"target",position:Be.Left,id:`input-${I}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:D,background:_n(A.type)},title:`${H} · ${A.type}`})]},`in-${I}`)}),i.map((A,I)=>{if(A.showOnNode===!1)return null;const D=`${2.25+I*1.75}rem`,H=A.name||`#${I+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:D},children:H}),o.jsx(Kn,{type:"source",position:Be.Right,id:`output-${I}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:D,background:_n(A.type)},title:`${H} · ${A.type}`})]},`out-${I}`)}),o.jsxs("div",{className:"af-work-run-card__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"event_repeat"}),o.jsx("strong",{children:(t==null?void 0:t.label)||"Scheduled Run"}),o.jsx("span",{children:(t==null?void 0:t.definitionId)||"workspace_scheduled_run"}),o.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",disabled:d,onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-work-schedule-card__body nodrag",children:[o.jsxs("label",{className:"af-work-schedule-card__toggle",children:[o.jsx("input",{type:"checkbox",checked:a.enabled,disabled:d,onChange:A=>p({enabled:A.target.checked})}),o.jsx("span",{children:a.enabled?"定时开启":"定时关闭"})]}),o.jsxs("label",{className:"af-work-schedule-card__field",children:[o.jsx("span",{children:"频率"}),o.jsxs("select",{value:a.scheduleType,disabled:d,onChange:A=>h(A.target.value),children:[o.jsx("option",{value:"daily",children:"每天"}),o.jsx("option",{value:"weekly",children:"每周"}),o.jsx("option",{value:"monthly",children:"每月"}),o.jsx("option",{value:"custom",children:"高级 Cron"})]})]}),a.scheduleType!=="custom"?o.jsxs("label",{className:"af-work-schedule-card__field",children:[o.jsx("span",{children:"时间"}),o.jsxs("div",{className:"af-work-schedule-time-selects",children:[o.jsx("select",{value:k,disabled:d,"aria-label":"小时",onChange:A=>y(A.target.value,w),children:Array.from({length:24},(A,I)=>Eo(I,0,0,23)).map(A=>o.jsxs("option",{value:A,children:[A," 时"]},A))}),o.jsx("select",{value:w,disabled:d,"aria-label":"分钟",onChange:A=>y(k,A.target.value),children:Array.from({length:12},(A,I)=>Eo(I*5,0,0,59)).map(A=>o.jsxs("option",{value:A,children:[A," 分"]},A))})]})]}):null,a.scheduleType==="weekly"?o.jsxs("label",{className:"af-work-schedule-card__field",children:[o.jsx("span",{children:"星期"}),o.jsxs("select",{value:a.weekday,disabled:d,onChange:A=>v(A.target.value),children:[o.jsx("option",{value:1,children:"周一"}),o.jsx("option",{value:2,children:"周二"}),o.jsx("option",{value:3,children:"周三"}),o.jsx("option",{value:4,children:"周四"}),o.jsx("option",{value:5,children:"周五"}),o.jsx("option",{value:6,children:"周六"}),o.jsx("option",{value:0,children:"周日"})]})]}):null,a.scheduleType==="monthly"?o.jsxs("label",{className:"af-work-schedule-card__field",children:[o.jsx("span",{children:"日期"}),o.jsx("select",{value:a.monthDay,disabled:d,onChange:A=>b(A.target.value),children:Array.from({length:31},(A,I)=>I+1).map(A=>o.jsxs("option",{value:A,children:[A," 日"]},A))})]}):null,a.scheduleType==="custom"?o.jsxs("label",{className:"af-work-schedule-card__field",children:[o.jsx("span",{children:"Cron"}),o.jsx("input",{type:"text",value:a.cron,disabled:d,spellCheck:!1,placeholder:kd,onChange:A=>p({cron:A.target.value})})]}):null,o.jsxs("div",{className:"af-work-schedule-card__meta",children:[o.jsxs("span",{children:[Hq(a.scheduleType)," ",a.scheduleType==="custom"?"":a.time]}),o.jsxs("span",{children:["Next ",Bq(l.nextAt)]}),o.jsx("span",{children:c?"running":l.lastStatus||"idle"})]}),l.lastError?o.jsx("div",{className:"af-work-schedule-card__error",children:l.lastError}):null,o.jsxs("div",{className:"af-work-schedule-card__actions",children:[o.jsxs("button",{type:"button",className:"af-work-run-card__button af-work-schedule-card__run-now nodrag"+(c?" af-work-run-card__button--stop":""),disabled:d||u,onClick:A=>{var I,D;A.stopPropagation(),c?(I=t==null?void 0:t.onStopWorkspaceNode)==null||I.call(t,e):(D=t==null?void 0:t.onRunWorkspaceNode)==null||D.call(t,e)},children:[o.jsx("span",{className:"material-symbols-outlined",children:c?"stop_circle":"play_arrow"}),o.jsx("span",{children:c?"停止":"立即运行"})]}),o.jsxs("button",{type:"button",className:"af-work-run-card__button af-work-schedule-card__optimize nodrag"+(u?" af-work-schedule-card__optimize--running":""),disabled:d||c||u,title:"为下游节点提前生成 implementation",onClick:A=>{var I;A.stopPropagation(),(I=t==null?void 0:t.onOptimizeWorkspaceSchedule)==null||I.call(t,e)},children:[o.jsx("span",{className:"material-symbols-outlined",children:u?"sync":"auto_fix_high"}),o.jsx("span",{children:u?"优化中":"优化"})]}),o.jsxs("button",{type:"button",className:"af-work-run-card__button af-work-schedule-card__logs nodrag",onClick:A=>{var I;A.stopPropagation(),(I=t==null?void 0:t.onOpenWorkspaceRunLogs)==null||I.call(t,{nodeId:e,scheduleNodeId:e,runNodeId:l.targetRunNodeId||e,lastRunId:l.lastRunId||"",label:(t==null?void 0:t.label)||"Scheduled Run"})},children:[o.jsx("span",{className:"material-symbols-outlined",children:"article"}),o.jsx("span",{children:"日志"})]})]})]})]})}function vY({id:e,data:t,selected:n,deleteNode:r}){const{setNodes:s}=wc(),i=!!(t!=null&&t.readOnly),a=Pw(t==null?void 0:t.nodeSize)||{width:Da,height:Fa},l=m.useCallback(c=>{var u,f;c.button!==0||c.metaKey||c.ctrlKey||c.shiftKey||(f=(u=c.target)==null?void 0:u.closest)!=null&&f.call(u,".af-work-group-node__resize, .af-work-group-node__delete")||s(d=>QR(d,e))},[e,s]);return o.jsxs("div",{className:"af-work-group-node"+(n?" af-work-group-node--selected":""),style:{width:a.width,height:a.height},onPointerDownCapture:l,children:[i?null:o.jsx(sk,{className:"af-work-group-node__resize nodrag",minWidth:Da,minHeight:Fa,position:"bottom-right",children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})}),o.jsxs("div",{className:"af-work-group-node__title nodrag",children:[o.jsx("span",{children:(t==null?void 0:t.title)||(t==null?void 0:t.label)||"Group"}),o.jsx("button",{type:"button",className:"af-work-group-node__delete",disabled:i,onClick:c=>{c.stopPropagation(),r==null||r(e)},"aria-label":"删除分组",title:"删除分组",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]})]})}function SY(e){var g,k,w,y,v,b,C,N,j,A,I,D,H,V,F,L,M,K,W,$,R,B,_,X,z,T,Z,ae;const{setEdges:t,setNodes:n}=wc(),r=(g=e.data)==null?void 0:g.onSyncNodePropDraft,s=!!((k=e.data)!=null&&k.readOnly),[i,a]=m.useState(!1),l=(w=e.data)!=null&&w.nodeSize&&Number(e.data.nodeSize.width)>0&&Number(e.data.nodeSize.height)>0?{width:Number(e.data.nodeSize.width),height:Number(e.data.nodeSize.height)}:null,c=m.useCallback(J=>{var re,ne,ue;if(s)return;(ne=(re=e.data)==null?void 0:re.onCleanupWorkspaceNodeOutputs)==null||ne.call(re,J,e.data);const se=Ys((ue=e.data)==null?void 0:ue.definitionId)?rT(J):"",ee=new Set([J,se].filter(Boolean));n(de=>de.filter(xe=>!ee.has(xe.id))),t(de=>de.filter(xe=>!ee.has(xe.source)&&!ee.has(xe.target)))},[e.data,s,t,n]),u=m.useCallback(J=>{var se,ee;J.button!==0||J.metaKey||J.ctrlKey||J.shiftKey||(ee=(se=J.target)==null?void 0:se.closest)!=null&&ee.call(se,".react-flow__handle, .af-work-display-resize")||(n(re=>QR(re,e.id)),t(re=>_Y(re)))},[e.id,t,n]),f=m.useCallback((J,se)=>{s||(n(ee=>ee.map(re=>re.id===J?{...re,data:{...re.data,model:se}}:re)),r==null||r(J,{model:se}))},[s,n,r]),d=m.useCallback((J,se)=>{s||(n(ee=>ee.map(re=>{var ue;if(re.id!==J)return re;const ne=Array.isArray((ue=re.data)==null?void 0:ue.outputs)&&re.data.outputs.length?re.data.outputs.map((de,xe)=>xe===0?{...de,default:se,value:se}:de):[{type:"bool",name:"value",default:se,value:se}];return{...re,data:{...re.data,body:"",outputs:ne}}})),r==null||r(J,ee=>({body:"",outputs:Array.isArray(ee==null?void 0:ee.outputs)&&ee.outputs.length?ee.outputs.map((ne,ue)=>ue===0?{...ne,default:se,value:se}:ne):[{type:"bool",name:"value",default:se,value:se}]})))},[s,n,r]),p=m.useCallback((J,se)=>{s||(n(ee=>ee.map(re=>re.id===J?{...re,data:{...re.data,body:se}}:re)),r==null||r(J,{body:se}))},[s,n,r]),h=m.useCallback((J,se)=>{if(s)return;const ee=ro(se);n(re=>re.map(ne=>ne.id===J?{...ne,data:{...ne.data,images:ee}}:ne)),r==null||r(J,{images:ee})},[s,n,r]);return(y=e.data)!=null&&y.isWorkspaceGroup?o.jsx(vY,{...e,deleteNode:c}):Ha((v=e.data)==null?void 0:v.definitionId)?o.jsx(GR,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c}):((b=e.data)==null?void 0:b.definitionId)==="workspace_run"?o.jsx(wY,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c}):((C=e.data)==null?void 0:C.definitionId)==="workspace_scheduled_run"?o.jsx(kY,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c}):Ys((N=e.data)==null?void 0:N.definitionId)?o.jsx(bY,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c,skills:(j=e.data)==null?void 0:j.skills,skillCollections:(A=e.data)==null?void 0:A.skillCollections,workspaces:(I=e.data)==null?void 0:I.workspaceTargets}):((D=e.data)==null?void 0:D.definitionId)==="control_load_skills"?o.jsx(WY,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c,skills:(H=e.data)==null?void 0:H.skills,skillCollections:(V=e.data)==null?void 0:V.skillCollections,onChangeSkillKeys:(F=e.data)==null?void 0:F.onChangeLoadSkillKeys}):((L=e.data)==null?void 0:L.definitionId)==="control_load_mcp"?o.jsx(VY,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c,servers:(M=e.data)==null?void 0:M.mcpServers,onChangeMcpNames:(K=e.data)==null?void 0:K.onChangeLoadMcpNames}):((W=e.data)==null?void 0:W.definitionId)==="control_cd_workspace"?o.jsx(KY,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c,workspaces:($=e.data)==null?void 0:$.workspaceTargets,onChangeWorkspace:(R=e.data)==null?void 0:R.onChangeLoadWorkspace,onRefreshWorkspaces:(B=e.data)==null?void 0:B.onRefreshWorkspaces}):o.jsxs("div",{className:"af-work-flow-node"+(e.selected?" af-work-flow-node--selected":"")+(i?" af-work-flow-node--resizing":"")+((_=e.data)!=null&&_.isExecuting||((X=e.data)==null?void 0:X.nodeStatus)==="running"?" af-work-flow-node--executing":"")+(((z=e.data)==null?void 0:z.nodeStatus)==="success"?" af-work-flow-node--done":"")+(((T=e.data)==null?void 0:T.nodeStatus)==="failed"?" af-work-flow-node--failed":"")+(((Z=e.data)==null?void 0:Z.nodeStatus)==="stopped"?" af-work-flow-node--stopped":""),style:l?{width:l.width,height:l.height}:void 0,onPointerDownCapture:u,children:[s?null:o.jsx(sk,{className:"af-work-display-resize af-work-flow-resize nodrag",position:"bottom-right",minWidth:SR,minHeight:Th,maxWidth:NR,maxHeight:jR,onResizeStart:()=>a(!0),onResizeEnd:()=>a(!1),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_full"})}),o.jsx(z7,{...e,deleteNode:c,modelLists:(ae=e.data)==null?void 0:ae.modelLists,onModelChange:f,onProvideValueChange:d,onNodeBodyChange:p,onNodeImagesChange:h})]})}const NY={[Jl]:SY};function Mk(e,t=[]){for(const n of e||[])n.type==="file"&&t.push(n),Array.isArray(n.children)&&Mk(n.children,t);return t}function JR(e,t){const n=String(t||"");if(!n)return null;for(const r of e||[]){if(r.path===n)return r;const s=Array.isArray(r.children)?JR(r.children,n):null;if(s)return s}return null}function jY(e){const t=String(e||"").replace(/\\/g,"/").replace(/^\/+|\/+$/g,"");return!t||!t.includes("/")?"":t.split("/").slice(0,-1).join("/")}function XR(e,t=[]){for(const n of e||[])n.type==="directory"&&(t.push(n.path),Array.isArray(n.children)&&XR(n.children,t));return t}function up(e){const t=String(e||"").replace(/\\/g,"/").split("/").filter(Boolean),n=[];for(let r=1;r<t.length;r++)n.push(t.slice(0,r).join("/"));return n}function CY(e,t){const n=String(t||"");let r=!1;const s=(e||[]).map(i=>{const a=i.id===n;return i.selected===a?i:(r=!0,{...i,selected:a})});return r?s:e}function QR(e,t){const n=String(t||""),r=(e||[]).find(i=>i.id===n),s=(e||[]).reduce((i,a)=>i+(a.selected?1:0),0);return r!=null&&r.selected&&s>1?e:CY(e,n)}function _Y(e){let t=!1;const n=(e||[]).map(r=>r.selected?(t=!0,{...r,selected:!1}):r);return t?n:e}function EY(e){return[...e||[]].sort((t,n)=>t.type!==n.type?t.type==="directory"?-1:1:String(t.name||"").localeCompare(String(n.name||"")))}function AY(e,t,n=0){const r=String(t||"").replace(/\\/g,"/").split("/").filter(Boolean);if(r.length===0)return e;const s=(i,a,l)=>{const c=r[a],u=l?`${l}/${c}`:c,f=a===r.length-1;let d=!1;const p=(Array.isArray(i)?i:[]).map(h=>h.name!==c?h:(d=!0,f?{...h,type:"file",name:c,path:u,icon:Dl(c),size:n}:{...h,type:"directory",name:c,path:u,icon:Dl(c,!0),children:s(h.children||[],a+1,u)}));return d||p.push(f?{type:"file",name:c,path:u,icon:Dl(c),size:n}:{type:"directory",name:c,path:u,icon:Dl(c,!0),children:s([],a+1,u)}),EY(p)};return s(e||[],0,"")}function PY(e){const t=Number(e||0);return!Number.isFinite(t)||t<=0?"":t<1024?`${t} B`:t<1024*1024?`${Math.round(t/102.4)/10} KB`:`${Math.round(t/1024/102.4)/10} MB`}function ZR({items:e,onOpen:t,selectedPath:n,collapsedDirs:r,onToggleDir:s,onSelect:i,onFileDragStart:a,onDelete:l,onDownload:c}){return o.jsx("ul",{className:"af-work-files",children:(e||[]).map(u=>{var h;const f=u.type==="directory",d=f&&(r==null?void 0:r.has(u.path)),p=n===u.path;return o.jsxs("li",{children:[o.jsxs("div",{className:"af-work-file-row",children:[o.jsxs("button",{type:"button",className:"af-work-file af-work-file--"+u.type+(p?" af-work-file--selected":""),draggable:!f,onDragStart:g=>{f||a==null||a(g,u)},onClick:()=>{i==null||i(u),f&&(s==null||s(u.path))},onDoubleClick:()=>{f||t(u)},title:u.path,children:[f?o.jsx("span",{className:"material-symbols-outlined af-work-file__chevron",children:d?"chevron_right":"expand_more"}):null,o.jsx("span",{className:"material-symbols-outlined",children:u.icon||Dl(u.name,f)}),o.jsx("span",{children:u.name})]}),p?o.jsxs("div",{className:"af-work-file-actions",children:[f?null:o.jsx("button",{type:"button",className:"af-work-file-action",onClick:g=>{g.stopPropagation(),c==null||c(u)},"aria-label":`下载 ${u.name}`,title:`下载 ${u.path}`,children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"download"})}),o.jsx("button",{type:"button",className:"af-work-file-action af-work-file-action--danger",onClick:g=>{g.stopPropagation(),l==null||l(u)},"aria-label":`删除 ${u.name}`,title:`删除 ${u.path}`,children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"delete"})})]}):null]}),f&&!d&&((h=u.children)!=null&&h.length)?o.jsx(ZR,{items:u.children,onOpen:t,selectedPath:n,collapsedDirs:r,onToggleDir:s,onSelect:i,onFileDragStart:a,onDelete:l,onDownload:c}):null]},u.path)})})}function IY({files:e,query:t,onQueryChange:n,onSelect:r,onUpload:s,onClose:i}){const a=m.useMemo(()=>Mk(e),[e]),l=String(t||"").trim().toLowerCase(),c=a.filter(u=>l?`${u.path} ${u.name}`.toLowerCase().includes(l):!0);return o.jsx("div",{className:"af-flow-snippet-modal-overlay",onMouseDown:i,children:o.jsxs("div",{className:"af-flow-snippet-modal af-work-file-picker-modal",role:"dialog","aria-modal":"true","aria-label":"选择文件",onMouseDown:u=>u.stopPropagation(),children:[o.jsxs("div",{className:"af-flow-snippet-modal__head",children:[o.jsxs("span",{className:"af-flow-snippet-modal__title",children:[o.jsx("span",{className:"material-symbols-outlined",children:"folder_open"}),"选择文件"]}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:i,"aria-label":"关闭",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-flow-snippet-modal__body",children:[o.jsxs("div",{className:"af-work-file-picker-modal__tools",children:[o.jsx("input",{value:t,onChange:u=>n(u.target.value),placeholder:"搜索文件路径...",autoFocus:!0}),o.jsxs("button",{type:"button",onClick:()=>s==null?void 0:s(""),children:[o.jsx("span",{className:"material-symbols-outlined",children:"upload_file"}),"上传"]})]}),o.jsxs("div",{className:"af-work-file-picker-modal__list",children:[c.map(u=>o.jsxs("button",{type:"button",className:"af-work-file-picker-modal__item",onClick:()=>r(u),children:[o.jsx("span",{className:"material-symbols-outlined",children:u.icon||Dl(u.name)}),o.jsxs("span",{className:"af-work-file-picker-modal__main",children:[o.jsx("strong",{children:u.name}),o.jsx("small",{children:u.path})]}),u.size?o.jsx("em",{children:PY(u.size)}):null]},u.path)),c.length===0?o.jsx("div",{className:"af-work-file-picker-modal__empty",children:"没有匹配文件,可先上传或调整搜索词。"}):null]})]})]})})}function V1({messages:e,running:t,showRunningIndicator:n=!0}){const r=e.length>0;return o.jsxs("div",{className:"af-composer-ai-stack af-composer-ai-stack--in-panel af-composer-thread-stack",children:[e.map((s,i)=>{const a=s.kind==="run-log"||s.kind==="run-summary"||s.kind==="activity"||s.kind==="prompt"||s.kind==="raw"||s.kind==="thinking"||s.kind==="result"||s.kind==="assistant"?"reply":s.role==="user"?"user-msg":s.error?"error":"reply",l=s.kind==="run-summary"?"Steps":s.kind==="run-log"?"Run":s.kind==="activity"?"Activity":s.kind==="prompt"?"Prompt":s.kind==="raw"?"Raw Trace":s.kind==="thinking"?"Thinking":s.kind==="result"?"Result":s.kind==="assistant"?"Response":s.role==="user"?"You":s.error?"Error":"Reply";return o.jsxs("section",{className:`af-composer-ai-block af-composer-ai-block--${a}${s.kind?` af-composer-ai-block--kind-${s.kind}`:""}`,children:[o.jsx("div",{className:"af-composer-ai-block-label",children:l}),o.jsx("div",{className:"af-composer-ai-block-body",children:s.text})]},`${i}-${s.role}-${String(s.text||"").slice(0,24)}`)}),n&&t&&!r?o.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--reply af-composer-ai-block--pending",children:[o.jsx("div",{className:"af-composer-ai-block-label",children:"Reply"}),o.jsx("div",{className:"af-composer-ai-block-body",children:"Waiting..."})]}):null,n&&t&&r?o.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--thinking",children:[o.jsx("div",{className:"af-composer-ai-block-label",children:"Thinking"}),o.jsx("div",{className:"af-composer-ai-block-body",children:"Workspace agent is running..."})]}):null]})}function eT(e){const t=String((e==null?void 0:e.kind)||"");return["run-log","run-summary","activity","prompt","raw","thinking"].includes(t)}function RY(e,t=!1){const n=Array.isArray(e)?e:[],r=n.filter(i=>!eT(i));if(r.length>0)return r;const s=[...n].reverse().find(i=>(i==null?void 0:i.kind)==="result"||(i==null?void 0:i.kind)==="assistant"||(i==null?void 0:i.error));return s?[s]:n.length>0||t?[{role:"assistant",kind:"assistant",text:t?"正在执行,可以在完成后继续追问或要求调整。":"运行已完成。可以在下方继续追问、要求总结或调整结果。",at:0}]:[]}function TY(e){return(Array.isArray(e)?e:[]).filter(eT)}function Nd(e){const t=String(e||"").trim();if(!t)return[];try{const n=JSON.parse(t);if(Array.isArray(n))return n.map(String).filter(Boolean)}catch{}return t.split(/[\n,]+/).map(n=>n.trim()).filter(Boolean)}function MY(e){const t=Nd((e==null?void 0:e.body)||"");if(t.length>0)return t;const r=(Array.isArray(e==null?void 0:e.inputs)?e.inputs:[]).find(s=>(s==null?void 0:s.name)==="skillsContext"||(s==null?void 0:s.name)==="skillKeys"||(s==null?void 0:s.type)==="text");return Nd((r==null?void 0:r.default)||(r==null?void 0:r.value)||"")}function $Y(e){const n=[...Array.isArray(e==null?void 0:e.inputs)?e.inputs:[],...Array.isArray(e==null?void 0:e.outputs)?e.outputs:[]].find(r=>(r==null?void 0:r.name)==="skillKeys"||(r==null?void 0:r.name)==="skillsContext");return Nd((n==null?void 0:n.default)||(n==null?void 0:n.value)||"")}function tT(e,t,n=1){const r=(Array.isArray(e)?e:[]).map(i=>String(i||"").trim()).filter(Boolean);return r.length?{head:r.slice(0,n).join("、"),extra:r.length>n?`等 ${r.length} 个`:"",title:r.join(", ")}:{head:t,extra:"",title:""}}function K1(e){return JSON.stringify(Array.from(new Set((e||[]).map(String).filter(Boolean))))}function Vo(e,t,n=""){const r=(Array.isArray(e)?e:[]).find(i=>(i==null?void 0:i.name)===t);return String((r==null?void 0:r.value)??(r==null?void 0:r.default)??"").trim()||n}function Hh(e,t){const n=Vo(e,t,"");if(!n)return null;try{const r=JSON.parse(n);return r&&typeof r=="object"&&!Array.isArray(r)?r:null}catch{return null}}function Vd(e){const t=String(e||"").trim().toLowerCase();return["markdown","html","react","table","chart","ascii","mermaid"].includes(t)?t:"markdown"}function hs(e){const t=String(e||""),n=t.indexOf(" - ");return n>=0?t.slice(0,n).trim():t.trim()}function nT(e){const t=Vd(e);return t==="html"?"display_html":t==="react"?"display_react_app":t==="table"?"display_table":t==="chart"?"display_chart":t==="ascii"?"display_ascii":t==="mermaid"?"display_mermaid":"display_markdown"}function rT(e){return`${String(e||"context_run").trim()||"context_run"}__display`}function sT(e){return e==="display_image"?"src":"content"}function U1(e,t,n){const r=sT(t),s=Nu(e);let i=!1;const a=s.map(l=>(l==null?void 0:l.name)===r?(i=!0,{...l,default:n,value:n,showOnNode:l.showOnNode!==!1}):(l==null?void 0:l.name)==="filePath"?{...l,default:"",value:""}:l);return i||a.push({type:"text",name:r,default:n,value:n,required:!0,showOnNode:!0}),a}function q1(e,t,n=[],r=[]){const s=Array.isArray(e)?e:[],i=new Set((Array.isArray(n)?n:[]).map(u=>String(u||"").trim()).filter(Boolean)),a=new Set((Array.isArray(r)?r:[]).map(u=>String(u||"").trim()).filter(Boolean)),l=u=>(u==null?void 0:u.showOnNode)!==!1;let c=s.findIndex(u=>l(u)&&i.has(String((u==null?void 0:u.name)||"").trim()));return c<0&&(c=s.findIndex(u=>i.has(String((u==null?void 0:u.name)||"").trim()))),c<0&&(c=s.findIndex(u=>l(u)&&a.has(String((u==null?void 0:u.type)||"").trim()))),c<0&&(c=s.findIndex(u=>l(u))),c<0&&(c=0),`${t}-${c}`}function Y1(e){return(Array.isArray(e)?e:[]).map(t=>(t==null?void 0:t.type)==="node"||(t==null?void 0:t.name)==="next"?t:{...t,default:"",value:""})}function $m(e){const t=Array.isArray(e==null?void 0:e.outputs)?e.outputs:Array.isArray(e==null?void 0:e.output)?e.output:[],n=s=>String((s==null?void 0:s.value)??(s==null?void 0:s.default)??"").trim(),r=t.find(s=>((s==null?void 0:s.name)==="content"||(s==null?void 0:s.name)==="result")&&n(s))||t.find(s=>(s==null?void 0:s.name)==="resultFile"&&n(s))||t.find(s=>(s==null?void 0:s.type)!=="node"&&(s==null?void 0:s.name)!=="next"&&(s==null?void 0:s.name)!=="displayType"&&n(s));return r?n(r):""}function LY(e){const t=Array.isArray(e==null?void 0:e.inputs)?e.inputs:[],n=Vo(t,"includeWorkspaceContext","true").toLowerCase(),r=Hh(t,"knowledgeContext"),s=Hh(t,"workspaceContext");return{task:String((e==null?void 0:e.body)||""),skillKeys:$Y(e),includeWorkspaceContext:n!=="false"&&n!=="0"&&n!=="off",knowledgeContext:r||(s?Lm([s]):null),workspaceContext:s,displayType:Vd(Vo(t,"displayType","markdown")),model:String((e==null?void 0:e.model)||"").trim()}}function Ys(e){const t=String(e||"");return t==="workspace_one_click_task"||t==="workspace_context_run"}function OY(e){const t=Nd((e==null?void 0:e.body)||"");if(t.length>0)return t;const r=(Array.isArray(e==null?void 0:e.inputs)?e.inputs:[]).find(s=>(s==null?void 0:s.name)==="mcpContext"||(s==null?void 0:s.name)==="serverNames"||(s==null?void 0:s.type)==="text");return Nd((r==null?void 0:r.default)||(r==null?void 0:r.value)||"")}function DY(e){return JSON.stringify(Array.from(new Set((e||[]).map(String).filter(Boolean))))}function iT(e={},t="context"){const n=String((e==null?void 0:e.cwd)||(e==null?void 0:e.workspaceRoot)||(e==null?void 0:e.path)||"").trim(),r=String((e==null?void 0:e.id)||"").trim(),s=String((e==null?void 0:e.label)||(e==null?void 0:e.name)||"").trim();if(!n&&!r&&!s)return null;const i=String(s||r||"知识库").trim();return{id:r,label:i,kind:(e==null?void 0:e.kind)==="git"?"git":"local",type:String((e==null?void 0:e.type)||""),repoPath:n,path:n,mountPath:String((e==null?void 0:e.mountPath)||r||i).trim(),repoUrl:String((e==null?void 0:e.repoUrl)||"").trim(),branch:String((e==null?void 0:e.branch)||"").trim(),readonly:!0,role:t}}function Lm(e=[]){const t=(Array.isArray(e)?e:[e]).map((n,r)=>iT(n,r===0?"primary":"context")).filter(Boolean);return t.length?{version:1,sources:t}:null}function oT(e){return(e&&typeof e=="object"&&Array.isArray(e.sources)?e.sources:[]).map(n=>iT(n,(n==null?void 0:n.role)||"context")).filter(Boolean)}function FY(e){const t=Array.isArray(e==null?void 0:e.inputs)?e.inputs:[],n=Hh(t,"knowledgeContext"),r=Hh(t,"workspaceContext");return{sources:oT(n||(r?Lm([r]):null)),path:Vo(t,"path",""),label:Vo(t,"label","")}}function G1(e){var r,s,i,a,l,c,u,f,d;if(!e)return null;const{inputs:t,outputs:n}=Z7(e);return{id:e.id,newId:e.id,label:String(((r=e.data)==null?void 0:r.label)??e.id),role:String(((s=e.data)==null?void 0:s.role)??"normal"),model:String(((i=e.data)==null?void 0:i.model)??""),body:String(((a=e.data)==null?void 0:a.body)??""),images:ro((l=e.data)==null?void 0:l.images),script:String(((c=e.data)==null?void 0:c.script)??""),scriptRef:String(((u=e.data)==null?void 0:u.scriptRef)??""),implementationRef:String(((f=e.data)==null?void 0:f.implementationRef)??""),implementationMode:String(((d=e.data)==null?void 0:d.implementationMode)??""),inputs:t,outputs:n}}function J1(e,t,n,r=""){var c,u;const s=String(n||"").trim(),i=(Array.isArray(e)?e:[]).find(f=>String((f==null?void 0:f.id)||"")===s),a=String(((c=i==null?void 0:i.data)==null?void 0:c.model)||"").trim();if(a&&a!=="default")return a;const l=String(((u=t==null?void 0:t[s])==null?void 0:u.model)||"").trim();return l&&l!=="default"?l:String(r||"").trim()}function X1(e){return(Array.isArray(e)?e:[]).map(t=>({type:String((t==null?void 0:t.type)??"node").trim()||"node",name:String((t==null?void 0:t.name)??""),default:String((t==null?void 0:t.default)??""),required:!!(t!=null&&t.required),showOnNode:(t==null?void 0:t.showOnNode)!=null?t.showOnNode!==!1:!!(t!=null&&t.required)||String((t==null?void 0:t.type)??"node").trim().toLowerCase()==="node"}))}function zY(e,t,n){var f,d;const r=String(((f=e==null?void 0:e.data)==null?void 0:f.definitionId)??n),s=r.startsWith("provide_"),i=String((t==null?void 0:t.role)||"").trim(),a=wd.includes(i)?i:"normal",l=String((t==null?void 0:t.model)||"").trim(),c={...e.data,label:String((t==null?void 0:t.label)||"").trim()||n,role:a,model:l===""||l==="default"?void 0:l,body:s?"":String((t==null?void 0:t.body)??""),images:s?[]:ro(t==null?void 0:t.images),inputs:X1(t==null?void 0:t.inputs),outputs:s&&Array.isArray((d=e.data)==null?void 0:d.outputs)?e.data.outputs:X1(t==null?void 0:t.outputs)},u=String((t==null?void 0:t.script)??"").trim();r==="tool_nodejs"||u!==""?c.script=String((t==null?void 0:t.script)??""):delete c.script;for(const p of["scriptRef","implementationRef","implementationMode"]){const h=String((t==null?void 0:t[p])??"").trim();h?c[p]=h:delete c[p]}return c}function Q1({nodes:e,edges:t,instances:n,selectedNode:r,draft:s,allowRename:i=!1}){if(!s||!r)return{ok:!1,error:""};const a=r.id,l=String(s.newId||"").trim(),c=i?l:a;if(i){if(!vU.test(c))return{ok:!1,error:"Invalid instance id"};if(e.some(k=>k.id===c&&k.id!==a))return{ok:!1,error:"Duplicate instance id"}}const u=zY(r,s,c),f=r.data||{};if(!(c!==a||f.label!==u.label||f.role!==u.role||f.model!==u.model||f.body!==u.body||JSON.stringify(ro(f.images))!==JSON.stringify(u.images)||(f.script??void 0)!==(u.script??void 0)||(f.scriptRef??void 0)!==(u.scriptRef??void 0)||(f.implementationRef??void 0)!==(u.implementationRef??void 0)||(f.implementationMode??void 0)!==(u.implementationMode??void 0)||JSON.stringify(f.inputs||[])!==JSON.stringify(u.inputs||[])||JSON.stringify(f.outputs||[])!==JSON.stringify(u.outputs||[])))return{ok:!0,changed:!1,nextId:c,nodes:e,edges:t,instances:n};const p=e.map(k=>k.id===a?{...k,id:c,selected:!0,data:u}:k);let h=t,g=n;if(c!==a){g={...n||{}};const k={...g[a]||{}};delete g[a],g[c]=k,h=t.map((w,y)=>({...w,source:w.source===a?c:w.source,target:w.target===a?c:w.target,id:`we-${w.source===a?c:w.source}-${w.target===a?c:w.target}-${y}`}))}return{ok:!0,changed:!0,nextId:c,nodes:p,edges:h,instances:g}}function BY(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}function HY(e,t,n){if(!e||!t||!n)return n;const r={...e};for(const s of["newId","label","role","model","body","images","script","scriptRef","implementationRef","implementationMode","inputs","outputs"])BY(e[s],t[s])&&(r[s]=n[s]);return r}function Tw(e,t=[]){const n=m.useRef(null),r=m.useRef(null),[s,i]=m.useState({visible:!1,top:0,height:100}),a=m.useCallback(()=>{const f=n.current;if(!f)return;const d=Math.max(1,f.scrollHeight),p=Math.max(1,f.clientHeight),h=d>p+1,g=h?Math.max(12,p/d*100):100,k=Math.max(0,100-g),w=h?Math.min(k,f.scrollTop/Math.max(1,d-p)*k):0;i({visible:h,top:w,height:g})},[]);m.useEffect(()=>{if(!e)return;const f=requestAnimationFrame(a);return()=>cancelAnimationFrame(f)},[e,a,...t]);const l=m.useCallback(f=>{const d=n.current;if(!d)return;const p=Math.max(0,d.scrollHeight-d.clientHeight);d.scrollTop=Math.min(1,Math.max(0,f))*p,a()},[a]),c=m.useCallback((f,d=0)=>{const p=r.current;if(!p)return 0;const h=p.getBoundingClientRect(),g=s.height/100*h.height,k=Math.max(1,h.height-g);return(f-h.top-d)/k},[s.height]),u=m.useCallback(f=>{var C,N;if(!s.visible)return;f.preventDefault(),f.stopPropagation();const d=r.current;if(!d)return;const p=d.getBoundingClientRect(),h=s.top/100*p.height,g=s.height/100*p.height,w=f.clientY>=p.top+h&&f.clientY<=p.top+h+g?f.clientY-p.top-h:g/2;l(c(f.clientY,w));const y=f.pointerId;(N=(C=f.currentTarget).setPointerCapture)==null||N.call(C,y);const v=j=>{j.preventDefault(),l(c(j.clientY,w))},b=()=>{window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",b)};window.addEventListener("pointermove",v),window.addEventListener("pointerup",b),window.addEventListener("pointercancel",b)},[c,l,s.height,s.top,s.visible]);return{menuRef:n,scrollbarTrackRef:r,scrollbar:s,updateMenuScrollbar:a,handleScrollbarPointerDown:u}}function WY({id:e,data:t,selected:n,deleteNode:r,skills:s,skillCollections:i,onChangeSkillKeys:a}){const l=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],c=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],u=Array.isArray(s)?s:[],f=Array.isArray(i)?i:[],[d,p]=m.useState(!1),[h,g]=m.useState(""),[k,w]=m.useState(()=>new Set),y=m.useRef(null),v=m.useRef(null),[b,C]=m.useState({visible:!1,top:0,height:100}),N=m.useMemo(()=>new Set(MY(t)),[t]),j=m.useMemo(()=>new Map(u.map($=>[$.key,$])),[u]),A=m.useMemo(()=>Array.from(N).map($=>{var R;return((R=j.get($))==null?void 0:R.name)||$}),[j,N]),I=m.useMemo(()=>tT(A,"选择 Skills"),[A]),D=m.useMemo(()=>{const $=new Set,R=f.map(_=>{const X=Ho(_,u).map(z=>j.get(z)).filter(Boolean);for(const z of X)$.add(z.key);return{..._,skills:X}}).filter(_=>_.skills.length>0),B=u.filter(_=>!$.has(_.key));return{collectionGroups:R,ungrouped:B}},[j,f,u]);m.useEffect(()=>{w($=>{let R=!1;const B=new Set($);for(const _ of D.collectionGroups)B.has(_.id)||(B.add(_.id),R=!0);return R?B:$})},[D.collectionGroups]);const H=m.useMemo(()=>{const $=h.trim().toLowerCase();if(!$)return D;const R=_=>[_==null?void 0:_.key,_==null?void 0:_.name,_==null?void 0:_.description].map(z=>String(z||"").toLowerCase()).join(" ").includes($);return{collectionGroups:D.collectionGroups.map(_=>{const z=[_==null?void 0:_.id,_==null?void 0:_.name,_==null?void 0:_.description].map(T=>String(T||"").toLowerCase()).join(" ").includes($)?_.skills:_.skills.filter(R);return{..._,skills:z}}).filter(_=>_.skills.length>0),ungrouped:D.ungrouped.filter(R)}},[D,h]),V=m.useCallback(($,R)=>{const B=new Set(N);for(const _ of $)R?B.add(_):B.delete(_);a==null||a(e,Array.from(B))},[e,N,a]),F=m.useCallback($=>{w(R=>{const B=new Set(R);return B.has($)?B.delete($):B.add($),B})},[]),L=m.useCallback(()=>{const $=y.current;if(!$)return;const R=Math.max(1,$.scrollHeight),B=Math.max(1,$.clientHeight),_=R>B+1,X=_?Math.max(12,B/R*100):100,z=Math.max(0,100-X),T=_?Math.min(z,$.scrollTop/Math.max(1,R-B)*z):0;C({visible:_,top:T,height:X})},[]);m.useEffect(()=>{if(!d)return;const $=requestAnimationFrame(L);return()=>cancelAnimationFrame($)},[k,H,N.size,d,L]);const M=m.useCallback($=>{const R=y.current;if(!R)return;const B=Math.max(0,R.scrollHeight-R.clientHeight);R.scrollTop=Math.min(1,Math.max(0,$))*B,L()},[L]),K=m.useCallback(($,R=0)=>{const B=v.current;if(!B)return 0;const _=B.getBoundingClientRect(),X=b.height/100*_.height,z=Math.max(1,_.height-X);return($-_.top-R)/z},[b.height]),W=m.useCallback($=>{var se,ee;if(!b.visible)return;$.preventDefault(),$.stopPropagation();const R=v.current;if(!R)return;const B=R.getBoundingClientRect(),_=b.top/100*B.height,X=b.height/100*B.height,T=$.clientY>=B.top+_&&$.clientY<=B.top+_+X?$.clientY-B.top-_:X/2;M(K($.clientY,T));const Z=$.pointerId;(ee=(se=$.currentTarget).setPointerCapture)==null||ee.call(se,Z);const ae=re=>{re.preventDefault(),M(K(re.clientY,T))},J=()=>{window.removeEventListener("pointermove",ae),window.removeEventListener("pointerup",J),window.removeEventListener("pointercancel",J)};window.addEventListener("pointermove",ae),window.addEventListener("pointerup",J),window.addEventListener("pointercancel",J)},[K,M,b.height,b.top,b.visible]);return o.jsxs("div",{className:"af-work-load-skills-card"+(n?" af-work-load-skills-card--selected":"")+(d?" af-work-load-skills-card--menu-open":""),onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,children:[l.map(($,R)=>{if($.showOnNode===!1)return null;const B=`${2.6+R*1.7}rem`,_=$.name||`#${R+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:B},children:_}),o.jsx(Kn,{type:"target",position:Be.Left,id:`input-${R}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:B,background:_n($.type)},title:`${_} · ${$.type}`})]},`in-${R}`)}),c.map(($,R)=>{if($.showOnNode===!1)return null;const B=`${2.6+R*1.7}rem`,_=$.name||`#${R+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:B},children:_}),o.jsx(Kn,{type:"source",position:Be.Right,id:`output-${R}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:B,background:_n($.type)},title:`${_} · ${$.type}`})]},`out-${R}`)}),o.jsxs("div",{className:"af-work-load-skills-card__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"extension"}),o.jsx("strong",{children:(t==null?void 0:t.label)||"Load Skills"}),o.jsx("span",{children:(t==null?void 0:t.definitionId)||"control_load_skills"}),o.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-work-load-skills-card__body nodrag",children:[o.jsxs("button",{type:"button",className:"af-work-load-skills-card__select",onClick:$=>{var R;$.stopPropagation(),d||(R=t==null?void 0:t.onRefreshSkills)==null||R.call(t),p(B=>!B)},children:[o.jsxs("span",{className:"af-work-load-skills-card__summary",title:I.title,children:[o.jsx("span",{className:"af-work-load-skills-card__summary-main",children:I.head}),I.extra?o.jsx("span",{className:"af-work-load-skills-card__summary-extra",children:I.extra}):null]}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:d?"expand_less":"expand_more"})]}),d?o.jsxs("div",{className:"af-work-load-skills-menu-shell",onClick:$=>$.stopPropagation(),children:[o.jsxs("div",{className:"af-work-load-skills-search",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{type:"search",value:h,onChange:$=>g($.target.value),placeholder:"搜索 Skills...",spellCheck:!1,autoComplete:"off","aria-label":"搜索 Skills"}),h?o.jsx("button",{type:"button",onClick:()=>g(""),"aria-label":"清空搜索",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),o.jsxs("div",{ref:y,className:"af-work-load-skills-menu",onScroll:L,children:[H.collectionGroups.map($=>{const R=$.skills.map(z=>z.key),B=R.filter(z=>N.has(z)).length,_=R.length>0&&B===R.length,X=k.has($.id);return o.jsxs("section",{className:"af-work-load-skills-menu__group"+(X?" af-work-load-skills-menu__group--collapsed":""),children:[o.jsxs("div",{className:"af-work-load-skills-menu__group-head",children:[o.jsx("input",{type:"checkbox",checked:_,onChange:z=>V(R,z.target.checked),"aria-label":`选择 ${$.name}`}),o.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-toggle",onClick:()=>F($.id),"aria-expanded":!X,children:o.jsxs("span",{className:"af-work-load-skills-menu__group-main",children:[o.jsx("span",{children:$.name}),$.description?o.jsx("em",{children:$.description}):null]})}),o.jsxs("small",{children:[B,"/",R.length]}),o.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-arrow",onClick:()=>F($.id),"aria-label":X?`展开 ${$.name}`:`收起 ${$.name}`,children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:X?"chevron_right":"expand_more"})})]}),X?null:o.jsx("div",{className:"af-work-load-skills-menu__options",children:$.skills.map(z=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:N.has(z.key),onChange:T=>V([z.key],T.target.checked)}),o.jsxs("span",{className:"af-work-load-skills-menu__option-main",children:[o.jsx("span",{className:"af-work-load-skills-menu__option-title",children:z.name}),z.description?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:z.description}):null]})]},`${$.id}:${z.key}`))})]},$.id)}),H.ungrouped.length>0?o.jsxs("section",{className:"af-work-load-skills-menu__group",children:[o.jsxs("div",{className:"af-work-load-skills-menu__group-head af-work-load-skills-menu__group-head--plain",children:[o.jsx("span",{children:"Ungrouped"}),o.jsx("small",{children:H.ungrouped.length})]}),o.jsx("div",{className:"af-work-load-skills-menu__options",children:H.ungrouped.map($=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:N.has($.key),onChange:R=>V([$.key],R.target.checked)}),o.jsxs("span",{className:"af-work-load-skills-menu__option-main",children:[o.jsx("span",{className:"af-work-load-skills-menu__option-title",children:$.name}),$.description?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:$.description}):null]})]},`ungrouped:${$.key}`))})]}):null,H.collectionGroups.length===0&&H.ungrouped.length===0?o.jsx("div",{className:"af-work-load-skills-menu__empty",children:"没有匹配的 Skills"}):null,o.jsx("button",{type:"button",className:"af-work-load-skills-menu__clear",onClick:()=>a==null?void 0:a(e,[]),children:"清空"})]}),o.jsx("div",{ref:v,className:"af-work-load-skills-scrollbar"+(b.visible?" af-work-load-skills-scrollbar--visible":""),onPointerDown:W,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${b.height}%`,top:`${b.top}%`}})})]}):null]})]})}function VY({id:e,data:t,selected:n,deleteNode:r,servers:s=[],onChangeMcpNames:i}){const a=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],l=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],[c,u]=m.useState(!1),[f,d]=m.useState(""),p=m.useMemo(()=>new Set(OY(t)),[t]),h=m.useMemo(()=>(Array.isArray(s)?s:[]).map(w=>({name:String((w==null?void 0:w.name)||""),description:String((w==null?void 0:w.description)||""),detail:String((w==null?void 0:w.url)||[w==null?void 0:w.command,...Array.isArray(w==null?void 0:w.args)?w.args:[]].filter(Boolean).join(" ")||""),type:String((w==null?void 0:w.type)||"")})).filter(w=>w.name),[s]),g=m.useMemo(()=>{const w=f.trim().toLowerCase();return w?h.filter(y=>[y.name,y.description,y.detail,y.type].join(" ").toLowerCase().includes(w)):h},[f,h]),k=m.useCallback((w,y)=>{const v=new Set(p);for(const b of w)y?v.add(b):v.delete(b);i==null||i(e,Array.from(v))},[e,p,i]);return o.jsxs("div",{className:"af-work-load-skills-card"+(n?" af-work-load-skills-card--selected":"")+(c?" af-work-load-skills-card--menu-open":""),onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,children:[a.map((w,y)=>{if(w.showOnNode===!1)return null;const v=`${2.6+y*1.7}rem`,b=w.name||`#${y+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:v},children:b}),o.jsx(Kn,{type:"target",position:Be.Left,id:`input-${y}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:v,background:_n(w.type)},title:`${b} · ${w.type}`})]},`in-${y}`)}),l.map((w,y)=>{if(w.showOnNode===!1)return null;const v=`${2.6+y*1.7}rem`,b=w.name||`#${y+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:v},children:b}),o.jsx(Kn,{type:"source",position:Be.Right,id:`output-${y}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:v,background:_n(w.type)},title:`${b} · ${w.type}`})]},`out-${y}`)}),o.jsxs("div",{className:"af-work-load-skills-card__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"hub"}),o.jsx("strong",{children:(t==null?void 0:t.label)||"Load MCP"}),o.jsx("span",{children:(t==null?void 0:t.definitionId)||"control_load_mcp"}),o.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-work-load-skills-card__body nodrag",children:[o.jsxs("button",{type:"button",className:"af-work-load-skills-card__select",onClick:w=>{var y;w.stopPropagation(),c||(y=t==null?void 0:t.onRefreshMcps)==null||y.call(t),u(v=>!v)},children:[o.jsx("span",{children:p.size>0?`${p.size} MCP selected`:"选择 MCP"}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:c?"expand_less":"expand_more"})]}),c?o.jsxs("div",{className:"af-work-load-skills-menu-shell",onClick:w=>w.stopPropagation(),children:[o.jsxs("div",{className:"af-work-load-skills-search",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{type:"search",value:f,onChange:w=>d(w.target.value),placeholder:"搜索 MCP...",spellCheck:!1,autoComplete:"off","aria-label":"搜索 MCP"}),f?o.jsx("button",{type:"button",onClick:()=>d(""),"aria-label":"清空搜索",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),o.jsxs("div",{className:"af-work-load-skills-menu",children:[o.jsxs("section",{className:"af-work-load-skills-menu__group",children:[o.jsxs("div",{className:"af-work-load-skills-menu__group-head af-work-load-skills-menu__group-head--plain",children:[o.jsx("span",{children:"MCP Servers"}),o.jsx("small",{children:g.length})]}),o.jsx("div",{className:"af-work-load-skills-menu__options",children:g.map(w=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:p.has(w.name),onChange:y=>k([w.name],y.target.checked)}),o.jsxs("span",{className:"af-work-load-skills-menu__option-main",children:[o.jsx("span",{className:"af-work-load-skills-menu__option-title",children:w.name}),w.description||w.detail?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:w.description||w.detail}):null]})]},w.name))})]}),g.length===0?o.jsx("div",{className:"af-work-load-skills-menu__empty",children:"没有匹配的 MCP"}):null,o.jsx("button",{type:"button",className:"af-work-load-skills-menu__clear",onClick:()=>i==null?void 0:i(e,[]),children:"清空"})]})]}):null]})]})}function KY({id:e,data:t,selected:n,deleteNode:r,workspaces:s=[],onChangeWorkspace:i,onRefreshWorkspaces:a}){const l=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],c=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],[u,f]=m.useState(!1),[d,p]=m.useState(""),h=FY(t),g=m.useMemo(()=>(Array.isArray(s)?s:[]).map(N=>({id:String((N==null?void 0:N.id)||""),label:String((N==null?void 0:N.label)||(N==null?void 0:N.name)||"知识库"),kind:(N==null?void 0:N.kind)==="git"?"git":"local",path:String((N==null?void 0:N.path)||""),repoUrl:String((N==null?void 0:N.repoUrl)||""),branch:String((N==null?void 0:N.branch)||""),mountPath:String((N==null?void 0:N.mountPath)||""),builtin:(N==null?void 0:N.builtin)===!0,exists:(N==null?void 0:N.exists)!==!1})).filter(N=>N.path),[s]),k=m.useMemo(()=>{const N=d.trim().toLowerCase();return N?g.filter(j=>[j.id,j.label,j.path,j.repoUrl,j.branch,j.mountPath].join(" ").toLowerCase().includes(N)):g},[d,g]),w=m.useMemo(()=>new Set((h.sources||[]).map(N=>N.id||N.path||N.repoPath).filter(Boolean)),[h.sources]),y=m.useMemo(()=>(h.sources||[]).map(N=>N.label||N.id||N.mountPath||N.path),[h.sources]),v=m.useMemo(()=>tT(y,"选择知识库"),[y]),b=Tw(u,[k.length,y.length,d]),C=(N,j)=>{const A=(N==null?void 0:N.id)||(N==null?void 0:N.path)||"",I=g.filter(D=>{const H=D.id||D.path||"";return H===A?j:w.has(H)});i==null||i(e,I)};return o.jsxs("div",{className:"af-work-load-skills-card af-work-load-workspace-card"+(n?" af-work-load-skills-card--selected":"")+(u?" af-work-load-skills-card--menu-open":""),onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,children:[l.map((N,j)=>{if(N.showOnNode===!1)return null;const A=`${2.6+j*1.7}rem`,I=N.name||`#${j+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:A},children:I}),o.jsx(Kn,{type:"target",position:Be.Left,id:`input-${j}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:A,background:_n(N.type)},title:`${I} · ${N.type}`})]},`in-${j}`)}),c.map((N,j)=>{if(N.showOnNode===!1)return null;const A=`${2.6+j*1.7}rem`,I=N.name||`#${j+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:A},children:I}),o.jsx(Kn,{type:"source",position:Be.Right,id:`output-${j}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:A,background:_n(N.type)},title:`${I} · ${N.type}`})]},`out-${j}`)}),o.jsxs("div",{className:"af-work-load-skills-card__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"folder_managed"}),o.jsx("strong",{children:(t==null?void 0:t.label)||"加载知识库"}),o.jsx("span",{children:(t==null?void 0:t.definitionId)||"control_cd_workspace"}),o.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-work-load-skills-card__body nodrag",children:[o.jsxs("button",{type:"button",className:"af-work-load-skills-card__select",onClick:N=>{N.stopPropagation(),u||a==null||a(),f(j=>!j)},children:[o.jsxs("span",{className:"af-work-load-skills-card__summary",title:v.title,children:[o.jsx("span",{className:"af-work-load-skills-card__summary-main",children:v.head}),v.extra?o.jsx("span",{className:"af-work-load-skills-card__summary-extra",children:v.extra}):null]}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:u?"expand_less":"expand_more"})]}),u?o.jsxs("div",{className:"af-work-load-skills-menu-shell",onClick:N=>N.stopPropagation(),children:[o.jsxs("div",{className:"af-work-load-skills-search",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{type:"search",value:d,onChange:N=>p(N.target.value),placeholder:"搜索知识库...",spellCheck:!1,autoComplete:"off","aria-label":"搜索知识库"}),d?o.jsx("button",{type:"button",onClick:()=>p(""),"aria-label":"清空搜索",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),o.jsxs("div",{ref:b.menuRef,className:"af-work-load-skills-menu",onScroll:b.updateMenuScrollbar,children:[o.jsxs("section",{className:"af-work-load-skills-menu__group",children:[o.jsxs("div",{className:"af-work-load-skills-menu__group-head af-work-load-skills-menu__group-head--plain",children:[o.jsx("span",{children:"知识库"}),o.jsx("small",{children:k.length})]}),o.jsx("div",{className:"af-work-load-skills-menu__options",children:k.map(N=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:w.has(N.id||N.path),onChange:j=>C(N,j.target.checked)}),o.jsxs("span",{className:"af-work-load-skills-menu__option-main",children:[o.jsx("span",{className:"af-work-load-skills-menu__option-title",children:N.label}),o.jsxs("span",{className:"af-work-load-skills-menu__option-desc",children:[N.kind==="git"&&N.repoUrl?`${N.repoUrl}${N.branch?` · ${N.branch}`:""}${N.mountPath?` · ${N.mountPath}`:""}`:N.path,N.exists?"":" · 路径未就绪"]})]})]},`${N.id}:${N.path}`))})]}),k.length===0?o.jsx("div",{className:"af-work-load-skills-menu__empty",children:"没有匹配的知识库"}):null,o.jsx("button",{type:"button",className:"af-work-load-skills-menu__clear",onClick:()=>i==null?void 0:i(e,[]),children:"清空知识库"})]}),o.jsx("div",{ref:b.scrollbarTrackRef,className:"af-work-load-skills-scrollbar"+(b.scrollbar.visible?" af-work-load-skills-scrollbar--visible":""),onPointerDown:b.handleScrollbarPointerDown,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${b.scrollbar.height}%`,top:`${b.scrollbar.top}%`}})})]}):null]})]})}function UY({projectId:e,tapdId:t,setTapdId:n,snapshot:r,loading:s,error:i,actionRunning:a,actionOutput:l,pendingConfirm:c,conflict:u,reviewPublishing:f,onRefresh:d,onRunDryRun:p,onConfirmAction:h,onRetryConflict:g,onPublishReview:k}){const[w,y]=m.useState("all"),[v,b]=m.useState("all"),C=String((r==null?void 0:r.phase)||(t?"unavailable":"unselected")),N=Array.isArray(r==null?void 0:r.issues)?r.issues:[],j=wq(r),A=j.reduce((T,Z)=>T+Z.issues.reduce((ae,J)=>ae+1+(Array.isArray(J.children)?J.children.length:0),0),0),I=Array.isArray(r==null?void 0:r.artifacts)?r.artifacts:[];Array.isArray(r==null?void 0:r.optionalGaps)&&r.optionalGaps;const D=r!=null&&r.nextAction&&typeof r.nextAction=="object"?r.nextAction:null,H=Sq(r,D),V=mq(r,H),F=I.filter(T=>!IR({...T,href:$h(T)})),L=m.useMemo(()=>fq(H),[H]);m.useEffect(()=>{v!=="all"&&(L.some(T=>T.key===v)||b("all"))},[v,L]);const M=H.filter(T=>pq(T,v)),K=uq(M),W=Nq(r),$=W.filter(T=>jq(T,w)),R=M.filter(T=>Ak(T)).length,B=r!=null&&r.collaboration&&typeof r.collaboration=="object"?r.collaboration:{},_=B.activeAction&&typeof B.activeAction=="object"?B.activeAction:null;Array.isArray(r==null?void 0:r.clientObservations)&&r.clientObservations;const X=String((r==null?void 0:r.rawOutput)||""),z=nq(C);return o.jsxs("main",{className:"af-prd-workflow af-prd-workflow--timeline","aria-label":"PRD Workflow",children:[o.jsxs("section",{className:"af-prd-workflow__statusbar",children:[o.jsxs("div",{className:"af-prd-workflow__status-main",children:[o.jsx("span",{className:`af-prd-workflow-phase af-prd-workflow-phase--${C.toLowerCase().replace(/[^a-z0-9_-]+/gi,"_")}`,children:j1(C)}),o.jsx("h1",{children:(r==null?void 0:r.pointer)||(t?"等待 prd-flow 返回状态":"绑定 TAPD 需求后读取状态")}),o.jsxs("p",{className:"af-prd-workflow__status-subtitle",children:["Project ",o.jsx("strong",{children:e||"Workspace"}),t?o.jsxs(o.Fragment,{children:[" · TAPD ",o.jsx("strong",{children:t})]}):o.jsx(o.Fragment,{children:" · 未绑定 TAPD"})]}),i?o.jsx("p",{className:"af-prd-workflow-error",children:i}):null,_||B.subscribers?o.jsxs("div",{className:"af-prd-workflow-collab",children:[_?o.jsxs("span",{children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"lock"}),_.title||_.action||"Workflow action"," 执行中",_.userId?o.jsx("small",{children:_.userId}):null]}):null,B.subscribers?o.jsxs("span",{children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"group"}),B.subscribers," 个连接"]}):null]}):null]}),o.jsxs("form",{className:"af-prd-workflow__lookup",onSubmit:T=>{T.preventDefault(),d==null||d()},children:[o.jsx("div",{className:"af-prd-workflow-flow","aria-label":"需求流程阶段",children:z.map(T=>o.jsxs("div",{className:`af-prd-workflow-flow__step af-prd-workflow-flow__step--${T.status}`,children:[o.jsx("span",{"aria-hidden":"true"}),o.jsx("small",{children:T.label})]},T.label))}),o.jsxs("div",{className:"af-prd-workflow__lookup-row",children:[o.jsxs("label",{children:[o.jsx("span",{children:"Project 绑定 TAPD"}),o.jsx("input",{value:t,onChange:T=>n(T.target.value),placeholder:"输入需求 ID",autoComplete:"off",spellCheck:!1})]}),o.jsxs("button",{type:"submit",disabled:s,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:s?"hourglass_empty":"sync"}),s?"读取中":t?"刷新":"绑定"]})]})]})]}),u?o.jsxs("section",{className:"af-prd-workflow-conflict","aria-label":"Workflow conflict",children:[o.jsxs("div",{children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"sync_problem"}),o.jsxs("div",{children:[o.jsx("strong",{children:"状态已变化,需要重新确认"}),o.jsx("p",{children:u.message||"当前 workflow 状态和执行前不一致。"})]})]}),o.jsxs("dl",{children:[o.jsxs("div",{children:[o.jsx("dt",{children:"执行时 revision"}),o.jsx("dd",{children:u.expectedRevision||"空"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"当前 revision"}),o.jsx("dd",{children:u.currentRevision||"未知"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"当前状态"}),o.jsx("dd",{children:[j1(u.currentPhase),u.currentPointer].filter(Boolean).join(" · ")||"未知"})]})]}),o.jsx("div",{className:"af-prd-workflow-conflict__actions",children:o.jsx("button",{type:"button",onClick:()=>d==null?void 0:d(),disabled:s||a,children:"刷新状态"})})]}):null,o.jsxs("section",{className:"af-prd-workflow__main",children:[o.jsxs("article",{className:"af-prd-workflow-actions","aria-label":"Workflow actions",children:[o.jsxs("div",{className:"af-prd-workflow-actions__head",children:[o.jsxs("div",{children:[o.jsx("h2",{children:"Action 时间线"}),o.jsx("p",{children:H.length?`${R}/${M.length} 已完成${v!=="all"?` · 共 ${H.length}`:""}`:"等待 prd-flow 返回 action 列表"})]}),D&&Sd(D)?o.jsxs("div",{className:"af-prd-workflow-local-command",children:[o.jsx("span",{children:"本地 agent 执行"}),o.jsx("code",{children:D.command||qi(D,0)})]}):null]}),L.length?o.jsxs("div",{className:"af-prd-workflow-action-filters","aria-label":"Action tag filters",children:[o.jsxs("button",{type:"button",className:v==="all"?"is-active":"","aria-pressed":v==="all",onClick:()=>b("all"),children:["全部 ",o.jsx("span",{children:H.length})]}),L.map(T=>o.jsxs("button",{type:"button",className:v===T.key?"is-active":"","aria-pressed":v===T.key,onClick:()=>b(T.key),children:[T.label," ",o.jsx("span",{children:T.count})]},T.key))]}):null,o.jsx("div",{className:"af-prd-workflow-action-list",children:M.length?K.map(T=>o.jsxs("section",{className:"af-prd-workflow-action-day",children:[o.jsxs("div",{className:"af-prd-workflow-action-day__label",children:[o.jsx("span",{children:T.day}),o.jsx("small",{children:"北京时间"})]}),o.jsx("div",{className:"af-prd-workflow-action-day__items",children:T.items.map(({item:Z,index:ae})=>{const J=Qo(Z.status),se=za(Z)==="observation"&&J==="done"?"observed":J,ee=Mm(Z),re=cq(Z),ne=hq(Z),ue=sq(Z,ae),de=iq(Z);return o.jsxs("div",{className:`af-prd-workflow-action af-prd-workflow-action--${se}`,children:[o.jsx("div",{className:"af-prd-workflow-action__rail",children:o.jsx("span",{className:"af-prd-workflow-action__dot"})}),o.jsxs("div",{className:"af-prd-workflow-action__body",children:[o.jsxs("div",{className:"af-prd-workflow-action__top",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"af-prd-workflow-action__title",children:[re?o.jsx("time",{dateTime:Lh(Z),children:re}):null,o.jsx("strong",{children:ue})]}),de?o.jsx("p",{children:de}):null,ne.length?o.jsx("div",{className:"af-prd-workflow-action__meta",children:ne.map(xe=>o.jsxs("span",{children:[o.jsx("b",{children:xe.label}),xe.value]},`${xe.label}-${xe.value}`))}):null]}),o.jsx("span",{className:"af-prd-workflow-action__status",children:dq(Z)})]}),ee.length?o.jsx("div",{className:"af-prd-workflow-action__links",children:ee.map(xe=>o.jsxs("a",{href:xe.href,target:"_blank",rel:"noreferrer",children:[o.jsx("span",{children:xe.label}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_new"})]},`${xe.label}-${xe.href}`))}):null]})]},Z.id||Z.actionId||`${qi(Z,ae)}-${ae}`)})})]},T.day)):o.jsxs("div",{className:"af-prd-workflow-action-empty",children:[o.jsx("strong",{children:t?H.length?"当前 tag 下暂无 action":"暂无 prd-flow 上报 action":"先绑定 TAPD 需求"}),o.jsx("p",{children:t?H.length?"切换到其它 tag 或查看全部。":"Workflow tab 不会生成默认步骤;需要 prd-flow snapshot 返回 actions/timeline/events/history 或 nextAction。":"绑定后从 prd-flow 读取真实 action、产物和 URL。"})]})})]}),o.jsxs("aside",{className:"af-prd-workflow-side","aria-label":"Workflow related links",children:[F.length?o.jsxs("article",{className:"af-prd-workflow-card",children:[o.jsxs("div",{className:"af-prd-workflow-card__head",children:[o.jsx("h2",{children:"关联产物"}),o.jsx("span",{children:F.length})]}),o.jsx("div",{className:"af-prd-workflow-list",children:F.map((T,Z)=>{const ae=$h(T),J=String(T.label||T.title||T.kind||ae||`Artifact ${Z+1}`);return ae?o.jsxs("a",{href:ae,target:"_blank",rel:"noreferrer",children:[o.jsx("span",{children:J}),o.jsx("small",{children:T.kind||ae})]},`${ae}-${Z}`):o.jsxs("div",{children:[o.jsx("span",{children:J}),o.jsx("small",{children:T.kind||""})]},`${J}-${Z}`)})})]}):null,o.jsxs("article",{className:"af-prd-workflow-card",children:[o.jsxs("div",{className:"af-prd-workflow-card__head",children:[o.jsx("h2",{children:"AI Docs"}),o.jsx("span",{children:V.length})]}),o.jsx("div",{className:"af-prd-workflow-list",children:V.length?V.map(T=>o.jsxs("a",{href:T.href,target:"_blank",rel:"noreferrer",children:[o.jsx("span",{children:T.label}),o.jsx("small",{children:[T.issueKey,T.platform,T.kind].filter(Boolean).join(" · ")||"ai-doc"})]},T.href)):o.jsx("p",{className:"af-prd-workflow-muted",children:"暂无 ai-doc 文档。"})})]}),o.jsxs("article",{className:"af-prd-workflow-card",children:[o.jsxs("div",{className:"af-prd-workflow-card__head",children:[o.jsx("h2",{children:"Issues"}),o.jsx("span",{children:A||N.length})]}),o.jsx("div",{className:"af-prd-workflow-issues",children:j.length?j.map(T=>o.jsxs("div",{className:"af-prd-workflow-epic",children:[o.jsxs("div",{className:"af-prd-workflow-epic__head",children:[o.jsx("strong",{children:T.title||T.key}),o.jsx("small",{children:T.issues.length})]}),T.issues.map((Z,ae)=>{var ee;const J=Z.issue||{},se=_1(J);return o.jsxs("div",{className:"af-prd-workflow-issue",children:[o.jsx("strong",{children:C1(J,ae)}),o.jsx("small",{children:[Vi(J,ae),J.platform,J.status].filter(Boolean).join(" · ")}),se.length?o.jsx("div",{className:"af-prd-workflow-issue__links",children:se.map(re=>o.jsx("a",{href:re.href,target:"_blank",rel:"noreferrer",children:re.label},`${re.label}-${re.href}`))}):null,(ee=Z.children)!=null&&ee.length?o.jsx("div",{className:"af-prd-workflow-issue__children",children:Z.children.map((re,ne)=>{const ue=re.issue||{},de=_1(ue);return o.jsxs("div",{className:"af-prd-workflow-issue af-prd-workflow-issue--child",children:[o.jsx("strong",{children:C1(ue,ne)}),o.jsx("small",{children:[Vi(ue,ne),ue.platform,ue.status].filter(Boolean).join(" · ")}),de.length?o.jsx("div",{className:"af-prd-workflow-issue__links",children:de.map(xe=>o.jsx("a",{href:xe.href,target:"_blank",rel:"noreferrer",children:xe.label},`${xe.label}-${xe.href}`))}):null]},Vi(ue,ne))})}):null]},Vi(J,ae))})]},T.key)):o.jsx("p",{className:"af-prd-workflow-muted",children:"暂无 Issue 信息。"})})]}),o.jsxs("article",{className:"af-prd-workflow-card",children:[o.jsxs("div",{className:"af-prd-workflow-card__head",children:[o.jsx("h2",{children:"运行审计"}),o.jsxs("span",{children:[$.length,"/",W.length]})]}),o.jsx("div",{className:"af-prd-workflow-audit-filter",role:"tablist","aria-label":"运行审计筛选",children:[["all","全部"],["errors","异常"],["review","Review"],["external","外部"]].map(([T,Z])=>o.jsx("button",{type:"button",className:w===T?"is-active":"",onClick:()=>y(T),children:Z},T))}),o.jsx("div",{className:"af-prd-workflow-audit",children:$.length?$.map((T,Z)=>o.jsxs("div",{children:[o.jsx("strong",{children:qi(T,Z)}),o.jsx("small",{children:[T.status,T.type,Lh(T)].filter(Boolean).join(" · ")})]},T.id||`${T.type}-${Z}`)):o.jsx("p",{className:"af-prd-workflow-muted",children:"暂无运行事件。"})})]}),X||l?o.jsxs("article",{className:"af-prd-workflow-card af-prd-workflow-card--raw",children:[o.jsx("div",{className:"af-prd-workflow-card__head",children:o.jsx("h2",{children:"Raw"})}),o.jsx("pre",{children:l||X})]}):null]})]})]})}function Z1(e,t){if(!(e!=null&&e[`has${t[0].toUpperCase()}${t.slice(1)}`]))return"(删除该字段)";const n=e==null?void 0:e[t];if(typeof n=="string")return n;try{return JSON.stringify(n,null,2)}catch{return String(n)}}function uu(e){if(!(e!=null&&e.hasIncoming))return"null";try{return JSON.stringify(e.incoming,null,2)}catch{return JSON.stringify(String(e.incoming))}}function qY(e,t,n,r=!0){const s=JSON.parse(JSON.stringify(e||{})),i=Array.isArray(t)?t:[];if(!i.length)return r?n:{};let a=s;for(let c=0;c<i.length-1;c+=1){const u=i[c],f=i[c+1];(!a[u]||typeof a[u]!="object")&&(a[u]=Number.isInteger(f)?[]:{}),a=a[u]}const l=i[i.length-1];return r?a[l]=n:Array.isArray(a)&&Number.isInteger(l)?a.splice(l,1):delete a[l],s}function YY(){var PS,IS,RS;const{t:e,i18n:t}=Ir(),{navigate:n}=Ni(),r=wc(),s=b5(),i=m.useMemo(WU,[]),a=m.useMemo(()=>i.workspaceId?`agentflow.workspace.viewport:shared:${i.workspaceId}`:`agentflow.workspace.viewport:${i.flowSource||"user"}:${i.flowId||""}`,[i]),[l,c]=m.useState(()=>(()=>{const x=new URLSearchParams(window.location.search).get("view");return x==="display"||x==="workflow"?x:"workspace"})()),[u,f]=m.useState(!1),[d,p]=m.useState(!1),[h,g]=k5([]),[k,w]=v5([]),y=m.useRef([]),v=m.useRef([]),b=m.useRef(null),[C,N]=m.useState(()=>Hp(null,[])),j=m.useRef(C),[A,I]=m.useState(null),D=m.useRef(null),H=m.useRef(!1),[V,F]=m.useState([]),L=m.useRef(new Map),M=m.useRef(new Map),K=m.useRef(null),W=m.useRef(null),$=m.useRef(null),[R,B]=m.useState(null),[_,X]=m.useState({}),z=m.useRef({}),T=m.useRef(!1),Z=m.useRef(null),ae=m.useRef(""),J=m.useRef(null),se=m.useRef(Promise.resolve()),ee=m.useRef(0),re=m.useRef(!1),ne=m.useRef(0),ue=m.useRef(!1),de=m.useRef(typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`client-${Date.now()}-${Math.random().toString(36).slice(2)}`),xe=m.useRef(!1),ze=m.useRef(null),[Te,Le]=m.useState([]),[nt,wt]=m.useState(""),[mt,Re]=m.useState("nodes"),[it,Nt]=m.useState([]),[qt,Zt]=m.useState(!1),[rt,fe]=m.useState(""),[ve,He]=m.useState(!1),[Ge,je]=m.useState({name:"",id:"",description:""}),[Tt,kn]=m.useState(!1),[dn,en]=m.useState(""),[Pn,te]=m.useState(""),Ee=m.useRef(null),[We,Ke]=m.useState(!1),[bt,jt]=m.useState(!1),[qn,Ht]=m.useState(""),[gt,Mn]=m.useState(null),[Pt,fn]=m.useState(()=>Ry()),[Yn,ei]=m.useState(""),[qr,Yr]=m.useState(!1),[pr,on]=m.useState(""),[zn,Rr]=m.useState(!1),[In,Qn]=m.useState([]),[vr,Ns]=m.useState(!1),[Sr,Ft]=m.useState(""),[ce,ke]=m.useState(""),[tt,yt]=m.useState(""),[vn,Jt]=m.useState(!1),[Bn,us]=m.useState(""),[ut,Wt]=m.useState(""),[Vt,$n]=m.useState(!1),[Fe,ir]=m.useState("nodes"),[Tr,ti]=m.useState(""),[js,Mr]=m.useState(0),[ie,be]=m.useState(""),Pe=m.useRef(""),[Se,xt]=m.useState(null),Kt=m.useRef(null),[or,rn]=m.useState(""),[hr,U]=m.useState([]),[ge,Me]=m.useState(""),[oe,Je]=m.useState(!0),[dt,_t]=m.useState(null),[pn,Gr]=m.useState(!1),[_i,io]=m.useState(!1),[Gk,Ec]=m.useState(""),[Ac,Jk]=m.useState(""),[Xk,Qk]=m.useState(""),[Sn,Ya]=m.useState(null),[ZT,Zo]=m.useState(!1),[Wm,Ga]=m.useState({}),[Jd,Zk]=m.useState(!1),[ev,Pc]=m.useState(""),[Vm,eM]=m.useState(""),[tM,Ja]=m.useState(()=>new Set),[Km,Um]=m.useState(""),[Ic,qm]=m.useState({nodeId:"",query:""}),[tv,nv]=m.useState(!1),rv=m.useRef(null),sv=m.useRef(null),iv=m.useRef(""),[Ym,nM]=m.useState(()=>{try{const x=Number(window.localStorage.getItem("agentflow.workspace.filesPaneHeight")||0);if(Number.isFinite(x)&&x>=160)return x}catch{}return 360}),[rM,ov]=m.useState(!1),[ea,sM]=m.useState({cursor:[],opencode:[],claudeCode:[],codex:[]}),[Ei,iM]=m.useState(""),[Cs,oM]=m.useState([]),[av,lv]=m.useState(!1),[_s,Rc]=m.useState([]),[Xa,aM]=m.useState([]),[cv,lM]=m.useState(!1),[uv,dv]=m.useState([]),[fv,pv]=m.useState([]),[ar,cM]=m.useState(()=>{try{const x=String(new URLSearchParams(window.location.search).get("tapdId")||"").trim();return x||String(window.localStorage.getItem(`agentflow.workflow.tapdId:${i.flowSource||"user"}:${i.flowId||""}`)||"").trim()}catch{return""}}),[tn,Xd]=m.useState(null),[uM,hv]=m.useState(!1),[dM,Qa]=m.useState(""),[Gm,mv]=m.useState(!1),[Jm,Qd]=m.useState(""),[ds,Zd]=m.useState(null),[Xm,gv]=m.useState(!1),[Tc,Mc]=m.useState(null),yv=m.useCallback(x=>{Ee.current&&window.clearTimeout(Ee.current),te(x),Ee.current=window.setTimeout(()=>{te(""),Ee.current=null},3800)},[]),oo=m.useCallback(x=>{const S=String(x||"").trim();if(!S)return;const E=()=>s(S);window.requestAnimationFrame(E),window.setTimeout(E,80)},[s]),xv=m.useCallback((x,S)=>{const E=String(x||"").trim(),P=Bh(S);!E||!P||(g(O=>O.map(q=>{var le;if(q.id!==E)return q;const Y=Bh((le=q.data)==null?void 0:le.displaySize),G=Y&&Y.width===P.width&&Y.height===P.height,Q=Math.round(Number(q.width||0))===P.width&&Math.round(Number(q.height||0))===P.height;return G&&Q?q:{...q,width:P.width,height:P.height,data:{...q.data,nodeSize:P,displaySize:P}}})),oo(E))},[oo,g]);m.useEffect(()=>{try{window.localStorage.setItem("agentflow.workspace.filesPaneHeight",String(Math.round(Ym)))}catch{}},[Ym]);const Qm=m.useCallback(x=>{const S=rv.current;if(!S)return;const E=S.getBoundingClientRect(),P=16,O=150,q=230,Y=E.top+P,G=E.bottom-P,Q=Math.max(O,G-Y-q),le=Math.min(Math.max(x-Y,O),Q);nM(le)},[]),fM=m.useCallback(x=>{x.preventDefault(),x.stopPropagation(),ov(!0),Qm(x.clientY);const S=P=>{P.preventDefault(),Qm(P.clientY)},E=()=>{ov(!1),window.removeEventListener("pointermove",S,!0),window.removeEventListener("pointerup",E,!0),window.removeEventListener("pointercancel",E,!0)};window.addEventListener("pointermove",S,!0),window.addEventListener("pointerup",E,!0),window.addEventListener("pointercancel",E,!0)},[Qm]);m.useEffect(()=>()=>{Ee.current&&window.clearTimeout(Ee.current),ze.current&&window.clearTimeout(ze.current)},[]);const[pM,wv]=m.useState(()=>new Set),[ef,Zm]=m.useState(!1),eg=m.useRef(null),bv=m.useRef(null),kv=m.useRef(null),[hM,mM]=m.useState({}),[ta,tg]=m.useState(""),[Jr,vv]=m.useState(!1),[na,Za]=m.useState([]),[Es,Hn]=m.useState([]),[$r,fs]=m.useState("workspace"),[$c,el]=m.useState(!1),Sv=m.useRef(null),ng=m.useRef(null),[Lc,tl]=m.useState(null),[gM,rg]=m.useState(!0),[Nv,jv]=m.useState(""),[ra,ao]=m.useState({}),[Nr,Cv]=m.useState(null),[_v,Ev]=m.useState(!1),nl=m.useMemo(()=>_v?YU(Nr):"",[_v,Nr]),[Oc,tf]=m.useState(!0);m.useEffect(()=>{nl&&tf(GU(nl))},[nl]),m.useEffect(()=>{if(nl)try{window.localStorage.setItem(nl,Oc?"true":"false")}catch{}},[Oc,nl]);const[sg,nf]=m.useState(!1),[ig,Av]=m.useState(!1),[og,Pv]=m.useState("pan"),[Iv,yM]=m.useState({}),Dc=m.useRef({}),[Rv,sa]=m.useState({}),Fc=m.useRef(new Map),zc=m.useRef(new Set),[Tv,rl]=m.useState(()=>new Set),[ag,sl]=m.useState({}),[Mv,$v]=m.useState(""),[mae,he]=m.useState(""),[Lv,As]=m.useState("loading"),[Ov,Ps]=m.useState("正在载入 Project"),Ai=m.useMemo(()=>qU(i),[i]),[Dv,Fv]=m.useState(""),Bc=i.flowSource||"user",zv=m.useMemo(()=>new Set(Object.values(Iv||{}).map(x=>String((x==null?void 0:x.runNodeId)||"").trim()).filter(Boolean)),[Iv]),Pi=m.useCallback(x=>{const S=Dc.current||{},E=typeof x=="function"?x(S):x,P=E&&typeof E=="object"&&!Array.isArray(E)?E:{};return Dc.current=P,yM(P),P},[]),Bv=!!(i.flowId&&!i.archived&&(dt!=null&&dt.role?dt.role==="owner":Bc==="user"||Bc==="workspace")),Hc=!!(Bc==="workspace"&&(dt!=null&&dt.role)&&dt.role!=="owner"),Hv={loading:"载入中",dirty:"有未同步修改",saving:"同步中",synced:"已同步",conflict:"同步冲突",error:"同步失败",readonly:"只读"}[Lv]||"同步状态",Is=m.useCallback(()=>{!T.current||!oe||(ue.current=!1,ee.current+=1,re.current=!0,As("dirty"),Ps("本地修改等待同步"))},[oe]);m.useEffect(()=>{i.flowId&&sD(i.flowId,i.flowSource||"user","workspace",!!i.archived)},[i]),m.useEffect(()=>{const x=()=>{c(new URLSearchParams(window.location.search).get("view")==="display"?"display":"workspace")};return window.addEventListener("popstate",x),()=>window.removeEventListener("popstate",x)},[]),m.useEffect(()=>{Za([]),Hn([]),fs("workspace"),rg(!0)},[i]);const Nn=m.useCallback(async()=>{const x=Cr(i),S=await fetch(`/api/workspace/files?${x.toString()}`),E=await S.json();if(!S.ok)throw new Error(E.error||"读取 workspace 失败");const P=E.files||[];U(P),Ja(new Set(XR(P))),Me(E.root||"")},[i]),rf=m.useCallback(async()=>{Zt(!0),fe("");try{const x=await fetch("/api/marketplace/flow-snippets"),S=await x.json().catch(()=>({}));if(!x.ok)throw new Error(S.error||"读取流程片段失败");Nt(Array.isArray(S.snippets)?S.snippets:[])}catch(x){fe(String(x.message||x)),Nt([])}finally{Zt(!1)}},[]),Wv=m.useCallback(async(x,S,E)=>{var Q,le,we;if(!T.current)return;if(!oe)throw he("Readonly workspace"),As("readonly"),Ps("只读 Project"),new Error("Readonly workspace");As("saving"),Ps("正在同步修改");const P=yl(x,S,z.current);P.ui={...P.ui||{},displayPage:L1(j.current,x)};const O=await fetch("/api/workspace/graph",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,graph:P,baseRevision:ae.current,baseGraph:J.current,clientId:de.current})}),q=await O.json().catch(()=>({}));if(!O.ok){if(O.status===409||O.status===428){const Ae=Array.isArray(q.conflictItems)?q.conflictItems:[];Ya({currentRevision:String(q.currentRevision||""),message:q.error||"Workspace 已被其他成员更新",conflictPaths:Array.isArray(q.conflictPaths)?q.conflictPaths:[],conflictItems:Ae,mergeGraph:q.mergeGraph||null,currentGraph:q.currentGraph||null}),Ga(Object.fromEntries(Ae.map((De,Oe)=>[String(Oe),{mode:"local",manual:uu(De)}]))),Pc(""),Zo(Ae.length>0),As("conflict"),Ps(q.error||"存在需要处理的字段冲突");const Qe=Array.isArray(q.conflictPaths)?q.conflictPaths:[],_e=Qe.length?`${q.error||"Workspace 已被其他成员更新"}:${Qe.join("、")}`:q.error||"Workspace 已被其他成员更新",$e=new Error(_e);throw $e.code="WORKSPACE_REVISION_CONFLICT",$e.currentRevision=q.currentRevision||"",$e}const pe=new Error(q.error||"保存 workspace graph 失败");throw As("error"),Ps(pe.message),pe}const Y=ee.current!==E,G=IU({savedGraph:q.graph,sentGraph:P,savedRevision:q.revision,currentRevision:ae.current});if(ae.current=G.revision,J.current=G.graph,!Y){if(z.current=((Q=q.graph)==null?void 0:Q.instances)||P.instances,X(z.current),q.merged&&q.graph){const pe=cu(q.graph,Te),Ae=Hp((we=(le=q.graph)==null?void 0:le.ui)==null?void 0:we.displayPage,pe.nodes);z.current=pe.instances,X(pe.instances),g(pe.nodes),w(pe.edges),j.current=Ae,N(Ae)}re.current=!1}return sa(cp(q.workspaceSchedules||[])),Ya(null),Zo(!1),As(Y?"dirty":"synced"),Ps(Y?"本地仍有修改等待同步":"所有修改已同步"),he(Y?"已保存上一版,本地新修改正在排队":q.merged?"Workspace graph merged and saved":"Workspace graph saved"),q},[i,Te,w,g,oe]),Yt=m.useCallback((x=h,S=k)=>{const E=ee.current,O=se.current.catch(()=>{}).then(()=>Wv(x,S,E)).catch(q=>{throw(q==null?void 0:q.code)!=="WORKSPACE_REVISION_CONFLICT"&&(As("error"),Ps(String(q.message||q))),q});return se.current=O,O},[k,h,Wv]),xM=m.useCallback(x=>{var E;const S=(E=x==null?void 0:x.extra)!=null&&E.instances&&typeof x.extra.instances=="object"?x.extra.instances:{};z.current=S,X(S),g(Array.isArray(x==null?void 0:x.nodes)?x.nodes:[]),w(Array.isArray(x==null?void 0:x.edges)?x.edges:[]),be(""),B(null)},[w,g]),wM=m.useMemo(()=>({instances:_}),[_]),bM=AU({nodes:h,edges:k,extra:wM,enabled:T.current,onRestore:xM}),{resetHistory:sf,undo:Vv,redo:Kv}=bM,Xr=m.useCallback(async(x={})=>{var Ze,Ye;const S=(x==null?void 0:x.background)===!0,E=ne.current+1;ne.current=E;const P=ee.current,O=ae.current;S||(T.current=!1);const q=Cr(i),Y=Cr(i);Y.set("lang",String(t.language||"zh").startsWith("zh")?"zh":"en");const[G,Q]=await Promise.all([fetch(`/api/nodes?${Y.toString()}`),fetch(`/api/workspace/graph?${q.toString()}`),Nn()]),le=await G.json(),we=await Q.json();if(!G.ok)throw new Error(le.error||"读取节点定义失败");if(!Q.ok)throw new Error(we.error||"读取 workspace graph 失败");const pe=PU({background:S,requestId:E,currentRequestId:ne.current,dirty:re.current,startedEditVersion:P,currentEditVersion:ee.current,startedRevision:O,currentRevision:ae.current});if(pe==="superseded")return{skipped:!0,reason:pe};if(pe==="local-edits")return he("检测到远端更新;本地修改将在保存时自动合并"),{skipped:!0,reason:pe};const Ae=[...(Array.isArray(le)?le:le.nodes||[]).filter(Ie=>!TU.has(Ie.id)),FU,DU,LU,OU,MU,$U];Le(Ae);const Qe=we.graph||JSON.parse(localStorage.getItem(RU)||"null")||{},_e=cu(Qe,Ae),$e=Hp((Ze=Qe==null?void 0:Qe.ui)==null?void 0:Ze.displayPage,_e.nodes),De=!H.current;let Oe=D.current;if(De){let Ie=null;try{Ie=JSON.parse(window.localStorage.getItem(a)||"null")}catch{Ie=null}Oe=Iw(Ie)||Iw((Ye=Qe==null?void 0:Qe.ui)==null?void 0:Ye.viewport)}z.current=_e.instances,X(_e.instances),g(_e.nodes),w(_e.edges),sa(cp(we.workspaceSchedules||[])),ae.current=String(we.revision||""),J.current=Qe,re.current=!1,_t(we.collaboration||null),Ya(null),N($e),j.current=$e,De&&(I(Oe),D.current=Oe,H.current=!0),F([]),sf(_e.nodes,_e.edges,{instances:_e.instances});const It=we.writable!==!1;return ue.current=!0,Je(It),he(It?"Workspace ready":"Readonly workspace"),As(It?"synced":"readonly"),Ps(It?"所有修改已同步":"只读 Project"),T.current=!0,{skipped:!1}},[i,t.language,Nn,sf,w,g,a]),of=m.useCallback(async(x=ar)=>{const S=String(x||"").trim();hv(!0),Qa("");try{const E=Cr(i);E.set("tapdId",S);const P=await fetch(`/api/prd-workflow/snapshot?${E.toString()}`),O=await P.json().catch(()=>({}));if(!P.ok)throw new Error(O.error||"读取 PRD Workflow 失败");Xd(O.snapshot||null),Qd(""),Zd(null),Mc(null);try{const q=`agentflow.workflow.tapdId:${i.flowSource||"user"}:${i.flowId||""}`;S?window.localStorage.setItem(q,S):window.localStorage.removeItem(q)}catch{}}catch(E){Qa(String(E.message||E))}finally{hv(!1)}},[i,ar]),il=m.useCallback(async(x=null,S={})=>{const E=x&&typeof x=="object"?x:tn==null?void 0:tn.nextAction,P=Sd(E);if(!P||Gm)return;const O=(S==null?void 0:S.confirm)===!0,q=String((S==null?void 0:S.expectedRevision)||(tn==null?void 0:tn.revision)||"");mv(!0),Qa(""),O||(Qd(""),Zd(null),Mc(null));try{const Y=await fetch("/api/prd-workflow/action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,tapdId:ar,action:P,stage:Ba(E),title:qi(E,0),...gq(E),dryRun:!O,confirm:O,issueKey:E.issueKey||E.issue_key||"",expectedRevision:q,idempotencyKey:`workflow-${Date.now()}-${Math.random().toString(36).slice(2)}`})}),G=await Y.json().catch(()=>({}));if(!Y.ok||G.ok===!1)throw G.snapshot&&Xd(G.snapshot),G.conflict&&Mc({...G.conflict,action:E}),new Error(G.error||"执行 PRD Workflow action 失败");Qd(G.rawOutput||(G.output?JSON.stringify(G.output,null,2):"")),Xd(G.snapshot||tn),Mc(null),Zd(O?null:{action:E,output:G.output||null,expectedRevision:q,at:new Date().toISOString()})}catch(Y){Qa(String(Y.message||Y))}finally{mv(!1)}},[i,Gm,tn,ar]),kM=m.useCallback((x=null)=>il(x,{confirm:!1}),[il]),vM=m.useCallback(()=>{const x=(ds==null?void 0:ds.action)||(tn==null?void 0:tn.nextAction);return il(x,{confirm:!0,expectedRevision:(ds==null?void 0:ds.expectedRevision)||""})},[il,ds,tn]),SM=m.useCallback(()=>{const x=(Tc==null?void 0:Tc.action)||(tn==null?void 0:tn.nextAction);return Mc(null),il(x,{confirm:!1})},[il,Tc,tn]),NM=m.useCallback(async()=>{var q;const x=String(Jm||(tn==null?void 0:tn.rawOutput)||"").trim();if(!x||Xm)return;const S=(ds==null?void 0:ds.action)||(tn==null?void 0:tn.nextAction)||{},E=`Review: ${qi(S,0)||(tn==null?void 0:tn.pointer)||ar||"PRD Workflow"}`,P=/^[\[{]/.test(x),O=x.startsWith("#")?x:`# ${E}
|
|
246
|
-
|
|
247
|
-
${P?`\`\`\`json
|
|
248
|
-
${x}
|
|
249
|
-
\`\`\``:x}`;gv(!0),Qa("");try{const Y=await fetch("/api/prd-workflow/review-link",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,tapdId:ar,title:E,markdown:O,action:Sd(S),stage:Ba(S),issueKey:S.issueKey||S.issue_key||"",artifactLabel:"临时 Review"})}),G=await Y.json().catch(()=>({}));if(!Y.ok||G.ok===!1)throw new Error(G.error||"生成 Review 链接失败");Xd(G.snapshot||tn);const Q=((q=G.review)==null?void 0:q.url)||"";Q&&Qd(le=>`${le||x}
|
|
250
|
-
|
|
251
|
-
Review link: ${Q}`)}catch(Y){Qa(String(Y.message||Y))}finally{gv(!1)}},[i,Jm,ds,Xm,tn,ar]),jM=m.useCallback(async(x,S)=>{const E={packageId:(x==null?void 0:x.newId)||(x==null?void 0:x.id)||(x==null?void 0:x.label),label:(x==null?void 0:x.label)||(x==null?void 0:x.newId)||(x==null?void 0:x.id),version:"1.0.0",definitionId:S,body:(x==null?void 0:x.body)||"",script:(x==null?void 0:x.script)||"",scriptRef:(x==null?void 0:x.scriptRef)||"",implementationRef:(x==null?void 0:x.implementationRef)||"",implementationMode:(x==null?void 0:x.implementationMode)||"",inputs:Array.isArray(x==null?void 0:x.inputs)?x.inputs:[],outputs:Array.isArray(x==null?void 0:x.outputs)?x.outputs:[],flowId:i.flowId,flowSource:i.flowSource||"user",archived:!!i.archived},P=await fetch("/api/marketplace/publish-node-from-instance",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(E)}),O=await P.json().catch(()=>({}));if(!P.ok||(O==null?void 0:O.ok)===!1)throw new Error((O==null?void 0:O.error)||"Publish failed");return await Xr(),he(`Published node ${O.definitionId||O.id||E.packageId}`),O},[i,Xr]),ia=m.useCallback((x=Es)=>{const S=Array.isArray(x)?x:[],P=[...S].reverse().find(O=>(O==null?void 0:O.status)==="running"||(O==null?void 0:O.status)==="stopping")||[...S].reverse().find(O=>O==null?void 0:O.id);return String((P==null?void 0:P.id)||"workspace")},[Es]),CM=m.useCallback(x=>{const S=String(x||"").trim();!S||S==="workspace"||Hn(E=>{const P=(Array.isArray(E)?E:[]).filter(O=>O.id!==S);return fs(O=>O===S?ia(P):O),P})},[ia]);m.useCallback((x="")=>{el(!0),tl(null),xt(null),fs(x||ia())},[ia]);const Uv=m.useCallback((x={})=>{tl({scheduleNodeId:String(x.scheduleNodeId||""),runNodeId:String(x.runNodeId||x.nodeId||""),lastRunId:String(x.lastRunId||""),label:String(x.label||"")}),el(!1),xt(null),be("")},[]),lg=m.useCallback(async(x="")=>{const S=String(x||"").trim();if(!(!S||!oe)){$v(S),he(`Optimizing run: ${S}`);try{await Yt(y.current,v.current);const E=yl(y.current,v.current,z.current),P=J1(y.current,z.current,S,Ei),O=await fetch("/api/workspace/run/optimize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,runNodeId:S,graph:E,model:P})}),q=await O.json().catch(()=>({}));if(!O.ok||q.ok===!1)throw new Error(q.error||"优化失败");const Y=q.graph||E,G=cu(Y,Te);z.current=G.instances,X(G.instances),g(G.nodes),w(G.edges),sa(cp(q.workspaceSchedules||[])),sf(G.nodes,G.edges,{instances:G.instances});const Q=Array.isArray(q.optimized)?q.optimized.length:0;he(Q>0?`已生成 ${Q} 个 implementation`:"没有需要优化的节点")}catch(E){he(String(E.message||E))}finally{$v("")}}},[Ei,v,i,y,Te,sf,Yt,w,g,oe]),qv=m.useCallback(async(x="")=>{const S=String(x||"").trim(),E=Dc.current||{},P=Object.entries(E).find(([Q,le])=>Q===S||String((le==null?void 0:le.runNodeId)||"")===S)||Object.entries(E)[0]||null,O=(P==null?void 0:P[0])||"",q=(P==null?void 0:P[1])||null,Y=String((q==null?void 0:q.runNodeId)||S||"").trim();if((q==null?void 0:q.status)==="stopping")return;const G=new Set([Y,...Array.isArray(q==null?void 0:q.plannedNodeIds)?q.plannedNodeIds:[]].map(Q=>String(Q||"").trim()).filter(Boolean));O&&Pi(Q=>{const le={...Q};return le[O]&&(le[O]={...le[O],status:"stopping"}),le}),he(Y?`Stopping Workspace run: ${Y}...`:"Stopping Workspace run..."),Hn(Q=>Q.map(le=>(O?le.id===O:!Y||le.runNodeId===Y)&&le.status==="running"?{...le,status:"stopping"}:le));try{const Q=await fetch("/api/workspace/run/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,runId:O,runNodeId:Y})}),le=await Q.json().catch(()=>({}));if(!Q.ok||(le==null?void 0:le.stopped)!==!0)throw new Error(le.error||"Workspace run stop failed");const we=O?Fc.current.get(O):null;we&&(we.abort(),Fc.current.delete(O)),O&&Pi(pe=>{const Ae={...pe};return delete Ae[O],Ae}),rl(pe=>{const Ae=new Set(pe);for(const Qe of G)Ae.delete(Qe);return Ae}),sl(pe=>{var Qe;const Ae={...pe};for(const _e of G)_e&&(!Ae[_e]||((Qe=Ae[_e])==null?void 0:Qe.status)==="running")&&(Ae[_e]={status:"stopped"});return Ae}),he(Y?`Workspace run stopped: ${Y}`:"Workspace run stopped"),Hn(pe=>pe.map(Ae=>(O?Ae.id===O:!Y||Ae.runNodeId===Y)?{...Ae,status:"stopped",endedAt:Date.now(),messages:[...Array.isArray(Ae.messages)?Ae.messages:[],{role:"assistant",kind:"status",text:"Workspace run stopped.",at:Date.now()}].slice(-160)}:Ae))}catch(Q){O&&Pi(we=>{const pe={...we};return pe[O]&&(pe[O]={...pe[O],status:"running"}),pe});const le=String((Q==null?void 0:Q.message)||Q||"Workspace run stop failed");he(`停止失败:${le}`),Hn(we=>we.map(pe=>(O?pe.id===O:!Y||pe.runNodeId===Y)?{...pe,status:"running",messages:[...Array.isArray(pe.messages)?pe.messages:[],{role:"assistant",kind:"error",error:!0,text:`停止失败:${le}`,at:Date.now()}].slice(-160)}:pe))}},[i,Pi]),af=m.useCallback(async()=>{if(i.flowId)try{const x=Cr(i),S=await fetch(`/api/workspace/run/status?${x.toString()}`),E=await S.json().catch(()=>({}));if(!S.ok||!E.running)return;const P=Array.isArray(E.runs)&&E.runs.length?E.runs:[{runId:`run-restored-${E.startedAt||Date.now()}`,runNodeId:E.runNodeId||"",startedAt:E.startedAt||Date.now(),plannedNodeIds:[]}],O={},q=[];for(const Y of P){const G=String((Y==null?void 0:Y.runNodeId)||"").trim(),Q=String((Y==null?void 0:Y.runId)||`run-restored-${(Y==null?void 0:Y.startedAt)||Date.now()}-${G}`).trim();if(!Q)continue;const le=String((Y==null?void 0:Y.label)||"").trim()||_y(y.current,z.current,G,"Workspace Run");O[Q]={id:Q,runNodeId:G,label:le,status:(Y==null?void 0:Y.state)==="stopping"?"stopping":"running",plannedNodeIds:Array.isArray(Y==null?void 0:Y.plannedNodeIds)?Y.plannedNodeIds:[],startedAt:(Y==null?void 0:Y.startedAt)||Date.now()},G&&q.push(G)}if(!Object.keys(O).length)return;Pi(Y=>({...Y,...O})),rl(Y=>{const G=new Set(Y);for(const Q of q)G.add(Q);return G}),sl(Y=>{const G={...Y};for(const Q of q)G[Q]={status:"running"};return G}),he(q.length?`Workspace run still running: ${q.join(", ")}`:"Workspace run still running"),Hn(Y=>{const G=[...Y];for(const[Q,le]of Object.entries(O)){if(G.some(Ae=>Ae.id===Q||["running","stopping"].includes(Ae.status)&&Ae.runNodeId===le.runNodeId))continue;const we=String(le.runNodeId||""),pe=String(le.label||"").trim()||_y(y.current,z.current,we,"Workspace Run");G.push({id:Q,label:Ey(pe,we,"Workspace Run"),alias:pe,runNodeId:we,status:le.status,startedAt:le.startedAt||Date.now(),steps:we?[{id:we,label:Ey(pe,we,"Workspace Run"),status:"running"}]:[],messages:[{role:"assistant",kind:"run-summary",text:le.status==="stopping"?"Workspace run is stopping in the background.":"Workspace run is still running in the background.",at:Date.now()}]})}return[...G.slice(-8)]})}catch{}},[i,y,Pi]),Yv=m.useCallback(async x=>{if(!oe){he("Readonly workspace");return}if(!x)return;if(Object.values(Dc.current||{}).find(Ze=>String((Ze==null?void 0:Ze.runNodeId)||"")===String(x||""))){he(`Workspace run already running: ${x}`);return}let E=y.current,P=v.current,O=z.current;const q=Kt.current;if(q!=null&&q.id){const Ze=E.find(Ie=>Ie.id===q.id),Ye=Q1({nodes:E,edges:P,instances:O,selectedNode:Ze,draft:q,allowRename:!1});if(Ye!=null&&Ye.error){rn(Ye.error),he(Ye.error);return}Ye!=null&&Ye.ok&&Ye.changed&&(E=Ye.nodes,P=Ye.edges,O=Ye.instances,z.current=O,y.current=E,v.current=P,X(O),g(E),w(P),oo(Ye.nextId||q.id))}const Y=yl(E,P,O),G=`run-${Date.now()}-${String(x).replace(/[^a-z0-9_-]+/gi,"_")}`,Q=_y(E,O,x,"Workspace Run"),le=Ey(Q,x,"Workspace Run");let we=[x];try{const Ze=await fetch("/api/workspace/run/plan",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,graph:Y,runNodeId:x})}),Ye=await Ze.json().catch(()=>({}));if(!Ze.ok||(Ye==null?void 0:Ye.ok)===!1)throw new Error(Ye.error||"Workspace run plan failed");we=Array.isArray(Ye.plannedNodeIds)&&Ye.plannedNodeIds.length?Ye.plannedNodeIds.map(Ot=>String(Ot||"").trim()).filter(Boolean):[x],we=Array.from(new Set([x,...we].filter(Boolean)));const Ie=Ye.conflict||null;if(Ie!=null&&Ie.runNodeId||Ie!=null&&Ie.runId){const Ot=Array.isArray(Ie.conflictNodeIds)&&Ie.conflictNodeIds.length?`: ${Ie.conflictNodeIds.join(", ")}`:"";he(`Run ${x} conflicts with running ${Ie.runNodeId||Ie.runId}${Ot}`);return}}catch(Ze){he(String(Ze.message||Ze));return}const pe=new Set(we),Ae=Object.values(Dc.current||{}).find(Ze=>(Array.isArray(Ze==null?void 0:Ze.plannedNodeIds)?Ze.plannedNodeIds:[]).some(Ye=>pe.has(String(Ye||"").trim())));if(Ae){const Ze=(Array.isArray(Ae.plannedNodeIds)?Ae.plannedNodeIds:[]).map(Ye=>String(Ye||"").trim()).filter(Ye=>Ye&&pe.has(Ye));he(`Run ${x} conflicts with running ${Ae.runNodeId||"workspace run"}${Ze.length?`: ${Ze.join(", ")}`:""}`);return}const Qe=new AbortController;Fc.current.set(G,Qe),zc.current.delete(G),Pi(Ze=>({...Ze,[G]:{id:G,runNodeId:x,label:Q,plannedNodeIds:we,startedAt:Date.now()}})),rl(Ze=>new Set([...Ze,x])),sl(Ze=>({...Ze,[x]:{status:"running"}})),he(`Running ${le}...`),fs(G),Hn(Ze=>[...Ze.slice(-7),{id:G,label:le,alias:Q,runNodeId:x,status:"running",startedAt:Date.now(),steps:[],messages:[{role:"assistant",kind:"run-summary",text:"准备运行...",at:Date.now()}]}]);let _e=x;const $e=new Map,De=()=>zc.current.has(G),Oe=Ze=>{const Ye=new Set((Ze||[]).map(Ie=>String(Ie||"").trim()).filter(Boolean));Ye.size||Ye.add(String(x||"")),rl(Ie=>{const Ot=new Set(Ie);for(const et of Ye)Ot.delete(et);return Ot})},It=(Ze,Ye)=>{const Ie=new Set((Ze||[]).map(Ot=>String(Ot||"").trim()).filter(Boolean));Ie.size||Ie.add(String(x||"")),sl(Ot=>{var pt;const et={...Ot};for(const zt of Ie)zt&&(!et[zt]||((pt=et[zt])==null?void 0:pt.status)==="running")&&(et[zt]={status:Ye});return et})};try{await Yt(E,P);const Ze=J1(E,O,x,Ei),Ye=await fetch("/api/workspace/run",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/x-ndjson"},signal:Qe.signal,body:JSON.stringify({...i,graph:Y,runNodeId:x,runAlias:Q,runSessionId:G,expectedRevision:ae.current,clientId:de.current,model:Ze,selectedSkills:_s,stream:!0})});if(!Ye.ok){const me=await Ye.json().catch(()=>({}));throw new Error(me.error||"Workspace run failed")}if(!Ye.body)throw new Error("Workspace run stream unavailable");const Ie=Ye.body.getReader(),Ot=new TextDecoder;let et="",pt=[],zt=[];const bg=(me,Xe)=>{var st,Ct;const Ve=h.find(Mt=>Mt.id===me),at=String(((st=Ve==null?void 0:Ve.data)==null?void 0:st.label)||me||"").trim(),ye=String(Xe||((Ct=Ve==null?void 0:Ve.data)==null?void 0:Ct.definitionId)||"").trim();return ye&&ye!==at?`${at} (${ye})`:at},Gc=(me,Xe,Ve)=>{const at=String(me||"").trim();at&&Hn(ye=>ye.map(st=>{if(st.id!==G)return st;const Mt=[...Array.isArray(st.steps)?st.steps:[]],lt=Mt.findIndex(an=>an.id===at),kt={id:at,label:bg(at,Xe),status:Ve};lt>=0?Mt[lt]={...Mt[lt],...kt}:Mt.push(kt);const sn=Mt.map((an,uo)=>{const Ti=an.status==="done"?"[done]":an.status==="failed"?"[failed]":"[running]";return`${uo+1}. ${Ti} ${an.label}`}).join(`
|
|
252
|
-
`),Bt=Array.isArray(st.messages)?st.messages:[],Xt=Bt.findIndex(an=>an.kind==="run-summary"),hn={role:"assistant",kind:"run-summary",text:sn||"准备运行...",at:Date.now()},$t=[...Bt];return Xt>=0?$t[Xt]=hn:$t.unshift(hn),{...st,steps:Mt,messages:$t.slice(-160)}}))},kg=(me,Xe)=>{var DS,FS,zS,BS,HS,WS,VS,KS,US,qS;const Ve=String(me||"").trim(),at=String(Xe||"").trim();if(!Ve||!at)return;const ye=(DS=z.current)==null?void 0:DS[Ve];if(!Ys(ye==null?void 0:ye.definitionId))return;const st=Vo(ye==null?void 0:ye.input,"displayType","markdown"),Ct=nT(st),Mt=rT(Ve),lt=Te.find(jr=>jr.id===Ct),kt=U1(lt==null?void 0:lt.inputs,Ct,at),sn=U1(lt==null?void 0:lt.outputs,Ct,at),Bt=String((ye==null?void 0:ye.label)||Ve||"一键任务").trim(),Xt={...z.current||{},[Ve]:{...ye||{},output:Y1(ye==null?void 0:ye.output)},[Mt]:{...((FS=z.current)==null?void 0:FS[Mt])||{},definitionId:Ct,label:Bt,role:"normal",body:at,input:kt,output:sn,sourceContextRunNodeId:Ve,displayReloadKey:String(Date.now())}};z.current=Xt,X(Xt);const hn=y.current||[],$t=hn.find(jr=>jr.id===Ve),an=hn.find(jr=>jr.id===Mt),uo=Number(((zS=$t==null?void 0:$t.measured)==null?void 0:zS.width)||($t==null?void 0:$t.width)||((HS=(BS=$t==null?void 0:$t.data)==null?void 0:BS.nodeSize)==null?void 0:HS.width)||520),Ti=(an==null?void 0:an.position)||{x:Number(((WS=$t==null?void 0:$t.position)==null?void 0:WS.x)||0)+uo+120,y:Number(((VS=$t==null?void 0:$t.position)==null?void 0:VS.y)||0)},er=((KS=an==null?void 0:an.data)==null?void 0:KS.displaySize)||((US=an==null?void 0:an.data)==null?void 0:US.nodeSize)||{width:Cw,height:_w},ni=jw({id:Mt,type:Jl,position:Ti,width:Number(er.width)||Cw,height:Number(er.height)||_w,data:{label:Bt,definitionId:Ct,role:"normal",body:at,inputs:kt,outputs:sn,sourceContextRunNodeId:Ve,displayReloadKey:Xt[Mt].displayReloadKey,nodeSize:er,displaySize:er}},Xt,Te),fo=hn.map(jr=>{if(jr.id===Ve){const{width:gae,height:yae,measured:xae,...j$}=jr,{nodeSize:wae,displaySize:bae,...Cf}=jr.data||{};return{...j$,data:{...Cf,outputs:Y1(Cf==null?void 0:Cf.outputs),contextRunResultNonce:Date.now()}}}return jr.id===Mt?{...ni,selected:jr.selected}:jr});an||fo.push(ni),y.current=fo,g(fo);const po=v.current||[],jf=sT(Ct),Sg=q1((ye==null?void 0:ye.output)||((qS=$t==null?void 0:$t.data)==null?void 0:qS.outputs),"output",["content","result"],["text"]),S$=q1(kt,"input",[jf,"content"],["text"]),N$={id:`we-${Ve}-${Mt}`,source:Ve,target:Mt,sourceHandle:Sg,targetHandle:S$,markerEnd:{type:fi.ArrowClosed}},OS=[...po.filter(jr=>!(jr.source===Ve&&jr.target===Mt)),N$];v.current=OS,w(OS),window.requestAnimationFrame(()=>{s(Ve),s(Mt)})},kf=(me,Xe=null)=>{const Ve=me!=null&&me.instances&&typeof me.instances=="object"?me.instances:{},at=Xe instanceof Set?Xe:null;for(const[ye,st]of Object.entries(Ve)){if(at&&!at.has(ye)||!Ys(st==null?void 0:st.definitionId))continue;const Ct=$m({outputs:st.output});Ct&&kg(ye,Ct)}},TS=me=>{const Xe=String(me||"").trim();if(!Xe)return;const Ve=_e;_e=Xe,rl(at=>{const ye=new Set(at);return Ve&&Ve!==Xe&&Ve!==x&&ye.delete(Ve),x&&ye.add(x),ye.add(Xe),ye}),sl(at=>{var ye;return{...at,...Ve&&Ve!==Xe&&Ve!==x&&((ye=at[Ve])==null?void 0:ye.status)==="running"?{[Ve]:{status:"success"}}:{},...x?{[x]:{status:"running"}}:{},[Xe]:{status:"running"}}})},MS=me=>{const Xe=String(me||"").trim();Xe&&(rl(Ve=>{const at=new Set(Ve);return at.delete(Xe),at}),sl(Ve=>({...Ve,[Xe]:{status:"success"}})))},$S=(me,Xe)=>{const Ve=String(Xe||"");if(!Ve.trim())return;const at=["assistant","thinking","result","error","prompt"].includes(me)?me:"assistant";Hn(ye=>ye.map(st=>{if(st.id!==G)return st;let Ct=Array.isArray(st.messages)?st.messages:[];if(at==="result"){const kt=[...Ct].reverse().find(sn=>sn.kind==="assistant");if(String((kt==null?void 0:kt.text)||"").trim()===Ve.trim())return st}if(at==="assistant"){const kt=Ct.findIndex(sn=>sn.kind==="result"&&String(sn.text||"").trim()===Ve.trim());kt>=0&&(Ct=Ct.filter((sn,Bt)=>Bt!==kt))}const Mt=[...Ct],lt=Mt[Mt.length-1];return lt&<.kind===at&&!lt.error?Mt[Mt.length-1]={...lt,text:`${lt.text||""}${lt.text?`
|
|
253
|
-
`:""}${Ve}`}:Mt.push({role:"assistant",kind:at,text:Ve,...at==="error"?{error:!0}:{},at:Date.now()}),{...st,messages:Mt.slice(-160)}}))},vf=me=>{const Xe=String(me||"");Xe.trim()&&Hn(Ve=>Ve.map(at=>{var Mt;if(at.id!==G)return at;const ye=Array.isArray(at.messages)?at.messages:[],st=ye.findIndex(lt=>lt.kind==="thinking"),Ct=[...ye];if(st>=0){const lt=String(((Mt=Ct[st])==null?void 0:Mt.text)||"");Ct[st]={...Ct[st],text:`${lt}${lt&&!lt.endsWith(`
|
|
254
|
-
`),""}${Xe}`,at:Date.now()}}else{const lt=Ct.findIndex(kt=>kt.kind==="activity");Ct.splice(lt>=0?lt+1:Ct.length,0,{role:"assistant",kind:"thinking",text:Xe,at:Date.now()})}return{...at,messages:Ct.slice(-160)}}))},co=(me,Xe=null)=>{const Ve=QU(me);Ve&&Hn(at=>at.map(ye=>{if(ye.id!==G)return ye;const st=Number(Xe==null?void 0:Xe.ts)||Date.now(),Ct=Number(ye.startedAt)||st,Mt=Number(ye.lastActivityAt)||Ct,lt=Math.max(0,st-Mt),kt=Number.isFinite(Number(Xe==null?void 0:Xe.runElapsedMs))?Math.max(0,Number(Xe.runElapsedMs)):Math.max(0,st-Ct),sn=Array.isArray(ye.activities)?ye.activities:[],Bt=sn[sn.length-1],hn=(typeof Bt=="string"?Bt:String((Bt==null?void 0:Bt.text)||""))===Ve?sn:[...sn,{text:Ve,kind:eq(Ve),stepMs:lt,totalMs:kt,at:st}].slice(-30),$t=Array.isArray(ye.timingEntries)?ye.timingEntries:[],an=Array.isArray(ye.messages)?ye.messages:[],uo=an.findIndex(ni=>ni.kind==="activity"),Ti={role:"assistant",kind:"activity",text:A1(hn,$t,Ct,st),at:Date.now()},er=[...an];if(uo>=0)er[uo]=Ti;else{const ni=er.findIndex(fo=>fo.kind==="run-summary");er.splice(ni>=0?ni+1:0,0,Ti)}return{...ye,activities:hn,lastActivityAt:st,messages:er.slice(-160)}}))},LS=me=>{const Xe=String((me==null?void 0:me.source)||"runner"),Ve=String((me==null?void 0:me.stream)||""),at=String((me==null?void 0:me.eventType)||"event"),ye=String((me==null?void 0:me.text)||"").trim();if(!ye)return;const st=`[${Xe}${Ve?`:${Ve}`:""}] ${at}
|
|
255
|
-
${ye}`,Ct=Pq(me);Hn(Mt=>Mt.map(lt=>{if(lt.id!==G)return lt;const sn=[...Array.isArray(lt.rawTrace)?lt.rawTrace:[],st].slice(-80),Bt=Array.isArray(lt.timingEntries)?lt.timingEntries:[],Xt=Ct?[...Bt,Ct].slice(-80):Bt,hn=Array.isArray(lt.activities)?lt.activities:[],$t=Number(lt.startedAt)||Number(me==null?void 0:me.ts)||Date.now(),an=Number(Ct==null?void 0:Ct.at)||Number(me==null?void 0:me.ts)||Date.now(),uo=Array.isArray(lt.messages)?lt.messages:[],Ti={role:"assistant",kind:"raw",text:sn.join(`
|
|
256
|
-
|
|
257
|
-
---
|
|
258
|
-
|
|
259
|
-
`),at:Date.now()},er=[...uo],ni=er.findIndex(po=>po.kind==="activity");if(Ct){const po={role:"assistant",kind:"activity",text:A1(hn,Xt,$t,an),at:Date.now()};if(ni>=0)er[ni]=po;else{const jf=er.findIndex(Sg=>Sg.kind==="run-summary");er.splice(jf>=0?jf+1:0,0,po)}}const fo=er.findIndex(po=>po.kind==="raw");return fo>=0?er[fo]=Ti:er.push(Ti),{...lt,rawTrace:sn,timingEntries:Xt,messages:er.slice(-160)}}))},v$=me=>{Hn(Xe=>Xe.map(Ve=>Ve.id===G?{...Ve,status:me,endedAt:Date.now()}:Ve))},Sf=me=>{const Xe=new Set,Ve=String((me==null?void 0:me.nodeId)||"").trim();Ve&&Xe.add(Ve);for(const at of Array.isArray(me==null?void 0:me.displayNodeIds)?me.displayNodeIds:[]){const ye=String(at||"").trim();ye&&Xe.add(ye)}for(const at of Array.isArray(me==null?void 0:me.touchedNodeIds)?me.touchedNodeIds:[]){const ye=String(at||"").trim();ye&&Xe.add(ye)}if(Xe.size===0)for(const at of Array.isArray(me==null?void 0:me.order)?me.order:[]){const ye=String(at||"").trim();ye&&Xe.add(ye)}return Xe},Nf=(me,Xe=null)=>{const Ve=cu(me||Y,Te),at=new Map(Ve.nodes.map(lt=>[lt.id,lt])),ye=Ve.instances||{},st=Xe instanceof Set?Xe:null,Ct=(lt,kt)=>{const sn={...lt||kt};Array.isArray(kt==null?void 0:kt.output)&&(sn.output=kt.output);for(const Bt of["scriptRef","implementationRef","implementationMode"])(kt==null?void 0:kt[Bt])!=null&&String(kt[Bt]).trim()!==""&&(sn[Bt]=kt[Bt]);return sn},Mt=(lt,kt)=>{const sn={...lt||{}};Array.isArray(kt==null?void 0:kt.outputs)&&(sn.outputs=kt.outputs);for(const Bt of["scriptRef","implementationRef","implementationMode"])(kt==null?void 0:kt[Bt])!=null&&String(kt[Bt]).trim()!==""&&(sn[Bt]=kt[Bt]);return sn};g(lt=>{const kt=new Set(lt.map(Xt=>Xt.id)),Bt={...yl(lt,v.current,z.current).instances||{}};for(const[Xt,hn]of Object.entries(ye)){if(st&&!st.has(Xt)||!kt.has(Xt))continue;const $t=Bt[Xt];Ha((hn==null?void 0:hn.definitionId)||($t==null?void 0:$t.definitionId))?Bt[Xt]=hn:Array.isArray(hn==null?void 0:hn.output)&&(Bt[Xt]=Ct($t,hn))}return z.current=Bt,X(Bt),lt.map(Xt=>{var $t,an;if(st&&!st.has(Xt.id))return Xt;const hn=at.get(Xt.id);return hn?Ha((($t=hn.data)==null?void 0:$t.definitionId)||((an=Xt.data)==null?void 0:an.definitionId))?{...Xt,data:{...Xt.data,...hn.data}}:{...Xt,data:Mt(Xt.data,hn.data)}:Xt})})};for(;;){const{value:me,done:Xe}=await Ie.read();if(Xe)break;et+=Ot.decode(me,{stream:!0});const Ve=et.split(`
|
|
260
|
-
`);et=Ve.pop()||"";for(const at of Ve){if(!at.trim())continue;const ye=JSON.parse(at);if(ye.type==="error")throw new Error(ye.error||"Workspace run failed");if(ye.type==="stopped"){zc.current.add(G),pt=Array.isArray(ye.order)?ye.order:pt,co("运行停止",ye);continue}if(ye.type==="node-start"&&(he(`Running ${ye.nodeId}...`),TS(ye.nodeId),Gc(ye.nodeId,ye.definitionId,"running")),ye.type==="node-done"){const st=$e.get(String(ye.nodeId||"").trim());st&&kg(ye.nodeId,st),MS(ye.nodeId),Gc(ye.nodeId,ye.definitionId,"done")}if(ye.type==="status"&&co(ye.line||ye.message||"",ye),ye.type==="paused"&&(zt=Array.isArray(ye.nodeIds)?ye.nodeIds:[],co("运行暂停",ye)),ye.type==="natural"&&((ye.kind==="result"||/---agentflow\b|resultFile\s*:|\"resultFile\"\s*:|\"result\"\s*:/i.test(String(ye.text||"")))&&ye.nodeId&&$e.set(String(ye.nodeId||"").trim(),String(ye.text||"")),ye.kind==="thinking"?vf(ye.text||""):$S(ye.kind,ye.text||"")),ye.type==="raw"){const st=P1(ye);st&&vf(st),LS(ye)}if(ye.type==="graph"&&ye.graph){const st=Sf(ye);Nf(ye.graph,st),kf(ye.graph,st)}if(ye.type==="done"){if(ye.revision&&(ae.current=String(ye.revision)),ye.graph){J.current=ye.graph;const st=Sf(ye);Nf(ye.graph,st),kf(ye.graph,st)}pt=Array.isArray(ye.order)?ye.order:[],zt=Array.isArray(ye.pauseNodeIds)?ye.pauseNodeIds:zt,co(zt.length?"运行暂停":"运行完成",ye)}}}if(et.trim()){const me=JSON.parse(et);if(me.type==="error")throw new Error(me.error||"Workspace run failed");if(me.type==="stopped"&&(zc.current.add(G),co("运行停止",me)),me.type==="node-start"&&(he(`Running ${me.nodeId}...`),TS(me.nodeId),Gc(me.nodeId,me.definitionId,"running")),me.type==="node-done"){const Xe=$e.get(String(me.nodeId||"").trim());Xe&&kg(me.nodeId,Xe),MS(me.nodeId),Gc(me.nodeId,me.definitionId,"done")}if(me.type==="status"&&co(me.line||me.message||"",me),me.type==="paused"&&(zt=Array.isArray(me.nodeIds)?me.nodeIds:[],co("运行暂停",me)),me.type==="natural"&&((me.kind==="result"||/---agentflow\b|resultFile\s*:|\"resultFile\"\s*:|\"result\"\s*:/i.test(String(me.text||"")))&&me.nodeId&&$e.set(String(me.nodeId||"").trim(),String(me.text||"")),me.kind==="thinking"?vf(me.text||""):$S(me.kind,me.text||"")),me.type==="raw"){const Xe=P1(me);Xe&&vf(Xe),LS(me)}if(me.type==="graph"&&me.graph){const Xe=Sf(me);Nf(me.graph,Xe),kf(me.graph,Xe)}if(me.type==="done"){if(me.revision&&(ae.current=String(me.revision)),me.graph){J.current=me.graph;const Xe=Sf(me);Nf(me.graph,Xe),kf(me.graph,Xe)}pt=Array.isArray(me.order)?me.order:[],zt=Array.isArray(me.pauseNodeIds)?me.pauseNodeIds:zt,co(zt.length?"运行暂停":"运行完成",me)}}De()&&(Oe(we),It(we,"stopped"));const vg=De()?`Workspace run stopped: ${x}`:zt.length?`Workspace run paused at ${zt.join(", ")}`:`Workspace run done: ${pt.length?pt.join(" -> "):x}`;if(he(vg),De()||It(we,zt.length?"paused":"success"),v$(De()?"stopped":zt.length?"paused":"done"),!De()){try{await Yt(y.current,v.current),he(vg)}catch(me){he(`${vg},但保存结果失败:${String(me.message||me)}`)}await Nn()}}catch(Ze){if(De()||(Ze==null?void 0:Ze.name)==="AbortError"){Oe(we),It(we,"stopped"),he(`Workspace run stopped: ${x}`),Hn(Ye=>Ye.map(Ie=>Ie.id===G?{...Ie,status:"stopped",endedAt:Date.now()}:Ie));return}Oe(we),It([x,_e].filter(Boolean),"failed"),he(String(Ze.message||Ze)),Hn(Ye=>Ye.map(Ie=>Ie.id===G?{...Ie,status:"failed",endedAt:Date.now(),messages:[...Array.isArray(Ie.messages)?Ie.messages:[],{role:"assistant",error:!0,text:String(Ze.message||Ze),at:Date.now()}].slice(-160)}:Ie))}finally{Fc.current.get(G)===Qe&&Fc.current.delete(G),Pi(Ze=>{const Ye={...Ze};return delete Ye[G],Ye}),zc.current.delete(G),Oe(we)}},[Ei,k,i,Nn,h,Te,oo,Yt,_s,w,g,Pi,s,oe]),lf=m.useCallback(async()=>{try{const S=await(await fetch("/api/skills")).json().catch(()=>({})),E=Array.isArray(S.skills)?S.skills.map(P=>({key:String(P.key),name:String(P.name||P.id||P.key),description:P.description?String(P.description):"",sourceLabel:P.sourceLabel?String(P.sourceLabel):""})):[];oM(E),lv(!0)}catch{lv(!0)}},[]),cf=m.useCallback(async()=>{try{const S=await(await fetch("/api/mcps")).json().catch(()=>({})),E=Array.isArray(S.servers)?S.servers.map(P=>({name:String((P==null?void 0:P.name)||""),type:String((P==null?void 0:P.type)||""),url:String((P==null?void 0:P.url)||""),command:String((P==null?void 0:P.command)||""),args:Array.isArray(P==null?void 0:P.args)?P.args.map(String):[],description:String((P==null?void 0:P.description)||"")})).filter(P=>P.name):[];dv(E)}catch{dv([])}},[]),uf=m.useCallback(async()=>{try{const x=Cr(i),E=await(await fetch(`/api/workspaces?${x.toString()}`)).json().catch(()=>({})),P=Array.isArray(E.workspaces)?E.workspaces.map(O=>({id:String((O==null?void 0:O.id)||""),label:String((O==null?void 0:O.label)||(O==null?void 0:O.name)||"知识库"),path:String((O==null?void 0:O.path)||""),kind:(O==null?void 0:O.kind)==="git"?"git":"local",repoUrl:String((O==null?void 0:O.repoUrl)||""),branch:String((O==null?void 0:O.branch)||""),mountPath:String((O==null?void 0:O.mountPath)||""),type:String((O==null?void 0:O.type)||""),builtin:(O==null?void 0:O.builtin)===!0,exists:(O==null?void 0:O.exists)!==!1})).filter(O=>O.path):[];pv(P)}catch{pv([])}},[i]),Gv=m.useCallback(async()=>{xe.current=!1;try{const x=Cr(i),S=await fetch(`/api/workspace/conversations?${x.toString()}`),E=await S.json().catch(()=>({}));if(!S.ok)throw new Error(E.error||`HTTP ${S.status}`);const P=S1(E.conversations||{});Za(P.composer.messages),Hn(P.composer.runSessions),fs(P.composer.activeSessionId||"workspace"),ao(P.nodeChats)}catch{Za([]),Hn([]),fs("workspace"),ao({})}finally{xe.current=!0}},[i]),Jv=m.useCallback(async()=>{if(!oe||i.archived)return;const x=S1({composer:{activeSessionId:$r,messages:na,runSessions:Es},nodeChats:ra});await fetch("/api/workspace/conversations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,conversations:x})}).then(async S=>{if(!S.ok){const E=await S.json().catch(()=>({}));throw new Error(E.error||`HTTP ${S.status}`)}})},[$r,na,Es,i,ra,oe]);m.useEffect(()=>{let x=!1;return(async()=>{const E=new URL(window.location.href),P=String(E.searchParams.get("invite")||"").trim();if(P){he("正在加入共享 Workspace...");const O=await fetch("/api/workspace/collaboration/accept",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:P})}),q=await O.json().catch(()=>({}));if(!O.ok)throw new Error(q.error||"加入共享 Workspace 失败");E.searchParams.delete("invite"),window.history.replaceState({},"",`${E.pathname}${E.search}${E.hash}`)}x||(await Xr(),x||await Gv())})().catch(E=>{const P=String(E.message||E);he(P),As("error"),Ps(P)}),rf(),fetch("/api/model-lists").then(E=>E.json()).then(E=>sM({cursor:Array.isArray(E.cursor)?E.cursor.map(String):[],opencode:Array.isArray(E.opencode)?E.opencode.map(String):[],claudeCode:Array.isArray(E.claudeCode)?E.claudeCode.map(String):[],codex:Array.isArray(E.codex)?E.codex.map(String):[]})).catch(()=>{}),lf(),cf(),uf(),af(),fetch("/api/skill-collections").then(E=>E.json()).then(E=>{aM(Sa(E)),lM(!0)}).catch(()=>{}),fetch("/api/auth/me").then(E=>E.json()).then(E=>{Cv(E.user||null),Ev(!0)}).catch(()=>{Cv(null),Ev(!0)}),()=>{x=!0}},[Xr,Gv,rf,cf,lf,af,uf,Ai]),m.useEffect(()=>{if(Fv(""),!(!av||!cv)){if(!Ai){Rc([]);return}Rc(gD(Ai,"workspace",Cs,Xa)),Fv(Ai)}},[Xa,cv,Cs,av,Ai]),m.useEffect(()=>{if(!(Dv!==Ai||!Ai))try{localStorage.setItem(Ai,JSON.stringify(_s))}catch{}},[_s,Ai,Dv]),m.useEffect(()=>{z.current=_},[_]),m.useEffect(()=>{y.current=h},[h]),m.useEffect(()=>{const x=L.current,S=new Map,E=[];for(const Y of h){const G=DR(Y);S.set(Y.id,G),x.get(Y.id)!==G&&E.push(Y.id)}if(L.current=S,E.length===0)return;const P=()=>E.forEach(Y=>s(Y)),O=window.requestAnimationFrame(P),q=window.setTimeout(P,80);return()=>{window.cancelAnimationFrame(O),window.clearTimeout(q)}},[h,s]),m.useEffect(()=>{v.current=k},[k]),m.useEffect(()=>{j.current=C},[C]),m.useEffect(()=>{D.current=A},[A]),m.useEffect(()=>{Kt.current=Se},[Se]),m.useEffect(()=>{Pe.current=ie},[ie]),m.useEffect(()=>{$.current=R},[R]),m.useEffect(()=>{if(!R)return;const x=E=>{E.key==="Escape"&&B(null)},S=E=>{var P,O;(O=(P=E.target)==null?void 0:P.closest)!=null&&O.call(P,".af-connect-node-menu")||B(null)};return document.addEventListener("keydown",x),document.addEventListener("pointerdown",S),()=>{document.removeEventListener("keydown",x),document.removeEventListener("pointerdown",S)}},[R]),m.useEffect(()=>{if(T.current&&oe){if(ue.current){ue.current=!1;return}return Is(),Z.current&&window.clearTimeout(Z.current),Z.current=window.setTimeout(()=>{Yt().catch(x=>he(String(x.message||x)))},650),()=>{Z.current&&window.clearTimeout(Z.current)}}},[h,k,C,Is,Yt,oe]),m.useEffect(()=>{if(xe.current&&!(!oe||i.archived))return ze.current&&window.clearTimeout(ze.current),ze.current=window.setTimeout(()=>{Jv().catch(x=>he(String(x.message||x)))},900),()=>{ze.current&&window.clearTimeout(ze.current)}},[$r,na,Es,i.archived,ra,Jv,oe]);const Wc=m.useMemo(()=>h.filter(x=>{var S;return((S=x==null?void 0:x.data)==null?void 0:S.definitionId)==="workspace_scheduled_run"}).map(x=>{var S;return{id:x.id,config:Tk(((S=x.data)==null?void 0:S.body)||"")}}),[h]),_M=m.useMemo(()=>Wc.map(x=>`${x.id}:${x.config.enabled?"1":"0"}:${x.config.cron}:${x.config.timezone}`).join("|"),[Wc]);m.useEffect(()=>{if(!T.current||l!=="workspace"||!i.flowId){sa({});return}if(!Wc.length){sa({});return}let x=!1;const S=async()=>{try{const P=Cr(i),O=await fetch(`/api/workspace/schedules?${P.toString()}`),q=await O.json().catch(()=>({}));if(!O.ok)throw new Error(q.error||"读取 Workspace 定时状态失败");x||sa(cp(q.schedules||[]))}catch{x||sa(P=>{var q;const O={};for(const Y of Wc)O[Y.id]={...P[Y.id]||{},lastStatus:((q=P[Y.id])==null?void 0:q.lastStatus)||"unknown"};return O})}};S();const E=window.setInterval(S,5e3);return()=>{x=!0,window.clearInterval(E)}},[i,Wc,_M,l]);const Xv=m.useCallback((x,S)=>{if(!oe){he("Readonly workspace");return}const E=K1(S),P=Q=>Array.isArray(Q)?Q.map(le=>(le==null?void 0:le.name)!=="skillKeys"&&(le==null?void 0:le.name)!=="skillsContext"&&(le==null?void 0:le.type)!=="text"?le:{...le,default:E,value:E}):[],O=h.map(Q=>{var le;return Q.id!==x?Q:{...Q,data:{...Q.data,body:E,inputs:P((le=Q.data)==null?void 0:le.inputs)}}}),q=z.current||{},Y=q[x]&&typeof q[x]=="object"?q[x]:{},G={...q,[x]:{...Y,body:E,input:P(Y.input)}};z.current=G,g(O),X(G),xt(Q=>!Q||Q.id!==x?Q:{...Q,body:E,inputs:P(Q.inputs)}),Yt(O,k).catch(Q=>he(String(Q.message||Q)))},[k,h,Yt,g,oe]),Qv=m.useCallback((x,S)=>{if(!oe){he("Readonly workspace");return}const E=DY(S),P=Q=>Array.isArray(Q)?Q.map(le=>(le==null?void 0:le.name)!=="serverNames"&&(le==null?void 0:le.name)!=="mcpContext"&&(le==null?void 0:le.type)!=="text"?le:{...le,default:E,value:E}):[],O=h.map(Q=>{var le;return Q.id!==x?Q:{...Q,data:{...Q.data,body:E,inputs:P((le=Q.data)==null?void 0:le.inputs)}}}),q=z.current||{},Y=q[x]&&typeof q[x]=="object"?q[x]:{},G={...q,[x]:{...Y,body:E,input:P(Y.input)}};z.current=G,g(O),X(G),xt(Q=>!Q||Q.id!==x?Q:{...Q,body:E,inputs:P(Q.inputs)}),Yt(O,k).catch(Q=>he(String(Q.message||Q)))},[k,h,Yt,g,oe]),Zv=m.useCallback((x,S)=>{if(!oe){he("Readonly workspace");return}const E=(Array.isArray(S)?S:S?[S]:[]).filter(_e=>String((_e==null?void 0:_e.path)||"").trim()),P=E[0]||null,O=String((P==null?void 0:P.path)||"").trim(),q=E.length===1?String((P==null?void 0:P.label)||(P==null?void 0:P.id)||"知识库").trim():E.length?`${E.length} 个知识库`:"",Y=E.length?JSON.stringify(Lm(E)):"",G=P?JSON.stringify({version:1,id:(P==null?void 0:P.id)||"",label:String((P==null?void 0:P.label)||(P==null?void 0:P.id)||"知识库").trim(),kind:(P==null?void 0:P.kind)||"local",cwd:O,workspaceRoot:O,repoUrl:(P==null?void 0:P.repoUrl)||"",branch:(P==null?void 0:P.branch)||"",mountPath:(P==null?void 0:P.mountPath)||"",type:(P==null?void 0:P.type)||""}):"",Q=_e=>Array.isArray(_e)?_e.map($e=>($e==null?void 0:$e.name)==="path"?{...$e,default:O,value:O}:($e==null?void 0:$e.name)==="label"?{...$e,default:q,value:q}:($e==null?void 0:$e.name)==="knowledgeContext"?{...$e,default:Y,value:Y}:($e==null?void 0:$e.name)==="workspaceContext"?{...$e,default:G,value:G}:($e==null?void 0:$e.name)==="mode"?{...$e,default:"set",value:"set"}:$e):[],le=_e=>Array.isArray(_e)?_e.map($e=>($e==null?void 0:$e.name)==="knowledgeContext"?{...$e,default:Y,value:Y}:($e==null?void 0:$e.name)==="workspaceContext"?{...$e,default:G,value:G,showOnNode:!1}:($e==null?void 0:$e.name)==="cwd"?{...$e,default:O,value:O,showOnNode:!1}:$e):[],we=h.map(_e=>{var $e,De,Oe;return _e.id===x?{..._e,data:{..._e.data,label:(($e=_e.data)==null?void 0:$e.label)||"加载知识库",inputs:Q((De=_e.data)==null?void 0:De.inputs),outputs:le((Oe=_e.data)==null?void 0:Oe.outputs)}}:_e}),pe=z.current||{},Ae=pe[x]&&typeof pe[x]=="object"?pe[x]:{},Qe={...pe,[x]:{...Ae,label:Ae.label||"加载知识库",input:Q(Ae.input),output:le(Ae.output)}};z.current=Qe,g(we),X(Qe),xt(_e=>(_e==null?void 0:_e.id)===x?{..._e,inputs:Q(_e.inputs),outputs:le(_e.outputs)}:_e),Yt(we,k).catch(_e=>he(String(_e.message||_e)))},[k,h,Yt,g,oe]),eS=m.useCallback((x,S)=>{if(!oe){he("Readonly workspace");return}const E=String(x||"");if(!E)return;const P=K1((S==null?void 0:S.skillKeys)||[]),O=Vd((S==null?void 0:S.displayType)||"markdown"),q=String((S==null?void 0:S.model)||"").trim(),Y=(S==null?void 0:S.includeWorkspaceContext)===!1?"false":"true",G=S!=null&&S.workspaceContext&&typeof S.workspaceContext=="object"?JSON.stringify(S.workspaceContext):"",Q=S!=null&&S.knowledgeContext&&typeof S.knowledgeContext=="object"?JSON.stringify(S.knowledgeContext):"",le=De=>Array.isArray(De)?De.map(Oe=>(Oe==null?void 0:Oe.name)==="skillKeys"?{...Oe,default:P,value:P}:(Oe==null?void 0:Oe.name)==="displayType"?{...Oe,default:O,value:O}:(Oe==null?void 0:Oe.name)==="includeWorkspaceContext"?{...Oe,default:Y,value:Y}:(Oe==null?void 0:Oe.name)==="knowledgeContext"?{...Oe,default:Q,value:Q}:(Oe==null?void 0:Oe.name)==="workspaceContext"?{...Oe,default:G,value:G}:Oe):[],we=De=>Array.isArray(De)?De.map(Oe=>(Oe==null?void 0:Oe.name)==="displayType"?{...Oe,default:O,value:O}:Oe):[],pe=String((S==null?void 0:S.task)??""),Ae=h.map(De=>{var Oe,It;return De.id===E?{...De,data:{...De.data,body:pe,model:q,inputs:le((Oe=De.data)==null?void 0:Oe.inputs),outputs:we((It=De.data)==null?void 0:It.outputs)}}:De}),Qe=z.current||{},_e=Qe[E]&&typeof Qe[E]=="object"?Qe[E]:{},$e={...Qe,[E]:{..._e,body:pe,model:q,input:le(_e.input),output:we(_e.output)}};z.current=$e,g(Ae),X($e),xt(De=>(De==null?void 0:De.id)===E?{...De,body:pe,model:q,inputs:le(De.inputs),outputs:we(De.outputs)}:De),Yt(Ae,k).catch(De=>he(String(De.message||De)))},[k,h,Yt,g,oe]),tS=m.useCallback((x,S)=>{if(!oe){he("Readonly workspace");return}const E=zq(S),P=h.map(G=>G.id===x?{...G,data:{...G.data,body:E}}:G),O=z.current||{},q=O[x]&&typeof O[x]=="object"?O[x]:{},Y={...O,[x]:{...q,body:E}};z.current=Y,g(P),X(Y),xt(G=>(G==null?void 0:G.id)===x?{...G,body:E}:G),Yt(P,k).catch(G=>he(String(G.message||G)))},[k,h,Yt,g,oe]),nS=m.useCallback(x=>{const S=String(x||"").trim();S&&(jv(E=>E===S?"":S),ao(E=>({...E,[S]:E[S]||{sessionId:`nodechat_${Date.now()}_${S.replace(/[^a-z0-9_-]+/gi,"_")}`,messages:[],draft:"",candidateContent:"",running:!1,error:""}})))},[]),rS=m.useCallback(()=>jv(""),[]),sS=m.useCallback((x,S)=>{const E=String(x||"").trim();E&&ao(P=>({...P,[E]:{...P[E]||{sessionId:`nodechat_${Date.now()}_${E.replace(/[^a-z0-9_-]+/gi,"_")}`,messages:[]},draft:String(S||""),error:""}}))},[]),Rs=m.useCallback((x,S,E="replace",P={})=>{var Ze,Ye;if(!oe){he("Readonly workspace");return}const O=String(x||"").trim();if(!O)return;const q=y.current.find(Ie=>Ie.id===O),Y=jn(q==null?void 0:q.data),G=Ys((Ze=q==null?void 0:q.data)==null?void 0:Ze.definitionId),Q=wi(S),le=Y==="html"?vc(Q):Y==="react"?Tm(Q):String(Q||""),we=q?Yi(q.data):"",pe=E==="append"&&String(we||"").trim()?`${String(we).replace(/\s+$/g,"")}
|
|
261
|
-
|
|
262
|
-
${le.trim()}`:le,Ae=Y==="image"?"src":"content",Qe=P!=null&&P.reloadDisplay?Date.now():(Ye=q==null?void 0:q.data)==null?void 0:Ye.displayReloadKey,_e=Ie=>{let Ot=!1;return(Array.isArray(Ie)?Ie:[]).map(pt=>{const zt=String((pt==null?void 0:pt.name)||""),bg=String((pt==null?void 0:pt.type)||"");return(G?zt===Ae||zt==="result"||zt==="filePath":zt===Ae||zt==="filePath"||bg==="text")?Ot?{...pt,default:"",value:""}:(Ot=!0,{...pt,default:pe,value:pe}):pt})},$e=y.current.map(Ie=>{var Ot,et;return Ie.id!==O?Ie:{...Ie,data:{...Ie.data,body:G?Ie.data.body:pe,...Qe?{displayReloadKey:Qe}:{},inputs:_e((Ot=Ie.data)==null?void 0:Ot.inputs),outputs:_e((et=Ie.data)==null?void 0:et.outputs)}}}),De=z.current||{},Oe=De[O]&&typeof De[O]=="object"?De[O]:{},It={...De,[O]:{...Oe,body:G?Oe.body:pe,input:_e(Oe.input),output:_e(Oe.output)}};z.current=It,g($e),X(It),xt(Ie=>(Ie==null?void 0:Ie.id)===O?{...Ie,...G?{}:{body:pe}}:Ie),(P==null?void 0:P.logChat)!==!1&&ao(Ie=>{var Ot;return{...Ie,[O]:{...Ie[O]||{},candidateContent:"",messages:[...(Ot=Ie[O])!=null&&Ot.messages&&Array.isArray(Ie[O].messages)?Ie[O].messages:[],{role:"assistant",text:E==="append"?"已追加到当前节点内容。":"已替换当前节点内容。",at:Date.now()}]}}}),Yt($e,v.current).catch(Ie=>he(String(Ie.message||Ie))),he(String((P==null?void 0:P.statusMessage)||"")||(E==="append"?"已追加节点内容":"已替换节点内容"))},[Yt,g,oe]),df=m.useCallback(async(x,S="")=>{if(!oe)return he("Readonly workspace"),"";if(!x)return"";try{const E=new FormData;E.set("file",x),E.set("dir",String(S||"")),i.flowId&&E.set("flowId",i.flowId),i.flowSource&&E.set("flowSource",i.flowSource),i.archived&&E.set("archived","1");const P=await fetch("/api/workspace/upload",{method:"POST",body:E}),O=await P.json().catch(()=>({}));if(!P.ok)throw new Error(O.error||"上传文件失败");const q=String(O.path||"").trim();if(!q)throw new Error("上传文件失败:未返回路径");return await Nn(),Ja(Y=>{const G=new Set(Y);for(const Q of up(q))G.delete(Q);return G}),he(`已上传 ${q}`),q}catch(E){return he(String(E.message||E)),""}},[i,Nn,oe]),ff=m.useCallback(async x=>Mh(x)?df(x,"img"):(he("请选择图片文件"),""),[df]),iS=m.useCallback((x="")=>{var S;if(!oe){he("Readonly workspace");return}iv.current=String(x||""),(S=sv.current)==null||S.click()},[oe]),EM=m.useCallback(async x=>{const S=Array.from(x.target.files||[]);if(x.target.value="",!S.length)return;const E=iv.current||"";nv(!0);try{let P="";for(const O of S){const q=await df(O,E);q&&(P=q)}S.length>1&&he(`已上传 ${S.length} 个文件${P?`,最后一个:${P}`:""}`)}catch(P){he(String(P.message||P))}finally{nv(!1)}},[df]),oS=m.useCallback(async(x,S)=>{const E=String(x||"").trim();if(!E)return;const P=await ff(S);P&&Rs(E,P,"replace",{logChat:!1,statusMessage:`已上传图片 ${P}`})},[Rs,ff]),aS=m.useCallback(async(x,S=void 0)=>{var _e,$e;if(!oe){he("Readonly workspace");return}const E=String(x||"").trim();if(!E)return;const P=ra[E]||{},O=String(S!==void 0?S:P.draft||"").trim();if(!O||P.running)return;const q=y.current.find(De=>De.id===E);if(!q)return;const Y=jn(q.data)||"markdown",G=Yi(q.data);let Q=Wo(G,Y),le=wi(G);if(Q)try{le=await Wa(i,Q)}catch(De){he(String(De.message||De))}else if(Y!=="image"&&String(le||"").trim()){const De=ba(Y,le);if(De){he(`${De} 未进入微调。`);return}try{const Oe=await Rw(i,W1(E,q.data),le);await Nn(),Rs(E,Oe,"replace",{logChat:!1,reloadDisplay:!0,statusMessage:`已将展示保存为 ${Oe}`}),Q=Oe,le=""}catch(Oe){he(String(Oe.message||Oe));return}}const we=nY(E,y.current,v.current),pe={role:"user",text:O,at:Date.now()},Ae=Array.isArray(P.messages)?P.messages:[],Qe=P.sessionId||`nodechat_${Date.now()}_${E.replace(/[^a-z0-9_-]+/gi,"_")}`;ao(De=>({...De,[E]:{...P,sessionId:Qe,messages:[...Ae,pe],draft:"",running:!0,error:""}}));try{const De=await fetch("/api/workspace/node-chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,sessionId:Qe,node:{id:E,label:((_e=q.data)==null?void 0:_e.label)||E,definitionId:(($e=q.data)==null?void 0:$e.definitionId)||""},nodeKind:Y,currentContent:Q?"":le,sourceContext:we,targetFilePath:Q,messages:Ae,message:O,model:Ei})}),Oe=await De.json().catch(()=>({}));if(!De.ok)throw new Error(Oe.error||"节点微调失败");const It=String(Oe.candidateContent||Oe.reply||"").trim(),Ze=!!Oe.directFileEdit,Ye=String(Oe.artifactPath||Q||"").trim();if(Ze&&Ye){const Ie=ba(Y,It);if(Ie)throw new Error(`${Ie} 文件已由 agent 修改,请检查 ${Ye}。`);await Nn(),Rs(E,Ye,"replace",{logChat:!1,reloadDisplay:!0,statusMessage:`已按微调描述更新 ${Ye}`})}else if(It){const Ie=ba(Y,It);if(Ie)throw new Error(`${Ie} 已取消写入,避免覆盖当前展示文件。`);if(Q){const Ot=await Rw(i,Q,It);await Nn(),Rs(E,Ot,"replace",{logChat:!1,statusMessage:`已按微调描述更新 ${Ot}`})}else Rs(E,It,"replace",{logChat:!1,statusMessage:"已按微调描述更新展示内容"})}ao(Ie=>{var Ot;return{...Ie,[E]:{...Ie[E]||{},sessionId:String(Oe.sessionId||Qe),running:!1,candidateContent:"",messages:[...(Ot=Ie[E])!=null&&Ot.messages&&Array.isArray(Ie[E].messages)?Ie[E].messages:[...Ae,pe],{role:"assistant",text:It||Ze?Ye?`已更新文件 ${Ye}。`:"已按你的描述更新当前展示。":"没有生成可更新的内容。",at:Date.now()}]}}})}catch(De){const Oe=String(De.message||De);ao(It=>({...It,[E]:{...It[E]||{},running:!1,error:Oe}})),he(Oe)}},[Ei,i,Nn,ra,Rs,oe]),lS=m.useCallback(async(x,S)=>{if(!oe){he("Readonly workspace");return}const E=jn(S)||"markdown",P=Yi(S),O=Wo(P,E);let q=wi(P);if(O)try{q=await Wa(i,O)}catch(le){he(String(le.message||le));return}if(!String(q||"").trim()){he("展示节点没有可保存内容");return}const Y=ba(E,q);if(Y){he(`${Y} 未保存文件。`);return}const G=W1(x,S),Q=window.prompt("保存到 workspace 相对路径",G);if(Q)try{const le=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:Q,content:q})}),we=await le.json().catch(()=>({}));if(!le.ok)throw new Error(we.error||"保存文件失败");const pe=we.path||Q,Ae=Cr(i);Ae.set("path",pe);const Qe=await fetch(`/api/workspace/file?${Ae.toString()}`);if(!Qe.ok){const _e=await Qe.json().catch(()=>({}));throw new Error(_e.error||`保存后读取失败:${pe}`)}await Nn(),U(_e=>AY(_e,pe,String(q||"").length)),Ja(_e=>{const $e=new Set(_e);for(const De of up(pe))$e.delete(De);return $e}),Rs(x,pe,"replace",{logChat:!1,statusMessage:`已保存并引用 ${pe}`}),he(`已保存 ${pe}`)}catch(le){he(String(le.message||le))}},[i,Nn,Rs,oe]),cS=m.useCallback(x=>{var O,q;const S=String(x||"").trim();if(!S||Yn)return;const E=y.current.find(Y=>Y.id===S);if(!E||!jn(E==null?void 0:E.data)){he("展示节点不可用");return}const P=String(((O=E.data)==null?void 0:O.label)||((q=E.data)==null?void 0:q.displayName)||S).trim()||"AgentFlow Display";fn(Ry({title:P,layout:"single",nodeIds:[S],mode:"single-node",sourceNodeId:S})),Ht(""),Mn(null),Ke(!0)},[Yn]),pf=m.useCallback((x,S)=>{const E=String(x||"");E&&xt(P=>{if(!P||P.id!==E)return P;const O=typeof S=="function"?S(P):S;return!O||typeof O!="object"?P:{...P,...O}})},[]),uS=m.useCallback((x,S)=>{const E=String(x||"");!E||!oe||(g(P=>P.map(O=>{var Y;if(O.id!==E)return O;const q=Array.isArray((Y=O.data)==null?void 0:Y.outputs)&&O.data.outputs.length?O.data.outputs.map((G,Q)=>Q===0?{...G,default:S,value:S}:G):[{type:"file",name:"value",default:S,value:S}];return{...O,data:{...O.data,body:"",outputs:q}}})),pf(E,P=>({body:"",outputs:Array.isArray(P==null?void 0:P.outputs)&&P.outputs.length?P.outputs.map((q,Y)=>Y===0?{...q,default:S,value:S}:q):[{type:"file",name:"value",default:S,value:S}]})),he(`已选择文件 ${S}`))},[g,pf,oe]),dS=m.useCallback(x=>{qm({nodeId:String(x||""),query:""})},[]),cg=m.useCallback(()=>{qm({nodeId:"",query:""})},[]),AM=m.useCallback(x=>{const S=String((x==null?void 0:x.path)||"").trim();!S||!Ic.nodeId||(uS(Ic.nodeId,S),cg())},[cg,Ic.nodeId,uS]),fS=m.useCallback(async(x,S)=>{if(!oe)return;const E=xY(x,S);if(E.length===0)return;const P=[];try{for(const O of E){const q=await fetch("/api/workspace/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:O})});if(q.status===404)continue;const Y=await q.json().catch(()=>({}));if(!q.ok)throw new Error(Y.error||"清理节点输出失败");P.push(Y.path||O)}if(P.length===0)return;he(`已清理 ${P.join(", ")}`),await Nn(),Um(O=>E.some(q=>O===q||O.startsWith(`${q}/`))?"":O)}catch(O){he(String(O.message||O))}},[i,Nn,oe]),hf=m.useMemo(()=>({modelLists:ea,showBodyPreview:!0,flowParams:i,readOnly:!oe,onRunWorkspaceNode:Yv,onStopWorkspaceNode:qv,onOpenWorkspaceRunLogs:Uv,onOptimizeWorkspaceRun:lg,onOptimizeWorkspaceSchedule:lg,runningRunNodeIds:zv,onChangeScheduledRunConfig:tS,onChangeContextRunConfig:eS,skills:Cs,skillCollections:Xa,onChangeLoadSkillKeys:Xv,onRefreshSkills:lf,mcpServers:uv,onChangeLoadMcpNames:Qv,onRefreshMcps:cf,workspaceTargets:fv,onChangeLoadWorkspace:Zv,onRefreshWorkspaces:uf,onSaveDisplayNodeToFile:lS,onShareDisplayNode:cS,onOpenDisplayPreview:Wt,onRefreshNodeInternals:oo,onEnsureWorkspaceNodeDisplaySize:xv,sharingDisplayNodeId:Yn,onUploadWorkspaceImage:ff,onUploadImageToDisplayNode:oS,onOpenProvideFilePicker:dS,onStatus:he,onSetDisplayNodeContent:Rs,onToggleNodeChat:nS,onCloseNodeChat:rS,onUpdateNodeChatDraft:sS,onSendNodeChat:aS,onSyncNodePropDraft:pf,onCleanupWorkspaceNodeOutputs:fS}),[eS,Qv,Xv,Zv,tS,fS,rS,xv,i,uv,ea,dS,Uv,lg,cf,oo,lf,uf,Yv,zv,lS,aS,Rs,cS,Yn,Xa,Cs,qv,pf,nS,sS,oS,ff,fv,oe]),PM=m.useRef(new Map),Ts=m.useMemo(()=>{const x=PM.current,S=new Set,E=h.map(P=>{var G,Q;const O={selected:P.selected===!0,isExecuting:Tv.has(P.id),nodeStatus:((G=ag[P.id])==null?void 0:G.status)??null,nodeElapsed:((Q=ag[P.id])==null?void 0:Q.elapsed)??null,optimizingRun:Mv===P.id,scheduledRunState:Rv[P.id]||null,nodeChatActive:Nv===P.id,nodeChat:ra[P.id]||null},q=x.get(P.id);if(q&&q.source===P&&q.commonData===hf&&Uq(q.runtime,O))return S.add(P.id),q.node;const Y={...P,data:{...P.data,...hf,...O}};return x.set(P.id,{source:P,commonData:hf,runtime:O,node:Y}),S.add(P.id),Y});for(const P of x.keys())S.has(P)||x.delete(P);return E},[Nv,hf,ra,h,Mv,Rv,Tv,ag]),ug=m.useMemo(()=>new Map(Ts.map(x=>[x.id,x])),[Ts]),pS=ut?ug.get(ut):null,Vc=m.useMemo(()=>{const x=new Set(V);return C.nodeIds.map((S,E)=>{const P=ug.get(S);if(!P||!jn(P.data))return null;const O=vl(P)||{width:520,height:320},q=Ca(C.nodeSizes[S]||O,{display:!0})||O,Y=C.nodePositions[S]||{x:180+E*36,y:120+E*28};return{...P,id:$1(S),position:Y,selected:x.has(S),width:q.width,height:q.height,data:{...P.data,sourceNodeId:S,displayPageMode:!0,readOnly:!0,selected:x.has(S),displaySize:q,nodeSize:q}}}).filter(Boolean)},[C,ug,V]),ol=m.useMemo(()=>Ts.filter(x=>jn(x==null?void 0:x.data)),[Ts]),ct=l==="display",Ln=l==="workflow";m.useEffect(()=>{if(!ct||!C.viewport)return;const x=C.viewport,S=()=>{try{r.setViewport(x,{duration:0})}catch{}},E=window.requestAnimationFrame(()=>window.requestAnimationFrame(S));return()=>window.cancelAnimationFrame(E)},[C.viewport,ct,r]),m.useEffect(()=>{if(ct||Ln||!A)return;const x=A,S=()=>{try{r.setViewport(x,{duration:0})}catch{}},E=window.requestAnimationFrame(()=>window.requestAnimationFrame(S));return()=>window.cancelAnimationFrame(E)},[ct,Ln,r,A]),m.useEffect(()=>{Ln&&of(ar)},[Ln]),m.useEffect(()=>{if(!Ln||!ar)return;const x=Cr(i);x.set("tapdId",ar);const S=new EventSource(`/api/prd-workflow/events?${x.toString()}`);return S.onmessage=()=>{of(ar)},S.onerror=()=>{S.close()},()=>S.close()},[i,Ln,of,ar]),m.useEffect(()=>{if(!i.flowId)return;const x=Cr(i);x.set("clientId",de.current);const S=new EventSource(`/api/workspace/events?${x.toString()}`);return S.onmessage=E=>{let P=null;try{P=JSON.parse(E.data||"{}")}catch{P=null}if(!(!P||P.clientId===de.current)){if(P.type==="graph.committed"){if(re.current){he("检测到其他成员的更新;保存时将自动合并");return}Xr({background:!0}).catch(O=>he(String(O.message||O)));return}if(P.type==="runtime.committed"){re.current||Xr({background:!0}).catch(O=>he(String(O.message||O)));return}if(String(P.type||"").startsWith("file.")){Nn();return}String(P.type||"").startsWith("run.")&&af()}},()=>S.close()},[i,Nn,Xr,af]),m.useEffect(()=>{const x=M.current,S=new Map,E=[];for(const Y of[...Ts,...Vc]){const G=Kq(Y);S.set(Y.id,G),x.get(Y.id)!==G&&E.push(Y.id)}if(M.current=S,E.length===0)return;const P=()=>E.forEach(Y=>s(Y)),O=window.requestAnimationFrame(P),q=window.setTimeout(P,80);return()=>{window.cancelAnimationFrame(O),window.clearTimeout(q)}},[Vc,Ts,s]);const nn=m.useMemo(()=>h.find(x=>x.id===ie)||null,[h,ie]),dg=m.useRef({id:"",draft:null}),IM=m.useMemo(()=>{const x=G1(nn);return x?JSON.stringify(x):""},[nn]);m.useEffect(()=>{if(!nn){dg.current={id:"",draft:null},xt(null),rn("");return}const x=G1(nn),S=dg.current;dg.current={id:nn.id,draft:x},xt(E=>!E||E.id!==nn.id||S.id!==nn.id||!S.draft?x:HY(E,S.draft,x)),rn("")},[nn==null?void 0:nn.id,IM]);const fg=m.useCallback((x=!1)=>{if(!Se||!nn)return!1;if(!oe)return rn("Readonly workspace"),he("Readonly workspace"),!1;rn("");const S=Q1({nodes:h,edges:k,instances:z.current,selectedNode:nn,draft:Se,allowRename:x});return S!=null&&S.error?(rn(S.error),!1):(!(S!=null&&S.ok)||!S.changed||(z.current=S.instances,X(S.instances),g(S.nodes),w(S.edges),S.nextId!==nn.id&&be(S.nextId),oo(S.nextId)),!0)},[k,Se,h,nn,w,g,oo,oe]);m.useEffect(()=>{if(!oe||!Se||!nn)return;const x=window.setTimeout(()=>{fg(!1)},350);return()=>window.clearTimeout(x)},[Se==null?void 0:Se.label,Se==null?void 0:Se.role,Se==null?void 0:Se.model,Se==null?void 0:Se.body,JSON.stringify((Se==null?void 0:Se.images)||[]),Se==null?void 0:Se.script,Se==null?void 0:Se.scriptRef,Se==null?void 0:Se.implementationRef,Se==null?void 0:Se.implementationMode,JSON.stringify((Se==null?void 0:Se.inputs)||[]),JSON.stringify((Se==null?void 0:Se.outputs)||[]),fg,nn==null?void 0:nn.id,oe]);const RM=m.useMemo(()=>{const x=new Map(Ts.map(S=>[S.id,S]));return k.map(S=>{var le,we,pe,Ae;const E=x.get(S.source),P=x.get(S.target),O=/^output-(\d+)$/.exec(S.sourceHandle||""),q=/^input-(\d+)$/.exec(S.targetHandle||""),Y=E&&O?(we=(le=E.data)==null?void 0:le.outputs)==null?void 0:we[parseInt(O[1],10)]:null,G=P&&q?(Ae=(pe=P.data)==null?void 0:pe.inputs)==null?void 0:Ae[parseInt(q[1],10)]:null,Q=Y!=null&&Y.type?_n(Y.type):G!=null&&G.type?_n(G.type):"";return Q?{...S,style:{...S.style||{},stroke:Q,strokeWidth:2},markerEnd:{type:fi.ArrowClosed,color:Q}}:S})},[k,Ts]),TM=ct?Vc:Ts,MM=ct?[]:RM,$M=m.useMemo(()=>ct?Vc.map(x=>({...x,id:Py(x.id)})):Ts,[Vc,Ts,ct]),LM=m.useCallback(x=>{const S=String(x||"").trim();if(!S)return;const E=ct?$1(S):S;ct?F([S]):(g(O=>O.map(q=>({...q,selected:q.id===E}))),w(O=>O.map(q=>({...q,selected:!1}))),be(E));const P=()=>{var le,we,pe;const O=r.getNode(E);if(!O)return;const q=(le=r.getInternalNode)==null?void 0:le.call(r,E),Y=((we=q==null?void 0:q.measured)==null?void 0:we.width)??(q==null?void 0:q.width)??O.width??260,G=((pe=q==null?void 0:q.measured)==null?void 0:pe.height)??(q==null?void 0:q.height)??O.height??120,{zoom:Q}=r.getViewport();r.setCenter(O.position.x+Y/2,O.position.y+G/2,{zoom:Qq(Q),duration:240})};window.requestAnimationFrame(()=>window.requestAnimationFrame(P))},[ct,r,w,g]),hS=m.useCallback(()=>{const x=r.getViewport(),S={x:Number(x.x)||0,y:Number(x.y)||0,zoom:Math.min(Math.max(Number(x.zoom)||1,.1),4)};if(ct){const E={...j.current,viewport:S};j.current=E,N(E),he("已固定 Display 进入视角")}else{D.current=S,I(S);try{window.localStorage.setItem(a,JSON.stringify(S))}catch{}he("已固定 Workspace 进入视角");return}Yt(y.current,v.current).catch(E=>he(String(E.message||E)))},[ct,r,Yt,a]),pg=m.useMemo(()=>{const x=nt.trim().toLowerCase(),S={DISPLAY:[],CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const E of Te)x&&![E.id,E.label,E.displayName,E.description].some(P=>String(P||"").toLowerCase().includes(x))||S[ku(E)].push(E);for(const E of bl)S[E].sort((P,O)=>P.id.localeCompare(O.id));return S},[Te,nt]),Kc=m.useMemo(()=>{const x=Tr.trim().toLowerCase();return Te.filter(S=>!x||[S.id,S.label,S.displayName,S.description].some(E=>String(E||"").toLowerCase().includes(x))).sort((S,E)=>{const P=bl.indexOf(ku(S)),O=bl.indexOf(ku(E));return P!==O?P-O:vu(S).localeCompare(vu(E))}).slice(0,30)},[Te,Tr]),Uc=m.useMemo(()=>{const x=Tr.trim().toLowerCase();return it.filter(S=>!x||[S.id,S.version,S.displayName,S.name,S.description,...Array.isArray(S.tags)?S.tags:[]].some(E=>String(E||"").toLowerCase().includes(x))).sort((S,E)=>String(S.displayName||S.name||S.id).localeCompare(String(E.displayName||E.name||E.id))).slice(0,30)},[it,Tr]);m.useEffect(()=>{Mr(0)},[Tr,Vt,Fe]),m.useEffect(()=>{if(!Vt)return;const x=window.setTimeout(()=>{var S;return(S=kv.current)==null?void 0:S.focus()},0);return()=>window.clearTimeout(x)},[Vt]);const OM=m.useMemo(()=>{const x=Vm.trim().toLowerCase();return x?Mk(hr).filter(S=>S.path.toLowerCase().includes(x)):hr},[Vm,hr]),oa=m.useMemo(()=>JR(hr,Km),[hr,Km]),Ii=(oa==null?void 0:oa.type)==="directory"?oa.path:jY((oa==null?void 0:oa.path)||""),DM=m.useCallback(x=>{var S,E;(E=(S=x.target)==null?void 0:S.closest)!=null&&E.call(S,".af-work-file")||Um("")},[]),FM=[...(ea.cursor||[]).map(x=>({label:`Cursor · ${x.split(" - ")[0]}`,value:`cursor:${x.split(" - ")[0]}`})),...(ea.opencode||[]).map(x=>({label:`OpenCode · ${x.split(" - ")[0]}`,value:`opencode:${x.split(" - ")[0]}`})),...(ea.claudeCode||[]).map(x=>({label:`Claude · ${x.split(" - ")[0]}`,value:`claude-code:${x.split(" - ")[0]}`})),...(ea.codex||[]).map(x=>({label:`Codex · ${x.split(" - ")[0]}`,value:`codex:${x.split(" - ")[0]}`}))],hg=m.useMemo(()=>new Set(_s),[_s]),al=m.useMemo(()=>{const x=new Map(Cs.map(q=>[q.key,q])),S=new Set,E=new Set,P=Xa.map(q=>{const Y=Ho(q,Cs).map(G=>x.get(G)).filter(Boolean);for(const G of Y)S.add(G.key),E.add(String(G.name||G.id||G.key||"").trim());return{...q,skills:Y}}).filter(q=>q.skills.length>0),O=Cs.filter(q=>{const Y=String(q.name||q.id||q.key||"").trim();return!S.has(q.key)&&!E.has(Y)});return{groups:P,ungrouped:O}},[Xa,Cs]);m.useEffect(()=>{wv(x=>{let S=!1;const E=new Set(x);for(const P of al.groups)E.has(P.id)||(E.add(P.id),S=!0);return S?E:x})},[al.groups]);const Gn=m.useMemo(()=>{const x=h.filter(S=>S.selected);return x.length>0?x:ie?h.filter(S=>S.id===ie):[]},[h,ie]),mf=m.useMemo(()=>Gn.map(x=>x.id),[Gn]),mS=m.useCallback(()=>{if(ct)return;if(!oe){he("Readonly workspace");return}const x=(y.current||[]).filter(G=>(G==null?void 0:G.selected)&&!Hu(G));if(x.length<2){he("选择至少两个节点后按 G 创建 Group");return}const S=x.reduce((G,Q)=>{var Qe,_e,$e,De,Oe,It,Ze,Ye,Ie,Ot,et,pt;const le=Number(((Qe=Q.position)==null?void 0:Qe.x)||0),we=Number(((_e=Q.position)==null?void 0:_e.y)||0),pe=Number((($e=Q.measured)==null?void 0:$e.width)||Q.width||((Oe=(De=Q.data)==null?void 0:De.nodeSize)==null?void 0:Oe.width)||((Ze=(It=Q.data)==null?void 0:It.displaySize)==null?void 0:Ze.width)||vR),Ae=Number(((Ye=Q.measured)==null?void 0:Ye.height)||Q.height||((Ot=(Ie=Q.data)==null?void 0:Ie.nodeSize)==null?void 0:Ot.height)||((pt=(et=Q.data)==null?void 0:et.displaySize)==null?void 0:pt.height)||Th);return{minX:Math.min(G.minX,le),minY:Math.min(G.minY,we),maxX:Math.max(G.maxX,le+pe),maxY:Math.max(G.maxY,we+Ae)}},{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});if(!Number.isFinite(S.minX)||!Number.isFinite(S.minY))return;const E=new Set((y.current||[]).map(G=>G.id));let P=1,O=`group_${P}`;for(;E.has(O);)P+=1,O=`group_${P}`;const q=Pw({width:S.maxX-S.minX+ap*2,height:S.maxY-S.minY+ap*2})||{width:Da,height:Fa},Y={id:O,type:Jl,position:{x:S.minX-ap,y:S.minY-ap},width:q.width,height:q.height,selected:!0,draggable:!0,selectable:!0,zIndex:0,data:{isWorkspaceGroup:!0,label:zh(P-1),title:zh(P-1),color:"purple",nodeSize:q}};g(G=>[Y,...G.map(Q=>({...Q,selected:!1}))]),w(G=>G.map(Q=>({...Q,selected:!1}))),be(""),he(`Created group for ${x.length} nodes`)},[ct,w,g,oe]),qc=m.useMemo(()=>h.filter(x=>jn(x==null?void 0:x.data)),[h]),mg=m.useMemo(()=>Gn.filter(x=>jn(x==null?void 0:x.data)).map(x=>x.id),[Gn]),zM=m.useMemo(()=>{const x=String((Nr==null?void 0:Nr.username)||(Nr==null?void 0:Nr.userId)||"").trim();return x?x.slice(0,1).toUpperCase():"?"},[Nr]),gg=m.useMemo(()=>new Set(mf),[mf]),gf=m.useMemo(()=>k.filter(x=>gg.has(x.source)&&gg.has(x.target)),[k,gg]),yg=m.useCallback(x=>{const S=x==="display"?"display":x==="workflow"?"workflow":"workspace";c(S),be(""),F([]),B(null),$n(!1),Jt(!1);const E=Cr(i);S==="display"&&E.set("view","display"),S==="workflow"&&(E.set("view","workflow"),ar.trim()&&E.set("tapdId",ar.trim()));const P=`/workspace${E.toString()?`?${E.toString()}`:""}`;window.history.pushState({},"",P)},[i,ar]),gS=m.useCallback(x=>{const S=String(x||"").trim();if(!S)return;const E=y.current.find(P=>P.id===S);if(!E||!jn(E.data)){he("展示节点不可用");return}N(P=>{if(P.nodeIds.includes(S))return P;const O=P.nodeIds.length,q=vl(E);return{nodeIds:[...P.nodeIds,S],nodePositions:{...P.nodePositions,[S]:{x:180+O*36,y:120+O*28}},nodeSizes:{...P.nodeSizes,...q?{[S]:q}:{}}}}),F([S])},[]),yS=m.useCallback(x=>{const S=String(x||"").trim();S&&(N(E=>{const P=E.nodeIds.filter(Y=>Y!==S),O={...E.nodePositions},q={...E.nodeSizes};return delete O[S],delete q[S],{nodeIds:P,nodePositions:O,nodeSizes:q}}),F(E=>E.filter(P=>P!==S)))},[]),xS=m.useCallback(x=>{const S=String(x||"").trim();S&&(j.current.nodeIds.includes(S)?yS(S):gS(S))},[gS,yS]),yf=m.useMemo(()=>{const x=Bn.trim().toLowerCase();return x?ol.filter(S=>{var E,P;return[S.id,(E=S.data)==null?void 0:E.label,(P=S.data)==null?void 0:P.definitionId].filter(Boolean).some(O=>String(O).toLowerCase().includes(x))}):ol},[ol,Bn]),wS=m.useMemo(()=>{const x=yf.length,S=x<=1?1:x<=4?2:3,E=Array.from({length:S},()=>({height:0,nodes:[]}));for(const P of yf){const O=vl(P)||{width:420,height:260},q=Math.max(1,Number(O.width)||420),Y=Math.max(1,Number(O.height)||260),G=Math.min(26,Math.max(5.5,Y/q*16))+3.2;let Q=E[0];for(const le of E)le.height<Q.height&&(Q=le);Q.nodes.push(P),Q.height+=G}return E.map(P=>P.nodes)},[yf]),BM=m.useCallback(x=>{var q;const S=C.nodeIds.includes(x.id),E=vl(x)||{width:420,height:260},P=Math.max(1,Math.round(Number(E.width)||420)),O=Math.max(1,Math.round(Number(E.height)||260));return o.jsxs("button",{type:"button",className:"af-display-picker-card"+(S?" af-display-picker-card--selected":""),style:{"--af-display-picker-card-ratio":`${P} / ${O}`},onClick:()=>xS(x.id),children:[o.jsx("span",{className:"af-display-picker-card__check","aria-hidden":!0,children:o.jsx("input",{type:"checkbox",checked:S,readOnly:!0,tabIndex:-1})}),o.jsx("span",{className:"af-display-picker-card__preview",children:o.jsx(pY,{node:x})}),o.jsxs("span",{className:"af-display-picker-card__meta",children:[o.jsx("strong",{children:((q=x.data)==null?void 0:q.label)||x.id}),o.jsxs("small",{children:[jn(x.data)," · ",x.id]})]})]},x.id)},[C.nodeIds,xS]),bS=m.useMemo(()=>{const x=nt.trim().toLowerCase();return x?it.filter(S=>[S.id,S.version,S.displayName,S.name,S.description,...Array.isArray(S.tags)?S.tags:[]].filter(Boolean).some(E=>String(E).toLowerCase().includes(x))):it},[it,nt]),kS=m.useCallback((x,S)=>{const E=String(x||"snippet_node").trim().replace(/[^a-zA-Z0-9_]+/g,"_").replace(/^_+|_+$/g,"")||"snippet_node";let P=`${E}_${Date.now().toString(36)}`,O=2;for(;S.has(P);)P=`${E}_${Date.now().toString(36)}_${O}`,O+=1;return S.add(P),P},[]),Yc=m.useCallback((x,S)=>{var Ie,Ot;if(!oe){he("Readonly workspace");return}const E=x!=null&&x.snippet&&typeof x.snippet=="object"?x.snippet:{},P=E.instances&&typeof E.instances=="object"?E.instances:{},O=Object.keys(P);if(O.length===0)return;const q=new Set(y.current.map(et=>et.id)),Y={};for(const et of O)Y[et]=kS(et,q);const G=(Ie=E.ui)!=null&&Ie.nodePositions&&typeof E.ui.nodePositions=="object"?E.ui.nodePositions:{},Q=(Ot=E.ui)!=null&&Ot.nodeSizes&&typeof E.ui.nodeSizes=="object"?E.ui.nodeSizes:{},le=O.map(et=>{const pt=G[et];return{id:et,x:typeof(pt==null?void 0:pt.x)=="number"?pt.x:0,y:typeof(pt==null?void 0:pt.y)=="number"?pt.y:0}}),we=Math.min(...le.map(et=>et.x)),pe=Math.min(...le.map(et=>et.y));let Ae=S||{x:360+y.current.length*24,y:180+y.current.length*18};if(!S){const et=document.querySelector(".af-workspace-canvas .react-flow");if(et){const pt=et.getBoundingClientRect();Ae=r.screenToFlowPosition({x:pt.left+pt.width*.48,y:pt.top+pt.height*.32})}}const Qe={},_e={},$e={};for(const et of le){const pt=Y[et.id];Qe[pt]={...P[et.id]||{}},_e[pt]={x:Ae.x+(et.x-we),y:Ae.y+(et.y-pe)};const zt=Q[et.id];typeof(zt==null?void 0:zt.width)=="number"&&typeof(zt==null?void 0:zt.height)=="number"&&($e[pt]={width:zt.width,height:zt.height})}const De=new Set(O),Oe=(Array.isArray(E.edges)?E.edges:[]).filter(et=>De.has(et==null?void 0:et.source)&&De.has(et==null?void 0:et.target)).map(et=>({source:Y[et.source],target:Y[et.target],sourceHandle:et.sourceHandle??null,targetHandle:et.targetHandle??null})),It=cu({instances:Qe,edges:Oe,ui:{nodePositions:_e,nodeSizes:$e}},Te),Ze=It.nodes.map(et=>et.id),Ye=It.nodes.map(et=>({...et,selected:!0}));z.current={...z.current,...It.instances},X(z.current),g(et=>[...et.map(pt=>({...pt,selected:!1})),...Ye]),w(et=>[...et.map(pt=>({...pt,selected:!1})),...It.edges.map(pt=>({...pt,selected:!1}))]),be(""),F([]),he(`已添加流程片段:${x.displayName||x.id}(已选中 ${Ze.length} 个节点)`)},[kS,Te,r,w,g,oe]),HM=m.useCallback(()=>{var E,P;if(Gn.length<2){fe("请先在 workspace 画布上选择至少两个节点。"),Re("flows");return}const x=Gn[0],S=Gn.length===2?`${((E=x.data)==null?void 0:E.label)||x.id} 片段`:`${((P=x.data)==null?void 0:P.label)||x.id} 等 ${Gn.length} 个节点`;je({name:S,id:S.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),description:""}),en(""),He(!0),Re("flows")},[Gn]),WM=m.useCallback(async()=>{var O,q;if(Gn.length<2)return;const x=Ge.name.trim();if(!x){en("请填写片段名称。");return}const S={},E={};for(const Y of Gn){S[Y.id]={x:((O=Y.position)==null?void 0:O.x)||0,y:((q=Y.position)==null?void 0:q.y)||0};const G=vl(Y);G&&(E[Y.id]=G)}const P=gf.map(Y=>({source:Y.source,target:Y.target,sourceHandle:Y.sourceHandle??null,targetHandle:Y.targetHandle??null}));kn(!0),en("");try{const Y=await fetch("/api/marketplace/publish-flow-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:Ge.id,name:x,displayName:x,version:"1.0.0",description:Ge.description,snippet:{instances:jk(Gn,z.current),edges:P,ui:{nodePositions:S,nodeSizes:E}}})}),G=await Y.json().catch(()=>({}));if(!Y.ok||G.ok===!1)throw new Error(G.error||"发布流程片段失败");He(!1),he(`流程片段已发布:${G.id||x}`),yv(`流程片段已发布:${G.id||x}`),await rf(),Re("flows")}catch(Y){en(String(Y.message||Y))}finally{kn(!1)}},[rf,Ge,gf,Gn,yv]),vS=m.useCallback(async()=>{var S;const x=Ac.trim();if(x){io(!0),Ec("");try{const E=await fetch("/api/workspace/collaboration/share",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,username:x,role:"editor"})}),P=await E.json().catch(()=>({}));if(!E.ok)throw new Error(P.error||"添加协作成员失败");_t(P.workspace||null),Jk(""),he(`已将 Workspace 分享给 ${((S=P.member)==null?void 0:S.username)||x}`)}catch(E){Ec(String(E.message||E))}finally{io(!1)}}},[i,Ac]),VM=m.useCallback(()=>{Ec(""),Gr(!0)},[]),KM=m.useCallback(async x=>{const S=String((x==null?void 0:x.userId)||"").trim();if(!(!S||S===(dt==null?void 0:dt.ownerId))){Qk(S),Ec("");try{const E=await fetch("/api/workspace/collaboration/share",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,memberUserId:S})}),P=await E.json().catch(()=>({}));if(!E.ok)throw new Error(P.error||"取消成员分享失败");_t(P.workspace||null),he(`已取消对 ${(x==null?void 0:x.username)||S} 的分享`)}catch(E){Ec(String(E.message||E))}finally{Qk("")}}},[i,dt==null?void 0:dt.ownerId]),SS=m.useCallback(async()=>{const x=yl(y.current,v.current,z.current);x.ui={...x.ui||{},...D.current?{viewport:D.current}:{},displayPage:L1(j.current,y.current)};const S=new Blob([`${JSON.stringify(x,null,2)}
|
|
263
|
-
`],{type:"application/json"}),E=URL.createObjectURL(S),P=document.createElement("a");P.href=E,P.download=`${i.flowId||"workspace"}-conflict-draft-${Date.now()}.json`,document.body.appendChild(P),P.click(),P.remove(),URL.revokeObjectURL(E),await Xr(),Ya(null),Zo(!1),he("已备份本地草稿并载入远端最新版本")},[v,i.flowId,Xr,y]),UM=m.useCallback(async()=>{const x=Array.isArray(Sn==null?void 0:Sn.conflictItems)?Sn.conflictItems:[];if(!x.length||!(Sn!=null&&Sn.mergeGraph)||!(Sn!=null&&Sn.currentGraph)){Pc("当前冲突缺少字段合并数据,请改用“备份并载入远端”。");return}let S=Sn.mergeGraph;try{x.forEach((P,O)=>{const q=Wm[String(O)]||{mode:"local"};let Y,G=!0;q.mode==="remote"?(Y=P.current,G=P.hasCurrent!==!1):q.mode==="manual"?Y=JSON.parse(String(q.manual||"")):(Y=P.incoming,G=P.hasIncoming!==!1),S=qY(S,P.pathParts,Y,G)})}catch(P){Pc(`手动值不是有效 JSON:${String(P.message||P)}`);return}Zk(!0),Pc(""),As("saving"),Ps("正在提交冲突解决结果");const E=se.current.catch(()=>{}).then(async()=>{const P=await fetch("/api/workspace/graph",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,graph:S,baseRevision:Sn.currentRevision,baseGraph:Sn.currentGraph,clientId:de.current})}),O=await P.json().catch(()=>({}));if(!P.ok){if(P.status===409&&Array.isArray(O.conflictItems)){const q=O.conflictItems;Ya({currentRevision:String(O.currentRevision||""),message:O.error||"Workspace 再次出现冲突",conflictPaths:Array.isArray(O.conflictPaths)?O.conflictPaths:[],conflictItems:q,mergeGraph:O.mergeGraph||null,currentGraph:O.currentGraph||null}),Ga(Object.fromEntries(q.map((Y,G)=>[String(G),{mode:"local",manual:uu(Y)}])))}throw new Error(O.error||"提交冲突解决结果失败")}await Xr(),Ya(null),Zo(!1),he("冲突已解决并保存")});se.current=E;try{await E}catch(P){Pc(String(P.message||P)),As("error"),Ps(String(P.message||P))}finally{Zk(!1)}},[i,Xr,Sn,Wm]);m.useCallback(()=>{if(qc.length===0){he("当前 workspace 没有 display 节点");return}const x=mg.length>0?mg:qc.map(E=>E.id),S=i.flowId?`${i.flowId} 展示页`:"AgentFlow Display";fn(Ry({title:S,layout:"gallery",nodeIds:x,mode:"multi-node"})),Ht(""),Mn(null),Ke(!0)},[i.flowId,mg,qc]);const qM=m.useCallback(x=>{fn(S=>{const E=Array.isArray(S.nodeIds)?S.nodeIds:[];return E.includes(x)?{...S,nodeIds:E.filter(P=>P!==x)}:{...S,nodeIds:[...E,x]}})},[]),Ms=m.useCallback(async()=>{Ns(!0),Ft("");try{const x=await fetch("/api/display/shares"),S=await x.json().catch(()=>({}));if(!x.ok)throw new Error(S.error||"读取分享列表失败");Qn(Array.isArray(S.shares)?S.shares:[])}catch(x){Ft(String(x.message||x)),Qn([])}finally{Ns(!1)}},[]),YM=m.useCallback(()=>{Rr(!0),yt(""),Ms()},[Ms]),GM=m.useCallback(async()=>{var E,P;const x=Pt.title.trim(),S=Array.isArray(Pt.nodeIds)?Pt.nodeIds:[];if(S.length===0){Ht("请选择至少一个 display 节点。");return}jt(!0),Ht(""),Mn(null);try{await Yt(h,k);const O=await fetch("/api/display/share",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,title:x,layout:Pt.layout,nodeIds:S,...D1(Pt)})}),q=await O.json().catch(()=>({}));if(!O.ok||q.ok===!1)throw new Error(q.error||"发布展示页失败");const Y=new URL(q.url||`/display/${((E=q.share)==null?void 0:E.id)||""}`,window.location.origin).href;Mn({...q,absoluteUrl:Y}),he((P=q.share)!=null&&P.expiresAt?"展示页已生成":"展示页已生成:永久有效"),zn&&Ms()}catch(O){Ht(String(O.message||O))}finally{jt(!1)}},[Pt,zn,k,i,Ms,h,Yt]),JM=m.useCallback(async()=>{var S,E;const x=Array.isArray(C.nodeIds)?C.nodeIds:[];if(x.length===0){Ht("请先添加至少一个展示节点。"),he("请先添加至少一个展示节点"),Jt(!0);return}jt(!0),Ht("");try{await Yt(h,k);const P=i.flowId?`${i.flowId} 展示页`:"AgentFlow Display",O=await fetch("/api/display/share",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,title:P,layout:"canvas",nodeIds:x,...D1(Pt)})}),q=await O.json().catch(()=>({}));if(!O.ok||q.ok===!1)throw new Error(q.error||"生成展示链接失败");const Y=new URL(q.url||`/display/${((S=q.share)==null?void 0:S.id)||""}`,window.location.origin).href;Mn({...q,absoluteUrl:Y}),Yr(!0),he((E=q.share)!=null&&E.expiresAt?"展示链接已生成":"展示链接已生成:永久有效"),zn&&Ms()}catch(P){const O=String(P.message||P);Ht(O),he(O)}finally{jt(!1)}},[C.nodeIds,Pt,zn,k,i,Ms,h,Yt]),NS=m.useCallback(async()=>{const x=gt==null?void 0:gt.absoluteUrl;if(!x)return;const S=await z1(x);on(S?"copied":"failed"),window.setTimeout(()=>on(""),1600)},[gt==null?void 0:gt.absoluteUrl]),XM=m.useCallback(async x=>{const S=F1(x),E=await z1(S);yt(E?String((x==null?void 0:x.id)||""):"failed"),window.setTimeout(()=>yt(""),1600)},[]),QM=m.useCallback(async(x,S)=>{const E=String((x==null?void 0:x.id)||"");if(E){ke(E),Ft("");try{const P=S==="permanent"?{id:E,expiresMode:"permanent",permanent:!0}:{id:E,expiresMode:"days",expiresInDays:Number(S||30)},O=await fetch("/api/display/share",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(P)}),q=await O.json().catch(()=>({}));if(!O.ok||q.ok===!1)throw new Error(q.error||"更新分享有效期失败");await Ms(),he("分享有效期已更新")}catch(P){Ft(String(P.message||P))}finally{ke("")}}},[Ms]),ZM=m.useCallback(async x=>{const S=String((x==null?void 0:x.id)||"");if(S){ke(S),Ft("");try{const E=await fetch(`/api/display/share?id=${encodeURIComponent(S)}`,{method:"DELETE"}),P=await E.json().catch(()=>({}));if(!E.ok||P.ok===!1)throw new Error(P.error||"撤销分享失败");await Ms(),he("分享已撤销")}catch(E){Ft(String(E.message||E))}finally{ke("")}}},[Ms]),e$=m.useCallback(x=>{g(S=>S.map(E=>E.id===x?{...E,selected:!1}:E)),be(S=>S===x?"":S)},[g]),ll=m.useCallback(()=>{const x=eg.current;if(!x)return;const S=x.getBoundingClientRect(),E=Math.min(420,Math.max(320,S.width+160)),P=12,O=Math.max(180,S.top-P*2),q=Math.min(560,O);mM({position:"fixed",left:Math.max(12,Math.min(window.innerWidth-E-12,S.left)),top:Math.max(P,S.top-q-P),width:E,maxHeight:q,zIndex:1e4})},[]);m.useEffect(()=>{if(!ef)return;ll();const x=E=>{var O,q;const P=E.target;(O=eg.current)!=null&&O.contains(P)||(q=bv.current)!=null&&q.contains(P)||Zm(!1)},S=E=>{E.key==="Escape"&&Zm(!1)};return window.addEventListener("pointerdown",x),window.addEventListener("keydown",S),window.addEventListener("resize",ll),window.addEventListener("scroll",ll,!0),()=>{window.removeEventListener("pointerdown",x),window.removeEventListener("keydown",S),window.removeEventListener("resize",ll),window.removeEventListener("scroll",ll,!0)}},[ef,ll]);const t$=m.useCallback(x=>{var O,q;if(l==="display"){const Y=[];let G=!1;(x||[]).some(le=>(le==null?void 0:le.type)==="position"&&!!le.position||(le==null?void 0:le.type)==="dimensions"&&le.resizing===!0)&&Is(),N(le=>{var Ae,Qe;const we={...le.nodePositions},pe={...le.nodeSizes};for(const _e of x||[]){const $e=Py(_e==null?void 0:_e.id);if(!(!$e||!le.nodeIds.includes($e))){if(_e.type==="select"){_e.selected&&Y.push($e);continue}if(_e.type==="position"&&_e.position){we[$e]={x:_e.position.x,y:_e.position.y},G=!0;continue}if(_e.type==="dimensions"&&((Ae=_e.dimensions)!=null&&Ae.width)&&((Qe=_e.dimensions)!=null&&Qe.height)){const De=Ca({width:Math.round(Number(_e.dimensions.width)),height:Math.round(Number(_e.dimensions.height))},{display:!0});De&&(pe[$e]=De,G=!0)}}}return G?{...le,nodePositions:we,nodeSizes:pe}:le}),(x||[]).some(le=>(le==null?void 0:le.type)==="select")&&F(Y);return}if(!oe){const Y=(x||[]).filter(G=>(G==null?void 0:G.type)==="select");Y.length>0&&g(G=>Ch(Y,G));return}(x||[]).some(Y=>(Y==null?void 0:Y.type)==="add"||(Y==null?void 0:Y.type)==="remove"||(Y==null?void 0:Y.type)==="replace"||(Y==null?void 0:Y.type)==="position"&&!!Y.position||(Y==null?void 0:Y.type)==="dimensions"&&Y.resizing===!0)&&Is();const E=new Map;for(const Y of x||[])if((Y==null?void 0:Y.type)==="dimensions"&&((O=Y.dimensions)!=null&&O.width)&&((q=Y.dimensions)!=null&&q.height)){const G=h.find(Ae=>Ae.id===Y.id),Q=Hu(G),le=!!jn(G==null?void 0:G.data),we={width:Math.round(Number(Y.dimensions.width)),height:Math.round(Number(Y.dimensions.height))},pe=Q?Pw(we):Ca(we,{display:le});pe&&E.set(Y.id,pe)}const P=Array.from(E.keys());if(g(Y=>Ch(x,Y).map(G=>{const Q=E.get(G.id);return Q?Hu(G)?{...G,width:Q.width,height:Q.height,data:{...G.data,nodeSize:Q}}:jn(G.data)?{...G,width:Q.width,height:Q.height,data:{...G.data,nodeSize:Q,displaySize:Q}}:{...G,width:Q.width,height:Q.height,data:{...G.data,nodeSize:Q}}:G})),P.length>0){const Y=()=>P.forEach(G=>s(G));window.requestAnimationFrame(Y),window.setTimeout(Y,80)}},[Is,h,g,s,l,oe]),n$=m.useCallback(x=>{if(l!=="display"){if(!oe){const S=(x||[]).filter(E=>(E==null?void 0:E.type)==="select");S.length>0&&w(E=>{const P=_h(S,E);return v.current=P,P});return}(x||[]).some(S=>(S==null?void 0:S.type)!=="select")&&Is(),w(S=>{const E=_h(x,S);return v.current=E,E})}},[Is,w,l,oe]),cl=m.useCallback(()=>{const x=document.querySelector(".af-workspace-canvas .react-flow");if(x){const S=x.getBoundingClientRect();return r.screenToFlowPosition({x:S.left+S.width*.48,y:S.top+S.height*.32})}return{x:360+h.length*36,y:180+h.length*28}},[h.length,r]),xf=m.useCallback(()=>{var x,S,E;if(nn){const P=Number(((x=nn.measured)==null?void 0:x.width)||nn.width||260);return{x:Number(((S=nn.position)==null?void 0:S.x)||0)+P+140,y:Number(((E=nn.position)==null?void 0:E.y)||0)}}return cl()},[cl,nn]),Ri=m.useCallback((x,S={})=>{if(!oe)return he("Readonly workspace"),null;if(!x)return null;const E=Ik(x)||x.id,P=$R(x),O=OR(x),q=S.id||Lq(E,h),Y=Nu(x.inputs),G=Nu(x.outputs),Q={definitionId:E,...P?{marketplaceRef:P}:{},...x.packageId?{marketplacePackageId:x.packageId}:{},...x.version?{marketplaceVersion:x.version}:{},label:S.label||Fh(x),role:"normal",body:S.body||"",...S.script||O?{script:S.script||O}:{},...S.scriptRef?{scriptRef:S.scriptRef}:{},...S.implementationRef?{implementationRef:S.implementationRef}:{},...S.implementationMode?{implementationMode:S.implementationMode}:{},input:S.inputs||Y,output:S.outputs||G},le={id:q,type:Jl,position:S.position||cl(),data:{label:Q.label,definitionId:E,...P?{marketplaceRef:P}:{},...x.packageId?{marketplacePackageId:x.packageId}:{},...x.version?{marketplaceVersion:x.version}:{},schemaType:MR(E,x),role:"normal",body:Q.body,...Q.script?{script:Q.script}:{},...Q.scriptRef?{scriptRef:Q.scriptRef}:{},...Q.implementationRef?{implementationRef:Q.implementationRef}:{},...Q.implementationMode?{implementationMode:Q.implementationMode}:{},inputs:Q.input,outputs:Q.output}},we={...jw(le,{...z.current,[q]:Q},Te),selected:!0};return Is(),g(pe=>[...pe.map(Ae=>({...Ae,selected:!1})),we]),S.openProperties&&be(q),q},[cl,Is,h,Te,g,oe]),r$=m.useCallback(x=>Ay(x,y.current),[]),s$=m.useCallback(x=>{if(!oe){he("Readonly workspace");return}if(!Ay(x,y.current)){he("端口类型不匹配,已取消连线");return}B(null),Is(),g(S=>Ny(S,x)),w(S=>{const E=S.filter(O=>!(O.target===x.target&&O.targetHandle===x.targetHandle)),P=Dp({...x,markerEnd:{type:fi.ArrowClosed}},E);return v.current=P,P})},[Is,w,g,oe]),i$=m.useCallback((x,S)=>{if(!oe)return;const E=Tq(S,y.current);W.current=E?{...E,preferExisting:!!(x!=null&&x.shiftKey)}:null,B(null)},[oe]),o$=m.useCallback((x,S)=>{var De,Oe,It,Ze;if(!oe)return;const E=W.current;if(W.current=null,!E||S!=null&&S.toNode)return;const P=Mq(Te,E),O=$q(y.current,v.current,E);if(P.length===0&&O.length===0){he(`没有匹配 ${E.slotType} 端口的节点`);return}const Y=!!(x!=null&&x.shiftKey||E.preferExisting)?O.length>0?"existing":"create":P.length>0?"create":"existing",G=((Oe=(De=x==null?void 0:x.changedTouches)==null?void 0:De[0])==null?void 0:Oe.clientX)??(x==null?void 0:x.clientX),Q=((Ze=(It=x==null?void 0:x.changedTouches)==null?void 0:It[0])==null?void 0:Ze.clientY)??(x==null?void 0:x.clientY);if(!Number.isFinite(G)||!Number.isFinite(Q))return;const le=document.querySelector(".af-workspace-canvas .react-flow");if(!le)return;const we=le.getBoundingClientRect(),pe=320,Ae=Math.max(P.length,O.length),Qe=Math.min(480,150+Ae*58),_e=Math.max(12,Math.min(G-we.left,we.width-pe-12)),$e=Math.max(12,Math.min(Q-we.top,we.height-Qe-12));B({left:_e,top:$e,flowPosition:r.screenToFlowPosition({x:G,y:Q}),draft:E,candidates:P,existingCandidates:O,mode:Y,query:""})},[Te,r,oe]),a$=m.useCallback(x=>{if(!oe){he("Readonly workspace"),B(null);return}const S=$.current;if(!S||!(x!=null&&x.def))return;const E=Ri(x.def,{position:S.flowPosition});if(!E)return;const P=S.draft.handleType==="source"?{source:S.draft.nodeId,sourceHandle:S.draft.handleId,target:E,targetHandle:`input-${x.slotIndex}`}:{source:E,sourceHandle:`output-${x.slotIndex}`,target:S.draft.nodeId,targetHandle:S.draft.handleId};g(O=>Ny(O,P)),w(O=>{const q=O.filter(G=>!(G.target===P.target&&G.targetHandle===P.targetHandle)),Y=Dp({...P,markerEnd:{type:fi.ArrowClosed}},q);return v.current=Y,Y}),B(null)},[Ri,w,oe]),l$=m.useCallback(x=>{if(!oe){he("Readonly workspace"),B(null);return}const S=x==null?void 0:x.connection;if(!S||!Ay(S,y.current)){he("端口类型不匹配,已取消连线"),B(null);return}g(E=>Ny(E,S)),w(E=>{const P=E.filter(q=>!(q.target===S.target&&q.targetHandle===S.targetHandle)),O=Dp({...S,markerEnd:{type:fi.ArrowClosed}},P);return v.current=O,O}),B(null)},[w,g,oe]),jS=m.useCallback(x=>{x&&(Ri(x,{position:xf()}),$n(!1),ti(""))},[Ri,xf]),CS=m.useCallback(x=>{x&&(Yc(x,xf()),$n(!1),ti(""))},[Yc,xf]),c$=m.useCallback(x=>{var E,P,O;if(ct||Ln)return;const S=x==null?void 0:x.target;N1(S)||(E=S==null?void 0:S.closest)!=null&&E.call(S,"button, a, [role='button'], .react-flow__handle")||(O=(P=b.current)==null?void 0:P.focus)==null||O.call(P,{preventScroll:!0})},[ct,Ln]);m.useEffect(()=>{const x=S=>{var le;if(S.defaultPrevented)return;const E=tU(S.target)||N1(S.target);if((S.metaKey||S.ctrlKey)&&S.key.toLowerCase()==="s"){S.preventDefault(),Yt().catch(we=>he(String(we.message||we)));return}if((S.metaKey||S.ctrlKey)&&S.key.toLowerCase()==="k"){S.preventDefault(),S.stopPropagation(),Av(we=>!we);return}if(ig)return;if(sg){(S.key==="Escape"||m1(S))&&(S.preventDefault(),nf(!1));return}const P=S.key.toLowerCase(),O=(S.metaKey||S.ctrlKey)&&P==="c",q=(S.metaKey||S.ctrlKey)&&P==="v",Y=E&&O&&XU(S.target);if(E&&!Y)return;const G=(S.metaKey||S.ctrlKey)&&!S.shiftKey&&P==="z",Q=(S.metaKey||S.ctrlKey)&&(S.shiftKey&&P==="z"||P==="y");if(G||Q){if(ct){S.preventDefault(),S.stopPropagation(),he("展示页布局会自动保存");return}if(!oe){S.preventDefault(),he("Readonly workspace");return}S.preventDefault(),S.stopPropagation();const we=G?Vv():Kv();he(we?G?"Undo canvas change":"Redo canvas change":G?"Nothing to undo":"Nothing to redo");return}if(O){if(ct)return;const we=Pe.current,pe=(y.current||[]).some(Qe=>Qe==null?void 0:Qe.selected)?y.current:(y.current||[]).map(Qe=>we&&Qe.id===we?{...Qe,selected:!0}:Qe),Ae=N7(pe,v.current,z.current);Ae&&(S.preventDefault(),S.stopPropagation(),K.current=Ae,Jq(Ae),Y&&typeof((le=S.target)==null?void 0:le.blur)=="function"&&S.target.blur(),he(`Copied ${Ae.nodes.length} node${Ae.nodes.length>1?"s":""}`));return}if(q){if(ct){S.preventDefault(),S.stopPropagation();return}if(!oe){S.preventDefault(),he("Readonly workspace");return}const we=K.current||Xq();we&&!K.current&&(K.current=we);const pe=j7(we,y.current,v.current,z.current);pe&&(S.preventDefault(),S.stopPropagation(),z.current=pe.instances,X(pe.instances),g(pe.nodes),w(pe.edges),he(`Pasted ${pe.pastedNodeIds.length} node${pe.pastedNodeIds.length>1?"s":""}`));return}if(m1(S)&&!S.metaKey&&!S.ctrlKey&&!S.altKey){S.preventDefault(),nf(!0);return}if(P==="g"&&!S.metaKey&&!S.ctrlKey&&!S.altKey){S.preventDefault(),mS();return}if(S.key==="a"||S.key==="A"){if(S.metaKey||S.ctrlKey){S.preventDefault(),ct?F(j.current.nodeIds):(g(we=>we.map(pe=>({...pe,selected:!0}))),w(we=>we.map(pe=>({...pe,selected:!1}))));return}if(S.altKey)return;if(ct){S.preventDefault(),Jt(!0);return}if(!oe){S.preventDefault(),he("Readonly workspace");return}S.preventDefault(),$n(!0);return}if((S.key==="v"||S.key==="V")&&!S.metaKey&&!S.ctrlKey&&!S.altKey){S.preventDefault(),Pv("select");return}if((S.key==="h"||S.key==="H")&&!S.metaKey&&!S.ctrlKey&&!S.altKey){S.preventDefault(),Pv("pan");return}(S.key==="f"||S.key==="F")&&!S.metaKey&&!S.ctrlKey&&!S.altKey&&(S.preventDefault(),hS())};return window.addEventListener("keydown",x,!0),()=>window.removeEventListener("keydown",x,!0)},[mS,ct,ig,hS,Kv,Yt,sg,w,g,Vv,oe]);const u$=m.useCallback(x=>{Ja(S=>{const E=new Set(S);return E.has(x)?E.delete(x):E.add(x),E})},[]),d$=m.useCallback((x,S)=>{x.dataTransfer.effectAllowed="copy",x.dataTransfer.setData("application/x-agentflow-workspace-file",JSON.stringify({path:S.path,name:S.name,type:S.type})),x.dataTransfer.setData("text/plain",S.path)},[]),f$=m.useCallback((x,S)=>{x.dataTransfer.effectAllowed="move",x.dataTransfer.setData("application/agentflow-node",S.id),x.dataTransfer.setData("text/plain",S.id)},[]),wf=m.useCallback(async(x,S)=>{const E=String((x==null?void 0:x.name)||(x==null?void 0:x.path)||"").toLowerCase(),P=E.split(".").pop(),O=["jsx","tsx","js"].includes(P)?"display_react_app":P==="html"?"display_html":P==="csv"||P==="tsv"||P==="json"&&/\b(table|data|rows|report)\b/i.test(E)?"display_table":["png","jpg","jpeg","gif","webp","svg"].includes(P)?"display_image":"display_markdown",q=Te.find(pe=>pe.id===O);if(!q){he("展示节点不可用");return}const Y=O==="display_image";let G=String(x.path||"");if(!Y){const pe=Cr(i);pe.set("path",x.path);const Ae=await fetch(`/api/workspace/file?${pe.toString()}`),Qe=await Ae.json();if(!Ae.ok)throw new Error(Qe.error||"读取文件失败");G=String(Qe.content||"")}const Q=O==="display_image"?"src":"content",le=Nu(q.inputs).map(pe=>pe.name===Q?{...pe,default:G,value:G}:pe),we=Nu(q.outputs).map(pe=>pe.name===Q?{...pe,default:G,value:G}:pe);Ri(q,{label:x.name||"Display",body:G,inputs:le,outputs:we,position:S}),he(`已创建展示:${x.path}`)},[Ri,i,Te]),p$=m.useCallback(x=>{if(!oe){he("Readonly workspace");return}wf(x,cl()).catch(S=>he(String(S.message||S)))},[wf,cl,oe]),h$=m.useCallback(x=>{if(!oe){x.preventDefault(),he("Readonly workspace");return}const S=x.dataTransfer.getData("application/x-agentflow-workspace-file");if(S){x.preventDefault();let Y;try{Y=JSON.parse(S)}catch{return}if(!(Y!=null&&Y.path))return;const G=r.screenToFlowPosition({x:x.clientX,y:x.clientY});wf(Y,G).catch(Q=>he(String(Q.message||Q)));return}const E=x.dataTransfer.getData("application/agentflow-snippet");if(E){const Y=it.find(Q=>`${Q.id}@${Q.version}`===E);if(!Y)return;x.preventDefault();const G=r.screenToFlowPosition({x:x.clientX,y:x.clientY});Yc(Y,G);return}const P=x.dataTransfer.getData("application/agentflow-node");if(!P)return;const O=Te.find(Y=>Y.id===P);if(!O)return;x.preventDefault();const q=r.screenToFlowPosition({x:x.clientX,y:x.clientY});Ri(O,{position:q})},[wf,Ri,it,Yc,Te,r,oe]),m$=m.useCallback(x=>{if(!oe)return;const S=Array.from(x.dataTransfer.types||[]);!S.includes("application/x-agentflow-workspace-file")&&!S.includes("application/agentflow-node")&&!S.includes("application/agentflow-snippet")||(x.preventDefault(),x.dataTransfer.dropEffect=S.includes("application/agentflow-node")||S.includes("application/agentflow-snippet")?"move":"copy")},[oe]),g$=m.useCallback(async(x="")=>{if(!oe){he("Readonly workspace");return}const S=window.prompt("新文件名",x?`${x}/notes.md`:"notes.md");if(!S)return;const E=x&&!S.includes("/")?`${x}/${S}`:S;try{const P=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:E,content:""})}),O=await P.json();if(!P.ok)throw new Error(O.error||"创建文件失败");await Nn(),Ja(q=>{const Y=new Set(q);for(const G of up(O.path||E))Y.delete(G);return Y}),he(`已创建 ${O.path}`)}catch(P){he(String(P.message||P))}},[i,Nn,oe]),y$=m.useCallback(async(x="")=>{if(!oe){he("Readonly workspace");return}const S=window.prompt("新文件夹名",x?`${x}/docs`:"docs");if(!S)return;const E=x&&!S.includes("/")?`${x}/${S}`:S;try{const P=await fetch("/api/workspace/folder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:E})}),O=await P.json();if(!P.ok)throw new Error(O.error||"创建文件夹失败");await Nn(),Ja(q=>{const Y=new Set(q);for(const G of up(O.path||E))Y.delete(G);return O.path&&Y.delete(O.path),Y}),he(`已创建 ${O.path}`)}catch(P){he(String(P.message||P))}},[i,Nn,oe]),x$=m.useCallback(async x=>{if(!oe){he("Readonly workspace");return}if(!(!(x!=null&&x.path)||!window.confirm(`删除 ${x.path}?`)))try{const S=await fetch("/api/workspace/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:x.path})}),E=await S.json();if(!S.ok)throw new Error(E.error||"删除失败");he(`已删除 ${E.path}`),await Nn()}catch(S){he(String(S.message||S))}},[i,Nn,oe]),w$=m.useCallback(x=>{if(!(x!=null&&x.path)||x.type==="directory")return;const S=vd(x.path,i,{download:!0});if(!S)return;const E=document.createElement("a");E.href=S,E.download=x.name||x.path.split("/").pop()||"download",E.rel="noopener",document.body.appendChild(E),E.click(),E.remove()},[i]),bf=m.useCallback(async()=>{if(!oe){he("Readonly workspace");return}const x=ta.trim(),S=$r,E=Es.find(Y=>Y.id===S)||null;if(!x||Jr||(E==null?void 0:E.status)==="running"||(E==null?void 0:E.status)==="stopping")return;const P=E?Array.isArray(E.messages)?E.messages:[]:na,O=yl(h,k,z.current);tg(""),vv(!0),el(!0),tl(null);const q={role:"user",text:x,at:Date.now()};E?Hn(Y=>Y.map(G=>G.id===S?{...G,status:"running",messages:[...Array.isArray(G.messages)?G.messages:[],q].slice(-180)}:G)):(fs("workspace"),Za(Y=>[...Y,q]));try{await Yt(h,k);const Y=await fetch("/api/workspace/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,prompt:x,outputKind:"markdown",workspaceGraph:O,allowFlowYaml:!1,model:Ei,selectedSkills:_s,selectedNodeIds:mf,messages:P})}),G=await Y.json();if(!Y.ok)throw new Error(G.error||"生成失败");const le={role:"assistant",kind:"assistant",text:String(G.content||"").trim(),at:Date.now()};E?Hn(we=>we.map(pe=>pe.id===S?{...pe,status:"done",messages:[...Array.isArray(pe.messages)?pe.messages:[],le].slice(-180)}:pe)):Za(we=>[...we,le]),await Xr(),he("AI 生成完成")}catch(Y){const G=String(Y.message||Y),Q={role:"assistant",text:G,error:!0,at:Date.now()};E?Hn(le=>le.map(we=>we.id===S?{...we,status:"failed",messages:[...Array.isArray(we.messages)?we.messages:[],Q].slice(-180)}:we)):Za(le=>[...le,Q]),he(G)}finally{vv(!1)}},[$r,na,Ei,Es,Jr,ta,k,i,Xr,h,Yt,mf,_s,oe]),Zn=Es.find(x=>x.id===$r)||null,xg=Zn?Array.isArray(Zn.messages)?Zn.messages:[]:na,ul=Zn&&(Zn.status==="running"||Zn.status==="stopping")||Jr,b$=RY(xg,ul),wg=TY(xg),_S=Zn?Zn.status==="stopping"?`${Zn.label} stopping`:Zn.status==="running"?`${Zn.label} running`:Zn.status==="paused"?`${Zn.label} paused`:Zn.status==="failed"?`${Zn.label} failed`:`${Zn.label} done`:Jr?"Workspace agent running":na.length>0?"Workspace conversation":"Ready";m.useEffect(()=>{$r!=="workspace"&&(Es.some(x=>x.id===$r)||fs(ia()))},[$r,Es,ia]),m.useEffect(()=>{if(!$c)return;const x=window.requestAnimationFrame(()=>{var E,P;const S=Sv.current;S&&(S.scrollTop=S.scrollHeight),(P=(E=ng.current)==null?void 0:E.scrollIntoView)==null||P.call(E,{block:"nearest",inline:"nearest"})});return()=>window.cancelAnimationFrame(x)},[xg.length,$r,_S,wg.length,$c]);const ES=String(i.flowId||"").trim()||"Workspace",lo=(Pt==null?void 0:Pt.mode)==="single-node",AS=lo&&qc.find(x=>{var S;return x.id===Pt.sourceNodeId||((S=Pt.nodeIds)==null?void 0:S.includes(x.id))})||null,k$=lo&&AS?[AS]:qc;return o.jsxs("div",{className:"af-workspace-page",children:[o.jsxs("header",{className:"af-pipeline-top af-workspace-top",children:[o.jsxs("div",{className:"af-pipeline-top-left",children:[o.jsx("button",{type:"button",className:"af-icon-btn af-pipeline-back",onClick:()=>n("/projects"),"aria-label":"返回",children:o.jsx("span",{className:"material-symbols-outlined",children:"arrow_back"})}),o.jsxs("div",{className:"af-pipeline-brand",title:i.flowId?`${i.flowId} · ${ge}`:ge||"PROJECT",children:[o.jsx("span",{className:"af-pipeline-brand-name",children:ES}),o.jsxs("span",{className:"af-pipeline-brand-ver",children:["V",HU,"-STABLE"]})]}),o.jsxs("div",{className:"af-view-switch","aria-label":"视图切换",children:[o.jsx("button",{type:"button",className:l==="workspace"?"af-view-switch__active":"",onClick:()=>yg("workspace"),children:"Workspace"}),o.jsx("button",{type:"button",className:l==="display"?"af-view-switch__active":"",onClick:()=>yg("display"),children:"Display"}),o.jsx("button",{type:"button",className:l==="workflow"?"af-view-switch__active":"",onClick:()=>yg("workflow"),children:"Workflow"})]})]}),o.jsxs("div",{className:"af-pipeline-top-right af-workspace-actions",children:[o.jsx("span",{className:`af-workspace-sync-light is-${Lv}`,title:`${Hv} · ${Ov}`,role:"status","aria-label":`${Hv}:${Ov}`,children:o.jsx("span",{className:"af-workspace-sync-light__dot","aria-hidden":!0})}),Sn?o.jsxs("button",{type:"button",className:"af-workspace-display-share-btn",onClick:()=>{var x;(x=Sn.conflictItems)!=null&&x.length?Zo(!0):SS()},title:["先下载当前本地草稿,再载入远端最新版本",...Sn.conflictPaths||[]].join(`
|
|
264
|
-
`),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"difference"}),"处理冲突"]}):null,ct?o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:"af-workspace-display-share-btn",disabled:bt||!(gt!=null&>.absoluteUrl)&&C.nodeIds.length===0,onClick:()=>{on(""),Yr(!0)},title:gt!=null&>.absoluteUrl?"查看展示链接":C.nodeIds.length===0?"先添加展示节点":"生成展示链接",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:bt?"hourglass_empty":"ios_share"}),bt?"生成中":gt!=null&>.absoluteUrl?"展示链接":"生成链接"]}),o.jsxs("button",{type:"button",className:"af-workspace-display-share-btn",disabled:ol.length===0,onClick:()=>Jt(!0),title:ol.length===0?"当前 workspace 没有 display 节点":"选择展示节点 (A)",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add_to_photos"}),"添加展示"]})]}):null,o.jsxs("button",{type:"button",className:"af-workspace-display-share-btn",disabled:!!(dt!=null&&dt.role&&dt.role!=="owner"),onClick:VM,title:dt!=null&&dt.role&&dt.role!=="owner"?"仅 Workspace 所有者可以创建邀请":"邀请其他成员协作编辑",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"group_add"}),"协作分享"]}),o.jsxs("button",{type:"button",className:"af-workspace-display-share-btn",onClick:YM,title:"查看我的展示分享",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"folder_shared"}),"我的分享"]}),o.jsx("button",{type:"button",className:"af-icon-btn",disabled:!Bv,onClick:()=>f(!0),"aria-label":e("project:archiveModal.title"),title:e("project:archiveModal.title"),children:o.jsx("span",{className:"material-symbols-outlined",children:"archive"})}),o.jsx("button",{type:"button",className:"af-icon-btn af-icon-btn--danger",disabled:!Bv&&!Hc,onClick:()=>p(!0),"aria-label":Hc?"退出共享 Workspace":e("flow:topbar.deletePipeline"),title:Hc?"退出共享 Workspace":e("flow:topbar.deletePipeline"),children:o.jsx("span",{className:"material-symbols-outlined",children:Hc?"logout":"delete_forever"})}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>nf(!0),"aria-label":"快捷键",title:"快捷键 (?)",children:o.jsx("span",{className:"material-symbols-outlined",children:"help"})}),o.jsx("button",{type:"button",className:"af-composer-topbar-btn"+($c?" af-composer-topbar-btn--active":"")+(Jr?" af-composer-topbar-btn--running":""),disabled:ct||Ln,onClick:()=>{tl(null),el(x=>(x||fs(ia()),!x))},children:"AI"}),o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!oe,onClick:()=>Yt().catch(x=>he(String(x.message||x))),children:"Save"})]})]}),Pn?o.jsxs("div",{className:"af-flow-snippet-toast",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"check_circle"}),o.jsx("span",{children:Pn}),o.jsx("button",{type:"button",onClick:()=>te(""),"aria-label":"关闭发布提示",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}):null,o.jsxs("div",{className:"af-workspace-body"+(!ct&&!Ln&&($c||Se)?" af-workspace-body--drawer":"")+(!ct&&!Ln&&Oc?" af-workspace-body--sidebar-collapsed":"")+(ct?" af-workspace-body--display-mode":"")+(Ln?" af-workspace-body--workflow-mode":""),children:[!ct&&!Ln&&Oc?o.jsx("nav",{className:"af-workspace-rail","aria-label":"Workspace sidebar",children:o.jsxs("div",{className:"af-workspace-rail__stack",children:[o.jsxs("button",{type:"button",className:"af-workspace-rail__primary",onClick:()=>$n(!0),"aria-label":"添加节点",title:"添加节点",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add"}),o.jsx("span",{className:"af-workspace-rail__dot","aria-hidden":!0})]}),o.jsx("button",{type:"button",className:"af-workspace-rail__btn",onClick:()=>tf(!1),"aria-label":"展开文件",title:"展开文件",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"folder"})}),o.jsx("span",{className:"af-workspace-rail__divider","aria-hidden":!0}),o.jsx("button",{type:"button",className:"af-workspace-rail__avatar",onClick:()=>tf(!1),"aria-label":"展开侧边栏",title:(Nr==null?void 0:Nr.username)||(Nr==null?void 0:Nr.userId)||"展开侧边栏",children:zM})]})}):null,!ct&&!Ln?o.jsxs("aside",{ref:rv,className:"af-workspace-sidebar"+(rM?" af-workspace-sidebar--resizing":""),"aria-hidden":Oc,style:{"--af-work-files-pane-height":`${Math.round(Ym)}px`},children:[o.jsxs("section",{className:"af-workspace-files-section",children:[o.jsxs("div",{className:"af-workspace-sidebar-head",children:[o.jsx("h2",{children:"Files"}),o.jsxs("div",{className:"af-workspace-sidebar-actions",children:[o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>tf(!0),"aria-label":"最小化侧边栏",title:"最小化侧边栏",children:o.jsx("span",{className:"material-symbols-outlined",children:"keyboard_double_arrow_left"})}),o.jsx("button",{type:"button",className:"af-icon-btn",disabled:!oe,onClick:()=>g$(Ii),"aria-label":"新增文件",title:Ii?`在 ${Ii} 新增文件`:"新增文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"note_add"})}),o.jsx("button",{type:"button",className:"af-icon-btn",disabled:!oe,onClick:()=>y$(Ii),"aria-label":"新增文件夹",title:Ii?`在 ${Ii} 新增文件夹`:"新增文件夹",children:o.jsx("span",{className:"material-symbols-outlined",children:"create_new_folder"})}),o.jsx("button",{type:"button",className:"af-icon-btn",disabled:!oe||tv,onClick:()=>iS(Ii),"aria-label":"上传文件",title:Ii?`上传到 ${Ii}`:"上传文件",children:o.jsx("span",{className:"material-symbols-outlined",children:tv?"hourglass_top":"upload_file"})}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>void Nn(),"aria-label":"刷新文件",title:"刷新文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"refresh"})}),o.jsx("input",{ref:sv,type:"file",multiple:!0,className:"af-visually-hidden",onChange:EM})]})]}),o.jsx("input",{className:"af-workspace-search",value:Vm,onChange:x=>eM(x.target.value),placeholder:"搜索文件..."}),o.jsx("div",{className:"af-workspace-files-scroll",onClick:DM,children:o.jsx(ZR,{items:OM,onOpen:p$,selectedPath:Km,collapsedDirs:tM,onToggleDir:u$,onSelect:x=>Um(x.path||""),onFileDragStart:d$,onDelete:x$,onDownload:w$})})]}),o.jsx("button",{type:"button",className:"af-workspace-sidebar-resizer",onPointerDown:fM,role:"separator","aria-orientation":"horizontal","aria-label":"调整 Files 和 Palette 区域大小",title:"拖动调整 Files / Palette 高度"}),o.jsxs("section",{className:"af-workspace-nodes-section",children:[o.jsxs("div",{className:"af-node-palette-head af-workspace-node-palette-head",children:[o.jsxs("h2",{className:"af-node-palette-title",children:[o.jsx("span",{children:"Palette"}),o.jsx("span",{className:"af-node-palette-title-kbd","aria-label":"快捷键 A",children:"A"})]}),o.jsxs("label",{className:"af-palette-search-wrap",children:[o.jsx("span",{className:"af-visually-hidden",children:mt==="flows"?"搜索流程片段":"搜索节点"}),o.jsx("span",{className:"af-palette-search-icon material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{type:"search",className:"af-palette-search-input",value:nt,onChange:x=>wt(x.target.value),placeholder:mt==="flows"?"搜索流程片段...":"搜索节点...","aria-label":mt==="flows"?"搜索流程片段":"搜索节点"})]}),o.jsxs("div",{className:"af-palette-tabs",role:"tablist","aria-label":"Palette 类型",children:[o.jsxs("button",{type:"button",role:"tab","aria-selected":mt==="nodes",className:"af-palette-tab"+(mt==="nodes"?" af-palette-tab--active":""),onClick:()=>Re("nodes"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"category"}),"节点"]}),o.jsxs("button",{type:"button",role:"tab","aria-selected":mt==="flows",className:"af-palette-tab"+(mt==="flows"?" af-palette-tab--active":""),onClick:()=>Re("flows"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"account_tree"}),"流程"]})]})]}),o.jsx("div",{className:"af-node-palette-scroll af-workspace-node-palette-scroll",children:mt==="flows"?o.jsxs(o.Fragment,{children:[o.jsx("section",{className:"af-palette-section af-flow-palette-section--snippets",children:o.jsxs("div",{className:"af-flow-snippet-actions",children:[o.jsxs("button",{type:"button",className:"af-flow-snippet-publish-btn",onClick:HM,disabled:Gn.length<2,title:Gn.length<2?"选择至少两个节点后发布流程片段":"发布选中的流程片段",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"ios_share"}),"发布选中片段"]}),o.jsxs("span",{className:"af-flow-snippet-selection",children:["已选 ",Gn.length," 节点 / ",gf.length," 连线"]})]})}),rt?o.jsx("p",{className:"af-err af-palette-list-err",children:rt}):null,qt?o.jsx("p",{className:"af-palette-empty",children:"正在加载流程片段..."}):bS.length>0?o.jsxs("section",{className:"af-palette-section af-flow-palette-section--snippets",children:[o.jsx("h3",{className:"af-palette-cat",children:"FLOW SNIPPETS"}),o.jsx("div",{className:"af-palette-cards",children:bS.map(x=>{const S=`${x.id}@${x.version}`,E=x.displayName||x.name||x.id,P=x.description||`${x.nodeCount||0} 个节点,${x.edgeCount||0} 条连线`;return o.jsxs("button",{type:"button",className:"af-palette-card af-flow-snippet-card",draggable:!0,onDragStart:O=>{O.dataTransfer.effectAllowed="move",O.dataTransfer.setData("application/agentflow-snippet",S),O.dataTransfer.setData("text/plain",S)},onClick:()=>Yc(x),title:P,children:[o.jsxs("span",{className:"af-palette-card-head",children:[o.jsx("span",{className:"af-palette-card-icon","aria-hidden":!0,children:o.jsx("span",{className:"material-symbols-outlined",children:"account_tree"})}),o.jsxs("span",{className:"af-palette-card-main",children:[o.jsx("span",{className:"af-palette-card-label",children:E}),o.jsxs("span",{className:"af-palette-card-id",children:[x.id,"@",x.version]})]})]}),P?o.jsx("span",{className:"af-palette-card-desc",children:P}):null,o.jsxs("span",{className:"af-flow-snippet-meta","aria-hidden":!0,children:[o.jsxs("span",{children:[x.nodeCount||0," nodes"]}),o.jsxs("span",{children:[x.edgeCount||0," edges"]})]})]},S)})})]}):o.jsx("p",{className:"af-palette-empty",children:nt.trim()?"没有匹配的流程片段":"暂无流程片段。选择多个节点后发布。"})]}):o.jsxs(o.Fragment,{children:[bl.map(x=>{var S;return(S=pg[x])!=null&&S.length?o.jsxs("section",{className:`af-palette-section af-flow-palette-section--${x}`,children:[o.jsx("h3",{className:"af-palette-cat",children:x}),o.jsx("div",{className:"af-palette-cards",children:pg[x].map(E=>{const P=T1(E.inputs,"input"),O=T1(E.outputs,"output"),q=Aw(E),Y=vu(E);return o.jsxs("button",{type:"button",className:"af-palette-card",draggable:!0,onDragStart:G=>f$(G,E),onClick:()=>Ri(E),title:q||E.id,children:[o.jsxs("span",{className:"af-palette-card-head",children:[o.jsx("span",{className:"af-palette-card-icon","aria-hidden":!0,children:o.jsx("span",{className:"material-symbols-outlined",children:I1(x)})}),o.jsxs("span",{className:"af-palette-card-main",children:[o.jsx("span",{className:"af-palette-card-label",children:Y}),Y!==E.id?o.jsx("span",{className:"af-palette-card-id",children:E.id}):null]})]}),q?o.jsx("span",{className:"af-palette-card-desc",children:q}):null,o.jsxs("span",{className:"af-palette-card-ports","aria-hidden":!0,children:[o.jsxs("span",{className:"af-palette-card-port-side af-palette-card-port-side--in",children:[o.jsxs("span",{className:"af-palette-card-port-count",children:[P.list.length," IN"]}),o.jsxs("span",{className:"af-palette-card-port-list",children:[P.shown.map((G,Q)=>o.jsxs("span",{className:"af-palette-card-port",title:R1("input",G,Q),children:[o.jsx("span",{className:"af-palette-card-port-dot",style:{background:_n(G==null?void 0:G.type)}}),o.jsx("span",{className:"af-palette-card-port-name",children:lp(G,Q)})]},`in-${Q}`)),P.hidden>0?o.jsxs("span",{className:"af-palette-card-port-more",children:["+",P.hidden]}):null]})]}),o.jsxs("span",{className:"af-palette-card-port-side af-palette-card-port-side--out",children:[o.jsxs("span",{className:"af-palette-card-port-count",children:[O.list.length," OUT"]}),o.jsxs("span",{className:"af-palette-card-port-list",children:[O.shown.map((G,Q)=>o.jsxs("span",{className:"af-palette-card-port",title:R1("output",G,Q),children:[o.jsx("span",{className:"af-palette-card-port-name",children:lp(G,Q)}),o.jsx("span",{className:"af-palette-card-port-dot",style:{background:_n(G==null?void 0:G.type)}})]},`out-${Q}`)),O.hidden>0?o.jsxs("span",{className:"af-palette-card-port-more",children:["+",O.hidden]}):null]})]})]})]},E.id)})})]},x):null}),Te.length>0&&nt.trim()&&bl.every(x=>{var S;return!((S=pg[x])!=null&&S.length)})?o.jsx("p",{className:"af-palette-empty",children:"没有匹配的节点"}):null]})})]})]}):null,Ln?o.jsx(UY,{projectId:ES,tapdId:ar,setTapdId:cM,snapshot:tn,loading:uM,error:dM,actionRunning:Gm,actionOutput:Jm,pendingConfirm:ds,conflict:Tc,reviewPublishing:Xm,onRefresh:()=>of(ar),onRunDryRun:kM,onConfirmAction:vM,onRetryConflict:SM,onPublishReview:NM}):o.jsxs("main",{ref:b,className:"af-workspace-canvas",tabIndex:-1,onPointerDownCapture:c$,children:[o.jsx(yI,{className:"af-flow-canvas af-workspace-flow"+(og==="pan"?" af-flow-canvas--tool-pan":" af-flow-canvas--tool-select")+(ct?" af-workspace-flow--display-mode":""),nodes:TM,edges:MM,nodeTypes:NY,onNodesChange:t$,onEdgesChange:n$,onConnect:ct?void 0:s$,onConnectStart:ct?void 0:i$,onConnectEnd:ct?void 0:o$,isValidConnection:ct?void 0:r$,onNodeClick:(x,S)=>{var E;if(ct){F([Py(S.id)]);return}if((E=S==null?void 0:S.data)!=null&&E.isWorkspaceGroup){be("");return}if(x.detail>=3){el(!1),g(P=>P.map(O=>({...O,selected:O.id===S.id}))),w(P=>P.map(O=>({...O,selected:!1}))),be(S.id);return}ie&&be(S.id)},onNodeDoubleClick:x=>{x.preventDefault()},onPaneClick:()=>{ct?F([]):be("")},onDrop:ct?void 0:h$,onDragOver:ct?void 0:m$,nodesDraggable:ct?!0:oe,nodesConnectable:ct?!1:oe,edgesReconnectable:ct?!1:oe,deleteKeyCode:ct?null:oe?["Backspace","Delete"]:null,selectionOnDrag:og==="select",panOnDrag:og==="pan"?!0:[1,2],panActivationKeyCode:"Space",proOptions:{hideAttribution:!0},fitView:!1,minZoom:.1,maxZoom:4,children:o.jsx(wI,{color:"rgba(255,255,255,0.12)",gap:22,size:1})}),!ct&&R?(()=>{var G;const x=String(R.query||"").trim().toLowerCase(),S=R.mode==="create"?"create":"existing",E=Array.isArray(R.candidates)?R.candidates:[],P=Array.isArray(R.existingCandidates)?R.existingCandidates:[],O=x?E.filter(Q=>{var le,we,pe;return[(le=Q.def)==null?void 0:le.id,Q.displayLabel,Q.description,(we=Q.slot)==null?void 0:we.name,(pe=Q.slot)==null?void 0:pe.type].filter(Boolean).some(Ae=>String(Ae).toLowerCase().includes(x))}):E,q=x?P.filter(Q=>{var le,we;return[Q.nodeId,Q.nodeLabel,Q.definitionId,(le=Q.slot)==null?void 0:le.name,(we=Q.slot)==null?void 0:we.type].filter(Boolean).some(pe=>String(pe).toLowerCase().includes(x))}):P,Y=R.draft.handleType==="source"?"IN":"OUT";return o.jsxs("div",{className:"af-connect-node-menu",style:{left:R.left,top:R.top},role:"dialog","aria-label":"选择匹配节点",children:[o.jsxs("div",{className:"af-connect-node-menu__head",children:[o.jsxs("div",{className:"af-connect-node-menu__title",children:[o.jsx("span",{className:"af-connect-node-menu__dot",style:{background:_n((G=R.draft.slot)==null?void 0:G.type)},"aria-hidden":!0}),o.jsxs("span",{children:["匹配 ",R.draft.slotType," 节点"]})]}),o.jsx("button",{type:"button",className:"af-connect-node-menu__close","aria-label":"关闭",onClick:()=>B(null),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),o.jsxs("div",{className:"af-connect-node-menu__tabs",role:"tablist","aria-label":"连接方式",children:[o.jsxs("button",{type:"button",className:S==="existing"?"af-connect-node-menu__tab af-connect-node-menu__tab--active":"af-connect-node-menu__tab",disabled:P.length===0,onClick:()=>B(Q=>Q&&{...Q,mode:"existing",query:""}),children:["连接已有 ",o.jsx("span",{children:P.length})]}),o.jsxs("button",{type:"button",className:S==="create"?"af-connect-node-menu__tab af-connect-node-menu__tab--active":"af-connect-node-menu__tab",disabled:E.length===0,onClick:()=>B(Q=>Q&&{...Q,mode:"create",query:""}),children:["新建节点 ",o.jsx("span",{children:E.length})]})]}),o.jsxs("label",{className:"af-connect-node-menu__search",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{type:"search",value:R.query,onChange:Q=>B(le=>le&&{...le,query:Q.target.value}),placeholder:"搜索节点",autoFocus:!0})]}),o.jsxs("div",{className:"af-connect-node-menu__list",children:[S==="create"?O.map(Q=>{var pe,Ae;const le=Q.displayLabel||((pe=Q.def)==null?void 0:pe.id),we=lp(Q.slot,Q.slotIndex);return o.jsxs("button",{type:"button",className:"af-connect-node-menu__item",onClick:()=>a$(Q),title:Q.description||Q.def.id,children:[o.jsxs("span",{className:"af-connect-node-menu__item-main",children:[o.jsx("span",{className:"af-connect-node-menu__item-label",children:le}),le!==Q.def.id?o.jsx("span",{className:"af-connect-node-menu__item-id",children:Q.def.id}):null]}),o.jsxs("span",{className:"af-connect-node-menu__port",children:[o.jsx("span",{children:Y}),o.jsx("span",{className:"af-connect-node-menu__port-dot",style:{background:_n((Ae=Q.slot)==null?void 0:Ae.type)},"aria-hidden":!0}),o.jsx("span",{className:"af-connect-node-menu__port-name",children:we})]})]},`${Q.def.id}-${Q.slotIndex}`)}):q.map(Q=>{var pe;const le=Q.nodeLabel||Q.nodeId,we=lp(Q.slot,Q.slotIndex);return o.jsxs("button",{type:"button",className:"af-connect-node-menu__item",onClick:()=>l$(Q),title:`${Q.definitionId||Q.nodeId} · ${we}`,children:[o.jsxs("span",{className:"af-connect-node-menu__item-main",children:[o.jsx("span",{className:"af-connect-node-menu__item-label",children:le}),o.jsxs("span",{className:"af-connect-node-menu__item-id",children:[Q.definitionId?`${Q.definitionId} · `:"",Q.nodeId]})]}),o.jsxs("span",{className:"af-connect-node-menu__port",children:[o.jsx("span",{children:Y}),o.jsx("span",{className:"af-connect-node-menu__port-dot",style:{background:_n((pe=Q.slot)==null?void 0:pe.type)},"aria-hidden":!0}),o.jsx("span",{className:"af-connect-node-menu__port-name",children:we}),Q.occupied?o.jsx("span",{className:"af-connect-node-menu__port-badge",children:"替换"}):null]})]},`${Q.nodeId}-${Q.handleId}`)}),(S==="create"?O.length:q.length)===0?o.jsx("div",{className:"af-connect-node-menu__empty",children:"没有匹配结果"}):null]})]})})():null,!ct&&!Ln&&!gM?o.jsx("div",{className:"af-workspace-composer af-bottom-composer-stack af-flow-bottom-composer",children:o.jsxs("div",{className:"af-pipeline-composer-inner",children:[o.jsx("button",{type:"button",className:"af-workspace-composer-minimize",onClick:()=>rg(!0),"aria-label":"最小化 AI 输入框",title:"最小化",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"remove"})}),o.jsx("div",{className:"af-composer-selected","aria-label":"Selected workspace nodes",children:Gn.length===0?o.jsx("span",{className:"af-composer-selected-empty",children:"选择画布节点后,可作为本次 Workspace AI 的上下文。"}):Gn.map(x=>{var O,q;const S=String(((O=x.data)==null?void 0:O.label)??x.id),E=(q=x.data)!=null&&q.definitionId?String(x.data.definitionId):"",P=E&&E!==S?`${S} · ${x.id} · ${E}`:`${S} · ${x.id}`;return o.jsxs("div",{className:"af-composer-node-chip",title:P,children:[o.jsx("span",{className:"af-composer-node-chip-kind",children:E||"node"}),o.jsx("span",{className:"af-composer-node-chip-label",children:S}),o.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>e$(x.id),"aria-label":`取消选择 ${x.id}`,children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},x.id)})}),o.jsxs("div",{className:"af-composer-card af-composer-card--input-only",children:[o.jsx("div",{className:"af-composer-input-wrap",children:o.jsx("textarea",{className:"af-composer-textarea",value:ta,rows:2,onChange:x=>tg(x.target.value),onKeyDown:x=>{(x.metaKey||x.ctrlKey)&&x.key==="Enter"&&(x.preventDefault(),bf())},placeholder:"描述你想在 workspace 中生成、分析或展示的内容",autoComplete:"off",spellCheck:!1,disabled:!oe})}),o.jsxs("div",{className:"af-composer-toolbar",children:[o.jsxs("div",{className:"af-composer-skills-field",children:[o.jsxs("button",{ref:eg,type:"button",className:"af-composer-skills-button"+(_s.length>0?" af-composer-skills-button--active":""),disabled:Jr||!oe,"aria-haspopup":"listbox","aria-expanded":ef,onClick:()=>Zm(x=>!x),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"extension"}),o.jsx("span",{children:_s.length>0?`Skills ${_s.length}`:"Skills"})]}),ef&&!Jr?cr.createPortal(o.jsx("div",{ref:bv,className:"af-composer-skills-menu",role:"listbox","aria-label":"Skills",style:hM,children:Cs.length===0?o.jsx("div",{className:"af-composer-skills-empty",children:"No skills found"}):o.jsxs(o.Fragment,{children:[al.groups.map(x=>{const S=Ho(x,Cs),E=hD(x,hg,Cs),P=pM.has(x.id);return o.jsxs("div",{className:"af-composer-skill-group af-composer-skill-group--framed"+(P?" af-composer-skill-group--collapsed":""),children:[o.jsxs("div",{className:"af-composer-skill-group-title af-composer-skill-group-title--selectable",children:[o.jsxs("label",{className:"af-composer-skill-group-check",children:[o.jsx("input",{type:"checkbox",checked:E==="all",disabled:S.length===0,onChange:O=>{const q=O.target.checked;Rc(Y=>q?fD(Y,S):pD(Y,S))}}),o.jsxs("span",{className:"af-composer-skill-group-title-main",children:[o.jsx("span",{children:x.name}),x.builtin?o.jsx("em",{children:"built-in"}):null,E==="partial"?o.jsx("em",{children:"partial"}):null]})]}),o.jsxs("button",{type:"button",className:"af-composer-skill-group-toggle","aria-label":P?`展开 ${x.name}`:`收起 ${x.name}`,onClick:()=>{wv(O=>{const q=new Set(O);return q.has(x.id)?q.delete(x.id):q.add(x.id),q})},children:[o.jsx("span",{children:x.skills.length}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:P?"expand_more":"expand_less"})]})]}),P?null:o.jsx("div",{className:"af-composer-skill-group-items",children:x.skills.map(O=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:hg.has(O.key),onChange:q=>{const Y=q.target.checked;Rc(G=>Y?G.includes(O.key)?G:[...G,O.key]:G.filter(Q=>Q!==O.key))}}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:O.name}),O.description?o.jsx("span",{className:"af-composer-skill-option-desc",children:O.description}):null]})]},`${x.id}:${O.key}`))})]},x.id)}),al.ungrouped.length>0?o.jsxs("div",{className:"af-composer-skill-group",children:[o.jsxs("div",{className:"af-composer-skill-group-title",children:[o.jsx("span",{children:"Ungrouped"}),o.jsx("span",{children:al.ungrouped.length})]}),al.ungrouped.map(x=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:hg.has(x.key),onChange:S=>{const E=S.target.checked;Rc(P=>E?P.includes(x.key)?P:[...P,x.key]:P.filter(O=>O!==x.key))}}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:x.name}),x.description?o.jsx("span",{className:"af-composer-skill-option-desc",children:x.description}):null]})]},`ungrouped:${x.key}`))]}):null]})}),document.body):null]}),o.jsx("label",{className:"af-composer-model-field",children:o.jsxs("select",{className:"af-composer-model-select",value:Ei,onChange:x=>iM(x.target.value),"aria-label":"模型",children:[o.jsx("option",{value:"",children:"默认模型"}),FM.map(x=>o.jsx("option",{value:x.value,children:x.label},x.value))]})}),o.jsx("button",{type:"button",className:"af-composer-send"+(ta.trim()&&!Jr?" af-composer-send--active":"")+(Jr?" af-composer-send--stop":""),disabled:Jr||!ta.trim()||!oe,"aria-label":Jr?"Running":"Send",onClick:()=>void bf(),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:Jr?"sync":"arrow_upward"})})]})]})]})}):!ct&&!Ln?o.jsx("button",{type:"button",className:"af-workspace-composer-fab",onClick:()=>rg(!1),"aria-label":"展开 AI 输入框",title:"展开 AI 输入框",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"auto_awesome"})}):null]}),!ct&&!Ln&&$c?o.jsx("aside",{className:"af-pipeline-drawer af-pipeline-drawer--wide af-workspace-composer-drawer","aria-label":"Workspace AI Composer",children:o.jsxs("div",{className:"af-composer-sidebar",children:[o.jsxs("div",{className:"af-pipeline-drawer-head",children:[o.jsx("h2",{className:"af-pipeline-drawer-title",children:"AI Composer"}),o.jsx("button",{type:"button",className:"af-pipeline-drawer-close af-icon-btn",onClick:()=>el(!1),"aria-label":"关闭 AI 对话侧栏",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-composer-session-tabs",children:[o.jsx("button",{type:"button",className:"af-composer-session-tab"+($r==="workspace"?" af-composer-session-tab--active":""),ref:$r==="workspace"?ng:null,onClick:()=>fs("workspace"),children:o.jsx("span",{className:"af-composer-session-label",children:"Workspace"})}),Es.map(x=>o.jsxs("div",{role:"tab",tabIndex:0,ref:$r===x.id?ng:null,className:"af-composer-session-tab"+($r===x.id?" af-composer-session-tab--active":"")+(x.status==="running"||x.status==="stopping"?" af-composer-session-tab--running":""),onClick:()=>fs(x.id),onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),fs(x.id))},title:x.runNodeId||x.label,children:[o.jsx("span",{className:"af-composer-session-label",children:x.label}),o.jsx("button",{type:"button",className:"af-composer-session-close",onClick:S=>{S.preventDefault(),S.stopPropagation(),CM(x.id)},"aria-label":`关闭 ${x.label}`,title:"关闭 tab",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]},x.id))]}),o.jsx("div",{className:"af-composer-sidebar-status"+(ul?" af-composer-sidebar-status--running":""),role:"status","aria-live":"polite",children:_S}),o.jsxs("div",{className:"af-composer-sidebar-thread",ref:Sv,children:[o.jsx(V1,{messages:b$,running:ul,showRunningIndicator:!Zn}),wg.length>0?o.jsxs("details",{className:"af-composer-sidebar-log-details",...ul?{open:!0}:{},children:[o.jsx("summary",{children:"执行日志"}),o.jsx(V1,{messages:wg,running:!1,showRunningIndicator:!1})]}):null]}),o.jsxs("div",{className:"af-composer-sidebar-input",children:[o.jsx("textarea",{className:"af-composer-sidebar-textarea",value:ta,rows:3,onChange:x=>tg(x.target.value),onKeyDown:x=>{(x.metaKey||x.ctrlKey)&&x.key==="Enter"&&(x.preventDefault(),bf())},placeholder:Zn?"继续追问、总结或要求调整这次结果":"继续描述你想让 AI 在 workspace 中做什么",disabled:!oe||ul}),o.jsx("button",{type:"button",className:"af-composer-sidebar-send",disabled:!oe||ul||!ta.trim(),onClick:()=>void bf(),"aria-label":"发送 AI 对话",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_upward"})})]})]})}):!ct&&!Ln&&Se&&nn?o.jsx("aside",{className:"af-pipeline-drawer af-workspace-node-drawer","aria-label":"Workspace Node Properties",children:o.jsx(SU,{draft:Se,setDraft:xt,definitionId:String(((PS=nn.data)==null?void 0:PS.definitionId)||nn.id),systemPromptReadonly:String(((IS=nn.data)==null?void 0:IS.description)||""),modelLists:ea,disabled:!oe,onIdBlur:()=>fg(!0),onClose:()=>be(""),onPublishToMarketplace:jM,error:or,ioSlots:{inputs:Array.isArray(Se==null?void 0:Se.inputs)?Se.inputs:[],outputs:Array.isArray(Se==null?void 0:Se.outputs)?Se.outputs:[]}})}):null,!ct&&!Ln&&Lc?cr.createPortal(o.jsx("div",{className:"af-workspace-run-logs-overlay",role:"presentation",onMouseDown:()=>tl(null),children:o.jsx("aside",{className:"af-workspace-run-logs-drawer","aria-label":"Workspace Run Logs",onMouseDown:x=>x.stopPropagation(),children:o.jsx(lU,{flowParams:i,scheduleNodeId:Lc.scheduleNodeId,runNodeId:Lc.runNodeId,lastRunId:Lc.lastRunId,label:Lc.label,onClose:()=>tl(null)})})}),document.body):null,o.jsx(sU,{open:sg,onClose:()=>nf(!1)}),o.jsx(oU,{open:ig,onClose:()=>Av(!1),onJump:LM,nodes:$M}),o.jsx(NU,{open:u,onClose:()=>f(!1),flowId:i.flowId||"",flowSource:Bc,onArchived:()=>{f(!1),n("/projects?tab=archived")}}),o.jsx(jU,{open:d&&!!i.flowId,onClose:()=>p(!1),flowId:i.flowId||"",flowSource:Bc,flowArchived:!!i.archived,workspaceId:i.workspaceId||"",leaveShared:Hc,onDeleted:async()=>{p(!1),n("/projects")}}),ZT&&Sn?cr.createPortal(o.jsx("div",{className:"af-flow-snippet-modal-overlay",children:o.jsxs("div",{className:"af-flow-snippet-modal af-workspace-conflict-modal",role:"dialog","aria-modal":"true","aria-label":"解决 Workspace 冲突",children:[o.jsxs("div",{className:"af-flow-snippet-modal__head",children:[o.jsxs("span",{className:"af-flow-snippet-modal__title",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"difference"}),"解决 ",((RS=Sn.conflictItems)==null?void 0:RS.length)||0," 处字段冲突"]}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>Zo(!1),"aria-label":"关闭",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),o.jsxs("div",{className:"af-flow-snippet-modal__body",children:[o.jsxs("div",{className:"af-workspace-conflict-summary",children:["未冲突的改动已经自动合并。这里只需要决定双方同时修改的字段。",o.jsxs("div",{className:"af-workspace-conflict-bulk",children:[o.jsx("button",{type:"button",onClick:()=>Ga(Object.fromEntries((Sn.conflictItems||[]).map((x,S)=>[String(S),{mode:"local",manual:uu(x)}]))),children:"全部保留我的"}),o.jsx("button",{type:"button",onClick:()=>Ga(Object.fromEntries((Sn.conflictItems||[]).map((x,S)=>[String(S),{mode:"remote",manual:uu(x)}]))),children:"全部使用远端"})]})]}),(Sn.conflictItems||[]).map((x,S)=>{const E=Wm[String(S)]||{mode:"local",manual:uu(x)};return o.jsxs("section",{className:"af-workspace-conflict-item",children:[o.jsx("code",{className:"af-workspace-conflict-path",children:x.path}),o.jsx("div",{className:"af-workspace-conflict-options",children:[["local","保留我的"],["remote","使用远端"],["manual","手动编辑"]].map(([P,O])=>o.jsx("button",{type:"button",className:E.mode===P?"is-active":"",onClick:()=>Ga(q=>({...q,[String(S)]:{...E,mode:P}})),children:O},P))}),o.jsxs("div",{className:"af-workspace-conflict-values",children:[o.jsxs("div",{className:E.mode==="local"?"is-selected":"",children:[o.jsx("span",{children:"我的修改"}),o.jsx("pre",{children:Z1(x,"incoming")})]}),o.jsxs("div",{className:E.mode==="remote"?"is-selected":"",children:[o.jsx("span",{children:"远端修改"}),o.jsx("pre",{children:Z1(x,"current")})]})]}),E.mode==="manual"?o.jsxs("label",{className:"af-workspace-conflict-manual",children:[o.jsx("span",{children:"最终值(JSON)"}),o.jsx("textarea",{value:E.manual,onChange:P=>Ga(O=>({...O,[String(S)]:{...E,manual:P.target.value}})),rows:5})]}):null]},`${x.path||"conflict"}-${S}`)}),ev?o.jsx("div",{className:"af-flow-snippet-error",children:ev}):null]}),o.jsxs("div",{className:"af-flow-snippet-modal__foot af-workspace-conflict-foot",children:[o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",disabled:Jd,onClick:()=>void SS(),children:"备份并载入远端"}),o.jsx("span",{className:"af-workspace-conflict-foot__spacer"}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",disabled:Jd,onClick:()=>Zo(!1),children:"稍后处理"}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:Jd||!(Sn.conflictItems||[]).length,onClick:()=>void UM(),children:Jd?"保存中...":"应用选择并保存"})]})]})}),document.body):null,ve?cr.createPortal(o.jsx("div",{className:"af-flow-snippet-modal-overlay",children:o.jsxs("div",{className:"af-flow-snippet-modal",role:"dialog","aria-modal":"true","aria-label":"发布流程片段",children:[o.jsxs("div",{className:"af-flow-snippet-modal__head",children:[o.jsxs("span",{className:"af-flow-snippet-modal__title",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"ios_share"}),"发布流程片段"]}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>He(!1),"aria-label":"关闭",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),o.jsxs("div",{className:"af-flow-snippet-modal__body",children:[o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"名称"}),o.jsx("input",{type:"text",value:Ge.name,onChange:x=>{const S=x.target.value;je(E=>({...E,name:S,id:E.id?E.id:S.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")}))},placeholder:"例如:内容整理片段",autoFocus:!0})]}),o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"ID"}),o.jsx("input",{type:"text",value:Ge.id,onChange:x=>je(S=>({...S,id:x.target.value})),placeholder:"content-cleanup-snippet"})]}),o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"说明"}),o.jsx("textarea",{value:Ge.description,onChange:x=>je(S=>({...S,description:x.target.value})),placeholder:"这段流程适合什么 workspace 场景、需要接哪些上下游。",rows:4})]}),o.jsxs("div",{className:"af-flow-snippet-summary",children:["将发布 ",Gn.length," 个节点和 ",gf.length," 条内部连线。"]}),dn?o.jsx("div",{className:"af-flow-snippet-error",children:dn}):null]}),o.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>He(!1),children:"取消"}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:Tt||!Ge.name.trim(),onClick:()=>void WM(),children:Tt?"发布中...":"发布"})]})]})}),document.body):null,pS?o.jsx(fY,{node:pS,onClose:()=>Wt("")}):null,We?cr.createPortal(o.jsx("div",{className:"af-flow-snippet-modal-overlay",children:o.jsxs("div",{className:"af-flow-snippet-modal af-display-share-modal",role:"dialog","aria-modal":"true","aria-label":lo?"新建分享":"发布展示页",children:[o.jsxs("div",{className:"af-flow-snippet-modal__head",children:[o.jsxs("span",{className:"af-flow-snippet-modal__title",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"present_to_all"}),lo?"新建分享":"发布展示页"]}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>Ke(!1),"aria-label":"关闭",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),o.jsxs("div",{className:"af-flow-snippet-modal__body",children:[o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"标题"}),o.jsx("input",{type:"text",value:Pt.title,onChange:x=>fn(S=>({...S,title:x.target.value})),placeholder:"展示页标题",autoFocus:!0})]}),lo?null:o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"布局"}),o.jsxs("select",{className:"af-display-share-select",value:Pt.layout,onChange:x=>fn(S=>({...S,layout:x.target.value})),children:[o.jsx("option",{value:"gallery",children:"Gallery"}),o.jsx("option",{value:"document",children:"Document"}),o.jsx("option",{value:"slides",children:"Slides"})]})]}),o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"有效期"}),o.jsx("select",{className:"af-display-share-select",value:O1(Pt),onChange:x=>{const S=x.target.value;fn(E=>({...E,permanent:S==="permanent",expiresInDays:S==="permanent"?E.expiresInDays||30:Number(S)}))},children:Iy.map(x=>o.jsx("option",{value:x.value,children:x.label},x.value))})]}),o.jsxs("div",{className:"af-display-share-node-list",role:"group","aria-label":lo?"分享内容":"选择展示节点",children:[lo?o.jsx("span",{className:"af-display-share-node-list__label",children:"分享内容"}):null,k$.map(x=>{var E;const S=Array.isArray(Pt.nodeIds)&&Pt.nodeIds.includes(x.id);return o.jsxs("label",{className:"af-display-share-node-row",children:[o.jsx("input",{type:"checkbox",checked:S,disabled:lo,onChange:()=>qM(x.id)}),o.jsxs("span",{className:"af-display-share-node-row__main",children:[o.jsx("strong",{children:((E=x.data)==null?void 0:E.label)||x.id}),o.jsxs("small",{children:[jn(x.data)," · ",x.id]})]})]},x.id)})]}),gt!=null&>.absoluteUrl?o.jsxs("div",{className:"af-display-share-result",children:[o.jsx("input",{type:"text",readOnly:!0,value:gt.absoluteUrl,onFocus:x=>x.target.select()}),o.jsx("button",{type:"button",onClick:()=>window.open(gt.absoluteUrl,"_blank","noopener,noreferrer"),children:"打开"}),o.jsx("button",{type:"button",onClick:()=>void NS(),children:pr==="copied"?"已复制":pr==="failed"?"复制失败":"复制"})]}):null,qn?o.jsx("div",{className:"af-flow-snippet-error",children:qn}):null]}),o.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>Ke(!1),children:"取消"}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:bt||!Array.isArray(Pt.nodeIds)||Pt.nodeIds.length===0,onClick:()=>void GM(),children:bt?"生成中...":"生成链接"})]})]})}),document.body):null,qr?cr.createPortal(o.jsx("div",{className:"af-flow-snippet-modal-overlay",children:o.jsxs("div",{className:"af-flow-snippet-modal af-display-link-modal",role:"dialog","aria-modal":"true","aria-label":"展示链接",children:[o.jsxs("div",{className:"af-flow-snippet-modal__head",children:[o.jsxs("span",{className:"af-flow-snippet-modal__title",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"link"}),"展示链接"]}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>{on(""),Yr(!1)},"aria-label":"关闭",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),o.jsxs("div",{className:"af-flow-snippet-modal__body",children:[gt!=null&>.absoluteUrl?o.jsxs("div",{className:"af-display-link-modal__url",children:[o.jsx("input",{type:"text",readOnly:!0,value:gt.absoluteUrl,onFocus:x=>x.target.select(),autoFocus:!0}),o.jsxs("button",{type:"button",onClick:()=>window.open(gt.absoluteUrl,"_blank","noopener,noreferrer"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_new"}),"打开"]}),o.jsxs("button",{type:"button",onClick:()=>void NS(),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:pr==="copied"?"check":"content_copy"}),pr==="copied"?"已复制":pr==="failed"?"复制失败":"复制"]})]}):o.jsx("div",{className:"af-display-link-modal__empty",children:"还没有生成展示链接"}),o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"新链接有效期"}),o.jsx("select",{className:"af-display-share-select",value:O1(Pt),onChange:x=>{const S=x.target.value;fn(E=>({...E,permanent:S==="permanent",expiresInDays:S==="permanent"?E.expiresInDays||30:Number(S)}))},children:Iy.map(x=>o.jsx("option",{value:x.value,children:x.label},x.value))})]}),qn?o.jsx("div",{className:"af-flow-snippet-error",children:qn}):null]}),o.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>{on(""),Yr(!1)},children:"关闭"}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:bt||C.nodeIds.length===0,onClick:()=>void JM(),children:bt?"生成中...":gt!=null&>.absoluteUrl?"更新链接":"生成链接"})]})]})}),document.body):null,pn?cr.createPortal(o.jsx("div",{className:"af-flow-snippet-modal-overlay",children:o.jsxs("div",{className:"af-flow-snippet-modal af-display-share-modal",role:"dialog","aria-modal":"true","aria-label":"协作分享",children:[o.jsxs("div",{className:"af-flow-snippet-modal__head",children:[o.jsxs("span",{className:"af-flow-snippet-modal__title",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"group_add"}),"协作分享"]}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>Gr(!1),"aria-label":"关闭",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),o.jsxs("div",{className:"af-flow-snippet-modal__body",children:[o.jsx("p",{className:"af-display-link-modal__empty",children:"输入已注册用户名。添加后,这个 Workspace 会直接出现在对方的项目列表中。"}),o.jsxs("div",{className:"af-workspace-member-add",children:[o.jsx("input",{type:"text",value:Ac,onChange:x=>Jk(x.target.value),onKeyDown:x=>{x.key==="Enter"&&Ac.trim()&&!_i&&(x.preventDefault(),vS())},placeholder:"输入用户名",autoFocus:!0}),o.jsx("button",{type:"button",disabled:_i||!Ac.trim(),onClick:()=>void vS(),children:_i?"添加中...":"添加成员"})]}),Gk?o.jsx("div",{className:"af-flow-snippet-error",children:Gk}):null,o.jsx("div",{className:"af-workspace-member-list",children:((dt==null?void 0:dt.members)||[]).map(x=>{const S=x.userId===(dt==null?void 0:dt.ownerId)||x.role==="owner";return o.jsxs("div",{className:"af-workspace-member-row",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:S?"shield_person":"person"}),o.jsxs("div",{children:[o.jsx("strong",{children:x.username||x.userId}),o.jsx("small",{children:S?"所有者":x.role==="viewer"?"只读成员":"编辑成员"})]}),S?null:o.jsx("button",{type:"button",disabled:Xk===x.userId,onClick:()=>void KM(x),children:Xk===x.userId?"移除中...":"取消分享"})]},x.userId)})})]}),o.jsx("div",{className:"af-flow-snippet-modal__foot",children:o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>Gr(!1),children:"完成"})})]})}),document.body):null,zn?cr.createPortal(o.jsx("div",{className:"af-flow-snippet-modal-overlay",children:o.jsxs("div",{className:"af-flow-snippet-modal af-display-shares-modal",role:"dialog","aria-modal":"true","aria-label":"我的分享",children:[o.jsxs("div",{className:"af-flow-snippet-modal__head",children:[o.jsxs("span",{className:"af-flow-snippet-modal__title",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"folder_shared"}),"我的分享"]}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>Rr(!1),"aria-label":"关闭",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),o.jsxs("div",{className:"af-flow-snippet-modal__body",children:[o.jsxs("div",{className:"af-display-shares-toolbar",children:[o.jsx("span",{children:In.length?`${In.length} 个分享`:"暂无分享"}),o.jsxs("button",{type:"button",onClick:()=>void Ms(),disabled:vr,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"refresh"}),"刷新"]})]}),Sr?o.jsx("div",{className:"af-flow-snippet-error",children:Sr}):null,vr?o.jsx("div",{className:"af-display-link-modal__empty",children:"Loading..."}):null,!vr&&In.length===0?o.jsx("div",{className:"af-display-link-modal__empty",children:"还没有创建过展示分享"}):null,o.jsx("div",{className:"af-display-shares-list",children:In.map(x=>{const S=F1(x),E=ce===x.id,P=x.expiresAt?String(x.expiresInDays||30):"permanent";return o.jsxs("article",{className:"af-display-share-item",children:[o.jsxs("div",{className:"af-display-share-item__main",children:[o.jsx("strong",{children:x.title||"AgentFlow Display"}),o.jsxs("span",{children:[x.flowId||"-"," · ",x.layout||"gallery"," · ",Array.isArray(x.nodeIds)?x.nodeIds.length:0," nodes"]}),o.jsx("small",{children:qq(x)})]}),o.jsx("input",{className:"af-display-share-item__url",type:"text",readOnly:!0,value:S,onFocus:O=>O.target.select()}),o.jsx("select",{className:"af-display-share-select",value:P,disabled:E,onChange:O=>void QM(x,O.target.value),"aria-label":"修改分享有效期",children:Iy.map(O=>o.jsx("option",{value:O.value,children:O.label},O.value))}),o.jsxs("div",{className:"af-display-share-item__actions",children:[o.jsxs("button",{type:"button",onClick:()=>window.open(S,"_blank","noopener,noreferrer"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_new"}),"打开"]}),o.jsxs("button",{type:"button",onClick:()=>void XM(x),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:tt===x.id?"check":"content_copy"}),tt===x.id?"已复制":"复制"]}),o.jsxs("button",{type:"button",className:"af-display-share-item__danger",disabled:E,onClick:()=>void ZM(x),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:E?"hourglass_empty":"link_off"}),"撤销"]})]})]},x.id)})})]})]})}),document.body):null,vn?cr.createPortal(o.jsx("div",{className:"af-flow-snippet-modal-overlay",children:o.jsxs("div",{className:"af-flow-snippet-modal af-display-picker-modal",role:"dialog","aria-modal":"true","aria-label":"选择展示节点",children:[o.jsxs("div",{className:"af-flow-snippet-modal__head",children:[o.jsxs("span",{className:"af-flow-snippet-modal__title",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add_to_photos"}),"选择展示节点"]}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>Jt(!1),"aria-label":"关闭",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),o.jsxs("div",{className:"af-flow-snippet-modal__body",children:[o.jsxs("label",{className:"af-display-picker-search",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{type:"search",value:Bn,onChange:x=>us(x.target.value),placeholder:"搜索展示节点...",autoFocus:!0})]}),o.jsx("div",{className:"af-display-picker-grid",role:"group","aria-label":"选择展示节点",style:{"--af-display-picker-columns":wS.length||1},children:yf.length>0?wS.map((x,S)=>o.jsx("div",{className:"af-display-picker-column",children:x.map(BM)},`display-picker-column-${S}`)):o.jsx("div",{className:"af-display-picker-empty",children:ol.length===0?"当前 Workspace 没有 display 节点":"没有匹配的展示节点"})})]}),o.jsx("div",{className:"af-flow-snippet-modal__foot",children:o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",onClick:()=>Jt(!1),children:"完成"})})]})}),document.body):null,Ic.nodeId?cr.createPortal(o.jsx(IY,{files:hr,query:Ic.query,onQueryChange:x=>qm(S=>({...S,query:x})),onSelect:AM,onUpload:iS,onClose:cg}),document.body):null,!ct&&!Ln&&Vt?cr.createPortal(o.jsx("div",{className:"af-workspace-quick-add-backdrop",onMouseDown:()=>$n(!1),children:o.jsxs("div",{className:"af-workspace-quick-add",role:"dialog","aria-modal":"true","aria-label":"Add workspace node",onMouseDown:x=>x.stopPropagation(),children:[o.jsxs("div",{className:"af-workspace-quick-add__tabs",role:"tablist","aria-label":"选择添加类型",children:[o.jsx("button",{type:"button",role:"tab","aria-selected":Fe==="nodes",className:"af-workspace-quick-add__tab"+(Fe==="nodes"?" af-workspace-quick-add__tab--active":""),onClick:()=>ir("nodes"),children:"节点"}),o.jsx("button",{type:"button",role:"tab","aria-selected":Fe==="flows",className:"af-workspace-quick-add__tab"+(Fe==="flows"?" af-workspace-quick-add__tab--active":""),onClick:()=>ir("flows"),children:"流程"})]}),o.jsxs("div",{className:"af-workspace-quick-add__search",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{ref:kv,value:Tr,onChange:x=>ti(x.target.value),onKeyDown:x=>{if(x.key==="Escape")x.preventDefault(),$n(!1);else if(x.key==="ArrowDown"){x.preventDefault();const S=Fe==="flows"?Uc.length:Kc.length;Mr(E=>Math.min(Math.max(0,S-1),E+1))}else x.key==="ArrowUp"?(x.preventDefault(),Mr(S=>Math.max(0,S-1))):x.key==="Tab"?(x.preventDefault(),ir(S=>S==="nodes"?"flows":"nodes")):x.key==="Enter"&&(x.preventDefault(),Fe==="flows"?CS(Uc[js]||Uc[0]):jS(Kc[js]||Kc[0]))},placeholder:Fe==="flows"?"搜索流程片段...":"搜索节点...","aria-label":Fe==="flows"?"搜索流程片段":"搜索节点"})]}),o.jsx("div",{className:"af-workspace-quick-add__list",children:Fe==="flows"?Uc.length===0?o.jsx("div",{className:"af-workspace-quick-add__empty",children:qt?"正在加载流程片段...":rt||"没有匹配的流程片段"}):Uc.map((x,S)=>{const E=x.displayName||x.name||x.id,P=x.snippet&&typeof x.snippet=="object"?x.snippet.instances:null,O=x.snippet&&typeof x.snippet=="object"?x.snippet.edges:null,q=Number.isFinite(Number(x.nodeCount))?Number(x.nodeCount):Object.keys(P||{}).length,Y=Number.isFinite(Number(x.edgeCount))?Number(x.edgeCount):Array.isArray(O)?O.length:0;return o.jsxs("button",{type:"button",className:"af-workspace-quick-add__item"+(S===js?" af-workspace-quick-add__item--active":""),onMouseEnter:()=>Mr(S),onClick:()=>CS(x),children:[o.jsx("span",{className:"af-workspace-quick-add__icon material-symbols-outlined","aria-hidden":!0,children:"schema"}),o.jsxs("span",{className:"af-workspace-quick-add__main",children:[o.jsx("span",{className:"af-workspace-quick-add__label",children:E}),o.jsxs("span",{className:"af-workspace-quick-add__meta",children:[x.id,x.version?` · v${x.version}`:""]}),o.jsx("span",{className:"af-workspace-quick-add__desc",children:x.description||`${q} 节点 / ${Y} 连线`})]}),o.jsx("span",{className:"af-workspace-quick-add__cat",children:"FLOW"})]},`${x.id}@${x.version}`)}):Kc.length===0?o.jsx("div",{className:"af-workspace-quick-add__empty",children:"没有匹配的节点"}):Kc.map((x,S)=>{const E=ku(x),P=vu(x),O=Aw(x);return o.jsxs("button",{type:"button",className:"af-workspace-quick-add__item"+(S===js?" af-workspace-quick-add__item--active":""),onMouseEnter:()=>Mr(S),onClick:()=>jS(x),children:[o.jsx("span",{className:"af-workspace-quick-add__icon material-symbols-outlined","aria-hidden":!0,children:I1(E)}),o.jsxs("span",{className:"af-workspace-quick-add__main",children:[o.jsx("span",{className:"af-workspace-quick-add__label",children:P}),o.jsx("span",{className:"af-workspace-quick-add__meta",children:x.id}),O?o.jsx("span",{className:"af-workspace-quick-add__desc",children:O}):null]}),o.jsx("span",{className:"af-workspace-quick-add__cat",children:E})]},x.id)})})]})}),document.body):null]})]})}function GY(){return o.jsx(rk,{children:o.jsx(YY,{})})}function JY(e){const t=[...(e==null?void 0:e.inputs)||[],...(e==null?void 0:e.outputs)||[]],n=(e==null?void 0:e.kind)==="image"?"src":"content",r=a=>String((a==null?void 0:a.value)??(a==null?void 0:a.default)??""),s=a=>r(a).trim(),i=t.find(a=>(a==null?void 0:a.name)===n&&s(a))||t.find(a=>(a==null?void 0:a.name)==="filePath"&&s(a))||t.find(a=>(a==null?void 0:a.type)==="text"&&s(a));return String((e==null?void 0:e.body)||(i?r(i):""))}function XY(e){return e==="mermaid"?"account_tree":e==="ascii"?"notes":e==="html"?"html":e==="react"?"deployed_code":e==="image"?"image":e==="chart"?"bar_chart":e==="table"?"table":"article"}function QY(e){let t=String(e||"").replace(/\r\n/g,`
|
|
265
|
-
`).trim();return t.includes(`
|
|
266
|
-
`)||(t=t.replace(/\s+(resultFile|result|outParams|outParams\.[A-Za-z_][A-Za-z0-9_-]*)\s*:/g,`
|
|
267
|
-
$1:`).replace(/(^|\n)outParams:\s+([A-Za-z_][A-Za-z0-9_-]*\s*:)/g,`$1outParams:
|
|
268
|
-
$2`)),t}function aT(e){const t=String(e||"").trim();if(!t)return String(e||"");const n=t.match(/---agentflow\b([\s\S]*?)---end/i);if(n!=null&&n[1]){const a=QY(n[1]),l=a.match(/^resultFile\s*:\s*["']?([^"'\n]+)["']?/m);if(l!=null&&l[1])return l[1].trim();const c=a.match(/^result\s*:\s*(.*)$/m);if(c){const f=String(c[1]||"").trim();return f==="|"||f===">"?a.slice((c.index||0)+c[0].length).split(`
|
|
269
|
-
`).filter(p=>/^\s+/.test(p)||!p.trim()).map(p=>p.replace(/^\s{2}/,"")).join(`
|
|
270
|
-
`).replace(/\s+$/g,""):f.replace(/^["']|["']$/g,"")}const u=t.replace(n[0],"").trim();if(u)return u}if(!/["']result["']\s*:|["']outParams["']\s*:|["']resultFile["']\s*:/i.test(t))return String(e||"");const r=[t],s=t.indexOf("{"),i=t.lastIndexOf("}");s>=0&&i>s&&r.unshift(t.slice(s,i+1));for(const a of r)try{const l=JSON.parse(a);if(l&&typeof l=="object"&&!Array.isArray(l)&&(Object.prototype.hasOwnProperty.call(l,"result")||Object.prototype.hasOwnProperty.call(l,"resultFile"))){const c=l.resultFile||l.result;return typeof c=="string"?c:JSON.stringify(c,null,2)}}catch{}return String(e||"")}function $k(e){let t=aT(e).trim();if(!t)return"";const n=t.match(/```(?:html|HTML)?\s*\n?([\s\S]*?)```/);if(n&&n[1])t=n[1].trim();else{const i=t.match(/```(?:html|HTML)?\s*\n?([\s\S]*)$/);i&&i[1]&&(t=i[1].trim())}t=t.replace(/^html\s*\n/i,"").replace(/```\s*$/g,"").trim();const s=[/<!doctype\b/i,/<html\b/i,/<head\b/i,/<body\b/i,/<style\b/i,/<script\b/i,/<main\b/i,/<section\b/i,/<article\b/i,/<div\b/i,/<svg\b/i,/<canvas\b/i].reduce((i,a)=>{const l=a.exec(t);return l?i<0?l.index:Math.min(i,l.index):i},-1);return s>0&&(t=t.slice(s).trim()),t}function ZY(e){const t=$k(e);return t.trim()?/<[^>]*$/g.test(t)?"HTML 内容末尾存在未闭合标签,可能是生成或保存时被截断。":/^(?:<!doctype\b|<html\b)/i.test(t)&&!/<\/html\s*>/i.test(t)?"完整 HTML 文档缺少 </html> 结束标签,可能是生成或保存时被截断。":"":""}function eG(e){const t=$k(e);if(!t.trim())return"";const n=`<base target="_blank"><script data-agentflow-display-link-guard="1">
|
|
271
|
-
(() => {
|
|
272
|
-
document.addEventListener("click", (event) => {
|
|
273
|
-
const link = event.target && event.target.closest ? event.target.closest("a[href]") : null;
|
|
274
|
-
if (!link) return;
|
|
275
|
-
const rawHref = String(link.getAttribute("href") || "").trim();
|
|
276
|
-
if (!rawHref || rawHref.startsWith("#")) return;
|
|
277
|
-
if (/^javascript:/i.test(rawHref)) {
|
|
278
|
-
event.preventDefault();
|
|
279
|
-
return;
|
|
280
|
-
}
|
|
281
|
-
event.preventDefault();
|
|
282
|
-
window.open(link.href, "_blank", "noopener,noreferrer");
|
|
283
|
-
}, true);
|
|
284
|
-
})();
|
|
285
|
-
<\/script>`;return/data-agentflow-display-link-guard=["']1["']/i.test(t)?t:/<head\b[^>]*>/i.test(t)?t.replace(/<head\b([^>]*)>/i,`<head$1>${n}`):/<html\b[^>]*>/i.test(t)?t.replace(/<html\b([^>]*)>/i,`<html$1><head>${n}</head>`):`<!doctype html><html><head>${n}</head><body>${t}</body></html>`}function lT(e,t,n={}){const r=String(e||"").trim();if(!r)return"";if(/^(?:https?:|data:|blob:|file:)/i.test(r)||r.startsWith("/"))return r;const s=new URLSearchParams;return s.set("id",t),s.set("path",r),n.download&&s.set("download","1"),`/api/display/file/raw?${s.toString()}`}function tG(e,t,n={}){const r=String(e||"").trim();return r?lT(r,t,n):""}function nG({className:e="",children:t}){const n=m.useRef(null),r=m.useRef(null),[s,i]=m.useState({visible:!1,top:0,height:100}),a=m.useCallback(()=>{const f=n.current;if(!f)return;const d=Math.max(1,f.scrollHeight),p=Math.max(1,f.clientHeight),h=d>p+1,g=h?Math.max(12,p/d*100):100,k=Math.max(0,100-g),w=h?Math.min(k,f.scrollTop/Math.max(1,d-p)*k):0;i({visible:h,top:w,height:g})},[]);m.useEffect(()=>{const f=requestAnimationFrame(a),d=n.current;if(!d||typeof ResizeObserver>"u")return()=>cancelAnimationFrame(f);const p=new ResizeObserver(a);p.observe(d);for(const h of Array.from(d.children))p.observe(h);return()=>{cancelAnimationFrame(f),p.disconnect()}},[t,a]);const l=m.useCallback(f=>{const d=n.current;if(!d)return;const p=Math.max(0,d.scrollHeight-d.clientHeight);d.scrollTop=Math.min(1,Math.max(0,f))*p,a()},[a]),c=m.useCallback((f,d=0)=>{const p=r.current;if(!p)return 0;const h=p.getBoundingClientRect(),g=s.height/100*h.height,k=Math.max(1,h.height-g);return(f-h.top-d)/k},[s.height]),u=m.useCallback(f=>{if(!s.visible)return;f.preventDefault(),f.stopPropagation();const d=r.current;if(!d)return;const p=d.getBoundingClientRect(),h=s.top/100*p.height,g=s.height/100*p.height,w=f.clientY>=p.top+h&&f.clientY<=p.top+h+g?f.clientY-p.top-h:g/2;l(c(f.clientY,w));const y=b=>{b.preventDefault(),l(c(b.clientY,w))},v=()=>{window.removeEventListener("pointermove",y),window.removeEventListener("pointerup",v),window.removeEventListener("pointercancel",v)};window.addEventListener("pointermove",y),window.addEventListener("pointerup",v),window.addEventListener("pointercancel",v)},[c,l,s.height,s.top,s.visible]);return o.jsxs("div",{className:`af-public-display-node__body ${e} nowheel nopan nodrag`,children:[o.jsx("div",{ref:n,className:`af-public-display-node__scroller ${e} nowheel nopan nodrag`,onScroll:a,children:t}),o.jsx("div",{ref:r,className:"af-public-display-scrollbar"+(s.visible?" af-public-display-scrollbar--visible":""),onPointerDown:u,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${s.height}%`,top:`${s.top}%`}})})]})}function Mw({node:e,shareId:t,style:n,bare:r=!1}){const s=JY(e),i=e.kind==="html"?$k(s):e.kind==="react"?Tm(s):aT(s),a=e.kind==="html"?ZY(i):"",l=`af-public-display-node__body--${e.kind||"unknown"}`;return o.jsxs("section",{className:`af-public-display-node af-public-display-node--${e.kind||"unknown"}${r?" af-public-display-node--bare":""}`,style:n,children:[r?null:o.jsx("div",{className:"af-public-display-node__head",children:o.jsxs("div",{className:"af-public-display-node__title",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:XY(e.kind)}),o.jsx("strong",{children:e.label||e.id}),o.jsx("em",{children:e.definitionId||e.kind||"display"})]})}),o.jsx(nG,{className:l,children:a?o.jsx("div",{className:"af-public-display-empty",children:a}):i.trim()?o.jsxs(o.Fragment,{children:[e.kind==="html"?o.jsx("iframe",{title:e.label||e.id,sandbox:"allow-scripts allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox",srcDoc:eG(i)}):null,e.kind==="react"?o.jsx("iframe",{title:e.label||e.id,sandbox:"allow-scripts allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox",srcDoc:Ck(i)}):null,e.kind==="image"?o.jsx("img",{src:lT(i,t),alt:e.label||e.id,loading:"lazy"}):null,e.kind==="markdown"?o.jsx("div",{className:"af-public-display-markdown",children:o.jsx(bk,{content:i,resolveSrc:(c,u)=>tG(c,t,u)})}):null,e.kind==="chart"?o.jsx(vk,{content:i}):null,e.kind==="table"?o.jsx(kk,{content:i}):null,e.kind==="mermaid"||e.kind==="ascii"?o.jsx("pre",{children:i}):null]}):o.jsx("div",{className:"af-public-display-empty",children:"No display content"})})]})}function rG({data:e}){return o.jsx(Mw,{node:e==null?void 0:e.node,shareId:e==null?void 0:e.shareId})}const sG={publicDisplay:rG};function iG(e){const t=String(e||"").split("/").filter(Boolean);return t[0]==="display"&&t[1]?decodeURIComponent(t[1]):new URLSearchParams(window.location.search).get("id")||""}function cT(){var l,c,u,f;const{path:e}=Ni(),t=m.useMemo(()=>iG(e),[e]),[n,r]=m.useState({loading:!0,error:"",share:null,nodes:[]});m.useEffect(()=>{let d=!1;async function p(){if(!t){r({loading:!1,error:"Missing display share id",share:null,nodes:[]});return}r(h=>({...h,loading:!0,error:""}));try{const h=await fetch(`/api/display/share?id=${encodeURIComponent(t)}`),g=await h.json().catch(()=>({}));if(!h.ok)throw new Error(g.error||"展示页不存在");d||r({loading:!1,error:"",share:g.share||null,nodes:Array.isArray(g.nodes)?g.nodes:[]})}catch(h){d||r({loading:!1,error:String((h==null?void 0:h.message)||h),share:null,nodes:[]})}}return p(),()=>{d=!0}},[t]);const s=m.useMemo(()=>(Array.isArray(n.nodes)?n.nodes:[]).map((p,h)=>{const g=p.position&&typeof p.position.x=="number"&&typeof p.position.y=="number"?p.position:{x:120+h*40,y:100+h*32},k=p.size&&typeof p.size.width=="number"&&typeof p.size.height=="number"?p.size:{width:520,height:320};return{id:p.id,type:"publicDisplay",position:g,data:{node:p,shareId:t},selectable:!1,draggable:!1,style:{width:Math.max(1,Number(k.width)||520),height:Math.max(1,Number(k.height)||320)}}}),[t,n.nodes]),i=m.useMemo(()=>{var k;const d=(k=n.share)==null?void 0:k.viewport;if(!d||typeof d!="object")return null;const p=Number(d.x),h=Number(d.y),g=Number(d.zoom);return!Number.isFinite(p)||!Number.isFinite(h)||!Number.isFinite(g)?null:{x:p,y:h,zoom:Math.min(Math.max(g,.1),4)}},[(l=n.share)==null?void 0:l.viewport]);if(n.loading)return o.jsx("main",{className:"af-public-display-page",children:o.jsx("div",{className:"af-public-display-status",children:"Loading..."})});if(n.error)return o.jsx("main",{className:"af-public-display-page",children:o.jsxs("div",{className:"af-public-display-status af-public-display-status--error",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"error"}),o.jsx("span",{children:n.error})]})});const a=String(((c=n.share)==null?void 0:c.layout)||"").trim()||"gallery";if(a!=="canvas"){if(a==="single")return o.jsx("main",{className:"af-public-display-page af-public-display-page--single",children:o.jsx("div",{className:"af-public-display-grid",children:(n.nodes||[]).map(p=>o.jsx(Mw,{node:p,shareId:t,bare:!0},p.id))})});const d=a==="slides"?"af-public-display-page--slides":a==="document"?"af-public-display-page--document":"af-public-display-page--gallery";return o.jsxs("main",{className:`af-public-display-page ${d}`,children:[o.jsxs("header",{className:"af-public-display-hero",children:[o.jsxs("div",{children:[o.jsx("p",{children:"AgentFlow Display"}),o.jsx("h1",{children:((u=n.share)==null?void 0:u.title)||"AgentFlow Display"})]}),o.jsx("span",{children:(f=n.share)!=null&&f.expiresAt?`有效期至 ${new Date(n.share.expiresAt).toLocaleString()}`:"永久有效"})]}),o.jsx("div",{className:"af-public-display-grid",children:(n.nodes||[]).map(p=>o.jsx(Mw,{node:p,shareId:t},p.id))})]})}return o.jsx("main",{className:"af-public-display-page af-public-display-page--canvas",children:o.jsx(rk,{children:o.jsx(yI,{className:"af-public-display-flow",nodes:s,edges:[],nodeTypes:sG,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,panOnDrag:!0,noPanClassName:"nopan",noDragClassName:"nodrag",noWheelClassName:"nowheel",panOnScroll:!0,zoomOnScroll:!0,zoomOnPinch:!0,defaultViewport:i||void 0,fitView:!i,fitViewOptions:{padding:.18,duration:180},minZoom:.1,maxZoom:4,proOptions:{hideAttribution:!0},children:o.jsx(wI,{color:"rgba(255,255,255,0.12)",gap:22,size:1})})})})}const ht=e=>typeof e=="string",du=()=>{let e,t;const n=new Promise((r,s)=>{e=r,t=s});return n.resolve=e,n.reject=t,n},eC=e=>e==null?"":""+e,oG=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},aG=/###/g,tC=e=>e&&e.indexOf("###")>-1?e.replace(aG,"."):e,nC=e=>!e||ht(e),Wu=(e,t,n)=>{const r=ht(t)?t.split("."):t;let s=0;for(;s<r.length-1;){if(nC(e))return{};const i=tC(r[s]);!e[i]&&n&&(e[i]=new n),Object.prototype.hasOwnProperty.call(e,i)?e=e[i]:e={},++s}return nC(e)?{}:{obj:e,k:tC(r[s])}},rC=(e,t,n)=>{const{obj:r,k:s}=Wu(e,t,Object);if(r!==void 0||t.length===1){r[s]=n;return}let i=t[t.length-1],a=t.slice(0,t.length-1),l=Wu(e,a,Object);for(;l.obj===void 0&&a.length;)i=`${a[a.length-1]}.${i}`,a=a.slice(0,a.length-1),l=Wu(e,a,Object),l&&l.obj&&typeof l.obj[`${l.k}.${i}`]<"u"&&(l.obj=void 0);l.obj[`${l.k}.${i}`]=n},lG=(e,t,n,r)=>{const{obj:s,k:i}=Wu(e,t,Object);s[i]=s[i]||[],s[i].push(n)},Wh=(e,t)=>{const{obj:n,k:r}=Wu(e,t);if(n)return n[r]},cG=(e,t,n)=>{const r=Wh(e,n);return r!==void 0?r:Wh(t,n)},uT=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?ht(e[r])||e[r]instanceof String||ht(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):uT(e[r],t[r],n):e[r]=t[r]);return e},xl=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var uG={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const dG=e=>ht(e)?e.replace(/[&<>"'\/]/g,t=>uG[t]):e;class fG{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const n=this.regExpMap.get(t);if(n!==void 0)return n;const r=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,r),this.regExpQueue.push(t),r}}const pG=[" ",",","?","!",";"],hG=new fG(20),mG=(e,t,n)=>{t=t||"",n=n||"";const r=pG.filter(a=>t.indexOf(a)<0&&n.indexOf(a)<0);if(r.length===0)return!0;const s=hG.getRegExp(`(${r.map(a=>a==="?"?"\\?":a).join("|")})`);let i=!s.test(e);if(!i){const a=e.indexOf(n);a>0&&!s.test(e.substring(0,a))&&(i=!0)}return i},$w=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return e[t];const r=t.split(n);let s=e;for(let i=0;i<r.length;){if(!s||typeof s!="object")return;let a,l="";for(let c=i;c<r.length;++c)if(c!==i&&(l+=n),l+=r[c],a=s[l],a!==void 0){if(["string","number","boolean"].indexOf(typeof a)>-1&&c<r.length-1)continue;i+=c-i+1;break}s=a}return s},Vh=e=>e&&e.replace("_","-"),gG={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class Kh{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(t,n)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=t||gG,this.options=n,this.debug=n.debug}log(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"log","",!0)}warn(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"warn","",!0)}error(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"error","")}deprecate(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"warn","WARNING DEPRECATED: ",!0)}forward(t,n,r,s){return s&&!this.debug?null:(ht(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new Kh(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new Kh(this.logger,t)}}var mi=new Kh;class Om{constructor(){this.observers={}}on(t,n){return t.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const s=this.observers[r].get(n)||0;this.observers[r].set(n,s+1)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t].delete(n)}}emit(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];this.observers[t]&&Array.from(this.observers[t].entries()).forEach(a=>{let[l,c]=a;for(let u=0;u<c;u++)l(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(a=>{let[l,c]=a;for(let u=0;u<c;u++)l.apply(l,[t,...r])})}}class sC extends Om{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const i=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,a=s.ignoreJSONStructure!==void 0?s.ignoreJSONStructure:this.options.ignoreJSONStructure;let l;t.indexOf(".")>-1?l=t.split("."):(l=[t,n],r&&(Array.isArray(r)?l.push(...r):ht(r)&&i?l.push(...r.split(i)):l.push(r)));const c=Wh(this.data,l);return!c&&!n&&!r&&t.indexOf(".")>-1&&(t=l[0],n=l[1],r=l.slice(2).join(".")),c||!a||!ht(r)?c:$w(this.data&&this.data[t]&&this.data[t][n],r,i)}addResource(t,n,r,s){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const a=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator;let l=[t,n];r&&(l=l.concat(a?r.split(a):r)),t.indexOf(".")>-1&&(l=t.split("."),s=n,n=l[1]),this.addNamespaces(n),rC(this.data,l,s),i.silent||this.emit("added",t,n,r,s)}addResources(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const i in r)(ht(r[i])||Array.isArray(r[i]))&&this.addResource(t,n,i,r[i],{silent:!0});s.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,s,i){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},l=[t,n];t.indexOf(".")>-1&&(l=t.split("."),s=r,r=n,n=l[1]),this.addNamespaces(n);let c=Wh(this.data,l)||{};a.skipCopy||(r=JSON.parse(JSON.stringify(r))),s?uT(c,r,i):c={...c,...r},rC(this.data,l,c),a.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(t,n)}:this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(s=>n[s]&&Object.keys(n[s]).length>0)}toJSON(){return this.data}}var dT={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,s){return e.forEach(i=>{this.processors[i]&&(t=this.processors[i].process(t,n,r,s))}),t}};const iC={};class Uh extends Om{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),oG(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=mi.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(t==null)return!1;const r=this.resolve(t,n);return r&&r.res!==void 0}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const s=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let i=n.ns||this.options.defaultNS||[];const a=r&&t.indexOf(r)>-1,l=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!mG(t,r,s);if(a&&!l){const c=t.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:t,namespaces:ht(i)?[i]:i};const u=t.split(r);(r!==s||r===s&&this.options.ns.indexOf(u[0])>-1)&&(i=u.shift()),t=u.join(s)}return{key:t,namespaces:ht(i)?[i]:i}}translate(t,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const s=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:a,namespaces:l}=this.extractFromKey(t[t.length-1],n),c=l[l.length-1],u=n.lng||this.language,f=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(f){const C=n.nsSeparator||this.options.nsSeparator;return s?{res:`${c}${C}${a}`,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:`${c}${C}${a}`}return s?{res:a,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:a}const d=this.resolve(t,n);let p=d&&d.res;const h=d&&d.usedKey||a,g=d&&d.exactUsedKey||a,k=Object.prototype.toString.apply(p),w=["[object Number]","[object Function]","[object RegExp]"],y=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject,b=!ht(p)&&typeof p!="boolean"&&typeof p!="number";if(v&&p&&b&&w.indexOf(k)<0&&!(ht(y)&&Array.isArray(p))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const C=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,p,{...n,ns:l}):`key '${a} (${this.language})' returned an object instead of string.`;return s?(d.res=C,d.usedParams=this.getUsedParamsDetails(n),d):C}if(i){const C=Array.isArray(p),N=C?[]:{},j=C?g:h;for(const A in p)if(Object.prototype.hasOwnProperty.call(p,A)){const I=`${j}${i}${A}`;N[A]=this.translate(I,{...n,joinArrays:!1,ns:l}),N[A]===I&&(N[A]=p[A])}p=N}}else if(v&&ht(y)&&Array.isArray(p))p=p.join(y),p&&(p=this.extendTranslation(p,t,n,r));else{let C=!1,N=!1;const j=n.count!==void 0&&!ht(n.count),A=Uh.hasDefaultValue(n),I=j?this.pluralResolver.getSuffix(u,n.count,n):"",D=n.ordinal&&j?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",H=j&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),V=H&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${I}`]||n[`defaultValue${D}`]||n.defaultValue;!this.isValidLookup(p)&&A&&(C=!0,p=V),this.isValidLookup(p)||(N=!0,p=a);const L=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&N?void 0:p,M=A&&V!==p&&this.options.updateMissing;if(N||C||M){if(this.logger.log(M?"updateKey":"missingKey",u,c,a,M?V:p),i){const R=this.resolve(a,{...n,keySeparator:!1});R&&R.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let K=[];const W=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&W&&W[0])for(let R=0;R<W.length;R++)K.push(W[R]);else this.options.saveMissingTo==="all"?K=this.languageUtils.toResolveHierarchy(n.lng||this.language):K.push(n.lng||this.language);const $=(R,B,_)=>{const X=A&&_!==p?_:L;this.options.missingKeyHandler?this.options.missingKeyHandler(R,c,B,X,M,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(R,c,B,X,M,n),this.emit("missingKey",R,c,B,p)};this.options.saveMissing&&(this.options.saveMissingPlurals&&j?K.forEach(R=>{const B=this.pluralResolver.getSuffixes(R,n);H&&n[`defaultValue${this.options.pluralSeparator}zero`]&&B.indexOf(`${this.options.pluralSeparator}zero`)<0&&B.push(`${this.options.pluralSeparator}zero`),B.forEach(_=>{$([R],a+_,n[`defaultValue${_}`]||V)})}):$(K,a,V))}p=this.extendTranslation(p,t,n,d,r),N&&p===a&&this.options.appendNamespaceToMissingKey&&(p=`${c}:${a}`),(N||C)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?p=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}:${a}`:a,C?p:void 0):p=this.options.parseMissingKeyHandler(p))}return s?(d.res=p,d.usedParams=this.getUsedParamsDetails(n),d):p}extendTranslation(t,n,r,s,i){var a=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||s.usedLng,s.usedNS,s.usedKey,{resolved:s});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const u=ht(t)&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let f;if(u){const p=t.match(this.interpolator.nestingRegexp);f=p&&p.length}let d=r.replace&&!ht(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),t=this.interpolator.interpolate(t,d,r.lng||this.language||s.usedLng,r),u){const p=t.match(this.interpolator.nestingRegexp),h=p&&p.length;f<h&&(r.nest=!1)}!r.lng&&this.options.compatibilityAPI!=="v1"&&s&&s.res&&(r.lng=this.language||s.usedLng),r.nest!==!1&&(t=this.interpolator.nest(t,function(){for(var p=arguments.length,h=new Array(p),g=0;g<p;g++)h[g]=arguments[g];return i&&i[0]===h[0]&&!r.context?(a.logger.warn(`It seems you are nesting recursively key: ${h[0]} in key: ${n[0]}`),null):a.translate(...h,n)},r)),r.interpolation&&this.interpolator.reset()}const l=r.postProcess||this.options.postProcess,c=ht(l)?[l]:l;return t!=null&&c&&c.length&&r.applyPostProcessor!==!1&&(t=dT.handle(c,t,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...s,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r,s,i,a,l;return ht(t)&&(t=[t]),t.forEach(c=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(c,n),f=u.key;s=f;let d=u.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const p=n.count!==void 0&&!ht(n.count),h=p&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),g=n.context!==void 0&&(ht(n.context)||typeof n.context=="number")&&n.context!=="",k=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);d.forEach(w=>{this.isValidLookup(r)||(l=w,!iC[`${k[0]}-${w}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(l)&&(iC[`${k[0]}-${w}`]=!0,this.logger.warn(`key "${s}" for languages "${k.join(", ")}" won't get resolved as namespace "${l}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),k.forEach(y=>{if(this.isValidLookup(r))return;a=y;const v=[f];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(v,f,y,w,n);else{let C;p&&(C=this.pluralResolver.getSuffix(y,n.count,n));const N=`${this.options.pluralSeparator}zero`,j=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(p&&(v.push(f+C),n.ordinal&&C.indexOf(j)===0&&v.push(f+C.replace(j,this.options.pluralSeparator)),h&&v.push(f+N)),g){const A=`${f}${this.options.contextSeparator}${n.context}`;v.push(A),p&&(v.push(A+C),n.ordinal&&C.indexOf(j)===0&&v.push(A+C.replace(j,this.options.pluralSeparator)),h&&v.push(A+N))}}let b;for(;b=v.pop();)this.isValidLookup(r)||(i=b,r=this.getResource(y,w,b,n))}))})}),{res:r,usedKey:s,exactUsedKey:i,usedLng:a,usedNS:l}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,r,s):this.resourceStore.getResource(t,n,r,s)}getUsedParamsDetails(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&!ht(t.replace);let s=r?t.replace:t;if(r&&typeof t.count<"u"&&(s.count=t.count),this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),!r){s={...s};for(const i of n)delete s[i]}return s}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,n.length)&&t[r]!==void 0)return!0;return!1}}const My=e=>e.charAt(0).toUpperCase()+e.slice(1);class oC{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=mi.create("languageUtils")}getScriptPartFromCode(t){if(t=Vh(t),!t||t.indexOf("-")<0)return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=Vh(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(ht(t)&&t.indexOf("-")>-1){if(typeof Intl<"u"&&typeof Intl.getCanonicalLocales<"u")try{let s=Intl.getCanonicalLocales(t)[0];if(s&&this.options.lowerCaseLng&&(s=s.toLowerCase()),s)return s}catch{}const n=["hans","hant","latn","cyrl","cans","mong","arab"];let r=t.split("-");return this.options.lowerCaseLng?r=r.map(s=>s.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=My(r[1].toLowerCase()))):r.length===3&&(r[0]=r[0].toLowerCase(),r[1].length===2&&(r[1]=r[1].toUpperCase()),r[0]!=="sgn"&&r[2].length===2&&(r[2]=r[2].toUpperCase()),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=My(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=My(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const s=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(s))&&(n=s)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const s=this.getLanguagePartFromCode(r);if(this.isSupportedCode(s))return n=s;n=this.options.supportedLngs.find(i=>{if(i===s)return i;if(!(i.indexOf("-")<0&&s.indexOf("-")<0)&&(i.indexOf("-")>0&&s.indexOf("-")<0&&i.substring(0,i.indexOf("-"))===s||i.indexOf(s)===0&&s.length>1))return i})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),ht(t)&&(t=[t]),Array.isArray(t))return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],t),s=[],i=a=>{a&&(this.isSupportedCode(a)?s.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return ht(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&i(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&i(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&i(this.getLanguagePartFromCode(t))):ht(t)&&i(this.formatLanguageCode(t)),r.forEach(a=>{s.indexOf(a)<0&&i(this.formatLanguageCode(a))}),s}}let yG=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],xG={1:e=>+(e>1),2:e=>+(e!=1),3:e=>0,4:e=>e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2,5:e=>e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5,6:e=>e==1?0:e>=2&&e<=4?1:2,7:e=>e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2,8:e=>e==1?0:e==2?1:e!=8&&e!=11?2:3,9:e=>+(e>=2),10:e=>e==1?0:e==2?1:e<7?2:e<11?3:4,11:e=>e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3,12:e=>+(e%10!=1||e%100==11),13:e=>+(e!==0),14:e=>e==1?0:e==2?1:e==3?2:3,15:e=>e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2,16:e=>e%10==1&&e%100!=11?0:e!==0?1:2,17:e=>e==1||e%10==1&&e%100!=11?0:1,18:e=>e==0?0:e==1?1:2,19:e=>e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3,20:e=>e==1?0:e==0||e%100>0&&e%100<20?1:2,21:e=>e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0,22:e=>e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3};const wG=["v1","v2","v3"],bG=["v4"],aC={zero:0,one:1,two:2,few:3,many:4,other:5},kG=()=>{const e={};return yG.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:xG[t.fc]}})}),e};class vG{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=mi.create("pluralResolver"),(!this.options.compatibilityJSON||bG.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=kG(),this.pluralRulesCache={}}addRule(t,n){this.rules[t]=n}clearCache(){this.pluralRulesCache={}}getRule(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi()){const r=Vh(t==="dev"?"en":t),s=n.ordinal?"ordinal":"cardinal",i=JSON.stringify({cleanedCode:r,type:s});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let a;try{a=new Intl.PluralRules(r,{type:s})}catch{if(!t.match(/-|_/))return;const c=this.languageUtils.getLanguagePartFromCode(t);a=this.getRule(c,n)}return this.pluralRulesCache[i]=a,a}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}needsPlural(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}getPluralFormsOfKey(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,r).map(s=>`${n}${s}`)}getSuffixes(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((s,i)=>aC[s]-aC[i]).map(s=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${s}`):r.numbers.map(s=>this.getSuffix(t,s,n)):[]}getSuffix(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const s=this.getRule(t,r);return s?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${s.select(n)}`:this.getSuffixRetroCompatible(s,n):(this.logger.warn(`no plural rule found for: ${t}`),"")}getSuffixRetroCompatible(t,n){const r=t.noAbs?t.plurals(n):t.plurals(Math.abs(n));let s=t.numbers[r];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(s===2?s="plural":s===1&&(s=""));const i=()=>this.options.prepend&&s.toString()?this.options.prepend+s.toString():s.toString();return this.options.compatibilityJSON==="v1"?s===1?"":typeof s=="number"?`_plural_${s.toString()}`:i():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?i():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!wG.includes(this.options.compatibilityJSON)}}const lC=function(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=cG(e,t,n);return!i&&s&&ht(n)&&(i=$w(e,n,r),i===void 0&&(i=$w(t,n,r))),i},$y=e=>e.replace(/\$/g,"$$$$");class SG{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=mi.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||(n=>n),this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const{escape:n,escapeValue:r,useRawValueToEscape:s,prefix:i,prefixEscaped:a,suffix:l,suffixEscaped:c,formatSeparator:u,unescapeSuffix:f,unescapePrefix:d,nestingPrefix:p,nestingPrefixEscaped:h,nestingSuffix:g,nestingSuffixEscaped:k,nestingOptionsSeparator:w,maxReplaces:y,alwaysFormat:v}=t.interpolation;this.escape=n!==void 0?n:dG,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=i?xl(i):a||"{{",this.suffix=l?xl(l):c||"}}",this.formatSeparator=u||",",this.unescapePrefix=f?"":d||"-",this.unescapeSuffix=this.unescapePrefix?"":f||"",this.nestingPrefix=p?xl(p):h||xl("$t("),this.nestingSuffix=g?xl(g):k||xl(")"),this.nestingOptionsSeparator=w||",",this.maxReplaces=y||1e3,this.alwaysFormat=v!==void 0?v:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,r)=>n&&n.source===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(t,n,r,s){let i,a,l;const c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=h=>{if(h.indexOf(this.formatSeparator)<0){const y=lC(n,c,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(y,void 0,r,{...s,...n,interpolationkey:h}):y}const g=h.split(this.formatSeparator),k=g.shift().trim(),w=g.join(this.formatSeparator).trim();return this.format(lC(n,c,k,this.options.keySeparator,this.options.ignoreJSONStructure),w,r,{...s,...n,interpolationkey:k})};this.resetRegExp();const f=s&&s.missingInterpolationHandler||this.options.missingInterpolationHandler,d=s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>$y(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?$y(this.escape(h)):$y(h)}].forEach(h=>{for(l=0;i=h.regex.exec(t);){const g=i[1].trim();if(a=u(g),a===void 0)if(typeof f=="function"){const w=f(t,i,s);a=ht(w)?w:""}else if(s&&Object.prototype.hasOwnProperty.call(s,g))a="";else if(d){a=i[0];continue}else this.logger.warn(`missed to pass in variable ${g} for interpolating ${t}`),a="";else!ht(a)&&!this.useRawValueToEscape&&(a=eC(a));const k=h.safeValue(a);if(t=t.replace(i[0],k),d?(h.regex.lastIndex+=a.length,h.regex.lastIndex-=i[0].length):h.regex.lastIndex=0,l++,l>=this.maxReplaces)break}}),t}nest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s,i,a;const l=(c,u)=>{const f=this.nestingOptionsSeparator;if(c.indexOf(f)<0)return c;const d=c.split(new RegExp(`${f}[ ]*{`));let p=`{${d[1]}`;c=d[0],p=this.interpolate(p,a);const h=p.match(/'/g),g=p.match(/"/g);(h&&h.length%2===0&&!g||g.length%2!==0)&&(p=p.replace(/'/g,'"'));try{a=JSON.parse(p),u&&(a={...u,...a})}catch(k){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,k),`${c}${f}${p}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,c};for(;s=this.nestingRegexp.exec(t);){let c=[];a={...r},a=a.replace&&!ht(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let u=!1;if(s[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(s[1])){const f=s[1].split(this.formatSeparator).map(d=>d.trim());s[1]=f.shift(),c=f,u=!0}if(i=n(l.call(this,s[1].trim(),a),a),i&&s[0]===t&&!ht(i))return i;ht(i)||(i=eC(i)),i||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${t}`),i=""),u&&(i=c.reduce((f,d)=>this.format(f,d,r.lng,{...r,interpolationkey:s[1].trim()}),i.trim())),t=t.replace(s[0],i),this.regexp.lastIndex=0}return t}}const NG=e=>{let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const s=r[1].substring(0,r[1].length-1);t==="currency"&&s.indexOf(":")<0?n.currency||(n.currency=s.trim()):t==="relativetime"&&s.indexOf(":")<0?n.range||(n.range=s.trim()):s.split(";").forEach(a=>{if(a){const[l,...c]=a.split(":"),u=c.join(":").trim().replace(/^'+|'+$/g,""),f=l.trim();n[f]||(n[f]=u),u==="false"&&(n[f]=!1),u==="true"&&(n[f]=!0),isNaN(u)||(n[f]=parseInt(u,10))}})}return{formatName:t,formatOptions:n}},wl=e=>{const t={};return(n,r,s)=>{let i=s;s&&s.interpolationkey&&s.formatParams&&s.formatParams[s.interpolationkey]&&s[s.interpolationkey]&&(i={...i,[s.interpolationkey]:void 0});const a=r+JSON.stringify(i);let l=t[a];return l||(l=e(Vh(r),s),t[a]=l),l(n)}};class jG{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=mi.create("formatter"),this.options=t,this.formats={number:wl((n,r)=>{const s=new Intl.NumberFormat(n,{...r});return i=>s.format(i)}),currency:wl((n,r)=>{const s=new Intl.NumberFormat(n,{...r,style:"currency"});return i=>s.format(i)}),datetime:wl((n,r)=>{const s=new Intl.DateTimeFormat(n,{...r});return i=>s.format(i)}),relativetime:wl((n,r)=>{const s=new Intl.RelativeTimeFormat(n,{...r});return i=>s.format(i,r.range||"day")}),list:wl((n,r)=>{const s=new Intl.ListFormat(n,{...r});return i=>s.format(i)})},this.init(t)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};this.formatSeparator=n.interpolation.formatSeparator||","}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=wl(n)}format(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const i=n.split(this.formatSeparator);if(i.length>1&&i[0].indexOf("(")>1&&i[0].indexOf(")")<0&&i.find(l=>l.indexOf(")")>-1)){const l=i.findIndex(c=>c.indexOf(")")>-1);i[0]=[i[0],...i.splice(1,l)].join(this.formatSeparator)}return i.reduce((l,c)=>{const{formatName:u,formatOptions:f}=NG(c);if(this.formats[u]){let d=l;try{const p=s&&s.formatParams&&s.formatParams[s.interpolationkey]||{},h=p.locale||p.lng||s.locale||s.lng||r;d=this.formats[u](l,h,{...f,...s,...p})}catch(p){this.logger.warn(p)}return d}else this.logger.warn(`there was no format function for ${u}`);return l},t)}}const CG=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class _G extends Om{constructor(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=t,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=s,this.logger=mi.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=s.maxParallelReads||10,this.readingCalls=0,this.maxRetries=s.maxRetries>=0?s.maxRetries:5,this.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,s.backend,s)}queueLoad(t,n,r,s){const i={},a={},l={},c={};return t.forEach(u=>{let f=!0;n.forEach(d=>{const p=`${u}|${d}`;!r.reload&&this.store.hasResourceBundle(u,d)?this.state[p]=2:this.state[p]<0||(this.state[p]===1?a[p]===void 0&&(a[p]=!0):(this.state[p]=1,f=!1,a[p]===void 0&&(a[p]=!0),i[p]===void 0&&(i[p]=!0),c[d]===void 0&&(c[d]=!0)))}),f||(l[u]=!0)}),(Object.keys(i).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:s}),{toLoad:Object.keys(i),pending:Object.keys(a),toLoadLanguages:Object.keys(l),toLoadNamespaces:Object.keys(c)}}loaded(t,n,r){const s=t.split("|"),i=s[0],a=s[1];n&&this.emit("failedLoading",i,a,n),!n&&r&&this.store.addResourceBundle(i,a,r,void 0,void 0,{skipCopy:!0}),this.state[t]=n?-1:2,n&&r&&(this.state[t]=0);const l={};this.queue.forEach(c=>{lG(c.loaded,[i],a),CG(c,t),n&&c.errors.push(n),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(u=>{l[u]||(l[u]={});const f=c.loaded[u];f.length&&f.forEach(d=>{l[u][d]===void 0&&(l[u][d]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",l),this.queue=this.queue.filter(c=>!c.done)}read(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!t.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:s,wait:i,callback:a});return}this.readingCalls++;const l=(u,f)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(u&&f&&s<this.maxRetries){setTimeout(()=>{this.read.call(this,t,n,r,s+1,i*2,a)},i);return}a(u,f)},c=this.backend[r].bind(this.backend);if(c.length===2){try{const u=c(t,n);u&&typeof u.then=="function"?u.then(f=>l(null,f)).catch(l):l(null,u)}catch(u){l(u)}return}return c(t,n,l)}prepareLoading(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),s&&s();ht(t)&&(t=this.languageUtils.toResolveHierarchy(t)),ht(n)&&(n=[n]);const i=this.queueLoad(t,n,r,s);if(!i.toLoad.length)return i.pending.length||s(),null;i.toLoad.forEach(a=>{this.loadOne(a)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=t.split("|"),s=r[0],i=r[1];this.read(s,i,"read",void 0,void 0,(a,l)=>{a&&this.logger.warn(`${n}loading namespace ${i} for language ${s} failed`,a),!a&&l&&this.logger.log(`${n}loaded namespace ${i} for language ${s}`,l),this.loaded(t,a,l)})}saveMissing(t,n,r,s,i){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},l=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend&&this.backend.create){const c={...a,isUpdate:i},u=this.backend.create.bind(this.backend);if(u.length<6)try{let f;u.length===5?f=u(t,n,r,s,c):f=u(t,n,r,s),f&&typeof f.then=="function"?f.then(d=>l(null,d)).catch(l):l(null,f)}catch(f){l(f)}else u(t,n,r,s,l,c)}!t||!t[0]||this.store.addResource(t[0],n,r,s)}}}const cC=()=>({debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),ht(e[1])&&(t.defaultValue=e[1]),ht(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const n=e[3]||e[2];Object.keys(n).forEach(r=>{t[r]=n[r]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),uC=e=>(ht(e.ns)&&(e.ns=[e.ns]),ht(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),ht(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),dp=()=>{},EG=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class jd extends Om{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=uC(t),this.services={},this.logger=mi,this.modules={external:[]},EG(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initImmediate)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof n=="function"&&(r=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(ht(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const s=cC();this.options={...s,...this.options,...uC(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...s.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);const i=f=>f?typeof f=="function"?new f:f:null;if(!this.options.isClone){this.modules.logger?mi.init(i(this.modules.logger),this.options):mi.init(null,this.options);let f;this.modules.formatter?f=this.modules.formatter:typeof Intl<"u"&&(f=jG);const d=new oC(this.options);this.store=new sC(this.options.resources,this.options);const p=this.services;p.logger=mi,p.resourceStore=this.store,p.languageUtils=d,p.pluralResolver=new vG(d,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),f&&(!this.options.interpolation.format||this.options.interpolation.format===s.interpolation.format)&&(p.formatter=i(f),p.formatter.init(p,this.options),this.options.interpolation.format=p.formatter.format.bind(p.formatter)),p.interpolator=new SG(this.options),p.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},p.backendConnector=new _G(i(this.modules.backend),p.resourceStore,p,this.options),p.backendConnector.on("*",function(h){for(var g=arguments.length,k=new Array(g>1?g-1:0),w=1;w<g;w++)k[w-1]=arguments[w];t.emit(h,...k)}),this.modules.languageDetector&&(p.languageDetector=i(this.modules.languageDetector),p.languageDetector.init&&p.languageDetector.init(p,this.options.detection,this.options)),this.modules.i18nFormat&&(p.i18nFormat=i(this.modules.i18nFormat),p.i18nFormat.init&&p.i18nFormat.init(this)),this.translator=new Uh(this.services,this.options),this.translator.on("*",function(h){for(var g=arguments.length,k=new Array(g>1?g-1:0),w=1;w<g;w++)k[w-1]=arguments[w];t.emit(h,...k)}),this.modules.external.forEach(h=>{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,r||(r=dp),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const f=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);f.length>0&&f[0]!=="dev"&&(this.options.lng=f[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(f=>{this[f]=function(){return t.store[f](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(f=>{this[f]=function(){return t.store[f](...arguments),t}});const c=du(),u=()=>{const f=(d,p)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),c.resolve(p),r(d,p)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return f(null,this.t.bind(this));this.changeLanguage(this.options.lng,f)};return this.options.resources||!this.options.initImmediate?u():setTimeout(u,0),c}loadResources(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:dp;const s=ht(t)?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(s&&s.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const i=[],a=l=>{if(!l||l==="cimode")return;this.services.languageUtils.toResolveHierarchy(l).forEach(u=>{u!=="cimode"&&i.indexOf(u)<0&&i.push(u)})};s?a(s):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(c=>a(c)),this.options.preload&&this.options.preload.forEach(l=>a(l)),this.services.backendConnector.load(i,this.options.ns,l=>{!l&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(l)})}else r(null)}reloadResources(t,n,r){const s=du();return typeof t=="function"&&(r=t,t=void 0),typeof n=="function"&&(r=n,n=void 0),t||(t=this.languages),n||(n=this.options.ns),r||(r=dp),this.services.backendConnector.reload(t,n,i=>{s.resolve(),r(i)}),s}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&dT.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1))for(let n=0;n<this.languages.length;n++){const r=this.languages[n];if(!(["cimode","dev"].indexOf(r)>-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(t,n){var r=this;this.isLanguageChangingTo=t;const s=du();this.emit("languageChanging",t);const i=c=>{this.language=c,this.languages=this.services.languageUtils.toResolveHierarchy(c),this.resolvedLanguage=void 0,this.setResolvedLanguage(c)},a=(c,u)=>{u?(i(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,s.resolve(function(){return r.t(...arguments)}),n&&n(c,function(){return r.t(...arguments)})},l=c=>{!t&&!c&&this.services.languageDetector&&(c=[]);const u=ht(c)?c:this.services.languageUtils.getBestMatchFromCodes(c);u&&(this.language||i(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,f=>{a(f,u)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?l(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(l):this.services.languageDetector.detect(l):l(t),s}getFixedT(t,n,r){var s=this;const i=function(a,l){let c;if(typeof l!="object"){for(var u=arguments.length,f=new Array(u>2?u-2:0),d=2;d<u;d++)f[d-2]=arguments[d];c=s.options.overloadTranslationOptionHandler([a,l].concat(f))}else c={...l};c.lng=c.lng||i.lng,c.lngs=c.lngs||i.lngs,c.ns=c.ns||i.ns,c.keyPrefix!==""&&(c.keyPrefix=c.keyPrefix||r||i.keyPrefix);const p=s.options.keySeparator||".";let h;return c.keyPrefix&&Array.isArray(a)?h=a.map(g=>`${c.keyPrefix}${p}${g}`):h=c.keyPrefix?`${c.keyPrefix}${p}${a}`:a,s.t(h,c)};return ht(t)?i.lng=t:i.lngs=t,i.ns=n,i.keyPrefix=r,i}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],s=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(l,c)=>{const u=this.services.backendConnector.state[`${l}|${c}`];return u===-1||u===0||u===2};if(n.precheck){const l=n.precheck(this,a);if(l!==void 0)return l}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(r,t)&&(!s||a(i,t)))}loadNamespaces(t,n){const r=du();return this.options.ns?(ht(t)&&(t=[t]),t.forEach(s=>{this.options.ns.indexOf(s)<0&&this.options.ns.push(s)}),this.loadResources(s=>{r.resolve(),n&&n(s)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=du();ht(t)&&(t=[t]);const s=this.options.preload||[],i=t.filter(a=>s.indexOf(a)<0&&this.services.languageUtils.isSupportedCode(a));return i.length?(this.options.preload=s.concat(i),this.loadResources(a=>{r.resolve(),n&&n(a)}),r):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!t)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services&&this.services.languageUtils||new oC(cC());return n.indexOf(r.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new jd(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:dp;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const s={...this.options,...t,isClone:!0},i=new jd(s);return(t.debug!==void 0||t.prefix!==void 0)&&(i.logger=i.logger.clone(t)),["store","services","language"].forEach(l=>{i[l]=this[l]}),i.services={...this.services},i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},r&&(i.store=new sC(this.store.data,s),i.services.resourceStore=i.store),i.translator=new Uh(i.services,s),i.translator.on("*",function(l){for(var c=arguments.length,u=new Array(c>1?c-1:0),f=1;f<c;f++)u[f-1]=arguments[f];i.emit(l,...u)}),i.init(s,n),i.translator.options=s,i.translator.backendConnector.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},i}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const fr=jd.createInstance();fr.createInstance=jd.createInstance;fr.createInstance;fr.dir;fr.init;fr.loadResources;fr.reloadResources;fr.use;fr.changeLanguage;fr.getFixedT;fr.t;fr.exists;fr.setDefaultNamespace;fr.hasLoadedNamespace;fr.loadNamespaces;fr.loadLanguages;function AG(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Cd(e){"@babel/helpers - typeof";return Cd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Cd(e)}function PG(e,t){if(Cd(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Cd(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function IG(e){var t=PG(e,"string");return Cd(t)=="symbol"?t:t+""}function RG(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,IG(r.key),r)}}function TG(e,t,n){return t&&RG(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var fT=[],MG=fT.forEach,$G=fT.slice;function LG(e){return MG.call($G.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}var dC=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,OG=function(t,n,r){var s=r||{};s.path=s.path||"/";var i=encodeURIComponent(n),a="".concat(t,"=").concat(i);if(s.maxAge>0){var l=s.maxAge-0;if(Number.isNaN(l))throw new Error("maxAge should be a Number");a+="; Max-Age=".concat(Math.floor(l))}if(s.domain){if(!dC.test(s.domain))throw new TypeError("option domain is invalid");a+="; Domain=".concat(s.domain)}if(s.path){if(!dC.test(s.path))throw new TypeError("option path is invalid");a+="; Path=".concat(s.path)}if(s.expires){if(typeof s.expires.toUTCString!="function")throw new TypeError("option expires is invalid");a+="; Expires=".concat(s.expires.toUTCString())}if(s.httpOnly&&(a+="; HttpOnly"),s.secure&&(a+="; Secure"),s.sameSite){var c=typeof s.sameSite=="string"?s.sameSite.toLowerCase():s.sameSite;switch(c){case!0:a+="; SameSite=Strict";break;case"lax":a+="; SameSite=Lax";break;case"strict":a+="; SameSite=Strict";break;case"none":a+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return a},fC={create:function(t,n,r,s){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(i.expires=new Date,i.expires.setTime(i.expires.getTime()+r*60*1e3)),s&&(i.domain=s),document.cookie=OG(t,encodeURIComponent(n),i)},read:function(t){for(var n="".concat(t,"="),r=document.cookie.split(";"),s=0;s<r.length;s++){for(var i=r[s];i.charAt(0)===" ";)i=i.substring(1,i.length);if(i.indexOf(n)===0)return i.substring(n.length,i.length)}return null},remove:function(t){this.create(t,"",-1)}},DG={name:"cookie",lookup:function(t){var n;if(t.lookupCookie&&typeof document<"u"){var r=fC.read(t.lookupCookie);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupCookie&&typeof document<"u"&&fC.create(n.lookupCookie,t,n.cookieMinutes,n.cookieDomain,n.cookieOptions)}},FG={name:"querystring",lookup:function(t){var n;if(typeof window<"u"){var r=window.location.search;!window.location.search&&window.location.hash&&window.location.hash.indexOf("?")>-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));for(var s=r.substring(1),i=s.split("&"),a=0;a<i.length;a++){var l=i[a].indexOf("=");if(l>0){var c=i[a].substring(0,l);c===t.lookupQuerystring&&(n=i[a].substring(l+1))}}}return n}},fu=null,pC=function(){if(fu!==null)return fu;try{fu=window!=="undefined"&&window.localStorage!==null;var t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{fu=!1}return fu},zG={name:"localStorage",lookup:function(t){var n;if(t.lookupLocalStorage&&pC()){var r=window.localStorage.getItem(t.lookupLocalStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupLocalStorage&&pC()&&window.localStorage.setItem(n.lookupLocalStorage,t)}},pu=null,hC=function(){if(pu!==null)return pu;try{pu=window!=="undefined"&&window.sessionStorage!==null;var t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{pu=!1}return pu},BG={name:"sessionStorage",lookup:function(t){var n;if(t.lookupSessionStorage&&hC()){var r=window.sessionStorage.getItem(t.lookupSessionStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupSessionStorage&&hC()&&window.sessionStorage.setItem(n.lookupSessionStorage,t)}},HG={name:"navigator",lookup:function(t){var n=[];if(typeof navigator<"u"){if(navigator.languages)for(var r=0;r<navigator.languages.length;r++)n.push(navigator.languages[r]);navigator.userLanguage&&n.push(navigator.userLanguage),navigator.language&&n.push(navigator.language)}return n.length>0?n:void 0}},WG={name:"htmlTag",lookup:function(t){var n,r=t.htmlTag||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(n=r.getAttribute("lang")),n}},VG={name:"path",lookup:function(t){var n;if(typeof window<"u"){var r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(r instanceof Array)if(typeof t.lookupFromPathIndex=="number"){if(typeof r[t.lookupFromPathIndex]!="string")return;n=r[t.lookupFromPathIndex].replace("/","")}else n=r[0].replace("/","")}return n}},KG={name:"subdomain",lookup:function(t){var n=typeof t.lookupFromSubdomainIndex=="number"?t.lookupFromSubdomainIndex+1:1,r=typeof window<"u"&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(r)return r[n]}},pT=!1;try{document.cookie,pT=!0}catch{}var hT=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];pT||hT.splice(1,1);function UG(){return{order:hT,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(t){return t}}}var mT=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};AG(this,e),this.type="languageDetector",this.detectors={},this.init(t,n)}return TG(e,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n||{languageUtils:{}},this.options=LG(r,this.options||{},UG()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=function(i){return i.replace("-","_")}),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=s,this.addDetector(DG),this.addDetector(FG),this.addDetector(zG),this.addDetector(BG),this.addDetector(HG),this.addDetector(WG),this.addDetector(VG),this.addDetector(KG)}},{key:"addDetector",value:function(n){return this.detectors[n.name]=n,this}},{key:"detect",value:function(n){var r=this;n||(n=this.options.order);var s=[];return n.forEach(function(i){if(r.detectors[i]){var a=r.detectors[i].lookup(r.options);a&&typeof a=="string"&&(a=[a]),a&&(s=s.concat(a))}}),s=s.map(function(i){return r.options.convertDetectedLanguage(i)}),this.services.languageUtils.getBestMatchFromCodes?s:s.length>0?s[0]:null}},{key:"cacheUserLanguage",value:function(n,r){var s=this;r||(r=this.options.caches),r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(n)>-1||r.forEach(function(i){s.detectors[i]&&s.detectors[i].cacheUserLanguage(n,s.options)}))}}])}();mT.type="languageDetector";const qG={name:"AgentFlow",tagline:"AI Workflow Orchestration"},YG={projects:"Projects",nodes:"Nodes",myNodes:"My Nodes",myFlows:"My Flows",skills:"Skills",mcps:"MCP",feedback:"Feedback",flowEditor:"Flow Editor",settings:"Settings",back:"Back"},GG={loading:"Loading...",saving:"Saving...",save:"Save",cancel:"Cancel",delete:"Delete",edit:"Edit",create:"Create",close:"Close",confirm:"Confirm",copy:"Copy",copied:"Copied!",refresh:"Refresh",search:"Search",filter:"Filter",success:"Success",error:"Error",warning:"Warning",info:"Info",done:"Done",pending:"Pending",running:"Running",notFound:"Not found",required:"Required",optional:"Optional"},JG={success:"Success",failed:"Failed",pending:"Pending",running:"Running",skipped:"Skipped"},XG={agent:"Agent",control:"Control",tool:"Tool",start:"Start",end:"End"},QG={online:"Engine Online",offline:"Engine Offline",connecting:"Connecting…"},ZG={hub:"AgentFlow Hub",docs:"Documentation",github:"GitHub Repository"},eJ={app:qG,nav:YG,common:GG,status:JG,nodeTypes:XG,engine:QG,links:ZG},tJ="Flow Editor",nJ="Nodes",rJ="Edges",sJ="Properties",iJ={label:"Node Label",type:"Node Type",model:"Model",body:"Body",inputs:"Inputs",outputs:"Outputs",addInput:"Add Input",addOutput:"Add Output",remove:"Remove Node",duplicate:"Duplicate Node",nodeType:"Node Type",displayName:"Display Name",displayNameHint:"(letters, numbers, underscores, hyphens, do not start with a number)",role:"Role",modelHint:"From ~/agentflow/model-lists.json; UI service runs agentflow update-model-lists in background on startup",defaultModel:"Default",userPrompt:"User Prompt (USER PROMPT / body)",systemDescription:"System Description (read-only, from node definition)",directCommand:"Direct Command (script)",scriptHint:"(tool_nodejs: skips AI when script exists, executed by pipeline)",diskRunning:"Disk record shows running",deleteNode:"Delete node",inputTooltip:"Input {{name}} | Type: {{type}}",outputTooltip:"Output {{name}} | Type: {{type}}",defaultSuffix:" | Default: {{value}}",fallbackLabel:"Node",expandProvide:"Edit content"},oJ={title:"Node Properties",noInputPins:"No input pins",noOutputPins:"No output pins",type:"Type",name:"Name",defaultValue:"Default / value",description:"Description / format",required:"Req",showOnNode:"Card",requiredHint:"Mark this pin as required so users know it must be connected or given a value",showOnNodeHint:"Show this pin name on the canvas node card; hidden pins can still be connected",pinRequiredAriaLabel:"{{label}} {{index}} required",pinShowOnNodeAriaLabel:"{{label}} {{index}} show on node card",pinDescriptionAriaLabel:"{{label}} {{index}} format description",conversationOutput:"Conversation & Output",addPin:"Add Pin",addPinAriaLabel:"Add {{label}}",handleHint:"Matches Handle index on canvas ({{prefix}}-0, {{prefix}}-1…). After adding/removing/reordering, existing connections may break — check validation after saving.",handle:"Handle",pinTypeAriaLabel:"{{label}} {{index}} type",pinNameAriaLabel:"{{label}} {{index}} name",pinDefaultAriaLabel:"{{label}} {{index}} default",deletePinAriaLabel:"Delete {{label}} {{index}}",deletePin:"Delete this pin",instanceId:"Node ID",yamlValueNotInList:"(YAML value, not in current list)",inputPins:"Input Pins (INPUT)",outputPins:"Output Pins (OUTPUT)",expand:"Expand",collapse:"Collapse",expandEditScript:"Expand edit script",expandEdit:"Expand edit",editScript:"Edit script",editUserPrompt:"Edit user prompt",scriptPlaceholder:"instances.*.script — full shell command; supports ${workspaceRoot}, ${pipelineWorkspace}, ${flowDir}, ${runDir} and slot names (don't quote placeholders)",scriptPlaceholderExpand:"instances.*.script — full shell command; don't quote ${workspaceRoot}, ${pipelineWorkspace}, ${flowDir} placeholders",bodyPlaceholder:"instances.*.body — supports multiline and ${variables}; type ${ to pick a slot",bodyPlaceholderExpand:"instances.*.body — supports multiline and ${variables}",noDescription:"(No description in current node definition)",modelAriaLabel:"Model",placeholderSlots:"Placeholders: input/output slots",publishToMarketplace:"Publish Node",publishToMarketplaceHint:"Publish the current node to the workspace local marketplace",publishing:"Publishing…",publishRunning:"Publishing to local marketplace…",publishSuccess:"Node published to local marketplace",publishSuccessWithId:"Node published: {{id}}"},aJ={run:"Run Flow",stop:"Stop",resume:"Resume",validate:"Validate",export:"Export",import:"Import"},lJ={nodeList:"Node List",runHistory:"Run History",validation:"Validation Results"},cJ={workspace:"Workspace",loading:"Loading...",archived:"Archived",noPipelines:"No pipelines",more:"more",moreFlows:"more flows",noRuns:"No run records",searchNodes:"Search nodes",noComponents:"No components available (check node library directory)",noMatch:"No matching nodes, adjust search terms",selectPipeline:"Select a pipeline from above to load components and canvas",validationWarnings:"Validation warnings (consistent with agentflow validate slot checks)",output:"Output",model:"Model",userDir:"User Directory",toggleRecentActivity:"Toggle recent opened or recent runs"},uJ={selectPipeline:"Please select a pipeline from the dropdown above",loadingProps:"Loading node properties...",pipelineId:"Pipeline ID",diskPath:"Disk Path",storageLocation:"Storage Location",introduction:"Introduction",introductionPlaceholder:"Briefly describe this pipeline (saved as flow.yaml ui.description)",metadata:"Metadata",nodeCount:"Node Count",nodesUnit:"nodes",loading:"Loading...",noRuns:"No run records (run records are generated in the workspace after terminal execution)"},dJ={saving:"Saving...",saved:"Saved",saveFailed:"Save failed",runInTerminal:"Please use terminal to run"},fJ={requirement:"Requirement Analysis",planning:"Technical Planning",code:"Code Execution",test:"Test Regression",normal:"Normal"},pJ={phase:"Phase",allPhasesComplete:"All phases completed",currentPhaseComplete:"Current phase completed, waiting for confirmation..."},hJ={node:"Node",text:"Text",file:"File",bool:"Boolean"},mJ={title:"Node Execution Context",resizeHandle:"Drag to resize node context width",apiConnectError:"Cannot connect to API (please open the page with agentflow ui, or configure /api proxy for Vite dev)",invalidJson:"Response is not valid JSON",requestTimeout:"Request timed out, please retry or check agentflow ui",executingNoArtifacts:"Executing, artifacts not yet written to workspace…",noData:"No data (this run has not reached this node or produced artifacts)",latest:"Latest",detectedContentType:"Detected content type",roundNoContent:"No content in this round",empty:"(empty)",imageTruncated:"Image truncated (exceeds size limit)",statusSuccess:"Success",statusFailed:"Failed",statusRunning:"Running",statusCacheMiss:"Cache miss",statusPending:"Pending"},gJ={title:"Keyboard Shortcuts",general:"General",saveDesc:"Save; when node properties sidebar is open, submit node first then save flow",shortcutsLabel:"Keyboard Shortcuts",jumpToNode:"Jump to node by ID",openNodePalette:"Open node palette",canvas:"Canvas",selectTool:"Select Tool",panTool:"Pan Tool",holdSpacePan:"Hold Space to temporarily pan",saveViewport:"Save current entry view",selectAll:"Select all nodes",undo:"Undo canvas change",redo:"Redo canvas change"},yJ={title:"Jump to node",placeholder:"Type node ID or label…",empty:"No matching nodes",hintNavigate:"navigate",hintJump:"jump",hintClose:"close"},xJ={title:"Start Building Your Flow",text:"Describe your workflow in the AI input box below, or drag nodes from the left panel to the canvas",composerHint:"Build AgentFlow with AI Composer",composerSub:"Drag nodes from the left panel, or describe your workflow in the <strong>input box below</strong>.<br/>Press <kbd>?</kbd> to view shortcuts."},wJ={mainNav:"Main Navigation"},bJ={flowWarningAriaLabel:"Flow validation warnings",reloadFromServer:"Reload flow from server and refresh validation",reloadFromServerShort:"Reload from server",closeBanner:"Close validation warning banner",nodePrefix:"Node",focusNodeAriaLabel:"Select and focus node {{nodeId}} on canvas",slotWarningCount:"Slot validation: {{count}} warnings (hidden)",show:"Show",shortcutHint:"Press ? to view keyboard shortcuts",shortcutHintLabel:"shortcuts",inputSlotNoEdge:' input slot "{{slotName}}" ({{handle}}) has no edge connection',outputSlotNoEdge:' output slot "{{slotName}}" ({{handle}}) has no edge connection'},kJ={title:"AI Assistant",placeholder:"Ask AI to help with this node...",thinking:"Thinking",reply:"Reply",result:"Result",error:"Error",waiting:"Waiting for response...",yourQuestion:"Your question",send:"Send",expand:"Expand conversation",collapse:"Collapse",connecting:"Connecting…",requestFailed:"Request failed",cannotReadStream:"Cannot read response stream",connectTimeout:"Connection timeout (120s), please confirm UI service is running and retry. [CONNECT_TIMEOUT]",aborted:"Aborted",executing:"Executing…",ready:"Ready",done:"Done",inputPlaceholder:"Type your question (⌘/Ctrl+Enter to send)",inputAriaLabel:"Question input",mentionAriaLabel:"Mention: instances and node types",modelLabel:"Model",modelAriaLabel:"Conversation model",modelDefault:"Default",modelNotInList:"(not in current list)",stopGeneration:"Stop generation",conversationOutput:"Conversation & Output",collapseAriaLabel:"Collapse",closeSidebar:"Close sidebar",endConversation:"End conversation (will stop generation)",closeConversation:"Close conversation",newConversation:"New conversation",switchConversation:"Switch conversation",selectedNodesAriaLabel:"Selected nodes list",selectedNodesEmpty:"Select nodes on canvas, or use @ in the input to pick Instances or Node types",removeFromInput:"Remove @{{id}} from input",deselectNode:"Deselect {{id}}",taskPlan:`📋 Task Plan ({{count}} steps):
|
|
286
|
-
{{summary}}`,step:"Step {{current}}/{{total}}: {{description}}",phaseGeneration:`Phased generation ({{count}} phases): {{labels}}
|
|
287
|
-
Current: {{current}}`,phaseComplete:"{{phaseName}} completed. Next phase: {{nextPhase}}",nextPhase:"Next phase",continuePhase:"Continue {{label}}",skipRemainingPhases:"Please complete all remaining steps at once (skip phased confirmation)",phaseProgress:"Phase progress",phaseReviewLabel:"Phase options",phaseReviewHint:'This phase is complete. Review the canvas, then continue to "{{nextPhase}}".',phaseReviewContinue:"Continue: {{label}}",phaseReviewSkip:"Skip — finish remaining in one pass",stepsAriaLabel:"Task steps progress",phasesAriaLabel:"Generation phases progress",phaseNumber:"Phase {{index}}",stepRoleLabel:"Role: {{role}}",stepInstanceLabel:"Instance: {{instanceId}}",pageRefreshReset:"Reset after page refresh",conversationLabel:"Conversation {{n}}"},vJ={currentPipeline:"Current Pipeline",backToEdit:"Back to edit",backToProjects:"Back to projects",executionLog:"Execution log",history:"History",pipelineSettings:"Pipeline settings",shortcutsLabel:"Shortcuts",shortcutsTitle:"Shortcuts (?)",deletePipeline:"Delete pipeline",resumeTitle:"Resume in same run directory (uuid={{uuid}})",resumeTitleNoUuid:"No apply-start received, will start a new run",rerunTitle:"Start a new run from scratch",runOptions:"Run options",runWithParams:"Run with params",runWithPreset:"Run with preset",editRun:"Edit run parameters",startRun:"Start run",stopRun:"Stop background run"},SJ={nodePalette:"Node Palette",noPipelineSelected:"No pipeline selected",moreRuns:"+{{count}} more",moreFlows:"+{{count}} more flows",runId:"Run ID: {{id}}"},NJ={connectingApi:"Connecting to /api/flow/run…",connectingApiResume:"Connecting to /api/flow/run (resuming run uuid={{uuid}})…",connectedReceiving:"Connected to execution stream, receiving NDJSON output…",noBody:"Response has no body (cannot stream), please check browser and agentflow ui version",nodeStart:"▶ Starting: {{instanceId}}",nodeStartWithLabel:"▶ Starting: {{instanceId}} ({{label}})",nodeDone:"✓ Done: {{instanceId}}",nodeDoneWithElapsed:"✓ Done: {{instanceId}} ({{elapsed}})",nodeFailed:"✗ Failed: {{instanceId}}",pipelineStart:"Pipeline started (uuid={{uuid}})",pipelineDone:"Pipeline completed",pipelineDoneWithElapsed:"Pipeline completed ({{elapsed}})",pipelinePaused:"Pipeline paused: waiting for user input ({{nodes}})",unknownError:"Unknown error",executionEnd:"Execution ended (exit code: {{exitCode}})",executionStopped:"Execution paused",pauseRun:"Pause run (can resume later)",pauseConfirm:"Pause the current run? You can resume from the interrupted node later.",pauseTitle:"Pause run",pauseConfirmOk:"Pause",backPromptTitle:"Back to projects",backPromptMessage:"Pipeline still running. Keep it in the background and exit, or stop it and return to edit mode?",backBackground:"Run in background & exit",backStopEdit:"Stop & enter edit",resizeConsole:"Drag to resize execution log height",closeLog:"Close log",userCheckContent:"Waiting for user to confirm content for node {{instanceId}}",userAskPrompt:"Waiting for user to choose branch for node {{instanceId}}"},jJ={close:"Close",loading:"Loading…",placeholder:"File content",largeFileWarning:"Large file, editor performance may be affected",reset:"Reset",aiEdit:"AI Edit",aiRunning:"AI processing…",save:"Save",saving:"Saving…",saved:"Saved"},CJ={title:"Pipeline Settings",subtitle:"Manage basic information, storage, node marketplace, scheduled runs, and metadata.",sectionNav:"Settings sections",basicInfo:"Basic Info",storageAndPath:"Storage & Path",nodeMarketplace:"Node Marketplace",overview:"Pipeline Overview",owner:"Owner",source:"Source",marketplaceNodes:"Marketplace nodes",marketNodesUnit:"market nodes",marketplaceHint:"Local marketplace nodes can be added to this pipeline; installed nodes can then be placed on the canvas.",marketplaceEmpty:"No local marketplace nodes are installed in this workspace yet. Publish one from the node properties panel.",addNodeFromMarket:"Back to canvas",quickActions:"Quick Actions",saveChanges:"Save changes",savingChanges:"Saving…",installNode:"Add to pipeline",installingNode:"Adding…",addInstalledNode:"Add to canvas",previewNode:"Preview",nodePreviewTitle:"Node preview",nodeStylePreview:"Node style preview",closePreview:"Close preview",nodeFunction:"Node purpose",nodePackageInfo:"Package info",definitionId:"Definition ID",version:"Version",packagePath:"Package path",packagedFiles:"Packaged files",marketplaceNoDescription:"No node purpose has been provided.",noInputs:"No inputs",noOutputs:"No outputs",backToCanvas:"Back to canvas",help:"Help",helpText:"Publish nodes from the node properties panel; installed collections sync into the local node marketplace.",archived:"Archived",archivedNote:"This pipeline is in the archive directory (_archived) and cannot be moved between user directory and workspace.",builtinNote:"Built-in templates are read-only; first save will write to workspace .workspace/agentflow/pipelines (pipelines), .workspace/agentflow/nodes (custom nodes), etc.",moveBusy:"Moving…",moveToWorkspace:"Move to workspace",moveToUserDir:"Move to user directory",globalSettings:"Global settings",currentPipeline:"Current pipeline:",builtin:"Built-in",rename:"Rename",renameBusy:"Renaming…",renameSuccess:"Renamed",copyPath:"Copy path",pathCopied:"Copied"},_J={title:"Scheduled Run",enabled:"Enable scheduled trigger",cron:"Cron expression",timezone:"Timezone",preset:"Run preset",defaultPreset:"Default inputs",overlapSkip:"Overlap policy: skip this trigger while the pipeline is running",nextRun:"Next estimated trigger: {{time}}",noNextRun:"No next trigger is configured",runtime:"Scheduler state",running:"Running",waiting:"Waiting",disabled:"Disabled",lastTriggeredAt:"Last triggered",lastSkippedAt:"Last skipped",lastRun:"Last run",lastExit:"Last exit code",lastFinishedAt:"Last finished",readonlyNote:"Built-in or archived pipelines cannot save schedule settings.",save:"Save schedule",saving:"Saving…",saved:"Schedule saved"},EJ={title:"Execution History",summary:"Execution results summary",successCount:"{{count}} succeeded",failedCount:"{{count}} failed",stoppedCount:"{{count}} stopped",interruptedCount:"{{count}} interrupted",runningCount:"{{count}} running",success:"Success",failed:"Failed",stopped:"Stopped",interrupted:"Interrupted",running:"Running",unknown:"Unknown",runLabel:"Run #{{id}}",enterRunView:"Enter run view with canvas and log"},AJ={invalidInstanceId:"Invalid Instance ID: only letters, numbers, underscores, and hyphens allowed, must not start with a number.",duplicateInstanceId:"This Instance ID already exists, please choose another.",loadFlowFailed:"Failed to load flow",loadNodesFailed:"Failed to load node library"},PJ={invalidPlaceholder:"Invalid placeholder: {{hint}}",empty:"(empty)",inputSubtitle:"Input · {{type}}",inputSubtitleNoType:"Input",outputSubtitle:"Output · {{type}}",outputSubtitleNoType:"Output",runtimeConst:"Runtime constant"},IJ={justNow:"Just now",minutesAgo:"{{n}} min ago",hoursAgo:"{{n}} hr ago",yesterday:"Yesterday",daysAgo:"{{n}} days ago",milliseconds:"{{n}} ms",seconds:"{{n}} s"},RJ={title:"User Confirmation ({{instanceId}})",edit:"Edit",save:"Save",cancel:"Cancel",aiEditPlaceholder:"Enter AI edit instruction, e.g., remove item 2, merge first two items…",aiEditBtn:"AI Edit",aiEditStarted:"AI is modifying content…",aiEditDone:"AI modification complete",aiEditFailed:"AI modification failed",contentSaved:"Content saved",saveFailed:"Save failed",close:"Close",continue:"Continue Execution",hint:"Edit or use AI to modify, then save. Click 'Continue Execution' to resume the flow"},TJ={title:"User Choice ({{instanceId}})",hint:"Pick an option below to continue the flow",submitting:"Submitting…",submitFailed:"Submit failed",close:"Close",noOptions:"No options configured on this node. Add items to the output slots in the editor first."},MJ={title:"Print Output: {{instanceId}}",expand:"Expand",restore:"Restore"},$J={save:"Save",cancel:"Cancel"},LJ={title:"Run with Params",noParams:"No input params in this flow",run:"Run",cancel:"Cancel"},OJ={title:"Run with Preset",noPresets:"No presets available",default:"Default run",run:"Run",cancel:"Cancel"},DJ={preset:"Preset",default:"Default",newPreset:"New preset",deletePreset:"Delete preset",presetNamePlaceholder:"Preset name",inputParams:"Input Parameters",noProvideNodes:"No provide nodes in this flow",filePathPlaceholder:"File path…",stringValuePlaceholder:"Value…",presetSaved:"Preset saved",presetDeleted:"Preset Deleted",savePreset:"Save current preset",expandInput:"Edit content"},FJ={title:tJ,nodes:nJ,edges:rJ,properties:sJ,node:iJ,nodeProps:oJ,actions:aJ,panel:lJ,palette:cJ,pipeline:uJ,status:dJ,roles:fJ,phases:pJ,types:hJ,runContext:mJ,shortcuts:gJ,jumpPalette:yJ,emptyCanvas:xJ,sidebar:wJ,validation:bJ,composer:kJ,topbar:vJ,palette2:SJ,run:NJ,fileEdit:jJ,settings:CJ,schedule:_J,history:EJ,nodePropsError:AJ,placeholder:PJ,time:IJ,userCheck:RJ,userAsk:TJ,toolPrint:MJ,provideEdit:$J,runParams:LJ,runPreset:OJ,runConfig:DJ},zJ="Settings",BJ={engine:"Engine Settings",preferences:"Global Preferences"},HJ={title:"Workspace",currentPath:"Current Workspace Root",placeholder:"Loading...",copyPath:"Copy path",description:"Pipelines and node lists are resolved relative to this directory (passed when starting the UI)."},WJ={title:"Cursor CLI",status:{cached:"Cached",notCached:"Not cached"},modelPreviewLabel:"Cursor model id list",modelList:{cached:"Model list cached",empty:"No model list",count:"{{count}} items",fetchedAt:"Updated {{time}}",never:"Never fetched",refresh:"Refresh List",fetching:"Fetching..."}},VJ={modelPreviewLabel:"OpenCode model id list",title:"OpenCode CLI",status:{ready:"Ready",notFound:"Not found"},provider:"Plan / Provider ID",providerPlaceholder:"e.g., bailian-coding-plan",saving:"Saving and updating list...",description:"Corresponds to CLI opencode models <provider> parameter; written to user directory config and triggers model-lists.json refresh after typing stops."},KJ={title:"Claude Code CLI",status:{ready:"Ready",notFound:"Not found"},modelPreviewLabel:"Claude Code model id list",description:"Built-in model list (Claude Code CLI has no models subcommand); refresh probes the claude binary in PATH. Run 'claude /login' first."},UJ={title:"Codex CLI",status:{ready:"Ready",notFound:"Not found"},modelPreviewLabel:"Codex model id list",description:"Model list comes from codex debug models --bundled. Run 'codex login' first."},qJ={title:"Environment Variables",note:"Private to the current signed-in user; overrides service-level env at runtime",noteAdmin:"Configure personal or global env; personal values override global values",saving:"Saving...",key:"Key",value:"Value",scope:"Scope",personal:"Personal",global:"Global",add:"Add",delete:"Delete {{key}}",invalidKey:"Env key must start with a letter or underscore, and only contain letters, numbers, and underscores.",newKey:"New env key",newValue:"Value (be careful with secrets)"},YJ={title:"User Allowlist",description:"Only controls which usernames may register or sign in. Users set their own password on first sign-in.",enabled:"Allowlist enabled",open:"Open registration",refreshing:"Refreshing...",saving:"Saving...",file:"File",fileList:"File allowlist",envList:"Environment allowlist",readonly:"Read-only",userCount:"{{count}} users",remove:"Remove {{username}}",emptyFile:"No file allowlist configured. If env allowlist is also empty, every username can register.",emptyEnv:"AGENTFLOW_USER_WHITELIST / AGENTFLOW_ALLOWED_USERS is not configured",unionHint:"The file allowlist and env allowlist are combined. This only stores usernames, never passwords.",add:"Add"},GJ={title:"System Status",normal:"Service normal",abnormal:"Some interfaces abnormal",cursorModels:"Cursor Models",opencodeModels:"OpenCode Models",claudeCodeModels:"Claude Code Models",codexModels:"Codex Models"},JJ={title:"Shortcuts",projects:"Projects & Pipelines",flowEditor:"Node Canvas"},XJ={title:"Language",description:"Select your preferred language for the interface",options:{zh:"中文",en:"English",ja:"日本語"}},QJ={title:"Onboarding Tour",description:"Restart the product tour to learn about AgentFlow's core features.",reset:"Reset Tour",resetSuccess:"Reset complete. Tour will start automatically on next visit."},ZJ={title:zJ,crumb:BJ,workspace:HJ,cursor:WJ,opencode:VJ,claudeCode:KJ,codex:UJ,env:qJ,allowlist:YJ,system:GJ,shortcuts:JJ,language:XJ,onboarding:QJ},eX={thinking:"Thinking",result:"Result",reply:"Reply",error:"Error"},tX={input:"Ask AI to help edit this node...",waiting:"Waiting for response...",selectedEmpty:"Select a node on the canvas, or use @ in the input to select instances or node types",textarea:"Describe your workflow or ask AI to help (⌘/Ctrl+Enter to send)"},nX={send:"Send",stop:"Stop",expand:"Expand",collapse:"Collapse",clear:"Clear"},rX={conversation:"Chat",conversationWithNumber:"Chat {{num}}",default:"Default"},sX={endSession:"End chat (will stop generation)",closeSession:"Close chat",newSession:"New chat",expandComposer:"Expand chat and output"},iX={hint:"Use the bottom input box for AI chat, with @node mentions, model selection, and more"},oX={aiLabels:eX,placeholders:tX,actions:nX,labels:rX,tooltips:sX,rightPanel:iX},aX="Projects",lX="All",cX="Archived",uX="Nodes",dX="My Nodes",fX="My Flows",pX="Skills",hX="Active Projects",mX="Archived Pipelines",gX="Global Nodes",yX="All Nodes",xX="My Nodes",wX="Manage node versions published to the current workspace marketplace, {{count}} total.",bX="Manage flow snippets published to the current workspace marketplace, {{count}} total.",kX="Global Skills",vX="Create New Project",SX="New Pipeline",NX="SEARCH PIPELINES...",jX="SEARCH NODES...",CX="SEARCH FLOW SNIPPETS...",_X="SEARCH SKILLS...",EX="Refresh Resources",AX="Loading pipelines...",PX="Loading global resources...",IX="Filter result: {{count}} items (matching title, description, path and tags)",RX="Archived pipelines can still be opened and edited; files are located in the _archived subdirectory of each pipelines directory.",TX="Manage your distributed node architectures and monitoring pipelines. Drag flow.yaml or .zip into this page to import shared flows.",MX="Review all globally available node definitions, {{count}} total, including built-in, workspace, and marketplace nodes.",$X="Review Composer-selectable skills, {{count}} total, including AgentFlow built-ins and workspace skills.",LX="Executable building blocks for pipeline runtime",OX="Nodes define what can be placed on the canvas, which inputs and outputs exist, and whether runtime behavior is agent, control, provide, or marketplace logic.",DX="Published local node packages",FX="Only node versions published to this workspace marketplace appear here. Inspect details and delete versions that no flow uses.",zX="Published flow snippets",BX="Flow snippets published from Pipeline or Workspace canvases appear here. Search and inspect them, then load them from the canvas flow palette.",HX="Operating guides for Composer and agents",WX="Skills tell AI which rules to follow for a task, how to change flows, and how to reuse project conventions.",VX="No archived projects.",KX="No active pipelines; archived items are in the Archived tab.",UX="No global nodes available.",qX="No marketplace nodes have been published.",YX="No flow snippets have been published. Select multiple canvas nodes and publish them first.",GX="No skills available.",JX="No description.",XX='No node matches "{{query}}".',QX='No flow snippet matches "{{query}}".',ZX='No skill matches "{{query}}".',eQ="{{inputs}} in / {{outputs}} out",tQ="Flow Snippet",nQ="{{nodes}} nodes / {{edges}} edges",rQ="Skill",sQ="Node detail",iQ="Flow snippet detail",oQ="Skill detail",aQ="Type",lQ="Source",cQ="Package",uQ="Version",dQ="Path",fQ="Editable",pQ="Read only",hQ="Editable",mQ="Schema",gQ="Inputs",yQ="Outputs",xQ="Runtime",wQ="Node Body",bQ="Files",kQ="Usage",vQ="No runtime manifest.",SQ="No node body or README.",NQ="No previewable files.",jQ="Select a file to preview.",CQ="Binary file preview is not supported.",_Q="Large file; showing the first 256KB only.",EQ="No pipelines using this node were found.",AQ="Node Management",PQ="Delete Node Version",IQ="Deleting...",RQ="AgentFlow checks all flow references before deleting; installed or used versions are kept.",TQ="Delete {{id}}@{{version}}? This cannot be undone.",MQ="Deleted {{id}}@{{version}}.",$Q="{{count}} flow(s) still use it.",LQ="Flow Snippet Management",OQ="Delete Flow Snippet",DQ="Deleting...",FQ="Deleting it only removes this reusable marketplace snippet. Nodes already loaded onto canvases are not changed.",zQ="Delete {{id}}@{{version}}? This cannot be undone.",BQ="Deleted {{id}}@{{version}}.",HQ="No slots",WQ="Purpose",VQ="This node is an execution unit in a pipeline. Its schema affects canvas wiring, parameter input, and runtime scheduling.",KQ="A flow snippet is a reusable part of a fixed workflow. Loading it copies its nodes, edges, and layout into the current canvas without replacing existing content.",UQ="Scale",qQ="Flow Preview",YQ="Edges",GQ="Snippet JSON",JQ="{{count}} more edge(s)",XQ="No previewable nodes.",QQ="This skill is injected into Composer as context for AI, constraining its decisions, edit strategy, and output format.",ZQ="SKILL.md Preview",eZ="No preview content available.",tZ="Select a resource to inspect details.",nZ="Failed to load pipeline list.",rZ="No pipelines in current workspace.",sZ="Run {{code1}} in the repository root and ensure the workspace contains {{code2}} or pipelines in the user directory; or click New Pipeline to create one.",iZ='No pipelines found matching "{{query}}". Try different keywords or clear the search.',oZ="Recent Activity",aZ="No recent activity",lZ="No recent activity matching the keyword",cZ="Recent Run",uZ="Recent Open",dZ={builtin:"Built-in",workspace:"Workspace",user:"User"},fZ={flow:"Flow",global:"Global",marketplace:"Marketplace"},pZ={all:"All",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},hZ={overview:"Overview",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},mZ="Open to edit this pipeline in the node canvas.",gZ={eyebrow:"AgentFlow Hub",title:"Browse community flows",desc:"Discover and install ready-made pipelines shared by the community.",cta:"Explore Hub",cliHint:"Or install via CLI: agentflow download <slug>"},yZ={title:"Create New Pipeline",lead:"Enter a pipeline name (English identifier); description is optional and will be saved in flow's ui.description.",nameLabel:"Name (required)",namePlaceholder:"e.g., my_feature_flow",nameHint:"Must start with a letter, only letters, numbers, underscores _ and hyphens - allowed",descLabel:"Description (optional)",descPlaceholder:"Briefly describe the purpose of this pipeline...",locationLabel:"Save Location",userDir:"User Directory (~/agentflow/pipelines)",workspaceDir:"Current Workspace (.workspace/agentflow/pipelines)",createFailed:"Creation failed",creating:"Creating...",createAndOpen:"Create and Open",cancel:"Cancel",close:"Close"},xZ={title:"Import Pipeline",lead:'File "{{filename}}" selected. Please confirm the pipeline name and save location; ZIP will preserve scripts and other files in the directory.',nameLabel:"Name (required)",namePlaceholder:"e.g., my_shared_flow",nameHint:"Must start with a letter, only letters, numbers, underscores _ and hyphens - allowed",locationLabel:"Save Location",userDir:"User Directory (~/agentflow/pipelines)",workspaceDir:"Current Workspace (.workspace/agentflow/pipelines)",changeFile:"Change File...",importFailed:"Import failed",importing:"Importing...",importAndOpen:"Import and Open",cancel:"Cancel",close:"Close"},wZ={title:"Delete Pipeline",lead:'This will permanently delete the pipeline directory from disk (including flow.yaml, scripts, etc.) and cannot be undone. Please enter the pipeline ID "{{flowId}}" below to confirm.',confirmLabel:"Confirm Pipeline Name",deleteFailed:"Delete failed",deleteTimeout:"Delete request timed out, please retry (check UI service logs in terminal)",delete:"Delete",deleting:"Deleting...",confirmDelete:"Confirm Delete",cancel:"Cancel",close:"Close"},bZ={title:"Archive Pipeline",lead:'After archiving, the pipeline will be moved to the "Archived" list and can still be opened and edited from there. Please enter the pipeline ID "{{flowId}}" below to confirm.',confirmLabel:"Confirm Pipeline Name",archiveFailed:"Archive failed",archive:"Archive",archiving:"Archiving...",confirmArchive:"Confirm Archive",cancel:"Cancel",close:"Close"},kZ={title:aX,all:lX,archived:cX,nodes:uX,myNodes:dX,myFlows:fX,skills:pX,activeProjects:hX,archivedPipelines:mX,globalNodes:gX,nodeScopeAll:yX,nodeScopeMine:xX,myNodesHint:wX,myFlowsHint:bX,globalSkills:kX,createNew:vX,newPipeline:SX,searchPipelines:NX,searchNodes:jX,searchFlows:CX,searchSkills:_X,refreshResources:EX,loadingPipelines:AX,loadingResources:PX,filterResult:IX,archivedHint:RX,activeHint:TX,nodesHint:MX,skillsHint:$X,nodesPurposeTitle:LX,nodesPurposeDesc:OX,myNodesPurposeTitle:DX,myNodesPurposeDesc:FX,myFlowsPurposeTitle:zX,myFlowsPurposeDesc:BX,skillsPurposeTitle:HX,skillsPurposeDesc:WX,noArchived:VX,noActive:KX,noNodes:UX,noMyNodes:qX,noMyFlows:YX,noSkills:GX,noDescription:JX,noNodeMatch:XX,noFlowSnippetMatch:QX,noSkillMatch:ZX,nodeSlots:eQ,flowSnippet:tQ,flowSnippetNodes:nQ,skill:rQ,nodeDetail:sQ,flowDetail:iQ,skillDetail:oQ,detailType:aQ,detailSource:lQ,detailPackage:cQ,detailVersion:uQ,detailPath:dQ,detailEditable:fQ,readOnly:pQ,editable:hQ,nodeSchema:mQ,nodeInputs:gQ,nodeOutputs:yQ,nodeRuntime:xQ,nodeBody:wQ,nodeFiles:bQ,nodeUsage:kQ,noRuntimeManifest:vQ,noNodeBody:SQ,noNodeFiles:NQ,selectNodeFile:jQ,binaryFile:CQ,fileTruncated:_Q,noNodeUsage:EQ,myNodeManagement:AQ,deleteMyNode:PQ,deletingMyNode:IQ,deleteMyNodeHint:RQ,deleteMyNodeConfirm:TQ,deleteMyNodeSuccess:MQ,deleteMyNodeUsedBy:$Q,myFlowManagement:LQ,deleteMyFlow:OQ,deletingMyFlow:DQ,deleteMyFlowHint:FQ,deleteMyFlowConfirm:zQ,deleteMyFlowSuccess:BQ,noSlots:HQ,resourceMeaning:WQ,nodesMeaning:VQ,myFlowsMeaning:KQ,flowSnippetScale:UQ,flowSnippetPreview:qQ,flowSnippetEdges:YQ,flowSnippetJson:GQ,flowSnippetMoreEdges:JQ,noFlowSnippetPreview:XQ,skillsMeaning:QQ,skillPreview:ZQ,skillPreviewEmpty:eZ,selectResource:tZ,loadFailed:nZ,noPipelines:rZ,emptyHint:sZ,noMatch:iZ,recentActivity:oZ,noRecentActivity:aZ,noMatchRecent:lZ,recentRun:cZ,recentOpen:uZ,sourceBadge:dZ,resourceSource:fZ,resourceFilter:pZ,nodeDetailTabs:hZ,defaultCardDesc:mZ,hubCard:gZ,newPipelineModal:yZ,importModal:xZ,deleteModal:wZ,archiveModal:bZ},vZ="Back",SZ="Next",NZ="Skip",jZ="Done",CZ="Start Creating",_Z={intro:`Welcome to AgentFlow! This is a visual workflow orchestration tool.
|
|
288
|
-
|
|
289
|
-
Click the button below to create your first pipeline.`,hubIntro:`Don't want to start from scratch?
|
|
290
|
-
|
|
291
|
-
Browse ready-made pipelines on AgentFlow Hub — community-shared flows you can install and run in one click.`},EZ={intro:`Now you're in the flow editor.
|
|
292
|
-
|
|
293
|
-
Describe your requirements in natural language in the input box below, and AI will generate the flow graph.
|
|
294
|
-
|
|
295
|
-
The left node panel allows you to freely drag, delete, and adjust connections.`,introEmpty:`The canvas is empty. Start creating your flow!
|
|
296
|
-
|
|
297
|
-
Describe your requirements in natural language in the input box below, and AI will generate the flow graph.
|
|
298
|
-
|
|
299
|
-
The left node panel allows you to freely drag, delete, and adjust connections.`},AZ={guideTitle:"First-time Creation Guide",guideDesc:"After entering the name and description, AI will automatically generate the flow graph. You can freely adjust nodes and connections in the editor.",nameHintGuide:"e.g., MyFirstFlow (starts with a letter, supports numbers and underscores)",descPlaceholderGuide:"e.g., Implement user login functionality with registration, verification, and authorization",descHintGuide:"More detailed description leads to more accurate AI-generated flow",createGuide:"Create & Start Editing",typeNode:"Node reference type",typeStr:"String type",typeFile:"File path type",typeBool:"Boolean type"},PZ={back:vZ,next:SZ,skip:NZ,done:jZ,startCreate:CZ,projects:_Z,flow:EZ,newPipeline:AZ},IZ={name:"AgentFlow",tagline:"AI 工作流编排"},RZ={projects:"项目",nodes:"Nodes",myNodes:"我的 Nodes",myFlows:"我的流程",skills:"Skills",mcps:"MCP",feedback:"意见反馈",flowEditor:"流程编辑器",settings:"设置",back:"返回"},TZ={loading:"加载中…",saving:"保存中…",save:"保存",cancel:"取消",delete:"删除",edit:"编辑",create:"创建",close:"关闭",confirm:"确认",copy:"复制",copied:"已复制!",refresh:"刷新",search:"搜索",filter:"筛选",success:"成功",error:"错误",warning:"警告",info:"信息",done:"完成",pending:"待处理",running:"运行中",notFound:"未找到",required:"必填",optional:"可选"},MZ={success:"成功",failed:"失败",pending:"等待",running:"运行中",skipped:"跳过"},$Z={agent:"Agent 节点",control:"控制节点",tool:"工具节点",start:"开始",end:"结束"},LZ={online:"引擎在线",offline:"引擎离线",connecting:"连接中…"},OZ={hub:"AgentFlow Hub",docs:"文档",github:"GitHub 仓库"},DZ={app:IZ,nav:RZ,common:TZ,status:MZ,nodeTypes:$Z,engine:LZ,links:OZ},FZ="流程编辑器",zZ="节点",BZ="连线",HZ="属性",WZ={label:"节点标签",type:"节点类型",model:"模型",body:"内容",inputs:"输入",outputs:"输出",addInput:"添加输入",addOutput:"添加输出",remove:"删除节点",duplicate:"复制节点",nodeType:"节点类型",displayName:"显示名称",displayNameHint:"(字母、数字、下划线、短横线,勿以数字开头)",role:"角色",modelHint:"来自 ~/agentflow/model-lists.json;UI 服务启动时会后台执行 agentflow update-model-lists",defaultModel:"默认",userPrompt:"用户提示(USER PROMPT / body)",systemDescription:"系统说明(只读,来自节点定义)",directCommand:"直接执行命令",scriptHint:"(tool_nodejs:有 script 时跳过 AI,由流水线执行)",diskRunning:"磁盘记录为执行中",deleteNode:"删除节点",inputTooltip:"输入 {{name}} | 类型: {{type}}",outputTooltip:"输出 {{name}} | 类型: {{type}}",defaultSuffix:" | 默认: {{value}}",fallbackLabel:"节点",expandProvide:"编辑内容"},VZ={title:"节点属性",noInputPins:"当前无输入引脚",noOutputPins:"当前无输出引脚",type:"类型",name:"名称",defaultValue:"默认值 / value",description:"描述 / 格式",required:"必填",showOnNode:"卡片",requiredHint:"标记为必填,用于提示用户该槽位必须提供值或连线",showOnNodeHint:"是否在画布节点卡片旁展示这个引脚名称;关闭后仍可连线",pinRequiredAriaLabel:"{{label}} {{index}} 是否必填",pinShowOnNodeAriaLabel:"{{label}} {{index}} 是否在节点卡片展示",pinDescriptionAriaLabel:"{{label}} {{index}} 格式描述",conversationOutput:"对话与输出",addPin:"添加引脚",addPinAriaLabel:"添加{{label}}",handleHint:"与画布上 Handle 序号一致({{prefix}}-0、{{prefix}}-1…)。增删或调整顺序后,原有连线可能失效,保存后请留意校验提示。",handle:"Handle",pinTypeAriaLabel:"{{label}} {{index}} 类型",pinNameAriaLabel:"{{label}} {{index}} 名称",pinDefaultAriaLabel:"{{label}} {{index}} 默认值",deletePinAriaLabel:"删除 {{label}} {{index}}",deletePin:"删除此引脚",instanceId:"节点 ID",yamlValueNotInList:"(YAML 中的值,不在当前列表)",inputPins:"输入引脚(INPUT)",outputPins:"输出引脚(OUTPUT)",expand:"展开",collapse:"收起",expandEditScript:"展开编辑 script",expandEdit:"展开编辑",editScript:"编辑 script",editUserPrompt:"编辑用户提示",scriptPlaceholder:"instances.*.script,完整 shell 命令;支持 ${workspaceRoot}、${pipelineWorkspace}、${flowDir}、${runDir} 与各槽位名(勿对占位符再包双引号)",scriptPlaceholderExpand:"instances.*.script,完整 shell 命令;勿对 ${workspaceRoot}、${pipelineWorkspace}、${flowDir} 等占位符再包双引号",bodyPlaceholder:"instances.*.body,支持多行与 ${变量};输入 ${ 选择槽位",bodyPlaceholderExpand:"instances.*.body,支持多行与 ${变量}",noDescription:"(当前节点定义无 description)",modelAriaLabel:"模型",placeholderSlots:"占位符:输入输出槽位",publishToMarketplace:"发布节点",publishToMarketplaceHint:"将当前节点发布到 Workspace 本地节点市场",publishing:"发布中…",publishRunning:"正在发布到本地节点市场…",publishSuccess:"节点已发布到本地节点市场",publishSuccessWithId:"节点已发布:{{id}}"},KZ={run:"运行流程",stop:"停止",resume:"继续",validate:"校验",export:"导出",import:"导入"},UZ={nodeList:"节点列表",runHistory:"运行历史",validation:"校验结果"},qZ={workspace:"工作区",loading:"加载中…",archived:"已归档",noPipelines:"暂无流水线",more:"更多",moreFlows:"更多流程",noRuns:"暂无运行记录",searchNodes:"搜索节点",noComponents:"暂无可用组件(检查节点库目录)",noMatch:"无匹配节点,请调整搜索词",selectPipeline:"从上方选择一条流水线以加载组件与画布",validationWarnings:"校验警告(与 agentflow validate 槽位检查一致)",output:"输出",model:"模型",userDir:"用户目录",toggleRecentActivity:"展开或收起最近打开或最近运行"},YZ={selectPipeline:"请从顶部下拉选择一条流水线",loadingProps:"加载节点属性…",pipelineId:"流水线 ID",diskPath:"磁盘路径",storageLocation:"存储位置",introduction:"介绍",introductionPlaceholder:"简要描述这条流水线的用途(写入 flow.yaml 的 ui.description)",metadata:"元数据",nodeCount:"节点数",nodesUnit:"个节点",loading:"加载中…",noRuns:"暂无运行记录(终端执行后会在工作区生成运行目录)"},GZ={saving:"保存中…",saved:"已保存",saveFailed:"保存失败",runInTerminal:"运行请使用终端"},JZ={requirement:"需求拆解",planning:"技术规划",code:"代码执行",test:"测试回归",normal:"普通"},XZ={phase:"阶段",allPhasesComplete:"所有阶段完成",currentPhaseComplete:"当前阶段完成,等待确认继续…"},QZ={node:"节点",text:"文本",file:"文件",bool:"布尔"},ZZ={title:"节点执行上下文",resizeHandle:"拖动调整节点上下文宽度",apiConnectError:"无法连接 API(请使用 agentflow ui 打开页面,或为 Vite 开发配置 /api 代理)",invalidJson:"响应不是有效 JSON",requestTimeout:"请求超时,请稍后重试或检查 agentflow ui",executingNoArtifacts:"执行中,产物尚未写入工作区…",noData:"暂无数据(本 run 尚未执行到该节点或未产生产物)",latest:"最新",detectedContentType:"检测到的内容类型",roundNoContent:"该轮次暂无内容",empty:"(空)",imageTruncated:"图像已截断(超过大小上限)",statusSuccess:"成功",statusFailed:"失败",statusRunning:"运行中",statusCacheMiss:"缓存失效",statusPending:"等待"},eee={title:"快捷键",general:"常规",saveDesc:"保存;节点属性侧栏打开时先提交节点再保存 flow",shortcutsLabel:"快捷键",jumpToNode:"按 ID 跳转到节点",openNodePalette:"打开节点面板",canvas:"画布",selectTool:"选择工具",panTool:"平移工具",holdSpacePan:"按住空格临时平移",saveViewport:"保存当前进入视角",selectAll:"全选所有节点",undo:"撤销画布修改",redo:"重做画布修改"},tee={title:"跳转到节点",placeholder:"输入节点 ID 或名称…",empty:"未匹配到节点",hintNavigate:"切换",hintJump:"跳转",hintClose:"关闭"},nee={title:"开始构建你的流程",text:"在下方 AI 输入框中描述你的流程,或从左侧面板拖拽节点到画布",composerHint:"使用 AI Composer 构建 AgentFlow",composerSub:"从左侧拖入节点,或在<strong>下方输入框</strong>中用自然语言描述工作流。<br/>按 <kbd>?</kbd> 查看快捷键。"},ree={mainNav:"主导航"},see={flowWarningAriaLabel:"流程校验警告",reloadFromServer:"从服务器重新加载流程并刷新校验",reloadFromServerShort:"从服务器重新加载",closeBanner:"关闭校验警告横幅",nodePrefix:"节点",focusNodeAriaLabel:"在画布中选中并定位节点 {{nodeId}}",slotWarningCount:"槽位校验 {{count}} 条(已隐藏)",show:"显示",shortcutHint:"按 ? 查看快捷键",shortcutHintLabel:"快捷键",inputSlotNoEdge:' 的 input 槽位 "{{slotName}}"({{handle}})无对应 edge 连接',outputSlotNoEdge:' 的 output 槽位 "{{slotName}}"({{handle}})无对应 edge 连接'},iee={title:"AI 助手",placeholder:"让 AI 协助编辑此节点…",thinking:"思考",reply:"回复",result:"结果",error:"错误",waiting:"等待响应…",yourQuestion:"您的问题",send:"发送",expand:"展开对话",collapse:"收起",connecting:"连接中…",requestFailed:"请求失败",cannotReadStream:"无法读取响应流",connectTimeout:"连接超时(120s),请确认 UI 服务正在运行并重试。[CONNECT_TIMEOUT]",aborted:"已中止",executing:"执行中…",ready:"就绪",done:"完成",inputPlaceholder:"在此输入问题(⌘/Ctrl+Enter 发送)",inputAriaLabel:"问题输入",mentionAriaLabel:"提及:实例与节点类型",modelLabel:"模型",modelAriaLabel:"对话模型",modelDefault:"默认",modelNotInList:"(不在当前列表)",stopGeneration:"停止生成",conversationOutput:"对话与输出",collapseAriaLabel:"收起",closeSidebar:"关闭侧栏",endConversation:"结束对话(将停止生成)",closeConversation:"关闭对话",newConversation:"新建对话",switchConversation:"切换对话",selectedNodesAriaLabel:"已选节点列表",selectedNodesEmpty:"在画布上选择节点,或在输入框用 @ 选择实例(Instances)或节点类型(Node)",removeFromInput:"从输入中移除 @{{id}}",deselectNode:"取消选中 {{id}}",taskPlan:`📋 任务规划({{count}} 步):
|
|
300
|
-
{{summary}}`,step:"步骤 {{current}}/{{total}}: {{description}}",phaseGeneration:`分阶段生成({{count}} 阶段):{{labels}}
|
|
301
|
-
当前:{{current}}`,phaseComplete:"{{phaseName}}已完成。下一阶段:{{nextPhase}}",nextPhase:"下一阶段",continuePhase:"继续{{label}}",skipRemainingPhases:"请一次性完成剩余所有步骤(跳过分阶段确认)",phaseProgress:"分阶段进度",phaseReviewLabel:"分阶段选项",phaseReviewHint:"当前阶段完成,请在画布上检查结果,确认无误后进入「{{nextPhase}}」",phaseReviewContinue:"继续:{{label}}",phaseReviewSkip:"跳过,一次性完成剩余",stepsAriaLabel:"任务步骤进度",phasesAriaLabel:"生成阶段进度",phaseNumber:"第 {{index}} 阶段",stepRoleLabel:"角色:{{role}}",stepInstanceLabel:"实例:{{instanceId}}",pageRefreshReset:"页面刷新后重置",conversationLabel:"对话 {{n}}"},oee={currentPipeline:"当前流水线",backToEdit:"返回编辑",backToProjects:"返回项目",executionLog:"执行日志",history:"历史",pipelineSettings:"流水线设置",shortcutsLabel:"快捷键",shortcutsTitle:"快捷键 (?)",deletePipeline:"删除流水线",resumeTitle:"在同一 run 目录继续执行(uuid={{uuid}})",resumeTitleNoUuid:"尚未收到 apply-start,将发起新的 run",rerunTitle:"从头开始新的运行",runOptions:"运行选项",runWithParams:"带参数运行",runWithPreset:"指定预设运行",editRun:"编辑运行参数",startRun:"开始执行",stopRun:"停止后台运行"},aee={nodePalette:"节点调色板",noPipelineSelected:"未选择流水线",moreRuns:"+{{count}} 更多",moreFlows:"+{{count}} 更多流程",runId:"运行 ID: {{id}}"},lee={connectingApi:"正在连接 /api/flow/run…",connectingApiResume:"正在连接 /api/flow/run(恢复 run uuid={{uuid}})…",connectedReceiving:"已连接执行流,正在接收 NDJSON 输出…",noBody:"响应无 body(无法流式读取),请检查浏览器与 agentflow ui 版本",nodeStart:"▶ 开始执行: {{instanceId}}",nodeStartWithLabel:"▶ 开始执行: {{instanceId}} ({{label}})",nodeDone:"✓ 完成: {{instanceId}}",nodeDoneWithElapsed:"✓ 完成: {{instanceId}} ({{elapsed}})",nodeFailed:"✗ 失败: {{instanceId}}",pipelineStart:"流水线开始执行 (uuid={{uuid}})",pipelineDone:"流水线执行完成",pipelineDoneWithElapsed:"流水线执行完成 ({{elapsed}})",pipelinePaused:"流水线暂停: 等待用户输入 ({{nodes}})",unknownError:"未知错误",executionEnd:"执行结束 (exit code: {{exitCode}})",executionStopped:"执行已暂停",pauseRun:"暂停运行(可稍后恢复)",pauseConfirm:"确认暂停当前 run?之后可从中断节点恢复。",pauseTitle:"暂停运行",pauseConfirmOk:"暂停",backPromptTitle:"返回项目列表",backPromptMessage:"流水线仍在运行,请选择处理方式:后台继续运行并退出,或停止后返回编辑。",backBackground:"后台运行并退出",backStopEdit:"停止并进入编辑",resizeConsole:"拖动调整执行日志高度",closeLog:"关闭日志",userCheckContent:"等待用户确认节点 {{instanceId}} 的内容",userAskPrompt:"等待用户选择节点 {{instanceId}} 的分支"},cee={close:"关闭",loading:"加载中…",placeholder:"文件内容",largeFileWarning:"文件较大,编辑器性能可能受影响",reset:"重置",aiEdit:"AI 修改",aiRunning:"AI 处理中…",save:"保存",saving:"保存中…",saved:"已保存"},uee={title:"流水线设置",subtitle:"管理流水线的基础信息、存储位置、节点市场、定时任务与元数据。",sectionNav:"设置分区",basicInfo:"基础信息",storageAndPath:"存储与路径",nodeMarketplace:"节点市场配置",overview:"流水线概览",owner:"所有者",source:"来源",marketplaceNodes:"市场节点",marketNodesUnit:"个市场节点",marketplaceHint:"本地市场中的节点可加入当前流水线;已加入后可直接添加到画布。",marketplaceEmpty:"当前工作区还没有安装本地市场节点。可在节点属性面板发布节点。",addNodeFromMarket:"返回画布添加节点",quickActions:"快捷操作",saveChanges:"保存更改",savingChanges:"保存中…",installNode:"加入流水线",installingNode:"加入中…",addInstalledNode:"添加到画布",previewNode:"预览",nodePreviewTitle:"节点预览",nodeStylePreview:"节点样式预览",closePreview:"关闭预览",nodeFunction:"节点用途",nodePackageInfo:"包信息",definitionId:"Definition ID",version:"版本",packagePath:"包路径",packagedFiles:"打包文件",marketplaceNoDescription:"暂无节点用途说明。",noInputs:"无输入",noOutputs:"无输出",backToCanvas:"返回画布",help:"帮助中心",helpText:"节点发布入口在节点属性面板;合集安装后会同步进入本地节点市场。",archived:"已归档",archivedNote:"此流水线位于归档目录(_archived),无法在用户目录与工作区之间移动。",builtinNote:"内置模板只读;首次保存将写入工作区 .workspace/agentflow/pipelines(流水线)、.workspace/agentflow/nodes(自定义节点)等;旧 .cursor/agentflow/ 下文件仍可读。",moveBusy:"移动中…",moveToWorkspace:"移动到工作区",moveToUserDir:"移动到用户目录",globalSettings:"全局设置",currentPipeline:"当前流水线:",builtin:"内置",rename:"重命名",renameBusy:"重命名中…",renameSuccess:"已重命名",copyPath:"复制路径",pathCopied:"已复制"},dee={title:"定时执行",enabled:"启用定时触发",cron:"Cron 表达式",timezone:"时区",preset:"运行参数预设",defaultPreset:"默认参数",overlapSkip:"重叠策略:运行中则跳过本次触发",nextRun:"下一次预计触发:{{time}}",noNextRun:"未设置下一次触发时间",runtime:"调度状态",running:"运行中",waiting:"等待触发",disabled:"未启用",lastTriggeredAt:"最近触发",lastSkippedAt:"最近跳过",lastRun:"最近 Run",lastExit:"最近退出码",lastFinishedAt:"最近结束",readonlyNote:"内置或归档流水线不可保存定时配置。",save:"保存定时配置",saving:"保存中…",saved:"定时配置已保存"},fee={title:"执行历史",summary:"执行结果汇总",successCount:"{{count}} 成功",failedCount:"{{count}} 失败",stoppedCount:"{{count}} 已停止",interruptedCount:"{{count}} 已中断",runningCount:"{{count}} 进行中",success:"成功",failed:"失败",stopped:"已停止",interrupted:"已中断",running:"进行中",unknown:"未知",runLabel:"运行 #{{id}}",enterRunView:"进入该次运行的画布与日志态"},pee={invalidInstanceId:"实例 ID 格式无效:仅允许英文字母、数字、下划线、短横线,且不能以数字开头。",duplicateInstanceId:"该实例 ID 已存在,请换一个。",loadFlowFailed:"读取 flow 失败",loadNodesFailed:"读取节点库失败"},hee={invalidPlaceholder:"无效占位符: {{hint}}",empty:"(空)",inputSubtitle:"输入 · {{type}}",inputSubtitleNoType:"输入",outputSubtitle:"输出 · {{type}}",outputSubtitleNoType:"输出",runtimeConst:"运行时常量"},mee={justNow:"刚刚",minutesAgo:"{{n}} 分钟前",hoursAgo:"{{n}} 小时前",yesterday:"昨天",daysAgo:"{{n}} 天前",milliseconds:"{{n}} 毫秒",seconds:"{{n}} 秒"},gee={title:"用户确认 ({{instanceId}})",edit:"编辑",save:"保存",cancel:"取消",aiEditPlaceholder:"输入 AI 修改指令,如:删除第二项、合并前两项…",aiEditBtn:"AI 修改",aiEditStarted:"AI 正在修改内容…",aiEditDone:"AI 修改完成",aiEditFailed:"AI 修改失败",contentSaved:"内容已保存",saveFailed:"保存失败",close:"关闭",continue:"继续执行",hint:"编辑或使用 AI 修改后点击保存,然后点击「继续执行」恢复流程"},yee={title:"用户选择 ({{instanceId}})",hint:"请从下方选项中选择一项以继续流程",submitting:"提交中…",submitFailed:"提交失败",close:"关闭",noOptions:"该节点未配置选项,请先在编辑器中为 output 槽位添加条目。"},xee={title:"Print 输出: {{instanceId}}",expand:"放大",restore:"还原"},wee={save:"保存",cancel:"取消"},bee={title:"带参数运行",noParams:"此流程无输入参数",run:"运行",cancel:"取消"},kee={title:"指定预设运行",noPresets:"无可用预设",default:"默认运行",run:"运行",cancel:"取消"},vee={preset:"预设",default:"默认",newPreset:"新建预设",deletePreset:"删除预设",presetNamePlaceholder:"预设名称",inputParams:"输入参数",noProvideNodes:"此流程无 provide 节点",filePathPlaceholder:"文件路径…",stringValuePlaceholder:"值…",presetSaved:"预设已保存",presetDeleted:"预设已删除",savePreset:"保存当前预设",expandInput:"编辑内容"},See={title:FZ,nodes:zZ,edges:BZ,properties:HZ,node:WZ,nodeProps:VZ,actions:KZ,panel:UZ,palette:qZ,pipeline:YZ,status:GZ,roles:JZ,phases:XZ,types:QZ,runContext:ZZ,shortcuts:eee,jumpPalette:tee,emptyCanvas:nee,sidebar:ree,validation:see,composer:iee,topbar:oee,palette2:aee,run:lee,fileEdit:cee,settings:uee,schedule:dee,history:fee,nodePropsError:pee,placeholder:hee,time:mee,userCheck:gee,userAsk:yee,toolPrint:xee,provideEdit:wee,runParams:bee,runPreset:kee,runConfig:vee},Nee="设置",jee={engine:"引擎设置",preferences:"全局首选项"},Cee={title:"工作区",currentPath:"当前工作区根目录",placeholder:"加载中…",copyPath:"复制路径",description:"流水线与节点清单将相对于此目录解析(由启动 UI 时传入)。"},_ee={title:"Cursor CLI",status:{cached:"已缓存",notCached:"未缓存"},modelPreviewLabel:"Cursor 模型名称列表",modelList:{cached:"模型清单已缓存",empty:"暂无模型列表",count:"{{count}} 条",fetchedAt:"更新 {{time}}",never:"尚未拉取",refresh:"刷新清单",fetching:"拉取中…"}},Eee={modelPreviewLabel:"OpenCode 模型名称列表",title:"OpenCode CLI",status:{ready:"就绪",notFound:"未找到"},provider:"方案 / Provider 标识",providerPlaceholder:"例如 bailian-coding-plan",saving:"正在保存并更新清单…",description:"对应 CLI opencode models <provider> 的参数;停止输入后会写入用户目录 config 并刷新 model-lists.json。"},Aee={title:"Claude Code CLI",status:{ready:"就绪",notFound:"未找到"},modelPreviewLabel:"Claude Code 模型名称列表",description:"内置模型列表(Claude Code CLI 无 models 子命令);刷新将探测 claude 二进制是否在 PATH 中。首次使用请先执行 claude /login。"},Pee={title:"Codex CLI",status:{ready:"就绪",notFound:"未找到"},modelPreviewLabel:"Codex 模型名称列表",description:"模型列表来自 codex debug models --bundled;首次使用请先执行 codex login。"},Iee={title:"环境变量",note:"当前登录用户私有,运行时优先于服务全局环境变量",noteAdmin:"可配置个人或全局环境变量;个人同名变量优先于全局",saving:"正在保存...",key:"键",value:"值",scope:"范围",personal:"个人",global:"全局",add:"添加",delete:"删除 {{key}}",invalidKey:"环境变量名必须以字母或下划线开头,且只能包含字母、数字和下划线。",newKey:"新环境变量键",newValue:"值(密钥请谨慎)"},Ree={title:"用户白名单",description:"只控制 username 是否允许注册或登录,密码由用户首次登录时自行设置。",enabled:"白名单已启用",open:"开放注册",refreshing:"刷新中...",saving:"保存中...",file:"文件",fileList:"文件白名单",envList:"环境变量白名单",readonly:"只读",userCount:"{{count}} 个用户",remove:"删除 {{username}}",emptyFile:"未配置文件白名单;如果环境变量也为空,则所有用户可注册。",emptyEnv:"未配置 AGENTFLOW_USER_WHITELIST / AGENTFLOW_ALLOWED_USERS",unionHint:"文件白名单与环境变量白名单取并集;这里只会保存用户名,不保存密码。",add:"添加"},Tee={title:"系统状态",normal:"服务正常",abnormal:"部分接口异常",cursorModels:"Cursor 模型",opencodeModels:"OpenCode 模型",claudeCodeModels:"Claude Code 模型",codexModels:"Codex 模型"},Mee={title:"快捷入口",projects:"项目与流水线",flowEditor:"节点画布"},$ee={title:"语言",description:"选择界面显示语言",options:{zh:"中文",en:"English",ja:"日本語"}},Lee={title:"新手引导",description:"重新启动产品引导流程,了解 AgentFlow 的核心功能。",reset:"重置引导",resetSuccess:"已重置,下次访问将自动启动引导"},Oee={title:Nee,crumb:jee,workspace:Cee,cursor:_ee,opencode:Eee,claudeCode:Aee,codex:Pee,env:Iee,allowlist:Ree,system:Tee,shortcuts:Mee,language:$ee,onboarding:Lee},Dee={thinking:"思考",result:"结果",reply:"回复",error:"错误"},Fee={input:"让 AI 协助编辑此节点…",waiting:"等待响应…",selectedEmpty:"在画布上选择节点,或在输入框用 @ 选择实例(Instances)或节点类型(Node)",textarea:"描述你的流程或让 AI 协助编辑(⌘/Ctrl+Enter 发送)"},zee={send:"发送",stop:"停止",expand:"展开",collapse:"收起",clear:"清空"},Bee={conversation:"对话",conversationWithNumber:"对话 {{num}}",default:"默认"},Hee={endSession:"结束对话(将停止生成)",closeSession:"关闭对话",newSession:"新建对话",expandComposer:"展开对话与输出"},Wee={hint:"使用底部输入框进行 AI 对话,支持 @节点、选择模型等功能"},Vee={aiLabels:Dee,placeholders:Fee,actions:zee,labels:Bee,tooltips:Hee,rightPanel:Wee},Kee="项目",Uee="全部",qee="已归档",Yee="Nodes",Gee="我的 Nodes",Jee="我的流程",Xee="Skills",Qee="活跃项目",Zee="已归档流水线",ete="全局 Nodes",tte="全部 Nodes",nte="我的 Nodes",rte="管理当前工作区已发布到本地 Marketplace 的节点,共 {{count}} 个。",ste="管理当前工作区已发布到本地 Marketplace 的流程片段,共 {{count}} 个。",ite="全局 Skills",ote="创建新项目",ate="新建流水线",lte="搜索流水线…",cte="搜索 nodes…",ute="搜索流程片段…",dte="搜索 skills…",fte="刷新资源",pte="加载流水线列表…",hte="加载全局资源…",mte="筛选结果:{{count}} 条(匹配标题、描述、路径与标签)",gte="已归档的流水线仍可打开与编辑;文件位于各 pipelines 目录下的 _archived。",yte="管理分布式节点架构与监控流水线。可将 flow.yaml 或 .zip 拖入本页导入分享流程。",xte="查看当前可用的全局节点定义,共 {{count}} 个;包含内置、工作区与 marketplace 节点。",wte="查看当前 Composer 可选择的 skills,共 {{count}} 个;包含 AgentFlow 内置与工作区 skills。",bte="流程运行时的可执行积木",kte="Nodes 决定画布上能拖什么、节点有哪些输入输出,以及运行时走 agent、control、provide 或 marketplace 哪类逻辑。",vte="已发布的本地节点包",Ste="这里仅显示你发布到当前 Workspace Marketplace 的节点版本;可查看详情并删除未被 Flow 使用的版本。",Nte="已发布的流程片段",jte="这里显示从 Pipeline 或 Workspace 画布发布的流程片段,可搜索、检查内容,并从画布的流程面板中加载复用。",Cte="Composer/Agent 的操作指南",_te="Skills 告诉 AI 在特定任务里应遵守什么规则、如何修改 flow、如何复用项目约定。",Ete="暂无归档项目。",Ate="暂无未归档流水线;已归档项在 Archived 标签中查看。",Pte="暂无可用全局 nodes。",Ite="暂无已发布的 marketplace nodes。",Rte="暂无已发布的流程片段。可在画布中选中多个节点后发布。",Tte="暂无可用 skills。",Mte="暂无描述。",$te="未找到与「{{query}}」匹配的 node。",Lte="未找到与「{{query}}」匹配的流程片段。",Ote="未找到与「{{query}}」匹配的 skill。",Dte="{{inputs}} in / {{outputs}} out",Fte="流程片段",zte="{{nodes}} 节点 / {{edges}} 连线",Bte="Skill",Hte="Node 详情",Wte="流程片段详情",Vte="Skill 详情",Kte="类型",Ute="来源",qte="包",Yte="版本",Gte="路径",Jte="可编辑",Xte="只读",Qte="可编辑",Zte="Schema",ene="输入",tne="输出",nne="Runtime",rne="节点内容",sne="Files",ine="Usage",one="暂无 runtime manifest。",ane="暂无节点正文或 README。",lne="暂无可预览文件。",cne="请选择文件查看内容。",une="二进制文件暂不支持预览。",dne="文件较大,仅显示前 256KB。",fne="暂未发现使用此 node 的流水线。",pne="节点管理",hne="删除节点版本",mne="删除中…",gne="删除前会检查所有 Flow 引用;仍被安装或使用的版本不会被删除。",yne="确定删除 {{id}}@{{version}}?此操作不可撤销。",xne="已删除 {{id}}@{{version}}。",wne="仍有 {{count}} 个 Flow 使用它。",bne="流程片段管理",kne="删除流程片段",vne="删除中…",Sne="删除后不会影响已经加载到画布里的节点,只会移除 Marketplace 中这个可复用片段。",Nne="确定删除 {{id}}@{{version}}?此操作不可撤销。",jne="已删除 {{id}}@{{version}}。",Cne="无槽位",_ne="作用",Ene="这个 node 是 pipeline 的执行单元。它的 schema 会影响画布连线、参数输入和运行时调度。",Ane="流程片段是固定化流程的一部分。加载时会复制这组节点、连线和布局到当前画布,不覆盖已有内容。",Pne="规模",Ine="流程预览",Rne="连线",Tne="片段 JSON",Mne="还有 {{count}} 条连线",$ne="暂无可预览节点。",Lne="这个 skill 会作为 Composer 的上下文注入给 AI,用于约束 AI 的判断、修改方式和输出口径。",One="SKILL.md 预览",Dne="暂无可预览内容。",Fne="请选择一个资源查看详情。",zne="未能加载流水线列表。",Bne="当前工作区暂无流水线。",Hne="在仓库根目录执行 {{code1}} 并确认工作区包含 {{code2}} 或用户目录下的流水线;亦可点击 New Pipeline 新建。",Wne="未找到与「{{query}}」匹配的流水线。可尝试其他关键词,或点击清除搜索。",Vne="最近打开或最近运行",Kne="暂无打开或运行记录",Une="暂无与关键词匹配的最近记录",qne="最近运行",Yne="最近打开",Gne={builtin:"内置",workspace:"工作区",user:"用户"},Jne={flow:"Flow",global:"Global",marketplace:"Marketplace"},Xne={all:"全部",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},Qne={overview:"概览",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},Zne="打开以在节点画布中编辑此流水线。",ere={eyebrow:"AgentFlow Hub",title:"浏览社区流程",desc:"发现并一键安装社区分享的现成流水线。",cta:"前往 Hub",cliHint:"或通过 CLI 安装:agentflow download <slug>"},tre={title:"新建空流水线",lead:"请先填写流水线名称(英文标识);介绍可选,将保存在 flow 的 ui.description。",nameLabel:"名称(必填)",namePlaceholder:"例如 my_feature_flow",nameHint:"须以英文字母开头,仅可使用字母、数字、下划线 _ 与连字符 -",descLabel:"介绍(可选)",descPlaceholder:"简要说明此流水线的用途…",locationLabel:"保存位置",userDir:"用户目录(~/agentflow/pipelines)",workspaceDir:"当前工作区(.workspace/agentflow/pipelines)",createFailed:"创建失败",creating:"创建中…",createAndOpen:"创建并打开",cancel:"取消",close:"关闭"},nre={title:"导入流水线",lead:"已选择文件「{{filename}}」。请确认流水线名称与保存位置;ZIP 将保留目录内脚本等文件。",nameLabel:"名称(必填)",namePlaceholder:"例如 my_shared_flow",nameHint:"须以英文字母开头,仅可使用字母、数字、下划线 _ 与连字符 -",locationLabel:"保存位置",userDir:"用户目录(~/agentflow/pipelines)",workspaceDir:"当前工作区(.workspace/agentflow/pipelines)",changeFile:"更换文件…",importFailed:"导入失败",importing:"导入中…",importAndOpen:"导入并打开",cancel:"取消",close:"关闭"},rre={title:"删除流水线",lead:"将永久删除磁盘上的流水线目录(含 flow.yaml、脚本等),无法撤销。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",deleteFailed:"删除失败",deleteTimeout:"删除请求超时,请重试(可先检查终端中的 UI 服务日志)",delete:"删除",deleting:"删除中…",confirmDelete:"确认删除",cancel:"取消",close:"关闭"},sre={title:"归档流水线",lead:"归档后流水线将移入「Archived」列表,仍可从该列表打开与编辑。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",archiveFailed:"归档失败",archive:"归档",archiving:"归档中…",confirmArchive:"确认归档",cancel:"取消",close:"关闭"},ire={title:Kee,all:Uee,archived:qee,nodes:Yee,myNodes:Gee,myFlows:Jee,skills:Xee,activeProjects:Qee,archivedPipelines:Zee,globalNodes:ete,nodeScopeAll:tte,nodeScopeMine:nte,myNodesHint:rte,myFlowsHint:ste,globalSkills:ite,createNew:ote,newPipeline:ate,searchPipelines:lte,searchNodes:cte,searchFlows:ute,searchSkills:dte,refreshResources:fte,loadingPipelines:pte,loadingResources:hte,filterResult:mte,archivedHint:gte,activeHint:yte,nodesHint:xte,skillsHint:wte,nodesPurposeTitle:bte,nodesPurposeDesc:kte,myNodesPurposeTitle:vte,myNodesPurposeDesc:Ste,myFlowsPurposeTitle:Nte,myFlowsPurposeDesc:jte,skillsPurposeTitle:Cte,skillsPurposeDesc:_te,noArchived:Ete,noActive:Ate,noNodes:Pte,noMyNodes:Ite,noMyFlows:Rte,noSkills:Tte,noDescription:Mte,noNodeMatch:$te,noFlowSnippetMatch:Lte,noSkillMatch:Ote,nodeSlots:Dte,flowSnippet:Fte,flowSnippetNodes:zte,skill:Bte,nodeDetail:Hte,flowDetail:Wte,skillDetail:Vte,detailType:Kte,detailSource:Ute,detailPackage:qte,detailVersion:Yte,detailPath:Gte,detailEditable:Jte,readOnly:Xte,editable:Qte,nodeSchema:Zte,nodeInputs:ene,nodeOutputs:tne,nodeRuntime:nne,nodeBody:rne,nodeFiles:sne,nodeUsage:ine,noRuntimeManifest:one,noNodeBody:ane,noNodeFiles:lne,selectNodeFile:cne,binaryFile:une,fileTruncated:dne,noNodeUsage:fne,myNodeManagement:pne,deleteMyNode:hne,deletingMyNode:mne,deleteMyNodeHint:gne,deleteMyNodeConfirm:yne,deleteMyNodeSuccess:xne,deleteMyNodeUsedBy:wne,myFlowManagement:bne,deleteMyFlow:kne,deletingMyFlow:vne,deleteMyFlowHint:Sne,deleteMyFlowConfirm:Nne,deleteMyFlowSuccess:jne,noSlots:Cne,resourceMeaning:_ne,nodesMeaning:Ene,myFlowsMeaning:Ane,flowSnippetScale:Pne,flowSnippetPreview:Ine,flowSnippetEdges:Rne,flowSnippetJson:Tne,flowSnippetMoreEdges:Mne,noFlowSnippetPreview:$ne,skillsMeaning:Lne,skillPreview:One,skillPreviewEmpty:Dne,selectResource:Fne,loadFailed:zne,noPipelines:Bne,emptyHint:Hne,noMatch:Wne,recentActivity:Vne,noRecentActivity:Kne,noMatchRecent:Une,recentRun:qne,recentOpen:Yne,sourceBadge:Gne,resourceSource:Jne,resourceFilter:Xne,nodeDetailTabs:Qne,defaultCardDesc:Zne,hubCard:ere,newPipelineModal:tre,importModal:nre,deleteModal:rre,archiveModal:sre},ore="返回",are="下一步",lre="跳过",cre="完成",ure="开始创建",dre={intro:`欢迎使用 AgentFlow!这是一个可视化流程编排工具。
|
|
302
|
-
|
|
303
|
-
点击下方按钮开始创建你的第一个流水线。`,hubIntro:`不想从零开始?
|
|
304
|
-
|
|
305
|
-
在 AgentFlow Hub 浏览社区分享的现成流水线,一键安装即可运行。`},fre={intro:`现在进入流程编辑器。
|
|
306
|
-
|
|
307
|
-
在下方输入框用自然语言描述你的需求,AI 会自动生成流程图。
|
|
308
|
-
|
|
309
|
-
左侧节点面板可以自由拖拽、删除和调整连接。`,introEmpty:`画布为空,开始创建你的流程吧!
|
|
310
|
-
|
|
311
|
-
在下方输入框用自然语言描述需求,AI 会自动生成流程图。
|
|
312
|
-
|
|
313
|
-
左侧节点面板可以自由拖拽、删除和调整连接。`},pre={guideTitle:"首次创建提示",guideDesc:"输入名称和描述后,AI 会自动生成流程图。你可以在编辑器中自由调整节点和连接。",nameHintGuide:"例如:MyFirstFlow(字母开头,支持数字和下划线)",descPlaceholderGuide:"例如:实现用户登录功能,包含注册、验证、授权",descHintGuide:"描述越详细,AI 生成的流程越准确",createGuide:"创建并开始编辑",typeNode:"节点引用类型",typeStr:"字符串类型",typeFile:"文件路径类型",typeBool:"布尔值类型"},hre={back:ore,next:are,skip:lre,done:cre,startCreate:ure,projects:dre,flow:fre,newPipeline:pre},mre={en:{common:eJ,flow:FJ,settings:ZJ,composer:oX,project:kZ,onboarding:PZ},zh:{common:DZ,flow:See,settings:Oee,composer:Vee,project:ire,onboarding:hre}};fr.use(mT).use(fO).init({resources:mre,fallbackLng:"en",debug:!1,ns:["common","flow","settings","composer","project","onboarding"],defaultNS:"common",interpolation:{escapeValue:!1},detection:{order:["localStorage","navigator","htmlTag"],lookupLocalStorage:"agentflow-lang",caches:["localStorage"]}});const gre=[{code:"zh",name:"中文",flag:"🇨🇳"},{code:"en",name:"English",flag:"🇬🇧"}];function yre(e){return fr.changeLanguage(e)}const Lw="agentflow-settings-opencode-plan-v1",fp="CURSOR_API_KEYS",pp="AGENTFLOW_CURSOR_API_KEY_COOLDOWN_MINUTES",gT=["cursor","opencode","claudeCode","codex"];function yT(){return{cursor:[],opencode:[],claudeCode:[],codex:[],cursorFetchedAt:null,opencodeFetchedAt:null,claudeCodeFetchedAt:null,codexFetchedAt:null}}function Ow(e){const t=String(e||"").trim(),n=t.indexOf(" - ");return n>=0?t.slice(0,n).trim():t}function aa(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n={};for(const r of gT)n[r]=Array.isArray(t[r])?[...new Set(t[r].map(Ow).filter(Boolean))]:[];return n}function $i(e){if(!e||typeof e!="object")return yT();const t=e;return{cursor:Array.isArray(t.cursor)?t.cursor.map(String):[],opencode:Array.isArray(t.opencode)?t.opencode.map(String):[],claudeCode:Array.isArray(t.claudeCode)?t.claudeCode.map(String):[],codex:Array.isArray(t.codex)?t.codex.map(String):[],cursorFetchedAt:t.cursorFetchedAt??null,opencodeFetchedAt:t.opencodeFetchedAt??null,claudeCodeFetchedAt:t.claudeCodeFetchedAt??null,codexFetchedAt:t.codexFetchedAt??null}}function Xl(){return`e_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function xre(e){return/^[A-Za-z_][A-Za-z0-9_]*$/.test(String(e||"").trim())}function fa(e,t="user"){if(!Array.isArray(e))return[];const n=[];for(const r of e){if(!r||typeof r!="object")continue;const s=String(r.key??"").trim(),i=String(r.value??""),a=String(r.id??"").trim()||Xl(),c=String(r.scope??t).trim()==="global"?"global":"user";!s&&!i||n.push({id:a,key:s,value:i,scope:c})}return n}function mC(e){return fa(e).map(({key:t,value:n})=>({key:t,value:n}))}function gC(){try{return localStorage.getItem(Lw)??""}catch{return""}}function xT(e){return e?e.length<=6?"•".repeat(e.length):`${"•".repeat(Math.min(20,e.length-4))}${e.slice(-4)}`:""}function wre(e){const t=String(e||"").trim();if(!t)return[];const n=(r,s)=>{if(typeof r=="string"){const a=r.trim();return a?{id:`legacy_${s}_${a.slice(-6)}`,name:`Key ${s+1}`,key:a,createdAt:""}:null}if(!r||typeof r!="object")return null;const i=String(r.key??"").trim();return i?{id:String(r.id??"").trim()||Xl(),name:String(r.name??"").trim()||`Key ${s+1}`,key:i,createdAt:String(r.createdAt??"").trim()}:null};try{const r=JSON.parse(t);if(Array.isArray(r))return r.map(n).filter(Boolean)}catch{}return t.split(",").map((r,s)=>n(r,s)).filter(Boolean)}function yC(e){const t=Array.isArray(e)?e.map((n,r)=>({id:String((n==null?void 0:n.id)||"").trim()||Xl(),name:String((n==null?void 0:n.name)||"").trim()||`Key ${r+1}`,key:String((n==null?void 0:n.key)||"").trim(),createdAt:String((n==null?void 0:n.createdAt)||"").trim()||new Date().toISOString()})).filter(n=>n.key):[];return JSON.stringify(t)}function bre(e){const t=String(e||"").trim();return t?t.length<=10?xT(t):`${t.slice(0,4)}${"•".repeat(Math.min(18,t.length-8))}${t.slice(-4)}`:""}function kre(e,t="zh"){if(!e)return"";const n=Date.parse(e);if(Number.isNaN(n))return String(e);try{const r=t==="en"?"en-US":t==="ja"?"ja-JP":"zh-CN";return new Intl.DateTimeFormat(r,{dateStyle:"short",timeStyle:"medium"}).format(new Date(n))}catch{return String(e)}}function vre({authUser:e}){const{t,i18n:n}=Ir(["common","settings"]),r=n.language||"zh",[s,i]=m.useState(""),[a,l]=m.useState(""),[c,u]=m.useState({cursor:[],opencode:[],claudeCode:[],codex:[],cursorFetchedAt:null,opencodeFetchedAt:null,claudeCodeFetchedAt:null,codexFetchedAt:null}),[f,d]=m.useState(yT()),[p,h]=m.useState(()=>aa({})),[g,k]=m.useState(!1),[w,y]=m.useState(""),[v,b]=m.useState(""),[C,N]=m.useState(!1),[j,A]=m.useState(!1),[I,D]=m.useState(""),[H,V]=m.useState([]),[F,L]=m.useState(""),[M,K]=m.useState(!1),[W,$]=m.useState(""),[R,B]=m.useState(""),[_,X]=m.useState(!1),[z,T]=m.useState(()=>new Set),[Z,ae]=m.useState(""),[J,se]=m.useState(""),[ee,re]=m.useState(!!(e!=null&&e.isAdmin)),[ne,ue]=m.useState(""),[de,xe]=m.useState([]),[ze,Te]=m.useState([]),[Le,nt]=m.useState(""),[wt,mt]=m.useState(""),[Re,it]=m.useState(!1),[Nt,qt]=m.useState(!1),[Zt,rt]=m.useState(""),[fe,ve]=m.useState(""),[He,Ge]=m.useState(""),[je,Tt]=m.useState(null),[kn,dn]=m.useState(!1),[en,Pn]=m.useState(!1),[te,Ee]=m.useState(""),We=m.useRef(null),Ke=m.useRef(!1),bt=m.useRef(!1),jt=m.useRef(""),qn=m.useCallback(async()=>{l("");try{const ie=await fetch("/api/ui-context");if(!ie.ok)throw new Error("HTTP "+ie.status);const be=await ie.json();i(typeof be.workspaceRoot=="string"?be.workspaceRoot:"")}catch(ie){l(String(ie.message||ie)),i("")}},[]),Ht=m.useCallback(async()=>{b(""),N(!0),y("");try{const ie=await fetch(e!=null&&e.isAdmin?"/api/model-visibility":"/api/model-lists");if(!ie.ok)throw new Error("HTTP "+ie.status);const be=await ie.json();if(e!=null&&e.isAdmin)u($i(be.modelLists)),d($i(be.allModelLists)),h(aa(be.hiddenModels));else{const Pe=$i(be);u(Pe),d(Pe),h(aa({}))}}catch(ie){b(String(ie.message||ie))}finally{N(!1)}},[e==null?void 0:e.isAdmin]),gt=m.useCallback(async()=>{L("");try{const ie=await fetch("/api/user-env"),be=await ie.json().catch(()=>({}));if(!ie.ok)throw new Error(typeof be.error=="string"?be.error:"HTTP "+ie.status);const Pe=fa(Array.isArray(be.env)?be.env:[],"user").map(Kt=>({...Kt,scope:"user"})),xt=[...e!=null&&e.isAdmin?fa(Array.isArray(be.globalEnv)?be.globalEnv:[],"global").map(Kt=>({...Kt,scope:"global"})):[],...Pe];jt.current=JSON.stringify(xt),V(xt)}catch(ie){V([]),L(String(ie.message||ie))}finally{bt.current=!0}},[e==null?void 0:e.isAdmin]),Mn=m.useCallback(async()=>{if(e!=null&&e.isAdmin){it(!0),rt("");try{const ie=await fetch("/api/admin/user-allowlist"),be=await ie.json().catch(()=>({}));if(!ie.ok)throw new Error(typeof be.error=="string"?be.error:"HTTP "+ie.status);const Pe=be.allowlist&&typeof be.allowlist=="object"?be.allowlist:{};xe(Array.isArray(Pe.fileUsers)?Pe.fileUsers.map(String):[]),Te(Array.isArray(Pe.envUsers)?Pe.envUsers.map(String):[]),nt(typeof Pe.path=="string"?Pe.path:"")}catch(ie){rt(String(ie.message||ie))}finally{it(!1)}}},[e==null?void 0:e.isAdmin]),Pt=m.useCallback(async ie=>{if(e!=null&&e.isAdmin){qt(!0),rt("");try{const be=await fetch("/api/admin/user-allowlist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({users:ie})}),Pe=await be.json().catch(()=>({}));if(!be.ok)throw new Error(typeof Pe.error=="string"?Pe.error:"HTTP "+be.status);const Se=Pe.allowlist&&typeof Pe.allowlist=="object"?Pe.allowlist:{};xe(Array.isArray(Se.fileUsers)?Se.fileUsers.map(String):[]),Te(Array.isArray(Se.envUsers)?Se.envUsers.map(String):[]),nt(typeof Se.path=="string"?Se.path:"")}catch(be){rt(String(be.message||be))}finally{qt(!1)}}},[e==null?void 0:e.isAdmin]),fn=m.useCallback(async()=>{if(e!=null&&e.isAdmin){dn(!0),Ee("");try{const ie=await fetch("/api/admin/storage-config"),be=await ie.json().catch(()=>({}));if(!ie.ok)throw new Error(typeof be.error=="string"?be.error:"HTTP "+ie.status);const Pe=be.config&&typeof be.config=="object"?be.config:{};Tt(Pe),ve(typeof Pe.dataRoot=="string"?Pe.dataRoot:""),Ge(typeof Pe.skillsRoot=="string"?Pe.skillsRoot:"")}catch(ie){Ee(String(ie.message||ie))}finally{dn(!1)}}},[e==null?void 0:e.isAdmin]),Yn=m.useCallback(async()=>{if(e!=null&&e.isAdmin){Pn(!0),Ee("");try{const ie=await fetch("/api/admin/storage-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dataRoot:fe.trim(),skillsRoot:He.trim(),migrateLegacySkills:!0})}),be=await ie.json().catch(()=>({}));if(!ie.ok)throw new Error(typeof be.error=="string"?be.error:"HTTP "+ie.status);const Pe=be.config&&typeof be.config=="object"?be.config:{};Tt(Pe),ve(typeof Pe.dataRoot=="string"?Pe.dataRoot:""),Ge(typeof Pe.skillsRoot=="string"?Pe.skillsRoot:"")}catch(ie){Ee(String(ie.message||ie))}finally{Pn(!1)}}},[e==null?void 0:e.isAdmin,fe,He]),ei=m.useCallback(async ie=>{const be=fa(ie),Pe=be.filter(xt=>xt.scope!=="global"),Se=be.filter(xt=>xt.scope==="global");K(!0),L("");try{const xt=await fetch("/api/user-env",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:mC(Pe),...e!=null&&e.isAdmin?{globalEnv:mC(Se)}:{}})}),Kt=await xt.json().catch(()=>({}));if(!xt.ok)throw new Error(typeof Kt.error=="string"?Kt.error:"HTTP "+xt.status);const or=fa(Array.isArray(Kt.env)?Kt.env:[],"user").map(U=>({...U,scope:"user"})),hr=[...e!=null&&e.isAdmin?fa(Array.isArray(Kt.globalEnv)?Kt.globalEnv:[],"global").map(U=>({...U,scope:"global"})):[],...or];jt.current=JSON.stringify(hr),V(hr)}catch(xt){L(String(xt.message||xt))}finally{K(!1)}},[e==null?void 0:e.isAdmin]),qr=m.useCallback(async()=>{b(""),N(!0);try{const ie=await fetch("/api/update-model-lists",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:ne.trim()})}),be=await ie.json().catch(()=>({}));if(!ie.ok)throw new Error(typeof be.error=="string"?be.error:"HTTP "+ie.status);u($i(be.modelLists)),e!=null&&e.isAdmin?await Ht():d($i(be.modelLists))}catch(ie){b(String(ie.message||ie))}finally{N(!1)}},[e==null?void 0:e.isAdmin,Ht,ne]),Yr=m.useCallback(async ie=>{if(!(e!=null&&e.isAdmin))return;const be=aa(ie);h(be),k(!0),y("");try{const Pe=await fetch("/api/model-visibility",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({hiddenModels:be})}),Se=await Pe.json().catch(()=>({}));if(!Pe.ok)throw new Error(typeof Se.error=="string"?Se.error:"HTTP "+Pe.status);u($i(Se.modelLists)),d($i(Se.allModelLists)),h(aa(Se.hiddenModels))}catch(Pe){y(String(Pe.message||Pe)),Ht()}finally{k(!1)}},[e==null?void 0:e.isAdmin,Ht]),pr=m.useCallback((ie,be,Pe)=>{const Se=gT.includes(ie)?ie:"cursor",xt=Ow(be);if(!xt)return;const Kt=aa(p),or=new Set(Kt[Se]);Pe?or.delete(xt):or.add(xt),Yr({...Kt,[Se]:Array.from(or)})},[p,Yr]);m.useEffect(()=>{qn(),Ht(),gt(),e!=null&&e.isAdmin&&(Mn(),fn()),(async()=>{try{const ie=await fetch("/api/agentflow-config");if(ie.ok){const be=await ie.json(),Pe=typeof be.opencodeProvider=="string"?be.opencodeProvider:"";ue(Pe),We.current=Pe;try{localStorage.setItem(Lw,Pe)}catch{}}else{const be=gC();ue(be),We.current=be}}catch{const ie=gC();ue(ie),We.current=ie}finally{Ke.current=!0}})()},[e==null?void 0:e.isAdmin,qn,Ht,fn,Mn,gt]),m.useEffect(()=>{if(!bt.current||JSON.stringify(fa(H))===jt.current)return;const be=setTimeout(()=>{ei(H)},350);return()=>clearTimeout(be)},[H,ei]),m.useEffect(()=>{if(!Ke.current)return;const ie=ne.trim();if(ie===We.current)return;const be=setTimeout(()=>{(async()=>{A(!0),D("");try{const Pe=await fetch("/api/agentflow-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:ie})}),Se=await Pe.json().catch(()=>({}));if(!Pe.ok)throw new Error(typeof Se.error=="string"?Se.error:"HTTP "+Pe.status);We.current=ie;try{localStorage.setItem(Lw,ie)}catch{}Se.modelLists&&(u($i(Se.modelLists)),e!=null&&e.isAdmin?Ht():d($i(Se.modelLists)))}catch(Pe){D(String(Pe.message||Pe))}finally{A(!1)}})()},450);return()=>clearTimeout(be)},[e==null?void 0:e.isAdmin,Ht,ne]);const on=e!=null&&e.isAdmin?f:c,zn=on.cursor.length>0,Rr=on.opencode.length>0,In=on.claudeCode.length>0,Qn=on.codex.length>0,vr=aa(p),Ns={cursor:c.cursor.length,opencode:c.opencode.length,claudeCode:c.claudeCode.length,codex:c.codex.length},Sr=m.useCallback((ie,be,Pe)=>{const Se=Array.isArray(be)?be:[];if(!(e!=null&&e.isAdmin))return o.jsx("pre",{className:"af-set-model-preview","aria-label":Pe,children:Se.join(`
|
|
314
|
-
`)});const xt=new Set(vr[ie]||[]);return o.jsxs("div",{className:"af-set-model-visibility","aria-label":Pe,children:[o.jsxs("div",{className:"af-set-model-visibility-head",children:[o.jsxs("span",{children:["展示 ",Ns[ie]||0," / ",Se.length]}),o.jsx("span",{children:g?"保存中":"取消勾选后从模型下拉隐藏"})]}),o.jsx("div",{className:"af-set-model-visibility-list",children:Se.map(Kt=>{const or=Ow(Kt),rn=!xt.has(or);return o.jsxs("label",{className:"af-set-model-visibility-row",children:[o.jsx("input",{type:"checkbox",checked:rn,disabled:g,onChange:hr=>pr(ie,Kt,hr.target.checked)}),o.jsx("span",{children:Kt})]},`${ie}-${Kt}`)})})]})},[e==null?void 0:e.isAdmin,vr,g,Ns,pr]),Ft=de.length>0||ze.length>0,ce=e!=null&&e.isAdmin&&ee?"global":"user",ke=m.useMemo(()=>H.find(ie=>ie.key===fp&&(ie.scope||"user")===ce)||null,[ce,H]),tt=m.useMemo(()=>wre((ke==null?void 0:ke.value)||""),[ke==null?void 0:ke.value]),yt=m.useMemo(()=>H.find(ie=>ie.key===pp&&(ie.scope||"user")===ce)||null,[ce,H]),vn=yt!=null&&yt.value?String(yt.value):"30",Jt=m.useCallback((ie,be,Pe)=>{const Se=String(ie||"").trim();if(!Se)return;const xt=String(be??"");V(Kt=>{const or=Kt.find(rn=>rn.key===Se&&(rn.scope||"user")===Pe);return xt?or?Kt.map(rn=>rn.id===or.id?{...rn,value:xt,scope:Pe}:rn):[{id:Xl(),key:Se,value:xt,scope:Pe},...Kt]:Kt.filter(rn=>!(rn.key===Se&&(rn.scope||"user")===Pe))})},[]),Bn=m.useCallback(()=>{const ie=J.trim();if(!ie)return;const be=[...tt,{id:Xl(),name:Z.trim()||`Key ${tt.length+1}`,key:ie,createdAt:new Date().toISOString()}];Jt(fp,yC(be),ce),ae(""),se("")},[Z,tt,ce,J,Jt]),us=m.useCallback(ie=>{const be=tt.filter(Pe=>Pe.id!==ie);Jt(fp,be.length?yC(be):"",ce)},[tt,ce,Jt]),ut=m.useCallback(ie=>{const be=String(ie||"").replace(/[^\d]/g,"");if(!be){Jt(pp,"",ce);return}const Pe=Math.min(1440,Math.max(1,Number(be)||30));Jt(pp,String(Pe),ce)},[ce,Jt]),Wt=m.useCallback(()=>{var ie;s&&((ie=navigator.clipboard)==null||ie.writeText(s))},[s]),Vt=m.useCallback(()=>{const ie=W.trim(),be=R;if(ie){if(!xre(ie)){L(t("settings:env.invalidKey"));return}V(Pe=>[{id:Xl(),key:ie,value:be,scope:e!=null&&e.isAdmin&&_?"global":"user"},...Pe]),$(""),B("")}},[e==null?void 0:e.isAdmin,_,W,R,t]),$n=m.useCallback(ie=>{V(be=>be.filter(Pe=>Pe.id!==ie))},[]),Fe=m.useCallback((ie,be)=>{V(Pe=>Pe.map(Se=>Se.id===ie?{...Se,...be}:Se))},[]),ir=m.useCallback(ie=>{T(be=>{const Pe=new Set(be);return Pe.has(ie)?Pe.delete(ie):Pe.add(ie),Pe})},[]),Tr=m.useCallback(()=>{const ie=wt.trim();if(!ie)return;if(!/^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(ie)){rt("用户名须以字母开头,仅可使用字母、数字、下划线与连字符,最多 64 字符");return}if(new Set(de.map(Pe=>String(Pe||"").trim().toLowerCase())).has(ie.toLowerCase())){mt("");return}mt(""),Pt([...de,ie])},[wt,de,Pt]),ti=m.useCallback(ie=>{const be=String(ie||"").trim().toLowerCase();be&&Pt(de.filter(Pe=>String(Pe||"").trim().toLowerCase()!==be))},[de,Pt]),js=m.useCallback(ie=>{const be=ie.target.value;yre(be)},[]),Mr=ie=>{const be=kre(ie,r);return be?t("settings:cursor.modelList.fetchedAt",{time:be}):t("settings:cursor.modelList.never")};return o.jsxs("div",{className:"af-settings-page",children:[o.jsx("header",{className:"af-settings-top",children:o.jsxs("div",{className:"af-settings-crumb","aria-label":t("settings:title"),children:[o.jsx("span",{className:"af-settings-crumb-muted",children:t("settings:crumb.engine")}),o.jsx("span",{className:"af-settings-crumb-sep","aria-hidden":!0,children:"/"}),o.jsx("span",{className:"af-settings-crumb-active",children:t("settings:crumb.preferences")})]})}),o.jsx("div",{className:"af-settings-body",children:o.jsxs("div",{className:"af-settings-inner",children:[o.jsxs("header",{className:"af-settings-hero",children:[o.jsxs("h1",{className:"af-settings-h1",children:[t("common:app.name")," ",t("settings:title")]}),o.jsx("p",{className:"af-settings-lead",children:t("settings:workspace.description")}),a?o.jsx("p",{className:"af-err af-settings-api-hint",children:a}):null,v?o.jsx("p",{className:"af-err af-settings-api-hint",children:v}):null,F?o.jsx("p",{className:"af-err af-settings-api-hint",children:F}):null,te?o.jsx("p",{className:"af-err af-settings-api-hint",children:te}):null]}),o.jsx("div",{className:"af-settings-layout",children:o.jsxs("div",{className:"af-settings-bento",children:[o.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--low af-set-workspace",children:[o.jsxs("div",{className:"af-set-card-inner",children:[o.jsxs("div",{className:"af-set-card-head",children:[o.jsx("span",{className:"material-symbols-outlined af-set-icon af-set-icon--secondary",children:"folder_managed"}),o.jsx("h2",{className:"af-set-h2",children:t("settings:workspace.title")})]}),o.jsx("label",{className:"af-set-label",htmlFor:"af-workspace-path",children:t("settings:workspace.currentPath")}),o.jsxs("div",{className:"af-set-input-wrap",children:[o.jsx("input",{id:"af-workspace-path",className:"af-set-input af-set-input--mono",type:"text",readOnly:!0,value:s,placeholder:t("common:loading")}),o.jsx("button",{type:"button",className:"af-set-input-suffix",onClick:Wt,"aria-label":t("settings:workspace.copyPath"),disabled:!s,children:o.jsx("span",{className:"material-symbols-outlined",children:"content_copy"})})]}),o.jsx("p",{className:"af-set-hint",children:"当前页面只展示运行时根目录。可被节点加载的代码库和文档目录请在左侧“知识库”里维护。"})]}),o.jsx("div",{className:"af-set-watermark","aria-hidden":!0,children:o.jsx("span",{className:"material-symbols-outlined",children:"account_tree"})})]}),o.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--high",children:[o.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[o.jsx("h2",{className:"af-set-h2 af-set-h2--caps",children:"Cursor CLI"}),o.jsx("span",{className:"af-set-badge"+(zn?" af-set-badge--ok":" af-set-badge--muted"),children:t(zn?"settings:cursor.status.cached":"settings:cursor.status.notCached")})]}),o.jsxs("div",{className:"af-set-cli-block",children:[o.jsx("div",{className:"af-set-cli-icon",children:o.jsx("span",{className:"material-symbols-outlined af-set-icon--tertiary",children:zn?"check_circle":"hourglass_empty"})}),o.jsxs("div",{children:[o.jsx("p",{className:"af-set-cli-title",children:t(zn?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),o.jsx("p",{className:"af-set-cli-mono",children:zn?t("settings:cursor.modelList.count",{count:c.cursor.length})+(e!=null&&e.isAdmin?` / ${on.cursor.length}`:"")+" · "+Mr(c.cursorFetchedAt):t("settings:cursor.modelList.refresh")})]})]}),zn?Sr("cursor",on.cursor,t("settings:cursor.modelPreviewLabel")):null,w?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",role:"alert",children:w}):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>qr(),disabled:C,children:t(C?"settings:cursor.modelList.fetching":"settings:cursor.modelList.refresh")})]}),o.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--low af-set-cursor-pool",children:[o.jsxs("div",{className:"af-set-env-head",children:[o.jsxs("div",{className:"af-set-card-head",children:[o.jsx("div",{className:"af-set-env-icon-wrap",children:o.jsx("span",{className:"material-symbols-outlined af-set-icon--primary",children:"key"})}),o.jsxs("div",{children:[o.jsx("h2",{className:"af-set-h2",children:"Cursor API Key 池"}),o.jsx("p",{className:"af-set-card-subtitle",children:"按请求轮换,遇到 usage limit 或 resource_exhausted 会自动尝试下一个 Key。"})]})]}),o.jsxs("span",{className:"af-set-badge"+(tt.length?" af-set-badge--ok":" af-set-badge--muted"),children:[tt.length," keys"]})]}),o.jsxs("div",{className:"af-set-cursor-pool-controls",children:[e!=null&&e.isAdmin?o.jsxs("div",{className:"af-set-env-scope-switch af-set-cursor-scope",role:"group","aria-label":"Cursor API Key scope",children:[o.jsx("button",{type:"button",className:ee?"":"is-active",onClick:()=>re(!1),children:"个人"}),o.jsx("button",{type:"button",className:ee?"is-active":"",onClick:()=>re(!0),children:"全局"})]}):null,o.jsxs("label",{className:"af-set-cursor-cooldown",children:[o.jsx("span",{children:"限额冷却"}),o.jsx("input",{className:"af-set-input af-set-input--sm af-set-input--mono",inputMode:"numeric",value:vn,onChange:ie=>ut(ie.target.value)}),o.jsx("span",{children:"分钟"})]}),o.jsx("span",{className:"af-set-env-note",children:M?"保存中":ce==="global"?"全局配置":"个人配置"})]}),o.jsx("div",{className:"af-set-cursor-key-list",children:tt.length?tt.map(ie=>o.jsxs("div",{className:"af-set-cursor-key-row",children:[o.jsxs("div",{className:"af-set-cursor-key-main",children:[o.jsx("strong",{children:ie.name}),o.jsx("code",{children:bre(ie.key)})]}),o.jsx("span",{className:"af-set-cursor-key-meta",children:ie.createdAt?new Date(ie.createdAt).toLocaleString():"历史 Key"}),o.jsx("button",{type:"button",className:"af-set-env-del af-set-cursor-key-delete","aria-label":`删除 ${ie.name}`,onClick:()=>us(ie.id),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})]},ie.id)):o.jsx("div",{className:"af-set-cursor-key-empty",children:"还没有配置 Key。配置后 Cursor CLI runner 会自动轮换使用。"})}),o.jsxs("div",{className:"af-set-cursor-key-add",children:[o.jsx("input",{className:"af-set-input",value:Z,onChange:ie=>ae(ie.target.value),placeholder:"名称,例如 Team Key 1"}),o.jsx("input",{className:"af-set-input af-set-input--mono",type:"password",value:J,onChange:ie=>se(ie.target.value),placeholder:"Cursor API Key"}),o.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:Bn,disabled:!J.trim(),children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),"添加 Key"]})]}),o.jsxs("p",{className:"af-set-hint",children:["保存到 ",fp,";冷却时间保存到 ",pp,"。个人配置会覆盖全局配置。"]})]}),o.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--high",children:[o.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[o.jsx("h2",{className:"af-set-h2 af-set-h2--caps",children:"OpenCode"}),o.jsx("span",{className:"af-set-badge"+(Rr?" af-set-badge--ok":" af-set-badge--err"),children:t(Rr?"settings:opencode.status.ready":"settings:opencode.status.notFound")})]}),o.jsx("p",{className:"af-set-p",children:t("settings:opencode.description")}),o.jsxs("div",{children:[o.jsx("label",{className:"af-set-label-sm",htmlFor:"af-opencode-plan",children:t("settings:opencode.provider")}),o.jsx("input",{id:"af-opencode-plan",className:"af-set-input af-set-input--sm af-set-input--mono",type:"text",value:ne,onChange:ie=>ue(ie.target.value),placeholder:t("settings:opencode.providerPlaceholder"),autoComplete:"off"}),j?o.jsx("p",{className:"af-set-hint af-set-hint--inline","aria-live":"polite",children:t("settings:opencode.saving")}):null,I?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",role:"alert",children:I}):null]}),Rr?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"af-set-cli-mono af-set-cli-mono--block",children:t("settings:cursor.modelList.count",{count:c.opencode.length})+(e!=null&&e.isAdmin?` / ${on.opencode.length}`:"")+" · "+Mr(c.opencodeFetchedAt)}),Sr("opencode",on.opencode,t("settings:opencode.modelPreviewLabel"))]}):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>qr(),disabled:C,children:t(C?"settings:cursor.modelList.fetching":"settings:cursor.modelList.refresh")})]}),o.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--high",children:[o.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[o.jsx("h2",{className:"af-set-h2 af-set-h2--caps",children:t("settings:claudeCode.title")}),o.jsx("span",{className:"af-set-badge"+(In?" af-set-badge--ok":" af-set-badge--err"),children:t(In?"settings:claudeCode.status.ready":"settings:claudeCode.status.notFound")})]}),o.jsxs("div",{className:"af-set-cli-block",children:[o.jsx("div",{className:"af-set-cli-icon",children:o.jsx("span",{className:"material-symbols-outlined af-set-icon--tertiary",children:In?"check_circle":"hourglass_empty"})}),o.jsxs("div",{children:[o.jsx("p",{className:"af-set-cli-title",children:t(In?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),o.jsx("p",{className:"af-set-cli-mono",children:In?t("settings:cursor.modelList.count",{count:c.claudeCode.length})+(e!=null&&e.isAdmin?` / ${on.claudeCode.length}`:"")+" · "+Mr(c.claudeCodeFetchedAt):t("settings:cursor.modelList.refresh")})]})]}),o.jsx("p",{className:"af-set-p",children:t("settings:claudeCode.description")}),In?Sr("claudeCode",on.claudeCode,t("settings:claudeCode.modelPreviewLabel")):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>qr(),disabled:C,children:t(C?"settings:cursor.modelList.fetching":"settings:cursor.modelList.refresh")})]}),o.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--high",children:[o.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[o.jsx("h2",{className:"af-set-h2 af-set-h2--caps",children:t("settings:codex.title")}),o.jsx("span",{className:"af-set-badge"+(Qn?" af-set-badge--ok":" af-set-badge--err"),children:t(Qn?"settings:codex.status.ready":"settings:codex.status.notFound")})]}),o.jsxs("div",{className:"af-set-cli-block",children:[o.jsx("div",{className:"af-set-cli-icon",children:o.jsx("span",{className:"material-symbols-outlined af-set-icon--tertiary",children:Qn?"check_circle":"hourglass_empty"})}),o.jsxs("div",{children:[o.jsx("p",{className:"af-set-cli-title",children:t(Qn?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),o.jsx("p",{className:"af-set-cli-mono",children:Qn?t("settings:cursor.modelList.count",{count:c.codex.length})+(e!=null&&e.isAdmin?` / ${on.codex.length}`:"")+" · "+Mr(c.codexFetchedAt):t("settings:cursor.modelList.refresh")})]})]}),o.jsx("p",{className:"af-set-p",children:t("settings:codex.description")}),Qn?Sr("codex",on.codex,t("settings:codex.modelPreviewLabel")):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>qr(),disabled:C,children:t(C?"settings:cursor.modelList.fetching":"settings:cursor.modelList.refresh")})]}),o.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--low af-set-env",children:[o.jsxs("div",{className:"af-set-env-head",children:[o.jsxs("div",{className:"af-set-card-head",children:[o.jsx("div",{className:"af-set-env-icon-wrap",children:o.jsx("span",{className:"material-symbols-outlined af-set-icon--primary",children:"variables"})}),o.jsx("h2",{className:"af-set-h2",children:t("settings:env.title")})]}),o.jsx("span",{className:"af-set-env-note",children:M?t("settings:env.saving"):e!=null&&e.isAdmin?t("settings:env.noteAdmin"):t("settings:env.note")})]}),o.jsxs("div",{className:"af-set-env-rows"+(e!=null&&e.isAdmin?" af-set-env-rows--admin":""),children:[o.jsxs("div",{className:"af-set-env-row af-set-env-row--header","aria-hidden":!0,children:[o.jsx("span",{children:t("settings:env.key")}),e!=null&&e.isAdmin?o.jsx("span",{children:t("settings:env.scope")}):null,o.jsx("span",{children:t("settings:env.value")}),o.jsx("span",{})]}),o.jsxs("div",{className:"af-set-env-row af-set-env-row--draft"+(e!=null&&e.isAdmin?" af-set-env-row--scoped":""),children:[o.jsx("div",{className:"af-set-env-cell",children:o.jsx("input",{className:"af-set-env-inline af-set-env-inline--key",placeholder:"KEY_NAME",value:W,onChange:ie=>$(ie.target.value),"aria-label":t("settings:env.newKey")})}),e!=null&&e.isAdmin?o.jsx("div",{className:"af-set-env-cell af-set-env-cell--scope",children:o.jsxs("div",{className:"af-set-env-scope-switch",role:"group","aria-label":t("settings:env.scope"),children:[o.jsx("button",{type:"button",className:_?"":"is-active",onClick:()=>X(!1),children:t("settings:env.personal")}),o.jsx("button",{type:"button",className:_?"is-active":"",onClick:()=>X(!0),children:t("settings:env.global")})]})}):null,o.jsx("div",{className:"af-set-env-cell af-set-env-cell--grow af-set-env-cell--value",children:o.jsx("input",{className:"af-set-env-inline af-set-env-inline--value",type:"password",placeholder:t("settings:env.newValue"),value:R,onChange:ie=>B(ie.target.value),"aria-label":t("settings:env.newValue")})}),o.jsx("div",{className:"af-set-env-actions",children:o.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:Vt,disabled:!W.trim(),children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),t("settings:env.add")]})})]}),H.map(ie=>o.jsxs("div",{className:"af-set-env-row"+(e!=null&&e.isAdmin?" af-set-env-row--scoped":""),children:[o.jsx("div",{className:"af-set-env-cell",children:o.jsx("input",{className:"af-set-env-inline af-set-env-inline--key",value:ie.key,onChange:be=>Fe(ie.id,{key:be.target.value}),"aria-label":t("settings:env.key"),spellCheck:!1})}),e!=null&&e.isAdmin?o.jsx("div",{className:"af-set-env-cell af-set-env-cell--scope",children:o.jsxs("div",{className:"af-set-env-scope-switch",role:"group","aria-label":t("settings:env.scope"),children:[o.jsx("button",{type:"button",className:ie.scope!=="global"?"is-active":"",onClick:()=>Fe(ie.id,{scope:"user"}),children:t("settings:env.personal")}),o.jsx("button",{type:"button",className:ie.scope==="global"?"is-active":"",onClick:()=>Fe(ie.id,{scope:"global"}),children:t("settings:env.global")})]})}):null,o.jsxs("div",{className:"af-set-env-cell af-set-env-cell--grow af-set-env-cell--value",children:[o.jsx("input",{className:"af-set-env-inline af-set-env-inline--value",type:z.has(ie.id)?"text":"password",value:ie.value,onChange:be=>Fe(ie.id,{value:be.target.value}),placeholder:xT(ie.value)||t("settings:env.newValue"),"aria-label":t("settings:env.value")}),o.jsx("button",{type:"button",className:"af-set-env-value-toggle",onClick:()=>ir(ie.id),"aria-label":z.has(ie.id)?"Hide value":"Show value",children:o.jsx("span",{className:"material-symbols-outlined",children:z.has(ie.id)?"visibility_off":"visibility"})})]}),o.jsx("div",{className:"af-set-env-actions",children:o.jsx("button",{type:"button",className:"af-set-env-del","aria-label":t("settings:env.delete",{key:ie.key}),onClick:()=>$n(ie.id),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})})]},ie.id))]})]}),e!=null&&e.isAdmin?o.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--low",children:[o.jsxs("div",{className:"af-set-env-head",children:[o.jsxs("div",{className:"af-set-card-head",children:[o.jsx("div",{className:"af-set-env-icon-wrap",children:o.jsx("span",{className:"material-symbols-outlined af-set-icon--primary",children:"hard_drive_2"})}),o.jsxs("div",{children:[o.jsx("h2",{className:"af-set-h2",children:"AgentFlow Data Root"}),o.jsx("p",{className:"af-set-card-subtitle",children:"配置整个 AgentFlow 数据目录的位置,保存时会迁移当前数据。"})]})]}),o.jsx("span",{className:"af-set-badge"+(je!=null&&je.envLocked?" af-set-badge--err":" af-set-badge--ok"),children:je!=null&&je.envLocked?"Env locked":"Configurable"}),o.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:()=>void fn(),disabled:kn||en,children:kn?"刷新中...":"刷新"})]}),te?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:te}):null,o.jsx("label",{className:"af-set-label-sm",htmlFor:"af-agentflow-data-root",children:"Data Root"}),o.jsxs("div",{className:"af-set-input-wrap",children:[o.jsx("input",{id:"af-agentflow-data-root",className:"af-set-input af-set-input--mono",type:"text",value:fe,onChange:ie=>ve(ie.target.value),placeholder:"/data1/services/mengmai/agentflow",autoComplete:"off",disabled:!!(je!=null&&je.envLocked)||en}),o.jsx("button",{type:"button",className:"af-set-input-suffix",onClick:()=>void Yn(),"aria-label":"保存 AgentFlow Data Root",disabled:en||!!(je!=null&&je.envLocked),children:o.jsx("span",{className:"material-symbols-outlined",children:en?"hourglass_empty":"save"})})]}),o.jsxs("p",{className:"af-set-hint",children:["当前目录:",o.jsx("code",{children:(je==null?void 0:je.dataRoot)||fe||"-"}),je!=null&&je.configPath?o.jsxs(o.Fragment,{children:[";配置文件:",o.jsx("code",{children:je.configPath})]}):null]}),o.jsxs("p",{className:"af-set-hint",children:["这个目录包含 ",o.jsx("code",{children:"users/"}),"、",o.jsx("code",{children:"pipelines/"}),"、",o.jsx("code",{children:"runBuild/"}),"、",o.jsx("code",{children:"auth/"})," 和 admin 配置。 保存到新绝对路径时会复制旧目录内容;旧目录不会自动删除。",je!=null&&je.envLocked?" 当前设置了 AGENTFLOW_HOME,需要改环境变量才能生效。":""]}),o.jsx("label",{className:"af-set-label-sm",htmlFor:"af-agentflow-skills-root",children:"Skills Root"}),o.jsxs("div",{className:"af-set-input-wrap",children:[o.jsx("input",{id:"af-agentflow-skills-root",className:"af-set-input af-set-input--mono",type:"text",value:He,onChange:ie=>Ge(ie.target.value),placeholder:"/data1/services/mengmai/agentflow/skills",autoComplete:"off",disabled:!!(je!=null&&je.skillsEnvLocked)||en}),o.jsx("button",{type:"button",className:"af-set-input-suffix",onClick:()=>void Yn(),"aria-label":"保存 AgentFlow Skills Root",disabled:en||!!(je!=null&&je.skillsEnvLocked),children:o.jsx("span",{className:"material-symbols-outlined",children:en?"hourglass_empty":"save"})})]}),o.jsxs("p",{className:"af-set-hint",children:["当前 Skills:",o.jsx("code",{children:(je==null?void 0:je.skillsRoot)||He||"-"}),je!=null&&je.legacySkillsRootExists?o.jsxs(o.Fragment,{children:[";保存时会补迁移旧目录 ",o.jsx("code",{children:je.legacySkillsRoot})," 中缺失的 skills。"]}):null]}),o.jsxs("p",{className:"af-set-hint",children:["SkillHub 新安装、更新和卸载都作用于 Skills Root;普通用户只通过 Workspace 的 Load Skills 使用。",je!=null&&je.skillsEnvLocked?" 当前设置了 AGENTFLOW_SKILLS_ROOT,需要改环境变量才能生效。":""]})]}):null,e!=null&&e.isAdmin?o.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--allowlist",children:[o.jsxs("div",{className:"af-set-env-head",children:[o.jsxs("div",{className:"af-set-card-head",children:[o.jsx("div",{className:"af-set-env-icon-wrap",children:o.jsx("span",{className:"material-symbols-outlined af-set-icon--primary",children:"manage_accounts"})}),o.jsxs("div",{children:[o.jsx("h2",{className:"af-set-h2",children:t("settings:allowlist.title")}),o.jsx("p",{className:"af-set-card-subtitle",children:t("settings:allowlist.description")})]})]}),o.jsx("span",{className:"af-set-badge"+(Ft?" af-set-badge--ok":" af-set-badge--muted"),children:t(Ft?"settings:allowlist.enabled":"settings:allowlist.open")}),o.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:()=>void Mn(),disabled:Re,children:t(Re?"settings:allowlist.refreshing":"common:common.refresh")})]}),Zt?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:Zt}):null,Le?o.jsxs("p",{className:"af-set-hint af-set-hint--inline",children:[t("settings:allowlist.file"),":",o.jsx("code",{children:Le})]}):null,o.jsxs("div",{className:"af-allowlist-grid",children:[o.jsxs("div",{className:"af-allowlist-main",children:[o.jsxs("div",{className:"af-allowlist-head",children:[o.jsx("span",{children:t("settings:allowlist.fileList")}),o.jsx("span",{children:Nt?t("settings:allowlist.saving"):t("settings:allowlist.userCount",{count:de.length})})]}),o.jsx("div",{className:"af-allowlist-list",children:de.length>0?de.map(ie=>o.jsxs("div",{className:"af-allowlist-row",children:[o.jsx("span",{className:"af-allowlist-name",children:ie}),o.jsx("button",{type:"button",className:"af-set-env-del",onClick:()=>ti(ie),"aria-label":t("settings:allowlist.remove",{username:ie}),disabled:Nt,children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})]},ie)):o.jsx("div",{className:"af-allowlist-empty",children:t("settings:allowlist.emptyFile")})}),o.jsxs("div",{className:"af-allowlist-add",children:[o.jsx("input",{className:"af-set-input af-set-input--sm af-set-input--mono",value:wt,onChange:ie=>mt(ie.target.value),onKeyDown:ie=>{ie.key==="Enter"&&Tr()},placeholder:"username",autoComplete:"off"}),o.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:Tr,disabled:Nt||!wt.trim(),children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),t("settings:allowlist.add")]})]})]}),o.jsxs("div",{className:"af-allowlist-side",children:[o.jsxs("div",{className:"af-allowlist-head",children:[o.jsx("span",{children:t("settings:allowlist.envList")}),o.jsx("span",{children:t("settings:allowlist.readonly")})]}),o.jsx("div",{className:"af-allowlist-env-list",children:ze.length>0?ze.map(ie=>o.jsx("code",{children:ie},ie)):o.jsx("span",{children:t("settings:allowlist.emptyEnv")})}),o.jsx("p",{className:"af-set-hint af-set-hint--inline",children:t("settings:allowlist.unionHint")})]})]})]}):null,o.jsxs("section",{className:"af-settings-rail","aria-label":t("settings:title"),children:[o.jsxs("div",{className:"af-set-rail-card af-set-rail-card--accent",children:[o.jsxs("div",{className:"af-set-rail-inner",children:[o.jsx("h3",{className:"af-set-rail-h3",children:t("settings:system.title")}),o.jsxs("div",{className:"af-set-health-line",children:[o.jsx("span",{className:"af-set-pulse-dot","aria-hidden":!0}),o.jsx("span",{className:"af-set-health-label",children:t(!a&&!v?"settings:system.normal":"settings:system.abnormal")})]}),o.jsxs("div",{className:"af-set-meter",children:[o.jsxs("div",{className:"af-set-meter-row",children:[o.jsx("span",{children:t("settings:system.cursorModels")}),o.jsx("span",{children:c.cursor.length})]}),o.jsx("div",{className:"af-set-meter-bar",children:o.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,c.cursor.length>0?12+c.cursor.length*3:4)}%`}})})]}),o.jsxs("div",{className:"af-set-meter",children:[o.jsxs("div",{className:"af-set-meter-row",children:[o.jsx("span",{children:t("settings:system.opencodeModels")}),o.jsx("span",{children:c.opencode.length})]}),o.jsx("div",{className:"af-set-meter-bar",children:o.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,c.opencode.length>0?12+c.opencode.length*3:4)}%`}})})]}),o.jsxs("div",{className:"af-set-meter",children:[o.jsxs("div",{className:"af-set-meter-row",children:[o.jsx("span",{children:t("settings:system.claudeCodeModels")}),o.jsx("span",{children:c.claudeCode.length})]}),o.jsx("div",{className:"af-set-meter-bar",children:o.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,c.claudeCode.length>0?12+c.claudeCode.length*3:4)}%`}})})]}),o.jsxs("div",{className:"af-set-meter",children:[o.jsxs("div",{className:"af-set-meter-row",children:[o.jsx("span",{children:t("settings:system.codexModels")}),o.jsx("span",{children:c.codex.length})]}),o.jsx("div",{className:"af-set-meter-bar",children:o.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,c.codex.length>0?12+c.codex.length*3:4)}%`}})})]})]}),o.jsx("div",{className:"af-set-rail-watermark","aria-hidden":!0,children:o.jsx("span",{className:"material-symbols-outlined",children:"vital_signs"})})]}),o.jsxs("div",{className:"af-set-rail-card",children:[o.jsx("h3",{className:"af-set-rail-h3 af-set-rail-h3--sm",children:t("settings:language.title")}),o.jsxs("div",{className:"af-set-language-selector",children:[o.jsx("select",{className:"af-set-input af-set-input--sm",value:r,onChange:js,"aria-label":t("settings:language.description"),children:gre.map(ie=>o.jsxs("option",{value:ie.code,children:[ie.flag," ",ie.name]},ie.code))}),o.jsx("p",{className:"af-set-hint",children:t("settings:language.description")})]})]})]})]})})]})})]})}function Lr(e){return new Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(Math.max(0,Number(e||0)))}function hp(e){return`${Math.round(Math.max(0,Math.min(1,Number(e||0)))*100)}%`}function Ly(e){const t=Math.max(0,Number(e||0));if(!t)return"-";const n=Math.round(t/1e3);if(n<60)return`${n}s`;const r=Math.round(n/60);if(r<60)return`${r}m`;const s=Math.round(r/60);return s<48?`${s}h`:`${Math.round(s/24)}d`}function Sre(e){const t=String(e||"");return t.includes("-")?t.slice(5):t}function Oy(e){if(!e)return"无运行记录";try{return new Intl.DateTimeFormat(void 0,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(Number(e)))}catch{return String(e)}}function Nre(e){const t=String(e||"").trim();return t?t.length>18?t.slice(0,8)+"..."+t.slice(-6):t:"-"}function jre(e){const t=String(e||"unknown");return t==="success"?"成功":t==="failed"?"失败":t==="running"?"运行中":t==="stopped"?"已停止":t==="interrupted"?"中断":"未知"}function Cre({authUser:e}){const[t,n]=m.useState(null),[r,s]=m.useState(!1),[i,a]=m.useState(""),l=m.useCallback(async()=>{if(e!=null&&e.isAdmin){s(!0),a("");try{const h=await fetch("/api/admin/usage-dashboard"),g=await h.json().catch(()=>({}));if(!h.ok)throw new Error(typeof g.error=="string"?g.error:"HTTP "+h.status);n(g)}catch(h){n(null),a(String((h==null?void 0:h.message)||h))}finally{s(!1)}}},[e==null?void 0:e.isAdmin]);m.useEffect(()=>{l()},[l]);const c=Array.isArray(t==null?void 0:t.dailyTrend)?t.dailyTrend:[],u=m.useMemo(()=>{const k={top:20,right:24,bottom:42,left:42},w=980-k.left-k.right,y=250-k.top-k.bottom,v=c.length>0?c:[],b=Math.max(1,...v.map(D=>Number(D.runs||0))),C=Math.max(1,...v.flatMap(D=>[Number(D.users||0),Number(D.pipelines||0)])),N=D=>k.left+(v.length<=1?w/2:D*w/(v.length-1)),j=D=>k.top+y-Math.max(0,Number(D||0))/b*y,A=D=>k.top+y-Math.max(0,Number(D||0))/C*y,I=D=>v.map((H,V)=>`${V===0?"M":"L"} ${N(V)} ${A(H[D])}`).join(" ");return{width:980,height:250,margin:k,innerHeight:y,rows:v,x:N,yRuns:j,yLine:A,lineUsers:I("users"),linePipelines:I("pipelines"),barWidth:Math.min(34,Math.max(12,w/Math.max(1,v.length)*.44))}},[c]),f=(t==null?void 0:t.usage)||{},d=(t==null?void 0:t.totals)||{},p=Array.isArray(t==null?void 0:t.recentRuns)?t.recentRuns:[];return e!=null&&e.isAdmin?o.jsxs("main",{className:"af-admin-usage-page",children:[o.jsxs("section",{className:"af-admin-usage-hero",children:[o.jsxs("div",{children:[o.jsx("p",{className:"af-admin-usage-eyebrow",children:"Admin / Usage"}),o.jsx("h1",{children:"管理看板"}),o.jsx("p",{children:"重点观察使用率、每日趋势、成功率与各用户流水线活跃度。"})]}),o.jsxs("button",{type:"button",onClick:()=>void l(),disabled:r,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"refresh"}),r?"刷新中":"刷新"]})]}),i?o.jsx("div",{className:"af-project-admin-usage__error",children:i}):null,o.jsxs("section",{className:"af-admin-usage-rate-grid","aria-label":"使用率",children:[o.jsxs("div",{children:[o.jsx("span",{children:"7日活跃用户率"}),o.jsx("strong",{children:hp(f.activeUserRate)}),o.jsxs("em",{children:[Lr(f.activeUsers)," / ",Lr(d.users)," users"]})]}),o.jsxs("div",{children:[o.jsx("span",{children:"7日流水线使用率"}),o.jsx("strong",{children:hp(f.activePipelineRate)}),o.jsxs("em",{children:[Lr(f.activePipelines)," / ",Lr(d.activePipelines)," active"]})]}),o.jsxs("div",{children:[o.jsx("span",{children:"7日 Run"}),o.jsx("strong",{children:Lr(f.runs)}),o.jsxs("em",{children:[Lr(f.avgRunsPerDay)," / day"]})]}),o.jsxs("div",{children:[o.jsx("span",{children:"7日成功率"}),o.jsx("strong",{children:hp(f.successRate)}),o.jsxs("em",{children:["失败率 ",hp(f.failureRate)," · avg ",Ly(f.avgDurationMs)]})]})]}),o.jsxs("section",{className:"af-project-admin-usage af-admin-usage-trend",children:[o.jsx("div",{className:"af-project-admin-usage__head",children:o.jsxs("div",{children:[o.jsx("strong",{children:"每日趋势"}),o.jsx("span",{children:"上方看趋势,下方看最近 50 次具体运行。"})]})}),o.jsxs("div",{className:"af-admin-usage-chart",role:"img","aria-label":"最近 14 天运行趋势",children:[o.jsxs("div",{className:"af-admin-usage-chart__legend",children:[o.jsxs("span",{children:[o.jsx("i",{className:"af-admin-usage-chart__swatch af-admin-usage-chart__swatch--runs"}),"Runs"]}),o.jsxs("span",{children:[o.jsx("i",{className:"af-admin-usage-chart__swatch af-admin-usage-chart__swatch--users"}),"活跃用户"]}),o.jsxs("span",{children:[o.jsx("i",{className:"af-admin-usage-chart__swatch af-admin-usage-chart__swatch--pipelines"}),"活跃流水线"]})]}),o.jsx("div",{className:"af-admin-usage-chart__canvas",children:o.jsxs("svg",{viewBox:`0 0 ${u.width} ${u.height}`,preserveAspectRatio:"xMidYMid meet",children:[o.jsx("line",{className:"af-admin-usage-chart__axis",x1:u.margin.left,y1:u.margin.top+u.innerHeight,x2:u.width-u.margin.right,y2:u.margin.top+u.innerHeight}),[.25,.5,.75,1].map(h=>o.jsx("line",{className:"af-admin-usage-chart__grid",x1:u.margin.left,y1:u.margin.top+u.innerHeight-u.innerHeight*h,x2:u.width-u.margin.right,y2:u.margin.top+u.innerHeight-u.innerHeight*h},h)),u.rows.map((h,g)=>{const k=u.x(g),w=u.yRuns(h.runs),y=u.margin.top+u.innerHeight,v=Math.max(2,y-w);return o.jsxs("g",{children:[o.jsx("rect",{className:"af-admin-usage-chart__run-bar",x:k-u.barWidth/2,y:y-v,width:u.barWidth,height:v,rx:"5",children:o.jsx("title",{children:`${h.date}: ${h.runs} runs`})}),o.jsx("text",{className:"af-admin-usage-chart__value",x:k,y:y+22,children:Lr(h.runs)}),o.jsx("text",{className:"af-admin-usage-chart__date",x:k,y:y+42,children:Sre(h.date)})]},h.date)}),u.rows.length>0?o.jsxs(o.Fragment,{children:[o.jsx("path",{className:"af-admin-usage-chart__line af-admin-usage-chart__line--users",d:u.lineUsers}),o.jsx("path",{className:"af-admin-usage-chart__line af-admin-usage-chart__line--pipelines",d:u.linePipelines}),u.rows.map((h,g)=>{const k=u.x(g);return o.jsxs("g",{children:[o.jsx("circle",{className:"af-admin-usage-chart__point af-admin-usage-chart__point--users",cx:k,cy:u.yLine(h.users),r:"3.5"}),o.jsx("circle",{className:"af-admin-usage-chart__point af-admin-usage-chart__point--pipelines",cx:k,cy:u.yLine(h.pipelines),r:"3.5"})]},`${h.date}-points`)})]}):null]})})]}),o.jsx("div",{className:"af-project-admin-usage__table-wrap",children:o.jsxs("table",{className:"af-project-admin-usage__table af-admin-usage-table--recent",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"用户"}),o.jsx("th",{children:"流水线"}),o.jsx("th",{children:"运行时间"}),o.jsx("th",{children:"状态"}),o.jsx("th",{children:"耗时"}),o.jsx("th",{children:"Run ID"})]})}),o.jsx("tbody",{children:p.length===0?o.jsx("tr",{children:o.jsx("td",{colSpan:6,children:"暂无运行明细"})}):p.map(h=>o.jsxs("tr",{children:[o.jsxs("td",{children:[o.jsx("strong",{children:h.username||h.userId||"-"}),o.jsx("span",{children:h.userId||"-"})]}),o.jsxs("td",{children:[o.jsx("strong",{children:h.flowId||"-"}),o.jsxs("span",{children:[h.runType==="workspace"?"Workspace Run":"Pipeline"," · ",h.flowSource||"user"]})]}),o.jsxs("td",{children:[o.jsx("strong",{children:Oy(h.at)}),h.endedAt?o.jsxs("span",{children:["结束 ",Oy(h.endedAt)]}):o.jsx("span",{children:"未结束"})]}),o.jsx("td",{children:o.jsx("span",{className:"af-project-admin-usage__chips",children:o.jsx("em",{children:jre(h.status)})})}),o.jsx("td",{children:Ly(h.durationMs)}),o.jsx("td",{children:o.jsx("code",{className:"af-admin-usage-run-id",children:Nre(h.runId)})})]},`${h.userId}:${h.flowSource}:${h.flowId}:${h.runId}:${h.at}`))})]})})]}),o.jsxs("section",{className:"af-project-admin-usage",children:[o.jsx("div",{className:"af-project-admin-usage__head",children:o.jsxs("div",{children:[o.jsx("strong",{children:"用户使用明细"}),o.jsx("span",{children:"按用户汇总 Pipeline 数、Run 次数和最近运行。"})]})}),o.jsx("div",{className:"af-project-admin-usage__table-wrap",children:o.jsxs("table",{className:"af-project-admin-usage__table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"User"}),o.jsx("th",{children:"Pipeline"}),o.jsx("th",{children:"Runs"}),o.jsx("th",{children:"状态"}),o.jsx("th",{children:"最近运行"})]})}),o.jsx("tbody",{children:r&&!t?o.jsx("tr",{children:o.jsx("td",{colSpan:5,children:"正在加载..."})}):((t==null?void 0:t.users)||[]).length===0?o.jsx("tr",{children:o.jsx("td",{colSpan:5,children:"暂无用户数据"})}):((t==null?void 0:t.users)||[]).map(h=>{var g,k,w,y,v,b,C,N,j,A,I;return o.jsxs("tr",{children:[o.jsxs("td",{children:[o.jsx("strong",{children:h.username||h.userId}),o.jsxs("span",{children:[h.userId,h.isAdmin?" · admin":""]})]}),o.jsxs("td",{children:[o.jsx("strong",{children:Lr((g=h.pipelines)==null?void 0:g.total)}),o.jsxs("span",{children:[Lr((k=h.pipelines)==null?void 0:k.active)," active / ",Lr((w=h.pipelines)==null?void 0:w.archived)," archived"]})]}),o.jsxs("td",{children:[o.jsx("strong",{children:Lr((y=h.runs)==null?void 0:y.total)}),o.jsxs("span",{children:["avg ",Ly((v=h.runs)==null?void 0:v.avgDurationMs)]})]}),o.jsx("td",{children:o.jsxs("span",{className:"af-project-admin-usage__chips",children:[o.jsxs("em",{children:["成功 ",Lr((b=h.runs)==null?void 0:b.success)]}),o.jsxs("em",{children:["失败 ",Lr((C=h.runs)==null?void 0:C.failed)]}),o.jsxs("em",{children:["运行中 ",Lr((N=h.runs)==null?void 0:N.running)]})]})}),o.jsx("td",{children:(j=h.runs)!=null&&j.lastRunAt?o.jsxs(o.Fragment,{children:[o.jsx("strong",{children:((A=h.runs)==null?void 0:A.lastRunFlowId)||"-"}),o.jsxs("span",{children:[((I=h.runs)==null?void 0:I.lastRunStatus)||"unknown"," · ",Oy(h.runs.lastRunAt)]})]}):o.jsx("span",{children:"无运行记录"})})]},h.userId)})})]})})]})]}):o.jsx("main",{className:"af-admin-usage-page",children:o.jsx("section",{className:"af-project-admin-usage",children:o.jsx("div",{className:"af-project-admin-usage__head",children:o.jsxs("div",{children:[o.jsx("strong",{children:"管理看板"}),o.jsx("span",{children:"需要管理员权限。"})]})})})})}function _re(e){if(!e)return"";const t=Date.parse(e);if(Number.isNaN(t))return String(e);try{return new Intl.DateTimeFormat("zh-CN",{dateStyle:"short",timeStyle:"medium"}).format(new Date(t))}catch{return String(e)}}function Ere({authUser:e}){const{navigate:t}=Ni(),[n,r]=m.useState(""),[s,i]=m.useState(""),[a,l]=m.useState(!1),[c,u]=m.useState(""),[f,d]=m.useState(!1),[p,h]=m.useState([]),[g,k]=m.useState(!1),[w,y]=m.useState(""),v=!!(e!=null&&e.isAdmin),b=m.useCallback(async()=>{if(v){k(!0),y("");try{const N=await fetch("/api/feedback"),j=await N.json().catch(()=>({}));if(!N.ok)throw new Error(j.error||"加载失败");h(Array.isArray(j.feedback)?j.feedback:[])}catch(N){y(String(N.message||N)),h([])}finally{k(!1)}}},[v]);m.useEffect(()=>{b()},[b]);const C=async N=>{if(N.preventDefault(),!a){l(!0),u("");try{const j=await fetch("/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:n,content:s,pageUrl:window.location.href})}),A=await j.json().catch(()=>({}));if(!j.ok)throw new Error(A.error||"提交失败");d(!0),r(""),i("")}catch(j){u(String(j.message||j))}finally{l(!1)}}};return v?o.jsx("main",{className:"af-feedback-page",children:o.jsxs("section",{className:"af-feedback-panel af-feedback-panel--admin",children:[o.jsxs("div",{className:"af-feedback-head",children:[o.jsxs("div",{children:[o.jsx("span",{className:"af-feedback-eyebrow",children:"Feedback"}),o.jsx("h1",{children:"意见反馈"}),o.jsx("p",{children:"查看用户提交的问题、建议和功能需求。"})]}),o.jsxs("div",{className:"af-feedback-admin-actions",children:[o.jsxs("button",{type:"button",className:"af-feedback-back",onClick:()=>void b(),disabled:g,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:g?"hourglass_empty":"refresh"}),g?"刷新中...":"刷新"]}),o.jsxs("button",{type:"button",className:"af-feedback-back",onClick:()=>t("/projects"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_back"}),"返回"]})]})]}),w?o.jsx("p",{className:"af-err af-feedback-error",children:w}):null,o.jsx("div",{className:"af-feedback-list af-feedback-list--page",children:p.length>0?p.map(N=>o.jsxs("article",{className:"af-feedback-item",children:[o.jsxs("header",{className:"af-feedback-item__head",children:[o.jsxs("div",{children:[o.jsx("h3",{children:N.title||"未命名反馈"}),o.jsxs("p",{children:[o.jsx("span",{children:N.username||N.userId||"unknown"}),o.jsx("span",{children:_re(N.createdAt)})]})]}),N.contact?o.jsx("span",{className:"af-feedback-item__contact",children:N.contact}):null]}),o.jsx("p",{className:"af-feedback-item__content",children:N.content}),N.pageUrl?o.jsx("code",{className:"af-feedback-item__url",children:N.pageUrl}):null]},N.id)):o.jsx("div",{className:"af-feedback-empty",children:g?"正在加载反馈...":"暂无反馈"})})]})}):o.jsx("main",{className:"af-feedback-page",children:o.jsxs("section",{className:"af-feedback-panel",children:[o.jsxs("div",{className:"af-feedback-head",children:[o.jsxs("div",{children:[o.jsx("span",{className:"af-feedback-eyebrow",children:"Feedback"}),o.jsx("h1",{children:"意见反馈"}),o.jsx("p",{children:"提交使用中遇到的问题、改进建议或功能需求,管理员会在这里统一查看。"})]}),o.jsxs("button",{type:"button",className:"af-feedback-back",onClick:()=>t("/projects"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_back"}),"返回"]})]}),f?o.jsxs("div",{className:"af-feedback-success",role:"status",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"check_circle"}),o.jsxs("div",{children:[o.jsx("strong",{children:"已提交"}),o.jsx("span",{children:"感谢反馈,管理员可以在意见反馈页查看这条记录。"})]})]}):null,o.jsxs("form",{className:"af-feedback-form",onSubmit:C,children:[o.jsxs("label",{className:"af-feedback-field",children:[o.jsx("span",{children:"标题"}),o.jsx("input",{value:n,onChange:N=>r(N.target.value),placeholder:"一句话说明问题或建议",maxLength:120,required:!0})]}),o.jsxs("label",{className:"af-feedback-field",children:[o.jsx("span",{children:"反馈内容"}),o.jsx("textarea",{value:s,onChange:N=>i(N.target.value),placeholder:"描述具体场景、期望表现、实际表现或复现步骤",maxLength:5e3,rows:9,required:!0})]}),c?o.jsx("p",{className:"af-err af-feedback-error",children:c}):null,o.jsx("div",{className:"af-feedback-actions",children:o.jsxs("button",{type:"submit",className:"af-feedback-submit",disabled:a||!n.trim()||!s.trim(),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:a?"hourglass_empty":"send"}),a?"提交中...":"提交反馈"]})})]})]})})}function wT(){return`m_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function xC(e,t=[]){const n=new Set((Array.isArray(t)?t:[]).map(String));return Object.entries(e&&typeof e=="object"?e:{}).map(([r,s])=>({id:wT(),key:r,value:String(s??""),private:n.has(r)}))}function wC(e){const t={};for(const n of Array.isArray(e)?e:[]){const r=String((n==null?void 0:n.key)||"").trim();r&&(t[r]=String((n==null?void 0:n.value)??""))}return t}function Wp(e=null){const t=e!=null&&e.raw&&typeof e.raw=="object"?e.raw:{},n=Array.isArray(t.args)?t.args:Array.isArray(e==null?void 0:e.args)?e.args:[];return{originalName:String((e==null?void 0:e.name)||""),name:String((e==null?void 0:e.name)||""),type:e!=null&&e.url||t.url?"url":"command",url:String((e==null?void 0:e.url)||t.url||""),command:String((e==null?void 0:e.command)||t.command||""),argsText:n.map(String).join(`
|
|
315
|
-
`),description:String((e==null?void 0:e.description)||t.description||""),envRows:xC(t.env||(e==null?void 0:e.env),e==null?void 0:e.privateEnvKeys),headerRows:xC(t.headers||(e==null?void 0:e.headers),e==null?void 0:e.privateHeaderKeys),extraJson:JSON.stringify(Object.fromEntries(Object.entries(t).filter(([r])=>!["url","command","args","env","headers","description","__agentflowPrivateKeys"].includes(r))),null,2)}}function Dy(){return Wp({name:"",raw:{command:""}})}function Are(e){const n={...e.extraJson.trim()?JSON.parse(e.extraJson):{}};if(e.type==="url")n.url=e.url.trim();else{n.command=e.command.trim();const i=e.argsText.split(/\r?\n/g).map(a=>a.trim()).filter(Boolean);i.length&&(n.args=i)}const r=wC(e.envRows),s=wC(e.headerRows);return Object.keys(r).length&&(n.env=r),Object.keys(s).length&&(n.headers=s),e.description.trim()&&(n.description=e.description.trim()),{name:e.originalName,nextName:e.name.trim(),server:n,privateEnvKeys:e.envRows.filter(i=>i.private).map(i=>String(i.key||"").trim()).filter(Boolean),privateHeaderKeys:e.headerRows.filter(i=>i.private).map(i=>String(i.key||"").trim()).filter(Boolean)}}function bC(e){return e?e.ok?`${e.toolCount||0} tools enabled`:`Error - ${e.error||"Show Output"}`:"未检测"}function kC(e){return e?e.ok?"ok":"error":"unknown"}function Dw(e){return e==="ok"?"ok":e==="partial"?"partial":e==="unsupported"?"error":"unknown"}function Pre(e,t){return e&&e.label||t}async function Fy(e){var n;const t=String(e||"");if(!t)return!1;try{if((n=navigator.clipboard)!=null&&n.writeText&&window.isSecureContext)return await navigator.clipboard.writeText(t),!0}catch{}try{const r=document.createElement("textarea");r.value=t,r.setAttribute("readonly",""),r.style.position="fixed",r.style.top="-9999px",r.style.left="-9999px",r.style.opacity="0",document.body.appendChild(r),r.focus(),r.select();const s=document.execCommand("copy");return r.remove(),s}catch{return!1}}function Lk(e){return String(e||"").trim()||"<AGENTFLOW_TOKEN>"}function bT({baseUrl:e="",token:t=""}){return JSON.stringify({mcpServers:{agentflow:{command:"agentflow",args:["mcp"],env:{AGENTFLOW_BASE_URL:String(e||"http://127.0.0.1:8875"),AGENTFLOW_TOKEN:Lk(t)}}}},null,2)}function kT({baseUrl:e="",token:t=""}){const n=JSON.stringify(String(e||"http://127.0.0.1:8875")),r=JSON.stringify(Lk(t));return["[mcp_servers.agentflow]",'command = "agentflow"','args = ["mcp"]',"","[mcp_servers.agentflow.env]",`AGENTFLOW_BASE_URL = ${n}`,`AGENTFLOW_TOKEN = ${r}`].join(`
|
|
316
|
-
`)}function Ire({baseUrl:e="",token:t=""}){const n=String(e||"http://127.0.0.1:8875"),r=bT({baseUrl:n,token:t}),s=kT({baseUrl:n,token:t});return["你是一个 AI Coding Agent。请帮我把 AgentFlow 配置成当前开发环境可用的 MCP server。","","这是一项配置任务,不是调用任务:请修改 Cursor 或 Codex 的 MCP 配置文件,让它们能连接本机 AgentFlow。","","AgentFlow MCP server 信息:","- server name: agentflow","- command: agentflow",'- args: ["mcp"]',`- env.AGENTFLOW_BASE_URL: ${n}`,`- env.AGENTFLOW_TOKEN: ${Lk(t)}`,"","Cursor 配置片段(合并到 .cursor/mcp.json 或 ~/.cursor/mcp.json):","```json",r,"```","","Codex 配置片段(合并到 ~/.codex/config.toml 的 mcp_servers 配置):","```toml",s,"```","","配置要求:","1. 先判断当前仓库主要使用 Cursor、Codex,还是两者都需要配置。","2. 不要覆盖已有 MCP server;只新增或更新名为 `agentflow` 的 server。","3. 保留已有配置文件里的其他字段、注释和 server。","4. 如果配置文件不存在,请创建父目录和配置文件。","5. 不要把 token 打印到最终回复里;如果需要说明,只写 `AGENTFLOW_TOKEN 已写入配置`。","6. 如果 token 仍是 `<AGENTFLOW_TOKEN>` 占位符,请提醒用户需要在配置文件中替换成真实 token,或回到 AgentFlow 的 MCP 页面点击“使用当前登录 Token”后重新复制。","7. 如果外部 Agent 启动 MCP 时找不到 `agentflow` 命令,请把 command 改成本机 agentflow 可执行文件的绝对路径,或先把 agentflow 安装/软链到 PATH。","","配置后验证:","- 如果配置使用 `command: agentflow`,确认外部 Agent 所在环境可以执行这个命令;如果使用绝对路径,则确认路径存在且可执行。","- 通过 MCP 客户端刷新或重启后,确认 `agentflow` server 出现在 MCP server 列表。","- 如果可以做工具探测,只验证 `tools/list` 能看到 `agentflow_list_flows`、`agentflow_run_flow`、`agentflow_get_display_outputs`。","","最终回复只需要说明:配置了哪些文件、是否验证成功、如果失败下一步该检查什么。"].join(`
|
|
317
|
-
`)}function Rre({server:e}){const t=(e==null?void 0:e.backends)||{},n=[["Cursor",t.cursor],["Codex",t.codex]];return o.jsx("div",{className:"af-mcp-backends",children:n.map(([r,s])=>o.jsxs("div",{className:`af-mcp-backend af-mcp-backend--${Dw(s==null?void 0:s.status)}`,children:[o.jsxs("div",{className:"af-mcp-backend-head",children:[o.jsx("strong",{children:r}),o.jsx("span",{children:Pre(s,"Unknown")})]}),Array.isArray(s==null?void 0:s.reasons)&&s.reasons.length?o.jsx("ul",{children:s.reasons.map(i=>o.jsx("li",{children:i},i))}):o.jsx("p",{children:"当前配置可直接使用。"})]},r))})}function vC({title:e,rows:t,onChange:n,placeholderKey:r="KEY",placeholderValue:s="value"}){const i=(a,l,c)=>n(t.map(u=>u.id===a?{...u,[l]:c}:u));return o.jsxs("div",{className:"af-mcp-field",children:[o.jsxs("div",{className:"af-mcp-field-head",children:[o.jsx("span",{children:e}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>n([...t,{id:wT(),key:"",value:"",private:!0}]),children:"添加"})]}),o.jsxs("div",{className:"af-mcp-kv-list",children:[t.length===0?o.jsx("p",{className:"af-set-hint",children:"暂无"}):null,t.map(a=>o.jsxs("div",{className:"af-mcp-kv-row",children:[o.jsx("input",{className:"af-set-input af-set-input--mono",value:a.key,placeholder:r,onChange:l=>i(a.id,"key",l.target.value)}),o.jsx("input",{className:"af-set-input af-set-input--mono",value:a.value,placeholder:s,onChange:l=>i(a.id,"value",l.target.value)}),o.jsxs("label",{className:"af-mcp-private-toggle",title:"只保存到当前 AgentFlow 用户的个人配置",children:[o.jsx("input",{type:"checkbox",checked:!!a.private,onChange:l=>i(a.id,"private",l.target.checked)}),o.jsx("span",{children:"个人"})]}),o.jsx("button",{type:"button",className:"af-set-env-del",onClick:()=>n(t.filter(l=>l.id!==a.id)),"aria-label":"删除",children:o.jsx("span",{className:"material-symbols-outlined",children:"delete"})})]},a.id))]})]})}function Tre(){var ae;const[e,t]=m.useState(""),[n,r]=m.useState([]),[s,i]=m.useState(Dy),[a,l]=m.useState(""),[c,u]=m.useState(!1),[f,d]=m.useState(!1),[p,h]=m.useState(!1),[g,k]=m.useState({}),[w,y]=m.useState(""),[v,b]=m.useState(""),[C,N]=m.useState(()=>{var J;return typeof window<"u"&&((J=window.location)!=null&&J.origin)?window.location.origin:"http://127.0.0.1:8875"}),[j,A]=m.useState(""),[I,D]=m.useState(""),H=m.useMemo(()=>n.find(J=>J.name===a)||null,[a,n]),V=H&&g[H.name]||null,F=m.useMemo(()=>bT({baseUrl:C,token:j}),[C,j]),L=m.useMemo(()=>kT({baseUrl:C,token:j}),[C,j]),M=m.useMemo(()=>Ire({baseUrl:C,token:j}),[C,j]),K=m.useCallback(async()=>{u(!0),y("");try{const J=await fetch("/api/mcps"),se=await J.json().catch(()=>({}));if(!J.ok)throw new Error(se.error||"MCP HTTP "+J.status);const ee=Array.isArray(se.servers)?se.servers:[];t(String(se.path||"")),r(ee),a&&ee.some(re=>re.name===a)&&i(Wp(ee.find(re=>re.name===a)))}catch(J){y(String(J.message||J))}finally{u(!1)}},[a]);m.useEffect(()=>{K()},[K]);const W=()=>{l(""),i(Dy()),b(""),y("")},$=J=>{l(J.name),i(Wp(J)),b(""),y("")},R=m.useCallback(async()=>{if(!M)return;const J=await Fy(M);D(J?"prompt":"copy-failed"),window.setTimeout(()=>D(""),1200)},[M]),B=m.useCallback(async()=>{const J=await Fy(F);D(J?"cursor":"copy-failed"),window.setTimeout(()=>D(""),1200)},[F]),_=m.useCallback(async()=>{const J=await Fy(L);D(J?"codex":"copy-failed"),window.setTimeout(()=>D(""),1200)},[L]),X=m.useCallback(async()=>{try{const J=await fetch("/api/auth/session-token"),se=await J.json().catch(()=>({}));if(!J.ok)throw new Error(typeof se.error=="string"?se.error:"HTTP "+J.status);A(String(se.token||"")),D("token"),window.setTimeout(()=>D(""),1200)}catch(J){D(""),y(String(J.message||J))}},[]),z=async(J="")=>{h(!0),y(""),b("");try{const se=await fetch("/api/mcps/check",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(J?{name:J}:{})}),ee=await se.json().catch(()=>({}));if(!se.ok)throw new Error(ee.error||"检测 MCP 失败");const re=Array.isArray(ee.results)?ee.results:[];k(ne=>{const ue={...ne};for(const de of re)de!=null&&de.name&&(ue[de.name]=de);return ue}),b(J?`已检测 ${J}。`:"已检测所有 MCP。")}catch(se){y(String(se.message||se))}finally{h(!1)}},T=async()=>{d(!0),y(""),b("");try{const J=Are(s);if(!J.nextName)throw new Error("请填写 MCP 名称");const se=await fetch("/api/mcps",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(J)}),ee=await se.json().catch(()=>({}));if(!se.ok)throw new Error(ee.error||"保存 MCP 失败");const re=Array.isArray(ee.servers)?ee.servers:[];r(re),t(String(ee.path||e)),l(J.nextName),i(Wp(re.find(ne=>ne.name===J.nextName)||null)),k(ne=>{const ue={...ne};return s.originalName&&s.originalName!==J.nextName&&delete ue[s.originalName],delete ue[J.nextName],ue}),b("已保存。Cursor CLI 下次启动时会读取新配置。")}catch(J){y(String(J.message||J))}finally{d(!1)}},Z=async J=>{if(J!=null&&J.name&&window.confirm(`删除 MCP "${J.name}"?`)){d(!0),y(""),b("");try{const se=await fetch("/api/mcps/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:J.name})}),ee=await se.json().catch(()=>({}));if(!se.ok)throw new Error(ee.error||"删除 MCP 失败");r(Array.isArray(ee.servers)?ee.servers:[]),l(""),i(Dy()),k(re=>{const ne={...re};return delete ne[J.name],ne}),b("已删除。")}catch(se){y(String(se.message||se))}finally{d(!1)}}};return o.jsxs("main",{className:"af-settings-page",children:[o.jsxs("header",{className:"af-settings-top",children:[o.jsxs("div",{className:"af-settings-crumb",children:[o.jsx("span",{className:"af-settings-crumb-muted",children:"AgentFlow"}),o.jsx("span",{className:"af-settings-crumb-sep",children:"/"}),o.jsx("span",{className:"af-settings-crumb-active",children:"MCP"})]}),o.jsxs("div",{className:"af-settings-top-right",children:[o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:K,disabled:c||f,children:"刷新"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>z(),disabled:p||c||f||n.length===0,children:p?"检测中...":"检测状态"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:W,disabled:f,children:"新增 MCP"})]})]}),o.jsx("div",{className:"af-settings-body",children:o.jsxs("div",{className:"af-settings-inner",children:[o.jsxs("section",{className:"af-settings-hero",children:[o.jsx("h1",{className:"af-settings-h1",children:"MCP 管理"}),o.jsx("p",{className:"af-settings-lead",children:"管理 AgentFlow 暴露给外部 Agent 的 MCP 接入方式,以及 AgentFlow 自身可调用的外部 MCP server。"})]}),o.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--low af-set-mcp-personal",children:[o.jsxs("div",{className:"af-set-env-head",children:[o.jsxs("div",{className:"af-set-card-head",children:[o.jsx("div",{className:"af-set-env-icon-wrap",children:o.jsx("span",{className:"material-symbols-outlined af-set-icon--primary",children:"lan"})}),o.jsxs("div",{children:[o.jsx("h2",{className:"af-set-h2",children:"我的 MCP"}),o.jsx("p",{className:"af-set-card-subtitle",children:"给 Cursor、Codex 等外部 Agent 配置 AgentFlow MCP,用来运行流程并读取 display 结果。"})]})]}),o.jsx("span",{className:"af-set-badge af-set-badge--ok",children:"AgentFlow as MCP"})]}),o.jsx("p",{className:"af-set-hint",children:"这里生成的是让其他 Agent 连接本平台的配置;下方“外部 MCP Servers”管理的是 AgentFlow 运行时可调用的外部工具。"}),o.jsxs("div",{className:"af-set-mcp-connect-grid",children:[o.jsxs("label",{className:"af-set-mcp-field",children:[o.jsx("span",{children:"Base URL"}),o.jsx("input",{className:"af-set-input af-set-input--mono",value:C,onChange:J=>N(J.target.value),placeholder:"http://127.0.0.1:8875"})]}),o.jsxs("label",{className:"af-set-mcp-field",children:[o.jsx("span",{children:"Token"}),o.jsxs("div",{className:"af-set-mcp-token-row",children:[o.jsx("input",{className:"af-set-input af-set-input--mono",type:"password",value:j,onChange:J=>A(J.target.value),placeholder:"<AGENTFLOW_TOKEN>"}),o.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:X,children:I==="token"?"已填入":"使用当前登录 Token"})]})]})]}),o.jsxs("div",{className:"af-set-mcp-snippet-grid",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"af-set-mcp-snippet-head",children:[o.jsx("span",{children:"Cursor mcp.json"}),o.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:B,children:I==="cursor"?"已复制":I==="copy-failed"?"复制失败":"复制"})]}),o.jsx("pre",{className:"af-set-mcp-code",children:F})]}),o.jsxs("div",{children:[o.jsxs("div",{className:"af-set-mcp-snippet-head",children:[o.jsx("span",{children:"Codex config.toml"}),o.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:_,children:I==="codex"?"已复制":I==="copy-failed"?"复制失败":"复制"})]}),o.jsx("pre",{className:"af-set-mcp-code",children:L})]})]}),o.jsx("div",{className:"af-set-mcp-copy-row",children:o.jsxs("button",{type:"button",className:"af-set-footer-primary",onClick:R,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"content_copy"}),I==="prompt"?"已复制 Prompt":I==="copy-failed"?"复制失败":"复制 AI 配置 Prompt"]})}),I==="copy-failed"?o.jsx("p",{className:"af-mcp-error",children:"浏览器禁止访问剪贴板,请手动选中下面的 Prompt 复制。"}):null,o.jsx("label",{className:"af-set-label-sm",htmlFor:"af-mcp-ai-prompt",children:"AI 配置 Prompt"}),o.jsx("textarea",{id:"af-mcp-ai-prompt",className:"af-set-input af-set-input--mono af-set-mcp-prompt",rows:12,readOnly:!0,value:M})]}),o.jsxs("section",{className:"af-settings-hero af-settings-hero--compact",children:[o.jsx("h2",{className:"af-settings-h2",children:"外部 MCP Servers"}),o.jsxs("p",{className:"af-settings-lead",children:["新增、编辑和删除 AgentFlow 可调用的外部 MCP server。当前配置文件:",o.jsx("span",{className:"af-settings-code",children:e||"~/.cursor/mcp.json"})]})]}),o.jsxs("div",{className:"af-mcp-layout",children:[o.jsxs("section",{className:"af-set-card af-mcp-list-card",children:[o.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[o.jsx("h2",{className:"af-set-h2",children:"Servers"}),o.jsxs("div",{className:"af-mcp-list-head-actions",children:[o.jsx("span",{className:"af-set-badge af-set-badge--muted",children:n.length}),o.jsxs("button",{type:"button",className:"af-set-btn-mini",onClick:W,disabled:f,children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),"新增"]})]})]}),c?o.jsx("p",{className:"af-set-p",children:"加载中..."}):null,n.length===0&&!c?o.jsxs("div",{className:"af-mcp-empty",children:[o.jsx("p",{className:"af-set-p",children:"暂无 MCP server。"}),o.jsx("button",{type:"button",className:"af-set-footer-primary",onClick:W,disabled:f,children:"新增 MCP Server"})]}):null,o.jsx("div",{className:"af-mcp-server-list",children:n.map(J=>{var se,ee,re,ne;return o.jsxs("button",{type:"button",className:"af-mcp-server-item"+(a===J.name?" af-mcp-server-item--active":""),onClick:()=>$(J),children:[o.jsx("span",{className:"material-symbols-outlined",children:J.type==="url"?"cloud":"terminal"}),o.jsxs("span",{children:[o.jsxs("span",{className:"af-mcp-server-title",children:[o.jsx("strong",{children:J.name}),o.jsx("small",{className:`af-mcp-server-health af-mcp-server-health--${kC(g[J.name])}`,children:bC(g[J.name])})]}),o.jsxs("span",{className:"af-mcp-server-backends",children:[o.jsx("small",{className:`af-mcp-backend-pill af-mcp-backend-pill--${Dw((ee=(se=J.backends)==null?void 0:se.cursor)==null?void 0:ee.status)}`,children:"Cursor"}),o.jsx("small",{className:`af-mcp-backend-pill af-mcp-backend-pill--${Dw((ne=(re=J.backends)==null?void 0:re.codex)==null?void 0:ne.status)}`,children:"Codex"})]}),o.jsx("em",{children:J.url||[J.command,...J.args||[]].filter(Boolean).join(" ")})]})]},J.name)})})]}),o.jsxs("section",{className:"af-set-card af-mcp-editor-card",children:[o.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"af-set-h2",children:H?"编辑 MCP":"新增 MCP"}),o.jsx("p",{className:"af-set-p af-set-p--tight",children:"保存后会写入 Cursor MCP 配置。已运行的 agent 进程不会热更新,下一次启动会读取新配置。"})]}),H?o.jsxs("div",{className:"af-mcp-editor-actions",children:[o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>z(H.name),disabled:p||f,children:p?"检测中...":"检测"}),o.jsx("button",{type:"button",className:"af-set-btn-mini af-set-btn-mini--danger",onClick:()=>Z(H),disabled:f,children:"删除"})]}):null]}),w?o.jsx("p",{className:"af-mcp-error",children:w}):null,v?o.jsx("p",{className:"af-mcp-status",children:v}):null,H?o.jsx(Rre,{server:H}):null,V?o.jsxs("div",{className:`af-mcp-check af-mcp-check--${kC(V)}`,children:[o.jsxs("div",{className:"af-mcp-check-head",children:[o.jsx("strong",{children:bC(V)}),o.jsxs("span",{children:[V.elapsedMs||0,"ms"]})]}),V.error?o.jsx("p",{children:V.error}):null,(ae=V.tools)!=null&&ae.length?o.jsx("div",{className:"af-mcp-tools-list",children:V.tools.map(J=>o.jsxs("div",{className:"af-mcp-tool-row",children:[o.jsx("strong",{children:J.name}),J.description?o.jsx("span",{children:J.description}):null]},J.name))}):null]}):null,o.jsxs("div",{className:"af-mcp-form",children:[o.jsxs("label",{className:"af-set-label",children:["MCP 名称",o.jsx("input",{className:"af-set-input af-set-input--mono",value:s.name,onChange:J=>i(se=>({...se,name:J.target.value})),placeholder:"github"})]}),o.jsxs("label",{className:"af-set-label",children:["类型",o.jsxs("select",{className:"af-set-input",value:s.type,onChange:J=>i(se=>({...se,type:J.target.value})),children:[o.jsx("option",{value:"url",children:"URL / HTTP"}),o.jsx("option",{value:"command",children:"Command / stdio"})]})]}),s.type==="url"?o.jsxs("label",{className:"af-set-label af-mcp-field--wide",children:["URL",o.jsx("input",{className:"af-set-input af-set-input--mono",value:s.url,onChange:J=>i(se=>({...se,url:J.target.value})),placeholder:"http://127.0.0.1:3845/mcp"})]}):o.jsxs(o.Fragment,{children:[o.jsxs("label",{className:"af-set-label",children:["Command",o.jsx("input",{className:"af-set-input af-set-input--mono",value:s.command,onChange:J=>i(se=>({...se,command:J.target.value})),placeholder:"uvx"})]}),o.jsxs("label",{className:"af-set-label",children:["Args,每行一个",o.jsx("textarea",{className:"af-set-input af-mcp-textarea af-set-input--mono",rows:4,value:s.argsText,onChange:J=>i(se=>({...se,argsText:J.target.value})),placeholder:`mcp-server-example
|
|
318
|
-
--flag`})]})]}),o.jsxs("label",{className:"af-set-label af-mcp-field--wide",children:["描述",o.jsx("input",{className:"af-set-input",value:s.description,onChange:J=>i(se=>({...se,description:J.target.value})),placeholder:"这个 MCP 提供什么能力"})]}),o.jsx(vC,{title:"Headers",rows:s.headerRows,onChange:J=>i(se=>({...se,headerRows:J})),placeholderKey:"Authorization",placeholderValue:"Bearer ..."}),o.jsx(vC,{title:"Env",rows:s.envRows,onChange:J=>i(se=>({...se,envRows:J})),placeholderKey:"TOKEN",placeholderValue:"..."}),o.jsxs("label",{className:"af-set-label af-mcp-field--wide",children:["额外 JSON 字段",o.jsx("textarea",{className:"af-set-input af-mcp-textarea af-set-input--mono",rows:5,value:s.extraJson,onChange:J=>i(se=>({...se,extraJson:J.target.value}))})]})]}),o.jsxs("div",{className:"af-mcp-actions",children:[o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:W,disabled:f,children:"清空"}),o.jsx("button",{type:"button",className:"af-set-footer-primary",onClick:T,disabled:f,children:f?"保存中...":"保存 MCP"})]})]})]})]})})]})}function SC(e){if(!e)return"-";const t=typeof e=="number"?e:Date.parse(String(e));return Number.isFinite(t)?new Date(t).toLocaleString():String(e)}function Mre(e){return(e==null?void 0:e.kind)==="workspace"?"Workspace":"Pipeline"}function $re(e){if(e!=null&&e.running)return"运行中";if(!(e!=null&&e.enabled))return"已停用";const t=String((e==null?void 0:e.lastStatus)||"").trim();return!t||t==="armed"||t==="enabled"?"已启用":t==="success"?"上次成功":t==="failed"?"上次失败":t==="invalid"?"配置异常":t.startsWith("skipped")?"已跳过":t}function Lre(){const[e,t]=m.useState([]),[n,r]=m.useState(!1),[s,i]=m.useState(""),[a,l]=m.useState(""),c=m.useCallback(async()=>{r(!0),i("");try{const d=await fetch("/api/schedules"),p=await d.json().catch(()=>({}));if(!d.ok)throw new Error(p.error||"读取定时任务失败");t(Array.isArray(p.schedules)?p.schedules:[])}catch(d){i(String(d.message||d)),t([])}finally{r(!1)}},[]);m.useEffect(()=>{c()},[c]);const u=m.useCallback(async d=>{const p=`${d.kind}:${d.flowSource||"user"}:${d.flowId||""}:${d.scheduleNodeId||""}`;l(p),i("");try{const h=await fetch("/api/schedule/toggle",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:d.kind,flowId:d.flowId,flowSource:d.flowSource||"user",scheduleNodeId:d.scheduleNodeId||"",enabled:!d.enabled})}),g=await h.json().catch(()=>({}));if(!h.ok||g.success===!1)throw new Error(g.error||"更新定时任务失败");await c()}catch(h){i(String(h.message||h))}finally{l("")}},[c]),f=m.useMemo(()=>{const d=e.filter(h=>h.enabled).length,p=e.filter(h=>h.kind==="workspace").length;return{total:e.length,enabled:d,workspace:p,pipeline:e.length-p}},[e]);return o.jsxs("div",{className:"af-settings-page af-schedules-page",children:[o.jsxs("div",{className:"af-settings-top",children:[o.jsxs("div",{className:"af-settings-crumb",children:[o.jsx("span",{className:"af-settings-crumb-muted",children:"AgentFlow"}),o.jsx("span",{className:"af-settings-crumb-sep",children:"/"}),o.jsx("span",{className:"af-settings-crumb-active",children:"定时任务"})]}),o.jsxs("button",{type:"button",className:"af-schedules-refresh",onClick:()=>void c(),disabled:n,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:n?"hourglass_empty":"refresh"}),"刷新"]})]}),o.jsx("div",{className:"af-settings-body",children:o.jsxs("div",{className:"af-settings-inner",children:[o.jsxs("section",{className:"af-settings-hero",children:[o.jsx("h1",{className:"af-settings-h1",children:"定时任务"}),o.jsx("p",{className:"af-settings-lead",children:"统一查看服务器上的 Pipeline 定时任务和 Workspace Scheduled Run,并在这里快捷启停。"})]}),o.jsxs("div",{className:"af-schedules-summary","aria-label":"定时任务汇总",children:[o.jsxs("div",{children:[o.jsx("span",{children:"全部"}),o.jsx("strong",{children:f.total})]}),o.jsxs("div",{children:[o.jsx("span",{children:"启用中"}),o.jsx("strong",{children:f.enabled})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Workspace"}),o.jsx("strong",{children:f.workspace})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Pipeline"}),o.jsx("strong",{children:f.pipeline})]})]}),s?o.jsx("div",{className:"af-schedules-error",children:s}):null,n?o.jsx("div",{className:"af-schedules-empty",children:"Loading..."}):null,!n&&e.length===0?o.jsx("div",{className:"af-schedules-empty",children:"暂无定时任务"}):null,o.jsx("div",{className:"af-schedules-list",children:e.map(d=>{const p=`${d.kind}:${d.flowSource||"user"}:${d.flowId||""}:${d.scheduleNodeId||""}`,h=a===p;return o.jsxs("article",{className:"af-schedule-card",children:[o.jsxs("div",{className:"af-schedule-card__main",children:[o.jsxs("div",{className:"af-schedule-card__title-row",children:[o.jsx("strong",{children:d.label||d.flowId||"-"}),o.jsx("span",{className:`af-schedule-badge af-schedule-badge--${d.kind||"pipeline"}`,children:Mre(d)}),o.jsx("span",{className:`af-schedule-state ${d.enabled?"af-schedule-state--on":"af-schedule-state--off"}`,children:$re(d)})]}),o.jsxs("div",{className:"af-schedule-card__meta",children:[o.jsx("span",{children:d.flowId||"-"}),o.jsx("span",{children:d.flowSource||"user"}),d.scheduleNodeId?o.jsx("span",{children:d.scheduleNodeId}):null]}),o.jsxs("div",{className:"af-schedule-card__grid",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Cron"}),o.jsx("strong",{children:d.cron||"-"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"时区"}),o.jsx("strong",{children:d.timezone||"Asia/Shanghai"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"下次执行"}),o.jsx("strong",{children:SC(d.nextRunAt)})]}),o.jsxs("div",{children:[o.jsx("span",{children:"最近执行"}),o.jsx("strong",{children:SC(d.lastTriggeredAt)})]})]}),d.lastError?o.jsx("p",{className:"af-schedule-card__error",children:d.lastError}):null]}),o.jsx("div",{className:"af-schedule-card__actions",children:o.jsxs("button",{type:"button",className:d.enabled?"af-schedule-toggle af-schedule-toggle--on":"af-schedule-toggle af-schedule-toggle--off",disabled:h,"aria-pressed":d.enabled,title:d.enabled?"点击停用":"点击启用",onClick:()=>void u(d),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:h?"hourglass_empty":d.enabled?"toggle_on":"toggle_off"}),d.enabled?"已启用":"已停用"]})})]},p)})})]})})]})}const NC={id:"",title:"Untitled Node",definitionId:"",agentMessages:[],promptDraft:"",manifest:{id:"",version:"1.0.0",name:"",runtime:{type:"agent_subAgent"},inputs:[],outputs:[],configSchema:{fields:[]},ui:{card:{icon:"extension",variant:"default",actions:[]}}},config:{},files:{},test:{inputs:{},log:[],status:"not run"}};function jC(e){const t=(e==null?void 0:e.manifest)||{};return(e==null?void 0:e.definitionId)||`marketplace:${t.id||(e==null?void 0:e.id)||"node"}@${t.version||"1.0.0"}`}function Ore(e){var c,u,f,d,p,h,g,k,w,y,v,b;const t=(e==null?void 0:e.manifest)||{},n=(e==null?void 0:e.files)||{},r=Array.isArray(t.inputs)?t.inputs:[],s=Array.isArray(t.outputs)?t.outputs:[],i=Array.isArray((c=t.configSchema)==null?void 0:c.fields)?t.configSchema.fields:[],a=Array.isArray((f=(u=t.ui)==null?void 0:u.card)==null?void 0:f.actions)?t.ui.card.actions:[],l=(d=e==null?void 0:e.test)!=null&&d.inputs&&typeof e.test.inputs=="object"?e.test.inputs:{};return[{id:"contract",label:"Contract",icon:"account_tree",rows:[...r.map(C=>[`input.${C.name||"-"}`,`${C.type||"text"}${C.required?" · required":""}${C.default?` · default: ${C.default}`:""}`]),...s.map(C=>[`output.${C.name||"-"}`,C.type||"text"]),...i.map(C=>[`config.${C.key||"-"}`,C.type||"text"])]},{id:"runtime",label:"Runtime",icon:"terminal",rows:[["runtime.type",((p=t.runtime)==null?void 0:p.type)||t.baseDefinitionId||"tool_nodejs"],["runtime.entry",((h=t.runtime)==null?void 0:h.entry)||"scripts/run.mjs"],["prompt.md",n["prompt.md"]||"-"],["implementation.md",n["implementation.md"]||"-"]]},{id:"ui",label:"UI",icon:"dashboard_customize",rows:[["card.variant",((k=(g=t.ui)==null?void 0:g.card)==null?void 0:k.variant)||"default"],["card.icon",((y=(w=t.ui)==null?void 0:w.card)==null?void 0:y.icon)||"extension"],...a.map(C=>[`action.${C.id||C.label||"-"}`,C.variant||C.label||"secondary"])]},{id:"tests",label:"Tests",icon:"science",rows:[...Object.entries(l).map(([C,N])=>[`sample.${C}`,String(N)]),["last run",`${((v=e==null?void 0:e.test)==null?void 0:v.status)||"not run"}${(b=e==null?void 0:e.test)!=null&&b.durationMs?` · ${e.test.durationMs}ms`:""}`]]}]}function Dre(){var L,M,K,W,$,R,B;const[e,t]=m.useState(null),[n,r]=m.useState("runtime"),[s,i]=m.useState(!1),[a,l]=m.useState(!0),[c,u]=m.useState(""),[f,d]=m.useState(!1),[p,h]=m.useState(""),g=e||NC,k=m.useMemo(()=>Ore(g),[g]),w=m.useMemo(()=>k.find(_=>_.id===n)||k[1],[n,k]),y=(g==null?void 0:g.manifest)||{},v=(g==null?void 0:g.config)||{},b=((L=g==null?void 0:g.test)==null?void 0:L.inputs)||{},C=Array.isArray((M=g==null?void 0:g.test)==null?void 0:M.log)?g.test.log:[],N=((W=(K=y.ui)==null?void 0:K.card)==null?void 0:W.icon)||"event_repeat",j=((R=($=y.ui)==null?void 0:$.card)==null?void 0:R.variant)||"default",A=v.enabled===!0,I=m.useCallback(async()=>{var _;l(!0),u("");try{const X=await fetch("/api/node-studio/drafts"),z=await X.json().catch(()=>({}));if(!X.ok)throw new Error(z.error||"读取节点草稿失败");const T=Array.isArray(z.drafts)?z.drafts[0]:null;if(!(T!=null&&T.id)){t(null),h("");return}const Z=await fetch(`/api/node-studio/draft?id=${encodeURIComponent(T.id)}`),ae=await Z.json().catch(()=>({}));if(!Z.ok)throw new Error(ae.error||"读取节点草稿失败");t(ae.draft||null),h(String(((_=ae.draft)==null?void 0:_.promptDraft)||""))}catch(X){u(String(X.message||X))}finally{l(!1)}},[]);m.useEffect(()=>{I()},[I]);const D=m.useCallback(async(_={})=>{var X;d(!0),u("");try{const z=await fetch("/api/node-studio/draft",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:(e==null?void 0:e.id)||"untitled_node",..._})}),T=await z.json().catch(()=>({}));if(!z.ok||T.ok===!1)throw new Error(T.error||"保存节点草稿失败");t(T.draft||e),h(String(((X=T.draft||e)==null?void 0:X.promptDraft)||""))}catch(z){u(String(z.message||z))}finally{d(!1)}},[e]),H=()=>{i(!0),window.setTimeout(()=>i(!1),900)},V=_=>{const X={...v,enabled:_};t(z=>({...z||NC,config:X})),D({config:{enabled:_}})},F=()=>{D({promptDraft:p,appendUserMessage:!0})};return o.jsxs("div",{className:"af-node-studio-page",children:[o.jsxs("header",{className:"af-node-studio-top",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"af-settings-crumb",children:[o.jsx("span",{className:"af-settings-crumb-muted",children:"AgentFlow"}),o.jsx("span",{className:"af-settings-crumb-sep",children:"/"}),o.jsx("span",{className:"af-settings-crumb-active",children:"Node Studio"})]}),o.jsx("h1",{children:"节点编辑器"})]}),o.jsxs("div",{className:"af-node-studio-actions",children:[o.jsxs("button",{type:"button",onClick:()=>void I(),disabled:a,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"visibility"}),a?"Loading":"Preview"]}),o.jsxs("button",{type:"button",onClick:H,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:s?"sync":"science"}),"Test"]}),o.jsxs("button",{type:"button",className:"af-node-studio-actions__primary",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"publish"}),"Publish"]})]})]}),o.jsxs("main",{className:"af-node-studio-shell",children:[o.jsxs("aside",{className:"af-node-studio-agent","aria-label":"AI Agent",children:[o.jsxs("div",{className:"af-node-studio-panel-head",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"auto_awesome"}),o.jsx("strong",{children:"AI Agent"})]}),c?o.jsx("div",{className:"af-node-studio-error",children:c}):null,o.jsxs("div",{className:"af-node-studio-thread",children:[e?null:o.jsx("div",{className:"af-node-studio-empty",children:"还没有节点草稿。描述你要创建的节点,发送后会创建一个新的 draft。"}),(Array.isArray(g==null?void 0:g.agentMessages)?g.agentMessages:[]).map((_,X)=>o.jsx("div",{className:_.role==="user"?"af-node-studio-message af-node-studio-message--user":"af-node-studio-message",children:_.text||""},`${_.role||"message"}-${X}`)),o.jsxs("div",{className:"af-node-studio-agent-tools",children:[o.jsxs("button",{type:"button",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"edit"}),"修改 UI"]}),o.jsxs("button",{type:"button",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"code"}),"改脚本"]}),o.jsxs("button",{type:"button",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"bug_report"}),"修复报错"]})]})]}),o.jsxs("label",{className:"af-node-studio-prompt",children:[o.jsx("span",{children:"需求"}),o.jsx("textarea",{value:p,onChange:_=>h(_.target.value)})]}),o.jsxs("button",{type:"button",className:"af-node-studio-send",onClick:F,disabled:f,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:f?"sync":"send"}),f?"Saving":"Send"]})]}),o.jsxs("section",{className:"af-node-studio-preview","aria-label":"Preview and Test",children:[o.jsxs("div",{className:"af-node-studio-panel-head",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"view_in_ar"}),o.jsx("strong",{children:"Preview / Test"})]}),o.jsxs("div",{className:"af-node-studio-preview-grid",children:[o.jsx("div",{className:"af-node-studio-preview-stage",children:e?j==="schedule"?o.jsxs("div",{className:"af-node-preview-card",children:[o.jsxs("div",{className:"af-node-preview-card__head",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:N}),o.jsx("strong",{children:g.title||y.name||"Untitled Node"}),o.jsx("code",{children:jC(g)})]}),o.jsxs("label",{className:"af-node-preview-toggle",children:[o.jsx("input",{type:"checkbox",checked:A,onChange:_=>V(_.target.checked)}),o.jsx("span",{children:A?"定时开启":"定时关闭"})]}),o.jsxs("div",{className:"af-node-preview-fields",children:[o.jsxs("label",{children:[o.jsx("span",{children:"频率"}),o.jsxs("select",{value:v.scheduleType||"daily",onChange:_=>D({config:{scheduleType:_.target.value}}),children:[o.jsx("option",{value:"daily",children:"每天"}),o.jsx("option",{value:"weekly",children:"每周"})]})]}),o.jsxs("label",{children:[o.jsx("span",{children:"时间"}),o.jsxs("div",{children:[o.jsxs("select",{value:v.hour||"09",onChange:_=>D({config:{hour:_.target.value}}),children:[o.jsx("option",{children:"09"}),o.jsx("option",{children:"10"})]}),o.jsxs("select",{value:v.minute||"00",onChange:_=>D({config:{minute:_.target.value}}),children:[o.jsx("option",{children:"00"}),o.jsx("option",{children:"30"})]})]})]})]}),o.jsxs("div",{className:"af-node-preview-meta",children:[o.jsxs("span",{children:[v.scheduleType==="weekly"?"每周":"每天"," ",v.hour||"09",":",v.minute||"00"]}),o.jsx("span",{children:"Next -"}),o.jsx("span",{children:A?"enabled":"disabled"})]}),o.jsxs("div",{className:"af-node-preview-actions",children:[o.jsxs("button",{type:"button",className:"af-node-preview-run",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"play_arrow"}),"立即运行"]}),o.jsxs("button",{type:"button",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"article"}),"日志"]})]})]}):o.jsxs("div",{className:"af-node-preview-card af-node-preview-card--default",children:[o.jsxs("div",{className:"af-node-preview-card__head",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:N}),o.jsx("strong",{children:g.title||y.name||"Untitled Node"}),o.jsx("code",{children:jC(g)})]}),o.jsxs("div",{className:"af-node-preview-default-body",children:[o.jsx("p",{children:y.description||"这个节点还没有描述。AI 生成 runtime、prompt 或 script 后,内部信息会显示在右侧。"}),o.jsxs("div",{children:[o.jsxs("span",{children:[Array.isArray(y.inputs)?y.inputs.length:0," inputs"]}),o.jsxs("span",{children:[Array.isArray(y.outputs)?y.outputs.length:0," outputs"]}),o.jsx("span",{children:((B=y.runtime)==null?void 0:B.type)||y.baseDefinitionId||"agent_subAgent"})]})]})]}):o.jsxs("div",{className:"af-node-preview-empty",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add_box"}),o.jsx("strong",{children:"暂无预览"}),o.jsx("p",{children:"先在左侧描述你要创建的节点,AI 生成 draft 后这里会展示节点卡片。"})]})}),o.jsxs("div",{className:"af-node-studio-test",children:[o.jsxs("div",{className:"af-node-studio-subhead",children:[o.jsx("strong",{children:"Test Inputs"}),o.jsxs("button",{type:"button",onClick:H,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:s?"sync":"play_arrow"}),"Run"]})]}),o.jsxs("div",{className:"af-node-studio-inputs",children:[o.jsxs("label",{children:[o.jsx("span",{children:"project"}),o.jsx("input",{value:b.project||"",readOnly:!0,placeholder:"-"})]}),o.jsxs("label",{children:[o.jsx("span",{children:"date"}),o.jsx("input",{value:b.date||"",readOnly:!0,placeholder:"-"})]})]}),o.jsx("div",{className:"af-node-studio-log",children:(s?["running..."]:C.length?C:["No test run yet."]).map((_,X)=>o.jsx("span",{children:_},`${_}-${X}`))})]})]})]}),o.jsxs("aside",{className:"af-node-studio-internals","aria-label":"Internals",children:[o.jsxs("div",{className:"af-node-studio-panel-head",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"fact_check"}),o.jsx("strong",{children:"Internals"})]}),o.jsx("div",{className:"af-node-studio-tabs",role:"tablist","aria-label":"Internals sections",children:k.map(_=>o.jsxs("button",{type:"button",className:_.id===n?"af-node-studio-tab af-node-studio-tab--active":"af-node-studio-tab",onClick:()=>r(_.id),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:_.icon}),_.label]},_.id))}),o.jsx("div",{className:"af-node-studio-internal-list",children:w.rows.map(([_,X])=>o.jsxs("div",{className:"af-node-studio-internal-row",children:[o.jsx("span",{children:_}),o.jsx("strong",{children:X})]},_))}),o.jsx("pre",{className:"af-node-studio-code",children:w.id==="ui"?JSON.stringify(y.ui||{},null,2):w.id==="contract"?JSON.stringify({inputs:y.inputs||[],outputs:y.outputs||[],configSchema:y.configSchema||{}},null,2):w.id==="tests"?JSON.stringify((g==null?void 0:g.test)||{},null,2):JSON.stringify({runtime:y.runtime||{},files:(g==null?void 0:g.files)||{}},null,2)})]})]})]})}function Fre(){return`ws_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`}function zre(e){return/^[A-Za-z_][A-Za-z0-9_]*$/.test(String(e||"").trim())}function Vp(e){const t=String(e||"").trim();if(!t)return"";let n=t;try{n=new URL(t).pathname}catch{n=t.split("?")[0].split("#")[0]}return(n.replace(/\/+$/,"").split("/").filter(Boolean).pop()||"").replace(/\.git$/i,"").replace(/[^A-Za-z0-9._-]+/g,"_").replace(/^_+|_+$/g,"")}function Bre(e={},t={}){return`${String(e.mountPath||t.mountPath||e.label||t.label||e.id||t.id||"workspace").trim().toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"").slice(0,48)||"WORKSPACE"}_GIT_TOKEN`}function zy(){return{id:"",label:"",kind:"git",path:"",repoUrl:"",branch:"master",mountPath:"",credentialRef:"",type:"code",description:"",enabled:!0}}function mp(e={}){return{id:String((e==null?void 0:e.id)||""),label:String((e==null?void 0:e.label)||(e==null?void 0:e.name)||""),kind:(e==null?void 0:e.kind)==="local"?"local":"git",path:String((e==null?void 0:e.path)||""),repoUrl:String((e==null?void 0:e.repoUrl)||""),branch:String((e==null?void 0:e.branch)||"master"),mountPath:String((e==null?void 0:e.mountPath)||""),credentialRef:String((e==null?void 0:e.credentialRef)||""),type:String((e==null?void 0:e.type)||((e==null?void 0:e.kind)==="local"?"local":"code")),description:String((e==null?void 0:e.description)||""),enabled:(e==null?void 0:e.enabled)!==!1}}function Hre(e){const t=e.kind==="local"?"local":"git",n=t==="git"?String(e.repoUrl||"").trim():"",r=t==="git"?String(e.mountPath||Vp(n)||"").trim():"";return{id:String(e.id||"").trim(),label:String(e.label||"").trim(),kind:t,path:String(e.path||"").trim(),repoUrl:n,branch:t==="git"?String(e.branch||"master").trim()||"master":"",mountPath:r,credentialRef:t==="git"?String(e.credentialRef||"").trim():"",type:String(e.type||(t==="local"?"local":"code")).trim(),description:String(e.description||"").trim(),enabled:e.enabled!==!1}}function Li(e,t=0){return(e==null?void 0:e.id)||(e==null?void 0:e.path)||(e==null?void 0:e.repoUrl)||`workspace-${t}`}function Wre({ok:e}){return o.jsx("span",{className:"af-workspaces-dot"+(e?" af-workspaces-dot--ok":""),"aria-hidden":!0})}function CC({item:e,selected:t,onClick:n,readOnly:r}){return o.jsxs("button",{type:"button",className:"af-workspaces-card"+(t?" af-workspaces-card--selected":""),onClick:n,children:[o.jsxs("div",{className:"af-workspaces-card__head",children:[o.jsx("strong",{children:e.label||"知识库"}),o.jsx("span",{children:e.kind==="git"?"Git":"Local"})]}),o.jsx("p",{children:e.description||e.repoUrl||e.path||"-"}),o.jsxs("div",{className:"af-workspaces-card__meta",children:[o.jsx(Wre,{ok:e.exists!==!1}),o.jsx("span",{children:e.exists===!1?"路径未就绪":"路径可用"}),r?o.jsx("em",{children:"内置"}):e.enabled===!1?o.jsx("em",{children:"disabled"}):null]})]})}function Vre(){const[e,t]=m.useState(!1),[n,r]=m.useState(!1),[s,i]=m.useState(!1),[a,l]=m.useState(""),[c,u]=m.useState(""),[f,d]=m.useState(""),[p,h]=m.useState([]),[g,k]=m.useState([]),[w,y]=m.useState(zy),[v,b]=m.useState(""),[C,N]=m.useState([]),[j,A]=m.useState(""),I=m.useMemo(()=>g.findIndex((z,T)=>Li(z,T)===j),[g,j]),H=!!m.useMemo(()=>p.find((z,T)=>Li(z,T)===j)||null,[p,j]),V=m.useMemo(()=>{const z=String(w.credentialRef||"").trim();return z?C.some(T=>String((T==null?void 0:T.key)||"").trim()===z&&String((T==null?void 0:T.value)??"")!==""):!1},[w.credentialRef,C]),F=m.useCallback(async()=>{t(!0),l("");try{const[z,T]=await Promise.all([fetch("/api/workspaces"),fetch("/api/user-env")]),Z=await z.json().catch(()=>({})),ae=await T.json().catch(()=>({}));if(!T.ok)throw new Error(typeof ae.error=="string"?ae.error:"ENV HTTP "+T.status);if(!z.ok)throw new Error(typeof Z.error=="string"?Z.error:"HTTP "+z.status);const J=Array.isArray(Z.workspaces)?Z.workspaces:[],se=Array.isArray(Z.customWorkspaces)?Z.customWorkspaces:[];d(String(Z.path||"")),h(J.filter(ee=>ee==null?void 0:ee.builtin)),k(se),N(Array.isArray(ae.env)?ae.env.map(ee=>({key:String((ee==null?void 0:ee.key)||""),value:String((ee==null?void 0:ee.value)??"")})):[])}catch(z){l(String(z.message||z))}finally{t(!1)}},[]);m.useEffect(()=>{F()},[F]);const L=m.useCallback(async(z,T="")=>{r(!0),l(""),u("");try{const Z=await fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaces:z})}),ae=await Z.json().catch(()=>({}));if(!Z.ok)throw new Error(typeof ae.error=="string"?ae.error:"HTTP "+Z.status);const J=Array.isArray(ae.customWorkspaces)?ae.customWorkspaces:z;k(J),h((Array.isArray(ae.workspaces)?ae.workspaces:[]).filter(se=>se==null?void 0:se.builtin)),d(String(ae.path||f)),T&&A(T),u("已保存")}catch(Z){l(String(Z.message||Z))}finally{r(!1)}},[f]),M=m.useCallback(()=>{A(""),y(zy()),b(""),u(""),l("")},[]),K=m.useCallback((z,T)=>{A(Li(z,T)),y(mp(z)),b(""),u("")},[]),W=m.useCallback((z,T)=>{A(Li(z,T)),y(mp(z)),b(""),u("")},[]),$=m.useCallback(async(z,T)=>{const Z=String(z||"").trim(),ae=String(T??"");if(!Z||!ae)return;const J=C.filter(re=>String((re==null?void 0:re.key)||"").trim()!==Z);J.push({key:Z,value:ae});const se=await fetch("/api/user-env",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:J})}),ee=await se.json().catch(()=>({}));if(!se.ok)throw new Error(typeof ee.error=="string"?ee.error:"ENV HTTP "+se.status);N(Array.isArray(ee.env)?ee.env.map(re=>({key:String((re==null?void 0:re.key)||""),value:String((re==null?void 0:re.value)??"")})):J)},[C]),R=m.useCallback(()=>{const z=Hre({...w,id:w.id||Fre()}),T=v.trim();if(z.kind==="git"&&T&&!z.credentialRef&&(z.credentialRef=Bre(w,z)),z.kind==="local"&&!z.path){l("本地知识库需要填写路径");return}if(z.kind==="git"&&!z.repoUrl){l("Git 知识库需要填写 repoUrl");return}if(!z.label){l("请填写名称");return}if(z.kind==="git"&&z.credentialRef&&!zre(z.credentialRef)){l("凭证环境变量只能使用字母、数字和下划线,且不能以数字开头");return}const Z=I>=0?g.map((ae,J)=>J===I?z:ae):[z,...g];y(mp(z)),(async()=>{r(!0);try{T&&await $(z.credentialRef,T),b(""),await L(Z,Li(z))}catch(ae){l(String(ae.message||ae)),r(!1)}})()},[g,w,L,$,I,v]),B=m.useCallback(()=>{if(I<0)return;const z=g.filter((T,Z)=>Z!==I);y(zy()),A(""),L(z)},[g,L,I]),_=m.useCallback(async()=>{if(!H){if(I<0||!w.id){l("请先保存知识库配置,再拉取更新");return}if(w.kind!=="git"){l("只有 Git 知识库支持拉取更新");return}i(!0),l(""),u("");try{const z=await fetch("/api/workspaces/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:w.id})}),T=await z.json().catch(()=>({}));if(!z.ok)throw new Error(typeof T.error=="string"?T.error:"HTTP "+z.status);const Z=Array.isArray(T.customWorkspaces)?T.customWorkspaces:g;k(Z),h((Array.isArray(T.workspaces)?T.workspaces:[]).filter(se=>se==null?void 0:se.builtin));const ae=Z.find(se=>String((se==null?void 0:se.id)||"")===String(w.id||""));ae&&y(mp(ae));const J=String(T.commit||"").trim();u(T.changed?`已拉取更新${J?`:${J.slice(0,8)}`:""}`:`已是最新${J?`:${J.slice(0,8)}`:""}`)}catch(z){l(String(z.message||z))}finally{i(!1)}}},[g,w,H,I]),X=m.useCallback(z=>{y(T=>({...T,...z}))},[]);return o.jsxs("div",{className:"af-workspaces-page",children:[o.jsxs("header",{className:"af-settings-top",children:[o.jsxs("div",{className:"af-settings-crumb","aria-label":"知识库",children:[o.jsx("span",{className:"af-settings-crumb-muted",children:"AgentFlow"}),o.jsx("span",{className:"af-settings-crumb-sep","aria-hidden":!0,children:"/"}),o.jsx("span",{className:"af-settings-crumb-active",children:"知识库"})]}),o.jsxs("button",{type:"button",className:"af-schedules-refresh",onClick:F,disabled:e,children:[o.jsx("span",{className:"material-symbols-outlined",children:"refresh"}),"刷新"]})]}),o.jsx("main",{className:"af-settings-body",children:o.jsxs("div",{className:"af-workspaces-inner",children:[o.jsxs("header",{className:"af-settings-hero",children:[o.jsx("h1",{className:"af-settings-h1",children:"知识库"}),o.jsx("p",{className:"af-settings-lead",children:"维护可被加载知识库、一键任务和后续 Agent 使用的只读上下文源。Git 字段与 mengmai 的资源配置保持一致。"}),f?o.jsxs("p",{className:"af-workspaces-config",children:["配置文件:",f]}):null,a?o.jsx("p",{className:"af-err af-settings-api-hint",children:a}):null,c?o.jsx("p",{className:"af-workspaces-status",children:c}):null]}),o.jsxs("section",{className:"af-workspaces-summary",children:[o.jsxs("div",{children:[o.jsx("span",{children:"内置"}),o.jsx("strong",{children:p.length})]}),o.jsxs("div",{children:[o.jsx("span",{children:"自定义"}),o.jsx("strong",{children:g.length})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Git"}),o.jsx("strong",{children:g.filter(z=>z.kind==="git").length})]})]}),o.jsxs("div",{className:"af-workspaces-layout",children:[o.jsxs("section",{className:"af-workspaces-list",children:[o.jsxs("div",{className:"af-workspaces-section-head",children:[o.jsx("h2",{children:"自定义知识库"}),o.jsxs("button",{type:"button",onClick:M,children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),"新增"]})]}),g.length?g.map((z,T)=>o.jsx(CC,{item:z,selected:Li(z,T)===j,onClick:()=>K(z,T)},Li(z,T))):o.jsx("div",{className:"af-workspaces-empty",children:"暂无自定义知识库。新增 Git 或本地目录后,画布里的加载知识库和一键任务就可以选择它。"}),o.jsx("div",{className:"af-workspaces-section-head af-workspaces-section-head--sub",children:o.jsx("h2",{children:"内置知识库"})}),p.map((z,T)=>o.jsx(CC,{item:z,selected:Li(z,T)===j,onClick:()=>W(z,T),readOnly:!0},Li(z,T)))]}),o.jsxs("section",{className:"af-workspaces-editor",children:[o.jsxs("div",{className:"af-workspaces-editor__head",children:[o.jsxs("div",{children:[o.jsx("h2",{children:H?"查看内置知识库":I>=0?"编辑知识库":"新增知识库"}),o.jsx("p",{children:H?"内置项由当前运行环境提供,不能在这里修改。":"本地路径用于读取上下文,Git 字段用于后续同步和上下文挂载。"})]}),o.jsxs("label",{className:"af-workspaces-switch",children:[o.jsx("input",{type:"checkbox",checked:w.enabled!==!1,disabled:H,onChange:z=>X({enabled:z.target.checked})}),o.jsx("span",{children:"启用"})]})]}),o.jsxs("div",{className:"af-workspaces-kind",children:[o.jsxs("button",{type:"button",className:w.kind==="git"?"active":"",disabled:H,onClick:()=>X({kind:"git",type:w.type==="local"?"code":w.type}),children:[o.jsx("span",{className:"material-symbols-outlined",children:"account_tree"}),"Git"]}),o.jsxs("button",{type:"button",className:w.kind==="local"?"active":"",disabled:H,onClick:()=>X({kind:"local",type:"local"}),children:[o.jsx("span",{className:"material-symbols-outlined",children:"folder_open"}),"本地目录"]})]}),o.jsxs("div",{className:"af-workspaces-form",children:[o.jsxs("label",{children:[o.jsx("span",{children:"名称"}),o.jsx("input",{value:w.label,disabled:H,onChange:z=>X({label:z.target.value}),placeholder:"Likee Android"})]}),o.jsxs("label",{children:[o.jsx("span",{children:"类型"}),o.jsxs("select",{value:w.type,disabled:H,onChange:z=>X({type:z.target.value}),children:[o.jsx("option",{value:"code",children:"code"}),o.jsx("option",{value:"docs",children:"docs"}),o.jsx("option",{value:"analytics",children:"analytics"}),o.jsx("option",{value:"config",children:"config"}),o.jsx("option",{value:"local",children:"local"}),o.jsx("option",{value:"other",children:"other"})]})]}),o.jsxs("label",{className:"af-workspaces-form__wide",children:[o.jsx("span",{children:"本地路径"}),o.jsx("input",{value:w.path,disabled:H,onChange:z=>X({path:z.target.value}),placeholder:w.kind==="git"?"可空,默认保存到全局资源目录/repos/<仓库名>":"/Users/.../project"})]}),w.kind==="git"?o.jsxs(o.Fragment,{children:[o.jsxs("label",{className:"af-workspaces-form__wide",children:[o.jsx("span",{children:"Git URL"}),o.jsx("input",{value:w.repoUrl,disabled:H,onChange:z=>{const T=z.target.value,Z=Vp(w.repoUrl),ae=String(w.mountPath||"").trim();X({repoUrl:T,...!ae||ae===Z?{mountPath:Vp(T)}:{}})},placeholder:"https://git.example.com/group/repo.git"})]}),o.jsxs("label",{children:[o.jsx("span",{children:"分支"}),o.jsx("input",{value:w.branch,disabled:H,onChange:z=>X({branch:z.target.value}),placeholder:"master"})]}),o.jsxs("label",{children:[o.jsx("span",{children:"挂载目录"}),o.jsx("input",{value:w.mountPath,disabled:H,onChange:z=>X({mountPath:z.target.value}),placeholder:Vp(w.repoUrl)||"repo_name"})]}),o.jsxs("label",{className:"af-workspaces-form__wide",children:[o.jsx("span",{children:"凭证环境变量"}),o.jsx("input",{value:w.credentialRef,disabled:H,onChange:z=>X({credentialRef:z.target.value}),placeholder:"LIKEE_GIT_READONLY_TOKEN"})]}),o.jsxs("label",{className:"af-workspaces-form__wide",children:[o.jsx("span",{children:"Token"}),o.jsx("input",{type:"password",value:v,disabled:H,onChange:z=>b(z.target.value),placeholder:V?"已在个人环境变量中配置;留空则不修改":"保存到个人环境变量,不写入 workspace 配置"}),o.jsx("small",{children:"保存后只在知识库配置中保留 credentialRef,token 会写入当前用户的个人环境变量。"})]})]}):null,o.jsxs("label",{className:"af-workspaces-form__wide",children:[o.jsx("span",{children:"说明"}),o.jsx("textarea",{value:w.description,disabled:H,onChange:z=>X({description:z.target.value}),placeholder:"这个知识库包含哪些代码、文档或需求上下文"})]})]}),o.jsxs("div",{className:"af-workspaces-actions",children:[!H&&I>=0?o.jsxs("button",{type:"button",className:"af-workspaces-danger",onClick:B,disabled:n||s,children:[o.jsx("span",{className:"material-symbols-outlined",children:"delete"}),"删除"]}):o.jsx("span",{}),o.jsxs("div",{children:[w.kind==="git"&&I>=0?o.jsxs("button",{type:"button",onClick:_,disabled:H||n||s,children:[o.jsx("span",{className:"material-symbols-outlined",children:s?"sync":"download"}),s?"拉取中":"拉取更新"]}):null,o.jsx("button",{type:"button",onClick:M,disabled:n||s,children:"重置"}),o.jsxs("button",{type:"button",className:"af-workspaces-primary",onClick:R,disabled:H||n||s,children:[o.jsx("span",{className:"material-symbols-outlined",children:"save"}),n?"保存中":"保存"]})]})]})]})]})]})})]})}const Kre=[{icon:"campaign",title:"首页 Feed 想加一个广告引导",question:"先判断入口、展示位、用户影响面,再决定弹框、浮层还是页面内引导。",context:["查客户端展示位逻辑","查历史需求与配置","查 m09 / Feed PV"],result:"原型 + PRD + TAPD 更新",tone:"pink"},{icon:"manage_search",title:"接到需求但不知道现有逻辑",question:"不用先找研发问一圈,直接从 Likee 代码、知识库、历史文档里拿上下文。",context:["客户端 / 后台 / 前端知识库","接口与配置链路","相关 Git 文档"],result:"背景结论 + 影响范围",tone:"cyan"},{icon:"query_stats",title:"运营要评估活动或入口价值",question:"先查人群规模、页面访问、历史转化,避免凭经验拍优先级。",context:["CK / Hive 查数","自动生成 SQL","指标口径解释"],result:"数据表 + 图表 + 结论",tone:"green"},{icon:"draw",title:"想快速把方案画给团队看",question:"把一句需求变成客户端或 H5 原型,让评审时先讨论体验,不只讨论文字。",context:["Likee 客户端样式","前端页面结构","交互状态与文案"],result:"HTML 原型 + Display 面板",tone:"amber"},{icon:"sync_alt",title:"需求写完后需要同步多个地方",question:"PRD、TAPD、Git 仓库和评审展示保持一致,减少重复复制和漏改。",context:["需求正文","变更记录","MR / 仓库路径"],result:"TAPD 更新 + Git 提交",tone:"violet"},{icon:"monitoring",title:"上线后要看效果和复盘",question:"沿用需求阶段的口径继续查数,把结果沉淀回下一轮需求线索。",context:["上线后 CK / Hive","分页面 / 分人群指标","实验和版本信息"],result:"复盘结论 + 后续建议",tone:"blue"}],Ure=[{label:"Use Case 01",title:"Likee 客户端知识库查询(如广告占位)",images:["/likee-context/usecase-ad-query.png"],trigger:"产品或运营想确认客户端已有逻辑,例如 Likee Android 里有哪些广告占位,以及相关常量和代码位置。",steps:["在「我的流程」加载 Likee Android 流程片段","在子 Agent 节点输入客户端逻辑问题","点击 Run Line,只执行当前链路","在右侧 Markdown Display 查看知识库查询结果"],outputs:["SETTING_ID / PAGE_ID 表格","客户端代码路径与口径说明","可继续用于 PRD 的背景材料"]},{label:"Use Case 02",title:"客户端原型设计",images:["/likee-context/usecase-prototype.png"],trigger:"业务已经明确要在 Likee 首页加入广告引导,需要先把弹框体验画出来给产品、设计、研发评审。",steps:["在 Workspace 打开原型生成流程","加载客户端原型 Skill","在子 Agent 中说明生成一个首页 dialog 弹框","查看 HTML Display 中的手机预览稿"],outputs:["Likee 风格手机原型","弹框文案与按钮状态","可直接用于评审的 Display 面板"]},{label:"Use Case 03",title:"前端 H5 原型设计",images:["/likee-context/usecase-h5-prototype.png"],trigger:"运营活动需要快速产出 Likee 风格 H5 页面,例如幸运转盘、积分排行榜、活动首页或结果页。",steps:["在 Workspace 打开 H5 原型生成流程","加载前端 H5 原型相关 Skill","在子 Agent 中说明活动结构、页面模块和运营规则","查看 HTML Display 中的可交互 H5 原型"],outputs:["Likee 风格 H5 页面","抽奖转盘与排行榜布局","活动规则和状态页","可用于评审的 HTML Display"]},{label:"Use Case 04",title:"CK / Hive 查数与 SQL 生成",images:["/likee-context/usecase-data-query.png"],trigger:"运营或产品需要快速验证一个数据问题,例如找出典型 UID、对比不同日期的视频上传分辨率占比,并保留可复用 SQL。",steps:["在 Workspace 打开查数流程","加载查数相关 Skill","在子 Agent 中说明数据口径、日期和筛选条件","查看 Markdown Display 中的数据结果和查询 SQL"],outputs:["查询结果表格","SQL 语句","口径说明","可继续接入 PRD 或复盘面板的数据结论"]},{label:"Use Case 05",title:"需求文档生成、数据补齐与同步",images:["/likee-context/usecase-prd.png","/likee-context/usecase-sync.png"],trigger:"需求进入评审和落库阶段,需要把 TAPD 信息、Hive 数据、原型内容组织成 PRD,并同步到 TAPD 和 Git 仓库。",steps:["先运行 TAPD / 数据查询节点,拿到迭代、页面 PV 和业务背景","把查询结果和原型 Display 内容接入 PRD 生成子 Agent","在 Markdown Display 查看完整需求文档","把 PRD content 接入 TAPD 更新节点和 Git 仓库提交节点"],outputs:["完整 PRD 文档","项目背景与 Top 页面数据","TAPD 需求更新成功","Git MR 链接"]},{label:"Use Case 06",title:"Display 模式做需求评审面板",images:["/likee-context/usecase-display.png"],trigger:"流程跑完后,需要把 PRD、原型、数据图表、展示位表格放在一个页面里给产品、运营、研发一起看。",steps:["在 Workspace 中完成查数、原型、PRD、同步节点执行","确认 Markdown / HTML / 图表 / 表格展示节点都有结果","切换顶部 DISPLAY 模式","使用生成链接把评审面板发给相关同学"],outputs:["PRD 长文档","客户端原型预览","图表与表格","统一展示链接"]}],qre=[{name:"likee-client-ui",namespace:"智能助手 / 客户端原型",icon:"phone_iphone",mode:"客户端原型设计",usage:"生成 Likee 客户端风格页面、弹框、Feed 引导、个人页、活动入口等原型,适合产品评审前快速对齐体验。",examples:["首页 dialog 弹框","Feed 内引导","客户端红色主品牌视觉","移动端交互态"],tone:"pink"},{name:"tapd-likee",namespace:"智能助手 / TAPD",icon:"sync",mode:"需求系统交互",usage:"和 TAPD 交互,支持创建、同步、更新需求,把工作区生成的 PRD 或 Markdown 内容回写到需求系统。",examples:["创建 TAPD 需求","更新需求正文","同步处理人和链接","把结果回显到 Display"],tone:"green"},{name:"plain-language-response",namespace:"智能助手 / 回答风格",icon:"record_voice_over",mode:"业务化回答",usage:"用于把回答收敛成产品、运营更容易阅读的解释,避免直接把客户端代码库细节、函数调用链和实现细节暴露太多。",examples:["需求背景解释","代码结论转业务语言","评审材料摘要","减少实现细节噪音"],tone:"cyan"},{name:"create-likee-h5-style-html",namespace:"智能助手 / 前端 H5",icon:"language",mode:"H5 原型设计",usage:"创建 Likee H5 风格原型,适合运营活动、抽奖、排行榜、报告页、反馈表单、创作者认证页、订单列表等页面。",examples:["幸运转盘活动","积分排行榜","活动规则页","结果页和空状态"],tone:"amber"},{name:"analytics",namespace:"数据 / CK & Hive",icon:"query_stats",mode:"查数和 SQL 生成",usage:"面向 CK、Hive 的指标查询和 SQL 生成,适合 PV、UV、转化、分国家、分实验组、典型 UID 等数据问题。",examples:["自动生成 SQL","输出查询结果表","解释指标口径","沉淀复盘数据"],tone:"green"}],Yre=[["知识库","查客户端、后台、前端逻辑","广告、Feed、会员、增长、配置、接口调用链"],["数据","查 CK / Hive 并输出 SQL","PV、UV、转化、分页面、分国家、分实验组"],["产物","生成原型、PRD、Display 面板","Markdown、HTML 原型、图表、表格、交互预览"],["协作","同步 TAPD 与 Git 仓库","需求正文、变更记录、MR 链接、评审材料"]];function gp({icon:e,title:t,label:n,tone:r="violet"}){return o.jsxs("div",{className:`likee-flow-node likee-flow-node-${r}`,children:[o.jsx("span",{className:"material-symbols-outlined",children:e}),o.jsxs("div",{children:[o.jsx("strong",{children:t}),o.jsx("small",{children:n})]})]})}function Gre(){return o.jsxs("div",{className:"likee-workspace-scene","aria-hidden":"true",children:[o.jsx("div",{className:"likee-scene-grid"}),o.jsxs("svg",{className:"likee-scene-lines",viewBox:"0 0 980 560",fill:"none",children:[o.jsx("path",{d:"M96 154 C236 96 330 122 444 194 C552 262 654 260 814 160"}),o.jsx("path",{d:"M118 350 C248 288 344 304 458 372 C578 444 704 420 858 310"}),o.jsx("path",{d:"M472 196 C512 248 524 302 486 372"}),o.jsx("path",{d:"M622 126 C670 198 696 258 682 354"})]}),o.jsx("div",{className:"likee-node-pos likee-node-a",children:o.jsx(gp,{icon:"travel_explore",title:"全局上下文",label:"Likee 业务、代码、数据",tone:"pink"})}),o.jsx("div",{className:"likee-node-pos likee-node-b",children:o.jsx(gp,{icon:"database",title:"CK / Hive",label:"自动 SQL 与指标口径",tone:"cyan"})}),o.jsx("div",{className:"likee-node-pos likee-node-c",children:o.jsx(gp,{icon:"article",title:"需求文档",label:"PRD、变更说明、评审稿",tone:"amber"})}),o.jsx("div",{className:"likee-node-pos likee-node-d",children:o.jsx(gp,{icon:"sync_alt",title:"TAPD / Git",label:"同步需求与版本资产",tone:"green"})}),o.jsxs("div",{className:"likee-phone-preview",children:[o.jsxs("div",{className:"likee-phone-top",children:[o.jsx("span",{children:"关注"}),o.jsx("strong",{children:"推荐"}),o.jsx("span",{children:"直播"})]}),o.jsxs("div",{className:"likee-phone-card",children:[o.jsx("div",{className:"likee-gift",children:"AD"}),o.jsx("h4",{children:"广告个性化引导弹框"}),o.jsx("p",{children:"保持推荐体验,同时解释权益与关闭路径。"}),o.jsx("button",{children:"继续"}),o.jsx("button",{className:"secondary",children:"稍后"})]})]}),o.jsxs("div",{className:"likee-display-panel",children:[o.jsxs("div",{className:"likee-panel-header",children:[o.jsx("span",{children:"DISPLAY"}),o.jsx("strong",{children:"需求资产面板"})]}),o.jsxs("div",{className:"likee-table-row",children:[o.jsx("span",{children:"需求"}),o.jsx("strong",{children:"首页广告个性化引导"})]}),o.jsxs("div",{className:"likee-table-row",children:[o.jsx("span",{children:"数据"}),o.jsx("strong",{children:"m09 PV Top 1"})]}),o.jsxs("div",{className:"likee-table-row",children:[o.jsx("span",{children:"同步"}),o.jsx("strong",{children:"TAPD + Git MR"})]})]})]})}function Kp({kicker:e,title:t,children:n}){return o.jsxs("div",{className:"likee-section-copy",children:[o.jsx("p",{className:"likee-section-kicker",children:e}),o.jsx("h2",{children:t}),o.jsx("p",{children:n})]})}function Jre(){return o.jsx("section",{id:"likee-skills",className:"likee-section likee-section-dark",children:o.jsxs("div",{className:"likee-section-inner likee-two-column likee-two-column-skills",children:[o.jsx(Kp,{kicker:"SKILLS",title:"用 Skills 把 Likee 上下文变成可复用能力",children:"Skills 是工作区里可加载的能力包。手动搭建工作区时,只需要按场景加载对应 Skill。"}),o.jsx("div",{className:"likee-skill-grid",children:qre.map(e=>o.jsxs("article",{className:`likee-skill-card likee-skill-${e.tone}`,children:[o.jsxs("div",{className:"likee-skill-head",children:[o.jsx("div",{className:"likee-skill-icon",children:o.jsx("span",{className:"material-symbols-outlined",children:e.icon})}),o.jsxs("div",{children:[o.jsx("h3",{children:e.name}),o.jsx("span",{children:e.namespace})]})]}),o.jsx("div",{className:"likee-skill-mode",children:e.mode}),o.jsx("p",{children:e.usage}),o.jsx("div",{className:"likee-skill-examples",children:e.examples.map(t=>o.jsx("strong",{children:t},t))})]},e.name))})]})})}function vT(){return o.jsxs("div",{className:"likee-page",children:[o.jsx("div",{className:"likee-top-actions",children:o.jsxs("a",{href:"/projects",className:"likee-home-link",children:[o.jsx("span",{className:"material-symbols-outlined",children:"arrow_back"}),"返回首页"]})}),o.jsxs("section",{className:"likee-hero",children:[o.jsx(Gre,{}),o.jsxs("div",{className:"likee-hero-content",children:[o.jsx("p",{className:"likee-eyebrow",children:"LIKEE CONTEXT WORKSPACE"}),o.jsx("h1",{children:"Likee Agent 工作台"}),o.jsx("p",{className:"likee-hero-subtitle",children:"提供 Likee 全局上下文,赋能需求挖掘、书写和运营。"}),o.jsxs("div",{className:"likee-signal-row",children:[o.jsx("span",{children:"查业务逻辑"}),o.jsx("span",{children:"查 CK / Hive"}),o.jsx("span",{children:"生成原型"}),o.jsx("span",{children:"生成 PRD"}),o.jsx("span",{children:"同步 TAPD / Git"})]}),o.jsxs("div",{className:"likee-hero-actions",children:[o.jsxs("a",{href:"/projects",className:"likee-primary-action",children:[o.jsx("span",{className:"material-symbols-outlined",children:"rocket_launch"}),"立即使用"]}),o.jsxs("a",{href:"#likee-scenarios",className:"likee-secondary-action",children:[o.jsx("span",{className:"material-symbols-outlined",children:"ads_click"}),"按场景查看"]}),o.jsxs("a",{href:"#likee-usecases",className:"likee-secondary-action",children:[o.jsx("span",{className:"material-symbols-outlined",children:"view_timeline"}),"查看 Use Cases"]}),o.jsxs("a",{href:"#likee-skills",className:"likee-secondary-action",children:[o.jsx("span",{className:"material-symbols-outlined",children:"extension"}),"查看 Skills"]})]})]})]}),o.jsx("section",{id:"likee-scenarios",className:"likee-section",children:o.jsxs("div",{className:"likee-section-inner",children:[o.jsx(Kp,{kicker:"SCENARIO TRIGGERS",title:"打造 Likee 团队全景上下文",children:"不要求先会写 Prompt,也不要求知道该找哪个系统。选择一个业务场景,工作台会把需要的 Likee 上下文、数据查询和最终产物组织起来。"}),o.jsx("div",{className:"likee-scenario-grid",children:Kre.map(e=>o.jsxs("article",{className:`likee-scenario-card likee-scenario-${e.tone}`,children:[o.jsx("div",{className:"likee-scenario-icon",children:o.jsx("span",{className:"material-symbols-outlined",children:e.icon})}),o.jsxs("div",{children:[o.jsx("h3",{children:e.title}),o.jsx("p",{children:e.question})]}),o.jsx("div",{className:"likee-scenario-context",children:e.context.map(t=>o.jsx("span",{children:t},t))}),o.jsxs("div",{className:"likee-scenario-result",children:[o.jsx("span",{children:"产出"}),o.jsx("strong",{children:e.result})]})]},e.title))})]})}),o.jsx("section",{id:"likee-usecases",className:"likee-section likee-section-muted",children:o.jsxs("div",{className:"likee-section-inner likee-two-column likee-usecase-layout",children:[o.jsx(Kp,{kicker:"USE CASES",title:"沉淀 Likee 业务流水线",children:"这里展示的是平台里实际可跑的工作流:加载流程片段,在子 Agent 或 Run 节点输入业务问题,执行当前 line,最终在 Display、TAPD 和 Git 中拿到结果。"}),o.jsx("div",{className:"likee-usecase-stack",children:Ure.map(e=>o.jsxs("article",{className:"likee-usecase-card",children:[o.jsx("div",{className:`likee-usecase-media ${e.images.length>1?"likee-usecase-media-split":""}`,children:e.images.map((t,n)=>o.jsx("img",{src:t,alt:`${e.title} 工作区截图 ${n+1}`,loading:"lazy"},t))}),o.jsxs("div",{className:"likee-usecase-body",children:[o.jsx("div",{className:"likee-usecase-label",children:e.label}),o.jsx("h3",{children:e.title}),o.jsx("p",{children:e.trigger}),o.jsx("ol",{className:"likee-usecase-steps",children:e.steps.map(t=>o.jsx("li",{children:t},t))}),o.jsxs("div",{className:"likee-usecase-output",children:[o.jsx("span",{children:"实际产物"}),o.jsx("div",{children:e.outputs.map(t=>o.jsx("strong",{children:t},t))})]})]})]},e.label))})]})}),o.jsx(Jre,{}),o.jsx("section",{className:"likee-section",children:o.jsxs("div",{className:"likee-section-inner likee-two-column likee-capability-layout",children:[o.jsx(Kp,{kicker:"CAPABILITY MAP",title:"每个场景背后,都连接同一套 Likee 上下文能力",children:"工作台把知识库、CK / Hive、原型、PRD、TAPD 和 Git 放到同一条链路里。用户看到的是业务场景,系统处理的是上下文、产物和同步。"}),o.jsx("div",{className:"likee-capability-table",children:Yre.map(([e,t,n])=>o.jsxs("div",{className:"likee-capability-row",children:[o.jsx("span",{children:e}),o.jsx("strong",{children:t}),o.jsx("p",{children:n})]},e))})]})})]})}function ST(e){return t=>typeof t===e}var Xre=ST("function"),Qre=e=>e===null,_C=e=>Object.prototype.toString.call(e).slice(8,-1)==="RegExp",EC=e=>!Zre(e)&&!Qre(e)&&(Xre(e)||typeof e=="object"),Zre=ST("undefined");function ese(e,t,n){return ase(n,e,t)?!0:(lse(n,e,t),e.constructor!==t.constructor?!1:Array.isArray(e)&&Array.isArray(t)?tse(e,t,n):e instanceof Map&&t instanceof Map?sse(e,t,n):e instanceof Set&&t instanceof Set?ose(e,t):e instanceof WeakMap||e instanceof WeakSet?!1:ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)?nse(e,t):_C(e)&&_C(t)?e.source===t.source&&e.flags===t.flags:e instanceof Error&&t instanceof Error?rse(e,t,n):e.valueOf!==Object.prototype.valueOf?e.valueOf()===t.valueOf():e.toString!==Object.prototype.toString?e.toString()===t.toString():ise(e,t,n))}function Kd(e,t,n){return e===t||Number.isNaN(e)&&Number.isNaN(t)?!0:!e||!EC(e)||!t||!EC(t)?!1:ese(e,t,n)}function tse(e,t,n){const{length:r}=e;if(r!==t.length)return!1;for(let s=r;s--!==0;)if(!Kd(e[s],t[s],n))return!1;return!0}function nse(e,t){if(e.byteLength!==t.byteLength)return!1;const n=new DataView(e.buffer),r=new DataView(t.buffer);let s=e.byteLength;for(;s--;)if(n.getUint8(s)!==r.getUint8(s))return!1;return!0}function rse(e,t,n){return e.message===t.message&&e.name===t.name&&Kd(e.cause,t.cause,n)}function sse(e,t,n){if(e.size!==t.size)return!1;for(const r of e.entries())if(!t.has(r[0]))return!1;for(const r of e.entries())if(!Kd(r[1],t.get(r[0]),n))return!1;return!0}function ise(e,t,n){const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(let s=r.length;s--!==0;)if(!Object.prototype.hasOwnProperty.call(t,r[s]))return!1;for(let s=r.length;s--!==0;){const i=r[s];if(!(i==="_owner"&&e.$$typeof)&&!Kd(e[i],t[i],n))return!1}return!0}function ose(e,t){if(e.size!==t.size)return!1;for(const n of e.entries())if(!t.has(n[0]))return!1;return!0}function ase(e,t,n){var r;return((r=e.get(t))==null?void 0:r.has(n))??!1}function lse(e,t,n){let r=e.get(t);r||(r=new WeakSet,e.set(t,r)),r.add(n)}function Ok(e,t){return Kd(e,t,new WeakMap)}function By(){var e;return!!(typeof window<"u"&&((e=window==null?void 0:window.document)!=null&&e.createElement))}function cse(e,...t){e&&e.removeEventListener&&e.removeEventListener(...t)}function use(e,...t){e&&e.addEventListener&&e.addEventListener(...t)}function dse(){const e=m.useRef(!0);return e.current?(e.current=!1,!0):e.current}function fse(e,t){const n=dse();m.useEffect(()=>{if(!n)return e()},t)}function NT(e){const t=m.useRef(void 0);return m.useEffect(()=>{t.current=e}),t.current}function pse(e,t){const n=m.useRef(t);return Ok(t,n.current)||(n.current=t),m.useMemo(e,n.current)}function hse(e){m.useEffect(()=>{e()},[])}function mse(e=0){const[t,n]=m.useState({height:By()?window.innerHeight:0,width:By()?window.innerWidth:0}),r=m.useRef(0),s=m.useRef(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(()=>{n({width:window.innerWidth,height:window.innerHeight})},e)});return m.useEffect(()=>{if(!By())return()=>{};const i=s.current;return n({height:window.innerHeight,width:window.innerWidth}),use(window,"resize",i),()=>{cse(window,"resize",i)}},[]),t}var gse=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","URL","WeakMap","WeakSet"],yse=["bigint","boolean","null","number","string","symbol","undefined"];function Ud(e){const t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(xse(t))return t}function Zs(e){return t=>Ud(t)===e}function xse(e){return gse.includes(e)}function Sc(e){return t=>typeof t===e}function wse(e){return yse.includes(e)}var bse=["innerHTML","ownerDocument","style","attributes","nodeValue"],qd=e=>Array.isArray(e),kse=e=>Ud(e)==="AsyncGeneratorFunction",vse=Zs("AsyncFunction"),Sse=Sc("bigint"),Nse=e=>e===!0||e===!1,jse=Zs("Date"),Cse=Zs("Error"),Ko=Sc("function"),_se=Zs("GeneratorFunction"),Ese=e=>typeof e=="number"&&Number.isInteger(e),Fw=Zs("Map"),jT=e=>Number.isNaN(e),Dk=e=>e===null,CT=Zs("Function"),Ase=Zs("Promise"),Pse=Zs("RegExp"),zw=Zs("Set"),Yd=Sc("string"),Ise=Sc("symbol"),Fk=Sc("undefined"),Rse=Zs("WeakMap"),Tse=Zs("WeakSet"),zk=e=>Dk(e)||Fk(e),_T=e=>!Fk(e),Mse=e=>Sc("number")(e)&&!jT(e),$se=e=>Yd(e)&&e.trim().length>0,Lse=e=>{if(!Yd(e)||e.length===0)return!1;const t=e.trim();return t.length>0&&Number.isFinite(Number(t))},Dm=e=>!zk(e)&&(Ko(e)||typeof e=="object"),ET=e=>{if(Ud(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})},Ose=e=>Dk(e)||wse(typeof e),Dse=e=>Ud(e)==="URL",AT=e=>!zk(e)&&Ko(e[Symbol.iterator]),Fse=e=>AT(e)&&Ko(e.next)&&Ko(e.throw),zse=e=>Ko(e)&&/^class\s/.test(e.toString()),Bse=(e,t)=>!qd(e)||!Ko(t)?!1:e.every(n=>t(n)),Hse=e=>Dm(e)&&!ET(e)&&e.nodeType===1&&Yd(e.nodeName)&&bse.every(t=>t in e),Wse=e=>Yd(e)&&e.length===0||qd(e)&&e.length===0||Dm(e)&&!Fw(e)&&!zw(e)&&Object.keys(e).length===0||zw(e)&&e.size===0||Fw(e)&&e.size===0,Vse=(e,t)=>!e||!t?!1:Object.getPrototypeOf(e)===t.prototype,Kse=(e,t)=>qd(e)?e.indexOf(t)>-1:!1,Use=(e,t,n)=>{if(!Dm(e)||!t)return!1;const r=e[t];return Ko(n)?n(r):_T(r)};function St(e){if(e===null)return"null";switch(typeof e){case"bigint":return"bigint";case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"symbol":return"symbol";case"undefined":return"undefined"}if(qd(e))return"Array";if(CT(e))return"Function";const t=Ud(e);return t||"Object"}St.array=qd;St.arrayOf=Bse;St.asyncGeneratorFunction=kse;St.asyncFunction=vse;St.bigint=Sse;St.boolean=Nse;St.class=zse;St.date=jse;St.defined=_T;St.domElement=Hse;St.empty=Wse;St.error=Cse;St.function=Ko;St.generator=Fse;St.generatorFunction=_se;St.instanceOf=Vse;St.integer=Ese;St.iterable=AT;St.map=Fw;St.nan=jT;St.null=Dk;St.nullOrUndefined=zk;St.nonEmptyString=$se;St.number=Mse;St.numericString=Lse;St.object=Dm;St.oneOf=Kse;St.plainFunction=CT;St.plainObject=ET;St.primitive=Ose;St.promise=Ase;St.propertyOf=Use;St.regexp=Pse;St.set=zw;St.string=Yd;St.symbol=Ise;St.undefined=Fk;St.url=Dse;St.weakMap=Rse;St.weakSet=Tse;var wr=St;/* v8 ignore next -- @preserve */var qse=function(e){return Object.prototype.hasOwnProperty.call(e,"props")},Yse=function(e,t){return e+_d(t)},_d=function(e){return e===null||typeof e=="boolean"||typeof e>"u"?"":typeof e=="number"?e.toString():typeof e=="string"?e:Array.isArray(e)?e.reduce(Yse,""):qse(e)&&Object.prototype.hasOwnProperty.call(e.props,"children")?_d(e.props.children):""};_d.default=_d;var Gse=_d;const Hy=qo(Gse);var PT={exports:{}};(function(e){const t=Object.getPrototypeOf({});function n(){return function(i){return typeof i=="object"&&i!==null&&!(i instanceof RegExp)&&!(i instanceof Date)}}function r(s){function i(N){return N!=="constructor"&&N!=="prototype"&&N!=="__proto__"}function a(N){let j=0;const A=N.length,I=new Array(A);for(j;j<A;++j)I[j]=y(N[j]);return I}function l(N){const j={};if(p&&Object.getPrototypeOf(N)!==t)return p(N);const A=d(N);let I,D,H;for(I=0,D=A.length;I<D;++I)i(H=A[I])&&(j[H]=y(N[H]));return j}function c(N,j){const A=N.length,I=j.length;let D=0;const H=new Array(A+I);for(D;D<A;++D)H[D]=y(N[D]);for(D=0;D<I;++D)H[D+A]=y(j[D]);return H}const u=Object.prototype.propertyIsEnumerable;function f(N){const j=Object.keys(N),A=Object.getOwnPropertySymbols(N);for(let I=0,D=A.length;I<D;++I)u.call(N,A[I])&&j.push(A[I]);return j}const d=s!=null&&s.symbols?f:Object.keys,p=typeof(s==null?void 0:s.cloneProtoObject)=="function"?s.cloneProtoObject:void 0,h=typeof(s==null?void 0:s.isMergeableObject)=="function"?s.isMergeableObject:n(),g=(s==null?void 0:s.onlyDefinedProperties)===!0;function k(N){return typeof N!="object"||N===null}const w=s&&typeof s.mergeArray=="function"?s.mergeArray({clone:y,deepmerge:b,getKeys:d,isMergeableObject:h}):c;function y(N){return h(N)?Array.isArray(N)?a(N):l(N):N}function v(N,j){const A={},I=d(N),D=d(j);let H,V,F;for(H=0,V=I.length;H<V;++H)i(F=I[H])&&D.indexOf(F)===-1&&(A[F]=y(N[F]));for(H=0,V=D.length;H<V;++H)if(i(F=D[H]))if(F in N)I.indexOf(F)!==-1&&(p&&h(j[F])&&Object.getPrototypeOf(j[F])!==t?A[F]=p(j[F]):A[F]=b(N[F],j[F]));else{if(g&&typeof j[F]>"u")continue;A[F]=y(j[F])}return A}function b(N,j){if(g&&typeof j>"u")return y(N);const A=Array.isArray(j),I=Array.isArray(N);return k(j)?j:h(N)?A&&I?w(N,j):A!==I?y(j):v(N,j):y(j)}function C(){switch(arguments.length){case 0:return{};case 1:return y(arguments[0]);case 2:return b(arguments[0],arguments[1])}let N;for(let j=0,A=arguments.length;j<A;++j)N=b(N,arguments[j]);return N}return s!=null&&s.all?C:b}e.exports=r,e.exports.default=r,e.exports.deepmerge=r,Object.defineProperty(e.exports,"isMergeableObject",{get:n})})(PT);var Jse=PT.exports;const Xse=qo(Jse);var Qse=new Error("Element already at target scroll position"),Zse=new Error("Scroll cancelled"),eie=Math.min,AC=Date.now,tie={left:PC("scrollLeft"),top:PC("scrollTop")};function PC(e){return function(n,r,s,i){s=s||{},typeof s=="function"&&(i=s,s={}),typeof i!="function"&&(i=rie);var a=AC(),l=n[e],c=s.ease||nie,u=isNaN(s.duration)?350:+s.duration,f=!1;return l===r?i(Qse,n[e]):requestAnimationFrame(p),d;function d(){f=!0}function p(h){if(f)return i(Zse,n[e]);var g=AC(),k=eie(1,(g-a)/u),w=c(k);n[e]=w*(r-l)+l,k<1?requestAnimationFrame(p):requestAnimationFrame(function(){i(null,n[e])})}}}function nie(e){return .5*(1-Math.cos(Math.PI*e))}function rie(){}const sie=qo(tie);var IT={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.Scrollparent=n()})(Vu,function(){function t(r){var s=getComputedStyle(r,null).getPropertyValue("overflow");return s.indexOf("scroll")>-1||s.indexOf("auto")>-1}function n(r){if(r instanceof HTMLElement||r instanceof SVGElement){for(var s=r.parentNode;s.parentNode;){if(t(s))return s;s=s.parentNode}return document.scrollingElement||document.documentElement}}return n})})(IT);var iie=IT.exports;const RT=qo(iie),oie=["top","right","bottom","left"],IC=["start","end"],RC=oie.reduce((e,t)=>e.concat(t,t+"-"+IC[0],t+"-"+IC[1]),[]),hc=Math.min,_a=Math.max,qh=Math.round,yp=Math.floor,bi=e=>({x:e,y:e}),aie={left:"right",right:"left",bottom:"top",top:"bottom"};function Bw(e,t,n){return _a(e,hc(t,n))}function Nc(e,t){return typeof e=="function"?e(t):e}function eo(e){return e.split("-")[0]}function ki(e){return e.split("-")[1]}function TT(e){return e==="x"?"y":"x"}function Bk(e){return e==="y"?"height":"width"}function Ao(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Hk(e){return TT(Ao(e))}function MT(e,t,n){n===void 0&&(n=!1);const r=ki(e),s=Hk(e),i=Bk(s);let a=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=Gh(a)),[a,Gh(a)]}function lie(e){const t=Gh(e);return[Yh(e),t,Yh(t)]}function Yh(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const TC=["left","right"],MC=["right","left"],cie=["top","bottom"],uie=["bottom","top"];function die(e,t,n){switch(e){case"top":case"bottom":return n?t?MC:TC:t?TC:MC;case"left":case"right":return t?cie:uie;default:return[]}}function fie(e,t,n,r){const s=ki(e);let i=die(eo(e),n==="start",r);return s&&(i=i.map(a=>a+"-"+s),t&&(i=i.concat(i.map(Yh)))),i}function Gh(e){const t=eo(e);return aie[t]+e.slice(t.length)}function pie(e){return{top:0,right:0,bottom:0,left:0,...e}}function $T(e){return typeof e!="number"?pie(e):{top:e,right:e,bottom:e,left:e}}function Jh(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function $C(e,t,n){let{reference:r,floating:s}=e;const i=Ao(t),a=Hk(t),l=Bk(a),c=eo(t),u=i==="y",f=r.x+r.width/2-s.width/2,d=r.y+r.height/2-s.height/2,p=r[l]/2-s[l]/2;let h;switch(c){case"top":h={x:f,y:r.y-s.height};break;case"bottom":h={x:f,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-s.width,y:d};break;default:h={x:r.x,y:r.y}}switch(ki(t)){case"start":h[a]-=p*(n&&u?-1:1);break;case"end":h[a]+=p*(n&&u?-1:1);break}return h}async function hie(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:i,rects:a,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:f="viewport",elementContext:d="floating",altBoundary:p=!1,padding:h=0}=Nc(t,e),g=$T(h),w=l[p?d==="floating"?"reference":"floating":d],y=Jh(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(w)))==null||n?w:w.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:u,rootBoundary:f,strategy:c})),v=d==="floating"?{x:r,y:s,width:a.floating.width,height:a.floating.height}:a.reference,b=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),C=await(i.isElement==null?void 0:i.isElement(b))?await(i.getScale==null?void 0:i.getScale(b))||{x:1,y:1}:{x:1,y:1},N=Jh(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:b,strategy:c}):v);return{top:(y.top-N.top+g.top)/C.y,bottom:(N.bottom-y.bottom+g.bottom)/C.y,left:(y.left-N.left+g.left)/C.x,right:(N.right-y.right+g.right)/C.x}}const mie=50,gie=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:hie},c=await(a.isRTL==null?void 0:a.isRTL(t));let u=await a.getElementRects({reference:e,floating:t,strategy:s}),{x:f,y:d}=$C(u,r,c),p=r,h=0;const g={};for(let k=0;k<i.length;k++){const w=i[k];if(!w)continue;const{name:y,fn:v}=w,{x:b,y:C,data:N,reset:j}=await v({x:f,y:d,initialPlacement:r,placement:p,strategy:s,middlewareData:g,rects:u,platform:l,elements:{reference:e,floating:t}});f=b??f,d=C??d,g[y]={...g[y],...N},j&&h<mie&&(h++,typeof j=="object"&&(j.placement&&(p=j.placement),j.rects&&(u=j.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:s}):j.rects),{x:f,y:d}=$C(u,p,c)),k=-1)}return{x:f,y:d,placement:p,strategy:s,middlewareData:g}},yie=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:i,platform:a,elements:l,middlewareData:c}=t,{element:u,padding:f=0}=Nc(e,t)||{};if(u==null)return{};const d=$T(f),p={x:n,y:r},h=Hk(s),g=Bk(h),k=await a.getDimensions(u),w=h==="y",y=w?"top":"left",v=w?"bottom":"right",b=w?"clientHeight":"clientWidth",C=i.reference[g]+i.reference[h]-p[h]-i.floating[g],N=p[h]-i.reference[h],j=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let A=j?j[b]:0;(!A||!await(a.isElement==null?void 0:a.isElement(j)))&&(A=l.floating[b]||i.floating[g]);const I=C/2-N/2,D=A/2-k[g]/2-1,H=hc(d[y],D),V=hc(d[v],D),F=H,L=A-k[g]-V,M=A/2-k[g]/2+I,K=Bw(F,M,L),W=!c.arrow&&ki(s)!=null&&M!==K&&i.reference[g]/2-(M<F?H:V)-k[g]/2<0,$=W?M<F?M-F:M-L:0;return{[h]:p[h]+$,data:{[h]:K,centerOffset:M-K-$,...W&&{alignmentOffset:$}},reset:W}}});function xie(e,t,n){return(e?[...n.filter(s=>ki(s)===e),...n.filter(s=>ki(s)!==e)]:n.filter(s=>eo(s)===s)).filter(s=>e?ki(s)===e||(t?Yh(s)!==s:!1):!0)}const wie=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,r,s;const{rects:i,middlewareData:a,placement:l,platform:c,elements:u}=t,{crossAxis:f=!1,alignment:d,allowedPlacements:p=RC,autoAlignment:h=!0,...g}=Nc(e,t),k=d!==void 0||p===RC?xie(d||null,h,p):p,w=await c.detectOverflow(t,g),y=((n=a.autoPlacement)==null?void 0:n.index)||0,v=k[y];if(v==null)return{};const b=MT(v,i,await(c.isRTL==null?void 0:c.isRTL(u.floating)));if(l!==v)return{reset:{placement:k[0]}};const C=[w[eo(v)],w[b[0]],w[b[1]]],N=[...((r=a.autoPlacement)==null?void 0:r.overflows)||[],{placement:v,overflows:C}],j=k[y+1];if(j)return{data:{index:y+1,overflows:N},reset:{placement:j}};const A=N.map(H=>{const V=ki(H.placement);return[H.placement,V&&f?H.overflows.slice(0,2).reduce((F,L)=>F+L,0):H.overflows[0],H.overflows]}).sort((H,V)=>H[1]-V[1]),D=((s=A.filter(H=>H[2].slice(0,ki(H[0])?2:3).every(V=>V<=0))[0])==null?void 0:s[0])||A[0][0];return D!==l?{data:{index:y+1,overflows:N},reset:{placement:D}}:{}}}},bie=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:i,rects:a,initialPlacement:l,platform:c,elements:u}=t,{mainAxis:f=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:k=!0,...w}=Nc(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const y=eo(s),v=Ao(l),b=eo(l)===l,C=await(c.isRTL==null?void 0:c.isRTL(u.floating)),N=p||(b||!k?[Gh(l)]:lie(l)),j=g!=="none";!p&&j&&N.push(...fie(l,k,g,C));const A=[l,...N],I=await c.detectOverflow(t,w),D=[];let H=((r=i.flip)==null?void 0:r.overflows)||[];if(f&&D.push(I[y]),d){const M=MT(s,a,C);D.push(I[M[0]],I[M[1]])}if(H=[...H,{placement:s,overflows:D}],!D.every(M=>M<=0)){var V,F;const M=(((V=i.flip)==null?void 0:V.index)||0)+1,K=A[M];if(K&&(!(d==="alignment"?v!==Ao(K):!1)||H.every(R=>Ao(R.placement)===v?R.overflows[0]>0:!0)))return{data:{index:M,overflows:H},reset:{placement:K}};let W=(F=H.filter($=>$.overflows[0]<=0).sort(($,R)=>$.overflows[1]-R.overflows[1])[0])==null?void 0:F.placement;if(!W)switch(h){case"bestFit":{var L;const $=(L=H.filter(R=>{if(j){const B=Ao(R.placement);return B===v||B==="y"}return!0}).map(R=>[R.placement,R.overflows.filter(B=>B>0).reduce((B,_)=>B+_,0)]).sort((R,B)=>R[1]-B[1])[0])==null?void 0:L[0];$&&(W=$);break}case"initialPlacement":W=l;break}if(s!==W)return{reset:{placement:W}}}return{}}}},kie=new Set(["left","top"]);async function vie(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),a=eo(n),l=ki(n),c=Ao(n)==="y",u=kie.has(a)?-1:1,f=i&&c?-1:1,d=Nc(t,e);let{mainAxis:p,crossAxis:h,alignmentAxis:g}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&typeof g=="number"&&(h=l==="end"?g*-1:g),c?{x:h*f,y:p*u}:{x:p*u,y:h*f}}const Sie=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:i,placement:a,middlewareData:l}=t,c=await vie(t,e);return a===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:i+c.y,data:{...c,placement:a}}}}},Nie=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:i}=t,{mainAxis:a=!0,crossAxis:l=!1,limiter:c={fn:y=>{let{x:v,y:b}=y;return{x:v,y:b}}},...u}=Nc(e,t),f={x:n,y:r},d=await i.detectOverflow(t,u),p=Ao(eo(s)),h=TT(p);let g=f[h],k=f[p];if(a){const y=h==="y"?"top":"left",v=h==="y"?"bottom":"right",b=g+d[y],C=g-d[v];g=Bw(b,g,C)}if(l){const y=p==="y"?"top":"left",v=p==="y"?"bottom":"right",b=k+d[y],C=k-d[v];k=Bw(b,k,C)}const w=c.fn({...t,[h]:g,[p]:k});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[h]:a,[p]:l}}}}}};function Fm(){return typeof window<"u"}function jc(e){return LT(e)?(e.nodeName||"").toLowerCase():"#document"}function is(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ci(e){var t;return(t=(LT(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function LT(e){return Fm()?e instanceof Node||e instanceof is(e).Node:!1}function Js(e){return Fm()?e instanceof Element||e instanceof is(e).Element:!1}function so(e){return Fm()?e instanceof HTMLElement||e instanceof is(e).HTMLElement:!1}function LC(e){return!Fm()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof is(e).ShadowRoot}function Gd(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=Xs(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function jie(e){return/^(table|td|th)$/.test(jc(e))}function zm(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Cie=/transform|translate|scale|rotate|perspective|filter/,_ie=/paint|layout|strict|content/,la=e=>!!e&&e!=="none";let Wy;function Wk(e){const t=Js(e)?Xs(e):e;return la(t.transform)||la(t.translate)||la(t.scale)||la(t.rotate)||la(t.perspective)||!Vk()&&(la(t.backdropFilter)||la(t.filter))||Cie.test(t.willChange||"")||_ie.test(t.contain||"")}function Eie(e){let t=Uo(e);for(;so(t)&&!mc(t);){if(Wk(t))return t;if(zm(t))return null;t=Uo(t)}return null}function Vk(){return Wy==null&&(Wy=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Wy}function mc(e){return/^(html|body|#document)$/.test(jc(e))}function Xs(e){return is(e).getComputedStyle(e)}function Bm(e){return Js(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Uo(e){if(jc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||LC(e)&&e.host||Ci(e);return LC(t)?t.host:t}function OT(e){const t=Uo(e);return mc(t)?e.ownerDocument?e.ownerDocument.body:e.body:so(t)&&Gd(t)?t:OT(t)}function Ed(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=OT(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),a=is(s);if(i){const l=Hw(a);return t.concat(a,a.visualViewport||[],Gd(s)?s:[],l&&n?Ed(l):[])}else return t.concat(s,Ed(s,[],n))}function Hw(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function DT(e){const t=Xs(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=so(e),i=s?e.offsetWidth:n,a=s?e.offsetHeight:r,l=qh(n)!==i||qh(r)!==a;return l&&(n=i,r=a),{width:n,height:r,$:l}}function Kk(e){return Js(e)?e:e.contextElement}function Ql(e){const t=Kk(e);if(!so(t))return bi(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=DT(t);let a=(i?qh(n.width):n.width)/r,l=(i?qh(n.height):n.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const Aie=bi(0);function FT(e){const t=is(e);return!Vk()||!t.visualViewport?Aie:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Pie(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==is(e)?!1:t}function Va(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=Kk(e);let a=bi(1);t&&(r?Js(r)&&(a=Ql(r)):a=Ql(e));const l=Pie(i,n,r)?FT(i):bi(0);let c=(s.left+l.x)/a.x,u=(s.top+l.y)/a.y,f=s.width/a.x,d=s.height/a.y;if(i){const p=is(i),h=r&&Js(r)?is(r):r;let g=p,k=Hw(g);for(;k&&r&&h!==g;){const w=Ql(k),y=k.getBoundingClientRect(),v=Xs(k),b=y.left+(k.clientLeft+parseFloat(v.paddingLeft))*w.x,C=y.top+(k.clientTop+parseFloat(v.paddingTop))*w.y;c*=w.x,u*=w.y,f*=w.x,d*=w.y,c+=b,u+=C,g=is(k),k=Hw(g)}}return Jh({width:f,height:d,x:c,y:u})}function Hm(e,t){const n=Bm(e).scrollLeft;return t?t.left+n:Va(Ci(e)).left+n}function zT(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Hm(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function Iie(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",a=Ci(r),l=t?zm(t.floating):!1;if(r===a||l&&i)return n;let c={scrollLeft:0,scrollTop:0},u=bi(1);const f=bi(0),d=so(r);if((d||!d&&!i)&&((jc(r)!=="body"||Gd(a))&&(c=Bm(r)),d)){const h=Va(r);u=Ql(r),f.x=h.x+r.clientLeft,f.y=h.y+r.clientTop}const p=a&&!d&&!i?zT(a,c):bi(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+f.x+p.x,y:n.y*u.y-c.scrollTop*u.y+f.y+p.y}}function Rie(e){return Array.from(e.getClientRects())}function Tie(e){const t=Ci(e),n=Bm(e),r=e.ownerDocument.body,s=_a(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=_a(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+Hm(e);const l=-n.scrollTop;return Xs(r).direction==="rtl"&&(a+=_a(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:a,y:l}}const OC=25;function Mie(e,t){const n=is(e),r=Ci(e),s=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,c=0;if(s){i=s.width,a=s.height;const f=Vk();(!f||f&&t==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}const u=Hm(r);if(u<=0){const f=r.ownerDocument,d=f.body,p=getComputedStyle(d),h=f.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,g=Math.abs(r.clientWidth-d.clientWidth-h);g<=OC&&(i-=g)}else u<=OC&&(i+=u);return{width:i,height:a,x:l,y:c}}function $ie(e,t){const n=Va(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=so(e)?Ql(e):bi(1),a=e.clientWidth*i.x,l=e.clientHeight*i.y,c=s*i.x,u=r*i.y;return{width:a,height:l,x:c,y:u}}function DC(e,t,n){let r;if(t==="viewport")r=Mie(e,n);else if(t==="document")r=Tie(Ci(e));else if(Js(t))r=$ie(t,n);else{const s=FT(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Jh(r)}function BT(e,t){const n=Uo(e);return n===t||!Js(n)||mc(n)?!1:Xs(n).position==="fixed"||BT(n,t)}function Lie(e,t){const n=t.get(e);if(n)return n;let r=Ed(e,[],!1).filter(l=>Js(l)&&jc(l)!=="body"),s=null;const i=Xs(e).position==="fixed";let a=i?Uo(e):e;for(;Js(a)&&!mc(a);){const l=Xs(a),c=Wk(a);!c&&l.position==="fixed"&&(s=null),(i?!c&&!s:!c&&l.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||Gd(a)&&!c&&BT(e,a))?r=r.filter(f=>f!==a):s=l,a=Uo(a)}return t.set(e,r),r}function Oie(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const a=[...n==="clippingAncestors"?zm(t)?[]:Lie(t,this._c):[].concat(n),r],l=DC(t,a[0],s);let c=l.top,u=l.right,f=l.bottom,d=l.left;for(let p=1;p<a.length;p++){const h=DC(t,a[p],s);c=_a(h.top,c),u=hc(h.right,u),f=hc(h.bottom,f),d=_a(h.left,d)}return{width:u-d,height:f-c,x:d,y:c}}function Die(e){const{width:t,height:n}=DT(e);return{width:t,height:n}}function Fie(e,t,n){const r=so(t),s=Ci(t),i=n==="fixed",a=Va(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=bi(0);function u(){c.x=Hm(s)}if(r||!r&&!i)if((jc(t)!=="body"||Gd(s))&&(l=Bm(t)),r){const h=Va(t,!0,i,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else s&&u();i&&!r&&s&&u();const f=s&&!r&&!i?zT(s,l):bi(0),d=a.left+l.scrollLeft-c.x-f.x,p=a.top+l.scrollTop-c.y-f.y;return{x:d,y:p,width:a.width,height:a.height}}function Vy(e){return Xs(e).position==="static"}function FC(e,t){if(!so(e)||Xs(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ci(e)===n&&(n=n.ownerDocument.body),n}function HT(e,t){const n=is(e);if(zm(e))return n;if(!so(e)){let s=Uo(e);for(;s&&!mc(s);){if(Js(s)&&!Vy(s))return s;s=Uo(s)}return n}let r=FC(e,t);for(;r&&jie(r)&&Vy(r);)r=FC(r,t);return r&&mc(r)&&Vy(r)&&!Wk(r)?n:r||Eie(e)||n}const zie=async function(e){const t=this.getOffsetParent||HT,n=this.getDimensions,r=await n(e.floating);return{reference:Fie(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Bie(e){return Xs(e).direction==="rtl"}const Hie={convertOffsetParentRelativeRectToViewportRelativeRect:Iie,getDocumentElement:Ci,getClippingRect:Oie,getOffsetParent:HT,getElementRects:zie,getClientRects:Rie,getDimensions:Die,getScale:Ql,isElement:Js,isRTL:Bie};function WT(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Wie(e,t){let n=null,r;const s=Ci(e);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function a(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),i();const u=e.getBoundingClientRect(),{left:f,top:d,width:p,height:h}=u;if(l||t(),!p||!h)return;const g=yp(d),k=yp(s.clientWidth-(f+p)),w=yp(s.clientHeight-(d+h)),y=yp(f),b={rootMargin:-g+"px "+-k+"px "+-w+"px "+-y+"px",threshold:_a(0,hc(1,c))||1};let C=!0;function N(j){const A=j[0].intersectionRatio;if(A!==c){if(!C)return a();A?a(!1,A):r=setTimeout(()=>{a(!1,1e-7)},1e3)}A===1&&!WT(u,e.getBoundingClientRect())&&a(),C=!1}try{n=new IntersectionObserver(N,{...b,root:s.ownerDocument})}catch{n=new IntersectionObserver(N,b)}n.observe(e)}return a(!0),i}function zC(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=Kk(e),f=s||i?[...u?Ed(u):[],...t?Ed(t):[]]:[];f.forEach(y=>{s&&y.addEventListener("scroll",n,{passive:!0}),i&&y.addEventListener("resize",n)});const d=u&&l?Wie(u,n):null;let p=-1,h=null;a&&(h=new ResizeObserver(y=>{let[v]=y;v&&v.target===u&&h&&t&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var b;(b=h)==null||b.observe(t)})),n()}),u&&!c&&h.observe(u),t&&h.observe(t));let g,k=c?Va(e):null;c&&w();function w(){const y=Va(e);k&&!WT(k,y)&&n(),k=y,g=requestAnimationFrame(w)}return n(),()=>{var y;f.forEach(v=>{s&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),d==null||d(),(y=h)==null||y.disconnect(),h=null,c&&cancelAnimationFrame(g)}}const Vie=Sie,Kie=wie,Uie=Nie,qie=bie,BC=yie,Yie=(e,t,n)=>{const r=new Map,s={platform:Hie,...n},i={...s.platform,_c:r};return gie(e,t,{...s,platform:i})};var Gie=typeof document<"u",Jie=function(){},Up=Gie?m.useLayoutEffect:Jie;function Xh(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Xh(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&e.$$typeof)&&!Xh(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function VT(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function HC(e,t){const n=VT(e);return Math.round(t*n)/n}function Ky(e){const t=m.useRef(e);return Up(()=>{t.current=e}),t}function WC(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:a}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[f,d]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=m.useState(r);Xh(p,r)||h(r);const[g,k]=m.useState(null),[w,y]=m.useState(null),v=m.useCallback(R=>{R!==j.current&&(j.current=R,k(R))},[]),b=m.useCallback(R=>{R!==A.current&&(A.current=R,y(R))},[]),C=i||g,N=a||w,j=m.useRef(null),A=m.useRef(null),I=m.useRef(f),D=c!=null,H=Ky(c),V=Ky(s),F=Ky(u),L=m.useCallback(()=>{if(!j.current||!A.current)return;const R={placement:t,strategy:n,middleware:p};V.current&&(R.platform=V.current),Yie(j.current,A.current,R).then(B=>{const _={...B,isPositioned:F.current!==!1};M.current&&!Xh(I.current,_)&&(I.current=_,cr.flushSync(()=>{d(_)}))})},[p,t,n,V,F]);Up(()=>{u===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,d(R=>({...R,isPositioned:!1})))},[u]);const M=m.useRef(!1);Up(()=>(M.current=!0,()=>{M.current=!1}),[]),Up(()=>{if(C&&(j.current=C),N&&(A.current=N),C&&N){if(H.current)return H.current(C,N,L);L()}},[C,N,L,H,D]);const K=m.useMemo(()=>({reference:j,floating:A,setReference:v,setFloating:b}),[v,b]),W=m.useMemo(()=>({reference:C,floating:N}),[C,N]),$=m.useMemo(()=>{const R={position:n,left:0,top:0};if(!W.floating)return R;const B=HC(W.floating,f.x),_=HC(W.floating,f.y);return l?{...R,transform:"translate("+B+"px, "+_+"px)",...VT(W.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:B,top:_}},[n,l,W.floating,f.x,f.y]);return m.useMemo(()=>({...f,update:L,refs:K,elements:W,floatingStyles:$}),[f,L,K,W,$])}const Xie=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?BC({element:r.current,padding:s}).fn(n):{}:r?BC({element:r,padding:s}).fn(n):{}}}},VC=(e,t)=>{const n=Vie(e);return{name:n.name,fn:n.fn,options:[e,t]}},Qie=(e,t)=>{const n=Uie(e);return{name:n.name,fn:n.fn,options:[e,t]}},Zie=(e,t)=>{const n=qie(e);return{name:n.name,fn:n.fn,options:[e,t]}},eoe=(e,t)=>{const n=Kie(e);return{name:n.name,fn:n.fn,options:[e,t]}},toe=(e,t)=>{const n=Xie(e);return{name:n.name,fn:n.fn,options:[e,t]}},noe={arrowBase:32,arrowColor:"#ffffff",arrowSize:16,arrowSpacing:12,backgroundColor:"#ffffff",beaconSize:36,beaconTrigger:"click",beforeTimeout:5e3,blockTargetInteraction:!1,buttons:["back","close","primary"],closeButtonAction:"close",disableFocusTrap:!1,dismissKeyAction:"close",hideOverlay:!1,loaderDelay:300,offset:10,overlayClickAction:"close",overlayColor:"#00000080",primaryColor:"#000000",scrollDuration:300,scrollOffset:20,showProgress:!1,skipBeacon:!1,skipScroll:!1,spotlightPadding:10,spotlightRadius:4,targetWaitTimeout:1e3,textColor:"#000000",width:380,zIndex:100},roe={beaconOptions:{offset:-18}},KT={back:"Back",close:"Close",last:"Last",next:"Next",nextWithProgress:"Next ({current} of {total})",open:"Open the dialog",skip:"Skip"},soe={isFixed:!1,locale:KT,placement:"bottom"},ioe={continuous:!1,debug:!1,run:!1,scrollToFirstStep:!1,steps:[]},Rt={INIT:"init",START:"start",STOP:"stop",RESET:"reset",PREV:"prev",NEXT:"next",GO:"go",CLOSE:"close",SKIP:"skip",UPDATE:"update",COMPLETE:"complete"},tr={TOUR_START:"tour:start",STEP_BEFORE_HOOK:"step:before_hook",STEP_BEFORE:"step:before",SCROLL_START:"scroll:start",SCROLL_END:"scroll:end",BEACON:"beacon",TOOLTIP:"tooltip",STEP_AFTER:"step:after",STEP_AFTER_HOOK:"step:after_hook",TOUR_END:"tour:end",TOUR_STATUS:"tour:status",TARGET_NOT_FOUND:"error:target_not_found",ERROR:"error"},Ue={INIT:"init",READY:"ready",BEACON_BEFORE:"beacon_before",BEACON:"beacon",TOOLTIP_BEFORE:"tooltip_before",TOOLTIP:"tooltip",COMPLETE:"complete"},ci={BUTTON_BACK:"button_back",BUTTON_CLOSE:"button_close",BUTTON_PRIMARY:"button_primary",BUTTON_SKIP:"button_skip",KEYBOARD:"keyboard",OVERLAY:"overlay"},Et={IDLE:"idle",READY:"ready",WAITING:"waiting",RUNNING:"running",PAUSED:"paused",SKIPPED:"skipped",FINISHED:"finished"},ooe="react-joyride-portal";function aoe(e){const t={};for(const n in e)e[n]!==void 0&&(t[n]=e[n]);return t}function Fl(...e){return Xse({all:!0,isMergeableObject:t=>!(!wr.plainObject(t)||m.isValidElement(t))})(...e)}function UT(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function Fi(e,t={}){const{defaultValue:n,step:r,steps:s}=t;let i=Hy(e);if(i)(i.includes("{current}")||i.includes("{total}"))&&r&&s&&(i=i.replace("{current}",r.toString()).replace("{total}",s.toString()));else if(m.isValidElement(e)&&!Object.values(e.props).length&&UT(e.type)==="function")try{i=Fi(e.type({}),t)}catch{i=Hy(n)}else i=Hy(n);return i}function rr(e,t,n,...r){if(!e)return;const s=new Date,i=`${String(s.getHours()).padStart(2,"0")}:${String(s.getMinutes()).padStart(2,"0")}:${String(s.getSeconds()).padStart(2,"0")}.${String(s.getMilliseconds()).padStart(3,"0")}`;console.log(`${t} %c${n}%c ${i}`,"font-weight: bold","color: gray; font-weight: normal",...r)}function loe(e,t){const n=aoe(t);return{...e,...n}}function Ad(){}function coe(e){return Object.keys(e)}function Qh(e,...t){if(!wr.plainObject(e))throw new TypeError("Expected an object");const n={};for(const r in e)({}).hasOwnProperty.call(e,r)&&(t.includes(r)||(n[r]=e[r]));return n}function KC(e,...t){if(!wr.plainObject(e))throw new TypeError("Expected an object");if(!t.length)return e;const n={};for(const r in e)({}).hasOwnProperty.call(e,r)&&t.includes(r)&&(n[r]=e[r]);return n}function Ww(e,t,n){const r=i=>i.replace("{current}",String(t)).replace("{total}",String(n));if(UT(e)==="string")return r(e);if(!m.isValidElement(e))return e;const{children:s}=e.props;if(wr.string(s)&&s.includes("{current}"))return m.cloneElement(e,{children:r(s)});if(Array.isArray(s))return m.cloneElement(e,{children:s.map(i=>typeof i=="string"?r(i):Ww(i,t,n))});if(wr.function(e.type)&&!Object.values(e.props).length)try{return Ww(e.type({}),t,n)}catch{return e}return e}function UC(e){return coe(e).sort().reduce((t,n)=>(t[n]=e[n],t),{})}function Uk(){var e;return!!(typeof window<"u"&&((e=window.document)!=null&&e.createElement))}function qC(e){let t=0,n=0,r=e;for(;r;)t+=r.offsetTop,n+=r.offsetLeft,r=r.offsetParent;return{left:n,top:t}}function qk(e){return e?e.getBoundingClientRect():null}function uoe(e=!1){const{body:t,documentElement:n}=document;if(!t||!n)return 0;if(e){const r=[t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight].sort((i,a)=>i-a),s=Math.floor(r.length/2);return r.length%2===0?(r[s-1]+r[s])/2:r[s]}return Math.max(t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight)}function ws(e){if(!e)return null;if(typeof e=="function")try{return e()}catch{return null}if(typeof e=="object"&&"current"in e)return e.current;if(typeof e=="string")try{return document.querySelector(e)}catch{return null}return e}function doe(e,t,n){const r=qk(e),s=Cc(e),i=s?!s.isSameNode(Br()):!1,a=n??_c(e);let l=0,c=(r==null?void 0:r.top)??0;return i&&a?c=(r==null?void 0:r.top)??0:s instanceof HTMLElement&&(l=s.scrollTop,!i&&!a&&(c+=l),s.isSameNode(Br())||(c+=Br().scrollTop)),Math.floor(c-t)}function Cc(e,t){if(!e)return Br();const n=RT(e);if(n){if(n.isSameNode(Br()))return t?document:Br();if(!(n.scrollHeight>n.offsetHeight))return Br()}return n}function foe(e){const t=e.getBoundingClientRect(),n=Br(),r=t.top+t.height/2,s=window.innerHeight/2;return Math.max(0,n.scrollTop+r-s)}function poe(e,t){if(!e)return 0;const n=RT(e)??Br(),r=parseFloat(getComputedStyle(e).scrollMarginTop)||0,s=qk(n),i=n.scrollTop??0,{offsetTop:a=0,scrollTop:l=0}=n;let c=e.getBoundingClientRect().top+l;if(a&&(qT(e)||hoe(e))){const f=e.getBoundingClientRect(),d=f.top-((s==null?void 0:s.top)??0),p=d+f.height,h=n.clientHeight,g=h*.2;d>=g&&p<=h-g?c=i:c=d+i}const u=Math.floor(c-t-r);return u<0?0:u}function hoe(e){return e.offsetParent!==document.body}function qT(e){if(!e)return!1;const t=Cc(e);return t?!t.isSameNode(Br()):!1}function _c(e,t="fixed"){if(!e||!(e instanceof Element))return!1;const{nodeName:n}=e;return n==="BODY"||n==="HTML"?!1:getComputedStyle(e).position===t?!0:e.parentNode?_c(e.parentNode,t):!1}function xp(e){if(!e)return!1;let t=e;for(;t&&t!==document.body;){if(t instanceof HTMLElement){const{display:n,visibility:r}=getComputedStyle(t);if(n==="none"||r==="hidden")return!1}t=t.parentElement??null}return!0}function YC(e){const{isFirstStep:t,scrollToFirstStep:n,step:r,target:s,targetLifecycle:i}=e;if(r.skipScroll||t&&!n&&i!==Ue.TOOLTIP||r.placement==="center")return!1;const a=s!=null&&s.isConnected?Cc(s):Br(),l=a?!a.isSameNode(Br()):!1;return(r.isFixed||_c(s))&&!l?!1:a.scrollHeight>a.clientHeight}function Br(){return document.scrollingElement??document.documentElement}function GC(e,t){const{duration:n,element:r}=t;let s=()=>{};const i=new Promise(a=>{const{scrollTop:l}=r,c=e>l?e-l:l-e;s=sie.top(r,e,{duration:c<100?50:n},()=>{a()})});return{cancel:s,promise:i}}function moe(e){const t=e.replace(/^#?([\da-f])([\da-f])([\da-f])$/i,(r,s,i,a)=>s+s+i+i+a+a),n=/^#?([\da-f]{2})([\da-f]{2})([\da-f]{2})/i.exec(t);return n?[parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)]:[]}const YT={backgroundColor:"transparent",border:0,borderRadius:0,color:"#555555",cursor:"pointer",fontSize:16,lineHeight:1,padding:0,WebkitAppearance:"none"},wp={...YT,borderRadius:4,padding:8};function goe(e,t){const{styles:n}=e,r=Fl(n??{},t.styles??{});let{width:s}=t;Uk()&&(s=typeof s=="number"&&window.innerWidth<s?window.innerWidth-30:s);const i={bottom:0,left:0,overflow:"hidden",position:"absolute",right:0,top:0,zIndex:t.zIndex};return Fl({arrow:{alignItems:"center",color:t.arrowColor,display:"inline-flex",justifyContent:"center",position:"absolute"},beaconWrapper:{...YT,display:"inline-flex",borderRadius:"50%",position:"relative"},beacon:{height:t.beaconSize,width:t.beaconSize},beaconInner:{animation:"joyride-beacon-inner 1.2s infinite ease-in-out",backgroundColor:t.primaryColor,borderRadius:"50%",display:"block",height:"50%",left:"50%",opacity:.7,position:"absolute",top:"50%",transform:"translate(-50%, -50%)",width:"50%"},beaconOuter:{animation:"joyride-beacon-outer 1.2s infinite ease-in-out",backgroundColor:`rgba(${moe(t.primaryColor).join(",")}, 0.2)`,border:`2px solid ${t.primaryColor}`,borderRadius:"50%",boxSizing:"border-box",display:"block",height:"100%",left:0,opacity:.9,position:"absolute",top:0,transformOrigin:"center",width:"100%"},buttonBack:{...wp,color:t.primaryColor,marginLeft:"auto",marginRight:5},buttonClose:{...wp,color:t.textColor,height:12,padding:8,position:"absolute",right:0,top:0,width:12},buttonPrimary:{...wp,backgroundColor:t.primaryColor,color:t.backgroundColor},buttonSkip:{...wp,color:t.textColor,fontSize:14},floater:{display:"inline-block",filter:"drop-shadow(0 0 3px rgba(0, 0, 0, 0.3))",maxWidth:"100%",transition:"opacity 0.3s"},loader:{alignItems:"center",display:"flex",height:48,inset:0,justifyContent:"center",pointerEvents:"none",position:"fixed",width:48,zIndex:t.zIndex+1},overlay:{...i,backgroundColor:t.overlayColor},spotlight:{},tooltip:{backgroundColor:t.backgroundColor,borderRadius:5,boxSizing:"border-box",color:t.textColor,fontSize:16,maxWidth:"100%",padding:12,position:"relative",width:s},tooltipContainer:{lineHeight:1.4,textAlign:"center"},tooltipTitle:{fontSize:18,margin:0},tooltipContent:{paddingBottom:12,paddingTop:12},tooltipFooter:{alignItems:"center",display:"flex",justifyContent:"flex-end"},tooltipFooterSpacer:{flex:1}},r)}const yoe=["after","arrowBase","arrowColor","arrowSize","arrowSpacing","backgroundColor","beaconSize","beaconTrigger","before","beforeTimeout","buttons","closeButtonAction","skipBeacon","dismissKeyAction","disableFocusTrap","hideOverlay","skipScroll","blockTargetInteraction","loaderDelay","offset","overlayClickAction","overlayColor","primaryColor","scrollDuration","scrollOffset","showProgress","spotlightPadding","spotlightRadius","targetWaitTimeout","textColor","width","zIndex"];function Yk(e,t){if(!t)return null;const n=Fl(soe,KC(e,"arrowComponent","beaconComponent","floatingOptions","loaderComponent","locale","styles","tooltipComponent"),t),r=Fl(noe,e.options??{},KC(t,...yoe)),s=goe(e,{...n,...r}),i=Fl(roe,e.floatingOptions??{},n.floatingOptions??{});return{...n,...r,locale:Fl(KT,e.locale??{},n.locale||{}),floatingOptions:i,spotlightPadding:xoe(r.spotlightPadding),styles:s}}function xoe(e){return typeof e=="number"?{top:e,right:e,bottom:e,left:e}:{top:(e==null?void 0:e.top)??0,right:(e==null?void 0:e.right)??0,bottom:(e==null?void 0:e.bottom)??0,left:(e==null?void 0:e.left)??0}}function woe(e,t,n){const{action:r}=t,s=n&&[Rt.PREV,Rt.NEXT].includes(r);return e.skipBeacon||e.placement==="center"||s}function GT(e,t=!1){return wr.plainObject(e)?e.target?!0:(rr(t,"tour","target is missing from the step"),!1):(rr(t,"tour","step must be an object"),!1)}function JT(e,t=!1){return wr.array(e)?e.every(n=>GT(n,t)):(rr(t,"tour","steps must be an array"),!1)}var boe=class{constructor(e){Rn(this,"beaconPosition",null);Rn(this,"debug");Rn(this,"eventListeners",new Map);Rn(this,"listeners",new Set);Rn(this,"props");Rn(this,"snapshot");Rn(this,"state");Rn(this,"steps");Rn(this,"tooltipPosition",null);Rn(this,"cleanupPositionData",()=>{this.beaconPosition=null,this.tooltipPosition=null});Rn(this,"getPositionData",e=>e==="beacon"?this.beaconPosition:this.tooltipPosition);Rn(this,"getServerSnapshot",()=>this.snapshot);Rn(this,"getSnapshot",()=>this.snapshot);Rn(this,"getEventState",()=>Qh(this.snapshot,"positioned"));Rn(this,"getState",()=>Qh(this.snapshot,"positioned"));Rn(this,"setPositionData",(e,t)=>{var r,s,i;((r=e==="beacon"?this.beaconPosition:this.tooltipPosition)==null?void 0:r.placement)!==t.placement&&rr(this.debug,`step:${this.state.index}`,"positioned",`${e} ${t.placement}`),e==="beacon"?this.beaconPosition=t:this.tooltipPosition=t,(this.state.lifecycle===Ue.BEACON_BEFORE||this.state.lifecycle===Ue.TOOLTIP_BEFORE)&&!this.state.positioned&&this.updateState({positioned:!0});const n=(i=(s=this.getStep())==null?void 0:s.floatingOptions)==null?void 0:i.onPosition;n&&n(t)});Rn(this,"setSteps",e=>{this.steps=e,this.updateState({size:e.length})});Rn(this,"dispatch",(e,t)=>{const n=this.eventListeners.get(e.type);if(n)for(const r of n)try{r(e,t)}catch{}});Rn(this,"on",(e,t)=>{let n=this.eventListeners.get(e);return n||(n=new Set,this.eventListeners.set(e,n)),n.add(t),()=>{n.delete(t)}});Rn(this,"subscribe",e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}));Rn(this,"updateState",(e,t=!1)=>{const{controlled:n,index:r}=this.state,s=this.snapshot,i=n&&!t&&e.index!==void 0?r:e.index??r,a={action:e.action??this.state.action,controlled:n,index:i,lifecycle:e.lifecycle??this.state.lifecycle,origin:e.origin??null,positioned:e.positioned??this.state.positioned,scrolling:e.scrolling??this.state.scrolling,size:e.size??this.state.size,status:e.status??this.state.status,waiting:e.waiting??this.state.waiting},l=this.applyTransitions(a);if(this.state=l,!Ok(s,l)){this.snapshot=Object.freeze({...l});for(const c of this.listeners)c(this.snapshot)}});const{initialStepIndex:t,stepIndex:n,steps:r=[]}=e??{},s=wr.number(n);let i=0;this.debug=(e==null?void 0:e.debug)??!1,s?(i=n,wr.number(t)&&rr(this.debug,"tour","initialStepIndex is ignored in controlled mode")):wr.number(t)&&(t>=0&&t<r.length?i=t:r.length>0&&rr(this.debug,"tour","initialStepIndex is out of bounds")),this.props=e??{steps:[]},this.steps=r,this.state={action:Rt.INIT,controlled:s,index:i,lifecycle:Ue.INIT,origin:null,positioned:!1,scrolling:!1,size:r.length,status:r.length?Et.READY:Et.IDLE,waiting:!1},this.snapshot=Object.freeze({...this.state})}applyTransitions(e){return e.status===Et.WAITING&&e.size>0?{...e,status:Et.RUNNING}:e}getStep(e){return Yk(this.props,this.steps[e??this.state.index])}};function koe(e){return new boe(e)}function JC(e,t){return Math.min(Math.max(e,0),t)}function voe(e,t,n){const r=m.useRef(t),s=m.useRef(n);return r.current=t,s.current=n,m.useMemo(()=>{const i=()=>e.current.getSnapshot();return{close:(w=null)=>{const{index:y,status:v}=i();v===Et.RUNNING&&e.current.updateState({action:Rt.CLOSE,index:y+1,origin:w,lifecycle:Ue.COMPLETE,positioned:!1,scrolling:!1,waiting:!1})},go:w=>{const{controlled:y,size:v,status:b}=i();if(y){rr(r.current,"tour","go() is not supported in controlled mode");return}b===Et.RUNNING&&e.current.updateState({action:Rt.GO,index:w,lifecycle:Ue.COMPLETE,positioned:!1,scrolling:!1,status:w<v?b:Et.FINISHED,waiting:!1})},info:()=>Qh(e.current.getSnapshot(),"positioned"),next:w=>{const{index:y,size:v,status:b}=i();b===Et.RUNNING&&e.current.updateState({action:Rt.NEXT,index:JC(y+1,v),lifecycle:Ue.COMPLETE,origin:w,positioned:!1,scrolling:!1,waiting:!1})},open:()=>{const{status:w}=i();w===Et.RUNNING&&e.current.updateState({action:Rt.UPDATE,lifecycle:Ue.TOOLTIP_BEFORE,positioned:!1,scrolling:!1,waiting:!1})},prev:w=>{const{index:y,size:v,status:b}=i();b===Et.RUNNING&&e.current.updateState({action:Rt.PREV,index:JC(y-1,v),lifecycle:Ue.COMPLETE,origin:w,positioned:!1,scrolling:!1,waiting:!1})},reset:(w=!1)=>{const{controlled:y}=i();if(y){rr(r.current,"tour","reset() is not supported in controlled mode");return}s.current(),e.current.updateState({action:Rt.RESET,index:0,lifecycle:Ue.INIT,positioned:!1,scrolling:!1,status:w?Et.RUNNING:Et.READY,waiting:!1})},skip:w=>{const{status:y}=i();y===Et.RUNNING&&e.current.updateState({action:Rt.SKIP,lifecycle:Ue.COMPLETE,origin:w,positioned:!1,scrolling:!1,status:Et.SKIPPED,waiting:!1})},start:w=>{const{index:y,size:v}=i();s.current(),e.current.updateState({action:Rt.START,index:wr.number(w)?w:y,lifecycle:Ue.INIT,positioned:!1,scrolling:!1,status:v?Et.RUNNING:Et.WAITING,waiting:!1},!0)},stop:(w=!1)=>{const{index:y,status:v}=i();[Et.FINISHED,Et.SKIPPED].includes(v)||e.current.updateState({action:Rt.STOP,index:y+(w?1:0),lifecycle:Ue.COMPLETE,positioned:!1,scrolling:!1,status:Et.PAUSED,waiting:!1})}}},[e])}const Soe=new Set(["origin","positioned"]);function Noe(e,t){const n=m.useRef(null);m.useEffect(()=>{if(!t)return;const r=e.current.getSnapshot();return rr(!0,"tour","init",r),n.current=r,e.current.subscribe(s=>{const i=n.current;if(n.current=s,!i)return;const a={};let l=!1;for(const c of Object.keys(s))s[c]!==i[c]&&!Soe.has(c)&&(a[c]={from:i[c],to:s[c]},(c==="status"||c==="size")&&(l=!0));Object.keys(a).length&&(!l&&s.index>=s.size||rr(!0,l?"tour":`step:${s.index}`,"state",a))})},[t,e])}function joe(e,t,n){const r=m.useRef(e),s=m.useRef(t);return r.current=e,s.current=t,m.useCallback((i,a,l)=>{var u;const c={...n.current.getEventState(),error:null,scroll:null,step:a,type:i,...l};(u=r.current)==null||u.call(r,c,s.current),n.current.dispatch(c,s.current)},[n])}function vo(e,t){return{hasChanged(n){return e[n]!==t[n]},hasChangedTo(n,r){const s=e[n],i=t[n];return Array.isArray(r)?r.includes(s)&&!r.includes(i):s===r&&i!==r},previous:t}}function Coe(e){const{addFailure:t,controls:n,emitEvent:r,previousState:s,props:i,state:a,step:l,store:c}=e,{action:u,index:f,lifecycle:d,positioned:p,scrolling:h,size:g,status:k}=a,w=NT(l)??null,y=m.useRef(null),v=m.useRef(i),b=m.useRef(a),C=m.useRef(s),N=m.useRef(l),j=m.useRef(w),A=m.useRef(n),I=m.useRef(null),D=m.useRef(null),H=m.useRef(null);v.current=i,b.current=a,C.current=s,N.current=l,j.current=w,A.current=n;const V=()=>{I.current&&(clearInterval(I.current),I.current=null),D.current=null,H.current&&(H.current.cancel(),H.current=null)};m.useEffect(()=>{if(!C.current)return;const{hasChangedTo:F}=vo(b.current,C.current);(F("action",[Rt.NEXT,Rt.PREV,Rt.SKIP,Rt.CLOSE])||y.current===Rt.CLOSE&&u===Rt.START)&&(y.current=u)},[u]),m.useEffect(()=>{if(!C.current)return()=>{V()};const{hasChanged:F}=vo(b.current,C.current),L=N.current;if(F("index")&&V(),k!==Et.RUNNING||!L||d!==Ue.INIT)return()=>{V()};const{hasChangedTo:M}=vo(b.current,C.current);M("status",Et.RUNNING)&&[Et.IDLE,Et.READY,Et.PAUSED].includes(C.current.status)&&r(tr.TOUR_START,L),c.current.cleanupPositionData();const{debug:K}=v.current;if(L.before&&!H.current){rr(K,`step:${f}`,"before()",L),H.current={cancel:()=>{}},c.current.updateState({waiting:!0}),r(tr.STEP_BEFORE_HOOK,L,{action:y.current??b.current.action});const W=()=>{H.current=null,c.current.updateState({action:y.current??b.current.action,waiting:!1,lifecycle:Ue.READY})},$=new AbortController,R=L.beforeTimeout;H.current={cancel:()=>$.abort()};const B=R?setTimeout(()=>{$.signal.aborted||(rr(K,`step:${f}`,"before()","timed out",`${R}ms`),$.abort(),t(L,"before_hook"),r(tr.ERROR,L,{error:new Error("Step before hook timed out")}),W())},R):null;L.before({...c.current.getState(),action:y.current??c.current.getState().action,step:L}).then(()=>{$.signal.aborted||(B&&clearTimeout(B),W())}).catch(_=>{$.signal.aborted||(B&&clearTimeout(B),t(L,"before_hook"),r(tr.ERROR,L,{error:_ instanceof Error?_:new Error(String(_))}),W())})}else if(!H.current){I.current&&D.current!==L.target&&V();const W=ws(L.target);if(W&&xp(W))V(),c.current.updateState({action:y.current??Rt.UPDATE,lifecycle:Ue.READY,waiting:!1});else if(L.targetWaitTimeout===0)c.current.updateState({action:y.current??Rt.UPDATE,lifecycle:Ue.READY,waiting:!1});else if(!I.current){const{targetWaitTimeout:$}=L,R=Date.now();D.current=L.target,rr(K,`step:${f}`,"polling","started",`${$}ms`),c.current.updateState({waiting:!0}),I.current=setInterval(()=>{const B=ws(L.target),_=Date.now()-R,X=_>=$;(B&&xp(B)||X)&&(rr(K,`step:${f}`,"polling",B&&xp(B)?"found":"timed out",`${_}ms`),V(),c.current.updateState({action:y.current??Rt.UPDATE,lifecycle:Ue.READY,waiting:!1}))},100)}}return()=>{V()}},[t,r,f,d,k,c]),m.useEffect(()=>{if(!C.current)return;const{hasChanged:F,hasChangedTo:L,previous:M}=vo(b.current,C.current),K=N.current;if(!K)return;const W=ws(K.target),$=!!W;if($&&xp(W)){if(L("lifecycle",Ue.READY)&&M.lifecycle===Ue.INIT&&r(tr.STEP_BEFORE,K,{action:y.current??b.current.action}),L("lifecycle",Ue.READY)){const R=b.current,B=woe(K,R,v.current.continuous)?Ue.TOOLTIP:Ue.BEACON,_=ws(K.scrollTarget??K.spotlightTarget??K.target),X=YC({isFirstStep:R.index===0,scrollToFirstStep:v.current.scrollToFirstStep,step:K,target:_,targetLifecycle:B}),z=B===Ue.TOOLTIP?Ue.TOOLTIP_BEFORE:Ue.BEACON_BEFORE;rr(v.current.debug,`step:${f}`,"scroll",X?"needed":"skipped"),c.current.updateState({action:Rt.UPDATE,lifecycle:z,scrolling:X})}}else if(b.current.status===Et.RUNNING&&d!==Ue.INIT&&d!==Ue.COMPLETE&&F("lifecycle")){rr(v.current.debug,`step:${f}`,$?"Target not visible":"Target not mounted",K),t(K,"target_not_found"),r(tr.TARGET_NOT_FOUND,K);const R=b.current;R.controlled||c.current.updateState({action:Rt.UPDATE,index:R.index+(R.action===Rt.PREV?-1:1),lifecycle:Ue.INIT})}},[t,r,f,d,c]),m.useEffect(()=>{if(!C.current)return;const{hasChangedTo:F,previous:L}=vo(b.current,C.current),M=N.current,K=j.current;if(M&&F("lifecycle",Ue.TOOLTIP_BEFORE)&&L.lifecycle===Ue.BEACON){const R=ws(M.scrollTarget??M.spotlightTarget??M.target);if(YC({isFirstStep:b.current.index===0,scrollToFirstStep:v.current.scrollToFirstStep,step:M,target:R,targetLifecycle:Ue.TOOLTIP})){c.current.updateState({scrolling:!0,positioned:!1});return}}const W=d===Ue.BEACON_BEFORE||d===Ue.TOOLTIP_BEFORE;if(M&&W&&!h){const R=d===Ue.TOOLTIP_BEFORE?Ue.TOOLTIP:Ue.BEACON;c.current.updateState({action:Rt.UPDATE,lifecycle:R})}M&&F("lifecycle",Ue.BEACON)&&r(tr.BEACON,M),M&&F("lifecycle",Ue.TOOLTIP)&&r(tr.TOOLTIP,M);const $=b.current;if(($.status===Et.RUNNING||$.controlled&&$.status===Et.PAUSED&&M)&&K&&F("lifecycle",Ue.COMPLETE)&&L.lifecycle===Ue.TOOLTIP&&(r(tr.STEP_AFTER,K,{action:y.current??Rt.UPDATE,index:L.index??$.index,lifecycle:$.lifecycle}),K.after)){r(tr.STEP_AFTER_HOOK,K,{action:y.current??Rt.UPDATE,index:L.index??$.index,lifecycle:$.lifecycle});try{K.after({...c.current.getState(),action:y.current??Rt.UPDATE,index:L.index??$.index,lifecycle:$.lifecycle,step:K})}catch{}}},[r,d,p,h,c]),m.useEffect(()=>{if(!C.current)return;const{hasChangedTo:F,previous:L}=vo(b.current,C.current),M=N.current,K=j.current;g&&!M&&d===Ue.INIT&&c.current.updateState({action:Rt.UPDATE,lifecycle:Ue.COMPLETE,status:Et.FINISHED}),!b.current.controlled&&k===Et.RUNNING&&F("lifecycle",Ue.COMPLETE)&&f<g&&c.current.updateState({action:Rt.UPDATE,lifecycle:Ue.INIT}),F("lifecycle",Ue.COMPLETE)&&f>=g&&c.current.updateState({action:Rt.UPDATE,lifecycle:Ue.COMPLETE,status:Et.FINISHED});const W=M??K??Yk(v.current,v.current.steps[f-1]);if(W&&F("status",[Et.FINISHED,Et.SKIPPED])){let $;M?$=f:K?$=L.index??f:$=f-1,r(tr.TOUR_END,W,{index:$}),b.current.controlled||A.current.reset(),y.current=null}M&&F("action",Rt.STOP)&&(y.current=null,r(tr.TOUR_STATUS,M)),M&&F("action",Rt.RESET)&&(r(tr.TOUR_STATUS,M),y.current=null)},[u,r,f,d,g,k,c])}function _oe({controls:e,emitEvent:t,props:n,state:r,store:s}){const{debug:i,initialStepIndex:a,run:l,stepIndex:c,steps:u}=n,f=m.useRef(void 0),d=m.useRef(r),p=m.useRef(e);d.current=r,p.current=e,m.useEffect(()=>{const h=f.current;if(f.current=n,!h||n===h)return;const{hasChanged:g}=vo(n,h);if(Ok(h.steps,u)||(JT(u,i)?s.current.setSteps(u):(rr(i,"tour","Steps are not valid",u),t(tr.ERROR,u[0]??{target:"",content:""},{error:new Error("Steps are not valid")}))),g("run"))l?s.current.getState().size&&p.current.start(c??a):p.current.stop();else if(wr.number(c)&&g("stepIndex")){const k=wr.number(h.stepIndex)&&h.stepIndex<c?Rt.NEXT:Rt.PREV;[Et.FINISHED,Et.SKIPPED].includes(d.current.status)||s.current.updateState({action:k,index:c,lifecycle:Ue.INIT,positioned:!1},!0)}},[i,t,a,n,l,c,u,s])}function Eoe(e,t){var l,c,u,f;const{beaconPosition:n,lifecycle:r,scrollOffset:s,step:i}=t;if(i.scrollTarget||i.spotlightTarget)return Math.max(0,e);let a=e-i.spotlightPadding.top;if(r===Ue.BEACON_BEFORE&&(n!=null&&n.placement)){const d=Aoe(n);["bottom"].includes(n.placement)||(a+=Math.floor(d-s))}else if(r===Ue.TOOLTIP_BEFORE){const{placement:d}=i;if(d==="top"){const p=((l=document.querySelector(".react-joyride__floater"))==null?void 0:l.getBoundingClientRect().height)??0,h=(c=i.floatingOptions)!=null&&c.hideArrow?0:i.arrowSize,g=i.offset+i.spotlightPadding.top+h;a-=p+g}else if(d==="left"||d==="right"){const p=((u=document.querySelector(".react-joyride__floater"))==null?void 0:u.getBoundingClientRect().height)??0,h=((f=ws(i.target))==null?void 0:f.getBoundingClientRect().height)??0,g=s+i.spotlightPadding.top+h/2-p/2;g<s&&(a-=s-g)}}return Math.max(0,a)}function Aoe(e){var n;const t=(n=e.middlewareData)==null?void 0:n.offset;return t?["left","right"].some(r=>e.placement.startsWith(r))?t.x:t.y:0}function Poe({emitEvent:e,previousState:t,props:n,state:r,step:s,store:i}){const{index:a,lifecycle:l,positioned:c,scrolling:u,status:f}=r,d=m.useRef(null),p=m.useRef(r),h=m.useRef(t),g=m.useRef(n),k=m.useRef(s);p.current=r,h.current=t,g.current=n,k.current=s,m.useEffect(()=>()=>{var w;(w=d.current)==null||w.call(d)},[]),m.useEffect(()=>{var N;if(!h.current||!k.current)return;const{hasChangedTo:w}=vo(p.current,h.current),y=k.current,{debug:v}=g.current,{scrollDuration:b}=y,C=l===Ue.BEACON_BEFORE||l===Ue.TOOLTIP_BEFORE;if(f===Et.RUNNING&&C&&u&&w("positioned",!0)){const j=ws(y.scrollTarget??y.spotlightTarget??y.target),A=i.current.getPositionData("beacon"),I=Cc(j),D=I?!I.isSameNode(Br()):!1;(N=d.current)==null||N.call(d),(async()=>{if(D&&!_c(I)){const $=Br(),R=foe(I),B={initial:$.scrollTop,target:R,element:$,duration:b};e(tr.SCROLL_START,y,{scroll:B});const{cancel:_,promise:X}=GC(R,{element:$,duration:b});d.current=_,await X,e(tr.SCROLL_END,y,{scroll:B})}const V=Math.floor(poe(j,y.scrollOffset))||0,F=D?V:Eoe(V,{beaconPosition:A,lifecycle:l,scrollOffset:y.scrollOffset,step:y});rr(v,`step:${a}`,"scroll",D?"custom":"document",`${V} → ${F}`);const L=I,M={initial:L.scrollTop,target:F,element:L,duration:b};e(tr.SCROLL_START,y,{scroll:M});const{cancel:K,promise:W}=GC(F,{element:L,duration:b});d.current=K,await W,e(tr.SCROLL_END,y,{scroll:M}),i.current.updateState({scrolling:!1})})().catch(()=>{i.current.updateState({scrolling:!1})})}},[e,a,l,c,u,f,i])}function Ioe(e){const t=pse(()=>loe(ioe,e),[e]),{debug:n,initialStepIndex:r,onEvent:s,run:i,stepIndex:a,steps:l}=t,c=m.useRef(koe(t)),u=zP.useSyncExternalStore(c.current.subscribe,c.current.getSnapshot,c.current.getServerSnapshot),[f,d]=m.useState([]),p=m.useCallback((N,j)=>{d(A=>[...A,{reason:j,step:N}])},[]),h=m.useCallback(()=>{d([])},[]);Noe(c,n);const g=voe(c,n,h),k=joe(s,g,c),{index:w,size:y,status:v}=u,b=NT(u),C=m.useMemo(()=>Yk(t,l[w]),[w,t,l]);return hse(()=>{i&&y&&JT(l,n)&&g.start(a??r)}),fse(()=>{i&&y&&v===Et.IDLE&&c.current.updateState({status:Et.READY})},[i,y,v]),_oe({controls:g,emitEvent:k,props:t,state:u,store:c}),Coe({addFailure:p,controls:g,emitEvent:k,previousState:b,props:t,state:u,step:C,store:c}),Poe({emitEvent:k,previousState:b,props:t,state:u,step:C,store:c}),{controls:g,failures:f,mergedProps:t,state:u,step:C,store:c}}function Roe(e){const[t,n]=m.useState(null);return m.useEffect(()=>{let r=null,s=!1;if(e)if(wr.domElement(e))r=e,s=!0;else{const i=document.querySelector(e);i&&(r=i)}else{const i=document.createElement("div");i.id=ooe,document.body.appendChild(i),r=i}return n(r),()=>{!r||s||r.parentNode===document.body&&document.body.removeChild(r)}},[e]),t}const Toe={animation:"joyride-loader-spin 1s linear infinite",border:"5px solid rgba(0, 0, 0, 0.1)",borderRadius:"50%",borderTopColor:"#555"};function Moe({nonce:e,step:t}){const{loaderComponent:n}=t,r=!!n;if(m.useEffect(()=>{if(r||document.getElementById("joyride-loader-animation"))return Ad;const c=document.createElement("style");return c.id="joyride-loader-animation",e&&c.setAttribute("nonce",e),c.appendChild(document.createTextNode(`
|
|
319
|
-
@keyframes joyride-loader-spin {
|
|
320
|
-
to { transform: rotate(360deg); }
|
|
321
|
-
}
|
|
322
|
-
`)),document.head.appendChild(c),()=>{const u=document.getElementById("joyride-loader-animation");u!=null&&u.parentNode&&u.parentNode.removeChild(u)}},[r,e]),n===null)return null;const{height:s,width:i,...a}=t.styles.loader;let l;if(n){const c=n;l=ot.createElement(c,{step:t})}else l=ot.createElement("div",{style:{...Toe,height:s,width:i,borderTopColor:t.primaryColor}});return ot.createElement("div",{className:"react-joyride__loader","data-testid":"loader",style:a},l)}const $oe={height:0,isFixed:!1,left:0,top:0,width:0};function hu(e,t){const n=ws(e);if(!n)return $oe;const r=qk(n),s=_c(n),i=doe(n,t.top,s);return{height:Math.round(((r==null?void 0:r.height)??0)+t.top+t.bottom),isFixed:s,left:Math.round(((r==null?void 0:r.left)??0)-t.left),top:i,width:Math.round(((r==null?void 0:r.width)??0)+t.left+t.right)}}function Loe(e,t,n){const[r,s]=m.useState(()=>hu(e,t)),i=m.useRef(void 0),a=m.useRef(null),l=m.useRef(n),c=m.useRef(null),u=m.useCallback(()=>{clearTimeout(i.current),i.current=window.setTimeout(()=>{s(d=>{const p=hu(e,t);return d.top===p.top&&d.left===p.left&&d.width===p.width&&d.height===p.height&&d.isFixed===p.isFixed?d:p})},100)},[e,t]);m.useEffect(()=>{let d=null;const p=g=>{a.current=Cc(g,!0),a.current&&a.current.addEventListener("scroll",u,{passive:!0}),window.addEventListener("scroll",u,{passive:!0}),window.addEventListener("resize",u),typeof ResizeObserver<"u"&&(c.current=new ResizeObserver(u),c.current.observe(g)),s(hu(e,t))},h=ws(e);return h?p(h):(d=new MutationObserver(()=>{const g=ws(e);g&&(d==null||d.disconnect(),d=null,p(g))}),d.observe(document.body,{childList:!0,subtree:!0})),()=>{var g;d==null||d.disconnect(),a.current&&a.current.removeEventListener("scroll",u),window.removeEventListener("scroll",u),window.removeEventListener("resize",u),(g=c.current)==null||g.disconnect(),clearTimeout(i.current)}},[e,t,u]),m.useEffect(()=>{l.current&&!n&&s(hu(e,t)),l.current=n},[n,e,t]);let f=r;return l.current&&!n&&(f=hu(e,t)),f}function Ooe(e,t,n){let r=`M0 0H${e}V${t}H0Z`;return n&&(r+=` ${n}`),r}function XC(e,t,n,r,s){if(n<=0||r<=0)return"";const i=Math.max(0,Math.min(s,n/2,r/2));let a=`M${e+i} ${t}`;return a+=`H${e+n-i}`,a+=`A${i} ${i} 0 0 1 ${e+n} ${t+i}`,a+=`V${t+r-i}`,a+=`A${i} ${i} 0 0 1 ${e+n-i} ${t+r}`,a+=`H${e+i}`,a+=`A${i} ${i} 0 0 1 ${e} ${t+r-i}`,a+=`V${t+i}`,a+=`A${i} ${i} 0 0 1 ${e+i} ${t}Z`,a}const Doe=[Ue.BEACON_BEFORE,Ue.BEACON];function Foe(e){var W,$;const{blockTargetInteraction:t,continuous:n,hideOverlay:r,lifecycle:s,onClickOverlay:i,overlayClickAction:a,placement:l,portalElement:c,scrolling:u,spotlightPadding:f,spotlightRadius:d,spotlightTarget:p,styles:h,target:g,waiting:k}=e,w=mse(),y=Loe(p??g,f,u||k),v=m.useRef(null),b=(s===Ue.TOOLTIP||s===Ue.TOOLTIP_BEFORE)&&l!=="center",[C,N]=m.useState(!1),j=c?(W=v.current)==null?void 0:W.offsetParent:null,A=(j==null?void 0:j.clientWidth)??w.width,I=(j==null?void 0:j.clientHeight)??uoe()??w.height,D=(($=h.overlay)==null?void 0:$.backgroundColor)??"rgba(0, 0, 0, 0.5)",H=m.useMemo(()=>{const{backgroundColor:R,mixBlendMode:B,..._}=h.overlay;return{height:I,pointerEvents:"none",..._}},[I,h.overlay]),V=b&&!u&&!k;m.useEffect(()=>{V?requestAnimationFrame(()=>N(!0)):N(!1)},[V]);const F=n&&Doe.includes(s),L=!n&&s!==Ue.TOOLTIP;if(r||!k&&(F||L))return null;let M="";if(V)if(c&&j){const R=ws(p??g);if(R){const B=qC(R),_=qC(j);M=XC(B.left-_.left-f.left,B.top-_.top-f.top,R.offsetWidth+f.left+f.right,R.offsetHeight+f.top+f.bottom,d)}}else M=XC(y.left,y.top,y.width,y.height,d);const K=Ooe(A,I,M);return ot.createElement("div",{ref:v,"aria-hidden":"true",className:"react-joyride__overlay","data-testid":"overlay",style:H},ot.createElement("svg",{className:"react-joyride__spotlight","data-testid":"spotlight",style:{height:I,left:0,position:y.isFixed?"fixed":"absolute",top:0,width:A}},ot.createElement("path",{d:K,fill:D,fillRule:"evenodd",onClick:i,style:{cursor:a?"pointer":"default",pointerEvents:"auto"}}),M&&ot.createElement("path",{d:M,fill:D,style:{opacity:C?0:1,pointerEvents:t?"auto":"none",transition:"opacity 0.2s"}}),M&&Object.keys(h.spotlight).length>0&&ot.createElement("path",{d:M,fill:"none",style:{pointerEvents:"none"},...h.spotlight})))}function XT(e){const{children:t,element:n}=e;return n?cr.createPortal(t,n):null}const zoe='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), area[href], [tabindex]:not([tabindex="-1"]), [contenteditable]';function Boe(e,t){const n=m.useRef(null);m.useEffect(()=>{if(!e)return Ad;n.current=document.activeElement;const r=i=>{if(i.key!=="Tab")return;const a=[...e.querySelectorAll(zoe)],{shiftKey:l}=i;if(!a.length)return;i.preventDefault();let c=document.activeElement?a.indexOf(document.activeElement):0;c===-1||!l&&c+1===a.length?c=0:l&&c===0?c=a.length-1:c+=l?-1:1,a[c].focus()};e.addEventListener("keydown",r,!1);let s;{const i=e.querySelector(t);i&&(s=setTimeout(()=>{i.focus({preventScroll:!0})},100))}return()=>{var i;e.removeEventListener("keydown",r),s!==void 0&&clearTimeout(s),(i=n.current)==null||i.focus({preventScroll:!0})}},[e,t])}function Ki(e,t,n){const[r]=e.split("-");switch(r){case"top":case"bottom":return{width:t,height:n};case"left":case"right":return{width:n,height:t};default:return null}}function Hoe(e,t,n){const[r]=e.split("-");switch(r){case"top":return{points:`0,0 ${t/2},${n} ${t},0`,...Ki(e,t,n)};case"bottom":return{points:`${t},${n} ${t/2},0 0,${n}`,...Ki(e,t,n)};case"left":return{points:`0,0 ${n},${t/2} 0,${t}`,...Ki(e,t,n)};case"right":return{points:`${n},${t} ${n},0 0,${t/2}`,...Ki(e,t,n)};default:return null}}function Woe(e,t,n,r){if(!t)return{};const[s]=e.split("-");switch(s){case"top":return{bottom:-n,left:t.x??0,...Ki(e,r,n)};case"bottom":return{top:-n,left:t.x??0,...Ki(e,r,n)};case"left":return{right:-n,top:t.y??0,...Ki(e,r,n)};case"right":return{left:-n,top:t.y??0,...Ki(e,r,n)};default:return{}}}function Voe({arrowComponent:e,arrowRef:t,base:n,placement:r,position:s,size:i,styles:a}){const l=e;let c=null;if(l){if(!Ki(r,n,i))return null;c=ot.createElement("span",{style:{flexShrink:0}},ot.createElement(l,{base:n,placement:r,size:i}))}else{const u=Hoe(r,n,i);if(!u)return null;c=ot.createElement("svg",{height:u.height,width:u.width,xmlns:"http://www.w3.org/2000/svg"},ot.createElement("polygon",{fill:"currentColor",points:u.points}))}return ot.createElement("span",{ref:t,className:"react-joyride__arrow","data-testid":"arrow",style:{...a,...Woe(r,s,i,n),...s?{}:{visibility:"hidden"}}},c)}function Koe(e){const{beaconComponent:t,continuous:n,index:r,isLastStep:s,locale:i,nonce:a,onInteract:l,shouldFocus:c,size:u,step:f,styles:d}=e,p=m.useRef(null),h=!!t;m.useEffect(()=>{if(h||document.getElementById("joyride-beacon-animation"))return Ad;const w=document.createElement("style");w.id="joyride-beacon-animation",a&&w.setAttribute("nonce",a),w.appendChild(document.createTextNode(`
|
|
323
|
-
@keyframes joyride-beacon-inner {
|
|
324
|
-
20% {
|
|
325
|
-
opacity: 0.9;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
90% {
|
|
329
|
-
opacity: 0.7;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
@keyframes joyride-beacon-outer {
|
|
334
|
-
0% {
|
|
335
|
-
transform: scale(1);
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
45% {
|
|
339
|
-
opacity: 0.7;
|
|
340
|
-
transform: scale(0.75);
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
100% {
|
|
344
|
-
opacity: 0.9;
|
|
345
|
-
transform: scale(1);
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
`)),document.head.appendChild(w);const y=setTimeout(()=>{wr.domElement(p.current)&&c&&p.current.focus()},0);return()=>{clearTimeout(y);const v=document.getElementById("joyride-beacon-animation");v!=null&&v.parentNode&&v.parentNode.removeChild(v)}},[h,a,c]);const g=Fi(i.open);let k;if(t){const w=t;k=ot.createElement(w,{continuous:n,index:r,isLastStep:s,size:u,step:f})}else k=ot.createElement("span",{style:d.beacon},ot.createElement("span",{style:d.beaconOuter}),ot.createElement("span",{style:d.beaconInner}));return ot.createElement("button",{ref:p,"aria-label":g,className:"react-joyride__beacon","data-testid":"button-beacon",onClick:l,onMouseEnter:l,style:d.beaconWrapper,title:g,type:"button"},k)}function Uoe({styles:e,...t}){const{color:n,height:r,width:s,...i}=e;return ot.createElement("button",{style:i,type:"button",...t},ot.createElement("svg",{height:typeof r=="number"?`${r}px`:r,preserveAspectRatio:"xMidYMid",version:"1.1",viewBox:"0 0 18 18",width:typeof s=="number"?`${s}px`:s,xmlns:"http://www.w3.org/2000/svg"},ot.createElement("g",null,ot.createElement("path",{d:"M8.13911129,9.00268191 L0.171521827,17.0258467 C-0.0498027049,17.248715 -0.0498027049,17.6098394 0.171521827,17.8327545 C0.28204354,17.9443526 0.427188206,17.9998706 0.572051765,17.9998706 C0.71714958,17.9998706 0.862013139,17.9443526 0.972581703,17.8327545 L9.0000937,9.74924618 L17.0276057,17.8327545 C17.1384085,17.9443526 17.2832721,17.9998706 17.4281356,17.9998706 C17.5729992,17.9998706 17.718097,17.9443526 17.8286656,17.8327545 C18.0499901,17.6098862 18.0499901,17.2487618 17.8286656,17.0258467 L9.86135722,9.00268191 L17.8340066,0.973848225 C18.0553311,0.750979934 18.0553311,0.389855532 17.8340066,0.16694039 C17.6126821,-0.0556467968 17.254037,-0.0556467968 17.0329467,0.16694039 L9.00042166,8.25611765 L0.967006424,0.167268345 C0.745681892,-0.0553188426 0.387317931,-0.0553188426 0.165993399,0.167268345 C-0.0553311331,0.390136635 -0.0553311331,0.751261038 0.165993399,0.974176179 L8.13920499,9.00268191 L8.13911129,9.00268191 Z",fill:n}))))}function qoe(e){const{backProps:t,closeProps:n,index:r,isLastStep:s,primaryProps:i,skipProps:a,step:l,tooltipProps:c}=e,{buttons:u,content:f,styles:d,title:p}=l,h={};u.includes("primary")&&(h.primary=ot.createElement("button",{"data-testid":"button-primary",style:d.buttonPrimary,type:"button",...i})),u.includes("skip")&&!s&&(h.skip=ot.createElement("button",{"aria-live":"off","data-testid":"button-skip",style:d.buttonSkip,type:"button",...a})),u.includes("back")&&r>0&&(h.back=ot.createElement("button",{"data-testid":"button-back",style:d.buttonBack,type:"button",...t})),h.close=u.includes("close")&&ot.createElement(Uoe,{"data-testid":"button-close",styles:d.buttonClose,...n});const g=p?{"aria-labelledby":"joyride-tooltip-title","aria-describedby":"joyride-tooltip-content"}:{"aria-label":Fi(f),"aria-describedby":"joyride-tooltip-content"};return ot.createElement("div",{key:"JoyrideTooltip",className:"react-joyride__tooltip","data-joyride-step":r,...l.id&&{"data-joyride-id":l.id},style:d.tooltip,...c,...g},ot.createElement("div",{style:d.tooltipContainer},p&&ot.createElement("h4",{id:"joyride-tooltip-title",style:d.tooltipTitle},p),ot.createElement("div",{id:"joyride-tooltip-content",style:d.tooltipContent},f)),u.some(k=>k==="back"||k==="primary"||k==="skip")&&ot.createElement("div",{style:d.tooltipFooter},ot.createElement("div",{style:d.tooltipFooterSpacer},h.skip),h.back,h.primary),h.close)}function Yoe(e){const{continuous:t,controls:n,index:r,isLastStep:s,size:i,step:a}=e,l=y=>{y.preventDefault(),n.prev(ci.BUTTON_BACK)},c=y=>{y.preventDefault(),a.closeButtonAction==="skip"?n.skip(ci.BUTTON_CLOSE):n.close(ci.BUTTON_CLOSE)},u=y=>{if(y.preventDefault(),!t){n.close(ci.BUTTON_PRIMARY);return}n.next(ci.BUTTON_PRIMARY)},f=y=>{y.preventDefault(),n.skip(ci.BUTTON_SKIP)},d=()=>{const{back:y,close:v,last:b,next:C,nextWithProgress:N,skip:j}=a.locale,A=Fi(y),I=Fi(v),D=Fi(b),H=Fi(C),V=Fi(j);let F=v,L=I;if(t){if(F=C,L=H,a.showProgress&&!s){const M=Fi(N,{step:r+1,steps:i});F=Ww(N,r+1,i),L=M}s&&(F=b,L=D)}return{backProps:{"aria-label":A,children:y,"data-action":"back",onClick:l,role:"button",title:A},closeProps:{"aria-label":I,children:v,"data-action":"close",onClick:c,role:"button",title:I},primaryProps:{"aria-label":L,children:F,"data-action":"primary",onClick:u,role:"button",title:L},skipProps:{"aria-label":V,children:j,"data-action":"skip",onClick:f,role:"button",title:V},tooltipProps:{"aria-modal":!0,role:"alertdialog"}}},{arrowComponent:p,beaconComponent:h,tooltipComponent:g,...k}=a;let w;if(g){const y=g;w=ot.createElement(y,{...d(),continuous:t,controls:n,index:r,isLastStep:s,size:i,step:k})}else w=ot.createElement(qoe,{...d(),continuous:t,controls:n,index:r,isLastStep:s,size:i,step:k});return w}function Goe(e){if(e.startsWith("left"))return["top","bottom"];if(e.startsWith("right"))return["bottom","top"]}function Joe(e,t,n){var r,s;return e?[eoe()]:((r=t.floatingOptions)==null?void 0:r.flipOptions)===!1?[]:[Zie({crossAxis:!1,fallbackPlacements:Goe(n),padding:20,...(s=t.floatingOptions)==null?void 0:s.flipOptions})]}function Xoe(e){var B,_,X,z,T;const{continuous:t,controls:n,index:r,lifecycle:s,nonce:i,open:a,portalElement:l,setPositionData:c,setTooltipRef:u,shouldScroll:f,size:d,step:p,target:h,updateState:g}=e,k=m.useRef(null),w=m.useRef({}),y=m.useRef({}),v=p.placement==="center",b=p.placement==="auto",C=m.useMemo(()=>({getBoundingClientRect:()=>({x:window.innerWidth/2,y:window.innerHeight/2,top:window.innerHeight/2,left:window.innerWidth/2,bottom:window.innerHeight/2,right:window.innerWidth/2,width:0,height:0})}),[]),N=m.useMemo(()=>qT(h)?Cc(h):void 0,[h]),j=m.useMemo(()=>_c(h),[h]),A=m.useMemo(()=>N?{boundary:N,rootBoundary:"viewport"}:{},[N]),I=v||b?"bottom":p.placement,D=v?"fixed":((B=p.floatingOptions)==null?void 0:B.strategy)??(p.isFixed||j?"fixed":"absolute"),H=m.useMemo(()=>{var Z,ae,J,se;return v?[{name:"center",fn:({rects:ee})=>({x:(window.innerWidth-ee.floating.width)/2,y:(window.innerHeight-ee.floating.height)/2})}]:[VC(({placement:ee})=>{var ue;let re="right";ee.startsWith("top")?re="top":ee.startsWith("bottom")?re="bottom":ee.startsWith("left")&&(re="left");const ne=p.spotlightTarget?0:p.spotlightPadding[re];return p.offset+ne+((ue=p.floatingOptions)!=null&&ue.hideArrow?0:p.arrowSize)},[p.offset,p.spotlightPadding,p.spotlightTarget,p.arrowSize,(Z=p.floatingOptions)==null?void 0:Z.hideArrow]),...Joe(b,p,I),Qie({padding:10,...A,...(ae=p.floatingOptions)==null?void 0:ae.shiftOptions}),...(J=p.floatingOptions)!=null&&J.hideArrow?[]:[toe({element:k,padding:p.arrowSpacing},[p.arrowSpacing,p.arrowBase])],...((se=p.floatingOptions)==null?void 0:se.middleware)??[]]},[v,p,b,I,A]),V=WC({...v?{elements:{reference:C}}:{},placement:I,strategy:D,middleware:H}),F=WC({strategy:D,placement:p.beaconPlacement??(b||v?"bottom":p.placement),middleware:m.useMemo(()=>{var Z,ae;return[VC(((ae=(Z=p.floatingOptions)==null?void 0:Z.beaconOptions)==null?void 0:ae.offset)??-18)]},[(X=(_=p.floatingOptions)==null?void 0:_.beaconOptions)==null?void 0:X.offset]),whileElementsMounted:zC});y.current=V.middlewareData,w.current=F.middlewareData,m.useEffect(()=>{var J;const{floating:Z,reference:ae}=V.elements;if(!(!ae||!Z||s!==Ue.TOOLTIP))return zC(ae,Z,V.update,(J=p.floatingOptions)==null?void 0:J.autoUpdate)},[s,V.update,(z=p.floatingOptions)==null?void 0:z.autoUpdate,p.target,V.elements]),m.useEffect(()=>{!v&&h&&V.refs.setReference(h),h&&F.refs.setReference(h)},[F.refs,v,h,V.refs]),m.useEffect(()=>{V.isPositioned&&c("tooltip",{placement:V.placement,x:V.x??0,y:V.y??0,middlewareData:y.current})},[c,V.isPositioned,V.placement,V.x,V.y]),m.useEffect(()=>{F.isPositioned&&c("beacon",{placement:F.placement,x:F.x??0,y:F.y??0,middlewareData:w.current})},[c,F.isPositioned,F.placement,F.x,F.y]);const L=p.zIndex+100,M=m.useCallback(Z=>{Z.type==="mouseenter"&&p.beaconTrigger!=="hover"||g({lifecycle:Ue.TOOLTIP_BEFORE,positioned:!1})},[p.beaconTrigger,g]),K=m.useCallback(Z=>{Z&&(V.refs.setFloating(Z),u(Z))},[V.refs,u]),{arrow:W,floater:$}=p.styles;let R=null;if(s===Ue.TOOLTIP||s===Ue.TOOLTIP_BEFORE){const Z=UC({...$,...V.floatingStyles,zIndex:L,opacity:a&&V.isPositioned?1:0,...!a&&{transition:"none"}});R=ot.createElement("div",{ref:K,className:"react-joyride__floater","data-testid":"floater",id:`react-joyride-step-${r}`,style:Z},ot.createElement(Yoe,{continuous:t,controls:n,index:r,isLastStep:r+1===d,size:d,step:p}),!v&&!((T=p.floatingOptions)!=null&&T.hideArrow)&&ot.createElement(Voe,{arrowComponent:p.arrowComponent,arrowRef:k,base:p.arrowBase,placement:V.placement,position:V.middlewareData.arrow,size:p.arrowSize,styles:W}))}else(s===Ue.BEACON||s===Ue.BEACON_BEFORE)&&(R=ot.createElement("div",{ref:F.refs.setFloating,className:"react-joyride__floater","data-testid":"floater-beacon",id:`react-joyride-step-${r}-beacon`,style:UC({...F.floatingStyles,zIndex:L})},ot.createElement(Koe,{beaconComponent:p.beaconComponent,continuous:t,index:r,isLastStep:r+1===d,locale:p.locale,nonce:i,onInteract:M,shouldFocus:f,size:d,step:p,styles:p.styles})));return ot.createElement(XT,{element:l},R)}function Qoe(e){const{continuous:t,controls:n,index:r,lifecycle:s,nonce:i,portalElement:a,setPositionData:l,shouldScroll:c,size:u,step:f,updateState:d}=e,[p,h]=m.useState(null);Boe(f.disableFocusTrap?null:p,"[data-action=primary]");const g=ws(f.target),k=s===Ue.TOOLTIP;return!GT(f)||!wr.domElement(g)?null:ot.createElement(Xoe,{key:`JoyrideStep-${r}`,continuous:t,controls:n,index:r,lifecycle:s,nonce:i,open:k,portalElement:a,setPositionData:l,setTooltipRef:h,shouldScroll:c,size:u,step:f,target:g,updateState:d})}function Zoe({controls:e,mergedProps:t,state:n,step:r,store:s}){const{continuous:i,debug:a,nonce:l,portalElement:c,scrollToFirstStep:u}=t,f=Roe(c),{index:d,lifecycle:p,status:h}=n,g=h===Et.RUNNING,[k,w]=m.useState(!1),y=m.useRef(null),v=(r==null?void 0:r.loaderDelay)??0;m.useEffect(()=>(n.waiting?v===0?w(!0):y.current=setTimeout(()=>{w(!0)},v):w(!1),()=>{y.current&&(clearTimeout(y.current),y.current=null)}),[v,n.waiting]),m.useEffect(()=>{if(!g)return;const N=j=>{!r||p!==Ue.TOOLTIP||j.key==="Escape"&&r.dismissKeyAction&&(r.dismissKeyAction==="next"?e.next(ci.KEYBOARD):e.close(ci.KEYBOARD))};return document.body.addEventListener("keydown",N,{passive:!0}),()=>{document.body.removeEventListener("keydown",N)}},[e,g,p,r]);const b=m.useCallback(()=>{(r==null?void 0:r.overlayClickAction)==="close"?e.close(ci.OVERLAY):(r==null?void 0:r.overlayClickAction)==="next"&&e.next(ci.OVERLAY)},[e,r==null?void 0:r.overlayClickAction]);if(!r||!g)return null;const C=n.action===Rt.START&&!r.skipBeacon&&r.placement!=="center";return ot.createElement(ot.Fragment,null,p!==Ue.INIT&&ot.createElement(Qoe,{...n,continuous:i,controls:e,debug:a,nonce:l,portalElement:f,setPositionData:s.current.setPositionData,shouldScroll:!r.skipScroll&&(d!==0||u),step:r,updateState:s.current.updateState}),ot.createElement(XT,{element:f},ot.createElement(ot.Fragment,null,k&&ot.createElement(Moe,{nonce:l,step:r}),!C&&ot.createElement(Foe,{...r,continuous:i,lifecycle:p,onClickOverlay:b,portalElement:c?f:null,scrolling:n.scrolling,waiting:n.waiting}))))}function eae(e){const{controls:t,failures:n,mergedProps:r,state:s,step:i,store:a}=Ioe(e);return{controls:t,failures:n,on:m.useCallback((l,c)=>a.current.on(l,c),[a]),state:m.useMemo(()=>Qh(s,"positioned"),[s]),step:i,Tour:Uk()?ot.createElement(Zoe,{controls:t,mergedProps:r,state:s,step:i,store:a}):null}}function tae(e){const{Tour:t}=eae(e);return t}function nae(e){return Uk()?ot.createElement(tae,e):null}function rae(e){return[{target:"body",content:e("onboarding:projects.intro"),disableBeacon:!0,placement:"center"},{target:".af-hub-card",content:e("onboarding:projects.hubIntro"),disableBeacon:!0,placement:"left"}]}function sae(e){return[{target:"body",content:e("onboarding:flow.intro"),disableBeacon:!0,placement:"center"}]}function iae(e){return[{target:"body",content:e("onboarding:flow.introEmpty"),disableBeacon:!0,placement:"center"}]}const bp="af:onboarding";function oae({page:e,hasNodes:t=!1}){const{t:n}=Ir(),[r,s]=m.useState(!1),[i,a]=m.useState([]),l=m.useRef(null),c=m.useMemo(()=>e==="projects"?rae(n):t?sae(n):iae(n),[e,t,n]);return m.useEffect(()=>{const u=localStorage.getItem(bp),f=u?JSON.parse(u):{};if(f.completed||f[e]){s(!1),a([]);return}localStorage.setItem(bp,JSON.stringify({...f,[e]:!0})),a(c),s(!0)},[e,t,c]),m.useEffect(()=>{if(!r)return;const u=f=>{var g;const d=f.target.closest("button");if(!d||!d.closest(".react-joyride__tooltip"))return;const h=(g=d.textContent)==null?void 0:g.trim();if(h===n("onboarding:done")||h===n("onboarding:startCreate")||h===n("onboarding:skip")){const k=localStorage.getItem(bp)||"{}",w=JSON.parse(k);h===n("onboarding:skip")?(w.projects=!0,w.flow=!0,w.completed=!0):w[e]=!0,localStorage.setItem(bp,JSON.stringify(w)),a([]),s(!1),e==="projects"&&(h===n("onboarding:done")||h===n("onboarding:startCreate"))&&(localStorage.setItem("af:newPipelineGuide","true"),setTimeout(()=>{const y=document.querySelector(".af-create-btn");y&&y.click()},500))}};return document.addEventListener("click",u,!0),()=>document.removeEventListener("click",u,!0)},[r,e,n]),!r||i.length===0?null:o.jsx(nae,{ref:l,steps:i,run:r,continuous:!0,showSkipButton:!0,showProgress:i.length>1,styles:{options:{primaryColor:"#7c4dff",textColor:"#ffffff",backgroundColor:"#1a1a1a",arrowColor:"#1a1a1a",overlayColor:"rgba(0, 0, 0, 0.4)",zIndex:1e4},tooltip:{borderRadius:"1.5rem",padding:"1.5rem"},buttonNext:{borderRadius:"9999px",padding:"0.625rem 1.5rem"},buttonSkip:{borderRadius:"9999px",color:"#9ecaff"},buttonClose:{display:"none"}},locale:{back:n("onboarding:back"),next:n("onboarding:next"),skip:n("onboarding:skip"),last:n(e==="projects"?"onboarding:startCreate":"onboarding:done")},floaterProps:{disableAnimation:!0},scrollToFirstStep:!0})}function aae(){const{navigate:e,path:t}=Ni(),[n,r]=m.useState([]),[s,i]=m.useState(!1);if(m.useEffect(()=>{let f=!1;const d=async()=>{try{const h=await fetch("/api/pipeline-recent-runs");if(!h.ok)return;const g=await h.json();if(f)return;const k=Array.isArray(g.runs)?g.runs:[];r(k.filter(w=>w&&w.status==="running"))}catch{}};d();const p=window.setInterval(d,3e3);return()=>{f=!0,window.clearInterval(p)}},[]),n.length===0)return null;const a=f=>{const d=new URLSearchParams({flowId:f.flowId,flowSource:f.flowSource||"workspace"});e(`/flow?${d.toString()}`),i(!1)},l=t==="/flow"?new URLSearchParams(window.location.search):null,c=(l==null?void 0:l.get("flowId"))||"",u=n.length===1;return o.jsxs("div",{className:"af-run-indicator",role:"status","aria-live":"polite",children:[s&&!u&&o.jsx("div",{className:"af-run-indicator__menu",onMouseLeave:()=>i(!1),children:n.map(f=>o.jsxs("button",{type:"button",className:"af-run-indicator__item"+(f.flowId===c?" af-run-indicator__item--current":""),onClick:()=>a(f),title:`${f.flowId} · ${f.runId}`,children:[o.jsx("span",{className:"af-run-indicator__dot"}),o.jsx("span",{className:"af-run-indicator__flow",children:f.flowId}),o.jsx("span",{className:"af-run-indicator__run",children:f.runId.slice(0,12)})]},`${f.flowId}:${f.runId}`))}),o.jsxs("button",{type:"button",className:"af-run-indicator__btn",onClick:()=>u?a(n[0]):i(f=>!f),title:u?`${n[0].flowId} 运行中,点击跳转`:`${n.length} 个 pipeline 运行中`,children:[o.jsx("span",{className:"af-run-indicator__pulse"}),o.jsx("span",{className:"af-run-indicator__label",children:u?n[0].flowId:`${n.length} running`})]})]})}function QT(e){return e==="/likee-context"||e==="/likee_context"}function lae(){const{navigate:e}=Ni();return m.useEffect(()=>{const t=new URLSearchParams(window.location.search),n=new URLSearchParams,r=t.get("flowId")||"",s=t.get("flowSource")||"";r&&n.set("flowId",r),s&&n.set("flowSource",s),t.get("flowArchived")&&n.set("archived",t.get("flowArchived")),e(`/workspace${n.toString()?`?${n.toString()}`:""}`)},[e]),null}class cae extends m.Component{constructor(t){super(t),this.state={error:null,info:null}}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,n){console.error("[AgentFlow UI render error]",t,n),this.setState({error:t,info:n})}render(){var r,s,i;if(!this.state.error)return this.props.children;const t=String(((r=this.state.error)==null?void 0:r.stack)||((s=this.state.error)==null?void 0:s.message)||this.state.error),n=String(((i=this.state.info)==null?void 0:i.componentStack)||"");return o.jsx("div",{className:"af-auth-screen",children:o.jsxs("div",{className:"af-auth-panel af-ui-error-panel",children:[o.jsxs("div",{className:"af-auth-brand",children:[o.jsx("span",{className:"material-symbols-outlined",children:"error"}),o.jsxs("div",{children:[o.jsx("h1",{children:"AgentFlow UI Error"}),o.jsx("p",{children:"页面渲染失败,下面是调试堆栈。"})]})]}),o.jsx("pre",{children:t}),n?o.jsx("pre",{children:n}):null]})})}}function uae({authUser:e}){const{path:t}=Ni();return t==="/projects"||t==="/"?o.jsx(pl,{authUser:e}):t==="/nodes"?o.jsx(pl,{authUser:e,resourceKind:"nodes"}):t==="/my-nodes"?o.jsx(pl,{authUser:e,resourceKind:"my-nodes"}):t==="/my-flows"?o.jsx(pl,{authUser:e,resourceKind:"my-flows"}):t==="/skills"?o.jsx(pl,{authUser:e,resourceKind:"skills"}):t==="/workspaces"?o.jsx(Vre,{authUser:e}):t==="/mcps"?o.jsx(Tre,{}):t==="/schedules"?o.jsx(Lre,{}):t==="/node-studio"?o.jsx(Dre,{}):t==="/flow"?o.jsx(lae,{}):t==="/workspace"?o.jsx(GY,{}):t.startsWith("/display")?o.jsx(cT,{}):t==="/settings"?o.jsx(vre,{authUser:e}):t==="/admin/usage"?o.jsx(Cre,{authUser:e}):t==="/feedback"?o.jsx(Ere,{authUser:e}):QT(t)?o.jsx(vT,{}):o.jsx(pl,{})}function dae({children:e}){const[t,n]=m.useState({loading:!0,authenticated:!1,user:null,setupRequired:!1}),[r,s]=m.useState(""),[i,a]=m.useState(""),[l,c]=m.useState(!1),[u,f]=m.useState(""),d=async()=>{try{const g=await(await fetch("/api/auth/me")).json().catch(()=>({}));n({loading:!1,authenticated:!!g.authenticated,user:g.user||null,setupRequired:!!g.setupRequired}),f(g.error?String(g.error):"")}catch(h){n({loading:!1,authenticated:!1,user:null,setupRequired:!1}),f(String(h.message||h))}};m.useEffect(()=>{d()},[]);const p=async h=>{h.preventDefault(),c(!0),f("");try{const g=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:r,password:i})}),k=await g.json().catch(()=>({}));if(!g.ok)throw new Error(k.error||"登录失败");n({loading:!1,authenticated:!0,user:k.user||null,setupRequired:!1})}catch(g){f(String(g.message||g))}finally{c(!1)}};return t.loading?o.jsx("div",{className:"af-auth-screen",children:o.jsx("div",{className:"af-auth-panel",children:"Loading..."})}):t.authenticated?e({user:t.user,onLogout:async()=>{await fetch("/api/auth/logout",{method:"POST"}).catch(()=>{}),n({loading:!1,authenticated:!1,user:null,setupRequired:!1})}}):o.jsx("div",{className:"af-auth-screen",children:o.jsxs("form",{className:"af-auth-panel",onSubmit:p,children:[o.jsxs("div",{className:"af-auth-brand",children:[o.jsx("span",{className:"material-symbols-outlined",children:"account_circle"}),o.jsxs("div",{children:[o.jsx("h1",{children:"AgentFlow"}),o.jsx("p",{children:t.setupRequired?"初始化管理员账号":"登录或创建用户"})]})]}),o.jsxs("label",{className:"af-auth-field",children:[o.jsx("span",{children:"用户名"}),o.jsx("input",{value:r,onChange:h=>s(h.target.value),autoComplete:"username",autoFocus:!0})]}),o.jsxs("label",{className:"af-auth-field",children:[o.jsx("span",{children:"密码"}),o.jsx("input",{type:"password",value:i,onChange:h=>a(h.target.value),autoComplete:t.setupRequired?"new-password":"current-password"})]}),u?o.jsx("p",{className:"af-auth-error",children:u}):null,o.jsx("button",{className:"af-auth-submit",type:"submit",disabled:l||!r.trim()||i.length<4,children:l?"处理中...":t.setupRequired?"创建并登录":"登录"})]})})}function fae({authUser:e,onLogout:t}){const{path:n}=Ni(),r=n==="/flow"||n==="/workspace";return o.jsxs("div",{className:"af-app",children:[n!=="/settings"?o.jsx(oae,{page:r?"flow":"projects"}):null,r?null:o.jsx(wO,{authUser:e,onLogout:t}),o.jsx("div",{className:r?"af-main af-main--pipeline":"af-main",children:o.jsx(uae,{authUser:e})}),o.jsx(aae,{})]})}function pae(){return o.jsx(cae,{children:o.jsx(eO,{children:o.jsx(hae,{})})})}function hae(){const{path:e}=Ni();return e.startsWith("/display")?o.jsx(cT,{}):QT(e)?o.jsx(vT,{}):o.jsx(dae,{children:({user:t,onLogout:n})=>o.jsx(fae,{authUser:t,onLogout:n})})}window.addEventListener("error",e=>{console.error("[AgentFlow UI global error]",e.error||e.message,{filename:e.filename,lineno:e.lineno,colno:e.colno})});window.addEventListener("unhandledrejection",e=>{console.error("[AgentFlow UI unhandled rejection]",e.reason)});const QC=document.querySelector('link[rel="icon"]');QC&&(QC.href=hA);Uy.createRoot(document.getElementById("root")).render(o.jsx(ot.StrictMode,{children:o.jsx(pae,{})}));
|