@fieldwangai/agentflow 0.1.89 → 0.1.91
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.
|
@@ -1,340 +0,0 @@
|
|
|
1
|
-
var aR=Object.defineProperty;var lR=(e,t,n)=>t in e?aR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Nn=(e,t,n)=>lR(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 au=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Co(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var l1={exports:{}},rh={},c1={exports:{}},St={};/**
|
|
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 Uu=Symbol.for("react.element"),cR=Symbol.for("react.portal"),uR=Symbol.for("react.fragment"),dR=Symbol.for("react.strict_mode"),fR=Symbol.for("react.profiler"),pR=Symbol.for("react.provider"),hR=Symbol.for("react.context"),mR=Symbol.for("react.forward_ref"),gR=Symbol.for("react.suspense"),yR=Symbol.for("react.memo"),xR=Symbol.for("react.lazy"),uv=Symbol.iterator;function wR(e){return e===null||typeof e!="object"?null:(e=uv&&e[uv]||e["@@iterator"],typeof e=="function"?e:null)}var u1={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},d1=Object.assign,f1={};function Hl(e,t,n){this.props=e,this.context=t,this.refs=f1,this.updater=n||u1}Hl.prototype.isReactComponent={};Hl.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")};Hl.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function p1(){}p1.prototype=Hl.prototype;function Tx(e,t,n){this.props=e,this.context=t,this.refs=f1,this.updater=n||u1}var Rx=Tx.prototype=new p1;Rx.constructor=Tx;d1(Rx,Hl.prototype);Rx.isPureReactComponent=!0;var dv=Array.isArray,h1=Object.prototype.hasOwnProperty,Mx={current:null},m1={key:!0,ref:!0,__self:!0,__source:!0};function g1(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)h1.call(t,r)&&!m1.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:Uu,type:e,key:i,ref:a,props:s,_owner:Mx.current}}function bR(e,t){return{$$typeof:Uu,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function $x(e){return typeof e=="object"&&e!==null&&e.$$typeof===Uu}function kR(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var fv=/\/+/g;function hm(e,t){return typeof e=="object"&&e!==null&&e.key!=null?kR(""+e.key):t.toString(36)}function Mf(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 Uu:case cR:a=!0}}if(a)return a=e,s=s(a),e=r===""?"."+hm(a,0):r,dv(s)?(n="",e!=null&&(n=e.replace(fv,"$&/")+"/"),Mf(s,t,n,"",function(u){return u})):s!=null&&($x(s)&&(s=bR(s,n+(!s.key||a&&a.key===s.key?"":(""+s.key).replace(fv,"$&/")+"/")+e)),t.push(s)),1;if(a=0,r=r===""?".":r+":",dv(e))for(var l=0;l<e.length;l++){i=e[l];var c=r+hm(i,l);a+=Mf(i,t,n,c,s)}else if(c=wR(e),typeof c=="function")for(e=c.call(e),l=0;!(i=e.next()).done;)i=i.value,c=r+hm(i,l++),a+=Mf(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 Fd(e,t,n){if(e==null)return e;var r=[],s=0;return Mf(e,r,"","",function(i){return t.call(n,i,s++)}),r}function vR(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 Nr={current:null},$f={transition:null},SR={ReactCurrentDispatcher:Nr,ReactCurrentBatchConfig:$f,ReactCurrentOwner:Mx};function y1(){throw Error("act(...) is not supported in production builds of React.")}St.Children={map:Fd,forEach:function(e,t,n){Fd(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Fd(e,function(){t++}),t},toArray:function(e){return Fd(e,function(t){return t})||[]},only:function(e){if(!$x(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};St.Component=Hl;St.Fragment=uR;St.Profiler=fR;St.PureComponent=Tx;St.StrictMode=dR;St.Suspense=gR;St.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=SR;St.act=y1;St.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=d1({},e.props),s=e.key,i=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,a=Mx.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)h1.call(t,c)&&!m1.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:Uu,type:e.type,key:s,ref:i,props:r,_owner:a}};St.createContext=function(e){return e={$$typeof:hR,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:pR,_context:e},e.Consumer=e};St.createElement=g1;St.createFactory=function(e){var t=g1.bind(null,e);return t.type=e,t};St.createRef=function(){return{current:null}};St.forwardRef=function(e){return{$$typeof:mR,render:e}};St.isValidElement=$x;St.lazy=function(e){return{$$typeof:xR,_payload:{_status:-1,_result:e},_init:vR}};St.memo=function(e,t){return{$$typeof:yR,type:e,compare:t===void 0?null:t}};St.startTransition=function(e){var t=$f.transition;$f.transition={};try{e()}finally{$f.transition=t}};St.unstable_act=y1;St.useCallback=function(e,t){return Nr.current.useCallback(e,t)};St.useContext=function(e){return Nr.current.useContext(e)};St.useDebugValue=function(){};St.useDeferredValue=function(e){return Nr.current.useDeferredValue(e)};St.useEffect=function(e,t){return Nr.current.useEffect(e,t)};St.useId=function(){return Nr.current.useId()};St.useImperativeHandle=function(e,t,n){return Nr.current.useImperativeHandle(e,t,n)};St.useInsertionEffect=function(e,t){return Nr.current.useInsertionEffect(e,t)};St.useLayoutEffect=function(e,t){return Nr.current.useLayoutEffect(e,t)};St.useMemo=function(e,t){return Nr.current.useMemo(e,t)};St.useReducer=function(e,t,n){return Nr.current.useReducer(e,t,n)};St.useRef=function(e){return Nr.current.useRef(e)};St.useState=function(e){return Nr.current.useState(e)};St.useSyncExternalStore=function(e,t,n){return Nr.current.useSyncExternalStore(e,t,n)};St.useTransition=function(){return Nr.current.useTransition()};St.version="18.3.1";c1.exports=St;var m=c1.exports;const rt=Co(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 NR=m,jR=Symbol.for("react.element"),CR=Symbol.for("react.fragment"),_R=Object.prototype.hasOwnProperty,ER=NR.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,AR={key:!0,ref:!0,__self:!0,__source:!0};function x1(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)_R.call(t,r)&&!AR.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:jR,type:e,key:i,ref:a,props:s,_owner:ER.current}}rh.Fragment=CR;rh.jsx=x1;rh.jsxs=x1;l1.exports=rh;var o=l1.exports,Lg={},w1={exports:{}},rs={},b1={exports:{}},k1={};/**
|
|
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(P,B){var E=P.length;P.push(B);e:for(;0<E;){var q=E-1>>>1,W=P[q];if(0<s(W,B))P[q]=B,P[E]=W,E=q;else break e}}function n(P){return P.length===0?null:P[0]}function r(P){if(P.length===0)return null;var B=P[0],E=P.pop();if(E!==B){P[0]=E;e:for(var q=0,W=P.length,L=W>>>1;q<L;){var X=2*(q+1)-1,se=P[X],ae=X+1,me=P[ae];if(0>s(se,E))ae<W&&0>s(me,se)?(P[q]=me,P[ae]=E,q=ae):(P[q]=se,P[X]=E,q=X);else if(ae<W&&0>s(me,E))P[q]=me,P[ae]=E,q=ae;else break e}}return B}function s(P,B){var E=P.sortIndex-B.sortIndex;return E!==0?E:P.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=[],p=1,f=null,d=3,h=!1,y=!1,b=!1,k=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(P){for(var B=n(u);B!==null;){if(B.callback===null)r(u);else if(B.startTime<=P)r(u),B.sortIndex=B.expirationTime,t(c,B);else break;B=n(u)}}function N(P){if(b=!1,x(P),!y)if(n(c)!==null)y=!0,M(C);else{var B=n(u);B!==null&&O(N,B.startTime-P)}}function C(P,B){y=!1,b&&(b=!1,g(A),A=-1),h=!0;var E=d;try{for(x(B),f=n(c);f!==null&&(!(f.expirationTime>B)||P&&!z());){var q=f.callback;if(typeof q=="function"){f.callback=null,d=f.priorityLevel;var W=q(f.expirationTime<=B);B=e.unstable_now(),typeof W=="function"?f.callback=W:f===n(c)&&r(c),x(B)}else r(c);f=n(c)}if(f!==null)var L=!0;else{var X=n(u);X!==null&&O(N,X.startTime-B),L=!1}return L}finally{f=null,d=E,h=!1}}var j=!1,_=null,A=-1,F=5,V=-1;function z(){return!(e.unstable_now()-V<F)}function D(){if(_!==null){var P=e.unstable_now();V=P;var B=!0;try{B=_(!0,P)}finally{B?R():(j=!1,_=null)}}else j=!1}var R;if(typeof w=="function")R=function(){w(D)};else if(typeof MessageChannel<"u"){var T=new MessageChannel,$=T.port2;T.port1.onmessage=D,R=function(){$.postMessage(null)}}else R=function(){k(D,0)};function M(P){_=P,j||(j=!0,R())}function O(P,B){A=k(function(){P(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(P){P.callback=null},e.unstable_continueExecution=function(){y||h||(y=!0,M(C))},e.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):F=0<P?Math.floor(1e3/P):5},e.unstable_getCurrentPriorityLevel=function(){return d},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(P){switch(d){case 1:case 2:case 3:var B=3;break;default:B=d}var E=d;d=B;try{return P()}finally{d=E}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(P,B){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var E=d;d=P;try{return B()}finally{d=E}},e.unstable_scheduleCallback=function(P,B,E){var q=e.unstable_now();switch(typeof E=="object"&&E!==null?(E=E.delay,E=typeof E=="number"&&0<E?q+E:q):E=q,P){case 1:var W=-1;break;case 2:W=250;break;case 5:W=1073741823;break;case 4:W=1e4;break;default:W=5e3}return W=E+W,P={id:p++,callback:B,priorityLevel:P,startTime:E,expirationTime:W,sortIndex:-1},E>q?(P.sortIndex=E,t(u,P),n(c)===null&&P===n(u)&&(b?(g(A),A=-1):b=!0,O(N,E-q))):(P.sortIndex=W,t(c,P),y||h||(y=!0,M(C))),P},e.unstable_shouldYield=z,e.unstable_wrapCallback=function(P){var B=d;return function(){var E=d;d=B;try{return P.apply(this,arguments)}finally{d=E}}}})(k1);b1.exports=k1;var PR=b1.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 IR=m,ts=PR;function je(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 v1=new Set,lu={};function wa(e,t){Sl(e,t),Sl(e+"Capture",t)}function Sl(e,t){for(lu[e]=t,e=0;e<t.length;e++)v1.add(t[e])}var Pi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Og=Object.prototype.hasOwnProperty,TR=/^[: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]*$/,pv={},hv={};function RR(e){return Og.call(hv,e)?!0:Og.call(pv,e)?!1:TR.test(e)?hv[e]=!0:(pv[e]=!0,!1)}function MR(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 $R(e,t,n,r){if(t===null||typeof t>"u"||MR(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 jr(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 rr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){rr[e]=new jr(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];rr[t]=new jr(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){rr[e]=new jr(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){rr[e]=new jr(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){rr[e]=new jr(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){rr[e]=new jr(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){rr[e]=new jr(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){rr[e]=new jr(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){rr[e]=new jr(e,5,!1,e.toLowerCase(),null,!1,!1)});var Lx=/[\-:]([a-z])/g;function Ox(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(Lx,Ox);rr[t]=new jr(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(Lx,Ox);rr[t]=new jr(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(Lx,Ox);rr[t]=new jr(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){rr[e]=new jr(e,1,!1,e.toLowerCase(),null,!1,!1)});rr.xlinkHref=new jr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){rr[e]=new jr(e,1,!1,e.toLowerCase(),null,!0,!0)});function Dx(e,t,n,r){var s=rr.hasOwnProperty(t)?rr[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&($R(t,n,s,r)&&(n=null),r||s===null?RR(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 Li=IR.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,zd=Symbol.for("react.element"),qa=Symbol.for("react.portal"),Ya=Symbol.for("react.fragment"),Fx=Symbol.for("react.strict_mode"),Dg=Symbol.for("react.profiler"),S1=Symbol.for("react.provider"),N1=Symbol.for("react.context"),zx=Symbol.for("react.forward_ref"),Fg=Symbol.for("react.suspense"),zg=Symbol.for("react.suspense_list"),Hx=Symbol.for("react.memo"),Zi=Symbol.for("react.lazy"),j1=Symbol.for("react.offscreen"),mv=Symbol.iterator;function pc(e){return e===null||typeof e!="object"?null:(e=mv&&e[mv]||e["@@iterator"],typeof e=="function"?e:null)}var wn=Object.assign,mm;function Tc(e){if(mm===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);mm=t&&t[1]||""}return`
|
|
34
|
-
`+mm+e}var gm=!1;function ym(e,t){if(!e||gm)return"";gm=!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{gm=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Tc(e):""}function LR(e){switch(e.tag){case 5:return Tc(e.type);case 16:return Tc("Lazy");case 13:return Tc("Suspense");case 19:return Tc("SuspenseList");case 0:case 2:case 15:return e=ym(e.type,!1),e;case 11:return e=ym(e.type.render,!1),e;case 1:return e=ym(e.type,!0),e;default:return""}}function Hg(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 Ya:return"Fragment";case qa:return"Portal";case Dg:return"Profiler";case Fx:return"StrictMode";case Fg:return"Suspense";case zg:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case N1:return(e.displayName||"Context")+".Consumer";case S1:return(e._context.displayName||"Context")+".Provider";case zx:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Hx:return t=e.displayName||null,t!==null?t:Hg(e.type)||"Memo";case Zi:t=e._payload,e=e._init;try{return Hg(e(t))}catch{}}return null}function OR(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 Hg(t);case 8:return t===Fx?"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 ko(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function C1(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function DR(e){var t=C1(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 Hd(e){e._valueTracker||(e._valueTracker=DR(e))}function _1(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=C1(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function rp(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 Bg(e,t){var n=t.checked;return wn({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function gv(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ko(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 E1(e,t){t=t.checked,t!=null&&Dx(e,"checked",t,!1)}function Wg(e,t){E1(e,t);var n=ko(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")?Vg(e,t.type,n):t.hasOwnProperty("defaultValue")&&Vg(e,t.type,ko(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function yv(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 Vg(e,t,n){(t!=="number"||rp(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Rc=Array.isArray;function ul(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=""+ko(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 Kg(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(je(91));return wn({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function xv(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(je(92));if(Rc(n)){if(1<n.length)throw Error(je(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:ko(n)}}function A1(e,t){var n=ko(t.value),r=ko(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 wv(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function P1(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 Ug(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?P1(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Bd,I1=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(Bd=Bd||document.createElement("div"),Bd.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Bd.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function cu(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Bc={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},FR=["Webkit","ms","Moz","O"];Object.keys(Bc).forEach(function(e){FR.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Bc[t]=Bc[e]})});function T1(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Bc.hasOwnProperty(e)&&Bc[e]?(""+t).trim():t+"px"}function R1(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=T1(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var zR=wn({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 qg(e,t){if(t){if(zR[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(je(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(je(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(je(61))}if(t.style!=null&&typeof t.style!="object")throw Error(je(62))}}function Yg(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 Gg=null;function Bx(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Jg=null,dl=null,fl=null;function bv(e){if(e=Gu(e)){if(typeof Jg!="function")throw Error(je(280));var t=e.stateNode;t&&(t=lh(t),Jg(e.stateNode,e.type,t))}}function M1(e){dl?fl?fl.push(e):fl=[e]:dl=e}function $1(){if(dl){var e=dl,t=fl;if(fl=dl=null,bv(e),t)for(e=0;e<t.length;e++)bv(t[e])}}function L1(e,t){return e(t)}function O1(){}var xm=!1;function D1(e,t,n){if(xm)return e(t,n);xm=!0;try{return L1(e,t,n)}finally{xm=!1,(dl!==null||fl!==null)&&(O1(),$1())}}function uu(e,t){var n=e.stateNode;if(n===null)return null;var r=lh(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(je(231,t,typeof n));return n}var Xg=!1;if(Pi)try{var hc={};Object.defineProperty(hc,"passive",{get:function(){Xg=!0}}),window.addEventListener("test",hc,hc),window.removeEventListener("test",hc,hc)}catch{Xg=!1}function HR(e,t,n,r,s,i,a,l,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(p){this.onError(p)}}var Wc=!1,sp=null,ip=!1,Qg=null,BR={onError:function(e){Wc=!0,sp=e}};function WR(e,t,n,r,s,i,a,l,c){Wc=!1,sp=null,HR.apply(BR,arguments)}function VR(e,t,n,r,s,i,a,l,c){if(WR.apply(this,arguments),Wc){if(Wc){var u=sp;Wc=!1,sp=null}else throw Error(je(198));ip||(ip=!0,Qg=u)}}function ba(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 F1(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 kv(e){if(ba(e)!==e)throw Error(je(188))}function KR(e){var t=e.alternate;if(!t){if(t=ba(e),t===null)throw Error(je(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 kv(s),e;if(i===r)return kv(s),t;i=i.sibling}throw Error(je(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(je(189))}}if(n.alternate!==r)throw Error(je(190))}if(n.tag!==3)throw Error(je(188));return n.stateNode.current===n?e:t}function z1(e){return e=KR(e),e!==null?H1(e):null}function H1(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=H1(e);if(t!==null)return t;e=e.sibling}return null}var B1=ts.unstable_scheduleCallback,vv=ts.unstable_cancelCallback,UR=ts.unstable_shouldYield,qR=ts.unstable_requestPaint,An=ts.unstable_now,YR=ts.unstable_getCurrentPriorityLevel,Wx=ts.unstable_ImmediatePriority,W1=ts.unstable_UserBlockingPriority,op=ts.unstable_NormalPriority,GR=ts.unstable_LowPriority,V1=ts.unstable_IdlePriority,sh=null,ri=null;function JR(e){if(ri&&typeof ri.onCommitFiberRoot=="function")try{ri.onCommitFiberRoot(sh,e,void 0,(e.current.flags&128)===128)}catch{}}var Ls=Math.clz32?Math.clz32:ZR,XR=Math.log,QR=Math.LN2;function ZR(e){return e>>>=0,e===0?32:31-(XR(e)/QR|0)|0}var Wd=64,Vd=4194304;function Mc(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 ap(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=Mc(l):(i&=a,i!==0&&(r=Mc(i)))}else a=n&~s,a!==0?r=Mc(a):i!==0&&(r=Mc(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-Ls(t),s=1<<n,r|=e[n],t&=~s;return r}function eM(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 tM(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes;0<i;){var a=31-Ls(i),l=1<<a,c=s[a];c===-1?(!(l&n)||l&r)&&(s[a]=eM(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}}function Zg(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function K1(){var e=Wd;return Wd<<=1,!(Wd&4194240)&&(Wd=64),e}function wm(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function qu(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ls(t),e[t]=n}function nM(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-Ls(n),i=1<<s;t[s]=0,r[s]=-1,e[s]=-1,n&=~i}}function Vx(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ls(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}var Kt=0;function U1(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var q1,Kx,Y1,G1,J1,ey=!1,Kd=[],co=null,uo=null,fo=null,du=new Map,fu=new Map,no=[],rM="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 Sv(e,t){switch(e){case"focusin":case"focusout":co=null;break;case"dragenter":case"dragleave":uo=null;break;case"mouseover":case"mouseout":fo=null;break;case"pointerover":case"pointerout":du.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":fu.delete(t.pointerId)}}function mc(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=Gu(t),t!==null&&Kx(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function sM(e,t,n,r,s){switch(t){case"focusin":return co=mc(co,e,t,n,r,s),!0;case"dragenter":return uo=mc(uo,e,t,n,r,s),!0;case"mouseover":return fo=mc(fo,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return du.set(i,mc(du.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,fu.set(i,mc(fu.get(i)||null,e,t,n,r,s)),!0}return!1}function X1(e){var t=Ko(e.target);if(t!==null){var n=ba(t);if(n!==null){if(t=n.tag,t===13){if(t=F1(n),t!==null){e.blockedOn=t,J1(e.priority,function(){Y1(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 Lf(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=ty(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Gg=r,n.target.dispatchEvent(r),Gg=null}else return t=Gu(n),t!==null&&Kx(t),e.blockedOn=n,!1;t.shift()}return!0}function Nv(e,t,n){Lf(e)&&n.delete(t)}function iM(){ey=!1,co!==null&&Lf(co)&&(co=null),uo!==null&&Lf(uo)&&(uo=null),fo!==null&&Lf(fo)&&(fo=null),du.forEach(Nv),fu.forEach(Nv)}function gc(e,t){e.blockedOn===t&&(e.blockedOn=null,ey||(ey=!0,ts.unstable_scheduleCallback(ts.unstable_NormalPriority,iM)))}function pu(e){function t(s){return gc(s,e)}if(0<Kd.length){gc(Kd[0],e);for(var n=1;n<Kd.length;n++){var r=Kd[n];r.blockedOn===e&&(r.blockedOn=null)}}for(co!==null&&gc(co,e),uo!==null&&gc(uo,e),fo!==null&&gc(fo,e),du.forEach(t),fu.forEach(t),n=0;n<no.length;n++)r=no[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<no.length&&(n=no[0],n.blockedOn===null);)X1(n),n.blockedOn===null&&no.shift()}var pl=Li.ReactCurrentBatchConfig,lp=!0;function oM(e,t,n,r){var s=Kt,i=pl.transition;pl.transition=null;try{Kt=1,Ux(e,t,n,r)}finally{Kt=s,pl.transition=i}}function aM(e,t,n,r){var s=Kt,i=pl.transition;pl.transition=null;try{Kt=4,Ux(e,t,n,r)}finally{Kt=s,pl.transition=i}}function Ux(e,t,n,r){if(lp){var s=ty(e,t,n,r);if(s===null)Am(e,t,r,cp,n),Sv(e,r);else if(sM(s,e,t,n,r))r.stopPropagation();else if(Sv(e,r),t&4&&-1<rM.indexOf(e)){for(;s!==null;){var i=Gu(s);if(i!==null&&q1(i),i=ty(e,t,n,r),i===null&&Am(e,t,r,cp,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else Am(e,t,r,null,n)}}var cp=null;function ty(e,t,n,r){if(cp=null,e=Bx(r),e=Ko(e),e!==null)if(t=ba(e),t===null)e=null;else if(n=t.tag,n===13){if(e=F1(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 cp=e,null}function Q1(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(YR()){case Wx:return 1;case W1:return 4;case op:case GR:return 16;case V1:return 536870912;default:return 16}default:return 16}}var io=null,qx=null,Of=null;function Z1(){if(Of)return Of;var e,t=qx,n=t.length,r,s="value"in io?io.value:io.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 Of=s.slice(e,1<r?1-r:void 0)}function Df(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 Ud(){return!0}function jv(){return!1}function ss(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)?Ud:jv,this.isPropagationStopped=jv,this}return wn(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=Ud)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Ud)},persist:function(){},isPersistent:Ud}),t}var Bl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Yx=ss(Bl),Yu=wn({},Bl,{view:0,detail:0}),lM=ss(Yu),bm,km,yc,ih=wn({},Yu,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Gx,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!==yc&&(yc&&e.type==="mousemove"?(bm=e.screenX-yc.screenX,km=e.screenY-yc.screenY):km=bm=0,yc=e),bm)},movementY:function(e){return"movementY"in e?e.movementY:km}}),Cv=ss(ih),cM=wn({},ih,{dataTransfer:0}),uM=ss(cM),dM=wn({},Yu,{relatedTarget:0}),vm=ss(dM),fM=wn({},Bl,{animationName:0,elapsedTime:0,pseudoElement:0}),pM=ss(fM),hM=wn({},Bl,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),mM=ss(hM),gM=wn({},Bl,{data:0}),_v=ss(gM),yM={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},xM={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"},wM={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function bM(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=wM[e])?!!t[e]:!1}function Gx(){return bM}var kM=wn({},Yu,{key:function(e){if(e.key){var t=yM[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Df(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?xM[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Gx,charCode:function(e){return e.type==="keypress"?Df(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Df(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),vM=ss(kM),SM=wn({},ih,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ev=ss(SM),NM=wn({},Yu,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Gx}),jM=ss(NM),CM=wn({},Bl,{propertyName:0,elapsedTime:0,pseudoElement:0}),_M=ss(CM),EM=wn({},ih,{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}),AM=ss(EM),PM=[9,13,27,32],Jx=Pi&&"CompositionEvent"in window,Vc=null;Pi&&"documentMode"in document&&(Vc=document.documentMode);var IM=Pi&&"TextEvent"in window&&!Vc,eC=Pi&&(!Jx||Vc&&8<Vc&&11>=Vc),Av=" ",Pv=!1;function tC(e,t){switch(e){case"keyup":return PM.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function nC(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ga=!1;function TM(e,t){switch(e){case"compositionend":return nC(t);case"keypress":return t.which!==32?null:(Pv=!0,Av);case"textInput":return e=t.data,e===Av&&Pv?null:e;default:return null}}function RM(e,t){if(Ga)return e==="compositionend"||!Jx&&tC(e,t)?(e=Z1(),Of=qx=io=null,Ga=!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 eC&&t.locale!=="ko"?null:t.data;default:return null}}var MM={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 Iv(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!MM[e.type]:t==="textarea"}function rC(e,t,n,r){M1(r),t=up(t,"onChange"),0<t.length&&(n=new Yx("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Kc=null,hu=null;function $M(e){hC(e,0)}function oh(e){var t=Qa(e);if(_1(t))return e}function LM(e,t){if(e==="change")return t}var sC=!1;if(Pi){var Sm;if(Pi){var Nm="oninput"in document;if(!Nm){var Tv=document.createElement("div");Tv.setAttribute("oninput","return;"),Nm=typeof Tv.oninput=="function"}Sm=Nm}else Sm=!1;sC=Sm&&(!document.documentMode||9<document.documentMode)}function Rv(){Kc&&(Kc.detachEvent("onpropertychange",iC),hu=Kc=null)}function iC(e){if(e.propertyName==="value"&&oh(hu)){var t=[];rC(t,hu,e,Bx(e)),D1($M,t)}}function OM(e,t,n){e==="focusin"?(Rv(),Kc=t,hu=n,Kc.attachEvent("onpropertychange",iC)):e==="focusout"&&Rv()}function DM(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return oh(hu)}function FM(e,t){if(e==="click")return oh(t)}function zM(e,t){if(e==="input"||e==="change")return oh(t)}function HM(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Fs=typeof Object.is=="function"?Object.is:HM;function mu(e,t){if(Fs(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(!Og.call(t,s)||!Fs(e[s],t[s]))return!1}return!0}function Mv(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function $v(e,t){var n=Mv(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=Mv(n)}}function oC(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?oC(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function aC(){for(var e=window,t=rp();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=rp(e.document)}return t}function Xx(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 BM(e){var t=aC(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&oC(n.ownerDocument.documentElement,n)){if(r!==null&&Xx(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=$v(n,i);var a=$v(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 WM=Pi&&"documentMode"in document&&11>=document.documentMode,Ja=null,ny=null,Uc=null,ry=!1;function Lv(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ry||Ja==null||Ja!==rp(r)||(r=Ja,"selectionStart"in r&&Xx(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}),Uc&&mu(Uc,r)||(Uc=r,r=up(ny,"onSelect"),0<r.length&&(t=new Yx("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Ja)))}function qd(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Xa={animationend:qd("Animation","AnimationEnd"),animationiteration:qd("Animation","AnimationIteration"),animationstart:qd("Animation","AnimationStart"),transitionend:qd("Transition","TransitionEnd")},jm={},lC={};Pi&&(lC=document.createElement("div").style,"AnimationEvent"in window||(delete Xa.animationend.animation,delete Xa.animationiteration.animation,delete Xa.animationstart.animation),"TransitionEvent"in window||delete Xa.transitionend.transition);function ah(e){if(jm[e])return jm[e];if(!Xa[e])return e;var t=Xa[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in lC)return jm[e]=t[n];return e}var cC=ah("animationend"),uC=ah("animationiteration"),dC=ah("animationstart"),fC=ah("transitionend"),pC=new Map,Ov="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 _o(e,t){pC.set(e,t),wa(t,[e])}for(var Cm=0;Cm<Ov.length;Cm++){var _m=Ov[Cm],VM=_m.toLowerCase(),KM=_m[0].toUpperCase()+_m.slice(1);_o(VM,"on"+KM)}_o(cC,"onAnimationEnd");_o(uC,"onAnimationIteration");_o(dC,"onAnimationStart");_o("dblclick","onDoubleClick");_o("focusin","onFocus");_o("focusout","onBlur");_o(fC,"onTransitionEnd");Sl("onMouseEnter",["mouseout","mouseover"]);Sl("onMouseLeave",["mouseout","mouseover"]);Sl("onPointerEnter",["pointerout","pointerover"]);Sl("onPointerLeave",["pointerout","pointerover"]);wa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));wa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));wa("onBeforeInput",["compositionend","keypress","textInput","paste"]);wa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));wa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));wa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var $c="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(" "),UM=new Set("cancel close invalid load scroll toggle".split(" ").concat($c));function Dv(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,VR(r,t,void 0,e),e.currentTarget=null}function hC(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;Dv(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;Dv(s,l,u),i=c}}}if(ip)throw e=Qg,ip=!1,Qg=null,e}function on(e,t){var n=t[ly];n===void 0&&(n=t[ly]=new Set);var r=e+"__bubble";n.has(r)||(mC(t,e,2,!1),n.add(r))}function Em(e,t,n){var r=0;t&&(r|=4),mC(n,e,r,t)}var Yd="_reactListening"+Math.random().toString(36).slice(2);function gu(e){if(!e[Yd]){e[Yd]=!0,v1.forEach(function(n){n!=="selectionchange"&&(UM.has(n)||Em(n,!1,e),Em(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Yd]||(t[Yd]=!0,Em("selectionchange",!1,t))}}function mC(e,t,n,r){switch(Q1(t)){case 1:var s=oM;break;case 4:s=aM;break;default:s=Ux}n=s.bind(null,t,n,e),s=void 0,!Xg||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 Am(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=Ko(l),a===null)return;if(c=a.tag,c===5||c===6){r=i=a;continue e}l=l.parentNode}}r=r.return}D1(function(){var u=i,p=Bx(n),f=[];e:{var d=pC.get(e);if(d!==void 0){var h=Yx,y=e;switch(e){case"keypress":if(Df(n)===0)break e;case"keydown":case"keyup":h=vM;break;case"focusin":y="focus",h=vm;break;case"focusout":y="blur",h=vm;break;case"beforeblur":case"afterblur":h=vm;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=Cv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=uM;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=jM;break;case cC:case uC:case dC:h=pM;break;case fC:h=_M;break;case"scroll":h=lM;break;case"wheel":h=AM;break;case"copy":case"cut":case"paste":h=mM;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=Ev}var b=(t&4)!==0,k=!b&&e==="scroll",g=b?d!==null?d+"Capture":null:d;b=[];for(var w=u,x;w!==null;){x=w;var N=x.stateNode;if(x.tag===5&&N!==null&&(x=N,g!==null&&(N=uu(w,g),N!=null&&b.push(yu(w,N,x)))),k)break;w=w.return}0<b.length&&(d=new h(d,y,null,n,p),f.push({event:d,listeners:b}))}}if(!(t&7)){e:{if(d=e==="mouseover"||e==="pointerover",h=e==="mouseout"||e==="pointerout",d&&n!==Gg&&(y=n.relatedTarget||n.fromElement)&&(Ko(y)||y[Ii]))break e;if((h||d)&&(d=p.window===p?p:(d=p.ownerDocument)?d.defaultView||d.parentWindow:window,h?(y=n.relatedTarget||n.toElement,h=u,y=y?Ko(y):null,y!==null&&(k=ba(y),y!==k||y.tag!==5&&y.tag!==6)&&(y=null)):(h=null,y=u),h!==y)){if(b=Cv,N="onMouseLeave",g="onMouseEnter",w="mouse",(e==="pointerout"||e==="pointerover")&&(b=Ev,N="onPointerLeave",g="onPointerEnter",w="pointer"),k=h==null?d:Qa(h),x=y==null?d:Qa(y),d=new b(N,w+"leave",h,n,p),d.target=k,d.relatedTarget=x,N=null,Ko(p)===u&&(b=new b(g,w+"enter",y,n,p),b.target=x,b.relatedTarget=k,N=b),k=N,h&&y)t:{for(b=h,g=y,w=0,x=b;x;x=Oa(x))w++;for(x=0,N=g;N;N=Oa(N))x++;for(;0<w-x;)b=Oa(b),w--;for(;0<x-w;)g=Oa(g),x--;for(;w--;){if(b===g||g!==null&&b===g.alternate)break t;b=Oa(b),g=Oa(g)}b=null}else b=null;h!==null&&Fv(f,d,h,b,!1),y!==null&&k!==null&&Fv(f,k,y,b,!0)}}e:{if(d=u?Qa(u):window,h=d.nodeName&&d.nodeName.toLowerCase(),h==="select"||h==="input"&&d.type==="file")var C=LM;else if(Iv(d))if(sC)C=zM;else{C=DM;var j=OM}else(h=d.nodeName)&&h.toLowerCase()==="input"&&(d.type==="checkbox"||d.type==="radio")&&(C=FM);if(C&&(C=C(e,u))){rC(f,C,n,p);break e}j&&j(e,d,u),e==="focusout"&&(j=d._wrapperState)&&j.controlled&&d.type==="number"&&Vg(d,"number",d.value)}switch(j=u?Qa(u):window,e){case"focusin":(Iv(j)||j.contentEditable==="true")&&(Ja=j,ny=u,Uc=null);break;case"focusout":Uc=ny=Ja=null;break;case"mousedown":ry=!0;break;case"contextmenu":case"mouseup":case"dragend":ry=!1,Lv(f,n,p);break;case"selectionchange":if(WM)break;case"keydown":case"keyup":Lv(f,n,p)}var _;if(Jx)e:{switch(e){case"compositionstart":var A="onCompositionStart";break e;case"compositionend":A="onCompositionEnd";break e;case"compositionupdate":A="onCompositionUpdate";break e}A=void 0}else Ga?tC(e,n)&&(A="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(A="onCompositionStart");A&&(eC&&n.locale!=="ko"&&(Ga||A!=="onCompositionStart"?A==="onCompositionEnd"&&Ga&&(_=Z1()):(io=p,qx="value"in io?io.value:io.textContent,Ga=!0)),j=up(u,A),0<j.length&&(A=new _v(A,e,null,n,p),f.push({event:A,listeners:j}),_?A.data=_:(_=nC(n),_!==null&&(A.data=_)))),(_=IM?TM(e,n):RM(e,n))&&(u=up(u,"onBeforeInput"),0<u.length&&(p=new _v("onBeforeInput","beforeinput",null,n,p),f.push({event:p,listeners:u}),p.data=_))}hC(f,t)})}function yu(e,t,n){return{instance:e,listener:t,currentTarget:n}}function up(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=uu(e,n),i!=null&&r.unshift(yu(e,i,s)),i=uu(e,t),i!=null&&r.push(yu(e,i,s))),e=e.return}return r}function Oa(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Fv(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=uu(n,i),c!=null&&a.unshift(yu(n,c,l))):s||(c=uu(n,i),c!=null&&a.push(yu(n,c,l)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var qM=/\r\n?/g,YM=/\u0000|\uFFFD/g;function zv(e){return(typeof e=="string"?e:""+e).replace(qM,`
|
|
38
|
-
`).replace(YM,"")}function Gd(e,t,n){if(t=zv(t),zv(e)!==t&&n)throw Error(je(425))}function dp(){}var sy=null,iy=null;function oy(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 ay=typeof setTimeout=="function"?setTimeout:void 0,GM=typeof clearTimeout=="function"?clearTimeout:void 0,Hv=typeof Promise=="function"?Promise:void 0,JM=typeof queueMicrotask=="function"?queueMicrotask:typeof Hv<"u"?function(e){return Hv.resolve(null).then(e).catch(XM)}:ay;function XM(e){setTimeout(function(){throw e})}function Pm(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),pu(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);pu(t)}function po(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 Bv(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 Wl=Math.random().toString(36).slice(2),Qs="__reactFiber$"+Wl,xu="__reactProps$"+Wl,Ii="__reactContainer$"+Wl,ly="__reactEvents$"+Wl,QM="__reactListeners$"+Wl,ZM="__reactHandles$"+Wl;function Ko(e){var t=e[Qs];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Ii]||n[Qs]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Bv(e);e!==null;){if(n=e[Qs])return n;e=Bv(e)}return t}e=n,n=e.parentNode}return null}function Gu(e){return e=e[Qs]||e[Ii],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Qa(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(je(33))}function lh(e){return e[xu]||null}var cy=[],Za=-1;function Eo(e){return{current:e}}function ln(e){0>Za||(e.current=cy[Za],cy[Za]=null,Za--)}function en(e,t){Za++,cy[Za]=e.current,e.current=t}var vo={},fr=Eo(vo),Lr=Eo(!1),ra=vo;function Nl(e,t){var n=e.type.contextTypes;if(!n)return vo;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 Or(e){return e=e.childContextTypes,e!=null}function fp(){ln(Lr),ln(fr)}function Wv(e,t,n){if(fr.current!==vo)throw Error(je(168));en(fr,t),en(Lr,n)}function gC(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(je(108,OR(e)||"Unknown",s));return wn({},n,r)}function pp(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||vo,ra=fr.current,en(fr,e),en(Lr,Lr.current),!0}function Vv(e,t,n){var r=e.stateNode;if(!r)throw Error(je(169));n?(e=gC(e,t,ra),r.__reactInternalMemoizedMergedChildContext=e,ln(Lr),ln(fr),en(fr,e)):ln(Lr),en(Lr,n)}var ki=null,ch=!1,Im=!1;function yC(e){ki===null?ki=[e]:ki.push(e)}function e2(e){ch=!0,yC(e)}function Ao(){if(!Im&&ki!==null){Im=!0;var e=0,t=Kt;try{var n=ki;for(Kt=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}ki=null,ch=!1}catch(s){throw ki!==null&&(ki=ki.slice(e+1)),B1(Wx,Ao),s}finally{Kt=t,Im=!1}}return null}var el=[],tl=0,hp=null,mp=0,us=[],ds=0,sa=null,Si=1,Ni="";function Do(e,t){el[tl++]=mp,el[tl++]=hp,hp=e,mp=t}function xC(e,t,n){us[ds++]=Si,us[ds++]=Ni,us[ds++]=sa,sa=e;var r=Si;e=Ni;var s=32-Ls(r)-1;r&=~(1<<s),n+=1;var i=32-Ls(t)+s;if(30<i){var a=s-s%5;i=(r&(1<<a)-1).toString(32),r>>=a,s-=a,Si=1<<32-Ls(t)+s|n<<s|r,Ni=i+e}else Si=1<<i|n<<s|r,Ni=e}function Qx(e){e.return!==null&&(Do(e,1),xC(e,1,0))}function Zx(e){for(;e===hp;)hp=el[--tl],el[tl]=null,mp=el[--tl],el[tl]=null;for(;e===sa;)sa=us[--ds],us[ds]=null,Ni=us[--ds],us[ds]=null,Si=us[--ds],us[ds]=null}var Zr=null,Xr=null,fn=!1,Is=null;function wC(e,t){var n=hs(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 Kv(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,Zr=e,Xr=po(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Zr=e,Xr=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=sa!==null?{id:Si,overflow:Ni}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=hs(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Zr=e,Xr=null,!0):!1;default:return!1}}function uy(e){return(e.mode&1)!==0&&(e.flags&128)===0}function dy(e){if(fn){var t=Xr;if(t){var n=t;if(!Kv(e,t)){if(uy(e))throw Error(je(418));t=po(n.nextSibling);var r=Zr;t&&Kv(e,t)?wC(r,n):(e.flags=e.flags&-4097|2,fn=!1,Zr=e)}}else{if(uy(e))throw Error(je(418));e.flags=e.flags&-4097|2,fn=!1,Zr=e}}}function Uv(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Zr=e}function Jd(e){if(e!==Zr)return!1;if(!fn)return Uv(e),fn=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!oy(e.type,e.memoizedProps)),t&&(t=Xr)){if(uy(e))throw bC(),Error(je(418));for(;t;)wC(e,t),t=po(t.nextSibling)}if(Uv(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(je(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Xr=po(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Xr=null}}else Xr=Zr?po(e.stateNode.nextSibling):null;return!0}function bC(){for(var e=Xr;e;)e=po(e.nextSibling)}function jl(){Xr=Zr=null,fn=!1}function ew(e){Is===null?Is=[e]:Is.push(e)}var t2=Li.ReactCurrentBatchConfig;function xc(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(je(309));var r=n.stateNode}if(!r)throw Error(je(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(je(284));if(!n._owner)throw Error(je(290,e))}return e}function Xd(e,t){throw e=Object.prototype.toString.call(t),Error(je(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function qv(e){var t=e._init;return t(e._payload)}function kC(e){function t(g,w){if(e){var x=g.deletions;x===null?(g.deletions=[w],g.flags|=16):x.push(w)}}function n(g,w){if(!e)return null;for(;w!==null;)t(g,w),w=w.sibling;return null}function r(g,w){for(g=new Map;w!==null;)w.key!==null?g.set(w.key,w):g.set(w.index,w),w=w.sibling;return g}function s(g,w){return g=yo(g,w),g.index=0,g.sibling=null,g}function i(g,w,x){return g.index=x,e?(x=g.alternate,x!==null?(x=x.index,x<w?(g.flags|=2,w):x):(g.flags|=2,w)):(g.flags|=1048576,w)}function a(g){return e&&g.alternate===null&&(g.flags|=2),g}function l(g,w,x,N){return w===null||w.tag!==6?(w=Dm(x,g.mode,N),w.return=g,w):(w=s(w,x),w.return=g,w)}function c(g,w,x,N){var C=x.type;return C===Ya?p(g,w,x.props.children,N,x.key):w!==null&&(w.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Zi&&qv(C)===w.type)?(N=s(w,x.props),N.ref=xc(g,w,x),N.return=g,N):(N=Kf(x.type,x.key,x.props,null,g.mode,N),N.ref=xc(g,w,x),N.return=g,N)}function u(g,w,x,N){return w===null||w.tag!==4||w.stateNode.containerInfo!==x.containerInfo||w.stateNode.implementation!==x.implementation?(w=Fm(x,g.mode,N),w.return=g,w):(w=s(w,x.children||[]),w.return=g,w)}function p(g,w,x,N,C){return w===null||w.tag!==7?(w=Xo(x,g.mode,N,C),w.return=g,w):(w=s(w,x),w.return=g,w)}function f(g,w,x){if(typeof w=="string"&&w!==""||typeof w=="number")return w=Dm(""+w,g.mode,x),w.return=g,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case zd:return x=Kf(w.type,w.key,w.props,null,g.mode,x),x.ref=xc(g,null,w),x.return=g,x;case qa:return w=Fm(w,g.mode,x),w.return=g,w;case Zi:var N=w._init;return f(g,N(w._payload),x)}if(Rc(w)||pc(w))return w=Xo(w,g.mode,x,null),w.return=g,w;Xd(g,w)}return null}function d(g,w,x,N){var C=w!==null?w.key:null;if(typeof x=="string"&&x!==""||typeof x=="number")return C!==null?null:l(g,w,""+x,N);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case zd:return x.key===C?c(g,w,x,N):null;case qa:return x.key===C?u(g,w,x,N):null;case Zi:return C=x._init,d(g,w,C(x._payload),N)}if(Rc(x)||pc(x))return C!==null?null:p(g,w,x,N,null);Xd(g,x)}return null}function h(g,w,x,N,C){if(typeof N=="string"&&N!==""||typeof N=="number")return g=g.get(x)||null,l(w,g,""+N,C);if(typeof N=="object"&&N!==null){switch(N.$$typeof){case zd:return g=g.get(N.key===null?x:N.key)||null,c(w,g,N,C);case qa:return g=g.get(N.key===null?x:N.key)||null,u(w,g,N,C);case Zi:var j=N._init;return h(g,w,x,j(N._payload),C)}if(Rc(N)||pc(N))return g=g.get(x)||null,p(w,g,N,C,null);Xd(w,N)}return null}function y(g,w,x,N){for(var C=null,j=null,_=w,A=w=0,F=null;_!==null&&A<x.length;A++){_.index>A?(F=_,_=null):F=_.sibling;var V=d(g,_,x[A],N);if(V===null){_===null&&(_=F);break}e&&_&&V.alternate===null&&t(g,_),w=i(V,w,A),j===null?C=V:j.sibling=V,j=V,_=F}if(A===x.length)return n(g,_),fn&&Do(g,A),C;if(_===null){for(;A<x.length;A++)_=f(g,x[A],N),_!==null&&(w=i(_,w,A),j===null?C=_:j.sibling=_,j=_);return fn&&Do(g,A),C}for(_=r(g,_);A<x.length;A++)F=h(_,g,A,x[A],N),F!==null&&(e&&F.alternate!==null&&_.delete(F.key===null?A:F.key),w=i(F,w,A),j===null?C=F:j.sibling=F,j=F);return e&&_.forEach(function(z){return t(g,z)}),fn&&Do(g,A),C}function b(g,w,x,N){var C=pc(x);if(typeof C!="function")throw Error(je(150));if(x=C.call(x),x==null)throw Error(je(151));for(var j=C=null,_=w,A=w=0,F=null,V=x.next();_!==null&&!V.done;A++,V=x.next()){_.index>A?(F=_,_=null):F=_.sibling;var z=d(g,_,V.value,N);if(z===null){_===null&&(_=F);break}e&&_&&z.alternate===null&&t(g,_),w=i(z,w,A),j===null?C=z:j.sibling=z,j=z,_=F}if(V.done)return n(g,_),fn&&Do(g,A),C;if(_===null){for(;!V.done;A++,V=x.next())V=f(g,V.value,N),V!==null&&(w=i(V,w,A),j===null?C=V:j.sibling=V,j=V);return fn&&Do(g,A),C}for(_=r(g,_);!V.done;A++,V=x.next())V=h(_,g,A,V.value,N),V!==null&&(e&&V.alternate!==null&&_.delete(V.key===null?A:V.key),w=i(V,w,A),j===null?C=V:j.sibling=V,j=V);return e&&_.forEach(function(D){return t(g,D)}),fn&&Do(g,A),C}function k(g,w,x,N){if(typeof x=="object"&&x!==null&&x.type===Ya&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case zd:e:{for(var C=x.key,j=w;j!==null;){if(j.key===C){if(C=x.type,C===Ya){if(j.tag===7){n(g,j.sibling),w=s(j,x.props.children),w.return=g,g=w;break e}}else if(j.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Zi&&qv(C)===j.type){n(g,j.sibling),w=s(j,x.props),w.ref=xc(g,j,x),w.return=g,g=w;break e}n(g,j);break}else t(g,j);j=j.sibling}x.type===Ya?(w=Xo(x.props.children,g.mode,N,x.key),w.return=g,g=w):(N=Kf(x.type,x.key,x.props,null,g.mode,N),N.ref=xc(g,w,x),N.return=g,g=N)}return a(g);case qa:e:{for(j=x.key;w!==null;){if(w.key===j)if(w.tag===4&&w.stateNode.containerInfo===x.containerInfo&&w.stateNode.implementation===x.implementation){n(g,w.sibling),w=s(w,x.children||[]),w.return=g,g=w;break e}else{n(g,w);break}else t(g,w);w=w.sibling}w=Fm(x,g.mode,N),w.return=g,g=w}return a(g);case Zi:return j=x._init,k(g,w,j(x._payload),N)}if(Rc(x))return y(g,w,x,N);if(pc(x))return b(g,w,x,N);Xd(g,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,w!==null&&w.tag===6?(n(g,w.sibling),w=s(w,x),w.return=g,g=w):(n(g,w),w=Dm(x,g.mode,N),w.return=g,g=w),a(g)):n(g,w)}return k}var Cl=kC(!0),vC=kC(!1),gp=Eo(null),yp=null,nl=null,tw=null;function nw(){tw=nl=yp=null}function rw(e){var t=gp.current;ln(gp),e._currentValue=t}function fy(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 hl(e,t){yp=e,tw=nl=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Rr=!0),e.firstContext=null)}function gs(e){var t=e._currentValue;if(tw!==e)if(e={context:e,memoizedValue:t,next:null},nl===null){if(yp===null)throw Error(je(308));nl=e,yp.dependencies={lanes:0,firstContext:e}}else nl=nl.next=e;return t}var Uo=null;function sw(e){Uo===null?Uo=[e]:Uo.push(e)}function SC(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,sw(t)):(n.next=s.next,s.next=n),t.interleaved=n,Ti(e,r)}function Ti(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 eo=!1;function iw(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function NC(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 Ei(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ho(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Tt&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,Ti(e,n)}return s=r.interleaved,s===null?(t.next=t,sw(r)):(t.next=s.next,s.next=t),r.interleaved=t,Ti(e,n)}function Ff(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,Vx(e,n)}}function Yv(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 xp(e,t,n,r){var s=e.updateQueue;eo=!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 p=e.alternate;p!==null&&(p=p.updateQueue,l=p.lastBaseUpdate,l!==a&&(l===null?p.firstBaseUpdate=u:l.next=u,p.lastBaseUpdate=c))}if(i!==null){var f=s.baseState;a=0,p=u=c=null,l=i;do{var d=l.lane,h=l.eventTime;if((r&d)===d){p!==null&&(p=p.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var y=e,b=l;switch(d=t,h=n,b.tag){case 1:if(y=b.payload,typeof y=="function"){f=y.call(h,f,d);break e}f=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=b.payload,d=typeof y=="function"?y.call(h,f,d):y,d==null)break e;f=wn({},f,d);break e;case 2:eo=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,d=s.effects,d===null?s.effects=[l]:d.push(l))}else h={eventTime:h,lane:d,tag:l.tag,payload:l.payload,callback:l.callback,next:null},p===null?(u=p=h,c=f):p=p.next=h,a|=d;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;d=l,l=d.next,d.next=null,s.lastBaseUpdate=d,s.shared.pending=null}}while(!0);if(p===null&&(c=f),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=p,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);oa|=a,e.lanes=a,e.memoizedState=f}}function Gv(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(je(191,s));s.call(r)}}}var Ju={},si=Eo(Ju),wu=Eo(Ju),bu=Eo(Ju);function qo(e){if(e===Ju)throw Error(je(174));return e}function ow(e,t){switch(en(bu,t),en(wu,e),en(si,Ju),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Ug(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Ug(t,e)}ln(si),en(si,t)}function _l(){ln(si),ln(wu),ln(bu)}function jC(e){qo(bu.current);var t=qo(si.current),n=Ug(t,e.type);t!==n&&(en(wu,e),en(si,n))}function aw(e){wu.current===e&&(ln(si),ln(wu))}var gn=Eo(0);function wp(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 Tm=[];function lw(){for(var e=0;e<Tm.length;e++)Tm[e]._workInProgressVersionPrimary=null;Tm.length=0}var zf=Li.ReactCurrentDispatcher,Rm=Li.ReactCurrentBatchConfig,ia=0,xn=null,Hn=null,Jn=null,bp=!1,qc=!1,ku=0,n2=0;function ar(){throw Error(je(321))}function cw(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Fs(e[n],t[n]))return!1;return!0}function uw(e,t,n,r,s,i){if(ia=i,xn=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,zf.current=e===null||e.memoizedState===null?o2:a2,e=n(r,s),qc){i=0;do{if(qc=!1,ku=0,25<=i)throw Error(je(301));i+=1,Jn=Hn=null,t.updateQueue=null,zf.current=l2,e=n(r,s)}while(qc)}if(zf.current=kp,t=Hn!==null&&Hn.next!==null,ia=0,Jn=Hn=xn=null,bp=!1,t)throw Error(je(300));return e}function dw(){var e=ku!==0;return ku=0,e}function Ys(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Jn===null?xn.memoizedState=Jn=e:Jn=Jn.next=e,Jn}function ys(){if(Hn===null){var e=xn.alternate;e=e!==null?e.memoizedState:null}else e=Hn.next;var t=Jn===null?xn.memoizedState:Jn.next;if(t!==null)Jn=t,Hn=e;else{if(e===null)throw Error(je(310));Hn=e,e={memoizedState:Hn.memoizedState,baseState:Hn.baseState,baseQueue:Hn.baseQueue,queue:Hn.queue,next:null},Jn===null?xn.memoizedState=Jn=e:Jn=Jn.next=e}return Jn}function vu(e,t){return typeof t=="function"?t(e):t}function Mm(e){var t=ys(),n=t.queue;if(n===null)throw Error(je(311));n.lastRenderedReducer=e;var r=Hn,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 p=u.lane;if((ia&p)===p)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 f={lane:p,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=f,a=r):c=c.next=f,xn.lanes|=p,oa|=p}u=u.next}while(u!==null&&u!==i);c===null?a=r:c.next=l,Fs(r,t.memoizedState)||(Rr=!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,xn.lanes|=i,oa|=i,s=s.next;while(s!==e)}else s===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function $m(e){var t=ys(),n=t.queue;if(n===null)throw Error(je(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);Fs(i,t.memoizedState)||(Rr=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function CC(){}function _C(e,t){var n=xn,r=ys(),s=t(),i=!Fs(r.memoizedState,s);if(i&&(r.memoizedState=s,Rr=!0),r=r.queue,fw(PC.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||Jn!==null&&Jn.memoizedState.tag&1){if(n.flags|=2048,Su(9,AC.bind(null,n,r,s,t),void 0,null),Qn===null)throw Error(je(349));ia&30||EC(n,t,s)}return s}function EC(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=xn.updateQueue,t===null?(t={lastEffect:null,stores:null},xn.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function AC(e,t,n,r){t.value=n,t.getSnapshot=r,IC(t)&&TC(e)}function PC(e,t,n){return n(function(){IC(t)&&TC(e)})}function IC(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Fs(e,n)}catch{return!0}}function TC(e){var t=Ti(e,1);t!==null&&Os(t,e,1,-1)}function Jv(e){var t=Ys();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:vu,lastRenderedState:e},t.queue=e,e=e.dispatch=i2.bind(null,xn,e),[t.memoizedState,e]}function Su(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=xn.updateQueue,t===null?(t={lastEffect:null,stores:null},xn.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 RC(){return ys().memoizedState}function Hf(e,t,n,r){var s=Ys();xn.flags|=e,s.memoizedState=Su(1|t,n,void 0,r===void 0?null:r)}function uh(e,t,n,r){var s=ys();r=r===void 0?null:r;var i=void 0;if(Hn!==null){var a=Hn.memoizedState;if(i=a.destroy,r!==null&&cw(r,a.deps)){s.memoizedState=Su(t,n,i,r);return}}xn.flags|=e,s.memoizedState=Su(1|t,n,i,r)}function Xv(e,t){return Hf(8390656,8,e,t)}function fw(e,t){return uh(2048,8,e,t)}function MC(e,t){return uh(4,2,e,t)}function $C(e,t){return uh(4,4,e,t)}function LC(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 OC(e,t,n){return n=n!=null?n.concat([e]):null,uh(4,4,LC.bind(null,t,e),n)}function pw(){}function DC(e,t){var n=ys();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&cw(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function FC(e,t){var n=ys();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&cw(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function zC(e,t,n){return ia&21?(Fs(n,t)||(n=K1(),xn.lanes|=n,oa|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Rr=!0),e.memoizedState=n)}function r2(e,t){var n=Kt;Kt=n!==0&&4>n?n:4,e(!0);var r=Rm.transition;Rm.transition={};try{e(!1),t()}finally{Kt=n,Rm.transition=r}}function HC(){return ys().memoizedState}function s2(e,t,n){var r=go(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},BC(e))WC(t,n);else if(n=SC(e,t,n,r),n!==null){var s=Sr();Os(n,e,r,s),VC(n,t,r)}}function i2(e,t,n){var r=go(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(BC(e))WC(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,Fs(l,a)){var c=t.interleaved;c===null?(s.next=s,sw(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}n=SC(e,t,s,r),n!==null&&(s=Sr(),Os(n,e,r,s),VC(n,t,r))}}function BC(e){var t=e.alternate;return e===xn||t!==null&&t===xn}function WC(e,t){qc=bp=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function VC(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Vx(e,n)}}var kp={readContext:gs,useCallback:ar,useContext:ar,useEffect:ar,useImperativeHandle:ar,useInsertionEffect:ar,useLayoutEffect:ar,useMemo:ar,useReducer:ar,useRef:ar,useState:ar,useDebugValue:ar,useDeferredValue:ar,useTransition:ar,useMutableSource:ar,useSyncExternalStore:ar,useId:ar,unstable_isNewReconciler:!1},o2={readContext:gs,useCallback:function(e,t){return Ys().memoizedState=[e,t===void 0?null:t],e},useContext:gs,useEffect:Xv,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Hf(4194308,4,LC.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Hf(4194308,4,e,t)},useInsertionEffect:function(e,t){return Hf(4,2,e,t)},useMemo:function(e,t){var n=Ys();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ys();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=s2.bind(null,xn,e),[r.memoizedState,e]},useRef:function(e){var t=Ys();return e={current:e},t.memoizedState=e},useState:Jv,useDebugValue:pw,useDeferredValue:function(e){return Ys().memoizedState=e},useTransition:function(){var e=Jv(!1),t=e[0];return e=r2.bind(null,e[1]),Ys().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=xn,s=Ys();if(fn){if(n===void 0)throw Error(je(407));n=n()}else{if(n=t(),Qn===null)throw Error(je(349));ia&30||EC(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,Xv(PC.bind(null,r,i,e),[e]),r.flags|=2048,Su(9,AC.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Ys(),t=Qn.identifierPrefix;if(fn){var n=Ni,r=Si;n=(r&~(1<<32-Ls(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=ku++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=n2++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},a2={readContext:gs,useCallback:DC,useContext:gs,useEffect:fw,useImperativeHandle:OC,useInsertionEffect:MC,useLayoutEffect:$C,useMemo:FC,useReducer:Mm,useRef:RC,useState:function(){return Mm(vu)},useDebugValue:pw,useDeferredValue:function(e){var t=ys();return zC(t,Hn.memoizedState,e)},useTransition:function(){var e=Mm(vu)[0],t=ys().memoizedState;return[e,t]},useMutableSource:CC,useSyncExternalStore:_C,useId:HC,unstable_isNewReconciler:!1},l2={readContext:gs,useCallback:DC,useContext:gs,useEffect:fw,useImperativeHandle:OC,useInsertionEffect:MC,useLayoutEffect:$C,useMemo:FC,useReducer:$m,useRef:RC,useState:function(){return $m(vu)},useDebugValue:pw,useDeferredValue:function(e){var t=ys();return Hn===null?t.memoizedState=e:zC(t,Hn.memoizedState,e)},useTransition:function(){var e=$m(vu)[0],t=ys().memoizedState;return[e,t]},useMutableSource:CC,useSyncExternalStore:_C,useId:HC,unstable_isNewReconciler:!1};function Es(e,t){if(e&&e.defaultProps){t=wn({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function py(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:wn({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var dh={isMounted:function(e){return(e=e._reactInternals)?ba(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Sr(),s=go(e),i=Ei(r,s);i.payload=t,n!=null&&(i.callback=n),t=ho(e,i,s),t!==null&&(Os(t,e,s,r),Ff(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Sr(),s=go(e),i=Ei(r,s);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=ho(e,i,s),t!==null&&(Os(t,e,s,r),Ff(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Sr(),r=go(e),s=Ei(n,r);s.tag=2,t!=null&&(s.callback=t),t=ho(e,s,r),t!==null&&(Os(t,e,r,n),Ff(t,e,r))}};function Qv(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?!mu(n,r)||!mu(s,i):!0}function KC(e,t,n){var r=!1,s=vo,i=t.contextType;return typeof i=="object"&&i!==null?i=gs(i):(s=Or(t)?ra:fr.current,r=t.contextTypes,i=(r=r!=null)?Nl(e,s):vo),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=dh,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=i),t}function Zv(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&&dh.enqueueReplaceState(t,t.state,null)}function hy(e,t,n,r){var s=e.stateNode;s.props=n,s.state=e.memoizedState,s.refs={},iw(e);var i=t.contextType;typeof i=="object"&&i!==null?s.context=gs(i):(i=Or(t)?ra:fr.current,s.context=Nl(e,i)),s.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(py(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&&dh.enqueueReplaceState(s,s.state,null),xp(e,n,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function El(e,t){try{var n="",r=t;do n+=LR(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 Lm(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function my(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var c2=typeof WeakMap=="function"?WeakMap:Map;function UC(e,t,n){n=Ei(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Sp||(Sp=!0,jy=r),my(e,t)},n}function qC(e,t,n){n=Ei(-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(){my(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){my(e,t),typeof r!="function"&&(mo===null?mo=new Set([this]):mo.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function e0(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new c2;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=S2.bind(null,e,t,n),t.then(e,e))}function t0(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 n0(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=Ei(-1,1),t.tag=2,ho(n,t,1))),n.lanes|=1),e)}var u2=Li.ReactCurrentOwner,Rr=!1;function kr(e,t,n,r){t.child=e===null?vC(t,null,n,r):Cl(t,e.child,n,r)}function r0(e,t,n,r,s){n=n.render;var i=t.ref;return hl(t,s),r=uw(e,t,n,r,i,s),n=dw(),e!==null&&!Rr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Ri(e,t,s)):(fn&&n&&Qx(t),t.flags|=1,kr(e,t,r,s),t.child)}function s0(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!kw(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,YC(e,t,i,r,s)):(e=Kf(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:mu,n(a,r)&&e.ref===t.ref)return Ri(e,t,s)}return t.flags|=1,e=yo(i,r),e.ref=t.ref,e.return=t,t.child=e}function YC(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(mu(i,r)&&e.ref===t.ref)if(Rr=!1,t.pendingProps=r=i,(e.lanes&s)!==0)e.flags&131072&&(Rr=!0);else return t.lanes=e.lanes,Ri(e,t,s)}return gy(e,t,n,r,s)}function GC(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},en(sl,Yr),Yr|=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,en(sl,Yr),Yr|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,en(sl,Yr),Yr|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,en(sl,Yr),Yr|=r;return kr(e,t,s,n),t.child}function JC(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function gy(e,t,n,r,s){var i=Or(n)?ra:fr.current;return i=Nl(t,i),hl(t,s),n=uw(e,t,n,r,i,s),r=dw(),e!==null&&!Rr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Ri(e,t,s)):(fn&&r&&Qx(t),t.flags|=1,kr(e,t,n,s),t.child)}function i0(e,t,n,r,s){if(Or(n)){var i=!0;pp(t)}else i=!1;if(hl(t,s),t.stateNode===null)Bf(e,t),KC(t,n,r),hy(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=gs(u):(u=Or(n)?ra:fr.current,u=Nl(t,u));var p=n.getDerivedStateFromProps,f=typeof p=="function"||typeof a.getSnapshotBeforeUpdate=="function";f||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==r||c!==u)&&Zv(t,a,r,u),eo=!1;var d=t.memoizedState;a.state=d,xp(t,r,a,s),c=t.memoizedState,l!==r||d!==c||Lr.current||eo?(typeof p=="function"&&(py(t,n,p,r),c=t.memoizedState),(l=eo||Qv(t,n,l,r,d,c,u))?(f||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,NC(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:Es(t.type,l),a.props=u,f=t.pendingProps,d=a.context,c=n.contextType,typeof c=="object"&&c!==null?c=gs(c):(c=Or(n)?ra:fr.current,c=Nl(t,c));var h=n.getDerivedStateFromProps;(p=typeof h=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==f||d!==c)&&Zv(t,a,r,c),eo=!1,d=t.memoizedState,a.state=d,xp(t,r,a,s);var y=t.memoizedState;l!==f||d!==y||Lr.current||eo?(typeof h=="function"&&(py(t,n,h,r),y=t.memoizedState),(u=eo||Qv(t,n,u,r,d,y,c)||!1)?(p||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,y,c),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,y,c)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=y),a.props=r,a.state=y,a.context=c,r=u):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),r=!1)}return yy(e,t,n,r,i,s)}function yy(e,t,n,r,s,i){JC(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return s&&Vv(t,n,!1),Ri(e,t,i);r=t.stateNode,u2.current=t;var l=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=Cl(t,e.child,null,i),t.child=Cl(t,null,l,i)):kr(e,t,l,i),t.memoizedState=r.state,s&&Vv(t,n,!0),t.child}function XC(e){var t=e.stateNode;t.pendingContext?Wv(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Wv(e,t.context,!1),ow(e,t.containerInfo)}function o0(e,t,n,r,s){return jl(),ew(s),t.flags|=256,kr(e,t,n,r),t.child}var xy={dehydrated:null,treeContext:null,retryLane:0};function wy(e){return{baseLanes:e,cachePool:null,transitions:null}}function QC(e,t,n){var r=t.pendingProps,s=gn.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),en(gn,s&1),e===null)return dy(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=hh(a,r,0,null),e=Xo(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=wy(n),t.memoizedState=xy,e):hw(t,a));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return d2(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=yo(s,c),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?i=yo(l,i):(i=Xo(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?wy(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=e.childLanes&~n,t.memoizedState=xy,r}return i=e.child,e=i.sibling,r=yo(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 hw(e,t){return t=hh({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Qd(e,t,n,r){return r!==null&&ew(r),Cl(t,e.child,null,n),e=hw(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function d2(e,t,n,r,s,i,a){if(n)return t.flags&256?(t.flags&=-257,r=Lm(Error(je(422))),Qd(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,s=t.mode,r=hh({mode:"visible",children:r.children},s,0,null),i=Xo(i,s,a,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&Cl(t,e.child,null,a),t.child.memoizedState=wy(a),t.memoizedState=xy,i);if(!(t.mode&1))return Qd(e,t,a,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(je(419)),r=Lm(i,r,void 0),Qd(e,t,a,r)}if(l=(a&e.childLanes)!==0,Rr||l){if(r=Qn,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,Ti(e,s),Os(r,e,s,-1))}return bw(),r=Lm(Error(je(421))),Qd(e,t,a,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=N2.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,Xr=po(s.nextSibling),Zr=t,fn=!0,Is=null,e!==null&&(us[ds++]=Si,us[ds++]=Ni,us[ds++]=sa,Si=e.id,Ni=e.overflow,sa=t),t=hw(t,r.children),t.flags|=4096,t)}function a0(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),fy(e.return,t,n)}function Om(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 ZC(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;if(kr(e,t,r.children,n),r=gn.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&&a0(e,n,t);else if(e.tag===19)a0(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(en(gn,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&&wp(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),Om(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&&wp(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}Om(t,!0,n,null,i);break;case"together":Om(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Bf(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Ri(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),oa|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(je(153));if(t.child!==null){for(e=t.child,n=yo(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=yo(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function f2(e,t,n){switch(t.tag){case 3:XC(t),jl();break;case 5:jC(t);break;case 1:Or(t.type)&&pp(t);break;case 4:ow(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;en(gp,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(en(gn,gn.current&1),t.flags|=128,null):n&t.child.childLanes?QC(e,t,n):(en(gn,gn.current&1),e=Ri(e,t,n),e!==null?e.sibling:null);en(gn,gn.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return ZC(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),en(gn,gn.current),r)break;return null;case 22:case 23:return t.lanes=0,GC(e,t,n)}return Ri(e,t,n)}var e_,by,t_,n_;e_=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}};by=function(){};t_=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,qo(si.current);var i=null;switch(n){case"input":s=Bg(e,s),r=Bg(e,r),i=[];break;case"select":s=wn({},s,{value:void 0}),r=wn({},r,{value:void 0}),i=[];break;case"textarea":s=Kg(e,s),r=Kg(e,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=dp)}qg(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"&&(lu.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"&&(lu.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&on("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)}};n_=function(e,t,n,r){n!==r&&(t.flags|=4)};function wc(e,t){if(!fn)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 lr(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 p2(e,t,n){var r=t.pendingProps;switch(Zx(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return lr(t),null;case 1:return Or(t.type)&&fp(),lr(t),null;case 3:return r=t.stateNode,_l(),ln(Lr),ln(fr),lw(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Jd(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Is!==null&&(Ey(Is),Is=null))),by(e,t),lr(t),null;case 5:aw(t);var s=qo(bu.current);if(n=t.type,e!==null&&t.stateNode!=null)t_(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(je(166));return lr(t),null}if(e=qo(si.current),Jd(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[Qs]=t,r[xu]=i,e=(t.mode&1)!==0,n){case"dialog":on("cancel",r),on("close",r);break;case"iframe":case"object":case"embed":on("load",r);break;case"video":case"audio":for(s=0;s<$c.length;s++)on($c[s],r);break;case"source":on("error",r);break;case"img":case"image":case"link":on("error",r),on("load",r);break;case"details":on("toggle",r);break;case"input":gv(r,i),on("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},on("invalid",r);break;case"textarea":xv(r,i),on("invalid",r)}qg(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&&Gd(r.textContent,l,e),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&Gd(r.textContent,l,e),s=["children",""+l]):lu.hasOwnProperty(a)&&l!=null&&a==="onScroll"&&on("scroll",r)}switch(n){case"input":Hd(r),yv(r,i,!0);break;case"textarea":Hd(r),wv(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=dp)}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=P1(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[Qs]=t,e[xu]=r,e_(e,t,!1,!1),t.stateNode=e;e:{switch(a=Yg(n,r),n){case"dialog":on("cancel",e),on("close",e),s=r;break;case"iframe":case"object":case"embed":on("load",e),s=r;break;case"video":case"audio":for(s=0;s<$c.length;s++)on($c[s],e);s=r;break;case"source":on("error",e),s=r;break;case"img":case"image":case"link":on("error",e),on("load",e),s=r;break;case"details":on("toggle",e),s=r;break;case"input":gv(e,r),s=Bg(e,r),on("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=wn({},r,{value:void 0}),on("invalid",e);break;case"textarea":xv(e,r),s=Kg(e,r),on("invalid",e);break;default:s=r}qg(n,s),l=s;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?R1(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&I1(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&cu(e,c):typeof c=="number"&&cu(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(lu.hasOwnProperty(i)?c!=null&&i==="onScroll"&&on("scroll",e):c!=null&&Dx(e,i,c,a))}switch(n){case"input":Hd(e),yv(e,r,!1);break;case"textarea":Hd(e),wv(e);break;case"option":r.value!=null&&e.setAttribute("value",""+ko(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?ul(e,!!r.multiple,i,!1):r.defaultValue!=null&&ul(e,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=dp)}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 lr(t),null;case 6:if(e&&t.stateNode!=null)n_(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(je(166));if(n=qo(bu.current),qo(si.current),Jd(t)){if(r=t.stateNode,n=t.memoizedProps,r[Qs]=t,(i=r.nodeValue!==n)&&(e=Zr,e!==null))switch(e.tag){case 3:Gd(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Gd(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Qs]=t,t.stateNode=r}return lr(t),null;case 13:if(ln(gn),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(fn&&Xr!==null&&t.mode&1&&!(t.flags&128))bC(),jl(),t.flags|=98560,i=!1;else if(i=Jd(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(je(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(je(317));i[Qs]=t}else jl(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;lr(t),i=!1}else Is!==null&&(Ey(Is),Is=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||gn.current&1?Bn===0&&(Bn=3):bw())),t.updateQueue!==null&&(t.flags|=4),lr(t),null);case 4:return _l(),by(e,t),e===null&&gu(t.stateNode.containerInfo),lr(t),null;case 10:return rw(t.type._context),lr(t),null;case 17:return Or(t.type)&&fp(),lr(t),null;case 19:if(ln(gn),i=t.memoizedState,i===null)return lr(t),null;if(r=(t.flags&128)!==0,a=i.rendering,a===null)if(r)wc(i,!1);else{if(Bn!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=wp(e),a!==null){for(t.flags|=128,wc(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 en(gn,gn.current&1|2),t.child}e=e.sibling}i.tail!==null&&An()>Al&&(t.flags|=128,r=!0,wc(i,!1),t.lanes=4194304)}else{if(!r)if(e=wp(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),wc(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!fn)return lr(t),null}else 2*An()-i.renderingStartTime>Al&&n!==1073741824&&(t.flags|=128,r=!0,wc(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=An(),t.sibling=null,n=gn.current,en(gn,r?n&1|2:n&1),t):(lr(t),null);case 22:case 23:return ww(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Yr&1073741824&&(lr(t),t.subtreeFlags&6&&(t.flags|=8192)):lr(t),null;case 24:return null;case 25:return null}throw Error(je(156,t.tag))}function h2(e,t){switch(Zx(t),t.tag){case 1:return Or(t.type)&&fp(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return _l(),ln(Lr),ln(fr),lw(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return aw(t),null;case 13:if(ln(gn),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(je(340));jl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ln(gn),null;case 4:return _l(),null;case 10:return rw(t.type._context),null;case 22:case 23:return ww(),null;case 24:return null;default:return null}}var Zd=!1,cr=!1,m2=typeof WeakSet=="function"?WeakSet:Set,Fe=null;function rl(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){jn(e,t,r)}else n.current=null}function ky(e,t,n){try{n()}catch(r){jn(e,t,r)}}var l0=!1;function g2(e,t){if(sy=lp,e=aC(),Xx(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,p=0,f=e,d=null;t:for(;;){for(var h;f!==n||s!==0&&f.nodeType!==3||(l=a+s),f!==i||r!==0&&f.nodeType!==3||(c=a+r),f.nodeType===3&&(a+=f.nodeValue.length),(h=f.firstChild)!==null;)d=f,f=h;for(;;){if(f===e)break t;if(d===n&&++u===s&&(l=a),d===i&&++p===r&&(c=a),(h=f.nextSibling)!==null)break;f=d,d=f.parentNode}f=h}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(iy={focusedElem:e,selectionRange:n},lp=!1,Fe=t;Fe!==null;)if(t=Fe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Fe=e;else for(;Fe!==null;){t=Fe;try{var y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var b=y.memoizedProps,k=y.memoizedState,g=t.stateNode,w=g.getSnapshotBeforeUpdate(t.elementType===t.type?b:Es(t.type,b),k);g.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var x=t.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(je(163))}}catch(N){jn(t,t.return,N)}if(e=t.sibling,e!==null){e.return=t.return,Fe=e;break}Fe=t.return}return y=l0,l0=!1,y}function Yc(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&&ky(t,n,i)}s=s.next}while(s!==r)}}function fh(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 vy(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 r_(e){var t=e.alternate;t!==null&&(e.alternate=null,r_(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Qs],delete t[xu],delete t[ly],delete t[QM],delete t[ZM])),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 s_(e){return e.tag===5||e.tag===3||e.tag===4}function c0(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||s_(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 Sy(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=dp));else if(r!==4&&(e=e.child,e!==null))for(Sy(e,t,n),e=e.sibling;e!==null;)Sy(e,t,n),e=e.sibling}function Ny(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(Ny(e,t,n),e=e.sibling;e!==null;)Ny(e,t,n),e=e.sibling}var tr=null,As=!1;function qi(e,t,n){for(n=n.child;n!==null;)i_(e,t,n),n=n.sibling}function i_(e,t,n){if(ri&&typeof ri.onCommitFiberUnmount=="function")try{ri.onCommitFiberUnmount(sh,n)}catch{}switch(n.tag){case 5:cr||rl(n,t);case 6:var r=tr,s=As;tr=null,qi(e,t,n),tr=r,As=s,tr!==null&&(As?(e=tr,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):tr.removeChild(n.stateNode));break;case 18:tr!==null&&(As?(e=tr,n=n.stateNode,e.nodeType===8?Pm(e.parentNode,n):e.nodeType===1&&Pm(e,n),pu(e)):Pm(tr,n.stateNode));break;case 4:r=tr,s=As,tr=n.stateNode.containerInfo,As=!0,qi(e,t,n),tr=r,As=s;break;case 0:case 11:case 14:case 15:if(!cr&&(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)&&ky(n,t,a),s=s.next}while(s!==r)}qi(e,t,n);break;case 1:if(!cr&&(rl(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){jn(n,t,l)}qi(e,t,n);break;case 21:qi(e,t,n);break;case 22:n.mode&1?(cr=(r=cr)||n.memoizedState!==null,qi(e,t,n),cr=r):qi(e,t,n);break;default:qi(e,t,n)}}function u0(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new m2),t.forEach(function(r){var s=j2.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Ns(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:tr=l.stateNode,As=!1;break e;case 3:tr=l.stateNode.containerInfo,As=!0;break e;case 4:tr=l.stateNode.containerInfo,As=!0;break e}l=l.return}if(tr===null)throw Error(je(160));i_(i,a,s),tr=null,As=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(u){jn(s,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)o_(t,e),t=t.sibling}function o_(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Ns(t,e),Ks(e),r&4){try{Yc(3,e,e.return),fh(3,e)}catch(b){jn(e,e.return,b)}try{Yc(5,e,e.return)}catch(b){jn(e,e.return,b)}}break;case 1:Ns(t,e),Ks(e),r&512&&n!==null&&rl(n,n.return);break;case 5:if(Ns(t,e),Ks(e),r&512&&n!==null&&rl(n,n.return),e.flags&32){var s=e.stateNode;try{cu(s,"")}catch(b){jn(e,e.return,b)}}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&&E1(s,i),Yg(l,a);var u=Yg(l,i);for(a=0;a<c.length;a+=2){var p=c[a],f=c[a+1];p==="style"?R1(s,f):p==="dangerouslySetInnerHTML"?I1(s,f):p==="children"?cu(s,f):Dx(s,p,f,u)}switch(l){case"input":Wg(s,i);break;case"textarea":A1(s,i);break;case"select":var d=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var h=i.value;h!=null?ul(s,!!i.multiple,h,!1):d!==!!i.multiple&&(i.defaultValue!=null?ul(s,!!i.multiple,i.defaultValue,!0):ul(s,!!i.multiple,i.multiple?[]:"",!1))}s[xu]=i}catch(b){jn(e,e.return,b)}}break;case 6:if(Ns(t,e),Ks(e),r&4){if(e.stateNode===null)throw Error(je(162));s=e.stateNode,i=e.memoizedProps;try{s.nodeValue=i}catch(b){jn(e,e.return,b)}}break;case 3:if(Ns(t,e),Ks(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{pu(t.containerInfo)}catch(b){jn(e,e.return,b)}break;case 4:Ns(t,e),Ks(e);break;case 13:Ns(t,e),Ks(e),s=e.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(yw=An())),r&4&&u0(e);break;case 22:if(p=n!==null&&n.memoizedState!==null,e.mode&1?(cr=(u=cr)||p,Ns(t,e),cr=u):Ns(t,e),Ks(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!p&&e.mode&1)for(Fe=e,p=e.child;p!==null;){for(f=Fe=p;Fe!==null;){switch(d=Fe,h=d.child,d.tag){case 0:case 11:case 14:case 15:Yc(4,d,d.return);break;case 1:rl(d,d.return);var y=d.stateNode;if(typeof y.componentWillUnmount=="function"){r=d,n=d.return;try{t=r,y.props=t.memoizedProps,y.state=t.memoizedState,y.componentWillUnmount()}catch(b){jn(r,n,b)}}break;case 5:rl(d,d.return);break;case 22:if(d.memoizedState!==null){f0(f);continue}}h!==null?(h.return=d,Fe=h):f0(f)}p=p.sibling}e:for(p=null,f=e;;){if(f.tag===5){if(p===null){p=f;try{s=f.stateNode,u?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=f.stateNode,c=f.memoizedProps.style,a=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=T1("display",a))}catch(b){jn(e,e.return,b)}}}else if(f.tag===6){if(p===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(b){jn(e,e.return,b)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;p===f&&(p=null),f=f.return}p===f&&(p=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Ns(t,e),Ks(e),r&4&&u0(e);break;case 21:break;default:Ns(t,e),Ks(e)}}function Ks(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(s_(n)){var r=n;break e}n=n.return}throw Error(je(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(cu(s,""),r.flags&=-33);var i=c0(e);Ny(e,i,s);break;case 3:case 4:var a=r.stateNode.containerInfo,l=c0(e);Sy(e,l,a);break;default:throw Error(je(161))}}catch(c){jn(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function y2(e,t,n){Fe=e,a_(e)}function a_(e,t,n){for(var r=(e.mode&1)!==0;Fe!==null;){var s=Fe,i=s.child;if(s.tag===22&&r){var a=s.memoizedState!==null||Zd;if(!a){var l=s.alternate,c=l!==null&&l.memoizedState!==null||cr;l=Zd;var u=cr;if(Zd=a,(cr=c)&&!u)for(Fe=s;Fe!==null;)a=Fe,c=a.child,a.tag===22&&a.memoizedState!==null?p0(s):c!==null?(c.return=a,Fe=c):p0(s);for(;i!==null;)Fe=i,a_(i),i=i.sibling;Fe=s,Zd=l,cr=u}d0(e)}else s.subtreeFlags&8772&&i!==null?(i.return=s,Fe=i):d0(e)}}function d0(e){for(;Fe!==null;){var t=Fe;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:cr||fh(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!cr)if(n===null)r.componentDidMount();else{var s=t.elementType===t.type?n.memoizedProps:Es(t.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&Gv(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}Gv(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 p=u.memoizedState;if(p!==null){var f=p.dehydrated;f!==null&&pu(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(je(163))}cr||t.flags&512&&vy(t)}catch(d){jn(t,t.return,d)}}if(t===e){Fe=null;break}if(n=t.sibling,n!==null){n.return=t.return,Fe=n;break}Fe=t.return}}function f0(e){for(;Fe!==null;){var t=Fe;if(t===e){Fe=null;break}var n=t.sibling;if(n!==null){n.return=t.return,Fe=n;break}Fe=t.return}}function p0(e){for(;Fe!==null;){var t=Fe;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{fh(4,t)}catch(c){jn(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(c){jn(t,s,c)}}var i=t.return;try{vy(t)}catch(c){jn(t,i,c)}break;case 5:var a=t.return;try{vy(t)}catch(c){jn(t,a,c)}}}catch(c){jn(t,t.return,c)}if(t===e){Fe=null;break}var l=t.sibling;if(l!==null){l.return=t.return,Fe=l;break}Fe=t.return}}var x2=Math.ceil,vp=Li.ReactCurrentDispatcher,mw=Li.ReactCurrentOwner,ms=Li.ReactCurrentBatchConfig,Tt=0,Qn=null,Rn=null,nr=0,Yr=0,sl=Eo(0),Bn=0,Nu=null,oa=0,ph=0,gw=0,Gc=null,Tr=null,yw=0,Al=1/0,bi=null,Sp=!1,jy=null,mo=null,ef=!1,oo=null,Np=0,Jc=0,Cy=null,Wf=-1,Vf=0;function Sr(){return Tt&6?An():Wf!==-1?Wf:Wf=An()}function go(e){return e.mode&1?Tt&2&&nr!==0?nr&-nr:t2.transition!==null?(Vf===0&&(Vf=K1()),Vf):(e=Kt,e!==0||(e=window.event,e=e===void 0?16:Q1(e.type)),e):1}function Os(e,t,n,r){if(50<Jc)throw Jc=0,Cy=null,Error(je(185));qu(e,n,r),(!(Tt&2)||e!==Qn)&&(e===Qn&&(!(Tt&2)&&(ph|=n),Bn===4&&ro(e,nr)),Dr(e,r),n===1&&Tt===0&&!(t.mode&1)&&(Al=An()+500,ch&&Ao()))}function Dr(e,t){var n=e.callbackNode;tM(e,t);var r=ap(e,e===Qn?nr:0);if(r===0)n!==null&&vv(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&vv(n),t===1)e.tag===0?e2(h0.bind(null,e)):yC(h0.bind(null,e)),JM(function(){!(Tt&6)&&Ao()}),n=null;else{switch(U1(r)){case 1:n=Wx;break;case 4:n=W1;break;case 16:n=op;break;case 536870912:n=V1;break;default:n=op}n=m_(n,l_.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function l_(e,t){if(Wf=-1,Vf=0,Tt&6)throw Error(je(327));var n=e.callbackNode;if(ml()&&e.callbackNode!==n)return null;var r=ap(e,e===Qn?nr:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=jp(e,r);else{t=r;var s=Tt;Tt|=2;var i=u_();(Qn!==e||nr!==t)&&(bi=null,Al=An()+500,Jo(e,t));do try{k2();break}catch(l){c_(e,l)}while(!0);nw(),vp.current=i,Tt=s,Rn!==null?t=0:(Qn=null,nr=0,t=Bn)}if(t!==0){if(t===2&&(s=Zg(e),s!==0&&(r=s,t=_y(e,s))),t===1)throw n=Nu,Jo(e,0),ro(e,r),Dr(e,An()),n;if(t===6)ro(e,r);else{if(s=e.current.alternate,!(r&30)&&!w2(s)&&(t=jp(e,r),t===2&&(i=Zg(e),i!==0&&(r=i,t=_y(e,i))),t===1))throw n=Nu,Jo(e,0),ro(e,r),Dr(e,An()),n;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(je(345));case 2:Fo(e,Tr,bi);break;case 3:if(ro(e,r),(r&130023424)===r&&(t=yw+500-An(),10<t)){if(ap(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){Sr(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=ay(Fo.bind(null,e,Tr,bi),t);break}Fo(e,Tr,bi);break;case 4:if(ro(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var a=31-Ls(r);i=1<<a,a=t[a],a>s&&(s=a),r&=~i}if(r=s,r=An()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*x2(r/1960))-r,10<r){e.timeoutHandle=ay(Fo.bind(null,e,Tr,bi),r);break}Fo(e,Tr,bi);break;case 5:Fo(e,Tr,bi);break;default:throw Error(je(329))}}}return Dr(e,An()),e.callbackNode===n?l_.bind(null,e):null}function _y(e,t){var n=Gc;return e.current.memoizedState.isDehydrated&&(Jo(e,t).flags|=256),e=jp(e,t),e!==2&&(t=Tr,Tr=n,t!==null&&Ey(t)),e}function Ey(e){Tr===null?Tr=e:Tr.push.apply(Tr,e)}function w2(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(!Fs(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 ro(e,t){for(t&=~gw,t&=~ph,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Ls(t),r=1<<n;e[n]=-1,t&=~r}}function h0(e){if(Tt&6)throw Error(je(327));ml();var t=ap(e,0);if(!(t&1))return Dr(e,An()),null;var n=jp(e,t);if(e.tag!==0&&n===2){var r=Zg(e);r!==0&&(t=r,n=_y(e,r))}if(n===1)throw n=Nu,Jo(e,0),ro(e,t),Dr(e,An()),n;if(n===6)throw Error(je(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Fo(e,Tr,bi),Dr(e,An()),null}function xw(e,t){var n=Tt;Tt|=1;try{return e(t)}finally{Tt=n,Tt===0&&(Al=An()+500,ch&&Ao())}}function aa(e){oo!==null&&oo.tag===0&&!(Tt&6)&&ml();var t=Tt;Tt|=1;var n=ms.transition,r=Kt;try{if(ms.transition=null,Kt=1,e)return e()}finally{Kt=r,ms.transition=n,Tt=t,!(Tt&6)&&Ao()}}function ww(){Yr=sl.current,ln(sl)}function Jo(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,GM(n)),Rn!==null)for(n=Rn.return;n!==null;){var r=n;switch(Zx(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&fp();break;case 3:_l(),ln(Lr),ln(fr),lw();break;case 5:aw(r);break;case 4:_l();break;case 13:ln(gn);break;case 19:ln(gn);break;case 10:rw(r.type._context);break;case 22:case 23:ww()}n=n.return}if(Qn=e,Rn=e=yo(e.current,null),nr=Yr=t,Bn=0,Nu=null,gw=ph=oa=0,Tr=Gc=null,Uo!==null){for(t=0;t<Uo.length;t++)if(n=Uo[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}Uo=null}return e}function c_(e,t){do{var n=Rn;try{if(nw(),zf.current=kp,bp){for(var r=xn.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}bp=!1}if(ia=0,Jn=Hn=xn=null,qc=!1,ku=0,mw.current=null,n===null||n.return===null){Bn=1,Nu=t,Rn=null;break}e:{var i=e,a=n.return,l=n,c=t;if(t=nr,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,p=l,f=p.tag;if(!(p.mode&1)&&(f===0||f===11||f===15)){var d=p.alternate;d?(p.updateQueue=d.updateQueue,p.memoizedState=d.memoizedState,p.lanes=d.lanes):(p.updateQueue=null,p.memoizedState=null)}var h=t0(a);if(h!==null){h.flags&=-257,n0(h,a,l,i,t),h.mode&1&&e0(i,u,t),t=h,c=u;var y=t.updateQueue;if(y===null){var b=new Set;b.add(c),t.updateQueue=b}else y.add(c);break e}else{if(!(t&1)){e0(i,u,t),bw();break e}c=Error(je(426))}}else if(fn&&l.mode&1){var k=t0(a);if(k!==null){!(k.flags&65536)&&(k.flags|=256),n0(k,a,l,i,t),ew(El(c,l));break e}}i=c=El(c,l),Bn!==4&&(Bn=2),Gc===null?Gc=[i]:Gc.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var g=UC(i,c,t);Yv(i,g);break e;case 1:l=c;var w=i.type,x=i.stateNode;if(!(i.flags&128)&&(typeof w.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(mo===null||!mo.has(x)))){i.flags|=65536,t&=-t,i.lanes|=t;var N=qC(i,l,t);Yv(i,N);break e}}i=i.return}while(i!==null)}f_(n)}catch(C){t=C,Rn===n&&n!==null&&(Rn=n=n.return);continue}break}while(!0)}function u_(){var e=vp.current;return vp.current=kp,e===null?kp:e}function bw(){(Bn===0||Bn===3||Bn===2)&&(Bn=4),Qn===null||!(oa&268435455)&&!(ph&268435455)||ro(Qn,nr)}function jp(e,t){var n=Tt;Tt|=2;var r=u_();(Qn!==e||nr!==t)&&(bi=null,Jo(e,t));do try{b2();break}catch(s){c_(e,s)}while(!0);if(nw(),Tt=n,vp.current=r,Rn!==null)throw Error(je(261));return Qn=null,nr=0,Bn}function b2(){for(;Rn!==null;)d_(Rn)}function k2(){for(;Rn!==null&&!UR();)d_(Rn)}function d_(e){var t=h_(e.alternate,e,Yr);e.memoizedProps=e.pendingProps,t===null?f_(e):Rn=t,mw.current=null}function f_(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=h2(n,t),n!==null){n.flags&=32767,Rn=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Bn=6,Rn=null;return}}else if(n=p2(n,t,Yr),n!==null){Rn=n;return}if(t=t.sibling,t!==null){Rn=t;return}Rn=t=e}while(t!==null);Bn===0&&(Bn=5)}function Fo(e,t,n){var r=Kt,s=ms.transition;try{ms.transition=null,Kt=1,v2(e,t,n,r)}finally{ms.transition=s,Kt=r}return null}function v2(e,t,n,r){do ml();while(oo!==null);if(Tt&6)throw Error(je(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(je(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(nM(e,i),e===Qn&&(Rn=Qn=null,nr=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||ef||(ef=!0,m_(op,function(){return ml(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=ms.transition,ms.transition=null;var a=Kt;Kt=1;var l=Tt;Tt|=4,mw.current=null,g2(e,n),o_(n,e),BM(iy),lp=!!sy,iy=sy=null,e.current=n,y2(n),qR(),Tt=l,Kt=a,ms.transition=i}else e.current=n;if(ef&&(ef=!1,oo=e,Np=s),i=e.pendingLanes,i===0&&(mo=null),JR(n.stateNode),Dr(e,An()),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(Sp)throw Sp=!1,e=jy,jy=null,e;return Np&1&&e.tag!==0&&ml(),i=e.pendingLanes,i&1?e===Cy?Jc++:(Jc=0,Cy=e):Jc=0,Ao(),null}function ml(){if(oo!==null){var e=U1(Np),t=ms.transition,n=Kt;try{if(ms.transition=null,Kt=16>e?16:e,oo===null)var r=!1;else{if(e=oo,oo=null,Np=0,Tt&6)throw Error(je(331));var s=Tt;for(Tt|=4,Fe=e.current;Fe!==null;){var i=Fe,a=i.child;if(Fe.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(Fe=u;Fe!==null;){var p=Fe;switch(p.tag){case 0:case 11:case 15:Yc(8,p,i)}var f=p.child;if(f!==null)f.return=p,Fe=f;else for(;Fe!==null;){p=Fe;var d=p.sibling,h=p.return;if(r_(p),p===u){Fe=null;break}if(d!==null){d.return=h,Fe=d;break}Fe=h}}}var y=i.alternate;if(y!==null){var b=y.child;if(b!==null){y.child=null;do{var k=b.sibling;b.sibling=null,b=k}while(b!==null)}}Fe=i}}if(i.subtreeFlags&2064&&a!==null)a.return=i,Fe=a;else e:for(;Fe!==null;){if(i=Fe,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Yc(9,i,i.return)}var g=i.sibling;if(g!==null){g.return=i.return,Fe=g;break e}Fe=i.return}}var w=e.current;for(Fe=w;Fe!==null;){a=Fe;var x=a.child;if(a.subtreeFlags&2064&&x!==null)x.return=a,Fe=x;else e:for(a=w;Fe!==null;){if(l=Fe,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:fh(9,l)}}catch(C){jn(l,l.return,C)}if(l===a){Fe=null;break e}var N=l.sibling;if(N!==null){N.return=l.return,Fe=N;break e}Fe=l.return}}if(Tt=s,Ao(),ri&&typeof ri.onPostCommitFiberRoot=="function")try{ri.onPostCommitFiberRoot(sh,e)}catch{}r=!0}return r}finally{Kt=n,ms.transition=t}}return!1}function m0(e,t,n){t=El(n,t),t=UC(e,t,1),e=ho(e,t,1),t=Sr(),e!==null&&(qu(e,1,t),Dr(e,t))}function jn(e,t,n){if(e.tag===3)m0(e,e,n);else for(;t!==null;){if(t.tag===3){m0(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(mo===null||!mo.has(r))){e=El(n,e),e=qC(t,e,1),t=ho(t,e,1),e=Sr(),t!==null&&(qu(t,1,e),Dr(t,e));break}}t=t.return}}function S2(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Sr(),e.pingedLanes|=e.suspendedLanes&n,Qn===e&&(nr&n)===n&&(Bn===4||Bn===3&&(nr&130023424)===nr&&500>An()-yw?Jo(e,0):gw|=n),Dr(e,t)}function p_(e,t){t===0&&(e.mode&1?(t=Vd,Vd<<=1,!(Vd&130023424)&&(Vd=4194304)):t=1);var n=Sr();e=Ti(e,t),e!==null&&(qu(e,t,n),Dr(e,n))}function N2(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),p_(e,n)}function j2(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(je(314))}r!==null&&r.delete(t),p_(e,n)}var h_;h_=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Lr.current)Rr=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Rr=!1,f2(e,t,n);Rr=!!(e.flags&131072)}else Rr=!1,fn&&t.flags&1048576&&xC(t,mp,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Bf(e,t),e=t.pendingProps;var s=Nl(t,fr.current);hl(t,n),s=uw(null,t,r,e,s,n);var i=dw();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,Or(r)?(i=!0,pp(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,iw(t),s.updater=dh,t.stateNode=s,s._reactInternals=t,hy(t,r,e,n),t=yy(null,t,r,!0,i,n)):(t.tag=0,fn&&i&&Qx(t),kr(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Bf(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=_2(r),e=Es(r,e),s){case 0:t=gy(null,t,r,e,n);break e;case 1:t=i0(null,t,r,e,n);break e;case 11:t=r0(null,t,r,e,n);break e;case 14:t=s0(null,t,r,Es(r.type,e),n);break e}throw Error(je(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Es(r,s),gy(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Es(r,s),i0(e,t,r,s,n);case 3:e:{if(XC(t),e===null)throw Error(je(387));r=t.pendingProps,i=t.memoizedState,s=i.element,NC(e,t),xp(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=El(Error(je(423)),t),t=o0(e,t,r,n,s);break e}else if(r!==s){s=El(Error(je(424)),t),t=o0(e,t,r,n,s);break e}else for(Xr=po(t.stateNode.containerInfo.firstChild),Zr=t,fn=!0,Is=null,n=vC(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(jl(),r===s){t=Ri(e,t,n);break e}kr(e,t,r,n)}t=t.child}return t;case 5:return jC(t),e===null&&dy(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,a=s.children,oy(r,s)?a=null:i!==null&&oy(r,i)&&(t.flags|=32),JC(e,t),kr(e,t,a,n),t.child;case 6:return e===null&&dy(t),null;case 13:return QC(e,t,n);case 4:return ow(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Cl(t,null,r,n):kr(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Es(r,s),r0(e,t,r,s,n);case 7:return kr(e,t,t.pendingProps,n),t.child;case 8:return kr(e,t,t.pendingProps.children,n),t.child;case 12:return kr(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,en(gp,r._currentValue),r._currentValue=a,i!==null)if(Fs(i.value,a)){if(i.children===s.children&&!Lr.current){t=Ri(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=Ei(-1,n&-n),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var p=u.pending;p===null?c.next=c:(c.next=p.next,p.next=c),u.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),fy(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(je(341));a.lanes|=n,l=a.alternate,l!==null&&(l.lanes|=n),fy(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}kr(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,hl(t,n),s=gs(s),r=r(s),t.flags|=1,kr(e,t,r,n),t.child;case 14:return r=t.type,s=Es(r,t.pendingProps),s=Es(r.type,s),s0(e,t,r,s,n);case 15:return YC(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Es(r,s),Bf(e,t),t.tag=1,Or(r)?(e=!0,pp(t)):e=!1,hl(t,n),KC(t,r,s),hy(t,r,s,n),yy(null,t,r,!0,e,n);case 19:return ZC(e,t,n);case 22:return GC(e,t,n)}throw Error(je(156,t.tag))};function m_(e,t){return B1(e,t)}function C2(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 hs(e,t,n,r){return new C2(e,t,n,r)}function kw(e){return e=e.prototype,!(!e||!e.isReactComponent)}function _2(e){if(typeof e=="function")return kw(e)?1:0;if(e!=null){if(e=e.$$typeof,e===zx)return 11;if(e===Hx)return 14}return 2}function yo(e,t){var n=e.alternate;return n===null?(n=hs(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 Kf(e,t,n,r,s,i){var a=2;if(r=e,typeof e=="function")kw(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Ya:return Xo(n.children,s,i,t);case Fx:a=8,s|=8;break;case Dg:return e=hs(12,n,t,s|2),e.elementType=Dg,e.lanes=i,e;case Fg:return e=hs(13,n,t,s),e.elementType=Fg,e.lanes=i,e;case zg:return e=hs(19,n,t,s),e.elementType=zg,e.lanes=i,e;case j1:return hh(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case S1:a=10;break e;case N1:a=9;break e;case zx:a=11;break e;case Hx:a=14;break e;case Zi:a=16,r=null;break e}throw Error(je(130,e==null?e:typeof e,""))}return t=hs(a,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function Xo(e,t,n,r){return e=hs(7,e,r,t),e.lanes=n,e}function hh(e,t,n,r){return e=hs(22,e,r,t),e.elementType=j1,e.lanes=n,e.stateNode={isHidden:!1},e}function Dm(e,t,n){return e=hs(6,e,null,t),e.lanes=n,e}function Fm(e,t,n){return t=hs(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function E2(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=wm(0),this.expirationTimes=wm(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=wm(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function vw(e,t,n,r,s,i,a,l,c){return e=new E2(e,t,n,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=hs(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},iw(i),e}function A2(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:qa,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function g_(e){if(!e)return vo;e=e._reactInternals;e:{if(ba(e)!==e||e.tag!==1)throw Error(je(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Or(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(je(171))}if(e.tag===1){var n=e.type;if(Or(n))return gC(e,n,t)}return t}function y_(e,t,n,r,s,i,a,l,c){return e=vw(n,r,!0,e,s,i,a,l,c),e.context=g_(null),n=e.current,r=Sr(),s=go(n),i=Ei(r,s),i.callback=t??null,ho(n,i,s),e.current.lanes=s,qu(e,s,r),Dr(e,r),e}function mh(e,t,n,r){var s=t.current,i=Sr(),a=go(s);return n=g_(n),t.context===null?t.context=n:t.pendingContext=n,t=Ei(i,a),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=ho(s,t,a),e!==null&&(Os(e,s,a,i),Ff(e,s,a)),a}function Cp(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 g0(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Sw(e,t){g0(e,t),(e=e.alternate)&&g0(e,t)}function P2(){return null}var x_=typeof reportError=="function"?reportError:function(e){console.error(e)};function Nw(e){this._internalRoot=e}gh.prototype.render=Nw.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(je(409));mh(e,t,null,null)};gh.prototype.unmount=Nw.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;aa(function(){mh(null,e,null,null)}),t[Ii]=null}};function gh(e){this._internalRoot=e}gh.prototype.unstable_scheduleHydration=function(e){if(e){var t=G1();e={blockedOn:null,target:e,priority:t};for(var n=0;n<no.length&&t!==0&&t<no[n].priority;n++);no.splice(n,0,e),n===0&&X1(e)}};function jw(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function yh(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function y0(){}function I2(e,t,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var u=Cp(a);i.call(u)}}var a=y_(t,r,e,0,null,!1,!1,"",y0);return e._reactRootContainer=a,e[Ii]=a.current,gu(e.nodeType===8?e.parentNode:e),aa(),a}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var u=Cp(c);l.call(u)}}var c=vw(e,0,!1,null,null,!1,!1,"",y0);return e._reactRootContainer=c,e[Ii]=c.current,gu(e.nodeType===8?e.parentNode:e),aa(function(){mh(t,c,n,r)}),c}function xh(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=Cp(a);l.call(c)}}mh(t,a,e,s)}else a=I2(n,t,e,s,r);return Cp(a)}q1=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Mc(t.pendingLanes);n!==0&&(Vx(t,n|1),Dr(t,An()),!(Tt&6)&&(Al=An()+500,Ao()))}break;case 13:aa(function(){var r=Ti(e,1);if(r!==null){var s=Sr();Os(r,e,1,s)}}),Sw(e,1)}};Kx=function(e){if(e.tag===13){var t=Ti(e,134217728);if(t!==null){var n=Sr();Os(t,e,134217728,n)}Sw(e,134217728)}};Y1=function(e){if(e.tag===13){var t=go(e),n=Ti(e,t);if(n!==null){var r=Sr();Os(n,e,t,r)}Sw(e,t)}};G1=function(){return Kt};J1=function(e,t){var n=Kt;try{return Kt=e,t()}finally{Kt=n}};Jg=function(e,t,n){switch(t){case"input":if(Wg(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=lh(r);if(!s)throw Error(je(90));_1(r),Wg(r,s)}}}break;case"textarea":A1(e,n);break;case"select":t=n.value,t!=null&&ul(e,!!n.multiple,t,!1)}};L1=xw;O1=aa;var T2={usingClientEntryPoint:!1,Events:[Gu,Qa,lh,M1,$1,xw]},bc={findFiberByHostInstance:Ko,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},R2={bundleType:bc.bundleType,version:bc.version,rendererPackageName:bc.rendererPackageName,rendererConfig:bc.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Li.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=z1(e),e===null?null:e.stateNode},findFiberByHostInstance:bc.findFiberByHostInstance||P2,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 tf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!tf.isDisabled&&tf.supportsFiber)try{sh=tf.inject(R2),ri=tf}catch{}}rs.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=T2;rs.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!jw(t))throw Error(je(200));return A2(e,t,null,n)};rs.createRoot=function(e,t){if(!jw(e))throw Error(je(299));var n=!1,r="",s=x_;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=vw(e,1,!1,null,null,n,!1,r,s),e[Ii]=t.current,gu(e.nodeType===8?e.parentNode:e),new Nw(t)};rs.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(je(188)):(e=Object.keys(e).join(","),Error(je(268,e)));return e=z1(t),e=e===null?null:e.stateNode,e};rs.flushSync=function(e){return aa(e)};rs.hydrate=function(e,t,n){if(!yh(t))throw Error(je(200));return xh(null,e,t,!0,n)};rs.hydrateRoot=function(e,t,n){if(!jw(e))throw Error(je(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",a=x_;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=y_(t,null,e,1,n??null,s,!1,i,a),e[Ii]=t.current,gu(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 gh(t)};rs.render=function(e,t,n){if(!yh(t))throw Error(je(200));return xh(null,e,t,!1,n)};rs.unmountComponentAtNode=function(e){if(!yh(e))throw Error(je(40));return e._reactRootContainer?(aa(function(){xh(null,null,e,!1,function(){e._reactRootContainer=null,e[Ii]=null})}),!0):!1};rs.unstable_batchedUpdates=xw;rs.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!yh(n))throw Error(je(200));if(e==null||e._reactInternals===void 0)throw Error(je(38));return xh(e,t,n,!1,r)};rs.version="18.3.1-next-f1338f8080-20240426";function w_(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(w_)}catch(e){console.error(e)}}w_(),w1.exports=rs;var vr=w1.exports,x0=vr;Lg.createRoot=x0.createRoot,Lg.hydrateRoot=x0.hydrateRoot;const b_=m.createContext(null);function Ay(e){let t=e||"/";return t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t||"/"}function M2(){const e=Ay(window.location.pathname);return e==="/"?(window.history.replaceState({},"","/projects"),"/projects"):e}function $2({children:e}){const[t,n]=m.useState(M2);m.useEffect(()=>{const i=()=>n(Ay(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=Ay(l.pathname),u=l.search||"";window.history.pushState({},"",c+u),n(c)},[]),s=m.useMemo(()=>({path:t,navigate:r}),[t,r]);return o.jsx(b_.Provider,{value:s,children:e})}function ui(){const e=m.useContext(b_);if(!e)throw new Error("useRoute must be used within RouteProvider");return e}function L2(){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 w0={};function Py(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];typeof t[0]=="string"&&w0[t[0]]||(typeof t[0]=="string"&&(w0[t[0]]=new Date),L2(...t))}const k_=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}};function b0(e,t,n){e.loadNamespaces(t,k_(e,n))}function k0(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,k_(e,r))}function O2(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 D2(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(Py("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}}):O2(e,t,n)}const F2=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,z2={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},H2=e=>z2[e],B2=e=>e.replace(F2,H2);let Iy={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:B2};function W2(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Iy={...Iy,...e}}function V2(){return Iy}let v_;function K2(e){v_=e}function U2(){return v_}const q2={type:"3rdParty",init(e){W2(e.options.react),K2(e)}},Y2=m.createContext();class G2{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const J2=(e,t)=>{const n=m.useRef();return m.useEffect(()=>{n.current=e},[e,t]),n.current};function Cr(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=t,{i18n:r,defaultNS:s}=m.useContext(Y2)||{},i=n||r||U2();if(i&&!i.reportNamespaces&&(i.reportNamespaces=new G2),!i){Py("You will need to pass in an i18next instance by using initReactI18next");const x=(C,j)=>typeof j=="string"?j:j&&typeof j=="object"&&typeof j.defaultValue=="string"?j.defaultValue:Array.isArray(C)?C[C.length-1]:C,N=[x,{},!1];return N.t=x,N.i18n={},N.ready=!1,N}i.options.react&&i.options.react.wait!==void 0&&Py("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const a={...V2(),...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 p=(i.isInitialized||i.initializedStoreOnce)&&u.every(x=>D2(x,i,a));function f(){return i.getFixedT(t.lng||null,a.nsMode==="fallback"?u:u[0],c)}const[d,h]=m.useState(f);let y=u.join();t.lng&&(y=`${t.lng}${y}`);const b=J2(y),k=m.useRef(!0);m.useEffect(()=>{const{bindI18n:x,bindI18nStore:N}=a;k.current=!0,!p&&!l&&(t.lng?k0(i,t.lng,u,()=>{k.current&&h(f)}):b0(i,u,()=>{k.current&&h(f)})),p&&b&&b!==y&&k.current&&h(f);function C(){k.current&&h(f)}return x&&i&&i.on(x,C),N&&i&&i.store.on(N,C),()=>{k.current=!1,x&&i&&x.split(" ").forEach(j=>i.off(j,C)),N&&i&&N.split(" ").forEach(j=>i.store.off(j,C))}},[i,y]);const g=m.useRef(!0);m.useEffect(()=>{k.current&&!g.current&&h(f),g.current=!1},[i,c]);const w=[d,i,p];if(w.t=d,w.i18n=i,w.ready=p,p||!p&&!l)return w;throw new Promise(x=>{t.lng?k0(i,t.lng,u,()=>x()):b0(i,u,()=>x())})}const S_="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",X2=[{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"}],Q2=[{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 Z2(e,t){return t==="/projects"?e==="/projects"||e==="/":t==="/nodes"?e==="/nodes"||e==="/my-nodes":e===t||e.startsWith(t+"/")}function e$({authUser:e,onLogout:t}){const{path:n,navigate:r}=ui(),{t:s}=Cr(),[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:S_,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:X2.filter(l=>!l.adminOnly||(e==null?void 0:e.isAdmin)).map(l=>o.jsxs("button",{type:"button",className:"af-nav-link"+(Z2(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&&Q2.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 t$="agentflow.pipelineRecent",n$=15;function r$(e){try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function s$(){if(typeof localStorage>"u")return[];const e=localStorage.getItem(t$);return e?r$(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 i$(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 v0(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 p=Math.floor(a/24);return p<7?t("flow:time.daysAgo",{n:p}):`${l.getMonth()+1}/${l.getDate()}`}function o$(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:i$(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,n$)}var Gr=Uint8Array,il=Uint16Array,a$=Int32Array,N_=new Gr([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]),j_=new Gr([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]),l$=new Gr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),C_=function(e,t){for(var n=new il(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var s=new a$(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}},__=C_(N_,2),E_=__.b,c$=__.r;E_[28]=258,c$[258]=28;var u$=C_(j_,0),d$=u$.b,Ty=new il(32768);for(var an=0;an<32768;++an){var Yi=(an&43690)>>1|(an&21845)<<1;Yi=(Yi&52428)>>2|(Yi&13107)<<2,Yi=(Yi&61680)>>4|(Yi&3855)<<4,Ty[an]=((Yi&65280)>>8|(Yi&255)<<8)>>1}var Xc=function(e,t,n){for(var r=e.length,s=0,i=new il(t);s<r;++s)e[s]&&++i[e[s]-1];var a=new il(t);for(s=1;s<t;++s)a[s]=a[s-1]+i[s-1]<<1;var l;if(n){l=new il(1<<t);var c=15-t;for(s=0;s<r;++s)if(e[s])for(var u=s<<4|e[s],p=t-e[s],f=a[e[s]-1]++<<p,d=f|(1<<p)-1;f<=d;++f)l[Ty[f]>>c]=u}else for(l=new il(r),s=0;s<r;++s)e[s]&&(l[s]=Ty[a[e[s]-1]++]>>15-e[s]);return l},Xu=new Gr(288);for(var an=0;an<144;++an)Xu[an]=8;for(var an=144;an<256;++an)Xu[an]=9;for(var an=256;an<280;++an)Xu[an]=7;for(var an=280;an<288;++an)Xu[an]=8;var A_=new Gr(32);for(var an=0;an<32;++an)A_[an]=5;var f$=Xc(Xu,9,1),p$=Xc(A_,5,1),zm=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},js=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},Hm=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},h$=function(e){return(e+7)/8|0},Cw=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new Gr(e.subarray(t,n))},m$=["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"],cs=function(e,t,n){var r=new Error(t||m$[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,cs),!n)throw r;return r},g$=function(e,t,n,r){var s=e.length,i=r?r.length:0;if(!s||t.f&&!t.l)return n||new Gr(0);var a=!n,l=a||t.i!=2,c=t.i;a&&(n=new Gr(s*3));var u=function(ue){var fe=n.length;if(ue>fe){var ve=new Gr(Math.max(fe*2,ue));ve.set(n),n=ve}},p=t.f||0,f=t.p||0,d=t.b||0,h=t.l,y=t.d,b=t.m,k=t.n,g=s*8;do{if(!h){p=js(e,f,1);var w=js(e,f+1,3);if(f+=3,w)if(w==1)h=f$,y=p$,b=9,k=5;else if(w==2){var j=js(e,f,31)+257,_=js(e,f+10,15)+4,A=j+js(e,f+5,31)+1;f+=14;for(var F=new Gr(A),V=new Gr(19),z=0;z<_;++z)V[l$[z]]=js(e,f+z*3,7);f+=_*3;for(var D=zm(V),R=(1<<D)-1,T=Xc(V,D,1),z=0;z<A;){var $=T[js(e,f,R)];f+=$&15;var x=$>>4;if(x<16)F[z++]=x;else{var M=0,O=0;for(x==16?(O=3+js(e,f,3),f+=2,M=F[z-1]):x==17?(O=3+js(e,f,7),f+=3):x==18&&(O=11+js(e,f,127),f+=7);O--;)F[z++]=M}}var P=F.subarray(0,j),B=F.subarray(j);b=zm(P),k=zm(B),h=Xc(P,b,1),y=Xc(B,k,1)}else cs(1);else{var x=h$(f)+4,N=e[x-4]|e[x-3]<<8,C=x+N;if(C>s){c&&cs(0);break}l&&u(d+N),n.set(e.subarray(x,C),d),t.b=d+=N,t.p=f=C*8,t.f=p;continue}if(f>g){c&&cs(0);break}}l&&u(d+131072);for(var E=(1<<b)-1,q=(1<<k)-1,W=f;;W=f){var M=h[Hm(e,f)&E],L=M>>4;if(f+=M&15,f>g){c&&cs(0);break}if(M||cs(2),L<256)n[d++]=L;else if(L==256){W=f,h=null;break}else{var X=L-254;if(L>264){var z=L-257,se=N_[z];X=js(e,f,(1<<se)-1)+E_[z],f+=se}var ae=y[Hm(e,f)&q],me=ae>>4;ae||cs(3),f+=ae&15;var B=d$[me];if(me>3){var se=j_[me];B+=Hm(e,f)&(1<<se)-1,f+=se}if(f>g){c&&cs(0);break}l&&u(d+131072);var re=d+X;if(d<B){var de=i-B,ne=Math.min(B,re);for(de+d<0&&cs(3);d<ne;++d)n[d]=r[de+d]}for(;d<re;++d)n[d]=n[d-B]}}t.l=h,t.p=W,t.b=d,t.f=p,h&&(p=1,t.m=b,t.d=y,t.n=k)}while(!p);return d!=n.length&&a?Cw(n,0,d):n.subarray(0,d)},y$=new Gr(0),Zs=function(e,t){return e[t]|e[t+1]<<8},Ts=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},Bm=function(e,t){return Ts(e,t)+Ts(e,t+4)*4294967296};function x$(e,t){return g$(e,{i:2},t&&t.out,t&&t.dictionary)}var Ry=typeof TextDecoder<"u"&&new TextDecoder,w$=0;try{Ry.decode(y$,{stream:!0}),w$=1}catch{}var b$=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:Cw(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 k$(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(Ry)return Ry.decode(e);var s=b$(e),i=s.s,n=s.r;return n.length&&cs(8),i}}var v$=function(e,t){return t+30+Zs(e,t+26)+Zs(e,t+28)},S$=function(e,t,n){var r=Zs(e,t+28),s=k$(e.subarray(t+46,t+46+r),!(Zs(e,t+8)&2048)),i=t+46+r,a=Ts(e,t+20),l=n&&a==4294967295?N$(e,i):[a,Ts(e,t+24),Ts(e,t+42)],c=l[0],u=l[1],p=l[2];return[Zs(e,t+10),c,u,s,i+Zs(e,t+30)+Zs(e,t+32),p]},N$=function(e,t){for(;Zs(e,t)!=1;t+=4+Zs(e,t+2));return[Bm(e,t+12),Bm(e,t+4),Bm(e,t+20)]};function j$(e,t){for(var n={},r=e.length-22;Ts(e,r)!=101010256;--r)(!r||e.length-r>65558)&&cs(13);var s=Zs(e,r+8);if(!s)return{};var i=Ts(e,r+16),a=i==4294967295||s==65535;if(a){var l=Ts(e,r-12);a=Ts(e,l)==101075792,a&&(s=Ts(e,l+32),i=Ts(e,l+48))}for(var c=0;c<s;++c){var u=S$(e,i,a),p=u[0],f=u[1],d=u[2],h=u[3],y=u[4],b=u[5],k=v$(e,b);i=y,p?p==8?n[h]=x$(e.subarray(k,k+f),{out:new Gr(d)}):cs(14,"unknown compression type "+p):n[h]=Cw(e,k,k+f)}return n}const C$=8*1024*1024,_$=500;function E$(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 A$(e){return e?e.split("/").some(n=>n==="__MACOSX"||n.startsWith("._")):!0}function P$(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 I$=/^[a-zA-Z][a-zA-Z0-9_-]*$/;async function T$(e){try{const t=new Uint8Array(await e.arrayBuffer()),n=j$(t),r=new Map;let s=0,i=0;for(const[c,u]of Object.entries(n)){if(c.endsWith("/"))continue;const p=E$(c);if(!p||A$(p))continue;const f=(u==null?void 0:u.length)??0;if(s+=f,s>C$||(i+=1,i>_$))return null;r.set(p,f)}if(r.size===0)return null;const a=new Set;for(const c of r.keys()){const u=P$(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 I$.test(l)?l:null}catch{return null}}const Wm=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function R$({file:e,onClose:t,onImported:n}){const{t:r}=Cr(),s=m.useId(),i=m.useRef(null),a=m.useRef(null),[l,c]=m.useState(""),[u,p]=m.useState("user"),[f,d]=m.useState(!1),[h,y]=m.useState(""),[b,k]=m.useState(null),g=b??e;m.useEffect(()=>{const C=requestAnimationFrame(()=>{var j;return(j=i.current)==null?void 0:j.focus()});return()=>cancelAnimationFrame(C)},[]),m.useEffect(()=>{let C=!1;return(async()=>{const j=g.name||"",_=j.toLowerCase();let A="";if(_.endsWith(".zip")){if(A=await T$(g)||"",!A){const F=j.replace(/\.zip$/i,"");Wm.test(F)&&(A=F)}}else if(_.endsWith(".yaml")||_.endsWith(".yml")){const F=j.replace(/\.ya?ml$/i,"");Wm.test(F)&&(A=F)}C||c(A)})(),()=>{C=!0}},[g]);const w=l.trim(),x=w.length>0&&Wm.test(w);async function N(C){if(C.preventDefault(),!(!x||f)){d(!0),y("");try{const j=new FormData;j.set("flowId",w),j.set("targetSpace",u),j.set("file",g,g.name);const _=await fetch("/api/flows/import",{method:"POST",body:j}),A=await _.json().catch(()=>({}));if(!_.ok){y(typeof A.error=="string"?A.error:r("project:importModal.importFailed"));return}n({id:A.flowId,source:A.flowSource??"user"})}catch(j){y(String((j==null?void 0:j.message)||j))}finally{d(!1)}}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:C=>{C.target===C.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:C=>C.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:N,children:[o.jsx("p",{className:"af-new-pipeline-lead",children:r("project:importModal.lead",{filename:g.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:C=>{var _;const j=(_=C.target.files)==null?void 0:_[0];j&&k(j),C.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:C=>c(C.target.value),"aria-invalid":w.length>0&&!x}),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 C;return(C=a.current)==null?void 0:C.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:f,children:r("project:importModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!x||f,children:r(f?"project:importModal.importing":"project:importModal.importAndOpen")})]})]})]})})}const M$=/^[a-zA-Z][a-zA-Z0-9_-]*$/,S0="af:newPipelineGuide";function $$({open:e,onClose:t,onCreated:n}){const{t:r}=Cr(),s=m.useId(),i=m.useRef(null),[a,l]=m.useState(""),[c,u]=m.useState(""),[p,f]=m.useState("user"),[d,h]=m.useState(!1),[y,b]=m.useState(""),[k,g]=m.useState(!1);m.useEffect(()=>{if(!e)return;l(""),u(""),f("user"),b(""),h(!1),localStorage.getItem(S0)==="true"&&g(!0);const _=requestAnimationFrame(()=>{var A;return(A=i.current)==null?void 0:A.focus()});return()=>cancelAnimationFrame(_)},[e]);const w=()=>{localStorage.removeItem(S0),g(!1)};if(!e)return null;const x=a.trim(),N=x.length>0&&M$.test(x);async function C(j){if(j.preventDefault(),!(!N||d)){h(!0),b(""),w();try{const _=await fetch("/api/flows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:x,description:c.trim(),targetSpace:p})}),A=await _.json().catch(()=>({}));if(!_.ok){b(typeof A.error=="string"?A.error:r("project:newPipelineModal.createFailed"));return}n({id:A.flowId,source:A.flowSource??"user"})}catch(_){b(String((_==null?void 0:_.message)||_))}finally{h(!1)}}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:j=>{j.target===j.currentTarget&&(w(),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:()=>{w(),t()},"aria-label":r("project:newPipelineModal.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),k?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:w,children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]})}):null,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: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":x.length>0&&!N}),o.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-hint",children:r(k?"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(k?"onboarding:newPipeline.descPlaceholderGuide":"project:newPipelineModal.descPlaceholder"),value:c,onChange:j=>u(j.target.value)}),k?o.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-guide-hint",children:r("onboarding:newPipeline.descHintGuide")}):null]}),y?o.jsx("p",{className:"af-err af-new-pipeline-err",children:y}):null,o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:()=>{w(),t()},disabled:d,children:r("project:newPipelineModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!N||d,children:r(d?"project:newPipelineModal.creating":k?"onboarding:newPipeline.createGuide":"project:newPipelineModal.createAndOpen")})]})]})]})})}const P_="agentflow.pipelineViewPreference";function I_(e,t="user",n=!1){return`${String(t||"user")}:${String(e||"")}:${n?"archived":"active"}`}function T_(){if(typeof localStorage>"u")return{};try{const e=JSON.parse(localStorage.getItem(P_)||"{}");return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}catch{return{}}}function L$(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(P_,JSON.stringify(e))}catch{}}function _w(e){return e==="display"?"display":"workspace"}function O$(e){const t=String(e||"").toLowerCase();return t==="builtin"||t==="admin"}function R_(e,t){const n=_w(t);return n==="pipeline"&&O$(e==null?void 0:e.source)?"workspace":n}function D$(e){return(e==null?void 0:e.hasPipeline)!==!1&&(e==null?void 0:e.hasFlow)!==!1&&(e==null?void 0:e.flowYaml)!==!1}function F$(e,t,n,r=!1){if(!e)return;const s=T_();s[I_(e,t,r)]={view:_w(n),at:Date.now()},L$(s)}function z$(e,t="workspace"){if(!(e!=null&&e.id))return _w(t);const r=T_()[I_(e.id,e.source??"user",!!e.archived)],s=R_(e,(r==null?void 0:r.view)||t);return s==="pipeline"&&!D$(e)?"workspace":s}function H$(e,t="workspace"){const n=R_(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 e.archived&&r.set("archived","1"),n==="display"&&r.set("view","display"),`/workspace?${r.toString()}`}function nf(e,t="workspace"){return H$(e,z$(e,t))}function B$(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 My(e){return String((e==null?void 0:e.version)||"").trim()}function W$(e){const t=My(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 V$({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(""),[p,f]=m.useState("keyword"),[d,h]=m.useState([]),[y,b]=m.useState({}),[k,g]=m.useState(""),[w,x]=m.useState(""),[N,C]=m.useState(""),j=m.useCallback(async()=>{x("");try{const[D,R]=await Promise.all([fetch("/api/skillhub/status"),fetch("/api/skillhub/list?target=agentflow&agent=codex")]),T=await D.json().catch(()=>({}));D.ok&&r({available:!!T.available,version:typeof T.version=="string"?T.version:"",loggedIn:!!T.loggedIn,user:typeof T.user=="string"?T.user:"",error:typeof T.error=="string"?T.error:""});const $=await R.json().catch(()=>({}));if(!R.ok)throw new Error(typeof $.error=="string"?$.error:"HTTP "+R.status);i(Array.isArray($.skills)?$.skills:[]),l(typeof $.skillsRoot=="string"?$.skillsRoot:""),b({})}catch(D){x(String(D.message||D))}},[]);m.useEffect(()=>{j()},[j]);const _=m.useCallback(async()=>{const D=c.trim();if(D){g("search"),x(""),C("");try{const R=await fetch(`/api/skillhub/search?q=${encodeURIComponent(D)}&mode=${encodeURIComponent(p)}`),T=await R.json().catch(()=>({}));if(!R.ok)throw new Error(typeof T.error=="string"?T.error:"HTTP "+R.status);h(Array.isArray(T.items)?T.items:[])}catch(R){x(String(R.message||R))}finally{g("")}}},[c,p]),A=m.useCallback(async(D,R=!1)=>{if(!t)return;const T=D&&typeof D=="object"?D:null,$=String(T?T.slug||T.name||T.collection||T.skillId||T.id:D||"").trim();if($){g(`install:${$}`),x(""),C("");try{const M=T?{slug:T.slug||"",skillId:T.skillId||"",collection:T.collection||"",collectionName:T.collection&&T.name||"",target:"agentflow",agent:"codex",force:R}:{slug:$,target:"agentflow",agent:"codex",force:R},O=await fetch("/api/skillhub/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(M)}),P=await O.json().catch(()=>({}));if(!O.ok)throw new Error(typeof P.error=="string"?P.error:"HTTP "+O.status);C(R?`已更新 ${$}`:`已安装 ${$}`),await j(),typeof e=="function"&&await e()}catch(M){x(String(M.message||M))}finally{g("")}}},[t,j,e]),F=m.useCallback(async()=>{if(t&&s.length!==0){g("check-updates"),x(""),C("");try{const D=await Promise.all(s.map(async $=>{const M=String($.name||"").trim();if(!M)return null;try{const O=await fetch(`/api/skillhub/search?q=${encodeURIComponent(M)}&mode=keyword`),P=await O.json().catch(()=>({}));if(!O.ok)throw new Error(typeof P.error=="string"?P.error:"HTTP "+O.status);const B=Array.isArray(P.items)?P.items:[],E=B.find(X=>X.slug===M||X.name===M||X.id===M)||B[0],q=My($),W=String((E==null?void 0:E.version)||"").trim();let L="unknown";return E?q&&W?L=B$(q,W)<0?"update":"current":W&&(L="remote-only"):L="missing",[M,{state:L,latestVersion:W,installedVersion:q,summary:(E==null?void 0:E.summary)||""}]}catch(O){return[M,{state:"error",error:String(O.message||O),installedVersion:My($)}]}})),R={};for(const $ of D)$&&(R[$[0]]=$[1]);b(R);const T=Object.values(R).filter($=>$.state==="update").length;C(T>0?`发现 ${T} 个可更新 skill`:"已检查,暂无明确可更新项")}finally{g("")}}},[t,s]),V=m.useCallback(async D=>{if(!t)return;const R=String(D||"").trim();if(R){g(`uninstall:${R}`),x(""),C("");try{const T=await fetch("/api/skillhub/uninstall",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:R,target:"agentflow",agent:"codex"})}),$=await T.json().catch(()=>({}));if(!T.ok)throw new Error(typeof $.error=="string"?$.error:"HTTP "+T.status);C(`已卸载 ${R}`),await j(),typeof e=="function"&&await e()}catch(T){x(String(T.message||T))}finally{g("")}}},[t,j,e]),z=m.useCallback(async()=>{if(t){g("update-cli"),x(""),C("");try{const D=await fetch("/api/skillhub/update",{method:"POST"}),R=await D.json().catch(()=>({}));if(!D.ok)throw new Error(typeof R.error=="string"?R.error:"HTTP "+D.status);C("SkillHub CLI 已更新"),await j()}catch(D){x(String(D.message||D))}finally{g("")}}},[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:!!k,children:"刷新"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:F,disabled:!t||!!k||s.length===0,children:k==="check-updates"?"检查中…":"检查更新"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:z,disabled:!t||!!k,children:k==="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:p,onChange:D=>{f(D.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:D=>u(D.target.value),onKeyDown:D=>{D.key==="Enter"&&_()},placeholder:p==="collectionId"?"输入 collection id,例如 1":p==="skillId"?"输入 skill id":"搜索 skill slug / 关键词,例如 android、issue-tracker"}),o.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:()=>_(),disabled:!c.trim()||k==="search",children:[o.jsx("span",{className:"material-symbols-outlined",children:"search"}),k==="search"?"搜索中…":"搜索"]})]}),w?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:w}):null,N?o.jsx("p",{className:"af-set-hint af-set-hint--inline",children:N}):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(D=>{const R=y[D.name],T=!R||R.state==="update"||R.state==="remote-only"||R.state==="unknown"||R.state==="error",$=k===`install:${D.name}`?"更新中…":(R==null?void 0:R.state)==="current"?"已最新":(R==null?void 0:R.state)==="update"&&R.latestVersion?`更新到 v${R.latestVersion}`:(R==null?void 0:R.state)==="remote-only"&&R.latestVersion?`安装 v${R.latestVersion}`:"重装";return o.jsxs("div",{className:"af-set-skillhub-item",children:[o.jsxs("div",{children:[o.jsx("div",{className:"af-set-skillhub-title",children:D.displayName||D.name}),o.jsx("div",{className:"af-set-skillhub-meta",children:W$(D)}),o.jsx("div",{className:"af-set-skillhub-version-row",children:R?R.state==="update"?o.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--warn",children:["可更新 ",R.installedVersion?`v${R.installedVersion} -> `:"","v",R.latestVersion]}):R.state==="current"?o.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--ok",children:["已最新 v",R.latestVersion||R.installedVersion]}):R.state==="remote-only"?o.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:["远端 v",R.latestVersion,",本地版本未知"]}):R.state==="missing"?o.jsx("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:"未找到远端匹配项"}):R.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:()=>A(D.name,!0),disabled:!t||!!k||!T,children:$}),o.jsx("button",{type:"button",className:"af-set-btn-mini af-set-btn-mini--danger",onClick:()=>V(D.name),disabled:!t||!!k,children:"卸载"})]})]},`${D.agent}:${D.path}:${D.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:d.length})]}),o.jsx("div",{className:"af-set-skillhub-list",children:d.length===0?o.jsx("div",{className:"af-set-skillhub-empty",children:"输入关键词后搜索 SkillHub"}):d.map(D=>{const R=D.slug||D.name,T=D.kind==="collection"||D.collection,$=!T&&s.some(M=>M.name===R||M.name===D.name);return o.jsxs("div",{className:"af-set-skillhub-item",children:[o.jsxs("div",{children:[o.jsx("div",{className:"af-set-skillhub-title",children:D.name||R}),o.jsxs("div",{className:"af-set-skillhub-meta",children:[T?`collection:${D.collection}`:R,D.skillId?` · id:${D.skillId}`:"",D.version?` · ${D.version}`:""]}),D.summary?o.jsx("p",{className:"af-set-skillhub-summary",children:D.summary}):null]}),o.jsx("button",{type:"button",className:$?"af-set-btn-mini":"af-set-btn-add af-set-btn-add--compact",onClick:()=>A(D,$),disabled:!t||!!k,children:$?"更新":T?"安装合集":"安装"})]},D.id||R)})})]})]})]})}function Qo(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 K$(e){return{version:1,collections:Qo({collections:e})}}function U$(e){const t=String(e||"").trim(),n=t.indexOf(":");return n>=0?t.slice(n+1).trim():t}function M_(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(U$(s)))||""}}function la(e,t){const n=M_(t);return Array.from(new Set((Array.isArray(e==null?void 0:e.skillKeys)?e.skillKeys:[]).map(r=>n(r)).filter(Boolean)))}function q$(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 Y$(e,t){const n=new Set(Array.isArray(t)?t:[]);return(Array.isArray(e)?e:[]).filter(r=>!n.has(r))}function G$(e,t,n){const r=la(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 J$(e,t,n){const r=String(e).trim().toLowerCase(),s=Qo({collections:n}).find(i=>i.id===r||i.name.toLowerCase()===r);return la(s,t)}function X$(e,t,n,r){const s=(Array.isArray(n)?n:[]).map(u=>u.key).filter(Boolean),i=String(t).trim().toLowerCase(),a=Qo({collections:r}),l=J$(t,n,r),c=l.length>0?l:s;if(!e)return c;try{const u=localStorage.getItem(e);if(u!==null){const p=JSON.parse(u);if(Array.isArray(p)){const f=M_(n),d=Array.from(new Set(p.map(f).filter(Boolean)));if(s.length>0&&d.length===s.length)return c;const h=new Set(d),y=new Set(l),b=l.length>0&&l.every(g=>h.has(g)),k=a.some(g=>{if(!g.builtin||g.id===i||g.name.toLowerCase()===i)return!1;const w=la(g,n);return w.length>0&&w.every(x=>h.has(x))});return l.length>0&&k&&!b?c:d}}}catch{}return c}function kc(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 Q$(e){const t=e??"user";return t==="builtin"||t==="admin"?"af-project-card af-project-card--builtin":"af-project-card"}function Z$(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 $y(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 $_(e){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 eL="project:defaultCardDesc";function L_(e,t){const n=e.description!=null?String(e.description).trim():"";return n!==""?n:t(eL)}function tL(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function En({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(`(${tL(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 nL(e,t,n){const r=[String(e.id),L_(e,n),$_(e),$y(e.source,n).label];return e.archived&&r.push(n("project:archived")),r.join(`
|
|
41
|
-
`).toLowerCase()}function rL(e,t,n){return t?nL(e,t,n).includes(t):!0}function sL(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 Vm(e,t){const n=e.trim().toLowerCase();return n?t.filter(Boolean).join(`
|
|
42
|
-
`).toLowerCase().includes(n):!0}function N0(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 j0(e){return e!=null&&e.packageDir?e.packageDir:`marketplace/flow-snippets / ${(e==null?void 0:e.id)||""}`}const iL=["all","agent","control","provide","marketplace"],oL=["all","agent","control","provide"],O_="agentflow.projects.activityPanelOpen",Ly="agentflow.projects.activitySelected";function aL(){if(typeof localStorage>"u")return!0;const e=localStorage.getItem(O_);return e!=="0"}function C0(e){return`${(e==null?void 0:e.flowSource)||"user"}:${(e==null?void 0:e.flowId)||""}`}function lL(){return typeof localStorage>"u"?"":localStorage.getItem(Ly)||""}function rf(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 cL(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 Gi(e){return`${(e==null?void 0:e.id)||""}:${(e==null?void 0:e.version)||""}:${(e==null?void 0:e.packageDir)||""}`}function D_(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 F_(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 Oy(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 _0(e,t){return String((e==null?void 0:e.label)||(e==null?void 0:e.displayName)||(e==null?void 0:e.name)||Oy(e,t))}function uL(e){return String((e==null?void 0:e.definitionId)||(e==null?void 0:e.type)||(e==null?void 0:e.runtimeType)||"").replace(/^marketplace:/,"")}function E0(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 dL(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 Km(e,t=16){const n=String(e||"").trim();return n.length<=t?n:`${n.slice(0,t-1)}…`}function fL(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 pL(e,t){const n=e.map(p=>p.id),r=new Set(n),s=new Map(n.map(p=>[p,0])),i=new Map(n.map(p=>[p,[]]));t.forEach(p=>{var f;!r.has(p.sourceId)||!r.has(p.targetId)||(s.set(p.targetId,(s.get(p.targetId)||0)+1),(f=i.get(p.sourceId))==null||f.push(p.targetId))});const a=new Map,l=n.filter(p=>(s.get(p)||0)===0);l.length===0&&n[0]&&l.push(n[0]),l.forEach(p=>a.set(p,0));for(let p=0;p<l.length;p+=1){const f=l[p],d=(a.get(f)||0)+1;for(const h of i.get(f)||[])(!a.has(h)||d>a.get(h))&&(a.set(h,d),l.push(h))}n.forEach((p,f)=>{a.has(p)||a.set(p,f%3)});const c=new Map,u=new Map;return n.forEach(p=>{const f=a.get(p)||0,d=c.get(f)||0;c.set(f,d+1),u.set(p,{x:f*190,y:d*86})}),u}function hL(e){var b,k,g,w;const t=D_(e),n=F_(e),r=new Map(t.map((x,N)=>[Oy(x,N),_0(x,N)])),s=t.map((x,N)=>({id:Oy(x,N),title:_0(x,N),meta:uL(x)})),i=n.map((x,N)=>{const C=E0(x,"source"),j=E0(x,"target");return{key:(x==null?void 0:x.id)||`${C}-${j}-${N}`,sourceId:C,targetId:j,source:r.get(C)||C||"?",target:r.get(j)||j||"?",label:dL(x)}}),a=(k=(b=e==null?void 0:e.snippet)==null?void 0:b.ui)!=null&&k.nodePositions&&typeof e.snippet.ui.nodePositions=="object"?e.snippet.ui.nodePositions:{},l=(w=(g=e==null?void 0:e.snippet)==null?void 0:g.ui)!=null&&w.nodeSizes&&typeof e.snippet.ui.nodeSizes=="object"?e.snippet.ui.nodeSizes:{},c=pL(s,i),u=s.map(x=>{const N=fL(a[x.id])||c.get(x.id)||{x:0,y:0},C=l[x.id]&&typeof l[x.id]=="object"?l[x.id]:{},j=Number(C.width),_=Number(C.height),A=Math.max(132,Math.min(210,Number.isFinite(j)?j*.62:150)),F=Math.max(48,Math.min(76,Number.isFinite(_)?_*.46:54));return{...x,x:N.x,y:N.y,width:A,height:F}}),p=new Map(u.map(x=>[x.id,x])),f=i.map(x=>{const N=p.get(x.sourceId),C=p.get(x.targetId);if(!N||!C)return null;const j=N.x+N.width,_=N.y+N.height/2,A=C.x,F=C.y+C.height/2,V=Math.max(48,Math.abs(A-j)*.45);return{...x,path:`M ${j} ${_} C ${j+V} ${_}, ${A-V} ${F}, ${A} ${F}`,labelX:(j+A)/2,labelY:(_+F)/2}}).filter(Boolean),d=u.reduce((x,N)=>({minX:Math.min(x.minX,N.x),minY:Math.min(x.minY,N.y),maxX:Math.max(x.maxX,N.x+N.width),maxY:Math.max(x.maxY,N.y+N.height)}),{minX:0,minY:0,maxX:420,maxY:220}),h=36,y=`${d.minX-h} ${d.minY-h} ${Math.max(360,d.maxX-d.minX+h*2)} ${Math.max(180,d.maxY-d.minY+h*2)}`;return{nodes:s,edges:i,diagram:{nodes:u,edges:f,viewBox:y}}}function Da({resourceKind:e="",authUser:t=null}){var Gt,vn,xs,Sn,Ar,os;const{t:n}=Cr(),{navigate:r,path:s}=ui(),i=!!(t!=null&&t.isAdmin),[a,l]=m.useState(e||"all"),[c,u]=m.useState([]),[p,f]=m.useState([]),[d,h]=m.useState([]),[y,b]=m.useState([]),[k,g]=m.useState([]),[w,x]=m.useState(""),[N,C]=m.useState(!1),[j,_]=m.useState([]),[A,F]=m.useState(""),[V,z]=m.useState(""),[D,R]=m.useState(!1),[T,$]=m.useState(!1),[M,O]=m.useState(!1),[P,B]=m.useState(null),[E,q]=m.useState(!1),[W,L]=m.useState(""),[X,se]=m.useState(aL),[ae,me]=m.useState(lL),[re,de]=m.useState("all"),[ne,ue]=m.useState(""),[fe,ve]=m.useState("overview"),[$e,We]=m.useState({}),[Pe,Ue]=m.useState(""),[pt,Te]=m.useState({}),[et,Yt]=m.useState(""),[jt,$t]=m.useState(""),[Ht,Xe]=m.useState({}),[oe,ke]=m.useState(""),[Se,qe]=m.useState(""),[Ze,kt]=m.useState(""),[Z,xe]=m.useState(""),[He,Ce]=m.useState(""),[nt,ht]=m.useState(!1),[un,_r]=m.useState(""),[Wn,Vn]=m.useState({hiddenBuiltins:[],promoted:[]}),Kn=m.useRef(0),hn=m.useRef(0),Un=m.useRef(0),Pn=m.useCallback(async()=>{var pe,Re;const K=++hn.current;F("");try{const Ee=await fetch("/api/flows");if(K!==hn.current)return;if(!Ee.ok)throw new Error("HTTP "+Ee.status);const Je=await Ee.json();if(K!==hn.current)return;u(Array.isArray(Je)?Je:[])}catch(Ee){if(K!==hn.current)return;u([]),F(String(Ee.message||Ee))}try{const Ee=await fetch("/api/pipeline-recent-runs");if(K!==hn.current)return;if(Ee.ok){const Je=await Ee.json();if(K!==hn.current)return;_(Array.isArray(Je.runs)?Je.runs:[])}else _([])}catch{if(K!==hn.current)return;_([])}if(t!=null&&t.isAdmin)try{const Ee=await fetch("/api/admin/builtin-flows");if(K!==hn.current)return;const Je=await Ee.json().catch(()=>({}));Ee.ok&&Vn({hiddenBuiltins:Array.isArray((pe=Je==null?void 0:Je.config)==null?void 0:pe.hiddenBuiltins)?Je.config.hiddenBuiltins:[],promoted:Array.isArray((Re=Je==null?void 0:Je.config)==null?void 0:Re.promoted)?Je.config.promoted:[]})}catch{if(K!==hn.current)return;Vn({hiddenBuiltins:[],promoted:[]})}else Vn({hiddenBuiltins:[],promoted:[]});R(!0)},[t==null?void 0:t.isAdmin]),hr=m.useCallback(async(K,pe)=>{if(!(t!=null&&t.isAdmin)||!(K!=null&&K.id))return;const Re=`${pe}:${K.source}:${K.id}`;_r(Re),F("");try{const Ee=await fetch("/api/admin/builtin-flows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:pe,flowId:K.id,ownerUserId:K.ownerUserId||t.userId})}),Je=await Ee.json().catch(()=>({}));if(!Ee.ok)throw new Error(Je.error||"更新内置配置失败");await Pn()}catch(Ee){F(String(Ee.message||Ee))}finally{_r("")}},[t==null?void 0:t.isAdmin,t==null?void 0:t.userId,Pn]),In=m.useCallback(async()=>{const K=++Un.current;z(""),$(!1);const pe="/api/nodes",Re=e==="my-flows"?"/api/marketplace/flow-snippets?scope=owned":"/api/marketplace/flow-snippets";f([]),b([]),ue("");try{const[Ee,Je,Jt,Ct]=await Promise.all([fetch(pe),fetch("/api/skills"),fetch("/api/skill-collections"),fetch(Re)]),Fn=await Ee.json().catch(()=>({})),ws=await Je.json().catch(()=>({})),Io=await Jt.json().catch(()=>({})),zi=await Ct.json().catch(()=>({}));if(!Ee.ok)throw new Error(Fn.error||"Nodes HTTP "+Ee.status);if(!Je.ok)throw new Error(ws.error||"Skills HTTP "+Je.status);if(!Jt.ok)throw new Error(Io.error||"Collections HTTP "+Jt.status);if(!Ct.ok)throw new Error(zi.error||"Flow snippets HTTP "+Ct.status);if(K!==Un.current)return;f(Array.isArray(Fn.nodes)?Fn.nodes:Array.isArray(Fn)?Fn:[]),h(Array.isArray(ws.skills)?ws.skills:[]),g(Qo(Io)),b(Array.isArray(zi.snippets)?zi.snippets:[])}catch(Ee){if(K!==Un.current)return;f([]),h([]),b([]),g([]),z(String(Ee.message||Ee))}finally{if(K!==Un.current)return;$(!0)}},[e]);m.useEffect(()=>{R(!1),Pn(),In()},[Pn,In]),m.useEffect(()=>{try{localStorage.setItem(O_,X?"1":"0")}catch{}},[X]),m.useEffect(()=>{try{ae?localStorage.setItem(Ly,ae):localStorage.removeItem(Ly)}catch{}},[ae]),m.useEffect(()=>{let K=!1;return fetch("/api/ui-context").then(pe=>pe.json()).then(pe=>{K||ht(!!pe.hideCommunityLinks)}).catch(()=>{}),()=>{K=!0}},[]);const Ln=m.useCallback(async K=>{if(!i)return;const pe=Qo({collections:K});C(!0),z("");try{const Re=await fetch("/api/skill-collections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(K$(pe))}),Ee=await Re.json().catch(()=>({}));if(!Re.ok)throw new Error(Ee.error||"Collections HTTP "+Re.status);g(Qo(Ee))}catch(Re){z(String(Re.message||Re))}finally{C(!1)}},[i]),ir=m.useCallback(()=>{if(!i)return;const K=w.trim();if(!K)return;const pe=K.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"collection",Re=new Set(k.map(Ct=>Ct.id));let Ee=pe,Je=2;for(;Re.has(Ee);)Ee=`${pe}-${Je++}`;const Jt=Date.now();Ln([...k,{id:Ee,name:K,skillKeys:[],createdAt:Jt,updatedAt:Jt}]),x(""),de(`collection:${Ee}`)},[i,w,Ln,k]),Zn=m.useCallback(K=>{if(!i)return;const pe=k.find(Ee=>Ee.id===K);if(pe!=null&&pe.builtin)return;const Re=k.filter(Ee=>Ee.id!==K);re===`collection:${K}`&&de("all"),Ln(Re)},[i,re,Ln,k]),Er=m.useCallback((K,pe,Re)=>{if(!i)return;const Ee=String(pe||"").trim();if(!Ee)return;const Je=Date.now(),Jt=k.map(Ct=>{if(Ct.id!==K)return Ct;const Fn=new Set(Ct.skillKeys||[]);return Re?Fn.add(Ee):Fn.delete(Ee),{...Ct,skillKeys:Array.from(Fn),updatedAt:Je}});Ln(Jt)},[i,Ln,k]),On=m.useCallback(async K=>{const pe=K==null?void 0:K.packageId,Re=K==null?void 0:K.version;if(!pe||!Re||!window.confirm(n("project:deleteMyNodeConfirm",{id:pe,version:Re})))return;const Ee=dn(K);qe(Ee),kt(""),z("");try{const Je=new URLSearchParams({id:pe,version:Re}),Jt=await fetch(`/api/marketplace/node?${Je.toString()}`,{method:"DELETE"}),Ct=await Jt.json().catch(()=>({}));if(!Jt.ok||(Ct==null?void 0:Ct.ok)===!1){const Fn=Array.isArray(Ct==null?void 0:Ct.usage)&&Ct.usage.length>0?` ${n("project:deleteMyNodeUsedBy",{count:Ct.usage.length})}`:"";throw new Error(((Ct==null?void 0:Ct.error)||"Delete failed")+Fn)}kt(n("project:deleteMyNodeSuccess",{id:pe,version:Re})),Te(Fn=>{const ws={...Fn};return delete ws[Ee],ws}),Xe(Fn=>{const ws={};for(const[Io,zi]of Object.entries(Fn))Io.startsWith(`${Ee}:`)||(ws[Io]=zi);return ws}),ue(""),await In()}catch(Je){kt(String(Je.message||Je))}finally{qe("")}},[In,n]),Hr=m.useCallback(async K=>{const pe=K==null?void 0:K.id,Re=(K==null?void 0:K.version)||"1.0.0";if(!pe||!Re||!window.confirm(n("project:deleteMyFlowConfirm",{id:pe,version:Re})))return;const Ee=Gi(K);xe(Ee),Ce(""),z("");try{const Je=new URLSearchParams({id:pe,version:Re}),Jt=await fetch(`/api/marketplace/flow-snippet?${Je.toString()}`,{method:"DELETE"}),Ct=await Jt.json().catch(()=>({}));if(!Jt.ok||(Ct==null?void 0:Ct.ok)===!1)throw new Error((Ct==null?void 0:Ct.error)||"Delete failed");Ce(n("project:deleteMyFlowSuccess",{id:pe,version:Re})),ue(""),await In()}catch(Je){Ce(String(Je.message||Je))}finally{xe("")}},[In,n]);m.useEffect(()=>{if(e==="nodes"||e==="my-nodes"||e==="my-flows"||e==="skills"){l(e),de("all"),ue(""),ve("overview");return}l(K=>K==="archived"?"archived":"all")},[e]),m.useEffect(()=>{if(s!=="/projects"&&s!=="/")return;const K=new URLSearchParams(window.location.search),pe=K.get("tab");let Re=!1;if(pe==="nodes"){r("/nodes");return}if(pe==="my-nodes"){r("/my-nodes");return}if(pe==="my-flows"){r("/my-flows");return}if(pe==="skills"){r("/skills");return}if(pe==="archived"?(l("archived"),K.delete("tab"),Re=!0):pe&&(l("all"),K.delete("tab"),Re=!0),K.get("new")==="1"&&(O(!0),K.delete("new"),Re=!0),Re){const Ee=K.toString();window.history.replaceState({},"",Ee?`/projects?${Ee}`:"/projects")}},[s,r]);const mr=m.useMemo(()=>o$(j,s$(),c),[j,c,s]),Br=m.useMemo(()=>mr.filter(K=>sL(W,K)),[mr,W]),bn=W.trim().toLowerCase(),nn=m.useMemo(()=>a==="archived"?c.filter(K=>K.archived):c.filter(K=>!K.archived),[c,a]),er=m.useMemo(()=>nn.filter(K=>rL(K,bn,n)),[nn,bn,n]),qn=m.useMemo(()=>new Set((Wn.promoted||[]).map(K=>String((K==null?void 0:K.id)||"").trim()).filter(Boolean)),[Wn.promoted]),gr=m.useMemo(()=>(Wn.hiddenBuiltins||[]).map(K=>String(K||"").trim()).filter(Boolean),[Wn.hiddenBuiltins]),Bt=a==="nodes"||a==="my-nodes",te=a==="my-nodes",be=a==="my-flows",st=m.useMemo(()=>p.filter(K=>te&&!cL(K,t)?!1:(re==="all"||(re==="marketplace"?K.source==="marketplace":K.type===re))&&Vm(W,[K.id,K.label,K.displayName,K.description,K.type,K.source,K.packageId,K.version])),[t,p,te,W,re]),wt=m.useMemo(()=>{const K=new Map;for(const pe of k)K.set(pe.id,new Set(pe.skillKeys||[]));return K},[k]),rn=m.useMemo(()=>[{id:"all",label:"全部"},...k.map(K=>({id:`collection:${K.id}`,label:K.name,count:K.skillKeys.length,collection:K})),{id:"ungrouped",label:"未分组"}],[k]),Cn=m.useMemo(()=>d.filter(K=>{var Ee;const pe=dn(K);let Re=re==="all";if(re.startsWith("collection:")){const Je=re.slice(11);Re=!!((Ee=wt.get(Je))!=null&&Ee.has(pe))}else re==="ungrouped"&&(Re=!Array.from(wt.values()).some(Je=>Je.has(pe)));return Re&&Vm(W,[K.name,K.id,K.description,K.sourceLabel,K.source,K.path])}),[d,W,re,wt]),kn=m.useMemo(()=>y.filter(K=>Vm(W,[K.id,K.name,K.displayName,K.description,K.version,K.packageDir,Array.isArray(K.tags)?K.tags.join(" "):""])),[y,W]),Dn=Bt||be||a==="skills",Ve=m.useMemo(()=>st.find(K=>dn(K)===ne)||st[0]||null,[st,ne]),Lt=m.useMemo(()=>Cn.find(K=>dn(K)===ne)||Cn[0]||null,[Cn,ne]),Ie=m.useMemo(()=>kn.find(K=>Gi(K)===ne)||kn[0]||null,[kn,ne]),Wt=Lt?$e[dn(Lt)]:null,Ye=Ve?pt[dn(Ve)]:null,or=Ve&&jt?Ht[`${dn(Ve)}:${jt}`]:null,Wr=n(Bt?"project:searchNodes":be?"project:searchFlows":a==="skills"?"project:searchSkills":"project:searchPipelines");m.useEffect(()=>{if(a!=="skills"||!Lt)return;const K=dn(Lt);if($e[K])return;let pe=!1;return Ue(K),fetch(`/api/skills/detail?key=${encodeURIComponent(K)}`).then(Re=>Re.json().then(Ee=>({ok:Re.ok,json:Ee}))).then(({ok:Re,json:Ee})=>{pe||Re&&Ee.skill&&We(Je=>({...Je,[K]:Ee.skill}))}).catch(()=>{}).finally(()=>{pe||Ue("")}),()=>{pe=!0}},[a,Lt,$e]),m.useEffect(()=>{if(!Bt||!Ve)return;const K=dn(Ve);if(pt[K])return;let pe=!1;return Yt(K),fetch(`/api/nodes/detail?id=${encodeURIComponent(Ve.id)}`).then(Re=>Re.json().then(Ee=>({ok:Re.ok,json:Ee}))).then(({ok:Re,json:Ee})=>{pe||Re&&Te(Je=>({...Je,[K]:Ee}))}).catch(()=>{}).finally(()=>{pe||Yt("")}),()=>{pe=!0}},[Bt,Ve,pt]),m.useEffect(()=>{if(!Bt)return;const K=Array.isArray(Ye==null?void 0:Ye.files)?Ye.files:[];$t(pe=>{var Re;return pe&&K.some(Ee=>Ee.path===pe)?pe:((Re=K[0])==null?void 0:Re.path)||""})},[Bt,Ye]),m.useEffect(()=>{if(!Bt||!Ve||!jt)return;const K=`${dn(Ve)}:${jt}`;if(Ht[K])return;let pe=!1;return ke(K),fetch(`/api/nodes/file?id=${encodeURIComponent(Ve.id)}&path=${encodeURIComponent(jt)}`).then(Re=>Re.json().then(Ee=>({ok:Re.ok,json:Ee}))).then(({ok:Re,json:Ee})=>{pe||Re&&Xe(Je=>({...Je,[K]:Ee}))}).catch(()=>{}).finally(()=>{pe||ke("")}),()=>{pe=!0}},[Bt,Ve,jt,Ht]),m.useEffect(()=>{kt("")},[ne,a]);const Vr=K=>{r(nf(K,"workspace"))},is=K=>{me(C0(K)),r(nf({id:K.flowId,source:K.flowSource,archived:!!K.archived},"workspace"))},ee=m.useCallback(K=>{var pe,Re;K.preventDefault(),K.stopPropagation(),(Re=(pe=K.dataTransfer)==null?void 0:pe.types)!=null&&Re.includes("Files")&&(Kn.current+=1,q(!0))},[]),Ne=m.useCallback(K=>{K.preventDefault(),K.stopPropagation(),Kn.current-=1,Kn.current<=0&&(Kn.current=0,q(!1))},[]),ie=m.useCallback(K=>{K.preventDefault(),K.stopPropagation()},[]),Dt=m.useCallback(K=>{var Ee,Je;K.preventDefault(),K.stopPropagation(),Kn.current=0,q(!1);const pe=(Je=(Ee=K.dataTransfer)==null?void 0:Ee.files)==null?void 0:Je[0];if(!pe)return;const Re=pe.name.toLowerCase();!Re.endsWith(".yaml")&&!Re.endsWith(".yml")&&!Re.endsWith(".zip")||B(pe)},[]);return o.jsxs("div",{className:"af-projects"+(E?" af-projects--drop-target":""),onDragEnter:ee,onDragLeave:Ne,onDragOver:ie,onDrop:Dt,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"+(W.trim()?" af-search--has-clear":""),type:"search",placeholder:Wr,"aria-label":Wr,autoComplete:"off",value:W,onChange:K=>L(K.target.value),onKeyDown:K=>{K.key==="Escape"&&(L(""),K.currentTarget.blur())}}),W.trim()?o.jsx("button",{type:"button",className:"af-search-clear","aria-label":"Clear search",onClick:()=>L(""),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),Dn?o.jsx("button",{type:"button",className:"af-btn-primary af-create-btn",onClick:()=>In(),children:n("project:refreshResources")}):o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-icon-btn"+(X?" af-icon-btn--active":""),"aria-label":n("flow:palette.toggleRecentActivity"),"aria-expanded":X,"aria-controls":"af-recent-activity-panel",onClick:()=>se(K=>!K),children:o.jsx("span",{className:"material-symbols-outlined",children:"notifications"})}),o.jsx("button",{type:"button",className:"af-btn-primary af-create-btn",onClick:()=>O(!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:bn?n("project:filterResult",{count:a==="nodes"||a==="my-nodes"?st.length:a==="my-flows"?kn.length:a==="skills"?Cn.length:er.length}):a==="my-nodes"?n("project:myNodesHint",{count:st.length}):a==="my-flows"?n("project:myFlowsHint",{count:kn.length}):a==="nodes"?n("project:nodesHint",{count:p.length}):a==="skills"?n("project:skillsHint",{count:d.length}):n(a==="archived"?"project:archivedHint":"project:activeHint")}),A?o.jsx("p",{className:"af-err af-projects-api-hint",children:A}):null,V&&Dn?o.jsx("p",{className:"af-err af-projects-api-hint",children:V}):null]}),Dn?o.jsxs("div",{className:"af-resource-toolbar",children:[a==="skills"?o.jsx(V$,{onChanged:In,canManage:!!(t!=null&&t.isAdmin)}):null,o.jsxs("div",{className:"af-resource-purpose",children:[o.jsx("span",{className:"material-symbols-outlined",children:be?"schema":Bt?te?"deployed_code":"account_tree":"extension"}),o.jsxs("div",{children:[o.jsx("h3",{children:n(be?"project:myFlowsPurposeTitle":te?"project:myNodesPurposeTitle":Bt?"project:nodesPurposeTitle":"project:skillsPurposeTitle")}),o.jsx("p",{children:n(be?"project:myFlowsPurposeDesc":te?"project:myNodesPurposeDesc":Bt?"project:nodesPurposeDesc":"project:skillsPurposeDesc")})]})]}),be?null:o.jsxs(o.Fragment,{children:[Bt?o.jsxs("div",{className:"af-resource-filter-row",children:[o.jsx("button",{type:"button",className:"af-resource-filter"+(te?"":" af-resource-filter--active"),onClick:()=>{l("nodes"),de("all"),ue("")},children:n("project:nodeScopeAll")}),o.jsx("button",{type:"button",className:"af-resource-filter"+(te?" af-resource-filter--active":""),onClick:()=>{l("my-nodes"),de("all"),ue("")},children:n("project:nodeScopeMine")})]}):null,o.jsx("div",{className:"af-resource-filter-row",children:(Bt?(te?oL:iL).map(K=>({id:K,label:n(`project:resourceFilter.${K}`)})):rn).map(K=>K.collection?o.jsxs("span",{className:"af-resource-filter-chip"+(re===K.id?" af-resource-filter-chip--active":""),children:[o.jsxs("button",{type:"button",className:"af-resource-filter af-resource-filter--embedded",onClick:()=>{de(K.id),ue("")},children:[K.label,o.jsx("em",{children:K.count}),K.collection.builtin?o.jsx("strong",{children:"built-in"}):null]}),i&&!K.collection.builtin?o.jsx("button",{type:"button",className:"af-resource-filter-chip__delete",disabled:N,"aria-label":`删除 ${K.collection.name}`,onClick:()=>Zn(K.collection.id),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})}):null]},K.id):o.jsx("button",{type:"button",className:"af-resource-filter"+(re===K.id?" af-resource-filter--active":""),onClick:()=>{de(K.id),ue("")},children:K.label},K.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:w,onChange:K=>x(K.target.value),onKeyDown:K=>{K.key==="Enter"&&ir()},placeholder:"新建 skill collection"}),o.jsxs("button",{type:"button",className:"af-set-btn-add af-set-btn-add--compact",disabled:!w.trim()||N,onClick:()=>ir(),children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),"新建"]})]})}):null]}):null,Bt?o.jsx("div",{className:"af-resource-grid",children:st.length>0?st.map(K=>o.jsxs("button",{type:"button",className:"af-resource-card"+(Ve&&dn(K)===dn(Ve)?" af-resource-card--active":""),onClick:()=>ue(dn(K)),children:[o.jsxs("div",{className:"af-resource-card-head",children:[o.jsx("span",{className:kc(K.type==="control"?"secondary":K.type==="provide"?"primary":"muted"),children:o.jsx(En,{query:W,children:K.type||"node"})}),o.jsx("span",{className:"af-resource-source",children:o.jsx(En,{query:W,children:N0(K.source,n)})})]}),o.jsx("h3",{className:"af-project-title",children:o.jsx(En,{query:W,children:K.label||K.displayName||K.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(En,{query:W,children:K.description||n("project:noDescription")})}),o.jsxs("div",{className:"af-resource-meta-row",children:[o.jsx("span",{children:o.jsx(En,{query:W,children:K.id})}),o.jsx("span",{children:n("project:nodeSlots",{inputs:Object.keys(K.inputs||{}).length,outputs:Object.keys(K.outputs||{}).length})})]}),K.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(En,{query:W,children:`${K.packageId}${K.version?` / ${K.version}`:""}`})})]}):null]},`${K.id}:${K.source||""}:${K.packageId||""}`)):T?o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:bn?n("project:noNodeMatch",{query:W.trim()}):n(te?"project:noMyNodes":"project:noNodes")})}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:n("project:loadingResources")})})}):be?o.jsx("div",{className:"af-resource-grid",children:kn.length>0?kn.map(K=>{const pe=D_(K),Re=F_(K),Ee=Number.isFinite(Number(K.nodeCount))?Number(K.nodeCount):pe.length,Je=Number.isFinite(Number(K.edgeCount))?Number(K.edgeCount):Re.length;return o.jsxs("button",{type:"button",className:"af-resource-card"+(Ie&&Gi(K)===Gi(Ie)?" af-resource-card--active":""),onClick:()=>ue(Gi(K)),children:[o.jsxs("div",{className:"af-resource-card-head",children:[o.jsx("span",{className:kc("primary"),children:o.jsx(En,{query:W,children:K.version?`v${K.version}`:"flow"})}),o.jsx("span",{className:"af-resource-source",children:n("project:flowSnippet")})]}),o.jsx("h3",{className:"af-project-title",children:o.jsx(En,{query:W,children:K.displayName||K.name||K.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(En,{query:W,children:K.description||n("project:noDescription")})}),o.jsxs("div",{className:"af-resource-meta-row",children:[o.jsx("span",{children:n("project:flowSnippetNodes",{nodes:Ee,edges:Je})}),o.jsx("span",{children:o.jsx(En,{query:W,children:K.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(En,{query:W,children:j0(K)})})]})]},Gi(K))}):T?o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:bn?n("project:noFlowSnippetMatch",{query:W.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:Cn.length>0?Cn.map(K=>o.jsxs("button",{type:"button",className:"af-resource-card"+(Lt&&dn(K)===dn(Lt)?" af-resource-card--active":""),onClick:()=>ue(dn(K)),children:[o.jsxs("div",{className:"af-resource-card-head",children:[o.jsx("span",{className:kc(K.source==="builtin"?"muted":"primary"),children:o.jsx(En,{query:W,children:K.sourceLabel||K.source||"skill"})}),o.jsx("span",{className:"af-resource-source",children:n("project:skill")})]}),o.jsx("h3",{className:"af-project-title",children:o.jsx(En,{query:W,children:K.name||K.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(En,{query:W,children:K.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(En,{query:W,children:K.path||K.key||""})})]}),o.jsxs("div",{className:"af-skill-card-collections",children:[k.filter(pe=>pe.skillKeys.includes(dn(K))).slice(0,3).map(pe=>o.jsx("span",{children:pe.name},pe.id)),k.filter(pe=>pe.skillKeys.includes(dn(K))).length===0?o.jsx("span",{className:"af-skill-card-collection-empty",children:"未分组"}):null]})]},K.key||`${K.source}:${K.name}`)):T?o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:bn?n("project:noSkillMatch",{query:W.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"&&gr.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:gr.map(K=>{const pe=un===`show-builtin:builtin:${K}`;return o.jsxs("button",{type:"button",disabled:pe,onClick:()=>hr({id:K,source:"builtin"},"show-builtin"),children:[o.jsx("span",{children:K}),o.jsx("em",{children:pe?"恢复中":"恢复"})]},K)})})]}):null,o.jsxs("div",{className:"af-project-grid",children:[er.length>0?er.map(K=>{const pe=(t==null?void 0:t.isAdmin)&&K.source==="user"&&!K.archived&&!qn.has(K.id),Re=(t==null?void 0:t.isAdmin)&&K.source==="admin",Ee=(t==null?void 0:t.isAdmin)&&K.source==="builtin",Je=un.endsWith(`:${K.source}:${K.id}`);return o.jsx("div",{className:Q$(K.source),role:"button",tabIndex:0,onClick:()=>Vr(K),onKeyDown:Jt=>{(Jt.key==="Enter"||Jt.key===" ")&&(Jt.preventDefault(),Vr(K))},children:o.jsxs("div",{className:"af-project-card-body",children:[o.jsx("span",{className:kc($y(K.source,n).tone),children:o.jsx(En,{query:W,children:$y(K.source,n).label})}),K.archived?o.jsx("span",{className:kc("muted"),children:o.jsx(En,{query:W,children:n("project:archived")})}):null,o.jsx("h3",{className:"af-project-title",children:o.jsx(En,{query:W,children:K.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(En,{query:W,children:L_(K,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(En,{query:W,children:$_(K)})})]}),t!=null&&t.isAdmin?o.jsxs("div",{className:"af-project-admin-actions",onClick:Jt=>Jt.stopPropagation(),onKeyDown:Jt=>Jt.stopPropagation(),children:[pe?o.jsx("button",{type:"button",disabled:Je,onClick:()=>hr(K,"promote"),children:"设为内置"}):null,Re?o.jsx("button",{type:"button",disabled:Je,onClick:()=>hr(K,"unpromote"),children:"取消内置"}):null,Ee?o.jsx("button",{type:"button",disabled:Je,onClick:()=>hr(K,"hide-builtin"),children:"隐藏内置"}):null]}):null]})},`${K.id}:${K.source??"user"}:${K.archived?"a":""}`)}):D?nn.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(A?"project:loadFailed":"project:noPipelines")}),!A&&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:W.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:()=>O(!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")})]}),nt?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")})]})]})]})]}),Dn?o.jsx("aside",{className:"af-resource-detail","aria-label":n(Bt?"project:nodeDetail":be?"project:flowDetail":"project:skillDetail"),children:Bt&&Ve?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:Ve.label||Ve.displayName||Ve.id}),o.jsx("p",{children:Ve.id})]})]}),o.jsx("div",{className:"af-resource-detail-tabs",children:["overview","schema","runtime","files","usage"].map(K=>o.jsx("button",{type:"button",className:"af-resource-detail-tab"+(fe===K?" af-resource-detail-tab--active":""),onClick:()=>ve(K),children:n(`project:nodeDetailTabs.${K}`)},K))}),et===dn(Ve)?o.jsx("p",{className:"af-resource-detail-desc",children:n("project:loadingResources")}):fe==="overview"?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"af-resource-detail-desc",children:Ve.description||((Gt=Ye==null?void 0:Ye.node)==null?void 0:Gt.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:Ve.type||((vn=Ye==null?void 0:Ye.node)==null?void 0:vn.type)||"node"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailSource")}),o.jsx("dd",{children:N0(Ve.source,n)})]}),Ve.packageId?o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPackage")}),o.jsx("dd",{children:Ve.packageId})]}):null,Ve.version?o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailVersion")}),o.jsx("dd",{children:Ve.version})]}):null,Ve.packageDir||Ye!=null&&Ye.baseDir?o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPath")}),o.jsx("dd",{children:Ve.packageDir||(Ye==null?void 0:Ye.baseDir)})]}):null,o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailEditable")}),o.jsx("dd",{children:(Ye==null?void 0:Ye.readOnly)===!1?n("project:editable"):n("project:readOnly")})]})]}),te&&Ve.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:Se===dn(Ve),onClick:()=>On(Ve),children:[o.jsx("span",{className:"material-symbols-outlined",children:"delete"}),Se===dn(Ve)?n("project:deletingMyNode"):n("project:deleteMyNode")]}),Ze?o.jsx("p",{className:"af-resource-action-message",children:Ze}):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")})]})]}):fe==="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")}),rf(((xs=Ye==null?void 0:Ye.node)==null?void 0:xs.inputs)||Ve.inputs).length>0?rf(((Sn=Ye==null?void 0:Ye.node)==null?void 0:Sn.inputs)||Ve.inputs).map(K=>o.jsxs("code",{children:[K.name||K.key,K.type?`: ${K.type}`:""]},K.key)):o.jsx("em",{children:n("project:noSlots")})]}),o.jsxs("div",{className:"af-resource-slot-group",children:[o.jsx("span",{children:n("project:nodeOutputs")}),rf(((Ar=Ye==null?void 0:Ye.node)==null?void 0:Ar.outputs)||Ve.outputs).length>0?rf(((os=Ye==null?void 0:Ye.node)==null?void 0:os.outputs)||Ve.outputs).map(K=>o.jsxs("code",{children:[K.name||K.key,K.type?`: ${K.type}`:""]},K.key)):o.jsx("em",{children:n("project:noSlots")})]})]}):fe==="runtime"?o.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[o.jsx("h4",{children:n("project:nodeRuntime")}),Ye!=null&&Ye.runtime?o.jsx("pre",{className:"af-resource-skill-preview",children:JSON.stringify(Ye.runtime,null,2)}):o.jsx("p",{children:n("project:noRuntimeManifest")}),Ye!=null&&Ye.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:Ye.body})]}):o.jsx("p",{children:n("project:noNodeBody")})]}):fe==="files"?o.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[o.jsx("h4",{children:n("project:nodeFiles")}),Array.isArray(Ye==null?void 0:Ye.files)&&Ye.files.length>0?o.jsxs("div",{className:"af-node-file-browser",children:[o.jsx("div",{className:"af-node-file-list",children:Ye.files.map(K=>o.jsxs("button",{type:"button",className:"af-node-file-item"+(jt===K.path?" af-node-file-item--active":""),onClick:()=>$t(K.path),children:[o.jsx("span",{className:"material-symbols-outlined",children:"description"}),o.jsx("span",{children:K.path})]},K.path))}),o.jsxs("pre",{className:"af-resource-skill-preview",children:[oe===`${dn(Ve)}:${jt}`?n("project:loadingResources"):or!=null&&or.binary?n("project:binaryFile"):(or==null?void 0:or.content)||n("project:selectNodeFile"),or!=null&&or.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(Ye==null?void 0:Ye.usage)&&Ye.usage.length>0?o.jsx("div",{className:"af-node-usage-list",children:Ye.usage.map(K=>o.jsxs("div",{className:"af-node-usage-item",children:[o.jsx("strong",{children:K.flowId}),o.jsxs("span",{children:[K.flowSource,K.archived?` · ${n("project:archived")}`:""]}),o.jsx("em",{children:K.instances.map(pe=>pe.label||pe.instanceId).join(", ")})]},`${K.flowSource}:${K.flowId}:${K.archived?"a":""}`))}):o.jsx("p",{children:n("project:noNodeUsage")})]})]}):be&&Ie?(()=>{const K=hL(Ie);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:Ie.displayName||Ie.name||Ie.id}),o.jsx("p",{children:Ie.id})]})]}),o.jsx("p",{className:"af-resource-detail-desc",children:Ie.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:Ie.version||"1.0.0"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPath")}),o.jsx("dd",{children:j0(Ie)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:flowSnippetScale")}),o.jsx("dd",{children:n("project:flowSnippetNodes",{nodes:Number.isFinite(Number(Ie.nodeCount))?Number(Ie.nodeCount):K.nodes.length,edges:Number.isFinite(Number(Ie.edgeCount))?Number(Ie.edgeCount):K.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:Z===Gi(Ie),onClick:()=>Hr(Ie),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"delete"}),Z===Gi(Ie)?n("project:deletingMyFlow"):n("project:deleteMyFlow")]}),He?o.jsx("p",{className:"af-resource-action-message",children:He}):null]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:n("project:flowSnippetPreview")}),K.diagram.nodes.length>0?o.jsx("div",{className:"af-flow-snippet-map",children:o.jsxs("svg",{viewBox:K.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:K.diagram.edges.map(pe=>o.jsxs("g",{children:[o.jsx("path",{d:pe.path}),pe.label?o.jsx("text",{x:pe.labelX,y:pe.labelY-5,textAnchor:"middle",children:Km(pe.label,18)}):null]},pe.key))}),o.jsx("g",{className:"af-flow-snippet-map__nodes",children:K.diagram.nodes.map((pe,Re)=>o.jsxs("g",{transform:`translate(${pe.x} ${pe.y})`,children:[o.jsx("rect",{width:pe.width,height:pe.height,rx:"10"}),o.jsx("circle",{cx:"19",cy:pe.height/2,r:"12"}),o.jsx("text",{className:"af-flow-snippet-map__node-index",x:"19",y:pe.height/2+4,textAnchor:"middle",children:Re+1}),o.jsx("text",{className:"af-flow-snippet-map__node-title",x:"40",y:pe.height/2-3,children:Km(pe.title)}),o.jsx("text",{className:"af-flow-snippet-map__node-meta",x:"40",y:pe.height/2+16,children:Km(pe.meta||pe.id,20)})]},pe.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(Ie.snippet||{},null,2)})]})]})]})})():a==="skills"&&Lt?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:Lt.name||Lt.id}),o.jsx("p",{children:Lt.sourceLabel||Lt.source})]})]}),o.jsx("p",{className:"af-resource-detail-desc",children:Lt.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:Lt.sourceLabel||Lt.source})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPath")}),o.jsx("dd",{children:Lt.path||Lt.key})]})]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:"Collections"}),k.length===0?o.jsx("p",{children:"暂无 collection。可在左侧新建后再添加。"}):o.jsx("div",{className:"af-skill-detail-collections",children:k.map(K=>{const pe=dn(Lt),Re=K.skillKeys.includes(pe);return o.jsxs("label",{className:"af-composer-skill-option af-skill-detail-collection-option",children:[o.jsx("input",{type:"checkbox",checked:Re,disabled:N||!i,onChange:Ee=>Er(K.id,pe,Ee.target.checked)}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:K.name}),o.jsxs("span",{className:"af-composer-skill-option-desc",children:[K.skillKeys.length," skills"]})]})]},K.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:Pe===dn(Lt)?n("project:loadingResources"):(Wt==null?void 0:Wt.body)||(Wt==null?void 0:Wt.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"+(X?"":" af-activity--hidden"),"aria-hidden":!X,"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:Br.length===0?o.jsx("p",{className:"af-activity-empty",children:mr.length===0?n("project:noRecentActivity"):n("project:noMatchRecent")}):Br.map(K=>{const pe=ae===C0(K);return o.jsxs("button",{type:"button",className:"af-activity-row af-activity-row--action"+(pe?" af-activity-row--active":""),"aria-current":pe?"page":void 0,onClick:()=>is(K),children:[o.jsxs("div",{className:"af-activity-row-top",children:[o.jsx("h4",{className:"af-activity-name",children:o.jsx(En,{query:W,children:K.flowId})}),o.jsx("span",{className:"af-activity-time",children:v0(K.at,n)})]}),o.jsxs("div",{className:"af-activity-meta",children:[o.jsx("span",{className:Z$(K.kind),children:K.kind==="executed"?"play_arrow":"visibility"}),o.jsxs("p",{className:"af-activity-text",children:[K.kind==="executed"?n("project:recentRun"):n("project:recentOpen")," · ",v0(K.at,n)]})]})]},`${K.kind}-${K.flowId}-${K.flowSource}-${K.at}`)})})]})]}),o.jsx($$,{open:M,onClose:()=>O(!1),onCreated:async K=>{O(!1),await Pn();const pe=K.source??"user";r(nf({id:K.id,source:pe},"workspace"))}}),P?o.jsx(R$,{file:P,onClose:()=>B(null),onImported:async K=>{B(null),await Pn();const pe=K.source??"user";r(nf({id:K.id,source:pe},"workspace"))}},`${P.name}-${P.size}-${P.lastModified}`):null]})}function $n(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=$n(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var mL={value:()=>{}};function wh(){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 Uf(n)}function Uf(e){this._=e}function gL(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}})}Uf.prototype=wh.prototype={constructor:Uf,on:function(e,t){var n=this._,r=gL(e+"",n),s,i=-1,a=r.length;if(arguments.length<2){for(;++i<a;)if((s=(e=r[i]).type)&&(s=yL(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]=A0(n[s],e.name,t);else if(t==null)for(s in n)n[s]=A0(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 Uf(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 yL(e,t){for(var n=0,r=e.length,s;n<r;++n)if((s=e[n]).name===t)return s.value}function A0(e,t,n){for(var r=0,s=e.length;r<s;++r)if(e[r].name===t){e[r]=mL,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Dy="http://www.w3.org/1999/xhtml";const P0={svg:"http://www.w3.org/2000/svg",xhtml:Dy,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function bh(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),P0.hasOwnProperty(t)?{space:P0[t],local:e}:e}function xL(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Dy&&t.documentElement.namespaceURI===Dy?t.createElement(e):t.createElementNS(n,e)}}function wL(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function z_(e){var t=bh(e);return(t.local?wL:xL)(t)}function bL(){}function Ew(e){return e==null?bL:function(){return this.querySelector(e)}}function kL(e){typeof e!="function"&&(e=Ew(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,p=0;p<a;++p)(c=i[p])&&(u=e.call(c,c.__data__,p,i))&&("__data__"in c&&(u.__data__=c.__data__),l[p]=u);return new ns(r,this._parents)}function vL(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function SL(){return[]}function H_(e){return e==null?SL:function(){return this.querySelectorAll(e)}}function NL(e){return function(){return vL(e.apply(this,arguments))}}function jL(e){typeof e=="function"?e=NL(e):e=H_(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 ns(r,s)}function B_(e){return function(){return this.matches(e)}}function W_(e){return function(t){return t.matches(e)}}var CL=Array.prototype.find;function _L(e){return function(){return CL.call(this.children,e)}}function EL(){return this.firstElementChild}function AL(e){return this.select(e==null?EL:_L(typeof e=="function"?e:W_(e)))}var PL=Array.prototype.filter;function IL(){return Array.from(this.children)}function TL(e){return function(){return PL.call(this.children,e)}}function RL(e){return this.selectAll(e==null?IL:TL(typeof e=="function"?e:W_(e)))}function ML(e){typeof e!="function"&&(e=B_(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 ns(r,this._parents)}function V_(e){return new Array(e.length)}function $L(){return new ns(this._enter||this._groups.map(V_),this._parents)}function _p(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}_p.prototype={constructor:_p,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 LL(e){return function(){return e}}function OL(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 _p(e,i[a]);for(;a<c;++a)(l=t[a])&&(s[a]=l)}function DL(e,t,n,r,s,i,a){var l,c,u=new Map,p=t.length,f=i.length,d=new Array(p),h;for(l=0;l<p;++l)(c=t[l])&&(d[l]=h=a.call(c,c.__data__,l,t)+"",u.has(h)?s[l]=c:u.set(h,c));for(l=0;l<f;++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 _p(e,i[l]);for(l=0;l<p;++l)(c=t[l])&&u.get(d[l])===c&&(s[l]=c)}function FL(e){return e.__data__}function zL(e,t){if(!arguments.length)return Array.from(this,FL);var n=t?DL:OL,r=this._parents,s=this._groups;typeof e!="function"&&(e=LL(e));for(var i=s.length,a=new Array(i),l=new Array(i),c=new Array(i),u=0;u<i;++u){var p=r[u],f=s[u],d=f.length,h=HL(e.call(p,p&&p.__data__,u,r)),y=h.length,b=l[u]=new Array(y),k=a[u]=new Array(y),g=c[u]=new Array(d);n(p,f,b,k,g,h,t);for(var w=0,x=0,N,C;w<y;++w)if(N=b[w]){for(w>=x&&(x=w+1);!(C=k[x])&&++x<y;);N._next=C||null}}return a=new ns(a,r),a._enter=l,a._exit=c,a}function HL(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function BL(){return new ns(this._exit||this._groups.map(V_),this._parents)}function WL(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 VL(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],p=r[c],f=u.length,d=l[c]=new Array(f),h,y=0;y<f;++y)(h=u[y]||p[y])&&(d[y]=h);for(;c<s;++c)l[c]=n[c];return new ns(l,this._parents)}function KL(){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 UL(e){e||(e=qL);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}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,p=0;p<l;++p)(u=a[p])&&(c[p]=u);c.sort(t)}return new ns(s,this._parents).order()}function qL(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function YL(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function GL(){return Array.from(this)}function JL(){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 XL(){let e=0;for(const t of this)++e;return e}function QL(){return!this.node()}function ZL(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 eO(e){return function(){this.removeAttribute(e)}}function tO(e){return function(){this.removeAttributeNS(e.space,e.local)}}function nO(e,t){return function(){this.setAttribute(e,t)}}function rO(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function sO(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function iO(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 oO(e,t){var n=bh(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?tO:eO:typeof t=="function"?n.local?iO:sO:n.local?rO:nO)(n,t))}function K_(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function aO(e){return function(){this.style.removeProperty(e)}}function lO(e,t,n){return function(){this.style.setProperty(e,t,n)}}function cO(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function uO(e,t,n){return arguments.length>1?this.each((t==null?aO:typeof t=="function"?cO:lO)(e,t,n??"")):Pl(this.node(),e)}function Pl(e,t){return e.style.getPropertyValue(t)||K_(e).getComputedStyle(e,null).getPropertyValue(t)}function dO(e){return function(){delete this[e]}}function fO(e,t){return function(){this[e]=t}}function pO(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function hO(e,t){return arguments.length>1?this.each((t==null?dO:typeof t=="function"?pO:fO)(e,t)):this.node()[e]}function U_(e){return e.trim().split(/^|\s+/)}function Aw(e){return e.classList||new q_(e)}function q_(e){this._node=e,this._names=U_(e.getAttribute("class")||"")}q_.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Y_(e,t){for(var n=Aw(e),r=-1,s=t.length;++r<s;)n.add(t[r])}function G_(e,t){for(var n=Aw(e),r=-1,s=t.length;++r<s;)n.remove(t[r])}function mO(e){return function(){Y_(this,e)}}function gO(e){return function(){G_(this,e)}}function yO(e,t){return function(){(t.apply(this,arguments)?Y_:G_)(this,e)}}function xO(e,t){var n=U_(e+"");if(arguments.length<2){for(var r=Aw(this.node()),s=-1,i=n.length;++s<i;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof t=="function"?yO:t?mO:gO)(n,t))}function wO(){this.textContent=""}function bO(e){return function(){this.textContent=e}}function kO(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function vO(e){return arguments.length?this.each(e==null?wO:(typeof e=="function"?kO:bO)(e)):this.node().textContent}function SO(){this.innerHTML=""}function NO(e){return function(){this.innerHTML=e}}function jO(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function CO(e){return arguments.length?this.each(e==null?SO:(typeof e=="function"?jO:NO)(e)):this.node().innerHTML}function _O(){this.nextSibling&&this.parentNode.appendChild(this)}function EO(){return this.each(_O)}function AO(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function PO(){return this.each(AO)}function IO(e){var t=typeof e=="function"?e:z_(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function TO(){return null}function RO(e,t){var n=typeof e=="function"?e:z_(e),r=t==null?TO:typeof t=="function"?t:Ew(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function MO(){var e=this.parentNode;e&&e.removeChild(this)}function $O(){return this.each(MO)}function LO(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function OO(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function DO(e){return this.select(e?OO:LO)}function FO(e){return arguments.length?this.property("__data__",e):this.node().__data__}function zO(e){return function(t){e.call(this,t,this.__data__)}}function HO(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 BO(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 WO(e,t,n){return function(){var r=this.__on,s,i=zO(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 VO(e,t,n){var r=HO(e+""),s,i=r.length,a;if(arguments.length<2){var l=this.node().__on;if(l){for(var c=0,u=l.length,p;c<u;++c)for(s=0,p=l[c];s<i;++s)if((a=r[s]).type===p.type&&a.name===p.name)return p.value}return}for(l=t?WO:BO,s=0;s<i;++s)this.each(l(r[s],t,n));return this}function J_(e,t,n){var r=K_(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 KO(e,t){return function(){return J_(this,e,t)}}function UO(e,t){return function(){return J_(this,e,t.apply(this,arguments))}}function qO(e,t){return this.each((typeof t=="function"?UO:KO)(e,t))}function*YO(){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 X_=[null];function ns(e,t){this._groups=e,this._parents=t}function Qu(){return new ns([[document.documentElement]],X_)}function GO(){return this}ns.prototype=Qu.prototype={constructor:ns,select:kL,selectAll:jL,selectChild:AL,selectChildren:RL,filter:ML,data:zL,enter:$L,exit:BL,join:WL,merge:VL,selection:GO,order:KL,sort:UL,call:YL,nodes:GL,node:JL,size:XL,empty:QL,each:ZL,attr:oO,style:uO,property:hO,classed:xO,text:vO,html:CO,raise:EO,lower:PO,append:IO,insert:RO,remove:$O,clone:DO,datum:FO,on:VO,dispatch:qO,[Symbol.iterator]:YO};function Jr(e){return typeof e=="string"?new ns([[document.querySelector(e)]],[document.documentElement]):new ns([[e]],X_)}function JO(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Ps(e,t){if(e=JO(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 XO={passive:!1},ju={capture:!0,passive:!1};function Um(e){e.stopImmediatePropagation()}function gl(e){e.preventDefault(),e.stopImmediatePropagation()}function Q_(e){var t=e.document.documentElement,n=Jr(e).on("dragstart.drag",gl,ju);"onselectstart"in t?n.on("selectstart.drag",gl,ju):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Z_(e,t){var n=e.document.documentElement,r=Jr(e).on("dragstart.drag",null);t&&(r.on("click.drag",gl,ju),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 sf=e=>()=>e;function Fy(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:i,x:a,y:l,dx:c,dy:u,dispatch:p}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value: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:p}})}Fy.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function QO(e){return!e.ctrlKey&&!e.button}function ZO(){return this.parentNode}function eD(e,t){return t??{x:e.x,y:e.y}}function tD(){return navigator.maxTouchPoints||"ontouchstart"in this}function eE(){var e=QO,t=ZO,n=eD,r=tD,s={},i=wh("start","drag","end"),a=0,l,c,u,p,f=0;function d(N){N.on("mousedown.drag",h).filter(r).on("touchstart.drag",k).on("touchmove.drag",g,XO).on("touchend.drag touchcancel.drag",w).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(N,C){if(!(p||!e.call(this,N,C))){var j=x(this,t.call(this,N,C),N,C,"mouse");j&&(Jr(N.view).on("mousemove.drag",y,ju).on("mouseup.drag",b,ju),Q_(N.view),Um(N),u=!1,l=N.clientX,c=N.clientY,j("start",N))}}function y(N){if(gl(N),!u){var C=N.clientX-l,j=N.clientY-c;u=C*C+j*j>f}s.mouse("drag",N)}function b(N){Jr(N.view).on("mousemove.drag mouseup.drag",null),Z_(N.view,u),gl(N),s.mouse("end",N)}function k(N,C){if(e.call(this,N,C)){var j=N.changedTouches,_=t.call(this,N,C),A=j.length,F,V;for(F=0;F<A;++F)(V=x(this,_,N,C,j[F].identifier,j[F]))&&(Um(N),V("start",N,j[F]))}}function g(N){var C=N.changedTouches,j=C.length,_,A;for(_=0;_<j;++_)(A=s[C[_].identifier])&&(gl(N),A("drag",N,C[_]))}function w(N){var C=N.changedTouches,j=C.length,_,A;for(p&&clearTimeout(p),p=setTimeout(function(){p=null},500),_=0;_<j;++_)(A=s[C[_].identifier])&&(Um(N),A("end",N,C[_]))}function x(N,C,j,_,A,F){var V=i.copy(),z=Ps(F||j,C),D,R,T;if((T=n.call(N,new Fy("beforestart",{sourceEvent:j,target:d,identifier:A,active:a,x:z[0],y:z[1],dx:0,dy:0,dispatch:V}),_))!=null)return D=T.x-z[0]||0,R=T.y-z[1]||0,function $(M,O,P){var B=z,E;switch(M){case"start":s[A]=$,E=a++;break;case"end":delete s[A],--a;case"drag":z=Ps(P||O,C),E=a;break}V.call(M,N,new Fy(M,{sourceEvent:O,subject:T,target:d,identifier:A,active:E,x:z[0]+D,y:z[1]+R,dx:z[0]-B[0],dy:z[1]-B[1],dispatch:V}),_)}}return d.filter=function(N){return arguments.length?(e=typeof N=="function"?N:sf(!!N),d):e},d.container=function(N){return arguments.length?(t=typeof N=="function"?N:sf(N),d):t},d.subject=function(N){return arguments.length?(n=typeof N=="function"?N:sf(N),d):n},d.touchable=function(N){return arguments.length?(r=typeof N=="function"?N:sf(!!N),d):r},d.on=function(){var N=i.on.apply(i,arguments);return N===i?d:N},d.clickDistance=function(N){return arguments.length?(f=(N=+N)*N,d):Math.sqrt(f)},d}function Pw(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function tE(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Zu(){}var Cu=.7,Ep=1/Cu,yl="\\s*([+-]?\\d+)\\s*",_u="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ii="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",nD=/^#([0-9a-f]{3,8})$/,rD=new RegExp(`^rgb\\(${yl},${yl},${yl}\\)$`),sD=new RegExp(`^rgb\\(${ii},${ii},${ii}\\)$`),iD=new RegExp(`^rgba\\(${yl},${yl},${yl},${_u}\\)$`),oD=new RegExp(`^rgba\\(${ii},${ii},${ii},${_u}\\)$`),aD=new RegExp(`^hsl\\(${_u},${ii},${ii}\\)$`),lD=new RegExp(`^hsla\\(${_u},${ii},${ii},${_u}\\)$`),I0={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};Pw(Zu,ca,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:T0,formatHex:T0,formatHex8:cD,formatHsl:uD,formatRgb:R0,toString:R0});function T0(){return this.rgb().formatHex()}function cD(){return this.rgb().formatHex8()}function uD(){return nE(this).formatHsl()}function R0(){return this.rgb().formatRgb()}function ca(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=nD.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?M0(t):n===3?new Mr(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?of(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?of(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=rD.exec(e))?new Mr(t[1],t[2],t[3],1):(t=sD.exec(e))?new Mr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=iD.exec(e))?of(t[1],t[2],t[3],t[4]):(t=oD.exec(e))?of(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=aD.exec(e))?O0(t[1],t[2]/100,t[3]/100,1):(t=lD.exec(e))?O0(t[1],t[2]/100,t[3]/100,t[4]):I0.hasOwnProperty(e)?M0(I0[e]):e==="transparent"?new Mr(NaN,NaN,NaN,0):null}function M0(e){return new Mr(e>>16&255,e>>8&255,e&255,1)}function of(e,t,n,r){return r<=0&&(e=t=n=NaN),new Mr(e,t,n,r)}function dD(e){return e instanceof Zu||(e=ca(e)),e?(e=e.rgb(),new Mr(e.r,e.g,e.b,e.opacity)):new Mr}function zy(e,t,n,r){return arguments.length===1?dD(e):new Mr(e,t,n,r??1)}function Mr(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Pw(Mr,zy,tE(Zu,{brighter(e){return e=e==null?Ep:Math.pow(Ep,e),new Mr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Cu:Math.pow(Cu,e),new Mr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Mr(Zo(this.r),Zo(this.g),Zo(this.b),Ap(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:$0,formatHex:$0,formatHex8:fD,formatRgb:L0,toString:L0}));function $0(){return`#${Yo(this.r)}${Yo(this.g)}${Yo(this.b)}`}function fD(){return`#${Yo(this.r)}${Yo(this.g)}${Yo(this.b)}${Yo((isNaN(this.opacity)?1:this.opacity)*255)}`}function L0(){const e=Ap(this.opacity);return`${e===1?"rgb(":"rgba("}${Zo(this.r)}, ${Zo(this.g)}, ${Zo(this.b)}${e===1?")":`, ${e})`}`}function Ap(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Zo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Yo(e){return e=Zo(e),(e<16?"0":"")+e.toString(16)}function O0(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Rs(e,t,n,r)}function nE(e){if(e instanceof Rs)return new Rs(e.h,e.s,e.l,e.opacity);if(e instanceof Zu||(e=ca(e)),!e)return new Rs;if(e instanceof Rs)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 Rs(a,l,c,e.opacity)}function pD(e,t,n,r){return arguments.length===1?nE(e):new Rs(e,t,n,r??1)}function Rs(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Pw(Rs,pD,tE(Zu,{brighter(e){return e=e==null?Ep:Math.pow(Ep,e),new Rs(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Cu:Math.pow(Cu,e),new Rs(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 Mr(qm(e>=240?e-240:e+120,s,r),qm(e,s,r),qm(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new Rs(D0(this.h),af(this.s),af(this.l),Ap(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=Ap(this.opacity);return`${e===1?"hsl(":"hsla("}${D0(this.h)}, ${af(this.s)*100}%, ${af(this.l)*100}%${e===1?")":`, ${e})`}`}}));function D0(e){return e=(e||0)%360,e<0?e+360:e}function af(e){return Math.max(0,Math.min(1,e||0))}function qm(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 Iw=e=>()=>e;function hD(e,t){return function(n){return e+n*t}}function mD(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 gD(e){return(e=+e)==1?rE:function(t,n){return n-t?mD(t,n,e):Iw(isNaN(t)?n:t)}}function rE(e,t){var n=t-e;return n?hD(e,n):Iw(isNaN(e)?t:e)}const Pp=function e(t){var n=gD(t);function r(s,i){var a=n((s=zy(s)).r,(i=zy(i)).r),l=n(s.g,i.g),c=n(s.b,i.b),u=rE(s.opacity,i.opacity);return function(p){return s.r=a(p),s.g=l(p),s.b=c(p),s.opacity=u(p),s+""}}return r.gamma=e,r}(1);function yD(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 xD(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function wD(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]=Qc(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 bD(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Js(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function kD(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]=Qc(e[s],t[s]):r[s]=t[s];return function(i){for(s in n)r[s]=n[s](i);return r}}var Hy=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ym=new RegExp(Hy.source,"g");function vD(e){return function(){return e}}function SD(e){return function(t){return e(t)+""}}function sE(e,t){var n=Hy.lastIndex=Ym.lastIndex=0,r,s,i,a=-1,l=[],c=[];for(e=e+"",t=t+"";(r=Hy.exec(e))&&(s=Ym.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:Js(r,s)})),n=Ym.lastIndex;return n<t.length&&(i=t.slice(n),l[a]?l[a]+=i:l[++a]=i),l.length<2?c[0]?SD(c[0].x):vD(t):(t=c.length,function(u){for(var p=0,f;p<t;++p)l[(f=c[p]).i]=f.x(u);return l.join("")})}function Qc(e,t){var n=typeof t,r;return t==null||n==="boolean"?Iw(t):(n==="number"?Js:n==="string"?(r=ca(t))?(t=r,Pp):sE:t instanceof ca?Pp:t instanceof Date?bD:xD(t)?yD:Array.isArray(t)?wD:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?kD:Js)(e,t)}var F0=180/Math.PI,By={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function iE(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)*F0,skewX:Math.atan(c)*F0,scaleX:a,scaleY:l}}var lf;function ND(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?By:iE(t.a,t.b,t.c,t.d,t.e,t.f)}function jD(e){return e==null||(lf||(lf=document.createElementNS("http://www.w3.org/2000/svg","g")),lf.setAttribute("transform",e),!(e=lf.transform.baseVal.consolidate()))?By:(e=e.matrix,iE(e.a,e.b,e.c,e.d,e.e,e.f))}function oE(e,t,n,r){function s(u){return u.length?u.pop()+" ":""}function i(u,p,f,d,h,y){if(u!==f||p!==d){var b=h.push("translate(",null,t,null,n);y.push({i:b-4,x:Js(u,f)},{i:b-2,x:Js(p,d)})}else(f||d)&&h.push("translate("+f+t+d+n)}function a(u,p,f,d){u!==p?(u-p>180?p+=360:p-u>180&&(u+=360),d.push({i:f.push(s(f)+"rotate(",null,r)-2,x:Js(u,p)})):p&&f.push(s(f)+"rotate("+p+r)}function l(u,p,f,d){u!==p?d.push({i:f.push(s(f)+"skewX(",null,r)-2,x:Js(u,p)}):p&&f.push(s(f)+"skewX("+p+r)}function c(u,p,f,d,h,y){if(u!==f||p!==d){var b=h.push(s(h)+"scale(",null,",",null,")");y.push({i:b-4,x:Js(u,f)},{i:b-2,x:Js(p,d)})}else(f!==1||d!==1)&&h.push(s(h)+"scale("+f+","+d+")")}return function(u,p){var f=[],d=[];return u=e(u),p=e(p),i(u.translateX,u.translateY,p.translateX,p.translateY,f,d),a(u.rotate,p.rotate,f,d),l(u.skewX,p.skewX,f,d),c(u.scaleX,u.scaleY,p.scaleX,p.scaleY,f,d),u=p=null,function(h){for(var y=-1,b=d.length,k;++y<b;)f[(k=d[y]).i]=k.x(h);return f.join("")}}}var CD=oE(ND,"px, ","px)","deg)"),_D=oE(jD,", ",")",")"),ED=1e-12;function z0(e){return((e=Math.exp(e))+1/e)/2}function AD(e){return((e=Math.exp(e))-1/e)/2}function PD(e){return((e=Math.exp(2*e))-1)/(e+1)}const qf=function e(t,n,r){function s(i,a){var l=i[0],c=i[1],u=i[2],p=a[0],f=a[1],d=a[2],h=p-l,y=f-c,b=h*h+y*y,k,g;if(b<ED)g=Math.log(d/u)/t,k=function(_){return[l+_*h,c+_*y,u*Math.exp(t*_*g)]};else{var w=Math.sqrt(b),x=(d*d-u*u+r*b)/(2*u*n*w),N=(d*d-u*u-r*b)/(2*d*n*w),C=Math.log(Math.sqrt(x*x+1)-x),j=Math.log(Math.sqrt(N*N+1)-N);g=(j-C)/t,k=function(_){var A=_*g,F=z0(C),V=u/(n*w)*(F*PD(t*A+C)-AD(C));return[l+V*h,c+V*y,u*F/z0(t*A+C)]}}return k.duration=g*1e3*t/Math.SQRT2,k}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 Il=0,Lc=0,vc=0,aE=1e3,Ip,Oc,Tp=0,ua=0,kh=0,Eu=typeof performance=="object"&&performance.now?performance:Date,lE=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Tw(){return ua||(lE(ID),ua=Eu.now()+kh)}function ID(){ua=0}function Rp(){this._call=this._time=this._next=null}Rp.prototype=cE.prototype={constructor:Rp,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Tw():+n)+(t==null?0:+t),!this._next&&Oc!==this&&(Oc?Oc._next=this:Ip=this,Oc=this),this._call=e,this._time=n,Wy()},stop:function(){this._call&&(this._call=null,this._time=1/0,Wy())}};function cE(e,t,n){var r=new Rp;return r.restart(e,t,n),r}function TD(){Tw(),++Il;for(var e=Ip,t;e;)(t=ua-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Il}function H0(){ua=(Tp=Eu.now())+kh,Il=Lc=0;try{TD()}finally{Il=0,MD(),ua=0}}function RD(){var e=Eu.now(),t=e-Tp;t>aE&&(kh-=t,Tp=e)}function MD(){for(var e,t=Ip,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:Ip=n);Oc=e,Wy(r)}function Wy(e){if(!Il){Lc&&(Lc=clearTimeout(Lc));var t=e-ua;t>24?(e<1/0&&(Lc=setTimeout(H0,e-Eu.now()-kh)),vc&&(vc=clearInterval(vc))):(vc||(Tp=Eu.now(),vc=setInterval(RD,aE)),Il=1,lE(H0))}}function B0(e,t,n){var r=new Rp;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var $D=wh("start","end","cancel","interrupt"),LD=[],uE=0,W0=1,Vy=2,Yf=3,V0=4,Ky=5,Gf=6;function vh(e,t,n,r,s,i){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;OD(e,n,{name:t,index:r,group:s,on:$D,tween:LD,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:uE})}function Rw(e,t){var n=Bs(e,t);if(n.state>uE)throw new Error("too late; already scheduled");return n}function di(e,t){var n=Bs(e,t);if(n.state>Yf)throw new Error("too late; already running");return n}function Bs(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function OD(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=cE(i,0,n.time);function i(u){n.state=W0,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var p,f,d,h;if(n.state!==W0)return c();for(p in r)if(h=r[p],h.name===n.name){if(h.state===Yf)return B0(a);h.state===V0?(h.state=Gf,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[p]):+p<t&&(h.state=Gf,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[p])}if(B0(function(){n.state===Yf&&(n.state=V0,n.timer.restart(l,n.delay,n.time),l(u))}),n.state=Vy,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Vy){for(n.state=Yf,s=new Array(d=n.tween.length),p=0,f=-1;p<d;++p)(h=n.tween[p].value.call(e,e.__data__,n.index,n.group))&&(s[++f]=h);s.length=f+1}}function l(u){for(var p=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=Ky,1),f=-1,d=s.length;++f<d;)s[f].call(e,p);n.state===Ky&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Gf,n.timer.stop(),delete r[t];for(var u in r)return;delete e.__transition}}function Jf(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>Vy&&r.state<Ky,r.state=Gf,r.timer.stop(),r.on.call(s?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[a]}i&&delete e.__transition}}function DD(e){return this.each(function(){Jf(this,e)})}function FD(e,t){var n,r;return function(){var s=di(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 zD(e,t,n){var r,s;if(typeof n!="function")throw new Error;return function(){var i=di(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 HD(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Bs(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?FD:zD)(n,e,t))}function Mw(e,t,n){var r=e._id;return e.each(function(){var s=di(this,r);(s.value||(s.value={}))[t]=n.apply(this,arguments)}),function(s){return Bs(s,r).value[t]}}function dE(e,t){var n;return(typeof t=="number"?Js:t instanceof ca?Pp:(n=ca(t))?(t=n,Pp):sE)(e,t)}function BD(e){return function(){this.removeAttribute(e)}}function WD(e){return function(){this.removeAttributeNS(e.space,e.local)}}function VD(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 KD(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 UD(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 qD(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 YD(e,t){var n=bh(e),r=n==="transform"?_D:dE;return this.attrTween(e,typeof t=="function"?(n.local?qD:UD)(n,r,Mw(this,"attr."+e,t)):t==null?(n.local?WD:BD)(n):(n.local?KD:VD)(n,r,t))}function GD(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function JD(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function XD(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&JD(e,i)),n}return s._value=t,s}function QD(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&GD(e,i)),n}return s._value=t,s}function ZD(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=bh(e);return this.tween(n,(r.local?XD:QD)(r,t))}function eF(e,t){return function(){Rw(this,e).delay=+t.apply(this,arguments)}}function tF(e,t){return t=+t,function(){Rw(this,e).delay=t}}function nF(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?eF:tF)(t,e)):Bs(this.node(),t).delay}function rF(e,t){return function(){di(this,e).duration=+t.apply(this,arguments)}}function sF(e,t){return t=+t,function(){di(this,e).duration=t}}function iF(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?rF:sF)(t,e)):Bs(this.node(),t).duration}function oF(e,t){if(typeof t!="function")throw new Error;return function(){di(this,e).ease=t}}function aF(e){var t=this._id;return arguments.length?this.each(oF(t,e)):Bs(this.node(),t).ease}function lF(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;di(this,e).ease=n}}function cF(e){if(typeof e!="function")throw new Error;return this.each(lF(this._id,e))}function uF(e){typeof e!="function"&&(e=B_(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 Mi(r,this._parents,this._name,this._id)}function dF(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],p=c.length,f=a[l]=new Array(p),d,h=0;h<p;++h)(d=c[h]||u[h])&&(f[h]=d);for(;l<r;++l)a[l]=t[l];return new Mi(a,this._parents,this._name,this._id)}function fF(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 pF(e,t,n){var r,s,i=fF(t)?Rw:di;return function(){var a=i(this,e),l=a.on;l!==r&&(s=(r=l).copy()).on(t,n),a.on=s}}function hF(e,t){var n=this._id;return arguments.length<2?Bs(this.node(),n).on.on(e):this.each(pF(n,e,t))}function mF(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function gF(){return this.on("end.remove",mF(this._id))}function yF(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Ew(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),p,f,d=0;d<c;++d)(p=l[d])&&(f=e.call(p,p.__data__,d,l))&&("__data__"in p&&(f.__data__=p.__data__),u[d]=f,vh(u[d],t,n,d,u,Bs(p,n)));return new Mi(i,this._parents,t,n)}function xF(e){var t=this._name,n=this._id;typeof e!="function"&&(e=H_(e));for(var r=this._groups,s=r.length,i=[],a=[],l=0;l<s;++l)for(var c=r[l],u=c.length,p,f=0;f<u;++f)if(p=c[f]){for(var d=e.call(p,p.__data__,f,c),h,y=Bs(p,n),b=0,k=d.length;b<k;++b)(h=d[b])&&vh(h,t,n,b,d,y);i.push(d),a.push(p)}return new Mi(i,a,t,n)}var wF=Qu.prototype.constructor;function bF(){return new wF(this._groups,this._parents)}function kF(e,t){var n,r,s;return function(){var i=Pl(this,e),a=(this.style.removeProperty(e),Pl(this,e));return i===a?null:i===n&&a===r?s:s=t(n=i,r=a)}}function fE(e){return function(){this.style.removeProperty(e)}}function vF(e,t,n){var r,s=n+"",i;return function(){var a=Pl(this,e);return a===s?null:a===r?i:i=t(r=a,n)}}function SF(e,t,n){var r,s,i;return function(){var a=Pl(this,e),l=n(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(e),Pl(this,e))),a===c?null:a===r&&c===s?i:(s=c,i=t(r=a,l))}}function NF(e,t){var n,r,s,i="style."+t,a="end."+i,l;return function(){var c=di(this,e),u=c.on,p=c.value[i]==null?l||(l=fE(t)):void 0;(u!==n||s!==p)&&(r=(n=u).copy()).on(a,s=p),c.on=r}}function jF(e,t,n){var r=(e+="")=="transform"?CD:dE;return t==null?this.styleTween(e,kF(e,r)).on("end.style."+e,fE(e)):typeof t=="function"?this.styleTween(e,SF(e,r,Mw(this,"style."+e,t))).each(NF(this._id,e)):this.styleTween(e,vF(e,r,t),n).on("end.style."+e,null)}function CF(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function _F(e,t,n){var r,s;function i(){var a=t.apply(this,arguments);return a!==s&&(r=(s=a)&&CF(e,a,n)),r}return i._value=t,i}function EF(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,_F(e,t,n??""))}function AF(e){return function(){this.textContent=e}}function PF(e){return function(){var t=e(this);this.textContent=t??""}}function IF(e){return this.tween("text",typeof e=="function"?PF(Mw(this,"text",e)):AF(e==null?"":e+""))}function TF(e){return function(t){this.textContent=e.call(this,t)}}function RF(e){var t,n;function r(){var s=e.apply(this,arguments);return s!==n&&(t=(n=s)&&TF(s)),t}return r._value=e,r}function MF(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,RF(e))}function $F(){for(var e=this._name,t=this._id,n=pE(),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 p=Bs(c,t);vh(c,e,n,u,a,{time:p.time+p.delay+p.duration,delay:0,duration:p.duration,ease:p.ease})}return new Mi(r,this._parents,e,n)}function LF(){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=di(this,r),p=u.on;p!==e&&(t=(e=p).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(c)),u.on=t}),s===0&&i()})}var OF=0;function Mi(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function pE(){return++OF}var xi=Qu.prototype;Mi.prototype={constructor:Mi,select:yF,selectAll:xF,selectChild:xi.selectChild,selectChildren:xi.selectChildren,filter:uF,merge:dF,selection:bF,transition:$F,call:xi.call,nodes:xi.nodes,node:xi.node,size:xi.size,empty:xi.empty,each:xi.each,on:hF,attr:YD,attrTween:ZD,style:jF,styleTween:EF,text:IF,textTween:MF,remove:gF,tween:HD,delay:nF,duration:iF,ease:aF,easeVarying:cF,end:LF,[Symbol.iterator]:xi[Symbol.iterator]};function DF(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var FF={time:null,delay:0,duration:250,ease:DF};function zF(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 HF(e){var t,n;e instanceof Mi?(t=e._id,e=e._name):(t=pE(),(n=FF).time=Tw(),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])&&vh(c,e,t,u,a,n||zF(c,t));return new Mi(r,this._parents,e,t)}Qu.prototype.interrupt=DD;Qu.prototype.transition=HF;const cf=e=>()=>e;function BF(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 ji(e,t,n){this.k=e,this.x=t,this.y=n}ji.prototype={constructor:ji,scale:function(e){return e===1?this:new ji(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ji(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 Sh=new ji(1,0,0);hE.prototype=ji.prototype;function hE(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Sh;return e.__zoom}function Gm(e){e.stopImmediatePropagation()}function Sc(e){e.preventDefault(),e.stopImmediatePropagation()}function WF(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function VF(){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 K0(){return this.__zoom||Sh}function KF(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function UF(){return navigator.maxTouchPoints||"ontouchstart"in this}function qF(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 mE(){var e=WF,t=VF,n=qF,r=KF,s=UF,i=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=qf,u=wh("start","zoom","end"),p,f,d,h=500,y=150,b=0,k=10;function g(T){T.property("__zoom",K0).on("wheel.zoom",A,{passive:!1}).on("mousedown.zoom",F).on("dblclick.zoom",V).filter(s).on("touchstart.zoom",z).on("touchmove.zoom",D).on("touchend.zoom touchcancel.zoom",R).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(T,$,M,O){var P=T.selection?T.selection():T;P.property("__zoom",K0),T!==P?C(T,$,M,O):P.interrupt().each(function(){j(this,arguments).event(O).start().zoom(null,typeof $=="function"?$.apply(this,arguments):$).end()})},g.scaleBy=function(T,$,M,O){g.scaleTo(T,function(){var P=this.__zoom.k,B=typeof $=="function"?$.apply(this,arguments):$;return P*B},M,O)},g.scaleTo=function(T,$,M,O){g.transform(T,function(){var P=t.apply(this,arguments),B=this.__zoom,E=M==null?N(P):typeof M=="function"?M.apply(this,arguments):M,q=B.invert(E),W=typeof $=="function"?$.apply(this,arguments):$;return n(x(w(B,W),E,q),P,a)},M,O)},g.translateBy=function(T,$,M,O){g.transform(T,function(){return n(this.__zoom.translate(typeof $=="function"?$.apply(this,arguments):$,typeof M=="function"?M.apply(this,arguments):M),t.apply(this,arguments),a)},null,O)},g.translateTo=function(T,$,M,O,P){g.transform(T,function(){var B=t.apply(this,arguments),E=this.__zoom,q=O==null?N(B):typeof O=="function"?O.apply(this,arguments):O;return n(Sh.translate(q[0],q[1]).scale(E.k).translate(typeof $=="function"?-$.apply(this,arguments):-$,typeof M=="function"?-M.apply(this,arguments):-M),B,a)},O,P)};function w(T,$){return $=Math.max(i[0],Math.min(i[1],$)),$===T.k?T:new ji($,T.x,T.y)}function x(T,$,M){var O=$[0]-M[0]*T.k,P=$[1]-M[1]*T.k;return O===T.x&&P===T.y?T:new ji(T.k,O,P)}function N(T){return[(+T[0][0]+ +T[1][0])/2,(+T[0][1]+ +T[1][1])/2]}function C(T,$,M,O){T.on("start.zoom",function(){j(this,arguments).event(O).start()}).on("interrupt.zoom end.zoom",function(){j(this,arguments).event(O).end()}).tween("zoom",function(){var P=this,B=arguments,E=j(P,B).event(O),q=t.apply(P,B),W=M==null?N(q):typeof M=="function"?M.apply(P,B):M,L=Math.max(q[1][0]-q[0][0],q[1][1]-q[0][1]),X=P.__zoom,se=typeof $=="function"?$.apply(P,B):$,ae=c(X.invert(W).concat(L/X.k),se.invert(W).concat(L/se.k));return function(me){if(me===1)me=se;else{var re=ae(me),de=L/re[2];me=new ji(de,W[0]-re[0]*de,W[1]-re[1]*de)}E.zoom(null,me)}})}function j(T,$,M){return!M&&T.__zooming||new _(T,$)}function _(T,$){this.that=T,this.args=$,this.active=0,this.sourceEvent=null,this.extent=t.apply(T,$),this.taps=0}_.prototype={event:function(T){return T&&(this.sourceEvent=T),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(T,$){return this.mouse&&T!=="mouse"&&(this.mouse[1]=$.invert(this.mouse[0])),this.touch0&&T!=="touch"&&(this.touch0[1]=$.invert(this.touch0[0])),this.touch1&&T!=="touch"&&(this.touch1[1]=$.invert(this.touch1[0])),this.that.__zoom=$,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(T){var $=Jr(this.that).datum();u.call(T,this.that,new BF(T,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:u}),$)}};function A(T,...$){if(!e.apply(this,arguments))return;var M=j(this,$).event(T),O=this.__zoom,P=Math.max(i[0],Math.min(i[1],O.k*Math.pow(2,r.apply(this,arguments)))),B=Ps(T);if(M.wheel)(M.mouse[0][0]!==B[0]||M.mouse[0][1]!==B[1])&&(M.mouse[1]=O.invert(M.mouse[0]=B)),clearTimeout(M.wheel);else{if(O.k===P)return;M.mouse=[B,O.invert(B)],Jf(this),M.start()}Sc(T),M.wheel=setTimeout(E,y),M.zoom("mouse",n(x(w(O,P),M.mouse[0],M.mouse[1]),M.extent,a));function E(){M.wheel=null,M.end()}}function F(T,...$){if(d||!e.apply(this,arguments))return;var M=T.currentTarget,O=j(this,$,!0).event(T),P=Jr(T.view).on("mousemove.zoom",W,!0).on("mouseup.zoom",L,!0),B=Ps(T,M),E=T.clientX,q=T.clientY;Q_(T.view),Gm(T),O.mouse=[B,this.__zoom.invert(B)],Jf(this),O.start();function W(X){if(Sc(X),!O.moved){var se=X.clientX-E,ae=X.clientY-q;O.moved=se*se+ae*ae>b}O.event(X).zoom("mouse",n(x(O.that.__zoom,O.mouse[0]=Ps(X,M),O.mouse[1]),O.extent,a))}function L(X){P.on("mousemove.zoom mouseup.zoom",null),Z_(X.view,O.moved),Sc(X),O.event(X).end()}}function V(T,...$){if(e.apply(this,arguments)){var M=this.__zoom,O=Ps(T.changedTouches?T.changedTouches[0]:T,this),P=M.invert(O),B=M.k*(T.shiftKey?.5:2),E=n(x(w(M,B),O,P),t.apply(this,$),a);Sc(T),l>0?Jr(this).transition().duration(l).call(C,E,O,T):Jr(this).call(g.transform,E,O,T)}}function z(T,...$){if(e.apply(this,arguments)){var M=T.touches,O=M.length,P=j(this,$,T.changedTouches.length===O).event(T),B,E,q,W;for(Gm(T),E=0;E<O;++E)q=M[E],W=Ps(q,this),W=[W,this.__zoom.invert(W),q.identifier],P.touch0?!P.touch1&&P.touch0[2]!==W[2]&&(P.touch1=W,P.taps=0):(P.touch0=W,B=!0,P.taps=1+!!p);p&&(p=clearTimeout(p)),B&&(P.taps<2&&(f=W[0],p=setTimeout(function(){p=null},h)),Jf(this),P.start())}}function D(T,...$){if(this.__zooming){var M=j(this,$).event(T),O=T.changedTouches,P=O.length,B,E,q,W;for(Sc(T),B=0;B<P;++B)E=O[B],q=Ps(E,this),M.touch0&&M.touch0[2]===E.identifier?M.touch0[0]=q:M.touch1&&M.touch1[2]===E.identifier&&(M.touch1[0]=q);if(E=M.that.__zoom,M.touch1){var L=M.touch0[0],X=M.touch0[1],se=M.touch1[0],ae=M.touch1[1],me=(me=se[0]-L[0])*me+(me=se[1]-L[1])*me,re=(re=ae[0]-X[0])*re+(re=ae[1]-X[1])*re;E=w(E,Math.sqrt(me/re)),q=[(L[0]+se[0])/2,(L[1]+se[1])/2],W=[(X[0]+ae[0])/2,(X[1]+ae[1])/2]}else if(M.touch0)q=M.touch0[0],W=M.touch0[1];else return;M.zoom("touch",n(x(E,q,W),M.extent,a))}}function R(T,...$){if(this.__zooming){var M=j(this,$).event(T),O=T.changedTouches,P=O.length,B,E;for(Gm(T),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),B=0;B<P;++B)E=O[B],M.touch0&&M.touch0[2]===E.identifier?delete M.touch0:M.touch1&&M.touch1[2]===E.identifier&&delete M.touch1;if(M.touch1&&!M.touch0&&(M.touch0=M.touch1,delete M.touch1),M.touch0)M.touch0[1]=this.__zoom.invert(M.touch0[0]);else if(M.end(),M.taps===2&&(E=Ps(E,this),Math.hypot(f[0]-E[0],f[1]-E[1])<k)){var q=Jr(this).on("dblclick.zoom");q&&q.apply(this,arguments)}}}return g.wheelDelta=function(T){return arguments.length?(r=typeof T=="function"?T:cf(+T),g):r},g.filter=function(T){return arguments.length?(e=typeof T=="function"?T:cf(!!T),g):e},g.touchable=function(T){return arguments.length?(s=typeof T=="function"?T:cf(!!T),g):s},g.extent=function(T){return arguments.length?(t=typeof T=="function"?T:cf([[+T[0][0],+T[0][1]],[+T[1][0],+T[1][1]]]),g):t},g.scaleExtent=function(T){return arguments.length?(i[0]=+T[0],i[1]=+T[1],g):[i[0],i[1]]},g.translateExtent=function(T){return arguments.length?(a[0][0]=+T[0][0],a[1][0]=+T[1][0],a[0][1]=+T[0][1],a[1][1]=+T[1][1],g):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},g.constrain=function(T){return arguments.length?(n=T,g):n},g.duration=function(T){return arguments.length?(l=+T,g):l},g.interpolate=function(T){return arguments.length?(c=T,g):c},g.on=function(){var T=u.on.apply(u,arguments);return T===u?g:T},g.clickDistance=function(T){return arguments.length?(b=(T=+T)*T,g):Math.sqrt(b)},g.tapDistance=function(T){return arguments.length?(k=+T,g):k},g}const li={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."},Au=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],gE=["Enter"," ","Escape"],yE={"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 Tl;(function(e){e.Strict="strict",e.Loose="loose"})(Tl||(Tl={}));var ea;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(ea||(ea={}));var Pu;(function(e){e.Partial="partial",e.Full="full"})(Pu||(Pu={}));const xE={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var so;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(so||(so={}));var ei;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(ei||(ei={}));var Le;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Le||(Le={}));const U0={[Le.Left]:Le.Right,[Le.Right]:Le.Left,[Le.Top]:Le.Bottom,[Le.Bottom]:Le.Top};function wE(e){return e===null?null:e?"valid":"invalid"}const bE=e=>"id"in e&&"source"in e&&"target"in e,YF=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),$w=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),ed=(e,t=[0,0])=>{const{width:n,height:r}=Oi(e),s=e.origin??t,i=n*s[0],a=r*s[1];return{x:e.position.x-i,y:e.position.y-a}},GF=(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):$w(s)?s:t.nodeLookup.get(s.id));const l=a?Mp(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Nh(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return jh(n)},td=(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=Nh(n,Mp(s)),r=!0)}),r?jh(n):{x:0,y:0,width:0,height:0}},Lw=(e,t,[n,r,s]=[0,0,1],i=!1,a=!1)=>{const l={...rd(t,[n,r,s]),width:t.width/s,height:t.height/s},c=[];for(const u of e.values()){const{measured:p,selectable:f=!0,hidden:d=!1}=u;if(a&&!f||d)continue;const h=p.width??u.width??u.initialWidth??null,y=p.height??u.height??u.initialHeight??null,b=Iu(l,Ml(u)),k=(h??0)*(y??0),g=i&&b>0;(!u.internals.handleBounds||g||b>=k||u.dragging)&&c.push(u)}return c},JF=(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 XF(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 QF({nodes:e,width:t,height:n,panZoom:r,minZoom:s,maxZoom:i},a){if(e.size===0)return Promise.resolve(!0);const l=XF(e,a),c=td(l),u=Ow(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 kE({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},p=a.origin??r;let f=a.extent||s;if(a.extent==="parent"&&!a.expandParent)if(!l)i==null||i("005",li.error005());else{const h=l.measured.width,y=l.measured.height;h&&y&&(f=[[c,u],[c+h,u+y]])}else l&&$l(a.extent)&&(f=[[a.extent[0][0]+c,a.extent[0][1]+u],[a.extent[1][0]+c,a.extent[1][1]+u]]);const d=$l(f)?da(t,f,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(i==null||i("015",li.error015())),{position:{x:d.x-c+(a.measured.width??0)*p[0],y:d.y-u+(a.measured.height??0)*p[1]},positionAbsolute:d}}async function ZF({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:s}){const i=new Set(e.map(d=>d.id)),a=[];for(const d of n){if(d.deletable===!1)continue;const h=i.has(d.id),y=!h&&d.parentId&&a.find(b=>b.id===d.parentId);(h||y)&&a.push(d)}const l=new Set(t.map(d=>d.id)),c=r.filter(d=>d.deletable!==!1),p=JF(a,c);for(const d of c)l.has(d.id)&&!p.find(y=>y.id===d.id)&&p.push(d);if(!s)return{edges:p,nodes:a};const f=await s({nodes:a,edges:p});return typeof f=="boolean"?f?{edges:p,nodes:a}:{edges:[],nodes:[]}:f}const Rl=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),da=(e={x:0,y:0},t,n)=>({x:Rl(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Rl(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function vE(e,t,n){const{width:r,height:s}=Oi(n),{x:i,y:a}=n.internals.positionAbsolute;return da(e,[[i,a],[i+r,a+s]],t)}const q0=(e,t,n)=>e<t?Rl(Math.abs(e-t),1,t)/t:e>n?-Rl(Math.abs(e-n),1,t)/t:0,SE=(e,t,n=15,r=40)=>{const s=q0(e.x,r,t.width-r)*n,i=q0(e.y,r,t.height-r)*n;return[s,i]},Nh=(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)}),Uy=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),jh=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Ml=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=$w(e)?e.internals.positionAbsolute:ed(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}},Mp=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=$w(e)?e.internals.positionAbsolute:ed(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)}},NE=(e,t)=>jh(Nh(Uy(e),Uy(t))),Iu=(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)},Y0=e=>Ms(e.width)&&Ms(e.height)&&Ms(e.x)&&Ms(e.y),Ms=e=>!isNaN(e)&&isFinite(e),ez=(e,t)=>{},nd=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),rd=({x:e,y:t},[n,r,s],i=!1,a=[1,1])=>{const l={x:(e-n)/s,y:(t-r)/s};return i?nd(l,a):l},$p=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r});function Fa(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 tz(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Fa(e,n),s=Fa(e,t);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof e=="object"){const r=Fa(e.top??e.y??0,n),s=Fa(e.bottom??e.y??0,n),i=Fa(e.left??e.x??0,t),a=Fa(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 nz(e,t,n,r,s,i){const{x:a,y:l}=$p(e,[t,n,r]),{x:c,y:u}=$p({x:e.x+e.width,y:e.y+e.height},[t,n,r]),p=s-c,f=i-u;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(p),bottom:Math.floor(f)}}const Ow=(e,t,n,r,s,i)=>{const a=tz(i,t,n),l=(t-a.x)/e.width,c=(n-a.y)/e.height,u=Math.min(l,c),p=Rl(u,r,s),f=e.x+e.width/2,d=e.y+e.height/2,h=t/2-f*p,y=n/2-d*p,b=nz(e,h,y,p,t,n),k={left:Math.min(b.left-a.left,0),top:Math.min(b.top-a.top,0),right:Math.min(b.right-a.right,0),bottom:Math.min(b.bottom-a.bottom,0)};return{x:h-k.left+k.right,y:y-k.top+k.bottom,zoom:p}},Tu=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function $l(e){return e!=null&&e!=="parent"}function Oi(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 jE(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 CE(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 G0(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function rz(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}function sz(e){return{...yE,...e||{}}}function Zc(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:i,y:a}=$s(e),l=rd({x:i-((s==null?void 0:s.left)??0),y:a-((s==null?void 0:s.top)??0)},r),{x:c,y:u}=n?nd(l,t):l;return{xSnapped:c,ySnapped:u,...l}}const Dw=e=>({width:e.offsetWidth,height:e.offsetHeight}),_E=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},iz=["INPUT","SELECT","TEXTAREA"];function EE(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:iz.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const AE=e=>"clientX"in e,$s=(e,t)=>{var i,a;const n=AE(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)}},J0=(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,...Dw(a)}})};function PE({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,p=Math.abs(c-e),f=Math.abs(u-t);return[c,u,p,f]}function uf(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function X0({pos:e,x1:t,y1:n,x2:r,y2:s,c:i}){switch(e){case Le.Left:return[t-uf(t-r,i),n];case Le.Right:return[t+uf(r-t,i),n];case Le.Top:return[t,n-uf(n-s,i)];case Le.Bottom:return[t,n+uf(s-n,i)]}}function IE({sourceX:e,sourceY:t,sourcePosition:n=Le.Bottom,targetX:r,targetY:s,targetPosition:i=Le.Top,curvature:a=.25}){const[l,c]=X0({pos:n,x1:e,y1:t,x2:r,y2:s,c:a}),[u,p]=X0({pos:i,x1:r,y1:s,x2:e,y2:t,c:a}),[f,d,h,y]=PE({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:p});return[`M${e},${t} C${l},${c} ${u},${p} ${r},${s}`,f,d,h,y]}function TE({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 oz({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 az({sourceNode:e,targetNode:t,width:n,height:r,transform:s}){const i=Nh(Mp(e),Mp(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 Iu(a,jh(i))>0}const lz=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,cz=(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)),Xf=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||lz;let s;return bE(e)?s={...e}:s={...e,id:r(e)},cz(s,t)?t:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,t.concat(s))};function RE({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,i,a,l]=TE({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,i,a,l]}const Q0={[Le.Left]:{x:-1,y:0},[Le.Right]:{x:1,y:0},[Le.Top]:{x:0,y:-1},[Le.Bottom]:{x:0,y:1}},uz=({source:e,sourcePosition:t=Le.Bottom,target:n})=>t===Le.Left||t===Le.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},Z0=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function dz({source:e,sourcePosition:t=Le.Bottom,target:n,targetPosition:r=Le.Top,center:s,offset:i,stepPosition:a}){const l=Q0[t],c=Q0[r],u={x:e.x+l.x*i,y:e.y+l.y*i},p={x:n.x+c.x*i,y:n.y+c.y*i},f=uz({source:u,sourcePosition:t,target:p}),d=f.x!==0?"x":"y",h=f[d];let y=[],b,k;const g={x:0,y:0},w={x:0,y:0},[,,x,N]=TE({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[d]*c[d]===-1){d==="x"?(b=s.x??u.x+(p.x-u.x)*a,k=s.y??(u.y+p.y)/2):(b=s.x??(u.x+p.x)/2,k=s.y??u.y+(p.y-u.y)*a);const A=[{x:b,y:u.y},{x:b,y:p.y}],F=[{x:u.x,y:k},{x:p.x,y:k}];l[d]===h?y=d==="x"?A:F:y=d==="x"?F:A}else{const A=[{x:u.x,y:p.y}],F=[{x:p.x,y:u.y}];if(d==="x"?y=l.x===h?F:A:y=l.y===h?A:F,t===r){const T=Math.abs(e[d]-n[d]);if(T<=i){const $=Math.min(i-1,i-T);l[d]===h?g[d]=(u[d]>e[d]?-1:1)*$:w[d]=(p[d]>n[d]?-1:1)*$}}if(t!==r){const T=d==="x"?"y":"x",$=l[d]===c[T],M=u[T]>p[T],O=u[T]<p[T];(l[d]===1&&(!$&&M||$&&O)||l[d]!==1&&(!$&&O||$&&M))&&(y=d==="x"?A:F)}const V={x:u.x+g.x,y:u.y+g.y},z={x:p.x+w.x,y:p.y+w.y},D=Math.max(Math.abs(V.x-y[0].x),Math.abs(z.x-y[0].x)),R=Math.max(Math.abs(V.y-y[0].y),Math.abs(z.y-y[0].y));D>=R?(b=(V.x+z.x)/2,k=y[0].y):(b=y[0].x,k=(V.y+z.y)/2)}const C={x:u.x+g.x,y:u.y+g.y},j={x:p.x+w.x,y:p.y+w.y};return[[e,...C.x!==y[0].x||C.y!==y[0].y?[C]:[],...y,...j.x!==y[y.length-1].x||j.y!==y[y.length-1].y?[j]:[],n],b,k,x,N]}function fz(e,t,n,r){const s=Math.min(Z0(e,t)/2,Z0(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,p=e.y<n.y?1:-1;return`L ${i+s*u},${a}Q ${i},${a} ${i},${a+s*p}`}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 qy({sourceX:e,sourceY:t,sourcePosition:n=Le.Bottom,targetX:r,targetY:s,targetPosition:i=Le.Top,borderRadius:a=5,centerX:l,centerY:c,offset:u=20,stepPosition:p=.5}){const[f,d,h,y,b]=dz({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:s},targetPosition:i,center:{x:l,y:c},offset:u,stepPosition:p});let k=`M${f[0].x} ${f[0].y}`;for(let g=1;g<f.length-1;g++)k+=fz(f[g-1],f[g],f[g+1],a);return k+=`L${f[f.length-1].x} ${f[f.length-1].y}`,[k,d,h,y,b]}function eS(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function pz(e){var f;const{sourceNode:t,targetNode:n}=e;if(!eS(t)||!eS(n))return null;const r=t.internals.handleBounds||tS(t.handles),s=n.internals.handleBounds||tS(n.handles),i=nS((r==null?void 0:r.source)??[],e.sourceHandle),a=nS(e.connectionMode===Tl.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(f=e.onError)==null||f.call(e,"008",li.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=(i==null?void 0:i.position)||Le.Bottom,c=(a==null?void 0:a.position)||Le.Top,u=fa(t,i,l),p=fa(n,a,c);return{sourceX:u.x,sourceY:u.y,targetX:p.x,targetY:p.y,sourcePosition:l,targetPosition:c}}function tS(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 fa(e,t,n=Le.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??Oi(e);if(r)return{x:s+a/2,y:i+l/2};switch((t==null?void 0:t.position)??n){case Le.Top:return{x:s+a/2,y:i};case Le.Right:return{x:s+a,y:i+l/2};case Le.Bottom:return{x:s+a/2,y:i+l};case Le.Left:return{x:s,y:i+l/2}}}function nS(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Yy(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function hz(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=Yy(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 ME=1e3,mz=10,Fw={nodeOrigin:[0,0],nodeExtent:Au,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},gz={...Fw,checkEquality:!0};function zw(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function yz(e,t,n){const r=zw(Fw,n);for(const s of e.values())if(s.parentId)Bw(s,e,t,r);else{const i=ed(s,r.nodeOrigin),a=$l(s.extent)?s.extent:r.nodeExtent,l=da(i,a,Oi(s));s.internals.positionAbsolute=l}}function xz(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 Hw(e){return e==="manual"}function Gy(e,t,n,r={}){var p,f;const s=zw(gz,r),i={i:0},a=new Map(t),l=s!=null&&s.elevateNodesOnSelect&&!Hw(s.zIndexMode)?ME:0;let c=e.length>0,u=!1;t.clear(),n.clear();for(const d of e){let h=a.get(d.id);if(s.checkEquality&&d===(h==null?void 0:h.internals.userNode))t.set(d.id,h);else{const y=ed(d,s.nodeOrigin),b=$l(d.extent)?d.extent:s.nodeExtent,k=da(y,b,Oi(d));h={...s.defaults,...d,measured:{width:(p=d.measured)==null?void 0:p.width,height:(f=d.measured)==null?void 0:f.height},internals:{positionAbsolute:k,handleBounds:xz(d,h),z:$E(d,l,s.zIndexMode),userNode:d}},t.set(d.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),d.parentId&&Bw(h,t,n,r,i),u||(u=d.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function wz(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 Bw(e,t,n,r,s){const{elevateNodesOnSelect:i,nodeOrigin:a,nodeExtent:l,zIndexMode:c}=zw(Fw,r),u=e.parentId,p=t.get(u);if(!p){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}wz(e,n),s&&!p.parentId&&p.internals.rootParentIndex===void 0&&c==="auto"&&(p.internals.rootParentIndex=++s.i,p.internals.z=p.internals.z+s.i*mz),s&&p.internals.rootParentIndex!==void 0&&(s.i=p.internals.rootParentIndex);const f=i&&!Hw(c)?ME:0,{x:d,y:h,z:y}=bz(e,p,a,l,f,c),{positionAbsolute:b}=e.internals,k=d!==b.x||h!==b.y;(k||y!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:k?{x:d,y:h}:b,z:y}})}function $E(e,t,n){const r=Ms(e.zIndex)?e.zIndex:0;return Hw(n)?r:r+(e.selected?t:0)}function bz(e,t,n,r,s,i){const{x:a,y:l}=t.internals.positionAbsolute,c=Oi(e),u=ed(e,n),p=$l(e.extent)?da(u,e.extent,c):u;let f=da({x:a+p.x,y:l+p.y},r,c);e.extent==="parent"&&(f=vE(f,c,t));const d=$E(e,s,i),h=t.internals.z??0;return{x:f.x,y:f.y,z:h>=d?h+1:d}}function Ww(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)??Ml(c),p=NE(u,l.rect);i.set(l.parentId,{expandedRect:p,parent:c})}return i.size>0&&i.forEach(({expandedRect:l,parent:c},u)=>{var x;const p=c.internals.positionAbsolute,f=Oi(c),d=c.origin??r,h=l.x<p.x?Math.round(Math.abs(p.x-l.x)):0,y=l.y<p.y?Math.round(Math.abs(p.y-l.y)):0,b=Math.max(f.width,Math.round(l.width)),k=Math.max(f.height,Math.round(l.height)),g=(b-f.width)*d[0],w=(k-f.height)*d[1];(h>0||y>0||g||w)&&(s.push({id:u,type:"position",position:{x:c.position.x-h+g,y:c.position.y-y+w}}),(x=n.get(u))==null||x.forEach(N=>{e.some(C=>C.id===N.id)||s.push({id:N.id,type:"position",position:{x:N.position.x+h,y:N.position.y+y}})})),(f.width<l.width||f.height<l.height||h||y)&&s.push({id:u,type:"dimensions",setAttributes:!0,dimensions:{width:b+(h?d[0]*h-g:0),height:k+(y?d[1]*y-w:0)}})}),s}function kz(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=[],p=window.getComputedStyle(l),{m22:f}=new window.DOMMatrixReadOnly(p.transform),d=[];for(const h of e.values()){const y=t.get(h.id);if(!y)continue;if(y.hidden){t.set(y.id,{...y,internals:{...y.internals,handleBounds:void 0}}),c=!0;continue}const b=Dw(h.nodeElement),k=y.measured.width!==b.width||y.measured.height!==b.height;if(!!(b.width&&b.height&&(k||!y.internals.handleBounds||h.force))){const w=h.nodeElement.getBoundingClientRect(),x=$l(y.extent)?y.extent:i;let{positionAbsolute:N}=y.internals;y.parentId&&y.extent==="parent"?N=vE(N,b,t.get(y.parentId)):x&&(N=da(N,x,b));const C={...y,measured:b,internals:{...y.internals,positionAbsolute:N,handleBounds:{source:J0("source",h.nodeElement,w,f,y.id),target:J0("target",h.nodeElement,w,f,y.id)}}};t.set(y.id,C),y.parentId&&Bw(C,t,n,{nodeOrigin:s,zIndexMode:a}),c=!0,k&&(u.push({id:y.id,type:"dimensions",dimensions:b}),y.expandParent&&y.parentId&&d.push({id:y.id,parentId:y.parentId,rect:Ml(C,s)}))}}if(d.length>0){const h=Ww(d,t,n,s);u.push(...h)}return{changes:u,updatedInternals:c}}async function vz({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 rS(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 LE(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}`,p=`${i}-${l}--${s}-${a}`;rS("source",c,p,e,s,a),rS("target",c,u,e,i,l),t.set(r.id,r)}}function OE(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:OE(n,t):!1}function sS(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 Sz(e,t,n,r){const s=new Map;for(const[i,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!OE(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 Jm({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var a,l,c;const s=[];for(const[u,p]of t){const f=(a=n.get(u))==null?void 0:a.internals.userNode;f&&s.push({...f,position:p.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 Nz({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=nd(i,t);return{x:a.x-i.x,y:a.y-i.y}}function jz({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},p=null,f=!1,d=null,h=!1,y=!1,b=null;function k({noDragClassName:w,handleSelector:x,domNode:N,isSelectable:C,nodeId:j,nodeClickDistance:_=0}){d=Jr(N);function A({x:D,y:R}){const{nodeLookup:T,nodeExtent:$,snapGrid:M,snapToGrid:O,nodeOrigin:P,onNodeDrag:B,onSelectionDrag:E,onError:q,updateNodePositions:W}=t();i={x:D,y:R};let L=!1;const X=l.size>1,se=X&&$?Uy(td(l)):null,ae=X&&O?Nz({dragItems:l,snapGrid:M,x:D,y:R}):null;for(const[me,re]of l){if(!T.has(me))continue;let de={x:D-re.distance.x,y:R-re.distance.y};O&&(de=ae?{x:Math.round(de.x+ae.x),y:Math.round(de.y+ae.y)}:nd(de,M));let ne=null;if(X&&$&&!re.extent&&se){const{positionAbsolute:ve}=re.internals,$e=ve.x-se.x+$[0][0],We=ve.x+re.measured.width-se.x2+$[1][0],Pe=ve.y-se.y+$[0][1],Ue=ve.y+re.measured.height-se.y2+$[1][1];ne=[[$e,Pe],[We,Ue]]}const{position:ue,positionAbsolute:fe}=kE({nodeId:me,nextPosition:de,nodeLookup:T,nodeExtent:ne||$,nodeOrigin:P,onError:q});L=L||re.position.x!==ue.x||re.position.y!==ue.y,re.position=ue,re.internals.positionAbsolute=fe}if(y=y||L,!!L&&(W(l,!0),b&&(r||B||!j&&E))){const[me,re]=Jm({nodeId:j,dragItems:l,nodeLookup:T});r==null||r(b,l,me,re),B==null||B(b,me,re),j||E==null||E(b,re)}}async function F(){if(!p)return;const{transform:D,panBy:R,autoPanSpeed:T,autoPanOnNodeDrag:$}=t();if(!$){c=!1,cancelAnimationFrame(a);return}const[M,O]=SE(u,p,T);(M!==0||O!==0)&&(i.x=(i.x??0)-M/D[2],i.y=(i.y??0)-O/D[2],await R({x:M,y:O})&&A(i)),a=requestAnimationFrame(F)}function V(D){var X;const{nodeLookup:R,multiSelectionActive:T,nodesDraggable:$,transform:M,snapGrid:O,snapToGrid:P,selectNodesOnDrag:B,onNodeDragStart:E,onSelectionDragStart:q,unselectNodesAndEdges:W}=t();f=!0,(!B||!C)&&!T&&j&&((X=R.get(j))!=null&&X.selected||W()),C&&B&&j&&(e==null||e(j));const L=Zc(D.sourceEvent,{transform:M,snapGrid:O,snapToGrid:P,containerBounds:p});if(i=L,l=Sz(R,$,L,j),l.size>0&&(n||E||!j&&q)){const[se,ae]=Jm({nodeId:j,dragItems:l,nodeLookup:R});n==null||n(D.sourceEvent,l,se,ae),E==null||E(D.sourceEvent,se,ae),j||q==null||q(D.sourceEvent,ae)}}const z=eE().clickDistance(_).on("start",D=>{const{domNode:R,nodeDragThreshold:T,transform:$,snapGrid:M,snapToGrid:O}=t();p=(R==null?void 0:R.getBoundingClientRect())||null,h=!1,y=!1,b=D.sourceEvent,T===0&&V(D),i=Zc(D.sourceEvent,{transform:$,snapGrid:M,snapToGrid:O,containerBounds:p}),u=$s(D.sourceEvent,p)}).on("drag",D=>{const{autoPanOnNodeDrag:R,transform:T,snapGrid:$,snapToGrid:M,nodeDragThreshold:O,nodeLookup:P}=t(),B=Zc(D.sourceEvent,{transform:T,snapGrid:$,snapToGrid:M,containerBounds:p});if(b=D.sourceEvent,(D.sourceEvent.type==="touchmove"&&D.sourceEvent.touches.length>1||j&&!P.has(j))&&(h=!0),!h){if(!c&&R&&f&&(c=!0,F()),!f){const E=$s(D.sourceEvent,p),q=E.x-u.x,W=E.y-u.y;Math.sqrt(q*q+W*W)>O&&V(D)}(i.x!==B.xSnapped||i.y!==B.ySnapped)&&l&&f&&(u=$s(D.sourceEvent,p),A(B))}}).on("end",D=>{if(!(!f||h)&&(c=!1,f=!1,cancelAnimationFrame(a),l.size>0)){const{nodeLookup:R,updateNodePositions:T,onNodeDragStop:$,onSelectionDragStop:M}=t();if(y&&(T(l,!1),y=!1),s||$||!j&&M){const[O,P]=Jm({nodeId:j,dragItems:l,nodeLookup:R,dragging:!1});s==null||s(D.sourceEvent,l,O,P),$==null||$(D.sourceEvent,O,P),j||M==null||M(D.sourceEvent,P)}}}).filter(D=>{const R=D.target;return!D.button&&(!w||!sS(R,`.${w}`,N))&&(!x||sS(R,x,N))});d.call(z)}function g(){d==null||d.on(".drag",null)}return{update:k,destroy:g}}function Cz(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())Iu(s,Ml(i))>0&&r.push(i);return r}const _z=250;function Ez(e,t,n,r){var l,c;let s=[],i=1/0;const a=Cz(e,n,t+_z);for(const u of a){const p=[...((l=u.internals.handleBounds)==null?void 0:l.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const f of p){if(r.nodeId===f.nodeId&&r.type===f.type&&r.id===f.id)continue;const{x:d,y:h}=fa(u,f,f.position,!0),y=Math.sqrt(Math.pow(d-e.x,2)+Math.pow(h-e.y,2));y>t||(y<i?(s=[{...f,x:d,y:h}],i=y):y===i&&s.push({...f,x:d,y:h}))}}if(!s.length)return null;if(s.length>1){const u=r.type==="source"?"target":"source";return s.find(p=>p.type===u)??s[0]}return s[0]}function DE(e,t,n,r,s,i=!1){var u,p,f;const a=r.get(e);if(!a)return null;const l=s==="strict"?(u=a.internals.handleBounds)==null?void 0:u[t]:[...((p=a.internals.handleBounds)==null?void 0:p.source)??[],...((f=a.internals.handleBounds)==null?void 0:f.target)??[]],c=(n?l==null?void 0:l.find(d=>d.id===n):l==null?void 0:l[0])??null;return c&&i?{...c,...fa(a,c,c.position,!0)}:c}function FE(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Az(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const zE=()=>!0;function Pz(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:s,edgeUpdaterType:i,isTarget:a,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:p,flowId:f,panBy:d,cancelConnection:h,onConnectStart:y,onConnect:b,onConnectEnd:k,isValidConnection:g=zE,onReconnectEnd:w,updateConnection:x,getTransform:N,getFromHandle:C,autoPanSpeed:j,dragThreshold:_=1,handleDomNode:A}){const F=_E(e.target);let V=0,z;const{x:D,y:R}=$s(e),T=FE(i,A),$=l==null?void 0:l.getBoundingClientRect();let M=!1;if(!$||!T)return;const O=DE(s,T,r,c,t);if(!O)return;let P=$s(e,$),B=!1,E=null,q=!1,W=null;function L(){if(!p||!$)return;const[ue,fe]=SE(P,$,j);d({x:ue,y:fe}),V=requestAnimationFrame(L)}const X={...O,nodeId:s,type:T,position:O.position},se=c.get(s);let me={inProgress:!0,isValid:null,from:fa(se,X,Le.Left,!0),fromHandle:X,fromPosition:X.position,fromNode:se,to:P,toHandle:null,toPosition:U0[X.position],toNode:null,pointer:P};function re(){M=!0,x(me),y==null||y(e,{nodeId:s,handleId:r,handleType:T})}_===0&&re();function de(ue){if(!M){const{x:Ue,y:pt}=$s(ue),Te=Ue-D,et=pt-R;if(!(Te*Te+et*et>_*_))return;re()}if(!C()||!X){ne(ue);return}const fe=N();P=$s(ue,$),z=Ez(rd(P,fe,!1,[1,1]),n,c,X),B||(L(),B=!0);const ve=HE(ue,{handle:z,connectionMode:t,fromNodeId:s,fromHandleId:r,fromType:a?"target":"source",isValidConnection:g,doc:F,lib:u,flowId:f,nodeLookup:c});W=ve.handleDomNode,E=ve.connection,q=Az(!!z,ve.isValid);const $e=c.get(s),We=$e?fa($e,X,Le.Left,!0):me.from,Pe={...me,from:We,isValid:q,to:ve.toHandle&&q?$p({x:ve.toHandle.x,y:ve.toHandle.y},fe):P,toHandle:ve.toHandle,toPosition:q&&ve.toHandle?ve.toHandle.position:U0[X.position],toNode:ve.toHandle?c.get(ve.toHandle.nodeId):null,pointer:P};x(Pe),me=Pe}function ne(ue){if(!("touches"in ue&&ue.touches.length>0)){if(M){(z||W)&&E&&q&&(b==null||b(E));const{inProgress:fe,...ve}=me,$e={...ve,toPosition:me.toHandle?me.toPosition:null};k==null||k(ue,$e),i&&(w==null||w(ue,$e))}h(),cancelAnimationFrame(V),B=!1,q=!1,E=null,W=null,F.removeEventListener("mousemove",de),F.removeEventListener("mouseup",ne),F.removeEventListener("touchmove",de),F.removeEventListener("touchend",ne)}}F.addEventListener("mousemove",de),F.addEventListener("mouseup",ne),F.addEventListener("touchmove",de),F.addEventListener("touchend",ne)}function HE(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:i,doc:a,lib:l,flowId:c,isValidConnection:u=zE,nodeLookup:p}){const f=i==="target",d=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}=$s(e),b=a.elementFromPoint(h,y),k=b!=null&&b.classList.contains(`${l}-flow__handle`)?b:d,g={handleDomNode:k,isValid:!1,connection:null,toHandle:null};if(k){const w=FE(void 0,k),x=k.getAttribute("data-nodeid"),N=k.getAttribute("data-handleid"),C=k.classList.contains("connectable"),j=k.classList.contains("connectableend");if(!x||!w)return g;const _={source:f?x:r,sourceHandle:f?N:s,target:f?r:x,targetHandle:f?s:N};g.connection=_;const F=C&&j&&(n===Tl.Strict?f&&w==="source"||!f&&w==="target":x!==r||N!==s);g.isValid=F&&u(_),g.toHandle=DE(x,w,N,p,n,!0)}return g}const Jy={onPointerDown:Pz,isValid:HE};function Iz({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const s=Jr(e);function i({translateExtent:l,width:c,height:u,zoomStep:p=1,pannable:f=!0,zoomable:d=!0,inversePan:h=!1}){const y=x=>{if(x.sourceEvent.type!=="wheel"||!t)return;const N=n(),C=x.sourceEvent.ctrlKey&&Tu()?10:1,j=-x.sourceEvent.deltaY*(x.sourceEvent.deltaMode===1?.05:x.sourceEvent.deltaMode?1:.002)*p,_=N[2]*Math.pow(2,j*C);t.scaleTo(_)};let b=[0,0];const k=x=>{(x.sourceEvent.type==="mousedown"||x.sourceEvent.type==="touchstart")&&(b=[x.sourceEvent.clientX??x.sourceEvent.touches[0].clientX,x.sourceEvent.clientY??x.sourceEvent.touches[0].clientY])},g=x=>{const N=n();if(x.sourceEvent.type!=="mousemove"&&x.sourceEvent.type!=="touchmove"||!t)return;const C=[x.sourceEvent.clientX??x.sourceEvent.touches[0].clientX,x.sourceEvent.clientY??x.sourceEvent.touches[0].clientY],j=[C[0]-b[0],C[1]-b[1]];b=C;const _=r()*Math.max(N[2],Math.log(N[2]))*(h?-1:1),A={x:N[0]-j[0]*_,y:N[1]-j[1]*_},F=[[0,0],[c,u]];t.setViewportConstrained({x:A.x,y:A.y,zoom:N[2]},F,l)},w=mE().on("start",k).on("zoom",f?g:null).on("zoom.wheel",d?y:null);s.call(w,{})}function a(){s.on("zoom",null)}return{update:i,destroy:a,pointer:Ps}}const Ch=e=>({x:e.x,y:e.y,zoom:e.k}),Xm=({x:e,y:t,zoom:n})=>Sh.translate(e,t).scale(n),ol=(e,t)=>e.target.closest(`.${t}`),BE=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Tz=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Qm=(e,t=0,n=Tz,r=()=>{})=>{const s=typeof t=="number"&&t>0;return s||r(),s?e.transition().duration(t).ease(n).on("end",r):e},WE=e=>{const t=e.ctrlKey&&Tu()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Rz({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:i,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return p=>{if(ol(p,t))return p.ctrlKey&&p.preventDefault(),!1;p.preventDefault(),p.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(p.ctrlKey&&a){const k=Ps(p),g=WE(p),w=f*Math.pow(2,g);r.scaleTo(n,w,k,p);return}const d=p.deltaMode===1?20:1;let h=s===ea.Vertical?0:p.deltaX*d,y=s===ea.Horizontal?0:p.deltaY*d;!Tu()&&p.shiftKey&&s!==ea.Vertical&&(h=p.deltaY*d,y=0),r.translateBy(n,-(h/f)*i,-(y/f)*i,{internal:!0});const b=Ch(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(p,b),e.panScrollTimeout=setTimeout(()=>{u==null||u(p,b),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(p,b))}}function Mz({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,s){const i=r.type==="wheel",a=!t&&i&&!r.ctrlKey,l=ol(r,e);if(r.ctrlKey&&i&&l&&r.preventDefault(),a||l)return null;r.preventDefault(),n.call(this,r,s)}}function $z({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,a,l;if((i=r.sourceEvent)!=null&&i.internal)return;const s=Ch(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 Lz({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return i=>{var a,l;e.usedRightMouseButton=!!(n&&BE(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,Ch(i.transform)))}}function Oz({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&&BE(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&i(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),s)){const c=Ch(a.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(a.sourceEvent,c)},n?150:0)}}}function Dz({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:i,userSelectionActive:a,noWheelClassName:l,noPanClassName:c,lib:u,connectionInProgress:p}){return f=>{var k;const d=e||t,h=n&&f.ctrlKey,y=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(ol(f,`${u}-flow__node`)||ol(f,`${u}-flow__edge`)))return!0;if(!r&&!d&&!s&&!i&&!n||a||p&&!y||ol(f,l)&&y||ol(f,c)&&(!y||s&&y&&!e)||!n&&f.ctrlKey&&y)return!1;if(!n&&f.type==="touchstart"&&((k=f.touches)==null?void 0:k.length)>1)return f.preventDefault(),!1;if(!d&&!s&&!h&&y||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const b=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||y)&&b}}function Fz({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},p=e.getBoundingClientRect(),f=mE().scaleExtent([t,n]).translateExtent(r),d=Jr(e).call(f);w({x:s.x,y:s.y,zoom:Rl(s.zoom,t,n)},[[0,0],[p.width,p.height]],r);const h=d.on("wheel.zoom"),y=d.on("dblclick.zoom");f.wheelDelta(WE);function b(z,D){return d?new Promise(R=>{f==null||f.interpolate((D==null?void 0:D.interpolate)==="linear"?Qc:qf).transform(Qm(d,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>R(!0)),z)}):Promise.resolve(!1)}function k({noWheelClassName:z,noPanClassName:D,onPaneContextMenu:R,userSelectionActive:T,panOnScroll:$,panOnDrag:M,panOnScrollMode:O,panOnScrollSpeed:P,preventScrolling:B,zoomOnPinch:E,zoomOnScroll:q,zoomOnDoubleClick:W,zoomActivationKeyPressed:L,lib:X,onTransformChange:se,connectionInProgress:ae,paneClickDistance:me,selectionOnDrag:re}){T&&!u.isZoomingOrPanning&&g();const de=$&&!L&&!T;f.clickDistance(re?1/0:!Ms(me)||me<0?0:me);const ne=de?Rz({zoomPanValues:u,noWheelClassName:z,d3Selection:d,d3Zoom:f,panOnScrollMode:O,panOnScrollSpeed:P,zoomOnPinch:E,onPanZoomStart:a,onPanZoom:i,onPanZoomEnd:l}):Mz({noWheelClassName:z,preventScrolling:B,d3ZoomHandler:h});if(d.on("wheel.zoom",ne,{passive:!1}),!T){const fe=$z({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});f.on("start",fe);const ve=Lz({zoomPanValues:u,panOnDrag:M,onPaneContextMenu:!!R,onPanZoom:i,onTransformChange:se});f.on("zoom",ve);const $e=Oz({zoomPanValues:u,panOnDrag:M,panOnScroll:$,onPaneContextMenu:R,onPanZoomEnd:l,onDraggingChange:c});f.on("end",$e)}const ue=Dz({zoomActivationKeyPressed:L,panOnDrag:M,zoomOnScroll:q,panOnScroll:$,zoomOnDoubleClick:W,zoomOnPinch:E,userSelectionActive:T,noPanClassName:D,noWheelClassName:z,lib:X,connectionInProgress:ae});f.filter(ue),W?d.on("dblclick.zoom",y):d.on("dblclick.zoom",null)}function g(){f.on("zoom",null)}async function w(z,D,R){const T=Xm(z),$=f==null?void 0:f.constrain()(T,D,R);return $&&await b($),new Promise(M=>M($))}async function x(z,D){const R=Xm(z);return await b(R,D),new Promise(T=>T(R))}function N(z){if(d){const D=Xm(z),R=d.property("__zoom");(R.k!==z.zoom||R.x!==z.x||R.y!==z.y)&&(f==null||f.transform(d,D,null,{sync:!0}))}}function C(){const z=d?hE(d.node()):{x:0,y:0,k:1};return{x:z.x,y:z.y,zoom:z.k}}function j(z,D){return d?new Promise(R=>{f==null||f.interpolate((D==null?void 0:D.interpolate)==="linear"?Qc:qf).scaleTo(Qm(d,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>R(!0)),z)}):Promise.resolve(!1)}function _(z,D){return d?new Promise(R=>{f==null||f.interpolate((D==null?void 0:D.interpolate)==="linear"?Qc:qf).scaleBy(Qm(d,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>R(!0)),z)}):Promise.resolve(!1)}function A(z){f==null||f.scaleExtent(z)}function F(z){f==null||f.translateExtent(z)}function V(z){const D=!Ms(z)||z<0?0:z;f==null||f.clickDistance(D)}return{update:k,destroy:g,setViewport:x,setViewportConstrained:w,getViewport:C,scaleTo:j,scaleBy:_,setScaleExtent:A,setTranslateExtent:F,syncViewport:N,setClickDistance:V}}var Ll;(function(e){e.Line="line",e.Handle="handle"})(Ll||(Ll={}));function zz({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 iS(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 Ji(e,t){return Math.max(0,t-e)}function Xi(e,t){return Math.max(0,e-t)}function df(e,t,n){return Math.max(0,t-e,e-n)}function oS(e,t){return e?!t:t}function Hz(e,t,n,r,s,i,a,l){let{affectsX:c,affectsY:u}=t;const{isHorizontal:p,isVertical:f}=t,d=p&&f,{xSnapped:h,ySnapped:y}=n,{minWidth:b,maxWidth:k,minHeight:g,maxHeight:w}=r,{x,y:N,width:C,height:j,aspectRatio:_}=e;let A=Math.floor(p?h-e.pointerX:0),F=Math.floor(f?y-e.pointerY:0);const V=C+(c?-A:A),z=j+(u?-F:F),D=-i[0]*C,R=-i[1]*j;let T=df(V,b,k),$=df(z,g,w);if(a){let P=0,B=0;c&&A<0?P=Ji(x+A+D,a[0][0]):!c&&A>0&&(P=Xi(x+V+D,a[1][0])),u&&F<0?B=Ji(N+F+R,a[0][1]):!u&&F>0&&(B=Xi(N+z+R,a[1][1])),T=Math.max(T,P),$=Math.max($,B)}if(l){let P=0,B=0;c&&A>0?P=Xi(x+A,l[0][0]):!c&&A<0&&(P=Ji(x+V,l[1][0])),u&&F>0?B=Xi(N+F,l[0][1]):!u&&F<0&&(B=Ji(N+z,l[1][1])),T=Math.max(T,P),$=Math.max($,B)}if(s){if(p){const P=df(V/_,g,w)*_;if(T=Math.max(T,P),a){let B=0;!c&&!u||c&&!u&&d?B=Xi(N+R+V/_,a[1][1])*_:B=Ji(N+R+(c?A:-A)/_,a[0][1])*_,T=Math.max(T,B)}if(l){let B=0;!c&&!u||c&&!u&&d?B=Ji(N+V/_,l[1][1])*_:B=Xi(N+(c?A:-A)/_,l[0][1])*_,T=Math.max(T,B)}}if(f){const P=df(z*_,b,k)/_;if($=Math.max($,P),a){let B=0;!c&&!u||u&&!c&&d?B=Xi(x+z*_+D,a[1][0])/_:B=Ji(x+(u?F:-F)*_+D,a[0][0])/_,$=Math.max($,B)}if(l){let B=0;!c&&!u||u&&!c&&d?B=Ji(x+z*_,l[1][0])/_:B=Xi(x+(u?F:-F)*_,l[0][0])/_,$=Math.max($,B)}}}F=F+(F<0?$:-$),A=A+(A<0?T:-T),s&&(d?V>z*_?F=(oS(c,u)?-A:A)/_:A=(oS(c,u)?-F:F)*_:p?(F=A/_,u=c):(A=F*_,c=u));const M=c?x+A:x,O=u?N+F:N;return{width:C+(c?-A:A),height:j+(u?-F:F),x:i[0]*A*(c?-1:1)+M,y:i[1]*F*(u?-1:1)+O}}const VE={width:0,height:0,x:0,y:0},Bz={...VE,pointerX:0,pointerY:0,aspectRatio:1};function Wz(e){return[[0,0],[e.measured.width,e.measured.height]]}function Vz(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 Kz({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:s}){const i=Jr(e);let a={controlDirection:iS("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:p,keepAspectRatio:f,resizeDirection:d,onResizeStart:h,onResize:y,onResizeEnd:b,shouldResize:k}){let g={...VE},w={...Bz};a={boundaries:p,resizeDirection:d,keepAspectRatio:f,controlDirection:iS(u)};let x,N=null,C=[],j,_,A,F=!1;const V=eE().on("start",z=>{const{nodeLookup:D,transform:R,snapGrid:T,snapToGrid:$,nodeOrigin:M,paneDomNode:O}=n();if(x=D.get(t),!x)return;N=(O==null?void 0:O.getBoundingClientRect())??null;const{xSnapped:P,ySnapped:B}=Zc(z.sourceEvent,{transform:R,snapGrid:T,snapToGrid:$,containerBounds:N});g={width:x.measured.width??0,height:x.measured.height??0,x:x.position.x??0,y:x.position.y??0},w={...g,pointerX:P,pointerY:B,aspectRatio:g.width/g.height},j=void 0,x.parentId&&(x.extent==="parent"||x.expandParent)&&(j=D.get(x.parentId),_=j&&x.extent==="parent"?Wz(j):void 0),C=[],A=void 0;for(const[E,q]of D)if(q.parentId===t&&(C.push({id:E,position:{...q.position},extent:q.extent}),q.extent==="parent"||q.expandParent)){const W=Vz(q,x,q.origin??M);A?A=[[Math.min(W[0][0],A[0][0]),Math.min(W[0][1],A[0][1])],[Math.max(W[1][0],A[1][0]),Math.max(W[1][1],A[1][1])]]:A=W}h==null||h(z,{...g})}).on("drag",z=>{const{transform:D,snapGrid:R,snapToGrid:T,nodeOrigin:$}=n(),M=Zc(z.sourceEvent,{transform:D,snapGrid:R,snapToGrid:T,containerBounds:N}),O=[];if(!x)return;const{x:P,y:B,width:E,height:q}=g,W={},L=x.origin??$,{width:X,height:se,x:ae,y:me}=Hz(w,a.controlDirection,M,a.boundaries,a.keepAspectRatio,L,_,A),re=X!==E,de=se!==q,ne=ae!==P&&re,ue=me!==B&&de;if(!ne&&!ue&&!re&&!de)return;if((ne||ue||L[0]===1||L[1]===1)&&(W.x=ne?ae:g.x,W.y=ue?me:g.y,g.x=W.x,g.y=W.y,C.length>0)){const We=ae-P,Pe=me-B;for(const Ue of C)Ue.position={x:Ue.position.x-We+L[0]*(X-E),y:Ue.position.y-Pe+L[1]*(se-q)},O.push(Ue)}if((re||de)&&(W.width=re&&(!a.resizeDirection||a.resizeDirection==="horizontal")?X:g.width,W.height=de&&(!a.resizeDirection||a.resizeDirection==="vertical")?se:g.height,g.width=W.width,g.height=W.height),j&&x.expandParent){const We=L[0]*(W.width??0);W.x&&W.x<We&&(g.x=We,w.x=w.x-(W.x-We));const Pe=L[1]*(W.height??0);W.y&&W.y<Pe&&(g.y=Pe,w.y=w.y-(W.y-Pe))}const fe=zz({width:g.width,prevWidth:E,height:g.height,prevHeight:q,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),ve={...g,direction:fe};(k==null?void 0:k(z,ve))!==!1&&(F=!0,y==null||y(z,ve),r(W,O))}).on("end",z=>{F&&(b==null||b(z,{...g}),s==null||s({...g}),F=!1)});i.call(V)}function c(){i.on(".drag",null)}return{update:l,destroy:c}}var KE={exports:{}},UE={},qE={exports:{}},YE={};/**
|
|
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 Ol=m;function Uz(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var qz=typeof Object.is=="function"?Object.is:Uz,Yz=Ol.useState,Gz=Ol.useEffect,Jz=Ol.useLayoutEffect,Xz=Ol.useDebugValue;function Qz(e,t){var n=t(),r=Yz({inst:{value:n,getSnapshot:t}}),s=r[0].inst,i=r[1];return Jz(function(){s.value=n,s.getSnapshot=t,Zm(s)&&i({inst:s})},[e,n,t]),Gz(function(){return Zm(s)&&i({inst:s}),e(function(){Zm(s)&&i({inst:s})})},[e]),Xz(n),n}function Zm(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!qz(e,n)}catch{return!0}}function Zz(e,t){return t()}var e3=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Zz:Qz;YE.useSyncExternalStore=Ol.useSyncExternalStore!==void 0?Ol.useSyncExternalStore:e3;qE.exports=YE;var GE=qE.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 _h=m,t3=GE;function n3(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var r3=typeof Object.is=="function"?Object.is:n3,s3=t3.useSyncExternalStore,i3=_h.useRef,o3=_h.useEffect,a3=_h.useMemo,l3=_h.useDebugValue;UE.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var i=i3(null);if(i.current===null){var a={hasValue:!1,value:null};i.current=a}else a=i.current;i=a3(function(){function c(h){if(!u){if(u=!0,p=h,h=r(h),s!==void 0&&a.hasValue){var y=a.value;if(s(y,h))return f=y}return f=h}if(y=f,r3(p,h))return y;var b=r(h);return s!==void 0&&s(y,b)?(p=h,y):(p=h,f=b)}var u=!1,p,f,d=n===void 0?null:n;return[function(){return c(t())},d===null?void 0:function(){return c(d())}]},[t,n,r,s]);var l=s3(e,i[0],i[1]);return o3(function(){a.hasValue=!0,a.value=l},[l]),l3(l),l};KE.exports=UE;var c3=KE.exports;const u3=Co(c3),d3={},aS=e=>{let t;const n=new Set,r=(p,f)=>{const d=typeof p=="function"?p(t):p;if(!Object.is(d,t)){const h=t;t=f??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(y=>y(t,h))}},s=()=>t,c={setState:r,getState:s,getInitialState:()=>u,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(d3?"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},f3=e=>e?aS(e):aS,{useDebugValue:p3}=rt,{useSyncExternalStoreWithSelector:h3}=u3,m3=e=>e;function JE(e,t=m3,n){const r=h3(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return p3(r),r}const lS=(e,t)=>{const n=f3(e),r=(s,i=t)=>JE(n,s,i);return Object.assign(r,n),r},g3=(e,t)=>e?lS(e,t):lS;function pn(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 Eh=m.createContext(null),y3=Eh.Provider,XE=li.error001();function At(e,t){const n=m.useContext(Eh);if(n===null)throw new Error(XE);return JE(n,e,t)}function cn(){const e=m.useContext(Eh);if(e===null)throw new Error(XE);return m.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const cS={display:"none"},x3={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},QE="react-flow__node-desc",ZE="react-flow__edge-desc",w3="react-flow__aria-live",b3=e=>e.ariaLiveMessage,k3=e=>e.ariaLabelConfig;function v3({rfId:e}){const t=At(b3);return o.jsx("div",{id:`${w3}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:x3,children:t})}function S3({rfId:e,disableKeyboardA11y:t}){const n=At(k3);return o.jsxs(o.Fragment,{children:[o.jsx("div",{id:`${QE}-${e}`,style:cS,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),o.jsx("div",{id:`${ZE}-${e}`,style:cS,children:n["edge.a11yDescription.default"]}),!t&&o.jsx(v3,{rfId:e})]})}const Ah=m.forwardRef(({position:e="top-left",children:t,className:n,style:r,...s},i)=>{const a=`${e}`.split("-");return o.jsx("div",{className:$n(["react-flow__panel",n,...a]),style:r,ref:i,...s,children:t})});Ah.displayName="Panel";function N3({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:o.jsx(Ah,{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 j3=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}},ff=e=>e.id;function C3(e,t){return pn(e.selectedNodes.map(ff),t.selectedNodes.map(ff))&&pn(e.selectedEdges.map(ff),t.selectedEdges.map(ff))}function _3({onSelectionChange:e}){const t=cn(),{selectedNodes:n,selectedEdges:r}=At(j3,C3);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 E3=e=>!!e.onSelectionChangeHandlers;function A3({onSelectionChange:e}){const t=At(E3);return e||t?o.jsx(_3,{onSelectionChange:e}):null}const Xy=typeof window<"u"?m.useLayoutEffect:m.useEffect,eA=[0,0],P3={x:0,y:0,zoom:1},I3=["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"],uS=[...I3,"rfId"],T3=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}),dS={translateExtent:Au,nodeOrigin:eA,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function R3(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:s,setTranslateExtent:i,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:c}=At(T3,pn),u=cn();Xy(()=>(c(e.defaultNodes,e.defaultEdges),()=>{p.current=dS,l()}),[]);const p=m.useRef(dS);return Xy(()=>{for(const f of uS){const d=e[f],h=p.current[f];d!==h&&(typeof e[f]>"u"||(f==="nodes"?t(d):f==="edges"?n(d):f==="minZoom"?r(d):f==="maxZoom"?s(d):f==="translateExtent"?i(d):f==="nodeExtent"?a(d):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:sz(d)}):f==="fitView"?u.setState({fitViewQueued:d}):f==="fitViewOptions"?u.setState({fitViewOptions:d}):u.setState({[f]:d})))}p.current=e},uS.map(f=>e[f])),null}function fS(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function M3(e){var r;const[t,n]=m.useState(e==="system"?null:e);return m.useEffect(()=>{if(e!=="system"){n(e);return}const s=fS(),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=fS())!=null&&r.matches?"dark":"light"}const pS=typeof document<"u"?document:null;function Ru(e=null,t={target:pS,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(f=>typeof f=="string").map(f=>f.replace("+",`
|
|
61
|
-
`).replace(`
|
|
62
|
-
|
|
63
|
-
`,`
|
|
64
|
-
+`).split(`
|
|
65
|
-
`)),p=u.reduce((f,d)=>f.concat(...d),[]);return[u,p]}return[[],[]]},[e]);return m.useEffect(()=>{const c=(t==null?void 0:t.target)??pS,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const p=h=>{var k,g;if(s.current=h.ctrlKey||h.metaKey||h.shiftKey||h.altKey,(!s.current||s.current&&!u)&&EE(h))return!1;const b=mS(h.code,l);if(i.current.add(h[b]),hS(a,i.current,!1)){const w=((g=(k=h.composedPath)==null?void 0:k.call(h))==null?void 0:g[0])||h.target,x=(w==null?void 0:w.nodeName)==="BUTTON"||(w==null?void 0:w.nodeName)==="A";t.preventDefault!==!1&&(s.current||!x)&&h.preventDefault(),r(!0)}},f=h=>{const y=mS(h.code,l);hS(a,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(h[y]),h.key==="Meta"&&i.current.clear(),s.current=!1},d=()=>{i.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",p),c==null||c.addEventListener("keyup",f),window.addEventListener("blur",d),window.addEventListener("contextmenu",d),()=>{c==null||c.removeEventListener("keydown",p),c==null||c.removeEventListener("keyup",f),window.removeEventListener("blur",d),window.removeEventListener("contextmenu",d)}}},[e,r]),n}function hS(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function mS(e,t){return t.includes(e)?"code":"key"}const $3=()=>{const e=cn();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=Ow(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},p=n.snapGrid??s,f=n.snapToGrid??i;return rd(u,r,f,p)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:s,y:i}=r.getBoundingClientRect(),a=$p(t,n);return{x:a.x+s,y:a.y+i}}}),[])};function tA(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)L3(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 L3(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 Lp(e,t){return tA(e,t)}function Vw(e,t){return tA(e,t)}function zo(e,t){return{id:e,type:"select",selected:t}}function al(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(zo(i.id,a)))}return r}function gS({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 yS(e){return{id:e.id,type:"remove"}}const xS=e=>YF(e),O3=e=>bE(e);function nA(e){return m.forwardRef(e)}function wS(e){const[t,n]=m.useState(BigInt(0)),[r]=m.useState(()=>D3(()=>n(s=>s+BigInt(1))));return Xy(()=>{const s=r.get();s.length&&(e(s),r.reset())},[t]),r}function D3(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const rA=m.createContext(null);function F3({children:e}){const t=cn(),n=m.useCallback(l=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:p,onNodesChange:f,nodeLookup:d,fitViewQueued:h,onNodesChangeMiddlewareMap:y}=t.getState();let b=c;for(const g of l)b=typeof g=="function"?g(b):g;let k=gS({items:b,lookup:d});for(const g of y.values())k=g(k);p&&u(b),k.length>0?f==null||f(k):h&&window.requestAnimationFrame(()=>{const{fitViewQueued:g,nodes:w,setNodes:x}=t.getState();g&&x(w)})},[]),r=wS(n),s=m.useCallback(l=>{const{edges:c=[],setEdges:u,hasDefaultEdges:p,onEdgesChange:f,edgeLookup:d}=t.getState();let h=c;for(const y of l)h=typeof y=="function"?y(h):y;p?u(h):f&&f(gS({items:h,lookup:d}))},[]),i=wS(s),a=m.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return o.jsx(rA.Provider,{value:a,children:e})}function z3(){const e=m.useContext(rA);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const H3=e=>!!e.panZoom;function Vl(){const e=$3(),t=cn(),n=z3(),r=At(H3),s=m.useMemo(()=>{const i=f=>t.getState().nodeLookup.get(f),a=f=>{n.nodeQueue.push(f)},l=f=>{n.edgeQueue.push(f)},c=f=>{var g,w;const{nodeLookup:d,nodeOrigin:h}=t.getState(),y=xS(f)?f:d.get(f.id),b=y.parentId?CE(y.position,y.measured,y.parentId,d,h):y.position,k={...y,position:b,width:((g=y.measured)==null?void 0:g.width)??y.width,height:((w=y.measured)==null?void 0:w.height)??y.height};return Ml(k)},u=(f,d,h={replace:!1})=>{a(y=>y.map(b=>{if(b.id===f){const k=typeof d=="function"?d(b):d;return h.replace&&xS(k)?k:{...b,...k}}return b}))},p=(f,d,h={replace:!1})=>{l(y=>y.map(b=>{if(b.id===f){const k=typeof d=="function"?d(b):d;return h.replace&&O3(k)?k:{...b,...k}}return b}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var d;return(d=i(f))==null?void 0:d.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(d=>({...d}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:a,setEdges:l,addNodes:f=>{const d=Array.isArray(f)?f:[f];n.nodeQueue.push(h=>[...h,...d])},addEdges:f=>{const d=Array.isArray(f)?f:[f];n.edgeQueue.push(h=>[...h,...d])},toObject:()=>{const{nodes:f=[],edges:d=[],transform:h}=t.getState(),[y,b,k]=h;return{nodes:f.map(g=>({...g})),edges:d.map(g=>({...g})),viewport:{x:y,y:b,zoom:k}}},deleteElements:async({nodes:f=[],edges:d=[]})=>{const{nodes:h,edges:y,onNodesDelete:b,onEdgesDelete:k,triggerNodeChanges:g,triggerEdgeChanges:w,onDelete:x,onBeforeDelete:N}=t.getState(),{nodes:C,edges:j}=await ZF({nodesToRemove:f,edgesToRemove:d,nodes:h,edges:y,onBeforeDelete:N}),_=j.length>0,A=C.length>0;if(_){const F=j.map(yS);k==null||k(j),w(F)}if(A){const F=C.map(yS);b==null||b(C),g(F)}return(A||_)&&(x==null||x({nodes:C,edges:j})),{deletedNodes:C,deletedEdges:j}},getIntersectingNodes:(f,d=!0,h)=>{const y=Y0(f),b=y?f:c(f),k=h!==void 0;return b?(h||t.getState().nodes).filter(g=>{const w=t.getState().nodeLookup.get(g.id);if(w&&!y&&(g.id===f.id||!w.internals.positionAbsolute))return!1;const x=Ml(k?g:w),N=Iu(x,b);return d&&N>0||N>=x.width*x.height||N>=b.width*b.height}):[]},isNodeIntersecting:(f,d,h=!0)=>{const b=Y0(f)?f:c(f);if(!b)return!1;const k=Iu(b,d);return h&&k>0||k>=d.width*d.height||k>=b.width*b.height},updateNode:u,updateNodeData:(f,d,h={replace:!1})=>{u(f,y=>{const b=typeof d=="function"?d(y):d;return h.replace?{...y,data:b}:{...y,data:{...y.data,...b}}},h)},updateEdge:p,updateEdgeData:(f,d,h={replace:!1})=>{p(f,y=>{const b=typeof d=="function"?d(y):d;return h.replace?{...y,data:b}:{...y,data:{...y.data,...b}}},h)},getNodesBounds:f=>{const{nodeLookup:d,nodeOrigin:h}=t.getState();return GF(f,{nodeLookup:d,nodeOrigin:h})},getHandleConnections:({type:f,id:d,nodeId:h})=>{var y;return Array.from(((y=t.getState().connectionLookup.get(`${h}-${f}${d?`-${d}`:""}`))==null?void 0:y.values())??[])},getNodeConnections:({type:f,handleId:d,nodeId:h})=>{var y;return Array.from(((y=t.getState().connectionLookup.get(`${h}${f?d?`-${f}-${d}`:`-${f}`:""}`))==null?void 0:y.values())??[])},fitView:async f=>{const d=t.getState().fitViewResolver??rz();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:d}),n.nodeQueue.push(h=>[...h]),d.promise}}},[]);return m.useMemo(()=>({...s,...e,viewportInitialized:r}),[r])}const bS=e=>e.selected,B3=typeof window<"u"?window:void 0;function W3({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=cn(),{deleteElements:r}=Vl(),s=Ru(e,{actInsideInputWithModifier:!1}),i=Ru(t,{target:B3});m.useEffect(()=>{if(s){const{edges:a,nodes:l}=n.getState();r({nodes:l.filter(bS),edges:a.filter(bS)}),n.setState({nodesSelectionActive:!1})}},[s]),m.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function V3(e){const t=cn();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=Dw(e.current);(r.height===0||r.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",li.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 Ph={position:"absolute",width:"100%",height:"100%",top:0,left:0},K3=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function U3({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:i=ea.Free,zoomOnDoubleClick:a=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:u,minZoom:p,maxZoom:f,zoomActivationKeyCode:d,preventScrolling:h=!0,children:y,noWheelClassName:b,noPanClassName:k,onViewportChange:g,isControlledViewport:w,paneClickDistance:x,selectionOnDrag:N}){const C=cn(),j=m.useRef(null),{userSelectionActive:_,lib:A,connectionInProgress:F}=At(K3,pn),V=Ru(d),z=m.useRef();V3(j);const D=m.useCallback(R=>{g==null||g({x:R[0],y:R[1],zoom:R[2]}),w||C.setState({transform:R})},[g,w]);return m.useEffect(()=>{if(j.current){z.current=Fz({domNode:j.current,minZoom:p,maxZoom:f,translateExtent:u,viewport:c,onDraggingChange:M=>C.setState(O=>O.paneDragging===M?O:{paneDragging:M}),onPanZoomStart:(M,O)=>{const{onViewportChangeStart:P,onMoveStart:B}=C.getState();B==null||B(M,O),P==null||P(O)},onPanZoom:(M,O)=>{const{onViewportChange:P,onMove:B}=C.getState();B==null||B(M,O),P==null||P(O)},onPanZoomEnd:(M,O)=>{const{onViewportChangeEnd:P,onMoveEnd:B}=C.getState();B==null||B(M,O),P==null||P(O)}});const{x:R,y:T,zoom:$}=z.current.getViewport();return C.setState({panZoom:z.current,transform:[R,T,$],domNode:j.current.closest(".react-flow")}),()=>{var M;(M=z.current)==null||M.destroy()}}},[]),m.useEffect(()=>{var R;(R=z.current)==null||R.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:i,zoomOnDoubleClick:a,panOnDrag:l,zoomActivationKeyPressed:V,preventScrolling:h,noPanClassName:k,userSelectionActive:_,noWheelClassName:b,lib:A,onTransformChange:D,connectionInProgress:F,selectionOnDrag:N,paneClickDistance:x})},[e,t,n,r,s,i,a,l,V,h,k,_,b,A,D,F,N,x]),o.jsx("div",{className:"react-flow__renderer",ref:j,style:Ph,children:y})}const q3=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Y3(){const{userSelectionActive:e,userSelectionRect:t}=At(q3,pn);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 eg=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},G3=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function J3({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Pu.Full,panOnDrag:r,paneClickDistance:s,selectionOnDrag:i,onSelectionStart:a,onSelectionEnd:l,onPaneClick:c,onPaneContextMenu:u,onPaneScroll:p,onPaneMouseEnter:f,onPaneMouseMove:d,onPaneMouseLeave:h,children:y}){const b=cn(),{userSelectionActive:k,elementsSelectable:g,dragging:w,connectionInProgress:x}=At(G3,pn),N=g&&(e||k),C=m.useRef(null),j=m.useRef(),_=m.useRef(new Set),A=m.useRef(new Set),F=m.useRef(!1),V=P=>{if(F.current||x){F.current=!1;return}c==null||c(P),b.getState().resetSelectedElements(),b.setState({nodesSelectionActive:!1})},z=P=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){P.preventDefault();return}u==null||u(P)},D=p?P=>p(P):void 0,R=P=>{F.current&&(P.stopPropagation(),F.current=!1)},T=P=>{var se,ae;const{domNode:B}=b.getState();if(j.current=B==null?void 0:B.getBoundingClientRect(),!j.current)return;const E=P.target===C.current;if(!E&&!!P.target.closest(".nokey")||!e||!(i&&E||t)||P.button!==0||!P.isPrimary)return;(ae=(se=P.target)==null?void 0:se.setPointerCapture)==null||ae.call(se,P.pointerId),F.current=!1;const{x:L,y:X}=$s(P.nativeEvent,j.current);b.setState({userSelectionRect:{width:0,height:0,startX:L,startY:X,x:L,y:X}}),E||(P.stopPropagation(),P.preventDefault())},$=P=>{const{userSelectionRect:B,transform:E,nodeLookup:q,edgeLookup:W,connectionLookup:L,triggerNodeChanges:X,triggerEdgeChanges:se,defaultEdgeOptions:ae,resetSelectedElements:me}=b.getState();if(!j.current||!B)return;const{x:re,y:de}=$s(P.nativeEvent,j.current),{startX:ne,startY:ue}=B;if(!F.current){const Pe=t?0:s;if(Math.hypot(re-ne,de-ue)<=Pe)return;me(),a==null||a(P)}F.current=!0;const fe={startX:ne,startY:ue,x:re<ne?re:ne,y:de<ue?de:ue,width:Math.abs(re-ne),height:Math.abs(de-ue)},ve=_.current,$e=A.current;_.current=new Set(Lw(q,fe,E,n===Pu.Partial,!0).map(Pe=>Pe.id)),A.current=new Set;const We=(ae==null?void 0:ae.selectable)??!0;for(const Pe of _.current){const Ue=L.get(Pe);if(Ue)for(const{edgeId:pt}of Ue.values()){const Te=W.get(pt);Te&&(Te.selectable??We)&&A.current.add(pt)}}if(!G0(ve,_.current)){const Pe=al(q,_.current,!0);X(Pe)}if(!G0($e,A.current)){const Pe=al(W,A.current);se(Pe)}b.setState({userSelectionRect:fe,userSelectionActive:!0,nodesSelectionActive:!1})},M=P=>{var B,E;P.button===0&&((E=(B=P.target)==null?void 0:B.releasePointerCapture)==null||E.call(B,P.pointerId),!k&&P.target===C.current&&b.getState().userSelectionRect&&(V==null||V(P)),b.setState({userSelectionActive:!1,userSelectionRect:null}),F.current&&(l==null||l(P),b.setState({nodesSelectionActive:_.current.size>0})))},O=r===!0||Array.isArray(r)&&r.includes(0);return o.jsxs("div",{className:$n(["react-flow__pane",{draggable:O,dragging:w,selection:e}]),onClick:N?void 0:eg(V,C),onContextMenu:eg(z,C),onWheel:eg(D,C),onPointerEnter:N?void 0:f,onPointerMove:N?$:d,onPointerUp:N?M:void 0,onPointerDownCapture:N?T:void 0,onClickCapture:N?R:void 0,onPointerLeave:h,ref:C,style:Ph,children:[y,o.jsx(Y3,{})]})}function Qy({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",li.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&a)&&(i({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var p;return(p=r==null?void 0:r.current)==null?void 0:p.blur()})):s([e])}function sA({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,nodeClickDistance:a}){const l=cn(),[c,u]=m.useState(!1),p=m.useRef();return m.useEffect(()=>{p.current=jz({getStoreItems:()=>l.getState(),onNodeMouseDown:f=>{Qy({id:f,store:l,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),m.useEffect(()=>{if(!(t||!e.current||!p.current))return p.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:s,nodeClickDistance:a}),()=>{var f;(f=p.current)==null||f.destroy()}},[n,r,t,i,e,s,a]),c}const X3=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function iA(){const e=cn();return m.useCallback(n=>{const{nodeExtent:r,snapToGrid:s,snapGrid:i,nodesDraggable:a,onError:l,updateNodePositions:c,nodeLookup:u,nodeOrigin:p}=e.getState(),f=new Map,d=X3(a),h=s?i[0]:5,y=s?i[1]:5,b=n.direction.x*h*n.factor,k=n.direction.y*y*n.factor;for(const[,g]of u){if(!d(g))continue;let w={x:g.internals.positionAbsolute.x+b,y:g.internals.positionAbsolute.y+k};s&&(w=nd(w,i));const{position:x,positionAbsolute:N}=kE({nodeId:g.id,nextPosition:w,nodeLookup:u,nodeExtent:r,nodeOrigin:p,onError:l});g.position=x,g.internals.positionAbsolute=N,f.set(g.id,g)}c(f)},[])}const Kw=m.createContext(null),Q3=Kw.Provider;Kw.Consumer;const oA=()=>m.useContext(Kw),Z3=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),e4=(e,t,n)=>r=>{const{connectionClickStartHandle:s,connectionMode:i,connection:a}=r,{fromHandle:l,toHandle:c,isValid:u}=a,p=(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:p,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===n,isPossibleEndHandle:i===Tl.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:p&&u}};function t4({type:e="source",position:t=Le.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:a,onConnect:l,children:c,className:u,onMouseDown:p,onTouchStart:f,...d},h){var $,M;const y=a||null,b=e==="target",k=cn(),g=oA(),{connectOnClick:w,noPanClassName:x,rfId:N}=At(Z3,pn),{connectingFrom:C,connectingTo:j,clickConnecting:_,isPossibleEndHandle:A,connectionInProcess:F,clickConnectionInProcess:V,valid:z}=At(e4(g,y,e),pn);g||(M=($=k.getState()).onError)==null||M.call($,"010",li.error010());const D=O=>{const{defaultEdgeOptions:P,onConnect:B,hasDefaultEdges:E}=k.getState(),q={...P,...O};if(E){const{edges:W,setEdges:L}=k.getState();L(Xf(q,W))}B==null||B(q),l==null||l(q)},R=O=>{if(!g)return;const P=AE(O.nativeEvent);if(s&&(P&&O.button===0||!P)){const B=k.getState();Jy.onPointerDown(O.nativeEvent,{handleDomNode:O.currentTarget,autoPanOnConnect:B.autoPanOnConnect,connectionMode:B.connectionMode,connectionRadius:B.connectionRadius,domNode:B.domNode,nodeLookup:B.nodeLookup,lib:B.lib,isTarget:b,handleId:y,nodeId:g,flowId:B.rfId,panBy:B.panBy,cancelConnection:B.cancelConnection,onConnectStart:B.onConnectStart,onConnectEnd:(...E)=>{var q,W;return(W=(q=k.getState()).onConnectEnd)==null?void 0:W.call(q,...E)},updateConnection:B.updateConnection,onConnect:D,isValidConnection:n||((...E)=>{var q,W;return((W=(q=k.getState()).isValidConnection)==null?void 0:W.call(q,...E))??!0}),getTransform:()=>k.getState().transform,getFromHandle:()=>k.getState().connection.fromHandle,autoPanSpeed:B.autoPanSpeed,dragThreshold:B.connectionDragThreshold})}P?p==null||p(O):f==null||f(O)},T=O=>{const{onClickConnectStart:P,onClickConnectEnd:B,connectionClickStartHandle:E,connectionMode:q,isValidConnection:W,lib:L,rfId:X,nodeLookup:se,connection:ae}=k.getState();if(!g||!E&&!s)return;if(!E){P==null||P(O.nativeEvent,{nodeId:g,handleId:y,handleType:e}),k.setState({connectionClickStartHandle:{nodeId:g,type:e,id:y}});return}const me=_E(O.target),re=n||W,{connection:de,isValid:ne}=Jy.isValid(O.nativeEvent,{handle:{nodeId:g,id:y,type:e},connectionMode:q,fromNodeId:E.nodeId,fromHandleId:E.id||null,fromType:E.type,isValidConnection:re,flowId:X,doc:me,lib:L,nodeLookup:se});ne&&de&&D(de);const ue=structuredClone(ae);delete ue.inProgress,ue.toPosition=ue.toHandle?ue.toHandle.position:null,B==null||B(O,ue),k.setState({connectionClickStartHandle:null})};return o.jsx("div",{"data-handleid":y,"data-nodeid":g,"data-handlepos":t,"data-id":`${N}-${g}-${y}-${e}`,className:$n(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",x,u,{source:!b,target:b,connectable:r,connectablestart:s,connectableend:i,clickconnecting:_,connectingfrom:C,connectingto:j,valid:z,connectionindicator:r&&(!F||A)&&(F||V?i:s)}]),onMouseDown:R,onTouchStart:R,onClick:w?T:void 0,ref:h,...d,children:c})}const Mn=m.memo(nA(t4));function n4({data:e,isConnectable:t,sourcePosition:n=Le.Bottom}){return o.jsxs(o.Fragment,{children:[e==null?void 0:e.label,o.jsx(Mn,{type:"source",position:n,isConnectable:t})]})}function r4({data:e,isConnectable:t,targetPosition:n=Le.Top,sourcePosition:r=Le.Bottom}){return o.jsxs(o.Fragment,{children:[o.jsx(Mn,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,o.jsx(Mn,{type:"source",position:r,isConnectable:t})]})}function s4(){return null}function i4({data:e,isConnectable:t,targetPosition:n=Le.Top}){return o.jsxs(o.Fragment,{children:[o.jsx(Mn,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Op={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},kS={input:n4,default:r4,output:i4,group:s4};function o4(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 a4=e=>{const{width:t,height:n,x:r,y:s}=td(e.nodeLookup,{filter:i=>!!i.selected});return{width:Ms(t)?t:null,height:Ms(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 l4({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=cn(),{width:s,height:i,transformString:a,userSelectionActive:l}=At(a4,pn),c=iA(),u=m.useRef(null);m.useEffect(()=>{var h;n||(h=u.current)==null||h.focus({preventScroll:!0})},[n]);const p=!l&&s!==null&&i!==null;if(sA({nodeRef:u,disabled:!p}),!p)return null;const f=e?h=>{const y=r.getState().nodes.filter(b=>b.selected);e(h,y)}:void 0,d=h=>{Object.prototype.hasOwnProperty.call(Op,h.key)&&(h.preventDefault(),c({direction:Op[h.key],factor:h.shiftKey?4:1}))};return o.jsx("div",{className:$n(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:o.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:d,style:{width:s,height:i}})})}const vS=typeof window<"u"?window:void 0,c4=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function aA({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,paneClickDistance:l,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:p,selectionMode:f,onSelectionStart:d,onSelectionEnd:h,multiSelectionKeyCode:y,panActivationKeyCode:b,zoomActivationKeyCode:k,elementsSelectable:g,zoomOnScroll:w,zoomOnPinch:x,panOnScroll:N,panOnScrollSpeed:C,panOnScrollMode:j,zoomOnDoubleClick:_,panOnDrag:A,defaultViewport:F,translateExtent:V,minZoom:z,maxZoom:D,preventScrolling:R,onSelectionContextMenu:T,noWheelClassName:$,noPanClassName:M,disableKeyboardA11y:O,onViewportChange:P,isControlledViewport:B}){const{nodesSelectionActive:E,userSelectionActive:q}=At(c4,pn),W=Ru(u,{target:vS}),L=Ru(b,{target:vS}),X=L||A,se=L||N,ae=p&&X!==!0,me=W||q||ae;return W3({deleteKeyCode:c,multiSelectionKeyCode:y}),o.jsx(U3,{onPaneContextMenu:i,elementsSelectable:g,zoomOnScroll:w,zoomOnPinch:x,panOnScroll:se,panOnScrollSpeed:C,panOnScrollMode:j,zoomOnDoubleClick:_,panOnDrag:!W&&X,defaultViewport:F,translateExtent:V,minZoom:z,maxZoom:D,zoomActivationKeyCode:k,preventScrolling:R,noWheelClassName:$,noPanClassName:M,onViewportChange:P,isControlledViewport:B,paneClickDistance:l,selectionOnDrag:ae,children:o.jsxs(J3,{onSelectionStart:d,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,panOnDrag:X,isSelecting:!!me,selectionMode:f,selectionKeyPressed:W,paneClickDistance:l,selectionOnDrag:ae,children:[e,E&&o.jsx(l4,{onSelectionContextMenu:T,noPanClassName:M,disableKeyboardA11y:O})]})})}aA.displayName="FlowRenderer";const u4=m.memo(aA),d4=e=>t=>e?Lw(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 f4(e){return At(m.useCallback(d4(e),[e]),pn)}const p4=e=>e.updateNodeInternals;function h4(){const e=At(p4),[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 m4({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const s=cn(),i=m.useRef(null),a=m.useRef(null),l=m.useRef(e.sourcePosition),c=m.useRef(e.targetPosition),u=m.useRef(t),p=n&&!!e.internals.handleBounds;return m.useEffect(()=>{i.current&&!e.hidden&&(!p||a.current!==i.current)&&(a.current&&(r==null||r.unobserve(a.current)),r==null||r.observe(i.current),a.current=i.current)},[p,e.hidden]),m.useEffect(()=>()=>{a.current&&(r==null||r.unobserve(a.current),a.current=null)},[]),m.useEffect(()=>{if(i.current){const f=u.current!==t,d=l.current!==e.sourcePosition,h=c.current!==e.targetPosition;(f||d||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 g4({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:s,onContextMenu:i,onDoubleClick:a,nodesDraggable:l,elementsSelectable:c,nodesConnectable:u,nodesFocusable:p,resizeObserver:f,noDragClassName:d,noPanClassName:h,disableKeyboardA11y:y,rfId:b,nodeTypes:k,nodeClickDistance:g,onError:w}){const{node:x,internals:N,isParent:C}=At(re=>{const de=re.nodeLookup.get(e),ne=re.parentLookup.has(e);return{node:de,internals:de.internals,isParent:ne}},pn);let j=x.type||"default",_=(k==null?void 0:k[j])||kS[j];_===void 0&&(w==null||w("003",li.error003(j)),j="default",_=(k==null?void 0:k.default)||kS.default);const A=!!(x.draggable||l&&typeof x.draggable>"u"),F=!!(x.selectable||c&&typeof x.selectable>"u"),V=!!(x.connectable||u&&typeof x.connectable>"u"),z=!!(x.focusable||p&&typeof x.focusable>"u"),D=cn(),R=jE(x),T=m4({node:x,nodeType:j,hasDimensions:R,resizeObserver:f}),$=sA({nodeRef:T,disabled:x.hidden||!A,noDragClassName:d,handleSelector:x.dragHandle,nodeId:e,isSelectable:F,nodeClickDistance:g}),M=iA();if(x.hidden)return null;const O=Oi(x),P=o4(x),B=F||A||t||n||r||s,E=n?re=>n(re,{...N.userNode}):void 0,q=r?re=>r(re,{...N.userNode}):void 0,W=s?re=>s(re,{...N.userNode}):void 0,L=i?re=>i(re,{...N.userNode}):void 0,X=a?re=>a(re,{...N.userNode}):void 0,se=re=>{const{selectNodesOnDrag:de,nodeDragThreshold:ne}=D.getState();F&&(!de||!A||ne>0)&&Qy({id:e,store:D,nodeRef:T}),t&&t(re,{...N.userNode})},ae=re=>{if(!(EE(re.nativeEvent)||y)){if(gE.includes(re.key)&&F){const de=re.key==="Escape";Qy({id:e,store:D,unselect:de,nodeRef:T})}else if(A&&x.selected&&Object.prototype.hasOwnProperty.call(Op,re.key)){re.preventDefault();const{ariaLabelConfig:de}=D.getState();D.setState({ariaLiveMessage:de["node.a11yDescription.ariaLiveMessage"]({direction:re.key.replace("Arrow","").toLowerCase(),x:~~N.positionAbsolute.x,y:~~N.positionAbsolute.y})}),M({direction:Op[re.key],factor:re.shiftKey?4:1})}}},me=()=>{var $e;if(y||!(($e=T.current)!=null&&$e.matches(":focus-visible")))return;const{transform:re,width:de,height:ne,autoPanOnNodeFocus:ue,setCenter:fe}=D.getState();if(!ue)return;Lw(new Map([[e,x]]),{x:0,y:0,width:de,height:ne},re,!0).length>0||fe(x.position.x+O.width/2,x.position.y+O.height/2,{zoom:re[2]})};return o.jsx("div",{className:$n(["react-flow__node",`react-flow__node-${j}`,{[h]:A},x.className,{selected:x.selected,selectable:F,parent:C,draggable:A,dragging:$}]),ref:T,style:{zIndex:N.z,transform:`translate(${N.positionAbsolute.x}px,${N.positionAbsolute.y}px)`,pointerEvents:B?"all":"none",visibility:R?"visible":"hidden",...x.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:E,onMouseMove:q,onMouseLeave:W,onContextMenu:L,onClick:se,onDoubleClick:X,onKeyDown:z?ae:void 0,tabIndex:z?0:void 0,onFocus:z?me:void 0,role:x.ariaRole??(z?"group":void 0),"aria-roledescription":"node","aria-describedby":y?void 0:`${QE}-${b}`,"aria-label":x.ariaLabel,...x.domAttributes,children:o.jsx(Q3,{value:e,children:o.jsx(_,{id:e,data:x.data,type:j,positionAbsoluteX:N.positionAbsolute.x,positionAbsoluteY:N.positionAbsolute.y,selected:x.selected??!1,selectable:F,draggable:A,deletable:x.deletable??!0,isConnectable:V,sourcePosition:x.sourcePosition,targetPosition:x.targetPosition,dragging:$,dragHandle:x.dragHandle,zIndex:N.z,parentId:x.parentId,...O})})})}var y4=m.memo(g4);const x4=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function lA(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,onError:i}=At(x4,pn),a=f4(e.onlyRenderVisibleElements),l=h4();return o.jsx("div",{className:"react-flow__nodes",style:Ph,children:a.map(c=>o.jsx(y4,{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))})}lA.displayName="NodeRenderer";const w4=m.memo(lA);function b4(e){return At(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&&az({sourceNode:i,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[e]),pn)}const k4=({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"})},v4=({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"})},SS={[ei.Arrow]:k4,[ei.ArrowClosed]:v4};function S4(e){const t=cn();return m.useMemo(()=>{var s,i;return Object.prototype.hasOwnProperty.call(SS,e)?SS[e]:((i=(s=t.getState()).onError)==null||i.call(s,"009",li.error009(e)),null)},[e])}const N4=({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=S4(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},cA=({defaultColor:e,rfId:t})=>{const n=At(i=>i.edges),r=At(i=>i.defaultEdgeOptions),s=m.useMemo(()=>hz(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(N4,{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};cA.displayName="MarkerDefinitions";var j4=m.memo(cA);function uA({x:e,y:t,label:n,labelStyle:r,labelShowBg:s=!0,labelBgStyle:i,labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:c,className:u,...p}){const[f,d]=m.useState({x:1,y:0,width:0,height:0}),h=$n(["react-flow__edge-textwrapper",u]),y=m.useRef(null);return m.useEffect(()=>{if(y.current){const b=y.current.getBBox();d({x:b.x,y:b.y,width:b.width,height:b.height})}},[n]),n?o.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:h,visibility:f.width?"visible":"hidden",...p,children:[s&&o.jsx("rect",{width:f.width+2*a[0],x:-a[0],y:-a[1],height:f.height+2*a[1],className:"react-flow__edge-textbg",style:i,rx:l,ry:l}),o.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:y,style:r,children:n}),c]}):null}uA.displayName="EdgeText";const C4=m.memo(uA);function Ih({path:e,labelX:t,labelY:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,interactionWidth:u=20,...p}){return o.jsxs(o.Fragment,{children:[o.jsx("path",{...p,d:e,fill:"none",className:$n(["react-flow__edge-path",p.className])}),u?o.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,r&&Ms(t)&&Ms(n)?o.jsx(C4,{x:t,y:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function NS({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===Le.Left||e===Le.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function dA({sourceX:e,sourceY:t,sourcePosition:n=Le.Bottom,targetX:r,targetY:s,targetPosition:i=Le.Top}){const[a,l]=NS({pos:n,x1:e,y1:t,x2:r,y2:s}),[c,u]=NS({pos:i,x1:r,y1:s,x2:e,y2:t}),[p,f,d,h]=PE({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}`,p,f,d,h]}function fA(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:a,targetPosition:l,label:c,labelStyle:u,labelShowBg:p,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:h,style:y,markerEnd:b,markerStart:k,interactionWidth:g})=>{const[w,x,N]=dA({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:l}),C=e.isInternal?void 0:t;return o.jsx(Ih,{id:C,path:w,labelX:x,labelY:N,label:c,labelStyle:u,labelShowBg:p,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:h,style:y,markerEnd:b,markerStart:k,interactionWidth:g})})}const _4=fA({isInternal:!1}),pA=fA({isInternal:!0});_4.displayName="SimpleBezierEdge";pA.displayName="SimpleBezierEdgeInternal";function hA(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:f,style:d,sourcePosition:h=Le.Bottom,targetPosition:y=Le.Top,markerEnd:b,markerStart:k,pathOptions:g,interactionWidth:w})=>{const[x,N,C]=qy({sourceX:n,sourceY:r,sourcePosition:h,targetX:s,targetY:i,targetPosition:y,borderRadius:g==null?void 0:g.borderRadius,offset:g==null?void 0:g.offset,stepPosition:g==null?void 0:g.stepPosition}),j=e.isInternal?void 0:t;return o.jsx(Ih,{id:j,path:x,labelX:N,labelY:C,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:f,style:d,markerEnd:b,markerStart:k,interactionWidth:w})})}const mA=hA({isInternal:!1}),gA=hA({isInternal:!0});mA.displayName="SmoothStepEdge";gA.displayName="SmoothStepEdgeInternal";function yA(e){return m.memo(({id:t,...n})=>{var s;const r=e.isInternal?void 0:t;return o.jsx(mA,{...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 E4=yA({isInternal:!1}),xA=yA({isInternal:!0});E4.displayName="StepEdge";xA.displayName="StepEdgeInternal";function wA(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:y,interactionWidth:b})=>{const[k,g,w]=RE({sourceX:n,sourceY:r,targetX:s,targetY:i}),x=e.isInternal?void 0:t;return o.jsx(Ih,{id:x,path:k,labelX:g,labelY:w,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:y,interactionWidth:b})})}const A4=wA({isInternal:!1}),bA=wA({isInternal:!0});A4.displayName="StraightEdge";bA.displayName="StraightEdgeInternal";function kA(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:a=Le.Bottom,targetPosition:l=Le.Top,label:c,labelStyle:u,labelShowBg:p,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:h,style:y,markerEnd:b,markerStart:k,pathOptions:g,interactionWidth:w})=>{const[x,N,C]=IE({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:l,curvature:g==null?void 0:g.curvature}),j=e.isInternal?void 0:t;return o.jsx(Ih,{id:j,path:x,labelX:N,labelY:C,label:c,labelStyle:u,labelShowBg:p,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:h,style:y,markerEnd:b,markerStart:k,interactionWidth:w})})}const P4=kA({isInternal:!1}),vA=kA({isInternal:!0});P4.displayName="BezierEdge";vA.displayName="BezierEdgeInternal";const jS={default:vA,straight:bA,step:xA,smoothstep:gA,simplebezier:pA},CS={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},I4=(e,t,n)=>n===Le.Left?e-t:n===Le.Right?e+t:e,T4=(e,t,n)=>n===Le.Top?e-t:n===Le.Bottom?e+t:e,_S="react-flow__edgeupdater";function ES({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:$n([_S,`${_S}-${l}`]),cx:I4(t,r,e),cy:T4(n,r,e),r,stroke:"transparent",fill:"transparent"})}function R4({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:s,targetX:i,targetY:a,sourcePosition:l,targetPosition:c,onReconnect:u,onReconnectStart:p,onReconnectEnd:f,setReconnecting:d,setUpdateHover:h}){const y=cn(),b=(N,C)=>{if(N.button!==0)return;const{autoPanOnConnect:j,domNode:_,connectionMode:A,connectionRadius:F,lib:V,onConnectStart:z,cancelConnection:D,nodeLookup:R,rfId:T,panBy:$,updateConnection:M}=y.getState(),O=C.type==="target",P=(q,W)=>{d(!1),f==null||f(q,n,C.type,W)},B=q=>u==null?void 0:u(n,q),E=(q,W)=>{d(!0),p==null||p(N,n,C.type),z==null||z(q,W)};Jy.onPointerDown(N.nativeEvent,{autoPanOnConnect:j,connectionMode:A,connectionRadius:F,domNode:_,handleId:C.id,nodeId:C.nodeId,nodeLookup:R,isTarget:O,edgeUpdaterType:C.type,lib:V,flowId:T,cancelConnection:D,panBy:$,isValidConnection:(...q)=>{var W,L;return((L=(W=y.getState()).isValidConnection)==null?void 0:L.call(W,...q))??!0},onConnect:B,onConnectStart:E,onConnectEnd:(...q)=>{var W,L;return(L=(W=y.getState()).onConnectEnd)==null?void 0:L.call(W,...q)},onReconnectEnd:P,updateConnection:M,getTransform:()=>y.getState().transform,getFromHandle:()=>y.getState().connection.fromHandle,dragThreshold:y.getState().connectionDragThreshold,handleDomNode:N.currentTarget})},k=N=>b(N,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),g=N=>b(N,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),w=()=>h(!0),x=()=>h(!1);return o.jsxs(o.Fragment,{children:[(e===!0||e==="source")&&o.jsx(ES,{position:l,centerX:r,centerY:s,radius:t,onMouseDown:k,onMouseEnter:w,onMouseOut:x,type:"source"}),(e===!0||e==="target")&&o.jsx(ES,{position:c,centerX:i,centerY:a,radius:t,onMouseDown:g,onMouseEnter:w,onMouseOut:x,type:"target"})]})}function M4({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:s,onDoubleClick:i,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,reconnectRadius:p,onReconnect:f,onReconnectStart:d,onReconnectEnd:h,rfId:y,edgeTypes:b,noPanClassName:k,onError:g,disableKeyboardA11y:w}){let x=At(fe=>fe.edgeLookup.get(e));const N=At(fe=>fe.defaultEdgeOptions);x=N?{...N,...x}:x;let C=x.type||"default",j=(b==null?void 0:b[C])||jS[C];j===void 0&&(g==null||g("011",li.error011(C)),C="default",j=(b==null?void 0:b.default)||jS.default);const _=!!(x.focusable||t&&typeof x.focusable>"u"),A=typeof f<"u"&&(x.reconnectable||n&&typeof x.reconnectable>"u"),F=!!(x.selectable||r&&typeof x.selectable>"u"),V=m.useRef(null),[z,D]=m.useState(!1),[R,T]=m.useState(!1),$=cn(),{zIndex:M,sourceX:O,sourceY:P,targetX:B,targetY:E,sourcePosition:q,targetPosition:W}=At(m.useCallback(fe=>{const ve=fe.nodeLookup.get(x.source),$e=fe.nodeLookup.get(x.target);if(!ve||!$e)return{zIndex:x.zIndex,...CS};const We=pz({id:e,sourceNode:ve,targetNode:$e,sourceHandle:x.sourceHandle||null,targetHandle:x.targetHandle||null,connectionMode:fe.connectionMode,onError:g});return{zIndex:oz({selected:x.selected,zIndex:x.zIndex,sourceNode:ve,targetNode:$e,elevateOnSelect:fe.elevateEdgesOnSelect,zIndexMode:fe.zIndexMode}),...We||CS}},[x.source,x.target,x.sourceHandle,x.targetHandle,x.selected,x.zIndex]),pn),L=m.useMemo(()=>x.markerStart?`url('#${Yy(x.markerStart,y)}')`:void 0,[x.markerStart,y]),X=m.useMemo(()=>x.markerEnd?`url('#${Yy(x.markerEnd,y)}')`:void 0,[x.markerEnd,y]);if(x.hidden||O===null||P===null||B===null||E===null)return null;const se=fe=>{var Pe;const{addSelectedEdges:ve,unselectNodesAndEdges:$e,multiSelectionActive:We}=$.getState();F&&($.setState({nodesSelectionActive:!1}),x.selected&&We?($e({nodes:[],edges:[x]}),(Pe=V.current)==null||Pe.blur()):ve([e])),s&&s(fe,x)},ae=i?fe=>{i(fe,{...x})}:void 0,me=a?fe=>{a(fe,{...x})}:void 0,re=l?fe=>{l(fe,{...x})}:void 0,de=c?fe=>{c(fe,{...x})}:void 0,ne=u?fe=>{u(fe,{...x})}:void 0,ue=fe=>{var ve;if(!w&&gE.includes(fe.key)&&F){const{unselectNodesAndEdges:$e,addSelectedEdges:We}=$.getState();fe.key==="Escape"?((ve=V.current)==null||ve.blur(),$e({edges:[x]})):We([e])}};return o.jsx("svg",{style:{zIndex:M},children:o.jsxs("g",{className:$n(["react-flow__edge",`react-flow__edge-${C}`,x.className,k,{selected:x.selected,animated:x.animated,inactive:!F&&!s,updating:z,selectable:F}]),onClick:se,onDoubleClick:ae,onContextMenu:me,onMouseEnter:re,onMouseMove:de,onMouseLeave:ne,onKeyDown:_?ue:void 0,tabIndex:_?0:void 0,role:x.ariaRole??(_?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":x.ariaLabel===null?void 0:x.ariaLabel||`Edge from ${x.source} to ${x.target}`,"aria-describedby":_?`${ZE}-${y}`:void 0,ref:V,...x.domAttributes,children:[!R&&o.jsx(j,{id:e,source:x.source,target:x.target,type:x.type,selected:x.selected,animated:x.animated,selectable:F,deletable:x.deletable??!0,label:x.label,labelStyle:x.labelStyle,labelShowBg:x.labelShowBg,labelBgStyle:x.labelBgStyle,labelBgPadding:x.labelBgPadding,labelBgBorderRadius:x.labelBgBorderRadius,sourceX:O,sourceY:P,targetX:B,targetY:E,sourcePosition:q,targetPosition:W,data:x.data,style:x.style,sourceHandleId:x.sourceHandle,targetHandleId:x.targetHandle,markerStart:L,markerEnd:X,pathOptions:"pathOptions"in x?x.pathOptions:void 0,interactionWidth:x.interactionWidth}),A&&o.jsx(R4,{edge:x,isReconnectable:A,reconnectRadius:p,onReconnect:f,onReconnectStart:d,onReconnectEnd:h,sourceX:O,sourceY:P,targetX:B,targetY:E,sourcePosition:q,targetPosition:W,setUpdateHover:D,setReconnecting:T})]})})}var $4=m.memo(M4);const L4=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function SA({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:s,onReconnect:i,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:p,reconnectRadius:f,onEdgeDoubleClick:d,onReconnectStart:h,onReconnectEnd:y,disableKeyboardA11y:b}){const{edgesFocusable:k,edgesReconnectable:g,elementsSelectable:w,onError:x}=At(L4,pn),N=b4(t);return o.jsxs("div",{className:"react-flow__edges",children:[o.jsx(j4,{defaultColor:e,rfId:n}),N.map(C=>o.jsx($4,{id:C,edgesFocusable:k,edgesReconnectable:g,elementsSelectable:w,noPanClassName:s,onReconnect:i,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,onClick:p,reconnectRadius:f,onDoubleClick:d,onReconnectStart:h,onReconnectEnd:y,rfId:n,onError:x,edgeTypes:r,disableKeyboardA11y:b},C))]})}SA.displayName="EdgeRenderer";const O4=m.memo(SA),D4=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function F4({children:e}){const t=At(D4);return o.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function z4(e){const t=Vl(),n=m.useRef(!1);m.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const H4=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function B4(e){const t=At(H4),n=cn();return m.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function W4(e){return e.connection.inProgress?{...e.connection,to:rd(e.connection.to,e.transform)}:{...e.connection}}function V4(e){return W4}function K4(e){const t=V4();return At(t,pn)}const U4=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function q4({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:s,width:i,height:a,isValid:l,inProgress:c}=At(U4,pn);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:$n(["react-flow__connection",wE(l)]),children:o.jsx(NA,{style:t,type:n,CustomComponent:r,isValid:l})})})}const NA=({style:e,type:t=so.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:s,from:i,fromNode:a,fromHandle:l,fromPosition:c,to:u,toNode:p,toHandle:f,toPosition:d,pointer:h}=K4();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:d,connectionStatus:wE(r),toNode:p,toHandle:f,pointer:h});let y="";const b={sourceX:i.x,sourceY:i.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:d};switch(t){case so.Bezier:[y]=IE(b);break;case so.SimpleBezier:[y]=dA(b);break;case so.Step:[y]=qy({...b,borderRadius:0});break;case so.SmoothStep:[y]=qy(b);break;default:[y]=RE(b)}return o.jsx("path",{d:y,fill:"none",className:"react-flow__connection-path",style:e})};NA.displayName="ConnectionLine";const Y4={};function AS(e=Y4){m.useRef(e),cn(),m.useEffect(()=>{},[e])}function G4(){cn(),m.useRef(!1),m.useEffect(()=>{},[])}function jA({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:i,onEdgeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:p,onSelectionContextMenu:f,onSelectionStart:d,onSelectionEnd:h,connectionLineType:y,connectionLineStyle:b,connectionLineComponent:k,connectionLineContainerStyle:g,selectionKeyCode:w,selectionOnDrag:x,selectionMode:N,multiSelectionKeyCode:C,panActivationKeyCode:j,zoomActivationKeyCode:_,deleteKeyCode:A,onlyRenderVisibleElements:F,elementsSelectable:V,defaultViewport:z,translateExtent:D,minZoom:R,maxZoom:T,preventScrolling:$,defaultMarkerColor:M,zoomOnScroll:O,zoomOnPinch:P,panOnScroll:B,panOnScrollSpeed:E,panOnScrollMode:q,zoomOnDoubleClick:W,panOnDrag:L,onPaneClick:X,onPaneMouseEnter:se,onPaneMouseMove:ae,onPaneMouseLeave:me,onPaneScroll:re,onPaneContextMenu:de,paneClickDistance:ne,nodeClickDistance:ue,onEdgeContextMenu:fe,onEdgeMouseEnter:ve,onEdgeMouseMove:$e,onEdgeMouseLeave:We,reconnectRadius:Pe,onReconnect:Ue,onReconnectStart:pt,onReconnectEnd:Te,noDragClassName:et,noWheelClassName:Yt,noPanClassName:jt,disableKeyboardA11y:$t,nodeExtent:Ht,rfId:Xe,viewport:oe,onViewportChange:ke}){return AS(e),AS(t),G4(),z4(n),B4(oe),o.jsx(u4,{onPaneClick:X,onPaneMouseEnter:se,onPaneMouseMove:ae,onPaneMouseLeave:me,onPaneContextMenu:de,onPaneScroll:re,paneClickDistance:ne,deleteKeyCode:A,selectionKeyCode:w,selectionOnDrag:x,selectionMode:N,onSelectionStart:d,onSelectionEnd:h,multiSelectionKeyCode:C,panActivationKeyCode:j,zoomActivationKeyCode:_,elementsSelectable:V,zoomOnScroll:O,zoomOnPinch:P,zoomOnDoubleClick:W,panOnScroll:B,panOnScrollSpeed:E,panOnScrollMode:q,panOnDrag:L,defaultViewport:z,translateExtent:D,minZoom:R,maxZoom:T,onSelectionContextMenu:f,preventScrolling:$,noDragClassName:et,noWheelClassName:Yt,noPanClassName:jt,disableKeyboardA11y:$t,onViewportChange:ke,isControlledViewport:!!oe,children:o.jsxs(F4,{children:[o.jsx(O4,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:a,onReconnect:Ue,onReconnectStart:pt,onReconnectEnd:Te,onlyRenderVisibleElements:F,onEdgeContextMenu:fe,onEdgeMouseEnter:ve,onEdgeMouseMove:$e,onEdgeMouseLeave:We,reconnectRadius:Pe,defaultMarkerColor:M,noPanClassName:jt,disableKeyboardA11y:$t,rfId:Xe}),o.jsx(q4,{style:b,type:y,component:k,containerStyle:g}),o.jsx("div",{className:"react-flow__edgelabel-renderer"}),o.jsx(w4,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:p,nodeClickDistance:ue,onlyRenderVisibleElements:F,noPanClassName:jt,noDragClassName:et,disableKeyboardA11y:$t,nodeExtent:Ht,rfId:Xe}),o.jsx("div",{className:"react-flow__viewport-portal"})]})})}jA.displayName="GraphView";const J4=m.memo(jA),PS=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:l,minZoom:c=.5,maxZoom:u=2,nodeOrigin:p,nodeExtent:f,zIndexMode:d="basic"}={})=>{const h=new Map,y=new Map,b=new Map,k=new Map,g=r??t??[],w=n??e??[],x=p??[0,0],N=f??Au;LE(b,k,g);const{nodesInitialized:C}=Gy(w,h,y,{nodeOrigin:x,nodeExtent:N,zIndexMode:d});let j=[0,0,1];if(a&&s&&i){const _=td(h,{filter:z=>!!((z.width||z.initialWidth)&&(z.height||z.initialHeight))}),{x:A,y:F,zoom:V}=Ow(_,s,i,c,u,(l==null?void 0:l.padding)??.1);j=[A,F,V]}return{rfId:"1",width:s??0,height:i??0,transform:j,nodes:w,nodesInitialized:C,nodeLookup:h,parentLookup:y,edges:g,edgeLookup:k,connectionLookup:b,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:Au,nodeExtent:N,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Tl.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:x,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:{...xE},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:ez,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:yE,zIndexMode:d,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},X4=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:p,nodeExtent:f,zIndexMode:d})=>g3((h,y)=>{async function b(){const{nodeLookup:k,panZoom:g,fitViewOptions:w,fitViewResolver:x,width:N,height:C,minZoom:j,maxZoom:_}=y();g&&(await QF({nodes:k,width:N,height:C,panZoom:g,minZoom:j,maxZoom:_},w),x==null||x.resolve(!0),h({fitViewResolver:null}))}return{...PS({nodes:e,edges:t,width:s,height:i,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:p,nodeExtent:f,defaultNodes:n,defaultEdges:r,zIndexMode:d}),setNodes:k=>{const{nodeLookup:g,parentLookup:w,nodeOrigin:x,elevateNodesOnSelect:N,fitViewQueued:C,zIndexMode:j,nodesSelectionActive:_}=y(),{nodesInitialized:A,hasSelectedNodes:F}=Gy(k,g,w,{nodeOrigin:x,nodeExtent:f,elevateNodesOnSelect:N,checkEquality:!0,zIndexMode:j}),V=_&&F;C&&A?(b(),h({nodes:k,nodesInitialized:A,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:V})):h({nodes:k,nodesInitialized:A,nodesSelectionActive:V})},setEdges:k=>{const{connectionLookup:g,edgeLookup:w}=y();LE(g,w,k),h({edges:k})},setDefaultNodesAndEdges:(k,g)=>{if(k){const{setNodes:w}=y();w(k),h({hasDefaultNodes:!0})}if(g){const{setEdges:w}=y();w(g),h({hasDefaultEdges:!0})}},updateNodeInternals:k=>{const{triggerNodeChanges:g,nodeLookup:w,parentLookup:x,domNode:N,nodeOrigin:C,nodeExtent:j,debug:_,fitViewQueued:A,zIndexMode:F}=y(),{changes:V,updatedInternals:z}=kz(k,w,x,N,C,j,F);z&&(yz(w,x,{nodeOrigin:C,nodeExtent:j,zIndexMode:F}),A?(b(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),(V==null?void 0:V.length)>0&&(_&&console.log("React Flow: trigger node changes",V),g==null||g(V)))},updateNodePositions:(k,g=!1)=>{const w=[];let x=[];const{nodeLookup:N,triggerNodeChanges:C,connection:j,updateConnection:_,onNodesChangeMiddlewareMap:A}=y();for(const[F,V]of k){const z=N.get(F),D=!!(z!=null&&z.expandParent&&(z!=null&&z.parentId)&&(V!=null&&V.position)),R={id:F,type:"position",position:D?{x:Math.max(0,V.position.x),y:Math.max(0,V.position.y)}:V.position,dragging:g};if(z&&j.inProgress&&j.fromNode.id===z.id){const T=fa(z,j.fromHandle,Le.Left,!0);_({...j,from:T})}D&&z.parentId&&w.push({id:F,parentId:z.parentId,rect:{...V.internals.positionAbsolute,width:V.measured.width??0,height:V.measured.height??0}}),x.push(R)}if(w.length>0){const{parentLookup:F,nodeOrigin:V}=y(),z=Ww(w,N,F,V);x.push(...z)}for(const F of A.values())x=F(x);C(x)},triggerNodeChanges:k=>{const{onNodesChange:g,setNodes:w,nodes:x,hasDefaultNodes:N,debug:C}=y();if(k!=null&&k.length){if(N){const j=Lp(k,x);w(j)}C&&console.log("React Flow: trigger node changes",k),g==null||g(k)}},triggerEdgeChanges:k=>{const{onEdgesChange:g,setEdges:w,edges:x,hasDefaultEdges:N,debug:C}=y();if(k!=null&&k.length){if(N){const j=Vw(k,x);w(j)}C&&console.log("React Flow: trigger edge changes",k),g==null||g(k)}},addSelectedNodes:k=>{const{multiSelectionActive:g,edgeLookup:w,nodeLookup:x,triggerNodeChanges:N,triggerEdgeChanges:C}=y();if(g){const j=k.map(_=>zo(_,!0));N(j);return}N(al(x,new Set([...k]),!0)),C(al(w))},addSelectedEdges:k=>{const{multiSelectionActive:g,edgeLookup:w,nodeLookup:x,triggerNodeChanges:N,triggerEdgeChanges:C}=y();if(g){const j=k.map(_=>zo(_,!0));C(j);return}C(al(w,new Set([...k]))),N(al(x,new Set,!0))},unselectNodesAndEdges:({nodes:k,edges:g}={})=>{const{edges:w,nodes:x,nodeLookup:N,triggerNodeChanges:C,triggerEdgeChanges:j}=y(),_=k||x,A=g||w,F=[];for(const z of _){if(!z.selected)continue;const D=N.get(z.id);D&&(D.selected=!1),F.push(zo(z.id,!1))}const V=[];for(const z of A)z.selected&&V.push(zo(z.id,!1));C(F),j(V)},setMinZoom:k=>{const{panZoom:g,maxZoom:w}=y();g==null||g.setScaleExtent([k,w]),h({minZoom:k})},setMaxZoom:k=>{const{panZoom:g,minZoom:w}=y();g==null||g.setScaleExtent([w,k]),h({maxZoom:k})},setTranslateExtent:k=>{var g;(g=y().panZoom)==null||g.setTranslateExtent(k),h({translateExtent:k})},resetSelectedElements:()=>{const{edges:k,nodes:g,triggerNodeChanges:w,triggerEdgeChanges:x,elementsSelectable:N}=y();if(!N)return;const C=g.reduce((_,A)=>A.selected?[..._,zo(A.id,!1)]:_,[]),j=k.reduce((_,A)=>A.selected?[..._,zo(A.id,!1)]:_,[]);w(C),x(j)},setNodeExtent:k=>{const{nodes:g,nodeLookup:w,parentLookup:x,nodeOrigin:N,elevateNodesOnSelect:C,nodeExtent:j,zIndexMode:_}=y();k[0][0]===j[0][0]&&k[0][1]===j[0][1]&&k[1][0]===j[1][0]&&k[1][1]===j[1][1]||(Gy(g,w,x,{nodeOrigin:N,nodeExtent:k,elevateNodesOnSelect:C,checkEquality:!1,zIndexMode:_}),h({nodeExtent:k}))},panBy:k=>{const{transform:g,width:w,height:x,panZoom:N,translateExtent:C}=y();return vz({delta:k,panZoom:N,transform:g,translateExtent:C,width:w,height:x})},setCenter:async(k,g,w)=>{const{width:x,height:N,maxZoom:C,panZoom:j}=y();if(!j)return Promise.resolve(!1);const _=typeof(w==null?void 0:w.zoom)<"u"?w.zoom:C;return await j.setViewport({x:x/2-k*_,y:N/2-g*_,zoom:_},{duration:w==null?void 0:w.duration,ease:w==null?void 0:w.ease,interpolate:w==null?void 0:w.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{h({connection:{...xE}})},updateConnection:k=>{h({connection:k})},reset:()=>h({...PS()})}},Object.is);function Uw({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:i,initialMinZoom:a,initialMaxZoom:l,initialFitViewOptions:c,fitView:u,nodeOrigin:p,nodeExtent:f,zIndexMode:d,children:h}){const[y]=m.useState(()=>X4({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:u,minZoom:a,maxZoom:l,fitViewOptions:c,nodeOrigin:p,nodeExtent:f,zIndexMode:d}));return o.jsx(y3,{value:y,children:o.jsx(F3,{children:h})})}function Q4({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:s,width:i,height:a,fitView:l,fitViewOptions:c,minZoom:u,maxZoom:p,nodeOrigin:f,nodeExtent:d,zIndexMode:h}){return m.useContext(Eh)?o.jsx(o.Fragment,{children:e}):o.jsx(Uw,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:s,initialWidth:i,initialHeight:a,fitView:l,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:p,nodeOrigin:f,nodeExtent:d,zIndexMode:h,children:e})}const Z4={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function e5({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i,edgeTypes:a,onNodeClick:l,onEdgeClick:c,onInit:u,onMove:p,onMoveStart:f,onMoveEnd:d,onConnect:h,onConnectStart:y,onConnectEnd:b,onClickConnectStart:k,onClickConnectEnd:g,onNodeMouseEnter:w,onNodeMouseMove:x,onNodeMouseLeave:N,onNodeContextMenu:C,onNodeDoubleClick:j,onNodeDragStart:_,onNodeDrag:A,onNodeDragStop:F,onNodesDelete:V,onEdgesDelete:z,onDelete:D,onSelectionChange:R,onSelectionDragStart:T,onSelectionDrag:$,onSelectionDragStop:M,onSelectionContextMenu:O,onSelectionStart:P,onSelectionEnd:B,onBeforeDelete:E,connectionMode:q,connectionLineType:W=so.Bezier,connectionLineStyle:L,connectionLineComponent:X,connectionLineContainerStyle:se,deleteKeyCode:ae="Backspace",selectionKeyCode:me="Shift",selectionOnDrag:re=!1,selectionMode:de=Pu.Full,panActivationKeyCode:ne="Space",multiSelectionKeyCode:ue=Tu()?"Meta":"Control",zoomActivationKeyCode:fe=Tu()?"Meta":"Control",snapToGrid:ve,snapGrid:$e,onlyRenderVisibleElements:We=!1,selectNodesOnDrag:Pe,nodesDraggable:Ue,autoPanOnNodeFocus:pt,nodesConnectable:Te,nodesFocusable:et,nodeOrigin:Yt=eA,edgesFocusable:jt,edgesReconnectable:$t,elementsSelectable:Ht=!0,defaultViewport:Xe=P3,minZoom:oe=.5,maxZoom:ke=2,translateExtent:Se=Au,preventScrolling:qe=!0,nodeExtent:Ze,defaultMarkerColor:kt="#b1b1b7",zoomOnScroll:Z=!0,zoomOnPinch:xe=!0,panOnScroll:He=!1,panOnScrollSpeed:Ce=.5,panOnScrollMode:nt=ea.Free,zoomOnDoubleClick:ht=!0,panOnDrag:un=!0,onPaneClick:_r,onPaneMouseEnter:Wn,onPaneMouseMove:Vn,onPaneMouseLeave:Kn,onPaneScroll:hn,onPaneContextMenu:Un,paneClickDistance:Pn=1,nodeClickDistance:hr=0,children:In,onReconnect:Ln,onReconnectStart:ir,onReconnectEnd:Zn,onEdgeContextMenu:Er,onEdgeDoubleClick:On,onEdgeMouseEnter:Hr,onEdgeMouseMove:mr,onEdgeMouseLeave:Br,reconnectRadius:bn=10,onNodesChange:nn,onEdgesChange:er,noDragClassName:qn="nodrag",noWheelClassName:gr="nowheel",noPanClassName:Bt="nopan",fitView:te,fitViewOptions:be,connectOnClick:st,attributionPosition:wt,proOptions:rn,defaultEdgeOptions:Cn,elevateNodesOnSelect:kn=!0,elevateEdgesOnSelect:Dn=!1,disableKeyboardA11y:Ve=!1,autoPanOnConnect:Lt,autoPanOnNodeDrag:Ie,autoPanSpeed:Wt,connectionRadius:Ye,isValidConnection:or,onError:Wr,style:Vr,id:is,nodeDragThreshold:ee,connectionDragThreshold:Ne,viewport:ie,onViewportChange:Dt,width:Gt,height:vn,colorMode:xs="light",debug:Sn,onScroll:Ar,ariaLabelConfig:os,zIndexMode:K="basic",...pe},Re){const Ee=is||"1",Je=M3(xs),Jt=m.useCallback(Ct=>{Ct.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Ar==null||Ar(Ct)},[Ar]);return o.jsx("div",{"data-testid":"rf__wrapper",...pe,onScroll:Jt,style:{...Vr,...Z4},ref:Re,className:$n(["react-flow",s,Je]),id:is,role:"application",children:o.jsxs(Q4,{nodes:e,edges:t,width:Gt,height:vn,fitView:te,fitViewOptions:be,minZoom:oe,maxZoom:ke,nodeOrigin:Yt,nodeExtent:Ze,zIndexMode:K,children:[o.jsx(R3,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:y,onConnectEnd:b,onClickConnectStart:k,onClickConnectEnd:g,nodesDraggable:Ue,autoPanOnNodeFocus:pt,nodesConnectable:Te,nodesFocusable:et,edgesFocusable:jt,edgesReconnectable:$t,elementsSelectable:Ht,elevateNodesOnSelect:kn,elevateEdgesOnSelect:Dn,minZoom:oe,maxZoom:ke,nodeExtent:Ze,onNodesChange:nn,onEdgesChange:er,snapToGrid:ve,snapGrid:$e,connectionMode:q,translateExtent:Se,connectOnClick:st,defaultEdgeOptions:Cn,fitView:te,fitViewOptions:be,onNodesDelete:V,onEdgesDelete:z,onDelete:D,onNodeDragStart:_,onNodeDrag:A,onNodeDragStop:F,onSelectionDrag:$,onSelectionDragStart:T,onSelectionDragStop:M,onMove:p,onMoveStart:f,onMoveEnd:d,noPanClassName:Bt,nodeOrigin:Yt,rfId:Ee,autoPanOnConnect:Lt,autoPanOnNodeDrag:Ie,autoPanSpeed:Wt,onError:Wr,connectionRadius:Ye,isValidConnection:or,selectNodesOnDrag:Pe,nodeDragThreshold:ee,connectionDragThreshold:Ne,onBeforeDelete:E,debug:Sn,ariaLabelConfig:os,zIndexMode:K}),o.jsx(J4,{onInit:u,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:w,onNodeMouseMove:x,onNodeMouseLeave:N,onNodeContextMenu:C,onNodeDoubleClick:j,nodeTypes:i,edgeTypes:a,connectionLineType:W,connectionLineStyle:L,connectionLineComponent:X,connectionLineContainerStyle:se,selectionKeyCode:me,selectionOnDrag:re,selectionMode:de,deleteKeyCode:ae,multiSelectionKeyCode:ue,panActivationKeyCode:ne,zoomActivationKeyCode:fe,onlyRenderVisibleElements:We,defaultViewport:Xe,translateExtent:Se,minZoom:oe,maxZoom:ke,preventScrolling:qe,zoomOnScroll:Z,zoomOnPinch:xe,zoomOnDoubleClick:ht,panOnScroll:He,panOnScrollSpeed:Ce,panOnScrollMode:nt,panOnDrag:un,onPaneClick:_r,onPaneMouseEnter:Wn,onPaneMouseMove:Vn,onPaneMouseLeave:Kn,onPaneScroll:hn,onPaneContextMenu:Un,paneClickDistance:Pn,nodeClickDistance:hr,onSelectionContextMenu:O,onSelectionStart:P,onSelectionEnd:B,onReconnect:Ln,onReconnectStart:ir,onReconnectEnd:Zn,onEdgeContextMenu:Er,onEdgeDoubleClick:On,onEdgeMouseEnter:Hr,onEdgeMouseMove:mr,onEdgeMouseLeave:Br,reconnectRadius:bn,defaultMarkerColor:kt,noDragClassName:qn,noWheelClassName:gr,noPanClassName:Bt,rfId:Ee,disableKeyboardA11y:Ve,nodeExtent:Ze,viewport:ie,onViewportChange:Dt}),o.jsx(A3,{onSelectionChange:R}),In,o.jsx(N3,{proOptions:rn,position:wt}),o.jsx(S3,{rfId:Ee,disableKeyboardA11y:Ve})]})})}var CA=nA(e5);function t5(){const e=cn();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 n5(e){const[t,n]=m.useState(e),r=m.useCallback(s=>n(i=>Lp(s,i)),[]);return[t,n,r]}function r5(e){const[t,n]=m.useState(e),r=m.useCallback(s=>n(i=>Vw(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:$n(["react-flow__background-pattern",n,r])})}function i5({radius:e,className:t}){return o.jsx("circle",{cx:e,cy:e,r:e,className:$n(["react-flow__background-pattern","dots",t])})}var xo;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(xo||(xo={}));const o5={[xo.Dots]:1,[xo.Lines]:1,[xo.Cross]:6},a5=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function _A({id:e,variant:t=xo.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=0,color:a,bgColor:l,style:c,className:u,patternClassName:p}){const f=m.useRef(null),{transform:d,patternId:h}=At(a5,pn),y=r||o5[t],b=t===xo.Dots,k=t===xo.Cross,g=Array.isArray(n)?n:[n,n],w=[g[0]*d[2]||1,g[1]*d[2]||1],x=y*d[2],N=Array.isArray(i)?i:[i,i],C=k?[x,x]:w,j=[N[0]*d[2]||1+C[0]/2,N[1]*d[2]||1+C[1]/2],_=`${h}${e||""}`;return o.jsxs("svg",{className:$n(["react-flow__background",u]),style:{...c,...Ph,"--xy-background-color-props":l,"--xy-background-pattern-color-props":a},ref:f,"data-testid":"rf__background",children:[o.jsx("pattern",{id:_,x:d[0]%w[0],y:d[1]%w[1],width:w[0],height:w[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${j[0]},-${j[1]})`,children:b?o.jsx(i5,{radius:x/2,className:p}):o.jsx(s5,{dimensions:C,lineWidth:s,variant:t,className:p})}),o.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${_})`})]})}_A.displayName="Background";const EA=m.memo(_A);function l5(){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 c5(){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 u5(){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 d5(){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 f5(){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 pf({children:e,className:t,...n}){return o.jsx("button",{type:"button",className:$n(["react-flow__controls-button",t]),...n,children:e})}const p5=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function AA({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:a,onFitView:l,onInteractiveChange:c,className:u,children:p,position:f="bottom-left",orientation:d="vertical","aria-label":h}){const y=cn(),{isInteractive:b,minZoomReached:k,maxZoomReached:g,ariaLabelConfig:w}=At(p5,pn),{zoomIn:x,zoomOut:N,fitView:C}=Vl(),j=()=>{x(),i==null||i()},_=()=>{N(),a==null||a()},A=()=>{C(s),l==null||l()},F=()=>{y.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),c==null||c(!b)},V=d==="horizontal"?"horizontal":"vertical";return o.jsxs(Ah,{className:$n(["react-flow__controls",V,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":h??w["controls.ariaLabel"],children:[t&&o.jsxs(o.Fragment,{children:[o.jsx(pf,{onClick:j,className:"react-flow__controls-zoomin",title:w["controls.zoomIn.ariaLabel"],"aria-label":w["controls.zoomIn.ariaLabel"],disabled:g,children:o.jsx(l5,{})}),o.jsx(pf,{onClick:_,className:"react-flow__controls-zoomout",title:w["controls.zoomOut.ariaLabel"],"aria-label":w["controls.zoomOut.ariaLabel"],disabled:k,children:o.jsx(c5,{})})]}),n&&o.jsx(pf,{className:"react-flow__controls-fitview",onClick:A,title:w["controls.fitView.ariaLabel"],"aria-label":w["controls.fitView.ariaLabel"],children:o.jsx(u5,{})}),r&&o.jsx(pf,{className:"react-flow__controls-interactive",onClick:F,title:w["controls.interactive.ariaLabel"],"aria-label":w["controls.interactive.ariaLabel"],children:b?o.jsx(f5,{}):o.jsx(d5,{})}),p]})}AA.displayName="Controls";m.memo(AA);function h5({id:e,x:t,y:n,width:r,height:s,style:i,color:a,strokeColor:l,strokeWidth:c,className:u,borderRadius:p,shapeRendering:f,selected:d,onClick:h}){const{background:y,backgroundColor:b}=i||{},k=a||y||b;return o.jsx("rect",{className:$n(["react-flow__minimap-node",{selected:d},u]),x:t,y:n,rx:p,ry:p,width:r,height:s,style:{fill:k,stroke:l,strokeWidth:c},shapeRendering:f,onClick:h?g=>h(g,e):void 0})}const m5=m.memo(h5),g5=e=>e.nodes.map(t=>t.id),tg=e=>e instanceof Function?e:()=>e;function y5({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:i=m5,onClick:a}){const l=At(g5,pn),c=tg(t),u=tg(e),p=tg(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return o.jsx(o.Fragment,{children:l.map(d=>o.jsx(w5,{id:d,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:p,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:i,onClick:a,shapeRendering:f},d))})}function x5({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:i,shapeRendering:a,NodeComponent:l,onClick:c}){const{node:u,x:p,y:f,width:d,height:h}=At(y=>{const b=y.nodeLookup.get(e);if(!b)return{node:void 0,x:0,y:0,width:0,height:0};const k=b.internals.userNode,{x:g,y:w}=b.internals.positionAbsolute,{width:x,height:N}=Oi(k);return{node:k,x:g,y:w,width:x,height:N}},pn);return!u||u.hidden||!jE(u)?null:o.jsx(l,{x:p,y:f,width:d,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 w5=m.memo(x5);var b5=m.memo(y5);const k5=200,v5=150,S5=e=>!e.hidden,N5=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?NE(td(e.nodeLookup,{filter:S5}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},j5="react-flow__minimap-desc";function PA({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:a,nodeComponent:l,bgColor:c,maskColor:u,maskStrokeColor:p,maskStrokeWidth:f,position:d="bottom-right",onClick:h,onNodeClick:y,pannable:b=!1,zoomable:k=!1,ariaLabel:g,inversePan:w,zoomStep:x=1,offsetScale:N=5}){const C=cn(),j=m.useRef(null),{boundingRect:_,viewBB:A,rfId:F,panZoom:V,translateExtent:z,flowWidth:D,flowHeight:R,ariaLabelConfig:T}=At(N5,pn),$=(e==null?void 0:e.width)??k5,M=(e==null?void 0:e.height)??v5,O=_.width/$,P=_.height/M,B=Math.max(O,P),E=B*$,q=B*M,W=N*B,L=_.x-(E-_.width)/2-W,X=_.y-(q-_.height)/2-W,se=E+W*2,ae=q+W*2,me=`${j5}-${F}`,re=m.useRef(0),de=m.useRef();re.current=B,m.useEffect(()=>{if(j.current&&V)return de.current=Iz({domNode:j.current,panZoom:V,getTransform:()=>C.getState().transform,getViewScale:()=>re.current}),()=>{var ve;(ve=de.current)==null||ve.destroy()}},[V]),m.useEffect(()=>{var ve;(ve=de.current)==null||ve.update({translateExtent:z,width:D,height:R,inversePan:w,pannable:b,zoomStep:x,zoomable:k})},[b,k,w,x,z,D,R]);const ne=h?ve=>{var Pe;const[$e,We]=((Pe=de.current)==null?void 0:Pe.pointer(ve))||[0,0];h(ve,{x:$e,y:We})}:void 0,ue=y?m.useCallback((ve,$e)=>{const We=C.getState().nodeLookup.get($e).internals.userNode;y(ve,We)},[]):void 0,fe=g??T["minimap.ariaLabel"];return o.jsx(Ah,{position:d,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 p=="string"?p:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*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:$n(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:o.jsxs("svg",{width:$,height:M,viewBox:`${L} ${X} ${se} ${ae}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":me,ref:j,onClick:ne,children:[fe&&o.jsx("title",{id:me,children:fe}),o.jsx(b5,{onClick:ue,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:a,nodeComponent:l}),o.jsx("path",{className:"react-flow__minimap-mask",d:`M${L-W},${X-W}h${se+W*2}v${ae+W*2}h${-se-W*2}z
|
|
66
|
-
M${A.x},${A.y}h${A.width}v${A.height}h${-A.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}PA.displayName="MiniMap";m.memo(PA);const C5=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,_5={[Ll.Line]:"right",[Ll.Handle]:"bottom-right"};function E5({nodeId:e,position:t,variant:n=Ll.Handle,className:r,style:s=void 0,children:i,color:a,minWidth:l=10,minHeight:c=10,maxWidth:u=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:d,autoScale:h=!0,shouldResize:y,onResizeStart:b,onResize:k,onResizeEnd:g}){const w=oA(),x=typeof e=="string"?e:w,N=cn(),C=m.useRef(null),j=n===Ll.Handle,_=At(m.useCallback(C5(j&&h),[j,h]),pn),A=m.useRef(null),F=t??_5[n];m.useEffect(()=>{if(!(!C.current||!x))return A.current||(A.current=Kz({domNode:C.current,nodeId:x,getStoreItems:()=>{const{nodeLookup:z,transform:D,snapGrid:R,snapToGrid:T,nodeOrigin:$,domNode:M}=N.getState();return{nodeLookup:z,transform:D,snapGrid:R,snapToGrid:T,nodeOrigin:$,paneDomNode:M}},onChange:(z,D)=>{const{triggerNodeChanges:R,nodeLookup:T,parentLookup:$,nodeOrigin:M}=N.getState(),O=[],P={x:z.x,y:z.y},B=T.get(x);if(B&&B.expandParent&&B.parentId){const E=B.origin??M,q=z.width??B.measured.width??0,W=z.height??B.measured.height??0,L={id:B.id,parentId:B.parentId,rect:{width:q,height:W,...CE({x:z.x??B.position.x,y:z.y??B.position.y},{width:q,height:W},B.parentId,T,E)}},X=Ww([L],T,$,M);O.push(...X),P.x=z.x?Math.max(E[0]*q,z.x):void 0,P.y=z.y?Math.max(E[1]*W,z.y):void 0}if(P.x!==void 0&&P.y!==void 0){const E={id:x,type:"position",position:{...P}};O.push(E)}if(z.width!==void 0&&z.height!==void 0){const q={id:x,type:"dimensions",resizing:!0,setAttributes:d?d==="horizontal"?"width":"height":!0,dimensions:{width:z.width,height:z.height}};O.push(q)}for(const E of D){const q={...E,type:"position"};O.push(q)}R(O)},onEnd:({width:z,height:D})=>{const R={id:x,type:"dimensions",resizing:!1,dimensions:{width:z,height:D}};N.getState().triggerNodeChanges([R])}})),A.current.update({controlPosition:F,boundaries:{minWidth:l,minHeight:c,maxWidth:u,maxHeight:p},keepAspectRatio:f,resizeDirection:d,onResizeStart:b,onResize:k,onResizeEnd:g,shouldResize:y}),()=>{var z;(z=A.current)==null||z.destroy()}},[F,l,c,u,p,f,b,k,g,y]);const V=F.split("-");return o.jsx("div",{className:$n(["react-flow__resize-control","nodrag",...V,n,r]),ref:C,style:{...s,scale:_,...a&&{[j?"backgroundColor":"borderColor"]:a}},children:i})}const qw=m.memo(E5),A5="modulepreload",P5=function(e){return"/"+e},IS={},I5=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=P5(c),c in IS)return;IS[c]=!0;const u=c.endsWith(".css"),p=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${p}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":A5,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((d,h)=>{f.addEventListener("load",d),f.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 T5(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const R5=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,M5=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,$5={};function TS(e,t){return($5.jsx?M5:R5).test(e)}const L5=/[ \t\n\f\r]/g;function O5(e){return typeof e=="object"?e.type==="text"?RS(e.value):!1:RS(e)}function RS(e){return e.replace(L5,"")===""}class sd{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}sd.prototype.normal={};sd.prototype.property={};sd.prototype.space=void 0;function IA(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new sd(n,r,t)}function Zy(e){return e.toLowerCase()}class zr{constructor(t,n){this.attribute=n,this.property=t}}zr.prototype.attribute="";zr.prototype.booleanish=!1;zr.prototype.boolean=!1;zr.prototype.commaOrSpaceSeparated=!1;zr.prototype.commaSeparated=!1;zr.prototype.defined=!1;zr.prototype.mustUseProperty=!1;zr.prototype.number=!1;zr.prototype.overloadedBoolean=!1;zr.prototype.property="";zr.prototype.spaceSeparated=!1;zr.prototype.space=void 0;let D5=0;const gt=ka(),Tn=ka(),ex=ka(),_e=ka(),Zt=ka(),xl=ka(),qr=ka();function ka(){return 2**++D5}const tx=Object.freeze(Object.defineProperty({__proto__:null,boolean:gt,booleanish:Tn,commaOrSpaceSeparated:qr,commaSeparated:xl,number:_e,overloadedBoolean:ex,spaceSeparated:Zt},Symbol.toStringTag,{value:"Module"})),ng=Object.keys(tx);class Yw extends zr{constructor(t,n,r,s){let i=-1;if(super(t,n),MS(this,"space",s),typeof r=="number")for(;++i<ng.length;){const a=ng[i];MS(this,ng[i],(r&tx[a])===tx[a])}}}Yw.prototype.defined=!0;function MS(e,t,n){n&&(e[t]=n)}function Kl(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new Yw(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[Zy(r)]=r,n[Zy(i.attribute)]=r}return new sd(t,n,e.space)}const TA=Kl({properties:{ariaActiveDescendant:null,ariaAtomic:Tn,ariaAutoComplete:null,ariaBusy:Tn,ariaChecked:Tn,ariaColCount:_e,ariaColIndex:_e,ariaColSpan:_e,ariaControls:Zt,ariaCurrent:null,ariaDescribedBy:Zt,ariaDetails:null,ariaDisabled:Tn,ariaDropEffect:Zt,ariaErrorMessage:null,ariaExpanded:Tn,ariaFlowTo:Zt,ariaGrabbed:Tn,ariaHasPopup:null,ariaHidden:Tn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Zt,ariaLevel:_e,ariaLive:null,ariaModal:Tn,ariaMultiLine:Tn,ariaMultiSelectable:Tn,ariaOrientation:null,ariaOwns:Zt,ariaPlaceholder:null,ariaPosInSet:_e,ariaPressed:Tn,ariaReadOnly:Tn,ariaRelevant:null,ariaRequired:Tn,ariaRoleDescription:Zt,ariaRowCount:_e,ariaRowIndex:_e,ariaRowSpan:_e,ariaSelected:Tn,ariaSetSize:_e,ariaSort:null,ariaValueMax:_e,ariaValueMin:_e,ariaValueNow:_e,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function RA(e,t){return t in e?e[t]:t}function MA(e,t){return RA(e,t.toLowerCase())}const F5=Kl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:xl,acceptCharset:Zt,accessKey:Zt,action:null,allow:null,allowFullScreen:gt,allowPaymentRequest:gt,allowUserMedia:gt,alt:null,as:null,async:gt,autoCapitalize:null,autoComplete:Zt,autoFocus:gt,autoPlay:gt,blocking:Zt,capture:null,charSet:null,checked:gt,cite:null,className:Zt,cols:_e,colSpan:null,content:null,contentEditable:Tn,controls:gt,controlsList:Zt,coords:_e|xl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:gt,defer:gt,dir:null,dirName:null,disabled:gt,download:ex,draggable:Tn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:gt,formTarget:null,headers:Zt,height:_e,hidden:ex,high:_e,href:null,hrefLang:null,htmlFor:Zt,httpEquiv:Zt,id:null,imageSizes:null,imageSrcSet:null,inert:gt,inputMode:null,integrity:null,is:null,isMap:gt,itemId:null,itemProp:Zt,itemRef:Zt,itemScope:gt,itemType:Zt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:gt,low:_e,manifest:null,max:null,maxLength:_e,media:null,method:null,min:null,minLength:_e,multiple:gt,muted:gt,name:null,nonce:null,noModule:gt,noValidate:gt,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:gt,optimum:_e,pattern:null,ping:Zt,placeholder:null,playsInline:gt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:gt,referrerPolicy:null,rel:Zt,required:gt,reversed:gt,rows:_e,rowSpan:_e,sandbox:Zt,scope:null,scoped:gt,seamless:gt,selected:gt,shadowRootClonable:gt,shadowRootDelegatesFocus:gt,shadowRootMode:null,shape:null,size:_e,sizes:null,slot:null,span:_e,spellCheck:Tn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:_e,step:null,style:null,tabIndex:_e,target:null,title:null,translate:null,type:null,typeMustMatch:gt,useMap:null,value:Tn,width:_e,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Zt,axis:null,background:null,bgColor:null,border:_e,borderColor:null,bottomMargin:_e,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:gt,declare:gt,event:null,face:null,frame:null,frameBorder:null,hSpace:_e,leftMargin:_e,link:null,longDesc:null,lowSrc:null,marginHeight:_e,marginWidth:_e,noResize:gt,noHref:gt,noShade:gt,noWrap:gt,object:null,profile:null,prompt:null,rev:null,rightMargin:_e,rules:null,scheme:null,scrolling:Tn,standby:null,summary:null,text:null,topMargin:_e,valueType:null,version:null,vAlign:null,vLink:null,vSpace:_e,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:gt,disableRemotePlayback:gt,prefix:null,property:null,results:_e,security:null,unselectable:null},space:"html",transform:MA}),z5=Kl({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:_e,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:_e,amplitude:_e,arabicForm:null,ascent:_e,attributeName:null,attributeType:null,azimuth:_e,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:_e,by:null,calcMode:null,capHeight:_e,className:Zt,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:_e,diffuseConstant:_e,direction:null,display:null,dur:null,divisor:_e,dominantBaseline:null,download:gt,dx:null,dy:null,edgeMode:null,editable:null,elevation:_e,enableBackground:null,end:null,event:null,exponent:_e,externalResourcesRequired:null,fill:null,fillOpacity:_e,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:xl,g2:xl,glyphName:xl,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:_e,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:_e,horizOriginX:_e,horizOriginY:_e,id:null,ideographic:_e,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:_e,k:_e,k1:_e,k2:_e,k3:_e,k4:_e,kernelMatrix:qr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:_e,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:_e,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:_e,overlineThickness:_e,paintOrder:null,panose1:null,path:null,pathLength:_e,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Zt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:_e,pointsAtY:_e,pointsAtZ:_e,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:_e,specularExponent:_e,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:_e,strikethroughThickness:_e,string:null,stroke:null,strokeDashArray:qr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:_e,strokeOpacity:_e,strokeWidth:null,style:null,surfaceScale:_e,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:qr,tabIndex:_e,tableValues:null,target:null,targetX:_e,targetY:_e,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:_e,underlineThickness:_e,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:_e,values:null,vAlphabetic:_e,vMathematical:_e,vectorEffect:null,vHanging:_e,vIdeographic:_e,version:null,vertAdvY:_e,vertOriginX:_e,vertOriginY:_e,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:_e,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:RA}),$A=Kl({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()}}),LA=Kl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:MA}),OA=Kl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),H5={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"},B5=/[A-Z]/g,$S=/-[a-z]/g,W5=/^data[-\w.:]+$/i;function V5(e,t){const n=Zy(t);let r=t,s=zr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&W5.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace($S,U5);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!$S.test(i)){let a=i.replace(B5,K5);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}s=Yw}return new s(r,t)}function K5(e){return"-"+e.toLowerCase()}function U5(e){return e.charAt(1).toUpperCase()}const q5=IA([TA,F5,$A,LA,OA],"html"),Gw=IA([TA,z5,$A,LA,OA],"svg");function Y5(e){return e.join(" ").trim()}var Jw={},LS=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,G5=/\n/g,J5=/^\s*/,X5=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Q5=/^:\s*/,Z5=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,eH=/^[;\s]*/,tH=/^\s+|\s+$/g,nH=`
|
|
67
|
-
`,OS="/",DS="*",Bo="",rH="comment",sH="declaration";function iH(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(y){var b=y.match(G5);b&&(n+=b.length);var k=y.lastIndexOf(nH);r=~k?y.length-k:r+y.length}function i(){var y={line:n,column:r};return function(b){return b.position=new a(y),u(),b}}function a(y){this.start=y,this.end={line:n,column:r},this.source=t.source}a.prototype.content=e;function l(y){var b=new Error(t.source+":"+n+":"+r+": "+y);if(b.reason=y,b.filename=t.source,b.line=n,b.column=r,b.source=e,!t.silent)throw b}function c(y){var b=y.exec(e);if(b){var k=b[0];return s(k),e=e.slice(k.length),b}}function u(){c(J5)}function p(y){var b;for(y=y||[];b=f();)b!==!1&&y.push(b);return y}function f(){var y=i();if(!(OS!=e.charAt(0)||DS!=e.charAt(1))){for(var b=2;Bo!=e.charAt(b)&&(DS!=e.charAt(b)||OS!=e.charAt(b+1));)++b;if(b+=2,Bo===e.charAt(b-1))return l("End of comment missing");var k=e.slice(2,b-2);return r+=2,s(k),e=e.slice(b),r+=2,y({type:rH,comment:k})}}function d(){var y=i(),b=c(X5);if(b){if(f(),!c(Q5))return l("property missing ':'");var k=c(Z5),g=y({type:sH,property:FS(b[0].replace(LS,Bo)),value:k?FS(k[0].replace(LS,Bo)):Bo});return c(eH),g}}function h(){var y=[];p(y);for(var b;b=d();)b!==!1&&(y.push(b),p(y));return y}return u(),h()}function FS(e){return e?e.replace(tH,Bo):Bo}var oH=iH,aH=au&&au.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Jw,"__esModule",{value:!0});Jw.default=cH;const lH=aH(oH);function cH(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,lH.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 Th={};Object.defineProperty(Th,"__esModule",{value:!0});Th.camelCase=void 0;var uH=/^--[a-zA-Z0-9_-]+$/,dH=/-([a-z])/g,fH=/^[^-]+$/,pH=/^-(webkit|moz|ms|o|khtml)-/,hH=/^-(ms)-/,mH=function(e){return!e||fH.test(e)||uH.test(e)},gH=function(e,t){return t.toUpperCase()},zS=function(e,t){return"".concat(t,"-")},yH=function(e,t){return t===void 0&&(t={}),mH(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(hH,zS):e=e.replace(pH,zS),e.replace(dH,gH))};Th.camelCase=yH;var xH=au&&au.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},wH=xH(Jw),bH=Th;function nx(e,t){var n={};return!e||typeof e!="string"||(0,wH.default)(e,function(r,s){r&&s&&(n[(0,bH.camelCase)(r,t)]=s)}),n}nx.default=nx;var kH=nx;const vH=Co(kH),DA=FA("end"),Xw=FA("start");function FA(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 SH(e){const t=Xw(e),n=DA(e);if(t&&n)return{start:t,end:n}}function eu(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?HS(e.position):"start"in e||"end"in e?HS(e):"line"in e||"column"in e?rx(e):""}function rx(e){return BS(e&&e.line)+":"+BS(e&&e.column)}function HS(e){return rx(e&&e.start)+"-"+rx(e&&e.end)}function BS(e){return e&&typeof e=="number"?e:1}class pr 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=eu(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}}pr.prototype.file="";pr.prototype.name="";pr.prototype.reason="";pr.prototype.message="";pr.prototype.stack="";pr.prototype.column=void 0;pr.prototype.line=void 0;pr.prototype.ancestors=void 0;pr.prototype.cause=void 0;pr.prototype.fatal=void 0;pr.prototype.place=void 0;pr.prototype.ruleId=void 0;pr.prototype.source=void 0;const Qw={}.hasOwnProperty,NH=new Map,jH=/[A-Z]/g,CH=new Set(["table","tbody","thead","tfoot","tr"]),_H=new Set(["td","th"]),zA="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function EH(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=LH(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=$H(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"?Gw:q5,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=HA(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function HA(e,t,n){if(t.type==="element")return AH(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return PH(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return TH(e,t,n);if(t.type==="mdxjsEsm")return IH(e,t);if(t.type==="root")return RH(e,t,n);if(t.type==="text")return MH(e,t)}function AH(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Gw,e.schema=s),e.ancestors.push(t);const i=WA(e,t.tagName,!1),a=OH(e,t);let l=eb(e,t);return CH.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!O5(c):!0})),BA(e,a,i,t),Zw(a,l),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function PH(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)}Mu(e,t.position)}function IH(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Mu(e,t.position)}function TH(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=Gw,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:WA(e,t.name,!0),a=DH(e,t),l=eb(e,t);return BA(e,a,i,t),Zw(a,l),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function RH(e,t,n){const r={};return Zw(r,eb(e,t)),e.create(t,e.Fragment,r,n)}function MH(e,t){return t.value}function BA(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Zw(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function $H(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 LH(e,t){return n;function n(r,s,i,a){const l=Array.isArray(i.children),c=Xw(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 OH(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&Qw.call(t.properties,s)){const i=FH(e,s,t.properties[s]);if(i){const[a,l]=i;e.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&_H.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 DH(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 Mu(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 Mu(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function eb(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:NH;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=HA(e,i,a);l!==void 0&&n.push(l)}return n}function FH(e,t,n){const r=V5(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?T5(n):Y5(n)),r.property==="style"){let s=typeof n=="object"?n:zH(e,String(n));return e.stylePropertyNameCase==="css"&&(s=HH(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?H5[r.property]||r.property:r.attribute,n]}}function zH(e,t){try{return vH(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new pr("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=zA+"#cannot-parse-style-attribute",s}}function WA(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=TS(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=TS(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return Qw.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);Mu(e)}function Mu(e,t){const n=new pr("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=zA+"#cannot-handle-mdx-estrees-without-createevaluater",n}function HH(e){const t={};let n;for(n in e)Qw.call(e,n)&&(t[BH(n)]=e[n]);return t}function BH(e){let t=e.replace(jH,WH);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function WH(e){return"-"+e.toLowerCase()}const rg={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"]},VH={};function KH(e,t){const n=VH,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return VA(e,r,s)}function VA(e,t,n){if(UH(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 WS(e.children,t,n)}return Array.isArray(e)?WS(e,t,n):""}function WS(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=VA(e[s],t,n);return r.join("")}function UH(e){return!!(e&&typeof e=="object")}const VS=document.createElement("i");function tb(e){const t="&"+e+";";VS.innerHTML=t;const n=VS.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function ci(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 fs(e,t){return e.length>0?(ci(e,e.length,0,t),e):t}const KS={}.hasOwnProperty;function qH(e){const t={};let n=-1;for(;++n<e.length;)YH(t,e[n]);return t}function YH(e,t){let n;for(n in t){const s=(KS.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let a;if(i)for(a in i){KS.call(s,a)||(s[a]=[]);const l=i[a];GH(s[a],Array.isArray(l)?l:l?[l]:[])}}}function GH(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);ci(e,0,0,r)}function KA(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 wl(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ti=Po(/[A-Za-z]/),Qr=Po(/[\dA-Za-z]/),JH=Po(/[#-'*+\--9=?A-Z^-~]/);function sx(e){return e!==null&&(e<32||e===127)}const ix=Po(/\d/),XH=Po(/[\dA-Fa-f]/),QH=Po(/[!-/:-@[-`{-~]/);function lt(e){return e!==null&&e<-2}function Fr(e){return e!==null&&(e<0||e===32)}function Ot(e){return e===-2||e===-1||e===32}const ZH=Po(new RegExp("\\p{P}|\\p{S}","u")),eB=Po(/\s/);function Po(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ul(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const i=e.charCodeAt(n);let a="";if(i===37&&Qr(e.charCodeAt(n+1))&&Qr(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 tn(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(c){return Ot(c)?(e.enter(n),l(c)):t(c)}function l(c){return Ot(c)&&i++<s?(e.consume(c),l):(e.exit(n),t(c))}}const tB={tokenize:nB};function nB(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"),tn(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 lt(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),a)}}const rB={tokenize:sB},US={tokenize:iB};function sB(e){const t=this,n=[];let r=0,s,i,a;return l;function l(x){if(r<n.length){const N=n[r];return t.containerState=N[1],e.attempt(N[0].continuation,c,u)(x)}return u(x)}function c(x){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&w();const N=t.events.length;let C=N,j;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){j=t.events[C][1].end;break}g(r);let _=N;for(;_<t.events.length;)t.events[_][1].end={...j},_++;return ci(t.events,C+1,0,t.events.slice(N)),t.events.length=_,u(x)}return l(x)}function u(x){if(r===n.length){if(!s)return d(x);if(s.currentConstruct&&s.currentConstruct.concrete)return y(x);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(US,p,f)(x)}function p(x){return s&&w(),g(r),d(x)}function f(x){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,y(x)}function d(x){return t.containerState={},e.attempt(US,h,y)(x)}function h(x){return r++,n.push([t.currentConstruct,t.containerState]),d(x)}function y(x){if(x===null){s&&w(),g(0),e.consume(x);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),b(x)}function b(x){if(x===null){k(e.exit("chunkFlow"),!0),g(0),e.consume(x);return}return lt(x)?(e.consume(x),k(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(x),b)}function k(x,N){const C=t.sliceStream(x);if(N&&C.push(null),x.previous=i,i&&(i.next=x),i=x,s.defineSkip(x.start),s.write(C),t.parser.lazy[x.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 _=t.events.length;let A=_,F,V;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){if(F){V=t.events[A][1].end;break}F=!0}for(g(r),j=_;j<t.events.length;)t.events[j][1].end={...V},j++;ci(t.events,A+1,0,t.events.slice(_)),t.events.length=j}}function g(x){let N=n.length;for(;N-- >x;){const C=n[N];t.containerState=C[1],C[0].exit.call(t,e)}n.length=x}function w(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function iB(e,t,n){return tn(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function qS(e){if(e===null||Fr(e)||eB(e))return 1;if(ZH(e))return 2}function nb(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 ox={name:"attention",resolveAll:oB,tokenize:aB};function oB(e,t){let n=-1,r,s,i,a,l,c,u,p;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;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 f={...e[r][1].end},d={...e[n][1].start};YS(f,-c),YS(d,c),a={type:c>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:d},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=fs(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=fs(u,[["enter",s,t],["enter",a,t],["exit",a,t],["enter",i,t]]),u=fs(u,nb(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=fs(u,[["exit",i,t],["enter",l,t],["exit",l,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,u=fs(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,ci(e,r-1,n-r+3,u),n=r+u.length-p-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function aB(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=qS(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"),p=qS(c),f=!p||p===2&&s||n.includes(c),d=!s||s===2&&p||n.includes(r);return u._open=!!(i===42?f:f&&(s||!d)),u._close=!!(i===42?d:d&&(p||!f)),t(c)}}function YS(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const lB={name:"autolink",tokenize:cB};function cB(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 ti(h)?(e.consume(h),a):h===64?n(h):u(h)}function a(h){return h===43||h===45||h===46||Qr(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||Qr(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||sx(h)?n(h):(e.consume(h),c)}function u(h){return h===64?(e.consume(h),p):JH(h)?(e.consume(h),u):n(h)}function p(h){return Qr(h)?f(h):n(h)}function f(h){return h===46?(e.consume(h),r=0,p):h===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):d(h)}function d(h){if((h===45||Qr(h))&&r++<63){const y=h===45?d:f;return e.consume(h),y}return n(h)}}const Rh={partial:!0,tokenize:uB};function uB(e,t,n){return r;function r(i){return Ot(i)?tn(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||lt(i)?t(i):n(i)}}const UA={continuation:{tokenize:fB},exit:pB,name:"blockQuote",tokenize:dB};function dB(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 Ot(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function fB(e,t,n){const r=this;return s;function s(a){return Ot(a)?tn(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):i(a)}function i(a){return e.attempt(UA,t,n)(a)}}function pB(e){e.exit("blockQuote")}const qA={name:"characterEscape",tokenize:hB};function hB(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 QH(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const YA={name:"characterReference",tokenize:mB};function mB(e,t,n){const r=this;let s=0,i,a;return l;function l(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),c}function c(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,a=Qr,p(f))}function u(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,a=XH,p):(e.enter("characterReferenceValue"),i=7,a=ix,p(f))}function p(f){if(f===59&&s){const d=e.exit("characterReferenceValue");return a===Qr&&!tb(r.sliceSerialize(d))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(f)&&s++<i?(e.consume(f),p):n(f)}}const GS={partial:!0,tokenize:yB},JS={concrete:!0,name:"codeFenced",tokenize:gB};function gB(e,t,n){const r=this,s={partial:!0,tokenize:C};let i=0,a=0,l;return c;function c(j){return u(j)}function u(j){const _=r.events[r.events.length-1];return i=_&&_[1].type==="linePrefix"?_[2].sliceSerialize(_[1],!0).length:0,l=j,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(j)}function p(j){return j===l?(a++,e.consume(j),p):a<3?n(j):(e.exit("codeFencedFenceSequence"),Ot(j)?tn(e,f,"whitespace")(j):f(j))}function f(j){return j===null||lt(j)?(e.exit("codeFencedFence"),r.interrupt?t(j):e.check(GS,b,N)(j)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),d(j))}function d(j){return j===null||lt(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(j)):Ot(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),tn(e,h,"whitespace")(j)):j===96&&j===l?n(j):(e.consume(j),d)}function h(j){return j===null||lt(j)?f(j):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),y(j))}function y(j){return j===null||lt(j)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(j)):j===96&&j===l?n(j):(e.consume(j),y)}function b(j){return e.attempt(s,N,k)(j)}function k(j){return e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),g}function g(j){return i>0&&Ot(j)?tn(e,w,"linePrefix",i+1)(j):w(j)}function w(j){return j===null||lt(j)?e.check(GS,b,N)(j):(e.enter("codeFlowValue"),x(j))}function x(j){return j===null||lt(j)?(e.exit("codeFlowValue"),w(j)):(e.consume(j),x)}function N(j){return e.exit("codeFenced"),t(j)}function C(j,_,A){let F=0;return V;function V($){return j.enter("lineEnding"),j.consume($),j.exit("lineEnding"),z}function z($){return j.enter("codeFencedFence"),Ot($)?tn(j,D,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):D($)}function D($){return $===l?(j.enter("codeFencedFenceSequence"),R($)):A($)}function R($){return $===l?(F++,j.consume($),R):F>=a?(j.exit("codeFencedFenceSequence"),Ot($)?tn(j,T,"whitespace")($):T($)):A($)}function T($){return $===null||lt($)?(j.exit("codeFencedFence"),_($)):A($)}}}function yB(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 sg={name:"codeIndented",tokenize:wB},xB={partial:!0,tokenize:bB};function wB(e,t,n){const r=this;return s;function s(u){return e.enter("codeIndented"),tn(e,i,"linePrefix",5)(u)}function i(u){const p=r.events[r.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?a(u):n(u)}function a(u){return u===null?c(u):lt(u)?e.attempt(xB,a,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||lt(u)?(e.exit("codeFlowValue"),a(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function bB(e,t,n){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?n(a):lt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):tn(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):lt(a)?s(a):n(a)}}const kB={name:"codeText",previous:SB,resolve:vB,tokenize:NB};function vB(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 SB(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function NB(e,t,n){let r=0,s,i;return a;function a(f){return e.enter("codeText"),e.enter("codeTextSequence"),l(f)}function l(f){return f===96?(e.consume(f),r++,l):(e.exit("codeTextSequence"),c(f))}function c(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),c):f===96?(i=e.enter("codeTextSequence"),s=0,p(f)):lt(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||lt(f)?(e.exit("codeTextData"),c(f)):(e.consume(f),u)}function p(f){return f===96?(e.consume(f),s++,p):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(i.type="codeTextData",u(f))}}class jB{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&&Nc(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),Nc(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Nc(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);Nc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Nc(this.left,n.reverse())}}}function Nc(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 GA(e){const t={};let n=-1,r,s,i,a,l,c,u;const p=new jB(e);for(;++n<p.length;){for(;n in t;)n=t[n];if(r=p.get(n),n&&r[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(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,CB(p,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,s=void 0;i--;)if(a=p.get(i),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(s&&(p.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={...p.get(s)[1].start},l=p.slice(s,n),l.unshift(r),p.splice(s,n-s+1,l))}}return ci(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!u}function CB(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 p,f,d=-1,h=n,y=0,b=0;const k=[b];for(;h;){for(;e.get(++s)[1]!==h;);i.push(s),h._tokenizer||(p=r.sliceStream(h),h.next||p.push(null),f&&a.defineSkip(h.start),h._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(p),h._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),f=h,h=h.next}for(h=n;++d<l.length;)l[d][0]==="exit"&&l[d-1][0]==="enter"&&l[d][1].type===l[d-1][1].type&&l[d][1].start.line!==l[d][1].end.line&&(b=d+1,k.push(b),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(a.events=[],h?(h._tokenizer=void 0,h.previous=void 0):k.pop(),d=k.length;d--;){const g=l.slice(k[d],k[d+1]),w=i.pop();c.push([w,w+g.length-1]),e.splice(w,2,g)}for(c.reverse(),d=-1;++d<c.length;)u[y+c[d][0]]=y+c[d][1],y+=c[d][1]-c[d][0]-1;return u}const _B={resolve:AB,tokenize:PB},EB={partial:!0,tokenize:IB};function AB(e){return GA(e),e}function PB(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):lt(l)?e.check(EB,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 IB(e,t,n){const r=this;return s;function s(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),tn(e,i,"linePrefix")}function i(a){if(a===null||lt(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 JA(e,t,n,r,s,i,a,l,c){const u=c||Number.POSITIVE_INFINITY;let p=0;return f;function f(g){return g===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(g),e.exit(i),d):g===null||g===32||g===41||sx(g)?n(g):(e.enter(r),e.enter(a),e.enter(l),e.enter("chunkString",{contentType:"string"}),b(g))}function d(g){return g===62?(e.enter(i),e.consume(g),e.exit(i),e.exit(s),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),h(g))}function h(g){return g===62?(e.exit("chunkString"),e.exit(l),d(g)):g===null||g===60||lt(g)?n(g):(e.consume(g),g===92?y:h)}function y(g){return g===60||g===62||g===92?(e.consume(g),h):h(g)}function b(g){return!p&&(g===null||g===41||Fr(g))?(e.exit("chunkString"),e.exit(l),e.exit(a),e.exit(r),t(g)):p<u&&g===40?(e.consume(g),p++,b):g===41?(e.consume(g),p--,b):g===null||g===32||g===40||sx(g)?n(g):(e.consume(g),g===92?k:b)}function k(g){return g===40||g===41||g===92?(e.consume(g),b):b(g)}}function XA(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),p}function p(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):lt(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),f(h))}function f(h){return h===null||h===91||h===93||lt(h)||l++>999?(e.exit("chunkString"),p(h)):(e.consume(h),c||(c=!Ot(h)),h===92?d:f)}function d(h){return h===91||h===92||h===93?(e.consume(h),l++,f):f(h)}}function QA(e,t,n,r,s,i){let a;return l;function l(d){return d===34||d===39||d===40?(e.enter(r),e.enter(s),e.consume(d),e.exit(s),a=d===40?41:d,c):n(d)}function c(d){return d===a?(e.enter(s),e.consume(d),e.exit(s),e.exit(r),t):(e.enter(i),u(d))}function u(d){return d===a?(e.exit(i),c(a)):d===null?n(d):lt(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),tn(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(d))}function p(d){return d===a||d===null||lt(d)?(e.exit("chunkString"),u(d)):(e.consume(d),d===92?f:p)}function f(d){return d===a||d===92?(e.consume(d),p):p(d)}}function tu(e,t){let n;return r;function r(s){return lt(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):Ot(s)?tn(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const TB={name:"definition",tokenize:MB},RB={partial:!0,tokenize:$B};function MB(e,t,n){const r=this;let s;return i;function i(h){return e.enter("definition"),a(h)}function a(h){return XA.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function l(h){return s=wl(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 Fr(h)?tu(e,u)(h):u(h)}function u(h){return JA(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function p(h){return e.attempt(RB,f,f)(h)}function f(h){return Ot(h)?tn(e,d,"whitespace")(h):d(h)}function d(h){return h===null||lt(h)?(e.exit("definition"),r.parser.defined.push(s),t(h)):n(h)}}function $B(e,t,n){return r;function r(l){return Fr(l)?tu(e,s)(l):n(l)}function s(l){return QA(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return Ot(l)?tn(e,a,"whitespace")(l):a(l)}function a(l){return l===null||lt(l)?t(l):n(l)}}const LB={name:"hardBreakEscape",tokenize:OB};function OB(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return lt(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const DB={name:"headingAtx",resolve:FB,tokenize:zB};function FB(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"},ci(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function zB(e,t,n){let r=0;return s;function s(p){return e.enter("atxHeading"),i(p)}function i(p){return e.enter("atxHeadingSequence"),a(p)}function a(p){return p===35&&r++<6?(e.consume(p),a):p===null||Fr(p)?(e.exit("atxHeadingSequence"),l(p)):n(p)}function l(p){return p===35?(e.enter("atxHeadingSequence"),c(p)):p===null||lt(p)?(e.exit("atxHeading"),t(p)):Ot(p)?tn(e,l,"whitespace")(p):(e.enter("atxHeadingText"),u(p))}function c(p){return p===35?(e.consume(p),c):(e.exit("atxHeadingSequence"),l(p))}function u(p){return p===null||p===35||Fr(p)?(e.exit("atxHeadingText"),l(p)):(e.consume(p),u)}}const HB=["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"],XS=["pre","script","style","textarea"],BB={concrete:!0,name:"htmlFlow",resolveTo:KB,tokenize:UB},WB={partial:!0,tokenize:YB},VB={partial:!0,tokenize:qB};function KB(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 UB(e,t,n){const r=this;let s,i,a,l,c;return u;function u(L){return p(L)}function p(L){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(L),f}function f(L){return L===33?(e.consume(L),d):L===47?(e.consume(L),i=!0,b):L===63?(e.consume(L),s=3,r.interrupt?t:E):ti(L)?(e.consume(L),a=String.fromCharCode(L),k):n(L)}function d(L){return L===45?(e.consume(L),s=2,h):L===91?(e.consume(L),s=5,l=0,y):ti(L)?(e.consume(L),s=4,r.interrupt?t:E):n(L)}function h(L){return L===45?(e.consume(L),r.interrupt?t:E):n(L)}function y(L){const X="CDATA[";return L===X.charCodeAt(l++)?(e.consume(L),l===X.length?r.interrupt?t:D:y):n(L)}function b(L){return ti(L)?(e.consume(L),a=String.fromCharCode(L),k):n(L)}function k(L){if(L===null||L===47||L===62||Fr(L)){const X=L===47,se=a.toLowerCase();return!X&&!i&&XS.includes(se)?(s=1,r.interrupt?t(L):D(L)):HB.includes(a.toLowerCase())?(s=6,X?(e.consume(L),g):r.interrupt?t(L):D(L)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(L):i?w(L):x(L))}return L===45||Qr(L)?(e.consume(L),a+=String.fromCharCode(L),k):n(L)}function g(L){return L===62?(e.consume(L),r.interrupt?t:D):n(L)}function w(L){return Ot(L)?(e.consume(L),w):V(L)}function x(L){return L===47?(e.consume(L),V):L===58||L===95||ti(L)?(e.consume(L),N):Ot(L)?(e.consume(L),x):V(L)}function N(L){return L===45||L===46||L===58||L===95||Qr(L)?(e.consume(L),N):C(L)}function C(L){return L===61?(e.consume(L),j):Ot(L)?(e.consume(L),C):x(L)}function j(L){return L===null||L===60||L===61||L===62||L===96?n(L):L===34||L===39?(e.consume(L),c=L,_):Ot(L)?(e.consume(L),j):A(L)}function _(L){return L===c?(e.consume(L),c=null,F):L===null||lt(L)?n(L):(e.consume(L),_)}function A(L){return L===null||L===34||L===39||L===47||L===60||L===61||L===62||L===96||Fr(L)?C(L):(e.consume(L),A)}function F(L){return L===47||L===62||Ot(L)?x(L):n(L)}function V(L){return L===62?(e.consume(L),z):n(L)}function z(L){return L===null||lt(L)?D(L):Ot(L)?(e.consume(L),z):n(L)}function D(L){return L===45&&s===2?(e.consume(L),M):L===60&&s===1?(e.consume(L),O):L===62&&s===4?(e.consume(L),q):L===63&&s===3?(e.consume(L),E):L===93&&s===5?(e.consume(L),B):lt(L)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(WB,W,R)(L)):L===null||lt(L)?(e.exit("htmlFlowData"),R(L)):(e.consume(L),D)}function R(L){return e.check(VB,T,W)(L)}function T(L){return e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),$}function $(L){return L===null||lt(L)?R(L):(e.enter("htmlFlowData"),D(L))}function M(L){return L===45?(e.consume(L),E):D(L)}function O(L){return L===47?(e.consume(L),a="",P):D(L)}function P(L){if(L===62){const X=a.toLowerCase();return XS.includes(X)?(e.consume(L),q):D(L)}return ti(L)&&a.length<8?(e.consume(L),a+=String.fromCharCode(L),P):D(L)}function B(L){return L===93?(e.consume(L),E):D(L)}function E(L){return L===62?(e.consume(L),q):L===45&&s===2?(e.consume(L),E):D(L)}function q(L){return L===null||lt(L)?(e.exit("htmlFlowData"),W(L)):(e.consume(L),q)}function W(L){return e.exit("htmlFlow"),t(L)}}function qB(e,t,n){const r=this;return s;function s(a){return lt(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 YB(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Rh,t,n)}}const GB={name:"htmlText",tokenize:JB};function JB(e,t,n){const r=this;let s,i,a;return l;function l(E){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(E),c}function c(E){return E===33?(e.consume(E),u):E===47?(e.consume(E),C):E===63?(e.consume(E),x):ti(E)?(e.consume(E),A):n(E)}function u(E){return E===45?(e.consume(E),p):E===91?(e.consume(E),i=0,y):ti(E)?(e.consume(E),w):n(E)}function p(E){return E===45?(e.consume(E),h):n(E)}function f(E){return E===null?n(E):E===45?(e.consume(E),d):lt(E)?(a=f,O(E)):(e.consume(E),f)}function d(E){return E===45?(e.consume(E),h):f(E)}function h(E){return E===62?M(E):E===45?d(E):f(E)}function y(E){const q="CDATA[";return E===q.charCodeAt(i++)?(e.consume(E),i===q.length?b:y):n(E)}function b(E){return E===null?n(E):E===93?(e.consume(E),k):lt(E)?(a=b,O(E)):(e.consume(E),b)}function k(E){return E===93?(e.consume(E),g):b(E)}function g(E){return E===62?M(E):E===93?(e.consume(E),g):b(E)}function w(E){return E===null||E===62?M(E):lt(E)?(a=w,O(E)):(e.consume(E),w)}function x(E){return E===null?n(E):E===63?(e.consume(E),N):lt(E)?(a=x,O(E)):(e.consume(E),x)}function N(E){return E===62?M(E):x(E)}function C(E){return ti(E)?(e.consume(E),j):n(E)}function j(E){return E===45||Qr(E)?(e.consume(E),j):_(E)}function _(E){return lt(E)?(a=_,O(E)):Ot(E)?(e.consume(E),_):M(E)}function A(E){return E===45||Qr(E)?(e.consume(E),A):E===47||E===62||Fr(E)?F(E):n(E)}function F(E){return E===47?(e.consume(E),M):E===58||E===95||ti(E)?(e.consume(E),V):lt(E)?(a=F,O(E)):Ot(E)?(e.consume(E),F):M(E)}function V(E){return E===45||E===46||E===58||E===95||Qr(E)?(e.consume(E),V):z(E)}function z(E){return E===61?(e.consume(E),D):lt(E)?(a=z,O(E)):Ot(E)?(e.consume(E),z):F(E)}function D(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),s=E,R):lt(E)?(a=D,O(E)):Ot(E)?(e.consume(E),D):(e.consume(E),T)}function R(E){return E===s?(e.consume(E),s=void 0,$):E===null?n(E):lt(E)?(a=R,O(E)):(e.consume(E),R)}function T(E){return E===null||E===34||E===39||E===60||E===61||E===96?n(E):E===47||E===62||Fr(E)?F(E):(e.consume(E),T)}function $(E){return E===47||E===62||Fr(E)?F(E):n(E)}function M(E){return E===62?(e.consume(E),e.exit("htmlTextData"),e.exit("htmlText"),t):n(E)}function O(E){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),P}function P(E){return Ot(E)?tn(e,B,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):B(E)}function B(E){return e.enter("htmlTextData"),a(E)}}const rb={name:"labelEnd",resolveAll:e6,resolveTo:t6,tokenize:n6},XB={tokenize:r6},QB={tokenize:s6},ZB={tokenize:i6};function e6(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&&ci(e,0,e.length,n),e}function t6(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}},p={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[a-2][1].start}};return l=[["enter",c,t],["enter",u,t]],l=fs(l,e.slice(i+1,i+r+3)),l=fs(l,[["enter",p,t]]),l=fs(l,nb(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),l=fs(l,[["exit",p,t],e[a-2],e[a-1],["exit",u,t]]),l=fs(l,e.slice(a+1)),l=fs(l,[["exit",c,t]]),ci(e,i,e.length,l),e}function n6(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(d){return i?i._inactive?f(d):(a=r.parser.defined.includes(wl(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelEnd"),c):n(d)}function c(d){return d===40?e.attempt(XB,p,a?p:f)(d):d===91?e.attempt(QB,p,a?u:f)(d):a?p(d):f(d)}function u(d){return e.attempt(ZB,p,f)(d)}function p(d){return t(d)}function f(d){return i._balanced=!0,n(d)}}function r6(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),s}function s(f){return Fr(f)?tu(e,i)(f):i(f)}function i(f){return f===41?p(f):JA(e,a,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function a(f){return Fr(f)?tu(e,c)(f):p(f)}function l(f){return n(f)}function c(f){return f===34||f===39||f===40?QA(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):p(f)}function u(f){return Fr(f)?tu(e,p)(f):p(f)}function p(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function s6(e,t,n){const r=this;return s;function s(l){return XA.call(r,e,i,a,"reference","referenceMarker","referenceString")(l)}function i(l){return r.parser.defined.includes(wl(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function a(l){return n(l)}}function i6(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 o6={name:"labelStartImage",resolveAll:rb.resolveAll,tokenize:a6};function a6(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 l6={name:"labelStartLink",resolveAll:rb.resolveAll,tokenize:c6};function c6(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 ig={name:"lineEnding",tokenize:u6};function u6(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),tn(e,t,"linePrefix")}}const Qf={name:"thematicBreak",tokenize:d6};function d6(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||lt(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===s?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),Ot(u)?tn(e,l,"whitespace")(u):l(u))}}const Ir={continuation:{tokenize:m6},exit:y6,name:"list",tokenize:h6},f6={partial:!0,tokenize:x6},p6={partial:!0,tokenize:g6};function h6(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 y=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:ix(h)){if(r.containerState.type||(r.containerState.type=y,e.enter(y,{_container:!0})),y==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(Qf,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 ix(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(Rh,r.interrupt?n:p,e.attempt(f6,d,f))}function p(h){return r.containerState.initialBlankLine=!0,i++,d(h)}function f(h){return Ot(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),d):n(h)}function d(h){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function m6(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Rh,s,i);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,tn(e,t,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!Ot(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(p6,t,a)(l))}function a(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,tn(e,e.attempt(Ir,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function g6(e,t,n){const r=this;return tn(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 y6(e){e.exit(this.containerState.type)}function x6(e,t,n){const r=this;return tn(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!Ot(i)&&a&&a[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const QS={name:"setextUnderline",resolveTo:w6,tokenize:b6};function w6(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 b6(e,t,n){const r=this;let s;return i;function i(u){let p=r.events.length,f;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){f=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(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"),Ot(u)?tn(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||lt(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const k6={tokenize:v6};function v6(e){const t=this,n=e.attempt(Rh,r,e.attempt(this.parser.constructs.flowInitial,s,tn(e,e.attempt(this.parser.constructs.flow,s,e.attempt(_B,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 S6={resolveAll:eP()},N6=ZA("string"),j6=ZA("text");function ZA(e){return{resolveAll:eP(e==="text"?C6: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(p){return u(p)?i(p):l(p)}function l(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),c}function c(p){return u(p)?(n.exit("data"),i(p)):(n.consume(p),c)}function u(p){if(p===null)return!0;const f=s[p];let d=-1;if(f)for(;++d<f.length;){const h=f[d];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function eP(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 C6(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 _6={42:Ir,43:Ir,45:Ir,48:Ir,49:Ir,50:Ir,51:Ir,52:Ir,53:Ir,54:Ir,55:Ir,56:Ir,57:Ir,62:UA},E6={91:TB},A6={[-2]:sg,[-1]:sg,32:sg},P6={35:DB,42:Qf,45:[QS,Qf],60:BB,61:QS,95:Qf,96:JS,126:JS},I6={38:YA,92:qA},T6={[-5]:ig,[-4]:ig,[-3]:ig,33:o6,38:YA,42:ox,60:[lB,GB],91:l6,92:[LB,qA],93:rb,95:ox,96:kB},R6={null:[ox,S6]},M6={null:[42,95]},$6={null:[]},L6=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:M6,contentInitial:E6,disable:$6,document:_6,flow:P6,flowInitial:A6,insideSpan:R6,string:I6,text:T6},Symbol.toStringTag,{value:"Module"}));function O6(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:_(C),check:_(j),consume:w,enter:x,exit:N,interrupt:_(j,{interrupt:!0})},u={code:null,containerState:{},defineSkip:b,events:[],now:y,parser:e,previous:null,sliceSerialize:d,sliceStream:h,write:f};let p=t.tokenize.call(u,c);return t.resolveAll&&i.push(t),u;function f(z){return a=fs(a,z),k(),a[a.length-1]!==null?[]:(A(t,0),u.events=nb(i,u.events,u),u.events)}function d(z,D){return F6(h(z),D)}function h(z){return D6(a,z)}function y(){const{_bufferIndex:z,_index:D,line:R,column:T,offset:$}=r;return{_bufferIndex:z,_index:D,line:R,column:T,offset:$}}function b(z){s[z.line]=z.column,V()}function k(){let z;for(;r._index<a.length;){const D=a[r._index];if(typeof D=="string")for(z=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===z&&r._bufferIndex<D.length;)g(D.charCodeAt(r._bufferIndex));else g(D)}}function g(z){p=p(z)}function w(z){lt(z)?(r.line++,r.column=1,r.offset+=z===-3?2:1,V()):z!==-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=z}function x(z,D){const R=D||{};return R.type=z,R.start=y(),u.events.push(["enter",R,u]),l.push(R),R}function N(z){const D=l.pop();return D.end=y(),u.events.push(["exit",D,u]),D}function C(z,D){A(z,D.from)}function j(z,D){D.restore()}function _(z,D){return R;function R(T,$,M){let O,P,B,E;return Array.isArray(T)?W(T):"tokenize"in T?W([T]):q(T);function q(ae){return me;function me(re){const de=re!==null&&ae[re],ne=re!==null&&ae.null,ue=[...Array.isArray(de)?de:de?[de]:[],...Array.isArray(ne)?ne:ne?[ne]:[]];return W(ue)(re)}}function W(ae){return O=ae,P=0,ae.length===0?M:L(ae[P])}function L(ae){return me;function me(re){return E=F(),B=ae,ae.partial||(u.currentConstruct=ae),ae.name&&u.parser.constructs.disable.null.includes(ae.name)?se():ae.tokenize.call(D?Object.assign(Object.create(u),D):u,c,X,se)(re)}}function X(ae){return z(B,E),$}function se(ae){return E.restore(),++P<O.length?L(O[P]):M}}}function A(z,D){z.resolveAll&&!i.includes(z)&&i.push(z),z.resolve&&ci(u.events,D,u.events.length-D,z.resolve(u.events.slice(D),u)),z.resolveTo&&(u.events=z.resolveTo(u.events,u))}function F(){const z=y(),D=u.previous,R=u.currentConstruct,T=u.events.length,$=Array.from(l);return{from:T,restore:M};function M(){r=z,u.previous=D,u.currentConstruct=R,u.events.length=T,l=$,V()}}function V(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function D6(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 F6(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 z6(e){const r={constructs:qH([L6,...(e||{}).extensions||[]]),content:s(tB),defined:[],document:s(rB),flow:s(k6),lazy:{},string:s(N6),text:s(j6)};return r;function s(i){return a;function a(l){return O6(r,i,l)}}}function H6(e){for(;!GA(e););return e}const ZS=/[\0\t\n\r]/g;function B6(){let e=1,t="",n=!0,r;return s;function s(i,a,l){const c=[];let u,p,f,d,h;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(a||void 0).decode(i)),f=0,t="",n&&(i.charCodeAt(0)===65279&&f++,n=void 0);f<i.length;){if(ZS.lastIndex=f,u=ZS.exec(i),d=u&&u.index!==void 0?u.index:i.length,h=i.charCodeAt(d),!u){t=i.slice(f);break}if(h===10&&f===d&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),f<d&&(c.push(i.slice(f,d)),e+=d-f),h){case 0:{c.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,c.push(-2);e++<p;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}f=d+1}return l&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const W6=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function V6(e){return e.replace(W6,K6)}function K6(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return KA(n.slice(i?2:1),i?16:10)}return tb(n)||e}const tP={}.hasOwnProperty;function U6(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),q6(n)(H6(z6(n).document().write(B6()(e,t,!0))))}function q6(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Te),autolinkProtocol:F,autolinkEmail:F,atxHeading:i(We),blockQuote:i(ne),characterEscape:F,characterReference:F,codeFenced:i(ue),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:i(ue,a),codeText:i(fe,a),codeTextData:F,data:F,codeFlowValue:F,definition:i(ve),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:i($e),hardBreakEscape:i(Pe),hardBreakTrailing:i(Pe),htmlFlow:i(Ue,a),htmlFlowData:F,htmlText:i(Ue,a),htmlTextData:F,image:i(pt),label:a,link:i(Te),listItem:i(Yt),listItemValue:d,listOrdered:i(et,f),listUnordered:i(et),paragraph:i(jt),reference:L,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:i(We),strong:i($t),thematicBreak:i(Xe)},exit:{atxHeading:c(),atxHeadingSequence:C,autolink:c(),autolinkEmail:de,autolinkProtocol:re,blockQuote:c(),characterEscapeValue:V,characterReferenceMarkerHexadecimal:se,characterReferenceMarkerNumeric:se,characterReferenceValue:ae,characterReference:me,codeFenced:c(k),codeFencedFence:b,codeFencedFenceInfo:h,codeFencedFenceMeta:y,codeFlowValue:V,codeIndented:c(g),codeText:c($),codeTextData:V,data:V,definition:c(),definitionDestinationString:N,definitionLabelString:w,definitionTitleString:x,emphasis:c(),hardBreakEscape:c(D),hardBreakTrailing:c(D),htmlFlow:c(R),htmlFlowData:V,htmlText:c(T),htmlTextData:V,image:c(O),label:B,labelText:P,lineEnding:z,link:c(M),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:X,resourceDestinationString:E,resourceTitleString:q,resource:W,setextHeading:c(A),setextHeadingLineSequence:_,setextHeadingText:j,strong:c(),thematicBreak:c()}};nP(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(oe){let ke={type:"root",children:[]};const Se={stack:[ke],tokenStack:[],config:t,enter:l,exit:u,buffer:a,resume:p,data:n},qe=[];let Ze=-1;for(;++Ze<oe.length;)if(oe[Ze][1].type==="listOrdered"||oe[Ze][1].type==="listUnordered")if(oe[Ze][0]==="enter")qe.push(Ze);else{const kt=qe.pop();Ze=s(oe,kt,Ze)}for(Ze=-1;++Ze<oe.length;){const kt=t[oe[Ze][0]];tP.call(kt,oe[Ze][1].type)&&kt[oe[Ze][1].type].call(Object.assign({sliceSerialize:oe[Ze][2].sliceSerialize},Se),oe[Ze][1])}if(Se.tokenStack.length>0){const kt=Se.tokenStack[Se.tokenStack.length-1];(kt[1]||eN).call(Se,void 0,kt[0])}for(ke.position={start:Qi(oe.length>0?oe[0][1].start:{line:1,column:1,offset:0}),end:Qi(oe.length>0?oe[oe.length-2][1].end:{line:1,column:1,offset:0})},Ze=-1;++Ze<t.transforms.length;)ke=t.transforms[Ze](ke)||ke;return ke}function s(oe,ke,Se){let qe=ke-1,Ze=-1,kt=!1,Z,xe,He,Ce;for(;++qe<=Se;){const nt=oe[qe];switch(nt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{nt[0]==="enter"?Ze++:Ze--,Ce=void 0;break}case"lineEndingBlank":{nt[0]==="enter"&&(Z&&!Ce&&!Ze&&!He&&(He=qe),Ce=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ce=void 0}if(!Ze&&nt[0]==="enter"&&nt[1].type==="listItemPrefix"||Ze===-1&&nt[0]==="exit"&&(nt[1].type==="listUnordered"||nt[1].type==="listOrdered")){if(Z){let ht=qe;for(xe=void 0;ht--;){const un=oe[ht];if(un[1].type==="lineEnding"||un[1].type==="lineEndingBlank"){if(un[0]==="exit")continue;xe&&(oe[xe][1].type="lineEndingBlank",kt=!0),un[1].type="lineEnding",xe=ht}else if(!(un[1].type==="linePrefix"||un[1].type==="blockQuotePrefix"||un[1].type==="blockQuotePrefixWhitespace"||un[1].type==="blockQuoteMarker"||un[1].type==="listItemIndent"))break}He&&(!xe||He<xe)&&(Z._spread=!0),Z.end=Object.assign({},xe?oe[xe][1].start:nt[1].end),oe.splice(xe||qe,0,["exit",Z,nt[2]]),qe++,Se++}if(nt[1].type==="listItemPrefix"){const ht={type:"listItem",_spread:!1,start:Object.assign({},nt[1].start),end:void 0};Z=ht,oe.splice(qe,0,["enter",ht,nt[2]]),qe++,Se++,He=void 0,Ce=!0}}}return oe[ke][1]._spread=kt,Se}function i(oe,ke){return Se;function Se(qe){l.call(this,oe(qe),qe),ke&&ke.call(this,qe)}}function a(){this.stack.push({type:"fragment",children:[]})}function l(oe,ke,Se){this.stack[this.stack.length-1].children.push(oe),this.stack.push(oe),this.tokenStack.push([ke,Se||void 0]),oe.position={start:Qi(ke.start),end:void 0}}function c(oe){return ke;function ke(Se){oe&&oe.call(this,Se),u.call(this,Se)}}function u(oe,ke){const Se=this.stack.pop(),qe=this.tokenStack.pop();if(qe)qe[0].type!==oe.type&&(ke?ke.call(this,oe,qe[0]):(qe[1]||eN).call(this,oe,qe[0]));else throw new Error("Cannot close `"+oe.type+"` ("+eu({start:oe.start,end:oe.end})+"): it’s not open");Se.position.end=Qi(oe.end)}function p(){return KH(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function d(oe){if(this.data.expectingFirstListItemValue){const ke=this.stack[this.stack.length-2];ke.start=Number.parseInt(this.sliceSerialize(oe),10),this.data.expectingFirstListItemValue=void 0}}function h(){const oe=this.resume(),ke=this.stack[this.stack.length-1];ke.lang=oe}function y(){const oe=this.resume(),ke=this.stack[this.stack.length-1];ke.meta=oe}function b(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function k(){const oe=this.resume(),ke=this.stack[this.stack.length-1];ke.value=oe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){const oe=this.resume(),ke=this.stack[this.stack.length-1];ke.value=oe.replace(/(\r?\n|\r)$/g,"")}function w(oe){const ke=this.resume(),Se=this.stack[this.stack.length-1];Se.label=ke,Se.identifier=wl(this.sliceSerialize(oe)).toLowerCase()}function x(){const oe=this.resume(),ke=this.stack[this.stack.length-1];ke.title=oe}function N(){const oe=this.resume(),ke=this.stack[this.stack.length-1];ke.url=oe}function C(oe){const ke=this.stack[this.stack.length-1];if(!ke.depth){const Se=this.sliceSerialize(oe).length;ke.depth=Se}}function j(){this.data.setextHeadingSlurpLineEnding=!0}function _(oe){const ke=this.stack[this.stack.length-1];ke.depth=this.sliceSerialize(oe).codePointAt(0)===61?1:2}function A(){this.data.setextHeadingSlurpLineEnding=void 0}function F(oe){const Se=this.stack[this.stack.length-1].children;let qe=Se[Se.length-1];(!qe||qe.type!=="text")&&(qe=Ht(),qe.position={start:Qi(oe.start),end:void 0},Se.push(qe)),this.stack.push(qe)}function V(oe){const ke=this.stack.pop();ke.value+=this.sliceSerialize(oe),ke.position.end=Qi(oe.end)}function z(oe){const ke=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Se=ke.children[ke.children.length-1];Se.position.end=Qi(oe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ke.type)&&(F.call(this,oe),V.call(this,oe))}function D(){this.data.atHardBreak=!0}function R(){const oe=this.resume(),ke=this.stack[this.stack.length-1];ke.value=oe}function T(){const oe=this.resume(),ke=this.stack[this.stack.length-1];ke.value=oe}function $(){const oe=this.resume(),ke=this.stack[this.stack.length-1];ke.value=oe}function M(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const ke=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=ke,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function O(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const ke=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=ke,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function P(oe){const ke=this.sliceSerialize(oe),Se=this.stack[this.stack.length-2];Se.label=V6(ke),Se.identifier=wl(ke).toLowerCase()}function B(){const oe=this.stack[this.stack.length-1],ke=this.resume(),Se=this.stack[this.stack.length-1];if(this.data.inReference=!0,Se.type==="link"){const qe=oe.children;Se.children=qe}else Se.alt=ke}function E(){const oe=this.resume(),ke=this.stack[this.stack.length-1];ke.url=oe}function q(){const oe=this.resume(),ke=this.stack[this.stack.length-1];ke.title=oe}function W(){this.data.inReference=void 0}function L(){this.data.referenceType="collapsed"}function X(oe){const ke=this.resume(),Se=this.stack[this.stack.length-1];Se.label=ke,Se.identifier=wl(this.sliceSerialize(oe)).toLowerCase(),this.data.referenceType="full"}function se(oe){this.data.characterReferenceType=oe.type}function ae(oe){const ke=this.sliceSerialize(oe),Se=this.data.characterReferenceType;let qe;Se?(qe=KA(ke,Se==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):qe=tb(ke);const Ze=this.stack[this.stack.length-1];Ze.value+=qe}function me(oe){const ke=this.stack.pop();ke.position.end=Qi(oe.end)}function re(oe){V.call(this,oe);const ke=this.stack[this.stack.length-1];ke.url=this.sliceSerialize(oe)}function de(oe){V.call(this,oe);const ke=this.stack[this.stack.length-1];ke.url="mailto:"+this.sliceSerialize(oe)}function ne(){return{type:"blockquote",children:[]}}function ue(){return{type:"code",lang:null,meta:null,value:""}}function fe(){return{type:"inlineCode",value:""}}function ve(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function $e(){return{type:"emphasis",children:[]}}function We(){return{type:"heading",depth:0,children:[]}}function Pe(){return{type:"break"}}function Ue(){return{type:"html",value:""}}function pt(){return{type:"image",title:null,url:"",alt:null}}function Te(){return{type:"link",title:null,url:"",children:[]}}function et(oe){return{type:"list",ordered:oe.type==="listOrdered",start:null,spread:oe._spread,children:[]}}function Yt(oe){return{type:"listItem",spread:oe._spread,checked:null,children:[]}}function jt(){return{type:"paragraph",children:[]}}function $t(){return{type:"strong",children:[]}}function Ht(){return{type:"text",value:""}}function Xe(){return{type:"thematicBreak"}}}function Qi(e){return{line:e.line,column:e.column,offset:e.offset}}function nP(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?nP(e,r):Y6(e,r)}}function Y6(e,t){let n;for(n in t)if(tP.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function eN(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+eu({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+eu({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+eu({start:t.start,end:t.end})+") is still open")}function G6(e){const t=this;t.parser=n;function n(r){return U6(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function J6(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 X6(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
70
|
-
`}]}function Q6(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 Z6(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function eW(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function tW(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=Ul(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 nW(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 rW(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function rP(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 sW(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return rP(e,t);const s={src:Ul(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 iW(e,t){const n={src:Ul(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 oW(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 aW(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return rP(e,t);const s={href:Ul(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 lW(e,t){const n={href:Ul(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 cW(e,t,n){const r=e.all(t),s=n?uW(n):sP(t),i={},a=[];if(typeof t.checked=="boolean"){const p=r[0];let f;p&&p.type==="element"&&p.tagName==="p"?f=p:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const p=r[l];(s||l!==0||p.type!=="element"||p.tagName!=="p")&&a.push({type:"text",value:`
|
|
72
|
-
`}),p.type==="element"&&p.tagName==="p"&&!s?a.push(...p.children):a.push(p)}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 uW(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=sP(n[r])}return t}function sP(e){const t=e.spread;return t??e.children.length>1}function dW(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 fW(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function pW(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function hW(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function mW(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=Xw(t.children[1]),c=DA(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 gW(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 f=t.children[c],d={},h=a?a[c]:void 0;h&&(d.align=h);let y={type:"element",tagName:i,properties:d,children:[]};f&&(y.children=e.all(f),e.patch(f,y),y=e.applyData(f,y)),u.push(y)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,p),e.applyData(t,p)}function yW(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const tN=9,nN=32;function xW(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const i=[];for(;r;)i.push(rN(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(rN(t.slice(s),s>0,!1)),i.join("")}function rN(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===tN||i===nN;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===tN||i===nN;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function wW(e,t){const n={type:"text",value:xW(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function bW(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const kW={blockquote:J6,break:X6,code:Q6,delete:Z6,emphasis:eW,footnoteReference:tW,heading:nW,html:rW,imageReference:sW,image:iW,inlineCode:oW,linkReference:aW,link:lW,listItem:cW,list:dW,paragraph:fW,root:pW,strong:hW,table:mW,tableCell:yW,tableRow:gW,text:wW,thematicBreak:bW,toml:hf,yaml:hf,definition:hf,footnoteDefinition:hf};function hf(){}const iP=-1,Mh=0,nu=1,Dp=2,sb=3,ib=4,ob=5,ab=6,oP=7,aP=8,sN=typeof self=="object"?self:globalThis,vW=(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 Mh:case iP:return n(a,s);case nu:{const l=n([],s);for(const c of a)l.push(r(c));return l}case Dp:{const l=n({},s);for(const[c,u]of a)l[r(c)]=r(u);return l}case sb:return n(new Date(a),s);case ib:{const{source:l,flags:c}=a;return n(new RegExp(l,c),s)}case ob:{const l=n(new Map,s);for(const[c,u]of a)l.set(r(c),r(u));return l}case ab:{const l=n(new Set,s);for(const c of a)l.add(r(c));return l}case oP:{const{name:l,message:c}=a;return n(new sN[l](c),s)}case aP: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 sN[i](a),s)};return r},iN=e=>vW(new Map,e)(0),za="",{toString:SW}={},{keys:NW}=Object,jc=e=>{const t=typeof e;if(t!=="object"||!e)return[Mh,t];const n=SW.call(e).slice(8,-1);switch(n){case"Array":return[nu,za];case"Object":return[Dp,za];case"Date":return[sb,za];case"RegExp":return[ib,za];case"Map":return[ob,za];case"Set":return[ab,za];case"DataView":return[nu,n]}return n.includes("Array")?[nu,n]:n.includes("Error")?[oP,n]:[Dp,n]},mf=([e,t])=>e===Mh&&(t==="function"||t==="symbol"),jW=(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]=jc(a);switch(l){case Mh:{let p=a;switch(c){case"bigint":l=aP,p=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);p=null;break;case"undefined":return s([iP],a)}return s([l,p],a)}case nu:{if(c){let d=a;return c==="DataView"?d=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(d=new Uint8Array(a)),s([c,[...d]],a)}const p=[],f=s([l,p],a);for(const d of a)p.push(i(d));return f}case Dp:{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 p=[],f=s([l,p],a);for(const d of NW(a))(e||!mf(jc(a[d])))&&p.push([i(d),i(a[d])]);return f}case sb:return s([l,a.toISOString()],a);case ib:{const{source:p,flags:f}=a;return s([l,{source:p,flags:f}],a)}case ob:{const p=[],f=s([l,p],a);for(const[d,h]of a)(e||!(mf(jc(d))||mf(jc(h))))&&p.push([i(d),i(h)]);return f}case ab:{const p=[],f=s([l,p],a);for(const d of a)(e||!mf(jc(d)))&&p.push(i(d));return f}}const{message:u}=a;return s([l,{name:c,message:u}],a)};return i},oN=(e,{json:t,lossy:n}={})=>{const r=[];return jW(!(t||n),!!t,new Map,r)(e),r},Fp=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?iN(oN(e,t)):structuredClone(e):(e,t)=>iN(oN(e,t));function CW(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 _W(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function EW(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||CW,r=e.options.footnoteBackLabel||_W,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 p=e.all(u),f=String(u.identifier).toUpperCase(),d=Ul(f.toLowerCase());let h=0;const y=[],b=e.footnoteCounts.get(f);for(;b!==void 0&&++h<=b;){y.length>0&&y.push({type:"text",value:" "});let w=typeof n=="string"?n:n(c,h);typeof w=="string"&&(w={type:"text",value:w}),y.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+d+(h>1?"-"+h:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,h),className:["data-footnote-backref"]},children:Array.isArray(w)?w:[w]})}const k=p[p.length-1];if(k&&k.type==="element"&&k.tagName==="p"){const w=k.children[k.children.length-1];w&&w.type==="text"?w.value+=" ":k.children.push({type:"text",value:" "}),k.children.push(...y)}else p.push(...y);const g={type:"element",tagName:"li",properties:{id:t+"fn-"+d},children:e.wrap(p,!0)};e.patch(u,g),l.push(g)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Fp(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 lP=function(e){if(e==null)return TW;if(typeof e=="function")return $h(e);if(typeof e=="object")return Array.isArray(e)?AW(e):PW(e);if(typeof e=="string")return IW(e);throw new Error("Expected function, string, or object as test")};function AW(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=lP(e[n]);return $h(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function PW(e){const t=e;return $h(n);function n(r){const s=r;let i;for(i in e)if(s[i]!==t[i])return!1;return!0}}function IW(e){return $h(t);function t(n){return n&&n.type===e}}function $h(e){return t;function t(n,r,s){return!!(RW(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function TW(){return!0}function RW(e){return e!==null&&typeof e=="object"&&"type"in e}const cP=[],MW=!0,aN=!1,$W="skip";function LW(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const i=lP(s),a=r?-1:1;l(e,void 0,[])();function l(c,u,p){const f=c&&typeof c=="object"?c:{};if(typeof f.type=="string"){const h=typeof f.tagName=="string"?f.tagName:typeof f.name=="string"?f.name:void 0;Object.defineProperty(d,"name",{value:"node ("+(c.type+(h?"<"+h+">":""))+")"})}return d;function d(){let h=cP,y,b,k;if((!t||i(c,u,p[p.length-1]||void 0))&&(h=OW(n(c,p)),h[0]===aN))return h;if("children"in c&&c.children){const g=c;if(g.children&&h[0]!==$W)for(b=(r?g.children.length:-1)+a,k=p.concat(g);b>-1&&b<g.children.length;){const w=g.children[b];if(y=l(w,b,k)(),y[0]===aN)return y;b=typeof y[1]=="number"?y[1]:b+a}}return h}}}function OW(e){return Array.isArray(e)?e:typeof e=="number"?[MW,e]:e==null?cP:[e]}function uP(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),LW(e,i,l,s);function l(c,u){const p=u[u.length-1],f=p?p.children.indexOf(c):void 0;return a(c,f,p)}}const ax={}.hasOwnProperty,DW={};function FW(e,t){const n=t||DW,r=new Map,s=new Map,i=new Map,a={...kW,...n.handlers},l={all:u,applyData:HW,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:a,one:c,options:n,patch:zW,wrap:WW};return uP(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const f=p.type==="definition"?r:s,d=String(p.identifier).toUpperCase();f.has(d)||f.set(d,p)}}),l;function c(p,f){const d=p.type,h=l.handlers[d];if(ax.call(l.handlers,d)&&h)return h(l,p,f);if(l.options.passThrough&&l.options.passThrough.includes(d)){if("children"in p){const{children:b,...k}=p,g=Fp(k);return g.children=l.all(p),g}return Fp(p)}return(l.options.unknownHandler||BW)(l,p,f)}function u(p){const f=[];if("children"in p){const d=p.children;let h=-1;for(;++h<d.length;){const y=l.one(d[h],p);if(y){if(h&&d[h-1].type==="break"&&(!Array.isArray(y)&&y.type==="text"&&(y.value=lN(y.value)),!Array.isArray(y)&&y.type==="element")){const b=y.children[0];b&&b.type==="text"&&(b.value=lN(b.value))}Array.isArray(y)?f.push(...y):f.push(y)}}}return f}}function zW(e,t){e.position&&(t.position=SH(e))}function HW(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,Fp(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function BW(e,t){const n=t.data||{},r="value"in t&&!(ax.call(n,"hProperties")||ax.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 WW(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 lN(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function cN(e,t){const n=FW(e,t),r=n.one(e,void 0),s=EW(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 VW(e,t){return e&&"run"in e?async function(n,r){const s=cN(n,{file:r,...t});await e.run(s,r)}:function(n,r){return cN(n,{file:r,...e||t})}}function uN(e){if(e)throw e}var Zf=Object.prototype.hasOwnProperty,dP=Object.prototype.toString,dN=Object.defineProperty,fN=Object.getOwnPropertyDescriptor,pN=function(t){return typeof Array.isArray=="function"?Array.isArray(t):dP.call(t)==="[object Array]"},hN=function(t){if(!t||dP.call(t)!=="[object Object]")return!1;var n=Zf.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Zf.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||Zf.call(t,s)},mN=function(t,n){dN&&n.name==="__proto__"?dN(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},gN=function(t,n){if(n==="__proto__")if(Zf.call(t,n)){if(fN)return fN(t,n).value}else return;return t[n]},KW=function e(){var t,n,r,s,i,a,l=arguments[0],c=1,u=arguments.length,p=!1;for(typeof l=="boolean"&&(p=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=gN(l,n),s=gN(t,n),l!==s&&(p&&s&&(hN(s)||(i=pN(s)))?(i?(i=!1,a=r&&pN(r)?r:[]):a=r&&hN(r)?r:{},mN(l,{name:n,newValue:e(p,a,s)})):typeof s<"u"&&mN(l,{name:n,newValue:s}));return l};const og=Co(KW);function lx(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 UW(){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 p=e[++i];let f=-1;if(c){a(c);return}for(;++f<s.length;)(u[f]===null||u[f]===void 0)&&(u[f]=s[f]);s=u,p?qW(p,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 qW(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 p=u;if(l&&n)throw p;return s(p)}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 Gs={basename:YW,dirname:GW,extname:JW,join:XW,sep:"/"};function YW(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');id(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 GW(e){if(id(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 JW(e){id(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 XW(...e){let t=-1,n;for(;++t<e.length;)id(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":QW(n)}function QW(e){id(e);const t=e.codePointAt(0)===47;let n=ZW(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function ZW(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 id(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const e8={cwd:t8};function t8(){return"/"}function cx(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function n8(e){if(typeof e=="string")e=new URL(e);else if(!cx(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 r8(e)}function r8(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 ag=["history","path","basename","stem","extname","dirname"];class fP{constructor(t){let n;t?cx(t)?n={path:t}:typeof t=="string"||s8(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":e8.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<ag.length;){const i=ag[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)ag.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Gs.basename(this.path):void 0}set basename(t){cg(t,"basename"),lg(t,"basename"),this.path=Gs.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Gs.dirname(this.path):void 0}set dirname(t){yN(this.basename,"dirname"),this.path=Gs.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Gs.extname(this.path):void 0}set extname(t){if(lg(t,"extname"),yN(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=Gs.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){cx(t)&&(t=n8(t)),cg(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Gs.basename(this.path,this.extname):void 0}set stem(t){cg(t,"stem"),lg(t,"stem"),this.path=Gs.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 pr(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 lg(e,t){if(e&&e.includes(Gs.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Gs.sep+"`")}function cg(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function yN(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function s8(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const i8=function(e){const r=this.constructor.prototype,s=r[e],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},o8={}.hasOwnProperty;class lb extends i8{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=UW()}copy(){const t=new lb;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(og(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(fg("data",this.frozen),this.namespace[t]=n,this):o8.call(this.namespace,t)&&this.namespace[t]||void 0:t?(fg("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=gf(t),r=this.parser||this.Parser;return ug("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),ug("process",this.parser||this.Parser),dg("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,a){const l=gf(t),c=r.parse(l);r.run(c,l,function(p,f,d){if(p||!f||!d)return u(p);const h=f,y=r.stringify(h,d);c8(y)?d.value=y:d.result=y,u(p,d)});function u(p,f){p||!f?a(p):i?i(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),ug("processSync",this.parser||this.Parser),dg("processSync",this.compiler||this.Compiler),this.process(t,s),wN("processSync","process",n),r;function s(i,a){n=!0,uN(i),r=a}}run(t,n,r){xN(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=gf(n);s.run(t,c,u);function u(p,f,d){const h=f||t;p?l(p):a?a(h):r(void 0,h,d)}}}runSync(t,n){let r=!1,s;return this.run(t,n,i),wN("runSync","run",r),s;function i(a,l){uN(a),s=l,r=!0}}stringify(t,n){this.freeze();const r=gf(n),s=this.compiler||this.Compiler;return dg("stringify",s),xN(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(fg("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[p,...f]=u;c(p,f)}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=og(!0,s.settings,u.settings))}function l(u){let p=-1;if(u!=null)if(Array.isArray(u))for(;++p<u.length;){const f=u[p];i(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,p){let f=-1,d=-1;for(;++f<r.length;)if(r[f][0]===u){d=f;break}if(d===-1)r.push([u,...p]);else if(p.length>0){let[h,...y]=p;const b=r[d][1];lx(b)&&lx(h)&&(h=og(!0,b,h)),r[d]=[u,h,...y]}}}}const a8=new lb().freeze();function ug(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function dg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function fg(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 xN(e){if(!lx(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function wN(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function gf(e){return l8(e)?e:new fP(e)}function l8(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function c8(e){return typeof e=="string"||u8(e)}function u8(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const d8="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",bN=[],kN={allowDangerousHtml:!0},f8=/^(https?|ircs?|mailto|xmpp)$/i,p8=[{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 pP(e){const t=h8(e),n=m8(e);return g8(t.runSync(t.parse(n),n),e)}function h8(e){const t=e.rehypePlugins||bN,n=e.remarkPlugins||bN,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...kN}:kN;return a8().use(G6).use(n).use(VW,r).use(t)}function m8(e){const t=e.children||"",n=new fP;return typeof t=="string"&&(n.value=t),n}function g8(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,a=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||y8;for(const p of p8)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+d8+p.id,void 0);return uP(e,u),EH(e,{Fragment:o.Fragment,components:s,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function u(p,f,d){if(p.type==="raw"&&d&&typeof f=="number")return a?d.children.splice(f,1):d.children[f]={type:"text",value:p.value},f;if(p.type==="element"){let h;for(h in rg)if(Object.hasOwn(rg,h)&&Object.hasOwn(p.properties,h)){const y=p.properties[h],b=rg[h];(b===null||b.includes(p.tagName))&&(p.properties[h]=c(String(y||""),h,p))}}if(p.type==="element"){let h=n?!n.includes(p.tagName):i?i.includes(p.tagName):!1;if(!h&&r&&typeof f=="number"&&(h=!r(p,f,d)),h&&d&&typeof f=="number")return l&&p.children?d.children.splice(f,1,...p.children):d.children.splice(f,1),f}}}function y8(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||f8.test(e.slice(0,t))?e:""}const x8=new Set(["echarts"]),w8=new Set(["line","bar","pie","scatter","radar","heatmap","tree","treemap","sunburst","sankey","graph","gauge","funnel"]),b8=new Set(["onclick","ondblclick","onmousedown","onmouseup","onmouseover","onmouseout","onmousemove","onmouseenter","onmouseleave","oncontextmenu","onkeydown","onkeyup","onkeypress","onload","onerror"]),k8=["#7c9cff","#a8e66f","#ffcf5c","#68d8d6","#ff8fb3","#b79cff","#f59e73","#8bd17c"];function wo(e){return e&&typeof e=="object"&&!Array.isArray(e)}function pa(e,t){if(!wo(e))return{...t};const n={...e};for(const[r,s]of Object.entries(t))n[r]==null?n[r]=s:wo(n[r])&&wo(s)&&(n[r]=pa(n[r],s));return n}function Lh(e,t){return e==null?e:Array.isArray(e)?e.map(n=>wo(n)?pa(n,t):n):wo(e)?pa(e,t):e}function v8(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 ux(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)=>ux(n,`${t}[${r}]`));return}if(typeof e=="object")for(const[n,r]of Object.entries(e)){if(/^on[A-Z]/.test(n)||b8.has(n.toLowerCase()))throw new Error(`${t}.${n} is not allowed`);ux(r,`${t}.${n}`)}}}function S8(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(!w8.has(r))throw new Error(`series.type "${r||"(empty)"}" is not allowed`)}return t}function N8(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:pa(e,t)}function j8(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(!wo(r))return r;const i=s===0&&t&&r.text==null?{...r,text:t}:r;return pa(i,n)}):wo(e)?pa(t&&e.text==null?{...e,text:t}:e,n):t?{...n,text:t}:e}function C8(e,t){const n={top:t?42:14,textStyle:{color:"rgba(255, 255, 255, 0.72)"},itemGap:14};return e==null?e:Lh(e,n)}function vN(e,t="rgba(255, 255, 255, 0.62)"){return Lh(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 _8(e,t){const n={left:52,right:42,top:t?78:42,bottom:42,containLabel:!0};return e==null?n:Lh(e,n)}function E8(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:Lh(e,t)}function A8(e,t,n){const r=j8(e.title,n),s=!!(Array.isArray(r)?r:[r]).filter(Boolean).some(a=>wo(a)&&a.text),i=e.legend!=null&&e.legend!==!1;return{...e,backgroundColor:e.backgroundColor??"transparent",color:e.color??k8,textStyle:pa(e.textStyle,{color:"rgba(255, 255, 255, 0.78)"}),title:r,tooltip:N8(e.tooltip),legend:C8(e.legend,s),grid:e.xAxis!=null||e.yAxis!=null?_8(e.grid,s||i):e.grid,xAxis:vN(e.xAxis),yAxis:vN(e.yAxis),radar:E8(e.radar),series:t}}function P8(e){const t=v8(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(!x8.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");ux(n);const r=S8(n.option.series),s=n.title==null?"":String(n.title),i=A8(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 Ci(e){let t=String(e||"").trim();return t.includes("|")?(t.startsWith("|")&&(t=t.slice(1)),t.endsWith("|")&&(t=t.slice(0,-1)),t.split("|").map(n=>n.trim())):[]}function hP(e){const t=Ci(e);return t.length>1&&t.every(n=>/^:?-{3,}:?$/.test(n))}function mP(e){return Ci(e).map(t=>t.startsWith(":")&&t.endsWith(":")?"center":t.endsWith(":")?"right":"left")}function I8(e){return/^\s*(sequenceDiagram|flowchart\s+(?:TD|TB|BT|LR|RL)|graph\s+(?:TD|TB|BT|LR|RL))\b/i.test(String(e||""))}function T8(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 R8({code:e}){const t=m.useMemo(()=>T8(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((p,f)=>{l.set(p.id,{x:28+(n?f*(r+i):f%3*(r+i)),y:28+(n?f%3*(s+a):f*(s+a))})});const c=Math.max(520,...Array.from(l.values()).map(p=>p.x+r+28)),u=Math.max(220,...Array.from(l.values()).map(p=>p.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((p,f)=>{const d=l.get(p.from),h=l.get(p.to);if(!d||!h)return null;const y=n?`M ${d.x+r} ${d.y+s/2} C ${(d.x+h.x+r)/2} ${d.y+s/2}, ${(d.x+h.x+r)/2} ${h.y+s/2}, ${h.x} ${h.y+s/2}`:`M ${d.x+r/2} ${d.y+s} C ${d.x+r/2} ${d.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:y,markerEnd:"url(#af-md-mermaid-arrow)"},`${p.from}-${p.to}-${f}`)}),t.nodes.map(p=>{const f=l.get(p.id);return o.jsxs("g",{children:[o.jsx("rect",{className:"af-md-mermaid-box",x:f.x,y:f.y,width:r,height:s,rx:"8"}),o.jsx("text",{className:"af-md-mermaid-text",x:f.x+r/2,y:f.y+s/2+5,textAnchor:"middle",children:p.label.slice(0,24)})]},p.id)})]})}function M8(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 $8({code:e}){const t=m.useMemo(()=>M8(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),p=f=>{const d=Math.max(0,n.findIndex(h=>h.id===f));return s+d*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((f,d)=>{const h=s+d*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:f.label.slice(0,18)}),o.jsx("line",{className:"af-md-sequence-life",x1:h,y1:i+a,x2:h,y2:u-18})]},f.id)}),t.rows.map((f,d)=>{const h=i+a+d*l+24;if(f.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:f.text.slice(0,120)})]},`note-${d}`);const y=p(f.from),b=p(f.to),k=(y+b)/2;return o.jsxs("g",{children:[o.jsx("line",{className:"af-md-mermaid-edge",x1:y,y1:h,x2:b,y2:h,markerEnd:"url(#af-md-sequence-arrow)"}),o.jsx("text",{className:"af-md-sequence-label",x:k,y:h-8,textAnchor:"middle",children:f.text.slice(0,72)})]},`msg-${d}`)})]})}function gP({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($8,{code:t}):o.jsx(R8,{code:t})})}function L8(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&&I8(l)){i();const u=[];for(;a<t.length;){const p=t[a]||"";if(u.length>0&&(!p.trim()||/^-{3,}\s*$/.test(p)||/^#{1,6}\s+/.test(p)))break;u.push(p),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&&Ci(l).length>1&&hP(t[a+1])){i();const u=Ci(l),p=mP(t[a+1]),f=[];for(a+=2;a<t.length&&t[a].trim()&&Ci(t[a]).length>1;)f.push(Ci(t[a])),a++;n.push({type:"table",headers:u,align:p,rows:f});continue}r.push(l),a++}return i(),n}function SN(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 yP(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 p=i;for(;p<r.length&&!/\s|<|>/.test(r[p]);)p+=1;let f=r.slice(i,p),d="";for(;/[.,;:!?)}\]]$/.test(f);)d=f.slice(-1)+d,f=f.slice(0,-1);f?s+=`[${f}](${f})${d}`:s+=r.slice(i,p),i=p}return s}).join(`
|
|
87
|
-
`)}function xP(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=SN(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 p;const c=((p=String(a||"").match(/language-(\w+)/i))==null?void 0:p[1])||"",u=String(l||"").replace(/\n$/,"");return!i&&/^(mermaid|mmd)$/i.test(c)?o.jsx(gP,{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(SN(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 NN({children:e,resolveSrc:t,basePath:n=""}){return o.jsx(pP,{components:xP(t,!0,n),children:yP(e)})}function cb({content:e,resolveSrc:t,basePath:n=""}){const r=m.useMemo(()=>L8(e),[e]),s=m.useMemo(()=>xP(t,!1,n),[n,t]);return o.jsx(o.Fragment,{children:r.map((i,a)=>i.type==="mermaid"?o.jsx(gP,{code:i.text},`mermaid-${a}`):i.type!=="table"?o.jsx(pP,{components:s,children:yP(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(NN,{resolveSrc:t,basePath:n,children:l})},c))})}),o.jsx("tbody",{children:i.rows.map((l,c)=>o.jsx("tr",{children:i.headers.map((u,p)=>o.jsx("td",{style:{textAlign:i.align[p]||"left"},children:o.jsx(NN,{resolveSrc:t,basePath:n,children:l[p]||""})},p))},c))})]})},`table-${a}`))})}function O8(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 qs(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 D8(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=>qs(i[a])))}}if(e.every(Array.isArray)&&e.length>0){const s=e[0].map((i,a)=>qs(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)=>qs(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:qs(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:qs(s)||`Column ${i+1}`,align:"left"})),{columns:r,rows:n.slice(1).map(s=>r.map((i,a)=>qs(s[a])))}):{columns:r,rows:n.map(s=>Array.isArray(s)?r.map((i,a)=>qs(s[a])):s&&typeof s=="object"?r.map(i=>qs(s[i.key])):r.map((i,a)=>a===0?qs(s):""))}}function F8(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=D8(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&&Ci(s[0]).length>1&&hP(s[1])){const l=Ci(s[0]),c=mP(s[1]);return{columns:l.map((u,p)=>({key:String(p),label:u,align:c[p]||"left"})),rows:s.slice(2).map(u=>Ci(u)),error:""}}const i=r.includes(" ")?" ":",",a=O8(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 ub({content:e}){const t=m.useMemo(()=>F8(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:qs(n[i])},`${s.key}-${i}`))},r))})]})})}function db({content:e}){const t=m.useRef(null),n=m.useMemo(()=>P8(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:""}),I5(()=>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,p;i=!0,c&&window.removeEventListener("resize",c),(u=l==null?void 0:l.disconnect)==null||u.call(l),(p=a==null?void 0:a.dispose)==null||p.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 wP(e){return typeof e>"u"||e===null}function z8(e){return typeof e=="object"&&e!==null}function H8(e){return Array.isArray(e)?e:wP(e)?[]:[e]}function B8(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 W8(e,t){var n="",r;for(r=0;r<t;r+=1)n+=e;return n}function V8(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var K8=wP,U8=z8,q8=H8,Y8=W8,G8=V8,J8=B8,fb={isNothing:K8,isObject:U8,toArray:q8,repeat:Y8,isNegativeZero:G8,extend:J8};function bP(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 $u(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=bP(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}$u.prototype=Object.create(Error.prototype);$u.prototype.constructor=$u;$u.prototype.toString=function(t){return this.name+": "+bP(this,t)};var Wo=$u,X8=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],Q8=["scalar","sequence","mapping"];function Z8(e){var t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(r){t[String(r)]=n})}),t}function e9(e,t){if(t=t||{},Object.keys(t).forEach(function(n){if(X8.indexOf(n)===-1)throw new Wo('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=Z8(t.styleAliases||null),Q8.indexOf(this.kind)===-1)throw new Wo('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var ur=e9;function jN(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 t9(){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 dx(e){return this.extend(e)}dx.prototype.extend=function(t){var n=[],r=[];if(t instanceof ur)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 Wo("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(i){if(!(i instanceof ur))throw new Wo("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(i.loadKind&&i.loadKind!=="scalar")throw new Wo("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 Wo("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 ur))throw new Wo("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var s=Object.create(dx.prototype);return s.implicit=(this.implicit||[]).concat(n),s.explicit=(this.explicit||[]).concat(r),s.compiledImplicit=jN(s,"implicit"),s.compiledExplicit=jN(s,"explicit"),s.compiledTypeMap=t9(s.compiledImplicit,s.compiledExplicit),s};var n9=dx,r9=new ur("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),s9=new ur("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),i9=new ur("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),o9=new n9({explicit:[r9,s9,i9]});function a9(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function l9(){return null}function c9(e){return e===null}var u9=new ur("tag:yaml.org,2002:null",{kind:"scalar",resolve:a9,construct:l9,predicate:c9,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function d9(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 f9(e){return e==="true"||e==="True"||e==="TRUE"}function p9(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var h9=new ur("tag:yaml.org,2002:bool",{kind:"scalar",resolve:d9,construct:f9,predicate:p9,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 m9(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function g9(e){return 48<=e&&e<=55}function y9(e){return 48<=e&&e<=57}function x9(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(!m9(e.charCodeAt(n)))return!1;r=!0}return r&&s!=="_"}if(s==="o"){for(n++;n<t;n++)if(s=e[n],s!=="_"){if(!g9(e.charCodeAt(n)))return!1;r=!0}return r&&s!=="_"}}if(s==="_")return!1;for(;n<t;n++)if(s=e[n],s!=="_"){if(!y9(e.charCodeAt(n)))return!1;r=!0}return!(!r||s==="_")}function w9(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 b9(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!fb.isNegativeZero(e)}var k9=new ur("tag:yaml.org,2002:int",{kind:"scalar",resolve:x9,construct:w9,predicate:b9,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"]}}),v9=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function S9(e){return!(e===null||!v9.test(e)||e[e.length-1]==="_")}function N9(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 j9=/^[-+]?[0-9]+e/;function C9(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(fb.isNegativeZero(e))return"-0.0";return n=e.toString(10),j9.test(n)?n.replace("e",".e"):n}function _9(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||fb.isNegativeZero(e))}var E9=new ur("tag:yaml.org,2002:float",{kind:"scalar",resolve:S9,construct:N9,predicate:_9,represent:C9,defaultStyle:"lowercase"}),A9=o9.extend({implicit:[u9,h9,k9,E9]}),P9=A9,kP=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),vP=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 I9(e){return e===null?!1:kP.exec(e)!==null||vP.exec(e)!==null}function T9(e){var t,n,r,s,i,a,l,c=0,u=null,p,f,d;if(t=kP.exec(e),t===null&&(t=vP.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]&&(p=+t[10],f=+(t[11]||0),u=(p*60+f)*6e4,t[9]==="-"&&(u=-u)),d=new Date(Date.UTC(n,r,s,i,a,l,c)),u&&d.setTime(d.getTime()-u),d}function R9(e){return e.toISOString()}var M9=new ur("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:I9,construct:T9,instanceOf:Date,represent:R9});function $9(e){return e==="<<"||e===null}var L9=new ur("tag:yaml.org,2002:merge",{kind:"scalar",resolve:$9}),pb=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
94
|
-
\r`;function O9(e){if(e===null)return!1;var t,n,r=0,s=e.length,i=pb;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 D9(e){var t,n,r=e.replace(/[\r\n=]/g,""),s=r.length,i=pb,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 F9(e){var t="",n=0,r,s,i=e.length,a=pb;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 z9(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var H9=new ur("tag:yaml.org,2002:binary",{kind:"scalar",resolve:O9,construct:D9,predicate:z9,represent:F9}),B9=Object.prototype.hasOwnProperty,W9=Object.prototype.toString;function V9(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,W9.call(s)!=="[object Object]")return!1;for(i in s)if(B9.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 K9(e){return e!==null?e:[]}var U9=new ur("tag:yaml.org,2002:omap",{kind:"sequence",resolve:V9,construct:K9}),q9=Object.prototype.toString;function Y9(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],q9.call(r)!=="[object Object]"||(s=Object.keys(r),s.length!==1))return!1;i[t]=[s[0],r[s[0]]]}return!0}function G9(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 J9=new ur("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:Y9,construct:G9}),X9=Object.prototype.hasOwnProperty;function Q9(e){if(e===null)return!0;var t,n=e;for(t in n)if(X9.call(n,t)&&n[t]!==null)return!1;return!0}function Z9(e){return e!==null?e:{}}var eV=new ur("tag:yaml.org,2002:set",{kind:"mapping",resolve:Q9,construct:Z9});P9.extend({implicit:[M9,L9],explicit:[H9,U9,J9,eV]});function CN(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 tV=new Array(256),nV=new Array(256);for(var Ha=0;Ha<256;Ha++)tV[Ha]=CN(Ha)?1:0,nV[Ha]=CN(Ha);const Lu=["requirement","planning","code","test","normal"],_N={普通:"normal",技术规划:"planning",代码执行:"code",测试回归:"test",需求拆解:"requirement"};function hb(e,t){var s,i,a,l,c,u,p,f,d,h,y,b,k,g;const n=w=>{const x={type:(w==null?void 0:w.type)??"node",name:(w==null?void 0:w.name)??"",value:(w==null?void 0:w.value)??(w==null?void 0:w.default)??""};return(w==null?void 0:w.required)===!0&&(x.required=!0),(w==null?void 0:w.description)!=null&&String(w.description).trim()&&(x.description=String(w.description)),(w==null?void 0:w.showOnNode)!=null&&(x.showOnNode=!!w.showOnNode),x},r={};for(const w of e){if((s=w==null?void 0:w.data)!=null&&s.isWorkspaceGroup)continue;const x=t[w.id]&&typeof t[w.id]=="object"?{...t[w.id]}:{},N=((i=w.data)==null?void 0:i.definitionId)||w.id,C=((a=w.data)==null?void 0:a.inputs)??[],j=((l=w.data)==null?void 0:l.outputs)??[],_=((c=w.data)==null?void 0:c.role)!=null?String(w.data.role).trim():"",A=x.role!=null?String(x.role).trim():"",F=_N[_]||_,V=_N[A]||A,z=Lu.includes(F)?F:Lu.includes(V)?V:"normal",D=Array.isArray(C)?C.map(n):Array.isArray(x.input)?x.input.map(se=>n(se)):[],R=Array.isArray(j)?j.map(n):Array.isArray(x.output)?x.output.map(se=>n(se)):[],T=((u=w.data)==null?void 0:u.label)!=null?String(w.data.label):x.label!=null?String(x.label):w.id,$=(p=w.data)==null?void 0:p.body,M=$!=null?String($):x.body!=null?String(x.body):"";let O=((f=w.data)==null?void 0:f.model)!=null&&String(w.data.model).trim()!==""?String(w.data.model).trim():x.model!=null&&String(x.model).trim()!==""?String(x.model).trim():void 0;(O===""||O==="default")&&(O=void 0);const P={...x,definitionId:N,label:T,role:z,model:O,input:D,output:R},B=((d=w.data)==null?void 0:d.marketplaceRef)||x.marketplaceRef;B?P.marketplaceRef=String(B):delete P.marketplaceRef;const E=((h=w.data)==null?void 0:h.marketplacePackageId)||x.marketplacePackageId;E?P.marketplacePackageId=String(E):delete P.marketplacePackageId;const q=((y=w.data)==null?void 0:y.marketplaceVersion)||x.marketplaceVersion;q?P.marketplaceVersion=String(q):delete P.marketplaceVersion,N.startsWith("provide_")||M.trim()===""?delete P.body:P.body=M;const W=Array.isArray((b=w.data)==null?void 0:b.images)?w.data.images:Array.isArray(x.images)?x.images:[];W.length>0?P.images=W:delete P.images;const L=(k=w.data)==null?void 0:k.script,X=L!=null?String(L):x.script!=null?String(x.script):"";X.trim()===""?delete P.script:P.script=X;for(const se of["scriptRef","implementationRef","implementationMode"]){const ae=(g=w.data)==null?void 0:g[se],me=ae!=null?String(ae):x[se]!=null?String(x[se]):"";me.trim()===""?delete P[se]:P[se]=me.trim()}delete P.temperature,delete P.maxTokens,delete P.description,r[w.id]=P}return r}function ru(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function rV(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 sV(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=>ru(a)),edges:i.map(a=>ru(a)),instances:hb(r,n||{})}}function iV(e,t,n,r,s={}){var f;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(d=>d.id)),l=new Map;for(const d of e.nodes)l.set(d.id,rV(d.id,a));const c=e.nodes.map(d=>{var y,b;const h=l.get(d.id);return{...ru(d),id:h,selected:!0,dragging:!1,position:{x:Number(((y=d.position)==null?void 0:y.x)||0)+i.x,y:Number(((b=d.position)==null?void 0:b.y)||0)+i.y}}}),u=(e.edges||[]).filter(d=>l.has(d.source)&&l.has(d.target)).map((d,h)=>{const y=l.get(d.source),b=l.get(d.target);return{...ru(d),id:`e-${y}-${b}-${Date.now()}-${h}`,source:y,target:b,selected:!1}}),p={...r||{}};for(const[d,h]of l.entries()){const y=(f=e.instances)==null?void 0:f[d];y&&(p[h]={...ru(y),label:y.label!=null?String(y.label):h})}return{nodes:[...(t||[]).map(d=>({...d,selected:!1})),...c],edges:[...(n||[]).map(d=>({...d,selected:!1})),...u],instances:p,pastedNodeIds:c.map(d=>d.id)}}function yn(e){switch(zp(e)){case"text":return"#2196f3";case"file":return"#4caf50";case"node":return"#ff9800";case"bool":return"#9c27b0";default:return"#9e9e9e"}}function zp(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 oV(e,t){const n=zp(e),r=zp(t);return!n||!r?!1:n==="any"||r==="any"?!0:n===r}const aV=new Set(["workspaceContext","skillsContext","mcpContext"]);function fx(e){const t=zp(e==null?void 0:e.type),n=String((e==null?void 0:e.name)||(e==null?void 0:e.id)||"").trim();return t==="text"&&aV.has(n)?`${t}+${n}`:t}function lV(e){return fx(e)}function Ou(e,t){if(!e||!t||!oV(e.type,t.type))return!1;const n=fx(e),r=fx(t),s=n.includes("+"),i=r.includes("+");return s||i?n===r:!0}function cV(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 px(e,t,n){var l;const r=n==="source"?"outputs":"inputs",i=cV(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 Hp=/\[image\s+(\d+)\]/gi;function Di(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 uV(e){return`image ${Di(e).length+1}`}function dV(e,t){const n=String(e||""),r=`[${t}]`;return n.trim()?`${n.replace(/[ \t]+$/u,"")} ${r}`:r}function fV(e,t){const n=Di(e),r=String(t||""),s=new Set;Hp.lastIndex=0;let i;for(;i=Hp.exec(r);)s.add(`image ${i[1]}`.toLowerCase());return s.size===0?[]:n.filter(a=>s.has(String(a.label||"").toLowerCase()))}function pV(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 SP(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 su(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 NP({files:e,body:t,images:n}){const r=Array.from(e||[]);if(r.length===0)return null;let s=String(t||"");const i=Di(n);for(const a of r){const l=await pV(a),c=uV(i);i.push({id:`${Date.now().toString(36)}-${i.length+1}`,label:c,...l}),s=dV(s,c)}return{body:s,images:i}}function as(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function hV(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 mV(e){return["true","1","yes","on"].includes(String((e==null?void 0:e.value)??(e==null?void 0:e.default)??"").trim().toLowerCase())}function zt(e){e.stopPropagation()}function gV(e){return String(e||"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function yV(e,t){const n=`\\[${gV(t)}\\]`;return String(e||"").replace(new RegExp(`[ \\t]*${n}`,"gi"),"").replace(/[ \t]+\n/g,`
|
|
96
|
-
`).replace(/\n{3,}/g,`
|
|
97
|
-
|
|
98
|
-
`).trimEnd()}function pg(e){return String(e||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function xV(e){const t=String(e||"");let n="",r=0;Hp.lastIndex=0;let s;for(;s=Hp.exec(t);)n+=pg(t.slice(r,s.index)),n+=`<span class="af-flow-node__image-token">${pg(s[0])}</span>`,r=s.index+s[0].length;return n+=pg(t.slice(r)),n||" "}function wV(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 bV({data:e,selected:t,id:n,deleteNode:r,onProvideExpand:s,onProvideValueChange:i,onNodeBodyChange:a,onNodeImagesChange:l,modelLists:c,onModelChange:u}){var gr,Bt;const{t:p}=Cr(),f=(e==null?void 0:e.inputs)??[],d=(e==null?void 0:e.outputs)??[],h=((e==null?void 0:e.schemaType)??"agent").toLowerCase(),y=hV(e),b=(e==null?void 0:e.isRunMode)??!1,k=!!(e!=null&&e.readOnly),g=(e==null?void 0:e.isExecuting)??!1,w=(e==null?void 0:e.isDim)??!1,x=(e==null?void 0:e.nodeStatus)??null,N=(e==null?void 0:e.nodeElapsed)??null,C=(e==null?void 0:e.definitionId)||"",j=C.startsWith("provide_"),_=C==="provide_bool",A=C==="provide_str",F=C==="provide_file",V=C==="provide_password",z=C==="agent_subAgent",D=C==="control_agent_toBool",R=(z||D)&&!b,T=_?mV(d[0]):!1,$=j?String(((gr=d[0])==null?void 0:gr.value)??((Bt=d[0])==null?void 0:Bt.default)??(e==null?void 0:e.body)??""):"",M=String((e==null?void 0:e.body)||""),O=(e==null?void 0:e.displayLabel)||(e==null?void 0:e.label)||p("flow:node.fallbackLabel"),P=!j&&!R&&(e!=null&&e.showBodyPreview)?String((e==null?void 0:e.body)||"").trim():"",B=Di(e==null?void 0:e.images),E=_||A||F||V||R||!!P,q=m.useRef(!1),W=m.useRef(!1),L=m.useRef(null),X=m.useRef(null),se=m.useRef(null),ae=m.useRef(null),me=m.useRef(null),[re,de]=m.useState($),[ne,ue]=m.useState(!1),[fe,ve]=m.useState(M),[$e,We]=m.useState(!1),[Pe,Ue]=m.useState({visible:!1,top:0,height:100}),[pt,Te]=m.useState(!1),et=m.useCallback(()=>{const te=X.current;if(!te)return;const be=Math.max(1,te.scrollHeight),st=Math.max(1,te.clientHeight),wt=be>st+1,rn=wt?Math.max(12,st/be*100):100,Cn=Math.max(0,100-rn),kn=wt?Math.min(Cn,te.scrollTop/Math.max(1,be-st)*Cn):0;Ue({visible:wt,top:kn,height:rn})},[]);m.useEffect(()=>{q.current||de($)},[n,$]),m.useEffect(()=>{W.current||ve(M)},[n,M]),m.useEffect(()=>{const te=X.current;if(!te)return;if(R){te.style.minHeight="",te.style.height="",se.current&&(se.current.style.minHeight="",se.current.style.height="");return}const be=wV(te,fe);te.style.minHeight=`${be}px`,te.style.height="",se.current&&(se.current.style.minHeight=`${be}px`,se.current.style.height="")},[fe,R]),m.useEffect(()=>{if(!R)return;const te=window.requestAnimationFrame(et),be=X.current;if(!be||typeof ResizeObserver>"u")return()=>window.cancelAnimationFrame(te);const st=new ResizeObserver(et);return st.observe(be),()=>{window.cancelAnimationFrame(te),st.disconnect()}},[fe,R,et]),m.useEffect(()=>{const te=L.current,be=e==null?void 0:e.onNodeContentResize;if(!R||!te||!be||typeof ResizeObserver>"u")return;let st=0;const wt=()=>{window.cancelAnimationFrame(st),st=window.requestAnimationFrame(()=>be(n))},rn=new ResizeObserver(wt);return rn.observe(te),wt(),()=>{window.cancelAnimationFrame(st),rn.disconnect()}},[e==null?void 0:e.onNodeContentResize,R,n]),m.useEffect(()=>{if(!pt)return;const te=window.setTimeout(()=>{const be=me.current;if(!be)return;be.focus();const st=be.value.length;be.setSelectionRange(st,st)},0);return()=>window.clearTimeout(te)},[pt]);const Yt=Array.isArray(c==null?void 0:c.cursor)?c.cursor:[],jt=Array.isArray(c==null?void 0:c.opencode)?c.opencode:[],$t=Array.isArray(c==null?void 0:c.claudeCode)?c.claudeCode:[],Ht=Array.isArray(c==null?void 0:c.codex)?c.codex:[],Xe=((e==null?void 0:e.model)??"").trim(),oe=h==="agent"&&!C.startsWith("tool_nodejs"),ke=new Set(Yt.map(as)),Se=new Set(jt.map(as)),qe=new Set($t.map(as)),Ze=new Set(Ht.map(as)),kt=Xe?Xe.startsWith("cursor:")||Xe.startsWith("opencode:")||Xe.startsWith("codex:")||Xe.startsWith("claude-code:")?Xe:qe.has(Xe)?`claude-code:${Xe}`:Ze.has(Xe)?`codex:${Xe}`:Se.has(Xe)?`opencode:${Xe}`:ke.has(Xe)?`cursor:${Xe}`:Xe:"",Z=Xe&&!kt.startsWith("cursor:")&&!kt.startsWith("opencode:")&&!kt.startsWith("codex:")&&!kt.startsWith("claude-code:")&&!ke.has(Xe)&&!Se.has(Xe)&&!qe.has(Xe)&&!Ze.has(Xe),xe=Xe.startsWith("cursor:")?Xe.slice(7):Xe.startsWith("opencode:")?Xe.slice(9):Xe.startsWith("codex:")?Xe.slice(6):Xe.startsWith("claude-code:")?Xe.slice(12):Xe,He=te=>{if(k)return;const be=te.target.value;u&&u(n,be)},Ce=te=>{te.stopPropagation(),!k&&r&&r(n)},nt=te=>{te.stopPropagation(),s&&s()},ht=te=>{te.stopPropagation(),!k&&(i==null||i(n,te.target.value==="true"?"true":"false"))},un=te=>{if(te.stopPropagation(),k)return;const be=te.target.value;de(be),q.current||i==null||i(n,be)},_r=te=>{te.stopPropagation(),q.current=!0},Wn=te=>{if(te.stopPropagation(),k)return;q.current=!1;const be=te.currentTarget.value;de(be),i==null||i(n,be)},Vn=()=>{k||i==null||i(n,re)},Kn=te=>{if(te.stopPropagation(),k)return;if(typeof(e==null?void 0:e.onOpenProvideFilePicker)=="function"){e.onOpenProvideFilePicker(n,re);return}const be=window.prompt("文件路径",re);be!=null&&(de(be),i==null||i(n,be))},hn=te=>{te.stopPropagation(),ue(be=>!be)},Un=te=>{if(ve(te),a==null||a(n,te),l){const be=fV(B,te);(be.length!==B.length||be.some((st,wt)=>{var rn;return st.id!==((rn=B[wt])==null?void 0:rn.id)}))&&l(n,be)}},Pn=te=>{if(te.stopPropagation(),k)return;const be=te.target.value;W.current?ve(be):Un(be)},hr=te=>{te.stopPropagation(),!k&&(W.current=!0,We(!0))},In=te=>{if(te.stopPropagation(),k)return;W.current=!1,We(!1);const be=te.currentTarget.value;Un(be)},Ln=()=>{k||(W.current=!1,We(!1),Un(fe))},ir=te=>{te.stopPropagation(),te.preventDefault(),!k&&Te(!0)},Zn=()=>{Te(!1),Ln()},Er=te=>{te.stopPropagation(),te.key==="Escape"&&(te.preventDefault(),Zn())},On=m.useCallback(te=>{const be=X.current;if(!be)return;const st=Math.max(0,be.scrollHeight-be.clientHeight);be.scrollTop=Math.min(1,Math.max(0,te))*st,et()},[et]),Hr=m.useCallback((te,be=0)=>{const st=ae.current;if(!st)return 0;const wt=st.getBoundingClientRect(),rn=Pe.height/100*wt.height,Cn=Math.max(1,wt.height-rn);return(te-wt.top-be)/Cn},[Pe.height]),mr=m.useCallback(te=>{var Ie,Wt;if(!Pe.visible)return;te.preventDefault(),te.stopPropagation();const be=ae.current;if(!be)return;const st=be.getBoundingClientRect(),wt=Pe.top/100*st.height,rn=Pe.height/100*st.height,kn=te.clientY>=st.top+wt&&te.clientY<=st.top+wt+rn?te.clientY-st.top-wt:rn/2;On(Hr(te.clientY,kn));const Dn=te.pointerId;(Wt=(Ie=te.currentTarget).setPointerCapture)==null||Wt.call(Ie,Dn);const Ve=Ye=>{Ye.preventDefault(),On(Hr(Ye.clientY,kn))},Lt=()=>{window.removeEventListener("pointermove",Ve),window.removeEventListener("pointerup",Lt),window.removeEventListener("pointercancel",Lt)};window.addEventListener("pointermove",Ve),window.addEventListener("pointerup",Lt),window.addEventListener("pointercancel",Lt)},[Hr,Pe.height,Pe.top,Pe.visible,On]),Br=async te=>{if(k)return;const be=await NP({files:te,body:fe,images:B});be&&(ve(be.body),a==null||a(n,be.body),l==null||l(n,be.images))},bn=(te,be)=>{if(te.stopPropagation(),k)return;const st=B.filter(rn=>rn.id!==be.id),wt=yV(fe,be.label);ve(wt),a==null||a(n,wt),l==null||l(n,st)},nn=te=>{if(k)return;const be=SP(te);be.length!==0&&(te.preventDefault(),te.stopPropagation(),Br(be).catch(()=>{}))},er=te=>{if(k)return;const be=su(te);be.length!==0&&(te.preventDefault(),te.stopPropagation(),Br(be).catch(()=>{}))},qn=()=>{const te=X.current,be=se.current;!te||!be||(be.scrollTop=te.scrollTop,be.scrollLeft=te.scrollLeft)};return o.jsxs("div",{className:"af-flow-node"+(t?" af-flow-node--selected":"")+(g?" af-flow-node--executing":"")+(x==="success"?" af-flow-node--done":"")+(x==="failed"?" af-flow-node--failed":"")+(x==="running"&&!g?" af-flow-node--running-disk":"")+(w?" af-flow-node--dim":"")+(R?" af-flow-node--inline-body-editor":"")+(A?" af-flow-node--provide-text":"")+(V?" 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:`${O}${n?` (${n})`:""}${y?` · ${y}`:""}`,children:O}),!b&&oe&&o.jsxs("div",{className:"af-flow-node__model-wrap nodrag",onPointerDown:zt,onMouseDown:zt,onClick:zt,children:[o.jsxs("select",{className:"af-flow-node__model nodrag",value:kt,onChange:He,onPointerDown:zt,onMouseDown:zt,onClick:zt,"aria-label":p("flow:node.model"),title:xe||p("flow:node.defaultModel"),disabled:k,children:[o.jsx("option",{value:"",children:p("flow:node.defaultModel")}),Z&&o.jsx("option",{value:Xe,children:Xe}),Yt.length>0&&o.jsx("optgroup",{label:"Cursor",children:Yt.map(te=>o.jsx("option",{value:`cursor:${as(te)}`,children:as(te)},`c-${te}`))}),jt.length>0&&o.jsx("optgroup",{label:"OpenCode",children:jt.map(te=>o.jsx("option",{value:`opencode:${as(te)}`,children:as(te)},`o-${te}`))}),Ht.length>0&&o.jsx("optgroup",{label:"Codex",children:Ht.map(te=>o.jsx("option",{value:`codex:${as(te)}`,children:as(te)},`codex-${te}`))}),$t.length>0&&o.jsx("optgroup",{label:"Claude Code",children:$t.map(te=>o.jsx("option",{value:`claude-code:${as(te)}`,children:as(te)},`cc-${te}`))})]}),o.jsx("span",{className:"af-flow-node__model-arrow material-symbols-outlined",children:"expand_more"})]}),g&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--executing",children:"EXECUTING"}),x==="running"&&!g&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--running-disk",title:p("flow:node.diskRunning"),children:"RUNNING"}),x==="success"&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--done",children:N!=null&&String(N).trim()!==""?N:"--"}),x==="failed"&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--failed",children:"FAILED"}),!b&&j&&!_&&!A&&!F&&!V&&o.jsx("button",{type:"button",className:"af-flow-node__expand",onClick:nt,"aria-label":p("flow:node.expandProvide"),title:p("flow:node.expandProvide"),children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})}),!b&&o.jsx("button",{type:"button",className:"af-flow-node__delete",disabled:k,onClick:Ce,"aria-label":p("flow:node.deleteNode"),title:p("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:f.map((te,be)=>{if(te.showOnNode===!1)return null;const st=p("flow:node.inputTooltip",{name:te.name||`#${be}`,type:te.type})+(te.default!=null&&te.default!==""?p("flow:node.defaultSuffix",{value:te.default}):""),wt=te.name||`#${be+1}`;return o.jsxs("div",{className:"af-flow-node__port-row",title:st,children:[o.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--in",children:[wt,te.required?o.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),o.jsx(Mn,{type:"target",position:Le.Left,id:`input-${be}`,className:"af-flow-node__handle",style:{background:yn(te.type)},title:st})]},`in-${be}`)})}),o.jsxs("div",{className:"af-flow-node__title-wrap",children:[_?o.jsxs("select",{className:"af-flow-node__bool-select nodrag"+(T?" af-flow-node__bool-select--true":""),value:T?"true":"false",onChange:ht,onPointerDown:zt,onMouseDown:zt,onClick:zt,"aria-label":"Boolean value",title:T?"true":"false",disabled:k,children:[o.jsx("option",{value:"false",children:"false"}),o.jsx("option",{value:"true",children:"true"})]}):A?o.jsx("textarea",{className:"af-flow-node__inline-text nodrag",value:re,onChange:un,onCompositionStart:_r,onCompositionEnd:Wn,onBlur:Vn,onPointerDown:zt,onMouseDown:zt,onClick:zt,placeholder:"输入文本",rows:2,readOnly:k}):F?o.jsxs("div",{className:"af-flow-node__file-value nodrag",onPointerDown:zt,onMouseDown:zt,onClick:zt,children:[o.jsx("input",{className:"af-flow-node__file-input nodrag",value:re,onChange:un,onCompositionStart:_r,onCompositionEnd:Wn,onBlur:Vn,placeholder:"选择或输入文件路径",title:re||"选择或输入文件路径",readOnly:k}),o.jsx("button",{type:"button",className:"af-flow-node__file-picker nodrag",disabled:k,onClick:Kn,"aria-label":"选择文件",title:"选择文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"folder_open"})})]}):V?o.jsxs("div",{className:"af-flow-node__password-value nodrag",onPointerDown:zt,onMouseDown:zt,onClick:zt,children:[o.jsx("input",{className:"af-flow-node__password-input nodrag",type:ne?"text":"password",value:re,onChange:un,onCompositionStart:_r,onCompositionEnd:Wn,onBlur:Vn,placeholder:"输入密码或密钥",title:ne?re:"密码已隐藏",autoComplete:"off",readOnly:k}),o.jsx("button",{type:"button",className:"af-flow-node__password-toggle nodrag",disabled:k,onClick:hn,"aria-label":ne?"隐藏密码":"预览密码",title:ne?"隐藏密码":"预览密码",children:o.jsx("span",{className:"material-symbols-outlined",children:ne?"visibility_off":"visibility"})})]}):R?o.jsxs("div",{ref:L,className:"af-flow-node__prompt-stack nodrag"+($e?" af-flow-node__prompt-stack--composing":""),children:[o.jsx("pre",{ref:se,className:"af-flow-node__prompt-backdrop","aria-hidden":"true",dangerouslySetInnerHTML:{__html:xV(fe)+`
|
|
99
|
-
`}}),o.jsx("textarea",{ref:X,className:"af-flow-node__prompt-editor nodrag",value:fe,onChange:Pn,onCompositionStart:hr,onCompositionEnd:In,onBlur:Ln,onPaste:nn,onDrop:er,onScroll:te=>{qn(),et()},onPointerDown:zt,onMouseDown:zt,onClick:zt,onKeyDown:zt,onDragOver:te=>{su(te).length>0&&te.preventDefault()},placeholder:D?"输入判断条件 / prompt":"输入 prompt",rows:2,readOnly:k}),!k&&o.jsx("button",{type:"button",className:"af-flow-node__prompt-expand nodrag",onPointerDown:zt,onMouseDown:zt,onClick:ir,"aria-label":"放大编辑",title:"放大编辑",children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})}),o.jsx("div",{ref:ae,className:"af-flow-node__prompt-scrollbar"+(Pe.visible?" af-flow-node__prompt-scrollbar--visible":""),onPointerDown:mr,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${Pe.height}%`,top:`${Pe.top}%`}})})]}):null,R&&B.length>0?o.jsx("div",{className:"af-flow-node__image-chips",children:B.map((te,be)=>o.jsxs("span",{className:"af-flow-node__image-chip",title:te.name,children:[o.jsx("img",{src:te.dataUrl,alt:""}),o.jsxs("span",{children:["[",te.label||`image ${be+1}`,"]"]}),o.jsx("button",{type:"button",className:"af-flow-node__image-remove nodrag",disabled:k,onClick:st=>bn(st,te),onPointerDown:zt,onMouseDown:zt,"aria-label":`删除 ${te.label||`image ${be+1}`}`,title:"删除图片",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},te.id||be))}):null,P?o.jsx("span",{className:"af-flow-node__prompt-preview",title:P,children:P}):null,E?null:o.jsx("span",{className:"af-flow-node__body-title",title:O,children:O})]}),o.jsx("div",{className:"af-flow-node__ports af-flow-node__ports--out",children:d.map((te,be)=>{if(te.showOnNode===!1)return null;const st=p("flow:node.outputTooltip",{name:te.name||`#${be}`,type:te.type})+(te.default!=null&&te.default!==""?p("flow:node.defaultSuffix",{value:te.default}):""),wt=te.name||`#${be+1}`;return o.jsxs("div",{className:"af-flow-node__port-row",title:st,children:[o.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--out",children:[wt,te.required?o.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),o.jsx(Mn,{type:"source",position:Le.Right,id:`output-${be}`,className:"af-flow-node__handle",style:{background:yn(te.type)},title:st})]},`out-${be}`)})})]}),pt?vr.createPortal(o.jsx("div",{className:"af-flow-node-full-editor nodrag",onPointerDown:zt,onMouseDown:zt,onClick:zt,onWheel:zt,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}),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:Zn,"aria-label":"关闭",title:"关闭",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx("textarea",{ref:me,className:"af-flow-node-full-editor__textarea",value:fe,onChange:Pn,onCompositionStart:hr,onCompositionEnd:In,onPaste:nn,onDrop:er,onKeyDown:Er,onDragOver:te=>{su(te).length>0&&te.preventDefault()},placeholder:D?"输入判断条件 / prompt":"输入 prompt",readOnly:k})]})}),document.body):null]})}const bl="flowNode";function hx(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 kV={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"],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 vV(e,t,n){const r=String((n==null?void 0:n.displayName)||"").trim(),s=String(t||"").trim();return!r||!s||r===s?s:(kV[e]||[]).includes(s)?r:s}const SV={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"])},NV={control_cd_workspace:new Set(["mode","label","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"])},jV=new Set(["display_markdown","display_mermaid","display_ascii","display_html","display_react_app","display_image","display_chart","display_table"]);function CV(e,t){if(!jV.has(String(e||"")))return!1;const n=String((t==null?void 0:t.name)||"");return n==="content"||n==="src"}function _V(e){const t=String((e==null?void 0:e.marketplaceDefinitionId)||(e==null?void 0:e.id)||"").trim();return t.startsWith("marketplace:")?t:""}function EV(e,t){const n=String((e==null?void 0:e.baseDefinitionId)||"").trim();return n||t}function jP(e){const t=String(e??"");return/^[A-Za-z0-9_@%+=:,./-]+$/.test(t)?t:"'"+t.replace(/'/g,"'\\''")+"'"}function AV(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 PV(e){const t=String(e??"").trim();return t?t.includes("${")?t:jP(t):""}function IV(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(PV).filter(Boolean):[];return[AV(t,n),jP(s),...i].join(" ")}return String(t.command||"").trim()}function EN(e,t,n){return!Array.isArray(t)||!Array.isArray(n)||n.length===0?t:t.map((r,s)=>{var u,p;const i=n[s],l=n.find(f=>(f==null?void 0:f.name)&&f.name===r.name)||i;if(!l)return r;const c=r.showOnNode===!1&&l.showOnNode==null&&((u=SV[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&&CV(e,r)?{showOnNode:!0}:{},...(p=NV[e])!=null&&p.has(r.name)?{showOnNode:!1}:{}}})}function TV(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=hx(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 mx(e,t,n,r,s){var P,B,E,q,W,L,X,se,ae,me,re,de,ne,ue,fe,ve,$e,We,Pe,Ue,pt;const i=((P=e.data)==null?void 0:P.definitionId)||String(e.id).replace(/-\d+$/,""),a=n.find(Te=>Te.id===i),l=t[e.id];let c=[],u=[],p=((B=e.data)==null?void 0:B.label)??e.id,f,d,h,y,b;const k=!!l;l&&(Array.isArray(l.input)&&(c=l.input.map(hx)),Array.isArray(l.output)&&(u=l.output.map(hx)),l.label&&(p=String(l.label)),l.role&&typeof l.role=="string"&&(f=l.role),l.model!=null&&(d=String(l.model).trim()),l.body!=null&&(h=String(l.body)),Array.isArray(l.images)&&(y=l.images),l.script!=null&&(b=String(l.script)));const g=f??(typeof((E=e.data)==null?void 0:E.role)=="string"?e.data.role:"普通"),w=d??((q=e.data)==null?void 0:q.model)??void 0,x=(a==null?void 0:a.description)!=null?String(a.description).trim():"",N=x!==""?x:void 0,C=h??((W=e.data)==null?void 0:W.body)??"",j=Array.isArray(y)?y:Array.isArray((L=e.data)==null?void 0:L.images)?e.data.images:[],_=IV(a),A=b!==void 0?b:((X=e.data)==null?void 0:X.script)!=null?String(e.data.script):_,F=String(e.id),V=(se=r==null?void 0:r[s])==null?void 0:se[F],z=(ae=V==null?void 0:V.label)==null?void 0:ae.label,D=V==null?void 0:V.body,R=V==null?void 0:V.description;k||(c.length===0&&((me=a==null?void 0:a.inputs)!=null&&me.length)&&(c=a.inputs.map(Te=>({...Te}))),u.length===0&&((re=a==null?void 0:a.outputs)!=null&&re.length)&&(u=a.outputs.map(Te=>({...Te}))));const T=EV(a,(a==null?void 0:a.id)??i),$=(l==null?void 0:l.marketplaceRef)||((de=e.data)==null?void 0:de.marketplaceRef)||_V(a);if(T==="agent_subAgent"&&!u.some(Te=>(Te==null?void 0:Te.name)==="result")){const Te=(ne=a==null?void 0:a.outputs)==null?void 0:ne.find(et=>(et==null?void 0:et.name)==="result");u=[...u,Te?{...Te}:{type:"text",name:"result",default:""}]}if((T==="display_markdown"||T==="display_mermaid"||T==="display_ascii"||T==="display_chart"||T==="display_table")&&!u.some(Te=>(Te==null?void 0:Te.name)==="next")){const Te=(ue=a==null?void 0:a.outputs)==null?void 0:ue.find(et=>(et==null?void 0:et.name)==="next");u=[...u,Te?{...Te}:{type:"node",name:"next",default:""}]}if(T==="workspace_run"){if(!c.some(Te=>(Te==null?void 0:Te.name)==="prev")){const Te=(fe=a==null?void 0:a.inputs)==null?void 0:fe.find(et=>(et==null?void 0:et.name)==="prev");c=[Te?{...Te}:{type:"node",name:"prev",default:""},...c]}if(!u.some(Te=>(Te==null?void 0:Te.name)==="next")){const Te=(ve=a==null?void 0:a.outputs)==null?void 0:ve.find(et=>(et==null?void 0:et.name)==="next");u=[...u,Te?{...Te}:{type:"node",name:"next",default:""}]}}c=EN(T,c,a==null?void 0:a.inputs),u=EN(T,u,a==null?void 0:a.outputs),T.startsWith("provide_")&&u[0]&&String(u[0].default??u[0].value??"").trim()===""&&String(C).trim()!==""&&(u=u.map((Te,et)=>et===0?{...Te,default:C,value:C}:Te));const M=vV(T,p,a),O=T==="tool_nodejs"||String(A).trim()!=="";return{...e,type:"flowNode",data:{...e.data,label:z||p,displayLabel:M,definitionDisplayName:a==null?void 0:a.displayName,definitionId:T,...$?{marketplaceRef:$}:{},...l!=null&&l.marketplacePackageId||($e=e.data)!=null&&$e.marketplacePackageId||a!=null&&a.packageId?{marketplacePackageId:(l==null?void 0:l.marketplacePackageId)||((We=e.data)==null?void 0:We.marketplacePackageId)||(a==null?void 0:a.packageId)}:{},...l!=null&&l.marketplaceVersion||(Pe=e.data)!=null&&Pe.marketplaceVersion||a!=null&&a.version?{marketplaceVersion:(l==null?void 0:l.marketplaceVersion)||((Ue=e.data)==null?void 0:Ue.marketplaceVersion)||(a==null?void 0:a.version)}:{},schemaType:((pt=e.data)==null?void 0:pt.schemaType)??e.type??"agent",role:g,model:w,body:D||C,images:j,script:A,inputs:c,outputs:u,description:R||N,originalLabel:p,originalBody:C,...O?{script:A}:{}}}}function RV(e,t){const n=new Map(t.map(r=>[r.id,r]));return e.filter(r=>{var p,f,d,h;const s=n.get(r.source),i=n.get(r.target),a=((f=(p=s==null?void 0:s.data)==null?void 0:p.outputs)==null?void 0:f.length)??0,l=((h=(d=i==null?void 0:i.data)==null?void 0:d.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 AN(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 PN(e,t){return!Array.isArray(e)||!e[t]||e[t].showOnNode===!0?e:e.map((n,r)=>r===t?{...n,showOnNode:!0}:n)}function hg(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=AN(t==null?void 0:t.sourceHandle,"output"),i=AN(t==null?void 0:t.targetHandle,"input");let a=!1;const l=(e||[]).map(c=>{var u,p,f,d;if(c.id===n){const h=PN((u=c.data)==null?void 0:u.outputs,s);if(h!==((p=c.data)==null?void 0:p.outputs))return a=!0,{...c,data:{...c.data,outputs:h}}}if(c.id===r){const h=PN((f=c.data)==null?void 0:f.inputs,i);if(h!==((d=c.data)==null?void 0:d.inputs))return a=!0,{...c,data:{...c.data,inputs:h}}}return c});return a?l:e}function MV(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 IN(e){return e.key==="?"||e.key==="/"&&e.shiftKey}function $V(){return typeof navigator>"u"?!1:/Mac|iPhone|iPod|iPad/i.test(navigator.platform||navigator.userAgent||"")}function LV({children:e}){return o.jsx("kbd",{className:"af-kbd",children:e})}function Cs({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(LV,{children:t})]},n))})}function OV({open:e,onClose:t}){const{t:n}=Cr(),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=$V()?"⌘":"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(Cs,{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(Cs,{keys:["?"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.jumpToNode")}),o.jsx(Cs,{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(Cs,{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(Cs,{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(Cs,{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(Cs,{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(Cs,{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(Cs,{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(Cs,{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(Cs,{keys:[i,"Shift","Z"]})]})]})]})]})]})})}function DV(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 FV({open:e,onClose:t,onJump:n,nodes:r}){const{t:s}=Cr(),[i,a]=m.useState(""),[l,c]=m.useState(0),u=m.useRef(null),p=m.useRef(null);m.useEffect(()=>{if(!e)return;a(""),c(0);const y=requestAnimationFrame(()=>{var b;return(b=u.current)==null?void 0:b.focus()});return()=>cancelAnimationFrame(y)},[e]);const f=m.useMemo(()=>{const y=(r||[]).map(g=>{var w,x,N;return{id:g.id,label:((w=g.data)==null?void 0:w.label)||"",definitionId:((x=g.data)==null?void 0:x.definitionId)||"",schemaType:((N=g.data)==null?void 0:N.schemaType)||""}}),b=i.trim(),k=y.map(g=>({e:g,s:DV(g,b)})).filter(g=>g.s>0);return k.sort((g,w)=>w.s-g.s||g.e.id.localeCompare(w.e.id)),k.slice(0,50).map(g=>g.e)},[r,i]);if(m.useEffect(()=>{l>=f.length&&c(0)},[f.length,l]),m.useEffect(()=>{var b;const y=(b=p.current)==null?void 0:b.querySelector(`[data-idx="${l}"]`);y&&y.scrollIntoView({block:"nearest"})},[l]),!e)return null;const d=y=>{const b=f[y];b&&(n(b.id),t())},h=y=>{if(y.key==="Escape"){y.preventDefault(),t();return}if(y.key==="ArrowDown"){y.preventDefault(),c(b=>Math.min(f.length-1,b+1));return}if(y.key==="ArrowUp"){y.preventDefault(),c(b=>Math.max(0,b-1));return}y.key==="Enter"&&(y.preventDefault(),d(l))};return o.jsx("div",{className:"af-jump-overlay",role:"presentation",onMouseDown:y=>{y.target===y.currentTarget&&t()},children:o.jsxs("div",{className:"af-jump-panel",role:"dialog","aria-modal":"true","aria-label":s("flow:jumpPalette.title"),onMouseDown:y=>y.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:y=>{a(y.target.value),c(0)},onKeyDown:h,spellCheck:!1,autoComplete:"off"}),o.jsx("span",{className:"af-jump-panel__count",children:f.length})]}),f.length===0?o.jsx("div",{className:"af-jump-panel__empty",children:s("flow:jumpPalette.empty")}):o.jsx("ul",{ref:p,className:"af-jump-panel__list",role:"listbox",children:f.map((y,b)=>o.jsxs("li",{"data-idx":b,role:"option","aria-selected":b===l,className:"af-jump-panel__item"+(b===l?" af-jump-panel__item--active":""),onMouseEnter:()=>c(b),onMouseDown:k=>{k.preventDefault(),d(b)},children:[o.jsx("span",{className:"af-jump-panel__id",children:y.id}),y.label&&y.label!==y.id&&o.jsx("span",{className:"af-jump-panel__label",children:y.label}),y.definitionId&&o.jsx("span",{className:"af-jump-panel__tag",children:y.definitionId})]},y.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 TN(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 zV(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 RN(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 mg(e){return String((e==null?void 0:e.nodeId)||(e==null?void 0:e.runNodeId)||"")}function MN(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 HV({flowParams:e,scheduleNodeId:t="",runNodeId:n="",lastRunId:r="",label:s="",onClose:i}){const[a,l]=m.useState([]),[c,u]=m.useState(""),[p,f]=m.useState(null),[d,h]=m.useState(!1),[y,b]=m.useState(!1),[k,g]=m.useState(""),[w,x]=m.useState(""),N=m.useCallback(async()=>{if(e!=null&&e.flowId){h(!0),g("");try{const A=new URLSearchParams;A.set("flowId",e.flowId),A.set("flowSource",e.flowSource||"user"),t?A.set("scheduleNodeId",t):n&&A.set("runNodeId",n),A.set("limit","80");const F=await fetch(`/api/workspace/run-logs?${A.toString()}`),V=await F.json().catch(()=>({}));if(!F.ok)throw new Error(V.error||"读取日志失败");const z=Array.isArray(V.runs)?V.runs:[];l(z),u(D=>{const R=z[0]||null;return R&&String(R.status||"")==="running"&&R.runId!==D?R.runId:D&&z.some(T=>T.runId===D)?D:r&&z.some(T=>T.runId===r)?r:(R==null?void 0:R.runId)||""})}catch(A){g(String(A.message||A)),l([])}finally{h(!1)}}},[e==null?void 0:e.flowId,e==null?void 0:e.flowSource,r,n,t]),C=m.useCallback(async A=>{if(!A){f(null);return}b(!0);try{const F=await fetch(`/api/workspace/run-logs/${encodeURIComponent(A)}`),V=await F.json().catch(()=>({}));if(!F.ok)throw new Error(V.error||"读取日志详情失败");f(V)}catch(F){f({error:String(F.message||F),events:[]})}finally{b(!1)}},[]);m.useEffect(()=>{N()},[N]),m.useEffect(()=>{C(c)},[C,c]),m.useEffect(()=>{const A=a.find(V=>V.runId===c),F=window.setInterval(()=>{N(),(!A||A.status==="running")&&c&&C(c)},2e3);return()=>window.clearInterval(F)},[C,N,a,c]);const j=m.useMemo(()=>{const A=Array.isArray(p==null?void 0:p.events)?p.events:[],F=w.trim().toLowerCase();return F?A.filter(V=>String(V.type||"").toLowerCase().includes(F)||mg(V).toLowerCase().includes(F)||RN(V).toLowerCase().includes(F)):A},[p==null?void 0:p.events,w]),_=(p==null?void 0:p.run)||a.find(A=>A.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 N(),title:"刷新日志","aria-label":"刷新日志",children:o.jsx("span",{className:"material-symbols-outlined",children:"refresh"})})]}),k?o.jsx("div",{className:"af-work-run-logs__error",children:k}):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:"最近执行"}),d?o.jsx("div",{className:"af-work-run-logs__empty",children:"Loading..."}):null,!d&&a.length===0?o.jsx("div",{className:"af-work-run-logs__empty",children:"暂无执行日志"}):null,a.map(A=>o.jsxs("button",{type:"button",className:"af-work-run-logs__run"+(A.runId===c?" af-work-run-logs__run--active":""),onClick:()=>u(A.runId),title:A.runId,children:[o.jsx("span",{className:`af-work-run-logs__status af-work-run-logs__status--${MN(A.status)}`,children:A.status||"unknown"}),o.jsx("span",{className:"af-work-run-logs__run-label",children:A.label||A.runNodeId||A.scheduleNodeId||"Workspace Run"}),o.jsx("span",{children:TN(A.startedAt)}),o.jsx("span",{children:zV(A.durationMs)})]},A.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:"详情"}),_!=null&&_.label?o.jsx("div",{className:"af-work-run-logs__detail-label",children:_.label}):null,o.jsx("div",{className:"af-work-run-logs__run-id",children:(_==null?void 0:_.runId)||"-"})]}),_?o.jsx("span",{className:`af-work-run-logs__status af-work-run-logs__status--${MN(_.status)}`,children:_.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:w,onChange:A=>x(A.target.value),placeholder:"搜索事件、节点、错误"})]}),y?o.jsx("div",{className:"af-work-run-logs__empty",children:"Loading..."}):null,p!=null&&p.error?o.jsx("div",{className:"af-work-run-logs__error",children:p.error}):null,!y&&!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((A,F)=>o.jsxs("div",{className:"af-work-run-logs__event",children:[o.jsx("span",{className:"af-work-run-logs__event-time",children:TN(A.ts)}),o.jsx("span",{className:"af-work-run-logs__event-type",children:A.type||"event"}),mg(A)?o.jsx("span",{className:"af-work-run-logs__event-node",children:mg(A)}):null,o.jsx("pre",{children:RN(A)})]},`${A.ts||F}-${F}`))})]})]})]})}function BV(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 CP(e){const t=BV(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 WV(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 VV(e){return String(e).replace(/<\/script/gi,"<\\/script")}function Oh(e){const t=CP(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 mb(e,t=""){const n=CP(e),r=n.files||{},s=r[n.entry]!=null?n.entry:Object.keys(r).find(d=>/(?:^|\/)App\.[jt]sx$/i.test(d))||Object.keys(r).find(d=>/\.[jt]sx?$/i.test(d))||n.entry,i=WV(r[s]||""),a=Object.entries(r).filter(([d])=>/\.css$/i.test(d)).map(([,d])=>String(d||"")).join(`
|
|
101
|
-
|
|
102
|
-
`),l=String(n.title||"React App"),c=JSON.stringify(String(t||"")),u=JSON.stringify(n.inputs||{}),p=VV(i||"function App() { return <main><h1>React App</h1><p>No entry file content.</p></main>; }"),f=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,d=>({"<":"<",">":">","&":"&"})[d])}</title>
|
|
114
|
-
<style>${f.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
|
-
${p}
|
|
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 _P=new Set(["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"]),KV=["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"];function UV(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 qV(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 $N(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 EP(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(_P.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 AP(e){return{inputNames:$N(e==null?void 0:e.inputs),outputNames:$N(e==null?void 0:e.outputs)}}function YV(e,t,n){const r=AP(t),s=qV(e),i=[];for(const a of s)if(!EP(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 GV(e,t){const n=AP(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=EP(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 JV(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function XV(e){return e.map(t=>{const n=JV(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 QV(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 KV)_P.has(r)&&n.push({section:"runtime",insert:r,label:r,subtitle:t("flow:placeholder.runtimeConst")});return n}function ZV(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 eK(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 yf({value:e,onChange:t,disabled:n,placeholder:r,rows:s=8,textareaClassName:i,ioSlots:a,variant:l="drawer",images:c,onImagesChange:u}){const{t:p}=Cr(),f=m.useId(),d=m.useRef(null),h=m.useRef(null),[y,b]=m.useState(0),[k,g]=m.useState(0),[w,x]=m.useState(null),N=m.useMemo(()=>Di(c),[c]),C=m.useMemo(()=>YV(e,a,p),[e,a,p]),j=C.length>0,_=m.useMemo(()=>GV(e,a),[e,a]),A=m.useMemo(()=>XV(_),[_]),F=m.useMemo(()=>n?null:UV(e,y),[e,y,n]),V=m.useMemo(()=>{if(!F)return[];const M=QV(a,p);return ZV(M,F.query)},[F,a,p]);m.useEffect(()=>{g(M=>{const O=Math.max(0,V.length-1);return Math.min(Math.max(0,M),O)})},[V.length]);const z=m.useCallback(()=>{const M=d.current;if(!M||!F||V.length===0){x(null);return}const O=eK(M,y);if(!O){x(null);return}const P=4,B=44,E=13.5*16,q=Math.min(V.length*B+8,E);let W=O.bottom+P;W+q>window.innerHeight-8&&(W=Math.max(8,O.top-q-P));const L=288;let X=O.left;X=Math.max(8,Math.min(X,window.innerWidth-L-8)),x({top:W,left:X})},[F,V.length,y]);m.useLayoutEffect(()=>{if(!F||V.length===0){x(null);return}const M=requestAnimationFrame(()=>z());return()=>cancelAnimationFrame(M)},[F,V.length,y,e,z]),m.useEffect(()=>{if(!F||V.length===0)return;const M=()=>z();return window.addEventListener("scroll",M,!0),window.addEventListener("resize",M),()=>{window.removeEventListener("scroll",M,!0),window.removeEventListener("resize",M)}},[F,V.length,z]);const D=m.useCallback(M=>{if(!F)return;const{atIndex:O}=F,P=e.slice(0,O)+"${"+M+"}"+e.slice(y);t(P);const B=O+M.length+3;queueMicrotask(()=>{const E=d.current;E&&(E.focus(),E.setSelectionRange(B,B)),b(B)})},[F,e,y,t]),R=m.useCallback(()=>{const M=d.current,O=h.current;!M||!O||(O.scrollTop=M.scrollTop,O.scrollLeft=M.scrollLeft,F&&V.length>0&&queueMicrotask(()=>z()))},[F,V.length,z]),T=m.useCallback(M=>{if(!n&&F&&V.length>0&&(M.key==="ArrowDown"||M.key==="ArrowUp"||M.key==="Enter")){if(M.key==="ArrowDown")M.preventDefault(),g(O=>(O+1)%V.length);else if(M.key==="ArrowUp")M.preventDefault(),g(O=>(O-1+V.length)%V.length);else if(M.key==="Enter"&&!M.shiftKey){M.preventDefault();const O=V[k];O&&D(O.insert)}}},[n,F,V,k,D]),$=m.useCallback(async M=>{if(n||typeof u!="function")return!1;const O=await NP({files:M,body:e,images:N});return O?(t(O.body),u(O.images),queueMicrotask(()=>{const P=d.current;if(!P)return;P.focus();const B=O.body.length;P.setSelectionRange(B,B),b(B)}),!0):!1},[n,N,t,u,e]);return o.jsxs("div",{className:"af-body-prompt-editor"+(l==="expand"?" af-body-prompt-editor--expand":""),children:[N.length>0?o.jsx("div",{className:"af-body-image-list","aria-label":"image attachments",children:N.map((M,O)=>o.jsxs("span",{className:"af-body-image-chip",title:M.name,children:[o.jsx("img",{src:M.dataUrl,alt:""}),o.jsxs("span",{children:["[",M.label||`image ${O+1}`,"]"]})]},M.id||O))}):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:A+`
|
|
182
|
-
`}}),o.jsx("textarea",{ref:d,className:"af-body-prompt-textarea "+i,rows:s,value:e,disabled:n,placeholder:r,spellCheck:!1,"aria-invalid":j,"aria-describedby":j?f:void 0,onChange:M=>{t(M.target.value),b(M.target.selectionStart??M.target.value.length)},onSelect:M=>{const O=M.target;O instanceof HTMLTextAreaElement&&b(O.selectionStart??0)},onClick:M=>{const O=M.target;O instanceof HTMLTextAreaElement&&b(O.selectionStart??0)},onKeyUp:M=>{const O=M.target;O instanceof HTMLTextAreaElement&&b(O.selectionStart??O.value.length)},onKeyDown:T,onPaste:M=>{const O=SP(M);O.length!==0&&(M.preventDefault(),$(O).catch(()=>{}))},onDragOver:M=>{su(M).length>0&&M.preventDefault()},onDrop:M=>{const O=su(M);O.length!==0&&(M.preventDefault(),$(O).catch(()=>{}))},onScroll:R})]}),F&&V.length>0&&w?vr.createPortal(o.jsx("ul",{className:"af-body-ph-menu af-body-ph-menu--pop af-composer-mention-menu",role:"listbox","aria-label":p("flow:nodeProps.placeholderSlots"),style:{position:"fixed",top:w.top,left:w.left,right:"auto",bottom:"auto",margin:0,zIndex:2e4},children:V.map((M,O)=>o.jsx("li",{role:"option","aria-selected":O===k,children:o.jsxs("button",{type:"button",className:"af-composer-mention-item"+(O===k?" af-composer-mention-item--active":""),onMouseDown:P=>P.preventDefault(),onMouseEnter:()=>g(O),onClick:()=>D(M.insert),children:[o.jsx("span",{className:"af-composer-mention-id",children:`\${${M.insert}}`}),M.subtitle?o.jsx("span",{className:"af-composer-mention-sub",children:M.subtitle}):null]})},`${M.section}-${M.insert}`))}),document.body):null,j?o.jsx("p",{id:f,className:"af-body-ph-issues",role:"status",children:C.map(M=>M.message).join(" · ")}):null]})}const tK=/^[a-zA-Z_][a-zA-Z0-9_-]*$/;function Cc(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function LN({kind:e,label:t,slots:n,onSlotsChange:r,disabled:s,requiredReadonly:i=!0}){const{t:a}=Cr(),l=()=>r([...n,{type:"text",name:"",default:"",required:!1,showOnNode:!1}]),c=f=>r(n.filter((d,h)=>h!==f)),u=(f,d,h)=>{const y=n.map((b,k)=>{if(k!==f)return b;const g={...b,[d]:h};return d==="required"&&h===!0&&(g.showOnNode=!0),g});r(y)},p=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:p})}),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((f,d)=>o.jsxs("div",{className:"af-node-props-io-row",children:[o.jsxs("span",{className:"af-node-props-io-handle",title:`${p}-${d}`,children:[p,"-",d]}),o.jsx("select",{className:"af-node-props-input af-node-props-io-cell",value:f.type,onChange:h=>u(d,"type",h.target.value),disabled:s,"aria-label":a("flow:nodeProps.pinTypeAriaLabel",{label:t,index:d}),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:f.name,onChange:h=>u(d,"name",h.target.value),disabled:s,spellCheck:!1,autoComplete:"off","aria-label":a("flow:nodeProps.pinNameAriaLabel",{label:t,index:d})}),o.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:f.default,onChange:h=>u(d,"default",h.target.value),disabled:s,spellCheck:!1,autoComplete:"off","aria-label":a("flow:nodeProps.pinDefaultAriaLabel",{label:t,index:d})}),o.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:f.description||"",onChange:h=>u(d,"description",h.target.value),disabled:s,spellCheck:!1,autoComplete:"off","aria-label":a("flow:nodeProps.pinDescriptionAriaLabel",{label:t,index:d})}),o.jsx("label",{className:"af-node-props-io-flag",title:a("flow:nodeProps.requiredHint"),children:o.jsx("input",{type:"checkbox",checked:!!f.required,onChange:h=>{i||u(d,"required",h.target.checked)},disabled:s||i,"aria-label":a("flow:nodeProps.pinRequiredAriaLabel",{label:t,index:d})})}),o.jsx("label",{className:"af-node-props-io-flag",title:a("flow:nodeProps.showOnNodeHint"),children:o.jsx("input",{type:"checkbox",checked:f.showOnNode!==!1,onChange:h=>u(d,"showOnNode",h.target.checked),disabled:s,"aria-label":a("flow:nodeProps.pinShowOnNodeAriaLabel",{label:t,index:d})})}),o.jsx("button",{type:"button",className:"af-icon-btn af-node-props-io-remove",onClick:()=>c(d),disabled:s,"aria-label":a("flow:nodeProps.deletePinAriaLabel",{label:t,index:d}),title:a("flow:nodeProps.deletePin"),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete"})})]},`${p}-${d}`))]}):null]})}function nK({draft:e,setDraft:t,definitionId:n,systemPromptReadonly:r,modelLists:s,disabled:i,onIdBlur:a,onClose:l,onPublishToMarketplace:c,allowEditRequiredPins:u=!1,error:p,ioSlots:f}){const{t:d}=Cr(),[h,y]=m.useState(!1),[b,k]=m.useState(!1),[g,w]=m.useState({status:"idle",message:""}),x=m.useCallback(R=>{t(T=>T&&{...T,...R})},[t]),{cursorList:N,opencodeList:C,claudeCodeList:j,codexList:_,currentNotInLists:A}=m.useMemo(()=>{const R=Array.isArray(s==null?void 0:s.cursor)?s.cursor:[],T=Array.isArray(s==null?void 0:s.opencode)?s.opencode:[],$=Array.isArray(s==null?void 0:s.claudeCode)?s.claudeCode:[],M=Array.isArray(s==null?void 0:s.codex)?s.codex:[],O=new Set([...R,...T,...$,...M].map(Cc)),P=((e==null?void 0:e.model)??"").trim(),B=P.startsWith("cursor:")?P.slice(7):P.startsWith("opencode:")?P.slice(9):P.startsWith("codex:")?P.slice(6):P.startsWith("claude-code:")?P.slice(12):P,E=P&&!O.has(B)?P:"";return{cursorList:R,opencodeList:T,claudeCodeList:$,codexList:M,currentNotInLists:E}},[s,e==null?void 0:e.model]);if(!e)return null;const F=String(e.script??""),V=n==="tool_nodejs"||F.trim()!=="",z=typeof c=="function"&&!i&&(e==null?void 0:e.newId),D=async()=>{if(z){w({status:"running",message:d("flow:nodeProps.publishRunning")});try{const R=await c(e,n);w({status:"success",message:R!=null&&R.definitionId?d("flow:nodeProps.publishSuccessWithId",{id:R.definitionId}):d("flow:nodeProps.publishSuccess")})}catch(R){w({status:"error",message:String((R==null?void 0:R.message)||R)})}}};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:d("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:D,disabled:!z||g.status==="running",title:d("flow:nodeProps.publishToMarketplaceHint"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"inventory_2"}),g.status==="running"?d("flow:nodeProps.publishing"):d("flow:nodeProps.publishToMarketplace")]}),o.jsx("button",{type:"button",className:"af-btn-ghost af-node-props-close-secondary",onClick:l,children:d("common:common.close")})]})]}),o.jsxs("div",{className:"af-pipeline-drawer-body af-node-props-body",children:[p?o.jsx("p",{className:"af-err af-node-props-err",children:p}):null,g.message?o.jsx("p",{className:`af-node-props-market-status af-node-props-market-status--${g.status}`,children:g.message}):null,o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsx("span",{className:"af-node-props-label",children:d("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:[d("flow:nodeProps.instanceId"),o.jsx("span",{className:"af-node-props-hint",children:d("flow:node.displayNameHint")})]}),o.jsx("input",{type:"text",className:"af-node-props-input",value:e.newId,onChange:R=>x({newId:R.target.value}),onBlur:a,disabled:i,spellCheck:!1,autoComplete:"off","aria-label":d("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:[d("flow:node.displayName"),"(LABEL)"]}),o.jsx("input",{type:"text",className:"af-node-props-input",value:e.label,onChange:R=>x({label:R.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:[d("flow:node.role"),"(ROLE)"]}),o.jsx("select",{className:"af-node-props-select",value:Lu.includes(e.role)?e.role:d("flow:roles.normal"),onChange:R=>x({role:R.target.value}),disabled:i,children:Lu.map(R=>o.jsx("option",{value:R,children:R},R))})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsxs("span",{className:"af-node-props-label",children:[d("flow:node.model"),"(MODEL)"]}),o.jsx("span",{className:"af-node-props-sublabel",children:d("flow:node.modelHint")}),o.jsxs("select",{className:"af-node-props-select",value:(()=>{const R=(e.model||"").trim();return R?A||R:""})(),onChange:R=>x({model:R.target.value}),disabled:i,"aria-label":d("flow:nodeProps.modelAriaLabel"),children:[o.jsx("option",{value:"",children:d("flow:node.defaultModel")}),A?o.jsxs("option",{value:A,children:[A,d("flow:nodeProps.yamlValueNotInList")]}):null,N.length>0?o.jsx("optgroup",{label:"Cursor",children:N.map(R=>o.jsx("option",{value:Cc(R),children:R},`c-${R}`))}):null,C.length>0?o.jsx("optgroup",{label:"OpenCode",children:C.map(R=>o.jsx("option",{value:`opencode:${Cc(R)}`,children:R},`o-${R}`))}):null,_.length>0?o.jsx("optgroup",{label:"Codex",children:_.map(R=>o.jsx("option",{value:`codex:${Cc(R)}`,children:R},`codex-${R}`))}):null,j.length>0?o.jsx("optgroup",{label:"Claude Code",children:j.map(R=>o.jsx("option",{value:`claude-code:${Cc(R)}`,children:R},`cc-${R}`))}):null]})]}),o.jsx(LN,{kind:"input",label:d("flow:nodeProps.inputPins"),slots:Array.isArray(e.inputs)?e.inputs:[],onSlotsChange:R=>x({inputs:R}),disabled:i,requiredReadonly:!u}),o.jsx(LN,{kind:"output",label:d("flow:nodeProps.outputPins"),slots:Array.isArray(e.outputs)?e.outputs:[],onSlotsChange:R=>x({outputs:R}),disabled:i,requiredReadonly:!u}),V?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:[d("flow:node.directCommand"),"(script)",o.jsx("span",{className:"af-node-props-hint",children:d("flow:node.scriptHint")})]}),o.jsx("button",{type:"button",className:"af-icon-btn af-node-props-expand",onClick:()=>k(!0),"aria-label":d("flow:nodeProps.expandEditScript"),title:d("flow:nodeProps.expand"),disabled:i,children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),o.jsx(yf,{value:F,onChange:R=>x({script:R}),disabled:i,placeholder:d("flow:nodeProps.scriptPlaceholder"),rows:6,textareaClassName:"af-pipeline-drawer-textarea af-node-props-body-textarea af-node-props-script-textarea",ioSlots:f,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:R=>x({scriptRef:R.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:R=>x({implementationRef:R.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:R=>x({implementationMode:R.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:d("flow:node.userPrompt")}),o.jsx("button",{type:"button",className:"af-icon-btn af-node-props-expand",onClick:()=>y(!0),"aria-label":d("flow:nodeProps.expandEdit"),title:d("flow:nodeProps.expand"),disabled:i,children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),o.jsx(yf,{value:e.body,onChange:R=>x({body:R}),images:e.images,onImagesChange:R=>x({images:R}),disabled:i,placeholder:d("flow:nodeProps.bodyPlaceholder"),rows:8,textareaClassName:"af-pipeline-drawer-textarea af-node-props-body-textarea",ioSlots:f,variant:"drawer"})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsx("span",{className:"af-node-props-label",children:d("flow:node.systemDescription")}),o.jsx("textarea",{className:"af-pipeline-drawer-textarea af-node-props-system-readonly",rows:4,readOnly:!0,value:r||d("flow:nodeProps.noDescription"),spellCheck:!1})]})]}),b?o.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":d("flow:nodeProps.editScript"),onMouseDown:R=>{R.target===R.currentTarget&&k(!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:d("flow:node.directCommand")}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>k(!1),"aria-label":d("flow:nodeProps.collapse"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx(yf,{value:F,onChange:R=>x({script:R}),disabled:i,placeholder:d("flow:nodeProps.scriptPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:f,variant:"expand"})]})}):null,h?o.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":d("flow:nodeProps.editUserPrompt"),onMouseDown:R=>{R.target===R.currentTarget&&y(!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:d("flow:node.body")}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>y(!1),"aria-label":d("flow:nodeProps.collapse"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx(yf,{value:e.body,onChange:R=>x({body:R}),images:e.images,onImagesChange:R=>x({images:R}),disabled:i,placeholder:d("flow:nodeProps.bodyPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:f,variant:"expand"})]})}):null]})}function rK({open:e,onClose:t,flowId:n,flowSource:r,onArchived:s}){const{t:i}=Cr(),a=m.useId(),l=m.useRef(null),[c,u]=m.useState(""),[p,f]=m.useState(!1),[d,h]=m.useState("");if(m.useEffect(()=>{if(!e)return;u(""),h(""),f(!1);const g=requestAnimationFrame(()=>{var w;return(w=l.current)==null?void 0:w.focus()});return()=>cancelAnimationFrame(g)},[e,n]),!e)return null;const y=c.trim(),b=y===n;async function k(g){if(g.preventDefault(),!(!b||p)){f(!0),h("");try{const w=await fetch("/api/flow/archive",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:n,flowSource:r,confirmFlowId:y})}),x=await w.json().catch(()=>({}));if(!w.ok){h(typeof x.error=="string"?x.error:i("project:archiveModal.archiveFailed"));return}s()}catch(w){h(String((w==null?void 0:w.message)||w))}finally{f(!1)}}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:g=>{g.target===g.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:g=>g.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:k,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:g=>u(g.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":y.length>0&&!b})]}),d?o.jsx("p",{className:"af-err af-new-pipeline-err",children:d}):null,o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:p,children:i("project:archiveModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!b||p,children:i(p?"project:archiveModal.archiving":"project:archiveModal.confirmArchive")})]})]})]})})}function sK({open:e,onClose:t,flowId:n,flowSource:r,flowArchived:s=!1,onDeleted:i}){const{t:a}=Cr(),l=m.useId(),c=m.useRef(null),[u,p]=m.useState(""),[f,d]=m.useState(!1),[h,y]=m.useState("");if(m.useEffect(()=>{if(!e)return;p(""),y(""),d(!1);const w=requestAnimationFrame(()=>{var x;return(x=c.current)==null?void 0:x.focus()});return()=>cancelAnimationFrame(w)},[e,n]),!e)return null;const b=u.trim(),k=b===n;async function g(w){if(w.preventDefault(),!k||f)return;d(!0),y("");let x=null;try{const N=new AbortController;x=setTimeout(()=>N.abort(),15e3);const C=await fetch("/api/flow/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:n,flowSource:r,confirmFlowId:b,flowArchived:s}),signal:N.signal}),j=await C.json().catch(()=>({}));if(!C.ok){y(typeof j.error=="string"?j.error:a("project:deleteModal.deleteFailed"));return}try{for(let _=localStorage.length-1;_>=0;_--){const A=localStorage.key(_);A&&(A.startsWith(`af:composer-sessions:${n}:${r}`)||A.startsWith(`af:composer-active-session:${n}:${r}`)||A.startsWith(`af:workspace-composer:${n}:${r}`))&&localStorage.removeItem(A)}}catch{}await i()}catch(N){if((N==null?void 0:N.name)==="AbortError"){y(a("project:deleteModal.deleteTimeout"));return}y(String((N==null?void 0:N.message)||N))}finally{x&&clearTimeout(x),d(!1)}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:w=>{w.target===w.currentTarget&&t()},children:o.jsxs("div",{ref:c,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":l,tabIndex:-1,onMouseDown:w=>w.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:l,className:"af-shortcuts-panel__title",children:a("project:deleteModal.title")}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":a("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:g,children:[o.jsx("p",{className:"af-new-pipeline-lead",children:a("project:deleteModal.lead",{flowId:n})}),o.jsxs("label",{className:"af-new-pipeline-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:a("project:deleteModal.confirmLabel")}),o.jsx("input",{type:"text",className:"af-new-pipeline-input",value:u,onChange:w=>p(w.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":b.length>0&&!k})]}),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:f,children:a("project:deleteModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary af-btn-destructive",disabled:!k||f,children:a(f?"project:deleteModal.deleting":"project:deleteModal.confirmDelete")})]})]})]})})}const ON=80,iK=220;function oK(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 aK(e){if(!e||typeof e!="object")return e;const{selected:t,className:n,...r}=e;return r}function xf(e,t,n){const r={nodes:Array.isArray(e)?e.map(oK):[],edges:Array.isArray(t)?t.map(aK):[],extra:n&&typeof n=="object"?n:{}},s=JSON.stringify(r);return{value:JSON.parse(s),signature:s}}function gg(e,t){const n=[...e,t];return n.length>ON?n.slice(n.length-ON):n}function lK({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),p=m.useRef(null),f=m.useRef(null),d=m.useRef(null),h=m.useRef(!1),y=m.useCallback(()=>a(C=>C+1),[]),b=m.useCallback(()=>{d.current&&(window.clearTimeout(d.current),d.current=null)},[]),k=m.useCallback(()=>{b();const C=p.current,j=f.current;return p.current=null,f.current=null,!C||!j||C.signature===j.signature?(j&&(u.current=j),!1):(l.current=gg(l.current,C),c.current=[],u.current=j,y(),!0)},[y,b]),g=m.useCallback((C=[],j=[],_={})=>{b(),l.current=[],c.current=[],p.current=null,f.current=null,u.current=xf(C,j,_),h.current=!1,y()},[y,b]),w=m.useCallback(C=>{h.current=!0,u.current=C,p.current=null,f.current=null,b(),s==null||s(C.value),y()},[y,b,s]),x=m.useCallback(()=>{k();const C=u.current||xf(e,t,n),j=l.current.pop();return j?(c.current=gg(c.current,C),w(j),!0):(y(),!1)},[y,t,n,k,e,w]),N=m.useCallback(()=>{k();const C=u.current||xf(e,t,n),j=c.current.pop();return j?(l.current=gg(l.current,C),w(j),!0):(y(),!1)},[y,t,n,k,e,w]);return m.useEffect(()=>()=>b(),[b]),m.useEffect(()=>{if(!r)return;const C=xf(e,t,n);if(!u.current){u.current=C;return}if(h.current){h.current=!1,u.current=C;return}C.signature!==u.current.signature&&(p.current||(p.current=u.current),f.current=C,b(),d.current=window.setTimeout(()=>{k()},iK))},[b,t,r,n,k,e]),{canUndo:l.current.length>0||!!p.current,canRedo:c.current.length>0,resetHistory:g,undo:x,redo:N,version:i}}const cK="af:workspace-graph:v2",DN="agentflow.workspace.sidebarCollapsed",Va=["DISPLAY","CONTROL","TOOL","PROVIDE","AGENT"],uK=new Set(["control_start","control_end","control_load_skills","control_load_mcp","control_cd_workspace","control_user_workspace"]),dK={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:""}]},fK={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:""}]},pK={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}]},hK={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}]},mK={id:"control_cd_workspace",displayName:"Load Workspace",label:"Load Workspace",description:"Select a configured workspace directory and pass workspaceContext 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:"workspaceContext",default:"",showOnNode:!1}],outputs:[{type:"node",name:"next",default:""},{type:"text",name:"workspaceContext",default:"",showOnNode:!0},{type:"file",name:"cwd",default:"",showOnNode:!1}]},gK={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:"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}]},yK=new Set(["png","jpg","jpeg","gif","webp","svg"]),PP=320,IP=180,TP=960,Bp=96,RP=900,gx=520,yx=320,wf=52,ha=240,ma=160,xx="display-ref:",Du="0 9 * * *",xK="Asia/Shanghai",wK="0.1.89";function bK(){const e=new URLSearchParams(window.location.search);return{flowId:e.get("flowId")||"",flowSource:e.get("flowSource")||"user",archived:e.get("archived")==="1"||e.get("flowArchived")==="1"}}function _s(e){const t=new URLSearchParams;return e.flowId&&t.set("flowId",e.flowId),e.flowSource&&t.set("flowSource",e.flowSource),e.archived&&t.set("archived","1"),t}function Wp(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 yK.has(n)}function Fu(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=_s(t||{});return s.set("path",r),n.download&&s.set("download","1"),`/api/workspace/file/raw?${s.toString()}`}function kK(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 vK(e){const t=String((e==null?void 0:e.username)||(e==null?void 0:e.userId)||"").trim();return t?`${DN}:${t}`:DN}function SK(e){try{const t=window.localStorage.getItem(e);if(t==="false")return!1;if(t==="true")return!0}catch{}return!0}function FN(e){return!e||typeof e.closest!="function"?!1:!!e.closest("input, textarea, select, [contenteditable='true']")}function NK(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 jK(e){return!e||typeof e.closest!="function"?!1:!!e.closest(".af-flow-node__prompt-stack")&&!NK(e)}function CK(e){const t=String(e||"").trim();if(!t||_K(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 _K(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 EK(e){const t=String(e||"").trim();return t?/^模型/.test(t)?"model":/^(执行|完成|耗时):/.test(t)?"tool":/^运行/.test(t)?"run":/^\[stderr\]/.test(t)?"error":"other":"other"}function yg(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 xg(e,t,n="Workspace Run"){const r=String(e||"").trim()||n,s=String(t||"").trim();return!s||r===s?r:`${r} (${s})`}function Vo(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 AK(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)?`(+${Vo(r)} / 总 ${Vo(s)})`:"";return`${t+1}. ${n}${i}`}function MP(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 Ka(...e){for(const t of e){const n=Number(t);if(Number.isFinite(n))return n}return NaN}function PK(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 IK(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 TK(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 RK(e){var i,a,l;const t=MP(e);if(!t||typeof t!="object")return null;const n=String(t.type||""),r=String(t.subtype||""),s=Ka(t.timestamp_ms,t.completedAtMs,t.startedAtMs,e==null?void 0:e.ts,Date.now());if(n==="tool_call"&&r==="completed"){const c=IK(t),u=PK(t),p=Ka(t.startedAtMs,c==null?void 0:c.startedAtMs),f=Ka(t.completedAtMs,c==null?void 0:c.completedAtMs),d=((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(p)&&Number.isFinite(f)?Math.max(0,f-p):Ka(d.executionTime,d.localExecutionTimeMs),y=String(((l=c==null?void 0:c.args)==null?void 0:l.command)||d.command||"").trim(),b=y?y.split(`
|
|
183
|
-
`).find(Boolean)||y:"";return{kind:"tool",label:TK(u,c),durationMs:Number.isFinite(h)?h:null,at:s,detail:b?b.slice(0,90):""}}if(n==="result"){const c=Ka(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 zN(e,t,n,r){const s=(Array.isArray(e)?e:[]).map(k=>typeof k=="string"?{text:k}:k).filter(k=>k&&String(k.text||"").trim()),i=Array.isArray(t)?t:[],a=[...i].reverse().find(k=>(k==null?void 0:k.kind)==="total"&&Number.isFinite(Number(k.durationMs))),l=[...s].reverse().find(k=>Number.isFinite(Number(k.totalMs))),c=Number.isFinite(Number(r))&&Number.isFinite(Number(n))?Math.max(0,Number(r)-Number(n)):NaN,u=Ka(a==null?void 0:a.durationMs,l==null?void 0:l.totalMs,c),p=s.filter(k=>k.kind==="model").reduce((k,g)=>k+(Number(g.stepMs)||0),0),f=i.filter(k=>(k==null?void 0:k.kind)==="tool"),d=f.reduce((k,g)=>k+(Number(g.durationMs)||0),0),h=i.filter(k=>(k==null?void 0:k.kind)==="network").length,y=[...s.filter(k=>Number(k.stepMs)>=1e3).map(k=>({label:k.text,durationMs:Number(k.stepMs),detail:"Activity 间隔"})),...f.filter(k=>Number(k.durationMs)>=1e3).map(k=>({label:k.label,durationMs:Number(k.durationMs),detail:k.detail||"工具实际执行"}))].sort((k,g)=>g.durationMs-k.durationMs).slice(0,6),b=["耗时概览"];return Number.isFinite(u)&&b.push(`- 当前总耗时:${Vo(u)}`),p>0&&b.push(`- 模型相关间隔:约 ${Vo(p)}(按 Activity 间隔估算)`),f.length>0&&b.push(`- 工具实际执行:${Vo(d)}(${f.length} 次完成事件)`),h>0&&b.push(`- 网络/会话恢复事件:${h} 次`),y.length>0&&(b.push(""),b.push("慢步骤"),y.forEach((k,g)=>{const w=k.detail?` · ${k.detail}`:"";b.push(`${g+1}. ${k.label}:${Vo(k.durationMs)}${w}`)})),s.length>0&&(b.push(""),b.push("最近 Activity"),s.slice(-10).forEach((k,g)=>{b.push(AK(k,g))})),f.length>0&&(b.push(""),b.push("最近工具完成"),f.slice(-8).forEach((k,g)=>{const w=Number.isFinite(Number(k.durationMs))?` ${Vo(k.durationMs)}`:"",x=k.detail?` · ${k.detail}`:"";b.push(`${g+1}. ${k.label}${w}${x}`)})),b.join(`
|
|
184
|
-
`)}function HN(e){if(String((e==null?void 0:e.type)||"")!=="raw"||String((e==null?void 0:e.eventType)||"")!=="thinking")return"";const t=MP(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 $P(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 LP(e){const t=String((e==null?void 0:e.marketplaceDefinitionId)||(e==null?void 0:e.id)||"").trim();return t.startsWith("marketplace:")?t:""}function gb(e){if(!e)return"";const t=String(e.baseDefinitionId||"").trim();return t||String(e.id||"").trim()}function OP(e){const t=String(e??"");return/^[A-Za-z0-9_@%+=:,./-]+$/.test(t)?t:"'"+t.replace(/'/g,"'\\''")+"'"}function MK(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 $K(e){const t=String(e??"").trim();return t?t.includes("${")?t:OP(t):""}function DP(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($K).filter(Boolean):[];return[MK(t,n),OP(i),...a].join(" ")}return String(t.command||"").trim()}function Dc(e){const t=String(gb(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 BN(e){return e==="DISPLAY"?"preview":e==="CONTROL"?"account_tree":e==="TOOL"?"build":e==="PROVIDE"?"database":"smart_toy"}function Vp(e){return String((e==null?void 0:e.displayName)||(e==null?void 0:e.label)||(e==null?void 0:e.id)||"Node")}function Fc(e){return Vp(e)}function wx(e){return String((e==null?void 0:e.description)||(e==null?void 0:e.body)||"").replace(/\s+/g," ").trim()}function bf(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 WN(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 VN(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 wg(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=px(s.get(n),e.sourceHandle||"output-0","source"),a=px(s.get(r),e.targetHandle||"input-0","target");return!!(i&&a&&Ou(i,a))}function LK(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=px(i,r,s);return a?{nodeId:n,handleId:r,handleType:s,slot:a,slotType:lV(a)}:null}function OK(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"?Ou(t.slot,a):Ou(a,t.slot)))continue;const c=Dc(n);return{def:n,order:r,category:c,categoryRank:Va.indexOf(c),slot:a,slotIndex:i,displayLabel:Fc(n),description:wx(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 DK(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 p=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 f=0;f<p.length;f+=1){const d=p[f];if((d==null?void 0:d.showOnNode)===!1||!(s?Ou(n.slot,d):Ou(d,n.slot)))continue;const y=s?{source:n.nodeId,sourceHandle:n.handleId,target:u.id,targetHandle:`input-${f}`}:{source:u.id,sourceHandle:`output-${f}`,target:n.nodeId,targetHandle:n.handleId},b=(t||[]).some(k=>k.target===y.target&&k.targetHandle===y.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:d,slotIndex:f,handleId:s?y.targetHandle:y.sourceHandle,connection:y,occupied:b})}}return r.sort((u,p)=>{var b,k,g,w,x,N,C,j;const f=Number(((k=(b=u.node)==null?void 0:b.position)==null?void 0:k.y)||0),d=Number(((w=(g=p.node)==null?void 0:g.position)==null?void 0:w.y)||0),h=Number(((N=(x=u.node)==null?void 0:x.position)==null?void 0:N.x)||0),y=Number(((j=(C=p.node)==null?void 0:C.position)==null?void 0:j.x)||0);return f-d||h-y||u.slotIndex-p.slotIndex||String(u.nodeId).localeCompare(String(p.nodeId))})}function ll(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 FK(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 zK(e){return(e==null?void 0:e.default)!=null?String(e.default):(e==null?void 0:e.value)!=null?String(e.value):""}function HK(e){const t=Number(e);if(!Number.isFinite(t)||t<=0)return Du;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} * * *`:Du}function ao(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 yb(e){const t=String(e||"").trim().match(/^(\d{1,2}):(\d{1,2})$/);return t?`${ao(t[1],9,0,23)}:${ao(t[2],0,0,59)}`:"09:00"}function zc(e,t,n,r,s){const i=yb(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()||Du:`${l} ${a} * * *`}function BK(e){const n=String(e||Du).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),p=Number.isFinite(c)&&Number.isFinite(u)&&r===String(c)&&s===String(u),f=p?`${ao(u,9,0,23)}:${ao(c,0,0,59)}`:"09:00";return p&&i==="*"&&a==="*"&&l==="*"?{scheduleType:"daily",time:f,weekday:1,monthDay:1}:p&&i==="*"&&a==="*"&&/^\d+$/.test(l)?{scheduleType:"weekly",time:f,weekday:Math.max(0,Math.min(6,Number.parseInt(l,10))),monthDay:1}:p&&/^\d+$/.test(i)&&a==="*"&&l==="*"?{scheduleType:"monthly",time:f,weekday:1,monthDay:Math.max(1,Math.min(31,Number.parseInt(i,10)))}:{scheduleType:"custom",time:f,weekday:1,monthDay:1}}function xb(e){let t={};const n=String(e||"").trim();if(n)try{t=JSON.parse(n)}catch{t={}}const r=Number(t.intervalMinutes),s=HK(r),i=typeof t.cron=="string"&&t.cron.trim()?t.cron.trim():s,a=BK(i),l=["daily","weekly","monthly","custom"].includes(t.scheduleType)?t.scheduleType:a.scheduleType,c=yb(t.time||a.time||"09:00"),u=Math.max(0,Math.min(6,Number.parseInt(String(t.weekday??a.weekday??1),10)||1)),p=Math.max(1,Math.min(31,Number.parseInt(String(t.monthDay??a.monthDay??1),10)||1)),f=zc(l,c,u,p,i);return{enabled:t.enabled===!0,scheduleType:l,time:c,weekday:u,monthDay:p,cron:f,timezone:xK,targetRunNodeId:typeof t.targetRunNodeId=="string"?t.targetRunNodeId.trim():"",overlapPolicy:"skip"}}function WK(e){const t=xb(JSON.stringify(e||{}));return JSON.stringify(t)}function VK(e){const t=Number(e||0);return!Number.isFinite(t)||t<=0?"-":new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function KK(e){return e==="weekly"?"每周":e==="monthly"?"每月":e==="custom"?"高级 Cron":"每天"}function KN(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 kf(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:KN(n.nextRunAt),lastAt:KN(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 iu(e){var t;return!!((t=e==null?void 0:e.data)!=null&&t.isWorkspaceGroup)}function Kp(e){return e>0?`Group ${e+1}`:"Group"}function UK(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)||Kp(r)).trim()||Kp(r),color:String((n==null?void 0:n.color)||"purple").trim()||"purple",x:i,y:a,width:Math.max(ha,Math.round(l)),height:Math.max(ma,Math.round(c))}}).filter(Boolean)}function qK(e){var n;return UK((n=e==null?void 0:e.ui)==null?void 0:n.groups).map(r=>({id:r.id,type:bl,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 bx(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(ha,Math.round(t)),height:Math.max(ma,Math.round(n))}}function Hc(e){return(Array.isArray(e)?e:[]).map(t=>({type:(t==null?void 0:t.type)||"node",name:(t==null?void 0:t.name)||"",default:zK(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 FP(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 YK(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=Dh(t);return[FP(e),mn(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 vf(e,t){var h,y;const n=e!=null&&e.instances&&typeof e.instances=="object"?e.instances:{},r=WP(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=(y=e==null?void 0:e.ui)!=null&&y.nodeSizes&&typeof e.ui.nodeSizes=="object"?e.ui.nodeSizes:{},l=new Set(Object.keys(r));for(const b of s)b!=null&&b.source&&l.add(String(b.source)),b!=null&&b.target&&l.add(String(b.target));const u=Array.from(l).map(b=>{const k=r[b]||{},g=k.definitionId||b,w=t.find(D=>D.id===g),x=gb(w)||g,N=t.find(D=>D.id===x)||w,C=k.marketplaceRef||LP(w),j=DP(w),_=i[b]&&typeof i[b].x=="number"&&typeof i[b].y=="number"?i[b]:{x:320+l.size*20,y:180+l.size*12},A=!!mn({definitionId:x,inputs:k.input,outputs:k.output}),F=a[b]&&typeof a[b].width=="number"&&typeof a[b].height=="number"?{width:a[b].width,height:a[b].height}:null,V=ta(F,{display:A}),z=V&&!Ds(x);return{id:b,type:bl,position:_,...z?{width:V.width,height:V.height}:{},data:{label:k.label||Vp(w)||Vp(N)||b,definitionId:x,...C?{marketplaceRef:C}:{},...w!=null&&w.packageId?{marketplacePackageId:w.packageId}:{},...w!=null&&w.version?{marketplaceVersion:w.version}:{},schemaType:$P(x,N||w),role:k.role||"normal",model:k.model||void 0,body:k.body||"",script:k.script||j||"",scriptRef:k.scriptRef||"",implementationRef:k.implementationRef||"",implementationMode:k.implementationMode||"",displayReloadKey:k.displayReloadKey||"",...z?{nodeSize:V}:{},...A&&z?{displaySize:V}:{}}}}).map(b=>mx(b,r,t)),p=qK(e),f=s.filter(b=>(b==null?void 0:b.source)&&(b==null?void 0:b.target)).filter(b=>!p.some(k=>k.id===String(b.source)||k.id===String(b.target))).map((b,k)=>({id:b.id||`we-${b.source}-${b.target}-${k}`,source:String(b.source),target:String(b.target),sourceHandle:b.sourceHandle??void 0,targetHandle:b.targetHandle??void 0,markerEnd:{type:ei.ArrowClosed}})),d=[...p,...u];return{nodes:d,edges:RV(f,d),instances:r}}function UN(e){return`${xx}${e}`}function bg(e){const t=String(e||"");return t.startsWith(xx)?t.slice(xx.length):t}function zP(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 kx(e,t=[]){const n=new Map((Array.isArray(t)?t:[]).filter(f=>{var d;return ga((d=f==null?void 0:f.data)==null?void 0:d.definitionId)}).map(f=>[f.id,f])),r=Array.isArray(e==null?void 0:e.nodeIds)?e.nodeIds:[],s=[],i=new Set;for(const f of r){const d=String(f||"").trim();!d||i.has(d)||!n.has(d)||(i.add(d),s.push(d))}const a={},l=e!=null&&e.nodePositions&&typeof e.nodePositions=="object"?e.nodePositions:{};s.forEach((f,d)=>{const h=l[f];a[f]=h&&typeof h.x=="number"&&typeof h.y=="number"?{x:h.x,y:h.y}:{x:180+d*36,y:120+d*28}});const c={},u=e!=null&&e.nodeSizes&&typeof e.nodeSizes=="object"?e.nodeSizes:{};s.forEach(f=>{const d=ta(u[f],{display:!0});d&&(c[f]=d)});const p=zP(e==null?void 0:e.viewport);return{nodeIds:s,nodePositions:a,nodeSizes:c,...p?{viewport:p}:{}}}function GK(e,t=[]){return kx(e,t)}const kg=[{value:"1",label:"1 天"},{value:"7",label:"7 天"},{value:"30",label:"30 天"},{value:"90",label:"90 天"},{value:"365",label:"1 年"},{value:"permanent",label:"永久"}];function vg(e={}){return{title:"",layout:"gallery",nodeIds:[],expiresInDays:30,permanent:!1,...e}}function qN(e={}){return e.permanent?"permanent":String(e.expiresInDays||30)}function YN(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 JK(e={}){if(!e.expiresAt)return"永久有效";const t=Date.parse(String(e.expiresAt||""));return Number.isFinite(t)?`有效期至 ${new Date(t).toLocaleString()}`:"永久有效"}function GN(e={}){return new URL(e.url||`/display/${e.id||""}`,window.location.origin).href}const HP="af:workspace:canvas-clipboard",BP="agentflow.workspace.canvas-clipboard";function XK(e){return JSON.stringify({type:BP,version:1,clipboard:e})}function QK(e){try{const t=JSON.parse(String(e||""));if((t==null?void 0:t.type)!==BP)return null;const n=t.clipboard;return!n||!Array.isArray(n.nodes)||n.nodes.length===0?null:n}catch{return null}}function ZK(e){try{localStorage.setItem(HP,XK(e))}catch{}}function e7(){try{return QK(localStorage.getItem(HP))}catch{return null}}function t7(e){const t=Number.isFinite(e)?e:1;return Math.min(Math.max(t,.75),1)}async function JN(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 XN(e,t,n){const r=Number(e);return!Number.isFinite(r)||r<=0?0:Math.min(n,Math.max(t,Math.round(r)))}function ta(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:XN(n,IP,TP)||PP,height:XN(r,Bp,RP)||Bp}}function Up(e){const t=ta(e,{display:!0});return t?{width:Math.max(320,Math.round(t.width)),height:Math.max(180,Math.round(t.height))}:null}function n7(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:gx,height:yx}}function r7(e,t=""){const n=Up(e==null?void 0:e.displaySize);if(n)return n;const r=Up(e==null?void 0:e.nodeSize);if(r)return r;const s=ga(t)||od(So((e==null?void 0:e.inputs)||(e==null?void 0:e.input)||[],"displayType","markdown"));return n7(s)}function Ua(e){var s,i,a,l,c,u,p,f,d,h,y;if(Ds((s=e==null?void 0:e.data)==null?void 0:s.definitionId))return null;const t=!!mn(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(((f=(p=e==null?void 0:e.data)==null?void 0:p.displaySize)==null?void 0:f.height)||((h=(d=e==null?void 0:e.data)==null?void 0:d.nodeSize)==null?void 0:h.height)||(e==null?void 0:e.height)||(t?(y=e==null?void 0:e.measured)==null?void 0:y.height:0)||0);return ta({width:n,height:r},{display:t})}function _c(e,t,n){var p,f,d,h,y,b,k,g,w,x,N,C,j;const r=(e||[]).filter(_=>!iu(_)),s=(e||[]).filter(iu),i=WP(hb(r,n||{})),a=t.map(_=>({source:_.source,target:_.target,sourceHandle:_.sourceHandle??null,targetHandle:_.targetHandle??null})).filter(_=>!s.some(A=>A.id===_.source||A.id===_.target)),l={},c={},u=[];for(const _ of r){l[_.id]={x:((p=_.position)==null?void 0:p.x)||0,y:((f=_.position)==null?void 0:f.y)||0};const A=Ua(_);A&&(c[_.id]=A)}for(const _ of s){const A=Number(((h=(d=_.data)==null?void 0:d.nodeSize)==null?void 0:h.width)||_.width||((y=_.measured)==null?void 0:y.width)||0),F=Number(((k=(b=_.data)==null?void 0:b.nodeSize)==null?void 0:k.height)||_.height||((g=_.measured)==null?void 0:g.height)||0);u.push({id:_.id,title:String(((w=_.data)==null?void 0:w.title)||((x=_.data)==null?void 0:x.label)||"Group"),color:String(((N=_.data)==null?void 0:N.color)||"purple"),x:Number(((C=_.position)==null?void 0:C.x)||0),y:Number(((j=_.position)==null?void 0:j.y)||0),width:Math.max(ha,Math.round(A||ha)),height:Math.max(ma,Math.round(F||ma))})}return{version:1,instances:i,edges:a,ui:{nodePositions:l,nodeSizes:c,groups:u}}}function WP(e){const t={};for(const[n,r]of Object.entries(e||{})){const s=String((r==null?void 0:r.definitionId)||n);if(!!ga(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 ga(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 mn(e){const t=ga(e==null?void 0:e.definitionId);return t||(Ds(e==null?void 0:e.definitionId)&&Dh(e)?od(So((e==null?void 0:e.inputs)||(e==null?void 0:e.input)||[],"displayType","markdown")):"")}function bo(e){const t=[...(e==null?void 0:e.inputs)||[],...(e==null?void 0:e.outputs)||[]],n=mn(e),r=Ds(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 ya(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 s7(e){let t=String(e||"").replace(/\r\n/g,`
|
|
185
|
-
`).trim();return t.includes(`
|
|
186
|
-
`)||(t=t.replace(/\s+(resultFile|result|outParams|outParams\.[A-Za-z_][A-Za-z0-9_-]*)\s*:/g,`
|
|
187
|
-
$1:`).replace(/(^|\n)outParams:\s+([A-Za-z_][A-Za-z0-9_-]*\s*:)/g,`$1outParams:
|
|
188
|
-
$2`)),t}function Ai(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=s7(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 p=String(c[1]||"").trim();return p==="|"||p===">"?a.slice((c.index||0)+c[0].length).split(`
|
|
189
|
-
`).filter(d=>/^\s+/.test(d)||!d.trim()).map(d=>d.replace(/^\s{2}/,"")).join(`
|
|
190
|
-
`).replace(/\s+$/g,""):p.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 Dl(e,t){const n=_s(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 vx(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 i7(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(`
|
|
191
|
-
`)}).filter(Boolean).join(`
|
|
192
|
-
|
|
193
|
-
`)}function ql(e){let t=Ai(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 o7(e){const t=ql(e);return t.trim()?/<[^>]*$/g.test(t)?"HTML 内容末尾存在未闭合标签,可能是生成或保存时被截断。":/^(?:<!doctype\b|<html\b)/i.test(t)&&!/<\/html\s*>/i.test(t)?"完整 HTML 文档缺少 </html> 结束标签,可能是生成或保存时被截断。":"":""}function Go(e,t){return e==="html"?o7(t):""}function VP(e,t=""){const n=ql(e);if(!n.trim())return"";const s=`<base target="_blank"><script data-agentflow-display-link-guard="1">
|
|
194
|
-
(() => {
|
|
195
|
-
const frameId = ${JSON.stringify(String(t||""))};
|
|
196
|
-
const postSize = () => {
|
|
197
|
-
const doc = document.documentElement;
|
|
198
|
-
const body = document.body;
|
|
199
|
-
const height = Math.ceil(Math.max(
|
|
200
|
-
doc ? doc.scrollHeight : 0,
|
|
201
|
-
doc ? doc.offsetHeight : 0,
|
|
202
|
-
doc ? doc.clientHeight : 0,
|
|
203
|
-
body ? body.scrollHeight : 0,
|
|
204
|
-
body ? body.offsetHeight : 0,
|
|
205
|
-
body ? body.clientHeight : 0,
|
|
206
|
-
window.innerHeight || 0
|
|
207
|
-
));
|
|
208
|
-
window.parent.postMessage({ source: "agentflow-html-display-size", frameId, height }, "*");
|
|
209
|
-
};
|
|
210
|
-
document.addEventListener("click", (event) => {
|
|
211
|
-
const link = event.target && event.target.closest ? event.target.closest("a[href]") : null;
|
|
212
|
-
if (!link) return;
|
|
213
|
-
const rawHref = String(link.getAttribute("href") || "").trim();
|
|
214
|
-
if (!rawHref || rawHref.startsWith("#")) return;
|
|
215
|
-
if (/^javascript:/i.test(rawHref)) {
|
|
216
|
-
event.preventDefault();
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
event.preventDefault();
|
|
220
|
-
window.open(link.href, "_blank", "noopener,noreferrer");
|
|
221
|
-
}, true);
|
|
222
|
-
window.addEventListener("load", postSize);
|
|
223
|
-
window.addEventListener("resize", postSize);
|
|
224
|
-
requestAnimationFrame(postSize);
|
|
225
|
-
setTimeout(postSize, 60);
|
|
226
|
-
setTimeout(postSize, 300);
|
|
227
|
-
if (typeof ResizeObserver !== "undefined") {
|
|
228
|
-
const resizeObserver = new ResizeObserver(postSize);
|
|
229
|
-
resizeObserver.observe(document.documentElement);
|
|
230
|
-
if (document.body) resizeObserver.observe(document.body);
|
|
231
|
-
}
|
|
232
|
-
if (typeof MutationObserver !== "undefined") {
|
|
233
|
-
const mutationObserver = new MutationObserver(postSize);
|
|
234
|
-
mutationObserver.observe(document.documentElement, { childList: true, subtree: true, attributes: true, characterData: true });
|
|
235
|
-
}
|
|
236
|
-
})();
|
|
237
|
-
<\/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 a7(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 l7(e,t){const n=document.createElement("a");n.href=e,n.download=t,document.body.appendChild(n),n.click(),n.remove()}function c7(e,t){const n=URL.createObjectURL(e);try{l7(n,t)}finally{window.setTimeout(()=>URL.revokeObjectURL(n),1e3)}}function KP(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 u7(e){const t=KP(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>"}
|
|
238
|
-
${t.documentElement.outerHTML}`:""}function Sg(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 d7(e,t,n,r={}){var k;const s=(k=e==null?void 0:e.getBoundingClientRect)==null?void 0:k.call(e),i=KP(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,p=(r==null?void 0:r.scroller)||null,f=(r==null?void 0:r.displaySize)||null,d={fallbackWidth:Number(t)||null,fallbackHeight:Number(n)||null,displaySizeWidth:Number((f==null?void 0:f.width)||0)||null,displaySizeHeight:Number((f==null?void 0:f.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:Sg(c),displayBody:Sg(u),scroller:Sg(p)},h=[Number(t)||0,Number((f==null?void 0:f.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((p==null?void 0:p.clientWidth)||0),Number((p==null?void 0:p.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(g=>Math.ceil(g)).filter(g=>g>0),y=Math.max(1,...h.length?h:[960]),b=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:y,height:b,debug:d}}async function f7({flowParams:e,content:t,sourceFilePath:n,iframe:r,width:s,height:i,filename:a,snapshotElements:l,displaySize:c}){const u=d7(r,s,i,{...l||{},displaySize:c}),p=u7(r),f=await fetch("/api/workspace/html-screenshot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e,content:p||t,sourceFilePath:n||"",width:u.width,height:u.height,filename:a})});if(!f.ok){const h=await f.json().catch(()=>({}));throw new Error(h.error||"截图失败")}const d=await f.blob();c7(d,a)}function p7(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 UP(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 h7(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 qP({code:e}){const t=m.useMemo(()=>h7(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((p,f)=>{l.set(p.id,{x:24+(n?f*(r+i):f%3*(r+i)),y:24+(n?f%3*(s+a):f*(s+a))})});const c=Math.max(360,...Array.from(l.values()).map(p=>p.x+r+24)),u=Math.max(180,...Array.from(l.values()).map(p=>p.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((p,f)=>{const d=l.get(p.from),h=l.get(p.to);if(!d||!h)return null;const y=n?`M ${d.x+r} ${d.y+s/2} C ${(d.x+h.x+r)/2} ${d.y+s/2}, ${(d.x+h.x+r)/2} ${h.y+s/2}, ${h.x} ${h.y+s/2}`:`M ${d.x+r/2} ${d.y+s} C ${d.x+r/2} ${d.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:y,markerEnd:"url(#af-work-arrow)"},`${p.from}-${p.to}-${f}`)}),t.nodes.map(p=>{const f=l.get(p.id);return o.jsxs("g",{children:[o.jsx("rect",{className:"af-work-node__mermaid-box",x:f.x,y:f.y,width:r,height:s,rx:"8"}),o.jsx("text",{className:"af-work-node__mermaid-text",x:f.x+r/2,y:f.y+s/2+5,textAnchor:"middle",children:p.label.slice(0,22)})]},p.id)})]})})}function Us({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 p=n.current;if(!p)return;const f=Math.max(1,p.scrollHeight),d=Math.max(1,p.clientHeight),h=f>d+1,y=h?Math.max(12,d/f*100):100,b=Math.max(0,100-y),k=h?Math.min(b,p.scrollTop/Math.max(1,f-d)*b):0;i({visible:h,top:k,height:y})},[]);m.useEffect(()=>{const p=requestAnimationFrame(a),f=n.current;if(!f||typeof ResizeObserver>"u")return()=>cancelAnimationFrame(p);const d=new ResizeObserver(a);d.observe(f);for(const h of Array.from(f.children))d.observe(h);return()=>{cancelAnimationFrame(p),d.disconnect()}},[t,a]);const l=m.useCallback(p=>{const f=n.current;if(!f)return;const d=Math.max(0,f.scrollHeight-f.clientHeight);f.scrollTop=Math.min(1,Math.max(0,p))*d,a()},[a]),c=m.useCallback((p,f=0)=>{const d=r.current;if(!d)return 0;const h=d.getBoundingClientRect(),y=s.height/100*h.height,b=Math.max(1,h.height-y);return(p-h.top-f)/b},[s.height]),u=m.useCallback(p=>{var N,C;if(!s.visible)return;p.preventDefault(),p.stopPropagation();const f=r.current;if(!f)return;const d=f.getBoundingClientRect(),h=s.top/100*d.height,y=s.height/100*d.height,k=p.clientY>=d.top+h&&p.clientY<=d.top+h+y?p.clientY-d.top-h:y/2;l(c(p.clientY,k));const g=p.pointerId;(C=(N=p.currentTarget).setPointerCapture)==null||C.call(N,g);const w=j=>{j.preventDefault(),l(c(j.clientY,k))},x=()=>{window.removeEventListener("pointermove",w),window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",x)};window.addEventListener("pointermove",w),window.addEventListener("pointerup",x),window.addEventListener("pointercancel",x)},[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 YP({data:e,flowParams:t,htmlFrameRef:n,htmlFrameVersion:r=0}){const s=mn(e),i=bo(e),a=s==="image"?i:Ai(i),l=s==="image"?"":ya(a,s),[c,u]=m.useState(""),[p,f]=m.useState(""),[d,h]=m.useState(!1);m.useEffect(()=>{let w=!1;return l?(h(!0),f(""),u(""),Dl(t,l).then(x=>{w||u(x)}).catch(x=>{w||f(String(x.message||x))}).finally(()=>{w||h(!1)}),()=>{w=!0}):(u(""),f(""),h(!1),()=>{w=!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 y=l?c:a,b=s==="html"?ql(y):s==="react"?Oh(y):Ai(y),k=m.useRef("");if(k.current||(k.current=`html-display-${Math.random().toString(36).slice(2,10)}`),!s)return null;const g=Go(s,b);if(d)return o.jsxs(Us,{className:"af-work-display-empty",children:["Loading ",l,"..."]});if(p)return o.jsx(Us,{className:"af-work-display-empty",children:p});if(g)return o.jsx(Us,{className:"af-work-display-empty",children:g});if(!b.trim())return o.jsx(Us,{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"?mb(b,k.current):VP(b,k.current)},r)});if(s==="image"){const w=Fu(b,t);return o.jsx(Us,{className:"af-work-display-body af-work-display-body--image",children:o.jsx("img",{className:"af-work-display-image",src:w,alt:p7(e),loading:"lazy"})})}return s==="markdown"?o.jsx(Us,{className:"af-work-display-body af-work-display-body--markdown",children:o.jsx(cb,{content:b,basePath:l,resolveSrc:(w,x)=>Fu(w,t,x)})}):s==="chart"?o.jsx(Us,{className:"af-work-display-body af-work-display-body--chart",children:o.jsx(db,{content:b})}):s==="table"?o.jsx(Us,{className:"af-work-display-body af-work-display-body--table",children:o.jsx(ub,{content:b})}):s==="mermaid"?o.jsxs(Us,{className:"af-work-display-body",children:[o.jsx(qP,{code:b}),o.jsx("pre",{className:"af-work-node__diagram af-work-node__diagram--mermaid",children:b})]}):o.jsx(Us,{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:b})})}function m7({node:e,onClose:t}){var i,a;const n=m.useRef(null),r=mn(e==null?void 0:e.data),s=((i=e==null?void 0:e.data)==null?void 0:i.label)||(r==="html"?"HTML 展示":r==="markdown"?"Markdown 展示":"Display 预览");return m.useEffect(()=>{const l=c=>{c.key==="Escape"&&(t==null||t())};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[t]),e?vr.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:UP(r)}),o.jsx("strong",{children:s}),o.jsx("span",{children:e.id})]}),o.jsx("button",{type:"button",className:"af-display-preview-close",onClick:t,"aria-label":"关闭全屏预览",title:"关闭",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),o.jsx("div",{className:"af-display-preview-content",children:o.jsx(YP,{data:e.data,flowParams:(a=e.data)==null?void 0:a.flowParams,htmlFrameRef:n})})]})}),document.body):null}function g7({node:e}){var d,h,y,b,k,g,w,x,N,C;const t=mn(e==null?void 0:e.data),n=bo(e==null?void 0:e.data),r=t==="image"?n:Ai(n),s=t==="image"?"":ya(r,t),[i,a]=m.useState(""),[l,c]=m.useState(!1);m.useEffect(()=>{var _;let j=!1;return s?(c(!0),a(""),Dl(((_=e==null?void 0:e.data)==null?void 0:_.flowParams)||{},s).then(A=>{j||a(A)}).catch(()=>{j||a("")}).finally(()=>{j||c(!1)}),()=>{j=!0}):(a(""),c(!1),()=>{j=!0})},[s,(h=(d=e==null?void 0:e.data)==null?void 0:d.flowParams)==null?void 0:h.flowId,(b=(y=e==null?void 0:e.data)==null?void 0:y.flowParams)==null?void 0:b.flowSource,(g=(k=e==null?void 0:e.data)==null?void 0:k.flowParams)==null?void 0:g.archived,(w=e==null?void 0:e.data)==null?void 0:w.displayReloadKey]);const u=s?i:r,p=t==="html"?ql(u):t==="react"?Oh(u):Ai(u),f=Go(t,p);return l?o.jsx("div",{className:"af-display-picker-preview__empty",children:"Loading"}):f?o.jsx("div",{className:"af-display-picker-preview__empty",children:f}):p.trim()?t==="html"||t==="react"?o.jsx("iframe",{title:((x=e==null?void 0:e.data)==null?void 0:x.label)||(e==null?void 0:e.id),sandbox:"allow-scripts allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox",srcDoc:t==="react"?mb(p):VP(p)}):t==="image"?o.jsx("img",{src:Fu(p,(N=e==null?void 0:e.data)==null?void 0:N.flowParams),alt:((C=e==null?void 0:e.data)==null?void 0:C.label)||(e==null?void 0:e.id),loading:"lazy"}):t==="markdown"?o.jsx("div",{className:"af-display-picker-preview__markdown",children:o.jsx(cb,{content:p,basePath:s,resolveSrc:(j,_)=>{var A;return Fu(j,(A=e==null?void 0:e.data)==null?void 0:A.flowParams,_)}})}):t==="chart"?o.jsx(db,{content:p}):t==="table"?o.jsx(ub,{content:p}):t==="mermaid"?o.jsxs("div",{className:"af-display-picker-preview__diagram",children:[o.jsx(qP,{code:p}),o.jsx("pre",{children:p})]}):o.jsx("pre",{className:"af-display-picker-preview__pre",children:p}):o.jsx("div",{className:"af-display-picker-preview__empty",children:"No content"})}function y7({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,p]=m.useState({visible:!1,top:0,height:100}),f=m.useCallback(()=>{const g=s.current;if(!g)return;const w=Math.max(1,g.scrollHeight),x=Math.max(1,g.clientHeight),N=w>x+1,C=N?Math.max(12,x/w*100):100,j=Math.max(0,100-C),_=N?Math.min(j,g.scrollTop/Math.max(1,w-x)*j):0;p({visible:N,top:_,height:C})},[]);m.useEffect(()=>{const g=requestAnimationFrame(f),w=s.current;if(!w||typeof ResizeObserver>"u")return()=>cancelAnimationFrame(g);const x=new ResizeObserver(f);return x.observe(w),()=>{cancelAnimationFrame(g),x.disconnect()}},[f,e]);const d=m.useCallback(g=>{const w=s.current;if(!w)return;const x=Math.max(0,w.scrollHeight-w.clientHeight);w.scrollTop=Math.min(1,Math.max(0,g))*x,f()},[f]),h=m.useCallback((g,w=0)=>{const x=a.current;if(!x)return 0;const N=x.getBoundingClientRect(),C=u.height/100*N.height,j=Math.max(1,N.height-C);return(g-N.top-w)/j},[u.height]),y=m.useCallback(g=>{if(!u.visible)return;g.preventDefault(),g.stopPropagation();const w=a.current;if(!w)return;const x=w.getBoundingClientRect(),N=u.top/100*x.height,C=u.height/100*x.height,_=g.clientY>=x.top+N&&g.clientY<=x.top+N+C?g.clientY-x.top-N:C/2;d(h(g.clientY,_));const A=V=>{V.preventDefault(),d(h(V.clientY,_))},F=()=>{window.removeEventListener("pointermove",A),window.removeEventListener("pointerup",F),window.removeEventListener("pointercancel",F)};window.addEventListener("pointermove",A),window.addEventListener("pointerup",F),window.addEventListener("pointercancel",F)},[h,d,u.height,u.top,u.visible]),b=m.useCallback(g=>{const w=String(e||""),x=s.current,N=Number((x==null?void 0:x.selectionStart)??w.length),C=Number((x==null?void 0:x.selectionEnd)??N),j=w.slice(0,N),_=w.slice(C),A=j&&!j.endsWith(`
|
|
239
|
-
`)?`
|
|
240
|
-
`:"",F=_&&!_.startsWith(`
|
|
241
|
-
`)?`
|
|
242
|
-
`:"",V=`${j}${A}${g}${F}${_}`;t==null||t(V),window.requestAnimationFrame(()=>{var D,R;const z=j.length+A.length+g.length;(D=s.current)==null||D.focus(),(R=s.current)==null||R.setSelectionRange(z,z)})},[t,e]),k=m.useCallback(async g=>{if(!r&&!(!g||l)){c(!0);try{const w=await(n==null?void 0:n(g)),x=String(w||"").trim();if(x){const N=String(g.name||"image").replace(/\.[^.]+$/g,"").trim()||"image";b(``)}}finally{c(!1)}}},[b,n,r,l]);return o.jsxs("div",{className:"af-work-display-editor nodrag nopan",onClick:g=>g.stopPropagation(),onDragOver:g=>{var x;Array.from(((x=g.dataTransfer)==null?void 0:x.items)||[]).some(N=>String((N==null?void 0:N.type)||"").startsWith("image/"))&&(g.preventDefault(),g.dataTransfer.dropEffect="copy")},onDrop:g=>{var x;const w=Array.from(((x=g.dataTransfer)==null?void 0:x.files)||[]).find(Wp);w&&(g.preventDefault(),k(w))},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 g;return(g=i.current)==null?void 0:g.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:g=>{var x;const w=(x=g.target.files)==null?void 0:x[0];g.target.value="",w&&k(w)}})]}),o.jsx("textarea",{ref:s,className:"af-work-display-editor__textarea",value:e,onChange:g=>t==null?void 0:t(g.target.value),onScroll:f,onKeyDown:g=>{g.key==="Escape"&&g.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:y,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${u.height}%`,top:`${u.top}%`}})})]})}function x7({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),p=String(s.candidateContent||""),f=!!s.running,d=!!(t!=null&&t.readOnly),h=String(s.error||""),y=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:b=>b.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 b;return(b=t==null?void 0:t.onCloseNodeChat)==null?void 0:b.call(t)},"aria-label":"关闭节点微调",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),i.length>0||f||h||p.trim()?o.jsxs("div",{className:"af-work-node-chat__messages",children:[y.map((b,k)=>o.jsxs("div",{className:`af-work-node-chat__msg af-work-node-chat__msg--${b.role==="assistant"?"assistant":"user"}`,children:[o.jsx("span",{children:b.role==="assistant"?"AI":"你"}),o.jsx("p",{children:b.text})]},`${b.at||k}-${k}`)),f?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:f||d,"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:f||d,placeholder:"描述你想怎么调整这个展示",onCompositionStart:()=>{u.current=!0},onCompositionEnd:b=>{var g;u.current=!1;const k=b.currentTarget.value;c(k),(g=t==null?void 0:t.onUpdateNodeChatDraft)==null||g.call(t,e,k)},onChange:b=>{var g;const k=b.target.value;c(k),u.current||(g=t==null?void 0:t.onUpdateNodeChatDraft)==null||g.call(t,e,k)},onKeyDown:b=>{var k,g;b.isComposing||(k=b.nativeEvent)!=null&&k.isComposing||b.keyCode===229||(b.metaKey||b.ctrlKey)&&b.key==="Enter"&&(b.preventDefault(),(g=t==null?void 0:t.onSendNodeChat)==null||g.call(t,e,l))}}),o.jsx("button",{type:"button",className:"af-work-node-chat__send",disabled:f||d||!l.trim(),onClick:()=>{var b;return(b=t==null?void 0:t.onSendNodeChat)==null?void 0:b.call(t,e,l)},"aria-label":"发送",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_upward"})})]}),o.jsxs("div",{className:"af-work-node-chat__actions",children:[o.jsx("button",{type:"button",disabled:f||d||!p.trim(),onClick:()=>{var b;return(b=t==null?void 0:t.onApplyNodeChatCandidate)==null?void 0:b.call(t,e,"replace")},children:"替换当前内容"}),o.jsx("button",{type:"button",disabled:f||d||!p.trim(),onClick:()=>{var b;return(b=t==null?void 0:t.onApplyNodeChatCandidate)==null?void 0:b.call(t,e,"append")},children:"追加"})]})]}):o.jsxs("button",{type:"button",className:"af-work-node-chat-anchor nodrag nopan",onClick:b=>{var k;b.stopPropagation(),(k=t==null?void 0:t.onToggleNodeChat)==null||k.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 w7(e){return e==="mermaid"?"mmd":e==="ascii"?"txt":e==="html"?"html":e==="react"?"json":e==="image"?"txt":e==="chart"||e==="table"?"json":"md"}function b7(e){return String(e).trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)||"display"}function k7(e){return String(e||"node").trim().replace(/[^a-zA-Z0-9._-]+/g,"_").replace(/^_+|_+$/g,"").slice(0,120)||"node"}function QN(e,t=""){const n=ya(e,t).replace(/^\/+/,"");return n.startsWith("outputs/")?n:""}function v7(e,t){const n=k7(e),r=new Set,s=mn(t)||"";Ds(t==null?void 0:t.definitionId)&&r.add(`outputs/${n}`);const i=QN(bo(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(/^\/+/,""),p=QN(u,s);return p&&r.add(p),u===`outputs/${n}`||u.startsWith(`outputs/${n}/`)})&&r.add(`outputs/${n}`),Array.from(r)}function ZN(e,t){const n=mn(t)||"markdown";return`outputs/${b7((t==null?void 0:t.label)||e||n)}.${w7(n)}`}function GP({id:e,data:t,selected:n,deleteNode:r}){var me,re,de;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 Pe,Ue,pt,Te;const fe=String(((Pe=ne.slot)==null?void 0:Pe.name)||"").trim(),ve=String(((Ue=ue.slot)==null?void 0:Ue.name)||"").trim();if(fe==="next"&&ve!=="next")return-1;if(ve==="next"&&fe!=="next")return 1;const $e=String(((pt=ne.slot)==null?void 0:pt.type)||"").trim(),We=String(((Te=ue.slot)==null?void 0:Te.type)||"").trim();return $e==="node"&&We!=="node"?-1:We==="node"&&$e!=="node"?1:ne.idx-ue.idx}),l=mn(t),c=m.useRef(null),u=m.useRef(null),[p,f]=m.useState(0),[d,h]=m.useState(!1),[y,b]=m.useState(!1),[k,g]=m.useState(!1),[w,x]=m.useState(""),[N,C]=m.useState(""),[j,_]=m.useState(!1),[A,F]=m.useState(!1),V=m.useRef(null),z=bo(t),D=l==="markdown"?Ai(z):"",R=l==="markdown"?ya(D,"markdown"):"",T=l==="markdown"?R?N:D:"",$=!!(t!=null&&t.readOnly),M=!!(t!=null&&t.displayPageMode);m.useEffect(()=>{let ne=!1;return l!=="markdown"||!R?(C(""),_(!1),()=>{ne=!0}):(_(!0),Dl((t==null?void 0:t.flowParams)||{},R).then(ue=>{ne||C(ue)}).catch(ue=>{var fe;ne||(C(""),(fe=t==null?void 0:t.onStatus)==null||fe.call(t,String(ue.message||ue)))}).finally(()=>{ne||_(!1)}),()=>{ne=!0})},[l,R,(me=t==null?void 0:t.flowParams)==null?void 0:me.flowId,(re=t==null?void 0:t.flowParams)==null?void 0:re.flowSource,(de=t==null?void 0:t.flowParams)==null?void 0:de.archived,t==null?void 0:t.displayReloadKey]),m.useEffect(()=>{if(!y)return;const ne=()=>b(!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)}},[y]),m.useEffect(()=>{k||x(String(T||""))},[T,k]);const O=(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"),P=String((t==null?void 0:t.sourceNodeId)||e),B=(t==null?void 0:t.sharingDisplayNodeId)===P,E=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,q=m.useCallback(async()=>{var et,Yt,jt,$t,Ht,Xe,oe,ke,Se,qe;if(l!=="html"||d)return;const ne=bo(t),ue=ya(ne,l);let fe=ne;if(ue)try{fe=await Dl((t==null?void 0:t.flowParams)||{},ue)}catch(Ze){h(!1),console.warn("Failed to read HTML display file before saving image.",Ze);return}const ve=ql(fe);if(!ve.trim())return;const $e=Go(l,ve);if($e){console.warn($e);return}const We=(Yt=(et=u.current)==null?void 0:et.getBoundingClientRect)==null?void 0:Yt.call(et),Pe=($t=(jt=c.current)==null?void 0:jt.querySelector)==null?void 0:$t.call(jt,".af-work-display-body"),Ue=(Xe=(Ht=c.current)==null?void 0:Ht.querySelector)==null?void 0:Xe.call(Ht,".af-visible-scroll-frame__scroller"),pt=Math.round(Math.max(Number((We==null?void 0:We.width)||0),Number((E==null?void 0:E.width)||0),Number(((oe=c.current)==null?void 0:oe.clientWidth)||0),Number((Pe==null?void 0:Pe.clientWidth)||0),Number((Ue==null?void 0:Ue.clientWidth)||0),Math.max(320,Number((E==null?void 0:E.width)||960)-2))),Te=Math.round(Math.max(Number((We==null?void 0:We.height)||0),Number((E==null?void 0:E.height)||0),Number(((ke=c.current)==null?void 0:ke.clientHeight)||0),Number((Pe==null?void 0:Pe.clientHeight)||0),Number((Ue==null?void 0:Ue.clientHeight)||0),Math.max(180,Number((E==null?void 0:E.height)||640)-46)));h(!0);try{await f7({flowParams:(t==null?void 0:t.flowParams)||{},content:ve,sourceFilePath:ue,iframe:u.current,width:pt,height:Te,filename:a7((t==null?void 0:t.label)||e||"html-render","png"),snapshotElements:{card:c.current,displayBody:Pe,scroller:Ue},displaySize:E}),(Se=t==null?void 0:t.onStatus)==null||Se.call(t,"已导出 HTML 展示截图")}catch(Ze){const kt=String((Ze==null?void 0:Ze.message)||Ze||"截图失败");(qe=t==null?void 0:t.onStatus)==null||qe.call(t,`HTML 截图失败:${kt}`),console.warn("Failed to save HTML display as PNG.",Ze)}finally{h(!1)}},[t,E==null?void 0:E.height,E==null?void 0:E.width,e,l,d]),W=m.useCallback(ne=>{var ue;$||!ne||l!=="image"||(ue=t==null?void 0:t.onUploadImageToDisplayNode)==null||ue.call(t,e,ne)},[t,e,l,$]),L=m.useCallback(ne=>{var ue,fe;(ue=ne==null?void 0:ne.stopPropagation)==null||ue.call(ne),!$&&((fe=t==null?void 0:t.onSetDisplayNodeContent)==null||fe.call(t,e,"","replace",{logChat:!1,reloadDisplay:!0,statusMessage:"已清空 Display 内容"}),l==="markdown"&&(x(""),g(!1)))},[t,e,l,$]),X=m.useCallback(ne=>{var ve,$e;$||l!=="image"||!(Array.from(((ve=ne.dataTransfer)==null?void 0:ve.files)||[]).some(Wp)||Array.from((($e=ne.dataTransfer)==null?void 0:$e.items)||[]).some(We=>String((We==null?void 0:We.type)||"").startsWith("image/")))||(ne.preventDefault(),ne.stopPropagation(),ne.dataTransfer.dropEffect="copy",F(!0))},[l,$]),se=m.useCallback(ne=>{l==="image"&&(ne.currentTarget.contains(ne.relatedTarget)||F(!1))},[l]),ae=m.useCallback(ne=>{var fe;if(l!=="image")return;const ue=Array.from(((fe=ne.dataTransfer)==null?void 0:fe.files)||[]).find(Wp);ue&&(ne.preventDefault(),ne.stopPropagation(),F(!1),W(ue))},[l,W]);return o.jsxs("div",{className:"af-work-display-card"+(E?" af-work-display-card--sized":"")+(n?" af-work-display-card--selected":"")+(y?" af-work-display-card--resizing":"")+(A?" af-work-display-card--image-drop":"")+(M?" 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:E?{width:E.width,height:E.height}:void 0,ref:c,onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,onDragOver:X,onDragLeave:se,onDrop:ae,children:[o.jsx(qw,{className:"af-work-display-resize nodrag",position:"bottom-right",minWidth:320,minHeight:180,onResizeStart:()=>b(!0),onResizeEnd:()=>b(!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 fe=`${4.15+ue*1.75}rem`,ve=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:fe},children:ve}),o.jsx(Mn,{type:"target",position:Le.Left,id:`input-${ue}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:fe,background:yn(ne.type)},title:`${ve} · ${ne.type}`})]},`in-${ue}`)}),a.map(({slot:ne,idx:ue},fe)=>{if(ne.showOnNode===!1)return null;const ve=`${4.15+fe*1.75}rem`,$e=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:ve},children:$e}),o.jsx(Mn,{type:"source",position:Le.Right,id:`output-${ue}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:ve,background:yn(ne.type)},title:`${$e} · ${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:UP(l)}),o.jsx("strong",{children:O}),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,fe,ve;try{(ve=(fe=(ue=(ne=u.current)==null?void 0:ne.contentWindow)==null?void 0:ue.history)==null?void 0:fe.back)==null||ve.call(fe)}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,fe,ve;try{(ve=(fe=(ue=(ne=u.current)==null?void 0:ne.contentWindow)==null?void 0:ue.history)==null?void 0:fe.forward)==null||ve.call(fe)}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:()=>f(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:d,onClick:q,"aria-label":"截图另存为图片",title:"截图另存为图片",children:o.jsx("span",{className:"material-symbols-outlined",children:d?"hourglass_empty":"photo_camera"})})]}):null,l==="markdown"?k?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:$||j,onClick:async()=>{var ne,ue,fe;if(R){try{const ve=await vx((t==null?void 0:t.flowParams)||{},R,w);C(w),(ne=t==null?void 0:t.onSetDisplayNodeContent)==null||ne.call(t,e,ve,"replace",{logChat:!1,reloadDisplay:!0,statusMessage:`已更新 ${ve}`}),g(!1)}catch(ve){(ue=t==null?void 0:t.onStatus)==null||ue.call(t,String(ve.message||ve))}return}(fe=t==null?void 0:t.onSetDisplayNodeContent)==null||fe.call(t,e,w,"replace",{logChat:!1,statusMessage:"已更新 Markdown 内容"}),g(!1)},"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:()=>{x(String(T||"")),g(!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:$||j,onClick:ne=>{ne.stopPropagation(),x(String(T||"")),g(!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:V,className:"af-hidden-file-input",type:"file",accept:"image/*",onChange:ne=>{var fe;const ue=(fe=ne.target.files)==null?void 0:fe[0];ne.target.value="",ue&&W(ue)}}),o.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:$,onClick:ne=>{var ue;ne.stopPropagation(),(ue=V.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,P)},"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,P)},"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:$,onClick:L,"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:$,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:$,onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),l==="markdown"&&k?o.jsx(y7,{value:w,onChange:x,onUploadImage:t==null?void 0:t.onUploadWorkspaceImage,readOnly:$}):o.jsx(YP,{data:t,flowParams:t==null?void 0:t.flowParams,htmlFrameRef:u,htmlFrameVersion:p}),o.jsx(x7,{nodeId:e,data:t})]})}function S7({id:e,data:t,selected:n,deleteNode:r}){var p,f,d;const s=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],i=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],a=((f=(p=t==null?void 0:t.runningRunNodeIds)==null?void 0:p.has)==null?void 0:f.call(p,e))||((d=t==null?void 0:t.runningRunNodeIds)==null?void 0:d[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,y)=>{if(h.showOnNode===!1)return null;const b=`${2.25+y*1.75}rem`,k=h.name||`#${y+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:b},children:k}),o.jsx(Mn,{type:"target",position:Le.Left,id:`input-${y}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:b,background:yn(h.type)},title:`${k} · ${h.type}`})]},`in-${y}`)}),i.map((h,y)=>{if(h.showOnNode===!1)return null;const b=`${2.25+y*1.75}rem`,k=h.name||`#${y+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:b},children:k}),o.jsx(Mn,{type:"source",position:Le.Right,id:`output-${y}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:b,background:yn(h.type)},title:`${k} · ${h.type}`})]},`out-${y}`)}),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 y,b;h.stopPropagation(),a?(y=t==null?void 0:t.onStopWorkspaceNode)==null||y.call(t,e):(b=t==null?void 0:t.onRunWorkspaceNode)==null||b.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 y;h.stopPropagation(),(y=t==null?void 0:t.onOptimizeWorkspaceRun)==null||y.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 y;h.stopPropagation(),(y=t==null?void 0:t.onOpenWorkspaceRunLogs)==null||y.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 N7({id:e,data:t,selected:n,deleteNode:r,skills:s,skillCollections:i,workspaces:a}){var Xe,oe,ke,Se,qe,Ze,kt;const l=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],c=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],u=z7(t),[p,f]=m.useState(u.task),d=m.useRef(!1),h=m.useRef(u.task),y=((oe=(Xe=t==null?void 0:t.runningRunNodeIds)==null?void 0:Xe.has)==null?void 0:oe.call(Xe,e))||((ke=t==null?void 0:t.runningRunNodeIds)==null?void 0:ke[e])===!0||(t==null?void 0:t.isExecuting)||(t==null?void 0:t.nodeStatus)==="running",b=(t==null?void 0:t.nodeStatus)==="stopped",k=!!(t!=null&&t.readOnly),g=Array.isArray(s)?s:[],w=Array.isArray(i)?i:[],x=m.useMemo(()=>(Array.isArray(a)?a:[]).map(Z=>({id:String((Z==null?void 0:Z.id)||""),label:String((Z==null?void 0:Z.label)||(Z==null?void 0:Z.name)||"Workspace"),kind:(Z==null?void 0:Z.kind)==="git"?"git":"local",path:String((Z==null?void 0:Z.path)||""),repoUrl:String((Z==null?void 0:Z.repoUrl)||""),branch:String((Z==null?void 0:Z.branch)||""),mountPath:String((Z==null?void 0:Z.mountPath)||""),builtin:(Z==null?void 0:Z.builtin)===!0,exists:(Z==null?void 0:Z.exists)!==!1,type:String((Z==null?void 0:Z.type)||"")})).filter(Z=>Z.path),[a]),[N,C]=m.useState(!1),[j,_]=m.useState(""),[A,F]=m.useState(()=>new Set),[V,z]=m.useState(!1),[D,R]=m.useState(""),[T,$]=m.useState("config"),M=Dh(t),O=!!M,P=tI(u.displayType),B=m.useMemo(()=>r7(t,P),[t==null?void 0:t.displaySize,t==null?void 0:t.nodeSize,t==null?void 0:t.inputs,t==null?void 0:t.input,P]),E=m.useMemo(()=>({...t,sourceNodeId:e,label:t!=null&&t.label&&t.label!=="Context Run"?t.label:"一键任务",definitionId:P,displaySize:B,nodeSize:B,body:M,inputs:[{type:"text",name:P==="display_image"?"src":"content",value:M,default:M}],outputs:c.length?c:[{type:"node",name:"next",default:""}]}),[t,P,e,M,c,B]),q=Array.isArray((Se=t==null?void 0:t.modelLists)==null?void 0:Se.cursor)?t.modelLists.cursor:[],W=Array.isArray((qe=t==null?void 0:t.modelLists)==null?void 0:qe.opencode)?t.modelLists.opencode:[],L=Array.isArray((Ze=t==null?void 0:t.modelLists)==null?void 0:Ze.claudeCode)?t.modelLists.claudeCode:[],X=Array.isArray((kt=t==null?void 0:t.modelLists)==null?void 0:kt.codex)?t.modelLists.codex:[],se=m.useMemo(()=>new Set(q.map(ls)),[q]),ae=m.useMemo(()=>new Set(W.map(ls)),[W]),me=m.useMemo(()=>new Set(L.map(ls)),[L]),re=m.useMemo(()=>new Set(X.map(ls)),[X]),de=u.model,ne=m.useMemo(()=>de?de.startsWith("cursor:")||de.startsWith("opencode:")||de.startsWith("codex:")||de.startsWith("claude-code:")?de:me.has(de)?`claude-code:${de}`:re.has(de)?`codex:${de}`:ae.has(de)?`opencode:${de}`:se.has(de)?`cursor:${de}`:de:"",[me,re,se,ae,de]),ue=de.startsWith("cursor:")?de.slice(7):de.startsWith("opencode:")?de.slice(9):de.startsWith("codex:")?de.slice(6):de.startsWith("claude-code:")?de.slice(12):de,fe=ue,ve=!!de&&!se.has(fe)&&!ae.has(fe)&&!me.has(fe)&&!re.has(fe),$e=m.useMemo(()=>new Set(u.skillKeys),[u.skillKeys]),We=m.useMemo(()=>new Map(g.map(Z=>[Z.key,Z])),[g]),Pe=m.useMemo(()=>{const Z=new Set,xe=w.map(Ce=>{const nt=la(Ce,g).map(ht=>We.get(ht)).filter(Boolean);for(const ht of nt)Z.add(ht.key);return{...Ce,skills:nt}}).filter(Ce=>Ce.skills.length>0),He=g.filter(Ce=>!Z.has(Ce.key));return{collectionGroups:xe,ungrouped:He}},[w,We,g]);m.useEffect(()=>{F(Z=>{let xe=!1;const He=new Set(Z);for(const Ce of Pe.collectionGroups)He.has(Ce.id)||(He.add(Ce.id),xe=!0);return xe?He:Z})},[Pe.collectionGroups]);const Ue=m.useMemo(()=>{const Z=j.trim().toLowerCase();if(!Z)return Pe;const xe=Ce=>[Ce==null?void 0:Ce.key,Ce==null?void 0:Ce.name,Ce==null?void 0:Ce.description].map(nt=>String(nt||"").toLowerCase()).join(" ").includes(Z);return{collectionGroups:Pe.collectionGroups.map(Ce=>{const nt=[Ce==null?void 0:Ce.id,Ce==null?void 0:Ce.name,Ce==null?void 0:Ce.description].map(ht=>String(ht||"").toLowerCase()).join(" ").includes(Z);return{...Ce,skills:nt?Ce.skills:Ce.skills.filter(xe)}}).filter(Ce=>Ce.skills.length>0),ungrouped:Pe.ungrouped.filter(xe)}},[Pe,j]),pt=m.useMemo(()=>{const Z=D.trim().toLowerCase();return Z?x.filter(xe=>[xe.id,xe.label,xe.path,xe.repoUrl,xe.branch,xe.mountPath,xe.type].join(" ").toLowerCase().includes(Z)):x},[x,D]),Te=m.useMemo(()=>{var He,Ce,nt;const Z=String(((He=u.workspaceContext)==null?void 0:He.cwd)||((Ce=u.workspaceContext)==null?void 0:Ce.workspaceRoot)||"").trim(),xe=String(((nt=u.workspaceContext)==null?void 0:nt.id)||"").trim();return x.find(ht=>xe&&ht.id===xe||Z&&ht.path===Z)||null},[u.workspaceContext,x]);m.useEffect(()=>{u.task!==h.current&&(h.current=u.task,d.current||f(u.task))},[u.task]),m.useEffect(()=>{if(!O){$("config");return}y||$("result")},[O,M,y]),m.useEffect(()=>{var xe,He;if(!(T==="result"&&O))return;(xe=t==null?void 0:t.onEnsureWorkspaceNodeDisplaySize)==null||xe.call(t,e,B),(He=t==null?void 0:t.onRefreshNodeInternals)==null||He.call(t,e);const Z=window.setTimeout(()=>{var Ce;return(Ce=t==null?void 0:t.onRefreshNodeInternals)==null?void 0:Ce.call(t,e)},120);return()=>window.clearTimeout(Z)},[t==null?void 0:t.onEnsureWorkspaceNodeDisplaySize,t==null?void 0:t.onRefreshNodeInternals,P,O,e,M,B,T]);const et=Z=>{var xe;(xe=t==null?void 0:t.onChangeContextRunConfig)==null||xe.call(t,e,{...u,task:p,...Z})},Yt=(Z=p)=>{var He;const xe=String(Z??"");xe!==u.task&&(h.current=xe,(He=t==null?void 0:t.onChangeContextRunConfig)==null||He.call(t,e,{...u,task:xe}))},jt=(Z,xe)=>{const He=new Set(u.skillKeys);for(const Ce of Z){const nt=String(Ce||"").trim();nt&&(xe?He.add(nt):He.delete(nt))}et({skillKeys:Array.from(He)})},$t=Z=>{F(xe=>{const He=new Set(xe);return He.has(Z)?He.delete(Z):He.add(Z),He})},Ht=Z=>{const xe=Z?{version:1,id:Z.id||"",label:Z.label||"Workspace",kind:Z.kind||"local",cwd:Z.path||"",workspaceRoot:Z.path||"",repoUrl:Z.repoUrl||"",branch:Z.branch||"",mountPath:Z.mountPath||"",type:Z.type||""}:null;et({includeWorkspaceContext:!!Z,workspaceContext:xe}),z(!1)};return T==="result"&&O?o.jsx(GP,{id:e,data:{...E,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":"")+(T==="result"&&O?" af-work-context-run-card--result":"")+(y?" 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":"")+(b?" af-work-context-run-card--stopped":""),onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,children:[l.map((Z,xe)=>{if(Z.showOnNode===!1)return null;const He=`${2.25+xe*1.75}rem`,Ce=Z.name||`#${xe+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:He},children:Ce}),o.jsx(Mn,{type:"target",position:Le.Left,id:`input-${xe}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:He,background:yn(Z.type)},title:`${Ce} · ${Z.type}`})]},`in-${xe}`)}),c.map((Z,xe)=>{if(Z.showOnNode===!1)return null;const He=`${2.25+xe*1.75}rem`,Ce=Z.name||`#${xe+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:He},children:Ce}),o.jsx(Mn,{type:"source",position:Le.Right,id:`output-${xe}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:He,background:yn(Z.type)},title:`${Ce} · ${Z.type}`})]},`out-${xe}`)}),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:Z=>Z.stopPropagation(),onMouseDown:Z=>Z.stopPropagation(),onClick:Z=>Z.stopPropagation(),children:[o.jsxs("select",{className:"af-work-context-run-card__model",value:ne,disabled:k,"aria-label":"模型",title:ue||"默认模型",onChange:Z=>et({model:Z.target.value}),children:[o.jsx("option",{value:"",children:"默认"}),ve?o.jsx("option",{value:de,children:de}):null,q.length?o.jsx("optgroup",{label:"Cursor",children:q.map(Z=>o.jsx("option",{value:`cursor:${ls(Z)}`,children:ls(Z)},`context-cursor-${Z}`))}):null,W.length?o.jsx("optgroup",{label:"OpenCode",children:W.map(Z=>o.jsx("option",{value:`opencode:${ls(Z)}`,children:ls(Z)},`context-opencode-${Z}`))}):null,X.length?o.jsx("optgroup",{label:"Codex",children:X.map(Z=>o.jsx("option",{value:`codex:${ls(Z)}`,children:ls(Z)},`context-codex-${Z}`))}):null,L.length?o.jsx("optgroup",{label:"Claude Code",children:L.map(Z=>o.jsx("option",{value:`claude-code:${ls(Z)}`,children:ls(Z)},`context-claude-${Z}`))}):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:Ds(t==null?void 0:t.definitionId)?"workspace_one_click_task":(t==null?void 0:t.definitionId)||"workspace_one_click_task"}),O?o.jsxs("div",{className:"af-work-context-run-card__view-switch nodrag",onClick:Z=>Z.stopPropagation(),children:[o.jsx("button",{type:"button",className:T==="config"?"is-active":"",onClick:()=>$("config"),"aria-label":"切换到任务配置",children:o.jsx("span",{className:"material-symbols-outlined",children:"tune"})}),o.jsx("button",{type:"button",className:T==="result"?"is-active":"",onClick:()=>$("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:k,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:p,disabled:k,placeholder:"输入任务,例如:基于当前 workspace 总结需求并生成展示页",onCompositionStart:()=>{d.current=!0},onCompositionEnd:Z=>{d.current=!1,f(Z.currentTarget.value),Yt(Z.currentTarget.value)},onChange:Z=>{f(Z.target.value)},onBlur:Z=>Yt(Z.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:k,className:"af-work-context-run-card__select",onClick:Z=>{var xe;Z.stopPropagation(),N||(xe=t==null?void 0:t.onRefreshSkills)==null||xe.call(t),C(He=>!He)},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"})]}),N?o.jsxs("div",{className:"af-work-context-run-card__skills-menu",onClick:Z=>Z.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:Z=>_(Z.target.value),placeholder:"搜索 Skills...",spellCheck:!1,autoComplete:"off","aria-label":"搜索 Skills"}),j?o.jsx("button",{type:"button",onClick:()=>_(""),"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 af-work-context-run-card__menu-scroll",children:[Ue.collectionGroups.map(Z=>{const xe=Z.skills.map(ht=>ht.key),He=xe.filter(ht=>$e.has(ht)).length,Ce=xe.length>0&&He===xe.length,nt=A.has(Z.id);return o.jsxs("section",{className:"af-work-load-skills-menu__group"+(nt?" 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:Ce,disabled:k,onChange:ht=>jt(xe,ht.target.checked),"aria-label":`选择 ${Z.name}`}),o.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-toggle",onClick:()=>$t(Z.id),"aria-expanded":!nt,children:o.jsxs("span",{className:"af-work-load-skills-menu__group-main",children:[o.jsx("span",{children:Z.name}),Z.description?o.jsx("em",{children:Z.description}):null]})}),o.jsxs("small",{children:[He,"/",xe.length]}),o.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-arrow",onClick:()=>$t(Z.id),"aria-label":nt?`展开 ${Z.name}`:`收起 ${Z.name}`,children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:nt?"chevron_right":"expand_more"})})]}),nt?null:o.jsx("div",{className:"af-work-load-skills-menu__options",children:Z.skills.map(ht=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:$e.has(ht.key),disabled:k,onChange:un=>jt([ht.key],un.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:ht.name}),ht.description?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:ht.description}):null]})]},`${Z.id}:${ht.key}`))})]},Z.id)}),Ue.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:Ue.ungrouped.length})]}),o.jsx("div",{className:"af-work-load-skills-menu__options",children:Ue.ungrouped.map(Z=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:$e.has(Z.key),disabled:k,onChange:xe=>jt([Z.key],xe.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]})]},`ungrouped:${Z.key}`))})]}):null,Ue.collectionGroups.length===0&&Ue.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:()=>et({skillKeys:[]}),children:"清空"})]})]}):null]}),o.jsxs("div",{className:"af-work-context-run-card__workspace",children:[o.jsxs("button",{type:"button",disabled:k,className:"af-work-context-run-card__select",onClick:Z=>{var xe;Z.stopPropagation(),V||(xe=t==null?void 0:t.onRefreshWorkspaces)==null||xe.call(t),z(He=>!He)},children:[o.jsx("span",{className:"material-symbols-outlined",children:Te?"folder_open":"folder_off"}),o.jsx("span",{children:(Te==null?void 0:Te.label)||"Workspace"}),o.jsx("span",{className:"material-symbols-outlined",children:"expand_more"})]}),V?o.jsxs("div",{className:"af-work-context-run-card__workspace-menu",onClick:Z=>Z.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:Z=>R(Z.target.value),placeholder:"搜索 Workspace...",spellCheck:!1,autoComplete:"off","aria-label":"搜索 Workspace"}),D?o.jsx("button",{type:"button",onClick:()=>R(""),"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 af-work-context-run-card__menu-scroll",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:"Workspace"}),o.jsx("small",{children:pt.length})]}),o.jsx("div",{className:"af-work-load-skills-menu__options",children:pt.map(Z=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"radio",name:`context-workspace-${e}`,checked:(Te==null?void 0:Te.path)===Z.path,disabled:k,onChange:()=>Ht(Z)}),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.label}),o.jsxs("span",{className:"af-work-load-skills-menu__option-desc",children:[Z.kind==="git"&&Z.repoUrl?`${Z.repoUrl}${Z.branch?` · ${Z.branch}`:""}${Z.mountPath?` · ${Z.mountPath}`:""}`:Z.path,Z.exists?"":" · 路径未就绪"]})]})]},`${Z.id}:${Z.path}`))})]}),pt.length===0?o.jsx("div",{className:"af-work-load-skills-menu__empty",children:"没有匹配的 Workspace"}):null,o.jsx("button",{type:"button",className:"af-work-load-skills-menu__clear",onClick:()=>Ht(null),children:"不加载 Workspace"})]})]}):null]}),o.jsxs("select",{value:u.displayType,disabled:k,onChange:Z=>et({displayType:Z.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"})]})]}),M?o.jsx("pre",{className:"af-work-context-run-card__preview",children:M.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"+(y?" af-work-run-card__button--stop":""),disabled:k,onClick:Z=>{var xe,He;Z.stopPropagation(),Yt(),y?(xe=t==null?void 0:t.onStopWorkspaceNode)==null||xe.call(t,e):(He=t==null?void 0:t.onRunWorkspaceNode)==null||He.call(t,e)},children:[o.jsx("span",{className:"material-symbols-outlined",children:y?"stop_circle":"play_arrow"}),o.jsx("span",{children:y?"Stop":"Run"})]}),o.jsx("button",{type:"button",className:"af-work-run-card__button af-work-context-run-card__logs nodrag",onClick:Z=>{var xe;Z.stopPropagation(),(xe=t==null?void 0:t.onOpenWorkspaceRunLogs)==null||xe.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 j7({id:e,data:t,selected:n,deleteNode:r}){var N,C,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=xb((t==null?void 0:t.body)||""),l=(t==null?void 0:t.scheduledRunState)||{},c=((C=(N=t==null?void 0:t.runningRunNodeIds)==null?void 0:N.has)==null?void 0:C.call(N,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,p=(t==null?void 0:t.nodeStatus)==="stopped",f=!!(t!=null&&t.readOnly),d=_=>{var A;(A=t==null?void 0:t.onChangeScheduledRunConfig)==null||A.call(t,e,{...a,..._})},h=_=>{d({scheduleType:_,cron:zc(_,a.time,a.weekday,a.monthDay,a.cron)})},y=_=>{d({time:_,cron:zc(a.scheduleType,_,a.weekday,a.monthDay,a.cron)})},[b,k]=yb(a.time).split(":"),g=(_,A)=>{y(`${ao(_,9,0,23)}:${ao(A,0,0,59)}`)},w=_=>{d({weekday:_,cron:zc(a.scheduleType,a.time,_,a.monthDay,a.cron)})},x=_=>{d({monthDay:_,cron:zc(a.scheduleType,a.time,a.weekday,_,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":"")+(p?" af-work-run-card--stopped":""),onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,children:[s.map((_,A)=>{if(_.showOnNode===!1)return null;const F=`${2.25+A*1.75}rem`,V=_.name||`#${A+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:F},children:V}),o.jsx(Mn,{type:"target",position:Le.Left,id:`input-${A}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:F,background:yn(_.type)},title:`${V} · ${_.type}`})]},`in-${A}`)}),i.map((_,A)=>{if(_.showOnNode===!1)return null;const F=`${2.25+A*1.75}rem`,V=_.name||`#${A+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:F},children:V}),o.jsx(Mn,{type:"source",position:Le.Right,id:`output-${A}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:F,background:yn(_.type)},title:`${V} · ${_.type}`})]},`out-${A}`)}),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:f,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:f,onChange:_=>d({enabled:_.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:f,onChange:_=>h(_.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:b,disabled:f,"aria-label":"小时",onChange:_=>g(_.target.value,k),children:Array.from({length:24},(_,A)=>ao(A,0,0,23)).map(_=>o.jsxs("option",{value:_,children:[_," 时"]},_))}),o.jsx("select",{value:k,disabled:f,"aria-label":"分钟",onChange:_=>g(b,_.target.value),children:Array.from({length:12},(_,A)=>ao(A*5,0,0,59)).map(_=>o.jsxs("option",{value:_,children:[_," 分"]},_))})]})]}):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:f,onChange:_=>w(_.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:f,onChange:_=>x(_.target.value),children:Array.from({length:31},(_,A)=>A+1).map(_=>o.jsxs("option",{value:_,children:[_," 日"]},_))})]}):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:f,spellCheck:!1,placeholder:Du,onChange:_=>d({cron:_.target.value})})]}):null,o.jsxs("div",{className:"af-work-schedule-card__meta",children:[o.jsxs("span",{children:[KK(a.scheduleType)," ",a.scheduleType==="custom"?"":a.time]}),o.jsxs("span",{children:["Next ",VK(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:f||u,onClick:_=>{var A,F;_.stopPropagation(),c?(A=t==null?void 0:t.onStopWorkspaceNode)==null||A.call(t,e):(F=t==null?void 0:t.onRunWorkspaceNode)==null||F.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:f||c||u,title:"为下游节点提前生成 implementation",onClick:_=>{var A;_.stopPropagation(),(A=t==null?void 0:t.onOptimizeWorkspaceSchedule)==null||A.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:_=>{var A;_.stopPropagation(),(A=t==null?void 0:t.onOpenWorkspaceRunLogs)==null||A.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 C7({id:e,data:t,selected:n,deleteNode:r}){const{setNodes:s}=Vl(),i=!!(t!=null&&t.readOnly),a=bx(t==null?void 0:t.nodeSize)||{width:ha,height:ma},l=m.useCallback(c=>{var u,p;c.button!==0||c.metaKey||c.ctrlKey||c.shiftKey||(p=(u=c.target)==null?void 0:u.closest)!=null&&p.call(u,".af-work-group-node__resize, .af-work-group-node__delete")||s(f=>QP(f,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(qw,{className:"af-work-group-node__resize nodrag",minWidth:ha,minHeight:ma,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 _7(e){var y,b,k,g,w,x,N,C,j,_,A,F,V,z,D,R,T,$,M,O,P,B,E;const{setEdges:t,setNodes:n}=Vl(),r=(y=e.data)==null?void 0:y.onSyncNodePropDraft,s=!!((b=e.data)!=null&&b.readOnly),[i,a]=m.useState(!1),l=(k=e.data)!=null&&k.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(q=>{var X,se,ae;if(s)return;(se=(X=e.data)==null?void 0:X.onCleanupWorkspaceNodeOutputs)==null||se.call(X,q,e.data);const W=Ds((ae=e.data)==null?void 0:ae.definitionId)?nI(q):"",L=new Set([q,W].filter(Boolean));n(me=>me.filter(re=>!L.has(re.id))),t(me=>me.filter(re=>!L.has(re.source)&&!L.has(re.target)))},[e.data,s,t,n]),u=m.useCallback(q=>{var W,L;q.button!==0||q.metaKey||q.ctrlKey||q.shiftKey||(L=(W=q.target)==null?void 0:W.closest)!=null&&L.call(W,".react-flow__handle, .af-work-display-resize")||(n(X=>QP(X,e.id)),t(X=>P7(X)))},[e.id,t,n]),p=m.useCallback((q,W)=>{s||(n(L=>L.map(X=>X.id===q?{...X,data:{...X.data,model:W}}:X)),r==null||r(q,{model:W}))},[s,n,r]),f=m.useCallback((q,W)=>{s||(n(L=>L.map(X=>{var ae;if(X.id!==q)return X;const se=Array.isArray((ae=X.data)==null?void 0:ae.outputs)&&X.data.outputs.length?X.data.outputs.map((me,re)=>re===0?{...me,default:W,value:W}:me):[{type:"bool",name:"value",default:W,value:W}];return{...X,data:{...X.data,body:"",outputs:se}}})),r==null||r(q,L=>({body:"",outputs:Array.isArray(L==null?void 0:L.outputs)&&L.outputs.length?L.outputs.map((se,ae)=>ae===0?{...se,default:W,value:W}:se):[{type:"bool",name:"value",default:W,value:W}]})))},[s,n,r]),d=m.useCallback((q,W)=>{s||(n(L=>L.map(X=>X.id===q?{...X,data:{...X.data,body:W}}:X)),r==null||r(q,{body:W}))},[s,n,r]),h=m.useCallback((q,W)=>{if(s)return;const L=Di(W);n(X=>X.map(se=>se.id===q?{...se,data:{...se.data,images:L}}:se)),r==null||r(q,{images:L})},[s,n,r]);return(g=e.data)!=null&&g.isWorkspaceGroup?o.jsx(C7,{...e,deleteNode:c}):ga((w=e.data)==null?void 0:w.definitionId)?o.jsx(GP,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c}):((x=e.data)==null?void 0:x.definitionId)==="workspace_run"?o.jsx(S7,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c}):((N=e.data)==null?void 0:N.definitionId)==="workspace_scheduled_run"?o.jsx(j7,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c}):Ds((C=e.data)==null?void 0:C.definitionId)?o.jsx(N7,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c,skills:(j=e.data)==null?void 0:j.skills,skillCollections:(_=e.data)==null?void 0:_.skillCollections,workspaces:(A=e.data)==null?void 0:A.workspaceTargets}):((F=e.data)==null?void 0:F.definitionId)==="control_load_skills"?o.jsx(q7,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c,skills:(V=e.data)==null?void 0:V.skills,skillCollections:(z=e.data)==null?void 0:z.skillCollections,onChangeSkillKeys:(D=e.data)==null?void 0:D.onChangeLoadSkillKeys}):((R=e.data)==null?void 0:R.definitionId)==="control_load_mcp"?o.jsx(Y7,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c,servers:(T=e.data)==null?void 0:T.mcpServers,onChangeMcpNames:($=e.data)==null?void 0:$.onChangeLoadMcpNames}):((M=e.data)==null?void 0:M.definitionId)==="control_cd_workspace"?o.jsx(G7,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c,workspaces:(O=e.data)==null?void 0:O.workspaceTargets,onChangeWorkspace:(P=e.data)==null?void 0:P.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":""),style:l?{width:l.width,height:l.height}:void 0,onPointerDownCapture:u,children:[s?null:o.jsx(qw,{className:"af-work-display-resize af-work-flow-resize nodrag",position:"bottom-right",minWidth:IP,minHeight:Bp,maxWidth:TP,maxHeight:RP,onResizeStart:()=>a(!0),onResizeEnd:()=>a(!1),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_full"})}),o.jsx(bV,{...e,deleteNode:c,modelLists:(E=e.data)==null?void 0:E.modelLists,onModelChange:p,onProvideValueChange:f,onNodeBodyChange:d,onNodeImagesChange:h})]})}const E7={[bl]:_7};function wb(e,t=[]){for(const n of e||[])n.type==="file"&&t.push(n),Array.isArray(n.children)&&wb(n.children,t);return t}function JP(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)?JP(r.children,n):null;if(s)return s}return null}function A7(e){const t=String(e||"").replace(/\\/g,"/").replace(/^\/+|\/+$/g,"");return!t||!t.includes("/")?"":t.split("/").slice(0,-1).join("/")}function XP(e,t=[]){for(const n of e||[])n.type==="directory"&&(t.push(n.path),Array.isArray(n.children)&&XP(n.children,t));return t}function Sf(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 QP(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 P7(e){let t=!1;const n=(e||[]).map(r=>r.selected?(t=!0,{...r,selected:!1}):r);return t?n:e}function I7(e){return[...e||[]].sort((t,n)=>t.type!==n.type?t.type==="directory"?-1:1:String(t.name||"").localeCompare(String(n.name||"")))}function T7(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,p=a===r.length-1;let f=!1;const d=(Array.isArray(i)?i:[]).map(h=>h.name!==c?h:(f=!0,p?{...h,type:"file",name:c,path:u,icon:ll(c),size:n}:{...h,type:"directory",name:c,path:u,icon:ll(c,!0),children:s(h.children||[],a+1,u)}));return f||d.push(p?{type:"file",name:c,path:u,icon:ll(c),size:n}:{type:"directory",name:c,path:u,icon:ll(c,!0),children:s([],a+1,u)}),I7(d)};return s(e||[],0,"")}function R7(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 ZP({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 p=u.type==="directory",f=p&&(r==null?void 0:r.has(u.path)),d=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+(d?" af-work-file--selected":""),draggable:!p,onDragStart:y=>{p||a==null||a(y,u)},onClick:()=>{i==null||i(u),p&&(s==null||s(u.path))},onDoubleClick:()=>{p||t(u)},title:u.path,children:[p?o.jsx("span",{className:"material-symbols-outlined af-work-file__chevron",children:f?"chevron_right":"expand_more"}):null,o.jsx("span",{className:"material-symbols-outlined",children:u.icon||ll(u.name,p)}),o.jsx("span",{children:u.name})]}),d?o.jsxs("div",{className:"af-work-file-actions",children:[p?null:o.jsx("button",{type:"button",className:"af-work-file-action",onClick:y=>{y.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:y=>{y.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]}),p&&!f&&((h=u.children)!=null&&h.length)?o.jsx(ZP,{items:u.children,onOpen:t,selectedPath:n,collapsedDirs:r,onToggleDir:s,onSelect:i,onFileDragStart:a,onDelete:l,onDownload:c}):null]},u.path)})})}function M7({files:e,query:t,onQueryChange:n,onSelect:r,onUpload:s,onClose:i}){const a=m.useMemo(()=>wb(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||ll(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:R7(u.size)}):null]},u.path)),c.length===0?o.jsx("div",{className:"af-work-file-picker-modal__empty",children:"没有匹配文件,可先上传或调整搜索词。"}):null]})]})]})})}function ej({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 eI(e){const t=String((e==null?void 0:e.kind)||"");return["run-log","run-summary","activity","prompt","raw","thinking"].includes(t)}function $7(e,t=!1){const n=Array.isArray(e)?e:[],r=n.filter(i=>!eI(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 L7(e){return(Array.isArray(e)?e:[]).filter(eI)}function zu(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 O7(e){const t=zu((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 zu((r==null?void 0:r.default)||(r==null?void 0:r.value)||"")}function D7(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 zu((n==null?void 0:n.default)||(n==null?void 0:n.value)||"")}function tj(e){return JSON.stringify(Array.from(new Set((e||[]).map(String).filter(Boolean))))}function So(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 F7(e,t){const n=So(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 od(e){const t=String(e||"").trim().toLowerCase();return["markdown","html","react","table","chart","ascii","mermaid"].includes(t)?t:"markdown"}function ls(e){const t=String(e||""),n=t.indexOf(" - ");return n>=0?t.slice(0,n).trim():t.trim()}function tI(e){const t=od(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 nI(e){return`${String(e||"context_run").trim()||"context_run"}__display`}function rI(e){return e==="display_image"?"src":"content"}function nj(e,t,n){const r=rI(t),s=Hc(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 rj(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 sj(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 Dh(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 z7(e){const t=Array.isArray(e==null?void 0:e.inputs)?e.inputs:[],n=So(t,"includeWorkspaceContext","true").toLowerCase();return{task:String((e==null?void 0:e.body)||""),skillKeys:D7(e),includeWorkspaceContext:n!=="false"&&n!=="0"&&n!=="off",workspaceContext:F7(t,"workspaceContext"),displayType:od(So(t,"displayType","markdown")),model:String((e==null?void 0:e.model)||"").trim()}}function Ds(e){const t=String(e||"");return t==="workspace_one_click_task"||t==="workspace_context_run"}function H7(e){const t=zu((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 zu((r==null?void 0:r.default)||(r==null?void 0:r.value)||"")}function B7(e){return JSON.stringify(Array.from(new Set((e||[]).map(String).filter(Boolean))))}function W7(e){const t=Array.isArray(e==null?void 0:e.inputs)?e.inputs:[];return{path:So(t,"path",""),label:So(t,"label","")}}function ij(e){var r,s,i,a,l,c,u,p,f;if(!e)return null;const{inputs:t,outputs:n}=TV(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:Di((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(((p=e.data)==null?void 0:p.implementationRef)??""),implementationMode:String(((f=e.data)==null?void 0:f.implementationMode)??""),inputs:t,outputs:n}}function oj(e,t,n,r=""){var c,u;const s=String(n||"").trim(),i=(Array.isArray(e)?e:[]).find(p=>String((p==null?void 0:p.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 aj(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 V7(e,t,n){var p,f;const r=String(((p=e==null?void 0:e.data)==null?void 0:p.definitionId)??n),s=r.startsWith("provide_"),i=String((t==null?void 0:t.role)||"").trim(),a=Lu.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?[]:Di(t==null?void 0:t.images),inputs:aj(t==null?void 0:t.inputs),outputs:s&&Array.isArray((f=e.data)==null?void 0:f.outputs)?e.data.outputs:aj(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 d of["scriptRef","implementationRef","implementationMode"]){const h=String((t==null?void 0:t[d])??"").trim();h?c[d]=h:delete c[d]}return c}function lj({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(!tK.test(c))return{ok:!1,error:"Invalid instance id"};if(e.some(b=>b.id===c&&b.id!==a))return{ok:!1,error:"Duplicate instance id"}}const u=V7(r,s,c),p=r.data||{};if(!(c!==a||p.label!==u.label||p.role!==u.role||p.model!==u.model||p.body!==u.body||JSON.stringify(Di(p.images))!==JSON.stringify(u.images)||(p.script??void 0)!==(u.script??void 0)||(p.scriptRef??void 0)!==(u.scriptRef??void 0)||(p.implementationRef??void 0)!==(u.implementationRef??void 0)||(p.implementationMode??void 0)!==(u.implementationMode??void 0)||JSON.stringify(p.inputs||[])!==JSON.stringify(u.inputs||[])||JSON.stringify(p.outputs||[])!==JSON.stringify(u.outputs||[])))return{ok:!0,changed:!1,nextId:c,nodes:e,edges:t,instances:n};const d=e.map(b=>b.id===a?{...b,id:c,selected:!0,data:u}:b);let h=t,y=n;if(c!==a){y={...n||{}};const b={...y[a]||{}};delete y[a],y[c]=b,h=t.map((k,g)=>({...k,source:k.source===a?c:k.source,target:k.target===a?c:k.target,id:`we-${k.source===a?c:k.source}-${k.target===a?c:k.target}-${g}`}))}return{ok:!0,changed:!0,nextId:c,nodes:d,edges:h,instances:y}}function K7(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}function U7(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"])K7(e[s],t[s])&&(r[s]=n[s]);return r}function q7({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:[],p=Array.isArray(i)?i:[],[f,d]=m.useState(!1),[h,y]=m.useState(""),[b,k]=m.useState(()=>new Set),g=m.useRef(null),w=m.useRef(null),[x,N]=m.useState({visible:!1,top:0,height:100}),C=m.useMemo(()=>new Set(O7(t)),[t]),j=m.useMemo(()=>new Map(u.map($=>[$.key,$])),[u]),_=m.useMemo(()=>{const $=new Set,M=p.map(P=>{const B=la(P,u).map(E=>j.get(E)).filter(Boolean);for(const E of B)$.add(E.key);return{...P,skills:B}}).filter(P=>P.skills.length>0),O=u.filter(P=>!$.has(P.key));return{collectionGroups:M,ungrouped:O}},[j,p,u]);m.useEffect(()=>{k($=>{let M=!1;const O=new Set($);for(const P of _.collectionGroups)O.has(P.id)||(O.add(P.id),M=!0);return M?O:$})},[_.collectionGroups]);const A=m.useMemo(()=>{const $=h.trim().toLowerCase();if(!$)return _;const M=P=>[P==null?void 0:P.key,P==null?void 0:P.name,P==null?void 0:P.description].map(E=>String(E||"").toLowerCase()).join(" ").includes($);return{collectionGroups:_.collectionGroups.map(P=>{const E=[P==null?void 0:P.id,P==null?void 0:P.name,P==null?void 0:P.description].map(q=>String(q||"").toLowerCase()).join(" ").includes($)?P.skills:P.skills.filter(M);return{...P,skills:E}}).filter(P=>P.skills.length>0),ungrouped:_.ungrouped.filter(M)}},[_,h]),F=m.useCallback(($,M)=>{const O=new Set(C);for(const P of $)M?O.add(P):O.delete(P);a==null||a(e,Array.from(O))},[e,C,a]),V=m.useCallback($=>{k(M=>{const O=new Set(M);return O.has($)?O.delete($):O.add($),O})},[]),z=m.useCallback(()=>{const $=g.current;if(!$)return;const M=Math.max(1,$.scrollHeight),O=Math.max(1,$.clientHeight),P=M>O+1,B=P?Math.max(12,O/M*100):100,E=Math.max(0,100-B),q=P?Math.min(E,$.scrollTop/Math.max(1,M-O)*E):0;N({visible:P,top:q,height:B})},[]);m.useEffect(()=>{if(!f)return;const $=requestAnimationFrame(z);return()=>cancelAnimationFrame($)},[b,A,C.size,f,z]);const D=m.useCallback($=>{const M=g.current;if(!M)return;const O=Math.max(0,M.scrollHeight-M.clientHeight);M.scrollTop=Math.min(1,Math.max(0,$))*O,z()},[z]),R=m.useCallback(($,M=0)=>{const O=w.current;if(!O)return 0;const P=O.getBoundingClientRect(),B=x.height/100*P.height,E=Math.max(1,P.height-B);return($-P.top-M)/E},[x.height]),T=m.useCallback($=>{var se,ae;if(!x.visible)return;$.preventDefault(),$.stopPropagation();const M=w.current;if(!M)return;const O=M.getBoundingClientRect(),P=x.top/100*O.height,B=x.height/100*O.height,q=$.clientY>=O.top+P&&$.clientY<=O.top+P+B?$.clientY-O.top-P:B/2;D(R($.clientY,q));const W=$.pointerId;(ae=(se=$.currentTarget).setPointerCapture)==null||ae.call(se,W);const L=me=>{me.preventDefault(),D(R(me.clientY,q))},X=()=>{window.removeEventListener("pointermove",L),window.removeEventListener("pointerup",X),window.removeEventListener("pointercancel",X)};window.addEventListener("pointermove",L),window.addEventListener("pointerup",X),window.addEventListener("pointercancel",X)},[R,D,x.height,x.top,x.visible]);return o.jsxs("div",{className:"af-work-load-skills-card"+(n?" af-work-load-skills-card--selected":""),onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,children:[l.map(($,M)=>{if($.showOnNode===!1)return null;const O=`${2.6+M*1.7}rem`,P=$.name||`#${M+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:O},children:P}),o.jsx(Mn,{type:"target",position:Le.Left,id:`input-${M}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:O,background:yn($.type)},title:`${P} · ${$.type}`})]},`in-${M}`)}),c.map(($,M)=>{if($.showOnNode===!1)return null;const O=`${2.6+M*1.7}rem`,P=$.name||`#${M+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:O},children:P}),o.jsx(Mn,{type:"source",position:Le.Right,id:`output-${M}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:O,background:yn($.type)},title:`${P} · ${$.type}`})]},`out-${M}`)}),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 M;$.stopPropagation(),f||(M=t==null?void 0:t.onRefreshSkills)==null||M.call(t),d(O=>!O)},children:[o.jsx("span",{children:C.size>0?`${C.size} skills selected`:"选择 Skills"}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:f?"expand_less":"expand_more"})]}),f?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:$=>y($.target.value),placeholder:"搜索 Skills...",spellCheck:!1,autoComplete:"off","aria-label":"搜索 Skills"}),h?o.jsx("button",{type:"button",onClick:()=>y(""),"aria-label":"清空搜索",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),o.jsxs("div",{ref:g,className:"af-work-load-skills-menu",onScroll:z,children:[A.collectionGroups.map($=>{const M=$.skills.map(E=>E.key),O=M.filter(E=>C.has(E)).length,P=M.length>0&&O===M.length,B=b.has($.id);return o.jsxs("section",{className:"af-work-load-skills-menu__group"+(B?" 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:P,onChange:E=>F(M,E.target.checked),"aria-label":`选择 ${$.name}`}),o.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-toggle",onClick:()=>V($.id),"aria-expanded":!B,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:[O,"/",M.length]}),o.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-arrow",onClick:()=>V($.id),"aria-label":B?`展开 ${$.name}`:`收起 ${$.name}`,children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:B?"chevron_right":"expand_more"})})]}),B?null:o.jsx("div",{className:"af-work-load-skills-menu__options",children:$.skills.map(E=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:C.has(E.key),onChange:q=>F([E.key],q.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:E.name}),E.description?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:E.description}):null]})]},`${$.id}:${E.key}`))})]},$.id)}),A.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:A.ungrouped.length})]}),o.jsx("div",{className:"af-work-load-skills-menu__options",children:A.ungrouped.map($=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:C.has($.key),onChange:M=>F([$.key],M.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,A.collectionGroups.length===0&&A.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:w,className:"af-work-load-skills-scrollbar"+(x.visible?" af-work-load-skills-scrollbar--visible":""),onPointerDown:T,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${x.height}%`,top:`${x.top}%`}})})]}):null]})]})}function Y7({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),[p,f]=m.useState(""),d=m.useMemo(()=>new Set(H7(t)),[t]),h=m.useMemo(()=>(Array.isArray(s)?s:[]).map(k=>({name:String((k==null?void 0:k.name)||""),description:String((k==null?void 0:k.description)||""),detail:String((k==null?void 0:k.url)||[k==null?void 0:k.command,...Array.isArray(k==null?void 0:k.args)?k.args:[]].filter(Boolean).join(" ")||""),type:String((k==null?void 0:k.type)||"")})).filter(k=>k.name),[s]),y=m.useMemo(()=>{const k=p.trim().toLowerCase();return k?h.filter(g=>[g.name,g.description,g.detail,g.type].join(" ").toLowerCase().includes(k)):h},[p,h]),b=m.useCallback((k,g)=>{const w=new Set(d);for(const x of k)g?w.add(x):w.delete(x);i==null||i(e,Array.from(w))},[e,d,i]);return o.jsxs("div",{className:"af-work-load-skills-card"+(n?" af-work-load-skills-card--selected":""),onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,children:[a.map((k,g)=>{if(k.showOnNode===!1)return null;const w=`${2.6+g*1.7}rem`,x=k.name||`#${g+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:w},children:x}),o.jsx(Mn,{type:"target",position:Le.Left,id:`input-${g}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:w,background:yn(k.type)},title:`${x} · ${k.type}`})]},`in-${g}`)}),l.map((k,g)=>{if(k.showOnNode===!1)return null;const w=`${2.6+g*1.7}rem`,x=k.name||`#${g+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:w},children:x}),o.jsx(Mn,{type:"source",position:Le.Right,id:`output-${g}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:w,background:yn(k.type)},title:`${x} · ${k.type}`})]},`out-${g}`)}),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:k=>{var g;k.stopPropagation(),c||(g=t==null?void 0:t.onRefreshMcps)==null||g.call(t),u(w=>!w)},children:[o.jsx("span",{children:d.size>0?`${d.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:k=>k.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:p,onChange:k=>f(k.target.value),placeholder:"搜索 MCP...",spellCheck:!1,autoComplete:"off","aria-label":"搜索 MCP"}),p?o.jsx("button",{type:"button",onClick:()=>f(""),"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:y.length})]}),o.jsx("div",{className:"af-work-load-skills-menu__options",children:y.map(k=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:d.has(k.name),onChange:g=>b([k.name],g.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:k.name}),k.description||k.detail?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:k.description||k.detail}):null]})]},k.name))})]}),y.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 G7({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,p]=m.useState(!1),[f,d]=m.useState(""),h=W7(t),y=m.useMemo(()=>(Array.isArray(s)?s:[]).map(w=>({id:String((w==null?void 0:w.id)||""),label:String((w==null?void 0:w.label)||(w==null?void 0:w.name)||"Workspace"),kind:(w==null?void 0:w.kind)==="git"?"git":"local",path:String((w==null?void 0:w.path)||""),repoUrl:String((w==null?void 0:w.repoUrl)||""),branch:String((w==null?void 0:w.branch)||""),mountPath:String((w==null?void 0:w.mountPath)||""),builtin:(w==null?void 0:w.builtin)===!0,exists:(w==null?void 0:w.exists)!==!1})).filter(w=>w.path),[s]),b=m.useMemo(()=>{const w=f.trim().toLowerCase();return w?y.filter(x=>[x.id,x.label,x.path,x.repoUrl,x.branch,x.mountPath].join(" ").toLowerCase().includes(w)):y},[f,y]),k=y.find(w=>w.path===h.path)||null,g=(k==null?void 0:k.label)||h.label||"选择 Workspace";return o.jsxs("div",{className:"af-work-load-skills-card af-work-load-workspace-card"+(n?" af-work-load-skills-card--selected":""),onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,children:[l.map((w,x)=>{if(w.showOnNode===!1)return null;const N=`${2.6+x*1.7}rem`,C=w.name||`#${x+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:N},children:C}),o.jsx(Mn,{type:"target",position:Le.Left,id:`input-${x}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:N,background:yn(w.type)},title:`${C} · ${w.type}`})]},`in-${x}`)}),c.map((w,x)=>{if(w.showOnNode===!1)return null;const N=`${2.6+x*1.7}rem`,C=w.name||`#${x+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:N},children:C}),o.jsx(Mn,{type:"source",position:Le.Right,id:`output-${x}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:N,background:yn(w.type)},title:`${C} · ${w.type}`})]},`out-${x}`)}),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)||"Load Workspace"}),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:w=>{w.stopPropagation(),u||a==null||a(),p(x=>!x)},children:[o.jsx("span",{children:g}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:u?"expand_less":"expand_more"})]}),h.path?o.jsx("div",{className:"af-work-load-workspace-card__path",children:h.path}):null,u?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:"搜索 Workspace...",spellCheck:!1,autoComplete:"off","aria-label":"搜索 Workspace"}),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:"Workspace"}),o.jsx("small",{children:b.length})]}),o.jsx("div",{className:"af-work-load-skills-menu__options",children:b.map(w=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"radio",name:`workspace-${e}`,checked:w.path===h.path,onChange:()=>{i==null||i(e,w),p(!1)}}),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.label}),o.jsxs("span",{className:"af-work-load-skills-menu__option-desc",children:[w.kind==="git"&&w.repoUrl?`${w.repoUrl}${w.branch?` · ${w.branch}`:""}${w.mountPath?` · ${w.mountPath}`:""}`:w.path,w.exists?"":" · 路径未就绪"]})]})]},`${w.id}:${w.path}`))})]}),b.length===0?o.jsx("div",{className:"af-work-load-skills-menu__empty",children:"没有匹配的 Workspace"}):null]})]}):null]})]})}function J7(){var qk,Yk;const{t:e,i18n:t}=Cr(),{navigate:n}=ui(),r=Vl(),s=t5(),i=m.useMemo(bK,[]),[a,l]=m.useState(()=>new URLSearchParams(window.location.search).get("view")==="display"?"display":"workspace"),[c,u]=m.useState(!1),[p,f]=m.useState(!1),[d,h]=n5([]),[y,b,k]=r5([]),g=m.useRef([]),w=m.useRef([]),x=m.useRef(null),[N,C]=m.useState(()=>kx(null,[])),j=m.useRef(N),[_,A]=m.useState(null),F=m.useRef(null),[V,z]=m.useState([]),D=m.useRef(new Map),R=m.useRef(new Map),T=m.useRef(null),$=m.useRef(null),M=m.useRef(null),[O,P]=m.useState(null),[B,E]=m.useState({}),q=m.useRef({}),W=m.useRef(!1),L=m.useRef(null),[X,se]=m.useState([]),[ae,me]=m.useState(""),[re,de]=m.useState("nodes"),[ne,ue]=m.useState([]),[fe,ve]=m.useState(!1),[$e,We]=m.useState(""),[Pe,Ue]=m.useState(!1),[pt,Te]=m.useState({name:"",id:"",description:""}),[et,Yt]=m.useState(!1),[jt,$t]=m.useState(""),[Ht,Xe]=m.useState(""),oe=m.useRef(null),[ke,Se]=m.useState(!1),[qe,Ze]=m.useState(!1),[kt,Z]=m.useState(""),[xe,He]=m.useState(null),[Ce,nt]=m.useState(()=>vg()),[ht,un]=m.useState(""),[_r,Wn]=m.useState(!1),[Vn,Kn]=m.useState(""),[hn,Un]=m.useState(!1),[Pn,hr]=m.useState([]),[In,Ln]=m.useState(!1),[ir,Zn]=m.useState(""),[Er,On]=m.useState(""),[Hr,mr]=m.useState(""),[Br,bn]=m.useState(!1),[nn,er]=m.useState(""),[qn,gr]=m.useState(""),[Bt,te]=m.useState(!1),[be,st]=m.useState("nodes"),[wt,rn]=m.useState(""),[Cn,kn]=m.useState(0),[Dn,Ve]=m.useState(""),Lt=m.useRef(""),[Ie,Wt]=m.useState(null),Ye=m.useRef(null),[or,Wr]=m.useState(""),[Vr,is]=m.useState([]),[ee,Ne]=m.useState(""),[ie,Dt]=m.useState(!0),[Gt,vn]=m.useState(""),[xs,Sn]=m.useState(()=>new Set),[Ar,os]=m.useState(""),[K,pe]=m.useState({nodeId:"",query:""}),[Re,Ee]=m.useState(!1),Je=m.useRef(null),Jt=m.useRef(null),Ct=m.useRef(""),[Fn,ws]=m.useState(()=>{try{const v=Number(window.localStorage.getItem("agentflow.workspace.filesPaneHeight")||0);if(Number.isFinite(v)&&v>=160)return v}catch{}return 360}),[Io,zi]=m.useState(!1),[To,YI]=m.useState({cursor:[],opencode:[],claudeCode:[],codex:[]}),[pi,GI]=m.useState(""),[bs,JI]=m.useState([]),[Mb,$b]=m.useState(!1),[ks,Zl]=m.useState([]),[va,XI]=m.useState([]),[Lb,QI]=m.useState(!1),[Ob,Db]=m.useState([]),[Fb,zb]=m.useState([]),Hb=m.useCallback(v=>{oe.current&&window.clearTimeout(oe.current),Xe(v),oe.current=window.setTimeout(()=>{Xe(""),oe.current=null},3800)},[]),Hi=m.useCallback(v=>{const S=String(v||"").trim();if(!S)return;const I=()=>s(S);window.requestAnimationFrame(I),window.setTimeout(I,80)},[s]),Bb=m.useCallback((v,S)=>{const I=String(v||"").trim(),H=Up(S);!I||!H||(h(U=>U.map(Y=>{var ce;if(Y.id!==I)return Y;const G=Up((ce=Y.data)==null?void 0:ce.displaySize),J=G&&G.width===H.width&&G.height===H.height,Q=Math.round(Number(Y.width||0))===H.width&&Math.round(Number(Y.height||0))===H.height;return J&&Q?Y:{...Y,width:H.width,height:H.height,data:{...Y.data,nodeSize:H,displaySize:H}}})),Hi(I))},[Hi,h]);m.useEffect(()=>{try{window.localStorage.setItem("agentflow.workspace.filesPaneHeight",String(Math.round(Fn)))}catch{}},[Fn]);const Kh=m.useCallback(v=>{const S=Je.current;if(!S)return;const I=S.getBoundingClientRect(),H=16,U=150,Y=230,G=I.top+H,J=I.bottom-H,Q=Math.max(U,J-G-Y),ce=Math.min(Math.max(v-G,U),Q);ws(ce)},[]),ZI=m.useCallback(v=>{v.preventDefault(),v.stopPropagation(),zi(!0),Kh(v.clientY);const S=H=>{H.preventDefault(),Kh(H.clientY)},I=()=>{zi(!1),window.removeEventListener("pointermove",S,!0),window.removeEventListener("pointerup",I,!0),window.removeEventListener("pointercancel",I,!0)};window.addEventListener("pointermove",S,!0),window.addEventListener("pointerup",I,!0),window.addEventListener("pointercancel",I,!0)},[Kh]);m.useEffect(()=>()=>{oe.current&&window.clearTimeout(oe.current)},[]);const[eT,Wb]=m.useState(()=>new Set),[fd,Uh]=m.useState(!1),qh=m.useRef(null),Vb=m.useRef(null),Kb=m.useRef(null),[tT,nT]=m.useState({}),[Ro,Yh]=m.useState(""),[Kr,Ub]=m.useState(!1),[pd,hd]=m.useState([]),[md,yr]=m.useState([]),[ec,Sa]=m.useState("workspace"),[Gh,Na]=m.useState(!1),[tc,ja]=m.useState(null),[rT,Jh]=m.useState(!0),[qb,Yb]=m.useState(""),[Ca,_a]=m.useState({}),[xr,Gb]=m.useState(null),[Jb,Xb]=m.useState(!1),Ea=m.useMemo(()=>Jb?vK(xr):"",[Jb,xr]),[nc,gd]=m.useState(!0);m.useEffect(()=>{Ea&&gd(SK(Ea))},[Ea]),m.useEffect(()=>{if(Ea)try{window.localStorage.setItem(Ea,nc?"true":"false")}catch{}},[nc,Ea]);const[Xh,yd]=m.useState(!1),[Qh,Qb]=m.useState(!1),[Zh,Zb]=m.useState("pan"),[ek,sT]=m.useState({}),rc=m.useRef({}),[tk,Mo]=m.useState({}),sc=m.useRef(new Map),Aa=m.useRef(new Set),[nk,Pa]=m.useState(()=>new Set),[em,Ia]=m.useState({}),[rk,sk]=m.useState(""),[iT,we]=m.useState(""),hi=m.useMemo(()=>kK(i),[i]),[ik,ok]=m.useState(""),xd=i.flowSource||"user",ak=m.useMemo(()=>new Set(Object.values(ek||{}).map(v=>String((v==null?void 0:v.runNodeId)||"").trim()).filter(Boolean)),[ek]),$o=m.useCallback(v=>{const S=rc.current||{},I=typeof v=="function"?v(S):v,H=I&&typeof I=="object"&&!Array.isArray(I)?I:{};return rc.current=H,sT(H),H},[]),lk=!!(i.flowId&&!i.archived&&(xd==="user"||xd==="workspace"));m.useEffect(()=>{i.flowId&&F$(i.flowId,i.flowSource||"user","workspace",!!i.archived)},[i]),m.useEffect(()=>{const v=()=>{l(new URLSearchParams(window.location.search).get("view")==="display"?"display":"workspace")};return window.addEventListener("popstate",v),()=>window.removeEventListener("popstate",v)},[]),m.useEffect(()=>{hd([]),yr([]),Sa("workspace"),Jh(!0)},[i]);const _n=m.useCallback(async()=>{const v=_s(i),S=await fetch(`/api/workspace/files?${v.toString()}`),I=await S.json();if(!S.ok)throw new Error(I.error||"读取 workspace 失败");const H=I.files||[];is(H),Sn(new Set(XP(H))),Ne(I.root||"")},[i]),wd=m.useCallback(async()=>{ve(!0),We("");try{const v=await fetch("/api/marketplace/flow-snippets"),S=await v.json().catch(()=>({}));if(!v.ok)throw new Error(S.error||"读取流程片段失败");ue(Array.isArray(S.snippets)?S.snippets:[])}catch(v){We(String(v.message||v)),ue([])}finally{ve(!1)}},[]),Ft=m.useCallback(async(v=d,S=y)=>{var Y;if(!W.current)return;if(!ie)throw we("Readonly workspace"),new Error("Readonly workspace");const I=_c(v,S,q.current);I.ui={...I.ui||{},...F.current?{viewport:F.current}:{},displayPage:GK(j.current,v)};const H=await fetch("/api/workspace/graph",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,graph:I})}),U=await H.json();if(!H.ok)throw new Error(U.error||"保存 workspace graph 失败");q.current=((Y=U.graph)==null?void 0:Y.instances)||I.instances,E(q.current),Mo(kf(U.workspaceSchedules||[])),we("Workspace graph saved")},[y,i,d,ie]),oT=m.useCallback(v=>{var I;const S=(I=v==null?void 0:v.extra)!=null&&I.instances&&typeof v.extra.instances=="object"?v.extra.instances:{};q.current=S,E(S),h(Array.isArray(v==null?void 0:v.nodes)?v.nodes:[]),b(Array.isArray(v==null?void 0:v.edges)?v.edges:[]),Ve(""),P(null)},[b,h]),aT=m.useMemo(()=>({instances:B}),[B]),lT=lK({nodes:d,edges:y,extra:aT,enabled:W.current,onRestore:oT}),{resetHistory:bd,undo:ck,redo:uk}=lT,Ta=m.useCallback(async()=>{var Me,ut;W.current=!1;const v=_s(i),S=_s(i);S.set("lang",String(t.language||"zh").startsWith("zh")?"zh":"en");const[I,H]=await Promise.all([fetch(`/api/nodes?${S.toString()}`),fetch(`/api/workspace/graph?${v.toString()}`),_n()]),U=await I.json(),Y=await H.json();if(!I.ok)throw new Error(U.error||"读取节点定义失败");if(!H.ok)throw new Error(Y.error||"读取 workspace graph 失败");const G=[...(Array.isArray(U)?U:U.nodes||[]).filter(Pt=>!uK.has(Pt.id)),gK,mK,pK,hK,dK,fK];se(G);const J=Y.graph||JSON.parse(localStorage.getItem(cK)||"null")||{},Q=vf(J,G),ce=kx((Me=J==null?void 0:J.ui)==null?void 0:Me.displayPage,Q.nodes),le=zP((ut=J==null?void 0:J.ui)==null?void 0:ut.viewport);q.current=Q.instances,E(Q.instances),h(Q.nodes),b(Q.edges),Mo(kf(Y.workspaceSchedules||[])),C(ce),j.current=ce,A(le),F.current=le,z([]),bd(Q.nodes,Q.edges,{instances:Q.instances});const ge=Y.writable!==!1;Dt(ge),we(ge?"Workspace ready":"Readonly workspace"),W.current=!0},[i,t.language,_n,bd,b,h]),cT=m.useCallback(async(v,S)=>{const I={packageId:(v==null?void 0:v.newId)||(v==null?void 0:v.id)||(v==null?void 0:v.label),label:(v==null?void 0:v.label)||(v==null?void 0:v.newId)||(v==null?void 0:v.id),version:"1.0.0",definitionId:S,body:(v==null?void 0:v.body)||"",script:(v==null?void 0:v.script)||"",scriptRef:(v==null?void 0:v.scriptRef)||"",implementationRef:(v==null?void 0:v.implementationRef)||"",implementationMode:(v==null?void 0:v.implementationMode)||"",inputs:Array.isArray(v==null?void 0:v.inputs)?v.inputs:[],outputs:Array.isArray(v==null?void 0:v.outputs)?v.outputs:[],flowId:i.flowId,flowSource:i.flowSource||"user",archived:!!i.archived},H=await fetch("/api/marketplace/publish-node-from-instance",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(I)}),U=await H.json().catch(()=>({}));if(!H.ok||(U==null?void 0:U.ok)===!1)throw new Error((U==null?void 0:U.error)||"Publish failed");return await Ta(),we(`Published node ${U.definitionId||U.id||I.packageId}`),U},[i,Ta]);m.useCallback((v="workspace")=>{Na(!0),ja(null),Wt(null),Sa(v||"workspace")},[]);const dk=m.useCallback((v={})=>{ja({scheduleNodeId:String(v.scheduleNodeId||""),runNodeId:String(v.runNodeId||v.nodeId||""),lastRunId:String(v.lastRunId||""),label:String(v.label||"")}),Na(!1),Wt(null),Ve("")},[]),tm=m.useCallback(async(v="")=>{const S=String(v||"").trim();if(!(!S||!ie)){sk(S),we(`Optimizing run: ${S}`);try{await Ft(g.current,w.current);const I=_c(g.current,w.current,q.current),H=oj(g.current,q.current,S,pi),U=await fetch("/api/workspace/run/optimize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,runNodeId:S,graph:I,model:H})}),Y=await U.json().catch(()=>({}));if(!U.ok||Y.ok===!1)throw new Error(Y.error||"优化失败");const G=Y.graph||I,J=vf(G,X);q.current=J.instances,E(J.instances),h(J.nodes),b(J.edges),Mo(kf(Y.workspaceSchedules||[])),bd(J.nodes,J.edges,{instances:J.instances});const Q=Array.isArray(Y.optimized)?Y.optimized.length:0;we(Q>0?`已生成 ${Q} 个 implementation`:"没有需要优化的节点")}catch(I){we(String(I.message||I))}finally{sk("")}}},[pi,w,i,g,X,bd,Ft,b,h,ie]),fk=m.useCallback(async(v="")=>{const S=String(v||"").trim(),I=rc.current||{},H=Object.entries(I).find(([ce,le])=>ce===S||String((le==null?void 0:le.runNodeId)||"")===S)||Object.entries(I)[0]||null,U=(H==null?void 0:H[0])||"",Y=(H==null?void 0:H[1])||null,G=String((Y==null?void 0:Y.runNodeId)||S||"").trim(),J=new Set([G,...Array.isArray(Y==null?void 0:Y.plannedNodeIds)?Y.plannedNodeIds:[]].map(ce=>String(ce||"").trim()).filter(Boolean));U&&Aa.current.add(U);const Q=U?sc.current.get(U):null;Q&&(Q.abort(),sc.current.delete(U)),U&&$o(ce=>{const le={...ce};return delete le[U],le}),Pa(ce=>{const le=new Set(ce);for(const ge of J)le.delete(ge);return le}),Ia(ce=>{var ge;const le={...ce};for(const Me of J)Me&&(!le[Me]||((ge=le[Me])==null?void 0:ge.status)==="running")&&(le[Me]={status:"stopped"});return le}),we(G?`Workspace run stopped: ${G}`:"Workspace run stopped"),yr(ce=>ce.map(le=>(U?le.id===U:!G||le.runNodeId===G)&&le.status==="running"?{...le,status:"stopped",endedAt:Date.now(),messages:[...Array.isArray(le.messages)?le.messages:[],{role:"assistant",kind:"status",text:"Workspace run stopped.",at:Date.now()}].slice(-160)}:le));try{await fetch("/api/workspace/run/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,runId:U,runNodeId:G})})}catch{}},[i,$o]),pk=m.useCallback(async()=>{if(i.flowId)try{const v=_s(i),S=await fetch(`/api/workspace/run/status?${v.toString()}`),I=await S.json().catch(()=>({}));if(!S.ok||!I.running)return;const H=Array.isArray(I.runs)&&I.runs.length?I.runs:[{runId:`run-restored-${I.startedAt||Date.now()}`,runNodeId:I.runNodeId||"",startedAt:I.startedAt||Date.now(),plannedNodeIds:[]}],U={},Y=[];for(const G of H){const J=String((G==null?void 0:G.runNodeId)||"").trim(),Q=String((G==null?void 0:G.runId)||`run-restored-${(G==null?void 0:G.startedAt)||Date.now()}-${J}`).trim();if(!Q)continue;const ce=String((G==null?void 0:G.label)||"").trim()||yg(g.current,q.current,J,"Workspace Run");U[Q]={id:Q,runNodeId:J,label:ce,plannedNodeIds:Array.isArray(G==null?void 0:G.plannedNodeIds)?G.plannedNodeIds:[],startedAt:(G==null?void 0:G.startedAt)||Date.now()},J&&Y.push(J)}if(!Object.keys(U).length)return;$o(G=>({...G,...U})),Pa(G=>{const J=new Set(G);for(const Q of Y)J.add(Q);return J}),Ia(G=>{const J={...G};for(const Q of Y)J[Q]={status:"running"};return J}),we(Y.length?`Workspace run still running: ${Y.join(", ")}`:"Workspace run still running"),yr(G=>{const J=[...G];for(const[Q,ce]of Object.entries(U)){if(J.some(Me=>Me.id===Q||Me.status==="running"&&Me.runNodeId===ce.runNodeId))continue;const le=String(ce.runNodeId||""),ge=String(ce.label||"").trim()||yg(g.current,q.current,le,"Workspace Run");J.push({id:Q,label:xg(ge,le,"Workspace Run"),alias:ge,runNodeId:le,status:"running",startedAt:ce.startedAt||Date.now(),steps:le?[{id:le,label:xg(ge,le,"Workspace Run"),status:"running"}]:[],messages:[{role:"assistant",kind:"run-summary",text:"Workspace run is still running in the background.",at:Date.now()}]})}return[...J.slice(-8)]})}catch{}},[i,g,$o]),hk=m.useCallback(async v=>{if(!ie){we("Readonly workspace");return}if(!v)return;if(Object.values(rc.current||{}).find(Qe=>String((Qe==null?void 0:Qe.runNodeId)||"")===String(v||""))){we(`Workspace run already running: ${v}`);return}let I=d,H=y,U=q.current;const Y=Ye.current;if(Y!=null&&Y.id){const Qe=I.find(Ae=>Ae.id===Y.id),Be=lj({nodes:I,edges:H,instances:U,selectedNode:Qe,draft:Y,allowRename:!1});if(Be!=null&&Be.error){Wr(Be.error),we(Be.error);return}Be!=null&&Be.ok&&Be.changed&&(I=Be.nodes,H=Be.edges,U=Be.instances,q.current=U,E(U),h(I),b(H),Hi(Be.nextId||Y.id))}const G=_c(I,H,U),J=`run-${Date.now()}-${String(v).replace(/[^a-z0-9_-]+/gi,"_")}`,Q=yg(I,U,v,"Workspace Run"),ce=xg(Q,v,"Workspace Run");let le=[v];try{const Qe=await fetch("/api/workspace/run/plan",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,graph:G,runNodeId:v})}),Be=await Qe.json().catch(()=>({}));if(!Qe.ok||(Be==null?void 0:Be.ok)===!1)throw new Error(Be.error||"Workspace run plan failed");le=Array.isArray(Be.plannedNodeIds)&&Be.plannedNodeIds.length?Be.plannedNodeIds.map(It=>String(It||"").trim()).filter(Boolean):[v],le=Array.from(new Set([v,...le].filter(Boolean)));const Ae=Be.conflict||null;if(Ae!=null&&Ae.runNodeId||Ae!=null&&Ae.runId){const It=Array.isArray(Ae.conflictNodeIds)&&Ae.conflictNodeIds.length?`: ${Ae.conflictNodeIds.join(", ")}`:"";we(`Run ${v} conflicts with running ${Ae.runNodeId||Ae.runId}${It}`);return}}catch(Qe){we(String(Qe.message||Qe));return}const ge=new Set(le),Me=Object.values(rc.current||{}).find(Qe=>(Array.isArray(Qe==null?void 0:Qe.plannedNodeIds)?Qe.plannedNodeIds:[]).some(Be=>ge.has(String(Be||"").trim())));if(Me){const Qe=(Array.isArray(Me.plannedNodeIds)?Me.plannedNodeIds:[]).map(Be=>String(Be||"").trim()).filter(Be=>Be&&ge.has(Be));we(`Run ${v} conflicts with running ${Me.runNodeId||"workspace run"}${Qe.length?`: ${Qe.join(", ")}`:""}`);return}const ut=new AbortController;sc.current.set(J,ut),Aa.current.delete(J),$o(Qe=>({...Qe,[J]:{id:J,runNodeId:v,label:Q,plannedNodeIds:le,startedAt:Date.now()}})),Pa(Qe=>new Set([...Qe,v])),Ia(Qe=>({...Qe,[v]:{status:"running"}})),we(`Running ${ce}...`),Sa(J),yr(Qe=>[...Qe.slice(-7),{id:J,label:ce,alias:Q,runNodeId:v,status:"running",startedAt:Date.now(),steps:[],messages:[{role:"assistant",kind:"run-summary",text:"准备运行...",at:Date.now()}]}]);let Pt=v;const dt=new Map,ze=()=>Aa.current.has(J),vt=Qe=>{const Be=new Set((Qe||[]).map(Ae=>String(Ae||"").trim()).filter(Boolean));Be.size||Be.add(String(v||"")),Pa(Ae=>{const It=new Set(Ae);for(const Ge of Be)It.delete(Ge);return It})},qt=(Qe,Be)=>{const Ae=new Set((Qe||[]).map(It=>String(It||"").trim()).filter(Boolean));Ae.size||Ae.add(String(v||"")),Ia(It=>{var ct;const Ge={...It};for(const Rt of Ae)Rt&&(!Ge[Rt]||((ct=Ge[Rt])==null?void 0:ct.status)==="running")&&(Ge[Rt]={status:Be});return Ge})};try{await Ft(I,H);const Qe=oj(I,U,v,pi),Be=await fetch("/api/workspace/run",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/x-ndjson"},signal:ut.signal,body:JSON.stringify({...i,graph:G,runNodeId:v,runAlias:Q,runSessionId:J,model:Qe,selectedSkills:ks,stream:!0})});if(!Be.ok){const he=await Be.json().catch(()=>({}));throw new Error(he.error||"Workspace run failed")}if(!Be.body)throw new Error("Workspace run stream unavailable");const Ae=Be.body.getReader(),It=new TextDecoder;let Ge="",ct=[],Rt=[];const um=(he,Ke)=>{var tt,xt;const Oe=d.find(_t=>_t.id===he),it=String(((tt=Oe==null?void 0:Oe.data)==null?void 0:tt.label)||he||"").trim(),ye=String(Ke||((xt=Oe==null?void 0:Oe.data)==null?void 0:xt.definitionId)||"").trim();return ye&&ye!==it?`${it} (${ye})`:it},fc=(he,Ke,Oe)=>{const it=String(he||"").trim();it&&yr(ye=>ye.map(tt=>{if(tt.id!==J)return tt;const _t=[...Array.isArray(tt.steps)?tt.steps:[]],ot=_t.findIndex(Qt=>Qt.id===it),mt={id:it,label:um(it,Ke),status:Oe};ot>=0?_t[ot]={..._t[ot],...mt}:_t.push(mt);const Xt=_t.map((Qt,Vi)=>{const yi=Qt.status==="done"?"[done]":Qt.status==="failed"?"[failed]":"[running]";return`${Vi+1}. ${yi} ${Qt.label}`}).join(`
|
|
243
|
-
`),Mt=Array.isArray(tt.messages)?tt.messages:[],Vt=Mt.findIndex(Qt=>Qt.kind==="run-summary"),sn={role:"assistant",kind:"run-summary",text:Xt||"准备运行...",at:Date.now()},Et=[...Mt];return Vt>=0?Et[Vt]=sn:Et.unshift(sn),{...tt,steps:_t,messages:Et.slice(-160)}}))},dm=(he,Ke)=>{var ev,tv,nv,rv,sv,iv,ov,av,lv,cv;const Oe=String(he||"").trim(),it=String(Ke||"").trim();if(!Oe||!it)return;const ye=(ev=q.current)==null?void 0:ev[Oe];if(!Ds(ye==null?void 0:ye.definitionId))return;const tt=So(ye==null?void 0:ye.input,"displayType","markdown"),xt=tI(tt),_t=nI(Oe),ot=X.find(br=>br.id===xt),mt=nj(ot==null?void 0:ot.inputs,xt,it),Xt=nj(ot==null?void 0:ot.outputs,xt,it),Mt=String((ye==null?void 0:ye.label)||Oe||"一键任务").trim(),Vt={...q.current||{},[Oe]:{...ye||{},output:sj(ye==null?void 0:ye.output)},[_t]:{...((tv=q.current)==null?void 0:tv[_t])||{},definitionId:xt,label:Mt,role:"normal",body:it,input:mt,output:Xt,sourceContextRunNodeId:Oe,displayReloadKey:String(Date.now())}};q.current=Vt,E(Vt);const sn=g.current||[],Et=sn.find(br=>br.id===Oe),Qt=sn.find(br=>br.id===_t),Vi=Number(((nv=Et==null?void 0:Et.measured)==null?void 0:nv.width)||(Et==null?void 0:Et.width)||((sv=(rv=Et==null?void 0:Et.data)==null?void 0:rv.nodeSize)==null?void 0:sv.width)||520),yi=(Qt==null?void 0:Qt.position)||{x:Number(((iv=Et==null?void 0:Et.position)==null?void 0:iv.x)||0)+Vi+120,y:Number(((ov=Et==null?void 0:Et.position)==null?void 0:ov.y)||0)},Yn=((av=Qt==null?void 0:Qt.data)==null?void 0:av.displaySize)||((lv=Qt==null?void 0:Qt.data)==null?void 0:lv.nodeSize)||{width:gx,height:yx},Vs=mx({id:_t,type:bl,position:yi,width:Number(Yn.width)||gx,height:Number(Yn.height)||yx,data:{label:Mt,definitionId:xt,role:"normal",body:it,inputs:mt,outputs:Xt,sourceContextRunNodeId:Oe,displayReloadKey:Vt[_t].displayReloadKey,nodeSize:Yn,displaySize:Yn}},Vt,X),Ki=sn.map(br=>{if(br.id===Oe){const{width:yse,height:xse,measured:wse,...oR}=br,{nodeSize:bse,displaySize:kse,...Dd}=br.data||{};return{...oR,data:{...Dd,outputs:sj(Dd==null?void 0:Dd.outputs),contextRunResultNonce:Date.now()}}}return br.id===_t?{...Vs,selected:br.selected}:br});Qt||Ki.push(Vs),g.current=Ki,h(Ki);const Ui=w.current||[],Od=rI(xt),pm=rj((ye==null?void 0:ye.output)||((cv=Et==null?void 0:Et.data)==null?void 0:cv.outputs),"output",["content","result"],["text"]),sR=rj(mt,"input",[Od,"content"],["text"]),iR={id:`we-${Oe}-${_t}`,source:Oe,target:_t,sourceHandle:pm,targetHandle:sR,markerEnd:{type:ei.ArrowClosed}},Zk=[...Ui.filter(br=>!(br.source===Oe&&br.target===_t)),iR];w.current=Zk,b(Zk),window.requestAnimationFrame(()=>{s(Oe),s(_t)})},Rd=(he,Ke=null)=>{const Oe=he!=null&&he.instances&&typeof he.instances=="object"?he.instances:{},it=Ke instanceof Set?Ke:null;for(const[ye,tt]of Object.entries(Oe)){if(it&&!it.has(ye)||!Ds(tt==null?void 0:tt.definitionId))continue;const xt=Dh({outputs:tt.output});xt&&dm(ye,xt)}},Gk=he=>{const Ke=String(he||"").trim();if(!Ke)return;const Oe=Pt;Pt=Ke,Pa(it=>{const ye=new Set(it);return Oe&&Oe!==Ke&&Oe!==v&&ye.delete(Oe),v&&ye.add(v),ye.add(Ke),ye}),Ia(it=>{var ye;return{...it,...Oe&&Oe!==Ke&&Oe!==v&&((ye=it[Oe])==null?void 0:ye.status)==="running"?{[Oe]:{status:"success"}}:{},...v?{[v]:{status:"running"}}:{},[Ke]:{status:"running"}}})},Jk=he=>{const Ke=String(he||"").trim();Ke&&(Pa(Oe=>{const it=new Set(Oe);return it.delete(Ke),it}),Ia(Oe=>({...Oe,[Ke]:{status:"success"}})))},Xk=(he,Ke)=>{const Oe=String(Ke||"");if(!Oe.trim())return;const it=["assistant","thinking","result","error","prompt"].includes(he)?he:"assistant";yr(ye=>ye.map(tt=>{if(tt.id!==J)return tt;let xt=Array.isArray(tt.messages)?tt.messages:[];if(it==="result"){const mt=[...xt].reverse().find(Xt=>Xt.kind==="assistant");if(String((mt==null?void 0:mt.text)||"").trim()===Oe.trim())return tt}if(it==="assistant"){const mt=xt.findIndex(Xt=>Xt.kind==="result"&&String(Xt.text||"").trim()===Oe.trim());mt>=0&&(xt=xt.filter((Xt,Mt)=>Mt!==mt))}const _t=[...xt],ot=_t[_t.length-1];return ot&&ot.kind===it&&!ot.error?_t[_t.length-1]={...ot,text:`${ot.text||""}${ot.text?`
|
|
244
|
-
`:""}${Oe}`}:_t.push({role:"assistant",kind:it,text:Oe,...it==="error"?{error:!0}:{},at:Date.now()}),{...tt,messages:_t.slice(-160)}}))},Md=he=>{const Ke=String(he||"");Ke.trim()&&yr(Oe=>Oe.map(it=>{var _t;if(it.id!==J)return it;const ye=Array.isArray(it.messages)?it.messages:[],tt=ye.findIndex(ot=>ot.kind==="thinking"),xt=[...ye];if(tt>=0){const ot=String(((_t=xt[tt])==null?void 0:_t.text)||"");xt[tt]={...xt[tt],text:`${ot}${ot&&!ot.endsWith(`
|
|
245
|
-
`),""}${Ke}`,at:Date.now()}}else{const ot=xt.findIndex(mt=>mt.kind==="activity");xt.splice(ot>=0?ot+1:xt.length,0,{role:"assistant",kind:"thinking",text:Ke,at:Date.now()})}return{...it,messages:xt.slice(-160)}}))},Wi=(he,Ke=null)=>{const Oe=CK(he);Oe&&yr(it=>it.map(ye=>{if(ye.id!==J)return ye;const tt=Number(Ke==null?void 0:Ke.ts)||Date.now(),xt=Number(ye.startedAt)||tt,_t=Number(ye.lastActivityAt)||xt,ot=Math.max(0,tt-_t),mt=Number.isFinite(Number(Ke==null?void 0:Ke.runElapsedMs))?Math.max(0,Number(Ke.runElapsedMs)):Math.max(0,tt-xt),Xt=Array.isArray(ye.activities)?ye.activities:[],Mt=Xt[Xt.length-1],sn=(typeof Mt=="string"?Mt:String((Mt==null?void 0:Mt.text)||""))===Oe?Xt:[...Xt,{text:Oe,kind:EK(Oe),stepMs:ot,totalMs:mt,at:tt}].slice(-30),Et=Array.isArray(ye.timingEntries)?ye.timingEntries:[],Qt=Array.isArray(ye.messages)?ye.messages:[],Vi=Qt.findIndex(Vs=>Vs.kind==="activity"),yi={role:"assistant",kind:"activity",text:zN(sn,Et,xt,tt),at:Date.now()},Yn=[...Qt];if(Vi>=0)Yn[Vi]=yi;else{const Vs=Yn.findIndex(Ki=>Ki.kind==="run-summary");Yn.splice(Vs>=0?Vs+1:0,0,yi)}return{...ye,activities:sn,lastActivityAt:tt,messages:Yn.slice(-160)}}))},Qk=he=>{const Ke=String((he==null?void 0:he.source)||"runner"),Oe=String((he==null?void 0:he.stream)||""),it=String((he==null?void 0:he.eventType)||"event"),ye=String((he==null?void 0:he.text)||"").trim();if(!ye)return;const tt=`[${Ke}${Oe?`:${Oe}`:""}] ${it}
|
|
246
|
-
${ye}`,xt=RK(he);yr(_t=>_t.map(ot=>{if(ot.id!==J)return ot;const Xt=[...Array.isArray(ot.rawTrace)?ot.rawTrace:[],tt].slice(-80),Mt=Array.isArray(ot.timingEntries)?ot.timingEntries:[],Vt=xt?[...Mt,xt].slice(-80):Mt,sn=Array.isArray(ot.activities)?ot.activities:[],Et=Number(ot.startedAt)||Number(he==null?void 0:he.ts)||Date.now(),Qt=Number(xt==null?void 0:xt.at)||Number(he==null?void 0:he.ts)||Date.now(),Vi=Array.isArray(ot.messages)?ot.messages:[],yi={role:"assistant",kind:"raw",text:Xt.join(`
|
|
247
|
-
|
|
248
|
-
---
|
|
249
|
-
|
|
250
|
-
`),at:Date.now()},Yn=[...Vi],Vs=Yn.findIndex(Ui=>Ui.kind==="activity");if(xt){const Ui={role:"assistant",kind:"activity",text:zN(sn,Vt,Et,Qt),at:Date.now()};if(Vs>=0)Yn[Vs]=Ui;else{const Od=Yn.findIndex(pm=>pm.kind==="run-summary");Yn.splice(Od>=0?Od+1:0,0,Ui)}}const Ki=Yn.findIndex(Ui=>Ui.kind==="raw");return Ki>=0?Yn[Ki]=yi:Yn.push(yi),{...ot,rawTrace:Xt,timingEntries:Vt,messages:Yn.slice(-160)}}))},rR=he=>{yr(Ke=>Ke.map(Oe=>Oe.id===J?{...Oe,status:he,endedAt:Date.now()}:Oe))},$d=he=>{const Ke=new Set,Oe=String((he==null?void 0:he.nodeId)||"").trim();Oe&&Ke.add(Oe);for(const it of Array.isArray(he==null?void 0:he.displayNodeIds)?he.displayNodeIds:[]){const ye=String(it||"").trim();ye&&Ke.add(ye)}for(const it of Array.isArray(he==null?void 0:he.touchedNodeIds)?he.touchedNodeIds:[]){const ye=String(it||"").trim();ye&&Ke.add(ye)}if(Ke.size===0)for(const it of Array.isArray(he==null?void 0:he.order)?he.order:[]){const ye=String(it||"").trim();ye&&Ke.add(ye)}return Ke},Ld=(he,Ke=null)=>{const Oe=vf(he||G,X),it=new Map(Oe.nodes.map(ot=>[ot.id,ot])),ye=Oe.instances||{},tt=Ke instanceof Set?Ke:null,xt=(ot,mt)=>{const Xt={...ot||mt};Array.isArray(mt==null?void 0:mt.output)&&(Xt.output=mt.output);for(const Mt of["scriptRef","implementationRef","implementationMode"])(mt==null?void 0:mt[Mt])!=null&&String(mt[Mt]).trim()!==""&&(Xt[Mt]=mt[Mt]);return Xt},_t=(ot,mt)=>{const Xt={...ot||{}};Array.isArray(mt==null?void 0:mt.outputs)&&(Xt.outputs=mt.outputs);for(const Mt of["scriptRef","implementationRef","implementationMode"])(mt==null?void 0:mt[Mt])!=null&&String(mt[Mt]).trim()!==""&&(Xt[Mt]=mt[Mt]);return Xt};h(ot=>{const mt=new Set(ot.map(Vt=>Vt.id)),Mt={..._c(ot,w.current,q.current).instances||{}};for(const[Vt,sn]of Object.entries(ye)){if(tt&&!tt.has(Vt)||!mt.has(Vt))continue;const Et=Mt[Vt];ga((sn==null?void 0:sn.definitionId)||(Et==null?void 0:Et.definitionId))?Mt[Vt]=sn:Array.isArray(sn==null?void 0:sn.output)&&(Mt[Vt]=xt(Et,sn))}return q.current=Mt,E(Mt),ot.map(Vt=>{var Et,Qt;if(tt&&!tt.has(Vt.id))return Vt;const sn=it.get(Vt.id);return sn?ga(((Et=sn.data)==null?void 0:Et.definitionId)||((Qt=Vt.data)==null?void 0:Qt.definitionId))?{...Vt,data:{...Vt.data,...sn.data}}:{...Vt,data:_t(Vt.data,sn.data)}:Vt})})};for(;;){const{value:he,done:Ke}=await Ae.read();if(Ke)break;Ge+=It.decode(he,{stream:!0});const Oe=Ge.split(`
|
|
251
|
-
`);Ge=Oe.pop()||"";for(const it of Oe){if(!it.trim())continue;const ye=JSON.parse(it);if(ye.type==="error")throw new Error(ye.error||"Workspace run failed");if(ye.type==="stopped"){Aa.current.add(J),ct=Array.isArray(ye.order)?ye.order:ct,Wi("运行停止",ye);continue}if(ye.type==="node-start"&&(we(`Running ${ye.nodeId}...`),Gk(ye.nodeId),fc(ye.nodeId,ye.definitionId,"running")),ye.type==="node-done"){const tt=dt.get(String(ye.nodeId||"").trim());tt&&dm(ye.nodeId,tt),Jk(ye.nodeId),fc(ye.nodeId,ye.definitionId,"done")}if(ye.type==="status"&&Wi(ye.line||ye.message||"",ye),ye.type==="paused"&&(Rt=Array.isArray(ye.nodeIds)?ye.nodeIds:[],Wi("运行暂停",ye)),ye.type==="natural"&&((ye.kind==="result"||/---agentflow\b|resultFile\s*:|\"resultFile\"\s*:|\"result\"\s*:/i.test(String(ye.text||"")))&&ye.nodeId&&dt.set(String(ye.nodeId||"").trim(),String(ye.text||"")),ye.kind==="thinking"?Md(ye.text||""):Xk(ye.kind,ye.text||"")),ye.type==="raw"){const tt=HN(ye);tt&&Md(tt),Qk(ye)}if(ye.type==="graph"&&ye.graph){const tt=$d(ye);Ld(ye.graph,tt),Rd(ye.graph,tt)}if(ye.type==="done"){if(ye.graph){const tt=$d(ye);Ld(ye.graph,tt),Rd(ye.graph,tt)}ct=Array.isArray(ye.order)?ye.order:[],Rt=Array.isArray(ye.pauseNodeIds)?ye.pauseNodeIds:Rt,Wi(Rt.length?"运行暂停":"运行完成",ye)}}}if(Ge.trim()){const he=JSON.parse(Ge);if(he.type==="error")throw new Error(he.error||"Workspace run failed");if(he.type==="stopped"&&(Aa.current.add(J),Wi("运行停止",he)),he.type==="node-start"&&(we(`Running ${he.nodeId}...`),Gk(he.nodeId),fc(he.nodeId,he.definitionId,"running")),he.type==="node-done"){const Ke=dt.get(String(he.nodeId||"").trim());Ke&&dm(he.nodeId,Ke),Jk(he.nodeId),fc(he.nodeId,he.definitionId,"done")}if(he.type==="status"&&Wi(he.line||he.message||"",he),he.type==="paused"&&(Rt=Array.isArray(he.nodeIds)?he.nodeIds:[],Wi("运行暂停",he)),he.type==="natural"&&((he.kind==="result"||/---agentflow\b|resultFile\s*:|\"resultFile\"\s*:|\"result\"\s*:/i.test(String(he.text||"")))&&he.nodeId&&dt.set(String(he.nodeId||"").trim(),String(he.text||"")),he.kind==="thinking"?Md(he.text||""):Xk(he.kind,he.text||"")),he.type==="raw"){const Ke=HN(he);Ke&&Md(Ke),Qk(he)}if(he.type==="graph"&&he.graph){const Ke=$d(he);Ld(he.graph,Ke),Rd(he.graph,Ke)}if(he.type==="done"){if(he.graph){const Ke=$d(he);Ld(he.graph,Ke),Rd(he.graph,Ke)}ct=Array.isArray(he.order)?he.order:[],Rt=Array.isArray(he.pauseNodeIds)?he.pauseNodeIds:Rt,Wi(Rt.length?"运行暂停":"运行完成",he)}}ze()&&(vt(le),qt(le,"stopped"));const fm=ze()?`Workspace run stopped: ${v}`:Rt.length?`Workspace run paused at ${Rt.join(", ")}`:`Workspace run done: ${ct.length?ct.join(" -> "):v}`;if(we(fm),ze()||qt(le,Rt.length?"paused":"success"),rR(ze()?"stopped":Rt.length?"paused":"done"),!ze()){try{await Ft(g.current,w.current),we(fm)}catch(he){we(`${fm},但保存结果失败:${String(he.message||he)}`)}await _n()}}catch(Qe){if(ze()||(Qe==null?void 0:Qe.name)==="AbortError"){vt(le),qt(le,"stopped"),we(`Workspace run stopped: ${v}`),yr(Be=>Be.map(Ae=>Ae.id===J?{...Ae,status:"stopped",endedAt:Date.now()}:Ae));return}vt(le),qt([v,Pt].filter(Boolean),"failed"),we(String(Qe.message||Qe)),yr(Be=>Be.map(Ae=>Ae.id===J?{...Ae,status:"failed",endedAt:Date.now(),messages:[...Array.isArray(Ae.messages)?Ae.messages:[],{role:"assistant",error:!0,text:String(Qe.message||Qe),at:Date.now()}].slice(-160)}:Ae))}finally{sc.current.get(J)===ut&&sc.current.delete(J),$o(Qe=>{const Be={...Qe};return delete Be[J],Be}),Aa.current.delete(J),vt(le)}},[pi,y,i,_n,d,X,Hi,Ft,ks,b,h,$o,s,ie]),kd=m.useCallback(async()=>{try{const S=await(await fetch("/api/skills")).json().catch(()=>({})),I=Array.isArray(S.skills)?S.skills.map(H=>({key:String(H.key),name:String(H.name||H.id||H.key),description:H.description?String(H.description):"",sourceLabel:H.sourceLabel?String(H.sourceLabel):""})):[];JI(I),$b(!0)}catch{$b(!0)}},[]),vd=m.useCallback(async()=>{try{const S=await(await fetch("/api/mcps")).json().catch(()=>({})),I=Array.isArray(S.servers)?S.servers.map(H=>({name:String((H==null?void 0:H.name)||""),type:String((H==null?void 0:H.type)||""),url:String((H==null?void 0:H.url)||""),command:String((H==null?void 0:H.command)||""),args:Array.isArray(H==null?void 0:H.args)?H.args.map(String):[],description:String((H==null?void 0:H.description)||"")})).filter(H=>H.name):[];Db(I)}catch{Db([])}},[]),Sd=m.useCallback(async()=>{try{const v=_s(i),I=await(await fetch(`/api/workspaces?${v.toString()}`)).json().catch(()=>({})),H=Array.isArray(I.workspaces)?I.workspaces.map(U=>({id:String((U==null?void 0:U.id)||""),label:String((U==null?void 0:U.label)||(U==null?void 0:U.name)||"Workspace"),path:String((U==null?void 0:U.path)||""),builtin:(U==null?void 0:U.builtin)===!0,exists:(U==null?void 0:U.exists)!==!1})).filter(U=>U.path):[];zb(H)}catch{zb([])}},[i]);m.useEffect(()=>{Ta().catch(v=>we(String(v.message||v))),wd(),fetch("/api/model-lists").then(v=>v.json()).then(v=>YI({cursor:Array.isArray(v.cursor)?v.cursor.map(String):[],opencode:Array.isArray(v.opencode)?v.opencode.map(String):[],claudeCode:Array.isArray(v.claudeCode)?v.claudeCode.map(String):[],codex:Array.isArray(v.codex)?v.codex.map(String):[]})).catch(()=>{}),kd(),vd(),Sd(),pk(),fetch("/api/skill-collections").then(v=>v.json()).then(v=>{XI(Qo(v)),QI(!0)}).catch(()=>{}),fetch("/api/auth/me").then(v=>v.json()).then(v=>{Gb(v.user||null),Xb(!0)}).catch(()=>{Gb(null),Xb(!0)})},[Ta,wd,vd,kd,pk,Sd,hi]),m.useEffect(()=>{if(ok(""),!(!Mb||!Lb)){if(!hi){Zl([]);return}Zl(X$(hi,"workspace",bs,va)),ok(hi)}},[va,Lb,bs,Mb,hi]),m.useEffect(()=>{if(!(ik!==hi||!hi))try{localStorage.setItem(hi,JSON.stringify(ks))}catch{}},[ks,hi,ik]),m.useEffect(()=>{q.current=B},[B]),m.useEffect(()=>{g.current=d},[d]),m.useEffect(()=>{const v=D.current,S=new Map,I=[];for(const G of d){const J=FP(G);S.set(G.id,J),v.get(G.id)!==J&&I.push(G.id)}if(D.current=S,I.length===0)return;const H=()=>I.forEach(G=>s(G)),U=window.requestAnimationFrame(H),Y=window.setTimeout(H,80);return()=>{window.cancelAnimationFrame(U),window.clearTimeout(Y)}},[d,s]),m.useEffect(()=>{w.current=y},[y]),m.useEffect(()=>{j.current=N},[N]),m.useEffect(()=>{F.current=_},[_]),m.useEffect(()=>{Ye.current=Ie},[Ie]),m.useEffect(()=>{Lt.current=Dn},[Dn]),m.useEffect(()=>{M.current=O},[O]),m.useEffect(()=>{if(!O)return;const v=I=>{I.key==="Escape"&&P(null)},S=I=>{var H,U;(U=(H=I.target)==null?void 0:H.closest)!=null&&U.call(H,".af-connect-node-menu")||P(null)};return document.addEventListener("keydown",v),document.addEventListener("pointerdown",S),()=>{document.removeEventListener("keydown",v),document.removeEventListener("pointerdown",S)}},[O]),m.useEffect(()=>{if(W.current&&ie)return L.current&&window.clearTimeout(L.current),L.current=window.setTimeout(()=>{Ft().catch(v=>we(String(v.message||v)))},650),()=>{L.current&&window.clearTimeout(L.current)}},[d,y,N,Ft,ie]);const ic=m.useMemo(()=>d.filter(v=>{var S;return((S=v==null?void 0:v.data)==null?void 0:S.definitionId)==="workspace_scheduled_run"}).map(v=>{var S;return{id:v.id,config:xb(((S=v.data)==null?void 0:S.body)||"")}}),[d]),uT=m.useMemo(()=>ic.map(v=>`${v.id}:${v.config.enabled?"1":"0"}:${v.config.cron}:${v.config.timezone}`).join("|"),[ic]);m.useEffect(()=>{if(!W.current||a!=="workspace"||!i.flowId){Mo({});return}if(!ic.length){Mo({});return}let v=!1;const S=async()=>{try{const H=_s(i),U=await fetch(`/api/workspace/schedules?${H.toString()}`),Y=await U.json().catch(()=>({}));if(!U.ok)throw new Error(Y.error||"读取 Workspace 定时状态失败");v||Mo(kf(Y.schedules||[]))}catch{v||Mo(H=>{var Y;const U={};for(const G of ic)U[G.id]={...H[G.id]||{},lastStatus:((Y=H[G.id])==null?void 0:Y.lastStatus)||"unknown"};return U})}};S();const I=window.setInterval(S,5e3);return()=>{v=!0,window.clearInterval(I)}},[i,ic,uT,a]);const mk=m.useCallback((v,S)=>{if(!ie){we("Readonly workspace");return}const I=tj(S),H=Q=>Array.isArray(Q)?Q.map(ce=>(ce==null?void 0:ce.name)!=="skillKeys"&&(ce==null?void 0:ce.name)!=="skillsContext"&&(ce==null?void 0:ce.type)!=="text"?ce:{...ce,default:I,value:I}):[],U=d.map(Q=>{var ce;return Q.id!==v?Q:{...Q,data:{...Q.data,body:I,inputs:H((ce=Q.data)==null?void 0:ce.inputs)}}}),Y=q.current||{},G=Y[v]&&typeof Y[v]=="object"?Y[v]:{},J={...Y,[v]:{...G,body:I,input:H(G.input)}};q.current=J,h(U),E(J),Wt(Q=>!Q||Q.id!==v?Q:{...Q,body:I,inputs:H(Q.inputs)}),Ft(U,y).catch(Q=>we(String(Q.message||Q)))},[y,d,Ft,h,ie]),gk=m.useCallback((v,S)=>{if(!ie){we("Readonly workspace");return}const I=B7(S),H=Q=>Array.isArray(Q)?Q.map(ce=>(ce==null?void 0:ce.name)!=="serverNames"&&(ce==null?void 0:ce.name)!=="mcpContext"&&(ce==null?void 0:ce.type)!=="text"?ce:{...ce,default:I,value:I}):[],U=d.map(Q=>{var ce;return Q.id!==v?Q:{...Q,data:{...Q.data,body:I,inputs:H((ce=Q.data)==null?void 0:ce.inputs)}}}),Y=q.current||{},G=Y[v]&&typeof Y[v]=="object"?Y[v]:{},J={...Y,[v]:{...G,body:I,input:H(G.input)}};q.current=J,h(U),E(J),Wt(Q=>!Q||Q.id!==v?Q:{...Q,body:I,inputs:H(Q.inputs)}),Ft(U,y).catch(Q=>we(String(Q.message||Q)))},[y,d,Ft,h,ie]),yk=m.useCallback((v,S)=>{if(!ie){we("Readonly workspace");return}const I=String((S==null?void 0:S.path)||"").trim();if(!I)return;const H=String((S==null?void 0:S.label)||(S==null?void 0:S.id)||"Workspace").trim(),U=JSON.stringify({version:1,id:(S==null?void 0:S.id)||"",label:H,kind:(S==null?void 0:S.kind)||"local",cwd:I,workspaceRoot:I,repoUrl:(S==null?void 0:S.repoUrl)||"",branch:(S==null?void 0:S.branch)||"",mountPath:(S==null?void 0:S.mountPath)||"",type:(S==null?void 0:S.type)||""}),Y=le=>Array.isArray(le)?le.map(ge=>(ge==null?void 0:ge.name)==="path"?{...ge,default:I,value:I}:(ge==null?void 0:ge.name)==="label"?{...ge,default:H,value:H}:(ge==null?void 0:ge.name)==="workspaceContext"?{...ge,default:U,value:U}:(ge==null?void 0:ge.name)==="mode"?{...ge,default:"set",value:"set"}:ge):[],G=d.map(le=>{var ge,Me;return le.id===v?{...le,data:{...le.data,label:((ge=le.data)==null?void 0:ge.label)||"Load Workspace",inputs:Y((Me=le.data)==null?void 0:Me.inputs)}}:le}),J=q.current||{},Q=J[v]&&typeof J[v]=="object"?J[v]:{},ce={...J,[v]:{...Q,label:Q.label||"Load Workspace",input:Y(Q.input)}};q.current=ce,h(G),E(ce),Wt(le=>(le==null?void 0:le.id)===v?{...le,inputs:Y(le.inputs)}:le),Ft(G,y).catch(le=>we(String(le.message||le)))},[y,d,Ft,h,ie]),xk=m.useCallback((v,S)=>{if(!ie){we("Readonly workspace");return}const I=String(v||"");if(!I)return;const H=tj((S==null?void 0:S.skillKeys)||[]),U=od((S==null?void 0:S.displayType)||"markdown"),Y=String((S==null?void 0:S.model)||"").trim(),G=(S==null?void 0:S.includeWorkspaceContext)===!1?"false":"true",J=S!=null&&S.workspaceContext&&typeof S.workspaceContext=="object"?JSON.stringify(S.workspaceContext):"",Q=dt=>Array.isArray(dt)?dt.map(ze=>(ze==null?void 0:ze.name)==="skillKeys"?{...ze,default:H,value:H}:(ze==null?void 0:ze.name)==="displayType"?{...ze,default:U,value:U}:(ze==null?void 0:ze.name)==="includeWorkspaceContext"?{...ze,default:G,value:G}:(ze==null?void 0:ze.name)==="workspaceContext"?{...ze,default:J,value:J}:ze):[],ce=dt=>Array.isArray(dt)?dt.map(ze=>(ze==null?void 0:ze.name)==="displayType"?{...ze,default:U,value:U}:ze):[],le=String((S==null?void 0:S.task)??""),ge=d.map(dt=>{var ze,vt;return dt.id===I?{...dt,data:{...dt.data,body:le,model:Y,inputs:Q((ze=dt.data)==null?void 0:ze.inputs),outputs:ce((vt=dt.data)==null?void 0:vt.outputs)}}:dt}),Me=q.current||{},ut=Me[I]&&typeof Me[I]=="object"?Me[I]:{},Pt={...Me,[I]:{...ut,body:le,model:Y,input:Q(ut.input),output:ce(ut.output)}};q.current=Pt,h(ge),E(Pt),Wt(dt=>(dt==null?void 0:dt.id)===I?{...dt,body:le,model:Y,inputs:Q(dt.inputs),outputs:ce(dt.outputs)}:dt),Ft(ge,y).catch(dt=>we(String(dt.message||dt)))},[y,d,Ft,h,ie]),wk=m.useCallback((v,S)=>{if(!ie){we("Readonly workspace");return}const I=WK(S),H=d.map(J=>J.id===v?{...J,data:{...J.data,body:I}}:J),U=q.current||{},Y=U[v]&&typeof U[v]=="object"?U[v]:{},G={...U,[v]:{...Y,body:I}};q.current=G,h(H),E(G),Wt(J=>(J==null?void 0:J.id)===v?{...J,body:I}:J),Ft(H,y).catch(J=>we(String(J.message||J)))},[y,d,Ft,h,ie]),bk=m.useCallback(v=>{const S=String(v||"").trim();S&&(Yb(I=>I===S?"":S),_a(I=>({...I,[S]:I[S]||{sessionId:`nodechat_${Date.now()}_${S.replace(/[^a-z0-9_-]+/gi,"_")}`,messages:[],draft:"",candidateContent:"",running:!1,error:""}})))},[]),kk=m.useCallback((v,S)=>{const I=String(v||"").trim();I&&_a(H=>({...H,[I]:{...H[I]||{sessionId:`nodechat_${Date.now()}_${I.replace(/[^a-z0-9_-]+/gi,"_")}`,messages:[]},draft:String(S||""),error:""}}))},[]),Ur=m.useCallback((v,S,I="replace",H={})=>{var Qe,Be;if(!ie){we("Readonly workspace");return}const U=String(v||"").trim();if(!U)return;const Y=g.current.find(Ae=>Ae.id===U),G=mn(Y==null?void 0:Y.data),J=Ds((Qe=Y==null?void 0:Y.data)==null?void 0:Qe.definitionId),Q=Ai(S),ce=G==="html"?ql(Q):G==="react"?Oh(Q):String(Q||""),le=Y?bo(Y.data):"",ge=I==="append"&&String(le||"").trim()?`${String(le).replace(/\s+$/g,"")}
|
|
252
|
-
|
|
253
|
-
${ce.trim()}`:ce,Me=G==="image"?"src":"content",ut=H!=null&&H.reloadDisplay?Date.now():(Be=Y==null?void 0:Y.data)==null?void 0:Be.displayReloadKey,Pt=Ae=>{let It=!1;return(Array.isArray(Ae)?Ae:[]).map(ct=>{const Rt=String((ct==null?void 0:ct.name)||""),um=String((ct==null?void 0:ct.type)||"");return(J?Rt===Me||Rt==="result"||Rt==="filePath":Rt===Me||Rt==="filePath"||um==="text")?It?{...ct,default:"",value:""}:(It=!0,{...ct,default:ge,value:ge}):ct})},dt=g.current.map(Ae=>{var It,Ge;return Ae.id!==U?Ae:{...Ae,data:{...Ae.data,body:J?Ae.data.body:ge,...ut?{displayReloadKey:ut}:{},inputs:Pt((It=Ae.data)==null?void 0:It.inputs),outputs:Pt((Ge=Ae.data)==null?void 0:Ge.outputs)}}}),ze=q.current||{},vt=ze[U]&&typeof ze[U]=="object"?ze[U]:{},qt={...ze,[U]:{...vt,body:J?vt.body:ge,input:Pt(vt.input),output:Pt(vt.output)}};q.current=qt,h(dt),E(qt),Wt(Ae=>(Ae==null?void 0:Ae.id)===U?{...Ae,...J?{}:{body:ge}}:Ae),(H==null?void 0:H.logChat)!==!1&&_a(Ae=>{var It;return{...Ae,[U]:{...Ae[U]||{},candidateContent:"",messages:[...(It=Ae[U])!=null&&It.messages&&Array.isArray(Ae[U].messages)?Ae[U].messages:[],{role:"assistant",text:I==="append"?"已追加到当前节点内容。":"已替换当前节点内容。",at:Date.now()}]}}}),Ft(dt,w.current).catch(Ae=>we(String(Ae.message||Ae))),we(String((H==null?void 0:H.statusMessage)||"")||(I==="append"?"已追加节点内容":"已替换节点内容"))},[Ft,h,ie]),Nd=m.useCallback(async(v,S="")=>{if(!ie)return we("Readonly workspace"),"";if(!v)return"";try{const I=new FormData;I.set("file",v),I.set("dir",String(S||"")),i.flowId&&I.set("flowId",i.flowId),i.flowSource&&I.set("flowSource",i.flowSource),i.archived&&I.set("archived","1");const H=await fetch("/api/workspace/upload",{method:"POST",body:I}),U=await H.json().catch(()=>({}));if(!H.ok)throw new Error(U.error||"上传文件失败");const Y=String(U.path||"").trim();if(!Y)throw new Error("上传文件失败:未返回路径");return await _n(),Sn(G=>{const J=new Set(G);for(const Q of Sf(Y))J.delete(Q);return J}),we(`已上传 ${Y}`),Y}catch(I){return we(String(I.message||I)),""}},[i,_n,ie]),jd=m.useCallback(async v=>Wp(v)?Nd(v,"img"):(we("请选择图片文件"),""),[Nd]),vk=m.useCallback((v="")=>{var S;if(!ie){we("Readonly workspace");return}Ct.current=String(v||""),(S=Jt.current)==null||S.click()},[ie]),dT=m.useCallback(async v=>{const S=Array.from(v.target.files||[]);if(v.target.value="",!S.length)return;const I=Ct.current||"";Ee(!0);try{let H="";for(const U of S){const Y=await Nd(U,I);Y&&(H=Y)}S.length>1&&we(`已上传 ${S.length} 个文件${H?`,最后一个:${H}`:""}`)}catch(H){we(String(H.message||H))}finally{Ee(!1)}},[Nd]),Sk=m.useCallback(async(v,S)=>{const I=String(v||"").trim();if(!I)return;const H=await jd(S);H&&Ur(I,H,"replace",{logChat:!1,statusMessage:`已上传图片 ${H}`})},[Ur,jd]),Nk=m.useCallback((v,S="replace")=>{var U;const I=String(v||"").trim(),H=String(((U=Ca[I])==null?void 0:U.candidateContent)||"").trim();!I||!H||Ur(I,H,S)},[Ca,Ur]),jk=m.useCallback(async(v,S=void 0)=>{var Pt,dt;if(!ie){we("Readonly workspace");return}const I=String(v||"").trim();if(!I)return;const H=Ca[I]||{},U=String(S!==void 0?S:H.draft||"").trim();if(!U||H.running)return;const Y=g.current.find(ze=>ze.id===I);if(!Y)return;const G=mn(Y.data)||"markdown",J=bo(Y.data);let Q=ya(J,G),ce=Ai(J);if(Q)try{ce=await Dl(i,Q)}catch(ze){we(String(ze.message||ze))}else if(G!=="image"&&String(ce||"").trim()){const ze=Go(G,ce);if(ze){we(`${ze} 未进入微调。`);return}try{const vt=await vx(i,ZN(I,Y.data),ce);await _n(),Ur(I,vt,"replace",{logChat:!1,reloadDisplay:!0,statusMessage:`已将展示保存为 ${vt}`}),Q=vt,ce=""}catch(vt){we(String(vt.message||vt));return}}const le=i7(I,g.current,w.current),ge={role:"user",text:U,at:Date.now()},Me=Array.isArray(H.messages)?H.messages:[],ut=H.sessionId||`nodechat_${Date.now()}_${I.replace(/[^a-z0-9_-]+/gi,"_")}`;_a(ze=>({...ze,[I]:{...H,sessionId:ut,messages:[...Me,ge],draft:"",running:!0,error:""}}));try{const ze=await fetch("/api/workspace/node-chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,sessionId:ut,node:{id:I,label:((Pt=Y.data)==null?void 0:Pt.label)||I,definitionId:((dt=Y.data)==null?void 0:dt.definitionId)||""},nodeKind:G,currentContent:Q?"":ce,sourceContext:le,targetFilePath:Q,messages:Me,message:U,model:pi})}),vt=await ze.json().catch(()=>({}));if(!ze.ok)throw new Error(vt.error||"节点微调失败");const qt=String(vt.candidateContent||vt.reply||"").trim(),Qe=!!vt.directFileEdit,Be=String(vt.artifactPath||Q||"").trim();if(Qe&&Be){const Ae=Go(G,qt);if(Ae)throw new Error(`${Ae} 文件已由 agent 修改,请检查 ${Be}。`);await _n(),Ur(I,Be,"replace",{logChat:!1,reloadDisplay:!0,statusMessage:`已按微调描述更新 ${Be}`})}else if(qt){const Ae=Go(G,qt);if(Ae)throw new Error(`${Ae} 已取消写入,避免覆盖当前展示文件。`);if(Q){const It=await vx(i,Q,qt);await _n(),Ur(I,It,"replace",{logChat:!1,statusMessage:`已按微调描述更新 ${It}`})}else Ur(I,qt,"replace",{logChat:!1,statusMessage:"已按微调描述更新展示内容"})}_a(Ae=>{var It;return{...Ae,[I]:{...Ae[I]||{},sessionId:String(vt.sessionId||ut),running:!1,candidateContent:"",messages:[...(It=Ae[I])!=null&&It.messages&&Array.isArray(Ae[I].messages)?Ae[I].messages:[...Me,ge],{role:"assistant",text:qt||Qe?Be?`已更新文件 ${Be}。`:"已按你的描述更新当前展示。":"没有生成可更新的内容。",at:Date.now()}]}}})}catch(ze){const vt=String(ze.message||ze);_a(qt=>({...qt,[I]:{...qt[I]||{},running:!1,error:vt}})),we(vt)}},[pi,i,_n,Ca,Ur,ie]),Ck=m.useCallback(async(v,S)=>{if(!ie){we("Readonly workspace");return}const I=mn(S)||"markdown",H=bo(S),U=ya(H,I);let Y=Ai(H);if(U)try{Y=await Dl(i,U)}catch(ce){we(String(ce.message||ce));return}if(!String(Y||"").trim()){we("展示节点没有可保存内容");return}const G=Go(I,Y);if(G){we(`${G} 未保存文件。`);return}const J=ZN(v,S),Q=window.prompt("保存到 workspace 相对路径",J);if(Q)try{const ce=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:Q,content:Y})}),le=await ce.json().catch(()=>({}));if(!ce.ok)throw new Error(le.error||"保存文件失败");const ge=le.path||Q,Me=_s(i);Me.set("path",ge);const ut=await fetch(`/api/workspace/file?${Me.toString()}`);if(!ut.ok){const Pt=await ut.json().catch(()=>({}));throw new Error(Pt.error||`保存后读取失败:${ge}`)}await _n(),is(Pt=>T7(Pt,ge,String(Y||"").length)),Sn(Pt=>{const dt=new Set(Pt);for(const ze of Sf(ge))dt.delete(ze);return dt}),Ur(v,ge,"replace",{logChat:!1,statusMessage:`已保存并引用 ${ge}`}),we(`已保存 ${ge}`)}catch(ce){we(String(ce.message||ce))}},[i,_n,Ur,ie]),_k=m.useCallback(v=>{var U,Y;const S=String(v||"").trim();if(!S||ht)return;const I=g.current.find(G=>G.id===S);if(!I||!mn(I==null?void 0:I.data)){we("展示节点不可用");return}const H=String(((U=I.data)==null?void 0:U.label)||((Y=I.data)==null?void 0:Y.displayName)||S).trim()||"AgentFlow Display";nt(vg({title:H,layout:"single",nodeIds:[S],mode:"single-node",sourceNodeId:S})),Z(""),He(null),Se(!0)},[ht]),Cd=m.useCallback((v,S)=>{const I=String(v||"");I&&Wt(H=>{if(!H||H.id!==I)return H;const U=typeof S=="function"?S(H):S;return!U||typeof U!="object"?H:{...H,...U}})},[]),Ek=m.useCallback((v,S)=>{const I=String(v||"");!I||!ie||(h(H=>H.map(U=>{var G;if(U.id!==I)return U;const Y=Array.isArray((G=U.data)==null?void 0:G.outputs)&&U.data.outputs.length?U.data.outputs.map((J,Q)=>Q===0?{...J,default:S,value:S}:J):[{type:"file",name:"value",default:S,value:S}];return{...U,data:{...U.data,body:"",outputs:Y}}})),Cd(I,H=>({body:"",outputs:Array.isArray(H==null?void 0:H.outputs)&&H.outputs.length?H.outputs.map((Y,G)=>G===0?{...Y,default:S,value:S}:Y):[{type:"file",name:"value",default:S,value:S}]})),we(`已选择文件 ${S}`))},[h,Cd,ie]),Ak=m.useCallback(v=>{pe({nodeId:String(v||""),query:""})},[]),nm=m.useCallback(()=>{pe({nodeId:"",query:""})},[]),fT=m.useCallback(v=>{const S=String((v==null?void 0:v.path)||"").trim();!S||!K.nodeId||(Ek(K.nodeId,S),nm())},[nm,K.nodeId,Ek]),Pk=m.useCallback(async(v,S)=>{if(!ie)return;const I=v7(v,S);if(I.length===0)return;const H=[];try{for(const U of I){const Y=await fetch("/api/workspace/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:U})});if(Y.status===404)continue;const G=await Y.json().catch(()=>({}));if(!Y.ok)throw new Error(G.error||"清理节点输出失败");H.push(G.path||U)}if(H.length===0)return;we(`已清理 ${H.join(", ")}`),await _n(),os(U=>I.some(Y=>U===Y||U.startsWith(`${Y}/`))?"":U)}catch(U){we(String(U.message||U))}},[i,_n,ie]),vs=m.useMemo(()=>d.map(v=>{var S,I;return{...v,data:{...v.data,selected:v.selected===!0,modelLists:To,showBodyPreview:!0,isExecuting:nk.has(v.id),nodeStatus:((S=em[v.id])==null?void 0:S.status)??null,nodeElapsed:((I=em[v.id])==null?void 0:I.elapsed)??null,flowParams:i,readOnly:!ie,onRunWorkspaceNode:hk,onStopWorkspaceNode:fk,onOpenWorkspaceRunLogs:dk,onOptimizeWorkspaceRun:tm,onOptimizeWorkspaceSchedule:tm,optimizingRun:rk===v.id,runningRunNodeIds:ak,scheduledRunState:tk[v.id]||null,onChangeScheduledRunConfig:wk,onChangeContextRunConfig:xk,skills:bs,skillCollections:va,onChangeLoadSkillKeys:mk,onRefreshSkills:kd,mcpServers:Ob,onChangeLoadMcpNames:gk,onRefreshMcps:vd,workspaceTargets:Fb,onChangeLoadWorkspace:yk,onRefreshWorkspaces:Sd,onSaveDisplayNodeToFile:Ck,onShareDisplayNode:_k,onOpenDisplayPreview:gr,onRefreshNodeInternals:Hi,onEnsureWorkspaceNodeDisplaySize:Bb,sharingDisplayNodeId:ht,onUploadWorkspaceImage:jd,onUploadImageToDisplayNode:Sk,onOpenProvideFilePicker:Ak,onStatus:we,nodeChatActive:qb===v.id,nodeChat:Ca[v.id]||null,onSetDisplayNodeContent:Ur,onToggleNodeChat:bk,onCloseNodeChat:()=>Yb(""),onUpdateNodeChatDraft:kk,onSendNodeChat:jk,onApplyNodeChatCandidate:Nk,onSyncNodePropDraft:Cd,onCleanupWorkspaceNodeOutputs:Pk}}}),[qb,Nk,xk,gk,mk,yk,wk,Pk,Bb,i,Ob,To,Ca,d,Ak,dk,tm,rk,vd,Hi,kd,Sd,hk,ak,Ck,tk,jk,Ur,_k,ht,va,bs,fk,Cd,bk,kk,Sk,jd,nk,em,Fb,ie]),rm=m.useMemo(()=>new Map(vs.map(v=>[v.id,v])),[vs]),Ik=qn?rm.get(qn):null,oc=m.useMemo(()=>{const v=new Set(V);return N.nodeIds.map((S,I)=>{const H=rm.get(S);if(!H||!mn(H.data))return null;const U=Ua(H)||{width:520,height:320},Y=ta(N.nodeSizes[S]||U,{display:!0})||U,G=N.nodePositions[S]||{x:180+I*36,y:120+I*28};return{...H,id:UN(S),position:G,selected:v.has(S),width:Y.width,height:Y.height,data:{...H.data,sourceNodeId:S,displayPageMode:!0,readOnly:!0,selected:v.has(S),displaySize:Y,nodeSize:Y}}}).filter(Boolean)},[N,rm,V]),Ra=m.useMemo(()=>vs.filter(v=>mn(v==null?void 0:v.data)),[vs]),at=a==="display";m.useEffect(()=>{if(!at||!N.viewport)return;const v=N.viewport,S=()=>{try{r.setViewport(v,{duration:0})}catch{}},I=window.requestAnimationFrame(()=>window.requestAnimationFrame(S));return()=>window.cancelAnimationFrame(I)},[N.viewport,at,r]),m.useEffect(()=>{if(at||!_)return;const v=_,S=()=>{try{r.setViewport(v,{duration:0})}catch{}},I=window.requestAnimationFrame(()=>window.requestAnimationFrame(S));return()=>window.cancelAnimationFrame(I)},[at,r,_]),m.useEffect(()=>{const v=R.current,S=new Map,I=[];for(const G of[...vs,...oc]){const J=YK(G);S.set(G.id,J),v.get(G.id)!==J&&I.push(G.id)}if(R.current=S,I.length===0)return;const H=()=>I.forEach(G=>s(G)),U=window.requestAnimationFrame(H),Y=window.setTimeout(H,80);return()=>{window.cancelAnimationFrame(U),window.clearTimeout(Y)}},[oc,vs,s]);const Ut=m.useMemo(()=>d.find(v=>v.id===Dn)||null,[d,Dn]),sm=m.useRef({id:"",draft:null}),pT=m.useMemo(()=>{const v=ij(Ut);return v?JSON.stringify(v):""},[Ut]);m.useEffect(()=>{if(!Ut){sm.current={id:"",draft:null},Wt(null),Wr("");return}const v=ij(Ut),S=sm.current;sm.current={id:Ut.id,draft:v},Wt(I=>!I||I.id!==Ut.id||S.id!==Ut.id||!S.draft?v:U7(I,S.draft,v)),Wr("")},[Ut==null?void 0:Ut.id,pT]);const im=m.useCallback((v=!1)=>{if(!Ie||!Ut)return!1;if(!ie)return Wr("Readonly workspace"),we("Readonly workspace"),!1;Wr("");const S=lj({nodes:d,edges:y,instances:q.current,selectedNode:Ut,draft:Ie,allowRename:v});return S!=null&&S.error?(Wr(S.error),!1):(!(S!=null&&S.ok)||!S.changed||(q.current=S.instances,E(S.instances),h(S.nodes),b(S.edges),S.nextId!==Ut.id&&Ve(S.nextId),Hi(S.nextId)),!0)},[y,Ie,d,Ut,b,h,Hi,ie]);m.useEffect(()=>{if(!ie||!Ie||!Ut)return;const v=window.setTimeout(()=>{im(!1)},350);return()=>window.clearTimeout(v)},[Ie==null?void 0:Ie.label,Ie==null?void 0:Ie.role,Ie==null?void 0:Ie.model,Ie==null?void 0:Ie.body,JSON.stringify((Ie==null?void 0:Ie.images)||[]),Ie==null?void 0:Ie.script,Ie==null?void 0:Ie.scriptRef,Ie==null?void 0:Ie.implementationRef,Ie==null?void 0:Ie.implementationMode,JSON.stringify((Ie==null?void 0:Ie.inputs)||[]),JSON.stringify((Ie==null?void 0:Ie.outputs)||[]),im,Ut==null?void 0:Ut.id,ie]);const hT=m.useMemo(()=>{const v=new Map(vs.map(S=>[S.id,S]));return y.map(S=>{var ce,le,ge,Me;const I=v.get(S.source),H=v.get(S.target),U=/^output-(\d+)$/.exec(S.sourceHandle||""),Y=/^input-(\d+)$/.exec(S.targetHandle||""),G=I&&U?(le=(ce=I.data)==null?void 0:ce.outputs)==null?void 0:le[parseInt(U[1],10)]:null,J=H&&Y?(Me=(ge=H.data)==null?void 0:ge.inputs)==null?void 0:Me[parseInt(Y[1],10)]:null,Q=G!=null&&G.type?yn(G.type):J!=null&&J.type?yn(J.type):"";return Q?{...S,style:{...S.style||{},stroke:Q,strokeWidth:2},markerEnd:{type:ei.ArrowClosed,color:Q}}:S})},[y,vs]),mT=at?oc:vs,gT=at?[]:hT,yT=m.useMemo(()=>at?oc.map(v=>({...v,id:bg(v.id)})):vs,[oc,vs,at]),xT=m.useCallback(v=>{const S=String(v||"").trim();if(!S)return;const I=at?UN(S):S;at?z([S]):(h(U=>U.map(Y=>({...Y,selected:Y.id===I}))),b(U=>U.map(Y=>({...Y,selected:!1}))),Ve(I));const H=()=>{var ce,le,ge;const U=r.getNode(I);if(!U)return;const Y=(ce=r.getInternalNode)==null?void 0:ce.call(r,I),G=((le=Y==null?void 0:Y.measured)==null?void 0:le.width)??(Y==null?void 0:Y.width)??U.width??260,J=((ge=Y==null?void 0:Y.measured)==null?void 0:ge.height)??(Y==null?void 0:Y.height)??U.height??120,{zoom:Q}=r.getViewport();r.setCenter(U.position.x+G/2,U.position.y+J/2,{zoom:t7(Q),duration:240})};window.requestAnimationFrame(()=>window.requestAnimationFrame(H))},[at,r,b,h]),Tk=m.useCallback(()=>{const v=r.getViewport(),S={x:Number(v.x)||0,y:Number(v.y)||0,zoom:Math.min(Math.max(Number(v.zoom)||1,.1),4)};if(at){const I={...j.current,viewport:S};j.current=I,C(I),we("已固定 Display 进入视角")}else F.current=S,A(S),we("已固定 Workspace 进入视角");Ft(g.current,w.current).catch(I=>we(String(I.message||I)))},[at,r,Ft]),om=m.useMemo(()=>{const v=ae.trim().toLowerCase(),S={DISPLAY:[],CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const I of X)v&&![I.id,I.label,I.displayName,I.description].some(H=>String(H||"").toLowerCase().includes(v))||S[Dc(I)].push(I);for(const I of Va)S[I].sort((H,U)=>H.id.localeCompare(U.id));return S},[X,ae]),ac=m.useMemo(()=>{const v=wt.trim().toLowerCase();return X.filter(S=>!v||[S.id,S.label,S.displayName,S.description].some(I=>String(I||"").toLowerCase().includes(v))).sort((S,I)=>{const H=Va.indexOf(Dc(S)),U=Va.indexOf(Dc(I));return H!==U?H-U:Fc(S).localeCompare(Fc(I))}).slice(0,30)},[X,wt]),lc=m.useMemo(()=>{const v=wt.trim().toLowerCase();return ne.filter(S=>!v||[S.id,S.version,S.displayName,S.name,S.description,...Array.isArray(S.tags)?S.tags:[]].some(I=>String(I||"").toLowerCase().includes(v))).sort((S,I)=>String(S.displayName||S.name||S.id).localeCompare(String(I.displayName||I.name||I.id))).slice(0,30)},[ne,wt]);m.useEffect(()=>{kn(0)},[wt,Bt,be]),m.useEffect(()=>{if(!Bt)return;const v=window.setTimeout(()=>{var S;return(S=Kb.current)==null?void 0:S.focus()},0);return()=>window.clearTimeout(v)},[Bt]);const wT=m.useMemo(()=>{const v=Gt.trim().toLowerCase();return v?wb(Vr).filter(S=>S.path.toLowerCase().includes(v)):Vr},[Gt,Vr]),Lo=m.useMemo(()=>JP(Vr,Ar),[Vr,Ar]),mi=(Lo==null?void 0:Lo.type)==="directory"?Lo.path:A7((Lo==null?void 0:Lo.path)||""),bT=m.useCallback(v=>{var S,I;(I=(S=v.target)==null?void 0:S.closest)!=null&&I.call(S,".af-work-file")||os("")},[]),kT=[...(To.cursor||[]).map(v=>({label:`Cursor · ${v.split(" - ")[0]}`,value:`cursor:${v.split(" - ")[0]}`})),...(To.opencode||[]).map(v=>({label:`OpenCode · ${v.split(" - ")[0]}`,value:`opencode:${v.split(" - ")[0]}`})),...(To.claudeCode||[]).map(v=>({label:`Claude · ${v.split(" - ")[0]}`,value:`claude-code:${v.split(" - ")[0]}`})),...(To.codex||[]).map(v=>({label:`Codex · ${v.split(" - ")[0]}`,value:`codex:${v.split(" - ")[0]}`}))],am=m.useMemo(()=>new Set(ks),[ks]),Ma=m.useMemo(()=>{const v=new Map(bs.map(Y=>[Y.key,Y])),S=new Set,I=new Set,H=va.map(Y=>{const G=la(Y,bs).map(J=>v.get(J)).filter(Boolean);for(const J of G)S.add(J.key),I.add(String(J.name||J.id||J.key||"").trim());return{...Y,skills:G}}).filter(Y=>Y.skills.length>0),U=bs.filter(Y=>{const G=String(Y.name||Y.id||Y.key||"").trim();return!S.has(Y.key)&&!I.has(G)});return{groups:H,ungrouped:U}},[va,bs]);m.useEffect(()=>{Wb(v=>{let S=!1;const I=new Set(v);for(const H of Ma.groups)I.has(H.id)||(I.add(H.id),S=!0);return S?I:v})},[Ma.groups]);const zn=m.useMemo(()=>{const v=d.filter(S=>S.selected);return v.length>0?v:Dn?d.filter(S=>S.id===Dn):[]},[d,Dn]),_d=m.useMemo(()=>zn.map(v=>v.id),[zn]),Rk=m.useCallback(()=>{if(at)return;if(!ie){we("Readonly workspace");return}const v=(g.current||[]).filter(J=>(J==null?void 0:J.selected)&&!iu(J));if(v.length<2){we("选择至少两个节点后按 G 创建 Group");return}const S=v.reduce((J,Q)=>{var ut,Pt,dt,ze,vt,qt,Qe,Be,Ae,It,Ge,ct;const ce=Number(((ut=Q.position)==null?void 0:ut.x)||0),le=Number(((Pt=Q.position)==null?void 0:Pt.y)||0),ge=Number(((dt=Q.measured)==null?void 0:dt.width)||Q.width||((vt=(ze=Q.data)==null?void 0:ze.nodeSize)==null?void 0:vt.width)||((Qe=(qt=Q.data)==null?void 0:qt.displaySize)==null?void 0:Qe.width)||PP),Me=Number(((Be=Q.measured)==null?void 0:Be.height)||Q.height||((It=(Ae=Q.data)==null?void 0:Ae.nodeSize)==null?void 0:It.height)||((ct=(Ge=Q.data)==null?void 0:Ge.displaySize)==null?void 0:ct.height)||Bp);return{minX:Math.min(J.minX,ce),minY:Math.min(J.minY,le),maxX:Math.max(J.maxX,ce+ge),maxY:Math.max(J.maxY,le+Me)}},{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});if(!Number.isFinite(S.minX)||!Number.isFinite(S.minY))return;const I=new Set((g.current||[]).map(J=>J.id));let H=1,U=`group_${H}`;for(;I.has(U);)H+=1,U=`group_${H}`;const Y=bx({width:S.maxX-S.minX+wf*2,height:S.maxY-S.minY+wf*2})||{width:ha,height:ma},G={id:U,type:bl,position:{x:S.minX-wf,y:S.minY-wf},width:Y.width,height:Y.height,selected:!0,draggable:!0,selectable:!0,zIndex:0,data:{isWorkspaceGroup:!0,label:Kp(H-1),title:Kp(H-1),color:"purple",nodeSize:Y}};h(J=>[G,...J.map(Q=>({...Q,selected:!1}))]),b(J=>J.map(Q=>({...Q,selected:!1}))),Ve(""),we(`Created group for ${v.length} nodes`)},[at,b,h,ie]),cc=m.useMemo(()=>d.filter(v=>mn(v==null?void 0:v.data)),[d]),lm=m.useMemo(()=>zn.filter(v=>mn(v==null?void 0:v.data)).map(v=>v.id),[zn]),vT=m.useMemo(()=>{const v=String((xr==null?void 0:xr.username)||(xr==null?void 0:xr.userId)||"").trim();return v?v.slice(0,1).toUpperCase():"?"},[xr]),cm=m.useMemo(()=>new Set(_d),[_d]),Ed=m.useMemo(()=>y.filter(v=>cm.has(v.source)&&cm.has(v.target)),[y,cm]),Mk=m.useCallback(v=>{const S=v==="display"?"display":"workspace";l(S),Ve(""),z([]),P(null),te(!1),bn(!1);const I=_s(i);S==="display"&&I.set("view","display");const H=`/workspace${I.toString()?`?${I.toString()}`:""}`;window.history.pushState({},"",H)},[i]),$k=m.useCallback(v=>{const S=String(v||"").trim();if(!S)return;const I=g.current.find(H=>H.id===S);if(!I||!mn(I.data)){we("展示节点不可用");return}C(H=>{if(H.nodeIds.includes(S))return H;const U=H.nodeIds.length,Y=Ua(I);return{nodeIds:[...H.nodeIds,S],nodePositions:{...H.nodePositions,[S]:{x:180+U*36,y:120+U*28}},nodeSizes:{...H.nodeSizes,...Y?{[S]:Y}:{}}}}),z([S])},[]),Lk=m.useCallback(v=>{const S=String(v||"").trim();S&&(C(I=>{const H=I.nodeIds.filter(G=>G!==S),U={...I.nodePositions},Y={...I.nodeSizes};return delete U[S],delete Y[S],{nodeIds:H,nodePositions:U,nodeSizes:Y}}),z(I=>I.filter(H=>H!==S)))},[]),Ok=m.useCallback(v=>{const S=String(v||"").trim();S&&(j.current.nodeIds.includes(S)?Lk(S):$k(S))},[$k,Lk]),Ad=m.useMemo(()=>{const v=nn.trim().toLowerCase();return v?Ra.filter(S=>{var I,H;return[S.id,(I=S.data)==null?void 0:I.label,(H=S.data)==null?void 0:H.definitionId].filter(Boolean).some(U=>String(U).toLowerCase().includes(v))}):Ra},[Ra,nn]),Dk=m.useMemo(()=>{const v=Ad.length,S=v<=1?1:v<=4?2:3,I=Array.from({length:S},()=>({height:0,nodes:[]}));for(const H of Ad){const U=Ua(H)||{width:420,height:260},Y=Math.max(1,Number(U.width)||420),G=Math.max(1,Number(U.height)||260),J=Math.min(26,Math.max(5.5,G/Y*16))+3.2;let Q=I[0];for(const ce of I)ce.height<Q.height&&(Q=ce);Q.nodes.push(H),Q.height+=J}return I.map(H=>H.nodes)},[Ad]),ST=m.useCallback(v=>{var Y;const S=N.nodeIds.includes(v.id),I=Ua(v)||{width:420,height:260},H=Math.max(1,Math.round(Number(I.width)||420)),U=Math.max(1,Math.round(Number(I.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":`${H} / ${U}`},onClick:()=>Ok(v.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(g7,{node:v})}),o.jsxs("span",{className:"af-display-picker-card__meta",children:[o.jsx("strong",{children:((Y=v.data)==null?void 0:Y.label)||v.id}),o.jsxs("small",{children:[mn(v.data)," · ",v.id]})]})]},v.id)},[N.nodeIds,Ok]),Fk=m.useMemo(()=>{const v=ae.trim().toLowerCase();return v?ne.filter(S=>[S.id,S.version,S.displayName,S.name,S.description,...Array.isArray(S.tags)?S.tags:[]].filter(Boolean).some(I=>String(I).toLowerCase().includes(v))):ne},[ne,ae]),zk=m.useCallback((v,S)=>{const I=String(v||"snippet_node").trim().replace(/[^a-zA-Z0-9_]+/g,"_").replace(/^_+|_+$/g,"")||"snippet_node";let H=`${I}_${Date.now().toString(36)}`,U=2;for(;S.has(H);)H=`${I}_${Date.now().toString(36)}_${U}`,U+=1;return S.add(H),H},[]),uc=m.useCallback((v,S)=>{var Ae,It;if(!ie){we("Readonly workspace");return}const I=v!=null&&v.snippet&&typeof v.snippet=="object"?v.snippet:{},H=I.instances&&typeof I.instances=="object"?I.instances:{},U=Object.keys(H);if(U.length===0)return;const Y=new Set(g.current.map(Ge=>Ge.id)),G={};for(const Ge of U)G[Ge]=zk(Ge,Y);const J=(Ae=I.ui)!=null&&Ae.nodePositions&&typeof I.ui.nodePositions=="object"?I.ui.nodePositions:{},Q=(It=I.ui)!=null&&It.nodeSizes&&typeof I.ui.nodeSizes=="object"?I.ui.nodeSizes:{},ce=U.map(Ge=>{const ct=J[Ge];return{id:Ge,x:typeof(ct==null?void 0:ct.x)=="number"?ct.x:0,y:typeof(ct==null?void 0:ct.y)=="number"?ct.y:0}}),le=Math.min(...ce.map(Ge=>Ge.x)),ge=Math.min(...ce.map(Ge=>Ge.y));let Me=S||{x:360+g.current.length*24,y:180+g.current.length*18};if(!S){const Ge=document.querySelector(".af-workspace-canvas .react-flow");if(Ge){const ct=Ge.getBoundingClientRect();Me=r.screenToFlowPosition({x:ct.left+ct.width*.48,y:ct.top+ct.height*.32})}}const ut={},Pt={},dt={};for(const Ge of ce){const ct=G[Ge.id];ut[ct]={...H[Ge.id]||{}},Pt[ct]={x:Me.x+(Ge.x-le),y:Me.y+(Ge.y-ge)};const Rt=Q[Ge.id];typeof(Rt==null?void 0:Rt.width)=="number"&&typeof(Rt==null?void 0:Rt.height)=="number"&&(dt[ct]={width:Rt.width,height:Rt.height})}const ze=new Set(U),vt=(Array.isArray(I.edges)?I.edges:[]).filter(Ge=>ze.has(Ge==null?void 0:Ge.source)&&ze.has(Ge==null?void 0:Ge.target)).map(Ge=>({source:G[Ge.source],target:G[Ge.target],sourceHandle:Ge.sourceHandle??null,targetHandle:Ge.targetHandle??null})),qt=vf({instances:ut,edges:vt,ui:{nodePositions:Pt,nodeSizes:dt}},X),Qe=qt.nodes.map(Ge=>Ge.id),Be=qt.nodes.map(Ge=>({...Ge,selected:!0}));q.current={...q.current,...qt.instances},E(q.current),h(Ge=>[...Ge.map(ct=>({...ct,selected:!1})),...Be]),b(Ge=>[...Ge.map(ct=>({...ct,selected:!1})),...qt.edges.map(ct=>({...ct,selected:!1}))]),Ve(""),z([]),we(`已添加流程片段:${v.displayName||v.id}(已选中 ${Qe.length} 个节点)`)},[zk,X,r,b,h,ie]),NT=m.useCallback(()=>{var I,H;if(zn.length<2){We("请先在 workspace 画布上选择至少两个节点。"),de("flows");return}const v=zn[0],S=zn.length===2?`${((I=v.data)==null?void 0:I.label)||v.id} 片段`:`${((H=v.data)==null?void 0:H.label)||v.id} 等 ${zn.length} 个节点`;Te({name:S,id:S.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),description:""}),$t(""),Ue(!0),de("flows")},[zn]),jT=m.useCallback(async()=>{var U,Y;if(zn.length<2)return;const v=pt.name.trim();if(!v){$t("请填写片段名称。");return}const S={},I={};for(const G of zn){S[G.id]={x:((U=G.position)==null?void 0:U.x)||0,y:((Y=G.position)==null?void 0:Y.y)||0};const J=Ua(G);J&&(I[G.id]=J)}const H=Ed.map(G=>({source:G.source,target:G.target,sourceHandle:G.sourceHandle??null,targetHandle:G.targetHandle??null}));Yt(!0),$t("");try{const G=await fetch("/api/marketplace/publish-flow-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:pt.id,name:v,displayName:v,version:"1.0.0",description:pt.description,snippet:{instances:hb(zn,q.current),edges:H,ui:{nodePositions:S,nodeSizes:I}}})}),J=await G.json().catch(()=>({}));if(!G.ok||J.ok===!1)throw new Error(J.error||"发布流程片段失败");Ue(!1),we(`流程片段已发布:${J.id||v}`),Hb(`流程片段已发布:${J.id||v}`),await wd(),de("flows")}catch(G){$t(String(G.message||G))}finally{Yt(!1)}},[wd,pt,Ed,zn,Hb]);m.useCallback(()=>{if(cc.length===0){we("当前 workspace 没有 display 节点");return}const v=lm.length>0?lm:cc.map(I=>I.id),S=i.flowId?`${i.flowId} 展示页`:"AgentFlow Display";nt(vg({title:S,layout:"gallery",nodeIds:v,mode:"multi-node"})),Z(""),He(null),Se(!0)},[i.flowId,lm,cc]);const CT=m.useCallback(v=>{nt(S=>{const I=Array.isArray(S.nodeIds)?S.nodeIds:[];return I.includes(v)?{...S,nodeIds:I.filter(H=>H!==v)}:{...S,nodeIds:[...I,v]}})},[]),Ss=m.useCallback(async()=>{Ln(!0),Zn("");try{const v=await fetch("/api/display/shares"),S=await v.json().catch(()=>({}));if(!v.ok)throw new Error(S.error||"读取分享列表失败");hr(Array.isArray(S.shares)?S.shares:[])}catch(v){Zn(String(v.message||v)),hr([])}finally{Ln(!1)}},[]),_T=m.useCallback(()=>{Un(!0),mr(""),Ss()},[Ss]),ET=m.useCallback(async()=>{var I,H;const v=Ce.title.trim(),S=Array.isArray(Ce.nodeIds)?Ce.nodeIds:[];if(S.length===0){Z("请选择至少一个 display 节点。");return}Ze(!0),Z(""),He(null);try{await Ft(d,y);const U=await fetch("/api/display/share",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,title:v,layout:Ce.layout,nodeIds:S,...YN(Ce)})}),Y=await U.json().catch(()=>({}));if(!U.ok||Y.ok===!1)throw new Error(Y.error||"发布展示页失败");const G=new URL(Y.url||`/display/${((I=Y.share)==null?void 0:I.id)||""}`,window.location.origin).href;He({...Y,absoluteUrl:G}),we((H=Y.share)!=null&&H.expiresAt?"展示页已生成":"展示页已生成:永久有效"),hn&&Ss()}catch(U){Z(String(U.message||U))}finally{Ze(!1)}},[Ce,hn,y,i,Ss,d,Ft]),AT=m.useCallback(async()=>{var S,I;const v=Array.isArray(N.nodeIds)?N.nodeIds:[];if(v.length===0){Z("请先添加至少一个展示节点。"),we("请先添加至少一个展示节点"),bn(!0);return}Ze(!0),Z("");try{await Ft(d,y);const H=i.flowId?`${i.flowId} 展示页`:"AgentFlow Display",U=await fetch("/api/display/share",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,title:H,layout:"canvas",nodeIds:v,...YN(Ce)})}),Y=await U.json().catch(()=>({}));if(!U.ok||Y.ok===!1)throw new Error(Y.error||"生成展示链接失败");const G=new URL(Y.url||`/display/${((S=Y.share)==null?void 0:S.id)||""}`,window.location.origin).href;He({...Y,absoluteUrl:G}),Wn(!0),we((I=Y.share)!=null&&I.expiresAt?"展示链接已生成":"展示链接已生成:永久有效"),hn&&Ss()}catch(H){const U=String(H.message||H);Z(U),we(U)}finally{Ze(!1)}},[N.nodeIds,Ce,hn,y,i,Ss,d,Ft]),Hk=m.useCallback(async()=>{const v=xe==null?void 0:xe.absoluteUrl;if(!v)return;const S=await JN(v);Kn(S?"copied":"failed"),window.setTimeout(()=>Kn(""),1600)},[xe==null?void 0:xe.absoluteUrl]),PT=m.useCallback(async v=>{const S=GN(v),I=await JN(S);mr(I?String((v==null?void 0:v.id)||""):"failed"),window.setTimeout(()=>mr(""),1600)},[]),IT=m.useCallback(async(v,S)=>{const I=String((v==null?void 0:v.id)||"");if(I){On(I),Zn("");try{const H=S==="permanent"?{id:I,expiresMode:"permanent",permanent:!0}:{id:I,expiresMode:"days",expiresInDays:Number(S||30)},U=await fetch("/api/display/share",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(H)}),Y=await U.json().catch(()=>({}));if(!U.ok||Y.ok===!1)throw new Error(Y.error||"更新分享有效期失败");await Ss(),we("分享有效期已更新")}catch(H){Zn(String(H.message||H))}finally{On("")}}},[Ss]),TT=m.useCallback(async v=>{const S=String((v==null?void 0:v.id)||"");if(S){On(S),Zn("");try{const I=await fetch(`/api/display/share?id=${encodeURIComponent(S)}`,{method:"DELETE"}),H=await I.json().catch(()=>({}));if(!I.ok||H.ok===!1)throw new Error(H.error||"撤销分享失败");await Ss(),we("分享已撤销")}catch(I){Zn(String(I.message||I))}finally{On("")}}},[Ss]),RT=m.useCallback(v=>{h(S=>S.map(I=>I.id===v?{...I,selected:!1}:I)),Ve(S=>S===v?"":S)},[h]),$a=m.useCallback(()=>{const v=qh.current;if(!v)return;const S=v.getBoundingClientRect(),I=Math.min(420,Math.max(320,S.width+160)),H=12,U=Math.max(180,S.top-H*2),Y=Math.min(560,U);nT({position:"fixed",left:Math.max(12,Math.min(window.innerWidth-I-12,S.left)),top:Math.max(H,S.top-Y-H),width:I,maxHeight:Y,zIndex:1e4})},[]);m.useEffect(()=>{if(!fd)return;$a();const v=I=>{var U,Y;const H=I.target;(U=qh.current)!=null&&U.contains(H)||(Y=Vb.current)!=null&&Y.contains(H)||Uh(!1)},S=I=>{I.key==="Escape"&&Uh(!1)};return window.addEventListener("pointerdown",v),window.addEventListener("keydown",S),window.addEventListener("resize",$a),window.addEventListener("scroll",$a,!0),()=>{window.removeEventListener("pointerdown",v),window.removeEventListener("keydown",S),window.removeEventListener("resize",$a),window.removeEventListener("scroll",$a,!0)}},[fd,$a]);const MT=m.useCallback(v=>{var H,U;if(a==="display"){const Y=[];let G=!1;C(J=>{var le,ge;const Q={...J.nodePositions},ce={...J.nodeSizes};for(const Me of v||[]){const ut=bg(Me==null?void 0:Me.id);if(!(!ut||!J.nodeIds.includes(ut))){if(Me.type==="select"){Me.selected&&Y.push(ut);continue}if(Me.type==="position"&&Me.position){Q[ut]={x:Me.position.x,y:Me.position.y},G=!0;continue}if(Me.type==="dimensions"&&((le=Me.dimensions)!=null&&le.width)&&((ge=Me.dimensions)!=null&&ge.height)){const Pt=ta({width:Math.round(Number(Me.dimensions.width)),height:Math.round(Number(Me.dimensions.height))},{display:!0});Pt&&(ce[ut]=Pt,G=!0)}}}return G?{...J,nodePositions:Q,nodeSizes:ce}:J}),(v||[]).some(J=>(J==null?void 0:J.type)==="select")&&z(Y);return}if(!ie){const Y=(v||[]).filter(G=>(G==null?void 0:G.type)==="select");Y.length>0&&h(G=>Lp(Y,G));return}const S=new Map;for(const Y of v||[])if((Y==null?void 0:Y.type)==="dimensions"&&((H=Y.dimensions)!=null&&H.width)&&((U=Y.dimensions)!=null&&U.height)){const G=d.find(ge=>ge.id===Y.id),J=iu(G),Q=!!mn(G==null?void 0:G.data),ce={width:Math.round(Number(Y.dimensions.width)),height:Math.round(Number(Y.dimensions.height))},le=J?bx(ce):ta(ce,{display:Q});le&&S.set(Y.id,le)}const I=Array.from(S.keys());if(h(Y=>Lp(v,Y).map(G=>{const J=S.get(G.id);return J?iu(G)?{...G,width:J.width,height:J.height,data:{...G.data,nodeSize:J}}:mn(G.data)?{...G,width:J.width,height:J.height,data:{...G.data,nodeSize:J,displaySize:J}}:{...G,width:J.width,height:J.height,data:{...G.data,nodeSize:J}}:G})),I.length>0){const Y=()=>I.forEach(G=>s(G));window.requestAnimationFrame(Y),window.setTimeout(Y,80)}},[d,h,s,a,ie]),$T=m.useCallback(v=>{if(a!=="display"){if(!ie){const S=(v||[]).filter(I=>(I==null?void 0:I.type)==="select");S.length>0&&b(I=>Vw(S,I));return}k(v)}},[k,b,a,ie]),La=m.useCallback(()=>{const v=document.querySelector(".af-workspace-canvas .react-flow");if(v){const S=v.getBoundingClientRect();return r.screenToFlowPosition({x:S.left+S.width*.48,y:S.top+S.height*.32})}return{x:360+d.length*36,y:180+d.length*28}},[d.length,r]),Pd=m.useCallback(()=>{var v,S,I;if(Ut){const H=Number(((v=Ut.measured)==null?void 0:v.width)||Ut.width||260);return{x:Number(((S=Ut.position)==null?void 0:S.x)||0)+H+140,y:Number(((I=Ut.position)==null?void 0:I.y)||0)}}return La()},[La,Ut]),gi=m.useCallback((v,S={})=>{if(!ie)return we("Readonly workspace"),null;if(!v)return null;const I=gb(v)||v.id,H=LP(v),U=DP(v),Y=S.id||FK(I,d),G=Hc(v.inputs),J=Hc(v.outputs),Q={definitionId:I,...H?{marketplaceRef:H}:{},...v.packageId?{marketplacePackageId:v.packageId}:{},...v.version?{marketplaceVersion:v.version}:{},label:S.label||Vp(v),role:"normal",body:S.body||"",...S.script||U?{script:S.script||U}:{},...S.scriptRef?{scriptRef:S.scriptRef}:{},...S.implementationRef?{implementationRef:S.implementationRef}:{},...S.implementationMode?{implementationMode:S.implementationMode}:{},input:S.inputs||G,output:S.outputs||J},ce={id:Y,type:bl,position:S.position||La(),data:{label:Q.label,definitionId:I,...H?{marketplaceRef:H}:{},...v.packageId?{marketplacePackageId:v.packageId}:{},...v.version?{marketplaceVersion:v.version}:{},schemaType:$P(I,v),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}},le={...mx(ce,{...q.current,[Y]:Q},X),selected:!0};return h(ge=>[...ge.map(Me=>({...Me,selected:!1})),le]),S.openProperties&&Ve(Y),Y},[La,d,X,h,ie]),LT=m.useCallback(v=>wg(v,g.current),[]),OT=m.useCallback(v=>{if(!ie){we("Readonly workspace");return}if(!wg(v,g.current)){we("端口类型不匹配,已取消连线");return}P(null),h(S=>hg(S,v)),b(S=>{const I=S.filter(H=>!(H.target===v.target&&H.targetHandle===v.targetHandle));return Xf({...v,markerEnd:{type:ei.ArrowClosed}},I)})},[b,h,ie]),DT=m.useCallback((v,S)=>{if(!ie)return;const I=LK(S,g.current);$.current=I?{...I,preferExisting:!!(v!=null&&v.shiftKey)}:null,P(null)},[ie]),FT=m.useCallback((v,S)=>{var ze,vt,qt,Qe;if(!ie)return;const I=$.current;if($.current=null,!I||S!=null&&S.toNode)return;const H=OK(X,I),U=DK(g.current,w.current,I);if(H.length===0&&U.length===0){we(`没有匹配 ${I.slotType} 端口的节点`);return}const G=!!(v!=null&&v.shiftKey||I.preferExisting)?U.length>0?"existing":"create":H.length>0?"create":"existing",J=((vt=(ze=v==null?void 0:v.changedTouches)==null?void 0:ze[0])==null?void 0:vt.clientX)??(v==null?void 0:v.clientX),Q=((Qe=(qt=v==null?void 0:v.changedTouches)==null?void 0:qt[0])==null?void 0:Qe.clientY)??(v==null?void 0:v.clientY);if(!Number.isFinite(J)||!Number.isFinite(Q))return;const ce=document.querySelector(".af-workspace-canvas .react-flow");if(!ce)return;const le=ce.getBoundingClientRect(),ge=320,Me=Math.max(H.length,U.length),ut=Math.min(480,150+Me*58),Pt=Math.max(12,Math.min(J-le.left,le.width-ge-12)),dt=Math.max(12,Math.min(Q-le.top,le.height-ut-12));P({left:Pt,top:dt,flowPosition:r.screenToFlowPosition({x:J,y:Q}),draft:I,candidates:H,existingCandidates:U,mode:G,query:""})},[X,r,ie]),zT=m.useCallback(v=>{if(!ie){we("Readonly workspace"),P(null);return}const S=M.current;if(!S||!(v!=null&&v.def))return;const I=gi(v.def,{position:S.flowPosition});if(!I)return;const H=S.draft.handleType==="source"?{source:S.draft.nodeId,sourceHandle:S.draft.handleId,target:I,targetHandle:`input-${v.slotIndex}`}:{source:I,sourceHandle:`output-${v.slotIndex}`,target:S.draft.nodeId,targetHandle:S.draft.handleId};h(U=>hg(U,H)),b(U=>{const Y=U.filter(G=>!(G.target===H.target&&G.targetHandle===H.targetHandle));return Xf({...H,markerEnd:{type:ei.ArrowClosed}},Y)}),P(null)},[gi,b,ie]),HT=m.useCallback(v=>{if(!ie){we("Readonly workspace"),P(null);return}const S=v==null?void 0:v.connection;if(!S||!wg(S,g.current)){we("端口类型不匹配,已取消连线"),P(null);return}h(I=>hg(I,S)),b(I=>{const H=I.filter(U=>!(U.target===S.target&&U.targetHandle===S.targetHandle));return Xf({...S,markerEnd:{type:ei.ArrowClosed}},H)}),P(null)},[b,h,ie]),Bk=m.useCallback(v=>{v&&(gi(v,{position:Pd()}),te(!1),rn(""))},[gi,Pd]),Wk=m.useCallback(v=>{v&&(uc(v,Pd()),te(!1),rn(""))},[uc,Pd]),BT=m.useCallback(v=>{var I,H,U;if(at)return;const S=v==null?void 0:v.target;FN(S)||(I=S==null?void 0:S.closest)!=null&&I.call(S,"button, a, [role='button'], .react-flow__handle")||(U=(H=x.current)==null?void 0:H.focus)==null||U.call(H,{preventScroll:!0})},[at]);m.useEffect(()=>{const v=S=>{var ce;if(S.defaultPrevented)return;const I=MV(S.target)||FN(S.target);if((S.metaKey||S.ctrlKey)&&S.key.toLowerCase()==="s"){S.preventDefault(),Ft().catch(le=>we(String(le.message||le)));return}if((S.metaKey||S.ctrlKey)&&S.key.toLowerCase()==="k"){S.preventDefault(),S.stopPropagation(),Qb(le=>!le);return}if(Qh)return;if(Xh){(S.key==="Escape"||IN(S))&&(S.preventDefault(),yd(!1));return}const H=S.key.toLowerCase(),U=(S.metaKey||S.ctrlKey)&&H==="c",Y=(S.metaKey||S.ctrlKey)&&H==="v",G=I&&U&&jK(S.target);if(I&&!G)return;const J=(S.metaKey||S.ctrlKey)&&!S.shiftKey&&H==="z",Q=(S.metaKey||S.ctrlKey)&&(S.shiftKey&&H==="z"||H==="y");if(J||Q){if(at){S.preventDefault(),S.stopPropagation(),we("展示页布局会自动保存");return}if(!ie){S.preventDefault(),we("Readonly workspace");return}S.preventDefault(),S.stopPropagation();const le=J?ck():uk();we(le?J?"Undo canvas change":"Redo canvas change":J?"Nothing to undo":"Nothing to redo");return}if(U){if(at)return;const le=Lt.current,ge=(g.current||[]).some(ut=>ut==null?void 0:ut.selected)?g.current:(g.current||[]).map(ut=>le&&ut.id===le?{...ut,selected:!0}:ut),Me=sV(ge,w.current,q.current);Me&&(S.preventDefault(),S.stopPropagation(),T.current=Me,ZK(Me),G&&typeof((ce=S.target)==null?void 0:ce.blur)=="function"&&S.target.blur(),we(`Copied ${Me.nodes.length} node${Me.nodes.length>1?"s":""}`));return}if(Y){if(at){S.preventDefault(),S.stopPropagation();return}if(!ie){S.preventDefault(),we("Readonly workspace");return}const le=T.current||e7();le&&!T.current&&(T.current=le);const ge=iV(le,g.current,w.current,q.current);ge&&(S.preventDefault(),S.stopPropagation(),q.current=ge.instances,E(ge.instances),h(ge.nodes),b(ge.edges),we(`Pasted ${ge.pastedNodeIds.length} node${ge.pastedNodeIds.length>1?"s":""}`));return}if(IN(S)&&!S.metaKey&&!S.ctrlKey&&!S.altKey){S.preventDefault(),yd(!0);return}if(H==="g"&&!S.metaKey&&!S.ctrlKey&&!S.altKey){S.preventDefault(),Rk();return}if(S.key==="a"||S.key==="A"){if(S.metaKey||S.ctrlKey){S.preventDefault(),at?z(j.current.nodeIds):(h(le=>le.map(ge=>({...ge,selected:!0}))),b(le=>le.map(ge=>({...ge,selected:!1}))));return}if(S.altKey)return;if(at){S.preventDefault(),bn(!0);return}if(!ie){S.preventDefault(),we("Readonly workspace");return}S.preventDefault(),te(!0);return}if((S.key==="v"||S.key==="V")&&!S.metaKey&&!S.ctrlKey&&!S.altKey){S.preventDefault(),Zb("select");return}if((S.key==="h"||S.key==="H")&&!S.metaKey&&!S.ctrlKey&&!S.altKey){S.preventDefault(),Zb("pan");return}(S.key==="f"||S.key==="F")&&!S.metaKey&&!S.ctrlKey&&!S.altKey&&(S.preventDefault(),Tk())};return window.addEventListener("keydown",v,!0),()=>window.removeEventListener("keydown",v,!0)},[Rk,at,Qh,Tk,uk,Ft,Xh,b,h,ck,ie]);const WT=m.useCallback(v=>{Sn(S=>{const I=new Set(S);return I.has(v)?I.delete(v):I.add(v),I})},[]),VT=m.useCallback((v,S)=>{v.dataTransfer.effectAllowed="copy",v.dataTransfer.setData("application/x-agentflow-workspace-file",JSON.stringify({path:S.path,name:S.name,type:S.type})),v.dataTransfer.setData("text/plain",S.path)},[]),KT=m.useCallback((v,S)=>{v.dataTransfer.effectAllowed="move",v.dataTransfer.setData("application/agentflow-node",S.id),v.dataTransfer.setData("text/plain",S.id)},[]),Id=m.useCallback(async(v,S)=>{const I=String((v==null?void 0:v.name)||(v==null?void 0:v.path)||"").toLowerCase(),H=I.split(".").pop(),U=["jsx","tsx","js"].includes(H)?"display_react_app":H==="html"?"display_html":H==="csv"||H==="tsv"||H==="json"&&/\b(table|data|rows|report)\b/i.test(I)?"display_table":["png","jpg","jpeg","gif","webp","svg"].includes(H)?"display_image":"display_markdown",Y=X.find(ge=>ge.id===U);if(!Y){we("展示节点不可用");return}const G=U==="display_image";let J=String(v.path||"");if(!G){const ge=_s(i);ge.set("path",v.path);const Me=await fetch(`/api/workspace/file?${ge.toString()}`),ut=await Me.json();if(!Me.ok)throw new Error(ut.error||"读取文件失败");J=String(ut.content||"")}const Q=U==="display_image"?"src":"content",ce=Hc(Y.inputs).map(ge=>ge.name===Q?{...ge,default:J,value:J}:ge),le=Hc(Y.outputs).map(ge=>ge.name===Q?{...ge,default:J,value:J}:ge);gi(Y,{label:v.name||"Display",body:J,inputs:ce,outputs:le,position:S}),we(`已创建展示:${v.path}`)},[gi,i,X]),UT=m.useCallback(v=>{if(!ie){we("Readonly workspace");return}Id(v,La()).catch(S=>we(String(S.message||S)))},[Id,La,ie]),qT=m.useCallback(v=>{if(!ie){v.preventDefault(),we("Readonly workspace");return}const S=v.dataTransfer.getData("application/x-agentflow-workspace-file");if(S){v.preventDefault();let G;try{G=JSON.parse(S)}catch{return}if(!(G!=null&&G.path))return;const J=r.screenToFlowPosition({x:v.clientX,y:v.clientY});Id(G,J).catch(Q=>we(String(Q.message||Q)));return}const I=v.dataTransfer.getData("application/agentflow-snippet");if(I){const G=ne.find(Q=>`${Q.id}@${Q.version}`===I);if(!G)return;v.preventDefault();const J=r.screenToFlowPosition({x:v.clientX,y:v.clientY});uc(G,J);return}const H=v.dataTransfer.getData("application/agentflow-node");if(!H)return;const U=X.find(G=>G.id===H);if(!U)return;v.preventDefault();const Y=r.screenToFlowPosition({x:v.clientX,y:v.clientY});gi(U,{position:Y})},[Id,gi,ne,uc,X,r,ie]),YT=m.useCallback(v=>{if(!ie)return;const S=Array.from(v.dataTransfer.types||[]);!S.includes("application/x-agentflow-workspace-file")&&!S.includes("application/agentflow-node")&&!S.includes("application/agentflow-snippet")||(v.preventDefault(),v.dataTransfer.dropEffect=S.includes("application/agentflow-node")||S.includes("application/agentflow-snippet")?"move":"copy")},[ie]),GT=m.useCallback(async(v="")=>{if(!ie){we("Readonly workspace");return}const S=window.prompt("新文件名",v?`${v}/notes.md`:"notes.md");if(!S)return;const I=v&&!S.includes("/")?`${v}/${S}`:S;try{const H=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:I,content:""})}),U=await H.json();if(!H.ok)throw new Error(U.error||"创建文件失败");await _n(),Sn(Y=>{const G=new Set(Y);for(const J of Sf(U.path||I))G.delete(J);return G}),we(`已创建 ${U.path}`)}catch(H){we(String(H.message||H))}},[i,_n,ie]),JT=m.useCallback(async(v="")=>{if(!ie){we("Readonly workspace");return}const S=window.prompt("新文件夹名",v?`${v}/docs`:"docs");if(!S)return;const I=v&&!S.includes("/")?`${v}/${S}`:S;try{const H=await fetch("/api/workspace/folder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:I})}),U=await H.json();if(!H.ok)throw new Error(U.error||"创建文件夹失败");await _n(),Sn(Y=>{const G=new Set(Y);for(const J of Sf(U.path||I))G.delete(J);return U.path&&G.delete(U.path),G}),we(`已创建 ${U.path}`)}catch(H){we(String(H.message||H))}},[i,_n,ie]),XT=m.useCallback(async v=>{if(!ie){we("Readonly workspace");return}if(!(!(v!=null&&v.path)||!window.confirm(`删除 ${v.path}?`)))try{const S=await fetch("/api/workspace/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:v.path})}),I=await S.json();if(!S.ok)throw new Error(I.error||"删除失败");we(`已删除 ${I.path}`),await _n()}catch(S){we(String(S.message||S))}},[i,_n,ie]),QT=m.useCallback(v=>{if(!(v!=null&&v.path)||v.type==="directory")return;const S=Fu(v.path,i,{download:!0});if(!S)return;const I=document.createElement("a");I.href=S,I.download=v.name||v.path.split("/").pop()||"download",I.rel="noopener",document.body.appendChild(I),I.click(),I.remove()},[i]),Td=m.useCallback(async()=>{if(!ie){we("Readonly workspace");return}const v=Ro.trim(),S=ec,I=md.find(G=>G.id===S)||null;if(!v||Kr||(I==null?void 0:I.status)==="running")return;const H=I?Array.isArray(I.messages)?I.messages:[]:pd,U=_c(d,y,q.current);Yh(""),Ub(!0),Na(!0),ja(null);const Y={role:"user",text:v,at:Date.now()};I?yr(G=>G.map(J=>J.id===S?{...J,status:"running",messages:[...Array.isArray(J.messages)?J.messages:[],Y].slice(-180)}:J)):(Sa("workspace"),hd(G=>[...G,Y]));try{await Ft(d,y);const G=await fetch("/api/workspace/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,prompt:v,outputKind:"markdown",workspaceGraph:U,allowFlowYaml:!1,model:pi,selectedSkills:ks,selectedNodeIds:_d,messages:H})}),J=await G.json();if(!G.ok)throw new Error(J.error||"生成失败");const ce={role:"assistant",kind:"assistant",text:String(J.content||"").trim(),at:Date.now()};I?yr(le=>le.map(ge=>ge.id===S?{...ge,status:"done",messages:[...Array.isArray(ge.messages)?ge.messages:[],ce].slice(-180)}:ge)):hd(le=>[...le,ce]),await Ta(),we("AI 生成完成")}catch(G){const J=String(G.message||G),Q={role:"assistant",text:J,error:!0,at:Date.now()};I?yr(ce=>ce.map(le=>le.id===S?{...le,status:"failed",messages:[...Array.isArray(le.messages)?le.messages:[],Q].slice(-180)}:le)):hd(ce=>[...ce,Q]),we(J)}finally{Ub(!1)}},[ec,pd,pi,md,Kr,Ro,y,i,Ta,d,Ft,_d,ks,ie]),wr=md.find(v=>v.id===ec)||null,Vk=wr?Array.isArray(wr.messages)?wr.messages:[]:pd,dc=wr&&wr.status==="running"||Kr,ZT=$7(Vk,dc),Kk=L7(Vk),eR=wr?wr.status==="running"?`${wr.label} running`:wr.status==="paused"?`${wr.label} paused`:wr.status==="failed"?`${wr.label} failed`:`${wr.label} done`:Kr?"Workspace agent running":pd.length>0?"Workspace conversation":"Ready",tR=String(i.flowId||"").trim()||"Workspace",Bi=(Ce==null?void 0:Ce.mode)==="single-node",Uk=Bi&&cc.find(v=>{var S;return v.id===Ce.sourceNodeId||((S=Ce.nodeIds)==null?void 0:S.includes(v.id))})||null,nR=Bi&&Uk?[Uk]:cc;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} · ${ee}`:ee||"PROJECT",children:[o.jsx("span",{className:"af-pipeline-brand-name",children:tR}),o.jsxs("span",{className:"af-pipeline-brand-ver",children:["V",wK,"-STABLE"]})]}),o.jsxs("div",{className:"af-view-switch","aria-label":"视图切换",children:[o.jsx("button",{type:"button",className:a==="workspace"?"af-view-switch__active":"",onClick:()=>Mk("workspace"),children:"Workspace"}),o.jsx("button",{type:"button",className:a==="display"?"af-view-switch__active":"",onClick:()=>Mk("display"),children:"Display"})]})]}),o.jsxs("div",{className:"af-pipeline-top-right af-workspace-actions",children:[o.jsx("span",{className:"af-workspace-save-status",children:iT}),at?o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:"af-workspace-display-share-btn",disabled:qe||!(xe!=null&&xe.absoluteUrl)&&N.nodeIds.length===0,onClick:()=>{Kn(""),Wn(!0)},title:xe!=null&&xe.absoluteUrl?"查看展示链接":N.nodeIds.length===0?"先添加展示节点":"生成展示链接",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:qe?"hourglass_empty":"ios_share"}),qe?"生成中":xe!=null&&xe.absoluteUrl?"展示链接":"生成链接"]}),o.jsxs("button",{type:"button",className:"af-workspace-display-share-btn",disabled:Ra.length===0,onClick:()=>bn(!0),title:Ra.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",onClick:_T,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:!lk,onClick:()=>u(!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:!lk,onClick:()=>f(!0),"aria-label":e("flow:topbar.deletePipeline"),title:e("flow:topbar.deletePipeline"),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_forever"})}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>yd(!0),"aria-label":"快捷键",title:"快捷键 (?)",children:o.jsx("span",{className:"material-symbols-outlined",children:"help"})}),o.jsx("button",{type:"button",className:"af-composer-topbar-btn"+(Gh?" af-composer-topbar-btn--active":"")+(Kr?" af-composer-topbar-btn--running":""),disabled:at,onClick:()=>{ja(null),Na(v=>!v)},children:"AI"}),o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!ie,onClick:()=>Ft().catch(v=>we(String(v.message||v))),children:"Save"})]})]}),Ht?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:Ht}),o.jsx("button",{type:"button",onClick:()=>Xe(""),"aria-label":"关闭发布提示",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}):null,o.jsxs("div",{className:"af-workspace-body"+(!at&&(Gh||Ie)?" af-workspace-body--drawer":"")+(!at&&nc?" af-workspace-body--sidebar-collapsed":"")+(at?" af-workspace-body--display-mode":""),children:[!at&&nc?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:()=>te(!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:()=>gd(!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:()=>gd(!1),"aria-label":"展开侧边栏",title:(xr==null?void 0:xr.username)||(xr==null?void 0:xr.userId)||"展开侧边栏",children:vT})]})}):null,at?null:o.jsxs("aside",{ref:Je,className:"af-workspace-sidebar"+(Io?" af-workspace-sidebar--resizing":""),"aria-hidden":nc,style:{"--af-work-files-pane-height":`${Math.round(Fn)}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:()=>gd(!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:!ie,onClick:()=>GT(mi),"aria-label":"新增文件",title:mi?`在 ${mi} 新增文件`:"新增文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"note_add"})}),o.jsx("button",{type:"button",className:"af-icon-btn",disabled:!ie,onClick:()=>JT(mi),"aria-label":"新增文件夹",title:mi?`在 ${mi} 新增文件夹`:"新增文件夹",children:o.jsx("span",{className:"material-symbols-outlined",children:"create_new_folder"})}),o.jsx("button",{type:"button",className:"af-icon-btn",disabled:!ie||Re,onClick:()=>vk(mi),"aria-label":"上传文件",title:mi?`上传到 ${mi}`:"上传文件",children:o.jsx("span",{className:"material-symbols-outlined",children:Re?"hourglass_top":"upload_file"})}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>void _n(),"aria-label":"刷新文件",title:"刷新文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"refresh"})}),o.jsx("input",{ref:Jt,type:"file",multiple:!0,className:"af-visually-hidden",onChange:dT})]})]}),o.jsx("input",{className:"af-workspace-search",value:Gt,onChange:v=>vn(v.target.value),placeholder:"搜索文件..."}),o.jsx("div",{className:"af-workspace-files-scroll",onClick:bT,children:o.jsx(ZP,{items:wT,onOpen:UT,selectedPath:Ar,collapsedDirs:xs,onToggleDir:WT,onSelect:v=>os(v.path||""),onFileDragStart:VT,onDelete:XT,onDownload:QT})})]}),o.jsx("button",{type:"button",className:"af-workspace-sidebar-resizer",onPointerDown:ZI,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:re==="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:ae,onChange:v=>me(v.target.value),placeholder:re==="flows"?"搜索流程片段...":"搜索节点...","aria-label":re==="flows"?"搜索流程片段":"搜索节点"})]}),o.jsxs("div",{className:"af-palette-tabs",role:"tablist","aria-label":"Palette 类型",children:[o.jsxs("button",{type:"button",role:"tab","aria-selected":re==="nodes",className:"af-palette-tab"+(re==="nodes"?" af-palette-tab--active":""),onClick:()=>de("nodes"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"category"}),"节点"]}),o.jsxs("button",{type:"button",role:"tab","aria-selected":re==="flows",className:"af-palette-tab"+(re==="flows"?" af-palette-tab--active":""),onClick:()=>de("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:re==="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:NT,disabled:zn.length<2,title:zn.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:["已选 ",zn.length," 节点 / ",Ed.length," 连线"]})]})}),$e?o.jsx("p",{className:"af-err af-palette-list-err",children:$e}):null,fe?o.jsx("p",{className:"af-palette-empty",children:"正在加载流程片段..."}):Fk.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:Fk.map(v=>{const S=`${v.id}@${v.version}`,I=v.displayName||v.name||v.id,H=v.description||`${v.nodeCount||0} 个节点,${v.edgeCount||0} 条连线`;return o.jsxs("button",{type:"button",className:"af-palette-card af-flow-snippet-card",draggable:!0,onDragStart:U=>{U.dataTransfer.effectAllowed="move",U.dataTransfer.setData("application/agentflow-snippet",S),U.dataTransfer.setData("text/plain",S)},onClick:()=>uc(v),title:H,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:I}),o.jsxs("span",{className:"af-palette-card-id",children:[v.id,"@",v.version]})]})]}),H?o.jsx("span",{className:"af-palette-card-desc",children:H}):null,o.jsxs("span",{className:"af-flow-snippet-meta","aria-hidden":!0,children:[o.jsxs("span",{children:[v.nodeCount||0," nodes"]}),o.jsxs("span",{children:[v.edgeCount||0," edges"]})]})]},S)})})]}):o.jsx("p",{className:"af-palette-empty",children:ae.trim()?"没有匹配的流程片段":"暂无流程片段。选择多个节点后发布。"})]}):o.jsxs(o.Fragment,{children:[Va.map(v=>{var S;return(S=om[v])!=null&&S.length?o.jsxs("section",{className:`af-palette-section af-flow-palette-section--${v}`,children:[o.jsx("h3",{className:"af-palette-cat",children:v}),o.jsx("div",{className:"af-palette-cards",children:om[v].map(I=>{const H=VN(I.inputs,"input"),U=VN(I.outputs,"output"),Y=wx(I),G=Fc(I);return o.jsxs("button",{type:"button",className:"af-palette-card",draggable:!0,onDragStart:J=>KT(J,I),onClick:()=>gi(I),title:Y||I.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:BN(v)})}),o.jsxs("span",{className:"af-palette-card-main",children:[o.jsx("span",{className:"af-palette-card-label",children:G}),G!==I.id?o.jsx("span",{className:"af-palette-card-id",children:I.id}):null]})]}),Y?o.jsx("span",{className:"af-palette-card-desc",children:Y}):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:[H.list.length," IN"]}),o.jsxs("span",{className:"af-palette-card-port-list",children:[H.shown.map((J,Q)=>o.jsxs("span",{className:"af-palette-card-port",title:WN("input",J,Q),children:[o.jsx("span",{className:"af-palette-card-port-dot",style:{background:yn(J==null?void 0:J.type)}}),o.jsx("span",{className:"af-palette-card-port-name",children:bf(J,Q)})]},`in-${Q}`)),H.hidden>0?o.jsxs("span",{className:"af-palette-card-port-more",children:["+",H.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:[U.list.length," OUT"]}),o.jsxs("span",{className:"af-palette-card-port-list",children:[U.shown.map((J,Q)=>o.jsxs("span",{className:"af-palette-card-port",title:WN("output",J,Q),children:[o.jsx("span",{className:"af-palette-card-port-name",children:bf(J,Q)}),o.jsx("span",{className:"af-palette-card-port-dot",style:{background:yn(J==null?void 0:J.type)}})]},`out-${Q}`)),U.hidden>0?o.jsxs("span",{className:"af-palette-card-port-more",children:["+",U.hidden]}):null]})]})]})]},I.id)})})]},v):null}),X.length>0&&ae.trim()&&Va.every(v=>{var S;return!((S=om[v])!=null&&S.length)})?o.jsx("p",{className:"af-palette-empty",children:"没有匹配的节点"}):null]})})]})]}),o.jsxs("main",{ref:x,className:"af-workspace-canvas",tabIndex:-1,onPointerDownCapture:BT,children:[o.jsx(CA,{className:"af-flow-canvas af-workspace-flow"+(Zh==="pan"?" af-flow-canvas--tool-pan":" af-flow-canvas--tool-select")+(at?" af-workspace-flow--display-mode":""),nodes:mT,edges:gT,nodeTypes:E7,onNodesChange:MT,onEdgesChange:$T,onConnect:at?void 0:OT,onConnectStart:at?void 0:DT,onConnectEnd:at?void 0:FT,isValidConnection:at?void 0:LT,onNodeClick:(v,S)=>{var I;if(at){z([bg(S.id)]);return}if((I=S==null?void 0:S.data)!=null&&I.isWorkspaceGroup){Ve("");return}if(v.detail>=3){Na(!1),h(H=>H.map(U=>({...U,selected:U.id===S.id}))),b(H=>H.map(U=>({...U,selected:!1}))),Ve(S.id);return}Dn&&Ve(S.id)},onNodeDoubleClick:v=>{v.preventDefault()},onPaneClick:()=>{at?z([]):Ve("")},onDrop:at?void 0:qT,onDragOver:at?void 0:YT,nodesDraggable:at?!0:ie,nodesConnectable:at?!1:ie,edgesReconnectable:at?!1:ie,deleteKeyCode:at?null:ie?["Backspace","Delete"]:null,selectionOnDrag:Zh==="select",panOnDrag:Zh==="pan"?!0:[1,2],panActivationKeyCode:"Space",proOptions:{hideAttribution:!0},fitView:!1,minZoom:.1,maxZoom:4,children:o.jsx(EA,{color:"rgba(255,255,255,0.12)",gap:22,size:1})}),!at&&O?(()=>{var J;const v=String(O.query||"").trim().toLowerCase(),S=O.mode==="create"?"create":"existing",I=Array.isArray(O.candidates)?O.candidates:[],H=Array.isArray(O.existingCandidates)?O.existingCandidates:[],U=v?I.filter(Q=>{var ce,le,ge;return[(ce=Q.def)==null?void 0:ce.id,Q.displayLabel,Q.description,(le=Q.slot)==null?void 0:le.name,(ge=Q.slot)==null?void 0:ge.type].filter(Boolean).some(Me=>String(Me).toLowerCase().includes(v))}):I,Y=v?H.filter(Q=>{var ce,le;return[Q.nodeId,Q.nodeLabel,Q.definitionId,(ce=Q.slot)==null?void 0:ce.name,(le=Q.slot)==null?void 0:le.type].filter(Boolean).some(ge=>String(ge).toLowerCase().includes(v))}):H,G=O.draft.handleType==="source"?"IN":"OUT";return o.jsxs("div",{className:"af-connect-node-menu",style:{left:O.left,top:O.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:yn((J=O.draft.slot)==null?void 0:J.type)},"aria-hidden":!0}),o.jsxs("span",{children:["匹配 ",O.draft.slotType," 节点"]})]}),o.jsx("button",{type:"button",className:"af-connect-node-menu__close","aria-label":"关闭",onClick:()=>P(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:H.length===0,onClick:()=>P(Q=>Q&&{...Q,mode:"existing",query:""}),children:["连接已有 ",o.jsx("span",{children:H.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:I.length===0,onClick:()=>P(Q=>Q&&{...Q,mode:"create",query:""}),children:["新建节点 ",o.jsx("span",{children:I.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:O.query,onChange:Q=>P(ce=>ce&&{...ce,query:Q.target.value}),placeholder:"搜索节点",autoFocus:!0})]}),o.jsxs("div",{className:"af-connect-node-menu__list",children:[S==="create"?U.map(Q=>{var ge,Me;const ce=Q.displayLabel||((ge=Q.def)==null?void 0:ge.id),le=bf(Q.slot,Q.slotIndex);return o.jsxs("button",{type:"button",className:"af-connect-node-menu__item",onClick:()=>zT(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:ce}),ce!==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:G}),o.jsx("span",{className:"af-connect-node-menu__port-dot",style:{background:yn((Me=Q.slot)==null?void 0:Me.type)},"aria-hidden":!0}),o.jsx("span",{className:"af-connect-node-menu__port-name",children:le})]})]},`${Q.def.id}-${Q.slotIndex}`)}):Y.map(Q=>{var ge;const ce=Q.nodeLabel||Q.nodeId,le=bf(Q.slot,Q.slotIndex);return o.jsxs("button",{type:"button",className:"af-connect-node-menu__item",onClick:()=>HT(Q),title:`${Q.definitionId||Q.nodeId} · ${le}`,children:[o.jsxs("span",{className:"af-connect-node-menu__item-main",children:[o.jsx("span",{className:"af-connect-node-menu__item-label",children:ce}),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:G}),o.jsx("span",{className:"af-connect-node-menu__port-dot",style:{background:yn((ge=Q.slot)==null?void 0:ge.type)},"aria-hidden":!0}),o.jsx("span",{className:"af-connect-node-menu__port-name",children:le}),Q.occupied?o.jsx("span",{className:"af-connect-node-menu__port-badge",children:"替换"}):null]})]},`${Q.nodeId}-${Q.handleId}`)}),(S==="create"?U.length:Y.length)===0?o.jsx("div",{className:"af-connect-node-menu__empty",children:"没有匹配结果"}):null]})]})})():null,!at&&!rT?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:()=>Jh(!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:zn.length===0?o.jsx("span",{className:"af-composer-selected-empty",children:"选择画布节点后,可作为本次 Workspace AI 的上下文。"}):zn.map(v=>{var U,Y;const S=String(((U=v.data)==null?void 0:U.label)??v.id),I=(Y=v.data)!=null&&Y.definitionId?String(v.data.definitionId):"",H=I&&I!==S?`${S} · ${v.id} · ${I}`:`${S} · ${v.id}`;return o.jsxs("div",{className:"af-composer-node-chip",title:H,children:[o.jsx("span",{className:"af-composer-node-chip-kind",children:I||"node"}),o.jsx("span",{className:"af-composer-node-chip-label",children:S}),o.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>RT(v.id),"aria-label":`取消选择 ${v.id}`,children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},v.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:Ro,rows:2,onChange:v=>Yh(v.target.value),onKeyDown:v=>{(v.metaKey||v.ctrlKey)&&v.key==="Enter"&&(v.preventDefault(),Td())},placeholder:"描述你想在 workspace 中生成、分析或展示的内容",autoComplete:"off",spellCheck:!1,disabled:!ie})}),o.jsxs("div",{className:"af-composer-toolbar",children:[o.jsxs("div",{className:"af-composer-skills-field",children:[o.jsxs("button",{ref:qh,type:"button",className:"af-composer-skills-button"+(ks.length>0?" af-composer-skills-button--active":""),disabled:Kr||!ie,"aria-haspopup":"listbox","aria-expanded":fd,onClick:()=>Uh(v=>!v),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"extension"}),o.jsx("span",{children:ks.length>0?`Skills ${ks.length}`:"Skills"})]}),fd&&!Kr?vr.createPortal(o.jsx("div",{ref:Vb,className:"af-composer-skills-menu",role:"listbox","aria-label":"Skills",style:tT,children:bs.length===0?o.jsx("div",{className:"af-composer-skills-empty",children:"No skills found"}):o.jsxs(o.Fragment,{children:[Ma.groups.map(v=>{const S=la(v,bs),I=G$(v,am,bs),H=eT.has(v.id);return o.jsxs("div",{className:"af-composer-skill-group af-composer-skill-group--framed"+(H?" 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:I==="all",disabled:S.length===0,onChange:U=>{const Y=U.target.checked;Zl(G=>Y?q$(G,S):Y$(G,S))}}),o.jsxs("span",{className:"af-composer-skill-group-title-main",children:[o.jsx("span",{children:v.name}),v.builtin?o.jsx("em",{children:"built-in"}):null,I==="partial"?o.jsx("em",{children:"partial"}):null]})]}),o.jsxs("button",{type:"button",className:"af-composer-skill-group-toggle","aria-label":H?`展开 ${v.name}`:`收起 ${v.name}`,onClick:()=>{Wb(U=>{const Y=new Set(U);return Y.has(v.id)?Y.delete(v.id):Y.add(v.id),Y})},children:[o.jsx("span",{children:v.skills.length}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:H?"expand_more":"expand_less"})]})]}),H?null:o.jsx("div",{className:"af-composer-skill-group-items",children:v.skills.map(U=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:am.has(U.key),onChange:Y=>{const G=Y.target.checked;Zl(J=>G?J.includes(U.key)?J:[...J,U.key]:J.filter(Q=>Q!==U.key))}}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:U.name}),U.description?o.jsx("span",{className:"af-composer-skill-option-desc",children:U.description}):null]})]},`${v.id}:${U.key}`))})]},v.id)}),Ma.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:Ma.ungrouped.length})]}),Ma.ungrouped.map(v=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:am.has(v.key),onChange:S=>{const I=S.target.checked;Zl(H=>I?H.includes(v.key)?H:[...H,v.key]:H.filter(U=>U!==v.key))}}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:v.name}),v.description?o.jsx("span",{className:"af-composer-skill-option-desc",children:v.description}):null]})]},`ungrouped:${v.key}`))]}):null]})}),document.body):null]}),o.jsx("label",{className:"af-composer-model-field",children:o.jsxs("select",{className:"af-composer-model-select",value:pi,onChange:v=>GI(v.target.value),"aria-label":"模型",children:[o.jsx("option",{value:"",children:"默认模型"}),kT.map(v=>o.jsx("option",{value:v.value,children:v.label},v.value))]})}),o.jsx("button",{type:"button",className:"af-composer-send"+(Ro.trim()&&!Kr?" af-composer-send--active":"")+(Kr?" af-composer-send--stop":""),disabled:Kr||!Ro.trim()||!ie,"aria-label":Kr?"Running":"Send",onClick:()=>void Td(),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:Kr?"sync":"arrow_upward"})})]})]})]})}):at?null:o.jsx("button",{type:"button",className:"af-workspace-composer-fab",onClick:()=>Jh(!1),"aria-label":"展开 AI 输入框",title:"展开 AI 输入框",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"auto_awesome"})})]}),!at&&Gh?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:()=>Na(!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"+(ec==="workspace"?" af-composer-session-tab--active":""),onClick:()=>Sa("workspace"),children:o.jsx("span",{className:"af-composer-session-label",children:"Workspace"})}),md.map(v=>o.jsx("button",{type:"button",className:"af-composer-session-tab"+(ec===v.id?" af-composer-session-tab--active":"")+(v.status==="running"?" af-composer-session-tab--running":""),onClick:()=>Sa(v.id),title:v.runNodeId||v.label,children:o.jsx("span",{className:"af-composer-session-label",children:v.label})},v.id))]}),o.jsx("div",{className:"af-composer-sidebar-status"+(dc?" af-composer-sidebar-status--running":""),role:"status","aria-live":"polite",children:eR}),o.jsxs("div",{className:"af-composer-sidebar-thread",children:[o.jsx(ej,{messages:ZT,running:dc,showRunningIndicator:!wr}),Kk.length>0?o.jsxs("details",{className:"af-composer-sidebar-log-details",children:[o.jsx("summary",{children:"执行日志"}),o.jsx(ej,{messages:Kk,running:!1,showRunningIndicator:!1})]}):null]}),o.jsxs("div",{className:"af-composer-sidebar-input",children:[o.jsx("textarea",{className:"af-composer-sidebar-textarea",value:Ro,rows:3,onChange:v=>Yh(v.target.value),onKeyDown:v=>{(v.metaKey||v.ctrlKey)&&v.key==="Enter"&&(v.preventDefault(),Td())},placeholder:wr?"继续追问、总结或要求调整这次结果":"继续描述你想让 AI 在 workspace 中做什么",disabled:!ie||dc}),o.jsx("button",{type:"button",className:"af-composer-sidebar-send",disabled:!ie||dc||!Ro.trim(),onClick:()=>void Td(),"aria-label":"发送 AI 对话",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_upward"})})]})]})}):!at&&Ie&&Ut?o.jsx("aside",{className:"af-pipeline-drawer af-workspace-node-drawer","aria-label":"Workspace Node Properties",children:o.jsx(nK,{draft:Ie,setDraft:Wt,definitionId:String(((qk=Ut.data)==null?void 0:qk.definitionId)||Ut.id),systemPromptReadonly:String(((Yk=Ut.data)==null?void 0:Yk.description)||""),modelLists:To,disabled:!ie,onIdBlur:()=>im(!0),onClose:()=>Ve(""),onPublishToMarketplace:cT,error:or,ioSlots:{inputs:Array.isArray(Ie==null?void 0:Ie.inputs)?Ie.inputs:[],outputs:Array.isArray(Ie==null?void 0:Ie.outputs)?Ie.outputs:[]}})}):null,!at&&tc?vr.createPortal(o.jsx("div",{className:"af-workspace-run-logs-overlay",role:"presentation",onMouseDown:()=>ja(null),children:o.jsx("aside",{className:"af-workspace-run-logs-drawer","aria-label":"Workspace Run Logs",onMouseDown:v=>v.stopPropagation(),children:o.jsx(HV,{flowParams:i,scheduleNodeId:tc.scheduleNodeId,runNodeId:tc.runNodeId,lastRunId:tc.lastRunId,label:tc.label,onClose:()=>ja(null)})})}),document.body):null,o.jsx(OV,{open:Xh,onClose:()=>yd(!1)}),o.jsx(FV,{open:Qh,onClose:()=>Qb(!1),onJump:xT,nodes:yT}),o.jsx(rK,{open:c,onClose:()=>u(!1),flowId:i.flowId||"",flowSource:xd,onArchived:()=>{u(!1),n("/projects?tab=archived")}}),o.jsx(sK,{open:p&&!!i.flowId,onClose:()=>f(!1),flowId:i.flowId||"",flowSource:xd,flowArchived:!!i.archived,onDeleted:async()=>{f(!1),n("/projects")}}),Pe?vr.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:()=>Ue(!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.name,onChange:v=>{const S=v.target.value;Te(I=>({...I,name:S,id:I.id?I.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:pt.id,onChange:v=>Te(S=>({...S,id:v.target.value})),placeholder:"content-cleanup-snippet"})]}),o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"说明"}),o.jsx("textarea",{value:pt.description,onChange:v=>Te(S=>({...S,description:v.target.value})),placeholder:"这段流程适合什么 workspace 场景、需要接哪些上下游。",rows:4})]}),o.jsxs("div",{className:"af-flow-snippet-summary",children:["将发布 ",zn.length," 个节点和 ",Ed.length," 条内部连线。"]}),jt?o.jsx("div",{className:"af-flow-snippet-error",children:jt}):null]}),o.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>Ue(!1),children:"取消"}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:et||!pt.name.trim(),onClick:()=>void jT(),children:et?"发布中...":"发布"})]})]})}),document.body):null,Ik?o.jsx(m7,{node:Ik,onClose:()=>gr("")}):null,ke?vr.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":Bi?"新建分享":"发布展示页",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"}),Bi?"新建分享":"发布展示页"]}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>Se(!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:Ce.title,onChange:v=>nt(S=>({...S,title:v.target.value})),placeholder:"展示页标题",autoFocus:!0})]}),Bi?null:o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"布局"}),o.jsxs("select",{className:"af-display-share-select",value:Ce.layout,onChange:v=>nt(S=>({...S,layout:v.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:qN(Ce),onChange:v=>{const S=v.target.value;nt(I=>({...I,permanent:S==="permanent",expiresInDays:S==="permanent"?I.expiresInDays||30:Number(S)}))},children:kg.map(v=>o.jsx("option",{value:v.value,children:v.label},v.value))})]}),o.jsxs("div",{className:"af-display-share-node-list",role:"group","aria-label":Bi?"分享内容":"选择展示节点",children:[Bi?o.jsx("span",{className:"af-display-share-node-list__label",children:"分享内容"}):null,nR.map(v=>{var I;const S=Array.isArray(Ce.nodeIds)&&Ce.nodeIds.includes(v.id);return o.jsxs("label",{className:"af-display-share-node-row",children:[o.jsx("input",{type:"checkbox",checked:S,disabled:Bi,onChange:()=>CT(v.id)}),o.jsxs("span",{className:"af-display-share-node-row__main",children:[o.jsx("strong",{children:((I=v.data)==null?void 0:I.label)||v.id}),o.jsxs("small",{children:[mn(v.data)," · ",v.id]})]})]},v.id)})]}),xe!=null&&xe.absoluteUrl?o.jsxs("div",{className:"af-display-share-result",children:[o.jsx("input",{type:"text",readOnly:!0,value:xe.absoluteUrl,onFocus:v=>v.target.select()}),o.jsx("button",{type:"button",onClick:()=>window.open(xe.absoluteUrl,"_blank","noopener,noreferrer"),children:"打开"}),o.jsx("button",{type:"button",onClick:()=>void Hk(),children:Vn==="copied"?"已复制":Vn==="failed"?"复制失败":"复制"})]}):null,kt?o.jsx("div",{className:"af-flow-snippet-error",children:kt}):null]}),o.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>Se(!1),children:"取消"}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:qe||!Array.isArray(Ce.nodeIds)||Ce.nodeIds.length===0,onClick:()=>void ET(),children:qe?"生成中...":"生成链接"})]})]})}),document.body):null,_r?vr.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:()=>{Kn(""),Wn(!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:[xe!=null&&xe.absoluteUrl?o.jsxs("div",{className:"af-display-link-modal__url",children:[o.jsx("input",{type:"text",readOnly:!0,value:xe.absoluteUrl,onFocus:v=>v.target.select(),autoFocus:!0}),o.jsxs("button",{type:"button",onClick:()=>window.open(xe.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 Hk(),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:Vn==="copied"?"check":"content_copy"}),Vn==="copied"?"已复制":Vn==="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:qN(Ce),onChange:v=>{const S=v.target.value;nt(I=>({...I,permanent:S==="permanent",expiresInDays:S==="permanent"?I.expiresInDays||30:Number(S)}))},children:kg.map(v=>o.jsx("option",{value:v.value,children:v.label},v.value))})]}),kt?o.jsx("div",{className:"af-flow-snippet-error",children:kt}):null]}),o.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>{Kn(""),Wn(!1)},children:"关闭"}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:qe||N.nodeIds.length===0,onClick:()=>void AT(),children:qe?"生成中...":xe!=null&&xe.absoluteUrl?"更新链接":"生成链接"})]})]})}),document.body):null,hn?vr.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:()=>Un(!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:Pn.length?`${Pn.length} 个分享`:"暂无分享"}),o.jsxs("button",{type:"button",onClick:()=>void Ss(),disabled:In,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"refresh"}),"刷新"]})]}),ir?o.jsx("div",{className:"af-flow-snippet-error",children:ir}):null,In?o.jsx("div",{className:"af-display-link-modal__empty",children:"Loading..."}):null,!In&&Pn.length===0?o.jsx("div",{className:"af-display-link-modal__empty",children:"还没有创建过展示分享"}):null,o.jsx("div",{className:"af-display-shares-list",children:Pn.map(v=>{const S=GN(v),I=Er===v.id,H=v.expiresAt?String(v.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:v.title||"AgentFlow Display"}),o.jsxs("span",{children:[v.flowId||"-"," · ",v.layout||"gallery"," · ",Array.isArray(v.nodeIds)?v.nodeIds.length:0," nodes"]}),o.jsx("small",{children:JK(v)})]}),o.jsx("input",{className:"af-display-share-item__url",type:"text",readOnly:!0,value:S,onFocus:U=>U.target.select()}),o.jsx("select",{className:"af-display-share-select",value:H,disabled:I,onChange:U=>void IT(v,U.target.value),"aria-label":"修改分享有效期",children:kg.map(U=>o.jsx("option",{value:U.value,children:U.label},U.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 PT(v),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:Hr===v.id?"check":"content_copy"}),Hr===v.id?"已复制":"复制"]}),o.jsxs("button",{type:"button",className:"af-display-share-item__danger",disabled:I,onClick:()=>void TT(v),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:I?"hourglass_empty":"link_off"}),"撤销"]})]})]},v.id)})})]})]})}),document.body):null,Br?vr.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:()=>bn(!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:nn,onChange:v=>er(v.target.value),placeholder:"搜索展示节点...",autoFocus:!0})]}),o.jsx("div",{className:"af-display-picker-grid",role:"group","aria-label":"选择展示节点",style:{"--af-display-picker-columns":Dk.length||1},children:Ad.length>0?Dk.map((v,S)=>o.jsx("div",{className:"af-display-picker-column",children:v.map(ST)},`display-picker-column-${S}`)):o.jsx("div",{className:"af-display-picker-empty",children:Ra.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:()=>bn(!1),children:"完成"})})]})}),document.body):null,K.nodeId?vr.createPortal(o.jsx(M7,{files:Vr,query:K.query,onQueryChange:v=>pe(S=>({...S,query:v})),onSelect:fT,onUpload:vk,onClose:nm}),document.body):null,!at&&Bt?vr.createPortal(o.jsx("div",{className:"af-workspace-quick-add-backdrop",onMouseDown:()=>te(!1),children:o.jsxs("div",{className:"af-workspace-quick-add",role:"dialog","aria-modal":"true","aria-label":"Add workspace node",onMouseDown:v=>v.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":be==="nodes",className:"af-workspace-quick-add__tab"+(be==="nodes"?" af-workspace-quick-add__tab--active":""),onClick:()=>st("nodes"),children:"节点"}),o.jsx("button",{type:"button",role:"tab","aria-selected":be==="flows",className:"af-workspace-quick-add__tab"+(be==="flows"?" af-workspace-quick-add__tab--active":""),onClick:()=>st("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:Kb,value:wt,onChange:v=>rn(v.target.value),onKeyDown:v=>{if(v.key==="Escape")v.preventDefault(),te(!1);else if(v.key==="ArrowDown"){v.preventDefault();const S=be==="flows"?lc.length:ac.length;kn(I=>Math.min(Math.max(0,S-1),I+1))}else v.key==="ArrowUp"?(v.preventDefault(),kn(S=>Math.max(0,S-1))):v.key==="Tab"?(v.preventDefault(),st(S=>S==="nodes"?"flows":"nodes")):v.key==="Enter"&&(v.preventDefault(),be==="flows"?Wk(lc[Cn]||lc[0]):Bk(ac[Cn]||ac[0]))},placeholder:be==="flows"?"搜索流程片段...":"搜索节点...","aria-label":be==="flows"?"搜索流程片段":"搜索节点"})]}),o.jsx("div",{className:"af-workspace-quick-add__list",children:be==="flows"?lc.length===0?o.jsx("div",{className:"af-workspace-quick-add__empty",children:fe?"正在加载流程片段...":$e||"没有匹配的流程片段"}):lc.map((v,S)=>{const I=v.displayName||v.name||v.id,H=v.snippet&&typeof v.snippet=="object"?v.snippet.instances:null,U=v.snippet&&typeof v.snippet=="object"?v.snippet.edges:null,Y=Number.isFinite(Number(v.nodeCount))?Number(v.nodeCount):Object.keys(H||{}).length,G=Number.isFinite(Number(v.edgeCount))?Number(v.edgeCount):Array.isArray(U)?U.length:0;return o.jsxs("button",{type:"button",className:"af-workspace-quick-add__item"+(S===Cn?" af-workspace-quick-add__item--active":""),onMouseEnter:()=>kn(S),onClick:()=>Wk(v),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:I}),o.jsxs("span",{className:"af-workspace-quick-add__meta",children:[v.id,v.version?` · v${v.version}`:""]}),o.jsx("span",{className:"af-workspace-quick-add__desc",children:v.description||`${Y} 节点 / ${G} 连线`})]}),o.jsx("span",{className:"af-workspace-quick-add__cat",children:"FLOW"})]},`${v.id}@${v.version}`)}):ac.length===0?o.jsx("div",{className:"af-workspace-quick-add__empty",children:"没有匹配的节点"}):ac.map((v,S)=>{const I=Dc(v),H=Fc(v),U=wx(v);return o.jsxs("button",{type:"button",className:"af-workspace-quick-add__item"+(S===Cn?" af-workspace-quick-add__item--active":""),onMouseEnter:()=>kn(S),onClick:()=>Bk(v),children:[o.jsx("span",{className:"af-workspace-quick-add__icon material-symbols-outlined","aria-hidden":!0,children:BN(I)}),o.jsxs("span",{className:"af-workspace-quick-add__main",children:[o.jsx("span",{className:"af-workspace-quick-add__label",children:H}),o.jsx("span",{className:"af-workspace-quick-add__meta",children:v.id}),U?o.jsx("span",{className:"af-workspace-quick-add__desc",children:U}):null]}),o.jsx("span",{className:"af-workspace-quick-add__cat",children:I})]},v.id)})})]})}),document.body):null]})]})}function X7(){return o.jsx(Uw,{children:o.jsx(J7,{})})}function Q7(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 Z7(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 eU(e){let t=String(e||"").replace(/\r\n/g,`
|
|
254
|
-
`).trim();return t.includes(`
|
|
255
|
-
`)||(t=t.replace(/\s+(resultFile|result|outParams|outParams\.[A-Za-z_][A-Za-z0-9_-]*)\s*:/g,`
|
|
256
|
-
$1:`).replace(/(^|\n)outParams:\s+([A-Za-z_][A-Za-z0-9_-]*\s*:)/g,`$1outParams:
|
|
257
|
-
$2`)),t}function sI(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=eU(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 p=String(c[1]||"").trim();return p==="|"||p===">"?a.slice((c.index||0)+c[0].length).split(`
|
|
258
|
-
`).filter(d=>/^\s+/.test(d)||!d.trim()).map(d=>d.replace(/^\s{2}/,"")).join(`
|
|
259
|
-
`).replace(/\s+$/g,""):p.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 bb(e){let t=sI(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 tU(e){const t=bb(e);return t.trim()?/<[^>]*$/g.test(t)?"HTML 内容末尾存在未闭合标签,可能是生成或保存时被截断。":/^(?:<!doctype\b|<html\b)/i.test(t)&&!/<\/html\s*>/i.test(t)?"完整 HTML 文档缺少 </html> 结束标签,可能是生成或保存时被截断。":"":""}function nU(e){const t=bb(e);if(!t.trim())return"";const n=`<base target="_blank"><script data-agentflow-display-link-guard="1">
|
|
260
|
-
(() => {
|
|
261
|
-
document.addEventListener("click", (event) => {
|
|
262
|
-
const link = event.target && event.target.closest ? event.target.closest("a[href]") : null;
|
|
263
|
-
if (!link) return;
|
|
264
|
-
const rawHref = String(link.getAttribute("href") || "").trim();
|
|
265
|
-
if (!rawHref || rawHref.startsWith("#")) return;
|
|
266
|
-
if (/^javascript:/i.test(rawHref)) {
|
|
267
|
-
event.preventDefault();
|
|
268
|
-
return;
|
|
269
|
-
}
|
|
270
|
-
event.preventDefault();
|
|
271
|
-
window.open(link.href, "_blank", "noopener,noreferrer");
|
|
272
|
-
}, true);
|
|
273
|
-
})();
|
|
274
|
-
<\/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 iI(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 rU(e,t,n={}){const r=String(e||"").trim();return r?iI(r,t,n):""}function sU({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 p=n.current;if(!p)return;const f=Math.max(1,p.scrollHeight),d=Math.max(1,p.clientHeight),h=f>d+1,y=h?Math.max(12,d/f*100):100,b=Math.max(0,100-y),k=h?Math.min(b,p.scrollTop/Math.max(1,f-d)*b):0;i({visible:h,top:k,height:y})},[]);m.useEffect(()=>{const p=requestAnimationFrame(a),f=n.current;if(!f||typeof ResizeObserver>"u")return()=>cancelAnimationFrame(p);const d=new ResizeObserver(a);d.observe(f);for(const h of Array.from(f.children))d.observe(h);return()=>{cancelAnimationFrame(p),d.disconnect()}},[t,a]);const l=m.useCallback(p=>{const f=n.current;if(!f)return;const d=Math.max(0,f.scrollHeight-f.clientHeight);f.scrollTop=Math.min(1,Math.max(0,p))*d,a()},[a]),c=m.useCallback((p,f=0)=>{const d=r.current;if(!d)return 0;const h=d.getBoundingClientRect(),y=s.height/100*h.height,b=Math.max(1,h.height-y);return(p-h.top-f)/b},[s.height]),u=m.useCallback(p=>{if(!s.visible)return;p.preventDefault(),p.stopPropagation();const f=r.current;if(!f)return;const d=f.getBoundingClientRect(),h=s.top/100*d.height,y=s.height/100*d.height,k=p.clientY>=d.top+h&&p.clientY<=d.top+h+y?p.clientY-d.top-h:y/2;l(c(p.clientY,k));const g=x=>{x.preventDefault(),l(c(x.clientY,k))},w=()=>{window.removeEventListener("pointermove",g),window.removeEventListener("pointerup",w),window.removeEventListener("pointercancel",w)};window.addEventListener("pointermove",g),window.addEventListener("pointerup",w),window.addEventListener("pointercancel",w)},[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 Sx({node:e,shareId:t,style:n,bare:r=!1}){const s=Q7(e),i=e.kind==="html"?bb(s):e.kind==="react"?Oh(s):sI(s),a=e.kind==="html"?tU(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:Z7(e.kind)}),o.jsx("strong",{children:e.label||e.id}),o.jsx("em",{children:e.definitionId||e.kind||"display"})]})}),o.jsx(sU,{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:nU(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:mb(i)}):null,e.kind==="image"?o.jsx("img",{src:iI(i,t),alt:e.label||e.id,loading:"lazy"}):null,e.kind==="markdown"?o.jsx("div",{className:"af-public-display-markdown",children:o.jsx(cb,{content:i,resolveSrc:(c,u)=>rU(c,t,u)})}):null,e.kind==="chart"?o.jsx(db,{content:i}):null,e.kind==="table"?o.jsx(ub,{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 iU({data:e}){return o.jsx(Sx,{node:e==null?void 0:e.node,shareId:e==null?void 0:e.shareId})}const oU={publicDisplay:iU};function aU(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 oI(){var l,c,u,p;const{path:e}=ui(),t=m.useMemo(()=>aU(e),[e]),[n,r]=m.useState({loading:!0,error:"",share:null,nodes:[]});m.useEffect(()=>{let f=!1;async function d(){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)}`),y=await h.json().catch(()=>({}));if(!h.ok)throw new Error(y.error||"展示页不存在");f||r({loading:!1,error:"",share:y.share||null,nodes:Array.isArray(y.nodes)?y.nodes:[]})}catch(h){f||r({loading:!1,error:String((h==null?void 0:h.message)||h),share:null,nodes:[]})}}return d(),()=>{f=!0}},[t]);const s=m.useMemo(()=>(Array.isArray(n.nodes)?n.nodes:[]).map((d,h)=>{const y=d.position&&typeof d.position.x=="number"&&typeof d.position.y=="number"?d.position:{x:120+h*40,y:100+h*32},b=d.size&&typeof d.size.width=="number"&&typeof d.size.height=="number"?d.size:{width:520,height:320};return{id:d.id,type:"publicDisplay",position:y,data:{node:d,shareId:t},selectable:!1,draggable:!1,style:{width:Math.max(1,Number(b.width)||520),height:Math.max(1,Number(b.height)||320)}}}),[t,n.nodes]),i=m.useMemo(()=>{var b;const f=(b=n.share)==null?void 0:b.viewport;if(!f||typeof f!="object")return null;const d=Number(f.x),h=Number(f.y),y=Number(f.zoom);return!Number.isFinite(d)||!Number.isFinite(h)||!Number.isFinite(y)?null:{x:d,y:h,zoom:Math.min(Math.max(y,.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(d=>o.jsx(Sx,{node:d,shareId:t,bare:!0},d.id))})});const f=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 ${f}`,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:(p=n.share)!=null&&p.expiresAt?`有效期至 ${new Date(n.share.expiresAt).toLocaleString()}`:"永久有效"})]}),o.jsx("div",{className:"af-public-display-grid",children:(n.nodes||[]).map(d=>o.jsx(Sx,{node:d,shareId:t},d.id))})]})}return o.jsx("main",{className:"af-public-display-page af-public-display-page--canvas",children:o.jsx(Uw,{children:o.jsx(CA,{className:"af-public-display-flow",nodes:s,edges:[],nodeTypes:oU,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(EA,{color:"rgba(255,255,255,0.12)",gap:22,size:1})})})})}const ft=e=>typeof e=="string",Ec=()=>{let e,t;const n=new Promise((r,s)=>{e=r,t=s});return n.resolve=e,n.reject=t,n},cj=e=>e==null?"":""+e,lU=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},cU=/###/g,uj=e=>e&&e.indexOf("###")>-1?e.replace(cU,"."):e,dj=e=>!e||ft(e),ou=(e,t,n)=>{const r=ft(t)?t.split("."):t;let s=0;for(;s<r.length-1;){if(dj(e))return{};const i=uj(r[s]);!e[i]&&n&&(e[i]=new n),Object.prototype.hasOwnProperty.call(e,i)?e=e[i]:e={},++s}return dj(e)?{}:{obj:e,k:uj(r[s])}},fj=(e,t,n)=>{const{obj:r,k:s}=ou(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=ou(e,a,Object);for(;l.obj===void 0&&a.length;)i=`${a[a.length-1]}.${i}`,a=a.slice(0,a.length-1),l=ou(e,a,Object),l&&l.obj&&typeof l.obj[`${l.k}.${i}`]<"u"&&(l.obj=void 0);l.obj[`${l.k}.${i}`]=n},uU=(e,t,n,r)=>{const{obj:s,k:i}=ou(e,t,Object);s[i]=s[i]||[],s[i].push(n)},qp=(e,t)=>{const{obj:n,k:r}=ou(e,t);if(n)return n[r]},dU=(e,t,n)=>{const r=qp(e,n);return r!==void 0?r:qp(t,n)},aI=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?ft(e[r])||e[r]instanceof String||ft(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):aI(e[r],t[r],n):e[r]=t[r]);return e},Ba=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var fU={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const pU=e=>ft(e)?e.replace(/[&<>"'\/]/g,t=>fU[t]):e;class hU{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 mU=[" ",",","?","!",";"],gU=new hU(20),yU=(e,t,n)=>{t=t||"",n=n||"";const r=mU.filter(a=>t.indexOf(a)<0&&n.indexOf(a)<0);if(r.length===0)return!0;const s=gU.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},Nx=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},Yp=e=>e&&e.replace("_","-"),xU={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 Gp{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||xU,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:(ft(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new Gp(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new Gp(this.logger,t)}}var ni=new Gp;class Fh{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 pj extends Fh{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):ft(r)&&i?l.push(...r.split(i)):l.push(r)));const c=qp(this.data,l);return!c&&!n&&!r&&t.indexOf(".")>-1&&(t=l[0],n=l[1],r=l.slice(2).join(".")),c||!a||!ft(r)?c:Nx(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),fj(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)(ft(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=qp(this.data,l)||{};a.skipCopy||(r=JSON.parse(JSON.stringify(r))),s?aI(c,r,i):c={...c,...r},fj(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 lI={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 hj={};class Jp extends Fh{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),lU(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=ni.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&&!yU(t,r,s);if(a&&!l){const c=t.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:t,namespaces:ft(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:ft(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,p=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(p){const N=n.nsSeparator||this.options.nsSeparator;return s?{res:`${c}${N}${a}`,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:`${c}${N}${a}`}return s?{res:a,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:a}const f=this.resolve(t,n);let d=f&&f.res;const h=f&&f.usedKey||a,y=f&&f.exactUsedKey||a,b=Object.prototype.toString.apply(d),k=["[object Number]","[object Function]","[object RegExp]"],g=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,w=!this.i18nFormat||this.i18nFormat.handleAsObject,x=!ft(d)&&typeof d!="boolean"&&typeof d!="number";if(w&&d&&x&&k.indexOf(b)<0&&!(ft(g)&&Array.isArray(d))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const N=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,d,{...n,ns:l}):`key '${a} (${this.language})' returned an object instead of string.`;return s?(f.res=N,f.usedParams=this.getUsedParamsDetails(n),f):N}if(i){const N=Array.isArray(d),C=N?[]:{},j=N?y:h;for(const _ in d)if(Object.prototype.hasOwnProperty.call(d,_)){const A=`${j}${i}${_}`;C[_]=this.translate(A,{...n,joinArrays:!1,ns:l}),C[_]===A&&(C[_]=d[_])}d=C}}else if(w&&ft(g)&&Array.isArray(d))d=d.join(g),d&&(d=this.extendTranslation(d,t,n,r));else{let N=!1,C=!1;const j=n.count!==void 0&&!ft(n.count),_=Jp.hasDefaultValue(n),A=j?this.pluralResolver.getSuffix(u,n.count,n):"",F=n.ordinal&&j?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",V=j&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),z=V&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${A}`]||n[`defaultValue${F}`]||n.defaultValue;!this.isValidLookup(d)&&_&&(N=!0,d=z),this.isValidLookup(d)||(C=!0,d=a);const R=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&C?void 0:d,T=_&&z!==d&&this.options.updateMissing;if(C||N||T){if(this.logger.log(T?"updateKey":"missingKey",u,c,a,T?z:d),i){const P=this.resolve(a,{...n,keySeparator:!1});P&&P.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 $=[];const M=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&M&&M[0])for(let P=0;P<M.length;P++)$.push(M[P]);else this.options.saveMissingTo==="all"?$=this.languageUtils.toResolveHierarchy(n.lng||this.language):$.push(n.lng||this.language);const O=(P,B,E)=>{const q=_&&E!==d?E:R;this.options.missingKeyHandler?this.options.missingKeyHandler(P,c,B,q,T,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(P,c,B,q,T,n),this.emit("missingKey",P,c,B,d)};this.options.saveMissing&&(this.options.saveMissingPlurals&&j?$.forEach(P=>{const B=this.pluralResolver.getSuffixes(P,n);V&&n[`defaultValue${this.options.pluralSeparator}zero`]&&B.indexOf(`${this.options.pluralSeparator}zero`)<0&&B.push(`${this.options.pluralSeparator}zero`),B.forEach(E=>{O([P],a+E,n[`defaultValue${E}`]||z)})}):O($,a,z))}d=this.extendTranslation(d,t,n,f,r),C&&d===a&&this.options.appendNamespaceToMissingKey&&(d=`${c}:${a}`),(C||N)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?d=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}:${a}`:a,N?d:void 0):d=this.options.parseMissingKeyHandler(d))}return s?(f.res=d,f.usedParams=this.getUsedParamsDetails(n),f):d}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=ft(t)&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let p;if(u){const d=t.match(this.interpolator.nestingRegexp);p=d&&d.length}let f=r.replace&&!ft(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(f={...this.options.interpolation.defaultVariables,...f}),t=this.interpolator.interpolate(t,f,r.lng||this.language||s.usedLng,r),u){const d=t.match(this.interpolator.nestingRegexp),h=d&&d.length;p<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 d=arguments.length,h=new Array(d),y=0;y<d;y++)h[y]=arguments[y];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=ft(l)?[l]:l;return t!=null&&c&&c.length&&r.applyPostProcessor!==!1&&(t=lI.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 ft(t)&&(t=[t]),t.forEach(c=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(c,n),p=u.key;s=p;let f=u.namespaces;this.options.fallbackNS&&(f=f.concat(this.options.fallbackNS));const d=n.count!==void 0&&!ft(n.count),h=d&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),y=n.context!==void 0&&(ft(n.context)||typeof n.context=="number")&&n.context!=="",b=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);f.forEach(k=>{this.isValidLookup(r)||(l=k,!hj[`${b[0]}-${k}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(l)&&(hj[`${b[0]}-${k}`]=!0,this.logger.warn(`key "${s}" for languages "${b.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!!!")),b.forEach(g=>{if(this.isValidLookup(r))return;a=g;const w=[p];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(w,p,g,k,n);else{let N;d&&(N=this.pluralResolver.getSuffix(g,n.count,n));const C=`${this.options.pluralSeparator}zero`,j=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(d&&(w.push(p+N),n.ordinal&&N.indexOf(j)===0&&w.push(p+N.replace(j,this.options.pluralSeparator)),h&&w.push(p+C)),y){const _=`${p}${this.options.contextSeparator}${n.context}`;w.push(_),d&&(w.push(_+N),n.ordinal&&N.indexOf(j)===0&&w.push(_+N.replace(j,this.options.pluralSeparator)),h&&w.push(_+C))}}let x;for(;x=w.pop();)this.isValidLookup(r)||(i=x,r=this.getResource(g,k,x,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&&!ft(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 Ng=e=>e.charAt(0).toUpperCase()+e.slice(1);class mj{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ni.create("languageUtils")}getScriptPartFromCode(t){if(t=Yp(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=Yp(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(ft(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]=Ng(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]=Ng(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=Ng(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)),ft(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 ft(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))):ft(t)&&i(this.formatLanguageCode(t)),r.forEach(a=>{s.indexOf(a)<0&&i(this.formatLanguageCode(a))}),s}}let wU=[{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}],bU={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 kU=["v1","v2","v3"],vU=["v4"],gj={zero:0,one:1,two:2,few:3,many:4,other:5},SU=()=>{const e={};return wU.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:bU[t.fc]}})}),e};class NU{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=ni.create("pluralResolver"),(!this.options.compatibilityJSON||vU.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=SU(),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=Yp(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)=>gj[s]-gj[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!kU.includes(this.options.compatibilityJSON)}}const yj=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=dU(e,t,n);return!i&&s&&ft(n)&&(i=Nx(e,n,r),i===void 0&&(i=Nx(t,n,r))),i},jg=e=>e.replace(/\$/g,"$$$$");class jU{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=ni.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:p,unescapePrefix:f,nestingPrefix:d,nestingPrefixEscaped:h,nestingSuffix:y,nestingSuffixEscaped:b,nestingOptionsSeparator:k,maxReplaces:g,alwaysFormat:w}=t.interpolation;this.escape=n!==void 0?n:pU,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=i?Ba(i):a||"{{",this.suffix=l?Ba(l):c||"}}",this.formatSeparator=u||",",this.unescapePrefix=p?"":f||"-",this.unescapeSuffix=this.unescapePrefix?"":p||"",this.nestingPrefix=d?Ba(d):h||Ba("$t("),this.nestingSuffix=y?Ba(y):b||Ba(")"),this.nestingOptionsSeparator=k||",",this.maxReplaces=g||1e3,this.alwaysFormat=w!==void 0?w:!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 g=yj(n,c,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(g,void 0,r,{...s,...n,interpolationkey:h}):g}const y=h.split(this.formatSeparator),b=y.shift().trim(),k=y.join(this.formatSeparator).trim();return this.format(yj(n,c,b,this.options.keySeparator,this.options.ignoreJSONStructure),k,r,{...s,...n,interpolationkey:b})};this.resetRegExp();const p=s&&s.missingInterpolationHandler||this.options.missingInterpolationHandler,f=s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>jg(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?jg(this.escape(h)):jg(h)}].forEach(h=>{for(l=0;i=h.regex.exec(t);){const y=i[1].trim();if(a=u(y),a===void 0)if(typeof p=="function"){const k=p(t,i,s);a=ft(k)?k:""}else if(s&&Object.prototype.hasOwnProperty.call(s,y))a="";else if(f){a=i[0];continue}else this.logger.warn(`missed to pass in variable ${y} for interpolating ${t}`),a="";else!ft(a)&&!this.useRawValueToEscape&&(a=cj(a));const b=h.safeValue(a);if(t=t.replace(i[0],b),f?(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 p=this.nestingOptionsSeparator;if(c.indexOf(p)<0)return c;const f=c.split(new RegExp(`${p}[ ]*{`));let d=`{${f[1]}`;c=f[0],d=this.interpolate(d,a);const h=d.match(/'/g),y=d.match(/"/g);(h&&h.length%2===0&&!y||y.length%2!==0)&&(d=d.replace(/'/g,'"'));try{a=JSON.parse(d),u&&(a={...u,...a})}catch(b){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,b),`${c}${p}${d}`}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&&!ft(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 p=s[1].split(this.formatSeparator).map(f=>f.trim());s[1]=p.shift(),c=p,u=!0}if(i=n(l.call(this,s[1].trim(),a),a),i&&s[0]===t&&!ft(i))return i;ft(i)||(i=cj(i)),i||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${t}`),i=""),u&&(i=c.reduce((p,f)=>this.format(p,f,r.lng,{...r,interpolationkey:s[1].trim()}),i.trim())),t=t.replace(s[0],i),this.regexp.lastIndex=0}return t}}const CU=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,""),p=l.trim();n[p]||(n[p]=u),u==="false"&&(n[p]=!1),u==="true"&&(n[p]=!0),isNaN(u)||(n[p]=parseInt(u,10))}})}return{formatName:t,formatOptions:n}},Wa=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(Yp(r),s),t[a]=l),l(n)}};class _U{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=ni.create("formatter"),this.options=t,this.formats={number:Wa((n,r)=>{const s=new Intl.NumberFormat(n,{...r});return i=>s.format(i)}),currency:Wa((n,r)=>{const s=new Intl.NumberFormat(n,{...r,style:"currency"});return i=>s.format(i)}),datetime:Wa((n,r)=>{const s=new Intl.DateTimeFormat(n,{...r});return i=>s.format(i)}),relativetime:Wa((n,r)=>{const s=new Intl.RelativeTimeFormat(n,{...r});return i=>s.format(i,r.range||"day")}),list:Wa((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()]=Wa(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:p}=CU(c);if(this.formats[u]){let f=l;try{const d=s&&s.formatParams&&s.formatParams[s.interpolationkey]||{},h=d.locale||d.lng||s.locale||s.lng||r;f=this.formats[u](l,h,{...p,...s,...d})}catch(d){this.logger.warn(d)}return f}else this.logger.warn(`there was no format function for ${u}`);return l},t)}}const EU=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class AU extends Fh{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=ni.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 p=!0;n.forEach(f=>{const d=`${u}|${f}`;!r.reload&&this.store.hasResourceBundle(u,f)?this.state[d]=2:this.state[d]<0||(this.state[d]===1?a[d]===void 0&&(a[d]=!0):(this.state[d]=1,p=!1,a[d]===void 0&&(a[d]=!0),i[d]===void 0&&(i[d]=!0),c[f]===void 0&&(c[f]=!0)))}),p||(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=>{uU(c.loaded,[i],a),EU(c,t),n&&c.errors.push(n),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(u=>{l[u]||(l[u]={});const p=c.loaded[u];p.length&&p.forEach(f=>{l[u][f]===void 0&&(l[u][f]=!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,p)=>{if(this.readingCalls--,this.waitingReads.length>0){const f=this.waitingReads.shift();this.read(f.lng,f.ns,f.fcName,f.tried,f.wait,f.callback)}if(u&&p&&s<this.maxRetries){setTimeout(()=>{this.read.call(this,t,n,r,s+1,i*2,a)},i);return}a(u,p)},c=this.backend[r].bind(this.backend);if(c.length===2){try{const u=c(t,n);u&&typeof u.then=="function"?u.then(p=>l(null,p)).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();ft(t)&&(t=this.languageUtils.toResolveHierarchy(t)),ft(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 p;u.length===5?p=u(t,n,r,s,c):p=u(t,n,r,s),p&&typeof p.then=="function"?p.then(f=>l(null,f)).catch(l):l(null,p)}catch(p){l(p)}else u(t,n,r,s,l,c)}!t||!t[0]||this.store.addResource(t[0],n,r,s)}}}const xj=()=>({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]),ft(e[1])&&(t.defaultValue=e[1]),ft(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}}),wj=e=>(ft(e.ns)&&(e.ns=[e.ns]),ft(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),ft(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),Nf=()=>{},PU=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class Hu extends Fh{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=wj(t),this.services={},this.logger=ni,this.modules={external:[]},PU(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&&(ft(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const s=xj();this.options={...s,...this.options,...wj(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=p=>p?typeof p=="function"?new p:p:null;if(!this.options.isClone){this.modules.logger?ni.init(i(this.modules.logger),this.options):ni.init(null,this.options);let p;this.modules.formatter?p=this.modules.formatter:typeof Intl<"u"&&(p=_U);const f=new mj(this.options);this.store=new pj(this.options.resources,this.options);const d=this.services;d.logger=ni,d.resourceStore=this.store,d.languageUtils=f,d.pluralResolver=new NU(f,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),p&&(!this.options.interpolation.format||this.options.interpolation.format===s.interpolation.format)&&(d.formatter=i(p),d.formatter.init(d,this.options),this.options.interpolation.format=d.formatter.format.bind(d.formatter)),d.interpolator=new jU(this.options),d.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},d.backendConnector=new AU(i(this.modules.backend),d.resourceStore,d,this.options),d.backendConnector.on("*",function(h){for(var y=arguments.length,b=new Array(y>1?y-1:0),k=1;k<y;k++)b[k-1]=arguments[k];t.emit(h,...b)}),this.modules.languageDetector&&(d.languageDetector=i(this.modules.languageDetector),d.languageDetector.init&&d.languageDetector.init(d,this.options.detection,this.options)),this.modules.i18nFormat&&(d.i18nFormat=i(this.modules.i18nFormat),d.i18nFormat.init&&d.i18nFormat.init(this)),this.translator=new Jp(this.services,this.options),this.translator.on("*",function(h){for(var y=arguments.length,b=new Array(y>1?y-1:0),k=1;k<y;k++)b[k-1]=arguments[k];t.emit(h,...b)}),this.modules.external.forEach(h=>{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,r||(r=Nf),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const p=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);p.length>0&&p[0]!=="dev"&&(this.options.lng=p[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(p=>{this[p]=function(){return t.store[p](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(p=>{this[p]=function(){return t.store[p](...arguments),t}});const c=Ec(),u=()=>{const p=(f,d)=>{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(d),r(f,d)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return p(null,this.t.bind(this));this.changeLanguage(this.options.lng,p)};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]:Nf;const s=ft(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=Ec();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=Nf),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"&&lI.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=Ec();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=ft(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,p=>{a(p,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,p=new Array(u>2?u-2:0),f=2;f<u;f++)p[f-2]=arguments[f];c=s.options.overloadTranslationOptionHandler([a,l].concat(p))}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 d=s.options.keySeparator||".";let h;return c.keyPrefix&&Array.isArray(a)?h=a.map(y=>`${c.keyPrefix}${d}${y}`):h=c.keyPrefix?`${c.keyPrefix}${d}${a}`:a,s.t(h,c)};return ft(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=Ec();return this.options.ns?(ft(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=Ec();ft(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 mj(xj());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 Hu(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Nf;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const s={...this.options,...t,isClone:!0},i=new Hu(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 pj(this.store.data,s),i.services.resourceStore=i.store),i.translator=new Jp(i.services,s),i.translator.on("*",function(l){for(var c=arguments.length,u=new Array(c>1?c-1:0),p=1;p<c;p++)u[p-1]=arguments[p];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 sr=Hu.createInstance();sr.createInstance=Hu.createInstance;sr.createInstance;sr.dir;sr.init;sr.loadResources;sr.reloadResources;sr.use;sr.changeLanguage;sr.getFixedT;sr.t;sr.exists;sr.setDefaultNamespace;sr.hasLoadedNamespace;sr.loadNamespaces;sr.loadLanguages;function IU(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Bu(e){"@babel/helpers - typeof";return Bu=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},Bu(e)}function TU(e,t){if(Bu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Bu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function RU(e){var t=TU(e,"string");return Bu(t)=="symbol"?t:t+""}function MU(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,RU(r.key),r)}}function $U(e,t,n){return t&&MU(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var cI=[],LU=cI.forEach,OU=cI.slice;function DU(e){return LU.call(OU.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}var bj=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,FU=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(!bj.test(s.domain))throw new TypeError("option domain is invalid");a+="; Domain=".concat(s.domain)}if(s.path){if(!bj.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},kj={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=FU(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)}},zU={name:"cookie",lookup:function(t){var n;if(t.lookupCookie&&typeof document<"u"){var r=kj.read(t.lookupCookie);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupCookie&&typeof document<"u"&&kj.create(n.lookupCookie,t,n.cookieMinutes,n.cookieDomain,n.cookieOptions)}},HU={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}},Ac=null,vj=function(){if(Ac!==null)return Ac;try{Ac=window!=="undefined"&&window.localStorage!==null;var t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{Ac=!1}return Ac},BU={name:"localStorage",lookup:function(t){var n;if(t.lookupLocalStorage&&vj()){var r=window.localStorage.getItem(t.lookupLocalStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupLocalStorage&&vj()&&window.localStorage.setItem(n.lookupLocalStorage,t)}},Pc=null,Sj=function(){if(Pc!==null)return Pc;try{Pc=window!=="undefined"&&window.sessionStorage!==null;var t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{Pc=!1}return Pc},WU={name:"sessionStorage",lookup:function(t){var n;if(t.lookupSessionStorage&&Sj()){var r=window.sessionStorage.getItem(t.lookupSessionStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupSessionStorage&&Sj()&&window.sessionStorage.setItem(n.lookupSessionStorage,t)}},VU={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}},KU={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}},UU={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}},qU={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]}},uI=!1;try{document.cookie,uI=!0}catch{}var dI=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];uI||dI.splice(1,1);function YU(){return{order:dI,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(t){return t}}}var fI=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};IU(this,e),this.type="languageDetector",this.detectors={},this.init(t,n)}return $U(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=DU(r,this.options||{},YU()),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(zU),this.addDetector(HU),this.addDetector(BU),this.addDetector(WU),this.addDetector(VU),this.addDetector(KU),this.addDetector(UU),this.addDetector(qU)}},{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)}))}}])}();fI.type="languageDetector";const GU={name:"AgentFlow",tagline:"AI Workflow Orchestration"},JU={projects:"Projects",nodes:"Nodes",myNodes:"My Nodes",myFlows:"My Flows",skills:"Skills",mcps:"MCP",feedback:"Feedback",flowEditor:"Flow Editor",settings:"Settings",back:"Back"},XU={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"},QU={success:"Success",failed:"Failed",pending:"Pending",running:"Running",skipped:"Skipped"},ZU={agent:"Agent",control:"Control",tool:"Tool",start:"Start",end:"End"},eq={online:"Engine Online",offline:"Engine Offline",connecting:"Connecting…"},tq={hub:"AgentFlow Hub",docs:"Documentation",github:"GitHub Repository"},nq={app:GU,nav:JU,common:XU,status:QU,nodeTypes:ZU,engine:eq,links:tq},rq="Flow Editor",sq="Nodes",iq="Edges",oq="Properties",aq={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"},lq={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}}"},cq={run:"Run Flow",stop:"Stop",resume:"Resume",validate:"Validate",export:"Export",import:"Import"},uq={nodeList:"Node List",runHistory:"Run History",validation:"Validation Results"},dq={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"},fq={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)"},pq={saving:"Saving...",saved:"Saved",saveFailed:"Save failed",runInTerminal:"Please use terminal to run"},hq={requirement:"Requirement Analysis",planning:"Technical Planning",code:"Code Execution",test:"Test Regression",normal:"Normal"},mq={phase:"Phase",allPhasesComplete:"All phases completed",currentPhaseComplete:"Current phase completed, waiting for confirmation..."},gq={node:"Node",text:"Text",file:"File",bool:"Boolean"},yq={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"},xq={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"},wq={title:"Jump to node",placeholder:"Type node ID or label…",empty:"No matching nodes",hintNavigate:"navigate",hintJump:"jump",hintClose:"close"},bq={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."},kq={mainNav:"Main Navigation"},vq={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'},Sq={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):
|
|
275
|
-
{{summary}}`,step:"Step {{current}}/{{total}}: {{description}}",phaseGeneration:`Phased generation ({{count}} phases): {{labels}}
|
|
276
|
-
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}}"},Nq={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"},jq={nodePalette:"Node Palette",noPipelineSelected:"No pipeline selected",moreRuns:"+{{count}} more",moreFlows:"+{{count}} more flows",runId:"Run ID: {{id}}"},Cq={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}}"},_q={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"},Eq={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"},Aq={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"},Pq={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"},Iq={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"},Tq={invalidPlaceholder:"Invalid placeholder: {{hint}}",empty:"(empty)",inputSubtitle:"Input · {{type}}",inputSubtitleNoType:"Input",outputSubtitle:"Output · {{type}}",outputSubtitleNoType:"Output",runtimeConst:"Runtime constant"},Rq={justNow:"Just now",minutesAgo:"{{n}} min ago",hoursAgo:"{{n}} hr ago",yesterday:"Yesterday",daysAgo:"{{n}} days ago",milliseconds:"{{n}} ms",seconds:"{{n}} s"},Mq={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"},$q={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."},Lq={title:"Print Output: {{instanceId}}",expand:"Expand",restore:"Restore"},Oq={save:"Save",cancel:"Cancel"},Dq={title:"Run with Params",noParams:"No input params in this flow",run:"Run",cancel:"Cancel"},Fq={title:"Run with Preset",noPresets:"No presets available",default:"Default run",run:"Run",cancel:"Cancel"},zq={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"},Hq={title:rq,nodes:sq,edges:iq,properties:oq,node:aq,nodeProps:lq,actions:cq,panel:uq,palette:dq,pipeline:fq,status:pq,roles:hq,phases:mq,types:gq,runContext:yq,shortcuts:xq,jumpPalette:wq,emptyCanvas:bq,sidebar:kq,validation:vq,composer:Sq,topbar:Nq,palette2:jq,run:Cq,fileEdit:_q,settings:Eq,schedule:Aq,history:Pq,nodePropsError:Iq,placeholder:Tq,time:Rq,userCheck:Mq,userAsk:$q,toolPrint:Lq,provideEdit:Oq,runParams:Dq,runPreset:Fq,runConfig:zq},Bq="Settings",Wq={engine:"Engine Settings",preferences:"Global Preferences"},Vq={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)."},Kq={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..."}},Uq={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."},qq={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."},Yq={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."},Gq={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)"},Jq={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"},Xq={title:"System Status",normal:"Service normal",abnormal:"Some interfaces abnormal",cursorModels:"Cursor Models",opencodeModels:"OpenCode Models",claudeCodeModels:"Claude Code Models",codexModels:"Codex Models"},Qq={title:"Shortcuts",projects:"Projects & Pipelines",flowEditor:"Node Canvas"},Zq={title:"Language",description:"Select your preferred language for the interface",options:{zh:"中文",en:"English",ja:"日本語"}},eY={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."},tY={title:Bq,crumb:Wq,workspace:Vq,cursor:Kq,opencode:Uq,claudeCode:qq,codex:Yq,env:Gq,allowlist:Jq,system:Xq,shortcuts:Qq,language:Zq,onboarding:eY},nY={thinking:"Thinking",result:"Result",reply:"Reply",error:"Error"},rY={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)"},sY={send:"Send",stop:"Stop",expand:"Expand",collapse:"Collapse",clear:"Clear"},iY={conversation:"Chat",conversationWithNumber:"Chat {{num}}",default:"Default"},oY={endSession:"End chat (will stop generation)",closeSession:"Close chat",newSession:"New chat",expandComposer:"Expand chat and output"},aY={hint:"Use the bottom input box for AI chat, with @node mentions, model selection, and more"},lY={aiLabels:nY,placeholders:rY,actions:sY,labels:iY,tooltips:oY,rightPanel:aY},cY="Projects",uY="All",dY="Archived",fY="Nodes",pY="My Nodes",hY="My Flows",mY="Skills",gY="Active Projects",yY="Archived Pipelines",xY="Global Nodes",wY="All Nodes",bY="My Nodes",kY="Manage node versions published to the current workspace marketplace, {{count}} total.",vY="Manage flow snippets published to the current workspace marketplace, {{count}} total.",SY="Global Skills",NY="Create New Project",jY="New Pipeline",CY="SEARCH PIPELINES...",_Y="SEARCH NODES...",EY="SEARCH FLOW SNIPPETS...",AY="SEARCH SKILLS...",PY="Refresh Resources",IY="Loading pipelines...",TY="Loading global resources...",RY="Filter result: {{count}} items (matching title, description, path and tags)",MY="Archived pipelines can still be opened and edited; files are located in the _archived subdirectory of each pipelines directory.",$Y="Manage your distributed node architectures and monitoring pipelines. Drag flow.yaml or .zip into this page to import shared flows.",LY="Review all globally available node definitions, {{count}} total, including built-in, workspace, and marketplace nodes.",OY="Review Composer-selectable skills, {{count}} total, including AgentFlow built-ins and workspace skills.",DY="Executable building blocks for pipeline runtime",FY="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.",zY="Published local node packages",HY="Only node versions published to this workspace marketplace appear here. Inspect details and delete versions that no flow uses.",BY="Published flow snippets",WY="Flow snippets published from Pipeline or Workspace canvases appear here. Search and inspect them, then load them from the canvas flow palette.",VY="Operating guides for Composer and agents",KY="Skills tell AI which rules to follow for a task, how to change flows, and how to reuse project conventions.",UY="No archived projects.",qY="No active pipelines; archived items are in the Archived tab.",YY="No global nodes available.",GY="No marketplace nodes have been published.",JY="No flow snippets have been published. Select multiple canvas nodes and publish them first.",XY="No skills available.",QY="No description.",ZY='No node matches "{{query}}".',eG='No flow snippet matches "{{query}}".',tG='No skill matches "{{query}}".',nG="{{inputs}} in / {{outputs}} out",rG="Flow Snippet",sG="{{nodes}} nodes / {{edges}} edges",iG="Skill",oG="Node detail",aG="Flow snippet detail",lG="Skill detail",cG="Type",uG="Source",dG="Package",fG="Version",pG="Path",hG="Editable",mG="Read only",gG="Editable",yG="Schema",xG="Inputs",wG="Outputs",bG="Runtime",kG="Node Body",vG="Files",SG="Usage",NG="No runtime manifest.",jG="No node body or README.",CG="No previewable files.",_G="Select a file to preview.",EG="Binary file preview is not supported.",AG="Large file; showing the first 256KB only.",PG="No pipelines using this node were found.",IG="Node Management",TG="Delete Node Version",RG="Deleting...",MG="AgentFlow checks all flow references before deleting; installed or used versions are kept.",$G="Delete {{id}}@{{version}}? This cannot be undone.",LG="Deleted {{id}}@{{version}}.",OG="{{count}} flow(s) still use it.",DG="Flow Snippet Management",FG="Delete Flow Snippet",zG="Deleting...",HG="Deleting it only removes this reusable marketplace snippet. Nodes already loaded onto canvases are not changed.",BG="Delete {{id}}@{{version}}? This cannot be undone.",WG="Deleted {{id}}@{{version}}.",VG="No slots",KG="Purpose",UG="This node is an execution unit in a pipeline. Its schema affects canvas wiring, parameter input, and runtime scheduling.",qG="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.",YG="Scale",GG="Flow Preview",JG="Edges",XG="Snippet JSON",QG="{{count}} more edge(s)",ZG="No previewable nodes.",eJ="This skill is injected into Composer as context for AI, constraining its decisions, edit strategy, and output format.",tJ="SKILL.md Preview",nJ="No preview content available.",rJ="Select a resource to inspect details.",sJ="Failed to load pipeline list.",iJ="No pipelines in current workspace.",oJ="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.",aJ='No pipelines found matching "{{query}}". Try different keywords or clear the search.',lJ="Recent Activity",cJ="No recent activity",uJ="No recent activity matching the keyword",dJ="Recent Run",fJ="Recent Open",pJ={builtin:"Built-in",workspace:"Workspace",user:"User"},hJ={flow:"Flow",global:"Global",marketplace:"Marketplace"},mJ={all:"All",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},gJ={overview:"Overview",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},yJ="Open to edit this pipeline in the node canvas.",xJ={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>"},wJ={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"},bJ={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"},kJ={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"},vJ={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"},SJ={title:cY,all:uY,archived:dY,nodes:fY,myNodes:pY,myFlows:hY,skills:mY,activeProjects:gY,archivedPipelines:yY,globalNodes:xY,nodeScopeAll:wY,nodeScopeMine:bY,myNodesHint:kY,myFlowsHint:vY,globalSkills:SY,createNew:NY,newPipeline:jY,searchPipelines:CY,searchNodes:_Y,searchFlows:EY,searchSkills:AY,refreshResources:PY,loadingPipelines:IY,loadingResources:TY,filterResult:RY,archivedHint:MY,activeHint:$Y,nodesHint:LY,skillsHint:OY,nodesPurposeTitle:DY,nodesPurposeDesc:FY,myNodesPurposeTitle:zY,myNodesPurposeDesc:HY,myFlowsPurposeTitle:BY,myFlowsPurposeDesc:WY,skillsPurposeTitle:VY,skillsPurposeDesc:KY,noArchived:UY,noActive:qY,noNodes:YY,noMyNodes:GY,noMyFlows:JY,noSkills:XY,noDescription:QY,noNodeMatch:ZY,noFlowSnippetMatch:eG,noSkillMatch:tG,nodeSlots:nG,flowSnippet:rG,flowSnippetNodes:sG,skill:iG,nodeDetail:oG,flowDetail:aG,skillDetail:lG,detailType:cG,detailSource:uG,detailPackage:dG,detailVersion:fG,detailPath:pG,detailEditable:hG,readOnly:mG,editable:gG,nodeSchema:yG,nodeInputs:xG,nodeOutputs:wG,nodeRuntime:bG,nodeBody:kG,nodeFiles:vG,nodeUsage:SG,noRuntimeManifest:NG,noNodeBody:jG,noNodeFiles:CG,selectNodeFile:_G,binaryFile:EG,fileTruncated:AG,noNodeUsage:PG,myNodeManagement:IG,deleteMyNode:TG,deletingMyNode:RG,deleteMyNodeHint:MG,deleteMyNodeConfirm:$G,deleteMyNodeSuccess:LG,deleteMyNodeUsedBy:OG,myFlowManagement:DG,deleteMyFlow:FG,deletingMyFlow:zG,deleteMyFlowHint:HG,deleteMyFlowConfirm:BG,deleteMyFlowSuccess:WG,noSlots:VG,resourceMeaning:KG,nodesMeaning:UG,myFlowsMeaning:qG,flowSnippetScale:YG,flowSnippetPreview:GG,flowSnippetEdges:JG,flowSnippetJson:XG,flowSnippetMoreEdges:QG,noFlowSnippetPreview:ZG,skillsMeaning:eJ,skillPreview:tJ,skillPreviewEmpty:nJ,selectResource:rJ,loadFailed:sJ,noPipelines:iJ,emptyHint:oJ,noMatch:aJ,recentActivity:lJ,noRecentActivity:cJ,noMatchRecent:uJ,recentRun:dJ,recentOpen:fJ,sourceBadge:pJ,resourceSource:hJ,resourceFilter:mJ,nodeDetailTabs:gJ,defaultCardDesc:yJ,hubCard:xJ,newPipelineModal:wJ,importModal:bJ,deleteModal:kJ,archiveModal:vJ},NJ="Back",jJ="Next",CJ="Skip",_J="Done",EJ="Start Creating",AJ={intro:`Welcome to AgentFlow! This is a visual workflow orchestration tool.
|
|
277
|
-
|
|
278
|
-
Click the button below to create your first pipeline.`,hubIntro:`Don't want to start from scratch?
|
|
279
|
-
|
|
280
|
-
Browse ready-made pipelines on AgentFlow Hub — community-shared flows you can install and run in one click.`},PJ={intro:`Now you're in the flow editor.
|
|
281
|
-
|
|
282
|
-
Describe your requirements in natural language in the input box below, and AI will generate the flow graph.
|
|
283
|
-
|
|
284
|
-
The left node panel allows you to freely drag, delete, and adjust connections.`,introEmpty:`The canvas is empty. Start creating your flow!
|
|
285
|
-
|
|
286
|
-
Describe your requirements in natural language in the input box below, and AI will generate the flow graph.
|
|
287
|
-
|
|
288
|
-
The left node panel allows you to freely drag, delete, and adjust connections.`},IJ={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"},TJ={back:NJ,next:jJ,skip:CJ,done:_J,startCreate:EJ,projects:AJ,flow:PJ,newPipeline:IJ},RJ={name:"AgentFlow",tagline:"AI 工作流编排"},MJ={projects:"项目",nodes:"Nodes",myNodes:"我的 Nodes",myFlows:"我的流程",skills:"Skills",mcps:"MCP",feedback:"意见反馈",flowEditor:"流程编辑器",settings:"设置",back:"返回"},$J={loading:"加载中…",saving:"保存中…",save:"保存",cancel:"取消",delete:"删除",edit:"编辑",create:"创建",close:"关闭",confirm:"确认",copy:"复制",copied:"已复制!",refresh:"刷新",search:"搜索",filter:"筛选",success:"成功",error:"错误",warning:"警告",info:"信息",done:"完成",pending:"待处理",running:"运行中",notFound:"未找到",required:"必填",optional:"可选"},LJ={success:"成功",failed:"失败",pending:"等待",running:"运行中",skipped:"跳过"},OJ={agent:"Agent 节点",control:"控制节点",tool:"工具节点",start:"开始",end:"结束"},DJ={online:"引擎在线",offline:"引擎离线",connecting:"连接中…"},FJ={hub:"AgentFlow Hub",docs:"文档",github:"GitHub 仓库"},zJ={app:RJ,nav:MJ,common:$J,status:LJ,nodeTypes:OJ,engine:DJ,links:FJ},HJ="流程编辑器",BJ="节点",WJ="连线",VJ="属性",KJ={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:"编辑内容"},UJ={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}}"},qJ={run:"运行流程",stop:"停止",resume:"继续",validate:"校验",export:"导出",import:"导入"},YJ={nodeList:"节点列表",runHistory:"运行历史",validation:"校验结果"},GJ={workspace:"工作区",loading:"加载中…",archived:"已归档",noPipelines:"暂无流水线",more:"更多",moreFlows:"更多流程",noRuns:"暂无运行记录",searchNodes:"搜索节点",noComponents:"暂无可用组件(检查节点库目录)",noMatch:"无匹配节点,请调整搜索词",selectPipeline:"从上方选择一条流水线以加载组件与画布",validationWarnings:"校验警告(与 agentflow validate 槽位检查一致)",output:"输出",model:"模型",userDir:"用户目录",toggleRecentActivity:"展开或收起最近打开或最近运行"},JJ={selectPipeline:"请从顶部下拉选择一条流水线",loadingProps:"加载节点属性…",pipelineId:"流水线 ID",diskPath:"磁盘路径",storageLocation:"存储位置",introduction:"介绍",introductionPlaceholder:"简要描述这条流水线的用途(写入 flow.yaml 的 ui.description)",metadata:"元数据",nodeCount:"节点数",nodesUnit:"个节点",loading:"加载中…",noRuns:"暂无运行记录(终端执行后会在工作区生成运行目录)"},XJ={saving:"保存中…",saved:"已保存",saveFailed:"保存失败",runInTerminal:"运行请使用终端"},QJ={requirement:"需求拆解",planning:"技术规划",code:"代码执行",test:"测试回归",normal:"普通"},ZJ={phase:"阶段",allPhasesComplete:"所有阶段完成",currentPhaseComplete:"当前阶段完成,等待确认继续…"},eX={node:"节点",text:"文本",file:"文件",bool:"布尔"},tX={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:"等待"},nX={title:"快捷键",general:"常规",saveDesc:"保存;节点属性侧栏打开时先提交节点再保存 flow",shortcutsLabel:"快捷键",jumpToNode:"按 ID 跳转到节点",openNodePalette:"打开节点面板",canvas:"画布",selectTool:"选择工具",panTool:"平移工具",holdSpacePan:"按住空格临时平移",saveViewport:"保存当前进入视角",selectAll:"全选所有节点",undo:"撤销画布修改",redo:"重做画布修改"},rX={title:"跳转到节点",placeholder:"输入节点 ID 或名称…",empty:"未匹配到节点",hintNavigate:"切换",hintJump:"跳转",hintClose:"关闭"},sX={title:"开始构建你的流程",text:"在下方 AI 输入框中描述你的流程,或从左侧面板拖拽节点到画布",composerHint:"使用 AI Composer 构建 AgentFlow",composerSub:"从左侧拖入节点,或在<strong>下方输入框</strong>中用自然语言描述工作流。<br/>按 <kbd>?</kbd> 查看快捷键。"},iX={mainNav:"主导航"},oX={flowWarningAriaLabel:"流程校验警告",reloadFromServer:"从服务器重新加载流程并刷新校验",reloadFromServerShort:"从服务器重新加载",closeBanner:"关闭校验警告横幅",nodePrefix:"节点",focusNodeAriaLabel:"在画布中选中并定位节点 {{nodeId}}",slotWarningCount:"槽位校验 {{count}} 条(已隐藏)",show:"显示",shortcutHint:"按 ? 查看快捷键",shortcutHintLabel:"快捷键",inputSlotNoEdge:' 的 input 槽位 "{{slotName}}"({{handle}})无对应 edge 连接',outputSlotNoEdge:' 的 output 槽位 "{{slotName}}"({{handle}})无对应 edge 连接'},aX={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}} 步):
|
|
289
|
-
{{summary}}`,step:"步骤 {{current}}/{{total}}: {{description}}",phaseGeneration:`分阶段生成({{count}} 阶段):{{labels}}
|
|
290
|
-
当前:{{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}}"},lX={currentPipeline:"当前流水线",backToEdit:"返回编辑",backToProjects:"返回项目",executionLog:"执行日志",history:"历史",pipelineSettings:"流水线设置",shortcutsLabel:"快捷键",shortcutsTitle:"快捷键 (?)",deletePipeline:"删除流水线",resumeTitle:"在同一 run 目录继续执行(uuid={{uuid}})",resumeTitleNoUuid:"尚未收到 apply-start,将发起新的 run",rerunTitle:"从头开始新的运行",runOptions:"运行选项",runWithParams:"带参数运行",runWithPreset:"指定预设运行",editRun:"编辑运行参数",startRun:"开始执行",stopRun:"停止后台运行"},cX={nodePalette:"节点调色板",noPipelineSelected:"未选择流水线",moreRuns:"+{{count}} 更多",moreFlows:"+{{count}} 更多流程",runId:"运行 ID: {{id}}"},uX={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}} 的分支"},dX={close:"关闭",loading:"加载中…",placeholder:"文件内容",largeFileWarning:"文件较大,编辑器性能可能受影响",reset:"重置",aiEdit:"AI 修改",aiRunning:"AI 处理中…",save:"保存",saving:"保存中…",saved:"已保存"},fX={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:"已复制"},pX={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:"定时配置已保存"},hX={title:"执行历史",summary:"执行结果汇总",successCount:"{{count}} 成功",failedCount:"{{count}} 失败",stoppedCount:"{{count}} 已停止",interruptedCount:"{{count}} 已中断",runningCount:"{{count}} 进行中",success:"成功",failed:"失败",stopped:"已停止",interrupted:"已中断",running:"进行中",unknown:"未知",runLabel:"运行 #{{id}}",enterRunView:"进入该次运行的画布与日志态"},mX={invalidInstanceId:"实例 ID 格式无效:仅允许英文字母、数字、下划线、短横线,且不能以数字开头。",duplicateInstanceId:"该实例 ID 已存在,请换一个。",loadFlowFailed:"读取 flow 失败",loadNodesFailed:"读取节点库失败"},gX={invalidPlaceholder:"无效占位符: {{hint}}",empty:"(空)",inputSubtitle:"输入 · {{type}}",inputSubtitleNoType:"输入",outputSubtitle:"输出 · {{type}}",outputSubtitleNoType:"输出",runtimeConst:"运行时常量"},yX={justNow:"刚刚",minutesAgo:"{{n}} 分钟前",hoursAgo:"{{n}} 小时前",yesterday:"昨天",daysAgo:"{{n}} 天前",milliseconds:"{{n}} 毫秒",seconds:"{{n}} 秒"},xX={title:"用户确认 ({{instanceId}})",edit:"编辑",save:"保存",cancel:"取消",aiEditPlaceholder:"输入 AI 修改指令,如:删除第二项、合并前两项…",aiEditBtn:"AI 修改",aiEditStarted:"AI 正在修改内容…",aiEditDone:"AI 修改完成",aiEditFailed:"AI 修改失败",contentSaved:"内容已保存",saveFailed:"保存失败",close:"关闭",continue:"继续执行",hint:"编辑或使用 AI 修改后点击保存,然后点击「继续执行」恢复流程"},wX={title:"用户选择 ({{instanceId}})",hint:"请从下方选项中选择一项以继续流程",submitting:"提交中…",submitFailed:"提交失败",close:"关闭",noOptions:"该节点未配置选项,请先在编辑器中为 output 槽位添加条目。"},bX={title:"Print 输出: {{instanceId}}",expand:"放大",restore:"还原"},kX={save:"保存",cancel:"取消"},vX={title:"带参数运行",noParams:"此流程无输入参数",run:"运行",cancel:"取消"},SX={title:"指定预设运行",noPresets:"无可用预设",default:"默认运行",run:"运行",cancel:"取消"},NX={preset:"预设",default:"默认",newPreset:"新建预设",deletePreset:"删除预设",presetNamePlaceholder:"预设名称",inputParams:"输入参数",noProvideNodes:"此流程无 provide 节点",filePathPlaceholder:"文件路径…",stringValuePlaceholder:"值…",presetSaved:"预设已保存",presetDeleted:"预设已删除",savePreset:"保存当前预设",expandInput:"编辑内容"},jX={title:HJ,nodes:BJ,edges:WJ,properties:VJ,node:KJ,nodeProps:UJ,actions:qJ,panel:YJ,palette:GJ,pipeline:JJ,status:XJ,roles:QJ,phases:ZJ,types:eX,runContext:tX,shortcuts:nX,jumpPalette:rX,emptyCanvas:sX,sidebar:iX,validation:oX,composer:aX,topbar:lX,palette2:cX,run:uX,fileEdit:dX,settings:fX,schedule:pX,history:hX,nodePropsError:mX,placeholder:gX,time:yX,userCheck:xX,userAsk:wX,toolPrint:bX,provideEdit:kX,runParams:vX,runPreset:SX,runConfig:NX},CX="设置",_X={engine:"引擎设置",preferences:"全局首选项"},EX={title:"工作区",currentPath:"当前工作区根目录",placeholder:"加载中…",copyPath:"复制路径",description:"流水线与节点清单将相对于此目录解析(由启动 UI 时传入)。"},AX={title:"Cursor CLI",status:{cached:"已缓存",notCached:"未缓存"},modelPreviewLabel:"Cursor 模型名称列表",modelList:{cached:"模型清单已缓存",empty:"暂无模型列表",count:"{{count}} 条",fetchedAt:"更新 {{time}}",never:"尚未拉取",refresh:"刷新清单",fetching:"拉取中…"}},PX={modelPreviewLabel:"OpenCode 模型名称列表",title:"OpenCode CLI",status:{ready:"就绪",notFound:"未找到"},provider:"方案 / Provider 标识",providerPlaceholder:"例如 bailian-coding-plan",saving:"正在保存并更新清单…",description:"对应 CLI opencode models <provider> 的参数;停止输入后会写入用户目录 config 并刷新 model-lists.json。"},IX={title:"Claude Code CLI",status:{ready:"就绪",notFound:"未找到"},modelPreviewLabel:"Claude Code 模型名称列表",description:"内置模型列表(Claude Code CLI 无 models 子命令);刷新将探测 claude 二进制是否在 PATH 中。首次使用请先执行 claude /login。"},TX={title:"Codex CLI",status:{ready:"就绪",notFound:"未找到"},modelPreviewLabel:"Codex 模型名称列表",description:"模型列表来自 codex debug models --bundled;首次使用请先执行 codex login。"},RX={title:"环境变量",note:"当前登录用户私有,运行时优先于服务全局环境变量",noteAdmin:"可配置个人或全局环境变量;个人同名变量优先于全局",saving:"正在保存...",key:"键",value:"值",scope:"范围",personal:"个人",global:"全局",add:"添加",delete:"删除 {{key}}",invalidKey:"环境变量名必须以字母或下划线开头,且只能包含字母、数字和下划线。",newKey:"新环境变量键",newValue:"值(密钥请谨慎)"},MX={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:"添加"},$X={title:"系统状态",normal:"服务正常",abnormal:"部分接口异常",cursorModels:"Cursor 模型",opencodeModels:"OpenCode 模型",claudeCodeModels:"Claude Code 模型",codexModels:"Codex 模型"},LX={title:"快捷入口",projects:"项目与流水线",flowEditor:"节点画布"},OX={title:"语言",description:"选择界面显示语言",options:{zh:"中文",en:"English",ja:"日本語"}},DX={title:"新手引导",description:"重新启动产品引导流程,了解 AgentFlow 的核心功能。",reset:"重置引导",resetSuccess:"已重置,下次访问将自动启动引导"},FX={title:CX,crumb:_X,workspace:EX,cursor:AX,opencode:PX,claudeCode:IX,codex:TX,env:RX,allowlist:MX,system:$X,shortcuts:LX,language:OX,onboarding:DX},zX={thinking:"思考",result:"结果",reply:"回复",error:"错误"},HX={input:"让 AI 协助编辑此节点…",waiting:"等待响应…",selectedEmpty:"在画布上选择节点,或在输入框用 @ 选择实例(Instances)或节点类型(Node)",textarea:"描述你的流程或让 AI 协助编辑(⌘/Ctrl+Enter 发送)"},BX={send:"发送",stop:"停止",expand:"展开",collapse:"收起",clear:"清空"},WX={conversation:"对话",conversationWithNumber:"对话 {{num}}",default:"默认"},VX={endSession:"结束对话(将停止生成)",closeSession:"关闭对话",newSession:"新建对话",expandComposer:"展开对话与输出"},KX={hint:"使用底部输入框进行 AI 对话,支持 @节点、选择模型等功能"},UX={aiLabels:zX,placeholders:HX,actions:BX,labels:WX,tooltips:VX,rightPanel:KX},qX="项目",YX="全部",GX="已归档",JX="Nodes",XX="我的 Nodes",QX="我的流程",ZX="Skills",eQ="活跃项目",tQ="已归档流水线",nQ="全局 Nodes",rQ="全部 Nodes",sQ="我的 Nodes",iQ="管理当前工作区已发布到本地 Marketplace 的节点,共 {{count}} 个。",oQ="管理当前工作区已发布到本地 Marketplace 的流程片段,共 {{count}} 个。",aQ="全局 Skills",lQ="创建新项目",cQ="新建流水线",uQ="搜索流水线…",dQ="搜索 nodes…",fQ="搜索流程片段…",pQ="搜索 skills…",hQ="刷新资源",mQ="加载流水线列表…",gQ="加载全局资源…",yQ="筛选结果:{{count}} 条(匹配标题、描述、路径与标签)",xQ="已归档的流水线仍可打开与编辑;文件位于各 pipelines 目录下的 _archived。",wQ="管理分布式节点架构与监控流水线。可将 flow.yaml 或 .zip 拖入本页导入分享流程。",bQ="查看当前可用的全局节点定义,共 {{count}} 个;包含内置、工作区与 marketplace 节点。",kQ="查看当前 Composer 可选择的 skills,共 {{count}} 个;包含 AgentFlow 内置与工作区 skills。",vQ="流程运行时的可执行积木",SQ="Nodes 决定画布上能拖什么、节点有哪些输入输出,以及运行时走 agent、control、provide 或 marketplace 哪类逻辑。",NQ="已发布的本地节点包",jQ="这里仅显示你发布到当前 Workspace Marketplace 的节点版本;可查看详情并删除未被 Flow 使用的版本。",CQ="已发布的流程片段",_Q="这里显示从 Pipeline 或 Workspace 画布发布的流程片段,可搜索、检查内容,并从画布的流程面板中加载复用。",EQ="Composer/Agent 的操作指南",AQ="Skills 告诉 AI 在特定任务里应遵守什么规则、如何修改 flow、如何复用项目约定。",PQ="暂无归档项目。",IQ="暂无未归档流水线;已归档项在 Archived 标签中查看。",TQ="暂无可用全局 nodes。",RQ="暂无已发布的 marketplace nodes。",MQ="暂无已发布的流程片段。可在画布中选中多个节点后发布。",$Q="暂无可用 skills。",LQ="暂无描述。",OQ="未找到与「{{query}}」匹配的 node。",DQ="未找到与「{{query}}」匹配的流程片段。",FQ="未找到与「{{query}}」匹配的 skill。",zQ="{{inputs}} in / {{outputs}} out",HQ="流程片段",BQ="{{nodes}} 节点 / {{edges}} 连线",WQ="Skill",VQ="Node 详情",KQ="流程片段详情",UQ="Skill 详情",qQ="类型",YQ="来源",GQ="包",JQ="版本",XQ="路径",QQ="可编辑",ZQ="只读",eZ="可编辑",tZ="Schema",nZ="输入",rZ="输出",sZ="Runtime",iZ="节点内容",oZ="Files",aZ="Usage",lZ="暂无 runtime manifest。",cZ="暂无节点正文或 README。",uZ="暂无可预览文件。",dZ="请选择文件查看内容。",fZ="二进制文件暂不支持预览。",pZ="文件较大,仅显示前 256KB。",hZ="暂未发现使用此 node 的流水线。",mZ="节点管理",gZ="删除节点版本",yZ="删除中…",xZ="删除前会检查所有 Flow 引用;仍被安装或使用的版本不会被删除。",wZ="确定删除 {{id}}@{{version}}?此操作不可撤销。",bZ="已删除 {{id}}@{{version}}。",kZ="仍有 {{count}} 个 Flow 使用它。",vZ="流程片段管理",SZ="删除流程片段",NZ="删除中…",jZ="删除后不会影响已经加载到画布里的节点,只会移除 Marketplace 中这个可复用片段。",CZ="确定删除 {{id}}@{{version}}?此操作不可撤销。",_Z="已删除 {{id}}@{{version}}。",EZ="无槽位",AZ="作用",PZ="这个 node 是 pipeline 的执行单元。它的 schema 会影响画布连线、参数输入和运行时调度。",IZ="流程片段是固定化流程的一部分。加载时会复制这组节点、连线和布局到当前画布,不覆盖已有内容。",TZ="规模",RZ="流程预览",MZ="连线",$Z="片段 JSON",LZ="还有 {{count}} 条连线",OZ="暂无可预览节点。",DZ="这个 skill 会作为 Composer 的上下文注入给 AI,用于约束 AI 的判断、修改方式和输出口径。",FZ="SKILL.md 预览",zZ="暂无可预览内容。",HZ="请选择一个资源查看详情。",BZ="未能加载流水线列表。",WZ="当前工作区暂无流水线。",VZ="在仓库根目录执行 {{code1}} 并确认工作区包含 {{code2}} 或用户目录下的流水线;亦可点击 New Pipeline 新建。",KZ="未找到与「{{query}}」匹配的流水线。可尝试其他关键词,或点击清除搜索。",UZ="最近打开或最近运行",qZ="暂无打开或运行记录",YZ="暂无与关键词匹配的最近记录",GZ="最近运行",JZ="最近打开",XZ={builtin:"内置",workspace:"工作区",user:"用户"},QZ={flow:"Flow",global:"Global",marketplace:"Marketplace"},ZZ={all:"全部",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},eee={overview:"概览",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},tee="打开以在节点画布中编辑此流水线。",nee={eyebrow:"AgentFlow Hub",title:"浏览社区流程",desc:"发现并一键安装社区分享的现成流水线。",cta:"前往 Hub",cliHint:"或通过 CLI 安装:agentflow download <slug>"},ree={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:"关闭"},see={title:"导入流水线",lead:"已选择文件「{{filename}}」。请确认流水线名称与保存位置;ZIP 将保留目录内脚本等文件。",nameLabel:"名称(必填)",namePlaceholder:"例如 my_shared_flow",nameHint:"须以英文字母开头,仅可使用字母、数字、下划线 _ 与连字符 -",locationLabel:"保存位置",userDir:"用户目录(~/agentflow/pipelines)",workspaceDir:"当前工作区(.workspace/agentflow/pipelines)",changeFile:"更换文件…",importFailed:"导入失败",importing:"导入中…",importAndOpen:"导入并打开",cancel:"取消",close:"关闭"},iee={title:"删除流水线",lead:"将永久删除磁盘上的流水线目录(含 flow.yaml、脚本等),无法撤销。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",deleteFailed:"删除失败",deleteTimeout:"删除请求超时,请重试(可先检查终端中的 UI 服务日志)",delete:"删除",deleting:"删除中…",confirmDelete:"确认删除",cancel:"取消",close:"关闭"},oee={title:"归档流水线",lead:"归档后流水线将移入「Archived」列表,仍可从该列表打开与编辑。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",archiveFailed:"归档失败",archive:"归档",archiving:"归档中…",confirmArchive:"确认归档",cancel:"取消",close:"关闭"},aee={title:qX,all:YX,archived:GX,nodes:JX,myNodes:XX,myFlows:QX,skills:ZX,activeProjects:eQ,archivedPipelines:tQ,globalNodes:nQ,nodeScopeAll:rQ,nodeScopeMine:sQ,myNodesHint:iQ,myFlowsHint:oQ,globalSkills:aQ,createNew:lQ,newPipeline:cQ,searchPipelines:uQ,searchNodes:dQ,searchFlows:fQ,searchSkills:pQ,refreshResources:hQ,loadingPipelines:mQ,loadingResources:gQ,filterResult:yQ,archivedHint:xQ,activeHint:wQ,nodesHint:bQ,skillsHint:kQ,nodesPurposeTitle:vQ,nodesPurposeDesc:SQ,myNodesPurposeTitle:NQ,myNodesPurposeDesc:jQ,myFlowsPurposeTitle:CQ,myFlowsPurposeDesc:_Q,skillsPurposeTitle:EQ,skillsPurposeDesc:AQ,noArchived:PQ,noActive:IQ,noNodes:TQ,noMyNodes:RQ,noMyFlows:MQ,noSkills:$Q,noDescription:LQ,noNodeMatch:OQ,noFlowSnippetMatch:DQ,noSkillMatch:FQ,nodeSlots:zQ,flowSnippet:HQ,flowSnippetNodes:BQ,skill:WQ,nodeDetail:VQ,flowDetail:KQ,skillDetail:UQ,detailType:qQ,detailSource:YQ,detailPackage:GQ,detailVersion:JQ,detailPath:XQ,detailEditable:QQ,readOnly:ZQ,editable:eZ,nodeSchema:tZ,nodeInputs:nZ,nodeOutputs:rZ,nodeRuntime:sZ,nodeBody:iZ,nodeFiles:oZ,nodeUsage:aZ,noRuntimeManifest:lZ,noNodeBody:cZ,noNodeFiles:uZ,selectNodeFile:dZ,binaryFile:fZ,fileTruncated:pZ,noNodeUsage:hZ,myNodeManagement:mZ,deleteMyNode:gZ,deletingMyNode:yZ,deleteMyNodeHint:xZ,deleteMyNodeConfirm:wZ,deleteMyNodeSuccess:bZ,deleteMyNodeUsedBy:kZ,myFlowManagement:vZ,deleteMyFlow:SZ,deletingMyFlow:NZ,deleteMyFlowHint:jZ,deleteMyFlowConfirm:CZ,deleteMyFlowSuccess:_Z,noSlots:EZ,resourceMeaning:AZ,nodesMeaning:PZ,myFlowsMeaning:IZ,flowSnippetScale:TZ,flowSnippetPreview:RZ,flowSnippetEdges:MZ,flowSnippetJson:$Z,flowSnippetMoreEdges:LZ,noFlowSnippetPreview:OZ,skillsMeaning:DZ,skillPreview:FZ,skillPreviewEmpty:zZ,selectResource:HZ,loadFailed:BZ,noPipelines:WZ,emptyHint:VZ,noMatch:KZ,recentActivity:UZ,noRecentActivity:qZ,noMatchRecent:YZ,recentRun:GZ,recentOpen:JZ,sourceBadge:XZ,resourceSource:QZ,resourceFilter:ZZ,nodeDetailTabs:eee,defaultCardDesc:tee,hubCard:nee,newPipelineModal:ree,importModal:see,deleteModal:iee,archiveModal:oee},lee="返回",cee="下一步",uee="跳过",dee="完成",fee="开始创建",pee={intro:`欢迎使用 AgentFlow!这是一个可视化流程编排工具。
|
|
291
|
-
|
|
292
|
-
点击下方按钮开始创建你的第一个流水线。`,hubIntro:`不想从零开始?
|
|
293
|
-
|
|
294
|
-
在 AgentFlow Hub 浏览社区分享的现成流水线,一键安装即可运行。`},hee={intro:`现在进入流程编辑器。
|
|
295
|
-
|
|
296
|
-
在下方输入框用自然语言描述你的需求,AI 会自动生成流程图。
|
|
297
|
-
|
|
298
|
-
左侧节点面板可以自由拖拽、删除和调整连接。`,introEmpty:`画布为空,开始创建你的流程吧!
|
|
299
|
-
|
|
300
|
-
在下方输入框用自然语言描述需求,AI 会自动生成流程图。
|
|
301
|
-
|
|
302
|
-
左侧节点面板可以自由拖拽、删除和调整连接。`},mee={guideTitle:"首次创建提示",guideDesc:"输入名称和描述后,AI 会自动生成流程图。你可以在编辑器中自由调整节点和连接。",nameHintGuide:"例如:MyFirstFlow(字母开头,支持数字和下划线)",descPlaceholderGuide:"例如:实现用户登录功能,包含注册、验证、授权",descHintGuide:"描述越详细,AI 生成的流程越准确",createGuide:"创建并开始编辑",typeNode:"节点引用类型",typeStr:"字符串类型",typeFile:"文件路径类型",typeBool:"布尔值类型"},gee={back:lee,next:cee,skip:uee,done:dee,startCreate:fee,projects:pee,flow:hee,newPipeline:mee},yee={en:{common:nq,flow:Hq,settings:tY,composer:lY,project:SJ,onboarding:TJ},zh:{common:zJ,flow:jX,settings:FX,composer:UX,project:aee,onboarding:gee}};sr.use(fI).use(q2).init({resources:yee,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 xee=[{code:"zh",name:"中文",flag:"🇨🇳"},{code:"en",name:"English",flag:"🇬🇧"}];function wee(e){return sr.changeLanguage(e)}const jx="agentflow-settings-opencode-plan-v1",jf="CURSOR_API_KEYS",Cf="AGENTFLOW_CURSOR_API_KEY_COOLDOWN_MINUTES";function Cg(e){if(!e||typeof e!="object")return{cursor:[],opencode:[],claudeCode:[],codex:[],cursorFetchedAt:null,opencodeFetchedAt:null,claudeCodeFetchedAt:null,codexFetchedAt:null};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 kl(){return`e_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function bee(e){return/^[A-Za-z_][A-Za-z0-9_]*$/.test(String(e||"").trim())}function Ho(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()||kl(),c=String(r.scope??t).trim()==="global"?"global":"user";!s&&!i||n.push({id:a,key:s,value:i,scope:c})}return n}function Nj(e){return Ho(e).map(({key:t,value:n})=>({key:t,value:n}))}function jj(){try{return localStorage.getItem(jx)??""}catch{return""}}function pI(e){return e?e.length<=6?"•".repeat(e.length):`${"•".repeat(Math.min(20,e.length-4))}${e.slice(-4)}`:""}function kee(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()||kl(),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 Cj(e){const t=Array.isArray(e)?e.map((n,r)=>({id:String((n==null?void 0:n.id)||"").trim()||kl(),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 vee(e){const t=String(e||"").trim();return t?t.length<=10?pI(t):`${t.slice(0,4)}${"•".repeat(Math.min(18,t.length-8))}${t.slice(-4)}`:""}function kb(e){return String(e||"").trim()||"<AGENTFLOW_TOKEN>"}function hI({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:kb(t)}}}},null,2)}function mI({baseUrl:e="",token:t=""}){const n=JSON.stringify(String(e||"http://127.0.0.1:8875")),r=JSON.stringify(kb(t));return["[mcp_servers.agentflow]",'command = "agentflow"','args = ["mcp"]',"","[mcp_servers.agentflow.env]",`AGENTFLOW_BASE_URL = ${n}`,`AGENTFLOW_TOKEN = ${r}`].join(`
|
|
303
|
-
`)}function See({baseUrl:e="",token:t=""}){const n=String(e||"http://127.0.0.1:8875"),r=hI({baseUrl:n,token:t}),s=mI({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: ${kb(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 设置页点击“使用当前登录 Token”后重新复制。","","配置后验证:","- 确认 `agentflow` 命令在 PATH 中可用。","- 通过 MCP 客户端刷新或重启后,确认 `agentflow` server 出现在 MCP server 列表。","- 如果可以做工具探测,只验证 `tools/list` 能看到 `agentflow_list_flows`、`agentflow_run_flow`、`agentflow_get_display_outputs`。","","最终回复只需要说明:配置了哪些文件、是否验证成功、如果失败下一步该检查什么。"].join(`
|
|
304
|
-
`)}function Nee(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 jee({authUser:e}){const{t,i18n:n}=Cr(["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}),[p,f]=m.useState(""),[d,h]=m.useState(!1),[y,b]=m.useState(!1),[k,g]=m.useState(""),[w,x]=m.useState([]),[N,C]=m.useState(""),[j,_]=m.useState(!1),[A,F]=m.useState(""),[V,z]=m.useState(""),[D,R]=m.useState(!1),[T,$]=m.useState(()=>new Set),[M,O]=m.useState(""),[P,B]=m.useState(""),[E,q]=m.useState(!!(e!=null&&e.isAdmin)),[W,L]=m.useState(""),[X,se]=m.useState([]),[ae,me]=m.useState([]),[re,de]=m.useState(""),[ne,ue]=m.useState(""),[fe,ve]=m.useState(()=>{var ee;return typeof window<"u"&&((ee=window.location)!=null&&ee.origin)?window.location.origin:"http://127.0.0.1:8875"}),[$e,We]=m.useState(""),[Pe,Ue]=m.useState(""),[pt,Te]=m.useState(!1),[et,Yt]=m.useState(!1),[jt,$t]=m.useState(""),[Ht,Xe]=m.useState(""),[oe,ke]=m.useState(""),[Se,qe]=m.useState(null),[Ze,kt]=m.useState(!1),[Z,xe]=m.useState(!1),[He,Ce]=m.useState(""),nt=m.useRef(null),ht=m.useRef(!1),un=m.useRef(!1),_r=m.useRef(""),Wn=m.useCallback(async()=>{l("");try{const ee=await fetch("/api/ui-context");if(!ee.ok)throw new Error("HTTP "+ee.status);const Ne=await ee.json();i(typeof Ne.workspaceRoot=="string"?Ne.workspaceRoot:"")}catch(ee){l(String(ee.message||ee)),i("")}},[]),Vn=m.useCallback(async()=>{f(""),h(!0);try{const ee=await fetch("/api/model-lists");if(!ee.ok)throw new Error("HTTP "+ee.status);const Ne=await ee.json();u(Cg(Ne))}catch(ee){f(String(ee.message||ee))}finally{h(!1)}},[]),Kn=m.useCallback(async()=>{C("");try{const ee=await fetch("/api/user-env"),Ne=await ee.json().catch(()=>({}));if(!ee.ok)throw new Error(typeof Ne.error=="string"?Ne.error:"HTTP "+ee.status);const ie=Ho(Array.isArray(Ne.env)?Ne.env:[],"user").map(vn=>({...vn,scope:"user"})),Gt=[...e!=null&&e.isAdmin?Ho(Array.isArray(Ne.globalEnv)?Ne.globalEnv:[],"global").map(vn=>({...vn,scope:"global"})):[],...ie];_r.current=JSON.stringify(Gt),x(Gt)}catch(ee){x([]),C(String(ee.message||ee))}finally{un.current=!0}},[e==null?void 0:e.isAdmin]),hn=m.useCallback(async()=>{if(e!=null&&e.isAdmin){Te(!0),$t("");try{const ee=await fetch("/api/admin/user-allowlist"),Ne=await ee.json().catch(()=>({}));if(!ee.ok)throw new Error(typeof Ne.error=="string"?Ne.error:"HTTP "+ee.status);const ie=Ne.allowlist&&typeof Ne.allowlist=="object"?Ne.allowlist:{};se(Array.isArray(ie.fileUsers)?ie.fileUsers.map(String):[]),me(Array.isArray(ie.envUsers)?ie.envUsers.map(String):[]),de(typeof ie.path=="string"?ie.path:"")}catch(ee){$t(String(ee.message||ee))}finally{Te(!1)}}},[e==null?void 0:e.isAdmin]),Un=m.useCallback(async ee=>{if(e!=null&&e.isAdmin){Yt(!0),$t("");try{const Ne=await fetch("/api/admin/user-allowlist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({users:ee})}),ie=await Ne.json().catch(()=>({}));if(!Ne.ok)throw new Error(typeof ie.error=="string"?ie.error:"HTTP "+Ne.status);const Dt=ie.allowlist&&typeof ie.allowlist=="object"?ie.allowlist:{};se(Array.isArray(Dt.fileUsers)?Dt.fileUsers.map(String):[]),me(Array.isArray(Dt.envUsers)?Dt.envUsers.map(String):[]),de(typeof Dt.path=="string"?Dt.path:"")}catch(Ne){$t(String(Ne.message||Ne))}finally{Yt(!1)}}},[e==null?void 0:e.isAdmin]),Pn=m.useCallback(async()=>{if(e!=null&&e.isAdmin){kt(!0),Ce("");try{const ee=await fetch("/api/admin/storage-config"),Ne=await ee.json().catch(()=>({}));if(!ee.ok)throw new Error(typeof Ne.error=="string"?Ne.error:"HTTP "+ee.status);const ie=Ne.config&&typeof Ne.config=="object"?Ne.config:{};qe(ie),Xe(typeof ie.dataRoot=="string"?ie.dataRoot:""),ke(typeof ie.skillsRoot=="string"?ie.skillsRoot:"")}catch(ee){Ce(String(ee.message||ee))}finally{kt(!1)}}},[e==null?void 0:e.isAdmin]),hr=m.useCallback(async()=>{if(e!=null&&e.isAdmin){xe(!0),Ce("");try{const ee=await fetch("/api/admin/storage-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dataRoot:Ht.trim(),skillsRoot:oe.trim(),migrateLegacySkills:!0})}),Ne=await ee.json().catch(()=>({}));if(!ee.ok)throw new Error(typeof Ne.error=="string"?Ne.error:"HTTP "+ee.status);const ie=Ne.config&&typeof Ne.config=="object"?Ne.config:{};qe(ie),Xe(typeof ie.dataRoot=="string"?ie.dataRoot:""),ke(typeof ie.skillsRoot=="string"?ie.skillsRoot:"")}catch(ee){Ce(String(ee.message||ee))}finally{xe(!1)}}},[e==null?void 0:e.isAdmin,Ht,oe]),In=m.useCallback(async ee=>{const Ne=Ho(ee),ie=Ne.filter(Gt=>Gt.scope!=="global"),Dt=Ne.filter(Gt=>Gt.scope==="global");_(!0),C("");try{const Gt=await fetch("/api/user-env",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:Nj(ie),...e!=null&&e.isAdmin?{globalEnv:Nj(Dt)}:{}})}),vn=await Gt.json().catch(()=>({}));if(!Gt.ok)throw new Error(typeof vn.error=="string"?vn.error:"HTTP "+Gt.status);const xs=Ho(Array.isArray(vn.env)?vn.env:[],"user").map(os=>({...os,scope:"user"})),Ar=[...e!=null&&e.isAdmin?Ho(Array.isArray(vn.globalEnv)?vn.globalEnv:[],"global").map(os=>({...os,scope:"global"})):[],...xs];_r.current=JSON.stringify(Ar),x(Ar)}catch(Gt){C(String(Gt.message||Gt))}finally{_(!1)}},[e==null?void 0:e.isAdmin]),Ln=m.useCallback(async()=>{f(""),h(!0);try{const ee=await fetch("/api/update-model-lists",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:W.trim()})}),Ne=await ee.json().catch(()=>({}));if(!ee.ok)throw new Error(typeof Ne.error=="string"?Ne.error:"HTTP "+ee.status);u(Cg(Ne.modelLists))}catch(ee){f(String(ee.message||ee))}finally{h(!1)}},[W]);m.useEffect(()=>{Wn(),Vn(),Kn(),e!=null&&e.isAdmin&&(hn(),Pn()),(async()=>{try{const ee=await fetch("/api/agentflow-config");if(ee.ok){const Ne=await ee.json(),ie=typeof Ne.opencodeProvider=="string"?Ne.opencodeProvider:"";L(ie),nt.current=ie;try{localStorage.setItem(jx,ie)}catch{}}else{const Ne=jj();L(Ne),nt.current=Ne}}catch{const ee=jj();L(ee),nt.current=ee}finally{ht.current=!0}})()},[e==null?void 0:e.isAdmin,Wn,Vn,Pn,hn,Kn]),m.useEffect(()=>{if(!un.current||JSON.stringify(Ho(w))===_r.current)return;const Ne=setTimeout(()=>{In(w)},350);return()=>clearTimeout(Ne)},[w,In]),m.useEffect(()=>{if(!ht.current)return;const ee=W.trim();if(ee===nt.current)return;const Ne=setTimeout(()=>{(async()=>{b(!0),g("");try{const ie=await fetch("/api/agentflow-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:ee})}),Dt=await ie.json().catch(()=>({}));if(!ie.ok)throw new Error(typeof Dt.error=="string"?Dt.error:"HTTP "+ie.status);nt.current=ee;try{localStorage.setItem(jx,ee)}catch{}Dt.modelLists&&u(Cg(Dt.modelLists))}catch(ie){g(String(ie.message||ie))}finally{b(!1)}})()},450);return()=>clearTimeout(Ne)},[W]);const ir=c.cursor.length>0,Zn=c.opencode.length>0,Er=c.claudeCode.length>0,On=c.codex.length>0,Hr=X.length>0||ae.length>0,mr=m.useMemo(()=>hI({baseUrl:fe,token:$e}),[fe,$e]),Br=m.useMemo(()=>mI({baseUrl:fe,token:$e}),[fe,$e]),bn=m.useMemo(()=>See({baseUrl:fe,token:$e}),[fe,$e]),nn=e!=null&&e.isAdmin&&E?"global":"user",er=m.useMemo(()=>w.find(ee=>ee.key===jf&&(ee.scope||"user")===nn)||null,[nn,w]),qn=m.useMemo(()=>kee((er==null?void 0:er.value)||""),[er==null?void 0:er.value]),gr=m.useMemo(()=>w.find(ee=>ee.key===Cf&&(ee.scope||"user")===nn)||null,[nn,w]),Bt=gr!=null&&gr.value?String(gr.value):"30",te=m.useCallback((ee,Ne,ie)=>{const Dt=String(ee||"").trim();if(!Dt)return;const Gt=String(Ne??"");x(vn=>{const xs=vn.find(Sn=>Sn.key===Dt&&(Sn.scope||"user")===ie);return Gt?xs?vn.map(Sn=>Sn.id===xs.id?{...Sn,value:Gt,scope:ie}:Sn):[{id:kl(),key:Dt,value:Gt,scope:ie},...vn]:vn.filter(Sn=>!(Sn.key===Dt&&(Sn.scope||"user")===ie))})},[]),be=m.useCallback(()=>{const ee=P.trim();if(!ee)return;const Ne=[...qn,{id:kl(),name:M.trim()||`Key ${qn.length+1}`,key:ee,createdAt:new Date().toISOString()}];te(jf,Cj(Ne),nn),O(""),B("")},[M,qn,nn,P,te]),st=m.useCallback(ee=>{const Ne=qn.filter(ie=>ie.id!==ee);te(jf,Ne.length?Cj(Ne):"",nn)},[qn,nn,te]),wt=m.useCallback(ee=>{const Ne=String(ee||"").replace(/[^\d]/g,"");if(!Ne){te(Cf,"",nn);return}const ie=Math.min(1440,Math.max(1,Number(Ne)||30));te(Cf,String(ie),nn)},[nn,te]),rn=m.useCallback(()=>{var ee;s&&((ee=navigator.clipboard)==null||ee.writeText(s))},[s]),Cn=m.useCallback(()=>{var ee;bn&&((ee=navigator.clipboard)==null||ee.writeText(bn),Ue("prompt"),window.setTimeout(()=>Ue(""),1200))},[bn]),kn=m.useCallback(()=>{var ee;(ee=navigator.clipboard)==null||ee.writeText(mr),Ue("cursor"),window.setTimeout(()=>Ue(""),1200)},[mr]),Dn=m.useCallback(()=>{var ee;(ee=navigator.clipboard)==null||ee.writeText(Br),Ue("codex"),window.setTimeout(()=>Ue(""),1200)},[Br]),Ve=m.useCallback(async()=>{try{const ee=await fetch("/api/auth/session-token"),Ne=await ee.json().catch(()=>({}));if(!ee.ok)throw new Error(typeof Ne.error=="string"?Ne.error:"HTTP "+ee.status);We(String(Ne.token||"")),Ue("token"),window.setTimeout(()=>Ue(""),1200)}catch(ee){Ue(""),l(String(ee.message||ee))}},[]),Lt=m.useCallback(()=>{const ee=A.trim(),Ne=V;if(ee){if(!bee(ee)){C(t("settings:env.invalidKey"));return}x(ie=>[{id:kl(),key:ee,value:Ne,scope:e!=null&&e.isAdmin&&D?"global":"user"},...ie]),F(""),z("")}},[e==null?void 0:e.isAdmin,D,A,V,t]),Ie=m.useCallback(ee=>{x(Ne=>Ne.filter(ie=>ie.id!==ee))},[]),Wt=m.useCallback((ee,Ne)=>{x(ie=>ie.map(Dt=>Dt.id===ee?{...Dt,...Ne}:Dt))},[]),Ye=m.useCallback(ee=>{$(Ne=>{const ie=new Set(Ne);return ie.has(ee)?ie.delete(ee):ie.add(ee),ie})},[]),or=m.useCallback(()=>{const ee=ne.trim();if(!ee)return;if(!/^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(ee)){$t("用户名须以字母开头,仅可使用字母、数字、下划线与连字符,最多 64 字符");return}if(new Set(X.map(ie=>String(ie||"").trim().toLowerCase())).has(ee.toLowerCase())){ue("");return}ue(""),Un([...X,ee])},[ne,X,Un]),Wr=m.useCallback(ee=>{const Ne=String(ee||"").trim().toLowerCase();Ne&&Un(X.filter(ie=>String(ie||"").trim().toLowerCase()!==Ne))},[X,Un]),Vr=m.useCallback(ee=>{const Ne=ee.target.value;wee(Ne)},[]),is=ee=>{const Ne=Nee(ee,r);return Ne?t("settings:cursor.modelList.fetchedAt",{time:Ne}):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,p?o.jsx("p",{className:"af-err af-settings-api-hint",children:p}):null,N?o.jsx("p",{className:"af-err af-settings-api-hint",children:N}):null,He?o.jsx("p",{className:"af-err af-settings-api-hint",children:He}):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:rn,"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"+(ir?" af-set-badge--ok":" af-set-badge--muted"),children:t(ir?"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:ir?"check_circle":"hourglass_empty"})}),o.jsxs("div",{children:[o.jsx("p",{className:"af-set-cli-title",children:t(ir?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),o.jsx("p",{className:"af-set-cli-mono",children:ir?t("settings:cursor.modelList.count",{count:c.cursor.length})+" · "+is(c.cursorFetchedAt):t("settings:cursor.modelList.refresh")})]})]}),ir?o.jsx("pre",{className:"af-set-model-preview","aria-label":t("settings:cursor.modelPreviewLabel"),children:c.cursor.join(`
|
|
305
|
-
`)}):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>Ln(),disabled:d,children:t(d?"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"+(qn.length?" af-set-badge--ok":" af-set-badge--muted"),children:[qn.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:E?"":"is-active",onClick:()=>q(!1),children:"个人"}),o.jsx("button",{type:"button",className:E?"is-active":"",onClick:()=>q(!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:Bt,onChange:ee=>wt(ee.target.value)}),o.jsx("span",{children:"分钟"})]}),o.jsx("span",{className:"af-set-env-note",children:j?"保存中":nn==="global"?"全局配置":"个人配置"})]}),o.jsx("div",{className:"af-set-cursor-key-list",children:qn.length?qn.map(ee=>o.jsxs("div",{className:"af-set-cursor-key-row",children:[o.jsxs("div",{className:"af-set-cursor-key-main",children:[o.jsx("strong",{children:ee.name}),o.jsx("code",{children:vee(ee.key)})]}),o.jsx("span",{className:"af-set-cursor-key-meta",children:ee.createdAt?new Date(ee.createdAt).toLocaleString():"历史 Key"}),o.jsx("button",{type:"button",className:"af-set-env-del af-set-cursor-key-delete","aria-label":`删除 ${ee.name}`,onClick:()=>st(ee.id),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})]},ee.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:M,onChange:ee=>O(ee.target.value),placeholder:"名称,例如 Team Key 1"}),o.jsx("input",{className:"af-set-input af-set-input--mono",type:"password",value:P,onChange:ee=>B(ee.target.value),placeholder:"Cursor API Key"}),o.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:be,disabled:!P.trim(),children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),"添加 Key"]})]}),o.jsxs("p",{className:"af-set-hint",children:["保存到 ",jf,";冷却时间保存到 ",Cf,"。个人配置会覆盖全局配置。"]})]}),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"+(Zn?" af-set-badge--ok":" af-set-badge--err"),children:t(Zn?"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:W,onChange:ee=>L(ee.target.value),placeholder:t("settings:opencode.providerPlaceholder"),autoComplete:"off"}),y?o.jsx("p",{className:"af-set-hint af-set-hint--inline","aria-live":"polite",children:t("settings:opencode.saving")}):null,k?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",role:"alert",children:k}):null]}),Zn?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})+" · "+is(c.opencodeFetchedAt)}),o.jsx("pre",{className:"af-set-model-preview","aria-label":t("settings:opencode.modelPreviewLabel"),children:c.opencode.join(`
|
|
306
|
-
`)})]}):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>Ln(),disabled:d,children:t(d?"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"+(Er?" af-set-badge--ok":" af-set-badge--err"),children:t(Er?"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:Er?"check_circle":"hourglass_empty"})}),o.jsxs("div",{children:[o.jsx("p",{className:"af-set-cli-title",children:t(Er?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),o.jsx("p",{className:"af-set-cli-mono",children:Er?t("settings:cursor.modelList.count",{count:c.claudeCode.length})+" · "+is(c.claudeCodeFetchedAt):t("settings:cursor.modelList.refresh")})]})]}),o.jsx("p",{className:"af-set-p",children:t("settings:claudeCode.description")}),Er?o.jsx("pre",{className:"af-set-model-preview","aria-label":t("settings:claudeCode.modelPreviewLabel"),children:c.claudeCode.join(`
|
|
307
|
-
`)}):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>Ln(),disabled:d,children:t(d?"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"+(On?" af-set-badge--ok":" af-set-badge--err"),children:t(On?"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:On?"check_circle":"hourglass_empty"})}),o.jsxs("div",{children:[o.jsx("p",{className:"af-set-cli-title",children:t(On?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),o.jsx("p",{className:"af-set-cli-mono",children:On?t("settings:cursor.modelList.count",{count:c.codex.length})+" · "+is(c.codexFetchedAt):t("settings:cursor.modelList.refresh")})]})]}),o.jsx("p",{className:"af-set-p",children:t("settings:codex.description")}),On?o.jsx("pre",{className:"af-set-model-preview","aria-label":t("settings:codex.modelPreviewLabel"),children:c.codex.join(`
|
|
308
|
-
`)}):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>Ln(),disabled:d,children:t(d?"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-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:"AgentFlow 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:"这里不是展示 AgentFlow 已接入的外部 MCP server;那些在 MCP tab 管理。这里生成的是让其他 Agent 连接本平台的配置。"}),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:fe,onChange:ee=>ve(ee.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:$e,onChange:ee=>We(ee.target.value),placeholder:"<AGENTFLOW_TOKEN>"}),o.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:Ve,children:Pe==="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:kn,children:Pe==="cursor"?"已复制":"复制"})]}),o.jsx("pre",{className:"af-set-mcp-code",children:mr})]}),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:Dn,children:Pe==="codex"?"已复制":"复制"})]}),o.jsx("pre",{className:"af-set-mcp-code",children:Br})]})]}),o.jsx("div",{className:"af-set-mcp-copy-row",children:o.jsxs("button",{type:"button",className:"af-set-footer-primary",onClick:Cn,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"content_copy"}),Pe==="prompt"?"已复制 Prompt":"复制 AI 使用 Prompt"]})}),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:bn})]}),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:j?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:A,onChange:ee=>F(ee.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:D?"":"is-active",onClick:()=>R(!1),children:t("settings:env.personal")}),o.jsx("button",{type:"button",className:D?"is-active":"",onClick:()=>R(!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:V,onChange:ee=>z(ee.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:Lt,disabled:!A.trim(),children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),t("settings:env.add")]})})]}),w.map(ee=>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:ee.key,onChange:Ne=>Wt(ee.id,{key:Ne.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:ee.scope!=="global"?"is-active":"",onClick:()=>Wt(ee.id,{scope:"user"}),children:t("settings:env.personal")}),o.jsx("button",{type:"button",className:ee.scope==="global"?"is-active":"",onClick:()=>Wt(ee.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:T.has(ee.id)?"text":"password",value:ee.value,onChange:Ne=>Wt(ee.id,{value:Ne.target.value}),placeholder:pI(ee.value)||t("settings:env.newValue"),"aria-label":t("settings:env.value")}),o.jsx("button",{type:"button",className:"af-set-env-value-toggle",onClick:()=>Ye(ee.id),"aria-label":T.has(ee.id)?"Hide value":"Show value",children:o.jsx("span",{className:"material-symbols-outlined",children:T.has(ee.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:ee.key}),onClick:()=>Ie(ee.id),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})})]},ee.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"+(Se!=null&&Se.envLocked?" af-set-badge--err":" af-set-badge--ok"),children:Se!=null&&Se.envLocked?"Env locked":"Configurable"}),o.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:()=>void Pn(),disabled:Ze||Z,children:Ze?"刷新中...":"刷新"})]}),He?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:He}):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:Ht,onChange:ee=>Xe(ee.target.value),placeholder:"/data1/services/mengmai/agentflow",autoComplete:"off",disabled:!!(Se!=null&&Se.envLocked)||Z}),o.jsx("button",{type:"button",className:"af-set-input-suffix",onClick:()=>void hr(),"aria-label":"保存 AgentFlow Data Root",disabled:Z||!!(Se!=null&&Se.envLocked),children:o.jsx("span",{className:"material-symbols-outlined",children:Z?"hourglass_empty":"save"})})]}),o.jsxs("p",{className:"af-set-hint",children:["当前目录:",o.jsx("code",{children:(Se==null?void 0:Se.dataRoot)||Ht||"-"}),Se!=null&&Se.configPath?o.jsxs(o.Fragment,{children:[";配置文件:",o.jsx("code",{children:Se.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 配置。 保存到新绝对路径时会复制旧目录内容;旧目录不会自动删除。",Se!=null&&Se.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:oe,onChange:ee=>ke(ee.target.value),placeholder:"/data1/services/mengmai/agentflow/skills",autoComplete:"off",disabled:!!(Se!=null&&Se.skillsEnvLocked)||Z}),o.jsx("button",{type:"button",className:"af-set-input-suffix",onClick:()=>void hr(),"aria-label":"保存 AgentFlow Skills Root",disabled:Z||!!(Se!=null&&Se.skillsEnvLocked),children:o.jsx("span",{className:"material-symbols-outlined",children:Z?"hourglass_empty":"save"})})]}),o.jsxs("p",{className:"af-set-hint",children:["当前 Skills:",o.jsx("code",{children:(Se==null?void 0:Se.skillsRoot)||oe||"-"}),Se!=null&&Se.legacySkillsRootExists?o.jsxs(o.Fragment,{children:[";保存时会补迁移旧目录 ",o.jsx("code",{children:Se.legacySkillsRoot})," 中缺失的 skills。"]}):null]}),o.jsxs("p",{className:"af-set-hint",children:["SkillHub 新安装、更新和卸载都作用于 Skills Root;普通用户只通过 Workspace 的 Load Skills 使用。",Se!=null&&Se.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"+(Hr?" af-set-badge--ok":" af-set-badge--muted"),children:t(Hr?"settings:allowlist.enabled":"settings:allowlist.open")}),o.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:()=>void hn(),disabled:pt,children:t(pt?"settings:allowlist.refreshing":"common:common.refresh")})]}),jt?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:jt}):null,re?o.jsxs("p",{className:"af-set-hint af-set-hint--inline",children:[t("settings:allowlist.file"),":",o.jsx("code",{children:re})]}):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:et?t("settings:allowlist.saving"):t("settings:allowlist.userCount",{count:X.length})})]}),o.jsx("div",{className:"af-allowlist-list",children:X.length>0?X.map(ee=>o.jsxs("div",{className:"af-allowlist-row",children:[o.jsx("span",{className:"af-allowlist-name",children:ee}),o.jsx("button",{type:"button",className:"af-set-env-del",onClick:()=>Wr(ee),"aria-label":t("settings:allowlist.remove",{username:ee}),disabled:et,children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})]},ee)):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:ne,onChange:ee=>ue(ee.target.value),onKeyDown:ee=>{ee.key==="Enter"&&or()},placeholder:"username",autoComplete:"off"}),o.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:or,disabled:et||!ne.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:ae.length>0?ae.map(ee=>o.jsx("code",{children:ee},ee)):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&&!p?"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:Vr,"aria-label":t("settings:language.description"),children:xee.map(ee=>o.jsxs("option",{value:ee.code,children:[ee.flag," ",ee.name]},ee.code))}),o.jsx("p",{className:"af-set-hint",children:t("settings:language.description")})]})]})]})]})})]})})]})}function Pr(e){return new Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(Math.max(0,Number(e||0)))}function _f(e){return`${Math.round(Math.max(0,Math.min(1,Number(e||0)))*100)}%`}function _g(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 Cee(e){const t=String(e||"");return t.includes("-")?t.slice(5):t}function Eg(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 _ee(e){const t=String(e||"").trim();return t?t.length>18?t.slice(0,8)+"..."+t.slice(-6):t:"-"}function Eee(e){const t=String(e||"unknown");return t==="success"?"成功":t==="failed"?"失败":t==="running"?"运行中":t==="stopped"?"已停止":t==="interrupted"?"中断":"未知"}function Aee({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"),y=await h.json().catch(()=>({}));if(!h.ok)throw new Error(typeof y.error=="string"?y.error:"HTTP "+h.status);n(y)}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 b={top:20,right:24,bottom:42,left:42},k=980-b.left-b.right,g=250-b.top-b.bottom,w=c.length>0?c:[],x=Math.max(1,...w.map(F=>Number(F.runs||0))),N=Math.max(1,...w.flatMap(F=>[Number(F.users||0),Number(F.pipelines||0)])),C=F=>b.left+(w.length<=1?k/2:F*k/(w.length-1)),j=F=>b.top+g-Math.max(0,Number(F||0))/x*g,_=F=>b.top+g-Math.max(0,Number(F||0))/N*g,A=F=>w.map((V,z)=>`${z===0?"M":"L"} ${C(z)} ${_(V[F])}`).join(" ");return{width:980,height:250,margin:b,innerHeight:g,rows:w,x:C,yRuns:j,yLine:_,lineUsers:A("users"),linePipelines:A("pipelines"),barWidth:Math.min(34,Math.max(12,k/Math.max(1,w.length)*.44))}},[c]),p=(t==null?void 0:t.usage)||{},f=(t==null?void 0:t.totals)||{},d=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:_f(p.activeUserRate)}),o.jsxs("em",{children:[Pr(p.activeUsers)," / ",Pr(f.users)," users"]})]}),o.jsxs("div",{children:[o.jsx("span",{children:"7日流水线使用率"}),o.jsx("strong",{children:_f(p.activePipelineRate)}),o.jsxs("em",{children:[Pr(p.activePipelines)," / ",Pr(f.activePipelines)," active"]})]}),o.jsxs("div",{children:[o.jsx("span",{children:"7日 Run"}),o.jsx("strong",{children:Pr(p.runs)}),o.jsxs("em",{children:[Pr(p.avgRunsPerDay)," / day"]})]}),o.jsxs("div",{children:[o.jsx("span",{children:"7日成功率"}),o.jsx("strong",{children:_f(p.successRate)}),o.jsxs("em",{children:["失败率 ",_f(p.failureRate)," · avg ",_g(p.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,y)=>{const b=u.x(y),k=u.yRuns(h.runs),g=u.margin.top+u.innerHeight,w=Math.max(2,g-k);return o.jsxs("g",{children:[o.jsx("rect",{className:"af-admin-usage-chart__run-bar",x:b-u.barWidth/2,y:g-w,width:u.barWidth,height:w,rx:"5",children:o.jsx("title",{children:`${h.date}: ${h.runs} runs`})}),o.jsx("text",{className:"af-admin-usage-chart__value",x:b,y:g+22,children:Pr(h.runs)}),o.jsx("text",{className:"af-admin-usage-chart__date",x:b,y:g+42,children:Cee(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,y)=>{const b=u.x(y);return o.jsxs("g",{children:[o.jsx("circle",{className:"af-admin-usage-chart__point af-admin-usage-chart__point--users",cx:b,cy:u.yLine(h.users),r:"3.5"}),o.jsx("circle",{className:"af-admin-usage-chart__point af-admin-usage-chart__point--pipelines",cx:b,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:d.length===0?o.jsx("tr",{children:o.jsx("td",{colSpan:6,children:"暂无运行明细"})}):d.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:Eg(h.at)}),h.endedAt?o.jsxs("span",{children:["结束 ",Eg(h.endedAt)]}):o.jsx("span",{children:"未结束"})]}),o.jsx("td",{children:o.jsx("span",{className:"af-project-admin-usage__chips",children:o.jsx("em",{children:Eee(h.status)})})}),o.jsx("td",{children:_g(h.durationMs)}),o.jsx("td",{children:o.jsx("code",{className:"af-admin-usage-run-id",children:_ee(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 y,b,k,g,w,x,N,C,j,_,A;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:Pr((y=h.pipelines)==null?void 0:y.total)}),o.jsxs("span",{children:[Pr((b=h.pipelines)==null?void 0:b.active)," active / ",Pr((k=h.pipelines)==null?void 0:k.archived)," archived"]})]}),o.jsxs("td",{children:[o.jsx("strong",{children:Pr((g=h.runs)==null?void 0:g.total)}),o.jsxs("span",{children:["avg ",_g((w=h.runs)==null?void 0:w.avgDurationMs)]})]}),o.jsx("td",{children:o.jsxs("span",{className:"af-project-admin-usage__chips",children:[o.jsxs("em",{children:["成功 ",Pr((x=h.runs)==null?void 0:x.success)]}),o.jsxs("em",{children:["失败 ",Pr((N=h.runs)==null?void 0:N.failed)]}),o.jsxs("em",{children:["运行中 ",Pr((C=h.runs)==null?void 0:C.running)]})]})}),o.jsx("td",{children:(j=h.runs)!=null&&j.lastRunAt?o.jsxs(o.Fragment,{children:[o.jsx("strong",{children:((_=h.runs)==null?void 0:_.lastRunFlowId)||"-"}),o.jsxs("span",{children:[((A=h.runs)==null?void 0:A.lastRunStatus)||"unknown"," · ",Eg(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 Pee(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 Iee({authUser:e}){const{navigate:t}=ui(),[n,r]=m.useState(""),[s,i]=m.useState(""),[a,l]=m.useState(!1),[c,u]=m.useState(""),[p,f]=m.useState(!1),[d,h]=m.useState([]),[y,b]=m.useState(!1),[k,g]=m.useState(""),w=!!(e!=null&&e.isAdmin),x=m.useCallback(async()=>{if(w){b(!0),g("");try{const C=await fetch("/api/feedback"),j=await C.json().catch(()=>({}));if(!C.ok)throw new Error(j.error||"加载失败");h(Array.isArray(j.feedback)?j.feedback:[])}catch(C){g(String(C.message||C)),h([])}finally{b(!1)}}},[w]);m.useEffect(()=>{x()},[x]);const N=async C=>{if(C.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})}),_=await j.json().catch(()=>({}));if(!j.ok)throw new Error(_.error||"提交失败");f(!0),r(""),i("")}catch(j){u(String(j.message||j))}finally{l(!1)}}};return w?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 x(),disabled:y,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:y?"hourglass_empty":"refresh"}),y?"刷新中...":"刷新"]}),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"}),"返回"]})]})]}),k?o.jsx("p",{className:"af-err af-feedback-error",children:k}):null,o.jsx("div",{className:"af-feedback-list af-feedback-list--page",children:d.length>0?d.map(C=>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:C.title||"未命名反馈"}),o.jsxs("p",{children:[o.jsx("span",{children:C.username||C.userId||"unknown"}),o.jsx("span",{children:Pee(C.createdAt)})]})]}),C.contact?o.jsx("span",{className:"af-feedback-item__contact",children:C.contact}):null]}),o.jsx("p",{className:"af-feedback-item__content",children:C.content}),C.pageUrl?o.jsx("code",{className:"af-feedback-item__url",children:C.pageUrl}):null]},C.id)):o.jsx("div",{className:"af-feedback-empty",children:y?"正在加载反馈...":"暂无反馈"})})]})}):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"}),"返回"]})]}),p?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:N,children:[o.jsxs("label",{className:"af-feedback-field",children:[o.jsx("span",{children:"标题"}),o.jsx("input",{value:n,onChange:C=>r(C.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:C=>i(C.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 gI(){return`m_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function _j(e,t=[]){const n=new Set((Array.isArray(t)?t:[]).map(String));return Object.entries(e&&typeof e=="object"?e:{}).map(([r,s])=>({id:gI(),key:r,value:String(s??""),private:n.has(r)}))}function Ej(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 ep(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(`
|
|
309
|
-
`),description:String((e==null?void 0:e.description)||t.description||""),envRows:_j(t.env||(e==null?void 0:e.env),e==null?void 0:e.privateEnvKeys),headerRows:_j(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 Ag(){return ep({name:"",raw:{command:""}})}function Tee(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=Ej(e.envRows),s=Ej(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 Aj(e){return e?e.ok?`${e.toolCount||0} tools enabled`:`Error - ${e.error||"Show Output"}`:"未检测"}function Pj(e){return e?e.ok?"ok":"error":"unknown"}function Cx(e){return e==="ok"?"ok":e==="partial"?"partial":e==="unsupported"?"error":"unknown"}function Ree(e,t){return e&&e.label||t}function Mee({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--${Cx(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:Ree(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 Ij({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:gI(),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 $ee(){var D;const[e,t]=m.useState(""),[n,r]=m.useState([]),[s,i]=m.useState(Ag),[a,l]=m.useState(""),[c,u]=m.useState(!1),[p,f]=m.useState(!1),[d,h]=m.useState(!1),[y,b]=m.useState({}),[k,g]=m.useState(""),[w,x]=m.useState(""),N=m.useMemo(()=>n.find(R=>R.name===a)||null,[a,n]),C=N&&y[N.name]||null,j=m.useCallback(async()=>{u(!0),g("");try{const R=await fetch("/api/mcps"),T=await R.json().catch(()=>({}));if(!R.ok)throw new Error(T.error||"MCP HTTP "+R.status);const $=Array.isArray(T.servers)?T.servers:[];t(String(T.path||"")),r($),a&&$.some(M=>M.name===a)&&i(ep($.find(M=>M.name===a)))}catch(R){g(String(R.message||R))}finally{u(!1)}},[a]);m.useEffect(()=>{j()},[j]);const _=()=>{l(""),i(Ag()),x(""),g("")},A=R=>{l(R.name),i(ep(R)),x(""),g("")},F=async(R="")=>{h(!0),g(""),x("");try{const T=await fetch("/api/mcps/check",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(R?{name:R}:{})}),$=await T.json().catch(()=>({}));if(!T.ok)throw new Error($.error||"检测 MCP 失败");const M=Array.isArray($.results)?$.results:[];b(O=>{const P={...O};for(const B of M)B!=null&&B.name&&(P[B.name]=B);return P}),x(R?`已检测 ${R}。`:"已检测所有 MCP。")}catch(T){g(String(T.message||T))}finally{h(!1)}},V=async()=>{f(!0),g(""),x("");try{const R=Tee(s);if(!R.nextName)throw new Error("请填写 MCP 名称");const T=await fetch("/api/mcps",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(R)}),$=await T.json().catch(()=>({}));if(!T.ok)throw new Error($.error||"保存 MCP 失败");const M=Array.isArray($.servers)?$.servers:[];r(M),t(String($.path||e)),l(R.nextName),i(ep(M.find(O=>O.name===R.nextName)||null)),b(O=>{const P={...O};return s.originalName&&s.originalName!==R.nextName&&delete P[s.originalName],delete P[R.nextName],P}),x("已保存。Cursor CLI 下次启动时会读取新配置。")}catch(R){g(String(R.message||R))}finally{f(!1)}},z=async R=>{if(R!=null&&R.name&&window.confirm(`删除 MCP "${R.name}"?`)){f(!0),g(""),x("");try{const T=await fetch("/api/mcps/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:R.name})}),$=await T.json().catch(()=>({}));if(!T.ok)throw new Error($.error||"删除 MCP 失败");r(Array.isArray($.servers)?$.servers:[]),l(""),i(Ag()),b(M=>{const O={...M};return delete O[R.name],O}),x("已删除。")}catch(T){g(String(T.message||T))}finally{f(!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:j,disabled:c||p,children:"刷新"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>F(),disabled:d||c||p||n.length===0,children:d?"检测中...":"检测状态"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:_,disabled:p,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.jsxs("p",{className:"af-settings-lead",children:["新增、编辑和删除 Cursor 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:_,disabled:p,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:_,disabled:p,children:"新增 MCP Server"})]}):null,o.jsx("div",{className:"af-mcp-server-list",children:n.map(R=>{var T,$,M,O;return o.jsxs("button",{type:"button",className:"af-mcp-server-item"+(a===R.name?" af-mcp-server-item--active":""),onClick:()=>A(R),children:[o.jsx("span",{className:"material-symbols-outlined",children:R.type==="url"?"cloud":"terminal"}),o.jsxs("span",{children:[o.jsxs("span",{className:"af-mcp-server-title",children:[o.jsx("strong",{children:R.name}),o.jsx("small",{className:`af-mcp-server-health af-mcp-server-health--${Pj(y[R.name])}`,children:Aj(y[R.name])})]}),o.jsxs("span",{className:"af-mcp-server-backends",children:[o.jsx("small",{className:`af-mcp-backend-pill af-mcp-backend-pill--${Cx(($=(T=R.backends)==null?void 0:T.cursor)==null?void 0:$.status)}`,children:"Cursor"}),o.jsx("small",{className:`af-mcp-backend-pill af-mcp-backend-pill--${Cx((O=(M=R.backends)==null?void 0:M.codex)==null?void 0:O.status)}`,children:"Codex"})]}),o.jsx("em",{children:R.url||[R.command,...R.args||[]].filter(Boolean).join(" ")})]})]},R.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:N?"编辑 MCP":"新增 MCP"}),o.jsx("p",{className:"af-set-p af-set-p--tight",children:"保存后会写入 Cursor MCP 配置。已运行的 agent 进程不会热更新,下一次启动会读取新配置。"})]}),N?o.jsxs("div",{className:"af-mcp-editor-actions",children:[o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>F(N.name),disabled:d||p,children:d?"检测中...":"检测"}),o.jsx("button",{type:"button",className:"af-set-btn-mini af-set-btn-mini--danger",onClick:()=>z(N),disabled:p,children:"删除"})]}):null]}),k?o.jsx("p",{className:"af-mcp-error",children:k}):null,w?o.jsx("p",{className:"af-mcp-status",children:w}):null,N?o.jsx(Mee,{server:N}):null,C?o.jsxs("div",{className:`af-mcp-check af-mcp-check--${Pj(C)}`,children:[o.jsxs("div",{className:"af-mcp-check-head",children:[o.jsx("strong",{children:Aj(C)}),o.jsxs("span",{children:[C.elapsedMs||0,"ms"]})]}),C.error?o.jsx("p",{children:C.error}):null,(D=C.tools)!=null&&D.length?o.jsx("div",{className:"af-mcp-tools-list",children:C.tools.map(R=>o.jsxs("div",{className:"af-mcp-tool-row",children:[o.jsx("strong",{children:R.name}),R.description?o.jsx("span",{children:R.description}):null]},R.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:R=>i(T=>({...T,name:R.target.value})),placeholder:"github"})]}),o.jsxs("label",{className:"af-set-label",children:["类型",o.jsxs("select",{className:"af-set-input",value:s.type,onChange:R=>i(T=>({...T,type:R.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:R=>i(T=>({...T,url:R.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:R=>i(T=>({...T,command:R.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:R=>i(T=>({...T,argsText:R.target.value})),placeholder:`mcp-server-example
|
|
310
|
-
--flag`})]})]}),o.jsxs("label",{className:"af-set-label af-mcp-field--wide",children:["描述",o.jsx("input",{className:"af-set-input",value:s.description,onChange:R=>i(T=>({...T,description:R.target.value})),placeholder:"这个 MCP 提供什么能力"})]}),o.jsx(Ij,{title:"Headers",rows:s.headerRows,onChange:R=>i(T=>({...T,headerRows:R})),placeholderKey:"Authorization",placeholderValue:"Bearer ..."}),o.jsx(Ij,{title:"Env",rows:s.envRows,onChange:R=>i(T=>({...T,envRows:R})),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:R=>i(T=>({...T,extraJson:R.target.value}))})]})]}),o.jsxs("div",{className:"af-mcp-actions",children:[o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:_,disabled:p,children:"清空"}),o.jsx("button",{type:"button",className:"af-set-footer-primary",onClick:V,disabled:p,children:p?"保存中...":"保存 MCP"})]})]})]})]})})]})}function Tj(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 Lee(e){return(e==null?void 0:e.kind)==="workspace"?"Workspace":"Pipeline"}function Oee(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 Dee(){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 f=await fetch("/api/schedules"),d=await f.json().catch(()=>({}));if(!f.ok)throw new Error(d.error||"读取定时任务失败");t(Array.isArray(d.schedules)?d.schedules:[])}catch(f){i(String(f.message||f)),t([])}finally{r(!1)}},[]);m.useEffect(()=>{c()},[c]);const u=m.useCallback(async f=>{const d=`${f.kind}:${f.flowSource||"user"}:${f.flowId||""}:${f.scheduleNodeId||""}`;l(d),i("");try{const h=await fetch("/api/schedule/toggle",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:f.kind,flowId:f.flowId,flowSource:f.flowSource||"user",scheduleNodeId:f.scheduleNodeId||"",enabled:!f.enabled})}),y=await h.json().catch(()=>({}));if(!h.ok||y.success===!1)throw new Error(y.error||"更新定时任务失败");await c()}catch(h){i(String(h.message||h))}finally{l("")}},[c]),p=m.useMemo(()=>{const f=e.filter(h=>h.enabled).length,d=e.filter(h=>h.kind==="workspace").length;return{total:e.length,enabled:f,workspace:d,pipeline:e.length-d}},[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:p.total})]}),o.jsxs("div",{children:[o.jsx("span",{children:"启用中"}),o.jsx("strong",{children:p.enabled})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Workspace"}),o.jsx("strong",{children:p.workspace})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Pipeline"}),o.jsx("strong",{children:p.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(f=>{const d=`${f.kind}:${f.flowSource||"user"}:${f.flowId||""}:${f.scheduleNodeId||""}`,h=a===d;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:f.label||f.flowId||"-"}),o.jsx("span",{className:`af-schedule-badge af-schedule-badge--${f.kind||"pipeline"}`,children:Lee(f)}),o.jsx("span",{className:`af-schedule-state ${f.enabled?"af-schedule-state--on":"af-schedule-state--off"}`,children:Oee(f)})]}),o.jsxs("div",{className:"af-schedule-card__meta",children:[o.jsx("span",{children:f.flowId||"-"}),o.jsx("span",{children:f.flowSource||"user"}),f.scheduleNodeId?o.jsx("span",{children:f.scheduleNodeId}):null]}),o.jsxs("div",{className:"af-schedule-card__grid",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Cron"}),o.jsx("strong",{children:f.cron||"-"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"时区"}),o.jsx("strong",{children:f.timezone||"Asia/Shanghai"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"下次执行"}),o.jsx("strong",{children:Tj(f.nextRunAt)})]}),o.jsxs("div",{children:[o.jsx("span",{children:"最近执行"}),o.jsx("strong",{children:Tj(f.lastTriggeredAt)})]})]}),f.lastError?o.jsx("p",{className:"af-schedule-card__error",children:f.lastError}):null]}),o.jsx("div",{className:"af-schedule-card__actions",children:o.jsxs("button",{type:"button",className:f.enabled?"af-schedule-toggle af-schedule-toggle--on":"af-schedule-toggle af-schedule-toggle--off",disabled:h,"aria-pressed":f.enabled,title:f.enabled?"点击停用":"点击启用",onClick:()=>void u(f),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:h?"hourglass_empty":f.enabled?"toggle_on":"toggle_off"}),f.enabled?"已启用":"已停用"]})})]},d)})})]})})]})}const Rj={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 Mj(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 Fee(e){var c,u,p,f,d,h,y,b,k,g,w,x;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((p=(u=t.ui)==null?void 0:u.card)==null?void 0:p.actions)?t.ui.card.actions:[],l=(f=e==null?void 0:e.test)!=null&&f.inputs&&typeof e.test.inputs=="object"?e.test.inputs:{};return[{id:"contract",label:"Contract",icon:"account_tree",rows:[...r.map(N=>[`input.${N.name||"-"}`,`${N.type||"text"}${N.required?" · required":""}${N.default?` · default: ${N.default}`:""}`]),...s.map(N=>[`output.${N.name||"-"}`,N.type||"text"]),...i.map(N=>[`config.${N.key||"-"}`,N.type||"text"])]},{id:"runtime",label:"Runtime",icon:"terminal",rows:[["runtime.type",((d=t.runtime)==null?void 0:d.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",((b=(y=t.ui)==null?void 0:y.card)==null?void 0:b.variant)||"default"],["card.icon",((g=(k=t.ui)==null?void 0:k.card)==null?void 0:g.icon)||"extension"],...a.map(N=>[`action.${N.id||N.label||"-"}`,N.variant||N.label||"secondary"])]},{id:"tests",label:"Tests",icon:"science",rows:[...Object.entries(l).map(([N,C])=>[`sample.${N}`,String(C)]),["last run",`${((w=e==null?void 0:e.test)==null?void 0:w.status)||"not run"}${(x=e==null?void 0:e.test)!=null&&x.durationMs?` · ${e.test.durationMs}ms`:""}`]]}]}function zee(){var R,T,$,M,O,P,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(""),[p,f]=m.useState(!1),[d,h]=m.useState(""),y=e||Rj,b=m.useMemo(()=>Fee(y),[y]),k=m.useMemo(()=>b.find(E=>E.id===n)||b[1],[n,b]),g=(y==null?void 0:y.manifest)||{},w=(y==null?void 0:y.config)||{},x=((R=y==null?void 0:y.test)==null?void 0:R.inputs)||{},N=Array.isArray((T=y==null?void 0:y.test)==null?void 0:T.log)?y.test.log:[],C=((M=($=g.ui)==null?void 0:$.card)==null?void 0:M.icon)||"event_repeat",j=((P=(O=g.ui)==null?void 0:O.card)==null?void 0:P.variant)||"default",_=w.enabled===!0,A=m.useCallback(async()=>{var E;l(!0),u("");try{const q=await fetch("/api/node-studio/drafts"),W=await q.json().catch(()=>({}));if(!q.ok)throw new Error(W.error||"读取节点草稿失败");const L=Array.isArray(W.drafts)?W.drafts[0]:null;if(!(L!=null&&L.id)){t(null),h("");return}const X=await fetch(`/api/node-studio/draft?id=${encodeURIComponent(L.id)}`),se=await X.json().catch(()=>({}));if(!X.ok)throw new Error(se.error||"读取节点草稿失败");t(se.draft||null),h(String(((E=se.draft)==null?void 0:E.promptDraft)||""))}catch(q){u(String(q.message||q))}finally{l(!1)}},[]);m.useEffect(()=>{A()},[A]);const F=m.useCallback(async(E={})=>{var q;f(!0),u("");try{const W=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",...E})}),L=await W.json().catch(()=>({}));if(!W.ok||L.ok===!1)throw new Error(L.error||"保存节点草稿失败");t(L.draft||e),h(String(((q=L.draft||e)==null?void 0:q.promptDraft)||""))}catch(W){u(String(W.message||W))}finally{f(!1)}},[e]),V=()=>{i(!0),window.setTimeout(()=>i(!1),900)},z=E=>{const q={...w,enabled:E};t(W=>({...W||Rj,config:q})),F({config:{enabled:E}})},D=()=>{F({promptDraft:d,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 A(),disabled:a,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"visibility"}),a?"Loading":"Preview"]}),o.jsxs("button",{type:"button",onClick:V,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(y==null?void 0:y.agentMessages)?y.agentMessages:[]).map((E,q)=>o.jsx("div",{className:E.role==="user"?"af-node-studio-message af-node-studio-message--user":"af-node-studio-message",children:E.text||""},`${E.role||"message"}-${q}`)),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:d,onChange:E=>h(E.target.value)})]}),o.jsxs("button",{type:"button",className:"af-node-studio-send",onClick:D,disabled:p,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:p?"sync":"send"}),p?"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:C}),o.jsx("strong",{children:y.title||g.name||"Untitled Node"}),o.jsx("code",{children:Mj(y)})]}),o.jsxs("label",{className:"af-node-preview-toggle",children:[o.jsx("input",{type:"checkbox",checked:_,onChange:E=>z(E.target.checked)}),o.jsx("span",{children:_?"定时开启":"定时关闭"})]}),o.jsxs("div",{className:"af-node-preview-fields",children:[o.jsxs("label",{children:[o.jsx("span",{children:"频率"}),o.jsxs("select",{value:w.scheduleType||"daily",onChange:E=>F({config:{scheduleType:E.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:w.hour||"09",onChange:E=>F({config:{hour:E.target.value}}),children:[o.jsx("option",{children:"09"}),o.jsx("option",{children:"10"})]}),o.jsxs("select",{value:w.minute||"00",onChange:E=>F({config:{minute:E.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:[w.scheduleType==="weekly"?"每周":"每天"," ",w.hour||"09",":",w.minute||"00"]}),o.jsx("span",{children:"Next -"}),o.jsx("span",{children:_?"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:C}),o.jsx("strong",{children:y.title||g.name||"Untitled Node"}),o.jsx("code",{children:Mj(y)})]}),o.jsxs("div",{className:"af-node-preview-default-body",children:[o.jsx("p",{children:g.description||"这个节点还没有描述。AI 生成 runtime、prompt 或 script 后,内部信息会显示在右侧。"}),o.jsxs("div",{children:[o.jsxs("span",{children:[Array.isArray(g.inputs)?g.inputs.length:0," inputs"]}),o.jsxs("span",{children:[Array.isArray(g.outputs)?g.outputs.length:0," outputs"]}),o.jsx("span",{children:((B=g.runtime)==null?void 0:B.type)||g.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:V,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:x.project||"",readOnly:!0,placeholder:"-"})]}),o.jsxs("label",{children:[o.jsx("span",{children:"date"}),o.jsx("input",{value:x.date||"",readOnly:!0,placeholder:"-"})]})]}),o.jsx("div",{className:"af-node-studio-log",children:(s?["running..."]:N.length?N:["No test run yet."]).map((E,q)=>o.jsx("span",{children:E},`${E}-${q}`))})]})]})]}),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:b.map(E=>o.jsxs("button",{type:"button",className:E.id===n?"af-node-studio-tab af-node-studio-tab--active":"af-node-studio-tab",onClick:()=>r(E.id),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:E.icon}),E.label]},E.id))}),o.jsx("div",{className:"af-node-studio-internal-list",children:k.rows.map(([E,q])=>o.jsxs("div",{className:"af-node-studio-internal-row",children:[o.jsx("span",{children:E}),o.jsx("strong",{children:q})]},E))}),o.jsx("pre",{className:"af-node-studio-code",children:k.id==="ui"?JSON.stringify(g.ui||{},null,2):k.id==="contract"?JSON.stringify({inputs:g.inputs||[],outputs:g.outputs||[],configSchema:g.configSchema||{}},null,2):k.id==="tests"?JSON.stringify((y==null?void 0:y.test)||{},null,2):JSON.stringify({runtime:g.runtime||{},files:(y==null?void 0:y.files)||{}},null,2)})]})]})]})}function Hee(){return`ws_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`}function Bee(e){return/^[A-Za-z_][A-Za-z0-9_]*$/.test(String(e||"").trim())}function Wee(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 Pg(){return{id:"",label:"",kind:"git",path:"",repoUrl:"",branch:"master",mountPath:"",credentialRef:"",type:"code",description:"",enabled:!0}}function Ef(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 Vee(e){const t=e.kind==="local"?"local":"git";return{id:String(e.id||"").trim(),label:String(e.label||"").trim(),kind:t,path:String(e.path||"").trim(),repoUrl:t==="git"?String(e.repoUrl||"").trim():"",branch:t==="git"?String(e.branch||"master").trim()||"master":"",mountPath:t==="git"?String(e.mountPath||"").trim():"",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 wi(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 Kee({ok:e}){return o.jsx("span",{className:"af-workspaces-dot"+(e?" af-workspaces-dot--ok":""),"aria-hidden":!0})}function $j({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||"Workspace"}),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(Kee,{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 Uee(){const[e,t]=m.useState(!1),[n,r]=m.useState(!1),[s,i]=m.useState(!1),[a,l]=m.useState(""),[c,u]=m.useState(""),[p,f]=m.useState(""),[d,h]=m.useState([]),[y,b]=m.useState([]),[k,g]=m.useState(Pg),[w,x]=m.useState(""),[N,C]=m.useState([]),[j,_]=m.useState(""),A=m.useMemo(()=>y.findIndex((W,L)=>wi(W,L)===j),[y,j]),V=!!m.useMemo(()=>d.find((W,L)=>wi(W,L)===j)||null,[d,j]),z=m.useMemo(()=>{const W=String(k.credentialRef||"").trim();return W?N.some(L=>String((L==null?void 0:L.key)||"").trim()===W&&String((L==null?void 0:L.value)??"")!==""):!1},[k.credentialRef,N]),D=m.useCallback(async()=>{t(!0),l("");try{const[W,L]=await Promise.all([fetch("/api/workspaces"),fetch("/api/user-env")]),X=await W.json().catch(()=>({})),se=await L.json().catch(()=>({}));if(!L.ok)throw new Error(typeof se.error=="string"?se.error:"ENV HTTP "+L.status);if(!W.ok)throw new Error(typeof X.error=="string"?X.error:"HTTP "+W.status);const ae=Array.isArray(X.workspaces)?X.workspaces:[],me=Array.isArray(X.customWorkspaces)?X.customWorkspaces:[];f(String(X.path||"")),h(ae.filter(re=>re==null?void 0:re.builtin)),b(me),C(Array.isArray(se.env)?se.env.map(re=>({key:String((re==null?void 0:re.key)||""),value:String((re==null?void 0:re.value)??"")})):[])}catch(W){l(String(W.message||W))}finally{t(!1)}},[]);m.useEffect(()=>{D()},[D]);const R=m.useCallback(async(W,L="")=>{r(!0),l(""),u("");try{const X=await fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaces:W})}),se=await X.json().catch(()=>({}));if(!X.ok)throw new Error(typeof se.error=="string"?se.error:"HTTP "+X.status);const ae=Array.isArray(se.customWorkspaces)?se.customWorkspaces:W;b(ae),h((Array.isArray(se.workspaces)?se.workspaces:[]).filter(me=>me==null?void 0:me.builtin)),f(String(se.path||p)),L&&_(L),u("已保存")}catch(X){l(String(X.message||X))}finally{r(!1)}},[p]),T=m.useCallback(()=>{_(""),g(Pg()),x(""),u(""),l("")},[]),$=m.useCallback((W,L)=>{_(wi(W,L)),g(Ef(W)),x(""),u("")},[]),M=m.useCallback((W,L)=>{_(wi(W,L)),g(Ef(W)),x(""),u("")},[]),O=m.useCallback(async(W,L)=>{const X=String(W||"").trim(),se=String(L??"");if(!X||!se)return;const ae=N.filter(de=>String((de==null?void 0:de.key)||"").trim()!==X);ae.push({key:X,value:se});const me=await fetch("/api/user-env",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:ae})}),re=await me.json().catch(()=>({}));if(!me.ok)throw new Error(typeof re.error=="string"?re.error:"ENV HTTP "+me.status);C(Array.isArray(re.env)?re.env.map(de=>({key:String((de==null?void 0:de.key)||""),value:String((de==null?void 0:de.value)??"")})):ae)},[N]),P=m.useCallback(()=>{const W=Vee({...k,id:k.id||Hee()}),L=w.trim();if(W.kind==="git"&&L&&!W.credentialRef&&(W.credentialRef=Wee(k,W)),W.kind==="local"&&!W.path){l("本地工作区需要填写路径");return}if(W.kind==="git"&&!W.repoUrl){l("Git 工作区需要填写 repoUrl");return}if(!W.label){l("请填写名称");return}if(W.kind==="git"&&W.credentialRef&&!Bee(W.credentialRef)){l("凭证环境变量只能使用字母、数字和下划线,且不能以数字开头");return}const X=A>=0?y.map((se,ae)=>ae===A?W:se):[W,...y];g(Ef(W)),(async()=>{r(!0);try{L&&await O(W.credentialRef,L),x(""),await R(X,wi(W))}catch(se){l(String(se.message||se)),r(!1)}})()},[y,k,R,O,A,w]),B=m.useCallback(()=>{if(A<0)return;const W=y.filter((L,X)=>X!==A);g(Pg()),_(""),R(W)},[y,R,A]),E=m.useCallback(async()=>{if(!V){if(A<0||!k.id){l("请先保存工作区配置,再拉取更新");return}if(k.kind!=="git"){l("只有 Git 工作区支持拉取更新");return}i(!0),l(""),u("");try{const W=await fetch("/api/workspaces/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:k.id})}),L=await W.json().catch(()=>({}));if(!W.ok)throw new Error(typeof L.error=="string"?L.error:"HTTP "+W.status);const X=Array.isArray(L.customWorkspaces)?L.customWorkspaces:y;b(X),h((Array.isArray(L.workspaces)?L.workspaces:[]).filter(me=>me==null?void 0:me.builtin));const se=X.find(me=>String((me==null?void 0:me.id)||"")===String(k.id||""));se&&g(Ef(se));const ae=String(L.commit||"").trim();u(L.changed?`已拉取更新${ae?`:${ae.slice(0,8)}`:""}`:`已是最新${ae?`:${ae.slice(0,8)}`:""}`)}catch(W){l(String(W.message||W))}finally{i(!1)}}},[y,k,V,A]),q=m.useCallback(W=>{g(L=>({...L,...W}))},[]);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:D,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:"维护可被 Load Workspace、一键任务和后续 Agent 运行使用的上下文目录。Git 字段与 mengmai 的资源配置保持一致。"}),p?o.jsxs("p",{className:"af-workspaces-config",children:["配置文件:",p]}):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:d.length})]}),o.jsxs("div",{children:[o.jsx("span",{children:"自定义"}),o.jsx("strong",{children:y.length})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Git"}),o.jsx("strong",{children:y.filter(W=>W.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:T,children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),"新增"]})]}),y.length?y.map((W,L)=>o.jsx($j,{item:W,selected:wi(W,L)===j,onClick:()=>$(W,L)},wi(W,L))):o.jsx("div",{className:"af-workspaces-empty",children:"暂无自定义工作区。新增 Git 或本地目录后,画布里的 Load Workspace 就可以选择它。"}),o.jsx("div",{className:"af-workspaces-section-head af-workspaces-section-head--sub",children:o.jsx("h2",{children:"内置工作区"})}),d.map((W,L)=>o.jsx($j,{item:W,selected:wi(W,L)===j,onClick:()=>M(W,L),readOnly:!0},wi(W,L)))]}),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:V?"查看内置工作区":A>=0?"编辑工作区":"新增工作区"}),o.jsx("p",{children:V?"内置项由当前运行环境提供,不能在这里修改。":"本地路径用于执行,Git 字段用于后续同步和上下文挂载。"})]}),o.jsxs("label",{className:"af-workspaces-switch",children:[o.jsx("input",{type:"checkbox",checked:k.enabled!==!1,disabled:V,onChange:W=>q({enabled:W.target.checked})}),o.jsx("span",{children:"启用"})]})]}),o.jsxs("div",{className:"af-workspaces-kind",children:[o.jsxs("button",{type:"button",className:k.kind==="git"?"active":"",disabled:V,onClick:()=>q({kind:"git",type:k.type==="local"?"code":k.type}),children:[o.jsx("span",{className:"material-symbols-outlined",children:"account_tree"}),"Git"]}),o.jsxs("button",{type:"button",className:k.kind==="local"?"active":"",disabled:V,onClick:()=>q({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:k.label,disabled:V,onChange:W=>q({label:W.target.value}),placeholder:"Likee Android"})]}),o.jsxs("label",{children:[o.jsx("span",{children:"类型"}),o.jsxs("select",{value:k.type,disabled:V,onChange:W=>q({type:W.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:k.path,disabled:V,onChange:W=>q({path:W.target.value}),placeholder:k.kind==="git"?"可空,默认保存到用户数据目录/workspaces/repos/<id>":"/Users/.../project"})]}),k.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:k.repoUrl,disabled:V,onChange:W=>q({repoUrl:W.target.value}),placeholder:"https://git.example.com/group/repo.git"})]}),o.jsxs("label",{children:[o.jsx("span",{children:"分支"}),o.jsx("input",{value:k.branch,disabled:V,onChange:W=>q({branch:W.target.value}),placeholder:"master"})]}),o.jsxs("label",{children:[o.jsx("span",{children:"挂载目录"}),o.jsx("input",{value:k.mountPath,disabled:V,onChange:W=>q({mountPath:W.target.value}),placeholder:"likee_android"})]}),o.jsxs("label",{className:"af-workspaces-form__wide",children:[o.jsx("span",{children:"凭证环境变量"}),o.jsx("input",{value:k.credentialRef,disabled:V,onChange:W=>q({credentialRef:W.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:w,disabled:V,onChange:W=>x(W.target.value),placeholder:z?"已在个人环境变量中配置;留空则不修改":"保存到个人环境变量,不写入 workspace 配置"}),o.jsx("small",{children:"保存后只在 workspace 配置中保留 credentialRef,token 会写入当前用户的个人环境变量。"})]})]}):null,o.jsxs("label",{className:"af-workspaces-form__wide",children:[o.jsx("span",{children:"说明"}),o.jsx("textarea",{value:k.description,disabled:V,onChange:W=>q({description:W.target.value}),placeholder:"这个工作区包含哪些代码、文档或需求上下文"})]})]}),o.jsxs("div",{className:"af-workspaces-actions",children:[!V&&A>=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:[k.kind==="git"&&A>=0?o.jsxs("button",{type:"button",onClick:E,disabled:V||n||s,children:[o.jsx("span",{className:"material-symbols-outlined",children:s?"sync":"download"}),s?"拉取中":"拉取更新"]}):null,o.jsx("button",{type:"button",onClick:T,disabled:n||s,children:"重置"}),o.jsxs("button",{type:"button",className:"af-workspaces-primary",onClick:P,disabled:V||n||s,children:[o.jsx("span",{className:"material-symbols-outlined",children:"save"}),n?"保存中":"保存"]})]})]})]})]})]})})]})}const qee=[{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"}],Yee=[{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 长文档","客户端原型预览","图表与表格","统一展示链接"]}],Gee=[{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"}],Jee=[["知识库","查客户端、后台、前端逻辑","广告、Feed、会员、增长、配置、接口调用链"],["数据","查 CK / Hive 并输出 SQL","PV、UV、转化、分页面、分国家、分实验组"],["产物","生成原型、PRD、Display 面板","Markdown、HTML 原型、图表、表格、交互预览"],["协作","同步 TAPD 与 Git 仓库","需求正文、变更记录、MR 链接、评审材料"]];function Af({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 Xee(){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(Af,{icon:"travel_explore",title:"全局上下文",label:"Likee 业务、代码、数据",tone:"pink"})}),o.jsx("div",{className:"likee-node-pos likee-node-b",children:o.jsx(Af,{icon:"database",title:"CK / Hive",label:"自动 SQL 与指标口径",tone:"cyan"})}),o.jsx("div",{className:"likee-node-pos likee-node-c",children:o.jsx(Af,{icon:"article",title:"需求文档",label:"PRD、变更说明、评审稿",tone:"amber"})}),o.jsx("div",{className:"likee-node-pos likee-node-d",children:o.jsx(Af,{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 tp({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 Qee(){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(tp,{kicker:"SKILLS",title:"用 Skills 把 Likee 上下文变成可复用能力",children:"Skills 是工作区里可加载的能力包。手动搭建工作区时,只需要按场景加载对应 Skill。"}),o.jsx("div",{className:"likee-skill-grid",children:Gee.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 yI(){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(Xee,{}),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(tp,{kicker:"SCENARIO TRIGGERS",title:"打造 Likee 团队全景上下文",children:"不要求先会写 Prompt,也不要求知道该找哪个系统。选择一个业务场景,工作台会把需要的 Likee 上下文、数据查询和最终产物组织起来。"}),o.jsx("div",{className:"likee-scenario-grid",children:qee.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(tp,{kicker:"USE CASES",title:"沉淀 Likee 业务流水线",children:"这里展示的是平台里实际可跑的工作流:加载流程片段,在子 Agent 或 Run 节点输入业务问题,执行当前 line,最终在 Display、TAPD 和 Git 中拿到结果。"}),o.jsx("div",{className:"likee-usecase-stack",children:Yee.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(Qee,{}),o.jsx("section",{className:"likee-section",children:o.jsxs("div",{className:"likee-section-inner likee-two-column likee-capability-layout",children:[o.jsx(tp,{kicker:"CAPABILITY MAP",title:"每个场景背后,都连接同一套 Likee 上下文能力",children:"工作台把知识库、CK / Hive、原型、PRD、TAPD 和 Git 放到同一条链路里。用户看到的是业务场景,系统处理的是上下文、产物和同步。"}),o.jsx("div",{className:"likee-capability-table",children:Jee.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 xI(e){return t=>typeof t===e}var Zee=xI("function"),ete=e=>e===null,Lj=e=>Object.prototype.toString.call(e).slice(8,-1)==="RegExp",Oj=e=>!tte(e)&&!ete(e)&&(Zee(e)||typeof e=="object"),tte=xI("undefined");function nte(e,t,n){return cte(n,e,t)?!0:(ute(n,e,t),e.constructor!==t.constructor?!1:Array.isArray(e)&&Array.isArray(t)?rte(e,t,n):e instanceof Map&&t instanceof Map?ote(e,t,n):e instanceof Set&&t instanceof Set?lte(e,t):e instanceof WeakMap||e instanceof WeakSet?!1:ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)?ste(e,t):Lj(e)&&Lj(t)?e.source===t.source&&e.flags===t.flags:e instanceof Error&&t instanceof Error?ite(e,t,n):e.valueOf!==Object.prototype.valueOf?e.valueOf()===t.valueOf():e.toString!==Object.prototype.toString?e.toString()===t.toString():ate(e,t,n))}function ad(e,t,n){return e===t||Number.isNaN(e)&&Number.isNaN(t)?!0:!e||!Oj(e)||!t||!Oj(t)?!1:nte(e,t,n)}function rte(e,t,n){const{length:r}=e;if(r!==t.length)return!1;for(let s=r;s--!==0;)if(!ad(e[s],t[s],n))return!1;return!0}function ste(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 ite(e,t,n){return e.message===t.message&&e.name===t.name&&ad(e.cause,t.cause,n)}function ote(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(!ad(r[1],t.get(r[0]),n))return!1;return!0}function ate(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)&&!ad(e[i],t[i],n))return!1}return!0}function lte(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 cte(e,t,n){var r;return((r=e.get(t))==null?void 0:r.has(n))??!1}function ute(e,t,n){let r=e.get(t);r||(r=new WeakSet,e.set(t,r)),r.add(n)}function vb(e,t){return ad(e,t,new WeakMap)}function Ig(){var e;return!!(typeof window<"u"&&((e=window==null?void 0:window.document)!=null&&e.createElement))}function dte(e,...t){e&&e.removeEventListener&&e.removeEventListener(...t)}function fte(e,...t){e&&e.addEventListener&&e.addEventListener(...t)}function pte(){const e=m.useRef(!0);return e.current?(e.current=!1,!0):e.current}function hte(e,t){const n=pte();m.useEffect(()=>{if(!n)return e()},t)}function wI(e){const t=m.useRef(void 0);return m.useEffect(()=>{t.current=e}),t.current}function mte(e,t){const n=m.useRef(t);return vb(t,n.current)||(n.current=t),m.useMemo(e,n.current)}function gte(e){m.useEffect(()=>{e()},[])}function yte(e=0){const[t,n]=m.useState({height:Ig()?window.innerHeight:0,width:Ig()?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(!Ig())return()=>{};const i=s.current;return n({height:window.innerHeight,width:window.innerWidth}),fte(window,"resize",i),()=>{dte(window,"resize",i)}},[]),t}var xte=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","URL","WeakMap","WeakSet"],wte=["bigint","boolean","null","number","string","symbol","undefined"];function ld(e){const t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(bte(t))return t}function Ws(e){return t=>ld(t)===e}function bte(e){return xte.includes(e)}function Yl(e){return t=>typeof t===e}function kte(e){return wte.includes(e)}var vte=["innerHTML","ownerDocument","style","attributes","nodeValue"],cd=e=>Array.isArray(e),Ste=e=>ld(e)==="AsyncGeneratorFunction",Nte=Ws("AsyncFunction"),jte=Yl("bigint"),Cte=e=>e===!0||e===!1,_te=Ws("Date"),Ete=Ws("Error"),No=Yl("function"),Ate=Ws("GeneratorFunction"),Pte=e=>typeof e=="number"&&Number.isInteger(e),_x=Ws("Map"),bI=e=>Number.isNaN(e),Sb=e=>e===null,kI=Ws("Function"),Ite=Ws("Promise"),Tte=Ws("RegExp"),Ex=Ws("Set"),ud=Yl("string"),Rte=Yl("symbol"),Nb=Yl("undefined"),Mte=Ws("WeakMap"),$te=Ws("WeakSet"),jb=e=>Sb(e)||Nb(e),vI=e=>!Nb(e),Lte=e=>Yl("number")(e)&&!bI(e),Ote=e=>ud(e)&&e.trim().length>0,Dte=e=>{if(!ud(e)||e.length===0)return!1;const t=e.trim();return t.length>0&&Number.isFinite(Number(t))},zh=e=>!jb(e)&&(No(e)||typeof e=="object"),SI=e=>{if(ld(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})},Fte=e=>Sb(e)||kte(typeof e),zte=e=>ld(e)==="URL",NI=e=>!jb(e)&&No(e[Symbol.iterator]),Hte=e=>NI(e)&&No(e.next)&&No(e.throw),Bte=e=>No(e)&&/^class\s/.test(e.toString()),Wte=(e,t)=>!cd(e)||!No(t)?!1:e.every(n=>t(n)),Vte=e=>zh(e)&&!SI(e)&&e.nodeType===1&&ud(e.nodeName)&&vte.every(t=>t in e),Kte=e=>ud(e)&&e.length===0||cd(e)&&e.length===0||zh(e)&&!_x(e)&&!Ex(e)&&Object.keys(e).length===0||Ex(e)&&e.size===0||_x(e)&&e.size===0,Ute=(e,t)=>!e||!t?!1:Object.getPrototypeOf(e)===t.prototype,qte=(e,t)=>cd(e)?e.indexOf(t)>-1:!1,Yte=(e,t,n)=>{if(!zh(e)||!t)return!1;const r=e[t];return No(n)?n(r):vI(r)};function yt(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(cd(e))return"Array";if(kI(e))return"Function";const t=ld(e);return t||"Object"}yt.array=cd;yt.arrayOf=Wte;yt.asyncGeneratorFunction=Ste;yt.asyncFunction=Nte;yt.bigint=jte;yt.boolean=Cte;yt.class=Bte;yt.date=_te;yt.defined=vI;yt.domElement=Vte;yt.empty=Kte;yt.error=Ete;yt.function=No;yt.generator=Hte;yt.generatorFunction=Ate;yt.instanceOf=Ute;yt.integer=Pte;yt.iterable=NI;yt.map=_x;yt.nan=bI;yt.null=Sb;yt.nullOrUndefined=jb;yt.nonEmptyString=Ote;yt.number=Lte;yt.numericString=Dte;yt.object=zh;yt.oneOf=qte;yt.plainFunction=kI;yt.plainObject=SI;yt.primitive=Fte;yt.promise=Ite;yt.propertyOf=Yte;yt.regexp=Tte;yt.set=Ex;yt.string=ud;yt.symbol=Rte;yt.undefined=Nb;yt.url=zte;yt.weakMap=Mte;yt.weakSet=$te;var dr=yt;/* v8 ignore next -- @preserve */var Gte=function(e){return Object.prototype.hasOwnProperty.call(e,"props")},Jte=function(e,t){return e+Wu(t)},Wu=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(Jte,""):Gte(e)&&Object.prototype.hasOwnProperty.call(e.props,"children")?Wu(e.props.children):""};Wu.default=Wu;var Xte=Wu;const Tg=Co(Xte);var jI={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(C){return C!=="constructor"&&C!=="prototype"&&C!=="__proto__"}function a(C){let j=0;const _=C.length,A=new Array(_);for(j;j<_;++j)A[j]=g(C[j]);return A}function l(C){const j={};if(d&&Object.getPrototypeOf(C)!==t)return d(C);const _=f(C);let A,F,V;for(A=0,F=_.length;A<F;++A)i(V=_[A])&&(j[V]=g(C[V]));return j}function c(C,j){const _=C.length,A=j.length;let F=0;const V=new Array(_+A);for(F;F<_;++F)V[F]=g(C[F]);for(F=0;F<A;++F)V[F+_]=g(j[F]);return V}const u=Object.prototype.propertyIsEnumerable;function p(C){const j=Object.keys(C),_=Object.getOwnPropertySymbols(C);for(let A=0,F=_.length;A<F;++A)u.call(C,_[A])&&j.push(_[A]);return j}const f=s!=null&&s.symbols?p:Object.keys,d=typeof(s==null?void 0:s.cloneProtoObject)=="function"?s.cloneProtoObject:void 0,h=typeof(s==null?void 0:s.isMergeableObject)=="function"?s.isMergeableObject:n(),y=(s==null?void 0:s.onlyDefinedProperties)===!0;function b(C){return typeof C!="object"||C===null}const k=s&&typeof s.mergeArray=="function"?s.mergeArray({clone:g,deepmerge:x,getKeys:f,isMergeableObject:h}):c;function g(C){return h(C)?Array.isArray(C)?a(C):l(C):C}function w(C,j){const _={},A=f(C),F=f(j);let V,z,D;for(V=0,z=A.length;V<z;++V)i(D=A[V])&&F.indexOf(D)===-1&&(_[D]=g(C[D]));for(V=0,z=F.length;V<z;++V)if(i(D=F[V]))if(D in C)A.indexOf(D)!==-1&&(d&&h(j[D])&&Object.getPrototypeOf(j[D])!==t?_[D]=d(j[D]):_[D]=x(C[D],j[D]));else{if(y&&typeof j[D]>"u")continue;_[D]=g(j[D])}return _}function x(C,j){if(y&&typeof j>"u")return g(C);const _=Array.isArray(j),A=Array.isArray(C);return b(j)?j:h(C)?_&&A?k(C,j):_!==A?g(j):w(C,j):g(j)}function N(){switch(arguments.length){case 0:return{};case 1:return g(arguments[0]);case 2:return x(arguments[0],arguments[1])}let C;for(let j=0,_=arguments.length;j<_;++j)C=x(C,arguments[j]);return C}return s!=null&&s.all?N:x}e.exports=r,e.exports.default=r,e.exports.deepmerge=r,Object.defineProperty(e.exports,"isMergeableObject",{get:n})})(jI);var Qte=jI.exports;const Zte=Co(Qte);var ene=new Error("Element already at target scroll position"),tne=new Error("Scroll cancelled"),nne=Math.min,Dj=Date.now,rne={left:Fj("scrollLeft"),top:Fj("scrollTop")};function Fj(e){return function(n,r,s,i){s=s||{},typeof s=="function"&&(i=s,s={}),typeof i!="function"&&(i=ine);var a=Dj(),l=n[e],c=s.ease||sne,u=isNaN(s.duration)?350:+s.duration,p=!1;return l===r?i(ene,n[e]):requestAnimationFrame(d),f;function f(){p=!0}function d(h){if(p)return i(tne,n[e]);var y=Dj(),b=nne(1,(y-a)/u),k=c(b);n[e]=k*(r-l)+l,b<1?requestAnimationFrame(d):requestAnimationFrame(function(){i(null,n[e])})}}}function sne(e){return .5*(1-Math.cos(Math.PI*e))}function ine(){}const one=Co(rne);var CI={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.Scrollparent=n()})(au,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})})(CI);var ane=CI.exports;const _I=Co(ane),lne=["top","right","bottom","left"],zj=["start","end"],Hj=lne.reduce((e,t)=>e.concat(t,t+"-"+zj[0],t+"-"+zj[1]),[]),Fl=Math.min,na=Math.max,Xp=Math.round,Pf=Math.floor,oi=e=>({x:e,y:e}),cne={left:"right",right:"left",bottom:"top",top:"bottom"};function Ax(e,t,n){return na(e,Fl(t,n))}function Gl(e,t){return typeof e=="function"?e(t):e}function $i(e){return e.split("-")[0]}function ai(e){return e.split("-")[1]}function EI(e){return e==="x"?"y":"x"}function Cb(e){return e==="y"?"height":"width"}function lo(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function _b(e){return EI(lo(e))}function AI(e,t,n){n===void 0&&(n=!1);const r=ai(e),s=_b(e),i=Cb(s);let a=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=Zp(a)),[a,Zp(a)]}function une(e){const t=Zp(e);return[Qp(e),t,Qp(t)]}function Qp(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Bj=["left","right"],Wj=["right","left"],dne=["top","bottom"],fne=["bottom","top"];function pne(e,t,n){switch(e){case"top":case"bottom":return n?t?Wj:Bj:t?Bj:Wj;case"left":case"right":return t?dne:fne;default:return[]}}function hne(e,t,n,r){const s=ai(e);let i=pne($i(e),n==="start",r);return s&&(i=i.map(a=>a+"-"+s),t&&(i=i.concat(i.map(Qp)))),i}function Zp(e){const t=$i(e);return cne[t]+e.slice(t.length)}function mne(e){return{top:0,right:0,bottom:0,left:0,...e}}function PI(e){return typeof e!="number"?mne(e):{top:e,right:e,bottom:e,left:e}}function eh(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 Vj(e,t,n){let{reference:r,floating:s}=e;const i=lo(t),a=_b(t),l=Cb(a),c=$i(t),u=i==="y",p=r.x+r.width/2-s.width/2,f=r.y+r.height/2-s.height/2,d=r[l]/2-s[l]/2;let h;switch(c){case"top":h={x:p,y:r.y-s.height};break;case"bottom":h={x:p,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:f};break;case"left":h={x:r.x-s.width,y:f};break;default:h={x:r.x,y:r.y}}switch(ai(t)){case"start":h[a]-=d*(n&&u?-1:1);break;case"end":h[a]+=d*(n&&u?-1:1);break}return h}async function gne(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:p="viewport",elementContext:f="floating",altBoundary:d=!1,padding:h=0}=Gl(t,e),y=PI(h),k=l[d?f==="floating"?"reference":"floating":f],g=eh(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(k)))==null||n?k:k.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:u,rootBoundary:p,strategy:c})),w=f==="floating"?{x:r,y:s,width:a.floating.width,height:a.floating.height}:a.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),N=await(i.isElement==null?void 0:i.isElement(x))?await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1}:{x:1,y:1},C=eh(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:w,offsetParent:x,strategy:c}):w);return{top:(g.top-C.top+y.top)/N.y,bottom:(C.bottom-g.bottom+y.bottom)/N.y,left:(g.left-C.left+y.left)/N.x,right:(C.right-g.right+y.right)/N.x}}const yne=50,xne=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:gne},c=await(a.isRTL==null?void 0:a.isRTL(t));let u=await a.getElementRects({reference:e,floating:t,strategy:s}),{x:p,y:f}=Vj(u,r,c),d=r,h=0;const y={};for(let b=0;b<i.length;b++){const k=i[b];if(!k)continue;const{name:g,fn:w}=k,{x,y:N,data:C,reset:j}=await w({x:p,y:f,initialPlacement:r,placement:d,strategy:s,middlewareData:y,rects:u,platform:l,elements:{reference:e,floating:t}});p=x??p,f=N??f,y[g]={...y[g],...C},j&&h<yne&&(h++,typeof j=="object"&&(j.placement&&(d=j.placement),j.rects&&(u=j.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:s}):j.rects),{x:p,y:f}=Vj(u,d,c)),b=-1)}return{x:p,y:f,placement:d,strategy:s,middlewareData:y}},wne=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:p=0}=Gl(e,t)||{};if(u==null)return{};const f=PI(p),d={x:n,y:r},h=_b(s),y=Cb(h),b=await a.getDimensions(u),k=h==="y",g=k?"top":"left",w=k?"bottom":"right",x=k?"clientHeight":"clientWidth",N=i.reference[y]+i.reference[h]-d[h]-i.floating[y],C=d[h]-i.reference[h],j=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let _=j?j[x]:0;(!_||!await(a.isElement==null?void 0:a.isElement(j)))&&(_=l.floating[x]||i.floating[y]);const A=N/2-C/2,F=_/2-b[y]/2-1,V=Fl(f[g],F),z=Fl(f[w],F),D=V,R=_-b[y]-z,T=_/2-b[y]/2+A,$=Ax(D,T,R),M=!c.arrow&&ai(s)!=null&&T!==$&&i.reference[y]/2-(T<D?V:z)-b[y]/2<0,O=M?T<D?T-D:T-R:0;return{[h]:d[h]+O,data:{[h]:$,centerOffset:T-$-O,...M&&{alignmentOffset:O}},reset:M}}});function bne(e,t,n){return(e?[...n.filter(s=>ai(s)===e),...n.filter(s=>ai(s)!==e)]:n.filter(s=>$i(s)===s)).filter(s=>e?ai(s)===e||(t?Qp(s)!==s:!1):!0)}const kne=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:p=!1,alignment:f,allowedPlacements:d=Hj,autoAlignment:h=!0,...y}=Gl(e,t),b=f!==void 0||d===Hj?bne(f||null,h,d):d,k=await c.detectOverflow(t,y),g=((n=a.autoPlacement)==null?void 0:n.index)||0,w=b[g];if(w==null)return{};const x=AI(w,i,await(c.isRTL==null?void 0:c.isRTL(u.floating)));if(l!==w)return{reset:{placement:b[0]}};const N=[k[$i(w)],k[x[0]],k[x[1]]],C=[...((r=a.autoPlacement)==null?void 0:r.overflows)||[],{placement:w,overflows:N}],j=b[g+1];if(j)return{data:{index:g+1,overflows:C},reset:{placement:j}};const _=C.map(V=>{const z=ai(V.placement);return[V.placement,z&&p?V.overflows.slice(0,2).reduce((D,R)=>D+R,0):V.overflows[0],V.overflows]}).sort((V,z)=>V[1]-z[1]),F=((s=_.filter(V=>V[2].slice(0,ai(V[0])?2:3).every(z=>z<=0))[0])==null?void 0:s[0])||_[0][0];return F!==l?{data:{index:g+1,overflows:C},reset:{placement:F}}:{}}}},vne=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:p=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:b=!0,...k}=Gl(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const g=$i(s),w=lo(l),x=$i(l)===l,N=await(c.isRTL==null?void 0:c.isRTL(u.floating)),C=d||(x||!b?[Zp(l)]:une(l)),j=y!=="none";!d&&j&&C.push(...hne(l,b,y,N));const _=[l,...C],A=await c.detectOverflow(t,k),F=[];let V=((r=i.flip)==null?void 0:r.overflows)||[];if(p&&F.push(A[g]),f){const T=AI(s,a,N);F.push(A[T[0]],A[T[1]])}if(V=[...V,{placement:s,overflows:F}],!F.every(T=>T<=0)){var z,D;const T=(((z=i.flip)==null?void 0:z.index)||0)+1,$=_[T];if($&&(!(f==="alignment"?w!==lo($):!1)||V.every(P=>lo(P.placement)===w?P.overflows[0]>0:!0)))return{data:{index:T,overflows:V},reset:{placement:$}};let M=(D=V.filter(O=>O.overflows[0]<=0).sort((O,P)=>O.overflows[1]-P.overflows[1])[0])==null?void 0:D.placement;if(!M)switch(h){case"bestFit":{var R;const O=(R=V.filter(P=>{if(j){const B=lo(P.placement);return B===w||B==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(B=>B>0).reduce((B,E)=>B+E,0)]).sort((P,B)=>P[1]-B[1])[0])==null?void 0:R[0];O&&(M=O);break}case"initialPlacement":M=l;break}if(s!==M)return{reset:{placement:M}}}return{}}}},Sne=new Set(["left","top"]);async function Nne(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),a=$i(n),l=ai(n),c=lo(n)==="y",u=Sne.has(a)?-1:1,p=i&&c?-1:1,f=Gl(t,e);let{mainAxis:d,crossAxis:h,alignmentAxis:y}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof y=="number"&&(h=l==="end"?y*-1:y),c?{x:h*p,y:d*u}:{x:d*u,y:h*p}}const jne=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 Nne(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}}}}},Cne=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:g=>{let{x:w,y:x}=g;return{x:w,y:x}}},...u}=Gl(e,t),p={x:n,y:r},f=await i.detectOverflow(t,u),d=lo($i(s)),h=EI(d);let y=p[h],b=p[d];if(a){const g=h==="y"?"top":"left",w=h==="y"?"bottom":"right",x=y+f[g],N=y-f[w];y=Ax(x,y,N)}if(l){const g=d==="y"?"top":"left",w=d==="y"?"bottom":"right",x=b+f[g],N=b-f[w];b=Ax(x,b,N)}const k=c.fn({...t,[h]:y,[d]:b});return{...k,data:{x:k.x-n,y:k.y-r,enabled:{[h]:a,[d]:l}}}}}};function Hh(){return typeof window<"u"}function Jl(e){return II(e)?(e.nodeName||"").toLowerCase():"#document"}function es(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function fi(e){var t;return(t=(II(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function II(e){return Hh()?e instanceof Node||e instanceof es(e).Node:!1}function zs(e){return Hh()?e instanceof Element||e instanceof es(e).Element:!1}function Fi(e){return Hh()?e instanceof HTMLElement||e instanceof es(e).HTMLElement:!1}function Kj(e){return!Hh()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof es(e).ShadowRoot}function dd(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=Hs(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function _ne(e){return/^(table|td|th)$/.test(Jl(e))}function Bh(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Ene=/transform|translate|scale|rotate|perspective|filter/,Ane=/paint|layout|strict|content/,Oo=e=>!!e&&e!=="none";let Rg;function Eb(e){const t=zs(e)?Hs(e):e;return Oo(t.transform)||Oo(t.translate)||Oo(t.scale)||Oo(t.rotate)||Oo(t.perspective)||!Ab()&&(Oo(t.backdropFilter)||Oo(t.filter))||Ene.test(t.willChange||"")||Ane.test(t.contain||"")}function Pne(e){let t=jo(e);for(;Fi(t)&&!zl(t);){if(Eb(t))return t;if(Bh(t))return null;t=jo(t)}return null}function Ab(){return Rg==null&&(Rg=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Rg}function zl(e){return/^(html|body|#document)$/.test(Jl(e))}function Hs(e){return es(e).getComputedStyle(e)}function Wh(e){return zs(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function jo(e){if(Jl(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Kj(e)&&e.host||fi(e);return Kj(t)?t.host:t}function TI(e){const t=jo(e);return zl(t)?e.ownerDocument?e.ownerDocument.body:e.body:Fi(t)&&dd(t)?t:TI(t)}function Vu(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=TI(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),a=es(s);if(i){const l=Px(a);return t.concat(a,a.visualViewport||[],dd(s)?s:[],l&&n?Vu(l):[])}else return t.concat(s,Vu(s,[],n))}function Px(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function RI(e){const t=Hs(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=Fi(e),i=s?e.offsetWidth:n,a=s?e.offsetHeight:r,l=Xp(n)!==i||Xp(r)!==a;return l&&(n=i,r=a),{width:n,height:r,$:l}}function Pb(e){return zs(e)?e:e.contextElement}function vl(e){const t=Pb(e);if(!Fi(t))return oi(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=RI(t);let a=(i?Xp(n.width):n.width)/r,l=(i?Xp(n.height):n.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const Ine=oi(0);function MI(e){const t=es(e);return!Ab()||!t.visualViewport?Ine:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Tne(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==es(e)?!1:t}function xa(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=Pb(e);let a=oi(1);t&&(r?zs(r)&&(a=vl(r)):a=vl(e));const l=Tne(i,n,r)?MI(i):oi(0);let c=(s.left+l.x)/a.x,u=(s.top+l.y)/a.y,p=s.width/a.x,f=s.height/a.y;if(i){const d=es(i),h=r&&zs(r)?es(r):r;let y=d,b=Px(y);for(;b&&r&&h!==y;){const k=vl(b),g=b.getBoundingClientRect(),w=Hs(b),x=g.left+(b.clientLeft+parseFloat(w.paddingLeft))*k.x,N=g.top+(b.clientTop+parseFloat(w.paddingTop))*k.y;c*=k.x,u*=k.y,p*=k.x,f*=k.y,c+=x,u+=N,y=es(b),b=Px(y)}}return eh({width:p,height:f,x:c,y:u})}function Vh(e,t){const n=Wh(e).scrollLeft;return t?t.left+n:xa(fi(e)).left+n}function $I(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Vh(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function Rne(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",a=fi(r),l=t?Bh(t.floating):!1;if(r===a||l&&i)return n;let c={scrollLeft:0,scrollTop:0},u=oi(1);const p=oi(0),f=Fi(r);if((f||!f&&!i)&&((Jl(r)!=="body"||dd(a))&&(c=Wh(r)),f)){const h=xa(r);u=vl(r),p.x=h.x+r.clientLeft,p.y=h.y+r.clientTop}const d=a&&!f&&!i?$I(a,c):oi(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+p.x+d.x,y:n.y*u.y-c.scrollTop*u.y+p.y+d.y}}function Mne(e){return Array.from(e.getClientRects())}function $ne(e){const t=fi(e),n=Wh(e),r=e.ownerDocument.body,s=na(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=na(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+Vh(e);const l=-n.scrollTop;return Hs(r).direction==="rtl"&&(a+=na(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:a,y:l}}const Uj=25;function Lne(e,t){const n=es(e),r=fi(e),s=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,c=0;if(s){i=s.width,a=s.height;const p=Ab();(!p||p&&t==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}const u=Vh(r);if(u<=0){const p=r.ownerDocument,f=p.body,d=getComputedStyle(f),h=p.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,y=Math.abs(r.clientWidth-f.clientWidth-h);y<=Uj&&(i-=y)}else u<=Uj&&(i+=u);return{width:i,height:a,x:l,y:c}}function One(e,t){const n=xa(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=Fi(e)?vl(e):oi(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 qj(e,t,n){let r;if(t==="viewport")r=Lne(e,n);else if(t==="document")r=$ne(fi(e));else if(zs(t))r=One(t,n);else{const s=MI(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return eh(r)}function LI(e,t){const n=jo(e);return n===t||!zs(n)||zl(n)?!1:Hs(n).position==="fixed"||LI(n,t)}function Dne(e,t){const n=t.get(e);if(n)return n;let r=Vu(e,[],!1).filter(l=>zs(l)&&Jl(l)!=="body"),s=null;const i=Hs(e).position==="fixed";let a=i?jo(e):e;for(;zs(a)&&!zl(a);){const l=Hs(a),c=Eb(a);!c&&l.position==="fixed"&&(s=null),(i?!c&&!s:!c&&l.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||dd(a)&&!c&&LI(e,a))?r=r.filter(p=>p!==a):s=l,a=jo(a)}return t.set(e,r),r}function Fne(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const a=[...n==="clippingAncestors"?Bh(t)?[]:Dne(t,this._c):[].concat(n),r],l=qj(t,a[0],s);let c=l.top,u=l.right,p=l.bottom,f=l.left;for(let d=1;d<a.length;d++){const h=qj(t,a[d],s);c=na(h.top,c),u=Fl(h.right,u),p=Fl(h.bottom,p),f=na(h.left,f)}return{width:u-f,height:p-c,x:f,y:c}}function zne(e){const{width:t,height:n}=RI(e);return{width:t,height:n}}function Hne(e,t,n){const r=Fi(t),s=fi(t),i=n==="fixed",a=xa(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=oi(0);function u(){c.x=Vh(s)}if(r||!r&&!i)if((Jl(t)!=="body"||dd(s))&&(l=Wh(t)),r){const h=xa(t,!0,i,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else s&&u();i&&!r&&s&&u();const p=s&&!r&&!i?$I(s,l):oi(0),f=a.left+l.scrollLeft-c.x-p.x,d=a.top+l.scrollTop-c.y-p.y;return{x:f,y:d,width:a.width,height:a.height}}function Mg(e){return Hs(e).position==="static"}function Yj(e,t){if(!Fi(e)||Hs(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return fi(e)===n&&(n=n.ownerDocument.body),n}function OI(e,t){const n=es(e);if(Bh(e))return n;if(!Fi(e)){let s=jo(e);for(;s&&!zl(s);){if(zs(s)&&!Mg(s))return s;s=jo(s)}return n}let r=Yj(e,t);for(;r&&_ne(r)&&Mg(r);)r=Yj(r,t);return r&&zl(r)&&Mg(r)&&!Eb(r)?n:r||Pne(e)||n}const Bne=async function(e){const t=this.getOffsetParent||OI,n=this.getDimensions,r=await n(e.floating);return{reference:Hne(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Wne(e){return Hs(e).direction==="rtl"}const Vne={convertOffsetParentRelativeRectToViewportRelativeRect:Rne,getDocumentElement:fi,getClippingRect:Fne,getOffsetParent:OI,getElementRects:Bne,getClientRects:Mne,getDimensions:zne,getScale:vl,isElement:zs,isRTL:Wne};function DI(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Kne(e,t){let n=null,r;const s=fi(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:p,top:f,width:d,height:h}=u;if(l||t(),!d||!h)return;const y=Pf(f),b=Pf(s.clientWidth-(p+d)),k=Pf(s.clientHeight-(f+h)),g=Pf(p),x={rootMargin:-y+"px "+-b+"px "+-k+"px "+-g+"px",threshold:na(0,Fl(1,c))||1};let N=!0;function C(j){const _=j[0].intersectionRatio;if(_!==c){if(!N)return a();_?a(!1,_):r=setTimeout(()=>{a(!1,1e-7)},1e3)}_===1&&!DI(u,e.getBoundingClientRect())&&a(),N=!1}try{n=new IntersectionObserver(C,{...x,root:s.ownerDocument})}catch{n=new IntersectionObserver(C,x)}n.observe(e)}return a(!0),i}function Gj(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=Pb(e),p=s||i?[...u?Vu(u):[],...t?Vu(t):[]]:[];p.forEach(g=>{s&&g.addEventListener("scroll",n,{passive:!0}),i&&g.addEventListener("resize",n)});const f=u&&l?Kne(u,n):null;let d=-1,h=null;a&&(h=new ResizeObserver(g=>{let[w]=g;w&&w.target===u&&h&&t&&(h.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var x;(x=h)==null||x.observe(t)})),n()}),u&&!c&&h.observe(u),t&&h.observe(t));let y,b=c?xa(e):null;c&&k();function k(){const g=xa(e);b&&!DI(b,g)&&n(),b=g,y=requestAnimationFrame(k)}return n(),()=>{var g;p.forEach(w=>{s&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),f==null||f(),(g=h)==null||g.disconnect(),h=null,c&&cancelAnimationFrame(y)}}const Une=jne,qne=kne,Yne=Cne,Gne=vne,Jj=wne,Jne=(e,t,n)=>{const r=new Map,s={platform:Vne,...n},i={...s.platform,_c:r};return xne(e,t,{...s,platform:i})};var Xne=typeof document<"u",Qne=function(){},np=Xne?m.useLayoutEffect:Qne;function th(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(!th(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)&&!th(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function FI(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Xj(e,t){const n=FI(e);return Math.round(t*n)/n}function $g(e){const t=m.useRef(e);return np(()=>{t.current=e}),t}function Qj(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,[p,f]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[d,h]=m.useState(r);th(d,r)||h(r);const[y,b]=m.useState(null),[k,g]=m.useState(null),w=m.useCallback(P=>{P!==j.current&&(j.current=P,b(P))},[]),x=m.useCallback(P=>{P!==_.current&&(_.current=P,g(P))},[]),N=i||y,C=a||k,j=m.useRef(null),_=m.useRef(null),A=m.useRef(p),F=c!=null,V=$g(c),z=$g(s),D=$g(u),R=m.useCallback(()=>{if(!j.current||!_.current)return;const P={placement:t,strategy:n,middleware:d};z.current&&(P.platform=z.current),Jne(j.current,_.current,P).then(B=>{const E={...B,isPositioned:D.current!==!1};T.current&&!th(A.current,E)&&(A.current=E,vr.flushSync(()=>{f(E)}))})},[d,t,n,z,D]);np(()=>{u===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,f(P=>({...P,isPositioned:!1})))},[u]);const T=m.useRef(!1);np(()=>(T.current=!0,()=>{T.current=!1}),[]),np(()=>{if(N&&(j.current=N),C&&(_.current=C),N&&C){if(V.current)return V.current(N,C,R);R()}},[N,C,R,V,F]);const $=m.useMemo(()=>({reference:j,floating:_,setReference:w,setFloating:x}),[w,x]),M=m.useMemo(()=>({reference:N,floating:C}),[N,C]),O=m.useMemo(()=>{const P={position:n,left:0,top:0};if(!M.floating)return P;const B=Xj(M.floating,p.x),E=Xj(M.floating,p.y);return l?{...P,transform:"translate("+B+"px, "+E+"px)",...FI(M.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:B,top:E}},[n,l,M.floating,p.x,p.y]);return m.useMemo(()=>({...p,update:R,refs:$,elements:M,floatingStyles:O}),[p,R,$,M,O])}const Zne=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?Jj({element:r.current,padding:s}).fn(n):{}:r?Jj({element:r,padding:s}).fn(n):{}}}},Zj=(e,t)=>{const n=Une(e);return{name:n.name,fn:n.fn,options:[e,t]}},ere=(e,t)=>{const n=Yne(e);return{name:n.name,fn:n.fn,options:[e,t]}},tre=(e,t)=>{const n=Gne(e);return{name:n.name,fn:n.fn,options:[e,t]}},nre=(e,t)=>{const n=qne(e);return{name:n.name,fn:n.fn,options:[e,t]}},rre=(e,t)=>{const n=Zne(e);return{name:n.name,fn:n.fn,options:[e,t]}},sre={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},ire={beaconOptions:{offset:-18}},zI={back:"Back",close:"Close",last:"Last",next:"Next",nextWithProgress:"Next ({current} of {total})",open:"Open the dialog",skip:"Skip"},ore={isFixed:!1,locale:zI,placement:"bottom"},are={continuous:!1,debug:!1,run:!1,scrollToFirstStep:!1,steps:[]},Nt={INIT:"init",START:"start",STOP:"stop",RESET:"reset",PREV:"prev",NEXT:"next",GO:"go",CLOSE:"close",SKIP:"skip",UPDATE:"update",COMPLETE:"complete"},Gn={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"},De={INIT:"init",READY:"ready",BEACON_BEFORE:"beacon_before",BEACON:"beacon",TOOLTIP_BEFORE:"tooltip_before",TOOLTIP:"tooltip",COMPLETE:"complete"},Xs={BUTTON_BACK:"button_back",BUTTON_CLOSE:"button_close",BUTTON_PRIMARY:"button_primary",BUTTON_SKIP:"button_skip",KEYBOARD:"keyboard",OVERLAY:"overlay"},bt={IDLE:"idle",READY:"ready",WAITING:"waiting",RUNNING:"running",PAUSED:"paused",SKIPPED:"skipped",FINISHED:"finished"},lre="react-joyride-portal";function cre(e){const t={};for(const n in e)e[n]!==void 0&&(t[n]=e[n]);return t}function cl(...e){return Zte({all:!0,isMergeableObject:t=>!(!dr.plainObject(t)||m.isValidElement(t))})(...e)}function HI(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function vi(e,t={}){const{defaultValue:n,step:r,steps:s}=t;let i=Tg(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&&HI(e.type)==="function")try{i=vi(e.type({}),t)}catch{i=Tg(n)}else i=Tg(n);return i}function Xn(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 ure(e,t){const n=cre(t);return{...e,...n}}function Ku(){}function dre(e){return Object.keys(e)}function nh(e,...t){if(!dr.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 e1(e,...t){if(!dr.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 Ix(e,t,n){const r=i=>i.replace("{current}",String(t)).replace("{total}",String(n));if(HI(e)==="string")return r(e);if(!m.isValidElement(e))return e;const{children:s}=e.props;if(dr.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):Ix(i,t,n))});if(dr.function(e.type)&&!Object.values(e.props).length)try{return Ix(e.type({}),t,n)}catch{return e}return e}function t1(e){return dre(e).sort().reduce((t,n)=>(t[n]=e[n],t),{})}function Ib(){var e;return!!(typeof window<"u"&&((e=window.document)!=null&&e.createElement))}function n1(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 Tb(e){return e?e.getBoundingClientRect():null}function fre(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 ps(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 pre(e,t,n){const r=Tb(e),s=Xl(e),i=s?!s.isSameNode($r()):!1,a=n??Ql(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($r())||(c+=$r().scrollTop)),Math.floor(c-t)}function Xl(e,t){if(!e)return $r();const n=_I(e);if(n){if(n.isSameNode($r()))return t?document:$r();if(!(n.scrollHeight>n.offsetHeight))return $r()}return n}function hre(e){const t=e.getBoundingClientRect(),n=$r(),r=t.top+t.height/2,s=window.innerHeight/2;return Math.max(0,n.scrollTop+r-s)}function mre(e,t){if(!e)return 0;const n=_I(e)??$r(),r=parseFloat(getComputedStyle(e).scrollMarginTop)||0,s=Tb(n),i=n.scrollTop??0,{offsetTop:a=0,scrollTop:l=0}=n;let c=e.getBoundingClientRect().top+l;if(a&&(BI(e)||gre(e))){const p=e.getBoundingClientRect(),f=p.top-((s==null?void 0:s.top)??0),d=f+p.height,h=n.clientHeight,y=h*.2;f>=y&&d<=h-y?c=i:c=f+i}const u=Math.floor(c-t-r);return u<0?0:u}function gre(e){return e.offsetParent!==document.body}function BI(e){if(!e)return!1;const t=Xl(e);return t?!t.isSameNode($r()):!1}function Ql(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?Ql(e.parentNode,t):!1}function If(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 r1(e){const{isFirstStep:t,scrollToFirstStep:n,step:r,target:s,targetLifecycle:i}=e;if(r.skipScroll||t&&!n&&i!==De.TOOLTIP||r.placement==="center")return!1;const a=s!=null&&s.isConnected?Xl(s):$r(),l=a?!a.isSameNode($r()):!1;return(r.isFixed||Ql(s))&&!l?!1:a.scrollHeight>a.clientHeight}function $r(){return document.scrollingElement??document.documentElement}function s1(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=one.top(r,e,{duration:c<100?50:n},()=>{a()})});return{cancel:s,promise:i}}function yre(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 WI={backgroundColor:"transparent",border:0,borderRadius:0,color:"#555555",cursor:"pointer",fontSize:16,lineHeight:1,padding:0,WebkitAppearance:"none"},Tf={...WI,borderRadius:4,padding:8};function xre(e,t){const{styles:n}=e,r=cl(n??{},t.styles??{});let{width:s}=t;Ib()&&(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 cl({arrow:{alignItems:"center",color:t.arrowColor,display:"inline-flex",justifyContent:"center",position:"absolute"},beaconWrapper:{...WI,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(${yre(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:{...Tf,color:t.primaryColor,marginLeft:"auto",marginRight:5},buttonClose:{...Tf,color:t.textColor,height:12,padding:8,position:"absolute",right:0,top:0,width:12},buttonPrimary:{...Tf,backgroundColor:t.primaryColor,color:t.backgroundColor},buttonSkip:{...Tf,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 wre=["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 Rb(e,t){if(!t)return null;const n=cl(ore,e1(e,"arrowComponent","beaconComponent","floatingOptions","loaderComponent","locale","styles","tooltipComponent"),t),r=cl(sre,e.options??{},e1(t,...wre)),s=xre(e,{...n,...r}),i=cl(ire,e.floatingOptions??{},n.floatingOptions??{});return{...n,...r,locale:cl(zI,e.locale??{},n.locale||{}),floatingOptions:i,spotlightPadding:bre(r.spotlightPadding),styles:s}}function bre(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 kre(e,t,n){const{action:r}=t,s=n&&[Nt.PREV,Nt.NEXT].includes(r);return e.skipBeacon||e.placement==="center"||s}function VI(e,t=!1){return dr.plainObject(e)?e.target?!0:(Xn(t,"tour","target is missing from the step"),!1):(Xn(t,"tour","step must be an object"),!1)}function KI(e,t=!1){return dr.array(e)?e.every(n=>VI(n,t)):(Xn(t,"tour","steps must be an array"),!1)}var vre=class{constructor(e){Nn(this,"beaconPosition",null);Nn(this,"debug");Nn(this,"eventListeners",new Map);Nn(this,"listeners",new Set);Nn(this,"props");Nn(this,"snapshot");Nn(this,"state");Nn(this,"steps");Nn(this,"tooltipPosition",null);Nn(this,"cleanupPositionData",()=>{this.beaconPosition=null,this.tooltipPosition=null});Nn(this,"getPositionData",e=>e==="beacon"?this.beaconPosition:this.tooltipPosition);Nn(this,"getServerSnapshot",()=>this.snapshot);Nn(this,"getSnapshot",()=>this.snapshot);Nn(this,"getEventState",()=>nh(this.snapshot,"positioned"));Nn(this,"getState",()=>nh(this.snapshot,"positioned"));Nn(this,"setPositionData",(e,t)=>{var r,s,i;((r=e==="beacon"?this.beaconPosition:this.tooltipPosition)==null?void 0:r.placement)!==t.placement&&Xn(this.debug,`step:${this.state.index}`,"positioned",`${e} ${t.placement}`),e==="beacon"?this.beaconPosition=t:this.tooltipPosition=t,(this.state.lifecycle===De.BEACON_BEFORE||this.state.lifecycle===De.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)});Nn(this,"setSteps",e=>{this.steps=e,this.updateState({size:e.length})});Nn(this,"dispatch",(e,t)=>{const n=this.eventListeners.get(e.type);if(n)for(const r of n)try{r(e,t)}catch{}});Nn(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)}});Nn(this,"subscribe",e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}));Nn(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,!vb(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=dr.number(n);let i=0;this.debug=(e==null?void 0:e.debug)??!1,s?(i=n,dr.number(t)&&Xn(this.debug,"tour","initialStepIndex is ignored in controlled mode")):dr.number(t)&&(t>=0&&t<r.length?i=t:r.length>0&&Xn(this.debug,"tour","initialStepIndex is out of bounds")),this.props=e??{steps:[]},this.steps=r,this.state={action:Nt.INIT,controlled:s,index:i,lifecycle:De.INIT,origin:null,positioned:!1,scrolling:!1,size:r.length,status:r.length?bt.READY:bt.IDLE,waiting:!1},this.snapshot=Object.freeze({...this.state})}applyTransitions(e){return e.status===bt.WAITING&&e.size>0?{...e,status:bt.RUNNING}:e}getStep(e){return Rb(this.props,this.steps[e??this.state.index])}};function Sre(e){return new vre(e)}function i1(e,t){return Math.min(Math.max(e,0),t)}function Nre(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:(k=null)=>{const{index:g,status:w}=i();w===bt.RUNNING&&e.current.updateState({action:Nt.CLOSE,index:g+1,origin:k,lifecycle:De.COMPLETE,positioned:!1,scrolling:!1,waiting:!1})},go:k=>{const{controlled:g,size:w,status:x}=i();if(g){Xn(r.current,"tour","go() is not supported in controlled mode");return}x===bt.RUNNING&&e.current.updateState({action:Nt.GO,index:k,lifecycle:De.COMPLETE,positioned:!1,scrolling:!1,status:k<w?x:bt.FINISHED,waiting:!1})},info:()=>nh(e.current.getSnapshot(),"positioned"),next:k=>{const{index:g,size:w,status:x}=i();x===bt.RUNNING&&e.current.updateState({action:Nt.NEXT,index:i1(g+1,w),lifecycle:De.COMPLETE,origin:k,positioned:!1,scrolling:!1,waiting:!1})},open:()=>{const{status:k}=i();k===bt.RUNNING&&e.current.updateState({action:Nt.UPDATE,lifecycle:De.TOOLTIP_BEFORE,positioned:!1,scrolling:!1,waiting:!1})},prev:k=>{const{index:g,size:w,status:x}=i();x===bt.RUNNING&&e.current.updateState({action:Nt.PREV,index:i1(g-1,w),lifecycle:De.COMPLETE,origin:k,positioned:!1,scrolling:!1,waiting:!1})},reset:(k=!1)=>{const{controlled:g}=i();if(g){Xn(r.current,"tour","reset() is not supported in controlled mode");return}s.current(),e.current.updateState({action:Nt.RESET,index:0,lifecycle:De.INIT,positioned:!1,scrolling:!1,status:k?bt.RUNNING:bt.READY,waiting:!1})},skip:k=>{const{status:g}=i();g===bt.RUNNING&&e.current.updateState({action:Nt.SKIP,lifecycle:De.COMPLETE,origin:k,positioned:!1,scrolling:!1,status:bt.SKIPPED,waiting:!1})},start:k=>{const{index:g,size:w}=i();s.current(),e.current.updateState({action:Nt.START,index:dr.number(k)?k:g,lifecycle:De.INIT,positioned:!1,scrolling:!1,status:w?bt.RUNNING:bt.WAITING,waiting:!1},!0)},stop:(k=!1)=>{const{index:g,status:w}=i();[bt.FINISHED,bt.SKIPPED].includes(w)||e.current.updateState({action:Nt.STOP,index:g+(k?1:0),lifecycle:De.COMPLETE,positioned:!1,scrolling:!1,status:bt.PAUSED,waiting:!1})}}},[e])}const jre=new Set(["origin","positioned"]);function Cre(e,t){const n=m.useRef(null);m.useEffect(()=>{if(!t)return;const r=e.current.getSnapshot();return Xn(!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]&&!jre.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||Xn(!0,l?"tour":`step:${s.index}`,"state",a))})},[t,e])}function _re(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 to(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 Ere(e){const{addFailure:t,controls:n,emitEvent:r,previousState:s,props:i,state:a,step:l,store:c}=e,{action:u,index:p,lifecycle:f,positioned:d,scrolling:h,size:y,status:b}=a,k=wI(l)??null,g=m.useRef(null),w=m.useRef(i),x=m.useRef(a),N=m.useRef(s),C=m.useRef(l),j=m.useRef(k),_=m.useRef(n),A=m.useRef(null),F=m.useRef(null),V=m.useRef(null);w.current=i,x.current=a,N.current=s,C.current=l,j.current=k,_.current=n;const z=()=>{A.current&&(clearInterval(A.current),A.current=null),F.current=null,V.current&&(V.current.cancel(),V.current=null)};m.useEffect(()=>{if(!N.current)return;const{hasChangedTo:D}=to(x.current,N.current);(D("action",[Nt.NEXT,Nt.PREV,Nt.SKIP,Nt.CLOSE])||g.current===Nt.CLOSE&&u===Nt.START)&&(g.current=u)},[u]),m.useEffect(()=>{if(!N.current)return()=>{z()};const{hasChanged:D}=to(x.current,N.current),R=C.current;if(D("index")&&z(),b!==bt.RUNNING||!R||f!==De.INIT)return()=>{z()};const{hasChangedTo:T}=to(x.current,N.current);T("status",bt.RUNNING)&&[bt.IDLE,bt.READY,bt.PAUSED].includes(N.current.status)&&r(Gn.TOUR_START,R),c.current.cleanupPositionData();const{debug:$}=w.current;if(R.before&&!V.current){Xn($,`step:${p}`,"before()",R),V.current={cancel:()=>{}},c.current.updateState({waiting:!0}),r(Gn.STEP_BEFORE_HOOK,R,{action:g.current??x.current.action});const M=()=>{V.current=null,c.current.updateState({action:g.current??x.current.action,waiting:!1,lifecycle:De.READY})},O=new AbortController,P=R.beforeTimeout;V.current={cancel:()=>O.abort()};const B=P?setTimeout(()=>{O.signal.aborted||(Xn($,`step:${p}`,"before()","timed out",`${P}ms`),O.abort(),t(R,"before_hook"),r(Gn.ERROR,R,{error:new Error("Step before hook timed out")}),M())},P):null;R.before({...c.current.getState(),action:g.current??c.current.getState().action,step:R}).then(()=>{O.signal.aborted||(B&&clearTimeout(B),M())}).catch(E=>{O.signal.aborted||(B&&clearTimeout(B),t(R,"before_hook"),r(Gn.ERROR,R,{error:E instanceof Error?E:new Error(String(E))}),M())})}else if(!V.current){A.current&&F.current!==R.target&&z();const M=ps(R.target);if(M&&If(M))z(),c.current.updateState({action:g.current??Nt.UPDATE,lifecycle:De.READY,waiting:!1});else if(R.targetWaitTimeout===0)c.current.updateState({action:g.current??Nt.UPDATE,lifecycle:De.READY,waiting:!1});else if(!A.current){const{targetWaitTimeout:O}=R,P=Date.now();F.current=R.target,Xn($,`step:${p}`,"polling","started",`${O}ms`),c.current.updateState({waiting:!0}),A.current=setInterval(()=>{const B=ps(R.target),E=Date.now()-P,q=E>=O;(B&&If(B)||q)&&(Xn($,`step:${p}`,"polling",B&&If(B)?"found":"timed out",`${E}ms`),z(),c.current.updateState({action:g.current??Nt.UPDATE,lifecycle:De.READY,waiting:!1}))},100)}}return()=>{z()}},[t,r,p,f,b,c]),m.useEffect(()=>{if(!N.current)return;const{hasChanged:D,hasChangedTo:R,previous:T}=to(x.current,N.current),$=C.current;if(!$)return;const M=ps($.target),O=!!M;if(O&&If(M)){if(R("lifecycle",De.READY)&&T.lifecycle===De.INIT&&r(Gn.STEP_BEFORE,$,{action:g.current??x.current.action}),R("lifecycle",De.READY)){const P=x.current,B=kre($,P,w.current.continuous)?De.TOOLTIP:De.BEACON,E=ps($.scrollTarget??$.spotlightTarget??$.target),q=r1({isFirstStep:P.index===0,scrollToFirstStep:w.current.scrollToFirstStep,step:$,target:E,targetLifecycle:B}),W=B===De.TOOLTIP?De.TOOLTIP_BEFORE:De.BEACON_BEFORE;Xn(w.current.debug,`step:${p}`,"scroll",q?"needed":"skipped"),c.current.updateState({action:Nt.UPDATE,lifecycle:W,scrolling:q})}}else if(x.current.status===bt.RUNNING&&f!==De.INIT&&f!==De.COMPLETE&&D("lifecycle")){Xn(w.current.debug,`step:${p}`,O?"Target not visible":"Target not mounted",$),t($,"target_not_found"),r(Gn.TARGET_NOT_FOUND,$);const P=x.current;P.controlled||c.current.updateState({action:Nt.UPDATE,index:P.index+(P.action===Nt.PREV?-1:1),lifecycle:De.INIT})}},[t,r,p,f,c]),m.useEffect(()=>{if(!N.current)return;const{hasChangedTo:D,previous:R}=to(x.current,N.current),T=C.current,$=j.current;if(T&&D("lifecycle",De.TOOLTIP_BEFORE)&&R.lifecycle===De.BEACON){const P=ps(T.scrollTarget??T.spotlightTarget??T.target);if(r1({isFirstStep:x.current.index===0,scrollToFirstStep:w.current.scrollToFirstStep,step:T,target:P,targetLifecycle:De.TOOLTIP})){c.current.updateState({scrolling:!0,positioned:!1});return}}const M=f===De.BEACON_BEFORE||f===De.TOOLTIP_BEFORE;if(T&&M&&!h){const P=f===De.TOOLTIP_BEFORE?De.TOOLTIP:De.BEACON;c.current.updateState({action:Nt.UPDATE,lifecycle:P})}T&&D("lifecycle",De.BEACON)&&r(Gn.BEACON,T),T&&D("lifecycle",De.TOOLTIP)&&r(Gn.TOOLTIP,T);const O=x.current;if((O.status===bt.RUNNING||O.controlled&&O.status===bt.PAUSED&&T)&&$&&D("lifecycle",De.COMPLETE)&&R.lifecycle===De.TOOLTIP&&(r(Gn.STEP_AFTER,$,{action:g.current??Nt.UPDATE,index:R.index??O.index,lifecycle:O.lifecycle}),$.after)){r(Gn.STEP_AFTER_HOOK,$,{action:g.current??Nt.UPDATE,index:R.index??O.index,lifecycle:O.lifecycle});try{$.after({...c.current.getState(),action:g.current??Nt.UPDATE,index:R.index??O.index,lifecycle:O.lifecycle,step:$})}catch{}}},[r,f,d,h,c]),m.useEffect(()=>{if(!N.current)return;const{hasChangedTo:D,previous:R}=to(x.current,N.current),T=C.current,$=j.current;y&&!T&&f===De.INIT&&c.current.updateState({action:Nt.UPDATE,lifecycle:De.COMPLETE,status:bt.FINISHED}),!x.current.controlled&&b===bt.RUNNING&&D("lifecycle",De.COMPLETE)&&p<y&&c.current.updateState({action:Nt.UPDATE,lifecycle:De.INIT}),D("lifecycle",De.COMPLETE)&&p>=y&&c.current.updateState({action:Nt.UPDATE,lifecycle:De.COMPLETE,status:bt.FINISHED});const M=T??$??Rb(w.current,w.current.steps[p-1]);if(M&&D("status",[bt.FINISHED,bt.SKIPPED])){let O;T?O=p:$?O=R.index??p:O=p-1,r(Gn.TOUR_END,M,{index:O}),x.current.controlled||_.current.reset(),g.current=null}T&&D("action",Nt.STOP)&&(g.current=null,r(Gn.TOUR_STATUS,T)),T&&D("action",Nt.RESET)&&(r(Gn.TOUR_STATUS,T),g.current=null)},[u,r,p,f,y,b,c])}function Are({controls:e,emitEvent:t,props:n,state:r,store:s}){const{debug:i,initialStepIndex:a,run:l,stepIndex:c,steps:u}=n,p=m.useRef(void 0),f=m.useRef(r),d=m.useRef(e);f.current=r,d.current=e,m.useEffect(()=>{const h=p.current;if(p.current=n,!h||n===h)return;const{hasChanged:y}=to(n,h);if(vb(h.steps,u)||(KI(u,i)?s.current.setSteps(u):(Xn(i,"tour","Steps are not valid",u),t(Gn.ERROR,u[0]??{target:"",content:""},{error:new Error("Steps are not valid")}))),y("run"))l?s.current.getState().size&&d.current.start(c??a):d.current.stop();else if(dr.number(c)&&y("stepIndex")){const b=dr.number(h.stepIndex)&&h.stepIndex<c?Nt.NEXT:Nt.PREV;[bt.FINISHED,bt.SKIPPED].includes(f.current.status)||s.current.updateState({action:b,index:c,lifecycle:De.INIT,positioned:!1},!0)}},[i,t,a,n,l,c,u,s])}function Pre(e,t){var l,c,u,p;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===De.BEACON_BEFORE&&(n!=null&&n.placement)){const f=Ire(n);["bottom"].includes(n.placement)||(a+=Math.floor(f-s))}else if(r===De.TOOLTIP_BEFORE){const{placement:f}=i;if(f==="top"){const d=((l=document.querySelector(".react-joyride__floater"))==null?void 0:l.getBoundingClientRect().height)??0,h=(c=i.floatingOptions)!=null&&c.hideArrow?0:i.arrowSize,y=i.offset+i.spotlightPadding.top+h;a-=d+y}else if(f==="left"||f==="right"){const d=((u=document.querySelector(".react-joyride__floater"))==null?void 0:u.getBoundingClientRect().height)??0,h=((p=ps(i.target))==null?void 0:p.getBoundingClientRect().height)??0,y=s+i.spotlightPadding.top+h/2-d/2;y<s&&(a-=s-y)}}return Math.max(0,a)}function Ire(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 Tre({emitEvent:e,previousState:t,props:n,state:r,step:s,store:i}){const{index:a,lifecycle:l,positioned:c,scrolling:u,status:p}=r,f=m.useRef(null),d=m.useRef(r),h=m.useRef(t),y=m.useRef(n),b=m.useRef(s);d.current=r,h.current=t,y.current=n,b.current=s,m.useEffect(()=>()=>{var k;(k=f.current)==null||k.call(f)},[]),m.useEffect(()=>{var C;if(!h.current||!b.current)return;const{hasChangedTo:k}=to(d.current,h.current),g=b.current,{debug:w}=y.current,{scrollDuration:x}=g,N=l===De.BEACON_BEFORE||l===De.TOOLTIP_BEFORE;if(p===bt.RUNNING&&N&&u&&k("positioned",!0)){const j=ps(g.scrollTarget??g.spotlightTarget??g.target),_=i.current.getPositionData("beacon"),A=Xl(j),F=A?!A.isSameNode($r()):!1;(C=f.current)==null||C.call(f),(async()=>{if(F&&!Ql(A)){const O=$r(),P=hre(A),B={initial:O.scrollTop,target:P,element:O,duration:x};e(Gn.SCROLL_START,g,{scroll:B});const{cancel:E,promise:q}=s1(P,{element:O,duration:x});f.current=E,await q,e(Gn.SCROLL_END,g,{scroll:B})}const z=Math.floor(mre(j,g.scrollOffset))||0,D=F?z:Pre(z,{beaconPosition:_,lifecycle:l,scrollOffset:g.scrollOffset,step:g});Xn(w,`step:${a}`,"scroll",F?"custom":"document",`${z} → ${D}`);const R=A,T={initial:R.scrollTop,target:D,element:R,duration:x};e(Gn.SCROLL_START,g,{scroll:T});const{cancel:$,promise:M}=s1(D,{element:R,duration:x});f.current=$,await M,e(Gn.SCROLL_END,g,{scroll:T}),i.current.updateState({scrolling:!1})})().catch(()=>{i.current.updateState({scrolling:!1})})}},[e,a,l,c,u,p,i])}function Rre(e){const t=mte(()=>ure(are,e),[e]),{debug:n,initialStepIndex:r,onEvent:s,run:i,stepIndex:a,steps:l}=t,c=m.useRef(Sre(t)),u=GE.useSyncExternalStore(c.current.subscribe,c.current.getSnapshot,c.current.getServerSnapshot),[p,f]=m.useState([]),d=m.useCallback((C,j)=>{f(_=>[..._,{reason:j,step:C}])},[]),h=m.useCallback(()=>{f([])},[]);Cre(c,n);const y=Nre(c,n,h),b=_re(s,y,c),{index:k,size:g,status:w}=u,x=wI(u),N=m.useMemo(()=>Rb(t,l[k]),[k,t,l]);return gte(()=>{i&&g&&KI(l,n)&&y.start(a??r)}),hte(()=>{i&&g&&w===bt.IDLE&&c.current.updateState({status:bt.READY})},[i,g,w]),Are({controls:y,emitEvent:b,props:t,state:u,store:c}),Ere({addFailure:d,controls:y,emitEvent:b,previousState:x,props:t,state:u,step:N,store:c}),Tre({emitEvent:b,previousState:x,props:t,state:u,step:N,store:c}),{controls:y,failures:p,mergedProps:t,state:u,step:N,store:c}}function Mre(e){const[t,n]=m.useState(null);return m.useEffect(()=>{let r=null,s=!1;if(e)if(dr.domElement(e))r=e,s=!0;else{const i=document.querySelector(e);i&&(r=i)}else{const i=document.createElement("div");i.id=lre,document.body.appendChild(i),r=i}return n(r),()=>{!r||s||r.parentNode===document.body&&document.body.removeChild(r)}},[e]),t}const $re={animation:"joyride-loader-spin 1s linear infinite",border:"5px solid rgba(0, 0, 0, 0.1)",borderRadius:"50%",borderTopColor:"#555"};function Lre({nonce:e,step:t}){const{loaderComponent:n}=t,r=!!n;if(m.useEffect(()=>{if(r||document.getElementById("joyride-loader-animation"))return Ku;const c=document.createElement("style");return c.id="joyride-loader-animation",e&&c.setAttribute("nonce",e),c.appendChild(document.createTextNode(`
|
|
311
|
-
@keyframes joyride-loader-spin {
|
|
312
|
-
to { transform: rotate(360deg); }
|
|
313
|
-
}
|
|
314
|
-
`)),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=rt.createElement(c,{step:t})}else l=rt.createElement("div",{style:{...$re,height:s,width:i,borderTopColor:t.primaryColor}});return rt.createElement("div",{className:"react-joyride__loader","data-testid":"loader",style:a},l)}const Ore={height:0,isFixed:!1,left:0,top:0,width:0};function Ic(e,t){const n=ps(e);if(!n)return Ore;const r=Tb(n),s=Ql(n),i=pre(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 Dre(e,t,n){const[r,s]=m.useState(()=>Ic(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(f=>{const d=Ic(e,t);return f.top===d.top&&f.left===d.left&&f.width===d.width&&f.height===d.height&&f.isFixed===d.isFixed?f:d})},100)},[e,t]);m.useEffect(()=>{let f=null;const d=y=>{a.current=Xl(y,!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(y)),s(Ic(e,t))},h=ps(e);return h?d(h):(f=new MutationObserver(()=>{const y=ps(e);y&&(f==null||f.disconnect(),f=null,d(y))}),f.observe(document.body,{childList:!0,subtree:!0})),()=>{var y;f==null||f.disconnect(),a.current&&a.current.removeEventListener("scroll",u),window.removeEventListener("scroll",u),window.removeEventListener("resize",u),(y=c.current)==null||y.disconnect(),clearTimeout(i.current)}},[e,t,u]),m.useEffect(()=>{l.current&&!n&&s(Ic(e,t)),l.current=n},[n,e,t]);let p=r;return l.current&&!n&&(p=Ic(e,t)),p}function Fre(e,t,n){let r=`M0 0H${e}V${t}H0Z`;return n&&(r+=` ${n}`),r}function o1(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 zre=[De.BEACON_BEFORE,De.BEACON];function Hre(e){var M,O;const{blockTargetInteraction:t,continuous:n,hideOverlay:r,lifecycle:s,onClickOverlay:i,overlayClickAction:a,placement:l,portalElement:c,scrolling:u,spotlightPadding:p,spotlightRadius:f,spotlightTarget:d,styles:h,target:y,waiting:b}=e,k=yte(),g=Dre(d??y,p,u||b),w=m.useRef(null),x=(s===De.TOOLTIP||s===De.TOOLTIP_BEFORE)&&l!=="center",[N,C]=m.useState(!1),j=c?(M=w.current)==null?void 0:M.offsetParent:null,_=(j==null?void 0:j.clientWidth)??k.width,A=(j==null?void 0:j.clientHeight)??fre()??k.height,F=((O=h.overlay)==null?void 0:O.backgroundColor)??"rgba(0, 0, 0, 0.5)",V=m.useMemo(()=>{const{backgroundColor:P,mixBlendMode:B,...E}=h.overlay;return{height:A,pointerEvents:"none",...E}},[A,h.overlay]),z=x&&!u&&!b;m.useEffect(()=>{z?requestAnimationFrame(()=>C(!0)):C(!1)},[z]);const D=n&&zre.includes(s),R=!n&&s!==De.TOOLTIP;if(r||!b&&(D||R))return null;let T="";if(z)if(c&&j){const P=ps(d??y);if(P){const B=n1(P),E=n1(j);T=o1(B.left-E.left-p.left,B.top-E.top-p.top,P.offsetWidth+p.left+p.right,P.offsetHeight+p.top+p.bottom,f)}}else T=o1(g.left,g.top,g.width,g.height,f);const $=Fre(_,A,T);return rt.createElement("div",{ref:w,"aria-hidden":"true",className:"react-joyride__overlay","data-testid":"overlay",style:V},rt.createElement("svg",{className:"react-joyride__spotlight","data-testid":"spotlight",style:{height:A,left:0,position:g.isFixed?"fixed":"absolute",top:0,width:_}},rt.createElement("path",{d:$,fill:F,fillRule:"evenodd",onClick:i,style:{cursor:a?"pointer":"default",pointerEvents:"auto"}}),T&&rt.createElement("path",{d:T,fill:F,style:{opacity:N?0:1,pointerEvents:t?"auto":"none",transition:"opacity 0.2s"}}),T&&Object.keys(h.spotlight).length>0&&rt.createElement("path",{d:T,fill:"none",style:{pointerEvents:"none"},...h.spotlight})))}function UI(e){const{children:t,element:n}=e;return n?vr.createPortal(t,n):null}const Bre='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), area[href], [tabindex]:not([tabindex="-1"]), [contenteditable]';function Wre(e,t){const n=m.useRef(null);m.useEffect(()=>{if(!e)return Ku;n.current=document.activeElement;const r=i=>{if(i.key!=="Tab")return;const a=[...e.querySelectorAll(Bre)],{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 _i(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 Vre(e,t,n){const[r]=e.split("-");switch(r){case"top":return{points:`0,0 ${t/2},${n} ${t},0`,..._i(e,t,n)};case"bottom":return{points:`${t},${n} ${t/2},0 0,${n}`,..._i(e,t,n)};case"left":return{points:`0,0 ${n},${t/2} 0,${t}`,..._i(e,t,n)};case"right":return{points:`${n},${t} ${n},0 0,${t/2}`,..._i(e,t,n)};default:return null}}function Kre(e,t,n,r){if(!t)return{};const[s]=e.split("-");switch(s){case"top":return{bottom:-n,left:t.x??0,..._i(e,r,n)};case"bottom":return{top:-n,left:t.x??0,..._i(e,r,n)};case"left":return{right:-n,top:t.y??0,..._i(e,r,n)};case"right":return{left:-n,top:t.y??0,..._i(e,r,n)};default:return{}}}function Ure({arrowComponent:e,arrowRef:t,base:n,placement:r,position:s,size:i,styles:a}){const l=e;let c=null;if(l){if(!_i(r,n,i))return null;c=rt.createElement("span",{style:{flexShrink:0}},rt.createElement(l,{base:n,placement:r,size:i}))}else{const u=Vre(r,n,i);if(!u)return null;c=rt.createElement("svg",{height:u.height,width:u.width,xmlns:"http://www.w3.org/2000/svg"},rt.createElement("polygon",{fill:"currentColor",points:u.points}))}return rt.createElement("span",{ref:t,className:"react-joyride__arrow","data-testid":"arrow",style:{...a,...Kre(r,s,i,n),...s?{}:{visibility:"hidden"}}},c)}function qre(e){const{beaconComponent:t,continuous:n,index:r,isLastStep:s,locale:i,nonce:a,onInteract:l,shouldFocus:c,size:u,step:p,styles:f}=e,d=m.useRef(null),h=!!t;m.useEffect(()=>{if(h||document.getElementById("joyride-beacon-animation"))return Ku;const k=document.createElement("style");k.id="joyride-beacon-animation",a&&k.setAttribute("nonce",a),k.appendChild(document.createTextNode(`
|
|
315
|
-
@keyframes joyride-beacon-inner {
|
|
316
|
-
20% {
|
|
317
|
-
opacity: 0.9;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
90% {
|
|
321
|
-
opacity: 0.7;
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
@keyframes joyride-beacon-outer {
|
|
326
|
-
0% {
|
|
327
|
-
transform: scale(1);
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
45% {
|
|
331
|
-
opacity: 0.7;
|
|
332
|
-
transform: scale(0.75);
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
100% {
|
|
336
|
-
opacity: 0.9;
|
|
337
|
-
transform: scale(1);
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
`)),document.head.appendChild(k);const g=setTimeout(()=>{dr.domElement(d.current)&&c&&d.current.focus()},0);return()=>{clearTimeout(g);const w=document.getElementById("joyride-beacon-animation");w!=null&&w.parentNode&&w.parentNode.removeChild(w)}},[h,a,c]);const y=vi(i.open);let b;if(t){const k=t;b=rt.createElement(k,{continuous:n,index:r,isLastStep:s,size:u,step:p})}else b=rt.createElement("span",{style:f.beacon},rt.createElement("span",{style:f.beaconOuter}),rt.createElement("span",{style:f.beaconInner}));return rt.createElement("button",{ref:d,"aria-label":y,className:"react-joyride__beacon","data-testid":"button-beacon",onClick:l,onMouseEnter:l,style:f.beaconWrapper,title:y,type:"button"},b)}function Yre({styles:e,...t}){const{color:n,height:r,width:s,...i}=e;return rt.createElement("button",{style:i,type:"button",...t},rt.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"},rt.createElement("g",null,rt.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 Gre(e){const{backProps:t,closeProps:n,index:r,isLastStep:s,primaryProps:i,skipProps:a,step:l,tooltipProps:c}=e,{buttons:u,content:p,styles:f,title:d}=l,h={};u.includes("primary")&&(h.primary=rt.createElement("button",{"data-testid":"button-primary",style:f.buttonPrimary,type:"button",...i})),u.includes("skip")&&!s&&(h.skip=rt.createElement("button",{"aria-live":"off","data-testid":"button-skip",style:f.buttonSkip,type:"button",...a})),u.includes("back")&&r>0&&(h.back=rt.createElement("button",{"data-testid":"button-back",style:f.buttonBack,type:"button",...t})),h.close=u.includes("close")&&rt.createElement(Yre,{"data-testid":"button-close",styles:f.buttonClose,...n});const y=d?{"aria-labelledby":"joyride-tooltip-title","aria-describedby":"joyride-tooltip-content"}:{"aria-label":vi(p),"aria-describedby":"joyride-tooltip-content"};return rt.createElement("div",{key:"JoyrideTooltip",className:"react-joyride__tooltip","data-joyride-step":r,...l.id&&{"data-joyride-id":l.id},style:f.tooltip,...c,...y},rt.createElement("div",{style:f.tooltipContainer},d&&rt.createElement("h4",{id:"joyride-tooltip-title",style:f.tooltipTitle},d),rt.createElement("div",{id:"joyride-tooltip-content",style:f.tooltipContent},p)),u.some(b=>b==="back"||b==="primary"||b==="skip")&&rt.createElement("div",{style:f.tooltipFooter},rt.createElement("div",{style:f.tooltipFooterSpacer},h.skip),h.back,h.primary),h.close)}function Jre(e){const{continuous:t,controls:n,index:r,isLastStep:s,size:i,step:a}=e,l=g=>{g.preventDefault(),n.prev(Xs.BUTTON_BACK)},c=g=>{g.preventDefault(),a.closeButtonAction==="skip"?n.skip(Xs.BUTTON_CLOSE):n.close(Xs.BUTTON_CLOSE)},u=g=>{if(g.preventDefault(),!t){n.close(Xs.BUTTON_PRIMARY);return}n.next(Xs.BUTTON_PRIMARY)},p=g=>{g.preventDefault(),n.skip(Xs.BUTTON_SKIP)},f=()=>{const{back:g,close:w,last:x,next:N,nextWithProgress:C,skip:j}=a.locale,_=vi(g),A=vi(w),F=vi(x),V=vi(N),z=vi(j);let D=w,R=A;if(t){if(D=N,R=V,a.showProgress&&!s){const T=vi(C,{step:r+1,steps:i});D=Ix(C,r+1,i),R=T}s&&(D=x,R=F)}return{backProps:{"aria-label":_,children:g,"data-action":"back",onClick:l,role:"button",title:_},closeProps:{"aria-label":A,children:w,"data-action":"close",onClick:c,role:"button",title:A},primaryProps:{"aria-label":R,children:D,"data-action":"primary",onClick:u,role:"button",title:R},skipProps:{"aria-label":z,children:j,"data-action":"skip",onClick:p,role:"button",title:z},tooltipProps:{"aria-modal":!0,role:"alertdialog"}}},{arrowComponent:d,beaconComponent:h,tooltipComponent:y,...b}=a;let k;if(y){const g=y;k=rt.createElement(g,{...f(),continuous:t,controls:n,index:r,isLastStep:s,size:i,step:b})}else k=rt.createElement(Gre,{...f(),continuous:t,controls:n,index:r,isLastStep:s,size:i,step:b});return k}function Xre(e){if(e.startsWith("left"))return["top","bottom"];if(e.startsWith("right"))return["bottom","top"]}function Qre(e,t,n){var r,s;return e?[nre()]:((r=t.floatingOptions)==null?void 0:r.flipOptions)===!1?[]:[tre({crossAxis:!1,fallbackPlacements:Xre(n),padding:20,...(s=t.floatingOptions)==null?void 0:s.flipOptions})]}function Zre(e){var B,E,q,W,L;const{continuous:t,controls:n,index:r,lifecycle:s,nonce:i,open:a,portalElement:l,setPositionData:c,setTooltipRef:u,shouldScroll:p,size:f,step:d,target:h,updateState:y}=e,b=m.useRef(null),k=m.useRef({}),g=m.useRef({}),w=d.placement==="center",x=d.placement==="auto",N=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})}),[]),C=m.useMemo(()=>BI(h)?Xl(h):void 0,[h]),j=m.useMemo(()=>Ql(h),[h]),_=m.useMemo(()=>C?{boundary:C,rootBoundary:"viewport"}:{},[C]),A=w||x?"bottom":d.placement,F=w?"fixed":((B=d.floatingOptions)==null?void 0:B.strategy)??(d.isFixed||j?"fixed":"absolute"),V=m.useMemo(()=>{var X,se,ae,me;return w?[{name:"center",fn:({rects:re})=>({x:(window.innerWidth-re.floating.width)/2,y:(window.innerHeight-re.floating.height)/2})}]:[Zj(({placement:re})=>{var ue;let de="right";re.startsWith("top")?de="top":re.startsWith("bottom")?de="bottom":re.startsWith("left")&&(de="left");const ne=d.spotlightTarget?0:d.spotlightPadding[de];return d.offset+ne+((ue=d.floatingOptions)!=null&&ue.hideArrow?0:d.arrowSize)},[d.offset,d.spotlightPadding,d.spotlightTarget,d.arrowSize,(X=d.floatingOptions)==null?void 0:X.hideArrow]),...Qre(x,d,A),ere({padding:10,..._,...(se=d.floatingOptions)==null?void 0:se.shiftOptions}),...(ae=d.floatingOptions)!=null&&ae.hideArrow?[]:[rre({element:b,padding:d.arrowSpacing},[d.arrowSpacing,d.arrowBase])],...((me=d.floatingOptions)==null?void 0:me.middleware)??[]]},[w,d,x,A,_]),z=Qj({...w?{elements:{reference:N}}:{},placement:A,strategy:F,middleware:V}),D=Qj({strategy:F,placement:d.beaconPlacement??(x||w?"bottom":d.placement),middleware:m.useMemo(()=>{var X,se;return[Zj(((se=(X=d.floatingOptions)==null?void 0:X.beaconOptions)==null?void 0:se.offset)??-18)]},[(q=(E=d.floatingOptions)==null?void 0:E.beaconOptions)==null?void 0:q.offset]),whileElementsMounted:Gj});g.current=z.middlewareData,k.current=D.middlewareData,m.useEffect(()=>{var ae;const{floating:X,reference:se}=z.elements;if(!(!se||!X||s!==De.TOOLTIP))return Gj(se,X,z.update,(ae=d.floatingOptions)==null?void 0:ae.autoUpdate)},[s,z.update,(W=d.floatingOptions)==null?void 0:W.autoUpdate,d.target,z.elements]),m.useEffect(()=>{!w&&h&&z.refs.setReference(h),h&&D.refs.setReference(h)},[D.refs,w,h,z.refs]),m.useEffect(()=>{z.isPositioned&&c("tooltip",{placement:z.placement,x:z.x??0,y:z.y??0,middlewareData:g.current})},[c,z.isPositioned,z.placement,z.x,z.y]),m.useEffect(()=>{D.isPositioned&&c("beacon",{placement:D.placement,x:D.x??0,y:D.y??0,middlewareData:k.current})},[c,D.isPositioned,D.placement,D.x,D.y]);const R=d.zIndex+100,T=m.useCallback(X=>{X.type==="mouseenter"&&d.beaconTrigger!=="hover"||y({lifecycle:De.TOOLTIP_BEFORE,positioned:!1})},[d.beaconTrigger,y]),$=m.useCallback(X=>{X&&(z.refs.setFloating(X),u(X))},[z.refs,u]),{arrow:M,floater:O}=d.styles;let P=null;if(s===De.TOOLTIP||s===De.TOOLTIP_BEFORE){const X=t1({...O,...z.floatingStyles,zIndex:R,opacity:a&&z.isPositioned?1:0,...!a&&{transition:"none"}});P=rt.createElement("div",{ref:$,className:"react-joyride__floater","data-testid":"floater",id:`react-joyride-step-${r}`,style:X},rt.createElement(Jre,{continuous:t,controls:n,index:r,isLastStep:r+1===f,size:f,step:d}),!w&&!((L=d.floatingOptions)!=null&&L.hideArrow)&&rt.createElement(Ure,{arrowComponent:d.arrowComponent,arrowRef:b,base:d.arrowBase,placement:z.placement,position:z.middlewareData.arrow,size:d.arrowSize,styles:M}))}else(s===De.BEACON||s===De.BEACON_BEFORE)&&(P=rt.createElement("div",{ref:D.refs.setFloating,className:"react-joyride__floater","data-testid":"floater-beacon",id:`react-joyride-step-${r}-beacon`,style:t1({...D.floatingStyles,zIndex:R})},rt.createElement(qre,{beaconComponent:d.beaconComponent,continuous:t,index:r,isLastStep:r+1===f,locale:d.locale,nonce:i,onInteract:T,shouldFocus:p,size:f,step:d,styles:d.styles})));return rt.createElement(UI,{element:l},P)}function ese(e){const{continuous:t,controls:n,index:r,lifecycle:s,nonce:i,portalElement:a,setPositionData:l,shouldScroll:c,size:u,step:p,updateState:f}=e,[d,h]=m.useState(null);Wre(p.disableFocusTrap?null:d,"[data-action=primary]");const y=ps(p.target),b=s===De.TOOLTIP;return!VI(p)||!dr.domElement(y)?null:rt.createElement(Zre,{key:`JoyrideStep-${r}`,continuous:t,controls:n,index:r,lifecycle:s,nonce:i,open:b,portalElement:a,setPositionData:l,setTooltipRef:h,shouldScroll:c,size:u,step:p,target:y,updateState:f})}function tse({controls:e,mergedProps:t,state:n,step:r,store:s}){const{continuous:i,debug:a,nonce:l,portalElement:c,scrollToFirstStep:u}=t,p=Mre(c),{index:f,lifecycle:d,status:h}=n,y=h===bt.RUNNING,[b,k]=m.useState(!1),g=m.useRef(null),w=(r==null?void 0:r.loaderDelay)??0;m.useEffect(()=>(n.waiting?w===0?k(!0):g.current=setTimeout(()=>{k(!0)},w):k(!1),()=>{g.current&&(clearTimeout(g.current),g.current=null)}),[w,n.waiting]),m.useEffect(()=>{if(!y)return;const C=j=>{!r||d!==De.TOOLTIP||j.key==="Escape"&&r.dismissKeyAction&&(r.dismissKeyAction==="next"?e.next(Xs.KEYBOARD):e.close(Xs.KEYBOARD))};return document.body.addEventListener("keydown",C,{passive:!0}),()=>{document.body.removeEventListener("keydown",C)}},[e,y,d,r]);const x=m.useCallback(()=>{(r==null?void 0:r.overlayClickAction)==="close"?e.close(Xs.OVERLAY):(r==null?void 0:r.overlayClickAction)==="next"&&e.next(Xs.OVERLAY)},[e,r==null?void 0:r.overlayClickAction]);if(!r||!y)return null;const N=n.action===Nt.START&&!r.skipBeacon&&r.placement!=="center";return rt.createElement(rt.Fragment,null,d!==De.INIT&&rt.createElement(ese,{...n,continuous:i,controls:e,debug:a,nonce:l,portalElement:p,setPositionData:s.current.setPositionData,shouldScroll:!r.skipScroll&&(f!==0||u),step:r,updateState:s.current.updateState}),rt.createElement(UI,{element:p},rt.createElement(rt.Fragment,null,b&&rt.createElement(Lre,{nonce:l,step:r}),!N&&rt.createElement(Hre,{...r,continuous:i,lifecycle:d,onClickOverlay:x,portalElement:c?p:null,scrolling:n.scrolling,waiting:n.waiting}))))}function nse(e){const{controls:t,failures:n,mergedProps:r,state:s,step:i,store:a}=Rre(e);return{controls:t,failures:n,on:m.useCallback((l,c)=>a.current.on(l,c),[a]),state:m.useMemo(()=>nh(s,"positioned"),[s]),step:i,Tour:Ib()?rt.createElement(tse,{controls:t,mergedProps:r,state:s,step:i,store:a}):null}}function rse(e){const{Tour:t}=nse(e);return t}function sse(e){return Ib()?rt.createElement(rse,e):null}function ise(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 ose(e){return[{target:"body",content:e("onboarding:flow.intro"),disableBeacon:!0,placement:"center"}]}function ase(e){return[{target:"body",content:e("onboarding:flow.introEmpty"),disableBeacon:!0,placement:"center"}]}const Rf="af:onboarding";function lse({page:e,hasNodes:t=!1}){const{t:n}=Cr(),[r,s]=m.useState(!1),[i,a]=m.useState([]),l=m.useRef(null),c=m.useMemo(()=>e==="projects"?ise(n):t?ose(n):ase(n),[e,t,n]);return m.useEffect(()=>{const u=localStorage.getItem(Rf),p=u?JSON.parse(u):{};if(p.completed||p[e]){s(!1),a([]);return}localStorage.setItem(Rf,JSON.stringify({...p,[e]:!0})),a(c),s(!0)},[e,t,c]),m.useEffect(()=>{if(!r)return;const u=p=>{var y;const f=p.target.closest("button");if(!f||!f.closest(".react-joyride__tooltip"))return;const h=(y=f.textContent)==null?void 0:y.trim();if(h===n("onboarding:done")||h===n("onboarding:startCreate")||h===n("onboarding:skip")){const b=localStorage.getItem(Rf)||"{}",k=JSON.parse(b);h===n("onboarding:skip")?(k.projects=!0,k.flow=!0,k.completed=!0):k[e]=!0,localStorage.setItem(Rf,JSON.stringify(k)),a([]),s(!1),e==="projects"&&(h===n("onboarding:done")||h===n("onboarding:startCreate"))&&(localStorage.setItem("af:newPipelineGuide","true"),setTimeout(()=>{const g=document.querySelector(".af-create-btn");g&&g.click()},500))}};return document.addEventListener("click",u,!0),()=>document.removeEventListener("click",u,!0)},[r,e,n]),!r||i.length===0?null:o.jsx(sse,{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 cse(){const{navigate:e,path:t}=ui(),[n,r]=m.useState([]),[s,i]=m.useState(!1);if(m.useEffect(()=>{let p=!1;const f=async()=>{try{const h=await fetch("/api/pipeline-recent-runs");if(!h.ok)return;const y=await h.json();if(p)return;const b=Array.isArray(y.runs)?y.runs:[];r(b.filter(k=>k&&k.status==="running"))}catch{}};f();const d=window.setInterval(f,3e3);return()=>{p=!0,window.clearInterval(d)}},[]),n.length===0)return null;const a=p=>{const f=new URLSearchParams({flowId:p.flowId,flowSource:p.flowSource||"workspace"});e(`/flow?${f.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(p=>o.jsxs("button",{type:"button",className:"af-run-indicator__item"+(p.flowId===c?" af-run-indicator__item--current":""),onClick:()=>a(p),title:`${p.flowId} · ${p.runId}`,children:[o.jsx("span",{className:"af-run-indicator__dot"}),o.jsx("span",{className:"af-run-indicator__flow",children:p.flowId}),o.jsx("span",{className:"af-run-indicator__run",children:p.runId.slice(0,12)})]},`${p.flowId}:${p.runId}`))}),o.jsxs("button",{type:"button",className:"af-run-indicator__btn",onClick:()=>u?a(n[0]):i(p=>!p),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 qI(e){return e==="/likee-context"||e==="/likee_context"}function use(){const{navigate:e}=ui();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 dse 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 fse({authUser:e}){const{path:t}=ui();return t==="/projects"||t==="/"?o.jsx(Da,{authUser:e}):t==="/nodes"?o.jsx(Da,{authUser:e,resourceKind:"nodes"}):t==="/my-nodes"?o.jsx(Da,{authUser:e,resourceKind:"my-nodes"}):t==="/my-flows"?o.jsx(Da,{authUser:e,resourceKind:"my-flows"}):t==="/skills"?o.jsx(Da,{authUser:e,resourceKind:"skills"}):t==="/workspaces"?o.jsx(Uee,{authUser:e}):t==="/mcps"?o.jsx($ee,{}):t==="/schedules"?o.jsx(Dee,{}):t==="/node-studio"?o.jsx(zee,{}):t==="/flow"?o.jsx(use,{}):t==="/workspace"?o.jsx(X7,{}):t.startsWith("/display")?o.jsx(oI,{}):t==="/settings"?o.jsx(jee,{authUser:e}):t==="/admin/usage"?o.jsx(Aee,{authUser:e}):t==="/feedback"?o.jsx(Iee,{authUser:e}):qI(t)?o.jsx(yI,{}):o.jsx(Da,{})}function pse({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,p]=m.useState(""),f=async()=>{try{const y=await(await fetch("/api/auth/me")).json().catch(()=>({}));n({loading:!1,authenticated:!!y.authenticated,user:y.user||null,setupRequired:!!y.setupRequired}),p(y.error?String(y.error):"")}catch(h){n({loading:!1,authenticated:!1,user:null,setupRequired:!1}),p(String(h.message||h))}};m.useEffect(()=>{f()},[]);const d=async h=>{h.preventDefault(),c(!0),p("");try{const y=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:r,password:i})}),b=await y.json().catch(()=>({}));if(!y.ok)throw new Error(b.error||"登录失败");n({loading:!1,authenticated:!0,user:b.user||null,setupRequired:!1})}catch(y){p(String(y.message||y))}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:d,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 hse({authUser:e,onLogout:t}){const{path:n}=ui(),r=n==="/flow"||n==="/workspace";return o.jsxs("div",{className:"af-app",children:[n!=="/settings"?o.jsx(lse,{page:r?"flow":"projects"}):null,r?null:o.jsx(e$,{authUser:e,onLogout:t}),o.jsx("div",{className:r?"af-main af-main--pipeline":"af-main",children:o.jsx(fse,{authUser:e})}),o.jsx(cse,{})]})}function mse(){return o.jsx(dse,{children:o.jsx($2,{children:o.jsx(gse,{})})})}function gse(){const{path:e}=ui();return e.startsWith("/display")?o.jsx(oI,{}):qI(e)?o.jsx(yI,{}):o.jsx(pse,{children:({user:t,onLogout:n})=>o.jsx(hse,{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 a1=document.querySelector('link[rel="icon"]');a1&&(a1.href=S_);Lg.createRoot(document.getElementById("root")).render(o.jsx(rt.StrictMode,{children:o.jsx(mse,{})}));
|