@fieldwangai/agentflow 0.1.45 → 0.1.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/lib/auth.mjs +30 -3
- package/bin/lib/ui-server.mjs +28 -0
- package/builtin/web-ui/dist/assets/index-3wtFgU47.js +222 -0
- package/builtin/web-ui/dist/assets/index-BrESzdFb.css +1 -0
- package/builtin/web-ui/dist/index.html +2 -2
- package/package.json +1 -1
- package/builtin/web-ui/dist/assets/index-CTI29E9h.js +0 -222
- package/builtin/web-ui/dist/assets/index-DLRqQLBo.css +0 -1
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
var U2=Object.defineProperty;var K2=(e,t,n)=>t in e?U2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Yn=(e,t,n)=>K2(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 Id=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $a(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var P1={exports:{}},Em={},A1={exports:{}},Tt={};/**
|
|
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 xf=Symbol.for("react.element"),q2=Symbol.for("react.portal"),Y2=Symbol.for("react.fragment"),G2=Symbol.for("react.strict_mode"),X2=Symbol.for("react.profiler"),J2=Symbol.for("react.provider"),Q2=Symbol.for("react.context"),Z2=Symbol.for("react.forward_ref"),eR=Symbol.for("react.suspense"),tR=Symbol.for("react.memo"),nR=Symbol.for("react.lazy"),x0=Symbol.iterator;function rR(e){return e===null||typeof e!="object"?null:(e=x0&&e[x0]||e["@@iterator"],typeof e=="function"?e:null)}var I1={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T1=Object.assign,R1={};function uu(e,t,n){this.props=e,this.context=t,this.refs=R1,this.updater=n||I1}uu.prototype.isReactComponent={};uu.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")};uu.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function L1(){}L1.prototype=uu.prototype;function Gw(e,t,n){this.props=e,this.context=t,this.refs=R1,this.updater=n||I1}var Xw=Gw.prototype=new L1;Xw.constructor=Gw;T1(Xw,uu.prototype);Xw.isPureReactComponent=!0;var w0=Array.isArray,O1=Object.prototype.hasOwnProperty,Jw={current:null},M1={key:!0,ref:!0,__self:!0,__source:!0};function $1(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)O1.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 u=Array(l),d=0;d<l;d++)u[d]=arguments[d+2];s.children=u}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)s[r]===void 0&&(s[r]=l[r]);return{$$typeof:xf,type:e,key:i,ref:a,props:s,_owner:Jw.current}}function sR(e,t){return{$$typeof:xf,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Qw(e){return typeof e=="object"&&e!==null&&e.$$typeof===xf}function iR(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var b0=/\/+/g;function Mg(e,t){return typeof e=="object"&&e!==null&&e.key!=null?iR(""+e.key):t.toString(36)}function Gp(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 xf:case q2:a=!0}}if(a)return a=e,s=s(a),e=r===""?"."+Mg(a,0):r,w0(s)?(n="",e!=null&&(n=e.replace(b0,"$&/")+"/"),Gp(s,t,n,"",function(d){return d})):s!=null&&(Qw(s)&&(s=sR(s,n+(!s.key||a&&a.key===s.key?"":(""+s.key).replace(b0,"$&/")+"/")+e)),t.push(s)),1;if(a=0,r=r===""?".":r+":",w0(e))for(var l=0;l<e.length;l++){i=e[l];var u=r+Mg(i,l);a+=Gp(i,t,n,u,s)}else if(u=rR(e),typeof u=="function")for(e=u.call(e),l=0;!(i=e.next()).done;)i=i.value,u=r+Mg(i,l++),a+=Gp(i,t,n,u,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 sp(e,t,n){if(e==null)return e;var r=[],s=0;return Gp(e,r,"","",function(i){return t.call(n,i,s++)}),r}function oR(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 qr={current:null},Xp={transition:null},aR={ReactCurrentDispatcher:qr,ReactCurrentBatchConfig:Xp,ReactCurrentOwner:Jw};function D1(){throw Error("act(...) is not supported in production builds of React.")}Tt.Children={map:sp,forEach:function(e,t,n){sp(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return sp(e,function(){t++}),t},toArray:function(e){return sp(e,function(t){return t})||[]},only:function(e){if(!Qw(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Tt.Component=uu;Tt.Fragment=Y2;Tt.Profiler=X2;Tt.PureComponent=Gw;Tt.StrictMode=G2;Tt.Suspense=eR;Tt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=aR;Tt.act=D1;Tt.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=T1({},e.props),s=e.key,i=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,a=Jw.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(u in t)O1.call(t,u)&&!M1.hasOwnProperty(u)&&(r[u]=t[u]===void 0&&l!==void 0?l[u]:t[u])}var u=arguments.length-2;if(u===1)r.children=n;else if(1<u){l=Array(u);for(var d=0;d<u;d++)l[d]=arguments[d+2];r.children=l}return{$$typeof:xf,type:e.type,key:s,ref:i,props:r,_owner:a}};Tt.createContext=function(e){return e={$$typeof:Q2,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:J2,_context:e},e.Consumer=e};Tt.createElement=$1;Tt.createFactory=function(e){var t=$1.bind(null,e);return t.type=e,t};Tt.createRef=function(){return{current:null}};Tt.forwardRef=function(e){return{$$typeof:Z2,render:e}};Tt.isValidElement=Qw;Tt.lazy=function(e){return{$$typeof:nR,_payload:{_status:-1,_result:e},_init:oR}};Tt.memo=function(e,t){return{$$typeof:tR,type:e,compare:t===void 0?null:t}};Tt.startTransition=function(e){var t=Xp.transition;Xp.transition={};try{e()}finally{Xp.transition=t}};Tt.unstable_act=D1;Tt.useCallback=function(e,t){return qr.current.useCallback(e,t)};Tt.useContext=function(e){return qr.current.useContext(e)};Tt.useDebugValue=function(){};Tt.useDeferredValue=function(e){return qr.current.useDeferredValue(e)};Tt.useEffect=function(e,t){return qr.current.useEffect(e,t)};Tt.useId=function(){return qr.current.useId()};Tt.useImperativeHandle=function(e,t,n){return qr.current.useImperativeHandle(e,t,n)};Tt.useInsertionEffect=function(e,t){return qr.current.useInsertionEffect(e,t)};Tt.useLayoutEffect=function(e,t){return qr.current.useLayoutEffect(e,t)};Tt.useMemo=function(e,t){return qr.current.useMemo(e,t)};Tt.useReducer=function(e,t,n){return qr.current.useReducer(e,t,n)};Tt.useRef=function(e){return qr.current.useRef(e)};Tt.useState=function(e){return qr.current.useState(e)};Tt.useSyncExternalStore=function(e,t,n){return qr.current.useSyncExternalStore(e,t,n)};Tt.useTransition=function(){return qr.current.useTransition()};Tt.version="18.3.1";A1.exports=Tt;var m=A1.exports;const ot=$a(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 lR=m,cR=Symbol.for("react.element"),uR=Symbol.for("react.fragment"),dR=Object.prototype.hasOwnProperty,fR=lR.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,pR={key:!0,ref:!0,__self:!0,__source:!0};function F1(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)dR.call(t,r)&&!pR.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:cR,type:e,key:i,ref:a,props:s,_owner:fR.current}}Em.Fragment=uR;Em.jsx=F1;Em.jsxs=F1;P1.exports=Em;var o=P1.exports,nx={},z1={exports:{}},$s={},B1={exports:{}},H1={};/**
|
|
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,L){var _=P.length;P.push(L);e:for(;0<_;){var G=_-1>>>1,Z=P[G];if(0<s(Z,L))P[G]=L,P[_]=Z,_=G;else break e}}function n(P){return P.length===0?null:P[0]}function r(P){if(P.length===0)return null;var L=P[0],_=P.pop();if(_!==L){P[0]=_;e:for(var G=0,Z=P.length,U=Z>>>1;G<U;){var se=2*(G+1)-1,ue=P[se],de=se+1,me=P[de];if(0>s(ue,_))de<Z&&0>s(me,ue)?(P[G]=me,P[de]=_,G=de):(P[G]=ue,P[se]=_,G=se);else if(de<Z&&0>s(me,_))P[G]=me,P[de]=_,G=de;else break e}}return L}function s(P,L){var _=P.sortIndex-L.sortIndex;return _!==0?_:P.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}var u=[],d=[],f=1,c=null,p=3,h=!1,g=!1,v=!1,k=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(P){for(var L=n(d);L!==null;){if(L.callback===null)r(d);else if(L.startTime<=P)r(d),L.sortIndex=L.expirationTime,t(u,L);else break;L=n(d)}}function N(P){if(v=!1,w(P),!g)if(n(u)!==null)g=!0,I(C);else{var L=n(d);L!==null&&B(N,L.startTime-P)}}function C(P,L){g=!1,v&&(v=!1,y(D),D=-1),h=!0;var _=p;try{for(w(L),c=n(u);c!==null&&(!(c.expirationTime>L)||P&&!$());){var G=c.callback;if(typeof G=="function"){c.callback=null,p=c.priorityLevel;var Z=G(c.expirationTime<=L);L=e.unstable_now(),typeof Z=="function"?c.callback=Z:c===n(u)&&r(u),w(L)}else r(u);c=n(u)}if(c!==null)var U=!0;else{var se=n(d);se!==null&&B(N,se.startTime-L),U=!1}return U}finally{c=null,p=_,h=!1}}var j=!1,R=null,D=-1,M=5,z=-1;function $(){return!(e.unstable_now()-z<M)}function A(){if(R!==null){var P=e.unstable_now();z=P;var L=!0;try{L=R(!0,P)}finally{L?F():(j=!1,R=null)}}else j=!1}var F;if(typeof b=="function")F=function(){b(A)};else if(typeof MessageChannel<"u"){var T=new MessageChannel,O=T.port2;T.port1.onmessage=A,F=function(){O.postMessage(null)}}else F=function(){k(A,0)};function I(P){R=P,j||(j=!0,F())}function B(P,L){D=k(function(){P(e.unstable_now())},L)}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(){g||h||(g=!0,I(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"):M=0<P?Math.floor(1e3/P):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_getFirstCallbackNode=function(){return n(u)},e.unstable_next=function(P){switch(p){case 1:case 2:case 3:var L=3;break;default:L=p}var _=p;p=L;try{return P()}finally{p=_}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(P,L){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var _=p;p=P;try{return L()}finally{p=_}},e.unstable_scheduleCallback=function(P,L,_){var G=e.unstable_now();switch(typeof _=="object"&&_!==null?(_=_.delay,_=typeof _=="number"&&0<_?G+_:G):_=G,P){case 1:var Z=-1;break;case 2:Z=250;break;case 5:Z=1073741823;break;case 4:Z=1e4;break;default:Z=5e3}return Z=_+Z,P={id:f++,callback:L,priorityLevel:P,startTime:_,expirationTime:Z,sortIndex:-1},_>G?(P.sortIndex=_,t(d,P),n(u)===null&&P===n(d)&&(v?(y(D),D=-1):v=!0,B(N,_-G))):(P.sortIndex=Z,t(u,P),g||h||(g=!0,I(C))),P},e.unstable_shouldYield=$,e.unstable_wrapCallback=function(P){var L=p;return function(){var _=p;p=L;try{return P.apply(this,arguments)}finally{p=_}}}})(H1);B1.exports=H1;var hR=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 mR=m,Os=hR;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 W1=new Set,Td={};function Ml(e,t){Wc(e,t),Wc(e+"Capture",t)}function Wc(e,t){for(Td[e]=t,e=0;e<t.length;e++)W1.add(t[e])}var Ro=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),rx=Object.prototype.hasOwnProperty,gR=/^[: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]*$/,v0={},k0={};function yR(e){return rx.call(k0,e)?!0:rx.call(v0,e)?!1:gR.test(e)?k0[e]=!0:(v0[e]=!0,!1)}function xR(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 wR(e,t,n,r){if(t===null||typeof t>"u"||xR(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 Yr(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 Ar={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ar[e]=new Yr(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ar[t]=new Yr(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ar[e]=new Yr(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ar[e]=new Yr(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){Ar[e]=new Yr(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ar[e]=new Yr(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ar[e]=new Yr(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ar[e]=new Yr(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ar[e]=new Yr(e,5,!1,e.toLowerCase(),null,!1,!1)});var Zw=/[\-:]([a-z])/g;function eb(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(Zw,eb);Ar[t]=new Yr(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(Zw,eb);Ar[t]=new Yr(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(Zw,eb);Ar[t]=new Yr(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ar[e]=new Yr(e,1,!1,e.toLowerCase(),null,!1,!1)});Ar.xlinkHref=new Yr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ar[e]=new Yr(e,1,!1,e.toLowerCase(),null,!0,!0)});function tb(e,t,n,r){var s=Ar.hasOwnProperty(t)?Ar[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(wR(t,n,s,r)&&(n=null),r||s===null?yR(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 zo=mR.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,ip=Symbol.for("react.element"),hc=Symbol.for("react.portal"),mc=Symbol.for("react.fragment"),nb=Symbol.for("react.strict_mode"),sx=Symbol.for("react.profiler"),V1=Symbol.for("react.provider"),U1=Symbol.for("react.context"),rb=Symbol.for("react.forward_ref"),ix=Symbol.for("react.suspense"),ox=Symbol.for("react.suspense_list"),sb=Symbol.for("react.memo"),la=Symbol.for("react.lazy"),K1=Symbol.for("react.offscreen"),S0=Symbol.iterator;function $u(e){return e===null||typeof e!="object"?null:(e=S0&&e[S0]||e["@@iterator"],typeof e=="function"?e:null)}var Bn=Object.assign,$g;function td(e){if($g===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);$g=t&&t[1]||""}return`
|
|
34
|
+
`+$g+e}var Dg=!1;function Fg(e,t){if(!e||Dg)return"";Dg=!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(d){var r=d}Reflect.construct(e,[],t)}else{try{t.call()}catch(d){r=d}e.call(t.prototype)}else{try{throw Error()}catch(d){r=d}e()}}catch(d){if(d&&r&&typeof d.stack=="string"){for(var s=d.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 u=`
|
|
37
|
+
`+s[a].replace(" at new "," at ");return e.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",e.displayName)),u}while(1<=a&&0<=l);break}}}finally{Dg=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?td(e):""}function bR(e){switch(e.tag){case 5:return td(e.type);case 16:return td("Lazy");case 13:return td("Suspense");case 19:return td("SuspenseList");case 0:case 2:case 15:return e=Fg(e.type,!1),e;case 11:return e=Fg(e.type.render,!1),e;case 1:return e=Fg(e.type,!0),e;default:return""}}function ax(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 mc:return"Fragment";case hc:return"Portal";case sx:return"Profiler";case nb:return"StrictMode";case ix:return"Suspense";case ox:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case U1:return(e.displayName||"Context")+".Consumer";case V1:return(e._context.displayName||"Context")+".Provider";case rb:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case sb:return t=e.displayName||null,t!==null?t:ax(e.type)||"Memo";case la:t=e._payload,e=e._init;try{return ax(e(t))}catch{}}return null}function vR(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 ax(t);case 8:return t===nb?"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 Aa(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function q1(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function kR(e){var t=q1(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 op(e){e._valueTracker||(e._valueTracker=kR(e))}function Y1(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=q1(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function wh(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 lx(e,t){var n=t.checked;return Bn({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function N0(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Aa(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 G1(e,t){t=t.checked,t!=null&&tb(e,"checked",t,!1)}function cx(e,t){G1(e,t);var n=Aa(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")?ux(e,t.type,n):t.hasOwnProperty("defaultValue")&&ux(e,t.type,Aa(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function j0(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 ux(e,t,n){(t!=="number"||wh(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var nd=Array.isArray;function Tc(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=""+Aa(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 dx(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(je(91));return Bn({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function C0(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(nd(n)){if(1<n.length)throw Error(je(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Aa(n)}}function X1(e,t){var n=Aa(t.value),r=Aa(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 E0(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function J1(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 fx(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?J1(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var ap,Q1=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(ap=ap||document.createElement("div"),ap.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=ap.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Rd(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var fd={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},SR=["Webkit","ms","Moz","O"];Object.keys(fd).forEach(function(e){SR.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),fd[t]=fd[e]})});function Z1(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||fd.hasOwnProperty(e)&&fd[e]?(""+t).trim():t+"px"}function eC(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=Z1(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var NR=Bn({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 px(e,t){if(t){if(NR[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 hx(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 mx=null;function ib(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var gx=null,Rc=null,Lc=null;function _0(e){if(e=vf(e)){if(typeof gx!="function")throw Error(je(280));var t=e.stateNode;t&&(t=Tm(t),gx(e.stateNode,e.type,t))}}function tC(e){Rc?Lc?Lc.push(e):Lc=[e]:Rc=e}function nC(){if(Rc){var e=Rc,t=Lc;if(Lc=Rc=null,_0(e),t)for(e=0;e<t.length;e++)_0(t[e])}}function rC(e,t){return e(t)}function sC(){}var zg=!1;function iC(e,t,n){if(zg)return e(t,n);zg=!0;try{return rC(e,t,n)}finally{zg=!1,(Rc!==null||Lc!==null)&&(sC(),nC())}}function Ld(e,t){var n=e.stateNode;if(n===null)return null;var r=Tm(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 yx=!1;if(Ro)try{var Du={};Object.defineProperty(Du,"passive",{get:function(){yx=!0}}),window.addEventListener("test",Du,Du),window.removeEventListener("test",Du,Du)}catch{yx=!1}function jR(e,t,n,r,s,i,a,l,u){var d=Array.prototype.slice.call(arguments,3);try{t.apply(n,d)}catch(f){this.onError(f)}}var pd=!1,bh=null,vh=!1,xx=null,CR={onError:function(e){pd=!0,bh=e}};function ER(e,t,n,r,s,i,a,l,u){pd=!1,bh=null,jR.apply(CR,arguments)}function _R(e,t,n,r,s,i,a,l,u){if(ER.apply(this,arguments),pd){if(pd){var d=bh;pd=!1,bh=null}else throw Error(je(198));vh||(vh=!0,xx=d)}}function $l(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 oC(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 P0(e){if($l(e)!==e)throw Error(je(188))}function PR(e){var t=e.alternate;if(!t){if(t=$l(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 P0(s),e;if(i===r)return P0(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 aC(e){return e=PR(e),e!==null?lC(e):null}function lC(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=lC(e);if(t!==null)return t;e=e.sibling}return null}var cC=Os.unstable_scheduleCallback,A0=Os.unstable_cancelCallback,AR=Os.unstable_shouldYield,IR=Os.unstable_requestPaint,Qn=Os.unstable_now,TR=Os.unstable_getCurrentPriorityLevel,ob=Os.unstable_ImmediatePriority,uC=Os.unstable_UserBlockingPriority,kh=Os.unstable_NormalPriority,RR=Os.unstable_LowPriority,dC=Os.unstable_IdlePriority,_m=null,so=null;function LR(e){if(so&&typeof so.onCommitFiberRoot=="function")try{so.onCommitFiberRoot(_m,e,void 0,(e.current.flags&128)===128)}catch{}}var Si=Math.clz32?Math.clz32:$R,OR=Math.log,MR=Math.LN2;function $R(e){return e>>>=0,e===0?32:31-(OR(e)/MR|0)|0}var lp=64,cp=4194304;function rd(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 Sh(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=rd(l):(i&=a,i!==0&&(r=rd(i)))}else a=n&~s,a!==0?r=rd(a):i!==0&&(r=rd(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-Si(t),s=1<<n,r|=e[n],t&=~s;return r}function DR(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 FR(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes;0<i;){var a=31-Si(i),l=1<<a,u=s[a];u===-1?(!(l&n)||l&r)&&(s[a]=DR(l,t)):u<=t&&(e.expiredLanes|=l),i&=~l}}function wx(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function fC(){var e=lp;return lp<<=1,!(lp&4194240)&&(lp=64),e}function Bg(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function wf(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Si(t),e[t]=n}function zR(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-Si(n),i=1<<s;t[s]=0,r[s]=-1,e[s]=-1,n&=~i}}function ab(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Si(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}var nn=0;function pC(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var hC,lb,mC,gC,yC,bx=!1,up=[],xa=null,wa=null,ba=null,Od=new Map,Md=new Map,da=[],BR="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 I0(e,t){switch(e){case"focusin":case"focusout":xa=null;break;case"dragenter":case"dragleave":wa=null;break;case"mouseover":case"mouseout":ba=null;break;case"pointerover":case"pointerout":Od.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Md.delete(t.pointerId)}}function Fu(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=vf(t),t!==null&&lb(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function HR(e,t,n,r,s){switch(t){case"focusin":return xa=Fu(xa,e,t,n,r,s),!0;case"dragenter":return wa=Fu(wa,e,t,n,r,s),!0;case"mouseover":return ba=Fu(ba,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return Od.set(i,Fu(Od.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,Md.set(i,Fu(Md.get(i)||null,e,t,n,r,s)),!0}return!1}function xC(e){var t=ml(e.target);if(t!==null){var n=$l(t);if(n!==null){if(t=n.tag,t===13){if(t=oC(n),t!==null){e.blockedOn=t,yC(e.priority,function(){mC(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 Jp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=vx(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);mx=r,n.target.dispatchEvent(r),mx=null}else return t=vf(n),t!==null&&lb(t),e.blockedOn=n,!1;t.shift()}return!0}function T0(e,t,n){Jp(e)&&n.delete(t)}function WR(){bx=!1,xa!==null&&Jp(xa)&&(xa=null),wa!==null&&Jp(wa)&&(wa=null),ba!==null&&Jp(ba)&&(ba=null),Od.forEach(T0),Md.forEach(T0)}function zu(e,t){e.blockedOn===t&&(e.blockedOn=null,bx||(bx=!0,Os.unstable_scheduleCallback(Os.unstable_NormalPriority,WR)))}function $d(e){function t(s){return zu(s,e)}if(0<up.length){zu(up[0],e);for(var n=1;n<up.length;n++){var r=up[n];r.blockedOn===e&&(r.blockedOn=null)}}for(xa!==null&&zu(xa,e),wa!==null&&zu(wa,e),ba!==null&&zu(ba,e),Od.forEach(t),Md.forEach(t),n=0;n<da.length;n++)r=da[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<da.length&&(n=da[0],n.blockedOn===null);)xC(n),n.blockedOn===null&&da.shift()}var Oc=zo.ReactCurrentBatchConfig,Nh=!0;function VR(e,t,n,r){var s=nn,i=Oc.transition;Oc.transition=null;try{nn=1,cb(e,t,n,r)}finally{nn=s,Oc.transition=i}}function UR(e,t,n,r){var s=nn,i=Oc.transition;Oc.transition=null;try{nn=4,cb(e,t,n,r)}finally{nn=s,Oc.transition=i}}function cb(e,t,n,r){if(Nh){var s=vx(e,t,n,r);if(s===null)Jg(e,t,r,jh,n),I0(e,r);else if(HR(s,e,t,n,r))r.stopPropagation();else if(I0(e,r),t&4&&-1<BR.indexOf(e)){for(;s!==null;){var i=vf(s);if(i!==null&&hC(i),i=vx(e,t,n,r),i===null&&Jg(e,t,r,jh,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else Jg(e,t,r,null,n)}}var jh=null;function vx(e,t,n,r){if(jh=null,e=ib(r),e=ml(e),e!==null)if(t=$l(e),t===null)e=null;else if(n=t.tag,n===13){if(e=oC(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 jh=e,null}function wC(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(TR()){case ob:return 1;case uC:return 4;case kh:case RR:return 16;case dC:return 536870912;default:return 16}default:return 16}}var ha=null,ub=null,Qp=null;function bC(){if(Qp)return Qp;var e,t=ub,n=t.length,r,s="value"in ha?ha.value:ha.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 Qp=s.slice(e,1<r?1-r:void 0)}function Zp(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 dp(){return!0}function R0(){return!1}function Ds(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)?dp:R0,this.isPropagationStopped=R0,this}return Bn(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=dp)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=dp)},persist:function(){},isPersistent:dp}),t}var du={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},db=Ds(du),bf=Bn({},du,{view:0,detail:0}),KR=Ds(bf),Hg,Wg,Bu,Pm=Bn({},bf,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:fb,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!==Bu&&(Bu&&e.type==="mousemove"?(Hg=e.screenX-Bu.screenX,Wg=e.screenY-Bu.screenY):Wg=Hg=0,Bu=e),Hg)},movementY:function(e){return"movementY"in e?e.movementY:Wg}}),L0=Ds(Pm),qR=Bn({},Pm,{dataTransfer:0}),YR=Ds(qR),GR=Bn({},bf,{relatedTarget:0}),Vg=Ds(GR),XR=Bn({},du,{animationName:0,elapsedTime:0,pseudoElement:0}),JR=Ds(XR),QR=Bn({},du,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),ZR=Ds(QR),eL=Bn({},du,{data:0}),O0=Ds(eL),tL={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},nL={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"},rL={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function sL(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=rL[e])?!!t[e]:!1}function fb(){return sL}var iL=Bn({},bf,{key:function(e){if(e.key){var t=tL[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Zp(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?nL[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:fb,charCode:function(e){return e.type==="keypress"?Zp(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Zp(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),oL=Ds(iL),aL=Bn({},Pm,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),M0=Ds(aL),lL=Bn({},bf,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:fb}),cL=Ds(lL),uL=Bn({},du,{propertyName:0,elapsedTime:0,pseudoElement:0}),dL=Ds(uL),fL=Bn({},Pm,{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}),pL=Ds(fL),hL=[9,13,27,32],pb=Ro&&"CompositionEvent"in window,hd=null;Ro&&"documentMode"in document&&(hd=document.documentMode);var mL=Ro&&"TextEvent"in window&&!hd,vC=Ro&&(!pb||hd&&8<hd&&11>=hd),$0=" ",D0=!1;function kC(e,t){switch(e){case"keyup":return hL.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function SC(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var gc=!1;function gL(e,t){switch(e){case"compositionend":return SC(t);case"keypress":return t.which!==32?null:(D0=!0,$0);case"textInput":return e=t.data,e===$0&&D0?null:e;default:return null}}function yL(e,t){if(gc)return e==="compositionend"||!pb&&kC(e,t)?(e=bC(),Qp=ub=ha=null,gc=!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 vC&&t.locale!=="ko"?null:t.data;default:return null}}var xL={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 F0(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!xL[e.type]:t==="textarea"}function NC(e,t,n,r){tC(r),t=Ch(t,"onChange"),0<t.length&&(n=new db("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var md=null,Dd=null;function wL(e){OC(e,0)}function Am(e){var t=wc(e);if(Y1(t))return e}function bL(e,t){if(e==="change")return t}var jC=!1;if(Ro){var Ug;if(Ro){var Kg="oninput"in document;if(!Kg){var z0=document.createElement("div");z0.setAttribute("oninput","return;"),Kg=typeof z0.oninput=="function"}Ug=Kg}else Ug=!1;jC=Ug&&(!document.documentMode||9<document.documentMode)}function B0(){md&&(md.detachEvent("onpropertychange",CC),Dd=md=null)}function CC(e){if(e.propertyName==="value"&&Am(Dd)){var t=[];NC(t,Dd,e,ib(e)),iC(wL,t)}}function vL(e,t,n){e==="focusin"?(B0(),md=t,Dd=n,md.attachEvent("onpropertychange",CC)):e==="focusout"&&B0()}function kL(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Am(Dd)}function SL(e,t){if(e==="click")return Am(t)}function NL(e,t){if(e==="input"||e==="change")return Am(t)}function jL(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ji=typeof Object.is=="function"?Object.is:jL;function Fd(e,t){if(ji(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(!rx.call(t,s)||!ji(e[s],t[s]))return!1}return!0}function H0(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function W0(e,t){var n=H0(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=H0(n)}}function EC(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?EC(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function _C(){for(var e=window,t=wh();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=wh(e.document)}return t}function hb(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 CL(e){var t=_C(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&EC(n.ownerDocument.documentElement,n)){if(r!==null&&hb(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!e.extend&&i>r&&(s=r,r=i,i=s),s=W0(n,i);var a=W0(n,r);s&&a&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var EL=Ro&&"documentMode"in document&&11>=document.documentMode,yc=null,kx=null,gd=null,Sx=!1;function V0(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Sx||yc==null||yc!==wh(r)||(r=yc,"selectionStart"in r&&hb(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}),gd&&Fd(gd,r)||(gd=r,r=Ch(kx,"onSelect"),0<r.length&&(t=new db("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=yc)))}function fp(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var xc={animationend:fp("Animation","AnimationEnd"),animationiteration:fp("Animation","AnimationIteration"),animationstart:fp("Animation","AnimationStart"),transitionend:fp("Transition","TransitionEnd")},qg={},PC={};Ro&&(PC=document.createElement("div").style,"AnimationEvent"in window||(delete xc.animationend.animation,delete xc.animationiteration.animation,delete xc.animationstart.animation),"TransitionEvent"in window||delete xc.transitionend.transition);function Im(e){if(qg[e])return qg[e];if(!xc[e])return e;var t=xc[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in PC)return qg[e]=t[n];return e}var AC=Im("animationend"),IC=Im("animationiteration"),TC=Im("animationstart"),RC=Im("transitionend"),LC=new Map,U0="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 Da(e,t){LC.set(e,t),Ml(t,[e])}for(var Yg=0;Yg<U0.length;Yg++){var Gg=U0[Yg],_L=Gg.toLowerCase(),PL=Gg[0].toUpperCase()+Gg.slice(1);Da(_L,"on"+PL)}Da(AC,"onAnimationEnd");Da(IC,"onAnimationIteration");Da(TC,"onAnimationStart");Da("dblclick","onDoubleClick");Da("focusin","onFocus");Da("focusout","onBlur");Da(RC,"onTransitionEnd");Wc("onMouseEnter",["mouseout","mouseover"]);Wc("onMouseLeave",["mouseout","mouseover"]);Wc("onPointerEnter",["pointerout","pointerover"]);Wc("onPointerLeave",["pointerout","pointerover"]);Ml("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Ml("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Ml("onBeforeInput",["compositionend","keypress","textInput","paste"]);Ml("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Ml("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Ml("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var sd="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(" "),AL=new Set("cancel close invalid load scroll toggle".split(" ").concat(sd));function K0(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,_R(r,t,void 0,e),e.currentTarget=null}function OC(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],u=l.instance,d=l.currentTarget;if(l=l.listener,u!==i&&s.isPropagationStopped())break e;K0(s,l,d),i=u}else for(a=0;a<r.length;a++){if(l=r[a],u=l.instance,d=l.currentTarget,l=l.listener,u!==i&&s.isPropagationStopped())break e;K0(s,l,d),i=u}}}if(vh)throw e=xx,vh=!1,xx=null,e}function En(e,t){var n=t[_x];n===void 0&&(n=t[_x]=new Set);var r=e+"__bubble";n.has(r)||(MC(t,e,2,!1),n.add(r))}function Xg(e,t,n){var r=0;t&&(r|=4),MC(n,e,r,t)}var pp="_reactListening"+Math.random().toString(36).slice(2);function zd(e){if(!e[pp]){e[pp]=!0,W1.forEach(function(n){n!=="selectionchange"&&(AL.has(n)||Xg(n,!1,e),Xg(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[pp]||(t[pp]=!0,Xg("selectionchange",!1,t))}}function MC(e,t,n,r){switch(wC(t)){case 1:var s=VR;break;case 4:s=UR;break;default:s=cb}n=s.bind(null,t,n,e),s=void 0,!yx||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 Jg(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 u=a.tag;if((u===3||u===4)&&(u=a.stateNode.containerInfo,u===s||u.nodeType===8&&u.parentNode===s))return;a=a.return}for(;l!==null;){if(a=ml(l),a===null)return;if(u=a.tag,u===5||u===6){r=i=a;continue e}l=l.parentNode}}r=r.return}iC(function(){var d=i,f=ib(n),c=[];e:{var p=LC.get(e);if(p!==void 0){var h=db,g=e;switch(e){case"keypress":if(Zp(n)===0)break e;case"keydown":case"keyup":h=oL;break;case"focusin":g="focus",h=Vg;break;case"focusout":g="blur",h=Vg;break;case"beforeblur":case"afterblur":h=Vg;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=L0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=YR;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=cL;break;case AC:case IC:case TC:h=JR;break;case RC:h=dL;break;case"scroll":h=KR;break;case"wheel":h=pL;break;case"copy":case"cut":case"paste":h=ZR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=M0}var v=(t&4)!==0,k=!v&&e==="scroll",y=v?p!==null?p+"Capture":null:p;v=[];for(var b=d,w;b!==null;){w=b;var N=w.stateNode;if(w.tag===5&&N!==null&&(w=N,y!==null&&(N=Ld(b,y),N!=null&&v.push(Bd(b,N,w)))),k)break;b=b.return}0<v.length&&(p=new h(p,g,null,n,f),c.push({event:p,listeners:v}))}}if(!(t&7)){e:{if(p=e==="mouseover"||e==="pointerover",h=e==="mouseout"||e==="pointerout",p&&n!==mx&&(g=n.relatedTarget||n.fromElement)&&(ml(g)||g[Lo]))break e;if((h||p)&&(p=f.window===f?f:(p=f.ownerDocument)?p.defaultView||p.parentWindow:window,h?(g=n.relatedTarget||n.toElement,h=d,g=g?ml(g):null,g!==null&&(k=$l(g),g!==k||g.tag!==5&&g.tag!==6)&&(g=null)):(h=null,g=d),h!==g)){if(v=L0,N="onMouseLeave",y="onMouseEnter",b="mouse",(e==="pointerout"||e==="pointerover")&&(v=M0,N="onPointerLeave",y="onPointerEnter",b="pointer"),k=h==null?p:wc(h),w=g==null?p:wc(g),p=new v(N,b+"leave",h,n,f),p.target=k,p.relatedTarget=w,N=null,ml(f)===d&&(v=new v(y,b+"enter",g,n,f),v.target=w,v.relatedTarget=k,N=v),k=N,h&&g)t:{for(v=h,y=g,b=0,w=v;w;w=sc(w))b++;for(w=0,N=y;N;N=sc(N))w++;for(;0<b-w;)v=sc(v),b--;for(;0<w-b;)y=sc(y),w--;for(;b--;){if(v===y||y!==null&&v===y.alternate)break t;v=sc(v),y=sc(y)}v=null}else v=null;h!==null&&q0(c,p,h,v,!1),g!==null&&k!==null&&q0(c,k,g,v,!0)}}e:{if(p=d?wc(d):window,h=p.nodeName&&p.nodeName.toLowerCase(),h==="select"||h==="input"&&p.type==="file")var C=bL;else if(F0(p))if(jC)C=NL;else{C=kL;var j=vL}else(h=p.nodeName)&&h.toLowerCase()==="input"&&(p.type==="checkbox"||p.type==="radio")&&(C=SL);if(C&&(C=C(e,d))){NC(c,C,n,f);break e}j&&j(e,p,d),e==="focusout"&&(j=p._wrapperState)&&j.controlled&&p.type==="number"&&ux(p,"number",p.value)}switch(j=d?wc(d):window,e){case"focusin":(F0(j)||j.contentEditable==="true")&&(yc=j,kx=d,gd=null);break;case"focusout":gd=kx=yc=null;break;case"mousedown":Sx=!0;break;case"contextmenu":case"mouseup":case"dragend":Sx=!1,V0(c,n,f);break;case"selectionchange":if(EL)break;case"keydown":case"keyup":V0(c,n,f)}var R;if(pb)e:{switch(e){case"compositionstart":var D="onCompositionStart";break e;case"compositionend":D="onCompositionEnd";break e;case"compositionupdate":D="onCompositionUpdate";break e}D=void 0}else gc?kC(e,n)&&(D="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(D="onCompositionStart");D&&(vC&&n.locale!=="ko"&&(gc||D!=="onCompositionStart"?D==="onCompositionEnd"&&gc&&(R=bC()):(ha=f,ub="value"in ha?ha.value:ha.textContent,gc=!0)),j=Ch(d,D),0<j.length&&(D=new O0(D,e,null,n,f),c.push({event:D,listeners:j}),R?D.data=R:(R=SC(n),R!==null&&(D.data=R)))),(R=mL?gL(e,n):yL(e,n))&&(d=Ch(d,"onBeforeInput"),0<d.length&&(f=new O0("onBeforeInput","beforeinput",null,n,f),c.push({event:f,listeners:d}),f.data=R))}OC(c,t)})}function Bd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ch(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=Ld(e,n),i!=null&&r.unshift(Bd(e,i,s)),i=Ld(e,t),i!=null&&r.push(Bd(e,i,s))),e=e.return}return r}function sc(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function q0(e,t,n,r,s){for(var i=t._reactName,a=[];n!==null&&n!==r;){var l=n,u=l.alternate,d=l.stateNode;if(u!==null&&u===r)break;l.tag===5&&d!==null&&(l=d,s?(u=Ld(n,i),u!=null&&a.unshift(Bd(n,u,l))):s||(u=Ld(n,i),u!=null&&a.push(Bd(n,u,l)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var IL=/\r\n?/g,TL=/\u0000|\uFFFD/g;function Y0(e){return(typeof e=="string"?e:""+e).replace(IL,`
|
|
38
|
+
`).replace(TL,"")}function hp(e,t,n){if(t=Y0(t),Y0(e)!==t&&n)throw Error(je(425))}function Eh(){}var Nx=null,jx=null;function Cx(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 Ex=typeof setTimeout=="function"?setTimeout:void 0,RL=typeof clearTimeout=="function"?clearTimeout:void 0,G0=typeof Promise=="function"?Promise:void 0,LL=typeof queueMicrotask=="function"?queueMicrotask:typeof G0<"u"?function(e){return G0.resolve(null).then(e).catch(OL)}:Ex;function OL(e){setTimeout(function(){throw e})}function Qg(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),$d(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);$d(t)}function va(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 X0(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 fu=Math.random().toString(36).slice(2),eo="__reactFiber$"+fu,Hd="__reactProps$"+fu,Lo="__reactContainer$"+fu,_x="__reactEvents$"+fu,ML="__reactListeners$"+fu,$L="__reactHandles$"+fu;function ml(e){var t=e[eo];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Lo]||n[eo]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=X0(e);e!==null;){if(n=e[eo])return n;e=X0(e)}return t}e=n,n=e.parentNode}return null}function vf(e){return e=e[eo]||e[Lo],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function wc(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(je(33))}function Tm(e){return e[Hd]||null}var Px=[],bc=-1;function Fa(e){return{current:e}}function Pn(e){0>bc||(e.current=Px[bc],Px[bc]=null,bc--)}function vn(e,t){bc++,Px[bc]=e.current,e.current=t}var Ia={},Dr=Fa(Ia),ps=Fa(!1),jl=Ia;function Vc(e,t){var n=e.type.contextTypes;if(!n)return Ia;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 hs(e){return e=e.childContextTypes,e!=null}function _h(){Pn(ps),Pn(Dr)}function J0(e,t,n){if(Dr.current!==Ia)throw Error(je(168));vn(Dr,t),vn(ps,n)}function $C(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,vR(e)||"Unknown",s));return Bn({},n,r)}function Ph(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ia,jl=Dr.current,vn(Dr,e),vn(ps,ps.current),!0}function Q0(e,t,n){var r=e.stateNode;if(!r)throw Error(je(169));n?(e=$C(e,t,jl),r.__reactInternalMemoizedMergedChildContext=e,Pn(ps),Pn(Dr),vn(Dr,e)):Pn(ps),vn(ps,n)}var No=null,Rm=!1,Zg=!1;function DC(e){No===null?No=[e]:No.push(e)}function DL(e){Rm=!0,DC(e)}function za(){if(!Zg&&No!==null){Zg=!0;var e=0,t=nn;try{var n=No;for(nn=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}No=null,Rm=!1}catch(s){throw No!==null&&(No=No.slice(e+1)),cC(ob,za),s}finally{nn=t,Zg=!1}}return null}var vc=[],kc=0,Ah=null,Ih=0,Ys=[],Gs=0,Cl=null,Eo=1,_o="";function cl(e,t){vc[kc++]=Ih,vc[kc++]=Ah,Ah=e,Ih=t}function FC(e,t,n){Ys[Gs++]=Eo,Ys[Gs++]=_o,Ys[Gs++]=Cl,Cl=e;var r=Eo;e=_o;var s=32-Si(r)-1;r&=~(1<<s),n+=1;var i=32-Si(t)+s;if(30<i){var a=s-s%5;i=(r&(1<<a)-1).toString(32),r>>=a,s-=a,Eo=1<<32-Si(t)+s|n<<s|r,_o=i+e}else Eo=1<<i|n<<s|r,_o=e}function mb(e){e.return!==null&&(cl(e,1),FC(e,1,0))}function gb(e){for(;e===Ah;)Ah=vc[--kc],vc[kc]=null,Ih=vc[--kc],vc[kc]=null;for(;e===Cl;)Cl=Ys[--Gs],Ys[Gs]=null,_o=Ys[--Gs],Ys[Gs]=null,Eo=Ys[--Gs],Ys[Gs]=null}var Rs=null,Is=null,Ln=!1,xi=null;function zC(e,t){var n=Qs(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 Z0(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,Rs=e,Is=va(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Rs=e,Is=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Cl!==null?{id:Eo,overflow:_o}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Qs(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Rs=e,Is=null,!0):!1;default:return!1}}function Ax(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Ix(e){if(Ln){var t=Is;if(t){var n=t;if(!Z0(e,t)){if(Ax(e))throw Error(je(418));t=va(n.nextSibling);var r=Rs;t&&Z0(e,t)?zC(r,n):(e.flags=e.flags&-4097|2,Ln=!1,Rs=e)}}else{if(Ax(e))throw Error(je(418));e.flags=e.flags&-4097|2,Ln=!1,Rs=e}}}function ek(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Rs=e}function mp(e){if(e!==Rs)return!1;if(!Ln)return ek(e),Ln=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Cx(e.type,e.memoizedProps)),t&&(t=Is)){if(Ax(e))throw BC(),Error(je(418));for(;t;)zC(e,t),t=va(t.nextSibling)}if(ek(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){Is=va(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Is=null}}else Is=Rs?va(e.stateNode.nextSibling):null;return!0}function BC(){for(var e=Is;e;)e=va(e.nextSibling)}function Uc(){Is=Rs=null,Ln=!1}function yb(e){xi===null?xi=[e]:xi.push(e)}var FL=zo.ReactCurrentBatchConfig;function Hu(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 gp(e,t){throw e=Object.prototype.toString.call(t),Error(je(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function tk(e){var t=e._init;return t(e._payload)}function HC(e){function t(y,b){if(e){var w=y.deletions;w===null?(y.deletions=[b],y.flags|=16):w.push(b)}}function n(y,b){if(!e)return null;for(;b!==null;)t(y,b),b=b.sibling;return null}function r(y,b){for(y=new Map;b!==null;)b.key!==null?y.set(b.key,b):y.set(b.index,b),b=b.sibling;return y}function s(y,b){return y=ja(y,b),y.index=0,y.sibling=null,y}function i(y,b,w){return y.index=w,e?(w=y.alternate,w!==null?(w=w.index,w<b?(y.flags|=2,b):w):(y.flags|=2,b)):(y.flags|=1048576,b)}function a(y){return e&&y.alternate===null&&(y.flags|=2),y}function l(y,b,w,N){return b===null||b.tag!==6?(b=oy(w,y.mode,N),b.return=y,b):(b=s(b,w),b.return=y,b)}function u(y,b,w,N){var C=w.type;return C===mc?f(y,b,w.props.children,N,w.key):b!==null&&(b.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===la&&tk(C)===b.type)?(N=s(b,w.props),N.ref=Hu(y,b,w),N.return=y,N):(N=oh(w.type,w.key,w.props,null,y.mode,N),N.ref=Hu(y,b,w),N.return=y,N)}function d(y,b,w,N){return b===null||b.tag!==4||b.stateNode.containerInfo!==w.containerInfo||b.stateNode.implementation!==w.implementation?(b=ay(w,y.mode,N),b.return=y,b):(b=s(b,w.children||[]),b.return=y,b)}function f(y,b,w,N,C){return b===null||b.tag!==7?(b=bl(w,y.mode,N,C),b.return=y,b):(b=s(b,w),b.return=y,b)}function c(y,b,w){if(typeof b=="string"&&b!==""||typeof b=="number")return b=oy(""+b,y.mode,w),b.return=y,b;if(typeof b=="object"&&b!==null){switch(b.$$typeof){case ip:return w=oh(b.type,b.key,b.props,null,y.mode,w),w.ref=Hu(y,null,b),w.return=y,w;case hc:return b=ay(b,y.mode,w),b.return=y,b;case la:var N=b._init;return c(y,N(b._payload),w)}if(nd(b)||$u(b))return b=bl(b,y.mode,w,null),b.return=y,b;gp(y,b)}return null}function p(y,b,w,N){var C=b!==null?b.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return C!==null?null:l(y,b,""+w,N);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case ip:return w.key===C?u(y,b,w,N):null;case hc:return w.key===C?d(y,b,w,N):null;case la:return C=w._init,p(y,b,C(w._payload),N)}if(nd(w)||$u(w))return C!==null?null:f(y,b,w,N,null);gp(y,w)}return null}function h(y,b,w,N,C){if(typeof N=="string"&&N!==""||typeof N=="number")return y=y.get(w)||null,l(b,y,""+N,C);if(typeof N=="object"&&N!==null){switch(N.$$typeof){case ip:return y=y.get(N.key===null?w:N.key)||null,u(b,y,N,C);case hc:return y=y.get(N.key===null?w:N.key)||null,d(b,y,N,C);case la:var j=N._init;return h(y,b,w,j(N._payload),C)}if(nd(N)||$u(N))return y=y.get(w)||null,f(b,y,N,C,null);gp(b,N)}return null}function g(y,b,w,N){for(var C=null,j=null,R=b,D=b=0,M=null;R!==null&&D<w.length;D++){R.index>D?(M=R,R=null):M=R.sibling;var z=p(y,R,w[D],N);if(z===null){R===null&&(R=M);break}e&&R&&z.alternate===null&&t(y,R),b=i(z,b,D),j===null?C=z:j.sibling=z,j=z,R=M}if(D===w.length)return n(y,R),Ln&&cl(y,D),C;if(R===null){for(;D<w.length;D++)R=c(y,w[D],N),R!==null&&(b=i(R,b,D),j===null?C=R:j.sibling=R,j=R);return Ln&&cl(y,D),C}for(R=r(y,R);D<w.length;D++)M=h(R,y,D,w[D],N),M!==null&&(e&&M.alternate!==null&&R.delete(M.key===null?D:M.key),b=i(M,b,D),j===null?C=M:j.sibling=M,j=M);return e&&R.forEach(function($){return t(y,$)}),Ln&&cl(y,D),C}function v(y,b,w,N){var C=$u(w);if(typeof C!="function")throw Error(je(150));if(w=C.call(w),w==null)throw Error(je(151));for(var j=C=null,R=b,D=b=0,M=null,z=w.next();R!==null&&!z.done;D++,z=w.next()){R.index>D?(M=R,R=null):M=R.sibling;var $=p(y,R,z.value,N);if($===null){R===null&&(R=M);break}e&&R&&$.alternate===null&&t(y,R),b=i($,b,D),j===null?C=$:j.sibling=$,j=$,R=M}if(z.done)return n(y,R),Ln&&cl(y,D),C;if(R===null){for(;!z.done;D++,z=w.next())z=c(y,z.value,N),z!==null&&(b=i(z,b,D),j===null?C=z:j.sibling=z,j=z);return Ln&&cl(y,D),C}for(R=r(y,R);!z.done;D++,z=w.next())z=h(R,y,D,z.value,N),z!==null&&(e&&z.alternate!==null&&R.delete(z.key===null?D:z.key),b=i(z,b,D),j===null?C=z:j.sibling=z,j=z);return e&&R.forEach(function(A){return t(y,A)}),Ln&&cl(y,D),C}function k(y,b,w,N){if(typeof w=="object"&&w!==null&&w.type===mc&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case ip:e:{for(var C=w.key,j=b;j!==null;){if(j.key===C){if(C=w.type,C===mc){if(j.tag===7){n(y,j.sibling),b=s(j,w.props.children),b.return=y,y=b;break e}}else if(j.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===la&&tk(C)===j.type){n(y,j.sibling),b=s(j,w.props),b.ref=Hu(y,j,w),b.return=y,y=b;break e}n(y,j);break}else t(y,j);j=j.sibling}w.type===mc?(b=bl(w.props.children,y.mode,N,w.key),b.return=y,y=b):(N=oh(w.type,w.key,w.props,null,y.mode,N),N.ref=Hu(y,b,w),N.return=y,y=N)}return a(y);case hc:e:{for(j=w.key;b!==null;){if(b.key===j)if(b.tag===4&&b.stateNode.containerInfo===w.containerInfo&&b.stateNode.implementation===w.implementation){n(y,b.sibling),b=s(b,w.children||[]),b.return=y,y=b;break e}else{n(y,b);break}else t(y,b);b=b.sibling}b=ay(w,y.mode,N),b.return=y,y=b}return a(y);case la:return j=w._init,k(y,b,j(w._payload),N)}if(nd(w))return g(y,b,w,N);if($u(w))return v(y,b,w,N);gp(y,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,b!==null&&b.tag===6?(n(y,b.sibling),b=s(b,w),b.return=y,y=b):(n(y,b),b=oy(w,y.mode,N),b.return=y,y=b),a(y)):n(y,b)}return k}var Kc=HC(!0),WC=HC(!1),Th=Fa(null),Rh=null,Sc=null,xb=null;function wb(){xb=Sc=Rh=null}function bb(e){var t=Th.current;Pn(Th),e._currentValue=t}function Tx(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 Mc(e,t){Rh=e,xb=Sc=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ls=!0),e.firstContext=null)}function ei(e){var t=e._currentValue;if(xb!==e)if(e={context:e,memoizedValue:t,next:null},Sc===null){if(Rh===null)throw Error(je(308));Sc=e,Rh.dependencies={lanes:0,firstContext:e}}else Sc=Sc.next=e;return t}var gl=null;function vb(e){gl===null?gl=[e]:gl.push(e)}function VC(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,vb(t)):(n.next=s.next,s.next=n),t.interleaved=n,Oo(e,r)}function Oo(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 ca=!1;function kb(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function UC(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 To(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ka(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ut&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,Oo(e,n)}return s=r.interleaved,s===null?(t.next=t,vb(r)):(t.next=s.next,s.next=t),r.interleaved=t,Oo(e,n)}function eh(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,ab(e,n)}}function nk(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=a:i=i.next=a,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Lh(e,t,n,r){var s=e.updateQueue;ca=!1;var i=s.firstBaseUpdate,a=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var u=l,d=u.next;u.next=null,a===null?i=d:a.next=d,a=u;var f=e.alternate;f!==null&&(f=f.updateQueue,l=f.lastBaseUpdate,l!==a&&(l===null?f.firstBaseUpdate=d:l.next=d,f.lastBaseUpdate=u))}if(i!==null){var c=s.baseState;a=0,f=d=u=null,l=i;do{var p=l.lane,h=l.eventTime;if((r&p)===p){f!==null&&(f=f.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var g=e,v=l;switch(p=t,h=n,v.tag){case 1:if(g=v.payload,typeof g=="function"){c=g.call(h,c,p);break e}c=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=v.payload,p=typeof g=="function"?g.call(h,c,p):g,p==null)break e;c=Bn({},c,p);break e;case 2:ca=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,p=s.effects,p===null?s.effects=[l]:p.push(l))}else h={eventTime:h,lane:p,tag:l.tag,payload:l.payload,callback:l.callback,next:null},f===null?(d=f=h,u=c):f=f.next=h,a|=p;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;p=l,l=p.next,p.next=null,s.lastBaseUpdate=p,s.shared.pending=null}}while(!0);if(f===null&&(u=c),s.baseState=u,s.firstBaseUpdate=d,s.lastBaseUpdate=f,t=s.shared.interleaved,t!==null){s=t;do a|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);_l|=a,e.lanes=a,e.memoizedState=c}}function rk(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 kf={},io=Fa(kf),Wd=Fa(kf),Vd=Fa(kf);function yl(e){if(e===kf)throw Error(je(174));return e}function Sb(e,t){switch(vn(Vd,t),vn(Wd,e),vn(io,kf),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:fx(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=fx(t,e)}Pn(io),vn(io,t)}function qc(){Pn(io),Pn(Wd),Pn(Vd)}function KC(e){yl(Vd.current);var t=yl(io.current),n=fx(t,e.type);t!==n&&(vn(Wd,e),vn(io,n))}function Nb(e){Wd.current===e&&(Pn(io),Pn(Wd))}var Fn=Fa(0);function Oh(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 ey=[];function jb(){for(var e=0;e<ey.length;e++)ey[e]._workInProgressVersionPrimary=null;ey.length=0}var th=zo.ReactCurrentDispatcher,ty=zo.ReactCurrentBatchConfig,El=0,zn=null,fr=null,yr=null,Mh=!1,yd=!1,Ud=0,zL=0;function Lr(){throw Error(je(321))}function Cb(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!ji(e[n],t[n]))return!1;return!0}function Eb(e,t,n,r,s,i){if(El=i,zn=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,th.current=e===null||e.memoizedState===null?VL:UL,e=n(r,s),yd){i=0;do{if(yd=!1,Ud=0,25<=i)throw Error(je(301));i+=1,yr=fr=null,t.updateQueue=null,th.current=KL,e=n(r,s)}while(yd)}if(th.current=$h,t=fr!==null&&fr.next!==null,El=0,yr=fr=zn=null,Mh=!1,t)throw Error(je(300));return e}function _b(){var e=Ud!==0;return Ud=0,e}function Xi(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return yr===null?zn.memoizedState=yr=e:yr=yr.next=e,yr}function ti(){if(fr===null){var e=zn.alternate;e=e!==null?e.memoizedState:null}else e=fr.next;var t=yr===null?zn.memoizedState:yr.next;if(t!==null)yr=t,fr=e;else{if(e===null)throw Error(je(310));fr=e,e={memoizedState:fr.memoizedState,baseState:fr.baseState,baseQueue:fr.baseQueue,queue:fr.queue,next:null},yr===null?zn.memoizedState=yr=e:yr=yr.next=e}return yr}function Kd(e,t){return typeof t=="function"?t(e):t}function ny(e){var t=ti(),n=t.queue;if(n===null)throw Error(je(311));n.lastRenderedReducer=e;var r=fr,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,u=null,d=i;do{var f=d.lane;if((El&f)===f)u!==null&&(u=u.next={lane:0,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null}),r=d.hasEagerState?d.eagerState:e(r,d.action);else{var c={lane:f,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null};u===null?(l=u=c,a=r):u=u.next=c,zn.lanes|=f,_l|=f}d=d.next}while(d!==null&&d!==i);u===null?a=r:u.next=l,ji(r,t.memoizedState)||(ls=!0),t.memoizedState=r,t.baseState=a,t.baseQueue=u,n.lastRenderedState=r}if(e=n.interleaved,e!==null){s=e;do i=s.lane,zn.lanes|=i,_l|=i,s=s.next;while(s!==e)}else s===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function ry(e){var t=ti(),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);ji(i,t.memoizedState)||(ls=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function qC(){}function YC(e,t){var n=zn,r=ti(),s=t(),i=!ji(r.memoizedState,s);if(i&&(r.memoizedState=s,ls=!0),r=r.queue,Pb(JC.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||yr!==null&&yr.memoizedState.tag&1){if(n.flags|=2048,qd(9,XC.bind(null,n,r,s,t),void 0,null),wr===null)throw Error(je(349));El&30||GC(n,t,s)}return s}function GC(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=zn.updateQueue,t===null?(t={lastEffect:null,stores:null},zn.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function XC(e,t,n,r){t.value=n,t.getSnapshot=r,QC(t)&&ZC(e)}function JC(e,t,n){return n(function(){QC(t)&&ZC(e)})}function QC(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!ji(e,n)}catch{return!0}}function ZC(e){var t=Oo(e,1);t!==null&&Ni(t,e,1,-1)}function sk(e){var t=Xi();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Kd,lastRenderedState:e},t.queue=e,e=e.dispatch=WL.bind(null,zn,e),[t.memoizedState,e]}function qd(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=zn.updateQueue,t===null?(t={lastEffect:null,stores:null},zn.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 eE(){return ti().memoizedState}function nh(e,t,n,r){var s=Xi();zn.flags|=e,s.memoizedState=qd(1|t,n,void 0,r===void 0?null:r)}function Lm(e,t,n,r){var s=ti();r=r===void 0?null:r;var i=void 0;if(fr!==null){var a=fr.memoizedState;if(i=a.destroy,r!==null&&Cb(r,a.deps)){s.memoizedState=qd(t,n,i,r);return}}zn.flags|=e,s.memoizedState=qd(1|t,n,i,r)}function ik(e,t){return nh(8390656,8,e,t)}function Pb(e,t){return Lm(2048,8,e,t)}function tE(e,t){return Lm(4,2,e,t)}function nE(e,t){return Lm(4,4,e,t)}function rE(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 sE(e,t,n){return n=n!=null?n.concat([e]):null,Lm(4,4,rE.bind(null,t,e),n)}function Ab(){}function iE(e,t){var n=ti();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Cb(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function oE(e,t){var n=ti();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Cb(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function aE(e,t,n){return El&21?(ji(n,t)||(n=fC(),zn.lanes|=n,_l|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,ls=!0),e.memoizedState=n)}function BL(e,t){var n=nn;nn=n!==0&&4>n?n:4,e(!0);var r=ty.transition;ty.transition={};try{e(!1),t()}finally{nn=n,ty.transition=r}}function lE(){return ti().memoizedState}function HL(e,t,n){var r=Na(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},cE(e))uE(t,n);else if(n=VC(e,t,n,r),n!==null){var s=Kr();Ni(n,e,r,s),dE(n,t,r)}}function WL(e,t,n){var r=Na(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(cE(e))uE(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,ji(l,a)){var u=t.interleaved;u===null?(s.next=s,vb(t)):(s.next=u.next,u.next=s),t.interleaved=s;return}}catch{}finally{}n=VC(e,t,s,r),n!==null&&(s=Kr(),Ni(n,e,r,s),dE(n,t,r))}}function cE(e){var t=e.alternate;return e===zn||t!==null&&t===zn}function uE(e,t){yd=Mh=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function dE(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ab(e,n)}}var $h={readContext:ei,useCallback:Lr,useContext:Lr,useEffect:Lr,useImperativeHandle:Lr,useInsertionEffect:Lr,useLayoutEffect:Lr,useMemo:Lr,useReducer:Lr,useRef:Lr,useState:Lr,useDebugValue:Lr,useDeferredValue:Lr,useTransition:Lr,useMutableSource:Lr,useSyncExternalStore:Lr,useId:Lr,unstable_isNewReconciler:!1},VL={readContext:ei,useCallback:function(e,t){return Xi().memoizedState=[e,t===void 0?null:t],e},useContext:ei,useEffect:ik,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,nh(4194308,4,rE.bind(null,t,e),n)},useLayoutEffect:function(e,t){return nh(4194308,4,e,t)},useInsertionEffect:function(e,t){return nh(4,2,e,t)},useMemo:function(e,t){var n=Xi();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Xi();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=HL.bind(null,zn,e),[r.memoizedState,e]},useRef:function(e){var t=Xi();return e={current:e},t.memoizedState=e},useState:sk,useDebugValue:Ab,useDeferredValue:function(e){return Xi().memoizedState=e},useTransition:function(){var e=sk(!1),t=e[0];return e=BL.bind(null,e[1]),Xi().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=zn,s=Xi();if(Ln){if(n===void 0)throw Error(je(407));n=n()}else{if(n=t(),wr===null)throw Error(je(349));El&30||GC(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,ik(JC.bind(null,r,i,e),[e]),r.flags|=2048,qd(9,XC.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Xi(),t=wr.identifierPrefix;if(Ln){var n=_o,r=Eo;n=(r&~(1<<32-Si(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Ud++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=zL++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},UL={readContext:ei,useCallback:iE,useContext:ei,useEffect:Pb,useImperativeHandle:sE,useInsertionEffect:tE,useLayoutEffect:nE,useMemo:oE,useReducer:ny,useRef:eE,useState:function(){return ny(Kd)},useDebugValue:Ab,useDeferredValue:function(e){var t=ti();return aE(t,fr.memoizedState,e)},useTransition:function(){var e=ny(Kd)[0],t=ti().memoizedState;return[e,t]},useMutableSource:qC,useSyncExternalStore:YC,useId:lE,unstable_isNewReconciler:!1},KL={readContext:ei,useCallback:iE,useContext:ei,useEffect:Pb,useImperativeHandle:sE,useInsertionEffect:tE,useLayoutEffect:nE,useMemo:oE,useReducer:ry,useRef:eE,useState:function(){return ry(Kd)},useDebugValue:Ab,useDeferredValue:function(e){var t=ti();return fr===null?t.memoizedState=e:aE(t,fr.memoizedState,e)},useTransition:function(){var e=ry(Kd)[0],t=ti().memoizedState;return[e,t]},useMutableSource:qC,useSyncExternalStore:YC,useId:lE,unstable_isNewReconciler:!1};function mi(e,t){if(e&&e.defaultProps){t=Bn({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Rx(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Bn({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Om={isMounted:function(e){return(e=e._reactInternals)?$l(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Kr(),s=Na(e),i=To(r,s);i.payload=t,n!=null&&(i.callback=n),t=ka(e,i,s),t!==null&&(Ni(t,e,s,r),eh(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Kr(),s=Na(e),i=To(r,s);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=ka(e,i,s),t!==null&&(Ni(t,e,s,r),eh(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Kr(),r=Na(e),s=To(n,r);s.tag=2,t!=null&&(s.callback=t),t=ka(e,s,r),t!==null&&(Ni(t,e,r,n),eh(t,e,r))}};function ok(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?!Fd(n,r)||!Fd(s,i):!0}function fE(e,t,n){var r=!1,s=Ia,i=t.contextType;return typeof i=="object"&&i!==null?i=ei(i):(s=hs(t)?jl:Dr.current,r=t.contextTypes,i=(r=r!=null)?Vc(e,s):Ia),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Om,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=i),t}function ak(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&&Om.enqueueReplaceState(t,t.state,null)}function Lx(e,t,n,r){var s=e.stateNode;s.props=n,s.state=e.memoizedState,s.refs={},kb(e);var i=t.contextType;typeof i=="object"&&i!==null?s.context=ei(i):(i=hs(t)?jl:Dr.current,s.context=Vc(e,i)),s.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Rx(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&&Om.enqueueReplaceState(s,s.state,null),Lh(e,n,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function Yc(e,t){try{var n="",r=t;do n+=bR(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 sy(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Ox(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var qL=typeof WeakMap=="function"?WeakMap:Map;function pE(e,t,n){n=To(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Fh||(Fh=!0,Ux=r),Ox(e,t)},n}function hE(e,t,n){n=To(-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(){Ox(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Ox(e,t),typeof r!="function"&&(Sa===null?Sa=new Set([this]):Sa.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function lk(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new qL;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=aO.bind(null,e,t,n),t.then(e,e))}function ck(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 uk(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=To(-1,1),t.tag=2,ka(n,t,1))),n.lanes|=1),e)}var YL=zo.ReactCurrentOwner,ls=!1;function Vr(e,t,n,r){t.child=e===null?WC(t,null,n,r):Kc(t,e.child,n,r)}function dk(e,t,n,r,s){n=n.render;var i=t.ref;return Mc(t,s),r=Eb(e,t,n,r,i,s),n=_b(),e!==null&&!ls?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Mo(e,t,s)):(Ln&&n&&mb(t),t.flags|=1,Vr(e,t,r,s),t.child)}function fk(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!Db(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,mE(e,t,i,r,s)):(e=oh(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:Fd,n(a,r)&&e.ref===t.ref)return Mo(e,t,s)}return t.flags|=1,e=ja(i,r),e.ref=t.ref,e.return=t,t.child=e}function mE(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(Fd(i,r)&&e.ref===t.ref)if(ls=!1,t.pendingProps=r=i,(e.lanes&s)!==0)e.flags&131072&&(ls=!0);else return t.lanes=e.lanes,Mo(e,t,s)}return Mx(e,t,n,r,s)}function gE(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},vn(jc,_s),_s|=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,vn(jc,_s),_s|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,vn(jc,_s),_s|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,vn(jc,_s),_s|=r;return Vr(e,t,s,n),t.child}function yE(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Mx(e,t,n,r,s){var i=hs(n)?jl:Dr.current;return i=Vc(t,i),Mc(t,s),n=Eb(e,t,n,r,i,s),r=_b(),e!==null&&!ls?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Mo(e,t,s)):(Ln&&r&&mb(t),t.flags|=1,Vr(e,t,n,s),t.child)}function pk(e,t,n,r,s){if(hs(n)){var i=!0;Ph(t)}else i=!1;if(Mc(t,s),t.stateNode===null)rh(e,t),fE(t,n,r),Lx(t,n,r,s),r=!0;else if(e===null){var a=t.stateNode,l=t.memoizedProps;a.props=l;var u=a.context,d=n.contextType;typeof d=="object"&&d!==null?d=ei(d):(d=hs(n)?jl:Dr.current,d=Vc(t,d));var f=n.getDerivedStateFromProps,c=typeof f=="function"||typeof a.getSnapshotBeforeUpdate=="function";c||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==r||u!==d)&&ak(t,a,r,d),ca=!1;var p=t.memoizedState;a.state=p,Lh(t,r,a,s),u=t.memoizedState,l!==r||p!==u||ps.current||ca?(typeof f=="function"&&(Rx(t,n,f,r),u=t.memoizedState),(l=ca||ok(t,n,l,r,p,u,d))?(c||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=u),a.props=r,a.state=u,a.context=d,r=l):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,UC(e,t),l=t.memoizedProps,d=t.type===t.elementType?l:mi(t.type,l),a.props=d,c=t.pendingProps,p=a.context,u=n.contextType,typeof u=="object"&&u!==null?u=ei(u):(u=hs(n)?jl:Dr.current,u=Vc(t,u));var h=n.getDerivedStateFromProps;(f=typeof h=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==c||p!==u)&&ak(t,a,r,u),ca=!1,p=t.memoizedState,a.state=p,Lh(t,r,a,s);var g=t.memoizedState;l!==c||p!==g||ps.current||ca?(typeof h=="function"&&(Rx(t,n,h,r),g=t.memoizedState),(d=ca||ok(t,n,d,r,p,g,u)||!1)?(f||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,g,u),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,g,u)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=g),a.props=r,a.state=g,a.context=u,r=d):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),r=!1)}return $x(e,t,n,r,i,s)}function $x(e,t,n,r,s,i){yE(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return s&&Q0(t,n,!1),Mo(e,t,i);r=t.stateNode,YL.current=t;var l=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=Kc(t,e.child,null,i),t.child=Kc(t,null,l,i)):Vr(e,t,l,i),t.memoizedState=r.state,s&&Q0(t,n,!0),t.child}function xE(e){var t=e.stateNode;t.pendingContext?J0(e,t.pendingContext,t.pendingContext!==t.context):t.context&&J0(e,t.context,!1),Sb(e,t.containerInfo)}function hk(e,t,n,r,s){return Uc(),yb(s),t.flags|=256,Vr(e,t,n,r),t.child}var Dx={dehydrated:null,treeContext:null,retryLane:0};function Fx(e){return{baseLanes:e,cachePool:null,transitions:null}}function wE(e,t,n){var r=t.pendingProps,s=Fn.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),vn(Fn,s&1),e===null)return Ix(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=Dm(a,r,0,null),e=bl(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Fx(n),t.memoizedState=Dx,e):Ib(t,a));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return GL(e,t,a,r,l,s,n);if(i){i=r.fallback,a=t.mode,s=e.child,l=s.sibling;var u={mode:"hidden",children:r.children};return!(a&1)&&t.child!==s?(r=t.child,r.childLanes=0,r.pendingProps=u,t.deletions=null):(r=ja(s,u),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?i=ja(l,i):(i=bl(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?Fx(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=e.childLanes&~n,t.memoizedState=Dx,r}return i=e.child,e=i.sibling,r=ja(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 Ib(e,t){return t=Dm({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function yp(e,t,n,r){return r!==null&&yb(r),Kc(t,e.child,null,n),e=Ib(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function GL(e,t,n,r,s,i,a){if(n)return t.flags&256?(t.flags&=-257,r=sy(Error(je(422))),yp(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,s=t.mode,r=Dm({mode:"visible",children:r.children},s,0,null),i=bl(i,s,a,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&Kc(t,e.child,null,a),t.child.memoizedState=Fx(a),t.memoizedState=Dx,i);if(!(t.mode&1))return yp(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=sy(i,r,void 0),yp(e,t,a,r)}if(l=(a&e.childLanes)!==0,ls||l){if(r=wr,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,Oo(e,s),Ni(r,e,s,-1))}return $b(),r=sy(Error(je(421))),yp(e,t,a,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=lO.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,Is=va(s.nextSibling),Rs=t,Ln=!0,xi=null,e!==null&&(Ys[Gs++]=Eo,Ys[Gs++]=_o,Ys[Gs++]=Cl,Eo=e.id,_o=e.overflow,Cl=t),t=Ib(t,r.children),t.flags|=4096,t)}function mk(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Tx(e.return,t,n)}function iy(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 bE(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;if(Vr(e,t,r.children,n),r=Fn.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&&mk(e,n,t);else if(e.tag===19)mk(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(vn(Fn,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&&Oh(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),iy(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&&Oh(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}iy(t,!0,n,null,i);break;case"together":iy(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function rh(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Mo(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),_l|=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=ja(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ja(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function XL(e,t,n){switch(t.tag){case 3:xE(t),Uc();break;case 5:KC(t);break;case 1:hs(t.type)&&Ph(t);break;case 4:Sb(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;vn(Th,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(vn(Fn,Fn.current&1),t.flags|=128,null):n&t.child.childLanes?wE(e,t,n):(vn(Fn,Fn.current&1),e=Mo(e,t,n),e!==null?e.sibling:null);vn(Fn,Fn.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return bE(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),vn(Fn,Fn.current),r)break;return null;case 22:case 23:return t.lanes=0,gE(e,t,n)}return Mo(e,t,n)}var vE,zx,kE,SE;vE=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}};zx=function(){};kE=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,yl(io.current);var i=null;switch(n){case"input":s=lx(e,s),r=lx(e,r),i=[];break;case"select":s=Bn({},s,{value:void 0}),r=Bn({},r,{value:void 0}),i=[];break;case"textarea":s=dx(e,s),r=dx(e,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Eh)}px(n,r);var a;n=null;for(d in s)if(!r.hasOwnProperty(d)&&s.hasOwnProperty(d)&&s[d]!=null)if(d==="style"){var l=s[d];for(a in l)l.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else d!=="dangerouslySetInnerHTML"&&d!=="children"&&d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&d!=="autoFocus"&&(Td.hasOwnProperty(d)?i||(i=[]):(i=i||[]).push(d,null));for(d in r){var u=r[d];if(l=s!=null?s[d]:void 0,r.hasOwnProperty(d)&&u!==l&&(u!=null||l!=null))if(d==="style")if(l){for(a in l)!l.hasOwnProperty(a)||u&&u.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in u)u.hasOwnProperty(a)&&l[a]!==u[a]&&(n||(n={}),n[a]=u[a])}else n||(i||(i=[]),i.push(d,n)),n=u;else d==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,l=l?l.__html:void 0,u!=null&&l!==u&&(i=i||[]).push(d,u)):d==="children"?typeof u!="string"&&typeof u!="number"||(i=i||[]).push(d,""+u):d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&(Td.hasOwnProperty(d)?(u!=null&&d==="onScroll"&&En("scroll",e),i||l===u||(i=[])):(i=i||[]).push(d,u))}n&&(i=i||[]).push("style",n);var d=i;(t.updateQueue=d)&&(t.flags|=4)}};SE=function(e,t,n,r){n!==r&&(t.flags|=4)};function Wu(e,t){if(!Ln)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 Or(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 JL(e,t,n){var r=t.pendingProps;switch(gb(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Or(t),null;case 1:return hs(t.type)&&_h(),Or(t),null;case 3:return r=t.stateNode,qc(),Pn(ps),Pn(Dr),jb(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(mp(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,xi!==null&&(Yx(xi),xi=null))),zx(e,t),Or(t),null;case 5:Nb(t);var s=yl(Vd.current);if(n=t.type,e!==null&&t.stateNode!=null)kE(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 Or(t),null}if(e=yl(io.current),mp(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[eo]=t,r[Hd]=i,e=(t.mode&1)!==0,n){case"dialog":En("cancel",r),En("close",r);break;case"iframe":case"object":case"embed":En("load",r);break;case"video":case"audio":for(s=0;s<sd.length;s++)En(sd[s],r);break;case"source":En("error",r);break;case"img":case"image":case"link":En("error",r),En("load",r);break;case"details":En("toggle",r);break;case"input":N0(r,i),En("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},En("invalid",r);break;case"textarea":C0(r,i),En("invalid",r)}px(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&&hp(r.textContent,l,e),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&hp(r.textContent,l,e),s=["children",""+l]):Td.hasOwnProperty(a)&&l!=null&&a==="onScroll"&&En("scroll",r)}switch(n){case"input":op(r),j0(r,i,!0);break;case"textarea":op(r),E0(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Eh)}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=J1(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[eo]=t,e[Hd]=r,vE(e,t,!1,!1),t.stateNode=e;e:{switch(a=hx(n,r),n){case"dialog":En("cancel",e),En("close",e),s=r;break;case"iframe":case"object":case"embed":En("load",e),s=r;break;case"video":case"audio":for(s=0;s<sd.length;s++)En(sd[s],e);s=r;break;case"source":En("error",e),s=r;break;case"img":case"image":case"link":En("error",e),En("load",e),s=r;break;case"details":En("toggle",e),s=r;break;case"input":N0(e,r),s=lx(e,r),En("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=Bn({},r,{value:void 0}),En("invalid",e);break;case"textarea":C0(e,r),s=dx(e,r),En("invalid",e);break;default:s=r}px(n,s),l=s;for(i in l)if(l.hasOwnProperty(i)){var u=l[i];i==="style"?eC(e,u):i==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&Q1(e,u)):i==="children"?typeof u=="string"?(n!=="textarea"||u!=="")&&Rd(e,u):typeof u=="number"&&Rd(e,""+u):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Td.hasOwnProperty(i)?u!=null&&i==="onScroll"&&En("scroll",e):u!=null&&tb(e,i,u,a))}switch(n){case"input":op(e),j0(e,r,!1);break;case"textarea":op(e),E0(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Aa(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?Tc(e,!!r.multiple,i,!1):r.defaultValue!=null&&Tc(e,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=Eh)}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 Or(t),null;case 6:if(e&&t.stateNode!=null)SE(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(je(166));if(n=yl(Vd.current),yl(io.current),mp(t)){if(r=t.stateNode,n=t.memoizedProps,r[eo]=t,(i=r.nodeValue!==n)&&(e=Rs,e!==null))switch(e.tag){case 3:hp(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&hp(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[eo]=t,t.stateNode=r}return Or(t),null;case 13:if(Pn(Fn),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Ln&&Is!==null&&t.mode&1&&!(t.flags&128))BC(),Uc(),t.flags|=98560,i=!1;else if(i=mp(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[eo]=t}else Uc(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Or(t),i=!1}else xi!==null&&(Yx(xi),xi=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||Fn.current&1?hr===0&&(hr=3):$b())),t.updateQueue!==null&&(t.flags|=4),Or(t),null);case 4:return qc(),zx(e,t),e===null&&zd(t.stateNode.containerInfo),Or(t),null;case 10:return bb(t.type._context),Or(t),null;case 17:return hs(t.type)&&_h(),Or(t),null;case 19:if(Pn(Fn),i=t.memoizedState,i===null)return Or(t),null;if(r=(t.flags&128)!==0,a=i.rendering,a===null)if(r)Wu(i,!1);else{if(hr!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=Oh(e),a!==null){for(t.flags|=128,Wu(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 vn(Fn,Fn.current&1|2),t.child}e=e.sibling}i.tail!==null&&Qn()>Gc&&(t.flags|=128,r=!0,Wu(i,!1),t.lanes=4194304)}else{if(!r)if(e=Oh(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Wu(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!Ln)return Or(t),null}else 2*Qn()-i.renderingStartTime>Gc&&n!==1073741824&&(t.flags|=128,r=!0,Wu(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=Qn(),t.sibling=null,n=Fn.current,vn(Fn,r?n&1|2:n&1),t):(Or(t),null);case 22:case 23:return Mb(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?_s&1073741824&&(Or(t),t.subtreeFlags&6&&(t.flags|=8192)):Or(t),null;case 24:return null;case 25:return null}throw Error(je(156,t.tag))}function QL(e,t){switch(gb(t),t.tag){case 1:return hs(t.type)&&_h(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return qc(),Pn(ps),Pn(Dr),jb(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Nb(t),null;case 13:if(Pn(Fn),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(je(340));Uc()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Pn(Fn),null;case 4:return qc(),null;case 10:return bb(t.type._context),null;case 22:case 23:return Mb(),null;case 24:return null;default:return null}}var xp=!1,Mr=!1,ZL=typeof WeakSet=="function"?WeakSet:Set,We=null;function Nc(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Gn(e,t,r)}else n.current=null}function Bx(e,t,n){try{n()}catch(r){Gn(e,t,r)}}var gk=!1;function eO(e,t){if(Nx=Nh,e=_C(),hb(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,u=-1,d=0,f=0,c=e,p=null;t:for(;;){for(var h;c!==n||s!==0&&c.nodeType!==3||(l=a+s),c!==i||r!==0&&c.nodeType!==3||(u=a+r),c.nodeType===3&&(a+=c.nodeValue.length),(h=c.firstChild)!==null;)p=c,c=h;for(;;){if(c===e)break t;if(p===n&&++d===s&&(l=a),p===i&&++f===r&&(u=a),(h=c.nextSibling)!==null)break;c=p,p=c.parentNode}c=h}n=l===-1||u===-1?null:{start:l,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(jx={focusedElem:e,selectionRange:n},Nh=!1,We=t;We!==null;)if(t=We,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,We=e;else for(;We!==null;){t=We;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var v=g.memoizedProps,k=g.memoizedState,y=t.stateNode,b=y.getSnapshotBeforeUpdate(t.elementType===t.type?v:mi(t.type,v),k);y.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(je(163))}}catch(N){Gn(t,t.return,N)}if(e=t.sibling,e!==null){e.return=t.return,We=e;break}We=t.return}return g=gk,gk=!1,g}function xd(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&&Bx(t,n,i)}s=s.next}while(s!==r)}}function Mm(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 Hx(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 NE(e){var t=e.alternate;t!==null&&(e.alternate=null,NE(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[eo],delete t[Hd],delete t[_x],delete t[ML],delete t[$L])),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 jE(e){return e.tag===5||e.tag===3||e.tag===4}function yk(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||jE(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 Wx(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=Eh));else if(r!==4&&(e=e.child,e!==null))for(Wx(e,t,n),e=e.sibling;e!==null;)Wx(e,t,n),e=e.sibling}function Vx(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(Vx(e,t,n),e=e.sibling;e!==null;)Vx(e,t,n),e=e.sibling}var Er=null,gi=!1;function ta(e,t,n){for(n=n.child;n!==null;)CE(e,t,n),n=n.sibling}function CE(e,t,n){if(so&&typeof so.onCommitFiberUnmount=="function")try{so.onCommitFiberUnmount(_m,n)}catch{}switch(n.tag){case 5:Mr||Nc(n,t);case 6:var r=Er,s=gi;Er=null,ta(e,t,n),Er=r,gi=s,Er!==null&&(gi?(e=Er,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Er.removeChild(n.stateNode));break;case 18:Er!==null&&(gi?(e=Er,n=n.stateNode,e.nodeType===8?Qg(e.parentNode,n):e.nodeType===1&&Qg(e,n),$d(e)):Qg(Er,n.stateNode));break;case 4:r=Er,s=gi,Er=n.stateNode.containerInfo,gi=!0,ta(e,t,n),Er=r,gi=s;break;case 0:case 11:case 14:case 15:if(!Mr&&(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)&&Bx(n,t,a),s=s.next}while(s!==r)}ta(e,t,n);break;case 1:if(!Mr&&(Nc(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){Gn(n,t,l)}ta(e,t,n);break;case 21:ta(e,t,n);break;case 22:n.mode&1?(Mr=(r=Mr)||n.memoizedState!==null,ta(e,t,n),Mr=r):ta(e,t,n);break;default:ta(e,t,n)}}function xk(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new ZL),t.forEach(function(r){var s=cO.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function pi(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:Er=l.stateNode,gi=!1;break e;case 3:Er=l.stateNode.containerInfo,gi=!0;break e;case 4:Er=l.stateNode.containerInfo,gi=!0;break e}l=l.return}if(Er===null)throw Error(je(160));CE(i,a,s),Er=null,gi=!1;var u=s.alternate;u!==null&&(u.return=null),s.return=null}catch(d){Gn(s,t,d)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)EE(t,e),t=t.sibling}function EE(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(pi(t,e),qi(e),r&4){try{xd(3,e,e.return),Mm(3,e)}catch(v){Gn(e,e.return,v)}try{xd(5,e,e.return)}catch(v){Gn(e,e.return,v)}}break;case 1:pi(t,e),qi(e),r&512&&n!==null&&Nc(n,n.return);break;case 5:if(pi(t,e),qi(e),r&512&&n!==null&&Nc(n,n.return),e.flags&32){var s=e.stateNode;try{Rd(s,"")}catch(v){Gn(e,e.return,v)}}if(r&4&&(s=e.stateNode,s!=null)){var i=e.memoizedProps,a=n!==null?n.memoizedProps:i,l=e.type,u=e.updateQueue;if(e.updateQueue=null,u!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&G1(s,i),hx(l,a);var d=hx(l,i);for(a=0;a<u.length;a+=2){var f=u[a],c=u[a+1];f==="style"?eC(s,c):f==="dangerouslySetInnerHTML"?Q1(s,c):f==="children"?Rd(s,c):tb(s,f,c,d)}switch(l){case"input":cx(s,i);break;case"textarea":X1(s,i);break;case"select":var p=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var h=i.value;h!=null?Tc(s,!!i.multiple,h,!1):p!==!!i.multiple&&(i.defaultValue!=null?Tc(s,!!i.multiple,i.defaultValue,!0):Tc(s,!!i.multiple,i.multiple?[]:"",!1))}s[Hd]=i}catch(v){Gn(e,e.return,v)}}break;case 6:if(pi(t,e),qi(e),r&4){if(e.stateNode===null)throw Error(je(162));s=e.stateNode,i=e.memoizedProps;try{s.nodeValue=i}catch(v){Gn(e,e.return,v)}}break;case 3:if(pi(t,e),qi(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{$d(t.containerInfo)}catch(v){Gn(e,e.return,v)}break;case 4:pi(t,e),qi(e);break;case 13:pi(t,e),qi(e),s=e.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(Lb=Qn())),r&4&&xk(e);break;case 22:if(f=n!==null&&n.memoizedState!==null,e.mode&1?(Mr=(d=Mr)||f,pi(t,e),Mr=d):pi(t,e),qi(e),r&8192){if(d=e.memoizedState!==null,(e.stateNode.isHidden=d)&&!f&&e.mode&1)for(We=e,f=e.child;f!==null;){for(c=We=f;We!==null;){switch(p=We,h=p.child,p.tag){case 0:case 11:case 14:case 15:xd(4,p,p.return);break;case 1:Nc(p,p.return);var g=p.stateNode;if(typeof g.componentWillUnmount=="function"){r=p,n=p.return;try{t=r,g.props=t.memoizedProps,g.state=t.memoizedState,g.componentWillUnmount()}catch(v){Gn(r,n,v)}}break;case 5:Nc(p,p.return);break;case 22:if(p.memoizedState!==null){bk(c);continue}}h!==null?(h.return=p,We=h):bk(c)}f=f.sibling}e:for(f=null,c=e;;){if(c.tag===5){if(f===null){f=c;try{s=c.stateNode,d?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=c.stateNode,u=c.memoizedProps.style,a=u!=null&&u.hasOwnProperty("display")?u.display:null,l.style.display=Z1("display",a))}catch(v){Gn(e,e.return,v)}}}else if(c.tag===6){if(f===null)try{c.stateNode.nodeValue=d?"":c.memoizedProps}catch(v){Gn(e,e.return,v)}}else if((c.tag!==22&&c.tag!==23||c.memoizedState===null||c===e)&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===e)break e;for(;c.sibling===null;){if(c.return===null||c.return===e)break e;f===c&&(f=null),c=c.return}f===c&&(f=null),c.sibling.return=c.return,c=c.sibling}}break;case 19:pi(t,e),qi(e),r&4&&xk(e);break;case 21:break;default:pi(t,e),qi(e)}}function qi(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(jE(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&&(Rd(s,""),r.flags&=-33);var i=yk(e);Vx(e,i,s);break;case 3:case 4:var a=r.stateNode.containerInfo,l=yk(e);Wx(e,l,a);break;default:throw Error(je(161))}}catch(u){Gn(e,e.return,u)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function tO(e,t,n){We=e,_E(e)}function _E(e,t,n){for(var r=(e.mode&1)!==0;We!==null;){var s=We,i=s.child;if(s.tag===22&&r){var a=s.memoizedState!==null||xp;if(!a){var l=s.alternate,u=l!==null&&l.memoizedState!==null||Mr;l=xp;var d=Mr;if(xp=a,(Mr=u)&&!d)for(We=s;We!==null;)a=We,u=a.child,a.tag===22&&a.memoizedState!==null?vk(s):u!==null?(u.return=a,We=u):vk(s);for(;i!==null;)We=i,_E(i),i=i.sibling;We=s,xp=l,Mr=d}wk(e)}else s.subtreeFlags&8772&&i!==null?(i.return=s,We=i):wk(e)}}function wk(e){for(;We!==null;){var t=We;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Mr||Mm(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Mr)if(n===null)r.componentDidMount();else{var s=t.elementType===t.type?n.memoizedProps:mi(t.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&rk(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}rk(t,a,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var u=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":u.autoFocus&&n.focus();break;case"img":u.src&&(n.src=u.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var d=t.alternate;if(d!==null){var f=d.memoizedState;if(f!==null){var c=f.dehydrated;c!==null&&$d(c)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(je(163))}Mr||t.flags&512&&Hx(t)}catch(p){Gn(t,t.return,p)}}if(t===e){We=null;break}if(n=t.sibling,n!==null){n.return=t.return,We=n;break}We=t.return}}function bk(e){for(;We!==null;){var t=We;if(t===e){We=null;break}var n=t.sibling;if(n!==null){n.return=t.return,We=n;break}We=t.return}}function vk(e){for(;We!==null;){var t=We;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Mm(4,t)}catch(u){Gn(t,n,u)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(u){Gn(t,s,u)}}var i=t.return;try{Hx(t)}catch(u){Gn(t,i,u)}break;case 5:var a=t.return;try{Hx(t)}catch(u){Gn(t,a,u)}}}catch(u){Gn(t,t.return,u)}if(t===e){We=null;break}var l=t.sibling;if(l!==null){l.return=t.return,We=l;break}We=t.return}}var nO=Math.ceil,Dh=zo.ReactCurrentDispatcher,Tb=zo.ReactCurrentOwner,Zs=zo.ReactCurrentBatchConfig,Ut=0,wr=null,or=null,_r=0,_s=0,jc=Fa(0),hr=0,Yd=null,_l=0,$m=0,Rb=0,wd=null,is=null,Lb=0,Gc=1/0,So=null,Fh=!1,Ux=null,Sa=null,wp=!1,ma=null,zh=0,bd=0,Kx=null,sh=-1,ih=0;function Kr(){return Ut&6?Qn():sh!==-1?sh:sh=Qn()}function Na(e){return e.mode&1?Ut&2&&_r!==0?_r&-_r:FL.transition!==null?(ih===0&&(ih=fC()),ih):(e=nn,e!==0||(e=window.event,e=e===void 0?16:wC(e.type)),e):1}function Ni(e,t,n,r){if(50<bd)throw bd=0,Kx=null,Error(je(185));wf(e,n,r),(!(Ut&2)||e!==wr)&&(e===wr&&(!(Ut&2)&&($m|=n),hr===4&&fa(e,_r)),ms(e,r),n===1&&Ut===0&&!(t.mode&1)&&(Gc=Qn()+500,Rm&&za()))}function ms(e,t){var n=e.callbackNode;FR(e,t);var r=Sh(e,e===wr?_r:0);if(r===0)n!==null&&A0(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&A0(n),t===1)e.tag===0?DL(kk.bind(null,e)):DC(kk.bind(null,e)),LL(function(){!(Ut&6)&&za()}),n=null;else{switch(pC(r)){case 1:n=ob;break;case 4:n=uC;break;case 16:n=kh;break;case 536870912:n=dC;break;default:n=kh}n=ME(n,PE.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function PE(e,t){if(sh=-1,ih=0,Ut&6)throw Error(je(327));var n=e.callbackNode;if($c()&&e.callbackNode!==n)return null;var r=Sh(e,e===wr?_r:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Bh(e,r);else{t=r;var s=Ut;Ut|=2;var i=IE();(wr!==e||_r!==t)&&(So=null,Gc=Qn()+500,wl(e,t));do try{iO();break}catch(l){AE(e,l)}while(!0);wb(),Dh.current=i,Ut=s,or!==null?t=0:(wr=null,_r=0,t=hr)}if(t!==0){if(t===2&&(s=wx(e),s!==0&&(r=s,t=qx(e,s))),t===1)throw n=Yd,wl(e,0),fa(e,r),ms(e,Qn()),n;if(t===6)fa(e,r);else{if(s=e.current.alternate,!(r&30)&&!rO(s)&&(t=Bh(e,r),t===2&&(i=wx(e),i!==0&&(r=i,t=qx(e,i))),t===1))throw n=Yd,wl(e,0),fa(e,r),ms(e,Qn()),n;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(je(345));case 2:ul(e,is,So);break;case 3:if(fa(e,r),(r&130023424)===r&&(t=Lb+500-Qn(),10<t)){if(Sh(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){Kr(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=Ex(ul.bind(null,e,is,So),t);break}ul(e,is,So);break;case 4:if(fa(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var a=31-Si(r);i=1<<a,a=t[a],a>s&&(s=a),r&=~i}if(r=s,r=Qn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*nO(r/1960))-r,10<r){e.timeoutHandle=Ex(ul.bind(null,e,is,So),r);break}ul(e,is,So);break;case 5:ul(e,is,So);break;default:throw Error(je(329))}}}return ms(e,Qn()),e.callbackNode===n?PE.bind(null,e):null}function qx(e,t){var n=wd;return e.current.memoizedState.isDehydrated&&(wl(e,t).flags|=256),e=Bh(e,t),e!==2&&(t=is,is=n,t!==null&&Yx(t)),e}function Yx(e){is===null?is=e:is.push.apply(is,e)}function rO(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(!ji(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 fa(e,t){for(t&=~Rb,t&=~$m,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Si(t),r=1<<n;e[n]=-1,t&=~r}}function kk(e){if(Ut&6)throw Error(je(327));$c();var t=Sh(e,0);if(!(t&1))return ms(e,Qn()),null;var n=Bh(e,t);if(e.tag!==0&&n===2){var r=wx(e);r!==0&&(t=r,n=qx(e,r))}if(n===1)throw n=Yd,wl(e,0),fa(e,t),ms(e,Qn()),n;if(n===6)throw Error(je(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,ul(e,is,So),ms(e,Qn()),null}function Ob(e,t){var n=Ut;Ut|=1;try{return e(t)}finally{Ut=n,Ut===0&&(Gc=Qn()+500,Rm&&za())}}function Pl(e){ma!==null&&ma.tag===0&&!(Ut&6)&&$c();var t=Ut;Ut|=1;var n=Zs.transition,r=nn;try{if(Zs.transition=null,nn=1,e)return e()}finally{nn=r,Zs.transition=n,Ut=t,!(Ut&6)&&za()}}function Mb(){_s=jc.current,Pn(jc)}function wl(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,RL(n)),or!==null)for(n=or.return;n!==null;){var r=n;switch(gb(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&_h();break;case 3:qc(),Pn(ps),Pn(Dr),jb();break;case 5:Nb(r);break;case 4:qc();break;case 13:Pn(Fn);break;case 19:Pn(Fn);break;case 10:bb(r.type._context);break;case 22:case 23:Mb()}n=n.return}if(wr=e,or=e=ja(e.current,null),_r=_s=t,hr=0,Yd=null,Rb=$m=_l=0,is=wd=null,gl!==null){for(t=0;t<gl.length;t++)if(n=gl[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}gl=null}return e}function AE(e,t){do{var n=or;try{if(wb(),th.current=$h,Mh){for(var r=zn.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}Mh=!1}if(El=0,yr=fr=zn=null,yd=!1,Ud=0,Tb.current=null,n===null||n.return===null){hr=1,Yd=t,or=null;break}e:{var i=e,a=n.return,l=n,u=t;if(t=_r,l.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){var d=u,f=l,c=f.tag;if(!(f.mode&1)&&(c===0||c===11||c===15)){var p=f.alternate;p?(f.updateQueue=p.updateQueue,f.memoizedState=p.memoizedState,f.lanes=p.lanes):(f.updateQueue=null,f.memoizedState=null)}var h=ck(a);if(h!==null){h.flags&=-257,uk(h,a,l,i,t),h.mode&1&&lk(i,d,t),t=h,u=d;var g=t.updateQueue;if(g===null){var v=new Set;v.add(u),t.updateQueue=v}else g.add(u);break e}else{if(!(t&1)){lk(i,d,t),$b();break e}u=Error(je(426))}}else if(Ln&&l.mode&1){var k=ck(a);if(k!==null){!(k.flags&65536)&&(k.flags|=256),uk(k,a,l,i,t),yb(Yc(u,l));break e}}i=u=Yc(u,l),hr!==4&&(hr=2),wd===null?wd=[i]:wd.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var y=pE(i,u,t);nk(i,y);break e;case 1:l=u;var b=i.type,w=i.stateNode;if(!(i.flags&128)&&(typeof b.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(Sa===null||!Sa.has(w)))){i.flags|=65536,t&=-t,i.lanes|=t;var N=hE(i,l,t);nk(i,N);break e}}i=i.return}while(i!==null)}RE(n)}catch(C){t=C,or===n&&n!==null&&(or=n=n.return);continue}break}while(!0)}function IE(){var e=Dh.current;return Dh.current=$h,e===null?$h:e}function $b(){(hr===0||hr===3||hr===2)&&(hr=4),wr===null||!(_l&268435455)&&!($m&268435455)||fa(wr,_r)}function Bh(e,t){var n=Ut;Ut|=2;var r=IE();(wr!==e||_r!==t)&&(So=null,wl(e,t));do try{sO();break}catch(s){AE(e,s)}while(!0);if(wb(),Ut=n,Dh.current=r,or!==null)throw Error(je(261));return wr=null,_r=0,hr}function sO(){for(;or!==null;)TE(or)}function iO(){for(;or!==null&&!AR();)TE(or)}function TE(e){var t=OE(e.alternate,e,_s);e.memoizedProps=e.pendingProps,t===null?RE(e):or=t,Tb.current=null}function RE(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=QL(n,t),n!==null){n.flags&=32767,or=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{hr=6,or=null;return}}else if(n=JL(n,t,_s),n!==null){or=n;return}if(t=t.sibling,t!==null){or=t;return}or=t=e}while(t!==null);hr===0&&(hr=5)}function ul(e,t,n){var r=nn,s=Zs.transition;try{Zs.transition=null,nn=1,oO(e,t,n,r)}finally{Zs.transition=s,nn=r}return null}function oO(e,t,n,r){do $c();while(ma!==null);if(Ut&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(zR(e,i),e===wr&&(or=wr=null,_r=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||wp||(wp=!0,ME(kh,function(){return $c(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Zs.transition,Zs.transition=null;var a=nn;nn=1;var l=Ut;Ut|=4,Tb.current=null,eO(e,n),EE(n,e),CL(jx),Nh=!!Nx,jx=Nx=null,e.current=n,tO(n),IR(),Ut=l,nn=a,Zs.transition=i}else e.current=n;if(wp&&(wp=!1,ma=e,zh=s),i=e.pendingLanes,i===0&&(Sa=null),LR(n.stateNode),ms(e,Qn()),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(Fh)throw Fh=!1,e=Ux,Ux=null,e;return zh&1&&e.tag!==0&&$c(),i=e.pendingLanes,i&1?e===Kx?bd++:(bd=0,Kx=e):bd=0,za(),null}function $c(){if(ma!==null){var e=pC(zh),t=Zs.transition,n=nn;try{if(Zs.transition=null,nn=16>e?16:e,ma===null)var r=!1;else{if(e=ma,ma=null,zh=0,Ut&6)throw Error(je(331));var s=Ut;for(Ut|=4,We=e.current;We!==null;){var i=We,a=i.child;if(We.flags&16){var l=i.deletions;if(l!==null){for(var u=0;u<l.length;u++){var d=l[u];for(We=d;We!==null;){var f=We;switch(f.tag){case 0:case 11:case 15:xd(8,f,i)}var c=f.child;if(c!==null)c.return=f,We=c;else for(;We!==null;){f=We;var p=f.sibling,h=f.return;if(NE(f),f===d){We=null;break}if(p!==null){p.return=h,We=p;break}We=h}}}var g=i.alternate;if(g!==null){var v=g.child;if(v!==null){g.child=null;do{var k=v.sibling;v.sibling=null,v=k}while(v!==null)}}We=i}}if(i.subtreeFlags&2064&&a!==null)a.return=i,We=a;else e:for(;We!==null;){if(i=We,i.flags&2048)switch(i.tag){case 0:case 11:case 15:xd(9,i,i.return)}var y=i.sibling;if(y!==null){y.return=i.return,We=y;break e}We=i.return}}var b=e.current;for(We=b;We!==null;){a=We;var w=a.child;if(a.subtreeFlags&2064&&w!==null)w.return=a,We=w;else e:for(a=b;We!==null;){if(l=We,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Mm(9,l)}}catch(C){Gn(l,l.return,C)}if(l===a){We=null;break e}var N=l.sibling;if(N!==null){N.return=l.return,We=N;break e}We=l.return}}if(Ut=s,za(),so&&typeof so.onPostCommitFiberRoot=="function")try{so.onPostCommitFiberRoot(_m,e)}catch{}r=!0}return r}finally{nn=n,Zs.transition=t}}return!1}function Sk(e,t,n){t=Yc(n,t),t=pE(e,t,1),e=ka(e,t,1),t=Kr(),e!==null&&(wf(e,1,t),ms(e,t))}function Gn(e,t,n){if(e.tag===3)Sk(e,e,n);else for(;t!==null;){if(t.tag===3){Sk(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Sa===null||!Sa.has(r))){e=Yc(n,e),e=hE(t,e,1),t=ka(t,e,1),e=Kr(),t!==null&&(wf(t,1,e),ms(t,e));break}}t=t.return}}function aO(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Kr(),e.pingedLanes|=e.suspendedLanes&n,wr===e&&(_r&n)===n&&(hr===4||hr===3&&(_r&130023424)===_r&&500>Qn()-Lb?wl(e,0):Rb|=n),ms(e,t)}function LE(e,t){t===0&&(e.mode&1?(t=cp,cp<<=1,!(cp&130023424)&&(cp=4194304)):t=1);var n=Kr();e=Oo(e,t),e!==null&&(wf(e,t,n),ms(e,n))}function lO(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),LE(e,n)}function cO(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),LE(e,n)}var OE;OE=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ps.current)ls=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return ls=!1,XL(e,t,n);ls=!!(e.flags&131072)}else ls=!1,Ln&&t.flags&1048576&&FC(t,Ih,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;rh(e,t),e=t.pendingProps;var s=Vc(t,Dr.current);Mc(t,n),s=Eb(null,t,r,e,s,n);var i=_b();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,hs(r)?(i=!0,Ph(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,kb(t),s.updater=Om,t.stateNode=s,s._reactInternals=t,Lx(t,r,e,n),t=$x(null,t,r,!0,i,n)):(t.tag=0,Ln&&i&&mb(t),Vr(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(rh(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=dO(r),e=mi(r,e),s){case 0:t=Mx(null,t,r,e,n);break e;case 1:t=pk(null,t,r,e,n);break e;case 11:t=dk(null,t,r,e,n);break e;case 14:t=fk(null,t,r,mi(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:mi(r,s),Mx(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:mi(r,s),pk(e,t,r,s,n);case 3:e:{if(xE(t),e===null)throw Error(je(387));r=t.pendingProps,i=t.memoizedState,s=i.element,UC(e,t),Lh(t,r,null,n);var a=t.memoizedState;if(r=a.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=Yc(Error(je(423)),t),t=hk(e,t,r,n,s);break e}else if(r!==s){s=Yc(Error(je(424)),t),t=hk(e,t,r,n,s);break e}else for(Is=va(t.stateNode.containerInfo.firstChild),Rs=t,Ln=!0,xi=null,n=WC(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Uc(),r===s){t=Mo(e,t,n);break e}Vr(e,t,r,n)}t=t.child}return t;case 5:return KC(t),e===null&&Ix(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,a=s.children,Cx(r,s)?a=null:i!==null&&Cx(r,i)&&(t.flags|=32),yE(e,t),Vr(e,t,a,n),t.child;case 6:return e===null&&Ix(t),null;case 13:return wE(e,t,n);case 4:return Sb(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Kc(t,null,r,n):Vr(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:mi(r,s),dk(e,t,r,s,n);case 7:return Vr(e,t,t.pendingProps,n),t.child;case 8:return Vr(e,t,t.pendingProps.children,n),t.child;case 12:return Vr(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,vn(Th,r._currentValue),r._currentValue=a,i!==null)if(ji(i.value,a)){if(i.children===s.children&&!ps.current){t=Mo(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 u=l.firstContext;u!==null;){if(u.context===r){if(i.tag===1){u=To(-1,n&-n),u.tag=2;var d=i.updateQueue;if(d!==null){d=d.shared;var f=d.pending;f===null?u.next=u:(u.next=f.next,f.next=u),d.pending=u}}i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),Tx(i.return,n,t),l.lanes|=n;break}u=u.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),Tx(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}Vr(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,Mc(t,n),s=ei(s),r=r(s),t.flags|=1,Vr(e,t,r,n),t.child;case 14:return r=t.type,s=mi(r,t.pendingProps),s=mi(r.type,s),fk(e,t,r,s,n);case 15:return mE(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:mi(r,s),rh(e,t),t.tag=1,hs(r)?(e=!0,Ph(t)):e=!1,Mc(t,n),fE(t,r,s),Lx(t,r,s,n),$x(null,t,r,!0,e,n);case 19:return bE(e,t,n);case 22:return gE(e,t,n)}throw Error(je(156,t.tag))};function ME(e,t){return cC(e,t)}function uO(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 Qs(e,t,n,r){return new uO(e,t,n,r)}function Db(e){return e=e.prototype,!(!e||!e.isReactComponent)}function dO(e){if(typeof e=="function")return Db(e)?1:0;if(e!=null){if(e=e.$$typeof,e===rb)return 11;if(e===sb)return 14}return 2}function ja(e,t){var n=e.alternate;return n===null?(n=Qs(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 oh(e,t,n,r,s,i){var a=2;if(r=e,typeof e=="function")Db(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case mc:return bl(n.children,s,i,t);case nb:a=8,s|=8;break;case sx:return e=Qs(12,n,t,s|2),e.elementType=sx,e.lanes=i,e;case ix:return e=Qs(13,n,t,s),e.elementType=ix,e.lanes=i,e;case ox:return e=Qs(19,n,t,s),e.elementType=ox,e.lanes=i,e;case K1:return Dm(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case V1:a=10;break e;case U1:a=9;break e;case rb:a=11;break e;case sb:a=14;break e;case la:a=16,r=null;break e}throw Error(je(130,e==null?e:typeof e,""))}return t=Qs(a,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function bl(e,t,n,r){return e=Qs(7,e,r,t),e.lanes=n,e}function Dm(e,t,n,r){return e=Qs(22,e,r,t),e.elementType=K1,e.lanes=n,e.stateNode={isHidden:!1},e}function oy(e,t,n){return e=Qs(6,e,null,t),e.lanes=n,e}function ay(e,t,n){return t=Qs(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function fO(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=Bg(0),this.expirationTimes=Bg(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Bg(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Fb(e,t,n,r,s,i,a,l,u){return e=new fO(e,t,n,l,u),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Qs(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},kb(i),e}function pO(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:hc,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function $E(e){if(!e)return Ia;e=e._reactInternals;e:{if($l(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(hs(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(hs(n))return $C(e,n,t)}return t}function DE(e,t,n,r,s,i,a,l,u){return e=Fb(n,r,!0,e,s,i,a,l,u),e.context=$E(null),n=e.current,r=Kr(),s=Na(n),i=To(r,s),i.callback=t??null,ka(n,i,s),e.current.lanes=s,wf(e,s,r),ms(e,r),e}function Fm(e,t,n,r){var s=t.current,i=Kr(),a=Na(s);return n=$E(n),t.context===null?t.context=n:t.pendingContext=n,t=To(i,a),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=ka(s,t,a),e!==null&&(Ni(e,s,a,i),eh(e,s,a)),a}function Hh(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 Nk(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function zb(e,t){Nk(e,t),(e=e.alternate)&&Nk(e,t)}function hO(){return null}var FE=typeof reportError=="function"?reportError:function(e){console.error(e)};function Bb(e){this._internalRoot=e}zm.prototype.render=Bb.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(je(409));Fm(e,t,null,null)};zm.prototype.unmount=Bb.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Pl(function(){Fm(null,e,null,null)}),t[Lo]=null}};function zm(e){this._internalRoot=e}zm.prototype.unstable_scheduleHydration=function(e){if(e){var t=gC();e={blockedOn:null,target:e,priority:t};for(var n=0;n<da.length&&t!==0&&t<da[n].priority;n++);da.splice(n,0,e),n===0&&xC(e)}};function Hb(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Bm(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function jk(){}function mO(e,t,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var d=Hh(a);i.call(d)}}var a=DE(t,r,e,0,null,!1,!1,"",jk);return e._reactRootContainer=a,e[Lo]=a.current,zd(e.nodeType===8?e.parentNode:e),Pl(),a}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var d=Hh(u);l.call(d)}}var u=Fb(e,0,!1,null,null,!1,!1,"",jk);return e._reactRootContainer=u,e[Lo]=u.current,zd(e.nodeType===8?e.parentNode:e),Pl(function(){Fm(t,u,n,r)}),u}function Hm(e,t,n,r,s){var i=n._reactRootContainer;if(i){var a=i;if(typeof s=="function"){var l=s;s=function(){var u=Hh(a);l.call(u)}}Fm(t,a,e,s)}else a=mO(n,t,e,s,r);return Hh(a)}hC=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=rd(t.pendingLanes);n!==0&&(ab(t,n|1),ms(t,Qn()),!(Ut&6)&&(Gc=Qn()+500,za()))}break;case 13:Pl(function(){var r=Oo(e,1);if(r!==null){var s=Kr();Ni(r,e,1,s)}}),zb(e,1)}};lb=function(e){if(e.tag===13){var t=Oo(e,134217728);if(t!==null){var n=Kr();Ni(t,e,134217728,n)}zb(e,134217728)}};mC=function(e){if(e.tag===13){var t=Na(e),n=Oo(e,t);if(n!==null){var r=Kr();Ni(n,e,t,r)}zb(e,t)}};gC=function(){return nn};yC=function(e,t){var n=nn;try{return nn=e,t()}finally{nn=n}};gx=function(e,t,n){switch(t){case"input":if(cx(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=Tm(r);if(!s)throw Error(je(90));Y1(r),cx(r,s)}}}break;case"textarea":X1(e,n);break;case"select":t=n.value,t!=null&&Tc(e,!!n.multiple,t,!1)}};rC=Ob;sC=Pl;var gO={usingClientEntryPoint:!1,Events:[vf,wc,Tm,tC,nC,Ob]},Vu={findFiberByHostInstance:ml,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},yO={bundleType:Vu.bundleType,version:Vu.version,rendererPackageName:Vu.rendererPackageName,rendererConfig:Vu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:zo.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=aC(e),e===null?null:e.stateNode},findFiberByHostInstance:Vu.findFiberByHostInstance||hO,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 bp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!bp.isDisabled&&bp.supportsFiber)try{_m=bp.inject(yO),so=bp}catch{}}$s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=gO;$s.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Hb(t))throw Error(je(200));return pO(e,t,null,n)};$s.createRoot=function(e,t){if(!Hb(e))throw Error(je(299));var n=!1,r="",s=FE;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=Fb(e,1,!1,null,null,n,!1,r,s),e[Lo]=t.current,zd(e.nodeType===8?e.parentNode:e),new Bb(t)};$s.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=aC(t),e=e===null?null:e.stateNode,e};$s.flushSync=function(e){return Pl(e)};$s.hydrate=function(e,t,n){if(!Bm(t))throw Error(je(200));return Hm(null,e,t,!0,n)};$s.hydrateRoot=function(e,t,n){if(!Hb(e))throw Error(je(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",a=FE;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=DE(t,null,e,1,n??null,s,!1,i,a),e[Lo]=t.current,zd(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 zm(t)};$s.render=function(e,t,n){if(!Bm(t))throw Error(je(200));return Hm(null,e,t,!1,n)};$s.unmountComponentAtNode=function(e){if(!Bm(e))throw Error(je(40));return e._reactRootContainer?(Pl(function(){Hm(null,null,e,!1,function(){e._reactRootContainer=null,e[Lo]=null})}),!0):!1};$s.unstable_batchedUpdates=Ob;$s.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Bm(n))throw Error(je(200));if(e==null||e._reactInternals===void 0)throw Error(je(38));return Hm(e,t,n,!1,r)};$s.version="18.3.1-next-f1338f8080-20240426";function zE(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(zE)}catch(e){console.error(e)}}zE(),z1.exports=$s;var os=z1.exports,Ck=os;nx.createRoot=Ck.createRoot,nx.hydrateRoot=Ck.hydrateRoot;const BE=m.createContext(null);function Gx(e){let t=e||"/";return t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t||"/"}function xO(){const e=Gx(window.location.pathname);return e==="/"?(window.history.replaceState({},"","/projects"),"/projects"):e}function wO({children:e}){const[t,n]=m.useState(xO);m.useEffect(()=>{const i=()=>n(Gx(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 u=Gx(l.pathname),d=l.search||"";window.history.pushState({},"",u+d),n(u)},[]),s=m.useMemo(()=>({path:t,navigate:r}),[t,r]);return o.jsx(BE.Provider,{value:s,children:e})}function Ba(){const e=m.useContext(BE);if(!e)throw new Error("useRoute must be used within RouteProvider");return e}function bO(){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 Ek={};function Xx(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];typeof t[0]=="string"&&Ek[t[0]]||(typeof t[0]=="string"&&(Ek[t[0]]=new Date),bO(...t))}const HE=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}};function _k(e,t,n){e.loadNamespaces(t,HE(e,n))}function Pk(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,HE(e,r))}function vO(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,u)=>{const d=t.services.backendConnector.state[`${l}|${u}`];return d===-1||d===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 kO(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(Xx("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}}):vO(e,t,n)}const SO=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,NO={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},jO=e=>NO[e],CO=e=>e.replace(SO,jO);let Jx={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:CO};function EO(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Jx={...Jx,...e}}function _O(){return Jx}let WE;function PO(e){WE=e}function AO(){return WE}const IO={type:"3rdParty",init(e){EO(e.options.react),PO(e)}},TO=m.createContext();class RO{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const LO=(e,t)=>{const n=m.useRef();return m.useEffect(()=>{n.current=e},[e,t]),n.current};function Sn(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=t,{i18n:r,defaultNS:s}=m.useContext(TO)||{},i=n||r||AO();if(i&&!i.reportNamespaces&&(i.reportNamespaces=new RO),!i){Xx("You will need to pass in an i18next instance by using initReactI18next");const w=(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=[w,{},!1];return N.t=w,N.i18n={},N.ready=!1,N}i.options.react&&i.options.react.wait!==void 0&&Xx("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const a={..._O(),...i.options.react,...t},{useSuspense:l,keyPrefix:u}=a;let d=e||s||i.options&&i.options.defaultNS;d=typeof d=="string"?[d]:d||["translation"],i.reportNamespaces.addUsedNamespaces&&i.reportNamespaces.addUsedNamespaces(d);const f=(i.isInitialized||i.initializedStoreOnce)&&d.every(w=>kO(w,i,a));function c(){return i.getFixedT(t.lng||null,a.nsMode==="fallback"?d:d[0],u)}const[p,h]=m.useState(c);let g=d.join();t.lng&&(g=`${t.lng}${g}`);const v=LO(g),k=m.useRef(!0);m.useEffect(()=>{const{bindI18n:w,bindI18nStore:N}=a;k.current=!0,!f&&!l&&(t.lng?Pk(i,t.lng,d,()=>{k.current&&h(c)}):_k(i,d,()=>{k.current&&h(c)})),f&&v&&v!==g&&k.current&&h(c);function C(){k.current&&h(c)}return w&&i&&i.on(w,C),N&&i&&i.store.on(N,C),()=>{k.current=!1,w&&i&&w.split(" ").forEach(j=>i.off(j,C)),N&&i&&N.split(" ").forEach(j=>i.store.off(j,C))}},[i,g]);const y=m.useRef(!0);m.useEffect(()=>{k.current&&!y.current&&h(c),y.current=!1},[i,u]);const b=[p,i,f];if(b.t=p,b.i18n=i,b.ready=f,f||!f&&!l)return b;throw new Promise(w=>{t.lng?Pk(i,t.lng,d,()=>w()):_k(i,d,()=>w())})}const VE="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",OO=[{to:"/projects",labelKey:"common:nav.projects",icon:"folder_open"},{to:"/nodes",labelKey:"common:nav.nodes",icon:"account_tree"},{to:"/my-nodes",labelKey:"common:nav.myNodes",icon:"deployed_code"},{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:"/feedback",labelKey:"common:nav.feedback",icon:"rate_review"},{to:"/settings",labelKey:"common:nav.settings",icon:"settings"}],MO=[{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 $O(e,t){return t==="/projects"?e==="/projects"||e==="/":e===t||e.startsWith(t+"/")}function DO({authUser:e,onLogout:t}){const{path:n,navigate:r}=Ba(),{t:s}=Sn(),[i,a]=m.useState(!1);return m.useEffect(()=>{let l=!1;return fetch("/api/ui-context").then(u=>u.json()).then(u=>{l||a(!!u.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:VE,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:OO.map(l=>o.jsxs("button",{type:"button",className:"af-nav-link"+($O(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: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&&MO.map(l=>{const u=s(l.labelKey);return o.jsx("a",{className:"af-sidebar-ext",href:l.href,target:"_blank",rel:"noopener noreferrer","aria-label":u,title:u,children:o.jsx("span",{className:"material-symbols-outlined",children:l.icon})},l.href)})]})]})}const UE="agentflow.pipelineRecent",FO=50,zO=15;function BO(e){try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function KE(){if(typeof localStorage>"u")return[];const e=localStorage.getItem(UE);return e?BO(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 vp(e,t){if(typeof localStorage>"u")return;const n=Date.now(),r=KE(),i=[{flowId:e,flowSource:t,kind:"opened",at:n},...r.filter(a=>!(a.flowId===e&&a.flowSource===t))].slice(0,FO);try{localStorage.setItem(UE,JSON.stringify(i))}catch{}}function HO(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 Qx(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),u=new Date,d=new Date(u);if(d.setDate(d.getDate()-1),l.toDateString()===d.toDateString())return t("flow:time.yesterday");const f=Math.floor(a/24);return f<7?t("flow:time.daysAgo",{n:f}):`${l.getMonth()+1}/${l.getDate()}`}function WO(e,t){if(e==null||!Number.isFinite(e)||e<=0)return"--";if(e<1e3)return t("flow:time.milliseconds",{n:Math.max(1,Math.round(e))});const n=e/1e3;return t("flow:time.seconds",{n:n>=10?Math.round(n):n.toFixed(1)})}function VO(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:HO(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,zO)}var Ps=Uint8Array,Cc=Uint16Array,UO=Int32Array,qE=new Ps([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]),YE=new Ps([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]),KO=new Ps([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),GE=function(e,t){for(var n=new Cc(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var s=new UO(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}},XE=GE(qE,2),JE=XE.b,qO=XE.r;JE[28]=258,qO[258]=28;var YO=GE(YE,0),GO=YO.b,Zx=new Cc(32768);for(var _n=0;_n<32768;++_n){var na=(_n&43690)>>1|(_n&21845)<<1;na=(na&52428)>>2|(na&13107)<<2,na=(na&61680)>>4|(na&3855)<<4,Zx[_n]=((na&65280)>>8|(na&255)<<8)>>1}var vd=function(e,t,n){for(var r=e.length,s=0,i=new Cc(t);s<r;++s)e[s]&&++i[e[s]-1];var a=new Cc(t);for(s=1;s<t;++s)a[s]=a[s-1]+i[s-1]<<1;var l;if(n){l=new Cc(1<<t);var u=15-t;for(s=0;s<r;++s)if(e[s])for(var d=s<<4|e[s],f=t-e[s],c=a[e[s]-1]++<<f,p=c|(1<<f)-1;c<=p;++c)l[Zx[c]>>u]=d}else for(l=new Cc(r),s=0;s<r;++s)e[s]&&(l[s]=Zx[a[e[s]-1]++]>>15-e[s]);return l},Sf=new Ps(288);for(var _n=0;_n<144;++_n)Sf[_n]=8;for(var _n=144;_n<256;++_n)Sf[_n]=9;for(var _n=256;_n<280;++_n)Sf[_n]=7;for(var _n=280;_n<288;++_n)Sf[_n]=8;var QE=new Ps(32);for(var _n=0;_n<32;++_n)QE[_n]=5;var XO=vd(Sf,9,1),JO=vd(QE,5,1),ly=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},hi=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},cy=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},QO=function(e){return(e+7)/8|0},Wb=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new Ps(e.subarray(t,n))},ZO=["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"],qs=function(e,t,n){var r=new Error(t||ZO[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,qs),!n)throw r;return r},eM=function(e,t,n,r){var s=e.length,i=r?r.length:0;if(!s||t.f&&!t.l)return n||new Ps(0);var a=!n,l=a||t.i!=2,u=t.i;a&&(n=new Ps(s*3));var d=function(be){var Ie=n.length;if(be>Ie){var _e=new Ps(Math.max(Ie*2,be));_e.set(n),n=_e}},f=t.f||0,c=t.p||0,p=t.b||0,h=t.l,g=t.d,v=t.m,k=t.n,y=s*8;do{if(!h){f=hi(e,c,1);var b=hi(e,c+1,3);if(c+=3,b)if(b==1)h=XO,g=JO,v=9,k=5;else if(b==2){var j=hi(e,c,31)+257,R=hi(e,c+10,15)+4,D=j+hi(e,c+5,31)+1;c+=14;for(var M=new Ps(D),z=new Ps(19),$=0;$<R;++$)z[KO[$]]=hi(e,c+$*3,7);c+=R*3;for(var A=ly(z),F=(1<<A)-1,T=vd(z,A,1),$=0;$<D;){var O=T[hi(e,c,F)];c+=O&15;var w=O>>4;if(w<16)M[$++]=w;else{var I=0,B=0;for(w==16?(B=3+hi(e,c,3),c+=2,I=M[$-1]):w==17?(B=3+hi(e,c,7),c+=3):w==18&&(B=11+hi(e,c,127),c+=7);B--;)M[$++]=I}}var P=M.subarray(0,j),L=M.subarray(j);v=ly(P),k=ly(L),h=vd(P,v,1),g=vd(L,k,1)}else qs(1);else{var w=QO(c)+4,N=e[w-4]|e[w-3]<<8,C=w+N;if(C>s){u&&qs(0);break}l&&d(p+N),n.set(e.subarray(w,C),p),t.b=p+=N,t.p=c=C*8,t.f=f;continue}if(c>y){u&&qs(0);break}}l&&d(p+131072);for(var _=(1<<v)-1,G=(1<<k)-1,Z=c;;Z=c){var I=h[cy(e,c)&_],U=I>>4;if(c+=I&15,c>y){u&&qs(0);break}if(I||qs(2),U<256)n[p++]=U;else if(U==256){Z=c,h=null;break}else{var se=U-254;if(U>264){var $=U-257,ue=qE[$];se=hi(e,c,(1<<ue)-1)+JE[$],c+=ue}var de=g[cy(e,c)&G],me=de>>4;de||qs(3),c+=de&15;var L=GO[me];if(me>3){var ue=YE[me];L+=cy(e,c)&(1<<ue)-1,c+=ue}if(c>y){u&&qs(0);break}l&&d(p+131072);var ae=p+se;if(p<L){var Ne=i-L,Pe=Math.min(L,ae);for(Ne+p<0&&qs(3);p<Pe;++p)n[p]=r[Ne+p]}for(;p<ae;++p)n[p]=n[p-L]}}t.l=h,t.p=Z,t.b=p,t.f=f,h&&(f=1,t.m=v,t.d=g,t.n=k)}while(!f);return p!=n.length&&a?Wb(n,0,p):n.subarray(0,p)},tM=new Ps(0),to=function(e,t){return e[t]|e[t+1]<<8},wi=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},uy=function(e,t){return wi(e,t)+wi(e,t+4)*4294967296};function nM(e,t){return eM(e,{i:2},t&&t.out,t&&t.dictionary)}var ew=typeof TextDecoder<"u"&&new TextDecoder,rM=0;try{ew.decode(tM,{stream:!0}),rM=1}catch{}var sM=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:Wb(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 iM(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(ew)return ew.decode(e);var s=sM(e),i=s.s,n=s.r;return n.length&&qs(8),i}}var oM=function(e,t){return t+30+to(e,t+26)+to(e,t+28)},aM=function(e,t,n){var r=to(e,t+28),s=iM(e.subarray(t+46,t+46+r),!(to(e,t+8)&2048)),i=t+46+r,a=wi(e,t+20),l=n&&a==4294967295?lM(e,i):[a,wi(e,t+24),wi(e,t+42)],u=l[0],d=l[1],f=l[2];return[to(e,t+10),u,d,s,i+to(e,t+30)+to(e,t+32),f]},lM=function(e,t){for(;to(e,t)!=1;t+=4+to(e,t+2));return[uy(e,t+12),uy(e,t+4),uy(e,t+20)]};function cM(e,t){for(var n={},r=e.length-22;wi(e,r)!=101010256;--r)(!r||e.length-r>65558)&&qs(13);var s=to(e,r+8);if(!s)return{};var i=wi(e,r+16),a=i==4294967295||s==65535;if(a){var l=wi(e,r-12);a=wi(e,l)==101075792,a&&(s=wi(e,l+32),i=wi(e,l+48))}for(var u=0;u<s;++u){var d=aM(e,i,a),f=d[0],c=d[1],p=d[2],h=d[3],g=d[4],v=d[5],k=oM(e,v);i=g,f?f==8?n[h]=nM(e.subarray(k,k+c),{out:new Ps(p)}):qs(14,"unknown compression type "+f):n[h]=Wb(e,k,k+c)}return n}const uM=8*1024*1024,dM=500;function fM(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 pM(e){return e?e.split("/").some(n=>n==="__MACOSX"||n.startsWith("._")):!0}function hM(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 mM=/^[a-zA-Z][a-zA-Z0-9_-]*$/;async function gM(e){try{const t=new Uint8Array(await e.arrayBuffer()),n=cM(t),r=new Map;let s=0,i=0;for(const[u,d]of Object.entries(n)){if(u.endsWith("/"))continue;const f=fM(u);if(!f||pM(f))continue;const c=(d==null?void 0:d.length)??0;if(s+=c,s>uM||(i+=1,i>dM))return null;r.set(f,c)}if(r.size===0)return null;const a=new Set;for(const u of r.keys()){const d=hM(u);d!==null&&a.add(d)}if(a.size!==1)return null;const[l]=[...a];if(l==="")return null;for(const u of r.keys())if(!(u===l||u.startsWith(`${l}/`)))return null;return mM.test(l)?l:null}catch{return null}}const dy=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function yM({file:e,onClose:t,onImported:n}){const{t:r}=Sn(),s=m.useId(),i=m.useRef(null),a=m.useRef(null),[l,u]=m.useState(""),[d,f]=m.useState("user"),[c,p]=m.useState(!1),[h,g]=m.useState(""),[v,k]=m.useState(null),y=v??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=y.name||"",R=j.toLowerCase();let D="";if(R.endsWith(".zip")){if(D=await gM(y)||"",!D){const M=j.replace(/\.zip$/i,"");dy.test(M)&&(D=M)}}else if(R.endsWith(".yaml")||R.endsWith(".yml")){const M=j.replace(/\.ya?ml$/i,"");dy.test(M)&&(D=M)}C||u(D)})(),()=>{C=!0}},[y]);const b=l.trim(),w=b.length>0&&dy.test(b);async function N(C){if(C.preventDefault(),!(!w||c)){p(!0),g("");try{const j=new FormData;j.set("flowId",b),j.set("targetSpace",d),j.set("file",y,y.name);const R=await fetch("/api/flows/import",{method:"POST",body:j}),D=await R.json().catch(()=>({}));if(!R.ok){g(typeof D.error=="string"?D.error:r("project:importModal.importFailed"));return}n({id:D.flowId,source:D.flowSource??"user"})}catch(j){g(String((j==null?void 0:j.message)||j))}finally{p(!1)}}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown: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:y.name})}),o.jsx("input",{ref:a,type:"file",className:"af-import-file-input",accept:".yaml,.yml,.zip,application/zip","aria-hidden":!0,tabIndex:-1,onChange:C=>{var R;const j=(R=C.target.files)==null?void 0:R[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=>u(C.target.value),"aria-invalid":b.length>0&&!w}),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:c,children:r("project:importModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!w||c,children:r(c?"project:importModal.importing":"project:importModal.importAndOpen")})]})]})]})})}const xM=/^[a-zA-Z][a-zA-Z0-9_-]*$/,Ak="af:newPipelineGuide";function wM({open:e,onClose:t,onCreated:n}){const{t:r}=Sn(),s=m.useId(),i=m.useRef(null),[a,l]=m.useState(""),[u,d]=m.useState(""),[f,c]=m.useState("user"),[p,h]=m.useState(!1),[g,v]=m.useState(""),[k,y]=m.useState(!1);m.useEffect(()=>{if(!e)return;l(""),d(""),c("user"),v(""),h(!1),localStorage.getItem(Ak)==="true"&&y(!0);const R=requestAnimationFrame(()=>{var D;return(D=i.current)==null?void 0:D.focus()});return()=>cancelAnimationFrame(R)},[e]);const b=()=>{localStorage.removeItem(Ak),y(!1)};if(!e)return null;const w=a.trim(),N=w.length>0&&xM.test(w);async function C(j){if(j.preventDefault(),!(!N||p)){h(!0),v(""),b();try{const R=await fetch("/api/flows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:w,description:u.trim(),targetSpace:f})}),D=await R.json().catch(()=>({}));if(!R.ok){v(typeof D.error=="string"?D.error:r("project:newPipelineModal.createFailed"));return}n({id:D.flowId,source:D.flowSource??"user"})}catch(R){v(String((R==null?void 0:R.message)||R))}finally{h(!1)}}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:j=>{j.target===j.currentTarget&&(b(),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:()=>{b(),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:b,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":w.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:u,onChange:j=>d(j.target.value)}),k?o.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-guide-hint",children:r("onboarding:newPipeline.descHintGuide")}):null]}),g?o.jsx("p",{className:"af-err af-new-pipeline-err",children:g}):null,o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:()=>{b(),t()},disabled:p,children:r("project:newPipelineModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!N||p,children:r(p?"project:newPipelineModal.creating":k?"onboarding:newPipeline.createGuide":"project:newPipelineModal.createAndOpen")})]})]})]})})}const ZE="agentflow.pipelineViewPreference";function e_(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(ZE)||"{}");return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}catch{return{}}}function bM(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(ZE,JSON.stringify(e))}catch{}}function Wh(e){return e==="pipeline"?"pipeline":"workspace"}function vM(e){return(e==null?void 0:e.hasPipeline)!==!1&&(e==null?void 0:e.hasFlow)!==!1&&(e==null?void 0:e.flowYaml)!==!1}function n_(e,t,n,r=!1){if(!e)return;const s=t_();s[e_(e,t,r)]={view:Wh(n),at:Date.now()},bM(s)}function kM(e,t="workspace"){if(!(e!=null&&e.id))return Wh(t);const r=t_()[e_(e.id,e.source??"user",!!e.archived)],s=Wh((r==null?void 0:r.view)||t);return s==="pipeline"&&!vM(e)?"workspace":s}function Vb(e,t="workspace"){if(!(e!=null&&e.id))return t==="pipeline"?"/flow":"/workspace";const n=new URLSearchParams({flowId:e.id,flowSource:e.source??"user"});return e.archived&&n.set(t==="pipeline"?"flowArchived":"archived","1"),`/${Wh(t)==="pipeline"?"flow":"workspace"}?${n.toString()}`}function kp(e,t="workspace"){return Vb(e,kM(e,t))}function SM(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 tw(e){return String((e==null?void 0:e.version)||"").trim()}function NM(e){const t=tw(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 jM({onChanged:e}){const[t,n]=m.useState({available:!1,version:"",loggedIn:!1,user:"",error:""}),[r,s]=m.useState([]),[i,a]=m.useState(""),[l,u]=m.useState("keyword"),[d,f]=m.useState([]),[c,p]=m.useState({}),[h,g]=m.useState(""),[v,k]=m.useState(""),[y,b]=m.useState(""),w=m.useCallback(async()=>{k("");try{const[M,z]=await Promise.all([fetch("/api/skillhub/status"),fetch("/api/skillhub/list?target=global&agent=codex")]),$=await M.json().catch(()=>({}));M.ok&&n({available:!!$.available,version:typeof $.version=="string"?$.version:"",loggedIn:!!$.loggedIn,user:typeof $.user=="string"?$.user:"",error:typeof $.error=="string"?$.error:""});const A=await z.json().catch(()=>({}));if(!z.ok)throw new Error(typeof A.error=="string"?A.error:"HTTP "+z.status);s(Array.isArray(A.skills)?A.skills:[]),p({})}catch(M){k(String(M.message||M))}},[]);m.useEffect(()=>{w()},[w]);const N=m.useCallback(async()=>{const M=i.trim();if(M){g("search"),k(""),b("");try{const z=await fetch(`/api/skillhub/search?q=${encodeURIComponent(M)}&mode=${encodeURIComponent(l)}`),$=await z.json().catch(()=>({}));if(!z.ok)throw new Error(typeof $.error=="string"?$.error:"HTTP "+z.status);f(Array.isArray($.items)?$.items:[])}catch(z){k(String(z.message||z))}finally{g("")}}},[i,l]),C=m.useCallback(async(M,z=!1)=>{const $=M&&typeof M=="object"?M:null,A=String($?$.slug||$.name||$.collection||$.skillId||$.id:M||"").trim();if(A){g(`install:${A}`),k(""),b("");try{const F=$?{slug:$.slug||"",skillId:$.skillId||"",collection:$.collection||"",collectionName:$.collection&&$.name||"",target:"global",agent:"codex",force:z}:{slug:A,target:"global",agent:"codex",force:z},T=await fetch("/api/skillhub/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(F)}),O=await T.json().catch(()=>({}));if(!T.ok)throw new Error(typeof O.error=="string"?O.error:"HTTP "+T.status);b(z?`已更新 ${A}`:`已安装 ${A}`),await w(),typeof e=="function"&&await e()}catch(F){k(String(F.message||F))}finally{g("")}}},[w,e]),j=m.useCallback(async()=>{if(r.length!==0){g("check-updates"),k(""),b("");try{const M=await Promise.all(r.map(async A=>{const F=String(A.name||"").trim();if(!F)return null;try{const T=await fetch(`/api/skillhub/search?q=${encodeURIComponent(F)}&mode=keyword`),O=await T.json().catch(()=>({}));if(!T.ok)throw new Error(typeof O.error=="string"?O.error:"HTTP "+T.status);const I=Array.isArray(O.items)?O.items:[],B=I.find(G=>G.slug===F||G.name===F||G.id===F)||I[0],P=tw(A),L=String((B==null?void 0:B.version)||"").trim();let _="unknown";return B?P&&L?_=SM(P,L)<0?"update":"current":L&&(_="remote-only"):_="missing",[F,{state:_,latestVersion:L,installedVersion:P,summary:(B==null?void 0:B.summary)||""}]}catch(T){return[F,{state:"error",error:String(T.message||T),installedVersion:tw(A)}]}})),z={};for(const A of M)A&&(z[A[0]]=A[1]);p(z);const $=Object.values(z).filter(A=>A.state==="update").length;b($>0?`发现 ${$} 个可更新 skill`:"已检查,暂无明确可更新项")}finally{g("")}}},[r]),R=m.useCallback(async M=>{const z=String(M||"").trim();if(z){g(`uninstall:${z}`),k(""),b("");try{const $=await fetch("/api/skillhub/uninstall",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:z,target:"global",agent:"codex"})}),A=await $.json().catch(()=>({}));if(!$.ok)throw new Error(typeof A.error=="string"?A.error:"HTTP "+$.status);b(`已卸载 ${z}`),await w(),typeof e=="function"&&await e()}catch($){k(String($.message||$))}finally{g("")}}},[w,e]),D=m.useCallback(async()=>{g("update-cli"),k(""),b("");try{const M=await fetch("/api/skillhub/update",{method:"POST"}),z=await M.json().catch(()=>({}));if(!M.ok)throw new Error(typeof z.error=="string"?z.error:"HTTP "+M.status);b("SkillHub CLI 已更新"),await w()}catch(M){k(String(M.message||M))}finally{g("")}},[w]);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:"搜索、安装、更新和卸载 Codex 全局 skills。"})]}),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:t.loggedIn?`已登录 ${t.user}`:"未登录 SkillHub"}),o.jsx("span",{className:"af-set-badge"+(t.available?" af-set-badge--ok":" af-set-badge--err"),children:t.available?`v${t.version}`:"not found"})]}),o.jsxs("div",{className:"af-set-skillhub-toolbar",children:[o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:w,disabled:!!h,children:"刷新"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:j,disabled:!!h||r.length===0,children:h==="check-updates"?"检查中…":"检查更新"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:D,disabled:!!h,children:h==="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:l,onChange:M=>{u(M.target.value),f([])},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:i,onChange:M=>a(M.target.value),onKeyDown:M=>{M.key==="Enter"&&N()},placeholder:l==="collectionId"?"输入 collection id,例如 1":l==="skillId"?"输入 skill id":"搜索 skill slug / 关键词,例如 android、issue-tracker"}),o.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:()=>N(),disabled:!i.trim()||h==="search",children:[o.jsx("span",{className:"material-symbols-outlined",children:"search"}),h==="search"?"搜索中…":"搜索"]})]}),v?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:v}):null,y?o.jsx("p",{className:"af-set-hint af-set-hint--inline",children:y}):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:r.length})]}),o.jsx("div",{className:"af-set-skillhub-list",children:r.length===0?o.jsx("div",{className:"af-set-skillhub-empty",children:"暂无 Codex 全局 skills"}):r.map(M=>{const z=c[M.name],$=!z||z.state==="update"||z.state==="remote-only"||z.state==="unknown"||z.state==="error",A=h===`install:${M.name}`?"更新中…":(z==null?void 0:z.state)==="current"?"已最新":(z==null?void 0:z.state)==="update"&&z.latestVersion?`更新到 v${z.latestVersion}`:(z==null?void 0:z.state)==="remote-only"&&z.latestVersion?`安装 v${z.latestVersion}`:"重装";return o.jsxs("div",{className:"af-set-skillhub-item",children:[o.jsxs("div",{children:[o.jsx("div",{className:"af-set-skillhub-title",children:M.displayName||M.name}),o.jsx("div",{className:"af-set-skillhub-meta",children:NM(M)}),o.jsx("div",{className:"af-set-skillhub-version-row",children:z?z.state==="update"?o.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--warn",children:["可更新 ",z.installedVersion?`v${z.installedVersion} -> `:"","v",z.latestVersion]}):z.state==="current"?o.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--ok",children:["已最新 v",z.latestVersion||z.installedVersion]}):z.state==="remote-only"?o.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:["远端 v",z.latestVersion,",本地版本未知"]}):z.state==="missing"?o.jsx("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:"未找到远端匹配项"}):z.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:()=>C(M.name,!0),disabled:!!h||!$,children:A}),o.jsx("button",{type:"button",className:"af-set-btn-mini af-set-btn-mini--danger",onClick:()=>R(M.name),disabled:!!h,children:"卸载"})]})]},`${M.agent}:${M.path}:${M.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(M=>{const z=M.slug||M.name,$=M.kind==="collection"||M.collection,A=!$&&r.some(F=>F.name===z||F.name===M.name);return o.jsxs("div",{className:"af-set-skillhub-item",children:[o.jsxs("div",{children:[o.jsx("div",{className:"af-set-skillhub-title",children:M.name||z}),o.jsxs("div",{className:"af-set-skillhub-meta",children:[$?`collection:${M.collection}`:z,M.skillId?` · id:${M.skillId}`:"",M.version?` · ${M.version}`:""]}),M.summary?o.jsx("p",{className:"af-set-skillhub-summary",children:M.summary}):null]}),o.jsx("button",{type:"button",className:A?"af-set-btn-mini":"af-set-btn-add af-set-btn-add--compact",onClick:()=>C(M,A),disabled:!!h,children:A?"更新":$?"安装合集":"安装"})]},M.id||z)})})]})]})]})}function Ca(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 CM(e){return{version:1,collections:Ca({collections:e})}}function Ta(e,t){const n=new Set((Array.isArray(t)?t:[]).map(r=>r.key).filter(Boolean));return(Array.isArray(e==null?void 0:e.skillKeys)?e.skillKeys:[]).filter(r=>n.has(r))}function r_(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 s_(e,t){const n=new Set(Array.isArray(t)?t:[]);return(Array.isArray(e)?e:[]).filter(r=>!n.has(r))}function i_(e,t,n){const r=Ta(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 EM(e,t,n){const r=String(e||"").trim().toLowerCase(),s=Ca({collections:n}).find(i=>i.id===r||i.name.toLowerCase()===r);return Ta(s,t)}function o_(e,t,n,r){const s=(Array.isArray(n)?n:[]).map(d=>d.key).filter(Boolean),i=String(t||"").trim().toLowerCase(),a=Ca({collections:r}),l=EM(t,n,r),u=l.length>0?l:s;if(!e)return u;try{const d=localStorage.getItem(e);if(d!==null){const f=JSON.parse(d);if(Array.isArray(f)){const c=new Set(s),p=f.map(String).filter(y=>c.has(y));if(s.length>0&&p.length===s.length)return u;const h=new Set(p),g=new Set(l),v=l.length>0&&l.every(y=>h.has(y)),k=a.some(y=>{if(!y.builtin||y.id===i||y.name.toLowerCase()===i)return!1;const b=Ta(y,n);return b.length>0&&b.every(w=>h.has(w))});return l.length>0&&k&&!v?u:p}}}catch{}return u}function Uu(e){return 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 _M(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 nw(e,t){return e==="builtin"?{label:t("project:sourceBadge.builtin"),tone:"muted"}:e==="admin"?{label:t("project:sourceBadge.builtin"),tone:"muted"}:e==="workspace"?{label:t("project:sourceBadge.workspace"),tone:"secondary"}:{label:t("project:sourceBadge.user"),tone:"primary"}}function a_(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 PM="project:defaultCardDesc";function l_(e,t){const n=e.description!=null?String(e.description).trim():"";return n!==""?n:t(PM)}function AM(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Jn({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(`(${AM(r)})`,"gi"),a=s.split(i);return o.jsx("span",{className:t,children:a.map((l,u)=>u%2===1?o.jsx("mark",{className:"af-search-hit",children:l},u):o.jsx("span",{children:l},u))})}function IM(e,t,n){const r=[String(e.id),l_(e,n),a_(e),nw(e.source,n).label];return e.archived&&r.push(n("project:archived")),r.join(`
|
|
41
|
+
`).toLowerCase()}function TM(e,t,n){return t?IM(e,t,n).includes(t):!0}function RM(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 fy(e,t){const n=e.trim().toLowerCase();return n?t.filter(Boolean).join(`
|
|
42
|
+
`).toLowerCase().includes(n):!0}function Ik(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 Tk(e){return e!=null&&e.packageDir?e.packageDir:`marketplace/flow-snippets / ${(e==null?void 0:e.id)||""}`}const LM=["all","agent","control","provide","marketplace"],OM=["all","agent","control","provide"],c_="agentflow.projects.activityPanelOpen",rw="agentflow.projects.activitySelected";function MM(){if(typeof localStorage>"u")return!0;const e=localStorage.getItem(c_);return e!=="0"}function Rk(e){return`${(e==null?void 0:e.flowSource)||"user"}:${(e==null?void 0:e.flowId)||""}`}function $M(){return typeof localStorage>"u"?"":localStorage.getItem(rw)||""}function Sp(e){return!e||typeof e!="object"?[]:Object.entries(e).map(([t,n])=>({key:t,...n&&typeof n=="object"?n:{}}))}function Rn(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 ra(e){return`${(e==null?void 0:e.id)||""}:${(e==null?void 0:e.version)||""}:${(e==null?void 0:e.packageDir)||""}`}function u_(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 d_(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 sw(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 Lk(e,t){return String((e==null?void 0:e.label)||(e==null?void 0:e.displayName)||(e==null?void 0:e.name)||sw(e,t))}function DM(e){return String((e==null?void 0:e.definitionId)||(e==null?void 0:e.type)||(e==null?void 0:e.runtimeType)||"").replace(/^marketplace:/,"")}function Ok(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 FM(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 py(e,t=16){const n=String(e||"").trim();return n.length<=t?n:`${n.slice(0,t-1)}…`}function zM(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 BM(e,t){const n=e.map(f=>f.id),r=new Set(n),s=new Map(n.map(f=>[f,0])),i=new Map(n.map(f=>[f,[]]));t.forEach(f=>{var c;!r.has(f.sourceId)||!r.has(f.targetId)||(s.set(f.targetId,(s.get(f.targetId)||0)+1),(c=i.get(f.sourceId))==null||c.push(f.targetId))});const a=new Map,l=n.filter(f=>(s.get(f)||0)===0);l.length===0&&n[0]&&l.push(n[0]),l.forEach(f=>a.set(f,0));for(let f=0;f<l.length;f+=1){const c=l[f],p=(a.get(c)||0)+1;for(const h of i.get(c)||[])(!a.has(h)||p>a.get(h))&&(a.set(h,p),l.push(h))}n.forEach((f,c)=>{a.has(f)||a.set(f,c%3)});const u=new Map,d=new Map;return n.forEach(f=>{const c=a.get(f)||0,p=u.get(c)||0;u.set(c,p+1),d.set(f,{x:c*190,y:p*86})}),d}function HM(e){var v,k,y,b;const t=u_(e),n=d_(e),r=new Map(t.map((w,N)=>[sw(w,N),Lk(w,N)])),s=t.map((w,N)=>({id:sw(w,N),title:Lk(w,N),meta:DM(w)})),i=n.map((w,N)=>{const C=Ok(w,"source"),j=Ok(w,"target");return{key:(w==null?void 0:w.id)||`${C}-${j}-${N}`,sourceId:C,targetId:j,source:r.get(C)||C||"?",target:r.get(j)||j||"?",label:FM(w)}}),a=(k=(v=e==null?void 0:e.snippet)==null?void 0:v.ui)!=null&&k.nodePositions&&typeof e.snippet.ui.nodePositions=="object"?e.snippet.ui.nodePositions:{},l=(b=(y=e==null?void 0:e.snippet)==null?void 0:y.ui)!=null&&b.nodeSizes&&typeof e.snippet.ui.nodeSizes=="object"?e.snippet.ui.nodeSizes:{},u=BM(s,i),d=s.map(w=>{const N=zM(a[w.id])||u.get(w.id)||{x:0,y:0},C=l[w.id]&&typeof l[w.id]=="object"?l[w.id]:{},j=Number(C.width),R=Number(C.height),D=Math.max(132,Math.min(210,Number.isFinite(j)?j*.62:150)),M=Math.max(48,Math.min(76,Number.isFinite(R)?R*.46:54));return{...w,x:N.x,y:N.y,width:D,height:M}}),f=new Map(d.map(w=>[w.id,w])),c=i.map(w=>{const N=f.get(w.sourceId),C=f.get(w.targetId);if(!N||!C)return null;const j=N.x+N.width,R=N.y+N.height/2,D=C.x,M=C.y+C.height/2,z=Math.max(48,Math.abs(D-j)*.45);return{...w,path:`M ${j} ${R} C ${j+z} ${R}, ${D-z} ${M}, ${D} ${M}`,labelX:(j+D)/2,labelY:(R+M)/2}}).filter(Boolean),p=d.reduce((w,N)=>({minX:Math.min(w.minX,N.x),minY:Math.min(w.minY,N.y),maxX:Math.max(w.maxX,N.x+N.width),maxY:Math.max(w.maxY,N.y+N.height)}),{minX:0,minY:0,maxX:420,maxY:220}),h=36,g=`${p.minX-h} ${p.minY-h} ${Math.max(360,p.maxX-p.minX+h*2)} ${Math.max(180,p.maxY-p.minY+h*2)}`;return{nodes:s,edges:i,diagram:{nodes:d,edges:c,viewBox:g}}}function ic({resourceKind:e="",authUser:t=null}){var si,tn,Ns,ii,Tr,Sr;const{t:n}=Sn(),{navigate:r,path:s}=Ba(),[i,a]=m.useState(e||"all"),[l,u]=m.useState([]),[d,f]=m.useState([]),[c,p]=m.useState([]),[h,g]=m.useState([]),[v,k]=m.useState([]),[y,b]=m.useState(""),[w,N]=m.useState(!1),[C,j]=m.useState([]),[R,D]=m.useState(""),[M,z]=m.useState(""),[$,A]=m.useState(!1),[F,T]=m.useState(!1),[O,I]=m.useState(!1),[B,P]=m.useState(null),[L,_]=m.useState(!1),[G,Z]=m.useState(""),[U,se]=m.useState(MM),[ue,de]=m.useState($M),[me,ae]=m.useState("all"),[Ne,Pe]=m.useState(""),[be,Ie]=m.useState("overview"),[_e,nt]=m.useState({}),[st,Je]=m.useState(""),[Ct,Be]=m.useState({}),[mt,Gt]=m.useState(""),[De,en]=m.useState(""),[rn,pn]=m.useState({}),[Hn,le]=m.useState(""),[ve,qe]=m.useState(""),[ge,lt]=m.useState(""),[Bt,hn]=m.useState(""),[In,mn]=m.useState(""),[cr,Xt]=m.useState(!1),[Wn,Tn]=m.useState(""),[br,xe]=m.useState({hiddenBuiltins:[],promoted:[]}),Me=m.useRef(0),Qe=m.useRef(0),re=m.useCallback(async()=>{var fe,Te;const V=++Qe.current;D("");try{const Ae=await fetch("/api/flows");if(V!==Qe.current)return;if(!Ae.ok)throw new Error("HTTP "+Ae.status);const Ge=await Ae.json();if(V!==Qe.current)return;u(Array.isArray(Ge)?Ge:[])}catch(Ae){if(V!==Qe.current)return;u([]),D(String(Ae.message||Ae))}try{const Ae=await fetch("/api/pipeline-recent-runs");if(V!==Qe.current)return;if(Ae.ok){const Ge=await Ae.json();if(V!==Qe.current)return;j(Array.isArray(Ge.runs)?Ge.runs:[])}else j([])}catch{if(V!==Qe.current)return;j([])}if(t!=null&&t.isAdmin)try{const Ae=await fetch("/api/admin/builtin-flows");if(V!==Qe.current)return;const Ge=await Ae.json().catch(()=>({}));Ae.ok&&xe({hiddenBuiltins:Array.isArray((fe=Ge==null?void 0:Ge.config)==null?void 0:fe.hiddenBuiltins)?Ge.config.hiddenBuiltins:[],promoted:Array.isArray((Te=Ge==null?void 0:Ge.config)==null?void 0:Te.promoted)?Ge.config.promoted:[]})}catch{if(V!==Qe.current)return;xe({hiddenBuiltins:[],promoted:[]})}else xe({hiddenBuiltins:[],promoted:[]});A(!0)},[t==null?void 0:t.isAdmin]),ke=m.useCallback(async(V,fe)=>{if(!(t!=null&&t.isAdmin)||!(V!=null&&V.id))return;const Te=`${fe}:${V.source}:${V.id}`;Tn(Te),D("");try{const Ae=await fetch("/api/admin/builtin-flows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:fe,flowId:V.id,ownerUserId:V.ownerUserId||t.userId})}),Ge=await Ae.json().catch(()=>({}));if(!Ae.ok)throw new Error(Ge.error||"更新内置配置失败");await re()}catch(Ae){D(String(Ae.message||Ae))}finally{Tn("")}},[t==null?void 0:t.isAdmin,t==null?void 0:t.userId,re]),et=m.useCallback(async()=>{z(""),T(!1);try{const[V,fe,Te,Ae]=await Promise.all([fetch("/api/nodes"),fetch("/api/skills"),fetch("/api/skill-collections"),fetch("/api/marketplace/flow-snippets")]),Ge=await V.json().catch(()=>({})),$t=await fe.json().catch(()=>({})),yt=await Te.json().catch(()=>({})),Kn=await Ae.json().catch(()=>({}));if(!V.ok)throw new Error(Ge.error||"Nodes HTTP "+V.status);if(!fe.ok)throw new Error($t.error||"Skills HTTP "+fe.status);if(!Te.ok)throw new Error(yt.error||"Collections HTTP "+Te.status);if(!Ae.ok)throw new Error(Kn.error||"Flow snippets HTTP "+Ae.status);f(Array.isArray(Ge.nodes)?Ge.nodes:Array.isArray(Ge)?Ge:[]),p(Array.isArray($t.skills)?$t.skills:[]),k(Ca(yt)),g(Array.isArray(Kn.snippets)?Kn.snippets:[])}catch(V){f([]),p([]),g([]),k([]),z(String(V.message||V))}finally{T(!0)}},[]);m.useEffect(()=>{A(!1),re(),et()},[re,et]),m.useEffect(()=>{try{localStorage.setItem(c_,U?"1":"0")}catch{}},[U]),m.useEffect(()=>{try{ue?localStorage.setItem(rw,ue):localStorage.removeItem(rw)}catch{}},[ue]),m.useEffect(()=>{let V=!1;return fetch("/api/ui-context").then(fe=>fe.json()).then(fe=>{V||Xt(!!fe.hideCommunityLinks)}).catch(()=>{}),()=>{V=!0}},[]);const Mt=m.useCallback(async V=>{const fe=Ca({collections:V});N(!0),z("");try{const Te=await fetch("/api/skill-collections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(CM(fe))}),Ae=await Te.json().catch(()=>({}));if(!Te.ok)throw new Error(Ae.error||"Collections HTTP "+Te.status);k(Ca(Ae))}catch(Te){z(String(Te.message||Te))}finally{N(!1)}},[]),Nn=m.useCallback(()=>{const V=y.trim();if(!V)return;const fe=V.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"collection",Te=new Set(v.map(yt=>yt.id));let Ae=fe,Ge=2;for(;Te.has(Ae);)Ae=`${fe}-${Ge++}`;const $t=Date.now();Mt([...v,{id:Ae,name:V,skillKeys:[],createdAt:$t,updatedAt:$t}]),b(""),ae(`collection:${Ae}`)},[y,Mt,v]),sn=m.useCallback(V=>{const fe=v.find(Ae=>Ae.id===V);if(fe!=null&&fe.builtin)return;const Te=v.filter(Ae=>Ae.id!==V);me===`collection:${V}`&&ae("all"),Mt(Te)},[me,Mt,v]),Gr=m.useCallback((V,fe,Te)=>{const Ae=String(fe||"").trim();if(!Ae)return;const Ge=Date.now(),$t=v.map(yt=>{if(yt.id!==V)return yt;const Kn=new Set(yt.skillKeys||[]);return Te?Kn.add(Ae):Kn.delete(Ae),{...yt,skillKeys:Array.from(Kn),updatedAt:Ge}});Mt($t)},[Mt,v]),Xr=m.useCallback(async V=>{const fe=V==null?void 0:V.packageId,Te=V==null?void 0:V.version;if(!fe||!Te||!window.confirm(n("project:deleteMyNodeConfirm",{id:fe,version:Te})))return;const Ae=Rn(V);qe(Ae),lt(""),z("");try{const Ge=new URLSearchParams({id:fe,version:Te}),$t=await fetch(`/api/marketplace/node?${Ge.toString()}`,{method:"DELETE"}),yt=await $t.json().catch(()=>({}));if(!$t.ok||(yt==null?void 0:yt.ok)===!1){const Kn=Array.isArray(yt==null?void 0:yt.usage)&&yt.usage.length>0?` ${n("project:deleteMyNodeUsedBy",{count:yt.usage.length})}`:"";throw new Error(((yt==null?void 0:yt.error)||"Delete failed")+Kn)}lt(n("project:deleteMyNodeSuccess",{id:fe,version:Te})),Be(Kn=>{const $n={...Kn};return delete $n[Ae],$n}),pn(Kn=>{const $n={};for(const[Ti,js]of Object.entries(Kn))Ti.startsWith(`${Ae}:`)||($n[Ti]=js);return $n}),Pe(""),await et()}catch(Ge){lt(String(Ge.message||Ge))}finally{qe("")}},[et,n]),bs=m.useCallback(async V=>{const fe=V==null?void 0:V.id,Te=(V==null?void 0:V.version)||"1.0.0";if(!fe||!Te||!window.confirm(n("project:deleteMyFlowConfirm",{id:fe,version:Te})))return;const Ae=ra(V);hn(Ae),mn(""),z("");try{const Ge=new URLSearchParams({id:fe,version:Te}),$t=await fetch(`/api/marketplace/flow-snippet?${Ge.toString()}`,{method:"DELETE"}),yt=await $t.json().catch(()=>({}));if(!$t.ok||(yt==null?void 0:yt.ok)===!1)throw new Error((yt==null?void 0:yt.error)||"Delete failed");mn(n("project:deleteMyFlowSuccess",{id:fe,version:Te})),Pe(""),await et()}catch(Ge){mn(String(Ge.message||Ge))}finally{hn("")}},[et,n]);m.useEffect(()=>{if(e==="nodes"||e==="my-nodes"||e==="my-flows"||e==="skills"){a(e),ae("all"),Pe(""),Ie("overview");return}a(V=>V==="archived"?"archived":"all")},[e]),m.useEffect(()=>{if(s!=="/projects"&&s!=="/")return;const V=new URLSearchParams(window.location.search);let fe=!1;if(V.get("tab")==="nodes"){r("/nodes");return}if(V.get("tab")==="my-nodes"){r("/my-nodes");return}if(V.get("tab")==="my-flows"){r("/my-flows");return}if(V.get("tab")==="skills"){r("/skills");return}if(V.get("tab")==="archived"&&(a("archived"),V.delete("tab"),fe=!0),V.get("new")==="1"&&(I(!0),V.delete("new"),fe=!0),fe){const Te=V.toString();window.history.replaceState({},"",Te?`/projects?${Te}`:"/projects")}},[s,r]);const vr=m.useMemo(()=>VO(C,KE(),l),[C,l,s]),Wo=m.useMemo(()=>vr.filter(V=>RM(G,V)),[vr,G]),Zn=G.trim().toLowerCase(),vs=m.useMemo(()=>i==="archived"?l.filter(V=>V.archived):l.filter(V=>!V.archived),[l,i]),Ai=m.useMemo(()=>vs.filter(V=>TM(V,Zn,n)),[vs,Zn,n]),mo=m.useMemo(()=>new Set((br.promoted||[]).map(V=>String((V==null?void 0:V.id)||"").trim()).filter(Boolean)),[br.promoted]),ni=m.useMemo(()=>(br.hiddenBuiltins||[]).map(V=>String(V||"").trim()).filter(Boolean),[br.hiddenBuiltins]),Vn=i==="nodes"||i==="my-nodes",Re=i==="my-nodes",Qt=i==="my-flows",er=m.useMemo(()=>d.filter(V=>Re&&V.source!=="marketplace"?!1:(me==="all"||(me==="marketplace"?V.source==="marketplace":V.type===me))&&fy(G,[V.id,V.label,V.displayName,V.description,V.type,V.source,V.packageId,V.version])),[d,Re,G,me]),gt=m.useMemo(()=>{const V=new Map;for(const fe of v)V.set(fe.id,new Set(fe.skillKeys||[]));return V},[v]),Fs=m.useMemo(()=>[{id:"all",label:"全部"},...v.map(V=>({id:`collection:${V.id}`,label:V.name,count:V.skillKeys.length,collection:V})),{id:"ungrouped",label:"未分组"}],[v]),Un=m.useMemo(()=>c.filter(V=>{var Ae;const fe=Rn(V);let Te=me==="all";if(me.startsWith("collection:")){const Ge=me.slice(11);Te=!!((Ae=gt.get(Ge))!=null&&Ae.has(fe))}else me==="ungrouped"&&(Te=!Array.from(gt.values()).some(Ge=>Ge.has(fe)));return Te&&fy(G,[V.name,V.id,V.description,V.sourceLabel,V.source,V.path])}),[c,G,me,gt]),Mn=m.useMemo(()=>h.filter(V=>fy(G,[V.id,V.name,V.displayName,V.description,V.version,V.packageDir,Array.isArray(V.tags)?V.tags.join(" "):""])),[h,G]),ks=Vn||Qt||i==="skills",at=m.useMemo(()=>er.find(V=>Rn(V)===Ne)||er[0]||null,[er,Ne]),Kt=m.useMemo(()=>Un.find(V=>Rn(V)===Ne)||Un[0]||null,[Un,Ne]),Ht=m.useMemo(()=>Mn.find(V=>ra(V)===Ne)||Mn[0]||null,[Mn,Ne]),jn=Kt?_e[Rn(Kt)]:null,Ye=at?Ct[Rn(at)]:null,tr=at&&De?rn[`${Rn(at)}:${De}`]:null,Br=n(Vn?"project:searchNodes":Qt?"project:searchFlows":i==="skills"?"project:searchSkills":"project:searchPipelines");m.useEffect(()=>{if(i!=="skills"||!Kt)return;const V=Rn(Kt);if(_e[V])return;let fe=!1;return Je(V),fetch(`/api/skills/detail?key=${encodeURIComponent(V)}`).then(Te=>Te.json().then(Ae=>({ok:Te.ok,json:Ae}))).then(({ok:Te,json:Ae})=>{fe||Te&&Ae.skill&&nt(Ge=>({...Ge,[V]:Ae.skill}))}).catch(()=>{}).finally(()=>{fe||Je("")}),()=>{fe=!0}},[i,Kt,_e]),m.useEffect(()=>{if(!Vn||!at)return;const V=Rn(at);if(Ct[V])return;let fe=!1;return Gt(V),fetch(`/api/nodes/detail?id=${encodeURIComponent(at.id)}`).then(Te=>Te.json().then(Ae=>({ok:Te.ok,json:Ae}))).then(({ok:Te,json:Ae})=>{fe||Te&&Be(Ge=>({...Ge,[V]:Ae}))}).catch(()=>{}).finally(()=>{fe||Gt("")}),()=>{fe=!0}},[Vn,at,Ct]),m.useEffect(()=>{if(!Vn)return;const V=Array.isArray(Ye==null?void 0:Ye.files)?Ye.files:[];en(fe=>{var Te;return fe&&V.some(Ae=>Ae.path===fe)?fe:((Te=V[0])==null?void 0:Te.path)||""})},[Vn,Ye]),m.useEffect(()=>{if(!Vn||!at||!De)return;const V=`${Rn(at)}:${De}`;if(rn[V])return;let fe=!1;return le(V),fetch(`/api/nodes/file?id=${encodeURIComponent(at.id)}&path=${encodeURIComponent(De)}`).then(Te=>Te.json().then(Ae=>({ok:Te.ok,json:Ae}))).then(({ok:Te,json:Ae})=>{fe||Te&&pn(Ge=>({...Ge,[V]:Ae}))}).catch(()=>{}).finally(()=>{fe||le("")}),()=>{fe=!0}},[Vn,at,De,rn]),m.useEffect(()=>{lt("")},[Ne,i]);const go=V=>{r(kp(V,"workspace"))},kr=V=>{de(Rk(V)),r(kp({id:V.flowId,source:V.flowSource,archived:!!V.archived},"workspace"))},Ii=m.useCallback(V=>{var fe,Te;V.preventDefault(),V.stopPropagation(),(Te=(fe=V.dataTransfer)==null?void 0:fe.types)!=null&&Te.includes("Files")&&(Me.current+=1,_(!0))},[]),Ss=m.useCallback(V=>{V.preventDefault(),V.stopPropagation(),Me.current-=1,Me.current<=0&&(Me.current=0,_(!1))},[]),ri=m.useCallback(V=>{V.preventDefault(),V.stopPropagation()},[]),zs=m.useCallback(V=>{var Ae,Ge;V.preventDefault(),V.stopPropagation(),Me.current=0,_(!1);const fe=(Ge=(Ae=V.dataTransfer)==null?void 0:Ae.files)==null?void 0:Ge[0];if(!fe)return;const Te=fe.name.toLowerCase();!Te.endsWith(".yaml")&&!Te.endsWith(".yml")&&!Te.endsWith(".zip")||P(fe)},[]);return o.jsxs("div",{className:"af-projects"+(L?" af-projects--drop-target":""),onDragEnter:Ii,onDragLeave:Ss,onDragOver:ri,onDrop:zs,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:i==="all"?"af-tab af-tab--active":"af-tab",onClick:()=>a("all"),children:n("project:all")}),o.jsx("button",{type:"button",className:i==="archived"?"af-tab af-tab--active":"af-tab",onClick:()=>a("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"+(G.trim()?" af-search--has-clear":""),type:"search",placeholder:Br,"aria-label":Br,autoComplete:"off",value:G,onChange:V=>Z(V.target.value),onKeyDown:V=>{V.key==="Escape"&&(Z(""),V.currentTarget.blur())}}),G.trim()?o.jsx("button",{type:"button",className:"af-search-clear","aria-label":"Clear search",onClick:()=>Z(""),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),ks?o.jsx("button",{type:"button",className:"af-btn-primary af-create-btn",onClick:()=>et(),children:n("project:refreshResources")}):o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-icon-btn"+(U?" af-icon-btn--active":""),"aria-label":n("flow:palette.toggleRecentActivity"),"aria-expanded":U,"aria-controls":"af-recent-activity-panel",onClick:()=>se(V=>!V),children:o.jsx("span",{className:"material-symbols-outlined",children:"notifications"})}),o.jsx("button",{type:"button",className:"af-btn-primary af-create-btn",onClick:()=>I(!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(i==="my-nodes"?"project:myNodes":i==="my-flows"?"project:myFlows":i==="nodes"?"project:globalNodes":i==="skills"?"project:globalSkills":i==="archived"?"project:archivedPipelines":"project:activeProjects")}),o.jsx("p",{className:"af-projects-sub",children:Zn?n("project:filterResult",{count:i==="nodes"||i==="my-nodes"?er.length:i==="my-flows"?Mn.length:i==="skills"?Un.length:Ai.length}):i==="my-nodes"?n("project:myNodesHint",{count:er.length}):i==="my-flows"?n("project:myFlowsHint",{count:Mn.length}):i==="nodes"?n("project:nodesHint",{count:d.length}):i==="skills"?n("project:skillsHint",{count:c.length}):n(i==="archived"?"project:archivedHint":"project:activeHint")}),R?o.jsx("p",{className:"af-err af-projects-api-hint",children:R}):null,M&&ks?o.jsx("p",{className:"af-err af-projects-api-hint",children:M}):null]}),ks?o.jsxs("div",{className:"af-resource-toolbar",children:[i==="skills"?o.jsx(jM,{onChanged:et}):null,o.jsxs("div",{className:"af-resource-purpose",children:[o.jsx("span",{className:"material-symbols-outlined",children:Qt?"schema":Vn?Re?"deployed_code":"account_tree":"extension"}),o.jsxs("div",{children:[o.jsx("h3",{children:n(Qt?"project:myFlowsPurposeTitle":Re?"project:myNodesPurposeTitle":Vn?"project:nodesPurposeTitle":"project:skillsPurposeTitle")}),o.jsx("p",{children:n(Qt?"project:myFlowsPurposeDesc":Re?"project:myNodesPurposeDesc":Vn?"project:nodesPurposeDesc":"project:skillsPurposeDesc")})]})]}),Qt?null:o.jsx("div",{className:"af-resource-filter-row",children:(Vn?(Re?OM:LM).map(V=>({id:V,label:n(`project:resourceFilter.${V}`)})):Fs).map(V=>V.collection?o.jsxs("span",{className:"af-resource-filter-chip"+(me===V.id?" af-resource-filter-chip--active":""),children:[o.jsxs("button",{type:"button",className:"af-resource-filter af-resource-filter--embedded",onClick:()=>{ae(V.id),Pe("")},children:[V.label,o.jsx("em",{children:V.count}),V.collection.builtin?o.jsx("strong",{children:"built-in"}):null]}),V.collection.builtin?null:o.jsx("button",{type:"button",className:"af-resource-filter-chip__delete",disabled:w,"aria-label":`删除 ${V.collection.name}`,onClick:()=>sn(V.collection.id),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},V.id):o.jsx("button",{type:"button",className:"af-resource-filter"+(me===V.id?" af-resource-filter--active":""),onClick:()=>{ae(V.id),Pe("")},children:V.label},V.id))}),i==="skills"?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:y,onChange:V=>b(V.target.value),onKeyDown:V=>{V.key==="Enter"&&Nn()},placeholder:"新建 skill collection"}),o.jsxs("button",{type:"button",className:"af-set-btn-add af-set-btn-add--compact",disabled:!y.trim()||w,onClick:()=>Nn(),children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),"新建"]})]})}):null]}):null,Vn?o.jsx("div",{className:"af-resource-grid",children:er.length>0?er.map(V=>o.jsxs("button",{type:"button",className:"af-resource-card"+(at&&Rn(V)===Rn(at)?" af-resource-card--active":""),onClick:()=>Pe(Rn(V)),children:[o.jsxs("div",{className:"af-resource-card-head",children:[o.jsx("span",{className:Uu(V.type==="control"?"secondary":V.type==="provide"?"primary":"muted"),children:o.jsx(Jn,{query:G,children:V.type||"node"})}),o.jsx("span",{className:"af-resource-source",children:o.jsx(Jn,{query:G,children:Ik(V.source,n)})})]}),o.jsx("h3",{className:"af-project-title",children:o.jsx(Jn,{query:G,children:V.label||V.displayName||V.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(Jn,{query:G,children:V.description||n("project:noDescription")})}),o.jsxs("div",{className:"af-resource-meta-row",children:[o.jsx("span",{children:o.jsx(Jn,{query:G,children:V.id})}),o.jsx("span",{children:n("project:nodeSlots",{inputs:Object.keys(V.inputs||{}).length,outputs:Object.keys(V.outputs||{}).length})})]}),V.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(Jn,{query:G,children:`${V.packageId}${V.version?` / ${V.version}`:""}`})})]}):null]},`${V.id}:${V.source||""}:${V.packageId||""}`)):F?o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:Zn?n("project:noNodeMatch",{query:G.trim()}):n(Re?"project:noMyNodes":"project:noNodes")})}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:n("project:loadingResources")})})}):Qt?o.jsx("div",{className:"af-resource-grid",children:Mn.length>0?Mn.map(V=>{const fe=u_(V),Te=d_(V),Ae=Number.isFinite(Number(V.nodeCount))?Number(V.nodeCount):fe.length,Ge=Number.isFinite(Number(V.edgeCount))?Number(V.edgeCount):Te.length;return o.jsxs("button",{type:"button",className:"af-resource-card"+(Ht&&ra(V)===ra(Ht)?" af-resource-card--active":""),onClick:()=>Pe(ra(V)),children:[o.jsxs("div",{className:"af-resource-card-head",children:[o.jsx("span",{className:Uu("primary"),children:o.jsx(Jn,{query:G,children:V.version?`v${V.version}`:"flow"})}),o.jsx("span",{className:"af-resource-source",children:n("project:flowSnippet")})]}),o.jsx("h3",{className:"af-project-title",children:o.jsx(Jn,{query:G,children:V.displayName||V.name||V.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(Jn,{query:G,children:V.description||n("project:noDescription")})}),o.jsxs("div",{className:"af-resource-meta-row",children:[o.jsx("span",{children:n("project:flowSnippetNodes",{nodes:Ae,edges:Ge})}),o.jsx("span",{children:o.jsx(Jn,{query:G,children:V.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(Jn,{query:G,children:Tk(V)})})]})]},ra(V))}):F?o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:Zn?n("project:noFlowSnippetMatch",{query:G.trim()}):n("project:noMyFlows")})}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:n("project:loadingResources")})})}):i==="skills"?o.jsx("div",{className:"af-resource-grid",children:Un.length>0?Un.map(V=>o.jsxs("button",{type:"button",className:"af-resource-card"+(Kt&&Rn(V)===Rn(Kt)?" af-resource-card--active":""),onClick:()=>Pe(Rn(V)),children:[o.jsxs("div",{className:"af-resource-card-head",children:[o.jsx("span",{className:Uu(V.source==="builtin"?"muted":"primary"),children:o.jsx(Jn,{query:G,children:V.sourceLabel||V.source||"skill"})}),o.jsx("span",{className:"af-resource-source",children:n("project:skill")})]}),o.jsx("h3",{className:"af-project-title",children:o.jsx(Jn,{query:G,children:V.name||V.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(Jn,{query:G,children:V.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(Jn,{query:G,children:V.path||V.key||""})})]}),o.jsxs("div",{className:"af-skill-card-collections",children:[v.filter(fe=>fe.skillKeys.includes(Rn(V))).slice(0,3).map(fe=>o.jsx("span",{children:fe.name},fe.id)),v.filter(fe=>fe.skillKeys.includes(Rn(V))).length===0?o.jsx("span",{className:"af-skill-card-collection-empty",children:"未分组"}):null]})]},V.key||`${V.source}:${V.name}`)):F?o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:Zn?n("project:noSkillMatch",{query:G.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&&i==="all"&&ni.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:ni.map(V=>{const fe=Wn===`show-builtin:builtin:${V}`;return o.jsxs("button",{type:"button",disabled:fe,onClick:()=>ke({id:V,source:"builtin"},"show-builtin"),children:[o.jsx("span",{children:V}),o.jsx("em",{children:fe?"恢复中":"恢复"})]},V)})})]}):null,o.jsxs("div",{className:"af-project-grid",children:[Ai.length>0?Ai.map(V=>{const fe=(t==null?void 0:t.isAdmin)&&V.source==="user"&&!V.archived&&!mo.has(V.id),Te=(t==null?void 0:t.isAdmin)&&V.source==="admin",Ae=(t==null?void 0:t.isAdmin)&&V.source==="builtin",Ge=Wn.endsWith(`:${V.source}:${V.id}`);return o.jsx("div",{className:"af-project-card",role:"button",tabIndex:0,onClick:()=>go(V),onKeyDown:$t=>{($t.key==="Enter"||$t.key===" ")&&($t.preventDefault(),go(V))},children:o.jsxs("div",{className:"af-project-card-body",children:[o.jsx("span",{className:Uu(nw(V.source,n).tone),children:o.jsx(Jn,{query:G,children:nw(V.source,n).label})}),V.archived?o.jsx("span",{className:Uu("muted"),children:o.jsx(Jn,{query:G,children:n("project:archived")})}):null,o.jsx("h3",{className:"af-project-title",children:o.jsx(Jn,{query:G,children:V.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(Jn,{query:G,children:l_(V,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(Jn,{query:G,children:a_(V)})})]}),t!=null&&t.isAdmin?o.jsxs("div",{className:"af-project-admin-actions",onClick:$t=>$t.stopPropagation(),onKeyDown:$t=>$t.stopPropagation(),children:[fe?o.jsx("button",{type:"button",disabled:Ge,onClick:()=>ke(V,"promote"),children:"设为内置"}):null,Te?o.jsx("button",{type:"button",disabled:Ge,onClick:()=>ke(V,"unpromote"),children:"取消内置"}):null,Ae?o.jsx("button",{type:"button",disabled:Ge,onClick:()=>ke(V,"hide-builtin"),children:"隐藏内置"}):null]}):null]})},`${V.id}:${V.source??"user"}:${V.archived?"a":""}`)}):$?vs.length===0?o.jsxs("div",{className:"af-projects-empty-block",children:[o.jsx("p",{className:"af-projects-empty",children:i==="archived"?n("project:noArchived"):l.length>0?n("project:noActive"):n(R?"project:loadFailed":"project:noPipelines")}),!R&&l.length===0&&i==="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:G.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:()=>I(!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")})]}),cr?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")})]})]})]})]}),ks?o.jsx("aside",{className:"af-resource-detail","aria-label":n(Vn?"project:nodeDetail":Qt?"project:flowDetail":"project:skillDetail"),children:Vn&&at?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:at.label||at.displayName||at.id}),o.jsx("p",{children:at.id})]})]}),o.jsx("div",{className:"af-resource-detail-tabs",children:["overview","schema","runtime","files","usage"].map(V=>o.jsx("button",{type:"button",className:"af-resource-detail-tab"+(be===V?" af-resource-detail-tab--active":""),onClick:()=>Ie(V),children:n(`project:nodeDetailTabs.${V}`)},V))}),mt===Rn(at)?o.jsx("p",{className:"af-resource-detail-desc",children:n("project:loadingResources")}):be==="overview"?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"af-resource-detail-desc",children:at.description||((si=Ye==null?void 0:Ye.node)==null?void 0:si.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:at.type||((tn=Ye==null?void 0:Ye.node)==null?void 0:tn.type)||"node"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailSource")}),o.jsx("dd",{children:Ik(at.source,n)})]}),at.packageId?o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPackage")}),o.jsx("dd",{children:at.packageId})]}):null,at.version?o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailVersion")}),o.jsx("dd",{children:at.version})]}):null,at.packageDir||Ye!=null&&Ye.baseDir?o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPath")}),o.jsx("dd",{children:at.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")})]})]}),Re&&at.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:ve===Rn(at),onClick:()=>Xr(at),children:[o.jsx("span",{className:"material-symbols-outlined",children:"delete"}),ve===Rn(at)?n("project:deletingMyNode"):n("project:deleteMyNode")]}),ge?o.jsx("p",{className:"af-resource-action-message",children:ge}):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")})]})]}):be==="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")}),Sp(((Ns=Ye==null?void 0:Ye.node)==null?void 0:Ns.inputs)||at.inputs).length>0?Sp(((ii=Ye==null?void 0:Ye.node)==null?void 0:ii.inputs)||at.inputs).map(V=>o.jsxs("code",{children:[V.name||V.key,V.type?`: ${V.type}`:""]},V.key)):o.jsx("em",{children:n("project:noSlots")})]}),o.jsxs("div",{className:"af-resource-slot-group",children:[o.jsx("span",{children:n("project:nodeOutputs")}),Sp(((Tr=Ye==null?void 0:Ye.node)==null?void 0:Tr.outputs)||at.outputs).length>0?Sp(((Sr=Ye==null?void 0:Ye.node)==null?void 0:Sr.outputs)||at.outputs).map(V=>o.jsxs("code",{children:[V.name||V.key,V.type?`: ${V.type}`:""]},V.key)):o.jsx("em",{children:n("project:noSlots")})]})]}):be==="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")})]}):be==="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(V=>o.jsxs("button",{type:"button",className:"af-node-file-item"+(De===V.path?" af-node-file-item--active":""),onClick:()=>en(V.path),children:[o.jsx("span",{className:"material-symbols-outlined",children:"description"}),o.jsx("span",{children:V.path})]},V.path))}),o.jsxs("pre",{className:"af-resource-skill-preview",children:[Hn===`${Rn(at)}:${De}`?n("project:loadingResources"):tr!=null&&tr.binary?n("project:binaryFile"):(tr==null?void 0:tr.content)||n("project:selectNodeFile"),tr!=null&&tr.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(V=>o.jsxs("div",{className:"af-node-usage-item",children:[o.jsx("strong",{children:V.flowId}),o.jsxs("span",{children:[V.flowSource,V.archived?` · ${n("project:archived")}`:""]}),o.jsx("em",{children:V.instances.map(fe=>fe.label||fe.instanceId).join(", ")})]},`${V.flowSource}:${V.flowId}:${V.archived?"a":""}`))}):o.jsx("p",{children:n("project:noNodeUsage")})]})]}):Qt&&Ht?(()=>{const V=HM(Ht);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:Ht.displayName||Ht.name||Ht.id}),o.jsx("p",{children:Ht.id})]})]}),o.jsx("p",{className:"af-resource-detail-desc",children:Ht.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:Ht.version||"1.0.0"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPath")}),o.jsx("dd",{children:Tk(Ht)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:flowSnippetScale")}),o.jsx("dd",{children:n("project:flowSnippetNodes",{nodes:Number.isFinite(Number(Ht.nodeCount))?Number(Ht.nodeCount):V.nodes.length,edges:Number.isFinite(Number(Ht.edgeCount))?Number(Ht.edgeCount):V.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:Bt===ra(Ht),onClick:()=>bs(Ht),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"delete"}),Bt===ra(Ht)?n("project:deletingMyFlow"):n("project:deleteMyFlow")]}),In?o.jsx("p",{className:"af-resource-action-message",children:In}):null]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:n("project:flowSnippetPreview")}),V.diagram.nodes.length>0?o.jsx("div",{className:"af-flow-snippet-map",children:o.jsxs("svg",{viewBox:V.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:V.diagram.edges.map(fe=>o.jsxs("g",{children:[o.jsx("path",{d:fe.path}),fe.label?o.jsx("text",{x:fe.labelX,y:fe.labelY-5,textAnchor:"middle",children:py(fe.label,18)}):null]},fe.key))}),o.jsx("g",{className:"af-flow-snippet-map__nodes",children:V.diagram.nodes.map((fe,Te)=>o.jsxs("g",{transform:`translate(${fe.x} ${fe.y})`,children:[o.jsx("rect",{width:fe.width,height:fe.height,rx:"10"}),o.jsx("circle",{cx:"19",cy:fe.height/2,r:"12"}),o.jsx("text",{className:"af-flow-snippet-map__node-index",x:"19",y:fe.height/2+4,textAnchor:"middle",children:Te+1}),o.jsx("text",{className:"af-flow-snippet-map__node-title",x:"40",y:fe.height/2-3,children:py(fe.title)}),o.jsx("text",{className:"af-flow-snippet-map__node-meta",x:"40",y:fe.height/2+16,children:py(fe.meta||fe.id,20)})]},fe.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(Ht.snippet||{},null,2)})]})]})]})})():i==="skills"&&Kt?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:Kt.name||Kt.id}),o.jsx("p",{children:Kt.sourceLabel||Kt.source})]})]}),o.jsx("p",{className:"af-resource-detail-desc",children:Kt.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:Kt.sourceLabel||Kt.source})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPath")}),o.jsx("dd",{children:Kt.path||Kt.key})]})]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:"Collections"}),v.length===0?o.jsx("p",{children:"暂无 collection。可在左侧新建后再添加。"}):o.jsx("div",{className:"af-skill-detail-collections",children:v.map(V=>{const fe=Rn(Kt),Te=V.skillKeys.includes(fe);return o.jsxs("label",{className:"af-composer-skill-option af-skill-detail-collection-option",children:[o.jsx("input",{type:"checkbox",checked:Te,disabled:w,onChange:Ae=>Gr(V.id,fe,Ae.target.checked)}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:V.name}),o.jsxs("span",{className:"af-composer-skill-option-desc",children:[V.skillKeys.length," skills"]})]})]},V.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:st===Rn(Kt)?n("project:loadingResources"):(jn==null?void 0:jn.body)||(jn==null?void 0:jn.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"+(U?"":" af-activity--hidden"),"aria-hidden":!U,"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:Wo.length===0?o.jsx("p",{className:"af-activity-empty",children:vr.length===0?n("project:noRecentActivity"):n("project:noMatchRecent")}):Wo.map(V=>{const fe=ue===Rk(V);return o.jsxs("button",{type:"button",className:"af-activity-row af-activity-row--action"+(fe?" af-activity-row--active":""),"aria-current":fe?"page":void 0,onClick:()=>kr(V),children:[o.jsxs("div",{className:"af-activity-row-top",children:[o.jsx("h4",{className:"af-activity-name",children:o.jsx(Jn,{query:G,children:V.flowId})}),o.jsx("span",{className:"af-activity-time",children:Qx(V.at,n)})]}),o.jsxs("div",{className:"af-activity-meta",children:[o.jsx("span",{className:_M(V.kind),children:V.kind==="executed"?"play_arrow":"visibility"}),o.jsxs("p",{className:"af-activity-text",children:[V.kind==="executed"?n("project:recentRun"):n("project:recentOpen")," · ",Qx(V.at,n)]})]})]},`${V.kind}-${V.flowId}-${V.flowSource}-${V.at}`)})})]})]}),o.jsx(wM,{open:O,onClose:()=>I(!1),onCreated:async V=>{I(!1),await re();const fe=V.source??"user";r(kp({id:V.id,source:fe},"workspace"))}}),B?o.jsx(yM,{file:B,onClose:()=>P(null),onImported:async V=>{P(null),await re();const fe=V.source??"user";r(kp({id:V.id,source:fe},"workspace"))}},`${B.name}-${B.size}-${B.lastModified}`):null]})}function lr(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=lr(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var WM={value:()=>{}};function Wm(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new ah(n)}function ah(e){this._=e}function VM(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}})}ah.prototype=Wm.prototype={constructor:ah,on:function(e,t){var n=this._,r=VM(e+"",n),s,i=-1,a=r.length;if(arguments.length<2){for(;++i<a;)if((s=(e=r[i]).type)&&(s=UM(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]=Mk(n[s],e.name,t);else if(t==null)for(s in n)n[s]=Mk(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 ah(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 UM(e,t){for(var n=0,r=e.length,s;n<r;++n)if((s=e[n]).name===t)return s.value}function Mk(e,t,n){for(var r=0,s=e.length;r<s;++r)if(e[r].name===t){e[r]=WM,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var iw="http://www.w3.org/1999/xhtml";const $k={svg:"http://www.w3.org/2000/svg",xhtml:iw,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Vm(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),$k.hasOwnProperty(t)?{space:$k[t],local:e}:e}function KM(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===iw&&t.documentElement.namespaceURI===iw?t.createElement(e):t.createElementNS(n,e)}}function qM(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function f_(e){var t=Vm(e);return(t.local?qM:KM)(t)}function YM(){}function Ub(e){return e==null?YM:function(){return this.querySelector(e)}}function GM(e){typeof e!="function"&&(e=Ub(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),u,d,f=0;f<a;++f)(u=i[f])&&(d=e.call(u,u.__data__,f,i))&&("__data__"in u&&(d.__data__=u.__data__),l[f]=d);return new Ms(r,this._parents)}function XM(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function JM(){return[]}function p_(e){return e==null?JM:function(){return this.querySelectorAll(e)}}function QM(e){return function(){return XM(e.apply(this,arguments))}}function ZM(e){typeof e=="function"?e=QM(e):e=p_(e);for(var t=this._groups,n=t.length,r=[],s=[],i=0;i<n;++i)for(var a=t[i],l=a.length,u,d=0;d<l;++d)(u=a[d])&&(r.push(e.call(u,u.__data__,d,a)),s.push(u));return new Ms(r,s)}function h_(e){return function(){return this.matches(e)}}function m_(e){return function(t){return t.matches(e)}}var e$=Array.prototype.find;function t$(e){return function(){return e$.call(this.children,e)}}function n$(){return this.firstElementChild}function r$(e){return this.select(e==null?n$:t$(typeof e=="function"?e:m_(e)))}var s$=Array.prototype.filter;function i$(){return Array.from(this.children)}function o$(e){return function(){return s$.call(this.children,e)}}function a$(e){return this.selectAll(e==null?i$:o$(typeof e=="function"?e:m_(e)))}function l$(e){typeof e!="function"&&(e=h_(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]=[],u,d=0;d<a;++d)(u=i[d])&&e.call(u,u.__data__,d,i)&&l.push(u);return new Ms(r,this._parents)}function g_(e){return new Array(e.length)}function c$(){return new Ms(this._enter||this._groups.map(g_),this._parents)}function Vh(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Vh.prototype={constructor:Vh,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 u$(e){return function(){return e}}function d$(e,t,n,r,s,i){for(var a=0,l,u=t.length,d=i.length;a<d;++a)(l=t[a])?(l.__data__=i[a],r[a]=l):n[a]=new Vh(e,i[a]);for(;a<u;++a)(l=t[a])&&(s[a]=l)}function f$(e,t,n,r,s,i,a){var l,u,d=new Map,f=t.length,c=i.length,p=new Array(f),h;for(l=0;l<f;++l)(u=t[l])&&(p[l]=h=a.call(u,u.__data__,l,t)+"",d.has(h)?s[l]=u:d.set(h,u));for(l=0;l<c;++l)h=a.call(e,i[l],l,i)+"",(u=d.get(h))?(r[l]=u,u.__data__=i[l],d.delete(h)):n[l]=new Vh(e,i[l]);for(l=0;l<f;++l)(u=t[l])&&d.get(p[l])===u&&(s[l]=u)}function p$(e){return e.__data__}function h$(e,t){if(!arguments.length)return Array.from(this,p$);var n=t?f$:d$,r=this._parents,s=this._groups;typeof e!="function"&&(e=u$(e));for(var i=s.length,a=new Array(i),l=new Array(i),u=new Array(i),d=0;d<i;++d){var f=r[d],c=s[d],p=c.length,h=m$(e.call(f,f&&f.__data__,d,r)),g=h.length,v=l[d]=new Array(g),k=a[d]=new Array(g),y=u[d]=new Array(p);n(f,c,v,k,y,h,t);for(var b=0,w=0,N,C;b<g;++b)if(N=v[b]){for(b>=w&&(w=b+1);!(C=k[w])&&++w<g;);N._next=C||null}}return a=new Ms(a,r),a._enter=l,a._exit=u,a}function m$(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function g$(){return new Ms(this._exit||this._groups.map(g_),this._parents)}function y$(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 x$(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),u=0;u<a;++u)for(var d=n[u],f=r[u],c=d.length,p=l[u]=new Array(c),h,g=0;g<c;++g)(h=d[g]||f[g])&&(p[g]=h);for(;u<s;++u)l[u]=n[u];return new Ms(l,this._parents)}function w$(){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 b$(e){e||(e=v$);function t(c,p){return c&&p?e(c.__data__,p.__data__):!c-!p}for(var n=this._groups,r=n.length,s=new Array(r),i=0;i<r;++i){for(var a=n[i],l=a.length,u=s[i]=new Array(l),d,f=0;f<l;++f)(d=a[f])&&(u[f]=d);u.sort(t)}return new Ms(s,this._parents).order()}function v$(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function k$(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function S$(){return Array.from(this)}function N$(){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 j$(){let e=0;for(const t of this)++e;return e}function C$(){return!this.node()}function E$(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 _$(e){return function(){this.removeAttribute(e)}}function P$(e){return function(){this.removeAttributeNS(e.space,e.local)}}function A$(e,t){return function(){this.setAttribute(e,t)}}function I$(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function T$(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function R$(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 L$(e,t){var n=Vm(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?P$:_$:typeof t=="function"?n.local?R$:T$:n.local?I$:A$)(n,t))}function y_(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function O$(e){return function(){this.style.removeProperty(e)}}function M$(e,t,n){return function(){this.style.setProperty(e,t,n)}}function $$(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function D$(e,t,n){return arguments.length>1?this.each((t==null?O$:typeof t=="function"?$$:M$)(e,t,n??"")):Xc(this.node(),e)}function Xc(e,t){return e.style.getPropertyValue(t)||y_(e).getComputedStyle(e,null).getPropertyValue(t)}function F$(e){return function(){delete this[e]}}function z$(e,t){return function(){this[e]=t}}function B$(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function H$(e,t){return arguments.length>1?this.each((t==null?F$:typeof t=="function"?B$:z$)(e,t)):this.node()[e]}function x_(e){return e.trim().split(/^|\s+/)}function Kb(e){return e.classList||new w_(e)}function w_(e){this._node=e,this._names=x_(e.getAttribute("class")||"")}w_.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 b_(e,t){for(var n=Kb(e),r=-1,s=t.length;++r<s;)n.add(t[r])}function v_(e,t){for(var n=Kb(e),r=-1,s=t.length;++r<s;)n.remove(t[r])}function W$(e){return function(){b_(this,e)}}function V$(e){return function(){v_(this,e)}}function U$(e,t){return function(){(t.apply(this,arguments)?b_:v_)(this,e)}}function K$(e,t){var n=x_(e+"");if(arguments.length<2){for(var r=Kb(this.node()),s=-1,i=n.length;++s<i;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof t=="function"?U$:t?W$:V$)(n,t))}function q$(){this.textContent=""}function Y$(e){return function(){this.textContent=e}}function G$(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function X$(e){return arguments.length?this.each(e==null?q$:(typeof e=="function"?G$:Y$)(e)):this.node().textContent}function J$(){this.innerHTML=""}function Q$(e){return function(){this.innerHTML=e}}function Z$(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function eD(e){return arguments.length?this.each(e==null?J$:(typeof e=="function"?Z$:Q$)(e)):this.node().innerHTML}function tD(){this.nextSibling&&this.parentNode.appendChild(this)}function nD(){return this.each(tD)}function rD(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function sD(){return this.each(rD)}function iD(e){var t=typeof e=="function"?e:f_(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function oD(){return null}function aD(e,t){var n=typeof e=="function"?e:f_(e),r=t==null?oD:typeof t=="function"?t:Ub(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function lD(){var e=this.parentNode;e&&e.removeChild(this)}function cD(){return this.each(lD)}function uD(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function dD(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function fD(e){return this.select(e?dD:uD)}function pD(e){return arguments.length?this.property("__data__",e):this.node().__data__}function hD(e){return function(t){e.call(this,t,this.__data__)}}function mD(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 gD(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 yD(e,t,n){return function(){var r=this.__on,s,i=hD(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 xD(e,t,n){var r=mD(e+""),s,i=r.length,a;if(arguments.length<2){var l=this.node().__on;if(l){for(var u=0,d=l.length,f;u<d;++u)for(s=0,f=l[u];s<i;++s)if((a=r[s]).type===f.type&&a.name===f.name)return f.value}return}for(l=t?yD:gD,s=0;s<i;++s)this.each(l(r[s],t,n));return this}function k_(e,t,n){var r=y_(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 wD(e,t){return function(){return k_(this,e,t)}}function bD(e,t){return function(){return k_(this,e,t.apply(this,arguments))}}function vD(e,t){return this.each((typeof t=="function"?bD:wD)(e,t))}function*kD(){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 S_=[null];function Ms(e,t){this._groups=e,this._parents=t}function Nf(){return new Ms([[document.documentElement]],S_)}function SD(){return this}Ms.prototype=Nf.prototype={constructor:Ms,select:GM,selectAll:ZM,selectChild:r$,selectChildren:a$,filter:l$,data:h$,enter:c$,exit:g$,join:y$,merge:x$,selection:SD,order:w$,sort:b$,call:k$,nodes:S$,node:N$,size:j$,empty:C$,each:E$,attr:L$,style:D$,property:H$,classed:K$,text:X$,html:eD,raise:nD,lower:sD,append:iD,insert:aD,remove:cD,clone:fD,datum:pD,on:xD,dispatch:vD,[Symbol.iterator]:kD};function As(e){return typeof e=="string"?new Ms([[document.querySelector(e)]],[document.documentElement]):new Ms([[e]],S_)}function ND(e){let t;for(;t=e.sourceEvent;)e=t;return e}function yi(e,t){if(e=ND(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 jD={passive:!1},Gd={capture:!0,passive:!1};function hy(e){e.stopImmediatePropagation()}function Dc(e){e.preventDefault(),e.stopImmediatePropagation()}function N_(e){var t=e.document.documentElement,n=As(e).on("dragstart.drag",Dc,Gd);"onselectstart"in t?n.on("selectstart.drag",Dc,Gd):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function j_(e,t){var n=e.document.documentElement,r=As(e).on("dragstart.drag",null);t&&(r.on("click.drag",Dc,Gd),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 Np=e=>()=>e;function ow(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:i,x:a,y:l,dx:u,dy:d,dispatch:f}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:f}})}ow.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function CD(e){return!e.ctrlKey&&!e.button}function ED(){return this.parentNode}function _D(e,t){return t??{x:e.x,y:e.y}}function PD(){return navigator.maxTouchPoints||"ontouchstart"in this}function C_(){var e=CD,t=ED,n=_D,r=PD,s={},i=Wm("start","drag","end"),a=0,l,u,d,f,c=0;function p(N){N.on("mousedown.drag",h).filter(r).on("touchstart.drag",k).on("touchmove.drag",y,jD).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(N,C){if(!(f||!e.call(this,N,C))){var j=w(this,t.call(this,N,C),N,C,"mouse");j&&(As(N.view).on("mousemove.drag",g,Gd).on("mouseup.drag",v,Gd),N_(N.view),hy(N),d=!1,l=N.clientX,u=N.clientY,j("start",N))}}function g(N){if(Dc(N),!d){var C=N.clientX-l,j=N.clientY-u;d=C*C+j*j>c}s.mouse("drag",N)}function v(N){As(N.view).on("mousemove.drag mouseup.drag",null),j_(N.view,d),Dc(N),s.mouse("end",N)}function k(N,C){if(e.call(this,N,C)){var j=N.changedTouches,R=t.call(this,N,C),D=j.length,M,z;for(M=0;M<D;++M)(z=w(this,R,N,C,j[M].identifier,j[M]))&&(hy(N),z("start",N,j[M]))}}function y(N){var C=N.changedTouches,j=C.length,R,D;for(R=0;R<j;++R)(D=s[C[R].identifier])&&(Dc(N),D("drag",N,C[R]))}function b(N){var C=N.changedTouches,j=C.length,R,D;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),R=0;R<j;++R)(D=s[C[R].identifier])&&(hy(N),D("end",N,C[R]))}function w(N,C,j,R,D,M){var z=i.copy(),$=yi(M||j,C),A,F,T;if((T=n.call(N,new ow("beforestart",{sourceEvent:j,target:p,identifier:D,active:a,x:$[0],y:$[1],dx:0,dy:0,dispatch:z}),R))!=null)return A=T.x-$[0]||0,F=T.y-$[1]||0,function O(I,B,P){var L=$,_;switch(I){case"start":s[D]=O,_=a++;break;case"end":delete s[D],--a;case"drag":$=yi(P||B,C),_=a;break}z.call(I,N,new ow(I,{sourceEvent:B,subject:T,target:p,identifier:D,active:_,x:$[0]+A,y:$[1]+F,dx:$[0]-L[0],dy:$[1]-L[1],dispatch:z}),R)}}return p.filter=function(N){return arguments.length?(e=typeof N=="function"?N:Np(!!N),p):e},p.container=function(N){return arguments.length?(t=typeof N=="function"?N:Np(N),p):t},p.subject=function(N){return arguments.length?(n=typeof N=="function"?N:Np(N),p):n},p.touchable=function(N){return arguments.length?(r=typeof N=="function"?N:Np(!!N),p):r},p.on=function(){var N=i.on.apply(i,arguments);return N===i?p:N},p.clickDistance=function(N){return arguments.length?(c=(N=+N)*N,p):Math.sqrt(c)},p}function qb(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function E_(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function jf(){}var Xd=.7,Uh=1/Xd,Fc="\\s*([+-]?\\d+)\\s*",Jd="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",oo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",AD=/^#([0-9a-f]{3,8})$/,ID=new RegExp(`^rgb\\(${Fc},${Fc},${Fc}\\)$`),TD=new RegExp(`^rgb\\(${oo},${oo},${oo}\\)$`),RD=new RegExp(`^rgba\\(${Fc},${Fc},${Fc},${Jd}\\)$`),LD=new RegExp(`^rgba\\(${oo},${oo},${oo},${Jd}\\)$`),OD=new RegExp(`^hsl\\(${Jd},${oo},${oo}\\)$`),MD=new RegExp(`^hsla\\(${Jd},${oo},${oo},${Jd}\\)$`),Dk={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};qb(jf,Al,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Fk,formatHex:Fk,formatHex8:$D,formatHsl:DD,formatRgb:zk,toString:zk});function Fk(){return this.rgb().formatHex()}function $D(){return this.rgb().formatHex8()}function DD(){return __(this).formatHsl()}function zk(){return this.rgb().formatRgb()}function Al(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=AD.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Bk(t):n===3?new cs(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?jp(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?jp(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=ID.exec(e))?new cs(t[1],t[2],t[3],1):(t=TD.exec(e))?new cs(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=RD.exec(e))?jp(t[1],t[2],t[3],t[4]):(t=LD.exec(e))?jp(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=OD.exec(e))?Vk(t[1],t[2]/100,t[3]/100,1):(t=MD.exec(e))?Vk(t[1],t[2]/100,t[3]/100,t[4]):Dk.hasOwnProperty(e)?Bk(Dk[e]):e==="transparent"?new cs(NaN,NaN,NaN,0):null}function Bk(e){return new cs(e>>16&255,e>>8&255,e&255,1)}function jp(e,t,n,r){return r<=0&&(e=t=n=NaN),new cs(e,t,n,r)}function FD(e){return e instanceof jf||(e=Al(e)),e?(e=e.rgb(),new cs(e.r,e.g,e.b,e.opacity)):new cs}function aw(e,t,n,r){return arguments.length===1?FD(e):new cs(e,t,n,r??1)}function cs(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}qb(cs,aw,E_(jf,{brighter(e){return e=e==null?Uh:Math.pow(Uh,e),new cs(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Xd:Math.pow(Xd,e),new cs(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new cs(vl(this.r),vl(this.g),vl(this.b),Kh(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:Hk,formatHex:Hk,formatHex8:zD,formatRgb:Wk,toString:Wk}));function Hk(){return`#${xl(this.r)}${xl(this.g)}${xl(this.b)}`}function zD(){return`#${xl(this.r)}${xl(this.g)}${xl(this.b)}${xl((isNaN(this.opacity)?1:this.opacity)*255)}`}function Wk(){const e=Kh(this.opacity);return`${e===1?"rgb(":"rgba("}${vl(this.r)}, ${vl(this.g)}, ${vl(this.b)}${e===1?")":`, ${e})`}`}function Kh(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function vl(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function xl(e){return e=vl(e),(e<16?"0":"")+e.toString(16)}function Vk(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new bi(e,t,n,r)}function __(e){if(e instanceof bi)return new bi(e.h,e.s,e.l,e.opacity);if(e instanceof jf||(e=Al(e)),!e)return new bi;if(e instanceof bi)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,u=(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/=u<.5?i+s:2-i-s,a*=60):l=u>0&&u<1?0:a,new bi(a,l,u,e.opacity)}function BD(e,t,n,r){return arguments.length===1?__(e):new bi(e,t,n,r??1)}function bi(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}qb(bi,BD,E_(jf,{brighter(e){return e=e==null?Uh:Math.pow(Uh,e),new bi(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Xd:Math.pow(Xd,e),new bi(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 cs(my(e>=240?e-240:e+120,s,r),my(e,s,r),my(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new bi(Uk(this.h),Cp(this.s),Cp(this.l),Kh(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=Kh(this.opacity);return`${e===1?"hsl(":"hsla("}${Uk(this.h)}, ${Cp(this.s)*100}%, ${Cp(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Uk(e){return e=(e||0)%360,e<0?e+360:e}function Cp(e){return Math.max(0,Math.min(1,e||0))}function my(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 Yb=e=>()=>e;function HD(e,t){return function(n){return e+n*t}}function WD(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 VD(e){return(e=+e)==1?P_:function(t,n){return n-t?WD(t,n,e):Yb(isNaN(t)?n:t)}}function P_(e,t){var n=t-e;return n?HD(e,n):Yb(isNaN(e)?t:e)}const qh=function e(t){var n=VD(t);function r(s,i){var a=n((s=aw(s)).r,(i=aw(i)).r),l=n(s.g,i.g),u=n(s.b,i.b),d=P_(s.opacity,i.opacity);return function(f){return s.r=a(f),s.g=l(f),s.b=u(f),s.opacity=d(f),s+""}}return r.gamma=e,r}(1);function UD(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 KD(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function qD(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]=kd(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 YD(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Qi(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function GD(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]=kd(e[s],t[s]):r[s]=t[s];return function(i){for(s in n)r[s]=n[s](i);return r}}var lw=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,gy=new RegExp(lw.source,"g");function XD(e){return function(){return e}}function JD(e){return function(t){return e(t)+""}}function A_(e,t){var n=lw.lastIndex=gy.lastIndex=0,r,s,i,a=-1,l=[],u=[];for(e=e+"",t=t+"";(r=lw.exec(e))&&(s=gy.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,u.push({i:a,x:Qi(r,s)})),n=gy.lastIndex;return n<t.length&&(i=t.slice(n),l[a]?l[a]+=i:l[++a]=i),l.length<2?u[0]?JD(u[0].x):XD(t):(t=u.length,function(d){for(var f=0,c;f<t;++f)l[(c=u[f]).i]=c.x(d);return l.join("")})}function kd(e,t){var n=typeof t,r;return t==null||n==="boolean"?Yb(t):(n==="number"?Qi:n==="string"?(r=Al(t))?(t=r,qh):A_:t instanceof Al?qh:t instanceof Date?YD:KD(t)?UD:Array.isArray(t)?qD:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?GD:Qi)(e,t)}var Kk=180/Math.PI,cw={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function I_(e,t,n,r,s,i){var a,l,u;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(u=e*n+t*r)&&(n-=e*u,r-=t*u),(l=Math.sqrt(n*n+r*r))&&(n/=l,r/=l,u/=l),e*r<t*n&&(e=-e,t=-t,u=-u,a=-a),{translateX:s,translateY:i,rotate:Math.atan2(t,e)*Kk,skewX:Math.atan(u)*Kk,scaleX:a,scaleY:l}}var Ep;function QD(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?cw:I_(t.a,t.b,t.c,t.d,t.e,t.f)}function ZD(e){return e==null||(Ep||(Ep=document.createElementNS("http://www.w3.org/2000/svg","g")),Ep.setAttribute("transform",e),!(e=Ep.transform.baseVal.consolidate()))?cw:(e=e.matrix,I_(e.a,e.b,e.c,e.d,e.e,e.f))}function T_(e,t,n,r){function s(d){return d.length?d.pop()+" ":""}function i(d,f,c,p,h,g){if(d!==c||f!==p){var v=h.push("translate(",null,t,null,n);g.push({i:v-4,x:Qi(d,c)},{i:v-2,x:Qi(f,p)})}else(c||p)&&h.push("translate("+c+t+p+n)}function a(d,f,c,p){d!==f?(d-f>180?f+=360:f-d>180&&(d+=360),p.push({i:c.push(s(c)+"rotate(",null,r)-2,x:Qi(d,f)})):f&&c.push(s(c)+"rotate("+f+r)}function l(d,f,c,p){d!==f?p.push({i:c.push(s(c)+"skewX(",null,r)-2,x:Qi(d,f)}):f&&c.push(s(c)+"skewX("+f+r)}function u(d,f,c,p,h,g){if(d!==c||f!==p){var v=h.push(s(h)+"scale(",null,",",null,")");g.push({i:v-4,x:Qi(d,c)},{i:v-2,x:Qi(f,p)})}else(c!==1||p!==1)&&h.push(s(h)+"scale("+c+","+p+")")}return function(d,f){var c=[],p=[];return d=e(d),f=e(f),i(d.translateX,d.translateY,f.translateX,f.translateY,c,p),a(d.rotate,f.rotate,c,p),l(d.skewX,f.skewX,c,p),u(d.scaleX,d.scaleY,f.scaleX,f.scaleY,c,p),d=f=null,function(h){for(var g=-1,v=p.length,k;++g<v;)c[(k=p[g]).i]=k.x(h);return c.join("")}}}var eF=T_(QD,"px, ","px)","deg)"),tF=T_(ZD,", ",")",")"),nF=1e-12;function qk(e){return((e=Math.exp(e))+1/e)/2}function rF(e){return((e=Math.exp(e))-1/e)/2}function sF(e){return((e=Math.exp(2*e))-1)/(e+1)}const lh=function e(t,n,r){function s(i,a){var l=i[0],u=i[1],d=i[2],f=a[0],c=a[1],p=a[2],h=f-l,g=c-u,v=h*h+g*g,k,y;if(v<nF)y=Math.log(p/d)/t,k=function(R){return[l+R*h,u+R*g,d*Math.exp(t*R*y)]};else{var b=Math.sqrt(v),w=(p*p-d*d+r*v)/(2*d*n*b),N=(p*p-d*d-r*v)/(2*p*n*b),C=Math.log(Math.sqrt(w*w+1)-w),j=Math.log(Math.sqrt(N*N+1)-N);y=(j-C)/t,k=function(R){var D=R*y,M=qk(C),z=d/(n*b)*(M*sF(t*D+C)-rF(C));return[l+z*h,u+z*g,d*M/qk(t*D+C)]}}return k.duration=y*1e3*t/Math.SQRT2,k}return s.rho=function(i){var a=Math.max(.001,+i),l=a*a,u=l*l;return e(a,l,u)},s}(Math.SQRT2,2,4);var Jc=0,id=0,Ku=0,R_=1e3,Yh,od,Gh=0,Il=0,Um=0,Qd=typeof performance=="object"&&performance.now?performance:Date,L_=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Gb(){return Il||(L_(iF),Il=Qd.now()+Um)}function iF(){Il=0}function Xh(){this._call=this._time=this._next=null}Xh.prototype=O_.prototype={constructor:Xh,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Gb():+n)+(t==null?0:+t),!this._next&&od!==this&&(od?od._next=this:Yh=this,od=this),this._call=e,this._time=n,uw()},stop:function(){this._call&&(this._call=null,this._time=1/0,uw())}};function O_(e,t,n){var r=new Xh;return r.restart(e,t,n),r}function oF(){Gb(),++Jc;for(var e=Yh,t;e;)(t=Il-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Jc}function Yk(){Il=(Gh=Qd.now())+Um,Jc=id=0;try{oF()}finally{Jc=0,lF(),Il=0}}function aF(){var e=Qd.now(),t=e-Gh;t>R_&&(Um-=t,Gh=e)}function lF(){for(var e,t=Yh,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:Yh=n);od=e,uw(r)}function uw(e){if(!Jc){id&&(id=clearTimeout(id));var t=e-Il;t>24?(e<1/0&&(id=setTimeout(Yk,e-Qd.now()-Um)),Ku&&(Ku=clearInterval(Ku))):(Ku||(Gh=Qd.now(),Ku=setInterval(aF,R_)),Jc=1,L_(Yk))}}function Gk(e,t,n){var r=new Xh;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var cF=Wm("start","end","cancel","interrupt"),uF=[],M_=0,Xk=1,dw=2,ch=3,Jk=4,fw=5,uh=6;function Km(e,t,n,r,s,i){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;dF(e,n,{name:t,index:r,group:s,on:cF,tween:uF,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:M_})}function Xb(e,t){var n=_i(e,t);if(n.state>M_)throw new Error("too late; already scheduled");return n}function po(e,t){var n=_i(e,t);if(n.state>ch)throw new Error("too late; already running");return n}function _i(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function dF(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=O_(i,0,n.time);function i(d){n.state=Xk,n.timer.restart(a,n.delay,n.time),n.delay<=d&&a(d-n.delay)}function a(d){var f,c,p,h;if(n.state!==Xk)return u();for(f in r)if(h=r[f],h.name===n.name){if(h.state===ch)return Gk(a);h.state===Jk?(h.state=uh,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[f]):+f<t&&(h.state=uh,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[f])}if(Gk(function(){n.state===ch&&(n.state=Jk,n.timer.restart(l,n.delay,n.time),l(d))}),n.state=dw,n.on.call("start",e,e.__data__,n.index,n.group),n.state===dw){for(n.state=ch,s=new Array(p=n.tween.length),f=0,c=-1;f<p;++f)(h=n.tween[f].value.call(e,e.__data__,n.index,n.group))&&(s[++c]=h);s.length=c+1}}function l(d){for(var f=d<n.duration?n.ease.call(null,d/n.duration):(n.timer.restart(u),n.state=fw,1),c=-1,p=s.length;++c<p;)s[c].call(e,f);n.state===fw&&(n.on.call("end",e,e.__data__,n.index,n.group),u())}function u(){n.state=uh,n.timer.stop(),delete r[t];for(var d in r)return;delete e.__transition}}function dh(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>dw&&r.state<fw,r.state=uh,r.timer.stop(),r.on.call(s?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[a]}i&&delete e.__transition}}function fF(e){return this.each(function(){dh(this,e)})}function pF(e,t){var n,r;return function(){var s=po(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 hF(e,t,n){var r,s;if(typeof n!="function")throw new Error;return function(){var i=po(this,e),a=i.tween;if(a!==r){s=(r=a).slice();for(var l={name:t,value:n},u=0,d=s.length;u<d;++u)if(s[u].name===t){s[u]=l;break}u===d&&s.push(l)}i.tween=s}}function mF(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=_i(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?pF:hF)(n,e,t))}function Jb(e,t,n){var r=e._id;return e.each(function(){var s=po(this,r);(s.value||(s.value={}))[t]=n.apply(this,arguments)}),function(s){return _i(s,r).value[t]}}function $_(e,t){var n;return(typeof t=="number"?Qi:t instanceof Al?qh:(n=Al(t))?(t=n,qh):A_)(e,t)}function gF(e){return function(){this.removeAttribute(e)}}function yF(e){return function(){this.removeAttributeNS(e.space,e.local)}}function xF(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 wF(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 bF(e,t,n){var r,s,i;return function(){var a,l=n(this),u;return l==null?void this.removeAttribute(e):(a=this.getAttribute(e),u=l+"",a===u?null:a===r&&u===s?i:(s=u,i=t(r=a,l)))}}function vF(e,t,n){var r,s,i;return function(){var a,l=n(this),u;return l==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),u=l+"",a===u?null:a===r&&u===s?i:(s=u,i=t(r=a,l)))}}function kF(e,t){var n=Vm(e),r=n==="transform"?tF:$_;return this.attrTween(e,typeof t=="function"?(n.local?vF:bF)(n,r,Jb(this,"attr."+e,t)):t==null?(n.local?yF:gF)(n):(n.local?wF:xF)(n,r,t))}function SF(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function NF(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function jF(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&NF(e,i)),n}return s._value=t,s}function CF(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&SF(e,i)),n}return s._value=t,s}function EF(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=Vm(e);return this.tween(n,(r.local?jF:CF)(r,t))}function _F(e,t){return function(){Xb(this,e).delay=+t.apply(this,arguments)}}function PF(e,t){return t=+t,function(){Xb(this,e).delay=t}}function AF(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?_F:PF)(t,e)):_i(this.node(),t).delay}function IF(e,t){return function(){po(this,e).duration=+t.apply(this,arguments)}}function TF(e,t){return t=+t,function(){po(this,e).duration=t}}function RF(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?IF:TF)(t,e)):_i(this.node(),t).duration}function LF(e,t){if(typeof t!="function")throw new Error;return function(){po(this,e).ease=t}}function OF(e){var t=this._id;return arguments.length?this.each(LF(t,e)):_i(this.node(),t).ease}function MF(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;po(this,e).ease=n}}function $F(e){if(typeof e!="function")throw new Error;return this.each(MF(this._id,e))}function DF(e){typeof e!="function"&&(e=h_(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]=[],u,d=0;d<a;++d)(u=i[d])&&e.call(u,u.__data__,d,i)&&l.push(u);return new $o(r,this._parents,this._name,this._id)}function FF(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 u=t[l],d=n[l],f=u.length,c=a[l]=new Array(f),p,h=0;h<f;++h)(p=u[h]||d[h])&&(c[h]=p);for(;l<r;++l)a[l]=t[l];return new $o(a,this._parents,this._name,this._id)}function zF(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 BF(e,t,n){var r,s,i=zF(t)?Xb:po;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?_i(this.node(),n).on.on(e):this.each(BF(n,e,t))}function WF(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function VF(){return this.on("end.remove",WF(this._id))}function UF(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Ub(e));for(var r=this._groups,s=r.length,i=new Array(s),a=0;a<s;++a)for(var l=r[a],u=l.length,d=i[a]=new Array(u),f,c,p=0;p<u;++p)(f=l[p])&&(c=e.call(f,f.__data__,p,l))&&("__data__"in f&&(c.__data__=f.__data__),d[p]=c,Km(d[p],t,n,p,d,_i(f,n)));return new $o(i,this._parents,t,n)}function KF(e){var t=this._name,n=this._id;typeof e!="function"&&(e=p_(e));for(var r=this._groups,s=r.length,i=[],a=[],l=0;l<s;++l)for(var u=r[l],d=u.length,f,c=0;c<d;++c)if(f=u[c]){for(var p=e.call(f,f.__data__,c,u),h,g=_i(f,n),v=0,k=p.length;v<k;++v)(h=p[v])&&Km(h,t,n,v,p,g);i.push(p),a.push(f)}return new $o(i,a,t,n)}var qF=Nf.prototype.constructor;function YF(){return new qF(this._groups,this._parents)}function GF(e,t){var n,r,s;return function(){var i=Xc(this,e),a=(this.style.removeProperty(e),Xc(this,e));return i===a?null:i===n&&a===r?s:s=t(n=i,r=a)}}function D_(e){return function(){this.style.removeProperty(e)}}function XF(e,t,n){var r,s=n+"",i;return function(){var a=Xc(this,e);return a===s?null:a===r?i:i=t(r=a,n)}}function JF(e,t,n){var r,s,i;return function(){var a=Xc(this,e),l=n(this),u=l+"";return l==null&&(u=l=(this.style.removeProperty(e),Xc(this,e))),a===u?null:a===r&&u===s?i:(s=u,i=t(r=a,l))}}function QF(e,t){var n,r,s,i="style."+t,a="end."+i,l;return function(){var u=po(this,e),d=u.on,f=u.value[i]==null?l||(l=D_(t)):void 0;(d!==n||s!==f)&&(r=(n=d).copy()).on(a,s=f),u.on=r}}function ZF(e,t,n){var r=(e+="")=="transform"?eF:$_;return t==null?this.styleTween(e,GF(e,r)).on("end.style."+e,D_(e)):typeof t=="function"?this.styleTween(e,JF(e,r,Jb(this,"style."+e,t))).each(QF(this._id,e)):this.styleTween(e,XF(e,r,t),n).on("end.style."+e,null)}function ez(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function tz(e,t,n){var r,s;function i(){var a=t.apply(this,arguments);return a!==s&&(r=(s=a)&&ez(e,a,n)),r}return i._value=t,i}function nz(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,tz(e,t,n??""))}function rz(e){return function(){this.textContent=e}}function sz(e){return function(){var t=e(this);this.textContent=t??""}}function iz(e){return this.tween("text",typeof e=="function"?sz(Jb(this,"text",e)):rz(e==null?"":e+""))}function oz(e){return function(t){this.textContent=e.call(this,t)}}function az(e){var t,n;function r(){var s=e.apply(this,arguments);return s!==n&&(t=(n=s)&&oz(s)),t}return r._value=e,r}function lz(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,az(e))}function cz(){for(var e=this._name,t=this._id,n=F_(),r=this._groups,s=r.length,i=0;i<s;++i)for(var a=r[i],l=a.length,u,d=0;d<l;++d)if(u=a[d]){var f=_i(u,t);Km(u,e,n,d,a,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new $o(r,this._parents,e,n)}function uz(){var e,t,n=this,r=n._id,s=n.size();return new Promise(function(i,a){var l={value:a},u={value:function(){--s===0&&i()}};n.each(function(){var d=po(this,r),f=d.on;f!==e&&(t=(e=f).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(u)),d.on=t}),s===0&&i()})}var dz=0;function $o(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function F_(){return++dz}var vo=Nf.prototype;$o.prototype={constructor:$o,select:UF,selectAll:KF,selectChild:vo.selectChild,selectChildren:vo.selectChildren,filter:DF,merge:FF,selection:YF,transition:cz,call:vo.call,nodes:vo.nodes,node:vo.node,size:vo.size,empty:vo.empty,each:vo.each,on:HF,attr:kF,attrTween:EF,style:ZF,styleTween:nz,text:iz,textTween:lz,remove:VF,tween:mF,delay:AF,duration:RF,ease:OF,easeVarying:$F,end:uz,[Symbol.iterator]:vo[Symbol.iterator]};function fz(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var pz={time:null,delay:0,duration:250,ease:fz};function hz(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 mz(e){var t,n;e instanceof $o?(t=e._id,e=e._name):(t=F_(),(n=pz).time=Gb(),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,u,d=0;d<l;++d)(u=a[d])&&Km(u,e,t,d,a,n||hz(u,t));return new $o(r,this._parents,e,t)}Nf.prototype.interrupt=fF;Nf.prototype.transition=mz;const _p=e=>()=>e;function gz(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 Po(e,t,n){this.k=e,this.x=t,this.y=n}Po.prototype={constructor:Po,scale:function(e){return e===1?this:new Po(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Po(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 qm=new Po(1,0,0);z_.prototype=Po.prototype;function z_(e){for(;!e.__zoom;)if(!(e=e.parentNode))return qm;return e.__zoom}function yy(e){e.stopImmediatePropagation()}function qu(e){e.preventDefault(),e.stopImmediatePropagation()}function yz(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function xz(){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 Qk(){return this.__zoom||qm}function wz(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function bz(){return navigator.maxTouchPoints||"ontouchstart"in this}function vz(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 B_(){var e=yz,t=xz,n=vz,r=wz,s=bz,i=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,u=lh,d=Wm("start","zoom","end"),f,c,p,h=500,g=150,v=0,k=10;function y(T){T.property("__zoom",Qk).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",M).on("dblclick.zoom",z).filter(s).on("touchstart.zoom",$).on("touchmove.zoom",A).on("touchend.zoom touchcancel.zoom",F).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(T,O,I,B){var P=T.selection?T.selection():T;P.property("__zoom",Qk),T!==P?C(T,O,I,B):P.interrupt().each(function(){j(this,arguments).event(B).start().zoom(null,typeof O=="function"?O.apply(this,arguments):O).end()})},y.scaleBy=function(T,O,I,B){y.scaleTo(T,function(){var P=this.__zoom.k,L=typeof O=="function"?O.apply(this,arguments):O;return P*L},I,B)},y.scaleTo=function(T,O,I,B){y.transform(T,function(){var P=t.apply(this,arguments),L=this.__zoom,_=I==null?N(P):typeof I=="function"?I.apply(this,arguments):I,G=L.invert(_),Z=typeof O=="function"?O.apply(this,arguments):O;return n(w(b(L,Z),_,G),P,a)},I,B)},y.translateBy=function(T,O,I,B){y.transform(T,function(){return n(this.__zoom.translate(typeof O=="function"?O.apply(this,arguments):O,typeof I=="function"?I.apply(this,arguments):I),t.apply(this,arguments),a)},null,B)},y.translateTo=function(T,O,I,B,P){y.transform(T,function(){var L=t.apply(this,arguments),_=this.__zoom,G=B==null?N(L):typeof B=="function"?B.apply(this,arguments):B;return n(qm.translate(G[0],G[1]).scale(_.k).translate(typeof O=="function"?-O.apply(this,arguments):-O,typeof I=="function"?-I.apply(this,arguments):-I),L,a)},B,P)};function b(T,O){return O=Math.max(i[0],Math.min(i[1],O)),O===T.k?T:new Po(O,T.x,T.y)}function w(T,O,I){var B=O[0]-I[0]*T.k,P=O[1]-I[1]*T.k;return B===T.x&&P===T.y?T:new Po(T.k,B,P)}function N(T){return[(+T[0][0]+ +T[1][0])/2,(+T[0][1]+ +T[1][1])/2]}function C(T,O,I,B){T.on("start.zoom",function(){j(this,arguments).event(B).start()}).on("interrupt.zoom end.zoom",function(){j(this,arguments).event(B).end()}).tween("zoom",function(){var P=this,L=arguments,_=j(P,L).event(B),G=t.apply(P,L),Z=I==null?N(G):typeof I=="function"?I.apply(P,L):I,U=Math.max(G[1][0]-G[0][0],G[1][1]-G[0][1]),se=P.__zoom,ue=typeof O=="function"?O.apply(P,L):O,de=u(se.invert(Z).concat(U/se.k),ue.invert(Z).concat(U/ue.k));return function(me){if(me===1)me=ue;else{var ae=de(me),Ne=U/ae[2];me=new Po(Ne,Z[0]-ae[0]*Ne,Z[1]-ae[1]*Ne)}_.zoom(null,me)}})}function j(T,O,I){return!I&&T.__zooming||new R(T,O)}function R(T,O){this.that=T,this.args=O,this.active=0,this.sourceEvent=null,this.extent=t.apply(T,O),this.taps=0}R.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,O){return this.mouse&&T!=="mouse"&&(this.mouse[1]=O.invert(this.mouse[0])),this.touch0&&T!=="touch"&&(this.touch0[1]=O.invert(this.touch0[0])),this.touch1&&T!=="touch"&&(this.touch1[1]=O.invert(this.touch1[0])),this.that.__zoom=O,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(T){var O=As(this.that).datum();d.call(T,this.that,new gz(T,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:d}),O)}};function D(T,...O){if(!e.apply(this,arguments))return;var I=j(this,O).event(T),B=this.__zoom,P=Math.max(i[0],Math.min(i[1],B.k*Math.pow(2,r.apply(this,arguments)))),L=yi(T);if(I.wheel)(I.mouse[0][0]!==L[0]||I.mouse[0][1]!==L[1])&&(I.mouse[1]=B.invert(I.mouse[0]=L)),clearTimeout(I.wheel);else{if(B.k===P)return;I.mouse=[L,B.invert(L)],dh(this),I.start()}qu(T),I.wheel=setTimeout(_,g),I.zoom("mouse",n(w(b(B,P),I.mouse[0],I.mouse[1]),I.extent,a));function _(){I.wheel=null,I.end()}}function M(T,...O){if(p||!e.apply(this,arguments))return;var I=T.currentTarget,B=j(this,O,!0).event(T),P=As(T.view).on("mousemove.zoom",Z,!0).on("mouseup.zoom",U,!0),L=yi(T,I),_=T.clientX,G=T.clientY;N_(T.view),yy(T),B.mouse=[L,this.__zoom.invert(L)],dh(this),B.start();function Z(se){if(qu(se),!B.moved){var ue=se.clientX-_,de=se.clientY-G;B.moved=ue*ue+de*de>v}B.event(se).zoom("mouse",n(w(B.that.__zoom,B.mouse[0]=yi(se,I),B.mouse[1]),B.extent,a))}function U(se){P.on("mousemove.zoom mouseup.zoom",null),j_(se.view,B.moved),qu(se),B.event(se).end()}}function z(T,...O){if(e.apply(this,arguments)){var I=this.__zoom,B=yi(T.changedTouches?T.changedTouches[0]:T,this),P=I.invert(B),L=I.k*(T.shiftKey?.5:2),_=n(w(b(I,L),B,P),t.apply(this,O),a);qu(T),l>0?As(this).transition().duration(l).call(C,_,B,T):As(this).call(y.transform,_,B,T)}}function $(T,...O){if(e.apply(this,arguments)){var I=T.touches,B=I.length,P=j(this,O,T.changedTouches.length===B).event(T),L,_,G,Z;for(yy(T),_=0;_<B;++_)G=I[_],Z=yi(G,this),Z=[Z,this.__zoom.invert(Z),G.identifier],P.touch0?!P.touch1&&P.touch0[2]!==Z[2]&&(P.touch1=Z,P.taps=0):(P.touch0=Z,L=!0,P.taps=1+!!f);f&&(f=clearTimeout(f)),L&&(P.taps<2&&(c=Z[0],f=setTimeout(function(){f=null},h)),dh(this),P.start())}}function A(T,...O){if(this.__zooming){var I=j(this,O).event(T),B=T.changedTouches,P=B.length,L,_,G,Z;for(qu(T),L=0;L<P;++L)_=B[L],G=yi(_,this),I.touch0&&I.touch0[2]===_.identifier?I.touch0[0]=G:I.touch1&&I.touch1[2]===_.identifier&&(I.touch1[0]=G);if(_=I.that.__zoom,I.touch1){var U=I.touch0[0],se=I.touch0[1],ue=I.touch1[0],de=I.touch1[1],me=(me=ue[0]-U[0])*me+(me=ue[1]-U[1])*me,ae=(ae=de[0]-se[0])*ae+(ae=de[1]-se[1])*ae;_=b(_,Math.sqrt(me/ae)),G=[(U[0]+ue[0])/2,(U[1]+ue[1])/2],Z=[(se[0]+de[0])/2,(se[1]+de[1])/2]}else if(I.touch0)G=I.touch0[0],Z=I.touch0[1];else return;I.zoom("touch",n(w(_,G,Z),I.extent,a))}}function F(T,...O){if(this.__zooming){var I=j(this,O).event(T),B=T.changedTouches,P=B.length,L,_;for(yy(T),p&&clearTimeout(p),p=setTimeout(function(){p=null},h),L=0;L<P;++L)_=B[L],I.touch0&&I.touch0[2]===_.identifier?delete I.touch0:I.touch1&&I.touch1[2]===_.identifier&&delete I.touch1;if(I.touch1&&!I.touch0&&(I.touch0=I.touch1,delete I.touch1),I.touch0)I.touch0[1]=this.__zoom.invert(I.touch0[0]);else if(I.end(),I.taps===2&&(_=yi(_,this),Math.hypot(c[0]-_[0],c[1]-_[1])<k)){var G=As(this).on("dblclick.zoom");G&&G.apply(this,arguments)}}}return y.wheelDelta=function(T){return arguments.length?(r=typeof T=="function"?T:_p(+T),y):r},y.filter=function(T){return arguments.length?(e=typeof T=="function"?T:_p(!!T),y):e},y.touchable=function(T){return arguments.length?(s=typeof T=="function"?T:_p(!!T),y):s},y.extent=function(T){return arguments.length?(t=typeof T=="function"?T:_p([[+T[0][0],+T[0][1]],[+T[1][0],+T[1][1]]]),y):t},y.scaleExtent=function(T){return arguments.length?(i[0]=+T[0],i[1]=+T[1],y):[i[0],i[1]]},y.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],y):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},y.constrain=function(T){return arguments.length?(n=T,y):n},y.duration=function(T){return arguments.length?(l=+T,y):l},y.interpolate=function(T){return arguments.length?(u=T,y):u},y.on=function(){var T=d.on.apply(d,arguments);return T===d?y:T},y.clickDistance=function(T){return arguments.length?(v=(T=+T)*T,y):Math.sqrt(v)},y.tapDistance=function(T){return arguments.length?(k=+T,y):k},y}const uo={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."},Zd=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],H_=["Enter"," ","Escape"],W_={"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 Qc;(function(e){e.Strict="strict",e.Loose="loose"})(Qc||(Qc={}));var kl;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(kl||(kl={}));var ef;(function(e){e.Partial="partial",e.Full="full"})(ef||(ef={}));const V_={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var pa;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(pa||(pa={}));var gs;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(gs||(gs={}));var Ke;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ke||(Ke={}));const Zk={[Ke.Left]:Ke.Right,[Ke.Right]:Ke.Left,[Ke.Top]:Ke.Bottom,[Ke.Bottom]:Ke.Top};function U_(e){return e===null?null:e?"valid":"invalid"}const K_=e=>"id"in e&&"source"in e&&"target"in e,kz=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Qb=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Cf=(e,t=[0,0])=>{const{width:n,height:r}=Bo(e),s=e.origin??t,i=n*s[0],a=r*s[1];return{x:e.position.x-i,y:e.position.y-a}},Sz=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,s)=>{const i=typeof s=="string";let a=!t.nodeLookup&&!i?s:void 0;t.nodeLookup&&(a=i?t.nodeLookup.get(s):Qb(s)?s:t.nodeLookup.get(s.id));const l=a?Jh(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Ym(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Gm(n)},Ef=(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=Ym(n,Jh(s)),r=!0)}),r?Gm(n):{x:0,y:0,width:0,height:0}},Zb=(e,t,[n,r,s]=[0,0,1],i=!1,a=!1)=>{const l={...Pf(t,[n,r,s]),width:t.width/s,height:t.height/s},u=[];for(const d of e.values()){const{measured:f,selectable:c=!0,hidden:p=!1}=d;if(a&&!c||p)continue;const h=f.width??d.width??d.initialWidth??null,g=f.height??d.height??d.initialHeight??null,v=tf(l,eu(d)),k=(h??0)*(g??0),y=i&&v>0;(!d.internals.handleBounds||y||v>=k||d.dragging)&&u.push(d)}return u},Nz=(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 jz(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 Cz({nodes:e,width:t,height:n,panZoom:r,minZoom:s,maxZoom:i},a){if(e.size===0)return Promise.resolve(!0);const l=jz(e,a),u=Ef(l),d=ev(u,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(d,{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 q_({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:u,y:d}=l?l.internals.positionAbsolute:{x:0,y:0},f=a.origin??r;let c=a.extent||s;if(a.extent==="parent"&&!a.expandParent)if(!l)i==null||i("005",uo.error005());else{const h=l.measured.width,g=l.measured.height;h&&g&&(c=[[u,d],[u+h,d+g]])}else l&&tu(a.extent)&&(c=[[a.extent[0][0]+u,a.extent[0][1]+d],[a.extent[1][0]+u,a.extent[1][1]+d]]);const p=tu(c)?Tl(t,c,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(i==null||i("015",uo.error015())),{position:{x:p.x-u+(a.measured.width??0)*f[0],y:p.y-d+(a.measured.height??0)*f[1]},positionAbsolute:p}}async function Ez({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:s}){const i=new Set(e.map(p=>p.id)),a=[];for(const p of n){if(p.deletable===!1)continue;const h=i.has(p.id),g=!h&&p.parentId&&a.find(v=>v.id===p.parentId);(h||g)&&a.push(p)}const l=new Set(t.map(p=>p.id)),u=r.filter(p=>p.deletable!==!1),f=Nz(a,u);for(const p of u)l.has(p.id)&&!f.find(g=>g.id===p.id)&&f.push(p);if(!s)return{edges:f,nodes:a};const c=await s({nodes:a,edges:f});return typeof c=="boolean"?c?{edges:f,nodes:a}:{edges:[],nodes:[]}:c}const Zc=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Tl=(e={x:0,y:0},t,n)=>({x:Zc(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Zc(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function Y_(e,t,n){const{width:r,height:s}=Bo(n),{x:i,y:a}=n.internals.positionAbsolute;return Tl(e,[[i,a],[i+r,a+s]],t)}const eS=(e,t,n)=>e<t?Zc(Math.abs(e-t),1,t)/t:e>n?-Zc(Math.abs(e-n),1,t)/t:0,G_=(e,t,n=15,r=40)=>{const s=eS(e.x,r,t.width-r)*n,i=eS(e.y,r,t.height-r)*n;return[s,i]},Ym=(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)}),pw=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Gm=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),eu=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Qb(e)?e.internals.positionAbsolute:Cf(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}},Jh=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Qb(e)?e.internals.positionAbsolute:Cf(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)}},X_=(e,t)=>Gm(Ym(pw(e),pw(t))),tf=(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)},tS=e=>vi(e.width)&&vi(e.height)&&vi(e.x)&&vi(e.y),vi=e=>!isNaN(e)&&isFinite(e),_z=(e,t)=>{},_f=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Pf=({x:e,y:t},[n,r,s],i=!1,a=[1,1])=>{const l={x:(e-n)/s,y:(t-r)/s};return i?_f(l,a):l},Qh=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r});function oc(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 Pz(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=oc(e,n),s=oc(e,t);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof e=="object"){const r=oc(e.top??e.y??0,n),s=oc(e.bottom??e.y??0,n),i=oc(e.left??e.x??0,t),a=oc(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 Az(e,t,n,r,s,i){const{x:a,y:l}=Qh(e,[t,n,r]),{x:u,y:d}=Qh({x:e.x+e.width,y:e.y+e.height},[t,n,r]),f=s-u,c=i-d;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(f),bottom:Math.floor(c)}}const ev=(e,t,n,r,s,i)=>{const a=Pz(i,t,n),l=(t-a.x)/e.width,u=(n-a.y)/e.height,d=Math.min(l,u),f=Zc(d,r,s),c=e.x+e.width/2,p=e.y+e.height/2,h=t/2-c*f,g=n/2-p*f,v=Az(e,h,g,f,t,n),k={left:Math.min(v.left-a.left,0),top:Math.min(v.top-a.top,0),right:Math.min(v.right-a.right,0),bottom:Math.min(v.bottom-a.bottom,0)};return{x:h-k.left+k.right,y:g-k.top+k.bottom,zoom:f}},nf=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function tu(e){return e!=null&&e!=="parent"}function Bo(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 J_(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 Q_(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 nS(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Iz(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}function Tz(e){return{...W_,...e||{}}}function Sd(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:i,y:a}=ki(e),l=Pf({x:i-((s==null?void 0:s.left)??0),y:a-((s==null?void 0:s.top)??0)},r),{x:u,y:d}=n?_f(l,t):l;return{xSnapped:u,ySnapped:d,...l}}const tv=e=>({width:e.offsetWidth,height:e.offsetHeight}),Z_=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},Rz=["INPUT","SELECT","TEXTAREA"];function eP(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:Rz.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const tP=e=>"clientX"in e,ki=(e,t)=>{var i,a;const n=tP(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)}},rS=(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,...tv(a)}})};function nP({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:s,sourceControlY:i,targetControlX:a,targetControlY:l}){const u=e*.125+s*.375+a*.375+n*.125,d=t*.125+i*.375+l*.375+r*.125,f=Math.abs(u-e),c=Math.abs(d-t);return[u,d,f,c]}function Pp(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function sS({pos:e,x1:t,y1:n,x2:r,y2:s,c:i}){switch(e){case Ke.Left:return[t-Pp(t-r,i),n];case Ke.Right:return[t+Pp(r-t,i),n];case Ke.Top:return[t,n-Pp(n-s,i)];case Ke.Bottom:return[t,n+Pp(s-n,i)]}}function rP({sourceX:e,sourceY:t,sourcePosition:n=Ke.Bottom,targetX:r,targetY:s,targetPosition:i=Ke.Top,curvature:a=.25}){const[l,u]=sS({pos:n,x1:e,y1:t,x2:r,y2:s,c:a}),[d,f]=sS({pos:i,x1:r,y1:s,x2:e,y2:t,c:a}),[c,p,h,g]=nP({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:l,sourceControlY:u,targetControlX:d,targetControlY:f});return[`M${e},${t} C${l},${u} ${d},${f} ${r},${s}`,c,p,h,g]}function sP({sourceX:e,sourceY:t,targetX:n,targetY:r}){const s=Math.abs(n-e)/2,i=n<e?n+s:n-s,a=Math.abs(r-t)/2,l=r<t?r+a:r-a;return[i,l,s,a]}function Lz({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 Oz({sourceNode:e,targetNode:t,width:n,height:r,transform:s}){const i=Ym(Jh(e),Jh(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 tf(a,Gm(i))>0}const Mz=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,$z=(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)),rf=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||Mz;let s;return K_(e)?s={...e}:s={...e,id:r(e)},$z(s,t)?t:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,t.concat(s))};function iP({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,i,a,l]=sP({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,i,a,l]}const iS={[Ke.Left]:{x:-1,y:0},[Ke.Right]:{x:1,y:0},[Ke.Top]:{x:0,y:-1},[Ke.Bottom]:{x:0,y:1}},Dz=({source:e,sourcePosition:t=Ke.Bottom,target:n})=>t===Ke.Left||t===Ke.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},oS=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Fz({source:e,sourcePosition:t=Ke.Bottom,target:n,targetPosition:r=Ke.Top,center:s,offset:i,stepPosition:a}){const l=iS[t],u=iS[r],d={x:e.x+l.x*i,y:e.y+l.y*i},f={x:n.x+u.x*i,y:n.y+u.y*i},c=Dz({source:d,sourcePosition:t,target:f}),p=c.x!==0?"x":"y",h=c[p];let g=[],v,k;const y={x:0,y:0},b={x:0,y:0},[,,w,N]=sP({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[p]*u[p]===-1){p==="x"?(v=s.x??d.x+(f.x-d.x)*a,k=s.y??(d.y+f.y)/2):(v=s.x??(d.x+f.x)/2,k=s.y??d.y+(f.y-d.y)*a);const D=[{x:v,y:d.y},{x:v,y:f.y}],M=[{x:d.x,y:k},{x:f.x,y:k}];l[p]===h?g=p==="x"?D:M:g=p==="x"?M:D}else{const D=[{x:d.x,y:f.y}],M=[{x:f.x,y:d.y}];if(p==="x"?g=l.x===h?M:D:g=l.y===h?D:M,t===r){const T=Math.abs(e[p]-n[p]);if(T<=i){const O=Math.min(i-1,i-T);l[p]===h?y[p]=(d[p]>e[p]?-1:1)*O:b[p]=(f[p]>n[p]?-1:1)*O}}if(t!==r){const T=p==="x"?"y":"x",O=l[p]===u[T],I=d[T]>f[T],B=d[T]<f[T];(l[p]===1&&(!O&&I||O&&B)||l[p]!==1&&(!O&&B||O&&I))&&(g=p==="x"?D:M)}const z={x:d.x+y.x,y:d.y+y.y},$={x:f.x+b.x,y:f.y+b.y},A=Math.max(Math.abs(z.x-g[0].x),Math.abs($.x-g[0].x)),F=Math.max(Math.abs(z.y-g[0].y),Math.abs($.y-g[0].y));A>=F?(v=(z.x+$.x)/2,k=g[0].y):(v=g[0].x,k=(z.y+$.y)/2)}const C={x:d.x+y.x,y:d.y+y.y},j={x:f.x+b.x,y:f.y+b.y};return[[e,...C.x!==g[0].x||C.y!==g[0].y?[C]:[],...g,...j.x!==g[g.length-1].x||j.y!==g[g.length-1].y?[j]:[],n],v,k,w,N]}function zz(e,t,n,r){const s=Math.min(oS(e,t)/2,oS(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 d=e.x<n.x?-1:1,f=e.y<n.y?1:-1;return`L ${i+s*d},${a}Q ${i},${a} ${i},${a+s*f}`}const l=e.x<n.x?1:-1,u=e.y<n.y?-1:1;return`L ${i},${a+s*u}Q ${i},${a} ${i+s*l},${a}`}function hw({sourceX:e,sourceY:t,sourcePosition:n=Ke.Bottom,targetX:r,targetY:s,targetPosition:i=Ke.Top,borderRadius:a=5,centerX:l,centerY:u,offset:d=20,stepPosition:f=.5}){const[c,p,h,g,v]=Fz({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:s},targetPosition:i,center:{x:l,y:u},offset:d,stepPosition:f});let k=`M${c[0].x} ${c[0].y}`;for(let y=1;y<c.length-1;y++)k+=zz(c[y-1],c[y],c[y+1],a);return k+=`L${c[c.length-1].x} ${c[c.length-1].y}`,[k,p,h,g,v]}function aS(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Bz(e){var c;const{sourceNode:t,targetNode:n}=e;if(!aS(t)||!aS(n))return null;const r=t.internals.handleBounds||lS(t.handles),s=n.internals.handleBounds||lS(n.handles),i=cS((r==null?void 0:r.source)??[],e.sourceHandle),a=cS(e.connectionMode===Qc.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(c=e.onError)==null||c.call(e,"008",uo.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=(i==null?void 0:i.position)||Ke.Bottom,u=(a==null?void 0:a.position)||Ke.Top,d=Rl(t,i,l),f=Rl(n,a,u);return{sourceX:d.x,sourceY:d.y,targetX:f.x,targetY:f.y,sourcePosition:l,targetPosition:u}}function lS(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 Rl(e,t,n=Ke.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??Bo(e);if(r)return{x:s+a/2,y:i+l/2};switch((t==null?void 0:t.position)??n){case Ke.Top:return{x:s+a/2,y:i};case Ke.Right:return{x:s+a,y:i+l/2};case Ke.Bottom:return{x:s+a/2,y:i+l};case Ke.Left:return{x:s,y:i+l/2}}}function cS(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function mw(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(u=>{if(u&&typeof u=="object"){const d=mw(u,t);i.has(d)||(a.push({id:d,color:u.color||n,...u}),i.add(d))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))}const oP=1e3,Wz=10,nv={nodeOrigin:[0,0],nodeExtent:Zd,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Vz={...nv,checkEquality:!0};function rv(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function Uz(e,t,n){const r=rv(nv,n);for(const s of e.values())if(s.parentId)iv(s,e,t,r);else{const i=Cf(s,r.nodeOrigin),a=tu(s.extent)?s.extent:r.nodeExtent,l=Tl(i,a,Bo(s));s.internals.positionAbsolute=l}}function Kz(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 sv(e){return e==="manual"}function gw(e,t,n,r={}){var f,c;const s=rv(Vz,r),i={i:0},a=new Map(t),l=s!=null&&s.elevateNodesOnSelect&&!sv(s.zIndexMode)?oP:0;let u=e.length>0,d=!1;t.clear(),n.clear();for(const p of e){let h=a.get(p.id);if(s.checkEquality&&p===(h==null?void 0:h.internals.userNode))t.set(p.id,h);else{const g=Cf(p,s.nodeOrigin),v=tu(p.extent)?p.extent:s.nodeExtent,k=Tl(g,v,Bo(p));h={...s.defaults,...p,measured:{width:(f=p.measured)==null?void 0:f.width,height:(c=p.measured)==null?void 0:c.height},internals:{positionAbsolute:k,handleBounds:Kz(p,h),z:aP(p,l,s.zIndexMode),userNode:p}},t.set(p.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(u=!1),p.parentId&&iv(h,t,n,r,i),d||(d=p.selected??!1)}return{nodesInitialized:u,hasSelectedNodes:d}}function qz(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 iv(e,t,n,r,s){const{elevateNodesOnSelect:i,nodeOrigin:a,nodeExtent:l,zIndexMode:u}=rv(nv,r),d=e.parentId,f=t.get(d);if(!f){console.warn(`Parent node ${d} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}qz(e,n),s&&!f.parentId&&f.internals.rootParentIndex===void 0&&u==="auto"&&(f.internals.rootParentIndex=++s.i,f.internals.z=f.internals.z+s.i*Wz),s&&f.internals.rootParentIndex!==void 0&&(s.i=f.internals.rootParentIndex);const c=i&&!sv(u)?oP:0,{x:p,y:h,z:g}=Yz(e,f,a,l,c,u),{positionAbsolute:v}=e.internals,k=p!==v.x||h!==v.y;(k||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:k?{x:p,y:h}:v,z:g}})}function aP(e,t,n){const r=vi(e.zIndex)?e.zIndex:0;return sv(n)?r:r+(e.selected?t:0)}function Yz(e,t,n,r,s,i){const{x:a,y:l}=t.internals.positionAbsolute,u=Bo(e),d=Cf(e,n),f=tu(e.extent)?Tl(d,e.extent,u):d;let c=Tl({x:a+f.x,y:l+f.y},r,u);e.extent==="parent"&&(c=Y_(c,u,t));const p=aP(e,s,i),h=t.internals.z??0;return{x:c.x,y:c.y,z:h>=p?h+1:p}}function ov(e,t,n,r=[0,0]){var a;const s=[],i=new Map;for(const l of e){const u=t.get(l.parentId);if(!u)continue;const d=((a=i.get(l.parentId))==null?void 0:a.expandedRect)??eu(u),f=X_(d,l.rect);i.set(l.parentId,{expandedRect:f,parent:u})}return i.size>0&&i.forEach(({expandedRect:l,parent:u},d)=>{var w;const f=u.internals.positionAbsolute,c=Bo(u),p=u.origin??r,h=l.x<f.x?Math.round(Math.abs(f.x-l.x)):0,g=l.y<f.y?Math.round(Math.abs(f.y-l.y)):0,v=Math.max(c.width,Math.round(l.width)),k=Math.max(c.height,Math.round(l.height)),y=(v-c.width)*p[0],b=(k-c.height)*p[1];(h>0||g>0||y||b)&&(s.push({id:d,type:"position",position:{x:u.position.x-h+y,y:u.position.y-g+b}}),(w=n.get(d))==null||w.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+g}})})),(c.width<l.width||c.height<l.height||h||g)&&s.push({id:d,type:"dimensions",setAttributes:!0,dimensions:{width:v+(h?p[0]*h-y:0),height:k+(g?p[1]*g-b:0)}})}),s}function Gz(e,t,n,r,s,i,a){const l=r==null?void 0:r.querySelector(".xyflow__viewport");let u=!1;if(!l)return{changes:[],updatedInternals:u};const d=[],f=window.getComputedStyle(l),{m22:c}=new window.DOMMatrixReadOnly(f.transform),p=[];for(const h of e.values()){const g=t.get(h.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),u=!0;continue}const v=tv(h.nodeElement),k=g.measured.width!==v.width||g.measured.height!==v.height;if(!!(v.width&&v.height&&(k||!g.internals.handleBounds||h.force))){const b=h.nodeElement.getBoundingClientRect(),w=tu(g.extent)?g.extent:i;let{positionAbsolute:N}=g.internals;g.parentId&&g.extent==="parent"?N=Y_(N,v,t.get(g.parentId)):w&&(N=Tl(N,w,v));const C={...g,measured:v,internals:{...g.internals,positionAbsolute:N,handleBounds:{source:rS("source",h.nodeElement,b,c,g.id),target:rS("target",h.nodeElement,b,c,g.id)}}};t.set(g.id,C),g.parentId&&iv(C,t,n,{nodeOrigin:s,zIndexMode:a}),u=!0,k&&(d.push({id:g.id,type:"dimensions",dimensions:v}),g.expandParent&&g.parentId&&p.push({id:g.id,parentId:g.parentId,rect:eu(C,s)}))}}if(p.length>0){const h=ov(p,t,n,s);d.push(...h)}return{changes:d,updatedInternals:u}}async function Xz({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 uS(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 u=r.get(a)||new Map;if(r.set(a,u.set(n,t)),i){a=`${s}-${e}-${i}`;const d=r.get(a)||new Map;r.set(a,d.set(n,t))}}function lP(e,t,n){e.clear(),t.clear();for(const r of n){const{source:s,target:i,sourceHandle:a=null,targetHandle:l=null}=r,u={edgeId:r.id,source:s,target:i,sourceHandle:a,targetHandle:l},d=`${s}-${a}--${i}-${l}`,f=`${i}-${l}--${s}-${a}`;uS("source",u,f,e,s,a),uS("target",u,d,e,i,l),t.set(r.id,r)}}function cP(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:cP(n,t):!1}function dS(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 Jz(e,t,n,r){const s=new Map;for(const[i,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!cP(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 xy({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var a,l,u;const s=[];for(const[d,f]of t){const c=(a=n.get(d))==null?void 0:a.internals.userNode;c&&s.push({...c,position:f.position,dragging:r})}if(!e)return[s[0],s];const i=(l=n.get(e))==null?void 0:l.internals.userNode;return[i?{...i,position:((u=t.get(e))==null?void 0:u.position)||i.position,dragging:r}:s[0],s]}function Qz({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=_f(i,t);return{x:a.x-i.x,y:a.y-i.y}}function Zz({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:s}){let i={x:null,y:null},a=0,l=new Map,u=!1,d={x:0,y:0},f=null,c=!1,p=null,h=!1,g=!1,v=null;function k({noDragClassName:b,handleSelector:w,domNode:N,isSelectable:C,nodeId:j,nodeClickDistance:R=0}){p=As(N);function D({x:A,y:F}){const{nodeLookup:T,nodeExtent:O,snapGrid:I,snapToGrid:B,nodeOrigin:P,onNodeDrag:L,onSelectionDrag:_,onError:G,updateNodePositions:Z}=t();i={x:A,y:F};let U=!1;const se=l.size>1,ue=se&&O?pw(Ef(l)):null,de=se&&B?Qz({dragItems:l,snapGrid:I,x:A,y:F}):null;for(const[me,ae]of l){if(!T.has(me))continue;let Ne={x:A-ae.distance.x,y:F-ae.distance.y};B&&(Ne=de?{x:Math.round(Ne.x+de.x),y:Math.round(Ne.y+de.y)}:_f(Ne,I));let Pe=null;if(se&&O&&!ae.extent&&ue){const{positionAbsolute:_e}=ae.internals,nt=_e.x-ue.x+O[0][0],st=_e.x+ae.measured.width-ue.x2+O[1][0],Je=_e.y-ue.y+O[0][1],Ct=_e.y+ae.measured.height-ue.y2+O[1][1];Pe=[[nt,Je],[st,Ct]]}const{position:be,positionAbsolute:Ie}=q_({nodeId:me,nextPosition:Ne,nodeLookup:T,nodeExtent:Pe||O,nodeOrigin:P,onError:G});U=U||ae.position.x!==be.x||ae.position.y!==be.y,ae.position=be,ae.internals.positionAbsolute=Ie}if(g=g||U,!!U&&(Z(l,!0),v&&(r||L||!j&&_))){const[me,ae]=xy({nodeId:j,dragItems:l,nodeLookup:T});r==null||r(v,l,me,ae),L==null||L(v,me,ae),j||_==null||_(v,ae)}}async function M(){if(!f)return;const{transform:A,panBy:F,autoPanSpeed:T,autoPanOnNodeDrag:O}=t();if(!O){u=!1,cancelAnimationFrame(a);return}const[I,B]=G_(d,f,T);(I!==0||B!==0)&&(i.x=(i.x??0)-I/A[2],i.y=(i.y??0)-B/A[2],await F({x:I,y:B})&&D(i)),a=requestAnimationFrame(M)}function z(A){var se;const{nodeLookup:F,multiSelectionActive:T,nodesDraggable:O,transform:I,snapGrid:B,snapToGrid:P,selectNodesOnDrag:L,onNodeDragStart:_,onSelectionDragStart:G,unselectNodesAndEdges:Z}=t();c=!0,(!L||!C)&&!T&&j&&((se=F.get(j))!=null&&se.selected||Z()),C&&L&&j&&(e==null||e(j));const U=Sd(A.sourceEvent,{transform:I,snapGrid:B,snapToGrid:P,containerBounds:f});if(i=U,l=Jz(F,O,U,j),l.size>0&&(n||_||!j&&G)){const[ue,de]=xy({nodeId:j,dragItems:l,nodeLookup:F});n==null||n(A.sourceEvent,l,ue,de),_==null||_(A.sourceEvent,ue,de),j||G==null||G(A.sourceEvent,de)}}const $=C_().clickDistance(R).on("start",A=>{const{domNode:F,nodeDragThreshold:T,transform:O,snapGrid:I,snapToGrid:B}=t();f=(F==null?void 0:F.getBoundingClientRect())||null,h=!1,g=!1,v=A.sourceEvent,T===0&&z(A),i=Sd(A.sourceEvent,{transform:O,snapGrid:I,snapToGrid:B,containerBounds:f}),d=ki(A.sourceEvent,f)}).on("drag",A=>{const{autoPanOnNodeDrag:F,transform:T,snapGrid:O,snapToGrid:I,nodeDragThreshold:B,nodeLookup:P}=t(),L=Sd(A.sourceEvent,{transform:T,snapGrid:O,snapToGrid:I,containerBounds:f});if(v=A.sourceEvent,(A.sourceEvent.type==="touchmove"&&A.sourceEvent.touches.length>1||j&&!P.has(j))&&(h=!0),!h){if(!u&&F&&c&&(u=!0,M()),!c){const _=ki(A.sourceEvent,f),G=_.x-d.x,Z=_.y-d.y;Math.sqrt(G*G+Z*Z)>B&&z(A)}(i.x!==L.xSnapped||i.y!==L.ySnapped)&&l&&c&&(d=ki(A.sourceEvent,f),D(L))}}).on("end",A=>{if(!(!c||h)&&(u=!1,c=!1,cancelAnimationFrame(a),l.size>0)){const{nodeLookup:F,updateNodePositions:T,onNodeDragStop:O,onSelectionDragStop:I}=t();if(g&&(T(l,!1),g=!1),s||O||!j&&I){const[B,P]=xy({nodeId:j,dragItems:l,nodeLookup:F,dragging:!1});s==null||s(A.sourceEvent,l,B,P),O==null||O(A.sourceEvent,B,P),j||I==null||I(A.sourceEvent,P)}}}).filter(A=>{const F=A.target;return!A.button&&(!b||!dS(F,`.${b}`,N))&&(!w||dS(F,w,N))});p.call($)}function y(){p==null||p.on(".drag",null)}return{update:k,destroy:y}}function e3(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())tf(s,eu(i))>0&&r.push(i);return r}const t3=250;function n3(e,t,n,r){var l,u;let s=[],i=1/0;const a=e3(e,n,t+t3);for(const d of a){const f=[...((l=d.internals.handleBounds)==null?void 0:l.source)??[],...((u=d.internals.handleBounds)==null?void 0:u.target)??[]];for(const c of f){if(r.nodeId===c.nodeId&&r.type===c.type&&r.id===c.id)continue;const{x:p,y:h}=Rl(d,c,c.position,!0),g=Math.sqrt(Math.pow(p-e.x,2)+Math.pow(h-e.y,2));g>t||(g<i?(s=[{...c,x:p,y:h}],i=g):g===i&&s.push({...c,x:p,y:h}))}}if(!s.length)return null;if(s.length>1){const d=r.type==="source"?"target":"source";return s.find(f=>f.type===d)??s[0]}return s[0]}function uP(e,t,n,r,s,i=!1){var d,f,c;const a=r.get(e);if(!a)return null;const l=s==="strict"?(d=a.internals.handleBounds)==null?void 0:d[t]:[...((f=a.internals.handleBounds)==null?void 0:f.source)??[],...((c=a.internals.handleBounds)==null?void 0:c.target)??[]],u=(n?l==null?void 0:l.find(p=>p.id===n):l==null?void 0:l[0])??null;return u&&i?{...u,...Rl(a,u,u.position,!0)}:u}function dP(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function r3(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const fP=()=>!0;function s3(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:s,edgeUpdaterType:i,isTarget:a,domNode:l,nodeLookup:u,lib:d,autoPanOnConnect:f,flowId:c,panBy:p,cancelConnection:h,onConnectStart:g,onConnect:v,onConnectEnd:k,isValidConnection:y=fP,onReconnectEnd:b,updateConnection:w,getTransform:N,getFromHandle:C,autoPanSpeed:j,dragThreshold:R=1,handleDomNode:D}){const M=Z_(e.target);let z=0,$;const{x:A,y:F}=ki(e),T=dP(i,D),O=l==null?void 0:l.getBoundingClientRect();let I=!1;if(!O||!T)return;const B=uP(s,T,r,u,t);if(!B)return;let P=ki(e,O),L=!1,_=null,G=!1,Z=null;function U(){if(!f||!O)return;const[be,Ie]=G_(P,O,j);p({x:be,y:Ie}),z=requestAnimationFrame(U)}const se={...B,nodeId:s,type:T,position:B.position},ue=u.get(s);let me={inProgress:!0,isValid:null,from:Rl(ue,se,Ke.Left,!0),fromHandle:se,fromPosition:se.position,fromNode:ue,to:P,toHandle:null,toPosition:Zk[se.position],toNode:null,pointer:P};function ae(){I=!0,w(me),g==null||g(e,{nodeId:s,handleId:r,handleType:T})}R===0&&ae();function Ne(be){if(!I){const{x:Ct,y:Be}=ki(be),mt=Ct-A,Gt=Be-F;if(!(mt*mt+Gt*Gt>R*R))return;ae()}if(!C()||!se){Pe(be);return}const Ie=N();P=ki(be,O),$=n3(Pf(P,Ie,!1,[1,1]),n,u,se),L||(U(),L=!0);const _e=pP(be,{handle:$,connectionMode:t,fromNodeId:s,fromHandleId:r,fromType:a?"target":"source",isValidConnection:y,doc:M,lib:d,flowId:c,nodeLookup:u});Z=_e.handleDomNode,_=_e.connection,G=r3(!!$,_e.isValid);const nt=u.get(s),st=nt?Rl(nt,se,Ke.Left,!0):me.from,Je={...me,from:st,isValid:G,to:_e.toHandle&&G?Qh({x:_e.toHandle.x,y:_e.toHandle.y},Ie):P,toHandle:_e.toHandle,toPosition:G&&_e.toHandle?_e.toHandle.position:Zk[se.position],toNode:_e.toHandle?u.get(_e.toHandle.nodeId):null,pointer:P};w(Je),me=Je}function Pe(be){if(!("touches"in be&&be.touches.length>0)){if(I){($||Z)&&_&&G&&(v==null||v(_));const{inProgress:Ie,..._e}=me,nt={..._e,toPosition:me.toHandle?me.toPosition:null};k==null||k(be,nt),i&&(b==null||b(be,nt))}h(),cancelAnimationFrame(z),L=!1,G=!1,_=null,Z=null,M.removeEventListener("mousemove",Ne),M.removeEventListener("mouseup",Pe),M.removeEventListener("touchmove",Ne),M.removeEventListener("touchend",Pe)}}M.addEventListener("mousemove",Ne),M.addEventListener("mouseup",Pe),M.addEventListener("touchmove",Ne),M.addEventListener("touchend",Pe)}function pP(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:i,doc:a,lib:l,flowId:u,isValidConnection:d=fP,nodeLookup:f}){const c=i==="target",p=t?a.querySelector(`.${l}-flow__handle[data-id="${u}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:h,y:g}=ki(e),v=a.elementFromPoint(h,g),k=v!=null&&v.classList.contains(`${l}-flow__handle`)?v:p,y={handleDomNode:k,isValid:!1,connection:null,toHandle:null};if(k){const b=dP(void 0,k),w=k.getAttribute("data-nodeid"),N=k.getAttribute("data-handleid"),C=k.classList.contains("connectable"),j=k.classList.contains("connectableend");if(!w||!b)return y;const R={source:c?w:r,sourceHandle:c?N:s,target:c?r:w,targetHandle:c?s:N};y.connection=R;const M=C&&j&&(n===Qc.Strict?c&&b==="source"||!c&&b==="target":w!==r||N!==s);y.isValid=M&&d(R),y.toHandle=uP(w,b,N,f,n,!0)}return y}const yw={onPointerDown:s3,isValid:pP};function i3({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const s=As(e);function i({translateExtent:l,width:u,height:d,zoomStep:f=1,pannable:c=!0,zoomable:p=!0,inversePan:h=!1}){const g=w=>{if(w.sourceEvent.type!=="wheel"||!t)return;const N=n(),C=w.sourceEvent.ctrlKey&&nf()?10:1,j=-w.sourceEvent.deltaY*(w.sourceEvent.deltaMode===1?.05:w.sourceEvent.deltaMode?1:.002)*f,R=N[2]*Math.pow(2,j*C);t.scaleTo(R)};let v=[0,0];const k=w=>{(w.sourceEvent.type==="mousedown"||w.sourceEvent.type==="touchstart")&&(v=[w.sourceEvent.clientX??w.sourceEvent.touches[0].clientX,w.sourceEvent.clientY??w.sourceEvent.touches[0].clientY])},y=w=>{const N=n();if(w.sourceEvent.type!=="mousemove"&&w.sourceEvent.type!=="touchmove"||!t)return;const C=[w.sourceEvent.clientX??w.sourceEvent.touches[0].clientX,w.sourceEvent.clientY??w.sourceEvent.touches[0].clientY],j=[C[0]-v[0],C[1]-v[1]];v=C;const R=r()*Math.max(N[2],Math.log(N[2]))*(h?-1:1),D={x:N[0]-j[0]*R,y:N[1]-j[1]*R},M=[[0,0],[u,d]];t.setViewportConstrained({x:D.x,y:D.y,zoom:N[2]},M,l)},b=B_().on("start",k).on("zoom",c?y:null).on("zoom.wheel",p?g:null);s.call(b,{})}function a(){s.on("zoom",null)}return{update:i,destroy:a,pointer:yi}}const Xm=e=>({x:e.x,y:e.y,zoom:e.k}),wy=({x:e,y:t,zoom:n})=>qm.translate(e,t).scale(n),Ec=(e,t)=>e.target.closest(`.${t}`),hP=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),o3=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,by=(e,t=0,n=o3,r=()=>{})=>{const s=typeof t=="number"&&t>0;return s||r(),s?e.transition().duration(t).ease(n).on("end",r):e},mP=e=>{const t=e.ctrlKey&&nf()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function a3({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:i,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:u,onPanZoomEnd:d}){return f=>{if(Ec(f,t))return f.ctrlKey&&f.preventDefault(),!1;f.preventDefault(),f.stopImmediatePropagation();const c=n.property("__zoom").k||1;if(f.ctrlKey&&a){const k=yi(f),y=mP(f),b=c*Math.pow(2,y);r.scaleTo(n,b,k,f);return}const p=f.deltaMode===1?20:1;let h=s===kl.Vertical?0:f.deltaX*p,g=s===kl.Horizontal?0:f.deltaY*p;!nf()&&f.shiftKey&&s!==kl.Vertical&&(h=f.deltaY*p,g=0),r.translateBy(n,-(h/c)*i,-(g/c)*i,{internal:!0});const v=Xm(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(u==null||u(f,v),e.panScrollTimeout=setTimeout(()=>{d==null||d(f,v),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(f,v))}}function l3({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,s){const i=r.type==="wheel",a=!t&&i&&!r.ctrlKey,l=Ec(r,e);if(r.ctrlKey&&i&&l&&r.preventDefault(),a||l)return null;r.preventDefault(),n.call(this,r,s)}}function c3({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,a,l;if((i=r.sourceEvent)!=null&&i.internal)return;const s=Xm(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 u3({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return i=>{var a,l;e.usedRightMouseButton=!!(n&&hP(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,Xm(i.transform)))}}function d3({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&&hP(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&i(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),s)){const u=Xm(a.transform);e.prevViewport=u,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(a.sourceEvent,u)},n?150:0)}}}function f3({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:i,userSelectionActive:a,noWheelClassName:l,noPanClassName:u,lib:d,connectionInProgress:f}){return c=>{var k;const p=e||t,h=n&&c.ctrlKey,g=c.type==="wheel";if(c.button===1&&c.type==="mousedown"&&(Ec(c,`${d}-flow__node`)||Ec(c,`${d}-flow__edge`)))return!0;if(!r&&!p&&!s&&!i&&!n||a||f&&!g||Ec(c,l)&&g||Ec(c,u)&&(!g||s&&g&&!e)||!n&&c.ctrlKey&&g)return!1;if(!n&&c.type==="touchstart"&&((k=c.touches)==null?void 0:k.length)>1)return c.preventDefault(),!1;if(!p&&!s&&!h&&g||!r&&(c.type==="mousedown"||c.type==="touchstart")||Array.isArray(r)&&!r.includes(c.button)&&c.type==="mousedown")return!1;const v=Array.isArray(r)&&r.includes(c.button)||!c.button||c.button<=1;return(!c.ctrlKey||g)&&v}}function p3({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:s,onPanZoom:i,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:u}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=e.getBoundingClientRect(),c=B_().scaleExtent([t,n]).translateExtent(r),p=As(e).call(c);b({x:s.x,y:s.y,zoom:Zc(s.zoom,t,n)},[[0,0],[f.width,f.height]],r);const h=p.on("wheel.zoom"),g=p.on("dblclick.zoom");c.wheelDelta(mP);function v($,A){return p?new Promise(F=>{c==null||c.interpolate((A==null?void 0:A.interpolate)==="linear"?kd:lh).transform(by(p,A==null?void 0:A.duration,A==null?void 0:A.ease,()=>F(!0)),$)}):Promise.resolve(!1)}function k({noWheelClassName:$,noPanClassName:A,onPaneContextMenu:F,userSelectionActive:T,panOnScroll:O,panOnDrag:I,panOnScrollMode:B,panOnScrollSpeed:P,preventScrolling:L,zoomOnPinch:_,zoomOnScroll:G,zoomOnDoubleClick:Z,zoomActivationKeyPressed:U,lib:se,onTransformChange:ue,connectionInProgress:de,paneClickDistance:me,selectionOnDrag:ae}){T&&!d.isZoomingOrPanning&&y();const Ne=O&&!U&&!T;c.clickDistance(ae?1/0:!vi(me)||me<0?0:me);const Pe=Ne?a3({zoomPanValues:d,noWheelClassName:$,d3Selection:p,d3Zoom:c,panOnScrollMode:B,panOnScrollSpeed:P,zoomOnPinch:_,onPanZoomStart:a,onPanZoom:i,onPanZoomEnd:l}):l3({noWheelClassName:$,preventScrolling:L,d3ZoomHandler:h});if(p.on("wheel.zoom",Pe,{passive:!1}),!T){const Ie=c3({zoomPanValues:d,onDraggingChange:u,onPanZoomStart:a});c.on("start",Ie);const _e=u3({zoomPanValues:d,panOnDrag:I,onPaneContextMenu:!!F,onPanZoom:i,onTransformChange:ue});c.on("zoom",_e);const nt=d3({zoomPanValues:d,panOnDrag:I,panOnScroll:O,onPaneContextMenu:F,onPanZoomEnd:l,onDraggingChange:u});c.on("end",nt)}const be=f3({zoomActivationKeyPressed:U,panOnDrag:I,zoomOnScroll:G,panOnScroll:O,zoomOnDoubleClick:Z,zoomOnPinch:_,userSelectionActive:T,noPanClassName:A,noWheelClassName:$,lib:se,connectionInProgress:de});c.filter(be),Z?p.on("dblclick.zoom",g):p.on("dblclick.zoom",null)}function y(){c.on("zoom",null)}async function b($,A,F){const T=wy($),O=c==null?void 0:c.constrain()(T,A,F);return O&&await v(O),new Promise(I=>I(O))}async function w($,A){const F=wy($);return await v(F,A),new Promise(T=>T(F))}function N($){if(p){const A=wy($),F=p.property("__zoom");(F.k!==$.zoom||F.x!==$.x||F.y!==$.y)&&(c==null||c.transform(p,A,null,{sync:!0}))}}function C(){const $=p?z_(p.node()):{x:0,y:0,k:1};return{x:$.x,y:$.y,zoom:$.k}}function j($,A){return p?new Promise(F=>{c==null||c.interpolate((A==null?void 0:A.interpolate)==="linear"?kd:lh).scaleTo(by(p,A==null?void 0:A.duration,A==null?void 0:A.ease,()=>F(!0)),$)}):Promise.resolve(!1)}function R($,A){return p?new Promise(F=>{c==null||c.interpolate((A==null?void 0:A.interpolate)==="linear"?kd:lh).scaleBy(by(p,A==null?void 0:A.duration,A==null?void 0:A.ease,()=>F(!0)),$)}):Promise.resolve(!1)}function D($){c==null||c.scaleExtent($)}function M($){c==null||c.translateExtent($)}function z($){const A=!vi($)||$<0?0:$;c==null||c.clickDistance(A)}return{update:k,destroy:y,setViewport:w,setViewportConstrained:b,getViewport:C,scaleTo:j,scaleBy:R,setScaleExtent:D,setTranslateExtent:M,syncViewport:N,setClickDistance:z}}var nu;(function(e){e.Line="line",e.Handle="handle"})(nu||(nu={}));function h3({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:s,affectsY:i}){const a=e-t,l=n-r,u=[a>0?1:a<0?-1:0,l>0?1:l<0?-1:0];return a&&s&&(u[0]=u[0]*-1),l&&i&&(u[1]=u[1]*-1),u}function fS(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 sa(e,t){return Math.max(0,t-e)}function ia(e,t){return Math.max(0,e-t)}function Ap(e,t,n){return Math.max(0,t-e,e-n)}function pS(e,t){return e?!t:t}function m3(e,t,n,r,s,i,a,l){let{affectsX:u,affectsY:d}=t;const{isHorizontal:f,isVertical:c}=t,p=f&&c,{xSnapped:h,ySnapped:g}=n,{minWidth:v,maxWidth:k,minHeight:y,maxHeight:b}=r,{x:w,y:N,width:C,height:j,aspectRatio:R}=e;let D=Math.floor(f?h-e.pointerX:0),M=Math.floor(c?g-e.pointerY:0);const z=C+(u?-D:D),$=j+(d?-M:M),A=-i[0]*C,F=-i[1]*j;let T=Ap(z,v,k),O=Ap($,y,b);if(a){let P=0,L=0;u&&D<0?P=sa(w+D+A,a[0][0]):!u&&D>0&&(P=ia(w+z+A,a[1][0])),d&&M<0?L=sa(N+M+F,a[0][1]):!d&&M>0&&(L=ia(N+$+F,a[1][1])),T=Math.max(T,P),O=Math.max(O,L)}if(l){let P=0,L=0;u&&D>0?P=ia(w+D,l[0][0]):!u&&D<0&&(P=sa(w+z,l[1][0])),d&&M>0?L=ia(N+M,l[0][1]):!d&&M<0&&(L=sa(N+$,l[1][1])),T=Math.max(T,P),O=Math.max(O,L)}if(s){if(f){const P=Ap(z/R,y,b)*R;if(T=Math.max(T,P),a){let L=0;!u&&!d||u&&!d&&p?L=ia(N+F+z/R,a[1][1])*R:L=sa(N+F+(u?D:-D)/R,a[0][1])*R,T=Math.max(T,L)}if(l){let L=0;!u&&!d||u&&!d&&p?L=sa(N+z/R,l[1][1])*R:L=ia(N+(u?D:-D)/R,l[0][1])*R,T=Math.max(T,L)}}if(c){const P=Ap($*R,v,k)/R;if(O=Math.max(O,P),a){let L=0;!u&&!d||d&&!u&&p?L=ia(w+$*R+A,a[1][0])/R:L=sa(w+(d?M:-M)*R+A,a[0][0])/R,O=Math.max(O,L)}if(l){let L=0;!u&&!d||d&&!u&&p?L=sa(w+$*R,l[1][0])/R:L=ia(w+(d?M:-M)*R,l[0][0])/R,O=Math.max(O,L)}}}M=M+(M<0?O:-O),D=D+(D<0?T:-T),s&&(p?z>$*R?M=(pS(u,d)?-D:D)/R:D=(pS(u,d)?-M:M)*R:f?(M=D/R,d=u):(D=M*R,u=d));const I=u?w+D:w,B=d?N+M:N;return{width:C+(u?-D:D),height:j+(d?-M:M),x:i[0]*D*(u?-1:1)+I,y:i[1]*M*(d?-1:1)+B}}const gP={width:0,height:0,x:0,y:0},g3={...gP,pointerX:0,pointerY:0,aspectRatio:1};function y3(e){return[[0,0],[e.measured.width,e.measured.height]]}function x3(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,u=n[1]*a;return[[r-l,s-u],[r+i-l,s+a-u]]}function w3({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:s}){const i=As(e);let a={controlDirection:fS("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:d,boundaries:f,keepAspectRatio:c,resizeDirection:p,onResizeStart:h,onResize:g,onResizeEnd:v,shouldResize:k}){let y={...gP},b={...g3};a={boundaries:f,resizeDirection:p,keepAspectRatio:c,controlDirection:fS(d)};let w,N=null,C=[],j,R,D,M=!1;const z=C_().on("start",$=>{const{nodeLookup:A,transform:F,snapGrid:T,snapToGrid:O,nodeOrigin:I,paneDomNode:B}=n();if(w=A.get(t),!w)return;N=(B==null?void 0:B.getBoundingClientRect())??null;const{xSnapped:P,ySnapped:L}=Sd($.sourceEvent,{transform:F,snapGrid:T,snapToGrid:O,containerBounds:N});y={width:w.measured.width??0,height:w.measured.height??0,x:w.position.x??0,y:w.position.y??0},b={...y,pointerX:P,pointerY:L,aspectRatio:y.width/y.height},j=void 0,w.parentId&&(w.extent==="parent"||w.expandParent)&&(j=A.get(w.parentId),R=j&&w.extent==="parent"?y3(j):void 0),C=[],D=void 0;for(const[_,G]of A)if(G.parentId===t&&(C.push({id:_,position:{...G.position},extent:G.extent}),G.extent==="parent"||G.expandParent)){const Z=x3(G,w,G.origin??I);D?D=[[Math.min(Z[0][0],D[0][0]),Math.min(Z[0][1],D[0][1])],[Math.max(Z[1][0],D[1][0]),Math.max(Z[1][1],D[1][1])]]:D=Z}h==null||h($,{...y})}).on("drag",$=>{const{transform:A,snapGrid:F,snapToGrid:T,nodeOrigin:O}=n(),I=Sd($.sourceEvent,{transform:A,snapGrid:F,snapToGrid:T,containerBounds:N}),B=[];if(!w)return;const{x:P,y:L,width:_,height:G}=y,Z={},U=w.origin??O,{width:se,height:ue,x:de,y:me}=m3(b,a.controlDirection,I,a.boundaries,a.keepAspectRatio,U,R,D),ae=se!==_,Ne=ue!==G,Pe=de!==P&&ae,be=me!==L&&Ne;if(!Pe&&!be&&!ae&&!Ne)return;if((Pe||be||U[0]===1||U[1]===1)&&(Z.x=Pe?de:y.x,Z.y=be?me:y.y,y.x=Z.x,y.y=Z.y,C.length>0)){const st=de-P,Je=me-L;for(const Ct of C)Ct.position={x:Ct.position.x-st+U[0]*(se-_),y:Ct.position.y-Je+U[1]*(ue-G)},B.push(Ct)}if((ae||Ne)&&(Z.width=ae&&(!a.resizeDirection||a.resizeDirection==="horizontal")?se:y.width,Z.height=Ne&&(!a.resizeDirection||a.resizeDirection==="vertical")?ue:y.height,y.width=Z.width,y.height=Z.height),j&&w.expandParent){const st=U[0]*(Z.width??0);Z.x&&Z.x<st&&(y.x=st,b.x=b.x-(Z.x-st));const Je=U[1]*(Z.height??0);Z.y&&Z.y<Je&&(y.y=Je,b.y=b.y-(Z.y-Je))}const Ie=h3({width:y.width,prevWidth:_,height:y.height,prevHeight:G,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),_e={...y,direction:Ie};(k==null?void 0:k($,_e))!==!1&&(M=!0,g==null||g($,_e),r(Z,B))}).on("end",$=>{M&&(v==null||v($,{...y}),s==null||s({...y}),M=!1)});i.call(z)}function u(){i.on(".drag",null)}return{update:l,destroy:u}}var yP={exports:{}},xP={},wP={exports:{}},bP={};/**
|
|
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 ru=m;function b3(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var v3=typeof Object.is=="function"?Object.is:b3,k3=ru.useState,S3=ru.useEffect,N3=ru.useLayoutEffect,j3=ru.useDebugValue;function C3(e,t){var n=t(),r=k3({inst:{value:n,getSnapshot:t}}),s=r[0].inst,i=r[1];return N3(function(){s.value=n,s.getSnapshot=t,vy(s)&&i({inst:s})},[e,n,t]),S3(function(){return vy(s)&&i({inst:s}),e(function(){vy(s)&&i({inst:s})})},[e]),j3(n),n}function vy(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!v3(e,n)}catch{return!0}}function E3(e,t){return t()}var _3=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?E3:C3;bP.useSyncExternalStore=ru.useSyncExternalStore!==void 0?ru.useSyncExternalStore:_3;wP.exports=bP;var vP=wP.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 Jm=m,P3=vP;function A3(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var I3=typeof Object.is=="function"?Object.is:A3,T3=P3.useSyncExternalStore,R3=Jm.useRef,L3=Jm.useEffect,O3=Jm.useMemo,M3=Jm.useDebugValue;xP.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var i=R3(null);if(i.current===null){var a={hasValue:!1,value:null};i.current=a}else a=i.current;i=O3(function(){function u(h){if(!d){if(d=!0,f=h,h=r(h),s!==void 0&&a.hasValue){var g=a.value;if(s(g,h))return c=g}return c=h}if(g=c,I3(f,h))return g;var v=r(h);return s!==void 0&&s(g,v)?(f=h,g):(f=h,c=v)}var d=!1,f,c,p=n===void 0?null:n;return[function(){return u(t())},p===null?void 0:function(){return u(p())}]},[t,n,r,s]);var l=T3(e,i[0],i[1]);return L3(function(){a.hasValue=!0,a.value=l},[l]),M3(l),l};yP.exports=xP;var $3=yP.exports;const D3=$a($3),F3={},hS=e=>{let t;const n=new Set,r=(f,c)=>{const p=typeof f=="function"?f(t):f;if(!Object.is(p,t)){const h=t;t=c??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(g=>g(t,h))}},s=()=>t,u={setState:r,getState:s,getInitialState:()=>d,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(F3?"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()}},d=t=e(r,s,u);return u},z3=e=>e?hS(e):hS,{useDebugValue:B3}=ot,{useSyncExternalStoreWithSelector:H3}=D3,W3=e=>e;function kP(e,t=W3,n){const r=H3(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return B3(r),r}const mS=(e,t)=>{const n=z3(e),r=(s,i=t)=>kP(n,s,i);return Object.assign(r,n),r},V3=(e,t)=>e?mS(e,t):mS;function On(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 Qm=m.createContext(null),U3=Qm.Provider,SP=uo.error001();function zt(e,t){const n=m.useContext(Qm);if(n===null)throw new Error(SP);return kP(n,e,t)}function An(){const e=m.useContext(Qm);if(e===null)throw new Error(SP);return m.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const gS={display:"none"},K3={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},NP="react-flow__node-desc",jP="react-flow__edge-desc",q3="react-flow__aria-live",Y3=e=>e.ariaLiveMessage,G3=e=>e.ariaLabelConfig;function X3({rfId:e}){const t=zt(Y3);return o.jsx("div",{id:`${q3}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:K3,children:t})}function J3({rfId:e,disableKeyboardA11y:t}){const n=zt(G3);return o.jsxs(o.Fragment,{children:[o.jsx("div",{id:`${NP}-${e}`,style:gS,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),o.jsx("div",{id:`${jP}-${e}`,style:gS,children:n["edge.a11yDescription.default"]}),!t&&o.jsx(X3,{rfId:e})]})}const su=m.forwardRef(({position:e="top-left",children:t,className:n,style:r,...s},i)=>{const a=`${e}`.split("-");return o.jsx("div",{className:lr(["react-flow__panel",n,...a]),style:r,ref:i,...s,children:t})});su.displayName="Panel";function Q3({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:o.jsx(su,{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 Z3=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}},Ip=e=>e.id;function e5(e,t){return On(e.selectedNodes.map(Ip),t.selectedNodes.map(Ip))&&On(e.selectedEdges.map(Ip),t.selectedEdges.map(Ip))}function t5({onSelectionChange:e}){const t=An(),{selectedNodes:n,selectedEdges:r}=zt(Z3,e5);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 n5=e=>!!e.onSelectionChangeHandlers;function r5({onSelectionChange:e}){const t=zt(n5);return e||t?o.jsx(t5,{onSelectionChange:e}):null}const xw=typeof window<"u"?m.useLayoutEffect:m.useEffect,CP=[0,0],s5={x:0,y:0,zoom:1},i5=["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"],yS=[...i5,"rfId"],o5=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}),xS={translateExtent:Zd,nodeOrigin:CP,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function a5(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:s,setTranslateExtent:i,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:u}=zt(o5,On),d=An();xw(()=>(u(e.defaultNodes,e.defaultEdges),()=>{f.current=xS,l()}),[]);const f=m.useRef(xS);return xw(()=>{for(const c of yS){const p=e[c],h=f.current[c];p!==h&&(typeof e[c]>"u"||(c==="nodes"?t(p):c==="edges"?n(p):c==="minZoom"?r(p):c==="maxZoom"?s(p):c==="translateExtent"?i(p):c==="nodeExtent"?a(p):c==="ariaLabelConfig"?d.setState({ariaLabelConfig:Tz(p)}):c==="fitView"?d.setState({fitViewQueued:p}):c==="fitViewOptions"?d.setState({fitViewOptions:p}):d.setState({[c]:p})))}f.current=e},yS.map(c=>e[c])),null}function wS(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function l5(e){var r;const[t,n]=m.useState(e==="system"?null:e);return m.useEffect(()=>{if(e!=="system"){n(e);return}const s=wS(),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=wS())!=null&&r.matches?"dark":"light"}const bS=typeof document<"u"?document:null;function sf(e=null,t={target:bS,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 d=(Array.isArray(e)?e:[e]).filter(c=>typeof c=="string").map(c=>c.replace("+",`
|
|
61
|
+
`).replace(`
|
|
62
|
+
|
|
63
|
+
`,`
|
|
64
|
+
+`).split(`
|
|
65
|
+
`)),f=d.reduce((c,p)=>c.concat(...p),[]);return[d,f]}return[[],[]]},[e]);return m.useEffect(()=>{const u=(t==null?void 0:t.target)??bS,d=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const f=h=>{var k,y;if(s.current=h.ctrlKey||h.metaKey||h.shiftKey||h.altKey,(!s.current||s.current&&!d)&&eP(h))return!1;const v=kS(h.code,l);if(i.current.add(h[v]),vS(a,i.current,!1)){const b=((y=(k=h.composedPath)==null?void 0:k.call(h))==null?void 0:y[0])||h.target,w=(b==null?void 0:b.nodeName)==="BUTTON"||(b==null?void 0:b.nodeName)==="A";t.preventDefault!==!1&&(s.current||!w)&&h.preventDefault(),r(!0)}},c=h=>{const g=kS(h.code,l);vS(a,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(h[g]),h.key==="Meta"&&i.current.clear(),s.current=!1},p=()=>{i.current.clear(),r(!1)};return u==null||u.addEventListener("keydown",f),u==null||u.addEventListener("keyup",c),window.addEventListener("blur",p),window.addEventListener("contextmenu",p),()=>{u==null||u.removeEventListener("keydown",f),u==null||u.removeEventListener("keyup",c),window.removeEventListener("blur",p),window.removeEventListener("contextmenu",p)}}},[e,r]),n}function vS(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function kS(e,t){return t.includes(e)?"code":"key"}const c5=()=>{const e=An();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(),u=ev(t,r,s,i,a,(n==null?void 0:n.padding)??.1);return l?(await l.setViewport(u,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),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:u}=a.getBoundingClientRect(),d={x:t.x-l,y:t.y-u},f=n.snapGrid??s,c=n.snapToGrid??i;return Pf(d,r,c,f)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:s,y:i}=r.getBoundingClientRect(),a=Qh(t,n);return{x:a.x+s,y:a.y+i}}}),[])};function EP(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 u of a)u5(u,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 u5(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 Zh(e,t){return EP(e,t)}function av(e,t){return EP(e,t)}function dl(e,t){return{id:e,type:"select",selected:t}}function _c(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(dl(i.id,a)))}return r}function SS({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),u=((s=l==null?void 0:l.internals)==null?void 0:s.userNode)??l;u!==void 0&&u!==a&&n.push({id:a.id,item:a,type:"replace"}),u===void 0&&n.push({item:a,type:"add",index:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function NS(e){return{id:e.id,type:"remove"}}const jS=e=>kz(e),d5=e=>K_(e);function _P(e){return m.forwardRef(e)}function CS(e){const[t,n]=m.useState(BigInt(0)),[r]=m.useState(()=>f5(()=>n(s=>s+BigInt(1))));return xw(()=>{const s=r.get();s.length&&(e(s),r.reset())},[t]),r}function f5(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const PP=m.createContext(null);function p5({children:e}){const t=An(),n=m.useCallback(l=>{const{nodes:u=[],setNodes:d,hasDefaultNodes:f,onNodesChange:c,nodeLookup:p,fitViewQueued:h,onNodesChangeMiddlewareMap:g}=t.getState();let v=u;for(const y of l)v=typeof y=="function"?y(v):y;let k=SS({items:v,lookup:p});for(const y of g.values())k=y(k);f&&d(v),k.length>0?c==null||c(k):h&&window.requestAnimationFrame(()=>{const{fitViewQueued:y,nodes:b,setNodes:w}=t.getState();y&&w(b)})},[]),r=CS(n),s=m.useCallback(l=>{const{edges:u=[],setEdges:d,hasDefaultEdges:f,onEdgesChange:c,edgeLookup:p}=t.getState();let h=u;for(const g of l)h=typeof g=="function"?g(h):g;f?d(h):c&&c(SS({items:h,lookup:p}))},[]),i=CS(s),a=m.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return o.jsx(PP.Provider,{value:a,children:e})}function h5(){const e=m.useContext(PP);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const m5=e=>!!e.panZoom;function Dl(){const e=c5(),t=An(),n=h5(),r=zt(m5),s=m.useMemo(()=>{const i=c=>t.getState().nodeLookup.get(c),a=c=>{n.nodeQueue.push(c)},l=c=>{n.edgeQueue.push(c)},u=c=>{var y,b;const{nodeLookup:p,nodeOrigin:h}=t.getState(),g=jS(c)?c:p.get(c.id),v=g.parentId?Q_(g.position,g.measured,g.parentId,p,h):g.position,k={...g,position:v,width:((y=g.measured)==null?void 0:y.width)??g.width,height:((b=g.measured)==null?void 0:b.height)??g.height};return eu(k)},d=(c,p,h={replace:!1})=>{a(g=>g.map(v=>{if(v.id===c){const k=typeof p=="function"?p(v):p;return h.replace&&jS(k)?k:{...v,...k}}return v}))},f=(c,p,h={replace:!1})=>{l(g=>g.map(v=>{if(v.id===c){const k=typeof p=="function"?p(v):p;return h.replace&&d5(k)?k:{...v,...k}}return v}))};return{getNodes:()=>t.getState().nodes.map(c=>({...c})),getNode:c=>{var p;return(p=i(c))==null?void 0:p.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:c=[]}=t.getState();return c.map(p=>({...p}))},getEdge:c=>t.getState().edgeLookup.get(c),setNodes:a,setEdges:l,addNodes:c=>{const p=Array.isArray(c)?c:[c];n.nodeQueue.push(h=>[...h,...p])},addEdges:c=>{const p=Array.isArray(c)?c:[c];n.edgeQueue.push(h=>[...h,...p])},toObject:()=>{const{nodes:c=[],edges:p=[],transform:h}=t.getState(),[g,v,k]=h;return{nodes:c.map(y=>({...y})),edges:p.map(y=>({...y})),viewport:{x:g,y:v,zoom:k}}},deleteElements:async({nodes:c=[],edges:p=[]})=>{const{nodes:h,edges:g,onNodesDelete:v,onEdgesDelete:k,triggerNodeChanges:y,triggerEdgeChanges:b,onDelete:w,onBeforeDelete:N}=t.getState(),{nodes:C,edges:j}=await Ez({nodesToRemove:c,edgesToRemove:p,nodes:h,edges:g,onBeforeDelete:N}),R=j.length>0,D=C.length>0;if(R){const M=j.map(NS);k==null||k(j),b(M)}if(D){const M=C.map(NS);v==null||v(C),y(M)}return(D||R)&&(w==null||w({nodes:C,edges:j})),{deletedNodes:C,deletedEdges:j}},getIntersectingNodes:(c,p=!0,h)=>{const g=tS(c),v=g?c:u(c),k=h!==void 0;return v?(h||t.getState().nodes).filter(y=>{const b=t.getState().nodeLookup.get(y.id);if(b&&!g&&(y.id===c.id||!b.internals.positionAbsolute))return!1;const w=eu(k?y:b),N=tf(w,v);return p&&N>0||N>=w.width*w.height||N>=v.width*v.height}):[]},isNodeIntersecting:(c,p,h=!0)=>{const v=tS(c)?c:u(c);if(!v)return!1;const k=tf(v,p);return h&&k>0||k>=p.width*p.height||k>=v.width*v.height},updateNode:d,updateNodeData:(c,p,h={replace:!1})=>{d(c,g=>{const v=typeof p=="function"?p(g):p;return h.replace?{...g,data:v}:{...g,data:{...g.data,...v}}},h)},updateEdge:f,updateEdgeData:(c,p,h={replace:!1})=>{f(c,g=>{const v=typeof p=="function"?p(g):p;return h.replace?{...g,data:v}:{...g,data:{...g.data,...v}}},h)},getNodesBounds:c=>{const{nodeLookup:p,nodeOrigin:h}=t.getState();return Sz(c,{nodeLookup:p,nodeOrigin:h})},getHandleConnections:({type:c,id:p,nodeId:h})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${h}-${c}${p?`-${p}`:""}`))==null?void 0:g.values())??[])},getNodeConnections:({type:c,handleId:p,nodeId:h})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${h}${c?p?`-${c}-${p}`:`-${c}`:""}`))==null?void 0:g.values())??[])},fitView:async c=>{const p=t.getState().fitViewResolver??Iz();return t.setState({fitViewQueued:!0,fitViewOptions:c,fitViewResolver:p}),n.nodeQueue.push(h=>[...h]),p.promise}}},[]);return m.useMemo(()=>({...s,...e,viewportInitialized:r}),[r])}const ES=e=>e.selected,g5=typeof window<"u"?window:void 0;function y5({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=An(),{deleteElements:r}=Dl(),s=sf(e,{actInsideInputWithModifier:!1}),i=sf(t,{target:g5});m.useEffect(()=>{if(s){const{edges:a,nodes:l}=n.getState();r({nodes:l.filter(ES),edges:a.filter(ES)}),n.setState({nodesSelectionActive:!1})}},[s]),m.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function x5(e){const t=An();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=tv(e.current);(r.height===0||r.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",uo.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const Zm={position:"absolute",width:"100%",height:"100%",top:0,left:0},w5=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function b5({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:i=kl.Free,zoomOnDoubleClick:a=!0,panOnDrag:l=!0,defaultViewport:u,translateExtent:d,minZoom:f,maxZoom:c,zoomActivationKeyCode:p,preventScrolling:h=!0,children:g,noWheelClassName:v,noPanClassName:k,onViewportChange:y,isControlledViewport:b,paneClickDistance:w,selectionOnDrag:N}){const C=An(),j=m.useRef(null),{userSelectionActive:R,lib:D,connectionInProgress:M}=zt(w5,On),z=sf(p),$=m.useRef();x5(j);const A=m.useCallback(F=>{y==null||y({x:F[0],y:F[1],zoom:F[2]}),b||C.setState({transform:F})},[y,b]);return m.useEffect(()=>{if(j.current){$.current=p3({domNode:j.current,minZoom:f,maxZoom:c,translateExtent:d,viewport:u,onDraggingChange:I=>C.setState(B=>B.paneDragging===I?B:{paneDragging:I}),onPanZoomStart:(I,B)=>{const{onViewportChangeStart:P,onMoveStart:L}=C.getState();L==null||L(I,B),P==null||P(B)},onPanZoom:(I,B)=>{const{onViewportChange:P,onMove:L}=C.getState();L==null||L(I,B),P==null||P(B)},onPanZoomEnd:(I,B)=>{const{onViewportChangeEnd:P,onMoveEnd:L}=C.getState();L==null||L(I,B),P==null||P(B)}});const{x:F,y:T,zoom:O}=$.current.getViewport();return C.setState({panZoom:$.current,transform:[F,T,O],domNode:j.current.closest(".react-flow")}),()=>{var I;(I=$.current)==null||I.destroy()}}},[]),m.useEffect(()=>{var F;(F=$.current)==null||F.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:i,zoomOnDoubleClick:a,panOnDrag:l,zoomActivationKeyPressed:z,preventScrolling:h,noPanClassName:k,userSelectionActive:R,noWheelClassName:v,lib:D,onTransformChange:A,connectionInProgress:M,selectionOnDrag:N,paneClickDistance:w})},[e,t,n,r,s,i,a,l,z,h,k,R,v,D,A,M,N,w]),o.jsx("div",{className:"react-flow__renderer",ref:j,style:Zm,children:g})}const v5=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function k5(){const{userSelectionActive:e,userSelectionRect:t}=zt(v5,On);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 ky=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},S5=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function N5({isSelecting:e,selectionKeyPressed:t,selectionMode:n=ef.Full,panOnDrag:r,paneClickDistance:s,selectionOnDrag:i,onSelectionStart:a,onSelectionEnd:l,onPaneClick:u,onPaneContextMenu:d,onPaneScroll:f,onPaneMouseEnter:c,onPaneMouseMove:p,onPaneMouseLeave:h,children:g}){const v=An(),{userSelectionActive:k,elementsSelectable:y,dragging:b,connectionInProgress:w}=zt(S5,On),N=y&&(e||k),C=m.useRef(null),j=m.useRef(),R=m.useRef(new Set),D=m.useRef(new Set),M=m.useRef(!1),z=P=>{if(M.current||w){M.current=!1;return}u==null||u(P),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1})},$=P=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){P.preventDefault();return}d==null||d(P)},A=f?P=>f(P):void 0,F=P=>{M.current&&(P.stopPropagation(),M.current=!1)},T=P=>{var ue,de;const{domNode:L}=v.getState();if(j.current=L==null?void 0:L.getBoundingClientRect(),!j.current)return;const _=P.target===C.current;if(!_&&!!P.target.closest(".nokey")||!e||!(i&&_||t)||P.button!==0||!P.isPrimary)return;(de=(ue=P.target)==null?void 0:ue.setPointerCapture)==null||de.call(ue,P.pointerId),M.current=!1;const{x:U,y:se}=ki(P.nativeEvent,j.current);v.setState({userSelectionRect:{width:0,height:0,startX:U,startY:se,x:U,y:se}}),_||(P.stopPropagation(),P.preventDefault())},O=P=>{const{userSelectionRect:L,transform:_,nodeLookup:G,edgeLookup:Z,connectionLookup:U,triggerNodeChanges:se,triggerEdgeChanges:ue,defaultEdgeOptions:de,resetSelectedElements:me}=v.getState();if(!j.current||!L)return;const{x:ae,y:Ne}=ki(P.nativeEvent,j.current),{startX:Pe,startY:be}=L;if(!M.current){const Je=t?0:s;if(Math.hypot(ae-Pe,Ne-be)<=Je)return;me(),a==null||a(P)}M.current=!0;const Ie={startX:Pe,startY:be,x:ae<Pe?ae:Pe,y:Ne<be?Ne:be,width:Math.abs(ae-Pe),height:Math.abs(Ne-be)},_e=R.current,nt=D.current;R.current=new Set(Zb(G,Ie,_,n===ef.Partial,!0).map(Je=>Je.id)),D.current=new Set;const st=(de==null?void 0:de.selectable)??!0;for(const Je of R.current){const Ct=U.get(Je);if(Ct)for(const{edgeId:Be}of Ct.values()){const mt=Z.get(Be);mt&&(mt.selectable??st)&&D.current.add(Be)}}if(!nS(_e,R.current)){const Je=_c(G,R.current,!0);se(Je)}if(!nS(nt,D.current)){const Je=_c(Z,D.current);ue(Je)}v.setState({userSelectionRect:Ie,userSelectionActive:!0,nodesSelectionActive:!1})},I=P=>{var L,_;P.button===0&&((_=(L=P.target)==null?void 0:L.releasePointerCapture)==null||_.call(L,P.pointerId),!k&&P.target===C.current&&v.getState().userSelectionRect&&(z==null||z(P)),v.setState({userSelectionActive:!1,userSelectionRect:null}),M.current&&(l==null||l(P),v.setState({nodesSelectionActive:R.current.size>0})))},B=r===!0||Array.isArray(r)&&r.includes(0);return o.jsxs("div",{className:lr(["react-flow__pane",{draggable:B,dragging:b,selection:e}]),onClick:N?void 0:ky(z,C),onContextMenu:ky($,C),onWheel:ky(A,C),onPointerEnter:N?void 0:c,onPointerMove:N?O:p,onPointerUp:N?I:void 0,onPointerDownCapture:N?T:void 0,onClickCapture:N?F:void 0,onPointerLeave:h,ref:C,style:Zm,children:[g,o.jsx(k5,{})]})}function ww({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:a,nodeLookup:l,onError:u}=t.getState(),d=l.get(e);if(!d){u==null||u("012",uo.error012(e));return}t.setState({nodesSelectionActive:!1}),d.selected?(n||d.selected&&a)&&(i({nodes:[d],edges:[]}),requestAnimationFrame(()=>{var f;return(f=r==null?void 0:r.current)==null?void 0:f.blur()})):s([e])}function AP({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,nodeClickDistance:a}){const l=An(),[u,d]=m.useState(!1),f=m.useRef();return m.useEffect(()=>{f.current=Zz({getStoreItems:()=>l.getState(),onNodeMouseDown:c=>{ww({id:c,store:l,nodeRef:e})},onDragStart:()=>{d(!0)},onDragStop:()=>{d(!1)}})},[]),m.useEffect(()=>{if(!(t||!e.current||!f.current))return f.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:s,nodeClickDistance:a}),()=>{var c;(c=f.current)==null||c.destroy()}},[n,r,t,i,e,s,a]),u}const j5=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function IP(){const e=An();return m.useCallback(n=>{const{nodeExtent:r,snapToGrid:s,snapGrid:i,nodesDraggable:a,onError:l,updateNodePositions:u,nodeLookup:d,nodeOrigin:f}=e.getState(),c=new Map,p=j5(a),h=s?i[0]:5,g=s?i[1]:5,v=n.direction.x*h*n.factor,k=n.direction.y*g*n.factor;for(const[,y]of d){if(!p(y))continue;let b={x:y.internals.positionAbsolute.x+v,y:y.internals.positionAbsolute.y+k};s&&(b=_f(b,i));const{position:w,positionAbsolute:N}=q_({nodeId:y.id,nextPosition:b,nodeLookup:d,nodeExtent:r,nodeOrigin:f,onError:l});y.position=w,y.internals.positionAbsolute=N,c.set(y.id,y)}u(c)},[])}const lv=m.createContext(null),C5=lv.Provider;lv.Consumer;const TP=()=>m.useContext(lv),E5=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),_5=(e,t,n)=>r=>{const{connectionClickStartHandle:s,connectionMode:i,connection:a}=r,{fromHandle:l,toHandle:u,isValid:d}=a,f=(u==null?void 0:u.nodeId)===e&&(u==null?void 0:u.id)===t&&(u==null?void 0:u.type)===n;return{connectingFrom:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===t&&(l==null?void 0:l.type)===n,connectingTo:f,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===n,isPossibleEndHandle:i===Qc.Strict?(l==null?void 0:l.type)!==n:e!==(l==null?void 0:l.nodeId)||t!==(l==null?void 0:l.id),connectionInProcess:!!l,clickConnectionInProcess:!!s,valid:f&&d}};function P5({type:e="source",position:t=Ke.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:a,onConnect:l,children:u,className:d,onMouseDown:f,onTouchStart:c,...p},h){var O,I;const g=a||null,v=e==="target",k=An(),y=TP(),{connectOnClick:b,noPanClassName:w,rfId:N}=zt(E5,On),{connectingFrom:C,connectingTo:j,clickConnecting:R,isPossibleEndHandle:D,connectionInProcess:M,clickConnectionInProcess:z,valid:$}=zt(_5(y,g,e),On);y||(I=(O=k.getState()).onError)==null||I.call(O,"010",uo.error010());const A=B=>{const{defaultEdgeOptions:P,onConnect:L,hasDefaultEdges:_}=k.getState(),G={...P,...B};if(_){const{edges:Z,setEdges:U}=k.getState();U(rf(G,Z))}L==null||L(G),l==null||l(G)},F=B=>{if(!y)return;const P=tP(B.nativeEvent);if(s&&(P&&B.button===0||!P)){const L=k.getState();yw.onPointerDown(B.nativeEvent,{handleDomNode:B.currentTarget,autoPanOnConnect:L.autoPanOnConnect,connectionMode:L.connectionMode,connectionRadius:L.connectionRadius,domNode:L.domNode,nodeLookup:L.nodeLookup,lib:L.lib,isTarget:v,handleId:g,nodeId:y,flowId:L.rfId,panBy:L.panBy,cancelConnection:L.cancelConnection,onConnectStart:L.onConnectStart,onConnectEnd:(..._)=>{var G,Z;return(Z=(G=k.getState()).onConnectEnd)==null?void 0:Z.call(G,..._)},updateConnection:L.updateConnection,onConnect:A,isValidConnection:n||((..._)=>{var G,Z;return((Z=(G=k.getState()).isValidConnection)==null?void 0:Z.call(G,..._))??!0}),getTransform:()=>k.getState().transform,getFromHandle:()=>k.getState().connection.fromHandle,autoPanSpeed:L.autoPanSpeed,dragThreshold:L.connectionDragThreshold})}P?f==null||f(B):c==null||c(B)},T=B=>{const{onClickConnectStart:P,onClickConnectEnd:L,connectionClickStartHandle:_,connectionMode:G,isValidConnection:Z,lib:U,rfId:se,nodeLookup:ue,connection:de}=k.getState();if(!y||!_&&!s)return;if(!_){P==null||P(B.nativeEvent,{nodeId:y,handleId:g,handleType:e}),k.setState({connectionClickStartHandle:{nodeId:y,type:e,id:g}});return}const me=Z_(B.target),ae=n||Z,{connection:Ne,isValid:Pe}=yw.isValid(B.nativeEvent,{handle:{nodeId:y,id:g,type:e},connectionMode:G,fromNodeId:_.nodeId,fromHandleId:_.id||null,fromType:_.type,isValidConnection:ae,flowId:se,doc:me,lib:U,nodeLookup:ue});Pe&&Ne&&A(Ne);const be=structuredClone(de);delete be.inProgress,be.toPosition=be.toHandle?be.toHandle.position:null,L==null||L(B,be),k.setState({connectionClickStartHandle:null})};return o.jsx("div",{"data-handleid":g,"data-nodeid":y,"data-handlepos":t,"data-id":`${N}-${y}-${g}-${e}`,className:lr(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",w,d,{source:!v,target:v,connectable:r,connectablestart:s,connectableend:i,clickconnecting:R,connectingfrom:C,connectingto:j,valid:$,connectionindicator:r&&(!M||D)&&(M||z?i:s)}]),onMouseDown:F,onTouchStart:F,onClick:b?T:void 0,ref:h,...p,children:u})}const xs=m.memo(_P(P5));function A5({data:e,isConnectable:t,sourcePosition:n=Ke.Bottom}){return o.jsxs(o.Fragment,{children:[e==null?void 0:e.label,o.jsx(xs,{type:"source",position:n,isConnectable:t})]})}function I5({data:e,isConnectable:t,targetPosition:n=Ke.Top,sourcePosition:r=Ke.Bottom}){return o.jsxs(o.Fragment,{children:[o.jsx(xs,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,o.jsx(xs,{type:"source",position:r,isConnectable:t})]})}function T5(){return null}function R5({data:e,isConnectable:t,targetPosition:n=Ke.Top}){return o.jsxs(o.Fragment,{children:[o.jsx(xs,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const em={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},_S={input:A5,default:I5,output:R5,group:T5};function L5(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 O5=e=>{const{width:t,height:n,x:r,y:s}=Ef(e.nodeLookup,{filter:i=>!!i.selected});return{width:vi(t)?t:null,height:vi(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 M5({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=An(),{width:s,height:i,transformString:a,userSelectionActive:l}=zt(O5,On),u=IP(),d=m.useRef(null);m.useEffect(()=>{var h;n||(h=d.current)==null||h.focus({preventScroll:!0})},[n]);const f=!l&&s!==null&&i!==null;if(AP({nodeRef:d,disabled:!f}),!f)return null;const c=e?h=>{const g=r.getState().nodes.filter(v=>v.selected);e(h,g)}:void 0,p=h=>{Object.prototype.hasOwnProperty.call(em,h.key)&&(h.preventDefault(),u({direction:em[h.key],factor:h.shiftKey?4:1}))};return o.jsx("div",{className:lr(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:o.jsx("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:c,tabIndex:n?void 0:-1,onKeyDown:n?void 0:p,style:{width:s,height:i}})})}const PS=typeof window<"u"?window:void 0,$5=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function RP({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,paneClickDistance:l,deleteKeyCode:u,selectionKeyCode:d,selectionOnDrag:f,selectionMode:c,onSelectionStart:p,onSelectionEnd:h,multiSelectionKeyCode:g,panActivationKeyCode:v,zoomActivationKeyCode:k,elementsSelectable:y,zoomOnScroll:b,zoomOnPinch:w,panOnScroll:N,panOnScrollSpeed:C,panOnScrollMode:j,zoomOnDoubleClick:R,panOnDrag:D,defaultViewport:M,translateExtent:z,minZoom:$,maxZoom:A,preventScrolling:F,onSelectionContextMenu:T,noWheelClassName:O,noPanClassName:I,disableKeyboardA11y:B,onViewportChange:P,isControlledViewport:L}){const{nodesSelectionActive:_,userSelectionActive:G}=zt($5,On),Z=sf(d,{target:PS}),U=sf(v,{target:PS}),se=U||D,ue=U||N,de=f&&se!==!0,me=Z||G||de;return y5({deleteKeyCode:u,multiSelectionKeyCode:g}),o.jsx(b5,{onPaneContextMenu:i,elementsSelectable:y,zoomOnScroll:b,zoomOnPinch:w,panOnScroll:ue,panOnScrollSpeed:C,panOnScrollMode:j,zoomOnDoubleClick:R,panOnDrag:!Z&&se,defaultViewport:M,translateExtent:z,minZoom:$,maxZoom:A,zoomActivationKeyCode:k,preventScrolling:F,noWheelClassName:O,noPanClassName:I,onViewportChange:P,isControlledViewport:L,paneClickDistance:l,selectionOnDrag:de,children:o.jsxs(N5,{onSelectionStart:p,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,panOnDrag:se,isSelecting:!!me,selectionMode:c,selectionKeyPressed:Z,paneClickDistance:l,selectionOnDrag:de,children:[e,_&&o.jsx(M5,{onSelectionContextMenu:T,noPanClassName:I,disableKeyboardA11y:B})]})})}RP.displayName="FlowRenderer";const D5=m.memo(RP),F5=e=>t=>e?Zb(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 z5(e){return zt(m.useCallback(F5(e),[e]),On)}const B5=e=>e.updateNodeInternals;function H5(){const e=zt(B5),[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 W5({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const s=An(),i=m.useRef(null),a=m.useRef(null),l=m.useRef(e.sourcePosition),u=m.useRef(e.targetPosition),d=m.useRef(t),f=n&&!!e.internals.handleBounds;return m.useEffect(()=>{i.current&&!e.hidden&&(!f||a.current!==i.current)&&(a.current&&(r==null||r.unobserve(a.current)),r==null||r.observe(i.current),a.current=i.current)},[f,e.hidden]),m.useEffect(()=>()=>{a.current&&(r==null||r.unobserve(a.current),a.current=null)},[]),m.useEffect(()=>{if(i.current){const c=d.current!==t,p=l.current!==e.sourcePosition,h=u.current!==e.targetPosition;(c||p||h)&&(d.current=t,l.current=e.sourcePosition,u.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 V5({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:s,onContextMenu:i,onDoubleClick:a,nodesDraggable:l,elementsSelectable:u,nodesConnectable:d,nodesFocusable:f,resizeObserver:c,noDragClassName:p,noPanClassName:h,disableKeyboardA11y:g,rfId:v,nodeTypes:k,nodeClickDistance:y,onError:b}){const{node:w,internals:N,isParent:C}=zt(ae=>{const Ne=ae.nodeLookup.get(e),Pe=ae.parentLookup.has(e);return{node:Ne,internals:Ne.internals,isParent:Pe}},On);let j=w.type||"default",R=(k==null?void 0:k[j])||_S[j];R===void 0&&(b==null||b("003",uo.error003(j)),j="default",R=(k==null?void 0:k.default)||_S.default);const D=!!(w.draggable||l&&typeof w.draggable>"u"),M=!!(w.selectable||u&&typeof w.selectable>"u"),z=!!(w.connectable||d&&typeof w.connectable>"u"),$=!!(w.focusable||f&&typeof w.focusable>"u"),A=An(),F=J_(w),T=W5({node:w,nodeType:j,hasDimensions:F,resizeObserver:c}),O=AP({nodeRef:T,disabled:w.hidden||!D,noDragClassName:p,handleSelector:w.dragHandle,nodeId:e,isSelectable:M,nodeClickDistance:y}),I=IP();if(w.hidden)return null;const B=Bo(w),P=L5(w),L=M||D||t||n||r||s,_=n?ae=>n(ae,{...N.userNode}):void 0,G=r?ae=>r(ae,{...N.userNode}):void 0,Z=s?ae=>s(ae,{...N.userNode}):void 0,U=i?ae=>i(ae,{...N.userNode}):void 0,se=a?ae=>a(ae,{...N.userNode}):void 0,ue=ae=>{const{selectNodesOnDrag:Ne,nodeDragThreshold:Pe}=A.getState();M&&(!Ne||!D||Pe>0)&&ww({id:e,store:A,nodeRef:T}),t&&t(ae,{...N.userNode})},de=ae=>{if(!(eP(ae.nativeEvent)||g)){if(H_.includes(ae.key)&&M){const Ne=ae.key==="Escape";ww({id:e,store:A,unselect:Ne,nodeRef:T})}else if(D&&w.selected&&Object.prototype.hasOwnProperty.call(em,ae.key)){ae.preventDefault();const{ariaLabelConfig:Ne}=A.getState();A.setState({ariaLiveMessage:Ne["node.a11yDescription.ariaLiveMessage"]({direction:ae.key.replace("Arrow","").toLowerCase(),x:~~N.positionAbsolute.x,y:~~N.positionAbsolute.y})}),I({direction:em[ae.key],factor:ae.shiftKey?4:1})}}},me=()=>{var nt;if(g||!((nt=T.current)!=null&&nt.matches(":focus-visible")))return;const{transform:ae,width:Ne,height:Pe,autoPanOnNodeFocus:be,setCenter:Ie}=A.getState();if(!be)return;Zb(new Map([[e,w]]),{x:0,y:0,width:Ne,height:Pe},ae,!0).length>0||Ie(w.position.x+B.width/2,w.position.y+B.height/2,{zoom:ae[2]})};return o.jsx("div",{className:lr(["react-flow__node",`react-flow__node-${j}`,{[h]:D},w.className,{selected:w.selected,selectable:M,parent:C,draggable:D,dragging:O}]),ref:T,style:{zIndex:N.z,transform:`translate(${N.positionAbsolute.x}px,${N.positionAbsolute.y}px)`,pointerEvents:L?"all":"none",visibility:F?"visible":"hidden",...w.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:_,onMouseMove:G,onMouseLeave:Z,onContextMenu:U,onClick:ue,onDoubleClick:se,onKeyDown:$?de:void 0,tabIndex:$?0:void 0,onFocus:$?me:void 0,role:w.ariaRole??($?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${NP}-${v}`,"aria-label":w.ariaLabel,...w.domAttributes,children:o.jsx(C5,{value:e,children:o.jsx(R,{id:e,data:w.data,type:j,positionAbsoluteX:N.positionAbsolute.x,positionAbsoluteY:N.positionAbsolute.y,selected:w.selected??!1,selectable:M,draggable:D,deletable:w.deletable??!0,isConnectable:z,sourcePosition:w.sourcePosition,targetPosition:w.targetPosition,dragging:O,dragHandle:w.dragHandle,zIndex:N.z,parentId:w.parentId,...B})})})}var U5=m.memo(V5);const K5=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function LP(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,onError:i}=zt(K5,On),a=z5(e.onlyRenderVisibleElements),l=H5();return o.jsx("div",{className:"react-flow__nodes",style:Zm,children:a.map(u=>o.jsx(U5,{id:u,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:l,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,nodeClickDistance:e.nodeClickDistance,onError:i},u))})}LP.displayName="NodeRenderer";const q5=m.memo(LP);function Y5(e){return zt(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&&Oz({sourceNode:i,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[e]),On)}const G5=({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"})},X5=({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"})},AS={[gs.Arrow]:G5,[gs.ArrowClosed]:X5};function J5(e){const t=An();return m.useMemo(()=>{var s,i;return Object.prototype.hasOwnProperty.call(AS,e)?AS[e]:((i=(s=t.getState()).onError)==null||i.call(s,"009",uo.error009(e)),null)},[e])}const Q5=({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 u=J5(t);return u?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(u,{color:n,strokeWidth:a})}):null},OP=({defaultColor:e,rfId:t})=>{const n=zt(i=>i.edges),r=zt(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(Q5,{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};OP.displayName="MarkerDefinitions";var Z5=m.memo(OP);function MP({x:e,y:t,label:n,labelStyle:r,labelShowBg:s=!0,labelBgStyle:i,labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:u,className:d,...f}){const[c,p]=m.useState({x:1,y:0,width:0,height:0}),h=lr(["react-flow__edge-textwrapper",d]),g=m.useRef(null);return m.useEffect(()=>{if(g.current){const v=g.current.getBBox();p({x:v.x,y:v.y,width:v.width,height:v.height})}},[n]),n?o.jsxs("g",{transform:`translate(${e-c.width/2} ${t-c.height/2})`,className:h,visibility:c.width?"visible":"hidden",...f,children:[s&&o.jsx("rect",{width:c.width+2*a[0],x:-a[0],y:-a[1],height:c.height+2*a[1],className:"react-flow__edge-textbg",style:i,rx:l,ry:l}),o.jsx("text",{className:"react-flow__edge-text",y:c.height/2,dy:"0.3em",ref:g,style:r,children:n}),u]}):null}MP.displayName="EdgeText";const eB=m.memo(MP);function eg({path:e,labelX:t,labelY:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u,interactionWidth:d=20,...f}){return o.jsxs(o.Fragment,{children:[o.jsx("path",{...f,d:e,fill:"none",className:lr(["react-flow__edge-path",f.className])}),d?o.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:d,className:"react-flow__edge-interaction"}):null,r&&vi(t)&&vi(n)?o.jsx(eB,{x:t,y:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u}):null]})}function IS({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===Ke.Left||e===Ke.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function $P({sourceX:e,sourceY:t,sourcePosition:n=Ke.Bottom,targetX:r,targetY:s,targetPosition:i=Ke.Top}){const[a,l]=IS({pos:n,x1:e,y1:t,x2:r,y2:s}),[u,d]=IS({pos:i,x1:r,y1:s,x2:e,y2:t}),[f,c,p,h]=nP({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:a,sourceControlY:l,targetControlX:u,targetControlY:d});return[`M${e},${t} C${a},${l} ${u},${d} ${r},${s}`,f,c,p,h]}function DP(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:a,targetPosition:l,label:u,labelStyle:d,labelShowBg:f,labelBgStyle:c,labelBgPadding:p,labelBgBorderRadius:h,style:g,markerEnd:v,markerStart:k,interactionWidth:y})=>{const[b,w,N]=$P({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:l}),C=e.isInternal?void 0:t;return o.jsx(eg,{id:C,path:b,labelX:w,labelY:N,label:u,labelStyle:d,labelShowBg:f,labelBgStyle:c,labelBgPadding:p,labelBgBorderRadius:h,style:g,markerEnd:v,markerStart:k,interactionWidth:y})})}const tB=DP({isInternal:!1}),FP=DP({isInternal:!0});tB.displayName="SimpleBezierEdge";FP.displayName="SimpleBezierEdgeInternal";function zP(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:a,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:c,style:p,sourcePosition:h=Ke.Bottom,targetPosition:g=Ke.Top,markerEnd:v,markerStart:k,pathOptions:y,interactionWidth:b})=>{const[w,N,C]=hw({sourceX:n,sourceY:r,sourcePosition:h,targetX:s,targetY:i,targetPosition:g,borderRadius:y==null?void 0:y.borderRadius,offset:y==null?void 0:y.offset,stepPosition:y==null?void 0:y.stepPosition}),j=e.isInternal?void 0:t;return o.jsx(eg,{id:j,path:w,labelX:N,labelY:C,label:a,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:c,style:p,markerEnd:v,markerStart:k,interactionWidth:b})})}const BP=zP({isInternal:!1}),HP=zP({isInternal:!0});BP.displayName="SmoothStepEdge";HP.displayName="SmoothStepEdgeInternal";function WP(e){return m.memo(({id:t,...n})=>{var s;const r=e.isInternal?void 0:t;return o.jsx(BP,{...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 nB=WP({isInternal:!1}),VP=WP({isInternal:!0});nB.displayName="StepEdge";VP.displayName="StepEdgeInternal";function UP(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:a,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:c,style:p,markerEnd:h,markerStart:g,interactionWidth:v})=>{const[k,y,b]=iP({sourceX:n,sourceY:r,targetX:s,targetY:i}),w=e.isInternal?void 0:t;return o.jsx(eg,{id:w,path:k,labelX:y,labelY:b,label:a,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:c,style:p,markerEnd:h,markerStart:g,interactionWidth:v})})}const rB=UP({isInternal:!1}),KP=UP({isInternal:!0});rB.displayName="StraightEdge";KP.displayName="StraightEdgeInternal";function qP(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:a=Ke.Bottom,targetPosition:l=Ke.Top,label:u,labelStyle:d,labelShowBg:f,labelBgStyle:c,labelBgPadding:p,labelBgBorderRadius:h,style:g,markerEnd:v,markerStart:k,pathOptions:y,interactionWidth:b})=>{const[w,N,C]=rP({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:l,curvature:y==null?void 0:y.curvature}),j=e.isInternal?void 0:t;return o.jsx(eg,{id:j,path:w,labelX:N,labelY:C,label:u,labelStyle:d,labelShowBg:f,labelBgStyle:c,labelBgPadding:p,labelBgBorderRadius:h,style:g,markerEnd:v,markerStart:k,interactionWidth:b})})}const sB=qP({isInternal:!1}),YP=qP({isInternal:!0});sB.displayName="BezierEdge";YP.displayName="BezierEdgeInternal";const TS={default:YP,straight:KP,step:VP,smoothstep:HP,simplebezier:FP},RS={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},iB=(e,t,n)=>n===Ke.Left?e-t:n===Ke.Right?e+t:e,oB=(e,t,n)=>n===Ke.Top?e-t:n===Ke.Bottom?e+t:e,LS="react-flow__edgeupdater";function OS({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:lr([LS,`${LS}-${l}`]),cx:iB(t,r,e),cy:oB(n,r,e),r,stroke:"transparent",fill:"transparent"})}function aB({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:s,targetX:i,targetY:a,sourcePosition:l,targetPosition:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:c,setReconnecting:p,setUpdateHover:h}){const g=An(),v=(N,C)=>{if(N.button!==0)return;const{autoPanOnConnect:j,domNode:R,connectionMode:D,connectionRadius:M,lib:z,onConnectStart:$,cancelConnection:A,nodeLookup:F,rfId:T,panBy:O,updateConnection:I}=g.getState(),B=C.type==="target",P=(G,Z)=>{p(!1),c==null||c(G,n,C.type,Z)},L=G=>d==null?void 0:d(n,G),_=(G,Z)=>{p(!0),f==null||f(N,n,C.type),$==null||$(G,Z)};yw.onPointerDown(N.nativeEvent,{autoPanOnConnect:j,connectionMode:D,connectionRadius:M,domNode:R,handleId:C.id,nodeId:C.nodeId,nodeLookup:F,isTarget:B,edgeUpdaterType:C.type,lib:z,flowId:T,cancelConnection:A,panBy:O,isValidConnection:(...G)=>{var Z,U;return((U=(Z=g.getState()).isValidConnection)==null?void 0:U.call(Z,...G))??!0},onConnect:L,onConnectStart:_,onConnectEnd:(...G)=>{var Z,U;return(U=(Z=g.getState()).onConnectEnd)==null?void 0:U.call(Z,...G)},onReconnectEnd:P,updateConnection:I,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:N.currentTarget})},k=N=>v(N,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),y=N=>v(N,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),b=()=>h(!0),w=()=>h(!1);return o.jsxs(o.Fragment,{children:[(e===!0||e==="source")&&o.jsx(OS,{position:l,centerX:r,centerY:s,radius:t,onMouseDown:k,onMouseEnter:b,onMouseOut:w,type:"source"}),(e===!0||e==="target")&&o.jsx(OS,{position:u,centerX:i,centerY:a,radius:t,onMouseDown:y,onMouseEnter:b,onMouseOut:w,type:"target"})]})}function lB({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:s,onDoubleClick:i,onContextMenu:a,onMouseEnter:l,onMouseMove:u,onMouseLeave:d,reconnectRadius:f,onReconnect:c,onReconnectStart:p,onReconnectEnd:h,rfId:g,edgeTypes:v,noPanClassName:k,onError:y,disableKeyboardA11y:b}){let w=zt(Ie=>Ie.edgeLookup.get(e));const N=zt(Ie=>Ie.defaultEdgeOptions);w=N?{...N,...w}:w;let C=w.type||"default",j=(v==null?void 0:v[C])||TS[C];j===void 0&&(y==null||y("011",uo.error011(C)),C="default",j=(v==null?void 0:v.default)||TS.default);const R=!!(w.focusable||t&&typeof w.focusable>"u"),D=typeof c<"u"&&(w.reconnectable||n&&typeof w.reconnectable>"u"),M=!!(w.selectable||r&&typeof w.selectable>"u"),z=m.useRef(null),[$,A]=m.useState(!1),[F,T]=m.useState(!1),O=An(),{zIndex:I,sourceX:B,sourceY:P,targetX:L,targetY:_,sourcePosition:G,targetPosition:Z}=zt(m.useCallback(Ie=>{const _e=Ie.nodeLookup.get(w.source),nt=Ie.nodeLookup.get(w.target);if(!_e||!nt)return{zIndex:w.zIndex,...RS};const st=Bz({id:e,sourceNode:_e,targetNode:nt,sourceHandle:w.sourceHandle||null,targetHandle:w.targetHandle||null,connectionMode:Ie.connectionMode,onError:y});return{zIndex:Lz({selected:w.selected,zIndex:w.zIndex,sourceNode:_e,targetNode:nt,elevateOnSelect:Ie.elevateEdgesOnSelect,zIndexMode:Ie.zIndexMode}),...st||RS}},[w.source,w.target,w.sourceHandle,w.targetHandle,w.selected,w.zIndex]),On),U=m.useMemo(()=>w.markerStart?`url('#${mw(w.markerStart,g)}')`:void 0,[w.markerStart,g]),se=m.useMemo(()=>w.markerEnd?`url('#${mw(w.markerEnd,g)}')`:void 0,[w.markerEnd,g]);if(w.hidden||B===null||P===null||L===null||_===null)return null;const ue=Ie=>{var Je;const{addSelectedEdges:_e,unselectNodesAndEdges:nt,multiSelectionActive:st}=O.getState();M&&(O.setState({nodesSelectionActive:!1}),w.selected&&st?(nt({nodes:[],edges:[w]}),(Je=z.current)==null||Je.blur()):_e([e])),s&&s(Ie,w)},de=i?Ie=>{i(Ie,{...w})}:void 0,me=a?Ie=>{a(Ie,{...w})}:void 0,ae=l?Ie=>{l(Ie,{...w})}:void 0,Ne=u?Ie=>{u(Ie,{...w})}:void 0,Pe=d?Ie=>{d(Ie,{...w})}:void 0,be=Ie=>{var _e;if(!b&&H_.includes(Ie.key)&&M){const{unselectNodesAndEdges:nt,addSelectedEdges:st}=O.getState();Ie.key==="Escape"?((_e=z.current)==null||_e.blur(),nt({edges:[w]})):st([e])}};return o.jsx("svg",{style:{zIndex:I},children:o.jsxs("g",{className:lr(["react-flow__edge",`react-flow__edge-${C}`,w.className,k,{selected:w.selected,animated:w.animated,inactive:!M&&!s,updating:$,selectable:M}]),onClick:ue,onDoubleClick:de,onContextMenu:me,onMouseEnter:ae,onMouseMove:Ne,onMouseLeave:Pe,onKeyDown:R?be:void 0,tabIndex:R?0:void 0,role:w.ariaRole??(R?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":w.ariaLabel===null?void 0:w.ariaLabel||`Edge from ${w.source} to ${w.target}`,"aria-describedby":R?`${jP}-${g}`:void 0,ref:z,...w.domAttributes,children:[!F&&o.jsx(j,{id:e,source:w.source,target:w.target,type:w.type,selected:w.selected,animated:w.animated,selectable:M,deletable:w.deletable??!0,label:w.label,labelStyle:w.labelStyle,labelShowBg:w.labelShowBg,labelBgStyle:w.labelBgStyle,labelBgPadding:w.labelBgPadding,labelBgBorderRadius:w.labelBgBorderRadius,sourceX:B,sourceY:P,targetX:L,targetY:_,sourcePosition:G,targetPosition:Z,data:w.data,style:w.style,sourceHandleId:w.sourceHandle,targetHandleId:w.targetHandle,markerStart:U,markerEnd:se,pathOptions:"pathOptions"in w?w.pathOptions:void 0,interactionWidth:w.interactionWidth}),D&&o.jsx(aB,{edge:w,isReconnectable:D,reconnectRadius:f,onReconnect:c,onReconnectStart:p,onReconnectEnd:h,sourceX:B,sourceY:P,targetX:L,targetY:_,sourcePosition:G,targetPosition:Z,setUpdateHover:A,setReconnecting:T})]})})}var cB=m.memo(lB);const uB=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function GP({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:s,onReconnect:i,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:u,onEdgeMouseLeave:d,onEdgeClick:f,reconnectRadius:c,onEdgeDoubleClick:p,onReconnectStart:h,onReconnectEnd:g,disableKeyboardA11y:v}){const{edgesFocusable:k,edgesReconnectable:y,elementsSelectable:b,onError:w}=zt(uB,On),N=Y5(t);return o.jsxs("div",{className:"react-flow__edges",children:[o.jsx(Z5,{defaultColor:e,rfId:n}),N.map(C=>o.jsx(cB,{id:C,edgesFocusable:k,edgesReconnectable:y,elementsSelectable:b,noPanClassName:s,onReconnect:i,onContextMenu:a,onMouseEnter:l,onMouseMove:u,onMouseLeave:d,onClick:f,reconnectRadius:c,onDoubleClick:p,onReconnectStart:h,onReconnectEnd:g,rfId:n,onError:w,edgeTypes:r,disableKeyboardA11y:v},C))]})}GP.displayName="EdgeRenderer";const dB=m.memo(GP),fB=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function pB({children:e}){const t=zt(fB);return o.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function hB(e){const t=Dl(),n=m.useRef(!1);m.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const mB=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function gB(e){const t=zt(mB),n=An();return m.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function yB(e){return e.connection.inProgress?{...e.connection,to:Pf(e.connection.to,e.transform)}:{...e.connection}}function xB(e){return yB}function wB(e){const t=xB();return zt(t,On)}const bB=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function vB({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:s,width:i,height:a,isValid:l,inProgress:u}=zt(bB,On);return!(i&&s&&u)?null:o.jsx("svg",{style:e,width:i,height:a,className:"react-flow__connectionline react-flow__container",children:o.jsx("g",{className:lr(["react-flow__connection",U_(l)]),children:o.jsx(XP,{style:t,type:n,CustomComponent:r,isValid:l})})})}const XP=({style:e,type:t=pa.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:s,from:i,fromNode:a,fromHandle:l,fromPosition:u,to:d,toNode:f,toHandle:c,toPosition:p,pointer:h}=wB();if(!s)return;if(n)return o.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:a,fromHandle:l,fromX:i.x,fromY:i.y,toX:d.x,toY:d.y,fromPosition:u,toPosition:p,connectionStatus:U_(r),toNode:f,toHandle:c,pointer:h});let g="";const v={sourceX:i.x,sourceY:i.y,sourcePosition:u,targetX:d.x,targetY:d.y,targetPosition:p};switch(t){case pa.Bezier:[g]=rP(v);break;case pa.SimpleBezier:[g]=$P(v);break;case pa.Step:[g]=hw({...v,borderRadius:0});break;case pa.SmoothStep:[g]=hw(v);break;default:[g]=iP(v)}return o.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};XP.displayName="ConnectionLine";const kB={};function MS(e=kB){m.useRef(e),An(),m.useEffect(()=>{},[e])}function SB(){An(),m.useRef(!1),m.useEffect(()=>{},[])}function JP({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:i,onEdgeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:u,onNodeMouseLeave:d,onNodeContextMenu:f,onSelectionContextMenu:c,onSelectionStart:p,onSelectionEnd:h,connectionLineType:g,connectionLineStyle:v,connectionLineComponent:k,connectionLineContainerStyle:y,selectionKeyCode:b,selectionOnDrag:w,selectionMode:N,multiSelectionKeyCode:C,panActivationKeyCode:j,zoomActivationKeyCode:R,deleteKeyCode:D,onlyRenderVisibleElements:M,elementsSelectable:z,defaultViewport:$,translateExtent:A,minZoom:F,maxZoom:T,preventScrolling:O,defaultMarkerColor:I,zoomOnScroll:B,zoomOnPinch:P,panOnScroll:L,panOnScrollSpeed:_,panOnScrollMode:G,zoomOnDoubleClick:Z,panOnDrag:U,onPaneClick:se,onPaneMouseEnter:ue,onPaneMouseMove:de,onPaneMouseLeave:me,onPaneScroll:ae,onPaneContextMenu:Ne,paneClickDistance:Pe,nodeClickDistance:be,onEdgeContextMenu:Ie,onEdgeMouseEnter:_e,onEdgeMouseMove:nt,onEdgeMouseLeave:st,reconnectRadius:Je,onReconnect:Ct,onReconnectStart:Be,onReconnectEnd:mt,noDragClassName:Gt,noWheelClassName:De,noPanClassName:en,disableKeyboardA11y:rn,nodeExtent:pn,rfId:Hn,viewport:le,onViewportChange:ve}){return MS(e),MS(t),SB(),hB(n),gB(le),o.jsx(D5,{onPaneClick:se,onPaneMouseEnter:ue,onPaneMouseMove:de,onPaneMouseLeave:me,onPaneContextMenu:Ne,onPaneScroll:ae,paneClickDistance:Pe,deleteKeyCode:D,selectionKeyCode:b,selectionOnDrag:w,selectionMode:N,onSelectionStart:p,onSelectionEnd:h,multiSelectionKeyCode:C,panActivationKeyCode:j,zoomActivationKeyCode:R,elementsSelectable:z,zoomOnScroll:B,zoomOnPinch:P,zoomOnDoubleClick:Z,panOnScroll:L,panOnScrollSpeed:_,panOnScrollMode:G,panOnDrag:U,defaultViewport:$,translateExtent:A,minZoom:F,maxZoom:T,onSelectionContextMenu:c,preventScrolling:O,noDragClassName:Gt,noWheelClassName:De,noPanClassName:en,disableKeyboardA11y:rn,onViewportChange:ve,isControlledViewport:!!le,children:o.jsxs(pB,{children:[o.jsx(dB,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:a,onReconnect:Ct,onReconnectStart:Be,onReconnectEnd:mt,onlyRenderVisibleElements:M,onEdgeContextMenu:Ie,onEdgeMouseEnter:_e,onEdgeMouseMove:nt,onEdgeMouseLeave:st,reconnectRadius:Je,defaultMarkerColor:I,noPanClassName:en,disableKeyboardA11y:rn,rfId:Hn}),o.jsx(vB,{style:v,type:g,component:k,containerStyle:y}),o.jsx("div",{className:"react-flow__edgelabel-renderer"}),o.jsx(q5,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:l,onNodeMouseMove:u,onNodeMouseLeave:d,onNodeContextMenu:f,nodeClickDistance:be,onlyRenderVisibleElements:M,noPanClassName:en,noDragClassName:Gt,disableKeyboardA11y:rn,nodeExtent:pn,rfId:Hn}),o.jsx("div",{className:"react-flow__viewport-portal"})]})})}JP.displayName="GraphView";const NB=m.memo(JP),$S=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:l,minZoom:u=.5,maxZoom:d=2,nodeOrigin:f,nodeExtent:c,zIndexMode:p="basic"}={})=>{const h=new Map,g=new Map,v=new Map,k=new Map,y=r??t??[],b=n??e??[],w=f??[0,0],N=c??Zd;lP(v,k,y);const{nodesInitialized:C}=gw(b,h,g,{nodeOrigin:w,nodeExtent:N,zIndexMode:p});let j=[0,0,1];if(a&&s&&i){const R=Ef(h,{filter:$=>!!(($.width||$.initialWidth)&&($.height||$.initialHeight))}),{x:D,y:M,zoom:z}=ev(R,s,i,u,d,(l==null?void 0:l.padding)??.1);j=[D,M,z]}return{rfId:"1",width:s??0,height:i??0,transform:j,nodes:b,nodesInitialized:C,nodeLookup:h,parentLookup:g,edges:y,edgeLookup:k,connectionLookup:v,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:u,maxZoom:d,translateExtent:Zd,nodeExtent:N,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Qc.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:w,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:{...V_},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:_z,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:W_,zIndexMode:p,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},jB=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:l,minZoom:u,maxZoom:d,nodeOrigin:f,nodeExtent:c,zIndexMode:p})=>V3((h,g)=>{async function v(){const{nodeLookup:k,panZoom:y,fitViewOptions:b,fitViewResolver:w,width:N,height:C,minZoom:j,maxZoom:R}=g();y&&(await Cz({nodes:k,width:N,height:C,panZoom:y,minZoom:j,maxZoom:R},b),w==null||w.resolve(!0),h({fitViewResolver:null}))}return{...$S({nodes:e,edges:t,width:s,height:i,fitView:a,fitViewOptions:l,minZoom:u,maxZoom:d,nodeOrigin:f,nodeExtent:c,defaultNodes:n,defaultEdges:r,zIndexMode:p}),setNodes:k=>{const{nodeLookup:y,parentLookup:b,nodeOrigin:w,elevateNodesOnSelect:N,fitViewQueued:C,zIndexMode:j,nodesSelectionActive:R}=g(),{nodesInitialized:D,hasSelectedNodes:M}=gw(k,y,b,{nodeOrigin:w,nodeExtent:c,elevateNodesOnSelect:N,checkEquality:!0,zIndexMode:j}),z=R&&M;C&&D?(v(),h({nodes:k,nodesInitialized:D,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:z})):h({nodes:k,nodesInitialized:D,nodesSelectionActive:z})},setEdges:k=>{const{connectionLookup:y,edgeLookup:b}=g();lP(y,b,k),h({edges:k})},setDefaultNodesAndEdges:(k,y)=>{if(k){const{setNodes:b}=g();b(k),h({hasDefaultNodes:!0})}if(y){const{setEdges:b}=g();b(y),h({hasDefaultEdges:!0})}},updateNodeInternals:k=>{const{triggerNodeChanges:y,nodeLookup:b,parentLookup:w,domNode:N,nodeOrigin:C,nodeExtent:j,debug:R,fitViewQueued:D,zIndexMode:M}=g(),{changes:z,updatedInternals:$}=Gz(k,b,w,N,C,j,M);$&&(Uz(b,w,{nodeOrigin:C,nodeExtent:j,zIndexMode:M}),D?(v(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),(z==null?void 0:z.length)>0&&(R&&console.log("React Flow: trigger node changes",z),y==null||y(z)))},updateNodePositions:(k,y=!1)=>{const b=[];let w=[];const{nodeLookup:N,triggerNodeChanges:C,connection:j,updateConnection:R,onNodesChangeMiddlewareMap:D}=g();for(const[M,z]of k){const $=N.get(M),A=!!($!=null&&$.expandParent&&($!=null&&$.parentId)&&(z!=null&&z.position)),F={id:M,type:"position",position:A?{x:Math.max(0,z.position.x),y:Math.max(0,z.position.y)}:z.position,dragging:y};if($&&j.inProgress&&j.fromNode.id===$.id){const T=Rl($,j.fromHandle,Ke.Left,!0);R({...j,from:T})}A&&$.parentId&&b.push({id:M,parentId:$.parentId,rect:{...z.internals.positionAbsolute,width:z.measured.width??0,height:z.measured.height??0}}),w.push(F)}if(b.length>0){const{parentLookup:M,nodeOrigin:z}=g(),$=ov(b,N,M,z);w.push(...$)}for(const M of D.values())w=M(w);C(w)},triggerNodeChanges:k=>{const{onNodesChange:y,setNodes:b,nodes:w,hasDefaultNodes:N,debug:C}=g();if(k!=null&&k.length){if(N){const j=Zh(k,w);b(j)}C&&console.log("React Flow: trigger node changes",k),y==null||y(k)}},triggerEdgeChanges:k=>{const{onEdgesChange:y,setEdges:b,edges:w,hasDefaultEdges:N,debug:C}=g();if(k!=null&&k.length){if(N){const j=av(k,w);b(j)}C&&console.log("React Flow: trigger edge changes",k),y==null||y(k)}},addSelectedNodes:k=>{const{multiSelectionActive:y,edgeLookup:b,nodeLookup:w,triggerNodeChanges:N,triggerEdgeChanges:C}=g();if(y){const j=k.map(R=>dl(R,!0));N(j);return}N(_c(w,new Set([...k]),!0)),C(_c(b))},addSelectedEdges:k=>{const{multiSelectionActive:y,edgeLookup:b,nodeLookup:w,triggerNodeChanges:N,triggerEdgeChanges:C}=g();if(y){const j=k.map(R=>dl(R,!0));C(j);return}C(_c(b,new Set([...k]))),N(_c(w,new Set,!0))},unselectNodesAndEdges:({nodes:k,edges:y}={})=>{const{edges:b,nodes:w,nodeLookup:N,triggerNodeChanges:C,triggerEdgeChanges:j}=g(),R=k||w,D=y||b,M=[];for(const $ of R){if(!$.selected)continue;const A=N.get($.id);A&&(A.selected=!1),M.push(dl($.id,!1))}const z=[];for(const $ of D)$.selected&&z.push(dl($.id,!1));C(M),j(z)},setMinZoom:k=>{const{panZoom:y,maxZoom:b}=g();y==null||y.setScaleExtent([k,b]),h({minZoom:k})},setMaxZoom:k=>{const{panZoom:y,minZoom:b}=g();y==null||y.setScaleExtent([b,k]),h({maxZoom:k})},setTranslateExtent:k=>{var y;(y=g().panZoom)==null||y.setTranslateExtent(k),h({translateExtent:k})},resetSelectedElements:()=>{const{edges:k,nodes:y,triggerNodeChanges:b,triggerEdgeChanges:w,elementsSelectable:N}=g();if(!N)return;const C=y.reduce((R,D)=>D.selected?[...R,dl(D.id,!1)]:R,[]),j=k.reduce((R,D)=>D.selected?[...R,dl(D.id,!1)]:R,[]);b(C),w(j)},setNodeExtent:k=>{const{nodes:y,nodeLookup:b,parentLookup:w,nodeOrigin:N,elevateNodesOnSelect:C,nodeExtent:j,zIndexMode:R}=g();k[0][0]===j[0][0]&&k[0][1]===j[0][1]&&k[1][0]===j[1][0]&&k[1][1]===j[1][1]||(gw(y,b,w,{nodeOrigin:N,nodeExtent:k,elevateNodesOnSelect:C,checkEquality:!1,zIndexMode:R}),h({nodeExtent:k}))},panBy:k=>{const{transform:y,width:b,height:w,panZoom:N,translateExtent:C}=g();return Xz({delta:k,panZoom:N,transform:y,translateExtent:C,width:b,height:w})},setCenter:async(k,y,b)=>{const{width:w,height:N,maxZoom:C,panZoom:j}=g();if(!j)return Promise.resolve(!1);const R=typeof(b==null?void 0:b.zoom)<"u"?b.zoom:C;return await j.setViewport({x:w/2-k*R,y:N/2-y*R,zoom:R},{duration:b==null?void 0:b.duration,ease:b==null?void 0:b.ease,interpolate:b==null?void 0:b.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{h({connection:{...V_}})},updateConnection:k=>{h({connection:k})},reset:()=>h({...$S()})}},Object.is);function cv({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:i,initialMinZoom:a,initialMaxZoom:l,initialFitViewOptions:u,fitView:d,nodeOrigin:f,nodeExtent:c,zIndexMode:p,children:h}){const[g]=m.useState(()=>jB({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:d,minZoom:a,maxZoom:l,fitViewOptions:u,nodeOrigin:f,nodeExtent:c,zIndexMode:p}));return o.jsx(U3,{value:g,children:o.jsx(p5,{children:h})})}function CB({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:s,width:i,height:a,fitView:l,fitViewOptions:u,minZoom:d,maxZoom:f,nodeOrigin:c,nodeExtent:p,zIndexMode:h}){return m.useContext(Qm)?o.jsx(o.Fragment,{children:e}):o.jsx(cv,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:s,initialWidth:i,initialHeight:a,fitView:l,initialFitViewOptions:u,initialMinZoom:d,initialMaxZoom:f,nodeOrigin:c,nodeExtent:p,zIndexMode:h,children:e})}const EB={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function _B({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i,edgeTypes:a,onNodeClick:l,onEdgeClick:u,onInit:d,onMove:f,onMoveStart:c,onMoveEnd:p,onConnect:h,onConnectStart:g,onConnectEnd:v,onClickConnectStart:k,onClickConnectEnd:y,onNodeMouseEnter:b,onNodeMouseMove:w,onNodeMouseLeave:N,onNodeContextMenu:C,onNodeDoubleClick:j,onNodeDragStart:R,onNodeDrag:D,onNodeDragStop:M,onNodesDelete:z,onEdgesDelete:$,onDelete:A,onSelectionChange:F,onSelectionDragStart:T,onSelectionDrag:O,onSelectionDragStop:I,onSelectionContextMenu:B,onSelectionStart:P,onSelectionEnd:L,onBeforeDelete:_,connectionMode:G,connectionLineType:Z=pa.Bezier,connectionLineStyle:U,connectionLineComponent:se,connectionLineContainerStyle:ue,deleteKeyCode:de="Backspace",selectionKeyCode:me="Shift",selectionOnDrag:ae=!1,selectionMode:Ne=ef.Full,panActivationKeyCode:Pe="Space",multiSelectionKeyCode:be=nf()?"Meta":"Control",zoomActivationKeyCode:Ie=nf()?"Meta":"Control",snapToGrid:_e,snapGrid:nt,onlyRenderVisibleElements:st=!1,selectNodesOnDrag:Je,nodesDraggable:Ct,autoPanOnNodeFocus:Be,nodesConnectable:mt,nodesFocusable:Gt,nodeOrigin:De=CP,edgesFocusable:en,edgesReconnectable:rn,elementsSelectable:pn=!0,defaultViewport:Hn=s5,minZoom:le=.5,maxZoom:ve=2,translateExtent:qe=Zd,preventScrolling:ge=!0,nodeExtent:lt,defaultMarkerColor:Bt="#b1b1b7",zoomOnScroll:hn=!0,zoomOnPinch:In=!0,panOnScroll:mn=!1,panOnScrollSpeed:cr=.5,panOnScrollMode:Xt=kl.Free,zoomOnDoubleClick:Wn=!0,panOnDrag:Tn=!0,onPaneClick:br,onPaneMouseEnter:xe,onPaneMouseMove:Me,onPaneMouseLeave:Qe,onPaneScroll:re,onPaneContextMenu:ke,paneClickDistance:et=1,nodeClickDistance:Mt=0,children:Nn,onReconnect:sn,onReconnectStart:Gr,onReconnectEnd:Xr,onEdgeContextMenu:bs,onEdgeDoubleClick:vr,onEdgeMouseEnter:Wo,onEdgeMouseMove:Zn,onEdgeMouseLeave:vs,reconnectRadius:Ai=10,onNodesChange:mo,onEdgesChange:ni,noDragClassName:Vn="nodrag",noWheelClassName:Re="nowheel",noPanClassName:Qt="nopan",fitView:er,fitViewOptions:gt,connectOnClick:Fs,attributionPosition:Un,proOptions:Mn,defaultEdgeOptions:ks,elevateNodesOnSelect:at=!0,elevateEdgesOnSelect:Kt=!1,disableKeyboardA11y:Ht=!1,autoPanOnConnect:jn,autoPanOnNodeDrag:Ye,autoPanSpeed:tr,connectionRadius:Br,isValidConnection:go,onError:kr,style:Ii,id:Ss,nodeDragThreshold:ri,connectionDragThreshold:zs,viewport:si,onViewportChange:tn,width:Ns,height:ii,colorMode:Tr="light",debug:Sr,onScroll:V,ariaLabelConfig:fe,zIndexMode:Te="basic",...Ae},Ge){const $t=Ss||"1",yt=l5(Tr),Kn=m.useCallback($n=>{$n.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),V==null||V($n)},[V]);return o.jsx("div",{"data-testid":"rf__wrapper",...Ae,onScroll:Kn,style:{...Ii,...EB},ref:Ge,className:lr(["react-flow",s,yt]),id:Ss,role:"application",children:o.jsxs(CB,{nodes:e,edges:t,width:Ns,height:ii,fitView:er,fitViewOptions:gt,minZoom:le,maxZoom:ve,nodeOrigin:De,nodeExtent:lt,zIndexMode:Te,children:[o.jsx(a5,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:g,onConnectEnd:v,onClickConnectStart:k,onClickConnectEnd:y,nodesDraggable:Ct,autoPanOnNodeFocus:Be,nodesConnectable:mt,nodesFocusable:Gt,edgesFocusable:en,edgesReconnectable:rn,elementsSelectable:pn,elevateNodesOnSelect:at,elevateEdgesOnSelect:Kt,minZoom:le,maxZoom:ve,nodeExtent:lt,onNodesChange:mo,onEdgesChange:ni,snapToGrid:_e,snapGrid:nt,connectionMode:G,translateExtent:qe,connectOnClick:Fs,defaultEdgeOptions:ks,fitView:er,fitViewOptions:gt,onNodesDelete:z,onEdgesDelete:$,onDelete:A,onNodeDragStart:R,onNodeDrag:D,onNodeDragStop:M,onSelectionDrag:O,onSelectionDragStart:T,onSelectionDragStop:I,onMove:f,onMoveStart:c,onMoveEnd:p,noPanClassName:Qt,nodeOrigin:De,rfId:$t,autoPanOnConnect:jn,autoPanOnNodeDrag:Ye,autoPanSpeed:tr,onError:kr,connectionRadius:Br,isValidConnection:go,selectNodesOnDrag:Je,nodeDragThreshold:ri,connectionDragThreshold:zs,onBeforeDelete:_,debug:Sr,ariaLabelConfig:fe,zIndexMode:Te}),o.jsx(NB,{onInit:d,onNodeClick:l,onEdgeClick:u,onNodeMouseEnter:b,onNodeMouseMove:w,onNodeMouseLeave:N,onNodeContextMenu:C,onNodeDoubleClick:j,nodeTypes:i,edgeTypes:a,connectionLineType:Z,connectionLineStyle:U,connectionLineComponent:se,connectionLineContainerStyle:ue,selectionKeyCode:me,selectionOnDrag:ae,selectionMode:Ne,deleteKeyCode:de,multiSelectionKeyCode:be,panActivationKeyCode:Pe,zoomActivationKeyCode:Ie,onlyRenderVisibleElements:st,defaultViewport:Hn,translateExtent:qe,minZoom:le,maxZoom:ve,preventScrolling:ge,zoomOnScroll:hn,zoomOnPinch:In,zoomOnDoubleClick:Wn,panOnScroll:mn,panOnScrollSpeed:cr,panOnScrollMode:Xt,panOnDrag:Tn,onPaneClick:br,onPaneMouseEnter:xe,onPaneMouseMove:Me,onPaneMouseLeave:Qe,onPaneScroll:re,onPaneContextMenu:ke,paneClickDistance:et,nodeClickDistance:Mt,onSelectionContextMenu:B,onSelectionStart:P,onSelectionEnd:L,onReconnect:sn,onReconnectStart:Gr,onReconnectEnd:Xr,onEdgeContextMenu:bs,onEdgeDoubleClick:vr,onEdgeMouseEnter:Wo,onEdgeMouseMove:Zn,onEdgeMouseLeave:vs,reconnectRadius:Ai,defaultMarkerColor:Bt,noDragClassName:Vn,noWheelClassName:Re,noPanClassName:Qt,rfId:$t,disableKeyboardA11y:Ht,nodeExtent:lt,viewport:si,onViewportChange:tn}),o.jsx(r5,{onSelectionChange:F}),Nn,o.jsx(Q3,{proOptions:Mn,position:Un}),o.jsx(J3,{rfId:$t,disableKeyboardA11y:Ht})]})})}var QP=_P(_B);function uv(){const e=An();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 ZP(e){const[t,n]=m.useState(e),r=m.useCallback(s=>n(i=>Zh(s,i)),[]);return[t,n,r]}function eA(e){const[t,n]=m.useState(e),r=m.useCallback(s=>n(i=>av(s,i)),[]);return[t,n,r]}function PB({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:lr(["react-flow__background-pattern",n,r])})}function AB({radius:e,className:t}){return o.jsx("circle",{cx:e,cy:e,r:e,className:lr(["react-flow__background-pattern","dots",t])})}var Ea;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ea||(Ea={}));const IB={[Ea.Dots]:1,[Ea.Lines]:1,[Ea.Cross]:6},TB=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function tA({id:e,variant:t=Ea.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=0,color:a,bgColor:l,style:u,className:d,patternClassName:f}){const c=m.useRef(null),{transform:p,patternId:h}=zt(TB,On),g=r||IB[t],v=t===Ea.Dots,k=t===Ea.Cross,y=Array.isArray(n)?n:[n,n],b=[y[0]*p[2]||1,y[1]*p[2]||1],w=g*p[2],N=Array.isArray(i)?i:[i,i],C=k?[w,w]:b,j=[N[0]*p[2]||1+C[0]/2,N[1]*p[2]||1+C[1]/2],R=`${h}${e||""}`;return o.jsxs("svg",{className:lr(["react-flow__background",d]),style:{...u,...Zm,"--xy-background-color-props":l,"--xy-background-pattern-color-props":a},ref:c,"data-testid":"rf__background",children:[o.jsx("pattern",{id:R,x:p[0]%b[0],y:p[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${j[0]},-${j[1]})`,children:v?o.jsx(AB,{radius:w/2,className:f}):o.jsx(PB,{dimensions:C,lineWidth:s,variant:t,className:f})}),o.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${R})`})]})}tA.displayName="Background";const nA=m.memo(tA);function RB(){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 LB(){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 OB(){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 MB(){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 $B(){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 Tp({children:e,className:t,...n}){return o.jsx("button",{type:"button",className:lr(["react-flow__controls-button",t]),...n,children:e})}const DB=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function rA({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:a,onFitView:l,onInteractiveChange:u,className:d,children:f,position:c="bottom-left",orientation:p="vertical","aria-label":h}){const g=An(),{isInteractive:v,minZoomReached:k,maxZoomReached:y,ariaLabelConfig:b}=zt(DB,On),{zoomIn:w,zoomOut:N,fitView:C}=Dl(),j=()=>{w(),i==null||i()},R=()=>{N(),a==null||a()},D=()=>{C(s),l==null||l()},M=()=>{g.setState({nodesDraggable:!v,nodesConnectable:!v,elementsSelectable:!v}),u==null||u(!v)},z=p==="horizontal"?"horizontal":"vertical";return o.jsxs(su,{className:lr(["react-flow__controls",z,d]),position:c,style:e,"data-testid":"rf__controls","aria-label":h??b["controls.ariaLabel"],children:[t&&o.jsxs(o.Fragment,{children:[o.jsx(Tp,{onClick:j,className:"react-flow__controls-zoomin",title:b["controls.zoomIn.ariaLabel"],"aria-label":b["controls.zoomIn.ariaLabel"],disabled:y,children:o.jsx(RB,{})}),o.jsx(Tp,{onClick:R,className:"react-flow__controls-zoomout",title:b["controls.zoomOut.ariaLabel"],"aria-label":b["controls.zoomOut.ariaLabel"],disabled:k,children:o.jsx(LB,{})})]}),n&&o.jsx(Tp,{className:"react-flow__controls-fitview",onClick:D,title:b["controls.fitView.ariaLabel"],"aria-label":b["controls.fitView.ariaLabel"],children:o.jsx(OB,{})}),r&&o.jsx(Tp,{className:"react-flow__controls-interactive",onClick:M,title:b["controls.interactive.ariaLabel"],"aria-label":b["controls.interactive.ariaLabel"],children:v?o.jsx($B,{}):o.jsx(MB,{})}),f]})}rA.displayName="Controls";const FB=m.memo(rA);function zB({id:e,x:t,y:n,width:r,height:s,style:i,color:a,strokeColor:l,strokeWidth:u,className:d,borderRadius:f,shapeRendering:c,selected:p,onClick:h}){const{background:g,backgroundColor:v}=i||{},k=a||g||v;return o.jsx("rect",{className:lr(["react-flow__minimap-node",{selected:p},d]),x:t,y:n,rx:f,ry:f,width:r,height:s,style:{fill:k,stroke:l,strokeWidth:u},shapeRendering:c,onClick:h?y=>h(y,e):void 0})}const BB=m.memo(zB),HB=e=>e.nodes.map(t=>t.id),Sy=e=>e instanceof Function?e:()=>e;function WB({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:i=BB,onClick:a}){const l=zt(HB,On),u=Sy(t),d=Sy(e),f=Sy(n),c=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return o.jsx(o.Fragment,{children:l.map(p=>o.jsx(UB,{id:p,nodeColorFunc:u,nodeStrokeColorFunc:d,nodeClassNameFunc:f,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:i,onClick:a,shapeRendering:c},p))})}function VB({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:i,shapeRendering:a,NodeComponent:l,onClick:u}){const{node:d,x:f,y:c,width:p,height:h}=zt(g=>{const v=g.nodeLookup.get(e);if(!v)return{node:void 0,x:0,y:0,width:0,height:0};const k=v.internals.userNode,{x:y,y:b}=v.internals.positionAbsolute,{width:w,height:N}=Bo(k);return{node:k,x:y,y:b,width:w,height:N}},On);return!d||d.hidden||!J_(d)?null:o.jsx(l,{x:f,y:c,width:p,height:h,style:d.style,selected:!!d.selected,className:r(d),color:t(d),borderRadius:s,strokeColor:n(d),strokeWidth:i,shapeRendering:a,onClick:u,id:d.id})}const UB=m.memo(VB);var KB=m.memo(WB);const qB=200,YB=150,GB=e=>!e.hidden,XB=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?X_(Ef(e.nodeLookup,{filter:GB}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},JB="react-flow__minimap-desc";function sA({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:a,nodeComponent:l,bgColor:u,maskColor:d,maskStrokeColor:f,maskStrokeWidth:c,position:p="bottom-right",onClick:h,onNodeClick:g,pannable:v=!1,zoomable:k=!1,ariaLabel:y,inversePan:b,zoomStep:w=1,offsetScale:N=5}){const C=An(),j=m.useRef(null),{boundingRect:R,viewBB:D,rfId:M,panZoom:z,translateExtent:$,flowWidth:A,flowHeight:F,ariaLabelConfig:T}=zt(XB,On),O=(e==null?void 0:e.width)??qB,I=(e==null?void 0:e.height)??YB,B=R.width/O,P=R.height/I,L=Math.max(B,P),_=L*O,G=L*I,Z=N*L,U=R.x-(_-R.width)/2-Z,se=R.y-(G-R.height)/2-Z,ue=_+Z*2,de=G+Z*2,me=`${JB}-${M}`,ae=m.useRef(0),Ne=m.useRef();ae.current=L,m.useEffect(()=>{if(j.current&&z)return Ne.current=i3({domNode:j.current,panZoom:z,getTransform:()=>C.getState().transform,getViewScale:()=>ae.current}),()=>{var _e;(_e=Ne.current)==null||_e.destroy()}},[z]),m.useEffect(()=>{var _e;(_e=Ne.current)==null||_e.update({translateExtent:$,width:A,height:F,inversePan:b,pannable:v,zoomStep:w,zoomable:k})},[v,k,b,w,$,A,F]);const Pe=h?_e=>{var Je;const[nt,st]=((Je=Ne.current)==null?void 0:Je.pointer(_e))||[0,0];h(_e,{x:nt,y:st})}:void 0,be=g?m.useCallback((_e,nt)=>{const st=C.getState().nodeLookup.get(nt).internals.userNode;g(_e,st)},[]):void 0,Ie=y??T["minimap.ariaLabel"];return o.jsx(su,{position:p,style:{...e,"--xy-minimap-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-stroke-width-props":typeof c=="number"?c*L: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:lr(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:o.jsxs("svg",{width:O,height:I,viewBox:`${U} ${se} ${ue} ${de}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":me,ref:j,onClick:Pe,children:[Ie&&o.jsx("title",{id:me,children:Ie}),o.jsx(KB,{onClick:be,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:a,nodeComponent:l}),o.jsx("path",{className:"react-flow__minimap-mask",d:`M${U-Z},${se-Z}h${ue+Z*2}v${de+Z*2}h${-ue-Z*2}z
|
|
66
|
+
M${D.x},${D.y}h${D.width}v${D.height}h${-D.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}sA.displayName="MiniMap";const QB=m.memo(sA),ZB=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,e4={[nu.Line]:"right",[nu.Handle]:"bottom-right"};function t4({nodeId:e,position:t,variant:n=nu.Handle,className:r,style:s=void 0,children:i,color:a,minWidth:l=10,minHeight:u=10,maxWidth:d=Number.MAX_VALUE,maxHeight:f=Number.MAX_VALUE,keepAspectRatio:c=!1,resizeDirection:p,autoScale:h=!0,shouldResize:g,onResizeStart:v,onResize:k,onResizeEnd:y}){const b=TP(),w=typeof e=="string"?e:b,N=An(),C=m.useRef(null),j=n===nu.Handle,R=zt(m.useCallback(ZB(j&&h),[j,h]),On),D=m.useRef(null),M=t??e4[n];m.useEffect(()=>{if(!(!C.current||!w))return D.current||(D.current=w3({domNode:C.current,nodeId:w,getStoreItems:()=>{const{nodeLookup:$,transform:A,snapGrid:F,snapToGrid:T,nodeOrigin:O,domNode:I}=N.getState();return{nodeLookup:$,transform:A,snapGrid:F,snapToGrid:T,nodeOrigin:O,paneDomNode:I}},onChange:($,A)=>{const{triggerNodeChanges:F,nodeLookup:T,parentLookup:O,nodeOrigin:I}=N.getState(),B=[],P={x:$.x,y:$.y},L=T.get(w);if(L&&L.expandParent&&L.parentId){const _=L.origin??I,G=$.width??L.measured.width??0,Z=$.height??L.measured.height??0,U={id:L.id,parentId:L.parentId,rect:{width:G,height:Z,...Q_({x:$.x??L.position.x,y:$.y??L.position.y},{width:G,height:Z},L.parentId,T,_)}},se=ov([U],T,O,I);B.push(...se),P.x=$.x?Math.max(_[0]*G,$.x):void 0,P.y=$.y?Math.max(_[1]*Z,$.y):void 0}if(P.x!==void 0&&P.y!==void 0){const _={id:w,type:"position",position:{...P}};B.push(_)}if($.width!==void 0&&$.height!==void 0){const G={id:w,type:"dimensions",resizing:!0,setAttributes:p?p==="horizontal"?"width":"height":!0,dimensions:{width:$.width,height:$.height}};B.push(G)}for(const _ of A){const G={..._,type:"position"};B.push(G)}F(B)},onEnd:({width:$,height:A})=>{const F={id:w,type:"dimensions",resizing:!1,dimensions:{width:$,height:A}};N.getState().triggerNodeChanges([F])}})),D.current.update({controlPosition:M,boundaries:{minWidth:l,minHeight:u,maxWidth:d,maxHeight:f},keepAspectRatio:c,resizeDirection:p,onResizeStart:v,onResize:k,onResizeEnd:y,shouldResize:g}),()=>{var $;($=D.current)==null||$.destroy()}},[M,l,u,d,f,c,v,k,y,g]);const z=M.split("-");return o.jsx("div",{className:lr(["react-flow__resize-control","nodrag",...z,n,r]),ref:C,style:{...s,scale:R,...a&&{[j?"backgroundColor":"borderColor"]:a}},children:i})}const n4=m.memo(t4);function r4(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const s4=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,i4=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,o4={};function DS(e,t){return(o4.jsx?i4:s4).test(e)}const a4=/[ \t\n\f\r]/g;function l4(e){return typeof e=="object"?e.type==="text"?FS(e.value):!1:FS(e)}function FS(e){return e.replace(a4,"")===""}let Af=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};Af.prototype.normal={};Af.prototype.property={};Af.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 Af(n,r,t)}function bw(e){return e.toLowerCase()}class ws{constructor(t,n){this.attribute=n,this.property=t}}ws.prototype.attribute="";ws.prototype.booleanish=!1;ws.prototype.boolean=!1;ws.prototype.commaOrSpaceSeparated=!1;ws.prototype.commaSeparated=!1;ws.prototype.defined=!1;ws.prototype.mustUseProperty=!1;ws.prototype.number=!1;ws.prototype.overloadedBoolean=!1;ws.prototype.property="";ws.prototype.spaceSeparated=!1;ws.prototype.space=void 0;let c4=0;const Et=Fl(),ir=Fl(),vw=Fl(),Ce=Fl(),bn=Fl(),zc=Fl(),Es=Fl();function Fl(){return 2**++c4}const kw=Object.freeze(Object.defineProperty({__proto__:null,boolean:Et,booleanish:ir,commaOrSpaceSeparated:Es,commaSeparated:zc,number:Ce,overloadedBoolean:vw,spaceSeparated:bn},Symbol.toStringTag,{value:"Module"})),Ny=Object.keys(kw);class dv extends ws{constructor(t,n,r,s){let i=-1;if(super(t,n),zS(this,"space",s),typeof r=="number")for(;++i<Ny.length;){const a=Ny[i];zS(this,Ny[i],(r&kw[a])===kw[a])}}}dv.prototype.defined=!0;function zS(e,t,n){n&&(e[t]=n)}function pu(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new dv(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[bw(r)]=r,n[bw(i.attribute)]=r}return new Af(t,n,e.space)}const oA=pu({properties:{ariaActiveDescendant:null,ariaAtomic:ir,ariaAutoComplete:null,ariaBusy:ir,ariaChecked:ir,ariaColCount:Ce,ariaColIndex:Ce,ariaColSpan:Ce,ariaControls:bn,ariaCurrent:null,ariaDescribedBy:bn,ariaDetails:null,ariaDisabled:ir,ariaDropEffect:bn,ariaErrorMessage:null,ariaExpanded:ir,ariaFlowTo:bn,ariaGrabbed:ir,ariaHasPopup:null,ariaHidden:ir,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:bn,ariaLevel:Ce,ariaLive:null,ariaModal:ir,ariaMultiLine:ir,ariaMultiSelectable:ir,ariaOrientation:null,ariaOwns:bn,ariaPlaceholder:null,ariaPosInSet:Ce,ariaPressed:ir,ariaReadOnly:ir,ariaRelevant:null,ariaRequired:ir,ariaRoleDescription:bn,ariaRowCount:Ce,ariaRowIndex:Ce,ariaRowSpan:Ce,ariaSelected:ir,ariaSetSize:Ce,ariaSort:null,ariaValueMax:Ce,ariaValueMin:Ce,ariaValueNow:Ce,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function aA(e,t){return t in e?e[t]:t}function lA(e,t){return aA(e,t.toLowerCase())}const u4=pu({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:zc,acceptCharset:bn,accessKey:bn,action:null,allow:null,allowFullScreen:Et,allowPaymentRequest:Et,allowUserMedia:Et,alt:null,as:null,async:Et,autoCapitalize:null,autoComplete:bn,autoFocus:Et,autoPlay:Et,blocking:bn,capture:null,charSet:null,checked:Et,cite:null,className:bn,cols:Ce,colSpan:null,content:null,contentEditable:ir,controls:Et,controlsList:bn,coords:Ce|zc,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Et,defer:Et,dir:null,dirName:null,disabled:Et,download:vw,draggable:ir,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Et,formTarget:null,headers:bn,height:Ce,hidden:vw,high:Ce,href:null,hrefLang:null,htmlFor:bn,httpEquiv:bn,id:null,imageSizes:null,imageSrcSet:null,inert:Et,inputMode:null,integrity:null,is:null,isMap:Et,itemId:null,itemProp:bn,itemRef:bn,itemScope:Et,itemType:bn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Et,low:Ce,manifest:null,max:null,maxLength:Ce,media:null,method:null,min:null,minLength:Ce,multiple:Et,muted:Et,name:null,nonce:null,noModule:Et,noValidate:Et,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:Et,optimum:Ce,pattern:null,ping:bn,placeholder:null,playsInline:Et,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Et,referrerPolicy:null,rel:bn,required:Et,reversed:Et,rows:Ce,rowSpan:Ce,sandbox:bn,scope:null,scoped:Et,seamless:Et,selected:Et,shadowRootClonable:Et,shadowRootDelegatesFocus:Et,shadowRootMode:null,shape:null,size:Ce,sizes:null,slot:null,span:Ce,spellCheck:ir,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ce,step:null,style:null,tabIndex:Ce,target:null,title:null,translate:null,type:null,typeMustMatch:Et,useMap:null,value:ir,width:Ce,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:bn,axis:null,background:null,bgColor:null,border:Ce,borderColor:null,bottomMargin:Ce,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Et,declare:Et,event:null,face:null,frame:null,frameBorder:null,hSpace:Ce,leftMargin:Ce,link:null,longDesc:null,lowSrc:null,marginHeight:Ce,marginWidth:Ce,noResize:Et,noHref:Et,noShade:Et,noWrap:Et,object:null,profile:null,prompt:null,rev:null,rightMargin:Ce,rules:null,scheme:null,scrolling:ir,standby:null,summary:null,text:null,topMargin:Ce,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ce,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Et,disableRemotePlayback:Et,prefix:null,property:null,results:Ce,security:null,unselectable:null},space:"html",transform:lA}),d4=pu({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:Es,accentHeight:Ce,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ce,amplitude:Ce,arabicForm:null,ascent:Ce,attributeName:null,attributeType:null,azimuth:Ce,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ce,by:null,calcMode:null,capHeight:Ce,className:bn,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Ce,diffuseConstant:Ce,direction:null,display:null,dur:null,divisor:Ce,dominantBaseline:null,download:Et,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ce,enableBackground:null,end:null,event:null,exponent:Ce,externalResourcesRequired:null,fill:null,fillOpacity:Ce,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:zc,g2:zc,glyphName:zc,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ce,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ce,horizOriginX:Ce,horizOriginY:Ce,id:null,ideographic:Ce,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ce,k:Ce,k1:Ce,k2:Ce,k3:Ce,k4:Ce,kernelMatrix:Es,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ce,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Ce,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Ce,overlineThickness:Ce,paintOrder:null,panose1:null,path:null,pathLength:Ce,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:bn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ce,pointsAtY:Ce,pointsAtZ:Ce,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Es,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Es,rev:Es,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Es,requiredFeatures:Es,requiredFonts:Es,requiredFormats:Es,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Ce,specularExponent:Ce,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ce,strikethroughThickness:Ce,string:null,stroke:null,strokeDashArray:Es,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ce,strokeOpacity:Ce,strokeWidth:null,style:null,surfaceScale:Ce,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Es,tabIndex:Ce,tableValues:null,target:null,targetX:Ce,targetY:Ce,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Es,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ce,underlineThickness:Ce,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ce,values:null,vAlphabetic:Ce,vMathematical:Ce,vectorEffect:null,vHanging:Ce,vIdeographic:Ce,version:null,vertAdvY:Ce,vertOriginX:Ce,vertOriginY:Ce,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ce,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:aA}),cA=pu({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()}}),uA=pu({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:lA}),dA=pu({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),f4={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"},p4=/[A-Z]/g,BS=/-[a-z]/g,h4=/^data[-\w.:]+$/i;function m4(e,t){const n=bw(t);let r=t,s=ws;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&h4.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(BS,y4);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!BS.test(i)){let a=i.replace(p4,g4);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}s=dv}return new s(r,t)}function g4(e){return"-"+e.toLowerCase()}function y4(e){return e.charAt(1).toUpperCase()}const x4=iA([oA,u4,cA,uA,dA],"html"),fv=iA([oA,d4,cA,uA,dA],"svg");function w4(e){return e.join(" ").trim()}var pv={},HS=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,b4=/\n/g,v4=/^\s*/,k4=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,S4=/^:\s*/,N4=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,j4=/^[;\s]*/,C4=/^\s+|\s+$/g,E4=`
|
|
67
|
+
`,WS="/",VS="*",pl="",_4="comment",P4="declaration";function A4(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function s(g){var v=g.match(b4);v&&(n+=v.length);var k=g.lastIndexOf(E4);r=~k?g.length-k:r+g.length}function i(){var g={line:n,column:r};return function(v){return v.position=new a(g),d(),v}}function a(g){this.start=g,this.end={line:n,column:r},this.source=t.source}a.prototype.content=e;function l(g){var v=new Error(t.source+":"+n+":"+r+": "+g);if(v.reason=g,v.filename=t.source,v.line=n,v.column=r,v.source=e,!t.silent)throw v}function u(g){var v=g.exec(e);if(v){var k=v[0];return s(k),e=e.slice(k.length),v}}function d(){u(v4)}function f(g){var v;for(g=g||[];v=c();)v!==!1&&g.push(v);return g}function c(){var g=i();if(!(WS!=e.charAt(0)||VS!=e.charAt(1))){for(var v=2;pl!=e.charAt(v)&&(VS!=e.charAt(v)||WS!=e.charAt(v+1));)++v;if(v+=2,pl===e.charAt(v-1))return l("End of comment missing");var k=e.slice(2,v-2);return r+=2,s(k),e=e.slice(v),r+=2,g({type:_4,comment:k})}}function p(){var g=i(),v=u(k4);if(v){if(c(),!u(S4))return l("property missing ':'");var k=u(N4),y=g({type:P4,property:US(v[0].replace(HS,pl)),value:k?US(k[0].replace(HS,pl)):pl});return u(j4),y}}function h(){var g=[];f(g);for(var v;v=p();)v!==!1&&(g.push(v),f(g));return g}return d(),h()}function US(e){return e?e.replace(C4,pl):pl}var I4=A4,T4=Id&&Id.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(pv,"__esModule",{value:!0});pv.default=L4;const R4=T4(I4);function L4(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,R4.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 tg={};Object.defineProperty(tg,"__esModule",{value:!0});tg.camelCase=void 0;var O4=/^--[a-zA-Z0-9_-]+$/,M4=/-([a-z])/g,$4=/^[^-]+$/,D4=/^-(webkit|moz|ms|o|khtml)-/,F4=/^-(ms)-/,z4=function(e){return!e||$4.test(e)||O4.test(e)},B4=function(e,t){return t.toUpperCase()},KS=function(e,t){return"".concat(t,"-")},H4=function(e,t){return t===void 0&&(t={}),z4(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(F4,KS):e=e.replace(D4,KS),e.replace(M4,B4))};tg.camelCase=H4;var W4=Id&&Id.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},V4=W4(pv),U4=tg;function Sw(e,t){var n={};return!e||typeof e!="string"||(0,V4.default)(e,function(r,s){r&&s&&(n[(0,U4.camelCase)(r,t)]=s)}),n}Sw.default=Sw;var K4=Sw;const q4=$a(K4),fA=pA("end"),hv=pA("start");function pA(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 Y4(e){const t=hv(e),n=fA(e);if(t&&n)return{start:t,end:n}}function Nd(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?qS(e.position):"start"in e||"end"in e?qS(e):"line"in e||"column"in e?Nw(e):""}function Nw(e){return YS(e&&e.line)+":"+YS(e&&e.column)}function qS(e){return Nw(e&&e.start)+"-"+Nw(e&&e.end)}function YS(e){return e&&typeof e=="number"?e:1}class Fr 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 u=r.indexOf(":");u===-1?i.ruleId=r:(i.source=r.slice(0,u),i.ruleId=r.slice(u+1))}if(!i.place&&i.ancestors&&i.ancestors){const u=i.ancestors[i.ancestors.length-1];u&&(i.place=u.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=l?l.line:void 0,this.name=Nd(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}}Fr.prototype.file="";Fr.prototype.name="";Fr.prototype.reason="";Fr.prototype.message="";Fr.prototype.stack="";Fr.prototype.column=void 0;Fr.prototype.line=void 0;Fr.prototype.ancestors=void 0;Fr.prototype.cause=void 0;Fr.prototype.fatal=void 0;Fr.prototype.place=void 0;Fr.prototype.ruleId=void 0;Fr.prototype.source=void 0;const mv={}.hasOwnProperty,G4=new Map,X4=/[A-Z]/g,J4=new Set(["table","tbody","thead","tfoot","tr"]),Q4=new Set(["td","th"]),hA="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Z4(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=aH(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=oH(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"?fv:x4,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=mA(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function mA(e,t,n){if(t.type==="element")return eH(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return tH(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return rH(e,t,n);if(t.type==="mdxjsEsm")return nH(e,t);if(t.type==="root")return sH(e,t,n);if(t.type==="text")return iH(e,t)}function eH(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=fv,e.schema=s),e.ancestors.push(t);const i=yA(e,t.tagName,!1),a=lH(e,t);let l=yv(e,t);return J4.has(t.tagName)&&(l=l.filter(function(u){return typeof u=="string"?!l4(u):!0})),gA(e,a,i,t),gv(a,l),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function tH(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)}of(e,t.position)}function nH(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);of(e,t.position)}function rH(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=fv,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:yA(e,t.name,!0),a=cH(e,t),l=yv(e,t);return gA(e,a,i,t),gv(a,l),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function sH(e,t,n){const r={};return gv(r,yv(e,t)),e.create(t,e.Fragment,r,n)}function iH(e,t){return t.value}function gA(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function gv(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function oH(e,t,n){return r;function r(s,i,a,l){const d=Array.isArray(a.children)?n:t;return l?d(i,a,l):d(i,a)}}function aH(e,t){return n;function n(r,s,i,a){const l=Array.isArray(i.children),u=hv(r);return t(s,i,a,l,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function lH(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&mv.call(t.properties,s)){const i=uH(e,s,t.properties[s]);if(i){const[a,l]=i;e.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&Q4.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 cH(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 of(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 of(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function yv(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:G4;for(;++r<t.children.length;){const i=t.children[r];let a;if(e.passKeys){const u=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(u){const d=s.get(u)||0;a=u+"-"+d,s.set(u,d+1)}}const l=mA(e,i,a);l!==void 0&&n.push(l)}return n}function uH(e,t,n){const r=m4(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?r4(n):w4(n)),r.property==="style"){let s=typeof n=="object"?n:dH(e,String(n));return e.stylePropertyNameCase==="css"&&(s=fH(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?f4[r.property]||r.property:r.attribute,n]}}function dH(e,t){try{return q4(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new Fr("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=hA+"#cannot-parse-style-attribute",s}}function yA(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=DS(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=DS(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return mv.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);of(e)}function of(e,t){const n=new Fr("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=hA+"#cannot-handle-mdx-estrees-without-createevaluater",n}function fH(e){const t={};let n;for(n in e)mv.call(e,n)&&(t[pH(n)]=e[n]);return t}function pH(e){let t=e.replace(X4,hH);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function hH(e){return"-"+e.toLowerCase()}const jy={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"]},mH={};function gH(e,t){const n=mH,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return xA(e,r,s)}function xA(e,t,n){if(yH(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 GS(e.children,t,n)}return Array.isArray(e)?GS(e,t,n):""}function GS(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=xA(e[s],t,n);return r.join("")}function yH(e){return!!(e&&typeof e=="object")}const XS=document.createElement("i");function xv(e){const t="&"+e+";";XS.innerHTML=t;const n=XS.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function fo(e,t,n,r){const s=e.length;let i=0,a;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);i<r.length;)a=r.slice(i,i+1e4),a.unshift(t,0),e.splice(...a),i+=1e4,t+=1e4}function Xs(e,t){return e.length>0?(fo(e,e.length,0,t),e):t}const JS={}.hasOwnProperty;function xH(e){const t={};let n=-1;for(;++n<e.length;)wH(t,e[n]);return t}function wH(e,t){let n;for(n in t){const s=(JS.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let a;if(i)for(a in i){JS.call(s,a)||(s[a]=[]);const l=i[a];bH(s[a],Array.isArray(l)?l:l?[l]:[])}}}function bH(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);fo(e,0,0,r)}function wA(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 Bc(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const no=Ha(/[A-Za-z]/),Ts=Ha(/[\dA-Za-z]/),vH=Ha(/[#-'*+\--9=?A-Z^-~]/);function jw(e){return e!==null&&(e<32||e===127)}const Cw=Ha(/\d/),kH=Ha(/[\dA-Fa-f]/),SH=Ha(/[!-/:-@[-`{-~]/);function xt(e){return e!==null&&e<-2}function ys(e){return e!==null&&(e<0||e===32)}function Jt(e){return e===-2||e===-1||e===32}const NH=Ha(new RegExp("\\p{P}|\\p{S}","u")),jH=Ha(/\s/);function Ha(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function hu(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const i=e.charCodeAt(n);let a="";if(i===37&&Ts(e.charCodeAt(n+1))&&Ts(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 kn(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(u){return Jt(u)?(e.enter(n),l(u)):t(u)}function l(u){return Jt(u)&&i++<s?(e.consume(u),l):(e.exit(n),t(u))}}const CH={tokenize:EH};function EH(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"),kn(e,t,"linePrefix")}function s(l){return e.enter("paragraph"),i(l)}function i(l){const u=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=u),n=u,a(l)}function a(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return xt(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),a)}}const _H={tokenize:PH},QS={tokenize:AH};function PH(e){const t=this,n=[];let r=0,s,i,a;return l;function l(w){if(r<n.length){const N=n[r];return t.containerState=N[1],e.attempt(N[0].continuation,u,d)(w)}return d(w)}function u(w){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&b();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}y(r);let R=N;for(;R<t.events.length;)t.events[R][1].end={...j},R++;return fo(t.events,C+1,0,t.events.slice(N)),t.events.length=R,d(w)}return l(w)}function d(w){if(r===n.length){if(!s)return p(w);if(s.currentConstruct&&s.currentConstruct.concrete)return g(w);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(QS,f,c)(w)}function f(w){return s&&b(),y(r),p(w)}function c(w){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,g(w)}function p(w){return t.containerState={},e.attempt(QS,h,g)(w)}function h(w){return r++,n.push([t.currentConstruct,t.containerState]),p(w)}function g(w){if(w===null){s&&b(),y(0),e.consume(w);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),v(w)}function v(w){if(w===null){k(e.exit("chunkFlow"),!0),y(0),e.consume(w);return}return xt(w)?(e.consume(w),k(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(w),v)}function k(w,N){const C=t.sliceStream(w);if(N&&C.push(null),w.previous=i,i&&(i.next=w),i=w,s.defineSkip(w.start),s.write(C),t.parser.lazy[w.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 R=t.events.length;let D=R,M,z;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){if(M){z=t.events[D][1].end;break}M=!0}for(y(r),j=R;j<t.events.length;)t.events[j][1].end={...z},j++;fo(t.events,D+1,0,t.events.slice(R)),t.events.length=j}}function y(w){let N=n.length;for(;N-- >w;){const C=n[N];t.containerState=C[1],C[0].exit.call(t,e)}n.length=w}function b(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function AH(e,t,n){return kn(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ZS(e){if(e===null||ys(e)||jH(e))return 1;if(NH(e))return 2}function wv(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 Ew={name:"attention",resolveAll:IH,tokenize:TH};function IH(e,t){let n=-1,r,s,i,a,l,u,d,f;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;u=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const c={...e[r][1].end},p={...e[n][1].start};eN(c,-u),eN(p,u),a={type:u>1?"strongSequence":"emphasisSequence",start:c,end:{...e[r][1].end}},l={type:u>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},i={type:u>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:u>1?"strong":"emphasis",start:{...a.start},end:{...l.end}},e[r][1].end={...a.start},e[n][1].start={...l.end},d=[],e[r][1].end.offset-e[r][1].start.offset&&(d=Xs(d,[["enter",e[r][1],t],["exit",e[r][1],t]])),d=Xs(d,[["enter",s,t],["enter",a,t],["exit",a,t],["enter",i,t]]),d=Xs(d,wv(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),d=Xs(d,[["exit",i,t],["enter",l,t],["exit",l,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(f=2,d=Xs(d,[["enter",e[n][1],t],["exit",e[n][1],t]])):f=0,fo(e,r-1,n-r+3,d),n=r+d.length-f-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function TH(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=ZS(r);let i;return a;function a(u){return i=u,e.enter("attentionSequence"),l(u)}function l(u){if(u===i)return e.consume(u),l;const d=e.exit("attentionSequence"),f=ZS(u),c=!f||f===2&&s||n.includes(u),p=!s||s===2&&f||n.includes(r);return d._open=!!(i===42?c:c&&(s||!p)),d._close=!!(i===42?p:p&&(f||!c)),t(u)}}function eN(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const RH={name:"autolink",tokenize:LH};function LH(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 no(h)?(e.consume(h),a):h===64?n(h):d(h)}function a(h){return h===43||h===45||h===46||Ts(h)?(r=1,l(h)):d(h)}function l(h){return h===58?(e.consume(h),r=0,u):(h===43||h===45||h===46||Ts(h))&&r++<32?(e.consume(h),l):(r=0,d(h))}function u(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||jw(h)?n(h):(e.consume(h),u)}function d(h){return h===64?(e.consume(h),f):vH(h)?(e.consume(h),d):n(h)}function f(h){return Ts(h)?c(h):n(h)}function c(h){return h===46?(e.consume(h),r=0,f):h===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):p(h)}function p(h){if((h===45||Ts(h))&&r++<63){const g=h===45?p:c;return e.consume(h),g}return n(h)}}const ng={partial:!0,tokenize:OH};function OH(e,t,n){return r;function r(i){return Jt(i)?kn(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||xt(i)?t(i):n(i)}}const bA={continuation:{tokenize:$H},exit:DH,name:"blockQuote",tokenize:MH};function MH(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 Jt(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function $H(e,t,n){const r=this;return s;function s(a){return Jt(a)?kn(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):i(a)}function i(a){return e.attempt(bA,t,n)(a)}}function DH(e){e.exit("blockQuote")}const vA={name:"characterEscape",tokenize:FH};function FH(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 SH(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const kA={name:"characterReference",tokenize:zH};function zH(e,t,n){const r=this;let s=0,i,a;return l;function l(c){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),u}function u(c){return c===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(c),e.exit("characterReferenceMarkerNumeric"),d):(e.enter("characterReferenceValue"),i=31,a=Ts,f(c))}function d(c){return c===88||c===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(c),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,a=kH,f):(e.enter("characterReferenceValue"),i=7,a=Cw,f(c))}function f(c){if(c===59&&s){const p=e.exit("characterReferenceValue");return a===Ts&&!xv(r.sliceSerialize(p))?n(c):(e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(c)&&s++<i?(e.consume(c),f):n(c)}}const tN={partial:!0,tokenize:HH},nN={concrete:!0,name:"codeFenced",tokenize:BH};function BH(e,t,n){const r=this,s={partial:!0,tokenize:C};let i=0,a=0,l;return u;function u(j){return d(j)}function d(j){const R=r.events[r.events.length-1];return i=R&&R[1].type==="linePrefix"?R[2].sliceSerialize(R[1],!0).length:0,l=j,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),f(j)}function f(j){return j===l?(a++,e.consume(j),f):a<3?n(j):(e.exit("codeFencedFenceSequence"),Jt(j)?kn(e,c,"whitespace")(j):c(j))}function c(j){return j===null||xt(j)?(e.exit("codeFencedFence"),r.interrupt?t(j):e.check(tN,v,N)(j)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(j))}function p(j){return j===null||xt(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(j)):Jt(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),kn(e,h,"whitespace")(j)):j===96&&j===l?n(j):(e.consume(j),p)}function h(j){return j===null||xt(j)?c(j):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(j))}function g(j){return j===null||xt(j)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(j)):j===96&&j===l?n(j):(e.consume(j),g)}function v(j){return e.attempt(s,N,k)(j)}function k(j){return e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),y}function y(j){return i>0&&Jt(j)?kn(e,b,"linePrefix",i+1)(j):b(j)}function b(j){return j===null||xt(j)?e.check(tN,v,N)(j):(e.enter("codeFlowValue"),w(j))}function w(j){return j===null||xt(j)?(e.exit("codeFlowValue"),b(j)):(e.consume(j),w)}function N(j){return e.exit("codeFenced"),t(j)}function C(j,R,D){let M=0;return z;function z(O){return j.enter("lineEnding"),j.consume(O),j.exit("lineEnding"),$}function $(O){return j.enter("codeFencedFence"),Jt(O)?kn(j,A,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):A(O)}function A(O){return O===l?(j.enter("codeFencedFenceSequence"),F(O)):D(O)}function F(O){return O===l?(M++,j.consume(O),F):M>=a?(j.exit("codeFencedFenceSequence"),Jt(O)?kn(j,T,"whitespace")(O):T(O)):D(O)}function T(O){return O===null||xt(O)?(j.exit("codeFencedFence"),R(O)):D(O)}}}function HH(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 Cy={name:"codeIndented",tokenize:VH},WH={partial:!0,tokenize:UH};function VH(e,t,n){const r=this;return s;function s(d){return e.enter("codeIndented"),kn(e,i,"linePrefix",5)(d)}function i(d){const f=r.events[r.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?a(d):n(d)}function a(d){return d===null?u(d):xt(d)?e.attempt(WH,a,u)(d):(e.enter("codeFlowValue"),l(d))}function l(d){return d===null||xt(d)?(e.exit("codeFlowValue"),a(d)):(e.consume(d),l)}function u(d){return e.exit("codeIndented"),t(d)}}function UH(e,t,n){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?n(a):xt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):kn(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):xt(a)?s(a):n(a)}}const KH={name:"codeText",previous:YH,resolve:qH,tokenize:GH};function qH(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 YH(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function GH(e,t,n){let r=0,s,i;return a;function a(c){return e.enter("codeText"),e.enter("codeTextSequence"),l(c)}function l(c){return c===96?(e.consume(c),r++,l):(e.exit("codeTextSequence"),u(c))}function u(c){return c===null?n(c):c===32?(e.enter("space"),e.consume(c),e.exit("space"),u):c===96?(i=e.enter("codeTextSequence"),s=0,f(c)):xt(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u):(e.enter("codeTextData"),d(c))}function d(c){return c===null||c===32||c===96||xt(c)?(e.exit("codeTextData"),u(c)):(e.consume(c),d)}function f(c){return c===96?(e.consume(c),s++,f):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(c)):(i.type="codeTextData",d(c))}}class XH{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&&Yu(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),Yu(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Yu(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);Yu(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Yu(this.left,n.reverse())}}}function Yu(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 SA(e){const t={};let n=-1,r,s,i,a,l,u,d;const f=new XH(e);for(;++n<f.length;){for(;n in t;)n=t[n];if(r=f.get(n),n&&r[1].type==="chunkFlow"&&f.get(n-1)[1].type==="listItemPrefix"&&(u=r[1]._tokenizer.events,i=0,i<u.length&&u[i][1].type==="lineEndingBlank"&&(i+=2),i<u.length&&u[i][1].type==="content"))for(;++i<u.length&&u[i][1].type!=="content";)u[i][1].type==="chunkText"&&(u[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,JH(f,n)),n=t[n],d=!0);else if(r[1]._container){for(i=n,s=void 0;i--;)if(a=f.get(i),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(s&&(f.get(s)[1].type="lineEndingBlank"),a[1].type="lineEnding",s=i);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;s&&(r[1].end={...f.get(s)[1].start},l=f.slice(s,n),l.unshift(r),f.splice(s,n-s+1,l))}}return fo(e,0,Number.POSITIVE_INFINITY,f.slice(0)),!d}function JH(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,u=[],d={};let f,c,p=-1,h=n,g=0,v=0;const k=[v];for(;h;){for(;e.get(++s)[1]!==h;);i.push(s),h._tokenizer||(f=r.sliceStream(h),h.next||f.push(null),c&&a.defineSkip(h.start),h._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(f),h._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),c=h,h=h.next}for(h=n;++p<l.length;)l[p][0]==="exit"&&l[p-1][0]==="enter"&&l[p][1].type===l[p-1][1].type&&l[p][1].start.line!==l[p][1].end.line&&(v=p+1,k.push(v),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(),p=k.length;p--;){const y=l.slice(k[p],k[p+1]),b=i.pop();u.push([b,b+y.length-1]),e.splice(b,2,y)}for(u.reverse(),p=-1;++p<u.length;)d[g+u[p][0]]=g+u[p][1],g+=u[p][1]-u[p][0]-1;return d}const QH={resolve:e8,tokenize:t8},ZH={partial:!0,tokenize:n8};function e8(e){return SA(e),e}function t8(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):xt(l)?e.check(ZH,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 n8(e,t,n){const r=this;return s;function s(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),kn(e,i,"linePrefix")}function i(a){if(a===null||xt(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 NA(e,t,n,r,s,i,a,l,u){const d=u||Number.POSITIVE_INFINITY;let f=0;return c;function c(y){return y===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(y),e.exit(i),p):y===null||y===32||y===41||jw(y)?n(y):(e.enter(r),e.enter(a),e.enter(l),e.enter("chunkString",{contentType:"string"}),v(y))}function p(y){return y===62?(e.enter(i),e.consume(y),e.exit(i),e.exit(s),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),h(y))}function h(y){return y===62?(e.exit("chunkString"),e.exit(l),p(y)):y===null||y===60||xt(y)?n(y):(e.consume(y),y===92?g:h)}function g(y){return y===60||y===62||y===92?(e.consume(y),h):h(y)}function v(y){return!f&&(y===null||y===41||ys(y))?(e.exit("chunkString"),e.exit(l),e.exit(a),e.exit(r),t(y)):f<d&&y===40?(e.consume(y),f++,v):y===41?(e.consume(y),f--,v):y===null||y===32||y===40||jw(y)?n(y):(e.consume(y),y===92?k:v)}function k(y){return y===40||y===41||y===92?(e.consume(y),v):v(y)}}function jA(e,t,n,r,s,i){const a=this;let l=0,u;return d;function d(h){return e.enter(r),e.enter(s),e.consume(h),e.exit(s),e.enter(i),f}function f(h){return l>999||h===null||h===91||h===93&&!u||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):xt(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),f):(e.enter("chunkString",{contentType:"string"}),c(h))}function c(h){return h===null||h===91||h===93||xt(h)||l++>999?(e.exit("chunkString"),f(h)):(e.consume(h),u||(u=!Jt(h)),h===92?p:c)}function p(h){return h===91||h===92||h===93?(e.consume(h),l++,c):c(h)}}function CA(e,t,n,r,s,i){let a;return l;function l(p){return p===34||p===39||p===40?(e.enter(r),e.enter(s),e.consume(p),e.exit(s),a=p===40?41:p,u):n(p)}function u(p){return p===a?(e.enter(s),e.consume(p),e.exit(s),e.exit(r),t):(e.enter(i),d(p))}function d(p){return p===a?(e.exit(i),u(a)):p===null?n(p):xt(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),kn(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===a||p===null||xt(p)?(e.exit("chunkString"),d(p)):(e.consume(p),p===92?c:f)}function c(p){return p===a||p===92?(e.consume(p),f):f(p)}}function jd(e,t){let n;return r;function r(s){return xt(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):Jt(s)?kn(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const r8={name:"definition",tokenize:i8},s8={partial:!0,tokenize:o8};function i8(e,t,n){const r=this;let s;return i;function i(h){return e.enter("definition"),a(h)}function a(h){return jA.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function l(h){return s=Bc(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),u):n(h)}function u(h){return ys(h)?jd(e,d)(h):d(h)}function d(h){return NA(e,f,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function f(h){return e.attempt(s8,c,c)(h)}function c(h){return Jt(h)?kn(e,p,"whitespace")(h):p(h)}function p(h){return h===null||xt(h)?(e.exit("definition"),r.parser.defined.push(s),t(h)):n(h)}}function o8(e,t,n){return r;function r(l){return ys(l)?jd(e,s)(l):n(l)}function s(l){return CA(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return Jt(l)?kn(e,a,"whitespace")(l):a(l)}function a(l){return l===null||xt(l)?t(l):n(l)}}const a8={name:"hardBreakEscape",tokenize:l8};function l8(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return xt(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const c8={name:"headingAtx",resolve:u8,tokenize:d8};function u8(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"},fo(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function d8(e,t,n){let r=0;return s;function s(f){return e.enter("atxHeading"),i(f)}function i(f){return e.enter("atxHeadingSequence"),a(f)}function a(f){return f===35&&r++<6?(e.consume(f),a):f===null||ys(f)?(e.exit("atxHeadingSequence"),l(f)):n(f)}function l(f){return f===35?(e.enter("atxHeadingSequence"),u(f)):f===null||xt(f)?(e.exit("atxHeading"),t(f)):Jt(f)?kn(e,l,"whitespace")(f):(e.enter("atxHeadingText"),d(f))}function u(f){return f===35?(e.consume(f),u):(e.exit("atxHeadingSequence"),l(f))}function d(f){return f===null||f===35||ys(f)?(e.exit("atxHeadingText"),l(f)):(e.consume(f),d)}}const f8=["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"],rN=["pre","script","style","textarea"],p8={concrete:!0,name:"htmlFlow",resolveTo:g8,tokenize:y8},h8={partial:!0,tokenize:w8},m8={partial:!0,tokenize:x8};function g8(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 y8(e,t,n){const r=this;let s,i,a,l,u;return d;function d(U){return f(U)}function f(U){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(U),c}function c(U){return U===33?(e.consume(U),p):U===47?(e.consume(U),i=!0,v):U===63?(e.consume(U),s=3,r.interrupt?t:_):no(U)?(e.consume(U),a=String.fromCharCode(U),k):n(U)}function p(U){return U===45?(e.consume(U),s=2,h):U===91?(e.consume(U),s=5,l=0,g):no(U)?(e.consume(U),s=4,r.interrupt?t:_):n(U)}function h(U){return U===45?(e.consume(U),r.interrupt?t:_):n(U)}function g(U){const se="CDATA[";return U===se.charCodeAt(l++)?(e.consume(U),l===se.length?r.interrupt?t:A:g):n(U)}function v(U){return no(U)?(e.consume(U),a=String.fromCharCode(U),k):n(U)}function k(U){if(U===null||U===47||U===62||ys(U)){const se=U===47,ue=a.toLowerCase();return!se&&!i&&rN.includes(ue)?(s=1,r.interrupt?t(U):A(U)):f8.includes(a.toLowerCase())?(s=6,se?(e.consume(U),y):r.interrupt?t(U):A(U)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(U):i?b(U):w(U))}return U===45||Ts(U)?(e.consume(U),a+=String.fromCharCode(U),k):n(U)}function y(U){return U===62?(e.consume(U),r.interrupt?t:A):n(U)}function b(U){return Jt(U)?(e.consume(U),b):z(U)}function w(U){return U===47?(e.consume(U),z):U===58||U===95||no(U)?(e.consume(U),N):Jt(U)?(e.consume(U),w):z(U)}function N(U){return U===45||U===46||U===58||U===95||Ts(U)?(e.consume(U),N):C(U)}function C(U){return U===61?(e.consume(U),j):Jt(U)?(e.consume(U),C):w(U)}function j(U){return U===null||U===60||U===61||U===62||U===96?n(U):U===34||U===39?(e.consume(U),u=U,R):Jt(U)?(e.consume(U),j):D(U)}function R(U){return U===u?(e.consume(U),u=null,M):U===null||xt(U)?n(U):(e.consume(U),R)}function D(U){return U===null||U===34||U===39||U===47||U===60||U===61||U===62||U===96||ys(U)?C(U):(e.consume(U),D)}function M(U){return U===47||U===62||Jt(U)?w(U):n(U)}function z(U){return U===62?(e.consume(U),$):n(U)}function $(U){return U===null||xt(U)?A(U):Jt(U)?(e.consume(U),$):n(U)}function A(U){return U===45&&s===2?(e.consume(U),I):U===60&&s===1?(e.consume(U),B):U===62&&s===4?(e.consume(U),G):U===63&&s===3?(e.consume(U),_):U===93&&s===5?(e.consume(U),L):xt(U)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(h8,Z,F)(U)):U===null||xt(U)?(e.exit("htmlFlowData"),F(U)):(e.consume(U),A)}function F(U){return e.check(m8,T,Z)(U)}function T(U){return e.enter("lineEnding"),e.consume(U),e.exit("lineEnding"),O}function O(U){return U===null||xt(U)?F(U):(e.enter("htmlFlowData"),A(U))}function I(U){return U===45?(e.consume(U),_):A(U)}function B(U){return U===47?(e.consume(U),a="",P):A(U)}function P(U){if(U===62){const se=a.toLowerCase();return rN.includes(se)?(e.consume(U),G):A(U)}return no(U)&&a.length<8?(e.consume(U),a+=String.fromCharCode(U),P):A(U)}function L(U){return U===93?(e.consume(U),_):A(U)}function _(U){return U===62?(e.consume(U),G):U===45&&s===2?(e.consume(U),_):A(U)}function G(U){return U===null||xt(U)?(e.exit("htmlFlowData"),Z(U)):(e.consume(U),G)}function Z(U){return e.exit("htmlFlow"),t(U)}}function x8(e,t,n){const r=this;return s;function s(a){return xt(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 w8(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(ng,t,n)}}const b8={name:"htmlText",tokenize:v8};function v8(e,t,n){const r=this;let s,i,a;return l;function l(_){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(_),u}function u(_){return _===33?(e.consume(_),d):_===47?(e.consume(_),C):_===63?(e.consume(_),w):no(_)?(e.consume(_),D):n(_)}function d(_){return _===45?(e.consume(_),f):_===91?(e.consume(_),i=0,g):no(_)?(e.consume(_),b):n(_)}function f(_){return _===45?(e.consume(_),h):n(_)}function c(_){return _===null?n(_):_===45?(e.consume(_),p):xt(_)?(a=c,B(_)):(e.consume(_),c)}function p(_){return _===45?(e.consume(_),h):c(_)}function h(_){return _===62?I(_):_===45?p(_):c(_)}function g(_){const G="CDATA[";return _===G.charCodeAt(i++)?(e.consume(_),i===G.length?v:g):n(_)}function v(_){return _===null?n(_):_===93?(e.consume(_),k):xt(_)?(a=v,B(_)):(e.consume(_),v)}function k(_){return _===93?(e.consume(_),y):v(_)}function y(_){return _===62?I(_):_===93?(e.consume(_),y):v(_)}function b(_){return _===null||_===62?I(_):xt(_)?(a=b,B(_)):(e.consume(_),b)}function w(_){return _===null?n(_):_===63?(e.consume(_),N):xt(_)?(a=w,B(_)):(e.consume(_),w)}function N(_){return _===62?I(_):w(_)}function C(_){return no(_)?(e.consume(_),j):n(_)}function j(_){return _===45||Ts(_)?(e.consume(_),j):R(_)}function R(_){return xt(_)?(a=R,B(_)):Jt(_)?(e.consume(_),R):I(_)}function D(_){return _===45||Ts(_)?(e.consume(_),D):_===47||_===62||ys(_)?M(_):n(_)}function M(_){return _===47?(e.consume(_),I):_===58||_===95||no(_)?(e.consume(_),z):xt(_)?(a=M,B(_)):Jt(_)?(e.consume(_),M):I(_)}function z(_){return _===45||_===46||_===58||_===95||Ts(_)?(e.consume(_),z):$(_)}function $(_){return _===61?(e.consume(_),A):xt(_)?(a=$,B(_)):Jt(_)?(e.consume(_),$):M(_)}function A(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(e.consume(_),s=_,F):xt(_)?(a=A,B(_)):Jt(_)?(e.consume(_),A):(e.consume(_),T)}function F(_){return _===s?(e.consume(_),s=void 0,O):_===null?n(_):xt(_)?(a=F,B(_)):(e.consume(_),F)}function T(_){return _===null||_===34||_===39||_===60||_===61||_===96?n(_):_===47||_===62||ys(_)?M(_):(e.consume(_),T)}function O(_){return _===47||_===62||ys(_)?M(_):n(_)}function I(_){return _===62?(e.consume(_),e.exit("htmlTextData"),e.exit("htmlText"),t):n(_)}function B(_){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),P}function P(_){return Jt(_)?kn(e,L,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):L(_)}function L(_){return e.enter("htmlTextData"),a(_)}}const bv={name:"labelEnd",resolveAll:j8,resolveTo:C8,tokenize:E8},k8={tokenize:_8},S8={tokenize:P8},N8={tokenize:A8};function j8(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&&fo(e,0,e.length,n),e}function C8(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 u={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},d={type:"label",start:{...e[i][1].start},end:{...e[a][1].end}},f={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[a-2][1].start}};return l=[["enter",u,t],["enter",d,t]],l=Xs(l,e.slice(i+1,i+r+3)),l=Xs(l,[["enter",f,t]]),l=Xs(l,wv(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),l=Xs(l,[["exit",f,t],e[a-2],e[a-1],["exit",d,t]]),l=Xs(l,e.slice(a+1)),l=Xs(l,[["exit",u,t]]),fo(e,i,e.length,l),e}function E8(e,t,n){const r=this;let s=r.events.length,i,a;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){i=r.events[s][1];break}return l;function l(p){return i?i._inactive?c(p):(a=r.parser.defined.includes(Bc(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),u):n(p)}function u(p){return p===40?e.attempt(k8,f,a?f:c)(p):p===91?e.attempt(S8,f,a?d:c)(p):a?f(p):c(p)}function d(p){return e.attempt(N8,f,c)(p)}function f(p){return t(p)}function c(p){return i._balanced=!0,n(p)}}function _8(e,t,n){return r;function r(c){return e.enter("resource"),e.enter("resourceMarker"),e.consume(c),e.exit("resourceMarker"),s}function s(c){return ys(c)?jd(e,i)(c):i(c)}function i(c){return c===41?f(c):NA(e,a,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(c)}function a(c){return ys(c)?jd(e,u)(c):f(c)}function l(c){return n(c)}function u(c){return c===34||c===39||c===40?CA(e,d,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(c):f(c)}function d(c){return ys(c)?jd(e,f)(c):f(c)}function f(c){return c===41?(e.enter("resourceMarker"),e.consume(c),e.exit("resourceMarker"),e.exit("resource"),t):n(c)}}function P8(e,t,n){const r=this;return s;function s(l){return jA.call(r,e,i,a,"reference","referenceMarker","referenceString")(l)}function i(l){return r.parser.defined.includes(Bc(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function a(l){return n(l)}}function A8(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 I8={name:"labelStartImage",resolveAll:bv.resolveAll,tokenize:T8};function T8(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 R8={name:"labelStartLink",resolveAll:bv.resolveAll,tokenize:L8};function L8(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 Ey={name:"lineEnding",tokenize:O8};function O8(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),kn(e,t,"linePrefix")}}const fh={name:"thematicBreak",tokenize:M8};function M8(e,t,n){let r=0,s;return i;function i(d){return e.enter("thematicBreak"),a(d)}function a(d){return s=d,l(d)}function l(d){return d===s?(e.enter("thematicBreakSequence"),u(d)):r>=3&&(d===null||xt(d))?(e.exit("thematicBreak"),t(d)):n(d)}function u(d){return d===s?(e.consume(d),r++,u):(e.exit("thematicBreakSequence"),Jt(d)?kn(e,l,"whitespace")(d):l(d))}}const ss={continuation:{tokenize:z8},exit:H8,name:"list",tokenize:F8},$8={partial:!0,tokenize:W8},D8={partial:!0,tokenize:B8};function F8(e,t,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,a=0;return l;function l(h){const g=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:Cw(h)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(fh,n,d)(h):d(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(h)}return n(h)}function u(h){return Cw(h)&&++a<10?(e.consume(h),u):(!r.interrupt||a<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),d(h)):n(h)}function d(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check(ng,r.interrupt?n:f,e.attempt($8,p,c))}function f(h){return r.containerState.initialBlankLine=!0,i++,p(h)}function c(h){return Jt(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),p):n(h)}function p(h){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function z8(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(ng,s,i);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,kn(e,t,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!Jt(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(D8,t,a)(l))}function a(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,kn(e,e.attempt(ss,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function B8(e,t,n){const r=this;return kn(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 H8(e){e.exit(this.containerState.type)}function W8(e,t,n){const r=this;return kn(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!Jt(i)&&a&&a[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const sN={name:"setextUnderline",resolveTo:V8,tokenize:U8};function V8(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 U8(e,t,n){const r=this;let s;return i;function i(d){let f=r.events.length,c;for(;f--;)if(r.events[f][1].type!=="lineEnding"&&r.events[f][1].type!=="linePrefix"&&r.events[f][1].type!=="content"){c=r.events[f][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||c)?(e.enter("setextHeadingLine"),s=d,a(d)):n(d)}function a(d){return e.enter("setextHeadingLineSequence"),l(d)}function l(d){return d===s?(e.consume(d),l):(e.exit("setextHeadingLineSequence"),Jt(d)?kn(e,u,"lineSuffix")(d):u(d))}function u(d){return d===null||xt(d)?(e.exit("setextHeadingLine"),t(d)):n(d)}}const K8={tokenize:q8};function q8(e){const t=this,n=e.attempt(ng,r,e.attempt(this.parser.constructs.flowInitial,s,kn(e,e.attempt(this.parser.constructs.flow,s,e.attempt(QH,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 Y8={resolveAll:_A()},G8=EA("string"),X8=EA("text");function EA(e){return{resolveAll:_A(e==="text"?J8:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],i=n.attempt(s,a,l);return a;function a(f){return d(f)?i(f):l(f)}function l(f){if(f===null){n.consume(f);return}return n.enter("data"),n.consume(f),u}function u(f){return d(f)?(n.exit("data"),i(f)):(n.consume(f),u)}function d(f){if(f===null)return!0;const c=s[f];let p=-1;if(c)for(;++p<c.length;){const h=c[p];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function _A(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 J8(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,u;for(;i--;){const d=s[i];if(typeof d=="string"){for(a=d.length;d.charCodeAt(a-1)===32;)l++,a--;if(a)break;a=-1}else if(d===-2)u=!0,l++;else if(d!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const d={type:n===e.length||u||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?a:r.start._bufferIndex+a,_index:r.start._index+i,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...d.start},r.start.offset===r.end.offset?Object.assign(r,d):(e.splice(n,0,["enter",d,t],["exit",d,t]),n+=2)}n++}return e}const Q8={42:ss,43:ss,45:ss,48:ss,49:ss,50:ss,51:ss,52:ss,53:ss,54:ss,55:ss,56:ss,57:ss,62:bA},Z8={91:r8},e6={[-2]:Cy,[-1]:Cy,32:Cy},t6={35:c8,42:fh,45:[sN,fh],60:p8,61:sN,95:fh,96:nN,126:nN},n6={38:kA,92:vA},r6={[-5]:Ey,[-4]:Ey,[-3]:Ey,33:I8,38:kA,42:Ew,60:[RH,b8],91:R8,92:[a8,vA],93:bv,95:Ew,96:KH},s6={null:[Ew,Y8]},i6={null:[42,95]},o6={null:[]},a6=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:i6,contentInitial:Z8,disable:o6,document:Q8,flow:t6,flowInitial:e6,insideSpan:s6,string:n6,text:r6},Symbol.toStringTag,{value:"Module"}));function l6(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 u={attempt:R(C),check:R(j),consume:b,enter:w,exit:N,interrupt:R(j,{interrupt:!0})},d={code:null,containerState:{},defineSkip:v,events:[],now:g,parser:e,previous:null,sliceSerialize:p,sliceStream:h,write:c};let f=t.tokenize.call(d,u);return t.resolveAll&&i.push(t),d;function c($){return a=Xs(a,$),k(),a[a.length-1]!==null?[]:(D(t,0),d.events=wv(i,d.events,d),d.events)}function p($,A){return u6(h($),A)}function h($){return c6(a,$)}function g(){const{_bufferIndex:$,_index:A,line:F,column:T,offset:O}=r;return{_bufferIndex:$,_index:A,line:F,column:T,offset:O}}function v($){s[$.line]=$.column,z()}function k(){let $;for(;r._index<a.length;){const A=a[r._index];if(typeof A=="string")for($=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===$&&r._bufferIndex<A.length;)y(A.charCodeAt(r._bufferIndex));else y(A)}}function y($){f=f($)}function b($){xt($)?(r.line++,r.column=1,r.offset+=$===-3?2:1,z()):$!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),d.previous=$}function w($,A){const F=A||{};return F.type=$,F.start=g(),d.events.push(["enter",F,d]),l.push(F),F}function N($){const A=l.pop();return A.end=g(),d.events.push(["exit",A,d]),A}function C($,A){D($,A.from)}function j($,A){A.restore()}function R($,A){return F;function F(T,O,I){let B,P,L,_;return Array.isArray(T)?Z(T):"tokenize"in T?Z([T]):G(T);function G(de){return me;function me(ae){const Ne=ae!==null&&de[ae],Pe=ae!==null&&de.null,be=[...Array.isArray(Ne)?Ne:Ne?[Ne]:[],...Array.isArray(Pe)?Pe:Pe?[Pe]:[]];return Z(be)(ae)}}function Z(de){return B=de,P=0,de.length===0?I:U(de[P])}function U(de){return me;function me(ae){return _=M(),L=de,de.partial||(d.currentConstruct=de),de.name&&d.parser.constructs.disable.null.includes(de.name)?ue():de.tokenize.call(A?Object.assign(Object.create(d),A):d,u,se,ue)(ae)}}function se(de){return $(L,_),O}function ue(de){return _.restore(),++P<B.length?U(B[P]):I}}}function D($,A){$.resolveAll&&!i.includes($)&&i.push($),$.resolve&&fo(d.events,A,d.events.length-A,$.resolve(d.events.slice(A),d)),$.resolveTo&&(d.events=$.resolveTo(d.events,d))}function M(){const $=g(),A=d.previous,F=d.currentConstruct,T=d.events.length,O=Array.from(l);return{from:T,restore:I};function I(){r=$,d.previous=A,d.currentConstruct=F,d.events.length=T,l=O,z()}}function z(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function c6(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 u6(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 d6(e){const r={constructs:xH([a6,...(e||{}).extensions||[]]),content:s(CH),defined:[],document:s(_H),flow:s(K8),lazy:{},string:s(G8),text:s(X8)};return r;function s(i){return a;function a(l){return l6(r,i,l)}}}function f6(e){for(;!SA(e););return e}const iN=/[\0\t\n\r]/g;function p6(){let e=1,t="",n=!0,r;return s;function s(i,a,l){const u=[];let d,f,c,p,h;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(a||void 0).decode(i)),c=0,t="",n&&(i.charCodeAt(0)===65279&&c++,n=void 0);c<i.length;){if(iN.lastIndex=c,d=iN.exec(i),p=d&&d.index!==void 0?d.index:i.length,h=i.charCodeAt(p),!d){t=i.slice(c);break}if(h===10&&c===p&&r)u.push(-3),r=void 0;else switch(r&&(u.push(-5),r=void 0),c<p&&(u.push(i.slice(c,p)),e+=p-c),h){case 0:{u.push(65533),e++;break}case 9:{for(f=Math.ceil(e/4)*4,u.push(-2);e++<f;)u.push(-1);break}case 10:{u.push(-4),e=1;break}default:r=!0,e=1}c=p+1}return l&&(r&&u.push(-5),t&&u.push(t),u.push(null)),u}}const h6=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function m6(e){return e.replace(h6,g6)}function g6(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return wA(n.slice(i?2:1),i?16:10)}return xv(n)||e}const PA={}.hasOwnProperty;function y6(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),x6(n)(f6(d6(n).document().write(p6()(e,t,!0))))}function x6(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(mt),autolinkProtocol:M,autolinkEmail:M,atxHeading:i(st),blockQuote:i(Pe),characterEscape:M,characterReference:M,codeFenced:i(be),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:i(be,a),codeText:i(Ie,a),codeTextData:M,data:M,codeFlowValue:M,definition:i(_e),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:i(nt),hardBreakEscape:i(Je),hardBreakTrailing:i(Je),htmlFlow:i(Ct,a),htmlFlowData:M,htmlText:i(Ct,a),htmlTextData:M,image:i(Be),label:a,link:i(mt),listItem:i(De),listItemValue:p,listOrdered:i(Gt,c),listUnordered:i(Gt),paragraph:i(en),reference:U,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:i(st),strong:i(rn),thematicBreak:i(Hn)},exit:{atxHeading:u(),atxHeadingSequence:C,autolink:u(),autolinkEmail:Ne,autolinkProtocol:ae,blockQuote:u(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:ue,characterReferenceMarkerNumeric:ue,characterReferenceValue:de,characterReference:me,codeFenced:u(k),codeFencedFence:v,codeFencedFenceInfo:h,codeFencedFenceMeta:g,codeFlowValue:z,codeIndented:u(y),codeText:u(O),codeTextData:z,data:z,definition:u(),definitionDestinationString:N,definitionLabelString:b,definitionTitleString:w,emphasis:u(),hardBreakEscape:u(A),hardBreakTrailing:u(A),htmlFlow:u(F),htmlFlowData:z,htmlText:u(T),htmlTextData:z,image:u(B),label:L,labelText:P,lineEnding:$,link:u(I),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:se,resourceDestinationString:_,resourceTitleString:G,resource:Z,setextHeading:u(D),setextHeadingLineSequence:R,setextHeadingText:j,strong:u(),thematicBreak:u()}};AA(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(le){let ve={type:"root",children:[]};const qe={stack:[ve],tokenStack:[],config:t,enter:l,exit:d,buffer:a,resume:f,data:n},ge=[];let lt=-1;for(;++lt<le.length;)if(le[lt][1].type==="listOrdered"||le[lt][1].type==="listUnordered")if(le[lt][0]==="enter")ge.push(lt);else{const Bt=ge.pop();lt=s(le,Bt,lt)}for(lt=-1;++lt<le.length;){const Bt=t[le[lt][0]];PA.call(Bt,le[lt][1].type)&&Bt[le[lt][1].type].call(Object.assign({sliceSerialize:le[lt][2].sliceSerialize},qe),le[lt][1])}if(qe.tokenStack.length>0){const Bt=qe.tokenStack[qe.tokenStack.length-1];(Bt[1]||oN).call(qe,void 0,Bt[0])}for(ve.position={start:oa(le.length>0?le[0][1].start:{line:1,column:1,offset:0}),end:oa(le.length>0?le[le.length-2][1].end:{line:1,column:1,offset:0})},lt=-1;++lt<t.transforms.length;)ve=t.transforms[lt](ve)||ve;return ve}function s(le,ve,qe){let ge=ve-1,lt=-1,Bt=!1,hn,In,mn,cr;for(;++ge<=qe;){const Xt=le[ge];switch(Xt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Xt[0]==="enter"?lt++:lt--,cr=void 0;break}case"lineEndingBlank":{Xt[0]==="enter"&&(hn&&!cr&&!lt&&!mn&&(mn=ge),cr=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:cr=void 0}if(!lt&&Xt[0]==="enter"&&Xt[1].type==="listItemPrefix"||lt===-1&&Xt[0]==="exit"&&(Xt[1].type==="listUnordered"||Xt[1].type==="listOrdered")){if(hn){let Wn=ge;for(In=void 0;Wn--;){const Tn=le[Wn];if(Tn[1].type==="lineEnding"||Tn[1].type==="lineEndingBlank"){if(Tn[0]==="exit")continue;In&&(le[In][1].type="lineEndingBlank",Bt=!0),Tn[1].type="lineEnding",In=Wn}else if(!(Tn[1].type==="linePrefix"||Tn[1].type==="blockQuotePrefix"||Tn[1].type==="blockQuotePrefixWhitespace"||Tn[1].type==="blockQuoteMarker"||Tn[1].type==="listItemIndent"))break}mn&&(!In||mn<In)&&(hn._spread=!0),hn.end=Object.assign({},In?le[In][1].start:Xt[1].end),le.splice(In||ge,0,["exit",hn,Xt[2]]),ge++,qe++}if(Xt[1].type==="listItemPrefix"){const Wn={type:"listItem",_spread:!1,start:Object.assign({},Xt[1].start),end:void 0};hn=Wn,le.splice(ge,0,["enter",Wn,Xt[2]]),ge++,qe++,mn=void 0,cr=!0}}}return le[ve][1]._spread=Bt,qe}function i(le,ve){return qe;function qe(ge){l.call(this,le(ge),ge),ve&&ve.call(this,ge)}}function a(){this.stack.push({type:"fragment",children:[]})}function l(le,ve,qe){this.stack[this.stack.length-1].children.push(le),this.stack.push(le),this.tokenStack.push([ve,qe||void 0]),le.position={start:oa(ve.start),end:void 0}}function u(le){return ve;function ve(qe){le&&le.call(this,qe),d.call(this,qe)}}function d(le,ve){const qe=this.stack.pop(),ge=this.tokenStack.pop();if(ge)ge[0].type!==le.type&&(ve?ve.call(this,le,ge[0]):(ge[1]||oN).call(this,le,ge[0]));else throw new Error("Cannot close `"+le.type+"` ("+Nd({start:le.start,end:le.end})+"): it’s not open");qe.position.end=oa(le.end)}function f(){return gH(this.stack.pop())}function c(){this.data.expectingFirstListItemValue=!0}function p(le){if(this.data.expectingFirstListItemValue){const ve=this.stack[this.stack.length-2];ve.start=Number.parseInt(this.sliceSerialize(le),10),this.data.expectingFirstListItemValue=void 0}}function h(){const le=this.resume(),ve=this.stack[this.stack.length-1];ve.lang=le}function g(){const le=this.resume(),ve=this.stack[this.stack.length-1];ve.meta=le}function v(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function k(){const le=this.resume(),ve=this.stack[this.stack.length-1];ve.value=le.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const le=this.resume(),ve=this.stack[this.stack.length-1];ve.value=le.replace(/(\r?\n|\r)$/g,"")}function b(le){const ve=this.resume(),qe=this.stack[this.stack.length-1];qe.label=ve,qe.identifier=Bc(this.sliceSerialize(le)).toLowerCase()}function w(){const le=this.resume(),ve=this.stack[this.stack.length-1];ve.title=le}function N(){const le=this.resume(),ve=this.stack[this.stack.length-1];ve.url=le}function C(le){const ve=this.stack[this.stack.length-1];if(!ve.depth){const qe=this.sliceSerialize(le).length;ve.depth=qe}}function j(){this.data.setextHeadingSlurpLineEnding=!0}function R(le){const ve=this.stack[this.stack.length-1];ve.depth=this.sliceSerialize(le).codePointAt(0)===61?1:2}function D(){this.data.setextHeadingSlurpLineEnding=void 0}function M(le){const qe=this.stack[this.stack.length-1].children;let ge=qe[qe.length-1];(!ge||ge.type!=="text")&&(ge=pn(),ge.position={start:oa(le.start),end:void 0},qe.push(ge)),this.stack.push(ge)}function z(le){const ve=this.stack.pop();ve.value+=this.sliceSerialize(le),ve.position.end=oa(le.end)}function $(le){const ve=this.stack[this.stack.length-1];if(this.data.atHardBreak){const qe=ve.children[ve.children.length-1];qe.position.end=oa(le.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ve.type)&&(M.call(this,le),z.call(this,le))}function A(){this.data.atHardBreak=!0}function F(){const le=this.resume(),ve=this.stack[this.stack.length-1];ve.value=le}function T(){const le=this.resume(),ve=this.stack[this.stack.length-1];ve.value=le}function O(){const le=this.resume(),ve=this.stack[this.stack.length-1];ve.value=le}function I(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const ve=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=ve,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function B(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const ve=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=ve,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function P(le){const ve=this.sliceSerialize(le),qe=this.stack[this.stack.length-2];qe.label=m6(ve),qe.identifier=Bc(ve).toLowerCase()}function L(){const le=this.stack[this.stack.length-1],ve=this.resume(),qe=this.stack[this.stack.length-1];if(this.data.inReference=!0,qe.type==="link"){const ge=le.children;qe.children=ge}else qe.alt=ve}function _(){const le=this.resume(),ve=this.stack[this.stack.length-1];ve.url=le}function G(){const le=this.resume(),ve=this.stack[this.stack.length-1];ve.title=le}function Z(){this.data.inReference=void 0}function U(){this.data.referenceType="collapsed"}function se(le){const ve=this.resume(),qe=this.stack[this.stack.length-1];qe.label=ve,qe.identifier=Bc(this.sliceSerialize(le)).toLowerCase(),this.data.referenceType="full"}function ue(le){this.data.characterReferenceType=le.type}function de(le){const ve=this.sliceSerialize(le),qe=this.data.characterReferenceType;let ge;qe?(ge=wA(ve,qe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ge=xv(ve);const lt=this.stack[this.stack.length-1];lt.value+=ge}function me(le){const ve=this.stack.pop();ve.position.end=oa(le.end)}function ae(le){z.call(this,le);const ve=this.stack[this.stack.length-1];ve.url=this.sliceSerialize(le)}function Ne(le){z.call(this,le);const ve=this.stack[this.stack.length-1];ve.url="mailto:"+this.sliceSerialize(le)}function Pe(){return{type:"blockquote",children:[]}}function be(){return{type:"code",lang:null,meta:null,value:""}}function Ie(){return{type:"inlineCode",value:""}}function _e(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function nt(){return{type:"emphasis",children:[]}}function st(){return{type:"heading",depth:0,children:[]}}function Je(){return{type:"break"}}function Ct(){return{type:"html",value:""}}function Be(){return{type:"image",title:null,url:"",alt:null}}function mt(){return{type:"link",title:null,url:"",children:[]}}function Gt(le){return{type:"list",ordered:le.type==="listOrdered",start:null,spread:le._spread,children:[]}}function De(le){return{type:"listItem",spread:le._spread,checked:null,children:[]}}function en(){return{type:"paragraph",children:[]}}function rn(){return{type:"strong",children:[]}}function pn(){return{type:"text",value:""}}function Hn(){return{type:"thematicBreak"}}}function oa(e){return{line:e.line,column:e.column,offset:e.offset}}function AA(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?AA(e,r):w6(e,r)}}function w6(e,t){let n;for(n in t)if(PA.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 oN(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Nd({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Nd({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Nd({start:t.start,end:t.end})+") is still open")}function b6(e){const t=this;t.parser=n;function n(r){return y6(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function v6(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 k6(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
70
|
+
`}]}function S6(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 N6(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function j6(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function C6(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=hu(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let a,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=i+1,l+=1,e.footnoteCounts.set(r,l);const u={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,u);const d={type:"element",tagName:"sup",properties:{},children:[u]};return e.patch(t,d),e.applyData(t,d)}function E6(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 _6(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function IA(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 P6(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return IA(e,t);const s={src:hu(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 A6(e,t){const n={src:hu(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 I6(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 T6(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return IA(e,t);const s={href:hu(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 R6(e,t){const n={href:hu(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 L6(e,t,n){const r=e.all(t),s=n?O6(n):TA(t),i={},a=[];if(typeof t.checked=="boolean"){const f=r[0];let c;f&&f.type==="element"&&f.tagName==="p"?c=f:(c={type:"element",tagName:"p",properties:{},children:[]},r.unshift(c)),c.children.length>0&&c.children.unshift({type:"text",value:" "}),c.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const f=r[l];(s||l!==0||f.type!=="element"||f.tagName!=="p")&&a.push({type:"text",value:`
|
|
72
|
+
`}),f.type==="element"&&f.tagName==="p"&&!s?a.push(...f.children):a.push(f)}const u=r[r.length-1];u&&(s||u.type!=="element"||u.tagName!=="p")&&a.push({type:"text",value:`
|
|
73
|
+
`});const d={type:"element",tagName:"li",properties:i,children:a};return e.patch(t,d),e.applyData(t,d)}function O6(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=TA(n[r])}return t}function TA(e){const t=e.spread;return t??e.children.length>1}function M6(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 $6(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function D6(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function F6(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function z6(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=hv(t.children[1]),u=fA(t.children[t.children.length-1]);l&&u&&(a.position={start:l,end:u}),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 B6(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,l=a?a.length:t.children.length;let u=-1;const d=[];for(;++u<l;){const c=t.children[u],p={},h=a?a[u]:void 0;h&&(p.align=h);let g={type:"element",tagName:i,properties:p,children:[]};c&&(g.children=e.all(c),e.patch(c,g),g=e.applyData(c,g)),d.push(g)}const f={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(t,f),e.applyData(t,f)}function H6(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const aN=9,lN=32;function W6(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const i=[];for(;r;)i.push(cN(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(cN(t.slice(s),s>0,!1)),i.join("")}function cN(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===aN||i===lN;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===aN||i===lN;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function V6(e,t){const n={type:"text",value:W6(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function U6(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const K6={blockquote:v6,break:k6,code:S6,delete:N6,emphasis:j6,footnoteReference:C6,heading:E6,html:_6,imageReference:P6,image:A6,inlineCode:I6,linkReference:T6,link:R6,listItem:L6,list:M6,paragraph:$6,root:D6,strong:F6,table:z6,tableCell:H6,tableRow:B6,text:V6,thematicBreak:U6,toml:Rp,yaml:Rp,definition:Rp,footnoteDefinition:Rp};function Rp(){}const RA=-1,rg=0,Cd=1,tm=2,vv=3,kv=4,Sv=5,Nv=6,LA=7,OA=8,uN=typeof self=="object"?self:globalThis,q6=(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 rg:case RA:return n(a,s);case Cd:{const l=n([],s);for(const u of a)l.push(r(u));return l}case tm:{const l=n({},s);for(const[u,d]of a)l[r(u)]=r(d);return l}case vv:return n(new Date(a),s);case kv:{const{source:l,flags:u}=a;return n(new RegExp(l,u),s)}case Sv:{const l=n(new Map,s);for(const[u,d]of a)l.set(r(u),r(d));return l}case Nv:{const l=n(new Set,s);for(const u of a)l.add(r(u));return l}case LA:{const{name:l,message:u}=a;return n(new uN[l](u),s)}case OA: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 uN[i](a),s)};return r},dN=e=>q6(new Map,e)(0),ac="",{toString:Y6}={},{keys:G6}=Object,Gu=e=>{const t=typeof e;if(t!=="object"||!e)return[rg,t];const n=Y6.call(e).slice(8,-1);switch(n){case"Array":return[Cd,ac];case"Object":return[tm,ac];case"Date":return[vv,ac];case"RegExp":return[kv,ac];case"Map":return[Sv,ac];case"Set":return[Nv,ac];case"DataView":return[Cd,n]}return n.includes("Array")?[Cd,n]:n.includes("Error")?[LA,n]:[tm,n]},Lp=([e,t])=>e===rg&&(t==="function"||t==="symbol"),X6=(e,t,n,r)=>{const s=(a,l)=>{const u=r.push(a)-1;return n.set(l,u),u},i=a=>{if(n.has(a))return n.get(a);let[l,u]=Gu(a);switch(l){case rg:{let f=a;switch(u){case"bigint":l=OA,f=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+u);f=null;break;case"undefined":return s([RA],a)}return s([l,f],a)}case Cd:{if(u){let p=a;return u==="DataView"?p=new Uint8Array(a.buffer):u==="ArrayBuffer"&&(p=new Uint8Array(a)),s([u,[...p]],a)}const f=[],c=s([l,f],a);for(const p of a)f.push(i(p));return c}case tm:{if(u)switch(u){case"BigInt":return s([u,a.toString()],a);case"Boolean":case"Number":case"String":return s([u,a.valueOf()],a)}if(t&&"toJSON"in a)return i(a.toJSON());const f=[],c=s([l,f],a);for(const p of G6(a))(e||!Lp(Gu(a[p])))&&f.push([i(p),i(a[p])]);return c}case vv:return s([l,a.toISOString()],a);case kv:{const{source:f,flags:c}=a;return s([l,{source:f,flags:c}],a)}case Sv:{const f=[],c=s([l,f],a);for(const[p,h]of a)(e||!(Lp(Gu(p))||Lp(Gu(h))))&&f.push([i(p),i(h)]);return c}case Nv:{const f=[],c=s([l,f],a);for(const p of a)(e||!Lp(Gu(p)))&&f.push(i(p));return c}}const{message:d}=a;return s([l,{name:u,message:d}],a)};return i},fN=(e,{json:t,lossy:n}={})=>{const r=[];return X6(!(t||n),!!t,new Map,r)(e),r},nm=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?dN(fN(e,t)):structuredClone(e):(e,t)=>dN(fN(e,t));function J6(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 Q6(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function Z6(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||J6,r=e.options.footnoteBackLabel||Q6,s=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let u=-1;for(;++u<e.footnoteOrder.length;){const d=e.footnoteById.get(e.footnoteOrder[u]);if(!d)continue;const f=e.all(d),c=String(d.identifier).toUpperCase(),p=hu(c.toLowerCase());let h=0;const g=[],v=e.footnoteCounts.get(c);for(;v!==void 0&&++h<=v;){g.length>0&&g.push({type:"text",value:" "});let b=typeof n=="string"?n:n(u,h);typeof b=="string"&&(b={type:"text",value:b}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+p+(h>1?"-"+h:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(u,h),className:["data-footnote-backref"]},children:Array.isArray(b)?b:[b]})}const k=f[f.length-1];if(k&&k.type==="element"&&k.tagName==="p"){const b=k.children[k.children.length-1];b&&b.type==="text"?b.value+=" ":k.children.push({type:"text",value:" "}),k.children.push(...g)}else f.push(...g);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+p},children:e.wrap(f,!0)};e.patch(d,y),l.push(y)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...nm(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 MA=function(e){if(e==null)return r9;if(typeof e=="function")return sg(e);if(typeof e=="object")return Array.isArray(e)?e9(e):t9(e);if(typeof e=="string")return n9(e);throw new Error("Expected function, string, or object as test")};function e9(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=MA(e[n]);return sg(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function t9(e){const t=e;return sg(n);function n(r){const s=r;let i;for(i in e)if(s[i]!==t[i])return!1;return!0}}function n9(e){return sg(t);function t(n){return n&&n.type===e}}function sg(e){return t;function t(n,r,s){return!!(s9(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function r9(){return!0}function s9(e){return e!==null&&typeof e=="object"&&"type"in e}const $A=[],i9=!0,pN=!1,o9="skip";function a9(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const i=MA(s),a=r?-1:1;l(e,void 0,[])();function l(u,d,f){const c=u&&typeof u=="object"?u:{};if(typeof c.type=="string"){const h=typeof c.tagName=="string"?c.tagName:typeof c.name=="string"?c.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(u.type+(h?"<"+h+">":""))+")"})}return p;function p(){let h=$A,g,v,k;if((!t||i(u,d,f[f.length-1]||void 0))&&(h=l9(n(u,f)),h[0]===pN))return h;if("children"in u&&u.children){const y=u;if(y.children&&h[0]!==o9)for(v=(r?y.children.length:-1)+a,k=f.concat(y);v>-1&&v<y.children.length;){const b=y.children[v];if(g=l(b,v,k)(),g[0]===pN)return g;v=typeof g[1]=="number"?g[1]:v+a}}return h}}}function l9(e){return Array.isArray(e)?e:typeof e=="number"?[i9,e]:e==null?$A:[e]}function DA(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),a9(e,i,l,s);function l(u,d){const f=d[d.length-1],c=f?f.children.indexOf(u):void 0;return a(u,c,f)}}const _w={}.hasOwnProperty,c9={};function u9(e,t){const n=t||c9,r=new Map,s=new Map,i=new Map,a={...K6,...n.handlers},l={all:d,applyData:f9,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:a,one:u,options:n,patch:d9,wrap:h9};return DA(e,function(f){if(f.type==="definition"||f.type==="footnoteDefinition"){const c=f.type==="definition"?r:s,p=String(f.identifier).toUpperCase();c.has(p)||c.set(p,f)}}),l;function u(f,c){const p=f.type,h=l.handlers[p];if(_w.call(l.handlers,p)&&h)return h(l,f,c);if(l.options.passThrough&&l.options.passThrough.includes(p)){if("children"in f){const{children:v,...k}=f,y=nm(k);return y.children=l.all(f),y}return nm(f)}return(l.options.unknownHandler||p9)(l,f,c)}function d(f){const c=[];if("children"in f){const p=f.children;let h=-1;for(;++h<p.length;){const g=l.one(p[h],f);if(g){if(h&&p[h-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=hN(g.value)),!Array.isArray(g)&&g.type==="element")){const v=g.children[0];v&&v.type==="text"&&(v.value=hN(v.value))}Array.isArray(g)?c.push(...g):c.push(g)}}}return c}}function d9(e,t){e.position&&(t.position=Y4(e))}function f9(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,nm(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function p9(e,t){const n=t.data||{},r="value"in t&&!(_w.call(n,"hProperties")||_w.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 h9(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 hN(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function mN(e,t){const n=u9(e,t),r=n.one(e,void 0),s=Z6(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 m9(e,t){return e&&"run"in e?async function(n,r){const s=mN(n,{file:r,...t});await e.run(s,r)}:function(n,r){return mN(n,{file:r,...e||t})}}function gN(e){if(e)throw e}var ph=Object.prototype.hasOwnProperty,FA=Object.prototype.toString,yN=Object.defineProperty,xN=Object.getOwnPropertyDescriptor,wN=function(t){return typeof Array.isArray=="function"?Array.isArray(t):FA.call(t)==="[object Array]"},bN=function(t){if(!t||FA.call(t)!=="[object Object]")return!1;var n=ph.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&ph.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||ph.call(t,s)},vN=function(t,n){yN&&n.name==="__proto__"?yN(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},kN=function(t,n){if(n==="__proto__")if(ph.call(t,n)){if(xN)return xN(t,n).value}else return;return t[n]},g9=function e(){var t,n,r,s,i,a,l=arguments[0],u=1,d=arguments.length,f=!1;for(typeof l=="boolean"&&(f=l,l=arguments[1]||{},u=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});u<d;++u)if(t=arguments[u],t!=null)for(n in t)r=kN(l,n),s=kN(t,n),l!==s&&(f&&s&&(bN(s)||(i=wN(s)))?(i?(i=!1,a=r&&wN(r)?r:[]):a=r&&bN(r)?r:{},vN(l,{name:n,newValue:e(f,a,s)})):typeof s<"u"&&vN(l,{name:n,newValue:s}));return l};const _y=$a(g9);function Pw(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 y9(){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(u,...d){const f=e[++i];let c=-1;if(u){a(u);return}for(;++c<s.length;)(d[c]===null||d[c]===void 0)&&(d[c]=s[c]);s=d,f?x9(f,l)(...d):a(null,...d)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function x9(e,t){let n;return r;function r(...a){const l=e.length>a.length;let u;l&&a.push(s);try{u=e.apply(this,a)}catch(d){const f=d;if(l&&n)throw f;return s(f)}l||(u&&u.then&&typeof u.then=="function"?u.then(i,s):u instanceof Error?s(u):i(u))}function s(a,...l){n||(n=!0,t(a,...l))}function i(a){s(null,a)}}const Ji={basename:w9,dirname:b9,extname:v9,join:k9,sep:"/"};function w9(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');If(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 b9(e){if(If(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 v9(e){If(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 k9(...e){let t=-1,n;for(;++t<e.length;)If(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":S9(n)}function S9(e){If(e);const t=e.codePointAt(0)===47;let n=N9(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function N9(e,t){let n="",r=0,s=-1,i=0,a=-1,l,u;for(;++a<=e.length;){if(a<e.length)l=e.codePointAt(a);else{if(l===47)break;l=47}if(l===47){if(!(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(u=n.lastIndexOf("/"),u!==n.length-1){u<0?(n="",r=0):(n=n.slice(0,u),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 If(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const j9={cwd:C9};function C9(){return"/"}function Aw(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function E9(e){if(typeof e=="string")e=new URL(e);else if(!Aw(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 _9(e)}function _9(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 Py=["history","path","basename","stem","extname","dirname"];class zA{constructor(t){let n;t?Aw(t)?n={path:t}:typeof t=="string"||P9(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":j9.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Py.length;){const i=Py[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)Py.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Ji.basename(this.path):void 0}set basename(t){Iy(t,"basename"),Ay(t,"basename"),this.path=Ji.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ji.dirname(this.path):void 0}set dirname(t){SN(this.basename,"dirname"),this.path=Ji.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ji.extname(this.path):void 0}set extname(t){if(Ay(t,"extname"),SN(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=Ji.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Aw(t)&&(t=E9(t)),Iy(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ji.basename(this.path,this.extname):void 0}set stem(t){Iy(t,"stem"),Ay(t,"stem"),this.path=Ji.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 Fr(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 Ay(e,t){if(e&&e.includes(Ji.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ji.sep+"`")}function Iy(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function SN(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function P9(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const A9=function(e){const r=this.constructor.prototype,s=r[e],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},I9={}.hasOwnProperty;class jv extends A9{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=y9()}copy(){const t=new jv;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(_y(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Ly("data",this.frozen),this.namespace[t]=n,this):I9.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ly("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=Op(t),r=this.parser||this.Parser;return Ty("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Ty("process",this.parser||this.Parser),Ry("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,a){const l=Op(t),u=r.parse(l);r.run(u,l,function(f,c,p){if(f||!c||!p)return d(f);const h=c,g=r.stringify(h,p);L9(g)?p.value=g:p.result=g,d(f,p)});function d(f,c){f||!c?a(f):i?i(c):n(void 0,c)}}}processSync(t){let n=!1,r;return this.freeze(),Ty("processSync",this.parser||this.Parser),Ry("processSync",this.compiler||this.Compiler),this.process(t,s),jN("processSync","process",n),r;function s(i,a){n=!0,gN(i),r=a}}run(t,n,r){NN(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 u=Op(n);s.run(t,u,d);function d(f,c,p){const h=c||t;f?l(f):a?a(h):r(void 0,h,p)}}}runSync(t,n){let r=!1,s;return this.run(t,n,i),jN("runSync","run",r),s;function i(a,l){gN(a),s=l,r=!0}}stringify(t,n){this.freeze();const r=Op(n),s=this.compiler||this.Compiler;return Ry("stringify",s),NN(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(Ly("use",this.frozen),t!=null)if(typeof t=="function")u(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):a(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(d){if(typeof d=="function")u(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[f,...c]=d;u(f,c)}else a(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function a(d){if(!("plugins"in d)&&!("settings"in d))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(d.plugins),d.settings&&(s.settings=_y(!0,s.settings,d.settings))}function l(d){let f=-1;if(d!=null)if(Array.isArray(d))for(;++f<d.length;){const c=d[f];i(c)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function u(d,f){let c=-1,p=-1;for(;++c<r.length;)if(r[c][0]===d){p=c;break}if(p===-1)r.push([d,...f]);else if(f.length>0){let[h,...g]=f;const v=r[p][1];Pw(v)&&Pw(h)&&(h=_y(!0,v,h)),r[p]=[d,h,...g]}}}}const T9=new jv().freeze();function Ty(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Ry(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ly(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 NN(e){if(!Pw(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function jN(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Op(e){return R9(e)?e:new zA(e)}function R9(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function L9(e){return typeof e=="string"||O9(e)}function O9(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const M9="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",CN=[],EN={allowDangerousHtml:!0},$9=/^(https?|ircs?|mailto|xmpp)$/i,D9=[{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 Tf(e){const t=F9(e),n=z9(e);return B9(t.runSync(t.parse(n),n),e)}function F9(e){const t=e.rehypePlugins||CN,n=e.remarkPlugins||CN,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...EN}:EN;return T9().use(b6).use(n).use(m9,r).use(t)}function z9(e){const t=e.children||"",n=new zA;return typeof t=="string"&&(n.value=t),n}function B9(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,a=t.skipHtml,l=t.unwrapDisallowed,u=t.urlTransform||H9;for(const f of D9)Object.hasOwn(t,f.from)&&(""+f.from+(f.to?"use `"+f.to+"` instead":"remove it")+M9+f.id,void 0);return DA(e,d),Z4(e,{Fragment:o.Fragment,components:s,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function d(f,c,p){if(f.type==="raw"&&p&&typeof c=="number")return a?p.children.splice(c,1):p.children[c]={type:"text",value:f.value},c;if(f.type==="element"){let h;for(h in jy)if(Object.hasOwn(jy,h)&&Object.hasOwn(f.properties,h)){const g=f.properties[h],v=jy[h];(v===null||v.includes(f.tagName))&&(f.properties[h]=u(String(g||""),h,f))}}if(f.type==="element"){let h=n?!n.includes(f.tagName):i?i.includes(f.tagName):!1;if(!h&&r&&typeof c=="number"&&(h=!r(f,c,p)),h&&p&&typeof c=="number")return l&&f.children?p.children.splice(c,1,...f.children):p.children.splice(c,1),c}}}function H9(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||$9.test(e.slice(0,t))?e:""}function W9(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function rm(e){if(e==null)return"null";if(typeof e!="object")return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(r=>rm(r)).join(",")}]`;const t=e;return`{${Object.keys(t).sort().map(r=>`${JSON.stringify(r)}:${rm(t[r])}`).join(",")}}`}function _N(e){return rm({id:e.id,type:e.type,position:e.position,data:e.data,parentId:e.parentId,extent:e.extent,sourcePosition:e.sourcePosition,targetPosition:e.targetPosition,hidden:e.hidden})}function af(e){const t=e.sourceHandle??"",n=e.targetHandle??"";return`${e.source}|${t}|${e.target}|${n}`}function PN(e){return rm({source:e.source,target:e.target,sourceHandle:e.sourceHandle??null,targetHandle:e.targetHandle??null,type:e.type,label:e.label,data:e.data,markerStart:e.markerStart,markerEnd:e.markerEnd,animated:e.animated,hidden:e.hidden,style:e.style})}function AN(e,t){return!W9(t)||!("selected"in t)||t.selected===e.selected?e:{...e,selected:!!t.selected}}function IN(e,t=!1){const n=new Map;for(const r of e){const s=af(r);if(t&&n.has(s))throw new Error(`存在重复连线键: ${s}`);n.set(s,r)}return n}function V9(e,t,n,r){const s=new Map(e.map(b=>[b.id,b])),i=new Set(n.map(b=>b.id)),a=new Set,l=[],u=[],d=n.map(b=>{const w=s.get(b.id);return w?_N(w)===_N(b)?(a.add(b.id),w):(u.push(b.id),AN(b,w)):(l.push(b.id),b)}),f=IN(t),c=IN(r,!0),p=new Set,h=[],g=[],v=r.map(b=>{const w=af(b),N=f.get(w);return N?PN(N)===PN(b)?(p.add(w),N):(g.push(w),AN(b,N)):(h.push(w),b)}),k=e.filter(b=>!i.has(b.id)).map(b=>b.id),y=t.map(b=>af(b)).filter(b=>!c.has(b));return{nodes:d,edges:v,changes:{addedNodeIds:l,updatedNodeIds:u,removedNodeIds:k,addedEdgeKeys:h,updatedEdgeKeys:g,removedEdgeKeys:y},stats:{nodeAdded:l.length,nodeRemoved:k.length,nodeReused:a.size,edgeAdded:h.length,edgeRemoved:y.length,edgeReused:p.size,nextEdgeCount:c.size}}}/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */function BA(e){return typeof e>"u"||e===null}function U9(e){return typeof e=="object"&&e!==null}function K9(e){return Array.isArray(e)?e:BA(e)?[]:[e]}function q9(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 Y9(e,t){var n="",r;for(r=0;r<t;r+=1)n+=e;return n}function G9(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var X9=BA,J9=U9,Q9=K9,Z9=Y9,eW=G9,tW=q9,pr={isNothing:X9,isObject:J9,toArray:Q9,repeat:Z9,isNegativeZero:eW,extend:tW};function HA(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+=`
|
|
80
|
+
|
|
81
|
+
`+e.mark.snippet),r+" "+n):r}function lf(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=HA(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}lf.prototype=Object.create(Error.prototype);lf.prototype.constructor=lf;lf.prototype.toString=function(t){return this.name+": "+HA(this,t)};var Ur=lf;function Oy(e,t,n,r,s){var i="",a="",l=Math.floor(s/2)-1;return r-t>l&&(i=" ... ",t=r-l+i.length),n-r>l&&(a=" ...",n=r+l-a.length),{str:i+e.slice(t,n).replace(/\t/g,"→")+a,pos:r-t+i.length}}function My(e,t){return pr.repeat(" ",t-e.length)+e}function nW(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);for(var n=/\r?\n|\r|\0/g,r=[0],s=[],i,a=-1;i=n.exec(e.buffer);)s.push(i.index),r.push(i.index+i[0].length),e.position<=i.index&&a<0&&(a=r.length-2);a<0&&(a=r.length-1);var l="",u,d,f=Math.min(e.line+t.linesAfter,s.length).toString().length,c=t.maxLength-(t.indent+f+3);for(u=1;u<=t.linesBefore&&!(a-u<0);u++)d=Oy(e.buffer,r[a-u],s[a-u],e.position-(r[a]-r[a-u]),c),l=pr.repeat(" ",t.indent)+My((e.line-u+1).toString(),f)+" | "+d.str+`
|
|
82
|
+
`+l;for(d=Oy(e.buffer,r[a],s[a],e.position,c),l+=pr.repeat(" ",t.indent)+My((e.line+1).toString(),f)+" | "+d.str+`
|
|
83
|
+
`,l+=pr.repeat("-",t.indent+f+3+d.pos)+`^
|
|
84
|
+
`,u=1;u<=t.linesAfter&&!(a+u>=s.length);u++)d=Oy(e.buffer,r[a+u],s[a+u],e.position-(r[a]-r[a+u]),c),l+=pr.repeat(" ",t.indent)+My((e.line+u+1).toString(),f)+" | "+d.str+`
|
|
85
|
+
`;return l.replace(/\n$/,"")}var rW=nW,sW=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],iW=["scalar","sequence","mapping"];function oW(e){var t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(r){t[String(r)]=n})}),t}function aW(e,t){if(t=t||{},Object.keys(t).forEach(function(n){if(sW.indexOf(n)===-1)throw new Ur('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=oW(t.styleAliases||null),iW.indexOf(this.kind)===-1)throw new Ur('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var Pr=aW;function TN(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 lW(){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 Iw(e){return this.extend(e)}Iw.prototype.extend=function(t){var n=[],r=[];if(t instanceof Pr)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 Ur("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(i){if(!(i instanceof Pr))throw new Ur("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(i.loadKind&&i.loadKind!=="scalar")throw new Ur("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 Ur("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 Pr))throw new Ur("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var s=Object.create(Iw.prototype);return s.implicit=(this.implicit||[]).concat(n),s.explicit=(this.explicit||[]).concat(r),s.compiledImplicit=TN(s,"implicit"),s.compiledExplicit=TN(s,"explicit"),s.compiledTypeMap=lW(s.compiledImplicit,s.compiledExplicit),s};var WA=Iw,VA=new Pr("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),UA=new Pr("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),KA=new Pr("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),qA=new WA({explicit:[VA,UA,KA]});function cW(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function uW(){return null}function dW(e){return e===null}var YA=new Pr("tag:yaml.org,2002:null",{kind:"scalar",resolve:cW,construct:uW,predicate:dW,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function fW(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 pW(e){return e==="true"||e==="True"||e==="TRUE"}function hW(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var GA=new Pr("tag:yaml.org,2002:bool",{kind:"scalar",resolve:fW,construct:pW,predicate:hW,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 mW(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function gW(e){return 48<=e&&e<=55}function yW(e){return 48<=e&&e<=57}function xW(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(!mW(e.charCodeAt(n)))return!1;r=!0}return r&&s!=="_"}if(s==="o"){for(n++;n<t;n++)if(s=e[n],s!=="_"){if(!gW(e.charCodeAt(n)))return!1;r=!0}return r&&s!=="_"}}if(s==="_")return!1;for(;n<t;n++)if(s=e[n],s!=="_"){if(!yW(e.charCodeAt(n)))return!1;r=!0}return!(!r||s==="_")}function wW(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 bW(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!pr.isNegativeZero(e)}var XA=new Pr("tag:yaml.org,2002:int",{kind:"scalar",resolve:xW,construct:wW,predicate:bW,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"]}}),vW=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function kW(e){return!(e===null||!vW.test(e)||e[e.length-1]==="_")}function SW(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 NW=/^[-+]?[0-9]+e/;function jW(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(pr.isNegativeZero(e))return"-0.0";return n=e.toString(10),NW.test(n)?n.replace("e",".e"):n}function CW(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||pr.isNegativeZero(e))}var JA=new Pr("tag:yaml.org,2002:float",{kind:"scalar",resolve:kW,construct:SW,predicate:CW,represent:jW,defaultStyle:"lowercase"}),QA=qA.extend({implicit:[YA,GA,XA,JA]}),ZA=QA,eI=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),tI=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 EW(e){return e===null?!1:eI.exec(e)!==null||tI.exec(e)!==null}function _W(e){var t,n,r,s,i,a,l,u=0,d=null,f,c,p;if(t=eI.exec(e),t===null&&(t=tI.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(u=t[7].slice(0,3);u.length<3;)u+="0";u=+u}return t[9]&&(f=+t[10],c=+(t[11]||0),d=(f*60+c)*6e4,t[9]==="-"&&(d=-d)),p=new Date(Date.UTC(n,r,s,i,a,l,u)),d&&p.setTime(p.getTime()-d),p}function PW(e){return e.toISOString()}var nI=new Pr("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:EW,construct:_W,instanceOf:Date,represent:PW});function AW(e){return e==="<<"||e===null}var rI=new Pr("tag:yaml.org,2002:merge",{kind:"scalar",resolve:AW}),Cv=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
86
|
+
\r`;function IW(e){if(e===null)return!1;var t,n,r=0,s=e.length,i=Cv;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 TW(e){var t,n,r=e.replace(/[\r\n=]/g,""),s=r.length,i=Cv,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 RW(e){var t="",n=0,r,s,i=e.length,a=Cv;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 LW(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var sI=new Pr("tag:yaml.org,2002:binary",{kind:"scalar",resolve:IW,construct:TW,predicate:LW,represent:RW}),OW=Object.prototype.hasOwnProperty,MW=Object.prototype.toString;function $W(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,MW.call(s)!=="[object Object]")return!1;for(i in s)if(OW.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 DW(e){return e!==null?e:[]}var iI=new Pr("tag:yaml.org,2002:omap",{kind:"sequence",resolve:$W,construct:DW}),FW=Object.prototype.toString;function zW(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],FW.call(r)!=="[object Object]"||(s=Object.keys(r),s.length!==1))return!1;i[t]=[s[0],r[s[0]]]}return!0}function BW(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 oI=new Pr("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:zW,construct:BW}),HW=Object.prototype.hasOwnProperty;function WW(e){if(e===null)return!0;var t,n=e;for(t in n)if(HW.call(n,t)&&n[t]!==null)return!1;return!0}function VW(e){return e!==null?e:{}}var aI=new Pr("tag:yaml.org,2002:set",{kind:"mapping",resolve:WW,construct:VW}),Ev=ZA.extend({implicit:[nI,rI],explicit:[sI,iI,oI,aI]}),Ra=Object.prototype.hasOwnProperty,sm=1,lI=2,cI=3,im=4,$y=1,UW=2,RN=3,KW=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,qW=/[\x85\u2028\u2029]/,YW=/[,\[\]\{\}]/,uI=/^(?:!|!!|![a-z\-]+!)$/i,dI=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function LN(e){return Object.prototype.toString.call(e)}function ao(e){return e===10||e===13}function Sl(e){return e===9||e===32}function us(e){return e===9||e===32||e===10||e===13}function Pc(e){return e===44||e===91||e===93||e===123||e===125}function GW(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}function XW(e){return e===120?2:e===117?4:e===85?8:0}function JW(e){return 48<=e&&e<=57?e-48:-1}function ON(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
|
|
87
|
+
`: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":""}function QW(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function fI(e,t,n){t==="__proto__"?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:n}):e[t]=n}var pI=new Array(256),hI=new Array(256);for(var lc=0;lc<256;lc++)pI[lc]=ON(lc)?1:0,hI[lc]=ON(lc);function ZW(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||Ev,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function mI(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=rW(n),new Ur(t,n)}function rt(e,t){throw mI(e,t)}function om(e,t){e.onWarning&&e.onWarning.call(null,mI(e,t))}var MN={YAML:function(t,n,r){var s,i,a;t.version!==null&&rt(t,"duplication of %YAML directive"),r.length!==1&&rt(t,"YAML directive accepts exactly one argument"),s=/^([0-9]+)\.([0-9]+)$/.exec(r[0]),s===null&&rt(t,"ill-formed argument of the YAML directive"),i=parseInt(s[1],10),a=parseInt(s[2],10),i!==1&&rt(t,"unacceptable YAML version of the document"),t.version=r[0],t.checkLineBreaks=a<2,a!==1&&a!==2&&om(t,"unsupported YAML version of the document")},TAG:function(t,n,r){var s,i;r.length!==2&&rt(t,"TAG directive accepts exactly two arguments"),s=r[0],i=r[1],uI.test(s)||rt(t,"ill-formed tag handle (first argument) of the TAG directive"),Ra.call(t.tagMap,s)&&rt(t,'there is a previously declared suffix for "'+s+'" tag handle'),dI.test(i)||rt(t,"ill-formed tag prefix (second argument) of the TAG directive");try{i=decodeURIComponent(i)}catch{rt(t,"tag prefix is malformed: "+i)}t.tagMap[s]=i}};function _a(e,t,n,r){var s,i,a,l;if(t<n){if(l=e.input.slice(t,n),r)for(s=0,i=l.length;s<i;s+=1)a=l.charCodeAt(s),a===9||32<=a&&a<=1114111||rt(e,"expected valid JSON character");else KW.test(l)&&rt(e,"the stream contains non-printable characters");e.result+=l}}function $N(e,t,n,r){var s,i,a,l;for(pr.isObject(n)||rt(e,"cannot merge mappings; the provided source object is unacceptable"),s=Object.keys(n),a=0,l=s.length;a<l;a+=1)i=s[a],Ra.call(t,i)||(fI(t,i,n[i]),r[i]=!0)}function Ac(e,t,n,r,s,i,a,l,u){var d,f;if(Array.isArray(s))for(s=Array.prototype.slice.call(s),d=0,f=s.length;d<f;d+=1)Array.isArray(s[d])&&rt(e,"nested arrays are not supported inside keys"),typeof s=="object"&&LN(s[d])==="[object Object]"&&(s[d]="[object Object]");if(typeof s=="object"&&LN(s)==="[object Object]"&&(s="[object Object]"),s=String(s),t===null&&(t={}),r==="tag:yaml.org,2002:merge")if(Array.isArray(i))for(d=0,f=i.length;d<f;d+=1)$N(e,t,i[d],n);else $N(e,t,i,n);else!e.json&&!Ra.call(n,s)&&Ra.call(t,s)&&(e.line=a||e.line,e.lineStart=l||e.lineStart,e.position=u||e.position,rt(e,"duplicated mapping key")),fI(t,s,i),delete n[s];return t}function _v(e){var t;t=e.input.charCodeAt(e.position),t===10?e.position++:t===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):rt(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function ar(e,t,n){for(var r=0,s=e.input.charCodeAt(e.position);s!==0;){for(;Sl(s);)s===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),s=e.input.charCodeAt(++e.position);if(t&&s===35)do s=e.input.charCodeAt(++e.position);while(s!==10&&s!==13&&s!==0);if(ao(s))for(_v(e),s=e.input.charCodeAt(e.position),r++,e.lineIndent=0;s===32;)e.lineIndent++,s=e.input.charCodeAt(++e.position);else break}return n!==-1&&r!==0&&e.lineIndent<n&&om(e,"deficient indentation"),r}function ig(e){var t=e.position,n;return n=e.input.charCodeAt(t),!!((n===45||n===46)&&n===e.input.charCodeAt(t+1)&&n===e.input.charCodeAt(t+2)&&(t+=3,n=e.input.charCodeAt(t),n===0||us(n)))}function Pv(e,t){t===1?e.result+=" ":t>1&&(e.result+=pr.repeat(`
|
|
88
|
+
`,t-1))}function eV(e,t,n){var r,s,i,a,l,u,d,f,c=e.kind,p=e.result,h;if(h=e.input.charCodeAt(e.position),us(h)||Pc(h)||h===35||h===38||h===42||h===33||h===124||h===62||h===39||h===34||h===37||h===64||h===96||(h===63||h===45)&&(s=e.input.charCodeAt(e.position+1),us(s)||n&&Pc(s)))return!1;for(e.kind="scalar",e.result="",i=a=e.position,l=!1;h!==0;){if(h===58){if(s=e.input.charCodeAt(e.position+1),us(s)||n&&Pc(s))break}else if(h===35){if(r=e.input.charCodeAt(e.position-1),us(r))break}else{if(e.position===e.lineStart&&ig(e)||n&&Pc(h))break;if(ao(h))if(u=e.line,d=e.lineStart,f=e.lineIndent,ar(e,!1,-1),e.lineIndent>=t){l=!0,h=e.input.charCodeAt(e.position);continue}else{e.position=a,e.line=u,e.lineStart=d,e.lineIndent=f;break}}l&&(_a(e,i,a,!1),Pv(e,e.line-u),i=a=e.position,l=!1),Sl(h)||(a=e.position+1),h=e.input.charCodeAt(++e.position)}return _a(e,i,a,!1),e.result?!0:(e.kind=c,e.result=p,!1)}function tV(e,t){var n,r,s;if(n=e.input.charCodeAt(e.position),n!==39)return!1;for(e.kind="scalar",e.result="",e.position++,r=s=e.position;(n=e.input.charCodeAt(e.position))!==0;)if(n===39)if(_a(e,r,e.position,!0),n=e.input.charCodeAt(++e.position),n===39)r=e.position,e.position++,s=e.position;else return!0;else ao(n)?(_a(e,r,s,!0),Pv(e,ar(e,!1,t)),r=s=e.position):e.position===e.lineStart&&ig(e)?rt(e,"unexpected end of the document within a single quoted scalar"):(e.position++,s=e.position);rt(e,"unexpected end of the stream within a single quoted scalar")}function nV(e,t){var n,r,s,i,a,l;if(l=e.input.charCodeAt(e.position),l!==34)return!1;for(e.kind="scalar",e.result="",e.position++,n=r=e.position;(l=e.input.charCodeAt(e.position))!==0;){if(l===34)return _a(e,n,e.position,!0),e.position++,!0;if(l===92){if(_a(e,n,e.position,!0),l=e.input.charCodeAt(++e.position),ao(l))ar(e,!1,t);else if(l<256&&pI[l])e.result+=hI[l],e.position++;else if((a=XW(l))>0){for(s=a,i=0;s>0;s--)l=e.input.charCodeAt(++e.position),(a=GW(l))>=0?i=(i<<4)+a:rt(e,"expected hexadecimal character");e.result+=QW(i),e.position++}else rt(e,"unknown escape sequence");n=r=e.position}else ao(l)?(_a(e,n,r,!0),Pv(e,ar(e,!1,t)),n=r=e.position):e.position===e.lineStart&&ig(e)?rt(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}rt(e,"unexpected end of the stream within a double quoted scalar")}function rV(e,t){var n=!0,r,s,i,a=e.tag,l,u=e.anchor,d,f,c,p,h,g=Object.create(null),v,k,y,b;if(b=e.input.charCodeAt(e.position),b===91)f=93,h=!1,l=[];else if(b===123)f=125,h=!0,l={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=l),b=e.input.charCodeAt(++e.position);b!==0;){if(ar(e,!0,t),b=e.input.charCodeAt(e.position),b===f)return e.position++,e.tag=a,e.anchor=u,e.kind=h?"mapping":"sequence",e.result=l,!0;n?b===44&&rt(e,"expected the node content, but found ','"):rt(e,"missed comma between flow collection entries"),k=v=y=null,c=p=!1,b===63&&(d=e.input.charCodeAt(e.position+1),us(d)&&(c=p=!0,e.position++,ar(e,!0,t))),r=e.line,s=e.lineStart,i=e.position,iu(e,t,sm,!1,!0),k=e.tag,v=e.result,ar(e,!0,t),b=e.input.charCodeAt(e.position),(p||e.line===r)&&b===58&&(c=!0,b=e.input.charCodeAt(++e.position),ar(e,!0,t),iu(e,t,sm,!1,!0),y=e.result),h?Ac(e,l,g,k,v,y,r,s,i):c?l.push(Ac(e,null,g,k,v,y,r,s,i)):l.push(v),ar(e,!0,t),b=e.input.charCodeAt(e.position),b===44?(n=!0,b=e.input.charCodeAt(++e.position)):n=!1}rt(e,"unexpected end of the stream within a flow collection")}function sV(e,t){var n,r,s=$y,i=!1,a=!1,l=t,u=0,d=!1,f,c;if(c=e.input.charCodeAt(e.position),c===124)r=!1;else if(c===62)r=!0;else return!1;for(e.kind="scalar",e.result="";c!==0;)if(c=e.input.charCodeAt(++e.position),c===43||c===45)$y===s?s=c===43?RN:UW:rt(e,"repeat of a chomping mode identifier");else if((f=JW(c))>=0)f===0?rt(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):a?rt(e,"repeat of an indentation width identifier"):(l=t+f-1,a=!0);else break;if(Sl(c)){do c=e.input.charCodeAt(++e.position);while(Sl(c));if(c===35)do c=e.input.charCodeAt(++e.position);while(!ao(c)&&c!==0)}for(;c!==0;){for(_v(e),e.lineIndent=0,c=e.input.charCodeAt(e.position);(!a||e.lineIndent<l)&&c===32;)e.lineIndent++,c=e.input.charCodeAt(++e.position);if(!a&&e.lineIndent>l&&(l=e.lineIndent),ao(c)){u++;continue}if(e.lineIndent<l){s===RN?e.result+=pr.repeat(`
|
|
89
|
+
`,i?1+u:u):s===$y&&i&&(e.result+=`
|
|
90
|
+
`);break}for(r?Sl(c)?(d=!0,e.result+=pr.repeat(`
|
|
91
|
+
`,i?1+u:u)):d?(d=!1,e.result+=pr.repeat(`
|
|
92
|
+
`,u+1)):u===0?i&&(e.result+=" "):e.result+=pr.repeat(`
|
|
93
|
+
`,u):e.result+=pr.repeat(`
|
|
94
|
+
`,i?1+u:u),i=!0,a=!0,u=0,n=e.position;!ao(c)&&c!==0;)c=e.input.charCodeAt(++e.position);_a(e,n,e.position,!1)}return!0}function DN(e,t){var n,r=e.tag,s=e.anchor,i=[],a,l=!1,u;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=i),u=e.input.charCodeAt(e.position);u!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,rt(e,"tab characters must not be used in indentation")),!(u!==45||(a=e.input.charCodeAt(e.position+1),!us(a))));){if(l=!0,e.position++,ar(e,!0,-1)&&e.lineIndent<=t){i.push(null),u=e.input.charCodeAt(e.position);continue}if(n=e.line,iu(e,t,cI,!1,!0),i.push(e.result),ar(e,!0,-1),u=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&u!==0)rt(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break}return l?(e.tag=r,e.anchor=s,e.kind="sequence",e.result=i,!0):!1}function iV(e,t,n){var r,s,i,a,l,u,d=e.tag,f=e.anchor,c={},p=Object.create(null),h=null,g=null,v=null,k=!1,y=!1,b;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=c),b=e.input.charCodeAt(e.position);b!==0;){if(!k&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,rt(e,"tab characters must not be used in indentation")),r=e.input.charCodeAt(e.position+1),i=e.line,(b===63||b===58)&&us(r))b===63?(k&&(Ac(e,c,p,h,g,null,a,l,u),h=g=v=null),y=!0,k=!0,s=!0):k?(k=!1,s=!0):rt(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,b=r;else{if(a=e.line,l=e.lineStart,u=e.position,!iu(e,n,lI,!1,!0))break;if(e.line===i){for(b=e.input.charCodeAt(e.position);Sl(b);)b=e.input.charCodeAt(++e.position);if(b===58)b=e.input.charCodeAt(++e.position),us(b)||rt(e,"a whitespace character is expected after the key-value separator within a block mapping"),k&&(Ac(e,c,p,h,g,null,a,l,u),h=g=v=null),y=!0,k=!1,s=!1,h=e.tag,g=e.result;else if(y)rt(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=d,e.anchor=f,!0}else if(y)rt(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=d,e.anchor=f,!0}if((e.line===i||e.lineIndent>t)&&(k&&(a=e.line,l=e.lineStart,u=e.position),iu(e,t,im,!0,s)&&(k?g=e.result:v=e.result),k||(Ac(e,c,p,h,g,v,a,l,u),h=g=v=null),ar(e,!0,-1),b=e.input.charCodeAt(e.position)),(e.line===i||e.lineIndent>t)&&b!==0)rt(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return k&&Ac(e,c,p,h,g,null,a,l,u),y&&(e.tag=d,e.anchor=f,e.kind="mapping",e.result=c),y}function oV(e){var t,n=!1,r=!1,s,i,a;if(a=e.input.charCodeAt(e.position),a!==33)return!1;if(e.tag!==null&&rt(e,"duplication of a tag property"),a=e.input.charCodeAt(++e.position),a===60?(n=!0,a=e.input.charCodeAt(++e.position)):a===33?(r=!0,s="!!",a=e.input.charCodeAt(++e.position)):s="!",t=e.position,n){do a=e.input.charCodeAt(++e.position);while(a!==0&&a!==62);e.position<e.length?(i=e.input.slice(t,e.position),a=e.input.charCodeAt(++e.position)):rt(e,"unexpected end of the stream within a verbatim tag")}else{for(;a!==0&&!us(a);)a===33&&(r?rt(e,"tag suffix cannot contain exclamation marks"):(s=e.input.slice(t-1,e.position+1),uI.test(s)||rt(e,"named tag handle cannot contain such characters"),r=!0,t=e.position+1)),a=e.input.charCodeAt(++e.position);i=e.input.slice(t,e.position),YW.test(i)&&rt(e,"tag suffix cannot contain flow indicator characters")}i&&!dI.test(i)&&rt(e,"tag name cannot contain such characters: "+i);try{i=decodeURIComponent(i)}catch{rt(e,"tag name is malformed: "+i)}return n?e.tag=i:Ra.call(e.tagMap,s)?e.tag=e.tagMap[s]+i:s==="!"?e.tag="!"+i:s==="!!"?e.tag="tag:yaml.org,2002:"+i:rt(e,'undeclared tag handle "'+s+'"'),!0}function aV(e){var t,n;if(n=e.input.charCodeAt(e.position),n!==38)return!1;for(e.anchor!==null&&rt(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;n!==0&&!us(n)&&!Pc(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&rt(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function lV(e){var t,n,r;if(r=e.input.charCodeAt(e.position),r!==42)return!1;for(r=e.input.charCodeAt(++e.position),t=e.position;r!==0&&!us(r)&&!Pc(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&rt(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),Ra.call(e.anchorMap,n)||rt(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],ar(e,!0,-1),!0}function iu(e,t,n,r,s){var i,a,l,u=1,d=!1,f=!1,c,p,h,g,v,k;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,i=a=l=im===n||cI===n,r&&ar(e,!0,-1)&&(d=!0,e.lineIndent>t?u=1:e.lineIndent===t?u=0:e.lineIndent<t&&(u=-1)),u===1)for(;oV(e)||aV(e);)ar(e,!0,-1)?(d=!0,l=i,e.lineIndent>t?u=1:e.lineIndent===t?u=0:e.lineIndent<t&&(u=-1)):l=!1;if(l&&(l=d||s),(u===1||im===n)&&(sm===n||lI===n?v=t:v=t+1,k=e.position-e.lineStart,u===1?l&&(DN(e,k)||iV(e,k,v))||rV(e,v)?f=!0:(a&&sV(e,v)||tV(e,v)||nV(e,v)?f=!0:lV(e)?(f=!0,(e.tag!==null||e.anchor!==null)&&rt(e,"alias node should not have any properties")):eV(e,v,sm===n)&&(f=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):u===0&&(f=l&&DN(e,k))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&rt(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),c=0,p=e.implicitTypes.length;c<p;c+=1)if(g=e.implicitTypes[c],g.resolve(e.result)){e.result=g.construct(e.result),e.tag=g.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(Ra.call(e.typeMap[e.kind||"fallback"],e.tag))g=e.typeMap[e.kind||"fallback"][e.tag];else for(g=null,h=e.typeMap.multi[e.kind||"fallback"],c=0,p=h.length;c<p;c+=1)if(e.tag.slice(0,h[c].tag.length)===h[c].tag){g=h[c];break}g||rt(e,"unknown tag !<"+e.tag+">"),e.result!==null&&g.kind!==e.kind&&rt(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+g.kind+'", not "'+e.kind+'"'),g.resolve(e.result,e.tag)?(e.result=g.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):rt(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||f}function cV(e){var t=e.position,n,r,s,i=!1,a;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(a=e.input.charCodeAt(e.position))!==0&&(ar(e,!0,-1),a=e.input.charCodeAt(e.position),!(e.lineIndent>0||a!==37));){for(i=!0,a=e.input.charCodeAt(++e.position),n=e.position;a!==0&&!us(a);)a=e.input.charCodeAt(++e.position);for(r=e.input.slice(n,e.position),s=[],r.length<1&&rt(e,"directive name must not be less than one character in length");a!==0;){for(;Sl(a);)a=e.input.charCodeAt(++e.position);if(a===35){do a=e.input.charCodeAt(++e.position);while(a!==0&&!ao(a));break}if(ao(a))break;for(n=e.position;a!==0&&!us(a);)a=e.input.charCodeAt(++e.position);s.push(e.input.slice(n,e.position))}a!==0&&_v(e),Ra.call(MN,r)?MN[r](e,r,s):om(e,'unknown document directive "'+r+'"')}if(ar(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,ar(e,!0,-1)):i&&rt(e,"directives end mark is expected"),iu(e,e.lineIndent-1,im,!1,!0),ar(e,!0,-1),e.checkLineBreaks&&qW.test(e.input.slice(t,e.position))&&om(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&ig(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,ar(e,!0,-1));return}if(e.position<e.length-1)rt(e,"end of the stream or a document separator is expected");else return}function gI(e,t){e=String(e),t=t||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
|
|
95
|
+
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var n=new ZW(e,t),r=e.indexOf("\0");for(r!==-1&&(n.position=r,rt(n,"null byte is not allowed in input")),n.input+="\0";n.input.charCodeAt(n.position)===32;)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)cV(n);return n.documents}function uV(e,t,n){t!==null&&typeof t=="object"&&typeof n>"u"&&(n=t,t=null);var r=gI(e,n);if(typeof t!="function")return r;for(var s=0,i=r.length;s<i;s+=1)t(r[s])}function dV(e,t){var n=gI(e,t);if(n.length!==0){if(n.length===1)return n[0];throw new Ur("expected a single document in the stream, but found more")}}var fV=uV,pV=dV,yI={loadAll:fV,load:pV},xI=Object.prototype.toString,wI=Object.prototype.hasOwnProperty,Av=65279,hV=9,cf=10,mV=13,gV=32,yV=33,xV=34,Tw=35,wV=37,bV=38,vV=39,kV=42,bI=44,SV=45,am=58,NV=61,jV=62,CV=63,EV=64,vI=91,kI=93,_V=96,SI=123,PV=124,NI=125,zr={};zr[0]="\\0";zr[7]="\\a";zr[8]="\\b";zr[9]="\\t";zr[10]="\\n";zr[11]="\\v";zr[12]="\\f";zr[13]="\\r";zr[27]="\\e";zr[34]='\\"';zr[92]="\\\\";zr[133]="\\N";zr[160]="\\_";zr[8232]="\\L";zr[8233]="\\P";var AV=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],IV=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function TV(e,t){var n,r,s,i,a,l,u;if(t===null)return{};for(n={},r=Object.keys(t),s=0,i=r.length;s<i;s+=1)a=r[s],l=String(t[a]),a.slice(0,2)==="!!"&&(a="tag:yaml.org,2002:"+a.slice(2)),u=e.compiledTypeMap.fallback[a],u&&wI.call(u.styleAliases,l)&&(l=u.styleAliases[l]),n[a]=l;return n}function RV(e){var t,n,r;if(t=e.toString(16).toUpperCase(),e<=255)n="x",r=2;else if(e<=65535)n="u",r=4;else if(e<=4294967295)n="U",r=8;else throw new Ur("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+n+pr.repeat("0",r-t.length)+t}var LV=1,uf=2;function OV(e){this.schema=e.schema||Ev,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=pr.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=TV(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?uf:LV,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function FN(e,t){for(var n=pr.repeat(" ",t),r=0,s=-1,i="",a,l=e.length;r<l;)s=e.indexOf(`
|
|
96
|
+
`,r),s===-1?(a=e.slice(r),r=l):(a=e.slice(r,s+1),r=s+1),a.length&&a!==`
|
|
97
|
+
`&&(i+=n),i+=a;return i}function Rw(e,t){return`
|
|
98
|
+
`+pr.repeat(" ",e.indent*t)}function MV(e,t){var n,r,s;for(n=0,r=e.implicitTypes.length;n<r;n+=1)if(s=e.implicitTypes[n],s.resolve(t))return!0;return!1}function lm(e){return e===gV||e===hV}function df(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==Av||65536<=e&&e<=1114111}function zN(e){return df(e)&&e!==Av&&e!==mV&&e!==cf}function BN(e,t,n){var r=zN(e),s=r&&!lm(e);return(n?r:r&&e!==bI&&e!==vI&&e!==kI&&e!==SI&&e!==NI)&&e!==Tw&&!(t===am&&!s)||zN(t)&&!lm(t)&&e===Tw||t===am&&s}function $V(e){return df(e)&&e!==Av&&!lm(e)&&e!==SV&&e!==CV&&e!==am&&e!==bI&&e!==vI&&e!==kI&&e!==SI&&e!==NI&&e!==Tw&&e!==bV&&e!==kV&&e!==yV&&e!==PV&&e!==NV&&e!==jV&&e!==vV&&e!==xV&&e!==wV&&e!==EV&&e!==_V}function DV(e){return!lm(e)&&e!==am}function ad(e,t){var n=e.charCodeAt(t),r;return n>=55296&&n<=56319&&t+1<e.length&&(r=e.charCodeAt(t+1),r>=56320&&r<=57343)?(n-55296)*1024+r-56320+65536:n}function jI(e){var t=/^\n* /;return t.test(e)}var CI=1,Lw=2,EI=3,_I=4,fc=5;function FV(e,t,n,r,s,i,a,l){var u,d=0,f=null,c=!1,p=!1,h=r!==-1,g=-1,v=$V(ad(e,0))&&DV(ad(e,e.length-1));if(t||a)for(u=0;u<e.length;d>=65536?u+=2:u++){if(d=ad(e,u),!df(d))return fc;v=v&&BN(d,f,l),f=d}else{for(u=0;u<e.length;d>=65536?u+=2:u++){if(d=ad(e,u),d===cf)c=!0,h&&(p=p||u-g-1>r&&e[g+1]!==" ",g=u);else if(!df(d))return fc;v=v&&BN(d,f,l),f=d}p=p||h&&u-g-1>r&&e[g+1]!==" "}return!c&&!p?v&&!a&&!s(e)?CI:i===uf?fc:Lw:n>9&&jI(e)?fc:a?i===uf?fc:Lw:p?_I:EI}function zV(e,t,n,r,s){e.dump=function(){if(t.length===0)return e.quotingType===uf?'""':"''";if(!e.noCompatMode&&(AV.indexOf(t)!==-1||IV.test(t)))return e.quotingType===uf?'"'+t+'"':"'"+t+"'";var i=e.indent*Math.max(1,n),a=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-i),l=r||e.flowLevel>-1&&n>=e.flowLevel;function u(d){return MV(e,d)}switch(FV(t,l,e.indent,a,u,e.quotingType,e.forceQuotes&&!r,s)){case CI:return t;case Lw:return"'"+t.replace(/'/g,"''")+"'";case EI:return"|"+HN(t,e.indent)+WN(FN(t,i));case _I:return">"+HN(t,e.indent)+WN(FN(BV(t,a),i));case fc:return'"'+HV(t)+'"';default:throw new Ur("impossible error: invalid scalar style")}}()}function HN(e,t){var n=jI(e)?String(t):"",r=e[e.length-1]===`
|
|
99
|
+
`,s=r&&(e[e.length-2]===`
|
|
100
|
+
`||e===`
|
|
101
|
+
`),i=s?"+":r?"":"-";return n+i+`
|
|
102
|
+
`}function WN(e){return e[e.length-1]===`
|
|
103
|
+
`?e.slice(0,-1):e}function BV(e,t){for(var n=/(\n+)([^\n]*)/g,r=function(){var d=e.indexOf(`
|
|
104
|
+
`);return d=d!==-1?d:e.length,n.lastIndex=d,VN(e.slice(0,d),t)}(),s=e[0]===`
|
|
105
|
+
`||e[0]===" ",i,a;a=n.exec(e);){var l=a[1],u=a[2];i=u[0]===" ",r+=l+(!s&&!i&&u!==""?`
|
|
106
|
+
`:"")+VN(u,t),s=i}return r}function VN(e,t){if(e===""||e[0]===" ")return e;for(var n=/ [^ ]/g,r,s=0,i,a=0,l=0,u="";r=n.exec(e);)l=r.index,l-s>t&&(i=a>s?a:l,u+=`
|
|
107
|
+
`+e.slice(s,i),s=i+1),a=l;return u+=`
|
|
108
|
+
`,e.length-s>t&&a>s?u+=e.slice(s,a)+`
|
|
109
|
+
`+e.slice(a+1):u+=e.slice(s),u.slice(1)}function HV(e){for(var t="",n=0,r,s=0;s<e.length;n>=65536?s+=2:s++)n=ad(e,s),r=zr[n],!r&&df(n)?(t+=e[s],n>=65536&&(t+=e[s+1])):t+=r||RV(n);return t}function WV(e,t,n){var r="",s=e.tag,i,a,l;for(i=0,a=n.length;i<a;i+=1)l=n[i],e.replacer&&(l=e.replacer.call(n,String(i),l)),(Do(e,t,l,!1,!1)||typeof l>"u"&&Do(e,t,null,!1,!1))&&(r!==""&&(r+=","+(e.condenseFlow?"":" ")),r+=e.dump);e.tag=s,e.dump="["+r+"]"}function UN(e,t,n,r){var s="",i=e.tag,a,l,u;for(a=0,l=n.length;a<l;a+=1)u=n[a],e.replacer&&(u=e.replacer.call(n,String(a),u)),(Do(e,t+1,u,!0,!0,!1,!0)||typeof u>"u"&&Do(e,t+1,null,!0,!0,!1,!0))&&((!r||s!=="")&&(s+=Rw(e,t)),e.dump&&cf===e.dump.charCodeAt(0)?s+="-":s+="- ",s+=e.dump);e.tag=i,e.dump=s||"[]"}function VV(e,t,n){var r="",s=e.tag,i=Object.keys(n),a,l,u,d,f;for(a=0,l=i.length;a<l;a+=1)f="",r!==""&&(f+=", "),e.condenseFlow&&(f+='"'),u=i[a],d=n[u],e.replacer&&(d=e.replacer.call(n,u,d)),Do(e,t,u,!1,!1)&&(e.dump.length>1024&&(f+="? "),f+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Do(e,t,d,!1,!1)&&(f+=e.dump,r+=f));e.tag=s,e.dump="{"+r+"}"}function UV(e,t,n,r){var s="",i=e.tag,a=Object.keys(n),l,u,d,f,c,p;if(e.sortKeys===!0)a.sort();else if(typeof e.sortKeys=="function")a.sort(e.sortKeys);else if(e.sortKeys)throw new Ur("sortKeys must be a boolean or a function");for(l=0,u=a.length;l<u;l+=1)p="",(!r||s!=="")&&(p+=Rw(e,t)),d=a[l],f=n[d],e.replacer&&(f=e.replacer.call(n,d,f)),Do(e,t+1,d,!0,!0,!0)&&(c=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,c&&(e.dump&&cf===e.dump.charCodeAt(0)?p+="?":p+="? "),p+=e.dump,c&&(p+=Rw(e,t)),Do(e,t+1,f,!0,c)&&(e.dump&&cf===e.dump.charCodeAt(0)?p+=":":p+=": ",p+=e.dump,s+=p));e.tag=i,e.dump=s||"{}"}function KN(e,t,n){var r,s,i,a,l,u;for(s=n?e.explicitTypes:e.implicitTypes,i=0,a=s.length;i<a;i+=1)if(l=s[i],(l.instanceOf||l.predicate)&&(!l.instanceOf||typeof t=="object"&&t instanceof l.instanceOf)&&(!l.predicate||l.predicate(t))){if(n?l.multi&&l.representName?e.tag=l.representName(t):e.tag=l.tag:e.tag="?",l.represent){if(u=e.styleMap[l.tag]||l.defaultStyle,xI.call(l.represent)==="[object Function]")r=l.represent(t,u);else if(wI.call(l.represent,u))r=l.represent[u](t,u);else throw new Ur("!<"+l.tag+'> tag resolver accepts not "'+u+'" style');e.dump=r}return!0}return!1}function Do(e,t,n,r,s,i,a){e.tag=null,e.dump=n,KN(e,n,!1)||KN(e,n,!0);var l=xI.call(e.dump),u=r,d;r&&(r=e.flowLevel<0||e.flowLevel>t);var f=l==="[object Object]"||l==="[object Array]",c,p;if(f&&(c=e.duplicates.indexOf(n),p=c!==-1),(e.tag!==null&&e.tag!=="?"||p||e.indent!==2&&t>0)&&(s=!1),p&&e.usedDuplicates[c])e.dump="*ref_"+c;else{if(f&&p&&!e.usedDuplicates[c]&&(e.usedDuplicates[c]=!0),l==="[object Object]")r&&Object.keys(e.dump).length!==0?(UV(e,t,e.dump,s),p&&(e.dump="&ref_"+c+e.dump)):(VV(e,t,e.dump),p&&(e.dump="&ref_"+c+" "+e.dump));else if(l==="[object Array]")r&&e.dump.length!==0?(e.noArrayIndent&&!a&&t>0?UN(e,t-1,e.dump,s):UN(e,t,e.dump,s),p&&(e.dump="&ref_"+c+e.dump)):(WV(e,t,e.dump),p&&(e.dump="&ref_"+c+" "+e.dump));else if(l==="[object String]")e.tag!=="?"&&zV(e,e.dump,t,i,u);else{if(l==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new Ur("unacceptable kind of an object to dump "+l)}e.tag!==null&&e.tag!=="?"&&(d=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?d="!"+d:d.slice(0,18)==="tag:yaml.org,2002:"?d="!!"+d.slice(18):d="!<"+d+">",e.dump=d+" "+e.dump)}return!0}function KV(e,t){var n=[],r=[],s,i;for(Ow(e,n,r),s=0,i=r.length;s<i;s+=1)t.duplicates.push(n[r[s]]);t.usedDuplicates=new Array(i)}function Ow(e,t,n){var r,s,i;if(e!==null&&typeof e=="object")if(s=t.indexOf(e),s!==-1)n.indexOf(s)===-1&&n.push(s);else if(t.push(e),Array.isArray(e))for(s=0,i=e.length;s<i;s+=1)Ow(e[s],t,n);else for(r=Object.keys(e),s=0,i=r.length;s<i;s+=1)Ow(e[r[s]],t,n)}function qV(e,t){t=t||{};var n=new OV(t);n.noRefs||KV(e,n);var r=e;return n.replacer&&(r=n.replacer.call({"":r},"",r)),Do(n,0,r,!0,!0)?n.dump+`
|
|
110
|
+
`:""}var YV=qV,GV={dump:YV};function Iv(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var XV=Pr,JV=WA,QV=qA,ZV=QA,e7=ZA,t7=Ev,n7=yI.load,r7=yI.loadAll,s7=GV.dump,i7=Ur,o7={binary:sI,float:JA,map:KA,null:YA,pairs:oI,set:aI,timestamp:nI,bool:GA,int:XA,merge:rI,omap:iI,seq:UA,str:VA},a7=Iv("safeLoad","load"),l7=Iv("safeLoadAll","loadAll"),c7=Iv("safeDump","dump"),PI={Type:XV,Schema:JV,FAILSAFE_SCHEMA:QV,JSON_SCHEMA:ZV,CORE_SCHEMA:e7,DEFAULT_SCHEMA:t7,load:n7,loadAll:r7,dump:s7,YAMLException:i7,types:o7,safeLoad:a7,safeLoadAll:l7,safeDump:c7};const La=["requirement","planning","code","test","normal"],Mw={普通:"normal",技术规划:"planning",代码执行:"code",测试回归:"test",需求拆解:"requirement"},u7=["agent","control","provide","condition","jump","condition_jump","start","end"];function d7(e){return u7.includes(e)?e:"agent"}function f7(e){const t=(e||"").toLowerCase();return t.startsWith("control_")?"control":t.startsWith("agent_")?"agent":t.startsWith("provide_")?"provide":(t.startsWith("tool_"),"agent")}function p7(e){var t;if(!(e!=null&&e.trim()))return{nodes:[],edges:[],instances:{}};try{const n=PI.load(e);if(!n||typeof n!="object")return{error:"flow.yaml 格式无效:根内容不是对象"};const r=n,s=r.instances&&typeof r.instances=="object"?r.instances:{},i=Array.isArray(r.edges)?r.edges:Array.isArray((t=r.flow)==null?void 0:t.edges)?r.flow.edges:[],a=r.ui&&typeof r.ui=="object"?r.ui:{},l=a.nodePositions&&typeof a.nodePositions=="object"?a.nodePositions:{},u=a.nodeSizes&&typeof a.nodeSizes=="object"?a.nodeSizes:{},d=typeof a.description=="string"&&a.description.trim()?a.description.trim():void 0,f=new Set(Object.keys(s));for(const h of i)h!=null&&h.source&&f.add(String(h.source)),h!=null&&h.target&&f.add(String(h.target));const c=Array.from(f).map(h=>{const g=s[h],v=l[h]&&typeof l[h].x=="number"&&typeof l[h].y=="number"?{x:l[h].x,y:l[h].y}:{x:0,y:0},k=u[h]&&typeof u[h].width=="number"&&typeof u[h].height=="number"?{width:u[h].width,height:u[h].height}:null,y=(g==null?void 0:g.definitionId)??h,b=f7(y),w=(g==null?void 0:g.label)!=null?String(g.label):h,N=(g==null?void 0:g.role)!=null?String(g.role).trim():"",C=Mw[N]||N,j=La.includes(C)?C:"normal",R=(g==null?void 0:g.model)!=null?String(g.model).trim():void 0,D=(g==null?void 0:g.body)!=null?String(g.body):"",M=(g==null?void 0:g.script)!=null?String(g.script):"",z=Array.isArray(g==null?void 0:g.images)?g.images:[];return{id:h,type:d7(b),position:v,...k?{width:k.width,height:k.height}:{},data:{label:w,definitionId:y,schemaType:b,role:j,model:R||void 0,body:D,images:z,...k?{displaySize:k}:{},...M.trim()!==""?{script:M}:{}}}}),p=i.filter(h=>(h==null?void 0:h.source)&&(h==null?void 0:h.target)).map((h,g)=>({id:`e-${h.source}-${h.target}-${g}`,source:String(h.source),target:String(h.target),sourceHandle:h.sourceHandle??void 0,targetHandle:h.targetHandle??void 0,markerEnd:{type:gs.ArrowClosed}}));return{nodes:c,edges:p,instances:s,description:d}}catch(n){const r=n instanceof Error?n.message:String(n);let s="";if(/bad indentation of a mapping entry|expected.*scalar|mapping values are not allowed/i.test(r)){const i=r.match(/\((\d+):/);s=`
|
|
111
|
+
|
|
112
|
+
💡 提示:通常由 ${i?`第 ${i[1]} 行附近`:""}的 \`script\` / \`body\` / \`value\` 字段裸写命令字符串引起。
|
|
113
|
+
YAML 中含 \`: \`、\`"\`、\`'\` 等特殊字符的多行字符串必须使用 \`|\` 块标量。
|
|
114
|
+
|
|
115
|
+
✅ 正确写法:
|
|
116
|
+
\`\`\`yaml
|
|
117
|
+
script: |
|
|
118
|
+
node -e "console.log('TODO: scripts/x.mjs')"
|
|
119
|
+
\`\`\`
|
|
120
|
+
❌ 错误写法(当前文件):
|
|
121
|
+
\`\`\`yaml
|
|
122
|
+
script: node -e "console.log('TODO: scripts/x.mjs')"
|
|
123
|
+
\`\`\``}return{error:`flow.yaml 解析失败:${r}${s}`}}}function Rf(e,t){var s,i,a,l,u,d,f,c,p,h,g,v;const n=k=>{const y={type:(k==null?void 0:k.type)??"node",name:(k==null?void 0:k.name)??"",value:(k==null?void 0:k.value)??(k==null?void 0:k.default)??""};return(k==null?void 0:k.required)===!0&&(y.required=!0),(k==null?void 0:k.showOnNode)!=null&&(y.showOnNode=!!k.showOnNode),y},r={};for(const k of e){const y=t[k.id]&&typeof t[k.id]=="object"?{...t[k.id]}:{},b=((s=k.data)==null?void 0:s.definitionId)||k.id,w=((i=k.data)==null?void 0:i.inputs)??[],N=((a=k.data)==null?void 0:a.outputs)??[],C=((l=k.data)==null?void 0:l.role)!=null?String(k.data.role).trim():"",j=y.role!=null?String(y.role).trim():"",R=Mw[C]||C,D=Mw[j]||j,M=La.includes(R)?R:La.includes(D)?D:"normal",z=Array.isArray(w)?w.map(n):Array.isArray(y.input)?y.input.map(U=>n(U)):[],$=Array.isArray(N)?N.map(n):Array.isArray(y.output)?y.output.map(U=>n(U)):[],A=((u=k.data)==null?void 0:u.label)!=null?String(k.data.label):y.label!=null?String(y.label):k.id,F=(d=k.data)==null?void 0:d.body,T=F!=null?String(F):y.body!=null?String(y.body):"";let O=((f=k.data)==null?void 0:f.model)!=null&&String(k.data.model).trim()!==""?String(k.data.model).trim():y.model!=null&&String(y.model).trim()!==""?String(y.model).trim():void 0;(O===""||O==="default")&&(O=void 0);const I={...y,definitionId:b,label:A,role:M,model:O,input:z,output:$},B=((c=k.data)==null?void 0:c.marketplaceRef)||y.marketplaceRef;B?I.marketplaceRef=String(B):delete I.marketplaceRef;const P=((p=k.data)==null?void 0:p.marketplacePackageId)||y.marketplacePackageId;P?I.marketplacePackageId=String(P):delete I.marketplacePackageId;const L=((h=k.data)==null?void 0:h.marketplaceVersion)||y.marketplaceVersion;L?I.marketplaceVersion=String(L):delete I.marketplaceVersion,b.startsWith("provide_")||T.trim()===""?delete I.body:I.body=T;const _=Array.isArray((g=k.data)==null?void 0:g.images)?k.data.images:Array.isArray(y.images)?y.images:[];_.length>0?I.images=_:delete I.images;const G=(v=k.data)==null?void 0:v.script,Z=G!=null?String(G):y.script!=null?String(y.script):"";Z.trim()===""?delete I.script:I.script=Z,delete I.temperature,delete I.maxTokens,delete I.description,r[k.id]=I}return r}function Ed(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function h7(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 AI(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=>Ed(a)),edges:i.map(a=>Ed(a)),instances:Rf(r,n||{})}}function II(e,t,n,r,s={}){var c;if(!e||!Array.isArray(e.nodes)||e.nodes.length===0)return null;const i=s.offset||{x:48,y:48},a=new Set((t||[]).map(p=>p.id)),l=new Map;for(const p of e.nodes)l.set(p.id,h7(p.id,a));const u=e.nodes.map(p=>{var g,v;const h=l.get(p.id);return{...Ed(p),id:h,selected:!0,dragging:!1,position:{x:Number(((g=p.position)==null?void 0:g.x)||0)+i.x,y:Number(((v=p.position)==null?void 0:v.y)||0)+i.y}}}),d=(e.edges||[]).filter(p=>l.has(p.source)&&l.has(p.target)).map((p,h)=>{const g=l.get(p.source),v=l.get(p.target);return{...Ed(p),id:`e-${g}-${v}-${Date.now()}-${h}`,source:g,target:v,selected:!1}}),f={...r||{}};for(const[p,h]of l.entries()){const g=(c=e.instances)==null?void 0:c[p];g&&(f[h]={...Ed(g),label:g.label!=null?String(g.label):h})}return{nodes:[...(t||[]).map(p=>({...p,selected:!1})),...u],edges:[...(n||[]).map(p=>({...p,selected:!1})),...d],instances:f,pastedNodeIds:u.map(p=>p.id)}}function qN(e,t,n,r){var f,c,p,h;const s=Rf(e,n),i=t.map(g=>({source:g.source,target:g.target,sourceHandle:g.sourceHandle??null,targetHandle:g.targetHandle??null})),a={},l={};for(const g of e){const v=g.position??{x:0,y:0};a[g.id]={x:v.x,y:v.y};const k=Number(((c=(f=g.data)==null?void 0:f.displaySize)==null?void 0:c.width)||g.width||0),y=Number(((h=(p=g.data)==null?void 0:p.displaySize)==null?void 0:h.height)||g.height||0);k>0&&y>0&&(l[g.id]={width:Math.round(k),height:Math.round(y)})}const u={nodePositions:a};Object.keys(l).length>0&&(u.nodeSizes=l),(r==null?void 0:r.description)!=null&&String(r.description).trim()!==""&&(u.description=String(r.description).trim());const d={instances:s,edges:i,ui:u};return PI.dump(d,{lineWidth:-1})}function m7(e){var s,i;const t={inputNames:[],outputNames:[]},n=Array.isArray((s=e.data)==null?void 0:s.inputs)?e.data.inputs:[],r=Array.isArray((i=e.data)==null?void 0:i.outputs)?e.data.outputs:[];for(let a=0;a<n.length;a++){const l=n[a],u=(l&&l.name!=null?String(l.name).trim():"")||`input-${a}`;t.inputNames.push(u)}for(let a=0;a<r.length;a++){const l=r[a],u=(l&&l.name!=null?String(l.name).trim():"")||`output-${a}`;t.outputNames.push(u)}return t}function g7(e,t,n){var u,d,f;const r=new Set(e.map(c=>c.id)),s={};for(const c of e)s[c.id]=m7(c);const i=new Map,a=new Map;for(const c of t)c.target&&r.has(c.target)&&(i.has(c.target)||i.set(c.target,new Set),c.targetHandle&&i.get(c.target).add(c.targetHandle)),c.source&&r.has(c.source)&&(a.has(c.source)||a.set(c.source,new Set),c.sourceHandle&&a.get(c.source).add(c.sourceHandle));const l=[];for(const c of e){const p=((u=c.data)==null?void 0:u.definitionId)!=null?String(c.data.definitionId):"",h=s[c.id]||{inputNames:[],outputNames:[]},g=h.inputNames.length,v=h.outputNames.length;if(!(p==="control_start"||p.startsWith("provide_"))&&g>0)for(let b=0;b<g;b++){const w=`input-${b}`;if(!((d=i.get(c.id))==null?void 0:d.has(w))){const C=h.inputNames[b]||w;l.push({nodeId:c.id,suffix:n("flow:validation.inputSlotNoEdge",{slotName:C,handle:w}),key:`${c.id}-${w}-in`})}}if(!(p==="control_end")&&v>0)for(let b=0;b<v;b++){const w=`output-${b}`;if(!((f=a.get(c.id))==null?void 0:f.has(w))){const C=h.outputNames[b]||w;l.push({nodeId:c.id,suffix:n("flow:validation.outputSlotNoEdge",{slotName:C,handle:w}),key:`${c.id}-${w}-out`})}}}return l}const cm=/\[image\s+(\d+)\]/gi;function ds(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 y7(e){return`image ${ds(e).length+1}`}function x7(e,t){const n=String(e||""),r=`[${t}]`;return n.trim()?`${n.replace(/[ \t]+$/u,"")} ${r}`:r}function w7(e,t){const n=ds(e),r=String(t||""),s=new Set;cm.lastIndex=0;let i;for(;i=cm.exec(r);)s.add(`image ${i[1]}`.toLowerCase());return s.size===0?[]:n.filter(a=>s.has(String(a.label||"").toLowerCase()))}function b7(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 TI(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 um(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 RI({files:e,body:t,images:n}){const r=Array.from(e||[]);if(r.length===0)return null;let s=String(t||"");const i=ds(n);for(const a of r){const l=await b7(a),u=y7(i);i.push({id:`${Date.now().toString(36)}-${i.length+1}`,label:u,...l}),s=x7(s,u)}return{body:s,images:i}}function $w(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),r.showOnNode=n?!!e.showOnNode:!!r.required||String(t).trim().toLowerCase()==="node",r._showOnNodeExplicit=n,r}const v7={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"],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_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_bool:["Boolean"],provide_text:["Text"],provide_str:["Text"],display_markdown:["Markdown Display"],display_mermaid:["Mermaid Display"],display_ascii:["ASCII Display"],display_chart:["Chart Display"],display_table:["Table Display"]};function k7(e,t,n){const r=String((n==null?void 0:n.displayName)||"").trim(),s=String(t||"").trim();return!r||!s||r===s?s:(v7[e]||[]).includes(s)?r:s}const S7={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"])},N7={control_cd_workspace:new Set(["mode","label","cwd","previous"]),control_user_workspace:new Set(["cwd"]),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"])},j7=new Set(["display_markdown","display_mermaid","display_ascii","display_html","display_image","display_chart","display_table"]);function C7(e,t){if(!j7.has(String(e||"")))return!1;const n=String((t==null?void 0:t.name)||"");return n==="content"||n==="src"}function E7(e){const t=String((e==null?void 0:e.marketplaceDefinitionId)||(e==null?void 0:e.id)||"").trim();return t.startsWith("marketplace:")?t:""}function _7(e,t){const n=String((e==null?void 0:e.baseDefinitionId)||"").trim();if(!n)return t;const r=e!=null&&e.runtime&&typeof e.runtime=="object"?e.runtime:{};return!!(r.entry||r.command)&&n==="tool_nodejs"?t:n}function YN(e,t,n){return!Array.isArray(t)||!Array.isArray(n)||n.length===0?t:t.map((r,s)=>{var d,f;const i=n[s],l=n.find(c=>(c==null?void 0:c.name)&&c.name===r.name)||i;if(!l)return r;const u=r.showOnNode===!1&&l.showOnNode==null&&((d=S7[e])==null?void 0:d.has(r.name));return{...r,...r.required==null&&l.required!=null?{required:!!l.required}:{},...u?{showOnNode:!0}:{},...!r._showOnNodeExplicit&&l.showOnNode!=null?{showOnNode:!!l.showOnNode}:{},...!r._showOnNodeExplicit&&l.showOnNode==null?{showOnNode:!!r.required||String(r.type||"").trim().toLowerCase()==="node"}:{},...C7(e,r)?{showOnNode:!0}:{},...(f=N7[e])!=null&&f.has(r.name)?{showOnNode:!1}:{}}})}function LI(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 u=$w(l);return{type:String(u.type||"node"),name:String(u.name??""),default:String(u.default??""),required:!!u.required,showOnNode:u.showOnNode!=null?u.showOnNode!==!1:!!u.required||String(u.type||"").trim().toLowerCase()==="node"}});return{inputs:r(t),outputs:r(n)}}function ff(e,t,n,r,s){var B,P,L,_,G,Z,U,se,ue,de,me,ae,Ne,Pe,be,Ie,_e,nt,st,Je,Ct;const i=((B=e.data)==null?void 0:B.definitionId)||String(e.id).replace(/-\d+$/,""),a=n.find(Be=>Be.id===i),l=t[e.id];let u=[],d=[],f=((P=e.data)==null?void 0:P.label)??e.id,c,p,h,g,v;const k=!!l;l&&(Array.isArray(l.input)&&(u=l.input.map($w)),Array.isArray(l.output)&&(d=l.output.map($w)),l.label&&(f=String(l.label)),l.role&&typeof l.role=="string"&&(c=l.role),l.model!=null&&(p=String(l.model).trim()),l.body!=null&&(h=String(l.body)),Array.isArray(l.images)&&(g=l.images),l.script!=null&&(v=String(l.script)));const y=c??(typeof((L=e.data)==null?void 0:L.role)=="string"?e.data.role:"普通"),b=p??((_=e.data)==null?void 0:_.model)??void 0,w=(a==null?void 0:a.description)!=null?String(a.description).trim():"",N=w!==""?w:void 0,C=h??((G=e.data)==null?void 0:G.body)??"",j=Array.isArray(g)?g:Array.isArray((Z=e.data)==null?void 0:Z.images)?e.data.images:[],R=v!==void 0?v:((U=e.data)==null?void 0:U.script)!=null?String(e.data.script):"",D=String(e.id),M=(se=r==null?void 0:r[s])==null?void 0:se[D],z=(ue=M==null?void 0:M.label)==null?void 0:ue.label,$=M==null?void 0:M.body,A=M==null?void 0:M.description;k||(u.length===0&&((de=a==null?void 0:a.inputs)!=null&&de.length)&&(u=a.inputs.map(Be=>({...Be}))),d.length===0&&((me=a==null?void 0:a.outputs)!=null&&me.length)&&(d=a.outputs.map(Be=>({...Be}))));const F=_7(a,(a==null?void 0:a.id)??i),T=(l==null?void 0:l.marketplaceRef)||((ae=e.data)==null?void 0:ae.marketplaceRef)||E7(a);if(F==="agent_subAgent"&&!d.some(Be=>(Be==null?void 0:Be.name)==="result")){const Be=(Ne=a==null?void 0:a.outputs)==null?void 0:Ne.find(mt=>(mt==null?void 0:mt.name)==="result");d=[...d,Be?{...Be}:{type:"text",name:"result",default:""}]}if((F==="display_markdown"||F==="display_mermaid"||F==="display_ascii"||F==="display_chart"||F==="display_table")&&!d.some(Be=>(Be==null?void 0:Be.name)==="next")){const Be=(Pe=a==null?void 0:a.outputs)==null?void 0:Pe.find(mt=>(mt==null?void 0:mt.name)==="next");d=[...d,Be?{...Be}:{type:"node",name:"next",default:""}]}if(F==="workspace_run"){if(!u.some(Be=>(Be==null?void 0:Be.name)==="prev")){const Be=(be=a==null?void 0:a.inputs)==null?void 0:be.find(mt=>(mt==null?void 0:mt.name)==="prev");u=[Be?{...Be}:{type:"node",name:"prev",default:""},...u]}if(!d.some(Be=>(Be==null?void 0:Be.name)==="next")){const Be=(Ie=a==null?void 0:a.outputs)==null?void 0:Ie.find(mt=>(mt==null?void 0:mt.name)==="next");d=[...d,Be?{...Be}:{type:"node",name:"next",default:""}]}}u=YN(F,u,a==null?void 0:a.inputs),d=YN(F,d,a==null?void 0:a.outputs),F.startsWith("provide_")&&d[0]&&String(d[0].default??d[0].value??"").trim()===""&&String(C).trim()!==""&&(d=d.map((Be,mt)=>mt===0?{...Be,default:C,value:C}:Be));const O=k7(F,z||f,a),I=F==="tool_nodejs"||String(R).trim()!=="";return{...e,type:"flowNode",data:{...e.data,label:z||f,displayLabel:O,definitionDisplayName:a==null?void 0:a.displayName,definitionId:F,...T?{marketplaceRef:T}:{},...l!=null&&l.marketplacePackageId||(_e=e.data)!=null&&_e.marketplacePackageId||a!=null&&a.packageId?{marketplacePackageId:(l==null?void 0:l.marketplacePackageId)||((nt=e.data)==null?void 0:nt.marketplacePackageId)||(a==null?void 0:a.packageId)}:{},...l!=null&&l.marketplaceVersion||(st=e.data)!=null&&st.marketplaceVersion||a!=null&&a.version?{marketplaceVersion:(l==null?void 0:l.marketplaceVersion)||((Je=e.data)==null?void 0:Je.marketplaceVersion)||(a==null?void 0:a.version)}:{},schemaType:((Ct=e.data)==null?void 0:Ct.schemaType)??e.type??"agent",role:y,model:b,body:$||C,images:j,script:R,inputs:u,outputs:d,description:A||N,originalLabel:f,originalBody:C,...I?{script:R}:{}}}}function OI(e,t){const n=new Map(t.map(r=>[r.id,r]));return e.filter(r=>{var f,c,p,h;const s=n.get(r.source),i=n.get(r.target),a=((c=(f=s==null?void 0:s.data)==null?void 0:f.outputs)==null?void 0:c.length)??0,l=((h=(p=i==null?void 0:i.data)==null?void 0:p.inputs)==null?void 0:h.length)??0,u=r.sourceHandle?parseInt(String(r.sourceHandle).replace("output-",""),10):0,d=r.targetHandle?parseInt(String(r.targetHandle).replace("input-",""),10):0;return s&&i&&u>=0&&u<a&&d>=0&&d<l})}function GN(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 XN(e,t){return!Array.isArray(e)||!e[t]||e[t].showOnNode===!0?e:e.map((n,r)=>r===t?{...n,showOnNode:!0}:n)}function dm(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=GN(t==null?void 0:t.sourceHandle,"output"),i=GN(t==null?void 0:t.targetHandle,"input");let a=!1;const l=(e||[]).map(u=>{var d,f,c,p;if(u.id===n){const h=XN((d=u.data)==null?void 0:d.outputs,s);if(h!==((f=u.data)==null?void 0:f.outputs))return a=!0,{...u,data:{...u.data,outputs:h}}}if(u.id===r){const h=XN((c=u.data)==null?void 0:c.inputs,i);if(h!==((p=u.data)==null?void 0:p.inputs))return a=!0,{...u,data:{...u.data,inputs:h}}}return u});return a?l:e}const JN=80,P7=220;function A7(e){if(!e||typeof e!="object")return e;const{selected:t,dragging:n,resizing:r,className:s,positionAbsolute:i,measured:a,internals:l,...u}=e;return u}function I7(e){if(!e||typeof e!="object")return e;const{selected:t,className:n,...r}=e;return r}function Mp(e,t,n){const r={nodes:Array.isArray(e)?e.map(A7):[],edges:Array.isArray(t)?t.map(I7):[],extra:n&&typeof n=="object"?n:{}},s=JSON.stringify(r);return{value:JSON.parse(s),signature:s}}function Dy(e,t){const n=[...e,t];return n.length>JN?n.slice(n.length-JN):n}function MI({nodes:e,edges:t,extra:n,enabled:r=!0,onRestore:s}){const[i,a]=m.useState(0),l=m.useRef([]),u=m.useRef([]),d=m.useRef(null),f=m.useRef(null),c=m.useRef(null),p=m.useRef(null),h=m.useRef(!1),g=m.useCallback(()=>a(C=>C+1),[]),v=m.useCallback(()=>{p.current&&(window.clearTimeout(p.current),p.current=null)},[]),k=m.useCallback(()=>{v();const C=f.current,j=c.current;return f.current=null,c.current=null,!C||!j||C.signature===j.signature?(j&&(d.current=j),!1):(l.current=Dy(l.current,C),u.current=[],d.current=j,g(),!0)},[g,v]),y=m.useCallback((C=[],j=[],R={})=>{v(),l.current=[],u.current=[],f.current=null,c.current=null,d.current=Mp(C,j,R),h.current=!1,g()},[g,v]),b=m.useCallback(C=>{h.current=!0,d.current=C,f.current=null,c.current=null,v(),s==null||s(C.value),g()},[g,v,s]),w=m.useCallback(()=>{k();const C=d.current||Mp(e,t,n),j=l.current.pop();return j?(u.current=Dy(u.current,C),b(j),!0):(g(),!1)},[g,t,n,k,e,b]),N=m.useCallback(()=>{k();const C=d.current||Mp(e,t,n),j=u.current.pop();return j?(l.current=Dy(l.current,C),b(j),!0):(g(),!1)},[g,t,n,k,e,b]);return m.useEffect(()=>()=>v(),[v]),m.useEffect(()=>{if(!r)return;const C=Mp(e,t,n);if(!d.current){d.current=C;return}if(h.current){h.current=!1,d.current=C;return}C.signature!==d.current.signature&&(f.current||(f.current=d.current),c.current=C,v(),p.current=window.setTimeout(()=>{k()},P7))},[v,t,r,n,k,e]),{canUndo:l.current.length>0||!!f.current,canRedo:u.current.length>0,resetHistory:y,undo:w,redo:N,version:i}}function Xn(e){switch(fm(e)){case"text":return"#2196f3";case"file":return"#4caf50";case"node":return"#ff9800";case"bool":return"#9c27b0";default:return"#9e9e9e"}}function fm(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 T7(e,t){const n=fm(e),r=fm(t);return!n||!r?!1:n==="any"||r==="any"?!0:n===r}const R7=new Set(["workspaceContext","skillsContext","mcpContext"]);function Dw(e){const t=fm(e==null?void 0:e.type),n=String((e==null?void 0:e.name)||(e==null?void 0:e.id)||"").trim();return t==="text"&&R7.has(n)?`${t}+${n}`:t}function $I(e){return Dw(e)}function ou(e,t){if(!e||!t||!T7(e.type,t.type))return!1;const n=Dw(e),r=Dw(t),s=n.includes("+"),i=r.includes("+");return s||i?n===r:!0}function L7(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 au(e,t,n){var l;const r=n==="source"?"outputs":"inputs",i=L7(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}function ko(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function O7(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 M7(e){const t=String(e||"").trim();return t?t.match(/^marketplace:/i)?"MARKETPLACE":t:""}function $7(e){return["true","1","yes","on"].includes(String((e==null?void 0:e.value)??(e==null?void 0:e.default)??"").trim().toLowerCase())}function sr(e){e.stopPropagation()}function D7(e){return String(e||"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function F7(e,t){const n=`\\[${D7(t)}\\]`;return String(e||"").replace(new RegExp(`[ \\t]*${n}`,"gi"),"").replace(/[ \t]+\n/g,`
|
|
124
|
+
`).replace(/\n{3,}/g,`
|
|
125
|
+
|
|
126
|
+
`).trimEnd()}function Fy(e){return String(e||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function z7(e){const t=String(e||"");let n="",r=0;cm.lastIndex=0;let s;for(;s=cm.exec(t);)n+=Fy(t.slice(r,s.index)),n+=`<span class="af-flow-node__image-token">${Fy(s[0])}</span>`,r=s.index+s[0].length;return n+=Fy(t.slice(r)),n||" "}function B7(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,u=String(t||"").split(/\r\n|\r|\n/).length,d=Math.min(Math.max(u,2),8);return Math.ceil(d*r+s+i+a+l)}function DI({data:e,selected:t,id:n,deleteNode:r,onProvideExpand:s,onProvideValueChange:i,onNodeBodyChange:a,onNodeImagesChange:l,modelLists:u,onModelChange:d}){var Tn,br;const{t:f}=Sn(),c=(e==null?void 0:e.inputs)??[],p=(e==null?void 0:e.outputs)??[],h=((e==null?void 0:e.schemaType)??"agent").toLowerCase(),g=O7(e),v=M7(g),k=(e==null?void 0:e.isRunMode)??!1,y=!!(e!=null&&e.readOnly),b=(e==null?void 0:e.isExecuting)??!1,w=(e==null?void 0:e.isDim)??!1,N=(e==null?void 0:e.nodeStatus)??null,C=(e==null?void 0:e.nodeElapsed)??null,j=(e==null?void 0:e.definitionId)||"",R=j.startsWith("provide_"),D=j==="provide_bool",M=j==="provide_str",z=j==="provide_file",$=j==="agent_subAgent",A=$&&!k,F=D?$7(p[0]):!1,T=R?String(((Tn=p[0])==null?void 0:Tn.value)??((br=p[0])==null?void 0:br.default)??(e==null?void 0:e.body)??""):"",O=String((e==null?void 0:e.body)||""),I=(e==null?void 0:e.displayLabel)||(e==null?void 0:e.label)||f("flow:node.fallbackLabel"),B=!R&&!A&&(e!=null&&e.showBodyPreview)?String((e==null?void 0:e.body)||"").trim():"",P=ds(e==null?void 0:e.images),L=m.useRef(!1),_=m.useRef(!1),G=m.useRef(null),Z=m.useRef(null),U=m.useRef(null),[se,ue]=m.useState(T),[de,me]=m.useState(O);m.useEffect(()=>{L.current||ue(T)},[n,T]),m.useEffect(()=>{_.current||me(O)},[n,O]),m.useEffect(()=>{const xe=Z.current;if(!xe)return;const Me=B7(xe,de);xe.style.minHeight=`${Me}px`,xe.style.height="",U.current&&(U.current.style.minHeight=`${Me}px`,U.current.style.height="")},[de]),m.useEffect(()=>{const xe=G.current,Me=e==null?void 0:e.onNodeContentResize;if(!A||!xe||!Me||typeof ResizeObserver>"u")return;let Qe=0;const re=()=>{window.cancelAnimationFrame(Qe),Qe=window.requestAnimationFrame(()=>Me(n))},ke=new ResizeObserver(re);return ke.observe(xe),re(),()=>{window.cancelAnimationFrame(Qe),ke.disconnect()}},[e==null?void 0:e.onNodeContentResize,A,n]);const ae=Array.isArray(u==null?void 0:u.cursor)?u.cursor:[],Ne=Array.isArray(u==null?void 0:u.opencode)?u.opencode:[],Pe=Array.isArray(u==null?void 0:u.claudeCode)?u.claudeCode:[],be=((e==null?void 0:e.model)??"").trim(),Ie=h==="agent"&&!j.startsWith("tool_nodejs"),_e=new Set(ae.map(ko)),nt=new Set(Ne.map(ko)),st=new Set(Pe.map(ko)),Je=be?be.startsWith("cursor:")||be.startsWith("opencode:")||be.startsWith("claude-code:")?be:st.has(be)?`claude-code:${be}`:nt.has(be)?`opencode:${be}`:_e.has(be)?`cursor:${be}`:be:"",Ct=be&&!Je.startsWith("cursor:")&&!Je.startsWith("opencode:")&&!Je.startsWith("claude-code:")&&!_e.has(be)&&!nt.has(be)&&!st.has(be),Be=be.startsWith("cursor:")?be.slice(7):be.startsWith("opencode:")?be.slice(9):be.startsWith("claude-code:")?be.slice(12):be,mt=xe=>{if(y)return;const Me=xe.target.value;d&&d(n,Me)},Gt=xe=>{xe.stopPropagation(),!y&&r&&r(n)},De=xe=>{xe.stopPropagation(),s&&s()},en=xe=>{xe.stopPropagation(),!y&&(i==null||i(n,xe.target.value==="true"?"true":"false"))},rn=xe=>{if(xe.stopPropagation(),y)return;const Me=xe.target.value;ue(Me),L.current||i==null||i(n,Me)},pn=xe=>{xe.stopPropagation(),L.current=!0},Hn=xe=>{if(xe.stopPropagation(),y)return;L.current=!1;const Me=xe.currentTarget.value;ue(Me),i==null||i(n,Me)},le=()=>{y||i==null||i(n,se)},ve=xe=>{if(xe.stopPropagation(),y)return;const Me=window.prompt("文件路径",se);Me!=null&&(ue(Me),i==null||i(n,Me))},qe=xe=>{if(me(xe),a==null||a(n,xe),l){const Me=w7(P,xe);(Me.length!==P.length||Me.some((Qe,re)=>{var ke;return Qe.id!==((ke=P[re])==null?void 0:ke.id)}))&&l(n,Me)}},ge=xe=>{if(xe.stopPropagation(),y)return;const Me=xe.target.value;_.current?me(Me):qe(Me)},lt=xe=>{xe.stopPropagation(),!y&&(_.current=!0)},Bt=xe=>{if(xe.stopPropagation(),y)return;_.current=!1;const Me=xe.currentTarget.value;qe(Me)},hn=()=>{y||qe(de)},In=async xe=>{if(y)return;const Me=await RI({files:xe,body:de,images:P});Me&&(me(Me.body),a==null||a(n,Me.body),l==null||l(n,Me.images))},mn=(xe,Me)=>{if(xe.stopPropagation(),y)return;const Qe=P.filter(ke=>ke.id!==Me.id),re=F7(de,Me.label);me(re),a==null||a(n,re),l==null||l(n,Qe)},cr=xe=>{if(y)return;const Me=TI(xe);Me.length!==0&&(xe.preventDefault(),xe.stopPropagation(),In(Me).catch(()=>{}))},Xt=xe=>{if(y)return;const Me=um(xe);Me.length!==0&&(xe.preventDefault(),xe.stopPropagation(),In(Me).catch(()=>{}))},Wn=()=>{const xe=Z.current,Me=U.current;!xe||!Me||(Me.scrollTop=xe.scrollTop,Me.scrollLeft=xe.scrollLeft)};return o.jsxs("div",{className:"af-flow-node"+(t?" af-flow-node--selected":"")+(b?" af-flow-node--executing":"")+(N==="success"?" af-flow-node--done":"")+(N==="failed"?" af-flow-node--failed":"")+(N==="running"&&!b?" af-flow-node--running-disk":"")+(w?" af-flow-node--dim":"")+(A?" af-flow-node--inline-body-editor":"")+" 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__type",title:g,children:v}),!k&&Ie&&o.jsxs("div",{className:"af-flow-node__model-wrap nodrag",onPointerDown:sr,onMouseDown:sr,onClick:sr,children:[o.jsxs("select",{className:"af-flow-node__model nodrag",value:Je,onChange:mt,onPointerDown:sr,onMouseDown:sr,onClick:sr,"aria-label":f("flow:node.model"),title:Be||f("flow:node.defaultModel"),disabled:y,children:[o.jsx("option",{value:"",children:f("flow:node.defaultModel")}),Ct&&o.jsx("option",{value:be,children:be}),ae.length>0&&o.jsx("optgroup",{label:"Cursor",children:ae.map(xe=>o.jsx("option",{value:`cursor:${ko(xe)}`,children:ko(xe)},`c-${xe}`))}),Ne.length>0&&o.jsx("optgroup",{label:"OpenCode",children:Ne.map(xe=>o.jsx("option",{value:`opencode:${ko(xe)}`,children:ko(xe)},`o-${xe}`))}),Pe.length>0&&o.jsx("optgroup",{label:"Claude Code",children:Pe.map(xe=>o.jsx("option",{value:`claude-code:${ko(xe)}`,children:ko(xe)},`cc-${xe}`))})]}),o.jsx("span",{className:"af-flow-node__model-arrow material-symbols-outlined",children:"expand_more"})]}),b&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--executing",children:"EXECUTING"}),N==="running"&&!b&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--running-disk",title:f("flow:node.diskRunning"),children:"RUNNING"}),N==="success"&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--done",children:C!=null&&String(C).trim()!==""?C:"--"}),N==="failed"&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--failed",children:"FAILED"}),!k&&R&&!D&&!M&&!z&&o.jsx("button",{type:"button",className:"af-flow-node__expand",onClick:De,"aria-label":f("flow:node.expandProvide"),title:f("flow:node.expandProvide"),children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})}),!k&&o.jsx("button",{type:"button",className:"af-flow-node__delete",disabled:y,onClick:Gt,"aria-label":f("flow:node.deleteNode"),title:f("flow:node.deleteNode"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-flow-node__body",children:[o.jsx("div",{className:"af-flow-node__ports af-flow-node__ports--in",children:c.map((xe,Me)=>{if(xe.showOnNode===!1)return null;const Qe=f("flow:node.inputTooltip",{name:xe.name||`#${Me}`,type:xe.type})+(xe.default!=null&&xe.default!==""?f("flow:node.defaultSuffix",{value:xe.default}):""),re=xe.name||`#${Me+1}`;return o.jsxs("div",{className:"af-flow-node__port-row",title:Qe,children:[o.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--in",children:[re,xe.required?o.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),o.jsx(xs,{type:"target",position:Ke.Left,id:`input-${Me}`,className:"af-flow-node__handle",style:{background:Xn(xe.type)},title:Qe})]},`in-${Me}`)})}),o.jsxs("div",{className:"af-flow-node__title-wrap",children:[o.jsx("span",{className:"af-flow-node__title",children:I}),n?o.jsx("span",{className:"af-flow-node__subtitle",title:n,children:n}):null,D?o.jsxs("select",{className:"af-flow-node__bool-select nodrag"+(F?" af-flow-node__bool-select--true":""),value:F?"true":"false",onChange:en,onPointerDown:sr,onMouseDown:sr,onClick:sr,"aria-label":"Boolean value",title:F?"true":"false",disabled:y,children:[o.jsx("option",{value:"false",children:"false"}),o.jsx("option",{value:"true",children:"true"})]}):M?o.jsx("textarea",{className:"af-flow-node__inline-text nodrag",value:se,onChange:rn,onCompositionStart:pn,onCompositionEnd:Hn,onBlur:le,onPointerDown:sr,onMouseDown:sr,onClick:sr,placeholder:"输入文本",rows:2,readOnly:y}):z?o.jsxs("div",{className:"af-flow-node__file-value nodrag",onPointerDown:sr,onMouseDown:sr,onClick:sr,children:[o.jsx("input",{className:"af-flow-node__file-input nodrag",value:se,onChange:rn,onCompositionStart:pn,onCompositionEnd:Hn,onBlur:le,placeholder:"选择或输入文件路径",title:se||"选择或输入文件路径",readOnly:y}),o.jsx("button",{type:"button",className:"af-flow-node__file-picker nodrag",disabled:y,onClick:ve,"aria-label":"选择文件",title:"选择文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"folder_open"})})]}):$&&!k?o.jsxs("div",{ref:G,className:"af-flow-node__prompt-stack nodrag",onPointerDown:sr,onMouseDown:sr,onClick:sr,children:[o.jsx("pre",{ref:U,className:"af-flow-node__prompt-backdrop","aria-hidden":"true",dangerouslySetInnerHTML:{__html:z7(de)+`
|
|
127
|
+
`}}),o.jsx("textarea",{ref:Z,className:"af-flow-node__prompt-editor nodrag",value:de,onChange:ge,onCompositionStart:lt,onCompositionEnd:Bt,onBlur:hn,onPaste:cr,onDrop:Xt,onScroll:Wn,onDragOver:xe=>{um(xe).length>0&&xe.preventDefault()},placeholder:"输入 prompt",rows:2,readOnly:y})]}):null,$&&P.length>0?o.jsx("div",{className:"af-flow-node__image-chips",children:P.map((xe,Me)=>o.jsxs("span",{className:"af-flow-node__image-chip",title:xe.name,children:[o.jsx("img",{src:xe.dataUrl,alt:""}),o.jsxs("span",{children:["[",xe.label||`image ${Me+1}`,"]"]}),o.jsx("button",{type:"button",className:"af-flow-node__image-remove nodrag",disabled:y,onClick:Qe=>mn(Qe,xe),onPointerDown:sr,onMouseDown:sr,"aria-label":`删除 ${xe.label||`image ${Me+1}`}`,title:"删除图片",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},xe.id||Me))}):null,B?o.jsx("span",{className:"af-flow-node__prompt-preview",title:B,children:B}):null]}),o.jsx("div",{className:"af-flow-node__ports af-flow-node__ports--out",children:p.map((xe,Me)=>{if(xe.showOnNode===!1)return null;const Qe=f("flow:node.outputTooltip",{name:xe.name||`#${Me}`,type:xe.type})+(xe.default!=null&&xe.default!==""?f("flow:node.defaultSuffix",{value:xe.default}):""),re=xe.name||`#${Me+1}`;return o.jsxs("div",{className:"af-flow-node__port-row",title:Qe,children:[o.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--out",children:[re,xe.required?o.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),o.jsx(xs,{type:"source",position:Ke.Right,id:`output-${Me}`,className:"af-flow-node__handle",style:{background:Xn(xe.type)},title:Qe})]},`out-${Me}`)})})]})]})}const Lf="flowNode";function FI(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 pm(e){return e.key==="?"||e.key==="/"&&e.shiftKey}function H7(){return typeof navigator>"u"?!1:/Mac|iPhone|iPod|iPad/i.test(navigator.platform||navigator.userAgent||"")}function W7({open:e,onClose:t,flowId:n,flowSource:r,onArchived:s}){const{t:i}=Sn(),a=m.useId(),l=m.useRef(null),[u,d]=m.useState(""),[f,c]=m.useState(!1),[p,h]=m.useState("");if(m.useEffect(()=>{if(!e)return;d(""),h(""),c(!1);const y=requestAnimationFrame(()=>{var b;return(b=l.current)==null?void 0:b.focus()});return()=>cancelAnimationFrame(y)},[e,n]),!e)return null;const g=u.trim(),v=g===n;async function k(y){if(y.preventDefault(),!(!v||f)){c(!0),h("");try{const b=await fetch("/api/flow/archive",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:n,flowSource:r,confirmFlowId:g})}),w=await b.json().catch(()=>({}));if(!b.ok){h(typeof w.error=="string"?w.error:i("project:archiveModal.archiveFailed"));return}s()}catch(b){h(String((b==null?void 0:b.message)||b))}finally{c(!1)}}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:y=>{y.target===y.currentTarget&&t()},children:o.jsxs("div",{ref:l,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":a,tabIndex:-1,onMouseDown:y=>y.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:a,className:"af-shortcuts-panel__title",children:i("project:archiveModal.title")}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":i("project:archiveModal.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit: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:u,onChange:y=>d(y.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":g.length>0&&!v})]}),p?o.jsx("p",{className:"af-err af-new-pipeline-err",children:p}):null,o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:f,children:i("project:archiveModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!v||f,children:i(f?"project:archiveModal.archiving":"project:archiveModal.confirmArchive")})]})]})]})})}function QN({open:e,title:t,message:n,confirmLabel:r,cancelLabel:s,destructive:i=!1,secondaryLabel:a,secondaryDestructive:l=!1,onSecondary:u,onConfirm:d,onCancel:f}){const{t:c}=Sn(),p=m.useId(),h=m.useRef(null);if(m.useEffect(()=>{if(!e)return;const y=requestAnimationFrame(()=>{var w;return(w=h.current)==null?void 0:w.focus()});function b(w){w.key==="Escape"&&f(),w.key==="Enter"&&d()}return window.addEventListener("keydown",b),()=>{cancelAnimationFrame(y),window.removeEventListener("keydown",b)}},[e,f,d]),!e)return null;const g=r??c("common:common.confirm","确定"),v=s??c("common:common.cancel","取消"),k=t??c("common:common.confirmTitle","请确认");return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:y=>{y.target===y.currentTarget&&f()},children:o.jsxs("div",{ref:h,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":p,tabIndex:-1,onMouseDown:y=>y.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:p,className:"af-shortcuts-panel__title",children:k}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:f,"aria-label":v,children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-shortcuts-panel__body af-new-pipeline-form",children:[o.jsx("p",{className:"af-new-pipeline-lead",children:n}),o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:f,children:v}),a&&u?o.jsx("button",{type:"button",className:l?"af-btn-secondary af-btn-destructive":"af-btn-secondary",onClick:u,children:a}):null,o.jsx("button",{type:"button",className:i?"af-btn-primary af-btn-destructive":"af-btn-primary",onClick:d,autoFocus:!0,children:g})]})]})]})})}function V7({open:e,onClose:t,flowId:n,flowSource:r,flowArchived:s=!1,onDeleted:i}){const{t:a}=Sn(),l=m.useId(),u=m.useRef(null),[d,f]=m.useState(""),[c,p]=m.useState(!1),[h,g]=m.useState("");if(m.useEffect(()=>{if(!e)return;f(""),g(""),p(!1);const b=requestAnimationFrame(()=>{var w;return(w=u.current)==null?void 0:w.focus()});return()=>cancelAnimationFrame(b)},[e,n]),!e)return null;const v=d.trim(),k=v===n;async function y(b){if(b.preventDefault(),!k||c)return;p(!0),g("");let w=null;try{const N=new AbortController;w=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:v,flowArchived:s}),signal:N.signal}),j=await C.json().catch(()=>({}));if(!C.ok){g(typeof j.error=="string"?j.error:a("project:deleteModal.deleteFailed"));return}try{for(let R=localStorage.length-1;R>=0;R--){const D=localStorage.key(R);D&&(D.startsWith(`af:composer-sessions:${n}:${r}`)||D.startsWith(`af:composer-active-session:${n}:${r}`)||D.startsWith(`af:workspace-composer:${n}:${r}`))&&localStorage.removeItem(D)}}catch{}await i()}catch(N){if((N==null?void 0:N.name)==="AbortError"){g(a("project:deleteModal.deleteTimeout"));return}g(String((N==null?void 0:N.message)||N))}finally{w&&clearTimeout(w),p(!1)}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:b=>{b.target===b.currentTarget&&t()},children:o.jsxs("div",{ref:u,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":l,tabIndex:-1,onMouseDown:b=>b.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:y,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:d,onChange:b=>f(b.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":v.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:c,children:a("project:deleteModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary af-btn-destructive",disabled:!k||c,children:a(c?"project:deleteModal.deleting":"project:deleteModal.confirmDelete")})]})]})]})})}function U7({children:e}){return o.jsx("kbd",{className:"af-kbd",children:e})}function Yi({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(U7,{children:t})]},n))})}function zI({open:e,onClose:t}){const{t:n}=Sn(),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=H7()?"⌘":"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(Yi,{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(Yi,{keys:["?"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.jumpToNode")}),o.jsx(Yi,{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(Yi,{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(Yi,{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(Yi,{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(Yi,{keys:["Space"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.selectAll")}),o.jsx(Yi,{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(Yi,{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(Yi,{keys:[i,"Shift","Z"]})]})]})]})]})]})})}function K7(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 q7({open:e,onClose:t,onJump:n,nodes:r}){const{t:s}=Sn(),[i,a]=m.useState(""),[l,u]=m.useState(0),d=m.useRef(null),f=m.useRef(null);m.useEffect(()=>{if(!e)return;a(""),u(0);const g=requestAnimationFrame(()=>{var v;return(v=d.current)==null?void 0:v.focus()});return()=>cancelAnimationFrame(g)},[e]);const c=m.useMemo(()=>{const g=(r||[]).map(y=>{var b,w,N;return{id:y.id,label:((b=y.data)==null?void 0:b.label)||"",definitionId:((w=y.data)==null?void 0:w.definitionId)||"",schemaType:((N=y.data)==null?void 0:N.schemaType)||""}}),v=i.trim(),k=g.map(y=>({e:y,s:K7(y,v)})).filter(y=>y.s>0);return k.sort((y,b)=>b.s-y.s||y.e.id.localeCompare(b.e.id)),k.slice(0,50).map(y=>y.e)},[r,i]);if(m.useEffect(()=>{l>=c.length&&u(0)},[c.length,l]),m.useEffect(()=>{var v;const g=(v=f.current)==null?void 0:v.querySelector(`[data-idx="${l}"]`);g&&g.scrollIntoView({block:"nearest"})},[l]),!e)return null;const p=g=>{const v=c[g];v&&(n(v.id),t())},h=g=>{if(g.key==="Escape"){g.preventDefault(),t();return}if(g.key==="ArrowDown"){g.preventDefault(),u(v=>Math.min(c.length-1,v+1));return}if(g.key==="ArrowUp"){g.preventDefault(),u(v=>Math.max(0,v-1));return}g.key==="Enter"&&(g.preventDefault(),p(l))};return o.jsx("div",{className:"af-jump-overlay",role:"presentation",onMouseDown:g=>{g.target===g.currentTarget&&t()},children:o.jsxs("div",{className:"af-jump-panel",role:"dialog","aria-modal":"true","aria-label":s("flow:jumpPalette.title"),onMouseDown:g=>g.stopPropagation(),children:[o.jsxs("div",{className:"af-jump-panel__input-wrap",children:[o.jsx("span",{className:"af-jump-panel__icon material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{ref:d,type:"text",className:"af-jump-panel__input",placeholder:s("flow:jumpPalette.placeholder"),value:i,onChange:g=>{a(g.target.value),u(0)},onKeyDown:h,spellCheck:!1,autoComplete:"off"}),o.jsx("span",{className:"af-jump-panel__count",children:c.length})]}),c.length===0?o.jsx("div",{className:"af-jump-panel__empty",children:s("flow:jumpPalette.empty")}):o.jsx("ul",{ref:f,className:"af-jump-panel__list",role:"listbox",children:c.map((g,v)=>o.jsxs("li",{"data-idx":v,role:"option","aria-selected":v===l,className:"af-jump-panel__item"+(v===l?" af-jump-panel__item--active":""),onMouseEnter:()=>u(v),onMouseDown:k=>{k.preventDefault(),p(v)},children:[o.jsx("span",{className:"af-jump-panel__id",children:g.id}),g.label&&g.label!==g.id&&o.jsx("span",{className:"af-jump-panel__label",children:g.label}),g.definitionId&&o.jsx("span",{className:"af-jump-panel__tag",children:g.definitionId})]},g.id))}),o.jsxs("div",{className:"af-jump-panel__hint",children:[o.jsxs("span",{children:[o.jsx("kbd",{className:"af-kbd",children:"↑"}),o.jsx("kbd",{className:"af-kbd",children:"↓"})," ",s("flow:jumpPalette.hintNavigate")]}),o.jsxs("span",{children:[o.jsx("kbd",{className:"af-kbd",children:"Enter"})," ",s("flow:jumpPalette.hintJump")]}),o.jsxs("span",{children:[o.jsx("kbd",{className:"af-kbd",children:"Esc"})," ",s("flow:jumpPalette.hintClose")]})]})]})})}function Y7({open:e,onClose:t,flowId:n,flowSource:r,flowArchived:s=!1,filePath:i,fileName:a,onSaved:l,onAiEdit:u}){const{t:d}=Sn(),f=m.useId(),c=m.useRef(null),p=m.useRef(null),[h,g]=m.useState(""),[v,k]=m.useState(""),[y,b]=m.useState(!1),[w,N]=m.useState(!1),[C,j]=m.useState(!1),[R,D]=m.useState(""),[M,z]=m.useState("");if(m.useEffect(()=>{if(!e||!i)return;g(""),k(""),D(""),z(""),b(!0),N(!1),j(!1);const I=new URLSearchParams({flowId:n,flowSource:r,archived:s?"1":"0",path:i});(async()=>{try{const P=await fetch(`/api/pipeline-file-content?${I}`),L=await P.json();if(!P.ok)throw new Error(L.error||"HTTP "+P.status);g(L.content||""),k(L.content||"")}catch(P){D(P.message||String(P))}finally{b(!1)}})();const B=requestAnimationFrame(()=>{var P;return(P=c.current)==null?void 0:P.focus()});return()=>cancelAnimationFrame(B)},[e,i,n,r,s]),!e)return null;const $=h!==v;async function A(I){if(I.preventDefault(),!w){N(!0),D(""),z("");try{const B=new URLSearchParams({flowId:n,flowSource:r,archived:s?"1":"0",path:i}),P=await fetch(`/api/pipeline-file-save?${B}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:h})}),L=await P.json();if(!P.ok)throw new Error(L.error||"HTTP "+P.status);k(h),z(d("flow:fileEdit.saved")),l&&l()}catch(B){D(B.message||String(B))}finally{N(!1)}}}async function F(){if(!(!u||C||!h)){j(!0),D("");try{const I=await u(h);typeof I=="string"&&I&&g(I)}catch(I){D(I.message||String(I))}finally{j(!1)}}}function T(){g(v),D(""),z("")}const O=h.length>1e5;return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:I=>{I.target===I.currentTarget&&t()},children:o.jsxs("div",{ref:c,className:"af-shortcuts-panel af-file-edit-panel",role:"dialog","aria-modal":"true","aria-labelledby":f,tabIndex:-1,onMouseDown:I=>I.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:f,className:"af-shortcuts-panel__title",children:a||i}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":d("flow:fileEdit.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx("div",{className:"af-file-edit-body",children:y?o.jsx("div",{className:"af-file-edit-loading",children:d("flow:fileEdit.loading")}):R&&!h?o.jsx("div",{className:"af-file-edit-error",children:R}):o.jsxs(o.Fragment,{children:[O&&o.jsx("div",{className:"af-file-edit-warning",children:d("flow:fileEdit.largeFileWarning")}),o.jsx("textarea",{ref:p,className:"af-file-edit-textarea",value:h,onChange:I=>g(I.target.value),spellCheck:!1,placeholder:d("flow:fileEdit.placeholder")})]})}),(R||M)&&!y&&o.jsx("div",{className:`af-file-edit-status${M?" af-file-edit-status--success":""}`,children:M||R}),o.jsxs("div",{className:"af-file-edit-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:T,disabled:!$||w||C,children:d("flow:fileEdit.reset")}),u&&o.jsx("button",{type:"button",className:"af-btn-secondary af-btn-ai",onClick:F,disabled:C||w||!h,children:d(C?"flow:fileEdit.aiRunning":"flow:fileEdit.aiEdit")}),o.jsx("button",{type:"button",className:"af-btn-primary",onClick:A,disabled:!$||w||C,children:d(w?"flow:fileEdit.saving":"flow:fileEdit.save")})]})]})})}const BI=new Set(["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"]),G7=["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"];function X7(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 J7(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 ZN(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 HI(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(BI.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 WI(e){return{inputNames:ZN(e==null?void 0:e.inputs),outputNames:ZN(e==null?void 0:e.outputs)}}function Q7(e,t,n){const r=WI(t),s=J7(e),i=[];for(const a of s)if(!HI(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 Z7(e,t){const n=WI(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],u=HI(a[1],n);s.push({kind:u?"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 eU(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function tU(e){return e.map(t=>{const n=eU(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 nU(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 G7)BI.has(r)&&n.push({section:"runtime",insert:r,label:r,subtitle:t("flow:placeholder.runtimeConst")});return n}function rU(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 sU(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(),u=parseFloat(r.lineHeight),d=Number.isFinite(u)&&u>0?u:l.height||16;return document.body.removeChild(s),{top:l.top,left:l.left,bottom:l.bottom,height:d}}function $p({value:e,onChange:t,disabled:n,placeholder:r,rows:s=8,textareaClassName:i,ioSlots:a,variant:l="drawer",images:u,onImagesChange:d}){const{t:f}=Sn(),c=m.useId(),p=m.useRef(null),h=m.useRef(null),[g,v]=m.useState(0),[k,y]=m.useState(0),[b,w]=m.useState(null),N=m.useMemo(()=>ds(u),[u]),C=m.useMemo(()=>Q7(e,a,f),[e,a,f]),j=C.length>0,R=m.useMemo(()=>Z7(e,a),[e,a]),D=m.useMemo(()=>tU(R),[R]),M=m.useMemo(()=>n?null:X7(e,g),[e,g,n]),z=m.useMemo(()=>{if(!M)return[];const I=nU(a,f);return rU(I,M.query)},[M,a,f]);m.useEffect(()=>{y(I=>{const B=Math.max(0,z.length-1);return Math.min(Math.max(0,I),B)})},[z.length]);const $=m.useCallback(()=>{const I=p.current;if(!I||!M||z.length===0){w(null);return}const B=sU(I,g);if(!B){w(null);return}const P=4,L=44,_=13.5*16,G=Math.min(z.length*L+8,_);let Z=B.bottom+P;Z+G>window.innerHeight-8&&(Z=Math.max(8,B.top-G-P));const U=288;let se=B.left;se=Math.max(8,Math.min(se,window.innerWidth-U-8)),w({top:Z,left:se})},[M,z.length,g]);m.useLayoutEffect(()=>{if(!M||z.length===0){w(null);return}const I=requestAnimationFrame(()=>$());return()=>cancelAnimationFrame(I)},[M,z.length,g,e,$]),m.useEffect(()=>{if(!M||z.length===0)return;const I=()=>$();return window.addEventListener("scroll",I,!0),window.addEventListener("resize",I),()=>{window.removeEventListener("scroll",I,!0),window.removeEventListener("resize",I)}},[M,z.length,$]);const A=m.useCallback(I=>{if(!M)return;const{atIndex:B}=M,P=e.slice(0,B)+"${"+I+"}"+e.slice(g);t(P);const L=B+I.length+3;queueMicrotask(()=>{const _=p.current;_&&(_.focus(),_.setSelectionRange(L,L)),v(L)})},[M,e,g,t]),F=m.useCallback(()=>{const I=p.current,B=h.current;!I||!B||(B.scrollTop=I.scrollTop,B.scrollLeft=I.scrollLeft,M&&z.length>0&&queueMicrotask(()=>$()))},[M,z.length,$]),T=m.useCallback(I=>{if(!n&&M&&z.length>0&&(I.key==="ArrowDown"||I.key==="ArrowUp"||I.key==="Enter")){if(I.key==="ArrowDown")I.preventDefault(),y(B=>(B+1)%z.length);else if(I.key==="ArrowUp")I.preventDefault(),y(B=>(B-1+z.length)%z.length);else if(I.key==="Enter"&&!I.shiftKey){I.preventDefault();const B=z[k];B&&A(B.insert)}}},[n,M,z,k,A]),O=m.useCallback(async I=>{if(n||typeof d!="function")return!1;const B=await RI({files:I,body:e,images:N});return B?(t(B.body),d(B.images),queueMicrotask(()=>{const P=p.current;if(!P)return;P.focus();const L=B.body.length;P.setSelectionRange(L,L),v(L)}),!0):!1},[n,N,t,d,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((I,B)=>o.jsxs("span",{className:"af-body-image-chip",title:I.name,children:[o.jsx("img",{src:I.dataUrl,alt:""}),o.jsxs("span",{children:["[",I.label||`image ${B+1}`,"]"]})]},I.id||B))}):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:D+`
|
|
128
|
+
`}}),o.jsx("textarea",{ref:p,className:"af-body-prompt-textarea "+i,rows:s,value:e,disabled:n,placeholder:r,spellCheck:!1,"aria-invalid":j,"aria-describedby":j?c:void 0,onChange:I=>{t(I.target.value),v(I.target.selectionStart??I.target.value.length)},onSelect:I=>{const B=I.target;B instanceof HTMLTextAreaElement&&v(B.selectionStart??0)},onClick:I=>{const B=I.target;B instanceof HTMLTextAreaElement&&v(B.selectionStart??0)},onKeyUp:I=>{const B=I.target;B instanceof HTMLTextAreaElement&&v(B.selectionStart??B.value.length)},onKeyDown:T,onPaste:I=>{const B=TI(I);B.length!==0&&(I.preventDefault(),O(B).catch(()=>{}))},onDragOver:I=>{um(I).length>0&&I.preventDefault()},onDrop:I=>{const B=um(I);B.length!==0&&(I.preventDefault(),O(B).catch(()=>{}))},onScroll:F})]}),M&&z.length>0&&b?os.createPortal(o.jsx("ul",{className:"af-body-ph-menu af-body-ph-menu--pop af-composer-mention-menu",role:"listbox","aria-label":f("flow:nodeProps.placeholderSlots"),style:{position:"fixed",top:b.top,left:b.left,right:"auto",bottom:"auto",margin:0,zIndex:2e4},children:z.map((I,B)=>o.jsx("li",{role:"option","aria-selected":B===k,children:o.jsxs("button",{type:"button",className:"af-composer-mention-item"+(B===k?" af-composer-mention-item--active":""),onMouseDown:P=>P.preventDefault(),onMouseEnter:()=>y(B),onClick:()=>A(I.insert),children:[o.jsx("span",{className:"af-composer-mention-id",children:`\${${I.insert}}`}),I.subtitle?o.jsx("span",{className:"af-composer-mention-sub",children:I.subtitle}):null]})},`${I.section}-${I.insert}`))}),document.body):null,j?o.jsx("p",{id:c,className:"af-body-ph-issues",role:"status",children:C.map(I=>I.message).join(" · ")}):null]})}const VI=/^[a-zA-Z_][a-zA-Z0-9_-]*$/;function Dp(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function ej({kind:e,label:t,slots:n,onSlotsChange:r,disabled:s,requiredReadonly:i=!0}){const{t:a}=Sn(),l=()=>r([...n,{type:"text",name:"",default:"",required:!1,showOnNode:!1}]),u=c=>r(n.filter((p,h)=>h!==c)),d=(c,p,h)=>{const g=n.map((v,k)=>{if(k!==c)return v;const y={...v,[p]:h};return p==="required"&&h===!0&&(y.showOnNode=!0),y});r(g)},f=e==="input"?"input":"output";return o.jsxs("div",{className:"af-node-props-field af-node-props-field--io",children:[o.jsxs("div",{className:"af-node-props-io-head",children:[o.jsx("span",{className:"af-node-props-label",children:t}),o.jsx("button",{type:"button",className:"af-btn-ghost af-node-props-io-add",onClick:l,disabled:s,"aria-label":a("flow:nodeProps.addPinAriaLabel",{label:t}),children:a("flow:nodeProps.addPin")})]}),o.jsx("p",{className:"af-node-props-io-hint",children:a("flow:nodeProps.handleHint",{prefix:f})}),n.length===0?o.jsx("p",{className:"af-node-props-io-empty",children:a(e==="input"?"flow:nodeProps.noInputPins":"flow:nodeProps.noOutputPins")}):null,n.length>0?o.jsxs("div",{className:"af-node-props-io-table",role:"group","aria-label":t,children:[o.jsxs("div",{className:"af-node-props-io-table-head","aria-hidden":!0,children:[o.jsx("span",{children:a("flow:nodeProps.handle")}),o.jsx("span",{children:a("flow:nodeProps.type")}),o.jsx("span",{children:a("flow:nodeProps.name")}),o.jsx("span",{children:a("flow:nodeProps.defaultValue")}),o.jsx("span",{children:a("flow:nodeProps.required")}),o.jsx("span",{children:a("flow:nodeProps.showOnNode")}),o.jsx("span",{})]}),n.map((c,p)=>o.jsxs("div",{className:"af-node-props-io-row",children:[o.jsxs("span",{className:"af-node-props-io-handle",title:`${f}-${p}`,children:[f,"-",p]}),o.jsx("select",{className:"af-node-props-input af-node-props-io-cell",value:c.type,onChange:h=>d(p,"type",h.target.value),disabled:s,"aria-label":a("flow:nodeProps.pinTypeAriaLabel",{label:t,index:p}),children:["node","text","file","bool"].map(h=>o.jsx("option",{value:h,children:h},h))}),o.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:c.name,onChange:h=>d(p,"name",h.target.value),disabled:s,spellCheck:!1,autoComplete:"off","aria-label":a("flow:nodeProps.pinNameAriaLabel",{label:t,index:p})}),o.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:c.default,onChange:h=>d(p,"default",h.target.value),disabled:s,spellCheck:!1,autoComplete:"off","aria-label":a("flow:nodeProps.pinDefaultAriaLabel",{label:t,index:p})}),o.jsx("label",{className:"af-node-props-io-flag",title:a("flow:nodeProps.requiredHint"),children:o.jsx("input",{type:"checkbox",checked:!!c.required,onChange:h=>{i||d(p,"required",h.target.checked)},disabled:s||i,"aria-label":a("flow:nodeProps.pinRequiredAriaLabel",{label:t,index:p})})}),o.jsx("label",{className:"af-node-props-io-flag",title:a("flow:nodeProps.showOnNodeHint"),children:o.jsx("input",{type:"checkbox",checked:c.showOnNode!==!1,onChange:h=>d(p,"showOnNode",h.target.checked),disabled:s,"aria-label":a("flow:nodeProps.pinShowOnNodeAriaLabel",{label:t,index:p})})}),o.jsx("button",{type:"button",className:"af-icon-btn af-node-props-io-remove",onClick:()=>u(p),disabled:s,"aria-label":a("flow:nodeProps.deletePinAriaLabel",{label:t,index:p}),title:a("flow:nodeProps.deletePin"),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete"})})]},`${f}-${p}`))]}):null]})}function UI({draft:e,setDraft:t,definitionId:n,systemPromptReadonly:r,modelLists:s,disabled:i,onIdBlur:a,onClose:l,onPublishToMarketplace:u,allowEditRequiredPins:d=!1,error:f,ioSlots:c}){const{t:p}=Sn(),[h,g]=m.useState(!1),[v,k]=m.useState(!1),[y,b]=m.useState({status:"idle",message:""}),w=m.useCallback(A=>{t(F=>F&&{...F,...A})},[t]),{cursorList:N,opencodeList:C,claudeCodeList:j,currentNotInLists:R}=m.useMemo(()=>{const A=Array.isArray(s==null?void 0:s.cursor)?s.cursor:[],F=Array.isArray(s==null?void 0:s.opencode)?s.opencode:[],T=Array.isArray(s==null?void 0:s.claudeCode)?s.claudeCode:[],O=new Set([...A,...F,...T].map(Dp)),I=((e==null?void 0:e.model)??"").trim(),B=I.startsWith("cursor:")?I.slice(7):I.startsWith("opencode:")?I.slice(9):I.startsWith("claude-code:")?I.slice(12):I,P=I&&!O.has(B)?I:"";return{cursorList:A,opencodeList:F,claudeCodeList:T,currentNotInLists:P}},[s,e==null?void 0:e.model]);if(!e)return null;const D=String(e.script??""),M=n==="tool_nodejs"||D.trim()!=="",z=typeof u=="function"&&!i&&(e==null?void 0:e.newId),$=async()=>{if(z){b({status:"running",message:p("flow:nodeProps.publishRunning")});try{const A=await u(e,n);b({status:"success",message:A!=null&&A.definitionId?p("flow:nodeProps.publishSuccessWithId",{id:A.definitionId}):p("flow:nodeProps.publishSuccess")})}catch(A){b({status:"error",message:String((A==null?void 0:A.message)||A)})}}};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-pipeline-drawer-head af-node-props-head",children:[o.jsx("h2",{className:"af-pipeline-drawer-title",children:p("flow:nodeProps.title")}),o.jsxs("div",{className:"af-node-props-head-actions",children:[o.jsxs("button",{type:"button",className:"af-btn-ghost af-node-props-market-btn",onClick:$,disabled:!z||y.status==="running",title:p("flow:nodeProps.publishToMarketplaceHint"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"inventory_2"}),y.status==="running"?p("flow:nodeProps.publishing"):p("flow:nodeProps.publishToMarketplace")]}),o.jsx("button",{type:"button",className:"af-btn-ghost af-node-props-close-secondary",onClick:l,children:p("common:common.close")})]})]}),o.jsxs("div",{className:"af-pipeline-drawer-body af-node-props-body",children:[f?o.jsx("p",{className:"af-err af-node-props-err",children:f}):null,y.message?o.jsx("p",{className:`af-node-props-market-status af-node-props-market-status--${y.status}`,children:y.message}):null,o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsx("span",{className:"af-node-props-label",children:p("flow:node.nodeType")}),o.jsx("div",{className:"af-pipeline-drawer-readonly af-node-props-readonly-mono",children:n})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsxs("span",{className:"af-node-props-label",children:[p("flow:nodeProps.instanceId"),o.jsx("span",{className:"af-node-props-hint",children:p("flow:node.displayNameHint")})]}),o.jsx("input",{type:"text",className:"af-node-props-input",value:e.newId,onChange:A=>w({newId:A.target.value}),onBlur:a,disabled:i,spellCheck:!1,autoComplete:"off","aria-label":p("flow:nodeProps.instanceId")})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsxs("span",{className:"af-node-props-label",children:[p("flow:node.displayName"),"(LABEL)"]}),o.jsx("input",{type:"text",className:"af-node-props-input",value:e.label,onChange:A=>w({label:A.target.value}),disabled:i,spellCheck:!1})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsxs("span",{className:"af-node-props-label",children:[p("flow:node.role"),"(ROLE)"]}),o.jsx("select",{className:"af-node-props-select",value:La.includes(e.role)?e.role:p("flow:roles.normal"),onChange:A=>w({role:A.target.value}),disabled:i,children:La.map(A=>o.jsx("option",{value:A,children:A},A))})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsxs("span",{className:"af-node-props-label",children:[p("flow:node.model"),"(MODEL)"]}),o.jsx("span",{className:"af-node-props-sublabel",children:p("flow:node.modelHint")}),o.jsxs("select",{className:"af-node-props-select",value:(()=>{const A=(e.model||"").trim();return A?R||A:""})(),onChange:A=>w({model:A.target.value}),disabled:i,"aria-label":p("flow:nodeProps.modelAriaLabel"),children:[o.jsx("option",{value:"",children:p("flow:node.defaultModel")}),R?o.jsxs("option",{value:R,children:[R,p("flow:nodeProps.yamlValueNotInList")]}):null,N.length>0?o.jsx("optgroup",{label:"Cursor",children:N.map(A=>o.jsx("option",{value:Dp(A),children:A},`c-${A}`))}):null,C.length>0?o.jsx("optgroup",{label:"OpenCode",children:C.map(A=>o.jsx("option",{value:Dp(A),children:A},`o-${A}`))}):null,j.length>0?o.jsx("optgroup",{label:"Claude Code",children:j.map(A=>o.jsx("option",{value:`claude-code:${Dp(A)}`,children:A},`cc-${A}`))}):null]})]}),o.jsx(ej,{kind:"input",label:p("flow:nodeProps.inputPins"),slots:Array.isArray(e.inputs)?e.inputs:[],onSlotsChange:A=>w({inputs:A}),disabled:i,requiredReadonly:!d}),o.jsx(ej,{kind:"output",label:p("flow:nodeProps.outputPins"),slots:Array.isArray(e.outputs)?e.outputs:[],onSlotsChange:A=>w({outputs:A}),disabled:i,requiredReadonly:!d}),M?o.jsxs("div",{className:"af-pipeline-drawer-field af-node-props-field af-node-props-field--prompt",children:[o.jsxs("div",{className:"af-node-props-prompt-head",children:[o.jsxs("span",{className:"af-node-props-label",children:[p("flow:node.directCommand"),"(script)",o.jsx("span",{className:"af-node-props-hint",children:p("flow:node.scriptHint")})]}),o.jsx("button",{type:"button",className:"af-icon-btn af-node-props-expand",onClick:()=>k(!0),"aria-label":p("flow:nodeProps.expandEditScript"),title:p("flow:nodeProps.expand"),disabled:i,children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),o.jsx($p,{value:D,onChange:A=>w({script:A}),disabled:i,placeholder:p("flow:nodeProps.scriptPlaceholder"),rows:6,textareaClassName:"af-pipeline-drawer-textarea af-node-props-body-textarea af-node-props-script-textarea",ioSlots:c,variant:"drawer"})]}):null,o.jsxs("div",{className:"af-pipeline-drawer-field af-node-props-field af-node-props-field--prompt",children:[o.jsxs("div",{className:"af-node-props-prompt-head",children:[o.jsx("span",{className:"af-node-props-label",children:p("flow:node.userPrompt")}),o.jsx("button",{type:"button",className:"af-icon-btn af-node-props-expand",onClick:()=>g(!0),"aria-label":p("flow:nodeProps.expandEdit"),title:p("flow:nodeProps.expand"),disabled:i,children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),o.jsx($p,{value:e.body,onChange:A=>w({body:A}),images:e.images,onImagesChange:A=>w({images:A}),disabled:i,placeholder:p("flow:nodeProps.bodyPlaceholder"),rows:8,textareaClassName:"af-pipeline-drawer-textarea af-node-props-body-textarea",ioSlots:c,variant:"drawer"})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsx("span",{className:"af-node-props-label",children:p("flow:node.systemDescription")}),o.jsx("textarea",{className:"af-pipeline-drawer-textarea af-node-props-system-readonly",rows:4,readOnly:!0,value:r||p("flow:nodeProps.noDescription"),spellCheck:!1})]})]}),v?o.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":p("flow:nodeProps.editScript"),onMouseDown:A=>{A.target===A.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:p("flow:node.directCommand")}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>k(!1),"aria-label":p("flow:nodeProps.collapse"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx($p,{value:D,onChange:A=>w({script:A}),disabled:i,placeholder:p("flow:nodeProps.scriptPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:c,variant:"expand"})]})}):null,h?o.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":p("flow:nodeProps.editUserPrompt"),onMouseDown:A=>{A.target===A.currentTarget&&g(!1)},children:o.jsxs("div",{className:"af-node-props-expand-panel",children:[o.jsxs("div",{className:"af-node-props-expand-head",children:[o.jsx("span",{className:"af-node-props-expand-title",children:p("flow:node.body")}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>g(!1),"aria-label":p("flow:nodeProps.collapse"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx($p,{value:e.body,onChange:A=>w({body:A}),images:e.images,onImagesChange:A=>w({images:A}),disabled:i,placeholder:p("flow:nodeProps.bodyPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:c,variant:"expand"})]})}):null]})}function Tv(e){var n;if(e.displayKind==="image"||e.encoding==="base64"&&((n=e.mimeType)!=null&&n.startsWith("image/")))return"image";if(e.displayKind==="json"||e.mimeType==="application/json")return"json";if(e.displayKind==="markdown"||e.mimeType==="text/markdown")return"markdown";if(e.displayKind==="text")return"text";const t=(e.content||"").trim();if(t&&(t.startsWith("{")||t.startsWith("[")))try{return JSON.parse(t),"json"}catch{}return"text"}function iU(e){const t=Tv(e);if(t==="image"){const n=(e.mimeType||"image/png").split("/")[1];return n?n.toUpperCase():"IMAGE"}return t==="json"?"JSON":t==="markdown"?"MD":null}function KI(e){try{return JSON.stringify(JSON.parse(e.trim()),null,2)}catch{return e}}function tj({text:e}){const{t}=Sn(),n=e||"";return n.trim()?o.jsx("div",{className:"af-run-ctx-md",children:o.jsx(Tf,{children:n})}):o.jsx("div",{className:"af-run-ctx-hint",children:t("flow:runContext.empty")})}function nj({o:e}){var r;const{t}=Sn(),n=Tv(e);if(n==="image"||e.encoding==="base64"&&((r=e.mimeType)!=null&&r.startsWith("image/"))){const i=`data:${e.mimeType||"image/png"};base64,${e.content||""}`;return o.jsxs("div",{className:"af-run-ctx-media",children:[o.jsx("img",{className:"af-run-ctx-img",src:i,alt:e.slot||"output",loading:"lazy"}),e.truncated?o.jsx("div",{className:"af-run-ctx-hint",children:t("flow:runContext.imageTruncated")}):null]})}if(n==="json")return o.jsx("pre",{className:"af-run-ctx-pre",children:KI(e.content||"")});if(n==="markdown"){const s=e.content||"";return s.trim()?o.jsx("div",{className:"af-run-ctx-md",children:o.jsx(Tf,{children:s})}):o.jsx("div",{className:"af-run-ctx-hint",children:t("flow:runContext.empty")})}return o.jsx("pre",{className:"af-run-ctx-pre",children:e.content!=null&&e.content!==""?e.content:t("flow:runContext.empty")})}function rj(e){return iU(e)}function sj(e){var r;if(!e)return null;const t=Tv(e);if(t==="image"||e.encoding==="base64"&&((r=e.mimeType)!=null&&r.startsWith("image/")))return null;const n=e.content;return n==null||n===""?null:t==="json"?KI(String(n)):String(n)}function ij({text:e,title:t,copiedLabel:n}){const[r,s]=m.useState(!1);if(!e)return null;const i=async()=>{try{await navigator.clipboard.writeText(e),s(!0),window.setTimeout(()=>s(!1),1400)}catch{}};return o.jsx("button",{type:"button",className:"af-icon-btn af-run-ctx-copy-btn",onClick:i,title:r?n:t,"aria-label":r?n:t,children:o.jsx("span",{className:"material-symbols-outlined",children:r?"check":"content_copy"})})}const oj=2e4,qI="af:run-node-ctx-width";function hh(){return typeof window>"u"?416:Math.min(26*16,window.innerWidth-32)}function ga(e){const n=Math.max(280,Math.min(Math.floor(window.innerWidth*.92),1200));return Number.isFinite(e)?Math.min(Math.max(Math.round(e),200),n):ga(hh())}function oU(){try{const e=localStorage.getItem(qI);if(e==null)return ga(hh());const t=parseInt(e,10);return Number.isFinite(t)?ga(t):ga(hh())}catch{return ga(hh())}}async function aj(e,t,n,r){const s=new URLSearchParams({flowId:e,instanceId:t});n&&String(n).trim()&&s.set("runId",String(n).trim());const i=await fetch(`/api/node-exec-context?${s.toString()}`,{signal:r}),a=await i.text();let l;try{l=JSON.parse(a)}catch{throw new Error(a.startsWith("<!")||a.startsWith("<html")?"apiConnectError":"invalidJson")}if(!i.ok)throw new Error(l.error||"HTTP "+i.status);return l}function aU(e,t){const n=`flow:runContext.${t}`,r=e(n);return r!==n?r:t}function lU({instanceId:e,flowId:t,runId:n,nodeStatus:r,onClose:s}){const{t:i}=Sn(),[a,l]=m.useState(()=>typeof window<"u"&&window.matchMedia("(max-width: 960px)").matches),[u,d]=m.useState(oU),f=m.useRef({active:!1,pointerId:-1,startX:0,startW:416}),[c,p]=m.useState(!0),[h,g]=m.useState(""),[v,k]=m.useState([]),[y,b]=m.useState(null),[w,N]=m.useState(null),C=m.useRef(null),j=m.useRef(null),R=m.useRef(0),D=m.useRef(0);m.useLayoutEffect(()=>{const P=window.matchMedia("(max-width: 960px)"),L=()=>l(P.matches);return P.addEventListener("change",L),()=>P.removeEventListener("change",L)},[]),m.useEffect(()=>{function P(){d(L=>ga(L))}return window.addEventListener("resize",P),()=>window.removeEventListener("resize",P)},[]);const M=m.useCallback(()=>{d(P=>{const L=ga(P);try{localStorage.setItem(qI,String(L))}catch{}return L})},[]),z=m.useCallback(P=>{if(a||P.button!==0)return;P.preventDefault();const L=P.currentTarget;f.current={active:!0,pointerId:P.pointerId,startX:P.clientX,startW:u},L.setPointerCapture(P.pointerId)},[a,u]),$=m.useCallback(P=>{const L=f.current;if(!L.active||P.pointerId!==L.pointerId)return;const _=L.startX-P.clientX;d(ga(L.startW+_))},[]),A=m.useCallback(P=>{const L=f.current;if(!(!L.active||P.pointerId!==L.pointerId)){L.active=!1;try{P.currentTarget.releasePointerCapture(P.pointerId)}catch{}M()}},[M]),F=m.useCallback(()=>{const P=f.current;P.active&&(P.active=!1,M())},[M]),T=m.useCallback(P=>{const L=Array.isArray(P)?P:[];k(L),b(_=>_&&L.some(G=>G.execId===_)?_:L.length>0?L[L.length-1].execId:null)},[]),O=m.useCallback(()=>{if(!e||!t)return;const P=++R.current,L=new AbortController,_=window.setTimeout(()=>L.abort(),oj);(async()=>{try{const G=await aj(t,e,n,L.signal);if(P!==R.current)return;T(Array.isArray(G.rounds)?G.rounds:[])}catch{}finally{window.clearTimeout(_)}})()},[e,t,n,T]);m.useEffect(()=>{if(!e||!t){p(!1),g(""),k([]);return}const P=++D.current;p(!0),g(""),k([]),b(null);const L=new AbortController,_=window.setTimeout(()=>L.abort(),oj);return(async()=>{try{const G=await aj(t,e,n,L.signal);if(P!==D.current)return;T(Array.isArray(G.rounds)?G.rounds:[])}catch(G){if(P!==D.current)return;const Z=(G==null?void 0:G.name)==="AbortError"?"requestTimeout":G.message||String(G);g(Z)}finally{window.clearTimeout(_),P===D.current&&p(!1)}})(),()=>{L.abort(),D.current++,R.current++}},[e,t,n,T]),m.useEffect(()=>{r&&O()},[r,O]),m.useEffect(()=>{clearInterval(j.current);const P=v.length>0?v[v.length-1]:null;return(r==="running"&&v.length===0||!!(P&&P.status==="running"))&&e&&t&&(j.current=setInterval(()=>O(),2e3)),()=>clearInterval(j.current)},[v,e,t,n,r,O]),m.useEffect(()=>{C.current&&(C.current.scrollTop=0)},[y]);const I=v.find(P=>P.execId===y),B=a?void 0:{width:`${u}px`};return o.jsxs("aside",{className:"af-run-ctx-panel",style:B,"aria-label":i("flow:runContext.title"),children:[a?null:o.jsx("div",{className:"af-run-ctx-resize",role:"separator","aria-orientation":"vertical","aria-label":i("flow:runContext.resizeHandle"),onPointerDown:z,onPointerMove:$,onPointerUp:A,onPointerCancel:A,onLostPointerCapture:F}),o.jsxs("div",{className:"af-run-ctx-panel__main",children:[o.jsxs("div",{className:"af-run-ctx-head",children:[o.jsx("h2",{className:"af-run-ctx-title",title:e,children:e}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:s,"aria-label":i("common:common.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),c&&o.jsx("div",{className:"af-run-ctx-placeholder",children:i("common:common.loading")}),h&&o.jsx("div",{className:"af-run-ctx-error",children:aU(i,h)}),!c&&!h&&v.length===0&&o.jsx("div",{className:"af-run-ctx-placeholder",children:i(r==="running"?"flow:runContext.executingNoArtifacts":"flow:runContext.noData")}),v.length>0&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-run-ctx-rounds af-run-ctx-rounds--select af-run-ctx-round--"+uU((I==null?void 0:I.status)||""),children:[o.jsx("span",{className:"af-run-ctx-round-dot","aria-hidden":!0}),o.jsx("select",{className:"af-run-ctx-round-select",value:String(y??""),onChange:P=>{const L=P.target.value;b(L==="latest"?"latest":Number(L))},children:[...v].reverse().map(P=>{const L=P.execId==="latest"?i("flow:runContext.latest"):`#${P.execId}`,_=dU(i,P.status),G=P.finishedAt?` · ${cU(P.finishedAt)}`:"";return o.jsx("option",{value:String(P.execId),children:`${L} · ${_}${G}`},P.execId)})})]}),I&&o.jsxs("div",{className:"af-run-ctx-body",ref:C,children:[I.inputs&&I.inputs.length>0&&o.jsxs("section",{className:"af-run-ctx-section",children:[o.jsxs("h3",{className:"af-run-ctx-section-title",children:[o.jsx("span",{className:"material-symbols-outlined af-run-ctx-section-icon","aria-hidden":!0,children:"input"}),"Inputs"]}),I.inputs.map((P,L)=>o.jsxs("div",{className:"af-run-ctx-output-slot",children:[o.jsx("div",{className:"af-run-ctx-slot-head",children:o.jsx("div",{className:"af-run-ctx-slot-name",children:P.slot})}),o.jsx("pre",{className:"af-run-ctx-slot-text",children:P.value})]},`${P.slot}-${L}`))]}),I.prompt!=null&&o.jsxs("section",{className:"af-run-ctx-section",children:[o.jsxs("h3",{className:"af-run-ctx-section-title",children:[o.jsx("span",{className:"material-symbols-outlined af-run-ctx-section-icon","aria-hidden":!0,children:"description"}),"Prompt",o.jsx("button",{type:"button",className:"af-icon-btn af-run-ctx-section-expand",onClick:()=>N("prompt"),title:i("flow:nodeProps.expand"),children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),o.jsx(tj,{text:I.prompt})]}),I.outputs&&I.outputs.length>0&&o.jsxs("section",{className:"af-run-ctx-section",children:[o.jsxs("h3",{className:"af-run-ctx-section-title",children:[o.jsx("span",{className:"material-symbols-outlined af-run-ctx-section-icon","aria-hidden":!0,children:"output"}),"Outputs",o.jsx("button",{type:"button",className:"af-icon-btn af-run-ctx-section-expand",onClick:()=>N("output"),title:i("flow:nodeProps.expand"),children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),I.outputs.map((P,L)=>{const _=rj(P),G=sj(P);return o.jsxs("div",{className:"af-run-ctx-output-slot",children:[o.jsxs("div",{className:"af-run-ctx-slot-head",children:[o.jsx("div",{className:"af-run-ctx-slot-name",children:P.slot}),_?o.jsx("span",{className:"af-run-ctx-format-badge",title:i("flow:runContext.detectedContentType"),children:_}):null,o.jsx(ij,{text:G,title:i("common:common.copy"),copiedLabel:i("common:common.copied")})]}),o.jsx(nj,{o:P})]},`${P.slot}-${L}`)})]}),!I.prompt&&(!I.outputs||I.outputs.length===0)&&o.jsx("div",{className:"af-run-ctx-placeholder",children:i("flow:runContext.roundNoContent")})]})]})]}),w&&I&&o.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true",onClick:P=>{P.target===P.currentTarget&&N(null)},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:w==="prompt"?"Prompt":"Outputs"}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>N(null),"aria-label":i("common:common.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-node-props-expand-body af-run-ctx-expand-body",children:[w==="prompt"&&I.prompt!=null&&o.jsx(tj,{text:I.prompt}),w==="output"&&I.outputs&&I.outputs.map((P,L)=>{const _=rj(P),G=sj(P);return o.jsxs("div",{className:"af-run-ctx-output-slot",style:{marginBottom:"1rem"},children:[o.jsxs("div",{className:"af-run-ctx-slot-head",children:[o.jsx("div",{className:"af-run-ctx-slot-name",children:P.slot}),_?o.jsx("span",{className:"af-run-ctx-format-badge",children:_}):null,o.jsx(ij,{text:G,title:i("common:common.copy"),copiedLabel:i("common:common.copied")})]}),o.jsx(nj,{o:P})]},`${P.slot}-${L}`)})]})]})})]})}function cU(e){try{const t=new Date(e);if(isNaN(t.getTime()))return e;const n=r=>String(r).padStart(2,"0");return`${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}catch{return e}}function uU(e){const t=String(e||"").toLowerCase();return t==="success"||t==="completed"||t==="done"?"success":t==="failed"||t==="error"?"failed":t==="running"||t==="executing"?"running":t==="cache_not_met"?"cache":t?"unknown":"pending"}function dU(e,t){const n=String(t||"").toLowerCase();return n?n==="success"||n==="completed"||n==="done"?e("flow:runContext.statusSuccess",{defaultValue:"成功"}):n==="failed"||n==="error"?e("flow:runContext.statusFailed",{defaultValue:"失败"}):n==="running"||n==="executing"?e("flow:runContext.statusRunning",{defaultValue:"运行中"}):n==="cache_not_met"?e("flow:runContext.statusCacheMiss",{defaultValue:"缓存失效"}):t:e("flow:runContext.statusPending",{defaultValue:"等待"})}function fU({flowId:e,flowSource:t,flowArchived:n,provideNodes:r,edges:s,nodes:i,onCliInputsChange:a,onBackToEdit:l}){const{t:u}=Sn(),[d,f]=m.useState({}),[c,p]=m.useState(null),[h,g]=m.useState({}),[v,k]=m.useState(!0),[y,b]=m.useState(!1),[w,N]=m.useState(""),[C,j]=m.useState(!1),[R,D]=m.useState(null),M=m.useRef(null),z=m.useRef(!0),$=m.useRef({});m.useMemo(()=>{var _,G,Z;const L={};for(const U of r){const se=(Z=(G=(_=U.data)==null?void 0:_.outputs)==null?void 0:G[0])==null?void 0:Z.default;se!=null&&se!==""&&(L[U.id]=String(se))}return $.current=L,L},[r]);const A=m.useMemo(()=>{var _;const L={};for(const G of i){if(!((_=G.data)!=null&&_.inputs))continue;const Z=G.data.inputs;for(let U=0;U<Z.length;U++){const se=Z[U];if(!(se!=null&&se.name))continue;const ue=s.find(me=>me.target===G.id&&me.targetHandle===`input-${U}`);if(!(ue!=null&&ue.source))continue;r.find(me=>me.id===ue.source)&&(L[ue.source]=se.name)}}return L},[i,s,r]);m.useEffect(()=>(z.current=!0,()=>{z.current=!1}),[]),m.useEffect(()=>{if(!e){k(!1);return}k(!0);const L=new URLSearchParams({flowId:e,flowSource:t||"user"});n&&L.set("archived","1"),fetch(`/api/flow/run-config?${L.toString()}`).then(_=>{if(!_.ok)throw new Error(`HTTP ${_.status}`);return _.json()}).then(_=>{var Z;if(!z.current)return;f(_.presets||{}),p(_.activePreset||null);const G=_.activePreset&&((Z=_.presets)!=null&&Z[_.activePreset])?_.presets[_.activePreset]:{};g({...$.current,...G}),k(!1)}).catch(()=>{z.current&&(g($.current),k(!1))})},[e,t,n]),m.useEffect(()=>{var _;if(!a)return;const L={};for(const[G,Z]of Object.entries(h)){const U=A[G];if(!U)continue;const se=r.find(de=>de.id===G);if(!se)continue;(((_=se.data)==null?void 0:_.definitionId)||"").startsWith("provide_file")?L[U]={type:"file",path:Z}:L[U]={type:"str",value:Z}}a(L)},[h,A,r,a]);const F=m.useCallback((L,_)=>{g(G=>({...G,[L]:_}))},[]),T=m.useCallback(L=>{L!==c&&(p(L),L&&d[L]?g({...$.current,...d[L]}):g($.current))},[c,d]),O=m.useCallback(async()=>{if(w.trim()){b(!0);try{const L={...d,[w.trim()]:h},_={flowId:e,flowSource:t,archived:n,presets:L,activePreset:w.trim()};(await fetch("/api/flow/run-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(_)})).ok&&(f(L),p(w.trim()),N(""),j(!1))}finally{b(!1)}}},[e,t,n,d,h,w]),I=m.useCallback(async()=>{if(c){b(!0);try{const L={...d};delete L[c];const _=Object.keys(L)[0]||null;(await fetch("/api/flow/run-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:e,flowSource:t,archived:n,presets:L,activePreset:_})})).ok&&(f(L),p(_),_&&L[_]?g({...$.current,...L[_]}):g($.current))}finally{b(!1)}}},[e,t,n,d,c]),B=m.useCallback(async()=>{if(c){b(!0);try{const L={...d,[c]:h};(await fetch("/api/flow/run-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:e,flowSource:t,archived:n,presets:L,activePreset:c})})).ok&&f(L)}finally{b(!1)}}},[e,t,n,d,c,h]),P=Object.keys(d);return P.length>0,v?o.jsx("aside",{className:"af-run-config-panel",children:o.jsx("div",{className:"af-run-config-loading",children:u("common.loading")})}):o.jsxs("aside",{className:"af-run-config-panel",children:[o.jsxs("div",{className:"af-run-config-preset",children:[o.jsx("label",{className:"af-run-config-preset-label",children:u("flow:runConfig.preset")}),o.jsxs("div",{className:"af-run-config-preset-row",children:[o.jsxs("select",{className:"af-run-config-preset-select",value:c||"",onChange:L=>T(L.target.value||null),disabled:y,children:[o.jsx("option",{value:"",children:u("flow:runConfig.default")}),P.map(L=>o.jsx("option",{value:L,children:L},L))]}),o.jsx("button",{type:"button",className:"af-run-config-preset-btn af-run-config-preset-btn--new",onClick:()=>j(!0),disabled:y,title:u("flow:runConfig.newPreset"),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add"})}),c&&o.jsx("button",{type:"button",className:"af-run-config-preset-btn af-run-config-preset-btn--save",onClick:B,disabled:y,title:u("flow:runConfig.savePreset"),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"save"})}),c&&o.jsx("button",{type:"button",className:"af-run-config-preset-btn af-run-config-preset-btn--delete",onClick:I,disabled:y,title:u("flow:runConfig.deletePreset"),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"delete"})})]})]}),C&&o.jsxs("div",{className:"af-run-config-save-dialog",children:[o.jsx("input",{type:"text",className:"af-run-config-save-input",placeholder:u("flow:runConfig.presetNamePlaceholder"),value:w,onChange:L=>N(L.target.value),disabled:y}),o.jsxs("div",{className:"af-run-config-save-actions",children:[o.jsx("button",{type:"button",className:"af-btn-primary",onClick:O,disabled:y||!w.trim(),children:u(y?"common.saving":"common.save")}),o.jsx("button",{type:"button",className:"af-btn-outline",onClick:()=>{j(!1),N("")},disabled:y,children:u("common.cancel")})]})]}),o.jsxs("div",{className:"af-run-config-inputs",children:[o.jsx("div",{className:"af-run-config-inputs-header",children:u("flow:runConfig.inputParams")}),r.length===0?o.jsx("div",{className:"af-run-config-empty",children:u("flow:runConfig.noProvideNodes")}):o.jsx("div",{className:"af-run-config-input-list",children:r.map(L=>{var me,ae;const _=((me=L.data)==null?void 0:me.definitionId)||"",G=_.startsWith("provide_file"),Z=_==="provide_bool",U=((ae=L.data)==null?void 0:ae.label)||L.id,se=L.id,ue=h[se]||"",de=["true","1","yes","on"].includes(String(ue).trim().toLowerCase());return o.jsxs("div",{className:"af-run-config-input-item",children:[o.jsxs("div",{className:"af-run-config-input-head",children:[o.jsx("span",{className:"af-run-config-input-icon material-symbols-outlined"+(G?" af-run-config-input-icon--file":""),"aria-hidden":!0,children:G?"description":Z?"toggle_on":"text_fields"}),o.jsx("span",{className:"af-run-config-input-label",children:U}),Z?null:o.jsx("button",{type:"button",className:"af-run-config-input-expand",onClick:()=>D({instanceId:se,label:U,content:ue}),"aria-label":u("flow:runConfig.expandInput"),title:u("flow:runConfig.expandInput"),children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),o.jsx("div",{className:"af-run-config-input-id",children:se}),Z?o.jsx("button",{type:"button",className:"af-run-config-bool-toggle"+(de?" af-run-config-bool-toggle--true":""),onClick:()=>F(se,de?"false":"true"),"aria-pressed":de,children:de?"true":"false"}):o.jsx("input",{type:"text",className:"af-run-config-input-field",value:ue,onChange:Ne=>F(se,Ne.target.value),placeholder:u(G?"flow:runConfig.filePathPlaceholder":"flow:runConfig.stringValuePlaceholder")})]},se)})})]}),R&&os.createPortal(o.jsx("div",{className:"af-provide-edit-overlay",children:o.jsxs("div",{className:"af-provide-edit-modal",role:"dialog","aria-modal":"true",children:[o.jsxs("div",{className:"af-provide-edit-modal__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"edit_document"}),o.jsx("span",{className:"af-provide-edit-modal__title",children:R.label}),o.jsx("button",{type:"button",className:"af-provide-edit-modal__close",onClick:()=>D(null),"aria-label":u("common:close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx("div",{className:"af-provide-edit-modal__body",children:o.jsx("textarea",{ref:M,className:"af-provide-edit-modal__textarea",defaultValue:R.content,autoFocus:!0})}),o.jsxs("div",{className:"af-provide-edit-modal__foot",children:[o.jsxs("button",{type:"button",className:"af-provide-edit-modal__btn af-provide-edit-modal__btn--save",onClick:()=>{!R||!M.current||(F(R.instanceId,M.current.value),D(null))},children:[o.jsx("span",{className:"material-symbols-outlined",children:"save"}),u("flow:provideEdit.save")]}),o.jsxs("button",{type:"button",className:"af-provide-edit-modal__btn",onClick:()=>D(null),children:[o.jsx("span",{className:"material-symbols-outlined",children:"close"}),u("flow:provideEdit.cancel")]})]})]})}),document.body)]})}const YI={ai:["planner-system","planner-user","planner-response","agent-step-prompt","repair-prompt","ai-thinking","ai-assistant","ai-result","ai-tool"],flow:["composer-start","classify","plan","phase-plan","phase-complete","phase-auto-continue","composer-done"],step:["step-start","step-progress","step-done","validation"],output:["natural","status"],error:["error"]},pU={"planner-system":"#9ecaff","planner-user":"#9ecaff","planner-response":"#7c4dff","agent-step-prompt":"#7c4dff","repair-prompt":"#ff6b6b","ai-thinking":"#a8b9d4","ai-assistant":"#e8deff","ai-result":"#00e475","ai-tool":"#9ecaff","composer-start":"#00e475","composer-done":"#00e475","step-start":"#e8deff","step-done":"#e8deff","step-progress":"#e8deff",natural:"#a8a8a8",status:"#a8a8a8",error:"#ff6b6b","phase-plan":"#00e475","phase-complete":"#00e475"};function hU(e){return!e||e<1024?`${e||0} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}function mU(e){if(!e)return"";const t=new Date(e);return isNaN(t.getTime())?e:`${t.getHours().toString().padStart(2,"0")}:${t.getMinutes().toString().padStart(2,"0")}:${t.getSeconds().toString().padStart(2,"0")}.${t.getMilliseconds().toString().padStart(3,"0")}`}function gU(e){if(!e)return"";const t=new Date(e);return isNaN(t.getTime())?e:`${t.getMonth()+1}/${t.getDate()} ${t.getHours().toString().padStart(2,"0")}:${t.getMinutes().toString().padStart(2,"0")}`}function lj(e,t){if(e==="natural"&&t&&typeof t=="object"){const n=t.kind;if(n==="thinking"||n==="assistant"||n==="result"||n==="tool")return"ai";if(n==="error")return"error"}for(const[n,r]of Object.entries(YI))if(r.includes(e))return n;return"other"}function yU({event:e,defaultExpanded:t}){const[n,r]=m.useState(!!t),s=pU[e.tag]||"#a8a8a8",i=e.payload,a=i&&typeof i=="object",l=a?typeof i.text=="string"?i.text:"":String(i||""),u=a?i.meta:null,d=m.useMemo(()=>l?l.slice(0,140).replace(/\s+/g," "):a?Object.keys(i).filter(h=>h!=="text"&&h!=="meta").slice(0,3).map(h=>{const g=i[h];return g==null?`${h}:null`:typeof g=="object"?`${h}:{…}`:`${h}:${String(g).slice(0,30)}`}).join(" "):"",[i,l,a]),f=m.useCallback(c=>{c.stopPropagation();const p=a?JSON.stringify(i,null,2):String(i);try{navigator.clipboard.writeText(p)}catch{}},[i,a]);return o.jsxs("div",{style:{borderLeft:`3px solid ${s}`,background:n?"#1c1b1b":"#131313",marginBottom:4,borderRadius:4,cursor:"pointer",transition:"background 120ms"},onClick:()=>r(c=>!c),children:[o.jsxs("div",{style:{padding:"6px 10px",display:"flex",alignItems:"center",gap:10,fontSize:12},children:[o.jsx("span",{style:{color:"#9a9a9a",fontFamily:"monospace",flexShrink:0},children:mU(e.ts)}),o.jsx("span",{style:{color:s,fontWeight:600,fontFamily:"monospace",flexShrink:0,padding:"1px 6px",background:"rgba(255,255,255,0.04)",borderRadius:3},children:e.tag}),o.jsx("span",{style:{color:"#c5c2c1",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:"monospace"},children:d}),n&&o.jsx("button",{type:"button",onClick:f,style:{background:"rgba(124,77,255,0.15)",color:"#e8deff",border:"none",borderRadius:3,padding:"2px 8px",fontSize:11,cursor:"pointer"},children:"Copy"})]}),n&&o.jsxs("div",{style:{padding:"0 10px 10px 10px",borderTop:"1px solid rgba(255,255,255,0.04)"},children:[u&&Object.keys(u).length>0&&o.jsx("div",{style:{marginTop:8,padding:8,background:"#0e0e0e",borderRadius:4,fontSize:11,fontFamily:"monospace",color:"#9ecaff",whiteSpace:"pre-wrap",wordBreak:"break-all"},children:JSON.stringify(u,null,2)}),l?o.jsx("pre",{style:{marginTop:8,padding:10,background:"#0e0e0e",borderRadius:4,fontSize:12,color:"#e5e2e1",whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:600,overflowY:"auto",margin:"8px 0 0 0",fontFamily:"ui-monospace, SF Mono, Menlo, monospace"},children:l}):a?o.jsx("pre",{style:{marginTop:8,padding:10,background:"#0e0e0e",borderRadius:4,fontSize:12,color:"#e5e2e1",whiteSpace:"pre-wrap",wordBreak:"break-all",maxHeight:400,overflowY:"auto",margin:"8px 0 0 0",fontFamily:"ui-monospace, SF Mono, Menlo, monospace"},children:JSON.stringify(i,null,2)}):null]})]})}function xU({open:e,onClose:t,flowId:n}){var D;const[r,s]=m.useState([]),[i,a]=m.useState(!1),[l,u]=m.useState(null),[d,f]=m.useState(null),[c,p]=m.useState(!1),[h,g]=m.useState(!0),[v,k]=m.useState({ai:!0,flow:!0,step:!0,output:!0,error:!0}),[y,b]=m.useState(""),w=m.useRef(null),N=m.useCallback(async()=>{a(!0);try{const M=h&&n?`?flowId=${encodeURIComponent(n)}`:"",$=await(await fetch(`/api/composer-logs${M}`)).json();s(Array.isArray($.sessions)?$.sessions:[])}catch{s([])}finally{a(!1)}},[n,h]),C=m.useCallback(async M=>{if(!M){f(null);return}p(!0);try{const $=await(await fetch(`/api/composer-logs/${encodeURIComponent(M)}`)).json();f($)}catch{f(null)}finally{p(!1)}},[]);m.useEffect(()=>{e&&N()},[e,N]),m.useEffect(()=>{if(!(!e||!l))return C(l),w.current=setInterval(()=>C(l),2e3),()=>{w.current&&clearInterval(w.current),w.current=null}},[e,l,C]);const j=m.useMemo(()=>{const M=(d==null?void 0:d.events)||[],z=y.trim().toLowerCase();return M.filter($=>{const A=lj($.tag,$.payload);return!v[A]&&A!=="other"?!1:z?[$.tag,JSON.stringify($.payload||"")].join(" ").toLowerCase().includes(z):!0})},[d,v,y]),R=m.useMemo(()=>{const M=(d==null?void 0:d.events)||[],z={};for(const $ of M){const A=lj($.tag,$.payload);z[A]=(z[A]||0)+1}return z},[d]);return e?o.jsxs("div",{style:{position:"fixed",top:0,right:0,bottom:0,width:"min(1100px, 80vw)",background:"#131313",borderLeft:"1px solid rgba(255,255,255,0.08)",display:"flex",flexDirection:"column",zIndex:9999,boxShadow:"-8px 0 32px rgba(0,0,0,0.5)",color:"#e5e2e1",fontFamily:"Inter, system-ui, sans-serif"},children:[o.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid rgba(255,255,255,0.06)",display:"flex",alignItems:"center",gap:12,flexShrink:0,background:"#1c1b1b"},children:[o.jsx("span",{style:{fontWeight:600,fontSize:14},children:"Composer Logs"}),o.jsx("span",{style:{fontSize:11,color:"#9a9a9a"},children:n?`flowId: ${n}`:"no flow selected"}),o.jsxs("label",{style:{fontSize:11,color:"#9a9a9a",display:"flex",alignItems:"center",gap:4,cursor:"pointer"},children:[o.jsx("input",{type:"checkbox",checked:h,onChange:M=>g(M.target.checked),disabled:!n}),"仅显示当前 flow"]}),o.jsx("button",{type:"button",onClick:N,style:{background:"rgba(124,77,255,0.15)",color:"#e8deff",border:"none",borderRadius:4,padding:"4px 10px",fontSize:12,cursor:"pointer"},children:"Refresh"}),o.jsx("span",{style:{flex:1}}),o.jsx("button",{type:"button",onClick:t,style:{background:"transparent",color:"#e5e2e1",border:"1px solid rgba(255,255,255,0.12)",borderRadius:4,padding:"4px 12px",fontSize:12,cursor:"pointer"},children:"Close"})]}),o.jsxs("div",{style:{flex:1,display:"flex",overflow:"hidden",minHeight:0},children:[o.jsxs("div",{style:{width:280,borderRight:"1px solid rgba(255,255,255,0.06)",overflowY:"auto",background:"#0e0e0e",flexShrink:0},children:[i&&o.jsx("div",{style:{padding:12,fontSize:12,color:"#9a9a9a"},children:"Loading…"}),!i&&r.length===0&&o.jsx("div",{style:{padding:12,fontSize:12,color:"#9a9a9a"},children:h&&n?"no sessions for this flow":"no sessions"}),r.map(M=>{const z=l===M.sessionId;return o.jsxs("div",{onClick:()=>u(M.sessionId),style:{padding:"10px 12px",borderBottom:"1px solid rgba(255,255,255,0.04)",cursor:"pointer",background:z?"rgba(124,77,255,0.18)":"transparent",borderLeft:z?"3px solid #7c4dff":"3px solid transparent"},children:[o.jsx("div",{style:{fontSize:12,fontWeight:600,color:"#e5e2e1"},children:gU(M.mtime)}),o.jsx("div",{style:{fontSize:11,color:"#9ecaff",marginTop:2,fontFamily:"monospace"},children:M.flowId||"(no flow)"}),M.promptPreview&&o.jsx("div",{style:{fontSize:11,color:"#9a9a9a",marginTop:4,overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:M.promptPreview}),o.jsxs("div",{style:{fontSize:10,color:"#6a6a6a",marginTop:4},children:[hU(M.size)," · ",M.model||"default"]})]},M.sessionId)})]}),o.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",minHeight:0},children:[o.jsxs("div",{style:{padding:"10px 16px",borderBottom:"1px solid rgba(255,255,255,0.06)",display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",flexShrink:0,background:"#1c1b1b"},children:[Object.keys(YI).map(M=>o.jsxs("button",{type:"button",onClick:()=>k(z=>({...z,[M]:!z[M]})),style:{background:v[M]?"rgba(124,77,255,0.25)":"transparent",color:v[M]?"#e8deff":"#6a6a6a",border:`1px solid ${v[M]?"rgba(124,77,255,0.4)":"rgba(255,255,255,0.08)"}`,borderRadius:999,padding:"3px 12px",fontSize:11,cursor:"pointer",fontFamily:"monospace",textTransform:"uppercase"},children:[M," ",R[M]!=null?`(${R[M]})`:""]},M)),o.jsx("input",{type:"text",placeholder:"search…",value:y,onChange:M=>b(M.target.value),style:{marginLeft:8,flex:1,minWidth:120,background:"#0e0e0e",border:"1px solid rgba(255,255,255,0.08)",borderRadius:4,color:"#e5e2e1",padding:"4px 8px",fontSize:12}})]}),o.jsxs("div",{style:{flex:1,overflowY:"auto",padding:12,minHeight:0},children:[!l&&o.jsx("div",{style:{color:"#9a9a9a",fontSize:12,padding:20,textAlign:"center"},children:"Select a session on the left to view events"}),c&&!d&&o.jsx("div",{style:{color:"#9a9a9a",fontSize:12,padding:20},children:"Loading…"}),d&&j.length===0&&o.jsxs("div",{style:{color:"#9a9a9a",fontSize:12,padding:20},children:["No events match current filter (",((D=d.events)==null?void 0:D.length)||0," total)"]}),j.map((M,z)=>o.jsx(yU,{event:M,defaultExpanded:M.tag==="error"},`${M.ts}_${z}`))]})]})]})]}):null}const wU="0.1.46";function cj(e){const t=Math.max(0,Number(e)||0),n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4),s=Math.floor(t%6e4/1e3);return`${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}:${String(s).padStart(2,"0")}`}function zy(e,t){return t==="running"?cj(e):e==null||!Number.isFinite(e)||e<=0?"--":cj(e)}const GI=m.createContext({modelLists:{cursor:[],opencode:[]},onModelChange:()=>{}});function bU(e){const{setNodes:t}=Dl(),{modelLists:n,onModelChange:r}=m.useContext(GI),s=m.useCallback(d=>{t(f=>f.filter(c=>c.id!==d))},[t]),i=m.useCallback(()=>{var p,h,g,v,k,y,b,w;const d=((p=e.data)==null?void 0:p.definitionId)||"",f=((h=e.data)==null?void 0:h.label)||e.id,c=((k=(v=(g=e.data)==null?void 0:g.outputs)==null?void 0:v[0])==null?void 0:k.value)||((w=(b=(y=e.data)==null?void 0:y.outputs)==null?void 0:b[0])==null?void 0:w.default)||"";window.__provideEditContent={instanceId:e.id,label:f,definitionId:d,content:c},window.dispatchEvent(new CustomEvent("provide-expand"))},[e.id,e.data]),a=m.useCallback((d,f)=>{t(c=>c.map(p=>{var g;if(p.id!==d)return p;const h=Array.isArray((g=p.data)==null?void 0:g.outputs)&&p.data.outputs.length?p.data.outputs.map((v,k)=>k===0?{...v,default:f,value:f}:v):[{type:"bool",name:"value",default:f,value:f}];return{...p,data:{...p.data,body:"",outputs:h}}}))},[t]),l=m.useCallback((d,f)=>{t(c=>c.map(p=>p.id===d?{...p,data:{...p.data,body:f}}:p))},[t]),u=m.useCallback((d,f)=>{t(c=>c.map(p=>p.id===d?{...p,data:{...p.data,images:ds(f)}}:p))},[t]);return o.jsx(DI,{...e,deleteNode:s,onProvideExpand:i,onProvideValueChange:a,onNodeBodyChange:l,onNodeImagesChange:u,modelLists:n,onModelChange:r})}const vU={[Lf]:bU},ld=["CONTROL","TOOL","PROVIDE","AGENT"],kU=1200,uj="af-flow-node--sync-flash",dj="af-flow-edge--sync-flash";function fj(e,t){const n=String(e||"").trim();return n?n.split(/\s+/).includes(t)?n:`${n} ${t}`:t}function pj(e,t){const n=String(e||"").trim();return n?n.split(/\s+/).filter(r=>r&&r!==t).join(" "):""}function Rv(e){const t=((e==null?void 0:e.id)??"").trim();return/^control/i.test(t)?"CONTROL":/^tool/i.test(t)?"TOOL":/^provide/i.test(t)?"PROVIDE":"AGENT"}function SU(e){const t=Rv(e);return t==="CONTROL"?"control":t==="PROVIDE"?"provide":t==="TOOL"?"tool":"agent"}function Fp(e){return(Array.isArray(e)?e:[]).map(n=>{const r=String((n==null?void 0:n.name)||(n==null?void 0:n.id)||"").trim(),s=String((n==null?void 0:n.type)||"").trim();return!r&&!s?"":s?`${r||"-"}: ${s}`:r}).filter(Boolean)}function XI(e){return String((e==null?void 0:e.label)||"").trim()||String((e==null?void 0:e.id)||"").trim()}function JI(e){return String((e==null?void 0:e.description)||(e==null?void 0:e.body)||"").replace(/\s+/g," ").trim()}function By(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 hj(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 mj(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 NU(e){return e==="CONTROL"?"account_tree":e==="TOOL"?"build":e==="PROVIDE"?"database":"smart_toy"}function jU(e,t){return t?[e==null?void 0:e.id,e==null?void 0:e.label,e==null?void 0:e.description].filter(Boolean).some(r=>String(r).toLowerCase().includes(t)):!0}function QI(e,t,n,r,s){const i=SU(e),a={id:t,type:Lf,position:n,data:{label:e.label??e.id,definitionId:e.id,schemaType:i,inputs:Array.isArray(e.inputs)?e.inputs.map(l=>({...l})):[],outputs:Array.isArray(e.outputs)?e.outputs.map(l=>({...l})):[]}};return ff(a,r,s)}function CU(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 gj(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(d=>[d.id,d])),i=s.get(n),a=s.get(r),l=au(i,e.sourceHandle||"output-0","source"),u=au(a,e.targetHandle||"input-0","target");return!l||!u?!1:ou(l,u)}function EU(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=au(i,r,s);return a?{nodeId:n,handleId:r,handleType:s,slot:a,slotType:$I(a)}:null}function _U(e,t,n){var a;const r=QI(e,`__candidate_${e.id}`,{x:0,y:0},{},t),s=n.handleType==="source"?"inputs":"outputs",i=Array.isArray((a=r.data)==null?void 0:a[s])?r.data[s]:[];for(let l=0;l<i.length;l+=1){const u=i[l];if(n.handleType==="source"?ou(n.slot,u):ou(u,n.slot))return{slot:u,slotIndex:l,hydrated:r}}return null}function PU(e,t){return t?e.map((n,r)=>{const s=_U(n,e,t);if(!s)return null;const i=Rv(n);return{def:n,order:r,category:i,categoryRank:ld.indexOf(i),slot:s.slot,slotIndex:s.slotIndex,displayLabel:XI(s.hydrated.data||n),description:JI(n)}}).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}):[]}const AU=/@([a-zA-Z_][a-zA-Z0-9_]*)/g;function IU(e){const t=new Set,n=[];let r;const s=new RegExp(AU.source,"g");for(;(r=s.exec(e))!==null;){const i=r[1];t.has(i)||(t.add(i),n.push(i))}return n}function yj(e,t){const n=e.slice(0,t),r=n.lastIndexOf("@");if(r<0)return null;const s=n.slice(r+1);return/[\s\n]/.test(s)?null:{atIndex:r,query:s}}function jo(e){const t=String(e||"").indexOf(" - ");return t>=0?e.slice(0,t).trim():String(e||"").trim()}function zp(e,t,n,r){const s=(e||"").trim();if(!s)return"";if(s.startsWith("opencode:")||s.startsWith("claude-code:"))return s;const i=Array.isArray(t)?t:[],a=Array.isArray(n)?n:[],l=Array.isArray(r)?r:[],u=i.map(jo),d=a.map(jo);return l.map(jo).includes(s)&&!u.includes(s)&&!d.includes(s)?`claude-code:${s}`:d.includes(s)&&!u.includes(s)?`opencode:${s}`:s}function TU(e){if(e==null)return"";const t=String(e).trim();return t?t.length<=26?t:`${t.slice(0,12)}…${t.slice(-10)}`:""}function Hy(e){if(!Array.isArray(e)||e.length===0)return 0;let t=0;for(const n of e){const r=/^(?:对话|Conversation|Chat)\s*(\d+)\s*$/.exec(String((n==null?void 0:n.label)??"").trim());r&&(t=Math.max(t,parseInt(r[1],10)))}return t}function RU({steps:e}){const{t}=Sn();return!e||e.length===0?null:o.jsx("div",{className:"af-composer-steps-track",role:"list","aria-label":t("flow:composer.stepsAriaLabel"),children:e.map(n=>{const r=String(n.description||n.type||"").trim(),s=n.model||n.executorModel,i=[`${n.index+1}. ${r||"—"}`,n.nodeRole?t("flow:composer.stepRoleLabel",{role:n.nodeRole}):"",n.instanceId?t("flow:composer.stepInstanceLabel",{instanceId:n.instanceId}):"",s?`${t("flow:palette.model")}:${s}`:""].filter(Boolean).join(`
|
|
129
|
+
`),a=n.status||"pending";return o.jsxs("div",{className:"af-composer-step-chip"+(a==="done"?" af-composer-step-chip--done":"")+(a==="running"?" af-composer-step-chip--running":"")+(a==="error"?" af-composer-step-chip--error":"")+(a==="pending"?" af-composer-step-chip--pending":""),role:"listitem",title:i,children:[o.jsx("span",{className:"af-composer-step-chip-idx",children:n.index+1}),o.jsx("span",{className:"af-composer-step-chip-main",children:n.nodeRole||s?o.jsxs("span",{className:"af-composer-step-chip-meta",children:[n.nodeRole?o.jsx("span",{className:"af-composer-step-chip-role",children:n.nodeRole}):null,s?o.jsx("span",{className:"af-composer-step-chip-model",children:TU(s)}):null]}):null})]},n.index)})})}function LU(e,t){const n=e.trim(),r=t.trim();return r?n?!!(n===r||n.endsWith(r)||r.length>=8&&n.includes(r)):!1:!0}function OU(e){const t=[];for(const n of e){if(!n||typeof n.text!="string"||!n.text.trim())continue;const s=typeof n.kind=="string"&&n.kind?n.kind:"assistant",i=t[t.length-1];i&&i.kind===s?i.text+=s==="error"||s==="result"?`
|
|
130
|
+
${n.text}`:n.text:t.push({kind:s,text:n.text})}return t}function MU(e,t){return e==="thinking"?t("flow:composer.thinking"):e==="result"?t("flow:composer.result"):e==="assistant"?t("flow:composer.reply"):e==="error"?t("flow:composer.error"):String(e)}function $U(e){return e==="thinking"?"af-composer-ai-block af-composer-ai-block--thinking":e==="result"?"af-composer-ai-block af-composer-ai-block--result":e==="assistant"?"af-composer-ai-block af-composer-ai-block--reply":e==="error"?"af-composer-ai-block af-composer-ai-block--error":"af-composer-ai-block af-composer-ai-block--reply"}function xj({thread:e,liveSegments:t,running:n,className:r="",autoScroll:s=!0}){const{t:i}=Sn(),a=m.useRef(null),l=["af-composer-ai-stack","af-composer-ai-stack--in-panel","af-composer-thread-stack",r].filter(Boolean).join(" ");return m.useEffect(()=>{if(!s||!a.current)return;const u=a.current;requestAnimationFrame(()=>{u.scrollTop=u.scrollHeight})},[e,t,s]),o.jsxs("div",{ref:a,className:l,children:[e.map((u,d)=>u.type==="user"?o.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--user-msg",children:[o.jsx("div",{className:"af-composer-ai-block-label",children:i("flow:composer.yourQuestion")}),o.jsx("div",{className:"af-composer-ai-block-body",children:u.text})]},`composer-u-${d}-${u.text.slice(0,48)}`):o.jsx("div",{className:"af-composer-thread-assistant",children:o.jsx(wj,{segments:u.segments,running:!1})},`composer-a-${d}`)),o.jsx("div",{className:"af-composer-thread-assistant",children:o.jsx(wj,{segments:t,running:n})})]})}function wj({segments:e,running:t=!1}){const{t:n}=Sn(),r=e.filter(c=>c.kind==="assistant").map(c=>c.text).join(""),s=e.filter(c=>c.kind==="result").map(c=>c.text).join(""),i=LU(r,s),a=e.filter(c=>c.kind==="error").map(c=>c.text).join(`
|
|
131
|
+
`),l=e.filter(c=>c.kind!=="error"),u=i?l.filter(c=>c.kind!=="result"):l,d=OU(u),f=!!(d.length>0||a);return o.jsxs(o.Fragment,{children:[d.map((c,p)=>o.jsxs("section",{className:$U(c.kind),children:[o.jsx("div",{className:"af-composer-ai-block-label",children:MU(c.kind,n)}),o.jsx("div",{className:"af-composer-ai-block-body",children:c.text})]},`${c.kind}-${p}`)),t&&!f?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:n("flow:composer.reply")}),o.jsx("div",{className:"af-composer-ai-block-body",children:n("flow:composer.waiting")})]}):null,a?o.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--error",children:[o.jsx("div",{className:"af-composer-ai-block-label",children:n("flow:composer.error")}),o.jsx("div",{className:"af-composer-ai-block-body",children:a})]}):null]})}function DU({fitViewEpoch:e}){const{fitView:t}=Dl(),n=m.useRef(t);return n.current=t,m.useEffect(()=>{if(e>0){const r=requestAnimationFrame(()=>n.current({padding:.2,duration:200,maxZoom:1}));return()=>cancelAnimationFrame(r)}},[e]),null}function FU({onReady:e}){const t=uv();return m.useEffect(()=>(e(t),()=>e(null)),[e,t]),null}function bj(e){const t=Number.isFinite(e)?e:1;return Math.min(Math.max(t,.75),1)}const mh=1500,vj=500,zU=262144,BU=2e3;function Wy(e){return typeof e!="string"?"":e.length<=BU?e:`[log line truncated, ${e.length} chars]`}const HU=mh;function WU(e){const t=e.match(/^\[([^\]]+)\]\s+\[([^\]]+)\]\s+([\s\S]*)$/);if(!t)return null;const[,n,r,s]=t;if(r==="cli")try{const i=JSON.parse(s);return i&&i.event==="node-start"?{ts:n,type:"node-start",text:`节点 ${i.instanceId||""}${i.label?` · ${i.label}`:""} 开始`}:i&&i.event==="node-done"?{ts:n,type:"node-done",text:`节点 ${i.instanceId||""} 完成${i.elapsed?` (${i.elapsed})`:""}`}:i&&i.event==="node-failed"?{ts:n,type:"node-failed",text:`节点 ${i.instanceId||""} 失败${i.error?`: ${i.error}`:""}`}:i&&i.event==="apply-start"?{ts:n,type:"info",text:`[apply-start] uuid=${i.uuid||""}`}:{ts:n,type:"info",text:Wy(s)}}catch{return{ts:n,type:"info",text:Wy(s)}}return{ts:n,type:"log",text:Wy(`[${r}] ${s}`)}}function kj(e){if(!e)return[];const t=[],n=e.split(`
|
|
132
|
+
`);for(let r=n.length-1;r>=0&&t.length<HU;r--){const s=n[r];if(!s)continue;const i=WU(s);i&&t.push(i)}return t.reverse(),t}function VU(e,t){if(e===t)return!0;if(!e||!t)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const s of n){const i=e[s],a=t[s];if(!a)return!1;if(i!==a&&(i.status!==a.status||(i.elapsed??null)!==(a.elapsed??null)))return!1}return!0}function UU(e,t){if(e===t)return!0;if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function KU({fitViewEpoch:e,canvasTool:t,nodes:n,edges:r,onNodesChange:s,onEdgesChange:i,onConnect:a,onConnectStart:l,onConnectEnd:u,isValidConnection:d,onNodesDelete:f,onNodeClick:c,onNodeDoubleClick:p,onEdgeClick:h,onFlowInit:g,onDrop:v,onDragOver:k,hideMinimapAndControls:y,bottomSlot:b}){const{t:w}=Sn(),N=!s,C=N||t==="pan"?!0:[1,2],j=N?!1:t==="select",R="af-flow-canvas"+(N?" af-flow-canvas--run-mode":"")+(t==="pan"?" af-flow-canvas--tool-pan":" af-flow-canvas--tool-select"),D=m.useCallback(()=>{},[]),M=m.useMemo(()=>{const z=new Map(n.map(O=>[O.id,O])),$=new Set(n.filter(O=>O.selected).map(O=>O.id)),A=$.size>0,F=(O,I)=>{const B=/^#([0-9a-f]{6})$/i.exec(O);if(!B)return O;const P=parseInt(B[1],16);return`rgba(${P>>16&255}, ${P>>8&255}, ${P&255}, ${I})`},T="#ff5169";return r.map(O=>{var be,Ie,_e,nt;const I=z.get(O.source),B=z.get(O.target),P=/^output-(\d+)$/.exec(O.sourceHandle||""),L=/^input-(\d+)$/.exec(O.targetHandle||""),_=I&&P?(Ie=(be=I.data)==null?void 0:be.outputs)==null?void 0:Ie[parseInt(P[1],10)]:null,G=B&&L?(nt=(_e=B.data)==null?void 0:_e.inputs)==null?void 0:nt[parseInt(L[1],10)]:null,Z=_!=null&&_.type?Xn(_.type):null,U=G!=null&&G.type?Xn(G.type):null,se=Z&&U&&Z!==U,ue=A&&($.has(O.source)||$.has(O.target)),de=O.style||{};if(se){const st=O.selected?.95:ue?.85:.78,Je=F(T,st);return{...O,className:((O.className||"")+" af-flow-edge--type-mismatch"+(ue?" af-flow-edge--adjacent":"")).trim(),style:{...de,stroke:Je,strokeWidth:ue?2.75:2.5,strokeDasharray:"6 4"},markerEnd:O.markerEnd&&typeof O.markerEnd=="object"?{...O.markerEnd,color:Je}:{type:gs.ArrowClosed,color:Je}}}const me=Z||U;if(!me)return ue?{...O,className:((O.className||"")+" af-flow-edge--adjacent").trim(),style:{...de,strokeWidth:2.5}}:O;const ae=ue||O.selected?.7:.38,Ne=F(me,ae),Pe=ue?2.5:de.strokeWidth??2;return{...O,className:((O.className||"")+(ue?" af-flow-edge--adjacent":"")).trim(),style:{...de,stroke:Ne,strokeWidth:Pe},markerEnd:O.markerEnd&&typeof O.markerEnd=="object"?{...O.markerEnd,color:Ne}:{type:gs.ArrowClosed,color:Ne}}})},[n,r]);return o.jsxs(QP,{className:R,nodes:n,edges:M,onNodesChange:s||D,onEdgesChange:i||D,onConnect:N?void 0:a,onConnectStart:N?void 0:l,onConnectEnd:N?void 0:u,isValidConnection:N?void 0:d,onNodesDelete:N?void 0:f,onNodeClick:c,onNodeDoubleClick:N?void 0:p,onEdgeClick:N?void 0:h,onInit:g,onDrop:N?void 0:v,onDragOver:N?void 0:k,nodeTypes:vU,selectionOnDrag:j,panOnDrag:C,nodesDraggable:!N,nodesConnectable:!N,elementsSelectable:!N,edgesFocusable:!N,panActivationKeyCode:"Space",proOptions:{hideAttribution:!0},fitView:!1,minZoom:.1,maxZoom:4,defaultEdgeOptions:{style:{stroke:"rgba(205, 189, 255, 0.45)",strokeWidth:2}},connectionLineStyle:{stroke:"rgba(205, 189, 255, 0.65)",strokeWidth:2},children:[o.jsx(nA,{gap:20,size:1,color:"rgba(28, 27, 27, 0.9)"}),o.jsx(su,{position:"bottom-center",className:"af-flow-bottom-unified-panel"+(y?" af-flow-bottom-unified-panel--solo":""),children:o.jsxs("div",{className:"af-flow-bottom-unified-row"+(y?" af-flow-bottom-unified-row--solo":""),children:[y?null:o.jsx("div",{className:"af-flow-bottom-unified__side af-flow-bottom-unified__side--minimap",children:o.jsx(QB,{zoomable:!0,pannable:!0,position:"bottom-left",className:"af-flow-bottom-minimap",style:{width:152,height:104},maskColor:"rgba(14, 14, 14, 0.85)",nodeColor:z=>{var A;const $=(((A=z.data)==null?void 0:A.schemaType)??"agent").toLowerCase();return $==="control"?"rgba(237, 108, 2, 0.85)":$==="provide"?"rgba(0, 228, 117, 0.35)":$==="tool"?"rgba(124, 77, 255, 0.75)":"rgba(158, 202, 255, 0.5)"}})}),o.jsx("div",{className:"af-flow-bottom-unified__center",children:b}),y?null:o.jsx("div",{className:"af-flow-bottom-unified__side af-flow-bottom-unified__side--zoom",children:o.jsx(FB,{position:"bottom-right",showInteractive:!1,className:"af-flow-bottom-controls"})})]})}),!y&&o.jsx(su,{position:"bottom-left",className:"af-pin-legend",children:[{type:"node",color:"#ff9800"},{type:"text",color:"#2196f3"},{type:"file",color:"#4caf50"},{type:"bool",color:"#9c27b0"}].map(({type:z,color:$})=>o.jsxs("span",{className:"af-pin-legend__item",children:[o.jsx("span",{className:"af-pin-legend__dot",style:{background:$}}),o.jsx("span",{className:"af-pin-legend__label",children:z})]},z))}),o.jsx(DU,{fitViewEpoch:e}),!N&&n.length===0?o.jsxs("div",{className:"af-flow-empty-hint",children:[o.jsx("span",{className:"af-flow-empty-hint-icon material-symbols-outlined",children:"account_tree"}),o.jsx("p",{className:"af-flow-empty-hint-text",children:w("flow:emptyCanvas.composerHint")}),o.jsx("p",{className:"af-flow-empty-hint-sub",dangerouslySetInnerHTML:{__html:w("flow:emptyCanvas.composerSub")}})]}):null]})}function Sj(e){if(!window.location.pathname.startsWith("/flow"))return;if(!e){window.history.replaceState({},"","/flow");return}const t=new URLSearchParams({flowId:e.id,flowSource:e.source??"user"});e.archived&&t.set("flowArchived","1"),window.history.replaceState({},"","/flow?"+t.toString())}function qU(e){return e==="builtin"||e==="admin"?"workspace":e??"user"}function Ks(e){return e==="builtin"||e==="admin"}function cc(e,t){return t(e==="builtin"||e==="admin"?"flow:settings.builtin":e==="workspace"?"flow:palette.workspace":"flow:palette.userDir")}function YU(e){var r,s,i,a;const t=Number(((s=(r=e==null?void 0:e.data)==null?void 0:r.displaySize)==null?void 0:s.width)||(e==null?void 0:e.width)||0),n=Number(((a=(i=e==null?void 0:e.data)==null?void 0:i.displaySize)==null?void 0:a.height)||(e==null?void 0:e.height)||0);return t>0&&n>0?{width:Math.round(t),height:Math.round(n)}:null}const ZI="af:run-console-height",_d=230,Xu={enabled:!1,cron:"",timezone:"Asia/Shanghai",preset:"",overlapPolicy:"skip",misfirePolicy:"skip",nextRunAt:null},Bp={};function gh(e){if(!Number.isFinite(e))return _d;const t=Math.max(240,Math.floor(window.innerHeight*.88));return Math.min(Math.max(Math.round(e),96),t)}function GU(){try{const e=localStorage.getItem(ZI);if(e==null)return _d;const t=parseInt(e,10);return Number.isFinite(t)?gh(t):_d}catch{return _d}}function XU(){var m0,g0;const{t:e,i18n:t}=Sn(),{navigate:n,path:r}=Ba(),s=m.useRef(null),i=m.useRef(new Map),a=m.useCallback(x=>{s.current=typeof x=="function"?x:null},[]),[l,u]=m.useState([]),[d,f]=m.useState(""),[c,p]=m.useState(null),[h,g]=m.useState(0),[v,k]=m.useState(""),[y,b]=m.useState(""),[w,N]=m.useState(""),[C,j]=m.useState(""),[R,D]=m.useState(!1),[M,z]=m.useState(""),[$,A]=m.useState(!1),[F,T]=m.useState(""),[O,I]=m.useState(!1),[B,P]=m.useState(!1),[L,_]=m.useState(!1),[G,Z]=m.useState(null),[U,se]=m.useState(!1),[ue,de]=m.useState(!1),me=m.useRef(!1),[ae,Ne]=m.useState([]),[Pe,be]=m.useState(""),[Ie,_e]=m.useState("nodes"),nt=m.useRef(null),[st,Je]=m.useState([]),[Ct,Be]=m.useState(!1),[mt,Gt]=m.useState(""),[De,en]=m.useState(!1),[rn,pn]=m.useState({name:"",id:"",description:""}),[Hn,le]=m.useState(!1),[ve,qe]=m.useState(""),[ge,lt]=m.useState(""),Bt=m.useRef(null),[hn,In]=m.useState([]),[mn,cr]=m.useState(!1),[Xt,Wn]=m.useState(""),[Tn,br]=m.useState(""),[xe,Me]=m.useState(null),[Qe,re]=m.useState(null),[ke,et]=m.useState([]),[Mt,Nn]=m.useState(""),[sn,Gr]=m.useState(!1),Xr=m.useCallback(x=>{Bt.current&&window.clearTimeout(Bt.current),lt(x),Bt.current=window.setTimeout(()=>{lt(""),Bt.current=null},3800)},[]),bs=m.useCallback(x=>{const S=String(x||"").trim();if(!S)return;const H=()=>{var K;return(K=s.current)==null?void 0:K.call(s,S)};window.requestAnimationFrame(H),window.setTimeout(H,80)},[]);m.useEffect(()=>()=>{Bt.current&&window.clearTimeout(Bt.current)},[]);const[vr,Wo]=m.useState(!1),[Zn,vs]=m.useState({files:[]}),[Ai,mo]=m.useState(!1),[ni,Vn]=m.useState(!0);m.useEffect(()=>{let x=!1;const S=()=>{fetch("/api/flows",{method:"HEAD"}).then(K=>{x||Vn(K.ok)}).catch(()=>{x||Vn(!1)})};S();const H=window.setInterval(S,5e3);return()=>{x=!0,window.clearInterval(H)}},[]),m.useEffect(()=>{let x=!1;return fetch("/api/dev-info").then(S=>S.json()).then(S=>{x||kr(!!(S!=null&&S.isDev))}).catch(()=>{}),()=>{x=!0}},[]),m.useEffect(()=>{c!=null&&c.id&&n_(c.id,c.source??"user","pipeline",!!c.archived)},[c==null?void 0:c.id,c==null?void 0:c.source,c==null?void 0:c.archived]);const[Re,Qt]=m.useState("edit"),[er,gt]=m.useState([]),Fs=m.useRef(0),[Un,Mn]=m.useState(new Set),[ks,at]=m.useState({}),[Kt,Ht]=m.useState(null),[jn,Ye]=m.useState(0),[tr,Br]=m.useState(!1),[go,kr]=m.useState(!1),[Ii,Ss]=m.useState(!1),[ri,zs]=m.useState(GU),si=m.useRef({active:!1,pointerId:-1,startY:0,startH:_d}),[tn,Ns]=m.useState(null),[ii,Tr]=m.useState(null),[Sr,V]=m.useState({}),fe=m.useRef(Sr);m.useEffect(()=>{fe.current=Sr},[Sr]);const[Te,Ae]=m.useState(!1),[Ge,$t]=m.useState(!1),[yt,Kn]=m.useState({}),[$n,Ti]=m.useState({}),[js,Cs]=m.useState(null),[nr,Jr]=m.useState(Xu),[zl,Ri]=m.useState(!1),[oi,ze]=m.useState(!1),[Qr,Vo]=m.useState(""),[Wa,rr]=m.useState(""),[Wt,ur]=m.useState(Bp),[Dn,bu]=m.useState(null),Bl=m.useRef(0),ai=m.useRef(null),Va=m.useRef(null),Hl=m.useRef(!0),Bs=m.useRef(!1),[mr,Ua]=m.useState(null),[Uo,Ka]=m.useState(null),[qa,Li]=m.useState(!1),[Ya,Ga]=m.useState(""),[Wl,Xa]=m.useState(!1),Ko=m.useRef(null),[Zr,Vl]=m.useState(null),[vu,qo]=m.useState(!1),[Ul,ku]=m.useState(null),[Oi,Lt]=m.useState(!1),[Mi,Kl]=m.useState(null),Ja=m.useRef(null),[es,yo]=m.useState(""),[$i,li]=m.useState(0),[Qa,Za]=m.useState(0),[Su,Di]=m.useState("pan"),[qn,Fi]=m.useState(!1),[Nu,ql]=m.useState(!1),Yo=m.useRef(null),Yl=m.useRef(null),Go=m.useRef(null),[el,hg]=m.useState(0),[St,ju]=m.useState(null),[Xo,Gl]=m.useState(""),[wt,Jo]=m.useState({cursor:[],opencode:[],claudeCode:[]}),[Hs,Ws]=m.useState(""),[Cu,qv]=m.useState(""),[ci,mg]=m.useState([]),[xo,Qo]=m.useState([]),[Eu,gg]=m.useState(!1),[Xl,yg]=m.useState([]),[tl,xg]=m.useState(!1),[wg,bg]=m.useState(()=>new Set),[nl,Jl]=m.useState(!1),_u=m.useRef(null),Pu=m.useRef(null),[Rr,vg]=m.useState({}),rl=m.useCallback(x=>{if(!x)return null;const S=x.id,H=x.source??"user",K=x.archived?"archived":"";return{sessionsKey:`af:composer-sessions:${S}:${H}${K?":"+K:""}`,activeKey:`af:composer-active-session:${S}:${H}${K?":"+K:""}`}},[]),zf=m.useCallback(x=>{if(!x)return"";const S=x.id,H=x.source??"user",K=x.archived?"archived":"";return`af:composer-skills:pipeline:${S}:${H}${K?":"+K:""}`},[]),Au=m.useCallback(x=>{const S=rl(x);if(!S)return{sessions:[],activeSessionId:null};try{const H=localStorage.getItem(S.sessionsKey);if(!H)return{sessions:[],activeSessionId:null};const K=JSON.parse(H);if(!Array.isArray(K))return{sessions:[],activeSessionId:null};const q=K.filter(ee=>ee&&typeof ee.id=="string").map(ee=>({...ee,running:!1,statusLine:ee.running?e("flow:composer.pageRefreshReset"):ee.statusLine,steps:[]}));let X=null;try{X=localStorage.getItem(S.activeKey),X&&!q.some(ee=>ee.id===X)&&(X=null)}catch{X=null}return{sessions:q,activeSessionId:X}}catch{return{sessions:[],activeSessionId:null}}},[rl]),sl=m.useCallback((x,S,H)=>{const K=rl(x);if(K)try{localStorage.setItem(K.sessionsKey,JSON.stringify(S)),H?localStorage.setItem(K.activeKey,H):localStorage.removeItem(K.activeKey)}catch{}},[rl]),E=m.useRef(0),W=m.useRef({sessions:[],activeSessionId:null,flowKey:null}),[Y,J]=m.useState([]),[Q,ie]=m.useState(null),ne=m.useMemo(()=>zf(c),[zf,c]),[oe,ye]=m.useState(""),Ee=m.useMemo(()=>{if(!c)return null;const x=c.id,S=c.source??"user",H=c.archived?"archived":"";return`${x}:${S}${H?":"+H:""}`},[c]),ct=m.useRef(!1);m.useEffect(()=>{if(!Ee){J([]),ie(null),W.current={sessions:[],activeSessionId:null,flowKey:null};return}const x=W.current;if(x.flowKey===Ee)return;x.flowKey=Ee,ct.current&&x.sessions.length>0&&sl(c,x.sessions,x.activeSessionId);const{sessions:S,activeSessionId:H}=Au(c);if(S.length===0){const K=`session-1-${Date.now()}`,q={id:K,label:e("flow:composer.conversationLabel",{n:1}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null};x.sessions=[q],x.activeSessionId=K,J([q]),ie(K)}else{const K=S[S.length-1];if(K&&(!K.thread||K.thread.length===0))E.current=Hy(S),x.sessions=S,x.activeSessionId=K.id,J(S),ie(K.id);else{const X=Hy(S)+1;E.current=X;const ee=`session-${X}-${Date.now()}`,te={id:ee,label:e("flow:composer.conversationLabel",{n:X}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null},pe=[...S,te];x.sessions=pe,x.activeSessionId=ee,J(pe),ie(ee)}}ct.current=!0},[Ee,c,Au,sl]);const Ze=m.useMemo(()=>Y.find(x=>x.id===Q)||null,[Y,Q]),Xe=(Ze==null?void 0:Ze.running)??!1,Vt=(Ze==null?void 0:Ze.statusLine)??"",gn=(Ze==null?void 0:Ze.segments)??[],yn=(Ze==null?void 0:Ze.thread)??[],Nr=(Ze==null?void 0:Ze.steps)??[];Ze==null||Ze.outputDismissed;const Le=(Ze==null?void 0:Ze.phaseContext)??null,Dt=m.useRef([]),[It,on]=m.useState(!1),jr=m.useRef(null),ft=m.useRef(null);m.useEffect(()=>{const x=ft.current;x&&requestAnimationFrame(()=>{x.scrollTop=x.scrollHeight})},[yn,gn]);const he=m.useRef(null),tt=m.useRef(!1),pt=m.useRef(null),it=m.useCallback(x=>{const S=++E.current,H=`session-${S}-${Date.now()}`,K={id:H,label:x||e("flow:composer.conversationLabel",{n:S}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null};return J(q=>[...q,K]),ie(H),H},[]);m.useEffect(()=>{!c||!ct.current||(W.current.sessions=Y,W.current.activeSessionId=Q,sl(c,Y,Q))},[Y,Q,c,sl]),m.useEffect(()=>{E.current=Math.max(E.current,Hy(Y))},[Y]);const $e=m.useCallback(x=>{var S;he.current===x&&((S=jr.current)==null||S.abort()),J(H=>{const K=H.filter(X=>X.id!==x);if(H.some((X,ee)=>X.id===x&&H.findIndex(te=>te.id===Q)===ee)||Q===x){const X=K;X.length>0?ie(X[X.length-1].id):setTimeout(()=>{E.current=0;const ee=++E.current,te=`session-${ee}-${Date.now()}`,pe={id:te,label:e("flow:composer.conversationLabel",{n:ee}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null};J(we=>[...we,pe]),ie(te)},0)}return K})},[Q]),ut=m.useCallback(x=>{J(S=>{const H=S.findIndex(X=>X.id===Q);if(H<0)return S;const K={...S[H]};x(K);const q=[...S];return q[H]=K,q})},[Q]),qt=m.useCallback(x=>{ut(S=>{S.running=x})},[ut]),Nt=m.useCallback(x=>{ut(S=>{S.statusLine=x})},[ut]),Ot=m.useCallback(x=>{ut(S=>{typeof x=="function"?S.segments=x(S.segments):S.segments=x})},[ut]),an=m.useCallback(x=>{ut(S=>{typeof x=="function"?S.thread=x(S.thread):S.thread=x})},[ut]),jt=m.useCallback(x=>{ut(S=>{typeof x=="function"?S.steps=x(S.steps):S.steps=x})},[ut]),Zt=m.useCallback(x=>{ut(S=>{S.outputDismissed=x})},[ut]),dr=m.useCallback(x=>{ut(S=>{S.phaseContext=typeof x=="function"?x(S.phaseContext):x})},[ut]),Vs=m.useCallback(x=>{ie(x),J(S=>{const H=S.findIndex(q=>q.id===x);if(H<0||!S[H].outputDismissed)return S;const K=[...S];return K[H]={...S[H],outputDismissed:!1},K})},[]);m.useEffect(()=>{Dt.current=gn},[gn]);const xn=m.useRef({}),zi=m.useRef(!1),wo=m.useRef(null),Bi=m.useRef(null),Ql=m.useRef(!1),kg=m.useRef(0),Bf=m.useRef(""),[Pt,kt,JT]=ZP([]),[Cn,ln,QT]=eA([]),Hi=m.useRef(Pt),Zl=m.useRef(Cn),Yv=m.useRef(null),Sg=m.useRef(null),Gv=m.useRef(null),Hf=m.useRef(null),[ts,bo]=m.useState(null),ZT=m.useCallback(x=>{var S;xn.current=(S=x==null?void 0:x.extra)!=null&&S.instances&&typeof x.extra.instances=="object"?x.extra.instances:{},kt(Array.isArray(x==null?void 0:x.nodes)?x.nodes:[]),ln(Array.isArray(x==null?void 0:x.edges)?x.edges:[]),bo(null)},[ln,kt]),e2=m.useMemo(()=>({instances:xn.current}),[Cn,Pt]),{resetHistory:Xv,undo:Jv,redo:Qv}=MI({nodes:Pt,edges:Cn,extra:e2,enabled:!!c&&Ql.current&&Re==="edit",onRestore:ZT}),ui=m.useMemo(()=>Pt.filter(x=>{var S;return(((S=x.data)==null?void 0:S.definitionId)||"").startsWith("provide_")}),[Pt]),ec=m.useMemo(()=>{var S;const x={};for(const H of Pt){if(!((S=H.data)!=null&&S.inputs))continue;const K=H.data.inputs;for(let q=0;q<K.length;q++){const X=K[q];if(!(X!=null&&X.name))continue;const ee=Cn.find(pe=>pe.target===H.id&&pe.targetHandle===`input-${q}`);if(!(ee!=null&&ee.source))continue;ui.find(pe=>pe.id===ee.source)&&(x[ee.source]=X.name)}}return x},[Pt,Cn,ui]),Iu=m.useMemo(()=>{if(Re==="edit"||Un.size===0)return null;const x=new Set(Un);for(const S of Cn)Un.has(S.source)&&x.add(S.target),Un.has(S.target)&&x.add(S.source);return x},[Re,Un,Cn]),t2=m.useMemo(()=>Re==="edit"?Pt:Pt.map(x=>{var S,H;return{...x,draggable:!1,connectable:!1,data:{...x.data,isRunMode:!0,isExecuting:Un.has(x.id),nodeStatus:((S=ks[x.id])==null?void 0:S.status)??null,nodeElapsed:((H=ks[x.id])==null?void 0:H.elapsed)??null,isDim:Iu?!Iu.has(x.id):!1}}}),[Re,Pt,Un,ks,Iu]),n2=m.useMemo(()=>Iu?Cn.map(x=>{const S=Un.has(x.source)||Un.has(x.target),H=x.className?x.className.replace(/\s?af-flow-edge--(dim|focus)\b/g,""):"",K=S?"af-flow-edge--focus":"af-flow-edge--dim";return{...x,className:(H?H+" ":"")+K}}):Cn,[Cn,Un,Iu]);m.useEffect(()=>{if(!c){Ti({}),Cs(null),Jr(Xu),ur(Bp),bu(null),Vo(""),rr("");return}const x=new URLSearchParams({flowId:c.id,flowSource:c.source||"user"});c.archived&&x.set("archived","1"),fetch(`/api/flow/run-config?${x.toString()}`).then(S=>S.json()).then(S=>{Ti(S.presets||{}),Cs(S.activePreset||null)}).catch(()=>{Ti({}),Cs(null)})},[c==null?void 0:c.id,c==null?void 0:c.source,c==null?void 0:c.archived]);const Zo=m.useCallback(x=>{Bl.current+=1,Jr(x)},[]),ea=m.useCallback(async(x,S={})=>{if(!x)return;const H=!!S.quiet,K=!!S.force,q=Bl.current;H||(Ri(!0),Vo(""),rr(""));const X=new URLSearchParams({flowId:x.id,flowSource:x.source||"user"});x.archived&&X.set("archived","1");try{const ee=await fetch(`/api/flow/schedule?${X.toString()}`),te=await ee.json().catch(()=>({}));if(!ee.ok)throw new Error(te.error||`HTTP ${ee.status}`);if(!K&&Bl.current!==q)return;Jr({...Xu,...te.schedule||{}}),ur(te.state&&typeof te.state=="object"?te.state:Bp),bu(te.status||null)}catch(ee){if(!K&&Bl.current!==q)return;Jr(Xu),ur(Bp),bu(null),Vo(String(ee.message||ee))}finally{Ri(!1)}},[]);m.useEffect(()=>{if(!c)return;let x=!1;return(async()=>{await ea(c)})(),()=>{x=!0}},[c==null?void 0:c.id,c==null?void 0:c.source,c==null?void 0:c.archived,ea]),m.useEffect(()=>{var H,K,q,X;if(!js||!$n[js]||ui.length===0)return;const x=$n[js],S={};for(const ee of ui){const te=ec[ee.id];if(!te)continue;const pe=((H=ee.data)==null?void 0:H.definitionId)||"",we=x[ee.id]??((X=(q=(K=ee.data)==null?void 0:K.outputs)==null?void 0:q[0])==null?void 0:X.default)??"";pe.startsWith("provide_file")?S[te]={type:"file",path:we}:S[te]={type:"str",value:we}}Object.keys(S).length>0&&V(S)},[js,$n,ui,ec]);const r2=m.useCallback(()=>{if(!Mi||!Ja.current)return;const x=Ja.current.value;kt(S=>S.map(H=>{var K,q;return H.id!==Mi.instanceId?H:{...H,data:{...H.data,outputs:((q=(K=H.data)==null?void 0:K.outputs)==null?void 0:q.map((X,ee)=>ee===0?{...X,default:x}:X))||[{type:"text",name:"value",default:x}]}}})),Kl(null)},[Mi,kt]),dt=m.useMemo(()=>{const x=Pt.filter(S=>S.selected);return x.length===1?x[0]:null},[Pt]),Wi=m.useMemo(()=>c?g7(Pt,Cn,e):[],[c,Pt,Cn,e]),s2=m.useMemo(()=>Wi.map(x=>x.key).join("|"),[Wi]),Zv=m.useMemo(()=>Wi.some(x=>String((x==null?void 0:x.level)||"warning").toLowerCase()==="error"),[Wi]);m.useLayoutEffect(()=>{se(Wi.length>0&&!Zv)},[s2,c==null?void 0:c.id,c==null?void 0:c.source,Wi.length,Zv]),Go.current=dt,m.useEffect(()=>{Hi.current=Pt},[Pt]),m.useEffect(()=>{const x=i.current,S=new Map,H=[];for(const ee of Pt){const te=CU(ee);S.set(ee.id,te),x.get(ee.id)!==te&&H.push(ee.id)}if(i.current=S,H.length===0)return;const K=()=>H.forEach(ee=>{var te;return(te=s.current)==null?void 0:te.call(s,ee)}),q=window.requestAnimationFrame(K),X=window.setTimeout(K,80);return()=>{window.cancelAnimationFrame(q),window.clearTimeout(X)}},[Pt]),m.useEffect(()=>{Zl.current=Cn},[Cn]),m.useEffect(()=>{Gv.current=ts},[ts]),m.useEffect(()=>{if(!ts)return;const x=H=>{H.key==="Escape"&&bo(null)},S=H=>{var K,q;(q=(K=H.target)==null?void 0:K.closest)!=null&&q.call(K,".af-connect-node-menu")||bo(null)};return document.addEventListener("keydown",x),document.addEventListener("pointerdown",S),()=>{document.removeEventListener("keydown",x),document.removeEventListener("pointerdown",S)}},[ts]),m.useEffect(()=>()=>{Bi.current!=null&&(clearTimeout(Bi.current),Bi.current=null)},[]);const Ng=m.useMemo(()=>{var S;if(!dt)return null;const x=(S=dt.data)==null?void 0:S.definitionId;return ae.find(H=>H.id===x)??null},[dt,ae]),jg=m.useMemo(()=>{const x={CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const S of ae){const H=Rv(S);x[H].push(S)}for(const S of ld)x[S].sort((H,K)=>H.id.localeCompare(K.id));return x},[ae]),Wf=m.useMemo(()=>{const x=Pe.trim().toLowerCase();if(!x)return jg;const S={CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const H of ld)S[H]=jg[H].filter(K=>jU(K,x));return S},[jg,Pe]),i2=m.useMemo(()=>ld.reduce((x,S)=>x+Wf[S].length,0),[Wf]),Vf=m.useMemo(()=>ae.filter(x=>{const S=String(x.id??""),H=String(x.source??"");return S.startsWith("marketplace:")||H==="marketplace"||H==="collection"}),[ae]),e0=m.useMemo(()=>{const x=new Set;for(const S of Vf){const H=String(S.id??"");if(H&&(x.add(H),H.startsWith("marketplace:"))){const K=H.slice(12),[q]=K.split("@");q&&x.add(`marketplace:${q}`)}}return x},[Vf]),Uf=m.useCallback(async()=>{f("");try{const x=await fetch("/api/flows");if(!x.ok)throw new Error("HTTP "+x.status);u(await x.json())}catch(x){f(String(x.message||x))}},[]);m.useEffect(()=>{Uf()},[Uf]),m.useEffect(()=>{if(r!=="/flow")return;const x=new URLSearchParams(window.location.search);x.get("new")==="1"&&!x.get("flowId")&&n("/projects?new=1")},[r,n]),m.useEffect(()=>{let x=!1;const S=()=>{fetch("/api/model-lists").then(K=>K.json()).then(K=>{x||Jo({cursor:Array.isArray(K.cursor)?K.cursor.map(String):[],opencode:Array.isArray(K.opencode)?K.opencode.map(String):[],claudeCode:Array.isArray(K.claudeCode)?K.claudeCode.map(String):[]})}).catch(()=>{})};S();const H=setTimeout(S,4e3);return()=>{x=!0,clearTimeout(H)}},[]),m.useEffect(()=>{let x=!1;return fetch("/api/skills").then(S=>S.json()).then(S=>{if(x)return;const H=Array.isArray(S.skills)?S.skills.filter(K=>K&&typeof K.key=="string"&&K.key.trim()).map(K=>({key:String(K.key),name:String(K.name||K.id||K.key),description:K.description?String(K.description):"",sourceLabel:K.sourceLabel?String(K.sourceLabel):""})):[];mg(H),gg(!0)}).catch(()=>{}),()=>{x=!0}},[]),m.useEffect(()=>{let x=!1;return fetch("/api/skill-collections").then(S=>S.json()).then(S=>{x||(yg(Ca(S)),xg(!0))}).catch(()=>{}),()=>{x=!0}},[]),m.useEffect(()=>{if(ye(""),!(!Eu||!tl)){if(!ne){Qo([]);return}Qo(o_(ne,"pipeline",ci,Xl)),ye(ne)}},[Xl,tl,ci,Eu,ne]),m.useEffect(()=>{if(!(oe!==ne||!ne))try{localStorage.setItem(ne,JSON.stringify(xo))}catch{}},[xo,ne,oe]);const t0=m.useCallback(async x=>{const S=x.source??"user",H=!!x.archived,K=new URLSearchParams({flowId:x.id,flowSource:S});H&&K.set("archived","1");const q=new URLSearchParams({flowId:x.id,flowSource:S});H&&q.set("archived","1"),q.set("lang",String(t.language||"zh").startsWith("zh")?"zh":"en");const[X,ee]=await Promise.all([fetch("/api/flow?"+K.toString()),fetch("/api/nodes?"+q.toString())]),te=await X.json();if(!X.ok||te.error)throw new Error(te.error||e("flow:nodePropsError.loadFlowFailed"));const pe=await ee.json();if(!ee.ok)throw new Error(e("flow:nodePropsError.loadNodesFailed"));const we=Array.isArray(pe)?pe:Array.isArray(pe==null?void 0:pe.nodes)?pe.nodes:[],Fe=!Array.isArray(pe)&&(pe==null?void 0:pe.pipelineTranslations)||{},ce=p7(te.flowYaml||"");if(ce.error)throw new Error(ce.error);const Oe={...ce.instances||{}},Se=ce.nodes.map(cn=>ff(cn,Oe,we,Fe,x.id)),ht=OI(ce.edges,Se);return{flowSource:S,paletteList:we,instances:Oe,flowDescriptionText:ce.description??"",nodes:Se,edges:ht}},[t.language,e]),Us=m.useCallback(async(x,S={})=>{const H=!!S.preserveComposer,K=H&&!!S.incrementalSync;Ql.current=!1,kg.current+=1,p(x),b(""),H||(N(""),be(""),re(null),k(""),z(""),T(""),yo(""),an([]),Ot([]),jt([]),Zt(!1),dr(null),Di("pan")),K||(xn.current={},kt([]),ln([])),Sj(x);try{const q=await t0(x);if(Ne(q.paletteList),xn.current=q.instances,k(q.flowDescriptionText),z(x.id||""),K){const X=Hi.current,ee=Zl.current;try{const te=V9(X,ee,q.nodes,q.edges),pe=new Set([...te.changes.addedNodeIds,...te.changes.updatedNodeIds]),we=new Set([...te.changes.addedEdgeKeys,...te.changes.updatedEdgeKeys]),Fe=pe.size>0?te.nodes.map(Oe=>pe.has(Oe.id)?{...Oe,className:fj(Oe.className,uj)}:Oe):te.nodes,ce=we.size>0?te.edges.map(Oe=>we.has(af(Oe))?{...Oe,className:fj(Oe.className,dj)}:Oe):te.edges;kt(Fe),ln(ce),Bi.current!=null&&(clearTimeout(Bi.current),Bi.current=null),(pe.size>0||we.size>0)&&(Bi.current=window.setTimeout(()=>{Bi.current=null,pe.size>0&&kt(Oe=>Oe.map(Se=>{if(!pe.has(Se.id))return Se;const ht=pj(Se.className,uj);return ht===String(Se.className||"")?Se:{...Se,className:ht}})),we.size>0&&ln(Oe=>Oe.map(Se=>{if(!we.has(af(Se)))return Se;const ht=pj(Se.className,dj);return ht===String(Se.className||"")?Se:{...Se,className:ht}}))},kU))}catch{kt(q.nodes),ln(q.edges)}}else kt(q.nodes),ln(q.edges),g(X=>X+1);vp(x.id,q.flowSource),hg(X=>X+1),Xv(q.nodes,q.edges,{instances:q.instances});try{Bf.current=qN(q.nodes,q.edges,q.instances,{description:q.flowDescriptionText})}catch{Bf.current=""}Ql.current=!0}catch(q){b(String(q.message||q))}},[t0,Xv,kt,ln]),Kf=m.useCallback(async()=>{if(!(c!=null&&c.id))return;const x=c.source??"user",S=new URLSearchParams({flowId:c.id,flowSource:x});c.archived&&S.set("archived","1"),S.set("lang",String(t.language||"zh").startsWith("zh")?"zh":"en");const H=await fetch("/api/nodes?"+S.toString()),K=await H.json();if(!H.ok)throw new Error((K==null?void 0:K.error)||e("flow:nodePropsError.loadNodesFailed"));const q=Array.isArray(K)?K:Array.isArray(K==null?void 0:K.nodes)?K.nodes:[];Ne(q)},[c,e,t.language]),Cg=m.useCallback(async()=>{cr(!0),Wn("");try{const x=await fetch("/api/marketplace/nodes"),S=await x.json().catch(()=>({}));if(!x.ok)throw new Error((S==null?void 0:S.error)||"Failed to load marketplace nodes");In(Array.isArray(S==null?void 0:S.nodes)?S.nodes:[])}catch(x){Wn(String(x.message||x)),In([])}finally{cr(!1)}},[]),qf=m.useCallback(async()=>{Be(!0),Gt("");try{const x=await fetch("/api/marketplace/flow-snippets"),S=await x.json().catch(()=>({}));if(!x.ok)throw new Error((S==null?void 0:S.error)||"Failed to load flow snippets");Je(Array.isArray(S==null?void 0:S.snippets)?S.snippets:[])}catch(x){Gt(String(x.message||x)),Je([])}finally{Be(!1)}},[]);m.useEffect(()=>{c&&(Cg(),qf())},[c==null?void 0:c.id,c==null?void 0:c.source,c==null?void 0:c.archived,Cg,qf]);const o2=m.useCallback(async x=>{if(!c||!x)return;const S=x.definitionId||`marketplace:${x.id}${x.version?`@${x.version}`:""}`;if(S){br(S),Wn("");try{const H=await fetch("/api/marketplace/install-node",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:c.id,flowSource:c.source||"user",archived:!!c.archived,nodeSpec:S})}),K=await H.json().catch(()=>({}));if(!H.ok||(K==null?void 0:K.ok)===!1)throw new Error((K==null?void 0:K.error)||"Failed to install marketplace node");await Kf()}catch(H){Wn(String(H.message||H))}finally{br("")}}},[c,Kf]),a2=m.useCallback(async(x,S)=>{const H={packageId:(x==null?void 0:x.newId)||(x==null?void 0:x.id)||(x==null?void 0:x.label),label:(x==null?void 0:x.label)||(x==null?void 0:x.newId)||(x==null?void 0:x.id),version:"1.0.0",definitionId:S,body:(x==null?void 0:x.body)||"",script:(x==null?void 0:x.script)||"",inputs:Array.isArray(x==null?void 0:x.inputs)?x.inputs:[],outputs:Array.isArray(x==null?void 0:x.outputs)?x.outputs:[],flowId:c==null?void 0:c.id,flowSource:(c==null?void 0:c.source)||"user"},K=await fetch("/api/marketplace/publish-node-from-instance",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(H)}),q=await K.json();if(!K.ok||(q==null?void 0:q.ok)===!1)throw new Error((q==null?void 0:q.error)||"Publish failed");return await Kf(),q},[Kf,c]),n0=m.useCallback(async()=>{var K;if(!c||me.current)return;const x=c.id,S=c.source??"user",H=((K=Go.current)==null?void 0:K.id)??null;me.current=!0,de(!0);try{await Us({id:x,source:S,archived:c.archived},{preserveComposer:!0,incrementalSync:!0}),H&&kt(q=>q.map(X=>({...X,selected:X.id===H})))}finally{me.current=!1,de(!1)}},[c,c==null?void 0:c.archived,Us,kt]);m.useEffect(()=>{if(zi.current||l.length===0)return;const x=new URLSearchParams(window.location.search),S=x.get("flowId");if(!S)return;const H=x.get("flowSource")??"user",K=x.get("flowArchived")==="1",q=l.find(X=>X.id===S&&(X.source??"user")===H&&!!X.archived===K);q&&(zi.current=!0,Us(q))},[l,Us]);const Yf=m.useRef(0);m.useEffect(()=>{if(!c)return;const x=c.id,S=c.source??"user",H=!!c.archived;Yf.current=0;let K=!1;const q=async()=>{var te;if(K)return;const ee=new URLSearchParams({flowId:x,flowSource:S,v:String(Yf.current)});H&&ee.set("archived","1");try{const pe=await fetch("/api/flow-editor-sync-poll?"+ee.toString());if(!pe.ok||K)return;const we=await pe.json();if(K)return;if(we.changed){Yf.current=we.version;const Fe=((te=Go.current)==null?void 0:te.id)??null;await Us({id:x,source:S,archived:H},{preserveComposer:!0,incrementalSync:!0}),await ea({id:x,source:S,archived:H},{quiet:!0,force:!0}),Fe&&kt(ce=>ce.map(Oe=>({...Oe,selected:Oe.id===Fe})))}else Yf.current=we.version}catch{}},X=window.setInterval(q,2e3);return q(),()=>{K=!0,window.clearInterval(X)}},[c==null?void 0:c.id,c==null?void 0:c.source,c==null?void 0:c.archived,Us,ea,kt]);const l2=m.useMemo(()=>w?w.startsWith(e("flow:status.saveFailed"))?" af-palette-tip--error":w===e("flow:status.saved")?" af-palette-tip--success":" af-palette-tip--info":"",[w]);m.useEffect(()=>{if(!w)return;w===e("flow:status.saved")||w.startsWith(e("flow:status.runInTerminal"));const x=w.startsWith(e("flow:status.runInTerminal"))?5200:2800,S=window.setTimeout(()=>N(""),x);return()=>clearTimeout(S)},[w,e]),m.useEffect(()=>{j("")},[c==null?void 0:c.id,c==null?void 0:c.source]),m.useEffect(()=>{const x=()=>{window.__provideEditContent&&(Kl(window.__provideEditContent),window.__provideEditContent=null)};return window.addEventListener("provide-expand",x),()=>window.removeEventListener("provide-expand",x)},[]),m.useEffect(()=>{var te,pe,we,Fe,ce,Oe,Se;if(!dt){ju(null);return}const x=xn.current[dt.id]||{},{inputs:S,outputs:H}=LI(dt),K=String(((te=dt.data)==null?void 0:te.definitionId)??dt.id??""),q=((pe=dt.data)==null?void 0:pe.script)!=null?String(dt.data.script):void 0,X=x.script!=null?String(x.script):void 0,ee=K==="tool_nodejs"||q&&q.trim()!==""||X&&X.trim()!==""?String(q??X??""):"";ju({id:dt.id,newId:dt.id,label:String(((we=dt.data)==null?void 0:we.label)??dt.id),role:((Fe=dt.data)==null?void 0:Fe.role)??"普通",model:String(((ce=dt.data)==null?void 0:ce.model)??x.model??""),body:String(((Oe=dt.data)==null?void 0:Oe.body)??x.body??""),images:ds(((Se=dt.data)==null?void 0:Se.images)??x.images),script:ee,inputs:S,outputs:H})},[dt==null?void 0:dt.id,el]),m.useEffect(()=>{c&&(dt||(Yl.current=null,re(x=>x==="node"?null:x)))},[c,dt==null?void 0:dt.id]);const Gf=m.useCallback(()=>{Yl.current=null,re(x=>x==="settings"||x==="history"?x:"node")},[]),c2=m.useCallback((x,S)=>{x.metaKey||x.ctrlKey||x.shiftKey||Re!=="edit"&&Tr((S==null?void 0:S.id)??null)},[Re]),u2=m.useCallback((x,S)=>{Re==="edit"&&(x.preventDefault(),kt(H=>H.map(K=>({...K,selected:K.id===S.id}))),ln(H=>H.map(K=>({...K,selected:!1}))),Gf())},[Gf,Re,ln,kt]),d2=m.useCallback((x,S)=>{if(Re!=="edit")return;const H=x.metaKey||x.ctrlKey||x.shiftKey;ln(K=>K.map(q=>q.id===S.id?{...q,selected:!q.selected||!H}:H?q:{...q,selected:!1})),H||kt(K=>K.map(q=>({...q,selected:!1})))},[Re,ln,kt]),f2=m.useCallback(x=>gj(x,Hi.current),[]),p2=m.useCallback(x=>{if(!gj(x,Hi.current)){N("端口类型不匹配,已取消连线");return}bo(null),kt(S=>dm(S,x)),ln(S=>{const H=S.filter(K=>!(K.target===x.target&&K.targetHandle===x.targetHandle));return rf({...x,markerEnd:{type:gs.ArrowClosed}},H)})},[ln,kt]),h2=m.useCallback((x,S)=>{Sg.current=EU(S,Hi.current),bo(null)},[]),m2=m.useCallback((x,S)=>{var Se,ht,cn,un;const H=Sg.current;if(Sg.current=null,!c||!H||S!=null&&S.toNode)return;const K=PU(ae,H);if(K.length===0){N(`没有匹配 ${H.slotType} 端口的节点`);return}const q=((ht=(Se=x==null?void 0:x.changedTouches)==null?void 0:Se[0])==null?void 0:ht.clientX)??(x==null?void 0:x.clientX),X=((un=(cn=x==null?void 0:x.changedTouches)==null?void 0:cn[0])==null?void 0:un.clientY)??(x==null?void 0:x.clientY);if(!Number.isFinite(q)||!Number.isFinite(X))return;const ee=wo.current,te=document.querySelector(".af-pipeline-flow .react-flow");if(!ee||!te)return;const pe=te.getBoundingClientRect(),we=320,Fe=Math.min(440,104+K.length*58),ce=Math.max(12,Math.min(q-pe.left,pe.width-we-12)),Oe=Math.max(12,Math.min(X-pe.top,pe.height-Fe-12));bo({left:ce,top:Oe,flowPosition:ee.screenToFlowPosition({x:q,y:X}),draft:H,candidates:K,query:""})},[ae,c]),g2=m.useCallback(x=>{for(const S of x)delete xn.current[S.id]},[]),y2=m.useCallback(x=>{wo.current=x},[]),x2=m.useCallback(x=>{kt(H=>H.map(K=>({...K,selected:K.id===x}))),ln(H=>H.map(K=>({...K,selected:!1}))),Gf();const S=()=>{var pe,we,Fe;const H=wo.current;if(!(H!=null&&H.getNode))return;const K=H.getNode(x);if(!K)return;const q=(pe=H.getInternalNode)==null?void 0:pe.call(H,x),X=((we=q==null?void 0:q.measured)==null?void 0:we.width)??(q==null?void 0:q.width)??K.width??200,ee=((Fe=q==null?void 0:q.measured)==null?void 0:Fe.height)??(q==null?void 0:q.height)??K.height??88,{zoom:te}=H.getViewport();H.setCenter(K.position.x+X/2,K.position.y+ee/2,{zoom:bj(te),duration:220})};requestAnimationFrame(()=>requestAnimationFrame(S))},[kt,ln,Gf]),w2=m.useCallback(x=>{kt(H=>H.map(K=>({...K,selected:K.id===x}))),ln(H=>H.map(K=>({...K,selected:!1})));const S=()=>{var we,Fe,ce;const H=wo.current;if(!(H!=null&&H.getNode))return;const K=H.getNode(x);if(!K)return;const q=(we=H.getInternalNode)==null?void 0:we.call(H,x),X=((Fe=q==null?void 0:q.measured)==null?void 0:Fe.width)??(q==null?void 0:q.width)??K.width??200,ee=((ce=q==null?void 0:q.measured)==null?void 0:ce.height)??(q==null?void 0:q.height)??K.height??88,{zoom:te}=H.getViewport(),pe=bj(te);H.setCenter(K.position.x+X/2,K.position.y+ee/2,{zoom:pe,duration:260})};requestAnimationFrame(()=>requestAnimationFrame(S))},[kt,ln]),tc=m.useCallback((x,S)=>{const H=`node-${Date.now()}`;return QI(x,H,S,xn.current,ae)},[ae]),r0=m.useCallback(x=>{if(!c||!x)return;let S={x:180,y:160};const H=wo.current,K=document.querySelector(".af-pipeline-flow .react-flow");if(H&&K){const q=K.getBoundingClientRect();S=H.screenToFlowPosition({x:q.left+q.width*.45,y:q.top+q.height*.38})}kt(q=>[...q,tc(x,S)])},[c,kt,tc]),b2=m.useCallback(x=>{const S=Gv.current;if(!c||!S||!(x!=null&&x.def))return;const H=tc(x.def,S.flowPosition),K=S.draft.handleType==="source"?{source:S.draft.nodeId,sourceHandle:S.draft.handleId,target:H.id,targetHandle:`input-${x.slotIndex}`}:{source:H.id,sourceHandle:`output-${x.slotIndex}`,target:S.draft.nodeId,targetHandle:S.draft.handleId};kt(q=>dm([...q,H],K)),ln(q=>{const X=q.filter(ee=>!(ee.target===K.target&&ee.targetHandle===K.targetHandle));return rf({...K,markerEnd:{type:gs.ArrowClosed}},X)}),bo(null)},[c,tc,kt,ln]),v2=m.useCallback(x=>{x.preventDefault(),x.dataTransfer.dropEffect="move"},[]),k2=m.useCallback(x=>{var ee;if(x.preventDefault(),!c)return;const S=wo.current;if(!S)return;const H=S.screenToFlowPosition({x:x.clientX,y:x.clientY}),K=x.dataTransfer.getData("application/agentflow-snippet");if(K){const te=st.find(pe=>`${pe.id}@${pe.version}`===K);te&&((ee=Hf.current)==null||ee.call(Hf,te,H));return}const q=x.dataTransfer.getData("application/agentflow-node");if(!q)return;const X=ae.find(te=>te.id===q);X&&kt(te=>[...te,tc(X,H)])},[c,ae,st,kt,tc]),Vi=m.useCallback(async(x,S)=>{if(!c)return;const H=qN(x,S,xn.current,{description:v});if(H!==Bf.current){N(e("flow:status.saving"));try{const K=qU(c.source),q=await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:c.id,flowSource:K,flowYaml:H,...c.archived?{flowArchived:!0}:{}})}),X=await q.json();if(!q.ok||!X.success)throw new Error(X.error||e("flow:status.saveFailed"));if(Bf.current=H,N(e("flow:status.saved")),Ks(c.source)&&K==="workspace"){const ee={id:c.id,source:"workspace",path:void 0};p(ee),Sj(ee),vp(c.id,"workspace")}}catch(K){N(e("flow:status.saveFailed")+": "+(K.message||K))}}},[c,v]);m.useEffect(()=>{if(!c||!Ql.current||Re!=="edit"||c.archived)return;const x=kg.current,S=setTimeout(()=>{x===kg.current&&Ql.current&&Vi(Hi.current,Zl.current)},400);return()=>clearTimeout(S)},[Pt,Cn,v,Re,c,Vi]);const Xf=m.useCallback(async x=>{if(!c||c.archived)return;const S=c.source??"user";if(!(S!=="user"&&S!=="workspace")&&S!==x){D(!0),j("");try{const H=await fetch("/api/flow/move",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:c.id,fromSource:S,toSource:x})}),K=await H.json().catch(()=>({}));if(!H.ok)throw new Error(typeof K.error=="string"?K.error:e("flow:composer.requestFailed"));const q=K.flowSource==="workspace"||K.flowSource==="user"?K.flowSource:x;let X={id:c.id,source:q,archived:c.archived};try{const ee=await fetch("/api/flows");if(ee.ok){const te=await ee.json(),pe=Array.isArray(te)?te.find(we=>we.id===c.id&&(we.source??"user")===q&&!!we.archived==!!c.archived):null;pe&&(X=pe)}}catch{}await Us(X,{preserveComposer:!0}),vp(c.id,q)}catch(H){j(String(H.message||H))}finally{D(!1)}}},[c,Us]),Eg=m.useCallback(async()=>{if(c){ze(!0),Vo(""),rr("");try{const x=await fetch("/api/flow/schedule",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:c.id,flowSource:c.source||"user",archived:!!c.archived,schedule:nr})}),S=await x.json().catch(()=>({}));if(!x.ok||!S.success)throw new Error(S.error||"Failed to save schedule");Jr({...Xu,...S.schedule||{}}),rr(e("flow:schedule.saved")),await ea(c,{quiet:!0,force:!0})}catch(x){Vo(String(x.message||x))}finally{ze(!1)}}},[c,nr,ea,e]),S2=m.useCallback(async()=>{c&&(await Vi(Hi.current,Zl.current),!c.archived&&c.source!=="builtin"&&await Eg())},[c,Vi,Eg]),Jf=m.useCallback(async()=>{if(!c||!M.trim())return;const x=M.trim();if(x===c.id){T("");return}A(!0),T("");try{const S=await fetch("/api/flow/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:c.id,flowSource:c.source??"user",newFlowId:x})}),H=await S.json().catch(()=>({}));if(!S.ok)throw new Error(typeof H.error=="string"?H.error:e("flow:composer.requestFailed"));let K={id:H.flowId,source:H.flowSource??c.source,archived:c.archived};try{const q=await fetch("/api/flows");if(q.ok){const X=await q.json(),ee=Array.isArray(X)?X.find(te=>te.id===H.flowId&&(te.source??"user")===(H.flowSource??c.source)):null;ee&&(K=ee)}}catch{}await Us(K,{preserveComposer:!0}),vp(H.flowId,H.flowSource??c.source)}catch(S){T(String(S.message||S))}finally{A(!1)}},[c,M,Us]),s0=m.useCallback(x=>{navigator.clipboard.writeText(x).then(()=>{I(!0),setTimeout(()=>I(!1),2e3)}).catch(()=>{})},[]),_g=m.useCallback(()=>{Vi(Pt,Cn)},[Vi,Pt,Cn]),N2=m.useCallback((x,S)=>{const H=S.trim()===""||S==="default"?void 0:S.trim(),K=Pt.map(q=>q.id===x?{...q,data:{...q.data,model:H}}:q);kt(K),Vi(K,Cn)},[Pt,Cn,kt,Vi]),Qf=m.useCallback(()=>{var ht,cn;if(!St||!c||!dt)return!1;const x=dt.id,S=St.newId.trim();if(Gl(""),!VI.test(S))return Gl(e("flow:nodePropsError.invalidInstanceId")),!1;if(Pt.some(un=>un.id===S&&un.id!==x))return Gl(e("flow:nodePropsError.duplicateInstanceId")),!1;const H=St.role.trim(),K=La.includes(H)?H:"普通",q=St.model.trim(),X=un=>(Array.isArray(un)?un:[]).map(Ft=>({type:String((Ft==null?void 0:Ft.type)??"节点").trim()||"节点",name:String((Ft==null?void 0:Ft.name)??""),default:String((Ft==null?void 0:Ft.default)??""),required:!!(Ft!=null&&Ft.required),showOnNode:(Ft==null?void 0:Ft.showOnNode)!=null?Ft.showOnNode!==!1:!!(Ft!=null&&Ft.required)||String((Ft==null?void 0:Ft.type)??"节点").trim().toLowerCase()==="node"})),ee=X(St.inputs),te=X(St.outputs),pe=String(((ht=dt.data)==null?void 0:ht.definitionId)??S),we=pe.startsWith("provide_"),Fe={...dt.data,label:St.label.trim()||S,role:K,model:q===""||q==="default"?void 0:q,body:we?"":St.body,images:we?[]:ds(St.images),inputs:ee,outputs:we&&Array.isArray((cn=dt.data)==null?void 0:cn.outputs)?dt.data.outputs:te},ce=String(St.script??"").trim();pe==="tool_nodejs"||ce!==""?Fe.script=String(St.script??""):delete Fe.script;let Oe,Se=Cn;if(S!==x){const un={...xn.current},Ft={...un[x]||{}};delete un[x],un[S]=Ft,xn.current=un,Oe=Pt.map(bt=>bt.id!==x?bt:{...bt,id:S,selected:!0,data:Fe}),Se=Cn.map((bt,Yt)=>({...bt,source:bt.source===x?S:bt.source,target:bt.target===x?S:bt.target,id:`e-${bt.source===x?S:bt.source}-${bt.target===x?S:bt.target}-${Yt}`}))}else Oe=Pt.map(un=>un.id===x?{...un,data:Fe}:un);return kt(Oe),ln(Se),bs(S),Vi(Oe,Se),!0},[St,c,dt,Pt,Cn,kt,ln,bs,Vi]),Pg=m.useCallback(()=>{var cn,un;if(!St||!c||!dt)return!1;const x=dt.id,S=St.role.trim(),H=La.includes(S)?S:"普通",K=St.model.trim(),q=Ft=>(Array.isArray(Ft)?Ft:[]).map(bt=>({type:String((bt==null?void 0:bt.type)??"节点").trim()||"节点",name:String((bt==null?void 0:bt.name)??""),default:String((bt==null?void 0:bt.default)??""),required:!!(bt!=null&&bt.required),showOnNode:(bt==null?void 0:bt.showOnNode)!=null?bt.showOnNode!==!1:!!(bt!=null&&bt.required)||String((bt==null?void 0:bt.type)??"节点").trim().toLowerCase()==="node"})),X=q(St.inputs),ee=q(St.outputs),te=String(((cn=dt.data)==null?void 0:cn.definitionId)??x),pe=te.startsWith("provide_"),we=St.label.trim()||x,Fe=K===""||K==="default"?void 0:K,ce={...dt.data,label:we,role:H,model:Fe,body:pe?"":St.body,images:pe?[]:ds(St.images),inputs:X,outputs:pe&&Array.isArray((un=dt.data)==null?void 0:un.outputs)?dt.data.outputs:ee},Oe=String(St.script??"").trim();te==="tool_nodejs"||Oe!==""?ce.script=String(St.script??""):delete ce.script;const Se=dt.data||{};return(Se.label!==ce.label||Se.role!==ce.role||Se.model!==ce.model||Se.body!==ce.body||JSON.stringify(ds(Se.images))!==JSON.stringify(ce.images)||(Se.script??void 0)!==(ce.script??void 0)||JSON.stringify(Se.inputs||[])!==JSON.stringify(X)||JSON.stringify(Se.outputs||[])!==JSON.stringify(ee))&&(kt(Ft=>Ft.map(bt=>bt.id===x?{...bt,data:ce}:bt)),bs(x)),!0},[St,c,dt,kt,bs]),i0=m.useRef(Pg);m.useEffect(()=>{i0.current=Pg},[Pg]),m.useEffect(()=>{if(!St||!c||!Ql.current||Re!=="edit")return;const x=setTimeout(()=>{i0.current()},400);return()=>clearTimeout(x)},[St,c,Re]);const j2=m.useCallback(()=>{if(!(!St||!dt)){if(St.newId.trim()===dt.id){Gl("");return}Qf()}},[St,dt,Qf]);m.useEffect(()=>{const x=S=>{var ee,te,pe;if(Re!=="edit")return;const H=FI(S.target);if((S.metaKey||S.ctrlKey)&&S.key.toLowerCase()==="s"){if(Qe==="node"&&dt&&St){S.preventDefault(),S.stopPropagation(),Qf()||_g();return}if(H)return;S.preventDefault(),S.stopPropagation(),_g();return}if((S.metaKey||S.ctrlKey)&&S.key.toLowerCase()==="k"){S.preventDefault(),S.stopPropagation(),ql(we=>!we);return}if(Nu)return;if(qn){if(S.key==="Escape"){S.preventDefault(),Fi(!1);return}if(pm(S)&&!S.metaKey&&!S.ctrlKey&&!S.altKey){S.preventDefault(),Fi(!1);return}(S.key==="v"||S.key==="V"||S.key==="h"||S.key==="H")&&!S.metaKey&&!S.ctrlKey&&!S.altKey&&S.preventDefault();return}if(H)return;const K=S.key.toLowerCase(),q=(S.metaKey||S.ctrlKey)&&!S.shiftKey&&K==="z",X=(S.metaKey||S.ctrlKey)&&(S.shiftKey&&K==="z"||K==="y");if(q||X){S.preventDefault(),S.stopPropagation();const we=q?Jv():Qv();N(we?q?"Undo canvas change":"Redo canvas change":q?"Nothing to undo":"Nothing to redo");return}if((S.metaKey||S.ctrlKey)&&S.key.toLowerCase()==="c"){const we=AI(Hi.current,Zl.current,xn.current);we&&(S.preventDefault(),S.stopPropagation(),Yv.current=we,N(`Copied ${we.nodes.length} node${we.nodes.length>1?"s":""}`));return}if((S.metaKey||S.ctrlKey)&&S.key.toLowerCase()==="v"){const we=II(Yv.current,Hi.current,Zl.current,xn.current);we&&(S.preventDefault(),S.stopPropagation(),xn.current=we.instances,kt(we.nodes),ln(we.edges),N(`Pasted ${we.pastedNodeIds.length} node${we.pastedNodeIds.length>1?"s":""}`));return}if((S.key==="a"||S.key==="A")&&!S.metaKey&&!S.ctrlKey&&!S.altKey){S.preventDefault(),S.stopPropagation(),(ee=nt.current)==null||ee.focus(),(pe=(te=nt.current)==null?void 0:te.select)==null||pe.call(te);return}if((S.metaKey||S.ctrlKey)&&S.key.toLowerCase()==="a"){S.preventDefault(),S.stopPropagation(),kt(we=>we.map(Fe=>({...Fe,selected:!0}))),ln(we=>we.map(Fe=>({...Fe,selected:!1})));return}if(pm(S)&&!S.metaKey&&!S.ctrlKey&&!S.altKey){S.preventDefault(),Fi(we=>!we);return}if((S.key==="v"||S.key==="V")&&!S.metaKey&&!S.ctrlKey&&!S.altKey){S.preventDefault(),Di("select");return}if((S.key==="h"||S.key==="H")&&!S.metaKey&&!S.ctrlKey&&!S.altKey){S.preventDefault(),Di("pan");return}};return window.addEventListener("keydown",x,!0),()=>window.removeEventListener("keydown",x,!0)},[_g,qn,Nu,Qe,dt,St,Qf,Re,Jv,Qv]),m.useEffect(()=>{if(Re!=="running"||Kt==null)return;let x=Math.floor((Date.now()-Kt)/1e3);const S=setInterval(()=>{const H=Date.now()-Kt,K=Math.floor(H/1e3);K!==x&&(x=K,Ye(H))},500);return()=>clearInterval(S)},[Re,Kt]),m.useEffect(()=>{const x=Va.current;!x||!x.parentElement||Hl.current&&(Bs.current=!0,x.scrollIntoView({behavior:"auto",block:"end"}),requestAnimationFrame(()=>{Bs.current=!1}))},[er]),m.useEffect(()=>{const x=Va.current;if(!x)return;const S=x.parentElement;if(!S)return;const H=()=>{if(Bs.current)return;const K=S.scrollHeight-S.scrollTop-S.clientHeight;Hl.current=K<40};return S.addEventListener("scroll",H,{passive:!0}),()=>S.removeEventListener("scroll",H)},[tr,Re]),m.useEffect(()=>{if(Re==="edit"||!tr)return;Hl.current=!0;const x=Va.current;x&&(Bs.current=!0,x.scrollIntoView({behavior:"auto",block:"end"}),requestAnimationFrame(()=>{Bs.current=!1}))},[Re,tr]),m.useEffect(()=>{er.length>mh+vj&>(x=>x.length>mh+vj?x.slice(-mh):x)},[er]);const C2=m.useCallback(x=>{if(x.button!==0)return;x.preventDefault();const S=x.currentTarget;si.current={active:!0,pointerId:x.pointerId,startY:x.clientY,startH:ri},S.setPointerCapture(x.pointerId)},[ri]),E2=m.useCallback(x=>{const S=si.current;if(!S.active||x.pointerId!==S.pointerId)return;const H=S.startY-x.clientY;zs(gh(S.startH+H))},[]),Zf=m.useCallback(()=>{zs(x=>{const S=gh(x);try{localStorage.setItem(ZI,String(S))}catch{}return S})},[]),o0=m.useCallback(x=>{const S=si.current;if(!(!S.active||x.pointerId!==S.pointerId)){S.active=!1;try{x.currentTarget.releasePointerCapture(x.pointerId)}catch{}Zf()}},[Zf]),_2=m.useCallback(()=>{const x=si.current;x.active&&(x.active=!1,Zf())},[Zf]);m.useEffect(()=>{function x(){zs(S=>gh(S))}return window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[]);const Ui=m.useCallback(async(x={})=>{if(!c)return;const S=x.runUuid!=null&&String(x.runUuid).trim()?String(x.runUuid).trim():null,H=x.cliInputsOverride??fe.current,K=!!x.prepareOnly;if(Qt(K?"ready":"running"),gt(K?[]:[{ts:new Date().toISOString(),type:"info",text:S?e("flow:run.connectingApiResume",{uuid:S}):e("flow:run.connectingApi")}]),Mn(new Set),at({}),Br(!K),re(null),S||Ns(null),K)return;if(!S){const X=Date.now();Ht(X),Ye(0)}const q=new AbortController;ai.current=q;try{const X=await fetch("/api/flow/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:c.id,flowSource:c.source||"user",...S?{uuid:S}:{},cliInputs:H}),signal:q.signal});if(!X.ok){const ce=await X.json().catch(()=>({error:e("flow:composer.requestFailed")}));gt(Oe=>[...Oe,{ts:new Date().toISOString(),type:"error",text:ce.error||e("flow:composer.requestFailed")}]),Qt("error");return}if(gt(ce=>[...ce,{ts:new Date().toISOString(),type:"info",text:e("flow:run.connectedReceiving")}]),!X.body){gt(ce=>[...ce,{ts:new Date().toISOString(),type:"error",text:e("flow:run.noBody")}]),Qt("error");return}const ee=X.body.getReader(),te=new TextDecoder;let pe="";const we=ce=>{const Oe=ce.ts||new Date().toISOString();if(ce.type==="event")if(ce.event==="node-start")Mn(Se=>new Set(Se).add(ce.instanceId)),at(Se=>({...Se,[ce.instanceId]:{status:"running",startMs:Date.now()}})),gt(Se=>[...Se,{ts:Oe,type:"node-start",text:ce.label?e("flow:run.nodeStartWithLabel",{instanceId:ce.instanceId,label:ce.label}):e("flow:run.nodeStart",{instanceId:ce.instanceId})}]);else if(ce.event==="node-done"){Mn(ht=>{const cn=new Set(ht);return cn.delete(ce.instanceId),cn});const Se=ce.elapsed??null;at(ht=>({...ht,[ce.instanceId]:{status:"success",elapsed:Se}})),gt(ht=>[...ht,{ts:Oe,type:"node-done",text:Se?e("flow:run.nodeDoneWithElapsed",{instanceId:ce.instanceId,elapsed:Se}):e("flow:run.nodeDone",{instanceId:ce.instanceId})}])}else if(ce.event==="node-failed")Mn(Se=>{const ht=new Set(Se);return ht.delete(ce.instanceId),ht}),at(Se=>({...Se,[ce.instanceId]:{status:"failed",elapsed:ce.elapsed??null}})),gt(Se=>[...Se,{ts:Oe,type:"node-failed",text:e("flow:run.nodeFailed",{instanceId:ce.instanceId})}]);else if(ce.event==="apply-start"){if(ce.uuid&&Ns(String(ce.uuid)),typeof ce.runStartTime=="number"&&ce.runStartTime>0)Ht(ce.runStartTime),Ye(Math.max(0,Date.now()-ce.runStartTime));else if(typeof ce.totalExecutedMs=="number"&&ce.totalExecutedMs>0){const Se=Date.now()-ce.totalExecutedMs;Ht(Se),Ye(ce.totalExecutedMs)}gt(Se=>[...Se,{ts:Oe,type:"info",text:e("flow:run.pipelineStart",{uuid:ce.uuid||"?"})}])}else ce.event==="apply-done"?gt(Se=>[...Se,{ts:Oe,type:"info",text:ce.totalElapsed?e("flow:run.pipelineDoneWithElapsed",{elapsed:ce.totalElapsed}):e("flow:run.pipelineDone")}]):ce.event==="apply-paused"?gt(Se=>[...Se,{ts:Oe,type:"warn",text:e("flow:run.pipelinePaused",{nodes:(ce.pendingNodes||[]).join(", ")})}]):gt(Se=>[...Se,{ts:Oe,type:"event",text:`[${ce.event}] ${JSON.stringify(ce)}`}]);else ce.type==="user-check-content"?(Ua({instanceId:ce.instanceId,execId:ce.execId??1,inputPath:ce.inputPath,outputPath:ce.outputPath,content:ce.content||""}),Ka(ce.content||""),Li(!1),Ga(""),Xa(!1),gt(Se=>[...Se,{ts:Oe,type:"user-check",text:e("flow:run.userCheckContent",{instanceId:ce.instanceId})}])):ce.type==="user-ask-prompt"?(Vl({instanceId:ce.instanceId,execId:ce.execId??1,question:ce.question||"",options:Array.isArray(ce.options)?ce.options:[]}),qo(!1),gt(Se=>[...Se,{ts:Oe,type:"user-ask",text:e("flow:run.userAskPrompt",{instanceId:ce.instanceId,defaultValue:`等待用户选择 (${ce.instanceId})`})}])):ce.type==="tool-print-content"?(ku({instanceId:ce.instanceId,execId:ce.execId??1,content:ce.content||"",createdAt:Date.now()}),Lt(!1)):ce.type==="log"?gt(Se=>[...Se,{ts:Oe,type:"log",text:ce.text!=null?String(ce.text):""}]):ce.type==="error"?gt(Se=>[...Se,{ts:Oe,type:"error",text:ce.message||e("flow:run.unknownError")}]):ce.type==="done"?gt(Se=>[...Se,{ts:Oe,type:"done",text:e("flow:run.executionEnd",{exitCode:ce.exitCode??"?"})}]):gt(Se=>[...Se,{ts:Oe,type:"log",text:JSON.stringify(ce)}])},Fe=ce=>{if(ce.trim())try{we(JSON.parse(ce))}catch{gt(Oe=>[...Oe,{ts:new Date().toISOString(),type:"log",text:ce}])}};for(;;){const{done:ce,value:Oe}=await ee.read();pe+=te.decode(Oe??new Uint8Array,{stream:!ce});const Se=pe.split(`
|
|
133
|
+
`);pe=Se.pop()??"";for(const ht of Se)Fe(ht);if(ce)break}pe.trim()&&Fe(pe),Qt("done")}catch(X){X.name==="AbortError"?(gt(ee=>[...ee,{ts:new Date().toISOString(),type:"warn",text:e("flow:run.executionStopped")}]),Qt("stopped")):(gt(ee=>[...ee,{ts:new Date().toISOString(),type:"error",text:X.message||e("flow:run.unknownError")}]),Qt("error"))}finally{ai.current=null,Mn(new Set)}},[c]),[P2,Ag]=m.useState(!1),A2=m.useCallback(()=>{Ag(!0)},[]),I2=m.useCallback(async()=>{if(Ag(!1),ai.current&&(ai.current.abort(),ai.current=null),c)try{await fetch("/api/flow/run/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:c.id,flowSource:c.source||"user"})})}catch{}Qt("stopped"),Mn(new Set)},[c]),il=m.useCallback(()=>{Qt("edit"),Mn(new Set),at({}),Tr(null),Ns(null)},[]),[T2,ep]=m.useState(!1),R2=m.useCallback(async()=>{if(ep(!1),ai.current&&(ai.current.abort(),ai.current=null),c)try{await fetch("/api/flow/run/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:c.id,flowSource:c.source||"user"})})}catch{}il()},[c,il]),L2=m.useCallback(()=>{ep(!1),n("/projects")},[n]),O2=m.useCallback(x=>{const S=x.runId!=null&&String(x.runId).trim()?String(x.runId).trim():null,H=x.flowId!=null&&String(x.flowId).trim()?String(x.flowId).trim():(c==null?void 0:c.id)!=null?String(c.id):null;Ns(S);const K=x.status||"unknown";let q="stopped";K==="success"?q="done":K==="failed"?q="error":K==="running"?q="running":q="stopped",Qt(q);const X=typeof x.at=="number"?x.at:null;if(q==="running"&&X!=null?(Ht(X),Ye(Math.max(0,Date.now()-X))):X!=null&&typeof x.endedAt=="number"&&x.endedAt>X?(Ht(null),Ye(x.endedAt-X)):(Ht(null),Ye(Math.max(0,x.durationMs??0))),gt([]),Mn(new Set),at({}),Tr(null),re(null),Br(!1),S&&H){const ee=new URLSearchParams({flowId:H,runId:S});fetch(`/api/run-node-statuses?${ee}`).then(te=>te.json()).then(te=>{const pe=te.statuses&&typeof te.statuses=="object"?te.statuses:{},we={};for(const[Fe,ce]of Object.entries(pe))ce&&typeof ce=="object"&&typeof ce.status=="string"&&(we[Fe]={status:ce.status,...ce.elapsed!=null&&String(ce.elapsed).trim()!==""?{elapsed:String(ce.elapsed)}:{}});at(we)}).catch(()=>{})}},[c==null?void 0:c.id]);m.useEffect(()=>{if(!(c!=null&&c.id)||Re!=="edit")return;let x=!1;return(async()=>{try{const S=await fetch("/api/pipeline-recent-runs"),H=await S.json();if(x||!S.ok)return;const q=(Array.isArray(H.runs)?H.runs:[]).find(te=>te.flowId===c.id&&te.status==="running");if(!q||x)return;const X=q.runId||null;Ns(X),Qt("running"),Br(!0),Ht(q.at||Date.now()),Fs.current=0;const ee=[{ts:new Date().toISOString(),type:"info",text:`[resume] 检测到活跃 run ${X},已恢复运行视图`}];if(X){const te=new URLSearchParams({flowId:c.id,runId:X}),we=await(await fetch(`/api/run-node-statuses?${te}`)).json();if(x)return;const Fe=we.statuses&&typeof we.statuses=="object"?we.statuses:{},ce={},Oe=new Set;for(const[Se,ht]of Object.entries(Fe))ht&&typeof ht=="object"&&typeof ht.status=="string"&&(ce[Se]={status:ht.status,...ht.elapsed!=null&&String(ht.elapsed).trim()!==""?{elapsed:String(ht.elapsed)}:{}},ht.status==="running"&&Oe.add(Se));at(ce),Mn(Oe);try{const Se=new URLSearchParams({flowId:c.id,runId:X,sinceBytes:"0",tailBytes:"262144"}),ht=await fetch(`/api/run-log?${Se}`);if(ht.ok){const cn=await ht.json();if(!x){Fs.current=Number(cn.bytes||0);const un=kj(typeof cn.text=="string"?cn.text:"");gt([...un,...ee]);return}}}catch{}}gt(ee)}catch{}})(),()=>{x=!0}},[c==null?void 0:c.id]),m.useEffect(()=>{if(Re==="edit"||!(c!=null&&c.id)||!tn)return;let x=!1,S=null;const H=async()=>{try{const K=new URLSearchParams({flowId:c.id,runId:tn}),q=await fetch(`/api/run-node-statuses?${K}`);if(!q.ok)return;const X=await q.json();if(x)return;const ee=X.statuses&&typeof X.statuses=="object"?X.statuses:{},te={},pe=new Set;for(const[we,Fe]of Object.entries(ee))Fe&&typeof Fe=="object"&&typeof Fe.status=="string"&&(te[we]={status:Fe.status,...Fe.elapsed!=null&&String(Fe.elapsed).trim()!==""?{elapsed:String(Fe.elapsed)}:{}},Fe.status==="running"&&pe.add(we));at(we=>VU(we,te)?we:te),Mn(we=>UU(we,pe)?we:pe);try{const we=new URLSearchParams({flowId:c.id,runId:tn,sinceBytes:String(Fs.current||0),tailBytes:String(zU)}),Fe=await fetch(`/api/run-log?${we}`);if(Fe.ok){const ce=await Fe.json();if(x)return;const Oe=Number(ce.bytes||0),Se=typeof ce.text=="string"?ce.text:"";if(Se){const ht=kj(Se);ht.length>0&>(cn=>[...cn,...ht])}Fs.current=Oe}}catch{}try{const we=await fetch("/api/pipeline-recent-runs");if(!we.ok)return;const Fe=await we.json();if(x)return;const Oe=(Array.isArray(Fe.runs)?Fe.runs:[]).find(Se=>Se.flowId===c.id&&Se.runId===tn);if(Oe&&Oe.status){const Se=Oe.status;Se==="running"?Qt(ht=>ht==="running"?ht:"running"):Se==="success"?Qt("done"):Se==="failed"?Qt("error"):(Se==="stopped"||Se==="interrupted")&&Qt("stopped")}}catch{}}catch{}};return H(),S=window.setInterval(H,2500),()=>{x=!0,S&&window.clearInterval(S)}},[Re,c==null?void 0:c.id,tn]),m.useEffect(()=>{if(Qe!=="history"||!c)return;let x=!1;return(async()=>{Gr(!0),Nn("");try{const S=await fetch("/api/pipeline-recent-runs"),H=await S.json();if(!S.ok)throw new Error(H.error||"HTTP "+S.status);x||et(Array.isArray(H.runs)?H.runs:[])}catch(S){x||(Nn(String(S.message||S)),et([]))}finally{x||Gr(!1)}})(),()=>{x=!0}},[Qe,c]),m.useEffect(()=>{if(!c){vs({files:[]});return}let x=!1;return(async()=>{mo(!0);try{const S=new URLSearchParams({flowId:c.id,flowSource:c.source||"user",archived:c.archived?"1":"0"}),H=await fetch(`/api/pipeline-files?${S}`),K=await H.json();if(!H.ok)throw new Error(K.error||"HTTP "+H.status);x||vs({files:Array.isArray(K.files)?K.files:[],path:K.path,error:K.error})}catch(S){x||vs({files:[],error:S.message||String(S)})}finally{x||mo(!1)}})(),()=>{x=!0}},[c]);const Tu=m.useMemo(()=>c?ke.filter(x=>x&&x.flowId===c.id).sort((x,S)=>S.at-x.at):[],[ke,c]),Hr=m.useMemo(()=>{let x=0,S=0,H=0,K=0,q=0;for(const X of Tu){const ee=X.status||"unknown";ee==="success"?x+=1:ee==="failed"?S+=1:ee==="running"?H+=1:ee==="stopped"?K+=1:ee==="interrupted"&&(q+=1)}return{success:x,failed:S,running:H,stopped:K,interrupted:q}},[Tu]),Ru=m.useMemo(()=>c?yj(es,$i):null,[c,es,$i]),di=m.useMemo(()=>{if(!Ru||!c)return[];const x=Ru.query.toLowerCase(),S=q=>x?q.some(X=>X&&String(X).toLowerCase().includes(x)):!0,H=Pt.map(q=>{var we,Fe;const X=q.id,ee=String(((we=q.data)==null?void 0:we.label)??X),te=(Fe=q.data)!=null&&Fe.definitionId?String(q.data.definitionId):"",pe=[ee!==X?ee:"",te&&te!==X?te:""].filter(Boolean);return{id:X,label:ee,defId:te,subs:pe}}).filter(({id:q,label:X,defId:ee})=>S([q,X,ee])).sort((q,X)=>q.id.localeCompare(X.id)).slice(0,18).map(({id:q,label:X,defId:ee})=>{const te=[X!==q?X:null,ee||null].filter(Boolean).join(" · ")||void 0;return{kind:"instance",id:q,title:q,subtitle:te}}),K=ae.filter(q=>q&&q.id&&S([q.id,q.label,q.description])).sort((q,X)=>q.id.localeCompare(X.id)).slice(0,22).map(q=>({kind:"definition",id:q.id,title:q.id,subtitle:q.label&&q.label!==q.id?String(q.label):String(q.type||"")}));return[...H,...K]},[Ru,Pt,ae,c]),Lu=m.useMemo(()=>{const x=di.filter(H=>H.kind==="instance"),S=di.filter(H=>H.kind==="definition");return{instances:x,definitions:S}},[di]);m.useEffect(()=>{Za(x=>{const S=Math.max(0,di.length-1);return Math.min(Math.max(0,x),S)})},[di]);const a0=m.useMemo(()=>IU(es),[es]),Cr=m.useMemo(()=>Pt.filter(x=>x.selected),[Pt]),Ig=m.useMemo(()=>new Set(Cr.map(x=>x.id)),[Cr]),tp=m.useMemo(()=>Cn.filter(x=>Ig.has(x.source)&&Ig.has(x.target)),[Cn,Ig]),l0=m.useMemo(()=>{const x=Pe.trim().toLowerCase();return x?st.filter(S=>[S.id,S.version,S.displayName,S.name,S.description,...Array.isArray(S.tags)?S.tags:[]].filter(Boolean).some(H=>String(H).toLowerCase().includes(x))):st},[st,Pe]),c0=m.useCallback((x,S)=>{const H=String(x||"snippet-node").trim().replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")||"snippet-node",K=Date.now().toString(36);let q=`${H}-${K}`,X=2;for(;S.has(q);)q=`${H}-${K}-${X}`,X+=1;return S.add(q),q},[]),u0=m.useCallback((x,S)=>{var Yt,Wr;if(!c||!x)return;const H=x.snippet&&typeof x.snippet=="object"?x.snippet:{},K=H.instances&&typeof H.instances=="object"?H.instances:{},q=Object.keys(K);if(q.length===0)return;const X=new Set(Hi.current.map(Ve=>Ve.id)),ee={};for(const Ve of q)ee[Ve]=c0(Ve,X);const te=(Yt=H.ui)!=null&&Yt.nodePositions&&typeof H.ui.nodePositions=="object"?H.ui.nodePositions:{},pe=(Wr=H.ui)!=null&&Wr.nodeSizes&&typeof H.ui.nodeSizes=="object"?H.ui.nodeSizes:{},we=q.map(Ve=>{const dn=te[Ve];return{id:Ve,x:typeof(dn==null?void 0:dn.x)=="number"?dn.x:0,y:typeof(dn==null?void 0:dn.y)=="number"?dn.y:0}}),Fe=Math.min(...we.map(Ve=>Ve.x)),ce=Math.min(...we.map(Ve=>Ve.y));let Oe=S||{x:180,y:160};const Se=wo.current,ht=document.querySelector(".af-pipeline-flow .react-flow");if(!S&&Se&&ht){const Ve=ht.getBoundingClientRect();Oe=Se.screenToFlowPosition({x:Ve.left+Ve.width*.48,y:Ve.top+Ve.height*.32})}const cn={};for(const Ve of q)cn[ee[Ve]]={...K[Ve]||{}};xn.current={...xn.current,...cn};const un=q.map(Ve=>{const dn=K[Ve]||{},Ki=we.find(Mu=>Mu.id===Ve)||{x:0,y:0},fi=pe[Ve]&&typeof pe[Ve].width=="number"&&typeof pe[Ve].height=="number"?{width:pe[Ve].width,height:pe[Ve].height}:null,al={id:ee[Ve],type:"flowNode",selected:!0,position:{x:Oe.x+(Ki.x-Fe),y:Oe.y+(Ki.y-ce)},...fi?{width:fi.width,height:fi.height}:{},data:{label:dn.label||ee[Ve],definitionId:dn.definitionId||Ve,role:dn.role||"normal",body:dn.body||"",script:dn.script||"",...fi?{displaySize:fi}:{}}};return ff(al,xn.current,ae,{},c.id)}),Ft=new Set(q),bt=(Array.isArray(H.edges)?H.edges:[]).filter(Ve=>Ft.has(Ve==null?void 0:Ve.source)&&Ft.has(Ve==null?void 0:Ve.target)).map((Ve,dn)=>({id:`e-${ee[Ve.source]}-${ee[Ve.target]}-${Date.now()}-${dn}`,source:ee[Ve.source],target:ee[Ve.target],sourceHandle:Ve.sourceHandle??void 0,targetHandle:Ve.targetHandle??void 0,markerEnd:{type:gs.ArrowClosed}}));kt(Ve=>[...Ve.map(dn=>({...dn,selected:!1})),...un]),ln(Ve=>[...Ve.map(dn=>({...dn,selected:!1})),...bt]),N(`已添加流程片段:${x.displayName||x.id}`)},[c0,ae,c,ln,kt]);Hf.current=u0;const M2=m.useCallback(()=>{var H,K;if(Cr.length<2){Gt("请先在画布上选择至少两个节点。"),_e("flows");return}const x=Cr[0],S=Cr.length===2?`${((H=x.data)==null?void 0:H.label)||x.id} 片段`:`${((K=x.data)==null?void 0:K.label)||x.id} 等 ${Cr.length} 个节点`;pn({name:S,id:S.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),description:""}),qe(""),en(!0),_e("flows")},[Cr]),$2=m.useCallback(async()=>{var X,ee;if(!c||Cr.length<2)return;const x=rn.name.trim();if(!x){qe("请填写片段名称。");return}const S=Rf(Cr,xn.current),H={},K={};for(const te of Cr){H[te.id]={x:((X=te.position)==null?void 0:X.x)||0,y:((ee=te.position)==null?void 0:ee.y)||0};const pe=YU(te);pe&&(K[te.id]=pe)}const q=tp.map(te=>({source:te.source,target:te.target,sourceHandle:te.sourceHandle??null,targetHandle:te.targetHandle??null}));le(!0),qe("");try{const te=await fetch("/api/marketplace/publish-flow-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:rn.id,name:x,displayName:x,version:"1.0.0",description:rn.description,snippet:{instances:S,edges:q,ui:{nodePositions:H,nodeSizes:K}}})}),pe=await te.json().catch(()=>({}));if(!te.ok||(pe==null?void 0:pe.ok)===!1)throw new Error((pe==null?void 0:pe.error)||"Publish failed");en(!1),N(`流程片段已发布:${pe.id||x}`),Xr(`流程片段已发布:${pe.id||x}`),await qf(),_e("flows")}catch(te){qe(String(te.message||te))}finally{le(!1)}},[c,Cr,tp,rn,qf,Xr]),np=m.useMemo(()=>{const x=[],S=new Set;for(const q of Cr)S.add(q.id),x.push({node:q,kind:"canvas"});const H=new Map(Pt.map(q=>[q.id,q])),K=new Map(ae.map(q=>[q.id,q]));for(const q of a0){if(S.has(q))continue;const X=H.get(q);if(X){S.add(q),x.push({node:X,kind:"mention"});continue}const ee=K.get(q);ee&&(S.add(q),x.push({definition:ee,kind:"definition"}))}return x},[Cr,a0,Pt,ae]),ns=m.useMemo(()=>{const x=Array.isArray(wt==null?void 0:wt.cursor)?wt.cursor:[],S=Array.isArray(wt==null?void 0:wt.opencode)?wt.opencode:[],H=Array.isArray(wt==null?void 0:wt.claudeCode)?wt.claudeCode:[],K=S.map(we=>`opencode:${jo(we)}`),q=H.map(we=>`claude-code:${jo(we)}`),X=new Set([...x,...S,...H].map(jo).concat(K).concat(q)),ee=(Hs||"").trim(),te=zp(Hs,x,S,H),pe=te&&!X.has(te)&&!X.has(ee)?ee:"";return{cursorList:x,opencodeList:S,claudeCodeList:H,currentNotInLists:pe}},[wt,Hs]),Tg=m.useMemo(()=>new Set(xo),[xo]),Rg=xo.length,rp=m.useMemo(()=>{const x=new Map(ci.map(X=>[X.key,X])),S=new Set,H=new Set,K=Xl.map(X=>{const ee=Ta(X,ci).map(te=>x.get(te)).filter(Boolean);for(const te of ee)S.add(te.key),H.add(String(te.name||te.id||te.key||"").trim());return{...X,skills:ee}}).filter(X=>X.skills.length>0),q=ci.filter(X=>{const ee=String(X.name||X.id||X.key||"").trim();return!S.has(X.key)&&!H.has(ee)});return{groups:K,ungrouped:q}},[Xl,ci]),nc=m.useCallback(()=>{const x=_u.current;if(!x)return;const S=x.getBoundingClientRect(),H=Math.min(400,Math.max(300,window.innerWidth-24)),K=Math.min(Math.max(12,S.right-H),window.innerWidth-H-12),q=Math.max(140,S.top-22),X=Math.min(360,q);vg({position:"fixed",left:`${K}px`,top:`${Math.max(12,S.top-X-10)}px`,width:`${H}px`,maxHeight:`${X}px`})},[]);m.useEffect(()=>{const x=Array.isArray(wt==null?void 0:wt.cursor)?wt.cursor:[],S=Array.isArray(wt==null?void 0:wt.opencode)?wt.opencode:[],H=Array.isArray(wt==null?void 0:wt.claudeCode)?wt.claudeCode:[];Ws(K=>{const q=zp(K,x,S,H);return q===K?K:q})},[wt.cursor,wt.opencode,wt.claudeCode]),m.useEffect(()=>{if(!nl)return;nc();const x=H=>{var q,X;const K=H.target;(q=_u.current)!=null&&q.contains(K)||(X=Pu.current)!=null&&X.contains(K)||Jl(!1)},S=H=>{H.key==="Escape"&&Jl(!1)};return window.addEventListener("resize",nc),window.addEventListener("scroll",nc,!0),document.addEventListener("pointerdown",x),document.addEventListener("keydown",S),()=>{window.removeEventListener("resize",nc),window.removeEventListener("scroll",nc,!0),document.removeEventListener("pointerdown",x),document.removeEventListener("keydown",S)}},[nl,nc]);const ol=m.useCallback(async(x,S={})=>{var bt;if(!c||tt.current)return;const H=S.phaseContextSnapshot,K=(typeof x=="string"?x:es).trim();if(!K)return;const q=Dt.current;tt.current=!0,qt(!0),Nt(e("flow:composer.connecting")),re(Yt=>Yt!=="composer"?"composer":Yt);const X=[...yn];if(q.length>0&&X.push({type:"assistant",segments:[...q]}),an([...X,{type:"user",text:K}]),X.filter(Yt=>Yt.type==="user").length===0){const Yt=K.replace(/\s+/g," ").slice(0,30)+(K.length>30?"…":"");J(Wr=>Wr.map(Ve=>Ve.id===Q?{...Ve,label:Yt}:Ve))}const ee=X.map(Yt=>Yt.type==="user"?{role:"user",text:Yt.text}:{role:"assistant",text:(Yt.segments||[]).filter(Ve=>Ve.kind==="assistant"||Ve.kind==="result").map(Ve=>Ve.text).join(`
|
|
134
|
+
`)}).filter(Yt=>Yt.text),te=H??Le;yo(""),Ot([]),jt([]),Zt(!1);const pe=new AbortController;jr.current=pe,he.current=Q;let we=null;const Fe=Array.isArray(wt==null?void 0:wt.cursor)?wt.cursor:[],ce=Array.isArray(wt==null?void 0:wt.opencode)?wt.opencode:[],Oe=Array.isArray(wt==null?void 0:wt.claudeCode)?wt.claudeCode:[],Se=zp(Hs,Fe,ce,Oe),ht=np.filter(Yt=>Yt.kind!=="definition"&&Yt.node).map(Yt=>Yt.node.id),cn=c;let un=!1,Ft=!1;try{we=setTimeout(()=>pe.abort(),12e4);const Yt={prompt:K,model:Se,flowId:c.id,flowSource:c.source??"user",...c.archived?{flowArchived:!0}:{},contextInstanceIds:ht,thread:ee,selectedSkills:xo};te&&te.nextPhase&&!te.isLastPhase&&(Yt.phaseContext={phaseIndex:te.nextPhase.index,phases:te.phases,userPromptOriginal:te.userPromptOriginal||K}),Cu&&(Yt.phaseRole=Cu);const Wr=await fetch("/api/composer-agent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Yt),signal:pe.signal});if(we&&(clearTimeout(we),we=null),!Wr.ok){let fi=Wr.statusText||e("flow:composer.requestFailed");try{const al=await Wr.json();al&&al.error&&(fi=String(al.error))}catch{}Nt(fi),Ot([{kind:"error",text:fi}]);return}const Ve=(bt=Wr.body)==null?void 0:bt.getReader();if(!Ve){Nt(e("flow:composer.cannotReadStream"));return}const dn=new TextDecoder;let Ki="";for(;;){const{done:fi,value:al}=await Ve.read();if(fi)break;for(Ki+=dn.decode(al,{stream:!0});;){const Mu=Ki.indexOf(`
|
|
135
|
+
`);if(Mu<0)break;const y0=Ki.slice(0,Mu).trim();if(Ki=Ki.slice(Mu+1),!y0)continue;let Ue;try{Ue=JSON.parse(y0)}catch{continue}if(Ue.type==="status"&&typeof Ue.line=="string"&&Nt(Ue.line),Ue.type==="natural"&&typeof Ue.text=="string"&&Ue.text){const wn=typeof Ue.kind=="string"&&Ue.kind?Ue.kind:"assistant";Ot(fn=>[...fn,{kind:wn,text:Ue.text}])}if(Ue.type==="error"&&Ue.message){Ft=!0;const wn=Ue.code?` [${Ue.code}]`:"",fn=String(Ue.message)+wn;Nt(fn),Ot(rs=>[...rs,{kind:"error",text:fn}])}if(Ue.type==="plan"&&Array.isArray(Ue.steps)){jt(Ue.steps.map(fn=>({...fn,status:"pending"})));const wn=Ue.steps.map((fn,rs)=>`${rs+1}. ${fn.description||fn.type}`).join(`
|
|
136
|
+
`);Ot(fn=>[...fn,{kind:"assistant",text:e("flow:composer.taskPlan",{count:Ue.steps.length,summary:wn})}])}if(Ue.type==="step-start"){const wn=Ue.index??0,fn=Ue.total??0,rs=Ue.tier?` [${Ue.tier}]`:"",W2=Ue.model?` (${Ue.model})`:"";Nt(e("flow:composer.step",{current:wn+1,total:fn,description:(Ue.description||"")+rs+W2})),jt(V2=>V2.map(rc=>rc.index===wn?{...rc,status:"running",model:Ue.model,tier:Ue.tier,nodeRole:Ue.nodeRole??rc.nodeRole,instanceId:Ue.instanceId??rc.instanceId,instanceLabel:Ue.instanceLabel??rc.instanceLabel}:rc))}if(Ue.type==="step-progress"){const wn=Ue.index??0,fn=Ue.total??0;Nt(e("flow:composer.step",{current:wn+1,total:fn,description:Ue.description||""}))}if(Ue.type==="step-done"){const wn=Ue.index??0;jt(fn=>fn.map(rs=>rs.index===wn?{...rs,status:Ue.success?"done":"error"}:rs))}if(Ue.type==="phase-plan"&&Array.isArray(Ue.phases)){dr(fn=>({...fn||{},phases:Ue.phases,currentPhase:Ue.currentPhase??0,phaseTotal:Ue.phaseTotal??Ue.phases.length,phaseName:Ue.phaseName||"",isLastPhase:!1,nextPhase:null,userPromptOriginal:(fn==null?void 0:fn.userPromptOriginal)||K}));const wn=Ue.phases.map((fn,rs)=>`${rs+1}. ${fn.label}`).join(" → ");Ot(fn=>[...fn,{kind:"assistant",text:e("flow:composer.phaseGeneration",{count:Ue.phases.length,labels:wn,current:Ue.phaseName||""})}])}Ue.type==="phase-complete"&&(dr(wn=>{var rs;return{...wn||{},phases:Ue.phases||(wn==null?void 0:wn.phases)||[],currentPhase:Ue.phaseIndex??0,phaseTotal:Ue.phaseTotal??((rs=Ue.phases)==null?void 0:rs.length)??0,phaseName:Ue.phaseName||"",isLastPhase:!!Ue.isLastPhase,nextPhase:Ue.nextPhase||null,userPromptOriginal:Ue.userPromptOriginal||(wn==null?void 0:wn.userPromptOriginal)||K}}),!Ue.isLastPhase&&Ue.nextPhase&&Ot(wn=>[...wn,{kind:"assistant",text:e("flow:composer.phaseComplete",{phaseName:Ue.phaseName||e("flow:composer.nextPhase"),nextPhase:Ue.nextPhase.label})}])),Ue.type==="done"&&(un=!0,Nt(wn=>wn||e("flow:composer.done")))}}}catch(Yt){const Wr=Yt;if(Wr.name==="AbortError"){const Ve=e(we?"flow:composer.connectTimeout":"flow:composer.aborted");Nt(Ve),Ot(dn=>[...dn,{kind:"error",text:Ve}])}else{const Ve=Wr.code||Wr.name||"UNKNOWN",dn=`${Wr.message||String(Yt)} [${Ve}]`;Nt(dn),Ot(Ki=>[...Ki,{kind:"error",text:dn}])}}finally{if(tt.current=!1,qt(!1),jr.current=null,he.current=null,we&&clearTimeout(we),un&&cn){const Yt={id:cn.id,source:cn.source??"user",archived:cn.archived};(async()=>(await Us(Yt,{preserveComposer:!0,incrementalSync:!0}),await ea(Yt,{quiet:!0,force:!0})))()}}},[c,es,Hs,wt,np,Us,ea,yn,Q,Le,Cu,xo]);pt.current=ol;const d0=m.useCallback(()=>{!Le||Le.isLastPhase||(dr(null),ol(e("flow:composer.skipRemainingPhases")))},[Le,ol]),f0=m.useCallback(()=>{if(!Le||Le.isLastPhase||!Le.nextPhase)return;const x=String(Le.nextPhase.label||"").trim()||e("flow:composer.nextPhase");ol(e("flow:composer.continuePhase",{label:x}),{phaseContextSnapshot:Le})},[Le,ol]);m.useEffect(()=>{if(!It)return;const x=S=>{S.key==="Escape"&&on(!1)};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[It]),m.useEffect(()=>{Re!=="edit"&&on(!1)},[Re]),m.useLayoutEffect(()=>{const x=Yo.current;if(!x)return;if(!c){x.style.height="";return}x.style.height="0px";const S=getComputedStyle(x),H=parseFloat(S.lineHeight),K=(parseFloat(S.paddingTop)||0)+(parseFloat(S.paddingBottom)||0),q=Number.isFinite(H)&&H>0?H:13*1.45,X=K+q*2,ee=K+q*10,te=Math.min(Math.max(x.scrollHeight,X),ee);x.style.height=`${te}px`},[es,c]);const Lg=m.useCallback(x=>{const S=es,H=$i,K=yj(S,H);if(!K)return;const q=S.slice(0,K.atIndex)+`@${x} `+S.slice(H);yo(q);const X=K.atIndex+x.length+2;queueMicrotask(()=>{const ee=Yo.current;ee&&(ee.focus(),ee.setSelectionRange(X,X)),li(X)})},[es,$i]),Og=m.useCallback(x=>{yo(S=>{const H=`@${x}`,K=S.indexOf(H);return K<0?S:S.slice(0,K)+S.slice(K+H.length)})},[]),p0=m.useCallback(x=>{x.kind==="canvas"?kt(S=>S.map(H=>H.id===x.node.id?{...H,selected:!1}:H)):x.kind==="mention"?Og(x.node.id):Og(x.definition.id)},[kt,Og]),D2=m.useCallback(()=>{re(x=>x==="history"?null:"history")},[]),F2=m.useCallback(()=>{re(x=>x==="settings"?null:"settings")},[]),z2=m.useCallback(()=>{re(x=>x==="composer"?null:"composer")},[]),Ou=m.useCallback(()=>{re(x=>(x==="node"&&Go.current&&(Yl.current=Go.current.id),null))},[]),h0=m.useCallback(()=>{Fi(x=>!x)},[]),B2=()=>{if(!c)return null;const x=oi||c.archived||Ks(c.source),S=Dn!=null&&Dn.running?e("flow:schedule.running"):nr.enabled?e("flow:schedule.waiting"):e("flow:schedule.disabled"),H=Dn!=null&&Dn.running?"running":nr.enabled?"waiting":"disabled",K=hn.slice(0,12),q=c.archived||Ks(c.source);return o.jsxs("section",{className:"af-pipeline-settings-page","aria-label":e("flow:settings.title"),children:[o.jsxs("aside",{className:"af-pipeline-settings-nav","aria-label":e("flow:settings.sectionNav"),children:[o.jsx("div",{className:"af-pipeline-settings-nav-title",children:e("flow:settings.title")}),o.jsxs("a",{href:"#pipeline-basic",className:"af-pipeline-settings-nav-item af-pipeline-settings-nav-item--active",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"badge"}),e("flow:settings.basicInfo")]}),o.jsxs("a",{href:"#pipeline-storage",className:"af-pipeline-settings-nav-item",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"folder_open"}),e("flow:settings.storageAndPath")]}),o.jsxs("a",{href:"#pipeline-marketplace",className:"af-pipeline-settings-nav-item",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"deployed_code"}),e("flow:settings.nodeMarketplace")]}),o.jsxs("a",{href:"#pipeline-schedule",className:"af-pipeline-settings-nav-item",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"schedule"}),e("flow:schedule.title")]}),o.jsxs("a",{href:"#pipeline-metadata",className:"af-pipeline-settings-nav-item",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"dataset"}),e("flow:pipeline.metadata")]}),o.jsxs("button",{type:"button",className:"af-pipeline-settings-nav-link",onClick:()=>n("/settings"),children:[e("flow:settings.globalSettings"),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_new"})]})]}),o.jsxs("main",{className:"af-pipeline-settings-main",children:[o.jsxs("div",{className:"af-pipeline-settings-main-head",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"af-pipeline-settings-title",children:e("flow:settings.title")}),o.jsx("p",{className:"af-pipeline-settings-subtitle",children:e("flow:settings.subtitle")})]}),o.jsxs("button",{type:"button",className:"af-btn-secondary",onClick:Ou,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_back"}),e("flow:settings.backToCanvas")]})]}),o.jsxs("section",{id:"pipeline-basic",className:"af-pipeline-settings-section",children:[o.jsxs("div",{className:"af-pipeline-settings-section-head",children:[o.jsx("span",{className:"af-pipeline-settings-section-index",children:"1."}),o.jsx("h2",{children:e("flow:settings.basicInfo")})]}),o.jsxs("div",{className:"af-pipeline-settings-grid af-pipeline-settings-grid--two",children:[o.jsxs("div",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.pipelineId")}),(c.source==="user"||c.source==="workspace")&&!c.archived?o.jsxs("div",{className:"af-pipeline-rename-row",children:[o.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:M,onChange:X=>{z(X.target.value),T("")},onKeyDown:X=>{X.key==="Enter"&&(X.preventDefault(),Jf())},onBlur:()=>{M.trim()&&M.trim()!==c.id&&Jf()},placeholder:c.id,disabled:$,spellCheck:!1}),o.jsx("span",{className:"af-pipeline-drawer-badge",children:cc(c.source??"user",e)})]}):o.jsxs("div",{className:"af-pipeline-drawer-readonly",children:[c.id,o.jsx("span",{className:"af-pipeline-drawer-badge",children:cc(c.source??"user",e)}),c.archived?o.jsx("span",{className:"af-pipeline-drawer-badge af-pipeline-drawer-badge--muted",children:e("flow:settings.archived")}):null]}),F?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:F}):null]}),o.jsxs("div",{className:"af-pipeline-settings-kv-block",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:settings.owner")}),o.jsxs("div",{className:"af-pipeline-drawer-readonly",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"person"}),c.owner||"bigo"]})]})]}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.introduction")}),o.jsx("textarea",{className:"af-pipeline-drawer-textarea af-pipeline-settings-textarea",value:v,onChange:X=>k(X.target.value),placeholder:e("flow:pipeline.introductionPlaceholder"),rows:4,spellCheck:!1})]})]}),o.jsxs("section",{id:"pipeline-storage",className:"af-pipeline-settings-section",children:[o.jsxs("div",{className:"af-pipeline-settings-section-head",children:[o.jsx("span",{className:"af-pipeline-settings-section-index",children:"2."}),o.jsx("h2",{children:e("flow:settings.storageAndPath")})]}),typeof c.path=="string"&&c.path?o.jsxs("div",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.diskPath")}),o.jsxs("div",{className:"af-pipeline-drawer-readonly af-pipeline-drawer-readonly--mono af-pipeline-path-row",children:[o.jsx("span",{className:"af-pipeline-path-text",children:c.path}),o.jsx("button",{type:"button",className:"af-icon-btn af-pipeline-copy-btn",onClick:()=>s0(c.path),title:e("flow:settings.copyPath"),children:o.jsx("span",{className:"material-symbols-outlined",children:O?"check":"content_copy"})})]})]}):null,c.source==="user"||c.source==="workspace"?c.archived?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.archivedNote")}):o.jsxs("div",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.storageLocation")}),o.jsx("div",{className:"af-pipeline-move-actions",children:c.source==="user"?o.jsx("button",{type:"button",className:"af-btn-secondary",disabled:R,onClick:()=>Xf("workspace"),children:e(R?"flow:settings.moveBusy":"flow:settings.moveToWorkspace")}):o.jsx("button",{type:"button",className:"af-btn-secondary",disabled:R,onClick:()=>Xf("user"),children:e(R?"flow:settings.moveBusy":"flow:settings.moveToUserDir")})}),C?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:C}):null]}):o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.builtinNote")})]}),o.jsxs("section",{id:"pipeline-marketplace",className:"af-pipeline-settings-section",children:[o.jsxs("div",{className:"af-pipeline-settings-section-head",children:[o.jsx("span",{className:"af-pipeline-settings-section-index",children:"3."}),o.jsx("h2",{children:e("flow:settings.nodeMarketplace")})]}),o.jsxs("div",{className:"af-pipeline-market-row",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"af-pipeline-market-count",children:[hn.length," ",e("flow:settings.marketNodesUnit")]}),o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.marketplaceHint")})]}),o.jsxs("button",{type:"button",className:"af-btn-secondary",onClick:Cg,disabled:mn,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"refresh"}),e(mn?"common:common.loading":"common:common.refresh")]})]}),Xt?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:Xt}):null,mn?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("common:common.loading")}):K.length>0?o.jsx("div",{className:"af-pipeline-market-list",children:K.map(X=>{const ee=X.definitionId||`marketplace:${X.id}${X.version?`@${X.version}`:""}`,te=e0.has(ee)||e0.has(`marketplace:${X.id}`),pe=Vf.find(Oe=>String(Oe.id)===ee||String(Oe.id)===`marketplace:${X.id}`),we=Tn===ee,Fe=Fp(X.inputs||X.input),ce=Fp(X.outputs||X.output);return o.jsxs("div",{className:"af-pipeline-market-item",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:te?"check_circle":"extension"}),o.jsxs("div",{className:"af-pipeline-market-main",children:[o.jsxs("div",{className:"af-pipeline-market-title-row",children:[o.jsx("strong",{children:X.displayName||X.label||X.id}),o.jsx("span",{children:X.version?`v${X.version}`:ee})]}),o.jsx("p",{className:"af-pipeline-market-purpose",children:X.description||e("flow:settings.marketplaceNoDescription")}),o.jsxs("div",{className:"af-pipeline-market-io",children:[o.jsxs("div",{children:[o.jsx("span",{className:"af-pipeline-market-io-label",children:"Inputs"}),o.jsx("div",{className:"af-pipeline-market-chips",children:Fe.length>0?Fe.map(Oe=>o.jsx("span",{className:"af-pipeline-market-chip",children:Oe},`in-${ee}-${Oe}`)):o.jsx("span",{className:"af-pipeline-market-chip af-pipeline-market-chip--muted",children:e("flow:settings.noInputs")})})]}),o.jsxs("div",{children:[o.jsx("span",{className:"af-pipeline-market-io-label",children:"Outputs"}),o.jsx("div",{className:"af-pipeline-market-chips",children:ce.length>0?ce.map(Oe=>o.jsx("span",{className:"af-pipeline-market-chip",children:Oe},`out-${ee}-${Oe}`)):o.jsx("span",{className:"af-pipeline-market-chip af-pipeline-market-chip--muted",children:e("flow:settings.noOutputs")})})]})]})]}),o.jsxs("div",{className:"af-pipeline-market-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary af-pipeline-market-action",onClick:()=>Me(X),children:e("flow:settings.previewNode")}),o.jsx("button",{type:"button",className:te?"af-btn-secondary af-pipeline-market-action":"af-btn-primary af-pipeline-market-action",disabled:q||we,onClick:()=>{te&&pe?(r0(pe),re(null)):o2(X)},children:e(we?"flow:settings.installingNode":te?"flow:settings.addInstalledNode":"flow:settings.installNode")})]})]},ee)})}):o.jsx("div",{className:"af-pipeline-settings-empty",children:e("flow:settings.marketplaceEmpty")})]}),o.jsxs("section",{id:"pipeline-schedule",className:"af-pipeline-settings-section",children:[o.jsxs("div",{className:"af-pipeline-settings-section-head",children:[o.jsx("span",{className:"af-pipeline-settings-section-index",children:"4."}),o.jsx("h2",{children:e("flow:schedule.title")})]}),zl?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("common:common.loading")}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-pipeline-settings-schedule-grid",children:[o.jsxs("label",{className:"af-new-pipeline-radio af-pipeline-settings-checkbox",children:[o.jsx("input",{type:"checkbox",checked:!!nr.enabled,disabled:x,onChange:X=>Zo(ee=>({...ee,enabled:X.target.checked}))}),o.jsx("span",{children:e("flow:schedule.enabled")})]}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.cron")}),o.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:nr.cron||"",disabled:x,onChange:X=>Zo(ee=>({...ee,cron:X.target.value})),placeholder:"0 9 * * *",spellCheck:!1})]}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.timezone")}),o.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:nr.timezone||"",disabled:x,onChange:X=>Zo(ee=>({...ee,timezone:X.target.value})),placeholder:"Asia/Shanghai",spellCheck:!1})]}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.preset")}),o.jsxs("select",{className:"af-pipeline-flow-select",value:nr.preset||"",disabled:x,onChange:X=>Zo(ee=>({...ee,preset:X.target.value})),children:[o.jsx("option",{value:"",children:e("flow:schedule.defaultPreset")}),Object.keys($n).map(X=>o.jsx("option",{value:X,children:X},X))]})]})]}),o.jsxs("div",{className:"af-pipeline-settings-schedule-status",children:[o.jsx("span",{className:`af-pipeline-settings-status-dot af-pipeline-settings-status-dot--${H}`}),o.jsx("span",{children:nr.nextRunAt?e("flow:schedule.nextRun",{time:new Date(nr.nextRunAt).toLocaleString()}):e("flow:schedule.noNextRun")}),o.jsxs("span",{children:[e("flow:schedule.runtime"),":",S]})]}),o.jsxs("dl",{className:"af-pipeline-meta-dl af-pipeline-settings-dl",children:[Wt.lastTriggeredAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastTriggeredAt")}),o.jsx("dd",{children:new Date(Wt.lastTriggeredAt).toLocaleString()})]}):null,Wt.lastSkippedAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastSkippedAt")}),o.jsxs("dd",{children:[new Date(Wt.lastSkippedAt).toLocaleString(),Wt.lastSkipReason?` · ${Wt.lastSkipReason}`:""]})]}):null,Wt.lastRunUuid?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastRun")}),o.jsx("dd",{children:Wt.lastRunUuid})]}):null,Wt.lastExitCode!=null?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastExit")}),o.jsx("dd",{children:String(Wt.lastExitCode)})]}):null,Wt.lastFinishedAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastFinishedAt")}),o.jsx("dd",{children:new Date(Wt.lastFinishedAt).toLocaleString()})]}):null]}),Dn!=null&&Dn.lastError||Wt.lastError?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:(Dn==null?void 0:Dn.lastError)||Wt.lastError}):null,c.archived||Ks(c.source)?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.readonlyNote")}):null,Qr?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:Qr}):null,Wa?o.jsx("p",{className:"af-pipeline-drawer-muted",children:Wa}):null]})]}),o.jsxs("section",{id:"pipeline-metadata",className:"af-pipeline-settings-section",children:[o.jsxs("div",{className:"af-pipeline-settings-section-head",children:[o.jsx("span",{className:"af-pipeline-settings-section-index",children:"5."}),o.jsx("h2",{children:e("flow:pipeline.metadata")})]}),o.jsxs("dl",{className:"af-pipeline-meta-dl af-pipeline-settings-dl",children:[o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:pipeline.nodeCount")}),o.jsxs("dd",{children:[Pt.length," ",e("flow:pipeline.nodesUnit")]})]}),o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:settings.marketplaceNodes")}),o.jsx("dd",{children:Vf.length})]}),o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:settings.source")}),o.jsx("dd",{children:cc(c.source??"user",e)})]})]})]})]}),o.jsxs("aside",{className:"af-pipeline-settings-side","aria-label":e("flow:settings.overview"),children:[o.jsxs("section",{className:"af-pipeline-settings-side-card",children:[o.jsxs("div",{className:"af-pipeline-settings-overview-head",children:[o.jsx("span",{className:"af-pipeline-settings-overview-icon material-symbols-outlined","aria-hidden":!0,children:"account_tree"}),o.jsxs("div",{children:[o.jsx("h2",{children:c.id}),o.jsx("span",{className:`af-pipeline-settings-status af-pipeline-settings-status--${H}`,children:S})]})]}),o.jsxs("dl",{className:"af-pipeline-settings-side-dl",children:[o.jsxs("div",{children:[o.jsx("dt",{children:e("flow:pipeline.nodeCount")}),o.jsx("dd",{children:Pt.length})]}),o.jsxs("div",{children:[o.jsx("dt",{children:e("flow:settings.owner")}),o.jsx("dd",{children:c.owner||"bigo"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:e("flow:settings.source")}),o.jsx("dd",{children:cc(c.source??"user",e)})]})]})]}),o.jsxs("section",{className:"af-pipeline-settings-side-card",children:[o.jsx("h2",{children:e("flow:settings.quickActions")}),o.jsxs("button",{type:"button",className:"af-btn-primary af-pipeline-settings-side-action",onClick:()=>void S2(),disabled:oi,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"save"}),e(oi?"flow:settings.savingChanges":"flow:settings.saveChanges")]}),o.jsxs("button",{type:"button",className:"af-btn-secondary af-pipeline-settings-side-action",onClick:Ou,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_back"}),e("flow:settings.backToCanvas")]})]}),o.jsxs("section",{className:"af-pipeline-settings-side-card",children:[o.jsx("h2",{children:e("flow:settings.help")}),o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.helpText")}),o.jsx("button",{type:"button",className:"af-pipeline-drawer-link",onClick:()=>n("/settings"),children:e("flow:settings.globalSettings")})]})]})]})},H2=()=>{const x=xe;if(!x)return null;const S=x.definitionId||`marketplace:${x.id}${x.version?`@${x.version}`:""}`,H=x.displayName||x.label||x.id,K=Fp(x.inputs||x.input),q=Fp(x.outputs||x.output);return os.createPortal(o.jsx("div",{className:"af-market-preview-overlay",role:"dialog","aria-modal":"true","aria-label":e("flow:settings.nodePreviewTitle"),onMouseDown:X=>{X.target===X.currentTarget&&Me(null)},children:o.jsxs("div",{className:"af-market-preview-dialog",children:[o.jsxs("div",{className:"af-market-preview-head",children:[o.jsxs("div",{children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:settings.nodePreviewTitle")}),o.jsx("h2",{children:H})]}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>Me(null),"aria-label":e("flow:settings.closePreview"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-market-preview-body",children:[o.jsx("section",{className:"af-market-preview-visual","aria-label":e("flow:settings.nodeStylePreview"),children:o.jsxs("div",{className:"af-market-preview-node",children:[o.jsx("div",{className:"af-market-preview-node-ports af-market-preview-node-ports--left",children:(K.length>0?K:[""]).slice(0,4).map((X,ee)=>o.jsx("span",{title:X},`preview-in-${ee}`))}),o.jsxs("div",{className:"af-market-preview-node-main",children:[o.jsx("span",{className:"af-market-preview-node-icon material-symbols-outlined","aria-hidden":!0,children:"extension"}),o.jsx("strong",{children:H}),o.jsx("span",{children:S})]}),o.jsx("div",{className:"af-market-preview-node-ports af-market-preview-node-ports--right",children:(q.length>0?q:[""]).slice(0,4).map((X,ee)=>o.jsx("span",{title:X},`preview-out-${ee}`))})]})}),o.jsxs("section",{className:"af-market-preview-section",children:[o.jsx("h3",{children:e("flow:settings.nodeFunction")}),o.jsx("p",{children:x.description||e("flow:settings.marketplaceNoDescription")})]}),o.jsxs("div",{className:"af-market-preview-io-grid",children:[o.jsxs("section",{className:"af-market-preview-section",children:[o.jsx("h3",{children:"Inputs"}),o.jsx("div",{className:"af-pipeline-market-chips af-market-preview-chips",children:K.length>0?K.map(X=>o.jsx("span",{className:"af-pipeline-market-chip",children:X},`preview-input-${X}`)):o.jsx("span",{className:"af-pipeline-market-chip af-pipeline-market-chip--muted",children:e("flow:settings.noInputs")})})]}),o.jsxs("section",{className:"af-market-preview-section",children:[o.jsx("h3",{children:"Outputs"}),o.jsx("div",{className:"af-pipeline-market-chips af-market-preview-chips",children:q.length>0?q.map(X=>o.jsx("span",{className:"af-pipeline-market-chip",children:X},`preview-output-${X}`)):o.jsx("span",{className:"af-pipeline-market-chip af-pipeline-market-chip--muted",children:e("flow:settings.noOutputs")})})]})]}),o.jsxs("section",{className:"af-market-preview-section",children:[o.jsx("h3",{children:e("flow:settings.nodePackageInfo")}),o.jsxs("dl",{className:"af-market-preview-dl",children:[o.jsxs("div",{children:[o.jsx("dt",{children:e("flow:settings.definitionId")}),o.jsx("dd",{children:S})]}),o.jsxs("div",{children:[o.jsx("dt",{children:e("flow:settings.version")}),o.jsx("dd",{children:x.version||"-"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:e("flow:settings.packagePath")}),o.jsx("dd",{children:x.packageDir||"-"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:e("flow:settings.packagedFiles")}),o.jsx("dd",{children:Array.isArray(x.packagedFiles)&&x.packagedFiles.length>0?x.packagedFiles.map(X=>X.to||X).join(", "):"-"})]})]})]})]})]})}),document.body)};return o.jsxs(cv,{children:[o.jsx(FU,{onReady:a}),o.jsxs(GI.Provider,{value:{modelLists:wt,onModelChange:N2},children:[o.jsxs("div",{className:"af-pipeline-page"+(Re!=="edit"?" af-pipeline-page--run-mode":""),children:[o.jsxs("header",{className:"af-pipeline-top",children:[o.jsxs("div",{className:"af-pipeline-top-left",children:[o.jsx("button",{type:"button",className:"af-icon-btn af-pipeline-back",onClick:()=>{Re==="running"?ep(!0):Re!=="edit"?il():n("/projects")},"aria-label":e(Re!=="edit"?"flow:topbar.backToEdit":"flow:topbar.backToProjects"),title:e(Re!=="edit"?"flow:topbar.backToEdit":"flow:topbar.backToProjects"),children:o.jsx("span",{className:"material-symbols-outlined",children:"arrow_back"})}),o.jsxs("div",{className:"af-pipeline-brand",children:[o.jsx("span",{className:"af-pipeline-brand-name",children:"PIPELINE"}),o.jsxs("span",{className:"af-pipeline-brand-ver",children:["V",wU,"-STABLE"]})]}),o.jsxs("div",{className:"af-view-switch","aria-label":"视图切换",children:[o.jsx("button",{type:"button",className:"af-view-switch__active",children:"Pipeline"}),o.jsx("button",{type:"button",onClick:()=>n(Vb(c,"workspace")),children:"Workspace"})]})]}),o.jsxs("div",{className:"af-pipeline-top-right af-flow-toolbar-actions",children:[go&&o.jsx("button",{type:"button",className:"af-icon-btn"+(Ii?" af-icon-btn--active":""),"aria-label":"Composer Logs (dev)",title:"Composer Logs (dev)",onClick:()=>Ss(x=>!x),children:o.jsx("span",{className:"material-symbols-outlined",children:"description"})}),Re==="running"&&o.jsxs("div",{className:"af-run-timer",children:[o.jsx("span",{className:"af-run-timer__dot"}),o.jsx("span",{className:"af-run-timer__label",children:"RUNTIME"}),o.jsx("span",{className:"af-run-timer__value",children:zy(jn,"running")})]}),Re==="stopped"&&o.jsxs("div",{className:"af-run-timer af-run-timer--stopped",children:[o.jsx("span",{className:"af-run-timer__label",children:"PAUSED"}),o.jsx("span",{className:"af-run-timer__value",children:zy(jn,"stopped")})]}),(Re==="done"||Re==="error")&&o.jsxs("div",{className:"af-run-timer"+(Re==="error"?" af-run-timer--error":" af-run-timer--done"),children:[o.jsx("span",{className:"af-run-timer__label",children:Re==="error"?"FAILED":"COMPLETED"}),o.jsx("span",{className:"af-run-timer__value",children:zy(jn,Re)})]}),Re!=="edit"&&o.jsx("button",{type:"button",className:"af-icon-btn"+(tr?" af-icon-btn--active":""),"aria-label":e("flow:topbar.executionLog"),title:e("flow:topbar.executionLog"),onClick:()=>Br(x=>!x),children:o.jsx("span",{className:"material-symbols-outlined",children:"terminal"})}),Re==="edit"&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-icon-btn"+(Qe==="history"?" af-icon-btn--active":""),"aria-label":e("flow:topbar.history"),title:e("flow:topbar.history"),disabled:!c,onClick:D2,children:o.jsx("span",{className:"material-symbols-outlined",children:"history"})}),o.jsx("button",{type:"button",className:"af-icon-btn"+(Qe==="settings"?" af-icon-btn--active":""),onClick:F2,"aria-label":e("flow:topbar.pipelineSettings"),title:e("flow:topbar.pipelineSettings"),disabled:!c,children:o.jsx("span",{className:"material-symbols-outlined",children:"settings"})}),o.jsx("button",{type:"button",className:"af-composer-topbar-btn"+(Qe==="composer"?" af-composer-topbar-btn--active":"")+(Xe?" af-composer-topbar-btn--running":""),onClick:z2,"aria-label":"AI Composer",title:"AI Composer",disabled:!c,children:"AI"}),o.jsx("button",{type:"button",className:"af-icon-btn af-shortcuts-trigger"+(qn?" af-icon-btn--active":""),onClick:h0,"aria-label":e("flow:topbar.shortcutsLabel"),title:e("flow:topbar.shortcutsTitle"),disabled:!c,children:o.jsx("span",{className:"af-shortcuts-trigger__mark","aria-hidden":!0,children:"?"})}),o.jsx("button",{type:"button",className:"af-icon-btn af-icon-btn--danger","aria-label":e("flow:topbar.deletePipeline"),title:e("flow:topbar.deletePipeline"),disabled:!c||Ks(c.source)||c.source!=="user"&&c.source!=="workspace",onClick:()=>_(!0),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_forever"})}),o.jsx("button",{type:"button",className:"af-btn-pipeline-archive",disabled:!c||Ks(c.source)||c.archived||c.source!=="user"&&c.source!=="workspace",onClick:()=>P(!0),children:"Archive"})]}),Re==="running"?o.jsxs("button",{type:"button",className:"af-btn-run-stop",onClick:A2,title:e("flow:run.pauseRun"),children:[o.jsx("span",{className:"material-symbols-outlined",children:"pause"}),"Pause"]}):Re==="ready"?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!c,onClick:()=>void Ui(),title:e("flow:topbar.startRun"),children:e("flow:topbar.startRun")}),o.jsxs("button",{type:"button",className:"af-btn-pipeline-save",onClick:il,children:[o.jsx("span",{className:"material-symbols-outlined",children:"edit"}),"Edit"]})]}):Re==="stopped"?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!c,onClick:()=>void Ui({runUuid:tn}),title:tn?e("flow:topbar.resumeTitle",{uuid:tn}):e("flow:topbar.resumeTitleNoUuid"),children:"Resume"}),o.jsxs("button",{type:"button",className:"af-btn-pipeline-save",onClick:il,children:[o.jsx("span",{className:"material-symbols-outlined",children:"edit"}),"Edit"]})]}):Re==="done"||Re==="error"?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!c,onClick:()=>void Ui(),title:e("flow:topbar.rerunTitle"),children:"Run"}),o.jsxs("button",{type:"button",className:"af-btn-pipeline-save",onClick:il,children:[o.jsx("span",{className:"material-symbols-outlined",children:"edit"}),"Edit"]})]}):o.jsxs("div",{className:"af-run-btn-group",children:[o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg af-run-btn-main",disabled:!c,onClick:()=>void Ui(),children:"Run"}),o.jsx("button",{type:"button",className:"af-run-btn-dropdown",disabled:!c,onClick:()=>Ae(x=>!x),"aria-label":e("flow:topbar.runOptions"),"aria-expanded":Te,children:o.jsx("span",{className:"material-symbols-outlined",children:"arrow_drop_down"})}),Te&&c&&o.jsxs("div",{className:"af-run-dropdown-menu",children:[o.jsxs("button",{type:"button",className:"af-run-dropdown-item",onClick:()=>{var S,H,K,q,X;Ae(!1);const x={};for(const ee of ui){const te=ec[ee.id];te&&(x[te]=((S=Sr[te])==null?void 0:S.value)??((H=Sr[te])==null?void 0:H.path)??((X=(q=(K=ee.data)==null?void 0:K.outputs)==null?void 0:q[0])==null?void 0:X.default)??"")}Kn(x),$t(!0)},children:[o.jsx("span",{className:"material-symbols-outlined",children:"edit_note"}),e("flow:topbar.runWithParams")]}),o.jsxs("button",{type:"button",className:"af-run-dropdown-item",onClick:()=>{Ae(!1),Ui({prepareOnly:!0})},children:[o.jsx("span",{className:"material-symbols-outlined",children:"tune"}),e("flow:topbar.editRun")]}),o.jsx("div",{className:"af-run-dropdown-divider"}),o.jsxs("div",{className:"af-run-dropdown-section",children:[o.jsx("span",{className:"af-run-dropdown-section-label",children:e("flow:topbar.runWithPreset")}),o.jsxs("button",{type:"button",className:"af-run-dropdown-item",onClick:()=>{Ae(!1),Ui()},children:[o.jsx("span",{className:"material-symbols-outlined",children:"play_arrow"}),e("flow:runPreset.default")]}),Object.keys($n).map(x=>o.jsxs("button",{type:"button",className:"af-run-dropdown-item",onClick:()=>{var K;Ae(!1);const S=$n[x]||{},H={};for(const q of ui){const X=ec[q.id];if(!X)continue;const ee=((K=q.data)==null?void 0:K.definitionId)||"",te=S[q.id]??"";ee.startsWith("provide_file")?H[X]={type:"file",path:te}:H[X]={type:"str",value:te}}Ui({cliInputsOverride:H})},children:[o.jsx("span",{className:"material-symbols-outlined",children:"bookmark"}),x]},x))]})]})]})]})]}),ge?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:ge}),o.jsx("button",{type:"button",onClick:()=>lt(""),"aria-label":"关闭发布提示",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}):null,o.jsxs("div",{className:"af-pipeline-body"+(Re!=="edit"?" af-pipeline-body--run-mode":""),children:[Re==="edit"&&Qe!=="settings"?o.jsxs("aside",{className:"af-node-palette af-flow-left-panel",id:"af-node-palette","aria-label":e("flow:palette2.nodePalette"),children:[o.jsxs("div",{className:`af-palette-workspace${vr?" af-palette-workspace--expanded":""}`,children:[o.jsxs("button",{type:"button",className:"af-palette-workspace-head",onClick:()=>Wo(x=>!x),"aria-expanded":vr,children:[o.jsx("span",{className:"af-palette-workspace-icon material-symbols-outlined","aria-hidden":!0,children:"folder_open"}),o.jsx("span",{className:"af-palette-workspace-label",children:e("flow:palette.workspace")}),o.jsx("span",{className:"af-palette-workspace-chevron material-symbols-outlined","aria-hidden":!0,children:vr?"expand_less":"expand_more"})]}),o.jsx("div",{className:"af-palette-workspace-path",title:c&&(c.path||Zn.path)||"",children:c?c.id:e("flow:palette2.noPipelineSelected")}),vr&&o.jsx("div",{className:"af-palette-workspace-tree",children:Ai?o.jsx("div",{className:"af-palette-workspace-loading",children:e("flow:palette.loading")}):Zn.error?o.jsx("div",{className:"af-palette-workspace-empty",children:Zn.error}):c?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-palette-workspace-group",children:[o.jsxs("div",{className:"af-palette-workspace-group-head",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"folder"}),o.jsx("span",{children:c.id}),o.jsxs("span",{className:"af-palette-workspace-count",children:["(",Zn.files.length,")"]})]}),Zn.files.length>0?o.jsx("ul",{className:"af-palette-workspace-list",children:Zn.files.filter(x=>x.type==="file").map(x=>o.jsxs("li",{className:"af-palette-workspace-item af-palette-workspace-item--clickable",title:x.path,onClick:()=>Z({filePath:x.path,fileName:x.name}),children:[o.jsx("span",{className:"material-symbols-outlined af-palette-workspace-item-icon","aria-hidden":!0,children:x.icon}),o.jsx("span",{className:"af-palette-workspace-item-label",children:x.name}),x.size!=null&&o.jsx("span",{className:"af-palette-workspace-item-size",children:x.size<1024?`${x.size}B`:x.size<1024*1024?`${(x.size/1024).toFixed(1)}KB`:`${(x.size/1024/1024).toFixed(1)}MB`})]},x.path))}):Zn.files.filter(x=>x.type==="directory").length===0?o.jsx("div",{className:"af-palette-workspace-empty",children:"暂无文件"}):null]}),Zn.files.filter(x=>{var S;return x.type==="directory"&&((S=x.children)==null?void 0:S.length)>0}).map(x=>o.jsxs("div",{className:"af-palette-workspace-group af-palette-workspace-group--sub",children:[o.jsxs("div",{className:"af-palette-workspace-group-head",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:x.icon}),o.jsxs("span",{children:[x.name,"/"]}),o.jsxs("span",{className:"af-palette-workspace-count",children:["(",x.children.length,")"]})]}),o.jsx("ul",{className:"af-palette-workspace-list",children:x.children.map(S=>o.jsxs("li",{className:`af-palette-workspace-item${S.type==="file"?" af-palette-workspace-item--clickable":""}`,title:S.path,onClick:S.type==="file"?()=>Z({filePath:S.path,fileName:S.name}):void 0,children:[o.jsx("span",{className:"material-symbols-outlined af-palette-workspace-item-icon","aria-hidden":!0,children:S.icon}),o.jsx("span",{className:"af-palette-workspace-item-label",children:S.name}),S.type==="file"&&S.size!=null&&o.jsx("span",{className:"af-palette-workspace-item-size",children:S.size<1024?`${S.size}B`:S.size<1024*1024?`${(S.size/1024).toFixed(1)}KB`:`${(S.size/1024/1024).toFixed(1)}MB`})]},S.path))})]},x.path))]}):o.jsx("div",{className:"af-palette-workspace-empty",children:e("flow:palette2.noPipelineSelected")})})]}),o.jsxs("div",{className:"af-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:Ie==="flows"?"搜索流程片段":e("flow:palette.searchNodes")}),o.jsx("span",{className:"af-palette-search-icon material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{ref:nt,type:"search",className:"af-palette-search-input",value:Pe,onChange:x=>be(x.target.value),placeholder:(Ie==="flows"?"搜索流程片段":e("flow:palette.searchNodes"))+"…","aria-label":Ie==="flows"?"搜索流程片段":e("flow:palette.searchNodes")})]}),o.jsxs("div",{className:"af-palette-tabs",role:"tablist","aria-label":"Palette 类型",children:[o.jsxs("button",{type:"button",role:"tab","aria-selected":Ie==="nodes",className:"af-palette-tab"+(Ie==="nodes"?" af-palette-tab--active":""),onClick:()=>_e("nodes"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"category"}),"节点"]}),o.jsxs("button",{type:"button",role:"tab","aria-selected":Ie==="flows",className:"af-palette-tab"+(Ie==="flows"?" af-palette-tab--active":""),onClick:()=>_e("flows"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"account_tree"}),"流程"]})]})]}),d?o.jsx("p",{className:"af-err af-palette-list-err",children:d}):null,o.jsx("div",{className:"af-node-palette-scroll",children:Ie==="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:M2,disabled:!c||Cr.length<2,title:Cr.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:["已选 ",Cr.length," 节点 / ",tp.length," 连线"]})]})}),mt?o.jsx("p",{className:"af-err af-palette-list-err",children:mt}):null,Ct?o.jsx("p",{className:"af-palette-empty",children:"正在加载流程片段…"}):l0.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:l0.map(x=>{const S=`${x.id}@${x.version}`,H=x.displayName||x.name||x.id,K=x.description||`${x.nodeCount||0} 个节点,${x.edgeCount||0} 条连线`;return o.jsxs("button",{type:"button",className:"af-palette-card af-flow-snippet-card",onClick:()=>u0(x),draggable:!!c,onDragStart:q=>{q.dataTransfer.setData("application/agentflow-snippet",S),q.dataTransfer.effectAllowed="move"},disabled:!c,title:K,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:H}),o.jsxs("span",{className:"af-palette-card-id",children:[x.id,"@",x.version]})]})]}),K?o.jsx("span",{className:"af-palette-card-desc",children:K}):null,o.jsxs("span",{className:"af-flow-snippet-meta","aria-hidden":!0,children:[o.jsxs("span",{children:[x.nodeCount||0," nodes"]}),o.jsxs("span",{children:[x.edgeCount||0," edges"]})]})]},S)})})]}):o.jsx("p",{className:"af-palette-empty",children:Pe.trim()?"无匹配流程片段":"暂无流程片段。选择多个节点后发布。"})]}):o.jsxs(o.Fragment,{children:[ld.filter(x=>Wf[x].length>0).map(x=>o.jsxs("section",{className:`af-palette-section af-flow-palette-section--${x}`,children:[o.jsx("h3",{className:"af-palette-cat",children:x}),o.jsx("div",{className:"af-palette-cards",children:Wf[x].map(S=>{const H=mj(S.inputs,"input"),K=mj(S.outputs,"output"),X=S.id==="control_load_skills"?"从当前 Skills collection 或上游上下文自动注入 Skills,通常无需手填参数。":JI(S),ee=XI(S);return o.jsxs("button",{type:"button",className:"af-palette-card",onClick:()=>r0(S),draggable:!!c,onDragStart:te=>{te.dataTransfer.setData("application/agentflow-node",S.id),te.dataTransfer.effectAllowed="move"},disabled:!c,title:X||S.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:NU(x)})}),o.jsxs("span",{className:"af-palette-card-main",children:[o.jsx("span",{className:"af-palette-card-label",children:ee}),ee!==S.id?o.jsx("span",{className:"af-palette-card-id",children:S.id}):null]})]}),X?o.jsx("span",{className:"af-palette-card-desc",children:X}):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((te,pe)=>o.jsxs("span",{className:"af-palette-card-port",title:hj("input",te,pe),children:[o.jsx("span",{className:"af-palette-card-port-dot",style:{background:Xn(te==null?void 0:te.type)}}),o.jsx("span",{className:"af-palette-card-port-name",children:By(te,pe)})]},`in-${pe}`)),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:[K.list.length," OUT"]}),o.jsxs("span",{className:"af-palette-card-port-list",children:[K.shown.map((te,pe)=>o.jsxs("span",{className:"af-palette-card-port",title:hj("output",te,pe),children:[o.jsx("span",{className:"af-palette-card-port-name",children:By(te,pe)}),o.jsx("span",{className:"af-palette-card-port-dot",style:{background:Xn(te==null?void 0:te.type)}})]},`out-${pe}`)),K.hidden>0?o.jsxs("span",{className:"af-palette-card-port-more",children:["+",K.hidden]}):null]})]})]})]},S.id)})})]},x)),c&&ae.length===0?o.jsx("p",{className:"af-palette-empty",children:e("flow:palette.noComponents")}):null,c&&ae.length>0&&Pe.trim()&&i2===0?o.jsx("p",{className:"af-palette-empty",children:e("flow:palette.noMatch")}):null,c?null:o.jsx("p",{className:"af-palette-empty",children:e("flow:palette.selectPipeline")})]})}),o.jsxs("footer",{className:"af-palette-engine",children:[o.jsxs("div",{className:"af-palette-engine-head",children:[o.jsx("span",{className:"af-palette-engine-dot"+(ni?"":" af-palette-engine-dot--offline"),"aria-hidden":!0}),o.jsx("span",{className:"af-palette-engine-label",children:e(ni?"common:engine.online":"common:engine.offline")})]}),w?o.jsx("div",{className:"af-palette-tip"+l2,role:"status","aria-live":"polite",children:w}):null]})]}):Re!=="edit"&&c?o.jsx(fU,{flowId:c.id,flowSource:c.source||"user",flowArchived:c.archived,provideNodes:ui,edges:Cn,nodes:Pt,onCliInputsChange:V,onBackToEdit:il}):null,o.jsxs("div",{className:"af-pipeline-main-stack",children:[o.jsxs("div",{className:"af-pipeline-canvas-col",children:[y?o.jsx("div",{className:"af-banner af-banner--err af-pipeline-banner",children:y}):null,c&&Wi.length>0&&!U?o.jsxs("div",{className:"af-banner af-banner--warn af-flow-slot-warnings",role:"region","aria-label":e("flow:validation.flowWarningAriaLabel"),children:[o.jsxs("div",{className:"af-flow-slot-warnings-head",children:[o.jsx("div",{className:"af-flow-slot-warnings-title",children:e("flow:palette.validationWarnings")}),o.jsxs("div",{className:"af-flow-slot-warnings-head-actions",children:[o.jsx("button",{type:"button",className:"af-icon-btn",disabled:ue,"aria-label":e("flow:validation.reloadFromServer"),title:e("flow:validation.reloadFromServerShort"),onClick:()=>void n0(),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"refresh"})}),o.jsx("button",{type:"button",className:"af-icon-btn","aria-label":e("flow:validation.closeBanner"),title:e("common:common.close"),onClick:()=>se(!0),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]})]}),o.jsx("ul",{className:"af-flow-slot-warnings-list",children:Wi.map(x=>o.jsxs("li",{children:[e("flow:validation.nodePrefix"),' "',o.jsx("a",{href:"#",className:"af-flow-slot-warning-node-link","aria-label":e("flow:validation.focusNodeAriaLabel",{nodeId:x.nodeId}),onClick:S=>{S.preventDefault(),x2(x.nodeId)},children:x.nodeId}),'"',x.suffix]},x.key))})]}):null,c&&Wi.length>0&&U?o.jsxs("div",{className:"af-banner af-banner--warn af-flow-slot-warnings af-flow-slot-warnings--collapsed",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"af-flow-slot-warnings-collapsed-text",children:e("flow:validation.slotWarningCount",{count:Wi.length})}),o.jsxs("button",{type:"button",className:"af-flow-slot-warnings-kbd-hint",onClick:h0,title:e("flow:validation.shortcutHint"),children:[o.jsx("kbd",{children:"?"})," ",e("flow:validation.shortcutHintLabel")]}),o.jsxs("div",{className:"af-flow-slot-warnings-collapsed-actions",children:[o.jsx("button",{type:"button",className:"af-flow-slot-warnings-collapsed-btn",onClick:()=>se(!1),children:e("flow:validation.show")}),o.jsx("button",{type:"button",className:"af-flow-slot-warnings-collapsed-btn",disabled:ue,onClick:()=>void n0(),children:e("common:common.refresh")})]})]}):null,Qe==="settings"&&c&&Re==="edit"?B2():o.jsx("div",{className:"af-react-flow-wrap af-pipeline-flow",children:c?o.jsxs(o.Fragment,{children:[o.jsx(KU,{fitViewEpoch:h,canvasTool:Su,nodes:t2,edges:n2,onNodesChange:Re!=="edit"?void 0:JT,onEdgesChange:Re!=="edit"?void 0:QT,onConnect:Re!=="edit"?void 0:p2,onConnectStart:Re!=="edit"?void 0:h2,onConnectEnd:Re!=="edit"?void 0:m2,isValidConnection:Re!=="edit"?void 0:f2,onNodesDelete:Re!=="edit"?void 0:g2,onNodeClick:c2,onNodeDoubleClick:u2,onEdgeClick:d2,onFlowInit:y2,onDrop:k2,onDragOver:v2,hideMinimapAndControls:!!(c&&Qe),bottomSlot:Re==="edit"?o.jsx("div",{className:"af-bottom-composer-stack af-flow-bottom-composer",children:o.jsxs("div",{className:"af-pipeline-composer-inner",children:[o.jsx("div",{className:"af-composer-selected","aria-label":e("flow:composer.selectedNodesAriaLabel"),children:np.length===0?o.jsx("span",{className:"af-composer-selected-empty",children:e("flow:composer.selectedNodesEmpty")}):np.map((x,S)=>{var pe,we;if(x.kind==="definition"){const Fe=x.definition,ce=String(Fe.label??Fe.id),Oe=[Fe.id,Fe.description?String(Fe.description).slice(0,120):""].filter(Boolean).join(" — ");return o.jsxs("div",{className:"af-composer-node-chip af-composer-node-chip--definition",title:Oe,children:[o.jsx("span",{className:"af-composer-node-chip-label",children:ce}),o.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>p0(x),"aria-label":e("flow:composer.removeFromInput",{id:Fe.id}),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},`def-${Fe.id}`)}const H=x.node,K=x.kind,q=String(((pe=H.data)==null?void 0:pe.label)??H.id),X=(we=H.data)!=null&&we.definitionId?String(H.data.definitionId):"",ee=X&&X!==q?`${q} · ${H.id} · ${X}`:`${q} · ${H.id}`,te=K==="canvas"?e("flow:composer.deselectNode",{id:H.id}):e("flow:composer.removeFromInput",{id:H.id});return o.jsxs("div",{className:"af-composer-node-chip"+(K==="mention"?" af-composer-node-chip--mention":""),title:ee,children:[o.jsx("span",{className:"af-composer-node-chip-label",children:q}),o.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>p0(x),"aria-label":te,children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},H.id)})}),o.jsxs("div",{className:"af-composer-card af-composer-card--input-only",children:[o.jsxs("div",{className:"af-composer-input-wrap",children:[o.jsx("textarea",{ref:Yo,className:"af-composer-textarea",placeholder:e("flow:composer.inputPlaceholder"),disabled:!c,value:es,rows:2,onChange:x=>{yo(x.target.value),li(x.target.selectionStart??x.target.value.length)},onSelect:x=>{const S=x.target;S instanceof HTMLTextAreaElement&&li(S.selectionStart??0)},onKeyDown:x=>{if((x.metaKey||x.ctrlKey)&&x.key==="Enter"){x.preventDefault(),ol();return}if(Ru&&di.length>0&&(x.key==="ArrowDown"||x.key==="ArrowUp"||x.key==="Enter")){if(x.key==="ArrowDown")x.preventDefault(),Za(S=>(S+1)%di.length);else if(x.key==="ArrowUp")x.preventDefault(),Za(S=>(S-1+di.length)%di.length);else if(x.key==="Enter"){x.preventDefault();const S=di[Qa];S&&Lg(S.id)}}},onKeyUp:x=>{const S=x.target;S instanceof HTMLTextAreaElement&&li(S.selectionStart??S.value.length)},onClick:x=>{const S=x.target;S instanceof HTMLTextAreaElement&&li(S.selectionStart??0)},"aria-label":e("flow:composer.inputAriaLabel"),autoComplete:"off",spellCheck:!1}),Ru&&c&&di.length>0?o.jsxs("ul",{className:"af-composer-mention-menu",role:"listbox","aria-label":e("flow:composer.mentionAriaLabel"),children:[Lu.instances.length>0?o.jsx("li",{className:"af-composer-mention-section",role:"presentation",children:o.jsx("div",{className:"af-composer-mention-section-title",children:"Instances"})}):null,Lu.instances.map((x,S)=>{const H=S;return o.jsx("li",{role:"option","aria-selected":H===Qa,children:o.jsxs("button",{type:"button",className:"af-composer-mention-item"+(H===Qa?" af-composer-mention-item--active":""),onMouseDown:K=>K.preventDefault(),onMouseEnter:()=>Za(H),onClick:()=>Lg(x.id),children:[o.jsx("span",{className:"af-composer-mention-id",children:x.title}),x.subtitle?o.jsx("span",{className:"af-composer-mention-sub",children:x.subtitle}):null]})},`i-${x.id}`)}),Lu.definitions.length>0?o.jsx("li",{className:"af-composer-mention-section",role:"presentation",children:o.jsx("div",{className:"af-composer-mention-section-title",children:"Node"})}):null,Lu.definitions.map((x,S)=>{const H=Lu.instances.length+S;return o.jsx("li",{role:"option","aria-selected":H===Qa,children:o.jsxs("button",{type:"button",className:"af-composer-mention-item"+(H===Qa?" af-composer-mention-item--active":""),onMouseDown:K=>K.preventDefault(),onMouseEnter:()=>Za(H),onClick:()=>Lg(x.id),children:[o.jsx("span",{className:"af-composer-mention-id",children:x.title}),x.subtitle?o.jsx("span",{className:"af-composer-mention-sub",children:x.subtitle}):null]})},`d-${x.id}`)})]}):null]}),o.jsxs("div",{className:"af-composer-toolbar",children:[Y.length>0&&o.jsx("label",{className:"af-composer-session-field",children:o.jsxs("select",{className:"af-composer-session-select",value:Q||"",onChange:x=>{x.target.value==="__new__"?it():Vs(x.target.value)},disabled:Xe,"aria-label":e("flow:composer.switchConversation"),children:[Y.map(x=>o.jsxs("option",{value:x.id,children:[x.label,x.running?" ⏳":""]},x.id)),o.jsxs("option",{value:"__new__",children:["+ ",e("flow:composer.newConversation")]})]})}),o.jsxs("div",{className:"af-composer-skills-field",children:[o.jsxs("button",{ref:_u,type:"button",className:"af-composer-skills-button"+(Rg>0?" af-composer-skills-button--active":""),disabled:!c||Xe,"aria-haspopup":"listbox","aria-expanded":nl,onClick:()=>Jl(x=>!x),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"extension"}),o.jsx("span",{children:Rg>0?`Skills ${Rg}`:"Skills"})]}),nl&&!Xe?os.createPortal(o.jsx("div",{ref:Pu,className:"af-composer-skills-menu",role:"listbox","aria-label":"Composer skills",style:Rr,children:ci.length===0?o.jsx("div",{className:"af-composer-skills-empty",children:"No skills found"}):o.jsxs(o.Fragment,{children:[rp.groups.map(x=>{const S=Ta(x,ci),H=i_(x,Tg,ci),K=wg.has(x.id);return o.jsxs("div",{className:"af-composer-skill-group af-composer-skill-group--framed"+(K?" 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:H==="all",disabled:S.length===0,onChange:q=>{const X=q.target.checked;Qo(ee=>X?r_(ee,S):s_(ee,S))}}),o.jsxs("span",{className:"af-composer-skill-group-title-main",children:[o.jsx("span",{children:x.name}),x.builtin?o.jsx("em",{children:"built-in"}):null,H==="partial"?o.jsx("em",{children:"partial"}):null]})]}),o.jsxs("button",{type:"button",className:"af-composer-skill-group-toggle","aria-label":K?`展开 ${x.name}`:`收起 ${x.name}`,onClick:()=>{bg(q=>{const X=new Set(q);return X.has(x.id)?X.delete(x.id):X.add(x.id),X})},children:[o.jsx("span",{children:x.skills.length}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:K?"expand_more":"expand_less"})]})]}),K?null:o.jsx("div",{className:"af-composer-skill-group-items",children:x.skills.map(q=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:Tg.has(q.key),onChange:X=>{const ee=X.target.checked;Qo(te=>ee?te.includes(q.key)?te:[...te,q.key]:te.filter(pe=>pe!==q.key))}}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:q.name}),q.description?o.jsx("span",{className:"af-composer-skill-option-desc",children:q.description}):null]})]},`${x.id}:${q.key}`))})]},x.id)}),rp.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:rp.ungrouped.length})]}),rp.ungrouped.map(x=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:Tg.has(x.key),onChange:S=>{const H=S.target.checked;Qo(K=>H?K.includes(x.key)?K:[...K,x.key]:K.filter(q=>q!==x.key))}}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:x.name}),x.description?o.jsx("span",{className:"af-composer-skill-option-desc",children:x.description}):null]})]},`ungrouped:${x.key}`))]}):null]})}),document.body):null]}),o.jsxs("label",{className:"af-composer-model-field",children:[o.jsx("span",{className:"af-visually-hidden",children:e("flow:composer.modelLabel")}),o.jsxs("select",{className:"af-composer-model-select",value:(Hs||"").trim()?ns.currentNotInLists?ns.currentNotInLists:zp(Hs,ns.cursorList,ns.opencodeList,ns.claudeCodeList):"",onChange:x=>Ws(x.target.value),disabled:!c||Xe,"aria-label":e("flow:composer.modelAriaLabel"),children:[o.jsx("option",{value:"",children:e("flow:composer.modelDefault")}),ns.currentNotInLists?o.jsxs("option",{value:ns.currentNotInLists,children:[ns.currentNotInLists,e("flow:composer.modelNotInList")]}):null,ns.cursorList.length>0?o.jsx("optgroup",{label:"Cursor",children:ns.cursorList.map(x=>o.jsx("option",{value:jo(x),children:x},`composer-c-${x}`))}):null,ns.opencodeList.length>0?o.jsx("optgroup",{label:"OpenCode",children:ns.opencodeList.map(x=>o.jsx("option",{value:`opencode:${jo(x)}`,children:x},`composer-o-${x}`))}):null,ns.claudeCodeList.length>0?o.jsx("optgroup",{label:"Claude Code",children:ns.claudeCodeList.map(x=>o.jsx("option",{value:`claude-code:${jo(x)}`,children:x},`composer-cc-${x}`))}):null]})]}),o.jsx("button",{type:"button",className:"af-composer-send"+(c&&es.trim()&&!Xe?" af-composer-send--active":"")+(Xe?" af-composer-send--stop":""),disabled:!c||!Xe&&!es.trim(),"aria-label":e(Xe?"flow:composer.stopGeneration":"flow:composer.send"),title:Xe?e("flow:composer.stopGeneration"):void 0,onClick:()=>{var x;if(Xe){(x=jr.current)==null||x.abort();return}ol()},children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:Xe?"stop":"arrow_upward"})})]})]}),It?os.createPortal(o.jsx("div",{className:"af-node-props-expand-overlay af-composer-thread-dialog-overlay",role:"dialog","aria-modal":"true","aria-label":e("flow:composer.conversationOutput"),onMouseDown:x=>{x.target===x.currentTarget&&on(!1)},children:o.jsxs("div",{className:"af-node-props-expand-panel af-composer-thread-dialog-panel",children:[o.jsxs("div",{className:"af-node-props-expand-head af-composer-thread-dialog-head",children:[o.jsxs("div",{className:"af-composer-thread-dialog-head-main",children:[o.jsx("span",{className:"af-node-props-expand-title",children:e("flow:nodeProps.conversationOutput")}),o.jsx("div",{className:"af-composer-thread-dialog-status"+(Xe?" af-composer-thread-dialog-status--running":""),role:"status","aria-live":"polite",title:Vt||void 0,children:Xe&&!Vt?e("flow:composer.executing"):Vt||e("flow:composer.ready")})]}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>on(!1),"aria-label":e("flow:composer.collapseAriaLabel"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),Nr.length>1&&!(Le&&Array.isArray(Le.phases)&&Le.phases.length>1)?o.jsx("div",{className:"af-composer-steps-track-wrap",children:o.jsx(RU,{steps:Nr})}):null,Le&&Array.isArray(Le.phases)&&Le.phases.length>1?o.jsx("div",{className:"af-composer-phase-bar","aria-label":e("flow:composer.phaseProgress"),children:Le.phases.map((x,S)=>{const H=x.status||(S<(Le.currentPhase??0)?"done":S===(Le.currentPhase??0)?Xe?"running":Le.nextPhase||Le.isLastPhase?"done":"running":"pending");return o.jsxs("div",{className:"af-composer-phase-item"+(H==="done"?" af-composer-phase-item--done":"")+(H==="running"?" af-composer-phase-item--running":"")+(H==="pending"?" af-composer-phase-item--pending":""),title:`${x.label}${x.description?":"+x.description:""}`,children:[o.jsx("span",{className:"af-composer-phase-dot","aria-hidden":!0,children:H==="done"?o.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"0.85rem"},children:"check"}):o.jsx("span",{children:S+1})}),o.jsx("span",{className:"af-composer-phase-label",children:x.label})]},x.name||S)})}):null,o.jsx("div",{className:"af-composer-thread-dialog-scroll",children:o.jsx(xj,{thread:yn,liveSegments:gn,running:Xe})}),Le&&!Le.isLastPhase&&Le.nextPhase&&!Xe?o.jsxs("div",{className:"af-composer-phase-review af-composer-phase-review--minimal","aria-label":e("flow:composer.phaseReviewLabel"),children:[o.jsx("span",{className:"af-composer-phase-auto-hint",children:e("flow:composer.phaseReviewHint",{nextPhase:Le.nextPhase.label})}),o.jsxs("div",{className:"af-composer-phase-review-buttons",children:[o.jsx("button",{type:"button",className:"af-composer-phase-btn af-composer-phase-btn--continue",onClick:f0,children:e("flow:composer.phaseReviewContinue",{label:Le.nextPhase.label})}),o.jsx("button",{type:"button",className:"af-composer-phase-btn af-composer-phase-btn--skip",onClick:d0,children:e("flow:composer.phaseReviewSkip")})]})]}):null]})}),document.body):null]})}):null}),ts&&Re==="edit"?(()=>{var K;const x=String(ts.query||"").trim().toLowerCase(),S=x?ts.candidates.filter(q=>{var X,ee,te;return[(X=q.def)==null?void 0:X.id,q.displayLabel,q.description,(ee=q.slot)==null?void 0:ee.name,(te=q.slot)==null?void 0:te.type].filter(Boolean).some(pe=>String(pe).toLowerCase().includes(x))}):ts.candidates,H=ts.draft.handleType==="source"?"IN":"OUT";return o.jsxs("div",{className:"af-connect-node-menu",style:{left:ts.left,top:ts.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:Xn((K=ts.draft.slot)==null?void 0:K.type)},"aria-hidden":!0}),o.jsxs("span",{children:["匹配 ",ts.draft.slotType," 节点"]})]}),o.jsx("button",{type:"button",className:"af-connect-node-menu__close","aria-label":"关闭",onClick:()=>bo(null),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),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:ts.query,onChange:q=>bo(X=>X&&{...X,query:q.target.value}),placeholder:"搜索节点",autoFocus:!0})]}),o.jsxs("div",{className:"af-connect-node-menu__list",children:[S.map(q=>{var te,pe;const X=q.displayLabel||((te=q.def)==null?void 0:te.id),ee=By(q.slot,q.slotIndex);return o.jsxs("button",{type:"button",className:"af-connect-node-menu__item",onClick:()=>b2(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:X}),X!==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:H}),o.jsx("span",{className:"af-connect-node-menu__port-dot",style:{background:Xn((pe=q.slot)==null?void 0:pe.type)},"aria-hidden":!0}),o.jsx("span",{className:"af-connect-node-menu__port-name",children:ee})]})]},`${q.def.id}-${q.slotIndex}`)}),S.length===0?o.jsx("div",{className:"af-connect-node-menu__empty",children:"没有匹配结果"}):null]})]})})():null]}):o.jsx("div",{className:"af-placeholder af-pipeline-placeholder",children:e("flow:pipeline.selectPipeline")})})]}),Re!=="edit"&&tr&&o.jsxs("div",{className:"af-run-console",style:{height:ri},children:[o.jsx("div",{className:"af-run-console__resize",role:"separator","aria-orientation":"horizontal","aria-label":e("flow:run.resizeConsole"),onPointerDown:C2,onPointerMove:E2,onPointerUp:o0,onPointerCancel:o0,onLostPointerCapture:_2}),o.jsxs("div",{className:"af-run-console__head",children:[o.jsxs("span",{className:"af-run-console__title",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"terminal"}),"EXECUTION CONSOLE"]}),o.jsxs("div",{className:"af-run-console__head-right",children:[Re==="running"&&o.jsx("span",{className:"af-run-console__live-badge",children:"LIVE"}),o.jsx("button",{type:"button",className:"af-icon-btn af-run-console__close",onClick:()=>Br(!1),"aria-label":e("flow:run.closeLog"),children:o.jsx("span",{className:"material-symbols-outlined",children:"expand_more"})})]})]}),o.jsxs("div",{className:"af-run-console__body",children:[er.map((x,S)=>o.jsxs("div",{className:"af-run-console__line"+(x.type==="error"?" af-run-console__line--error":"")+(x.type==="warn"?" af-run-console__line--warn":"")+(x.type==="node-start"?" af-run-console__line--start":"")+(x.type==="node-done"?" af-run-console__line--done":"")+(x.type==="node-failed"?" af-run-console__line--error":"")+(x.type==="done"?" af-run-console__line--done":""),children:[o.jsxs("span",{className:"af-run-console__ts",children:["[",x.ts?new Date(x.ts).toLocaleTimeString():"--:--:--","]"]}),o.jsx("span",{className:"af-run-console__text",children:x.text!=null?String(x.text):""})]},S)),o.jsx("div",{ref:Va})]})]})]}),Re!=="edit"&&ii&&c?o.jsx(lU,{instanceId:ii,flowId:c.id,runId:tn,nodeStatus:((m0=ks[ii])==null?void 0:m0.status)??null,onClose:()=>Tr(null)}):null,Qe&&Qe!=="settings"&&c&&Re==="edit"?o.jsx("aside",{className:"af-pipeline-drawer"+(Qe==="node"?" af-pipeline-drawer--wide":"")+(Qe==="composer"?" af-pipeline-drawer--wide":""),"aria-label":Qe==="settings"?e("flow:settings.title"):Qe==="history"?e("flow:history.title"):Qe==="composer"?"AI Composer":e("flow:nodeProps.title"),children:Qe==="composer"?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:Ou,"aria-label":e("flow:composer.closeSidebar"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),Y.length>0&&o.jsxs("div",{className:"af-composer-session-tabs",children:[Y.map(x=>o.jsxs("button",{type:"button",ref:S=>{S&&x.id===Q&&S.scrollIntoView({block:"nearest",inline:"nearest"})},className:["af-composer-session-tab",x.id===Q?"af-composer-session-tab--active":"",x.running?"af-composer-session-tab--running":""].filter(Boolean).join(" "),onClick:()=>Vs(x.id),title:x.label,children:[o.jsx("span",{className:"af-composer-session-label",children:x.label}),o.jsx("span",{className:"af-composer-session-close",role:"button",tabIndex:0,onClick:S=>{S.stopPropagation(),$e(x.id)},onKeyDown:S=>{S.key!=="Enter"&&S.key!==" "||(S.preventDefault(),S.stopPropagation(),$e(x.id))},title:x.running?e("flow:composer.endConversation"):e("flow:composer.closeConversation"),children:o.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"0.75rem"},children:"close"})})]},x.id)),o.jsx("button",{type:"button",className:"af-composer-session-add",onClick:()=>it(),title:e("flow:composer.newConversation"),children:o.jsx("span",{className:"material-symbols-outlined",children:"add"})})]}),o.jsx("div",{className:"af-composer-sidebar-status"+(Xe?" af-composer-sidebar-status--running":""),role:"status","aria-live":"polite",children:Xe&&!Vt?e("flow:composer.executing"):Vt||e("flow:composer.ready")}),Le&&Array.isArray(Le.phases)&&Le.phases.length>1?o.jsx("div",{className:"af-composer-phase-bar","aria-label":e("flow:composer.phaseProgress"),children:Le.phases.map((x,S)=>{const H=x.status||(S<(Le.currentPhase??0)?"done":S===(Le.currentPhase??0)?Xe?"running":Le.isLastPhase&&S===Le.phases.length-1||Le.nextPhase?"done":"running":"pending");return o.jsxs("div",{className:"af-composer-phase-item"+(H==="done"?" af-composer-phase-item--done":"")+(H==="running"?" af-composer-phase-item--running":"")+(H==="pending"?" af-composer-phase-item--pending":""),title:`${x.label}${x.description?":"+x.description:""}`,children:[o.jsx("span",{className:"af-composer-phase-dot","aria-hidden":!0,children:H==="done"?o.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"0.85rem"},children:"check"}):o.jsx("span",{children:S+1})}),o.jsx("span",{className:"af-composer-phase-label",children:x.label})]},x.name||S)})}):null,o.jsx("div",{className:"af-composer-sidebar-thread",ref:ft,children:o.jsx(xj,{thread:yn,liveSegments:gn,running:Xe})}),Le&&!Le.isLastPhase&&Le.nextPhase&&!Xe?o.jsxs("div",{className:"af-composer-phase-review af-composer-phase-review--minimal","aria-label":e("flow:composer.phaseReviewLabel"),children:[o.jsx("span",{className:"af-composer-phase-auto-hint",children:e("flow:composer.phaseReviewHint",{nextPhase:Le.nextPhase.label})}),o.jsxs("div",{className:"af-composer-phase-review-buttons",children:[o.jsx("button",{type:"button",className:"af-composer-phase-btn af-composer-phase-btn--continue",onClick:f0,children:e("flow:composer.phaseReviewContinue",{label:Le.nextPhase.label})}),o.jsx("button",{type:"button",className:"af-composer-phase-btn af-composer-phase-btn--skip",onClick:d0,children:e("flow:composer.phaseReviewSkip")})]})]}):null]}):Qe==="node"&&dt?St?o.jsx(UI,{draft:St,setDraft:ju,definitionId:String(((g0=dt.data)==null?void 0:g0.definitionId)??dt.id),systemPromptReadonly:String((Ng==null?void 0:Ng.description)??""),modelLists:wt,disabled:!c,onIdBlur:j2,onClose:Ou,onPublishToMarketplace:a2,error:Xo,ioSlots:{inputs:Array.isArray(St==null?void 0:St.inputs)?St.inputs:[],outputs:Array.isArray(St==null?void 0:St.outputs)?St.outputs:[]}}):o.jsx("div",{className:"af-pipeline-drawer-body",children:o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:pipeline.loadingProps")})}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-pipeline-drawer-head",children:[o.jsx("h2",{className:"af-pipeline-drawer-title",children:e(Qe==="settings"?"flow:settings.title":"flow:history.title")}),o.jsx("button",{type:"button",className:"af-pipeline-drawer-close af-icon-btn",onClick:Ou,"aria-label":e("flow:composer.closeSidebar"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx("div",{className:"af-pipeline-drawer-body",children:Qe==="settings"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.pipelineId")}),(c.source==="user"||c.source==="workspace")&&!c.archived?o.jsxs("div",{className:"af-pipeline-rename-row",children:[o.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:M,onChange:x=>{z(x.target.value),T("")},onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),Jf())},onBlur:()=>{M.trim()&&M.trim()!==c.id&&Jf()},placeholder:c.id,disabled:$,spellCheck:!1}),o.jsx("span",{className:"af-pipeline-drawer-badge",children:cc(c.source??"user",e)})]}):o.jsxs("div",{className:"af-pipeline-drawer-readonly",children:[c.id,o.jsx("span",{className:"af-pipeline-drawer-badge",children:cc(c.source??"user",e)}),c.archived?o.jsx("span",{className:"af-pipeline-drawer-badge af-pipeline-drawer-badge--muted",children:e("flow:settings.archived")}):null]}),F?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:F}):null]}),typeof c.path=="string"&&c.path?o.jsxs("div",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.diskPath")}),o.jsxs("div",{className:"af-pipeline-drawer-readonly af-pipeline-drawer-readonly--mono af-pipeline-path-row",children:[o.jsx("span",{className:"af-pipeline-path-text",children:c.path}),o.jsx("button",{type:"button",className:"af-icon-btn af-pipeline-copy-btn",onClick:()=>s0(c.path),title:e("flow:settings.copyPath"),children:o.jsx("span",{className:"material-symbols-outlined",children:O?"check":"content_copy"})})]})]}):null,c.source==="user"||c.source==="workspace"?c.archived?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.archivedNote")}):o.jsxs("div",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.storageLocation")}),o.jsx("div",{className:"af-pipeline-move-actions",children:c.source==="user"?o.jsx("button",{type:"button",className:"af-btn-secondary",disabled:R,onClick:()=>Xf("workspace"),children:e(R?"flow:settings.moveBusy":"flow:settings.moveToWorkspace")}):o.jsx("button",{type:"button",className:"af-btn-secondary",disabled:R,onClick:()=>Xf("user"),children:e(R?"flow:settings.moveBusy":"flow:settings.moveToUserDir")})}),C?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:C}):null]}):o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.builtinNote")}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.introduction")}),o.jsx("textarea",{className:"af-pipeline-drawer-textarea",value:v,onChange:x=>k(x.target.value),placeholder:e("flow:pipeline.introductionPlaceholder"),rows:5,spellCheck:!1})]}),o.jsxs("div",{className:"af-pipeline-meta-card",children:[o.jsx("h3",{className:"af-pipeline-meta-title",children:e("flow:schedule.title")}),zl?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("common:common.loading")}):o.jsxs(o.Fragment,{children:[o.jsxs("label",{className:"af-new-pipeline-radio",children:[o.jsx("input",{type:"checkbox",checked:!!nr.enabled,disabled:oi||c.archived||Ks(c.source),onChange:x=>Zo(S=>({...S,enabled:x.target.checked}))}),o.jsx("span",{children:e("flow:schedule.enabled")})]}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.cron")}),o.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:nr.cron||"",disabled:oi||c.archived||Ks(c.source),onChange:x=>Zo(S=>({...S,cron:x.target.value})),placeholder:"0 9 * * *",spellCheck:!1})]}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.timezone")}),o.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:nr.timezone||"",disabled:oi||c.archived||Ks(c.source),onChange:x=>Zo(S=>({...S,timezone:x.target.value})),placeholder:"Asia/Shanghai",spellCheck:!1})]}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.preset")}),o.jsxs("select",{className:"af-pipeline-flow-select",value:nr.preset||"",disabled:oi||c.archived||Ks(c.source),onChange:x=>Zo(S=>({...S,preset:x.target.value})),children:[o.jsx("option",{value:"",children:e("flow:schedule.defaultPreset")}),Object.keys($n).map(x=>o.jsx("option",{value:x,children:x},x))]})]}),o.jsx("div",{className:"af-pipeline-drawer-readonly",children:o.jsx("span",{children:e("flow:schedule.overlapSkip")})}),nr.nextRunAt?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.nextRun",{time:new Date(nr.nextRunAt).toLocaleString()})}):o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.noNextRun")}),o.jsxs("dl",{className:"af-pipeline-meta-dl",children:[o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.runtime")}),o.jsx("dd",{children:Dn!=null&&Dn.running?e("flow:schedule.running"):nr.enabled?e("flow:schedule.waiting"):e("flow:schedule.disabled")})]}),Wt.lastTriggeredAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastTriggeredAt")}),o.jsx("dd",{children:new Date(Wt.lastTriggeredAt).toLocaleString()})]}):null,Wt.lastSkippedAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastSkippedAt")}),o.jsxs("dd",{children:[new Date(Wt.lastSkippedAt).toLocaleString(),Wt.lastSkipReason?` · ${Wt.lastSkipReason}`:""]})]}):null,Wt.lastRunUuid?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastRun")}),o.jsx("dd",{children:Wt.lastRunUuid})]}):null,Wt.lastExitCode!=null?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastExit")}),o.jsx("dd",{children:String(Wt.lastExitCode)})]}):null,Wt.lastFinishedAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastFinishedAt")}),o.jsx("dd",{children:new Date(Wt.lastFinishedAt).toLocaleString()})]}):null]}),Dn!=null&&Dn.lastError||Wt.lastError?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:(Dn==null?void 0:Dn.lastError)||Wt.lastError}):null,c.archived||Ks(c.source)?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.readonlyNote")}):null,Qr?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:Qr}):null,Wa?o.jsx("p",{className:"af-pipeline-drawer-muted",children:Wa}):null,o.jsx("button",{type:"button",className:"af-btn-secondary",disabled:oi||c.archived||Ks(c.source),onClick:Eg,children:e(oi?"flow:schedule.saving":"flow:schedule.save")})]})]}),o.jsxs("div",{className:"af-pipeline-meta-card",children:[o.jsx("h3",{className:"af-pipeline-meta-title",children:e("flow:pipeline.metadata")}),o.jsx("dl",{className:"af-pipeline-meta-dl",children:o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:pipeline.nodeCount")}),o.jsxs("dd",{children:[Pt.length," ",e("flow:pipeline.nodesUnit")]})]})})]}),o.jsx("button",{type:"button",className:"af-pipeline-drawer-link",onClick:()=>n("/settings"),children:e("flow:settings.globalSettings")})]}):o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"af-pipeline-drawer-lead",children:[e("flow:settings.currentPipeline"),o.jsx("strong",{children:c.id})]}),sn?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("common:common.loading")}):Mt?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:Mt}):Tu.length===0?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:pipeline.noRuns")}):o.jsxs(o.Fragment,{children:[Hr.success+Hr.failed+Hr.running+Hr.stopped+Hr.interrupted>0?o.jsxs("div",{className:"af-exec-history-summary","aria-label":e("flow:history.summary"),children:[Hr.success>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--success",children:e("flow:history.successCount",{count:Hr.success})}):null,Hr.failed>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--failed",children:e("flow:history.failedCount",{count:Hr.failed})}):null,Hr.stopped>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--stopped",children:e("flow:history.stoppedCount",{count:Hr.stopped})}):null,Hr.interrupted>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--interrupted",children:e("flow:history.interruptedCount",{count:Hr.interrupted})}):null,Hr.running>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--running",children:e("flow:history.runningCount",{count:Hr.running})}):null]}):null,o.jsx("ul",{className:"af-exec-history-list",children:Tu.map((x,S)=>{const H=x.status||"unknown",K=H==="success"?"af-exec-history-card--success":H==="failed"?"af-exec-history-card--failed":H==="stopped"?"af-exec-history-card--stopped":H==="interrupted"?"af-exec-history-card--interrupted":H==="running"?"af-exec-history-card--running":"af-exec-history-card--unknown",q=e(H==="success"?"flow:history.success":H==="failed"?"flow:history.failed":H==="stopped"?"flow:history.stopped":H==="interrupted"?"flow:history.interrupted":H==="running"?"flow:history.running":"flow:history.unknown"),X=H==="success"?"check_circle":H==="failed"?"error":H==="stopped"?"stop_circle":H==="interrupted"?"sync_disabled":H==="running"?"progress_activity":"help",ee=x.runId||`${x.at}-${S}`,te=x.runId!=null&&x.runId.length>=6?e("flow:history.runLabel",{id:x.runId.length>8?x.runId.slice(-8):x.runId}):e("flow:history.runLabel",{id:Tu.length-S});return o.jsx("li",{className:"af-exec-history-list-item",children:o.jsxs("button",{type:"button",className:`af-exec-history-card ${K}`,onClick:()=>O2(x),title:e("flow:history.enterRunView"),children:[o.jsxs("div",{className:"af-exec-history-card-top",children:[o.jsx("span",{className:"af-exec-history-card-title",children:te}),o.jsx("span",{className:"af-exec-history-card-time",children:Qx(x.at,e)})]}),o.jsxs("div",{className:"af-exec-history-card-bottom",children:[o.jsxs("span",{className:"af-exec-history-card-status",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:X}),q]}),o.jsxs("span",{className:"af-exec-history-card-duration",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"timer"}),WO(x.durationMs,e)]})]})]})},`${c.id}-${ee}`)})})]})]})})]})}):null]}),o.jsx(QN,{open:P2,title:e("flow:run.pauseTitle",{defaultValue:"暂停运行"}),message:e("flow:run.pauseConfirm"),confirmLabel:e("flow:run.pauseConfirmOk",{defaultValue:"暂停"}),onConfirm:I2,onCancel:()=>Ag(!1)}),o.jsx(QN,{open:T2,title:e("flow:run.backPromptTitle",{defaultValue:"返回项目列表"}),message:e("flow:run.backPromptMessage",{defaultValue:"流水线仍在运行,请选择处理方式:后台继续运行并退出,或停止后返回编辑。"}),confirmLabel:e("flow:run.backBackground",{defaultValue:"后台运行并退出"}),secondaryLabel:e("flow:run.backStopEdit",{defaultValue:"停止并进入编辑"}),secondaryDestructive:!0,onConfirm:L2,onSecondary:R2,onCancel:()=>ep(!1)}),o.jsx(zI,{open:qn,onClose:()=>Fi(!1)}),H2(),o.jsx(q7,{open:Nu,onClose:()=>ql(!1),onJump:w2,nodes:Pt}),o.jsx(xU,{open:Ii,onClose:()=>Ss(!1),flowId:(c==null?void 0:c.id)??""}),o.jsx(W7,{open:B,onClose:()=>P(!1),flowId:(c==null?void 0:c.id)??"",flowSource:(c==null?void 0:c.source)??"user",onArchived:async()=>{P(!1),await Uf(),n("/projects?tab=archived")}}),o.jsx(V7,{open:L&&!!(c!=null&&c.id),onClose:()=>_(!1),flowId:(c==null?void 0:c.id)??"",flowSource:(c==null?void 0:c.source)??"user",flowArchived:!!(c!=null&&c.archived),onDeleted:async()=>{_(!1),p(null),kt([]),ln([]),dr(null),await Uf(),n("/projects")}}),De&&os.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:()=>en(!1),"aria-label":e("common:common.close"),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:rn.name,onChange:x=>{const S=x.target.value;pn(H=>({...H,name:S,id:H.id?H.id:S.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")}))},placeholder:"例如:PR 检查片段",autoFocus:!0})]}),o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"ID"}),o.jsx("input",{type:"text",value:rn.id,onChange:x=>pn(S=>({...S,id:x.target.value})),placeholder:"pr-check-snippet"})]}),o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"说明"}),o.jsx("textarea",{value:rn.description,onChange:x=>pn(S=>({...S,description:x.target.value})),placeholder:"这段流程适合什么场景、需要接哪些上下游。",rows:4})]}),o.jsxs("div",{className:"af-flow-snippet-summary",children:["将发布 ",Cr.length," 个节点和 ",tp.length," 条内部连线。"]}),ve?o.jsx("div",{className:"af-flow-snippet-error",children:ve}):null]}),o.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>en(!1),children:"取消"}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:Hn||!rn.name.trim(),onClick:()=>void $2(),children:Hn?"发布中…":"发布"})]})]})}),document.body),o.jsx(Y7,{open:!!G,onClose:()=>Z(null),flowId:(c==null?void 0:c.id)??"",flowSource:(c==null?void 0:c.source)??"user",flowArchived:!!(c!=null&&c.archived),filePath:(G==null?void 0:G.filePath)??"",fileName:(G==null?void 0:G.fileName)??"",onSaved:()=>{vs(x=>({...x}))}})]}),mr&&Re!=="edit"&&os.createPortal(o.jsx("div",{className:"af-user-check-modal-overlay",children:o.jsxs("div",{className:"af-user-check-modal",role:"dialog","aria-modal":"true",children:[o.jsxs("div",{className:"af-user-check-modal__head",children:[o.jsxs("span",{className:"af-user-check-modal__title",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"fact_check"}),e("flow:userCheck.title",{instanceId:mr.instanceId})]}),o.jsx("div",{className:"af-user-check-modal__actions",children:qa?o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:"af-user-check-modal__btn af-user-check-modal__btn--save",onClick:async()=>{if(!mr||!c||!tn)return;const x=Uo||mr.content;try{(await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:c.id,flowSource:c.source??"user",action:"save-user-check-content",runUuid:tn,instanceId:mr.instanceId,content:x})})).ok?(Ua(H=>H&&{...H,content:x}),Li(!1),gt(H=>[...H,{ts:new Date().toISOString(),type:"info",text:e("flow:userCheck.contentSaved")}])):gt(H=>[...H,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}catch{gt(S=>[...S,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}},children:[o.jsx("span",{className:"material-symbols-outlined",children:"save"}),e("flow:userCheck.save")]}),o.jsxs("button",{type:"button",className:"af-user-check-modal__btn",onClick:()=>{Ka(mr.content),Li(!1)},children:[o.jsx("span",{className:"material-symbols-outlined",children:"close"}),e("flow:userCheck.cancel")]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:"af-user-check-modal__btn",onClick:()=>Li(!0),children:[o.jsx("span",{className:"material-symbols-outlined",children:"edit"}),e("flow:userCheck.edit")]}),o.jsx("button",{type:"button",className:"af-user-check-modal__btn",onClick:()=>Ua(null),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]})})]}),o.jsx("div",{className:"af-user-check-modal__body",children:qa?o.jsx("textarea",{ref:Ko,className:"af-user-check-modal__textarea",value:Uo||mr.content,onChange:x=>Ka(x.target.value)}):o.jsx("div",{className:"af-user-check-modal__preview",children:o.jsx("pre",{children:Uo||mr.content})})}),o.jsxs("div",{className:"af-user-check-modal__ai-bar",children:[o.jsx("input",{type:"text",className:"af-user-check-modal__ai-input",placeholder:e("flow:userCheck.aiEditPlaceholder"),value:Ya,onChange:x=>Ga(x.target.value),disabled:Wl}),o.jsxs("button",{type:"button",className:"af-user-check-modal__btn af-user-check-modal__btn--ai",disabled:Wl||!Ya.trim(),onClick:()=>{!mr||!c||!tn||!Ya.trim()||(Xa(!0),gt(x=>[...x,{ts:new Date().toISOString(),type:"info",text:e("flow:userCheck.aiEditStarted")}]),fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:c.id,flowSource:c.source??"user",action:"ai-edit-user-check-content",runUuid:tn,instanceId:mr.instanceId,content:Uo||mr.content,prompt:Ya})}).then(x=>x.json()).then(x=>{Xa(!1),x.ok&&x.content?(Ka(x.content),Li(!0),Ga(""),gt(S=>[...S,{ts:new Date().toISOString(),type:"info",text:e("flow:userCheck.aiEditDone")}])):gt(S=>[...S,{ts:new Date().toISOString(),type:"error",text:x.error||e("flow:userCheck.aiEditFailed")}])}).catch(()=>{Xa(!1),gt(x=>[...x,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.aiEditFailed")}])}))},children:[Wl?o.jsx("span",{className:"material-symbols-outlined af-spin",children:"sync"}):o.jsx("span",{className:"material-symbols-outlined",children:"auto_fix_high"}),e("flow:userCheck.aiEditBtn")]})]}),o.jsxs("div",{className:"af-user-check-modal__foot",children:[o.jsx("span",{className:"af-user-check-modal__hint",children:e("flow:userCheck.hint")}),o.jsxs("button",{type:"button",className:"af-user-check-modal__btn af-user-check-modal__btn--continue",onClick:async()=>{if(!mr||!c||!tn)return;const x=Uo||mr.content;try{(await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:c.id,flowSource:c.source??"user",action:"save-user-check-content",runUuid:tn,instanceId:mr.instanceId,content:x})})).ok?(await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:c.id,flowSource:c.source??"user",action:"confirm-user-check",runUuid:tn,instanceId:mr.instanceId,execId:mr.execId})}),Ua(null),Ga(""),Ui({runUuid:tn})):gt(H=>[...H,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}catch{gt(S=>[...S,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}},children:[o.jsx("span",{className:"material-symbols-outlined",children:"play_arrow"}),e("flow:userCheck.continue")]})]})]})}),document.body),Zr&&Re!=="edit"&&os.createPortal(o.jsx("div",{className:"af-user-ask-modal-overlay",children:o.jsxs("div",{className:"af-user-ask-modal",role:"dialog","aria-modal":"true",children:[o.jsxs("div",{className:"af-user-ask-modal__head",children:[o.jsxs("span",{className:"af-user-ask-modal__title",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"help"}),e("flow:userAsk.title",{instanceId:Zr.instanceId})]}),o.jsx("div",{className:"af-user-ask-modal__actions",children:o.jsx("button",{type:"button",className:"af-user-ask-modal__btn",onClick:()=>Vl(null),"aria-label":e("flow:userAsk.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})})]}),o.jsxs("div",{className:"af-user-ask-modal__body",children:[Zr.question.trim()?o.jsx("div",{className:"af-user-ask-modal__question",children:o.jsx("pre",{children:Zr.question})}):null,Zr.options.length===0?o.jsx("div",{className:"af-user-ask-modal__empty",children:e("flow:userAsk.noOptions")}):o.jsx("div",{className:"af-user-ask-modal__options",children:Zr.options.map(x=>o.jsxs("button",{type:"button",className:"af-user-ask-option",disabled:vu,onClick:async()=>{if(!(!Zr||!c||!tn)){qo(!0);try{(await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:c.id,flowSource:c.source??"user",action:"confirm-user-ask",runUuid:tn,instanceId:Zr.instanceId,execId:Zr.execId,branch:x.name,selectedIndex:x.index,selectedLabel:x.label})})).ok?(Vl(null),qo(!1),Ui({runUuid:tn})):(qo(!1),gt(H=>[...H,{ts:new Date().toISOString(),type:"error",text:e("flow:userAsk.submitFailed")}]))}catch{qo(!1),gt(S=>[...S,{ts:new Date().toISOString(),type:"error",text:e("flow:userAsk.submitFailed")}])}}},children:[o.jsxs("span",{className:"af-user-ask-option__index",children:["[",x.index,"]"]}),o.jsx("span",{className:"af-user-ask-option__label",children:x.label})]},x.name))})]}),o.jsx("div",{className:"af-user-ask-modal__foot",children:o.jsx("span",{className:"af-user-ask-modal__hint",children:e(vu?"flow:userAsk.submitting":"flow:userAsk.hint")})})]})}),document.body),Ul&&Re!=="edit"&&o.jsxs("div",{className:"af-tool-print-toast"+(Oi?" af-tool-print-toast--expanded":""),role:"status","aria-live":"polite",children:[o.jsxs("div",{className:"af-tool-print-toast__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"print"}),o.jsx("span",{className:"af-tool-print-toast__title",children:e("flow:toolPrint.title",{instanceId:Ul.instanceId})}),o.jsx("button",{type:"button",className:"af-tool-print-toast__close",onClick:()=>Lt(x=>!x),"aria-label":e(Oi?"flow:toolPrint.restore":"flow:toolPrint.expand"),title:e(Oi?"flow:toolPrint.restore":"flow:toolPrint.expand"),children:o.jsx("span",{className:"material-symbols-outlined",children:Oi?"close_fullscreen":"open_in_full"})}),o.jsx("button",{type:"button",className:"af-tool-print-toast__close",onClick:()=>ku(null),"aria-label":e("common:close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx("div",{className:"af-tool-print-toast__body",children:o.jsx("div",{className:"af-tool-print-toast__markdown",children:o.jsx(Tf,{children:Ul.content})})})]}),Mi&&o.jsx("div",{className:"af-provide-edit-overlay",children:o.jsxs("div",{className:"af-provide-edit-modal",role:"dialog","aria-modal":"true",children:[o.jsxs("div",{className:"af-provide-edit-modal__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"edit_document"}),o.jsx("span",{className:"af-provide-edit-modal__title",children:Mi.label}),o.jsx("button",{type:"button",className:"af-provide-edit-modal__close",onClick:()=>Kl(null),"aria-label":e("common:close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx("div",{className:"af-provide-edit-modal__body",children:o.jsx("textarea",{ref:Ja,className:"af-provide-edit-modal__textarea",defaultValue:Mi.content,autoFocus:!0})}),o.jsxs("div",{className:"af-provide-edit-modal__foot",children:[o.jsxs("button",{type:"button",className:"af-provide-edit-modal__btn af-provide-edit-modal__btn--save",onClick:r2,children:[o.jsx("span",{className:"material-symbols-outlined",children:"save"}),e("flow:provideEdit.save")]}),o.jsxs("button",{type:"button",className:"af-provide-edit-modal__btn",onClick:()=>Kl(null),children:[o.jsx("span",{className:"material-symbols-outlined",children:"close"}),e("flow:provideEdit.cancel")]})]})]})}),Ge&&o.jsx("div",{className:"af-run-params-overlay",children:o.jsxs("div",{className:"af-run-params-modal",role:"dialog","aria-modal":"true",children:[o.jsxs("div",{className:"af-run-params-modal__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"edit_note"}),o.jsx("span",{className:"af-run-params-modal__title",children:e("flow:runParams.title")}),o.jsx("button",{type:"button",className:"af-run-params-modal__close",onClick:()=>$t(!1),"aria-label":e("common:close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx("div",{className:"af-run-params-modal__body",children:ui.length===0?o.jsx("div",{className:"af-run-params-empty",children:e("flow:runParams.noParams")}):o.jsx("div",{className:"af-run-params-list",children:ui.map(x=>{var pe,we;const S=ec[x.id];if(!S)return null;const H=((pe=x.data)==null?void 0:pe.definitionId)||"",K=H.startsWith("provide_file"),q=H==="provide_bool",X=((we=x.data)==null?void 0:we.label)||x.id,ee=yt[S]??"",te=["true","1","yes","on"].includes(String(ee).trim().toLowerCase());return o.jsxs("div",{className:"af-run-params-item",children:[o.jsxs("div",{className:"af-run-params-item__head",children:[o.jsx("span",{className:"af-run-params-item__icon material-symbols-outlined"+(K?" af-run-params-item__icon--file":""),children:K?"description":q?"toggle_on":"text_fields"}),o.jsx("span",{className:"af-run-params-item__label",children:X}),o.jsx("span",{className:"af-run-params-item__slot",children:S})]}),q?o.jsx("button",{type:"button",className:"af-run-config-bool-toggle"+(te?" af-run-config-bool-toggle--true":""),onClick:()=>Kn(Fe=>({...Fe,[S]:te?"false":"true"})),"aria-pressed":te,children:te?"true":"false"}):o.jsx("input",{type:"text",className:"af-run-params-item__input",value:ee,onChange:Fe=>Kn(ce=>({...ce,[S]:Fe.target.value})),placeholder:e(K?"flow:runConfig.filePathPlaceholder":"flow:runConfig.stringValuePlaceholder")})]},x.id)})})}),o.jsxs("div",{className:"af-run-params-modal__foot",children:[o.jsxs("button",{type:"button",className:"af-run-params-modal__btn af-run-params-modal__btn--run",onClick:()=>{var S;const x={};for(const H of ui){const K=ec[H.id];if(!K)continue;const q=((S=H.data)==null?void 0:S.definitionId)||"",X=yt[K]??"";q.startsWith("provide_file")?x[K]={type:"file",path:X}:x[K]={type:"str",value:X}}$t(!1),Ae(!1),Ui({cliInputsOverride:x})},children:[o.jsx("span",{className:"material-symbols-outlined",children:"play_arrow"}),e("flow:runParams.run")]}),o.jsxs("button",{type:"button",className:"af-run-params-modal__btn",onClick:()=>$t(!1),children:[o.jsx("span",{className:"material-symbols-outlined",children:"close"}),e("flow:runParams.cancel")]})]})]})})]})]})}const JU="modulepreload",QU=function(e){return"/"+e},Nj={},ZU=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(u=>{if(u=QU(u),u in Nj)return;Nj[u]=!0;const d=u.endsWith(".css"),f=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${f}`))return;const c=document.createElement("link");if(c.rel=d?"stylesheet":JU,d||(c.as="script"),c.crossOrigin="",c.href=u,l&&c.setAttribute("nonce",l),document.head.appendChild(c),d)return new Promise((p,h)=>{c.addEventListener("load",p),c.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${u}`)))})}))}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)})},eK=new Set(["echarts"]),tK=new Set(["line","bar","pie","scatter","radar","heatmap","tree","treemap","sunburst","sankey","graph","gauge","funnel"]),nK=new Set(["onclick","ondblclick","onmousedown","onmouseup","onmouseover","onmouseout","onmousemove","onmouseenter","onmouseleave","oncontextmenu","onkeydown","onkeyup","onkeypress","onload","onerror"]),rK=["#7c9cff","#a8e66f","#ffcf5c","#68d8d6","#ff8fb3","#b79cff","#f59e73","#8bd17c"];function Pa(e){return e&&typeof e=="object"&&!Array.isArray(e)}function Ll(e,t){if(!Pa(e))return{...t};const n={...e};for(const[r,s]of Object.entries(t))n[r]==null?n[r]=s:Pa(n[r])&&Pa(s)&&(n[r]=Ll(n[r],s));return n}function og(e,t){return e==null?e:Array.isArray(e)?e.map(n=>Pa(n)?Ll(n,t):n):Pa(e)?Ll(e,t):e}function sK(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 Fw(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)=>Fw(n,`${t}[${r}]`));return}if(typeof e=="object")for(const[n,r]of Object.entries(e)){if(/^on[A-Z]/.test(n)||nK.has(n.toLowerCase()))throw new Error(`${t}.${n} is not allowed`);Fw(r,`${t}.${n}`)}}}function iK(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(!tK.has(r))throw new Error(`series.type "${r||"(empty)"}" is not allowed`)}return t}function oK(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:Ll(e,t)}function aK(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(!Pa(r))return r;const i=s===0&&t&&r.text==null?{...r,text:t}:r;return Ll(i,n)}):Pa(e)?Ll(t&&e.text==null?{...e,text:t}:e,n):t?{...n,text:t}:e}function lK(e,t){const n={top:t?42:14,textStyle:{color:"rgba(255, 255, 255, 0.72)"},itemGap:14};return e==null?e:og(e,n)}function jj(e,t="rgba(255, 255, 255, 0.62)"){return og(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 cK(e,t){const n={left:52,right:42,top:t?78:42,bottom:42,containLabel:!0};return e==null?n:og(e,n)}function uK(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:og(e,t)}function dK(e,t,n){const r=aK(e.title,n),s=!!(Array.isArray(r)?r:[r]).filter(Boolean).some(a=>Pa(a)&&a.text),i=e.legend!=null&&e.legend!==!1;return{...e,backgroundColor:e.backgroundColor??"transparent",color:e.color??rK,textStyle:Ll(e.textStyle,{color:"rgba(255, 255, 255, 0.78)"}),title:r,tooltip:oK(e.tooltip),legend:lK(e.legend,s),grid:e.xAxis!=null||e.yAxis!=null?cK(e.grid,s||i):e.grid,xAxis:jj(e.xAxis),yAxis:jj(e.yAxis),radar:uK(e.radar),series:t}}function fK(e){const t=sK(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(!eK.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");Fw(n);const r=iK(n.option.series),s=n.title==null?"":String(n.title),i=dK(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)}}}const pK="af:workspace-graph:v2",pc=["DISPLAY","CONTROL","TOOL","PROVIDE","AGENT"],hK=new Set(["control_start","control_end","control_load_skills","control_load_mcp"]),mK={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:""}]},gK={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}]},yK={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}]},xK=new Set(["png","jpg","jpeg","gif","webp","svg"]),eT=320,wK=180,bK=960,zw=96,vK=900,kK="0.1.46";function SK(){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 hl(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 hm(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 xK.has(n)}function tT(e,t){const n=String(e||"").trim();if(!n)return"";if(/^(?:https?:|data:|blob:|file:)/i.test(n)||n.startsWith("/"))return n;const r=hl(t||{});return r.set("path",n),`/api/workspace/file/raw?${r.toString()}`}function NK(e,t){const n=String(e||"").trim();if(!n)return"";const r=hl(t||{});return r.set("path",n),r.set("download","1"),`/api/workspace/file/raw?${r.toString()}`}function jK(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 CK(e){return!e||typeof e.closest!="function"?!1:!!e.closest("input, textarea, select, [contenteditable='true']")}function EK(e){const t=String(e||"").trim();if(!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 Cj(e){if(String((e==null?void 0:e.type)||"")!=="raw"||String((e==null?void 0:e.eventType)||"")!=="thinking")return"";const t=String((e==null?void 0:e.text)||"").trim();if(!t)return"";try{const n=JSON.parse(t);if((n==null?void 0:n.type)!=="thinking")return"";const r=String((n==null?void 0:n.subtype)||"");return r&&r!=="delta"?"":String((n==null?void 0:n.text)||(n==null?void 0:n.delta)||(n==null?void 0:n.thinking)||"").trim()}catch{return""}}function nT(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 rT(e){const t=String((e==null?void 0:e.marketplaceDefinitionId)||(e==null?void 0:e.id)||"").trim();return t.startsWith("marketplace:")?t:""}function Lv(e){if(!e)return"";const t=String(e.baseDefinitionId||"").trim();if(!t)return String(e.id||"").trim();const n=e.runtime&&typeof e.runtime=="object"?e.runtime:{};return!!(n.entry||n.command)&&t==="tool_nodejs"?String(e.id||"").trim():t}function cd(e){const t=String(Lv(e)||(e==null?void 0:e.id)||"");return t==="workspace_run"?"CONTROL":t.startsWith("display_")?"DISPLAY":/^control/i.test(t)?"CONTROL":/^tool/i.test(t)?"TOOL":/^provide/i.test(t)?"PROVIDE":"AGENT"}function Ej(e){return e==="DISPLAY"?"preview":e==="CONTROL"?"account_tree":e==="TOOL"?"build":e==="PROVIDE"?"database":"smart_toy"}function mm(e){return String((e==null?void 0:e.displayName)||(e==null?void 0:e.label)||(e==null?void 0:e.id)||"Node")}function ud(e){return mm(e)}function Bw(e){return String((e==null?void 0:e.description)||(e==null?void 0:e.body)||"").replace(/\s+/g," ").trim()}function Vy(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 _j(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 Pj(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 Aj(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=au(s.get(n),e.sourceHandle||"output-0","source"),a=au(s.get(r),e.targetHandle||"input-0","target");return!!(i&&a&&ou(i,a))}function _K(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=au(i,r,s);return a?{nodeId:n,handleId:r,handleType:s,slot:a,slotType:$I(a)}:null}function PK(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 u=cd(n);return{def:n,order:r,category:u,categoryRank:pc.indexOf(u),slot:a,slotIndex:i,displayLabel:ud(n),description:Bw(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 dd(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 AK(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 IK(e){return(e==null?void 0:e.default)!=null?String(e.default):(e==null?void 0:e.value)!=null?String(e.value):""}function Hp(e){return(Array.isArray(e)?e:[]).map(t=>({type:(t==null?void 0:t.type)||"node",name:(t==null?void 0:t.name)||"",default:IK(t),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 sT(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 TK(e){var s,i;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:{};return[sT(e),Number((e==null?void 0:e.width)||0)||"",Number((e==null?void 0:e.height)||0)||"",Number(((s=e==null?void 0:e.measured)==null?void 0:s.width)||0)||"",Number(((i=e==null?void 0:e.measured)==null?void 0:i.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)||"",(t==null?void 0:t.runningRunNodeId)||""].join("::")}function Uy(e,t){var c,p;const n=e!=null&&e.instances&&typeof e.instances=="object"?e.instances:{},r=oT(n),s=Array.isArray(e==null?void 0:e.edges)?e.edges:[],i=(c=e==null?void 0:e.ui)!=null&&c.nodePositions&&typeof e.ui.nodePositions=="object"?e.ui.nodePositions:{},a=(p=e==null?void 0:e.ui)!=null&&p.nodeSizes&&typeof e.ui.nodeSizes=="object"?e.ui.nodeSizes:{},l=new Set(Object.keys(r));for(const h of s)h!=null&&h.source&&l.add(String(h.source)),h!=null&&h.target&&l.add(String(h.target));const d=Array.from(l).map(h=>{const g=r[h]||{},v=g.definitionId||h,k=t.find(D=>D.id===v),y=Lv(k)||v,b=t.find(D=>D.id===y)||k,w=g.marketplaceRef||rT(k),N=i[h]&&typeof i[h].x=="number"&&typeof i[h].y=="number"?i[h]:{x:320+l.size*20,y:180+l.size*12},C=!!as(y),j=a[h]&&typeof a[h].width=="number"&&typeof a[h].height=="number"?{width:a[h].width,height:a[h].height}:null,R=ag(j,{display:C});return{id:h,type:Lf,position:N,...R?{width:R.width,height:R.height}:{},data:{label:g.label||mm(k)||mm(b)||h,definitionId:y,...w?{marketplaceRef:w}:{},...k!=null&&k.packageId?{marketplacePackageId:k.packageId}:{},...k!=null&&k.version?{marketplaceVersion:k.version}:{},schemaType:nT(y,b||k),role:g.role||"normal",model:g.model||void 0,body:g.body||"",script:g.script||"",...R?{nodeSize:R}:{},...C&&R?{displaySize:R}:{}}}}).map(h=>ff(h,r,t)),f=s.filter(h=>(h==null?void 0:h.source)&&(h==null?void 0:h.target)).map((h,g)=>({id:h.id||`we-${h.source}-${h.target}-${g}`,source:String(h.source),target:String(h.target),sourceHandle:h.sourceHandle??void 0,targetHandle:h.targetHandle??void 0,markerEnd:{type:gs.ArrowClosed}}));return{nodes:d,edges:OI(f,d),instances:r}}function Ij(e,t,n){const r=Number(e);return!Number.isFinite(r)||r<=0?0:Math.min(n,Math.max(t,Math.round(r)))}function ag(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:Ij(n,wK,bK)||eT,height:Ij(r,zw,vK)||zw}}function iT(e){var s,i,a,l,u,d,f,c,p,h,g;const t=!!as((s=e==null?void 0:e.data)==null?void 0:s.definitionId),n=Number(((a=(i=e==null?void 0:e.data)==null?void 0:i.displaySize)==null?void 0:a.width)||((u=(l=e==null?void 0:e.data)==null?void 0:l.nodeSize)==null?void 0:u.width)||(e==null?void 0:e.width)||(t?(d=e==null?void 0:e.measured)==null?void 0:d.width:0)||0),r=Number(((c=(f=e==null?void 0:e.data)==null?void 0:f.displaySize)==null?void 0:c.height)||((h=(p=e==null?void 0:e.data)==null?void 0:p.nodeSize)==null?void 0:h.height)||(e==null?void 0:e.height)||(t?(g=e==null?void 0:e.measured)==null?void 0:g.height:0)||0);return ag({width:n,height:r},{display:t})}function Wp(e,t,n){var l,u;const r=oT(Rf(e,n||{})),s=t.map(d=>({source:d.source,target:d.target,sourceHandle:d.sourceHandle??null,targetHandle:d.targetHandle??null})),i={},a={};for(const d of e){i[d.id]={x:((l=d.position)==null?void 0:l.x)||0,y:((u=d.position)==null?void 0:u.y)||0};const f=iT(d);f&&(a[d.id]=f)}return{version:1,instances:r,edges:s,ui:{nodePositions:i,nodeSizes:a}}}function oT(e){const t={};for(const[n,r]of Object.entries(e||{})){const s=String((r==null?void 0:r.definitionId)||n);if(!!as(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 as(e){const t=String(e||"");return t==="display_markdown"?"markdown":t==="display_mermaid"?"mermaid":t==="display_ascii"?"ascii":t==="display_html"?"html":t==="display_image"?"image":t==="display_chart"?"chart":t==="display_table"?"table":""}function Pd(e){const t=[...(e==null?void 0:e.inputs)||[],...(e==null?void 0:e.outputs)||[]],r=as(e==null?void 0:e.definitionId)==="image"?"src":"content",s=l=>String((l==null?void 0:l.value)??(l==null?void 0:l.default)??""),i=l=>s(l).trim(),a=t.find(l=>(l==null?void 0:l.name)===r&&i(l))||t.find(l=>(l==null?void 0:l.name)==="filePath"&&i(l))||t.find(l=>(l==null?void 0:l.type)==="text"&&i(l));return String((e==null?void 0:e.body)||(a?s(a):""))}function aT(e){let t=String(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 RK(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 LK(e){return e==="mermaid"?"account_tree":e==="ascii"?"notes":e==="html"?"html":e==="image"?"image":e==="chart"?"bar_chart":e==="table"?"table":"article"}function Ao(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 lT(e){const t=Ao(e);return t.length>1&&t.every(n=>/^:?-{3,}:?$/.test(n))}function cT(e){return Ao(e).map(t=>t.startsWith(":")&&t.endsWith(":")?"center":t.endsWith(":")?"right":"left")}function OK(e){const t=String(e||"").replace(/\r\n/g,`
|
|
137
|
+
`).split(`
|
|
138
|
+
`),n=[];let r=[],s=!1;const i=()=>{r.length&&(n.push({type:"markdown",text:r.join(`
|
|
139
|
+
`)}),r=[])};for(let a=0;a<t.length;){const l=t[a]||"";if(/^\s*```/.test(l)){s=!s,r.push(l),a++;continue}if(!s&&a+1<t.length&&Ao(l).length>1&&lT(t[a+1])){i();const u=Ao(l),d=cT(t[a+1]),f=[];for(a+=2;a<t.length&&t[a].trim()&&Ao(t[a]).length>1;)f.push(Ao(t[a])),a++;n.push({type:"table",headers:u,align:d,rows:f});continue}r.push(l),a++}return i(),n}function uT(e,t=!1){return{...t?{p:({children:n})=>o.jsx(o.Fragment,{children:n})}:{},img:({src:n,alt:r})=>o.jsx("img",{src:tT(n,e),alt:r||"",loading:"lazy"})}}function Tj({children:e,flowParams:t}){return o.jsx(Tf,{components:uT(t,!0),children:String(e||"")})}function MK({content:e,flowParams:t}){const n=m.useMemo(()=>OK(e),[e]),r=m.useMemo(()=>uT(t),[t]);return o.jsx(o.Fragment,{children:n.map((s,i)=>s.type!=="table"?o.jsx(Tf,{components:r,children:s.text},`md-${i}`):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:s.headers.map((a,l)=>o.jsx("th",{style:{textAlign:s.align[l]||"left"},children:o.jsx(Tj,{flowParams:t,children:a})},l))})}),o.jsx("tbody",{children:s.rows.map((a,l)=>o.jsx("tr",{children:s.headers.map((u,d)=>o.jsx("td",{style:{textAlign:s.align[d]||"left"},children:o.jsx(Tj,{flowParams:t,children:a[d]||""})},d))},l))})]})},`table-${i}`))})}function $K(e,t=","){const n=[];let r=[],s="",i=!1;const a=String(e||"").replace(/\r\n/g,`
|
|
140
|
+
`);for(let l=0;l<a.length;l+=1){const u=a[l],d=a[l+1];if(i){u==='"'&&d==='"'?(s+='"',l+=1):u==='"'?i=!1:s+=u;continue}u==='"'?i=!0:u===t?(r.push(s.trim()),s=""):u===`
|
|
141
|
+
`?(r.push(s.trim()),n.push(r),r=[],s=""):s+=u}return(s||r.length)&&(r.push(s.trim()),n.push(r)),n.filter(l=>l.some(u=>String(u||"").trim()))}function Gi(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 DK(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=>Gi(i[a])))}}if(e.every(Array.isArray)&&e.length>0){const s=e[0].map((i,a)=>Gi(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)=>Gi(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:Gi(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:Gi(s)||`Column ${i+1}`,align:"left"})),{columns:r,rows:n.slice(1).map(s=>r.map((i,a)=>Gi(s[a])))}):{columns:r,rows:n.map(s=>Array.isArray(s)?r.map((i,a)=>Gi(s[a])):s&&typeof s=="object"?r.map(i=>Gi(s[i.key])):r.map((i,a)=>a===0?Gi(s):""))}}function FK(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=DK(JSON.parse(r));if(l&&l.columns.length)return{...l,error:""}}catch{}const s=r.replace(/\r\n/g,`
|
|
142
|
+
`).split(`
|
|
143
|
+
`).filter(l=>l.trim());if(s.length>=2&&Ao(s[0]).length>1&&lT(s[1])){const l=Ao(s[0]),u=cT(s[1]);return{columns:l.map((d,f)=>({key:String(f),label:d,align:u[f]||"left"})),rows:s.slice(2).map(d=>Ao(d)),error:""}}const i=r.includes(" ")?" ":",",a=$K(r,i);return a.length>0&&a[0].length>1?{columns:a[0].map((u,d)=>u||`Column ${d+1}`).map((u,d)=>({key:String(d),label:u,align:"left"})),rows:a.slice(1),error:""}:{columns:[],rows:[],error:"No table data detected"}}function zK({content:e}){const t=m.useMemo(()=>FK(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:Gi(n[i])},`${s.key}-${i}`))},r))})]})})}function BK(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,u="")=>{const d=String(l||"").replace(/[^A-Za-z0-9_]/g,"_")||`N${n.size+1}`;return n.has(d)?u&&(n.get(d).label=u):n.set(d,{id:d,label:u||d}),d},a=l=>{const u=String(l||"").trim().replace(/[;,]+$/,""),d=u.match(/^([A-Za-z][A-Za-z0-9_]*)(?:\[(.+?)\]|\((.+?)\)|\{(.+?)\})?$/);return d?i(d[1],d[2]||d[3]||d[4]||d[1]):i(u.replace(/[^A-Za-z0-9_]/g,"_"),u)};for(const l of t){const u=l.match(/^(graph|flowchart)\s+(TD|TB|BT|LR|RL)\b/i);if(u){s=u[2].toUpperCase();continue}const d=l.match(/^(.+?)\s*-{1,2}>+\s*(.+)$/);if(d){r.push({from:a(d[1]),to:a(d[2])});continue}a(l)}return{nodes:Array.from(n.values()),edges:r,direction:s}}function HK({code:e}){const t=m.useMemo(()=>BK(e),[e]);if(!String(e||"").trim())return null;const n=t.direction==="LR"||t.direction==="RL",r=142,s=44,i=n?96:32,a=n?30:68,l=new Map;t.nodes.forEach((f,c)=>{l.set(f.id,{x:24+(n?c*(r+i):c%3*(r+i)),y:24+(n?c%3*(s+a):c*(s+a))})});const u=Math.max(360,...Array.from(l.values()).map(f=>f.x+r+24)),d=Math.max(180,...Array.from(l.values()).map(f=>f.y+s+24));return o.jsx("div",{className:"af-work-node__mermaid-preview",children:o.jsxs("svg",{viewBox:`0 0 ${u} ${d}`,role:"img","aria-label":"Mermaid preview",children:[o.jsx("defs",{children:o.jsx("marker",{id:"af-work-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:o.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z"})})}),t.edges.map((f,c)=>{const p=l.get(f.from),h=l.get(f.to);if(!p||!h)return null;const g=n?`M ${p.x+r} ${p.y+s/2} C ${(p.x+h.x+r)/2} ${p.y+s/2}, ${(p.x+h.x+r)/2} ${h.y+s/2}, ${h.x} ${h.y+s/2}`:`M ${p.x+r/2} ${p.y+s} C ${p.x+r/2} ${p.y+s+28}, ${h.x+r/2} ${h.y-28}, ${h.x+r/2} ${h.y}`;return o.jsx("path",{className:"af-work-node__mermaid-edge",d:g,markerEnd:"url(#af-work-arrow)"},`${f.from}-${f.to}-${c}`)}),t.nodes.map(f=>{const c=l.get(f.id);return o.jsxs("g",{children:[o.jsx("rect",{className:"af-work-node__mermaid-box",x:c.x,y:c.y,width:r,height:s,rx:"8"}),o.jsx("text",{className:"af-work-node__mermaid-text",x:c.x+r/2,y:c.y+s/2+5,textAnchor:"middle",children:f.label.slice(0,22)})]},f.id)})]})})}function aa({className:e="",children:t}){const n=m.useRef(null),r=m.useRef(null),[s,i]=m.useState({visible:!1,top:0,height:100}),a=m.useCallback(()=>{const f=n.current;if(!f)return;const c=Math.max(1,f.scrollHeight),p=Math.max(1,f.clientHeight),h=c>p+1,g=h?Math.max(12,p/c*100):100,v=Math.max(0,100-g),k=h?Math.min(v,f.scrollTop/Math.max(1,c-p)*v):0;i({visible:h,top:k,height:g})},[]);m.useEffect(()=>{const f=requestAnimationFrame(a),c=n.current;if(!c||typeof ResizeObserver>"u")return()=>cancelAnimationFrame(f);const p=new ResizeObserver(a);p.observe(c);for(const h of Array.from(c.children))p.observe(h);return()=>{cancelAnimationFrame(f),p.disconnect()}},[t,a]);const l=m.useCallback(f=>{const c=n.current;if(!c)return;const p=Math.max(0,c.scrollHeight-c.clientHeight);c.scrollTop=Math.min(1,Math.max(0,f))*p,a()},[a]),u=m.useCallback((f,c=0)=>{const p=r.current;if(!p)return 0;const h=p.getBoundingClientRect(),g=s.height/100*h.height,v=Math.max(1,h.height-g);return(f-h.top-c)/v},[s.height]),d=m.useCallback(f=>{var N,C;if(!s.visible)return;f.preventDefault(),f.stopPropagation();const c=r.current;if(!c)return;const p=c.getBoundingClientRect(),h=s.top/100*p.height,g=s.height/100*p.height,k=f.clientY>=p.top+h&&f.clientY<=p.top+h+g?f.clientY-p.top-h:g/2;l(u(f.clientY,k));const y=f.pointerId;(C=(N=f.currentTarget).setPointerCapture)==null||C.call(N,y);const b=j=>{j.preventDefault(),l(u(j.clientY,k))},w=()=>{window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",w),window.removeEventListener("pointercancel",w)};window.addEventListener("pointermove",b),window.addEventListener("pointerup",w),window.addEventListener("pointercancel",w)},[u,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:d,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${s.height}%`,top:`${s.top}%`}})})]})}function WK({content:e}){const t=m.useRef(null),n=m.useMemo(()=>fK(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,u=null;return s({loading:!0,error:""}),ZU(()=>import("./index-DgQRkS4v.js"),[]).then(d=>{i||!t.current||(a=d.init(t.current,"dark",{renderer:"canvas"}),a.setOption(n.spec.option,!0),u=()=>a==null?void 0:a.resize(),typeof ResizeObserver<"u"&&(l=new ResizeObserver(u),l.observe(t.current)),window.addEventListener("resize",u),window.requestAnimationFrame(u),i||s({loading:!1,error:""}))}).catch(d=>{i||s({loading:!1,error:String((d==null?void 0:d.message)||d)})}),()=>{var d,f;i=!0,u&&window.removeEventListener("resize",u),(d=l==null?void 0:l.disconnect)==null||d.call(l),(f=a==null?void 0:a.dispose)==null||f.call(a)}},[n]),!n.ok||r.error?o.jsxs("div",{className:"af-work-display-chart-error",children:[o.jsx("strong",{children:"Chart configuration error"}),o.jsx("span",{children:r.error||n.error})]}):o.jsxs("div",{className:"af-work-display-chart",children:[o.jsx("div",{ref:t,className:"af-work-display-chart__canvas"}),r.loading?o.jsx("div",{className:"af-work-display-chart__loading",children:"Loading chart..."}):null]})}function VK({data:e,flowParams:t,htmlFrameRef:n,htmlFrameVersion:r=0}){const s=as(e==null?void 0:e.definitionId);if(!s)return null;const i=Pd(e),a=s==="html"?aT(i):i;if(!a.trim())return o.jsx(aa,{className:"af-work-display-empty",children:"No display content"});if(s==="html")return o.jsx(aa,{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)||"HTML preview",sandbox:"allow-scripts allow-forms allow-modals",srcDoc:a},r)});if(s==="image"){const l=tT(a,t);return o.jsx(aa,{className:"af-work-display-body af-work-display-body--image",children:o.jsx("img",{className:"af-work-display-image",src:l,alt:RK(e),loading:"lazy"})})}return s==="markdown"?o.jsx(aa,{className:"af-work-display-body af-work-display-body--markdown",children:o.jsx(MK,{content:a,flowParams:t})}):s==="chart"?o.jsx(aa,{className:"af-work-display-body af-work-display-body--chart",children:o.jsx(WK,{content:a})}):s==="table"?o.jsx(aa,{className:"af-work-display-body af-work-display-body--table",children:o.jsx(zK,{content:a})}):s==="mermaid"?o.jsxs(aa,{className:"af-work-display-body",children:[o.jsx(HK,{code:a}),o.jsx("pre",{className:"af-work-node__diagram af-work-node__diagram--mermaid",children:a})]}):o.jsx(aa,{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:a})})}function UK({value:e,onChange:t,onUploadImage:n,readOnly:r=!1}){const s=m.useRef(null),i=m.useRef(null),[a,l]=m.useState(!1),u=m.useCallback(f=>{const c=String(e||""),p=s.current,h=Number((p==null?void 0:p.selectionStart)??c.length),g=Number((p==null?void 0:p.selectionEnd)??h),v=c.slice(0,h),k=c.slice(g),y=v&&!v.endsWith(`
|
|
144
|
+
`)?`
|
|
145
|
+
`:"",b=k&&!k.startsWith(`
|
|
146
|
+
`)?`
|
|
147
|
+
`:"",w=`${v}${y}${f}${b}${k}`;t==null||t(w),window.requestAnimationFrame(()=>{var C,j;const N=v.length+y.length+f.length;(C=s.current)==null||C.focus(),(j=s.current)==null||j.setSelectionRange(N,N)})},[t,e]),d=m.useCallback(async f=>{if(!r&&!(!f||a)){l(!0);try{const c=await(n==null?void 0:n(f)),p=String(c||"").trim();if(p){const h=String(f.name||"image").replace(/\.[^.]+$/g,"").trim()||"image";u(``)}}finally{l(!1)}}},[u,n,r,a]);return o.jsxs("div",{className:"af-work-display-editor nodrag nopan",onClick:f=>f.stopPropagation(),onDragOver:f=>{var p;Array.from(((p=f.dataTransfer)==null?void 0:p.items)||[]).some(h=>String((h==null?void 0:h.type)||"").startsWith("image/"))&&(f.preventDefault(),f.dataTransfer.dropEffect="copy")},onDrop:f=>{var p;const c=Array.from(((p=f.dataTransfer)==null?void 0:p.files)||[]).find(hm);c&&(f.preventDefault(),d(c))},children:[o.jsxs("div",{className:"af-work-display-editor__toolbar",children:[o.jsx("button",{type:"button",className:"af-work-display-card__action",disabled:a||r,onClick:()=>{var f;return(f=i.current)==null?void 0:f.click()},"aria-label":"上传图片",title:"上传图片",children:o.jsx("span",{className:"material-symbols-outlined",children:a?"hourglass_top":"add_photo_alternate"})}),o.jsx("input",{ref:i,className:"af-hidden-file-input",type:"file",accept:"image/*",onChange:f=>{var p;const c=(p=f.target.files)==null?void 0:p[0];f.target.value="",c&&d(c)}})]}),o.jsx("textarea",{ref:s,className:"af-work-display-editor__textarea",value:e,onChange:f=>t==null?void 0:t(f.target.value),onKeyDown:f=>{f.key==="Escape"&&f.stopPropagation()},placeholder:"输入 Markdown 内容",spellCheck:!1,readOnly:r})]})}function KK({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,u]=m.useState(a),d=m.useRef(!1),f=String(s.candidateContent||""),c=!!s.running,p=!!(t!=null&&t.readOnly),h=String(s.error||"");return m.useEffect(()=>{d.current||u(a)},[a]),!n&&!r?null:n?o.jsxs("div",{className:"af-work-node-chat nodrag nopan",onClick:g=>g.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 g;return(g=t==null?void 0:t.onCloseNodeChat)==null?void 0:g.call(t)},"aria-label":"关闭节点微调",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),i.length>0||c||h||f.trim()?o.jsxs("div",{className:"af-work-node-chat__messages",children:[i.slice(-4).map((g,v)=>o.jsxs("div",{className:`af-work-node-chat__msg af-work-node-chat__msg--${g.role==="assistant"?"assistant":"user"}`,children:[o.jsx("span",{children:g.role==="assistant"?"AI":"你"}),o.jsx("p",{children:g.text})]},`${g.at||v}-${v}`)),c?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:c||p,"aria-label":"添加上下文",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add"})}),o.jsx("textarea",{className:"af-work-node-chat__input",rows:2,value:l,disabled:c||p,placeholder:"描述你想怎么调整这个展示",onCompositionStart:()=>{d.current=!0},onCompositionEnd:g=>{var k;d.current=!1;const v=g.currentTarget.value;u(v),(k=t==null?void 0:t.onUpdateNodeChatDraft)==null||k.call(t,e,v)},onChange:g=>{var k;const v=g.target.value;u(v),d.current||(k=t==null?void 0:t.onUpdateNodeChatDraft)==null||k.call(t,e,v)},onKeyDown:g=>{var v,k;g.isComposing||(v=g.nativeEvent)!=null&&v.isComposing||g.keyCode===229||(g.metaKey||g.ctrlKey)&&g.key==="Enter"&&(g.preventDefault(),(k=t==null?void 0:t.onSendNodeChat)==null||k.call(t,e,l))}}),o.jsx("button",{type:"button",className:"af-work-node-chat__send",disabled:c||p||!l.trim(),onClick:()=>{var g;return(g=t==null?void 0:t.onSendNodeChat)==null?void 0:g.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:c||p||!f.trim(),onClick:()=>{var g;return(g=t==null?void 0:t.onApplyNodeChatCandidate)==null?void 0:g.call(t,e,"replace")},children:"替换当前内容"}),o.jsx("button",{type:"button",disabled:c||p||!f.trim(),onClick:()=>{var g;return(g=t==null?void 0:t.onApplyNodeChatCandidate)==null?void 0:g.call(t,e,"append")},children:"追加"})]})]}):o.jsxs("button",{type:"button",className:"af-work-node-chat-anchor nodrag nopan",onClick:g=>{var v;g.stopPropagation(),(v=t==null?void 0:t.onToggleNodeChat)==null||v.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 qK(e){return e==="mermaid"?"mmd":e==="ascii"?"txt":e==="html"?"html":e==="image"?"txt":e==="chart"||e==="table"?"json":"md"}function YK(e){return String(e).trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)||"display"}function GK(e,t){const n=as(t==null?void 0:t.definitionId)||"markdown";return`outputs/${YK((t==null?void 0:t.label)||e||n)}.${qK(n)}`}function XK({id:e,data:t,selected:n,deleteNode:r}){const s=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],a=(Array.isArray(t==null?void 0:t.outputs)?t.outputs:[]).map((A,F)=>({slot:A,idx:F})).sort((A,F)=>{var P,L,_,G;const T=String(((P=A.slot)==null?void 0:P.name)||"").trim(),O=String(((L=F.slot)==null?void 0:L.name)||"").trim();if(T==="next"&&O!=="next")return-1;if(O==="next"&&T!=="next")return 1;const I=String(((_=A.slot)==null?void 0:_.type)||"").trim(),B=String(((G=F.slot)==null?void 0:G.type)||"").trim();return I==="node"&&B!=="node"?-1:B==="node"&&I!=="node"?1:A.idx-F.idx}),l=as(t==null?void 0:t.definitionId),u=m.useRef(null),[d,f]=m.useState(0),[c,p]=m.useState(!1),[h,g]=m.useState(!1),[v,k]=m.useState(""),[y,b]=m.useState(!1),w=m.useRef(null),N=l==="markdown"?Pd(t):"",C=!!(t!=null&&t.readOnly);m.useEffect(()=>{if(!c)return;const A=()=>p(!1);return window.addEventListener("pointerup",A,!0),window.addEventListener("pointercancel",A,!0),window.addEventListener("mouseup",A,!0),window.addEventListener("blur",A),()=>{window.removeEventListener("pointerup",A,!0),window.removeEventListener("pointercancel",A,!0),window.removeEventListener("mouseup",A,!0),window.removeEventListener("blur",A)}},[c]),m.useEffect(()=>{h||k(String(N||""))},[N,h]);const j=(t==null?void 0:t.label)||(l==="mermaid"?"Mermaid":l==="ascii"?"ASCII":l==="html"?"HTML":l==="image"?"Image":l==="chart"?"Chart":l==="table"?"Table":"Markdown"),R=t!=null&&t.displaySize&&Number(t.displaySize.width)>0&&Number(t.displaySize.height)>0?{width:Number(t.displaySize.width),height:Number(t.displaySize.height)}:null,D=m.useCallback(A=>{var F;C||!A||l!=="image"||(F=t==null?void 0:t.onUploadImageToDisplayNode)==null||F.call(t,e,A)},[t,e,l,C]),M=m.useCallback(A=>{var O,I;C||l!=="image"||!(Array.from(((O=A.dataTransfer)==null?void 0:O.files)||[]).some(hm)||Array.from(((I=A.dataTransfer)==null?void 0:I.items)||[]).some(B=>String((B==null?void 0:B.type)||"").startsWith("image/")))||(A.preventDefault(),A.stopPropagation(),A.dataTransfer.dropEffect="copy",b(!0))},[l,C]),z=m.useCallback(A=>{l==="image"&&(A.currentTarget.contains(A.relatedTarget)||b(!1))},[l]),$=m.useCallback(A=>{var T;if(l!=="image")return;const F=Array.from(((T=A.dataTransfer)==null?void 0:T.files)||[]).find(hm);F&&(A.preventDefault(),A.stopPropagation(),b(!1),D(F))},[l,D]);return o.jsxs("div",{className:"af-work-display-card"+(R?" af-work-display-card--sized":"")+(n?" af-work-display-card--selected":"")+(c?" af-work-display-card--resizing":"")+(y?" af-work-display-card--image-drop":"")+(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:R?{width:R.width,height:R.height}:void 0,onDragOver:M,onDragLeave:z,onDrop:$,children:[o.jsx(n4,{className:"af-work-display-resize nodrag",position:"bottom-right",minWidth:320,minHeight:180,maxWidth:1200,maxHeight:1e3,onResizeStart:()=>p(!0),onResizeEnd:()=>p(!1),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_full"})}),s.map((A,F)=>{if(A.showOnNode===!1)return null;const T=`${4.15+F*1.75}rem`,O=A.name||`#${F+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:T},children:O}),o.jsx(xs,{type:"target",position:Ke.Left,id:`input-${F}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:T,background:Xn(A.type)},title:`${O} · ${A.type}`})]},`in-${F}`)}),a.map(({slot:A,idx:F},T)=>{if(A.showOnNode===!1)return null;const O=`${4.15+T*1.75}rem`,I=A.name||`#${F+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:O},children:I}),o.jsx(xs,{type:"source",position:Ke.Right,id:`output-${F}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:O,background:Xn(A.type)},title:`${I} · ${A.type}`})]},`out-${F}`)}),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:LK(l)}),o.jsx("strong",{children:j}),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:A=>A.stopPropagation(),children:[o.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>{var A,F,T,O;try{(O=(T=(F=(A=u.current)==null?void 0:A.contentWindow)==null?void 0:F.history)==null?void 0:T.back)==null||O.call(T)}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 A,F,T,O;try{(O=(T=(F=(A=u.current)==null?void 0:A.contentWindow)==null?void 0:F.history)==null?void 0:T.forward)==null||O.call(T)}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(A=>A+1),"aria-label":"刷新",title:"刷新",children:o.jsx("span",{className:"material-symbols-outlined",children:"refresh"})})]}):null,l==="markdown"?h?o.jsxs("div",{className:"af-work-display-card__html-controls nodrag",onClick:A=>A.stopPropagation(),children:[o.jsx("button",{type:"button",className:"af-work-display-card__action",disabled:C,onClick:()=>{var A;(A=t==null?void 0:t.onSetDisplayNodeContent)==null||A.call(t,e,v,"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:()=>{k(String(N||"")),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:C,onClick:A=>{A.stopPropagation(),k(String(N||"")),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:w,className:"af-hidden-file-input",type:"file",accept:"image/*",onChange:A=>{var T;const F=(T=A.target.files)==null?void 0:T[0];A.target.value="",F&&D(F)}}),o.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:C,onClick:A=>{var F;A.stopPropagation(),(F=w.current)==null||F.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",disabled:C,onClick:()=>{var A;return(A=t==null?void 0:t.onSaveDisplayNodeToFile)==null?void 0:A.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:C,onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),l==="markdown"&&h?o.jsx(UK,{value:v,onChange:k,onUploadImage:t==null?void 0:t.onUploadWorkspaceImage,readOnly:C}):o.jsx(VK,{data:t,flowParams:t==null?void 0:t.flowParams,htmlFrameRef:u,htmlFrameVersion:d}),o.jsx(KK,{nodeId:e,data:t})]})}function JK({id:e,data:t,selected:n,deleteNode:r}){const s=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],i=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],a=(t==null?void 0:t.runningRunNodeId)===e,l=(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":"")+(l?" af-work-run-card--stopped":""),children:[s.map((d,f)=>{if(d.showOnNode===!1)return null;const c=`${2.25+f*1.75}rem`,p=d.name||`#${f+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:c},children:p}),o.jsx(xs,{type:"target",position:Ke.Left,id:`input-${f}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:c,background:Xn(d.type)},title:`${p} · ${d.type}`})]},`in-${f}`)}),i.map((d,f)=>{if(d.showOnNode===!1)return null;const c=`${2.25+f*1.75}rem`,p=d.name||`#${f+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:c},children:p}),o.jsx(xs,{type:"source",position:Ke.Right,id:`output-${f}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:c,background:Xn(d.type)},title:`${p} · ${d.type}`})]},`out-${f}`)}),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("button",{type:"button",className:"af-work-run-card__button nodrag"+(a?" af-work-run-card__button--stop":""),disabled:u,onClick:d=>{var f,c;d.stopPropagation(),a?(f=t==null?void 0:t.onStopWorkspaceNode)==null||f.call(t,e):(c=t==null?void 0:t.onRunWorkspaceNode)==null||c.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"})]})]})}function QK(e){var g,v,k,y,b,w,N,C,j,R,D,M,z;const{setEdges:t,setNodes:n}=Dl(),r=uv(),s=m.useRef(null),i=(g=e.data)==null?void 0:g.onSyncNodePropDraft,a=!!((v=e.data)!=null&&v.readOnly),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,u=m.useCallback($=>{a||(n(A=>A.filter(F=>F.id!==$)),t(A=>A.filter(F=>F.source!==$&&F.target!==$)))},[a,t,n]),d=m.useCallback(($,A)=>{a||(n(F=>F.map(T=>T.id===$?{...T,data:{...T.data,model:A}}:T)),i==null||i($,{model:A}))},[a,n,i]),f=m.useCallback(($,A)=>{a||(n(F=>F.map(T=>{var I;if(T.id!==$)return T;const O=Array.isArray((I=T.data)==null?void 0:I.outputs)&&T.data.outputs.length?T.data.outputs.map((B,P)=>P===0?{...B,default:A,value:A}:B):[{type:"bool",name:"value",default:A,value:A}];return{...T,data:{...T.data,body:"",outputs:O}}})),i==null||i($,F=>({body:"",outputs:Array.isArray(F==null?void 0:F.outputs)&&F.outputs.length?F.outputs.map((O,I)=>I===0?{...O,default:A,value:A}:O):[{type:"bool",name:"value",default:A,value:A}]})))},[a,n,i]),c=m.useCallback(($,A)=>{a||(n(F=>F.map(T=>T.id===$?{...T,data:{...T.data,body:A}}:T)),i==null||i($,{body:A}))},[a,n,i]),p=m.useCallback(($,A)=>{if(a)return;const F=ds(A);n(T=>T.map(O=>O.id===$?{...O,data:{...O.data,images:F}}:O)),i==null||i($,{images:F})},[a,n,i]),h=m.useCallback($=>{if(a)return;const A=s.current;if(!A)return;const F=A.getBoundingClientRect();n(O=>O.map(I=>{var Z,U,se,ue,de,me;if(I.id!==$)return I;const B=Number(((U=(Z=I.data)==null?void 0:Z.nodeSize)==null?void 0:U.width)||I.width||((se=I.measured)==null?void 0:se.width)||0),P=Number(((de=(ue=I.data)==null?void 0:ue.nodeSize)==null?void 0:de.height)||I.height||((me=I.measured)==null?void 0:me.height)||0),L=B>0?B:Math.ceil(F.width||eT),_=Math.ceil(Math.max(A.scrollHeight,F.height,zw)),G=ag({width:L,height:_},{display:!1});return!G||Math.abs(B-G.width)<2&&Math.abs(P-G.height)<2?I:{...I,width:G.width,height:G.height,data:{...I.data,nodeSize:G}}}));const T=()=>r($);window.requestAnimationFrame(T),window.setTimeout(T,80)},[n,r]);return as((y=e.data)==null?void 0:y.definitionId)?o.jsx(XK,{...e,deleteNode:u}):((b=e.data)==null?void 0:b.definitionId)==="workspace_run"?o.jsx(JK,{...e,deleteNode:u}):((w=e.data)==null?void 0:w.definitionId)==="control_load_skills"?o.jsx(cq,{...e,deleteNode:u,skills:(N=e.data)==null?void 0:N.skills,skillCollections:(C=e.data)==null?void 0:C.skillCollections,onChangeSkillKeys:(j=e.data)==null?void 0:j.onChangeLoadSkillKeys}):((R=e.data)==null?void 0:R.definitionId)==="control_load_mcp"?o.jsx(uq,{...e,deleteNode:u,servers:(D=e.data)==null?void 0:D.mcpServers,onChangeMcpNames:(M=e.data)==null?void 0:M.onChangeLoadMcpNames}):o.jsx("div",{ref:s,className:"af-work-flow-node",style:l?{width:l.width,height:l.height}:void 0,children:o.jsx(DI,{...e,data:{...e.data,onNodeContentResize:h},deleteNode:u,modelLists:(z=e.data)==null?void 0:z.modelLists,onModelChange:d,onProvideValueChange:f,onNodeBodyChange:c,onNodeImagesChange:p})})}const ZK={[Lf]:QK};function dT(e,t=[]){for(const n of e||[])n.type==="file"&&t.push(n),Array.isArray(n.children)&&dT(n.children,t);return t}function fT(e,t=[]){for(const n of e||[])n.type==="directory"&&(t.push(n.path),Array.isArray(n.children)&&fT(n.children,t));return t}function Vp(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 eq(e){return[...e||[]].sort((t,n)=>t.type!==n.type?t.type==="directory"?-1:1:String(t.name||"").localeCompare(String(n.name||"")))}function tq(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 u=r[a],d=l?`${l}/${u}`:u,f=a===r.length-1;let c=!1;const p=(Array.isArray(i)?i:[]).map(h=>h.name!==u?h:(c=!0,f?{...h,type:"file",name:u,path:d,icon:dd(u),size:n}:{...h,type:"directory",name:u,path:d,icon:dd(u,!0),children:s(h.children||[],a+1,d)}));return c||p.push(f?{type:"file",name:u,path:d,icon:dd(u),size:n}:{type:"directory",name:u,path:d,icon:dd(u,!0),children:s([],a+1,d)}),eq(p)};return s(e||[],0,"")}function pT({items:e,flowParams:t,onOpen:n,collapsedDirs:r,onToggleDir:s,onCreateFile:i,onCreateFolder:a,onDelete:l,onFileDragStart:u}){return o.jsx("ul",{className:"af-work-files",children:(e||[]).map(d=>{var p;const f=d.type==="directory",c=f&&(r==null?void 0:r.has(d.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--"+d.type,draggable:!f,onDragStart:h=>{f||u==null||u(h,d)},onClick:()=>f?s==null?void 0:s(d.path):n(d),title:d.path,children:[f?o.jsx("span",{className:"material-symbols-outlined af-work-file__chevron",children:c?"chevron_right":"expand_more"}):null,o.jsx("span",{className:"material-symbols-outlined",children:d.icon||dd(d.name,f)}),o.jsx("span",{children:d.name})]}),f?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-work-file-action",onClick:()=>i==null?void 0:i(d.path),title:"新增文件","aria-label":`在 ${d.name} 新增文件`,children:o.jsx("span",{className:"material-symbols-outlined",children:"note_add"})}),o.jsx("button",{type:"button",className:"af-work-file-action",onClick:()=>a==null?void 0:a(d.path),title:"新增文件夹","aria-label":`在 ${d.name} 新增文件夹`,children:o.jsx("span",{className:"material-symbols-outlined",children:"create_new_folder"})})]}):null,f?null:o.jsx("a",{className:"af-work-file-action",href:NK(d.path,t),download:d.name,onClick:h=>h.stopPropagation(),title:"下载","aria-label":`下载 ${d.name}`,children:o.jsx("span",{className:"material-symbols-outlined",children:"download"})}),o.jsx("button",{type:"button",className:"af-work-file-action af-work-file-action--danger",onClick:()=>l==null?void 0:l(d),title:"删除","aria-label":`删除 ${d.name}`,children:o.jsx("span",{className:"material-symbols-outlined",children:"delete"})})]}),f&&!c&&((p=d.children)!=null&&p.length)?o.jsx(pT,{items:d.children,flowParams:t,onOpen:n,collapsedDirs:r,onToggleDir:s,onCreateFile:i,onCreateFolder:a,onDelete:l,onFileDragStart:u}):null]},d.path)})})}function nq({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 gm(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 rq(e){const t=gm((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 gm((r==null?void 0:r.default)||(r==null?void 0:r.value)||"")}function sq(e){return JSON.stringify(Array.from(new Set((e||[]).map(String).filter(Boolean))))}function iq(e){const t=gm((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 gm((r==null?void 0:r.default)||(r==null?void 0:r.value)||"")}function oq(e){return JSON.stringify(Array.from(new Set((e||[]).map(String).filter(Boolean))))}function Rj(e){var r,s,i,a,l,u;if(!e)return null;const{inputs:t,outputs:n}=LI(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:ds((l=e.data)==null?void 0:l.images),script:String(((u=e.data)==null?void 0:u.script)??""),inputs:t,outputs:n}}function aq(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}function lq(e,t,n){if(!e||!t||!n)return n;const r={...e};for(const s of["newId","label","role","model","body","images","script","inputs","outputs"])aq(e[s],t[s])&&(r[s]=n[s]);return r}function cq({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:[],u=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],d=Array.isArray(s)?s:[],f=Array.isArray(i)?i:[],[c,p]=m.useState(!1),[h,g]=m.useState(""),[v,k]=m.useState(()=>new Set),y=m.useRef(null),b=m.useRef(null),[w,N]=m.useState({visible:!1,top:0,height:100}),C=m.useMemo(()=>new Set(rq(t)),[t]),j=m.useMemo(()=>new Map(d.map(O=>[O.key,O])),[d]),R=m.useMemo(()=>{const O=new Set,I=f.map(P=>{const L=Ta(P,d).map(_=>j.get(_)).filter(Boolean);for(const _ of L)O.add(_.key);return{...P,skills:L}}).filter(P=>P.skills.length>0),B=d.filter(P=>!O.has(P.key));return{collectionGroups:I,ungrouped:B}},[j,f,d]);m.useEffect(()=>{k(O=>{let I=!1;const B=new Set(O);for(const P of R.collectionGroups)B.has(P.id)||(B.add(P.id),I=!0);return I?B:O})},[R.collectionGroups]);const D=m.useMemo(()=>{const O=h.trim().toLowerCase();if(!O)return R;const I=P=>[P==null?void 0:P.key,P==null?void 0:P.name,P==null?void 0:P.description].map(_=>String(_||"").toLowerCase()).join(" ").includes(O);return{collectionGroups:R.collectionGroups.map(P=>{const _=[P==null?void 0:P.id,P==null?void 0:P.name,P==null?void 0:P.description].map(G=>String(G||"").toLowerCase()).join(" ").includes(O)?P.skills:P.skills.filter(I);return{...P,skills:_}}).filter(P=>P.skills.length>0),ungrouped:R.ungrouped.filter(I)}},[R,h]),M=m.useCallback((O,I)=>{const B=new Set(C);for(const P of O)I?B.add(P):B.delete(P);a==null||a(e,Array.from(B))},[e,C,a]),z=m.useCallback(O=>{k(I=>{const B=new Set(I);return B.has(O)?B.delete(O):B.add(O),B})},[]),$=m.useCallback(()=>{const O=y.current;if(!O)return;const I=Math.max(1,O.scrollHeight),B=Math.max(1,O.clientHeight),P=I>B+1,L=P?Math.max(12,B/I*100):100,_=Math.max(0,100-L),G=P?Math.min(_,O.scrollTop/Math.max(1,I-B)*_):0;N({visible:P,top:G,height:L})},[]);m.useEffect(()=>{if(!c)return;const O=requestAnimationFrame($);return()=>cancelAnimationFrame(O)},[v,D,C.size,c,$]);const A=m.useCallback(O=>{const I=y.current;if(!I)return;const B=Math.max(0,I.scrollHeight-I.clientHeight);I.scrollTop=Math.min(1,Math.max(0,O))*B,$()},[$]),F=m.useCallback((O,I=0)=>{const B=b.current;if(!B)return 0;const P=B.getBoundingClientRect(),L=w.height/100*P.height,_=Math.max(1,P.height-L);return(O-P.top-I)/_},[w.height]),T=m.useCallback(O=>{var ue,de;if(!w.visible)return;O.preventDefault(),O.stopPropagation();const I=b.current;if(!I)return;const B=I.getBoundingClientRect(),P=w.top/100*B.height,L=w.height/100*B.height,G=O.clientY>=B.top+P&&O.clientY<=B.top+P+L?O.clientY-B.top-P:L/2;A(F(O.clientY,G));const Z=O.pointerId;(de=(ue=O.currentTarget).setPointerCapture)==null||de.call(ue,Z);const U=me=>{me.preventDefault(),A(F(me.clientY,G))},se=()=>{window.removeEventListener("pointermove",U),window.removeEventListener("pointerup",se),window.removeEventListener("pointercancel",se)};window.addEventListener("pointermove",U),window.addEventListener("pointerup",se),window.addEventListener("pointercancel",se)},[F,A,w.height,w.top,w.visible]);return o.jsxs("div",{className:"af-work-load-skills-card"+(n?" af-work-load-skills-card--selected":""),children:[l.map((O,I)=>{if(O.showOnNode===!1)return null;const B=`${2.6+I*1.7}rem`,P=O.name||`#${I+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:B},children:P}),o.jsx(xs,{type:"target",position:Ke.Left,id:`input-${I}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:B,background:Xn(O.type)},title:`${P} · ${O.type}`})]},`in-${I}`)}),u.map((O,I)=>{if(O.showOnNode===!1)return null;const B=`${2.6+I*1.7}rem`,P=O.name||`#${I+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:B},children:P}),o.jsx(xs,{type:"source",position:Ke.Right,id:`output-${I}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:B,background:Xn(O.type)},title:`${P} · ${O.type}`})]},`out-${I}`)}),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:O=>{var I;O.stopPropagation(),c||(I=t==null?void 0:t.onRefreshSkills)==null||I.call(t),p(B=>!B)},children:[o.jsx("span",{children:C.size>0?`${C.size} skills selected`:"选择 Skills"}),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:O=>O.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:O=>g(O.target.value),placeholder:"搜索 Skills...",spellCheck:!1,autoComplete:"off","aria-label":"搜索 Skills"}),h?o.jsx("button",{type:"button",onClick:()=>g(""),"aria-label":"清空搜索",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),o.jsxs("div",{ref:y,className:"af-work-load-skills-menu",onScroll:$,children:[D.collectionGroups.map(O=>{const I=O.skills.map(_=>_.key),B=I.filter(_=>C.has(_)).length,P=I.length>0&&B===I.length,L=v.has(O.id);return o.jsxs("section",{className:"af-work-load-skills-menu__group"+(L?" 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:_=>M(I,_.target.checked),"aria-label":`选择 ${O.name}`}),o.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-toggle",onClick:()=>z(O.id),"aria-expanded":!L,children:o.jsxs("span",{className:"af-work-load-skills-menu__group-main",children:[o.jsx("span",{children:O.name}),O.description?o.jsx("em",{children:O.description}):null]})}),o.jsxs("small",{children:[B,"/",I.length]}),o.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-arrow",onClick:()=>z(O.id),"aria-label":L?`展开 ${O.name}`:`收起 ${O.name}`,children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:L?"chevron_right":"expand_more"})})]}),L?null:o.jsx("div",{className:"af-work-load-skills-menu__options",children:O.skills.map(_=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:C.has(_.key),onChange:G=>M([_.key],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:_.name}),_.description?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:_.description}):null]})]},`${O.id}:${_.key}`))})]},O.id)}),D.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:D.ungrouped.length})]}),o.jsx("div",{className:"af-work-load-skills-menu__options",children:D.ungrouped.map(O=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:C.has(O.key),onChange:I=>M([O.key],I.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:O.name}),O.description?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:O.description}):null]})]},`ungrouped:${O.key}`))})]}):null,D.collectionGroups.length===0&&D.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:b,className:"af-work-load-skills-scrollbar"+(w.visible?" af-work-load-skills-scrollbar--visible":""),onPointerDown:T,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${w.height}%`,top:`${w.top}%`}})})]}):null]})]})}function uq({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:[],[u,d]=m.useState(!1),[f,c]=m.useState(""),p=m.useMemo(()=>new Set(iq(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]),g=m.useMemo(()=>{const k=f.trim().toLowerCase();return k?h.filter(y=>[y.name,y.description,y.detail,y.type].join(" ").toLowerCase().includes(k)):h},[f,h]),v=m.useCallback((k,y)=>{const b=new Set(p);for(const w of k)y?b.add(w):b.delete(w);i==null||i(e,Array.from(b))},[e,p,i]);return o.jsxs("div",{className:"af-work-load-skills-card"+(n?" af-work-load-skills-card--selected":""),children:[a.map((k,y)=>{if(k.showOnNode===!1)return null;const b=`${2.6+y*1.7}rem`,w=k.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:w}),o.jsx(xs,{type:"target",position:Ke.Left,id:`input-${y}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:b,background:Xn(k.type)},title:`${w} · ${k.type}`})]},`in-${y}`)}),l.map((k,y)=>{if(k.showOnNode===!1)return null;const b=`${2.6+y*1.7}rem`,w=k.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:w}),o.jsx(xs,{type:"source",position:Ke.Right,id:`output-${y}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:b,background:Xn(k.type)},title:`${w} · ${k.type}`})]},`out-${y}`)}),o.jsxs("div",{className:"af-work-load-skills-card__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"hub"}),o.jsx("strong",{children:(t==null?void 0:t.label)||"Load MCP"}),o.jsx("span",{children:(t==null?void 0:t.definitionId)||"control_load_mcp"}),o.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-work-load-skills-card__body nodrag",children:[o.jsxs("button",{type:"button",className:"af-work-load-skills-card__select",onClick:k=>{var y;k.stopPropagation(),u||(y=t==null?void 0:t.onRefreshMcps)==null||y.call(t),d(b=>!b)},children:[o.jsx("span",{children:p.size>0?`${p.size} MCP selected`:"选择 MCP"}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:u?"expand_less":"expand_more"})]}),u?o.jsxs("div",{className:"af-work-load-skills-menu-shell",onClick: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:f,onChange:k=>c(k.target.value),placeholder:"搜索 MCP...",spellCheck:!1,autoComplete:"off","aria-label":"搜索 MCP"}),f?o.jsx("button",{type:"button",onClick:()=>c(""),"aria-label":"清空搜索",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),o.jsxs("div",{className:"af-work-load-skills-menu",children:[o.jsxs("section",{className:"af-work-load-skills-menu__group",children:[o.jsxs("div",{className:"af-work-load-skills-menu__group-head af-work-load-skills-menu__group-head--plain",children:[o.jsx("span",{children:"MCP Servers"}),o.jsx("small",{children:g.length})]}),o.jsx("div",{className:"af-work-load-skills-menu__options",children:g.map(k=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:p.has(k.name),onChange:y=>v([k.name],y.target.checked)}),o.jsxs("span",{className:"af-work-load-skills-menu__option-main",children:[o.jsx("span",{className:"af-work-load-skills-menu__option-title",children: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))})]}),g.length===0?o.jsx("div",{className:"af-work-load-skills-menu__empty",children:"没有匹配的 MCP"}):null,o.jsx("button",{type:"button",className:"af-work-load-skills-menu__clear",onClick:()=>i==null?void 0:i(e,[]),children:"清空"})]})]}):null]})]})}function dq(){var Au,sl;const{i18n:e}=Sn(),{navigate:t}=Ba(),n=Dl(),r=uv(),s=m.useMemo(SK,[]),[i,a]=ZP([]),[l,u,d]=eA([]),f=m.useRef([]),c=m.useRef([]),p=m.useRef(new Map),h=m.useRef(new Map),g=m.useRef(null),v=m.useRef(null),k=m.useRef(null),[y,b]=m.useState(null),[w,N]=m.useState({}),C=m.useRef({}),j=m.useRef(!1),R=m.useRef(null),[D,M]=m.useState([]),[z,$]=m.useState(""),[A,F]=m.useState("nodes"),[T,O]=m.useState([]),[I,B]=m.useState(!1),[P,L]=m.useState(""),[_,G]=m.useState(!1),[Z,U]=m.useState({name:"",id:"",description:""}),[se,ue]=m.useState(!1),[de,me]=m.useState(""),[ae,Ne]=m.useState(""),Pe=m.useRef(null),[be,Ie]=m.useState(!1),[_e,nt]=m.useState("nodes"),[st,Je]=m.useState(""),[Ct,Be]=m.useState(0),[mt,Gt]=m.useState(""),[De,en]=m.useState(null),[rn,pn]=m.useState(""),[Hn,le]=m.useState([]),[ve,qe]=m.useState(""),[ge,lt]=m.useState(!0),[Bt,hn]=m.useState(""),[In,mn]=m.useState(()=>new Set),cr=m.useRef(null),[Xt,Wn]=m.useState(()=>{try{const E=Number(window.localStorage.getItem("agentflow.workspace.filesPaneHeight")||0);if(Number.isFinite(E)&&E>=160)return E}catch{}return 360}),[Tn,br]=m.useState(!1),[xe,Me]=m.useState({cursor:[],opencode:[],claudeCode:[]}),[Qe,re]=m.useState(""),[ke,et]=m.useState([]),[Mt,Nn]=m.useState(!1),[sn,Gr]=m.useState([]),[Xr,bs]=m.useState([]),[vr,Wo]=m.useState(!1),[Zn,vs]=m.useState([]),Ai=m.useCallback(E=>{Pe.current&&window.clearTimeout(Pe.current),Ne(E),Pe.current=window.setTimeout(()=>{Ne(""),Pe.current=null},3800)},[]),mo=m.useCallback(E=>{const W=String(E||"").trim();if(!W)return;const Y=()=>r(W);window.requestAnimationFrame(Y),window.setTimeout(Y,80)},[r]);m.useEffect(()=>{try{window.localStorage.setItem("agentflow.workspace.filesPaneHeight",String(Math.round(Xt)))}catch{}},[Xt]);const ni=m.useCallback(E=>{const W=cr.current;if(!W)return;const Y=W.getBoundingClientRect(),J=16,Q=150,ie=230,ne=Y.top+J,oe=Y.bottom-J,ye=Math.max(Q,oe-ne-ie),Ee=Math.min(Math.max(E-ne,Q),ye);Wn(Ee)},[]),Vn=m.useCallback(E=>{E.preventDefault(),E.stopPropagation(),br(!0),ni(E.clientY);const W=J=>{J.preventDefault(),ni(J.clientY)},Y=()=>{br(!1),window.removeEventListener("pointermove",W,!0),window.removeEventListener("pointerup",Y,!0),window.removeEventListener("pointercancel",Y,!0)};window.addEventListener("pointermove",W,!0),window.addEventListener("pointerup",Y,!0),window.addEventListener("pointercancel",Y,!0)},[ni]);m.useEffect(()=>()=>{Pe.current&&window.clearTimeout(Pe.current)},[]);const[Re,Qt]=m.useState(()=>new Set),[er,gt]=m.useState(!1),Fs=m.useRef(null),Un=m.useRef(null),Mn=m.useRef(null),[ks,at]=m.useState({}),[Kt,Ht]=m.useState(""),[jn,Ye]=m.useState(!1),[tr,Br]=m.useState([]),[go,kr]=m.useState([]),[Ii,Ss]=m.useState("workspace"),[ri,zs]=m.useState(!1),[si,tn]=m.useState(!0),[Ns,ii]=m.useState(""),[Tr,Sr]=m.useState({}),[V,fe]=m.useState(!1),[Te,Ae]=m.useState(!1),[Ge,$t]=m.useState("pan"),[yt,Kn]=m.useState(null),[$n,Ti]=m.useState(""),js=m.useRef(null),Cs=m.useRef(!1),[nr,Jr]=m.useState(()=>new Set),[zl,Ri]=m.useState({}),[oi,ze]=m.useState(""),Qr=m.useMemo(()=>jK(s),[s]),[Vo,Wa]=m.useState("");m.useEffect(()=>{s.flowId&&n_(s.flowId,s.flowSource||"user","workspace",!!s.archived)},[s]),m.useEffect(()=>{Br([]),kr([]),Ss("workspace"),tn(!0)},[s]);const rr=m.useCallback(async()=>{const E=hl(s),W=await fetch(`/api/workspace/files?${E.toString()}`),Y=await W.json();if(!W.ok)throw new Error(Y.error||"读取 workspace 失败");const J=Y.files||[];le(J),mn(new Set(fT(J))),qe(Y.root||"")},[s]),Wt=m.useCallback(async()=>{B(!0),L("");try{const E=await fetch("/api/marketplace/flow-snippets"),W=await E.json().catch(()=>({}));if(!E.ok)throw new Error(W.error||"读取流程片段失败");O(Array.isArray(W.snippets)?W.snippets:[])}catch(E){L(String(E.message||E)),O([])}finally{B(!1)}},[]),ur=m.useCallback(async(E=i,W=l)=>{var ie;if(!j.current)return;if(!ge)throw ze("Readonly workspace"),new Error("Readonly workspace");const Y=Wp(E,W,C.current),J=await fetch("/api/workspace/graph",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,graph:Y})}),Q=await J.json();if(!J.ok)throw new Error(Q.error||"保存 workspace graph 失败");C.current=((ie=Q.graph)==null?void 0:ie.instances)||Y.instances,N(C.current),ze("Workspace graph saved")},[l,s,i,ge]),Dn=m.useCallback(E=>{var Y;const W=(Y=E==null?void 0:E.extra)!=null&&Y.instances&&typeof E.extra.instances=="object"?E.extra.instances:{};C.current=W,N(W),a(Array.isArray(E==null?void 0:E.nodes)?E.nodes:[]),u(Array.isArray(E==null?void 0:E.edges)?E.edges:[]),Gt(""),b(null)},[u,a]),bu=m.useMemo(()=>({instances:w}),[w]),Bl=MI({nodes:i,edges:l,extra:bu,enabled:j.current,onRestore:Dn}),{resetHistory:ai,undo:Va,redo:Hl}=Bl,Bs=m.useCallback(async()=>{j.current=!1;const E=hl(s),W=hl(s);W.set("lang",String(e.language||"zh").startsWith("zh")?"zh":"en");const[Y,J]=await Promise.all([fetch(`/api/nodes?${W.toString()}`),fetch(`/api/workspace/graph?${E.toString()}`),rr()]),Q=await Y.json(),ie=await J.json();if(!Y.ok)throw new Error(Q.error||"读取节点定义失败");if(!J.ok)throw new Error(ie.error||"读取 workspace graph 失败");const ne=[...(Array.isArray(Q)?Q:Q.nodes||[]).filter(ct=>!hK.has(ct.id)),gK,yK,mK];M(ne);const oe=ie.graph||JSON.parse(localStorage.getItem(pK)||"null")||{},ye=Uy(oe,ne);C.current=ye.instances,N(ye.instances),a(ye.nodes),u(ye.edges),ai(ye.nodes,ye.edges,{instances:ye.instances});const Ee=ie.writable!==!1;lt(Ee),ze(Ee?"Workspace ready":"Readonly workspace"),j.current=!0},[s,e.language,rr,ai,u,a]),mr=m.useCallback(async(E,W)=>{const Y={packageId:(E==null?void 0:E.newId)||(E==null?void 0:E.id)||(E==null?void 0:E.label),label:(E==null?void 0:E.label)||(E==null?void 0:E.newId)||(E==null?void 0:E.id),version:"1.0.0",definitionId:W,body:(E==null?void 0:E.body)||"",script:(E==null?void 0:E.script)||"",inputs:Array.isArray(E==null?void 0:E.inputs)?E.inputs:[],outputs:Array.isArray(E==null?void 0:E.outputs)?E.outputs:[],flowId:s.flowId,flowSource:s.flowSource||"user",archived:!!s.archived},J=await fetch("/api/marketplace/publish-node-from-instance",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Y)}),Q=await J.json().catch(()=>({}));if(!J.ok||(Q==null?void 0:Q.ok)===!1)throw new Error((Q==null?void 0:Q.error)||"Publish failed");return await Bs(),ze(`Published node ${Q.definitionId||Q.id||Y.packageId}`),Q},[s,Bs]),Ua=m.useCallback((E="workspace")=>{zs(!0),en(null),Ss(E||"workspace")},[]),Uo=m.useCallback(async(E="")=>{const W=String(E||$n||"").trim();if(W){Cs.current=!0,js.current&&(js.current.abort(),js.current=null),Ti(""),Jr(new Set),Ri(Y=>{const J={...Y};for(const[Q,ie]of Object.entries(J))(ie==null?void 0:ie.status)==="running"&&(J[Q]={status:"stopped"});return J[W]={status:"stopped"},J}),ze(`Workspace run stopped: ${W}`),kr(Y=>Y.map(J=>J.runNodeId===W&&J.status==="running"?{...J,status:"stopped",endedAt:Date.now(),messages:[...Array.isArray(J.messages)?J.messages:[],{role:"assistant",kind:"status",text:"Workspace run stopped.",at:Date.now()}].slice(-160)}:J));try{await fetch("/api/workspace/run/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,runNodeId:W})})}catch{}}},[s,$n]),Ka=m.useCallback(async E=>{if(!ge){ze("Readonly workspace");return}if(!E||$n)return;const W=Wp(i,l,C.current),Y=`run-${Date.now()}-${String(E).replace(/[^a-z0-9_-]+/gi,"_")}`,J=`Run ${E}`,Q=new AbortController;js.current=Q,Cs.current=!1,Ti(E),Jr(new Set([E])),Ri({[E]:{status:"running"}}),ze(`Running ${E}...`),Ss(Y),kr(ie=>[...ie.slice(-7),{id:Y,label:J,runNodeId:E,status:"running",startedAt:Date.now(),steps:[],messages:[{role:"assistant",kind:"run-summary",text:"准备运行...",at:Date.now()}]}]);try{await ur(i,l);const ie=await fetch("/api/workspace/run",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/x-ndjson"},signal:Q.signal,body:JSON.stringify({...s,graph:W,runNodeId:E,model:Qe,selectedSkills:sn,stream:!0})});if(!ie.ok){const he=await ie.json().catch(()=>({}));throw new Error(he.error||"Workspace run failed")}if(!ie.body)throw new Error("Workspace run stream unavailable");const ne=ie.body.getReader(),oe=new TextDecoder;let ye="",Ee=[],ct=[],Ze=E;const Xe=(he,tt)=>{var ut,qt;const pt=i.find(Nt=>Nt.id===he),it=String(((ut=pt==null?void 0:pt.data)==null?void 0:ut.label)||he||"").trim(),$e=String(tt||((qt=pt==null?void 0:pt.data)==null?void 0:qt.definitionId)||"").trim();return $e&&$e!==it?`${it} (${$e})`:it},Vt=(he,tt,pt)=>{const it=String(he||"").trim();it&&kr($e=>$e.map(ut=>{if(ut.id!==Y)return ut;const Nt=[...Array.isArray(ut.steps)?ut.steps:[]],Ot=Nt.findIndex(zi=>zi.id===it),an={id:it,label:Xe(it,tt),status:pt};Ot>=0?Nt[Ot]={...Nt[Ot],...an}:Nt.push(an);const jt=Nt.map((zi,wo)=>{const Bi=zi.status==="done"?"[done]":zi.status==="failed"?"[failed]":"[running]";return`${wo+1}. ${Bi} ${zi.label}`}).join(`
|
|
148
|
+
`),Zt=Array.isArray(ut.messages)?ut.messages:[],dr=Zt.findIndex(zi=>zi.kind==="run-summary"),Vs={role:"assistant",kind:"run-summary",text:jt||"准备运行...",at:Date.now()},xn=[...Zt];return dr>=0?xn[dr]=Vs:xn.unshift(Vs),{...ut,steps:Nt,messages:xn.slice(-160)}}))},gn=he=>{const tt=String(he||"").trim();if(!tt)return;const pt=Ze;Ze=tt,Jr(new Set([tt])),Ri(it=>{var $e;return{...it,...pt&&pt!==tt&&(($e=it[pt])==null?void 0:$e.status)==="running"?{[pt]:{status:"success"}}:{},[tt]:{status:"running"}}})},yn=he=>{const tt=String(he||"").trim();tt&&(Jr(pt=>{const it=new Set(pt);return it.delete(tt),it}),Ri(pt=>({...pt,[tt]:{status:"success"}})))},Nr=(he,tt)=>{const pt=String(tt||"");if(!pt.trim())return;const it=["assistant","thinking","result","error","prompt"].includes(he)?he:"assistant";kr($e=>$e.map(ut=>{if(ut.id!==Y)return ut;let qt=Array.isArray(ut.messages)?ut.messages:[];if(it==="result"){const an=[...qt].reverse().find(jt=>jt.kind==="assistant");if(String((an==null?void 0:an.text)||"").trim()===pt.trim())return ut}if(it==="assistant"){const an=qt.findIndex(jt=>jt.kind==="result"&&String(jt.text||"").trim()===pt.trim());an>=0&&(qt=qt.filter((jt,Zt)=>Zt!==an))}const Nt=[...qt],Ot=Nt[Nt.length-1];return Ot&&Ot.kind===it&&!Ot.error?Nt[Nt.length-1]={...Ot,text:`${Ot.text||""}${Ot.text?`
|
|
149
|
+
`:""}${pt}`}:Nt.push({role:"assistant",kind:it,text:pt,...it==="error"?{error:!0}:{},at:Date.now()}),{...ut,messages:Nt.slice(-160)}}))},Le=he=>{const tt=String(he||"");tt.trim()&&kr(pt=>pt.map(it=>{var Nt;if(it.id!==Y)return it;const $e=Array.isArray(it.messages)?it.messages:[],ut=$e.findIndex(Ot=>Ot.kind==="thinking"),qt=[...$e];if(ut>=0){const Ot=String(((Nt=qt[ut])==null?void 0:Nt.text)||"");qt[ut]={...qt[ut],text:`${Ot}${Ot&&!Ot.endsWith(`
|
|
150
|
+
`),""}${tt}`,at:Date.now()}}else{const Ot=qt.findIndex(an=>an.kind==="activity");qt.splice(Ot>=0?Ot+1:qt.length,0,{role:"assistant",kind:"thinking",text:tt,at:Date.now()})}return{...it,messages:qt.slice(-160)}}))},Dt=he=>{const tt=EK(he);tt&&kr(pt=>pt.map(it=>{if(it.id!==Y)return it;const $e=Array.isArray(it.activities)?it.activities:[],ut=$e[$e.length-1]===tt?$e:[...$e,tt].slice(-8),qt=Array.isArray(it.messages)?it.messages:[],Nt=qt.findIndex(jt=>jt.kind==="activity"),Ot={role:"assistant",kind:"activity",text:ut.map((jt,Zt)=>`${Zt+1}. ${jt}`).join(`
|
|
151
|
+
`),at:Date.now()},an=[...qt];if(Nt>=0)an[Nt]=Ot;else{const jt=an.findIndex(Zt=>Zt.kind==="run-summary");an.splice(jt>=0?jt+1:0,0,Ot)}return{...it,activities:ut,messages:an.slice(-160)}}))},It=he=>{const tt=String((he==null?void 0:he.source)||"runner"),pt=String((he==null?void 0:he.stream)||""),it=String((he==null?void 0:he.eventType)||"event"),$e=String((he==null?void 0:he.text)||"").trim();if(!$e)return;const ut=`[${tt}${pt?`:${pt}`:""}] ${it}
|
|
152
|
+
${$e}`;kr(qt=>qt.map(Nt=>{if(Nt.id!==Y)return Nt;const an=[...Array.isArray(Nt.rawTrace)?Nt.rawTrace:[],ut].slice(-80),jt=Array.isArray(Nt.messages)?Nt.messages:[],Zt=jt.findIndex(xn=>xn.kind==="raw"),dr={role:"assistant",kind:"raw",text:an.join(`
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
`),at:Date.now()},Vs=[...jt];return Zt>=0?Vs[Zt]=dr:Vs.push(dr),{...Nt,rawTrace:an,messages:Vs.slice(-160)}}))},on=he=>{kr(tt=>tt.map(pt=>pt.id===Y?{...pt,status:he,endedAt:Date.now()}:pt))},jr=he=>{const tt=new Set,pt=String((he==null?void 0:he.nodeId)||"").trim();pt&&tt.add(pt);for(const it of Array.isArray(he==null?void 0:he.displayNodeIds)?he.displayNodeIds:[]){const $e=String(it||"").trim();$e&&tt.add($e)}for(const it of Array.isArray(he==null?void 0:he.touchedNodeIds)?he.touchedNodeIds:[]){const $e=String(it||"").trim();$e&&tt.add($e)}if(tt.size===0)for(const it of Array.isArray(he==null?void 0:he.order)?he.order:[]){const $e=String(it||"").trim();$e&&tt.add($e)}return tt},ft=(he,tt=null)=>{const pt=Uy(he||W,D),it=new Map(pt.nodes.map(qt=>[qt.id,qt])),$e=pt.instances||{},ut=tt instanceof Set?tt:null;a(qt=>{const Nt=new Set(qt.map(jt=>jt.id)),an={...Wp(qt,c.current,C.current).instances||{}};for(const[jt,Zt]of Object.entries($e)){if(ut&&!ut.has(jt)||!Nt.has(jt))continue;const dr=an[jt];as((Zt==null?void 0:Zt.definitionId)||(dr==null?void 0:dr.definitionId))?an[jt]=Zt:Array.isArray(Zt==null?void 0:Zt.output)&&(an[jt]={...dr||Zt,output:Zt.output})}return C.current=an,N(an),qt.map(jt=>{var dr,Vs,xn;if(ut&&!ut.has(jt.id))return jt;const Zt=it.get(jt.id);return Zt?as(((dr=Zt.data)==null?void 0:dr.definitionId)||((Vs=jt.data)==null?void 0:Vs.definitionId))?{...jt,data:{...jt.data,...Zt.data}}:Array.isArray((xn=Zt.data)==null?void 0:xn.outputs)?{...jt,data:{...jt.data,outputs:Zt.data.outputs}}:jt:jt})})};for(;;){const{value:he,done:tt}=await ne.read();if(tt)break;ye+=oe.decode(he,{stream:!0});const pt=ye.split(`
|
|
157
|
+
`);ye=pt.pop()||"";for(const it of pt){if(!it.trim())continue;const $e=JSON.parse(it);if($e.type==="error")throw new Error($e.error||"Workspace run failed");if($e.type==="stopped"){Cs.current=!0,Ee=Array.isArray($e.order)?$e.order:Ee;continue}if($e.type==="node-start"&&(ze(`Running ${$e.nodeId}...`),gn($e.nodeId),Vt($e.nodeId,$e.definitionId,"running")),$e.type==="node-done"&&(yn($e.nodeId),Vt($e.nodeId,$e.definitionId,"done")),$e.type==="status"&&Dt($e.line||$e.message||""),$e.type==="paused"&&(ct=Array.isArray($e.nodeIds)?$e.nodeIds:[]),$e.type==="natural"&&($e.kind==="thinking"?Le($e.text||""):Nr($e.kind,$e.text||"")),$e.type==="raw"){const ut=Cj($e);ut&&Le(ut),It($e)}$e.type==="graph"&&$e.graph&&ft($e.graph,jr($e)),$e.type==="done"&&($e.graph&&ft($e.graph,jr($e)),Ee=Array.isArray($e.order)?$e.order:[],ct=Array.isArray($e.pauseNodeIds)?$e.pauseNodeIds:ct)}}if(ye.trim()){const he=JSON.parse(ye);if(he.type==="error")throw new Error(he.error||"Workspace run failed");if(he.type==="stopped"&&(Cs.current=!0),he.type==="node-start"&&(ze(`Running ${he.nodeId}...`),gn(he.nodeId),Vt(he.nodeId,he.definitionId,"running")),he.type==="node-done"&&(yn(he.nodeId),Vt(he.nodeId,he.definitionId,"done")),he.type==="status"&&Dt(he.line||he.message||""),he.type==="paused"&&(ct=Array.isArray(he.nodeIds)?he.nodeIds:[]),he.type==="natural"&&(he.kind==="thinking"?Le(he.text||""):Nr(he.kind,he.text||"")),he.type==="raw"){const tt=Cj(he);tt&&Le(tt),It(he)}he.type==="graph"&&he.graph&&ft(he.graph,jr(he)),he.type==="done"&&(he.graph&&ft(he.graph,jr(he)),Ee=Array.isArray(he.order)?he.order:[],ct=Array.isArray(he.pauseNodeIds)?he.pauseNodeIds:ct)}Cs.current&&(Jr(new Set),Ri(he=>{var pt;const tt=((pt=Object.entries(he).find(([,it])=>(it==null?void 0:it.status)==="running"))==null?void 0:pt[0])||E;return tt?{...he,[tt]:{status:"stopped"}}:he})),ze(Cs.current?`Workspace run stopped: ${E}`:ct.length?`Workspace run paused at ${ct.join(", ")}`:`Workspace run done: ${Ee.length?Ee.join(" -> "):E}`),on(Cs.current?"stopped":ct.length?"paused":"done"),Cs.current||await rr()}catch(ie){if(Cs.current||(ie==null?void 0:ie.name)==="AbortError"){Jr(new Set),Ri(ne=>{var ye;const oe=((ye=Object.entries(ne).find(([,Ee])=>(Ee==null?void 0:Ee.status)==="running"))==null?void 0:ye[0])||E;return oe?{...ne,[oe]:{status:"stopped"}}:ne}),ze(`Workspace run stopped: ${E}`),kr(ne=>ne.map(oe=>oe.id===Y?{...oe,status:"stopped",endedAt:Date.now()}:oe));return}Jr(new Set),Ri(ne=>{var ye;const oe=(ye=Object.entries(ne).find(([,Ee])=>(Ee==null?void 0:Ee.status)==="running"))==null?void 0:ye[0];return oe?{...ne,[oe]:{status:"failed"}}:ne}),ze(String(ie.message||ie)),kr(ne=>ne.map(oe=>oe.id===Y?{...oe,status:"failed",endedAt:Date.now(),messages:[...Array.isArray(oe.messages)?oe.messages:[],{role:"assistant",error:!0,text:String(ie.message||ie),at:Date.now()}].slice(-160)}:oe))}finally{js.current===Q&&(js.current=null),Ti(""),Jr(new Set)}},[Qe,l,s,rr,i,D,$n,ur,sn,u,a,ge]),qa=m.useCallback(async()=>{try{const W=await(await fetch("/api/skills")).json().catch(()=>({})),Y=Array.isArray(W.skills)?W.skills.map(J=>({key:String(J.key),name:String(J.name||J.id||J.key),description:J.description?String(J.description):"",sourceLabel:J.sourceLabel?String(J.sourceLabel):""})):[];et(Y),Nn(!0)}catch{Nn(!0)}},[]),Li=m.useCallback(async()=>{try{const W=await(await fetch("/api/mcps")).json().catch(()=>({})),Y=Array.isArray(W.servers)?W.servers.map(J=>({name:String((J==null?void 0:J.name)||""),type:String((J==null?void 0:J.type)||""),url:String((J==null?void 0:J.url)||""),command:String((J==null?void 0:J.command)||""),args:Array.isArray(J==null?void 0:J.args)?J.args.map(String):[],description:String((J==null?void 0:J.description)||"")})).filter(J=>J.name):[];vs(Y)}catch{vs([])}},[]);m.useEffect(()=>{Bs().catch(E=>ze(String(E.message||E))),Wt(),fetch("/api/model-lists").then(E=>E.json()).then(E=>Me({cursor:Array.isArray(E.cursor)?E.cursor.map(String):[],opencode:Array.isArray(E.opencode)?E.opencode.map(String):[],claudeCode:Array.isArray(E.claudeCode)?E.claudeCode.map(String):[]})).catch(()=>{}),qa(),Li(),fetch("/api/skill-collections").then(E=>E.json()).then(E=>{bs(Ca(E)),Wo(!0)}).catch(()=>{}),fetch("/api/auth/me").then(E=>E.json()).then(E=>Kn(E.user||null)).catch(()=>Kn(null))},[Bs,Wt,Li,qa,Qr]),m.useEffect(()=>{if(Wa(""),!(!Mt||!vr)){if(!Qr){Gr([]);return}Gr(o_(Qr,"workspace",ke,Xr)),Wa(Qr)}},[Xr,vr,ke,Mt,Qr]),m.useEffect(()=>{if(!(Vo!==Qr||!Qr))try{localStorage.setItem(Qr,JSON.stringify(sn))}catch{}},[sn,Qr,Vo]),m.useEffect(()=>{C.current=w},[w]),m.useEffect(()=>{f.current=i},[i]),m.useEffect(()=>{const E=p.current,W=new Map,Y=[];for(const ne of i){const oe=sT(ne);W.set(ne.id,oe),E.get(ne.id)!==oe&&Y.push(ne.id)}if(p.current=W,Y.length===0)return;const J=()=>Y.forEach(ne=>r(ne)),Q=window.requestAnimationFrame(J),ie=window.setTimeout(J,80);return()=>{window.cancelAnimationFrame(Q),window.clearTimeout(ie)}},[i,r]),m.useEffect(()=>{c.current=l},[l]),m.useEffect(()=>{k.current=y},[y]),m.useEffect(()=>{if(!y)return;const E=Y=>{Y.key==="Escape"&&b(null)},W=Y=>{var J,Q;(Q=(J=Y.target)==null?void 0:J.closest)!=null&&Q.call(J,".af-connect-node-menu")||b(null)};return document.addEventListener("keydown",E),document.addEventListener("pointerdown",W),()=>{document.removeEventListener("keydown",E),document.removeEventListener("pointerdown",W)}},[y]),m.useEffect(()=>{if(j.current&&ge)return R.current&&window.clearTimeout(R.current),R.current=window.setTimeout(()=>{ur().catch(E=>ze(String(E.message||E)))},650),()=>{R.current&&window.clearTimeout(R.current)}},[i,l,ur,ge]);const Ya=m.useCallback((E,W)=>{if(!ge){ze("Readonly workspace");return}const Y=sq(W),J=ye=>Array.isArray(ye)?ye.map(Ee=>(Ee==null?void 0:Ee.name)!=="skillKeys"&&(Ee==null?void 0:Ee.name)!=="skillsContext"&&(Ee==null?void 0:Ee.type)!=="text"?Ee:{...Ee,default:Y,value:Y}):[],Q=i.map(ye=>{var Ee;return ye.id!==E?ye:{...ye,data:{...ye.data,body:Y,inputs:J((Ee=ye.data)==null?void 0:Ee.inputs)}}}),ie=C.current||{},ne=ie[E]&&typeof ie[E]=="object"?ie[E]:{},oe={...ie,[E]:{...ne,body:Y,input:J(ne.input)}};C.current=oe,a(Q),N(oe),en(ye=>!ye||ye.id!==E?ye:{...ye,body:Y,inputs:J(ye.inputs)}),ur(Q,l).catch(ye=>ze(String(ye.message||ye)))},[l,i,ur,a,ge]),Ga=m.useCallback((E,W)=>{if(!ge){ze("Readonly workspace");return}const Y=oq(W),J=ye=>Array.isArray(ye)?ye.map(Ee=>(Ee==null?void 0:Ee.name)!=="serverNames"&&(Ee==null?void 0:Ee.name)!=="mcpContext"&&(Ee==null?void 0:Ee.type)!=="text"?Ee:{...Ee,default:Y,value:Y}):[],Q=i.map(ye=>{var Ee;return ye.id!==E?ye:{...ye,data:{...ye.data,body:Y,inputs:J((Ee=ye.data)==null?void 0:Ee.inputs)}}}),ie=C.current||{},ne=ie[E]&&typeof ie[E]=="object"?ie[E]:{},oe={...ie,[E]:{...ne,body:Y,input:J(ne.input)}};C.current=oe,a(Q),N(oe),en(ye=>!ye||ye.id!==E?ye:{...ye,body:Y,inputs:J(ye.inputs)}),ur(Q,l).catch(ye=>ze(String(ye.message||ye)))},[l,i,ur,a,ge]),Wl=m.useCallback(E=>{const W=String(E||"").trim();W&&(ii(Y=>Y===W?"":W),Sr(Y=>({...Y,[W]:Y[W]||{sessionId:`nodechat_${Date.now()}_${W.replace(/[^a-z0-9_-]+/gi,"_")}`,messages:[],draft:"",candidateContent:"",running:!1,error:""}})))},[]),Xa=m.useCallback((E,W)=>{const Y=String(E||"").trim();Y&&Sr(J=>({...J,[Y]:{...J[Y]||{sessionId:`nodechat_${Date.now()}_${Y.replace(/[^a-z0-9_-]+/gi,"_")}`,messages:[]},draft:String(W||""),error:""}}))},[]),Ko=m.useCallback((E,W,Y="replace",J={})=>{var Nr;if(!ge){ze("Readonly workspace");return}const Q=String(E||"").trim();if(!Q)return;const ie=f.current.find(Le=>Le.id===Q),ne=as((Nr=ie==null?void 0:ie.data)==null?void 0:Nr.definitionId),oe=ne==="html"?aT(W):String(W||""),ye=ie?Pd(ie.data):"",Ee=Y==="append"&&String(ye||"").trim()?`${String(ye).replace(/\s+$/g,"")}
|
|
158
|
+
|
|
159
|
+
${oe.trim()}`:oe,ct=ne==="image"?"src":"content",Ze=Le=>{let Dt=!1;return(Array.isArray(Le)?Le:[]).map(on=>{const jr=String((on==null?void 0:on.name)||""),ft=String((on==null?void 0:on.type)||"");return!Dt&&(jr===ct||jr==="filePath"||ft==="text")?(Dt=!0,{...on,default:Ee,value:Ee}):on})},Xe=f.current.map(Le=>{var Dt,It;return Le.id!==Q?Le:{...Le,data:{...Le.data,body:Ee,inputs:Ze((Dt=Le.data)==null?void 0:Dt.inputs),outputs:Ze((It=Le.data)==null?void 0:It.outputs)}}}),Vt=C.current||{},gn=Vt[Q]&&typeof Vt[Q]=="object"?Vt[Q]:{},yn={...Vt,[Q]:{...gn,body:Ee,input:Ze(gn.input),output:Ze(gn.output)}};C.current=yn,a(Xe),N(yn),en(Le=>(Le==null?void 0:Le.id)===Q?{...Le,body:Ee}:Le),(J==null?void 0:J.logChat)!==!1&&Sr(Le=>{var Dt;return{...Le,[Q]:{...Le[Q]||{},candidateContent:"",messages:[...(Dt=Le[Q])!=null&&Dt.messages&&Array.isArray(Le[Q].messages)?Le[Q].messages:[],{role:"assistant",text:Y==="append"?"已追加到当前节点内容。":"已替换当前节点内容。",at:Date.now()}]}}}),ur(Xe,c.current).catch(Le=>ze(String(Le.message||Le))),ze(String((J==null?void 0:J.statusMessage)||"")||(Y==="append"?"已追加节点内容":"已替换节点内容"))},[ur,a,ge]),Zr=m.useCallback(async E=>{if(!ge)return ze("Readonly workspace"),"";if(!hm(E))return ze("请选择图片文件"),"";try{const W=new FormData;W.set("file",E),W.set("dir","img"),s.flowId&&W.set("flowId",s.flowId),s.flowSource&&W.set("flowSource",s.flowSource),s.archived&&W.set("archived","1");const Y=await fetch("/api/workspace/upload",{method:"POST",body:W}),J=await Y.json().catch(()=>({}));if(!Y.ok)throw new Error(J.error||"上传图片失败");const Q=String(J.path||"").trim();if(!Q)throw new Error("上传图片失败:未返回路径");return await rr(),mn(ie=>{const ne=new Set(ie);for(const oe of Vp(Q))ne.delete(oe);return ne}),ze(`已上传图片 ${Q}`),Q}catch(W){return ze(String(W.message||W)),""}},[s,rr,ge]),Vl=m.useCallback(async(E,W)=>{const Y=String(E||"").trim();if(!Y)return;const J=await Zr(W);J&&Ko(Y,J,"replace",{logChat:!1,statusMessage:`已上传图片 ${J}`})},[Ko,Zr]),vu=m.useCallback((E,W="replace")=>{var Q;const Y=String(E||"").trim(),J=String(((Q=Tr[Y])==null?void 0:Q.candidateContent)||"").trim();!Y||!J||Ko(Y,J,W)},[Tr,Ko]),qo=m.useCallback(async(E,W=void 0)=>{var Ee,ct,Ze;if(!ge){ze("Readonly workspace");return}const Y=String(E||"").trim();if(!Y)return;const J=Tr[Y]||{},Q=String(W!==void 0?W:J.draft||"").trim();if(!Q||J.running)return;const ie=f.current.find(Xe=>Xe.id===Y);if(!ie)return;const ne={role:"user",text:Q,at:Date.now()},oe=Array.isArray(J.messages)?J.messages:[],ye=J.sessionId||`nodechat_${Date.now()}_${Y.replace(/[^a-z0-9_-]+/gi,"_")}`;Sr(Xe=>({...Xe,[Y]:{...J,sessionId:ye,messages:[...oe,ne],draft:"",running:!0,error:""}}));try{const Xe=await fetch("/api/workspace/node-chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,sessionId:ye,node:{id:Y,label:((Ee=ie.data)==null?void 0:Ee.label)||Y,definitionId:((ct=ie.data)==null?void 0:ct.definitionId)||""},nodeKind:as((Ze=ie.data)==null?void 0:Ze.definitionId)||"markdown",currentContent:Pd(ie.data),messages:oe,message:Q,model:Qe})}),Vt=await Xe.json().catch(()=>({}));if(!Xe.ok)throw new Error(Vt.error||"节点微调失败");const gn=String(Vt.candidateContent||Vt.reply||"").trim();Sr(yn=>{var Nr;return{...yn,[Y]:{...yn[Y]||{},sessionId:String(Vt.sessionId||ye),running:!1,candidateContent:gn,messages:[...(Nr=yn[Y])!=null&&Nr.messages&&Array.isArray(yn[Y].messages)?yn[Y].messages:[...oe,ne],{role:"assistant",text:gn||"已生成候选内容。",at:Date.now()}]}}})}catch(Xe){const Vt=String(Xe.message||Xe);Sr(gn=>({...gn,[Y]:{...gn[Y]||{},running:!1,error:Vt}})),ze(Vt)}},[Qe,s,Tr,ge]),Ul=m.useCallback(async(E,W)=>{if(!ge){ze("Readonly workspace");return}const Y=Pd(W);if(!String(Y||"").trim()){ze("展示节点没有可保存内容");return}const J=GK(E,W),Q=window.prompt("保存到 workspace 相对路径",J);if(Q)try{const ie=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,path:Q,content:Y})}),ne=await ie.json().catch(()=>({}));if(!ie.ok)throw new Error(ne.error||"保存文件失败");const oe=ne.path||Q,ye=hl(s);ye.set("path",oe);const Ee=await fetch(`/api/workspace/file?${ye.toString()}`);if(!Ee.ok){const ct=await Ee.json().catch(()=>({}));throw new Error(ct.error||`保存后读取失败:${oe}`)}await rr(),le(ct=>tq(ct,oe,String(Y||"").length)),mn(ct=>{const Ze=new Set(ct);for(const Xe of Vp(oe))Ze.delete(Xe);return Ze}),ze(`已保存 ${oe}`)}catch(ie){ze(String(ie.message||ie))}},[s,rr,ge]),ku=m.useCallback((E,W)=>{const Y=String(E||"");Y&&en(J=>{if(!J||J.id!==Y)return J;const Q=typeof W=="function"?W(J):W;return!Q||typeof Q!="object"?J:{...J,...Q}})},[]),Oi=m.useMemo(()=>i.map(E=>{var W,Y;return{...E,data:{...E.data,selected:E.selected===!0,modelLists:xe,showBodyPreview:!0,isExecuting:nr.has(E.id),nodeStatus:((W=zl[E.id])==null?void 0:W.status)??null,nodeElapsed:((Y=zl[E.id])==null?void 0:Y.elapsed)??null,flowParams:s,readOnly:!ge,onRunWorkspaceNode:Ka,onStopWorkspaceNode:Uo,runningRunNodeId:$n,skills:ke,skillCollections:Xr,onChangeLoadSkillKeys:Ya,onRefreshSkills:qa,mcpServers:Zn,onChangeLoadMcpNames:Ga,onRefreshMcps:Li,onSaveDisplayNodeToFile:Ul,onUploadWorkspaceImage:Zr,onUploadImageToDisplayNode:Vl,nodeChatActive:Ns===E.id,nodeChat:Tr[E.id]||null,onSetDisplayNodeContent:Ko,onToggleNodeChat:Wl,onCloseNodeChat:()=>ii(""),onUpdateNodeChatDraft:Xa,onSendNodeChat:qo,onApplyNodeChatCandidate:vu,onSyncNodePropDraft:ku}}}),[Ns,vu,Ga,Ya,s,Zn,xe,Tr,i,Li,qa,Ka,$n,Ul,qo,Ko,Xr,ke,Uo,ku,Wl,Xa,Vl,Zr,nr,zl,ge]);m.useEffect(()=>{const E=h.current,W=new Map,Y=[];for(const ne of Oi){const oe=TK(ne);W.set(ne.id,oe),E.get(ne.id)!==oe&&Y.push(ne.id)}if(h.current=W,Y.length===0)return;const J=()=>Y.forEach(ne=>r(ne)),Q=window.requestAnimationFrame(J),ie=window.setTimeout(J,80);return()=>{window.cancelAnimationFrame(Q),window.clearTimeout(ie)}},[Oi,r]);const Lt=m.useMemo(()=>i.find(E=>E.id===mt)||null,[i,mt]),Mi=m.useRef({id:"",draft:null}),Kl=m.useMemo(()=>{const E=Rj(Lt);return E?JSON.stringify(E):""},[Lt]);m.useEffect(()=>{if(!Lt){Mi.current={id:"",draft:null},en(null),pn("");return}const E=Rj(Lt),W=Mi.current;Mi.current={id:Lt.id,draft:E},en(Y=>!Y||Y.id!==Lt.id||W.id!==Lt.id||!W.draft?E:lq(Y,W.draft,E)),pn("")},[Lt==null?void 0:Lt.id,Kl]);const Ja=m.useCallback((E=!1)=>{var Nr,Le;if(!De||!Lt)return!1;if(!ge)return pn("Readonly workspace"),ze("Readonly workspace"),!1;const W=Lt.id,Y=String(De.newId||"").trim(),J=E?Y:W;if(pn(""),E){if(!VI.test(J))return pn("Invalid instance id"),!1;if(i.some(Dt=>Dt.id===J&&Dt.id!==W))return pn("Duplicate instance id"),!1}const Q=String(De.role||"").trim(),ie=La.includes(Q)?Q:"normal",ne=String(De.model||"").trim(),oe=Dt=>(Array.isArray(Dt)?Dt:[]).map(It=>({type:String((It==null?void 0:It.type)??"node").trim()||"node",name:String((It==null?void 0:It.name)??""),default:String((It==null?void 0:It.default)??""),required:!!(It!=null&&It.required),showOnNode:(It==null?void 0:It.showOnNode)!=null?It.showOnNode!==!1:!!(It!=null&&It.required)||String((It==null?void 0:It.type)??"node").trim().toLowerCase()==="node"})),ye=String(((Nr=Lt.data)==null?void 0:Nr.definitionId)??J),Ee=ye.startsWith("provide_"),ct={...Lt.data,label:String(De.label||"").trim()||J,role:ie,model:ne===""||ne==="default"?void 0:ne,body:Ee?"":String(De.body??""),images:Ee?[]:ds(De.images),inputs:oe(De.inputs),outputs:Ee&&Array.isArray((Le=Lt.data)==null?void 0:Le.outputs)?Lt.data.outputs:oe(De.outputs)},Ze=String(De.script??"").trim();ye==="tool_nodejs"||Ze!==""?ct.script=String(De.script??""):delete ct.script;const Xe=Lt.data||{};if(!(J!==W||Xe.label!==ct.label||Xe.role!==ct.role||Xe.model!==ct.model||Xe.body!==ct.body||JSON.stringify(ds(Xe.images))!==JSON.stringify(ct.images)||(Xe.script??void 0)!==(ct.script??void 0)||JSON.stringify(Xe.inputs||[])!==JSON.stringify(ct.inputs||[])||JSON.stringify(Xe.outputs||[])!==JSON.stringify(ct.outputs||[])))return!0;let gn=i.map(Dt=>Dt.id===W?{...Dt,id:J,selected:!0,data:ct}:Dt),yn=l;if(J!==W){const Dt={...C.current},It={...Dt[W]||{}};delete Dt[W],Dt[J]=It,C.current=Dt,N(Dt),yn=l.map((on,jr)=>({...on,source:on.source===W?J:on.source,target:on.target===W?J:on.target,id:`we-${on.source===W?J:on.source}-${on.target===W?J:on.target}-${jr}`})),Gt(J)}return a(gn),u(yn),mo(J),!0},[l,De,i,Lt,u,a,mo,ge]);m.useEffect(()=>{if(!ge||!De||!Lt)return;const E=window.setTimeout(()=>{Ja(!1)},350);return()=>window.clearTimeout(E)},[De==null?void 0:De.label,De==null?void 0:De.role,De==null?void 0:De.model,De==null?void 0:De.body,JSON.stringify((De==null?void 0:De.images)||[]),De==null?void 0:De.script,JSON.stringify((De==null?void 0:De.inputs)||[]),JSON.stringify((De==null?void 0:De.outputs)||[]),Ja,Lt==null?void 0:Lt.id,ge]);const es=m.useMemo(()=>{const E=new Map(Oi.map(W=>[W.id,W]));return l.map(W=>{var Ee,ct,Ze,Xe;const Y=E.get(W.source),J=E.get(W.target),Q=/^output-(\d+)$/.exec(W.sourceHandle||""),ie=/^input-(\d+)$/.exec(W.targetHandle||""),ne=Y&&Q?(ct=(Ee=Y.data)==null?void 0:Ee.outputs)==null?void 0:ct[parseInt(Q[1],10)]:null,oe=J&&ie?(Xe=(Ze=J.data)==null?void 0:Ze.inputs)==null?void 0:Xe[parseInt(ie[1],10)]:null,ye=ne!=null&&ne.type?Xn(ne.type):oe!=null&&oe.type?Xn(oe.type):"";return ye?{...W,style:{...W.style||{},stroke:ye,strokeWidth:2},markerEnd:{type:gs.ArrowClosed,color:ye}}:W})},[l,Oi]),yo=m.useMemo(()=>{const E=z.trim().toLowerCase(),W={DISPLAY:[],CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const Y of D)E&&![Y.id,Y.label,Y.displayName,Y.description].some(J=>String(J||"").toLowerCase().includes(E))||W[cd(Y)].push(Y);for(const Y of pc)W[Y].sort((J,Q)=>J.id.localeCompare(Q.id));return W},[D,z]),$i=m.useMemo(()=>{const E=st.trim().toLowerCase();return D.filter(W=>!E||[W.id,W.label,W.displayName,W.description].some(Y=>String(Y||"").toLowerCase().includes(E))).sort((W,Y)=>{const J=pc.indexOf(cd(W)),Q=pc.indexOf(cd(Y));return J!==Q?J-Q:ud(W).localeCompare(ud(Y))}).slice(0,30)},[D,st]),li=m.useMemo(()=>{const E=st.trim().toLowerCase();return T.filter(W=>!E||[W.id,W.version,W.displayName,W.name,W.description,...Array.isArray(W.tags)?W.tags:[]].some(Y=>String(Y||"").toLowerCase().includes(E))).sort((W,Y)=>String(W.displayName||W.name||W.id).localeCompare(String(Y.displayName||Y.name||Y.id))).slice(0,30)},[T,st]);m.useEffect(()=>{Be(0)},[st,be,_e]),m.useEffect(()=>{if(!be)return;const E=window.setTimeout(()=>{var W;return(W=Mn.current)==null?void 0:W.focus()},0);return()=>window.clearTimeout(E)},[be]);const Qa=m.useMemo(()=>{const E=Bt.trim().toLowerCase();return E?dT(Hn).filter(W=>W.path.toLowerCase().includes(E)):Hn},[Bt,Hn]),Za=[...(xe.cursor||[]).map(E=>({label:`Cursor · ${E.split(" - ")[0]}`,value:`cursor:${E.split(" - ")[0]}`})),...(xe.opencode||[]).map(E=>({label:`OpenCode · ${E.split(" - ")[0]}`,value:`opencode:${E.split(" - ")[0]}`})),...(xe.claudeCode||[]).map(E=>({label:`Claude · ${E.split(" - ")[0]}`,value:`claude-code:${E.split(" - ")[0]}`}))],Su=m.useMemo(()=>new Set(sn),[sn]),Di=m.useMemo(()=>{const E=new Map(ke.map(ie=>[ie.key,ie])),W=new Set,Y=new Set,J=Xr.map(ie=>{const ne=Ta(ie,ke).map(oe=>E.get(oe)).filter(Boolean);for(const oe of ne)W.add(oe.key),Y.add(String(oe.name||oe.id||oe.key||"").trim());return{...ie,skills:ne}}).filter(ie=>ie.skills.length>0),Q=ke.filter(ie=>{const ne=String(ie.name||ie.id||ie.key||"").trim();return!W.has(ie.key)&&!Y.has(ne)});return{groups:J,ungrouped:Q}},[Xr,ke]);m.useEffect(()=>{Qt(E=>{let W=!1;const Y=new Set(E);for(const J of Di.groups)Y.has(J.id)||(Y.add(J.id),W=!0);return W?Y:E})},[Di.groups]);const qn=m.useMemo(()=>{const E=i.filter(W=>W.selected);return E.length>0?E:mt?i.filter(W=>W.id===mt):[]},[i,mt]),Fi=m.useMemo(()=>qn.map(E=>E.id),[qn]),Nu=m.useMemo(()=>{const E=String((yt==null?void 0:yt.username)||(yt==null?void 0:yt.userId)||"").trim();return E?E.slice(0,1).toUpperCase():"?"},[yt]),ql=m.useMemo(()=>new Set(Fi),[Fi]),Yo=m.useMemo(()=>l.filter(E=>ql.has(E.source)&&ql.has(E.target)),[l,ql]),Yl=m.useMemo(()=>{const E=z.trim().toLowerCase();return E?T.filter(W=>[W.id,W.version,W.displayName,W.name,W.description,...Array.isArray(W.tags)?W.tags:[]].filter(Boolean).some(Y=>String(Y).toLowerCase().includes(E))):T},[T,z]),Go=m.useCallback((E,W)=>{const Y=String(E||"snippet_node").trim().replace(/[^a-zA-Z0-9_]+/g,"_").replace(/^_+|_+$/g,"")||"snippet_node";let J=`${Y}_${Date.now().toString(36)}`,Q=2;for(;W.has(J);)J=`${Y}_${Date.now().toString(36)}_${Q}`,Q+=1;return W.add(J),J},[]),el=m.useCallback((E,W)=>{var on,jr;if(!ge){ze("Readonly workspace");return}const Y=E!=null&&E.snippet&&typeof E.snippet=="object"?E.snippet:{},J=Y.instances&&typeof Y.instances=="object"?Y.instances:{},Q=Object.keys(J);if(Q.length===0)return;const ie=new Set(f.current.map(ft=>ft.id)),ne={};for(const ft of Q)ne[ft]=Go(ft,ie);const oe=(on=Y.ui)!=null&&on.nodePositions&&typeof Y.ui.nodePositions=="object"?Y.ui.nodePositions:{},ye=(jr=Y.ui)!=null&&jr.nodeSizes&&typeof Y.ui.nodeSizes=="object"?Y.ui.nodeSizes:{},Ee=Q.map(ft=>{const he=oe[ft];return{id:ft,x:typeof(he==null?void 0:he.x)=="number"?he.x:0,y:typeof(he==null?void 0:he.y)=="number"?he.y:0}}),ct=Math.min(...Ee.map(ft=>ft.x)),Ze=Math.min(...Ee.map(ft=>ft.y));let Xe=W||{x:360+f.current.length*24,y:180+f.current.length*18};if(!W){const ft=document.querySelector(".af-workspace-canvas .react-flow");if(ft){const he=ft.getBoundingClientRect();Xe=n.screenToFlowPosition({x:he.left+he.width*.48,y:he.top+he.height*.32})}}const Vt={},gn={},yn={};for(const ft of Ee){const he=ne[ft.id];Vt[he]={...J[ft.id]||{}},gn[he]={x:Xe.x+(ft.x-ct),y:Xe.y+(ft.y-Ze)};const tt=ye[ft.id];typeof(tt==null?void 0:tt.width)=="number"&&typeof(tt==null?void 0:tt.height)=="number"&&(yn[he]={width:tt.width,height:tt.height})}const Nr=new Set(Q),Le=(Array.isArray(Y.edges)?Y.edges:[]).filter(ft=>Nr.has(ft==null?void 0:ft.source)&&Nr.has(ft==null?void 0:ft.target)).map(ft=>({source:ne[ft.source],target:ne[ft.target],sourceHandle:ft.sourceHandle??null,targetHandle:ft.targetHandle??null})),Dt=Uy({instances:Vt,edges:Le,ui:{nodePositions:gn,nodeSizes:yn}},D),It=Dt.nodes.map(ft=>({...ft,selected:!0}));C.current={...C.current,...Dt.instances},N(C.current),a(ft=>[...ft.map(he=>({...he,selected:!1})),...It]),u(ft=>[...ft.map(he=>({...he,selected:!1})),...Dt.edges]),ze(`已添加流程片段:${E.displayName||E.id}`)},[Go,D,n,u,a,ge]),hg=m.useCallback(()=>{var Y,J;if(qn.length<2){L("请先在 workspace 画布上选择至少两个节点。"),F("flows");return}const E=qn[0],W=qn.length===2?`${((Y=E.data)==null?void 0:Y.label)||E.id} 片段`:`${((J=E.data)==null?void 0:J.label)||E.id} 等 ${qn.length} 个节点`;U({name:W,id:W.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),description:""}),me(""),G(!0),F("flows")},[qn]),St=m.useCallback(async()=>{var Q,ie;if(qn.length<2)return;const E=Z.name.trim();if(!E){me("请填写片段名称。");return}const W={},Y={};for(const ne of qn){W[ne.id]={x:((Q=ne.position)==null?void 0:Q.x)||0,y:((ie=ne.position)==null?void 0:ie.y)||0};const oe=iT(ne);oe&&(Y[ne.id]=oe)}const J=Yo.map(ne=>({source:ne.source,target:ne.target,sourceHandle:ne.sourceHandle??null,targetHandle:ne.targetHandle??null}));ue(!0),me("");try{const ne=await fetch("/api/marketplace/publish-flow-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:Z.id,name:E,displayName:E,version:"1.0.0",description:Z.description,snippet:{instances:Rf(qn,C.current),edges:J,ui:{nodePositions:W,nodeSizes:Y}}})}),oe=await ne.json().catch(()=>({}));if(!ne.ok||oe.ok===!1)throw new Error(oe.error||"发布流程片段失败");G(!1),ze(`流程片段已发布:${oe.id||E}`),Ai(`流程片段已发布:${oe.id||E}`),await Wt(),F("flows")}catch(ne){me(String(ne.message||ne))}finally{ue(!1)}},[Wt,Z,Yo,qn,Ai]),ju=m.useCallback(E=>{a(W=>W.map(Y=>Y.id===E?{...Y,selected:!1}:Y)),Gt(W=>W===E?"":W)},[a]),Xo=m.useCallback(()=>{const E=Fs.current;if(!E)return;const W=E.getBoundingClientRect(),Y=Math.min(420,Math.max(320,W.width+160)),J=12,Q=Math.max(180,W.top-J*2),ie=Math.min(560,Q);at({position:"fixed",left:Math.max(12,Math.min(window.innerWidth-Y-12,W.left)),top:Math.max(J,W.top-ie-J),width:Y,maxHeight:ie,zIndex:1e4})},[]);m.useEffect(()=>{if(!er)return;Xo();const E=Y=>{var Q,ie;const J=Y.target;(Q=Fs.current)!=null&&Q.contains(J)||(ie=Un.current)!=null&&ie.contains(J)||gt(!1)},W=Y=>{Y.key==="Escape"&>(!1)};return window.addEventListener("pointerdown",E),window.addEventListener("keydown",W),window.addEventListener("resize",Xo),window.addEventListener("scroll",Xo,!0),()=>{window.removeEventListener("pointerdown",E),window.removeEventListener("keydown",W),window.removeEventListener("resize",Xo),window.removeEventListener("scroll",Xo,!0)}},[er,Xo]);const Gl=m.useCallback(E=>{var J,Q,ie;if(!ge){const ne=(E||[]).filter(oe=>(oe==null?void 0:oe.type)==="select");ne.length>0&&a(oe=>Zh(ne,oe));return}const W=new Map;for(const ne of E||[])if((ne==null?void 0:ne.type)==="dimensions"&&((J=ne.dimensions)!=null&&J.width)&&((Q=ne.dimensions)!=null&&Q.height)){const oe=i.find(ct=>ct.id===ne.id),ye=!!as((ie=oe==null?void 0:oe.data)==null?void 0:ie.definitionId),Ee=ag({width:Math.round(Number(ne.dimensions.width)),height:Math.round(Number(ne.dimensions.height))},{display:ye});Ee&&W.set(ne.id,Ee)}const Y=Array.from(W.keys());if(a(ne=>Zh(E,ne).map(oe=>{var Ee;const ye=W.get(oe.id);return ye?as((Ee=oe.data)==null?void 0:Ee.definitionId)?{...oe,width:ye.width,height:ye.height,data:{...oe.data,nodeSize:ye,displaySize:ye}}:{...oe,width:ye.width,height:ye.height,data:{...oe.data,nodeSize:ye}}:oe})),Y.length>0){const ne=()=>Y.forEach(oe=>r(oe));window.requestAnimationFrame(ne),window.setTimeout(ne,80)}},[i,a,r,ge]),wt=m.useCallback(E=>{if(!ge){const W=(E||[]).filter(Y=>(Y==null?void 0:Y.type)==="select");W.length>0&&u(Y=>av(W,Y));return}d(E)},[d,u,ge]),Jo=m.useCallback(()=>{const E=document.querySelector(".af-workspace-canvas .react-flow");if(E){const W=E.getBoundingClientRect();return n.screenToFlowPosition({x:W.left+W.width*.48,y:W.top+W.height*.32})}return{x:360+i.length*36,y:180+i.length*28}},[i.length,n]),Hs=m.useCallback(()=>{var E,W,Y;if(Lt){const J=Number(((E=Lt.measured)==null?void 0:E.width)||Lt.width||260);return{x:Number(((W=Lt.position)==null?void 0:W.x)||0)+J+140,y:Number(((Y=Lt.position)==null?void 0:Y.y)||0)}}return Jo()},[Jo,Lt]),Ws=m.useCallback((E,W={})=>{if(!ge)return ze("Readonly workspace"),null;if(!E)return null;const Y=Lv(E)||E.id,J=rT(E),Q=W.id||AK(Y,i),ie=Hp(E.inputs),ne=Hp(E.outputs),oe={definitionId:Y,...J?{marketplaceRef:J}:{},...E.packageId?{marketplacePackageId:E.packageId}:{},...E.version?{marketplaceVersion:E.version}:{},label:W.label||mm(E),role:"normal",body:W.body||"",input:W.inputs||ie,output:W.outputs||ne},ye={id:Q,type:Lf,position:W.position||Jo(),data:{label:oe.label,definitionId:Y,...J?{marketplaceRef:J}:{},...E.packageId?{marketplacePackageId:E.packageId}:{},...E.version?{marketplaceVersion:E.version}:{},schemaType:nT(Y,E),role:"normal",body:oe.body,inputs:oe.input,outputs:oe.output}},Ee={...ff(ye,{...C.current,[Q]:oe},D),selected:!0};return a(ct=>[...ct.map(Ze=>({...Ze,selected:!1})),Ee]),W.openProperties&&Gt(Q),Q},[Jo,i,D,a,ge]),Cu=m.useCallback(E=>Aj(E,f.current),[]),qv=m.useCallback(E=>{if(!ge){ze("Readonly workspace");return}if(!Aj(E,f.current)){ze("端口类型不匹配,已取消连线");return}b(null),a(W=>dm(W,E)),u(W=>{const Y=W.filter(J=>!(J.target===E.target&&J.targetHandle===E.targetHandle));return rf({...E,markerEnd:{type:gs.ArrowClosed}},Y)})},[u,a,ge]),ci=m.useCallback((E,W)=>{ge&&(v.current=_K(W,f.current),b(null))},[ge]),mg=m.useCallback((E,W)=>{var Xe,Vt,gn,yn;if(!ge)return;const Y=v.current;if(v.current=null,!Y||W!=null&&W.toNode)return;const J=PK(D,Y);if(J.length===0){ze(`没有匹配 ${Y.slotType} 端口的节点`);return}const Q=((Vt=(Xe=E==null?void 0:E.changedTouches)==null?void 0:Xe[0])==null?void 0:Vt.clientX)??(E==null?void 0:E.clientX),ie=((yn=(gn=E==null?void 0:E.changedTouches)==null?void 0:gn[0])==null?void 0:yn.clientY)??(E==null?void 0:E.clientY);if(!Number.isFinite(Q)||!Number.isFinite(ie))return;const ne=document.querySelector(".af-workspace-canvas .react-flow");if(!ne)return;const oe=ne.getBoundingClientRect(),ye=320,Ee=Math.min(440,104+J.length*58),ct=Math.max(12,Math.min(Q-oe.left,oe.width-ye-12)),Ze=Math.max(12,Math.min(ie-oe.top,oe.height-Ee-12));b({left:ct,top:Ze,flowPosition:n.screenToFlowPosition({x:Q,y:ie}),draft:Y,candidates:J,query:""})},[D,n,ge]),xo=m.useCallback(E=>{if(!ge){ze("Readonly workspace"),b(null);return}const W=k.current;if(!W||!(E!=null&&E.def))return;const Y=Ws(E.def,{position:W.flowPosition});if(!Y)return;const J=W.draft.handleType==="source"?{source:W.draft.nodeId,sourceHandle:W.draft.handleId,target:Y,targetHandle:`input-${E.slotIndex}`}:{source:Y,sourceHandle:`output-${E.slotIndex}`,target:W.draft.nodeId,targetHandle:W.draft.handleId};a(Q=>dm(Q,J)),u(Q=>{const ie=Q.filter(ne=>!(ne.target===J.target&&ne.targetHandle===J.targetHandle));return rf({...J,markerEnd:{type:gs.ArrowClosed}},ie)}),b(null)},[Ws,u,ge]),Qo=m.useCallback(E=>{E&&(Ws(E,{position:Hs()}),Ie(!1),Je(""))},[Ws,Hs]),Eu=m.useCallback(E=>{E&&(el(E,Hs()),Ie(!1),Je(""))},[el,Hs]);m.useEffect(()=>{const E=W=>{if(W.defaultPrevented)return;const Y=FI(W.target)||CK(W.target);if((W.metaKey||W.ctrlKey)&&W.key.toLowerCase()==="s"){W.preventDefault(),ur().catch(ne=>ze(String(ne.message||ne)));return}if(Te){(W.key==="Escape"||pm(W))&&(W.preventDefault(),Ae(!1));return}if(Y)return;const J=W.key.toLowerCase(),Q=(W.metaKey||W.ctrlKey)&&!W.shiftKey&&J==="z",ie=(W.metaKey||W.ctrlKey)&&(W.shiftKey&&J==="z"||J==="y");if(Q||ie){if(!ge){W.preventDefault(),ze("Readonly workspace");return}W.preventDefault(),W.stopPropagation();const ne=Q?Va():Hl();ze(ne?Q?"Undo canvas change":"Redo canvas change":Q?"Nothing to undo":"Nothing to redo");return}if((W.metaKey||W.ctrlKey)&&W.key.toLowerCase()==="c"){const ne=AI(f.current,c.current,C.current);ne&&(W.preventDefault(),W.stopPropagation(),g.current=ne,ze(`Copied ${ne.nodes.length} node${ne.nodes.length>1?"s":""}`));return}if((W.metaKey||W.ctrlKey)&&W.key.toLowerCase()==="v"){if(!ge){W.preventDefault(),ze("Readonly workspace");return}const ne=II(g.current,f.current,c.current,C.current);ne&&(W.preventDefault(),W.stopPropagation(),C.current=ne.instances,N(ne.instances),a(ne.nodes),u(ne.edges),ze(`Pasted ${ne.pastedNodeIds.length} node${ne.pastedNodeIds.length>1?"s":""}`));return}if(pm(W)&&!W.metaKey&&!W.ctrlKey&&!W.altKey){W.preventDefault(),Ae(!0);return}if(W.key==="a"||W.key==="A"){if(W.metaKey||W.ctrlKey){W.preventDefault(),a(ne=>ne.map(oe=>({...oe,selected:!0}))),u(ne=>ne.map(oe=>({...oe,selected:!1})));return}if(W.altKey)return;if(!ge){W.preventDefault(),ze("Readonly workspace");return}W.preventDefault(),Ie(!0);return}if((W.key==="v"||W.key==="V")&&!W.metaKey&&!W.ctrlKey&&!W.altKey){W.preventDefault(),$t("select");return}(W.key==="h"||W.key==="H")&&!W.metaKey&&!W.ctrlKey&&!W.altKey&&(W.preventDefault(),$t("pan"))};return window.addEventListener("keydown",E,!0),()=>window.removeEventListener("keydown",E,!0)},[Hl,ur,Te,u,a,Va,ge]);const gg=m.useCallback(E=>{mn(W=>{const Y=new Set(W);return Y.has(E)?Y.delete(E):Y.add(E),Y})},[]),Xl=m.useCallback((E,W)=>{E.dataTransfer.effectAllowed="copy",E.dataTransfer.setData("application/x-agentflow-workspace-file",JSON.stringify({path:W.path,name:W.name,type:W.type})),E.dataTransfer.setData("text/plain",W.path)},[]),yg=m.useCallback((E,W)=>{E.dataTransfer.effectAllowed="move",E.dataTransfer.setData("application/agentflow-node",W.id),E.dataTransfer.setData("text/plain",W.id)},[]),tl=m.useCallback(async(E,W)=>{const Y=String((E==null?void 0:E.name)||(E==null?void 0:E.path)||"").toLowerCase(),J=Y.split(".").pop(),Q=J==="html"?"display_html":J==="csv"||J==="tsv"||J==="json"&&/\b(table|data|rows|report)\b/i.test(Y)?"display_table":["png","jpg","jpeg","gif","webp","svg"].includes(J)?"display_image":"display_markdown",ie=D.find(Ze=>Ze.id===Q);if(!ie){ze("展示节点不可用");return}const ne=Q==="display_image";let oe=String(E.path||"");if(!ne){const Ze=hl(s);Ze.set("path",E.path);const Xe=await fetch(`/api/workspace/file?${Ze.toString()}`),Vt=await Xe.json();if(!Xe.ok)throw new Error(Vt.error||"读取文件失败");oe=String(Vt.content||"")}const ye=Q==="display_image"?"src":"content",Ee=Hp(ie.inputs).map(Ze=>Ze.name===ye?{...Ze,default:oe,value:oe}:Ze),ct=Hp(ie.outputs).map(Ze=>Ze.name===ye?{...Ze,default:oe,value:oe}:Ze);Ws(ie,{label:E.name||"Display",body:oe,inputs:Ee,outputs:ct,position:W}),ze(`已创建展示:${E.path}`)},[Ws,s,D]),xg=m.useCallback(E=>{if(!ge){ze("Readonly workspace");return}tl(E,Jo()).catch(W=>ze(String(W.message||W)))},[tl,Jo,ge]),wg=m.useCallback(E=>{if(!ge){E.preventDefault(),ze("Readonly workspace");return}const W=E.dataTransfer.getData("application/x-agentflow-workspace-file");if(W){E.preventDefault();let ne;try{ne=JSON.parse(W)}catch{return}if(!(ne!=null&&ne.path))return;const oe=n.screenToFlowPosition({x:E.clientX,y:E.clientY});tl(ne,oe).catch(ye=>ze(String(ye.message||ye)));return}const Y=E.dataTransfer.getData("application/agentflow-snippet");if(Y){const ne=T.find(ye=>`${ye.id}@${ye.version}`===Y);if(!ne)return;E.preventDefault();const oe=n.screenToFlowPosition({x:E.clientX,y:E.clientY});el(ne,oe);return}const J=E.dataTransfer.getData("application/agentflow-node");if(!J)return;const Q=D.find(ne=>ne.id===J);if(!Q)return;E.preventDefault();const ie=n.screenToFlowPosition({x:E.clientX,y:E.clientY});Ws(Q,{position:ie})},[tl,Ws,T,el,D,n,ge]),bg=m.useCallback(E=>{if(!ge)return;const W=Array.from(E.dataTransfer.types||[]);!W.includes("application/x-agentflow-workspace-file")&&!W.includes("application/agentflow-node")&&!W.includes("application/agentflow-snippet")||(E.preventDefault(),E.dataTransfer.dropEffect=W.includes("application/agentflow-node")||W.includes("application/agentflow-snippet")?"move":"copy")},[ge]),nl=m.useCallback(async(E="")=>{if(!ge){ze("Readonly workspace");return}const W=window.prompt("新文件名",E?`${E}/notes.md`:"notes.md");if(!W)return;const Y=E&&!W.includes("/")?`${E}/${W}`:W;try{const J=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,path:Y,content:""})}),Q=await J.json();if(!J.ok)throw new Error(Q.error||"创建文件失败");await rr(),mn(ie=>{const ne=new Set(ie);for(const oe of Vp(Q.path||Y))ne.delete(oe);return ne}),ze(`已创建 ${Q.path}`)}catch(J){ze(String(J.message||J))}},[s,rr,ge]),Jl=m.useCallback(async(E="")=>{if(!ge){ze("Readonly workspace");return}const W=window.prompt("新文件夹名",E?`${E}/docs`:"docs");if(!W)return;const Y=E&&!W.includes("/")?`${E}/${W}`:W;try{const J=await fetch("/api/workspace/folder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,path:Y})}),Q=await J.json();if(!J.ok)throw new Error(Q.error||"创建文件夹失败");await rr(),mn(ie=>{const ne=new Set(ie);for(const oe of Vp(Q.path||Y))ne.delete(oe);return Q.path&&ne.delete(Q.path),ne}),ze(`已创建 ${Q.path}`)}catch(J){ze(String(J.message||J))}},[s,rr,ge]),_u=m.useCallback(async E=>{if(!ge){ze("Readonly workspace");return}if(!(!(E!=null&&E.path)||!window.confirm(`删除 ${E.path}?`)))try{const W=await fetch("/api/workspace/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,path:E.path})}),Y=await W.json();if(!W.ok)throw new Error(Y.error||"删除失败");ze(`已删除 ${Y.path}`),await rr()}catch(W){ze(String(W.message||W))}},[s,rr,ge]),Pu=m.useCallback(async()=>{if(!ge){ze("Readonly workspace");return}const E=Kt.trim();if(!E||jn)return;const W=Wp(i,l,C.current);Ht(""),Ye(!0),Ua("workspace"),Br(Y=>[...Y,{role:"user",text:E,at:Date.now()}]);try{await ur(i,l);const Y=await fetch("/api/workspace/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,prompt:E,outputKind:"markdown",workspaceGraph:W,allowFlowYaml:!1,model:Qe,selectedSkills:sn,selectedNodeIds:Fi})}),J=await Y.json();if(!Y.ok)throw new Error(J.error||"生成失败");const Q=String(J.content||"").trim();Br(ie=>[...ie,{role:"assistant",text:Q,at:Date.now()}]),await Bs(),ze("AI 生成完成")}catch(Y){const J=String(Y.message||Y);Br(Q=>[...Q,{role:"assistant",text:J,error:!0,at:Date.now()}]),ze(J)}finally{Ye(!1)}},[Qe,jn,Kt,l,s,Bs,i,Ua,ur,Fi,sn,ge]),Rr=go.find(E=>E.id===Ii)||null,vg=Rr?Array.isArray(Rr.messages)?Rr.messages:[]:tr,rl=Rr?Rr.status==="running":jn,zf=Rr?Rr.status==="running"?`${Rr.label} running`:Rr.status==="paused"?`${Rr.label} paused`:Rr.status==="failed"?`${Rr.label} failed`:`${Rr.label} done`:jn?"Workspace agent running":tr.length>0?"Workspace conversation":"Ready";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:()=>t("/projects"),"aria-label":"返回",children:o.jsx("span",{className:"material-symbols-outlined",children:"arrow_back"})}),o.jsxs("div",{className:"af-pipeline-brand",title:s.flowId?`${s.flowId} · ${ve}`:ve||"PROJECT",children:[o.jsx("span",{className:"af-pipeline-brand-name",children:"WORKSPACE"}),o.jsxs("span",{className:"af-pipeline-brand-ver",children:["V",kK,"-STABLE"]})]}),o.jsxs("div",{className:"af-view-switch","aria-label":"视图切换",children:[o.jsx("button",{type:"button",onClick:()=>{t(Vb({id:s.flowId,source:s.flowSource||"user",archived:!!s.archived},"pipeline"))},children:"Pipeline"}),o.jsx("button",{type:"button",className:"af-view-switch__active",children:"Workspace"})]})]}),o.jsxs("div",{className:"af-pipeline-top-right af-workspace-actions",children:[o.jsx("span",{className:"af-workspace-save-status",children:oi}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>Ae(!0),"aria-label":"快捷键",title:"快捷键 (?)",children:o.jsx("span",{className:"material-symbols-outlined",children:"help"})}),o.jsx("button",{type:"button",className:"af-composer-topbar-btn"+(ri?" af-composer-topbar-btn--active":"")+(jn?" af-composer-topbar-btn--running":""),onClick:()=>zs(E=>!E),children:"AI"}),o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!ge,onClick:()=>ur().catch(E=>ze(String(E.message||E))),children:"Save"})]})]}),ae?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:ae}),o.jsx("button",{type:"button",onClick:()=>Ne(""),"aria-label":"关闭发布提示",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}):null,o.jsxs("div",{className:"af-workspace-body"+(ri||De?" af-workspace-body--drawer":"")+(V?" af-workspace-body--sidebar-collapsed":""),children:[V?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:()=>Ie(!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:()=>fe(!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:()=>fe(!1),"aria-label":"展开侧边栏",title:(yt==null?void 0:yt.username)||(yt==null?void 0:yt.userId)||"展开侧边栏",children:Nu})]})}):null,o.jsxs("aside",{ref:cr,className:"af-workspace-sidebar"+(Tn?" af-workspace-sidebar--resizing":""),"aria-hidden":V,style:{"--af-work-files-pane-height":`${Math.round(Xt)}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:()=>fe(!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:!ge,onClick:()=>nl(""),"aria-label":"新增文件",title:"新增文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"note_add"})}),o.jsx("button",{type:"button",className:"af-icon-btn",disabled:!ge,onClick:()=>Jl(""),"aria-label":"新增文件夹",title:"新增文件夹",children:o.jsx("span",{className:"material-symbols-outlined",children:"create_new_folder"})}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>void rr(),"aria-label":"刷新文件",title:"刷新文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"refresh"})})]})]}),o.jsx("input",{className:"af-workspace-search",value:Bt,onChange:E=>hn(E.target.value),placeholder:"搜索文件..."}),o.jsx("div",{className:"af-workspace-files-scroll",children:o.jsx(pT,{items:Qa,flowParams:s,onOpen:xg,collapsedDirs:In,onToggleDir:gg,onCreateFile:nl,onCreateFolder:Jl,onDelete:_u,onFileDragStart:Xl})})]}),o.jsx("button",{type:"button",className:"af-workspace-sidebar-resizer",onPointerDown:Vn,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:A==="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:z,onChange:E=>$(E.target.value),placeholder:A==="flows"?"搜索流程片段...":"搜索节点...","aria-label":A==="flows"?"搜索流程片段":"搜索节点"})]}),o.jsxs("div",{className:"af-palette-tabs",role:"tablist","aria-label":"Palette 类型",children:[o.jsxs("button",{type:"button",role:"tab","aria-selected":A==="nodes",className:"af-palette-tab"+(A==="nodes"?" af-palette-tab--active":""),onClick:()=>F("nodes"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"category"}),"节点"]}),o.jsxs("button",{type:"button",role:"tab","aria-selected":A==="flows",className:"af-palette-tab"+(A==="flows"?" af-palette-tab--active":""),onClick:()=>F("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:A==="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:hg,disabled:qn.length<2,title:qn.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:["已选 ",qn.length," 节点 / ",Yo.length," 连线"]})]})}),P?o.jsx("p",{className:"af-err af-palette-list-err",children:P}):null,I?o.jsx("p",{className:"af-palette-empty",children:"正在加载流程片段..."}):Yl.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:Yl.map(E=>{const W=`${E.id}@${E.version}`,Y=E.displayName||E.name||E.id,J=E.description||`${E.nodeCount||0} 个节点,${E.edgeCount||0} 条连线`;return o.jsxs("button",{type:"button",className:"af-palette-card af-flow-snippet-card",draggable:!0,onDragStart:Q=>{Q.dataTransfer.effectAllowed="move",Q.dataTransfer.setData("application/agentflow-snippet",W),Q.dataTransfer.setData("text/plain",W)},onClick:()=>el(E),title:J,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:Y}),o.jsxs("span",{className:"af-palette-card-id",children:[E.id,"@",E.version]})]})]}),J?o.jsx("span",{className:"af-palette-card-desc",children:J}):null,o.jsxs("span",{className:"af-flow-snippet-meta","aria-hidden":!0,children:[o.jsxs("span",{children:[E.nodeCount||0," nodes"]}),o.jsxs("span",{children:[E.edgeCount||0," edges"]})]})]},W)})})]}):o.jsx("p",{className:"af-palette-empty",children:z.trim()?"没有匹配的流程片段":"暂无流程片段。选择多个节点后发布。"})]}):o.jsxs(o.Fragment,{children:[pc.map(E=>{var W;return(W=yo[E])!=null&&W.length?o.jsxs("section",{className:`af-palette-section af-flow-palette-section--${E}`,children:[o.jsx("h3",{className:"af-palette-cat",children:E}),o.jsx("div",{className:"af-palette-cards",children:yo[E].map(Y=>{const J=Pj(Y.inputs,"input"),Q=Pj(Y.outputs,"output"),ie=Bw(Y),ne=ud(Y);return o.jsxs("button",{type:"button",className:"af-palette-card",draggable:!0,onDragStart:oe=>yg(oe,Y),onClick:()=>Ws(Y),title:ie||Y.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:Ej(E)})}),o.jsxs("span",{className:"af-palette-card-main",children:[o.jsx("span",{className:"af-palette-card-label",children:ne}),ne!==Y.id?o.jsx("span",{className:"af-palette-card-id",children:Y.id}):null]})]}),ie?o.jsx("span",{className:"af-palette-card-desc",children:ie}):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:[J.list.length," IN"]}),o.jsxs("span",{className:"af-palette-card-port-list",children:[J.shown.map((oe,ye)=>o.jsxs("span",{className:"af-palette-card-port",title:_j("input",oe,ye),children:[o.jsx("span",{className:"af-palette-card-port-dot",style:{background:Xn(oe==null?void 0:oe.type)}}),o.jsx("span",{className:"af-palette-card-port-name",children:Vy(oe,ye)})]},`in-${ye}`)),J.hidden>0?o.jsxs("span",{className:"af-palette-card-port-more",children:["+",J.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:[Q.list.length," OUT"]}),o.jsxs("span",{className:"af-palette-card-port-list",children:[Q.shown.map((oe,ye)=>o.jsxs("span",{className:"af-palette-card-port",title:_j("output",oe,ye),children:[o.jsx("span",{className:"af-palette-card-port-name",children:Vy(oe,ye)}),o.jsx("span",{className:"af-palette-card-port-dot",style:{background:Xn(oe==null?void 0:oe.type)}})]},`out-${ye}`)),Q.hidden>0?o.jsxs("span",{className:"af-palette-card-port-more",children:["+",Q.hidden]}):null]})]})]})]},Y.id)})})]},E):null}),D.length>0&&z.trim()&&pc.every(E=>{var W;return!((W=yo[E])!=null&&W.length)})?o.jsx("p",{className:"af-palette-empty",children:"没有匹配的节点"}):null]})})]})]}),o.jsxs("main",{className:"af-workspace-canvas",children:[o.jsx(QP,{className:"af-flow-canvas af-workspace-flow"+(Ge==="pan"?" af-flow-canvas--tool-pan":" af-flow-canvas--tool-select"),nodes:Oi,edges:es,nodeTypes:ZK,onNodesChange:Gl,onEdgesChange:wt,onConnect:qv,onConnectStart:ci,onConnectEnd:mg,isValidConnection:Cu,onNodeClick:(E,W)=>{mt&&Gt(W.id)},onNodeDoubleClick:(E,W)=>{E.preventDefault(),zs(!1),a(Y=>Y.map(J=>({...J,selected:J.id===W.id}))),u(Y=>Y.map(J=>({...J,selected:!1}))),Gt(W.id)},onPaneClick:()=>Gt(""),onDrop:wg,onDragOver:bg,nodesDraggable:ge,nodesConnectable:ge,edgesReconnectable:ge,deleteKeyCode:ge?["Backspace","Delete"]:null,selectionOnDrag:Ge==="select",panOnDrag:Ge==="pan"?!0:[1,2],panActivationKeyCode:"Space",proOptions:{hideAttribution:!0},fitView:!1,minZoom:.1,maxZoom:4,children:o.jsx(nA,{color:"rgba(255,255,255,0.12)",gap:22,size:1})}),y?(()=>{var J;const E=String(y.query||"").trim().toLowerCase(),W=E?y.candidates.filter(Q=>{var ie,ne,oe;return[(ie=Q.def)==null?void 0:ie.id,Q.displayLabel,Q.description,(ne=Q.slot)==null?void 0:ne.name,(oe=Q.slot)==null?void 0:oe.type].filter(Boolean).some(ye=>String(ye).toLowerCase().includes(E))}):y.candidates,Y=y.draft.handleType==="source"?"IN":"OUT";return o.jsxs("div",{className:"af-connect-node-menu",style:{left:y.left,top:y.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:Xn((J=y.draft.slot)==null?void 0:J.type)},"aria-hidden":!0}),o.jsxs("span",{children:["匹配 ",y.draft.slotType," 节点"]})]}),o.jsx("button",{type:"button",className:"af-connect-node-menu__close","aria-label":"关闭",onClick:()=>b(null),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),o.jsxs("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:y.query,onChange:Q=>b(ie=>ie&&{...ie,query:Q.target.value}),placeholder:"搜索节点",autoFocus:!0})]}),o.jsxs("div",{className:"af-connect-node-menu__list",children:[W.map(Q=>{var oe,ye;const ie=Q.displayLabel||((oe=Q.def)==null?void 0:oe.id),ne=Vy(Q.slot,Q.slotIndex);return o.jsxs("button",{type:"button",className:"af-connect-node-menu__item",onClick:()=>xo(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:ie}),ie!==Q.def.id?o.jsx("span",{className:"af-connect-node-menu__item-id",children:Q.def.id}):null]}),o.jsxs("span",{className:"af-connect-node-menu__port",children:[o.jsx("span",{children:Y}),o.jsx("span",{className:"af-connect-node-menu__port-dot",style:{background:Xn((ye=Q.slot)==null?void 0:ye.type)},"aria-hidden":!0}),o.jsx("span",{className:"af-connect-node-menu__port-name",children:ne})]})]},`${Q.def.id}-${Q.slotIndex}`)}),W.length===0?o.jsx("div",{className:"af-connect-node-menu__empty",children:"没有匹配结果"}):null]})]})})():null,si?o.jsx("button",{type:"button",className:"af-workspace-composer-fab",onClick:()=>tn(!1),"aria-label":"展开 AI 输入框",title:"展开 AI 输入框",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"auto_awesome"})}):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:()=>tn(!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:qn.length===0?o.jsx("span",{className:"af-composer-selected-empty",children:"选择画布节点后,可作为本次 Workspace AI 的上下文。"}):qn.map(E=>{var Q,ie;const W=String(((Q=E.data)==null?void 0:Q.label)??E.id),Y=(ie=E.data)!=null&&ie.definitionId?String(E.data.definitionId):"",J=Y&&Y!==W?`${W} · ${E.id} · ${Y}`:`${W} · ${E.id}`;return o.jsxs("div",{className:"af-composer-node-chip",title:J,children:[o.jsx("span",{className:"af-composer-node-chip-kind",children:Y||"node"}),o.jsx("span",{className:"af-composer-node-chip-label",children:W}),o.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>ju(E.id),"aria-label":`取消选择 ${E.id}`,children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},E.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:Kt,rows:2,onChange:E=>Ht(E.target.value),onKeyDown:E=>{(E.metaKey||E.ctrlKey)&&E.key==="Enter"&&(E.preventDefault(),Pu())},placeholder:"描述你想在 workspace 中生成、分析或展示的内容",autoComplete:"off",spellCheck:!1,disabled:!ge})}),o.jsxs("div",{className:"af-composer-toolbar",children:[o.jsxs("div",{className:"af-composer-skills-field",children:[o.jsxs("button",{ref:Fs,type:"button",className:"af-composer-skills-button"+(sn.length>0?" af-composer-skills-button--active":""),disabled:jn||!ge,"aria-haspopup":"listbox","aria-expanded":er,onClick:()=>gt(E=>!E),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"extension"}),o.jsx("span",{children:sn.length>0?`Skills ${sn.length}`:"Skills"})]}),er&&!jn?os.createPortal(o.jsx("div",{ref:Un,className:"af-composer-skills-menu",role:"listbox","aria-label":"Skills",style:ks,children:ke.length===0?o.jsx("div",{className:"af-composer-skills-empty",children:"No skills found"}):o.jsxs(o.Fragment,{children:[Di.groups.map(E=>{const W=Ta(E,ke),Y=i_(E,Su,ke),J=Re.has(E.id);return o.jsxs("div",{className:"af-composer-skill-group af-composer-skill-group--framed"+(J?" 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:Y==="all",disabled:W.length===0,onChange:Q=>{const ie=Q.target.checked;Gr(ne=>ie?r_(ne,W):s_(ne,W))}}),o.jsxs("span",{className:"af-composer-skill-group-title-main",children:[o.jsx("span",{children:E.name}),E.builtin?o.jsx("em",{children:"built-in"}):null,Y==="partial"?o.jsx("em",{children:"partial"}):null]})]}),o.jsxs("button",{type:"button",className:"af-composer-skill-group-toggle","aria-label":J?`展开 ${E.name}`:`收起 ${E.name}`,onClick:()=>{Qt(Q=>{const ie=new Set(Q);return ie.has(E.id)?ie.delete(E.id):ie.add(E.id),ie})},children:[o.jsx("span",{children:E.skills.length}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:J?"expand_more":"expand_less"})]})]}),J?null:o.jsx("div",{className:"af-composer-skill-group-items",children:E.skills.map(Q=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:Su.has(Q.key),onChange:ie=>{const ne=ie.target.checked;Gr(oe=>ne?oe.includes(Q.key)?oe:[...oe,Q.key]:oe.filter(ye=>ye!==Q.key))}}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:Q.name}),Q.description?o.jsx("span",{className:"af-composer-skill-option-desc",children:Q.description}):null]})]},`${E.id}:${Q.key}`))})]},E.id)}),Di.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:Di.ungrouped.length})]}),Di.ungrouped.map(E=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:Su.has(E.key),onChange:W=>{const Y=W.target.checked;Gr(J=>Y?J.includes(E.key)?J:[...J,E.key]:J.filter(Q=>Q!==E.key))}}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:E.name}),E.description?o.jsx("span",{className:"af-composer-skill-option-desc",children:E.description}):null]})]},`ungrouped:${E.key}`))]}):null]})}),document.body):null]}),o.jsx("label",{className:"af-composer-model-field",children:o.jsxs("select",{className:"af-composer-model-select",value:Qe,onChange:E=>re(E.target.value),"aria-label":"模型",children:[o.jsx("option",{value:"",children:"默认模型"}),Za.map(E=>o.jsx("option",{value:E.value,children:E.label},E.value))]})}),o.jsx("button",{type:"button",className:"af-composer-send"+(Kt.trim()&&!jn?" af-composer-send--active":"")+(jn?" af-composer-send--stop":""),disabled:jn||!Kt.trim()||!ge,"aria-label":jn?"Running":"Send",onClick:()=>void Pu(),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:jn?"sync":"arrow_upward"})})]})]})]})})]}),ri?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:()=>zs(!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"+(Ii==="workspace"?" af-composer-session-tab--active":""),onClick:()=>Ss("workspace"),children:o.jsx("span",{className:"af-composer-session-label",children:"Workspace"})}),go.map(E=>o.jsx("button",{type:"button",className:"af-composer-session-tab"+(Ii===E.id?" af-composer-session-tab--active":"")+(E.status==="running"?" af-composer-session-tab--running":""),onClick:()=>Ss(E.id),title:E.runNodeId||E.label,children:o.jsx("span",{className:"af-composer-session-label",children:E.label})},E.id))]}),o.jsx("div",{className:"af-composer-sidebar-status"+(rl?" af-composer-sidebar-status--running":""),role:"status","aria-live":"polite",children:zf}),o.jsx("div",{className:"af-composer-sidebar-thread",children:o.jsx(nq,{messages:vg,running:rl,showRunningIndicator:!Rr})})]})}):De&&Lt?o.jsx("aside",{className:"af-pipeline-drawer af-workspace-node-drawer","aria-label":"Workspace Node Properties",children:o.jsx(UI,{draft:De,setDraft:en,definitionId:String(((Au=Lt.data)==null?void 0:Au.definitionId)||Lt.id),systemPromptReadonly:String(((sl=Lt.data)==null?void 0:sl.description)||""),modelLists:xe,disabled:!ge,onIdBlur:()=>Ja(!0),onClose:()=>Gt(""),onPublishToMarketplace:mr,error:rn,ioSlots:{inputs:Array.isArray(De==null?void 0:De.inputs)?De.inputs:[],outputs:Array.isArray(De==null?void 0:De.outputs)?De.outputs:[]}})}):null,o.jsx(zI,{open:Te,onClose:()=>Ae(!1)}),_?os.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:()=>G(!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:Z.name,onChange:E=>{const W=E.target.value;U(Y=>({...Y,name:W,id:Y.id?Y.id:W.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:Z.id,onChange:E=>U(W=>({...W,id:E.target.value})),placeholder:"content-cleanup-snippet"})]}),o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"说明"}),o.jsx("textarea",{value:Z.description,onChange:E=>U(W=>({...W,description:E.target.value})),placeholder:"这段流程适合什么 workspace 场景、需要接哪些上下游。",rows:4})]}),o.jsxs("div",{className:"af-flow-snippet-summary",children:["将发布 ",qn.length," 个节点和 ",Yo.length," 条内部连线。"]}),de?o.jsx("div",{className:"af-flow-snippet-error",children:de}):null]}),o.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>G(!1),children:"取消"}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:se||!Z.name.trim(),onClick:()=>void St(),children:se?"发布中...":"发布"})]})]})}),document.body):null,be?os.createPortal(o.jsx("div",{className:"af-workspace-quick-add-backdrop",onMouseDown:()=>Ie(!1),children:o.jsxs("div",{className:"af-workspace-quick-add",role:"dialog","aria-modal":"true","aria-label":"Add workspace node",onMouseDown:E=>E.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":_e==="nodes",className:"af-workspace-quick-add__tab"+(_e==="nodes"?" af-workspace-quick-add__tab--active":""),onClick:()=>nt("nodes"),children:"节点"}),o.jsx("button",{type:"button",role:"tab","aria-selected":_e==="flows",className:"af-workspace-quick-add__tab"+(_e==="flows"?" af-workspace-quick-add__tab--active":""),onClick:()=>nt("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:Mn,value:st,onChange:E=>Je(E.target.value),onKeyDown:E=>{if(E.key==="Escape")E.preventDefault(),Ie(!1);else if(E.key==="ArrowDown"){E.preventDefault();const W=_e==="flows"?li.length:$i.length;Be(Y=>Math.min(Math.max(0,W-1),Y+1))}else E.key==="ArrowUp"?(E.preventDefault(),Be(W=>Math.max(0,W-1))):E.key==="Tab"?(E.preventDefault(),nt(W=>W==="nodes"?"flows":"nodes")):E.key==="Enter"&&(E.preventDefault(),_e==="flows"?Eu(li[Ct]||li[0]):Qo($i[Ct]||$i[0]))},placeholder:_e==="flows"?"搜索流程片段...":"搜索节点...","aria-label":_e==="flows"?"搜索流程片段":"搜索节点"})]}),o.jsx("div",{className:"af-workspace-quick-add__list",children:_e==="flows"?li.length===0?o.jsx("div",{className:"af-workspace-quick-add__empty",children:I?"正在加载流程片段...":P||"没有匹配的流程片段"}):li.map((E,W)=>{const Y=E.displayName||E.name||E.id,J=E.snippet&&typeof E.snippet=="object"?E.snippet.instances:null,Q=E.snippet&&typeof E.snippet=="object"?E.snippet.edges:null,ie=Number.isFinite(Number(E.nodeCount))?Number(E.nodeCount):Object.keys(J||{}).length,ne=Number.isFinite(Number(E.edgeCount))?Number(E.edgeCount):Array.isArray(Q)?Q.length:0;return o.jsxs("button",{type:"button",className:"af-workspace-quick-add__item"+(W===Ct?" af-workspace-quick-add__item--active":""),onMouseEnter:()=>Be(W),onClick:()=>Eu(E),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:Y}),o.jsxs("span",{className:"af-workspace-quick-add__meta",children:[E.id,E.version?` · v${E.version}`:""]}),o.jsx("span",{className:"af-workspace-quick-add__desc",children:E.description||`${ie} 节点 / ${ne} 连线`})]}),o.jsx("span",{className:"af-workspace-quick-add__cat",children:"FLOW"})]},`${E.id}@${E.version}`)}):$i.length===0?o.jsx("div",{className:"af-workspace-quick-add__empty",children:"没有匹配的节点"}):$i.map((E,W)=>{const Y=cd(E),J=ud(E),Q=Bw(E);return o.jsxs("button",{type:"button",className:"af-workspace-quick-add__item"+(W===Ct?" af-workspace-quick-add__item--active":""),onMouseEnter:()=>Be(W),onClick:()=>Qo(E),children:[o.jsx("span",{className:"af-workspace-quick-add__icon material-symbols-outlined","aria-hidden":!0,children:Ej(Y)}),o.jsxs("span",{className:"af-workspace-quick-add__main",children:[o.jsx("span",{className:"af-workspace-quick-add__label",children:J}),o.jsx("span",{className:"af-workspace-quick-add__meta",children:E.id}),Q?o.jsx("span",{className:"af-workspace-quick-add__desc",children:Q}):null]}),o.jsx("span",{className:"af-workspace-quick-add__cat",children:Y})]},E.id)})})]})}),document.body):null]})]})}function fq(){return o.jsx(cv,{children:o.jsx(dq,{})})}const vt=e=>typeof e=="string",Ju=()=>{let e,t;const n=new Promise((r,s)=>{e=r,t=s});return n.resolve=e,n.reject=t,n},Lj=e=>e==null?"":""+e,pq=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},hq=/###/g,Oj=e=>e&&e.indexOf("###")>-1?e.replace(hq,"."):e,Mj=e=>!e||vt(e),Ad=(e,t,n)=>{const r=vt(t)?t.split("."):t;let s=0;for(;s<r.length-1;){if(Mj(e))return{};const i=Oj(r[s]);!e[i]&&n&&(e[i]=new n),Object.prototype.hasOwnProperty.call(e,i)?e=e[i]:e={},++s}return Mj(e)?{}:{obj:e,k:Oj(r[s])}},$j=(e,t,n)=>{const{obj:r,k:s}=Ad(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=Ad(e,a,Object);for(;l.obj===void 0&&a.length;)i=`${a[a.length-1]}.${i}`,a=a.slice(0,a.length-1),l=Ad(e,a,Object),l&&l.obj&&typeof l.obj[`${l.k}.${i}`]<"u"&&(l.obj=void 0);l.obj[`${l.k}.${i}`]=n},mq=(e,t,n,r)=>{const{obj:s,k:i}=Ad(e,t,Object);s[i]=s[i]||[],s[i].push(n)},ym=(e,t)=>{const{obj:n,k:r}=Ad(e,t);if(n)return n[r]},gq=(e,t,n)=>{const r=ym(e,n);return r!==void 0?r:ym(t,n)},hT=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?vt(e[r])||e[r]instanceof String||vt(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):hT(e[r],t[r],n):e[r]=t[r]);return e},uc=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var yq={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const xq=e=>vt(e)?e.replace(/[&<>"'\/]/g,t=>yq[t]):e;class wq{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 bq=[" ",",","?","!",";"],vq=new wq(20),kq=(e,t,n)=>{t=t||"",n=n||"";const r=bq.filter(a=>t.indexOf(a)<0&&n.indexOf(a)<0);if(r.length===0)return!0;const s=vq.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},Hw=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 u=i;u<r.length;++u)if(u!==i&&(l+=n),l+=r[u],a=s[l],a!==void 0){if(["string","number","boolean"].indexOf(typeof a)>-1&&u<r.length-1)continue;i+=u-i+1;break}s=a}return s},xm=e=>e&&e.replace("_","-"),Sq={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 wm{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||Sq,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:(vt(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new wm(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new wm(this.logger,t)}}var ro=new wm;class lg{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,u]=a;for(let d=0;d<u;d++)l(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(a=>{let[l,u]=a;for(let d=0;d<u;d++)l.apply(l,[t,...r])})}}class Dj extends lg{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):vt(r)&&i?l.push(...r.split(i)):l.push(r)));const u=ym(this.data,l);return!u&&!n&&!r&&t.indexOf(".")>-1&&(t=l[0],n=l[1],r=l.slice(2).join(".")),u||!a||!vt(r)?u:Hw(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),$j(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)(vt(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 u=ym(this.data,l)||{};a.skipCopy||(r=JSON.parse(JSON.stringify(r))),s?hT(u,r,i):u={...u,...r},$j(this.data,l,u),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 mT={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 Fj={};class bm extends lg{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),pq(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=ro.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&&!kq(t,r,s);if(a&&!l){const u=t.match(this.interpolator.nestingRegexp);if(u&&u.length>0)return{key:t,namespaces:vt(i)?[i]:i};const d=t.split(r);(r!==s||r===s&&this.options.ns.indexOf(d[0])>-1)&&(i=d.shift()),t=d.join(s)}return{key:t,namespaces:vt(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),u=l[l.length-1],d=n.lng||this.language,f=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d&&d.toLowerCase()==="cimode"){if(f){const N=n.nsSeparator||this.options.nsSeparator;return s?{res:`${u}${N}${a}`,usedKey:a,exactUsedKey:a,usedLng:d,usedNS:u,usedParams:this.getUsedParamsDetails(n)}:`${u}${N}${a}`}return s?{res:a,usedKey:a,exactUsedKey:a,usedLng:d,usedNS:u,usedParams:this.getUsedParamsDetails(n)}:a}const c=this.resolve(t,n);let p=c&&c.res;const h=c&&c.usedKey||a,g=c&&c.exactUsedKey||a,v=Object.prototype.toString.apply(p),k=["[object Number]","[object Function]","[object RegExp]"],y=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject,w=!vt(p)&&typeof p!="boolean"&&typeof p!="number";if(b&&p&&w&&k.indexOf(v)<0&&!(vt(y)&&Array.isArray(p))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const N=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,p,{...n,ns:l}):`key '${a} (${this.language})' returned an object instead of string.`;return s?(c.res=N,c.usedParams=this.getUsedParamsDetails(n),c):N}if(i){const N=Array.isArray(p),C=N?[]:{},j=N?g:h;for(const R in p)if(Object.prototype.hasOwnProperty.call(p,R)){const D=`${j}${i}${R}`;C[R]=this.translate(D,{...n,joinArrays:!1,ns:l}),C[R]===D&&(C[R]=p[R])}p=C}}else if(b&&vt(y)&&Array.isArray(p))p=p.join(y),p&&(p=this.extendTranslation(p,t,n,r));else{let N=!1,C=!1;const j=n.count!==void 0&&!vt(n.count),R=bm.hasDefaultValue(n),D=j?this.pluralResolver.getSuffix(d,n.count,n):"",M=n.ordinal&&j?this.pluralResolver.getSuffix(d,n.count,{ordinal:!1}):"",z=j&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),$=z&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${D}`]||n[`defaultValue${M}`]||n.defaultValue;!this.isValidLookup(p)&&R&&(N=!0,p=$),this.isValidLookup(p)||(C=!0,p=a);const F=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&C?void 0:p,T=R&&$!==p&&this.options.updateMissing;if(C||N||T){if(this.logger.log(T?"updateKey":"missingKey",d,u,a,T?$:p),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 O=[];const I=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&I&&I[0])for(let P=0;P<I.length;P++)O.push(I[P]);else this.options.saveMissingTo==="all"?O=this.languageUtils.toResolveHierarchy(n.lng||this.language):O.push(n.lng||this.language);const B=(P,L,_)=>{const G=R&&_!==p?_:F;this.options.missingKeyHandler?this.options.missingKeyHandler(P,u,L,G,T,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(P,u,L,G,T,n),this.emit("missingKey",P,u,L,p)};this.options.saveMissing&&(this.options.saveMissingPlurals&&j?O.forEach(P=>{const L=this.pluralResolver.getSuffixes(P,n);z&&n[`defaultValue${this.options.pluralSeparator}zero`]&&L.indexOf(`${this.options.pluralSeparator}zero`)<0&&L.push(`${this.options.pluralSeparator}zero`),L.forEach(_=>{B([P],a+_,n[`defaultValue${_}`]||$)})}):B(O,a,$))}p=this.extendTranslation(p,t,n,c,r),C&&p===a&&this.options.appendNamespaceToMissingKey&&(p=`${u}:${a}`),(C||N)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?p=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}:${a}`:a,N?p:void 0):p=this.options.parseMissingKeyHandler(p))}return s?(c.res=p,c.usedParams=this.getUsedParamsDetails(n),c):p}extendTranslation(t,n,r,s,i){var a=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||s.usedLng,s.usedNS,s.usedKey,{resolved:s});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const d=vt(t)&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let f;if(d){const p=t.match(this.interpolator.nestingRegexp);f=p&&p.length}let c=r.replace&&!vt(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(c={...this.options.interpolation.defaultVariables,...c}),t=this.interpolator.interpolate(t,c,r.lng||this.language||s.usedLng,r),d){const p=t.match(this.interpolator.nestingRegexp),h=p&&p.length;f<h&&(r.nest=!1)}!r.lng&&this.options.compatibilityAPI!=="v1"&&s&&s.res&&(r.lng=this.language||s.usedLng),r.nest!==!1&&(t=this.interpolator.nest(t,function(){for(var p=arguments.length,h=new Array(p),g=0;g<p;g++)h[g]=arguments[g];return i&&i[0]===h[0]&&!r.context?(a.logger.warn(`It seems you are nesting recursively key: ${h[0]} in key: ${n[0]}`),null):a.translate(...h,n)},r)),r.interpolation&&this.interpolator.reset()}const l=r.postProcess||this.options.postProcess,u=vt(l)?[l]:l;return t!=null&&u&&u.length&&r.applyPostProcessor!==!1&&(t=mT.handle(u,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 vt(t)&&(t=[t]),t.forEach(u=>{if(this.isValidLookup(r))return;const d=this.extractFromKey(u,n),f=d.key;s=f;let c=d.namespaces;this.options.fallbackNS&&(c=c.concat(this.options.fallbackNS));const p=n.count!==void 0&&!vt(n.count),h=p&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),g=n.context!==void 0&&(vt(n.context)||typeof n.context=="number")&&n.context!=="",v=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);c.forEach(k=>{this.isValidLookup(r)||(l=k,!Fj[`${v[0]}-${k}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(l)&&(Fj[`${v[0]}-${k}`]=!0,this.logger.warn(`key "${s}" for languages "${v.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!!!")),v.forEach(y=>{if(this.isValidLookup(r))return;a=y;const b=[f];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(b,f,y,k,n);else{let N;p&&(N=this.pluralResolver.getSuffix(y,n.count,n));const C=`${this.options.pluralSeparator}zero`,j=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(p&&(b.push(f+N),n.ordinal&&N.indexOf(j)===0&&b.push(f+N.replace(j,this.options.pluralSeparator)),h&&b.push(f+C)),g){const R=`${f}${this.options.contextSeparator}${n.context}`;b.push(R),p&&(b.push(R+N),n.ordinal&&N.indexOf(j)===0&&b.push(R+N.replace(j,this.options.pluralSeparator)),h&&b.push(R+C))}}let w;for(;w=b.pop();)this.isValidLookup(r)||(i=w,r=this.getResource(y,k,w,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&&!vt(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 Ky=e=>e.charAt(0).toUpperCase()+e.slice(1);class zj{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ro.create("languageUtils")}getScriptPartFromCode(t){if(t=xm(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=xm(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(vt(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]=Ky(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]=Ky(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=Ky(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)),vt(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 vt(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))):vt(t)&&i(this.formatLanguageCode(t)),r.forEach(a=>{s.indexOf(a)<0&&i(this.formatLanguageCode(a))}),s}}let Nq=[{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}],jq={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 Cq=["v1","v2","v3"],Eq=["v4"],Bj={zero:0,one:1,two:2,few:3,many:4,other:5},_q=()=>{const e={};return Nq.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:jq[t.fc]}})}),e};class Pq{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=ro.create("pluralResolver"),(!this.options.compatibilityJSON||Eq.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=_q(),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=xm(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 u=this.languageUtils.getLanguagePartFromCode(t);a=this.getRule(u,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)=>Bj[s]-Bj[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!Cq.includes(this.options.compatibilityJSON)}}const Hj=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=gq(e,t,n);return!i&&s&&vt(n)&&(i=Hw(e,n,r),i===void 0&&(i=Hw(t,n,r))),i},qy=e=>e.replace(/\$/g,"$$$$");class Aq{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=ro.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:u,formatSeparator:d,unescapeSuffix:f,unescapePrefix:c,nestingPrefix:p,nestingPrefixEscaped:h,nestingSuffix:g,nestingSuffixEscaped:v,nestingOptionsSeparator:k,maxReplaces:y,alwaysFormat:b}=t.interpolation;this.escape=n!==void 0?n:xq,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=i?uc(i):a||"{{",this.suffix=l?uc(l):u||"}}",this.formatSeparator=d||",",this.unescapePrefix=f?"":c||"-",this.unescapeSuffix=this.unescapePrefix?"":f||"",this.nestingPrefix=p?uc(p):h||uc("$t("),this.nestingSuffix=g?uc(g):v||uc(")"),this.nestingOptionsSeparator=k||",",this.maxReplaces=y||1e3,this.alwaysFormat=b!==void 0?b:!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 u=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},d=h=>{if(h.indexOf(this.formatSeparator)<0){const y=Hj(n,u,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(y,void 0,r,{...s,...n,interpolationkey:h}):y}const g=h.split(this.formatSeparator),v=g.shift().trim(),k=g.join(this.formatSeparator).trim();return this.format(Hj(n,u,v,this.options.keySeparator,this.options.ignoreJSONStructure),k,r,{...s,...n,interpolationkey:v})};this.resetRegExp();const f=s&&s.missingInterpolationHandler||this.options.missingInterpolationHandler,c=s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>qy(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?qy(this.escape(h)):qy(h)}].forEach(h=>{for(l=0;i=h.regex.exec(t);){const g=i[1].trim();if(a=d(g),a===void 0)if(typeof f=="function"){const k=f(t,i,s);a=vt(k)?k:""}else if(s&&Object.prototype.hasOwnProperty.call(s,g))a="";else if(c){a=i[0];continue}else this.logger.warn(`missed to pass in variable ${g} for interpolating ${t}`),a="";else!vt(a)&&!this.useRawValueToEscape&&(a=Lj(a));const v=h.safeValue(a);if(t=t.replace(i[0],v),c?(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=(u,d)=>{const f=this.nestingOptionsSeparator;if(u.indexOf(f)<0)return u;const c=u.split(new RegExp(`${f}[ ]*{`));let p=`{${c[1]}`;u=c[0],p=this.interpolate(p,a);const h=p.match(/'/g),g=p.match(/"/g);(h&&h.length%2===0&&!g||g.length%2!==0)&&(p=p.replace(/'/g,'"'));try{a=JSON.parse(p),d&&(a={...d,...a})}catch(v){return this.logger.warn(`failed parsing options string in nesting for key ${u}`,v),`${u}${f}${p}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,u};for(;s=this.nestingRegexp.exec(t);){let u=[];a={...r},a=a.replace&&!vt(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let d=!1;if(s[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(s[1])){const f=s[1].split(this.formatSeparator).map(c=>c.trim());s[1]=f.shift(),u=f,d=!0}if(i=n(l.call(this,s[1].trim(),a),a),i&&s[0]===t&&!vt(i))return i;vt(i)||(i=Lj(i)),i||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${t}`),i=""),d&&(i=u.reduce((f,c)=>this.format(f,c,r.lng,{...r,interpolationkey:s[1].trim()}),i.trim())),t=t.replace(s[0],i),this.regexp.lastIndex=0}return t}}const Iq=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,...u]=a.split(":"),d=u.join(":").trim().replace(/^'+|'+$/g,""),f=l.trim();n[f]||(n[f]=d),d==="false"&&(n[f]=!1),d==="true"&&(n[f]=!0),isNaN(d)||(n[f]=parseInt(d,10))}})}return{formatName:t,formatOptions:n}},dc=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(xm(r),s),t[a]=l),l(n)}};class Tq{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=ro.create("formatter"),this.options=t,this.formats={number:dc((n,r)=>{const s=new Intl.NumberFormat(n,{...r});return i=>s.format(i)}),currency:dc((n,r)=>{const s=new Intl.NumberFormat(n,{...r,style:"currency"});return i=>s.format(i)}),datetime:dc((n,r)=>{const s=new Intl.DateTimeFormat(n,{...r});return i=>s.format(i)}),relativetime:dc((n,r)=>{const s=new Intl.RelativeTimeFormat(n,{...r});return i=>s.format(i,r.range||"day")}),list:dc((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()]=dc(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(u=>u.indexOf(")")>-1);i[0]=[i[0],...i.splice(1,l)].join(this.formatSeparator)}return i.reduce((l,u)=>{const{formatName:d,formatOptions:f}=Iq(u);if(this.formats[d]){let c=l;try{const p=s&&s.formatParams&&s.formatParams[s.interpolationkey]||{},h=p.locale||p.lng||s.locale||s.lng||r;c=this.formats[d](l,h,{...f,...s,...p})}catch(p){this.logger.warn(p)}return c}else this.logger.warn(`there was no format function for ${d}`);return l},t)}}const Rq=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class Lq extends lg{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=ro.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={},u={};return t.forEach(d=>{let f=!0;n.forEach(c=>{const p=`${d}|${c}`;!r.reload&&this.store.hasResourceBundle(d,c)?this.state[p]=2:this.state[p]<0||(this.state[p]===1?a[p]===void 0&&(a[p]=!0):(this.state[p]=1,f=!1,a[p]===void 0&&(a[p]=!0),i[p]===void 0&&(i[p]=!0),u[c]===void 0&&(u[c]=!0)))}),f||(l[d]=!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(u)}}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(u=>{mq(u.loaded,[i],a),Rq(u,t),n&&u.errors.push(n),u.pendingCount===0&&!u.done&&(Object.keys(u.loaded).forEach(d=>{l[d]||(l[d]={});const f=u.loaded[d];f.length&&f.forEach(c=>{l[d][c]===void 0&&(l[d][c]=!0)})}),u.done=!0,u.errors.length?u.callback(u.errors):u.callback())}),this.emit("loaded",l),this.queue=this.queue.filter(u=>!u.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=(d,f)=>{if(this.readingCalls--,this.waitingReads.length>0){const c=this.waitingReads.shift();this.read(c.lng,c.ns,c.fcName,c.tried,c.wait,c.callback)}if(d&&f&&s<this.maxRetries){setTimeout(()=>{this.read.call(this,t,n,r,s+1,i*2,a)},i);return}a(d,f)},u=this.backend[r].bind(this.backend);if(u.length===2){try{const d=u(t,n);d&&typeof d.then=="function"?d.then(f=>l(null,f)).catch(l):l(null,d)}catch(d){l(d)}return}return u(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();vt(t)&&(t=this.languageUtils.toResolveHierarchy(t)),vt(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 u={...a,isUpdate:i},d=this.backend.create.bind(this.backend);if(d.length<6)try{let f;d.length===5?f=d(t,n,r,s,u):f=d(t,n,r,s),f&&typeof f.then=="function"?f.then(c=>l(null,c)).catch(l):l(null,f)}catch(f){l(f)}else d(t,n,r,s,l,u)}!t||!t[0]||this.store.addResource(t[0],n,r,s)}}}const Wj=()=>({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]),vt(e[1])&&(t.defaultValue=e[1]),vt(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}}),Vj=e=>(vt(e.ns)&&(e.ns=[e.ns]),vt(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),vt(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),Up=()=>{},Oq=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class pf extends lg{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=Vj(t),this.services={},this.logger=ro,this.modules={external:[]},Oq(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&&(vt(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const s=Wj();this.options={...s,...this.options,...Vj(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...s.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);const i=f=>f?typeof f=="function"?new f:f:null;if(!this.options.isClone){this.modules.logger?ro.init(i(this.modules.logger),this.options):ro.init(null,this.options);let f;this.modules.formatter?f=this.modules.formatter:typeof Intl<"u"&&(f=Tq);const c=new zj(this.options);this.store=new Dj(this.options.resources,this.options);const p=this.services;p.logger=ro,p.resourceStore=this.store,p.languageUtils=c,p.pluralResolver=new Pq(c,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),f&&(!this.options.interpolation.format||this.options.interpolation.format===s.interpolation.format)&&(p.formatter=i(f),p.formatter.init(p,this.options),this.options.interpolation.format=p.formatter.format.bind(p.formatter)),p.interpolator=new Aq(this.options),p.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},p.backendConnector=new Lq(i(this.modules.backend),p.resourceStore,p,this.options),p.backendConnector.on("*",function(h){for(var g=arguments.length,v=new Array(g>1?g-1:0),k=1;k<g;k++)v[k-1]=arguments[k];t.emit(h,...v)}),this.modules.languageDetector&&(p.languageDetector=i(this.modules.languageDetector),p.languageDetector.init&&p.languageDetector.init(p,this.options.detection,this.options)),this.modules.i18nFormat&&(p.i18nFormat=i(this.modules.i18nFormat),p.i18nFormat.init&&p.i18nFormat.init(this)),this.translator=new bm(this.services,this.options),this.translator.on("*",function(h){for(var g=arguments.length,v=new Array(g>1?g-1:0),k=1;k<g;k++)v[k-1]=arguments[k];t.emit(h,...v)}),this.modules.external.forEach(h=>{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,r||(r=Up),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const f=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);f.length>0&&f[0]!=="dev"&&(this.options.lng=f[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(f=>{this[f]=function(){return t.store[f](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(f=>{this[f]=function(){return t.store[f](...arguments),t}});const u=Ju(),d=()=>{const f=(c,p)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),u.resolve(p),r(c,p)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return f(null,this.t.bind(this));this.changeLanguage(this.options.lng,f)};return this.options.resources||!this.options.initImmediate?d():setTimeout(d,0),u}loadResources(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Up;const s=vt(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(d=>{d!=="cimode"&&i.indexOf(d)<0&&i.push(d)})};s?a(s):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(u=>a(u)),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=Ju();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=Up),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"&&mT.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=Ju();this.emit("languageChanging",t);const i=u=>{this.language=u,this.languages=this.services.languageUtils.toResolveHierarchy(u),this.resolvedLanguage=void 0,this.setResolvedLanguage(u)},a=(u,d)=>{d?(i(d),this.translator.changeLanguage(d),this.isLanguageChangingTo=void 0,this.emit("languageChanged",d),this.logger.log("languageChanged",d)):this.isLanguageChangingTo=void 0,s.resolve(function(){return r.t(...arguments)}),n&&n(u,function(){return r.t(...arguments)})},l=u=>{!t&&!u&&this.services.languageDetector&&(u=[]);const d=vt(u)?u:this.services.languageUtils.getBestMatchFromCodes(u);d&&(this.language||i(d),this.translator.language||this.translator.changeLanguage(d),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(d)),this.loadResources(d,f=>{a(f,d)})};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 u;if(typeof l!="object"){for(var d=arguments.length,f=new Array(d>2?d-2:0),c=2;c<d;c++)f[c-2]=arguments[c];u=s.options.overloadTranslationOptionHandler([a,l].concat(f))}else u={...l};u.lng=u.lng||i.lng,u.lngs=u.lngs||i.lngs,u.ns=u.ns||i.ns,u.keyPrefix!==""&&(u.keyPrefix=u.keyPrefix||r||i.keyPrefix);const p=s.options.keySeparator||".";let h;return u.keyPrefix&&Array.isArray(a)?h=a.map(g=>`${u.keyPrefix}${p}${g}`):h=u.keyPrefix?`${u.keyPrefix}${p}${a}`:a,s.t(h,u)};return vt(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,u)=>{const d=this.services.backendConnector.state[`${l}|${u}`];return d===-1||d===0||d===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=Ju();return this.options.ns?(vt(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=Ju();vt(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 zj(Wj());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 pf(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Up;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const s={...this.options,...t,isClone:!0},i=new pf(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 Dj(this.store.data,s),i.services.resourceStore=i.store),i.translator=new bm(i.services,s),i.translator.on("*",function(l){for(var u=arguments.length,d=new Array(u>1?u-1:0),f=1;f<u;f++)d[f-1]=arguments[f];i.emit(l,...d)}),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 Ir=pf.createInstance();Ir.createInstance=pf.createInstance;Ir.createInstance;Ir.dir;Ir.init;Ir.loadResources;Ir.reloadResources;Ir.use;Ir.changeLanguage;Ir.getFixedT;Ir.t;Ir.exists;Ir.setDefaultNamespace;Ir.hasLoadedNamespace;Ir.loadNamespaces;Ir.loadLanguages;function Mq(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hf(e){"@babel/helpers - typeof";return hf=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},hf(e)}function $q(e,t){if(hf(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(hf(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Dq(e){var t=$q(e,"string");return hf(t)=="symbol"?t:t+""}function Fq(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,Dq(r.key),r)}}function zq(e,t,n){return t&&Fq(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var gT=[],Bq=gT.forEach,Hq=gT.slice;function Wq(e){return Bq.call(Hq.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}var Uj=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,Vq=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(!Uj.test(s.domain))throw new TypeError("option domain is invalid");a+="; Domain=".concat(s.domain)}if(s.path){if(!Uj.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 u=typeof s.sameSite=="string"?s.sameSite.toLowerCase():s.sameSite;switch(u){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=Vq(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)}},Uq={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)}},Kq={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 u=i[a].substring(0,l);u===t.lookupQuerystring&&(n=i[a].substring(l+1))}}}return n}},Qu=null,qj=function(){if(Qu!==null)return Qu;try{Qu=window!=="undefined"&&window.localStorage!==null;var t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{Qu=!1}return Qu},qq={name:"localStorage",lookup:function(t){var n;if(t.lookupLocalStorage&&qj()){var r=window.localStorage.getItem(t.lookupLocalStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupLocalStorage&&qj()&&window.localStorage.setItem(n.lookupLocalStorage,t)}},Zu=null,Yj=function(){if(Zu!==null)return Zu;try{Zu=window!=="undefined"&&window.sessionStorage!==null;var t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{Zu=!1}return Zu},Yq={name:"sessionStorage",lookup:function(t){var n;if(t.lookupSessionStorage&&Yj()){var r=window.sessionStorage.getItem(t.lookupSessionStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupSessionStorage&&Yj()&&window.sessionStorage.setItem(n.lookupSessionStorage,t)}},Gq={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}},Xq={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}},Jq={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}},Qq={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]}},yT=!1;try{document.cookie,yT=!0}catch{}var xT=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];yT||xT.splice(1,1);function Zq(){return{order:xT,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(t){return t}}}var wT=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Mq(this,e),this.type="languageDetector",this.detectors={},this.init(t,n)}return zq(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=Wq(r,this.options||{},Zq()),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(Uq),this.addDetector(Kq),this.addDetector(qq),this.addDetector(Yq),this.addDetector(Gq),this.addDetector(Xq),this.addDetector(Jq),this.addDetector(Qq)}},{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)}))}}])}();wT.type="languageDetector";const eY={name:"AgentFlow",tagline:"AI Workflow Orchestration"},tY={projects:"Projects",nodes:"Nodes",myNodes:"My Nodes",myFlows:"My Flows",skills:"Skills",mcps:"MCP",feedback:"Feedback",flowEditor:"Flow Editor",settings:"Settings",back:"Back"},nY={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"},rY={success:"Success",failed:"Failed",pending:"Pending",running:"Running",skipped:"Skipped"},sY={agent:"Agent",control:"Control",tool:"Tool",start:"Start",end:"End"},iY={online:"Engine Online",offline:"Engine Offline",connecting:"Connecting…"},oY={hub:"AgentFlow Hub",docs:"Documentation",github:"GitHub Repository"},aY={app:eY,nav:tY,common:nY,status:rY,nodeTypes:sY,engine:iY,links:oY},lY="Flow Editor",cY="Nodes",uY="Edges",dY="Properties",fY={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"},pY={title:"Node Properties",noInputPins:"No input pins",noOutputPins:"No output pins",type:"Type",name:"Name",defaultValue:"Default / value",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",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}}"},hY={run:"Run Flow",stop:"Stop",resume:"Resume",validate:"Validate",export:"Export",import:"Import"},mY={nodeList:"Node List",runHistory:"Run History",validation:"Validation Results"},gY={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"},yY={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)"},xY={saving:"Saving...",saved:"Saved",saveFailed:"Save failed",runInTerminal:"Please use terminal to run"},wY={requirement:"Requirement Analysis",planning:"Technical Planning",code:"Code Execution",test:"Test Regression",normal:"Normal"},bY={phase:"Phase",allPhasesComplete:"All phases completed",currentPhaseComplete:"Current phase completed, waiting for confirmation..."},vY={node:"Node",text:"Text",file:"File",bool:"Boolean"},kY={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"},SY={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",selectAll:"Select all nodes",undo:"Undo canvas change",redo:"Redo canvas change"},NY={title:"Jump to node",placeholder:"Type node ID or label…",empty:"No matching nodes",hintNavigate:"navigate",hintJump:"jump",hintClose:"close"},jY={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."},CY={mainNav:"Main Navigation"},EY={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'},_Y={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):
|
|
160
|
+
{{summary}}`,step:"Step {{current}}/{{total}}: {{description}}",phaseGeneration:`Phased generation ({{count}} phases): {{labels}}
|
|
161
|
+
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}}"},PY={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"},AY={nodePalette:"Node Palette",noPipelineSelected:"No pipeline selected",moreRuns:"+{{count}} more",moreFlows:"+{{count}} more flows",runId:"Run ID: {{id}}"},IY={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}}"},TY={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"},RY={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"},LY={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"},OY={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"},MY={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"},$Y={invalidPlaceholder:"Invalid placeholder: {{hint}}",empty:"(empty)",inputSubtitle:"Input · {{type}}",inputSubtitleNoType:"Input",outputSubtitle:"Output · {{type}}",outputSubtitleNoType:"Output",runtimeConst:"Runtime constant"},DY={justNow:"Just now",minutesAgo:"{{n}} min ago",hoursAgo:"{{n}} hr ago",yesterday:"Yesterday",daysAgo:"{{n}} days ago",milliseconds:"{{n}} ms",seconds:"{{n}} s"},FY={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"},zY={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."},BY={title:"Print Output: {{instanceId}}",expand:"Expand",restore:"Restore"},HY={save:"Save",cancel:"Cancel"},WY={title:"Run with Params",noParams:"No input params in this flow",run:"Run",cancel:"Cancel"},VY={title:"Run with Preset",noPresets:"No presets available",default:"Default run",run:"Run",cancel:"Cancel"},UY={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"},KY={title:lY,nodes:cY,edges:uY,properties:dY,node:fY,nodeProps:pY,actions:hY,panel:mY,palette:gY,pipeline:yY,status:xY,roles:wY,phases:bY,types:vY,runContext:kY,shortcuts:SY,jumpPalette:NY,emptyCanvas:jY,sidebar:CY,validation:EY,composer:_Y,topbar:PY,palette2:AY,run:IY,fileEdit:TY,settings:RY,schedule:LY,history:OY,nodePropsError:MY,placeholder:$Y,time:DY,userCheck:FY,userAsk:zY,toolPrint:BY,provideEdit:HY,runParams:WY,runPreset:VY,runConfig:UY},qY="Settings",YY={engine:"Engine Settings",preferences:"Global Preferences"},GY={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)."},XY={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..."}},JY={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."},QY={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."},ZY={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)"},eG={title:"System Status",normal:"Service normal",abnormal:"Some interfaces abnormal",cursorModels:"Cursor Models",opencodeModels:"OpenCode Models",claudeCodeModels:"Claude Code Models"},tG={title:"Shortcuts",projects:"Projects & Pipelines",flowEditor:"Node Canvas"},nG={title:"Language",description:"Select your preferred language for the interface",options:{zh:"中文",en:"English",ja:"日本語"}},rG={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."},sG={title:qY,crumb:YY,workspace:GY,cursor:XY,opencode:JY,claudeCode:QY,env:ZY,system:eG,shortcuts:tG,language:nG,onboarding:rG},iG={thinking:"Thinking",result:"Result",reply:"Reply",error:"Error"},oG={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)"},aG={send:"Send",stop:"Stop",expand:"Expand",collapse:"Collapse",clear:"Clear"},lG={conversation:"Chat",conversationWithNumber:"Chat {{num}}",default:"Default"},cG={endSession:"End chat (will stop generation)",closeSession:"Close chat",newSession:"New chat",expandComposer:"Expand chat and output"},uG={hint:"Use the bottom input box for AI chat, with @node mentions, model selection, and more"},dG={aiLabels:iG,placeholders:oG,actions:aG,labels:lG,tooltips:cG,rightPanel:uG},fG="Projects",pG="All",hG="Archived",mG="Nodes",gG="My Nodes",yG="My Flows",xG="Skills",wG="Active Projects",bG="Archived Pipelines",vG="Global Nodes",kG="Manage node versions published to the current workspace marketplace, {{count}} total.",SG="Manage flow snippets published to the current workspace marketplace, {{count}} total.",NG="Global Skills",jG="Create New Project",CG="New Pipeline",EG="SEARCH PIPELINES...",_G="SEARCH NODES...",PG="SEARCH FLOW SNIPPETS...",AG="SEARCH SKILLS...",IG="Refresh Resources",TG="Loading pipelines...",RG="Loading global resources...",LG="Filter result: {{count}} items (matching title, description, path and tags)",OG="Archived pipelines can still be opened and edited; files are located in the _archived subdirectory of each pipelines directory.",MG="Manage your distributed node architectures and monitoring pipelines. Drag flow.yaml or .zip into this page to import shared flows.",$G="Review all globally available node definitions, {{count}} total, including built-in, workspace, and marketplace nodes.",DG="Review Composer-selectable skills, {{count}} total, including AgentFlow built-ins and workspace skills.",FG="Executable building blocks for pipeline runtime",zG="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.",BG="Published local node packages",HG="Only node versions published to this workspace marketplace appear here. Inspect details and delete versions that no flow uses.",WG="Published flow snippets",VG="Flow snippets published from Pipeline or Workspace canvases appear here. Search and inspect them, then load them from the canvas flow palette.",UG="Operating guides for Composer and agents",KG="Skills tell AI which rules to follow for a task, how to change flows, and how to reuse project conventions.",qG="No archived projects.",YG="No active pipelines; archived items are in the Archived tab.",GG="No global nodes available.",XG="No marketplace nodes have been published.",JG="No flow snippets have been published. Select multiple canvas nodes and publish them first.",QG="No skills available.",ZG="No description.",eX='No node matches "{{query}}".',tX='No flow snippet matches "{{query}}".',nX='No skill matches "{{query}}".',rX="{{inputs}} in / {{outputs}} out",sX="Flow Snippet",iX="{{nodes}} nodes / {{edges}} edges",oX="Skill",aX="Node detail",lX="Flow snippet detail",cX="Skill detail",uX="Type",dX="Source",fX="Package",pX="Version",hX="Path",mX="Editable",gX="Read only",yX="Editable",xX="Schema",wX="Inputs",bX="Outputs",vX="Runtime",kX="Node Body",SX="Files",NX="Usage",jX="No runtime manifest.",CX="No node body or README.",EX="No previewable files.",_X="Select a file to preview.",PX="Binary file preview is not supported.",AX="Large file; showing the first 256KB only.",IX="No pipelines using this node were found.",TX="Node Management",RX="Delete Node Version",LX="Deleting...",OX="AgentFlow checks all flow references before deleting; installed or used versions are kept.",MX="Delete {{id}}@{{version}}? This cannot be undone.",$X="Deleted {{id}}@{{version}}.",DX="{{count}} flow(s) still use it.",FX="Flow Snippet Management",zX="Delete Flow Snippet",BX="Deleting...",HX="Deleting it only removes this reusable marketplace snippet. Nodes already loaded onto canvases are not changed.",WX="Delete {{id}}@{{version}}? This cannot be undone.",VX="Deleted {{id}}@{{version}}.",UX="No slots",KX="Purpose",qX="This node is an execution unit in a pipeline. Its schema affects canvas wiring, parameter input, and runtime scheduling.",YX="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.",GX="Scale",XX="Flow Preview",JX="Edges",QX="Snippet JSON",ZX="{{count}} more edge(s)",eJ="No previewable nodes.",tJ="This skill is injected into Composer as context for AI, constraining its decisions, edit strategy, and output format.",nJ="SKILL.md Preview",rJ="No preview content available.",sJ="Select a resource to inspect details.",iJ="Failed to load pipeline list.",oJ="No pipelines in current workspace.",aJ="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.",lJ='No pipelines found matching "{{query}}". Try different keywords or clear the search.',cJ="Recent Activity",uJ="No recent activity",dJ="No recent activity matching the keyword",fJ="Recent Run",pJ="Recent Open",hJ={builtin:"Built-in",workspace:"Workspace",user:"User"},mJ={flow:"Flow",global:"Global",marketplace:"Marketplace"},gJ={all:"All",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},yJ={overview:"Overview",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},xJ="Open to edit this pipeline in the node canvas.",wJ={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>"},bJ={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"},vJ={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"},SJ={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"},NJ={title:fG,all:pG,archived:hG,nodes:mG,myNodes:gG,myFlows:yG,skills:xG,activeProjects:wG,archivedPipelines:bG,globalNodes:vG,myNodesHint:kG,myFlowsHint:SG,globalSkills:NG,createNew:jG,newPipeline:CG,searchPipelines:EG,searchNodes:_G,searchFlows:PG,searchSkills:AG,refreshResources:IG,loadingPipelines:TG,loadingResources:RG,filterResult:LG,archivedHint:OG,activeHint:MG,nodesHint:$G,skillsHint:DG,nodesPurposeTitle:FG,nodesPurposeDesc:zG,myNodesPurposeTitle:BG,myNodesPurposeDesc:HG,myFlowsPurposeTitle:WG,myFlowsPurposeDesc:VG,skillsPurposeTitle:UG,skillsPurposeDesc:KG,noArchived:qG,noActive:YG,noNodes:GG,noMyNodes:XG,noMyFlows:JG,noSkills:QG,noDescription:ZG,noNodeMatch:eX,noFlowSnippetMatch:tX,noSkillMatch:nX,nodeSlots:rX,flowSnippet:sX,flowSnippetNodes:iX,skill:oX,nodeDetail:aX,flowDetail:lX,skillDetail:cX,detailType:uX,detailSource:dX,detailPackage:fX,detailVersion:pX,detailPath:hX,detailEditable:mX,readOnly:gX,editable:yX,nodeSchema:xX,nodeInputs:wX,nodeOutputs:bX,nodeRuntime:vX,nodeBody:kX,nodeFiles:SX,nodeUsage:NX,noRuntimeManifest:jX,noNodeBody:CX,noNodeFiles:EX,selectNodeFile:_X,binaryFile:PX,fileTruncated:AX,noNodeUsage:IX,myNodeManagement:TX,deleteMyNode:RX,deletingMyNode:LX,deleteMyNodeHint:OX,deleteMyNodeConfirm:MX,deleteMyNodeSuccess:$X,deleteMyNodeUsedBy:DX,myFlowManagement:FX,deleteMyFlow:zX,deletingMyFlow:BX,deleteMyFlowHint:HX,deleteMyFlowConfirm:WX,deleteMyFlowSuccess:VX,noSlots:UX,resourceMeaning:KX,nodesMeaning:qX,myFlowsMeaning:YX,flowSnippetScale:GX,flowSnippetPreview:XX,flowSnippetEdges:JX,flowSnippetJson:QX,flowSnippetMoreEdges:ZX,noFlowSnippetPreview:eJ,skillsMeaning:tJ,skillPreview:nJ,skillPreviewEmpty:rJ,selectResource:sJ,loadFailed:iJ,noPipelines:oJ,emptyHint:aJ,noMatch:lJ,recentActivity:cJ,noRecentActivity:uJ,noMatchRecent:dJ,recentRun:fJ,recentOpen:pJ,sourceBadge:hJ,resourceSource:mJ,resourceFilter:gJ,nodeDetailTabs:yJ,defaultCardDesc:xJ,hubCard:wJ,newPipelineModal:bJ,importModal:vJ,deleteModal:kJ,archiveModal:SJ},jJ="Back",CJ="Next",EJ="Skip",_J="Done",PJ="Start Creating",AJ={intro:`Welcome to AgentFlow! This is a visual workflow orchestration tool.
|
|
162
|
+
|
|
163
|
+
Click the button below to create your first pipeline.`,hubIntro:`Don't want to start from scratch?
|
|
164
|
+
|
|
165
|
+
Browse ready-made pipelines on AgentFlow Hub — community-shared flows you can install and run in one click.`},IJ={intro:`Now you're in the flow editor.
|
|
166
|
+
|
|
167
|
+
Describe your requirements in natural language in the input box below, and AI will generate the flow graph.
|
|
168
|
+
|
|
169
|
+
The left node panel allows you to freely drag, delete, and adjust connections.`,introEmpty:`The canvas is empty. Start creating your flow!
|
|
170
|
+
|
|
171
|
+
Describe your requirements in natural language in the input box below, and AI will generate the flow graph.
|
|
172
|
+
|
|
173
|
+
The left node panel allows you to freely drag, delete, and adjust connections.`},TJ={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"},RJ={back:jJ,next:CJ,skip:EJ,done:_J,startCreate:PJ,projects:AJ,flow:IJ,newPipeline:TJ},LJ={name:"AgentFlow",tagline:"AI 工作流编排"},OJ={projects:"项目",nodes:"Nodes",myNodes:"我的 Nodes",myFlows:"我的流程",skills:"Skills",mcps:"MCP",feedback:"意见反馈",flowEditor:"流程编辑器",settings:"设置",back:"返回"},MJ={loading:"加载中…",saving:"保存中…",save:"保存",cancel:"取消",delete:"删除",edit:"编辑",create:"创建",close:"关闭",confirm:"确认",copy:"复制",copied:"已复制!",refresh:"刷新",search:"搜索",filter:"筛选",success:"成功",error:"错误",warning:"警告",info:"信息",done:"完成",pending:"待处理",running:"运行中",notFound:"未找到",required:"必填",optional:"可选"},$J={success:"成功",failed:"失败",pending:"等待",running:"运行中",skipped:"跳过"},DJ={agent:"Agent 节点",control:"控制节点",tool:"工具节点",start:"开始",end:"结束"},FJ={online:"引擎在线",offline:"引擎离线",connecting:"连接中…"},zJ={hub:"AgentFlow Hub",docs:"文档",github:"GitHub 仓库"},BJ={app:LJ,nav:OJ,common:MJ,status:$J,nodeTypes:DJ,engine:FJ,links:zJ},HJ="流程编辑器",WJ="节点",VJ="连线",UJ="属性",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:"编辑内容"},qJ={title:"节点属性",noInputPins:"当前无输入引脚",noOutputPins:"当前无输出引脚",type:"类型",name:"名称",defaultValue:"默认值 / value",required:"必填",showOnNode:"卡片",requiredHint:"标记为必填,用于提示用户该槽位必须提供值或连线",showOnNodeHint:"是否在画布节点卡片旁展示这个引脚名称;关闭后仍可连线",pinRequiredAriaLabel:"{{label}} {{index}} 是否必填",pinShowOnNodeAriaLabel:"{{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}}"},YJ={run:"运行流程",stop:"停止",resume:"继续",validate:"校验",export:"导出",import:"导入"},GJ={nodeList:"节点列表",runHistory:"运行历史",validation:"校验结果"},XJ={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:"暂无运行记录(终端执行后会在工作区生成运行目录)"},QJ={saving:"保存中…",saved:"已保存",saveFailed:"保存失败",runInTerminal:"运行请使用终端"},ZJ={requirement:"需求拆解",planning:"技术规划",code:"代码执行",test:"测试回归",normal:"普通"},eQ={phase:"阶段",allPhasesComplete:"所有阶段完成",currentPhaseComplete:"当前阶段完成,等待确认继续…"},tQ={node:"节点",text:"文本",file:"文件",bool:"布尔"},nQ={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:"等待"},rQ={title:"快捷键",general:"常规",saveDesc:"保存;节点属性侧栏打开时先提交节点再保存 flow",shortcutsLabel:"快捷键",jumpToNode:"按 ID 跳转到节点",openNodePalette:"打开节点面板",canvas:"画布",selectTool:"选择工具",panTool:"平移工具",holdSpacePan:"按住空格临时平移",selectAll:"全选所有节点",undo:"撤销画布修改",redo:"重做画布修改"},sQ={title:"跳转到节点",placeholder:"输入节点 ID 或名称…",empty:"未匹配到节点",hintNavigate:"切换",hintJump:"跳转",hintClose:"关闭"},iQ={title:"开始构建你的流程",text:"在下方 AI 输入框中描述你的流程,或从左侧面板拖拽节点到画布",composerHint:"使用 AI Composer 构建 AgentFlow",composerSub:"从左侧拖入节点,或在<strong>下方输入框</strong>中用自然语言描述工作流。<br/>按 <kbd>?</kbd> 查看快捷键。"},oQ={mainNav:"主导航"},aQ={flowWarningAriaLabel:"流程校验警告",reloadFromServer:"从服务器重新加载流程并刷新校验",reloadFromServerShort:"从服务器重新加载",closeBanner:"关闭校验警告横幅",nodePrefix:"节点",focusNodeAriaLabel:"在画布中选中并定位节点 {{nodeId}}",slotWarningCount:"槽位校验 {{count}} 条(已隐藏)",show:"显示",shortcutHint:"按 ? 查看快捷键",shortcutHintLabel:"快捷键",inputSlotNoEdge:' 的 input 槽位 "{{slotName}}"({{handle}})无对应 edge 连接',outputSlotNoEdge:' 的 output 槽位 "{{slotName}}"({{handle}})无对应 edge 连接'},lQ={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}} 步):
|
|
174
|
+
{{summary}}`,step:"步骤 {{current}}/{{total}}: {{description}}",phaseGeneration:`分阶段生成({{count}} 阶段):{{labels}}
|
|
175
|
+
当前:{{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}}"},cQ={currentPipeline:"当前流水线",backToEdit:"返回编辑",backToProjects:"返回项目",executionLog:"执行日志",history:"历史",pipelineSettings:"流水线设置",shortcutsLabel:"快捷键",shortcutsTitle:"快捷键 (?)",deletePipeline:"删除流水线",resumeTitle:"在同一 run 目录继续执行(uuid={{uuid}})",resumeTitleNoUuid:"尚未收到 apply-start,将发起新的 run",rerunTitle:"从头开始新的运行",runOptions:"运行选项",runWithParams:"带参数运行",runWithPreset:"指定预设运行",editRun:"编辑运行参数",startRun:"开始执行",stopRun:"停止后台运行"},uQ={nodePalette:"节点调色板",noPipelineSelected:"未选择流水线",moreRuns:"+{{count}} 更多",moreFlows:"+{{count}} 更多流程",runId:"运行 ID: {{id}}"},dQ={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}} 的分支"},fQ={close:"关闭",loading:"加载中…",placeholder:"文件内容",largeFileWarning:"文件较大,编辑器性能可能受影响",reset:"重置",aiEdit:"AI 修改",aiRunning:"AI 处理中…",save:"保存",saving:"保存中…",saved:"已保存"},pQ={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:"已复制"},hQ={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:"定时配置已保存"},mQ={title:"执行历史",summary:"执行结果汇总",successCount:"{{count}} 成功",failedCount:"{{count}} 失败",stoppedCount:"{{count}} 已停止",interruptedCount:"{{count}} 已中断",runningCount:"{{count}} 进行中",success:"成功",failed:"失败",stopped:"已停止",interrupted:"已中断",running:"进行中",unknown:"未知",runLabel:"运行 #{{id}}",enterRunView:"进入该次运行的画布与日志态"},gQ={invalidInstanceId:"实例 ID 格式无效:仅允许英文字母、数字、下划线、短横线,且不能以数字开头。",duplicateInstanceId:"该实例 ID 已存在,请换一个。",loadFlowFailed:"读取 flow 失败",loadNodesFailed:"读取节点库失败"},yQ={invalidPlaceholder:"无效占位符: {{hint}}",empty:"(空)",inputSubtitle:"输入 · {{type}}",inputSubtitleNoType:"输入",outputSubtitle:"输出 · {{type}}",outputSubtitleNoType:"输出",runtimeConst:"运行时常量"},xQ={justNow:"刚刚",minutesAgo:"{{n}} 分钟前",hoursAgo:"{{n}} 小时前",yesterday:"昨天",daysAgo:"{{n}} 天前",milliseconds:"{{n}} 毫秒",seconds:"{{n}} 秒"},wQ={title:"用户确认 ({{instanceId}})",edit:"编辑",save:"保存",cancel:"取消",aiEditPlaceholder:"输入 AI 修改指令,如:删除第二项、合并前两项…",aiEditBtn:"AI 修改",aiEditStarted:"AI 正在修改内容…",aiEditDone:"AI 修改完成",aiEditFailed:"AI 修改失败",contentSaved:"内容已保存",saveFailed:"保存失败",close:"关闭",continue:"继续执行",hint:"编辑或使用 AI 修改后点击保存,然后点击「继续执行」恢复流程"},bQ={title:"用户选择 ({{instanceId}})",hint:"请从下方选项中选择一项以继续流程",submitting:"提交中…",submitFailed:"提交失败",close:"关闭",noOptions:"该节点未配置选项,请先在编辑器中为 output 槽位添加条目。"},vQ={title:"Print 输出: {{instanceId}}",expand:"放大",restore:"还原"},kQ={save:"保存",cancel:"取消"},SQ={title:"带参数运行",noParams:"此流程无输入参数",run:"运行",cancel:"取消"},NQ={title:"指定预设运行",noPresets:"无可用预设",default:"默认运行",run:"运行",cancel:"取消"},jQ={preset:"预设",default:"默认",newPreset:"新建预设",deletePreset:"删除预设",presetNamePlaceholder:"预设名称",inputParams:"输入参数",noProvideNodes:"此流程无 provide 节点",filePathPlaceholder:"文件路径…",stringValuePlaceholder:"值…",presetSaved:"预设已保存",presetDeleted:"预设已删除",savePreset:"保存当前预设",expandInput:"编辑内容"},CQ={title:HJ,nodes:WJ,edges:VJ,properties:UJ,node:KJ,nodeProps:qJ,actions:YJ,panel:GJ,palette:XJ,pipeline:JJ,status:QJ,roles:ZJ,phases:eQ,types:tQ,runContext:nQ,shortcuts:rQ,jumpPalette:sQ,emptyCanvas:iQ,sidebar:oQ,validation:aQ,composer:lQ,topbar:cQ,palette2:uQ,run:dQ,fileEdit:fQ,settings:pQ,schedule:hQ,history:mQ,nodePropsError:gQ,placeholder:yQ,time:xQ,userCheck:wQ,userAsk:bQ,toolPrint:vQ,provideEdit:kQ,runParams:SQ,runPreset:NQ,runConfig:jQ},EQ="设置",_Q={engine:"引擎设置",preferences:"全局首选项"},PQ={title:"工作区",currentPath:"当前工作区根目录",placeholder:"加载中…",copyPath:"复制路径",description:"流水线与节点清单将相对于此目录解析(由启动 UI 时传入)。"},AQ={title:"Cursor CLI",status:{cached:"已缓存",notCached:"未缓存"},modelPreviewLabel:"Cursor 模型名称列表",modelList:{cached:"模型清单已缓存",empty:"暂无模型列表",count:"{{count}} 条",fetchedAt:"更新 {{time}}",never:"尚未拉取",refresh:"刷新清单",fetching:"拉取中…"}},IQ={modelPreviewLabel:"OpenCode 模型名称列表",title:"OpenCode CLI",status:{ready:"就绪",notFound:"未找到"},provider:"方案 / Provider 标识",providerPlaceholder:"例如 bailian-coding-plan",saving:"正在保存并更新清单…",description:"对应 CLI opencode models <provider> 的参数;停止输入后会写入用户目录 config 并刷新 model-lists.json。"},TQ={title:"Claude Code CLI",status:{ready:"就绪",notFound:"未找到"},modelPreviewLabel:"Claude Code 模型名称列表",description:"内置模型列表(Claude Code CLI 无 models 子命令);刷新将探测 claude 二进制是否在 PATH 中。首次使用请先执行 claude /login。"},RQ={title:"环境变量",note:"当前登录用户私有,运行时优先于服务全局环境变量",noteAdmin:"可配置个人或全局环境变量;个人同名变量优先于全局",saving:"正在保存...",key:"键",value:"值",scope:"范围",personal:"个人",global:"全局",add:"添加",delete:"删除 {{key}}",invalidKey:"环境变量名必须以字母或下划线开头,且只能包含字母、数字和下划线。",newKey:"新环境变量键",newValue:"值(密钥请谨慎)"},LQ={title:"系统状态",normal:"服务正常",abnormal:"部分接口异常",cursorModels:"Cursor 模型",opencodeModels:"OpenCode 模型",claudeCodeModels:"Claude Code 模型"},OQ={title:"快捷入口",projects:"项目与流水线",flowEditor:"节点画布"},MQ={title:"语言",description:"选择界面显示语言",options:{zh:"中文",en:"English",ja:"日本語"}},$Q={title:"新手引导",description:"重新启动产品引导流程,了解 AgentFlow 的核心功能。",reset:"重置引导",resetSuccess:"已重置,下次访问将自动启动引导"},DQ={title:EQ,crumb:_Q,workspace:PQ,cursor:AQ,opencode:IQ,claudeCode:TQ,env:RQ,system:LQ,shortcuts:OQ,language:MQ,onboarding:$Q},FQ={thinking:"思考",result:"结果",reply:"回复",error:"错误"},zQ={input:"让 AI 协助编辑此节点…",waiting:"等待响应…",selectedEmpty:"在画布上选择节点,或在输入框用 @ 选择实例(Instances)或节点类型(Node)",textarea:"描述你的流程或让 AI 协助编辑(⌘/Ctrl+Enter 发送)"},BQ={send:"发送",stop:"停止",expand:"展开",collapse:"收起",clear:"清空"},HQ={conversation:"对话",conversationWithNumber:"对话 {{num}}",default:"默认"},WQ={endSession:"结束对话(将停止生成)",closeSession:"关闭对话",newSession:"新建对话",expandComposer:"展开对话与输出"},VQ={hint:"使用底部输入框进行 AI 对话,支持 @节点、选择模型等功能"},UQ={aiLabels:FQ,placeholders:zQ,actions:BQ,labels:HQ,tooltips:WQ,rightPanel:VQ},KQ="项目",qQ="全部",YQ="已归档",GQ="Nodes",XQ="我的 Nodes",JQ="我的流程",QQ="Skills",ZQ="活跃项目",eZ="已归档流水线",tZ="全局 Nodes",nZ="管理当前工作区已发布到本地 Marketplace 的节点,共 {{count}} 个。",rZ="管理当前工作区已发布到本地 Marketplace 的流程片段,共 {{count}} 个。",sZ="全局 Skills",iZ="创建新项目",oZ="新建流水线",aZ="搜索流水线…",lZ="搜索 nodes…",cZ="搜索流程片段…",uZ="搜索 skills…",dZ="刷新资源",fZ="加载流水线列表…",pZ="加载全局资源…",hZ="筛选结果:{{count}} 条(匹配标题、描述、路径与标签)",mZ="已归档的流水线仍可打开与编辑;文件位于各 pipelines 目录下的 _archived。",gZ="管理分布式节点架构与监控流水线。可将 flow.yaml 或 .zip 拖入本页导入分享流程。",yZ="查看当前可用的全局节点定义,共 {{count}} 个;包含内置、工作区与 marketplace 节点。",xZ="查看当前 Composer 可选择的 skills,共 {{count}} 个;包含 AgentFlow 内置与工作区 skills。",wZ="流程运行时的可执行积木",bZ="Nodes 决定画布上能拖什么、节点有哪些输入输出,以及运行时走 agent、control、provide 或 marketplace 哪类逻辑。",vZ="已发布的本地节点包",kZ="这里仅显示你发布到当前 Workspace Marketplace 的节点版本;可查看详情并删除未被 Flow 使用的版本。",SZ="已发布的流程片段",NZ="这里显示从 Pipeline 或 Workspace 画布发布的流程片段,可搜索、检查内容,并从画布的流程面板中加载复用。",jZ="Composer/Agent 的操作指南",CZ="Skills 告诉 AI 在特定任务里应遵守什么规则、如何修改 flow、如何复用项目约定。",EZ="暂无归档项目。",_Z="暂无未归档流水线;已归档项在 Archived 标签中查看。",PZ="暂无可用全局 nodes。",AZ="暂无已发布的 marketplace nodes。",IZ="暂无已发布的流程片段。可在画布中选中多个节点后发布。",TZ="暂无可用 skills。",RZ="暂无描述。",LZ="未找到与「{{query}}」匹配的 node。",OZ="未找到与「{{query}}」匹配的流程片段。",MZ="未找到与「{{query}}」匹配的 skill。",$Z="{{inputs}} in / {{outputs}} out",DZ="流程片段",FZ="{{nodes}} 节点 / {{edges}} 连线",zZ="Skill",BZ="Node 详情",HZ="流程片段详情",WZ="Skill 详情",VZ="类型",UZ="来源",KZ="包",qZ="版本",YZ="路径",GZ="可编辑",XZ="只读",JZ="可编辑",QZ="Schema",ZZ="输入",eee="输出",tee="Runtime",nee="节点内容",ree="Files",see="Usage",iee="暂无 runtime manifest。",oee="暂无节点正文或 README。",aee="暂无可预览文件。",lee="请选择文件查看内容。",cee="二进制文件暂不支持预览。",uee="文件较大,仅显示前 256KB。",dee="暂未发现使用此 node 的流水线。",fee="节点管理",pee="删除节点版本",hee="删除中…",mee="删除前会检查所有 Flow 引用;仍被安装或使用的版本不会被删除。",gee="确定删除 {{id}}@{{version}}?此操作不可撤销。",yee="已删除 {{id}}@{{version}}。",xee="仍有 {{count}} 个 Flow 使用它。",wee="流程片段管理",bee="删除流程片段",vee="删除中…",kee="删除后不会影响已经加载到画布里的节点,只会移除 Marketplace 中这个可复用片段。",See="确定删除 {{id}}@{{version}}?此操作不可撤销。",Nee="已删除 {{id}}@{{version}}。",jee="无槽位",Cee="作用",Eee="这个 node 是 pipeline 的执行单元。它的 schema 会影响画布连线、参数输入和运行时调度。",_ee="流程片段是固定化流程的一部分。加载时会复制这组节点、连线和布局到当前画布,不覆盖已有内容。",Pee="规模",Aee="流程预览",Iee="连线",Tee="片段 JSON",Ree="还有 {{count}} 条连线",Lee="暂无可预览节点。",Oee="这个 skill 会作为 Composer 的上下文注入给 AI,用于约束 AI 的判断、修改方式和输出口径。",Mee="SKILL.md 预览",$ee="暂无可预览内容。",Dee="请选择一个资源查看详情。",Fee="未能加载流水线列表。",zee="当前工作区暂无流水线。",Bee="在仓库根目录执行 {{code1}} 并确认工作区包含 {{code2}} 或用户目录下的流水线;亦可点击 New Pipeline 新建。",Hee="未找到与「{{query}}」匹配的流水线。可尝试其他关键词,或点击清除搜索。",Wee="最近打开或最近运行",Vee="暂无打开或运行记录",Uee="暂无与关键词匹配的最近记录",Kee="最近运行",qee="最近打开",Yee={builtin:"内置",workspace:"工作区",user:"用户"},Gee={flow:"Flow",global:"Global",marketplace:"Marketplace"},Xee={all:"全部",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},Jee={overview:"概览",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},Qee="打开以在节点画布中编辑此流水线。",Zee={eyebrow:"AgentFlow Hub",title:"浏览社区流程",desc:"发现并一键安装社区分享的现成流水线。",cta:"前往 Hub",cliHint:"或通过 CLI 安装:agentflow download <slug>"},ete={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:"关闭"},tte={title:"导入流水线",lead:"已选择文件「{{filename}}」。请确认流水线名称与保存位置;ZIP 将保留目录内脚本等文件。",nameLabel:"名称(必填)",namePlaceholder:"例如 my_shared_flow",nameHint:"须以英文字母开头,仅可使用字母、数字、下划线 _ 与连字符 -",locationLabel:"保存位置",userDir:"用户目录(~/agentflow/pipelines)",workspaceDir:"当前工作区(.workspace/agentflow/pipelines)",changeFile:"更换文件…",importFailed:"导入失败",importing:"导入中…",importAndOpen:"导入并打开",cancel:"取消",close:"关闭"},nte={title:"删除流水线",lead:"将永久删除磁盘上的流水线目录(含 flow.yaml、脚本等),无法撤销。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",deleteFailed:"删除失败",deleteTimeout:"删除请求超时,请重试(可先检查终端中的 UI 服务日志)",delete:"删除",deleting:"删除中…",confirmDelete:"确认删除",cancel:"取消",close:"关闭"},rte={title:"归档流水线",lead:"归档后流水线将移入「Archived」列表,仍可从该列表打开与编辑。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",archiveFailed:"归档失败",archive:"归档",archiving:"归档中…",confirmArchive:"确认归档",cancel:"取消",close:"关闭"},ste={title:KQ,all:qQ,archived:YQ,nodes:GQ,myNodes:XQ,myFlows:JQ,skills:QQ,activeProjects:ZQ,archivedPipelines:eZ,globalNodes:tZ,myNodesHint:nZ,myFlowsHint:rZ,globalSkills:sZ,createNew:iZ,newPipeline:oZ,searchPipelines:aZ,searchNodes:lZ,searchFlows:cZ,searchSkills:uZ,refreshResources:dZ,loadingPipelines:fZ,loadingResources:pZ,filterResult:hZ,archivedHint:mZ,activeHint:gZ,nodesHint:yZ,skillsHint:xZ,nodesPurposeTitle:wZ,nodesPurposeDesc:bZ,myNodesPurposeTitle:vZ,myNodesPurposeDesc:kZ,myFlowsPurposeTitle:SZ,myFlowsPurposeDesc:NZ,skillsPurposeTitle:jZ,skillsPurposeDesc:CZ,noArchived:EZ,noActive:_Z,noNodes:PZ,noMyNodes:AZ,noMyFlows:IZ,noSkills:TZ,noDescription:RZ,noNodeMatch:LZ,noFlowSnippetMatch:OZ,noSkillMatch:MZ,nodeSlots:$Z,flowSnippet:DZ,flowSnippetNodes:FZ,skill:zZ,nodeDetail:BZ,flowDetail:HZ,skillDetail:WZ,detailType:VZ,detailSource:UZ,detailPackage:KZ,detailVersion:qZ,detailPath:YZ,detailEditable:GZ,readOnly:XZ,editable:JZ,nodeSchema:QZ,nodeInputs:ZZ,nodeOutputs:eee,nodeRuntime:tee,nodeBody:nee,nodeFiles:ree,nodeUsage:see,noRuntimeManifest:iee,noNodeBody:oee,noNodeFiles:aee,selectNodeFile:lee,binaryFile:cee,fileTruncated:uee,noNodeUsage:dee,myNodeManagement:fee,deleteMyNode:pee,deletingMyNode:hee,deleteMyNodeHint:mee,deleteMyNodeConfirm:gee,deleteMyNodeSuccess:yee,deleteMyNodeUsedBy:xee,myFlowManagement:wee,deleteMyFlow:bee,deletingMyFlow:vee,deleteMyFlowHint:kee,deleteMyFlowConfirm:See,deleteMyFlowSuccess:Nee,noSlots:jee,resourceMeaning:Cee,nodesMeaning:Eee,myFlowsMeaning:_ee,flowSnippetScale:Pee,flowSnippetPreview:Aee,flowSnippetEdges:Iee,flowSnippetJson:Tee,flowSnippetMoreEdges:Ree,noFlowSnippetPreview:Lee,skillsMeaning:Oee,skillPreview:Mee,skillPreviewEmpty:$ee,selectResource:Dee,loadFailed:Fee,noPipelines:zee,emptyHint:Bee,noMatch:Hee,recentActivity:Wee,noRecentActivity:Vee,noMatchRecent:Uee,recentRun:Kee,recentOpen:qee,sourceBadge:Yee,resourceSource:Gee,resourceFilter:Xee,nodeDetailTabs:Jee,defaultCardDesc:Qee,hubCard:Zee,newPipelineModal:ete,importModal:tte,deleteModal:nte,archiveModal:rte},ite="返回",ote="下一步",ate="跳过",lte="完成",cte="开始创建",ute={intro:`欢迎使用 AgentFlow!这是一个可视化流程编排工具。
|
|
176
|
+
|
|
177
|
+
点击下方按钮开始创建你的第一个流水线。`,hubIntro:`不想从零开始?
|
|
178
|
+
|
|
179
|
+
在 AgentFlow Hub 浏览社区分享的现成流水线,一键安装即可运行。`},dte={intro:`现在进入流程编辑器。
|
|
180
|
+
|
|
181
|
+
在下方输入框用自然语言描述你的需求,AI 会自动生成流程图。
|
|
182
|
+
|
|
183
|
+
左侧节点面板可以自由拖拽、删除和调整连接。`,introEmpty:`画布为空,开始创建你的流程吧!
|
|
184
|
+
|
|
185
|
+
在下方输入框用自然语言描述需求,AI 会自动生成流程图。
|
|
186
|
+
|
|
187
|
+
左侧节点面板可以自由拖拽、删除和调整连接。`},fte={guideTitle:"首次创建提示",guideDesc:"输入名称和描述后,AI 会自动生成流程图。你可以在编辑器中自由调整节点和连接。",nameHintGuide:"例如:MyFirstFlow(字母开头,支持数字和下划线)",descPlaceholderGuide:"例如:实现用户登录功能,包含注册、验证、授权",descHintGuide:"描述越详细,AI 生成的流程越准确",createGuide:"创建并开始编辑",typeNode:"节点引用类型",typeStr:"字符串类型",typeFile:"文件路径类型",typeBool:"布尔值类型"},pte={back:ite,next:ote,skip:ate,done:lte,startCreate:cte,projects:ute,flow:dte,newPipeline:fte},hte={en:{common:aY,flow:KY,settings:sG,composer:dG,project:NJ,onboarding:RJ},zh:{common:BJ,flow:CQ,settings:DQ,composer:UQ,project:ste,onboarding:pte}};Ir.use(wT).use(IO).init({resources:hte,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 mte=[{code:"zh",name:"中文",flag:"🇨🇳"},{code:"en",name:"English",flag:"🇬🇧"}];function gte(e){return Ir.changeLanguage(e)}const Ww="agentflow-settings-opencode-plan-v1";function Yy(e){if(!e||typeof e!="object")return{cursor:[],opencode:[],claudeCode:[],cursorFetchedAt:null,opencodeFetchedAt:null,claudeCodeFetchedAt: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):[],cursorFetchedAt:t.cursorFetchedAt??null,opencodeFetchedAt:t.opencodeFetchedAt??null,claudeCodeFetchedAt:t.claudeCodeFetchedAt??null}}function bT(){return`e_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function yte(e){return/^[A-Za-z_][A-Za-z0-9_]*$/.test(String(e||"").trim())}function fl(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()||bT(),u=String(r.scope??t).trim()==="global"?"global":"user";!s&&!i||n.push({id:a,key:s,value:i,scope:u})}return n}function Gj(e){return fl(e).map(({key:t,value:n})=>({key:t,value:n}))}function Xj(){try{return localStorage.getItem(Ww)??""}catch{return""}}function xte(e){return e?e.length<=6?"•".repeat(e.length):`${"•".repeat(Math.min(20,e.length-4))}${e.slice(-4)}`:""}function Jj(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 wte({authUser:e}){const{t,i18n:n}=Sn(["common","settings"]),r=n.language||"zh",[s,i]=m.useState(""),[a,l]=m.useState(""),[u,d]=m.useState({cursor:[],opencode:[],claudeCode:[],cursorFetchedAt:null,opencodeFetchedAt:null,claudeCodeFetchedAt:null}),[f,c]=m.useState(""),[p,h]=m.useState(!1),[g,v]=m.useState(!1),[k,y]=m.useState(""),[b,w]=m.useState([]),[N,C]=m.useState(""),[j,R]=m.useState(!1),[D,M]=m.useState(""),[z,$]=m.useState(""),[A,F]=m.useState(!1),[T,O]=m.useState(()=>new Set),[I,B]=m.useState(""),[P,L]=m.useState([]),[_,G]=m.useState(!1),[Z,U]=m.useState(""),[se,ue]=m.useState([]),[de,me]=m.useState([]),[ae,Ne]=m.useState(""),[Pe,be]=m.useState(""),[Ie,_e]=m.useState(!1),[nt,st]=m.useState(!1),[Je,Ct]=m.useState(""),Be=m.useRef(null),mt=m.useRef(!1),Gt=m.useRef(!1),De=m.useRef(""),en=m.useCallback(async()=>{l("");try{const re=await fetch("/api/ui-context");if(!re.ok)throw new Error("HTTP "+re.status);const ke=await re.json();i(typeof ke.workspaceRoot=="string"?ke.workspaceRoot:"")}catch(re){l(String(re.message||re)),i("")}},[]),rn=m.useCallback(async()=>{c(""),h(!0);try{const re=await fetch("/api/model-lists");if(!re.ok)throw new Error("HTTP "+re.status);const ke=await re.json();d(Yy(ke))}catch(re){c(String(re.message||re))}finally{h(!1)}},[]),pn=m.useCallback(async()=>{C("");try{const re=await fetch("/api/user-env"),ke=await re.json().catch(()=>({}));if(!re.ok)throw new Error(typeof ke.error=="string"?ke.error:"HTTP "+re.status);const et=fl(Array.isArray(ke.env)?ke.env:[],"user").map(sn=>({...sn,scope:"user"})),Nn=[...e!=null&&e.isAdmin?fl(Array.isArray(ke.globalEnv)?ke.globalEnv:[],"global").map(sn=>({...sn,scope:"global"})):[],...et];De.current=JSON.stringify(Nn),w(Nn)}catch(re){w([]),C(String(re.message||re))}finally{Gt.current=!0}},[e==null?void 0:e.isAdmin]),Hn=m.useCallback(async()=>{if(e!=null&&e.isAdmin){G(!0),U("");try{const re=await fetch("/api/feedback"),ke=await re.json().catch(()=>({}));if(!re.ok)throw new Error(typeof ke.error=="string"?ke.error:"HTTP "+re.status);L(Array.isArray(ke.feedback)?ke.feedback:[])}catch(re){U(String(re.message||re))}finally{G(!1)}}},[e==null?void 0:e.isAdmin]),le=m.useCallback(async()=>{if(e!=null&&e.isAdmin){_e(!0),Ct("");try{const re=await fetch("/api/admin/user-allowlist"),ke=await re.json().catch(()=>({}));if(!re.ok)throw new Error(typeof ke.error=="string"?ke.error:"HTTP "+re.status);const et=ke.allowlist&&typeof ke.allowlist=="object"?ke.allowlist:{};ue(Array.isArray(et.fileUsers)?et.fileUsers.map(String):[]),me(Array.isArray(et.envUsers)?et.envUsers.map(String):[]),Ne(typeof et.path=="string"?et.path:"")}catch(re){Ct(String(re.message||re))}finally{_e(!1)}}},[e==null?void 0:e.isAdmin]),ve=m.useCallback(async re=>{if(e!=null&&e.isAdmin){st(!0),Ct("");try{const ke=await fetch("/api/admin/user-allowlist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({users:re})}),et=await ke.json().catch(()=>({}));if(!ke.ok)throw new Error(typeof et.error=="string"?et.error:"HTTP "+ke.status);const Mt=et.allowlist&&typeof et.allowlist=="object"?et.allowlist:{};ue(Array.isArray(Mt.fileUsers)?Mt.fileUsers.map(String):[]),me(Array.isArray(Mt.envUsers)?Mt.envUsers.map(String):[]),Ne(typeof Mt.path=="string"?Mt.path:"")}catch(ke){Ct(String(ke.message||ke))}finally{st(!1)}}},[e==null?void 0:e.isAdmin]),qe=m.useCallback(async re=>{const ke=fl(re),et=ke.filter(Nn=>Nn.scope!=="global"),Mt=ke.filter(Nn=>Nn.scope==="global");R(!0),C("");try{const Nn=await fetch("/api/user-env",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:Gj(et),...e!=null&&e.isAdmin?{globalEnv:Gj(Mt)}:{}})}),sn=await Nn.json().catch(()=>({}));if(!Nn.ok)throw new Error(typeof sn.error=="string"?sn.error:"HTTP "+Nn.status);const Gr=fl(Array.isArray(sn.env)?sn.env:[],"user").map(vr=>({...vr,scope:"user"})),bs=[...e!=null&&e.isAdmin?fl(Array.isArray(sn.globalEnv)?sn.globalEnv:[],"global").map(vr=>({...vr,scope:"global"})):[],...Gr];De.current=JSON.stringify(bs),w(bs)}catch(Nn){C(String(Nn.message||Nn))}finally{R(!1)}},[e==null?void 0:e.isAdmin]),ge=m.useCallback(async()=>{c(""),h(!0);try{const re=await fetch("/api/update-model-lists",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:I.trim()})}),ke=await re.json().catch(()=>({}));if(!re.ok)throw new Error(typeof ke.error=="string"?ke.error:"HTTP "+re.status);d(Yy(ke.modelLists))}catch(re){c(String(re.message||re))}finally{h(!1)}},[I]);m.useEffect(()=>{en(),rn(),pn(),e!=null&&e.isAdmin&&(Hn(),le()),(async()=>{try{const re=await fetch("/api/agentflow-config");if(re.ok){const ke=await re.json(),et=typeof ke.opencodeProvider=="string"?ke.opencodeProvider:"";B(et),Be.current=et;try{localStorage.setItem(Ww,et)}catch{}}else{const ke=Xj();B(ke),Be.current=ke}}catch{const re=Xj();B(re),Be.current=re}finally{mt.current=!0}})()},[e==null?void 0:e.isAdmin,en,Hn,rn,le,pn]),m.useEffect(()=>{if(!Gt.current||JSON.stringify(fl(b))===De.current)return;const ke=setTimeout(()=>{qe(b)},350);return()=>clearTimeout(ke)},[b,qe]),m.useEffect(()=>{if(!mt.current)return;const re=I.trim();if(re===Be.current)return;const ke=setTimeout(()=>{(async()=>{v(!0),y("");try{const et=await fetch("/api/agentflow-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:re})}),Mt=await et.json().catch(()=>({}));if(!et.ok)throw new Error(typeof Mt.error=="string"?Mt.error:"HTTP "+et.status);Be.current=re;try{localStorage.setItem(Ww,re)}catch{}Mt.modelLists&&d(Yy(Mt.modelLists))}catch(et){y(String(et.message||et))}finally{v(!1)}})()},450);return()=>clearTimeout(ke)},[I]);const lt=u.cursor.length>0,Bt=u.opencode.length>0,hn=u.claudeCode.length>0,In=m.useCallback(()=>{var re;s&&((re=navigator.clipboard)==null||re.writeText(s))},[s]),mn=m.useCallback(()=>{const re=D.trim(),ke=z;if(re){if(!yte(re)){C(t("settings:env.invalidKey"));return}w(et=>[...et,{id:bT(),key:re,value:ke,scope:e!=null&&e.isAdmin&&A?"global":"user"}]),M(""),$("")}},[e==null?void 0:e.isAdmin,A,D,z,t]),cr=m.useCallback(re=>{w(ke=>ke.filter(et=>et.id!==re))},[]),Xt=m.useCallback((re,ke)=>{w(et=>et.map(Mt=>Mt.id===re?{...Mt,...ke}:Mt))},[]),Wn=m.useCallback(re=>{O(ke=>{const et=new Set(ke);return et.has(re)?et.delete(re):et.add(re),et})},[]),Tn=m.useCallback(()=>{const re=Pe.trim();if(!re)return;if(!/^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(re)){Ct("用户名须以字母开头,仅可使用字母、数字、下划线与连字符,最多 64 字符");return}if(new Set(se.map(et=>String(et||"").trim().toLowerCase())).has(re.toLowerCase())){be("");return}be(""),ve([...se,re])},[Pe,se,ve]),br=m.useCallback(re=>{const ke=String(re||"").trim().toLowerCase();ke&&ve(se.filter(et=>String(et||"").trim().toLowerCase()!==ke))},[se,ve]),xe=m.useCallback(re=>{const ke=re.target.value;gte(ke)},[]),Me=re=>{const ke=Jj(re,r);return ke?t("settings:cursor.modelList.fetchedAt",{time:ke}):t("settings:cursor.modelList.never")},Qe=re=>Jj(re,r)||String(re||"");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,f?o.jsx("p",{className:"af-err af-settings-api-hint",children:f}):null,N?o.jsx("p",{className:"af-err af-settings-api-hint",children:N}):null]}),o.jsxs("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:In,"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:t("settings:workspace.description")})]}),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"+(lt?" af-set-badge--ok":" af-set-badge--muted"),children:t(lt?"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:lt?"check_circle":"hourglass_empty"})}),o.jsxs("div",{children:[o.jsx("p",{className:"af-set-cli-title",children:t(lt?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),o.jsx("p",{className:"af-set-cli-mono",children:lt?t("settings:cursor.modelList.count",{count:u.cursor.length})+" · "+Me(u.cursorFetchedAt):t("settings:cursor.modelList.refresh")})]})]}),lt?o.jsx("pre",{className:"af-set-model-preview","aria-label":t("settings:cursor.modelPreviewLabel"),children:u.cursor.join(`
|
|
188
|
+
`)}):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>ge(),disabled:p,children:t(p?"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:"OpenCode"}),o.jsx("span",{className:"af-set-badge"+(Bt?" af-set-badge--ok":" af-set-badge--err"),children:t(Bt?"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:I,onChange:re=>B(re.target.value),placeholder:t("settings:opencode.providerPlaceholder"),autoComplete:"off"}),g?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]}),Bt?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:u.opencode.length})+" · "+Me(u.opencodeFetchedAt)}),o.jsx("pre",{className:"af-set-model-preview","aria-label":t("settings:opencode.modelPreviewLabel"),children:u.opencode.join(`
|
|
189
|
+
`)})]}):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>ge(),disabled:p,children:t(p?"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"+(hn?" af-set-badge--ok":" af-set-badge--err"),children:t(hn?"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:hn?"check_circle":"hourglass_empty"})}),o.jsxs("div",{children:[o.jsx("p",{className:"af-set-cli-title",children:t(hn?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),o.jsx("p",{className:"af-set-cli-mono",children:hn?t("settings:cursor.modelList.count",{count:u.claudeCode.length})+" · "+Me(u.claudeCodeFetchedAt):t("settings:cursor.modelList.refresh")})]})]}),o.jsx("p",{className:"af-set-p",children:t("settings:claudeCode.description")}),hn?o.jsx("pre",{className:"af-set-model-preview","aria-label":t("settings:claudeCode.modelPreviewLabel"),children:u.claudeCode.join(`
|
|
190
|
+
`)}):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>ge(),disabled:p,children:t(p?"settings:cursor.modelList.fetching":"settings:cursor.modelList.refresh")})]}),o.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--low af-set-env",children:[o.jsxs("div",{className:"af-set-env-head",children:[o.jsxs("div",{className:"af-set-card-head",children:[o.jsx("div",{className:"af-set-env-icon-wrap",children:o.jsx("span",{className:"material-symbols-outlined af-set-icon--primary",children:"variables"})}),o.jsx("h2",{className:"af-set-h2",children:t("settings:env.title")})]}),o.jsx("span",{className:"af-set-env-note",children: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",{})]}),b.map(re=>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:re.key,onChange:ke=>Xt(re.id,{key:ke.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:re.scope!=="global"?"is-active":"",onClick:()=>Xt(re.id,{scope:"user"}),children:t("settings:env.personal")}),o.jsx("button",{type:"button",className:re.scope==="global"?"is-active":"",onClick:()=>Xt(re.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(re.id)?"text":"password",value:re.value,onChange:ke=>Xt(re.id,{value:ke.target.value}),placeholder:xte(re.value)||t("settings:env.newValue"),"aria-label":t("settings:env.value")}),o.jsx("button",{type:"button",className:"af-set-env-value-toggle",onClick:()=>Wn(re.id),"aria-label":T.has(re.id)?"Hide value":"Show value",children:o.jsx("span",{className:"material-symbols-outlined",children:T.has(re.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:re.key}),onClick:()=>cr(re.id),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})})]},re.id)),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:D,onChange:re=>M(re.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:A?"":"is-active",onClick:()=>F(!1),children:t("settings:env.personal")}),o.jsx("button",{type:"button",className:A?"is-active":"",onClick:()=>F(!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:z,onChange:re=>$(re.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:mn,disabled:!D.trim(),children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),t("settings:env.add")]})})]})]})]}),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:"用户白名单"}),o.jsx("p",{className:"af-set-card-subtitle",children:"只控制 username 是否允许注册或登录,密码由用户首次登录时自行设置。"})]})]}),o.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:()=>void le(),disabled:Ie,children:Ie?"刷新中...":"刷新"})]}),Je?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:Je}):null,ae?o.jsxs("p",{className:"af-set-hint af-set-hint--inline",children:["文件:",o.jsx("code",{children:ae})]}):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:"文件白名单"}),o.jsx("span",{children:nt?"保存中...":`${se.length} 个用户`})]}),o.jsx("div",{className:"af-allowlist-list",children:se.length>0?se.map(re=>o.jsxs("div",{className:"af-allowlist-row",children:[o.jsx("span",{className:"af-allowlist-name",children:re}),o.jsx("button",{type:"button",className:"af-set-env-del",onClick:()=>br(re),"aria-label":`删除 ${re}`,disabled:nt,children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})]},re)):o.jsx("div",{className:"af-allowlist-empty",children:"未配置文件白名单;如果环境变量也为空,则所有用户可注册。"})}),o.jsxs("div",{className:"af-allowlist-add",children:[o.jsx("input",{className:"af-set-input af-set-input--sm af-set-input--mono",value:Pe,onChange:re=>be(re.target.value),onKeyDown:re=>{re.key==="Enter"&&Tn()},placeholder:"username",autoComplete:"off"}),o.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:Tn,disabled:nt||!Pe.trim(),children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),"添加"]})]})]}),o.jsxs("div",{className:"af-allowlist-side",children:[o.jsxs("div",{className:"af-allowlist-head",children:[o.jsx("span",{children:"环境变量白名单"}),o.jsx("span",{children:"只读"})]}),o.jsx("div",{className:"af-allowlist-env-list",children:de.length>0?de.map(re=>o.jsx("code",{children:re},re)):o.jsx("span",{children:"未配置 AGENTFLOW_USER_WHITELIST / AGENTFLOW_ALLOWED_USERS"})})]})]})]}):null,e!=null&&e.isAdmin?o.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--feedback",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:"rate_review"})}),o.jsx("h2",{className:"af-set-h2",children:"意见反馈"})]}),o.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:()=>void Hn(),disabled:_,children:_?"刷新中...":"刷新"})]}),Z?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:Z}):null,o.jsx("div",{className:"af-feedback-list",children:P.length>0?P.map(re=>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:re.title||"未命名反馈"}),o.jsxs("p",{children:[o.jsx("span",{children:re.username||re.userId||"unknown"}),o.jsx("span",{children:Qe(re.createdAt)})]})]}),re.contact?o.jsx("span",{className:"af-feedback-item__contact",children:re.contact}):null]}),o.jsx("p",{className:"af-feedback-item__content",children:re.content}),re.pageUrl?o.jsx("code",{className:"af-feedback-item__url",children:re.pageUrl}):null]},re.id)):o.jsx("div",{className:"af-feedback-empty",children:_?"正在加载反馈...":"暂无反馈"})})]}):null]}),o.jsxs("aside",{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&&!f?"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:u.cursor.length})]}),o.jsx("div",{className:"af-set-meter-bar",children:o.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,u.cursor.length>0?12+u.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:u.opencode.length})]}),o.jsx("div",{className:"af-set-meter-bar",children:o.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,u.opencode.length>0?12+u.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:u.claudeCode.length})]}),o.jsx("div",{className:"af-set-meter-bar",children:o.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,u.claudeCode.length>0?12+u.claudeCode.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:xe,"aria-label":t("settings:language.description"),children:mte.map(re=>o.jsxs("option",{value:re.code,children:[re.flag," ",re.name]},re.code))}),o.jsx("p",{className:"af-set-hint",children:t("settings:language.description")})]})]})]})]})]})})]})}function bte(){const{navigate:e}=Ba(),[t,n]=m.useState(""),[r,s]=m.useState(""),[i,a]=m.useState(!1),[l,u]=m.useState(""),[d,f]=m.useState(!1),c=async p=>{if(p.preventDefault(),!i){a(!0),u("");try{const h=await fetch("/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:t,content:r,pageUrl:window.location.href})}),g=await h.json().catch(()=>({}));if(!h.ok)throw new Error(g.error||"提交失败");f(!0),n(""),s("")}catch(h){u(String(h.message||h))}finally{a(!1)}}};return 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:()=>e("/projects"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_back"}),"返回"]})]}),d?o.jsxs("div",{className:"af-feedback-success",role:"status",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"check_circle"}),o.jsxs("div",{children:[o.jsx("strong",{children:"已提交"}),o.jsx("span",{children:"感谢反馈,管理员可以在设置页查看这条记录。"})]})]}):null,o.jsxs("form",{className:"af-feedback-form",onSubmit:c,children:[o.jsxs("label",{className:"af-feedback-field",children:[o.jsx("span",{children:"标题"}),o.jsx("input",{value:t,onChange:p=>n(p.target.value),placeholder:"一句话说明问题或建议",maxLength:120,required:!0})]}),o.jsxs("label",{className:"af-feedback-field",children:[o.jsx("span",{children:"反馈内容"}),o.jsx("textarea",{value:r,onChange:p=>s(p.target.value),placeholder:"描述具体场景、期望表现、实际表现或复现步骤",maxLength:5e3,rows:9,required:!0})]}),l?o.jsx("p",{className:"af-err af-feedback-error",children:l}):null,o.jsx("div",{className:"af-feedback-actions",children:o.jsxs("button",{type:"submit",className:"af-feedback-submit",disabled:i||!t.trim()||!r.trim(),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:i?"hourglass_empty":"send"}),i?"提交中...":"提交反馈"]})})]})]})})}function vT(){return`m_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function Qj(e,t=[]){const n=new Set((Array.isArray(t)?t:[]).map(String));return Object.entries(e&&typeof e=="object"?e:{}).map(([r,s])=>({id:vT(),key:r,value:String(s??""),private:n.has(r)}))}function Zj(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 yh(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(`
|
|
191
|
+
`),description:String((e==null?void 0:e.description)||t.description||""),envRows:Qj(t.env||(e==null?void 0:e.env),e==null?void 0:e.privateEnvKeys),headerRows:Qj(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 Gy(){return yh({name:"",raw:{command:""}})}function vte(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=Zj(e.envRows),s=Zj(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 e1(e){return e?e.ok?`${e.toolCount||0} tools enabled`:`Error - ${e.error||"Show Output"}`:"未检测"}function t1(e){return e?e.ok?"ok":"error":"unknown"}function n1({title:e,rows:t,onChange:n,placeholderKey:r="KEY",placeholderValue:s="value"}){const i=(a,l,u)=>n(t.map(d=>d.id===a?{...d,[l]:u}:d));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:vT(),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 kte(){var A;const[e,t]=m.useState(""),[n,r]=m.useState([]),[s,i]=m.useState(Gy),[a,l]=m.useState(""),[u,d]=m.useState(!1),[f,c]=m.useState(!1),[p,h]=m.useState(!1),[g,v]=m.useState({}),[k,y]=m.useState(""),[b,w]=m.useState(""),N=m.useMemo(()=>n.find(F=>F.name===a)||null,[a,n]),C=N&&g[N.name]||null,j=m.useCallback(async()=>{d(!0),y("");try{const F=await fetch("/api/mcps"),T=await F.json().catch(()=>({}));if(!F.ok)throw new Error(T.error||"MCP HTTP "+F.status);const O=Array.isArray(T.servers)?T.servers:[];t(String(T.path||"")),r(O),a&&O.some(I=>I.name===a)&&i(yh(O.find(I=>I.name===a)))}catch(F){y(String(F.message||F))}finally{d(!1)}},[a]);m.useEffect(()=>{j()},[j]);const R=()=>{l(""),i(Gy()),w(""),y("")},D=F=>{l(F.name),i(yh(F)),w(""),y("")},M=async(F="")=>{h(!0),y(""),w("");try{const T=await fetch("/api/mcps/check",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(F?{name:F}:{})}),O=await T.json().catch(()=>({}));if(!T.ok)throw new Error(O.error||"检测 MCP 失败");const I=Array.isArray(O.results)?O.results:[];v(B=>{const P={...B};for(const L of I)L!=null&&L.name&&(P[L.name]=L);return P}),w(F?`已检测 ${F}。`:"已检测所有 MCP。")}catch(T){y(String(T.message||T))}finally{h(!1)}},z=async()=>{c(!0),y(""),w("");try{const F=vte(s);if(!F.nextName)throw new Error("请填写 MCP 名称");const T=await fetch("/api/mcps",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(F)}),O=await T.json().catch(()=>({}));if(!T.ok)throw new Error(O.error||"保存 MCP 失败");const I=Array.isArray(O.servers)?O.servers:[];r(I),t(String(O.path||e)),l(F.nextName),i(yh(I.find(B=>B.name===F.nextName)||null)),v(B=>{const P={...B};return s.originalName&&s.originalName!==F.nextName&&delete P[s.originalName],delete P[F.nextName],P}),w("已保存。Cursor CLI 下次启动时会读取新配置。")}catch(F){y(String(F.message||F))}finally{c(!1)}},$=async F=>{if(F!=null&&F.name&&window.confirm(`删除 MCP "${F.name}"?`)){c(!0),y(""),w("");try{const T=await fetch("/api/mcps/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:F.name})}),O=await T.json().catch(()=>({}));if(!T.ok)throw new Error(O.error||"删除 MCP 失败");r(Array.isArray(O.servers)?O.servers:[]),l(""),i(Gy()),v(I=>{const B={...I};return delete B[F.name],B}),w("已删除。")}catch(T){y(String(T.message||T))}finally{c(!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:u||f,children:"刷新"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>M(),disabled:p||u||f||n.length===0,children:p?"检测中...":"检测状态"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:R,disabled:f,children:"新增 MCP"})]})]}),o.jsx("div",{className:"af-settings-body",children:o.jsxs("div",{className:"af-settings-inner",children:[o.jsxs("section",{className:"af-settings-hero",children:[o.jsx("h1",{className:"af-settings-h1",children:"MCP 管理"}),o.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:R,disabled:f,children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),"新增"]})]})]}),u?o.jsx("p",{className:"af-set-p",children:"加载中..."}):null,n.length===0&&!u?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:R,disabled:f,children:"新增 MCP Server"})]}):null,o.jsx("div",{className:"af-mcp-server-list",children:n.map(F=>o.jsxs("button",{type:"button",className:"af-mcp-server-item"+(a===F.name?" af-mcp-server-item--active":""),onClick:()=>D(F),children:[o.jsx("span",{className:"material-symbols-outlined",children:F.type==="url"?"cloud":"terminal"}),o.jsxs("span",{children:[o.jsxs("span",{className:"af-mcp-server-title",children:[o.jsx("strong",{children:F.name}),o.jsx("small",{className:`af-mcp-server-health af-mcp-server-health--${t1(g[F.name])}`,children:e1(g[F.name])})]}),o.jsx("em",{children:F.url||[F.command,...F.args||[]].filter(Boolean).join(" ")})]})]},F.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:()=>M(N.name),disabled:p||f,children:p?"检测中...":"检测"}),o.jsx("button",{type:"button",className:"af-set-btn-mini af-set-btn-mini--danger",onClick:()=>$(N),disabled:f,children:"删除"})]}):null]}),k?o.jsx("p",{className:"af-mcp-error",children:k}):null,b?o.jsx("p",{className:"af-mcp-status",children:b}):null,C?o.jsxs("div",{className:`af-mcp-check af-mcp-check--${t1(C)}`,children:[o.jsxs("div",{className:"af-mcp-check-head",children:[o.jsx("strong",{children:e1(C)}),o.jsxs("span",{children:[C.elapsedMs||0,"ms"]})]}),C.error?o.jsx("p",{children:C.error}):null,(A=C.tools)!=null&&A.length?o.jsx("div",{className:"af-mcp-tools-list",children:C.tools.map(F=>o.jsxs("div",{className:"af-mcp-tool-row",children:[o.jsx("strong",{children:F.name}),F.description?o.jsx("span",{children:F.description}):null]},F.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:F=>i(T=>({...T,name:F.target.value})),placeholder:"github"})]}),o.jsxs("label",{className:"af-set-label",children:["类型",o.jsxs("select",{className:"af-set-input",value:s.type,onChange:F=>i(T=>({...T,type:F.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:F=>i(T=>({...T,url:F.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:F=>i(T=>({...T,command:F.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:F=>i(T=>({...T,argsText:F.target.value})),placeholder:`mcp-server-example
|
|
192
|
+
--flag`})]})]}),o.jsxs("label",{className:"af-set-label af-mcp-field--wide",children:["描述",o.jsx("input",{className:"af-set-input",value:s.description,onChange:F=>i(T=>({...T,description:F.target.value})),placeholder:"这个 MCP 提供什么能力"})]}),o.jsx(n1,{title:"Headers",rows:s.headerRows,onChange:F=>i(T=>({...T,headerRows:F})),placeholderKey:"Authorization",placeholderValue:"Bearer ..."}),o.jsx(n1,{title:"Env",rows:s.envRows,onChange:F=>i(T=>({...T,envRows:F})),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:F=>i(T=>({...T,extraJson:F.target.value}))})]})]}),o.jsxs("div",{className:"af-mcp-actions",children:[o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:R,disabled:f,children:"清空"}),o.jsx("button",{type:"button",className:"af-set-footer-primary",onClick:z,disabled:f,children:f?"保存中...":"保存 MCP"})]})]})]})]})})]})}function kT(e){return t=>typeof t===e}var Ste=kT("function"),Nte=e=>e===null,r1=e=>Object.prototype.toString.call(e).slice(8,-1)==="RegExp",s1=e=>!jte(e)&&!Nte(e)&&(Ste(e)||typeof e=="object"),jte=kT("undefined");function Cte(e,t,n){return Rte(n,e,t)?!0:(Lte(n,e,t),e.constructor!==t.constructor?!1:Array.isArray(e)&&Array.isArray(t)?Ete(e,t,n):e instanceof Map&&t instanceof Map?Ate(e,t,n):e instanceof Set&&t instanceof Set?Tte(e,t):e instanceof WeakMap||e instanceof WeakSet?!1:ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)?_te(e,t):r1(e)&&r1(t)?e.source===t.source&&e.flags===t.flags:e instanceof Error&&t instanceof Error?Pte(e,t,n):e.valueOf!==Object.prototype.valueOf?e.valueOf()===t.valueOf():e.toString!==Object.prototype.toString?e.toString()===t.toString():Ite(e,t,n))}function Of(e,t,n){return e===t||Number.isNaN(e)&&Number.isNaN(t)?!0:!e||!s1(e)||!t||!s1(t)?!1:Cte(e,t,n)}function Ete(e,t,n){const{length:r}=e;if(r!==t.length)return!1;for(let s=r;s--!==0;)if(!Of(e[s],t[s],n))return!1;return!0}function _te(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 Pte(e,t,n){return e.message===t.message&&e.name===t.name&&Of(e.cause,t.cause,n)}function Ate(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(!Of(r[1],t.get(r[0]),n))return!1;return!0}function Ite(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)&&!Of(e[i],t[i],n))return!1}return!0}function Tte(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 Rte(e,t,n){var r;return((r=e.get(t))==null?void 0:r.has(n))??!1}function Lte(e,t,n){let r=e.get(t);r||(r=new WeakSet,e.set(t,r)),r.add(n)}function Ov(e,t){return Of(e,t,new WeakMap)}function Xy(){var e;return!!(typeof window<"u"&&((e=window==null?void 0:window.document)!=null&&e.createElement))}function Ote(e,...t){e&&e.removeEventListener&&e.removeEventListener(...t)}function Mte(e,...t){e&&e.addEventListener&&e.addEventListener(...t)}function $te(){const e=m.useRef(!0);return e.current?(e.current=!1,!0):e.current}function Dte(e,t){const n=$te();m.useEffect(()=>{if(!n)return e()},t)}function ST(e){const t=m.useRef(void 0);return m.useEffect(()=>{t.current=e}),t.current}function Fte(e,t){const n=m.useRef(t);return Ov(t,n.current)||(n.current=t),m.useMemo(e,n.current)}function zte(e){m.useEffect(()=>{e()},[])}function Bte(e=0){const[t,n]=m.useState({height:Xy()?window.innerHeight:0,width:Xy()?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(!Xy())return()=>{};const i=s.current;return n({height:window.innerHeight,width:window.innerWidth}),Mte(window,"resize",i),()=>{Ote(window,"resize",i)}},[]),t}var Hte=["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 Mf(e){const t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(Vte(t))return t}function Pi(e){return t=>Mf(t)===e}function Vte(e){return Hte.includes(e)}function mu(e){return t=>typeof t===e}function Ute(e){return Wte.includes(e)}var Kte=["innerHTML","ownerDocument","style","attributes","nodeValue"],$f=e=>Array.isArray(e),qte=e=>Mf(e)==="AsyncGeneratorFunction",Yte=Pi("AsyncFunction"),Gte=mu("bigint"),Xte=e=>e===!0||e===!1,Jte=Pi("Date"),Qte=Pi("Error"),Oa=mu("function"),Zte=Pi("GeneratorFunction"),ene=e=>typeof e=="number"&&Number.isInteger(e),Vw=Pi("Map"),NT=e=>Number.isNaN(e),Mv=e=>e===null,jT=Pi("Function"),tne=Pi("Promise"),nne=Pi("RegExp"),Uw=Pi("Set"),Df=mu("string"),rne=mu("symbol"),$v=mu("undefined"),sne=Pi("WeakMap"),ine=Pi("WeakSet"),Dv=e=>Mv(e)||$v(e),CT=e=>!$v(e),one=e=>mu("number")(e)&&!NT(e),ane=e=>Df(e)&&e.trim().length>0,lne=e=>{if(!Df(e)||e.length===0)return!1;const t=e.trim();return t.length>0&&Number.isFinite(Number(t))},cg=e=>!Dv(e)&&(Oa(e)||typeof e=="object"),ET=e=>{if(Mf(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})},cne=e=>Mv(e)||Ute(typeof e),une=e=>Mf(e)==="URL",_T=e=>!Dv(e)&&Oa(e[Symbol.iterator]),dne=e=>_T(e)&&Oa(e.next)&&Oa(e.throw),fne=e=>Oa(e)&&/^class\s/.test(e.toString()),pne=(e,t)=>!$f(e)||!Oa(t)?!1:e.every(n=>t(n)),hne=e=>cg(e)&&!ET(e)&&e.nodeType===1&&Df(e.nodeName)&&Kte.every(t=>t in e),mne=e=>Df(e)&&e.length===0||$f(e)&&e.length===0||cg(e)&&!Vw(e)&&!Uw(e)&&Object.keys(e).length===0||Uw(e)&&e.size===0||Vw(e)&&e.size===0,gne=(e,t)=>!e||!t?!1:Object.getPrototypeOf(e)===t.prototype,yne=(e,t)=>$f(e)?e.indexOf(t)>-1:!1,xne=(e,t,n)=>{if(!cg(e)||!t)return!1;const r=e[t];return Oa(n)?n(r):CT(r)};function _t(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($f(e))return"Array";if(jT(e))return"Function";const t=Mf(e);return t||"Object"}_t.array=$f;_t.arrayOf=pne;_t.asyncGeneratorFunction=qte;_t.asyncFunction=Yte;_t.bigint=Gte;_t.boolean=Xte;_t.class=fne;_t.date=Jte;_t.defined=CT;_t.domElement=hne;_t.empty=mne;_t.error=Qte;_t.function=Oa;_t.generator=dne;_t.generatorFunction=Zte;_t.instanceOf=gne;_t.integer=ene;_t.iterable=_T;_t.map=Vw;_t.nan=NT;_t.null=Mv;_t.nullOrUndefined=Dv;_t.nonEmptyString=ane;_t.number=one;_t.numericString=lne;_t.object=cg;_t.oneOf=yne;_t.plainFunction=jT;_t.plainObject=ET;_t.primitive=cne;_t.promise=tne;_t.propertyOf=xne;_t.regexp=nne;_t.set=Uw;_t.string=Df;_t.symbol=rne;_t.undefined=$v;_t.url=une;_t.weakMap=sne;_t.weakSet=ine;var $r=_t;/* v8 ignore next -- @preserve */var wne=function(e){return Object.prototype.hasOwnProperty.call(e,"props")},bne=function(e,t){return e+mf(t)},mf=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(bne,""):wne(e)&&Object.prototype.hasOwnProperty.call(e.props,"children")?mf(e.props.children):""};mf.default=mf;var vne=mf;const Jy=$a(vne);var PT={exports:{}};(function(e){const t=Object.getPrototypeOf({});function n(){return function(i){return typeof i=="object"&&i!==null&&!(i instanceof RegExp)&&!(i instanceof Date)}}function r(s){function i(C){return C!=="constructor"&&C!=="prototype"&&C!=="__proto__"}function a(C){let j=0;const R=C.length,D=new Array(R);for(j;j<R;++j)D[j]=y(C[j]);return D}function l(C){const j={};if(p&&Object.getPrototypeOf(C)!==t)return p(C);const R=c(C);let D,M,z;for(D=0,M=R.length;D<M;++D)i(z=R[D])&&(j[z]=y(C[z]));return j}function u(C,j){const R=C.length,D=j.length;let M=0;const z=new Array(R+D);for(M;M<R;++M)z[M]=y(C[M]);for(M=0;M<D;++M)z[M+R]=y(j[M]);return z}const d=Object.prototype.propertyIsEnumerable;function f(C){const j=Object.keys(C),R=Object.getOwnPropertySymbols(C);for(let D=0,M=R.length;D<M;++D)d.call(C,R[D])&&j.push(R[D]);return j}const c=s!=null&&s.symbols?f:Object.keys,p=typeof(s==null?void 0:s.cloneProtoObject)=="function"?s.cloneProtoObject:void 0,h=typeof(s==null?void 0:s.isMergeableObject)=="function"?s.isMergeableObject:n(),g=(s==null?void 0:s.onlyDefinedProperties)===!0;function v(C){return typeof C!="object"||C===null}const k=s&&typeof s.mergeArray=="function"?s.mergeArray({clone:y,deepmerge:w,getKeys:c,isMergeableObject:h}):u;function y(C){return h(C)?Array.isArray(C)?a(C):l(C):C}function b(C,j){const R={},D=c(C),M=c(j);let z,$,A;for(z=0,$=D.length;z<$;++z)i(A=D[z])&&M.indexOf(A)===-1&&(R[A]=y(C[A]));for(z=0,$=M.length;z<$;++z)if(i(A=M[z]))if(A in C)D.indexOf(A)!==-1&&(p&&h(j[A])&&Object.getPrototypeOf(j[A])!==t?R[A]=p(j[A]):R[A]=w(C[A],j[A]));else{if(g&&typeof j[A]>"u")continue;R[A]=y(j[A])}return R}function w(C,j){if(g&&typeof j>"u")return y(C);const R=Array.isArray(j),D=Array.isArray(C);return v(j)?j:h(C)?R&&D?k(C,j):R!==D?y(j):b(C,j):y(j)}function N(){switch(arguments.length){case 0:return{};case 1:return y(arguments[0]);case 2:return w(arguments[0],arguments[1])}let C;for(let j=0,R=arguments.length;j<R;++j)C=w(C,arguments[j]);return C}return s!=null&&s.all?N:w}e.exports=r,e.exports.default=r,e.exports.deepmerge=r,Object.defineProperty(e.exports,"isMergeableObject",{get:n})})(PT);var kne=PT.exports;const Sne=$a(kne);var Nne=new Error("Element already at target scroll position"),jne=new Error("Scroll cancelled"),Cne=Math.min,i1=Date.now,Ene={left:o1("scrollLeft"),top:o1("scrollTop")};function o1(e){return function(n,r,s,i){s=s||{},typeof s=="function"&&(i=s,s={}),typeof i!="function"&&(i=Pne);var a=i1(),l=n[e],u=s.ease||_ne,d=isNaN(s.duration)?350:+s.duration,f=!1;return l===r?i(Nne,n[e]):requestAnimationFrame(p),c;function c(){f=!0}function p(h){if(f)return i(jne,n[e]);var g=i1(),v=Cne(1,(g-a)/d),k=u(v);n[e]=k*(r-l)+l,v<1?requestAnimationFrame(p):requestAnimationFrame(function(){i(null,n[e])})}}}function _ne(e){return .5*(1-Math.cos(Math.PI*e))}function Pne(){}const Ane=$a(Ene);var AT={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.Scrollparent=n()})(Id,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})})(AT);var Ine=AT.exports;const IT=$a(Ine),Tne=["top","right","bottom","left"],a1=["start","end"],l1=Tne.reduce((e,t)=>e.concat(t,t+"-"+a1[0],t+"-"+a1[1]),[]),lu=Math.min,Nl=Math.max,vm=Math.round,Kp=Math.floor,lo=e=>({x:e,y:e}),Rne={left:"right",right:"left",bottom:"top",top:"bottom"};function Kw(e,t,n){return Nl(e,lu(t,n))}function gu(e,t){return typeof e=="function"?e(t):e}function Fo(e){return e.split("-")[0]}function co(e){return e.split("-")[1]}function TT(e){return e==="x"?"y":"x"}function Fv(e){return e==="y"?"height":"width"}function ya(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function zv(e){return TT(ya(e))}function RT(e,t,n){n===void 0&&(n=!1);const r=co(e),s=zv(e),i=Fv(s);let a=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=Sm(a)),[a,Sm(a)]}function Lne(e){const t=Sm(e);return[km(e),t,km(t)]}function km(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const c1=["left","right"],u1=["right","left"],One=["top","bottom"],Mne=["bottom","top"];function $ne(e,t,n){switch(e){case"top":case"bottom":return n?t?u1:c1:t?c1:u1;case"left":case"right":return t?One:Mne;default:return[]}}function Dne(e,t,n,r){const s=co(e);let i=$ne(Fo(e),n==="start",r);return s&&(i=i.map(a=>a+"-"+s),t&&(i=i.concat(i.map(km)))),i}function Sm(e){const t=Fo(e);return Rne[t]+e.slice(t.length)}function Fne(e){return{top:0,right:0,bottom:0,left:0,...e}}function LT(e){return typeof e!="number"?Fne(e):{top:e,right:e,bottom:e,left:e}}function Nm(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 d1(e,t,n){let{reference:r,floating:s}=e;const i=ya(t),a=zv(t),l=Fv(a),u=Fo(t),d=i==="y",f=r.x+r.width/2-s.width/2,c=r.y+r.height/2-s.height/2,p=r[l]/2-s[l]/2;let h;switch(u){case"top":h={x:f,y:r.y-s.height};break;case"bottom":h={x:f,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:c};break;case"left":h={x:r.x-s.width,y:c};break;default:h={x:r.x,y:r.y}}switch(co(t)){case"start":h[a]-=p*(n&&d?-1:1);break;case"end":h[a]+=p*(n&&d?-1:1);break}return h}async function zne(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:i,rects:a,elements:l,strategy:u}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:c="floating",altBoundary:p=!1,padding:h=0}=gu(t,e),g=LT(h),k=l[p?c==="floating"?"reference":"floating":c],y=Nm(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:d,rootBoundary:f,strategy:u})),b=c==="floating"?{x:r,y:s,width:a.floating.width,height:a.floating.height}:a.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),N=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},C=Nm(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:b,offsetParent:w,strategy:u}):b);return{top:(y.top-C.top+g.top)/N.y,bottom:(C.bottom-y.bottom+g.bottom)/N.y,left:(y.left-C.left+g.left)/N.x,right:(C.right-y.right+g.right)/N.x}}const Bne=50,Hne=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:zne},u=await(a.isRTL==null?void 0:a.isRTL(t));let d=await a.getElementRects({reference:e,floating:t,strategy:s}),{x:f,y:c}=d1(d,r,u),p=r,h=0;const g={};for(let v=0;v<i.length;v++){const k=i[v];if(!k)continue;const{name:y,fn:b}=k,{x:w,y:N,data:C,reset:j}=await b({x:f,y:c,initialPlacement:r,placement:p,strategy:s,middlewareData:g,rects:d,platform:l,elements:{reference:e,floating:t}});f=w??f,c=N??c,g[y]={...g[y],...C},j&&h<Bne&&(h++,typeof j=="object"&&(j.placement&&(p=j.placement),j.rects&&(d=j.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:s}):j.rects),{x:f,y:c}=d1(d,p,u)),v=-1)}return{x:f,y:c,placement:p,strategy:s,middlewareData:g}},Wne=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:i,platform:a,elements:l,middlewareData:u}=t,{element:d,padding:f=0}=gu(e,t)||{};if(d==null)return{};const c=LT(f),p={x:n,y:r},h=zv(s),g=Fv(h),v=await a.getDimensions(d),k=h==="y",y=k?"top":"left",b=k?"bottom":"right",w=k?"clientHeight":"clientWidth",N=i.reference[g]+i.reference[h]-p[h]-i.floating[g],C=p[h]-i.reference[h],j=await(a.getOffsetParent==null?void 0:a.getOffsetParent(d));let R=j?j[w]:0;(!R||!await(a.isElement==null?void 0:a.isElement(j)))&&(R=l.floating[w]||i.floating[g]);const D=N/2-C/2,M=R/2-v[g]/2-1,z=lu(c[y],M),$=lu(c[b],M),A=z,F=R-v[g]-$,T=R/2-v[g]/2+D,O=Kw(A,T,F),I=!u.arrow&&co(s)!=null&&T!==O&&i.reference[g]/2-(T<A?z:$)-v[g]/2<0,B=I?T<A?T-A:T-F:0;return{[h]:p[h]+B,data:{[h]:O,centerOffset:T-O-B,...I&&{alignmentOffset:B}},reset:I}}});function Vne(e,t,n){return(e?[...n.filter(s=>co(s)===e),...n.filter(s=>co(s)!==e)]:n.filter(s=>Fo(s)===s)).filter(s=>e?co(s)===e||(t?km(s)!==s:!1):!0)}const Une=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:u,elements:d}=t,{crossAxis:f=!1,alignment:c,allowedPlacements:p=l1,autoAlignment:h=!0,...g}=gu(e,t),v=c!==void 0||p===l1?Vne(c||null,h,p):p,k=await u.detectOverflow(t,g),y=((n=a.autoPlacement)==null?void 0:n.index)||0,b=v[y];if(b==null)return{};const w=RT(b,i,await(u.isRTL==null?void 0:u.isRTL(d.floating)));if(l!==b)return{reset:{placement:v[0]}};const N=[k[Fo(b)],k[w[0]],k[w[1]]],C=[...((r=a.autoPlacement)==null?void 0:r.overflows)||[],{placement:b,overflows:N}],j=v[y+1];if(j)return{data:{index:y+1,overflows:C},reset:{placement:j}};const R=C.map(z=>{const $=co(z.placement);return[z.placement,$&&f?z.overflows.slice(0,2).reduce((A,F)=>A+F,0):z.overflows[0],z.overflows]}).sort((z,$)=>z[1]-$[1]),M=((s=R.filter(z=>z[2].slice(0,co(z[0])?2:3).every($=>$<=0))[0])==null?void 0:s[0])||R[0][0];return M!==l?{data:{index:y+1,overflows:C},reset:{placement:M}}:{}}}},Kne=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:u,elements:d}=t,{mainAxis:f=!0,crossAxis:c=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:v=!0,...k}=gu(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const y=Fo(s),b=ya(l),w=Fo(l)===l,N=await(u.isRTL==null?void 0:u.isRTL(d.floating)),C=p||(w||!v?[Sm(l)]:Lne(l)),j=g!=="none";!p&&j&&C.push(...Dne(l,v,g,N));const R=[l,...C],D=await u.detectOverflow(t,k),M=[];let z=((r=i.flip)==null?void 0:r.overflows)||[];if(f&&M.push(D[y]),c){const T=RT(s,a,N);M.push(D[T[0]],D[T[1]])}if(z=[...z,{placement:s,overflows:M}],!M.every(T=>T<=0)){var $,A;const T=((($=i.flip)==null?void 0:$.index)||0)+1,O=R[T];if(O&&(!(c==="alignment"?b!==ya(O):!1)||z.every(P=>ya(P.placement)===b?P.overflows[0]>0:!0)))return{data:{index:T,overflows:z},reset:{placement:O}};let I=(A=z.filter(B=>B.overflows[0]<=0).sort((B,P)=>B.overflows[1]-P.overflows[1])[0])==null?void 0:A.placement;if(!I)switch(h){case"bestFit":{var F;const B=(F=z.filter(P=>{if(j){const L=ya(P.placement);return L===b||L==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(L=>L>0).reduce((L,_)=>L+_,0)]).sort((P,L)=>P[1]-L[1])[0])==null?void 0:F[0];B&&(I=B);break}case"initialPlacement":I=l;break}if(s!==I)return{reset:{placement:I}}}return{}}}},qne=new Set(["left","top"]);async function Yne(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),a=Fo(n),l=co(n),u=ya(n)==="y",d=qne.has(a)?-1:1,f=i&&u?-1:1,c=gu(t,e);let{mainAxis:p,crossAxis:h,alignmentAxis:g}=typeof c=="number"?{mainAxis:c,crossAxis:0,alignmentAxis:null}:{mainAxis:c.mainAxis||0,crossAxis:c.crossAxis||0,alignmentAxis:c.alignmentAxis};return l&&typeof g=="number"&&(h=l==="end"?g*-1:g),u?{x:h*f,y:p*d}:{x:p*d,y:h*f}}const Gne=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,u=await Yne(t,e);return a===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:s+u.x,y:i+u.y,data:{...u,placement:a}}}}},Xne=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:u={fn:y=>{let{x:b,y:w}=y;return{x:b,y:w}}},...d}=gu(e,t),f={x:n,y:r},c=await i.detectOverflow(t,d),p=ya(Fo(s)),h=TT(p);let g=f[h],v=f[p];if(a){const y=h==="y"?"top":"left",b=h==="y"?"bottom":"right",w=g+c[y],N=g-c[b];g=Kw(w,g,N)}if(l){const y=p==="y"?"top":"left",b=p==="y"?"bottom":"right",w=v+c[y],N=v-c[b];v=Kw(w,v,N)}const k=u.fn({...t,[h]:g,[p]:v});return{...k,data:{x:k.x-n,y:k.y-r,enabled:{[h]:a,[p]:l}}}}}};function ug(){return typeof window<"u"}function yu(e){return OT(e)?(e.nodeName||"").toLowerCase():"#document"}function Ls(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ho(e){var t;return(t=(OT(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function OT(e){return ug()?e instanceof Node||e instanceof Ls(e).Node:!1}function Ci(e){return ug()?e instanceof Element||e instanceof Ls(e).Element:!1}function Ho(e){return ug()?e instanceof HTMLElement||e instanceof Ls(e).HTMLElement:!1}function f1(e){return!ug()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ls(e).ShadowRoot}function Ff(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=Ei(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function Jne(e){return/^(table|td|th)$/.test(yu(e))}function dg(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Qne=/transform|translate|scale|rotate|perspective|filter/,Zne=/paint|layout|strict|content/,ll=e=>!!e&&e!=="none";let Qy;function Bv(e){const t=Ci(e)?Ei(e):e;return ll(t.transform)||ll(t.translate)||ll(t.scale)||ll(t.rotate)||ll(t.perspective)||!Hv()&&(ll(t.backdropFilter)||ll(t.filter))||Qne.test(t.willChange||"")||Zne.test(t.contain||"")}function ere(e){let t=Ma(e);for(;Ho(t)&&!cu(t);){if(Bv(t))return t;if(dg(t))return null;t=Ma(t)}return null}function Hv(){return Qy==null&&(Qy=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Qy}function cu(e){return/^(html|body|#document)$/.test(yu(e))}function Ei(e){return Ls(e).getComputedStyle(e)}function fg(e){return Ci(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ma(e){if(yu(e)==="html")return e;const t=e.assignedSlot||e.parentNode||f1(e)&&e.host||ho(e);return f1(t)?t.host:t}function MT(e){const t=Ma(e);return cu(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ho(t)&&Ff(t)?t:MT(t)}function gf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=MT(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),a=Ls(s);if(i){const l=qw(a);return t.concat(a,a.visualViewport||[],Ff(s)?s:[],l&&n?gf(l):[])}else return t.concat(s,gf(s,[],n))}function qw(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function $T(e){const t=Ei(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=Ho(e),i=s?e.offsetWidth:n,a=s?e.offsetHeight:r,l=vm(n)!==i||vm(r)!==a;return l&&(n=i,r=a),{width:n,height:r,$:l}}function Wv(e){return Ci(e)?e:e.contextElement}function Hc(e){const t=Wv(e);if(!Ho(t))return lo(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=$T(t);let a=(i?vm(n.width):n.width)/r,l=(i?vm(n.height):n.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const tre=lo(0);function DT(e){const t=Ls(e);return!Hv()||!t.visualViewport?tre:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function nre(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ls(e)?!1:t}function Ol(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=Wv(e);let a=lo(1);t&&(r?Ci(r)&&(a=Hc(r)):a=Hc(e));const l=nre(i,n,r)?DT(i):lo(0);let u=(s.left+l.x)/a.x,d=(s.top+l.y)/a.y,f=s.width/a.x,c=s.height/a.y;if(i){const p=Ls(i),h=r&&Ci(r)?Ls(r):r;let g=p,v=qw(g);for(;v&&r&&h!==g;){const k=Hc(v),y=v.getBoundingClientRect(),b=Ei(v),w=y.left+(v.clientLeft+parseFloat(b.paddingLeft))*k.x,N=y.top+(v.clientTop+parseFloat(b.paddingTop))*k.y;u*=k.x,d*=k.y,f*=k.x,c*=k.y,u+=w,d+=N,g=Ls(v),v=qw(g)}}return Nm({width:f,height:c,x:u,y:d})}function pg(e,t){const n=fg(e).scrollLeft;return t?t.left+n:Ol(ho(e)).left+n}function FT(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-pg(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function rre(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",a=ho(r),l=t?dg(t.floating):!1;if(r===a||l&&i)return n;let u={scrollLeft:0,scrollTop:0},d=lo(1);const f=lo(0),c=Ho(r);if((c||!c&&!i)&&((yu(r)!=="body"||Ff(a))&&(u=fg(r)),c)){const h=Ol(r);d=Hc(r),f.x=h.x+r.clientLeft,f.y=h.y+r.clientTop}const p=a&&!c&&!i?FT(a,u):lo(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-u.scrollLeft*d.x+f.x+p.x,y:n.y*d.y-u.scrollTop*d.y+f.y+p.y}}function sre(e){return Array.from(e.getClientRects())}function ire(e){const t=ho(e),n=fg(e),r=e.ownerDocument.body,s=Nl(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Nl(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+pg(e);const l=-n.scrollTop;return Ei(r).direction==="rtl"&&(a+=Nl(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:a,y:l}}const p1=25;function ore(e,t){const n=Ls(e),r=ho(e),s=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,u=0;if(s){i=s.width,a=s.height;const f=Hv();(!f||f&&t==="fixed")&&(l=s.offsetLeft,u=s.offsetTop)}const d=pg(r);if(d<=0){const f=r.ownerDocument,c=f.body,p=getComputedStyle(c),h=f.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,g=Math.abs(r.clientWidth-c.clientWidth-h);g<=p1&&(i-=g)}else d<=p1&&(i+=d);return{width:i,height:a,x:l,y:u}}function are(e,t){const n=Ol(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=Ho(e)?Hc(e):lo(1),a=e.clientWidth*i.x,l=e.clientHeight*i.y,u=s*i.x,d=r*i.y;return{width:a,height:l,x:u,y:d}}function h1(e,t,n){let r;if(t==="viewport")r=ore(e,n);else if(t==="document")r=ire(ho(e));else if(Ci(t))r=are(t,n);else{const s=DT(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Nm(r)}function zT(e,t){const n=Ma(e);return n===t||!Ci(n)||cu(n)?!1:Ei(n).position==="fixed"||zT(n,t)}function lre(e,t){const n=t.get(e);if(n)return n;let r=gf(e,[],!1).filter(l=>Ci(l)&&yu(l)!=="body"),s=null;const i=Ei(e).position==="fixed";let a=i?Ma(e):e;for(;Ci(a)&&!cu(a);){const l=Ei(a),u=Bv(a);!u&&l.position==="fixed"&&(s=null),(i?!u&&!s:!u&&l.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||Ff(a)&&!u&&zT(e,a))?r=r.filter(f=>f!==a):s=l,a=Ma(a)}return t.set(e,r),r}function cre(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const a=[...n==="clippingAncestors"?dg(t)?[]:lre(t,this._c):[].concat(n),r],l=h1(t,a[0],s);let u=l.top,d=l.right,f=l.bottom,c=l.left;for(let p=1;p<a.length;p++){const h=h1(t,a[p],s);u=Nl(h.top,u),d=lu(h.right,d),f=lu(h.bottom,f),c=Nl(h.left,c)}return{width:d-c,height:f-u,x:c,y:u}}function ure(e){const{width:t,height:n}=$T(e);return{width:t,height:n}}function dre(e,t,n){const r=Ho(t),s=ho(t),i=n==="fixed",a=Ol(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const u=lo(0);function d(){u.x=pg(s)}if(r||!r&&!i)if((yu(t)!=="body"||Ff(s))&&(l=fg(t)),r){const h=Ol(t,!0,i,t);u.x=h.x+t.clientLeft,u.y=h.y+t.clientTop}else s&&d();i&&!r&&s&&d();const f=s&&!r&&!i?FT(s,l):lo(0),c=a.left+l.scrollLeft-u.x-f.x,p=a.top+l.scrollTop-u.y-f.y;return{x:c,y:p,width:a.width,height:a.height}}function Zy(e){return Ei(e).position==="static"}function m1(e,t){if(!Ho(e)||Ei(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ho(e)===n&&(n=n.ownerDocument.body),n}function BT(e,t){const n=Ls(e);if(dg(e))return n;if(!Ho(e)){let s=Ma(e);for(;s&&!cu(s);){if(Ci(s)&&!Zy(s))return s;s=Ma(s)}return n}let r=m1(e,t);for(;r&&Jne(r)&&Zy(r);)r=m1(r,t);return r&&cu(r)&&Zy(r)&&!Bv(r)?n:r||ere(e)||n}const fre=async function(e){const t=this.getOffsetParent||BT,n=this.getDimensions,r=await n(e.floating);return{reference:dre(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function pre(e){return Ei(e).direction==="rtl"}const hre={convertOffsetParentRelativeRectToViewportRelativeRect:rre,getDocumentElement:ho,getClippingRect:cre,getOffsetParent:BT,getElementRects:fre,getClientRects:sre,getDimensions:ure,getScale:Hc,isElement:Ci,isRTL:pre};function HT(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function mre(e,t){let n=null,r;const s=ho(e);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function a(l,u){l===void 0&&(l=!1),u===void 0&&(u=1),i();const d=e.getBoundingClientRect(),{left:f,top:c,width:p,height:h}=d;if(l||t(),!p||!h)return;const g=Kp(c),v=Kp(s.clientWidth-(f+p)),k=Kp(s.clientHeight-(c+h)),y=Kp(f),w={rootMargin:-g+"px "+-v+"px "+-k+"px "+-y+"px",threshold:Nl(0,lu(1,u))||1};let N=!0;function C(j){const R=j[0].intersectionRatio;if(R!==u){if(!N)return a();R?a(!1,R):r=setTimeout(()=>{a(!1,1e-7)},1e3)}R===1&&!HT(d,e.getBoundingClientRect())&&a(),N=!1}try{n=new IntersectionObserver(C,{...w,root:s.ownerDocument})}catch{n=new IntersectionObserver(C,w)}n.observe(e)}return a(!0),i}function g1(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:u=!1}=r,d=Wv(e),f=s||i?[...d?gf(d):[],...t?gf(t):[]]:[];f.forEach(y=>{s&&y.addEventListener("scroll",n,{passive:!0}),i&&y.addEventListener("resize",n)});const c=d&&l?mre(d,n):null;let p=-1,h=null;a&&(h=new ResizeObserver(y=>{let[b]=y;b&&b.target===d&&h&&t&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var w;(w=h)==null||w.observe(t)})),n()}),d&&!u&&h.observe(d),t&&h.observe(t));let g,v=u?Ol(e):null;u&&k();function k(){const y=Ol(e);v&&!HT(v,y)&&n(),v=y,g=requestAnimationFrame(k)}return n(),()=>{var y;f.forEach(b=>{s&&b.removeEventListener("scroll",n),i&&b.removeEventListener("resize",n)}),c==null||c(),(y=h)==null||y.disconnect(),h=null,u&&cancelAnimationFrame(g)}}const gre=Gne,yre=Une,xre=Xne,wre=Kne,y1=Wne,bre=(e,t,n)=>{const r=new Map,s={platform:hre,...n},i={...s.platform,_c:r};return Hne(e,t,{...s,platform:i})};var vre=typeof document<"u",kre=function(){},xh=vre?m.useLayoutEffect:kre;function jm(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(!jm(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)&&!jm(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function WT(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function x1(e,t){const n=WT(e);return Math.round(t*n)/n}function ex(e){const t=m.useRef(e);return xh(()=>{t.current=e}),t}function w1(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:u,open:d}=e,[f,c]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=m.useState(r);jm(p,r)||h(r);const[g,v]=m.useState(null),[k,y]=m.useState(null),b=m.useCallback(P=>{P!==j.current&&(j.current=P,v(P))},[]),w=m.useCallback(P=>{P!==R.current&&(R.current=P,y(P))},[]),N=i||g,C=a||k,j=m.useRef(null),R=m.useRef(null),D=m.useRef(f),M=u!=null,z=ex(u),$=ex(s),A=ex(d),F=m.useCallback(()=>{if(!j.current||!R.current)return;const P={placement:t,strategy:n,middleware:p};$.current&&(P.platform=$.current),bre(j.current,R.current,P).then(L=>{const _={...L,isPositioned:A.current!==!1};T.current&&!jm(D.current,_)&&(D.current=_,os.flushSync(()=>{c(_)}))})},[p,t,n,$,A]);xh(()=>{d===!1&&D.current.isPositioned&&(D.current.isPositioned=!1,c(P=>({...P,isPositioned:!1})))},[d]);const T=m.useRef(!1);xh(()=>(T.current=!0,()=>{T.current=!1}),[]),xh(()=>{if(N&&(j.current=N),C&&(R.current=C),N&&C){if(z.current)return z.current(N,C,F);F()}},[N,C,F,z,M]);const O=m.useMemo(()=>({reference:j,floating:R,setReference:b,setFloating:w}),[b,w]),I=m.useMemo(()=>({reference:N,floating:C}),[N,C]),B=m.useMemo(()=>{const P={position:n,left:0,top:0};if(!I.floating)return P;const L=x1(I.floating,f.x),_=x1(I.floating,f.y);return l?{...P,transform:"translate("+L+"px, "+_+"px)",...WT(I.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:L,top:_}},[n,l,I.floating,f.x,f.y]);return m.useMemo(()=>({...f,update:F,refs:O,elements:I,floatingStyles:B}),[f,F,O,I,B])}const Sre=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?y1({element:r.current,padding:s}).fn(n):{}:r?y1({element:r,padding:s}).fn(n):{}}}},b1=(e,t)=>{const n=gre(e);return{name:n.name,fn:n.fn,options:[e,t]}},Nre=(e,t)=>{const n=xre(e);return{name:n.name,fn:n.fn,options:[e,t]}},jre=(e,t)=>{const n=wre(e);return{name:n.name,fn:n.fn,options:[e,t]}},Cre=(e,t)=>{const n=yre(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ere=(e,t)=>{const n=Sre(e);return{name:n.name,fn:n.fn,options:[e,t]}},_re={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},Pre={beaconOptions:{offset:-18}},VT={back:"Back",close:"Close",last:"Last",next:"Next",nextWithProgress:"Next ({current} of {total})",open:"Open the dialog",skip:"Skip"},Are={isFixed:!1,locale:VT,placement:"bottom"},Ire={continuous:!1,debug:!1,run:!1,scrollToFirstStep:!1,steps:[]},Rt={INIT:"init",START:"start",STOP:"stop",RESET:"reset",PREV:"prev",NEXT:"next",GO:"go",CLOSE:"close",SKIP:"skip",UPDATE:"update",COMPLETE:"complete"},gr={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"},He={INIT:"init",READY:"ready",BEACON_BEFORE:"beacon_before",BEACON:"beacon",TOOLTIP_BEFORE:"tooltip_before",TOOLTIP:"tooltip",COMPLETE:"complete"},Zi={BUTTON_BACK:"button_back",BUTTON_CLOSE:"button_close",BUTTON_PRIMARY:"button_primary",BUTTON_SKIP:"button_skip",KEYBOARD:"keyboard",OVERLAY:"overlay"},At={IDLE:"idle",READY:"ready",WAITING:"waiting",RUNNING:"running",PAUSED:"paused",SKIPPED:"skipped",FINISHED:"finished"},Tre="react-joyride-portal";function Rre(e){const t={};for(const n in e)e[n]!==void 0&&(t[n]=e[n]);return t}function Ic(...e){return Sne({all:!0,isMergeableObject:t=>!(!$r.plainObject(t)||m.isValidElement(t))})(...e)}function UT(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function Co(e,t={}){const{defaultValue:n,step:r,steps:s}=t;let i=Jy(e);if(i)(i.includes("{current}")||i.includes("{total}"))&&r&&s&&(i=i.replace("{current}",r.toString()).replace("{total}",s.toString()));else if(m.isValidElement(e)&&!Object.values(e.props).length&&UT(e.type)==="function")try{i=Co(e.type({}),t)}catch{i=Jy(n)}else i=Jy(n);return i}function xr(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 Lre(e,t){const n=Rre(t);return{...e,...n}}function yf(){}function Ore(e){return Object.keys(e)}function Cm(e,...t){if(!$r.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 v1(e,...t){if(!$r.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 Yw(e,t,n){const r=i=>i.replace("{current}",String(t)).replace("{total}",String(n));if(UT(e)==="string")return r(e);if(!m.isValidElement(e))return e;const{children:s}=e.props;if($r.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):Yw(i,t,n))});if($r.function(e.type)&&!Object.values(e.props).length)try{return Yw(e.type({}),t,n)}catch{return e}return e}function k1(e){return Ore(e).sort().reduce((t,n)=>(t[n]=e[n],t),{})}function Vv(){var e;return!!(typeof window<"u"&&((e=window.document)!=null&&e.createElement))}function S1(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 Uv(e){return e?e.getBoundingClientRect():null}function Mre(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 Js(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 $re(e,t,n){const r=Uv(e),s=xu(e),i=s?!s.isSameNode(fs()):!1,a=n??wu(e);let l=0,u=(r==null?void 0:r.top)??0;return i&&a?u=(r==null?void 0:r.top)??0:s instanceof HTMLElement&&(l=s.scrollTop,!i&&!a&&(u+=l),s.isSameNode(fs())||(u+=fs().scrollTop)),Math.floor(u-t)}function xu(e,t){if(!e)return fs();const n=IT(e);if(n){if(n.isSameNode(fs()))return t?document:fs();if(!(n.scrollHeight>n.offsetHeight))return fs()}return n}function Dre(e){const t=e.getBoundingClientRect(),n=fs(),r=t.top+t.height/2,s=window.innerHeight/2;return Math.max(0,n.scrollTop+r-s)}function Fre(e,t){if(!e)return 0;const n=IT(e)??fs(),r=parseFloat(getComputedStyle(e).scrollMarginTop)||0,s=Uv(n),i=n.scrollTop??0,{offsetTop:a=0,scrollTop:l=0}=n;let u=e.getBoundingClientRect().top+l;if(a&&(KT(e)||zre(e))){const f=e.getBoundingClientRect(),c=f.top-((s==null?void 0:s.top)??0),p=c+f.height,h=n.clientHeight,g=h*.2;c>=g&&p<=h-g?u=i:u=c+i}const d=Math.floor(u-t-r);return d<0?0:d}function zre(e){return e.offsetParent!==document.body}function KT(e){if(!e)return!1;const t=xu(e);return t?!t.isSameNode(fs()):!1}function wu(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?wu(e.parentNode,t):!1}function qp(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 N1(e){const{isFirstStep:t,scrollToFirstStep:n,step:r,target:s,targetLifecycle:i}=e;if(r.skipScroll||t&&!n&&i!==He.TOOLTIP||r.placement==="center")return!1;const a=s!=null&&s.isConnected?xu(s):fs(),l=a?!a.isSameNode(fs()):!1;return(r.isFixed||wu(s))&&!l?!1:a.scrollHeight>a.clientHeight}function fs(){return document.scrollingElement??document.documentElement}function j1(e,t){const{duration:n,element:r}=t;let s=()=>{};const i=new Promise(a=>{const{scrollTop:l}=r,u=e>l?e-l:l-e;s=Ane.top(r,e,{duration:u<100?50:n},()=>{a()})});return{cancel:s,promise:i}}function Bre(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 qT={backgroundColor:"transparent",border:0,borderRadius:0,color:"#555555",cursor:"pointer",fontSize:16,lineHeight:1,padding:0,WebkitAppearance:"none"},Yp={...qT,borderRadius:4,padding:8};function Hre(e,t){const{styles:n}=e,r=Ic(n??{},t.styles??{});let{width:s}=t;Vv()&&(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 Ic({arrow:{alignItems:"center",color:t.arrowColor,display:"inline-flex",justifyContent:"center",position:"absolute"},beaconWrapper:{...qT,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(${Bre(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:{...Yp,color:t.primaryColor,marginLeft:"auto",marginRight:5},buttonClose:{...Yp,color:t.textColor,height:12,padding:8,position:"absolute",right:0,top:0,width:12},buttonPrimary:{...Yp,backgroundColor:t.primaryColor,color:t.backgroundColor},buttonSkip:{...Yp,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 Kv(e,t){if(!t)return null;const n=Ic(Are,v1(e,"arrowComponent","beaconComponent","floatingOptions","loaderComponent","locale","styles","tooltipComponent"),t),r=Ic(_re,e.options??{},v1(t,...Wre)),s=Hre(e,{...n,...r}),i=Ic(Pre,e.floatingOptions??{},n.floatingOptions??{});return{...n,...r,locale:Ic(VT,e.locale??{},n.locale||{}),floatingOptions:i,spotlightPadding:Vre(r.spotlightPadding),styles:s}}function Vre(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 Ure(e,t,n){const{action:r}=t,s=n&&[Rt.PREV,Rt.NEXT].includes(r);return e.skipBeacon||e.placement==="center"||s}function YT(e,t=!1){return $r.plainObject(e)?e.target?!0:(xr(t,"tour","target is missing from the step"),!1):(xr(t,"tour","step must be an object"),!1)}function GT(e,t=!1){return $r.array(e)?e.every(n=>YT(n,t)):(xr(t,"tour","steps must be an array"),!1)}var Kre=class{constructor(e){Yn(this,"beaconPosition",null);Yn(this,"debug");Yn(this,"eventListeners",new Map);Yn(this,"listeners",new Set);Yn(this,"props");Yn(this,"snapshot");Yn(this,"state");Yn(this,"steps");Yn(this,"tooltipPosition",null);Yn(this,"cleanupPositionData",()=>{this.beaconPosition=null,this.tooltipPosition=null});Yn(this,"getPositionData",e=>e==="beacon"?this.beaconPosition:this.tooltipPosition);Yn(this,"getServerSnapshot",()=>this.snapshot);Yn(this,"getSnapshot",()=>this.snapshot);Yn(this,"getEventState",()=>Cm(this.snapshot,"positioned"));Yn(this,"getState",()=>Cm(this.snapshot,"positioned"));Yn(this,"setPositionData",(e,t)=>{var r,s,i;((r=e==="beacon"?this.beaconPosition:this.tooltipPosition)==null?void 0:r.placement)!==t.placement&&xr(this.debug,`step:${this.state.index}`,"positioned",`${e} ${t.placement}`),e==="beacon"?this.beaconPosition=t:this.tooltipPosition=t,(this.state.lifecycle===He.BEACON_BEFORE||this.state.lifecycle===He.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)});Yn(this,"setSteps",e=>{this.steps=e,this.updateState({size:e.length})});Yn(this,"dispatch",(e,t)=>{const n=this.eventListeners.get(e.type);if(n)for(const r of n)try{r(e,t)}catch{}});Yn(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)}});Yn(this,"subscribe",e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}));Yn(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,!Ov(s,l)){this.snapshot=Object.freeze({...l});for(const u of this.listeners)u(this.snapshot)}});const{initialStepIndex:t,stepIndex:n,steps:r=[]}=e??{},s=$r.number(n);let i=0;this.debug=(e==null?void 0:e.debug)??!1,s?(i=n,$r.number(t)&&xr(this.debug,"tour","initialStepIndex is ignored in controlled mode")):$r.number(t)&&(t>=0&&t<r.length?i=t:r.length>0&&xr(this.debug,"tour","initialStepIndex is out of bounds")),this.props=e??{steps:[]},this.steps=r,this.state={action:Rt.INIT,controlled:s,index:i,lifecycle:He.INIT,origin:null,positioned:!1,scrolling:!1,size:r.length,status:r.length?At.READY:At.IDLE,waiting:!1},this.snapshot=Object.freeze({...this.state})}applyTransitions(e){return e.status===At.WAITING&&e.size>0?{...e,status:At.RUNNING}:e}getStep(e){return Kv(this.props,this.steps[e??this.state.index])}};function qre(e){return new Kre(e)}function C1(e,t){return Math.min(Math.max(e,0),t)}function Yre(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:y,status:b}=i();b===At.RUNNING&&e.current.updateState({action:Rt.CLOSE,index:y+1,origin:k,lifecycle:He.COMPLETE,positioned:!1,scrolling:!1,waiting:!1})},go:k=>{const{controlled:y,size:b,status:w}=i();if(y){xr(r.current,"tour","go() is not supported in controlled mode");return}w===At.RUNNING&&e.current.updateState({action:Rt.GO,index:k,lifecycle:He.COMPLETE,positioned:!1,scrolling:!1,status:k<b?w:At.FINISHED,waiting:!1})},info:()=>Cm(e.current.getSnapshot(),"positioned"),next:k=>{const{index:y,size:b,status:w}=i();w===At.RUNNING&&e.current.updateState({action:Rt.NEXT,index:C1(y+1,b),lifecycle:He.COMPLETE,origin:k,positioned:!1,scrolling:!1,waiting:!1})},open:()=>{const{status:k}=i();k===At.RUNNING&&e.current.updateState({action:Rt.UPDATE,lifecycle:He.TOOLTIP_BEFORE,positioned:!1,scrolling:!1,waiting:!1})},prev:k=>{const{index:y,size:b,status:w}=i();w===At.RUNNING&&e.current.updateState({action:Rt.PREV,index:C1(y-1,b),lifecycle:He.COMPLETE,origin:k,positioned:!1,scrolling:!1,waiting:!1})},reset:(k=!1)=>{const{controlled:y}=i();if(y){xr(r.current,"tour","reset() is not supported in controlled mode");return}s.current(),e.current.updateState({action:Rt.RESET,index:0,lifecycle:He.INIT,positioned:!1,scrolling:!1,status:k?At.RUNNING:At.READY,waiting:!1})},skip:k=>{const{status:y}=i();y===At.RUNNING&&e.current.updateState({action:Rt.SKIP,lifecycle:He.COMPLETE,origin:k,positioned:!1,scrolling:!1,status:At.SKIPPED,waiting:!1})},start:k=>{const{index:y,size:b}=i();s.current(),e.current.updateState({action:Rt.START,index:$r.number(k)?k:y,lifecycle:He.INIT,positioned:!1,scrolling:!1,status:b?At.RUNNING:At.WAITING,waiting:!1},!0)},stop:(k=!1)=>{const{index:y,status:b}=i();[At.FINISHED,At.SKIPPED].includes(b)||e.current.updateState({action:Rt.STOP,index:y+(k?1:0),lifecycle:He.COMPLETE,positioned:!1,scrolling:!1,status:At.PAUSED,waiting:!1})}}},[e])}const Gre=new Set(["origin","positioned"]);function Xre(e,t){const n=m.useRef(null);m.useEffect(()=>{if(!t)return;const r=e.current.getSnapshot();return xr(!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 u of Object.keys(s))s[u]!==i[u]&&!Gre.has(u)&&(a[u]={from:i[u],to:s[u]},(u==="status"||u==="size")&&(l=!0));Object.keys(a).length&&(!l&&s.index>=s.size||xr(!0,l?"tour":`step:${s.index}`,"state",a))})},[t,e])}function Jre(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 d;const u={...n.current.getEventState(),error:null,scroll:null,step:a,type:i,...l};(d=r.current)==null||d.call(r,u,s.current),n.current.dispatch(u,s.current)},[n])}function ua(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 Qre(e){const{addFailure:t,controls:n,emitEvent:r,previousState:s,props:i,state:a,step:l,store:u}=e,{action:d,index:f,lifecycle:c,positioned:p,scrolling:h,size:g,status:v}=a,k=ST(l)??null,y=m.useRef(null),b=m.useRef(i),w=m.useRef(a),N=m.useRef(s),C=m.useRef(l),j=m.useRef(k),R=m.useRef(n),D=m.useRef(null),M=m.useRef(null),z=m.useRef(null);b.current=i,w.current=a,N.current=s,C.current=l,j.current=k,R.current=n;const $=()=>{D.current&&(clearInterval(D.current),D.current=null),M.current=null,z.current&&(z.current.cancel(),z.current=null)};m.useEffect(()=>{if(!N.current)return;const{hasChangedTo:A}=ua(w.current,N.current);(A("action",[Rt.NEXT,Rt.PREV,Rt.SKIP,Rt.CLOSE])||y.current===Rt.CLOSE&&d===Rt.START)&&(y.current=d)},[d]),m.useEffect(()=>{if(!N.current)return()=>{$()};const{hasChanged:A}=ua(w.current,N.current),F=C.current;if(A("index")&&$(),v!==At.RUNNING||!F||c!==He.INIT)return()=>{$()};const{hasChangedTo:T}=ua(w.current,N.current);T("status",At.RUNNING)&&[At.IDLE,At.READY,At.PAUSED].includes(N.current.status)&&r(gr.TOUR_START,F),u.current.cleanupPositionData();const{debug:O}=b.current;if(F.before&&!z.current){xr(O,`step:${f}`,"before()",F),z.current={cancel:()=>{}},u.current.updateState({waiting:!0}),r(gr.STEP_BEFORE_HOOK,F,{action:y.current??w.current.action});const I=()=>{z.current=null,u.current.updateState({action:y.current??w.current.action,waiting:!1,lifecycle:He.READY})},B=new AbortController,P=F.beforeTimeout;z.current={cancel:()=>B.abort()};const L=P?setTimeout(()=>{B.signal.aborted||(xr(O,`step:${f}`,"before()","timed out",`${P}ms`),B.abort(),t(F,"before_hook"),r(gr.ERROR,F,{error:new Error("Step before hook timed out")}),I())},P):null;F.before({...u.current.getState(),action:y.current??u.current.getState().action,step:F}).then(()=>{B.signal.aborted||(L&&clearTimeout(L),I())}).catch(_=>{B.signal.aborted||(L&&clearTimeout(L),t(F,"before_hook"),r(gr.ERROR,F,{error:_ instanceof Error?_:new Error(String(_))}),I())})}else if(!z.current){D.current&&M.current!==F.target&&$();const I=Js(F.target);if(I&&qp(I))$(),u.current.updateState({action:y.current??Rt.UPDATE,lifecycle:He.READY,waiting:!1});else if(F.targetWaitTimeout===0)u.current.updateState({action:y.current??Rt.UPDATE,lifecycle:He.READY,waiting:!1});else if(!D.current){const{targetWaitTimeout:B}=F,P=Date.now();M.current=F.target,xr(O,`step:${f}`,"polling","started",`${B}ms`),u.current.updateState({waiting:!0}),D.current=setInterval(()=>{const L=Js(F.target),_=Date.now()-P,G=_>=B;(L&&qp(L)||G)&&(xr(O,`step:${f}`,"polling",L&&qp(L)?"found":"timed out",`${_}ms`),$(),u.current.updateState({action:y.current??Rt.UPDATE,lifecycle:He.READY,waiting:!1}))},100)}}return()=>{$()}},[t,r,f,c,v,u]),m.useEffect(()=>{if(!N.current)return;const{hasChanged:A,hasChangedTo:F,previous:T}=ua(w.current,N.current),O=C.current;if(!O)return;const I=Js(O.target),B=!!I;if(B&&qp(I)){if(F("lifecycle",He.READY)&&T.lifecycle===He.INIT&&r(gr.STEP_BEFORE,O,{action:y.current??w.current.action}),F("lifecycle",He.READY)){const P=w.current,L=Ure(O,P,b.current.continuous)?He.TOOLTIP:He.BEACON,_=Js(O.scrollTarget??O.spotlightTarget??O.target),G=N1({isFirstStep:P.index===0,scrollToFirstStep:b.current.scrollToFirstStep,step:O,target:_,targetLifecycle:L}),Z=L===He.TOOLTIP?He.TOOLTIP_BEFORE:He.BEACON_BEFORE;xr(b.current.debug,`step:${f}`,"scroll",G?"needed":"skipped"),u.current.updateState({action:Rt.UPDATE,lifecycle:Z,scrolling:G})}}else if(w.current.status===At.RUNNING&&c!==He.INIT&&c!==He.COMPLETE&&A("lifecycle")){xr(b.current.debug,`step:${f}`,B?"Target not visible":"Target not mounted",O),t(O,"target_not_found"),r(gr.TARGET_NOT_FOUND,O);const P=w.current;P.controlled||u.current.updateState({action:Rt.UPDATE,index:P.index+(P.action===Rt.PREV?-1:1),lifecycle:He.INIT})}},[t,r,f,c,u]),m.useEffect(()=>{if(!N.current)return;const{hasChangedTo:A,previous:F}=ua(w.current,N.current),T=C.current,O=j.current;if(T&&A("lifecycle",He.TOOLTIP_BEFORE)&&F.lifecycle===He.BEACON){const P=Js(T.scrollTarget??T.spotlightTarget??T.target);if(N1({isFirstStep:w.current.index===0,scrollToFirstStep:b.current.scrollToFirstStep,step:T,target:P,targetLifecycle:He.TOOLTIP})){u.current.updateState({scrolling:!0,positioned:!1});return}}const I=c===He.BEACON_BEFORE||c===He.TOOLTIP_BEFORE;if(T&&I&&!h){const P=c===He.TOOLTIP_BEFORE?He.TOOLTIP:He.BEACON;u.current.updateState({action:Rt.UPDATE,lifecycle:P})}T&&A("lifecycle",He.BEACON)&&r(gr.BEACON,T),T&&A("lifecycle",He.TOOLTIP)&&r(gr.TOOLTIP,T);const B=w.current;if((B.status===At.RUNNING||B.controlled&&B.status===At.PAUSED&&T)&&O&&A("lifecycle",He.COMPLETE)&&F.lifecycle===He.TOOLTIP&&(r(gr.STEP_AFTER,O,{action:y.current??Rt.UPDATE,index:F.index??B.index,lifecycle:B.lifecycle}),O.after)){r(gr.STEP_AFTER_HOOK,O,{action:y.current??Rt.UPDATE,index:F.index??B.index,lifecycle:B.lifecycle});try{O.after({...u.current.getState(),action:y.current??Rt.UPDATE,index:F.index??B.index,lifecycle:B.lifecycle,step:O})}catch{}}},[r,c,p,h,u]),m.useEffect(()=>{if(!N.current)return;const{hasChangedTo:A,previous:F}=ua(w.current,N.current),T=C.current,O=j.current;g&&!T&&c===He.INIT&&u.current.updateState({action:Rt.UPDATE,lifecycle:He.COMPLETE,status:At.FINISHED}),!w.current.controlled&&v===At.RUNNING&&A("lifecycle",He.COMPLETE)&&f<g&&u.current.updateState({action:Rt.UPDATE,lifecycle:He.INIT}),A("lifecycle",He.COMPLETE)&&f>=g&&u.current.updateState({action:Rt.UPDATE,lifecycle:He.COMPLETE,status:At.FINISHED});const I=T??O??Kv(b.current,b.current.steps[f-1]);if(I&&A("status",[At.FINISHED,At.SKIPPED])){let B;T?B=f:O?B=F.index??f:B=f-1,r(gr.TOUR_END,I,{index:B}),w.current.controlled||R.current.reset(),y.current=null}T&&A("action",Rt.STOP)&&(y.current=null,r(gr.TOUR_STATUS,T)),T&&A("action",Rt.RESET)&&(r(gr.TOUR_STATUS,T),y.current=null)},[d,r,f,c,g,v,u])}function Zre({controls:e,emitEvent:t,props:n,state:r,store:s}){const{debug:i,initialStepIndex:a,run:l,stepIndex:u,steps:d}=n,f=m.useRef(void 0),c=m.useRef(r),p=m.useRef(e);c.current=r,p.current=e,m.useEffect(()=>{const h=f.current;if(f.current=n,!h||n===h)return;const{hasChanged:g}=ua(n,h);if(Ov(h.steps,d)||(GT(d,i)?s.current.setSteps(d):(xr(i,"tour","Steps are not valid",d),t(gr.ERROR,d[0]??{target:"",content:""},{error:new Error("Steps are not valid")}))),g("run"))l?s.current.getState().size&&p.current.start(u??a):p.current.stop();else if($r.number(u)&&g("stepIndex")){const v=$r.number(h.stepIndex)&&h.stepIndex<u?Rt.NEXT:Rt.PREV;[At.FINISHED,At.SKIPPED].includes(c.current.status)||s.current.updateState({action:v,index:u,lifecycle:He.INIT,positioned:!1},!0)}},[i,t,a,n,l,u,d,s])}function ese(e,t){var l,u,d,f;const{beaconPosition:n,lifecycle:r,scrollOffset:s,step:i}=t;if(i.scrollTarget||i.spotlightTarget)return Math.max(0,e);let a=e-i.spotlightPadding.top;if(r===He.BEACON_BEFORE&&(n!=null&&n.placement)){const c=tse(n);["bottom"].includes(n.placement)||(a+=Math.floor(c-s))}else if(r===He.TOOLTIP_BEFORE){const{placement:c}=i;if(c==="top"){const p=((l=document.querySelector(".react-joyride__floater"))==null?void 0:l.getBoundingClientRect().height)??0,h=(u=i.floatingOptions)!=null&&u.hideArrow?0:i.arrowSize,g=i.offset+i.spotlightPadding.top+h;a-=p+g}else if(c==="left"||c==="right"){const p=((d=document.querySelector(".react-joyride__floater"))==null?void 0:d.getBoundingClientRect().height)??0,h=((f=Js(i.target))==null?void 0:f.getBoundingClientRect().height)??0,g=s+i.spotlightPadding.top+h/2-p/2;g<s&&(a-=s-g)}}return Math.max(0,a)}function tse(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 nse({emitEvent:e,previousState:t,props:n,state:r,step:s,store:i}){const{index:a,lifecycle:l,positioned:u,scrolling:d,status:f}=r,c=m.useRef(null),p=m.useRef(r),h=m.useRef(t),g=m.useRef(n),v=m.useRef(s);p.current=r,h.current=t,g.current=n,v.current=s,m.useEffect(()=>()=>{var k;(k=c.current)==null||k.call(c)},[]),m.useEffect(()=>{var C;if(!h.current||!v.current)return;const{hasChangedTo:k}=ua(p.current,h.current),y=v.current,{debug:b}=g.current,{scrollDuration:w}=y,N=l===He.BEACON_BEFORE||l===He.TOOLTIP_BEFORE;if(f===At.RUNNING&&N&&d&&k("positioned",!0)){const j=Js(y.scrollTarget??y.spotlightTarget??y.target),R=i.current.getPositionData("beacon"),D=xu(j),M=D?!D.isSameNode(fs()):!1;(C=c.current)==null||C.call(c),(async()=>{if(M&&!wu(D)){const B=fs(),P=Dre(D),L={initial:B.scrollTop,target:P,element:B,duration:w};e(gr.SCROLL_START,y,{scroll:L});const{cancel:_,promise:G}=j1(P,{element:B,duration:w});c.current=_,await G,e(gr.SCROLL_END,y,{scroll:L})}const $=Math.floor(Fre(j,y.scrollOffset))||0,A=M?$:ese($,{beaconPosition:R,lifecycle:l,scrollOffset:y.scrollOffset,step:y});xr(b,`step:${a}`,"scroll",M?"custom":"document",`${$} → ${A}`);const F=D,T={initial:F.scrollTop,target:A,element:F,duration:w};e(gr.SCROLL_START,y,{scroll:T});const{cancel:O,promise:I}=j1(A,{element:F,duration:w});c.current=O,await I,e(gr.SCROLL_END,y,{scroll:T}),i.current.updateState({scrolling:!1})})().catch(()=>{i.current.updateState({scrolling:!1})})}},[e,a,l,u,d,f,i])}function rse(e){const t=Fte(()=>Lre(Ire,e),[e]),{debug:n,initialStepIndex:r,onEvent:s,run:i,stepIndex:a,steps:l}=t,u=m.useRef(qre(t)),d=vP.useSyncExternalStore(u.current.subscribe,u.current.getSnapshot,u.current.getServerSnapshot),[f,c]=m.useState([]),p=m.useCallback((C,j)=>{c(R=>[...R,{reason:j,step:C}])},[]),h=m.useCallback(()=>{c([])},[]);Xre(u,n);const g=Yre(u,n,h),v=Jre(s,g,u),{index:k,size:y,status:b}=d,w=ST(d),N=m.useMemo(()=>Kv(t,l[k]),[k,t,l]);return zte(()=>{i&&y&>(l,n)&&g.start(a??r)}),Dte(()=>{i&&y&&b===At.IDLE&&u.current.updateState({status:At.READY})},[i,y,b]),Zre({controls:g,emitEvent:v,props:t,state:d,store:u}),Qre({addFailure:p,controls:g,emitEvent:v,previousState:w,props:t,state:d,step:N,store:u}),nse({emitEvent:v,previousState:w,props:t,state:d,step:N,store:u}),{controls:g,failures:f,mergedProps:t,state:d,step:N,store:u}}function sse(e){const[t,n]=m.useState(null);return m.useEffect(()=>{let r=null,s=!1;if(e)if($r.domElement(e))r=e,s=!0;else{const i=document.querySelector(e);i&&(r=i)}else{const i=document.createElement("div");i.id=Tre,document.body.appendChild(i),r=i}return n(r),()=>{!r||s||r.parentNode===document.body&&document.body.removeChild(r)}},[e]),t}const ise={animation:"joyride-loader-spin 1s linear infinite",border:"5px solid rgba(0, 0, 0, 0.1)",borderRadius:"50%",borderTopColor:"#555"};function ose({nonce:e,step:t}){const{loaderComponent:n}=t,r=!!n;if(m.useEffect(()=>{if(r||document.getElementById("joyride-loader-animation"))return yf;const u=document.createElement("style");return u.id="joyride-loader-animation",e&&u.setAttribute("nonce",e),u.appendChild(document.createTextNode(`
|
|
193
|
+
@keyframes joyride-loader-spin {
|
|
194
|
+
to { transform: rotate(360deg); }
|
|
195
|
+
}
|
|
196
|
+
`)),document.head.appendChild(u),()=>{const d=document.getElementById("joyride-loader-animation");d!=null&&d.parentNode&&d.parentNode.removeChild(d)}},[r,e]),n===null)return null;const{height:s,width:i,...a}=t.styles.loader;let l;if(n){const u=n;l=ot.createElement(u,{step:t})}else l=ot.createElement("div",{style:{...ise,height:s,width:i,borderTopColor:t.primaryColor}});return ot.createElement("div",{className:"react-joyride__loader","data-testid":"loader",style:a},l)}const ase={height:0,isFixed:!1,left:0,top:0,width:0};function ed(e,t){const n=Js(e);if(!n)return ase;const r=Uv(n),s=wu(n),i=$re(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 lse(e,t,n){const[r,s]=m.useState(()=>ed(e,t)),i=m.useRef(void 0),a=m.useRef(null),l=m.useRef(n),u=m.useRef(null),d=m.useCallback(()=>{clearTimeout(i.current),i.current=window.setTimeout(()=>{s(c=>{const p=ed(e,t);return c.top===p.top&&c.left===p.left&&c.width===p.width&&c.height===p.height&&c.isFixed===p.isFixed?c:p})},100)},[e,t]);m.useEffect(()=>{let c=null;const p=g=>{a.current=xu(g,!0),a.current&&a.current.addEventListener("scroll",d,{passive:!0}),window.addEventListener("scroll",d,{passive:!0}),window.addEventListener("resize",d),typeof ResizeObserver<"u"&&(u.current=new ResizeObserver(d),u.current.observe(g)),s(ed(e,t))},h=Js(e);return h?p(h):(c=new MutationObserver(()=>{const g=Js(e);g&&(c==null||c.disconnect(),c=null,p(g))}),c.observe(document.body,{childList:!0,subtree:!0})),()=>{var g;c==null||c.disconnect(),a.current&&a.current.removeEventListener("scroll",d),window.removeEventListener("scroll",d),window.removeEventListener("resize",d),(g=u.current)==null||g.disconnect(),clearTimeout(i.current)}},[e,t,d]),m.useEffect(()=>{l.current&&!n&&s(ed(e,t)),l.current=n},[n,e,t]);let f=r;return l.current&&!n&&(f=ed(e,t)),f}function cse(e,t,n){let r=`M0 0H${e}V${t}H0Z`;return n&&(r+=` ${n}`),r}function E1(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 use=[He.BEACON_BEFORE,He.BEACON];function dse(e){var I,B;const{blockTargetInteraction:t,continuous:n,hideOverlay:r,lifecycle:s,onClickOverlay:i,overlayClickAction:a,placement:l,portalElement:u,scrolling:d,spotlightPadding:f,spotlightRadius:c,spotlightTarget:p,styles:h,target:g,waiting:v}=e,k=Bte(),y=lse(p??g,f,d||v),b=m.useRef(null),w=(s===He.TOOLTIP||s===He.TOOLTIP_BEFORE)&&l!=="center",[N,C]=m.useState(!1),j=u?(I=b.current)==null?void 0:I.offsetParent:null,R=(j==null?void 0:j.clientWidth)??k.width,D=(j==null?void 0:j.clientHeight)??Mre()??k.height,M=((B=h.overlay)==null?void 0:B.backgroundColor)??"rgba(0, 0, 0, 0.5)",z=m.useMemo(()=>{const{backgroundColor:P,mixBlendMode:L,..._}=h.overlay;return{height:D,pointerEvents:"none",..._}},[D,h.overlay]),$=w&&!d&&!v;m.useEffect(()=>{$?requestAnimationFrame(()=>C(!0)):C(!1)},[$]);const A=n&&use.includes(s),F=!n&&s!==He.TOOLTIP;if(r||!v&&(A||F))return null;let T="";if($)if(u&&j){const P=Js(p??g);if(P){const L=S1(P),_=S1(j);T=E1(L.left-_.left-f.left,L.top-_.top-f.top,P.offsetWidth+f.left+f.right,P.offsetHeight+f.top+f.bottom,c)}}else T=E1(y.left,y.top,y.width,y.height,c);const O=cse(R,D,T);return ot.createElement("div",{ref:b,"aria-hidden":"true",className:"react-joyride__overlay","data-testid":"overlay",style:z},ot.createElement("svg",{className:"react-joyride__spotlight","data-testid":"spotlight",style:{height:D,left:0,position:y.isFixed?"fixed":"absolute",top:0,width:R}},ot.createElement("path",{d:O,fill:M,fillRule:"evenodd",onClick:i,style:{cursor:a?"pointer":"default",pointerEvents:"auto"}}),T&&ot.createElement("path",{d:T,fill:M,style:{opacity:N?0:1,pointerEvents:t?"auto":"none",transition:"opacity 0.2s"}}),T&&Object.keys(h.spotlight).length>0&&ot.createElement("path",{d:T,fill:"none",style:{pointerEvents:"none"},...h.spotlight})))}function XT(e){const{children:t,element:n}=e;return n?os.createPortal(t,n):null}const fse='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), area[href], [tabindex]:not([tabindex="-1"]), [contenteditable]';function pse(e,t){const n=m.useRef(null);m.useEffect(()=>{if(!e)return yf;n.current=document.activeElement;const r=i=>{if(i.key!=="Tab")return;const a=[...e.querySelectorAll(fse)],{shiftKey:l}=i;if(!a.length)return;i.preventDefault();let u=document.activeElement?a.indexOf(document.activeElement):0;u===-1||!l&&u+1===a.length?u=0:l&&u===0?u=a.length-1:u+=l?-1:1,a[u].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 Io(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 hse(e,t,n){const[r]=e.split("-");switch(r){case"top":return{points:`0,0 ${t/2},${n} ${t},0`,...Io(e,t,n)};case"bottom":return{points:`${t},${n} ${t/2},0 0,${n}`,...Io(e,t,n)};case"left":return{points:`0,0 ${n},${t/2} 0,${t}`,...Io(e,t,n)};case"right":return{points:`${n},${t} ${n},0 0,${t/2}`,...Io(e,t,n)};default:return null}}function mse(e,t,n,r){if(!t)return{};const[s]=e.split("-");switch(s){case"top":return{bottom:-n,left:t.x??0,...Io(e,r,n)};case"bottom":return{top:-n,left:t.x??0,...Io(e,r,n)};case"left":return{right:-n,top:t.y??0,...Io(e,r,n)};case"right":return{left:-n,top:t.y??0,...Io(e,r,n)};default:return{}}}function gse({arrowComponent:e,arrowRef:t,base:n,placement:r,position:s,size:i,styles:a}){const l=e;let u=null;if(l){if(!Io(r,n,i))return null;u=ot.createElement("span",{style:{flexShrink:0}},ot.createElement(l,{base:n,placement:r,size:i}))}else{const d=hse(r,n,i);if(!d)return null;u=ot.createElement("svg",{height:d.height,width:d.width,xmlns:"http://www.w3.org/2000/svg"},ot.createElement("polygon",{fill:"currentColor",points:d.points}))}return ot.createElement("span",{ref:t,className:"react-joyride__arrow","data-testid":"arrow",style:{...a,...mse(r,s,i,n),...s?{}:{visibility:"hidden"}}},u)}function yse(e){const{beaconComponent:t,continuous:n,index:r,isLastStep:s,locale:i,nonce:a,onInteract:l,shouldFocus:u,size:d,step:f,styles:c}=e,p=m.useRef(null),h=!!t;m.useEffect(()=>{if(h||document.getElementById("joyride-beacon-animation"))return yf;const k=document.createElement("style");k.id="joyride-beacon-animation",a&&k.setAttribute("nonce",a),k.appendChild(document.createTextNode(`
|
|
197
|
+
@keyframes joyride-beacon-inner {
|
|
198
|
+
20% {
|
|
199
|
+
opacity: 0.9;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
90% {
|
|
203
|
+
opacity: 0.7;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
@keyframes joyride-beacon-outer {
|
|
208
|
+
0% {
|
|
209
|
+
transform: scale(1);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
45% {
|
|
213
|
+
opacity: 0.7;
|
|
214
|
+
transform: scale(0.75);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
100% {
|
|
218
|
+
opacity: 0.9;
|
|
219
|
+
transform: scale(1);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
`)),document.head.appendChild(k);const y=setTimeout(()=>{$r.domElement(p.current)&&u&&p.current.focus()},0);return()=>{clearTimeout(y);const b=document.getElementById("joyride-beacon-animation");b!=null&&b.parentNode&&b.parentNode.removeChild(b)}},[h,a,u]);const g=Co(i.open);let v;if(t){const k=t;v=ot.createElement(k,{continuous:n,index:r,isLastStep:s,size:d,step:f})}else v=ot.createElement("span",{style:c.beacon},ot.createElement("span",{style:c.beaconOuter}),ot.createElement("span",{style:c.beaconInner}));return ot.createElement("button",{ref:p,"aria-label":g,className:"react-joyride__beacon","data-testid":"button-beacon",onClick:l,onMouseEnter:l,style:c.beaconWrapper,title:g,type:"button"},v)}function xse({styles:e,...t}){const{color:n,height:r,width:s,...i}=e;return ot.createElement("button",{style:i,type:"button",...t},ot.createElement("svg",{height:typeof r=="number"?`${r}px`:r,preserveAspectRatio:"xMidYMid",version:"1.1",viewBox:"0 0 18 18",width:typeof s=="number"?`${s}px`:s,xmlns:"http://www.w3.org/2000/svg"},ot.createElement("g",null,ot.createElement("path",{d:"M8.13911129,9.00268191 L0.171521827,17.0258467 C-0.0498027049,17.248715 -0.0498027049,17.6098394 0.171521827,17.8327545 C0.28204354,17.9443526 0.427188206,17.9998706 0.572051765,17.9998706 C0.71714958,17.9998706 0.862013139,17.9443526 0.972581703,17.8327545 L9.0000937,9.74924618 L17.0276057,17.8327545 C17.1384085,17.9443526 17.2832721,17.9998706 17.4281356,17.9998706 C17.5729992,17.9998706 17.718097,17.9443526 17.8286656,17.8327545 C18.0499901,17.6098862 18.0499901,17.2487618 17.8286656,17.0258467 L9.86135722,9.00268191 L17.8340066,0.973848225 C18.0553311,0.750979934 18.0553311,0.389855532 17.8340066,0.16694039 C17.6126821,-0.0556467968 17.254037,-0.0556467968 17.0329467,0.16694039 L9.00042166,8.25611765 L0.967006424,0.167268345 C0.745681892,-0.0553188426 0.387317931,-0.0553188426 0.165993399,0.167268345 C-0.0553311331,0.390136635 -0.0553311331,0.751261038 0.165993399,0.974176179 L8.13920499,9.00268191 L8.13911129,9.00268191 Z",fill:n}))))}function wse(e){const{backProps:t,closeProps:n,index:r,isLastStep:s,primaryProps:i,skipProps:a,step:l,tooltipProps:u}=e,{buttons:d,content:f,styles:c,title:p}=l,h={};d.includes("primary")&&(h.primary=ot.createElement("button",{"data-testid":"button-primary",style:c.buttonPrimary,type:"button",...i})),d.includes("skip")&&!s&&(h.skip=ot.createElement("button",{"aria-live":"off","data-testid":"button-skip",style:c.buttonSkip,type:"button",...a})),d.includes("back")&&r>0&&(h.back=ot.createElement("button",{"data-testid":"button-back",style:c.buttonBack,type:"button",...t})),h.close=d.includes("close")&&ot.createElement(xse,{"data-testid":"button-close",styles:c.buttonClose,...n});const g=p?{"aria-labelledby":"joyride-tooltip-title","aria-describedby":"joyride-tooltip-content"}:{"aria-label":Co(f),"aria-describedby":"joyride-tooltip-content"};return ot.createElement("div",{key:"JoyrideTooltip",className:"react-joyride__tooltip","data-joyride-step":r,...l.id&&{"data-joyride-id":l.id},style:c.tooltip,...u,...g},ot.createElement("div",{style:c.tooltipContainer},p&&ot.createElement("h4",{id:"joyride-tooltip-title",style:c.tooltipTitle},p),ot.createElement("div",{id:"joyride-tooltip-content",style:c.tooltipContent},f)),d.some(v=>v==="back"||v==="primary"||v==="skip")&&ot.createElement("div",{style:c.tooltipFooter},ot.createElement("div",{style:c.tooltipFooterSpacer},h.skip),h.back,h.primary),h.close)}function bse(e){const{continuous:t,controls:n,index:r,isLastStep:s,size:i,step:a}=e,l=y=>{y.preventDefault(),n.prev(Zi.BUTTON_BACK)},u=y=>{y.preventDefault(),a.closeButtonAction==="skip"?n.skip(Zi.BUTTON_CLOSE):n.close(Zi.BUTTON_CLOSE)},d=y=>{if(y.preventDefault(),!t){n.close(Zi.BUTTON_PRIMARY);return}n.next(Zi.BUTTON_PRIMARY)},f=y=>{y.preventDefault(),n.skip(Zi.BUTTON_SKIP)},c=()=>{const{back:y,close:b,last:w,next:N,nextWithProgress:C,skip:j}=a.locale,R=Co(y),D=Co(b),M=Co(w),z=Co(N),$=Co(j);let A=b,F=D;if(t){if(A=N,F=z,a.showProgress&&!s){const T=Co(C,{step:r+1,steps:i});A=Yw(C,r+1,i),F=T}s&&(A=w,F=M)}return{backProps:{"aria-label":R,children:y,"data-action":"back",onClick:l,role:"button",title:R},closeProps:{"aria-label":D,children:b,"data-action":"close",onClick:u,role:"button",title:D},primaryProps:{"aria-label":F,children:A,"data-action":"primary",onClick:d,role:"button",title:F},skipProps:{"aria-label":$,children:j,"data-action":"skip",onClick:f,role:"button",title:$},tooltipProps:{"aria-modal":!0,role:"alertdialog"}}},{arrowComponent:p,beaconComponent:h,tooltipComponent:g,...v}=a;let k;if(g){const y=g;k=ot.createElement(y,{...c(),continuous:t,controls:n,index:r,isLastStep:s,size:i,step:v})}else k=ot.createElement(wse,{...c(),continuous:t,controls:n,index:r,isLastStep:s,size:i,step:v});return k}function vse(e){if(e.startsWith("left"))return["top","bottom"];if(e.startsWith("right"))return["bottom","top"]}function kse(e,t,n){var r,s;return e?[Cre()]:((r=t.floatingOptions)==null?void 0:r.flipOptions)===!1?[]:[jre({crossAxis:!1,fallbackPlacements:vse(n),padding:20,...(s=t.floatingOptions)==null?void 0:s.flipOptions})]}function Sse(e){var L,_,G,Z,U;const{continuous:t,controls:n,index:r,lifecycle:s,nonce:i,open:a,portalElement:l,setPositionData:u,setTooltipRef:d,shouldScroll:f,size:c,step:p,target:h,updateState:g}=e,v=m.useRef(null),k=m.useRef({}),y=m.useRef({}),b=p.placement==="center",w=p.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(()=>KT(h)?xu(h):void 0,[h]),j=m.useMemo(()=>wu(h),[h]),R=m.useMemo(()=>C?{boundary:C,rootBoundary:"viewport"}:{},[C]),D=b||w?"bottom":p.placement,M=b?"fixed":((L=p.floatingOptions)==null?void 0:L.strategy)??(p.isFixed||j?"fixed":"absolute"),z=m.useMemo(()=>{var se,ue,de,me;return b?[{name:"center",fn:({rects:ae})=>({x:(window.innerWidth-ae.floating.width)/2,y:(window.innerHeight-ae.floating.height)/2})}]:[b1(({placement:ae})=>{var be;let Ne="right";ae.startsWith("top")?Ne="top":ae.startsWith("bottom")?Ne="bottom":ae.startsWith("left")&&(Ne="left");const Pe=p.spotlightTarget?0:p.spotlightPadding[Ne];return p.offset+Pe+((be=p.floatingOptions)!=null&&be.hideArrow?0:p.arrowSize)},[p.offset,p.spotlightPadding,p.spotlightTarget,p.arrowSize,(se=p.floatingOptions)==null?void 0:se.hideArrow]),...kse(w,p,D),Nre({padding:10,...R,...(ue=p.floatingOptions)==null?void 0:ue.shiftOptions}),...(de=p.floatingOptions)!=null&&de.hideArrow?[]:[Ere({element:v,padding:p.arrowSpacing},[p.arrowSpacing,p.arrowBase])],...((me=p.floatingOptions)==null?void 0:me.middleware)??[]]},[b,p,w,D,R]),$=w1({...b?{elements:{reference:N}}:{},placement:D,strategy:M,middleware:z}),A=w1({strategy:M,placement:p.beaconPlacement??(w||b?"bottom":p.placement),middleware:m.useMemo(()=>{var se,ue;return[b1(((ue=(se=p.floatingOptions)==null?void 0:se.beaconOptions)==null?void 0:ue.offset)??-18)]},[(G=(_=p.floatingOptions)==null?void 0:_.beaconOptions)==null?void 0:G.offset]),whileElementsMounted:g1});y.current=$.middlewareData,k.current=A.middlewareData,m.useEffect(()=>{var de;const{floating:se,reference:ue}=$.elements;if(!(!ue||!se||s!==He.TOOLTIP))return g1(ue,se,$.update,(de=p.floatingOptions)==null?void 0:de.autoUpdate)},[s,$.update,(Z=p.floatingOptions)==null?void 0:Z.autoUpdate,p.target,$.elements]),m.useEffect(()=>{!b&&h&&$.refs.setReference(h),h&&A.refs.setReference(h)},[A.refs,b,h,$.refs]),m.useEffect(()=>{$.isPositioned&&u("tooltip",{placement:$.placement,x:$.x??0,y:$.y??0,middlewareData:y.current})},[u,$.isPositioned,$.placement,$.x,$.y]),m.useEffect(()=>{A.isPositioned&&u("beacon",{placement:A.placement,x:A.x??0,y:A.y??0,middlewareData:k.current})},[u,A.isPositioned,A.placement,A.x,A.y]);const F=p.zIndex+100,T=m.useCallback(se=>{se.type==="mouseenter"&&p.beaconTrigger!=="hover"||g({lifecycle:He.TOOLTIP_BEFORE,positioned:!1})},[p.beaconTrigger,g]),O=m.useCallback(se=>{se&&($.refs.setFloating(se),d(se))},[$.refs,d]),{arrow:I,floater:B}=p.styles;let P=null;if(s===He.TOOLTIP||s===He.TOOLTIP_BEFORE){const se=k1({...B,...$.floatingStyles,zIndex:F,opacity:a&&$.isPositioned?1:0,...!a&&{transition:"none"}});P=ot.createElement("div",{ref:O,className:"react-joyride__floater","data-testid":"floater",id:`react-joyride-step-${r}`,style:se},ot.createElement(bse,{continuous:t,controls:n,index:r,isLastStep:r+1===c,size:c,step:p}),!b&&!((U=p.floatingOptions)!=null&&U.hideArrow)&&ot.createElement(gse,{arrowComponent:p.arrowComponent,arrowRef:v,base:p.arrowBase,placement:$.placement,position:$.middlewareData.arrow,size:p.arrowSize,styles:I}))}else(s===He.BEACON||s===He.BEACON_BEFORE)&&(P=ot.createElement("div",{ref:A.refs.setFloating,className:"react-joyride__floater","data-testid":"floater-beacon",id:`react-joyride-step-${r}-beacon`,style:k1({...A.floatingStyles,zIndex:F})},ot.createElement(yse,{beaconComponent:p.beaconComponent,continuous:t,index:r,isLastStep:r+1===c,locale:p.locale,nonce:i,onInteract:T,shouldFocus:f,size:c,step:p,styles:p.styles})));return ot.createElement(XT,{element:l},P)}function Nse(e){const{continuous:t,controls:n,index:r,lifecycle:s,nonce:i,portalElement:a,setPositionData:l,shouldScroll:u,size:d,step:f,updateState:c}=e,[p,h]=m.useState(null);pse(f.disableFocusTrap?null:p,"[data-action=primary]");const g=Js(f.target),v=s===He.TOOLTIP;return!YT(f)||!$r.domElement(g)?null:ot.createElement(Sse,{key:`JoyrideStep-${r}`,continuous:t,controls:n,index:r,lifecycle:s,nonce:i,open:v,portalElement:a,setPositionData:l,setTooltipRef:h,shouldScroll:u,size:d,step:f,target:g,updateState:c})}function jse({controls:e,mergedProps:t,state:n,step:r,store:s}){const{continuous:i,debug:a,nonce:l,portalElement:u,scrollToFirstStep:d}=t,f=sse(u),{index:c,lifecycle:p,status:h}=n,g=h===At.RUNNING,[v,k]=m.useState(!1),y=m.useRef(null),b=(r==null?void 0:r.loaderDelay)??0;m.useEffect(()=>(n.waiting?b===0?k(!0):y.current=setTimeout(()=>{k(!0)},b):k(!1),()=>{y.current&&(clearTimeout(y.current),y.current=null)}),[b,n.waiting]),m.useEffect(()=>{if(!g)return;const C=j=>{!r||p!==He.TOOLTIP||j.key==="Escape"&&r.dismissKeyAction&&(r.dismissKeyAction==="next"?e.next(Zi.KEYBOARD):e.close(Zi.KEYBOARD))};return document.body.addEventListener("keydown",C,{passive:!0}),()=>{document.body.removeEventListener("keydown",C)}},[e,g,p,r]);const w=m.useCallback(()=>{(r==null?void 0:r.overlayClickAction)==="close"?e.close(Zi.OVERLAY):(r==null?void 0:r.overlayClickAction)==="next"&&e.next(Zi.OVERLAY)},[e,r==null?void 0:r.overlayClickAction]);if(!r||!g)return null;const N=n.action===Rt.START&&!r.skipBeacon&&r.placement!=="center";return ot.createElement(ot.Fragment,null,p!==He.INIT&&ot.createElement(Nse,{...n,continuous:i,controls:e,debug:a,nonce:l,portalElement:f,setPositionData:s.current.setPositionData,shouldScroll:!r.skipScroll&&(c!==0||d),step:r,updateState:s.current.updateState}),ot.createElement(XT,{element:f},ot.createElement(ot.Fragment,null,v&&ot.createElement(ose,{nonce:l,step:r}),!N&&ot.createElement(dse,{...r,continuous:i,lifecycle:p,onClickOverlay:w,portalElement:u?f:null,scrolling:n.scrolling,waiting:n.waiting}))))}function Cse(e){const{controls:t,failures:n,mergedProps:r,state:s,step:i,store:a}=rse(e);return{controls:t,failures:n,on:m.useCallback((l,u)=>a.current.on(l,u),[a]),state:m.useMemo(()=>Cm(s,"positioned"),[s]),step:i,Tour:Vv()?ot.createElement(jse,{controls:t,mergedProps:r,state:s,step:i,store:a}):null}}function Ese(e){const{Tour:t}=Cse(e);return t}function _se(e){return Vv()?ot.createElement(Ese,e):null}function Pse(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 Ase(e){return[{target:"body",content:e("onboarding:flow.intro"),disableBeacon:!0,placement:"center"}]}function Ise(e){return[{target:"body",content:e("onboarding:flow.introEmpty"),disableBeacon:!0,placement:"center"}]}const tx="af:onboarding";function Tse({page:e,hasNodes:t=!1}){const{t:n}=Sn(),[r,s]=m.useState(!1),[i,a]=m.useState([]),l=m.useRef(null),u=m.useMemo(()=>e==="projects"?Pse(n):t?Ase(n):Ise(n),[e,t,n]);return m.useEffect(()=>{const d=localStorage.getItem(tx);console.log("[Onboarding] localStorage:",d);const f=d?JSON.parse(d):{};if(console.log("[Onboarding] progress:",f,"page:",e),f.completed||f[e]){console.log("[Onboarding] skipped - already done"),s(!1),a([]);return}console.log("[Onboarding] starting with steps:",u),a(u),s(!0)},[e,t,u]),m.useEffect(()=>{if(!r)return;const d=f=>{var g;const c=f.target.closest("button");if(!c||!c.closest(".react-joyride__tooltip"))return;const h=(g=c.textContent)==null?void 0:g.trim();if(h===n("onboarding:done")||h===n("onboarding:startCreate")||h===n("onboarding:skip")){const v=localStorage.getItem(tx)||"{}",k=JSON.parse(v);h===n("onboarding:skip")?(k.projects=!0,k.flow=!0,k.completed=!0):k[e]=!0,localStorage.setItem(tx,JSON.stringify(k)),a([]),s(!1),e==="projects"&&(h===n("onboarding:done")||h===n("onboarding:startCreate"))&&(localStorage.setItem("af:newPipelineGuide","true"),setTimeout(()=>{const y=document.querySelector(".af-create-btn");y&&y.click()},500))}};return document.addEventListener("click",d,!0),()=>document.removeEventListener("click",d,!0)},[r,e,n]),!r||i.length===0?null:o.jsx(_se,{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 Rse(){const{navigate:e,path:t}=Ba(),[n,r]=m.useState([]),[s,i]=m.useState(!1);if(m.useEffect(()=>{let f=!1;const c=async()=>{try{const h=await fetch("/api/pipeline-recent-runs");if(!h.ok)return;const g=await h.json();if(f)return;const v=Array.isArray(g.runs)?g.runs:[];r(v.filter(k=>k&&k.status==="running"))}catch{}};c();const p=window.setInterval(c,3e3);return()=>{f=!0,window.clearInterval(p)}},[]),n.length===0)return null;const a=f=>{const c=new URLSearchParams({flowId:f.flowId,flowSource:f.flowSource||"workspace"});e(`/flow?${c.toString()}`),i(!1)},l=t==="/flow"?new URLSearchParams(window.location.search):null,u=(l==null?void 0:l.get("flowId"))||"",d=n.length===1;return o.jsxs("div",{className:"af-run-indicator",role:"status","aria-live":"polite",children:[s&&!d&&o.jsx("div",{className:"af-run-indicator__menu",onMouseLeave:()=>i(!1),children:n.map(f=>o.jsxs("button",{type:"button",className:"af-run-indicator__item"+(f.flowId===u?" af-run-indicator__item--current":""),onClick:()=>a(f),title:`${f.flowId} · ${f.runId}`,children:[o.jsx("span",{className:"af-run-indicator__dot"}),o.jsx("span",{className:"af-run-indicator__flow",children:f.flowId}),o.jsx("span",{className:"af-run-indicator__run",children:f.runId.slice(0,12)})]},`${f.flowId}:${f.runId}`))}),o.jsxs("button",{type:"button",className:"af-run-indicator__btn",onClick:()=>d?a(n[0]):i(f=>!f),title:d?`${n[0].flowId} 运行中,点击跳转`:`${n.length} 个 pipeline 运行中`,children:[o.jsx("span",{className:"af-run-indicator__pulse"}),o.jsx("span",{className:"af-run-indicator__label",children:d?n[0].flowId:`${n.length} running`})]})]})}class Lse 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 Ose({authUser:e}){const{path:t}=Ba();return t==="/projects"||t==="/"?o.jsx(ic,{authUser:e}):t==="/nodes"?o.jsx(ic,{authUser:e,resourceKind:"nodes"}):t==="/my-nodes"?o.jsx(ic,{authUser:e,resourceKind:"my-nodes"}):t==="/my-flows"?o.jsx(ic,{authUser:e,resourceKind:"my-flows"}):t==="/skills"?o.jsx(ic,{authUser:e,resourceKind:"skills"}):t==="/mcps"?o.jsx(kte,{}):t==="/flow"?o.jsx(XU,{}):t==="/workspace"?o.jsx(fq,{}):t==="/settings"?o.jsx(wte,{authUser:e}):t==="/feedback"?o.jsx(bte,{}):o.jsx(ic,{})}function Mse({children:e}){const[t,n]=m.useState({loading:!0,authenticated:!1,user:null,setupRequired:!1}),[r,s]=m.useState(""),[i,a]=m.useState(""),[l,u]=m.useState(!1),[d,f]=m.useState(""),c=async()=>{try{const g=await(await fetch("/api/auth/me")).json().catch(()=>({}));n({loading:!1,authenticated:!!g.authenticated,user:g.user||null,setupRequired:!!g.setupRequired}),f(g.error?String(g.error):"")}catch(h){n({loading:!1,authenticated:!1,user:null,setupRequired:!1}),f(String(h.message||h))}};m.useEffect(()=>{c()},[]);const p=async h=>{h.preventDefault(),u(!0),f("");try{const g=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:r,password:i})}),v=await g.json().catch(()=>({}));if(!g.ok)throw new Error(v.error||"登录失败");n({loading:!1,authenticated:!0,user:v.user||null,setupRequired:!1})}catch(g){f(String(g.message||g))}finally{u(!1)}};return t.loading?o.jsx("div",{className:"af-auth-screen",children:o.jsx("div",{className:"af-auth-panel",children:"Loading..."})}):t.authenticated?e({user:t.user,onLogout:async()=>{await fetch("/api/auth/logout",{method:"POST"}).catch(()=>{}),n({loading:!1,authenticated:!1,user:null,setupRequired:!1})}}):o.jsx("div",{className:"af-auth-screen",children:o.jsxs("form",{className:"af-auth-panel",onSubmit:p,children:[o.jsxs("div",{className:"af-auth-brand",children:[o.jsx("span",{className:"material-symbols-outlined",children:"account_circle"}),o.jsxs("div",{children:[o.jsx("h1",{children:"AgentFlow"}),o.jsx("p",{children:t.setupRequired?"初始化管理员账号":"登录或创建用户"})]})]}),o.jsxs("label",{className:"af-auth-field",children:[o.jsx("span",{children:"用户名"}),o.jsx("input",{value:r,onChange:h=>s(h.target.value),autoComplete:"username",autoFocus:!0})]}),o.jsxs("label",{className:"af-auth-field",children:[o.jsx("span",{children:"密码"}),o.jsx("input",{type:"password",value:i,onChange:h=>a(h.target.value),autoComplete:t.setupRequired?"new-password":"current-password"})]}),d?o.jsx("p",{className:"af-auth-error",children:d}):null,o.jsx("button",{className:"af-auth-submit",type:"submit",disabled:l||!r.trim()||i.length<4,children:l?"处理中...":t.setupRequired?"创建并登录":"登录"})]})})}function $se({authUser:e,onLogout:t}){const{path:n}=Ba(),r=n==="/flow"||n==="/workspace";return o.jsxs("div",{className:"af-app",children:[n!=="/settings"?o.jsx(Tse,{page:r?"flow":"projects"}):null,r?null:o.jsx(DO,{authUser:e,onLogout:t}),o.jsx("div",{className:r?"af-main af-main--pipeline":"af-main",children:o.jsx(Ose,{authUser:e})}),o.jsx(Rse,{})]})}function Dse(){return o.jsx(Lse,{children:o.jsx(wO,{children:o.jsx(Mse,{children:({user:e,onLogout:t})=>o.jsx($se,{authUser:e,onLogout:t})})})})}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 _1=document.querySelector('link[rel="icon"]');_1&&(_1.href=VE);nx.createRoot(document.getElementById("root")).render(o.jsx(ot.StrictMode,{children:o.jsx(Dse,{})}));
|