@fieldwangai/agentflow 0.1.62 → 0.1.64
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/ui-server.mjs +235 -168
- package/builtin/web-ui/dist/assets/index-BFZ6_IPB.css +1 -0
- package/builtin/web-ui/dist/assets/index-CJFXWvjB.js +264 -0
- package/builtin/web-ui/dist/index.html +2 -2
- package/package.json +1 -1
- package/builtin/web-ui/dist/assets/index-CyyeTRvo.js +0 -254
- package/builtin/web-ui/dist/assets/index-Db5Z0V8r.css +0 -1
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
var MR=Object.defineProperty;var OR=(e,t,n)=>t in e?MR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var sr=(e,t,n)=>OR(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 bf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function hl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var RC={exports:{}},Ag={},LC={exports:{}},Ot={};/**
|
|
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 ap=Symbol.for("react.element"),$R=Symbol.for("react.portal"),DR=Symbol.for("react.fragment"),FR=Symbol.for("react.strict_mode"),zR=Symbol.for("react.profiler"),HR=Symbol.for("react.provider"),BR=Symbol.for("react.context"),WR=Symbol.for("react.forward_ref"),VR=Symbol.for("react.suspense"),UR=Symbol.for("react.memo"),KR=Symbol.for("react.lazy"),pk=Symbol.iterator;function qR(e){return e===null||typeof e!="object"?null:(e=pk&&e[pk]||e["@@iterator"],typeof e=="function"?e:null)}var MC={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},OC=Object.assign,$C={};function Uu(e,t,n){this.props=e,this.context=t,this.refs=$C,this.updater=n||MC}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 DC(){}DC.prototype=Uu.prototype;function Xb(e,t,n){this.props=e,this.context=t,this.refs=$C,this.updater=n||MC}var Jb=Xb.prototype=new DC;Jb.constructor=Xb;OC(Jb,Uu.prototype);Jb.isPureReactComponent=!0;var hk=Array.isArray,FC=Object.prototype.hasOwnProperty,Qb={current:null},zC={key:!0,ref:!0,__self:!0,__source:!0};function HC(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)FC.call(t,r)&&!zC.hasOwnProperty(r)&&(s[r]=t[r]);var l=arguments.length-2;if(l===1)s.children=n;else if(1<l){for(var c=Array(l),d=0;d<l;d++)c[d]=arguments[d+2];s.children=c}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)s[r]===void 0&&(s[r]=l[r]);return{$$typeof:ap,type:e,key:i,ref:a,props:s,_owner:Qb.current}}function YR(e,t){return{$$typeof:ap,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Zb(e){return typeof e=="object"&&e!==null&&e.$$typeof===ap}function GR(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var mk=/\/+/g;function Iy(e,t){return typeof e=="object"&&e!==null&&e.key!=null?GR(""+e.key):t.toString(36)}function Xh(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 ap:case $R:a=!0}}if(a)return a=e,s=s(a),e=r===""?"."+Iy(a,0):r,hk(s)?(n="",e!=null&&(n=e.replace(mk,"$&/")+"/"),Xh(s,t,n,"",function(d){return d})):s!=null&&(Zb(s)&&(s=YR(s,n+(!s.key||a&&a.key===s.key?"":(""+s.key).replace(mk,"$&/")+"/")+e)),t.push(s)),1;if(a=0,r=r===""?".":r+":",hk(e))for(var l=0;l<e.length;l++){i=e[l];var c=r+Iy(i,l);a+=Xh(i,t,n,c,s)}else if(c=qR(e),typeof c=="function")for(e=c.call(e),l=0;!(i=e.next()).done;)i=i.value,c=r+Iy(i,l++),a+=Xh(i,t,n,c,s);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return a}function sh(e,t,n){if(e==null)return e;var r=[],s=0;return Xh(e,r,"","",function(i){return t.call(n,i,s++)}),r}function XR(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 gs={current:null},Jh={transition:null},JR={ReactCurrentDispatcher:gs,ReactCurrentBatchConfig:Jh,ReactCurrentOwner:Qb};function BC(){throw Error("act(...) is not supported in production builds of React.")}Ot.Children={map:sh,forEach:function(e,t,n){sh(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return sh(e,function(){t++}),t},toArray:function(e){return sh(e,function(t){return t})||[]},only:function(e){if(!Zb(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ot.Component=Uu;Ot.Fragment=DR;Ot.Profiler=zR;Ot.PureComponent=Xb;Ot.StrictMode=FR;Ot.Suspense=VR;Ot.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=JR;Ot.act=BC;Ot.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=OC({},e.props),s=e.key,i=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,a=Qb.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)FC.call(t,c)&&!zC.hasOwnProperty(c)&&(r[c]=t[c]===void 0&&l!==void 0?l[c]:t[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){l=Array(c);for(var d=0;d<c;d++)l[d]=arguments[d+2];r.children=l}return{$$typeof:ap,type:e.type,key:s,ref:i,props:r,_owner:a}};Ot.createContext=function(e){return e={$$typeof:BR,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:HR,_context:e},e.Consumer=e};Ot.createElement=HC;Ot.createFactory=function(e){var t=HC.bind(null,e);return t.type=e,t};Ot.createRef=function(){return{current:null}};Ot.forwardRef=function(e){return{$$typeof:WR,render:e}};Ot.isValidElement=Zb;Ot.lazy=function(e){return{$$typeof:KR,_payload:{_status:-1,_result:e},_init:XR}};Ot.memo=function(e,t){return{$$typeof:UR,type:e,compare:t===void 0?null:t}};Ot.startTransition=function(e){var t=Jh.transition;Jh.transition={};try{e()}finally{Jh.transition=t}};Ot.unstable_act=BC;Ot.useCallback=function(e,t){return gs.current.useCallback(e,t)};Ot.useContext=function(e){return gs.current.useContext(e)};Ot.useDebugValue=function(){};Ot.useDeferredValue=function(e){return gs.current.useDeferredValue(e)};Ot.useEffect=function(e,t){return gs.current.useEffect(e,t)};Ot.useId=function(){return gs.current.useId()};Ot.useImperativeHandle=function(e,t,n){return gs.current.useImperativeHandle(e,t,n)};Ot.useInsertionEffect=function(e,t){return gs.current.useInsertionEffect(e,t)};Ot.useLayoutEffect=function(e,t){return gs.current.useLayoutEffect(e,t)};Ot.useMemo=function(e,t){return gs.current.useMemo(e,t)};Ot.useReducer=function(e,t,n){return gs.current.useReducer(e,t,n)};Ot.useRef=function(e){return gs.current.useRef(e)};Ot.useState=function(e){return gs.current.useState(e)};Ot.useSyncExternalStore=function(e,t,n){return gs.current.useSyncExternalStore(e,t,n)};Ot.useTransition=function(){return gs.current.useTransition()};Ot.version="18.3.1";LC.exports=Ot;var h=LC.exports;const ct=hl(h);/**
|
|
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 QR=h,ZR=Symbol.for("react.element"),eL=Symbol.for("react.fragment"),tL=Object.prototype.hasOwnProperty,nL=QR.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,rL={key:!0,ref:!0,__self:!0,__source:!0};function WC(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)tL.call(t,r)&&!rL.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:ZR,type:e,key:i,ref:a,props:s,_owner:nL.current}}Ag.Fragment=eL;Ag.jsx=WC;Ag.jsxs=WC;RC.exports=Ag;var o=RC.exports,Zx={},VC={exports:{}},oi={},UC={exports:{}},KC={};/**
|
|
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 E=P.length;P.push(L);e:for(;0<E;){var X=E-1>>>1,ee=P[X];if(0<s(ee,L))P[X]=L,P[E]=ee,E=X;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],E=P.pop();if(E!==L){P[0]=E;e:for(var X=0,ee=P.length,V=ee>>>1;X<V;){var ie=2*(X+1)-1,fe=P[ie],me=ie+1,ge=P[me];if(0>s(fe,E))me<ee&&0>s(ge,fe)?(P[X]=ge,P[me]=E,X=me):(P[X]=fe,P[ie]=E,X=ie);else if(me<ee&&0>s(ge,E))P[X]=ge,P[me]=E,X=me;else break e}}return L}function s(P,L){var E=P.sortIndex-L.sortIndex;return E!==0?E: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 c=[],d=[],f=1,u=null,p=3,m=!1,y=!1,b=!1,k=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(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(c,L);else break;L=n(d)}}function N(P){if(b=!1,x(P),!y)if(n(c)!==null)y=!0,I(_);else{var L=n(d);L!==null&&z(N,L.startTime-P)}}function _(P,L){y=!1,b&&(b=!1,g(H),H=-1),m=!0;var E=p;try{for(x(L),u=n(c);u!==null&&(!(u.expirationTime>L)||P&&!D());){var X=u.callback;if(typeof X=="function"){u.callback=null,p=u.priorityLevel;var ee=X(u.expirationTime<=L);L=e.unstable_now(),typeof ee=="function"?u.callback=ee:u===n(c)&&r(c),x(L)}else r(c);u=n(c)}if(u!==null)var V=!0;else{var ie=n(d);ie!==null&&z(N,ie.startTime-L),V=!1}return V}finally{u=null,p=E,m=!1}}var C=!1,T=null,H=-1,M=5,F=-1;function D(){return!(e.unstable_now()-F<M)}function $(){if(T!==null){var P=e.unstable_now();F=P;var L=!0;try{L=T(!0,P)}finally{L?W():(C=!1,T=null)}}else C=!1}var W;if(typeof v=="function")W=function(){v($)};else if(typeof MessageChannel<"u"){var O=new MessageChannel,R=O.port2;O.port1.onmessage=$,W=function(){R.postMessage(null)}}else W=function(){k($,0)};function I(P){T=P,C||(C=!0,W())}function z(P,L){H=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(){y||m||(y=!0,I(_))},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(c)},e.unstable_next=function(P){switch(p){case 1:case 2:case 3:var L=3;break;default:L=p}var E=p;p=L;try{return P()}finally{p=E}},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 E=p;p=P;try{return L()}finally{p=E}},e.unstable_scheduleCallback=function(P,L,E){var X=e.unstable_now();switch(typeof E=="object"&&E!==null?(E=E.delay,E=typeof E=="number"&&0<E?X+E:X):E=X,P){case 1:var ee=-1;break;case 2:ee=250;break;case 5:ee=1073741823;break;case 4:ee=1e4;break;default:ee=5e3}return ee=E+ee,P={id:f++,callback:L,priorityLevel:P,startTime:E,expirationTime:ee,sortIndex:-1},E>X?(P.sortIndex=E,t(d,P),n(c)===null&&P===n(d)&&(b?(g(H),H=-1):b=!0,z(N,E-X))):(P.sortIndex=ee,t(c,P),y||m||(y=!0,I(_))),P},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(P){var L=p;return function(){var E=p;p=L;try{return P.apply(this,arguments)}finally{p=E}}}})(KC);UC.exports=KC;var sL=UC.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 iL=h,si=sL;function Ee(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 qC=new Set,vf={};function yc(e,t){ku(e,t),ku(e+"Capture",t)}function ku(e,t){for(vf[e]=t,e=0;e<t.length;e++)qC.add(t[e])}var la=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ew=Object.prototype.hasOwnProperty,oL=/^[: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]*$/,gk={},yk={};function aL(e){return ew.call(yk,e)?!0:ew.call(gk,e)?!1:oL.test(e)?yk[e]=!0:(gk[e]=!0,!1)}function lL(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 cL(e,t,n,r){if(t===null||typeof t>"u"||lL(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 ys(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 Br={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Br[e]=new ys(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Br[t]=new ys(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Br[e]=new ys(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Br[e]=new ys(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){Br[e]=new ys(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Br[e]=new ys(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Br[e]=new ys(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Br[e]=new ys(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Br[e]=new ys(e,5,!1,e.toLowerCase(),null,!1,!1)});var ev=/[\-:]([a-z])/g;function tv(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(ev,tv);Br[t]=new ys(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(ev,tv);Br[t]=new ys(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(ev,tv);Br[t]=new ys(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Br[e]=new ys(e,1,!1,e.toLowerCase(),null,!1,!1)});Br.xlinkHref=new ys("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Br[e]=new ys(e,1,!1,e.toLowerCase(),null,!0,!0)});function nv(e,t,n,r){var s=Br.hasOwnProperty(t)?Br[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(cL(t,n,s,r)&&(n=null),r||s===null?aL(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 ma=iL.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,ih=Symbol.for("react.element"),Kc=Symbol.for("react.portal"),qc=Symbol.for("react.fragment"),rv=Symbol.for("react.strict_mode"),tw=Symbol.for("react.profiler"),YC=Symbol.for("react.provider"),GC=Symbol.for("react.context"),sv=Symbol.for("react.forward_ref"),nw=Symbol.for("react.suspense"),rw=Symbol.for("react.suspense_list"),iv=Symbol.for("react.memo"),Fa=Symbol.for("react.lazy"),XC=Symbol.for("react.offscreen"),xk=Symbol.iterator;function Cd(e){return e===null||typeof e!="object"?null:(e=xk&&e[xk]||e["@@iterator"],typeof e=="function"?e:null)}var Qn=Object.assign,Ty;function Vd(e){if(Ty===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Ty=t&&t[1]||""}return`
|
|
34
|
+
`+Ty+e}var Ry=!1;function Ly(e,t){if(!e||Ry)return"";Ry=!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 c=`
|
|
37
|
+
`+s[a].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=a&&0<=l);break}}}finally{Ry=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Vd(e):""}function uL(e){switch(e.tag){case 5:return Vd(e.type);case 16:return Vd("Lazy");case 13:return Vd("Suspense");case 19:return Vd("SuspenseList");case 0:case 2:case 15:return e=Ly(e.type,!1),e;case 11:return e=Ly(e.type.render,!1),e;case 1:return e=Ly(e.type,!0),e;default:return""}}function sw(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 qc:return"Fragment";case Kc:return"Portal";case tw:return"Profiler";case rv:return"StrictMode";case nw:return"Suspense";case rw:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case GC:return(e.displayName||"Context")+".Consumer";case YC:return(e._context.displayName||"Context")+".Provider";case sv:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case iv:return t=e.displayName||null,t!==null?t:sw(e.type)||"Memo";case Fa:t=e._payload,e=e._init;try{return sw(e(t))}catch{}}return null}function dL(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 sw(t);case 8:return t===rv?"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 al(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function JC(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function fL(e){var t=JC(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 oh(e){e._valueTracker||(e._valueTracker=fL(e))}function QC(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=JC(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function vm(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 iw(e,t){var n=t.checked;return Qn({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function wk(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=al(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 ZC(e,t){t=t.checked,t!=null&&nv(e,"checked",t,!1)}function ow(e,t){ZC(e,t);var n=al(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")?aw(e,t.type,n):t.hasOwnProperty("defaultValue")&&aw(e,t.type,al(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function bk(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 aw(e,t,n){(t!=="number"||vm(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Ud=Array.isArray;function uu(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=""+al(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 lw(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(Ee(91));return Qn({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function vk(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(Ee(92));if(Ud(n)){if(1<n.length)throw Error(Ee(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:al(n)}}function eE(e,t){var n=al(t.value),r=al(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 kk(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function tE(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 cw(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?tE(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var ah,nE=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(ah=ah||document.createElement("div"),ah.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=ah.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function kf(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var tf={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},pL=["Webkit","ms","Moz","O"];Object.keys(tf).forEach(function(e){pL.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),tf[t]=tf[e]})});function rE(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||tf.hasOwnProperty(e)&&tf[e]?(""+t).trim():t+"px"}function sE(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=rE(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var hL=Qn({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 uw(e,t){if(t){if(hL[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Ee(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Ee(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Ee(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Ee(62))}}function dw(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 fw=null;function ov(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var pw=null,du=null,fu=null;function Sk(e){if(e=up(e)){if(typeof pw!="function")throw Error(Ee(280));var t=e.stateNode;t&&(t=Mg(t),pw(e.stateNode,e.type,t))}}function iE(e){du?fu?fu.push(e):fu=[e]:du=e}function oE(){if(du){var e=du,t=fu;if(fu=du=null,Sk(e),t)for(e=0;e<t.length;e++)Sk(t[e])}}function aE(e,t){return e(t)}function lE(){}var My=!1;function cE(e,t,n){if(My)return e(t,n);My=!0;try{return aE(e,t,n)}finally{My=!1,(du!==null||fu!==null)&&(lE(),oE())}}function Sf(e,t){var n=e.stateNode;if(n===null)return null;var r=Mg(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(Ee(231,t,typeof n));return n}var hw=!1;if(la)try{var Ed={};Object.defineProperty(Ed,"passive",{get:function(){hw=!0}}),window.addEventListener("test",Ed,Ed),window.removeEventListener("test",Ed,Ed)}catch{hw=!1}function mL(e,t,n,r,s,i,a,l,c){var d=Array.prototype.slice.call(arguments,3);try{t.apply(n,d)}catch(f){this.onError(f)}}var nf=!1,km=null,Sm=!1,mw=null,gL={onError:function(e){nf=!0,km=e}};function yL(e,t,n,r,s,i,a,l,c){nf=!1,km=null,mL.apply(gL,arguments)}function xL(e,t,n,r,s,i,a,l,c){if(yL.apply(this,arguments),nf){if(nf){var d=km;nf=!1,km=null}else throw Error(Ee(198));Sm||(Sm=!0,mw=d)}}function xc(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 uE(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 Nk(e){if(xc(e)!==e)throw Error(Ee(188))}function wL(e){var t=e.alternate;if(!t){if(t=xc(e),t===null)throw Error(Ee(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 Nk(s),e;if(i===r)return Nk(s),t;i=i.sibling}throw Error(Ee(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(Ee(189))}}if(n.alternate!==r)throw Error(Ee(190))}if(n.tag!==3)throw Error(Ee(188));return n.stateNode.current===n?e:t}function dE(e){return e=wL(e),e!==null?fE(e):null}function fE(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=fE(e);if(t!==null)return t;e=e.sibling}return null}var pE=si.unstable_scheduleCallback,jk=si.unstable_cancelCallback,bL=si.unstable_shouldYield,vL=si.unstable_requestPaint,pr=si.unstable_now,kL=si.unstable_getCurrentPriorityLevel,av=si.unstable_ImmediatePriority,hE=si.unstable_UserBlockingPriority,Nm=si.unstable_NormalPriority,SL=si.unstable_LowPriority,mE=si.unstable_IdlePriority,Ig=null,jo=null;function NL(e){if(jo&&typeof jo.onCommitFiberRoot=="function")try{jo.onCommitFiberRoot(Ig,e,void 0,(e.current.flags&128)===128)}catch{}}var Ji=Math.clz32?Math.clz32:EL,jL=Math.log,CL=Math.LN2;function EL(e){return e>>>=0,e===0?32:31-(jL(e)/CL|0)|0}var lh=64,ch=4194304;function Kd(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 jm(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=Kd(l):(i&=a,i!==0&&(r=Kd(i)))}else a=n&~s,a!==0?r=Kd(a):i!==0&&(r=Kd(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-Ji(t),s=1<<n,r|=e[n],t&=~s;return r}function _L(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 PL(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes;0<i;){var a=31-Ji(i),l=1<<a,c=s[a];c===-1?(!(l&n)||l&r)&&(s[a]=_L(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}}function gw(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function gE(){var e=lh;return lh<<=1,!(lh&4194240)&&(lh=64),e}function Oy(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function lp(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ji(t),e[t]=n}function AL(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-Ji(n),i=1<<s;t[s]=0,r[s]=-1,e[s]=-1,n&=~i}}function lv(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ji(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}var pn=0;function yE(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var xE,cv,wE,bE,vE,yw=!1,uh=[],Ga=null,Xa=null,Ja=null,Nf=new Map,jf=new Map,Ba=[],IL="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 Ck(e,t){switch(e){case"focusin":case"focusout":Ga=null;break;case"dragenter":case"dragleave":Xa=null;break;case"mouseover":case"mouseout":Ja=null;break;case"pointerover":case"pointerout":Nf.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":jf.delete(t.pointerId)}}function _d(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=up(t),t!==null&&cv(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function TL(e,t,n,r,s){switch(t){case"focusin":return Ga=_d(Ga,e,t,n,r,s),!0;case"dragenter":return Xa=_d(Xa,e,t,n,r,s),!0;case"mouseover":return Ja=_d(Ja,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return Nf.set(i,_d(Nf.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,jf.set(i,_d(jf.get(i)||null,e,t,n,r,s)),!0}return!1}function kE(e){var t=Yl(e.target);if(t!==null){var n=xc(t);if(n!==null){if(t=n.tag,t===13){if(t=uE(n),t!==null){e.blockedOn=t,vE(e.priority,function(){wE(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 Qh(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=xw(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);fw=r,n.target.dispatchEvent(r),fw=null}else return t=up(n),t!==null&&cv(t),e.blockedOn=n,!1;t.shift()}return!0}function Ek(e,t,n){Qh(e)&&n.delete(t)}function RL(){yw=!1,Ga!==null&&Qh(Ga)&&(Ga=null),Xa!==null&&Qh(Xa)&&(Xa=null),Ja!==null&&Qh(Ja)&&(Ja=null),Nf.forEach(Ek),jf.forEach(Ek)}function Pd(e,t){e.blockedOn===t&&(e.blockedOn=null,yw||(yw=!0,si.unstable_scheduleCallback(si.unstable_NormalPriority,RL)))}function Cf(e){function t(s){return Pd(s,e)}if(0<uh.length){Pd(uh[0],e);for(var n=1;n<uh.length;n++){var r=uh[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Ga!==null&&Pd(Ga,e),Xa!==null&&Pd(Xa,e),Ja!==null&&Pd(Ja,e),Nf.forEach(t),jf.forEach(t),n=0;n<Ba.length;n++)r=Ba[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Ba.length&&(n=Ba[0],n.blockedOn===null);)kE(n),n.blockedOn===null&&Ba.shift()}var pu=ma.ReactCurrentBatchConfig,Cm=!0;function LL(e,t,n,r){var s=pn,i=pu.transition;pu.transition=null;try{pn=1,uv(e,t,n,r)}finally{pn=s,pu.transition=i}}function ML(e,t,n,r){var s=pn,i=pu.transition;pu.transition=null;try{pn=4,uv(e,t,n,r)}finally{pn=s,pu.transition=i}}function uv(e,t,n,r){if(Cm){var s=xw(e,t,n,r);if(s===null)Ky(e,t,r,Em,n),Ck(e,r);else if(TL(s,e,t,n,r))r.stopPropagation();else if(Ck(e,r),t&4&&-1<IL.indexOf(e)){for(;s!==null;){var i=up(s);if(i!==null&&xE(i),i=xw(e,t,n,r),i===null&&Ky(e,t,r,Em,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else Ky(e,t,r,null,n)}}var Em=null;function xw(e,t,n,r){if(Em=null,e=ov(r),e=Yl(e),e!==null)if(t=xc(e),t===null)e=null;else if(n=t.tag,n===13){if(e=uE(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 Em=e,null}function SE(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(kL()){case av:return 1;case hE:return 4;case Nm:case SL:return 16;case mE:return 536870912;default:return 16}default:return 16}}var Ua=null,dv=null,Zh=null;function NE(){if(Zh)return Zh;var e,t=dv,n=t.length,r,s="value"in Ua?Ua.value:Ua.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 Zh=s.slice(e,1<r?1-r:void 0)}function em(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 dh(){return!0}function _k(){return!1}function ai(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)?dh:_k,this.isPropagationStopped=_k,this}return Qn(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=dh)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=dh)},persist:function(){},isPersistent:dh}),t}var Ku={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},fv=ai(Ku),cp=Qn({},Ku,{view:0,detail:0}),OL=ai(cp),$y,Dy,Ad,Tg=Qn({},cp,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:pv,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!==Ad&&(Ad&&e.type==="mousemove"?($y=e.screenX-Ad.screenX,Dy=e.screenY-Ad.screenY):Dy=$y=0,Ad=e),$y)},movementY:function(e){return"movementY"in e?e.movementY:Dy}}),Pk=ai(Tg),$L=Qn({},Tg,{dataTransfer:0}),DL=ai($L),FL=Qn({},cp,{relatedTarget:0}),Fy=ai(FL),zL=Qn({},Ku,{animationName:0,elapsedTime:0,pseudoElement:0}),HL=ai(zL),BL=Qn({},Ku,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),WL=ai(BL),VL=Qn({},Ku,{data:0}),Ak=ai(VL),UL={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},KL={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"},qL={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function YL(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=qL[e])?!!t[e]:!1}function pv(){return YL}var GL=Qn({},cp,{key:function(e){if(e.key){var t=UL[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=em(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?KL[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:pv,charCode:function(e){return e.type==="keypress"?em(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?em(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),XL=ai(GL),JL=Qn({},Tg,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ik=ai(JL),QL=Qn({},cp,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:pv}),ZL=ai(QL),eM=Qn({},Ku,{propertyName:0,elapsedTime:0,pseudoElement:0}),tM=ai(eM),nM=Qn({},Tg,{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}),rM=ai(nM),sM=[9,13,27,32],hv=la&&"CompositionEvent"in window,rf=null;la&&"documentMode"in document&&(rf=document.documentMode);var iM=la&&"TextEvent"in window&&!rf,jE=la&&(!hv||rf&&8<rf&&11>=rf),Tk=" ",Rk=!1;function CE(e,t){switch(e){case"keyup":return sM.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function EE(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Yc=!1;function oM(e,t){switch(e){case"compositionend":return EE(t);case"keypress":return t.which!==32?null:(Rk=!0,Tk);case"textInput":return e=t.data,e===Tk&&Rk?null:e;default:return null}}function aM(e,t){if(Yc)return e==="compositionend"||!hv&&CE(e,t)?(e=NE(),Zh=dv=Ua=null,Yc=!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 jE&&t.locale!=="ko"?null:t.data;default:return null}}var lM={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 Lk(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!lM[e.type]:t==="textarea"}function _E(e,t,n,r){iE(r),t=_m(t,"onChange"),0<t.length&&(n=new fv("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var sf=null,Ef=null;function cM(e){FE(e,0)}function Rg(e){var t=Jc(e);if(QC(t))return e}function uM(e,t){if(e==="change")return t}var PE=!1;if(la){var zy;if(la){var Hy="oninput"in document;if(!Hy){var Mk=document.createElement("div");Mk.setAttribute("oninput","return;"),Hy=typeof Mk.oninput=="function"}zy=Hy}else zy=!1;PE=zy&&(!document.documentMode||9<document.documentMode)}function Ok(){sf&&(sf.detachEvent("onpropertychange",AE),Ef=sf=null)}function AE(e){if(e.propertyName==="value"&&Rg(Ef)){var t=[];_E(t,Ef,e,ov(e)),cE(cM,t)}}function dM(e,t,n){e==="focusin"?(Ok(),sf=t,Ef=n,sf.attachEvent("onpropertychange",AE)):e==="focusout"&&Ok()}function fM(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Rg(Ef)}function pM(e,t){if(e==="click")return Rg(t)}function hM(e,t){if(e==="input"||e==="change")return Rg(t)}function mM(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Zi=typeof Object.is=="function"?Object.is:mM;function _f(e,t){if(Zi(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(!ew.call(t,s)||!Zi(e[s],t[s]))return!1}return!0}function $k(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Dk(e,t){var n=$k(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=$k(n)}}function IE(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?IE(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function TE(){for(var e=window,t=vm();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=vm(e.document)}return t}function mv(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 gM(e){var t=TE(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&IE(n.ownerDocument.documentElement,n)){if(r!==null&&mv(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=Dk(n,i);var a=Dk(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 yM=la&&"documentMode"in document&&11>=document.documentMode,Gc=null,ww=null,of=null,bw=!1;function Fk(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;bw||Gc==null||Gc!==vm(r)||(r=Gc,"selectionStart"in r&&mv(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}),of&&_f(of,r)||(of=r,r=_m(ww,"onSelect"),0<r.length&&(t=new fv("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Gc)))}function fh(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Xc={animationend:fh("Animation","AnimationEnd"),animationiteration:fh("Animation","AnimationIteration"),animationstart:fh("Animation","AnimationStart"),transitionend:fh("Transition","TransitionEnd")},By={},RE={};la&&(RE=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 Lg(e){if(By[e])return By[e];if(!Xc[e])return e;var t=Xc[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in RE)return By[e]=t[n];return e}var LE=Lg("animationend"),ME=Lg("animationiteration"),OE=Lg("animationstart"),$E=Lg("transitionend"),DE=new Map,zk="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 ml(e,t){DE.set(e,t),yc(t,[e])}for(var Wy=0;Wy<zk.length;Wy++){var Vy=zk[Wy],xM=Vy.toLowerCase(),wM=Vy[0].toUpperCase()+Vy.slice(1);ml(xM,"on"+wM)}ml(LE,"onAnimationEnd");ml(ME,"onAnimationIteration");ml(OE,"onAnimationStart");ml("dblclick","onDoubleClick");ml("focusin","onFocus");ml("focusout","onBlur");ml($E,"onTransitionEnd");ku("onMouseEnter",["mouseout","mouseover"]);ku("onMouseLeave",["mouseout","mouseover"]);ku("onPointerEnter",["pointerout","pointerover"]);ku("onPointerLeave",["pointerout","pointerover"]);yc("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));yc("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));yc("onBeforeInput",["compositionend","keypress","textInput","paste"]);yc("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));yc("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));yc("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var qd="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(" "),bM=new Set("cancel close invalid load scroll toggle".split(" ").concat(qd));function Hk(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,xL(r,t,void 0,e),e.currentTarget=null}function FE(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],s=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var a=r.length-1;0<=a;a--){var l=r[a],c=l.instance,d=l.currentTarget;if(l=l.listener,c!==i&&s.isPropagationStopped())break e;Hk(s,l,d),i=c}else for(a=0;a<r.length;a++){if(l=r[a],c=l.instance,d=l.currentTarget,l=l.listener,c!==i&&s.isPropagationStopped())break e;Hk(s,l,d),i=c}}}if(Sm)throw e=mw,Sm=!1,mw=null,e}function Dn(e,t){var n=t[jw];n===void 0&&(n=t[jw]=new Set);var r=e+"__bubble";n.has(r)||(zE(t,e,2,!1),n.add(r))}function Uy(e,t,n){var r=0;t&&(r|=4),zE(n,e,r,t)}var ph="_reactListening"+Math.random().toString(36).slice(2);function Pf(e){if(!e[ph]){e[ph]=!0,qC.forEach(function(n){n!=="selectionchange"&&(bM.has(n)||Uy(n,!1,e),Uy(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ph]||(t[ph]=!0,Uy("selectionchange",!1,t))}}function zE(e,t,n,r){switch(SE(t)){case 1:var s=LL;break;case 4:s=ML;break;default:s=uv}n=s.bind(null,t,n,e),s=void 0,!hw||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 Ky(e,t,n,r,s){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var a=r.tag;if(a===3||a===4){var l=r.stateNode.containerInfo;if(l===s||l.nodeType===8&&l.parentNode===s)break;if(a===4)for(a=r.return;a!==null;){var c=a.tag;if((c===3||c===4)&&(c=a.stateNode.containerInfo,c===s||c.nodeType===8&&c.parentNode===s))return;a=a.return}for(;l!==null;){if(a=Yl(l),a===null)return;if(c=a.tag,c===5||c===6){r=i=a;continue e}l=l.parentNode}}r=r.return}cE(function(){var d=i,f=ov(n),u=[];e:{var p=DE.get(e);if(p!==void 0){var m=fv,y=e;switch(e){case"keypress":if(em(n)===0)break e;case"keydown":case"keyup":m=XL;break;case"focusin":y="focus",m=Fy;break;case"focusout":y="blur",m=Fy;break;case"beforeblur":case"afterblur":m=Fy;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":m=Pk;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=DL;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=ZL;break;case LE:case ME:case OE:m=HL;break;case $E:m=tM;break;case"scroll":m=OL;break;case"wheel":m=rM;break;case"copy":case"cut":case"paste":m=WL;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=Ik}var b=(t&4)!==0,k=!b&&e==="scroll",g=b?p!==null?p+"Capture":null:p;b=[];for(var v=d,x;v!==null;){x=v;var N=x.stateNode;if(x.tag===5&&N!==null&&(x=N,g!==null&&(N=Sf(v,g),N!=null&&b.push(Af(v,N,x)))),k)break;v=v.return}0<b.length&&(p=new m(p,y,null,n,f),u.push({event:p,listeners:b}))}}if(!(t&7)){e:{if(p=e==="mouseover"||e==="pointerover",m=e==="mouseout"||e==="pointerout",p&&n!==fw&&(y=n.relatedTarget||n.fromElement)&&(Yl(y)||y[ca]))break e;if((m||p)&&(p=f.window===f?f:(p=f.ownerDocument)?p.defaultView||p.parentWindow:window,m?(y=n.relatedTarget||n.toElement,m=d,y=y?Yl(y):null,y!==null&&(k=xc(y),y!==k||y.tag!==5&&y.tag!==6)&&(y=null)):(m=null,y=d),m!==y)){if(b=Pk,N="onMouseLeave",g="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(b=Ik,N="onPointerLeave",g="onPointerEnter",v="pointer"),k=m==null?p:Jc(m),x=y==null?p:Jc(y),p=new b(N,v+"leave",m,n,f),p.target=k,p.relatedTarget=x,N=null,Yl(f)===d&&(b=new b(g,v+"enter",y,n,f),b.target=x,b.relatedTarget=k,N=b),k=N,m&&y)t:{for(b=m,g=y,v=0,x=b;x;x=Mc(x))v++;for(x=0,N=g;N;N=Mc(N))x++;for(;0<v-x;)b=Mc(b),v--;for(;0<x-v;)g=Mc(g),x--;for(;v--;){if(b===g||g!==null&&b===g.alternate)break t;b=Mc(b),g=Mc(g)}b=null}else b=null;m!==null&&Bk(u,p,m,b,!1),y!==null&&k!==null&&Bk(u,k,y,b,!0)}}e:{if(p=d?Jc(d):window,m=p.nodeName&&p.nodeName.toLowerCase(),m==="select"||m==="input"&&p.type==="file")var _=uM;else if(Lk(p))if(PE)_=hM;else{_=fM;var C=dM}else(m=p.nodeName)&&m.toLowerCase()==="input"&&(p.type==="checkbox"||p.type==="radio")&&(_=pM);if(_&&(_=_(e,d))){_E(u,_,n,f);break e}C&&C(e,p,d),e==="focusout"&&(C=p._wrapperState)&&C.controlled&&p.type==="number"&&aw(p,"number",p.value)}switch(C=d?Jc(d):window,e){case"focusin":(Lk(C)||C.contentEditable==="true")&&(Gc=C,ww=d,of=null);break;case"focusout":of=ww=Gc=null;break;case"mousedown":bw=!0;break;case"contextmenu":case"mouseup":case"dragend":bw=!1,Fk(u,n,f);break;case"selectionchange":if(yM)break;case"keydown":case"keyup":Fk(u,n,f)}var T;if(hv)e:{switch(e){case"compositionstart":var H="onCompositionStart";break e;case"compositionend":H="onCompositionEnd";break e;case"compositionupdate":H="onCompositionUpdate";break e}H=void 0}else Yc?CE(e,n)&&(H="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(H="onCompositionStart");H&&(jE&&n.locale!=="ko"&&(Yc||H!=="onCompositionStart"?H==="onCompositionEnd"&&Yc&&(T=NE()):(Ua=f,dv="value"in Ua?Ua.value:Ua.textContent,Yc=!0)),C=_m(d,H),0<C.length&&(H=new Ak(H,e,null,n,f),u.push({event:H,listeners:C}),T?H.data=T:(T=EE(n),T!==null&&(H.data=T)))),(T=iM?oM(e,n):aM(e,n))&&(d=_m(d,"onBeforeInput"),0<d.length&&(f=new Ak("onBeforeInput","beforeinput",null,n,f),u.push({event:f,listeners:d}),f.data=T))}FE(u,t)})}function Af(e,t,n){return{instance:e,listener:t,currentTarget:n}}function _m(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=Sf(e,n),i!=null&&r.unshift(Af(e,i,s)),i=Sf(e,t),i!=null&&r.push(Af(e,i,s))),e=e.return}return r}function Mc(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Bk(e,t,n,r,s){for(var i=t._reactName,a=[];n!==null&&n!==r;){var l=n,c=l.alternate,d=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&d!==null&&(l=d,s?(c=Sf(n,i),c!=null&&a.unshift(Af(n,c,l))):s||(c=Sf(n,i),c!=null&&a.push(Af(n,c,l)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var vM=/\r\n?/g,kM=/\u0000|\uFFFD/g;function Wk(e){return(typeof e=="string"?e:""+e).replace(vM,`
|
|
38
|
+
`).replace(kM,"")}function hh(e,t,n){if(t=Wk(t),Wk(e)!==t&&n)throw Error(Ee(425))}function Pm(){}var vw=null,kw=null;function Sw(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 Nw=typeof setTimeout=="function"?setTimeout:void 0,SM=typeof clearTimeout=="function"?clearTimeout:void 0,Vk=typeof Promise=="function"?Promise:void 0,NM=typeof queueMicrotask=="function"?queueMicrotask:typeof Vk<"u"?function(e){return Vk.resolve(null).then(e).catch(jM)}:Nw;function jM(e){setTimeout(function(){throw e})}function qy(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),Cf(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);Cf(t)}function Qa(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 Uk(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 qu=Math.random().toString(36).slice(2),vo="__reactFiber$"+qu,If="__reactProps$"+qu,ca="__reactContainer$"+qu,jw="__reactEvents$"+qu,CM="__reactListeners$"+qu,EM="__reactHandles$"+qu;function Yl(e){var t=e[vo];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ca]||n[vo]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Uk(e);e!==null;){if(n=e[vo])return n;e=Uk(e)}return t}e=n,n=e.parentNode}return null}function up(e){return e=e[vo]||e[ca],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Jc(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(Ee(33))}function Mg(e){return e[If]||null}var Cw=[],Qc=-1;function gl(e){return{current:e}}function zn(e){0>Qc||(e.current=Cw[Qc],Cw[Qc]=null,Qc--)}function Rn(e,t){Qc++,Cw[Qc]=e.current,e.current=t}var ll={},ss=gl(ll),Ls=gl(!1),oc=ll;function Su(e,t){var n=e.type.contextTypes;if(!n)return ll;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 Ms(e){return e=e.childContextTypes,e!=null}function Am(){zn(Ls),zn(ss)}function Kk(e,t,n){if(ss.current!==ll)throw Error(Ee(168));Rn(ss,t),Rn(Ls,n)}function HE(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(Ee(108,dL(e)||"Unknown",s));return Qn({},n,r)}function Im(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ll,oc=ss.current,Rn(ss,e),Rn(Ls,Ls.current),!0}function qk(e,t,n){var r=e.stateNode;if(!r)throw Error(Ee(169));n?(e=HE(e,t,oc),r.__reactInternalMemoizedMergedChildContext=e,zn(Ls),zn(ss),Rn(ss,e)):zn(Ls),Rn(Ls,n)}var Qo=null,Og=!1,Yy=!1;function BE(e){Qo===null?Qo=[e]:Qo.push(e)}function _M(e){Og=!0,BE(e)}function yl(){if(!Yy&&Qo!==null){Yy=!0;var e=0,t=pn;try{var n=Qo;for(pn=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Qo=null,Og=!1}catch(s){throw Qo!==null&&(Qo=Qo.slice(e+1)),pE(av,yl),s}finally{pn=t,Yy=!1}}return null}var Zc=[],eu=0,Tm=null,Rm=0,ki=[],Si=0,ac=null,ta=1,na="";function Wl(e,t){Zc[eu++]=Rm,Zc[eu++]=Tm,Tm=e,Rm=t}function WE(e,t,n){ki[Si++]=ta,ki[Si++]=na,ki[Si++]=ac,ac=e;var r=ta;e=na;var s=32-Ji(r)-1;r&=~(1<<s),n+=1;var i=32-Ji(t)+s;if(30<i){var a=s-s%5;i=(r&(1<<a)-1).toString(32),r>>=a,s-=a,ta=1<<32-Ji(t)+s|n<<s|r,na=i+e}else ta=1<<i|n<<s|r,na=e}function gv(e){e.return!==null&&(Wl(e,1),WE(e,1,0))}function yv(e){for(;e===Tm;)Tm=Zc[--eu],Zc[eu]=null,Rm=Zc[--eu],Zc[eu]=null;for(;e===ac;)ac=ki[--Si],ki[Si]=null,na=ki[--Si],ki[Si]=null,ta=ki[--Si],ki[Si]=null}var ni=null,ei=null,qn=!1,Ki=null;function VE(e,t){var n=Ci(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 Yk(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,ni=e,ei=Qa(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,ni=e,ei=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=ac!==null?{id:ta,overflow:na}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Ci(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,ni=e,ei=null,!0):!1;default:return!1}}function Ew(e){return(e.mode&1)!==0&&(e.flags&128)===0}function _w(e){if(qn){var t=ei;if(t){var n=t;if(!Yk(e,t)){if(Ew(e))throw Error(Ee(418));t=Qa(n.nextSibling);var r=ni;t&&Yk(e,t)?VE(r,n):(e.flags=e.flags&-4097|2,qn=!1,ni=e)}}else{if(Ew(e))throw Error(Ee(418));e.flags=e.flags&-4097|2,qn=!1,ni=e}}}function Gk(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;ni=e}function mh(e){if(e!==ni)return!1;if(!qn)return Gk(e),qn=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Sw(e.type,e.memoizedProps)),t&&(t=ei)){if(Ew(e))throw UE(),Error(Ee(418));for(;t;)VE(e,t),t=Qa(t.nextSibling)}if(Gk(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Ee(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){ei=Qa(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}ei=null}}else ei=ni?Qa(e.stateNode.nextSibling):null;return!0}function UE(){for(var e=ei;e;)e=Qa(e.nextSibling)}function Nu(){ei=ni=null,qn=!1}function xv(e){Ki===null?Ki=[e]:Ki.push(e)}var PM=ma.ReactCurrentBatchConfig;function Id(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(Ee(309));var r=n.stateNode}if(!r)throw Error(Ee(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(Ee(284));if(!n._owner)throw Error(Ee(290,e))}return e}function gh(e,t){throw e=Object.prototype.toString.call(t),Error(Ee(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Xk(e){var t=e._init;return t(e._payload)}function KE(e){function t(g,v){if(e){var x=g.deletions;x===null?(g.deletions=[v],g.flags|=16):x.push(v)}}function n(g,v){if(!e)return null;for(;v!==null;)t(g,v),v=v.sibling;return null}function r(g,v){for(g=new Map;v!==null;)v.key!==null?g.set(v.key,v):g.set(v.index,v),v=v.sibling;return g}function s(g,v){return g=nl(g,v),g.index=0,g.sibling=null,g}function i(g,v,x){return g.index=x,e?(x=g.alternate,x!==null?(x=x.index,x<v?(g.flags|=2,v):x):(g.flags|=2,v)):(g.flags|=1048576,v)}function a(g){return e&&g.alternate===null&&(g.flags|=2),g}function l(g,v,x,N){return v===null||v.tag!==6?(v=tx(x,g.mode,N),v.return=g,v):(v=s(v,x),v.return=g,v)}function c(g,v,x,N){var _=x.type;return _===qc?f(g,v,x.props.children,N,x.key):v!==null&&(v.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===Fa&&Xk(_)===v.type)?(N=s(v,x.props),N.ref=Id(g,v,x),N.return=g,N):(N=am(x.type,x.key,x.props,null,g.mode,N),N.ref=Id(g,v,x),N.return=g,N)}function d(g,v,x,N){return v===null||v.tag!==4||v.stateNode.containerInfo!==x.containerInfo||v.stateNode.implementation!==x.implementation?(v=nx(x,g.mode,N),v.return=g,v):(v=s(v,x.children||[]),v.return=g,v)}function f(g,v,x,N,_){return v===null||v.tag!==7?(v=ec(x,g.mode,N,_),v.return=g,v):(v=s(v,x),v.return=g,v)}function u(g,v,x){if(typeof v=="string"&&v!==""||typeof v=="number")return v=tx(""+v,g.mode,x),v.return=g,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case ih:return x=am(v.type,v.key,v.props,null,g.mode,x),x.ref=Id(g,null,v),x.return=g,x;case Kc:return v=nx(v,g.mode,x),v.return=g,v;case Fa:var N=v._init;return u(g,N(v._payload),x)}if(Ud(v)||Cd(v))return v=ec(v,g.mode,x,null),v.return=g,v;gh(g,v)}return null}function p(g,v,x,N){var _=v!==null?v.key:null;if(typeof x=="string"&&x!==""||typeof x=="number")return _!==null?null:l(g,v,""+x,N);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case ih:return x.key===_?c(g,v,x,N):null;case Kc:return x.key===_?d(g,v,x,N):null;case Fa:return _=x._init,p(g,v,_(x._payload),N)}if(Ud(x)||Cd(x))return _!==null?null:f(g,v,x,N,null);gh(g,x)}return null}function m(g,v,x,N,_){if(typeof N=="string"&&N!==""||typeof N=="number")return g=g.get(x)||null,l(v,g,""+N,_);if(typeof N=="object"&&N!==null){switch(N.$$typeof){case ih:return g=g.get(N.key===null?x:N.key)||null,c(v,g,N,_);case Kc:return g=g.get(N.key===null?x:N.key)||null,d(v,g,N,_);case Fa:var C=N._init;return m(g,v,x,C(N._payload),_)}if(Ud(N)||Cd(N))return g=g.get(x)||null,f(v,g,N,_,null);gh(v,N)}return null}function y(g,v,x,N){for(var _=null,C=null,T=v,H=v=0,M=null;T!==null&&H<x.length;H++){T.index>H?(M=T,T=null):M=T.sibling;var F=p(g,T,x[H],N);if(F===null){T===null&&(T=M);break}e&&T&&F.alternate===null&&t(g,T),v=i(F,v,H),C===null?_=F:C.sibling=F,C=F,T=M}if(H===x.length)return n(g,T),qn&&Wl(g,H),_;if(T===null){for(;H<x.length;H++)T=u(g,x[H],N),T!==null&&(v=i(T,v,H),C===null?_=T:C.sibling=T,C=T);return qn&&Wl(g,H),_}for(T=r(g,T);H<x.length;H++)M=m(T,g,H,x[H],N),M!==null&&(e&&M.alternate!==null&&T.delete(M.key===null?H:M.key),v=i(M,v,H),C===null?_=M:C.sibling=M,C=M);return e&&T.forEach(function(D){return t(g,D)}),qn&&Wl(g,H),_}function b(g,v,x,N){var _=Cd(x);if(typeof _!="function")throw Error(Ee(150));if(x=_.call(x),x==null)throw Error(Ee(151));for(var C=_=null,T=v,H=v=0,M=null,F=x.next();T!==null&&!F.done;H++,F=x.next()){T.index>H?(M=T,T=null):M=T.sibling;var D=p(g,T,F.value,N);if(D===null){T===null&&(T=M);break}e&&T&&D.alternate===null&&t(g,T),v=i(D,v,H),C===null?_=D:C.sibling=D,C=D,T=M}if(F.done)return n(g,T),qn&&Wl(g,H),_;if(T===null){for(;!F.done;H++,F=x.next())F=u(g,F.value,N),F!==null&&(v=i(F,v,H),C===null?_=F:C.sibling=F,C=F);return qn&&Wl(g,H),_}for(T=r(g,T);!F.done;H++,F=x.next())F=m(T,g,H,F.value,N),F!==null&&(e&&F.alternate!==null&&T.delete(F.key===null?H:F.key),v=i(F,v,H),C===null?_=F:C.sibling=F,C=F);return e&&T.forEach(function($){return t(g,$)}),qn&&Wl(g,H),_}function k(g,v,x,N){if(typeof x=="object"&&x!==null&&x.type===qc&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case ih:e:{for(var _=x.key,C=v;C!==null;){if(C.key===_){if(_=x.type,_===qc){if(C.tag===7){n(g,C.sibling),v=s(C,x.props.children),v.return=g,g=v;break e}}else if(C.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===Fa&&Xk(_)===C.type){n(g,C.sibling),v=s(C,x.props),v.ref=Id(g,C,x),v.return=g,g=v;break e}n(g,C);break}else t(g,C);C=C.sibling}x.type===qc?(v=ec(x.props.children,g.mode,N,x.key),v.return=g,g=v):(N=am(x.type,x.key,x.props,null,g.mode,N),N.ref=Id(g,v,x),N.return=g,g=N)}return a(g);case Kc:e:{for(C=x.key;v!==null;){if(v.key===C)if(v.tag===4&&v.stateNode.containerInfo===x.containerInfo&&v.stateNode.implementation===x.implementation){n(g,v.sibling),v=s(v,x.children||[]),v.return=g,g=v;break e}else{n(g,v);break}else t(g,v);v=v.sibling}v=nx(x,g.mode,N),v.return=g,g=v}return a(g);case Fa:return C=x._init,k(g,v,C(x._payload),N)}if(Ud(x))return y(g,v,x,N);if(Cd(x))return b(g,v,x,N);gh(g,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,v!==null&&v.tag===6?(n(g,v.sibling),v=s(v,x),v.return=g,g=v):(n(g,v),v=tx(x,g.mode,N),v.return=g,g=v),a(g)):n(g,v)}return k}var ju=KE(!0),qE=KE(!1),Lm=gl(null),Mm=null,tu=null,wv=null;function bv(){wv=tu=Mm=null}function vv(e){var t=Lm.current;zn(Lm),e._currentValue=t}function Pw(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 hu(e,t){Mm=e,wv=tu=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Ps=!0),e.firstContext=null)}function _i(e){var t=e._currentValue;if(wv!==e)if(e={context:e,memoizedValue:t,next:null},tu===null){if(Mm===null)throw Error(Ee(308));tu=e,Mm.dependencies={lanes:0,firstContext:e}}else tu=tu.next=e;return t}var Gl=null;function kv(e){Gl===null?Gl=[e]:Gl.push(e)}function YE(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,kv(t)):(n.next=s.next,s.next=n),t.interleaved=n,ua(e,r)}function ua(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 za=!1;function Sv(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function GE(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 oa(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Za(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,qt&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,ua(e,n)}return s=r.interleaved,s===null?(t.next=t,kv(r)):(t.next=s.next,s.next=t),r.interleaved=t,ua(e,n)}function tm(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,lv(e,n)}}function Jk(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 Om(e,t,n,r){var s=e.updateQueue;za=!1;var i=s.firstBaseUpdate,a=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,d=c.next;c.next=null,a===null?i=d:a.next=d,a=c;var f=e.alternate;f!==null&&(f=f.updateQueue,l=f.lastBaseUpdate,l!==a&&(l===null?f.firstBaseUpdate=d:l.next=d,f.lastBaseUpdate=c))}if(i!==null){var u=s.baseState;a=0,f=d=c=null,l=i;do{var p=l.lane,m=l.eventTime;if((r&p)===p){f!==null&&(f=f.next={eventTime:m,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var y=e,b=l;switch(p=t,m=n,b.tag){case 1:if(y=b.payload,typeof y=="function"){u=y.call(m,u,p);break e}u=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=b.payload,p=typeof y=="function"?y.call(m,u,p):y,p==null)break e;u=Qn({},u,p);break e;case 2:za=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,p=s.effects,p===null?s.effects=[l]:p.push(l))}else m={eventTime:m,lane:p,tag:l.tag,payload:l.payload,callback:l.callback,next:null},f===null?(d=f=m,c=u):f=f.next=m,a|=p;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;p=l,l=p.next,p.next=null,s.lastBaseUpdate=p,s.shared.pending=null}}while(!0);if(f===null&&(c=u),s.baseState=c,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);cc|=a,e.lanes=a,e.memoizedState=u}}function Qk(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(Ee(191,s));s.call(r)}}}var dp={},Co=gl(dp),Tf=gl(dp),Rf=gl(dp);function Xl(e){if(e===dp)throw Error(Ee(174));return e}function Nv(e,t){switch(Rn(Rf,t),Rn(Tf,e),Rn(Co,dp),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:cw(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=cw(t,e)}zn(Co),Rn(Co,t)}function Cu(){zn(Co),zn(Tf),zn(Rf)}function XE(e){Xl(Rf.current);var t=Xl(Co.current),n=cw(t,e.type);t!==n&&(Rn(Tf,e),Rn(Co,n))}function jv(e){Tf.current===e&&(zn(Co),zn(Tf))}var Xn=gl(0);function $m(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 Gy=[];function Cv(){for(var e=0;e<Gy.length;e++)Gy[e]._workInProgressVersionPrimary=null;Gy.length=0}var nm=ma.ReactCurrentDispatcher,Xy=ma.ReactCurrentBatchConfig,lc=0,Jn=null,Sr=null,Ir=null,Dm=!1,af=!1,Lf=0,AM=0;function es(){throw Error(Ee(321))}function Ev(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Zi(e[n],t[n]))return!1;return!0}function _v(e,t,n,r,s,i){if(lc=i,Jn=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,nm.current=e===null||e.memoizedState===null?LM:MM,e=n(r,s),af){i=0;do{if(af=!1,Lf=0,25<=i)throw Error(Ee(301));i+=1,Ir=Sr=null,t.updateQueue=null,nm.current=OM,e=n(r,s)}while(af)}if(nm.current=Fm,t=Sr!==null&&Sr.next!==null,lc=0,Ir=Sr=Jn=null,Dm=!1,t)throw Error(Ee(300));return e}function Pv(){var e=Lf!==0;return Lf=0,e}function go(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ir===null?Jn.memoizedState=Ir=e:Ir=Ir.next=e,Ir}function Pi(){if(Sr===null){var e=Jn.alternate;e=e!==null?e.memoizedState:null}else e=Sr.next;var t=Ir===null?Jn.memoizedState:Ir.next;if(t!==null)Ir=t,Sr=e;else{if(e===null)throw Error(Ee(310));Sr=e,e={memoizedState:Sr.memoizedState,baseState:Sr.baseState,baseQueue:Sr.baseQueue,queue:Sr.queue,next:null},Ir===null?Jn.memoizedState=Ir=e:Ir=Ir.next=e}return Ir}function Mf(e,t){return typeof t=="function"?t(e):t}function Jy(e){var t=Pi(),n=t.queue;if(n===null)throw Error(Ee(311));n.lastRenderedReducer=e;var r=Sr,s=r.baseQueue,i=n.pending;if(i!==null){if(s!==null){var a=s.next;s.next=i.next,i.next=a}r.baseQueue=s=i,n.pending=null}if(s!==null){i=s.next,r=r.baseState;var l=a=null,c=null,d=i;do{var f=d.lane;if((lc&f)===f)c!==null&&(c=c.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 u={lane:f,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null};c===null?(l=c=u,a=r):c=c.next=u,Jn.lanes|=f,cc|=f}d=d.next}while(d!==null&&d!==i);c===null?a=r:c.next=l,Zi(r,t.memoizedState)||(Ps=!0),t.memoizedState=r,t.baseState=a,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){s=e;do i=s.lane,Jn.lanes|=i,cc|=i,s=s.next;while(s!==e)}else s===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Qy(e){var t=Pi(),n=t.queue;if(n===null)throw Error(Ee(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);Zi(i,t.memoizedState)||(Ps=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function JE(){}function QE(e,t){var n=Jn,r=Pi(),s=t(),i=!Zi(r.memoizedState,s);if(i&&(r.memoizedState=s,Ps=!0),r=r.queue,Av(t_.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||Ir!==null&&Ir.memoizedState.tag&1){if(n.flags|=2048,Of(9,e_.bind(null,n,r,s,t),void 0,null),Rr===null)throw Error(Ee(349));lc&30||ZE(n,t,s)}return s}function ZE(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Jn.updateQueue,t===null?(t={lastEffect:null,stores:null},Jn.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function e_(e,t,n,r){t.value=n,t.getSnapshot=r,n_(t)&&r_(e)}function t_(e,t,n){return n(function(){n_(t)&&r_(e)})}function n_(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Zi(e,n)}catch{return!0}}function r_(e){var t=ua(e,1);t!==null&&Qi(t,e,1,-1)}function Zk(e){var t=go();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Mf,lastRenderedState:e},t.queue=e,e=e.dispatch=RM.bind(null,Jn,e),[t.memoizedState,e]}function Of(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Jn.updateQueue,t===null?(t={lastEffect:null,stores:null},Jn.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 s_(){return Pi().memoizedState}function rm(e,t,n,r){var s=go();Jn.flags|=e,s.memoizedState=Of(1|t,n,void 0,r===void 0?null:r)}function $g(e,t,n,r){var s=Pi();r=r===void 0?null:r;var i=void 0;if(Sr!==null){var a=Sr.memoizedState;if(i=a.destroy,r!==null&&Ev(r,a.deps)){s.memoizedState=Of(t,n,i,r);return}}Jn.flags|=e,s.memoizedState=Of(1|t,n,i,r)}function eS(e,t){return rm(8390656,8,e,t)}function Av(e,t){return $g(2048,8,e,t)}function i_(e,t){return $g(4,2,e,t)}function o_(e,t){return $g(4,4,e,t)}function a_(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 l_(e,t,n){return n=n!=null?n.concat([e]):null,$g(4,4,a_.bind(null,t,e),n)}function Iv(){}function c_(e,t){var n=Pi();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Ev(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function u_(e,t){var n=Pi();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Ev(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function d_(e,t,n){return lc&21?(Zi(n,t)||(n=gE(),Jn.lanes|=n,cc|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Ps=!0),e.memoizedState=n)}function IM(e,t){var n=pn;pn=n!==0&&4>n?n:4,e(!0);var r=Xy.transition;Xy.transition={};try{e(!1),t()}finally{pn=n,Xy.transition=r}}function f_(){return Pi().memoizedState}function TM(e,t,n){var r=tl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},p_(e))h_(t,n);else if(n=YE(e,t,n,r),n!==null){var s=ms();Qi(n,e,r,s),m_(n,t,r)}}function RM(e,t,n){var r=tl(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(p_(e))h_(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,Zi(l,a)){var c=t.interleaved;c===null?(s.next=s,kv(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}n=YE(e,t,s,r),n!==null&&(s=ms(),Qi(n,e,r,s),m_(n,t,r))}}function p_(e){var t=e.alternate;return e===Jn||t!==null&&t===Jn}function h_(e,t){af=Dm=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function m_(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,lv(e,n)}}var Fm={readContext:_i,useCallback:es,useContext:es,useEffect:es,useImperativeHandle:es,useInsertionEffect:es,useLayoutEffect:es,useMemo:es,useReducer:es,useRef:es,useState:es,useDebugValue:es,useDeferredValue:es,useTransition:es,useMutableSource:es,useSyncExternalStore:es,useId:es,unstable_isNewReconciler:!1},LM={readContext:_i,useCallback:function(e,t){return go().memoizedState=[e,t===void 0?null:t],e},useContext:_i,useEffect:eS,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,rm(4194308,4,a_.bind(null,t,e),n)},useLayoutEffect:function(e,t){return rm(4194308,4,e,t)},useInsertionEffect:function(e,t){return rm(4,2,e,t)},useMemo:function(e,t){var n=go();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=go();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=TM.bind(null,Jn,e),[r.memoizedState,e]},useRef:function(e){var t=go();return e={current:e},t.memoizedState=e},useState:Zk,useDebugValue:Iv,useDeferredValue:function(e){return go().memoizedState=e},useTransition:function(){var e=Zk(!1),t=e[0];return e=IM.bind(null,e[1]),go().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Jn,s=go();if(qn){if(n===void 0)throw Error(Ee(407));n=n()}else{if(n=t(),Rr===null)throw Error(Ee(349));lc&30||ZE(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,eS(t_.bind(null,r,i,e),[e]),r.flags|=2048,Of(9,e_.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=go(),t=Rr.identifierPrefix;if(qn){var n=na,r=ta;n=(r&~(1<<32-Ji(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Lf++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=AM++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},MM={readContext:_i,useCallback:c_,useContext:_i,useEffect:Av,useImperativeHandle:l_,useInsertionEffect:i_,useLayoutEffect:o_,useMemo:u_,useReducer:Jy,useRef:s_,useState:function(){return Jy(Mf)},useDebugValue:Iv,useDeferredValue:function(e){var t=Pi();return d_(t,Sr.memoizedState,e)},useTransition:function(){var e=Jy(Mf)[0],t=Pi().memoizedState;return[e,t]},useMutableSource:JE,useSyncExternalStore:QE,useId:f_,unstable_isNewReconciler:!1},OM={readContext:_i,useCallback:c_,useContext:_i,useEffect:Av,useImperativeHandle:l_,useInsertionEffect:i_,useLayoutEffect:o_,useMemo:u_,useReducer:Qy,useRef:s_,useState:function(){return Qy(Mf)},useDebugValue:Iv,useDeferredValue:function(e){var t=Pi();return Sr===null?t.memoizedState=e:d_(t,Sr.memoizedState,e)},useTransition:function(){var e=Qy(Mf)[0],t=Pi().memoizedState;return[e,t]},useMutableSource:JE,useSyncExternalStore:QE,useId:f_,unstable_isNewReconciler:!1};function Wi(e,t){if(e&&e.defaultProps){t=Qn({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Aw(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Qn({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Dg={isMounted:function(e){return(e=e._reactInternals)?xc(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=ms(),s=tl(e),i=oa(r,s);i.payload=t,n!=null&&(i.callback=n),t=Za(e,i,s),t!==null&&(Qi(t,e,s,r),tm(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=ms(),s=tl(e),i=oa(r,s);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Za(e,i,s),t!==null&&(Qi(t,e,s,r),tm(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=ms(),r=tl(e),s=oa(n,r);s.tag=2,t!=null&&(s.callback=t),t=Za(e,s,r),t!==null&&(Qi(t,e,r,n),tm(t,e,r))}};function tS(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?!_f(n,r)||!_f(s,i):!0}function g_(e,t,n){var r=!1,s=ll,i=t.contextType;return typeof i=="object"&&i!==null?i=_i(i):(s=Ms(t)?oc:ss.current,r=t.contextTypes,i=(r=r!=null)?Su(e,s):ll),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Dg,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=i),t}function nS(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&&Dg.enqueueReplaceState(t,t.state,null)}function Iw(e,t,n,r){var s=e.stateNode;s.props=n,s.state=e.memoizedState,s.refs={},Sv(e);var i=t.contextType;typeof i=="object"&&i!==null?s.context=_i(i):(i=Ms(t)?oc:ss.current,s.context=Su(e,i)),s.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Aw(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&&Dg.enqueueReplaceState(s,s.state,null),Om(e,n,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function Eu(e,t){try{var n="",r=t;do n+=uL(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 Zy(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Tw(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var $M=typeof WeakMap=="function"?WeakMap:Map;function y_(e,t,n){n=oa(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Hm||(Hm=!0,Bw=r),Tw(e,t)},n}function x_(e,t,n){n=oa(-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(){Tw(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Tw(e,t),typeof r!="function"&&(el===null?el=new Set([this]):el.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function rS(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new $M;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=JM.bind(null,e,t,n),t.then(e,e))}function sS(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 iS(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=oa(-1,1),t.tag=2,Za(n,t,1))),n.lanes|=1),e)}var DM=ma.ReactCurrentOwner,Ps=!1;function ps(e,t,n,r){t.child=e===null?qE(t,null,n,r):ju(t,e.child,n,r)}function oS(e,t,n,r,s){n=n.render;var i=t.ref;return hu(t,s),r=_v(e,t,n,r,i,s),n=Pv(),e!==null&&!Ps?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,da(e,t,s)):(qn&&n&&gv(t),t.flags|=1,ps(e,t,r,s),t.child)}function aS(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!Fv(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,w_(e,t,i,r,s)):(e=am(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:_f,n(a,r)&&e.ref===t.ref)return da(e,t,s)}return t.flags|=1,e=nl(i,r),e.ref=t.ref,e.return=t,t.child=e}function w_(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(_f(i,r)&&e.ref===t.ref)if(Ps=!1,t.pendingProps=r=i,(e.lanes&s)!==0)e.flags&131072&&(Ps=!0);else return t.lanes=e.lanes,da(e,t,s)}return Rw(e,t,n,r,s)}function b_(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},Rn(ru,Js),Js|=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,Rn(ru,Js),Js|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,Rn(ru,Js),Js|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,Rn(ru,Js),Js|=r;return ps(e,t,s,n),t.child}function v_(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Rw(e,t,n,r,s){var i=Ms(n)?oc:ss.current;return i=Su(t,i),hu(t,s),n=_v(e,t,n,r,i,s),r=Pv(),e!==null&&!Ps?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,da(e,t,s)):(qn&&r&&gv(t),t.flags|=1,ps(e,t,n,s),t.child)}function lS(e,t,n,r,s){if(Ms(n)){var i=!0;Im(t)}else i=!1;if(hu(t,s),t.stateNode===null)sm(e,t),g_(t,n,r),Iw(t,n,r,s),r=!0;else if(e===null){var a=t.stateNode,l=t.memoizedProps;a.props=l;var c=a.context,d=n.contextType;typeof d=="object"&&d!==null?d=_i(d):(d=Ms(n)?oc:ss.current,d=Su(t,d));var f=n.getDerivedStateFromProps,u=typeof f=="function"||typeof a.getSnapshotBeforeUpdate=="function";u||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==r||c!==d)&&nS(t,a,r,d),za=!1;var p=t.memoizedState;a.state=p,Om(t,r,a,s),c=t.memoizedState,l!==r||p!==c||Ls.current||za?(typeof f=="function"&&(Aw(t,n,f,r),c=t.memoizedState),(l=za||tS(t,n,l,r,p,c,d))?(u||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),a.props=r,a.state=c,a.context=d,r=l):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,GE(e,t),l=t.memoizedProps,d=t.type===t.elementType?l:Wi(t.type,l),a.props=d,u=t.pendingProps,p=a.context,c=n.contextType,typeof c=="object"&&c!==null?c=_i(c):(c=Ms(n)?oc:ss.current,c=Su(t,c));var m=n.getDerivedStateFromProps;(f=typeof m=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==u||p!==c)&&nS(t,a,r,c),za=!1,p=t.memoizedState,a.state=p,Om(t,r,a,s);var y=t.memoizedState;l!==u||p!==y||Ls.current||za?(typeof m=="function"&&(Aw(t,n,m,r),y=t.memoizedState),(d=za||tS(t,n,d,r,p,y,c)||!1)?(f||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,y,c),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,y,c)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=y),a.props=r,a.state=y,a.context=c,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 Lw(e,t,n,r,i,s)}function Lw(e,t,n,r,s,i){v_(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return s&&qk(t,n,!1),da(e,t,i);r=t.stateNode,DM.current=t;var l=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=ju(t,e.child,null,i),t.child=ju(t,null,l,i)):ps(e,t,l,i),t.memoizedState=r.state,s&&qk(t,n,!0),t.child}function k_(e){var t=e.stateNode;t.pendingContext?Kk(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Kk(e,t.context,!1),Nv(e,t.containerInfo)}function cS(e,t,n,r,s){return Nu(),xv(s),t.flags|=256,ps(e,t,n,r),t.child}var Mw={dehydrated:null,treeContext:null,retryLane:0};function Ow(e){return{baseLanes:e,cachePool:null,transitions:null}}function S_(e,t,n){var r=t.pendingProps,s=Xn.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),Rn(Xn,s&1),e===null)return _w(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=Hg(a,r,0,null),e=ec(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Ow(n),t.memoizedState=Mw,e):Tv(t,a));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return FM(e,t,a,r,l,s,n);if(i){i=r.fallback,a=t.mode,s=e.child,l=s.sibling;var c={mode:"hidden",children:r.children};return!(a&1)&&t.child!==s?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=nl(s,c),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?i=nl(l,i):(i=ec(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?Ow(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=e.childLanes&~n,t.memoizedState=Mw,r}return i=e.child,e=i.sibling,r=nl(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 Tv(e,t){return t=Hg({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function yh(e,t,n,r){return r!==null&&xv(r),ju(t,e.child,null,n),e=Tv(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function FM(e,t,n,r,s,i,a){if(n)return t.flags&256?(t.flags&=-257,r=Zy(Error(Ee(422))),yh(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,s=t.mode,r=Hg({mode:"visible",children:r.children},s,0,null),i=ec(i,s,a,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&ju(t,e.child,null,a),t.child.memoizedState=Ow(a),t.memoizedState=Mw,i);if(!(t.mode&1))return yh(e,t,a,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(Ee(419)),r=Zy(i,r,void 0),yh(e,t,a,r)}if(l=(a&e.childLanes)!==0,Ps||l){if(r=Rr,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,ua(e,s),Qi(r,e,s,-1))}return Dv(),r=Zy(Error(Ee(421))),yh(e,t,a,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=QM.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,ei=Qa(s.nextSibling),ni=t,qn=!0,Ki=null,e!==null&&(ki[Si++]=ta,ki[Si++]=na,ki[Si++]=ac,ta=e.id,na=e.overflow,ac=t),t=Tv(t,r.children),t.flags|=4096,t)}function uS(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Pw(e.return,t,n)}function ex(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 N_(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;if(ps(e,t,r.children,n),r=Xn.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&&uS(e,n,t);else if(e.tag===19)uS(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(Rn(Xn,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&&$m(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),ex(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&&$m(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}ex(t,!0,n,null,i);break;case"together":ex(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function sm(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function da(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),cc|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(Ee(153));if(t.child!==null){for(e=t.child,n=nl(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=nl(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function zM(e,t,n){switch(t.tag){case 3:k_(t),Nu();break;case 5:XE(t);break;case 1:Ms(t.type)&&Im(t);break;case 4:Nv(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;Rn(Lm,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(Rn(Xn,Xn.current&1),t.flags|=128,null):n&t.child.childLanes?S_(e,t,n):(Rn(Xn,Xn.current&1),e=da(e,t,n),e!==null?e.sibling:null);Rn(Xn,Xn.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return N_(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),Rn(Xn,Xn.current),r)break;return null;case 22:case 23:return t.lanes=0,b_(e,t,n)}return da(e,t,n)}var j_,$w,C_,E_;j_=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}};$w=function(){};C_=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,Xl(Co.current);var i=null;switch(n){case"input":s=iw(e,s),r=iw(e,r),i=[];break;case"select":s=Qn({},s,{value:void 0}),r=Qn({},r,{value:void 0}),i=[];break;case"textarea":s=lw(e,s),r=lw(e,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Pm)}uw(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"&&(vf.hasOwnProperty(d)?i||(i=[]):(i=i||[]).push(d,null));for(d in r){var c=r[d];if(l=s!=null?s[d]:void 0,r.hasOwnProperty(d)&&c!==l&&(c!=null||l!=null))if(d==="style")if(l){for(a in l)!l.hasOwnProperty(a)||c&&c.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in c)c.hasOwnProperty(a)&&l[a]!==c[a]&&(n||(n={}),n[a]=c[a])}else n||(i||(i=[]),i.push(d,n)),n=c;else d==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(i=i||[]).push(d,c)):d==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(d,""+c):d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&(vf.hasOwnProperty(d)?(c!=null&&d==="onScroll"&&Dn("scroll",e),i||l===c||(i=[])):(i=i||[]).push(d,c))}n&&(i=i||[]).push("style",n);var d=i;(t.updateQueue=d)&&(t.flags|=4)}};E_=function(e,t,n,r){n!==r&&(t.flags|=4)};function Td(e,t){if(!qn)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 ts(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 HM(e,t,n){var r=t.pendingProps;switch(yv(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ts(t),null;case 1:return Ms(t.type)&&Am(),ts(t),null;case 3:return r=t.stateNode,Cu(),zn(Ls),zn(ss),Cv(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(mh(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ki!==null&&(Uw(Ki),Ki=null))),$w(e,t),ts(t),null;case 5:jv(t);var s=Xl(Rf.current);if(n=t.type,e!==null&&t.stateNode!=null)C_(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(Ee(166));return ts(t),null}if(e=Xl(Co.current),mh(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[vo]=t,r[If]=i,e=(t.mode&1)!==0,n){case"dialog":Dn("cancel",r),Dn("close",r);break;case"iframe":case"object":case"embed":Dn("load",r);break;case"video":case"audio":for(s=0;s<qd.length;s++)Dn(qd[s],r);break;case"source":Dn("error",r);break;case"img":case"image":case"link":Dn("error",r),Dn("load",r);break;case"details":Dn("toggle",r);break;case"input":wk(r,i),Dn("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},Dn("invalid",r);break;case"textarea":vk(r,i),Dn("invalid",r)}uw(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&&hh(r.textContent,l,e),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&hh(r.textContent,l,e),s=["children",""+l]):vf.hasOwnProperty(a)&&l!=null&&a==="onScroll"&&Dn("scroll",r)}switch(n){case"input":oh(r),bk(r,i,!0);break;case"textarea":oh(r),kk(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Pm)}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=tE(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[vo]=t,e[If]=r,j_(e,t,!1,!1),t.stateNode=e;e:{switch(a=dw(n,r),n){case"dialog":Dn("cancel",e),Dn("close",e),s=r;break;case"iframe":case"object":case"embed":Dn("load",e),s=r;break;case"video":case"audio":for(s=0;s<qd.length;s++)Dn(qd[s],e);s=r;break;case"source":Dn("error",e),s=r;break;case"img":case"image":case"link":Dn("error",e),Dn("load",e),s=r;break;case"details":Dn("toggle",e),s=r;break;case"input":wk(e,r),s=iw(e,r),Dn("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=Qn({},r,{value:void 0}),Dn("invalid",e);break;case"textarea":vk(e,r),s=lw(e,r),Dn("invalid",e);break;default:s=r}uw(n,s),l=s;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?sE(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&nE(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&kf(e,c):typeof c=="number"&&kf(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(vf.hasOwnProperty(i)?c!=null&&i==="onScroll"&&Dn("scroll",e):c!=null&&nv(e,i,c,a))}switch(n){case"input":oh(e),bk(e,r,!1);break;case"textarea":oh(e),kk(e);break;case"option":r.value!=null&&e.setAttribute("value",""+al(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?uu(e,!!r.multiple,i,!1):r.defaultValue!=null&&uu(e,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=Pm)}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 ts(t),null;case 6:if(e&&t.stateNode!=null)E_(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(Ee(166));if(n=Xl(Rf.current),Xl(Co.current),mh(t)){if(r=t.stateNode,n=t.memoizedProps,r[vo]=t,(i=r.nodeValue!==n)&&(e=ni,e!==null))switch(e.tag){case 3:hh(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&hh(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[vo]=t,t.stateNode=r}return ts(t),null;case 13:if(zn(Xn),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(qn&&ei!==null&&t.mode&1&&!(t.flags&128))UE(),Nu(),t.flags|=98560,i=!1;else if(i=mh(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(Ee(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(Ee(317));i[vo]=t}else Nu(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;ts(t),i=!1}else Ki!==null&&(Uw(Ki),Ki=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||Xn.current&1?jr===0&&(jr=3):Dv())),t.updateQueue!==null&&(t.flags|=4),ts(t),null);case 4:return Cu(),$w(e,t),e===null&&Pf(t.stateNode.containerInfo),ts(t),null;case 10:return vv(t.type._context),ts(t),null;case 17:return Ms(t.type)&&Am(),ts(t),null;case 19:if(zn(Xn),i=t.memoizedState,i===null)return ts(t),null;if(r=(t.flags&128)!==0,a=i.rendering,a===null)if(r)Td(i,!1);else{if(jr!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=$m(e),a!==null){for(t.flags|=128,Td(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 Rn(Xn,Xn.current&1|2),t.child}e=e.sibling}i.tail!==null&&pr()>_u&&(t.flags|=128,r=!0,Td(i,!1),t.lanes=4194304)}else{if(!r)if(e=$m(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Td(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!qn)return ts(t),null}else 2*pr()-i.renderingStartTime>_u&&n!==1073741824&&(t.flags|=128,r=!0,Td(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=pr(),t.sibling=null,n=Xn.current,Rn(Xn,r?n&1|2:n&1),t):(ts(t),null);case 22:case 23:return $v(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Js&1073741824&&(ts(t),t.subtreeFlags&6&&(t.flags|=8192)):ts(t),null;case 24:return null;case 25:return null}throw Error(Ee(156,t.tag))}function BM(e,t){switch(yv(t),t.tag){case 1:return Ms(t.type)&&Am(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Cu(),zn(Ls),zn(ss),Cv(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return jv(t),null;case 13:if(zn(Xn),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Ee(340));Nu()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return zn(Xn),null;case 4:return Cu(),null;case 10:return vv(t.type._context),null;case 22:case 23:return $v(),null;case 24:return null;default:return null}}var xh=!1,ns=!1,WM=typeof WeakSet=="function"?WeakSet:Set,Ge=null;function nu(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ir(e,t,r)}else n.current=null}function Dw(e,t,n){try{n()}catch(r){ir(e,t,r)}}var dS=!1;function VM(e,t){if(vw=Cm,e=TE(),mv(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var a=0,l=-1,c=-1,d=0,f=0,u=e,p=null;t:for(;;){for(var m;u!==n||s!==0&&u.nodeType!==3||(l=a+s),u!==i||r!==0&&u.nodeType!==3||(c=a+r),u.nodeType===3&&(a+=u.nodeValue.length),(m=u.firstChild)!==null;)p=u,u=m;for(;;){if(u===e)break t;if(p===n&&++d===s&&(l=a),p===i&&++f===r&&(c=a),(m=u.nextSibling)!==null)break;u=p,p=u.parentNode}u=m}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(kw={focusedElem:e,selectionRange:n},Cm=!1,Ge=t;Ge!==null;)if(t=Ge,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ge=e;else for(;Ge!==null;){t=Ge;try{var y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var b=y.memoizedProps,k=y.memoizedState,g=t.stateNode,v=g.getSnapshotBeforeUpdate(t.elementType===t.type?b:Wi(t.type,b),k);g.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var x=t.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Ee(163))}}catch(N){ir(t,t.return,N)}if(e=t.sibling,e!==null){e.return=t.return,Ge=e;break}Ge=t.return}return y=dS,dS=!1,y}function lf(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&&Dw(t,n,i)}s=s.next}while(s!==r)}}function Fg(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 Fw(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 __(e){var t=e.alternate;t!==null&&(e.alternate=null,__(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[vo],delete t[If],delete t[jw],delete t[CM],delete t[EM])),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 P_(e){return e.tag===5||e.tag===3||e.tag===4}function fS(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||P_(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 zw(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=Pm));else if(r!==4&&(e=e.child,e!==null))for(zw(e,t,n),e=e.sibling;e!==null;)zw(e,t,n),e=e.sibling}function Hw(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(Hw(e,t,n),e=e.sibling;e!==null;)Hw(e,t,n),e=e.sibling}var Dr=null,Vi=!1;function Ra(e,t,n){for(n=n.child;n!==null;)A_(e,t,n),n=n.sibling}function A_(e,t,n){if(jo&&typeof jo.onCommitFiberUnmount=="function")try{jo.onCommitFiberUnmount(Ig,n)}catch{}switch(n.tag){case 5:ns||nu(n,t);case 6:var r=Dr,s=Vi;Dr=null,Ra(e,t,n),Dr=r,Vi=s,Dr!==null&&(Vi?(e=Dr,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Dr.removeChild(n.stateNode));break;case 18:Dr!==null&&(Vi?(e=Dr,n=n.stateNode,e.nodeType===8?qy(e.parentNode,n):e.nodeType===1&&qy(e,n),Cf(e)):qy(Dr,n.stateNode));break;case 4:r=Dr,s=Vi,Dr=n.stateNode.containerInfo,Vi=!0,Ra(e,t,n),Dr=r,Vi=s;break;case 0:case 11:case 14:case 15:if(!ns&&(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)&&Dw(n,t,a),s=s.next}while(s!==r)}Ra(e,t,n);break;case 1:if(!ns&&(nu(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){ir(n,t,l)}Ra(e,t,n);break;case 21:Ra(e,t,n);break;case 22:n.mode&1?(ns=(r=ns)||n.memoizedState!==null,Ra(e,t,n),ns=r):Ra(e,t,n);break;default:Ra(e,t,n)}}function pS(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new WM),t.forEach(function(r){var s=ZM.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Fi(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:Dr=l.stateNode,Vi=!1;break e;case 3:Dr=l.stateNode.containerInfo,Vi=!0;break e;case 4:Dr=l.stateNode.containerInfo,Vi=!0;break e}l=l.return}if(Dr===null)throw Error(Ee(160));A_(i,a,s),Dr=null,Vi=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(d){ir(s,t,d)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)I_(t,e),t=t.sibling}function I_(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Fi(t,e),ho(e),r&4){try{lf(3,e,e.return),Fg(3,e)}catch(b){ir(e,e.return,b)}try{lf(5,e,e.return)}catch(b){ir(e,e.return,b)}}break;case 1:Fi(t,e),ho(e),r&512&&n!==null&&nu(n,n.return);break;case 5:if(Fi(t,e),ho(e),r&512&&n!==null&&nu(n,n.return),e.flags&32){var s=e.stateNode;try{kf(s,"")}catch(b){ir(e,e.return,b)}}if(r&4&&(s=e.stateNode,s!=null)){var i=e.memoizedProps,a=n!==null?n.memoizedProps:i,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&ZC(s,i),dw(l,a);var d=dw(l,i);for(a=0;a<c.length;a+=2){var f=c[a],u=c[a+1];f==="style"?sE(s,u):f==="dangerouslySetInnerHTML"?nE(s,u):f==="children"?kf(s,u):nv(s,f,u,d)}switch(l){case"input":ow(s,i);break;case"textarea":eE(s,i);break;case"select":var p=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var m=i.value;m!=null?uu(s,!!i.multiple,m,!1):p!==!!i.multiple&&(i.defaultValue!=null?uu(s,!!i.multiple,i.defaultValue,!0):uu(s,!!i.multiple,i.multiple?[]:"",!1))}s[If]=i}catch(b){ir(e,e.return,b)}}break;case 6:if(Fi(t,e),ho(e),r&4){if(e.stateNode===null)throw Error(Ee(162));s=e.stateNode,i=e.memoizedProps;try{s.nodeValue=i}catch(b){ir(e,e.return,b)}}break;case 3:if(Fi(t,e),ho(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Cf(t.containerInfo)}catch(b){ir(e,e.return,b)}break;case 4:Fi(t,e),ho(e);break;case 13:Fi(t,e),ho(e),s=e.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(Mv=pr())),r&4&&pS(e);break;case 22:if(f=n!==null&&n.memoizedState!==null,e.mode&1?(ns=(d=ns)||f,Fi(t,e),ns=d):Fi(t,e),ho(e),r&8192){if(d=e.memoizedState!==null,(e.stateNode.isHidden=d)&&!f&&e.mode&1)for(Ge=e,f=e.child;f!==null;){for(u=Ge=f;Ge!==null;){switch(p=Ge,m=p.child,p.tag){case 0:case 11:case 14:case 15:lf(4,p,p.return);break;case 1:nu(p,p.return);var y=p.stateNode;if(typeof y.componentWillUnmount=="function"){r=p,n=p.return;try{t=r,y.props=t.memoizedProps,y.state=t.memoizedState,y.componentWillUnmount()}catch(b){ir(r,n,b)}}break;case 5:nu(p,p.return);break;case 22:if(p.memoizedState!==null){mS(u);continue}}m!==null?(m.return=p,Ge=m):mS(u)}f=f.sibling}e:for(f=null,u=e;;){if(u.tag===5){if(f===null){f=u;try{s=u.stateNode,d?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=u.stateNode,c=u.memoizedProps.style,a=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=rE("display",a))}catch(b){ir(e,e.return,b)}}}else if(u.tag===6){if(f===null)try{u.stateNode.nodeValue=d?"":u.memoizedProps}catch(b){ir(e,e.return,b)}}else if((u.tag!==22&&u.tag!==23||u.memoizedState===null||u===e)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===e)break e;for(;u.sibling===null;){if(u.return===null||u.return===e)break e;f===u&&(f=null),u=u.return}f===u&&(f=null),u.sibling.return=u.return,u=u.sibling}}break;case 19:Fi(t,e),ho(e),r&4&&pS(e);break;case 21:break;default:Fi(t,e),ho(e)}}function ho(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(P_(n)){var r=n;break e}n=n.return}throw Error(Ee(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(kf(s,""),r.flags&=-33);var i=fS(e);Hw(e,i,s);break;case 3:case 4:var a=r.stateNode.containerInfo,l=fS(e);zw(e,l,a);break;default:throw Error(Ee(161))}}catch(c){ir(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function UM(e,t,n){Ge=e,T_(e)}function T_(e,t,n){for(var r=(e.mode&1)!==0;Ge!==null;){var s=Ge,i=s.child;if(s.tag===22&&r){var a=s.memoizedState!==null||xh;if(!a){var l=s.alternate,c=l!==null&&l.memoizedState!==null||ns;l=xh;var d=ns;if(xh=a,(ns=c)&&!d)for(Ge=s;Ge!==null;)a=Ge,c=a.child,a.tag===22&&a.memoizedState!==null?gS(s):c!==null?(c.return=a,Ge=c):gS(s);for(;i!==null;)Ge=i,T_(i),i=i.sibling;Ge=s,xh=l,ns=d}hS(e)}else s.subtreeFlags&8772&&i!==null?(i.return=s,Ge=i):hS(e)}}function hS(e){for(;Ge!==null;){var t=Ge;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:ns||Fg(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!ns)if(n===null)r.componentDidMount();else{var s=t.elementType===t.type?n.memoizedProps:Wi(t.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&Qk(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}Qk(t,a,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var d=t.alternate;if(d!==null){var f=d.memoizedState;if(f!==null){var u=f.dehydrated;u!==null&&Cf(u)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Ee(163))}ns||t.flags&512&&Fw(t)}catch(p){ir(t,t.return,p)}}if(t===e){Ge=null;break}if(n=t.sibling,n!==null){n.return=t.return,Ge=n;break}Ge=t.return}}function mS(e){for(;Ge!==null;){var t=Ge;if(t===e){Ge=null;break}var n=t.sibling;if(n!==null){n.return=t.return,Ge=n;break}Ge=t.return}}function gS(e){for(;Ge!==null;){var t=Ge;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Fg(4,t)}catch(c){ir(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(c){ir(t,s,c)}}var i=t.return;try{Fw(t)}catch(c){ir(t,i,c)}break;case 5:var a=t.return;try{Fw(t)}catch(c){ir(t,a,c)}}}catch(c){ir(t,t.return,c)}if(t===e){Ge=null;break}var l=t.sibling;if(l!==null){l.return=t.return,Ge=l;break}Ge=t.return}}var KM=Math.ceil,zm=ma.ReactCurrentDispatcher,Rv=ma.ReactCurrentOwner,Ei=ma.ReactCurrentBatchConfig,qt=0,Rr=null,xr=null,zr=0,Js=0,ru=gl(0),jr=0,$f=null,cc=0,zg=0,Lv=0,cf=null,_s=null,Mv=0,_u=1/0,Jo=null,Hm=!1,Bw=null,el=null,wh=!1,Ka=null,Bm=0,uf=0,Ww=null,im=-1,om=0;function ms(){return qt&6?pr():im!==-1?im:im=pr()}function tl(e){return e.mode&1?qt&2&&zr!==0?zr&-zr:PM.transition!==null?(om===0&&(om=gE()),om):(e=pn,e!==0||(e=window.event,e=e===void 0?16:SE(e.type)),e):1}function Qi(e,t,n,r){if(50<uf)throw uf=0,Ww=null,Error(Ee(185));lp(e,n,r),(!(qt&2)||e!==Rr)&&(e===Rr&&(!(qt&2)&&(zg|=n),jr===4&&Wa(e,zr)),Os(e,r),n===1&&qt===0&&!(t.mode&1)&&(_u=pr()+500,Og&&yl()))}function Os(e,t){var n=e.callbackNode;PL(e,t);var r=jm(e,e===Rr?zr:0);if(r===0)n!==null&&jk(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&jk(n),t===1)e.tag===0?_M(yS.bind(null,e)):BE(yS.bind(null,e)),NM(function(){!(qt&6)&&yl()}),n=null;else{switch(yE(r)){case 1:n=av;break;case 4:n=hE;break;case 16:n=Nm;break;case 536870912:n=mE;break;default:n=Nm}n=z_(n,R_.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function R_(e,t){if(im=-1,om=0,qt&6)throw Error(Ee(327));var n=e.callbackNode;if(mu()&&e.callbackNode!==n)return null;var r=jm(e,e===Rr?zr:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Wm(e,r);else{t=r;var s=qt;qt|=2;var i=M_();(Rr!==e||zr!==t)&&(Jo=null,_u=pr()+500,Zl(e,t));do try{GM();break}catch(l){L_(e,l)}while(!0);bv(),zm.current=i,qt=s,xr!==null?t=0:(Rr=null,zr=0,t=jr)}if(t!==0){if(t===2&&(s=gw(e),s!==0&&(r=s,t=Vw(e,s))),t===1)throw n=$f,Zl(e,0),Wa(e,r),Os(e,pr()),n;if(t===6)Wa(e,r);else{if(s=e.current.alternate,!(r&30)&&!qM(s)&&(t=Wm(e,r),t===2&&(i=gw(e),i!==0&&(r=i,t=Vw(e,i))),t===1))throw n=$f,Zl(e,0),Wa(e,r),Os(e,pr()),n;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(Ee(345));case 2:Vl(e,_s,Jo);break;case 3:if(Wa(e,r),(r&130023424)===r&&(t=Mv+500-pr(),10<t)){if(jm(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){ms(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=Nw(Vl.bind(null,e,_s,Jo),t);break}Vl(e,_s,Jo);break;case 4:if(Wa(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var a=31-Ji(r);i=1<<a,a=t[a],a>s&&(s=a),r&=~i}if(r=s,r=pr()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*KM(r/1960))-r,10<r){e.timeoutHandle=Nw(Vl.bind(null,e,_s,Jo),r);break}Vl(e,_s,Jo);break;case 5:Vl(e,_s,Jo);break;default:throw Error(Ee(329))}}}return Os(e,pr()),e.callbackNode===n?R_.bind(null,e):null}function Vw(e,t){var n=cf;return e.current.memoizedState.isDehydrated&&(Zl(e,t).flags|=256),e=Wm(e,t),e!==2&&(t=_s,_s=n,t!==null&&Uw(t)),e}function Uw(e){_s===null?_s=e:_s.push.apply(_s,e)}function qM(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(!Zi(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 Wa(e,t){for(t&=~Lv,t&=~zg,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Ji(t),r=1<<n;e[n]=-1,t&=~r}}function yS(e){if(qt&6)throw Error(Ee(327));mu();var t=jm(e,0);if(!(t&1))return Os(e,pr()),null;var n=Wm(e,t);if(e.tag!==0&&n===2){var r=gw(e);r!==0&&(t=r,n=Vw(e,r))}if(n===1)throw n=$f,Zl(e,0),Wa(e,t),Os(e,pr()),n;if(n===6)throw Error(Ee(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Vl(e,_s,Jo),Os(e,pr()),null}function Ov(e,t){var n=qt;qt|=1;try{return e(t)}finally{qt=n,qt===0&&(_u=pr()+500,Og&&yl())}}function uc(e){Ka!==null&&Ka.tag===0&&!(qt&6)&&mu();var t=qt;qt|=1;var n=Ei.transition,r=pn;try{if(Ei.transition=null,pn=1,e)return e()}finally{pn=r,Ei.transition=n,qt=t,!(qt&6)&&yl()}}function $v(){Js=ru.current,zn(ru)}function Zl(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,SM(n)),xr!==null)for(n=xr.return;n!==null;){var r=n;switch(yv(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Am();break;case 3:Cu(),zn(Ls),zn(ss),Cv();break;case 5:jv(r);break;case 4:Cu();break;case 13:zn(Xn);break;case 19:zn(Xn);break;case 10:vv(r.type._context);break;case 22:case 23:$v()}n=n.return}if(Rr=e,xr=e=nl(e.current,null),zr=Js=t,jr=0,$f=null,Lv=zg=cc=0,_s=cf=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 L_(e,t){do{var n=xr;try{if(bv(),nm.current=Fm,Dm){for(var r=Jn.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}Dm=!1}if(lc=0,Ir=Sr=Jn=null,af=!1,Lf=0,Rv.current=null,n===null||n.return===null){jr=1,$f=t,xr=null;break}e:{var i=e,a=n.return,l=n,c=t;if(t=zr,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=c,f=l,u=f.tag;if(!(f.mode&1)&&(u===0||u===11||u===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 m=sS(a);if(m!==null){m.flags&=-257,iS(m,a,l,i,t),m.mode&1&&rS(i,d,t),t=m,c=d;var y=t.updateQueue;if(y===null){var b=new Set;b.add(c),t.updateQueue=b}else y.add(c);break e}else{if(!(t&1)){rS(i,d,t),Dv();break e}c=Error(Ee(426))}}else if(qn&&l.mode&1){var k=sS(a);if(k!==null){!(k.flags&65536)&&(k.flags|=256),iS(k,a,l,i,t),xv(Eu(c,l));break e}}i=c=Eu(c,l),jr!==4&&(jr=2),cf===null?cf=[i]:cf.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var g=y_(i,c,t);Jk(i,g);break e;case 1:l=c;var v=i.type,x=i.stateNode;if(!(i.flags&128)&&(typeof v.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(el===null||!el.has(x)))){i.flags|=65536,t&=-t,i.lanes|=t;var N=x_(i,l,t);Jk(i,N);break e}}i=i.return}while(i!==null)}$_(n)}catch(_){t=_,xr===n&&n!==null&&(xr=n=n.return);continue}break}while(!0)}function M_(){var e=zm.current;return zm.current=Fm,e===null?Fm:e}function Dv(){(jr===0||jr===3||jr===2)&&(jr=4),Rr===null||!(cc&268435455)&&!(zg&268435455)||Wa(Rr,zr)}function Wm(e,t){var n=qt;qt|=2;var r=M_();(Rr!==e||zr!==t)&&(Jo=null,Zl(e,t));do try{YM();break}catch(s){L_(e,s)}while(!0);if(bv(),qt=n,zm.current=r,xr!==null)throw Error(Ee(261));return Rr=null,zr=0,jr}function YM(){for(;xr!==null;)O_(xr)}function GM(){for(;xr!==null&&!bL();)O_(xr)}function O_(e){var t=F_(e.alternate,e,Js);e.memoizedProps=e.pendingProps,t===null?$_(e):xr=t,Rv.current=null}function $_(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=BM(n,t),n!==null){n.flags&=32767,xr=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{jr=6,xr=null;return}}else if(n=HM(n,t,Js),n!==null){xr=n;return}if(t=t.sibling,t!==null){xr=t;return}xr=t=e}while(t!==null);jr===0&&(jr=5)}function Vl(e,t,n){var r=pn,s=Ei.transition;try{Ei.transition=null,pn=1,XM(e,t,n,r)}finally{Ei.transition=s,pn=r}return null}function XM(e,t,n,r){do mu();while(Ka!==null);if(qt&6)throw Error(Ee(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(Ee(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(AL(e,i),e===Rr&&(xr=Rr=null,zr=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||wh||(wh=!0,z_(Nm,function(){return mu(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Ei.transition,Ei.transition=null;var a=pn;pn=1;var l=qt;qt|=4,Rv.current=null,VM(e,n),I_(n,e),gM(kw),Cm=!!vw,kw=vw=null,e.current=n,UM(n),vL(),qt=l,pn=a,Ei.transition=i}else e.current=n;if(wh&&(wh=!1,Ka=e,Bm=s),i=e.pendingLanes,i===0&&(el=null),NL(n.stateNode),Os(e,pr()),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(Hm)throw Hm=!1,e=Bw,Bw=null,e;return Bm&1&&e.tag!==0&&mu(),i=e.pendingLanes,i&1?e===Ww?uf++:(uf=0,Ww=e):uf=0,yl(),null}function mu(){if(Ka!==null){var e=yE(Bm),t=Ei.transition,n=pn;try{if(Ei.transition=null,pn=16>e?16:e,Ka===null)var r=!1;else{if(e=Ka,Ka=null,Bm=0,qt&6)throw Error(Ee(331));var s=qt;for(qt|=4,Ge=e.current;Ge!==null;){var i=Ge,a=i.child;if(Ge.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var d=l[c];for(Ge=d;Ge!==null;){var f=Ge;switch(f.tag){case 0:case 11:case 15:lf(8,f,i)}var u=f.child;if(u!==null)u.return=f,Ge=u;else for(;Ge!==null;){f=Ge;var p=f.sibling,m=f.return;if(__(f),f===d){Ge=null;break}if(p!==null){p.return=m,Ge=p;break}Ge=m}}}var y=i.alternate;if(y!==null){var b=y.child;if(b!==null){y.child=null;do{var k=b.sibling;b.sibling=null,b=k}while(b!==null)}}Ge=i}}if(i.subtreeFlags&2064&&a!==null)a.return=i,Ge=a;else e:for(;Ge!==null;){if(i=Ge,i.flags&2048)switch(i.tag){case 0:case 11:case 15:lf(9,i,i.return)}var g=i.sibling;if(g!==null){g.return=i.return,Ge=g;break e}Ge=i.return}}var v=e.current;for(Ge=v;Ge!==null;){a=Ge;var x=a.child;if(a.subtreeFlags&2064&&x!==null)x.return=a,Ge=x;else e:for(a=v;Ge!==null;){if(l=Ge,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Fg(9,l)}}catch(_){ir(l,l.return,_)}if(l===a){Ge=null;break e}var N=l.sibling;if(N!==null){N.return=l.return,Ge=N;break e}Ge=l.return}}if(qt=s,yl(),jo&&typeof jo.onPostCommitFiberRoot=="function")try{jo.onPostCommitFiberRoot(Ig,e)}catch{}r=!0}return r}finally{pn=n,Ei.transition=t}}return!1}function xS(e,t,n){t=Eu(n,t),t=y_(e,t,1),e=Za(e,t,1),t=ms(),e!==null&&(lp(e,1,t),Os(e,t))}function ir(e,t,n){if(e.tag===3)xS(e,e,n);else for(;t!==null;){if(t.tag===3){xS(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(el===null||!el.has(r))){e=Eu(n,e),e=x_(t,e,1),t=Za(t,e,1),e=ms(),t!==null&&(lp(t,1,e),Os(t,e));break}}t=t.return}}function JM(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=ms(),e.pingedLanes|=e.suspendedLanes&n,Rr===e&&(zr&n)===n&&(jr===4||jr===3&&(zr&130023424)===zr&&500>pr()-Mv?Zl(e,0):Lv|=n),Os(e,t)}function D_(e,t){t===0&&(e.mode&1?(t=ch,ch<<=1,!(ch&130023424)&&(ch=4194304)):t=1);var n=ms();e=ua(e,t),e!==null&&(lp(e,t,n),Os(e,n))}function QM(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),D_(e,n)}function ZM(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(Ee(314))}r!==null&&r.delete(t),D_(e,n)}var F_;F_=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ls.current)Ps=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Ps=!1,zM(e,t,n);Ps=!!(e.flags&131072)}else Ps=!1,qn&&t.flags&1048576&&WE(t,Rm,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;sm(e,t),e=t.pendingProps;var s=Su(t,ss.current);hu(t,n),s=_v(null,t,r,e,s,n);var i=Pv();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,Ms(r)?(i=!0,Im(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Sv(t),s.updater=Dg,t.stateNode=s,s._reactInternals=t,Iw(t,r,e,n),t=Lw(null,t,r,!0,i,n)):(t.tag=0,qn&&i&&gv(t),ps(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(sm(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=tO(r),e=Wi(r,e),s){case 0:t=Rw(null,t,r,e,n);break e;case 1:t=lS(null,t,r,e,n);break e;case 11:t=oS(null,t,r,e,n);break e;case 14:t=aS(null,t,r,Wi(r.type,e),n);break e}throw Error(Ee(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Wi(r,s),Rw(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Wi(r,s),lS(e,t,r,s,n);case 3:e:{if(k_(t),e===null)throw Error(Ee(387));r=t.pendingProps,i=t.memoizedState,s=i.element,GE(e,t),Om(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=Eu(Error(Ee(423)),t),t=cS(e,t,r,n,s);break e}else if(r!==s){s=Eu(Error(Ee(424)),t),t=cS(e,t,r,n,s);break e}else for(ei=Qa(t.stateNode.containerInfo.firstChild),ni=t,qn=!0,Ki=null,n=qE(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Nu(),r===s){t=da(e,t,n);break e}ps(e,t,r,n)}t=t.child}return t;case 5:return XE(t),e===null&&_w(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,a=s.children,Sw(r,s)?a=null:i!==null&&Sw(r,i)&&(t.flags|=32),v_(e,t),ps(e,t,a,n),t.child;case 6:return e===null&&_w(t),null;case 13:return S_(e,t,n);case 4:return Nv(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ju(t,null,r,n):ps(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Wi(r,s),oS(e,t,r,s,n);case 7:return ps(e,t,t.pendingProps,n),t.child;case 8:return ps(e,t,t.pendingProps.children,n),t.child;case 12:return ps(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,Rn(Lm,r._currentValue),r._currentValue=a,i!==null)if(Zi(i.value,a)){if(i.children===s.children&&!Ls.current){t=da(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){a=i.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=oa(-1,n&-n),c.tag=2;var d=i.updateQueue;if(d!==null){d=d.shared;var f=d.pending;f===null?c.next=c:(c.next=f.next,f.next=c),d.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),Pw(i.return,n,t),l.lanes|=n;break}c=c.next}}else if(i.tag===10)a=i.type===t.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error(Ee(341));a.lanes|=n,l=a.alternate,l!==null&&(l.lanes|=n),Pw(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}ps(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,hu(t,n),s=_i(s),r=r(s),t.flags|=1,ps(e,t,r,n),t.child;case 14:return r=t.type,s=Wi(r,t.pendingProps),s=Wi(r.type,s),aS(e,t,r,s,n);case 15:return w_(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Wi(r,s),sm(e,t),t.tag=1,Ms(r)?(e=!0,Im(t)):e=!1,hu(t,n),g_(t,r,s),Iw(t,r,s,n),Lw(null,t,r,!0,e,n);case 19:return N_(e,t,n);case 22:return b_(e,t,n)}throw Error(Ee(156,t.tag))};function z_(e,t){return pE(e,t)}function eO(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 Ci(e,t,n,r){return new eO(e,t,n,r)}function Fv(e){return e=e.prototype,!(!e||!e.isReactComponent)}function tO(e){if(typeof e=="function")return Fv(e)?1:0;if(e!=null){if(e=e.$$typeof,e===sv)return 11;if(e===iv)return 14}return 2}function nl(e,t){var n=e.alternate;return n===null?(n=Ci(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 am(e,t,n,r,s,i){var a=2;if(r=e,typeof e=="function")Fv(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case qc:return ec(n.children,s,i,t);case rv:a=8,s|=8;break;case tw:return e=Ci(12,n,t,s|2),e.elementType=tw,e.lanes=i,e;case nw:return e=Ci(13,n,t,s),e.elementType=nw,e.lanes=i,e;case rw:return e=Ci(19,n,t,s),e.elementType=rw,e.lanes=i,e;case XC:return Hg(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case YC:a=10;break e;case GC:a=9;break e;case sv:a=11;break e;case iv:a=14;break e;case Fa:a=16,r=null;break e}throw Error(Ee(130,e==null?e:typeof e,""))}return t=Ci(a,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function ec(e,t,n,r){return e=Ci(7,e,r,t),e.lanes=n,e}function Hg(e,t,n,r){return e=Ci(22,e,r,t),e.elementType=XC,e.lanes=n,e.stateNode={isHidden:!1},e}function tx(e,t,n){return e=Ci(6,e,null,t),e.lanes=n,e}function nx(e,t,n){return t=Ci(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function nO(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=Oy(0),this.expirationTimes=Oy(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Oy(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function zv(e,t,n,r,s,i,a,l,c){return e=new nO(e,t,n,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Ci(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Sv(i),e}function rO(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Kc,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function H_(e){if(!e)return ll;e=e._reactInternals;e:{if(xc(e)!==e||e.tag!==1)throw Error(Ee(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Ms(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(Ee(171))}if(e.tag===1){var n=e.type;if(Ms(n))return HE(e,n,t)}return t}function B_(e,t,n,r,s,i,a,l,c){return e=zv(n,r,!0,e,s,i,a,l,c),e.context=H_(null),n=e.current,r=ms(),s=tl(n),i=oa(r,s),i.callback=t??null,Za(n,i,s),e.current.lanes=s,lp(e,s,r),Os(e,r),e}function Bg(e,t,n,r){var s=t.current,i=ms(),a=tl(s);return n=H_(n),t.context===null?t.context=n:t.pendingContext=n,t=oa(i,a),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Za(s,t,a),e!==null&&(Qi(e,s,a,i),tm(e,s,a)),a}function Vm(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 wS(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Hv(e,t){wS(e,t),(e=e.alternate)&&wS(e,t)}function sO(){return null}var W_=typeof reportError=="function"?reportError:function(e){console.error(e)};function Bv(e){this._internalRoot=e}Wg.prototype.render=Bv.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Ee(409));Bg(e,t,null,null)};Wg.prototype.unmount=Bv.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;uc(function(){Bg(null,e,null,null)}),t[ca]=null}};function Wg(e){this._internalRoot=e}Wg.prototype.unstable_scheduleHydration=function(e){if(e){var t=bE();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ba.length&&t!==0&&t<Ba[n].priority;n++);Ba.splice(n,0,e),n===0&&kE(e)}};function Wv(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Vg(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function bS(){}function iO(e,t,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var d=Vm(a);i.call(d)}}var a=B_(t,r,e,0,null,!1,!1,"",bS);return e._reactRootContainer=a,e[ca]=a.current,Pf(e.nodeType===8?e.parentNode:e),uc(),a}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var d=Vm(c);l.call(d)}}var c=zv(e,0,!1,null,null,!1,!1,"",bS);return e._reactRootContainer=c,e[ca]=c.current,Pf(e.nodeType===8?e.parentNode:e),uc(function(){Bg(t,c,n,r)}),c}function Ug(e,t,n,r,s){var i=n._reactRootContainer;if(i){var a=i;if(typeof s=="function"){var l=s;s=function(){var c=Vm(a);l.call(c)}}Bg(t,a,e,s)}else a=iO(n,t,e,s,r);return Vm(a)}xE=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Kd(t.pendingLanes);n!==0&&(lv(t,n|1),Os(t,pr()),!(qt&6)&&(_u=pr()+500,yl()))}break;case 13:uc(function(){var r=ua(e,1);if(r!==null){var s=ms();Qi(r,e,1,s)}}),Hv(e,1)}};cv=function(e){if(e.tag===13){var t=ua(e,134217728);if(t!==null){var n=ms();Qi(t,e,134217728,n)}Hv(e,134217728)}};wE=function(e){if(e.tag===13){var t=tl(e),n=ua(e,t);if(n!==null){var r=ms();Qi(n,e,t,r)}Hv(e,t)}};bE=function(){return pn};vE=function(e,t){var n=pn;try{return pn=e,t()}finally{pn=n}};pw=function(e,t,n){switch(t){case"input":if(ow(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=Mg(r);if(!s)throw Error(Ee(90));QC(r),ow(r,s)}}}break;case"textarea":eE(e,n);break;case"select":t=n.value,t!=null&&uu(e,!!n.multiple,t,!1)}};aE=Ov;lE=uc;var oO={usingClientEntryPoint:!1,Events:[up,Jc,Mg,iE,oE,Ov]},Rd={findFiberByHostInstance:Yl,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},aO={bundleType:Rd.bundleType,version:Rd.version,rendererPackageName:Rd.rendererPackageName,rendererConfig:Rd.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ma.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=dE(e),e===null?null:e.stateNode},findFiberByHostInstance:Rd.findFiberByHostInstance||sO,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 bh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!bh.isDisabled&&bh.supportsFiber)try{Ig=bh.inject(aO),jo=bh}catch{}}oi.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=oO;oi.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Wv(t))throw Error(Ee(200));return rO(e,t,null,n)};oi.createRoot=function(e,t){if(!Wv(e))throw Error(Ee(299));var n=!1,r="",s=W_;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=zv(e,1,!1,null,null,n,!1,r,s),e[ca]=t.current,Pf(e.nodeType===8?e.parentNode:e),new Bv(t)};oi.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(Ee(188)):(e=Object.keys(e).join(","),Error(Ee(268,e)));return e=dE(t),e=e===null?null:e.stateNode,e};oi.flushSync=function(e){return uc(e)};oi.hydrate=function(e,t,n){if(!Vg(t))throw Error(Ee(200));return Ug(null,e,t,!0,n)};oi.hydrateRoot=function(e,t,n){if(!Wv(e))throw Error(Ee(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",a=W_;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=B_(t,null,e,1,n??null,s,!1,i,a),e[ca]=t.current,Pf(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 Wg(t)};oi.render=function(e,t,n){if(!Vg(t))throw Error(Ee(200));return Ug(null,e,t,!1,n)};oi.unmountComponentAtNode=function(e){if(!Vg(e))throw Error(Ee(40));return e._reactRootContainer?(uc(function(){Ug(null,null,e,!1,function(){e._reactRootContainer=null,e[ca]=null})}),!0):!1};oi.unstable_batchedUpdates=Ov;oi.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Vg(n))throw Error(Ee(200));if(e==null||e._reactInternals===void 0)throw Error(Ee(38));return Ug(e,t,n,!1,r)};oi.version="18.3.1-next-f1338f8080-20240426";function V_(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(V_)}catch(e){console.error(e)}}V_(),VC.exports=oi;var Fr=VC.exports,vS=Fr;Zx.createRoot=vS.createRoot,Zx.hydrateRoot=vS.hydrateRoot;const U_=h.createContext(null);function Kw(e){let t=e||"/";return t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t||"/"}function lO(){const e=Kw(window.location.pathname);return e==="/"?(window.history.replaceState({},"","/projects"),"/projects"):e}function cO({children:e}){const[t,n]=h.useState(lO);h.useEffect(()=>{const i=()=>n(Kw(window.location.pathname));return window.addEventListener("popstate",i),()=>window.removeEventListener("popstate",i)},[]);const r=h.useCallback(i=>{const a=i.startsWith("/")?i:`/${i}`;let l;try{l=new URL(a,window.location.origin)}catch{l=new URL("/",window.location.origin)}const c=Kw(l.pathname),d=l.search||"";window.history.pushState({},"",c+d),n(c)},[]),s=h.useMemo(()=>({path:t,navigate:r}),[t,r]);return o.jsx(U_.Provider,{value:s,children:e})}function Ro(){const e=h.useContext(U_);if(!e)throw new Error("useRoute must be used within RouteProvider");return e}function uO(){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 kS={};function qw(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];typeof t[0]=="string"&&kS[t[0]]||(typeof t[0]=="string"&&(kS[t[0]]=new Date),uO(...t))}const K_=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}};function SS(e,t,n){e.loadNamespaces(t,K_(e,n))}function NS(e,t,n,r){typeof n=="string"&&(n=[n]),n.forEach(s=>{e.options.ns.indexOf(s)<0&&e.options.ns.push(s)}),e.loadLanguages(t,K_(e,r))}function dO(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=t.languages[0],s=t.options?t.options.fallbackLng:!1,i=t.languages[t.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(l,c)=>{const d=t.services.backendConnector.state[`${l}|${c}`];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 fO(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(qw("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}}):dO(e,t,n)}const pO=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,hO={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},mO=e=>hO[e],gO=e=>e.replace(pO,mO);let Yw={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:gO};function yO(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Yw={...Yw,...e}}function xO(){return Yw}let q_;function wO(e){q_=e}function bO(){return q_}const vO={type:"3rdParty",init(e){yO(e.options.react),wO(e)}},kO=h.createContext();class SO{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const NO=(e,t)=>{const n=h.useRef();return h.useEffect(()=>{n.current=e},[e,t]),n.current};function Mn(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=t,{i18n:r,defaultNS:s}=h.useContext(kO)||{},i=n||r||bO();if(i&&!i.reportNamespaces&&(i.reportNamespaces=new SO),!i){qw("You will need to pass in an i18next instance by using initReactI18next");const x=(_,C)=>typeof C=="string"?C:C&&typeof C=="object"&&typeof C.defaultValue=="string"?C.defaultValue:Array.isArray(_)?_[_.length-1]:_,N=[x,{},!1];return N.t=x,N.i18n={},N.ready=!1,N}i.options.react&&i.options.react.wait!==void 0&&qw("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const a={...xO(),...i.options.react,...t},{useSuspense:l,keyPrefix:c}=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(x=>fO(x,i,a));function u(){return i.getFixedT(t.lng||null,a.nsMode==="fallback"?d:d[0],c)}const[p,m]=h.useState(u);let y=d.join();t.lng&&(y=`${t.lng}${y}`);const b=NO(y),k=h.useRef(!0);h.useEffect(()=>{const{bindI18n:x,bindI18nStore:N}=a;k.current=!0,!f&&!l&&(t.lng?NS(i,t.lng,d,()=>{k.current&&m(u)}):SS(i,d,()=>{k.current&&m(u)})),f&&b&&b!==y&&k.current&&m(u);function _(){k.current&&m(u)}return x&&i&&i.on(x,_),N&&i&&i.store.on(N,_),()=>{k.current=!1,x&&i&&x.split(" ").forEach(C=>i.off(C,_)),N&&i&&N.split(" ").forEach(C=>i.store.off(C,_))}},[i,y]);const g=h.useRef(!0);h.useEffect(()=>{k.current&&!g.current&&m(u),g.current=!1},[i,c]);const v=[p,i,f];if(v.t=p,v.i18n=i,v.ready=f,f||!f&&!l)return v;throw new Promise(x=>{t.lng?NS(i,t.lng,d,()=>x()):SS(i,d,()=>x())})}const Y_="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",jO=[{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"}],CO=[{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 EO(e,t){return t==="/projects"?e==="/projects"||e==="/":e===t||e.startsWith(t+"/")}function _O({authUser:e,onLogout:t}){const{path:n,navigate:r}=Ro(),{t:s}=Mn(),[i,a]=h.useState(!1);return h.useEffect(()=>{let l=!1;return fetch("/api/ui-context").then(c=>c.json()).then(c=>{l||a(!!c.hideCommunityLinks)}).catch(()=>{}),()=>{l=!0}},[]),o.jsxs("aside",{className:"af-sidebar","aria-label":s("flow:sidebar.mainNav"),children:[o.jsxs("div",{className:"af-brand",children:[o.jsx("div",{className:"af-brand-mark","aria-hidden":!0,children:o.jsx("img",{src:Y_,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:jO.map(l=>o.jsxs("button",{type:"button",className:"af-nav-link"+(EO(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&&CO.map(l=>{const c=s(l.labelKey);return o.jsx("a",{className:"af-sidebar-ext",href:l.href,target:"_blank",rel:"noopener noreferrer","aria-label":c,title:c,children:o.jsx("span",{className:"material-symbols-outlined",children:l.icon})},l.href)})]})]})}const G_="agentflow.pipelineRecent",PO=50,AO=15;function IO(e){try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function X_(){if(typeof localStorage>"u")return[];const e=localStorage.getItem(G_);return e?IO(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 vh(e,t){if(typeof localStorage>"u")return;const n=Date.now(),r=X_(),i=[{flowId:e,flowSource:t,kind:"opened",at:n},...r.filter(a=>!(a.flowId===e&&a.flowSource===t))].slice(0,PO);try{localStorage.setItem(G_,JSON.stringify(i))}catch{}}function TO(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 Gw(e,t){const n=Date.now(),r=Math.max(0,n-e),s=Math.floor(r/1e3);if(s<60)return t("flow:time.justNow");const i=Math.floor(s/60);if(i<60)return t("flow:time.minutesAgo",{n:i});const a=Math.floor(i/60);if(a<24)return t("flow:time.hoursAgo",{n:a});const l=new Date(e),c=new Date,d=new Date(c);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 RO(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 LO(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:TO(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,AO)}var Qs=Uint8Array,su=Uint16Array,MO=Int32Array,J_=new Qs([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]),Q_=new Qs([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]),OO=new Qs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Z_=function(e,t){for(var n=new su(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var s=new MO(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}},eP=Z_(J_,2),tP=eP.b,$O=eP.r;tP[28]=258,$O[258]=28;var DO=Z_(Q_,0),FO=DO.b,Xw=new su(32768);for(var Fn=0;Fn<32768;++Fn){var La=(Fn&43690)>>1|(Fn&21845)<<1;La=(La&52428)>>2|(La&13107)<<2,La=(La&61680)>>4|(La&3855)<<4,Xw[Fn]=((La&65280)>>8|(La&255)<<8)>>1}var df=function(e,t,n){for(var r=e.length,s=0,i=new su(t);s<r;++s)e[s]&&++i[e[s]-1];var a=new su(t);for(s=1;s<t;++s)a[s]=a[s-1]+i[s-1]<<1;var l;if(n){l=new su(1<<t);var c=15-t;for(s=0;s<r;++s)if(e[s])for(var d=s<<4|e[s],f=t-e[s],u=a[e[s]-1]++<<f,p=u|(1<<f)-1;u<=p;++u)l[Xw[u]>>c]=d}else for(l=new su(r),s=0;s<r;++s)e[s]&&(l[s]=Xw[a[e[s]-1]++]>>15-e[s]);return l},fp=new Qs(288);for(var Fn=0;Fn<144;++Fn)fp[Fn]=8;for(var Fn=144;Fn<256;++Fn)fp[Fn]=9;for(var Fn=256;Fn<280;++Fn)fp[Fn]=7;for(var Fn=280;Fn<288;++Fn)fp[Fn]=8;var nP=new Qs(32);for(var Fn=0;Fn<32;++Fn)nP[Fn]=5;var zO=df(fp,9,1),HO=df(nP,5,1),rx=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},zi=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},sx=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},BO=function(e){return(e+7)/8|0},Vv=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new Qs(e.subarray(t,n))},WO=["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"],vi=function(e,t,n){var r=new Error(t||WO[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,vi),!n)throw r;return r},VO=function(e,t,n,r){var s=e.length,i=r?r.length:0;if(!s||t.f&&!t.l)return n||new Qs(0);var a=!n,l=a||t.i!=2,c=t.i;a&&(n=new Qs(s*3));var d=function(pe){var _e=n.length;if(pe>_e){var je=new Qs(Math.max(_e*2,pe));je.set(n),n=je}},f=t.f||0,u=t.p||0,p=t.b||0,m=t.l,y=t.d,b=t.m,k=t.n,g=s*8;do{if(!m){f=zi(e,u,1);var v=zi(e,u+1,3);if(u+=3,v)if(v==1)m=zO,y=HO,b=9,k=5;else if(v==2){var C=zi(e,u,31)+257,T=zi(e,u+10,15)+4,H=C+zi(e,u+5,31)+1;u+=14;for(var M=new Qs(H),F=new Qs(19),D=0;D<T;++D)F[OO[D]]=zi(e,u+D*3,7);u+=T*3;for(var $=rx(F),W=(1<<$)-1,O=df(F,$,1),D=0;D<H;){var R=O[zi(e,u,W)];u+=R&15;var x=R>>4;if(x<16)M[D++]=x;else{var I=0,z=0;for(x==16?(z=3+zi(e,u,3),u+=2,I=M[D-1]):x==17?(z=3+zi(e,u,7),u+=3):x==18&&(z=11+zi(e,u,127),u+=7);z--;)M[D++]=I}}var P=M.subarray(0,C),L=M.subarray(C);b=rx(P),k=rx(L),m=df(P,b,1),y=df(L,k,1)}else vi(1);else{var x=BO(u)+4,N=e[x-4]|e[x-3]<<8,_=x+N;if(_>s){c&&vi(0);break}l&&d(p+N),n.set(e.subarray(x,_),p),t.b=p+=N,t.p=u=_*8,t.f=f;continue}if(u>g){c&&vi(0);break}}l&&d(p+131072);for(var E=(1<<b)-1,X=(1<<k)-1,ee=u;;ee=u){var I=m[sx(e,u)&E],V=I>>4;if(u+=I&15,u>g){c&&vi(0);break}if(I||vi(2),V<256)n[p++]=V;else if(V==256){ee=u,m=null;break}else{var ie=V-254;if(V>264){var D=V-257,fe=J_[D];ie=zi(e,u,(1<<fe)-1)+tP[D],u+=fe}var me=y[sx(e,u)&X],ge=me>>4;me||vi(3),u+=me&15;var L=FO[ge];if(ge>3){var fe=Q_[ge];L+=sx(e,u)&(1<<fe)-1,u+=fe}if(u>g){c&&vi(0);break}l&&d(p+131072);var Z=p+ie;if(p<L){var ae=i-L,xe=Math.min(L,Z);for(ae+p<0&&vi(3);p<xe;++p)n[p]=r[ae+p]}for(;p<Z;++p)n[p]=n[p-L]}}t.l=m,t.p=ee,t.b=p,t.f=f,m&&(f=1,t.m=b,t.d=y,t.n=k)}while(!f);return p!=n.length&&a?Vv(n,0,p):n.subarray(0,p)},UO=new Qs(0),ko=function(e,t){return e[t]|e[t+1]<<8},qi=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},ix=function(e,t){return qi(e,t)+qi(e,t+4)*4294967296};function KO(e,t){return VO(e,{i:2},t&&t.out,t&&t.dictionary)}var Jw=typeof TextDecoder<"u"&&new TextDecoder,qO=0;try{Jw.decode(UO,{stream:!0}),qO=1}catch{}var YO=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:Vv(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 GO(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(Jw)return Jw.decode(e);var s=YO(e),i=s.s,n=s.r;return n.length&&vi(8),i}}var XO=function(e,t){return t+30+ko(e,t+26)+ko(e,t+28)},JO=function(e,t,n){var r=ko(e,t+28),s=GO(e.subarray(t+46,t+46+r),!(ko(e,t+8)&2048)),i=t+46+r,a=qi(e,t+20),l=n&&a==4294967295?QO(e,i):[a,qi(e,t+24),qi(e,t+42)],c=l[0],d=l[1],f=l[2];return[ko(e,t+10),c,d,s,i+ko(e,t+30)+ko(e,t+32),f]},QO=function(e,t){for(;ko(e,t)!=1;t+=4+ko(e,t+2));return[ix(e,t+12),ix(e,t+4),ix(e,t+20)]};function ZO(e,t){for(var n={},r=e.length-22;qi(e,r)!=101010256;--r)(!r||e.length-r>65558)&&vi(13);var s=ko(e,r+8);if(!s)return{};var i=qi(e,r+16),a=i==4294967295||s==65535;if(a){var l=qi(e,r-12);a=qi(e,l)==101075792,a&&(s=qi(e,l+32),i=qi(e,l+48))}for(var c=0;c<s;++c){var d=JO(e,i,a),f=d[0],u=d[1],p=d[2],m=d[3],y=d[4],b=d[5],k=XO(e,b);i=y,f?f==8?n[m]=KO(e.subarray(k,k+u),{out:new Qs(p)}):vi(14,"unknown compression type "+f):n[m]=Vv(e,k,k+u)}return n}const e$=8*1024*1024,t$=500;function n$(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 r$(e){return e?e.split("/").some(n=>n==="__MACOSX"||n.startsWith("._")):!0}function s$(e){const t=e.toLowerCase();if(t==="flow.yaml"||t==="flow.yml")return"";const n="/flow.yaml",r="/flow.yml";let s=null;if(t.endsWith(n))s=e.slice(0,-n.length);else if(t.endsWith(r))s=e.slice(0,-r.length);else return null;return s.includes("/")?null:s}const i$=/^[a-zA-Z][a-zA-Z0-9_-]*$/;async function o$(e){try{const t=new Uint8Array(await e.arrayBuffer()),n=ZO(t),r=new Map;let s=0,i=0;for(const[c,d]of Object.entries(n)){if(c.endsWith("/"))continue;const f=n$(c);if(!f||r$(f))continue;const u=(d==null?void 0:d.length)??0;if(s+=u,s>e$||(i+=1,i>t$))return null;r.set(f,u)}if(r.size===0)return null;const a=new Set;for(const c of r.keys()){const d=s$(c);d!==null&&a.add(d)}if(a.size!==1)return null;const[l]=[...a];if(l==="")return null;for(const c of r.keys())if(!(c===l||c.startsWith(`${l}/`)))return null;return i$.test(l)?l:null}catch{return null}}const ox=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function a$({file:e,onClose:t,onImported:n}){const{t:r}=Mn(),s=h.useId(),i=h.useRef(null),a=h.useRef(null),[l,c]=h.useState(""),[d,f]=h.useState("user"),[u,p]=h.useState(!1),[m,y]=h.useState(""),[b,k]=h.useState(null),g=b??e;h.useEffect(()=>{const _=requestAnimationFrame(()=>{var C;return(C=i.current)==null?void 0:C.focus()});return()=>cancelAnimationFrame(_)},[]),h.useEffect(()=>{let _=!1;return(async()=>{const C=g.name||"",T=C.toLowerCase();let H="";if(T.endsWith(".zip")){if(H=await o$(g)||"",!H){const M=C.replace(/\.zip$/i,"");ox.test(M)&&(H=M)}}else if(T.endsWith(".yaml")||T.endsWith(".yml")){const M=C.replace(/\.ya?ml$/i,"");ox.test(M)&&(H=M)}_||c(H)})(),()=>{_=!0}},[g]);const v=l.trim(),x=v.length>0&&ox.test(v);async function N(_){if(_.preventDefault(),!(!x||u)){p(!0),y("");try{const C=new FormData;C.set("flowId",v),C.set("targetSpace",d),C.set("file",g,g.name);const T=await fetch("/api/flows/import",{method:"POST",body:C}),H=await T.json().catch(()=>({}));if(!T.ok){y(typeof H.error=="string"?H.error:r("project:importModal.importFailed"));return}n({id:H.flowId,source:H.flowSource??"user"})}catch(C){y(String((C==null?void 0:C.message)||C))}finally{p(!1)}}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:_=>{_.target===_.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:_=>_.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:s,className:"af-shortcuts-panel__title",children:r("project:importModal.title")}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":r("project:importModal.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:N,children:[o.jsx("p",{className:"af-new-pipeline-lead",children:r("project:importModal.lead",{filename:g.name})}),o.jsx("input",{ref:a,type:"file",className:"af-import-file-input",accept:".yaml,.yml,.zip,application/zip","aria-hidden":!0,tabIndex:-1,onChange:_=>{var T;const C=(T=_.target.files)==null?void 0:T[0];C&&k(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(_.target.value),"aria-invalid":v.length>0&&!x}),o.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-hint",children:r("project:importModal.nameHint")})]}),o.jsx("div",{className:"af-import-repick",children:o.jsx("button",{type:"button",className:"af-btn-secondary af-import-repick-btn",onClick:()=>{var _;return(_=a.current)==null?void 0:_.click()},children:r("project:importModal.changeFile")})}),m?o.jsx("p",{className:"af-err af-new-pipeline-err",children:m}):null,o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:u,children:r("project:importModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!x||u,children:r(u?"project:importModal.importing":"project:importModal.importAndOpen")})]})]})]})})}const l$=/^[a-zA-Z][a-zA-Z0-9_-]*$/,jS="af:newPipelineGuide";function c$({open:e,onClose:t,onCreated:n}){const{t:r}=Mn(),s=h.useId(),i=h.useRef(null),[a,l]=h.useState(""),[c,d]=h.useState(""),[f,u]=h.useState("user"),[p,m]=h.useState(!1),[y,b]=h.useState(""),[k,g]=h.useState(!1);h.useEffect(()=>{if(!e)return;l(""),d(""),u("user"),b(""),m(!1),localStorage.getItem(jS)==="true"&&g(!0);const T=requestAnimationFrame(()=>{var H;return(H=i.current)==null?void 0:H.focus()});return()=>cancelAnimationFrame(T)},[e]);const v=()=>{localStorage.removeItem(jS),g(!1)};if(!e)return null;const x=a.trim(),N=x.length>0&&l$.test(x);async function _(C){if(C.preventDefault(),!(!N||p)){m(!0),b(""),v();try{const T=await fetch("/api/flows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:x,description:c.trim(),targetSpace:f})}),H=await T.json().catch(()=>({}));if(!T.ok){b(typeof H.error=="string"?H.error:r("project:newPipelineModal.createFailed"));return}n({id:H.flowId,source:H.flowSource??"user"})}catch(T){b(String((T==null?void 0:T.message)||T))}finally{m(!1)}}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:C=>{C.target===C.currentTarget&&(v(),t())},children:o.jsxs("div",{ref:i,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":s,tabIndex:-1,onMouseDown: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:newPipelineModal.title")}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:()=>{v(),t()},"aria-label":r("project:newPipelineModal.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),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:v,children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]})}):null,o.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:_,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:C=>l(C.target.value),"aria-invalid":x.length>0&&!N}),o.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-hint",children:r(k?"onboarding:newPipeline.nameHintGuide":"project:newPipelineModal.nameHint")})]}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:r("project:newPipelineModal.descLabel")}),o.jsx("textarea",{className:"af-pipeline-drawer-textarea af-new-pipeline-textarea",name:"pipelineDescription",rows:3,placeholder:r(k?"onboarding:newPipeline.descPlaceholderGuide":"project:newPipelineModal.descPlaceholder"),value:c,onChange:C=>d(C.target.value)}),k?o.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-guide-hint",children:r("onboarding:newPipeline.descHintGuide")}):null]}),y?o.jsx("p",{className:"af-err af-new-pipeline-err",children:y}):null,o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:()=>{v(),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 rP="agentflow.pipelineViewPreference";function sP(e,t="user",n=!1){return`${String(t||"user")}:${String(e||"")}:${n?"archived":"active"}`}function iP(){if(typeof localStorage>"u")return{};try{const e=JSON.parse(localStorage.getItem(rP)||"{}");return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}catch{return{}}}function u$(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(rP,JSON.stringify(e))}catch{}}function Um(e){return e==="display"?"display":e==="pipeline"?"pipeline":"workspace"}function d$(e){return(e==null?void 0:e.hasPipeline)!==!1&&(e==null?void 0:e.hasFlow)!==!1&&(e==null?void 0:e.flowYaml)!==!1}function oP(e,t,n,r=!1){if(!e)return;const s=iP();s[sP(e,t,r)]={view:Um(n),at:Date.now()},u$(s)}function f$(e,t="workspace"){if(!(e!=null&&e.id))return Um(t);const r=iP()[sP(e.id,e.source??"user",!!e.archived)],s=Um((r==null?void 0:r.view)||t);return s==="pipeline"&&!d$(e)?"workspace":s}function Df(e,t="workspace"){const n=Um(t);if(!(e!=null&&e.id))return n==="pipeline"?"/flow":n==="display"?"/workspace?view=display":"/workspace";const r=new URLSearchParams({flowId:e.id,flowSource:e.source??"user"});return e.archived&&r.set(n==="pipeline"?"flowArchived":"archived","1"),n==="display"&&r.set("view","display"),`/${n==="pipeline"?"flow":"workspace"}?${r.toString()}`}function kh(e,t="workspace"){return Df(e,f$(e,t))}function p$(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 Qw(e){return String((e==null?void 0:e.version)||"").trim()}function h$(e){const t=Qw(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 m$({onChanged:e}){const[t,n]=h.useState({available:!1,version:"",loggedIn:!1,user:"",error:""}),[r,s]=h.useState([]),[i,a]=h.useState(""),[l,c]=h.useState("keyword"),[d,f]=h.useState([]),[u,p]=h.useState({}),[m,y]=h.useState(""),[b,k]=h.useState(""),[g,v]=h.useState(""),x=h.useCallback(async()=>{k("");try{const[M,F]=await Promise.all([fetch("/api/skillhub/status"),fetch("/api/skillhub/list?target=global&agent=codex")]),D=await M.json().catch(()=>({}));M.ok&&n({available:!!D.available,version:typeof D.version=="string"?D.version:"",loggedIn:!!D.loggedIn,user:typeof D.user=="string"?D.user:"",error:typeof D.error=="string"?D.error:""});const $=await F.json().catch(()=>({}));if(!F.ok)throw new Error(typeof $.error=="string"?$.error:"HTTP "+F.status);s(Array.isArray($.skills)?$.skills:[]),p({})}catch(M){k(String(M.message||M))}},[]);h.useEffect(()=>{x()},[x]);const N=h.useCallback(async()=>{const M=i.trim();if(M){y("search"),k(""),v("");try{const F=await fetch(`/api/skillhub/search?q=${encodeURIComponent(M)}&mode=${encodeURIComponent(l)}`),D=await F.json().catch(()=>({}));if(!F.ok)throw new Error(typeof D.error=="string"?D.error:"HTTP "+F.status);f(Array.isArray(D.items)?D.items:[])}catch(F){k(String(F.message||F))}finally{y("")}}},[i,l]),_=h.useCallback(async(M,F=!1)=>{const D=M&&typeof M=="object"?M:null,$=String(D?D.slug||D.name||D.collection||D.skillId||D.id:M||"").trim();if($){y(`install:${$}`),k(""),v("");try{const W=D?{slug:D.slug||"",skillId:D.skillId||"",collection:D.collection||"",collectionName:D.collection&&D.name||"",target:"global",agent:"codex",force:F}:{slug:$,target:"global",agent:"codex",force:F},O=await fetch("/api/skillhub/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(W)}),R=await O.json().catch(()=>({}));if(!O.ok)throw new Error(typeof R.error=="string"?R.error:"HTTP "+O.status);v(F?`已更新 ${$}`:`已安装 ${$}`),await x(),typeof e=="function"&&await e()}catch(W){k(String(W.message||W))}finally{y("")}}},[x,e]),C=h.useCallback(async()=>{if(r.length!==0){y("check-updates"),k(""),v("");try{const M=await Promise.all(r.map(async $=>{const W=String($.name||"").trim();if(!W)return null;try{const O=await fetch(`/api/skillhub/search?q=${encodeURIComponent(W)}&mode=keyword`),R=await O.json().catch(()=>({}));if(!O.ok)throw new Error(typeof R.error=="string"?R.error:"HTTP "+O.status);const I=Array.isArray(R.items)?R.items:[],z=I.find(X=>X.slug===W||X.name===W||X.id===W)||I[0],P=Qw($),L=String((z==null?void 0:z.version)||"").trim();let E="unknown";return z?P&&L?E=p$(P,L)<0?"update":"current":L&&(E="remote-only"):E="missing",[W,{state:E,latestVersion:L,installedVersion:P,summary:(z==null?void 0:z.summary)||""}]}catch(O){return[W,{state:"error",error:String(O.message||O),installedVersion:Qw($)}]}})),F={};for(const $ of M)$&&(F[$[0]]=$[1]);p(F);const D=Object.values(F).filter($=>$.state==="update").length;v(D>0?`发现 ${D} 个可更新 skill`:"已检查,暂无明确可更新项")}finally{y("")}}},[r]),T=h.useCallback(async M=>{const F=String(M||"").trim();if(F){y(`uninstall:${F}`),k(""),v("");try{const D=await fetch("/api/skillhub/uninstall",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:F,target:"global",agent:"codex"})}),$=await D.json().catch(()=>({}));if(!D.ok)throw new Error(typeof $.error=="string"?$.error:"HTTP "+D.status);v(`已卸载 ${F}`),await x(),typeof e=="function"&&await e()}catch(D){k(String(D.message||D))}finally{y("")}}},[x,e]),H=h.useCallback(async()=>{y("update-cli"),k(""),v("");try{const M=await fetch("/api/skillhub/update",{method:"POST"}),F=await M.json().catch(()=>({}));if(!M.ok)throw new Error(typeof F.error=="string"?F.error:"HTTP "+M.status);v("SkillHub CLI 已更新"),await x()}catch(M){k(String(M.message||M))}finally{y("")}},[x]);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:x,disabled:!!m,children:"刷新"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:C,disabled:!!m||r.length===0,children:m==="check-updates"?"检查中…":"检查更新"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:H,disabled:!!m,children:m==="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=>{c(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()||m==="search",children:[o.jsx("span",{className:"material-symbols-outlined",children:"search"}),m==="search"?"搜索中…":"搜索"]})]}),b?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:b}):null,g?o.jsx("p",{className:"af-set-hint af-set-hint--inline",children:g}):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 F=u[M.name],D=!F||F.state==="update"||F.state==="remote-only"||F.state==="unknown"||F.state==="error",$=m===`install:${M.name}`?"更新中…":(F==null?void 0:F.state)==="current"?"已最新":(F==null?void 0:F.state)==="update"&&F.latestVersion?`更新到 v${F.latestVersion}`:(F==null?void 0:F.state)==="remote-only"&&F.latestVersion?`安装 v${F.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:h$(M)}),o.jsx("div",{className:"af-set-skillhub-version-row",children:F?F.state==="update"?o.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--warn",children:["可更新 ",F.installedVersion?`v${F.installedVersion} -> `:"","v",F.latestVersion]}):F.state==="current"?o.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--ok",children:["已最新 v",F.latestVersion||F.installedVersion]}):F.state==="remote-only"?o.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:["远端 v",F.latestVersion,",本地版本未知"]}):F.state==="missing"?o.jsx("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:"未找到远端匹配项"}):F.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:()=>_(M.name,!0),disabled:!!m||!D,children:$}),o.jsx("button",{type:"button",className:"af-set-btn-mini af-set-btn-mini--danger",onClick:()=>T(M.name),disabled:!!m,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 F=M.slug||M.name,D=M.kind==="collection"||M.collection,$=!D&&r.some(W=>W.name===F||W.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||F}),o.jsxs("div",{className:"af-set-skillhub-meta",children:[D?`collection:${M.collection}`:F,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:$?"af-set-btn-mini":"af-set-btn-add af-set-btn-add--compact",onClick:()=>_(M,$),disabled:!!m,children:$?"更新":D?"安装合集":"安装"})]},M.id||F)})})]})]})]})}function rl(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 g$(e){return{version:1,collections:rl({collections:e})}}function cl(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 aP(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 lP(e,t){const n=new Set(Array.isArray(t)?t:[]);return(Array.isArray(e)?e:[]).filter(r=>!n.has(r))}function cP(e,t,n){const r=cl(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 y$(e,t,n){const r=String(e||"").trim().toLowerCase(),s=rl({collections:n}).find(i=>i.id===r||i.name.toLowerCase()===r);return cl(s,t)}function uP(e,t,n,r){const s=(Array.isArray(n)?n:[]).map(d=>d.key).filter(Boolean),i=String(t||"").trim().toLowerCase(),a=rl({collections:r}),l=y$(t,n,r),c=l.length>0?l:s;if(!e)return c;try{const d=localStorage.getItem(e);if(d!==null){const f=JSON.parse(d);if(Array.isArray(f)){const u=new Set(s),p=f.map(String).filter(g=>u.has(g));if(s.length>0&&p.length===s.length)return c;const m=new Set(p),y=new Set(l),b=l.length>0&&l.every(g=>m.has(g)),k=a.some(g=>{if(!g.builtin||g.id===i||g.name.toLowerCase()===i)return!1;const v=cl(g,n);return v.length>0&&v.every(x=>m.has(x))});return l.length>0&&k&&!b?c:p}}}catch{}return c}function Ld(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 x$(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 Zw(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 dP(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 w$="project:defaultCardDesc";function fP(e,t){const n=e.description!=null?String(e.description).trim():"";return n!==""?n:t(w$)}function b$(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function fr({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(`(${b$(r)})`,"gi"),a=s.split(i);return o.jsx("span",{className:t,children:a.map((l,c)=>c%2===1?o.jsx("mark",{className:"af-search-hit",children:l},c):o.jsx("span",{children:l},c))})}function v$(e,t,n){const r=[String(e.id),fP(e,n),dP(e),Zw(e.source,n).label];return e.archived&&r.push(n("project:archived")),r.join(`
|
|
41
|
+
`).toLowerCase()}function k$(e,t,n){return t?v$(e,t,n).includes(t):!0}function S$(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 ax(e,t){const n=e.trim().toLowerCase();return n?t.filter(Boolean).join(`
|
|
42
|
+
`).toLowerCase().includes(n):!0}function CS(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 ES(e){return e!=null&&e.packageDir?e.packageDir:`marketplace/flow-snippets / ${(e==null?void 0:e.id)||""}`}const N$=["all","agent","control","provide","marketplace"],j$=["all","agent","control","provide"],pP="agentflow.projects.activityPanelOpen",eb="agentflow.projects.activitySelected";function C$(){if(typeof localStorage>"u")return!0;const e=localStorage.getItem(pP);return e!=="0"}function _S(e){return`${(e==null?void 0:e.flowSource)||"user"}:${(e==null?void 0:e.flowId)||""}`}function E$(){return typeof localStorage>"u"?"":localStorage.getItem(eb)||""}function Sh(e){return!e||typeof e!="object"?[]:Object.entries(e).map(([t,n])=>({key:t,...n&&typeof n=="object"?n:{}}))}function Un(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 Ma(e){return`${(e==null?void 0:e.id)||""}:${(e==null?void 0:e.version)||""}:${(e==null?void 0:e.packageDir)||""}`}function hP(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 mP(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 tb(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 PS(e,t){return String((e==null?void 0:e.label)||(e==null?void 0:e.displayName)||(e==null?void 0:e.name)||tb(e,t))}function _$(e){return String((e==null?void 0:e.definitionId)||(e==null?void 0:e.type)||(e==null?void 0:e.runtimeType)||"").replace(/^marketplace:/,"")}function AS(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 P$(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 lx(e,t=16){const n=String(e||"").trim();return n.length<=t?n:`${n.slice(0,t-1)}…`}function A$(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 I$(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 u;!r.has(f.sourceId)||!r.has(f.targetId)||(s.set(f.targetId,(s.get(f.targetId)||0)+1),(u=i.get(f.sourceId))==null||u.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 u=l[f],p=(a.get(u)||0)+1;for(const m of i.get(u)||[])(!a.has(m)||p>a.get(m))&&(a.set(m,p),l.push(m))}n.forEach((f,u)=>{a.has(f)||a.set(f,u%3)});const c=new Map,d=new Map;return n.forEach(f=>{const u=a.get(f)||0,p=c.get(u)||0;c.set(u,p+1),d.set(f,{x:u*190,y:p*86})}),d}function T$(e){var b,k,g,v;const t=hP(e),n=mP(e),r=new Map(t.map((x,N)=>[tb(x,N),PS(x,N)])),s=t.map((x,N)=>({id:tb(x,N),title:PS(x,N),meta:_$(x)})),i=n.map((x,N)=>{const _=AS(x,"source"),C=AS(x,"target");return{key:(x==null?void 0:x.id)||`${_}-${C}-${N}`,sourceId:_,targetId:C,source:r.get(_)||_||"?",target:r.get(C)||C||"?",label:P$(x)}}),a=(k=(b=e==null?void 0:e.snippet)==null?void 0:b.ui)!=null&&k.nodePositions&&typeof e.snippet.ui.nodePositions=="object"?e.snippet.ui.nodePositions:{},l=(v=(g=e==null?void 0:e.snippet)==null?void 0:g.ui)!=null&&v.nodeSizes&&typeof e.snippet.ui.nodeSizes=="object"?e.snippet.ui.nodeSizes:{},c=I$(s,i),d=s.map(x=>{const N=A$(a[x.id])||c.get(x.id)||{x:0,y:0},_=l[x.id]&&typeof l[x.id]=="object"?l[x.id]:{},C=Number(_.width),T=Number(_.height),H=Math.max(132,Math.min(210,Number.isFinite(C)?C*.62:150)),M=Math.max(48,Math.min(76,Number.isFinite(T)?T*.46:54));return{...x,x:N.x,y:N.y,width:H,height:M}}),f=new Map(d.map(x=>[x.id,x])),u=i.map(x=>{const N=f.get(x.sourceId),_=f.get(x.targetId);if(!N||!_)return null;const C=N.x+N.width,T=N.y+N.height/2,H=_.x,M=_.y+_.height/2,F=Math.max(48,Math.abs(H-C)*.45);return{...x,path:`M ${C} ${T} C ${C+F} ${T}, ${H-F} ${M}, ${H} ${M}`,labelX:(C+H)/2,labelY:(T+M)/2}}).filter(Boolean),p=d.reduce((x,N)=>({minX:Math.min(x.minX,N.x),minY:Math.min(x.minY,N.y),maxX:Math.max(x.maxX,N.x+N.width),maxY:Math.max(x.maxY,N.y+N.height)}),{minX:0,minY:0,maxX:420,maxY:220}),m=36,y=`${p.minX-m} ${p.minY-m} ${Math.max(360,p.maxX-p.minX+m*2)} ${Math.max(180,p.maxY-p.minY+m*2)}`;return{nodes:s,edges:i,diagram:{nodes:d,edges:u,viewBox:y}}}function Oc({resourceKind:e="",authUser:t=null}){var xn,er,bs,Yr,li,Ws;const{t:n}=Mn(),{navigate:r,path:s}=Ro(),[i,a]=h.useState(e||"all"),[l,c]=h.useState([]),[d,f]=h.useState([]),[u,p]=h.useState([]),[m,y]=h.useState([]),[b,k]=h.useState([]),[g,v]=h.useState(""),[x,N]=h.useState(!1),[_,C]=h.useState([]),[T,H]=h.useState(""),[M,F]=h.useState(""),[D,$]=h.useState(!1),[W,O]=h.useState(!1),[R,I]=h.useState(!1),[z,P]=h.useState(null),[L,E]=h.useState(!1),[X,ee]=h.useState(""),[V,ie]=h.useState(C$),[fe,me]=h.useState(E$),[ge,Z]=h.useState("all"),[ae,xe]=h.useState(""),[pe,_e]=h.useState("overview"),[je,Ve]=h.useState({}),[et,qe]=h.useState(""),[dt,He]=h.useState({}),[bt,sn]=h.useState(""),[on,an]=h.useState(""),[Yt,En]=h.useState({}),[hn,ue]=h.useState(""),[ke,De]=h.useState(""),[rt,at]=h.useState(""),[Lt,st]=h.useState(""),[mn,Zt]=h.useState(""),[ar,_n]=h.useState(!1),[gn,bn]=h.useState(""),[lr,ve]=h.useState({hiddenBuiltins:[],promoted:[]}),$e=h.useRef(0),nt=h.useRef(0),zt=h.useRef(0),oe=h.useCallback(async()=>{var we,Le;const K=++nt.current;H("");try{const Me=await fetch("/api/flows");if(K!==nt.current)return;if(!Me.ok)throw new Error("HTTP "+Me.status);const Ke=await Me.json();if(K!==nt.current)return;c(Array.isArray(Ke)?Ke:[])}catch(Me){if(K!==nt.current)return;c([]),H(String(Me.message||Me))}try{const Me=await fetch("/api/pipeline-recent-runs");if(K!==nt.current)return;if(Me.ok){const Ke=await Me.json();if(K!==nt.current)return;C(Array.isArray(Ke.runs)?Ke.runs:[])}else C([])}catch{if(K!==nt.current)return;C([])}if(t!=null&&t.isAdmin)try{const Me=await fetch("/api/admin/builtin-flows");if(K!==nt.current)return;const Ke=await Me.json().catch(()=>({}));Me.ok&&ve({hiddenBuiltins:Array.isArray((we=Ke==null?void 0:Ke.config)==null?void 0:we.hiddenBuiltins)?Ke.config.hiddenBuiltins:[],promoted:Array.isArray((Le=Ke==null?void 0:Ke.config)==null?void 0:Le.promoted)?Ke.config.promoted:[]})}catch{if(K!==nt.current)return;ve({hiddenBuiltins:[],promoted:[]})}else ve({hiddenBuiltins:[],promoted:[]});$(!0)},[t==null?void 0:t.isAdmin]),Te=h.useCallback(async(K,we)=>{if(!(t!=null&&t.isAdmin)||!(K!=null&&K.id))return;const Le=`${we}:${K.source}:${K.id}`;bn(Le),H("");try{const Me=await fetch("/api/admin/builtin-flows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:we,flowId:K.id,ownerUserId:K.ownerUserId||t.userId})}),Ke=await Me.json().catch(()=>({}));if(!Me.ok)throw new Error(Ke.error||"更新内置配置失败");await oe()}catch(Me){H(String(Me.message||Me))}finally{bn("")}},[t==null?void 0:t.isAdmin,t==null?void 0:t.userId,oe]),Ue=h.useCallback(async()=>{const K=++zt.current;F(""),O(!1);const we=e==="my-nodes"?"/api/nodes?scope=owned":"/api/nodes",Le=e==="my-flows"?"/api/marketplace/flow-snippets?scope=owned":"/api/marketplace/flow-snippets";f([]),y([]),xe("");try{const[Me,Ke,en,Mt]=await Promise.all([fetch(we),fetch("/api/skills"),fetch("/api/skill-collections"),fetch(Le)]),wn=await Me.json().catch(()=>({})),Gr=await Ke.json().catch(()=>({})),ls=await en.json().catch(()=>({})),Vs=await Mt.json().catch(()=>({}));if(!Me.ok)throw new Error(wn.error||"Nodes HTTP "+Me.status);if(!Ke.ok)throw new Error(Gr.error||"Skills HTTP "+Ke.status);if(!en.ok)throw new Error(ls.error||"Collections HTTP "+en.status);if(!Mt.ok)throw new Error(Vs.error||"Flow snippets HTTP "+Mt.status);if(K!==zt.current)return;f(Array.isArray(wn.nodes)?wn.nodes:Array.isArray(wn)?wn:[]),p(Array.isArray(Gr.skills)?Gr.skills:[]),k(rl(ls)),y(Array.isArray(Vs.snippets)?Vs.snippets:[])}catch(Me){if(K!==zt.current)return;f([]),p([]),y([]),k([]),F(String(Me.message||Me))}finally{if(K!==zt.current)return;O(!0)}},[e]);h.useEffect(()=>{$(!1),oe(),Ue()},[oe,Ue]),h.useEffect(()=>{try{localStorage.setItem(pP,V?"1":"0")}catch{}},[V]),h.useEffect(()=>{try{fe?localStorage.setItem(eb,fe):localStorage.removeItem(eb)}catch{}},[fe]),h.useEffect(()=>{let K=!1;return fetch("/api/ui-context").then(we=>we.json()).then(we=>{K||_n(!!we.hideCommunityLinks)}).catch(()=>{}),()=>{K=!0}},[]);const Ht=h.useCallback(async K=>{const we=rl({collections:K});N(!0),F("");try{const Le=await fetch("/api/skill-collections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(g$(we))}),Me=await Le.json().catch(()=>({}));if(!Le.ok)throw new Error(Me.error||"Collections HTTP "+Le.status);k(rl(Me))}catch(Le){F(String(Le.message||Le))}finally{N(!1)}},[]),yn=h.useCallback(()=>{const K=g.trim();if(!K)return;const we=K.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"collection",Le=new Set(b.map(Mt=>Mt.id));let Me=we,Ke=2;for(;Le.has(Me);)Me=`${we}-${Ke++}`;const en=Date.now();Ht([...b,{id:Me,name:K,skillKeys:[],createdAt:en,updatedAt:en}]),v(""),Z(`collection:${Me}`)},[g,Ht,b]),cr=h.useCallback(K=>{const we=b.find(Me=>Me.id===K);if(we!=null&&we.builtin)return;const Le=b.filter(Me=>Me.id!==K);ge===`collection:${K}`&&Z("all"),Ht(Le)},[ge,Ht,b]),Hs=h.useCallback((K,we,Le)=>{const Me=String(we||"").trim();if(!Me)return;const Ke=Date.now(),en=b.map(Mt=>{if(Mt.id!==K)return Mt;const wn=new Set(Mt.skillKeys||[]);return Le?wn.add(Me):wn.delete(Me),{...Mt,skillKeys:Array.from(wn),updatedAt:Ke}});Ht(en)},[Ht,b]),as=h.useCallback(async K=>{const we=K==null?void 0:K.packageId,Le=K==null?void 0:K.version;if(!we||!Le||!window.confirm(n("project:deleteMyNodeConfirm",{id:we,version:Le})))return;const Me=Un(K);De(Me),at(""),F("");try{const Ke=new URLSearchParams({id:we,version:Le}),en=await fetch(`/api/marketplace/node?${Ke.toString()}`,{method:"DELETE"}),Mt=await en.json().catch(()=>({}));if(!en.ok||(Mt==null?void 0:Mt.ok)===!1){const wn=Array.isArray(Mt==null?void 0:Mt.usage)&&Mt.usage.length>0?` ${n("project:deleteMyNodeUsedBy",{count:Mt.usage.length})}`:"";throw new Error(((Mt==null?void 0:Mt.error)||"Delete failed")+wn)}at(n("project:deleteMyNodeSuccess",{id:we,version:Le})),He(wn=>{const Gr={...wn};return delete Gr[Me],Gr}),En(wn=>{const Gr={};for(const[ls,Vs]of Object.entries(wn))ls.startsWith(`${Me}:`)||(Gr[ls]=Vs);return Gr}),xe(""),await Ue()}catch(Ke){at(String(Ke.message||Ke))}finally{De("")}},[Ue,n]),hr=h.useCallback(async K=>{const we=K==null?void 0:K.id,Le=(K==null?void 0:K.version)||"1.0.0";if(!we||!Le||!window.confirm(n("project:deleteMyFlowConfirm",{id:we,version:Le})))return;const Me=Ma(K);st(Me),Zt(""),F("");try{const Ke=new URLSearchParams({id:we,version:Le}),en=await fetch(`/api/marketplace/flow-snippet?${Ke.toString()}`,{method:"DELETE"}),Mt=await en.json().catch(()=>({}));if(!en.ok||(Mt==null?void 0:Mt.ok)===!1)throw new Error((Mt==null?void 0:Mt.error)||"Delete failed");Zt(n("project:deleteMyFlowSuccess",{id:we,version:Le})),xe(""),await Ue()}catch(Ke){Zt(String(Ke.message||Ke))}finally{st("")}},[Ue,n]);h.useEffect(()=>{if(e==="nodes"||e==="my-nodes"||e==="my-flows"||e==="skills"){a(e),Z("all"),xe(""),_e("overview");return}a(K=>K==="archived"?"archived":"all")},[e]),h.useEffect(()=>{if(s!=="/projects"&&s!=="/")return;const K=new URLSearchParams(window.location.search);let we=!1;if(K.get("tab")==="nodes"){r("/nodes");return}if(K.get("tab")==="my-nodes"){r("/my-nodes");return}if(K.get("tab")==="my-flows"){r("/my-flows");return}if(K.get("tab")==="skills"){r("/skills");return}if(K.get("tab")==="archived"&&(a("archived"),K.delete("tab"),we=!0),K.get("new")==="1"&&(I(!0),K.delete("new"),we=!0),we){const Le=K.toString();window.history.replaceState({},"",Le?`/projects?${Le}`:"/projects")}},[s,r]);const Zn=h.useMemo(()=>LO(_,X_(),l),[_,l,s]),Vr=h.useMemo(()=>Zn.filter(K=>S$(X,K)),[Zn,X]),ot=X.trim().toLowerCase(),Ur=h.useMemo(()=>i==="archived"?l.filter(K=>K.archived):l.filter(K=>!K.archived),[l,i]),Ai=h.useMemo(()=>Ur.filter(K=>k$(K,ot,n)),[Ur,ot,n]),xa=h.useMemo(()=>new Set((lr.promoted||[]).map(K=>String((K==null?void 0:K.id)||"").trim()).filter(Boolean)),[lr.promoted]),xs=h.useMemo(()=>(lr.hiddenBuiltins||[]).map(K=>String(K||"").trim()).filter(Boolean),[lr.hiddenBuiltins]),Ie=i==="nodes"||i==="my-nodes",cn=i==="my-nodes",mr=i==="my-flows",ht=h.useMemo(()=>d.filter(K=>cn&&K.source!=="marketplace"?!1:(ge==="all"||(ge==="marketplace"?K.source==="marketplace":K.type===ge))&&ax(X,[K.id,K.label,K.displayName,K.description,K.type,K.source,K.packageId,K.version])),[d,cn,X,ge]),Oe=h.useMemo(()=>{const K=new Map;for(const we of b)K.set(we.id,new Set(we.skillKeys||[]));return K},[b]),Kr=h.useMemo(()=>[{id:"all",label:"全部"},...b.map(K=>({id:`collection:${K.id}`,label:K.name,count:K.skillKeys.length,collection:K})),{id:"ungrouped",label:"未分组"}],[b]),Gn=h.useMemo(()=>u.filter(K=>{var Me;const we=Un(K);let Le=ge==="all";if(ge.startsWith("collection:")){const Ke=ge.slice(11);Le=!!((Me=Oe.get(Ke))!=null&&Me.has(we))}else ge==="ungrouped"&&(Le=!Array.from(Oe.values()).some(Ke=>Ke.has(we)));return Le&&ax(X,[K.name,K.id,K.description,K.sourceLabel,K.source,K.path])}),[u,X,ge,Oe]),qr=h.useMemo(()=>m.filter(K=>ax(X,[K.id,K.name,K.displayName,K.description,K.version,K.packageDir,Array.isArray(K.tags)?K.tags.join(" "):""])),[m,X]),Cr=Ie||mr||i==="skills",ut=h.useMemo(()=>ht.find(K=>Un(K)===ae)||ht[0]||null,[ht,ae]),Ut=h.useMemo(()=>Gn.find(K=>Un(K)===ae)||Gn[0]||null,[Gn,ae]),un=h.useMemo(()=>qr.find(K=>Ma(K)===ae)||qr[0]||null,[qr,ae]),Er=Ut?je[Un(Ut)]:null,tt=ut?dt[Un(ut)]:null,gr=ut&&on?Yt[`${Un(ut)}:${on}`]:null,Bs=n(Ie?"project:searchNodes":mr?"project:searchFlows":i==="skills"?"project:searchSkills":"project:searchPipelines");h.useEffect(()=>{if(i!=="skills"||!Ut)return;const K=Un(Ut);if(je[K])return;let we=!1;return qe(K),fetch(`/api/skills/detail?key=${encodeURIComponent(K)}`).then(Le=>Le.json().then(Me=>({ok:Le.ok,json:Me}))).then(({ok:Le,json:Me})=>{we||Le&&Me.skill&&Ve(Ke=>({...Ke,[K]:Me.skill}))}).catch(()=>{}).finally(()=>{we||qe("")}),()=>{we=!0}},[i,Ut,je]),h.useEffect(()=>{if(!Ie||!ut)return;const K=Un(ut);if(dt[K])return;let we=!1;return sn(K),fetch(`/api/nodes/detail?id=${encodeURIComponent(ut.id)}`).then(Le=>Le.json().then(Me=>({ok:Le.ok,json:Me}))).then(({ok:Le,json:Me})=>{we||Le&&He(Ke=>({...Ke,[K]:Me}))}).catch(()=>{}).finally(()=>{we||sn("")}),()=>{we=!0}},[Ie,ut,dt]),h.useEffect(()=>{if(!Ie)return;const K=Array.isArray(tt==null?void 0:tt.files)?tt.files:[];an(we=>{var Le;return we&&K.some(Me=>Me.path===we)?we:((Le=K[0])==null?void 0:Le.path)||""})},[Ie,tt]),h.useEffect(()=>{if(!Ie||!ut||!on)return;const K=`${Un(ut)}:${on}`;if(Yt[K])return;let we=!1;return ue(K),fetch(`/api/nodes/file?id=${encodeURIComponent(ut.id)}&path=${encodeURIComponent(on)}`).then(Le=>Le.json().then(Me=>({ok:Le.ok,json:Me}))).then(({ok:Le,json:Me})=>{we||Le&&En(Ke=>({...Ke,[K]:Me}))}).catch(()=>{}).finally(()=>{we||ue("")}),()=>{we=!0}},[Ie,ut,on,Yt]),h.useEffect(()=>{at("")},[ae,i]);const wa=K=>{r(kh(K,"workspace"))},ws=K=>{me(_S(K)),r(kh({id:K.flowId,source:K.flowSource,archived:!!K.archived},"workspace"))},Oo=h.useCallback(K=>{var we,Le;K.preventDefault(),K.stopPropagation(),(Le=(we=K.dataTransfer)==null?void 0:we.types)!=null&&Le.includes("Files")&&($e.current+=1,E(!0))},[]),vr=h.useCallback(K=>{K.preventDefault(),K.stopPropagation(),$e.current-=1,$e.current<=0&&($e.current=0,E(!1))},[]),$o=h.useCallback(K=>{K.preventDefault(),K.stopPropagation()},[]),Ii=h.useCallback(K=>{var Me,Ke;K.preventDefault(),K.stopPropagation(),$e.current=0,E(!1);const we=(Ke=(Me=K.dataTransfer)==null?void 0:Me.files)==null?void 0:Ke[0];if(!we)return;const Le=we.name.toLowerCase();!Le.endsWith(".yaml")&&!Le.endsWith(".yml")&&!Le.endsWith(".zip")||P(we)},[]);return o.jsxs("div",{className:"af-projects"+(L?" af-projects--drop-target":""),onDragEnter:Oo,onDragLeave:vr,onDragOver:$o,onDrop:Ii,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"+(X.trim()?" af-search--has-clear":""),type:"search",placeholder:Bs,"aria-label":Bs,autoComplete:"off",value:X,onChange:K=>ee(K.target.value),onKeyDown:K=>{K.key==="Escape"&&(ee(""),K.currentTarget.blur())}}),X.trim()?o.jsx("button",{type:"button",className:"af-search-clear","aria-label":"Clear search",onClick:()=>ee(""),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),Cr?o.jsx("button",{type:"button",className:"af-btn-primary af-create-btn",onClick:()=>Ue(),children:n("project:refreshResources")}):o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-icon-btn"+(V?" af-icon-btn--active":""),"aria-label":n("flow:palette.toggleRecentActivity"),"aria-expanded":V,"aria-controls":"af-recent-activity-panel",onClick:()=>ie(K=>!K),children:o.jsx("span",{className:"material-symbols-outlined",children:"notifications"})}),o.jsx("button",{type:"button",className:"af-btn-primary af-create-btn",onClick:()=>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:ot?n("project:filterResult",{count:i==="nodes"||i==="my-nodes"?ht.length:i==="my-flows"?qr.length:i==="skills"?Gn.length:Ai.length}):i==="my-nodes"?n("project:myNodesHint",{count:ht.length}):i==="my-flows"?n("project:myFlowsHint",{count:qr.length}):i==="nodes"?n("project:nodesHint",{count:d.length}):i==="skills"?n("project:skillsHint",{count:u.length}):n(i==="archived"?"project:archivedHint":"project:activeHint")}),T?o.jsx("p",{className:"af-err af-projects-api-hint",children:T}):null,M&&Cr?o.jsx("p",{className:"af-err af-projects-api-hint",children:M}):null]}),Cr?o.jsxs("div",{className:"af-resource-toolbar",children:[i==="skills"?o.jsx(m$,{onChanged:Ue}):null,o.jsxs("div",{className:"af-resource-purpose",children:[o.jsx("span",{className:"material-symbols-outlined",children:mr?"schema":Ie?cn?"deployed_code":"account_tree":"extension"}),o.jsxs("div",{children:[o.jsx("h3",{children:n(mr?"project:myFlowsPurposeTitle":cn?"project:myNodesPurposeTitle":Ie?"project:nodesPurposeTitle":"project:skillsPurposeTitle")}),o.jsx("p",{children:n(mr?"project:myFlowsPurposeDesc":cn?"project:myNodesPurposeDesc":Ie?"project:nodesPurposeDesc":"project:skillsPurposeDesc")})]})]}),mr?null:o.jsx("div",{className:"af-resource-filter-row",children:(Ie?(cn?j$:N$).map(K=>({id:K,label:n(`project:resourceFilter.${K}`)})):Kr).map(K=>K.collection?o.jsxs("span",{className:"af-resource-filter-chip"+(ge===K.id?" af-resource-filter-chip--active":""),children:[o.jsxs("button",{type:"button",className:"af-resource-filter af-resource-filter--embedded",onClick:()=>{Z(K.id),xe("")},children:[K.label,o.jsx("em",{children:K.count}),K.collection.builtin?o.jsx("strong",{children:"built-in"}):null]}),K.collection.builtin?null:o.jsx("button",{type:"button",className:"af-resource-filter-chip__delete",disabled:x,"aria-label":`删除 ${K.collection.name}`,onClick:()=>cr(K.collection.id),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},K.id):o.jsx("button",{type:"button",className:"af-resource-filter"+(ge===K.id?" af-resource-filter--active":""),onClick:()=>{Z(K.id),xe("")},children:K.label},K.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:g,onChange:K=>v(K.target.value),onKeyDown:K=>{K.key==="Enter"&&yn()},placeholder:"新建 skill collection"}),o.jsxs("button",{type:"button",className:"af-set-btn-add af-set-btn-add--compact",disabled:!g.trim()||x,onClick:()=>yn(),children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),"新建"]})]})}):null]}):null,Ie?o.jsx("div",{className:"af-resource-grid",children:ht.length>0?ht.map(K=>o.jsxs("button",{type:"button",className:"af-resource-card"+(ut&&Un(K)===Un(ut)?" af-resource-card--active":""),onClick:()=>xe(Un(K)),children:[o.jsxs("div",{className:"af-resource-card-head",children:[o.jsx("span",{className:Ld(K.type==="control"?"secondary":K.type==="provide"?"primary":"muted"),children:o.jsx(fr,{query:X,children:K.type||"node"})}),o.jsx("span",{className:"af-resource-source",children:o.jsx(fr,{query:X,children:CS(K.source,n)})})]}),o.jsx("h3",{className:"af-project-title",children:o.jsx(fr,{query:X,children:K.label||K.displayName||K.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(fr,{query:X,children:K.description||n("project:noDescription")})}),o.jsxs("div",{className:"af-resource-meta-row",children:[o.jsx("span",{children:o.jsx(fr,{query:X,children:K.id})}),o.jsx("span",{children:n("project:nodeSlots",{inputs:Object.keys(K.inputs||{}).length,outputs:Object.keys(K.outputs||{}).length})})]}),K.packageId?o.jsxs("div",{className:"af-project-path",children:[o.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"deployed_code"}),o.jsx("span",{className:"af-path-text",children:o.jsx(fr,{query:X,children:`${K.packageId}${K.version?` / ${K.version}`:""}`})})]}):null]},`${K.id}:${K.source||""}:${K.packageId||""}`)):W?o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:ot?n("project:noNodeMatch",{query:X.trim()}):n(cn?"project:noMyNodes":"project:noNodes")})}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:n("project:loadingResources")})})}):mr?o.jsx("div",{className:"af-resource-grid",children:qr.length>0?qr.map(K=>{const we=hP(K),Le=mP(K),Me=Number.isFinite(Number(K.nodeCount))?Number(K.nodeCount):we.length,Ke=Number.isFinite(Number(K.edgeCount))?Number(K.edgeCount):Le.length;return o.jsxs("button",{type:"button",className:"af-resource-card"+(un&&Ma(K)===Ma(un)?" af-resource-card--active":""),onClick:()=>xe(Ma(K)),children:[o.jsxs("div",{className:"af-resource-card-head",children:[o.jsx("span",{className:Ld("primary"),children:o.jsx(fr,{query:X,children:K.version?`v${K.version}`:"flow"})}),o.jsx("span",{className:"af-resource-source",children:n("project:flowSnippet")})]}),o.jsx("h3",{className:"af-project-title",children:o.jsx(fr,{query:X,children:K.displayName||K.name||K.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(fr,{query:X,children:K.description||n("project:noDescription")})}),o.jsxs("div",{className:"af-resource-meta-row",children:[o.jsx("span",{children:n("project:flowSnippetNodes",{nodes:Me,edges:Ke})}),o.jsx("span",{children:o.jsx(fr,{query:X,children:K.id})})]}),o.jsxs("div",{className:"af-project-path",children:[o.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"schema"}),o.jsx("span",{className:"af-path-text",children:o.jsx(fr,{query:X,children:ES(K)})})]})]},Ma(K))}):W?o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:ot?n("project:noFlowSnippetMatch",{query:X.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:Gn.length>0?Gn.map(K=>o.jsxs("button",{type:"button",className:"af-resource-card"+(Ut&&Un(K)===Un(Ut)?" af-resource-card--active":""),onClick:()=>xe(Un(K)),children:[o.jsxs("div",{className:"af-resource-card-head",children:[o.jsx("span",{className:Ld(K.source==="builtin"?"muted":"primary"),children:o.jsx(fr,{query:X,children:K.sourceLabel||K.source||"skill"})}),o.jsx("span",{className:"af-resource-source",children:n("project:skill")})]}),o.jsx("h3",{className:"af-project-title",children:o.jsx(fr,{query:X,children:K.name||K.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(fr,{query:X,children:K.description||n("project:noDescription")})}),o.jsxs("div",{className:"af-project-path",children:[o.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"extension"}),o.jsx("span",{className:"af-path-text",children:o.jsx(fr,{query:X,children:K.path||K.key||""})})]}),o.jsxs("div",{className:"af-skill-card-collections",children:[b.filter(we=>we.skillKeys.includes(Un(K))).slice(0,3).map(we=>o.jsx("span",{children:we.name},we.id)),b.filter(we=>we.skillKeys.includes(Un(K))).length===0?o.jsx("span",{className:"af-skill-card-collection-empty",children:"未分组"}):null]})]},K.key||`${K.source}:${K.name}`)):W?o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:ot?n("project:noSkillMatch",{query:X.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"&&xs.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:xs.map(K=>{const we=gn===`show-builtin:builtin:${K}`;return o.jsxs("button",{type:"button",disabled:we,onClick:()=>Te({id:K,source:"builtin"},"show-builtin"),children:[o.jsx("span",{children:K}),o.jsx("em",{children:we?"恢复中":"恢复"})]},K)})})]}):null,o.jsxs("div",{className:"af-project-grid",children:[Ai.length>0?Ai.map(K=>{const we=(t==null?void 0:t.isAdmin)&&K.source==="user"&&!K.archived&&!xa.has(K.id),Le=(t==null?void 0:t.isAdmin)&&K.source==="admin",Me=(t==null?void 0:t.isAdmin)&&K.source==="builtin",Ke=gn.endsWith(`:${K.source}:${K.id}`);return o.jsx("div",{className:"af-project-card",role:"button",tabIndex:0,onClick:()=>wa(K),onKeyDown:en=>{(en.key==="Enter"||en.key===" ")&&(en.preventDefault(),wa(K))},children:o.jsxs("div",{className:"af-project-card-body",children:[o.jsx("span",{className:Ld(Zw(K.source,n).tone),children:o.jsx(fr,{query:X,children:Zw(K.source,n).label})}),K.archived?o.jsx("span",{className:Ld("muted"),children:o.jsx(fr,{query:X,children:n("project:archived")})}):null,o.jsx("h3",{className:"af-project-title",children:o.jsx(fr,{query:X,children:K.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(fr,{query:X,children:fP(K,n)})}),o.jsxs("div",{className:"af-project-path",children:[o.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"database"}),o.jsx("span",{className:"af-path-text",children:o.jsx(fr,{query:X,children:dP(K)})})]}),t!=null&&t.isAdmin?o.jsxs("div",{className:"af-project-admin-actions",onClick:en=>en.stopPropagation(),onKeyDown:en=>en.stopPropagation(),children:[we?o.jsx("button",{type:"button",disabled:Ke,onClick:()=>Te(K,"promote"),children:"设为内置"}):null,Le?o.jsx("button",{type:"button",disabled:Ke,onClick:()=>Te(K,"unpromote"),children:"取消内置"}):null,Me?o.jsx("button",{type:"button",disabled:Ke,onClick:()=>Te(K,"hide-builtin"),children:"隐藏内置"}):null]}):null]})},`${K.id}:${K.source??"user"}:${K.archived?"a":""}`)}):D?Ur.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(T?"project:loadFailed":"project:noPipelines")}),!T&&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:X.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")})]}),ar?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")})]})]})]})]}),Cr?o.jsx("aside",{className:"af-resource-detail","aria-label":n(Ie?"project:nodeDetail":mr?"project:flowDetail":"project:skillDetail"),children:Ie&&ut?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-resource-detail-head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"account_tree"}),o.jsxs("div",{children:[o.jsx("h3",{children:ut.label||ut.displayName||ut.id}),o.jsx("p",{children:ut.id})]})]}),o.jsx("div",{className:"af-resource-detail-tabs",children:["overview","schema","runtime","files","usage"].map(K=>o.jsx("button",{type:"button",className:"af-resource-detail-tab"+(pe===K?" af-resource-detail-tab--active":""),onClick:()=>_e(K),children:n(`project:nodeDetailTabs.${K}`)},K))}),bt===Un(ut)?o.jsx("p",{className:"af-resource-detail-desc",children:n("project:loadingResources")}):pe==="overview"?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"af-resource-detail-desc",children:ut.description||((xn=tt==null?void 0:tt.node)==null?void 0:xn.description)||n("project:noDescription")}),o.jsxs("dl",{className:"af-resource-detail-kv",children:[o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailType")}),o.jsx("dd",{children:ut.type||((er=tt==null?void 0:tt.node)==null?void 0:er.type)||"node"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailSource")}),o.jsx("dd",{children:CS(ut.source,n)})]}),ut.packageId?o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPackage")}),o.jsx("dd",{children:ut.packageId})]}):null,ut.version?o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailVersion")}),o.jsx("dd",{children:ut.version})]}):null,ut.packageDir||tt!=null&&tt.baseDir?o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPath")}),o.jsx("dd",{children:ut.packageDir||(tt==null?void 0:tt.baseDir)})]}):null,o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailEditable")}),o.jsx("dd",{children:(tt==null?void 0:tt.readOnly)===!1?n("project:editable"):n("project:readOnly")})]})]}),cn&&ut.source==="marketplace"?o.jsxs("div",{className:"af-resource-detail-section af-resource-danger-zone",children:[o.jsx("h4",{children:n("project:myNodeManagement")}),o.jsx("p",{children:n("project:deleteMyNodeHint")}),o.jsxs("button",{type:"button",className:"af-btn-secondary af-btn-danger",disabled:ke===Un(ut),onClick:()=>as(ut),children:[o.jsx("span",{className:"material-symbols-outlined",children:"delete"}),ke===Un(ut)?n("project:deletingMyNode"):n("project:deleteMyNode")]}),rt?o.jsx("p",{className:"af-resource-action-message",children:rt}):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")})]})]}):pe==="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")}),Sh(((bs=tt==null?void 0:tt.node)==null?void 0:bs.inputs)||ut.inputs).length>0?Sh(((Yr=tt==null?void 0:tt.node)==null?void 0:Yr.inputs)||ut.inputs).map(K=>o.jsxs("code",{children:[K.name||K.key,K.type?`: ${K.type}`:""]},K.key)):o.jsx("em",{children:n("project:noSlots")})]}),o.jsxs("div",{className:"af-resource-slot-group",children:[o.jsx("span",{children:n("project:nodeOutputs")}),Sh(((li=tt==null?void 0:tt.node)==null?void 0:li.outputs)||ut.outputs).length>0?Sh(((Ws=tt==null?void 0:tt.node)==null?void 0:Ws.outputs)||ut.outputs).map(K=>o.jsxs("code",{children:[K.name||K.key,K.type?`: ${K.type}`:""]},K.key)):o.jsx("em",{children:n("project:noSlots")})]})]}):pe==="runtime"?o.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[o.jsx("h4",{children:n("project:nodeRuntime")}),tt!=null&&tt.runtime?o.jsx("pre",{className:"af-resource-skill-preview",children:JSON.stringify(tt.runtime,null,2)}):o.jsx("p",{children:n("project:noRuntimeManifest")}),tt!=null&&tt.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:tt.body})]}):o.jsx("p",{children:n("project:noNodeBody")})]}):pe==="files"?o.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[o.jsx("h4",{children:n("project:nodeFiles")}),Array.isArray(tt==null?void 0:tt.files)&&tt.files.length>0?o.jsxs("div",{className:"af-node-file-browser",children:[o.jsx("div",{className:"af-node-file-list",children:tt.files.map(K=>o.jsxs("button",{type:"button",className:"af-node-file-item"+(on===K.path?" af-node-file-item--active":""),onClick:()=>an(K.path),children:[o.jsx("span",{className:"material-symbols-outlined",children:"description"}),o.jsx("span",{children:K.path})]},K.path))}),o.jsxs("pre",{className:"af-resource-skill-preview",children:[hn===`${Un(ut)}:${on}`?n("project:loadingResources"):gr!=null&&gr.binary?n("project:binaryFile"):(gr==null?void 0:gr.content)||n("project:selectNodeFile"),gr!=null&&gr.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(tt==null?void 0:tt.usage)&&tt.usage.length>0?o.jsx("div",{className:"af-node-usage-list",children:tt.usage.map(K=>o.jsxs("div",{className:"af-node-usage-item",children:[o.jsx("strong",{children:K.flowId}),o.jsxs("span",{children:[K.flowSource,K.archived?` · ${n("project:archived")}`:""]}),o.jsx("em",{children:K.instances.map(we=>we.label||we.instanceId).join(", ")})]},`${K.flowSource}:${K.flowId}:${K.archived?"a":""}`))}):o.jsx("p",{children:n("project:noNodeUsage")})]})]}):mr&&un?(()=>{const K=T$(un);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:un.displayName||un.name||un.id}),o.jsx("p",{children:un.id})]})]}),o.jsx("p",{className:"af-resource-detail-desc",children:un.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:un.version||"1.0.0"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPath")}),o.jsx("dd",{children:ES(un)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:flowSnippetScale")}),o.jsx("dd",{children:n("project:flowSnippetNodes",{nodes:Number.isFinite(Number(un.nodeCount))?Number(un.nodeCount):K.nodes.length,edges:Number.isFinite(Number(un.edgeCount))?Number(un.edgeCount):K.edges.length})})]})]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:n("project:resourceMeaning")}),o.jsx("p",{children:n("project:myFlowsMeaning")})]}),o.jsxs("div",{className:"af-resource-detail-section af-resource-danger-zone",children:[o.jsx("h4",{children:n("project:myFlowManagement")}),o.jsx("p",{children:n("project:deleteMyFlowHint")}),o.jsxs("button",{type:"button",className:"af-btn-secondary af-btn-danger",disabled:Lt===Ma(un),onClick:()=>hr(un),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"delete"}),Lt===Ma(un)?n("project:deletingMyFlow"):n("project:deleteMyFlow")]}),mn?o.jsx("p",{className:"af-resource-action-message",children:mn}):null]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:n("project:flowSnippetPreview")}),K.diagram.nodes.length>0?o.jsx("div",{className:"af-flow-snippet-map",children:o.jsxs("svg",{viewBox:K.diagram.viewBox,role:"img","aria-label":n("project:flowSnippetPreview"),children:[o.jsx("defs",{children:o.jsx("marker",{id:"af-flow-snippet-arrow",markerWidth:"8",markerHeight:"8",refX:"7",refY:"4",orient:"auto",markerUnits:"strokeWidth",children:o.jsx("path",{d:"M 0 0 L 8 4 L 0 8 z"})})}),o.jsx("g",{className:"af-flow-snippet-map__edges",children:K.diagram.edges.map(we=>o.jsxs("g",{children:[o.jsx("path",{d:we.path}),we.label?o.jsx("text",{x:we.labelX,y:we.labelY-5,textAnchor:"middle",children:lx(we.label,18)}):null]},we.key))}),o.jsx("g",{className:"af-flow-snippet-map__nodes",children:K.diagram.nodes.map((we,Le)=>o.jsxs("g",{transform:`translate(${we.x} ${we.y})`,children:[o.jsx("rect",{width:we.width,height:we.height,rx:"10"}),o.jsx("circle",{cx:"19",cy:we.height/2,r:"12"}),o.jsx("text",{className:"af-flow-snippet-map__node-index",x:"19",y:we.height/2+4,textAnchor:"middle",children:Le+1}),o.jsx("text",{className:"af-flow-snippet-map__node-title",x:"40",y:we.height/2-3,children:lx(we.title)}),o.jsx("text",{className:"af-flow-snippet-map__node-meta",x:"40",y:we.height/2+16,children:lx(we.meta||we.id,20)})]},we.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(un.snippet||{},null,2)})]})]})]})})():i==="skills"&&Ut?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:Ut.name||Ut.id}),o.jsx("p",{children:Ut.sourceLabel||Ut.source})]})]}),o.jsx("p",{className:"af-resource-detail-desc",children:Ut.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:Ut.sourceLabel||Ut.source})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPath")}),o.jsx("dd",{children:Ut.path||Ut.key})]})]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:"Collections"}),b.length===0?o.jsx("p",{children:"暂无 collection。可在左侧新建后再添加。"}):o.jsx("div",{className:"af-skill-detail-collections",children:b.map(K=>{const we=Un(Ut),Le=K.skillKeys.includes(we);return o.jsxs("label",{className:"af-composer-skill-option af-skill-detail-collection-option",children:[o.jsx("input",{type:"checkbox",checked:Le,disabled:x,onChange:Me=>Hs(K.id,we,Me.target.checked)}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:K.name}),o.jsxs("span",{className:"af-composer-skill-option-desc",children:[K.skillKeys.length," skills"]})]})]},K.id)})})]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:n("project:resourceMeaning")}),o.jsx("p",{children:n("project:skillsMeaning")})]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:n("project:skillPreview")}),o.jsx("pre",{className:"af-resource-skill-preview",children:et===Un(Ut)?n("project:loadingResources"):(Er==null?void 0:Er.body)||(Er==null?void 0:Er.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"+(V?"":" af-activity--hidden"),"aria-hidden":!V,"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:Vr.length===0?o.jsx("p",{className:"af-activity-empty",children:Zn.length===0?n("project:noRecentActivity"):n("project:noMatchRecent")}):Vr.map(K=>{const we=fe===_S(K);return o.jsxs("button",{type:"button",className:"af-activity-row af-activity-row--action"+(we?" af-activity-row--active":""),"aria-current":we?"page":void 0,onClick:()=>ws(K),children:[o.jsxs("div",{className:"af-activity-row-top",children:[o.jsx("h4",{className:"af-activity-name",children:o.jsx(fr,{query:X,children:K.flowId})}),o.jsx("span",{className:"af-activity-time",children:Gw(K.at,n)})]}),o.jsxs("div",{className:"af-activity-meta",children:[o.jsx("span",{className:x$(K.kind),children:K.kind==="executed"?"play_arrow":"visibility"}),o.jsxs("p",{className:"af-activity-text",children:[K.kind==="executed"?n("project:recentRun"):n("project:recentOpen")," · ",Gw(K.at,n)]})]})]},`${K.kind}-${K.flowId}-${K.flowSource}-${K.at}`)})})]})]}),o.jsx(c$,{open:R,onClose:()=>I(!1),onCreated:async K=>{I(!1),await oe();const we=K.source??"user";r(kh({id:K.id,source:we},"workspace"))}}),z?o.jsx(a$,{file:z,onClose:()=>P(null),onImported:async K=>{P(null),await oe();const we=K.source??"user";r(kh({id:K.id,source:we},"workspace"))}},`${z.name}-${z.size}-${z.lastModified}`):null]})}function br(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=br(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var R$={value:()=>{}};function Kg(){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 lm(n)}function lm(e){this._=e}function L$(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}})}lm.prototype=Kg.prototype={constructor:lm,on:function(e,t){var n=this._,r=L$(e+"",n),s,i=-1,a=r.length;if(arguments.length<2){for(;++i<a;)if((s=(e=r[i]).type)&&(s=M$(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]=IS(n[s],e.name,t);else if(t==null)for(s in n)n[s]=IS(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 lm(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 M$(e,t){for(var n=0,r=e.length,s;n<r;++n)if((s=e[n]).name===t)return s.value}function IS(e,t,n){for(var r=0,s=e.length;r<s;++r)if(e[r].name===t){e[r]=R$,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var nb="http://www.w3.org/1999/xhtml";const TS={svg:"http://www.w3.org/2000/svg",xhtml:nb,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function qg(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),TS.hasOwnProperty(t)?{space:TS[t],local:e}:e}function O$(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===nb&&t.documentElement.namespaceURI===nb?t.createElement(e):t.createElementNS(n,e)}}function $$(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function gP(e){var t=qg(e);return(t.local?$$:O$)(t)}function D$(){}function Uv(e){return e==null?D$:function(){return this.querySelector(e)}}function F$(e){typeof e!="function"&&(e=Uv(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],a=i.length,l=r[s]=new Array(a),c,d,f=0;f<a;++f)(c=i[f])&&(d=e.call(c,c.__data__,f,i))&&("__data__"in c&&(d.__data__=c.__data__),l[f]=d);return new ii(r,this._parents)}function z$(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function H$(){return[]}function yP(e){return e==null?H$:function(){return this.querySelectorAll(e)}}function B$(e){return function(){return z$(e.apply(this,arguments))}}function W$(e){typeof e=="function"?e=B$(e):e=yP(e);for(var t=this._groups,n=t.length,r=[],s=[],i=0;i<n;++i)for(var a=t[i],l=a.length,c,d=0;d<l;++d)(c=a[d])&&(r.push(e.call(c,c.__data__,d,a)),s.push(c));return new ii(r,s)}function xP(e){return function(){return this.matches(e)}}function wP(e){return function(t){return t.matches(e)}}var V$=Array.prototype.find;function U$(e){return function(){return V$.call(this.children,e)}}function K$(){return this.firstElementChild}function q$(e){return this.select(e==null?K$:U$(typeof e=="function"?e:wP(e)))}var Y$=Array.prototype.filter;function G$(){return Array.from(this.children)}function X$(e){return function(){return Y$.call(this.children,e)}}function J$(e){return this.selectAll(e==null?G$:X$(typeof e=="function"?e:wP(e)))}function Q$(e){typeof e!="function"&&(e=xP(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],a=i.length,l=r[s]=[],c,d=0;d<a;++d)(c=i[d])&&e.call(c,c.__data__,d,i)&&l.push(c);return new ii(r,this._parents)}function bP(e){return new Array(e.length)}function Z$(){return new ii(this._enter||this._groups.map(bP),this._parents)}function Km(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Km.prototype={constructor:Km,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 eD(e){return function(){return e}}function tD(e,t,n,r,s,i){for(var a=0,l,c=t.length,d=i.length;a<d;++a)(l=t[a])?(l.__data__=i[a],r[a]=l):n[a]=new Km(e,i[a]);for(;a<c;++a)(l=t[a])&&(s[a]=l)}function nD(e,t,n,r,s,i,a){var l,c,d=new Map,f=t.length,u=i.length,p=new Array(f),m;for(l=0;l<f;++l)(c=t[l])&&(p[l]=m=a.call(c,c.__data__,l,t)+"",d.has(m)?s[l]=c:d.set(m,c));for(l=0;l<u;++l)m=a.call(e,i[l],l,i)+"",(c=d.get(m))?(r[l]=c,c.__data__=i[l],d.delete(m)):n[l]=new Km(e,i[l]);for(l=0;l<f;++l)(c=t[l])&&d.get(p[l])===c&&(s[l]=c)}function rD(e){return e.__data__}function sD(e,t){if(!arguments.length)return Array.from(this,rD);var n=t?nD:tD,r=this._parents,s=this._groups;typeof e!="function"&&(e=eD(e));for(var i=s.length,a=new Array(i),l=new Array(i),c=new Array(i),d=0;d<i;++d){var f=r[d],u=s[d],p=u.length,m=iD(e.call(f,f&&f.__data__,d,r)),y=m.length,b=l[d]=new Array(y),k=a[d]=new Array(y),g=c[d]=new Array(p);n(f,u,b,k,g,m,t);for(var v=0,x=0,N,_;v<y;++v)if(N=b[v]){for(v>=x&&(x=v+1);!(_=k[x])&&++x<y;);N._next=_||null}}return a=new ii(a,r),a._enter=l,a._exit=c,a}function iD(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function oD(){return new ii(this._exit||this._groups.map(bP),this._parents)}function aD(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 lD(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,s=n.length,i=r.length,a=Math.min(s,i),l=new Array(s),c=0;c<a;++c)for(var d=n[c],f=r[c],u=d.length,p=l[c]=new Array(u),m,y=0;y<u;++y)(m=d[y]||f[y])&&(p[y]=m);for(;c<s;++c)l[c]=n[c];return new ii(l,this._parents)}function cD(){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 uD(e){e||(e=dD);function t(u,p){return u&&p?e(u.__data__,p.__data__):!u-!p}for(var n=this._groups,r=n.length,s=new Array(r),i=0;i<r;++i){for(var a=n[i],l=a.length,c=s[i]=new Array(l),d,f=0;f<l;++f)(d=a[f])&&(c[f]=d);c.sort(t)}return new ii(s,this._parents).order()}function dD(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function fD(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function pD(){return Array.from(this)}function hD(){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 mD(){let e=0;for(const t of this)++e;return e}function gD(){return!this.node()}function yD(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 xD(e){return function(){this.removeAttribute(e)}}function wD(e){return function(){this.removeAttributeNS(e.space,e.local)}}function bD(e,t){return function(){this.setAttribute(e,t)}}function vD(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function kD(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function SD(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 ND(e,t){var n=qg(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?wD:xD:typeof t=="function"?n.local?SD:kD:n.local?vD:bD)(n,t))}function vP(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function jD(e){return function(){this.style.removeProperty(e)}}function CD(e,t,n){return function(){this.style.setProperty(e,t,n)}}function ED(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?jD:typeof t=="function"?ED:CD)(e,t,n??"")):Pu(this.node(),e)}function Pu(e,t){return e.style.getPropertyValue(t)||vP(e).getComputedStyle(e,null).getPropertyValue(t)}function PD(e){return function(){delete this[e]}}function AD(e,t){return function(){this[e]=t}}function ID(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function TD(e,t){return arguments.length>1?this.each((t==null?PD:typeof t=="function"?ID:AD)(e,t)):this.node()[e]}function kP(e){return e.trim().split(/^|\s+/)}function Kv(e){return e.classList||new SP(e)}function SP(e){this._node=e,this._names=kP(e.getAttribute("class")||"")}SP.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 NP(e,t){for(var n=Kv(e),r=-1,s=t.length;++r<s;)n.add(t[r])}function jP(e,t){for(var n=Kv(e),r=-1,s=t.length;++r<s;)n.remove(t[r])}function RD(e){return function(){NP(this,e)}}function LD(e){return function(){jP(this,e)}}function MD(e,t){return function(){(t.apply(this,arguments)?NP:jP)(this,e)}}function OD(e,t){var n=kP(e+"");if(arguments.length<2){for(var r=Kv(this.node()),s=-1,i=n.length;++s<i;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof t=="function"?MD:t?RD:LD)(n,t))}function $D(){this.textContent=""}function DD(e){return function(){this.textContent=e}}function FD(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function zD(e){return arguments.length?this.each(e==null?$D:(typeof e=="function"?FD:DD)(e)):this.node().textContent}function HD(){this.innerHTML=""}function BD(e){return function(){this.innerHTML=e}}function WD(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function VD(e){return arguments.length?this.each(e==null?HD:(typeof e=="function"?WD:BD)(e)):this.node().innerHTML}function UD(){this.nextSibling&&this.parentNode.appendChild(this)}function KD(){return this.each(UD)}function qD(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function YD(){return this.each(qD)}function GD(e){var t=typeof e=="function"?e:gP(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function XD(){return null}function JD(e,t){var n=typeof e=="function"?e:gP(e),r=t==null?XD:typeof t=="function"?t:Uv(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function QD(){var e=this.parentNode;e&&e.removeChild(this)}function ZD(){return this.each(QD)}function eF(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function tF(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function nF(e){return this.select(e?tF:eF)}function rF(e){return arguments.length?this.property("__data__",e):this.node().__data__}function sF(e){return function(t){e.call(this,t,this.__data__)}}function iF(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 oF(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 aF(e,t,n){return function(){var r=this.__on,s,i=sF(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 lF(e,t,n){var r=iF(e+""),s,i=r.length,a;if(arguments.length<2){var l=this.node().__on;if(l){for(var c=0,d=l.length,f;c<d;++c)for(s=0,f=l[c];s<i;++s)if((a=r[s]).type===f.type&&a.name===f.name)return f.value}return}for(l=t?aF:oF,s=0;s<i;++s)this.each(l(r[s],t,n));return this}function CP(e,t,n){var r=vP(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 cF(e,t){return function(){return CP(this,e,t)}}function uF(e,t){return function(){return CP(this,e,t.apply(this,arguments))}}function dF(e,t){return this.each((typeof t=="function"?uF:cF)(e,t))}function*fF(){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 EP=[null];function ii(e,t){this._groups=e,this._parents=t}function pp(){return new ii([[document.documentElement]],EP)}function pF(){return this}ii.prototype=pp.prototype={constructor:ii,select:F$,selectAll:W$,selectChild:q$,selectChildren:J$,filter:Q$,data:sD,enter:Z$,exit:oD,join:aD,merge:lD,selection:pF,order:cD,sort:uD,call:fD,nodes:pD,node:hD,size:mD,empty:gD,each:yD,attr:ND,style:_D,property:TD,classed:OD,text:zD,html:VD,raise:KD,lower:YD,append:GD,insert:JD,remove:ZD,clone:nF,datum:rF,on:lF,dispatch:dF,[Symbol.iterator]:fF};function Zs(e){return typeof e=="string"?new ii([[document.querySelector(e)]],[document.documentElement]):new ii([[e]],EP)}function hF(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Ui(e,t){if(e=hF(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 mF={passive:!1},Ff={capture:!0,passive:!1};function cx(e){e.stopImmediatePropagation()}function gu(e){e.preventDefault(),e.stopImmediatePropagation()}function _P(e){var t=e.document.documentElement,n=Zs(e).on("dragstart.drag",gu,Ff);"onselectstart"in t?n.on("selectstart.drag",gu,Ff):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function PP(e,t){var n=e.document.documentElement,r=Zs(e).on("dragstart.drag",null);t&&(r.on("click.drag",gu,Ff),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 Nh=e=>()=>e;function rb(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:i,x:a,y:l,dx:c,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:c,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:f}})}rb.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function gF(e){return!e.ctrlKey&&!e.button}function yF(){return this.parentNode}function xF(e,t){return t??{x:e.x,y:e.y}}function wF(){return navigator.maxTouchPoints||"ontouchstart"in this}function AP(){var e=gF,t=yF,n=xF,r=wF,s={},i=Kg("start","drag","end"),a=0,l,c,d,f,u=0;function p(N){N.on("mousedown.drag",m).filter(r).on("touchstart.drag",k).on("touchmove.drag",g,mF).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(N,_){if(!(f||!e.call(this,N,_))){var C=x(this,t.call(this,N,_),N,_,"mouse");C&&(Zs(N.view).on("mousemove.drag",y,Ff).on("mouseup.drag",b,Ff),_P(N.view),cx(N),d=!1,l=N.clientX,c=N.clientY,C("start",N))}}function y(N){if(gu(N),!d){var _=N.clientX-l,C=N.clientY-c;d=_*_+C*C>u}s.mouse("drag",N)}function b(N){Zs(N.view).on("mousemove.drag mouseup.drag",null),PP(N.view,d),gu(N),s.mouse("end",N)}function k(N,_){if(e.call(this,N,_)){var C=N.changedTouches,T=t.call(this,N,_),H=C.length,M,F;for(M=0;M<H;++M)(F=x(this,T,N,_,C[M].identifier,C[M]))&&(cx(N),F("start",N,C[M]))}}function g(N){var _=N.changedTouches,C=_.length,T,H;for(T=0;T<C;++T)(H=s[_[T].identifier])&&(gu(N),H("drag",N,_[T]))}function v(N){var _=N.changedTouches,C=_.length,T,H;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),T=0;T<C;++T)(H=s[_[T].identifier])&&(cx(N),H("end",N,_[T]))}function x(N,_,C,T,H,M){var F=i.copy(),D=Ui(M||C,_),$,W,O;if((O=n.call(N,new rb("beforestart",{sourceEvent:C,target:p,identifier:H,active:a,x:D[0],y:D[1],dx:0,dy:0,dispatch:F}),T))!=null)return $=O.x-D[0]||0,W=O.y-D[1]||0,function R(I,z,P){var L=D,E;switch(I){case"start":s[H]=R,E=a++;break;case"end":delete s[H],--a;case"drag":D=Ui(P||z,_),E=a;break}F.call(I,N,new rb(I,{sourceEvent:z,subject:O,target:p,identifier:H,active:E,x:D[0]+$,y:D[1]+W,dx:D[0]-L[0],dy:D[1]-L[1],dispatch:F}),T)}}return p.filter=function(N){return arguments.length?(e=typeof N=="function"?N:Nh(!!N),p):e},p.container=function(N){return arguments.length?(t=typeof N=="function"?N:Nh(N),p):t},p.subject=function(N){return arguments.length?(n=typeof N=="function"?N:Nh(N),p):n},p.touchable=function(N){return arguments.length?(r=typeof N=="function"?N:Nh(!!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?(u=(N=+N)*N,p):Math.sqrt(u)},p}function qv(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function IP(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function hp(){}var zf=.7,qm=1/zf,yu="\\s*([+-]?\\d+)\\s*",Hf="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Eo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",bF=/^#([0-9a-f]{3,8})$/,vF=new RegExp(`^rgb\\(${yu},${yu},${yu}\\)$`),kF=new RegExp(`^rgb\\(${Eo},${Eo},${Eo}\\)$`),SF=new RegExp(`^rgba\\(${yu},${yu},${yu},${Hf}\\)$`),NF=new RegExp(`^rgba\\(${Eo},${Eo},${Eo},${Hf}\\)$`),jF=new RegExp(`^hsl\\(${Hf},${Eo},${Eo}\\)$`),CF=new RegExp(`^hsla\\(${Hf},${Eo},${Eo},${Hf}\\)$`),RS={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};qv(hp,dc,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:LS,formatHex:LS,formatHex8:EF,formatHsl:_F,formatRgb:MS,toString:MS});function LS(){return this.rgb().formatHex()}function EF(){return this.rgb().formatHex8()}function _F(){return TP(this).formatHsl()}function MS(){return this.rgb().formatRgb()}function dc(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=bF.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?OS(t):n===3?new As(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?jh(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?jh(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=vF.exec(e))?new As(t[1],t[2],t[3],1):(t=kF.exec(e))?new As(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=SF.exec(e))?jh(t[1],t[2],t[3],t[4]):(t=NF.exec(e))?jh(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=jF.exec(e))?FS(t[1],t[2]/100,t[3]/100,1):(t=CF.exec(e))?FS(t[1],t[2]/100,t[3]/100,t[4]):RS.hasOwnProperty(e)?OS(RS[e]):e==="transparent"?new As(NaN,NaN,NaN,0):null}function OS(e){return new As(e>>16&255,e>>8&255,e&255,1)}function jh(e,t,n,r){return r<=0&&(e=t=n=NaN),new As(e,t,n,r)}function PF(e){return e instanceof hp||(e=dc(e)),e?(e=e.rgb(),new As(e.r,e.g,e.b,e.opacity)):new As}function sb(e,t,n,r){return arguments.length===1?PF(e):new As(e,t,n,r??1)}function As(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}qv(As,sb,IP(hp,{brighter(e){return e=e==null?qm:Math.pow(qm,e),new As(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?zf:Math.pow(zf,e),new As(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new As(tc(this.r),tc(this.g),tc(this.b),Ym(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:$S,formatHex:$S,formatHex8:AF,formatRgb:DS,toString:DS}));function $S(){return`#${Jl(this.r)}${Jl(this.g)}${Jl(this.b)}`}function AF(){return`#${Jl(this.r)}${Jl(this.g)}${Jl(this.b)}${Jl((isNaN(this.opacity)?1:this.opacity)*255)}`}function DS(){const e=Ym(this.opacity);return`${e===1?"rgb(":"rgba("}${tc(this.r)}, ${tc(this.g)}, ${tc(this.b)}${e===1?")":`, ${e})`}`}function Ym(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function tc(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Jl(e){return e=tc(e),(e<16?"0":"")+e.toString(16)}function FS(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Yi(e,t,n,r)}function TP(e){if(e instanceof Yi)return new Yi(e.h,e.s,e.l,e.opacity);if(e instanceof hp||(e=dc(e)),!e)return new Yi;if(e instanceof Yi)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),i=Math.max(t,n,r),a=NaN,l=i-s,c=(i+s)/2;return l?(t===i?a=(n-r)/l+(n<r)*6:n===i?a=(r-t)/l+2:a=(t-n)/l+4,l/=c<.5?i+s:2-i-s,a*=60):l=c>0&&c<1?0:a,new Yi(a,l,c,e.opacity)}function IF(e,t,n,r){return arguments.length===1?TP(e):new Yi(e,t,n,r??1)}function Yi(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}qv(Yi,IF,IP(hp,{brighter(e){return e=e==null?qm:Math.pow(qm,e),new Yi(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?zf:Math.pow(zf,e),new Yi(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 As(ux(e>=240?e-240:e+120,s,r),ux(e,s,r),ux(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new Yi(zS(this.h),Ch(this.s),Ch(this.l),Ym(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=Ym(this.opacity);return`${e===1?"hsl(":"hsla("}${zS(this.h)}, ${Ch(this.s)*100}%, ${Ch(this.l)*100}%${e===1?")":`, ${e})`}`}}));function zS(e){return e=(e||0)%360,e<0?e+360:e}function Ch(e){return Math.max(0,Math.min(1,e||0))}function ux(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 Yv=e=>()=>e;function TF(e,t){return function(n){return e+n*t}}function RF(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 LF(e){return(e=+e)==1?RP:function(t,n){return n-t?RF(t,n,e):Yv(isNaN(t)?n:t)}}function RP(e,t){var n=t-e;return n?TF(e,n):Yv(isNaN(e)?t:e)}const Gm=function e(t){var n=LF(t);function r(s,i){var a=n((s=sb(s)).r,(i=sb(i)).r),l=n(s.g,i.g),c=n(s.b,i.b),d=RP(s.opacity,i.opacity);return function(f){return s.r=a(f),s.g=l(f),s.b=c(f),s.opacity=d(f),s+""}}return r.gamma=e,r}(1);function MF(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 OF(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function $F(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]=ff(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 DF(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function wo(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function FF(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]=ff(e[s],t[s]):r[s]=t[s];return function(i){for(s in n)r[s]=n[s](i);return r}}var ib=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,dx=new RegExp(ib.source,"g");function zF(e){return function(){return e}}function HF(e){return function(t){return e(t)+""}}function LP(e,t){var n=ib.lastIndex=dx.lastIndex=0,r,s,i,a=-1,l=[],c=[];for(e=e+"",t=t+"";(r=ib.exec(e))&&(s=dx.exec(t));)(i=s.index)>n&&(i=t.slice(n,i),l[a]?l[a]+=i:l[++a]=i),(r=r[0])===(s=s[0])?l[a]?l[a]+=s:l[++a]=s:(l[++a]=null,c.push({i:a,x:wo(r,s)})),n=dx.lastIndex;return n<t.length&&(i=t.slice(n),l[a]?l[a]+=i:l[++a]=i),l.length<2?c[0]?HF(c[0].x):zF(t):(t=c.length,function(d){for(var f=0,u;f<t;++f)l[(u=c[f]).i]=u.x(d);return l.join("")})}function ff(e,t){var n=typeof t,r;return t==null||n==="boolean"?Yv(t):(n==="number"?wo:n==="string"?(r=dc(t))?(t=r,Gm):LP:t instanceof dc?Gm:t instanceof Date?DF:OF(t)?MF:Array.isArray(t)?$F:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?FF:wo)(e,t)}var HS=180/Math.PI,ob={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function MP(e,t,n,r,s,i){var a,l,c;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(l=Math.sqrt(n*n+r*r))&&(n/=l,r/=l,c/=l),e*r<t*n&&(e=-e,t=-t,c=-c,a=-a),{translateX:s,translateY:i,rotate:Math.atan2(t,e)*HS,skewX:Math.atan(c)*HS,scaleX:a,scaleY:l}}var Eh;function BF(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?ob:MP(t.a,t.b,t.c,t.d,t.e,t.f)}function WF(e){return e==null||(Eh||(Eh=document.createElementNS("http://www.w3.org/2000/svg","g")),Eh.setAttribute("transform",e),!(e=Eh.transform.baseVal.consolidate()))?ob:(e=e.matrix,MP(e.a,e.b,e.c,e.d,e.e,e.f))}function OP(e,t,n,r){function s(d){return d.length?d.pop()+" ":""}function i(d,f,u,p,m,y){if(d!==u||f!==p){var b=m.push("translate(",null,t,null,n);y.push({i:b-4,x:wo(d,u)},{i:b-2,x:wo(f,p)})}else(u||p)&&m.push("translate("+u+t+p+n)}function a(d,f,u,p){d!==f?(d-f>180?f+=360:f-d>180&&(d+=360),p.push({i:u.push(s(u)+"rotate(",null,r)-2,x:wo(d,f)})):f&&u.push(s(u)+"rotate("+f+r)}function l(d,f,u,p){d!==f?p.push({i:u.push(s(u)+"skewX(",null,r)-2,x:wo(d,f)}):f&&u.push(s(u)+"skewX("+f+r)}function c(d,f,u,p,m,y){if(d!==u||f!==p){var b=m.push(s(m)+"scale(",null,",",null,")");y.push({i:b-4,x:wo(d,u)},{i:b-2,x:wo(f,p)})}else(u!==1||p!==1)&&m.push(s(m)+"scale("+u+","+p+")")}return function(d,f){var u=[],p=[];return d=e(d),f=e(f),i(d.translateX,d.translateY,f.translateX,f.translateY,u,p),a(d.rotate,f.rotate,u,p),l(d.skewX,f.skewX,u,p),c(d.scaleX,d.scaleY,f.scaleX,f.scaleY,u,p),d=f=null,function(m){for(var y=-1,b=p.length,k;++y<b;)u[(k=p[y]).i]=k.x(m);return u.join("")}}}var VF=OP(BF,"px, ","px)","deg)"),UF=OP(WF,", ",")",")"),KF=1e-12;function BS(e){return((e=Math.exp(e))+1/e)/2}function qF(e){return((e=Math.exp(e))-1/e)/2}function YF(e){return((e=Math.exp(2*e))-1)/(e+1)}const cm=function e(t,n,r){function s(i,a){var l=i[0],c=i[1],d=i[2],f=a[0],u=a[1],p=a[2],m=f-l,y=u-c,b=m*m+y*y,k,g;if(b<KF)g=Math.log(p/d)/t,k=function(T){return[l+T*m,c+T*y,d*Math.exp(t*T*g)]};else{var v=Math.sqrt(b),x=(p*p-d*d+r*b)/(2*d*n*v),N=(p*p-d*d-r*b)/(2*p*n*v),_=Math.log(Math.sqrt(x*x+1)-x),C=Math.log(Math.sqrt(N*N+1)-N);g=(C-_)/t,k=function(T){var H=T*g,M=BS(_),F=d/(n*v)*(M*YF(t*H+_)-qF(_));return[l+F*m,c+F*y,d*M/BS(t*H+_)]}}return k.duration=g*1e3*t/Math.SQRT2,k}return s.rho=function(i){var a=Math.max(.001,+i),l=a*a,c=l*l;return e(a,l,c)},s}(Math.SQRT2,2,4);var Au=0,Yd=0,Md=0,$P=1e3,Xm,Gd,Jm=0,fc=0,Yg=0,Bf=typeof performance=="object"&&performance.now?performance:Date,DP=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Gv(){return fc||(DP(GF),fc=Bf.now()+Yg)}function GF(){fc=0}function Qm(){this._call=this._time=this._next=null}Qm.prototype=FP.prototype={constructor:Qm,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Gv():+n)+(t==null?0:+t),!this._next&&Gd!==this&&(Gd?Gd._next=this:Xm=this,Gd=this),this._call=e,this._time=n,ab()},stop:function(){this._call&&(this._call=null,this._time=1/0,ab())}};function FP(e,t,n){var r=new Qm;return r.restart(e,t,n),r}function XF(){Gv(),++Au;for(var e=Xm,t;e;)(t=fc-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Au}function WS(){fc=(Jm=Bf.now())+Yg,Au=Yd=0;try{XF()}finally{Au=0,QF(),fc=0}}function JF(){var e=Bf.now(),t=e-Jm;t>$P&&(Yg-=t,Jm=e)}function QF(){for(var e,t=Xm,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:Xm=n);Gd=e,ab(r)}function ab(e){if(!Au){Yd&&(Yd=clearTimeout(Yd));var t=e-fc;t>24?(e<1/0&&(Yd=setTimeout(WS,e-Bf.now()-Yg)),Md&&(Md=clearInterval(Md))):(Md||(Jm=Bf.now(),Md=setInterval(JF,$P)),Au=1,DP(WS))}}function VS(e,t,n){var r=new Qm;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var ZF=Kg("start","end","cancel","interrupt"),ez=[],zP=0,US=1,lb=2,um=3,KS=4,cb=5,dm=6;function Gg(e,t,n,r,s,i){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;tz(e,n,{name:t,index:r,group:s,on:ZF,tween:ez,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:zP})}function Xv(e,t){var n=no(e,t);if(n.state>zP)throw new Error("too late; already scheduled");return n}function Lo(e,t){var n=no(e,t);if(n.state>um)throw new Error("too late; already running");return n}function no(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function tz(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=FP(i,0,n.time);function i(d){n.state=US,n.timer.restart(a,n.delay,n.time),n.delay<=d&&a(d-n.delay)}function a(d){var f,u,p,m;if(n.state!==US)return c();for(f in r)if(m=r[f],m.name===n.name){if(m.state===um)return VS(a);m.state===KS?(m.state=dm,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete r[f]):+f<t&&(m.state=dm,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete r[f])}if(VS(function(){n.state===um&&(n.state=KS,n.timer.restart(l,n.delay,n.time),l(d))}),n.state=lb,n.on.call("start",e,e.__data__,n.index,n.group),n.state===lb){for(n.state=um,s=new Array(p=n.tween.length),f=0,u=-1;f<p;++f)(m=n.tween[f].value.call(e,e.__data__,n.index,n.group))&&(s[++u]=m);s.length=u+1}}function l(d){for(var f=d<n.duration?n.ease.call(null,d/n.duration):(n.timer.restart(c),n.state=cb,1),u=-1,p=s.length;++u<p;)s[u].call(e,f);n.state===cb&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=dm,n.timer.stop(),delete r[t];for(var d in r)return;delete e.__transition}}function fm(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>lb&&r.state<cb,r.state=dm,r.timer.stop(),r.on.call(s?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[a]}i&&delete e.__transition}}function nz(e){return this.each(function(){fm(this,e)})}function rz(e,t){var n,r;return function(){var s=Lo(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 sz(e,t,n){var r,s;if(typeof n!="function")throw new Error;return function(){var i=Lo(this,e),a=i.tween;if(a!==r){s=(r=a).slice();for(var l={name:t,value:n},c=0,d=s.length;c<d;++c)if(s[c].name===t){s[c]=l;break}c===d&&s.push(l)}i.tween=s}}function iz(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=no(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?rz:sz)(n,e,t))}function Jv(e,t,n){var r=e._id;return e.each(function(){var s=Lo(this,r);(s.value||(s.value={}))[t]=n.apply(this,arguments)}),function(s){return no(s,r).value[t]}}function HP(e,t){var n;return(typeof t=="number"?wo:t instanceof dc?Gm:(n=dc(t))?(t=n,Gm):LP)(e,t)}function oz(e){return function(){this.removeAttribute(e)}}function az(e){return function(){this.removeAttributeNS(e.space,e.local)}}function lz(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 cz(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 uz(e,t,n){var r,s,i;return function(){var a,l=n(this),c;return l==null?void this.removeAttribute(e):(a=this.getAttribute(e),c=l+"",a===c?null:a===r&&c===s?i:(s=c,i=t(r=a,l)))}}function dz(e,t,n){var r,s,i;return function(){var a,l=n(this),c;return l==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),c=l+"",a===c?null:a===r&&c===s?i:(s=c,i=t(r=a,l)))}}function fz(e,t){var n=qg(e),r=n==="transform"?UF:HP;return this.attrTween(e,typeof t=="function"?(n.local?dz:uz)(n,r,Jv(this,"attr."+e,t)):t==null?(n.local?az:oz)(n):(n.local?cz:lz)(n,r,t))}function pz(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function hz(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function mz(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&hz(e,i)),n}return s._value=t,s}function gz(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&pz(e,i)),n}return s._value=t,s}function yz(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=qg(e);return this.tween(n,(r.local?mz:gz)(r,t))}function xz(e,t){return function(){Xv(this,e).delay=+t.apply(this,arguments)}}function wz(e,t){return t=+t,function(){Xv(this,e).delay=t}}function bz(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?xz:wz)(t,e)):no(this.node(),t).delay}function vz(e,t){return function(){Lo(this,e).duration=+t.apply(this,arguments)}}function kz(e,t){return t=+t,function(){Lo(this,e).duration=t}}function Sz(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?vz:kz)(t,e)):no(this.node(),t).duration}function Nz(e,t){if(typeof t!="function")throw new Error;return function(){Lo(this,e).ease=t}}function jz(e){var t=this._id;return arguments.length?this.each(Nz(t,e)):no(this.node(),t).ease}function Cz(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Lo(this,e).ease=n}}function Ez(e){if(typeof e!="function")throw new Error;return this.each(Cz(this._id,e))}function _z(e){typeof e!="function"&&(e=xP(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],a=i.length,l=r[s]=[],c,d=0;d<a;++d)(c=i[d])&&e.call(c,c.__data__,d,i)&&l.push(c);return new fa(r,this._parents,this._name,this._id)}function Pz(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,s=n.length,i=Math.min(r,s),a=new Array(r),l=0;l<i;++l)for(var c=t[l],d=n[l],f=c.length,u=a[l]=new Array(f),p,m=0;m<f;++m)(p=c[m]||d[m])&&(u[m]=p);for(;l<r;++l)a[l]=t[l];return new fa(a,this._parents,this._name,this._id)}function Az(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 Iz(e,t,n){var r,s,i=Az(t)?Xv:Lo;return function(){var a=i(this,e),l=a.on;l!==r&&(s=(r=l).copy()).on(t,n),a.on=s}}function Tz(e,t){var n=this._id;return arguments.length<2?no(this.node(),n).on.on(e):this.each(Iz(n,e,t))}function Rz(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Lz(){return this.on("end.remove",Rz(this._id))}function Mz(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Uv(e));for(var r=this._groups,s=r.length,i=new Array(s),a=0;a<s;++a)for(var l=r[a],c=l.length,d=i[a]=new Array(c),f,u,p=0;p<c;++p)(f=l[p])&&(u=e.call(f,f.__data__,p,l))&&("__data__"in f&&(u.__data__=f.__data__),d[p]=u,Gg(d[p],t,n,p,d,no(f,n)));return new fa(i,this._parents,t,n)}function Oz(e){var t=this._name,n=this._id;typeof e!="function"&&(e=yP(e));for(var r=this._groups,s=r.length,i=[],a=[],l=0;l<s;++l)for(var c=r[l],d=c.length,f,u=0;u<d;++u)if(f=c[u]){for(var p=e.call(f,f.__data__,u,c),m,y=no(f,n),b=0,k=p.length;b<k;++b)(m=p[b])&&Gg(m,t,n,b,p,y);i.push(p),a.push(f)}return new fa(i,a,t,n)}var $z=pp.prototype.constructor;function Dz(){return new $z(this._groups,this._parents)}function Fz(e,t){var n,r,s;return function(){var i=Pu(this,e),a=(this.style.removeProperty(e),Pu(this,e));return i===a?null:i===n&&a===r?s:s=t(n=i,r=a)}}function BP(e){return function(){this.style.removeProperty(e)}}function zz(e,t,n){var r,s=n+"",i;return function(){var a=Pu(this,e);return a===s?null:a===r?i:i=t(r=a,n)}}function Hz(e,t,n){var r,s,i;return function(){var a=Pu(this,e),l=n(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(e),Pu(this,e))),a===c?null:a===r&&c===s?i:(s=c,i=t(r=a,l))}}function Bz(e,t){var n,r,s,i="style."+t,a="end."+i,l;return function(){var c=Lo(this,e),d=c.on,f=c.value[i]==null?l||(l=BP(t)):void 0;(d!==n||s!==f)&&(r=(n=d).copy()).on(a,s=f),c.on=r}}function Wz(e,t,n){var r=(e+="")=="transform"?VF:HP;return t==null?this.styleTween(e,Fz(e,r)).on("end.style."+e,BP(e)):typeof t=="function"?this.styleTween(e,Hz(e,r,Jv(this,"style."+e,t))).each(Bz(this._id,e)):this.styleTween(e,zz(e,r,t),n).on("end.style."+e,null)}function Vz(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Uz(e,t,n){var r,s;function i(){var a=t.apply(this,arguments);return a!==s&&(r=(s=a)&&Vz(e,a,n)),r}return i._value=t,i}function Kz(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,Uz(e,t,n??""))}function qz(e){return function(){this.textContent=e}}function Yz(e){return function(){var t=e(this);this.textContent=t??""}}function Gz(e){return this.tween("text",typeof e=="function"?Yz(Jv(this,"text",e)):qz(e==null?"":e+""))}function Xz(e){return function(t){this.textContent=e.call(this,t)}}function Jz(e){var t,n;function r(){var s=e.apply(this,arguments);return s!==n&&(t=(n=s)&&Xz(s)),t}return r._value=e,r}function Qz(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,Jz(e))}function Zz(){for(var e=this._name,t=this._id,n=WP(),r=this._groups,s=r.length,i=0;i<s;++i)for(var a=r[i],l=a.length,c,d=0;d<l;++d)if(c=a[d]){var f=no(c,t);Gg(c,e,n,d,a,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new fa(r,this._parents,e,n)}function e3(){var e,t,n=this,r=n._id,s=n.size();return new Promise(function(i,a){var l={value:a},c={value:function(){--s===0&&i()}};n.each(function(){var d=Lo(this,r),f=d.on;f!==e&&(t=(e=f).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(c)),d.on=t}),s===0&&i()})}var t3=0;function fa(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function WP(){return++t3}var Go=pp.prototype;fa.prototype={constructor:fa,select:Mz,selectAll:Oz,selectChild:Go.selectChild,selectChildren:Go.selectChildren,filter:_z,merge:Pz,selection:Dz,transition:Zz,call:Go.call,nodes:Go.nodes,node:Go.node,size:Go.size,empty:Go.empty,each:Go.each,on:Tz,attr:fz,attrTween:yz,style:Wz,styleTween:Kz,text:Gz,textTween:Qz,remove:Lz,tween:iz,delay:bz,duration:Sz,ease:jz,easeVarying:Ez,end:e3,[Symbol.iterator]:Go[Symbol.iterator]};function n3(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var r3={time:null,delay:0,duration:250,ease:n3};function s3(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 i3(e){var t,n;e instanceof fa?(t=e._id,e=e._name):(t=WP(),(n=r3).time=Gv(),e=e==null?null:e+"");for(var r=this._groups,s=r.length,i=0;i<s;++i)for(var a=r[i],l=a.length,c,d=0;d<l;++d)(c=a[d])&&Gg(c,e,t,d,a,n||s3(c,t));return new fa(r,this._parents,e,t)}pp.prototype.interrupt=nz;pp.prototype.transition=i3;const _h=e=>()=>e;function o3(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 ra(e,t,n){this.k=e,this.x=t,this.y=n}ra.prototype={constructor:ra,scale:function(e){return e===1?this:new ra(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ra(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 Xg=new ra(1,0,0);VP.prototype=ra.prototype;function VP(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Xg;return e.__zoom}function fx(e){e.stopImmediatePropagation()}function Od(e){e.preventDefault(),e.stopImmediatePropagation()}function a3(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function l3(){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 qS(){return this.__zoom||Xg}function c3(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function u3(){return navigator.maxTouchPoints||"ontouchstart"in this}function d3(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 UP(){var e=a3,t=l3,n=d3,r=c3,s=u3,i=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=cm,d=Kg("start","zoom","end"),f,u,p,m=500,y=150,b=0,k=10;function g(O){O.property("__zoom",qS).on("wheel.zoom",H,{passive:!1}).on("mousedown.zoom",M).on("dblclick.zoom",F).filter(s).on("touchstart.zoom",D).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",W).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(O,R,I,z){var P=O.selection?O.selection():O;P.property("__zoom",qS),O!==P?_(O,R,I,z):P.interrupt().each(function(){C(this,arguments).event(z).start().zoom(null,typeof R=="function"?R.apply(this,arguments):R).end()})},g.scaleBy=function(O,R,I,z){g.scaleTo(O,function(){var P=this.__zoom.k,L=typeof R=="function"?R.apply(this,arguments):R;return P*L},I,z)},g.scaleTo=function(O,R,I,z){g.transform(O,function(){var P=t.apply(this,arguments),L=this.__zoom,E=I==null?N(P):typeof I=="function"?I.apply(this,arguments):I,X=L.invert(E),ee=typeof R=="function"?R.apply(this,arguments):R;return n(x(v(L,ee),E,X),P,a)},I,z)},g.translateBy=function(O,R,I,z){g.transform(O,function(){return n(this.__zoom.translate(typeof R=="function"?R.apply(this,arguments):R,typeof I=="function"?I.apply(this,arguments):I),t.apply(this,arguments),a)},null,z)},g.translateTo=function(O,R,I,z,P){g.transform(O,function(){var L=t.apply(this,arguments),E=this.__zoom,X=z==null?N(L):typeof z=="function"?z.apply(this,arguments):z;return n(Xg.translate(X[0],X[1]).scale(E.k).translate(typeof R=="function"?-R.apply(this,arguments):-R,typeof I=="function"?-I.apply(this,arguments):-I),L,a)},z,P)};function v(O,R){return R=Math.max(i[0],Math.min(i[1],R)),R===O.k?O:new ra(R,O.x,O.y)}function x(O,R,I){var z=R[0]-I[0]*O.k,P=R[1]-I[1]*O.k;return z===O.x&&P===O.y?O:new ra(O.k,z,P)}function N(O){return[(+O[0][0]+ +O[1][0])/2,(+O[0][1]+ +O[1][1])/2]}function _(O,R,I,z){O.on("start.zoom",function(){C(this,arguments).event(z).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event(z).end()}).tween("zoom",function(){var P=this,L=arguments,E=C(P,L).event(z),X=t.apply(P,L),ee=I==null?N(X):typeof I=="function"?I.apply(P,L):I,V=Math.max(X[1][0]-X[0][0],X[1][1]-X[0][1]),ie=P.__zoom,fe=typeof R=="function"?R.apply(P,L):R,me=c(ie.invert(ee).concat(V/ie.k),fe.invert(ee).concat(V/fe.k));return function(ge){if(ge===1)ge=fe;else{var Z=me(ge),ae=V/Z[2];ge=new ra(ae,ee[0]-Z[0]*ae,ee[1]-Z[1]*ae)}E.zoom(null,ge)}})}function C(O,R,I){return!I&&O.__zooming||new T(O,R)}function T(O,R){this.that=O,this.args=R,this.active=0,this.sourceEvent=null,this.extent=t.apply(O,R),this.taps=0}T.prototype={event:function(O){return O&&(this.sourceEvent=O),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(O,R){return this.mouse&&O!=="mouse"&&(this.mouse[1]=R.invert(this.mouse[0])),this.touch0&&O!=="touch"&&(this.touch0[1]=R.invert(this.touch0[0])),this.touch1&&O!=="touch"&&(this.touch1[1]=R.invert(this.touch1[0])),this.that.__zoom=R,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(O){var R=Zs(this.that).datum();d.call(O,this.that,new o3(O,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:d}),R)}};function H(O,...R){if(!e.apply(this,arguments))return;var I=C(this,R).event(O),z=this.__zoom,P=Math.max(i[0],Math.min(i[1],z.k*Math.pow(2,r.apply(this,arguments)))),L=Ui(O);if(I.wheel)(I.mouse[0][0]!==L[0]||I.mouse[0][1]!==L[1])&&(I.mouse[1]=z.invert(I.mouse[0]=L)),clearTimeout(I.wheel);else{if(z.k===P)return;I.mouse=[L,z.invert(L)],fm(this),I.start()}Od(O),I.wheel=setTimeout(E,y),I.zoom("mouse",n(x(v(z,P),I.mouse[0],I.mouse[1]),I.extent,a));function E(){I.wheel=null,I.end()}}function M(O,...R){if(p||!e.apply(this,arguments))return;var I=O.currentTarget,z=C(this,R,!0).event(O),P=Zs(O.view).on("mousemove.zoom",ee,!0).on("mouseup.zoom",V,!0),L=Ui(O,I),E=O.clientX,X=O.clientY;_P(O.view),fx(O),z.mouse=[L,this.__zoom.invert(L)],fm(this),z.start();function ee(ie){if(Od(ie),!z.moved){var fe=ie.clientX-E,me=ie.clientY-X;z.moved=fe*fe+me*me>b}z.event(ie).zoom("mouse",n(x(z.that.__zoom,z.mouse[0]=Ui(ie,I),z.mouse[1]),z.extent,a))}function V(ie){P.on("mousemove.zoom mouseup.zoom",null),PP(ie.view,z.moved),Od(ie),z.event(ie).end()}}function F(O,...R){if(e.apply(this,arguments)){var I=this.__zoom,z=Ui(O.changedTouches?O.changedTouches[0]:O,this),P=I.invert(z),L=I.k*(O.shiftKey?.5:2),E=n(x(v(I,L),z,P),t.apply(this,R),a);Od(O),l>0?Zs(this).transition().duration(l).call(_,E,z,O):Zs(this).call(g.transform,E,z,O)}}function D(O,...R){if(e.apply(this,arguments)){var I=O.touches,z=I.length,P=C(this,R,O.changedTouches.length===z).event(O),L,E,X,ee;for(fx(O),E=0;E<z;++E)X=I[E],ee=Ui(X,this),ee=[ee,this.__zoom.invert(ee),X.identifier],P.touch0?!P.touch1&&P.touch0[2]!==ee[2]&&(P.touch1=ee,P.taps=0):(P.touch0=ee,L=!0,P.taps=1+!!f);f&&(f=clearTimeout(f)),L&&(P.taps<2&&(u=ee[0],f=setTimeout(function(){f=null},m)),fm(this),P.start())}}function $(O,...R){if(this.__zooming){var I=C(this,R).event(O),z=O.changedTouches,P=z.length,L,E,X,ee;for(Od(O),L=0;L<P;++L)E=z[L],X=Ui(E,this),I.touch0&&I.touch0[2]===E.identifier?I.touch0[0]=X:I.touch1&&I.touch1[2]===E.identifier&&(I.touch1[0]=X);if(E=I.that.__zoom,I.touch1){var V=I.touch0[0],ie=I.touch0[1],fe=I.touch1[0],me=I.touch1[1],ge=(ge=fe[0]-V[0])*ge+(ge=fe[1]-V[1])*ge,Z=(Z=me[0]-ie[0])*Z+(Z=me[1]-ie[1])*Z;E=v(E,Math.sqrt(ge/Z)),X=[(V[0]+fe[0])/2,(V[1]+fe[1])/2],ee=[(ie[0]+me[0])/2,(ie[1]+me[1])/2]}else if(I.touch0)X=I.touch0[0],ee=I.touch0[1];else return;I.zoom("touch",n(x(E,X,ee),I.extent,a))}}function W(O,...R){if(this.__zooming){var I=C(this,R).event(O),z=O.changedTouches,P=z.length,L,E;for(fx(O),p&&clearTimeout(p),p=setTimeout(function(){p=null},m),L=0;L<P;++L)E=z[L],I.touch0&&I.touch0[2]===E.identifier?delete I.touch0:I.touch1&&I.touch1[2]===E.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&&(E=Ui(E,this),Math.hypot(u[0]-E[0],u[1]-E[1])<k)){var X=Zs(this).on("dblclick.zoom");X&&X.apply(this,arguments)}}}return g.wheelDelta=function(O){return arguments.length?(r=typeof O=="function"?O:_h(+O),g):r},g.filter=function(O){return arguments.length?(e=typeof O=="function"?O:_h(!!O),g):e},g.touchable=function(O){return arguments.length?(s=typeof O=="function"?O:_h(!!O),g):s},g.extent=function(O){return arguments.length?(t=typeof O=="function"?O:_h([[+O[0][0],+O[0][1]],[+O[1][0],+O[1][1]]]),g):t},g.scaleExtent=function(O){return arguments.length?(i[0]=+O[0],i[1]=+O[1],g):[i[0],i[1]]},g.translateExtent=function(O){return arguments.length?(a[0][0]=+O[0][0],a[1][0]=+O[1][0],a[0][1]=+O[0][1],a[1][1]=+O[1][1],g):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},g.constrain=function(O){return arguments.length?(n=O,g):n},g.duration=function(O){return arguments.length?(l=+O,g):l},g.interpolate=function(O){return arguments.length?(c=O,g):c},g.on=function(){var O=d.on.apply(d,arguments);return O===d?g:O},g.clickDistance=function(O){return arguments.length?(b=(O=+O)*O,g):Math.sqrt(b)},g.tapDistance=function(O){return arguments.length?(k=+O,g):k},g}const Io={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."},Wf=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],KP=["Enter"," ","Escape"],qP={"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 Iu;(function(e){e.Strict="strict",e.Loose="loose"})(Iu||(Iu={}));var nc;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(nc||(nc={}));var Vf;(function(e){e.Partial="partial",e.Full="full"})(Vf||(Vf={}));const YP={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Va;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Va||(Va={}));var $s;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})($s||($s={}));var Ze;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ze||(Ze={}));const YS={[Ze.Left]:Ze.Right,[Ze.Right]:Ze.Left,[Ze.Top]:Ze.Bottom,[Ze.Bottom]:Ze.Top};function GP(e){return e===null?null:e?"valid":"invalid"}const XP=e=>"id"in e&&"source"in e&&"target"in e,f3=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Qv=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),mp=(e,t=[0,0])=>{const{width:n,height:r}=ga(e),s=e.origin??t,i=n*s[0],a=r*s[1];return{x:e.position.x-i,y:e.position.y-a}},p3=(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):Qv(s)?s:t.nodeLookup.get(s.id));const l=a?Zm(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Jg(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Qg(n)},gp=(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=Jg(n,Zm(s)),r=!0)}),r?Qg(n):{x:0,y:0,width:0,height:0}},Zv=(e,t,[n,r,s]=[0,0,1],i=!1,a=!1)=>{const l={...xp(t,[n,r,s]),width:t.width/s,height:t.height/s},c=[];for(const d of e.values()){const{measured:f,selectable:u=!0,hidden:p=!1}=d;if(a&&!u||p)continue;const m=f.width??d.width??d.initialWidth??null,y=f.height??d.height??d.initialHeight??null,b=Uf(l,Ru(d)),k=(m??0)*(y??0),g=i&&b>0;(!d.internals.handleBounds||g||b>=k||d.dragging)&&c.push(d)}return c},h3=(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 m3(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 g3({nodes:e,width:t,height:n,panZoom:r,minZoom:s,maxZoom:i},a){if(e.size===0)return Promise.resolve(!0);const l=m3(e,a),c=gp(l),d=e0(c,t,n,(a==null?void 0:a.minZoom)??s,(a==null?void 0:a.maxZoom)??i,(a==null?void 0:a.padding)??.1);return await r.setViewport(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 JP({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:s,onError:i}){const a=n.get(e),l=a.parentId?n.get(a.parentId):void 0,{x:c,y:d}=l?l.internals.positionAbsolute:{x:0,y:0},f=a.origin??r;let u=a.extent||s;if(a.extent==="parent"&&!a.expandParent)if(!l)i==null||i("005",Io.error005());else{const m=l.measured.width,y=l.measured.height;m&&y&&(u=[[c,d],[c+m,d+y]])}else l&&Lu(a.extent)&&(u=[[a.extent[0][0]+c,a.extent[0][1]+d],[a.extent[1][0]+c,a.extent[1][1]+d]]);const p=Lu(u)?pc(t,u,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(i==null||i("015",Io.error015())),{position:{x:p.x-c+(a.measured.width??0)*f[0],y:p.y-d+(a.measured.height??0)*f[1]},positionAbsolute:p}}async function y3({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 m=i.has(p.id),y=!m&&p.parentId&&a.find(b=>b.id===p.parentId);(m||y)&&a.push(p)}const l=new Set(t.map(p=>p.id)),c=r.filter(p=>p.deletable!==!1),f=h3(a,c);for(const p of c)l.has(p.id)&&!f.find(y=>y.id===p.id)&&f.push(p);if(!s)return{edges:f,nodes:a};const u=await s({nodes:a,edges:f});return typeof u=="boolean"?u?{edges:f,nodes:a}:{edges:[],nodes:[]}:u}const Tu=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),pc=(e={x:0,y:0},t,n)=>({x:Tu(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Tu(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function QP(e,t,n){const{width:r,height:s}=ga(n),{x:i,y:a}=n.internals.positionAbsolute;return pc(e,[[i,a],[i+r,a+s]],t)}const GS=(e,t,n)=>e<t?Tu(Math.abs(e-t),1,t)/t:e>n?-Tu(Math.abs(e-n),1,t)/t:0,ZP=(e,t,n=15,r=40)=>{const s=GS(e.x,r,t.width-r)*n,i=GS(e.y,r,t.height-r)*n;return[s,i]},Jg=(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)}),ub=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Qg=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Ru=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Qv(e)?e.internals.positionAbsolute:mp(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}},Zm=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Qv(e)?e.internals.positionAbsolute:mp(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)}},eA=(e,t)=>Qg(Jg(ub(e),ub(t))),Uf=(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)},XS=e=>Gi(e.width)&&Gi(e.height)&&Gi(e.x)&&Gi(e.y),Gi=e=>!isNaN(e)&&isFinite(e),x3=(e,t)=>{},yp=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),xp=({x:e,y:t},[n,r,s],i=!1,a=[1,1])=>{const l={x:(e-n)/s,y:(t-r)/s};return i?yp(l,a):l},eg=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r});function $c(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 w3(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=$c(e,n),s=$c(e,t);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof e=="object"){const r=$c(e.top??e.y??0,n),s=$c(e.bottom??e.y??0,n),i=$c(e.left??e.x??0,t),a=$c(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 b3(e,t,n,r,s,i){const{x:a,y:l}=eg(e,[t,n,r]),{x:c,y:d}=eg({x:e.x+e.width,y:e.y+e.height},[t,n,r]),f=s-c,u=i-d;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(f),bottom:Math.floor(u)}}const e0=(e,t,n,r,s,i)=>{const a=w3(i,t,n),l=(t-a.x)/e.width,c=(n-a.y)/e.height,d=Math.min(l,c),f=Tu(d,r,s),u=e.x+e.width/2,p=e.y+e.height/2,m=t/2-u*f,y=n/2-p*f,b=b3(e,m,y,f,t,n),k={left:Math.min(b.left-a.left,0),top:Math.min(b.top-a.top,0),right:Math.min(b.right-a.right,0),bottom:Math.min(b.bottom-a.bottom,0)};return{x:m-k.left+k.right,y:y-k.top+k.bottom,zoom:f}},Kf=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Lu(e){return e!=null&&e!=="parent"}function ga(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 tA(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 nA(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 JS(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function v3(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}function k3(e){return{...qP,...e||{}}}function pf(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:i,y:a}=Xi(e),l=xp({x:i-((s==null?void 0:s.left)??0),y:a-((s==null?void 0:s.top)??0)},r),{x:c,y:d}=n?yp(l,t):l;return{xSnapped:c,ySnapped:d,...l}}const t0=e=>({width:e.offsetWidth,height:e.offsetHeight}),rA=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},S3=["INPUT","SELECT","TEXTAREA"];function sA(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:S3.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const iA=e=>"clientX"in e,Xi=(e,t)=>{var i,a;const n=iA(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)}},QS=(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,...t0(a)}})};function oA({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:s,sourceControlY:i,targetControlX:a,targetControlY:l}){const c=e*.125+s*.375+a*.375+n*.125,d=t*.125+i*.375+l*.375+r*.125,f=Math.abs(c-e),u=Math.abs(d-t);return[c,d,f,u]}function Ph(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function ZS({pos:e,x1:t,y1:n,x2:r,y2:s,c:i}){switch(e){case Ze.Left:return[t-Ph(t-r,i),n];case Ze.Right:return[t+Ph(r-t,i),n];case Ze.Top:return[t,n-Ph(n-s,i)];case Ze.Bottom:return[t,n+Ph(s-n,i)]}}function aA({sourceX:e,sourceY:t,sourcePosition:n=Ze.Bottom,targetX:r,targetY:s,targetPosition:i=Ze.Top,curvature:a=.25}){const[l,c]=ZS({pos:n,x1:e,y1:t,x2:r,y2:s,c:a}),[d,f]=ZS({pos:i,x1:r,y1:s,x2:e,y2:t,c:a}),[u,p,m,y]=oA({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:l,sourceControlY:c,targetControlX:d,targetControlY:f});return[`M${e},${t} C${l},${c} ${d},${f} ${r},${s}`,u,p,m,y]}function lA({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 N3({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 j3({sourceNode:e,targetNode:t,width:n,height:r,transform:s}){const i=Jg(Zm(e),Zm(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 Uf(a,Qg(i))>0}const C3=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,E3=(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)),qf=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||C3;let s;return XP(e)?s={...e}:s={...e,id:r(e)},E3(s,t)?t:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,t.concat(s))};function cA({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,i,a,l]=lA({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,i,a,l]}const eN={[Ze.Left]:{x:-1,y:0},[Ze.Right]:{x:1,y:0},[Ze.Top]:{x:0,y:-1},[Ze.Bottom]:{x:0,y:1}},_3=({source:e,sourcePosition:t=Ze.Bottom,target:n})=>t===Ze.Left||t===Ze.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},tN=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function P3({source:e,sourcePosition:t=Ze.Bottom,target:n,targetPosition:r=Ze.Top,center:s,offset:i,stepPosition:a}){const l=eN[t],c=eN[r],d={x:e.x+l.x*i,y:e.y+l.y*i},f={x:n.x+c.x*i,y:n.y+c.y*i},u=_3({source:d,sourcePosition:t,target:f}),p=u.x!==0?"x":"y",m=u[p];let y=[],b,k;const g={x:0,y:0},v={x:0,y:0},[,,x,N]=lA({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[p]*c[p]===-1){p==="x"?(b=s.x??d.x+(f.x-d.x)*a,k=s.y??(d.y+f.y)/2):(b=s.x??(d.x+f.x)/2,k=s.y??d.y+(f.y-d.y)*a);const H=[{x:b,y:d.y},{x:b,y:f.y}],M=[{x:d.x,y:k},{x:f.x,y:k}];l[p]===m?y=p==="x"?H:M:y=p==="x"?M:H}else{const H=[{x:d.x,y:f.y}],M=[{x:f.x,y:d.y}];if(p==="x"?y=l.x===m?M:H:y=l.y===m?H:M,t===r){const O=Math.abs(e[p]-n[p]);if(O<=i){const R=Math.min(i-1,i-O);l[p]===m?g[p]=(d[p]>e[p]?-1:1)*R:v[p]=(f[p]>n[p]?-1:1)*R}}if(t!==r){const O=p==="x"?"y":"x",R=l[p]===c[O],I=d[O]>f[O],z=d[O]<f[O];(l[p]===1&&(!R&&I||R&&z)||l[p]!==1&&(!R&&z||R&&I))&&(y=p==="x"?H:M)}const F={x:d.x+g.x,y:d.y+g.y},D={x:f.x+v.x,y:f.y+v.y},$=Math.max(Math.abs(F.x-y[0].x),Math.abs(D.x-y[0].x)),W=Math.max(Math.abs(F.y-y[0].y),Math.abs(D.y-y[0].y));$>=W?(b=(F.x+D.x)/2,k=y[0].y):(b=y[0].x,k=(F.y+D.y)/2)}const _={x:d.x+g.x,y:d.y+g.y},C={x:f.x+v.x,y:f.y+v.y};return[[e,..._.x!==y[0].x||_.y!==y[0].y?[_]:[],...y,...C.x!==y[y.length-1].x||C.y!==y[y.length-1].y?[C]:[],n],b,k,x,N]}function A3(e,t,n,r){const s=Math.min(tN(e,t)/2,tN(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,c=e.y<n.y?-1:1;return`L ${i},${a+s*c}Q ${i},${a} ${i+s*l},${a}`}function db({sourceX:e,sourceY:t,sourcePosition:n=Ze.Bottom,targetX:r,targetY:s,targetPosition:i=Ze.Top,borderRadius:a=5,centerX:l,centerY:c,offset:d=20,stepPosition:f=.5}){const[u,p,m,y,b]=P3({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:s},targetPosition:i,center:{x:l,y:c},offset:d,stepPosition:f});let k=`M${u[0].x} ${u[0].y}`;for(let g=1;g<u.length-1;g++)k+=A3(u[g-1],u[g],u[g+1],a);return k+=`L${u[u.length-1].x} ${u[u.length-1].y}`,[k,p,m,y,b]}function nN(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function I3(e){var u;const{sourceNode:t,targetNode:n}=e;if(!nN(t)||!nN(n))return null;const r=t.internals.handleBounds||rN(t.handles),s=n.internals.handleBounds||rN(n.handles),i=sN((r==null?void 0:r.source)??[],e.sourceHandle),a=sN(e.connectionMode===Iu.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(u=e.onError)==null||u.call(e,"008",Io.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=(i==null?void 0:i.position)||Ze.Bottom,c=(a==null?void 0:a.position)||Ze.Top,d=hc(t,i,l),f=hc(n,a,c);return{sourceX:d.x,sourceY:d.y,targetX:f.x,targetY:f.y,sourcePosition:l,targetPosition:c}}function rN(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 hc(e,t,n=Ze.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??ga(e);if(r)return{x:s+a/2,y:i+l/2};switch((t==null?void 0:t.position)??n){case Ze.Top:return{x:s+a/2,y:i};case Ze.Right:return{x:s+a,y:i+l/2};case Ze.Bottom:return{x:s+a/2,y:i+l};case Ze.Left:return{x:s,y:i+l/2}}}function sN(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function fb(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function T3(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:s}){const i=new Set;return e.reduce((a,l)=>([l.markerStart||r,l.markerEnd||s].forEach(c=>{if(c&&typeof c=="object"){const d=fb(c,t);i.has(d)||(a.push({id:d,color:c.color||n,...c}),i.add(d))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))}const uA=1e3,R3=10,n0={nodeOrigin:[0,0],nodeExtent:Wf,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},L3={...n0,checkEquality:!0};function r0(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function M3(e,t,n){const r=r0(n0,n);for(const s of e.values())if(s.parentId)i0(s,e,t,r);else{const i=mp(s,r.nodeOrigin),a=Lu(s.extent)?s.extent:r.nodeExtent,l=pc(i,a,ga(s));s.internals.positionAbsolute=l}}function O3(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 s0(e){return e==="manual"}function pb(e,t,n,r={}){var f,u;const s=r0(L3,r),i={i:0},a=new Map(t),l=s!=null&&s.elevateNodesOnSelect&&!s0(s.zIndexMode)?uA:0;let c=e.length>0,d=!1;t.clear(),n.clear();for(const p of e){let m=a.get(p.id);if(s.checkEquality&&p===(m==null?void 0:m.internals.userNode))t.set(p.id,m);else{const y=mp(p,s.nodeOrigin),b=Lu(p.extent)?p.extent:s.nodeExtent,k=pc(y,b,ga(p));m={...s.defaults,...p,measured:{width:(f=p.measured)==null?void 0:f.width,height:(u=p.measured)==null?void 0:u.height},internals:{positionAbsolute:k,handleBounds:O3(p,m),z:dA(p,l,s.zIndexMode),userNode:p}},t.set(p.id,m)}(m.measured===void 0||m.measured.width===void 0||m.measured.height===void 0)&&!m.hidden&&(c=!1),p.parentId&&i0(m,t,n,r,i),d||(d=p.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:d}}function $3(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 i0(e,t,n,r,s){const{elevateNodesOnSelect:i,nodeOrigin:a,nodeExtent:l,zIndexMode:c}=r0(n0,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}$3(e,n),s&&!f.parentId&&f.internals.rootParentIndex===void 0&&c==="auto"&&(f.internals.rootParentIndex=++s.i,f.internals.z=f.internals.z+s.i*R3),s&&f.internals.rootParentIndex!==void 0&&(s.i=f.internals.rootParentIndex);const u=i&&!s0(c)?uA:0,{x:p,y:m,z:y}=D3(e,f,a,l,u,c),{positionAbsolute:b}=e.internals,k=p!==b.x||m!==b.y;(k||y!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:k?{x:p,y:m}:b,z:y}})}function dA(e,t,n){const r=Gi(e.zIndex)?e.zIndex:0;return s0(n)?r:r+(e.selected?t:0)}function D3(e,t,n,r,s,i){const{x:a,y:l}=t.internals.positionAbsolute,c=ga(e),d=mp(e,n),f=Lu(e.extent)?pc(d,e.extent,c):d;let u=pc({x:a+f.x,y:l+f.y},r,c);e.extent==="parent"&&(u=QP(u,c,t));const p=dA(e,s,i),m=t.internals.z??0;return{x:u.x,y:u.y,z:m>=p?m+1:p}}function o0(e,t,n,r=[0,0]){var a;const s=[],i=new Map;for(const l of e){const c=t.get(l.parentId);if(!c)continue;const d=((a=i.get(l.parentId))==null?void 0:a.expandedRect)??Ru(c),f=eA(d,l.rect);i.set(l.parentId,{expandedRect:f,parent:c})}return i.size>0&&i.forEach(({expandedRect:l,parent:c},d)=>{var x;const f=c.internals.positionAbsolute,u=ga(c),p=c.origin??r,m=l.x<f.x?Math.round(Math.abs(f.x-l.x)):0,y=l.y<f.y?Math.round(Math.abs(f.y-l.y)):0,b=Math.max(u.width,Math.round(l.width)),k=Math.max(u.height,Math.round(l.height)),g=(b-u.width)*p[0],v=(k-u.height)*p[1];(m>0||y>0||g||v)&&(s.push({id:d,type:"position",position:{x:c.position.x-m+g,y:c.position.y-y+v}}),(x=n.get(d))==null||x.forEach(N=>{e.some(_=>_.id===N.id)||s.push({id:N.id,type:"position",position:{x:N.position.x+m,y:N.position.y+y}})})),(u.width<l.width||u.height<l.height||m||y)&&s.push({id:d,type:"dimensions",setAttributes:!0,dimensions:{width:b+(m?p[0]*m-g:0),height:k+(y?p[1]*y-v:0)}})}),s}function F3(e,t,n,r,s,i,a){const l=r==null?void 0:r.querySelector(".xyflow__viewport");let c=!1;if(!l)return{changes:[],updatedInternals:c};const d=[],f=window.getComputedStyle(l),{m22:u}=new window.DOMMatrixReadOnly(f.transform),p=[];for(const m of e.values()){const y=t.get(m.id);if(!y)continue;if(y.hidden){t.set(y.id,{...y,internals:{...y.internals,handleBounds:void 0}}),c=!0;continue}const b=t0(m.nodeElement),k=y.measured.width!==b.width||y.measured.height!==b.height;if(!!(b.width&&b.height&&(k||!y.internals.handleBounds||m.force))){const v=m.nodeElement.getBoundingClientRect(),x=Lu(y.extent)?y.extent:i;let{positionAbsolute:N}=y.internals;y.parentId&&y.extent==="parent"?N=QP(N,b,t.get(y.parentId)):x&&(N=pc(N,x,b));const _={...y,measured:b,internals:{...y.internals,positionAbsolute:N,handleBounds:{source:QS("source",m.nodeElement,v,u,y.id),target:QS("target",m.nodeElement,v,u,y.id)}}};t.set(y.id,_),y.parentId&&i0(_,t,n,{nodeOrigin:s,zIndexMode:a}),c=!0,k&&(d.push({id:y.id,type:"dimensions",dimensions:b}),y.expandParent&&y.parentId&&p.push({id:y.id,parentId:y.parentId,rect:Ru(_,s)}))}}if(p.length>0){const m=o0(p,t,n,s);d.push(...m)}return{changes:d,updatedInternals:c}}async function z3({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 iN(e,t,n,r,s,i){let a=s;const l=r.get(a)||new Map;r.set(a,l.set(n,t)),a=`${s}-${e}`;const c=r.get(a)||new Map;if(r.set(a,c.set(n,t)),i){a=`${s}-${e}-${i}`;const d=r.get(a)||new Map;r.set(a,d.set(n,t))}}function fA(e,t,n){e.clear(),t.clear();for(const r of n){const{source:s,target:i,sourceHandle:a=null,targetHandle:l=null}=r,c={edgeId:r.id,source:s,target:i,sourceHandle:a,targetHandle:l},d=`${s}-${a}--${i}-${l}`,f=`${i}-${l}--${s}-${a}`;iN("source",c,f,e,s,a),iN("target",c,d,e,i,l),t.set(r.id,r)}}function pA(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:pA(n,t):!1}function oN(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 H3(e,t,n,r){const s=new Map;for(const[i,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!pA(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 px({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var a,l,c;const s=[];for(const[d,f]of t){const u=(a=n.get(d))==null?void 0:a.internals.userNode;u&&s.push({...u,position:f.position,dragging:r})}if(!e)return[s[0],s];const i=(l=n.get(e))==null?void 0:l.internals.userNode;return[i?{...i,position:((c=t.get(e))==null?void 0:c.position)||i.position,dragging:r}:s[0],s]}function B3({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=yp(i,t);return{x:a.x-i.x,y:a.y-i.y}}function W3({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:s}){let i={x:null,y:null},a=0,l=new Map,c=!1,d={x:0,y:0},f=null,u=!1,p=null,m=!1,y=!1,b=null;function k({noDragClassName:v,handleSelector:x,domNode:N,isSelectable:_,nodeId:C,nodeClickDistance:T=0}){p=Zs(N);function H({x:$,y:W}){const{nodeLookup:O,nodeExtent:R,snapGrid:I,snapToGrid:z,nodeOrigin:P,onNodeDrag:L,onSelectionDrag:E,onError:X,updateNodePositions:ee}=t();i={x:$,y:W};let V=!1;const ie=l.size>1,fe=ie&&R?ub(gp(l)):null,me=ie&&z?B3({dragItems:l,snapGrid:I,x:$,y:W}):null;for(const[ge,Z]of l){if(!O.has(ge))continue;let ae={x:$-Z.distance.x,y:W-Z.distance.y};z&&(ae=me?{x:Math.round(ae.x+me.x),y:Math.round(ae.y+me.y)}:yp(ae,I));let xe=null;if(ie&&R&&!Z.extent&&fe){const{positionAbsolute:je}=Z.internals,Ve=je.x-fe.x+R[0][0],et=je.x+Z.measured.width-fe.x2+R[1][0],qe=je.y-fe.y+R[0][1],dt=je.y+Z.measured.height-fe.y2+R[1][1];xe=[[Ve,qe],[et,dt]]}const{position:pe,positionAbsolute:_e}=JP({nodeId:ge,nextPosition:ae,nodeLookup:O,nodeExtent:xe||R,nodeOrigin:P,onError:X});V=V||Z.position.x!==pe.x||Z.position.y!==pe.y,Z.position=pe,Z.internals.positionAbsolute=_e}if(y=y||V,!!V&&(ee(l,!0),b&&(r||L||!C&&E))){const[ge,Z]=px({nodeId:C,dragItems:l,nodeLookup:O});r==null||r(b,l,ge,Z),L==null||L(b,ge,Z),C||E==null||E(b,Z)}}async function M(){if(!f)return;const{transform:$,panBy:W,autoPanSpeed:O,autoPanOnNodeDrag:R}=t();if(!R){c=!1,cancelAnimationFrame(a);return}const[I,z]=ZP(d,f,O);(I!==0||z!==0)&&(i.x=(i.x??0)-I/$[2],i.y=(i.y??0)-z/$[2],await W({x:I,y:z})&&H(i)),a=requestAnimationFrame(M)}function F($){var ie;const{nodeLookup:W,multiSelectionActive:O,nodesDraggable:R,transform:I,snapGrid:z,snapToGrid:P,selectNodesOnDrag:L,onNodeDragStart:E,onSelectionDragStart:X,unselectNodesAndEdges:ee}=t();u=!0,(!L||!_)&&!O&&C&&((ie=W.get(C))!=null&&ie.selected||ee()),_&&L&&C&&(e==null||e(C));const V=pf($.sourceEvent,{transform:I,snapGrid:z,snapToGrid:P,containerBounds:f});if(i=V,l=H3(W,R,V,C),l.size>0&&(n||E||!C&&X)){const[fe,me]=px({nodeId:C,dragItems:l,nodeLookup:W});n==null||n($.sourceEvent,l,fe,me),E==null||E($.sourceEvent,fe,me),C||X==null||X($.sourceEvent,me)}}const D=AP().clickDistance(T).on("start",$=>{const{domNode:W,nodeDragThreshold:O,transform:R,snapGrid:I,snapToGrid:z}=t();f=(W==null?void 0:W.getBoundingClientRect())||null,m=!1,y=!1,b=$.sourceEvent,O===0&&F($),i=pf($.sourceEvent,{transform:R,snapGrid:I,snapToGrid:z,containerBounds:f}),d=Xi($.sourceEvent,f)}).on("drag",$=>{const{autoPanOnNodeDrag:W,transform:O,snapGrid:R,snapToGrid:I,nodeDragThreshold:z,nodeLookup:P}=t(),L=pf($.sourceEvent,{transform:O,snapGrid:R,snapToGrid:I,containerBounds:f});if(b=$.sourceEvent,($.sourceEvent.type==="touchmove"&&$.sourceEvent.touches.length>1||C&&!P.has(C))&&(m=!0),!m){if(!c&&W&&u&&(c=!0,M()),!u){const E=Xi($.sourceEvent,f),X=E.x-d.x,ee=E.y-d.y;Math.sqrt(X*X+ee*ee)>z&&F($)}(i.x!==L.xSnapped||i.y!==L.ySnapped)&&l&&u&&(d=Xi($.sourceEvent,f),H(L))}}).on("end",$=>{if(!(!u||m)&&(c=!1,u=!1,cancelAnimationFrame(a),l.size>0)){const{nodeLookup:W,updateNodePositions:O,onNodeDragStop:R,onSelectionDragStop:I}=t();if(y&&(O(l,!1),y=!1),s||R||!C&&I){const[z,P]=px({nodeId:C,dragItems:l,nodeLookup:W,dragging:!1});s==null||s($.sourceEvent,l,z,P),R==null||R($.sourceEvent,z,P),C||I==null||I($.sourceEvent,P)}}}).filter($=>{const W=$.target;return!$.button&&(!v||!oN(W,`.${v}`,N))&&(!x||oN(W,x,N))});p.call(D)}function g(){p==null||p.on(".drag",null)}return{update:k,destroy:g}}function V3(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())Uf(s,Ru(i))>0&&r.push(i);return r}const U3=250;function K3(e,t,n,r){var l,c;let s=[],i=1/0;const a=V3(e,n,t+U3);for(const d of a){const f=[...((l=d.internals.handleBounds)==null?void 0:l.source)??[],...((c=d.internals.handleBounds)==null?void 0:c.target)??[]];for(const u of f){if(r.nodeId===u.nodeId&&r.type===u.type&&r.id===u.id)continue;const{x:p,y:m}=hc(d,u,u.position,!0),y=Math.sqrt(Math.pow(p-e.x,2)+Math.pow(m-e.y,2));y>t||(y<i?(s=[{...u,x:p,y:m}],i=y):y===i&&s.push({...u,x:p,y:m}))}}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 hA(e,t,n,r,s,i=!1){var d,f,u;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)??[],...((u=a.internals.handleBounds)==null?void 0:u.target)??[]],c=(n?l==null?void 0:l.find(p=>p.id===n):l==null?void 0:l[0])??null;return c&&i?{...c,...hc(a,c,c.position,!0)}:c}function mA(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function q3(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const gA=()=>!0;function Y3(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:s,edgeUpdaterType:i,isTarget:a,domNode:l,nodeLookup:c,lib:d,autoPanOnConnect:f,flowId:u,panBy:p,cancelConnection:m,onConnectStart:y,onConnect:b,onConnectEnd:k,isValidConnection:g=gA,onReconnectEnd:v,updateConnection:x,getTransform:N,getFromHandle:_,autoPanSpeed:C,dragThreshold:T=1,handleDomNode:H}){const M=rA(e.target);let F=0,D;const{x:$,y:W}=Xi(e),O=mA(i,H),R=l==null?void 0:l.getBoundingClientRect();let I=!1;if(!R||!O)return;const z=hA(s,O,r,c,t);if(!z)return;let P=Xi(e,R),L=!1,E=null,X=!1,ee=null;function V(){if(!f||!R)return;const[pe,_e]=ZP(P,R,C);p({x:pe,y:_e}),F=requestAnimationFrame(V)}const ie={...z,nodeId:s,type:O,position:z.position},fe=c.get(s);let ge={inProgress:!0,isValid:null,from:hc(fe,ie,Ze.Left,!0),fromHandle:ie,fromPosition:ie.position,fromNode:fe,to:P,toHandle:null,toPosition:YS[ie.position],toNode:null,pointer:P};function Z(){I=!0,x(ge),y==null||y(e,{nodeId:s,handleId:r,handleType:O})}T===0&&Z();function ae(pe){if(!I){const{x:dt,y:He}=Xi(pe),bt=dt-$,sn=He-W;if(!(bt*bt+sn*sn>T*T))return;Z()}if(!_()||!ie){xe(pe);return}const _e=N();P=Xi(pe,R),D=K3(xp(P,_e,!1,[1,1]),n,c,ie),L||(V(),L=!0);const je=yA(pe,{handle:D,connectionMode:t,fromNodeId:s,fromHandleId:r,fromType:a?"target":"source",isValidConnection:g,doc:M,lib:d,flowId:u,nodeLookup:c});ee=je.handleDomNode,E=je.connection,X=q3(!!D,je.isValid);const Ve=c.get(s),et=Ve?hc(Ve,ie,Ze.Left,!0):ge.from,qe={...ge,from:et,isValid:X,to:je.toHandle&&X?eg({x:je.toHandle.x,y:je.toHandle.y},_e):P,toHandle:je.toHandle,toPosition:X&&je.toHandle?je.toHandle.position:YS[ie.position],toNode:je.toHandle?c.get(je.toHandle.nodeId):null,pointer:P};x(qe),ge=qe}function xe(pe){if(!("touches"in pe&&pe.touches.length>0)){if(I){(D||ee)&&E&&X&&(b==null||b(E));const{inProgress:_e,...je}=ge,Ve={...je,toPosition:ge.toHandle?ge.toPosition:null};k==null||k(pe,Ve),i&&(v==null||v(pe,Ve))}m(),cancelAnimationFrame(F),L=!1,X=!1,E=null,ee=null,M.removeEventListener("mousemove",ae),M.removeEventListener("mouseup",xe),M.removeEventListener("touchmove",ae),M.removeEventListener("touchend",xe)}}M.addEventListener("mousemove",ae),M.addEventListener("mouseup",xe),M.addEventListener("touchmove",ae),M.addEventListener("touchend",xe)}function yA(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:i,doc:a,lib:l,flowId:c,isValidConnection:d=gA,nodeLookup:f}){const u=i==="target",p=t?a.querySelector(`.${l}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:m,y}=Xi(e),b=a.elementFromPoint(m,y),k=b!=null&&b.classList.contains(`${l}-flow__handle`)?b:p,g={handleDomNode:k,isValid:!1,connection:null,toHandle:null};if(k){const v=mA(void 0,k),x=k.getAttribute("data-nodeid"),N=k.getAttribute("data-handleid"),_=k.classList.contains("connectable"),C=k.classList.contains("connectableend");if(!x||!v)return g;const T={source:u?x:r,sourceHandle:u?N:s,target:u?r:x,targetHandle:u?s:N};g.connection=T;const M=_&&C&&(n===Iu.Strict?u&&v==="source"||!u&&v==="target":x!==r||N!==s);g.isValid=M&&d(T),g.toHandle=hA(x,v,N,f,n,!0)}return g}const hb={onPointerDown:Y3,isValid:yA};function G3({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const s=Zs(e);function i({translateExtent:l,width:c,height:d,zoomStep:f=1,pannable:u=!0,zoomable:p=!0,inversePan:m=!1}){const y=x=>{if(x.sourceEvent.type!=="wheel"||!t)return;const N=n(),_=x.sourceEvent.ctrlKey&&Kf()?10:1,C=-x.sourceEvent.deltaY*(x.sourceEvent.deltaMode===1?.05:x.sourceEvent.deltaMode?1:.002)*f,T=N[2]*Math.pow(2,C*_);t.scaleTo(T)};let b=[0,0];const k=x=>{(x.sourceEvent.type==="mousedown"||x.sourceEvent.type==="touchstart")&&(b=[x.sourceEvent.clientX??x.sourceEvent.touches[0].clientX,x.sourceEvent.clientY??x.sourceEvent.touches[0].clientY])},g=x=>{const N=n();if(x.sourceEvent.type!=="mousemove"&&x.sourceEvent.type!=="touchmove"||!t)return;const _=[x.sourceEvent.clientX??x.sourceEvent.touches[0].clientX,x.sourceEvent.clientY??x.sourceEvent.touches[0].clientY],C=[_[0]-b[0],_[1]-b[1]];b=_;const T=r()*Math.max(N[2],Math.log(N[2]))*(m?-1:1),H={x:N[0]-C[0]*T,y:N[1]-C[1]*T},M=[[0,0],[c,d]];t.setViewportConstrained({x:H.x,y:H.y,zoom:N[2]},M,l)},v=UP().on("start",k).on("zoom",u?g:null).on("zoom.wheel",p?y:null);s.call(v,{})}function a(){s.on("zoom",null)}return{update:i,destroy:a,pointer:Ui}}const Zg=e=>({x:e.x,y:e.y,zoom:e.k}),hx=({x:e,y:t,zoom:n})=>Xg.translate(e,t).scale(n),iu=(e,t)=>e.target.closest(`.${t}`),xA=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),X3=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,mx=(e,t=0,n=X3,r=()=>{})=>{const s=typeof t=="number"&&t>0;return s||r(),s?e.transition().duration(t).ease(n).on("end",r):e},wA=e=>{const t=e.ctrlKey&&Kf()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function J3({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:i,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:d}){return f=>{if(iu(f,t))return f.ctrlKey&&f.preventDefault(),!1;f.preventDefault(),f.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(f.ctrlKey&&a){const k=Ui(f),g=wA(f),v=u*Math.pow(2,g);r.scaleTo(n,v,k,f);return}const p=f.deltaMode===1?20:1;let m=s===nc.Vertical?0:f.deltaX*p,y=s===nc.Horizontal?0:f.deltaY*p;!Kf()&&f.shiftKey&&s!==nc.Vertical&&(m=f.deltaY*p,y=0),r.translateBy(n,-(m/u)*i,-(y/u)*i,{internal:!0});const b=Zg(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(f,b),e.panScrollTimeout=setTimeout(()=>{d==null||d(f,b),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(f,b))}}function Q3({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,s){const i=r.type==="wheel",a=!t&&i&&!r.ctrlKey,l=iu(r,e);if(r.ctrlKey&&i&&l&&r.preventDefault(),a||l)return null;r.preventDefault(),n.call(this,r,s)}}function Z3({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,a,l;if((i=r.sourceEvent)!=null&&i.internal)return;const s=Zg(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 e5({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return i=>{var a,l;e.usedRightMouseButton=!!(n&&xA(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,Zg(i.transform)))}}function t5({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&&xA(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&i(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),s)){const c=Zg(a.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(a.sourceEvent,c)},n?150:0)}}}function n5({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:i,userSelectionActive:a,noWheelClassName:l,noPanClassName:c,lib:d,connectionInProgress:f}){return u=>{var k;const p=e||t,m=n&&u.ctrlKey,y=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(iu(u,`${d}-flow__node`)||iu(u,`${d}-flow__edge`)))return!0;if(!r&&!p&&!s&&!i&&!n||a||f&&!y||iu(u,l)&&y||iu(u,c)&&(!y||s&&y&&!e)||!n&&u.ctrlKey&&y)return!1;if(!n&&u.type==="touchstart"&&((k=u.touches)==null?void 0:k.length)>1)return u.preventDefault(),!1;if(!p&&!s&&!m&&y||!r&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(r)&&!r.includes(u.button)&&u.type==="mousedown")return!1;const b=Array.isArray(r)&&r.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||y)&&b}}function r5({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:s,onPanZoom:i,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:c}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=e.getBoundingClientRect(),u=UP().scaleExtent([t,n]).translateExtent(r),p=Zs(e).call(u);v({x:s.x,y:s.y,zoom:Tu(s.zoom,t,n)},[[0,0],[f.width,f.height]],r);const m=p.on("wheel.zoom"),y=p.on("dblclick.zoom");u.wheelDelta(wA);function b(D,$){return p?new Promise(W=>{u==null||u.interpolate(($==null?void 0:$.interpolate)==="linear"?ff:cm).transform(mx(p,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>W(!0)),D)}):Promise.resolve(!1)}function k({noWheelClassName:D,noPanClassName:$,onPaneContextMenu:W,userSelectionActive:O,panOnScroll:R,panOnDrag:I,panOnScrollMode:z,panOnScrollSpeed:P,preventScrolling:L,zoomOnPinch:E,zoomOnScroll:X,zoomOnDoubleClick:ee,zoomActivationKeyPressed:V,lib:ie,onTransformChange:fe,connectionInProgress:me,paneClickDistance:ge,selectionOnDrag:Z}){O&&!d.isZoomingOrPanning&&g();const ae=R&&!V&&!O;u.clickDistance(Z?1/0:!Gi(ge)||ge<0?0:ge);const xe=ae?J3({zoomPanValues:d,noWheelClassName:D,d3Selection:p,d3Zoom:u,panOnScrollMode:z,panOnScrollSpeed:P,zoomOnPinch:E,onPanZoomStart:a,onPanZoom:i,onPanZoomEnd:l}):Q3({noWheelClassName:D,preventScrolling:L,d3ZoomHandler:m});if(p.on("wheel.zoom",xe,{passive:!1}),!O){const _e=Z3({zoomPanValues:d,onDraggingChange:c,onPanZoomStart:a});u.on("start",_e);const je=e5({zoomPanValues:d,panOnDrag:I,onPaneContextMenu:!!W,onPanZoom:i,onTransformChange:fe});u.on("zoom",je);const Ve=t5({zoomPanValues:d,panOnDrag:I,panOnScroll:R,onPaneContextMenu:W,onPanZoomEnd:l,onDraggingChange:c});u.on("end",Ve)}const pe=n5({zoomActivationKeyPressed:V,panOnDrag:I,zoomOnScroll:X,panOnScroll:R,zoomOnDoubleClick:ee,zoomOnPinch:E,userSelectionActive:O,noPanClassName:$,noWheelClassName:D,lib:ie,connectionInProgress:me});u.filter(pe),ee?p.on("dblclick.zoom",y):p.on("dblclick.zoom",null)}function g(){u.on("zoom",null)}async function v(D,$,W){const O=hx(D),R=u==null?void 0:u.constrain()(O,$,W);return R&&await b(R),new Promise(I=>I(R))}async function x(D,$){const W=hx(D);return await b(W,$),new Promise(O=>O(W))}function N(D){if(p){const $=hx(D),W=p.property("__zoom");(W.k!==D.zoom||W.x!==D.x||W.y!==D.y)&&(u==null||u.transform(p,$,null,{sync:!0}))}}function _(){const D=p?VP(p.node()):{x:0,y:0,k:1};return{x:D.x,y:D.y,zoom:D.k}}function C(D,$){return p?new Promise(W=>{u==null||u.interpolate(($==null?void 0:$.interpolate)==="linear"?ff:cm).scaleTo(mx(p,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>W(!0)),D)}):Promise.resolve(!1)}function T(D,$){return p?new Promise(W=>{u==null||u.interpolate(($==null?void 0:$.interpolate)==="linear"?ff:cm).scaleBy(mx(p,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>W(!0)),D)}):Promise.resolve(!1)}function H(D){u==null||u.scaleExtent(D)}function M(D){u==null||u.translateExtent(D)}function F(D){const $=!Gi(D)||D<0?0:D;u==null||u.clickDistance($)}return{update:k,destroy:g,setViewport:x,setViewportConstrained:v,getViewport:_,scaleTo:C,scaleBy:T,setScaleExtent:H,setTranslateExtent:M,syncViewport:N,setClickDistance:F}}var Mu;(function(e){e.Line="line",e.Handle="handle"})(Mu||(Mu={}));function s5({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:s,affectsY:i}){const a=e-t,l=n-r,c=[a>0?1:a<0?-1:0,l>0?1:l<0?-1:0];return a&&s&&(c[0]=c[0]*-1),l&&i&&(c[1]=c[1]*-1),c}function aN(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 Oa(e,t){return Math.max(0,t-e)}function $a(e,t){return Math.max(0,e-t)}function Ah(e,t,n){return Math.max(0,t-e,e-n)}function lN(e,t){return e?!t:t}function i5(e,t,n,r,s,i,a,l){let{affectsX:c,affectsY:d}=t;const{isHorizontal:f,isVertical:u}=t,p=f&&u,{xSnapped:m,ySnapped:y}=n,{minWidth:b,maxWidth:k,minHeight:g,maxHeight:v}=r,{x,y:N,width:_,height:C,aspectRatio:T}=e;let H=Math.floor(f?m-e.pointerX:0),M=Math.floor(u?y-e.pointerY:0);const F=_+(c?-H:H),D=C+(d?-M:M),$=-i[0]*_,W=-i[1]*C;let O=Ah(F,b,k),R=Ah(D,g,v);if(a){let P=0,L=0;c&&H<0?P=Oa(x+H+$,a[0][0]):!c&&H>0&&(P=$a(x+F+$,a[1][0])),d&&M<0?L=Oa(N+M+W,a[0][1]):!d&&M>0&&(L=$a(N+D+W,a[1][1])),O=Math.max(O,P),R=Math.max(R,L)}if(l){let P=0,L=0;c&&H>0?P=$a(x+H,l[0][0]):!c&&H<0&&(P=Oa(x+F,l[1][0])),d&&M>0?L=$a(N+M,l[0][1]):!d&&M<0&&(L=Oa(N+D,l[1][1])),O=Math.max(O,P),R=Math.max(R,L)}if(s){if(f){const P=Ah(F/T,g,v)*T;if(O=Math.max(O,P),a){let L=0;!c&&!d||c&&!d&&p?L=$a(N+W+F/T,a[1][1])*T:L=Oa(N+W+(c?H:-H)/T,a[0][1])*T,O=Math.max(O,L)}if(l){let L=0;!c&&!d||c&&!d&&p?L=Oa(N+F/T,l[1][1])*T:L=$a(N+(c?H:-H)/T,l[0][1])*T,O=Math.max(O,L)}}if(u){const P=Ah(D*T,b,k)/T;if(R=Math.max(R,P),a){let L=0;!c&&!d||d&&!c&&p?L=$a(x+D*T+$,a[1][0])/T:L=Oa(x+(d?M:-M)*T+$,a[0][0])/T,R=Math.max(R,L)}if(l){let L=0;!c&&!d||d&&!c&&p?L=Oa(x+D*T,l[1][0])/T:L=$a(x+(d?M:-M)*T,l[0][0])/T,R=Math.max(R,L)}}}M=M+(M<0?R:-R),H=H+(H<0?O:-O),s&&(p?F>D*T?M=(lN(c,d)?-H:H)/T:H=(lN(c,d)?-M:M)*T:f?(M=H/T,d=c):(H=M*T,c=d));const I=c?x+H:x,z=d?N+M:N;return{width:_+(c?-H:H),height:C+(d?-M:M),x:i[0]*H*(c?-1:1)+I,y:i[1]*M*(d?-1:1)+z}}const bA={width:0,height:0,x:0,y:0},o5={...bA,pointerX:0,pointerY:0,aspectRatio:1};function a5(e){return[[0,0],[e.measured.width,e.measured.height]]}function l5(e,t,n){const r=t.position.x+e.position.x,s=t.position.y+e.position.y,i=e.measured.width??0,a=e.measured.height??0,l=n[0]*i,c=n[1]*a;return[[r-l,s-c],[r+i-l,s+a-c]]}function c5({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:s}){const i=Zs(e);let a={controlDirection:aN("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:u,resizeDirection:p,onResizeStart:m,onResize:y,onResizeEnd:b,shouldResize:k}){let g={...bA},v={...o5};a={boundaries:f,resizeDirection:p,keepAspectRatio:u,controlDirection:aN(d)};let x,N=null,_=[],C,T,H,M=!1;const F=AP().on("start",D=>{const{nodeLookup:$,transform:W,snapGrid:O,snapToGrid:R,nodeOrigin:I,paneDomNode:z}=n();if(x=$.get(t),!x)return;N=(z==null?void 0:z.getBoundingClientRect())??null;const{xSnapped:P,ySnapped:L}=pf(D.sourceEvent,{transform:W,snapGrid:O,snapToGrid:R,containerBounds:N});g={width:x.measured.width??0,height:x.measured.height??0,x:x.position.x??0,y:x.position.y??0},v={...g,pointerX:P,pointerY:L,aspectRatio:g.width/g.height},C=void 0,x.parentId&&(x.extent==="parent"||x.expandParent)&&(C=$.get(x.parentId),T=C&&x.extent==="parent"?a5(C):void 0),_=[],H=void 0;for(const[E,X]of $)if(X.parentId===t&&(_.push({id:E,position:{...X.position},extent:X.extent}),X.extent==="parent"||X.expandParent)){const ee=l5(X,x,X.origin??I);H?H=[[Math.min(ee[0][0],H[0][0]),Math.min(ee[0][1],H[0][1])],[Math.max(ee[1][0],H[1][0]),Math.max(ee[1][1],H[1][1])]]:H=ee}m==null||m(D,{...g})}).on("drag",D=>{const{transform:$,snapGrid:W,snapToGrid:O,nodeOrigin:R}=n(),I=pf(D.sourceEvent,{transform:$,snapGrid:W,snapToGrid:O,containerBounds:N}),z=[];if(!x)return;const{x:P,y:L,width:E,height:X}=g,ee={},V=x.origin??R,{width:ie,height:fe,x:me,y:ge}=i5(v,a.controlDirection,I,a.boundaries,a.keepAspectRatio,V,T,H),Z=ie!==E,ae=fe!==X,xe=me!==P&&Z,pe=ge!==L&&ae;if(!xe&&!pe&&!Z&&!ae)return;if((xe||pe||V[0]===1||V[1]===1)&&(ee.x=xe?me:g.x,ee.y=pe?ge:g.y,g.x=ee.x,g.y=ee.y,_.length>0)){const et=me-P,qe=ge-L;for(const dt of _)dt.position={x:dt.position.x-et+V[0]*(ie-E),y:dt.position.y-qe+V[1]*(fe-X)},z.push(dt)}if((Z||ae)&&(ee.width=Z&&(!a.resizeDirection||a.resizeDirection==="horizontal")?ie:g.width,ee.height=ae&&(!a.resizeDirection||a.resizeDirection==="vertical")?fe:g.height,g.width=ee.width,g.height=ee.height),C&&x.expandParent){const et=V[0]*(ee.width??0);ee.x&&ee.x<et&&(g.x=et,v.x=v.x-(ee.x-et));const qe=V[1]*(ee.height??0);ee.y&&ee.y<qe&&(g.y=qe,v.y=v.y-(ee.y-qe))}const _e=s5({width:g.width,prevWidth:E,height:g.height,prevHeight:X,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),je={...g,direction:_e};(k==null?void 0:k(D,je))!==!1&&(M=!0,y==null||y(D,je),r(ee,z))}).on("end",D=>{M&&(b==null||b(D,{...g}),s==null||s({...g}),M=!1)});i.call(F)}function c(){i.on(".drag",null)}return{update:l,destroy:c}}var vA={exports:{}},kA={},SA={exports:{}},NA={};/**
|
|
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 Ou=h;function u5(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var d5=typeof Object.is=="function"?Object.is:u5,f5=Ou.useState,p5=Ou.useEffect,h5=Ou.useLayoutEffect,m5=Ou.useDebugValue;function g5(e,t){var n=t(),r=f5({inst:{value:n,getSnapshot:t}}),s=r[0].inst,i=r[1];return h5(function(){s.value=n,s.getSnapshot=t,gx(s)&&i({inst:s})},[e,n,t]),p5(function(){return gx(s)&&i({inst:s}),e(function(){gx(s)&&i({inst:s})})},[e]),m5(n),n}function gx(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!d5(e,n)}catch{return!0}}function y5(e,t){return t()}var x5=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?y5:g5;NA.useSyncExternalStore=Ou.useSyncExternalStore!==void 0?Ou.useSyncExternalStore:x5;SA.exports=NA;var jA=SA.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 ey=h,w5=jA;function b5(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var v5=typeof Object.is=="function"?Object.is:b5,k5=w5.useSyncExternalStore,S5=ey.useRef,N5=ey.useEffect,j5=ey.useMemo,C5=ey.useDebugValue;kA.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var i=S5(null);if(i.current===null){var a={hasValue:!1,value:null};i.current=a}else a=i.current;i=j5(function(){function c(m){if(!d){if(d=!0,f=m,m=r(m),s!==void 0&&a.hasValue){var y=a.value;if(s(y,m))return u=y}return u=m}if(y=u,v5(f,m))return y;var b=r(m);return s!==void 0&&s(y,b)?(f=m,y):(f=m,u=b)}var d=!1,f,u,p=n===void 0?null:n;return[function(){return c(t())},p===null?void 0:function(){return c(p())}]},[t,n,r,s]);var l=k5(e,i[0],i[1]);return N5(function(){a.hasValue=!0,a.value=l},[l]),C5(l),l};vA.exports=kA;var E5=vA.exports;const _5=hl(E5),P5={},cN=e=>{let t;const n=new Set,r=(f,u)=>{const p=typeof f=="function"?f(t):f;if(!Object.is(p,t)){const m=t;t=u??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(y=>y(t,m))}},s=()=>t,c={setState:r,getState:s,getInitialState:()=>d,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(P5?"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,c);return c},A5=e=>e?cN(e):cN,{useDebugValue:I5}=ct,{useSyncExternalStoreWithSelector:T5}=_5,R5=e=>e;function CA(e,t=R5,n){const r=T5(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return I5(r),r}const uN=(e,t)=>{const n=A5(e),r=(s,i=t)=>CA(n,s,i);return Object.assign(r,n),r},L5=(e,t)=>e?uN(e,t):uN;function Yn(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 ty=h.createContext(null),M5=ty.Provider,EA=Io.error001();function Vt(e,t){const n=h.useContext(ty);if(n===null)throw new Error(EA);return CA(n,e,t)}function Hn(){const e=h.useContext(ty);if(e===null)throw new Error(EA);return h.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const dN={display:"none"},O5={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},_A="react-flow__node-desc",PA="react-flow__edge-desc",$5="react-flow__aria-live",D5=e=>e.ariaLiveMessage,F5=e=>e.ariaLabelConfig;function z5({rfId:e}){const t=Vt(D5);return o.jsx("div",{id:`${$5}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:O5,children:t})}function H5({rfId:e,disableKeyboardA11y:t}){const n=Vt(F5);return o.jsxs(o.Fragment,{children:[o.jsx("div",{id:`${_A}-${e}`,style:dN,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),o.jsx("div",{id:`${PA}-${e}`,style:dN,children:n["edge.a11yDescription.default"]}),!t&&o.jsx(z5,{rfId:e})]})}const $u=h.forwardRef(({position:e="top-left",children:t,className:n,style:r,...s},i)=>{const a=`${e}`.split("-");return o.jsx("div",{className:br(["react-flow__panel",n,...a]),style:r,ref:i,...s,children:t})});$u.displayName="Panel";function B5({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:o.jsx($u,{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 W5=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}},Ih=e=>e.id;function V5(e,t){return Yn(e.selectedNodes.map(Ih),t.selectedNodes.map(Ih))&&Yn(e.selectedEdges.map(Ih),t.selectedEdges.map(Ih))}function U5({onSelectionChange:e}){const t=Hn(),{selectedNodes:n,selectedEdges:r}=Vt(W5,V5);return h.useEffect(()=>{const s={nodes:n,edges:r};e==null||e(s),t.getState().onSelectionChangeHandlers.forEach(i=>i(s))},[n,r,e]),null}const K5=e=>!!e.onSelectionChangeHandlers;function q5({onSelectionChange:e}){const t=Vt(K5);return e||t?o.jsx(U5,{onSelectionChange:e}):null}const mb=typeof window<"u"?h.useLayoutEffect:h.useEffect,AA=[0,0],Y5={x:0,y:0,zoom:1},G5=["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"],fN=[...G5,"rfId"],X5=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}),pN={translateExtent:Wf,nodeOrigin:AA,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function J5(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:s,setTranslateExtent:i,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:c}=Vt(X5,Yn),d=Hn();mb(()=>(c(e.defaultNodes,e.defaultEdges),()=>{f.current=pN,l()}),[]);const f=h.useRef(pN);return mb(()=>{for(const u of fN){const p=e[u],m=f.current[u];p!==m&&(typeof e[u]>"u"||(u==="nodes"?t(p):u==="edges"?n(p):u==="minZoom"?r(p):u==="maxZoom"?s(p):u==="translateExtent"?i(p):u==="nodeExtent"?a(p):u==="ariaLabelConfig"?d.setState({ariaLabelConfig:k3(p)}):u==="fitView"?d.setState({fitViewQueued:p}):u==="fitViewOptions"?d.setState({fitViewOptions:p}):d.setState({[u]:p})))}f.current=e},fN.map(u=>e[u])),null}function hN(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Q5(e){var r;const[t,n]=h.useState(e==="system"?null:e);return h.useEffect(()=>{if(e!=="system"){n(e);return}const s=hN(),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=hN())!=null&&r.matches?"dark":"light"}const mN=typeof document<"u"?document:null;function Yf(e=null,t={target:mN,actInsideInputWithModifier:!0}){const[n,r]=h.useState(!1),s=h.useRef(!1),i=h.useRef(new Set([])),[a,l]=h.useMemo(()=>{if(e!==null){const d=(Array.isArray(e)?e:[e]).filter(u=>typeof u=="string").map(u=>u.replace("+",`
|
|
61
|
+
`).replace(`
|
|
62
|
+
|
|
63
|
+
`,`
|
|
64
|
+
+`).split(`
|
|
65
|
+
`)),f=d.reduce((u,p)=>u.concat(...p),[]);return[d,f]}return[[],[]]},[e]);return h.useEffect(()=>{const c=(t==null?void 0:t.target)??mN,d=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const f=m=>{var k,g;if(s.current=m.ctrlKey||m.metaKey||m.shiftKey||m.altKey,(!s.current||s.current&&!d)&&sA(m))return!1;const b=yN(m.code,l);if(i.current.add(m[b]),gN(a,i.current,!1)){const v=((g=(k=m.composedPath)==null?void 0:k.call(m))==null?void 0:g[0])||m.target,x=(v==null?void 0:v.nodeName)==="BUTTON"||(v==null?void 0:v.nodeName)==="A";t.preventDefault!==!1&&(s.current||!x)&&m.preventDefault(),r(!0)}},u=m=>{const y=yN(m.code,l);gN(a,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(m[y]),m.key==="Meta"&&i.current.clear(),s.current=!1},p=()=>{i.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",f),c==null||c.addEventListener("keyup",u),window.addEventListener("blur",p),window.addEventListener("contextmenu",p),()=>{c==null||c.removeEventListener("keydown",f),c==null||c.removeEventListener("keyup",u),window.removeEventListener("blur",p),window.removeEventListener("contextmenu",p)}}},[e,r]),n}function gN(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function yN(e,t){return t.includes(e)?"code":"key"}const Z5=()=>{const e=Hn();return h.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,s,i],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??r,y:t.y??s,zoom:t.zoom??i},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:s,minZoom:i,maxZoom:a,panZoom:l}=e.getState(),c=e0(t,r,s,i,a,(n==null?void 0:n.padding)??.1);return l?(await l.setViewport(c,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:s,snapToGrid:i,domNode:a}=e.getState();if(!a)return t;const{x:l,y:c}=a.getBoundingClientRect(),d={x:t.x-l,y:t.y-c},f=n.snapGrid??s,u=n.snapToGrid??i;return xp(d,r,u,f)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:s,y:i}=r.getBoundingClientRect(),a=eg(t,n);return{x:a.x+s,y:a.y+i}}}),[])};function IA(e,t){const n=[],r=new Map,s=[];for(const i of e)if(i.type==="add"){s.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const a=r.get(i.id);a?a.push(i):r.set(i.id,[i])}for(const i of t){const a=r.get(i.id);if(!a){n.push(i);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){n.push({...a[0].item});continue}const l={...i};for(const c of a)eH(c,l);n.push(l)}return s.length&&s.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function eH(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 tg(e,t){return IA(e,t)}function a0(e,t){return IA(e,t)}function Ul(e,t){return{id:e,type:"select",selected:t}}function ou(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(Ul(i.id,a)))}return r}function xN({items:e=[],lookup:t}){var s;const n=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,a]of e.entries()){const l=t.get(a.id),c=((s=l==null?void 0:l.internals)==null?void 0:s.userNode)??l;c!==void 0&&c!==a&&n.push({id:a.id,item:a,type:"replace"}),c===void 0&&n.push({item:a,type:"add",index:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function wN(e){return{id:e.id,type:"remove"}}const bN=e=>f3(e),tH=e=>XP(e);function TA(e){return h.forwardRef(e)}function vN(e){const[t,n]=h.useState(BigInt(0)),[r]=h.useState(()=>nH(()=>n(s=>s+BigInt(1))));return mb(()=>{const s=r.get();s.length&&(e(s),r.reset())},[t]),r}function nH(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const RA=h.createContext(null);function rH({children:e}){const t=Hn(),n=h.useCallback(l=>{const{nodes:c=[],setNodes:d,hasDefaultNodes:f,onNodesChange:u,nodeLookup:p,fitViewQueued:m,onNodesChangeMiddlewareMap:y}=t.getState();let b=c;for(const g of l)b=typeof g=="function"?g(b):g;let k=xN({items:b,lookup:p});for(const g of y.values())k=g(k);f&&d(b),k.length>0?u==null||u(k):m&&window.requestAnimationFrame(()=>{const{fitViewQueued:g,nodes:v,setNodes:x}=t.getState();g&&x(v)})},[]),r=vN(n),s=h.useCallback(l=>{const{edges:c=[],setEdges:d,hasDefaultEdges:f,onEdgesChange:u,edgeLookup:p}=t.getState();let m=c;for(const y of l)m=typeof y=="function"?y(m):y;f?d(m):u&&u(xN({items:m,lookup:p}))},[]),i=vN(s),a=h.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return o.jsx(RA.Provider,{value:a,children:e})}function sH(){const e=h.useContext(RA);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const iH=e=>!!e.panZoom;function wc(){const e=Z5(),t=Hn(),n=sH(),r=Vt(iH),s=h.useMemo(()=>{const i=u=>t.getState().nodeLookup.get(u),a=u=>{n.nodeQueue.push(u)},l=u=>{n.edgeQueue.push(u)},c=u=>{var g,v;const{nodeLookup:p,nodeOrigin:m}=t.getState(),y=bN(u)?u:p.get(u.id),b=y.parentId?nA(y.position,y.measured,y.parentId,p,m):y.position,k={...y,position:b,width:((g=y.measured)==null?void 0:g.width)??y.width,height:((v=y.measured)==null?void 0:v.height)??y.height};return Ru(k)},d=(u,p,m={replace:!1})=>{a(y=>y.map(b=>{if(b.id===u){const k=typeof p=="function"?p(b):p;return m.replace&&bN(k)?k:{...b,...k}}return b}))},f=(u,p,m={replace:!1})=>{l(y=>y.map(b=>{if(b.id===u){const k=typeof p=="function"?p(b):p;return m.replace&&tH(k)?k:{...b,...k}}return b}))};return{getNodes:()=>t.getState().nodes.map(u=>({...u})),getNode:u=>{var p;return(p=i(u))==null?void 0:p.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:u=[]}=t.getState();return u.map(p=>({...p}))},getEdge:u=>t.getState().edgeLookup.get(u),setNodes:a,setEdges:l,addNodes:u=>{const p=Array.isArray(u)?u:[u];n.nodeQueue.push(m=>[...m,...p])},addEdges:u=>{const p=Array.isArray(u)?u:[u];n.edgeQueue.push(m=>[...m,...p])},toObject:()=>{const{nodes:u=[],edges:p=[],transform:m}=t.getState(),[y,b,k]=m;return{nodes:u.map(g=>({...g})),edges:p.map(g=>({...g})),viewport:{x:y,y:b,zoom:k}}},deleteElements:async({nodes:u=[],edges:p=[]})=>{const{nodes:m,edges:y,onNodesDelete:b,onEdgesDelete:k,triggerNodeChanges:g,triggerEdgeChanges:v,onDelete:x,onBeforeDelete:N}=t.getState(),{nodes:_,edges:C}=await y3({nodesToRemove:u,edgesToRemove:p,nodes:m,edges:y,onBeforeDelete:N}),T=C.length>0,H=_.length>0;if(T){const M=C.map(wN);k==null||k(C),v(M)}if(H){const M=_.map(wN);b==null||b(_),g(M)}return(H||T)&&(x==null||x({nodes:_,edges:C})),{deletedNodes:_,deletedEdges:C}},getIntersectingNodes:(u,p=!0,m)=>{const y=XS(u),b=y?u:c(u),k=m!==void 0;return b?(m||t.getState().nodes).filter(g=>{const v=t.getState().nodeLookup.get(g.id);if(v&&!y&&(g.id===u.id||!v.internals.positionAbsolute))return!1;const x=Ru(k?g:v),N=Uf(x,b);return p&&N>0||N>=x.width*x.height||N>=b.width*b.height}):[]},isNodeIntersecting:(u,p,m=!0)=>{const b=XS(u)?u:c(u);if(!b)return!1;const k=Uf(b,p);return m&&k>0||k>=p.width*p.height||k>=b.width*b.height},updateNode:d,updateNodeData:(u,p,m={replace:!1})=>{d(u,y=>{const b=typeof p=="function"?p(y):p;return m.replace?{...y,data:b}:{...y,data:{...y.data,...b}}},m)},updateEdge:f,updateEdgeData:(u,p,m={replace:!1})=>{f(u,y=>{const b=typeof p=="function"?p(y):p;return m.replace?{...y,data:b}:{...y,data:{...y.data,...b}}},m)},getNodesBounds:u=>{const{nodeLookup:p,nodeOrigin:m}=t.getState();return p3(u,{nodeLookup:p,nodeOrigin:m})},getHandleConnections:({type:u,id:p,nodeId:m})=>{var y;return Array.from(((y=t.getState().connectionLookup.get(`${m}-${u}${p?`-${p}`:""}`))==null?void 0:y.values())??[])},getNodeConnections:({type:u,handleId:p,nodeId:m})=>{var y;return Array.from(((y=t.getState().connectionLookup.get(`${m}${u?p?`-${u}-${p}`:`-${u}`:""}`))==null?void 0:y.values())??[])},fitView:async u=>{const p=t.getState().fitViewResolver??v3();return t.setState({fitViewQueued:!0,fitViewOptions:u,fitViewResolver:p}),n.nodeQueue.push(m=>[...m]),p.promise}}},[]);return h.useMemo(()=>({...s,...e,viewportInitialized:r}),[r])}const kN=e=>e.selected,oH=typeof window<"u"?window:void 0;function aH({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=Hn(),{deleteElements:r}=wc(),s=Yf(e,{actInsideInputWithModifier:!1}),i=Yf(t,{target:oH});h.useEffect(()=>{if(s){const{edges:a,nodes:l}=n.getState();r({nodes:l.filter(kN),edges:a.filter(kN)}),n.setState({nodesSelectionActive:!1})}},[s]),h.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function lH(e){const t=Hn();h.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=t0(e.current);(r.height===0||r.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",Io.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 ny={position:"absolute",width:"100%",height:"100%",top:0,left:0},cH=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function uH({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:i=nc.Free,zoomOnDoubleClick:a=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:d,minZoom:f,maxZoom:u,zoomActivationKeyCode:p,preventScrolling:m=!0,children:y,noWheelClassName:b,noPanClassName:k,onViewportChange:g,isControlledViewport:v,paneClickDistance:x,selectionOnDrag:N}){const _=Hn(),C=h.useRef(null),{userSelectionActive:T,lib:H,connectionInProgress:M}=Vt(cH,Yn),F=Yf(p),D=h.useRef();lH(C);const $=h.useCallback(W=>{g==null||g({x:W[0],y:W[1],zoom:W[2]}),v||_.setState({transform:W})},[g,v]);return h.useEffect(()=>{if(C.current){D.current=r5({domNode:C.current,minZoom:f,maxZoom:u,translateExtent:d,viewport:c,onDraggingChange:I=>_.setState(z=>z.paneDragging===I?z:{paneDragging:I}),onPanZoomStart:(I,z)=>{const{onViewportChangeStart:P,onMoveStart:L}=_.getState();L==null||L(I,z),P==null||P(z)},onPanZoom:(I,z)=>{const{onViewportChange:P,onMove:L}=_.getState();L==null||L(I,z),P==null||P(z)},onPanZoomEnd:(I,z)=>{const{onViewportChangeEnd:P,onMoveEnd:L}=_.getState();L==null||L(I,z),P==null||P(z)}});const{x:W,y:O,zoom:R}=D.current.getViewport();return _.setState({panZoom:D.current,transform:[W,O,R],domNode:C.current.closest(".react-flow")}),()=>{var I;(I=D.current)==null||I.destroy()}}},[]),h.useEffect(()=>{var W;(W=D.current)==null||W.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:i,zoomOnDoubleClick:a,panOnDrag:l,zoomActivationKeyPressed:F,preventScrolling:m,noPanClassName:k,userSelectionActive:T,noWheelClassName:b,lib:H,onTransformChange:$,connectionInProgress:M,selectionOnDrag:N,paneClickDistance:x})},[e,t,n,r,s,i,a,l,F,m,k,T,b,H,$,M,N,x]),o.jsx("div",{className:"react-flow__renderer",ref:C,style:ny,children:y})}const dH=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function fH(){const{userSelectionActive:e,userSelectionRect:t}=Vt(dH,Yn);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 yx=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},pH=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function hH({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Vf.Full,panOnDrag:r,paneClickDistance:s,selectionOnDrag:i,onSelectionStart:a,onSelectionEnd:l,onPaneClick:c,onPaneContextMenu:d,onPaneScroll:f,onPaneMouseEnter:u,onPaneMouseMove:p,onPaneMouseLeave:m,children:y}){const b=Hn(),{userSelectionActive:k,elementsSelectable:g,dragging:v,connectionInProgress:x}=Vt(pH,Yn),N=g&&(e||k),_=h.useRef(null),C=h.useRef(),T=h.useRef(new Set),H=h.useRef(new Set),M=h.useRef(!1),F=P=>{if(M.current||x){M.current=!1;return}c==null||c(P),b.getState().resetSelectedElements(),b.setState({nodesSelectionActive:!1})},D=P=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){P.preventDefault();return}d==null||d(P)},$=f?P=>f(P):void 0,W=P=>{M.current&&(P.stopPropagation(),M.current=!1)},O=P=>{var fe,me;const{domNode:L}=b.getState();if(C.current=L==null?void 0:L.getBoundingClientRect(),!C.current)return;const E=P.target===_.current;if(!E&&!!P.target.closest(".nokey")||!e||!(i&&E||t)||P.button!==0||!P.isPrimary)return;(me=(fe=P.target)==null?void 0:fe.setPointerCapture)==null||me.call(fe,P.pointerId),M.current=!1;const{x:V,y:ie}=Xi(P.nativeEvent,C.current);b.setState({userSelectionRect:{width:0,height:0,startX:V,startY:ie,x:V,y:ie}}),E||(P.stopPropagation(),P.preventDefault())},R=P=>{const{userSelectionRect:L,transform:E,nodeLookup:X,edgeLookup:ee,connectionLookup:V,triggerNodeChanges:ie,triggerEdgeChanges:fe,defaultEdgeOptions:me,resetSelectedElements:ge}=b.getState();if(!C.current||!L)return;const{x:Z,y:ae}=Xi(P.nativeEvent,C.current),{startX:xe,startY:pe}=L;if(!M.current){const qe=t?0:s;if(Math.hypot(Z-xe,ae-pe)<=qe)return;ge(),a==null||a(P)}M.current=!0;const _e={startX:xe,startY:pe,x:Z<xe?Z:xe,y:ae<pe?ae:pe,width:Math.abs(Z-xe),height:Math.abs(ae-pe)},je=T.current,Ve=H.current;T.current=new Set(Zv(X,_e,E,n===Vf.Partial,!0).map(qe=>qe.id)),H.current=new Set;const et=(me==null?void 0:me.selectable)??!0;for(const qe of T.current){const dt=V.get(qe);if(dt)for(const{edgeId:He}of dt.values()){const bt=ee.get(He);bt&&(bt.selectable??et)&&H.current.add(He)}}if(!JS(je,T.current)){const qe=ou(X,T.current,!0);ie(qe)}if(!JS(Ve,H.current)){const qe=ou(ee,H.current);fe(qe)}b.setState({userSelectionRect:_e,userSelectionActive:!0,nodesSelectionActive:!1})},I=P=>{var L,E;P.button===0&&((E=(L=P.target)==null?void 0:L.releasePointerCapture)==null||E.call(L,P.pointerId),!k&&P.target===_.current&&b.getState().userSelectionRect&&(F==null||F(P)),b.setState({userSelectionActive:!1,userSelectionRect:null}),M.current&&(l==null||l(P),b.setState({nodesSelectionActive:T.current.size>0})))},z=r===!0||Array.isArray(r)&&r.includes(0);return o.jsxs("div",{className:br(["react-flow__pane",{draggable:z,dragging:v,selection:e}]),onClick:N?void 0:yx(F,_),onContextMenu:yx(D,_),onWheel:yx($,_),onPointerEnter:N?void 0:u,onPointerMove:N?R:p,onPointerUp:N?I:void 0,onPointerDownCapture:N?O:void 0,onClickCapture:N?W:void 0,onPointerLeave:m,ref:_,style:ny,children:[y,o.jsx(fH,{})]})}function gb({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:a,nodeLookup:l,onError:c}=t.getState(),d=l.get(e);if(!d){c==null||c("012",Io.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 LA({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,nodeClickDistance:a}){const l=Hn(),[c,d]=h.useState(!1),f=h.useRef();return h.useEffect(()=>{f.current=W3({getStoreItems:()=>l.getState(),onNodeMouseDown:u=>{gb({id:u,store:l,nodeRef:e})},onDragStart:()=>{d(!0)},onDragStop:()=>{d(!1)}})},[]),h.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 u;(u=f.current)==null||u.destroy()}},[n,r,t,i,e,s,a]),c}const mH=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function MA(){const e=Hn();return h.useCallback(n=>{const{nodeExtent:r,snapToGrid:s,snapGrid:i,nodesDraggable:a,onError:l,updateNodePositions:c,nodeLookup:d,nodeOrigin:f}=e.getState(),u=new Map,p=mH(a),m=s?i[0]:5,y=s?i[1]:5,b=n.direction.x*m*n.factor,k=n.direction.y*y*n.factor;for(const[,g]of d){if(!p(g))continue;let v={x:g.internals.positionAbsolute.x+b,y:g.internals.positionAbsolute.y+k};s&&(v=yp(v,i));const{position:x,positionAbsolute:N}=JP({nodeId:g.id,nextPosition:v,nodeLookup:d,nodeExtent:r,nodeOrigin:f,onError:l});g.position=x,g.internals.positionAbsolute=N,u.set(g.id,g)}c(u)},[])}const l0=h.createContext(null),gH=l0.Provider;l0.Consumer;const OA=()=>h.useContext(l0),yH=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),xH=(e,t,n)=>r=>{const{connectionClickStartHandle:s,connectionMode:i,connection:a}=r,{fromHandle:l,toHandle:c,isValid:d}=a,f=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===t&&(l==null?void 0:l.type)===n,connectingTo:f,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===n,isPossibleEndHandle:i===Iu.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 wH({type:e="source",position:t=Ze.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:a,onConnect:l,children:c,className:d,onMouseDown:f,onTouchStart:u,...p},m){var R,I;const y=a||null,b=e==="target",k=Hn(),g=OA(),{connectOnClick:v,noPanClassName:x,rfId:N}=Vt(yH,Yn),{connectingFrom:_,connectingTo:C,clickConnecting:T,isPossibleEndHandle:H,connectionInProcess:M,clickConnectionInProcess:F,valid:D}=Vt(xH(g,y,e),Yn);g||(I=(R=k.getState()).onError)==null||I.call(R,"010",Io.error010());const $=z=>{const{defaultEdgeOptions:P,onConnect:L,hasDefaultEdges:E}=k.getState(),X={...P,...z};if(E){const{edges:ee,setEdges:V}=k.getState();V(qf(X,ee))}L==null||L(X),l==null||l(X)},W=z=>{if(!g)return;const P=iA(z.nativeEvent);if(s&&(P&&z.button===0||!P)){const L=k.getState();hb.onPointerDown(z.nativeEvent,{handleDomNode:z.currentTarget,autoPanOnConnect:L.autoPanOnConnect,connectionMode:L.connectionMode,connectionRadius:L.connectionRadius,domNode:L.domNode,nodeLookup:L.nodeLookup,lib:L.lib,isTarget:b,handleId:y,nodeId:g,flowId:L.rfId,panBy:L.panBy,cancelConnection:L.cancelConnection,onConnectStart:L.onConnectStart,onConnectEnd:(...E)=>{var X,ee;return(ee=(X=k.getState()).onConnectEnd)==null?void 0:ee.call(X,...E)},updateConnection:L.updateConnection,onConnect:$,isValidConnection:n||((...E)=>{var X,ee;return((ee=(X=k.getState()).isValidConnection)==null?void 0:ee.call(X,...E))??!0}),getTransform:()=>k.getState().transform,getFromHandle:()=>k.getState().connection.fromHandle,autoPanSpeed:L.autoPanSpeed,dragThreshold:L.connectionDragThreshold})}P?f==null||f(z):u==null||u(z)},O=z=>{const{onClickConnectStart:P,onClickConnectEnd:L,connectionClickStartHandle:E,connectionMode:X,isValidConnection:ee,lib:V,rfId:ie,nodeLookup:fe,connection:me}=k.getState();if(!g||!E&&!s)return;if(!E){P==null||P(z.nativeEvent,{nodeId:g,handleId:y,handleType:e}),k.setState({connectionClickStartHandle:{nodeId:g,type:e,id:y}});return}const ge=rA(z.target),Z=n||ee,{connection:ae,isValid:xe}=hb.isValid(z.nativeEvent,{handle:{nodeId:g,id:y,type:e},connectionMode:X,fromNodeId:E.nodeId,fromHandleId:E.id||null,fromType:E.type,isValidConnection:Z,flowId:ie,doc:ge,lib:V,nodeLookup:fe});xe&&ae&&$(ae);const pe=structuredClone(me);delete pe.inProgress,pe.toPosition=pe.toHandle?pe.toHandle.position:null,L==null||L(z,pe),k.setState({connectionClickStartHandle:null})};return o.jsx("div",{"data-handleid":y,"data-nodeid":g,"data-handlepos":t,"data-id":`${N}-${g}-${y}-${e}`,className:br(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",x,d,{source:!b,target:b,connectable:r,connectablestart:s,connectableend:i,clickconnecting:T,connectingfrom:_,connectingto:C,valid:D,connectionindicator:r&&(!M||H)&&(M||F?i:s)}]),onMouseDown:W,onTouchStart:W,onClick:v?O:void 0,ref:m,...p,children:c})}const Fs=h.memo(TA(wH));function bH({data:e,isConnectable:t,sourcePosition:n=Ze.Bottom}){return o.jsxs(o.Fragment,{children:[e==null?void 0:e.label,o.jsx(Fs,{type:"source",position:n,isConnectable:t})]})}function vH({data:e,isConnectable:t,targetPosition:n=Ze.Top,sourcePosition:r=Ze.Bottom}){return o.jsxs(o.Fragment,{children:[o.jsx(Fs,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,o.jsx(Fs,{type:"source",position:r,isConnectable:t})]})}function kH(){return null}function SH({data:e,isConnectable:t,targetPosition:n=Ze.Top}){return o.jsxs(o.Fragment,{children:[o.jsx(Fs,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const ng={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},SN={input:bH,default:vH,output:SH,group:kH};function NH(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 jH=e=>{const{width:t,height:n,x:r,y:s}=gp(e.nodeLookup,{filter:i=>!!i.selected});return{width:Gi(t)?t:null,height:Gi(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 CH({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Hn(),{width:s,height:i,transformString:a,userSelectionActive:l}=Vt(jH,Yn),c=MA(),d=h.useRef(null);h.useEffect(()=>{var m;n||(m=d.current)==null||m.focus({preventScroll:!0})},[n]);const f=!l&&s!==null&&i!==null;if(LA({nodeRef:d,disabled:!f}),!f)return null;const u=e?m=>{const y=r.getState().nodes.filter(b=>b.selected);e(m,y)}:void 0,p=m=>{Object.prototype.hasOwnProperty.call(ng,m.key)&&(m.preventDefault(),c({direction:ng[m.key],factor:m.shiftKey?4:1}))};return o.jsx("div",{className:br(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:o.jsx("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:u,tabIndex:n?void 0:-1,onKeyDown:n?void 0:p,style:{width:s,height:i}})})}const NN=typeof window<"u"?window:void 0,EH=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function $A({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,paneClickDistance:l,deleteKeyCode:c,selectionKeyCode:d,selectionOnDrag:f,selectionMode:u,onSelectionStart:p,onSelectionEnd:m,multiSelectionKeyCode:y,panActivationKeyCode:b,zoomActivationKeyCode:k,elementsSelectable:g,zoomOnScroll:v,zoomOnPinch:x,panOnScroll:N,panOnScrollSpeed:_,panOnScrollMode:C,zoomOnDoubleClick:T,panOnDrag:H,defaultViewport:M,translateExtent:F,minZoom:D,maxZoom:$,preventScrolling:W,onSelectionContextMenu:O,noWheelClassName:R,noPanClassName:I,disableKeyboardA11y:z,onViewportChange:P,isControlledViewport:L}){const{nodesSelectionActive:E,userSelectionActive:X}=Vt(EH,Yn),ee=Yf(d,{target:NN}),V=Yf(b,{target:NN}),ie=V||H,fe=V||N,me=f&&ie!==!0,ge=ee||X||me;return aH({deleteKeyCode:c,multiSelectionKeyCode:y}),o.jsx(uH,{onPaneContextMenu:i,elementsSelectable:g,zoomOnScroll:v,zoomOnPinch:x,panOnScroll:fe,panOnScrollSpeed:_,panOnScrollMode:C,zoomOnDoubleClick:T,panOnDrag:!ee&&ie,defaultViewport:M,translateExtent:F,minZoom:D,maxZoom:$,zoomActivationKeyCode:k,preventScrolling:W,noWheelClassName:R,noPanClassName:I,onViewportChange:P,isControlledViewport:L,paneClickDistance:l,selectionOnDrag:me,children:o.jsxs(hH,{onSelectionStart:p,onSelectionEnd:m,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,panOnDrag:ie,isSelecting:!!ge,selectionMode:u,selectionKeyPressed:ee,paneClickDistance:l,selectionOnDrag:me,children:[e,E&&o.jsx(CH,{onSelectionContextMenu:O,noPanClassName:I,disableKeyboardA11y:z})]})})}$A.displayName="FlowRenderer";const _H=h.memo($A),PH=e=>t=>e?Zv(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 AH(e){return Vt(h.useCallback(PH(e),[e]),Yn)}const IH=e=>e.updateNodeInternals;function TH(){const e=Vt(IH),[t]=h.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 h.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function RH({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const s=Hn(),i=h.useRef(null),a=h.useRef(null),l=h.useRef(e.sourcePosition),c=h.useRef(e.targetPosition),d=h.useRef(t),f=n&&!!e.internals.handleBounds;return h.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]),h.useEffect(()=>()=>{a.current&&(r==null||r.unobserve(a.current),a.current=null)},[]),h.useEffect(()=>{if(i.current){const u=d.current!==t,p=l.current!==e.sourcePosition,m=c.current!==e.targetPosition;(u||p||m)&&(d.current=t,l.current=e.sourcePosition,c.current=e.targetPosition,s.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function LH({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:s,onContextMenu:i,onDoubleClick:a,nodesDraggable:l,elementsSelectable:c,nodesConnectable:d,nodesFocusable:f,resizeObserver:u,noDragClassName:p,noPanClassName:m,disableKeyboardA11y:y,rfId:b,nodeTypes:k,nodeClickDistance:g,onError:v}){const{node:x,internals:N,isParent:_}=Vt(Z=>{const ae=Z.nodeLookup.get(e),xe=Z.parentLookup.has(e);return{node:ae,internals:ae.internals,isParent:xe}},Yn);let C=x.type||"default",T=(k==null?void 0:k[C])||SN[C];T===void 0&&(v==null||v("003",Io.error003(C)),C="default",T=(k==null?void 0:k.default)||SN.default);const H=!!(x.draggable||l&&typeof x.draggable>"u"),M=!!(x.selectable||c&&typeof x.selectable>"u"),F=!!(x.connectable||d&&typeof x.connectable>"u"),D=!!(x.focusable||f&&typeof x.focusable>"u"),$=Hn(),W=tA(x),O=RH({node:x,nodeType:C,hasDimensions:W,resizeObserver:u}),R=LA({nodeRef:O,disabled:x.hidden||!H,noDragClassName:p,handleSelector:x.dragHandle,nodeId:e,isSelectable:M,nodeClickDistance:g}),I=MA();if(x.hidden)return null;const z=ga(x),P=NH(x),L=M||H||t||n||r||s,E=n?Z=>n(Z,{...N.userNode}):void 0,X=r?Z=>r(Z,{...N.userNode}):void 0,ee=s?Z=>s(Z,{...N.userNode}):void 0,V=i?Z=>i(Z,{...N.userNode}):void 0,ie=a?Z=>a(Z,{...N.userNode}):void 0,fe=Z=>{const{selectNodesOnDrag:ae,nodeDragThreshold:xe}=$.getState();M&&(!ae||!H||xe>0)&&gb({id:e,store:$,nodeRef:O}),t&&t(Z,{...N.userNode})},me=Z=>{if(!(sA(Z.nativeEvent)||y)){if(KP.includes(Z.key)&&M){const ae=Z.key==="Escape";gb({id:e,store:$,unselect:ae,nodeRef:O})}else if(H&&x.selected&&Object.prototype.hasOwnProperty.call(ng,Z.key)){Z.preventDefault();const{ariaLabelConfig:ae}=$.getState();$.setState({ariaLiveMessage:ae["node.a11yDescription.ariaLiveMessage"]({direction:Z.key.replace("Arrow","").toLowerCase(),x:~~N.positionAbsolute.x,y:~~N.positionAbsolute.y})}),I({direction:ng[Z.key],factor:Z.shiftKey?4:1})}}},ge=()=>{var Ve;if(y||!((Ve=O.current)!=null&&Ve.matches(":focus-visible")))return;const{transform:Z,width:ae,height:xe,autoPanOnNodeFocus:pe,setCenter:_e}=$.getState();if(!pe)return;Zv(new Map([[e,x]]),{x:0,y:0,width:ae,height:xe},Z,!0).length>0||_e(x.position.x+z.width/2,x.position.y+z.height/2,{zoom:Z[2]})};return o.jsx("div",{className:br(["react-flow__node",`react-flow__node-${C}`,{[m]:H},x.className,{selected:x.selected,selectable:M,parent:_,draggable:H,dragging:R}]),ref:O,style:{zIndex:N.z,transform:`translate(${N.positionAbsolute.x}px,${N.positionAbsolute.y}px)`,pointerEvents:L?"all":"none",visibility:W?"visible":"hidden",...x.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:E,onMouseMove:X,onMouseLeave:ee,onContextMenu:V,onClick:fe,onDoubleClick:ie,onKeyDown:D?me:void 0,tabIndex:D?0:void 0,onFocus:D?ge:void 0,role:x.ariaRole??(D?"group":void 0),"aria-roledescription":"node","aria-describedby":y?void 0:`${_A}-${b}`,"aria-label":x.ariaLabel,...x.domAttributes,children:o.jsx(gH,{value:e,children:o.jsx(T,{id:e,data:x.data,type:C,positionAbsoluteX:N.positionAbsolute.x,positionAbsoluteY:N.positionAbsolute.y,selected:x.selected??!1,selectable:M,draggable:H,deletable:x.deletable??!0,isConnectable:F,sourcePosition:x.sourcePosition,targetPosition:x.targetPosition,dragging:R,dragHandle:x.dragHandle,zIndex:N.z,parentId:x.parentId,...z})})})}var MH=h.memo(LH);const OH=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function DA(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,onError:i}=Vt(OH,Yn),a=AH(e.onlyRenderVisibleElements),l=TH();return o.jsx("div",{className:"react-flow__nodes",style:ny,children:a.map(c=>o.jsx(MH,{id:c,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:l,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,nodeClickDistance:e.nodeClickDistance,onError:i},c))})}DA.displayName="NodeRenderer";const $H=h.memo(DA);function DH(e){return Vt(h.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&&j3({sourceNode:i,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[e]),Yn)}const FH=({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"})},zH=({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"})},jN={[$s.Arrow]:FH,[$s.ArrowClosed]:zH};function HH(e){const t=Hn();return h.useMemo(()=>{var s,i;return Object.prototype.hasOwnProperty.call(jN,e)?jN[e]:((i=(s=t.getState()).onError)==null||i.call(s,"009",Io.error009(e)),null)},[e])}const BH=({id:e,type:t,color:n,width:r=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:a,orient:l="auto-start-reverse"})=>{const c=HH(t);return c?o.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:l,refX:"0",refY:"0",children:o.jsx(c,{color:n,strokeWidth:a})}):null},FA=({defaultColor:e,rfId:t})=>{const n=Vt(i=>i.edges),r=Vt(i=>i.defaultEdgeOptions),s=h.useMemo(()=>T3(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(BH,{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};FA.displayName="MarkerDefinitions";var WH=h.memo(FA);function zA({x:e,y:t,label:n,labelStyle:r,labelShowBg:s=!0,labelBgStyle:i,labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:c,className:d,...f}){const[u,p]=h.useState({x:1,y:0,width:0,height:0}),m=br(["react-flow__edge-textwrapper",d]),y=h.useRef(null);return h.useEffect(()=>{if(y.current){const b=y.current.getBBox();p({x:b.x,y:b.y,width:b.width,height:b.height})}},[n]),n?o.jsxs("g",{transform:`translate(${e-u.width/2} ${t-u.height/2})`,className:m,visibility:u.width?"visible":"hidden",...f,children:[s&&o.jsx("rect",{width:u.width+2*a[0],x:-a[0],y:-a[1],height:u.height+2*a[1],className:"react-flow__edge-textbg",style:i,rx:l,ry:l}),o.jsx("text",{className:"react-flow__edge-text",y:u.height/2,dy:"0.3em",ref:y,style:r,children:n}),c]}):null}zA.displayName="EdgeText";const VH=h.memo(zA);function ry({path:e,labelX:t,labelY:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,interactionWidth:d=20,...f}){return o.jsxs(o.Fragment,{children:[o.jsx("path",{...f,d:e,fill:"none",className:br(["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&&Gi(t)&&Gi(n)?o.jsx(VH,{x:t,y:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function CN({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===Ze.Left||e===Ze.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function HA({sourceX:e,sourceY:t,sourcePosition:n=Ze.Bottom,targetX:r,targetY:s,targetPosition:i=Ze.Top}){const[a,l]=CN({pos:n,x1:e,y1:t,x2:r,y2:s}),[c,d]=CN({pos:i,x1:r,y1:s,x2:e,y2:t}),[f,u,p,m]=oA({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:d});return[`M${e},${t} C${a},${l} ${c},${d} ${r},${s}`,f,u,p,m]}function BA(e){return h.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:a,targetPosition:l,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:m,style:y,markerEnd:b,markerStart:k,interactionWidth:g})=>{const[v,x,N]=HA({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:l}),_=e.isInternal?void 0:t;return o.jsx(ry,{id:_,path:v,labelX:x,labelY:N,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:m,style:y,markerEnd:b,markerStart:k,interactionWidth:g})})}const UH=BA({isInternal:!1}),WA=BA({isInternal:!0});UH.displayName="SimpleBezierEdge";WA.displayName="SimpleBezierEdgeInternal";function VA(e){return h.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:u,style:p,sourcePosition:m=Ze.Bottom,targetPosition:y=Ze.Top,markerEnd:b,markerStart:k,pathOptions:g,interactionWidth:v})=>{const[x,N,_]=db({sourceX:n,sourceY:r,sourcePosition:m,targetX:s,targetY:i,targetPosition:y,borderRadius:g==null?void 0:g.borderRadius,offset:g==null?void 0:g.offset,stepPosition:g==null?void 0:g.stepPosition}),C=e.isInternal?void 0:t;return o.jsx(ry,{id:C,path:x,labelX:N,labelY:_,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:u,style:p,markerEnd:b,markerStart:k,interactionWidth:v})})}const UA=VA({isInternal:!1}),KA=VA({isInternal:!0});UA.displayName="SmoothStepEdge";KA.displayName="SmoothStepEdgeInternal";function qA(e){return h.memo(({id:t,...n})=>{var s;const r=e.isInternal?void 0:t;return o.jsx(UA,{...n,id:r,pathOptions:h.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(s=n.pathOptions)==null?void 0:s.offset])})})}const KH=qA({isInternal:!1}),YA=qA({isInternal:!0});KH.displayName="StepEdge";YA.displayName="StepEdgeInternal";function GA(e){return h.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:u,style:p,markerEnd:m,markerStart:y,interactionWidth:b})=>{const[k,g,v]=cA({sourceX:n,sourceY:r,targetX:s,targetY:i}),x=e.isInternal?void 0:t;return o.jsx(ry,{id:x,path:k,labelX:g,labelY:v,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:u,style:p,markerEnd:m,markerStart:y,interactionWidth:b})})}const qH=GA({isInternal:!1}),XA=GA({isInternal:!0});qH.displayName="StraightEdge";XA.displayName="StraightEdgeInternal";function JA(e){return h.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:a=Ze.Bottom,targetPosition:l=Ze.Top,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:m,style:y,markerEnd:b,markerStart:k,pathOptions:g,interactionWidth:v})=>{const[x,N,_]=aA({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:l,curvature:g==null?void 0:g.curvature}),C=e.isInternal?void 0:t;return o.jsx(ry,{id:C,path:x,labelX:N,labelY:_,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:m,style:y,markerEnd:b,markerStart:k,interactionWidth:v})})}const YH=JA({isInternal:!1}),QA=JA({isInternal:!0});YH.displayName="BezierEdge";QA.displayName="BezierEdgeInternal";const EN={default:QA,straight:XA,step:YA,smoothstep:KA,simplebezier:WA},_N={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},GH=(e,t,n)=>n===Ze.Left?e-t:n===Ze.Right?e+t:e,XH=(e,t,n)=>n===Ze.Top?e-t:n===Ze.Bottom?e+t:e,PN="react-flow__edgeupdater";function AN({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:br([PN,`${PN}-${l}`]),cx:GH(t,r,e),cy:XH(n,r,e),r,stroke:"transparent",fill:"transparent"})}function JH({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:s,targetX:i,targetY:a,sourcePosition:l,targetPosition:c,onReconnect:d,onReconnectStart:f,onReconnectEnd:u,setReconnecting:p,setUpdateHover:m}){const y=Hn(),b=(N,_)=>{if(N.button!==0)return;const{autoPanOnConnect:C,domNode:T,connectionMode:H,connectionRadius:M,lib:F,onConnectStart:D,cancelConnection:$,nodeLookup:W,rfId:O,panBy:R,updateConnection:I}=y.getState(),z=_.type==="target",P=(X,ee)=>{p(!1),u==null||u(X,n,_.type,ee)},L=X=>d==null?void 0:d(n,X),E=(X,ee)=>{p(!0),f==null||f(N,n,_.type),D==null||D(X,ee)};hb.onPointerDown(N.nativeEvent,{autoPanOnConnect:C,connectionMode:H,connectionRadius:M,domNode:T,handleId:_.id,nodeId:_.nodeId,nodeLookup:W,isTarget:z,edgeUpdaterType:_.type,lib:F,flowId:O,cancelConnection:$,panBy:R,isValidConnection:(...X)=>{var ee,V;return((V=(ee=y.getState()).isValidConnection)==null?void 0:V.call(ee,...X))??!0},onConnect:L,onConnectStart:E,onConnectEnd:(...X)=>{var ee,V;return(V=(ee=y.getState()).onConnectEnd)==null?void 0:V.call(ee,...X)},onReconnectEnd:P,updateConnection:I,getTransform:()=>y.getState().transform,getFromHandle:()=>y.getState().connection.fromHandle,dragThreshold:y.getState().connectionDragThreshold,handleDomNode:N.currentTarget})},k=N=>b(N,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),g=N=>b(N,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),v=()=>m(!0),x=()=>m(!1);return o.jsxs(o.Fragment,{children:[(e===!0||e==="source")&&o.jsx(AN,{position:l,centerX:r,centerY:s,radius:t,onMouseDown:k,onMouseEnter:v,onMouseOut:x,type:"source"}),(e===!0||e==="target")&&o.jsx(AN,{position:c,centerX:i,centerY:a,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:x,type:"target"})]})}function QH({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:s,onDoubleClick:i,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:d,reconnectRadius:f,onReconnect:u,onReconnectStart:p,onReconnectEnd:m,rfId:y,edgeTypes:b,noPanClassName:k,onError:g,disableKeyboardA11y:v}){let x=Vt(_e=>_e.edgeLookup.get(e));const N=Vt(_e=>_e.defaultEdgeOptions);x=N?{...N,...x}:x;let _=x.type||"default",C=(b==null?void 0:b[_])||EN[_];C===void 0&&(g==null||g("011",Io.error011(_)),_="default",C=(b==null?void 0:b.default)||EN.default);const T=!!(x.focusable||t&&typeof x.focusable>"u"),H=typeof u<"u"&&(x.reconnectable||n&&typeof x.reconnectable>"u"),M=!!(x.selectable||r&&typeof x.selectable>"u"),F=h.useRef(null),[D,$]=h.useState(!1),[W,O]=h.useState(!1),R=Hn(),{zIndex:I,sourceX:z,sourceY:P,targetX:L,targetY:E,sourcePosition:X,targetPosition:ee}=Vt(h.useCallback(_e=>{const je=_e.nodeLookup.get(x.source),Ve=_e.nodeLookup.get(x.target);if(!je||!Ve)return{zIndex:x.zIndex,..._N};const et=I3({id:e,sourceNode:je,targetNode:Ve,sourceHandle:x.sourceHandle||null,targetHandle:x.targetHandle||null,connectionMode:_e.connectionMode,onError:g});return{zIndex:N3({selected:x.selected,zIndex:x.zIndex,sourceNode:je,targetNode:Ve,elevateOnSelect:_e.elevateEdgesOnSelect,zIndexMode:_e.zIndexMode}),...et||_N}},[x.source,x.target,x.sourceHandle,x.targetHandle,x.selected,x.zIndex]),Yn),V=h.useMemo(()=>x.markerStart?`url('#${fb(x.markerStart,y)}')`:void 0,[x.markerStart,y]),ie=h.useMemo(()=>x.markerEnd?`url('#${fb(x.markerEnd,y)}')`:void 0,[x.markerEnd,y]);if(x.hidden||z===null||P===null||L===null||E===null)return null;const fe=_e=>{var qe;const{addSelectedEdges:je,unselectNodesAndEdges:Ve,multiSelectionActive:et}=R.getState();M&&(R.setState({nodesSelectionActive:!1}),x.selected&&et?(Ve({nodes:[],edges:[x]}),(qe=F.current)==null||qe.blur()):je([e])),s&&s(_e,x)},me=i?_e=>{i(_e,{...x})}:void 0,ge=a?_e=>{a(_e,{...x})}:void 0,Z=l?_e=>{l(_e,{...x})}:void 0,ae=c?_e=>{c(_e,{...x})}:void 0,xe=d?_e=>{d(_e,{...x})}:void 0,pe=_e=>{var je;if(!v&&KP.includes(_e.key)&&M){const{unselectNodesAndEdges:Ve,addSelectedEdges:et}=R.getState();_e.key==="Escape"?((je=F.current)==null||je.blur(),Ve({edges:[x]})):et([e])}};return o.jsx("svg",{style:{zIndex:I},children:o.jsxs("g",{className:br(["react-flow__edge",`react-flow__edge-${_}`,x.className,k,{selected:x.selected,animated:x.animated,inactive:!M&&!s,updating:D,selectable:M}]),onClick:fe,onDoubleClick:me,onContextMenu:ge,onMouseEnter:Z,onMouseMove:ae,onMouseLeave:xe,onKeyDown:T?pe:void 0,tabIndex:T?0:void 0,role:x.ariaRole??(T?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":x.ariaLabel===null?void 0:x.ariaLabel||`Edge from ${x.source} to ${x.target}`,"aria-describedby":T?`${PA}-${y}`:void 0,ref:F,...x.domAttributes,children:[!W&&o.jsx(C,{id:e,source:x.source,target:x.target,type:x.type,selected:x.selected,animated:x.animated,selectable:M,deletable:x.deletable??!0,label:x.label,labelStyle:x.labelStyle,labelShowBg:x.labelShowBg,labelBgStyle:x.labelBgStyle,labelBgPadding:x.labelBgPadding,labelBgBorderRadius:x.labelBgBorderRadius,sourceX:z,sourceY:P,targetX:L,targetY:E,sourcePosition:X,targetPosition:ee,data:x.data,style:x.style,sourceHandleId:x.sourceHandle,targetHandleId:x.targetHandle,markerStart:V,markerEnd:ie,pathOptions:"pathOptions"in x?x.pathOptions:void 0,interactionWidth:x.interactionWidth}),H&&o.jsx(JH,{edge:x,isReconnectable:H,reconnectRadius:f,onReconnect:u,onReconnectStart:p,onReconnectEnd:m,sourceX:z,sourceY:P,targetX:L,targetY:E,sourcePosition:X,targetPosition:ee,setUpdateHover:$,setReconnecting:O})]})})}var ZH=h.memo(QH);const e4=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function ZA({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:s,onReconnect:i,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:d,onEdgeClick:f,reconnectRadius:u,onEdgeDoubleClick:p,onReconnectStart:m,onReconnectEnd:y,disableKeyboardA11y:b}){const{edgesFocusable:k,edgesReconnectable:g,elementsSelectable:v,onError:x}=Vt(e4,Yn),N=DH(t);return o.jsxs("div",{className:"react-flow__edges",children:[o.jsx(WH,{defaultColor:e,rfId:n}),N.map(_=>o.jsx(ZH,{id:_,edgesFocusable:k,edgesReconnectable:g,elementsSelectable:v,noPanClassName:s,onReconnect:i,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:d,onClick:f,reconnectRadius:u,onDoubleClick:p,onReconnectStart:m,onReconnectEnd:y,rfId:n,onError:x,edgeTypes:r,disableKeyboardA11y:b},_))]})}ZA.displayName="EdgeRenderer";const t4=h.memo(ZA),n4=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function r4({children:e}){const t=Vt(n4);return o.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function s4(e){const t=wc(),n=h.useRef(!1);h.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const i4=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function o4(e){const t=Vt(i4),n=Hn();return h.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function a4(e){return e.connection.inProgress?{...e.connection,to:xp(e.connection.to,e.transform)}:{...e.connection}}function l4(e){return a4}function c4(e){const t=l4();return Vt(t,Yn)}const u4=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function d4({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:s,width:i,height:a,isValid:l,inProgress:c}=Vt(u4,Yn);return!(i&&s&&c)?null:o.jsx("svg",{style:e,width:i,height:a,className:"react-flow__connectionline react-flow__container",children:o.jsx("g",{className:br(["react-flow__connection",GP(l)]),children:o.jsx(eI,{style:t,type:n,CustomComponent:r,isValid:l})})})}const eI=({style:e,type:t=Va.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:s,from:i,fromNode:a,fromHandle:l,fromPosition:c,to:d,toNode:f,toHandle:u,toPosition:p,pointer:m}=c4();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:c,toPosition:p,connectionStatus:GP(r),toNode:f,toHandle:u,pointer:m});let y="";const b={sourceX:i.x,sourceY:i.y,sourcePosition:c,targetX:d.x,targetY:d.y,targetPosition:p};switch(t){case Va.Bezier:[y]=aA(b);break;case Va.SimpleBezier:[y]=HA(b);break;case Va.Step:[y]=db({...b,borderRadius:0});break;case Va.SmoothStep:[y]=db(b);break;default:[y]=cA(b)}return o.jsx("path",{d:y,fill:"none",className:"react-flow__connection-path",style:e})};eI.displayName="ConnectionLine";const f4={};function IN(e=f4){h.useRef(e),Hn(),h.useEffect(()=>{},[e])}function p4(){Hn(),h.useRef(!1),h.useEffect(()=>{},[])}function tI({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:i,onEdgeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:d,onNodeContextMenu:f,onSelectionContextMenu:u,onSelectionStart:p,onSelectionEnd:m,connectionLineType:y,connectionLineStyle:b,connectionLineComponent:k,connectionLineContainerStyle:g,selectionKeyCode:v,selectionOnDrag:x,selectionMode:N,multiSelectionKeyCode:_,panActivationKeyCode:C,zoomActivationKeyCode:T,deleteKeyCode:H,onlyRenderVisibleElements:M,elementsSelectable:F,defaultViewport:D,translateExtent:$,minZoom:W,maxZoom:O,preventScrolling:R,defaultMarkerColor:I,zoomOnScroll:z,zoomOnPinch:P,panOnScroll:L,panOnScrollSpeed:E,panOnScrollMode:X,zoomOnDoubleClick:ee,panOnDrag:V,onPaneClick:ie,onPaneMouseEnter:fe,onPaneMouseMove:me,onPaneMouseLeave:ge,onPaneScroll:Z,onPaneContextMenu:ae,paneClickDistance:xe,nodeClickDistance:pe,onEdgeContextMenu:_e,onEdgeMouseEnter:je,onEdgeMouseMove:Ve,onEdgeMouseLeave:et,reconnectRadius:qe,onReconnect:dt,onReconnectStart:He,onReconnectEnd:bt,noDragClassName:sn,noWheelClassName:on,noPanClassName:an,disableKeyboardA11y:Yt,nodeExtent:En,rfId:hn,viewport:ue,onViewportChange:ke}){return IN(e),IN(t),p4(),s4(n),o4(ue),o.jsx(_H,{onPaneClick:ie,onPaneMouseEnter:fe,onPaneMouseMove:me,onPaneMouseLeave:ge,onPaneContextMenu:ae,onPaneScroll:Z,paneClickDistance:xe,deleteKeyCode:H,selectionKeyCode:v,selectionOnDrag:x,selectionMode:N,onSelectionStart:p,onSelectionEnd:m,multiSelectionKeyCode:_,panActivationKeyCode:C,zoomActivationKeyCode:T,elementsSelectable:F,zoomOnScroll:z,zoomOnPinch:P,zoomOnDoubleClick:ee,panOnScroll:L,panOnScrollSpeed:E,panOnScrollMode:X,panOnDrag:V,defaultViewport:D,translateExtent:$,minZoom:W,maxZoom:O,onSelectionContextMenu:u,preventScrolling:R,noDragClassName:sn,noWheelClassName:on,noPanClassName:an,disableKeyboardA11y:Yt,onViewportChange:ke,isControlledViewport:!!ue,children:o.jsxs(r4,{children:[o.jsx(t4,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:a,onReconnect:dt,onReconnectStart:He,onReconnectEnd:bt,onlyRenderVisibleElements:M,onEdgeContextMenu:_e,onEdgeMouseEnter:je,onEdgeMouseMove:Ve,onEdgeMouseLeave:et,reconnectRadius:qe,defaultMarkerColor:I,noPanClassName:an,disableKeyboardA11y:Yt,rfId:hn}),o.jsx(d4,{style:b,type:y,component:k,containerStyle:g}),o.jsx("div",{className:"react-flow__edgelabel-renderer"}),o.jsx($H,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:d,onNodeContextMenu:f,nodeClickDistance:pe,onlyRenderVisibleElements:M,noPanClassName:an,noDragClassName:sn,disableKeyboardA11y:Yt,nodeExtent:En,rfId:hn}),o.jsx("div",{className:"react-flow__viewport-portal"})]})})}tI.displayName="GraphView";const h4=h.memo(tI),TN=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:l,minZoom:c=.5,maxZoom:d=2,nodeOrigin:f,nodeExtent:u,zIndexMode:p="basic"}={})=>{const m=new Map,y=new Map,b=new Map,k=new Map,g=r??t??[],v=n??e??[],x=f??[0,0],N=u??Wf;fA(b,k,g);const{nodesInitialized:_}=pb(v,m,y,{nodeOrigin:x,nodeExtent:N,zIndexMode:p});let C=[0,0,1];if(a&&s&&i){const T=gp(m,{filter:D=>!!((D.width||D.initialWidth)&&(D.height||D.initialHeight))}),{x:H,y:M,zoom:F}=e0(T,s,i,c,d,(l==null?void 0:l.padding)??.1);C=[H,M,F]}return{rfId:"1",width:s??0,height:i??0,transform:C,nodes:v,nodesInitialized:_,nodeLookup:m,parentLookup:y,edges:g,edgeLookup:k,connectionLookup:b,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:d,translateExtent:Wf,nodeExtent:N,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Iu.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:x,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:a??!1,fitViewOptions:l,fitViewResolver:null,connection:{...YP},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:x3,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:qP,zIndexMode:p,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},m4=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:d,nodeOrigin:f,nodeExtent:u,zIndexMode:p})=>L5((m,y)=>{async function b(){const{nodeLookup:k,panZoom:g,fitViewOptions:v,fitViewResolver:x,width:N,height:_,minZoom:C,maxZoom:T}=y();g&&(await g3({nodes:k,width:N,height:_,panZoom:g,minZoom:C,maxZoom:T},v),x==null||x.resolve(!0),m({fitViewResolver:null}))}return{...TN({nodes:e,edges:t,width:s,height:i,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:d,nodeOrigin:f,nodeExtent:u,defaultNodes:n,defaultEdges:r,zIndexMode:p}),setNodes:k=>{const{nodeLookup:g,parentLookup:v,nodeOrigin:x,elevateNodesOnSelect:N,fitViewQueued:_,zIndexMode:C,nodesSelectionActive:T}=y(),{nodesInitialized:H,hasSelectedNodes:M}=pb(k,g,v,{nodeOrigin:x,nodeExtent:u,elevateNodesOnSelect:N,checkEquality:!0,zIndexMode:C}),F=T&&M;_&&H?(b(),m({nodes:k,nodesInitialized:H,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:F})):m({nodes:k,nodesInitialized:H,nodesSelectionActive:F})},setEdges:k=>{const{connectionLookup:g,edgeLookup:v}=y();fA(g,v,k),m({edges:k})},setDefaultNodesAndEdges:(k,g)=>{if(k){const{setNodes:v}=y();v(k),m({hasDefaultNodes:!0})}if(g){const{setEdges:v}=y();v(g),m({hasDefaultEdges:!0})}},updateNodeInternals:k=>{const{triggerNodeChanges:g,nodeLookup:v,parentLookup:x,domNode:N,nodeOrigin:_,nodeExtent:C,debug:T,fitViewQueued:H,zIndexMode:M}=y(),{changes:F,updatedInternals:D}=F3(k,v,x,N,_,C,M);D&&(M3(v,x,{nodeOrigin:_,nodeExtent:C,zIndexMode:M}),H?(b(),m({fitViewQueued:!1,fitViewOptions:void 0})):m({}),(F==null?void 0:F.length)>0&&(T&&console.log("React Flow: trigger node changes",F),g==null||g(F)))},updateNodePositions:(k,g=!1)=>{const v=[];let x=[];const{nodeLookup:N,triggerNodeChanges:_,connection:C,updateConnection:T,onNodesChangeMiddlewareMap:H}=y();for(const[M,F]of k){const D=N.get(M),$=!!(D!=null&&D.expandParent&&(D!=null&&D.parentId)&&(F!=null&&F.position)),W={id:M,type:"position",position:$?{x:Math.max(0,F.position.x),y:Math.max(0,F.position.y)}:F.position,dragging:g};if(D&&C.inProgress&&C.fromNode.id===D.id){const O=hc(D,C.fromHandle,Ze.Left,!0);T({...C,from:O})}$&&D.parentId&&v.push({id:M,parentId:D.parentId,rect:{...F.internals.positionAbsolute,width:F.measured.width??0,height:F.measured.height??0}}),x.push(W)}if(v.length>0){const{parentLookup:M,nodeOrigin:F}=y(),D=o0(v,N,M,F);x.push(...D)}for(const M of H.values())x=M(x);_(x)},triggerNodeChanges:k=>{const{onNodesChange:g,setNodes:v,nodes:x,hasDefaultNodes:N,debug:_}=y();if(k!=null&&k.length){if(N){const C=tg(k,x);v(C)}_&&console.log("React Flow: trigger node changes",k),g==null||g(k)}},triggerEdgeChanges:k=>{const{onEdgesChange:g,setEdges:v,edges:x,hasDefaultEdges:N,debug:_}=y();if(k!=null&&k.length){if(N){const C=a0(k,x);v(C)}_&&console.log("React Flow: trigger edge changes",k),g==null||g(k)}},addSelectedNodes:k=>{const{multiSelectionActive:g,edgeLookup:v,nodeLookup:x,triggerNodeChanges:N,triggerEdgeChanges:_}=y();if(g){const C=k.map(T=>Ul(T,!0));N(C);return}N(ou(x,new Set([...k]),!0)),_(ou(v))},addSelectedEdges:k=>{const{multiSelectionActive:g,edgeLookup:v,nodeLookup:x,triggerNodeChanges:N,triggerEdgeChanges:_}=y();if(g){const C=k.map(T=>Ul(T,!0));_(C);return}_(ou(v,new Set([...k]))),N(ou(x,new Set,!0))},unselectNodesAndEdges:({nodes:k,edges:g}={})=>{const{edges:v,nodes:x,nodeLookup:N,triggerNodeChanges:_,triggerEdgeChanges:C}=y(),T=k||x,H=g||v,M=[];for(const D of T){if(!D.selected)continue;const $=N.get(D.id);$&&($.selected=!1),M.push(Ul(D.id,!1))}const F=[];for(const D of H)D.selected&&F.push(Ul(D.id,!1));_(M),C(F)},setMinZoom:k=>{const{panZoom:g,maxZoom:v}=y();g==null||g.setScaleExtent([k,v]),m({minZoom:k})},setMaxZoom:k=>{const{panZoom:g,minZoom:v}=y();g==null||g.setScaleExtent([v,k]),m({maxZoom:k})},setTranslateExtent:k=>{var g;(g=y().panZoom)==null||g.setTranslateExtent(k),m({translateExtent:k})},resetSelectedElements:()=>{const{edges:k,nodes:g,triggerNodeChanges:v,triggerEdgeChanges:x,elementsSelectable:N}=y();if(!N)return;const _=g.reduce((T,H)=>H.selected?[...T,Ul(H.id,!1)]:T,[]),C=k.reduce((T,H)=>H.selected?[...T,Ul(H.id,!1)]:T,[]);v(_),x(C)},setNodeExtent:k=>{const{nodes:g,nodeLookup:v,parentLookup:x,nodeOrigin:N,elevateNodesOnSelect:_,nodeExtent:C,zIndexMode:T}=y();k[0][0]===C[0][0]&&k[0][1]===C[0][1]&&k[1][0]===C[1][0]&&k[1][1]===C[1][1]||(pb(g,v,x,{nodeOrigin:N,nodeExtent:k,elevateNodesOnSelect:_,checkEquality:!1,zIndexMode:T}),m({nodeExtent:k}))},panBy:k=>{const{transform:g,width:v,height:x,panZoom:N,translateExtent:_}=y();return z3({delta:k,panZoom:N,transform:g,translateExtent:_,width:v,height:x})},setCenter:async(k,g,v)=>{const{width:x,height:N,maxZoom:_,panZoom:C}=y();if(!C)return Promise.resolve(!1);const T=typeof(v==null?void 0:v.zoom)<"u"?v.zoom:_;return await C.setViewport({x:x/2-k*T,y:N/2-g*T,zoom:T},{duration:v==null?void 0:v.duration,ease:v==null?void 0:v.ease,interpolate:v==null?void 0:v.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{m({connection:{...YP}})},updateConnection:k=>{m({connection:k})},reset:()=>m({...TN()})}},Object.is);function sy({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:i,initialMinZoom:a,initialMaxZoom:l,initialFitViewOptions:c,fitView:d,nodeOrigin:f,nodeExtent:u,zIndexMode:p,children:m}){const[y]=h.useState(()=>m4({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:d,minZoom:a,maxZoom:l,fitViewOptions:c,nodeOrigin:f,nodeExtent:u,zIndexMode:p}));return o.jsx(M5,{value:y,children:o.jsx(rH,{children:m})})}function g4({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:s,width:i,height:a,fitView:l,fitViewOptions:c,minZoom:d,maxZoom:f,nodeOrigin:u,nodeExtent:p,zIndexMode:m}){return h.useContext(ty)?o.jsx(o.Fragment,{children:e}):o.jsx(sy,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:s,initialWidth:i,initialHeight:a,fitView:l,initialFitViewOptions:c,initialMinZoom:d,initialMaxZoom:f,nodeOrigin:u,nodeExtent:p,zIndexMode:m,children:e})}const y4={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function x4({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i,edgeTypes:a,onNodeClick:l,onEdgeClick:c,onInit:d,onMove:f,onMoveStart:u,onMoveEnd:p,onConnect:m,onConnectStart:y,onConnectEnd:b,onClickConnectStart:k,onClickConnectEnd:g,onNodeMouseEnter:v,onNodeMouseMove:x,onNodeMouseLeave:N,onNodeContextMenu:_,onNodeDoubleClick:C,onNodeDragStart:T,onNodeDrag:H,onNodeDragStop:M,onNodesDelete:F,onEdgesDelete:D,onDelete:$,onSelectionChange:W,onSelectionDragStart:O,onSelectionDrag:R,onSelectionDragStop:I,onSelectionContextMenu:z,onSelectionStart:P,onSelectionEnd:L,onBeforeDelete:E,connectionMode:X,connectionLineType:ee=Va.Bezier,connectionLineStyle:V,connectionLineComponent:ie,connectionLineContainerStyle:fe,deleteKeyCode:me="Backspace",selectionKeyCode:ge="Shift",selectionOnDrag:Z=!1,selectionMode:ae=Vf.Full,panActivationKeyCode:xe="Space",multiSelectionKeyCode:pe=Kf()?"Meta":"Control",zoomActivationKeyCode:_e=Kf()?"Meta":"Control",snapToGrid:je,snapGrid:Ve,onlyRenderVisibleElements:et=!1,selectNodesOnDrag:qe,nodesDraggable:dt,autoPanOnNodeFocus:He,nodesConnectable:bt,nodesFocusable:sn,nodeOrigin:on=AA,edgesFocusable:an,edgesReconnectable:Yt,elementsSelectable:En=!0,defaultViewport:hn=Y5,minZoom:ue=.5,maxZoom:ke=2,translateExtent:De=Wf,preventScrolling:rt=!0,nodeExtent:at,defaultMarkerColor:Lt="#b1b1b7",zoomOnScroll:st=!0,zoomOnPinch:mn=!0,panOnScroll:Zt=!1,panOnScrollSpeed:ar=.5,panOnScrollMode:_n=nc.Free,zoomOnDoubleClick:gn=!0,panOnDrag:bn=!0,onPaneClick:lr,onPaneMouseEnter:ve,onPaneMouseMove:$e,onPaneMouseLeave:nt,onPaneScroll:zt,onPaneContextMenu:oe,paneClickDistance:Te=1,nodeClickDistance:Ue=0,children:Ht,onReconnect:yn,onReconnectStart:cr,onReconnectEnd:Hs,onEdgeContextMenu:as,onEdgeDoubleClick:hr,onEdgeMouseEnter:Zn,onEdgeMouseMove:Vr,onEdgeMouseLeave:ot,reconnectRadius:Ur=10,onNodesChange:Ai,onEdgesChange:xa,noDragClassName:xs="nodrag",noWheelClassName:Ie="nowheel",noPanClassName:cn="nopan",fitView:mr,fitViewOptions:ht,connectOnClick:Oe,attributionPosition:Kr,proOptions:Gn,defaultEdgeOptions:qr,elevateNodesOnSelect:Cr=!0,elevateEdgesOnSelect:ut=!1,disableKeyboardA11y:Ut=!1,autoPanOnConnect:un,autoPanOnNodeDrag:Er,autoPanSpeed:tt,connectionRadius:gr,isValidConnection:Bs,onError:wa,style:ws,id:Oo,nodeDragThreshold:vr,connectionDragThreshold:$o,viewport:Ii,onViewportChange:xn,width:er,height:bs,colorMode:Yr="light",debug:li,onScroll:Ws,ariaLabelConfig:K,zIndexMode:we="basic",...Le},Me){const Ke=Oo||"1",en=Q5(Yr),Mt=h.useCallback(wn=>{wn.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Ws==null||Ws(wn)},[Ws]);return o.jsx("div",{"data-testid":"rf__wrapper",...Le,onScroll:Mt,style:{...ws,...y4},ref:Me,className:br(["react-flow",s,en]),id:Oo,role:"application",children:o.jsxs(g4,{nodes:e,edges:t,width:er,height:bs,fitView:mr,fitViewOptions:ht,minZoom:ue,maxZoom:ke,nodeOrigin:on,nodeExtent:at,zIndexMode:we,children:[o.jsx(J5,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:m,onConnectStart:y,onConnectEnd:b,onClickConnectStart:k,onClickConnectEnd:g,nodesDraggable:dt,autoPanOnNodeFocus:He,nodesConnectable:bt,nodesFocusable:sn,edgesFocusable:an,edgesReconnectable:Yt,elementsSelectable:En,elevateNodesOnSelect:Cr,elevateEdgesOnSelect:ut,minZoom:ue,maxZoom:ke,nodeExtent:at,onNodesChange:Ai,onEdgesChange:xa,snapToGrid:je,snapGrid:Ve,connectionMode:X,translateExtent:De,connectOnClick:Oe,defaultEdgeOptions:qr,fitView:mr,fitViewOptions:ht,onNodesDelete:F,onEdgesDelete:D,onDelete:$,onNodeDragStart:T,onNodeDrag:H,onNodeDragStop:M,onSelectionDrag:R,onSelectionDragStart:O,onSelectionDragStop:I,onMove:f,onMoveStart:u,onMoveEnd:p,noPanClassName:cn,nodeOrigin:on,rfId:Ke,autoPanOnConnect:un,autoPanOnNodeDrag:Er,autoPanSpeed:tt,onError:wa,connectionRadius:gr,isValidConnection:Bs,selectNodesOnDrag:qe,nodeDragThreshold:vr,connectionDragThreshold:$o,onBeforeDelete:E,debug:li,ariaLabelConfig:K,zIndexMode:we}),o.jsx(h4,{onInit:d,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:x,onNodeMouseLeave:N,onNodeContextMenu:_,onNodeDoubleClick:C,nodeTypes:i,edgeTypes:a,connectionLineType:ee,connectionLineStyle:V,connectionLineComponent:ie,connectionLineContainerStyle:fe,selectionKeyCode:ge,selectionOnDrag:Z,selectionMode:ae,deleteKeyCode:me,multiSelectionKeyCode:pe,panActivationKeyCode:xe,zoomActivationKeyCode:_e,onlyRenderVisibleElements:et,defaultViewport:hn,translateExtent:De,minZoom:ue,maxZoom:ke,preventScrolling:rt,zoomOnScroll:st,zoomOnPinch:mn,zoomOnDoubleClick:gn,panOnScroll:Zt,panOnScrollSpeed:ar,panOnScrollMode:_n,panOnDrag:bn,onPaneClick:lr,onPaneMouseEnter:ve,onPaneMouseMove:$e,onPaneMouseLeave:nt,onPaneScroll:zt,onPaneContextMenu:oe,paneClickDistance:Te,nodeClickDistance:Ue,onSelectionContextMenu:z,onSelectionStart:P,onSelectionEnd:L,onReconnect:yn,onReconnectStart:cr,onReconnectEnd:Hs,onEdgeContextMenu:as,onEdgeDoubleClick:hr,onEdgeMouseEnter:Zn,onEdgeMouseMove:Vr,onEdgeMouseLeave:ot,reconnectRadius:Ur,defaultMarkerColor:Lt,noDragClassName:xs,noWheelClassName:Ie,noPanClassName:cn,rfId:Ke,disableKeyboardA11y:Ut,nodeExtent:at,viewport:Ii,onViewportChange:xn}),o.jsx(q5,{onSelectionChange:W}),Ht,o.jsx(B5,{proOptions:Gn,position:Kr}),o.jsx(H5,{rfId:Ke,disableKeyboardA11y:Ut})]})})}var c0=TA(x4);function u0(){const e=Hn();return h.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 nI(e){const[t,n]=h.useState(e),r=h.useCallback(s=>n(i=>tg(s,i)),[]);return[t,n,r]}function rI(e){const[t,n]=h.useState(e),r=h.useCallback(s=>n(i=>a0(s,i)),[]);return[t,n,r]}function w4({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:br(["react-flow__background-pattern",n,r])})}function b4({radius:e,className:t}){return o.jsx("circle",{cx:e,cy:e,r:e,className:br(["react-flow__background-pattern","dots",t])})}var sl;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(sl||(sl={}));const v4={[sl.Dots]:1,[sl.Lines]:1,[sl.Cross]:6},k4=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function sI({id:e,variant:t=sl.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=0,color:a,bgColor:l,style:c,className:d,patternClassName:f}){const u=h.useRef(null),{transform:p,patternId:m}=Vt(k4,Yn),y=r||v4[t],b=t===sl.Dots,k=t===sl.Cross,g=Array.isArray(n)?n:[n,n],v=[g[0]*p[2]||1,g[1]*p[2]||1],x=y*p[2],N=Array.isArray(i)?i:[i,i],_=k?[x,x]:v,C=[N[0]*p[2]||1+_[0]/2,N[1]*p[2]||1+_[1]/2],T=`${m}${e||""}`;return o.jsxs("svg",{className:br(["react-flow__background",d]),style:{...c,...ny,"--xy-background-color-props":l,"--xy-background-pattern-color-props":a},ref:u,"data-testid":"rf__background",children:[o.jsx("pattern",{id:T,x:p[0]%v[0],y:p[1]%v[1],width:v[0],height:v[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`,children:b?o.jsx(b4,{radius:x/2,className:f}):o.jsx(w4,{dimensions:_,lineWidth:s,variant:t,className:f})}),o.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${T})`})]})}sI.displayName="Background";const d0=h.memo(sI);function S4(){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 N4(){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 j4(){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 C4(){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 E4(){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 Th({children:e,className:t,...n}){return o.jsx("button",{type:"button",className:br(["react-flow__controls-button",t]),...n,children:e})}const _4=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function iI({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:a,onFitView:l,onInteractiveChange:c,className:d,children:f,position:u="bottom-left",orientation:p="vertical","aria-label":m}){const y=Hn(),{isInteractive:b,minZoomReached:k,maxZoomReached:g,ariaLabelConfig:v}=Vt(_4,Yn),{zoomIn:x,zoomOut:N,fitView:_}=wc(),C=()=>{x(),i==null||i()},T=()=>{N(),a==null||a()},H=()=>{_(s),l==null||l()},M=()=>{y.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),c==null||c(!b)},F=p==="horizontal"?"horizontal":"vertical";return o.jsxs($u,{className:br(["react-flow__controls",F,d]),position:u,style:e,"data-testid":"rf__controls","aria-label":m??v["controls.ariaLabel"],children:[t&&o.jsxs(o.Fragment,{children:[o.jsx(Th,{onClick:C,className:"react-flow__controls-zoomin",title:v["controls.zoomIn.ariaLabel"],"aria-label":v["controls.zoomIn.ariaLabel"],disabled:g,children:o.jsx(S4,{})}),o.jsx(Th,{onClick:T,className:"react-flow__controls-zoomout",title:v["controls.zoomOut.ariaLabel"],"aria-label":v["controls.zoomOut.ariaLabel"],disabled:k,children:o.jsx(N4,{})})]}),n&&o.jsx(Th,{className:"react-flow__controls-fitview",onClick:H,title:v["controls.fitView.ariaLabel"],"aria-label":v["controls.fitView.ariaLabel"],children:o.jsx(j4,{})}),r&&o.jsx(Th,{className:"react-flow__controls-interactive",onClick:M,title:v["controls.interactive.ariaLabel"],"aria-label":v["controls.interactive.ariaLabel"],children:b?o.jsx(E4,{}):o.jsx(C4,{})}),f]})}iI.displayName="Controls";const P4=h.memo(iI);function A4({id:e,x:t,y:n,width:r,height:s,style:i,color:a,strokeColor:l,strokeWidth:c,className:d,borderRadius:f,shapeRendering:u,selected:p,onClick:m}){const{background:y,backgroundColor:b}=i||{},k=a||y||b;return o.jsx("rect",{className:br(["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:c},shapeRendering:u,onClick:m?g=>m(g,e):void 0})}const I4=h.memo(A4),T4=e=>e.nodes.map(t=>t.id),xx=e=>e instanceof Function?e:()=>e;function R4({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:i=I4,onClick:a}){const l=Vt(T4,Yn),c=xx(t),d=xx(e),f=xx(n),u=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return o.jsx(o.Fragment,{children:l.map(p=>o.jsx(M4,{id:p,nodeColorFunc:c,nodeStrokeColorFunc:d,nodeClassNameFunc:f,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:i,onClick:a,shapeRendering:u},p))})}function L4({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:i,shapeRendering:a,NodeComponent:l,onClick:c}){const{node:d,x:f,y:u,width:p,height:m}=Vt(y=>{const b=y.nodeLookup.get(e);if(!b)return{node:void 0,x:0,y:0,width:0,height:0};const k=b.internals.userNode,{x:g,y:v}=b.internals.positionAbsolute,{width:x,height:N}=ga(k);return{node:k,x:g,y:v,width:x,height:N}},Yn);return!d||d.hidden||!tA(d)?null:o.jsx(l,{x:f,y:u,width:p,height:m,style:d.style,selected:!!d.selected,className:r(d),color:t(d),borderRadius:s,strokeColor:n(d),strokeWidth:i,shapeRendering:a,onClick:c,id:d.id})}const M4=h.memo(L4);var O4=h.memo(R4);const $4=200,D4=150,F4=e=>!e.hidden,z4=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?eA(gp(e.nodeLookup,{filter:F4}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},H4="react-flow__minimap-desc";function oI({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:a,nodeComponent:l,bgColor:c,maskColor:d,maskStrokeColor:f,maskStrokeWidth:u,position:p="bottom-right",onClick:m,onNodeClick:y,pannable:b=!1,zoomable:k=!1,ariaLabel:g,inversePan:v,zoomStep:x=1,offsetScale:N=5}){const _=Hn(),C=h.useRef(null),{boundingRect:T,viewBB:H,rfId:M,panZoom:F,translateExtent:D,flowWidth:$,flowHeight:W,ariaLabelConfig:O}=Vt(z4,Yn),R=(e==null?void 0:e.width)??$4,I=(e==null?void 0:e.height)??D4,z=T.width/R,P=T.height/I,L=Math.max(z,P),E=L*R,X=L*I,ee=N*L,V=T.x-(E-T.width)/2-ee,ie=T.y-(X-T.height)/2-ee,fe=E+ee*2,me=X+ee*2,ge=`${H4}-${M}`,Z=h.useRef(0),ae=h.useRef();Z.current=L,h.useEffect(()=>{if(C.current&&F)return ae.current=G3({domNode:C.current,panZoom:F,getTransform:()=>_.getState().transform,getViewScale:()=>Z.current}),()=>{var je;(je=ae.current)==null||je.destroy()}},[F]),h.useEffect(()=>{var je;(je=ae.current)==null||je.update({translateExtent:D,width:$,height:W,inversePan:v,pannable:b,zoomStep:x,zoomable:k})},[b,k,v,x,D,$,W]);const xe=m?je=>{var qe;const[Ve,et]=((qe=ae.current)==null?void 0:qe.pointer(je))||[0,0];m(je,{x:Ve,y:et})}:void 0,pe=y?h.useCallback((je,Ve)=>{const et=_.getState().nodeLookup.get(Ve).internals.userNode;y(je,et)},[]):void 0,_e=g??O["minimap.ariaLabel"];return o.jsx($u,{position:p,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c: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 u=="number"?u*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:br(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:o.jsxs("svg",{width:R,height:I,viewBox:`${V} ${ie} ${fe} ${me}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ge,ref:C,onClick:xe,children:[_e&&o.jsx("title",{id:ge,children:_e}),o.jsx(O4,{onClick:pe,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:a,nodeComponent:l}),o.jsx("path",{className:"react-flow__minimap-mask",d:`M${V-ee},${ie-ee}h${fe+ee*2}v${me+ee*2}h${-fe-ee*2}z
|
|
66
|
+
M${H.x},${H.y}h${H.width}v${H.height}h${-H.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}oI.displayName="MiniMap";const B4=h.memo(oI),W4=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,V4={[Mu.Line]:"right",[Mu.Handle]:"bottom-right"};function U4({nodeId:e,position:t,variant:n=Mu.Handle,className:r,style:s=void 0,children:i,color:a,minWidth:l=10,minHeight:c=10,maxWidth:d=Number.MAX_VALUE,maxHeight:f=Number.MAX_VALUE,keepAspectRatio:u=!1,resizeDirection:p,autoScale:m=!0,shouldResize:y,onResizeStart:b,onResize:k,onResizeEnd:g}){const v=OA(),x=typeof e=="string"?e:v,N=Hn(),_=h.useRef(null),C=n===Mu.Handle,T=Vt(h.useCallback(W4(C&&m),[C,m]),Yn),H=h.useRef(null),M=t??V4[n];h.useEffect(()=>{if(!(!_.current||!x))return H.current||(H.current=c5({domNode:_.current,nodeId:x,getStoreItems:()=>{const{nodeLookup:D,transform:$,snapGrid:W,snapToGrid:O,nodeOrigin:R,domNode:I}=N.getState();return{nodeLookup:D,transform:$,snapGrid:W,snapToGrid:O,nodeOrigin:R,paneDomNode:I}},onChange:(D,$)=>{const{triggerNodeChanges:W,nodeLookup:O,parentLookup:R,nodeOrigin:I}=N.getState(),z=[],P={x:D.x,y:D.y},L=O.get(x);if(L&&L.expandParent&&L.parentId){const E=L.origin??I,X=D.width??L.measured.width??0,ee=D.height??L.measured.height??0,V={id:L.id,parentId:L.parentId,rect:{width:X,height:ee,...nA({x:D.x??L.position.x,y:D.y??L.position.y},{width:X,height:ee},L.parentId,O,E)}},ie=o0([V],O,R,I);z.push(...ie),P.x=D.x?Math.max(E[0]*X,D.x):void 0,P.y=D.y?Math.max(E[1]*ee,D.y):void 0}if(P.x!==void 0&&P.y!==void 0){const E={id:x,type:"position",position:{...P}};z.push(E)}if(D.width!==void 0&&D.height!==void 0){const X={id:x,type:"dimensions",resizing:!0,setAttributes:p?p==="horizontal"?"width":"height":!0,dimensions:{width:D.width,height:D.height}};z.push(X)}for(const E of $){const X={...E,type:"position"};z.push(X)}W(z)},onEnd:({width:D,height:$})=>{const W={id:x,type:"dimensions",resizing:!1,dimensions:{width:D,height:$}};N.getState().triggerNodeChanges([W])}})),H.current.update({controlPosition:M,boundaries:{minWidth:l,minHeight:c,maxWidth:d,maxHeight:f},keepAspectRatio:u,resizeDirection:p,onResizeStart:b,onResize:k,onResizeEnd:g,shouldResize:y}),()=>{var D;(D=H.current)==null||D.destroy()}},[M,l,c,d,f,u,b,k,g,y]);const F=M.split("-");return o.jsx("div",{className:br(["react-flow__resize-control","nodrag",...F,n,r]),ref:_,style:{...s,scale:T,...a&&{[C?"backgroundColor":"borderColor"]:a}},children:i})}const aI=h.memo(U4);function K4(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const q4=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Y4=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,G4={};function RN(e,t){return(G4.jsx?Y4:q4).test(e)}const X4=/[ \t\n\f\r]/g;function J4(e){return typeof e=="object"?e.type==="text"?LN(e.value):!1:LN(e)}function LN(e){return e.replace(X4,"")===""}let wp=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};wp.prototype.normal={};wp.prototype.property={};wp.prototype.space=void 0;function lI(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new wp(n,r,t)}function yb(e){return e.toLowerCase()}class zs{constructor(t,n){this.attribute=n,this.property=t}}zs.prototype.attribute="";zs.prototype.booleanish=!1;zs.prototype.boolean=!1;zs.prototype.commaOrSpaceSeparated=!1;zs.prototype.commaSeparated=!1;zs.prototype.defined=!1;zs.prototype.mustUseProperty=!1;zs.prototype.number=!1;zs.prototype.overloadedBoolean=!1;zs.prototype.property="";zs.prototype.spaceSeparated=!1;zs.prototype.space=void 0;let Q4=0;const Pt=bc(),yr=bc(),xb=bc(),Ae=bc(),Tn=bc(),xu=bc(),Xs=bc();function bc(){return 2**++Q4}const wb=Object.freeze(Object.defineProperty({__proto__:null,boolean:Pt,booleanish:yr,commaOrSpaceSeparated:Xs,commaSeparated:xu,number:Ae,overloadedBoolean:xb,spaceSeparated:Tn},Symbol.toStringTag,{value:"Module"})),wx=Object.keys(wb);class f0 extends zs{constructor(t,n,r,s){let i=-1;if(super(t,n),MN(this,"space",s),typeof r=="number")for(;++i<wx.length;){const a=wx[i];MN(this,wx[i],(r&wb[a])===wb[a])}}}f0.prototype.defined=!0;function MN(e,t,n){n&&(e[t]=n)}function Yu(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new f0(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[yb(r)]=r,n[yb(i.attribute)]=r}return new wp(t,n,e.space)}const cI=Yu({properties:{ariaActiveDescendant:null,ariaAtomic:yr,ariaAutoComplete:null,ariaBusy:yr,ariaChecked:yr,ariaColCount:Ae,ariaColIndex:Ae,ariaColSpan:Ae,ariaControls:Tn,ariaCurrent:null,ariaDescribedBy:Tn,ariaDetails:null,ariaDisabled:yr,ariaDropEffect:Tn,ariaErrorMessage:null,ariaExpanded:yr,ariaFlowTo:Tn,ariaGrabbed:yr,ariaHasPopup:null,ariaHidden:yr,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Tn,ariaLevel:Ae,ariaLive:null,ariaModal:yr,ariaMultiLine:yr,ariaMultiSelectable:yr,ariaOrientation:null,ariaOwns:Tn,ariaPlaceholder:null,ariaPosInSet:Ae,ariaPressed:yr,ariaReadOnly:yr,ariaRelevant:null,ariaRequired:yr,ariaRoleDescription:Tn,ariaRowCount:Ae,ariaRowIndex:Ae,ariaRowSpan:Ae,ariaSelected:yr,ariaSetSize:Ae,ariaSort:null,ariaValueMax:Ae,ariaValueMin:Ae,ariaValueNow:Ae,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function uI(e,t){return t in e?e[t]:t}function dI(e,t){return uI(e,t.toLowerCase())}const Z4=Yu({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:xu,acceptCharset:Tn,accessKey:Tn,action:null,allow:null,allowFullScreen:Pt,allowPaymentRequest:Pt,allowUserMedia:Pt,alt:null,as:null,async:Pt,autoCapitalize:null,autoComplete:Tn,autoFocus:Pt,autoPlay:Pt,blocking:Tn,capture:null,charSet:null,checked:Pt,cite:null,className:Tn,cols:Ae,colSpan:null,content:null,contentEditable:yr,controls:Pt,controlsList:Tn,coords:Ae|xu,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Pt,defer:Pt,dir:null,dirName:null,disabled:Pt,download:xb,draggable:yr,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Pt,formTarget:null,headers:Tn,height:Ae,hidden:xb,high:Ae,href:null,hrefLang:null,htmlFor:Tn,httpEquiv:Tn,id:null,imageSizes:null,imageSrcSet:null,inert:Pt,inputMode:null,integrity:null,is:null,isMap:Pt,itemId:null,itemProp:Tn,itemRef:Tn,itemScope:Pt,itemType:Tn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Pt,low:Ae,manifest:null,max:null,maxLength:Ae,media:null,method:null,min:null,minLength:Ae,multiple:Pt,muted:Pt,name:null,nonce:null,noModule:Pt,noValidate:Pt,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:Pt,optimum:Ae,pattern:null,ping:Tn,placeholder:null,playsInline:Pt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Pt,referrerPolicy:null,rel:Tn,required:Pt,reversed:Pt,rows:Ae,rowSpan:Ae,sandbox:Tn,scope:null,scoped:Pt,seamless:Pt,selected:Pt,shadowRootClonable:Pt,shadowRootDelegatesFocus:Pt,shadowRootMode:null,shape:null,size:Ae,sizes:null,slot:null,span:Ae,spellCheck:yr,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ae,step:null,style:null,tabIndex:Ae,target:null,title:null,translate:null,type:null,typeMustMatch:Pt,useMap:null,value:yr,width:Ae,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Tn,axis:null,background:null,bgColor:null,border:Ae,borderColor:null,bottomMargin:Ae,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Pt,declare:Pt,event:null,face:null,frame:null,frameBorder:null,hSpace:Ae,leftMargin:Ae,link:null,longDesc:null,lowSrc:null,marginHeight:Ae,marginWidth:Ae,noResize:Pt,noHref:Pt,noShade:Pt,noWrap:Pt,object:null,profile:null,prompt:null,rev:null,rightMargin:Ae,rules:null,scheme:null,scrolling:yr,standby:null,summary:null,text:null,topMargin:Ae,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ae,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Pt,disableRemotePlayback:Pt,prefix:null,property:null,results:Ae,security:null,unselectable:null},space:"html",transform:dI}),eB=Yu({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:Xs,accentHeight:Ae,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ae,amplitude:Ae,arabicForm:null,ascent:Ae,attributeName:null,attributeType:null,azimuth:Ae,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ae,by:null,calcMode:null,capHeight:Ae,className:Tn,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:Ae,diffuseConstant:Ae,direction:null,display:null,dur:null,divisor:Ae,dominantBaseline:null,download:Pt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ae,enableBackground:null,end:null,event:null,exponent:Ae,externalResourcesRequired:null,fill:null,fillOpacity:Ae,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:xu,g2:xu,glyphName:xu,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ae,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ae,horizOriginX:Ae,horizOriginY:Ae,id:null,ideographic:Ae,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ae,k:Ae,k1:Ae,k2:Ae,k3:Ae,k4:Ae,kernelMatrix:Xs,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ae,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:Ae,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:Ae,overlineThickness:Ae,paintOrder:null,panose1:null,path:null,pathLength:Ae,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Tn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ae,pointsAtY:Ae,pointsAtZ:Ae,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Xs,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Xs,rev:Xs,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Xs,requiredFeatures:Xs,requiredFonts:Xs,requiredFormats:Xs,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:Ae,specularExponent:Ae,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ae,strikethroughThickness:Ae,string:null,stroke:null,strokeDashArray:Xs,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ae,strokeOpacity:Ae,strokeWidth:null,style:null,surfaceScale:Ae,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Xs,tabIndex:Ae,tableValues:null,target:null,targetX:Ae,targetY:Ae,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Xs,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ae,underlineThickness:Ae,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ae,values:null,vAlphabetic:Ae,vMathematical:Ae,vectorEffect:null,vHanging:Ae,vIdeographic:Ae,version:null,vertAdvY:Ae,vertOriginX:Ae,vertOriginY:Ae,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ae,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:uI}),fI=Yu({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()}}),pI=Yu({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:dI}),hI=Yu({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),tB={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"},nB=/[A-Z]/g,ON=/-[a-z]/g,rB=/^data[-\w.:]+$/i;function sB(e,t){const n=yb(t);let r=t,s=zs;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&rB.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(ON,oB);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!ON.test(i)){let a=i.replace(nB,iB);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}s=f0}return new s(r,t)}function iB(e){return"-"+e.toLowerCase()}function oB(e){return e.charAt(1).toUpperCase()}const aB=lI([cI,Z4,fI,pI,hI],"html"),p0=lI([cI,eB,fI,pI,hI],"svg");function lB(e){return e.join(" ").trim()}var h0={},$N=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,cB=/\n/g,uB=/^\s*/,dB=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,fB=/^:\s*/,pB=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,hB=/^[;\s]*/,mB=/^\s+|\s+$/g,gB=`
|
|
67
|
+
`,DN="/",FN="*",ql="",yB="comment",xB="declaration";function wB(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function s(y){var b=y.match(cB);b&&(n+=b.length);var k=y.lastIndexOf(gB);r=~k?y.length-k:r+y.length}function i(){var y={line:n,column:r};return function(b){return b.position=new a(y),d(),b}}function a(y){this.start=y,this.end={line:n,column:r},this.source=t.source}a.prototype.content=e;function l(y){var b=new Error(t.source+":"+n+":"+r+": "+y);if(b.reason=y,b.filename=t.source,b.line=n,b.column=r,b.source=e,!t.silent)throw b}function c(y){var b=y.exec(e);if(b){var k=b[0];return s(k),e=e.slice(k.length),b}}function d(){c(uB)}function f(y){var b;for(y=y||[];b=u();)b!==!1&&y.push(b);return y}function u(){var y=i();if(!(DN!=e.charAt(0)||FN!=e.charAt(1))){for(var b=2;ql!=e.charAt(b)&&(FN!=e.charAt(b)||DN!=e.charAt(b+1));)++b;if(b+=2,ql===e.charAt(b-1))return l("End of comment missing");var k=e.slice(2,b-2);return r+=2,s(k),e=e.slice(b),r+=2,y({type:yB,comment:k})}}function p(){var y=i(),b=c(dB);if(b){if(u(),!c(fB))return l("property missing ':'");var k=c(pB),g=y({type:xB,property:zN(b[0].replace($N,ql)),value:k?zN(k[0].replace($N,ql)):ql});return c(hB),g}}function m(){var y=[];f(y);for(var b;b=p();)b!==!1&&(y.push(b),f(y));return y}return d(),m()}function zN(e){return e?e.replace(mB,ql):ql}var bB=wB,vB=bf&&bf.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(h0,"__esModule",{value:!0});h0.default=SB;const kB=vB(bB);function SB(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,kB.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 iy={};Object.defineProperty(iy,"__esModule",{value:!0});iy.camelCase=void 0;var NB=/^--[a-zA-Z0-9_-]+$/,jB=/-([a-z])/g,CB=/^[^-]+$/,EB=/^-(webkit|moz|ms|o|khtml)-/,_B=/^-(ms)-/,PB=function(e){return!e||CB.test(e)||NB.test(e)},AB=function(e,t){return t.toUpperCase()},HN=function(e,t){return"".concat(t,"-")},IB=function(e,t){return t===void 0&&(t={}),PB(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(_B,HN):e=e.replace(EB,HN),e.replace(jB,AB))};iy.camelCase=IB;var TB=bf&&bf.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},RB=TB(h0),LB=iy;function bb(e,t){var n={};return!e||typeof e!="string"||(0,RB.default)(e,function(r,s){r&&s&&(n[(0,LB.camelCase)(r,t)]=s)}),n}bb.default=bb;var MB=bb;const OB=hl(MB),mI=gI("end"),m0=gI("start");function gI(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 $B(e){const t=m0(e),n=mI(e);if(t&&n)return{start:t,end:n}}function hf(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?BN(e.position):"start"in e||"end"in e?BN(e):"line"in e||"column"in e?vb(e):""}function vb(e){return WN(e&&e.line)+":"+WN(e&&e.column)}function BN(e){return vb(e&&e.start)+"-"+vb(e&&e.end)}function WN(e){return e&&typeof e=="number"?e:1}class is extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},a=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?s=t:!i.cause&&t&&(a=!0,s=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=l?l.line:void 0,this.name=hf(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}}is.prototype.file="";is.prototype.name="";is.prototype.reason="";is.prototype.message="";is.prototype.stack="";is.prototype.column=void 0;is.prototype.line=void 0;is.prototype.ancestors=void 0;is.prototype.cause=void 0;is.prototype.fatal=void 0;is.prototype.place=void 0;is.prototype.ruleId=void 0;is.prototype.source=void 0;const g0={}.hasOwnProperty,DB=new Map,FB=/[A-Z]/g,zB=new Set(["table","tbody","thead","tfoot","tr"]),HB=new Set(["td","th"]),yI="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function BB(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=XB(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=GB(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"?p0:aB,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=xI(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function xI(e,t,n){if(t.type==="element")return WB(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return VB(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return KB(e,t,n);if(t.type==="mdxjsEsm")return UB(e,t);if(t.type==="root")return qB(e,t,n);if(t.type==="text")return YB(e,t)}function WB(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=p0,e.schema=s),e.ancestors.push(t);const i=bI(e,t.tagName,!1),a=JB(e,t);let l=x0(e,t);return zB.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!J4(c):!0})),wI(e,a,i,t),y0(a,l),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function VB(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)}Gf(e,t.position)}function UB(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Gf(e,t.position)}function KB(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=p0,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:bI(e,t.name,!0),a=QB(e,t),l=x0(e,t);return wI(e,a,i,t),y0(a,l),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function qB(e,t,n){const r={};return y0(r,x0(e,t)),e.create(t,e.Fragment,r,n)}function YB(e,t){return t.value}function wI(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function y0(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function GB(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 XB(e,t){return n;function n(r,s,i,a){const l=Array.isArray(i.children),c=m0(r);return t(s,i,a,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function JB(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&g0.call(t.properties,s)){const i=ZB(e,s,t.properties[s]);if(i){const[a,l]=i;e.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&HB.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 QB(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 Gf(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 Gf(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function x0(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:DB;for(;++r<t.children.length;){const i=t.children[r];let a;if(e.passKeys){const c=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(c){const d=s.get(c)||0;a=c+"-"+d,s.set(c,d+1)}}const l=xI(e,i,a);l!==void 0&&n.push(l)}return n}function ZB(e,t,n){const r=sB(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?K4(n):lB(n)),r.property==="style"){let s=typeof n=="object"?n:e6(e,String(n));return e.stylePropertyNameCase==="css"&&(s=t6(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?tB[r.property]||r.property:r.attribute,n]}}function e6(e,t){try{return OB(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new is("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=yI+"#cannot-parse-style-attribute",s}}function bI(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=RN(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=RN(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return g0.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);Gf(e)}function Gf(e,t){const n=new is("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=yI+"#cannot-handle-mdx-estrees-without-createevaluater",n}function t6(e){const t={};let n;for(n in e)g0.call(e,n)&&(t[n6(n)]=e[n]);return t}function n6(e){let t=e.replace(FB,r6);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function r6(e){return"-"+e.toLowerCase()}const bx={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"]},s6={};function i6(e,t){const n=s6,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return vI(e,r,s)}function vI(e,t,n){if(o6(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 VN(e.children,t,n)}return Array.isArray(e)?VN(e,t,n):""}function VN(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=vI(e[s],t,n);return r.join("")}function o6(e){return!!(e&&typeof e=="object")}const UN=document.createElement("i");function w0(e){const t="&"+e+";";UN.innerHTML=t;const n=UN.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function To(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 Ni(e,t){return e.length>0?(To(e,e.length,0,t),e):t}const KN={}.hasOwnProperty;function a6(e){const t={};let n=-1;for(;++n<e.length;)l6(t,e[n]);return t}function l6(e,t){let n;for(n in t){const s=(KN.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let a;if(i)for(a in i){KN.call(s,a)||(s[a]=[]);const l=i[a];c6(s[a],Array.isArray(l)?l:l?[l]:[])}}}function c6(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);To(e,0,0,r)}function kI(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 wu(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const So=xl(/[A-Za-z]/),ti=xl(/[\dA-Za-z]/),u6=xl(/[#-'*+\--9=?A-Z^-~]/);function kb(e){return e!==null&&(e<32||e===127)}const Sb=xl(/\d/),d6=xl(/[\dA-Fa-f]/),f6=xl(/[!-/:-@[-`{-~]/);function wt(e){return e!==null&&e<-2}function Ds(e){return e!==null&&(e<0||e===32)}function rn(e){return e===-2||e===-1||e===32}const p6=xl(new RegExp("\\p{P}|\\p{S}","u")),h6=xl(/\s/);function xl(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Gu(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const i=e.charCodeAt(n);let a="";if(i===37&&ti(e.charCodeAt(n+1))&&ti(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 Ln(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(c){return rn(c)?(e.enter(n),l(c)):t(c)}function l(c){return rn(c)&&i++<s?(e.consume(c),l):(e.exit(n),t(c))}}const m6={tokenize:g6};function g6(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"),Ln(e,t,"linePrefix")}function s(l){return e.enter("paragraph"),i(l)}function i(l){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,a(l)}function a(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return wt(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),a)}}const y6={tokenize:x6},qN={tokenize:w6};function x6(e){const t=this,n=[];let r=0,s,i,a;return l;function l(x){if(r<n.length){const N=n[r];return t.containerState=N[1],e.attempt(N[0].continuation,c,d)(x)}return d(x)}function c(x){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&v();const N=t.events.length;let _=N,C;for(;_--;)if(t.events[_][0]==="exit"&&t.events[_][1].type==="chunkFlow"){C=t.events[_][1].end;break}g(r);let T=N;for(;T<t.events.length;)t.events[T][1].end={...C},T++;return To(t.events,_+1,0,t.events.slice(N)),t.events.length=T,d(x)}return l(x)}function d(x){if(r===n.length){if(!s)return p(x);if(s.currentConstruct&&s.currentConstruct.concrete)return y(x);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(qN,f,u)(x)}function f(x){return s&&v(),g(r),p(x)}function u(x){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,y(x)}function p(x){return t.containerState={},e.attempt(qN,m,y)(x)}function m(x){return r++,n.push([t.currentConstruct,t.containerState]),p(x)}function y(x){if(x===null){s&&v(),g(0),e.consume(x);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),b(x)}function b(x){if(x===null){k(e.exit("chunkFlow"),!0),g(0),e.consume(x);return}return wt(x)?(e.consume(x),k(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(x),b)}function k(x,N){const _=t.sliceStream(x);if(N&&_.push(null),x.previous=i,i&&(i.next=x),i=x,s.defineSkip(x.start),s.write(_),t.parser.lazy[x.start.line]){let C=s.events.length;for(;C--;)if(s.events[C][1].start.offset<a&&(!s.events[C][1].end||s.events[C][1].end.offset>a))return;const T=t.events.length;let H=T,M,F;for(;H--;)if(t.events[H][0]==="exit"&&t.events[H][1].type==="chunkFlow"){if(M){F=t.events[H][1].end;break}M=!0}for(g(r),C=T;C<t.events.length;)t.events[C][1].end={...F},C++;To(t.events,H+1,0,t.events.slice(T)),t.events.length=C}}function g(x){let N=n.length;for(;N-- >x;){const _=n[N];t.containerState=_[1],_[0].exit.call(t,e)}n.length=x}function v(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function w6(e,t,n){return Ln(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function YN(e){if(e===null||Ds(e)||h6(e))return 1;if(p6(e))return 2}function b0(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 Nb={name:"attention",resolveAll:b6,tokenize:v6};function b6(e,t){let n=-1,r,s,i,a,l,c,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;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const u={...e[r][1].end},p={...e[n][1].start};GN(u,-c),GN(p,c),a={type:c>1?"strongSequence":"emphasisSequence",start:u,end:{...e[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},i={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:c>1?"strong":"emphasis",start:{...a.start},end:{...l.end}},e[r][1].end={...a.start},e[n][1].start={...l.end},d=[],e[r][1].end.offset-e[r][1].start.offset&&(d=Ni(d,[["enter",e[r][1],t],["exit",e[r][1],t]])),d=Ni(d,[["enter",s,t],["enter",a,t],["exit",a,t],["enter",i,t]]),d=Ni(d,b0(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),d=Ni(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=Ni(d,[["enter",e[n][1],t],["exit",e[n][1],t]])):f=0,To(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 v6(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=YN(r);let i;return a;function a(c){return i=c,e.enter("attentionSequence"),l(c)}function l(c){if(c===i)return e.consume(c),l;const d=e.exit("attentionSequence"),f=YN(c),u=!f||f===2&&s||n.includes(c),p=!s||s===2&&f||n.includes(r);return d._open=!!(i===42?u:u&&(s||!p)),d._close=!!(i===42?p:p&&(f||!u)),t(c)}}function GN(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const k6={name:"autolink",tokenize:S6};function S6(e,t,n){let r=0;return s;function s(m){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(m){return So(m)?(e.consume(m),a):m===64?n(m):d(m)}function a(m){return m===43||m===45||m===46||ti(m)?(r=1,l(m)):d(m)}function l(m){return m===58?(e.consume(m),r=0,c):(m===43||m===45||m===46||ti(m))&&r++<32?(e.consume(m),l):(r=0,d(m))}function c(m){return m===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):m===null||m===32||m===60||kb(m)?n(m):(e.consume(m),c)}function d(m){return m===64?(e.consume(m),f):u6(m)?(e.consume(m),d):n(m)}function f(m){return ti(m)?u(m):n(m)}function u(m){return m===46?(e.consume(m),r=0,f):m===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):p(m)}function p(m){if((m===45||ti(m))&&r++<63){const y=m===45?p:u;return e.consume(m),y}return n(m)}}const oy={partial:!0,tokenize:N6};function N6(e,t,n){return r;function r(i){return rn(i)?Ln(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||wt(i)?t(i):n(i)}}const SI={continuation:{tokenize:C6},exit:E6,name:"blockQuote",tokenize:j6};function j6(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 rn(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function C6(e,t,n){const r=this;return s;function s(a){return rn(a)?Ln(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):i(a)}function i(a){return e.attempt(SI,t,n)(a)}}function E6(e){e.exit("blockQuote")}const NI={name:"characterEscape",tokenize:_6};function _6(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 f6(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const jI={name:"characterReference",tokenize:P6};function P6(e,t,n){const r=this;let s=0,i,a;return l;function l(u){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(u),e.exit("characterReferenceMarker"),c}function c(u){return u===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(u),e.exit("characterReferenceMarkerNumeric"),d):(e.enter("characterReferenceValue"),i=31,a=ti,f(u))}function d(u){return u===88||u===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(u),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,a=d6,f):(e.enter("characterReferenceValue"),i=7,a=Sb,f(u))}function f(u){if(u===59&&s){const p=e.exit("characterReferenceValue");return a===ti&&!w0(r.sliceSerialize(p))?n(u):(e.enter("characterReferenceMarker"),e.consume(u),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(u)&&s++<i?(e.consume(u),f):n(u)}}const XN={partial:!0,tokenize:I6},JN={concrete:!0,name:"codeFenced",tokenize:A6};function A6(e,t,n){const r=this,s={partial:!0,tokenize:_};let i=0,a=0,l;return c;function c(C){return d(C)}function d(C){const T=r.events[r.events.length-1];return i=T&&T[1].type==="linePrefix"?T[2].sliceSerialize(T[1],!0).length:0,l=C,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),f(C)}function f(C){return C===l?(a++,e.consume(C),f):a<3?n(C):(e.exit("codeFencedFenceSequence"),rn(C)?Ln(e,u,"whitespace")(C):u(C))}function u(C){return C===null||wt(C)?(e.exit("codeFencedFence"),r.interrupt?t(C):e.check(XN,b,N)(C)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(C))}function p(C){return C===null||wt(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),u(C)):rn(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ln(e,m,"whitespace")(C)):C===96&&C===l?n(C):(e.consume(C),p)}function m(C){return C===null||wt(C)?u(C):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),y(C))}function y(C){return C===null||wt(C)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),u(C)):C===96&&C===l?n(C):(e.consume(C),y)}function b(C){return e.attempt(s,N,k)(C)}function k(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),g}function g(C){return i>0&&rn(C)?Ln(e,v,"linePrefix",i+1)(C):v(C)}function v(C){return C===null||wt(C)?e.check(XN,b,N)(C):(e.enter("codeFlowValue"),x(C))}function x(C){return C===null||wt(C)?(e.exit("codeFlowValue"),v(C)):(e.consume(C),x)}function N(C){return e.exit("codeFenced"),t(C)}function _(C,T,H){let M=0;return F;function F(R){return C.enter("lineEnding"),C.consume(R),C.exit("lineEnding"),D}function D(R){return C.enter("codeFencedFence"),rn(R)?Ln(C,$,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):$(R)}function $(R){return R===l?(C.enter("codeFencedFenceSequence"),W(R)):H(R)}function W(R){return R===l?(M++,C.consume(R),W):M>=a?(C.exit("codeFencedFenceSequence"),rn(R)?Ln(C,O,"whitespace")(R):O(R)):H(R)}function O(R){return R===null||wt(R)?(C.exit("codeFencedFence"),T(R)):H(R)}}}function I6(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 vx={name:"codeIndented",tokenize:R6},T6={partial:!0,tokenize:L6};function R6(e,t,n){const r=this;return s;function s(d){return e.enter("codeIndented"),Ln(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?c(d):wt(d)?e.attempt(T6,a,c)(d):(e.enter("codeFlowValue"),l(d))}function l(d){return d===null||wt(d)?(e.exit("codeFlowValue"),a(d)):(e.consume(d),l)}function c(d){return e.exit("codeIndented"),t(d)}}function L6(e,t,n){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?n(a):wt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):Ln(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):wt(a)?s(a):n(a)}}const M6={name:"codeText",previous:$6,resolve:O6,tokenize:D6};function O6(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 $6(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function D6(e,t,n){let r=0,s,i;return a;function a(u){return e.enter("codeText"),e.enter("codeTextSequence"),l(u)}function l(u){return u===96?(e.consume(u),r++,l):(e.exit("codeTextSequence"),c(u))}function c(u){return u===null?n(u):u===32?(e.enter("space"),e.consume(u),e.exit("space"),c):u===96?(i=e.enter("codeTextSequence"),s=0,f(u)):wt(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c):(e.enter("codeTextData"),d(u))}function d(u){return u===null||u===32||u===96||wt(u)?(e.exit("codeTextData"),c(u)):(e.consume(u),d)}function f(u){return u===96?(e.consume(u),s++,f):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(u)):(i.type="codeTextData",d(u))}}class F6{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&&$d(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),$d(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),$d(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);$d(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);$d(this.left,n.reverse())}}}function $d(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 CI(e){const t={};let n=-1,r,s,i,a,l,c,d;const f=new F6(e);for(;++n<f.length;){for(;n in t;)n=t[n];if(r=f.get(n),n&&r[1].type==="chunkFlow"&&f.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type==="lineEndingBlank"&&(i+=2),i<c.length&&c[i][1].type==="content"))for(;++i<c.length&&c[i][1].type!=="content";)c[i][1].type==="chunkText"&&(c[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,z6(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 To(e,0,Number.POSITIVE_INFINITY,f.slice(0)),!d}function z6(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const i=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const l=a.events,c=[],d={};let f,u,p=-1,m=n,y=0,b=0;const k=[b];for(;m;){for(;e.get(++s)[1]!==m;);i.push(s),m._tokenizer||(f=r.sliceStream(m),m.next||f.push(null),u&&a.defineSkip(m.start),m._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(f),m._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),u=m,m=m.next}for(m=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&&(b=p+1,k.push(b),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(a.events=[],m?(m._tokenizer=void 0,m.previous=void 0):k.pop(),p=k.length;p--;){const g=l.slice(k[p],k[p+1]),v=i.pop();c.push([v,v+g.length-1]),e.splice(v,2,g)}for(c.reverse(),p=-1;++p<c.length;)d[y+c[p][0]]=y+c[p][1],y+=c[p][1]-c[p][0]-1;return d}const H6={resolve:W6,tokenize:V6},B6={partial:!0,tokenize:U6};function W6(e){return CI(e),e}function V6(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):wt(l)?e.check(B6,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 U6(e,t,n){const r=this;return s;function s(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Ln(e,i,"linePrefix")}function i(a){if(a===null||wt(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 EI(e,t,n,r,s,i,a,l,c){const d=c||Number.POSITIVE_INFINITY;let f=0;return u;function u(g){return g===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(g),e.exit(i),p):g===null||g===32||g===41||kb(g)?n(g):(e.enter(r),e.enter(a),e.enter(l),e.enter("chunkString",{contentType:"string"}),b(g))}function p(g){return g===62?(e.enter(i),e.consume(g),e.exit(i),e.exit(s),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),m(g))}function m(g){return g===62?(e.exit("chunkString"),e.exit(l),p(g)):g===null||g===60||wt(g)?n(g):(e.consume(g),g===92?y:m)}function y(g){return g===60||g===62||g===92?(e.consume(g),m):m(g)}function b(g){return!f&&(g===null||g===41||Ds(g))?(e.exit("chunkString"),e.exit(l),e.exit(a),e.exit(r),t(g)):f<d&&g===40?(e.consume(g),f++,b):g===41?(e.consume(g),f--,b):g===null||g===32||g===40||kb(g)?n(g):(e.consume(g),g===92?k:b)}function k(g){return g===40||g===41||g===92?(e.consume(g),b):b(g)}}function _I(e,t,n,r,s,i){const a=this;let l=0,c;return d;function d(m){return e.enter(r),e.enter(s),e.consume(m),e.exit(s),e.enter(i),f}function f(m){return l>999||m===null||m===91||m===93&&!c||m===94&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(m):m===93?(e.exit(i),e.enter(s),e.consume(m),e.exit(s),e.exit(r),t):wt(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),f):(e.enter("chunkString",{contentType:"string"}),u(m))}function u(m){return m===null||m===91||m===93||wt(m)||l++>999?(e.exit("chunkString"),f(m)):(e.consume(m),c||(c=!rn(m)),m===92?p:u)}function p(m){return m===91||m===92||m===93?(e.consume(m),l++,u):u(m)}}function PI(e,t,n,r,s,i){let a;return l;function l(p){return p===34||p===39||p===40?(e.enter(r),e.enter(s),e.consume(p),e.exit(s),a=p===40?41:p,c):n(p)}function c(p){return p===a?(e.enter(s),e.consume(p),e.exit(s),e.exit(r),t):(e.enter(i),d(p))}function d(p){return p===a?(e.exit(i),c(a)):p===null?n(p):wt(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),Ln(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===a||p===null||wt(p)?(e.exit("chunkString"),d(p)):(e.consume(p),p===92?u:f)}function u(p){return p===a||p===92?(e.consume(p),f):f(p)}}function mf(e,t){let n;return r;function r(s){return wt(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):rn(s)?Ln(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const K6={name:"definition",tokenize:Y6},q6={partial:!0,tokenize:G6};function Y6(e,t,n){const r=this;let s;return i;function i(m){return e.enter("definition"),a(m)}function a(m){return _I.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function l(m){return s=wu(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),c):n(m)}function c(m){return Ds(m)?mf(e,d)(m):d(m)}function d(m){return EI(e,f,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function f(m){return e.attempt(q6,u,u)(m)}function u(m){return rn(m)?Ln(e,p,"whitespace")(m):p(m)}function p(m){return m===null||wt(m)?(e.exit("definition"),r.parser.defined.push(s),t(m)):n(m)}}function G6(e,t,n){return r;function r(l){return Ds(l)?mf(e,s)(l):n(l)}function s(l){return PI(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return rn(l)?Ln(e,a,"whitespace")(l):a(l)}function a(l){return l===null||wt(l)?t(l):n(l)}}const X6={name:"hardBreakEscape",tokenize:J6};function J6(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return wt(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const Q6={name:"headingAtx",resolve:Z6,tokenize:e8};function Z6(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"},To(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function e8(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||Ds(f)?(e.exit("atxHeadingSequence"),l(f)):n(f)}function l(f){return f===35?(e.enter("atxHeadingSequence"),c(f)):f===null||wt(f)?(e.exit("atxHeading"),t(f)):rn(f)?Ln(e,l,"whitespace")(f):(e.enter("atxHeadingText"),d(f))}function c(f){return f===35?(e.consume(f),c):(e.exit("atxHeadingSequence"),l(f))}function d(f){return f===null||f===35||Ds(f)?(e.exit("atxHeadingText"),l(f)):(e.consume(f),d)}}const t8=["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"],QN=["pre","script","style","textarea"],n8={concrete:!0,name:"htmlFlow",resolveTo:i8,tokenize:o8},r8={partial:!0,tokenize:l8},s8={partial:!0,tokenize:a8};function i8(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 o8(e,t,n){const r=this;let s,i,a,l,c;return d;function d(V){return f(V)}function f(V){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(V),u}function u(V){return V===33?(e.consume(V),p):V===47?(e.consume(V),i=!0,b):V===63?(e.consume(V),s=3,r.interrupt?t:E):So(V)?(e.consume(V),a=String.fromCharCode(V),k):n(V)}function p(V){return V===45?(e.consume(V),s=2,m):V===91?(e.consume(V),s=5,l=0,y):So(V)?(e.consume(V),s=4,r.interrupt?t:E):n(V)}function m(V){return V===45?(e.consume(V),r.interrupt?t:E):n(V)}function y(V){const ie="CDATA[";return V===ie.charCodeAt(l++)?(e.consume(V),l===ie.length?r.interrupt?t:$:y):n(V)}function b(V){return So(V)?(e.consume(V),a=String.fromCharCode(V),k):n(V)}function k(V){if(V===null||V===47||V===62||Ds(V)){const ie=V===47,fe=a.toLowerCase();return!ie&&!i&&QN.includes(fe)?(s=1,r.interrupt?t(V):$(V)):t8.includes(a.toLowerCase())?(s=6,ie?(e.consume(V),g):r.interrupt?t(V):$(V)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(V):i?v(V):x(V))}return V===45||ti(V)?(e.consume(V),a+=String.fromCharCode(V),k):n(V)}function g(V){return V===62?(e.consume(V),r.interrupt?t:$):n(V)}function v(V){return rn(V)?(e.consume(V),v):F(V)}function x(V){return V===47?(e.consume(V),F):V===58||V===95||So(V)?(e.consume(V),N):rn(V)?(e.consume(V),x):F(V)}function N(V){return V===45||V===46||V===58||V===95||ti(V)?(e.consume(V),N):_(V)}function _(V){return V===61?(e.consume(V),C):rn(V)?(e.consume(V),_):x(V)}function C(V){return V===null||V===60||V===61||V===62||V===96?n(V):V===34||V===39?(e.consume(V),c=V,T):rn(V)?(e.consume(V),C):H(V)}function T(V){return V===c?(e.consume(V),c=null,M):V===null||wt(V)?n(V):(e.consume(V),T)}function H(V){return V===null||V===34||V===39||V===47||V===60||V===61||V===62||V===96||Ds(V)?_(V):(e.consume(V),H)}function M(V){return V===47||V===62||rn(V)?x(V):n(V)}function F(V){return V===62?(e.consume(V),D):n(V)}function D(V){return V===null||wt(V)?$(V):rn(V)?(e.consume(V),D):n(V)}function $(V){return V===45&&s===2?(e.consume(V),I):V===60&&s===1?(e.consume(V),z):V===62&&s===4?(e.consume(V),X):V===63&&s===3?(e.consume(V),E):V===93&&s===5?(e.consume(V),L):wt(V)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(r8,ee,W)(V)):V===null||wt(V)?(e.exit("htmlFlowData"),W(V)):(e.consume(V),$)}function W(V){return e.check(s8,O,ee)(V)}function O(V){return e.enter("lineEnding"),e.consume(V),e.exit("lineEnding"),R}function R(V){return V===null||wt(V)?W(V):(e.enter("htmlFlowData"),$(V))}function I(V){return V===45?(e.consume(V),E):$(V)}function z(V){return V===47?(e.consume(V),a="",P):$(V)}function P(V){if(V===62){const ie=a.toLowerCase();return QN.includes(ie)?(e.consume(V),X):$(V)}return So(V)&&a.length<8?(e.consume(V),a+=String.fromCharCode(V),P):$(V)}function L(V){return V===93?(e.consume(V),E):$(V)}function E(V){return V===62?(e.consume(V),X):V===45&&s===2?(e.consume(V),E):$(V)}function X(V){return V===null||wt(V)?(e.exit("htmlFlowData"),ee(V)):(e.consume(V),X)}function ee(V){return e.exit("htmlFlow"),t(V)}}function a8(e,t,n){const r=this;return s;function s(a){return wt(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 l8(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(oy,t,n)}}const c8={name:"htmlText",tokenize:u8};function u8(e,t,n){const r=this;let s,i,a;return l;function l(E){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(E),c}function c(E){return E===33?(e.consume(E),d):E===47?(e.consume(E),_):E===63?(e.consume(E),x):So(E)?(e.consume(E),H):n(E)}function d(E){return E===45?(e.consume(E),f):E===91?(e.consume(E),i=0,y):So(E)?(e.consume(E),v):n(E)}function f(E){return E===45?(e.consume(E),m):n(E)}function u(E){return E===null?n(E):E===45?(e.consume(E),p):wt(E)?(a=u,z(E)):(e.consume(E),u)}function p(E){return E===45?(e.consume(E),m):u(E)}function m(E){return E===62?I(E):E===45?p(E):u(E)}function y(E){const X="CDATA[";return E===X.charCodeAt(i++)?(e.consume(E),i===X.length?b:y):n(E)}function b(E){return E===null?n(E):E===93?(e.consume(E),k):wt(E)?(a=b,z(E)):(e.consume(E),b)}function k(E){return E===93?(e.consume(E),g):b(E)}function g(E){return E===62?I(E):E===93?(e.consume(E),g):b(E)}function v(E){return E===null||E===62?I(E):wt(E)?(a=v,z(E)):(e.consume(E),v)}function x(E){return E===null?n(E):E===63?(e.consume(E),N):wt(E)?(a=x,z(E)):(e.consume(E),x)}function N(E){return E===62?I(E):x(E)}function _(E){return So(E)?(e.consume(E),C):n(E)}function C(E){return E===45||ti(E)?(e.consume(E),C):T(E)}function T(E){return wt(E)?(a=T,z(E)):rn(E)?(e.consume(E),T):I(E)}function H(E){return E===45||ti(E)?(e.consume(E),H):E===47||E===62||Ds(E)?M(E):n(E)}function M(E){return E===47?(e.consume(E),I):E===58||E===95||So(E)?(e.consume(E),F):wt(E)?(a=M,z(E)):rn(E)?(e.consume(E),M):I(E)}function F(E){return E===45||E===46||E===58||E===95||ti(E)?(e.consume(E),F):D(E)}function D(E){return E===61?(e.consume(E),$):wt(E)?(a=D,z(E)):rn(E)?(e.consume(E),D):M(E)}function $(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),s=E,W):wt(E)?(a=$,z(E)):rn(E)?(e.consume(E),$):(e.consume(E),O)}function W(E){return E===s?(e.consume(E),s=void 0,R):E===null?n(E):wt(E)?(a=W,z(E)):(e.consume(E),W)}function O(E){return E===null||E===34||E===39||E===60||E===61||E===96?n(E):E===47||E===62||Ds(E)?M(E):(e.consume(E),O)}function R(E){return E===47||E===62||Ds(E)?M(E):n(E)}function I(E){return E===62?(e.consume(E),e.exit("htmlTextData"),e.exit("htmlText"),t):n(E)}function z(E){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),P}function P(E){return rn(E)?Ln(e,L,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):L(E)}function L(E){return e.enter("htmlTextData"),a(E)}}const v0={name:"labelEnd",resolveAll:h8,resolveTo:m8,tokenize:g8},d8={tokenize:y8},f8={tokenize:x8},p8={tokenize:w8};function h8(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&&To(e,0,e.length,n),e}function m8(e,t){let n=e.length,r=0,s,i,a,l;for(;n--;)if(s=e[n][1],i){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(a){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(i=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(a=n);const c={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},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",c,t],["enter",d,t]],l=Ni(l,e.slice(i+1,i+r+3)),l=Ni(l,[["enter",f,t]]),l=Ni(l,b0(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),l=Ni(l,[["exit",f,t],e[a-2],e[a-1],["exit",d,t]]),l=Ni(l,e.slice(a+1)),l=Ni(l,[["exit",c,t]]),To(e,i,e.length,l),e}function g8(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?u(p):(a=r.parser.defined.includes(wu(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),c):n(p)}function c(p){return p===40?e.attempt(d8,f,a?f:u)(p):p===91?e.attempt(f8,f,a?d:u)(p):a?f(p):u(p)}function d(p){return e.attempt(p8,f,u)(p)}function f(p){return t(p)}function u(p){return i._balanced=!0,n(p)}}function y8(e,t,n){return r;function r(u){return e.enter("resource"),e.enter("resourceMarker"),e.consume(u),e.exit("resourceMarker"),s}function s(u){return Ds(u)?mf(e,i)(u):i(u)}function i(u){return u===41?f(u):EI(e,a,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(u)}function a(u){return Ds(u)?mf(e,c)(u):f(u)}function l(u){return n(u)}function c(u){return u===34||u===39||u===40?PI(e,d,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(u):f(u)}function d(u){return Ds(u)?mf(e,f)(u):f(u)}function f(u){return u===41?(e.enter("resourceMarker"),e.consume(u),e.exit("resourceMarker"),e.exit("resource"),t):n(u)}}function x8(e,t,n){const r=this;return s;function s(l){return _I.call(r,e,i,a,"reference","referenceMarker","referenceString")(l)}function i(l){return r.parser.defined.includes(wu(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function a(l){return n(l)}}function w8(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 b8={name:"labelStartImage",resolveAll:v0.resolveAll,tokenize:v8};function v8(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 k8={name:"labelStartLink",resolveAll:v0.resolveAll,tokenize:S8};function S8(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 kx={name:"lineEnding",tokenize:N8};function N8(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ln(e,t,"linePrefix")}}const pm={name:"thematicBreak",tokenize:j8};function j8(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"),c(d)):r>=3&&(d===null||wt(d))?(e.exit("thematicBreak"),t(d)):n(d)}function c(d){return d===s?(e.consume(d),r++,c):(e.exit("thematicBreakSequence"),rn(d)?Ln(e,l,"whitespace")(d):l(d))}}const Es={continuation:{tokenize:P8},exit:I8,name:"list",tokenize:_8},C8={partial:!0,tokenize:T8},E8={partial:!0,tokenize:A8};function _8(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(m){const y=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:Sb(m)){if(r.containerState.type||(r.containerState.type=y,e.enter(y,{_container:!0})),y==="listUnordered")return e.enter("listItemPrefix"),m===42||m===45?e.check(pm,n,d)(m):d(m);if(!r.interrupt||m===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(m)}return n(m)}function c(m){return Sb(m)&&++a<10?(e.consume(m),c):(!r.interrupt||a<2)&&(r.containerState.marker?m===r.containerState.marker:m===41||m===46)?(e.exit("listItemValue"),d(m)):n(m)}function d(m){return e.enter("listItemMarker"),e.consume(m),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||m,e.check(oy,r.interrupt?n:f,e.attempt(C8,p,u))}function f(m){return r.containerState.initialBlankLine=!0,i++,p(m)}function u(m){return rn(m)?(e.enter("listItemPrefixWhitespace"),e.consume(m),e.exit("listItemPrefixWhitespace"),p):n(m)}function p(m){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(m)}}function P8(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(oy,s,i);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ln(e,t,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!rn(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(E8,t,a)(l))}function a(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ln(e,e.attempt(Es,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function A8(e,t,n){const r=this;return Ln(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 I8(e){e.exit(this.containerState.type)}function T8(e,t,n){const r=this;return Ln(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!rn(i)&&a&&a[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const ZN={name:"setextUnderline",resolveTo:R8,tokenize:L8};function R8(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 L8(e,t,n){const r=this;let s;return i;function i(d){let f=r.events.length,u;for(;f--;)if(r.events[f][1].type!=="lineEnding"&&r.events[f][1].type!=="linePrefix"&&r.events[f][1].type!=="content"){u=r.events[f][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||u)?(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"),rn(d)?Ln(e,c,"lineSuffix")(d):c(d))}function c(d){return d===null||wt(d)?(e.exit("setextHeadingLine"),t(d)):n(d)}}const M8={tokenize:O8};function O8(e){const t=this,n=e.attempt(oy,r,e.attempt(this.parser.constructs.flowInitial,s,Ln(e,e.attempt(this.parser.constructs.flow,s,e.attempt(H6,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 $8={resolveAll:II()},D8=AI("string"),F8=AI("text");function AI(e){return{resolveAll:II(e==="text"?z8: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),c}function c(f){return d(f)?(n.exit("data"),i(f)):(n.consume(f),c)}function d(f){if(f===null)return!0;const u=s[f];let p=-1;if(u)for(;++p<u.length;){const m=u[p];if(!m.previous||m.previous.call(r,r.previous))return!0}return!1}}}function II(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 z8(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],s=t.sliceStream(r);let i=s.length,a=-1,l=0,c;for(;i--;){const 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)c=!0,l++;else if(d!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const d={type:n===e.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?a:r.start._bufferIndex+a,_index:r.start._index+i,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...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 H8={42:Es,43:Es,45:Es,48:Es,49:Es,50:Es,51:Es,52:Es,53:Es,54:Es,55:Es,56:Es,57:Es,62:SI},B8={91:K6},W8={[-2]:vx,[-1]:vx,32:vx},V8={35:Q6,42:pm,45:[ZN,pm],60:n8,61:ZN,95:pm,96:JN,126:JN},U8={38:jI,92:NI},K8={[-5]:kx,[-4]:kx,[-3]:kx,33:b8,38:jI,42:Nb,60:[k6,c8],91:k8,92:[X6,NI],93:v0,95:Nb,96:M6},q8={null:[Nb,$8]},Y8={null:[42,95]},G8={null:[]},X8=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Y8,contentInitial:B8,disable:G8,document:H8,flow:V8,flowInitial:W8,insideSpan:q8,string:U8,text:K8},Symbol.toStringTag,{value:"Module"}));function J8(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},i=[];let a=[],l=[];const c={attempt:T(_),check:T(C),consume:v,enter:x,exit:N,interrupt:T(C,{interrupt:!0})},d={code:null,containerState:{},defineSkip:b,events:[],now:y,parser:e,previous:null,sliceSerialize:p,sliceStream:m,write:u};let f=t.tokenize.call(d,c);return t.resolveAll&&i.push(t),d;function u(D){return a=Ni(a,D),k(),a[a.length-1]!==null?[]:(H(t,0),d.events=b0(i,d.events,d),d.events)}function p(D,$){return Z8(m(D),$)}function m(D){return Q8(a,D)}function y(){const{_bufferIndex:D,_index:$,line:W,column:O,offset:R}=r;return{_bufferIndex:D,_index:$,line:W,column:O,offset:R}}function b(D){s[D.line]=D.column,F()}function k(){let D;for(;r._index<a.length;){const $=a[r._index];if(typeof $=="string")for(D=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===D&&r._bufferIndex<$.length;)g($.charCodeAt(r._bufferIndex));else g($)}}function g(D){f=f(D)}function v(D){wt(D)?(r.line++,r.column=1,r.offset+=D===-3?2:1,F()):D!==-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=D}function x(D,$){const W=$||{};return W.type=D,W.start=y(),d.events.push(["enter",W,d]),l.push(W),W}function N(D){const $=l.pop();return $.end=y(),d.events.push(["exit",$,d]),$}function _(D,$){H(D,$.from)}function C(D,$){$.restore()}function T(D,$){return W;function W(O,R,I){let z,P,L,E;return Array.isArray(O)?ee(O):"tokenize"in O?ee([O]):X(O);function X(me){return ge;function ge(Z){const ae=Z!==null&&me[Z],xe=Z!==null&&me.null,pe=[...Array.isArray(ae)?ae:ae?[ae]:[],...Array.isArray(xe)?xe:xe?[xe]:[]];return ee(pe)(Z)}}function ee(me){return z=me,P=0,me.length===0?I:V(me[P])}function V(me){return ge;function ge(Z){return E=M(),L=me,me.partial||(d.currentConstruct=me),me.name&&d.parser.constructs.disable.null.includes(me.name)?fe():me.tokenize.call($?Object.assign(Object.create(d),$):d,c,ie,fe)(Z)}}function ie(me){return D(L,E),R}function fe(me){return E.restore(),++P<z.length?V(z[P]):I}}}function H(D,$){D.resolveAll&&!i.includes(D)&&i.push(D),D.resolve&&To(d.events,$,d.events.length-$,D.resolve(d.events.slice($),d)),D.resolveTo&&(d.events=D.resolveTo(d.events,d))}function M(){const D=y(),$=d.previous,W=d.currentConstruct,O=d.events.length,R=Array.from(l);return{from:O,restore:I};function I(){r=D,d.previous=$,d.currentConstruct=W,d.events.length=O,l=R,F()}}function F(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function Q8(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 Z8(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 eW(e){const r={constructs:a6([X8,...(e||{}).extensions||[]]),content:s(m6),defined:[],document:s(y6),flow:s(M8),lazy:{},string:s(D8),text:s(F8)};return r;function s(i){return a;function a(l){return J8(r,i,l)}}}function tW(e){for(;!CI(e););return e}const ej=/[\0\t\n\r]/g;function nW(){let e=1,t="",n=!0,r;return s;function s(i,a,l){const c=[];let d,f,u,p,m;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t="",n&&(i.charCodeAt(0)===65279&&u++,n=void 0);u<i.length;){if(ej.lastIndex=u,d=ej.exec(i),p=d&&d.index!==void 0?d.index:i.length,m=i.charCodeAt(p),!d){t=i.slice(u);break}if(m===10&&u===p&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),u<p&&(c.push(i.slice(u,p)),e+=p-u),m){case 0:{c.push(65533),e++;break}case 9:{for(f=Math.ceil(e/4)*4,c.push(-2);e++<f;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}u=p+1}return l&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const rW=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function sW(e){return e.replace(rW,iW)}function iW(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return kI(n.slice(i?2:1),i?16:10)}return w0(n)||e}const TI={}.hasOwnProperty;function oW(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),aW(n)(tW(eW(n).document().write(nW()(e,t,!0))))}function aW(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(bt),autolinkProtocol:M,autolinkEmail:M,atxHeading:i(et),blockQuote:i(xe),characterEscape:M,characterReference:M,codeFenced:i(pe),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:i(pe,a),codeText:i(_e,a),codeTextData:M,data:M,codeFlowValue:M,definition:i(je),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:i(Ve),hardBreakEscape:i(qe),hardBreakTrailing:i(qe),htmlFlow:i(dt,a),htmlFlowData:M,htmlText:i(dt,a),htmlTextData:M,image:i(He),label:a,link:i(bt),listItem:i(on),listItemValue:p,listOrdered:i(sn,u),listUnordered:i(sn),paragraph:i(an),reference:V,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:i(et),strong:i(Yt),thematicBreak:i(hn)},exit:{atxHeading:c(),atxHeadingSequence:_,autolink:c(),autolinkEmail:ae,autolinkProtocol:Z,blockQuote:c(),characterEscapeValue:F,characterReferenceMarkerHexadecimal:fe,characterReferenceMarkerNumeric:fe,characterReferenceValue:me,characterReference:ge,codeFenced:c(k),codeFencedFence:b,codeFencedFenceInfo:m,codeFencedFenceMeta:y,codeFlowValue:F,codeIndented:c(g),codeText:c(R),codeTextData:F,data:F,definition:c(),definitionDestinationString:N,definitionLabelString:v,definitionTitleString:x,emphasis:c(),hardBreakEscape:c($),hardBreakTrailing:c($),htmlFlow:c(W),htmlFlowData:F,htmlText:c(O),htmlTextData:F,image:c(z),label:L,labelText:P,lineEnding:D,link:c(I),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ie,resourceDestinationString:E,resourceTitleString:X,resource:ee,setextHeading:c(H),setextHeadingLineSequence:T,setextHeadingText:C,strong:c(),thematicBreak:c()}};RI(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(ue){let ke={type:"root",children:[]};const De={stack:[ke],tokenStack:[],config:t,enter:l,exit:d,buffer:a,resume:f,data:n},rt=[];let at=-1;for(;++at<ue.length;)if(ue[at][1].type==="listOrdered"||ue[at][1].type==="listUnordered")if(ue[at][0]==="enter")rt.push(at);else{const Lt=rt.pop();at=s(ue,Lt,at)}for(at=-1;++at<ue.length;){const Lt=t[ue[at][0]];TI.call(Lt,ue[at][1].type)&&Lt[ue[at][1].type].call(Object.assign({sliceSerialize:ue[at][2].sliceSerialize},De),ue[at][1])}if(De.tokenStack.length>0){const Lt=De.tokenStack[De.tokenStack.length-1];(Lt[1]||tj).call(De,void 0,Lt[0])}for(ke.position={start:Da(ue.length>0?ue[0][1].start:{line:1,column:1,offset:0}),end:Da(ue.length>0?ue[ue.length-2][1].end:{line:1,column:1,offset:0})},at=-1;++at<t.transforms.length;)ke=t.transforms[at](ke)||ke;return ke}function s(ue,ke,De){let rt=ke-1,at=-1,Lt=!1,st,mn,Zt,ar;for(;++rt<=De;){const _n=ue[rt];switch(_n[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{_n[0]==="enter"?at++:at--,ar=void 0;break}case"lineEndingBlank":{_n[0]==="enter"&&(st&&!ar&&!at&&!Zt&&(Zt=rt),ar=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ar=void 0}if(!at&&_n[0]==="enter"&&_n[1].type==="listItemPrefix"||at===-1&&_n[0]==="exit"&&(_n[1].type==="listUnordered"||_n[1].type==="listOrdered")){if(st){let gn=rt;for(mn=void 0;gn--;){const bn=ue[gn];if(bn[1].type==="lineEnding"||bn[1].type==="lineEndingBlank"){if(bn[0]==="exit")continue;mn&&(ue[mn][1].type="lineEndingBlank",Lt=!0),bn[1].type="lineEnding",mn=gn}else if(!(bn[1].type==="linePrefix"||bn[1].type==="blockQuotePrefix"||bn[1].type==="blockQuotePrefixWhitespace"||bn[1].type==="blockQuoteMarker"||bn[1].type==="listItemIndent"))break}Zt&&(!mn||Zt<mn)&&(st._spread=!0),st.end=Object.assign({},mn?ue[mn][1].start:_n[1].end),ue.splice(mn||rt,0,["exit",st,_n[2]]),rt++,De++}if(_n[1].type==="listItemPrefix"){const gn={type:"listItem",_spread:!1,start:Object.assign({},_n[1].start),end:void 0};st=gn,ue.splice(rt,0,["enter",gn,_n[2]]),rt++,De++,Zt=void 0,ar=!0}}}return ue[ke][1]._spread=Lt,De}function i(ue,ke){return De;function De(rt){l.call(this,ue(rt),rt),ke&&ke.call(this,rt)}}function a(){this.stack.push({type:"fragment",children:[]})}function l(ue,ke,De){this.stack[this.stack.length-1].children.push(ue),this.stack.push(ue),this.tokenStack.push([ke,De||void 0]),ue.position={start:Da(ke.start),end:void 0}}function c(ue){return ke;function ke(De){ue&&ue.call(this,De),d.call(this,De)}}function d(ue,ke){const De=this.stack.pop(),rt=this.tokenStack.pop();if(rt)rt[0].type!==ue.type&&(ke?ke.call(this,ue,rt[0]):(rt[1]||tj).call(this,ue,rt[0]));else throw new Error("Cannot close `"+ue.type+"` ("+hf({start:ue.start,end:ue.end})+"): it’s not open");De.position.end=Da(ue.end)}function f(){return i6(this.stack.pop())}function u(){this.data.expectingFirstListItemValue=!0}function p(ue){if(this.data.expectingFirstListItemValue){const ke=this.stack[this.stack.length-2];ke.start=Number.parseInt(this.sliceSerialize(ue),10),this.data.expectingFirstListItemValue=void 0}}function m(){const ue=this.resume(),ke=this.stack[this.stack.length-1];ke.lang=ue}function y(){const ue=this.resume(),ke=this.stack[this.stack.length-1];ke.meta=ue}function b(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function k(){const ue=this.resume(),ke=this.stack[this.stack.length-1];ke.value=ue.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){const ue=this.resume(),ke=this.stack[this.stack.length-1];ke.value=ue.replace(/(\r?\n|\r)$/g,"")}function v(ue){const ke=this.resume(),De=this.stack[this.stack.length-1];De.label=ke,De.identifier=wu(this.sliceSerialize(ue)).toLowerCase()}function x(){const ue=this.resume(),ke=this.stack[this.stack.length-1];ke.title=ue}function N(){const ue=this.resume(),ke=this.stack[this.stack.length-1];ke.url=ue}function _(ue){const ke=this.stack[this.stack.length-1];if(!ke.depth){const De=this.sliceSerialize(ue).length;ke.depth=De}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function T(ue){const ke=this.stack[this.stack.length-1];ke.depth=this.sliceSerialize(ue).codePointAt(0)===61?1:2}function H(){this.data.setextHeadingSlurpLineEnding=void 0}function M(ue){const De=this.stack[this.stack.length-1].children;let rt=De[De.length-1];(!rt||rt.type!=="text")&&(rt=En(),rt.position={start:Da(ue.start),end:void 0},De.push(rt)),this.stack.push(rt)}function F(ue){const ke=this.stack.pop();ke.value+=this.sliceSerialize(ue),ke.position.end=Da(ue.end)}function D(ue){const ke=this.stack[this.stack.length-1];if(this.data.atHardBreak){const De=ke.children[ke.children.length-1];De.position.end=Da(ue.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ke.type)&&(M.call(this,ue),F.call(this,ue))}function $(){this.data.atHardBreak=!0}function W(){const ue=this.resume(),ke=this.stack[this.stack.length-1];ke.value=ue}function O(){const ue=this.resume(),ke=this.stack[this.stack.length-1];ke.value=ue}function R(){const ue=this.resume(),ke=this.stack[this.stack.length-1];ke.value=ue}function I(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const ke=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=ke,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function z(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const ke=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=ke,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function P(ue){const ke=this.sliceSerialize(ue),De=this.stack[this.stack.length-2];De.label=sW(ke),De.identifier=wu(ke).toLowerCase()}function L(){const ue=this.stack[this.stack.length-1],ke=this.resume(),De=this.stack[this.stack.length-1];if(this.data.inReference=!0,De.type==="link"){const rt=ue.children;De.children=rt}else De.alt=ke}function E(){const ue=this.resume(),ke=this.stack[this.stack.length-1];ke.url=ue}function X(){const ue=this.resume(),ke=this.stack[this.stack.length-1];ke.title=ue}function ee(){this.data.inReference=void 0}function V(){this.data.referenceType="collapsed"}function ie(ue){const ke=this.resume(),De=this.stack[this.stack.length-1];De.label=ke,De.identifier=wu(this.sliceSerialize(ue)).toLowerCase(),this.data.referenceType="full"}function fe(ue){this.data.characterReferenceType=ue.type}function me(ue){const ke=this.sliceSerialize(ue),De=this.data.characterReferenceType;let rt;De?(rt=kI(ke,De==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):rt=w0(ke);const at=this.stack[this.stack.length-1];at.value+=rt}function ge(ue){const ke=this.stack.pop();ke.position.end=Da(ue.end)}function Z(ue){F.call(this,ue);const ke=this.stack[this.stack.length-1];ke.url=this.sliceSerialize(ue)}function ae(ue){F.call(this,ue);const ke=this.stack[this.stack.length-1];ke.url="mailto:"+this.sliceSerialize(ue)}function xe(){return{type:"blockquote",children:[]}}function pe(){return{type:"code",lang:null,meta:null,value:""}}function _e(){return{type:"inlineCode",value:""}}function je(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ve(){return{type:"emphasis",children:[]}}function et(){return{type:"heading",depth:0,children:[]}}function qe(){return{type:"break"}}function dt(){return{type:"html",value:""}}function He(){return{type:"image",title:null,url:"",alt:null}}function bt(){return{type:"link",title:null,url:"",children:[]}}function sn(ue){return{type:"list",ordered:ue.type==="listOrdered",start:null,spread:ue._spread,children:[]}}function on(ue){return{type:"listItem",spread:ue._spread,checked:null,children:[]}}function an(){return{type:"paragraph",children:[]}}function Yt(){return{type:"strong",children:[]}}function En(){return{type:"text",value:""}}function hn(){return{type:"thematicBreak"}}}function Da(e){return{line:e.line,column:e.column,offset:e.offset}}function RI(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?RI(e,r):lW(e,r)}}function lW(e,t){let n;for(n in t)if(TI.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 tj(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+hf({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+hf({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+hf({start:t.start,end:t.end})+") is still open")}function cW(e){const t=this;t.parser=n;function n(r){return oW(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function uW(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 dW(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
70
|
+
`}]}function fW(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 pW(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function hW(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function mW(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=Gu(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let a,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=i+1,l+=1,e.footnoteCounts.set(r,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,c);const d={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,d),e.applyData(t,d)}function gW(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 yW(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function LI(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 xW(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return LI(e,t);const s={src:Gu(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 wW(e,t){const n={src:Gu(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 bW(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 vW(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return LI(e,t);const s={href:Gu(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 kW(e,t){const n={href:Gu(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 SW(e,t,n){const r=e.all(t),s=n?NW(n):MI(t),i={},a=[];if(typeof t.checked=="boolean"){const f=r[0];let u;f&&f.type==="element"&&f.tagName==="p"?u=f:(u={type:"element",tagName:"p",properties:{},children:[]},r.unshift(u)),u.children.length>0&&u.children.unshift({type:"text",value:" "}),u.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const f=r[l];(s||l!==0||f.type!=="element"||f.tagName!=="p")&&a.push({type:"text",value:`
|
|
72
|
+
`}),f.type==="element"&&f.tagName==="p"&&!s?a.push(...f.children):a.push(f)}const c=r[r.length-1];c&&(s||c.type!=="element"||c.tagName!=="p")&&a.push({type:"text",value:`
|
|
73
|
+
`});const d={type:"element",tagName:"li",properties:i,children:a};return e.patch(t,d),e.applyData(t,d)}function NW(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=MI(n[r])}return t}function MI(e){const t=e.spread;return t??e.children.length>1}function jW(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 CW(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function EW(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function _W(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function PW(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=m0(t.children[1]),c=mI(t.children[t.children.length-1]);l&&c&&(a.position={start:l,end:c}),s.push(a)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function AW(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,l=a?a.length:t.children.length;let c=-1;const d=[];for(;++c<l;){const u=t.children[c],p={},m=a?a[c]:void 0;m&&(p.align=m);let y={type:"element",tagName:i,properties:p,children:[]};u&&(y.children=e.all(u),e.patch(u,y),y=e.applyData(u,y)),d.push(y)}const f={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(t,f),e.applyData(t,f)}function IW(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const nj=9,rj=32;function TW(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const i=[];for(;r;)i.push(sj(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(sj(t.slice(s),s>0,!1)),i.join("")}function sj(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===nj||i===rj;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===nj||i===rj;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function RW(e,t){const n={type:"text",value:TW(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function LW(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const MW={blockquote:uW,break:dW,code:fW,delete:pW,emphasis:hW,footnoteReference:mW,heading:gW,html:yW,imageReference:xW,image:wW,inlineCode:bW,linkReference:vW,link:kW,listItem:SW,list:jW,paragraph:CW,root:EW,strong:_W,table:PW,tableCell:IW,tableRow:AW,text:RW,thematicBreak:LW,toml:Rh,yaml:Rh,definition:Rh,footnoteDefinition:Rh};function Rh(){}const OI=-1,ay=0,gf=1,rg=2,k0=3,S0=4,N0=5,j0=6,$I=7,DI=8,ij=typeof self=="object"?self:globalThis,OW=(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 ay:case OI:return n(a,s);case gf:{const l=n([],s);for(const c of a)l.push(r(c));return l}case rg:{const l=n({},s);for(const[c,d]of a)l[r(c)]=r(d);return l}case k0:return n(new Date(a),s);case S0:{const{source:l,flags:c}=a;return n(new RegExp(l,c),s)}case N0:{const l=n(new Map,s);for(const[c,d]of a)l.set(r(c),r(d));return l}case j0:{const l=n(new Set,s);for(const c of a)l.add(r(c));return l}case $I:{const{name:l,message:c}=a;return n(new ij[l](c),s)}case DI: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 ij[i](a),s)};return r},oj=e=>OW(new Map,e)(0),Dc="",{toString:$W}={},{keys:DW}=Object,Dd=e=>{const t=typeof e;if(t!=="object"||!e)return[ay,t];const n=$W.call(e).slice(8,-1);switch(n){case"Array":return[gf,Dc];case"Object":return[rg,Dc];case"Date":return[k0,Dc];case"RegExp":return[S0,Dc];case"Map":return[N0,Dc];case"Set":return[j0,Dc];case"DataView":return[gf,n]}return n.includes("Array")?[gf,n]:n.includes("Error")?[$I,n]:[rg,n]},Lh=([e,t])=>e===ay&&(t==="function"||t==="symbol"),FW=(e,t,n,r)=>{const s=(a,l)=>{const c=r.push(a)-1;return n.set(l,c),c},i=a=>{if(n.has(a))return n.get(a);let[l,c]=Dd(a);switch(l){case ay:{let f=a;switch(c){case"bigint":l=DI,f=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);f=null;break;case"undefined":return s([OI],a)}return s([l,f],a)}case gf:{if(c){let p=a;return c==="DataView"?p=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(p=new Uint8Array(a)),s([c,[...p]],a)}const f=[],u=s([l,f],a);for(const p of a)f.push(i(p));return u}case rg:{if(c)switch(c){case"BigInt":return s([c,a.toString()],a);case"Boolean":case"Number":case"String":return s([c,a.valueOf()],a)}if(t&&"toJSON"in a)return i(a.toJSON());const f=[],u=s([l,f],a);for(const p of DW(a))(e||!Lh(Dd(a[p])))&&f.push([i(p),i(a[p])]);return u}case k0:return s([l,a.toISOString()],a);case S0:{const{source:f,flags:u}=a;return s([l,{source:f,flags:u}],a)}case N0:{const f=[],u=s([l,f],a);for(const[p,m]of a)(e||!(Lh(Dd(p))||Lh(Dd(m))))&&f.push([i(p),i(m)]);return u}case j0:{const f=[],u=s([l,f],a);for(const p of a)(e||!Lh(Dd(p)))&&f.push(i(p));return u}}const{message:d}=a;return s([l,{name:c,message:d}],a)};return i},aj=(e,{json:t,lossy:n}={})=>{const r=[];return FW(!(t||n),!!t,new Map,r)(e),r},sg=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?oj(aj(e,t)):structuredClone(e):(e,t)=>oj(aj(e,t));function zW(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 HW(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function BW(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||zW,r=e.options.footnoteBackLabel||HW,s=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<e.footnoteOrder.length;){const d=e.footnoteById.get(e.footnoteOrder[c]);if(!d)continue;const f=e.all(d),u=String(d.identifier).toUpperCase(),p=Gu(u.toLowerCase());let m=0;const y=[],b=e.footnoteCounts.get(u);for(;b!==void 0&&++m<=b;){y.length>0&&y.push({type:"text",value:" "});let v=typeof n=="string"?n:n(c,m);typeof v=="string"&&(v={type:"text",value:v}),y.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+p+(m>1?"-"+m:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,m),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const k=f[f.length-1];if(k&&k.type==="element"&&k.tagName==="p"){const v=k.children[k.children.length-1];v&&v.type==="text"?v.value+=" ":k.children.push({type:"text",value:" "}),k.children.push(...y)}else f.push(...y);const g={type:"element",tagName:"li",properties:{id:t+"fn-"+p},children:e.wrap(f,!0)};e.patch(d,g),l.push(g)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...sg(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 FI=function(e){if(e==null)return KW;if(typeof e=="function")return ly(e);if(typeof e=="object")return Array.isArray(e)?WW(e):VW(e);if(typeof e=="string")return UW(e);throw new Error("Expected function, string, or object as test")};function WW(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=FI(e[n]);return ly(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function VW(e){const t=e;return ly(n);function n(r){const s=r;let i;for(i in e)if(s[i]!==t[i])return!1;return!0}}function UW(e){return ly(t);function t(n){return n&&n.type===e}}function ly(e){return t;function t(n,r,s){return!!(qW(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function KW(){return!0}function qW(e){return e!==null&&typeof e=="object"&&"type"in e}const zI=[],YW=!0,lj=!1,GW="skip";function XW(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const i=FI(s),a=r?-1:1;l(e,void 0,[])();function l(c,d,f){const u=c&&typeof c=="object"?c:{};if(typeof u.type=="string"){const m=typeof u.tagName=="string"?u.tagName:typeof u.name=="string"?u.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(c.type+(m?"<"+m+">":""))+")"})}return p;function p(){let m=zI,y,b,k;if((!t||i(c,d,f[f.length-1]||void 0))&&(m=JW(n(c,f)),m[0]===lj))return m;if("children"in c&&c.children){const g=c;if(g.children&&m[0]!==GW)for(b=(r?g.children.length:-1)+a,k=f.concat(g);b>-1&&b<g.children.length;){const v=g.children[b];if(y=l(v,b,k)(),y[0]===lj)return y;b=typeof y[1]=="number"?y[1]:b+a}}return m}}}function JW(e){return Array.isArray(e)?e:typeof e=="number"?[YW,e]:e==null?zI:[e]}function HI(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),XW(e,i,l,s);function l(c,d){const f=d[d.length-1],u=f?f.children.indexOf(c):void 0;return a(c,u,f)}}const jb={}.hasOwnProperty,QW={};function ZW(e,t){const n=t||QW,r=new Map,s=new Map,i=new Map,a={...MW,...n.handlers},l={all:d,applyData:t9,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:a,one:c,options:n,patch:e9,wrap:r9};return HI(e,function(f){if(f.type==="definition"||f.type==="footnoteDefinition"){const u=f.type==="definition"?r:s,p=String(f.identifier).toUpperCase();u.has(p)||u.set(p,f)}}),l;function c(f,u){const p=f.type,m=l.handlers[p];if(jb.call(l.handlers,p)&&m)return m(l,f,u);if(l.options.passThrough&&l.options.passThrough.includes(p)){if("children"in f){const{children:b,...k}=f,g=sg(k);return g.children=l.all(f),g}return sg(f)}return(l.options.unknownHandler||n9)(l,f,u)}function d(f){const u=[];if("children"in f){const p=f.children;let m=-1;for(;++m<p.length;){const y=l.one(p[m],f);if(y){if(m&&p[m-1].type==="break"&&(!Array.isArray(y)&&y.type==="text"&&(y.value=cj(y.value)),!Array.isArray(y)&&y.type==="element")){const b=y.children[0];b&&b.type==="text"&&(b.value=cj(b.value))}Array.isArray(y)?u.push(...y):u.push(y)}}}return u}}function e9(e,t){e.position&&(t.position=$B(e))}function t9(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,sg(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function n9(e,t){const n=t.data||{},r="value"in t&&!(jb.call(n,"hProperties")||jb.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 r9(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 cj(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function uj(e,t){const n=ZW(e,t),r=n.one(e,void 0),s=BW(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 s9(e,t){return e&&"run"in e?async function(n,r){const s=uj(n,{file:r,...t});await e.run(s,r)}:function(n,r){return uj(n,{file:r,...e||t})}}function dj(e){if(e)throw e}var hm=Object.prototype.hasOwnProperty,BI=Object.prototype.toString,fj=Object.defineProperty,pj=Object.getOwnPropertyDescriptor,hj=function(t){return typeof Array.isArray=="function"?Array.isArray(t):BI.call(t)==="[object Array]"},mj=function(t){if(!t||BI.call(t)!=="[object Object]")return!1;var n=hm.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&hm.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||hm.call(t,s)},gj=function(t,n){fj&&n.name==="__proto__"?fj(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},yj=function(t,n){if(n==="__proto__")if(hm.call(t,n)){if(pj)return pj(t,n).value}else return;return t[n]},i9=function e(){var t,n,r,s,i,a,l=arguments[0],c=1,d=arguments.length,f=!1;for(typeof l=="boolean"&&(f=l,l=arguments[1]||{},c=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});c<d;++c)if(t=arguments[c],t!=null)for(n in t)r=yj(l,n),s=yj(t,n),l!==s&&(f&&s&&(mj(s)||(i=hj(s)))?(i?(i=!1,a=r&&hj(r)?r:[]):a=r&&mj(r)?r:{},gj(l,{name:n,newValue:e(f,a,s)})):typeof s<"u"&&gj(l,{name:n,newValue:s}));return l};const Sx=hl(i9);function Cb(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 o9(){const e=[],t={run:n,use:r};return t;function n(...s){let i=-1;const a=s.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);l(null,...s);function l(c,...d){const f=e[++i];let u=-1;if(c){a(c);return}for(;++u<s.length;)(d[u]===null||d[u]===void 0)&&(d[u]=s[u]);s=d,f?a9(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 a9(e,t){let n;return r;function r(...a){const l=e.length>a.length;let c;l&&a.push(s);try{c=e.apply(this,a)}catch(d){const f=d;if(l&&n)throw f;return s(f)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,s):c instanceof Error?s(c):i(c))}function s(a,...l){n||(n=!0,t(a,...l))}function i(a){s(null,a)}}const yo={basename:l9,dirname:c9,extname:u9,join:d9,sep:"/"};function l9(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');bp(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 c9(e){if(bp(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 u9(e){bp(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 d9(...e){let t=-1,n;for(;++t<e.length;)bp(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":f9(n)}function f9(e){bp(e);const t=e.codePointAt(0)===47;let n=p9(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function p9(e,t){let n="",r=0,s=-1,i=0,a=-1,l,c;for(;++a<=e.length;){if(a<e.length)l=e.codePointAt(a);else{if(l===47)break;l=47}if(l===47){if(!(s===a-1||i===1))if(s!==a-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),s=a,i=0;continue}}else if(n.length>0){n="",r=0,s=a,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,a):n=e.slice(s+1,a),r=a-s-1;s=a,i=0}else l===46&&i>-1?i++:i=-1}return n}function bp(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const h9={cwd:m9};function m9(){return"/"}function Eb(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function g9(e){if(typeof e=="string")e=new URL(e);else if(!Eb(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 y9(e)}function y9(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 Nx=["history","path","basename","stem","extname","dirname"];class WI{constructor(t){let n;t?Eb(t)?n={path:t}:typeof t=="string"||x9(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":h9.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Nx.length;){const i=Nx[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)Nx.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?yo.basename(this.path):void 0}set basename(t){Cx(t,"basename"),jx(t,"basename"),this.path=yo.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?yo.dirname(this.path):void 0}set dirname(t){xj(this.basename,"dirname"),this.path=yo.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?yo.extname(this.path):void 0}set extname(t){if(jx(t,"extname"),xj(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=yo.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Eb(t)&&(t=g9(t)),Cx(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?yo.basename(this.path,this.extname):void 0}set stem(t){Cx(t,"stem"),jx(t,"stem"),this.path=yo.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 is(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 jx(e,t){if(e&&e.includes(yo.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+yo.sep+"`")}function Cx(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function xj(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function x9(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const w9=function(e){const r=this.constructor.prototype,s=r[e],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},b9={}.hasOwnProperty;class C0 extends w9{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=o9()}copy(){const t=new C0;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Sx(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Px("data",this.frozen),this.namespace[t]=n,this):b9.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Px("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=Mh(t),r=this.parser||this.Parser;return Ex("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Ex("process",this.parser||this.Parser),_x("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,a){const l=Mh(t),c=r.parse(l);r.run(c,l,function(f,u,p){if(f||!u||!p)return d(f);const m=u,y=r.stringify(m,p);S9(y)?p.value=y:p.result=y,d(f,p)});function d(f,u){f||!u?a(f):i?i(u):n(void 0,u)}}}processSync(t){let n=!1,r;return this.freeze(),Ex("processSync",this.parser||this.Parser),_x("processSync",this.compiler||this.Compiler),this.process(t,s),bj("processSync","process",n),r;function s(i,a){n=!0,dj(i),r=a}}run(t,n,r){wj(t),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(a,l){const c=Mh(n);s.run(t,c,d);function d(f,u,p){const m=u||t;f?l(f):a?a(m):r(void 0,m,p)}}}runSync(t,n){let r=!1,s;return this.run(t,n,i),bj("runSync","run",r),s;function i(a,l){dj(a),s=l,r=!0}}stringify(t,n){this.freeze();const r=Mh(n),s=this.compiler||this.Compiler;return _x("stringify",s),wj(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(Px("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):a(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(d){if(typeof d=="function")c(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[f,...u]=d;c(f,u)}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=Sx(!0,s.settings,d.settings))}function l(d){let f=-1;if(d!=null)if(Array.isArray(d))for(;++f<d.length;){const u=d[f];i(u)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function c(d,f){let u=-1,p=-1;for(;++u<r.length;)if(r[u][0]===d){p=u;break}if(p===-1)r.push([d,...f]);else if(f.length>0){let[m,...y]=f;const b=r[p][1];Cb(b)&&Cb(m)&&(m=Sx(!0,b,m)),r[p]=[d,m,...y]}}}}const v9=new C0().freeze();function Ex(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function _x(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Px(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 wj(e){if(!Cb(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function bj(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Mh(e){return k9(e)?e:new WI(e)}function k9(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function S9(e){return typeof e=="string"||N9(e)}function N9(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const j9="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",vj=[],kj={allowDangerousHtml:!0},C9=/^(https?|ircs?|mailto|xmpp)$/i,E9=[{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 vp(e){const t=_9(e),n=P9(e);return A9(t.runSync(t.parse(n),n),e)}function _9(e){const t=e.rehypePlugins||vj,n=e.remarkPlugins||vj,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...kj}:kj;return v9().use(cW).use(n).use(s9,r).use(t)}function P9(e){const t=e.children||"",n=new WI;return typeof t=="string"&&(n.value=t),n}function A9(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,a=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||I9;for(const f of E9)Object.hasOwn(t,f.from)&&(""+f.from+(f.to?"use `"+f.to+"` instead":"remove it")+j9+f.id,void 0);return HI(e,d),BB(e,{Fragment:o.Fragment,components:s,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function d(f,u,p){if(f.type==="raw"&&p&&typeof u=="number")return a?p.children.splice(u,1):p.children[u]={type:"text",value:f.value},u;if(f.type==="element"){let m;for(m in bx)if(Object.hasOwn(bx,m)&&Object.hasOwn(f.properties,m)){const y=f.properties[m],b=bx[m];(b===null||b.includes(f.tagName))&&(f.properties[m]=c(String(y||""),m,f))}}if(f.type==="element"){let m=n?!n.includes(f.tagName):i?i.includes(f.tagName):!1;if(!m&&r&&typeof u=="number"&&(m=!r(f,u,p)),m&&p&&typeof u=="number")return l&&f.children?p.children.splice(u,1,...f.children):p.children.splice(u,1),u}}}function I9(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||C9.test(e.slice(0,t))?e:""}function T9(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function ig(e){if(e==null)return"null";if(typeof e!="object")return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(r=>ig(r)).join(",")}]`;const t=e;return`{${Object.keys(t).sort().map(r=>`${JSON.stringify(r)}:${ig(t[r])}`).join(",")}}`}function Sj(e){return ig({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 Xf(e){const t=e.sourceHandle??"",n=e.targetHandle??"";return`${e.source}|${t}|${e.target}|${n}`}function Nj(e){return ig({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 jj(e,t){return!T9(t)||!("selected"in t)||t.selected===e.selected?e:{...e,selected:!!t.selected}}function Cj(e,t=!1){const n=new Map;for(const r of e){const s=Xf(r);if(t&&n.has(s))throw new Error(`存在重复连线键: ${s}`);n.set(s,r)}return n}function R9(e,t,n,r){const s=new Map(e.map(v=>[v.id,v])),i=new Set(n.map(v=>v.id)),a=new Set,l=[],c=[],d=n.map(v=>{const x=s.get(v.id);return x?Sj(x)===Sj(v)?(a.add(v.id),x):(c.push(v.id),jj(v,x)):(l.push(v.id),v)}),f=Cj(t),u=Cj(r,!0),p=new Set,m=[],y=[],b=r.map(v=>{const x=Xf(v),N=f.get(x);return N?Nj(N)===Nj(v)?(p.add(x),N):(y.push(x),jj(v,N)):(m.push(x),v)}),k=e.filter(v=>!i.has(v.id)).map(v=>v.id),g=t.map(v=>Xf(v)).filter(v=>!u.has(v));return{nodes:d,edges:b,changes:{addedNodeIds:l,updatedNodeIds:c,removedNodeIds:k,addedEdgeKeys:m,updatedEdgeKeys:y,removedEdgeKeys:g},stats:{nodeAdded:l.length,nodeRemoved:k.length,nodeReused:a.size,edgeAdded:m.length,edgeRemoved:g.length,edgeReused:p.size,nextEdgeCount:u.size}}}/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */function VI(e){return typeof e>"u"||e===null}function L9(e){return typeof e=="object"&&e!==null}function M9(e){return Array.isArray(e)?e:VI(e)?[]:[e]}function O9(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 $9(e,t){var n="",r;for(r=0;r<t;r+=1)n+=e;return n}function D9(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var F9=VI,z9=L9,H9=M9,B9=$9,W9=D9,V9=O9,Nr={isNothing:F9,isObject:z9,toArray:H9,repeat:B9,isNegativeZero:W9,extend:V9};function UI(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 Jf(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=UI(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}Jf.prototype=Object.create(Error.prototype);Jf.prototype.constructor=Jf;Jf.prototype.toString=function(t){return this.name+": "+UI(this,t)};var hs=Jf;function Ax(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 Ix(e,t){return Nr.repeat(" ",t-e.length)+e}function U9(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="",c,d,f=Math.min(e.line+t.linesAfter,s.length).toString().length,u=t.maxLength-(t.indent+f+3);for(c=1;c<=t.linesBefore&&!(a-c<0);c++)d=Ax(e.buffer,r[a-c],s[a-c],e.position-(r[a]-r[a-c]),u),l=Nr.repeat(" ",t.indent)+Ix((e.line-c+1).toString(),f)+" | "+d.str+`
|
|
82
|
+
`+l;for(d=Ax(e.buffer,r[a],s[a],e.position,u),l+=Nr.repeat(" ",t.indent)+Ix((e.line+1).toString(),f)+" | "+d.str+`
|
|
83
|
+
`,l+=Nr.repeat("-",t.indent+f+3+d.pos)+`^
|
|
84
|
+
`,c=1;c<=t.linesAfter&&!(a+c>=s.length);c++)d=Ax(e.buffer,r[a+c],s[a+c],e.position-(r[a]-r[a+c]),u),l+=Nr.repeat(" ",t.indent)+Ix((e.line+c+1).toString(),f)+" | "+d.str+`
|
|
85
|
+
`;return l.replace(/\n$/,"")}var K9=U9,q9=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],Y9=["scalar","sequence","mapping"];function G9(e){var t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(r){t[String(r)]=n})}),t}function X9(e,t){if(t=t||{},Object.keys(t).forEach(function(n){if(q9.indexOf(n)===-1)throw new hs('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=G9(t.styleAliases||null),Y9.indexOf(this.kind)===-1)throw new hs('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var Hr=X9;function Ej(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 J9(){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 _b(e){return this.extend(e)}_b.prototype.extend=function(t){var n=[],r=[];if(t instanceof Hr)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 hs("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(i){if(!(i instanceof Hr))throw new hs("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(i.loadKind&&i.loadKind!=="scalar")throw new hs("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 hs("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 Hr))throw new hs("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var s=Object.create(_b.prototype);return s.implicit=(this.implicit||[]).concat(n),s.explicit=(this.explicit||[]).concat(r),s.compiledImplicit=Ej(s,"implicit"),s.compiledExplicit=Ej(s,"explicit"),s.compiledTypeMap=J9(s.compiledImplicit,s.compiledExplicit),s};var KI=_b,qI=new Hr("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),YI=new Hr("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),GI=new Hr("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),XI=new KI({explicit:[qI,YI,GI]});function Q9(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function Z9(){return null}function eV(e){return e===null}var JI=new Hr("tag:yaml.org,2002:null",{kind:"scalar",resolve:Q9,construct:Z9,predicate:eV,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function tV(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 nV(e){return e==="true"||e==="True"||e==="TRUE"}function rV(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var QI=new Hr("tag:yaml.org,2002:bool",{kind:"scalar",resolve:tV,construct:nV,predicate:rV,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 sV(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function iV(e){return 48<=e&&e<=55}function oV(e){return 48<=e&&e<=57}function aV(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(!sV(e.charCodeAt(n)))return!1;r=!0}return r&&s!=="_"}if(s==="o"){for(n++;n<t;n++)if(s=e[n],s!=="_"){if(!iV(e.charCodeAt(n)))return!1;r=!0}return r&&s!=="_"}}if(s==="_")return!1;for(;n<t;n++)if(s=e[n],s!=="_"){if(!oV(e.charCodeAt(n)))return!1;r=!0}return!(!r||s==="_")}function lV(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 cV(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!Nr.isNegativeZero(e)}var ZI=new Hr("tag:yaml.org,2002:int",{kind:"scalar",resolve:aV,construct:lV,predicate:cV,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"]}}),uV=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function dV(e){return!(e===null||!uV.test(e)||e[e.length-1]==="_")}function fV(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 pV=/^[-+]?[0-9]+e/;function hV(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(Nr.isNegativeZero(e))return"-0.0";return n=e.toString(10),pV.test(n)?n.replace("e",".e"):n}function mV(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||Nr.isNegativeZero(e))}var eT=new Hr("tag:yaml.org,2002:float",{kind:"scalar",resolve:dV,construct:fV,predicate:mV,represent:hV,defaultStyle:"lowercase"}),tT=XI.extend({implicit:[JI,QI,ZI,eT]}),nT=tT,rT=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),sT=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 gV(e){return e===null?!1:rT.exec(e)!==null||sT.exec(e)!==null}function yV(e){var t,n,r,s,i,a,l,c=0,d=null,f,u,p;if(t=rT.exec(e),t===null&&(t=sT.exec(e)),t===null)throw new Error("Date resolve error");if(n=+t[1],r=+t[2]-1,s=+t[3],!t[4])return new Date(Date.UTC(n,r,s));if(i=+t[4],a=+t[5],l=+t[6],t[7]){for(c=t[7].slice(0,3);c.length<3;)c+="0";c=+c}return t[9]&&(f=+t[10],u=+(t[11]||0),d=(f*60+u)*6e4,t[9]==="-"&&(d=-d)),p=new Date(Date.UTC(n,r,s,i,a,l,c)),d&&p.setTime(p.getTime()-d),p}function xV(e){return e.toISOString()}var iT=new Hr("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:gV,construct:yV,instanceOf:Date,represent:xV});function wV(e){return e==="<<"||e===null}var oT=new Hr("tag:yaml.org,2002:merge",{kind:"scalar",resolve:wV}),E0=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
86
|
+
\r`;function bV(e){if(e===null)return!1;var t,n,r=0,s=e.length,i=E0;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 vV(e){var t,n,r=e.replace(/[\r\n=]/g,""),s=r.length,i=E0,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 kV(e){var t="",n=0,r,s,i=e.length,a=E0;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 SV(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var aT=new Hr("tag:yaml.org,2002:binary",{kind:"scalar",resolve:bV,construct:vV,predicate:SV,represent:kV}),NV=Object.prototype.hasOwnProperty,jV=Object.prototype.toString;function CV(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,jV.call(s)!=="[object Object]")return!1;for(i in s)if(NV.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 EV(e){return e!==null?e:[]}var lT=new Hr("tag:yaml.org,2002:omap",{kind:"sequence",resolve:CV,construct:EV}),_V=Object.prototype.toString;function PV(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],_V.call(r)!=="[object Object]"||(s=Object.keys(r),s.length!==1))return!1;i[t]=[s[0],r[s[0]]]}return!0}function AV(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 cT=new Hr("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:PV,construct:AV}),IV=Object.prototype.hasOwnProperty;function TV(e){if(e===null)return!0;var t,n=e;for(t in n)if(IV.call(n,t)&&n[t]!==null)return!1;return!0}function RV(e){return e!==null?e:{}}var uT=new Hr("tag:yaml.org,2002:set",{kind:"mapping",resolve:TV,construct:RV}),_0=nT.extend({implicit:[iT,oT],explicit:[aT,lT,cT,uT]}),ul=Object.prototype.hasOwnProperty,og=1,dT=2,fT=3,ag=4,Tx=1,LV=2,_j=3,MV=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,OV=/[\x85\u2028\u2029]/,$V=/[,\[\]\{\}]/,pT=/^(?:!|!!|![a-z\-]+!)$/i,hT=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function Pj(e){return Object.prototype.toString.call(e)}function _o(e){return e===10||e===13}function rc(e){return e===9||e===32}function Is(e){return e===9||e===32||e===10||e===13}function au(e){return e===44||e===91||e===93||e===123||e===125}function DV(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}function FV(e){return e===120?2:e===117?4:e===85?8:0}function zV(e){return 48<=e&&e<=57?e-48:-1}function Aj(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 HV(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function mT(e,t,n){t==="__proto__"?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:n}):e[t]=n}var gT=new Array(256),yT=new Array(256);for(var Fc=0;Fc<256;Fc++)gT[Fc]=Aj(Fc)?1:0,yT[Fc]=Aj(Fc);function BV(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||_0,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 xT(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=K9(n),new hs(t,n)}function it(e,t){throw xT(e,t)}function lg(e,t){e.onWarning&&e.onWarning.call(null,xT(e,t))}var Ij={YAML:function(t,n,r){var s,i,a;t.version!==null&&it(t,"duplication of %YAML directive"),r.length!==1&&it(t,"YAML directive accepts exactly one argument"),s=/^([0-9]+)\.([0-9]+)$/.exec(r[0]),s===null&&it(t,"ill-formed argument of the YAML directive"),i=parseInt(s[1],10),a=parseInt(s[2],10),i!==1&&it(t,"unacceptable YAML version of the document"),t.version=r[0],t.checkLineBreaks=a<2,a!==1&&a!==2&&lg(t,"unsupported YAML version of the document")},TAG:function(t,n,r){var s,i;r.length!==2&&it(t,"TAG directive accepts exactly two arguments"),s=r[0],i=r[1],pT.test(s)||it(t,"ill-formed tag handle (first argument) of the TAG directive"),ul.call(t.tagMap,s)&&it(t,'there is a previously declared suffix for "'+s+'" tag handle'),hT.test(i)||it(t,"ill-formed tag prefix (second argument) of the TAG directive");try{i=decodeURIComponent(i)}catch{it(t,"tag prefix is malformed: "+i)}t.tagMap[s]=i}};function il(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||it(e,"expected valid JSON character");else MV.test(l)&&it(e,"the stream contains non-printable characters");e.result+=l}}function Tj(e,t,n,r){var s,i,a,l;for(Nr.isObject(n)||it(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],ul.call(t,i)||(mT(t,i,n[i]),r[i]=!0)}function lu(e,t,n,r,s,i,a,l,c){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])&&it(e,"nested arrays are not supported inside keys"),typeof s=="object"&&Pj(s[d])==="[object Object]"&&(s[d]="[object Object]");if(typeof s=="object"&&Pj(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)Tj(e,t,i[d],n);else Tj(e,t,i,n);else!e.json&&!ul.call(n,s)&&ul.call(t,s)&&(e.line=a||e.line,e.lineStart=l||e.lineStart,e.position=c||e.position,it(e,"duplicated mapping key")),mT(t,s,i),delete n[s];return t}function P0(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++):it(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function wr(e,t,n){for(var r=0,s=e.input.charCodeAt(e.position);s!==0;){for(;rc(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(_o(s))for(P0(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&&lg(e,"deficient indentation"),r}function cy(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||Is(n)))}function A0(e,t){t===1?e.result+=" ":t>1&&(e.result+=Nr.repeat(`
|
|
88
|
+
`,t-1))}function WV(e,t,n){var r,s,i,a,l,c,d,f,u=e.kind,p=e.result,m;if(m=e.input.charCodeAt(e.position),Is(m)||au(m)||m===35||m===38||m===42||m===33||m===124||m===62||m===39||m===34||m===37||m===64||m===96||(m===63||m===45)&&(s=e.input.charCodeAt(e.position+1),Is(s)||n&&au(s)))return!1;for(e.kind="scalar",e.result="",i=a=e.position,l=!1;m!==0;){if(m===58){if(s=e.input.charCodeAt(e.position+1),Is(s)||n&&au(s))break}else if(m===35){if(r=e.input.charCodeAt(e.position-1),Is(r))break}else{if(e.position===e.lineStart&&cy(e)||n&&au(m))break;if(_o(m))if(c=e.line,d=e.lineStart,f=e.lineIndent,wr(e,!1,-1),e.lineIndent>=t){l=!0,m=e.input.charCodeAt(e.position);continue}else{e.position=a,e.line=c,e.lineStart=d,e.lineIndent=f;break}}l&&(il(e,i,a,!1),A0(e,e.line-c),i=a=e.position,l=!1),rc(m)||(a=e.position+1),m=e.input.charCodeAt(++e.position)}return il(e,i,a,!1),e.result?!0:(e.kind=u,e.result=p,!1)}function VV(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(il(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 _o(n)?(il(e,r,s,!0),A0(e,wr(e,!1,t)),r=s=e.position):e.position===e.lineStart&&cy(e)?it(e,"unexpected end of the document within a single quoted scalar"):(e.position++,s=e.position);it(e,"unexpected end of the stream within a single quoted scalar")}function UV(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 il(e,n,e.position,!0),e.position++,!0;if(l===92){if(il(e,n,e.position,!0),l=e.input.charCodeAt(++e.position),_o(l))wr(e,!1,t);else if(l<256&&gT[l])e.result+=yT[l],e.position++;else if((a=FV(l))>0){for(s=a,i=0;s>0;s--)l=e.input.charCodeAt(++e.position),(a=DV(l))>=0?i=(i<<4)+a:it(e,"expected hexadecimal character");e.result+=HV(i),e.position++}else it(e,"unknown escape sequence");n=r=e.position}else _o(l)?(il(e,n,r,!0),A0(e,wr(e,!1,t)),n=r=e.position):e.position===e.lineStart&&cy(e)?it(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}it(e,"unexpected end of the stream within a double quoted scalar")}function KV(e,t){var n=!0,r,s,i,a=e.tag,l,c=e.anchor,d,f,u,p,m,y=Object.create(null),b,k,g,v;if(v=e.input.charCodeAt(e.position),v===91)f=93,m=!1,l=[];else if(v===123)f=125,m=!0,l={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=l),v=e.input.charCodeAt(++e.position);v!==0;){if(wr(e,!0,t),v=e.input.charCodeAt(e.position),v===f)return e.position++,e.tag=a,e.anchor=c,e.kind=m?"mapping":"sequence",e.result=l,!0;n?v===44&&it(e,"expected the node content, but found ','"):it(e,"missed comma between flow collection entries"),k=b=g=null,u=p=!1,v===63&&(d=e.input.charCodeAt(e.position+1),Is(d)&&(u=p=!0,e.position++,wr(e,!0,t))),r=e.line,s=e.lineStart,i=e.position,Du(e,t,og,!1,!0),k=e.tag,b=e.result,wr(e,!0,t),v=e.input.charCodeAt(e.position),(p||e.line===r)&&v===58&&(u=!0,v=e.input.charCodeAt(++e.position),wr(e,!0,t),Du(e,t,og,!1,!0),g=e.result),m?lu(e,l,y,k,b,g,r,s,i):u?l.push(lu(e,null,y,k,b,g,r,s,i)):l.push(b),wr(e,!0,t),v=e.input.charCodeAt(e.position),v===44?(n=!0,v=e.input.charCodeAt(++e.position)):n=!1}it(e,"unexpected end of the stream within a flow collection")}function qV(e,t){var n,r,s=Tx,i=!1,a=!1,l=t,c=0,d=!1,f,u;if(u=e.input.charCodeAt(e.position),u===124)r=!1;else if(u===62)r=!0;else return!1;for(e.kind="scalar",e.result="";u!==0;)if(u=e.input.charCodeAt(++e.position),u===43||u===45)Tx===s?s=u===43?_j:LV:it(e,"repeat of a chomping mode identifier");else if((f=zV(u))>=0)f===0?it(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):a?it(e,"repeat of an indentation width identifier"):(l=t+f-1,a=!0);else break;if(rc(u)){do u=e.input.charCodeAt(++e.position);while(rc(u));if(u===35)do u=e.input.charCodeAt(++e.position);while(!_o(u)&&u!==0)}for(;u!==0;){for(P0(e),e.lineIndent=0,u=e.input.charCodeAt(e.position);(!a||e.lineIndent<l)&&u===32;)e.lineIndent++,u=e.input.charCodeAt(++e.position);if(!a&&e.lineIndent>l&&(l=e.lineIndent),_o(u)){c++;continue}if(e.lineIndent<l){s===_j?e.result+=Nr.repeat(`
|
|
89
|
+
`,i?1+c:c):s===Tx&&i&&(e.result+=`
|
|
90
|
+
`);break}for(r?rc(u)?(d=!0,e.result+=Nr.repeat(`
|
|
91
|
+
`,i?1+c:c)):d?(d=!1,e.result+=Nr.repeat(`
|
|
92
|
+
`,c+1)):c===0?i&&(e.result+=" "):e.result+=Nr.repeat(`
|
|
93
|
+
`,c):e.result+=Nr.repeat(`
|
|
94
|
+
`,i?1+c:c),i=!0,a=!0,c=0,n=e.position;!_o(u)&&u!==0;)u=e.input.charCodeAt(++e.position);il(e,n,e.position,!1)}return!0}function Rj(e,t){var n,r=e.tag,s=e.anchor,i=[],a,l=!1,c;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=i),c=e.input.charCodeAt(e.position);c!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,it(e,"tab characters must not be used in indentation")),!(c!==45||(a=e.input.charCodeAt(e.position+1),!Is(a))));){if(l=!0,e.position++,wr(e,!0,-1)&&e.lineIndent<=t){i.push(null),c=e.input.charCodeAt(e.position);continue}if(n=e.line,Du(e,t,fT,!1,!0),i.push(e.result),wr(e,!0,-1),c=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&c!==0)it(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 YV(e,t,n){var r,s,i,a,l,c,d=e.tag,f=e.anchor,u={},p=Object.create(null),m=null,y=null,b=null,k=!1,g=!1,v;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=u),v=e.input.charCodeAt(e.position);v!==0;){if(!k&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,it(e,"tab characters must not be used in indentation")),r=e.input.charCodeAt(e.position+1),i=e.line,(v===63||v===58)&&Is(r))v===63?(k&&(lu(e,u,p,m,y,null,a,l,c),m=y=b=null),g=!0,k=!0,s=!0):k?(k=!1,s=!0):it(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,v=r;else{if(a=e.line,l=e.lineStart,c=e.position,!Du(e,n,dT,!1,!0))break;if(e.line===i){for(v=e.input.charCodeAt(e.position);rc(v);)v=e.input.charCodeAt(++e.position);if(v===58)v=e.input.charCodeAt(++e.position),Is(v)||it(e,"a whitespace character is expected after the key-value separator within a block mapping"),k&&(lu(e,u,p,m,y,null,a,l,c),m=y=b=null),g=!0,k=!1,s=!1,m=e.tag,y=e.result;else if(g)it(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=d,e.anchor=f,!0}else if(g)it(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,c=e.position),Du(e,t,ag,!0,s)&&(k?y=e.result:b=e.result),k||(lu(e,u,p,m,y,b,a,l,c),m=y=b=null),wr(e,!0,-1),v=e.input.charCodeAt(e.position)),(e.line===i||e.lineIndent>t)&&v!==0)it(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return k&&lu(e,u,p,m,y,null,a,l,c),g&&(e.tag=d,e.anchor=f,e.kind="mapping",e.result=u),g}function GV(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&&it(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)):it(e,"unexpected end of the stream within a verbatim tag")}else{for(;a!==0&&!Is(a);)a===33&&(r?it(e,"tag suffix cannot contain exclamation marks"):(s=e.input.slice(t-1,e.position+1),pT.test(s)||it(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),$V.test(i)&&it(e,"tag suffix cannot contain flow indicator characters")}i&&!hT.test(i)&&it(e,"tag name cannot contain such characters: "+i);try{i=decodeURIComponent(i)}catch{it(e,"tag name is malformed: "+i)}return n?e.tag=i:ul.call(e.tagMap,s)?e.tag=e.tagMap[s]+i:s==="!"?e.tag="!"+i:s==="!!"?e.tag="tag:yaml.org,2002:"+i:it(e,'undeclared tag handle "'+s+'"'),!0}function XV(e){var t,n;if(n=e.input.charCodeAt(e.position),n!==38)return!1;for(e.anchor!==null&&it(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;n!==0&&!Is(n)&&!au(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&it(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function JV(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&&!Is(r)&&!au(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&it(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),ul.call(e.anchorMap,n)||it(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],wr(e,!0,-1),!0}function Du(e,t,n,r,s){var i,a,l,c=1,d=!1,f=!1,u,p,m,y,b,k;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,i=a=l=ag===n||fT===n,r&&wr(e,!0,-1)&&(d=!0,e.lineIndent>t?c=1:e.lineIndent===t?c=0:e.lineIndent<t&&(c=-1)),c===1)for(;GV(e)||XV(e);)wr(e,!0,-1)?(d=!0,l=i,e.lineIndent>t?c=1:e.lineIndent===t?c=0:e.lineIndent<t&&(c=-1)):l=!1;if(l&&(l=d||s),(c===1||ag===n)&&(og===n||dT===n?b=t:b=t+1,k=e.position-e.lineStart,c===1?l&&(Rj(e,k)||YV(e,k,b))||KV(e,b)?f=!0:(a&&qV(e,b)||VV(e,b)||UV(e,b)?f=!0:JV(e)?(f=!0,(e.tag!==null||e.anchor!==null)&&it(e,"alias node should not have any properties")):WV(e,b,og===n)&&(f=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):c===0&&(f=l&&Rj(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"&&it(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),u=0,p=e.implicitTypes.length;u<p;u+=1)if(y=e.implicitTypes[u],y.resolve(e.result)){e.result=y.construct(e.result),e.tag=y.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(ul.call(e.typeMap[e.kind||"fallback"],e.tag))y=e.typeMap[e.kind||"fallback"][e.tag];else for(y=null,m=e.typeMap.multi[e.kind||"fallback"],u=0,p=m.length;u<p;u+=1)if(e.tag.slice(0,m[u].tag.length)===m[u].tag){y=m[u];break}y||it(e,"unknown tag !<"+e.tag+">"),e.result!==null&&y.kind!==e.kind&&it(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+y.kind+'", not "'+e.kind+'"'),y.resolve(e.result,e.tag)?(e.result=y.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):it(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 QV(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&&(wr(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&&!Is(a);)a=e.input.charCodeAt(++e.position);for(r=e.input.slice(n,e.position),s=[],r.length<1&&it(e,"directive name must not be less than one character in length");a!==0;){for(;rc(a);)a=e.input.charCodeAt(++e.position);if(a===35){do a=e.input.charCodeAt(++e.position);while(a!==0&&!_o(a));break}if(_o(a))break;for(n=e.position;a!==0&&!Is(a);)a=e.input.charCodeAt(++e.position);s.push(e.input.slice(n,e.position))}a!==0&&P0(e),ul.call(Ij,r)?Ij[r](e,r,s):lg(e,'unknown document directive "'+r+'"')}if(wr(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,wr(e,!0,-1)):i&&it(e,"directives end mark is expected"),Du(e,e.lineIndent-1,ag,!1,!0),wr(e,!0,-1),e.checkLineBreaks&&OV.test(e.input.slice(t,e.position))&&lg(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&cy(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,wr(e,!0,-1));return}if(e.position<e.length-1)it(e,"end of the stream or a document separator is expected");else return}function wT(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 BV(e,t),r=e.indexOf("\0");for(r!==-1&&(n.position=r,it(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;)QV(n);return n.documents}function ZV(e,t,n){t!==null&&typeof t=="object"&&typeof n>"u"&&(n=t,t=null);var r=wT(e,n);if(typeof t!="function")return r;for(var s=0,i=r.length;s<i;s+=1)t(r[s])}function eU(e,t){var n=wT(e,t);if(n.length!==0){if(n.length===1)return n[0];throw new hs("expected a single document in the stream, but found more")}}var tU=ZV,nU=eU,bT={loadAll:tU,load:nU},vT=Object.prototype.toString,kT=Object.prototype.hasOwnProperty,I0=65279,rU=9,Qf=10,sU=13,iU=32,oU=33,aU=34,Pb=35,lU=37,cU=38,uU=39,dU=42,ST=44,fU=45,cg=58,pU=61,hU=62,mU=63,gU=64,NT=91,jT=93,yU=96,CT=123,xU=124,ET=125,os={};os[0]="\\0";os[7]="\\a";os[8]="\\b";os[9]="\\t";os[10]="\\n";os[11]="\\v";os[12]="\\f";os[13]="\\r";os[27]="\\e";os[34]='\\"';os[92]="\\\\";os[133]="\\N";os[160]="\\_";os[8232]="\\L";os[8233]="\\P";var wU=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],bU=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function vU(e,t){var n,r,s,i,a,l,c;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)),c=e.compiledTypeMap.fallback[a],c&&kT.call(c.styleAliases,l)&&(l=c.styleAliases[l]),n[a]=l;return n}function kU(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 hs("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+n+Nr.repeat("0",r-t.length)+t}var SU=1,Zf=2;function NU(e){this.schema=e.schema||_0,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=Nr.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=vU(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==='"'?Zf:SU,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 Lj(e,t){for(var n=Nr.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 Ab(e,t){return`
|
|
98
|
+
`+Nr.repeat(" ",e.indent*t)}function jU(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 ug(e){return e===iU||e===rU}function ep(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==I0||65536<=e&&e<=1114111}function Mj(e){return ep(e)&&e!==I0&&e!==sU&&e!==Qf}function Oj(e,t,n){var r=Mj(e),s=r&&!ug(e);return(n?r:r&&e!==ST&&e!==NT&&e!==jT&&e!==CT&&e!==ET)&&e!==Pb&&!(t===cg&&!s)||Mj(t)&&!ug(t)&&e===Pb||t===cg&&s}function CU(e){return ep(e)&&e!==I0&&!ug(e)&&e!==fU&&e!==mU&&e!==cg&&e!==ST&&e!==NT&&e!==jT&&e!==CT&&e!==ET&&e!==Pb&&e!==cU&&e!==dU&&e!==oU&&e!==xU&&e!==pU&&e!==hU&&e!==uU&&e!==aU&&e!==lU&&e!==gU&&e!==yU}function EU(e){return!ug(e)&&e!==cg}function Xd(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 _T(e){var t=/^\n* /;return t.test(e)}var PT=1,Ib=2,AT=3,IT=4,Wc=5;function _U(e,t,n,r,s,i,a,l){var c,d=0,f=null,u=!1,p=!1,m=r!==-1,y=-1,b=CU(Xd(e,0))&&EU(Xd(e,e.length-1));if(t||a)for(c=0;c<e.length;d>=65536?c+=2:c++){if(d=Xd(e,c),!ep(d))return Wc;b=b&&Oj(d,f,l),f=d}else{for(c=0;c<e.length;d>=65536?c+=2:c++){if(d=Xd(e,c),d===Qf)u=!0,m&&(p=p||c-y-1>r&&e[y+1]!==" ",y=c);else if(!ep(d))return Wc;b=b&&Oj(d,f,l),f=d}p=p||m&&c-y-1>r&&e[y+1]!==" "}return!u&&!p?b&&!a&&!s(e)?PT:i===Zf?Wc:Ib:n>9&&_T(e)?Wc:a?i===Zf?Wc:Ib:p?IT:AT}function PU(e,t,n,r,s){e.dump=function(){if(t.length===0)return e.quotingType===Zf?'""':"''";if(!e.noCompatMode&&(wU.indexOf(t)!==-1||bU.test(t)))return e.quotingType===Zf?'"'+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 c(d){return jU(e,d)}switch(_U(t,l,e.indent,a,c,e.quotingType,e.forceQuotes&&!r,s)){case PT:return t;case Ib:return"'"+t.replace(/'/g,"''")+"'";case AT:return"|"+$j(t,e.indent)+Dj(Lj(t,i));case IT:return">"+$j(t,e.indent)+Dj(Lj(AU(t,a),i));case Wc:return'"'+IU(t)+'"';default:throw new hs("impossible error: invalid scalar style")}}()}function $j(e,t){var n=_T(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 Dj(e){return e[e.length-1]===`
|
|
103
|
+
`?e.slice(0,-1):e}function AU(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,Fj(e.slice(0,d),t)}(),s=e[0]===`
|
|
105
|
+
`||e[0]===" ",i,a;a=n.exec(e);){var l=a[1],c=a[2];i=c[0]===" ",r+=l+(!s&&!i&&c!==""?`
|
|
106
|
+
`:"")+Fj(c,t),s=i}return r}function Fj(e,t){if(e===""||e[0]===" ")return e;for(var n=/ [^ ]/g,r,s=0,i,a=0,l=0,c="";r=n.exec(e);)l=r.index,l-s>t&&(i=a>s?a:l,c+=`
|
|
107
|
+
`+e.slice(s,i),s=i+1),a=l;return c+=`
|
|
108
|
+
`,e.length-s>t&&a>s?c+=e.slice(s,a)+`
|
|
109
|
+
`+e.slice(a+1):c+=e.slice(s),c.slice(1)}function IU(e){for(var t="",n=0,r,s=0;s<e.length;n>=65536?s+=2:s++)n=Xd(e,s),r=os[n],!r&&ep(n)?(t+=e[s],n>=65536&&(t+=e[s+1])):t+=r||kU(n);return t}function TU(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)),(pa(e,t,l,!1,!1)||typeof l>"u"&&pa(e,t,null,!1,!1))&&(r!==""&&(r+=","+(e.condenseFlow?"":" ")),r+=e.dump);e.tag=s,e.dump="["+r+"]"}function zj(e,t,n,r){var s="",i=e.tag,a,l,c;for(a=0,l=n.length;a<l;a+=1)c=n[a],e.replacer&&(c=e.replacer.call(n,String(a),c)),(pa(e,t+1,c,!0,!0,!1,!0)||typeof c>"u"&&pa(e,t+1,null,!0,!0,!1,!0))&&((!r||s!=="")&&(s+=Ab(e,t)),e.dump&&Qf===e.dump.charCodeAt(0)?s+="-":s+="- ",s+=e.dump);e.tag=i,e.dump=s||"[]"}function RU(e,t,n){var r="",s=e.tag,i=Object.keys(n),a,l,c,d,f;for(a=0,l=i.length;a<l;a+=1)f="",r!==""&&(f+=", "),e.condenseFlow&&(f+='"'),c=i[a],d=n[c],e.replacer&&(d=e.replacer.call(n,c,d)),pa(e,t,c,!1,!1)&&(e.dump.length>1024&&(f+="? "),f+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),pa(e,t,d,!1,!1)&&(f+=e.dump,r+=f));e.tag=s,e.dump="{"+r+"}"}function LU(e,t,n,r){var s="",i=e.tag,a=Object.keys(n),l,c,d,f,u,p;if(e.sortKeys===!0)a.sort();else if(typeof e.sortKeys=="function")a.sort(e.sortKeys);else if(e.sortKeys)throw new hs("sortKeys must be a boolean or a function");for(l=0,c=a.length;l<c;l+=1)p="",(!r||s!=="")&&(p+=Ab(e,t)),d=a[l],f=n[d],e.replacer&&(f=e.replacer.call(n,d,f)),pa(e,t+1,d,!0,!0,!0)&&(u=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,u&&(e.dump&&Qf===e.dump.charCodeAt(0)?p+="?":p+="? "),p+=e.dump,u&&(p+=Ab(e,t)),pa(e,t+1,f,!0,u)&&(e.dump&&Qf===e.dump.charCodeAt(0)?p+=":":p+=": ",p+=e.dump,s+=p));e.tag=i,e.dump=s||"{}"}function Hj(e,t,n){var r,s,i,a,l,c;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(c=e.styleMap[l.tag]||l.defaultStyle,vT.call(l.represent)==="[object Function]")r=l.represent(t,c);else if(kT.call(l.represent,c))r=l.represent[c](t,c);else throw new hs("!<"+l.tag+'> tag resolver accepts not "'+c+'" style');e.dump=r}return!0}return!1}function pa(e,t,n,r,s,i,a){e.tag=null,e.dump=n,Hj(e,n,!1)||Hj(e,n,!0);var l=vT.call(e.dump),c=r,d;r&&(r=e.flowLevel<0||e.flowLevel>t);var f=l==="[object Object]"||l==="[object Array]",u,p;if(f&&(u=e.duplicates.indexOf(n),p=u!==-1),(e.tag!==null&&e.tag!=="?"||p||e.indent!==2&&t>0)&&(s=!1),p&&e.usedDuplicates[u])e.dump="*ref_"+u;else{if(f&&p&&!e.usedDuplicates[u]&&(e.usedDuplicates[u]=!0),l==="[object Object]")r&&Object.keys(e.dump).length!==0?(LU(e,t,e.dump,s),p&&(e.dump="&ref_"+u+e.dump)):(RU(e,t,e.dump),p&&(e.dump="&ref_"+u+" "+e.dump));else if(l==="[object Array]")r&&e.dump.length!==0?(e.noArrayIndent&&!a&&t>0?zj(e,t-1,e.dump,s):zj(e,t,e.dump,s),p&&(e.dump="&ref_"+u+e.dump)):(TU(e,t,e.dump),p&&(e.dump="&ref_"+u+" "+e.dump));else if(l==="[object String]")e.tag!=="?"&&PU(e,e.dump,t,i,c);else{if(l==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new hs("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 MU(e,t){var n=[],r=[],s,i;for(Tb(e,n,r),s=0,i=r.length;s<i;s+=1)t.duplicates.push(n[r[s]]);t.usedDuplicates=new Array(i)}function Tb(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)Tb(e[s],t,n);else for(r=Object.keys(e),s=0,i=r.length;s<i;s+=1)Tb(e[r[s]],t,n)}function OU(e,t){t=t||{};var n=new NU(t);n.noRefs||MU(e,n);var r=e;return n.replacer&&(r=n.replacer.call({"":r},"",r)),pa(n,0,r,!0,!0)?n.dump+`
|
|
110
|
+
`:""}var $U=OU,DU={dump:$U};function T0(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 FU=Hr,zU=KI,HU=XI,BU=tT,WU=nT,VU=_0,UU=bT.load,KU=bT.loadAll,qU=DU.dump,YU=hs,GU={binary:aT,float:eT,map:GI,null:JI,pairs:cT,set:uT,timestamp:iT,bool:QI,int:ZI,merge:oT,omap:lT,seq:YI,str:qI},XU=T0("safeLoad","load"),JU=T0("safeLoadAll","loadAll"),QU=T0("safeDump","dump"),TT={Type:FU,Schema:zU,FAILSAFE_SCHEMA:HU,JSON_SCHEMA:BU,CORE_SCHEMA:WU,DEFAULT_SCHEMA:VU,load:UU,loadAll:KU,dump:qU,YAMLException:YU,types:GU,safeLoad:XU,safeLoadAll:JU,safeDump:QU};const dl=["requirement","planning","code","test","normal"],Rb={普通:"normal",技术规划:"planning",代码执行:"code",测试回归:"test",需求拆解:"requirement"},ZU=["agent","control","provide","condition","jump","condition_jump","start","end"];function eK(e){return ZU.includes(e)?e:"agent"}function tK(e){const t=(e||"").toLowerCase();return t.startsWith("control_")?"control":t.startsWith("agent_")?"agent":t.startsWith("provide_")?"provide":(t.startsWith("tool_"),"agent")}function nK(e){var t;if(!(e!=null&&e.trim()))return{nodes:[],edges:[],instances:{}};try{const n=TT.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:{},c=a.nodeSizes&&typeof a.nodeSizes=="object"?a.nodeSizes:{},d=a.viewport&&typeof a.viewport=="object"?a.viewport:null,f=d&&Number.isFinite(Number(d.x))&&Number.isFinite(Number(d.y))&&Number.isFinite(Number(d.zoom))?{x:Number(d.x),y:Number(d.y),zoom:Math.min(Math.max(Number(d.zoom),.1),4)}:void 0,u=typeof a.description=="string"&&a.description.trim()?a.description.trim():void 0,p=new Set(Object.keys(s));for(const b of i)b!=null&&b.source&&p.add(String(b.source)),b!=null&&b.target&&p.add(String(b.target));const m=Array.from(p).map(b=>{const k=s[b],g=l[b]&&typeof l[b].x=="number"&&typeof l[b].y=="number"?{x:l[b].x,y:l[b].y}:{x:0,y:0},v=c[b]&&typeof c[b].width=="number"&&typeof c[b].height=="number"?{width:c[b].width,height:c[b].height}:null,x=(k==null?void 0:k.definitionId)??b,N=tK(x),_=(k==null?void 0:k.label)!=null?String(k.label):b,C=(k==null?void 0:k.role)!=null?String(k.role).trim():"",T=Rb[C]||C,H=dl.includes(T)?T:"normal",M=(k==null?void 0:k.model)!=null?String(k.model).trim():void 0,F=(k==null?void 0:k.body)!=null?String(k.body):"",D=(k==null?void 0:k.script)!=null?String(k.script):"",$=Array.isArray(k==null?void 0:k.images)?k.images:[];return{id:b,type:eK(N),position:g,...v?{width:v.width,height:v.height}:{},data:{label:_,definitionId:x,schemaType:N,role:H,model:M||void 0,body:F,images:$,...v?{displaySize:v}:{},...D.trim()!==""?{script:D}:{}}}}),y=i.filter(b=>(b==null?void 0:b.source)&&(b==null?void 0:b.target)).map((b,k)=>({id:`e-${b.source}-${b.target}-${k}`,source:String(b.source),target:String(b.target),sourceHandle:b.sourceHandle??void 0,targetHandle:b.targetHandle??void 0,markerEnd:{type:$s.ArrowClosed}}));return{nodes:m,edges:y,instances:s,description:u,...f?{viewport:f}:{}}}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 kp(e,t){var s,i,a,l,c,d,f,u,p,m,y,b;const n=k=>{const g={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&&(g.required=!0),(k==null?void 0:k.showOnNode)!=null&&(g.showOnNode=!!k.showOnNode),g},r={};for(const k of e){const g=t[k.id]&&typeof t[k.id]=="object"?{...t[k.id]}:{},v=((s=k.data)==null?void 0:s.definitionId)||k.id,x=((i=k.data)==null?void 0:i.inputs)??[],N=((a=k.data)==null?void 0:a.outputs)??[],_=((l=k.data)==null?void 0:l.role)!=null?String(k.data.role).trim():"",C=g.role!=null?String(g.role).trim():"",T=Rb[_]||_,H=Rb[C]||C,M=dl.includes(T)?T:dl.includes(H)?H:"normal",F=Array.isArray(x)?x.map(n):Array.isArray(g.input)?g.input.map(V=>n(V)):[],D=Array.isArray(N)?N.map(n):Array.isArray(g.output)?g.output.map(V=>n(V)):[],$=((c=k.data)==null?void 0:c.label)!=null?String(k.data.label):g.label!=null?String(g.label):k.id,W=(d=k.data)==null?void 0:d.body,O=W!=null?String(W):g.body!=null?String(g.body):"";let R=((f=k.data)==null?void 0:f.model)!=null&&String(k.data.model).trim()!==""?String(k.data.model).trim():g.model!=null&&String(g.model).trim()!==""?String(g.model).trim():void 0;(R===""||R==="default")&&(R=void 0);const I={...g,definitionId:v,label:$,role:M,model:R,input:F,output:D},z=((u=k.data)==null?void 0:u.marketplaceRef)||g.marketplaceRef;z?I.marketplaceRef=String(z):delete I.marketplaceRef;const P=((p=k.data)==null?void 0:p.marketplacePackageId)||g.marketplacePackageId;P?I.marketplacePackageId=String(P):delete I.marketplacePackageId;const L=((m=k.data)==null?void 0:m.marketplaceVersion)||g.marketplaceVersion;L?I.marketplaceVersion=String(L):delete I.marketplaceVersion,v.startsWith("provide_")||O.trim()===""?delete I.body:I.body=O;const E=Array.isArray((y=k.data)==null?void 0:y.images)?k.data.images:Array.isArray(g.images)?g.images:[];E.length>0?I.images=E:delete I.images;const X=(b=k.data)==null?void 0:b.script,ee=X!=null?String(X):g.script!=null?String(g.script):"";ee.trim()===""?delete I.script:I.script=ee,delete I.temperature,delete I.maxTokens,delete I.description,r[k.id]=I}return r}function yf(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function rK(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 RT(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=>yf(a)),edges:i.map(a=>yf(a)),instances:kp(r,n||{})}}function LT(e,t,n,r,s={}){var u;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,rK(p.id,a));const c=e.nodes.map(p=>{var y,b;const m=l.get(p.id);return{...yf(p),id:m,selected:!0,dragging:!1,position:{x:Number(((y=p.position)==null?void 0:y.x)||0)+i.x,y:Number(((b=p.position)==null?void 0:b.y)||0)+i.y}}}),d=(e.edges||[]).filter(p=>l.has(p.source)&&l.has(p.target)).map((p,m)=>{const y=l.get(p.source),b=l.get(p.target);return{...yf(p),id:`e-${y}-${b}-${Date.now()}-${m}`,source:y,target:b,selected:!1}}),f={...r||{}};for(const[p,m]of l.entries()){const y=(u=e.instances)==null?void 0:u[p];y&&(f[m]={...yf(y),label:y.label!=null?String(y.label):m})}return{nodes:[...(t||[]).map(p=>({...p,selected:!1})),...c],edges:[...(n||[]).map(p=>({...p,selected:!1})),...d],instances:f,pastedNodeIds:c.map(p=>p.id)}}function Bj(e,t,n,r){var f,u,p,m;const s=kp(e,n),i=t.map(y=>({source:y.source,target:y.target,sourceHandle:y.sourceHandle??null,targetHandle:y.targetHandle??null})),a={},l={};for(const y of e){const b=y.position??{x:0,y:0};a[y.id]={x:b.x,y:b.y};const k=Number(((u=(f=y.data)==null?void 0:f.displaySize)==null?void 0:u.width)||y.width||0),g=Number(((m=(p=y.data)==null?void 0:p.displaySize)==null?void 0:m.height)||y.height||0);k>0&&g>0&&(l[y.id]={width:Math.round(k),height:Math.round(g)})}const c={nodePositions:a};Object.keys(l).length>0&&(c.nodeSizes=l),r!=null&&r.viewport&&Number.isFinite(Number(r.viewport.x))&&Number.isFinite(Number(r.viewport.y))&&Number.isFinite(Number(r.viewport.zoom))&&(c.viewport={x:Number(r.viewport.x),y:Number(r.viewport.y),zoom:Math.min(Math.max(Number(r.viewport.zoom),.1),4)}),(r==null?void 0:r.description)!=null&&String(r.description).trim()!==""&&(c.description=String(r.description).trim());const d={instances:s,edges:i,ui:c};return TT.dump(d,{lineWidth:-1})}function sK(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],c=(l&&l.name!=null?String(l.name).trim():"")||`input-${a}`;t.inputNames.push(c)}for(let a=0;a<r.length;a++){const l=r[a],c=(l&&l.name!=null?String(l.name).trim():"")||`output-${a}`;t.outputNames.push(c)}return t}function iK(e,t,n){var c,d,f;const r=new Set(e.map(u=>u.id)),s={};for(const u of e)s[u.id]=sK(u);const i=new Map,a=new Map;for(const u of t)u.target&&r.has(u.target)&&(i.has(u.target)||i.set(u.target,new Set),u.targetHandle&&i.get(u.target).add(u.targetHandle)),u.source&&r.has(u.source)&&(a.has(u.source)||a.set(u.source,new Set),u.sourceHandle&&a.get(u.source).add(u.sourceHandle));const l=[];for(const u of e){const p=((c=u.data)==null?void 0:c.definitionId)!=null?String(u.data.definitionId):"",m=s[u.id]||{inputNames:[],outputNames:[]},y=m.inputNames.length,b=m.outputNames.length;if(!(p==="control_start"||p.startsWith("provide_"))&&y>0)for(let v=0;v<y;v++){const x=`input-${v}`;if(!((d=i.get(u.id))==null?void 0:d.has(x))){const _=m.inputNames[v]||x;l.push({nodeId:u.id,suffix:n("flow:validation.inputSlotNoEdge",{slotName:_,handle:x}),key:`${u.id}-${x}-in`})}}if(!(p==="control_end")&&b>0)for(let v=0;v<b;v++){const x=`output-${v}`;if(!((f=a.get(u.id))==null?void 0:f.has(x))){const _=m.outputNames[v]||x;l.push({nodeId:u.id,suffix:n("flow:validation.outputSlotNoEdge",{slotName:_,handle:x}),key:`${u.id}-${x}-out`})}}}return l}const dg=/\[image\s+(\d+)\]/gi;function Ts(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 oK(e){return`image ${Ts(e).length+1}`}function aK(e,t){const n=String(e||""),r=`[${t}]`;return n.trim()?`${n.replace(/[ \t]+$/u,"")} ${r}`:r}function lK(e,t){const n=Ts(e),r=String(t||""),s=new Set;dg.lastIndex=0;let i;for(;i=dg.exec(r);)s.add(`image ${i[1]}`.toLowerCase());return s.size===0?[]:n.filter(a=>s.has(String(a.label||"").toLowerCase()))}function cK(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 MT(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 fg(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 OT({files:e,body:t,images:n}){const r=Array.from(e||[]);if(r.length===0)return null;let s=String(t||"");const i=Ts(n);for(const a of r){const l=await cK(a),c=oK(i);i.push({id:`${Date.now().toString(36)}-${i.length+1}`,label:c,...l}),s=aK(s,c)}return{body:s,images:i}}function Lb(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 uK={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 dK(e,t,n){const r=String((n==null?void 0:n.displayName)||"").trim(),s=String(t||"").trim();return!r||!s||r===s?s:(uK[e]||[]).includes(s)?r:s}const fK={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"])},pK={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"])},hK=new Set(["display_markdown","display_mermaid","display_ascii","display_html","display_image","display_chart","display_table"]);function mK(e,t){if(!hK.has(String(e||"")))return!1;const n=String((t==null?void 0:t.name)||"");return n==="content"||n==="src"}function gK(e){const t=String((e==null?void 0:e.marketplaceDefinitionId)||(e==null?void 0:e.id)||"").trim();return t.startsWith("marketplace:")?t:""}function yK(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 Wj(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(u=>(u==null?void 0:u.name)&&u.name===r.name)||i;if(!l)return r;const c=r.showOnNode===!1&&l.showOnNode==null&&((d=fK[e])==null?void 0:d.has(r.name));return{...r,...r.required==null&&l.required!=null?{required:!!l.required}:{},...c?{showOnNode:!0}:{},...!r._showOnNodeExplicit&&l.showOnNode!=null?{showOnNode:!!l.showOnNode}:{},...!r._showOnNodeExplicit&&l.showOnNode==null?{showOnNode:!!r.required||String(r.type||"").trim().toLowerCase()==="node"}:{},...!r._showOnNodeExplicit&&mK(e,r)?{showOnNode:!0}:{},...(f=pK[e])!=null&&f.has(r.name)?{showOnNode:!1}:{}}})}function $T(e){var s,i;const t=Array.isArray((s=e==null?void 0:e.data)==null?void 0:s.inputs)?e.data.inputs:[],n=Array.isArray((i=e==null?void 0:e.data)==null?void 0:i.outputs)?e.data.outputs:[],r=a=>a.map(l=>{const c=Lb(l);return{type:String(c.type||"node"),name:String(c.name??""),default:String(c.default??""),required:!!c.required,showOnNode:c.showOnNode!=null?c.showOnNode!==!1:!!c.required||String(c.type||"").trim().toLowerCase()==="node"}});return{inputs:r(t),outputs:r(n)}}function tp(e,t,n,r,s){var z,P,L,E,X,ee,V,ie,fe,me,ge,Z,ae,xe,pe,_e,je,Ve,et,qe,dt;const i=((z=e.data)==null?void 0:z.definitionId)||String(e.id).replace(/-\d+$/,""),a=n.find(He=>He.id===i),l=t[e.id];let c=[],d=[],f=((P=e.data)==null?void 0:P.label)??e.id,u,p,m,y,b;const k=!!l;l&&(Array.isArray(l.input)&&(c=l.input.map(Lb)),Array.isArray(l.output)&&(d=l.output.map(Lb)),l.label&&(f=String(l.label)),l.role&&typeof l.role=="string"&&(u=l.role),l.model!=null&&(p=String(l.model).trim()),l.body!=null&&(m=String(l.body)),Array.isArray(l.images)&&(y=l.images),l.script!=null&&(b=String(l.script)));const g=u??(typeof((L=e.data)==null?void 0:L.role)=="string"?e.data.role:"普通"),v=p??((E=e.data)==null?void 0:E.model)??void 0,x=(a==null?void 0:a.description)!=null?String(a.description).trim():"",N=x!==""?x:void 0,_=m??((X=e.data)==null?void 0:X.body)??"",C=Array.isArray(y)?y:Array.isArray((ee=e.data)==null?void 0:ee.images)?e.data.images:[],T=b!==void 0?b:((V=e.data)==null?void 0:V.script)!=null?String(e.data.script):"",H=String(e.id),M=(ie=r==null?void 0:r[s])==null?void 0:ie[H],F=(fe=M==null?void 0:M.label)==null?void 0:fe.label,D=M==null?void 0:M.body,$=M==null?void 0:M.description;k||(c.length===0&&((me=a==null?void 0:a.inputs)!=null&&me.length)&&(c=a.inputs.map(He=>({...He}))),d.length===0&&((ge=a==null?void 0:a.outputs)!=null&&ge.length)&&(d=a.outputs.map(He=>({...He}))));const W=yK(a,(a==null?void 0:a.id)??i),O=(l==null?void 0:l.marketplaceRef)||((Z=e.data)==null?void 0:Z.marketplaceRef)||gK(a);if(W==="agent_subAgent"&&!d.some(He=>(He==null?void 0:He.name)==="result")){const He=(ae=a==null?void 0:a.outputs)==null?void 0:ae.find(bt=>(bt==null?void 0:bt.name)==="result");d=[...d,He?{...He}:{type:"text",name:"result",default:""}]}if((W==="display_markdown"||W==="display_mermaid"||W==="display_ascii"||W==="display_chart"||W==="display_table")&&!d.some(He=>(He==null?void 0:He.name)==="next")){const He=(xe=a==null?void 0:a.outputs)==null?void 0:xe.find(bt=>(bt==null?void 0:bt.name)==="next");d=[...d,He?{...He}:{type:"node",name:"next",default:""}]}if(W==="workspace_run"){if(!c.some(He=>(He==null?void 0:He.name)==="prev")){const He=(pe=a==null?void 0:a.inputs)==null?void 0:pe.find(bt=>(bt==null?void 0:bt.name)==="prev");c=[He?{...He}:{type:"node",name:"prev",default:""},...c]}if(!d.some(He=>(He==null?void 0:He.name)==="next")){const He=(_e=a==null?void 0:a.outputs)==null?void 0:_e.find(bt=>(bt==null?void 0:bt.name)==="next");d=[...d,He?{...He}:{type:"node",name:"next",default:""}]}}c=Wj(W,c,a==null?void 0:a.inputs),d=Wj(W,d,a==null?void 0:a.outputs),W.startsWith("provide_")&&d[0]&&String(d[0].default??d[0].value??"").trim()===""&&String(_).trim()!==""&&(d=d.map((He,bt)=>bt===0?{...He,default:_,value:_}:He));const R=dK(W,F||f,a),I=W==="tool_nodejs"||String(T).trim()!=="";return{...e,type:"flowNode",data:{...e.data,label:F||f,displayLabel:R,definitionDisplayName:a==null?void 0:a.displayName,definitionId:W,...O?{marketplaceRef:O}:{},...l!=null&&l.marketplacePackageId||(je=e.data)!=null&&je.marketplacePackageId||a!=null&&a.packageId?{marketplacePackageId:(l==null?void 0:l.marketplacePackageId)||((Ve=e.data)==null?void 0:Ve.marketplacePackageId)||(a==null?void 0:a.packageId)}:{},...l!=null&&l.marketplaceVersion||(et=e.data)!=null&&et.marketplaceVersion||a!=null&&a.version?{marketplaceVersion:(l==null?void 0:l.marketplaceVersion)||((qe=e.data)==null?void 0:qe.marketplaceVersion)||(a==null?void 0:a.version)}:{},schemaType:((dt=e.data)==null?void 0:dt.schemaType)??e.type??"agent",role:g,model:v,body:D||_,images:C,script:T,inputs:c,outputs:d,description:$||N,originalLabel:f,originalBody:_,...I?{script:T}:{}}}}function DT(e,t){const n=new Map(t.map(r=>[r.id,r]));return e.filter(r=>{var f,u,p,m;const s=n.get(r.source),i=n.get(r.target),a=((u=(f=s==null?void 0:s.data)==null?void 0:f.outputs)==null?void 0:u.length)??0,l=((m=(p=i==null?void 0:i.data)==null?void 0:p.inputs)==null?void 0:m.length)??0,c=r.sourceHandle?parseInt(String(r.sourceHandle).replace("output-",""),10):0,d=r.targetHandle?parseInt(String(r.targetHandle).replace("input-",""),10):0;return s&&i&&c>=0&&c<a&&d>=0&&d<l})}function Vj(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 Uj(e,t){return!Array.isArray(e)||!e[t]||e[t].showOnNode===!0?e:e.map((n,r)=>r===t?{...n,showOnNode:!0}:n)}function pg(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=Vj(t==null?void 0:t.sourceHandle,"output"),i=Vj(t==null?void 0:t.targetHandle,"input");let a=!1;const l=(e||[]).map(c=>{var d,f,u,p;if(c.id===n){const m=Uj((d=c.data)==null?void 0:d.outputs,s);if(m!==((f=c.data)==null?void 0:f.outputs))return a=!0,{...c,data:{...c.data,outputs:m}}}if(c.id===r){const m=Uj((u=c.data)==null?void 0:u.inputs,i);if(m!==((p=c.data)==null?void 0:p.inputs))return a=!0,{...c,data:{...c.data,inputs:m}}}return c});return a?l:e}const Kj=80,xK=220;function wK(e){if(!e||typeof e!="object")return e;const{selected:t,dragging:n,resizing:r,className:s,positionAbsolute:i,measured:a,internals:l,...c}=e;return c}function bK(e){if(!e||typeof e!="object")return e;const{selected:t,className:n,...r}=e;return r}function Oh(e,t,n){const r={nodes:Array.isArray(e)?e.map(wK):[],edges:Array.isArray(t)?t.map(bK):[],extra:n&&typeof n=="object"?n:{}},s=JSON.stringify(r);return{value:JSON.parse(s),signature:s}}function Rx(e,t){const n=[...e,t];return n.length>Kj?n.slice(n.length-Kj):n}function FT({nodes:e,edges:t,extra:n,enabled:r=!0,onRestore:s}){const[i,a]=h.useState(0),l=h.useRef([]),c=h.useRef([]),d=h.useRef(null),f=h.useRef(null),u=h.useRef(null),p=h.useRef(null),m=h.useRef(!1),y=h.useCallback(()=>a(_=>_+1),[]),b=h.useCallback(()=>{p.current&&(window.clearTimeout(p.current),p.current=null)},[]),k=h.useCallback(()=>{b();const _=f.current,C=u.current;return f.current=null,u.current=null,!_||!C||_.signature===C.signature?(C&&(d.current=C),!1):(l.current=Rx(l.current,_),c.current=[],d.current=C,y(),!0)},[y,b]),g=h.useCallback((_=[],C=[],T={})=>{b(),l.current=[],c.current=[],f.current=null,u.current=null,d.current=Oh(_,C,T),m.current=!1,y()},[y,b]),v=h.useCallback(_=>{m.current=!0,d.current=_,f.current=null,u.current=null,b(),s==null||s(_.value),y()},[y,b,s]),x=h.useCallback(()=>{k();const _=d.current||Oh(e,t,n),C=l.current.pop();return C?(c.current=Rx(c.current,_),v(C),!0):(y(),!1)},[y,t,n,k,e,v]),N=h.useCallback(()=>{k();const _=d.current||Oh(e,t,n),C=c.current.pop();return C?(l.current=Rx(l.current,_),v(C),!0):(y(),!1)},[y,t,n,k,e,v]);return h.useEffect(()=>()=>b(),[b]),h.useEffect(()=>{if(!r)return;const _=Oh(e,t,n);if(!d.current){d.current=_;return}if(m.current){m.current=!1,d.current=_;return}_.signature!==d.current.signature&&(f.current||(f.current=d.current),u.current=_,b(),p.current=window.setTimeout(()=>{k()},xK))},[b,t,r,n,k,e]),{canUndo:l.current.length>0||!!f.current,canRedo:c.current.length>0,resetHistory:g,undo:x,redo:N,version:i}}function or(e){switch(hg(e)){case"text":return"#2196f3";case"file":return"#4caf50";case"node":return"#ff9800";case"bool":return"#9c27b0";default:return"#9e9e9e"}}function hg(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 vK(e,t){const n=hg(e),r=hg(t);return!n||!r?!1:n==="any"||r==="any"?!0:n===r}const kK=new Set(["workspaceContext","skillsContext","mcpContext"]);function Mb(e){const t=hg(e==null?void 0:e.type),n=String((e==null?void 0:e.name)||(e==null?void 0:e.id)||"").trim();return t==="text"&&kK.has(n)?`${t}+${n}`:t}function zT(e){return Mb(e)}function Fu(e,t){if(!e||!t||!vK(e.type,t.type))return!1;const n=Mb(e),r=Mb(t),s=n.includes("+"),i=r.includes("+");return s||i?n===r:!0}function SK(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 zu(e,t,n){var l;const r=n==="source"?"outputs":"inputs",i=SK(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 Xo(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function NK(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 jK(e){const t=String(e||"").trim();return t?t.match(/^marketplace:/i)?"MARKETPLACE":t:""}function CK(e){return["true","1","yes","on"].includes(String((e==null?void 0:e.value)??(e==null?void 0:e.default)??"").trim().toLowerCase())}function $r(e){e.stopPropagation()}function EK(e){return String(e||"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _K(e,t){const n=`\\[${EK(t)}\\]`;return String(e||"").replace(new RegExp(`[ \\t]*${n}`,"gi"),"").replace(/[ \t]+\n/g,`
|
|
124
|
+
`).replace(/\n{3,}/g,`
|
|
125
|
+
|
|
126
|
+
`).trimEnd()}function Lx(e){return String(e||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function PK(e){const t=String(e||"");let n="",r=0;dg.lastIndex=0;let s;for(;s=dg.exec(t);)n+=Lx(t.slice(r,s.index)),n+=`<span class="af-flow-node__image-token">${Lx(s[0])}</span>`,r=s.index+s[0].length;return n+=Lx(t.slice(r)),n||" "}function AK(e,t){const n=window.getComputedStyle(e),r=Number.parseFloat(n.lineHeight)||18,s=Number.parseFloat(n.paddingTop)||0,i=Number.parseFloat(n.paddingBottom)||0,a=Number.parseFloat(n.borderTopWidth)||0,l=Number.parseFloat(n.borderBottomWidth)||0,c=String(t||"").split(/\r\n|\r|\n/).length,d=Math.min(Math.max(c,2),8);return Math.ceil(d*r+s+i+a+l)}function HT({data:e,selected:t,id:n,deleteNode:r,onProvideExpand:s,onProvideValueChange:i,onNodeBodyChange:a,onNodeImagesChange:l,modelLists:c,onModelChange:d}){var bn,lr;const{t:f}=Mn(),u=(e==null?void 0:e.inputs)??[],p=(e==null?void 0:e.outputs)??[],m=((e==null?void 0:e.schemaType)??"agent").toLowerCase(),y=NK(e),b=jK(y),k=(e==null?void 0:e.isRunMode)??!1,g=!!(e!=null&&e.readOnly),v=(e==null?void 0:e.isExecuting)??!1,x=(e==null?void 0:e.isDim)??!1,N=(e==null?void 0:e.nodeStatus)??null,_=(e==null?void 0:e.nodeElapsed)??null,C=(e==null?void 0:e.definitionId)||"",T=C.startsWith("provide_"),H=C==="provide_bool",M=C==="provide_str",F=C==="provide_file",D=C==="agent_subAgent",$=D&&!k,W=H?CK(p[0]):!1,O=T?String(((bn=p[0])==null?void 0:bn.value)??((lr=p[0])==null?void 0:lr.default)??(e==null?void 0:e.body)??""):"",R=String((e==null?void 0:e.body)||""),I=(e==null?void 0:e.displayLabel)||(e==null?void 0:e.label)||f("flow:node.fallbackLabel"),z=!T&&!$&&(e!=null&&e.showBodyPreview)?String((e==null?void 0:e.body)||"").trim():"",P=Ts(e==null?void 0:e.images),L=h.useRef(!1),E=h.useRef(!1),X=h.useRef(null),ee=h.useRef(null),V=h.useRef(null),[ie,fe]=h.useState(O),[me,ge]=h.useState(R);h.useEffect(()=>{L.current||fe(O)},[n,O]),h.useEffect(()=>{E.current||ge(R)},[n,R]),h.useEffect(()=>{const ve=ee.current;if(!ve)return;const $e=AK(ve,me);ve.style.minHeight=`${$e}px`,ve.style.height="",V.current&&(V.current.style.minHeight=`${$e}px`,V.current.style.height="")},[me]),h.useEffect(()=>{const ve=X.current,$e=e==null?void 0:e.onNodeContentResize;if(!$||!ve||!$e||typeof ResizeObserver>"u")return;let nt=0;const zt=()=>{window.cancelAnimationFrame(nt),nt=window.requestAnimationFrame(()=>$e(n))},oe=new ResizeObserver(zt);return oe.observe(ve),zt(),()=>{window.cancelAnimationFrame(nt),oe.disconnect()}},[e==null?void 0:e.onNodeContentResize,$,n]);const Z=Array.isArray(c==null?void 0:c.cursor)?c.cursor:[],ae=Array.isArray(c==null?void 0:c.opencode)?c.opencode:[],xe=Array.isArray(c==null?void 0:c.claudeCode)?c.claudeCode:[],pe=((e==null?void 0:e.model)??"").trim(),_e=m==="agent"&&!C.startsWith("tool_nodejs"),je=new Set(Z.map(Xo)),Ve=new Set(ae.map(Xo)),et=new Set(xe.map(Xo)),qe=pe?pe.startsWith("cursor:")||pe.startsWith("opencode:")||pe.startsWith("claude-code:")?pe:et.has(pe)?`claude-code:${pe}`:Ve.has(pe)?`opencode:${pe}`:je.has(pe)?`cursor:${pe}`:pe:"",dt=pe&&!qe.startsWith("cursor:")&&!qe.startsWith("opencode:")&&!qe.startsWith("claude-code:")&&!je.has(pe)&&!Ve.has(pe)&&!et.has(pe),He=pe.startsWith("cursor:")?pe.slice(7):pe.startsWith("opencode:")?pe.slice(9):pe.startsWith("claude-code:")?pe.slice(12):pe,bt=ve=>{if(g)return;const $e=ve.target.value;d&&d(n,$e)},sn=ve=>{ve.stopPropagation(),!g&&r&&r(n)},on=ve=>{ve.stopPropagation(),s&&s()},an=ve=>{ve.stopPropagation(),!g&&(i==null||i(n,ve.target.value==="true"?"true":"false"))},Yt=ve=>{if(ve.stopPropagation(),g)return;const $e=ve.target.value;fe($e),L.current||i==null||i(n,$e)},En=ve=>{ve.stopPropagation(),L.current=!0},hn=ve=>{if(ve.stopPropagation(),g)return;L.current=!1;const $e=ve.currentTarget.value;fe($e),i==null||i(n,$e)},ue=()=>{g||i==null||i(n,ie)},ke=ve=>{if(ve.stopPropagation(),g)return;const $e=window.prompt("文件路径",ie);$e!=null&&(fe($e),i==null||i(n,$e))},De=ve=>{if(ge(ve),a==null||a(n,ve),l){const $e=lK(P,ve);($e.length!==P.length||$e.some((nt,zt)=>{var oe;return nt.id!==((oe=P[zt])==null?void 0:oe.id)}))&&l(n,$e)}},rt=ve=>{if(ve.stopPropagation(),g)return;const $e=ve.target.value;E.current?ge($e):De($e)},at=ve=>{ve.stopPropagation(),!g&&(E.current=!0)},Lt=ve=>{if(ve.stopPropagation(),g)return;E.current=!1;const $e=ve.currentTarget.value;De($e)},st=()=>{g||De(me)},mn=async ve=>{if(g)return;const $e=await OT({files:ve,body:me,images:P});$e&&(ge($e.body),a==null||a(n,$e.body),l==null||l(n,$e.images))},Zt=(ve,$e)=>{if(ve.stopPropagation(),g)return;const nt=P.filter(oe=>oe.id!==$e.id),zt=_K(me,$e.label);ge(zt),a==null||a(n,zt),l==null||l(n,nt)},ar=ve=>{if(g)return;const $e=MT(ve);$e.length!==0&&(ve.preventDefault(),ve.stopPropagation(),mn($e).catch(()=>{}))},_n=ve=>{if(g)return;const $e=fg(ve);$e.length!==0&&(ve.preventDefault(),ve.stopPropagation(),mn($e).catch(()=>{}))},gn=()=>{const ve=ee.current,$e=V.current;!ve||!$e||($e.scrollTop=ve.scrollTop,$e.scrollLeft=ve.scrollLeft)};return o.jsxs("div",{className:"af-flow-node"+(t?" af-flow-node--selected":"")+(v?" af-flow-node--executing":"")+(N==="success"?" af-flow-node--done":"")+(N==="failed"?" af-flow-node--failed":"")+(N==="running"&&!v?" af-flow-node--running-disk":"")+(x?" af-flow-node--dim":"")+($?" af-flow-node--inline-body-editor":"")+(M?" af-flow-node--provide-text":"")+" af-flow-node--"+m.replace(/[^a-z0-9_-]/g,""),"data-schema":m,children:[o.jsxs("div",{className:"af-flow-node__chrome",children:[o.jsx("span",{className:"af-flow-node__type",title:y,children:b}),!k&&_e&&o.jsxs("div",{className:"af-flow-node__model-wrap nodrag",onPointerDown:$r,onMouseDown:$r,onClick:$r,children:[o.jsxs("select",{className:"af-flow-node__model nodrag",value:qe,onChange:bt,onPointerDown:$r,onMouseDown:$r,onClick:$r,"aria-label":f("flow:node.model"),title:He||f("flow:node.defaultModel"),disabled:g,children:[o.jsx("option",{value:"",children:f("flow:node.defaultModel")}),dt&&o.jsx("option",{value:pe,children:pe}),Z.length>0&&o.jsx("optgroup",{label:"Cursor",children:Z.map(ve=>o.jsx("option",{value:`cursor:${Xo(ve)}`,children:Xo(ve)},`c-${ve}`))}),ae.length>0&&o.jsx("optgroup",{label:"OpenCode",children:ae.map(ve=>o.jsx("option",{value:`opencode:${Xo(ve)}`,children:Xo(ve)},`o-${ve}`))}),xe.length>0&&o.jsx("optgroup",{label:"Claude Code",children:xe.map(ve=>o.jsx("option",{value:`claude-code:${Xo(ve)}`,children:Xo(ve)},`cc-${ve}`))})]}),o.jsx("span",{className:"af-flow-node__model-arrow material-symbols-outlined",children:"expand_more"})]}),v&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--executing",children:"EXECUTING"}),N==="running"&&!v&&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:_!=null&&String(_).trim()!==""?_:"--"}),N==="failed"&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--failed",children:"FAILED"}),!k&&T&&!H&&!M&&!F&&o.jsx("button",{type:"button",className:"af-flow-node__expand",onClick:on,"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:g,onClick:sn,"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:u.map((ve,$e)=>{if(ve.showOnNode===!1)return null;const nt=f("flow:node.inputTooltip",{name:ve.name||`#${$e}`,type:ve.type})+(ve.default!=null&&ve.default!==""?f("flow:node.defaultSuffix",{value:ve.default}):""),zt=ve.name||`#${$e+1}`;return o.jsxs("div",{className:"af-flow-node__port-row",title:nt,children:[o.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--in",children:[zt,ve.required?o.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),o.jsx(Fs,{type:"target",position:Ze.Left,id:`input-${$e}`,className:"af-flow-node__handle",style:{background:or(ve.type)},title:nt})]},`in-${$e}`)})}),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,H?o.jsxs("select",{className:"af-flow-node__bool-select nodrag"+(W?" af-flow-node__bool-select--true":""),value:W?"true":"false",onChange:an,onPointerDown:$r,onMouseDown:$r,onClick:$r,"aria-label":"Boolean value",title:W?"true":"false",disabled:g,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:ie,onChange:Yt,onCompositionStart:En,onCompositionEnd:hn,onBlur:ue,onPointerDown:$r,onMouseDown:$r,onClick:$r,placeholder:"输入文本",rows:2,readOnly:g}):F?o.jsxs("div",{className:"af-flow-node__file-value nodrag",onPointerDown:$r,onMouseDown:$r,onClick:$r,children:[o.jsx("input",{className:"af-flow-node__file-input nodrag",value:ie,onChange:Yt,onCompositionStart:En,onCompositionEnd:hn,onBlur:ue,placeholder:"选择或输入文件路径",title:ie||"选择或输入文件路径",readOnly:g}),o.jsx("button",{type:"button",className:"af-flow-node__file-picker nodrag",disabled:g,onClick:ke,"aria-label":"选择文件",title:"选择文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"folder_open"})})]}):D&&!k?o.jsxs("div",{ref:X,className:"af-flow-node__prompt-stack nodrag",children:[o.jsx("pre",{ref:V,className:"af-flow-node__prompt-backdrop","aria-hidden":"true",dangerouslySetInnerHTML:{__html:PK(me)+`
|
|
127
|
+
`}}),o.jsx("textarea",{ref:ee,className:"af-flow-node__prompt-editor nodrag",value:me,onChange:rt,onCompositionStart:at,onCompositionEnd:Lt,onBlur:st,onPaste:ar,onDrop:_n,onScroll:gn,onDragOver:ve=>{fg(ve).length>0&&ve.preventDefault()},placeholder:"输入 prompt",rows:2,readOnly:g})]}):null,D&&P.length>0?o.jsx("div",{className:"af-flow-node__image-chips",children:P.map((ve,$e)=>o.jsxs("span",{className:"af-flow-node__image-chip",title:ve.name,children:[o.jsx("img",{src:ve.dataUrl,alt:""}),o.jsxs("span",{children:["[",ve.label||`image ${$e+1}`,"]"]}),o.jsx("button",{type:"button",className:"af-flow-node__image-remove nodrag",disabled:g,onClick:nt=>Zt(nt,ve),onPointerDown:$r,onMouseDown:$r,"aria-label":`删除 ${ve.label||`image ${$e+1}`}`,title:"删除图片",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},ve.id||$e))}):null,z?o.jsx("span",{className:"af-flow-node__prompt-preview",title:z,children:z}):null]}),o.jsx("div",{className:"af-flow-node__ports af-flow-node__ports--out",children:p.map((ve,$e)=>{if(ve.showOnNode===!1)return null;const nt=f("flow:node.outputTooltip",{name:ve.name||`#${$e}`,type:ve.type})+(ve.default!=null&&ve.default!==""?f("flow:node.defaultSuffix",{value:ve.default}):""),zt=ve.name||`#${$e+1}`;return o.jsxs("div",{className:"af-flow-node__port-row",title:nt,children:[o.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--out",children:[zt,ve.required?o.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),o.jsx(Fs,{type:"source",position:Ze.Right,id:`output-${$e}`,className:"af-flow-node__handle",style:{background:or(ve.type)},title:nt})]},`out-${$e}`)})})]})]})}const Sp="flowNode";function BT(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 mg(e){return e.key==="?"||e.key==="/"&&e.shiftKey}function IK(){return typeof navigator>"u"?!1:/Mac|iPhone|iPod|iPad/i.test(navigator.platform||navigator.userAgent||"")}function WT({open:e,onClose:t,flowId:n,flowSource:r,onArchived:s}){const{t:i}=Mn(),a=h.useId(),l=h.useRef(null),[c,d]=h.useState(""),[f,u]=h.useState(!1),[p,m]=h.useState("");if(h.useEffect(()=>{if(!e)return;d(""),m(""),u(!1);const g=requestAnimationFrame(()=>{var v;return(v=l.current)==null?void 0:v.focus()});return()=>cancelAnimationFrame(g)},[e,n]),!e)return null;const y=c.trim(),b=y===n;async function k(g){if(g.preventDefault(),!(!b||f)){u(!0),m("");try{const v=await fetch("/api/flow/archive",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:n,flowSource:r,confirmFlowId:y})}),x=await v.json().catch(()=>({}));if(!v.ok){m(typeof x.error=="string"?x.error:i("project:archiveModal.archiveFailed"));return}s()}catch(v){m(String((v==null?void 0:v.message)||v))}finally{u(!1)}}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:g=>{g.target===g.currentTarget&&t()},children:o.jsxs("div",{ref:l,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":a,tabIndex:-1,onMouseDown:g=>g.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:a,className:"af-shortcuts-panel__title",children:i("project:archiveModal.title")}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":i("project:archiveModal.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:k,children:[o.jsx("p",{className:"af-new-pipeline-lead",children:i("project:archiveModal.lead",{flowId:n})}),o.jsxs("label",{className:"af-new-pipeline-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:i("project:archiveModal.confirmLabel")}),o.jsx("input",{type:"text",className:"af-new-pipeline-input",value:c,onChange:g=>d(g.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":y.length>0&&!b})]}),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:!b||f,children:i(f?"project:archiveModal.archiving":"project:archiveModal.confirmArchive")})]})]})]})})}function qj({open:e,title:t,message:n,confirmLabel:r,cancelLabel:s,destructive:i=!1,secondaryLabel:a,secondaryDestructive:l=!1,onSecondary:c,onConfirm:d,onCancel:f}){const{t:u}=Mn(),p=h.useId(),m=h.useRef(null);if(h.useEffect(()=>{if(!e)return;const g=requestAnimationFrame(()=>{var x;return(x=m.current)==null?void 0:x.focus()});function v(x){x.key==="Escape"&&f(),x.key==="Enter"&&d()}return window.addEventListener("keydown",v),()=>{cancelAnimationFrame(g),window.removeEventListener("keydown",v)}},[e,f,d]),!e)return null;const y=r??u("common:common.confirm","确定"),b=s??u("common:common.cancel","取消"),k=t??u("common:common.confirmTitle","请确认");return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:g=>{g.target===g.currentTarget&&f()},children:o.jsxs("div",{ref:m,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":p,tabIndex:-1,onMouseDown:g=>g.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":b,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:b}),a&&c?o.jsx("button",{type:"button",className:l?"af-btn-secondary af-btn-destructive":"af-btn-secondary",onClick:c,children:a}):null,o.jsx("button",{type:"button",className:i?"af-btn-primary af-btn-destructive":"af-btn-primary",onClick:d,autoFocus:!0,children:y})]})]})]})})}function VT({open:e,onClose:t,flowId:n,flowSource:r,flowArchived:s=!1,onDeleted:i}){const{t:a}=Mn(),l=h.useId(),c=h.useRef(null),[d,f]=h.useState(""),[u,p]=h.useState(!1),[m,y]=h.useState("");if(h.useEffect(()=>{if(!e)return;f(""),y(""),p(!1);const v=requestAnimationFrame(()=>{var x;return(x=c.current)==null?void 0:x.focus()});return()=>cancelAnimationFrame(v)},[e,n]),!e)return null;const b=d.trim(),k=b===n;async function g(v){if(v.preventDefault(),!k||u)return;p(!0),y("");let x=null;try{const N=new AbortController;x=setTimeout(()=>N.abort(),15e3);const _=await fetch("/api/flow/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:n,flowSource:r,confirmFlowId:b,flowArchived:s}),signal:N.signal}),C=await _.json().catch(()=>({}));if(!_.ok){y(typeof C.error=="string"?C.error:a("project:deleteModal.deleteFailed"));return}try{for(let T=localStorage.length-1;T>=0;T--){const H=localStorage.key(T);H&&(H.startsWith(`af:composer-sessions:${n}:${r}`)||H.startsWith(`af:composer-active-session:${n}:${r}`)||H.startsWith(`af:workspace-composer:${n}:${r}`))&&localStorage.removeItem(H)}}catch{}await i()}catch(N){if((N==null?void 0:N.name)==="AbortError"){y(a("project:deleteModal.deleteTimeout"));return}y(String((N==null?void 0:N.message)||N))}finally{x&&clearTimeout(x),p(!1)}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:v=>{v.target===v.currentTarget&&t()},children:o.jsxs("div",{ref:c,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":l,tabIndex:-1,onMouseDown:v=>v.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:l,className:"af-shortcuts-panel__title",children:a("project:deleteModal.title")}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":a("project:deleteModal.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:g,children:[o.jsx("p",{className:"af-new-pipeline-lead",children:a("project:deleteModal.lead",{flowId:n})}),o.jsxs("label",{className:"af-new-pipeline-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:a("project:deleteModal.confirmLabel")}),o.jsx("input",{type:"text",className:"af-new-pipeline-input",value:d,onChange:v=>f(v.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":b.length>0&&!k})]}),m?o.jsx("p",{className:"af-err af-new-pipeline-err",children:m}):null,o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:u,children:a("project:deleteModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary af-btn-destructive",disabled:!k||u,children:a(u?"project:deleteModal.deleting":"project:deleteModal.confirmDelete")})]})]})]})})}function TK({children:e}){return o.jsx("kbd",{className:"af-kbd",children:e})}function Hi({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(TK,{children:t})]},n))})}function UT({open:e,onClose:t}){const{t:n}=Mn(),r=h.useRef(null);if(h.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=IK()?"⌘":"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(Hi,{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(Hi,{keys:["?"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.jumpToNode")}),o.jsx(Hi,{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(Hi,{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(Hi,{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(Hi,{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(Hi,{keys:["Space"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.saveViewport")}),o.jsx(Hi,{keys:["F"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.selectAll")}),o.jsx(Hi,{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(Hi,{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(Hi,{keys:[i,"Shift","Z"]})]})]})]})]})]})})}function RK(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 KT({open:e,onClose:t,onJump:n,nodes:r}){const{t:s}=Mn(),[i,a]=h.useState(""),[l,c]=h.useState(0),d=h.useRef(null),f=h.useRef(null);h.useEffect(()=>{if(!e)return;a(""),c(0);const y=requestAnimationFrame(()=>{var b;return(b=d.current)==null?void 0:b.focus()});return()=>cancelAnimationFrame(y)},[e]);const u=h.useMemo(()=>{const y=(r||[]).map(g=>{var v,x,N;return{id:g.id,label:((v=g.data)==null?void 0:v.label)||"",definitionId:((x=g.data)==null?void 0:x.definitionId)||"",schemaType:((N=g.data)==null?void 0:N.schemaType)||""}}),b=i.trim(),k=y.map(g=>({e:g,s:RK(g,b)})).filter(g=>g.s>0);return k.sort((g,v)=>v.s-g.s||g.e.id.localeCompare(v.e.id)),k.slice(0,50).map(g=>g.e)},[r,i]);if(h.useEffect(()=>{l>=u.length&&c(0)},[u.length,l]),h.useEffect(()=>{var b;const y=(b=f.current)==null?void 0:b.querySelector(`[data-idx="${l}"]`);y&&y.scrollIntoView({block:"nearest"})},[l]),!e)return null;const p=y=>{const b=u[y];b&&(n(b.id),t())},m=y=>{if(y.key==="Escape"){y.preventDefault(),t();return}if(y.key==="ArrowDown"){y.preventDefault(),c(b=>Math.min(u.length-1,b+1));return}if(y.key==="ArrowUp"){y.preventDefault(),c(b=>Math.max(0,b-1));return}y.key==="Enter"&&(y.preventDefault(),p(l))};return o.jsx("div",{className:"af-jump-overlay",role:"presentation",onMouseDown:y=>{y.target===y.currentTarget&&t()},children:o.jsxs("div",{className:"af-jump-panel",role:"dialog","aria-modal":"true","aria-label":s("flow:jumpPalette.title"),onMouseDown:y=>y.stopPropagation(),children:[o.jsxs("div",{className:"af-jump-panel__input-wrap",children:[o.jsx("span",{className:"af-jump-panel__icon material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{ref:d,type:"text",className:"af-jump-panel__input",placeholder:s("flow:jumpPalette.placeholder"),value:i,onChange:y=>{a(y.target.value),c(0)},onKeyDown:m,spellCheck:!1,autoComplete:"off"}),o.jsx("span",{className:"af-jump-panel__count",children:u.length})]}),u.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:u.map((y,b)=>o.jsxs("li",{"data-idx":b,role:"option","aria-selected":b===l,className:"af-jump-panel__item"+(b===l?" af-jump-panel__item--active":""),onMouseEnter:()=>c(b),onMouseDown:k=>{k.preventDefault(),p(b)},children:[o.jsx("span",{className:"af-jump-panel__id",children:y.id}),y.label&&y.label!==y.id&&o.jsx("span",{className:"af-jump-panel__label",children:y.label}),y.definitionId&&o.jsx("span",{className:"af-jump-panel__tag",children:y.definitionId})]},y.id))}),o.jsxs("div",{className:"af-jump-panel__hint",children:[o.jsxs("span",{children:[o.jsx("kbd",{className:"af-kbd",children:"↑"}),o.jsx("kbd",{className:"af-kbd",children:"↓"})," ",s("flow:jumpPalette.hintNavigate")]}),o.jsxs("span",{children:[o.jsx("kbd",{className:"af-kbd",children:"Enter"})," ",s("flow:jumpPalette.hintJump")]}),o.jsxs("span",{children:[o.jsx("kbd",{className:"af-kbd",children:"Esc"})," ",s("flow:jumpPalette.hintClose")]})]})]})})}function LK({open:e,onClose:t,flowId:n,flowSource:r,flowArchived:s=!1,filePath:i,fileName:a,onSaved:l,onAiEdit:c}){const{t:d}=Mn(),f=h.useId(),u=h.useRef(null),p=h.useRef(null),[m,y]=h.useState(""),[b,k]=h.useState(""),[g,v]=h.useState(!1),[x,N]=h.useState(!1),[_,C]=h.useState(!1),[T,H]=h.useState(""),[M,F]=h.useState("");if(h.useEffect(()=>{if(!e||!i)return;y(""),k(""),H(""),F(""),v(!0),N(!1),C(!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);y(L.content||""),k(L.content||"")}catch(P){H(P.message||String(P))}finally{v(!1)}})();const z=requestAnimationFrame(()=>{var P;return(P=u.current)==null?void 0:P.focus()});return()=>cancelAnimationFrame(z)},[e,i,n,r,s]),!e)return null;const D=m!==b;async function $(I){if(I.preventDefault(),!x){N(!0),H(""),F("");try{const z=new URLSearchParams({flowId:n,flowSource:r,archived:s?"1":"0",path:i}),P=await fetch(`/api/pipeline-file-save?${z}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:m})}),L=await P.json();if(!P.ok)throw new Error(L.error||"HTTP "+P.status);k(m),F(d("flow:fileEdit.saved")),l&&l()}catch(z){H(z.message||String(z))}finally{N(!1)}}}async function W(){if(!(!c||_||!m)){C(!0),H("");try{const I=await c(m);typeof I=="string"&&I&&y(I)}catch(I){H(I.message||String(I))}finally{C(!1)}}}function O(){y(b),H(""),F("")}const R=m.length>1e5;return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:I=>{I.target===I.currentTarget&&t()},children:o.jsxs("div",{ref:u,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:g?o.jsx("div",{className:"af-file-edit-loading",children:d("flow:fileEdit.loading")}):T&&!m?o.jsx("div",{className:"af-file-edit-error",children:T}):o.jsxs(o.Fragment,{children:[R&&o.jsx("div",{className:"af-file-edit-warning",children:d("flow:fileEdit.largeFileWarning")}),o.jsx("textarea",{ref:p,className:"af-file-edit-textarea",value:m,onChange:I=>y(I.target.value),spellCheck:!1,placeholder:d("flow:fileEdit.placeholder")})]})}),(T||M)&&!g&&o.jsx("div",{className:`af-file-edit-status${M?" af-file-edit-status--success":""}`,children:M||T}),o.jsxs("div",{className:"af-file-edit-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:O,disabled:!D||x||_,children:d("flow:fileEdit.reset")}),c&&o.jsx("button",{type:"button",className:"af-btn-secondary af-btn-ai",onClick:W,disabled:_||x||!m,children:d(_?"flow:fileEdit.aiRunning":"flow:fileEdit.aiEdit")}),o.jsx("button",{type:"button",className:"af-btn-primary",onClick:$,disabled:!D||x||_,children:d(x?"flow:fileEdit.saving":"flow:fileEdit.save")})]})]})})}const qT=new Set(["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"]),MK=["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"];function OK(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 $K(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 Yj(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 YT(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(qT.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 GT(e){return{inputNames:Yj(e==null?void 0:e.inputs),outputNames:Yj(e==null?void 0:e.outputs)}}function DK(e,t,n){const r=GT(t),s=$K(e),i=[];for(const a of s)if(!YT(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 FK(e,t){const n=GT(t),r=/\$\{([^}]*)\}/g,s=[];let i=0,a;for(;(a=r.exec(e))!==null;){a.index>i&&s.push({kind:"plain",text:e.slice(i,a.index)});const l=a[0],c=YT(a[1],n);s.push({kind:c?"ph-valid":"ph-invalid",text:l}),i=a.index+l.length}return i<e.length&&s.push({kind:"plain",text:e.slice(i)}),s}function zK(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function HK(e){return e.map(t=>{const n=zK(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 BK(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 MK)qT.has(r)&&n.push({section:"runtime",insert:r,label:r,subtitle:t("flow:placeholder.runtimeConst")});return n}function WK(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 VK(e,t){if(!e||t<0)return null;const n=Math.min(t,e.value.length),r=getComputedStyle(e),s=document.createElement("div");s.setAttribute("aria-hidden","true"),s.style.visibility="hidden",s.style.position="fixed",s.style.top="0",s.style.left="-99999px",s.style.whiteSpace="pre-wrap",s.style.wordWrap="break-word",s.style.overflow="hidden";const i=e.clientWidth;if(i<=0)return null;s.style.width=`${i}px`,s.style.font=r.font,s.style.lineHeight=r.lineHeight,s.style.padding=r.padding,s.style.border=r.border,s.style.boxSizing=r.boxSizing,s.style.letterSpacing=r.letterSpacing,s.style.textIndent=r.textIndent,s.style.tabSize=r.tabSize||"8",s.textContent=e.value.slice(0,n);const a=document.createElement("span");a.textContent="",s.appendChild(a),document.body.appendChild(s);const l=a.getBoundingClientRect(),c=parseFloat(r.lineHeight),d=Number.isFinite(c)&&c>0?c:l.height||16;return document.body.removeChild(s),{top:l.top,left:l.left,bottom:l.bottom,height:d}}function $h({value:e,onChange:t,disabled:n,placeholder:r,rows:s=8,textareaClassName:i,ioSlots:a,variant:l="drawer",images:c,onImagesChange:d}){const{t:f}=Mn(),u=h.useId(),p=h.useRef(null),m=h.useRef(null),[y,b]=h.useState(0),[k,g]=h.useState(0),[v,x]=h.useState(null),N=h.useMemo(()=>Ts(c),[c]),_=h.useMemo(()=>DK(e,a,f),[e,a,f]),C=_.length>0,T=h.useMemo(()=>FK(e,a),[e,a]),H=h.useMemo(()=>HK(T),[T]),M=h.useMemo(()=>n?null:OK(e,y),[e,y,n]),F=h.useMemo(()=>{if(!M)return[];const I=BK(a,f);return WK(I,M.query)},[M,a,f]);h.useEffect(()=>{g(I=>{const z=Math.max(0,F.length-1);return Math.min(Math.max(0,I),z)})},[F.length]);const D=h.useCallback(()=>{const I=p.current;if(!I||!M||F.length===0){x(null);return}const z=VK(I,y);if(!z){x(null);return}const P=4,L=44,E=13.5*16,X=Math.min(F.length*L+8,E);let ee=z.bottom+P;ee+X>window.innerHeight-8&&(ee=Math.max(8,z.top-X-P));const V=288;let ie=z.left;ie=Math.max(8,Math.min(ie,window.innerWidth-V-8)),x({top:ee,left:ie})},[M,F.length,y]);h.useLayoutEffect(()=>{if(!M||F.length===0){x(null);return}const I=requestAnimationFrame(()=>D());return()=>cancelAnimationFrame(I)},[M,F.length,y,e,D]),h.useEffect(()=>{if(!M||F.length===0)return;const I=()=>D();return window.addEventListener("scroll",I,!0),window.addEventListener("resize",I),()=>{window.removeEventListener("scroll",I,!0),window.removeEventListener("resize",I)}},[M,F.length,D]);const $=h.useCallback(I=>{if(!M)return;const{atIndex:z}=M,P=e.slice(0,z)+"${"+I+"}"+e.slice(y);t(P);const L=z+I.length+3;queueMicrotask(()=>{const E=p.current;E&&(E.focus(),E.setSelectionRange(L,L)),b(L)})},[M,e,y,t]),W=h.useCallback(()=>{const I=p.current,z=m.current;!I||!z||(z.scrollTop=I.scrollTop,z.scrollLeft=I.scrollLeft,M&&F.length>0&&queueMicrotask(()=>D()))},[M,F.length,D]),O=h.useCallback(I=>{if(!n&&M&&F.length>0&&(I.key==="ArrowDown"||I.key==="ArrowUp"||I.key==="Enter")){if(I.key==="ArrowDown")I.preventDefault(),g(z=>(z+1)%F.length);else if(I.key==="ArrowUp")I.preventDefault(),g(z=>(z-1+F.length)%F.length);else if(I.key==="Enter"&&!I.shiftKey){I.preventDefault();const z=F[k];z&&$(z.insert)}}},[n,M,F,k,$]),R=h.useCallback(async I=>{if(n||typeof d!="function")return!1;const z=await OT({files:I,body:e,images:N});return z?(t(z.body),d(z.images),queueMicrotask(()=>{const P=p.current;if(!P)return;P.focus();const L=z.body.length;P.setSelectionRange(L,L),b(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,z)=>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 ${z+1}`,"]"]})]},I.id||z))}):null,o.jsxs("div",{className:"af-body-prompt-stack",children:[o.jsx("pre",{ref:m,className:"af-body-prompt-backdrop "+i,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:H+`
|
|
128
|
+
`}}),o.jsx("textarea",{ref:p,className:"af-body-prompt-textarea "+i,rows:s,value:e,disabled:n,placeholder:r,spellCheck:!1,"aria-invalid":C,"aria-describedby":C?u:void 0,onChange:I=>{t(I.target.value),b(I.target.selectionStart??I.target.value.length)},onSelect:I=>{const z=I.target;z instanceof HTMLTextAreaElement&&b(z.selectionStart??0)},onClick:I=>{const z=I.target;z instanceof HTMLTextAreaElement&&b(z.selectionStart??0)},onKeyUp:I=>{const z=I.target;z instanceof HTMLTextAreaElement&&b(z.selectionStart??z.value.length)},onKeyDown:O,onPaste:I=>{const z=MT(I);z.length!==0&&(I.preventDefault(),R(z).catch(()=>{}))},onDragOver:I=>{fg(I).length>0&&I.preventDefault()},onDrop:I=>{const z=fg(I);z.length!==0&&(I.preventDefault(),R(z).catch(()=>{}))},onScroll:W})]}),M&&F.length>0&&v?Fr.createPortal(o.jsx("ul",{className:"af-body-ph-menu af-body-ph-menu--pop af-composer-mention-menu",role:"listbox","aria-label":f("flow:nodeProps.placeholderSlots"),style:{position:"fixed",top:v.top,left:v.left,right:"auto",bottom:"auto",margin:0,zIndex:2e4},children:F.map((I,z)=>o.jsx("li",{role:"option","aria-selected":z===k,children:o.jsxs("button",{type:"button",className:"af-composer-mention-item"+(z===k?" af-composer-mention-item--active":""),onMouseDown:P=>P.preventDefault(),onMouseEnter:()=>g(z),onClick:()=>$(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,C?o.jsx("p",{id:u,className:"af-body-ph-issues",role:"status",children:_.map(I=>I.message).join(" · ")}):null]})}const XT=/^[a-zA-Z_][a-zA-Z0-9_-]*$/;function Dh(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function Gj({kind:e,label:t,slots:n,onSlotsChange:r,disabled:s,requiredReadonly:i=!0}){const{t:a}=Mn(),l=()=>r([...n,{type:"text",name:"",default:"",required:!1,showOnNode:!1}]),c=u=>r(n.filter((p,m)=>m!==u)),d=(u,p,m)=>{const y=n.map((b,k)=>{if(k!==u)return b;const g={...b,[p]:m};return p==="required"&&m===!0&&(g.showOnNode=!0),g});r(y)},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((u,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:u.type,onChange:m=>d(p,"type",m.target.value),disabled:s,"aria-label":a("flow:nodeProps.pinTypeAriaLabel",{label:t,index:p}),children:["node","text","file","bool"].map(m=>o.jsx("option",{value:m,children:m},m))}),o.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:u.name,onChange:m=>d(p,"name",m.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:u.default,onChange:m=>d(p,"default",m.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:!!u.required,onChange:m=>{i||d(p,"required",m.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:u.showOnNode!==!1,onChange:m=>d(p,"showOnNode",m.target.checked),disabled:s,"aria-label":a("flow:nodeProps.pinShowOnNodeAriaLabel",{label:t,index:p})})}),o.jsx("button",{type:"button",className:"af-icon-btn af-node-props-io-remove",onClick:()=>c(p),disabled:s,"aria-label":a("flow:nodeProps.deletePinAriaLabel",{label:t,index:p}),title:a("flow:nodeProps.deletePin"),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete"})})]},`${f}-${p}`))]}):null]})}function JT({draft:e,setDraft:t,definitionId:n,systemPromptReadonly:r,modelLists:s,disabled:i,onIdBlur:a,onClose:l,onPublishToMarketplace:c,allowEditRequiredPins:d=!1,error:f,ioSlots:u}){const{t:p}=Mn(),[m,y]=h.useState(!1),[b,k]=h.useState(!1),[g,v]=h.useState({status:"idle",message:""}),x=h.useCallback($=>{t(W=>W&&{...W,...$})},[t]),{cursorList:N,opencodeList:_,claudeCodeList:C,currentNotInLists:T}=h.useMemo(()=>{const $=Array.isArray(s==null?void 0:s.cursor)?s.cursor:[],W=Array.isArray(s==null?void 0:s.opencode)?s.opencode:[],O=Array.isArray(s==null?void 0:s.claudeCode)?s.claudeCode:[],R=new Set([...$,...W,...O].map(Dh)),I=((e==null?void 0:e.model)??"").trim(),z=I.startsWith("cursor:")?I.slice(7):I.startsWith("opencode:")?I.slice(9):I.startsWith("claude-code:")?I.slice(12):I,P=I&&!R.has(z)?I:"";return{cursorList:$,opencodeList:W,claudeCodeList:O,currentNotInLists:P}},[s,e==null?void 0:e.model]);if(!e)return null;const H=String(e.script??""),M=n==="tool_nodejs"||H.trim()!=="",F=typeof c=="function"&&!i&&(e==null?void 0:e.newId),D=async()=>{if(F){v({status:"running",message:p("flow:nodeProps.publishRunning")});try{const $=await c(e,n);v({status:"success",message:$!=null&&$.definitionId?p("flow:nodeProps.publishSuccessWithId",{id:$.definitionId}):p("flow:nodeProps.publishSuccess")})}catch($){v({status:"error",message:String(($==null?void 0:$.message)||$)})}}};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:D,disabled:!F||g.status==="running",title:p("flow:nodeProps.publishToMarketplaceHint"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"inventory_2"}),g.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,g.message?o.jsx("p",{className:`af-node-props-market-status af-node-props-market-status--${g.status}`,children:g.message}):null,o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsx("span",{className:"af-node-props-label",children: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:$=>x({newId:$.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:$=>x({label:$.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:dl.includes(e.role)?e.role:p("flow:roles.normal"),onChange:$=>x({role:$.target.value}),disabled:i,children:dl.map($=>o.jsx("option",{value:$,children:$},$))})]}),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 $=(e.model||"").trim();return $?T||$:""})(),onChange:$=>x({model:$.target.value}),disabled:i,"aria-label":p("flow:nodeProps.modelAriaLabel"),children:[o.jsx("option",{value:"",children:p("flow:node.defaultModel")}),T?o.jsxs("option",{value:T,children:[T,p("flow:nodeProps.yamlValueNotInList")]}):null,N.length>0?o.jsx("optgroup",{label:"Cursor",children:N.map($=>o.jsx("option",{value:Dh($),children:$},`c-${$}`))}):null,_.length>0?o.jsx("optgroup",{label:"OpenCode",children:_.map($=>o.jsx("option",{value:Dh($),children:$},`o-${$}`))}):null,C.length>0?o.jsx("optgroup",{label:"Claude Code",children:C.map($=>o.jsx("option",{value:`claude-code:${Dh($)}`,children:$},`cc-${$}`))}):null]})]}),o.jsx(Gj,{kind:"input",label:p("flow:nodeProps.inputPins"),slots:Array.isArray(e.inputs)?e.inputs:[],onSlotsChange:$=>x({inputs:$}),disabled:i,requiredReadonly:!d}),o.jsx(Gj,{kind:"output",label:p("flow:nodeProps.outputPins"),slots:Array.isArray(e.outputs)?e.outputs:[],onSlotsChange:$=>x({outputs:$}),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($h,{value:H,onChange:$=>x({script:$}),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:u,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:()=>y(!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($h,{value:e.body,onChange:$=>x({body:$}),images:e.images,onImagesChange:$=>x({images:$}),disabled:i,placeholder:p("flow:nodeProps.bodyPlaceholder"),rows:8,textareaClassName:"af-pipeline-drawer-textarea af-node-props-body-textarea",ioSlots:u,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})]})]}),b?o.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":p("flow:nodeProps.editScript"),onMouseDown:$=>{$.target===$.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($h,{value:H,onChange:$=>x({script:$}),disabled:i,placeholder:p("flow:nodeProps.scriptPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:u,variant:"expand"})]})}):null,m?o.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":p("flow:nodeProps.editUserPrompt"),onMouseDown:$=>{$.target===$.currentTarget&&y(!1)},children:o.jsxs("div",{className:"af-node-props-expand-panel",children:[o.jsxs("div",{className:"af-node-props-expand-head",children:[o.jsx("span",{className:"af-node-props-expand-title",children:p("flow:node.body")}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>y(!1),"aria-label":p("flow:nodeProps.collapse"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx($h,{value:e.body,onChange:$=>x({body:$}),images:e.images,onImagesChange:$=>x({images:$}),disabled:i,placeholder:p("flow:nodeProps.bodyPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:u,variant:"expand"})]})}):null]})}function R0(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 UK(e){const t=R0(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 QT(e){try{return JSON.stringify(JSON.parse(e.trim()),null,2)}catch{return e}}function Xj({text:e}){const{t}=Mn(),n=e||"";return n.trim()?o.jsx("div",{className:"af-run-ctx-md",children:o.jsx(vp,{children:n})}):o.jsx("div",{className:"af-run-ctx-hint",children:t("flow:runContext.empty")})}function Jj({o:e}){var r;const{t}=Mn(),n=R0(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:QT(e.content||"")});if(n==="markdown"){const s=e.content||"";return s.trim()?o.jsx("div",{className:"af-run-ctx-md",children:o.jsx(vp,{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 Qj(e){return UK(e)}function Zj(e){var r;if(!e)return null;const t=R0(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"?QT(String(n)):String(n)}function e1({text:e,title:t,copiedLabel:n}){const[r,s]=h.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 t1=2e4,ZT="af:run-node-ctx-width";function mm(){return typeof window>"u"?416:Math.min(26*16,window.innerWidth-32)}function qa(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):qa(mm())}function KK(){try{const e=localStorage.getItem(ZT);if(e==null)return qa(mm());const t=parseInt(e,10);return Number.isFinite(t)?qa(t):qa(mm())}catch{return qa(mm())}}async function n1(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 qK(e,t){const n=`flow:runContext.${t}`,r=e(n);return r!==n?r:t}function YK({instanceId:e,flowId:t,runId:n,nodeStatus:r,onClose:s}){const{t:i}=Mn(),[a,l]=h.useState(()=>typeof window<"u"&&window.matchMedia("(max-width: 960px)").matches),[c,d]=h.useState(KK),f=h.useRef({active:!1,pointerId:-1,startX:0,startW:416}),[u,p]=h.useState(!0),[m,y]=h.useState(""),[b,k]=h.useState([]),[g,v]=h.useState(null),[x,N]=h.useState(null),_=h.useRef(null),C=h.useRef(null),T=h.useRef(0),H=h.useRef(0);h.useLayoutEffect(()=>{const P=window.matchMedia("(max-width: 960px)"),L=()=>l(P.matches);return P.addEventListener("change",L),()=>P.removeEventListener("change",L)},[]),h.useEffect(()=>{function P(){d(L=>qa(L))}return window.addEventListener("resize",P),()=>window.removeEventListener("resize",P)},[]);const M=h.useCallback(()=>{d(P=>{const L=qa(P);try{localStorage.setItem(ZT,String(L))}catch{}return L})},[]),F=h.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:c},L.setPointerCapture(P.pointerId)},[a,c]),D=h.useCallback(P=>{const L=f.current;if(!L.active||P.pointerId!==L.pointerId)return;const E=L.startX-P.clientX;d(qa(L.startW+E))},[]),$=h.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]),W=h.useCallback(()=>{const P=f.current;P.active&&(P.active=!1,M())},[M]),O=h.useCallback(P=>{const L=Array.isArray(P)?P:[];k(L),v(E=>E&&L.some(X=>X.execId===E)?E:L.length>0?L[L.length-1].execId:null)},[]),R=h.useCallback(()=>{if(!e||!t)return;const P=++T.current,L=new AbortController,E=window.setTimeout(()=>L.abort(),t1);(async()=>{try{const X=await n1(t,e,n,L.signal);if(P!==T.current)return;O(Array.isArray(X.rounds)?X.rounds:[])}catch{}finally{window.clearTimeout(E)}})()},[e,t,n,O]);h.useEffect(()=>{if(!e||!t){p(!1),y(""),k([]);return}const P=++H.current;p(!0),y(""),k([]),v(null);const L=new AbortController,E=window.setTimeout(()=>L.abort(),t1);return(async()=>{try{const X=await n1(t,e,n,L.signal);if(P!==H.current)return;O(Array.isArray(X.rounds)?X.rounds:[])}catch(X){if(P!==H.current)return;const ee=(X==null?void 0:X.name)==="AbortError"?"requestTimeout":X.message||String(X);y(ee)}finally{window.clearTimeout(E),P===H.current&&p(!1)}})(),()=>{L.abort(),H.current++,T.current++}},[e,t,n,O]),h.useEffect(()=>{r&&R()},[r,R]),h.useEffect(()=>{clearInterval(C.current);const P=b.length>0?b[b.length-1]:null;return(r==="running"&&b.length===0||!!(P&&P.status==="running"))&&e&&t&&(C.current=setInterval(()=>R(),2e3)),()=>clearInterval(C.current)},[b,e,t,n,r,R]),h.useEffect(()=>{_.current&&(_.current.scrollTop=0)},[g]);const I=b.find(P=>P.execId===g),z=a?void 0:{width:`${c}px`};return o.jsxs("aside",{className:"af-run-ctx-panel",style:z,"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:F,onPointerMove:D,onPointerUp:$,onPointerCancel:$,onLostPointerCapture:W}),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"})})]}),u&&o.jsx("div",{className:"af-run-ctx-placeholder",children:i("common:common.loading")}),m&&o.jsx("div",{className:"af-run-ctx-error",children:qK(i,m)}),!u&&!m&&b.length===0&&o.jsx("div",{className:"af-run-ctx-placeholder",children:i(r==="running"?"flow:runContext.executingNoArtifacts":"flow:runContext.noData")}),b.length>0&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-run-ctx-rounds af-run-ctx-rounds--select af-run-ctx-round--"+XK((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(g??""),onChange:P=>{const L=P.target.value;v(L==="latest"?"latest":Number(L))},children:[...b].reverse().map(P=>{const L=P.execId==="latest"?i("flow:runContext.latest"):`#${P.execId}`,E=JK(i,P.status),X=P.finishedAt?` · ${GK(P.finishedAt)}`:"";return o.jsx("option",{value:String(P.execId),children:`${L} · ${E}${X}`},P.execId)})})]}),I&&o.jsxs("div",{className:"af-run-ctx-body",ref:_,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(Xj,{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 E=Qj(P),X=Zj(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}),E?o.jsx("span",{className:"af-run-ctx-format-badge",title:i("flow:runContext.detectedContentType"),children:E}):null,o.jsx(e1,{text:X,title:i("common:common.copy"),copiedLabel:i("common:common.copied")})]}),o.jsx(Jj,{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")})]})]})]}),x&&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:x==="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:[x==="prompt"&&I.prompt!=null&&o.jsx(Xj,{text:I.prompt}),x==="output"&&I.outputs&&I.outputs.map((P,L)=>{const E=Qj(P),X=Zj(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}),E?o.jsx("span",{className:"af-run-ctx-format-badge",children:E}):null,o.jsx(e1,{text:X,title:i("common:common.copy"),copiedLabel:i("common:common.copied")})]}),o.jsx(Jj,{o:P})]},`${P.slot}-${L}`)})]})]})})]})}function GK(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 XK(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 JK(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 QK({flowId:e,flowSource:t,flowArchived:n,provideNodes:r,edges:s,nodes:i,onCliInputsChange:a,onBackToEdit:l}){const{t:c}=Mn(),[d,f]=h.useState({}),[u,p]=h.useState(null),[m,y]=h.useState({}),[b,k]=h.useState(!0),[g,v]=h.useState(!1),[x,N]=h.useState(""),[_,C]=h.useState(!1),[T,H]=h.useState(null),M=h.useRef(null),F=h.useRef(!0),D=h.useRef({});h.useMemo(()=>{var E,X,ee;const L={};for(const V of r){const ie=(ee=(X=(E=V.data)==null?void 0:E.outputs)==null?void 0:X[0])==null?void 0:ee.default;ie!=null&&ie!==""&&(L[V.id]=String(ie))}return D.current=L,L},[r]);const $=h.useMemo(()=>{var E;const L={};for(const X of i){if(!((E=X.data)!=null&&E.inputs))continue;const ee=X.data.inputs;for(let V=0;V<ee.length;V++){const ie=ee[V];if(!(ie!=null&&ie.name))continue;const fe=s.find(ge=>ge.target===X.id&&ge.targetHandle===`input-${V}`);if(!(fe!=null&&fe.source))continue;r.find(ge=>ge.id===fe.source)&&(L[fe.source]=ie.name)}}return L},[i,s,r]);h.useEffect(()=>(F.current=!0,()=>{F.current=!1}),[]),h.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(E=>{if(!E.ok)throw new Error(`HTTP ${E.status}`);return E.json()}).then(E=>{var ee;if(!F.current)return;f(E.presets||{}),p(E.activePreset||null);const X=E.activePreset&&((ee=E.presets)!=null&&ee[E.activePreset])?E.presets[E.activePreset]:{};y({...D.current,...X}),k(!1)}).catch(()=>{F.current&&(y(D.current),k(!1))})},[e,t,n]),h.useEffect(()=>{var E;if(!a)return;const L={};for(const[X,ee]of Object.entries(m)){const V=$[X];if(!V)continue;const ie=r.find(me=>me.id===X);if(!ie)continue;(((E=ie.data)==null?void 0:E.definitionId)||"").startsWith("provide_file")?L[V]={type:"file",path:ee}:L[V]={type:"str",value:ee}}a(L)},[m,$,r,a]);const W=h.useCallback((L,E)=>{y(X=>({...X,[L]:E}))},[]),O=h.useCallback(L=>{L!==u&&(p(L),L&&d[L]?y({...D.current,...d[L]}):y(D.current))},[u,d]),R=h.useCallback(async()=>{if(x.trim()){v(!0);try{const L={...d,[x.trim()]:m},E={flowId:e,flowSource:t,archived:n,presets:L,activePreset:x.trim()};(await fetch("/api/flow/run-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(E)})).ok&&(f(L),p(x.trim()),N(""),C(!1))}finally{v(!1)}}},[e,t,n,d,m,x]),I=h.useCallback(async()=>{if(u){v(!0);try{const L={...d};delete L[u];const E=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:E})})).ok&&(f(L),p(E),E&&L[E]?y({...D.current,...L[E]}):y(D.current))}finally{v(!1)}}},[e,t,n,d,u]),z=h.useCallback(async()=>{if(u){v(!0);try{const L={...d,[u]:m};(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:u})})).ok&&f(L)}finally{v(!1)}}},[e,t,n,d,u,m]),P=Object.keys(d);return P.length>0,b?o.jsx("aside",{className:"af-run-config-panel",children:o.jsx("div",{className:"af-run-config-loading",children:c("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:c("flow:runConfig.preset")}),o.jsxs("div",{className:"af-run-config-preset-row",children:[o.jsxs("select",{className:"af-run-config-preset-select",value:u||"",onChange:L=>O(L.target.value||null),disabled:g,children:[o.jsx("option",{value:"",children:c("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:()=>C(!0),disabled:g,title:c("flow:runConfig.newPreset"),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add"})}),u&&o.jsx("button",{type:"button",className:"af-run-config-preset-btn af-run-config-preset-btn--save",onClick:z,disabled:g,title:c("flow:runConfig.savePreset"),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"save"})}),u&&o.jsx("button",{type:"button",className:"af-run-config-preset-btn af-run-config-preset-btn--delete",onClick:I,disabled:g,title:c("flow:runConfig.deletePreset"),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"delete"})})]})]}),_&&o.jsxs("div",{className:"af-run-config-save-dialog",children:[o.jsx("input",{type:"text",className:"af-run-config-save-input",placeholder:c("flow:runConfig.presetNamePlaceholder"),value:x,onChange:L=>N(L.target.value),disabled:g}),o.jsxs("div",{className:"af-run-config-save-actions",children:[o.jsx("button",{type:"button",className:"af-btn-primary",onClick:R,disabled:g||!x.trim(),children:c(g?"common.saving":"common.save")}),o.jsx("button",{type:"button",className:"af-btn-outline",onClick:()=>{C(!1),N("")},disabled:g,children:c("common.cancel")})]})]}),o.jsxs("div",{className:"af-run-config-inputs",children:[o.jsx("div",{className:"af-run-config-inputs-header",children:c("flow:runConfig.inputParams")}),r.length===0?o.jsx("div",{className:"af-run-config-empty",children:c("flow:runConfig.noProvideNodes")}):o.jsx("div",{className:"af-run-config-input-list",children:r.map(L=>{var ge,Z;const E=((ge=L.data)==null?void 0:ge.definitionId)||"",X=E.startsWith("provide_file"),ee=E==="provide_bool",V=((Z=L.data)==null?void 0:Z.label)||L.id,ie=L.id,fe=m[ie]||"",me=["true","1","yes","on"].includes(String(fe).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"+(X?" af-run-config-input-icon--file":""),"aria-hidden":!0,children:X?"description":ee?"toggle_on":"text_fields"}),o.jsx("span",{className:"af-run-config-input-label",children:V}),ee?null:o.jsx("button",{type:"button",className:"af-run-config-input-expand",onClick:()=>H({instanceId:ie,label:V,content:fe}),"aria-label":c("flow:runConfig.expandInput"),title:c("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:ie}),ee?o.jsx("button",{type:"button",className:"af-run-config-bool-toggle"+(me?" af-run-config-bool-toggle--true":""),onClick:()=>W(ie,me?"false":"true"),"aria-pressed":me,children:me?"true":"false"}):o.jsx("input",{type:"text",className:"af-run-config-input-field",value:fe,onChange:ae=>W(ie,ae.target.value),placeholder:c(X?"flow:runConfig.filePathPlaceholder":"flow:runConfig.stringValuePlaceholder")})]},ie)})})]}),T&&Fr.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:T.label}),o.jsx("button",{type:"button",className:"af-provide-edit-modal__close",onClick:()=>H(null),"aria-label":c("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:T.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:()=>{!T||!M.current||(W(T.instanceId,M.current.value),H(null))},children:[o.jsx("span",{className:"material-symbols-outlined",children:"save"}),c("flow:provideEdit.save")]}),o.jsxs("button",{type:"button",className:"af-provide-edit-modal__btn",onClick:()=>H(null),children:[o.jsx("span",{className:"material-symbols-outlined",children:"close"}),c("flow:provideEdit.cancel")]})]})]})}),document.body)]})}const e2={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"]},ZK={"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 e7(e){return!e||e<1024?`${e||0} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}function t7(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 n7(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 r1(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(e2))if(r.includes(e))return n;return"other"}function r7({event:e,defaultExpanded:t}){const[n,r]=h.useState(!!t),s=ZK[e.tag]||"#a8a8a8",i=e.payload,a=i&&typeof i=="object",l=a?typeof i.text=="string"?i.text:"":String(i||""),c=a?i.meta:null,d=h.useMemo(()=>l?l.slice(0,140).replace(/\s+/g," "):a?Object.keys(i).filter(m=>m!=="text"&&m!=="meta").slice(0,3).map(m=>{const y=i[m];return y==null?`${m}:null`:typeof y=="object"?`${m}:{…}`:`${m}:${String(y).slice(0,30)}`}).join(" "):"",[i,l,a]),f=h.useCallback(u=>{u.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(u=>!u),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:t7(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:[c&&Object.keys(c).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(c,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 s7({open:e,onClose:t,flowId:n}){var H;const[r,s]=h.useState([]),[i,a]=h.useState(!1),[l,c]=h.useState(null),[d,f]=h.useState(null),[u,p]=h.useState(!1),[m,y]=h.useState(!0),[b,k]=h.useState({ai:!0,flow:!0,step:!0,output:!0,error:!0}),[g,v]=h.useState(""),x=h.useRef(null),N=h.useCallback(async()=>{a(!0);try{const M=m&&n?`?flowId=${encodeURIComponent(n)}`:"",D=await(await fetch(`/api/composer-logs${M}`)).json();s(Array.isArray(D.sessions)?D.sessions:[])}catch{s([])}finally{a(!1)}},[n,m]),_=h.useCallback(async M=>{if(!M){f(null);return}p(!0);try{const D=await(await fetch(`/api/composer-logs/${encodeURIComponent(M)}`)).json();f(D)}catch{f(null)}finally{p(!1)}},[]);h.useEffect(()=>{e&&N()},[e,N]),h.useEffect(()=>{if(!(!e||!l))return _(l),x.current=setInterval(()=>_(l),2e3),()=>{x.current&&clearInterval(x.current),x.current=null}},[e,l,_]);const C=h.useMemo(()=>{const M=(d==null?void 0:d.events)||[],F=g.trim().toLowerCase();return M.filter(D=>{const $=r1(D.tag,D.payload);return!b[$]&&$!=="other"?!1:F?[D.tag,JSON.stringify(D.payload||"")].join(" ").toLowerCase().includes(F):!0})},[d,b,g]),T=h.useMemo(()=>{const M=(d==null?void 0:d.events)||[],F={};for(const D of M){const $=r1(D.tag,D.payload);F[$]=(F[$]||0)+1}return F},[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:m,onChange:M=>y(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:m&&n?"no sessions for this flow":"no sessions"}),r.map(M=>{const F=l===M.sessionId;return o.jsxs("div",{onClick:()=>c(M.sessionId),style:{padding:"10px 12px",borderBottom:"1px solid rgba(255,255,255,0.04)",cursor:"pointer",background:F?"rgba(124,77,255,0.18)":"transparent",borderLeft:F?"3px solid #7c4dff":"3px solid transparent"},children:[o.jsx("div",{style:{fontSize:12,fontWeight:600,color:"#e5e2e1"},children:n7(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:[e7(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(e2).map(M=>o.jsxs("button",{type:"button",onClick:()=>k(F=>({...F,[M]:!F[M]})),style:{background:b[M]?"rgba(124,77,255,0.25)":"transparent",color:b[M]?"#e8deff":"#6a6a6a",border:`1px solid ${b[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," ",T[M]!=null?`(${T[M]})`:""]},M)),o.jsx("input",{type:"text",placeholder:"search…",value:g,onChange:M=>v(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"}),u&&!d&&o.jsx("div",{style:{color:"#9a9a9a",fontSize:12,padding:20},children:"Loading…"}),d&&C.length===0&&o.jsxs("div",{style:{color:"#9a9a9a",fontSize:12,padding:20},children:["No events match current filter (",((H=d.events)==null?void 0:H.length)||0," total)"]}),C.map((M,F)=>o.jsx(r7,{event:M,defaultExpanded:M.tag==="error"},`${M.ts}_${F}`))]})]})]})]}):null}const i7="0.1.64";function s1(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 Mx(e,t){return t==="running"?s1(e):e==null||!Number.isFinite(e)||e<=0?"--":s1(e)}const t2=h.createContext({modelLists:{cursor:[],opencode:[]},onModelChange:()=>{}});function o7(e){var v,x,N,_,C,T,H,M,F,D,$;const{setNodes:t}=wc(),n=u0(),{modelLists:r,onModelChange:s}=h.useContext(t2),i=h.useRef(null),a=!!((v=e.data)!=null&&v.readOnly),l=(x=e.data)!=null&&x.displaySize&&Number(e.data.displaySize.width)>0&&Number(e.data.displaySize.height)>0?{width:Number(e.data.displaySize.width),height:Number(e.data.displaySize.height)}:null,c=((N=e.data)==null?void 0:N.definitionId)==="agent_subAgent"&&!((_=e.data)!=null&&_.isRunMode)&&!a,d=h.useCallback(W=>{const O=()=>n(W);window.requestAnimationFrame(O),window.setTimeout(O,80)},[n]),f=h.useCallback((W,O)=>{const R=f1(O);R&&(t(I=>I.map(z=>{var E,X,ee,V,ie,fe;if(z.id!==W)return z;const P=Number(((X=(E=z.data)==null?void 0:E.displaySize)==null?void 0:X.width)||z.width||((ee=z.measured)==null?void 0:ee.width)||0),L=Number(((ie=(V=z.data)==null?void 0:V.displaySize)==null?void 0:ie.height)||z.height||((fe=z.measured)==null?void 0:fe.height)||0);return Math.abs(P-R.width)<2&&Math.abs(L-R.height)<2?z:{...z,width:R.width,height:R.height,data:{...z.data,displaySize:R}}})),d(W))},[d,t]),u=h.useCallback(W=>{if(a)return;const O=i.current;if(!O)return;const R=O.getBoundingClientRect();f(W,{width:Math.max(R.width,O.scrollWidth),height:Math.max(R.height,O.scrollHeight)})},[f,a]),p=h.useCallback(W=>{var ie,fe,me,ge,Z,ae;if(!c)return;W.preventDefault(),W.stopPropagation();const O=i.current,R=O==null?void 0:O.getBoundingClientRect(),I=Number(((fe=(ie=e.data)==null?void 0:ie.displaySize)==null?void 0:fe.width)||e.width||((me=e.measured)==null?void 0:me.width)||(R==null?void 0:R.width)||i2),z=Number(((Z=(ge=e.data)==null?void 0:ge.displaySize)==null?void 0:Z.height)||e.height||((ae=e.measured)==null?void 0:ae.height)||(R==null?void 0:R.height)||Ob),P=W.clientX,L=W.clientY,E=e.id;let X=0;const ee=xe=>{const pe=f1({width:I+xe.clientX-P,height:z+xe.clientY-L});pe&&(window.cancelAnimationFrame(X),X=window.requestAnimationFrame(()=>f(E,pe)))},V=()=>{window.cancelAnimationFrame(X),window.removeEventListener("pointermove",ee),window.removeEventListener("pointerup",V),window.removeEventListener("pointercancel",V),d(E)};window.addEventListener("pointermove",ee),window.addEventListener("pointerup",V,{once:!0}),window.addEventListener("pointercancel",V,{once:!0})},[f,(T=(C=e.data)==null?void 0:C.displaySize)==null?void 0:T.height,(M=(H=e.data)==null?void 0:H.displaySize)==null?void 0:M.width,e.height,e.id,(F=e.measured)==null?void 0:F.height,(D=e.measured)==null?void 0:D.width,e.width,d,c]),m=h.useCallback(W=>{t(O=>O.filter(R=>R.id!==W))},[t]),y=h.useCallback(()=>{var I,z,P,L,E,X,ee,V;const W=((I=e.data)==null?void 0:I.definitionId)||"",O=((z=e.data)==null?void 0:z.label)||e.id,R=((E=(L=(P=e.data)==null?void 0:P.outputs)==null?void 0:L[0])==null?void 0:E.value)||((V=(ee=(X=e.data)==null?void 0:X.outputs)==null?void 0:ee[0])==null?void 0:V.default)||"";window.__provideEditContent={instanceId:e.id,label:O,definitionId:W,content:R},window.dispatchEvent(new CustomEvent("provide-expand"))},[e.id,e.data]),b=h.useCallback((W,O)=>{t(R=>R.map(I=>{var P;if(I.id!==W)return I;const z=Array.isArray((P=I.data)==null?void 0:P.outputs)&&I.data.outputs.length?I.data.outputs.map((L,E)=>E===0?{...L,default:O,value:O}:L):[{type:"bool",name:"value",default:O,value:O}];return{...I,data:{...I.data,body:"",outputs:z}}}))},[t]),k=h.useCallback((W,O)=>{t(R=>R.map(I=>I.id===W?{...I,data:{...I.data,body:O}}:I))},[t]),g=h.useCallback((W,O)=>{t(R=>R.map(I=>I.id===W?{...I,data:{...I.data,images:Ts(O)}}:I))},[t]);return o.jsxs("div",{ref:i,className:"af-flow-node-shell"+(c?" af-flow-node-shell--resizable":""),style:l?{width:l.width,height:l.height}:void 0,children:[o.jsx(HT,{...e,data:{...e.data,onNodeContentResize:u},deleteNode:m,onProvideExpand:y,onProvideValueChange:b,onNodeBodyChange:k,onNodeImagesChange:g,modelLists:r,onModelChange:s}),c?o.jsx("span",{className:"af-flow-node-shell__resize-grip nodrag","aria-label":(($=e.data)==null?void 0:$.resizeLabel)||"Resize node",role:"separator",onPointerDown:p}):null]})}const a7={[Sp]:o7},Jd=["CONTROL","TOOL","PROVIDE","AGENT"],l7=1200,i1="af-flow-node--sync-flash",o1="af-flow-edge--sync-flash";function a1(e,t){const n=String(e||"").trim();return n?n.split(/\s+/).includes(t)?n:`${n} ${t}`:t}function l1(e,t){const n=String(e||"").trim();return n?n.split(/\s+/).filter(r=>r&&r!==t).join(" "):""}function L0(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 c7(e){const t=L0(e);return t==="CONTROL"?"control":t==="PROVIDE"?"provide":t==="TOOL"?"tool":"agent"}function Fh(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 n2(e){return String((e==null?void 0:e.label)||"").trim()||String((e==null?void 0:e.id)||"").trim()}function r2(e){return String((e==null?void 0:e.description)||(e==null?void 0:e.body)||"").replace(/\s+/g," ").trim()}function Ox(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 c1(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 u1(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 u7(e){return e==="CONTROL"?"account_tree":e==="TOOL"?"build":e==="PROVIDE"?"database":"smart_toy"}function d7(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 s2(e,t,n,r,s){const i=c7(e),a={id:t,type:Sp,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 tp(a,r,s)}const i2=320,f7=220,p7=1600,Ob=104,h7=900;function d1(e,t,n){const r=Number(e);return!Number.isFinite(r)||r<=0?0:Math.min(n,Math.max(t,Math.round(r)))}function f1(e){if(!e||typeof e!="object")return null;const t=Number(e.width),n=Number(e.height);return!Number.isFinite(t)||!Number.isFinite(n)||t<=0||n<=0?null:{width:d1(t,f7,p7)||i2,height:d1(n,Ob,h7)||Ob}}function m7(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 p1(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=zu(i,e.sourceHandle||"output-0","source"),c=zu(a,e.targetHandle||"input-0","target");return!l||!c?!1:Fu(l,c)}function g7(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=zu(i,r,s);return a?{nodeId:n,handleId:r,handleType:s,slot:a,slotType:zT(a)}:null}function y7(e,t,n){var a;const r=s2(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 c=i[l];if(n.handleType==="source"?Fu(n.slot,c):Fu(c,n.slot))return{slot:c,slotIndex:l,hydrated:r}}return null}function x7(e,t){return t?e.map((n,r)=>{const s=y7(n,e,t);if(!s)return null;const i=L0(n);return{def:n,order:r,category:i,categoryRank:Jd.indexOf(i),slot:s.slot,slotIndex:s.slotIndex,displayLabel:n2(s.hydrated.data||n),description:r2(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 w7=/@([a-zA-Z_][a-zA-Z0-9_]*)/g;function b7(e){const t=new Set,n=[];let r;const s=new RegExp(w7.source,"g");for(;(r=s.exec(e))!==null;){const i=r[1];t.has(i)||(t.add(i),n.push(i))}return n}function h1(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 Zo(e){const t=String(e||"").indexOf(" - ");return t>=0?e.slice(0,t).trim():String(e||"").trim()}function zh(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:[],c=i.map(Zo),d=a.map(Zo);return l.map(Zo).includes(s)&&!c.includes(s)&&!d.includes(s)?`claude-code:${s}`:d.includes(s)&&!c.includes(s)?`opencode:${s}`:s}function v7(e){if(e==null)return"";const t=String(e).trim();return t?t.length<=26?t:`${t.slice(0,12)}…${t.slice(-10)}`:""}function $x(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 k7({steps:e}){const{t}=Mn();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:v7(s)}):null]}):null})]},n.index)})})}function S7(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 N7(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 j7(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 C7(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 m1({thread:e,liveSegments:t,running:n,className:r="",autoScroll:s=!0}){const{t:i}=Mn(),a=h.useRef(null),l=["af-composer-ai-stack","af-composer-ai-stack--in-panel","af-composer-thread-stack",r].filter(Boolean).join(" ");return h.useEffect(()=>{if(!s||!a.current)return;const c=a.current;requestAnimationFrame(()=>{c.scrollTop=c.scrollHeight})},[e,t,s]),o.jsxs("div",{ref:a,className:l,children:[e.map((c,d)=>c.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:c.text})]},`composer-u-${d}-${c.text.slice(0,48)}`):o.jsx("div",{className:"af-composer-thread-assistant",children:o.jsx(g1,{segments:c.segments,running:!1})},`composer-a-${d}`)),o.jsx("div",{className:"af-composer-thread-assistant",children:o.jsx(g1,{segments:t,running:n})})]})}function g1({segments:e,running:t=!1}){const{t:n}=Mn(),r=e.filter(u=>u.kind==="assistant").map(u=>u.text).join(""),s=e.filter(u=>u.kind==="result").map(u=>u.text).join(""),i=S7(r,s),a=e.filter(u=>u.kind==="error").map(u=>u.text).join(`
|
|
131
|
+
`),l=e.filter(u=>u.kind!=="error"),c=i?l.filter(u=>u.kind!=="result"):l,d=N7(c),f=!!(d.length>0||a);return o.jsxs(o.Fragment,{children:[d.map((u,p)=>o.jsxs("section",{className:C7(u.kind),children:[o.jsx("div",{className:"af-composer-ai-block-label",children:j7(u.kind,n)}),o.jsx("div",{className:"af-composer-ai-block-body",children:u.text})]},`${u.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 E7({fitViewEpoch:e}){const{fitView:t}=wc(),n=h.useRef(t);return n.current=t,h.useEffect(()=>{if(e>0){const r=requestAnimationFrame(()=>n.current({padding:.2,duration:200,maxZoom:1}));return()=>cancelAnimationFrame(r)}},[e]),null}function _7({onReady:e}){const t=u0();return h.useEffect(()=>(e(t),()=>e(null)),[e,t]),null}function y1(e){const t=Number.isFinite(e)?e:1;return Math.min(Math.max(t,.75),1)}function x1(e){if(!e||typeof e!="object")return null;const t=Number(e.x),n=Number(e.y),r=Number(e.zoom);return!Number.isFinite(t)||!Number.isFinite(n)||!Number.isFinite(r)?null:{x:t,y:n,zoom:Math.min(Math.max(r,.1),4)}}const gm=1500,w1=500,P7=262144,A7=2e3;function Dx(e){return typeof e!="string"?"":e.length<=A7?e:`[log line truncated, ${e.length} chars]`}const I7=gm;function T7(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:Dx(s)}}catch{return{ts:n,type:"info",text:Dx(s)}}return{ts:n,type:"log",text:Dx(`[${r}] ${s}`)}}function b1(e){if(!e)return[];const t=[],n=e.split(`
|
|
132
|
+
`);for(let r=n.length-1;r>=0&&t.length<I7;r--){const s=n[r];if(!s)continue;const i=T7(s);i&&t.push(i)}return t.reverse(),t}function R7(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 L7(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 M7({fitViewEpoch:e,canvasTool:t,nodes:n,edges:r,onNodesChange:s,onEdgesChange:i,onConnect:a,onConnectStart:l,onConnectEnd:c,isValidConnection:d,onNodesDelete:f,onNodeClick:u,onNodeDoubleClick:p,onEdgeClick:m,onFlowInit:y,onDrop:b,onDragOver:k,hideMinimapAndControls:g,bottomSlot:v}){const{t:x}=Mn(),N=!s,_=N||t==="pan"?!0:[1,2],C=N?!1:t==="select",T="af-flow-canvas"+(N?" af-flow-canvas--run-mode":"")+(t==="pan"?" af-flow-canvas--tool-pan":" af-flow-canvas--tool-select"),H=h.useCallback(()=>{},[]),M=h.useMemo(()=>{const F=new Map(n.map(R=>[R.id,R])),D=new Set(n.filter(R=>R.selected).map(R=>R.id)),$=D.size>0,W=(R,I)=>{const z=/^#([0-9a-f]{6})$/i.exec(R);if(!z)return R;const P=parseInt(z[1],16);return`rgba(${P>>16&255}, ${P>>8&255}, ${P&255}, ${I})`},O="#ff5169";return r.map(R=>{var pe,_e,je,Ve;const I=F.get(R.source),z=F.get(R.target),P=/^output-(\d+)$/.exec(R.sourceHandle||""),L=/^input-(\d+)$/.exec(R.targetHandle||""),E=I&&P?(_e=(pe=I.data)==null?void 0:pe.outputs)==null?void 0:_e[parseInt(P[1],10)]:null,X=z&&L?(Ve=(je=z.data)==null?void 0:je.inputs)==null?void 0:Ve[parseInt(L[1],10)]:null,ee=E!=null&&E.type?or(E.type):null,V=X!=null&&X.type?or(X.type):null,ie=ee&&V&&ee!==V,fe=$&&(D.has(R.source)||D.has(R.target)),me=R.style||{};if(ie){const et=R.selected?.95:fe?.85:.78,qe=W(O,et);return{...R,className:((R.className||"")+" af-flow-edge--type-mismatch"+(fe?" af-flow-edge--adjacent":"")).trim(),style:{...me,stroke:qe,strokeWidth:fe?2.75:2.5,strokeDasharray:"6 4"},markerEnd:R.markerEnd&&typeof R.markerEnd=="object"?{...R.markerEnd,color:qe}:{type:$s.ArrowClosed,color:qe}}}const ge=ee||V;if(!ge)return fe?{...R,className:((R.className||"")+" af-flow-edge--adjacent").trim(),style:{...me,strokeWidth:2.5}}:R;const Z=fe||R.selected?.7:.38,ae=W(ge,Z),xe=fe?2.5:me.strokeWidth??2;return{...R,className:((R.className||"")+(fe?" af-flow-edge--adjacent":"")).trim(),style:{...me,stroke:ae,strokeWidth:xe},markerEnd:R.markerEnd&&typeof R.markerEnd=="object"?{...R.markerEnd,color:ae}:{type:$s.ArrowClosed,color:ae}}})},[n,r]);return o.jsxs(c0,{className:T,nodes:n,edges:M,onNodesChange:s||H,onEdgesChange:i||H,onConnect:N?void 0:a,onConnectStart:N?void 0:l,onConnectEnd:N?void 0:c,isValidConnection:N?void 0:d,onNodesDelete:N?void 0:f,onNodeClick:u,onNodeDoubleClick:N?void 0:p,onEdgeClick:N?void 0:m,onInit:y,onDrop:N?void 0:b,onDragOver:N?void 0:k,nodeTypes:a7,selectionOnDrag:C,panOnDrag:_,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(d0,{gap:20,size:1,color:"rgba(28, 27, 27, 0.9)"}),o.jsx($u,{position:"bottom-center",className:"af-flow-bottom-unified-panel"+(g?" af-flow-bottom-unified-panel--solo":""),children:o.jsxs("div",{className:"af-flow-bottom-unified-row"+(g?" af-flow-bottom-unified-row--solo":""),children:[g?null:o.jsx("div",{className:"af-flow-bottom-unified__side af-flow-bottom-unified__side--minimap",children:o.jsx(B4,{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:F=>{var $;const D=((($=F.data)==null?void 0:$.schemaType)??"agent").toLowerCase();return D==="control"?"rgba(237, 108, 2, 0.85)":D==="provide"?"rgba(0, 228, 117, 0.35)":D==="tool"?"rgba(124, 77, 255, 0.75)":"rgba(158, 202, 255, 0.5)"}})}),o.jsx("div",{className:"af-flow-bottom-unified__center",children:v}),g?null:o.jsx("div",{className:"af-flow-bottom-unified__side af-flow-bottom-unified__side--zoom",children:o.jsx(P4,{position:"bottom-right",showInteractive:!1,className:"af-flow-bottom-controls"})})]})}),!g&&o.jsx($u,{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:F,color:D})=>o.jsxs("span",{className:"af-pin-legend__item",children:[o.jsx("span",{className:"af-pin-legend__dot",style:{background:D}}),o.jsx("span",{className:"af-pin-legend__label",children:F})]},F))}),o.jsx(E7,{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:x("flow:emptyCanvas.composerHint")}),o.jsx("p",{className:"af-flow-empty-hint-sub",dangerouslySetInnerHTML:{__html:x("flow:emptyCanvas.composerSub")}})]}):null]})}function v1(e){if(!window.location.pathname.startsWith("/flow"))return;if(!e){window.history.replaceState({},"","/flow");return}const t=new URLSearchParams(window.location.search),n=new URLSearchParams({flowId:e.id,flowSource:e.source??"user"});e.archived&&n.set("flowArchived","1"),t.get("panel")==="settings"&&n.set("panel","settings"),window.history.replaceState({},"","/flow?"+n.toString())}function O7(e){return e==="builtin"||e==="admin"?"workspace":e??"user"}function bi(e){return e==="builtin"||e==="admin"}function zc(e,t){return t(e==="builtin"||e==="admin"?"flow:settings.builtin":e==="workspace"?"flow:palette.workspace":"flow:palette.userDir")}function $7(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 o2="af:run-console-height",xf=230,Fd={enabled:!1,cron:"",timezone:"Asia/Shanghai",preset:"",overlapPolicy:"skip",misfirePolicy:"skip",nextRunAt:null},Hh={};function ym(e){if(!Number.isFinite(e))return xf;const t=Math.max(240,Math.floor(window.innerHeight*.88));return Math.min(Math.max(Math.round(e),96),t)}function D7(){try{const e=localStorage.getItem(o2);if(e==null)return xf;const t=parseInt(e,10);return Number.isFinite(t)?ym(t):xf}catch{return xf}}function F7(){var uk,dk;const{t:e,i18n:t}=Mn(),{navigate:n,path:r}=Ro(),s=h.useRef(null),i=h.useRef(new Map),a=h.useCallback(w=>{s.current=typeof w=="function"?w:null},[]),[l,c]=h.useState([]),[d,f]=h.useState(""),[u,p]=h.useState(null),[m,y]=h.useState(0),[b,k]=h.useState(""),[g,v]=h.useState(""),[x,N]=h.useState(""),[_,C]=h.useState(""),[T,H]=h.useState(!1),[M,F]=h.useState(""),[D,$]=h.useState(!1),[W,O]=h.useState(""),[R,I]=h.useState(!1),[z,P]=h.useState(!1),[L,E]=h.useState(!1),[X,ee]=h.useState(null),[V,ie]=h.useState(!1),[fe,me]=h.useState(!1),ge=h.useRef(!1),[Z,ae]=h.useState([]),[xe,pe]=h.useState(""),[_e,je]=h.useState("nodes"),Ve=h.useRef(null),[et,qe]=h.useState([]),[dt,He]=h.useState(!1),[bt,sn]=h.useState(""),[on,an]=h.useState(!1),[Yt,En]=h.useState({name:"",id:"",description:""}),[hn,ue]=h.useState(!1),[ke,De]=h.useState(""),[rt,at]=h.useState(""),Lt=h.useRef(null),[st,mn]=h.useState([]),[Zt,ar]=h.useState(!1),[_n,gn]=h.useState(""),[bn,lr]=h.useState(""),[ve,$e]=h.useState(null),[nt,zt]=h.useState(null),[oe,Te]=h.useState([]),[Ue,Ht]=h.useState(""),[yn,cr]=h.useState(!1),Hs=h.useCallback(w=>{Lt.current&&window.clearTimeout(Lt.current),at(w),Lt.current=window.setTimeout(()=>{at(""),Lt.current=null},3800)},[]),as=h.useCallback(w=>{const j=String(w||"").trim();if(!j)return;const B=()=>{var q;return(q=s.current)==null?void 0:q.call(s,j)};window.requestAnimationFrame(B),window.setTimeout(B,80)},[]);h.useEffect(()=>()=>{Lt.current&&window.clearTimeout(Lt.current)},[]);const[hr,Zn]=h.useState(!1),[Vr,ot]=h.useState({files:[]}),[Ur,Ai]=h.useState(!1),[xa,xs]=h.useState(!0);h.useEffect(()=>{let w=!1;const j=()=>{fetch("/api/flows",{method:"HEAD"}).then(q=>{w||xs(q.ok)}).catch(()=>{w||xs(!1)})};j();const B=window.setInterval(j,5e3);return()=>{w=!0,window.clearInterval(B)}},[]),h.useEffect(()=>{let w=!1;return fetch("/api/dev-info").then(j=>j.json()).then(j=>{w||wa(!!(j!=null&&j.isDev))}).catch(()=>{}),()=>{w=!0}},[]),h.useEffect(()=>{u!=null&&u.id&&oP(u.id,u.source??"user","pipeline",!!u.archived)},[u==null?void 0:u.id,u==null?void 0:u.source,u==null?void 0:u.archived]);const[Ie,cn]=h.useState("edit"),[mr,ht]=h.useState([]),Oe=h.useRef(0),[Kr,Gn]=h.useState(new Set),[qr,Cr]=h.useState({}),[ut,Ut]=h.useState(null),[un,Er]=h.useState(0),[tt,gr]=h.useState(!1),[Bs,wa]=h.useState(!1),[ws,Oo]=h.useState(!1),[vr,$o]=h.useState(D7),Ii=h.useRef({active:!1,pointerId:-1,startY:0,startH:xf}),[xn,er]=h.useState(null),[bs,Yr]=h.useState(null),[li,Ws]=h.useState({}),K=h.useRef(li);h.useEffect(()=>{K.current=li},[li]);const[we,Le]=h.useState(!1),[Me,Ke]=h.useState(!1),[en,Mt]=h.useState({}),[wn,Gr]=h.useState({}),[ls,Vs]=h.useState(null),[ur,ba]=h.useState(Fd),[nd,Pp]=h.useState(!1),[Ti,va]=h.useState(!1),[wl,_r]=h.useState(""),[bl,vl]=h.useState(""),[Kt,vc]=h.useState(Hh),[Bt,kl]=h.useState(null),so=h.useRef(0),ci=h.useRef(null),Do=h.useRef(null),rd=h.useRef(!0),Fo=h.useRef(!1),[kr,Sl]=h.useState(null),[ui,Ri]=h.useState(null),[kc,zo]=h.useState(!1),[ka,Ho]=h.useState(""),[Nl,jl]=h.useState(!1),sd=h.useRef(null),[di,Lr]=h.useState(null),[id,fi]=h.useState(!1),[Sa,Bo]=h.useState(null),[vs,od]=h.useState(!1),[Xr,Na]=h.useState(null),pi=h.useRef(null),[ks,Pe]=h.useState(""),[Ss,ja]=h.useState(0),[Ca,hi]=h.useState(0),[Ap,ad]=h.useState("pan"),[Bn,io]=h.useState(!1),[On,Ip]=h.useState(!1),ld=h.useRef(null),cd=h.useRef(null),Ea=h.useRef(null),[Tp,Rp]=h.useState(0),[gt,ud]=h.useState(null),[Lp,Cl]=h.useState(""),[vt,Mp]=h.useState({cursor:[],opencode:[],claudeCode:[]}),[mi,El]=h.useState(""),[Sc,yy]=h.useState(""),[gi,Op]=h.useState([]),[dr,oo]=h.useState([]),[dd,$p]=h.useState(!1),[_l,Dp]=h.useState([]),[fd,Us]=h.useState(!1),[Fp,Pl]=h.useState(()=>new Set),[Li,mt]=h.useState(!1),Gt=h.useRef(null),Nc=h.useRef(null),[xy,pd]=h.useState({}),jc=h.useCallback(w=>{if(!w)return null;const j=w.id,B=w.source??"user",q=w.archived?"archived":"";return{sessionsKey:`af:composer-sessions:${j}:${B}${q?":"+q:""}`,activeKey:`af:composer-active-session:${j}:${B}${q?":"+q:""}`}},[]),zp=h.useCallback(w=>{if(!w)return"";const j=w.id,B=w.source??"user",q=w.archived?"archived":"";return`af:composer-skills:pipeline:${j}:${B}${q?":"+q:""}`},[]),Hp=h.useCallback(w=>{const j=jc(w);if(!j)return{sessions:[],activeSessionId:null};try{const B=localStorage.getItem(j.sessionsKey);if(!B)return{sessions:[],activeSessionId:null};const q=JSON.parse(B);if(!Array.isArray(q))return{sessions:[],activeSessionId:null};const Y=q.filter(te=>te&&typeof te.id=="string").map(te=>({...te,running:!1,statusLine:te.running?e("flow:composer.pageRefreshReset"):te.statusLine,steps:[]}));let J=null;try{J=localStorage.getItem(j.activeKey),J&&!Y.some(te=>te.id===J)&&(J=null)}catch{J=null}return{sessions:Y,activeSessionId:J}}catch{return{sessions:[],activeSessionId:null}}},[jc]),Cc=h.useCallback((w,j,B)=>{const q=jc(w);if(q)try{localStorage.setItem(q.sessionsKey,JSON.stringify(j)),B?localStorage.setItem(q.activeKey,B):localStorage.removeItem(q.activeKey)}catch{}},[jc]),Wo=h.useRef(0),Al=h.useRef({sessions:[],activeSessionId:null,flowKey:null}),[cs,Jr]=h.useState([]),[tr,ao]=h.useState(null),lo=h.useMemo(()=>zp(u),[zp,u]),[Ec,Vo]=h.useState(""),Wn=h.useMemo(()=>{if(!u)return null;const w=u.id,j=u.source??"user",B=u.archived?"archived":"";return`${w}:${j}${B?":"+B:""}`},[u]),_a=h.useRef(!1);h.useEffect(()=>{if(!Wn){Jr([]),ao(null),Al.current={sessions:[],activeSessionId:null,flowKey:null};return}const w=Al.current;if(w.flowKey===Wn)return;w.flowKey=Wn,_a.current&&w.sessions.length>0&&Cc(u,w.sessions,w.activeSessionId);const{sessions:j,activeSessionId:B}=Hp(u);if(j.length===0){const q=`session-1-${Date.now()}`,Y={id:q,label:e("flow:composer.conversationLabel",{n:1}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null};w.sessions=[Y],w.activeSessionId=q,Jr([Y]),ao(q)}else{const q=j[j.length-1];if(q&&(!q.thread||q.thread.length===0))Wo.current=$x(j),w.sessions=j,w.activeSessionId=q.id,Jr(j),ao(q.id);else{const J=$x(j)+1;Wo.current=J;const te=`session-${J}-${Date.now()}`,ne={id:te,label:e("flow:composer.conversationLabel",{n:J}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null},ye=[...j,ne];w.sessions=ye,w.activeSessionId=te,Jr(ye),ao(te)}}_a.current=!0},[Wn,u,Hp,Cc]);const Pn=h.useMemo(()=>cs.find(w=>w.id===tr)||null,[cs,tr]),An=(Pn==null?void 0:Pn.running)??!1,Il=(Pn==null?void 0:Pn.statusLine)??"",Uo=(Pn==null?void 0:Pn.segments)??[],co=(Pn==null?void 0:Pn.thread)??[],hd=(Pn==null?void 0:Pn.steps)??[];Pn==null||Pn.outputDismissed;const jt=(Pn==null?void 0:Pn.phaseContext)??null,md=h.useRef([]),[_c,Ko]=h.useState(!1),Tl=h.useRef(null),Bp=h.useRef(null);h.useEffect(()=>{const w=Bp.current;w&&requestAnimationFrame(()=>{w.scrollTop=w.scrollHeight})},[co,Uo]);const Pc=h.useRef(null),Ac=h.useRef(!1),Rl=h.useRef(null),Wp=h.useCallback(w=>{const j=++Wo.current,B=`session-${j}-${Date.now()}`,q={id:B,label:w||e("flow:composer.conversationLabel",{n:j}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null};return Jr(Y=>[...Y,q]),ao(B),B},[]);h.useEffect(()=>{!u||!_a.current||(Al.current.sessions=cs,Al.current.activeSessionId=tr,Cc(u,cs,tr))},[cs,tr,u,Cc]),h.useEffect(()=>{Wo.current=Math.max(Wo.current,$x(cs))},[cs]);const Vp=h.useCallback(w=>{var j;Pc.current===w&&((j=Tl.current)==null||j.abort()),Jr(B=>{const q=B.filter(J=>J.id!==w);if(B.some((J,te)=>J.id===w&&B.findIndex(ne=>ne.id===tr)===te)||tr===w){const J=q;J.length>0?ao(J[J.length-1].id):setTimeout(()=>{Wo.current=0;const te=++Wo.current,ne=`session-${te}-${Date.now()}`,ye={id:ne,label:e("flow:composer.conversationLabel",{n:te}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null};Jr(be=>[...be,ye]),ao(ne)},0)}return q})},[tr]),Qr=h.useCallback(w=>{Jr(j=>{const B=j.findIndex(J=>J.id===tr);if(B<0)return j;const q={...j[B]};w(q);const Y=[...j];return Y[B]=q,Y})},[tr]),Up=h.useCallback(w=>{Qr(j=>{j.running=w})},[Qr]),Ks=h.useCallback(w=>{Qr(j=>{j.statusLine=w})},[Qr]),qs=h.useCallback(w=>{Qr(j=>{typeof w=="function"?j.segments=w(j.segments):j.segments=w})},[Qr]),Kp=h.useCallback(w=>{Qr(j=>{typeof w=="function"?j.thread=w(j.thread):j.thread=w})},[Qr]),yi=h.useCallback(w=>{Qr(j=>{typeof w=="function"?j.steps=w(j.steps):j.steps=w})},[Qr]),qp=h.useCallback(w=>{Qr(j=>{j.outputDismissed=w})},[Qr]),Ll=h.useCallback(w=>{Qr(j=>{j.phaseContext=typeof w=="function"?w(j.phaseContext):w})},[Qr]),qo=h.useCallback(w=>{ao(w),Jr(j=>{const B=j.findIndex(Y=>Y.id===w);if(B<0||!j[B].outputDismissed)return j;const q=[...j];return q[B]={...j[B],outputDismissed:!1},q})},[]);h.useEffect(()=>{md.current=Uo},[Uo]);const nr=h.useRef({}),xi=h.useRef(!1),Mi=h.useRef(null),Ic=h.useRef(null),uo=h.useRef(null),Pa=h.useRef(!1),gd=h.useRef(0),Ml=h.useRef(""),[Et,kt,wy]=nI([]),[vn,Xt,by]=rI([]),Ys=h.useRef(Et),Yo=h.useRef(vn),yd=h.useRef(null),Tc=h.useRef(null),Yp=h.useRef(null),Ol=h.useRef(null),[dn,Oi]=h.useState(null),Gp=h.useCallback(w=>{var j;nr.current=(j=w==null?void 0:w.extra)!=null&&j.instances&&typeof w.extra.instances=="object"?w.extra.instances:{},kt(Array.isArray(w==null?void 0:w.nodes)?w.nodes:[]),Xt(Array.isArray(w==null?void 0:w.edges)?w.edges:[]),Oi(null)},[Xt,kt]),vy=h.useMemo(()=>({instances:nr.current}),[vn,Et]),{resetHistory:xd,undo:wd,redo:S}=FT({nodes:Et,edges:vn,extra:vy,enabled:!!u&&Pa.current&&Ie==="edit",onRestore:Gp}),A=h.useMemo(()=>Et.filter(w=>{var j;return(((j=w.data)==null?void 0:j.definitionId)||"").startsWith("provide_")}),[Et]),U=h.useMemo(()=>{var j;const w={};for(const B of Et){if(!((j=B.data)!=null&&j.inputs))continue;const q=B.data.inputs;for(let Y=0;Y<q.length;Y++){const J=q[Y];if(!(J!=null&&J.name))continue;const te=vn.find(ye=>ye.target===B.id&&ye.targetHandle===`input-${Y}`);if(!(te!=null&&te.source))continue;A.find(ye=>ye.id===te.source)&&(w[te.source]=J.name)}}return w},[Et,vn,A]),G=h.useMemo(()=>{if(Ie==="edit"||Kr.size===0)return null;const w=new Set(Kr);for(const j of vn)Kr.has(j.source)&&w.add(j.target),Kr.has(j.target)&&w.add(j.source);return w},[Ie,Kr,vn]),Q=h.useMemo(()=>Ie==="edit"?Et:Et.map(w=>{var j,B;return{...w,draggable:!1,connectable:!1,data:{...w.data,isRunMode:!0,isExecuting:Kr.has(w.id),nodeStatus:((j=qr[w.id])==null?void 0:j.status)??null,nodeElapsed:((B=qr[w.id])==null?void 0:B.elapsed)??null,isDim:G?!G.has(w.id):!1}}}),[Ie,Et,Kr,qr,G]),se=h.useMemo(()=>G?vn.map(w=>{const j=Kr.has(w.source)||Kr.has(w.target),B=w.className?w.className.replace(/\s?af-flow-edge--(dim|focus)\b/g,""):"",q=j?"af-flow-edge--focus":"af-flow-edge--dim";return{...w,className:(B?B+" ":"")+q}}):vn,[vn,Kr,G]);h.useEffect(()=>{if(!u){Gr({}),Vs(null),ba(Fd),vc(Hh),kl(null),_r(""),vl("");return}const w=new URLSearchParams({flowId:u.id,flowSource:u.source||"user"});u.archived&&w.set("archived","1"),fetch(`/api/flow/run-config?${w.toString()}`).then(j=>j.json()).then(j=>{Gr(j.presets||{}),Vs(j.activePreset||null)}).catch(()=>{Gr({}),Vs(null)})},[u==null?void 0:u.id,u==null?void 0:u.source,u==null?void 0:u.archived]);const re=h.useCallback(w=>{so.current+=1,ba(w)},[]),le=h.useCallback(async(w,j={})=>{if(!w)return;const B=!!j.quiet,q=!!j.force,Y=so.current;B||(Pp(!0),_r(""),vl(""));const J=new URLSearchParams({flowId:w.id,flowSource:w.source||"user"});w.archived&&J.set("archived","1");try{const te=await fetch(`/api/flow/schedule?${J.toString()}`),ne=await te.json().catch(()=>({}));if(!te.ok)throw new Error(ne.error||`HTTP ${te.status}`);if(!q&&so.current!==Y)return;ba({...Fd,...ne.schedule||{}}),vc(ne.state&&typeof ne.state=="object"?ne.state:Hh),kl(ne.status||null)}catch(te){if(!q&&so.current!==Y)return;ba(Fd),vc(Hh),kl(null),_r(String(te.message||te))}finally{Pp(!1)}},[]);h.useEffect(()=>{if(!u)return;let w=!1;return(async()=>{await le(u)})(),()=>{w=!0}},[u==null?void 0:u.id,u==null?void 0:u.source,u==null?void 0:u.archived,le]),h.useEffect(()=>{var B,q,Y,J;if(!ls||!wn[ls]||A.length===0)return;const w=wn[ls],j={};for(const te of A){const ne=U[te.id];if(!ne)continue;const ye=((B=te.data)==null?void 0:B.definitionId)||"",be=w[te.id]??((J=(Y=(q=te.data)==null?void 0:q.outputs)==null?void 0:Y[0])==null?void 0:J.default)??"";ye.startsWith("provide_file")?j[ne]={type:"file",path:be}:j[ne]={type:"str",value:be}}Object.keys(j).length>0&&Ws(j)},[ls,wn,A,U]);const he=h.useCallback(()=>{if(!Xr||!pi.current)return;const w=pi.current.value;kt(j=>j.map(B=>{var q,Y;return B.id!==Xr.instanceId?B:{...B,data:{...B.data,outputs:((Y=(q=B.data)==null?void 0:q.outputs)==null?void 0:Y.map((J,te)=>te===0?{...J,default:w}:J))||[{type:"text",name:"value",default:w}]}}})),Na(null)},[Xr,kt]),ce=h.useMemo(()=>{const w=Et.filter(j=>j.selected);return w.length===1?w[0]:null},[Et]),Ce=h.useMemo(()=>u?iK(Et,vn,e):[],[u,Et,vn,e]),Be=h.useMemo(()=>Ce.map(w=>w.key).join("|"),[Ce]),yt=h.useMemo(()=>Ce.some(w=>String((w==null?void 0:w.level)||"warning").toLowerCase()==="error"),[Ce]);h.useLayoutEffect(()=>{ie(Ce.length>0&&!yt)},[Be,u==null?void 0:u.id,u==null?void 0:u.source,Ce.length,yt]),Ea.current=ce,h.useEffect(()=>{Ys.current=Et},[Et]),h.useEffect(()=>{const w=i.current,j=new Map,B=[];for(const te of Et){const ne=m7(te);j.set(te.id,ne),w.get(te.id)!==ne&&B.push(te.id)}if(i.current=j,B.length===0)return;const q=()=>B.forEach(te=>{var ne;return(ne=s.current)==null?void 0:ne.call(s,te)}),Y=window.requestAnimationFrame(q),J=window.setTimeout(q,80);return()=>{window.cancelAnimationFrame(Y),window.clearTimeout(J)}},[Et]),h.useEffect(()=>{Yo.current=vn},[vn]),h.useEffect(()=>{Yp.current=dn},[dn]),h.useEffect(()=>{if(!dn)return;const w=B=>{B.key==="Escape"&&Oi(null)},j=B=>{var q,Y;(Y=(q=B.target)==null?void 0:q.closest)!=null&&Y.call(q,".af-connect-node-menu")||Oi(null)};return document.addEventListener("keydown",w),document.addEventListener("pointerdown",j),()=>{document.removeEventListener("keydown",w),document.removeEventListener("pointerdown",j)}},[dn]),h.useEffect(()=>()=>{uo.current!=null&&(clearTimeout(uo.current),uo.current=null)},[]);const Xe=h.useMemo(()=>{var j;if(!ce)return null;const w=(j=ce.data)==null?void 0:j.definitionId;return Z.find(B=>B.id===w)??null},[ce,Z]),_t=h.useMemo(()=>{const w={CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const j of Z){const B=L0(j);w[B].push(j)}for(const j of Jd)w[j].sort((B,q)=>B.id.localeCompare(q.id));return w},[Z]),kn=h.useMemo(()=>{const w=xe.trim().toLowerCase();if(!w)return _t;const j={CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const B of Jd)j[B]=_t[B].filter(q=>d7(q,w));return j},[_t,xe]),us=h.useMemo(()=>Jd.reduce((w,j)=>w+kn[j].length,0),[kn]),ln=h.useMemo(()=>Z.filter(w=>{const j=String(w.id??""),B=String(w.source??"");return j.startsWith("marketplace:")||B==="marketplace"||B==="collection"}),[Z]),fn=h.useMemo(()=>{const w=new Set;for(const j of ln){const B=String(j.id??"");if(B&&(w.add(B),B.startsWith("marketplace:"))){const q=B.slice(12),[Y]=q.split("@");Y&&w.add(`marketplace:${Y}`)}}return w},[ln]),rr=h.useCallback(async()=>{f("");try{const w=await fetch("/api/flows");if(!w.ok)throw new Error("HTTP "+w.status);c(await w.json())}catch(w){f(String(w.message||w))}},[]);h.useEffect(()=>{rr()},[rr]),h.useEffect(()=>{if(r!=="/flow")return;const w=new URLSearchParams(window.location.search);w.get("new")==="1"&&!w.get("flowId")&&n("/projects?new=1")},[r,n]),h.useEffect(()=>{if(r!=="/flow"||!u)return;new URLSearchParams(window.location.search).get("panel")==="settings"&&zt("settings")},[r,u==null?void 0:u.id,u==null?void 0:u.source]),h.useEffect(()=>{let w=!1;const j=()=>{fetch("/api/model-lists").then(q=>q.json()).then(q=>{w||Mp({cursor:Array.isArray(q.cursor)?q.cursor.map(String):[],opencode:Array.isArray(q.opencode)?q.opencode.map(String):[],claudeCode:Array.isArray(q.claudeCode)?q.claudeCode.map(String):[]})}).catch(()=>{})};j();const B=setTimeout(j,4e3);return()=>{w=!0,clearTimeout(B)}},[]),h.useEffect(()=>{let w=!1;return fetch("/api/skills").then(j=>j.json()).then(j=>{if(w)return;const B=Array.isArray(j.skills)?j.skills.filter(q=>q&&typeof q.key=="string"&&q.key.trim()).map(q=>({key:String(q.key),name:String(q.name||q.id||q.key),description:q.description?String(q.description):"",sourceLabel:q.sourceLabel?String(q.sourceLabel):""})):[];Op(B),$p(!0)}).catch(()=>{}),()=>{w=!0}},[]),h.useEffect(()=>{let w=!1;return fetch("/api/skill-collections").then(j=>j.json()).then(j=>{w||(Dp(rl(j)),Us(!0))}).catch(()=>{}),()=>{w=!0}},[]),h.useEffect(()=>{if(Vo(""),!(!dd||!fd)){if(!lo){oo([]);return}oo(uP(lo,"pipeline",gi,_l)),Vo(lo)}},[_l,fd,gi,dd,lo]),h.useEffect(()=>{if(!(Ec!==lo||!lo))try{localStorage.setItem(lo,JSON.stringify(dr))}catch{}},[dr,lo,Ec]);const Tt=h.useCallback(async w=>{const j=w.source??"user",B=!!w.archived,q=new URLSearchParams({flowId:w.id,flowSource:j});B&&q.set("archived","1");const Y=new URLSearchParams({flowId:w.id,flowSource:j});B&&Y.set("archived","1"),Y.set("lang",String(t.language||"zh").startsWith("zh")?"zh":"en");const[J,te]=await Promise.all([fetch("/api/flow?"+q.toString()),fetch("/api/nodes?"+Y.toString())]),ne=await J.json();if(!J.ok||ne.error)throw new Error(ne.error||e("flow:nodePropsError.loadFlowFailed"));const ye=await te.json();if(!te.ok)throw new Error(e("flow:nodePropsError.loadNodesFailed"));const be=Array.isArray(ye)?ye:Array.isArray(ye==null?void 0:ye.nodes)?ye.nodes:[],ze=!Array.isArray(ye)&&(ye==null?void 0:ye.pipelineTranslations)||{},de=nK(ne.flowYaml||"");if(de.error)throw new Error(de.error);const Fe={...de.instances||{}},Ne=de.nodes.map(Sn=>tp(Sn,Fe,be,ze,w.id)),xt=DT(de.edges,Ne);return{flowSource:j,paletteList:be,instances:Fe,flowDescriptionText:de.description??"",viewport:x1(de.viewport),nodes:Ne,edges:xt}},[t.language,e]),$t=h.useCallback(async(w,j={})=>{const B=!!j.preserveComposer,q=B&&!!j.incrementalSync;Pa.current=!1,gd.current+=1,p(w),v(""),B||(N(""),pe(""),zt(null),k(""),F(""),O(""),Pe(""),Kp([]),qs([]),yi([]),qp(!1),Ll(null),ad("pan")),q||(nr.current={},kt([]),Xt([])),v1(w);try{const Y=await Tt(w);if(ae(Y.paletteList),nr.current=Y.instances,k(Y.flowDescriptionText),F(w.id||""),q){const J=Ys.current,te=Yo.current;try{const ne=R9(J,te,Y.nodes,Y.edges),ye=new Set([...ne.changes.addedNodeIds,...ne.changes.updatedNodeIds]),be=new Set([...ne.changes.addedEdgeKeys,...ne.changes.updatedEdgeKeys]),ze=ye.size>0?ne.nodes.map(Fe=>ye.has(Fe.id)?{...Fe,className:a1(Fe.className,i1)}:Fe):ne.nodes,de=be.size>0?ne.edges.map(Fe=>be.has(Xf(Fe))?{...Fe,className:a1(Fe.className,o1)}:Fe):ne.edges;kt(ze),Xt(de),uo.current!=null&&(clearTimeout(uo.current),uo.current=null),(ye.size>0||be.size>0)&&(uo.current=window.setTimeout(()=>{uo.current=null,ye.size>0&&kt(Fe=>Fe.map(Ne=>{if(!ye.has(Ne.id))return Ne;const xt=l1(Ne.className,i1);return xt===String(Ne.className||"")?Ne:{...Ne,className:xt}})),be.size>0&&Xt(Fe=>Fe.map(Ne=>{if(!be.has(Xf(Ne)))return Ne;const xt=l1(Ne.className,o1);return xt===String(Ne.className||"")?Ne:{...Ne,className:xt}}))},l7))}catch{kt(Y.nodes),Xt(Y.edges)}}else if(kt(Y.nodes),Xt(Y.edges),Ic.current=Y.viewport||null,Y.viewport){const J=()=>{var te;try{(te=Mi.current)==null||te.setViewport(Y.viewport,{duration:0})}catch{}};requestAnimationFrame(()=>requestAnimationFrame(J))}else y(J=>J+1);vh(w.id,Y.flowSource),Rp(J=>J+1),xd(Y.nodes,Y.edges,{instances:Y.instances});try{Ml.current=Bj(Y.nodes,Y.edges,Y.instances,{description:Y.flowDescriptionText,viewport:Ic.current})}catch{Ml.current=""}Pa.current=!0}catch(Y){v(String(Y.message||Y))}},[Tt,xd,kt,Xt]),We=h.useCallback(async()=>{if(!(u!=null&&u.id))return;const w=u.source??"user",j=new URLSearchParams({flowId:u.id,flowSource:w});u.archived&&j.set("archived","1"),j.set("lang",String(t.language||"zh").startsWith("zh")?"zh":"en");const B=await fetch("/api/nodes?"+j.toString()),q=await B.json();if(!B.ok)throw new Error((q==null?void 0:q.error)||e("flow:nodePropsError.loadNodesFailed"));const Y=Array.isArray(q)?q:Array.isArray(q==null?void 0:q.nodes)?q.nodes:[];ae(Y)},[u,e,t.language]),Ct=h.useCallback(async()=>{ar(!0),gn("");try{const w=await fetch("/api/marketplace/nodes"),j=await w.json().catch(()=>({}));if(!w.ok)throw new Error((j==null?void 0:j.error)||"Failed to load marketplace nodes");mn(Array.isArray(j==null?void 0:j.nodes)?j.nodes:[])}catch(w){gn(String(w.message||w)),mn([])}finally{ar(!1)}},[]),Pr=h.useCallback(async()=>{He(!0),sn("");try{const w=await fetch("/api/marketplace/flow-snippets"),j=await w.json().catch(()=>({}));if(!w.ok)throw new Error((j==null?void 0:j.error)||"Failed to load flow snippets");qe(Array.isArray(j==null?void 0:j.snippets)?j.snippets:[])}catch(w){sn(String(w.message||w)),qe([])}finally{He(!1)}},[]);h.useEffect(()=>{u&&(Ct(),Pr())},[u==null?void 0:u.id,u==null?void 0:u.source,u==null?void 0:u.archived,Ct,Pr]);const Aa=h.useCallback(async w=>{if(!u||!w)return;const j=w.definitionId||`marketplace:${w.id}${w.version?`@${w.version}`:""}`;if(j){lr(j),gn("");try{const B=await fetch("/api/marketplace/install-node",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source||"user",archived:!!u.archived,nodeSpec:j})}),q=await B.json().catch(()=>({}));if(!B.ok||(q==null?void 0:q.ok)===!1)throw new Error((q==null?void 0:q.error)||"Failed to install marketplace node");await We()}catch(B){gn(String(B.message||B))}finally{lr("")}}},[u,We]),$l=h.useCallback(async(w,j)=>{const B={packageId:(w==null?void 0:w.newId)||(w==null?void 0:w.id)||(w==null?void 0:w.label),label:(w==null?void 0:w.label)||(w==null?void 0:w.newId)||(w==null?void 0:w.id),version:"1.0.0",definitionId:j,body:(w==null?void 0:w.body)||"",script:(w==null?void 0:w.script)||"",inputs:Array.isArray(w==null?void 0:w.inputs)?w.inputs:[],outputs:Array.isArray(w==null?void 0:w.outputs)?w.outputs:[],flowId:u==null?void 0:u.id,flowSource:(u==null?void 0:u.source)||"user"},q=await fetch("/api/marketplace/publish-node-from-instance",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(B)}),Y=await q.json();if(!q.ok||(Y==null?void 0:Y.ok)===!1)throw new Error((Y==null?void 0:Y.error)||"Publish failed");return await We(),Y},[We,u]),Se=h.useCallback(async()=>{var q;if(!u||ge.current)return;const w=u.id,j=u.source??"user",B=((q=Ea.current)==null?void 0:q.id)??null;ge.current=!0,me(!0);try{await $t({id:w,source:j,archived:u.archived},{preserveComposer:!0,incrementalSync:!0}),B&&kt(Y=>Y.map(J=>({...J,selected:J.id===B})))}finally{ge.current=!1,me(!1)}},[u,u==null?void 0:u.archived,$t,kt]);h.useEffect(()=>{if(xi.current||l.length===0)return;const w=new URLSearchParams(window.location.search),j=w.get("flowId");if(!j)return;const B=w.get("flowSource")??"user",q=w.get("flowArchived")==="1",Y=l.find(J=>J.id===j&&(J.source??"user")===B&&!!J.archived===q);Y&&(xi.current=!0,$t(Y))},[l,$t]);const lt=h.useRef(0);h.useEffect(()=>{if(!u)return;const w=u.id,j=u.source??"user",B=!!u.archived;lt.current=0;let q=!1;const Y=async()=>{var ne;if(q)return;const te=new URLSearchParams({flowId:w,flowSource:j,v:String(lt.current)});B&&te.set("archived","1");try{const ye=await fetch("/api/flow-editor-sync-poll?"+te.toString());if(!ye.ok||q)return;const be=await ye.json();if(q)return;if(be.changed){lt.current=be.version;const ze=((ne=Ea.current)==null?void 0:ne.id)??null;await $t({id:w,source:j,archived:B},{preserveComposer:!0,incrementalSync:!0}),await le({id:w,source:j,archived:B},{quiet:!0,force:!0}),ze&&kt(de=>de.map(Fe=>({...Fe,selected:Fe.id===ze})))}else lt.current=be.version}catch{}},J=window.setInterval(Y,2e3);return Y(),()=>{q=!0,window.clearInterval(J)}},[u==null?void 0:u.id,u==null?void 0:u.source,u==null?void 0:u.archived,$t,le,kt]);const ft=h.useMemo(()=>x?x.startsWith(e("flow:status.saveFailed"))?" af-palette-tip--error":x===e("flow:status.saved")?" af-palette-tip--success":" af-palette-tip--info":"",[x]);h.useEffect(()=>{if(!x)return;x===e("flow:status.saved")||x.startsWith(e("flow:status.runInTerminal"));const w=x.startsWith(e("flow:status.runInTerminal"))?5200:2800,j=window.setTimeout(()=>N(""),w);return()=>clearTimeout(j)},[x,e]),h.useEffect(()=>{C("")},[u==null?void 0:u.id,u==null?void 0:u.source]),h.useEffect(()=>{const w=()=>{window.__provideEditContent&&(Na(window.__provideEditContent),window.__provideEditContent=null)};return window.addEventListener("provide-expand",w),()=>window.removeEventListener("provide-expand",w)},[]),h.useEffect(()=>{var ne,ye,be,ze,de,Fe,Ne;if(!ce){ud(null);return}const w=nr.current[ce.id]||{},{inputs:j,outputs:B}=$T(ce),q=String(((ne=ce.data)==null?void 0:ne.definitionId)??ce.id??""),Y=((ye=ce.data)==null?void 0:ye.script)!=null?String(ce.data.script):void 0,J=w.script!=null?String(w.script):void 0,te=q==="tool_nodejs"||Y&&Y.trim()!==""||J&&J.trim()!==""?String(Y??J??""):"";ud({id:ce.id,newId:ce.id,label:String(((be=ce.data)==null?void 0:be.label)??ce.id),role:((ze=ce.data)==null?void 0:ze.role)??"普通",model:String(((de=ce.data)==null?void 0:de.model)??w.model??""),body:String(((Fe=ce.data)==null?void 0:Fe.body)??w.body??""),images:Ts(((Ne=ce.data)==null?void 0:Ne.images)??w.images),script:te,inputs:j,outputs:B})},[ce==null?void 0:ce.id,Tp]),h.useEffect(()=>{u&&(ce||(cd.current=null,zt(w=>w==="node"?null:w)))},[u,ce==null?void 0:ce.id]);const pt=h.useCallback(()=>{cd.current=null,zt(w=>w==="settings"||w==="history"?w:"node")},[]),Re=h.useCallback((w,j)=>{w.metaKey||w.ctrlKey||w.shiftKey||Ie!=="edit"&&Yr((j==null?void 0:j.id)??null)},[Ie]),It=h.useCallback((w,j)=>{Ie==="edit"&&(w.preventDefault(),kt(B=>B.map(q=>({...q,selected:q.id===j.id}))),Xt(B=>B.map(q=>({...q,selected:!1}))),pt())},[pt,Ie,Xt,kt]),tn=h.useCallback((w,j)=>{if(Ie!=="edit")return;const B=w.metaKey||w.ctrlKey||w.shiftKey;Xt(q=>q.map(Y=>Y.id===j.id?{...Y,selected:!Y.selected||!B}:B?Y:{...Y,selected:!1})),B||kt(q=>q.map(Y=>({...Y,selected:!1})))},[Ie,Xt,kt]),Jt=h.useCallback(w=>p1(w,Ys.current),[]),$n=h.useCallback(w=>{if(!p1(w,Ys.current)){N("端口类型不匹配,已取消连线");return}Oi(null),kt(j=>pg(j,w)),Xt(j=>{const B=j.filter(q=>!(q.target===w.target&&q.targetHandle===w.targetHandle));return qf({...w,markerEnd:{type:$s.ArrowClosed}},B)})},[Xt,kt]),Vn=h.useCallback((w,j)=>{Tc.current=g7(j,Ys.current),Oi(null)},[]),Dt=h.useCallback((w,j)=>{var Ne,xt,Sn,Nn;const B=Tc.current;if(Tc.current=null,!u||!B||j!=null&&j.toNode)return;const q=x7(Z,B);if(q.length===0){N(`没有匹配 ${B.slotType} 端口的节点`);return}const Y=((xt=(Ne=w==null?void 0:w.changedTouches)==null?void 0:Ne[0])==null?void 0:xt.clientX)??(w==null?void 0:w.clientX),J=((Nn=(Sn=w==null?void 0:w.changedTouches)==null?void 0:Sn[0])==null?void 0:Nn.clientY)??(w==null?void 0:w.clientY);if(!Number.isFinite(Y)||!Number.isFinite(J))return;const te=Mi.current,ne=document.querySelector(".af-pipeline-flow .react-flow");if(!te||!ne)return;const ye=ne.getBoundingClientRect(),be=320,ze=Math.min(440,104+q.length*58),de=Math.max(12,Math.min(Y-ye.left,ye.width-be-12)),Fe=Math.max(12,Math.min(J-ye.top,ye.height-ze-12));Oi({left:de,top:Fe,flowPosition:te.screenToFlowPosition({x:Y,y:J}),draft:B,candidates:q,query:""})},[Z,u]),nn=h.useCallback(w=>{for(const j of w)delete nr.current[j.id]},[]),Zr=h.useCallback(w=>{Mi.current=w},[]),Ns=h.useCallback(w=>{kt(B=>B.map(q=>({...q,selected:q.id===w}))),Xt(B=>B.map(q=>({...q,selected:!1}))),pt();const j=()=>{var ye,be,ze;const B=Mi.current;if(!(B!=null&&B.getNode))return;const q=B.getNode(w);if(!q)return;const Y=(ye=B.getInternalNode)==null?void 0:ye.call(B,w),J=((be=Y==null?void 0:Y.measured)==null?void 0:be.width)??(Y==null?void 0:Y.width)??q.width??200,te=((ze=Y==null?void 0:Y.measured)==null?void 0:ze.height)??(Y==null?void 0:Y.height)??q.height??88,{zoom:ne}=B.getViewport();B.setCenter(q.position.x+J/2,q.position.y+te/2,{zoom:y1(ne),duration:220})};requestAnimationFrame(()=>requestAnimationFrame(j))},[kt,Xt,pt]),Gs=h.useCallback(w=>{kt(B=>B.map(q=>({...q,selected:q.id===w}))),Xt(B=>B.map(q=>({...q,selected:!1})));const j=()=>{var be,ze,de;const B=Mi.current;if(!(B!=null&&B.getNode))return;const q=B.getNode(w);if(!q)return;const Y=(be=B.getInternalNode)==null?void 0:be.call(B,w),J=((ze=Y==null?void 0:Y.measured)==null?void 0:ze.width)??(Y==null?void 0:Y.width)??q.width??200,te=((de=Y==null?void 0:Y.measured)==null?void 0:de.height)??(Y==null?void 0:Y.height)??q.height??88,{zoom:ne}=B.getViewport(),ye=y1(ne);B.setCenter(q.position.x+J/2,q.position.y+te/2,{zoom:ye,duration:260})};requestAnimationFrame(()=>requestAnimationFrame(j))},[kt,Xt]),Mr=h.useCallback((w,j)=>{const B=`node-${Date.now()}`;return s2(w,B,j,nr.current,Z)},[Z]),Dl=h.useCallback(w=>{if(!u||!w)return;let j={x:180,y:160};const B=Mi.current,q=document.querySelector(".af-pipeline-flow .react-flow");if(B&&q){const Y=q.getBoundingClientRect();j=B.screenToFlowPosition({x:Y.left+Y.width*.45,y:Y.top+Y.height*.38})}kt(Y=>[...Y,Mr(w,j)])},[u,kt,Mr]),Ia=h.useCallback(w=>{const j=Yp.current;if(!u||!j||!(w!=null&&w.def))return;const B=Mr(w.def,j.flowPosition),q=j.draft.handleType==="source"?{source:j.draft.nodeId,sourceHandle:j.draft.handleId,target:B.id,targetHandle:`input-${w.slotIndex}`}:{source:B.id,sourceHandle:`output-${w.slotIndex}`,target:j.draft.nodeId,targetHandle:j.draft.handleId};kt(Y=>pg([...Y,B],q)),Xt(Y=>{const J=Y.filter(te=>!(te.target===q.target&&te.targetHandle===q.targetHandle));return qf({...q,markerEnd:{type:$s.ArrowClosed}},J)}),Oi(null)},[u,Mr,kt,Xt]),Ta=h.useCallback(w=>{w.preventDefault(),w.dataTransfer.dropEffect="move"},[]),bd=h.useCallback(w=>{var te;if(w.preventDefault(),!u)return;const j=Mi.current;if(!j)return;const B=j.screenToFlowPosition({x:w.clientX,y:w.clientY}),q=w.dataTransfer.getData("application/agentflow-snippet");if(q){const ne=et.find(ye=>`${ye.id}@${ye.version}`===q);ne&&((te=Ol.current)==null||te.call(Ol,ne,B));return}const Y=w.dataTransfer.getData("application/agentflow-node");if(!Y)return;const J=Z.find(ne=>ne.id===Y);J&&kt(ne=>[...ne,Mr(J,B)])},[u,Z,et,kt,Mr]),wi=h.useCallback(async(w,j)=>{if(!u)return;const B=Bj(w,j,nr.current,{description:b,viewport:Ic.current});if(B!==Ml.current){N(e("flow:status.saving"));try{const q=O7(u.source),Y=await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:q,flowYaml:B,...u.archived?{flowArchived:!0}:{}})}),J=await Y.json();if(!Y.ok||!J.success)throw new Error(J.error||e("flow:status.saveFailed"));if(Ml.current=B,N(e("flow:status.saved")),bi(u.source)&&q==="workspace"){const te={id:u.id,source:"workspace",path:void 0};p(te),v1(te),vh(u.id,"workspace")}}catch(q){N(e("flow:status.saveFailed")+": "+(q.message||q))}}},[u,b]);h.useEffect(()=>{if(!u||!Pa.current||Ie!=="edit"||u.archived)return;const w=gd.current,j=setTimeout(()=>{w===gd.current&&Pa.current&&wi(Ys.current,Yo.current)},400);return()=>clearTimeout(j)},[Et,vn,b,Ie,u,wi]);const Xp=h.useCallback(async w=>{if(!u||u.archived)return;const j=u.source??"user";if(!(j!=="user"&&j!=="workspace")&&j!==w){H(!0),C("");try{const B=await fetch("/api/flow/move",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,fromSource:j,toSource:w})}),q=await B.json().catch(()=>({}));if(!B.ok)throw new Error(typeof q.error=="string"?q.error:e("flow:composer.requestFailed"));const Y=q.flowSource==="workspace"||q.flowSource==="user"?q.flowSource:w;let J={id:u.id,source:Y,archived:u.archived};try{const te=await fetch("/api/flows");if(te.ok){const ne=await te.json(),ye=Array.isArray(ne)?ne.find(be=>be.id===u.id&&(be.source??"user")===Y&&!!be.archived==!!u.archived):null;ye&&(J=ye)}}catch{}await $t(J,{preserveComposer:!0}),vh(u.id,Y)}catch(B){C(String(B.message||B))}finally{H(!1)}}},[u,$t]),ky=h.useCallback(async()=>{if(u){va(!0),_r(""),vl("");try{const w=await fetch("/api/flow/schedule",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source||"user",archived:!!u.archived,schedule:ur})}),j=await w.json().catch(()=>({}));if(!w.ok||!j.success)throw new Error(j.error||"Failed to save schedule");ba({...Fd,...j.schedule||{}}),vl(e("flow:schedule.saved")),await le(u,{quiet:!0,force:!0})}catch(w){_r(String(w.message||w))}finally{va(!1)}}},[u,ur,le,e]),pR=h.useCallback(async()=>{u&&(await wi(Ys.current,Yo.current),!u.archived&&u.source!=="builtin"&&await ky())},[u,wi,ky]),Jp=h.useCallback(async()=>{if(!u||!M.trim())return;const w=M.trim();if(w===u.id){O("");return}$(!0),O("");try{const j=await fetch("/api/flow/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source??"user",newFlowId:w})}),B=await j.json().catch(()=>({}));if(!j.ok)throw new Error(typeof B.error=="string"?B.error:e("flow:composer.requestFailed"));let q={id:B.flowId,source:B.flowSource??u.source,archived:u.archived};try{const Y=await fetch("/api/flows");if(Y.ok){const J=await Y.json(),te=Array.isArray(J)?J.find(ne=>ne.id===B.flowId&&(ne.source??"user")===(B.flowSource??u.source)):null;te&&(q=te)}}catch{}await $t(q,{preserveComposer:!0}),vh(B.flowId,B.flowSource??u.source)}catch(j){O(String(j.message||j))}finally{$(!1)}},[u,M,$t]),Q0=h.useCallback(w=>{navigator.clipboard.writeText(w).then(()=>{I(!0),setTimeout(()=>I(!1),2e3)}).catch(()=>{})},[]),Sy=h.useCallback(()=>{wi(Et,vn)},[wi,Et,vn]),Z0=h.useCallback(()=>{var j,B;if(!u)return;const w=x1((B=(j=Mi.current)==null?void 0:j.getViewport)==null?void 0:B.call(j));w&&(Ic.current=w,N("已固定 Pipeline 进入视角"),wi(Ys.current,Yo.current))},[wi,u]),hR=h.useCallback((w,j)=>{const B=j.trim()===""||j==="default"?void 0:j.trim(),q=Et.map(Y=>Y.id===w?{...Y,data:{...Y.data,model:B}}:Y);kt(q),wi(q,vn)},[Et,vn,kt,wi]),Qp=h.useCallback(()=>{var xt,Sn;if(!gt||!u||!ce)return!1;const w=ce.id,j=gt.newId.trim();if(Cl(""),!XT.test(j))return Cl(e("flow:nodePropsError.invalidInstanceId")),!1;if(Et.some(Nn=>Nn.id===j&&Nn.id!==w))return Cl(e("flow:nodePropsError.duplicateInstanceId")),!1;const B=gt.role.trim(),q=dl.includes(B)?B:"普通",Y=gt.model.trim(),J=Nn=>(Array.isArray(Nn)?Nn:[]).map(Wt=>({type:String((Wt==null?void 0:Wt.type)??"节点").trim()||"节点",name:String((Wt==null?void 0:Wt.name)??""),default:String((Wt==null?void 0:Wt.default)??""),required:!!(Wt!=null&&Wt.required),showOnNode:(Wt==null?void 0:Wt.showOnNode)!=null?Wt.showOnNode!==!1:!!(Wt!=null&&Wt.required)||String((Wt==null?void 0:Wt.type)??"节点").trim().toLowerCase()==="node"})),te=J(gt.inputs),ne=J(gt.outputs),ye=String(((xt=ce.data)==null?void 0:xt.definitionId)??j),be=ye.startsWith("provide_"),ze={...ce.data,label:gt.label.trim()||j,displayLabel:gt.label.trim()||j,role:q,model:Y===""||Y==="default"?void 0:Y,body:be?"":gt.body,images:be?[]:Ts(gt.images),inputs:te,outputs:be&&Array.isArray((Sn=ce.data)==null?void 0:Sn.outputs)?ce.data.outputs:ne},de=String(gt.script??"").trim();ye==="tool_nodejs"||de!==""?ze.script=String(gt.script??""):delete ze.script;let Fe,Ne=vn;if(j!==w){const Nn={...nr.current},Wt={...Nn[w]||{}};delete Nn[w],Nn[j]=Wt,nr.current=Nn,Fe=Et.map(St=>St.id!==w?St:{...St,id:j,selected:!0,data:ze}),Ne=vn.map((St,Qt)=>({...St,source:St.source===w?j:St.source,target:St.target===w?j:St.target,id:`e-${St.source===w?j:St.source}-${St.target===w?j:St.target}-${Qt}`}))}else Fe=Et.map(Nn=>Nn.id===w?{...Nn,data:ze}:Nn);return kt(Fe),Xt(Ne),as(j),wi(Fe,Ne),!0},[gt,u,ce,Et,vn,kt,Xt,as,wi]),Ny=h.useCallback(()=>{var Sn,Nn;if(!gt||!u||!ce)return!1;const w=ce.id,j=gt.role.trim(),B=dl.includes(j)?j:"普通",q=gt.model.trim(),Y=Wt=>(Array.isArray(Wt)?Wt:[]).map(St=>({type:String((St==null?void 0:St.type)??"节点").trim()||"节点",name:String((St==null?void 0:St.name)??""),default:String((St==null?void 0:St.default)??""),required:!!(St!=null&&St.required),showOnNode:(St==null?void 0:St.showOnNode)!=null?St.showOnNode!==!1:!!(St!=null&&St.required)||String((St==null?void 0:St.type)??"节点").trim().toLowerCase()==="node"})),J=Y(gt.inputs),te=Y(gt.outputs),ne=String(((Sn=ce.data)==null?void 0:Sn.definitionId)??w),ye=ne.startsWith("provide_"),be=gt.label.trim()||w,ze=q===""||q==="default"?void 0:q,de={...ce.data,label:be,displayLabel:be,role:B,model:ze,body:ye?"":gt.body,images:ye?[]:Ts(gt.images),inputs:J,outputs:ye&&Array.isArray((Nn=ce.data)==null?void 0:Nn.outputs)?ce.data.outputs:te},Fe=String(gt.script??"").trim();ne==="tool_nodejs"||Fe!==""?de.script=String(gt.script??""):delete de.script;const Ne=ce.data||{};return(Ne.label!==de.label||Ne.role!==de.role||Ne.model!==de.model||Ne.body!==de.body||JSON.stringify(Ts(Ne.images))!==JSON.stringify(de.images)||(Ne.script??void 0)!==(de.script??void 0)||JSON.stringify(Ne.inputs||[])!==JSON.stringify(J)||JSON.stringify(Ne.outputs||[])!==JSON.stringify(te))&&(kt(Wt=>Wt.map(St=>St.id===w?{...St,data:de}:St)),as(w)),!0},[gt,u,ce,kt,as]),ek=h.useRef(Ny);h.useEffect(()=>{ek.current=Ny},[Ny]),h.useEffect(()=>{if(!gt||!u||!Pa.current||Ie!=="edit")return;const w=setTimeout(()=>{ek.current()},400);return()=>clearTimeout(w)},[gt,u,Ie]);const mR=h.useCallback(()=>{if(!(!gt||!ce)){if(gt.newId.trim()===ce.id){Cl("");return}Qp()}},[gt,ce,Qp]);h.useEffect(()=>{const w=j=>{var te,ne,ye;if(Ie!=="edit")return;const B=BT(j.target);if((j.metaKey||j.ctrlKey)&&j.key.toLowerCase()==="s"){if(nt==="node"&&ce&>){j.preventDefault(),j.stopPropagation(),Qp()||Sy();return}if(B)return;j.preventDefault(),j.stopPropagation(),Sy();return}if((j.metaKey||j.ctrlKey)&&j.key.toLowerCase()==="k"){j.preventDefault(),j.stopPropagation(),Ip(be=>!be);return}if(On)return;if(Bn){if(j.key==="Escape"){j.preventDefault(),io(!1);return}if(mg(j)&&!j.metaKey&&!j.ctrlKey&&!j.altKey){j.preventDefault(),io(!1);return}(j.key==="v"||j.key==="V"||j.key==="h"||j.key==="H")&&!j.metaKey&&!j.ctrlKey&&!j.altKey&&j.preventDefault();return}if(B)return;const q=j.key.toLowerCase(),Y=(j.metaKey||j.ctrlKey)&&!j.shiftKey&&q==="z",J=(j.metaKey||j.ctrlKey)&&(j.shiftKey&&q==="z"||q==="y");if(Y||J){j.preventDefault(),j.stopPropagation();const be=Y?wd():S();N(be?Y?"Undo canvas change":"Redo canvas change":Y?"Nothing to undo":"Nothing to redo");return}if((j.metaKey||j.ctrlKey)&&j.key.toLowerCase()==="c"){const be=RT(Ys.current,Yo.current,nr.current);be&&(j.preventDefault(),j.stopPropagation(),yd.current=be,N(`Copied ${be.nodes.length} node${be.nodes.length>1?"s":""}`));return}if((j.metaKey||j.ctrlKey)&&j.key.toLowerCase()==="v"){const be=LT(yd.current,Ys.current,Yo.current,nr.current);be&&(j.preventDefault(),j.stopPropagation(),nr.current=be.instances,kt(be.nodes),Xt(be.edges),N(`Pasted ${be.pastedNodeIds.length} node${be.pastedNodeIds.length>1?"s":""}`));return}if((j.key==="a"||j.key==="A")&&!j.metaKey&&!j.ctrlKey&&!j.altKey){j.preventDefault(),j.stopPropagation(),(te=Ve.current)==null||te.focus(),(ye=(ne=Ve.current)==null?void 0:ne.select)==null||ye.call(ne);return}if((j.metaKey||j.ctrlKey)&&j.key.toLowerCase()==="a"){j.preventDefault(),j.stopPropagation(),kt(be=>be.map(ze=>({...ze,selected:!0}))),Xt(be=>be.map(ze=>({...ze,selected:!1})));return}if(mg(j)&&!j.metaKey&&!j.ctrlKey&&!j.altKey){j.preventDefault(),io(be=>!be);return}if((j.key==="v"||j.key==="V")&&!j.metaKey&&!j.ctrlKey&&!j.altKey){j.preventDefault(),ad("select");return}if((j.key==="h"||j.key==="H")&&!j.metaKey&&!j.ctrlKey&&!j.altKey){j.preventDefault(),ad("pan");return}if((j.key==="f"||j.key==="F")&&!j.metaKey&&!j.ctrlKey&&!j.altKey){j.preventDefault(),Z0();return}};return window.addEventListener("keydown",w,!0),()=>window.removeEventListener("keydown",w,!0)},[Sy,Z0,Bn,On,nt,ce,gt,Qp,Ie,wd,S]),h.useEffect(()=>{if(Ie!=="running"||ut==null)return;let w=Math.floor((Date.now()-ut)/1e3);const j=setInterval(()=>{const B=Date.now()-ut,q=Math.floor(B/1e3);q!==w&&(w=q,Er(B))},500);return()=>clearInterval(j)},[Ie,ut]),h.useEffect(()=>{const w=Do.current;!w||!w.parentElement||rd.current&&(Fo.current=!0,w.scrollIntoView({behavior:"auto",block:"end"}),requestAnimationFrame(()=>{Fo.current=!1}))},[mr]),h.useEffect(()=>{const w=Do.current;if(!w)return;const j=w.parentElement;if(!j)return;const B=()=>{if(Fo.current)return;const q=j.scrollHeight-j.scrollTop-j.clientHeight;rd.current=q<40};return j.addEventListener("scroll",B,{passive:!0}),()=>j.removeEventListener("scroll",B)},[tt,Ie]),h.useEffect(()=>{if(Ie==="edit"||!tt)return;rd.current=!0;const w=Do.current;w&&(Fo.current=!0,w.scrollIntoView({behavior:"auto",block:"end"}),requestAnimationFrame(()=>{Fo.current=!1}))},[Ie,tt]),h.useEffect(()=>{mr.length>gm+w1&&ht(w=>w.length>gm+w1?w.slice(-gm):w)},[mr]);const gR=h.useCallback(w=>{if(w.button!==0)return;w.preventDefault();const j=w.currentTarget;Ii.current={active:!0,pointerId:w.pointerId,startY:w.clientY,startH:vr},j.setPointerCapture(w.pointerId)},[vr]),yR=h.useCallback(w=>{const j=Ii.current;if(!j.active||w.pointerId!==j.pointerId)return;const B=j.startY-w.clientY;$o(ym(j.startH+B))},[]),Zp=h.useCallback(()=>{$o(w=>{const j=ym(w);try{localStorage.setItem(o2,String(j))}catch{}return j})},[]),tk=h.useCallback(w=>{const j=Ii.current;if(!(!j.active||w.pointerId!==j.pointerId)){j.active=!1;try{w.currentTarget.releasePointerCapture(w.pointerId)}catch{}Zp()}},[Zp]),xR=h.useCallback(()=>{const w=Ii.current;w.active&&(w.active=!1,Zp())},[Zp]);h.useEffect(()=>{function w(){$o(j=>ym(j))}return window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[]);const fo=h.useCallback(async(w={})=>{if(!u)return;const j=w.runUuid!=null&&String(w.runUuid).trim()?String(w.runUuid).trim():null,B=w.cliInputsOverride??K.current,q=!!w.prepareOnly;if(cn(q?"ready":"running"),ht(q?[]:[{ts:new Date().toISOString(),type:"info",text:j?e("flow:run.connectingApiResume",{uuid:j}):e("flow:run.connectingApi")}]),Gn(new Set),Cr({}),gr(!q),zt(null),j||er(null),q)return;if(!j){const J=Date.now();Ut(J),Er(0)}const Y=new AbortController;ci.current=Y;try{const J=await fetch("/api/flow/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source||"user",...j?{uuid:j}:{},cliInputs:B}),signal:Y.signal});if(!J.ok){const de=await J.json().catch(()=>({error:e("flow:composer.requestFailed")}));ht(Fe=>[...Fe,{ts:new Date().toISOString(),type:"error",text:de.error||e("flow:composer.requestFailed")}]),cn("error");return}if(ht(de=>[...de,{ts:new Date().toISOString(),type:"info",text:e("flow:run.connectedReceiving")}]),!J.body){ht(de=>[...de,{ts:new Date().toISOString(),type:"error",text:e("flow:run.noBody")}]),cn("error");return}const te=J.body.getReader(),ne=new TextDecoder;let ye="";const be=de=>{const Fe=de.ts||new Date().toISOString();if(de.type==="event")if(de.event==="node-start")Gn(Ne=>new Set(Ne).add(de.instanceId)),Cr(Ne=>({...Ne,[de.instanceId]:{status:"running",startMs:Date.now()}})),ht(Ne=>[...Ne,{ts:Fe,type:"node-start",text:de.label?e("flow:run.nodeStartWithLabel",{instanceId:de.instanceId,label:de.label}):e("flow:run.nodeStart",{instanceId:de.instanceId})}]);else if(de.event==="node-done"){Gn(xt=>{const Sn=new Set(xt);return Sn.delete(de.instanceId),Sn});const Ne=de.elapsed??null;Cr(xt=>({...xt,[de.instanceId]:{status:"success",elapsed:Ne}})),ht(xt=>[...xt,{ts:Fe,type:"node-done",text:Ne?e("flow:run.nodeDoneWithElapsed",{instanceId:de.instanceId,elapsed:Ne}):e("flow:run.nodeDone",{instanceId:de.instanceId})}])}else if(de.event==="node-failed")Gn(Ne=>{const xt=new Set(Ne);return xt.delete(de.instanceId),xt}),Cr(Ne=>({...Ne,[de.instanceId]:{status:"failed",elapsed:de.elapsed??null}})),ht(Ne=>[...Ne,{ts:Fe,type:"node-failed",text:e("flow:run.nodeFailed",{instanceId:de.instanceId})}]);else if(de.event==="apply-start"){if(de.uuid&&er(String(de.uuid)),typeof de.runStartTime=="number"&&de.runStartTime>0)Ut(de.runStartTime),Er(Math.max(0,Date.now()-de.runStartTime));else if(typeof de.totalExecutedMs=="number"&&de.totalExecutedMs>0){const Ne=Date.now()-de.totalExecutedMs;Ut(Ne),Er(de.totalExecutedMs)}ht(Ne=>[...Ne,{ts:Fe,type:"info",text:e("flow:run.pipelineStart",{uuid:de.uuid||"?"})}])}else de.event==="apply-done"?ht(Ne=>[...Ne,{ts:Fe,type:"info",text:de.totalElapsed?e("flow:run.pipelineDoneWithElapsed",{elapsed:de.totalElapsed}):e("flow:run.pipelineDone")}]):de.event==="apply-paused"?ht(Ne=>[...Ne,{ts:Fe,type:"warn",text:e("flow:run.pipelinePaused",{nodes:(de.pendingNodes||[]).join(", ")})}]):ht(Ne=>[...Ne,{ts:Fe,type:"event",text:`[${de.event}] ${JSON.stringify(de)}`}]);else de.type==="user-check-content"?(Sl({instanceId:de.instanceId,execId:de.execId??1,inputPath:de.inputPath,outputPath:de.outputPath,content:de.content||""}),Ri(de.content||""),zo(!1),Ho(""),jl(!1),ht(Ne=>[...Ne,{ts:Fe,type:"user-check",text:e("flow:run.userCheckContent",{instanceId:de.instanceId})}])):de.type==="user-ask-prompt"?(Lr({instanceId:de.instanceId,execId:de.execId??1,question:de.question||"",options:Array.isArray(de.options)?de.options:[]}),fi(!1),ht(Ne=>[...Ne,{ts:Fe,type:"user-ask",text:e("flow:run.userAskPrompt",{instanceId:de.instanceId,defaultValue:`等待用户选择 (${de.instanceId})`})}])):de.type==="tool-print-content"?(Bo({instanceId:de.instanceId,execId:de.execId??1,content:de.content||"",createdAt:Date.now()}),od(!1)):de.type==="log"?ht(Ne=>[...Ne,{ts:Fe,type:"log",text:de.text!=null?String(de.text):""}]):de.type==="error"?ht(Ne=>[...Ne,{ts:Fe,type:"error",text:de.message||e("flow:run.unknownError")}]):de.type==="done"?ht(Ne=>[...Ne,{ts:Fe,type:"done",text:e("flow:run.executionEnd",{exitCode:de.exitCode??"?"})}]):ht(Ne=>[...Ne,{ts:Fe,type:"log",text:JSON.stringify(de)}])},ze=de=>{if(de.trim())try{be(JSON.parse(de))}catch{ht(Fe=>[...Fe,{ts:new Date().toISOString(),type:"log",text:de}])}};for(;;){const{done:de,value:Fe}=await te.read();ye+=ne.decode(Fe??new Uint8Array,{stream:!de});const Ne=ye.split(`
|
|
133
|
+
`);ye=Ne.pop()??"";for(const xt of Ne)ze(xt);if(de)break}ye.trim()&&ze(ye),cn("done")}catch(J){J.name==="AbortError"?(ht(te=>[...te,{ts:new Date().toISOString(),type:"warn",text:e("flow:run.executionStopped")}]),cn("stopped")):(ht(te=>[...te,{ts:new Date().toISOString(),type:"error",text:J.message||e("flow:run.unknownError")}]),cn("error"))}finally{ci.current=null,Gn(new Set)}},[u]),[wR,jy]=h.useState(!1),bR=h.useCallback(()=>{jy(!0)},[]),vR=h.useCallback(async()=>{if(jy(!1),ci.current&&(ci.current.abort(),ci.current=null),u)try{await fetch("/api/flow/run/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source||"user"})})}catch{}cn("stopped"),Gn(new Set)},[u]),Fl=h.useCallback(()=>{cn("edit"),Gn(new Set),Cr({}),Yr(null),er(null)},[]),[kR,eh]=h.useState(!1),SR=h.useCallback(async()=>{if(eh(!1),ci.current&&(ci.current.abort(),ci.current=null),u)try{await fetch("/api/flow/run/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source||"user"})})}catch{}Fl()},[u,Fl]),NR=h.useCallback(()=>{eh(!1),n("/projects")},[n]),jR=h.useCallback(w=>{const j=w.runId!=null&&String(w.runId).trim()?String(w.runId).trim():null,B=w.flowId!=null&&String(w.flowId).trim()?String(w.flowId).trim():(u==null?void 0:u.id)!=null?String(u.id):null;er(j);const q=w.status||"unknown";let Y="stopped";q==="success"?Y="done":q==="failed"?Y="error":q==="running"?Y="running":Y="stopped",cn(Y);const J=typeof w.at=="number"?w.at:null;if(Y==="running"&&J!=null?(Ut(J),Er(Math.max(0,Date.now()-J))):J!=null&&typeof w.endedAt=="number"&&w.endedAt>J?(Ut(null),Er(w.endedAt-J)):(Ut(null),Er(Math.max(0,w.durationMs??0))),ht([]),Gn(new Set),Cr({}),Yr(null),zt(null),gr(!1),j&&B){const te=new URLSearchParams({flowId:B,runId:j});fetch(`/api/run-node-statuses?${te}`).then(ne=>ne.json()).then(ne=>{const ye=ne.statuses&&typeof ne.statuses=="object"?ne.statuses:{},be={};for(const[ze,de]of Object.entries(ye))de&&typeof de=="object"&&typeof de.status=="string"&&(be[ze]={status:de.status,...de.elapsed!=null&&String(de.elapsed).trim()!==""?{elapsed:String(de.elapsed)}:{}});Cr(be)}).catch(()=>{})}},[u==null?void 0:u.id]);h.useEffect(()=>{if(!(u!=null&&u.id)||Ie!=="edit")return;let w=!1;return(async()=>{try{const j=await fetch("/api/pipeline-recent-runs"),B=await j.json();if(w||!j.ok)return;const Y=(Array.isArray(B.runs)?B.runs:[]).find(ne=>ne.flowId===u.id&&ne.status==="running");if(!Y||w)return;const J=Y.runId||null;er(J),cn("running"),gr(!0),Ut(Y.at||Date.now()),Oe.current=0;const te=[{ts:new Date().toISOString(),type:"info",text:`[resume] 检测到活跃 run ${J},已恢复运行视图`}];if(J){const ne=new URLSearchParams({flowId:u.id,runId:J}),be=await(await fetch(`/api/run-node-statuses?${ne}`)).json();if(w)return;const ze=be.statuses&&typeof be.statuses=="object"?be.statuses:{},de={},Fe=new Set;for(const[Ne,xt]of Object.entries(ze))xt&&typeof xt=="object"&&typeof xt.status=="string"&&(de[Ne]={status:xt.status,...xt.elapsed!=null&&String(xt.elapsed).trim()!==""?{elapsed:String(xt.elapsed)}:{}},xt.status==="running"&&Fe.add(Ne));Cr(de),Gn(Fe);try{const Ne=new URLSearchParams({flowId:u.id,runId:J,sinceBytes:"0",tailBytes:"262144"}),xt=await fetch(`/api/run-log?${Ne}`);if(xt.ok){const Sn=await xt.json();if(!w){Oe.current=Number(Sn.bytes||0);const Nn=b1(typeof Sn.text=="string"?Sn.text:"");ht([...Nn,...te]);return}}}catch{}}ht(te)}catch{}})(),()=>{w=!0}},[u==null?void 0:u.id]),h.useEffect(()=>{if(Ie==="edit"||!(u!=null&&u.id)||!xn)return;let w=!1,j=null;const B=async()=>{try{const q=new URLSearchParams({flowId:u.id,runId:xn}),Y=await fetch(`/api/run-node-statuses?${q}`);if(!Y.ok)return;const J=await Y.json();if(w)return;const te=J.statuses&&typeof J.statuses=="object"?J.statuses:{},ne={},ye=new Set;for(const[be,ze]of Object.entries(te))ze&&typeof ze=="object"&&typeof ze.status=="string"&&(ne[be]={status:ze.status,...ze.elapsed!=null&&String(ze.elapsed).trim()!==""?{elapsed:String(ze.elapsed)}:{}},ze.status==="running"&&ye.add(be));Cr(be=>R7(be,ne)?be:ne),Gn(be=>L7(be,ye)?be:ye);try{const be=new URLSearchParams({flowId:u.id,runId:xn,sinceBytes:String(Oe.current||0),tailBytes:String(P7)}),ze=await fetch(`/api/run-log?${be}`);if(ze.ok){const de=await ze.json();if(w)return;const Fe=Number(de.bytes||0),Ne=typeof de.text=="string"?de.text:"";if(Ne){const xt=b1(Ne);xt.length>0&&ht(Sn=>[...Sn,...xt])}Oe.current=Fe}}catch{}try{const be=await fetch("/api/pipeline-recent-runs");if(!be.ok)return;const ze=await be.json();if(w)return;const Fe=(Array.isArray(ze.runs)?ze.runs:[]).find(Ne=>Ne.flowId===u.id&&Ne.runId===xn);if(Fe&&Fe.status){const Ne=Fe.status;Ne==="running"?cn(xt=>xt==="running"?xt:"running"):Ne==="success"?cn("done"):Ne==="failed"?cn("error"):(Ne==="stopped"||Ne==="interrupted")&&cn("stopped")}}catch{}}catch{}};return B(),j=window.setInterval(B,2500),()=>{w=!0,j&&window.clearInterval(j)}},[Ie,u==null?void 0:u.id,xn]),h.useEffect(()=>{if(nt!=="history"||!u)return;let w=!1;return(async()=>{cr(!0),Ht("");try{const j=await fetch("/api/pipeline-recent-runs"),B=await j.json();if(!j.ok)throw new Error(B.error||"HTTP "+j.status);w||Te(Array.isArray(B.runs)?B.runs:[])}catch(j){w||(Ht(String(j.message||j)),Te([]))}finally{w||cr(!1)}})(),()=>{w=!0}},[nt,u]),h.useEffect(()=>{if(!u){ot({files:[]});return}let w=!1;return(async()=>{Ai(!0);try{const j=new URLSearchParams({flowId:u.id,flowSource:u.source||"user",archived:u.archived?"1":"0"}),B=await fetch(`/api/pipeline-files?${j}`),q=await B.json();if(!B.ok)throw new Error(q.error||"HTTP "+B.status);w||ot({files:Array.isArray(q.files)?q.files:[],path:q.path,error:q.error})}catch(j){w||ot({files:[],error:j.message||String(j)})}finally{w||Ai(!1)}})(),()=>{w=!0}},[u]);const vd=h.useMemo(()=>u?oe.filter(w=>w&&w.flowId===u.id).sort((w,j)=>j.at-w.at):[],[oe,u]),ds=h.useMemo(()=>{let w=0,j=0,B=0,q=0,Y=0;for(const J of vd){const te=J.status||"unknown";te==="success"?w+=1:te==="failed"?j+=1:te==="running"?B+=1:te==="stopped"?q+=1:te==="interrupted"&&(Y+=1)}return{success:w,failed:j,running:B,stopped:q,interrupted:Y}},[vd]),kd=h.useMemo(()=>u?h1(ks,Ss):null,[u,ks,Ss]),$i=h.useMemo(()=>{if(!kd||!u)return[];const w=kd.query.toLowerCase(),j=Y=>w?Y.some(J=>J&&String(J).toLowerCase().includes(w)):!0,B=Et.map(Y=>{var be,ze;const J=Y.id,te=String(((be=Y.data)==null?void 0:be.label)??J),ne=(ze=Y.data)!=null&&ze.definitionId?String(Y.data.definitionId):"",ye=[te!==J?te:"",ne&&ne!==J?ne:""].filter(Boolean);return{id:J,label:te,defId:ne,subs:ye}}).filter(({id:Y,label:J,defId:te})=>j([Y,J,te])).sort((Y,J)=>Y.id.localeCompare(J.id)).slice(0,18).map(({id:Y,label:J,defId:te})=>{const ne=[J!==Y?J:null,te||null].filter(Boolean).join(" · ")||void 0;return{kind:"instance",id:Y,title:Y,subtitle:ne}}),q=Z.filter(Y=>Y&&Y.id&&j([Y.id,Y.label,Y.description])).sort((Y,J)=>Y.id.localeCompare(J.id)).slice(0,22).map(Y=>({kind:"definition",id:Y.id,title:Y.id,subtitle:Y.label&&Y.label!==Y.id?String(Y.label):String(Y.type||"")}));return[...B,...q]},[kd,Et,Z,u]),Sd=h.useMemo(()=>{const w=$i.filter(B=>B.kind==="instance"),j=$i.filter(B=>B.kind==="definition");return{instances:w,definitions:j}},[$i]);h.useEffect(()=>{hi(w=>{const j=Math.max(0,$i.length-1);return Math.min(Math.max(0,w),j)})},[$i]);const nk=h.useMemo(()=>b7(ks),[ks]),Or=h.useMemo(()=>Et.filter(w=>w.selected),[Et]),Cy=h.useMemo(()=>new Set(Or.map(w=>w.id)),[Or]),th=h.useMemo(()=>vn.filter(w=>Cy.has(w.source)&&Cy.has(w.target)),[vn,Cy]),rk=h.useMemo(()=>{const w=xe.trim().toLowerCase();return w?et.filter(j=>[j.id,j.version,j.displayName,j.name,j.description,...Array.isArray(j.tags)?j.tags:[]].filter(Boolean).some(B=>String(B).toLowerCase().includes(w))):et},[et,xe]),sk=h.useCallback((w,j)=>{const B=String(w||"snippet-node").trim().replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")||"snippet-node",q=Date.now().toString(36);let Y=`${B}-${q}`,J=2;for(;j.has(Y);)Y=`${B}-${q}-${J}`,J+=1;return j.add(Y),Y},[]),ik=h.useCallback((w,j)=>{var Qt,fs;if(!u||!w)return;const B=w.snippet&&typeof w.snippet=="object"?w.snippet:{},q=B.instances&&typeof B.instances=="object"?B.instances:{},Y=Object.keys(q);if(Y.length===0)return;const J=new Set(Ys.current.map(Je=>Je.id)),te={};for(const Je of Y)te[Je]=sk(Je,J);const ne=(Qt=B.ui)!=null&&Qt.nodePositions&&typeof B.ui.nodePositions=="object"?B.ui.nodePositions:{},ye=(fs=B.ui)!=null&&fs.nodeSizes&&typeof B.ui.nodeSizes=="object"?B.ui.nodeSizes:{},be=Y.map(Je=>{const jn=ne[Je];return{id:Je,x:typeof(jn==null?void 0:jn.x)=="number"?jn.x:0,y:typeof(jn==null?void 0:jn.y)=="number"?jn.y:0}}),ze=Math.min(...be.map(Je=>Je.x)),de=Math.min(...be.map(Je=>Je.y));let Fe=j||{x:180,y:160};const Ne=Mi.current,xt=document.querySelector(".af-pipeline-flow .react-flow");if(!j&&Ne&&xt){const Je=xt.getBoundingClientRect();Fe=Ne.screenToFlowPosition({x:Je.left+Je.width*.48,y:Je.top+Je.height*.32})}const Sn={};for(const Je of Y)Sn[te[Je]]={...q[Je]||{}};nr.current={...nr.current,...Sn};const Nn=Y.map(Je=>{const jn=q[Je]||{},po=be.find(jd=>jd.id===Je)||{x:0,y:0},Di=ye[Je]&&typeof ye[Je].width=="number"&&typeof ye[Je].height=="number"?{width:ye[Je].width,height:ye[Je].height}:null,Hl={id:te[Je],type:"flowNode",selected:!0,position:{x:Fe.x+(po.x-ze),y:Fe.y+(po.y-de)},...Di?{width:Di.width,height:Di.height}:{},data:{label:jn.label||te[Je],definitionId:jn.definitionId||Je,role:jn.role||"normal",body:jn.body||"",script:jn.script||"",...Di?{displaySize:Di}:{}}};return tp(Hl,nr.current,Z,{},u.id)}),Wt=new Set(Y),St=(Array.isArray(B.edges)?B.edges:[]).filter(Je=>Wt.has(Je==null?void 0:Je.source)&&Wt.has(Je==null?void 0:Je.target)).map((Je,jn)=>({id:`e-${te[Je.source]}-${te[Je.target]}-${Date.now()}-${jn}`,source:te[Je.source],target:te[Je.target],sourceHandle:Je.sourceHandle??void 0,targetHandle:Je.targetHandle??void 0,markerEnd:{type:$s.ArrowClosed}}));kt(Je=>[...Je.map(jn=>({...jn,selected:!1})),...Nn]),Xt(Je=>[...Je.map(jn=>({...jn,selected:!1})),...St]),N(`已添加流程片段:${w.displayName||w.id}`)},[sk,Z,u,Xt,kt]);Ol.current=ik;const CR=h.useCallback(()=>{var B,q;if(Or.length<2){sn("请先在画布上选择至少两个节点。"),je("flows");return}const w=Or[0],j=Or.length===2?`${((B=w.data)==null?void 0:B.label)||w.id} 片段`:`${((q=w.data)==null?void 0:q.label)||w.id} 等 ${Or.length} 个节点`;En({name:j,id:j.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),description:""}),De(""),an(!0),je("flows")},[Or]),ER=h.useCallback(async()=>{var J,te;if(!u||Or.length<2)return;const w=Yt.name.trim();if(!w){De("请填写片段名称。");return}const j=kp(Or,nr.current),B={},q={};for(const ne of Or){B[ne.id]={x:((J=ne.position)==null?void 0:J.x)||0,y:((te=ne.position)==null?void 0:te.y)||0};const ye=$7(ne);ye&&(q[ne.id]=ye)}const Y=th.map(ne=>({source:ne.source,target:ne.target,sourceHandle:ne.sourceHandle??null,targetHandle:ne.targetHandle??null}));ue(!0),De("");try{const ne=await fetch("/api/marketplace/publish-flow-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:Yt.id,name:w,displayName:w,version:"1.0.0",description:Yt.description,snippet:{instances:j,edges:Y,ui:{nodePositions:B,nodeSizes:q}}})}),ye=await ne.json().catch(()=>({}));if(!ne.ok||(ye==null?void 0:ye.ok)===!1)throw new Error((ye==null?void 0:ye.error)||"Publish failed");an(!1),N(`流程片段已发布:${ye.id||w}`),Hs(`流程片段已发布:${ye.id||w}`),await Pr(),je("flows")}catch(ne){De(String(ne.message||ne))}finally{ue(!1)}},[u,Or,th,Yt,Pr,Hs]),nh=h.useMemo(()=>{const w=[],j=new Set;for(const Y of Or)j.add(Y.id),w.push({node:Y,kind:"canvas"});const B=new Map(Et.map(Y=>[Y.id,Y])),q=new Map(Z.map(Y=>[Y.id,Y]));for(const Y of nk){if(j.has(Y))continue;const J=B.get(Y);if(J){j.add(Y),w.push({node:J,kind:"mention"});continue}const te=q.get(Y);te&&(j.add(Y),w.push({definition:te,kind:"definition"}))}return w},[Or,nk,Et,Z]),js=h.useMemo(()=>{const w=Array.isArray(vt==null?void 0:vt.cursor)?vt.cursor:[],j=Array.isArray(vt==null?void 0:vt.opencode)?vt.opencode:[],B=Array.isArray(vt==null?void 0:vt.claudeCode)?vt.claudeCode:[],q=j.map(be=>`opencode:${Zo(be)}`),Y=B.map(be=>`claude-code:${Zo(be)}`),J=new Set([...w,...j,...B].map(Zo).concat(q).concat(Y)),te=(mi||"").trim(),ne=zh(mi,w,j,B),ye=ne&&!J.has(ne)&&!J.has(te)?te:"";return{cursorList:w,opencodeList:j,claudeCodeList:B,currentNotInLists:ye}},[vt,mi]),Ey=h.useMemo(()=>new Set(dr),[dr]),_y=dr.length,rh=h.useMemo(()=>{const w=new Map(gi.map(J=>[J.key,J])),j=new Set,B=new Set,q=_l.map(J=>{const te=cl(J,gi).map(ne=>w.get(ne)).filter(Boolean);for(const ne of te)j.add(ne.key),B.add(String(ne.name||ne.id||ne.key||"").trim());return{...J,skills:te}}).filter(J=>J.skills.length>0),Y=gi.filter(J=>{const te=String(J.name||J.id||J.key||"").trim();return!j.has(J.key)&&!B.has(te)});return{groups:q,ungrouped:Y}},[_l,gi]),Rc=h.useCallback(()=>{const w=Gt.current;if(!w)return;const j=w.getBoundingClientRect(),B=Math.min(400,Math.max(300,window.innerWidth-24)),q=Math.min(Math.max(12,j.right-B),window.innerWidth-B-12),Y=Math.max(140,j.top-22),J=Math.min(360,Y);pd({position:"fixed",left:`${q}px`,top:`${Math.max(12,j.top-J-10)}px`,width:`${B}px`,maxHeight:`${J}px`})},[]);h.useEffect(()=>{const w=Array.isArray(vt==null?void 0:vt.cursor)?vt.cursor:[],j=Array.isArray(vt==null?void 0:vt.opencode)?vt.opencode:[],B=Array.isArray(vt==null?void 0:vt.claudeCode)?vt.claudeCode:[];El(q=>{const Y=zh(q,w,j,B);return Y===q?q:Y})},[vt.cursor,vt.opencode,vt.claudeCode]),h.useEffect(()=>{if(!Li)return;Rc();const w=B=>{var Y,J;const q=B.target;(Y=Gt.current)!=null&&Y.contains(q)||(J=Nc.current)!=null&&J.contains(q)||mt(!1)},j=B=>{B.key==="Escape"&&mt(!1)};return window.addEventListener("resize",Rc),window.addEventListener("scroll",Rc,!0),document.addEventListener("pointerdown",w),document.addEventListener("keydown",j),()=>{window.removeEventListener("resize",Rc),window.removeEventListener("scroll",Rc,!0),document.removeEventListener("pointerdown",w),document.removeEventListener("keydown",j)}},[Li,Rc]);const zl=h.useCallback(async(w,j={})=>{var St;if(!u||Ac.current)return;const B=j.phaseContextSnapshot,q=(typeof w=="string"?w:ks).trim();if(!q)return;const Y=md.current;Ac.current=!0,Up(!0),Ks(e("flow:composer.connecting")),zt(Qt=>Qt!=="composer"?"composer":Qt);const J=[...co];if(Y.length>0&&J.push({type:"assistant",segments:[...Y]}),Kp([...J,{type:"user",text:q}]),J.filter(Qt=>Qt.type==="user").length===0){const Qt=q.replace(/\s+/g," ").slice(0,30)+(q.length>30?"…":"");Jr(fs=>fs.map(Je=>Je.id===tr?{...Je,label:Qt}:Je))}const te=J.map(Qt=>Qt.type==="user"?{role:"user",text:Qt.text}:{role:"assistant",text:(Qt.segments||[]).filter(Je=>Je.kind==="assistant"||Je.kind==="result").map(Je=>Je.text).join(`
|
|
134
|
+
`)}).filter(Qt=>Qt.text),ne=B??jt;Pe(""),qs([]),yi([]),qp(!1);const ye=new AbortController;Tl.current=ye,Pc.current=tr;let be=null;const ze=Array.isArray(vt==null?void 0:vt.cursor)?vt.cursor:[],de=Array.isArray(vt==null?void 0:vt.opencode)?vt.opencode:[],Fe=Array.isArray(vt==null?void 0:vt.claudeCode)?vt.claudeCode:[],Ne=zh(mi,ze,de,Fe),xt=nh.filter(Qt=>Qt.kind!=="definition"&&Qt.node).map(Qt=>Qt.node.id),Sn=u;let Nn=!1,Wt=!1;try{be=setTimeout(()=>ye.abort(),12e4);const Qt={prompt:q,model:Ne,flowId:u.id,flowSource:u.source??"user",...u.archived?{flowArchived:!0}:{},contextInstanceIds:xt,thread:te,selectedSkills:dr};ne&&ne.nextPhase&&!ne.isLastPhase&&(Qt.phaseContext={phaseIndex:ne.nextPhase.index,phases:ne.phases,userPromptOriginal:ne.userPromptOriginal||q}),Sc&&(Qt.phaseRole=Sc);const fs=await fetch("/api/composer-agent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Qt),signal:ye.signal});if(be&&(clearTimeout(be),be=null),!fs.ok){let Di=fs.statusText||e("flow:composer.requestFailed");try{const Hl=await fs.json();Hl&&Hl.error&&(Di=String(Hl.error))}catch{}Ks(Di),qs([{kind:"error",text:Di}]);return}const Je=(St=fs.body)==null?void 0:St.getReader();if(!Je){Ks(e("flow:composer.cannotReadStream"));return}const jn=new TextDecoder;let po="";for(;;){const{done:Di,value:Hl}=await Je.read();if(Di)break;for(po+=jn.decode(Hl,{stream:!0});;){const jd=po.indexOf(`
|
|
135
|
+
`);if(jd<0)break;const fk=po.slice(0,jd).trim();if(po=po.slice(jd+1),!fk)continue;let Qe;try{Qe=JSON.parse(fk)}catch{continue}if(Qe.type==="status"&&typeof Qe.line=="string"&&Ks(Qe.line),Qe.type==="natural"&&typeof Qe.text=="string"&&Qe.text){const In=typeof Qe.kind=="string"&&Qe.kind?Qe.kind:"assistant";qs(Cn=>[...Cn,{kind:In,text:Qe.text}])}if(Qe.type==="error"&&Qe.message){Wt=!0;const In=Qe.code?` [${Qe.code}]`:"",Cn=String(Qe.message)+In;Ks(Cn),qs(Cs=>[...Cs,{kind:"error",text:Cn}])}if(Qe.type==="plan"&&Array.isArray(Qe.steps)){yi(Qe.steps.map(Cn=>({...Cn,status:"pending"})));const In=Qe.steps.map((Cn,Cs)=>`${Cs+1}. ${Cn.description||Cn.type}`).join(`
|
|
136
|
+
`);qs(Cn=>[...Cn,{kind:"assistant",text:e("flow:composer.taskPlan",{count:Qe.steps.length,summary:In})}])}if(Qe.type==="step-start"){const In=Qe.index??0,Cn=Qe.total??0,Cs=Qe.tier?` [${Qe.tier}]`:"",RR=Qe.model?` (${Qe.model})`:"";Ks(e("flow:composer.step",{current:In+1,total:Cn,description:(Qe.description||"")+Cs+RR})),yi(LR=>LR.map(Lc=>Lc.index===In?{...Lc,status:"running",model:Qe.model,tier:Qe.tier,nodeRole:Qe.nodeRole??Lc.nodeRole,instanceId:Qe.instanceId??Lc.instanceId,instanceLabel:Qe.instanceLabel??Lc.instanceLabel}:Lc))}if(Qe.type==="step-progress"){const In=Qe.index??0,Cn=Qe.total??0;Ks(e("flow:composer.step",{current:In+1,total:Cn,description:Qe.description||""}))}if(Qe.type==="step-done"){const In=Qe.index??0;yi(Cn=>Cn.map(Cs=>Cs.index===In?{...Cs,status:Qe.success?"done":"error"}:Cs))}if(Qe.type==="phase-plan"&&Array.isArray(Qe.phases)){Ll(Cn=>({...Cn||{},phases:Qe.phases,currentPhase:Qe.currentPhase??0,phaseTotal:Qe.phaseTotal??Qe.phases.length,phaseName:Qe.phaseName||"",isLastPhase:!1,nextPhase:null,userPromptOriginal:(Cn==null?void 0:Cn.userPromptOriginal)||q}));const In=Qe.phases.map((Cn,Cs)=>`${Cs+1}. ${Cn.label}`).join(" → ");qs(Cn=>[...Cn,{kind:"assistant",text:e("flow:composer.phaseGeneration",{count:Qe.phases.length,labels:In,current:Qe.phaseName||""})}])}Qe.type==="phase-complete"&&(Ll(In=>{var Cs;return{...In||{},phases:Qe.phases||(In==null?void 0:In.phases)||[],currentPhase:Qe.phaseIndex??0,phaseTotal:Qe.phaseTotal??((Cs=Qe.phases)==null?void 0:Cs.length)??0,phaseName:Qe.phaseName||"",isLastPhase:!!Qe.isLastPhase,nextPhase:Qe.nextPhase||null,userPromptOriginal:Qe.userPromptOriginal||(In==null?void 0:In.userPromptOriginal)||q}}),!Qe.isLastPhase&&Qe.nextPhase&&qs(In=>[...In,{kind:"assistant",text:e("flow:composer.phaseComplete",{phaseName:Qe.phaseName||e("flow:composer.nextPhase"),nextPhase:Qe.nextPhase.label})}])),Qe.type==="done"&&(Nn=!0,Ks(In=>In||e("flow:composer.done")))}}}catch(Qt){const fs=Qt;if(fs.name==="AbortError"){const Je=e(be?"flow:composer.connectTimeout":"flow:composer.aborted");Ks(Je),qs(jn=>[...jn,{kind:"error",text:Je}])}else{const Je=fs.code||fs.name||"UNKNOWN",jn=`${fs.message||String(Qt)} [${Je}]`;Ks(jn),qs(po=>[...po,{kind:"error",text:jn}])}}finally{if(Ac.current=!1,Up(!1),Tl.current=null,Pc.current=null,be&&clearTimeout(be),Nn&&Sn){const Qt={id:Sn.id,source:Sn.source??"user",archived:Sn.archived};(async()=>(await $t(Qt,{preserveComposer:!0,incrementalSync:!0}),await le(Qt,{quiet:!0,force:!0})))()}}},[u,ks,mi,vt,nh,$t,le,co,tr,jt,Sc,dr]);Rl.current=zl;const ok=h.useCallback(()=>{!jt||jt.isLastPhase||(Ll(null),zl(e("flow:composer.skipRemainingPhases")))},[jt,zl]),ak=h.useCallback(()=>{if(!jt||jt.isLastPhase||!jt.nextPhase)return;const w=String(jt.nextPhase.label||"").trim()||e("flow:composer.nextPhase");zl(e("flow:composer.continuePhase",{label:w}),{phaseContextSnapshot:jt})},[jt,zl]);h.useEffect(()=>{if(!_c)return;const w=j=>{j.key==="Escape"&&Ko(!1)};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[_c]),h.useEffect(()=>{Ie!=="edit"&&Ko(!1)},[Ie]),h.useLayoutEffect(()=>{const w=ld.current;if(!w)return;if(!u){w.style.height="";return}w.style.height="0px";const j=getComputedStyle(w),B=parseFloat(j.lineHeight),q=(parseFloat(j.paddingTop)||0)+(parseFloat(j.paddingBottom)||0),Y=Number.isFinite(B)&&B>0?B:13*1.45,J=q+Y*2,te=q+Y*10,ne=Math.min(Math.max(w.scrollHeight,J),te);w.style.height=`${ne}px`},[ks,u]);const Py=h.useCallback(w=>{const j=ks,B=Ss,q=h1(j,B);if(!q)return;const Y=j.slice(0,q.atIndex)+`@${w} `+j.slice(B);Pe(Y);const J=q.atIndex+w.length+2;queueMicrotask(()=>{const te=ld.current;te&&(te.focus(),te.setSelectionRange(J,J)),ja(J)})},[ks,Ss]),Ay=h.useCallback(w=>{Pe(j=>{const B=`@${w}`,q=j.indexOf(B);return q<0?j:j.slice(0,q)+j.slice(q+B.length)})},[]),lk=h.useCallback(w=>{w.kind==="canvas"?kt(j=>j.map(B=>B.id===w.node.id?{...B,selected:!1}:B)):w.kind==="mention"?Ay(w.node.id):Ay(w.definition.id)},[kt,Ay]),_R=h.useCallback(()=>{zt(w=>w==="history"?null:"history")},[]),PR=h.useCallback(()=>{zt(w=>w==="settings"?null:"settings")},[]),AR=h.useCallback(()=>{zt(w=>w==="composer"?null:"composer")},[]),Nd=h.useCallback(()=>{zt(w=>(w==="node"&&Ea.current&&(cd.current=Ea.current.id),null))},[]),ck=h.useCallback(()=>{io(w=>!w)},[]),IR=()=>{if(!u)return null;const w=Ti||u.archived||bi(u.source),j=Bt!=null&&Bt.running?e("flow:schedule.running"):ur.enabled?e("flow:schedule.waiting"):e("flow:schedule.disabled"),B=Bt!=null&&Bt.running?"running":ur.enabled?"waiting":"disabled",q=st.slice(0,12),Y=u.archived||bi(u.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:Nd,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")}),(u.source==="user"||u.source==="workspace")&&!u.archived?o.jsxs("div",{className:"af-pipeline-rename-row",children:[o.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:M,onChange:J=>{F(J.target.value),O("")},onKeyDown:J=>{J.key==="Enter"&&(J.preventDefault(),Jp())},onBlur:()=>{M.trim()&&M.trim()!==u.id&&Jp()},placeholder:u.id,disabled:D,spellCheck:!1}),o.jsx("span",{className:"af-pipeline-drawer-badge",children:zc(u.source??"user",e)})]}):o.jsxs("div",{className:"af-pipeline-drawer-readonly",children:[u.id,o.jsx("span",{className:"af-pipeline-drawer-badge",children:zc(u.source??"user",e)}),u.archived?o.jsx("span",{className:"af-pipeline-drawer-badge af-pipeline-drawer-badge--muted",children:e("flow:settings.archived")}):null]}),W?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:W}):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"}),u.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:b,onChange:J=>k(J.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 u.path=="string"&&u.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:u.path}),o.jsx("button",{type:"button",className:"af-icon-btn af-pipeline-copy-btn",onClick:()=>Q0(u.path),title:e("flow:settings.copyPath"),children:o.jsx("span",{className:"material-symbols-outlined",children:R?"check":"content_copy"})})]})]}):null,u.source==="user"||u.source==="workspace"?u.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:u.source==="user"?o.jsx("button",{type:"button",className:"af-btn-secondary",disabled:T,onClick:()=>Xp("workspace"),children:e(T?"flow:settings.moveBusy":"flow:settings.moveToWorkspace")}):o.jsx("button",{type:"button",className:"af-btn-secondary",disabled:T,onClick:()=>Xp("user"),children:e(T?"flow:settings.moveBusy":"flow:settings.moveToUserDir")})}),_?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:_}):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:[st.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:Ct,disabled:Zt,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"refresh"}),e(Zt?"common:common.loading":"common:common.refresh")]})]}),_n?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:_n}):null,Zt?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("common:common.loading")}):q.length>0?o.jsx("div",{className:"af-pipeline-market-list",children:q.map(J=>{const te=J.definitionId||`marketplace:${J.id}${J.version?`@${J.version}`:""}`,ne=fn.has(te)||fn.has(`marketplace:${J.id}`),ye=ln.find(Fe=>String(Fe.id)===te||String(Fe.id)===`marketplace:${J.id}`),be=bn===te,ze=Fh(J.inputs||J.input),de=Fh(J.outputs||J.output);return o.jsxs("div",{className:"af-pipeline-market-item",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:ne?"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:J.displayName||J.label||J.id}),o.jsx("span",{children:J.version?`v${J.version}`:te})]}),o.jsx("p",{className:"af-pipeline-market-purpose",children:J.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:ze.length>0?ze.map(Fe=>o.jsx("span",{className:"af-pipeline-market-chip",children:Fe},`in-${te}-${Fe}`)):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:de.length>0?de.map(Fe=>o.jsx("span",{className:"af-pipeline-market-chip",children:Fe},`out-${te}-${Fe}`)):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:()=>$e(J),children:e("flow:settings.previewNode")}),o.jsx("button",{type:"button",className:ne?"af-btn-secondary af-pipeline-market-action":"af-btn-primary af-pipeline-market-action",disabled:Y||be,onClick:()=>{ne&&ye?(Dl(ye),zt(null)):Aa(J)},children:e(be?"flow:settings.installingNode":ne?"flow:settings.addInstalledNode":"flow:settings.installNode")})]})]},te)})}):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")})]}),nd?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:!!ur.enabled,disabled:w,onChange:J=>re(te=>({...te,enabled:J.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:ur.cron||"",disabled:w,onChange:J=>re(te=>({...te,cron:J.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:ur.timezone||"",disabled:w,onChange:J=>re(te=>({...te,timezone:J.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:ur.preset||"",disabled:w,onChange:J=>re(te=>({...te,preset:J.target.value})),children:[o.jsx("option",{value:"",children:e("flow:schedule.defaultPreset")}),Object.keys(wn).map(J=>o.jsx("option",{value:J,children:J},J))]})]})]}),o.jsxs("div",{className:"af-pipeline-settings-schedule-status",children:[o.jsx("span",{className:`af-pipeline-settings-status-dot af-pipeline-settings-status-dot--${B}`}),o.jsx("span",{children:ur.nextRunAt?e("flow:schedule.nextRun",{time:new Date(ur.nextRunAt).toLocaleString()}):e("flow:schedule.noNextRun")}),o.jsxs("span",{children:[e("flow:schedule.runtime"),":",j]})]}),o.jsxs("dl",{className:"af-pipeline-meta-dl af-pipeline-settings-dl",children:[Kt.lastTriggeredAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastTriggeredAt")}),o.jsx("dd",{children:new Date(Kt.lastTriggeredAt).toLocaleString()})]}):null,Kt.lastSkippedAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastSkippedAt")}),o.jsxs("dd",{children:[new Date(Kt.lastSkippedAt).toLocaleString(),Kt.lastSkipReason?` · ${Kt.lastSkipReason}`:""]})]}):null,Kt.lastRunUuid?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastRun")}),o.jsx("dd",{children:Kt.lastRunUuid})]}):null,Kt.lastExitCode!=null?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastExit")}),o.jsx("dd",{children:String(Kt.lastExitCode)})]}):null,Kt.lastFinishedAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastFinishedAt")}),o.jsx("dd",{children:new Date(Kt.lastFinishedAt).toLocaleString()})]}):null]}),Bt!=null&&Bt.lastError||Kt.lastError?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:(Bt==null?void 0:Bt.lastError)||Kt.lastError}):null,u.archived||bi(u.source)?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.readonlyNote")}):null,wl?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:wl}):null,bl?o.jsx("p",{className:"af-pipeline-drawer-muted",children:bl}):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:[Et.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:ln.length})]}),o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:settings.source")}),o.jsx("dd",{children:zc(u.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:u.id}),o.jsx("span",{className:`af-pipeline-settings-status af-pipeline-settings-status--${B}`,children:j})]})]}),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:Et.length})]}),o.jsxs("div",{children:[o.jsx("dt",{children:e("flow:settings.owner")}),o.jsx("dd",{children:u.owner||"bigo"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:e("flow:settings.source")}),o.jsx("dd",{children:zc(u.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 pR(),disabled:Ti,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"save"}),e(Ti?"flow:settings.savingChanges":"flow:settings.saveChanges")]}),o.jsxs("button",{type:"button",className:"af-btn-secondary af-pipeline-settings-side-action",onClick:Nd,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")})]})]})]})},TR=()=>{const w=ve;if(!w)return null;const j=w.definitionId||`marketplace:${w.id}${w.version?`@${w.version}`:""}`,B=w.displayName||w.label||w.id,q=Fh(w.inputs||w.input),Y=Fh(w.outputs||w.output);return Fr.createPortal(o.jsx("div",{className:"af-market-preview-overlay",role:"dialog","aria-modal":"true","aria-label":e("flow:settings.nodePreviewTitle"),onMouseDown:J=>{J.target===J.currentTarget&&$e(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:B})]}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>$e(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:(q.length>0?q:[""]).slice(0,4).map((J,te)=>o.jsx("span",{title:J},`preview-in-${te}`))}),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:B}),o.jsx("span",{children:j})]}),o.jsx("div",{className:"af-market-preview-node-ports af-market-preview-node-ports--right",children:(Y.length>0?Y:[""]).slice(0,4).map((J,te)=>o.jsx("span",{title:J},`preview-out-${te}`))})]})}),o.jsxs("section",{className:"af-market-preview-section",children:[o.jsx("h3",{children:e("flow:settings.nodeFunction")}),o.jsx("p",{children:w.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:q.length>0?q.map(J=>o.jsx("span",{className:"af-pipeline-market-chip",children:J},`preview-input-${J}`)):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:Y.length>0?Y.map(J=>o.jsx("span",{className:"af-pipeline-market-chip",children:J},`preview-output-${J}`)):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:j})]}),o.jsxs("div",{children:[o.jsx("dt",{children:e("flow:settings.version")}),o.jsx("dd",{children:w.version||"-"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:e("flow:settings.packagePath")}),o.jsx("dd",{children:w.packageDir||"-"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:e("flow:settings.packagedFiles")}),o.jsx("dd",{children:Array.isArray(w.packagedFiles)&&w.packagedFiles.length>0?w.packagedFiles.map(J=>J.to||J).join(", "):"-"})]})]})]})]})]})}),document.body)};return o.jsxs(sy,{children:[o.jsx(_7,{onReady:a}),o.jsxs(t2.Provider,{value:{modelLists:vt,onModelChange:hR},children:[o.jsxs("div",{className:"af-pipeline-page"+(Ie!=="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:()=>{Ie==="running"?eh(!0):Ie!=="edit"?Fl():n("/projects")},"aria-label":e(Ie!=="edit"?"flow:topbar.backToEdit":"flow:topbar.backToProjects"),title:e(Ie!=="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",i7,"-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(Df(u,"workspace")),children:"Workspace"}),o.jsx("button",{type:"button",onClick:()=>n(Df(u,"display")),children:"Display"})]})]}),o.jsxs("div",{className:"af-pipeline-top-right af-flow-toolbar-actions",children:[Bs&&o.jsx("button",{type:"button",className:"af-icon-btn"+(ws?" af-icon-btn--active":""),"aria-label":"Composer Logs (dev)",title:"Composer Logs (dev)",onClick:()=>Oo(w=>!w),children:o.jsx("span",{className:"material-symbols-outlined",children:"description"})}),Ie==="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:Mx(un,"running")})]}),Ie==="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:Mx(un,"stopped")})]}),(Ie==="done"||Ie==="error")&&o.jsxs("div",{className:"af-run-timer"+(Ie==="error"?" af-run-timer--error":" af-run-timer--done"),children:[o.jsx("span",{className:"af-run-timer__label",children:Ie==="error"?"FAILED":"COMPLETED"}),o.jsx("span",{className:"af-run-timer__value",children:Mx(un,Ie)})]}),Ie!=="edit"&&o.jsx("button",{type:"button",className:"af-icon-btn"+(tt?" af-icon-btn--active":""),"aria-label":e("flow:topbar.executionLog"),title:e("flow:topbar.executionLog"),onClick:()=>gr(w=>!w),children:o.jsx("span",{className:"material-symbols-outlined",children:"terminal"})}),Ie==="edit"&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-icon-btn"+(nt==="history"?" af-icon-btn--active":""),"aria-label":e("flow:topbar.history"),title:e("flow:topbar.history"),disabled:!u,onClick:_R,children:o.jsx("span",{className:"material-symbols-outlined",children:"history"})}),o.jsx("button",{type:"button",className:"af-icon-btn"+(nt==="settings"?" af-icon-btn--active":""),onClick:PR,"aria-label":e("flow:topbar.pipelineSettings"),title:e("flow:topbar.pipelineSettings"),disabled:!u,children:o.jsx("span",{className:"material-symbols-outlined",children:"settings"})}),o.jsx("button",{type:"button",className:"af-composer-topbar-btn"+(nt==="composer"?" af-composer-topbar-btn--active":"")+(An?" af-composer-topbar-btn--running":""),onClick:AR,"aria-label":"AI Composer",title:"AI Composer",disabled:!u,children:"AI"}),o.jsx("button",{type:"button",className:"af-icon-btn af-shortcuts-trigger"+(Bn?" af-icon-btn--active":""),onClick:ck,"aria-label":e("flow:topbar.shortcutsLabel"),title:e("flow:topbar.shortcutsTitle"),disabled:!u,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:!u||bi(u.source)||u.source!=="user"&&u.source!=="workspace",onClick:()=>E(!0),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_forever"})}),o.jsx("button",{type:"button",className:"af-btn-pipeline-archive",disabled:!u||bi(u.source)||u.archived||u.source!=="user"&&u.source!=="workspace",onClick:()=>P(!0),children:"Archive"})]}),Ie==="running"?o.jsxs("button",{type:"button",className:"af-btn-run-stop",onClick:bR,title:e("flow:run.pauseRun"),children:[o.jsx("span",{className:"material-symbols-outlined",children:"pause"}),"Pause"]}):Ie==="ready"?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!u,onClick:()=>void fo(),title:e("flow:topbar.startRun"),children:e("flow:topbar.startRun")}),o.jsxs("button",{type:"button",className:"af-btn-pipeline-save",onClick:Fl,children:[o.jsx("span",{className:"material-symbols-outlined",children:"edit"}),"Edit"]})]}):Ie==="stopped"?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!u,onClick:()=>void fo({runUuid:xn}),title:xn?e("flow:topbar.resumeTitle",{uuid:xn}):e("flow:topbar.resumeTitleNoUuid"),children:"Resume"}),o.jsxs("button",{type:"button",className:"af-btn-pipeline-save",onClick:Fl,children:[o.jsx("span",{className:"material-symbols-outlined",children:"edit"}),"Edit"]})]}):Ie==="done"||Ie==="error"?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!u,onClick:()=>void fo(),title:e("flow:topbar.rerunTitle"),children:"Run"}),o.jsxs("button",{type:"button",className:"af-btn-pipeline-save",onClick:Fl,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:!u,onClick:()=>void fo(),children:"Run"}),o.jsx("button",{type:"button",className:"af-run-btn-dropdown",disabled:!u,onClick:()=>Le(w=>!w),"aria-label":e("flow:topbar.runOptions"),"aria-expanded":we,children:o.jsx("span",{className:"material-symbols-outlined",children:"arrow_drop_down"})}),we&&u&&o.jsxs("div",{className:"af-run-dropdown-menu",children:[o.jsxs("button",{type:"button",className:"af-run-dropdown-item",onClick:()=>{var j,B,q,Y,J;Le(!1);const w={};for(const te of A){const ne=U[te.id];ne&&(w[ne]=((j=li[ne])==null?void 0:j.value)??((B=li[ne])==null?void 0:B.path)??((J=(Y=(q=te.data)==null?void 0:q.outputs)==null?void 0:Y[0])==null?void 0:J.default)??"")}Mt(w),Ke(!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:()=>{Le(!1),fo({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:()=>{Le(!1),fo()},children:[o.jsx("span",{className:"material-symbols-outlined",children:"play_arrow"}),e("flow:runPreset.default")]}),Object.keys(wn).map(w=>o.jsxs("button",{type:"button",className:"af-run-dropdown-item",onClick:()=>{var q;Le(!1);const j=wn[w]||{},B={};for(const Y of A){const J=U[Y.id];if(!J)continue;const te=((q=Y.data)==null?void 0:q.definitionId)||"",ne=j[Y.id]??"";te.startsWith("provide_file")?B[J]={type:"file",path:ne}:B[J]={type:"str",value:ne}}fo({cliInputsOverride:B})},children:[o.jsx("span",{className:"material-symbols-outlined",children:"bookmark"}),w]},w))]})]})]})]})]}),rt?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:rt}),o.jsx("button",{type:"button",onClick:()=>at(""),"aria-label":"关闭发布提示",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}):null,o.jsxs("div",{className:"af-pipeline-body"+(Ie!=="edit"?" af-pipeline-body--run-mode":""),children:[Ie==="edit"&&nt!=="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${hr?" af-palette-workspace--expanded":""}`,children:[o.jsxs("button",{type:"button",className:"af-palette-workspace-head",onClick:()=>Zn(w=>!w),"aria-expanded":hr,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:hr?"expand_less":"expand_more"})]}),o.jsx("div",{className:"af-palette-workspace-path",title:u&&(u.path||Vr.path)||"",children:u?u.id:e("flow:palette2.noPipelineSelected")}),hr&&o.jsx("div",{className:"af-palette-workspace-tree",children:Ur?o.jsx("div",{className:"af-palette-workspace-loading",children:e("flow:palette.loading")}):Vr.error?o.jsx("div",{className:"af-palette-workspace-empty",children:Vr.error}):u?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:u.id}),o.jsxs("span",{className:"af-palette-workspace-count",children:["(",Vr.files.length,")"]})]}),Vr.files.length>0?o.jsx("ul",{className:"af-palette-workspace-list",children:Vr.files.filter(w=>w.type==="file").map(w=>o.jsxs("li",{className:"af-palette-workspace-item af-palette-workspace-item--clickable",title:w.path,onClick:()=>ee({filePath:w.path,fileName:w.name}),children:[o.jsx("span",{className:"material-symbols-outlined af-palette-workspace-item-icon","aria-hidden":!0,children:w.icon}),o.jsx("span",{className:"af-palette-workspace-item-label",children:w.name}),w.size!=null&&o.jsx("span",{className:"af-palette-workspace-item-size",children:w.size<1024?`${w.size}B`:w.size<1024*1024?`${(w.size/1024).toFixed(1)}KB`:`${(w.size/1024/1024).toFixed(1)}MB`})]},w.path))}):Vr.files.filter(w=>w.type==="directory").length===0?o.jsx("div",{className:"af-palette-workspace-empty",children:"暂无文件"}):null]}),Vr.files.filter(w=>{var j;return w.type==="directory"&&((j=w.children)==null?void 0:j.length)>0}).map(w=>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:w.icon}),o.jsxs("span",{children:[w.name,"/"]}),o.jsxs("span",{className:"af-palette-workspace-count",children:["(",w.children.length,")"]})]}),o.jsx("ul",{className:"af-palette-workspace-list",children:w.children.map(j=>o.jsxs("li",{className:`af-palette-workspace-item${j.type==="file"?" af-palette-workspace-item--clickable":""}`,title:j.path,onClick:j.type==="file"?()=>ee({filePath:j.path,fileName:j.name}):void 0,children:[o.jsx("span",{className:"material-symbols-outlined af-palette-workspace-item-icon","aria-hidden":!0,children:j.icon}),o.jsx("span",{className:"af-palette-workspace-item-label",children:j.name}),j.type==="file"&&j.size!=null&&o.jsx("span",{className:"af-palette-workspace-item-size",children:j.size<1024?`${j.size}B`:j.size<1024*1024?`${(j.size/1024).toFixed(1)}KB`:`${(j.size/1024/1024).toFixed(1)}MB`})]},j.path))})]},w.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:_e==="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:Ve,type:"search",className:"af-palette-search-input",value:xe,onChange:w=>pe(w.target.value),placeholder:(_e==="flows"?"搜索流程片段":e("flow:palette.searchNodes"))+"…","aria-label":_e==="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":_e==="nodes",className:"af-palette-tab"+(_e==="nodes"?" af-palette-tab--active":""),onClick:()=>je("nodes"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"category"}),"节点"]}),o.jsxs("button",{type:"button",role:"tab","aria-selected":_e==="flows",className:"af-palette-tab"+(_e==="flows"?" af-palette-tab--active":""),onClick:()=>je("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:_e==="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:CR,disabled:!u||Or.length<2,title:Or.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:["已选 ",Or.length," 节点 / ",th.length," 连线"]})]})}),bt?o.jsx("p",{className:"af-err af-palette-list-err",children:bt}):null,dt?o.jsx("p",{className:"af-palette-empty",children:"正在加载流程片段…"}):rk.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:rk.map(w=>{const j=`${w.id}@${w.version}`,B=w.displayName||w.name||w.id,q=w.description||`${w.nodeCount||0} 个节点,${w.edgeCount||0} 条连线`;return o.jsxs("button",{type:"button",className:"af-palette-card af-flow-snippet-card",onClick:()=>ik(w),draggable:!!u,onDragStart:Y=>{Y.dataTransfer.setData("application/agentflow-snippet",j),Y.dataTransfer.effectAllowed="move"},disabled:!u,title:q,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:B}),o.jsxs("span",{className:"af-palette-card-id",children:[w.id,"@",w.version]})]})]}),q?o.jsx("span",{className:"af-palette-card-desc",children:q}):null,o.jsxs("span",{className:"af-flow-snippet-meta","aria-hidden":!0,children:[o.jsxs("span",{children:[w.nodeCount||0," nodes"]}),o.jsxs("span",{children:[w.edgeCount||0," edges"]})]})]},j)})})]}):o.jsx("p",{className:"af-palette-empty",children:xe.trim()?"无匹配流程片段":"暂无流程片段。选择多个节点后发布。"})]}):o.jsxs(o.Fragment,{children:[Jd.filter(w=>kn[w].length>0).map(w=>o.jsxs("section",{className:`af-palette-section af-flow-palette-section--${w}`,children:[o.jsx("h3",{className:"af-palette-cat",children:w}),o.jsx("div",{className:"af-palette-cards",children:kn[w].map(j=>{const B=u1(j.inputs,"input"),q=u1(j.outputs,"output"),J=j.id==="control_load_skills"?"从当前 Skills collection 或上游上下文自动注入 Skills,通常无需手填参数。":r2(j),te=n2(j);return o.jsxs("button",{type:"button",className:"af-palette-card",onClick:()=>Dl(j),draggable:!!u,onDragStart:ne=>{ne.dataTransfer.setData("application/agentflow-node",j.id),ne.dataTransfer.effectAllowed="move"},disabled:!u,title:J||j.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:u7(w)})}),o.jsxs("span",{className:"af-palette-card-main",children:[o.jsx("span",{className:"af-palette-card-label",children:te}),te!==j.id?o.jsx("span",{className:"af-palette-card-id",children:j.id}):null]})]}),J?o.jsx("span",{className:"af-palette-card-desc",children:J}):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:[B.list.length," IN"]}),o.jsxs("span",{className:"af-palette-card-port-list",children:[B.shown.map((ne,ye)=>o.jsxs("span",{className:"af-palette-card-port",title:c1("input",ne,ye),children:[o.jsx("span",{className:"af-palette-card-port-dot",style:{background:or(ne==null?void 0:ne.type)}}),o.jsx("span",{className:"af-palette-card-port-name",children:Ox(ne,ye)})]},`in-${ye}`)),B.hidden>0?o.jsxs("span",{className:"af-palette-card-port-more",children:["+",B.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((ne,ye)=>o.jsxs("span",{className:"af-palette-card-port",title:c1("output",ne,ye),children:[o.jsx("span",{className:"af-palette-card-port-name",children:Ox(ne,ye)}),o.jsx("span",{className:"af-palette-card-port-dot",style:{background:or(ne==null?void 0:ne.type)}})]},`out-${ye}`)),q.hidden>0?o.jsxs("span",{className:"af-palette-card-port-more",children:["+",q.hidden]}):null]})]})]})]},j.id)})})]},w)),u&&Z.length===0?o.jsx("p",{className:"af-palette-empty",children:e("flow:palette.noComponents")}):null,u&&Z.length>0&&xe.trim()&&us===0?o.jsx("p",{className:"af-palette-empty",children:e("flow:palette.noMatch")}):null,u?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"+(xa?"":" af-palette-engine-dot--offline"),"aria-hidden":!0}),o.jsx("span",{className:"af-palette-engine-label",children:e(xa?"common:engine.online":"common:engine.offline")})]}),x?o.jsx("div",{className:"af-palette-tip"+ft,role:"status","aria-live":"polite",children:x}):null]})]}):Ie!=="edit"&&u?o.jsx(QK,{flowId:u.id,flowSource:u.source||"user",flowArchived:u.archived,provideNodes:A,edges:vn,nodes:Et,onCliInputsChange:Ws,onBackToEdit:Fl}):null,o.jsxs("div",{className:"af-pipeline-main-stack",children:[o.jsxs("div",{className:"af-pipeline-canvas-col",children:[g?o.jsx("div",{className:"af-banner af-banner--err af-pipeline-banner",children:g}):null,u&&Ce.length>0&&!V?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:fe,"aria-label":e("flow:validation.reloadFromServer"),title:e("flow:validation.reloadFromServerShort"),onClick:()=>void Se(),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:()=>ie(!0),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]})]}),o.jsx("ul",{className:"af-flow-slot-warnings-list",children:Ce.map(w=>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:w.nodeId}),onClick:j=>{j.preventDefault(),Ns(w.nodeId)},children:w.nodeId}),'"',w.suffix]},w.key))})]}):null,u&&Ce.length>0&&V?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:Ce.length})}),o.jsxs("button",{type:"button",className:"af-flow-slot-warnings-kbd-hint",onClick:ck,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:()=>ie(!1),children:e("flow:validation.show")}),o.jsx("button",{type:"button",className:"af-flow-slot-warnings-collapsed-btn",disabled:fe,onClick:()=>void Se(),children:e("common:common.refresh")})]})]}):null,nt==="settings"&&u&&Ie==="edit"?IR():o.jsx("div",{className:"af-react-flow-wrap af-pipeline-flow",children:u?o.jsxs(o.Fragment,{children:[o.jsx(M7,{fitViewEpoch:m,canvasTool:Ap,nodes:Q,edges:se,onNodesChange:Ie!=="edit"?void 0:wy,onEdgesChange:Ie!=="edit"?void 0:by,onConnect:Ie!=="edit"?void 0:$n,onConnectStart:Ie!=="edit"?void 0:Vn,onConnectEnd:Ie!=="edit"?void 0:Dt,isValidConnection:Ie!=="edit"?void 0:Jt,onNodesDelete:Ie!=="edit"?void 0:nn,onNodeClick:Re,onNodeDoubleClick:It,onEdgeClick:tn,onFlowInit:Zr,onDrop:bd,onDragOver:Ta,hideMinimapAndControls:!!(u&&nt),bottomSlot:Ie==="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:nh.length===0?o.jsx("span",{className:"af-composer-selected-empty",children:e("flow:composer.selectedNodesEmpty")}):nh.map((w,j)=>{var ye,be;if(w.kind==="definition"){const ze=w.definition,de=String(ze.label??ze.id),Fe=[ze.id,ze.description?String(ze.description).slice(0,120):""].filter(Boolean).join(" — ");return o.jsxs("div",{className:"af-composer-node-chip af-composer-node-chip--definition",title:Fe,children:[o.jsx("span",{className:"af-composer-node-chip-label",children:de}),o.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>lk(w),"aria-label":e("flow:composer.removeFromInput",{id:ze.id}),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},`def-${ze.id}`)}const B=w.node,q=w.kind,Y=String(((ye=B.data)==null?void 0:ye.label)??B.id),J=(be=B.data)!=null&&be.definitionId?String(B.data.definitionId):"",te=J&&J!==Y?`${Y} · ${B.id} · ${J}`:`${Y} · ${B.id}`,ne=q==="canvas"?e("flow:composer.deselectNode",{id:B.id}):e("flow:composer.removeFromInput",{id:B.id});return o.jsxs("div",{className:"af-composer-node-chip"+(q==="mention"?" af-composer-node-chip--mention":""),title:te,children:[o.jsx("span",{className:"af-composer-node-chip-label",children:Y}),o.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>lk(w),"aria-label":ne,children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},B.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:ld,className:"af-composer-textarea",placeholder:e("flow:composer.inputPlaceholder"),disabled:!u,value:ks,rows:2,onChange:w=>{Pe(w.target.value),ja(w.target.selectionStart??w.target.value.length)},onSelect:w=>{const j=w.target;j instanceof HTMLTextAreaElement&&ja(j.selectionStart??0)},onKeyDown:w=>{if((w.metaKey||w.ctrlKey)&&w.key==="Enter"){w.preventDefault(),zl();return}if(kd&&$i.length>0&&(w.key==="ArrowDown"||w.key==="ArrowUp"||w.key==="Enter")){if(w.key==="ArrowDown")w.preventDefault(),hi(j=>(j+1)%$i.length);else if(w.key==="ArrowUp")w.preventDefault(),hi(j=>(j-1+$i.length)%$i.length);else if(w.key==="Enter"){w.preventDefault();const j=$i[Ca];j&&Py(j.id)}}},onKeyUp:w=>{const j=w.target;j instanceof HTMLTextAreaElement&&ja(j.selectionStart??j.value.length)},onClick:w=>{const j=w.target;j instanceof HTMLTextAreaElement&&ja(j.selectionStart??0)},"aria-label":e("flow:composer.inputAriaLabel"),autoComplete:"off",spellCheck:!1}),kd&&u&&$i.length>0?o.jsxs("ul",{className:"af-composer-mention-menu",role:"listbox","aria-label":e("flow:composer.mentionAriaLabel"),children:[Sd.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,Sd.instances.map((w,j)=>{const B=j;return o.jsx("li",{role:"option","aria-selected":B===Ca,children:o.jsxs("button",{type:"button",className:"af-composer-mention-item"+(B===Ca?" af-composer-mention-item--active":""),onMouseDown:q=>q.preventDefault(),onMouseEnter:()=>hi(B),onClick:()=>Py(w.id),children:[o.jsx("span",{className:"af-composer-mention-id",children:w.title}),w.subtitle?o.jsx("span",{className:"af-composer-mention-sub",children:w.subtitle}):null]})},`i-${w.id}`)}),Sd.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,Sd.definitions.map((w,j)=>{const B=Sd.instances.length+j;return o.jsx("li",{role:"option","aria-selected":B===Ca,children:o.jsxs("button",{type:"button",className:"af-composer-mention-item"+(B===Ca?" af-composer-mention-item--active":""),onMouseDown:q=>q.preventDefault(),onMouseEnter:()=>hi(B),onClick:()=>Py(w.id),children:[o.jsx("span",{className:"af-composer-mention-id",children:w.title}),w.subtitle?o.jsx("span",{className:"af-composer-mention-sub",children:w.subtitle}):null]})},`d-${w.id}`)})]}):null]}),o.jsxs("div",{className:"af-composer-toolbar",children:[cs.length>0&&o.jsx("label",{className:"af-composer-session-field",children:o.jsxs("select",{className:"af-composer-session-select",value:tr||"",onChange:w=>{w.target.value==="__new__"?Wp():qo(w.target.value)},disabled:An,"aria-label":e("flow:composer.switchConversation"),children:[cs.map(w=>o.jsxs("option",{value:w.id,children:[w.label,w.running?" ⏳":""]},w.id)),o.jsxs("option",{value:"__new__",children:["+ ",e("flow:composer.newConversation")]})]})}),o.jsxs("div",{className:"af-composer-skills-field",children:[o.jsxs("button",{ref:Gt,type:"button",className:"af-composer-skills-button"+(_y>0?" af-composer-skills-button--active":""),disabled:!u||An,"aria-haspopup":"listbox","aria-expanded":Li,onClick:()=>mt(w=>!w),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"extension"}),o.jsx("span",{children:_y>0?`Skills ${_y}`:"Skills"})]}),Li&&!An?Fr.createPortal(o.jsx("div",{ref:Nc,className:"af-composer-skills-menu",role:"listbox","aria-label":"Composer skills",style:xy,children:gi.length===0?o.jsx("div",{className:"af-composer-skills-empty",children:"No skills found"}):o.jsxs(o.Fragment,{children:[rh.groups.map(w=>{const j=cl(w,gi),B=cP(w,Ey,gi),q=Fp.has(w.id);return o.jsxs("div",{className:"af-composer-skill-group af-composer-skill-group--framed"+(q?" 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:B==="all",disabled:j.length===0,onChange:Y=>{const J=Y.target.checked;oo(te=>J?aP(te,j):lP(te,j))}}),o.jsxs("span",{className:"af-composer-skill-group-title-main",children:[o.jsx("span",{children:w.name}),w.builtin?o.jsx("em",{children:"built-in"}):null,B==="partial"?o.jsx("em",{children:"partial"}):null]})]}),o.jsxs("button",{type:"button",className:"af-composer-skill-group-toggle","aria-label":q?`展开 ${w.name}`:`收起 ${w.name}`,onClick:()=>{Pl(Y=>{const J=new Set(Y);return J.has(w.id)?J.delete(w.id):J.add(w.id),J})},children:[o.jsx("span",{children:w.skills.length}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:q?"expand_more":"expand_less"})]})]}),q?null:o.jsx("div",{className:"af-composer-skill-group-items",children:w.skills.map(Y=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:Ey.has(Y.key),onChange:J=>{const te=J.target.checked;oo(ne=>te?ne.includes(Y.key)?ne:[...ne,Y.key]:ne.filter(ye=>ye!==Y.key))}}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:Y.name}),Y.description?o.jsx("span",{className:"af-composer-skill-option-desc",children:Y.description}):null]})]},`${w.id}:${Y.key}`))})]},w.id)}),rh.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:rh.ungrouped.length})]}),rh.ungrouped.map(w=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:Ey.has(w.key),onChange:j=>{const B=j.target.checked;oo(q=>B?q.includes(w.key)?q:[...q,w.key]:q.filter(Y=>Y!==w.key))}}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:w.name}),w.description?o.jsx("span",{className:"af-composer-skill-option-desc",children:w.description}):null]})]},`ungrouped:${w.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:(mi||"").trim()?js.currentNotInLists?js.currentNotInLists:zh(mi,js.cursorList,js.opencodeList,js.claudeCodeList):"",onChange:w=>El(w.target.value),disabled:!u||An,"aria-label":e("flow:composer.modelAriaLabel"),children:[o.jsx("option",{value:"",children:e("flow:composer.modelDefault")}),js.currentNotInLists?o.jsxs("option",{value:js.currentNotInLists,children:[js.currentNotInLists,e("flow:composer.modelNotInList")]}):null,js.cursorList.length>0?o.jsx("optgroup",{label:"Cursor",children:js.cursorList.map(w=>o.jsx("option",{value:Zo(w),children:w},`composer-c-${w}`))}):null,js.opencodeList.length>0?o.jsx("optgroup",{label:"OpenCode",children:js.opencodeList.map(w=>o.jsx("option",{value:`opencode:${Zo(w)}`,children:w},`composer-o-${w}`))}):null,js.claudeCodeList.length>0?o.jsx("optgroup",{label:"Claude Code",children:js.claudeCodeList.map(w=>o.jsx("option",{value:`claude-code:${Zo(w)}`,children:w},`composer-cc-${w}`))}):null]})]}),o.jsx("button",{type:"button",className:"af-composer-send"+(u&&ks.trim()&&!An?" af-composer-send--active":"")+(An?" af-composer-send--stop":""),disabled:!u||!An&&!ks.trim(),"aria-label":e(An?"flow:composer.stopGeneration":"flow:composer.send"),title:An?e("flow:composer.stopGeneration"):void 0,onClick:()=>{var w;if(An){(w=Tl.current)==null||w.abort();return}zl()},children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:An?"stop":"arrow_upward"})})]})]}),_c?Fr.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:w=>{w.target===w.currentTarget&&Ko(!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"+(An?" af-composer-thread-dialog-status--running":""),role:"status","aria-live":"polite",title:Il||void 0,children:An&&!Il?e("flow:composer.executing"):Il||e("flow:composer.ready")})]}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>Ko(!1),"aria-label":e("flow:composer.collapseAriaLabel"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),hd.length>1&&!(jt&&Array.isArray(jt.phases)&&jt.phases.length>1)?o.jsx("div",{className:"af-composer-steps-track-wrap",children:o.jsx(k7,{steps:hd})}):null,jt&&Array.isArray(jt.phases)&&jt.phases.length>1?o.jsx("div",{className:"af-composer-phase-bar","aria-label":e("flow:composer.phaseProgress"),children:jt.phases.map((w,j)=>{const B=w.status||(j<(jt.currentPhase??0)?"done":j===(jt.currentPhase??0)?An?"running":jt.nextPhase||jt.isLastPhase?"done":"running":"pending");return o.jsxs("div",{className:"af-composer-phase-item"+(B==="done"?" af-composer-phase-item--done":"")+(B==="running"?" af-composer-phase-item--running":"")+(B==="pending"?" af-composer-phase-item--pending":""),title:`${w.label}${w.description?":"+w.description:""}`,children:[o.jsx("span",{className:"af-composer-phase-dot","aria-hidden":!0,children:B==="done"?o.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"0.85rem"},children:"check"}):o.jsx("span",{children:j+1})}),o.jsx("span",{className:"af-composer-phase-label",children:w.label})]},w.name||j)})}):null,o.jsx("div",{className:"af-composer-thread-dialog-scroll",children:o.jsx(m1,{thread:co,liveSegments:Uo,running:An})}),jt&&!jt.isLastPhase&&jt.nextPhase&&!An?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:jt.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:ak,children:e("flow:composer.phaseReviewContinue",{label:jt.nextPhase.label})}),o.jsx("button",{type:"button",className:"af-composer-phase-btn af-composer-phase-btn--skip",onClick:ok,children:e("flow:composer.phaseReviewSkip")})]})]}):null]})}),document.body):null]})}):null}),dn&&Ie==="edit"?(()=>{var q;const w=String(dn.query||"").trim().toLowerCase(),j=w?dn.candidates.filter(Y=>{var J,te,ne;return[(J=Y.def)==null?void 0:J.id,Y.displayLabel,Y.description,(te=Y.slot)==null?void 0:te.name,(ne=Y.slot)==null?void 0:ne.type].filter(Boolean).some(ye=>String(ye).toLowerCase().includes(w))}):dn.candidates,B=dn.draft.handleType==="source"?"IN":"OUT";return o.jsxs("div",{className:"af-connect-node-menu",style:{left:dn.left,top:dn.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:or((q=dn.draft.slot)==null?void 0:q.type)},"aria-hidden":!0}),o.jsxs("span",{children:["匹配 ",dn.draft.slotType," 节点"]})]}),o.jsx("button",{type:"button",className:"af-connect-node-menu__close","aria-label":"关闭",onClick:()=>Oi(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:dn.query,onChange:Y=>Oi(J=>J&&{...J,query:Y.target.value}),placeholder:"搜索节点",autoFocus:!0})]}),o.jsxs("div",{className:"af-connect-node-menu__list",children:[j.map(Y=>{var ne,ye;const J=Y.displayLabel||((ne=Y.def)==null?void 0:ne.id),te=Ox(Y.slot,Y.slotIndex);return o.jsxs("button",{type:"button",className:"af-connect-node-menu__item",onClick:()=>Ia(Y),title:Y.description||Y.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:J}),J!==Y.def.id?o.jsx("span",{className:"af-connect-node-menu__item-id",children:Y.def.id}):null]}),o.jsxs("span",{className:"af-connect-node-menu__port",children:[o.jsx("span",{children:B}),o.jsx("span",{className:"af-connect-node-menu__port-dot",style:{background:or((ye=Y.slot)==null?void 0:ye.type)},"aria-hidden":!0}),o.jsx("span",{className:"af-connect-node-menu__port-name",children:te})]})]},`${Y.def.id}-${Y.slotIndex}`)}),j.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")})})]}),Ie!=="edit"&&tt&&o.jsxs("div",{className:"af-run-console",style:{height:vr},children:[o.jsx("div",{className:"af-run-console__resize",role:"separator","aria-orientation":"horizontal","aria-label":e("flow:run.resizeConsole"),onPointerDown:gR,onPointerMove:yR,onPointerUp:tk,onPointerCancel:tk,onLostPointerCapture:xR}),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:[Ie==="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:()=>gr(!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:[mr.map((w,j)=>o.jsxs("div",{className:"af-run-console__line"+(w.type==="error"?" af-run-console__line--error":"")+(w.type==="warn"?" af-run-console__line--warn":"")+(w.type==="node-start"?" af-run-console__line--start":"")+(w.type==="node-done"?" af-run-console__line--done":"")+(w.type==="node-failed"?" af-run-console__line--error":"")+(w.type==="done"?" af-run-console__line--done":""),children:[o.jsxs("span",{className:"af-run-console__ts",children:["[",w.ts?new Date(w.ts).toLocaleTimeString():"--:--:--","]"]}),o.jsx("span",{className:"af-run-console__text",children:w.text!=null?String(w.text):""})]},j)),o.jsx("div",{ref:Do})]})]})]}),Ie!=="edit"&&bs&&u?o.jsx(YK,{instanceId:bs,flowId:u.id,runId:xn,nodeStatus:((uk=qr[bs])==null?void 0:uk.status)??null,onClose:()=>Yr(null)}):null,nt&&nt!=="settings"&&u&&Ie==="edit"?o.jsx("aside",{className:"af-pipeline-drawer"+(nt==="node"?" af-pipeline-drawer--wide":"")+(nt==="composer"?" af-pipeline-drawer--wide":""),"aria-label":nt==="settings"?e("flow:settings.title"):nt==="history"?e("flow:history.title"):nt==="composer"?"AI Composer":e("flow:nodeProps.title"),children:nt==="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:Nd,"aria-label":e("flow:composer.closeSidebar"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),cs.length>0&&o.jsxs("div",{className:"af-composer-session-tabs",children:[cs.map(w=>o.jsxs("button",{type:"button",ref:j=>{j&&w.id===tr&&j.scrollIntoView({block:"nearest",inline:"nearest"})},className:["af-composer-session-tab",w.id===tr?"af-composer-session-tab--active":"",w.running?"af-composer-session-tab--running":""].filter(Boolean).join(" "),onClick:()=>qo(w.id),title:w.label,children:[o.jsx("span",{className:"af-composer-session-label",children:w.label}),o.jsx("span",{className:"af-composer-session-close",role:"button",tabIndex:0,onClick:j=>{j.stopPropagation(),Vp(w.id)},onKeyDown:j=>{j.key!=="Enter"&&j.key!==" "||(j.preventDefault(),j.stopPropagation(),Vp(w.id))},title:w.running?e("flow:composer.endConversation"):e("flow:composer.closeConversation"),children:o.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"0.75rem"},children:"close"})})]},w.id)),o.jsx("button",{type:"button",className:"af-composer-session-add",onClick:()=>Wp(),title:e("flow:composer.newConversation"),children:o.jsx("span",{className:"material-symbols-outlined",children:"add"})})]}),o.jsx("div",{className:"af-composer-sidebar-status"+(An?" af-composer-sidebar-status--running":""),role:"status","aria-live":"polite",children:An&&!Il?e("flow:composer.executing"):Il||e("flow:composer.ready")}),jt&&Array.isArray(jt.phases)&&jt.phases.length>1?o.jsx("div",{className:"af-composer-phase-bar","aria-label":e("flow:composer.phaseProgress"),children:jt.phases.map((w,j)=>{const B=w.status||(j<(jt.currentPhase??0)?"done":j===(jt.currentPhase??0)?An?"running":jt.isLastPhase&&j===jt.phases.length-1||jt.nextPhase?"done":"running":"pending");return o.jsxs("div",{className:"af-composer-phase-item"+(B==="done"?" af-composer-phase-item--done":"")+(B==="running"?" af-composer-phase-item--running":"")+(B==="pending"?" af-composer-phase-item--pending":""),title:`${w.label}${w.description?":"+w.description:""}`,children:[o.jsx("span",{className:"af-composer-phase-dot","aria-hidden":!0,children:B==="done"?o.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"0.85rem"},children:"check"}):o.jsx("span",{children:j+1})}),o.jsx("span",{className:"af-composer-phase-label",children:w.label})]},w.name||j)})}):null,o.jsx("div",{className:"af-composer-sidebar-thread",ref:Bp,children:o.jsx(m1,{thread:co,liveSegments:Uo,running:An})}),jt&&!jt.isLastPhase&&jt.nextPhase&&!An?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:jt.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:ak,children:e("flow:composer.phaseReviewContinue",{label:jt.nextPhase.label})}),o.jsx("button",{type:"button",className:"af-composer-phase-btn af-composer-phase-btn--skip",onClick:ok,children:e("flow:composer.phaseReviewSkip")})]})]}):null]}):nt==="node"&&ce?gt?o.jsx(JT,{draft:gt,setDraft:ud,definitionId:String(((dk=ce.data)==null?void 0:dk.definitionId)??ce.id),systemPromptReadonly:String((Xe==null?void 0:Xe.description)??""),modelLists:vt,disabled:!u,onIdBlur:mR,onClose:Nd,onPublishToMarketplace:$l,error:Lp,ioSlots:{inputs:Array.isArray(gt==null?void 0:gt.inputs)?gt.inputs:[],outputs:Array.isArray(gt==null?void 0:gt.outputs)?gt.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(nt==="settings"?"flow:settings.title":"flow:history.title")}),o.jsx("button",{type:"button",className:"af-pipeline-drawer-close af-icon-btn",onClick:Nd,"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:nt==="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")}),(u.source==="user"||u.source==="workspace")&&!u.archived?o.jsxs("div",{className:"af-pipeline-rename-row",children:[o.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:M,onChange:w=>{F(w.target.value),O("")},onKeyDown:w=>{w.key==="Enter"&&(w.preventDefault(),Jp())},onBlur:()=>{M.trim()&&M.trim()!==u.id&&Jp()},placeholder:u.id,disabled:D,spellCheck:!1}),o.jsx("span",{className:"af-pipeline-drawer-badge",children:zc(u.source??"user",e)})]}):o.jsxs("div",{className:"af-pipeline-drawer-readonly",children:[u.id,o.jsx("span",{className:"af-pipeline-drawer-badge",children:zc(u.source??"user",e)}),u.archived?o.jsx("span",{className:"af-pipeline-drawer-badge af-pipeline-drawer-badge--muted",children:e("flow:settings.archived")}):null]}),W?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:W}):null]}),typeof u.path=="string"&&u.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:u.path}),o.jsx("button",{type:"button",className:"af-icon-btn af-pipeline-copy-btn",onClick:()=>Q0(u.path),title:e("flow:settings.copyPath"),children:o.jsx("span",{className:"material-symbols-outlined",children:R?"check":"content_copy"})})]})]}):null,u.source==="user"||u.source==="workspace"?u.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:u.source==="user"?o.jsx("button",{type:"button",className:"af-btn-secondary",disabled:T,onClick:()=>Xp("workspace"),children:e(T?"flow:settings.moveBusy":"flow:settings.moveToWorkspace")}):o.jsx("button",{type:"button",className:"af-btn-secondary",disabled:T,onClick:()=>Xp("user"),children:e(T?"flow:settings.moveBusy":"flow:settings.moveToUserDir")})}),_?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:_}):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:b,onChange:w=>k(w.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")}),nd?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:!!ur.enabled,disabled:Ti||u.archived||bi(u.source),onChange:w=>re(j=>({...j,enabled:w.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:ur.cron||"",disabled:Ti||u.archived||bi(u.source),onChange:w=>re(j=>({...j,cron:w.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:ur.timezone||"",disabled:Ti||u.archived||bi(u.source),onChange:w=>re(j=>({...j,timezone:w.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:ur.preset||"",disabled:Ti||u.archived||bi(u.source),onChange:w=>re(j=>({...j,preset:w.target.value})),children:[o.jsx("option",{value:"",children:e("flow:schedule.defaultPreset")}),Object.keys(wn).map(w=>o.jsx("option",{value:w,children:w},w))]})]}),o.jsx("div",{className:"af-pipeline-drawer-readonly",children:o.jsx("span",{children:e("flow:schedule.overlapSkip")})}),ur.nextRunAt?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.nextRun",{time:new Date(ur.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:Bt!=null&&Bt.running?e("flow:schedule.running"):ur.enabled?e("flow:schedule.waiting"):e("flow:schedule.disabled")})]}),Kt.lastTriggeredAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastTriggeredAt")}),o.jsx("dd",{children:new Date(Kt.lastTriggeredAt).toLocaleString()})]}):null,Kt.lastSkippedAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastSkippedAt")}),o.jsxs("dd",{children:[new Date(Kt.lastSkippedAt).toLocaleString(),Kt.lastSkipReason?` · ${Kt.lastSkipReason}`:""]})]}):null,Kt.lastRunUuid?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastRun")}),o.jsx("dd",{children:Kt.lastRunUuid})]}):null,Kt.lastExitCode!=null?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastExit")}),o.jsx("dd",{children:String(Kt.lastExitCode)})]}):null,Kt.lastFinishedAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastFinishedAt")}),o.jsx("dd",{children:new Date(Kt.lastFinishedAt).toLocaleString()})]}):null]}),Bt!=null&&Bt.lastError||Kt.lastError?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:(Bt==null?void 0:Bt.lastError)||Kt.lastError}):null,u.archived||bi(u.source)?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.readonlyNote")}):null,wl?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:wl}):null,bl?o.jsx("p",{className:"af-pipeline-drawer-muted",children:bl}):null,o.jsx("button",{type:"button",className:"af-btn-secondary",disabled:Ti||u.archived||bi(u.source),onClick:ky,children:e(Ti?"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:[Et.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:u.id})]}),yn?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("common:common.loading")}):Ue?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:Ue}):vd.length===0?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:pipeline.noRuns")}):o.jsxs(o.Fragment,{children:[ds.success+ds.failed+ds.running+ds.stopped+ds.interrupted>0?o.jsxs("div",{className:"af-exec-history-summary","aria-label":e("flow:history.summary"),children:[ds.success>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--success",children:e("flow:history.successCount",{count:ds.success})}):null,ds.failed>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--failed",children:e("flow:history.failedCount",{count:ds.failed})}):null,ds.stopped>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--stopped",children:e("flow:history.stoppedCount",{count:ds.stopped})}):null,ds.interrupted>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--interrupted",children:e("flow:history.interruptedCount",{count:ds.interrupted})}):null,ds.running>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--running",children:e("flow:history.runningCount",{count:ds.running})}):null]}):null,o.jsx("ul",{className:"af-exec-history-list",children:vd.map((w,j)=>{const B=w.status||"unknown",q=B==="success"?"af-exec-history-card--success":B==="failed"?"af-exec-history-card--failed":B==="stopped"?"af-exec-history-card--stopped":B==="interrupted"?"af-exec-history-card--interrupted":B==="running"?"af-exec-history-card--running":"af-exec-history-card--unknown",Y=e(B==="success"?"flow:history.success":B==="failed"?"flow:history.failed":B==="stopped"?"flow:history.stopped":B==="interrupted"?"flow:history.interrupted":B==="running"?"flow:history.running":"flow:history.unknown"),J=B==="success"?"check_circle":B==="failed"?"error":B==="stopped"?"stop_circle":B==="interrupted"?"sync_disabled":B==="running"?"progress_activity":"help",te=w.runId||`${w.at}-${j}`,ne=w.runId!=null&&w.runId.length>=6?e("flow:history.runLabel",{id:w.runId.length>8?w.runId.slice(-8):w.runId}):e("flow:history.runLabel",{id:vd.length-j});return o.jsx("li",{className:"af-exec-history-list-item",children:o.jsxs("button",{type:"button",className:`af-exec-history-card ${q}`,onClick:()=>jR(w),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:ne}),o.jsx("span",{className:"af-exec-history-card-time",children:Gw(w.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:J}),Y]}),o.jsxs("span",{className:"af-exec-history-card-duration",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"timer"}),RO(w.durationMs,e)]})]})]})},`${u.id}-${te}`)})})]})]})})]})}):null]}),o.jsx(qj,{open:wR,title:e("flow:run.pauseTitle",{defaultValue:"暂停运行"}),message:e("flow:run.pauseConfirm"),confirmLabel:e("flow:run.pauseConfirmOk",{defaultValue:"暂停"}),onConfirm:vR,onCancel:()=>jy(!1)}),o.jsx(qj,{open:kR,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:NR,onSecondary:SR,onCancel:()=>eh(!1)}),o.jsx(UT,{open:Bn,onClose:()=>io(!1)}),TR(),o.jsx(KT,{open:On,onClose:()=>Ip(!1),onJump:Gs,nodes:Et}),o.jsx(s7,{open:ws,onClose:()=>Oo(!1),flowId:(u==null?void 0:u.id)??""}),o.jsx(WT,{open:z,onClose:()=>P(!1),flowId:(u==null?void 0:u.id)??"",flowSource:(u==null?void 0:u.source)??"user",onArchived:async()=>{P(!1),await rr(),n("/projects?tab=archived")}}),o.jsx(VT,{open:L&&!!(u!=null&&u.id),onClose:()=>E(!1),flowId:(u==null?void 0:u.id)??"",flowSource:(u==null?void 0:u.source)??"user",flowArchived:!!(u!=null&&u.archived),onDeleted:async()=>{E(!1),p(null),kt([]),Xt([]),Ll(null),await rr(),n("/projects")}}),on&&Fr.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:()=>an(!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:Yt.name,onChange:w=>{const j=w.target.value;En(B=>({...B,name:j,id:B.id?B.id:j.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:Yt.id,onChange:w=>En(j=>({...j,id:w.target.value})),placeholder:"pr-check-snippet"})]}),o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"说明"}),o.jsx("textarea",{value:Yt.description,onChange:w=>En(j=>({...j,description:w.target.value})),placeholder:"这段流程适合什么场景、需要接哪些上下游。",rows:4})]}),o.jsxs("div",{className:"af-flow-snippet-summary",children:["将发布 ",Or.length," 个节点和 ",th.length," 条内部连线。"]}),ke?o.jsx("div",{className:"af-flow-snippet-error",children:ke}):null]}),o.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>an(!1),children:"取消"}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:hn||!Yt.name.trim(),onClick:()=>void ER(),children:hn?"发布中…":"发布"})]})]})}),document.body),o.jsx(LK,{open:!!X,onClose:()=>ee(null),flowId:(u==null?void 0:u.id)??"",flowSource:(u==null?void 0:u.source)??"user",flowArchived:!!(u!=null&&u.archived),filePath:(X==null?void 0:X.filePath)??"",fileName:(X==null?void 0:X.fileName)??"",onSaved:()=>{ot(w=>({...w}))}})]}),kr&&Ie!=="edit"&&Fr.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:kr.instanceId})]}),o.jsx("div",{className:"af-user-check-modal__actions",children:kc?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(!kr||!u||!xn)return;const w=ui||kr.content;try{(await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source??"user",action:"save-user-check-content",runUuid:xn,instanceId:kr.instanceId,content:w})})).ok?(Sl(B=>B&&{...B,content:w}),zo(!1),ht(B=>[...B,{ts:new Date().toISOString(),type:"info",text:e("flow:userCheck.contentSaved")}])):ht(B=>[...B,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}catch{ht(j=>[...j,{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:()=>{Ri(kr.content),zo(!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:()=>zo(!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:()=>Sl(null),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]})})]}),o.jsx("div",{className:"af-user-check-modal__body",children:kc?o.jsx("textarea",{ref:sd,className:"af-user-check-modal__textarea",value:ui||kr.content,onChange:w=>Ri(w.target.value)}):o.jsx("div",{className:"af-user-check-modal__preview",children:o.jsx("pre",{children:ui||kr.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:ka,onChange:w=>Ho(w.target.value),disabled:Nl}),o.jsxs("button",{type:"button",className:"af-user-check-modal__btn af-user-check-modal__btn--ai",disabled:Nl||!ka.trim(),onClick:()=>{!kr||!u||!xn||!ka.trim()||(jl(!0),ht(w=>[...w,{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:u.id,flowSource:u.source??"user",action:"ai-edit-user-check-content",runUuid:xn,instanceId:kr.instanceId,content:ui||kr.content,prompt:ka})}).then(w=>w.json()).then(w=>{jl(!1),w.ok&&w.content?(Ri(w.content),zo(!0),Ho(""),ht(j=>[...j,{ts:new Date().toISOString(),type:"info",text:e("flow:userCheck.aiEditDone")}])):ht(j=>[...j,{ts:new Date().toISOString(),type:"error",text:w.error||e("flow:userCheck.aiEditFailed")}])}).catch(()=>{jl(!1),ht(w=>[...w,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.aiEditFailed")}])}))},children:[Nl?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(!kr||!u||!xn)return;const w=ui||kr.content;try{(await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source??"user",action:"save-user-check-content",runUuid:xn,instanceId:kr.instanceId,content:w})})).ok?(await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source??"user",action:"confirm-user-check",runUuid:xn,instanceId:kr.instanceId,execId:kr.execId})}),Sl(null),Ho(""),fo({runUuid:xn})):ht(B=>[...B,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}catch{ht(j=>[...j,{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),di&&Ie!=="edit"&&Fr.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:di.instanceId})]}),o.jsx("div",{className:"af-user-ask-modal__actions",children:o.jsx("button",{type:"button",className:"af-user-ask-modal__btn",onClick:()=>Lr(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:[di.question.trim()?o.jsx("div",{className:"af-user-ask-modal__question",children:o.jsx("pre",{children:di.question})}):null,di.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:di.options.map(w=>o.jsxs("button",{type:"button",className:"af-user-ask-option",disabled:id,onClick:async()=>{if(!(!di||!u||!xn)){fi(!0);try{(await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source??"user",action:"confirm-user-ask",runUuid:xn,instanceId:di.instanceId,execId:di.execId,branch:w.name,selectedIndex:w.index,selectedLabel:w.label})})).ok?(Lr(null),fi(!1),fo({runUuid:xn})):(fi(!1),ht(B=>[...B,{ts:new Date().toISOString(),type:"error",text:e("flow:userAsk.submitFailed")}]))}catch{fi(!1),ht(j=>[...j,{ts:new Date().toISOString(),type:"error",text:e("flow:userAsk.submitFailed")}])}}},children:[o.jsxs("span",{className:"af-user-ask-option__index",children:["[",w.index,"]"]}),o.jsx("span",{className:"af-user-ask-option__label",children:w.label})]},w.name))})]}),o.jsx("div",{className:"af-user-ask-modal__foot",children:o.jsx("span",{className:"af-user-ask-modal__hint",children:e(id?"flow:userAsk.submitting":"flow:userAsk.hint")})})]})}),document.body),Sa&&Ie!=="edit"&&o.jsxs("div",{className:"af-tool-print-toast"+(vs?" 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:Sa.instanceId})}),o.jsx("button",{type:"button",className:"af-tool-print-toast__close",onClick:()=>od(w=>!w),"aria-label":e(vs?"flow:toolPrint.restore":"flow:toolPrint.expand"),title:e(vs?"flow:toolPrint.restore":"flow:toolPrint.expand"),children:o.jsx("span",{className:"material-symbols-outlined",children:vs?"close_fullscreen":"open_in_full"})}),o.jsx("button",{type:"button",className:"af-tool-print-toast__close",onClick:()=>Bo(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(vp,{children:Sa.content})})})]}),Xr&&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:Xr.label}),o.jsx("button",{type:"button",className:"af-provide-edit-modal__close",onClick:()=>Na(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:pi,className:"af-provide-edit-modal__textarea",defaultValue:Xr.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:he,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:()=>Na(null),children:[o.jsx("span",{className:"material-symbols-outlined",children:"close"}),e("flow:provideEdit.cancel")]})]})]})}),Me&&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:()=>Ke(!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:A.length===0?o.jsx("div",{className:"af-run-params-empty",children:e("flow:runParams.noParams")}):o.jsx("div",{className:"af-run-params-list",children:A.map(w=>{var ye,be;const j=U[w.id];if(!j)return null;const B=((ye=w.data)==null?void 0:ye.definitionId)||"",q=B.startsWith("provide_file"),Y=B==="provide_bool",J=((be=w.data)==null?void 0:be.label)||w.id,te=en[j]??"",ne=["true","1","yes","on"].includes(String(te).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"+(q?" af-run-params-item__icon--file":""),children:q?"description":Y?"toggle_on":"text_fields"}),o.jsx("span",{className:"af-run-params-item__label",children:J}),o.jsx("span",{className:"af-run-params-item__slot",children:j})]}),Y?o.jsx("button",{type:"button",className:"af-run-config-bool-toggle"+(ne?" af-run-config-bool-toggle--true":""),onClick:()=>Mt(ze=>({...ze,[j]:ne?"false":"true"})),"aria-pressed":ne,children:ne?"true":"false"}):o.jsx("input",{type:"text",className:"af-run-params-item__input",value:te,onChange:ze=>Mt(de=>({...de,[j]:ze.target.value})),placeholder:e(q?"flow:runConfig.filePathPlaceholder":"flow:runConfig.stringValuePlaceholder")})]},w.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 j;const w={};for(const B of A){const q=U[B.id];if(!q)continue;const Y=((j=B.data)==null?void 0:j.definitionId)||"",J=en[q]??"";Y.startsWith("provide_file")?w[q]={type:"file",path:J}:w[q]={type:"str",value:J}}Ke(!1),Le(!1),fo({cliInputsOverride:w})},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:()=>Ke(!1),children:[o.jsx("span",{className:"material-symbols-outlined",children:"close"}),e("flow:runParams.cancel")]})]})]})})]})]})}const z7="modulepreload",H7=function(e){return"/"+e},k1={},B7=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=Promise.allSettled(n.map(c=>{if(c=H7(c),c in k1)return;k1[c]=!0;const d=c.endsWith(".css"),f=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const u=document.createElement("link");if(u.rel=d?"stylesheet":z7,d||(u.as="script"),u.crossOrigin="",u.href=c,l&&u.setAttribute("nonce",l),document.head.appendChild(u),d)return new Promise((p,m)=>{u.addEventListener("load",p),u.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return s.then(a=>{for(const l of a||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})},W7=new Set(["echarts"]),V7=new Set(["line","bar","pie","scatter","radar","heatmap","tree","treemap","sunburst","sankey","graph","gauge","funnel"]),U7=new Set(["onclick","ondblclick","onmousedown","onmouseup","onmouseover","onmouseout","onmousemove","onmouseenter","onmouseleave","oncontextmenu","onkeydown","onkeyup","onkeypress","onload","onerror"]),K7=["#7c9cff","#a8e66f","#ffcf5c","#68d8d6","#ff8fb3","#b79cff","#f59e73","#8bd17c"];function ol(e){return e&&typeof e=="object"&&!Array.isArray(e)}function mc(e,t){if(!ol(e))return{...t};const n={...e};for(const[r,s]of Object.entries(t))n[r]==null?n[r]=s:ol(n[r])&&ol(s)&&(n[r]=mc(n[r],s));return n}function uy(e,t){return e==null?e:Array.isArray(e)?e.map(n=>ol(n)?mc(n,t):n):ol(e)?mc(e,t):e}function q7(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 $b(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)=>$b(n,`${t}[${r}]`));return}if(typeof e=="object")for(const[n,r]of Object.entries(e)){if(/^on[A-Z]/.test(n)||U7.has(n.toLowerCase()))throw new Error(`${t}.${n} is not allowed`);$b(r,`${t}.${n}`)}}}function Y7(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(!V7.has(r))throw new Error(`series.type "${r||"(empty)"}" is not allowed`)}return t}function G7(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:mc(e,t)}function X7(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(!ol(r))return r;const i=s===0&&t&&r.text==null?{...r,text:t}:r;return mc(i,n)}):ol(e)?mc(t&&e.text==null?{...e,text:t}:e,n):t?{...n,text:t}:e}function J7(e,t){const n={top:t?42:14,textStyle:{color:"rgba(255, 255, 255, 0.72)"},itemGap:14};return e==null?e:uy(e,n)}function S1(e,t="rgba(255, 255, 255, 0.62)"){return uy(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 Q7(e,t){const n={left:52,right:42,top:t?78:42,bottom:42,containLabel:!0};return e==null?n:uy(e,n)}function Z7(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:uy(e,t)}function eq(e,t,n){const r=X7(e.title,n),s=!!(Array.isArray(r)?r:[r]).filter(Boolean).some(a=>ol(a)&&a.text),i=e.legend!=null&&e.legend!==!1;return{...e,backgroundColor:e.backgroundColor??"transparent",color:e.color??K7,textStyle:mc(e.textStyle,{color:"rgba(255, 255, 255, 0.78)"}),title:r,tooltip:G7(e.tooltip),legend:J7(e.legend,s),grid:e.xAxis!=null||e.yAxis!=null?Q7(e.grid,s||i):e.grid,xAxis:S1(e.xAxis),yAxis:S1(e.yAxis),radar:Z7(e.radar),series:t}}function tq(e){const t=q7(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(!W7.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");$b(n);const r=Y7(n.option.series),s=n.title==null?"":String(n.title),i=eq(n.option,r,s);return{ok:!0,spec:{...n,title:s,option:i}}}catch(n){return{ok:!1,error:String((n==null?void 0:n.message)||n)}}}function sa(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 a2(e){const t=sa(e);return t.length>1&&t.every(n=>/^:?-{3,}:?$/.test(n))}function l2(e){return sa(e).map(t=>t.startsWith(":")&&t.endsWith(":")?"center":t.endsWith(":")?"right":"left")}function nq(e){return/^\s*(sequenceDiagram|flowchart\s+(?:TD|TB|BT|LR|RL)|graph\s+(?:TD|TB|BT|LR|RL))\b/i.test(String(e||""))}function rq(e){const t=String(e||"").split(/\r?\n/).map(l=>l.replace(/%%.*$/,"").trim()).filter(Boolean),n=new Map,r=[];let s="TD";const i=(l,c="")=>{const d=String(l||"").replace(/[^A-Za-z0-9_]/g,"_")||`N${n.size+1}`;return n.has(d)?c&&(n.get(d).label=c):n.set(d,{id:d,label:c||d}),d},a=l=>{const c=String(l||"").trim().replace(/[;,]+$/,""),d=c.match(/^([A-Za-z][A-Za-z0-9_]*)(?:\[(.+?)\]|\((.+?)\)|\{(.+?)\})?$/);return d?i(d[1],d[2]||d[3]||d[4]||d[1]):i(c.replace(/[^A-Za-z0-9_]/g,"_"),c)};for(const l of t){const c=l.match(/^(graph|flowchart)\s+(TD|TB|BT|LR|RL)\b/i);if(c){s=c[2].toUpperCase();continue}const 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 sq({code:e}){const t=h.useMemo(()=>rq(e),[e]),n=t.direction==="LR"||t.direction==="RL",r=150,s=46,i=n?102:38,a=n?34:72,l=new Map;t.nodes.forEach((f,u)=>{l.set(f.id,{x:28+(n?u*(r+i):u%3*(r+i)),y:28+(n?u%3*(s+a):u*(s+a))})});const c=Math.max(520,...Array.from(l.values()).map(f=>f.x+r+28)),d=Math.max(220,...Array.from(l.values()).map(f=>f.y+s+28));return o.jsxs("svg",{viewBox:`0 0 ${c} ${d}`,role:"img","aria-label":"Mermaid flowchart preview",children:[o.jsx("defs",{children:o.jsx("marker",{id:"af-md-mermaid-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:o.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z"})})}),t.edges.map((f,u)=>{const p=l.get(f.from),m=l.get(f.to);if(!p||!m)return null;const y=n?`M ${p.x+r} ${p.y+s/2} C ${(p.x+m.x+r)/2} ${p.y+s/2}, ${(p.x+m.x+r)/2} ${m.y+s/2}, ${m.x} ${m.y+s/2}`:`M ${p.x+r/2} ${p.y+s} C ${p.x+r/2} ${p.y+s+28}, ${m.x+r/2} ${m.y-28}, ${m.x+r/2} ${m.y}`;return o.jsx("path",{className:"af-md-mermaid-edge",d:y,markerEnd:"url(#af-md-mermaid-arrow)"},`${f.from}-${f.to}-${u}`)}),t.nodes.map(f=>{const u=l.get(f.id);return o.jsxs("g",{children:[o.jsx("rect",{className:"af-md-mermaid-box",x:u.x,y:u.y,width:r,height:s,rx:"8"}),o.jsx("text",{className:"af-md-mermaid-text",x:u.x+r/2,y:u.y+s/2+5,textAnchor:"middle",children:f.label.slice(0,24)})]},f.id)})]})}function iq(e){const t=String(e||"").split(/\r?\n/).map(i=>i.replace(/%%.*$/,"").trim()).filter(Boolean),n=new Map,r=[],s=(i,a="")=>{const l=String(i||"").trim();l&&(n.has(l)||n.set(l,a||l))};for(const i of t){if(/^sequenceDiagram\b/i.test(i))continue;const a=i.match(/^(participant|actor)\s+([A-Za-z0-9_]+)(?:\s+as\s+(.+))?$/i);if(a){s(a[2],a[3]||a[2]);continue}const l=i.match(/^([A-Za-z0-9_]+)\s*[-=]+>>\+?\s*([A-Za-z0-9_]+)\s*:\s*(.+)$/);if(l){s(l[1]),s(l[2]),r.push({type:"message",from:l[1],to:l[2],text:l[3]});continue}const c=i.match(/^note\s+(?:over|right of|left of)\s+([^:]+):\s*(.+)$/i);r.push({type:"note",text:c?c[2]:i})}return{participants:Array.from(n,([i,a])=>({id:i,label:a})),rows:r}}function oq({code:e}){const t=h.useMemo(()=>iq(e),[e]),n=t.participants.length?t.participants:[{id:"A",label:"A"},{id:"B",label:"B"}],r=190,s=48,i=26,a=44,l=48,c=Math.max(620,s*2+n.length*r),d=Math.max(220,i+a+Math.max(1,t.rows.length)*l+34),f=u=>{const p=Math.max(0,n.findIndex(m=>m.id===u));return s+p*r+r/2};return o.jsxs("svg",{viewBox:`0 0 ${c} ${d}`,role:"img","aria-label":"Mermaid sequence diagram preview",children:[o.jsx("defs",{children:o.jsx("marker",{id:"af-md-sequence-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:o.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z"})})}),n.map((u,p)=>{const m=s+p*r+r/2;return o.jsxs("g",{children:[o.jsx("rect",{className:"af-md-mermaid-box",x:m-68,y:i,width:"136",height:"34",rx:"8"}),o.jsx("text",{className:"af-md-mermaid-text",x:m,y:i+22,textAnchor:"middle",children:u.label.slice(0,18)}),o.jsx("line",{className:"af-md-sequence-life",x1:m,y1:i+a,x2:m,y2:d-18})]},u.id)}),t.rows.map((u,p)=>{const m=i+a+p*l+24;if(u.type!=="message")return o.jsxs("g",{children:[o.jsx("rect",{className:"af-md-sequence-note",x:s,y:m-17,width:c-s*2,height:"30",rx:"7"}),o.jsx("text",{className:"af-md-mermaid-text",x:s+12,y:m+4,children:u.text.slice(0,120)})]},`note-${p}`);const y=f(u.from),b=f(u.to),k=(y+b)/2;return o.jsxs("g",{children:[o.jsx("line",{className:"af-md-mermaid-edge",x1:y,y1:m,x2:b,y2:m,markerEnd:"url(#af-md-sequence-arrow)"}),o.jsx("text",{className:"af-md-sequence-label",x:k,y:m-8,textAnchor:"middle",children:u.text.slice(0,72)})]},`msg-${p}`)})]})}function c2({code:e}){const t=String(e||"").trim();if(!t)return null;const n=/^sequenceDiagram\b/i.test(t);return o.jsx("div",{className:"af-md-mermaid-preview",children:n?o.jsx(oq,{code:t}):o.jsx(sq,{code:t})})}function aq(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]||"",c=l.match(/^\s*```\s*(mermaid|mmd)\s*$/i);if(!s&&c){i();const d=[];for(a++;a<t.length&&!/^\s*```\s*$/.test(t[a]||"");)d.push(t[a]||""),a++;a<t.length&&a++,n.push({type:"mermaid",text:d.join(`
|
|
140
|
+
`)});continue}if(!s&&nq(l)){i();const d=[];for(;a<t.length;){const f=t[a]||"";if(d.length>0&&(!f.trim()||/^-{3,}\s*$/.test(f)||/^#{1,6}\s+/.test(f)))break;d.push(f),a++}n.push({type:"mermaid",text:d.join(`
|
|
141
|
+
`)});continue}if(/^\s*```/.test(l)){s=!s,r.push(l),a++;continue}if(!s&&a+1<t.length&&sa(l).length>1&&a2(t[a+1])){i();const d=sa(l),f=l2(t[a+1]),u=[];for(a+=2;a<t.length&&t[a].trim()&&sa(t[a]).length>1;)u.push(sa(t[a])),a++;n.push({type:"table",headers:d,align:f,rows:u});continue}r.push(l),a++}return i(),n}function N1(e,t=""){const n=String(e||"").trim();if(!n||/^(?:https?:|data:|blob:|file:|javascript:|mailto:|tel:)/i.test(n)||n.startsWith("/")||n.startsWith("#")||!t||n.startsWith("outputs/"))return n;const r=String(t||"").split("/").filter(Boolean);r.pop();const s=[...r,...n.split("/")].filter(Boolean),i=[];for(const a of s)if(a!=="."){if(a===".."){if(i.length===0)return n;i.pop();continue}i.push(a)}return i.join("/")}function u2(e,t=!1,n=""){const r=s=>{const i=String(s||"").trim();if(!i)return"";if(/^(?:https?:|data:|blob:|file:|javascript:|mailto:|tel:)/i.test(i)||i.startsWith("#"))return i;const a=N1(i,n);return e?e(a,{kind:"link",download:!0}):a};return{...t?{p:({children:s})=>o.jsx(o.Fragment,{children:s})}:{},code:({inline:s,className:i,children:a})=>{var d;const l=((d=String(i||"").match(/language-(\w+)/i))==null?void 0:d[1])||"",c=String(a||"").replace(/\n$/,"");return!s&&/^(mermaid|mmd)$/i.test(l)?o.jsx(c2,{code:c}):s?o.jsx("code",{className:i,children:a}):o.jsx("code",{className:i,children:a})},img:({src:s,alt:i})=>o.jsx("img",{src:e?e(N1(s,n)):s||"",alt:i||"",loading:"lazy"}),a:({href:s,children:i})=>o.jsx("a",{href:r(s),target:"_blank",rel:"noopener noreferrer",children:i})}}function j1({children:e,resolveSrc:t,basePath:n=""}){return o.jsx(vp,{components:u2(t,!0,n),children:String(e||"")})}function M0({content:e,resolveSrc:t,basePath:n=""}){const r=h.useMemo(()=>aq(e),[e]),s=h.useMemo(()=>u2(t,!1,n),[n,t]);return o.jsx(o.Fragment,{children:r.map((i,a)=>i.type==="mermaid"?o.jsx(c2,{code:i.text},`mermaid-${a}`):i.type!=="table"?o.jsx(vp,{components:s,children:i.text},`md-${a}`):o.jsx("div",{className:"af-work-display-table-wrap",children:o.jsxs("table",{className:"af-work-display-table",children:[o.jsx("thead",{children:o.jsx("tr",{children:i.headers.map((l,c)=>o.jsx("th",{style:{textAlign:i.align[c]||"left"},children:o.jsx(j1,{resolveSrc:t,basePath:n,children:l})},c))})}),o.jsx("tbody",{children:i.rows.map((l,c)=>o.jsx("tr",{children:i.headers.map((d,f)=>o.jsx("td",{style:{textAlign:i.align[f]||"left"},children:o.jsx(j1,{resolveSrc:t,basePath:n,children:l[f]||""})},f))},c))})]})},`table-${a}`))})}function lq(e,t=","){const n=[];let r=[],s="",i=!1;const a=String(e||"").replace(/\r\n/g,`
|
|
142
|
+
`);for(let l=0;l<a.length;l+=1){const c=a[l],d=a[l+1];if(i){c==='"'&&d==='"'?(s+='"',l+=1):c==='"'?i=!1:s+=c;continue}c==='"'?i=!0:c===t?(r.push(s.trim()),s=""):c===`
|
|
143
|
+
`?(r.push(s.trim()),n.push(r),r=[],s=""):s+=c}return(s||r.length)&&(r.push(s.trim()),n.push(r)),n.filter(l=>l.some(c=>String(c||"").trim()))}function mo(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 cq(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=>mo(i[a])))}}if(e.every(Array.isArray)&&e.length>0){const s=e[0].map((i,a)=>mo(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)=>mo(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:mo(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:mo(s)||`Column ${i+1}`,align:"left"})),{columns:r,rows:n.slice(1).map(s=>r.map((i,a)=>mo(s[a])))}):{columns:r,rows:n.map(s=>Array.isArray(s)?r.map((i,a)=>mo(s[a])):s&&typeof s=="object"?r.map(i=>mo(s[i.key])):r.map((i,a)=>a===0?mo(s):""))}}function uq(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=cq(JSON.parse(r));if(l&&l.columns.length)return{...l,error:""}}catch{}const s=r.replace(/\r\n/g,`
|
|
144
|
+
`).split(`
|
|
145
|
+
`).filter(l=>l.trim());if(s.length>=2&&sa(s[0]).length>1&&a2(s[1])){const l=sa(s[0]),c=l2(s[1]);return{columns:l.map((d,f)=>({key:String(f),label:d,align:c[f]||"left"})),rows:s.slice(2).map(d=>sa(d)),error:""}}const i=r.includes(" ")?" ":",",a=lq(r,i);return a.length>0&&a[0].length>1?{columns:a[0].map((c,d)=>c||`Column ${d+1}`).map((c,d)=>({key:String(d),label:c,align:"left"})),rows:a.slice(1),error:""}:{columns:[],rows:[],error:"No table data detected"}}function O0({content:e}){const t=h.useMemo(()=>uq(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:mo(n[i])},`${s.key}-${i}`))},r))})]})})}function $0({content:e}){const t=h.useRef(null),n=h.useMemo(()=>tq(e),[e]),[r,s]=h.useState({loading:!1,error:""});return h.useEffect(()=>{if(!n.ok){s({loading:!1,error:n.error||"Invalid chart spec"});return}let i=!1,a=null,l=null,c=null;return s({loading:!0,error:""}),B7(()=>import("./index-DgQRkS4v.js"),[]).then(d=>{i||!t.current||(a=d.init(t.current,"dark",{renderer:"canvas"}),a.setOption(n.spec.option,!0),c=()=>a==null?void 0:a.resize(),typeof ResizeObserver<"u"&&(l=new ResizeObserver(c),l.observe(t.current)),window.addEventListener("resize",c),window.requestAnimationFrame(c),i||s({loading:!1,error:""}))}).catch(d=>{i||s({loading:!1,error:String((d==null?void 0:d.message)||d)})}),()=>{var d,f;i=!0,c&&window.removeEventListener("resize",c),(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]})}const dq="af:workspace-graph:v2",Vc=["DISPLAY","CONTROL","TOOL","PROVIDE","AGENT"],fq=new Set(["control_start","control_end","control_load_skills","control_load_mcp"]),pq={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:""}]},hq={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}]},mq={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}]},gq=new Set(["png","jpg","jpeg","gif","webp","svg"]),yq=320,d2=180,f2=960,Db=96,p2=900,Fb="display-ref:",xq="0.1.64";function wq(){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 xo(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 gg(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 gq.has(n)}function yg(e,t,n={}){const r=String(e||"").trim();if(!r)return"";if(/^(?:https?:|data:|blob:|file:)/i.test(r)||r.startsWith("/"))return r;const s=xo(t||{});return s.set("path",r),n.download&&s.set("download","1"),`/api/workspace/file/raw?${s.toString()}`}function bq(e,t){const n=String(e||"").trim();if(!n)return"";const r=xo(t||{});return r.set("path",n),r.set("download","1"),`/api/workspace/file/raw?${r.toString()}`}function vq(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 kq(e){return!e||typeof e.closest!="function"?!1:!!e.closest("input, textarea, select, [contenteditable='true']")}function Sq(e){var t;if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)return Number(e.selectionStart??0)!==Number(e.selectionEnd??0);if(e instanceof Element&&e.closest('[contenteditable="true"]')){const n=(t=window.getSelection)==null?void 0:t.call(window);return!!(n&&!n.isCollapsed)}return!1}function Nq(e){return!e||typeof e.closest!="function"?!1:!!e.closest(".af-flow-node__prompt-stack")&&!Sq(e)}function jq(e){const t=String(e||"").trim();if(!t)return"";if(/^运行完成/.test(t))return"运行完成";if(/^运行暂停/.test(t))return"运行暂停";if(/^运行停止/.test(t))return"运行停止";if(/^思考中/.test(t))return"模型正在思考";if(/^生成回复中/.test(t))return"模型正在生成回复";if(/^Timing\s+(.+?):\s+(\d+)ms/i.test(t)){const n=t.match(/^Timing\s+(.+?):\s+(\d+)ms/i);return`耗时:${(n==null?void 0:n[1])||"step"} ${(n==null?void 0:n[2])||"0"}ms`}if(/^工具\s+(.+?)(?:\s+\((started|completed)\))?$/i.test(t)){const n=t.match(/^工具\s+(.+?)(?:\s+\((started|completed)\))?$/i),r=String((n==null?void 0:n[1])||"tool").trim(),s=String((n==null?void 0:n[2])||"").toLowerCase();if(r==="thinking")return"模型正在思考";const i=r==="readToolCall"?"读取文件/上下文":r==="grepToolCall"?"搜索代码":r==="editToolCall"?"编辑文件":r;return s==="completed"?`完成:${i}`:`执行:${i}`}return/^\[stderr\]/.test(t)?t:""}function C1(e){const t=Math.max(0,Number(e)||0);if(t<1e3)return`${t}ms`;if(t<6e4)return`${(t/1e3).toFixed(t<1e4?1:0)}s`;const n=Math.floor(t/6e4),r=Math.round(t%6e4/1e3);return`${n}m${r?`${r}s`:""}`}function Cq(e,t){const n=typeof e=="string"?e:String((e==null?void 0:e.text)||""),r=typeof e=="object"?Number(e==null?void 0:e.stepMs):NaN,s=typeof e=="object"?Number(e==null?void 0:e.totalMs):NaN,i=Number.isFinite(r)&&Number.isFinite(s)?`(+${C1(r)} / 总 ${C1(s)})`:"";return`${t+1}. ${n}${i}`}function E1(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 h2(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 m2(e){const t=String((e==null?void 0:e.marketplaceDefinitionId)||(e==null?void 0:e.id)||"").trim();return t.startsWith("marketplace:")?t:""}function D0(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 Qd(e){const t=String(D0(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 _1(e){return e==="DISPLAY"?"preview":e==="CONTROL"?"account_tree":e==="TOOL"?"build":e==="PROVIDE"?"database":"smart_toy"}function xg(e){return String((e==null?void 0:e.displayName)||(e==null?void 0:e.label)||(e==null?void 0:e.id)||"Node")}function Zd(e){return xg(e)}function zb(e){return String((e==null?void 0:e.description)||(e==null?void 0:e.body)||"").replace(/\s+/g," ").trim()}function Fx(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 P1(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 A1(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 I1(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=zu(s.get(n),e.sourceHandle||"output-0","source"),a=zu(s.get(r),e.targetHandle||"input-0","target");return!!(i&&a&&Fu(i,a))}function Eq(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=zu(i,r,s);return a?{nodeId:n,handleId:r,handleType:s,slot:a,slotType:zT(a)}:null}function _q(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"?Fu(t.slot,a):Fu(a,t.slot)))continue;const c=Qd(n);return{def:n,order:r,category:c,categoryRank:Vc.indexOf(c),slot:a,slotIndex:i,displayLabel:Zd(n),description:zb(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 ef(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 Pq(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 Aq(e){return(e==null?void 0:e.default)!=null?String(e.default):(e==null?void 0:e.value)!=null?String(e.value):""}function Bh(e){return(Array.isArray(e)?e:[]).map(t=>({type:(t==null?void 0:t.type)||"node",name:(t==null?void 0:t.name)||"",default:Aq(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 g2(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 Iq(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[g2(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 zx(e,t){var u,p;const n=e!=null&&e.instances&&typeof e.instances=="object"?e.instances:{},r=x2(n),s=Array.isArray(e==null?void 0:e.edges)?e.edges:[],i=(u=e==null?void 0:e.ui)!=null&&u.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 m of s)m!=null&&m.source&&l.add(String(m.source)),m!=null&&m.target&&l.add(String(m.target));const d=Array.from(l).map(m=>{const y=r[m]||{},b=y.definitionId||m,k=t.find(H=>H.id===b),g=D0(k)||b,v=t.find(H=>H.id===g)||k,x=y.marketplaceRef||m2(k),N=i[m]&&typeof i[m].x=="number"&&typeof i[m].y=="number"?i[m]:{x:320+l.size*20,y:180+l.size*12},_=!!Kn(g),C=a[m]&&typeof a[m].width=="number"&&typeof a[m].height=="number"?{width:a[m].width,height:a[m].height}:null,T=bu(C,{display:_});return{id:m,type:Sp,position:N,...T?{width:T.width,height:T.height}:{},data:{label:y.label||xg(k)||xg(v)||m,definitionId:g,...x?{marketplaceRef:x}:{},...k!=null&&k.packageId?{marketplacePackageId:k.packageId}:{},...k!=null&&k.version?{marketplaceVersion:k.version}:{},schemaType:h2(g,v||k),role:y.role||"normal",model:y.model||void 0,body:y.body||"",script:y.script||"",...T?{nodeSize:T}:{},..._&&T?{displaySize:T}:{}}}}).map(m=>tp(m,r,t)),f=s.filter(m=>(m==null?void 0:m.source)&&(m==null?void 0:m.target)).map((m,y)=>({id:m.id||`we-${m.source}-${m.target}-${y}`,source:String(m.source),target:String(m.target),sourceHandle:m.sourceHandle??void 0,targetHandle:m.targetHandle??void 0,markerEnd:{type:$s.ArrowClosed}}));return{nodes:d,edges:DT(f,d),instances:r}}function T1(e){return`${Fb}${e}`}function Hx(e){const t=String(e||"");return t.startsWith(Fb)?t.slice(Fb.length):t}function y2(e){if(!e||typeof e!="object")return null;const t=Number(e.x),n=Number(e.y),r=Number(e.zoom);return!Number.isFinite(t)||!Number.isFinite(n)||!Number.isFinite(r)?null:{x:t,y:n,zoom:Math.min(Math.max(r,.1),4)}}function Hb(e,t=[]){const n=new Map((Array.isArray(t)?t:[]).filter(u=>{var p;return Kn((p=u==null?void 0:u.data)==null?void 0:p.definitionId)}).map(u=>[u.id,u])),r=Array.isArray(e==null?void 0:e.nodeIds)?e.nodeIds:[],s=[],i=new Set;for(const u of r){const p=String(u||"").trim();!p||i.has(p)||!n.has(p)||(i.add(p),s.push(p))}const a={},l=e!=null&&e.nodePositions&&typeof e.nodePositions=="object"?e.nodePositions:{};s.forEach((u,p)=>{const m=l[u];a[u]=m&&typeof m.x=="number"&&typeof m.y=="number"?{x:m.x,y:m.y}:{x:180+p*36,y:120+p*28}});const c={},d=e!=null&&e.nodeSizes&&typeof e.nodeSizes=="object"?e.nodeSizes:{};s.forEach(u=>{const p=bu(d[u],{display:!0});p&&(c[u]=p)});const f=y2(e==null?void 0:e.viewport);return{nodeIds:s,nodePositions:a,nodeSizes:c,...f?{viewport:f}:{}}}function Tq(e,t=[]){return Hb(e,t)}function Rq(e){const t=Number.isFinite(e)?e:1;return Math.min(Math.max(t,.75),1)}async function Lq(e){var n;const t=String(e||"");if(!t)return!1;try{if((n=navigator.clipboard)!=null&&n.writeText)return await navigator.clipboard.writeText(t),!0}catch{}try{const r=document.createElement("textarea");r.value=t,r.setAttribute("readonly",""),r.style.position="fixed",r.style.left="-9999px",r.style.top="0",document.body.appendChild(r),r.focus(),r.select();const s=document.execCommand("copy");return document.body.removeChild(r),s}catch{return!1}}function R1(e,t,n){const r=Number(e);return!Number.isFinite(r)||r<=0?0:Math.min(n,Math.max(t,Math.round(r)))}function bu(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:R1(n,d2,f2)||yq,height:R1(r,Db,p2)||Db}}function Uc(e){var s,i,a,l,c,d,f,u,p,m,y;const t=!!Kn((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)||((c=(l=e==null?void 0:e.data)==null?void 0:l.nodeSize)==null?void 0:c.width)||(e==null?void 0:e.width)||(t?(d=e==null?void 0:e.measured)==null?void 0:d.width:0)||0),r=Number(((u=(f=e==null?void 0:e.data)==null?void 0:f.displaySize)==null?void 0:u.height)||((m=(p=e==null?void 0:e.data)==null?void 0:p.nodeSize)==null?void 0:m.height)||(e==null?void 0:e.height)||(t?(y=e==null?void 0:e.measured)==null?void 0:y.height:0)||0);return bu({width:n,height:r},{display:t})}function Wh(e,t,n){var l,c;const r=x2(kp(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:((c=d.position)==null?void 0:c.y)||0};const f=Uc(d);f&&(a[d.id]=f)}return{version:1,instances:r,edges:s,ui:{nodePositions:i,nodeSizes:a}}}function x2(e){const t={};for(const[n,r]of Object.entries(e||{})){const s=String((r==null?void 0:r.definitionId)||n);if(!!Kn(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 Kn(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 sc(e){const t=[...(e==null?void 0:e.inputs)||[],...(e==null?void 0:e.outputs)||[]],r=Kn(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 Hu(e,t=""){const n=String(e||"").trim();if(!n||n.length>260||/[\r\n<>]/.test(n)||/^(?:https?:|data:|blob:|file:|javascript:|mailto:|tel:)/i.test(n))return"";const r=n.replace(/^\/+/,"");if(r.includes("..")||r.startsWith("."))return"";const s=r.split("?")[0].split("#")[0].toLowerCase().split(".").pop()||"";return({html:new Set(["html","htm"]),markdown:new Set(["md","markdown","txt"]),mermaid:new Set(["mmd","mermaid","txt"]),ascii:new Set(["txt","log"]),chart:new Set(["json"]),table:new Set(["json","csv","tsv"])}[t]||new Set(["html","htm","md","markdown","txt","json","csv","tsv"])).has(s)?r:""}function Mq(e){let t=String(e||"").replace(/\r\n/g,`
|
|
146
|
+
`).trim();return t.includes(`
|
|
147
|
+
`)||(t=t.replace(/\s+(resultFile|result|outParams|outParams\.[A-Za-z_][A-Za-z0-9_-]*)\s*:/g,`
|
|
148
|
+
$1:`).replace(/(^|\n)outParams:\s+([A-Za-z_][A-Za-z0-9_-]*\s*:)/g,`$1outParams:
|
|
149
|
+
$2`)),t}function aa(e){const t=String(e||"").trim();if(!t)return String(e||"");const n=t.match(/---agentflow\b([\s\S]*?)---end/i);if(n!=null&&n[1]){const a=Mq(n[1]),l=a.match(/^resultFile\s*:\s*["']?([^"'\n]+)["']?/m);if(l!=null&&l[1])return l[1].trim();const c=a.match(/^result\s*:\s*(.*)$/m);if(c){const f=String(c[1]||"").trim();return f==="|"||f===">"?a.slice((c.index||0)+c[0].length).split(`
|
|
150
|
+
`).filter(p=>/^\s+/.test(p)||!p.trim()).map(p=>p.replace(/^\s{2}/,"")).join(`
|
|
151
|
+
`).replace(/\s+$/g,""):f.replace(/^["']|["']$/g,"")}const d=t.replace(n[0],"").trim();if(d)return d}if(!/["']result["']\s*:|["']outParams["']\s*:|["']resultFile["']\s*:/i.test(t))return String(e||"");const r=[t],s=t.indexOf("{"),i=t.lastIndexOf("}");s>=0&&i>s&&r.unshift(t.slice(s,i+1));for(const a of r)try{const l=JSON.parse(a);if(l&&typeof l=="object"&&!Array.isArray(l)&&(Object.prototype.hasOwnProperty.call(l,"result")||Object.prototype.hasOwnProperty.call(l,"resultFile"))){const c=l.resultFile||l.result;return typeof c=="string"?c:JSON.stringify(c,null,2)}}catch{}return String(e||"")}async function Bu(e,t){const n=xo(e);n.set("path",t);const r=await fetch(`/api/workspace/file?${n.toString()}`),s=await r.json().catch(()=>({}));if(!r.ok)throw new Error(s.error||`读取文件失败:${t}`);return String(s.content||"")}async function Bb(e,t,n){const r=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e,path:t,content:String(n||"")})}),s=await r.json().catch(()=>({}));if(!r.ok)throw new Error(s.error||`写入文件失败:${t}`);return s.path||t}function Oq(e,t=[],n=[]){const r=String(e||"");if(!r)return"";const s=new Map(t.map(i=>[i.id,i]));return(Array.isArray(n)?n:[]).filter(i=>String((i==null?void 0:i.target)||"")===r).slice(0,4).map(i=>{const a=s.get(String((i==null?void 0:i.source)||""));if(!a)return"";const l=a.data||{},c=String(l.body||"").trim(),d=[`- upstreamId: ${a.id}`,` label: ${String(l.label||a.id).trim()}`,` definitionId: ${String(l.definitionId||"").trim()}`];return c&&d.push(` task: ${c.slice(0,4e3)}`),d.join(`
|
|
152
|
+
`)}).filter(Boolean).join(`
|
|
153
|
+
|
|
154
|
+
`)}function Xu(e){let t=aa(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 $q(e){const t=Xu(e);return t.trim()?/<[^>]*$/g.test(t)?"HTML 内容末尾存在未闭合标签,可能是生成或保存时被截断。":/^(?:<!doctype\b|<html\b)/i.test(t)&&!/<\/html\s*>/i.test(t)?"完整 HTML 文档缺少 </html> 结束标签,可能是生成或保存时被截断。":"":""}function Ql(e,t){return e==="html"?$q(t):""}function w2(e){const t=Xu(e);if(!t.trim())return"";const n=`<base target="_self"><script>
|
|
155
|
+
(() => {
|
|
156
|
+
document.addEventListener("click", (event) => {
|
|
157
|
+
const link = event.target && event.target.closest ? event.target.closest("a[href]") : null;
|
|
158
|
+
if (!link) return;
|
|
159
|
+
const rawHref = String(link.getAttribute("href") || "").trim();
|
|
160
|
+
if (!rawHref || rawHref.startsWith("#")) return;
|
|
161
|
+
if (/^(?:javascript|mailto|tel):/i.test(rawHref)) return;
|
|
162
|
+
event.preventDefault();
|
|
163
|
+
window.location.href = link.href;
|
|
164
|
+
}, true);
|
|
165
|
+
})();
|
|
166
|
+
<\/script>`;return/<script\b[^>]*>\s*\(\(\)\s*=>\s*\{\s*document\.addEventListener\("click"/i.test(t)?t:/<head\b[^>]*>/i.test(t)?t.replace(/<head\b([^>]*)>/i,`<head$1>${n}`):/<html\b[^>]*>/i.test(t)?t.replace(/<html\b([^>]*)>/i,`<html$1><head>${n}</head>`):`<!doctype html><html><head>${n}</head><body>${t}</body></html>`}function Dq(e,t){const n=String(e).trim().replace(/[\\/:*?"<>|]+/g,"-").replace(/\s+/g,"-").replace(/^-+|-+$/g,"")||"html-render",r=String(t).replace(/^\.+/,"")||"png";return`${n}.${r}`}function Fq(e,t){const n=document.createElement("a");n.href=e,n.download=t,document.body.appendChild(n),n.click(),n.remove()}function zq(e,t){const n=URL.createObjectURL(e);try{Fq(n,t)}finally{window.setTimeout(()=>URL.revokeObjectURL(n),1e3)}}function b2(e){var t;try{return(e==null?void 0:e.contentDocument)||((t=e==null?void 0:e.contentWindow)==null?void 0:t.document)||null}catch{return null}}function Hq(e){const t=b2(e);return t!=null&&t.documentElement?`${t.doctype?`<!DOCTYPE ${t.doctype.name}${t.doctype.publicId?` PUBLIC "${t.doctype.publicId}"`:""}${t.doctype.systemId?` "${t.doctype.systemId}"`:""}>`:"<!DOCTYPE html>"}
|
|
167
|
+
${t.documentElement.outerHTML}`:""}function Bx(e){var n;if(!e)return null;const t=(n=e.getBoundingClientRect)==null?void 0:n.call(e);return{rectWidth:t!=null&&t.width?Math.round(t.width):null,rectHeight:t!=null&&t.height?Math.round(t.height):null,clientWidth:e.clientWidth||null,clientHeight:e.clientHeight||null,scrollWidth:e.scrollWidth||null,scrollHeight:e.scrollHeight||null,offsetWidth:e.offsetWidth||null,offsetHeight:e.offsetHeight||null}}function Bq(e,t,n,r={}){var k;const s=(k=e==null?void 0:e.getBoundingClientRect)==null?void 0:k.call(e),i=b2(e),a=i==null?void 0:i.documentElement,l=i==null?void 0:i.body,c=(r==null?void 0:r.card)||null,d=(r==null?void 0:r.displayBody)||null,f=(r==null?void 0:r.scroller)||null,u=(r==null?void 0:r.displaySize)||null,p={fallbackWidth:Number(t)||null,fallbackHeight:Number(n)||null,displaySizeWidth:Number((u==null?void 0:u.width)||0)||null,displaySizeHeight:Number((u==null?void 0:u.height)||0)||null,rectWidth:s!=null&&s.width?Math.round(s.width):null,rectHeight:s!=null&&s.height?Math.round(s.height):null,iframeClientWidth:(e==null?void 0:e.clientWidth)||null,iframeClientHeight:(e==null?void 0:e.clientHeight)||null,docScrollWidth:(a==null?void 0:a.scrollWidth)||null,docScrollHeight:(a==null?void 0:a.scrollHeight)||null,bodyScrollWidth:(l==null?void 0:l.scrollWidth)||null,bodyScrollHeight:(l==null?void 0:l.scrollHeight)||null,docOffsetWidth:(a==null?void 0:a.offsetWidth)||null,bodyOffsetWidth:(l==null?void 0:l.offsetWidth)||null,card:Bx(c),displayBody:Bx(d),scroller:Bx(f)},m=[Number(t)||0,Number((u==null?void 0:u.width)||0),Number((c==null?void 0:c.clientWidth)||0),Number((c==null?void 0:c.scrollWidth)||0),Number((d==null?void 0:d.clientWidth)||0),Number((d==null?void 0:d.scrollWidth)||0),Number((f==null?void 0:f.clientWidth)||0),Number((f==null?void 0:f.scrollWidth)||0),Number(s==null?void 0:s.width)||0,Number(e==null?void 0:e.clientWidth)||0,Number((a==null?void 0:a.scrollWidth)||0),Number((l==null?void 0:l.scrollWidth)||0),Number((a==null?void 0:a.offsetWidth)||0),Number((l==null?void 0:l.offsetWidth)||0)].map(g=>Math.ceil(g)).filter(g=>g>0),y=Math.max(1,...m.length?m:[960]),b=Math.max(1,Math.round(Number(n)||(s==null?void 0:s.height)||(e==null?void 0:e.clientHeight)||640),Math.ceil(Number((a==null?void 0:a.scrollHeight)||0)),Math.ceil(Number((l==null?void 0:l.scrollHeight)||0)));return{width:y,height:b,debug:p}}async function Wq({flowParams:e,content:t,sourceFilePath:n,iframe:r,width:s,height:i,filename:a,snapshotElements:l,displaySize:c}){const d=Bq(r,s,i,{...l||{},displaySize:c}),f=Hq(r),u=await fetch("/api/workspace/html-screenshot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e,content:f||t,sourceFilePath:n||"",width:d.width,height:d.height,filename:a})});if(!u.ok){const m=await u.json().catch(()=>({}));throw new Error(m.error||"截图失败")}const p=await u.blob();zq(p,a)}function Vq(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 Uq(e){return e==="mermaid"?"account_tree":e==="ascii"?"notes":e==="html"?"html":e==="image"?"image":e==="chart"?"bar_chart":e==="table"?"table":"article"}function Kq(e){const t=String(e||"").split(/\r?\n/).map(l=>l.replace(/%%.*$/,"").trim()).filter(Boolean),n=new Map,r=[];let s="TD";const i=(l,c="")=>{const d=String(l||"").replace(/[^A-Za-z0-9_]/g,"_")||`N${n.size+1}`;return n.has(d)?c&&(n.get(d).label=c):n.set(d,{id:d,label:c||d}),d},a=l=>{const c=String(l||"").trim().replace(/[;,]+$/,""),d=c.match(/^([A-Za-z][A-Za-z0-9_]*)(?:\[(.+?)\]|\((.+?)\)|\{(.+?)\})?$/);return d?i(d[1],d[2]||d[3]||d[4]||d[1]):i(c.replace(/[^A-Za-z0-9_]/g,"_"),c)};for(const l of t){const c=l.match(/^(graph|flowchart)\s+(TD|TB|BT|LR|RL)\b/i);if(c){s=c[2].toUpperCase();continue}const 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 v2({code:e}){const t=h.useMemo(()=>Kq(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,u)=>{l.set(f.id,{x:24+(n?u*(r+i):u%3*(r+i)),y:24+(n?u%3*(s+a):u*(s+a))})});const c=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 ${c} ${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,u)=>{const p=l.get(f.from),m=l.get(f.to);if(!p||!m)return null;const y=n?`M ${p.x+r} ${p.y+s/2} C ${(p.x+m.x+r)/2} ${p.y+s/2}, ${(p.x+m.x+r)/2} ${m.y+s/2}, ${m.x} ${m.y+s/2}`:`M ${p.x+r/2} ${p.y+s} C ${p.x+r/2} ${p.y+s+28}, ${m.x+r/2} ${m.y-28}, ${m.x+r/2} ${m.y}`;return o.jsx("path",{className:"af-work-node__mermaid-edge",d:y,markerEnd:"url(#af-work-arrow)"},`${f.from}-${f.to}-${u}`)}),t.nodes.map(f=>{const u=l.get(f.id);return o.jsxs("g",{children:[o.jsx("rect",{className:"af-work-node__mermaid-box",x:u.x,y:u.y,width:r,height:s,rx:"8"}),o.jsx("text",{className:"af-work-node__mermaid-text",x:u.x+r/2,y:u.y+s/2+5,textAnchor:"middle",children:f.label.slice(0,22)})]},f.id)})]})})}function Bi({className:e="",children:t}){const n=h.useRef(null),r=h.useRef(null),[s,i]=h.useState({visible:!1,top:0,height:100}),a=h.useCallback(()=>{const f=n.current;if(!f)return;const u=Math.max(1,f.scrollHeight),p=Math.max(1,f.clientHeight),m=u>p+1,y=m?Math.max(12,p/u*100):100,b=Math.max(0,100-y),k=m?Math.min(b,f.scrollTop/Math.max(1,u-p)*b):0;i({visible:m,top:k,height:y})},[]);h.useEffect(()=>{const f=requestAnimationFrame(a),u=n.current;if(!u||typeof ResizeObserver>"u")return()=>cancelAnimationFrame(f);const p=new ResizeObserver(a);p.observe(u);for(const m of Array.from(u.children))p.observe(m);return()=>{cancelAnimationFrame(f),p.disconnect()}},[t,a]);const l=h.useCallback(f=>{const u=n.current;if(!u)return;const p=Math.max(0,u.scrollHeight-u.clientHeight);u.scrollTop=Math.min(1,Math.max(0,f))*p,a()},[a]),c=h.useCallback((f,u=0)=>{const p=r.current;if(!p)return 0;const m=p.getBoundingClientRect(),y=s.height/100*m.height,b=Math.max(1,m.height-y);return(f-m.top-u)/b},[s.height]),d=h.useCallback(f=>{var N,_;if(!s.visible)return;f.preventDefault(),f.stopPropagation();const u=r.current;if(!u)return;const p=u.getBoundingClientRect(),m=s.top/100*p.height,y=s.height/100*p.height,k=f.clientY>=p.top+m&&f.clientY<=p.top+m+y?f.clientY-p.top-m:y/2;l(c(f.clientY,k));const g=f.pointerId;(_=(N=f.currentTarget).setPointerCapture)==null||_.call(N,g);const v=C=>{C.preventDefault(),l(c(C.clientY,k))},x=()=>{window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",x)};window.addEventListener("pointermove",v),window.addEventListener("pointerup",x),window.addEventListener("pointercancel",x)},[c,l,s.height,s.top,s.visible]);return o.jsxs("div",{className:`af-visible-scroll-frame ${e}`,children:[o.jsx("div",{ref:n,className:`af-visible-scroll-frame__scroller ${e}`,onScroll:a,children:t}),o.jsx("div",{ref:r,className:"af-visible-scrollbar"+(s.visible?" af-visible-scrollbar--visible":""),onPointerDown:d,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${s.height}%`,top:`${s.top}%`}})})]})}function qq({data:e,flowParams:t,htmlFrameRef:n,htmlFrameVersion:r=0}){const s=Kn(e==null?void 0:e.definitionId),i=sc(e),a=s==="image"?i:aa(i),l=s==="image"?"":Hu(a,s),[c,d]=h.useState(""),[f,u]=h.useState(""),[p,m]=h.useState(!1);if(h.useEffect(()=>{let g=!1;return l?(m(!0),u(""),d(""),Bu(t,l).then(v=>{g||d(v)}).catch(v=>{g||u(String(v.message||v))}).finally(()=>{g||m(!1)}),()=>{g=!0}):(d(""),u(""),m(!1),()=>{g=!0})},[l,t==null?void 0:t.flowId,t==null?void 0:t.flowSource,t==null?void 0:t.archived,e==null?void 0:e.displayReloadKey]),!s)return null;const y=l?c:a,b=s==="html"?Xu(y):aa(y),k=Ql(s,b);if(p)return o.jsxs(Bi,{className:"af-work-display-empty",children:["Loading ",l,"..."]});if(f)return o.jsx(Bi,{className:"af-work-display-empty",children:f});if(k)return o.jsx(Bi,{className:"af-work-display-empty",children:k});if(!b.trim())return o.jsx(Bi,{className:"af-work-display-empty",children:"No display content"});if(s==="html")return o.jsx(Bi,{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:w2(b)},r)});if(s==="image"){const g=yg(b,t);return o.jsx(Bi,{className:"af-work-display-body af-work-display-body--image",children:o.jsx("img",{className:"af-work-display-image",src:g,alt:Vq(e),loading:"lazy"})})}return s==="markdown"?o.jsx(Bi,{className:"af-work-display-body af-work-display-body--markdown",children:o.jsx(M0,{content:b,basePath:l,resolveSrc:(g,v)=>yg(g,t,v)})}):s==="chart"?o.jsx(Bi,{className:"af-work-display-body af-work-display-body--chart",children:o.jsx($0,{content:b})}):s==="table"?o.jsx(Bi,{className:"af-work-display-body af-work-display-body--table",children:o.jsx(O0,{content:b})}):s==="mermaid"?o.jsxs(Bi,{className:"af-work-display-body",children:[o.jsx(v2,{code:b}),o.jsx("pre",{className:"af-work-node__diagram af-work-node__diagram--mermaid",children:b})]}):o.jsx(Bi,{className:"af-work-display-body af-work-display-body--ascii",children:o.jsx("pre",{className:"af-work-node__diagram af-work-node__diagram--ascii",children:b})})}function Yq({node:e}){var p,m,y,b,k,g,v,x,N,_,C;const t=Kn((p=e==null?void 0:e.data)==null?void 0:p.definitionId),n=sc(e==null?void 0:e.data),r=t==="image"?n:aa(n),s=t==="image"?"":Hu(r,t),[i,a]=h.useState(""),[l,c]=h.useState(!1);h.useEffect(()=>{var H;let T=!1;return s?(c(!0),a(""),Bu(((H=e==null?void 0:e.data)==null?void 0:H.flowParams)||{},s).then(M=>{T||a(M)}).catch(()=>{T||a("")}).finally(()=>{T||c(!1)}),()=>{T=!0}):(a(""),c(!1),()=>{T=!0})},[s,(y=(m=e==null?void 0:e.data)==null?void 0:m.flowParams)==null?void 0:y.flowId,(k=(b=e==null?void 0:e.data)==null?void 0:b.flowParams)==null?void 0:k.flowSource,(v=(g=e==null?void 0:e.data)==null?void 0:g.flowParams)==null?void 0:v.archived,(x=e==null?void 0:e.data)==null?void 0:x.displayReloadKey]);const d=s?i:r,f=t==="html"?Xu(d):aa(d),u=Ql(t,f);return l?o.jsx("div",{className:"af-display-picker-preview__empty",children:"Loading"}):u?o.jsx("div",{className:"af-display-picker-preview__empty",children:u}):f.trim()?t==="html"?o.jsx("iframe",{title:((N=e==null?void 0:e.data)==null?void 0:N.label)||(e==null?void 0:e.id),sandbox:"allow-scripts allow-forms allow-modals",srcDoc:w2(f)}):t==="image"?o.jsx("img",{src:yg(f,(_=e==null?void 0:e.data)==null?void 0:_.flowParams),alt:((C=e==null?void 0:e.data)==null?void 0:C.label)||(e==null?void 0:e.id),loading:"lazy"}):t==="markdown"?o.jsx("div",{className:"af-display-picker-preview__markdown",children:o.jsx(M0,{content:f,basePath:s,resolveSrc:(T,H)=>{var M;return yg(T,(M=e==null?void 0:e.data)==null?void 0:M.flowParams,H)}})}):t==="chart"?o.jsx($0,{content:f}):t==="table"?o.jsx(O0,{content:f}):t==="mermaid"?o.jsxs("div",{className:"af-display-picker-preview__diagram",children:[o.jsx(v2,{code:f}),o.jsx("pre",{children:f})]}):o.jsx("pre",{className:"af-display-picker-preview__pre",children:f}):o.jsx("div",{className:"af-display-picker-preview__empty",children:"No content"})}function Gq({value:e,onChange:t,onUploadImage:n,readOnly:r=!1}){const s=h.useRef(null),i=h.useRef(null),a=h.useRef(null),[l,c]=h.useState(!1),[d,f]=h.useState({visible:!1,top:0,height:100}),u=h.useCallback(()=>{const g=s.current;if(!g)return;const v=Math.max(1,g.scrollHeight),x=Math.max(1,g.clientHeight),N=v>x+1,_=N?Math.max(12,x/v*100):100,C=Math.max(0,100-_),T=N?Math.min(C,g.scrollTop/Math.max(1,v-x)*C):0;f({visible:N,top:T,height:_})},[]);h.useEffect(()=>{const g=requestAnimationFrame(u),v=s.current;if(!v||typeof ResizeObserver>"u")return()=>cancelAnimationFrame(g);const x=new ResizeObserver(u);return x.observe(v),()=>{cancelAnimationFrame(g),x.disconnect()}},[u,e]);const p=h.useCallback(g=>{const v=s.current;if(!v)return;const x=Math.max(0,v.scrollHeight-v.clientHeight);v.scrollTop=Math.min(1,Math.max(0,g))*x,u()},[u]),m=h.useCallback((g,v=0)=>{const x=a.current;if(!x)return 0;const N=x.getBoundingClientRect(),_=d.height/100*N.height,C=Math.max(1,N.height-_);return(g-N.top-v)/C},[d.height]),y=h.useCallback(g=>{if(!d.visible)return;g.preventDefault(),g.stopPropagation();const v=a.current;if(!v)return;const x=v.getBoundingClientRect(),N=d.top/100*x.height,_=d.height/100*x.height,T=g.clientY>=x.top+N&&g.clientY<=x.top+N+_?g.clientY-x.top-N:_/2;p(m(g.clientY,T));const H=F=>{F.preventDefault(),p(m(F.clientY,T))},M=()=>{window.removeEventListener("pointermove",H),window.removeEventListener("pointerup",M),window.removeEventListener("pointercancel",M)};window.addEventListener("pointermove",H),window.addEventListener("pointerup",M),window.addEventListener("pointercancel",M)},[m,p,d.height,d.top,d.visible]),b=h.useCallback(g=>{const v=String(e||""),x=s.current,N=Number((x==null?void 0:x.selectionStart)??v.length),_=Number((x==null?void 0:x.selectionEnd)??N),C=v.slice(0,N),T=v.slice(_),H=C&&!C.endsWith(`
|
|
168
|
+
`)?`
|
|
169
|
+
`:"",M=T&&!T.startsWith(`
|
|
170
|
+
`)?`
|
|
171
|
+
`:"",F=`${C}${H}${g}${M}${T}`;t==null||t(F),window.requestAnimationFrame(()=>{var $,W;const D=C.length+H.length+g.length;($=s.current)==null||$.focus(),(W=s.current)==null||W.setSelectionRange(D,D)})},[t,e]),k=h.useCallback(async g=>{if(!r&&!(!g||l)){c(!0);try{const v=await(n==null?void 0:n(g)),x=String(v||"").trim();if(x){const N=String(g.name||"image").replace(/\.[^.]+$/g,"").trim()||"image";b(``)}}finally{c(!1)}}},[b,n,r,l]);return o.jsxs("div",{className:"af-work-display-editor nodrag nopan",onClick:g=>g.stopPropagation(),onDragOver:g=>{var x;Array.from(((x=g.dataTransfer)==null?void 0:x.items)||[]).some(N=>String((N==null?void 0:N.type)||"").startsWith("image/"))&&(g.preventDefault(),g.dataTransfer.dropEffect="copy")},onDrop:g=>{var x;const v=Array.from(((x=g.dataTransfer)==null?void 0:x.files)||[]).find(gg);v&&(g.preventDefault(),k(v))},children:[o.jsxs("div",{className:"af-work-display-editor__toolbar",children:[o.jsx("button",{type:"button",className:"af-work-display-card__action",disabled:l||r,onClick:()=>{var g;return(g=i.current)==null?void 0:g.click()},"aria-label":"上传图片",title:"上传图片",children:o.jsx("span",{className:"material-symbols-outlined",children:l?"hourglass_top":"add_photo_alternate"})}),o.jsx("input",{ref:i,className:"af-hidden-file-input",type:"file",accept:"image/*",onChange:g=>{var x;const v=(x=g.target.files)==null?void 0:x[0];g.target.value="",v&&k(v)}})]}),o.jsx("textarea",{ref:s,className:"af-work-display-editor__textarea",value:e,onChange:g=>t==null?void 0:t(g.target.value),onScroll:u,onKeyDown:g=>{g.key==="Escape"&&g.stopPropagation()},placeholder:"输入 Markdown 内容",spellCheck:!1,readOnly:r}),o.jsx("div",{ref:a,className:"af-work-display-editor__scrollbar"+(d.visible?" af-work-display-editor__scrollbar--visible":""),onPointerDown:y,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${d.height}%`,top:`${d.top}%`}})})]})}function Xq({nodeId:e,data:t}){const n=t==null?void 0:t.nodeChatActive,r=!!(t!=null&&t.selected),s=(t==null?void 0:t.nodeChat)||{},i=Array.isArray(s.messages)?s.messages:[],a=String(s.draft||""),[l,c]=h.useState(a),d=h.useRef(!1),f=String(s.candidateContent||""),u=!!s.running,p=!!(t!=null&&t.readOnly),m=String(s.error||"");return h.useEffect(()=>{d.current||c(a)},[a]),!n&&!r?null:n?o.jsxs("div",{className:"af-work-node-chat nodrag nopan",onClick:y=>y.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 y;return(y=t==null?void 0:t.onCloseNodeChat)==null?void 0:y.call(t)},"aria-label":"关闭节点微调",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),i.length>0||u||m||f.trim()?o.jsxs("div",{className:"af-work-node-chat__messages",children:[i.slice(-4).map((y,b)=>o.jsxs("div",{className:`af-work-node-chat__msg af-work-node-chat__msg--${y.role==="assistant"?"assistant":"user"}`,children:[o.jsx("span",{children:y.role==="assistant"?"AI":"你"}),o.jsx("p",{children:y.text})]},`${y.at||b}-${b}`)),u?o.jsx("div",{className:"af-work-node-chat__pending",children:"生成中..."}):null,m?o.jsx("div",{className:"af-work-node-chat__error",children:m}):null]}):null,o.jsxs("div",{className:"af-work-node-chat__composer",children:[o.jsx("button",{type:"button",className:"af-work-node-chat__add",disabled:u||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:u||p,placeholder:"描述你想怎么调整这个展示",onCompositionStart:()=>{d.current=!0},onCompositionEnd:y=>{var k;d.current=!1;const b=y.currentTarget.value;c(b),(k=t==null?void 0:t.onUpdateNodeChatDraft)==null||k.call(t,e,b)},onChange:y=>{var k;const b=y.target.value;c(b),d.current||(k=t==null?void 0:t.onUpdateNodeChatDraft)==null||k.call(t,e,b)},onKeyDown:y=>{var b,k;y.isComposing||(b=y.nativeEvent)!=null&&b.isComposing||y.keyCode===229||(y.metaKey||y.ctrlKey)&&y.key==="Enter"&&(y.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:u||p||!l.trim(),onClick:()=>{var y;return(y=t==null?void 0:t.onSendNodeChat)==null?void 0:y.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:u||p||!f.trim(),onClick:()=>{var y;return(y=t==null?void 0:t.onApplyNodeChatCandidate)==null?void 0:y.call(t,e,"replace")},children:"替换当前内容"}),o.jsx("button",{type:"button",disabled:u||p||!f.trim(),onClick:()=>{var y;return(y=t==null?void 0:t.onApplyNodeChatCandidate)==null?void 0:y.call(t,e,"append")},children:"追加"})]})]}):o.jsxs("button",{type:"button",className:"af-work-node-chat-anchor nodrag nopan",onClick:y=>{var b;y.stopPropagation(),(b=t==null?void 0:t.onToggleNodeChat)==null||b.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 Jq(e){return e==="mermaid"?"mmd":e==="ascii"?"txt":e==="html"?"html":e==="image"?"txt":e==="chart"||e==="table"?"json":"md"}function Qq(e){return String(e).trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)||"display"}function L1(e,t){const n=Kn(t==null?void 0:t.definitionId)||"markdown";return`outputs/${Qq((t==null?void 0:t.label)||e||n)}.${Jq(n)}`}function Zq({id:e,data:t,selected:n,deleteNode:r}){var fe,me,ge;const s=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],a=(Array.isArray(t==null?void 0:t.outputs)?t.outputs:[]).map((Z,ae)=>({slot:Z,idx:ae})).sort((Z,ae)=>{var Ve,et,qe,dt;const xe=String(((Ve=Z.slot)==null?void 0:Ve.name)||"").trim(),pe=String(((et=ae.slot)==null?void 0:et.name)||"").trim();if(xe==="next"&&pe!=="next")return-1;if(pe==="next"&&xe!=="next")return 1;const _e=String(((qe=Z.slot)==null?void 0:qe.type)||"").trim(),je=String(((dt=ae.slot)==null?void 0:dt.type)||"").trim();return _e==="node"&&je!=="node"?-1:je==="node"&&_e!=="node"?1:Z.idx-ae.idx}),l=Kn(t==null?void 0:t.definitionId),c=h.useRef(null),d=h.useRef(null),[f,u]=h.useState(0),[p,m]=h.useState(!1),[y,b]=h.useState(!1),[k,g]=h.useState(!1),[v,x]=h.useState(""),[N,_]=h.useState(""),[C,T]=h.useState(!1),[H,M]=h.useState(!1),F=h.useRef(null),D=sc(t),$=l==="markdown"?aa(D):"",W=l==="markdown"?Hu($,"markdown"):"",O=l==="markdown"?W?N:$:"",R=!!(t!=null&&t.readOnly),I=!!(t!=null&&t.displayPageMode);h.useEffect(()=>{let Z=!1;return l!=="markdown"||!W?(_(""),T(!1),()=>{Z=!0}):(T(!0),Bu((t==null?void 0:t.flowParams)||{},W).then(ae=>{Z||_(ae)}).catch(ae=>{var xe;Z||(_(""),(xe=t==null?void 0:t.onStatus)==null||xe.call(t,String(ae.message||ae)))}).finally(()=>{Z||T(!1)}),()=>{Z=!0})},[l,W,(fe=t==null?void 0:t.flowParams)==null?void 0:fe.flowId,(me=t==null?void 0:t.flowParams)==null?void 0:me.flowSource,(ge=t==null?void 0:t.flowParams)==null?void 0:ge.archived,t==null?void 0:t.displayReloadKey]),h.useEffect(()=>{if(!y)return;const Z=()=>b(!1);return window.addEventListener("pointerup",Z,!0),window.addEventListener("pointercancel",Z,!0),window.addEventListener("mouseup",Z,!0),window.addEventListener("blur",Z),()=>{window.removeEventListener("pointerup",Z,!0),window.removeEventListener("pointercancel",Z,!0),window.removeEventListener("mouseup",Z,!0),window.removeEventListener("blur",Z)}},[y]),h.useEffect(()=>{k||x(String(O||""))},[O,k]);const z=(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"),P=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,L=h.useCallback(async()=>{var He,bt,sn,on,an,Yt,En,hn,ue,ke;if(l!=="html"||p)return;const Z=sc(t),ae=Hu(Z,l);let xe=Z;if(ae)try{xe=await Bu((t==null?void 0:t.flowParams)||{},ae)}catch(De){m(!1),console.warn("Failed to read HTML display file before saving image.",De);return}const pe=Xu(xe);if(!pe.trim())return;const _e=Ql(l,pe);if(_e){console.warn(_e);return}const je=(bt=(He=d.current)==null?void 0:He.getBoundingClientRect)==null?void 0:bt.call(He),Ve=(on=(sn=c.current)==null?void 0:sn.querySelector)==null?void 0:on.call(sn,".af-work-display-body"),et=(Yt=(an=c.current)==null?void 0:an.querySelector)==null?void 0:Yt.call(an,".af-visible-scroll-frame__scroller"),qe=Math.round(Math.max(Number((je==null?void 0:je.width)||0),Number((P==null?void 0:P.width)||0),Number(((En=c.current)==null?void 0:En.clientWidth)||0),Number((Ve==null?void 0:Ve.clientWidth)||0),Number((et==null?void 0:et.clientWidth)||0),Math.max(320,Number((P==null?void 0:P.width)||960)-2))),dt=Math.round(Math.max(Number((je==null?void 0:je.height)||0),Number((P==null?void 0:P.height)||0),Number(((hn=c.current)==null?void 0:hn.clientHeight)||0),Number((Ve==null?void 0:Ve.clientHeight)||0),Number((et==null?void 0:et.clientHeight)||0),Math.max(180,Number((P==null?void 0:P.height)||640)-46)));m(!0);try{await Wq({flowParams:(t==null?void 0:t.flowParams)||{},content:pe,sourceFilePath:ae,iframe:d.current,width:qe,height:dt,filename:Dq((t==null?void 0:t.label)||e||"html-render","png"),snapshotElements:{card:c.current,displayBody:Ve,scroller:et},displaySize:P}),(ue=t==null?void 0:t.onStatus)==null||ue.call(t,"已导出 HTML 展示截图")}catch(De){const rt=String((De==null?void 0:De.message)||De||"截图失败");(ke=t==null?void 0:t.onStatus)==null||ke.call(t,`HTML 截图失败:${rt}`),console.warn("Failed to save HTML display as PNG.",De)}finally{m(!1)}},[t,P==null?void 0:P.height,P==null?void 0:P.width,e,l,p]),E=h.useCallback(Z=>{var ae;R||!Z||l!=="image"||(ae=t==null?void 0:t.onUploadImageToDisplayNode)==null||ae.call(t,e,Z)},[t,e,l,R]),X=h.useCallback(Z=>{var ae,xe;(ae=Z==null?void 0:Z.stopPropagation)==null||ae.call(Z),!R&&((xe=t==null?void 0:t.onSetDisplayNodeContent)==null||xe.call(t,e,"","replace",{logChat:!1,reloadDisplay:!0,statusMessage:"已清空 Display 内容"}),l==="markdown"&&(x(""),g(!1)))},[t,e,l,R]),ee=h.useCallback(Z=>{var pe,_e;R||l!=="image"||!(Array.from(((pe=Z.dataTransfer)==null?void 0:pe.files)||[]).some(gg)||Array.from(((_e=Z.dataTransfer)==null?void 0:_e.items)||[]).some(je=>String((je==null?void 0:je.type)||"").startsWith("image/")))||(Z.preventDefault(),Z.stopPropagation(),Z.dataTransfer.dropEffect="copy",M(!0))},[l,R]),V=h.useCallback(Z=>{l==="image"&&(Z.currentTarget.contains(Z.relatedTarget)||M(!1))},[l]),ie=h.useCallback(Z=>{var xe;if(l!=="image")return;const ae=Array.from(((xe=Z.dataTransfer)==null?void 0:xe.files)||[]).find(gg);ae&&(Z.preventDefault(),Z.stopPropagation(),M(!1),E(ae))},[l,E]);return o.jsxs("div",{className:"af-work-display-card"+(P?" af-work-display-card--sized":"")+(n?" af-work-display-card--selected":"")+(y?" af-work-display-card--resizing":"")+(H?" af-work-display-card--image-drop":"")+(I?" af-work-display-card--presentation":"")+(t!=null&&t.isExecuting?" af-work-display-card--executing":"")+((t==null?void 0:t.nodeStatus)==="success"?" af-work-display-card--done":"")+((t==null?void 0:t.nodeStatus)==="failed"?" af-work-display-card--failed":""),style:P?{width:P.width,height:P.height}:void 0,ref:c,onDragOver:ee,onDragLeave:V,onDrop:ie,children:[o.jsx(aI,{className:"af-work-display-resize nodrag",position:"bottom-right",minWidth:320,minHeight:180,onResizeStart:()=>b(!0),onResizeEnd:()=>b(!1),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_full"})}),s.map((Z,ae)=>{if(Z.showOnNode===!1)return null;const xe=`${4.15+ae*1.75}rem`,pe=Z.name||`#${ae+1}`;return o.jsxs(h.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:xe},children:pe}),o.jsx(Fs,{type:"target",position:Ze.Left,id:`input-${ae}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:xe,background:or(Z.type)},title:`${pe} · ${Z.type}`})]},`in-${ae}`)}),a.map(({slot:Z,idx:ae},xe)=>{if(Z.showOnNode===!1)return null;const pe=`${4.15+xe*1.75}rem`,_e=Z.name||`#${ae+1}`;return o.jsxs(h.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:pe},children:_e}),o.jsx(Fs,{type:"source",position:Ze.Right,id:`output-${ae}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:pe,background:or(Z.type)},title:`${_e} · ${Z.type}`})]},`out-${ae}`)}),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:Uq(l)}),o.jsx("strong",{children:z}),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:Z=>Z.stopPropagation(),children:[o.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>{var Z,ae,xe,pe;try{(pe=(xe=(ae=(Z=d.current)==null?void 0:Z.contentWindow)==null?void 0:ae.history)==null?void 0:xe.back)==null||pe.call(xe)}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 Z,ae,xe,pe;try{(pe=(xe=(ae=(Z=d.current)==null?void 0:Z.contentWindow)==null?void 0:ae.history)==null?void 0:xe.forward)==null||pe.call(xe)}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:()=>u(Z=>Z+1),"aria-label":"刷新",title:"刷新",children:o.jsx("span",{className:"material-symbols-outlined",children:"refresh"})}),o.jsx("button",{type:"button",className:"af-work-display-card__action",disabled:p,onClick:L,"aria-label":"截图另存为图片",title:"截图另存为图片",children:o.jsx("span",{className:"material-symbols-outlined",children:p?"hourglass_empty":"photo_camera"})})]}):null,l==="markdown"?k?o.jsxs("div",{className:"af-work-display-card__html-controls nodrag",onClick:Z=>Z.stopPropagation(),children:[o.jsx("button",{type:"button",className:"af-work-display-card__action",disabled:R||C,onClick:async()=>{var Z,ae,xe;if(W){try{const pe=await Bb((t==null?void 0:t.flowParams)||{},W,v);_(v),(Z=t==null?void 0:t.onSetDisplayNodeContent)==null||Z.call(t,e,pe,"replace",{logChat:!1,reloadDisplay:!0,statusMessage:`已更新 ${pe}`}),g(!1)}catch(pe){(ae=t==null?void 0:t.onStatus)==null||ae.call(t,String(pe.message||pe))}return}(xe=t==null?void 0:t.onSetDisplayNodeContent)==null||xe.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:()=>{x(String(O||"")),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:R||C,onClick:Z=>{Z.stopPropagation(),x(String(O||"")),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:F,className:"af-hidden-file-input",type:"file",accept:"image/*",onChange:Z=>{var xe;const ae=(xe=Z.target.files)==null?void 0:xe[0];Z.target.value="",ae&&E(ae)}}),o.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:R,onClick:Z=>{var ae;Z.stopPropagation(),(ae=F.current)==null||ae.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:R,onClick:X,"aria-label":"清空内容",title:"清空内容",children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_sweep"})}),o.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:R,onClick:()=>{var Z;return(Z=t==null?void 0:t.onSaveDisplayNodeToFile)==null?void 0:Z.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:R,onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),l==="markdown"&&k?o.jsx(Gq,{value:v,onChange:x,onUploadImage:t==null?void 0:t.onUploadWorkspaceImage,readOnly:R}):o.jsx(qq,{data:t,flowParams:t==null?void 0:t.flowParams,htmlFrameRef:d,htmlFrameVersion:f}),o.jsx(Xq,{nodeId:e,data:t})]})}function eY({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",c=!!(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 u=`${2.25+f*1.75}rem`,p=d.name||`#${f+1}`;return o.jsxs(h.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:u},children:p}),o.jsx(Fs,{type:"target",position:Ze.Left,id:`input-${f}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:u,background:or(d.type)},title:`${p} · ${d.type}`})]},`in-${f}`)}),i.map((d,f)=>{if(d.showOnNode===!1)return null;const u=`${2.25+f*1.75}rem`,p=d.name||`#${f+1}`;return o.jsxs(h.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:u},children:p}),o.jsx(Fs,{type:"source",position:Ze.Right,id:`output-${f}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:u,background:or(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:c,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:c,onClick:d=>{var f,u;d.stopPropagation(),a?(f=t==null?void 0:t.onStopWorkspaceNode)==null||f.call(t,e):(u=t==null?void 0:t.onRunWorkspaceNode)==null||u.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 tY(e){var m,y,b,k,g,v,x,N,_,C,T,H,M;const{setEdges:t,setNodes:n}=wc(),r=(m=e.data)==null?void 0:m.onSyncNodePropDraft,s=!!((y=e.data)!=null&&y.readOnly),[i,a]=h.useState(!1),l=(b=e.data)!=null&&b.nodeSize&&Number(e.data.nodeSize.width)>0&&Number(e.data.nodeSize.height)>0?{width:Number(e.data.nodeSize.width),height:Number(e.data.nodeSize.height)}:null,c=h.useCallback(F=>{s||(n(D=>D.filter($=>$.id!==F)),t(D=>D.filter($=>$.source!==F&&$.target!==F)))},[s,t,n]),d=h.useCallback((F,D)=>{s||(n($=>$.map(W=>W.id===F?{...W,data:{...W.data,model:D}}:W)),r==null||r(F,{model:D}))},[s,n,r]),f=h.useCallback((F,D)=>{s||(n($=>$.map(W=>{var R;if(W.id!==F)return W;const O=Array.isArray((R=W.data)==null?void 0:R.outputs)&&W.data.outputs.length?W.data.outputs.map((I,z)=>z===0?{...I,default:D,value:D}:I):[{type:"bool",name:"value",default:D,value:D}];return{...W,data:{...W.data,body:"",outputs:O}}})),r==null||r(F,$=>({body:"",outputs:Array.isArray($==null?void 0:$.outputs)&&$.outputs.length?$.outputs.map((O,R)=>R===0?{...O,default:D,value:D}:O):[{type:"bool",name:"value",default:D,value:D}]})))},[s,n,r]),u=h.useCallback((F,D)=>{s||(n($=>$.map(W=>W.id===F?{...W,data:{...W.data,body:D}}:W)),r==null||r(F,{body:D}))},[s,n,r]),p=h.useCallback((F,D)=>{if(s)return;const $=Ts(D);n(W=>W.map(O=>O.id===F?{...O,data:{...O.data,images:$}}:O)),r==null||r(F,{images:$})},[s,n,r]);return Kn((k=e.data)==null?void 0:k.definitionId)?o.jsx(Zq,{...e,deleteNode:c}):((g=e.data)==null?void 0:g.definitionId)==="workspace_run"?o.jsx(eY,{...e,deleteNode:c}):((v=e.data)==null?void 0:v.definitionId)==="control_load_skills"?o.jsx(pY,{...e,deleteNode:c,skills:(x=e.data)==null?void 0:x.skills,skillCollections:(N=e.data)==null?void 0:N.skillCollections,onChangeSkillKeys:(_=e.data)==null?void 0:_.onChangeLoadSkillKeys}):((C=e.data)==null?void 0:C.definitionId)==="control_load_mcp"?o.jsx(hY,{...e,deleteNode:c,servers:(T=e.data)==null?void 0:T.mcpServers,onChangeMcpNames:(H=e.data)==null?void 0:H.onChangeLoadMcpNames}):o.jsxs("div",{className:"af-work-flow-node"+(e.selected?" af-work-flow-node--selected":"")+(i?" af-work-flow-node--resizing":""),style:l?{width:l.width,height:l.height}:void 0,children:[s?null:o.jsx(aI,{className:"af-work-display-resize af-work-flow-resize nodrag",position:"bottom-right",minWidth:d2,minHeight:Db,maxWidth:f2,maxHeight:p2,onResizeStart:()=>a(!0),onResizeEnd:()=>a(!1),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_full"})}),o.jsx(HT,{...e,deleteNode:c,modelLists:(M=e.data)==null?void 0:M.modelLists,onModelChange:d,onProvideValueChange:f,onNodeBodyChange:u,onNodeImagesChange:p})]})}const nY={[Sp]:tY};function k2(e,t=[]){for(const n of e||[])n.type==="file"&&t.push(n),Array.isArray(n.children)&&k2(n.children,t);return t}function S2(e,t=[]){for(const n of e||[])n.type==="directory"&&(t.push(n.path),Array.isArray(n.children)&&S2(n.children,t));return t}function Vh(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 rY(e){return[...e||[]].sort((t,n)=>t.type!==n.type?t.type==="directory"?-1:1:String(t.name||"").localeCompare(String(n.name||"")))}function sY(e,t,n=0){const r=String(t||"").replace(/\\/g,"/").split("/").filter(Boolean);if(r.length===0)return e;const s=(i,a,l)=>{const c=r[a],d=l?`${l}/${c}`:c,f=a===r.length-1;let u=!1;const p=(Array.isArray(i)?i:[]).map(m=>m.name!==c?m:(u=!0,f?{...m,type:"file",name:c,path:d,icon:ef(c),size:n}:{...m,type:"directory",name:c,path:d,icon:ef(c,!0),children:s(m.children||[],a+1,d)}));return u||p.push(f?{type:"file",name:c,path:d,icon:ef(c),size:n}:{type:"directory",name:c,path:d,icon:ef(c,!0),children:s([],a+1,d)}),rY(p)};return s(e||[],0,"")}function N2({items:e,flowParams:t,onOpen:n,collapsedDirs:r,onToggleDir:s,onCreateFile:i,onCreateFolder:a,onDelete:l,onFileDragStart:c}){return o.jsx("ul",{className:"af-work-files",children:(e||[]).map(d=>{var p;const f=d.type==="directory",u=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:m=>{f||c==null||c(m,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:u?"chevron_right":"expand_more"}):null,o.jsx("span",{className:"material-symbols-outlined",children:d.icon||ef(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:bq(d.path,t),download:d.name,onClick:m=>m.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&&!u&&((p=d.children)!=null&&p.length)?o.jsx(N2,{items:d.children,flowParams:t,onOpen:n,collapsedDirs:r,onToggleDir:s,onCreateFile:i,onCreateFolder:a,onDelete:l,onFileDragStart:c}):null]},d.path)})})}function iY({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 wg(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 oY(e){const t=wg((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 wg((r==null?void 0:r.default)||(r==null?void 0:r.value)||"")}function aY(e){return JSON.stringify(Array.from(new Set((e||[]).map(String).filter(Boolean))))}function lY(e){const t=wg((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 wg((r==null?void 0:r.default)||(r==null?void 0:r.value)||"")}function cY(e){return JSON.stringify(Array.from(new Set((e||[]).map(String).filter(Boolean))))}function M1(e){var r,s,i,a,l,c;if(!e)return null;const{inputs:t,outputs:n}=$T(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:Ts((l=e.data)==null?void 0:l.images),script:String(((c=e.data)==null?void 0:c.script)??""),inputs:t,outputs:n}}function O1(e){return(Array.isArray(e)?e:[]).map(t=>({type:String((t==null?void 0:t.type)??"node").trim()||"node",name:String((t==null?void 0:t.name)??""),default:String((t==null?void 0:t.default)??""),required:!!(t!=null&&t.required),showOnNode:(t==null?void 0:t.showOnNode)!=null?t.showOnNode!==!1:!!(t!=null&&t.required)||String((t==null?void 0:t.type)??"node").trim().toLowerCase()==="node"}))}function uY(e,t,n){var f,u;const r=String(((f=e==null?void 0:e.data)==null?void 0:f.definitionId)??n),s=r.startsWith("provide_"),i=String((t==null?void 0:t.role)||"").trim(),a=dl.includes(i)?i:"normal",l=String((t==null?void 0:t.model)||"").trim(),c={...e.data,label:String((t==null?void 0:t.label)||"").trim()||n,role:a,model:l===""||l==="default"?void 0:l,body:s?"":String((t==null?void 0:t.body)??""),images:s?[]:Ts(t==null?void 0:t.images),inputs:O1(t==null?void 0:t.inputs),outputs:s&&Array.isArray((u=e.data)==null?void 0:u.outputs)?e.data.outputs:O1(t==null?void 0:t.outputs)},d=String((t==null?void 0:t.script)??"").trim();return r==="tool_nodejs"||d!==""?c.script=String((t==null?void 0:t.script)??""):delete c.script,c}function $1({nodes:e,edges:t,instances:n,selectedNode:r,draft:s,allowRename:i=!1}){if(!s||!r)return{ok:!1,error:""};const a=r.id,l=String(s.newId||"").trim(),c=i?l:a;if(i){if(!XT.test(c))return{ok:!1,error:"Invalid instance id"};if(e.some(b=>b.id===c&&b.id!==a))return{ok:!1,error:"Duplicate instance id"}}const d=uY(r,s,c),f=r.data||{};if(!(c!==a||f.label!==d.label||f.role!==d.role||f.model!==d.model||f.body!==d.body||JSON.stringify(Ts(f.images))!==JSON.stringify(d.images)||(f.script??void 0)!==(d.script??void 0)||JSON.stringify(f.inputs||[])!==JSON.stringify(d.inputs||[])||JSON.stringify(f.outputs||[])!==JSON.stringify(d.outputs||[])))return{ok:!0,changed:!1,nextId:c,nodes:e,edges:t,instances:n};const p=e.map(b=>b.id===a?{...b,id:c,selected:!0,data:d}:b);let m=t,y=n;if(c!==a){y={...n||{}};const b={...y[a]||{}};delete y[a],y[c]=b,m=t.map((k,g)=>({...k,source:k.source===a?c:k.source,target:k.target===a?c:k.target,id:`we-${k.source===a?c:k.source}-${k.target===a?c:k.target}-${g}`}))}return{ok:!0,changed:!0,nextId:c,nodes:p,edges:m,instances:y}}function dY(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}function fY(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"])dY(e[s],t[s])&&(r[s]=n[s]);return r}function pY({id:e,data:t,selected:n,deleteNode:r,skills:s,skillCollections:i,onChangeSkillKeys:a}){const l=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],c=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],d=Array.isArray(s)?s:[],f=Array.isArray(i)?i:[],[u,p]=h.useState(!1),[m,y]=h.useState(""),[b,k]=h.useState(()=>new Set),g=h.useRef(null),v=h.useRef(null),[x,N]=h.useState({visible:!1,top:0,height:100}),_=h.useMemo(()=>new Set(oY(t)),[t]),C=h.useMemo(()=>new Map(d.map(R=>[R.key,R])),[d]),T=h.useMemo(()=>{const R=new Set,I=f.map(P=>{const L=cl(P,d).map(E=>C.get(E)).filter(Boolean);for(const E of L)R.add(E.key);return{...P,skills:L}}).filter(P=>P.skills.length>0),z=d.filter(P=>!R.has(P.key));return{collectionGroups:I,ungrouped:z}},[C,f,d]);h.useEffect(()=>{k(R=>{let I=!1;const z=new Set(R);for(const P of T.collectionGroups)z.has(P.id)||(z.add(P.id),I=!0);return I?z:R})},[T.collectionGroups]);const H=h.useMemo(()=>{const R=m.trim().toLowerCase();if(!R)return T;const I=P=>[P==null?void 0:P.key,P==null?void 0:P.name,P==null?void 0:P.description].map(E=>String(E||"").toLowerCase()).join(" ").includes(R);return{collectionGroups:T.collectionGroups.map(P=>{const E=[P==null?void 0:P.id,P==null?void 0:P.name,P==null?void 0:P.description].map(X=>String(X||"").toLowerCase()).join(" ").includes(R)?P.skills:P.skills.filter(I);return{...P,skills:E}}).filter(P=>P.skills.length>0),ungrouped:T.ungrouped.filter(I)}},[T,m]),M=h.useCallback((R,I)=>{const z=new Set(_);for(const P of R)I?z.add(P):z.delete(P);a==null||a(e,Array.from(z))},[e,_,a]),F=h.useCallback(R=>{k(I=>{const z=new Set(I);return z.has(R)?z.delete(R):z.add(R),z})},[]),D=h.useCallback(()=>{const R=g.current;if(!R)return;const I=Math.max(1,R.scrollHeight),z=Math.max(1,R.clientHeight),P=I>z+1,L=P?Math.max(12,z/I*100):100,E=Math.max(0,100-L),X=P?Math.min(E,R.scrollTop/Math.max(1,I-z)*E):0;N({visible:P,top:X,height:L})},[]);h.useEffect(()=>{if(!u)return;const R=requestAnimationFrame(D);return()=>cancelAnimationFrame(R)},[b,H,_.size,u,D]);const $=h.useCallback(R=>{const I=g.current;if(!I)return;const z=Math.max(0,I.scrollHeight-I.clientHeight);I.scrollTop=Math.min(1,Math.max(0,R))*z,D()},[D]),W=h.useCallback((R,I=0)=>{const z=v.current;if(!z)return 0;const P=z.getBoundingClientRect(),L=x.height/100*P.height,E=Math.max(1,P.height-L);return(R-P.top-I)/E},[x.height]),O=h.useCallback(R=>{var fe,me;if(!x.visible)return;R.preventDefault(),R.stopPropagation();const I=v.current;if(!I)return;const z=I.getBoundingClientRect(),P=x.top/100*z.height,L=x.height/100*z.height,X=R.clientY>=z.top+P&&R.clientY<=z.top+P+L?R.clientY-z.top-P:L/2;$(W(R.clientY,X));const ee=R.pointerId;(me=(fe=R.currentTarget).setPointerCapture)==null||me.call(fe,ee);const V=ge=>{ge.preventDefault(),$(W(ge.clientY,X))},ie=()=>{window.removeEventListener("pointermove",V),window.removeEventListener("pointerup",ie),window.removeEventListener("pointercancel",ie)};window.addEventListener("pointermove",V),window.addEventListener("pointerup",ie),window.addEventListener("pointercancel",ie)},[W,$,x.height,x.top,x.visible]);return o.jsxs("div",{className:"af-work-load-skills-card"+(n?" af-work-load-skills-card--selected":""),children:[l.map((R,I)=>{if(R.showOnNode===!1)return null;const z=`${2.6+I*1.7}rem`,P=R.name||`#${I+1}`;return o.jsxs(h.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:z},children:P}),o.jsx(Fs,{type:"target",position:Ze.Left,id:`input-${I}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:z,background:or(R.type)},title:`${P} · ${R.type}`})]},`in-${I}`)}),c.map((R,I)=>{if(R.showOnNode===!1)return null;const z=`${2.6+I*1.7}rem`,P=R.name||`#${I+1}`;return o.jsxs(h.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:z},children:P}),o.jsx(Fs,{type:"source",position:Ze.Right,id:`output-${I}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:z,background:or(R.type)},title:`${P} · ${R.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:R=>{var I;R.stopPropagation(),u||(I=t==null?void 0:t.onRefreshSkills)==null||I.call(t),p(z=>!z)},children:[o.jsx("span",{children:_.size>0?`${_.size} skills selected`:"选择 Skills"}),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:R=>R.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:m,onChange:R=>y(R.target.value),placeholder:"搜索 Skills...",spellCheck:!1,autoComplete:"off","aria-label":"搜索 Skills"}),m?o.jsx("button",{type:"button",onClick:()=>y(""),"aria-label":"清空搜索",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),o.jsxs("div",{ref:g,className:"af-work-load-skills-menu",onScroll:D,children:[H.collectionGroups.map(R=>{const I=R.skills.map(E=>E.key),z=I.filter(E=>_.has(E)).length,P=I.length>0&&z===I.length,L=b.has(R.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:E=>M(I,E.target.checked),"aria-label":`选择 ${R.name}`}),o.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-toggle",onClick:()=>F(R.id),"aria-expanded":!L,children:o.jsxs("span",{className:"af-work-load-skills-menu__group-main",children:[o.jsx("span",{children:R.name}),R.description?o.jsx("em",{children:R.description}):null]})}),o.jsxs("small",{children:[z,"/",I.length]}),o.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-arrow",onClick:()=>F(R.id),"aria-label":L?`展开 ${R.name}`:`收起 ${R.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:R.skills.map(E=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:_.has(E.key),onChange:X=>M([E.key],X.target.checked)}),o.jsxs("span",{className:"af-work-load-skills-menu__option-main",children:[o.jsx("span",{className:"af-work-load-skills-menu__option-title",children:E.name}),E.description?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:E.description}):null]})]},`${R.id}:${E.key}`))})]},R.id)}),H.ungrouped.length>0?o.jsxs("section",{className:"af-work-load-skills-menu__group",children:[o.jsxs("div",{className:"af-work-load-skills-menu__group-head af-work-load-skills-menu__group-head--plain",children:[o.jsx("span",{children:"Ungrouped"}),o.jsx("small",{children:H.ungrouped.length})]}),o.jsx("div",{className:"af-work-load-skills-menu__options",children:H.ungrouped.map(R=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:_.has(R.key),onChange:I=>M([R.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:R.name}),R.description?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:R.description}):null]})]},`ungrouped:${R.key}`))})]}):null,H.collectionGroups.length===0&&H.ungrouped.length===0?o.jsx("div",{className:"af-work-load-skills-menu__empty",children:"没有匹配的 Skills"}):null,o.jsx("button",{type:"button",className:"af-work-load-skills-menu__clear",onClick:()=>a==null?void 0:a(e,[]),children:"清空"})]}),o.jsx("div",{ref:v,className:"af-work-load-skills-scrollbar"+(x.visible?" af-work-load-skills-scrollbar--visible":""),onPointerDown:O,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${x.height}%`,top:`${x.top}%`}})})]}):null]})]})}function hY({id:e,data:t,selected:n,deleteNode:r,servers:s=[],onChangeMcpNames:i}){const a=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],l=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],[c,d]=h.useState(!1),[f,u]=h.useState(""),p=h.useMemo(()=>new Set(lY(t)),[t]),m=h.useMemo(()=>(Array.isArray(s)?s:[]).map(k=>({name:String((k==null?void 0:k.name)||""),description:String((k==null?void 0:k.description)||""),detail:String((k==null?void 0:k.url)||[k==null?void 0:k.command,...Array.isArray(k==null?void 0:k.args)?k.args:[]].filter(Boolean).join(" ")||""),type:String((k==null?void 0:k.type)||"")})).filter(k=>k.name),[s]),y=h.useMemo(()=>{const k=f.trim().toLowerCase();return k?m.filter(g=>[g.name,g.description,g.detail,g.type].join(" ").toLowerCase().includes(k)):m},[f,m]),b=h.useCallback((k,g)=>{const v=new Set(p);for(const x of k)g?v.add(x):v.delete(x);i==null||i(e,Array.from(v))},[e,p,i]);return o.jsxs("div",{className:"af-work-load-skills-card"+(n?" af-work-load-skills-card--selected":""),children:[a.map((k,g)=>{if(k.showOnNode===!1)return null;const v=`${2.6+g*1.7}rem`,x=k.name||`#${g+1}`;return o.jsxs(h.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:v},children:x}),o.jsx(Fs,{type:"target",position:Ze.Left,id:`input-${g}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:v,background:or(k.type)},title:`${x} · ${k.type}`})]},`in-${g}`)}),l.map((k,g)=>{if(k.showOnNode===!1)return null;const v=`${2.6+g*1.7}rem`,x=k.name||`#${g+1}`;return o.jsxs(h.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:v},children:x}),o.jsx(Fs,{type:"source",position:Ze.Right,id:`output-${g}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:v,background:or(k.type)},title:`${x} · ${k.type}`})]},`out-${g}`)}),o.jsxs("div",{className:"af-work-load-skills-card__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"hub"}),o.jsx("strong",{children:(t==null?void 0:t.label)||"Load MCP"}),o.jsx("span",{children:(t==null?void 0:t.definitionId)||"control_load_mcp"}),o.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-work-load-skills-card__body nodrag",children:[o.jsxs("button",{type:"button",className:"af-work-load-skills-card__select",onClick:k=>{var g;k.stopPropagation(),c||(g=t==null?void 0:t.onRefreshMcps)==null||g.call(t),d(v=>!v)},children:[o.jsx("span",{children:p.size>0?`${p.size} MCP selected`:"选择 MCP"}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:c?"expand_less":"expand_more"})]}),c?o.jsxs("div",{className:"af-work-load-skills-menu-shell",onClick: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=>u(k.target.value),placeholder:"搜索 MCP...",spellCheck:!1,autoComplete:"off","aria-label":"搜索 MCP"}),f?o.jsx("button",{type:"button",onClick:()=>u(""),"aria-label":"清空搜索",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),o.jsxs("div",{className:"af-work-load-skills-menu",children:[o.jsxs("section",{className:"af-work-load-skills-menu__group",children:[o.jsxs("div",{className:"af-work-load-skills-menu__group-head af-work-load-skills-menu__group-head--plain",children:[o.jsx("span",{children:"MCP Servers"}),o.jsx("small",{children:y.length})]}),o.jsx("div",{className:"af-work-load-skills-menu__options",children:y.map(k=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:p.has(k.name),onChange:g=>b([k.name],g.target.checked)}),o.jsxs("span",{className:"af-work-load-skills-menu__option-main",children:[o.jsx("span",{className:"af-work-load-skills-menu__option-title",children:k.name}),k.description||k.detail?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:k.description||k.detail}):null]})]},k.name))})]}),y.length===0?o.jsx("div",{className:"af-work-load-skills-menu__empty",children:"没有匹配的 MCP"}):null,o.jsx("button",{type:"button",className:"af-work-load-skills-menu__clear",onClick:()=>i==null?void 0:i(e,[]),children:"清空"})]})]}):null]})]})}function mY(){var xd,wd;const{t:e,i18n:t}=Mn(),{navigate:n}=Ro(),r=wc(),s=u0(),i=h.useMemo(wq,[]),[a,l]=h.useState(()=>new URLSearchParams(window.location.search).get("view")==="display"?"display":"workspace"),[c,d]=h.useState(!1),[f,u]=h.useState(!1),[p,m]=nI([]),[y,b,k]=rI([]),g=h.useRef([]),v=h.useRef([]),[x,N]=h.useState(()=>Hb(null,[])),_=h.useRef(x),[C,T]=h.useState(null),H=h.useRef(null),[M,F]=h.useState([]),D=h.useRef(new Map),$=h.useRef(new Map),W=h.useRef(null),O=h.useRef(null),R=h.useRef(null),[I,z]=h.useState(null),[P,L]=h.useState({}),E=h.useRef({}),X=h.useRef(!1),ee=h.useRef(null),[V,ie]=h.useState([]),[fe,me]=h.useState(""),[ge,Z]=h.useState("nodes"),[ae,xe]=h.useState([]),[pe,_e]=h.useState(!1),[je,Ve]=h.useState(""),[et,qe]=h.useState(!1),[dt,He]=h.useState({name:"",id:"",description:""}),[bt,sn]=h.useState(!1),[on,an]=h.useState(""),[Yt,En]=h.useState(""),hn=h.useRef(null),[ue,ke]=h.useState(!1),[De,rt]=h.useState(!1),[at,Lt]=h.useState(""),[st,mn]=h.useState(null),[Zt,ar]=h.useState({title:"",layout:"gallery",nodeIds:[]}),[_n,gn]=h.useState(!1),[bn,lr]=h.useState(""),[ve,$e]=h.useState(!1),[nt,zt]=h.useState(""),[oe,Te]=h.useState(!1),[Ue,Ht]=h.useState("nodes"),[yn,cr]=h.useState(""),[Hs,as]=h.useState(0),[hr,Zn]=h.useState(""),Vr=h.useRef(""),[ot,Ur]=h.useState(null),Ai=h.useRef(null),[xa,xs]=h.useState(""),[Ie,cn]=h.useState([]),[mr,ht]=h.useState(""),[Oe,Kr]=h.useState(!0),[Gn,qr]=h.useState(""),[Cr,ut]=h.useState(()=>new Set),Ut=h.useRef(null),[un,Er]=h.useState(()=>{try{const S=Number(window.localStorage.getItem("agentflow.workspace.filesPaneHeight")||0);if(Number.isFinite(S)&&S>=160)return S}catch{}return 360}),[tt,gr]=h.useState(!1),[Bs,wa]=h.useState({cursor:[],opencode:[],claudeCode:[]}),[ws,Oo]=h.useState(""),[vr,$o]=h.useState([]),[Ii,xn]=h.useState(!1),[er,bs]=h.useState([]),[Yr,li]=h.useState([]),[Ws,K]=h.useState(!1),[we,Le]=h.useState([]),Me=h.useCallback(S=>{hn.current&&window.clearTimeout(hn.current),En(S),hn.current=window.setTimeout(()=>{En(""),hn.current=null},3800)},[]),Ke=h.useCallback(S=>{const A=String(S||"").trim();if(!A)return;const U=()=>s(A);window.requestAnimationFrame(U),window.setTimeout(U,80)},[s]);h.useEffect(()=>{try{window.localStorage.setItem("agentflow.workspace.filesPaneHeight",String(Math.round(un)))}catch{}},[un]);const en=h.useCallback(S=>{const A=Ut.current;if(!A)return;const U=A.getBoundingClientRect(),G=16,Q=150,se=230,re=U.top+G,le=U.bottom-G,he=Math.max(Q,le-re-se),ce=Math.min(Math.max(S-re,Q),he);Er(ce)},[]),Mt=h.useCallback(S=>{S.preventDefault(),S.stopPropagation(),gr(!0),en(S.clientY);const A=G=>{G.preventDefault(),en(G.clientY)},U=()=>{gr(!1),window.removeEventListener("pointermove",A,!0),window.removeEventListener("pointerup",U,!0),window.removeEventListener("pointercancel",U,!0)};window.addEventListener("pointermove",A,!0),window.addEventListener("pointerup",U,!0),window.addEventListener("pointercancel",U,!0)},[en]);h.useEffect(()=>()=>{hn.current&&window.clearTimeout(hn.current)},[]);const[wn,Gr]=h.useState(()=>new Set),[ls,Vs]=h.useState(!1),ur=h.useRef(null),ba=h.useRef(null),nd=h.useRef(null),[Pp,Ti]=h.useState({}),[va,wl]=h.useState(""),[_r,bl]=h.useState(!1),[vl,Kt]=h.useState([]),[vc,Bt]=h.useState([]),[kl,so]=h.useState("workspace"),[ci,Do]=h.useState(!1),[rd,Fo]=h.useState(!0),[kr,Sl]=h.useState(""),[ui,Ri]=h.useState({}),[kc,zo]=h.useState(!1),[ka,Ho]=h.useState(!1),[Nl,jl]=h.useState(!1),[sd,di]=h.useState("pan"),[Lr,id]=h.useState(null),[fi,Sa]=h.useState(""),Bo=h.useRef(null),vs=h.useRef(!1),[od,Xr]=h.useState(()=>new Set),[Na,pi]=h.useState({}),[ks,Pe]=h.useState(""),Ss=h.useMemo(()=>vq(i),[i]),[ja,Ca]=h.useState(""),hi=i.flowSource||"user",Ap=!!(i.flowId&&!i.archived&&(hi==="user"||hi==="workspace")),ad=h.useMemo(()=>{if(!i.flowId)return"/flow?panel=settings";const S=Df({id:i.flowId,source:hi,archived:!!i.archived},"pipeline"),[A,U=""]=S.split("?"),G=new URLSearchParams(U);return G.set("panel","settings"),`${A}?${G.toString()}`},[i.archived,i.flowId,hi]);h.useEffect(()=>{i.flowId&&oP(i.flowId,i.flowSource||"user","workspace",!!i.archived)},[i]),h.useEffect(()=>{const S=()=>{l(new URLSearchParams(window.location.search).get("view")==="display"?"display":"workspace")};return window.addEventListener("popstate",S),()=>window.removeEventListener("popstate",S)},[]),h.useEffect(()=>{Kt([]),Bt([]),so("workspace"),Fo(!0)},[i]);const Bn=h.useCallback(async()=>{const S=xo(i),A=await fetch(`/api/workspace/files?${S.toString()}`),U=await A.json();if(!A.ok)throw new Error(U.error||"读取 workspace 失败");const G=U.files||[];cn(G),ut(new Set(S2(G))),ht(U.root||"")},[i]),io=h.useCallback(async()=>{_e(!0),Ve("");try{const S=await fetch("/api/marketplace/flow-snippets"),A=await S.json().catch(()=>({}));if(!S.ok)throw new Error(A.error||"读取流程片段失败");xe(Array.isArray(A.snippets)?A.snippets:[])}catch(S){Ve(String(S.message||S)),xe([])}finally{_e(!1)}},[]),On=h.useCallback(async(S=p,A=y)=>{var se;if(!X.current)return;if(!Oe)throw Pe("Readonly workspace"),new Error("Readonly workspace");const U=Wh(S,A,E.current);U.ui={...U.ui||{},...H.current?{viewport:H.current}:{},displayPage:Tq(_.current,S)};const G=await fetch("/api/workspace/graph",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,graph:U})}),Q=await G.json();if(!G.ok)throw new Error(Q.error||"保存 workspace graph 失败");E.current=((se=Q.graph)==null?void 0:se.instances)||U.instances,L(E.current),Pe("Workspace graph saved")},[y,i,p,Oe]),Ip=h.useCallback(S=>{var U;const A=(U=S==null?void 0:S.extra)!=null&&U.instances&&typeof S.extra.instances=="object"?S.extra.instances:{};E.current=A,L(A),m(Array.isArray(S==null?void 0:S.nodes)?S.nodes:[]),b(Array.isArray(S==null?void 0:S.edges)?S.edges:[]),Zn(""),z(null)},[b,m]),ld=h.useMemo(()=>({instances:P}),[P]),cd=FT({nodes:p,edges:y,extra:ld,enabled:X.current,onRestore:Ip}),{resetHistory:Ea,undo:Tp,redo:Rp}=cd,gt=h.useCallback(async()=>{var yt,Xe;X.current=!1;const S=xo(i),A=xo(i);A.set("lang",String(t.language||"zh").startsWith("zh")?"zh":"en");const[U,G]=await Promise.all([fetch(`/api/nodes?${A.toString()}`),fetch(`/api/workspace/graph?${S.toString()}`),Bn()]),Q=await U.json(),se=await G.json();if(!U.ok)throw new Error(Q.error||"读取节点定义失败");if(!G.ok)throw new Error(se.error||"读取 workspace graph 失败");const re=[...(Array.isArray(Q)?Q:Q.nodes||[]).filter(_t=>!fq.has(_t.id)),hq,mq,pq];ie(re);const le=se.graph||JSON.parse(localStorage.getItem(dq)||"null")||{},he=zx(le,re),ce=Hb((yt=le==null?void 0:le.ui)==null?void 0:yt.displayPage,he.nodes),Ce=y2((Xe=le==null?void 0:le.ui)==null?void 0:Xe.viewport);E.current=he.instances,L(he.instances),m(he.nodes),b(he.edges),N(ce),_.current=ce,T(Ce),H.current=Ce,F([]),Ea(he.nodes,he.edges,{instances:he.instances});const Be=se.writable!==!1;Kr(Be),Pe(Be?"Workspace ready":"Readonly workspace"),X.current=!0},[i,t.language,Bn,Ea,b,m]),ud=h.useCallback(async(S,A)=>{const U={packageId:(S==null?void 0:S.newId)||(S==null?void 0:S.id)||(S==null?void 0:S.label),label:(S==null?void 0:S.label)||(S==null?void 0:S.newId)||(S==null?void 0:S.id),version:"1.0.0",definitionId:A,body:(S==null?void 0:S.body)||"",script:(S==null?void 0:S.script)||"",inputs:Array.isArray(S==null?void 0:S.inputs)?S.inputs:[],outputs:Array.isArray(S==null?void 0:S.outputs)?S.outputs:[],flowId:i.flowId,flowSource:i.flowSource||"user",archived:!!i.archived},G=await fetch("/api/marketplace/publish-node-from-instance",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(U)}),Q=await G.json().catch(()=>({}));if(!G.ok||(Q==null?void 0:Q.ok)===!1)throw new Error((Q==null?void 0:Q.error)||"Publish failed");return await gt(),Pe(`Published node ${Q.definitionId||Q.id||U.packageId}`),Q},[i,gt]),Lp=h.useCallback((S="workspace")=>{Do(!0),Ur(null),so(S||"workspace")},[]),Cl=h.useCallback(async(S="")=>{const A=String(S||fi||"").trim();vs.current=!0,Bo.current&&(Bo.current.abort(),Bo.current=null),Sa(""),Xr(new Set),pi(U=>{const G={...U};for(const[Q,se]of Object.entries(G))(se==null?void 0:se.status)==="running"&&(G[Q]={status:"stopped"});return A&&(G[A]={status:"stopped"}),G}),Pe(A?`Workspace run stopped: ${A}`:"Workspace run stopped"),Bt(U=>U.map(G=>(!A||G.runNodeId===A)&&G.status==="running"?{...G,status:"stopped",endedAt:Date.now(),messages:[...Array.isArray(G.messages)?G.messages:[],{role:"assistant",kind:"status",text:"Workspace run stopped.",at:Date.now()}].slice(-160)}:G));try{await fetch("/api/workspace/run/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,runNodeId:A})})}catch{}},[i,fi]),vt=h.useCallback(async()=>{if(i.flowId)try{const S=xo(i),A=await fetch(`/api/workspace/run/status?${S.toString()}`),U=await A.json().catch(()=>({}));if(!A.ok||!U.running)return;const G=String(U.runNodeId||"").trim();G?(Sa(G),Xr(new Set([G])),pi(Q=>({...Q,[G]:{status:"running"}})),Pe(`Workspace run still running: ${G}`)):Pe("Workspace run still running"),Bt(Q=>{if(Q.some(re=>re.status==="running"&&(!G||re.runNodeId===G)))return Q;const se=`run-restored-${U.startedAt||Date.now()}`;return[...Q.slice(-7),{id:se,label:G?`Run ${G}`:"Workspace Run",runNodeId:G,status:"running",startedAt:U.startedAt||Date.now(),steps:G?[{id:G,label:G,status:"running"}]:[],messages:[{role:"assistant",kind:"run-summary",text:"Workspace run is still running in the background.",at:Date.now()}]}]})}catch{}},[i]),Mp=h.useCallback(async S=>{if(!Oe){Pe("Readonly workspace");return}if(!S||fi)return;let A=p,U=y,G=E.current;const Q=Ai.current;if(Q!=null&&Q.id){const ce=A.find(Be=>Be.id===Q.id),Ce=$1({nodes:A,edges:U,instances:G,selectedNode:ce,draft:Q,allowRename:!1});if(Ce!=null&&Ce.error){xs(Ce.error),Pe(Ce.error);return}Ce!=null&&Ce.ok&&Ce.changed&&(A=Ce.nodes,U=Ce.edges,G=Ce.instances,E.current=G,L(G),m(A),b(U),Ke(Ce.nextId||Q.id))}const se=Wh(A,U,G),re=`run-${Date.now()}-${String(S).replace(/[^a-z0-9_-]+/gi,"_")}`,le=`Run ${S}`,he=new AbortController;Bo.current=he,vs.current=!1,Sa(S),Xr(new Set([S])),pi({[S]:{status:"running"}}),Pe(`Running ${S}...`),so(re),Bt(ce=>[...ce.slice(-7),{id:re,label:le,runNodeId:S,status:"running",startedAt:Date.now(),steps:[],messages:[{role:"assistant",kind:"run-summary",text:"准备运行...",at:Date.now()}]}]);try{await On(A,U);const ce=await fetch("/api/workspace/run",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/x-ndjson"},signal:he.signal,body:JSON.stringify({...i,graph:se,runNodeId:S,model:ws,selectedSkills:er,stream:!0})});if(!ce.ok){const Se=await ce.json().catch(()=>({}));throw new Error(Se.error||"Workspace run failed")}if(!ce.body)throw new Error("Workspace run stream unavailable");const Ce=ce.body.getReader(),Be=new TextDecoder;let yt="",Xe=[],_t=[],kn=S;const us=(Se,lt)=>{var It,tn;const ft=p.find(Jt=>Jt.id===Se),pt=String(((It=ft==null?void 0:ft.data)==null?void 0:It.label)||Se||"").trim(),Re=String(lt||((tn=ft==null?void 0:ft.data)==null?void 0:tn.definitionId)||"").trim();return Re&&Re!==pt?`${pt} (${Re})`:pt},ln=(Se,lt,ft)=>{const pt=String(Se||"").trim();pt&&Bt(Re=>Re.map(It=>{if(It.id!==re)return It;const Jt=[...Array.isArray(It.steps)?It.steps:[]],$n=Jt.findIndex(Mr=>Mr.id===pt),Vn={id:pt,label:us(pt,lt),status:ft};$n>=0?Jt[$n]={...Jt[$n],...Vn}:Jt.push(Vn);const Dt=Jt.map((Mr,Dl)=>{const Ia=Mr.status==="done"?"[done]":Mr.status==="failed"?"[failed]":"[running]";return`${Dl+1}. ${Ia} ${Mr.label}`}).join(`
|
|
172
|
+
`),nn=Array.isArray(It.messages)?It.messages:[],Zr=nn.findIndex(Mr=>Mr.kind==="run-summary"),Ns={role:"assistant",kind:"run-summary",text:Dt||"准备运行...",at:Date.now()},Gs=[...nn];return Zr>=0?Gs[Zr]=Ns:Gs.unshift(Ns),{...It,steps:Jt,messages:Gs.slice(-160)}}))},fn=Se=>{const lt=String(Se||"").trim();if(!lt)return;const ft=kn;kn=lt,Xr(new Set([lt])),pi(pt=>{var Re;return{...pt,...ft&&ft!==lt&&((Re=pt[ft])==null?void 0:Re.status)==="running"?{[ft]:{status:"success"}}:{},[lt]:{status:"running"}}})},rr=Se=>{const lt=String(Se||"").trim();lt&&(Xr(ft=>{const pt=new Set(ft);return pt.delete(lt),pt}),pi(ft=>({...ft,[lt]:{status:"success"}})))},Tt=(Se,lt)=>{const ft=String(lt||"");if(!ft.trim())return;const pt=["assistant","thinking","result","error","prompt"].includes(Se)?Se:"assistant";Bt(Re=>Re.map(It=>{if(It.id!==re)return It;let tn=Array.isArray(It.messages)?It.messages:[];if(pt==="result"){const Vn=[...tn].reverse().find(Dt=>Dt.kind==="assistant");if(String((Vn==null?void 0:Vn.text)||"").trim()===ft.trim())return It}if(pt==="assistant"){const Vn=tn.findIndex(Dt=>Dt.kind==="result"&&String(Dt.text||"").trim()===ft.trim());Vn>=0&&(tn=tn.filter((Dt,nn)=>nn!==Vn))}const Jt=[...tn],$n=Jt[Jt.length-1];return $n&&$n.kind===pt&&!$n.error?Jt[Jt.length-1]={...$n,text:`${$n.text||""}${$n.text?`
|
|
173
|
+
`:""}${ft}`}:Jt.push({role:"assistant",kind:pt,text:ft,...pt==="error"?{error:!0}:{},at:Date.now()}),{...It,messages:Jt.slice(-160)}}))},$t=Se=>{const lt=String(Se||"");lt.trim()&&Bt(ft=>ft.map(pt=>{var Jt;if(pt.id!==re)return pt;const Re=Array.isArray(pt.messages)?pt.messages:[],It=Re.findIndex($n=>$n.kind==="thinking"),tn=[...Re];if(It>=0){const $n=String(((Jt=tn[It])==null?void 0:Jt.text)||"");tn[It]={...tn[It],text:`${$n}${$n&&!$n.endsWith(`
|
|
174
|
+
`),""}${lt}`,at:Date.now()}}else{const $n=tn.findIndex(Vn=>Vn.kind==="activity");tn.splice($n>=0?$n+1:tn.length,0,{role:"assistant",kind:"thinking",text:lt,at:Date.now()})}return{...pt,messages:tn.slice(-160)}}))},We=(Se,lt=null)=>{const ft=jq(Se);ft&&Bt(pt=>pt.map(Re=>{if(Re.id!==re)return Re;const It=Number(lt==null?void 0:lt.ts)||Date.now(),tn=Number(Re.startedAt)||It,Jt=Number(Re.lastActivityAt)||tn,$n=Math.max(0,It-Jt),Vn=Number.isFinite(Number(lt==null?void 0:lt.runElapsedMs))?Math.max(0,Number(lt.runElapsedMs)):Math.max(0,It-tn),Dt=Array.isArray(Re.activities)?Re.activities:[],nn=Dt[Dt.length-1],Ns=(typeof nn=="string"?nn:String((nn==null?void 0:nn.text)||""))===ft?Dt:[...Dt,{text:ft,stepMs:$n,totalMs:Vn,at:It}].slice(-8),Gs=Array.isArray(Re.messages)?Re.messages:[],Mr=Gs.findIndex(Ta=>Ta.kind==="activity"),Dl={role:"assistant",kind:"activity",text:Ns.map((Ta,bd)=>Cq(Ta,bd)).join(`
|
|
175
|
+
`),at:Date.now()},Ia=[...Gs];if(Mr>=0)Ia[Mr]=Dl;else{const Ta=Ia.findIndex(bd=>bd.kind==="run-summary");Ia.splice(Ta>=0?Ta+1:0,0,Dl)}return{...Re,activities:Ns,lastActivityAt:It,messages:Ia.slice(-160)}}))},Ct=Se=>{const lt=String((Se==null?void 0:Se.source)||"runner"),ft=String((Se==null?void 0:Se.stream)||""),pt=String((Se==null?void 0:Se.eventType)||"event"),Re=String((Se==null?void 0:Se.text)||"").trim();if(!Re)return;const It=`[${lt}${ft?`:${ft}`:""}] ${pt}
|
|
176
|
+
${Re}`;Bt(tn=>tn.map(Jt=>{if(Jt.id!==re)return Jt;const Vn=[...Array.isArray(Jt.rawTrace)?Jt.rawTrace:[],It].slice(-80),Dt=Array.isArray(Jt.messages)?Jt.messages:[],nn=Dt.findIndex(Gs=>Gs.kind==="raw"),Zr={role:"assistant",kind:"raw",text:Vn.join(`
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
`),at:Date.now()},Ns=[...Dt];return nn>=0?Ns[nn]=Zr:Ns.push(Zr),{...Jt,rawTrace:Vn,messages:Ns.slice(-160)}}))},Pr=Se=>{Bt(lt=>lt.map(ft=>ft.id===re?{...ft,status:Se,endedAt:Date.now()}:ft))},Aa=Se=>{const lt=new Set,ft=String((Se==null?void 0:Se.nodeId)||"").trim();ft&<.add(ft);for(const pt of Array.isArray(Se==null?void 0:Se.displayNodeIds)?Se.displayNodeIds:[]){const Re=String(pt||"").trim();Re&<.add(Re)}for(const pt of Array.isArray(Se==null?void 0:Se.touchedNodeIds)?Se.touchedNodeIds:[]){const Re=String(pt||"").trim();Re&<.add(Re)}if(lt.size===0)for(const pt of Array.isArray(Se==null?void 0:Se.order)?Se.order:[]){const Re=String(pt||"").trim();Re&<.add(Re)}return lt},$l=(Se,lt=null)=>{const ft=zx(Se||se,V),pt=new Map(ft.nodes.map(tn=>[tn.id,tn])),Re=ft.instances||{},It=lt instanceof Set?lt:null;m(tn=>{const Jt=new Set(tn.map(Dt=>Dt.id)),Vn={...Wh(tn,v.current,E.current).instances||{}};for(const[Dt,nn]of Object.entries(Re)){if(It&&!It.has(Dt)||!Jt.has(Dt))continue;const Zr=Vn[Dt];Kn((nn==null?void 0:nn.definitionId)||(Zr==null?void 0:Zr.definitionId))?Vn[Dt]=nn:Array.isArray(nn==null?void 0:nn.output)&&(Vn[Dt]={...Zr||nn,output:nn.output})}return E.current=Vn,L(Vn),tn.map(Dt=>{var Zr,Ns,Gs;if(It&&!It.has(Dt.id))return Dt;const nn=pt.get(Dt.id);return nn?Kn(((Zr=nn.data)==null?void 0:Zr.definitionId)||((Ns=Dt.data)==null?void 0:Ns.definitionId))?{...Dt,data:{...Dt.data,...nn.data}}:Array.isArray((Gs=nn.data)==null?void 0:Gs.outputs)?{...Dt,data:{...Dt.data,outputs:nn.data.outputs}}:Dt:Dt})})};for(;;){const{value:Se,done:lt}=await Ce.read();if(lt)break;yt+=Be.decode(Se,{stream:!0});const ft=yt.split(`
|
|
181
|
+
`);yt=ft.pop()||"";for(const pt of ft){if(!pt.trim())continue;const Re=JSON.parse(pt);if(Re.type==="error")throw new Error(Re.error||"Workspace run failed");if(Re.type==="stopped"){vs.current=!0,Xe=Array.isArray(Re.order)?Re.order:Xe,We("运行停止",Re);continue}if(Re.type==="node-start"&&(Pe(`Running ${Re.nodeId}...`),fn(Re.nodeId),ln(Re.nodeId,Re.definitionId,"running")),Re.type==="node-done"&&(rr(Re.nodeId),ln(Re.nodeId,Re.definitionId,"done")),Re.type==="status"&&We(Re.line||Re.message||"",Re),Re.type==="paused"&&(_t=Array.isArray(Re.nodeIds)?Re.nodeIds:[],We("运行暂停",Re)),Re.type==="natural"&&(Re.kind==="thinking"?$t(Re.text||""):Tt(Re.kind,Re.text||"")),Re.type==="raw"){const It=E1(Re);It&&$t(It),Ct(Re)}Re.type==="graph"&&Re.graph&&$l(Re.graph,Aa(Re)),Re.type==="done"&&(Re.graph&&$l(Re.graph,Aa(Re)),Xe=Array.isArray(Re.order)?Re.order:[],_t=Array.isArray(Re.pauseNodeIds)?Re.pauseNodeIds:_t,We(_t.length?"运行暂停":"运行完成",Re))}}if(yt.trim()){const Se=JSON.parse(yt);if(Se.type==="error")throw new Error(Se.error||"Workspace run failed");if(Se.type==="stopped"&&(vs.current=!0,We("运行停止",Se)),Se.type==="node-start"&&(Pe(`Running ${Se.nodeId}...`),fn(Se.nodeId),ln(Se.nodeId,Se.definitionId,"running")),Se.type==="node-done"&&(rr(Se.nodeId),ln(Se.nodeId,Se.definitionId,"done")),Se.type==="status"&&We(Se.line||Se.message||"",Se),Se.type==="paused"&&(_t=Array.isArray(Se.nodeIds)?Se.nodeIds:[],We("运行暂停",Se)),Se.type==="natural"&&(Se.kind==="thinking"?$t(Se.text||""):Tt(Se.kind,Se.text||"")),Se.type==="raw"){const lt=E1(Se);lt&&$t(lt),Ct(Se)}Se.type==="graph"&&Se.graph&&$l(Se.graph,Aa(Se)),Se.type==="done"&&(Se.graph&&$l(Se.graph,Aa(Se)),Xe=Array.isArray(Se.order)?Se.order:[],_t=Array.isArray(Se.pauseNodeIds)?Se.pauseNodeIds:_t,We(_t.length?"运行暂停":"运行完成",Se))}vs.current&&(Xr(new Set),pi(Se=>{var ft;const lt=((ft=Object.entries(Se).find(([,pt])=>(pt==null?void 0:pt.status)==="running"))==null?void 0:ft[0])||S;return lt?{...Se,[lt]:{status:"stopped"}}:Se})),Pe(vs.current?`Workspace run stopped: ${S}`:_t.length?`Workspace run paused at ${_t.join(", ")}`:`Workspace run done: ${Xe.length?Xe.join(" -> "):S}`),Pr(vs.current?"stopped":_t.length?"paused":"done"),vs.current||await Bn()}catch(ce){if(vs.current||(ce==null?void 0:ce.name)==="AbortError"){Xr(new Set),pi(Ce=>{var yt;const Be=((yt=Object.entries(Ce).find(([,Xe])=>(Xe==null?void 0:Xe.status)==="running"))==null?void 0:yt[0])||S;return Be?{...Ce,[Be]:{status:"stopped"}}:Ce}),Pe(`Workspace run stopped: ${S}`),Bt(Ce=>Ce.map(Be=>Be.id===re?{...Be,status:"stopped",endedAt:Date.now()}:Be));return}Xr(new Set),pi(Ce=>{var yt;const Be=(yt=Object.entries(Ce).find(([,Xe])=>(Xe==null?void 0:Xe.status)==="running"))==null?void 0:yt[0];return Be?{...Ce,[Be]:{status:"failed"}}:Ce}),Pe(String(ce.message||ce)),Bt(Ce=>Ce.map(Be=>Be.id===re?{...Be,status:"failed",endedAt:Date.now(),messages:[...Array.isArray(Be.messages)?Be.messages:[],{role:"assistant",error:!0,text:String(ce.message||ce),at:Date.now()}].slice(-160)}:Be))}finally{Bo.current===he&&(Bo.current=null),Sa(""),Xr(new Set)}},[ws,y,i,Bn,p,V,Ke,fi,On,er,b,m,Oe]),mi=h.useCallback(async()=>{try{const A=await(await fetch("/api/skills")).json().catch(()=>({})),U=Array.isArray(A.skills)?A.skills.map(G=>({key:String(G.key),name:String(G.name||G.id||G.key),description:G.description?String(G.description):"",sourceLabel:G.sourceLabel?String(G.sourceLabel):""})):[];$o(U),xn(!0)}catch{xn(!0)}},[]),El=h.useCallback(async()=>{try{const A=await(await fetch("/api/mcps")).json().catch(()=>({})),U=Array.isArray(A.servers)?A.servers.map(G=>({name:String((G==null?void 0:G.name)||""),type:String((G==null?void 0:G.type)||""),url:String((G==null?void 0:G.url)||""),command:String((G==null?void 0:G.command)||""),args:Array.isArray(G==null?void 0:G.args)?G.args.map(String):[],description:String((G==null?void 0:G.description)||"")})).filter(G=>G.name):[];Le(U)}catch{Le([])}},[]);h.useEffect(()=>{gt().catch(S=>Pe(String(S.message||S))),io(),fetch("/api/model-lists").then(S=>S.json()).then(S=>wa({cursor:Array.isArray(S.cursor)?S.cursor.map(String):[],opencode:Array.isArray(S.opencode)?S.opencode.map(String):[],claudeCode:Array.isArray(S.claudeCode)?S.claudeCode.map(String):[]})).catch(()=>{}),mi(),El(),vt(),fetch("/api/skill-collections").then(S=>S.json()).then(S=>{li(rl(S)),K(!0)}).catch(()=>{}),fetch("/api/auth/me").then(S=>S.json()).then(S=>id(S.user||null)).catch(()=>id(null))},[gt,io,El,mi,vt,Ss]),h.useEffect(()=>{if(Ca(""),!(!Ii||!Ws)){if(!Ss){bs([]);return}bs(uP(Ss,"workspace",vr,Yr)),Ca(Ss)}},[Yr,Ws,vr,Ii,Ss]),h.useEffect(()=>{if(!(ja!==Ss||!Ss))try{localStorage.setItem(Ss,JSON.stringify(er))}catch{}},[er,Ss,ja]),h.useEffect(()=>{E.current=P},[P]),h.useEffect(()=>{g.current=p},[p]),h.useEffect(()=>{const S=D.current,A=new Map,U=[];for(const re of p){const le=g2(re);A.set(re.id,le),S.get(re.id)!==le&&U.push(re.id)}if(D.current=A,U.length===0)return;const G=()=>U.forEach(re=>s(re)),Q=window.requestAnimationFrame(G),se=window.setTimeout(G,80);return()=>{window.cancelAnimationFrame(Q),window.clearTimeout(se)}},[p,s]),h.useEffect(()=>{v.current=y},[y]),h.useEffect(()=>{_.current=x},[x]),h.useEffect(()=>{H.current=C},[C]),h.useEffect(()=>{Ai.current=ot},[ot]),h.useEffect(()=>{Vr.current=hr},[hr]),h.useEffect(()=>{R.current=I},[I]),h.useEffect(()=>{if(!I)return;const S=U=>{U.key==="Escape"&&z(null)},A=U=>{var G,Q;(Q=(G=U.target)==null?void 0:G.closest)!=null&&Q.call(G,".af-connect-node-menu")||z(null)};return document.addEventListener("keydown",S),document.addEventListener("pointerdown",A),()=>{document.removeEventListener("keydown",S),document.removeEventListener("pointerdown",A)}},[I]),h.useEffect(()=>{if(X.current&&Oe)return ee.current&&window.clearTimeout(ee.current),ee.current=window.setTimeout(()=>{On().catch(S=>Pe(String(S.message||S)))},650),()=>{ee.current&&window.clearTimeout(ee.current)}},[p,y,x,On,Oe]);const Sc=h.useCallback((S,A)=>{if(!Oe){Pe("Readonly workspace");return}const U=aY(A),G=he=>Array.isArray(he)?he.map(ce=>(ce==null?void 0:ce.name)!=="skillKeys"&&(ce==null?void 0:ce.name)!=="skillsContext"&&(ce==null?void 0:ce.type)!=="text"?ce:{...ce,default:U,value:U}):[],Q=p.map(he=>{var ce;return he.id!==S?he:{...he,data:{...he.data,body:U,inputs:G((ce=he.data)==null?void 0:ce.inputs)}}}),se=E.current||{},re=se[S]&&typeof se[S]=="object"?se[S]:{},le={...se,[S]:{...re,body:U,input:G(re.input)}};E.current=le,m(Q),L(le),Ur(he=>!he||he.id!==S?he:{...he,body:U,inputs:G(he.inputs)}),On(Q,y).catch(he=>Pe(String(he.message||he)))},[y,p,On,m,Oe]),yy=h.useCallback((S,A)=>{if(!Oe){Pe("Readonly workspace");return}const U=cY(A),G=he=>Array.isArray(he)?he.map(ce=>(ce==null?void 0:ce.name)!=="serverNames"&&(ce==null?void 0:ce.name)!=="mcpContext"&&(ce==null?void 0:ce.type)!=="text"?ce:{...ce,default:U,value:U}):[],Q=p.map(he=>{var ce;return he.id!==S?he:{...he,data:{...he.data,body:U,inputs:G((ce=he.data)==null?void 0:ce.inputs)}}}),se=E.current||{},re=se[S]&&typeof se[S]=="object"?se[S]:{},le={...se,[S]:{...re,body:U,input:G(re.input)}};E.current=le,m(Q),L(le),Ur(he=>!he||he.id!==S?he:{...he,body:U,inputs:G(he.inputs)}),On(Q,y).catch(he=>Pe(String(he.message||he)))},[y,p,On,m,Oe]),gi=h.useCallback(S=>{const A=String(S||"").trim();A&&(Sl(U=>U===A?"":A),Ri(U=>({...U,[A]:U[A]||{sessionId:`nodechat_${Date.now()}_${A.replace(/[^a-z0-9_-]+/gi,"_")}`,messages:[],draft:"",candidateContent:"",running:!1,error:""}})))},[]),Op=h.useCallback((S,A)=>{const U=String(S||"").trim();U&&Ri(G=>({...G,[U]:{...G[U]||{sessionId:`nodechat_${Date.now()}_${U.replace(/[^a-z0-9_-]+/gi,"_")}`,messages:[]},draft:String(A||""),error:""}}))},[]),dr=h.useCallback((S,A,U="replace",G={})=>{var fn,rr;if(!Oe){Pe("Readonly workspace");return}const Q=String(S||"").trim();if(!Q)return;const se=g.current.find(Tt=>Tt.id===Q),re=Kn((fn=se==null?void 0:se.data)==null?void 0:fn.definitionId),le=aa(A),he=re==="html"?Xu(le):String(le||""),ce=se?sc(se.data):"",Ce=U==="append"&&String(ce||"").trim()?`${String(ce).replace(/\s+$/g,"")}
|
|
182
|
+
|
|
183
|
+
${he.trim()}`:he,Be=re==="image"?"src":"content",yt=G!=null&&G.reloadDisplay?Date.now():(rr=se==null?void 0:se.data)==null?void 0:rr.displayReloadKey,Xe=Tt=>{let $t=!1;return(Array.isArray(Tt)?Tt:[]).map(Ct=>{const Pr=String((Ct==null?void 0:Ct.name)||""),Aa=String((Ct==null?void 0:Ct.type)||"");return Pr===Be||Pr==="filePath"||Aa==="text"?$t?{...Ct,default:"",value:""}:($t=!0,{...Ct,default:Ce,value:Ce}):Ct})},_t=g.current.map(Tt=>{var $t,We;return Tt.id!==Q?Tt:{...Tt,data:{...Tt.data,body:Ce,...yt?{displayReloadKey:yt}:{},inputs:Xe(($t=Tt.data)==null?void 0:$t.inputs),outputs:Xe((We=Tt.data)==null?void 0:We.outputs)}}}),kn=E.current||{},us=kn[Q]&&typeof kn[Q]=="object"?kn[Q]:{},ln={...kn,[Q]:{...us,body:Ce,input:Xe(us.input),output:Xe(us.output)}};E.current=ln,m(_t),L(ln),Ur(Tt=>(Tt==null?void 0:Tt.id)===Q?{...Tt,body:Ce}:Tt),(G==null?void 0:G.logChat)!==!1&&Ri(Tt=>{var $t;return{...Tt,[Q]:{...Tt[Q]||{},candidateContent:"",messages:[...($t=Tt[Q])!=null&&$t.messages&&Array.isArray(Tt[Q].messages)?Tt[Q].messages:[],{role:"assistant",text:U==="append"?"已追加到当前节点内容。":"已替换当前节点内容。",at:Date.now()}]}}}),On(_t,v.current).catch(Tt=>Pe(String(Tt.message||Tt))),Pe(String((G==null?void 0:G.statusMessage)||"")||(U==="append"?"已追加节点内容":"已替换节点内容"))},[On,m,Oe]),oo=h.useCallback(async S=>{if(!Oe)return Pe("Readonly workspace"),"";if(!gg(S))return Pe("请选择图片文件"),"";try{const A=new FormData;A.set("file",S),A.set("dir","img"),i.flowId&&A.set("flowId",i.flowId),i.flowSource&&A.set("flowSource",i.flowSource),i.archived&&A.set("archived","1");const U=await fetch("/api/workspace/upload",{method:"POST",body:A}),G=await U.json().catch(()=>({}));if(!U.ok)throw new Error(G.error||"上传图片失败");const Q=String(G.path||"").trim();if(!Q)throw new Error("上传图片失败:未返回路径");return await Bn(),ut(se=>{const re=new Set(se);for(const le of Vh(Q))re.delete(le);return re}),Pe(`已上传图片 ${Q}`),Q}catch(A){return Pe(String(A.message||A)),""}},[i,Bn,Oe]),dd=h.useCallback(async(S,A)=>{const U=String(S||"").trim();if(!U)return;const G=await oo(A);G&&dr(U,G,"replace",{logChat:!1,statusMessage:`已上传图片 ${G}`})},[dr,oo]),$p=h.useCallback((S,A="replace")=>{var Q;const U=String(S||"").trim(),G=String(((Q=ui[U])==null?void 0:Q.candidateContent)||"").trim();!U||!G||dr(U,G,A)},[ui,dr]),_l=h.useCallback(async(S,A=void 0)=>{var _t,kn,us;if(!Oe){Pe("Readonly workspace");return}const U=String(S||"").trim();if(!U)return;const G=ui[U]||{},Q=String(A!==void 0?A:G.draft||"").trim();if(!Q||G.running)return;const se=g.current.find(ln=>ln.id===U);if(!se)return;const re=Kn((_t=se.data)==null?void 0:_t.definitionId)||"markdown",le=sc(se.data);let he=Hu(le,re),ce=aa(le);if(he)try{ce=await Bu(i,he)}catch(ln){Pe(String(ln.message||ln))}else if(re!=="image"&&String(ce||"").trim()){const ln=Ql(re,ce);if(ln){Pe(`${ln} 未进入微调。`);return}try{const fn=await Bb(i,L1(U,se.data),ce);await Bn(),dr(U,fn,"replace",{logChat:!1,reloadDisplay:!0,statusMessage:`已将展示保存为 ${fn}`}),he=fn,ce=""}catch(fn){Pe(String(fn.message||fn));return}}const Ce=Oq(U,g.current,v.current),Be={role:"user",text:Q,at:Date.now()},yt=Array.isArray(G.messages)?G.messages:[],Xe=G.sessionId||`nodechat_${Date.now()}_${U.replace(/[^a-z0-9_-]+/gi,"_")}`;Ri(ln=>({...ln,[U]:{...G,sessionId:Xe,messages:[...yt,Be],draft:"",running:!0,error:""}}));try{const ln=await fetch("/api/workspace/node-chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,sessionId:Xe,node:{id:U,label:((kn=se.data)==null?void 0:kn.label)||U,definitionId:((us=se.data)==null?void 0:us.definitionId)||""},nodeKind:re,currentContent:he?"":ce,sourceContext:Ce,targetFilePath:he,messages:yt,message:Q,model:ws})}),fn=await ln.json().catch(()=>({}));if(!ln.ok)throw new Error(fn.error||"节点微调失败");const rr=String(fn.candidateContent||fn.reply||"").trim(),Tt=!!fn.directFileEdit,$t=String(fn.artifactPath||he||"").trim();if(Tt&&$t){const We=Ql(re,rr);if(We)throw new Error(`${We} 文件已由 agent 修改,请检查 ${$t}。`);await Bn(),dr(U,$t,"replace",{logChat:!1,reloadDisplay:!0,statusMessage:`已按微调描述更新 ${$t}`})}else if(rr){const We=Ql(re,rr);if(We)throw new Error(`${We} 已取消写入,避免覆盖当前展示文件。`);if(he){const Ct=await Bb(i,he,rr);await Bn(),dr(U,Ct,"replace",{logChat:!1,statusMessage:`已按微调描述更新 ${Ct}`})}else dr(U,rr,"replace",{logChat:!1,statusMessage:"已按微调描述更新展示内容"})}Ri(We=>{var Ct;return{...We,[U]:{...We[U]||{},sessionId:String(fn.sessionId||Xe),running:!1,candidateContent:"",messages:[...(Ct=We[U])!=null&&Ct.messages&&Array.isArray(We[U].messages)?We[U].messages:[...yt,Be],{role:"assistant",text:rr||Tt?$t?`已更新文件 ${$t}。`:"已按你的描述更新当前展示。":"没有生成可更新的内容。",at:Date.now()}]}}})}catch(ln){const fn=String(ln.message||ln);Ri(rr=>({...rr,[U]:{...rr[U]||{},running:!1,error:fn}})),Pe(fn)}},[ws,i,Bn,ui,dr,Oe]),Dp=h.useCallback(async(S,A)=>{if(!Oe){Pe("Readonly workspace");return}const U=Kn(A==null?void 0:A.definitionId)||"markdown",G=sc(A),Q=Hu(G,U);let se=aa(G);if(Q)try{se=await Bu(i,Q)}catch(ce){Pe(String(ce.message||ce));return}if(!String(se||"").trim()){Pe("展示节点没有可保存内容");return}const re=Ql(U,se);if(re){Pe(`${re} 未保存文件。`);return}const le=L1(S,A),he=window.prompt("保存到 workspace 相对路径",le);if(he)try{const ce=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:he,content:se})}),Ce=await ce.json().catch(()=>({}));if(!ce.ok)throw new Error(Ce.error||"保存文件失败");const Be=Ce.path||he,yt=xo(i);yt.set("path",Be);const Xe=await fetch(`/api/workspace/file?${yt.toString()}`);if(!Xe.ok){const _t=await Xe.json().catch(()=>({}));throw new Error(_t.error||`保存后读取失败:${Be}`)}await Bn(),cn(_t=>sY(_t,Be,String(se||"").length)),ut(_t=>{const kn=new Set(_t);for(const us of Vh(Be))kn.delete(us);return kn}),dr(S,Be,"replace",{logChat:!1,statusMessage:`已保存并引用 ${Be}`}),Pe(`已保存 ${Be}`)}catch(ce){Pe(String(ce.message||ce))}},[i,Bn,dr,Oe]),fd=h.useCallback((S,A)=>{const U=String(S||"");U&&Ur(G=>{if(!G||G.id!==U)return G;const Q=typeof A=="function"?A(G):A;return!Q||typeof Q!="object"?G:{...G,...Q}})},[]),Us=h.useMemo(()=>p.map(S=>{var A,U;return{...S,data:{...S.data,selected:S.selected===!0,modelLists:Bs,showBodyPreview:!0,isExecuting:od.has(S.id),nodeStatus:((A=Na[S.id])==null?void 0:A.status)??null,nodeElapsed:((U=Na[S.id])==null?void 0:U.elapsed)??null,flowParams:i,readOnly:!Oe,onRunWorkspaceNode:Mp,onStopWorkspaceNode:Cl,runningRunNodeId:fi,skills:vr,skillCollections:Yr,onChangeLoadSkillKeys:Sc,onRefreshSkills:mi,mcpServers:we,onChangeLoadMcpNames:yy,onRefreshMcps:El,onSaveDisplayNodeToFile:Dp,onUploadWorkspaceImage:oo,onUploadImageToDisplayNode:dd,onStatus:Pe,nodeChatActive:kr===S.id,nodeChat:ui[S.id]||null,onSetDisplayNodeContent:dr,onToggleNodeChat:gi,onCloseNodeChat:()=>Sl(""),onUpdateNodeChatDraft:Op,onSendNodeChat:_l,onApplyNodeChatCandidate:$p,onSyncNodePropDraft:fd}}}),[kr,$p,yy,Sc,i,we,Bs,ui,p,El,mi,Mp,fi,Dp,_l,dr,Yr,vr,Cl,fd,gi,Op,dd,oo,od,Na,Oe]),Fp=h.useMemo(()=>new Map(Us.map(S=>[S.id,S])),[Us]),Pl=h.useMemo(()=>{const S=new Set(M);return x.nodeIds.map((A,U)=>{var le;const G=Fp.get(A);if(!G||!Kn((le=G.data)==null?void 0:le.definitionId))return null;const Q=Uc(G)||{width:520,height:320},se=bu(x.nodeSizes[A]||Q,{display:!0})||Q,re=x.nodePositions[A]||{x:180+U*36,y:120+U*28};return{...G,id:T1(A),position:re,selected:S.has(A),width:se.width,height:se.height,data:{...G.data,sourceNodeId:A,displayPageMode:!0,readOnly:!0,selected:S.has(A),displaySize:se,nodeSize:se}}}).filter(Boolean)},[x,Fp,M]),Li=h.useMemo(()=>Us.filter(S=>{var A;return Kn((A=S==null?void 0:S.data)==null?void 0:A.definitionId)}),[Us]),mt=a==="display";h.useEffect(()=>{if(!mt||!x.viewport)return;const S=x.viewport,A=()=>{try{r.setViewport(S,{duration:0})}catch{}},U=window.requestAnimationFrame(()=>window.requestAnimationFrame(A));return()=>window.cancelAnimationFrame(U)},[x.viewport,mt,r]),h.useEffect(()=>{if(mt||!C)return;const S=C,A=()=>{try{r.setViewport(S,{duration:0})}catch{}},U=window.requestAnimationFrame(()=>window.requestAnimationFrame(A));return()=>window.cancelAnimationFrame(U)},[mt,r,C]),h.useEffect(()=>{const S=$.current,A=new Map,U=[];for(const re of[...Us,...Pl]){const le=Iq(re);A.set(re.id,le),S.get(re.id)!==le&&U.push(re.id)}if($.current=A,U.length===0)return;const G=()=>U.forEach(re=>s(re)),Q=window.requestAnimationFrame(G),se=window.setTimeout(G,80);return()=>{window.cancelAnimationFrame(Q),window.clearTimeout(se)}},[Pl,Us,s]);const Gt=h.useMemo(()=>p.find(S=>S.id===hr)||null,[p,hr]),Nc=h.useRef({id:"",draft:null}),xy=h.useMemo(()=>{const S=M1(Gt);return S?JSON.stringify(S):""},[Gt]);h.useEffect(()=>{if(!Gt){Nc.current={id:"",draft:null},Ur(null),xs("");return}const S=M1(Gt),A=Nc.current;Nc.current={id:Gt.id,draft:S},Ur(U=>!U||U.id!==Gt.id||A.id!==Gt.id||!A.draft?S:fY(U,A.draft,S)),xs("")},[Gt==null?void 0:Gt.id,xy]);const pd=h.useCallback((S=!1)=>{if(!ot||!Gt)return!1;if(!Oe)return xs("Readonly workspace"),Pe("Readonly workspace"),!1;xs("");const A=$1({nodes:p,edges:y,instances:E.current,selectedNode:Gt,draft:ot,allowRename:S});return A!=null&&A.error?(xs(A.error),!1):(!(A!=null&&A.ok)||!A.changed||(E.current=A.instances,L(A.instances),m(A.nodes),b(A.edges),A.nextId!==Gt.id&&Zn(A.nextId),Ke(A.nextId)),!0)},[y,ot,p,Gt,b,m,Ke,Oe]);h.useEffect(()=>{if(!Oe||!ot||!Gt)return;const S=window.setTimeout(()=>{pd(!1)},350);return()=>window.clearTimeout(S)},[ot==null?void 0:ot.label,ot==null?void 0:ot.role,ot==null?void 0:ot.model,ot==null?void 0:ot.body,JSON.stringify((ot==null?void 0:ot.images)||[]),ot==null?void 0:ot.script,JSON.stringify((ot==null?void 0:ot.inputs)||[]),JSON.stringify((ot==null?void 0:ot.outputs)||[]),pd,Gt==null?void 0:Gt.id,Oe]);const jc=h.useMemo(()=>{const S=new Map(Us.map(A=>[A.id,A]));return y.map(A=>{var ce,Ce,Be,yt;const U=S.get(A.source),G=S.get(A.target),Q=/^output-(\d+)$/.exec(A.sourceHandle||""),se=/^input-(\d+)$/.exec(A.targetHandle||""),re=U&&Q?(Ce=(ce=U.data)==null?void 0:ce.outputs)==null?void 0:Ce[parseInt(Q[1],10)]:null,le=G&&se?(yt=(Be=G.data)==null?void 0:Be.inputs)==null?void 0:yt[parseInt(se[1],10)]:null,he=re!=null&&re.type?or(re.type):le!=null&&le.type?or(le.type):"";return he?{...A,style:{...A.style||{},stroke:he,strokeWidth:2},markerEnd:{type:$s.ArrowClosed,color:he}}:A})},[y,Us]),zp=mt?Pl:Us,Hp=mt?[]:jc,Cc=h.useMemo(()=>mt?Pl.map(S=>({...S,id:Hx(S.id)})):Us,[Pl,Us,mt]),Wo=h.useCallback(S=>{const A=String(S||"").trim();if(!A)return;const U=mt?T1(A):A;mt?F([A]):(m(Q=>Q.map(se=>({...se,selected:se.id===U}))),b(Q=>Q.map(se=>({...se,selected:!1}))),Zn(U));const G=()=>{var ce,Ce,Be;const Q=r.getNode(U);if(!Q)return;const se=(ce=r.getInternalNode)==null?void 0:ce.call(r,U),re=((Ce=se==null?void 0:se.measured)==null?void 0:Ce.width)??(se==null?void 0:se.width)??Q.width??260,le=((Be=se==null?void 0:se.measured)==null?void 0:Be.height)??(se==null?void 0:se.height)??Q.height??120,{zoom:he}=r.getViewport();r.setCenter(Q.position.x+re/2,Q.position.y+le/2,{zoom:Rq(he),duration:240})};window.requestAnimationFrame(()=>window.requestAnimationFrame(G))},[mt,r,b,m]),Al=h.useCallback(()=>{const S=r.getViewport(),A={x:Number(S.x)||0,y:Number(S.y)||0,zoom:Math.min(Math.max(Number(S.zoom)||1,.1),4)};if(mt){const U={..._.current,viewport:A};_.current=U,N(U),Pe("已固定 Display 进入视角")}else H.current=A,T(A),Pe("已固定 Workspace 进入视角");On(g.current,v.current).catch(U=>Pe(String(U.message||U)))},[mt,r,On]),cs=h.useMemo(()=>{const S=fe.trim().toLowerCase(),A={DISPLAY:[],CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const U of V)S&&![U.id,U.label,U.displayName,U.description].some(G=>String(G||"").toLowerCase().includes(S))||A[Qd(U)].push(U);for(const U of Vc)A[U].sort((G,Q)=>G.id.localeCompare(Q.id));return A},[V,fe]),Jr=h.useMemo(()=>{const S=yn.trim().toLowerCase();return V.filter(A=>!S||[A.id,A.label,A.displayName,A.description].some(U=>String(U||"").toLowerCase().includes(S))).sort((A,U)=>{const G=Vc.indexOf(Qd(A)),Q=Vc.indexOf(Qd(U));return G!==Q?G-Q:Zd(A).localeCompare(Zd(U))}).slice(0,30)},[V,yn]),tr=h.useMemo(()=>{const S=yn.trim().toLowerCase();return ae.filter(A=>!S||[A.id,A.version,A.displayName,A.name,A.description,...Array.isArray(A.tags)?A.tags:[]].some(U=>String(U||"").toLowerCase().includes(S))).sort((A,U)=>String(A.displayName||A.name||A.id).localeCompare(String(U.displayName||U.name||U.id))).slice(0,30)},[ae,yn]);h.useEffect(()=>{as(0)},[yn,oe,Ue]),h.useEffect(()=>{if(!oe)return;const S=window.setTimeout(()=>{var A;return(A=nd.current)==null?void 0:A.focus()},0);return()=>window.clearTimeout(S)},[oe]);const ao=h.useMemo(()=>{const S=Gn.trim().toLowerCase();return S?k2(Ie).filter(A=>A.path.toLowerCase().includes(S)):Ie},[Gn,Ie]),lo=[...(Bs.cursor||[]).map(S=>({label:`Cursor · ${S.split(" - ")[0]}`,value:`cursor:${S.split(" - ")[0]}`})),...(Bs.opencode||[]).map(S=>({label:`OpenCode · ${S.split(" - ")[0]}`,value:`opencode:${S.split(" - ")[0]}`})),...(Bs.claudeCode||[]).map(S=>({label:`Claude · ${S.split(" - ")[0]}`,value:`claude-code:${S.split(" - ")[0]}`}))],Ec=h.useMemo(()=>new Set(er),[er]),Vo=h.useMemo(()=>{const S=new Map(vr.map(se=>[se.key,se])),A=new Set,U=new Set,G=Yr.map(se=>{const re=cl(se,vr).map(le=>S.get(le)).filter(Boolean);for(const le of re)A.add(le.key),U.add(String(le.name||le.id||le.key||"").trim());return{...se,skills:re}}).filter(se=>se.skills.length>0),Q=vr.filter(se=>{const re=String(se.name||se.id||se.key||"").trim();return!A.has(se.key)&&!U.has(re)});return{groups:G,ungrouped:Q}},[Yr,vr]);h.useEffect(()=>{Gr(S=>{let A=!1;const U=new Set(S);for(const G of Vo.groups)U.has(G.id)||(U.add(G.id),A=!0);return A?U:S})},[Vo.groups]);const Wn=h.useMemo(()=>{const S=p.filter(A=>A.selected);return S.length>0?S:hr?p.filter(A=>A.id===hr):[]},[p,hr]),_a=h.useMemo(()=>Wn.map(S=>S.id),[Wn]),Pn=h.useMemo(()=>p.filter(S=>{var A;return Kn((A=S==null?void 0:S.data)==null?void 0:A.definitionId)}),[p]),An=h.useMemo(()=>Wn.filter(S=>{var A;return Kn((A=S==null?void 0:S.data)==null?void 0:A.definitionId)}).map(S=>S.id),[Wn]),Il=h.useMemo(()=>{const S=String((Lr==null?void 0:Lr.username)||(Lr==null?void 0:Lr.userId)||"").trim();return S?S.slice(0,1).toUpperCase():"?"},[Lr]),Uo=h.useMemo(()=>new Set(_a),[_a]),co=h.useMemo(()=>y.filter(S=>Uo.has(S.source)&&Uo.has(S.target)),[y,Uo]),hd=h.useCallback(S=>{const A=S==="display"?"display":"workspace";l(A),Zn(""),F([]),z(null),Te(!1),$e(!1);const U=xo(i);A==="display"&&U.set("view","display");const G=`/workspace${U.toString()?`?${U.toString()}`:""}`;window.history.pushState({},"",G)},[i]),jt=h.useCallback(S=>{var G;const A=String(S||"").trim();if(!A)return;const U=g.current.find(Q=>Q.id===A);if(!U||!Kn((G=U.data)==null?void 0:G.definitionId)){Pe("展示节点不可用");return}N(Q=>{if(Q.nodeIds.includes(A))return Q;const se=Q.nodeIds.length,re=Uc(U);return{nodeIds:[...Q.nodeIds,A],nodePositions:{...Q.nodePositions,[A]:{x:180+se*36,y:120+se*28}},nodeSizes:{...Q.nodeSizes,...re?{[A]:re}:{}}}}),F([A])},[]),md=h.useCallback(S=>{const A=String(S||"").trim();A&&(N(U=>{const G=U.nodeIds.filter(re=>re!==A),Q={...U.nodePositions},se={...U.nodeSizes};return delete Q[A],delete se[A],{nodeIds:G,nodePositions:Q,nodeSizes:se}}),F(U=>U.filter(G=>G!==A)))},[]),_c=h.useCallback(S=>{const A=String(S||"").trim();A&&(_.current.nodeIds.includes(A)?md(A):jt(A))},[jt,md]),Ko=h.useMemo(()=>{const S=nt.trim().toLowerCase();return S?Li.filter(A=>{var U,G;return[A.id,(U=A.data)==null?void 0:U.label,(G=A.data)==null?void 0:G.definitionId].filter(Boolean).some(Q=>String(Q).toLowerCase().includes(S))}):Li},[Li,nt]),Tl=h.useMemo(()=>{const S=Ko.length,A=S<=1?1:S<=4?2:3,U=Array.from({length:A},()=>({height:0,nodes:[]}));for(const G of Ko){const Q=Uc(G)||{width:420,height:260},se=Math.max(1,Number(Q.width)||420),re=Math.max(1,Number(Q.height)||260),le=Math.min(26,Math.max(5.5,re/se*16))+3.2;let he=U[0];for(const ce of U)ce.height<he.height&&(he=ce);he.nodes.push(G),he.height+=le}return U.map(G=>G.nodes)},[Ko]),Bp=h.useCallback(S=>{var se,re;const A=x.nodeIds.includes(S.id),U=Uc(S)||{width:420,height:260},G=Math.max(1,Math.round(Number(U.width)||420)),Q=Math.max(1,Math.round(Number(U.height)||260));return o.jsxs("button",{type:"button",className:"af-display-picker-card"+(A?" af-display-picker-card--selected":""),style:{"--af-display-picker-card-ratio":`${G} / ${Q}`},onClick:()=>_c(S.id),children:[o.jsx("span",{className:"af-display-picker-card__check","aria-hidden":!0,children:o.jsx("input",{type:"checkbox",checked:A,readOnly:!0,tabIndex:-1})}),o.jsx("span",{className:"af-display-picker-card__preview",children:o.jsx(Yq,{node:S})}),o.jsxs("span",{className:"af-display-picker-card__meta",children:[o.jsx("strong",{children:((se=S.data)==null?void 0:se.label)||S.id}),o.jsxs("small",{children:[Kn((re=S.data)==null?void 0:re.definitionId)," · ",S.id]})]})]},S.id)},[x.nodeIds,_c]),Pc=h.useMemo(()=>{const S=fe.trim().toLowerCase();return S?ae.filter(A=>[A.id,A.version,A.displayName,A.name,A.description,...Array.isArray(A.tags)?A.tags:[]].filter(Boolean).some(U=>String(U).toLowerCase().includes(S))):ae},[ae,fe]),Ac=h.useCallback((S,A)=>{const U=String(S||"snippet_node").trim().replace(/[^a-zA-Z0-9_]+/g,"_").replace(/^_+|_+$/g,"")||"snippet_node";let G=`${U}_${Date.now().toString(36)}`,Q=2;for(;A.has(G);)G=`${U}_${Date.now().toString(36)}_${Q}`,Q+=1;return A.add(G),G},[]),Rl=h.useCallback((S,A)=>{var Tt,$t;if(!Oe){Pe("Readonly workspace");return}const U=S!=null&&S.snippet&&typeof S.snippet=="object"?S.snippet:{},G=U.instances&&typeof U.instances=="object"?U.instances:{},Q=Object.keys(G);if(Q.length===0)return;const se=new Set(g.current.map(We=>We.id)),re={};for(const We of Q)re[We]=Ac(We,se);const le=(Tt=U.ui)!=null&&Tt.nodePositions&&typeof U.ui.nodePositions=="object"?U.ui.nodePositions:{},he=($t=U.ui)!=null&&$t.nodeSizes&&typeof U.ui.nodeSizes=="object"?U.ui.nodeSizes:{},ce=Q.map(We=>{const Ct=le[We];return{id:We,x:typeof(Ct==null?void 0:Ct.x)=="number"?Ct.x:0,y:typeof(Ct==null?void 0:Ct.y)=="number"?Ct.y:0}}),Ce=Math.min(...ce.map(We=>We.x)),Be=Math.min(...ce.map(We=>We.y));let yt=A||{x:360+g.current.length*24,y:180+g.current.length*18};if(!A){const We=document.querySelector(".af-workspace-canvas .react-flow");if(We){const Ct=We.getBoundingClientRect();yt=r.screenToFlowPosition({x:Ct.left+Ct.width*.48,y:Ct.top+Ct.height*.32})}}const Xe={},_t={},kn={};for(const We of ce){const Ct=re[We.id];Xe[Ct]={...G[We.id]||{}},_t[Ct]={x:yt.x+(We.x-Ce),y:yt.y+(We.y-Be)};const Pr=he[We.id];typeof(Pr==null?void 0:Pr.width)=="number"&&typeof(Pr==null?void 0:Pr.height)=="number"&&(kn[Ct]={width:Pr.width,height:Pr.height})}const us=new Set(Q),ln=(Array.isArray(U.edges)?U.edges:[]).filter(We=>us.has(We==null?void 0:We.source)&&us.has(We==null?void 0:We.target)).map(We=>({source:re[We.source],target:re[We.target],sourceHandle:We.sourceHandle??null,targetHandle:We.targetHandle??null})),fn=zx({instances:Xe,edges:ln,ui:{nodePositions:_t,nodeSizes:kn}},V),rr=fn.nodes.map(We=>({...We,selected:!0}));E.current={...E.current,...fn.instances},L(E.current),m(We=>[...We.map(Ct=>({...Ct,selected:!1})),...rr]),b(We=>[...We.map(Ct=>({...Ct,selected:!1})),...fn.edges]),Pe(`已添加流程片段:${S.displayName||S.id}`)},[Ac,V,r,b,m,Oe]),Wp=h.useCallback(()=>{var U,G;if(Wn.length<2){Ve("请先在 workspace 画布上选择至少两个节点。"),Z("flows");return}const S=Wn[0],A=Wn.length===2?`${((U=S.data)==null?void 0:U.label)||S.id} 片段`:`${((G=S.data)==null?void 0:G.label)||S.id} 等 ${Wn.length} 个节点`;He({name:A,id:A.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),description:""}),an(""),qe(!0),Z("flows")},[Wn]),Vp=h.useCallback(async()=>{var Q,se;if(Wn.length<2)return;const S=dt.name.trim();if(!S){an("请填写片段名称。");return}const A={},U={};for(const re of Wn){A[re.id]={x:((Q=re.position)==null?void 0:Q.x)||0,y:((se=re.position)==null?void 0:se.y)||0};const le=Uc(re);le&&(U[re.id]=le)}const G=co.map(re=>({source:re.source,target:re.target,sourceHandle:re.sourceHandle??null,targetHandle:re.targetHandle??null}));sn(!0),an("");try{const re=await fetch("/api/marketplace/publish-flow-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:dt.id,name:S,displayName:S,version:"1.0.0",description:dt.description,snippet:{instances:kp(Wn,E.current),edges:G,ui:{nodePositions:A,nodeSizes:U}}})}),le=await re.json().catch(()=>({}));if(!re.ok||le.ok===!1)throw new Error(le.error||"发布流程片段失败");qe(!1),Pe(`流程片段已发布:${le.id||S}`),Me(`流程片段已发布:${le.id||S}`),await io(),Z("flows")}catch(re){an(String(re.message||re))}finally{sn(!1)}},[io,dt,co,Wn,Me]);h.useCallback(()=>{if(Pn.length===0){Pe("当前 workspace 没有 display 节点");return}const S=An.length>0?An:Pn.map(U=>U.id),A=i.flowId?`${i.flowId} 展示页`:"AgentFlow Display";ar({title:A,layout:"gallery",nodeIds:S}),Lt(""),mn(null),ke(!0)},[i.flowId,An,Pn]);const Qr=h.useCallback(S=>{ar(A=>{const U=Array.isArray(A.nodeIds)?A.nodeIds:[];return U.includes(S)?{...A,nodeIds:U.filter(G=>G!==S)}:{...A,nodeIds:[...U,S]}})},[]),Up=h.useCallback(async()=>{var U;const S=Zt.title.trim(),A=Array.isArray(Zt.nodeIds)?Zt.nodeIds:[];if(A.length===0){Lt("请选择至少一个 display 节点。");return}rt(!0),Lt(""),mn(null);try{await On(p,y);const G=await fetch("/api/display/share",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,title:S,layout:Zt.layout,nodeIds:A})}),Q=await G.json().catch(()=>({}));if(!G.ok||Q.ok===!1)throw new Error(Q.error||"发布展示页失败");const se=new URL(Q.url||`/display/${((U=Q.share)==null?void 0:U.id)||""}`,window.location.origin).href;mn({...Q,absoluteUrl:se}),Pe("展示页已生成")}catch(G){Lt(String(G.message||G))}finally{rt(!1)}},[Zt,y,i,p,On]),Ks=h.useCallback(async()=>{var A;const S=Array.isArray(x.nodeIds)?x.nodeIds:[];if(S.length===0){Lt("请先添加至少一个展示节点。"),Pe("请先添加至少一个展示节点"),$e(!0);return}rt(!0),Lt("");try{await On(p,y);const U=i.flowId?`${i.flowId} 展示页`:"AgentFlow Display",G=await fetch("/api/display/share",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,title:U,layout:"canvas",nodeIds:S})}),Q=await G.json().catch(()=>({}));if(!G.ok||Q.ok===!1)throw new Error(Q.error||"生成展示链接失败");const se=new URL(Q.url||`/display/${((A=Q.share)==null?void 0:A.id)||""}`,window.location.origin).href;mn({...Q,absoluteUrl:se}),gn(!0),Pe("展示链接已生成")}catch(U){const G=String(U.message||U);Lt(G),Pe(G)}finally{rt(!1)}},[x.nodeIds,y,i,p,On]),qs=h.useCallback(async()=>{const S=st==null?void 0:st.absoluteUrl;if(!S)return;const A=await Lq(S);lr(A?"copied":"failed"),window.setTimeout(()=>lr(""),1600)},[st==null?void 0:st.absoluteUrl]),Kp=h.useCallback(S=>{m(A=>A.map(U=>U.id===S?{...U,selected:!1}:U)),Zn(A=>A===S?"":A)},[m]),yi=h.useCallback(()=>{const S=ur.current;if(!S)return;const A=S.getBoundingClientRect(),U=Math.min(420,Math.max(320,A.width+160)),G=12,Q=Math.max(180,A.top-G*2),se=Math.min(560,Q);Ti({position:"fixed",left:Math.max(12,Math.min(window.innerWidth-U-12,A.left)),top:Math.max(G,A.top-se-G),width:U,maxHeight:se,zIndex:1e4})},[]);h.useEffect(()=>{if(!ls)return;yi();const S=U=>{var Q,se;const G=U.target;(Q=ur.current)!=null&&Q.contains(G)||(se=ba.current)!=null&&se.contains(G)||Vs(!1)},A=U=>{U.key==="Escape"&&Vs(!1)};return window.addEventListener("pointerdown",S),window.addEventListener("keydown",A),window.addEventListener("resize",yi),window.addEventListener("scroll",yi,!0),()=>{window.removeEventListener("pointerdown",S),window.removeEventListener("keydown",A),window.removeEventListener("resize",yi),window.removeEventListener("scroll",yi,!0)}},[ls,yi]);const qp=h.useCallback(S=>{var G,Q,se;if(a==="display"){const re=[];let le=!1;N(he=>{var Be,yt;const ce={...he.nodePositions},Ce={...he.nodeSizes};for(const Xe of S||[]){const _t=Hx(Xe==null?void 0:Xe.id);if(!(!_t||!he.nodeIds.includes(_t))){if(Xe.type==="select"){Xe.selected&&re.push(_t);continue}if(Xe.type==="position"&&Xe.position){ce[_t]={x:Xe.position.x,y:Xe.position.y},le=!0;continue}if(Xe.type==="dimensions"&&((Be=Xe.dimensions)!=null&&Be.width)&&((yt=Xe.dimensions)!=null&&yt.height)){const kn=bu({width:Math.round(Number(Xe.dimensions.width)),height:Math.round(Number(Xe.dimensions.height))},{display:!0});kn&&(Ce[_t]=kn,le=!0)}}}return le?{...he,nodePositions:ce,nodeSizes:Ce}:he}),(S||[]).some(he=>(he==null?void 0:he.type)==="select")&&F(re);return}if(!Oe){const re=(S||[]).filter(le=>(le==null?void 0:le.type)==="select");re.length>0&&m(le=>tg(re,le));return}const A=new Map;for(const re of S||[])if((re==null?void 0:re.type)==="dimensions"&&((G=re.dimensions)!=null&&G.width)&&((Q=re.dimensions)!=null&&Q.height)){const le=p.find(Ce=>Ce.id===re.id),he=!!Kn((se=le==null?void 0:le.data)==null?void 0:se.definitionId),ce=bu({width:Math.round(Number(re.dimensions.width)),height:Math.round(Number(re.dimensions.height))},{display:he});ce&&A.set(re.id,ce)}const U=Array.from(A.keys());if(m(re=>tg(S,re).map(le=>{var ce;const he=A.get(le.id);return he?Kn((ce=le.data)==null?void 0:ce.definitionId)?{...le,width:he.width,height:he.height,data:{...le.data,nodeSize:he,displaySize:he}}:{...le,width:he.width,height:he.height,data:{...le.data,nodeSize:he}}:le})),U.length>0){const re=()=>U.forEach(le=>s(le));window.requestAnimationFrame(re),window.setTimeout(re,80)}},[p,m,s,a,Oe]),Ll=h.useCallback(S=>{if(a!=="display"){if(!Oe){const A=(S||[]).filter(U=>(U==null?void 0:U.type)==="select");A.length>0&&b(U=>a0(A,U));return}k(S)}},[k,b,a,Oe]),qo=h.useCallback(()=>{const S=document.querySelector(".af-workspace-canvas .react-flow");if(S){const A=S.getBoundingClientRect();return r.screenToFlowPosition({x:A.left+A.width*.48,y:A.top+A.height*.32})}return{x:360+p.length*36,y:180+p.length*28}},[p.length,r]),nr=h.useCallback(()=>{var S,A,U;if(Gt){const G=Number(((S=Gt.measured)==null?void 0:S.width)||Gt.width||260);return{x:Number(((A=Gt.position)==null?void 0:A.x)||0)+G+140,y:Number(((U=Gt.position)==null?void 0:U.y)||0)}}return qo()},[qo,Gt]),xi=h.useCallback((S,A={})=>{if(!Oe)return Pe("Readonly workspace"),null;if(!S)return null;const U=D0(S)||S.id,G=m2(S),Q=A.id||Pq(U,p),se=Bh(S.inputs),re=Bh(S.outputs),le={definitionId:U,...G?{marketplaceRef:G}:{},...S.packageId?{marketplacePackageId:S.packageId}:{},...S.version?{marketplaceVersion:S.version}:{},label:A.label||xg(S),role:"normal",body:A.body||"",input:A.inputs||se,output:A.outputs||re},he={id:Q,type:Sp,position:A.position||qo(),data:{label:le.label,definitionId:U,...G?{marketplaceRef:G}:{},...S.packageId?{marketplacePackageId:S.packageId}:{},...S.version?{marketplaceVersion:S.version}:{},schemaType:h2(U,S),role:"normal",body:le.body,inputs:le.input,outputs:le.output}},ce={...tp(he,{...E.current,[Q]:le},V),selected:!0};return m(Ce=>[...Ce.map(Be=>({...Be,selected:!1})),ce]),A.openProperties&&Zn(Q),Q},[qo,p,V,m,Oe]),Mi=h.useCallback(S=>I1(S,g.current),[]),Ic=h.useCallback(S=>{if(!Oe){Pe("Readonly workspace");return}if(!I1(S,g.current)){Pe("端口类型不匹配,已取消连线");return}z(null),m(A=>pg(A,S)),b(A=>{const U=A.filter(G=>!(G.target===S.target&&G.targetHandle===S.targetHandle));return qf({...S,markerEnd:{type:$s.ArrowClosed}},U)})},[b,m,Oe]),uo=h.useCallback((S,A)=>{Oe&&(O.current=Eq(A,g.current),z(null))},[Oe]),Pa=h.useCallback((S,A)=>{var yt,Xe,_t,kn;if(!Oe)return;const U=O.current;if(O.current=null,!U||A!=null&&A.toNode)return;const G=_q(V,U);if(G.length===0){Pe(`没有匹配 ${U.slotType} 端口的节点`);return}const Q=((Xe=(yt=S==null?void 0:S.changedTouches)==null?void 0:yt[0])==null?void 0:Xe.clientX)??(S==null?void 0:S.clientX),se=((kn=(_t=S==null?void 0:S.changedTouches)==null?void 0:_t[0])==null?void 0:kn.clientY)??(S==null?void 0:S.clientY);if(!Number.isFinite(Q)||!Number.isFinite(se))return;const re=document.querySelector(".af-workspace-canvas .react-flow");if(!re)return;const le=re.getBoundingClientRect(),he=320,ce=Math.min(440,104+G.length*58),Ce=Math.max(12,Math.min(Q-le.left,le.width-he-12)),Be=Math.max(12,Math.min(se-le.top,le.height-ce-12));z({left:Ce,top:Be,flowPosition:r.screenToFlowPosition({x:Q,y:se}),draft:U,candidates:G,query:""})},[V,r,Oe]),gd=h.useCallback(S=>{if(!Oe){Pe("Readonly workspace"),z(null);return}const A=R.current;if(!A||!(S!=null&&S.def))return;const U=xi(S.def,{position:A.flowPosition});if(!U)return;const G=A.draft.handleType==="source"?{source:A.draft.nodeId,sourceHandle:A.draft.handleId,target:U,targetHandle:`input-${S.slotIndex}`}:{source:U,sourceHandle:`output-${S.slotIndex}`,target:A.draft.nodeId,targetHandle:A.draft.handleId};m(Q=>pg(Q,G)),b(Q=>{const se=Q.filter(re=>!(re.target===G.target&&re.targetHandle===G.targetHandle));return qf({...G,markerEnd:{type:$s.ArrowClosed}},se)}),z(null)},[xi,b,Oe]),Ml=h.useCallback(S=>{S&&(xi(S,{position:nr()}),Te(!1),cr(""))},[xi,nr]),Et=h.useCallback(S=>{S&&(Rl(S,nr()),Te(!1),cr(""))},[Rl,nr]);h.useEffect(()=>{const S=A=>{var ce;if(A.defaultPrevented)return;const U=BT(A.target)||kq(A.target);if((A.metaKey||A.ctrlKey)&&A.key.toLowerCase()==="s"){A.preventDefault(),On().catch(Ce=>Pe(String(Ce.message||Ce)));return}if((A.metaKey||A.ctrlKey)&&A.key.toLowerCase()==="k"){A.preventDefault(),A.stopPropagation(),jl(Ce=>!Ce);return}if(Nl)return;if(ka){(A.key==="Escape"||mg(A))&&(A.preventDefault(),Ho(!1));return}const G=A.key.toLowerCase(),Q=(A.metaKey||A.ctrlKey)&&G==="c",se=(A.metaKey||A.ctrlKey)&&G==="v",re=U&&Q&&Nq(A.target);if(U&&!re)return;const le=(A.metaKey||A.ctrlKey)&&!A.shiftKey&&G==="z",he=(A.metaKey||A.ctrlKey)&&(A.shiftKey&&G==="z"||G==="y");if(le||he){if(mt){A.preventDefault(),A.stopPropagation(),Pe("展示页布局会自动保存");return}if(!Oe){A.preventDefault(),Pe("Readonly workspace");return}A.preventDefault(),A.stopPropagation();const Ce=le?Tp():Rp();Pe(Ce?le?"Undo canvas change":"Redo canvas change":le?"Nothing to undo":"Nothing to redo");return}if(Q){if(mt)return;const Ce=Vr.current,Be=(g.current||[]).some(Xe=>Xe==null?void 0:Xe.selected)?g.current:(g.current||[]).map(Xe=>Ce&&Xe.id===Ce?{...Xe,selected:!0}:Xe),yt=RT(Be,v.current,E.current);yt&&(A.preventDefault(),A.stopPropagation(),W.current=yt,re&&typeof((ce=A.target)==null?void 0:ce.blur)=="function"&&A.target.blur(),Pe(`Copied ${yt.nodes.length} node${yt.nodes.length>1?"s":""}`));return}if(se){if(mt){A.preventDefault(),A.stopPropagation();return}if(!Oe){A.preventDefault(),Pe("Readonly workspace");return}const Ce=LT(W.current,g.current,v.current,E.current);Ce&&(A.preventDefault(),A.stopPropagation(),E.current=Ce.instances,L(Ce.instances),m(Ce.nodes),b(Ce.edges),Pe(`Pasted ${Ce.pastedNodeIds.length} node${Ce.pastedNodeIds.length>1?"s":""}`));return}if(mg(A)&&!A.metaKey&&!A.ctrlKey&&!A.altKey){A.preventDefault(),Ho(!0);return}if(A.key==="a"||A.key==="A"){if(A.metaKey||A.ctrlKey){A.preventDefault(),mt?F(_.current.nodeIds):(m(Ce=>Ce.map(Be=>({...Be,selected:!0}))),b(Ce=>Ce.map(Be=>({...Be,selected:!1}))));return}if(A.altKey)return;if(mt){A.preventDefault(),$e(!0);return}if(!Oe){A.preventDefault(),Pe("Readonly workspace");return}A.preventDefault(),Te(!0);return}if((A.key==="v"||A.key==="V")&&!A.metaKey&&!A.ctrlKey&&!A.altKey){A.preventDefault(),di("select");return}if((A.key==="h"||A.key==="H")&&!A.metaKey&&!A.ctrlKey&&!A.altKey){A.preventDefault(),di("pan");return}(A.key==="f"||A.key==="F")&&!A.metaKey&&!A.ctrlKey&&!A.altKey&&(A.preventDefault(),Al())};return window.addEventListener("keydown",S,!0),()=>window.removeEventListener("keydown",S,!0)},[mt,Nl,Al,Rp,On,ka,b,m,Tp,Oe]);const kt=h.useCallback(S=>{ut(A=>{const U=new Set(A);return U.has(S)?U.delete(S):U.add(S),U})},[]),wy=h.useCallback((S,A)=>{S.dataTransfer.effectAllowed="copy",S.dataTransfer.setData("application/x-agentflow-workspace-file",JSON.stringify({path:A.path,name:A.name,type:A.type})),S.dataTransfer.setData("text/plain",A.path)},[]),vn=h.useCallback((S,A)=>{S.dataTransfer.effectAllowed="move",S.dataTransfer.setData("application/agentflow-node",A.id),S.dataTransfer.setData("text/plain",A.id)},[]),Xt=h.useCallback(async(S,A)=>{const U=String((S==null?void 0:S.name)||(S==null?void 0:S.path)||"").toLowerCase(),G=U.split(".").pop(),Q=G==="html"?"display_html":G==="csv"||G==="tsv"||G==="json"&&/\b(table|data|rows|report)\b/i.test(U)?"display_table":["png","jpg","jpeg","gif","webp","svg"].includes(G)?"display_image":"display_markdown",se=V.find(Be=>Be.id===Q);if(!se){Pe("展示节点不可用");return}const re=Q==="display_image";let le=String(S.path||"");if(!re){const Be=xo(i);Be.set("path",S.path);const yt=await fetch(`/api/workspace/file?${Be.toString()}`),Xe=await yt.json();if(!yt.ok)throw new Error(Xe.error||"读取文件失败");le=String(Xe.content||"")}const he=Q==="display_image"?"src":"content",ce=Bh(se.inputs).map(Be=>Be.name===he?{...Be,default:le,value:le}:Be),Ce=Bh(se.outputs).map(Be=>Be.name===he?{...Be,default:le,value:le}:Be);xi(se,{label:S.name||"Display",body:le,inputs:ce,outputs:Ce,position:A}),Pe(`已创建展示:${S.path}`)},[xi,i,V]),by=h.useCallback(S=>{if(!Oe){Pe("Readonly workspace");return}Xt(S,qo()).catch(A=>Pe(String(A.message||A)))},[Xt,qo,Oe]),Ys=h.useCallback(S=>{if(!Oe){S.preventDefault(),Pe("Readonly workspace");return}const A=S.dataTransfer.getData("application/x-agentflow-workspace-file");if(A){S.preventDefault();let re;try{re=JSON.parse(A)}catch{return}if(!(re!=null&&re.path))return;const le=r.screenToFlowPosition({x:S.clientX,y:S.clientY});Xt(re,le).catch(he=>Pe(String(he.message||he)));return}const U=S.dataTransfer.getData("application/agentflow-snippet");if(U){const re=ae.find(he=>`${he.id}@${he.version}`===U);if(!re)return;S.preventDefault();const le=r.screenToFlowPosition({x:S.clientX,y:S.clientY});Rl(re,le);return}const G=S.dataTransfer.getData("application/agentflow-node");if(!G)return;const Q=V.find(re=>re.id===G);if(!Q)return;S.preventDefault();const se=r.screenToFlowPosition({x:S.clientX,y:S.clientY});xi(Q,{position:se})},[Xt,xi,ae,Rl,V,r,Oe]),Yo=h.useCallback(S=>{if(!Oe)return;const A=Array.from(S.dataTransfer.types||[]);!A.includes("application/x-agentflow-workspace-file")&&!A.includes("application/agentflow-node")&&!A.includes("application/agentflow-snippet")||(S.preventDefault(),S.dataTransfer.dropEffect=A.includes("application/agentflow-node")||A.includes("application/agentflow-snippet")?"move":"copy")},[Oe]),yd=h.useCallback(async(S="")=>{if(!Oe){Pe("Readonly workspace");return}const A=window.prompt("新文件名",S?`${S}/notes.md`:"notes.md");if(!A)return;const U=S&&!A.includes("/")?`${S}/${A}`:A;try{const G=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:U,content:""})}),Q=await G.json();if(!G.ok)throw new Error(Q.error||"创建文件失败");await Bn(),ut(se=>{const re=new Set(se);for(const le of Vh(Q.path||U))re.delete(le);return re}),Pe(`已创建 ${Q.path}`)}catch(G){Pe(String(G.message||G))}},[i,Bn,Oe]),Tc=h.useCallback(async(S="")=>{if(!Oe){Pe("Readonly workspace");return}const A=window.prompt("新文件夹名",S?`${S}/docs`:"docs");if(!A)return;const U=S&&!A.includes("/")?`${S}/${A}`:A;try{const G=await fetch("/api/workspace/folder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:U})}),Q=await G.json();if(!G.ok)throw new Error(Q.error||"创建文件夹失败");await Bn(),ut(se=>{const re=new Set(se);for(const le of Vh(Q.path||U))re.delete(le);return Q.path&&re.delete(Q.path),re}),Pe(`已创建 ${Q.path}`)}catch(G){Pe(String(G.message||G))}},[i,Bn,Oe]),Yp=h.useCallback(async S=>{if(!Oe){Pe("Readonly workspace");return}if(!(!(S!=null&&S.path)||!window.confirm(`删除 ${S.path}?`)))try{const A=await fetch("/api/workspace/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:S.path})}),U=await A.json();if(!A.ok)throw new Error(U.error||"删除失败");Pe(`已删除 ${U.path}`),await Bn()}catch(A){Pe(String(A.message||A))}},[i,Bn,Oe]),Ol=h.useCallback(async()=>{if(!Oe){Pe("Readonly workspace");return}const S=va.trim();if(!S||_r)return;const A=Wh(p,y,E.current);wl(""),bl(!0),Lp("workspace"),Kt(U=>[...U,{role:"user",text:S,at:Date.now()}]);try{await On(p,y);const U=await fetch("/api/workspace/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,prompt:S,outputKind:"markdown",workspaceGraph:A,allowFlowYaml:!1,model:ws,selectedSkills:er,selectedNodeIds:_a})}),G=await U.json();if(!U.ok)throw new Error(G.error||"生成失败");const Q=String(G.content||"").trim();Kt(se=>[...se,{role:"assistant",text:Q,at:Date.now()}]),await gt(),Pe("AI 生成完成")}catch(U){const G=String(U.message||U);Kt(Q=>[...Q,{role:"assistant",text:G,error:!0,at:Date.now()}]),Pe(G)}finally{bl(!1)}},[ws,_r,va,y,i,gt,p,Lp,On,_a,er,Oe]),dn=vc.find(S=>S.id===kl)||null,Oi=dn?Array.isArray(dn.messages)?dn.messages:[]:vl,Gp=dn?dn.status==="running":_r,vy=dn?dn.status==="running"?`${dn.label} running`:dn.status==="paused"?`${dn.label} paused`:dn.status==="failed"?`${dn.label} failed`:`${dn.label} done`:_r?"Workspace agent running":vl.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:()=>n("/projects"),"aria-label":"返回",children:o.jsx("span",{className:"material-symbols-outlined",children:"arrow_back"})}),o.jsxs("div",{className:"af-pipeline-brand",title:i.flowId?`${i.flowId} · ${mr}`:mr||"PROJECT",children:[o.jsx("span",{className:"af-pipeline-brand-name",children:"WORKSPACE"}),o.jsxs("span",{className:"af-pipeline-brand-ver",children:["V",xq,"-STABLE"]})]}),o.jsxs("div",{className:"af-view-switch","aria-label":"视图切换",children:[o.jsx("button",{type:"button",onClick:()=>{n(Df({id:i.flowId,source:i.flowSource||"user",archived:!!i.archived},"pipeline"))},children:"Pipeline"}),o.jsx("button",{type:"button",className:a==="workspace"?"af-view-switch__active":"",onClick:()=>hd("workspace"),children:"Workspace"}),o.jsx("button",{type:"button",className:a==="display"?"af-view-switch__active":"",onClick:()=>hd("display"),children:"Display"})]})]}),o.jsxs("div",{className:"af-pipeline-top-right af-workspace-actions",children:[o.jsx("span",{className:"af-workspace-save-status",children:ks}),mt?o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:"af-workspace-display-share-btn",disabled:De||!(st!=null&&st.absoluteUrl)&&x.nodeIds.length===0,onClick:()=>{lr(""),st!=null&&st.absoluteUrl?gn(!0):Ks()},title:st!=null&&st.absoluteUrl?"查看展示链接":x.nodeIds.length===0?"先添加展示节点":"生成展示链接",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:De?"hourglass_empty":"ios_share"}),De?"生成中":st!=null&&st.absoluteUrl?"展示链接":"生成链接"]}),o.jsxs("button",{type:"button",className:"af-workspace-display-share-btn",disabled:Li.length===0,onClick:()=>$e(!0),title:Li.length===0?"当前 workspace 没有 display 节点":"选择展示节点 (A)",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add_to_photos"}),"添加展示"]})]}):null,o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>n(ad),"aria-label":e("flow:topbar.pipelineSettings"),title:e("flow:topbar.pipelineSettings"),children:o.jsx("span",{className:"material-symbols-outlined",children:"settings"})}),o.jsx("button",{type:"button",className:"af-icon-btn",disabled:!Ap,onClick:()=>d(!0),"aria-label":e("project:archiveModal.title"),title:e("project:archiveModal.title"),children:o.jsx("span",{className:"material-symbols-outlined",children:"archive"})}),o.jsx("button",{type:"button",className:"af-icon-btn af-icon-btn--danger",disabled:!Ap,onClick:()=>u(!0),"aria-label":e("flow:topbar.deletePipeline"),title:e("flow:topbar.deletePipeline"),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_forever"})}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>Ho(!0),"aria-label":"快捷键",title:"快捷键 (?)",children:o.jsx("span",{className:"material-symbols-outlined",children:"help"})}),o.jsx("button",{type:"button",className:"af-composer-topbar-btn"+(ci?" af-composer-topbar-btn--active":"")+(_r?" af-composer-topbar-btn--running":""),disabled:mt,onClick:()=>Do(S=>!S),children:"AI"}),o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!Oe,onClick:()=>On().catch(S=>Pe(String(S.message||S))),children:"Save"})]})]}),Yt?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:Yt}),o.jsx("button",{type:"button",onClick:()=>En(""),"aria-label":"关闭发布提示",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}):null,o.jsxs("div",{className:"af-workspace-body"+(!mt&&(ci||ot)?" af-workspace-body--drawer":"")+(!mt&&kc?" af-workspace-body--sidebar-collapsed":"")+(mt?" af-workspace-body--display-mode":""),children:[!mt&&kc?o.jsx("nav",{className:"af-workspace-rail","aria-label":"Workspace sidebar",children:o.jsxs("div",{className:"af-workspace-rail__stack",children:[o.jsxs("button",{type:"button",className:"af-workspace-rail__primary",onClick:()=>Te(!0),"aria-label":"添加节点",title:"添加节点",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add"}),o.jsx("span",{className:"af-workspace-rail__dot","aria-hidden":!0})]}),o.jsx("button",{type:"button",className:"af-workspace-rail__btn",onClick:()=>zo(!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:()=>zo(!1),"aria-label":"展开侧边栏",title:(Lr==null?void 0:Lr.username)||(Lr==null?void 0:Lr.userId)||"展开侧边栏",children:Il})]})}):null,mt?null:o.jsxs("aside",{ref:Ut,className:"af-workspace-sidebar"+(tt?" af-workspace-sidebar--resizing":""),"aria-hidden":kc,style:{"--af-work-files-pane-height":`${Math.round(un)}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:()=>zo(!0),"aria-label":"最小化侧边栏",title:"最小化侧边栏",children:o.jsx("span",{className:"material-symbols-outlined",children:"keyboard_double_arrow_left"})}),o.jsx("button",{type:"button",className:"af-icon-btn",disabled:!Oe,onClick:()=>yd(""),"aria-label":"新增文件",title:"新增文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"note_add"})}),o.jsx("button",{type:"button",className:"af-icon-btn",disabled:!Oe,onClick:()=>Tc(""),"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 Bn(),"aria-label":"刷新文件",title:"刷新文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"refresh"})})]})]}),o.jsx("input",{className:"af-workspace-search",value:Gn,onChange:S=>qr(S.target.value),placeholder:"搜索文件..."}),o.jsx("div",{className:"af-workspace-files-scroll",children:o.jsx(N2,{items:ao,flowParams:i,onOpen:by,collapsedDirs:Cr,onToggleDir:kt,onCreateFile:yd,onCreateFolder:Tc,onDelete:Yp,onFileDragStart:wy})})]}),o.jsx("button",{type:"button",className:"af-workspace-sidebar-resizer",onPointerDown:Mt,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:ge==="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:fe,onChange:S=>me(S.target.value),placeholder:ge==="flows"?"搜索流程片段...":"搜索节点...","aria-label":ge==="flows"?"搜索流程片段":"搜索节点"})]}),o.jsxs("div",{className:"af-palette-tabs",role:"tablist","aria-label":"Palette 类型",children:[o.jsxs("button",{type:"button",role:"tab","aria-selected":ge==="nodes",className:"af-palette-tab"+(ge==="nodes"?" af-palette-tab--active":""),onClick:()=>Z("nodes"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"category"}),"节点"]}),o.jsxs("button",{type:"button",role:"tab","aria-selected":ge==="flows",className:"af-palette-tab"+(ge==="flows"?" af-palette-tab--active":""),onClick:()=>Z("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:ge==="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:Wp,disabled:Wn.length<2,title:Wn.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:["已选 ",Wn.length," 节点 / ",co.length," 连线"]})]})}),je?o.jsx("p",{className:"af-err af-palette-list-err",children:je}):null,pe?o.jsx("p",{className:"af-palette-empty",children:"正在加载流程片段..."}):Pc.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:Pc.map(S=>{const A=`${S.id}@${S.version}`,U=S.displayName||S.name||S.id,G=S.description||`${S.nodeCount||0} 个节点,${S.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",A),Q.dataTransfer.setData("text/plain",A)},onClick:()=>Rl(S),title:G,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:U}),o.jsxs("span",{className:"af-palette-card-id",children:[S.id,"@",S.version]})]})]}),G?o.jsx("span",{className:"af-palette-card-desc",children:G}):null,o.jsxs("span",{className:"af-flow-snippet-meta","aria-hidden":!0,children:[o.jsxs("span",{children:[S.nodeCount||0," nodes"]}),o.jsxs("span",{children:[S.edgeCount||0," edges"]})]})]},A)})})]}):o.jsx("p",{className:"af-palette-empty",children:fe.trim()?"没有匹配的流程片段":"暂无流程片段。选择多个节点后发布。"})]}):o.jsxs(o.Fragment,{children:[Vc.map(S=>{var A;return(A=cs[S])!=null&&A.length?o.jsxs("section",{className:`af-palette-section af-flow-palette-section--${S}`,children:[o.jsx("h3",{className:"af-palette-cat",children:S}),o.jsx("div",{className:"af-palette-cards",children:cs[S].map(U=>{const G=A1(U.inputs,"input"),Q=A1(U.outputs,"output"),se=zb(U),re=Zd(U);return o.jsxs("button",{type:"button",className:"af-palette-card",draggable:!0,onDragStart:le=>vn(le,U),onClick:()=>xi(U),title:se||U.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:_1(S)})}),o.jsxs("span",{className:"af-palette-card-main",children:[o.jsx("span",{className:"af-palette-card-label",children:re}),re!==U.id?o.jsx("span",{className:"af-palette-card-id",children:U.id}):null]})]}),se?o.jsx("span",{className:"af-palette-card-desc",children:se}):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:[G.list.length," IN"]}),o.jsxs("span",{className:"af-palette-card-port-list",children:[G.shown.map((le,he)=>o.jsxs("span",{className:"af-palette-card-port",title:P1("input",le,he),children:[o.jsx("span",{className:"af-palette-card-port-dot",style:{background:or(le==null?void 0:le.type)}}),o.jsx("span",{className:"af-palette-card-port-name",children:Fx(le,he)})]},`in-${he}`)),G.hidden>0?o.jsxs("span",{className:"af-palette-card-port-more",children:["+",G.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((le,he)=>o.jsxs("span",{className:"af-palette-card-port",title:P1("output",le,he),children:[o.jsx("span",{className:"af-palette-card-port-name",children:Fx(le,he)}),o.jsx("span",{className:"af-palette-card-port-dot",style:{background:or(le==null?void 0:le.type)}})]},`out-${he}`)),Q.hidden>0?o.jsxs("span",{className:"af-palette-card-port-more",children:["+",Q.hidden]}):null]})]})]})]},U.id)})})]},S):null}),V.length>0&&fe.trim()&&Vc.every(S=>{var A;return!((A=cs[S])!=null&&A.length)})?o.jsx("p",{className:"af-palette-empty",children:"没有匹配的节点"}):null]})})]})]}),o.jsxs("main",{className:"af-workspace-canvas",children:[o.jsx(c0,{className:"af-flow-canvas af-workspace-flow"+(sd==="pan"?" af-flow-canvas--tool-pan":" af-flow-canvas--tool-select")+(mt?" af-workspace-flow--display-mode":""),nodes:zp,edges:Hp,nodeTypes:nY,onNodesChange:qp,onEdgesChange:Ll,onConnect:mt?void 0:Ic,onConnectStart:mt?void 0:uo,onConnectEnd:mt?void 0:Pa,isValidConnection:mt?void 0:Mi,onNodeClick:(S,A)=>{if(mt){F([Hx(A.id)]);return}if(S.detail>=3){Do(!1),m(U=>U.map(G=>({...G,selected:G.id===A.id}))),b(U=>U.map(G=>({...G,selected:!1}))),Zn(A.id);return}hr&&Zn(A.id)},onNodeDoubleClick:S=>{S.preventDefault()},onPaneClick:()=>{mt?F([]):Zn("")},onDrop:mt?void 0:Ys,onDragOver:mt?void 0:Yo,nodesDraggable:mt?!0:Oe,nodesConnectable:mt?!1:Oe,edgesReconnectable:mt?!1:Oe,deleteKeyCode:mt?null:Oe?["Backspace","Delete"]:null,selectionOnDrag:sd==="select",panOnDrag:sd==="pan"?!0:[1,2],panActivationKeyCode:"Space",proOptions:{hideAttribution:!0},fitView:!1,minZoom:.1,maxZoom:4,children:o.jsx(d0,{color:"rgba(255,255,255,0.12)",gap:22,size:1})}),!mt&&I?(()=>{var G;const S=String(I.query||"").trim().toLowerCase(),A=S?I.candidates.filter(Q=>{var se,re,le;return[(se=Q.def)==null?void 0:se.id,Q.displayLabel,Q.description,(re=Q.slot)==null?void 0:re.name,(le=Q.slot)==null?void 0:le.type].filter(Boolean).some(he=>String(he).toLowerCase().includes(S))}):I.candidates,U=I.draft.handleType==="source"?"IN":"OUT";return o.jsxs("div",{className:"af-connect-node-menu",style:{left:I.left,top:I.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:or((G=I.draft.slot)==null?void 0:G.type)},"aria-hidden":!0}),o.jsxs("span",{children:["匹配 ",I.draft.slotType," 节点"]})]}),o.jsx("button",{type:"button",className:"af-connect-node-menu__close","aria-label":"关闭",onClick:()=>z(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:I.query,onChange:Q=>z(se=>se&&{...se,query:Q.target.value}),placeholder:"搜索节点",autoFocus:!0})]}),o.jsxs("div",{className:"af-connect-node-menu__list",children:[A.map(Q=>{var le,he;const se=Q.displayLabel||((le=Q.def)==null?void 0:le.id),re=Fx(Q.slot,Q.slotIndex);return o.jsxs("button",{type:"button",className:"af-connect-node-menu__item",onClick:()=>gd(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:se}),se!==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:U}),o.jsx("span",{className:"af-connect-node-menu__port-dot",style:{background:or((he=Q.slot)==null?void 0:he.type)},"aria-hidden":!0}),o.jsx("span",{className:"af-connect-node-menu__port-name",children:re})]})]},`${Q.def.id}-${Q.slotIndex}`)}),A.length===0?o.jsx("div",{className:"af-connect-node-menu__empty",children:"没有匹配结果"}):null]})]})})():null,!mt&&!rd?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:()=>Fo(!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:Wn.length===0?o.jsx("span",{className:"af-composer-selected-empty",children:"选择画布节点后,可作为本次 Workspace AI 的上下文。"}):Wn.map(S=>{var Q,se;const A=String(((Q=S.data)==null?void 0:Q.label)??S.id),U=(se=S.data)!=null&&se.definitionId?String(S.data.definitionId):"",G=U&&U!==A?`${A} · ${S.id} · ${U}`:`${A} · ${S.id}`;return o.jsxs("div",{className:"af-composer-node-chip",title:G,children:[o.jsx("span",{className:"af-composer-node-chip-kind",children:U||"node"}),o.jsx("span",{className:"af-composer-node-chip-label",children:A}),o.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>Kp(S.id),"aria-label":`取消选择 ${S.id}`,children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},S.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:va,rows:2,onChange:S=>wl(S.target.value),onKeyDown:S=>{(S.metaKey||S.ctrlKey)&&S.key==="Enter"&&(S.preventDefault(),Ol())},placeholder:"描述你想在 workspace 中生成、分析或展示的内容",autoComplete:"off",spellCheck:!1,disabled:!Oe})}),o.jsxs("div",{className:"af-composer-toolbar",children:[o.jsxs("div",{className:"af-composer-skills-field",children:[o.jsxs("button",{ref:ur,type:"button",className:"af-composer-skills-button"+(er.length>0?" af-composer-skills-button--active":""),disabled:_r||!Oe,"aria-haspopup":"listbox","aria-expanded":ls,onClick:()=>Vs(S=>!S),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"extension"}),o.jsx("span",{children:er.length>0?`Skills ${er.length}`:"Skills"})]}),ls&&!_r?Fr.createPortal(o.jsx("div",{ref:ba,className:"af-composer-skills-menu",role:"listbox","aria-label":"Skills",style:Pp,children:vr.length===0?o.jsx("div",{className:"af-composer-skills-empty",children:"No skills found"}):o.jsxs(o.Fragment,{children:[Vo.groups.map(S=>{const A=cl(S,vr),U=cP(S,Ec,vr),G=wn.has(S.id);return o.jsxs("div",{className:"af-composer-skill-group af-composer-skill-group--framed"+(G?" 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:U==="all",disabled:A.length===0,onChange:Q=>{const se=Q.target.checked;bs(re=>se?aP(re,A):lP(re,A))}}),o.jsxs("span",{className:"af-composer-skill-group-title-main",children:[o.jsx("span",{children:S.name}),S.builtin?o.jsx("em",{children:"built-in"}):null,U==="partial"?o.jsx("em",{children:"partial"}):null]})]}),o.jsxs("button",{type:"button",className:"af-composer-skill-group-toggle","aria-label":G?`展开 ${S.name}`:`收起 ${S.name}`,onClick:()=>{Gr(Q=>{const se=new Set(Q);return se.has(S.id)?se.delete(S.id):se.add(S.id),se})},children:[o.jsx("span",{children:S.skills.length}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:G?"expand_more":"expand_less"})]})]}),G?null:o.jsx("div",{className:"af-composer-skill-group-items",children:S.skills.map(Q=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:Ec.has(Q.key),onChange:se=>{const re=se.target.checked;bs(le=>re?le.includes(Q.key)?le:[...le,Q.key]:le.filter(he=>he!==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]})]},`${S.id}:${Q.key}`))})]},S.id)}),Vo.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:Vo.ungrouped.length})]}),Vo.ungrouped.map(S=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:Ec.has(S.key),onChange:A=>{const U=A.target.checked;bs(G=>U?G.includes(S.key)?G:[...G,S.key]:G.filter(Q=>Q!==S.key))}}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:S.name}),S.description?o.jsx("span",{className:"af-composer-skill-option-desc",children:S.description}):null]})]},`ungrouped:${S.key}`))]}):null]})}),document.body):null]}),o.jsx("label",{className:"af-composer-model-field",children:o.jsxs("select",{className:"af-composer-model-select",value:ws,onChange:S=>Oo(S.target.value),"aria-label":"模型",children:[o.jsx("option",{value:"",children:"默认模型"}),lo.map(S=>o.jsx("option",{value:S.value,children:S.label},S.value))]})}),o.jsx("button",{type:"button",className:"af-composer-send"+(va.trim()&&!_r?" af-composer-send--active":"")+(_r?" af-composer-send--stop":""),disabled:_r||!va.trim()||!Oe,"aria-label":_r?"Running":"Send",onClick:()=>void Ol(),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:_r?"sync":"arrow_upward"})})]})]})]})}):mt?null:o.jsx("button",{type:"button",className:"af-workspace-composer-fab",onClick:()=>Fo(!1),"aria-label":"展开 AI 输入框",title:"展开 AI 输入框",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"auto_awesome"})})]}),!mt&&ci?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:()=>Do(!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"+(kl==="workspace"?" af-composer-session-tab--active":""),onClick:()=>so("workspace"),children:o.jsx("span",{className:"af-composer-session-label",children:"Workspace"})}),vc.map(S=>o.jsx("button",{type:"button",className:"af-composer-session-tab"+(kl===S.id?" af-composer-session-tab--active":"")+(S.status==="running"?" af-composer-session-tab--running":""),onClick:()=>so(S.id),title:S.runNodeId||S.label,children:o.jsx("span",{className:"af-composer-session-label",children:S.label})},S.id))]}),o.jsx("div",{className:"af-composer-sidebar-status"+(Gp?" af-composer-sidebar-status--running":""),role:"status","aria-live":"polite",children:vy}),o.jsx("div",{className:"af-composer-sidebar-thread",children:o.jsx(iY,{messages:Oi,running:Gp,showRunningIndicator:!dn})})]})}):!mt&&ot&&Gt?o.jsx("aside",{className:"af-pipeline-drawer af-workspace-node-drawer","aria-label":"Workspace Node Properties",children:o.jsx(JT,{draft:ot,setDraft:Ur,definitionId:String(((xd=Gt.data)==null?void 0:xd.definitionId)||Gt.id),systemPromptReadonly:String(((wd=Gt.data)==null?void 0:wd.description)||""),modelLists:Bs,disabled:!Oe,onIdBlur:()=>pd(!0),onClose:()=>Zn(""),onPublishToMarketplace:ud,error:xa,ioSlots:{inputs:Array.isArray(ot==null?void 0:ot.inputs)?ot.inputs:[],outputs:Array.isArray(ot==null?void 0:ot.outputs)?ot.outputs:[]}})}):null,o.jsx(UT,{open:ka,onClose:()=>Ho(!1)}),o.jsx(KT,{open:Nl,onClose:()=>jl(!1),onJump:Wo,nodes:Cc}),o.jsx(WT,{open:c,onClose:()=>d(!1),flowId:i.flowId||"",flowSource:hi,onArchived:()=>{d(!1),n("/projects?tab=archived")}}),o.jsx(VT,{open:f&&!!i.flowId,onClose:()=>u(!1),flowId:i.flowId||"",flowSource:hi,flowArchived:!!i.archived,onDeleted:async()=>{u(!1),n("/projects")}}),et?Fr.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:()=>qe(!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:dt.name,onChange:S=>{const A=S.target.value;He(U=>({...U,name:A,id:U.id?U.id:A.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:dt.id,onChange:S=>He(A=>({...A,id:S.target.value})),placeholder:"content-cleanup-snippet"})]}),o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"说明"}),o.jsx("textarea",{value:dt.description,onChange:S=>He(A=>({...A,description:S.target.value})),placeholder:"这段流程适合什么 workspace 场景、需要接哪些上下游。",rows:4})]}),o.jsxs("div",{className:"af-flow-snippet-summary",children:["将发布 ",Wn.length," 个节点和 ",co.length," 条内部连线。"]}),on?o.jsx("div",{className:"af-flow-snippet-error",children:on}):null]}),o.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>qe(!1),children:"取消"}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:bt||!dt.name.trim(),onClick:()=>void Vp(),children:bt?"发布中...":"发布"})]})]})}),document.body):null,ue?Fr.createPortal(o.jsx("div",{className:"af-flow-snippet-modal-overlay",children:o.jsxs("div",{className:"af-flow-snippet-modal af-display-share-modal",role:"dialog","aria-modal":"true","aria-label":"发布展示页",children:[o.jsxs("div",{className:"af-flow-snippet-modal__head",children:[o.jsxs("span",{className:"af-flow-snippet-modal__title",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"present_to_all"}),"发布展示页"]}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>ke(!1),"aria-label":"关闭",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),o.jsxs("div",{className:"af-flow-snippet-modal__body",children:[o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"标题"}),o.jsx("input",{type:"text",value:Zt.title,onChange:S=>ar(A=>({...A,title:S.target.value})),placeholder:"展示页标题",autoFocus:!0})]}),o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"布局"}),o.jsxs("select",{className:"af-display-share-select",value:Zt.layout,onChange:S=>ar(A=>({...A,layout:S.target.value})),children:[o.jsx("option",{value:"gallery",children:"Gallery"}),o.jsx("option",{value:"document",children:"Document"}),o.jsx("option",{value:"slides",children:"Slides"})]})]}),o.jsx("div",{className:"af-display-share-node-list",role:"group","aria-label":"选择展示节点",children:Pn.map(S=>{var U,G;const A=Array.isArray(Zt.nodeIds)&&Zt.nodeIds.includes(S.id);return o.jsxs("label",{className:"af-display-share-node-row",children:[o.jsx("input",{type:"checkbox",checked:A,onChange:()=>Qr(S.id)}),o.jsxs("span",{className:"af-display-share-node-row__main",children:[o.jsx("strong",{children:((U=S.data)==null?void 0:U.label)||S.id}),o.jsxs("small",{children:[Kn((G=S.data)==null?void 0:G.definitionId)," · ",S.id]})]})]},S.id)})}),st!=null&&st.absoluteUrl?o.jsxs("div",{className:"af-display-share-result",children:[o.jsx("input",{type:"text",readOnly:!0,value:st.absoluteUrl,onFocus:S=>S.target.select()}),o.jsx("button",{type:"button",onClick:()=>window.open(st.absoluteUrl,"_blank","noopener,noreferrer"),children:"打开"}),o.jsx("button",{type:"button",onClick:()=>void qs(),children:bn==="copied"?"已复制":bn==="failed"?"复制失败":"复制"})]}):null,at?o.jsx("div",{className:"af-flow-snippet-error",children:at}):null]}),o.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>ke(!1),children:"取消"}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:De||!Array.isArray(Zt.nodeIds)||Zt.nodeIds.length===0,onClick:()=>void Up(),children:De?"生成中...":"生成链接"})]})]})}),document.body):null,_n?Fr.createPortal(o.jsx("div",{className:"af-flow-snippet-modal-overlay",children:o.jsxs("div",{className:"af-flow-snippet-modal af-display-link-modal",role:"dialog","aria-modal":"true","aria-label":"展示链接",children:[o.jsxs("div",{className:"af-flow-snippet-modal__head",children:[o.jsxs("span",{className:"af-flow-snippet-modal__title",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"link"}),"展示链接"]}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>{lr(""),gn(!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:[st!=null&&st.absoluteUrl?o.jsxs("div",{className:"af-display-link-modal__url",children:[o.jsx("input",{type:"text",readOnly:!0,value:st.absoluteUrl,onFocus:S=>S.target.select(),autoFocus:!0}),o.jsxs("button",{type:"button",onClick:()=>window.open(st.absoluteUrl,"_blank","noopener,noreferrer"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_new"}),"打开"]}),o.jsxs("button",{type:"button",onClick:()=>void qs(),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:bn==="copied"?"check":"content_copy"}),bn==="copied"?"已复制":bn==="failed"?"复制失败":"复制"]})]}):o.jsx("div",{className:"af-display-link-modal__empty",children:"还没有生成展示链接"}),at?o.jsx("div",{className:"af-flow-snippet-error",children:at}):null]}),o.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>{lr(""),gn(!1)},children:"关闭"}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:De||x.nodeIds.length===0,onClick:()=>void Ks(),children:De?"生成中...":st!=null&&st.absoluteUrl?"更新链接":"生成链接"})]})]})}),document.body):null,ve?Fr.createPortal(o.jsx("div",{className:"af-flow-snippet-modal-overlay",children:o.jsxs("div",{className:"af-flow-snippet-modal af-display-picker-modal",role:"dialog","aria-modal":"true","aria-label":"选择展示节点",children:[o.jsxs("div",{className:"af-flow-snippet-modal__head",children:[o.jsxs("span",{className:"af-flow-snippet-modal__title",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add_to_photos"}),"选择展示节点"]}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>$e(!1),"aria-label":"关闭",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),o.jsxs("div",{className:"af-flow-snippet-modal__body",children:[o.jsxs("label",{className:"af-display-picker-search",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{type:"search",value:nt,onChange:S=>zt(S.target.value),placeholder:"搜索展示节点...",autoFocus:!0})]}),o.jsx("div",{className:"af-display-picker-grid",role:"group","aria-label":"选择展示节点",style:{"--af-display-picker-columns":Tl.length||1},children:Ko.length>0?Tl.map((S,A)=>o.jsx("div",{className:"af-display-picker-column",children:S.map(Bp)},`display-picker-column-${A}`)):o.jsx("div",{className:"af-display-picker-empty",children:Li.length===0?"当前 Workspace 没有 display 节点":"没有匹配的展示节点"})})]}),o.jsx("div",{className:"af-flow-snippet-modal__foot",children:o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",onClick:()=>$e(!1),children:"完成"})})]})}),document.body):null,!mt&&oe?Fr.createPortal(o.jsx("div",{className:"af-workspace-quick-add-backdrop",onMouseDown:()=>Te(!1),children:o.jsxs("div",{className:"af-workspace-quick-add",role:"dialog","aria-modal":"true","aria-label":"Add workspace node",onMouseDown:S=>S.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":Ue==="nodes",className:"af-workspace-quick-add__tab"+(Ue==="nodes"?" af-workspace-quick-add__tab--active":""),onClick:()=>Ht("nodes"),children:"节点"}),o.jsx("button",{type:"button",role:"tab","aria-selected":Ue==="flows",className:"af-workspace-quick-add__tab"+(Ue==="flows"?" af-workspace-quick-add__tab--active":""),onClick:()=>Ht("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:nd,value:yn,onChange:S=>cr(S.target.value),onKeyDown:S=>{if(S.key==="Escape")S.preventDefault(),Te(!1);else if(S.key==="ArrowDown"){S.preventDefault();const A=Ue==="flows"?tr.length:Jr.length;as(U=>Math.min(Math.max(0,A-1),U+1))}else S.key==="ArrowUp"?(S.preventDefault(),as(A=>Math.max(0,A-1))):S.key==="Tab"?(S.preventDefault(),Ht(A=>A==="nodes"?"flows":"nodes")):S.key==="Enter"&&(S.preventDefault(),Ue==="flows"?Et(tr[Hs]||tr[0]):Ml(Jr[Hs]||Jr[0]))},placeholder:Ue==="flows"?"搜索流程片段...":"搜索节点...","aria-label":Ue==="flows"?"搜索流程片段":"搜索节点"})]}),o.jsx("div",{className:"af-workspace-quick-add__list",children:Ue==="flows"?tr.length===0?o.jsx("div",{className:"af-workspace-quick-add__empty",children:pe?"正在加载流程片段...":je||"没有匹配的流程片段"}):tr.map((S,A)=>{const U=S.displayName||S.name||S.id,G=S.snippet&&typeof S.snippet=="object"?S.snippet.instances:null,Q=S.snippet&&typeof S.snippet=="object"?S.snippet.edges:null,se=Number.isFinite(Number(S.nodeCount))?Number(S.nodeCount):Object.keys(G||{}).length,re=Number.isFinite(Number(S.edgeCount))?Number(S.edgeCount):Array.isArray(Q)?Q.length:0;return o.jsxs("button",{type:"button",className:"af-workspace-quick-add__item"+(A===Hs?" af-workspace-quick-add__item--active":""),onMouseEnter:()=>as(A),onClick:()=>Et(S),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:U}),o.jsxs("span",{className:"af-workspace-quick-add__meta",children:[S.id,S.version?` · v${S.version}`:""]}),o.jsx("span",{className:"af-workspace-quick-add__desc",children:S.description||`${se} 节点 / ${re} 连线`})]}),o.jsx("span",{className:"af-workspace-quick-add__cat",children:"FLOW"})]},`${S.id}@${S.version}`)}):Jr.length===0?o.jsx("div",{className:"af-workspace-quick-add__empty",children:"没有匹配的节点"}):Jr.map((S,A)=>{const U=Qd(S),G=Zd(S),Q=zb(S);return o.jsxs("button",{type:"button",className:"af-workspace-quick-add__item"+(A===Hs?" af-workspace-quick-add__item--active":""),onMouseEnter:()=>as(A),onClick:()=>Ml(S),children:[o.jsx("span",{className:"af-workspace-quick-add__icon material-symbols-outlined","aria-hidden":!0,children:_1(U)}),o.jsxs("span",{className:"af-workspace-quick-add__main",children:[o.jsx("span",{className:"af-workspace-quick-add__label",children:G}),o.jsx("span",{className:"af-workspace-quick-add__meta",children:S.id}),Q?o.jsx("span",{className:"af-workspace-quick-add__desc",children:Q}):null]}),o.jsx("span",{className:"af-workspace-quick-add__cat",children:U})]},S.id)})})]})}),document.body):null]})]})}function gY(){return o.jsx(sy,{children:o.jsx(mY,{})})}function yY(e){const t=[...(e==null?void 0:e.inputs)||[],...(e==null?void 0:e.outputs)||[]],n=(e==null?void 0:e.kind)==="image"?"src":"content",r=a=>String((a==null?void 0:a.value)??(a==null?void 0:a.default)??""),s=a=>r(a).trim(),i=t.find(a=>(a==null?void 0:a.name)===n&&s(a))||t.find(a=>(a==null?void 0:a.name)==="filePath"&&s(a))||t.find(a=>(a==null?void 0:a.type)==="text"&&s(a));return String((e==null?void 0:e.body)||(i?r(i):""))}function xY(e){return e==="mermaid"?"account_tree":e==="ascii"?"notes":e==="html"?"html":e==="image"?"image":e==="chart"?"bar_chart":e==="table"?"table":"article"}function wY(e){let t=String(e||"").replace(/\r\n/g,`
|
|
184
|
+
`).trim();return t.includes(`
|
|
185
|
+
`)||(t=t.replace(/\s+(resultFile|result|outParams|outParams\.[A-Za-z_][A-Za-z0-9_-]*)\s*:/g,`
|
|
186
|
+
$1:`).replace(/(^|\n)outParams:\s+([A-Za-z_][A-Za-z0-9_-]*\s*:)/g,`$1outParams:
|
|
187
|
+
$2`)),t}function j2(e){const t=String(e||"").trim();if(!t)return String(e||"");const n=t.match(/---agentflow\b([\s\S]*?)---end/i);if(n!=null&&n[1]){const a=wY(n[1]),l=a.match(/^resultFile\s*:\s*["']?([^"'\n]+)["']?/m);if(l!=null&&l[1])return l[1].trim();const c=a.match(/^result\s*:\s*(.*)$/m);if(c){const f=String(c[1]||"").trim();return f==="|"||f===">"?a.slice((c.index||0)+c[0].length).split(`
|
|
188
|
+
`).filter(p=>/^\s+/.test(p)||!p.trim()).map(p=>p.replace(/^\s{2}/,"")).join(`
|
|
189
|
+
`).replace(/\s+$/g,""):f.replace(/^["']|["']$/g,"")}const d=t.replace(n[0],"").trim();if(d)return d}if(!/["']result["']\s*:|["']outParams["']\s*:|["']resultFile["']\s*:/i.test(t))return String(e||"");const r=[t],s=t.indexOf("{"),i=t.lastIndexOf("}");s>=0&&i>s&&r.unshift(t.slice(s,i+1));for(const a of r)try{const l=JSON.parse(a);if(l&&typeof l=="object"&&!Array.isArray(l)&&(Object.prototype.hasOwnProperty.call(l,"result")||Object.prototype.hasOwnProperty.call(l,"resultFile"))){const c=l.resultFile||l.result;return typeof c=="string"?c:JSON.stringify(c,null,2)}}catch{}return String(e||"")}function F0(e){let t=j2(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 bY(e){const t=F0(e);return t.trim()?/<[^>]*$/g.test(t)?"HTML 内容末尾存在未闭合标签,可能是生成或保存时被截断。":/^(?:<!doctype\b|<html\b)/i.test(t)&&!/<\/html\s*>/i.test(t)?"完整 HTML 文档缺少 </html> 结束标签,可能是生成或保存时被截断。":"":""}function vY(e){const t=F0(e);if(!t.trim())return"";const n=`<base target="_self"><script>
|
|
190
|
+
(() => {
|
|
191
|
+
document.addEventListener("click", (event) => {
|
|
192
|
+
const link = event.target && event.target.closest ? event.target.closest("a[href]") : null;
|
|
193
|
+
if (!link) return;
|
|
194
|
+
const rawHref = String(link.getAttribute("href") || "").trim();
|
|
195
|
+
if (!rawHref || rawHref.startsWith("#")) return;
|
|
196
|
+
if (/^(?:javascript|mailto|tel):/i.test(rawHref)) return;
|
|
197
|
+
event.preventDefault();
|
|
198
|
+
window.location.href = link.href;
|
|
199
|
+
}, true);
|
|
200
|
+
})();
|
|
201
|
+
<\/script>`;return/<script\b[^>]*>\s*\(\(\)\s*=>\s*\{\s*document\.addEventListener\("click"/i.test(t)?t:/<head\b[^>]*>/i.test(t)?t.replace(/<head\b([^>]*)>/i,`<head$1>${n}`):/<html\b[^>]*>/i.test(t)?t.replace(/<html\b([^>]*)>/i,`<html$1><head>${n}</head>`):`<!doctype html><html><head>${n}</head><body>${t}</body></html>`}function C2(e,t,n={}){const r=String(e||"").trim();if(!r)return"";if(/^(?:https?:|data:|blob:|file:)/i.test(r)||r.startsWith("/"))return r;const s=new URLSearchParams;return s.set("id",t),s.set("path",r),n.download&&s.set("download","1"),`/api/display/file/raw?${s.toString()}`}function kY(e,t,n={}){const r=String(e||"").trim();return r?C2(r,t,n):""}function SY({className:e="",children:t}){const n=h.useRef(null),r=h.useRef(null),[s,i]=h.useState({visible:!1,top:0,height:100}),a=h.useCallback(()=>{const f=n.current;if(!f)return;const u=Math.max(1,f.scrollHeight),p=Math.max(1,f.clientHeight),m=u>p+1,y=m?Math.max(12,p/u*100):100,b=Math.max(0,100-y),k=m?Math.min(b,f.scrollTop/Math.max(1,u-p)*b):0;i({visible:m,top:k,height:y})},[]);h.useEffect(()=>{const f=requestAnimationFrame(a),u=n.current;if(!u||typeof ResizeObserver>"u")return()=>cancelAnimationFrame(f);const p=new ResizeObserver(a);p.observe(u);for(const m of Array.from(u.children))p.observe(m);return()=>{cancelAnimationFrame(f),p.disconnect()}},[t,a]);const l=h.useCallback(f=>{const u=n.current;if(!u)return;const p=Math.max(0,u.scrollHeight-u.clientHeight);u.scrollTop=Math.min(1,Math.max(0,f))*p,a()},[a]),c=h.useCallback((f,u=0)=>{const p=r.current;if(!p)return 0;const m=p.getBoundingClientRect(),y=s.height/100*m.height,b=Math.max(1,m.height-y);return(f-m.top-u)/b},[s.height]),d=h.useCallback(f=>{if(!s.visible)return;f.preventDefault(),f.stopPropagation();const u=r.current;if(!u)return;const p=u.getBoundingClientRect(),m=s.top/100*p.height,y=s.height/100*p.height,k=f.clientY>=p.top+m&&f.clientY<=p.top+m+y?f.clientY-p.top-m:y/2;l(c(f.clientY,k));const g=x=>{x.preventDefault(),l(c(x.clientY,k))},v=()=>{window.removeEventListener("pointermove",g),window.removeEventListener("pointerup",v),window.removeEventListener("pointercancel",v)};window.addEventListener("pointermove",g),window.addEventListener("pointerup",v),window.addEventListener("pointercancel",v)},[c,l,s.height,s.top,s.visible]);return o.jsxs("div",{className:`af-public-display-node__body ${e} nowheel nopan nodrag`,children:[o.jsx("div",{ref:n,className:`af-public-display-node__scroller ${e} nowheel nopan nodrag`,onScroll:a,children:t}),o.jsx("div",{ref:r,className:"af-public-display-scrollbar"+(s.visible?" af-public-display-scrollbar--visible":""),onPointerDown:d,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${s.height}%`,top:`${s.top}%`}})})]})}function NY({node:e,shareId:t,style:n}){const r=yY(e),s=e.kind==="html"?F0(r):j2(r),i=e.kind==="html"?bY(s):"",a=`af-public-display-node__body--${e.kind||"unknown"}`;return o.jsxs("section",{className:`af-public-display-node af-public-display-node--${e.kind||"unknown"}`,style:n,children:[o.jsx("div",{className:"af-public-display-node__head",children:o.jsxs("div",{className:"af-public-display-node__title",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:xY(e.kind)}),o.jsx("strong",{children:e.label||e.id}),o.jsx("em",{children:e.definitionId||e.kind||"display"})]})}),o.jsx(SY,{className:a,children:i?o.jsx("div",{className:"af-public-display-empty",children:i}):s.trim()?o.jsxs(o.Fragment,{children:[e.kind==="html"?o.jsx("iframe",{title:e.label||e.id,sandbox:"allow-scripts allow-forms allow-modals",srcDoc:vY(s)}):null,e.kind==="image"?o.jsx("img",{src:C2(s,t),alt:e.label||e.id,loading:"lazy"}):null,e.kind==="markdown"?o.jsx("div",{className:"af-public-display-markdown",children:o.jsx(M0,{content:s,resolveSrc:(l,c)=>kY(l,t,c)})}):null,e.kind==="chart"?o.jsx($0,{content:s}):null,e.kind==="table"?o.jsx(O0,{content:s}):null,e.kind==="mermaid"||e.kind==="ascii"?o.jsx("pre",{children:s}):null]}):o.jsx("div",{className:"af-public-display-empty",children:"No display content"})})]})}function jY({data:e}){return o.jsx(NY,{node:e==null?void 0:e.node,shareId:e==null?void 0:e.shareId})}const CY={publicDisplay:jY};function EY(e){const t=String(e||"").split("/").filter(Boolean);return t[0]==="display"&&t[1]?decodeURIComponent(t[1]):new URLSearchParams(window.location.search).get("id")||""}function E2(){var a;const{path:e}=Ro(),t=h.useMemo(()=>EY(e),[e]),[n,r]=h.useState({loading:!0,error:"",share:null,nodes:[]});h.useEffect(()=>{let l=!1;async function c(){if(!t){r({loading:!1,error:"Missing display share id",share:null,nodes:[]});return}r(d=>({...d,loading:!0,error:""}));try{const d=await fetch(`/api/display/share?id=${encodeURIComponent(t)}`),f=await d.json().catch(()=>({}));if(!d.ok)throw new Error(f.error||"展示页不存在");l||r({loading:!1,error:"",share:f.share||null,nodes:Array.isArray(f.nodes)?f.nodes:[]})}catch(d){l||r({loading:!1,error:String((d==null?void 0:d.message)||d),share:null,nodes:[]})}}return c(),()=>{l=!0}},[t]);const s=h.useMemo(()=>(Array.isArray(n.nodes)?n.nodes:[]).map((c,d)=>{const f=c.position&&typeof c.position.x=="number"&&typeof c.position.y=="number"?c.position:{x:120+d*40,y:100+d*32},u=c.size&&typeof c.size.width=="number"&&typeof c.size.height=="number"?c.size:{width:520,height:320};return{id:c.id,type:"publicDisplay",position:f,data:{node:c,shareId:t},selectable:!1,draggable:!1,style:{width:Math.max(1,Number(u.width)||520),height:Math.max(1,Number(u.height)||320)}}}),[t,n.nodes]),i=h.useMemo(()=>{var u;const l=(u=n.share)==null?void 0:u.viewport;if(!l||typeof l!="object")return null;const c=Number(l.x),d=Number(l.y),f=Number(l.zoom);return!Number.isFinite(c)||!Number.isFinite(d)||!Number.isFinite(f)?null:{x:c,y:d,zoom:Math.min(Math.max(f,.1),4)}},[(a=n.share)==null?void 0:a.viewport]);return n.loading?o.jsx("main",{className:"af-public-display-page",children:o.jsx("div",{className:"af-public-display-status",children:"Loading..."})}):n.error?o.jsx("main",{className:"af-public-display-page",children:o.jsxs("div",{className:"af-public-display-status af-public-display-status--error",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"error"}),o.jsx("span",{children:n.error})]})}):o.jsx("main",{className:"af-public-display-page af-public-display-page--canvas",children:o.jsx(sy,{children:o.jsx(c0,{className:"af-public-display-flow",nodes:s,edges:[],nodeTypes:CY,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,panOnDrag:!0,noPanClassName:"nopan",noDragClassName:"nodrag",noWheelClassName:"nowheel",panOnScroll:!0,zoomOnScroll:!0,zoomOnPinch:!0,defaultViewport:i||void 0,fitView:!i,fitViewOptions:{padding:.18,duration:180},minZoom:.1,maxZoom:4,proOptions:{hideAttribution:!0},children:o.jsx(d0,{color:"rgba(255,255,255,0.12)",gap:22,size:1})})})})}const Nt=e=>typeof e=="string",zd=()=>{let e,t;const n=new Promise((r,s)=>{e=r,t=s});return n.resolve=e,n.reject=t,n},D1=e=>e==null?"":""+e,_Y=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},PY=/###/g,F1=e=>e&&e.indexOf("###")>-1?e.replace(PY,"."):e,z1=e=>!e||Nt(e),wf=(e,t,n)=>{const r=Nt(t)?t.split("."):t;let s=0;for(;s<r.length-1;){if(z1(e))return{};const i=F1(r[s]);!e[i]&&n&&(e[i]=new n),Object.prototype.hasOwnProperty.call(e,i)?e=e[i]:e={},++s}return z1(e)?{}:{obj:e,k:F1(r[s])}},H1=(e,t,n)=>{const{obj:r,k:s}=wf(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=wf(e,a,Object);for(;l.obj===void 0&&a.length;)i=`${a[a.length-1]}.${i}`,a=a.slice(0,a.length-1),l=wf(e,a,Object),l&&l.obj&&typeof l.obj[`${l.k}.${i}`]<"u"&&(l.obj=void 0);l.obj[`${l.k}.${i}`]=n},AY=(e,t,n,r)=>{const{obj:s,k:i}=wf(e,t,Object);s[i]=s[i]||[],s[i].push(n)},bg=(e,t)=>{const{obj:n,k:r}=wf(e,t);if(n)return n[r]},IY=(e,t,n)=>{const r=bg(e,n);return r!==void 0?r:bg(t,n)},_2=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?Nt(e[r])||e[r]instanceof String||Nt(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):_2(e[r],t[r],n):e[r]=t[r]);return e},Hc=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var TY={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const RY=e=>Nt(e)?e.replace(/[&<>"'\/]/g,t=>TY[t]):e;class LY{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 MY=[" ",",","?","!",";"],OY=new LY(20),$Y=(e,t,n)=>{t=t||"",n=n||"";const r=MY.filter(a=>t.indexOf(a)<0&&n.indexOf(a)<0);if(r.length===0)return!0;const s=OY.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},Wb=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return e[t];const r=t.split(n);let s=e;for(let i=0;i<r.length;){if(!s||typeof s!="object")return;let a,l="";for(let c=i;c<r.length;++c)if(c!==i&&(l+=n),l+=r[c],a=s[l],a!==void 0){if(["string","number","boolean"].indexOf(typeof a)>-1&&c<r.length-1)continue;i+=c-i+1;break}s=a}return s},vg=e=>e&&e.replace("_","-"),DY={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 kg{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||DY,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:(Nt(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new kg(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new kg(this.logger,t)}}var No=new kg;class dy{constructor(){this.observers={}}on(t,n){return t.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const s=this.observers[r].get(n)||0;this.observers[r].set(n,s+1)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t].delete(n)}}emit(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];this.observers[t]&&Array.from(this.observers[t].entries()).forEach(a=>{let[l,c]=a;for(let d=0;d<c;d++)l(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(a=>{let[l,c]=a;for(let d=0;d<c;d++)l.apply(l,[t,...r])})}}class B1 extends dy{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):Nt(r)&&i?l.push(...r.split(i)):l.push(r)));const c=bg(this.data,l);return!c&&!n&&!r&&t.indexOf(".")>-1&&(t=l[0],n=l[1],r=l.slice(2).join(".")),c||!a||!Nt(r)?c:Wb(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),H1(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)(Nt(r[i])||Array.isArray(r[i]))&&this.addResource(t,n,i,r[i],{silent:!0});s.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,s,i){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},l=[t,n];t.indexOf(".")>-1&&(l=t.split("."),s=r,r=n,n=l[1]),this.addNamespaces(n);let c=bg(this.data,l)||{};a.skipCopy||(r=JSON.parse(JSON.stringify(r))),s?_2(c,r,i):c={...c,...r},H1(this.data,l,c),a.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(t,n)}:this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(s=>n[s]&&Object.keys(n[s]).length>0)}toJSON(){return this.data}}var P2={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 W1={};class Sg extends dy{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),_Y(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=No.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&&!$Y(t,r,s);if(a&&!l){const c=t.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:t,namespaces:Nt(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:Nt(i)?[i]:i}}translate(t,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const s=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:a,namespaces:l}=this.extractFromKey(t[t.length-1],n),c=l[l.length-1],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:`${c}${N}${a}`,usedKey:a,exactUsedKey:a,usedLng:d,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:`${c}${N}${a}`}return s?{res:a,usedKey:a,exactUsedKey:a,usedLng:d,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:a}const u=this.resolve(t,n);let p=u&&u.res;const m=u&&u.usedKey||a,y=u&&u.exactUsedKey||a,b=Object.prototype.toString.apply(p),k=["[object Number]","[object Function]","[object RegExp]"],g=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject,x=!Nt(p)&&typeof p!="boolean"&&typeof p!="number";if(v&&p&&x&&k.indexOf(b)<0&&!(Nt(g)&&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(m,p,{...n,ns:l}):`key '${a} (${this.language})' returned an object instead of string.`;return s?(u.res=N,u.usedParams=this.getUsedParamsDetails(n),u):N}if(i){const N=Array.isArray(p),_=N?[]:{},C=N?y:m;for(const T in p)if(Object.prototype.hasOwnProperty.call(p,T)){const H=`${C}${i}${T}`;_[T]=this.translate(H,{...n,joinArrays:!1,ns:l}),_[T]===H&&(_[T]=p[T])}p=_}}else if(v&&Nt(g)&&Array.isArray(p))p=p.join(g),p&&(p=this.extendTranslation(p,t,n,r));else{let N=!1,_=!1;const C=n.count!==void 0&&!Nt(n.count),T=Sg.hasDefaultValue(n),H=C?this.pluralResolver.getSuffix(d,n.count,n):"",M=n.ordinal&&C?this.pluralResolver.getSuffix(d,n.count,{ordinal:!1}):"",F=C&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),D=F&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${H}`]||n[`defaultValue${M}`]||n.defaultValue;!this.isValidLookup(p)&&T&&(N=!0,p=D),this.isValidLookup(p)||(_=!0,p=a);const W=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&_?void 0:p,O=T&&D!==p&&this.options.updateMissing;if(_||N||O){if(this.logger.log(O?"updateKey":"missingKey",d,c,a,O?D: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 R=[];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++)R.push(I[P]);else this.options.saveMissingTo==="all"?R=this.languageUtils.toResolveHierarchy(n.lng||this.language):R.push(n.lng||this.language);const z=(P,L,E)=>{const X=T&&E!==p?E:W;this.options.missingKeyHandler?this.options.missingKeyHandler(P,c,L,X,O,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(P,c,L,X,O,n),this.emit("missingKey",P,c,L,p)};this.options.saveMissing&&(this.options.saveMissingPlurals&&C?R.forEach(P=>{const L=this.pluralResolver.getSuffixes(P,n);F&&n[`defaultValue${this.options.pluralSeparator}zero`]&&L.indexOf(`${this.options.pluralSeparator}zero`)<0&&L.push(`${this.options.pluralSeparator}zero`),L.forEach(E=>{z([P],a+E,n[`defaultValue${E}`]||D)})}):z(R,a,D))}p=this.extendTranslation(p,t,n,u,r),_&&p===a&&this.options.appendNamespaceToMissingKey&&(p=`${c}:${a}`),(_||N)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?p=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}:${a}`:a,N?p:void 0):p=this.options.parseMissingKeyHandler(p))}return s?(u.res=p,u.usedParams=this.getUsedParamsDetails(n),u):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=Nt(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 u=r.replace&&!Nt(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(u={...this.options.interpolation.defaultVariables,...u}),t=this.interpolator.interpolate(t,u,r.lng||this.language||s.usedLng,r),d){const p=t.match(this.interpolator.nestingRegexp),m=p&&p.length;f<m&&(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,m=new Array(p),y=0;y<p;y++)m[y]=arguments[y];return i&&i[0]===m[0]&&!r.context?(a.logger.warn(`It seems you are nesting recursively key: ${m[0]} in key: ${n[0]}`),null):a.translate(...m,n)},r)),r.interpolation&&this.interpolator.reset()}const l=r.postProcess||this.options.postProcess,c=Nt(l)?[l]:l;return t!=null&&c&&c.length&&r.applyPostProcessor!==!1&&(t=P2.handle(c,t,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...s,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r,s,i,a,l;return Nt(t)&&(t=[t]),t.forEach(c=>{if(this.isValidLookup(r))return;const d=this.extractFromKey(c,n),f=d.key;s=f;let u=d.namespaces;this.options.fallbackNS&&(u=u.concat(this.options.fallbackNS));const p=n.count!==void 0&&!Nt(n.count),m=p&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),y=n.context!==void 0&&(Nt(n.context)||typeof n.context=="number")&&n.context!=="",b=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);u.forEach(k=>{this.isValidLookup(r)||(l=k,!W1[`${b[0]}-${k}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(l)&&(W1[`${b[0]}-${k}`]=!0,this.logger.warn(`key "${s}" for languages "${b.join(", ")}" won't get resolved as namespace "${l}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),b.forEach(g=>{if(this.isValidLookup(r))return;a=g;const v=[f];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(v,f,g,k,n);else{let N;p&&(N=this.pluralResolver.getSuffix(g,n.count,n));const _=`${this.options.pluralSeparator}zero`,C=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(p&&(v.push(f+N),n.ordinal&&N.indexOf(C)===0&&v.push(f+N.replace(C,this.options.pluralSeparator)),m&&v.push(f+_)),y){const T=`${f}${this.options.contextSeparator}${n.context}`;v.push(T),p&&(v.push(T+N),n.ordinal&&N.indexOf(C)===0&&v.push(T+N.replace(C,this.options.pluralSeparator)),m&&v.push(T+_))}}let x;for(;x=v.pop();)this.isValidLookup(r)||(i=x,r=this.getResource(g,k,x,n))}))})}),{res:r,usedKey:s,exactUsedKey:i,usedLng:a,usedNS:l}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,r,s):this.resourceStore.getResource(t,n,r,s)}getUsedParamsDetails(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&!Nt(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 Wx=e=>e.charAt(0).toUpperCase()+e.slice(1);class V1{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=No.create("languageUtils")}getScriptPartFromCode(t){if(t=vg(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=vg(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(Nt(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]=Wx(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]=Wx(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=Wx(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)),Nt(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 Nt(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))):Nt(t)&&i(this.formatLanguageCode(t)),r.forEach(a=>{s.indexOf(a)<0&&i(this.formatLanguageCode(a))}),s}}let FY=[{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}],zY={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 HY=["v1","v2","v3"],BY=["v4"],U1={zero:0,one:1,two:2,few:3,many:4,other:5},WY=()=>{const e={};return FY.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:zY[t.fc]}})}),e};class VY{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=No.create("pluralResolver"),(!this.options.compatibilityJSON||BY.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=WY(),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=vg(t==="dev"?"en":t),s=n.ordinal?"ordinal":"cardinal",i=JSON.stringify({cleanedCode:r,type:s});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let a;try{a=new Intl.PluralRules(r,{type:s})}catch{if(!t.match(/-|_/))return;const c=this.languageUtils.getLanguagePartFromCode(t);a=this.getRule(c,n)}return this.pluralRulesCache[i]=a,a}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}needsPlural(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}getPluralFormsOfKey(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,r).map(s=>`${n}${s}`)}getSuffixes(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((s,i)=>U1[s]-U1[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!HY.includes(this.options.compatibilityJSON)}}const K1=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=IY(e,t,n);return!i&&s&&Nt(n)&&(i=Wb(e,n,r),i===void 0&&(i=Wb(t,n,r))),i},Vx=e=>e.replace(/\$/g,"$$$$");class UY{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=No.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||(n=>n),this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const{escape:n,escapeValue:r,useRawValueToEscape:s,prefix:i,prefixEscaped:a,suffix:l,suffixEscaped:c,formatSeparator:d,unescapeSuffix:f,unescapePrefix:u,nestingPrefix:p,nestingPrefixEscaped:m,nestingSuffix:y,nestingSuffixEscaped:b,nestingOptionsSeparator:k,maxReplaces:g,alwaysFormat:v}=t.interpolation;this.escape=n!==void 0?n:RY,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=i?Hc(i):a||"{{",this.suffix=l?Hc(l):c||"}}",this.formatSeparator=d||",",this.unescapePrefix=f?"":u||"-",this.unescapeSuffix=this.unescapePrefix?"":f||"",this.nestingPrefix=p?Hc(p):m||Hc("$t("),this.nestingSuffix=y?Hc(y):b||Hc(")"),this.nestingOptionsSeparator=k||",",this.maxReplaces=g||1e3,this.alwaysFormat=v!==void 0?v:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,r)=>n&&n.source===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(t,n,r,s){let i,a,l;const c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},d=m=>{if(m.indexOf(this.formatSeparator)<0){const g=K1(n,c,m,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(g,void 0,r,{...s,...n,interpolationkey:m}):g}const y=m.split(this.formatSeparator),b=y.shift().trim(),k=y.join(this.formatSeparator).trim();return this.format(K1(n,c,b,this.options.keySeparator,this.options.ignoreJSONStructure),k,r,{...s,...n,interpolationkey:b})};this.resetRegExp();const f=s&&s.missingInterpolationHandler||this.options.missingInterpolationHandler,u=s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:m=>Vx(m)},{regex:this.regexp,safeValue:m=>this.escapeValue?Vx(this.escape(m)):Vx(m)}].forEach(m=>{for(l=0;i=m.regex.exec(t);){const y=i[1].trim();if(a=d(y),a===void 0)if(typeof f=="function"){const k=f(t,i,s);a=Nt(k)?k:""}else if(s&&Object.prototype.hasOwnProperty.call(s,y))a="";else if(u){a=i[0];continue}else this.logger.warn(`missed to pass in variable ${y} for interpolating ${t}`),a="";else!Nt(a)&&!this.useRawValueToEscape&&(a=D1(a));const b=m.safeValue(a);if(t=t.replace(i[0],b),u?(m.regex.lastIndex+=a.length,m.regex.lastIndex-=i[0].length):m.regex.lastIndex=0,l++,l>=this.maxReplaces)break}}),t}nest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s,i,a;const l=(c,d)=>{const f=this.nestingOptionsSeparator;if(c.indexOf(f)<0)return c;const u=c.split(new RegExp(`${f}[ ]*{`));let p=`{${u[1]}`;c=u[0],p=this.interpolate(p,a);const m=p.match(/'/g),y=p.match(/"/g);(m&&m.length%2===0&&!y||y.length%2!==0)&&(p=p.replace(/'/g,'"'));try{a=JSON.parse(p),d&&(a={...d,...a})}catch(b){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,b),`${c}${f}${p}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,c};for(;s=this.nestingRegexp.exec(t);){let c=[];a={...r},a=a.replace&&!Nt(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(u=>u.trim());s[1]=f.shift(),c=f,d=!0}if(i=n(l.call(this,s[1].trim(),a),a),i&&s[0]===t&&!Nt(i))return i;Nt(i)||(i=D1(i)),i||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${t}`),i=""),d&&(i=c.reduce((f,u)=>this.format(f,u,r.lng,{...r,interpolationkey:s[1].trim()}),i.trim())),t=t.replace(s[0],i),this.regexp.lastIndex=0}return t}}const KY=e=>{let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const s=r[1].substring(0,r[1].length-1);t==="currency"&&s.indexOf(":")<0?n.currency||(n.currency=s.trim()):t==="relativetime"&&s.indexOf(":")<0?n.range||(n.range=s.trim()):s.split(";").forEach(a=>{if(a){const[l,...c]=a.split(":"),d=c.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}},Bc=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(vg(r),s),t[a]=l),l(n)}};class qY{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=No.create("formatter"),this.options=t,this.formats={number:Bc((n,r)=>{const s=new Intl.NumberFormat(n,{...r});return i=>s.format(i)}),currency:Bc((n,r)=>{const s=new Intl.NumberFormat(n,{...r,style:"currency"});return i=>s.format(i)}),datetime:Bc((n,r)=>{const s=new Intl.DateTimeFormat(n,{...r});return i=>s.format(i)}),relativetime:Bc((n,r)=>{const s=new Intl.RelativeTimeFormat(n,{...r});return i=>s.format(i,r.range||"day")}),list:Bc((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()]=Bc(n)}format(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const i=n.split(this.formatSeparator);if(i.length>1&&i[0].indexOf("(")>1&&i[0].indexOf(")")<0&&i.find(l=>l.indexOf(")")>-1)){const l=i.findIndex(c=>c.indexOf(")")>-1);i[0]=[i[0],...i.splice(1,l)].join(this.formatSeparator)}return i.reduce((l,c)=>{const{formatName:d,formatOptions:f}=KY(c);if(this.formats[d]){let u=l;try{const p=s&&s.formatParams&&s.formatParams[s.interpolationkey]||{},m=p.locale||p.lng||s.locale||s.lng||r;u=this.formats[d](l,m,{...f,...s,...p})}catch(p){this.logger.warn(p)}return u}else this.logger.warn(`there was no format function for ${d}`);return l},t)}}const YY=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class GY extends dy{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=No.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=s.maxParallelReads||10,this.readingCalls=0,this.maxRetries=s.maxRetries>=0?s.maxRetries:5,this.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,s.backend,s)}queueLoad(t,n,r,s){const i={},a={},l={},c={};return t.forEach(d=>{let f=!0;n.forEach(u=>{const p=`${d}|${u}`;!r.reload&&this.store.hasResourceBundle(d,u)?this.state[p]=2:this.state[p]<0||(this.state[p]===1?a[p]===void 0&&(a[p]=!0):(this.state[p]=1,f=!1,a[p]===void 0&&(a[p]=!0),i[p]===void 0&&(i[p]=!0),c[u]===void 0&&(c[u]=!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(c)}}loaded(t,n,r){const s=t.split("|"),i=s[0],a=s[1];n&&this.emit("failedLoading",i,a,n),!n&&r&&this.store.addResourceBundle(i,a,r,void 0,void 0,{skipCopy:!0}),this.state[t]=n?-1:2,n&&r&&(this.state[t]=0);const l={};this.queue.forEach(c=>{AY(c.loaded,[i],a),YY(c,t),n&&c.errors.push(n),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(d=>{l[d]||(l[d]={});const f=c.loaded[d];f.length&&f.forEach(u=>{l[d][u]===void 0&&(l[d][u]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",l),this.queue=this.queue.filter(c=>!c.done)}read(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!t.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:s,wait:i,callback:a});return}this.readingCalls++;const l=(d,f)=>{if(this.readingCalls--,this.waitingReads.length>0){const u=this.waitingReads.shift();this.read(u.lng,u.ns,u.fcName,u.tried,u.wait,u.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)},c=this.backend[r].bind(this.backend);if(c.length===2){try{const d=c(t,n);d&&typeof d.then=="function"?d.then(f=>l(null,f)).catch(l):l(null,d)}catch(d){l(d)}return}return c(t,n,l)}prepareLoading(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),s&&s();Nt(t)&&(t=this.languageUtils.toResolveHierarchy(t)),Nt(n)&&(n=[n]);const i=this.queueLoad(t,n,r,s);if(!i.toLoad.length)return i.pending.length||s(),null;i.toLoad.forEach(a=>{this.loadOne(a)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=t.split("|"),s=r[0],i=r[1];this.read(s,i,"read",void 0,void 0,(a,l)=>{a&&this.logger.warn(`${n}loading namespace ${i} for language ${s} failed`,a),!a&&l&&this.logger.log(`${n}loaded namespace ${i} for language ${s}`,l),this.loaded(t,a,l)})}saveMissing(t,n,r,s,i){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},l=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend&&this.backend.create){const c={...a,isUpdate:i},d=this.backend.create.bind(this.backend);if(d.length<6)try{let f;d.length===5?f=d(t,n,r,s,c):f=d(t,n,r,s),f&&typeof f.then=="function"?f.then(u=>l(null,u)).catch(l):l(null,f)}catch(f){l(f)}else d(t,n,r,s,l,c)}!t||!t[0]||this.store.addResource(t[0],n,r,s)}}}const q1=()=>({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]),Nt(e[1])&&(t.defaultValue=e[1]),Nt(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}}),Y1=e=>(Nt(e.ns)&&(e.ns=[e.ns]),Nt(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),Nt(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),Uh=()=>{},XY=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class np extends dy{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=Y1(t),this.services={},this.logger=No,this.modules={external:[]},XY(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&&(Nt(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const s=q1();this.options={...s,...this.options,...Y1(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?No.init(i(this.modules.logger),this.options):No.init(null,this.options);let f;this.modules.formatter?f=this.modules.formatter:typeof Intl<"u"&&(f=qY);const u=new V1(this.options);this.store=new B1(this.options.resources,this.options);const p=this.services;p.logger=No,p.resourceStore=this.store,p.languageUtils=u,p.pluralResolver=new VY(u,{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 UY(this.options),p.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},p.backendConnector=new GY(i(this.modules.backend),p.resourceStore,p,this.options),p.backendConnector.on("*",function(m){for(var y=arguments.length,b=new Array(y>1?y-1:0),k=1;k<y;k++)b[k-1]=arguments[k];t.emit(m,...b)}),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 Sg(this.services,this.options),this.translator.on("*",function(m){for(var y=arguments.length,b=new Array(y>1?y-1:0),k=1;k<y;k++)b[k-1]=arguments[k];t.emit(m,...b)}),this.modules.external.forEach(m=>{m.init&&m.init(this)})}if(this.format=this.options.interpolation.format,r||(r=Uh),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const f=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);f.length>0&&f[0]!=="dev"&&(this.options.lng=f[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(f=>{this[f]=function(){return t.store[f](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(f=>{this[f]=function(){return t.store[f](...arguments),t}});const c=zd(),d=()=>{const f=(u,p)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),c.resolve(p),r(u,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),c}loadResources(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Uh;const s=Nt(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(c=>a(c)),this.options.preload&&this.options.preload.forEach(l=>a(l)),this.services.backendConnector.load(i,this.options.ns,l=>{!l&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(l)})}else r(null)}reloadResources(t,n,r){const s=zd();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=Uh),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"&&P2.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=zd();this.emit("languageChanging",t);const i=c=>{this.language=c,this.languages=this.services.languageUtils.toResolveHierarchy(c),this.resolvedLanguage=void 0,this.setResolvedLanguage(c)},a=(c,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(c,function(){return r.t(...arguments)})},l=c=>{!t&&!c&&this.services.languageDetector&&(c=[]);const d=Nt(c)?c:this.services.languageUtils.getBestMatchFromCodes(c);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 c;if(typeof l!="object"){for(var d=arguments.length,f=new Array(d>2?d-2:0),u=2;u<d;u++)f[u-2]=arguments[u];c=s.options.overloadTranslationOptionHandler([a,l].concat(f))}else c={...l};c.lng=c.lng||i.lng,c.lngs=c.lngs||i.lngs,c.ns=c.ns||i.ns,c.keyPrefix!==""&&(c.keyPrefix=c.keyPrefix||r||i.keyPrefix);const p=s.options.keySeparator||".";let m;return c.keyPrefix&&Array.isArray(a)?m=a.map(y=>`${c.keyPrefix}${p}${y}`):m=c.keyPrefix?`${c.keyPrefix}${p}${a}`:a,s.t(m,c)};return Nt(t)?i.lng=t:i.lngs=t,i.ns=n,i.keyPrefix=r,i}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],s=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(l,c)=>{const d=this.services.backendConnector.state[`${l}|${c}`];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=zd();return this.options.ns?(Nt(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=zd();Nt(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 V1(q1());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 np(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Uh;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const s={...this.options,...t,isClone:!0},i=new np(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 B1(this.store.data,s),i.services.resourceStore=i.store),i.translator=new Sg(i.services,s),i.translator.on("*",function(l){for(var c=arguments.length,d=new Array(c>1?c-1:0),f=1;f<c;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 Wr=np.createInstance();Wr.createInstance=np.createInstance;Wr.createInstance;Wr.dir;Wr.init;Wr.loadResources;Wr.reloadResources;Wr.use;Wr.changeLanguage;Wr.getFixedT;Wr.t;Wr.exists;Wr.setDefaultNamespace;Wr.hasLoadedNamespace;Wr.loadNamespaces;Wr.loadLanguages;function JY(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rp(e){"@babel/helpers - typeof";return rp=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},rp(e)}function QY(e,t){if(rp(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(rp(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function ZY(e){var t=QY(e,"string");return rp(t)=="symbol"?t:t+""}function eG(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,ZY(r.key),r)}}function tG(e,t,n){return t&&eG(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var A2=[],nG=A2.forEach,rG=A2.slice;function sG(e){return nG.call(rG.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}var G1=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,iG=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(!G1.test(s.domain))throw new TypeError("option domain is invalid");a+="; Domain=".concat(s.domain)}if(s.path){if(!G1.test(s.path))throw new TypeError("option path is invalid");a+="; Path=".concat(s.path)}if(s.expires){if(typeof s.expires.toUTCString!="function")throw new TypeError("option expires is invalid");a+="; Expires=".concat(s.expires.toUTCString())}if(s.httpOnly&&(a+="; HttpOnly"),s.secure&&(a+="; Secure"),s.sameSite){var c=typeof s.sameSite=="string"?s.sameSite.toLowerCase():s.sameSite;switch(c){case!0:a+="; SameSite=Strict";break;case"lax":a+="; SameSite=Lax";break;case"strict":a+="; SameSite=Strict";break;case"none":a+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return a},X1={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=iG(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)}},oG={name:"cookie",lookup:function(t){var n;if(t.lookupCookie&&typeof document<"u"){var r=X1.read(t.lookupCookie);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupCookie&&typeof document<"u"&&X1.create(n.lookupCookie,t,n.cookieMinutes,n.cookieDomain,n.cookieOptions)}},aG={name:"querystring",lookup:function(t){var n;if(typeof window<"u"){var r=window.location.search;!window.location.search&&window.location.hash&&window.location.hash.indexOf("?")>-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));for(var s=r.substring(1),i=s.split("&"),a=0;a<i.length;a++){var l=i[a].indexOf("=");if(l>0){var c=i[a].substring(0,l);c===t.lookupQuerystring&&(n=i[a].substring(l+1))}}}return n}},Hd=null,J1=function(){if(Hd!==null)return Hd;try{Hd=window!=="undefined"&&window.localStorage!==null;var t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{Hd=!1}return Hd},lG={name:"localStorage",lookup:function(t){var n;if(t.lookupLocalStorage&&J1()){var r=window.localStorage.getItem(t.lookupLocalStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupLocalStorage&&J1()&&window.localStorage.setItem(n.lookupLocalStorage,t)}},Bd=null,Q1=function(){if(Bd!==null)return Bd;try{Bd=window!=="undefined"&&window.sessionStorage!==null;var t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{Bd=!1}return Bd},cG={name:"sessionStorage",lookup:function(t){var n;if(t.lookupSessionStorage&&Q1()){var r=window.sessionStorage.getItem(t.lookupSessionStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupSessionStorage&&Q1()&&window.sessionStorage.setItem(n.lookupSessionStorage,t)}},uG={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}},dG={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}},fG={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}},pG={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]}},I2=!1;try{document.cookie,I2=!0}catch{}var T2=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];I2||T2.splice(1,1);function hG(){return{order:T2,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(t){return t}}}var R2=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};JY(this,e),this.type="languageDetector",this.detectors={},this.init(t,n)}return tG(e,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n||{languageUtils:{}},this.options=sG(r,this.options||{},hG()),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(oG),this.addDetector(aG),this.addDetector(lG),this.addDetector(cG),this.addDetector(uG),this.addDetector(dG),this.addDetector(fG),this.addDetector(pG)}},{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)}))}}])}();R2.type="languageDetector";const mG={name:"AgentFlow",tagline:"AI Workflow Orchestration"},gG={projects:"Projects",nodes:"Nodes",myNodes:"My Nodes",myFlows:"My Flows",skills:"Skills",mcps:"MCP",feedback:"Feedback",flowEditor:"Flow Editor",settings:"Settings",back:"Back"},yG={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"},xG={success:"Success",failed:"Failed",pending:"Pending",running:"Running",skipped:"Skipped"},wG={agent:"Agent",control:"Control",tool:"Tool",start:"Start",end:"End"},bG={online:"Engine Online",offline:"Engine Offline",connecting:"Connecting…"},vG={hub:"AgentFlow Hub",docs:"Documentation",github:"GitHub Repository"},kG={app:mG,nav:gG,common:yG,status:xG,nodeTypes:wG,engine:bG,links:vG},SG="Flow Editor",NG="Nodes",jG="Edges",CG="Properties",EG={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"},_G={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}}"},PG={run:"Run Flow",stop:"Stop",resume:"Resume",validate:"Validate",export:"Export",import:"Import"},AG={nodeList:"Node List",runHistory:"Run History",validation:"Validation Results"},IG={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"},TG={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)"},RG={saving:"Saving...",saved:"Saved",saveFailed:"Save failed",runInTerminal:"Please use terminal to run"},LG={requirement:"Requirement Analysis",planning:"Technical Planning",code:"Code Execution",test:"Test Regression",normal:"Normal"},MG={phase:"Phase",allPhasesComplete:"All phases completed",currentPhaseComplete:"Current phase completed, waiting for confirmation..."},OG={node:"Node",text:"Text",file:"File",bool:"Boolean"},$G={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"},DG={title:"Keyboard Shortcuts",general:"General",saveDesc:"Save; when node properties sidebar is open, submit node first then save flow",shortcutsLabel:"Keyboard Shortcuts",jumpToNode:"Jump to node by ID",openNodePalette:"Open node palette",canvas:"Canvas",selectTool:"Select Tool",panTool:"Pan Tool",holdSpacePan:"Hold Space to temporarily pan",saveViewport:"Save current entry view",selectAll:"Select all nodes",undo:"Undo canvas change",redo:"Redo canvas change"},FG={title:"Jump to node",placeholder:"Type node ID or label…",empty:"No matching nodes",hintNavigate:"navigate",hintJump:"jump",hintClose:"close"},zG={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."},HG={mainNav:"Main Navigation"},BG={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'},WG={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):
|
|
202
|
+
{{summary}}`,step:"Step {{current}}/{{total}}: {{description}}",phaseGeneration:`Phased generation ({{count}} phases): {{labels}}
|
|
203
|
+
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}}"},VG={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"},UG={nodePalette:"Node Palette",noPipelineSelected:"No pipeline selected",moreRuns:"+{{count}} more",moreFlows:"+{{count}} more flows",runId:"Run ID: {{id}}"},KG={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}}"},qG={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"},YG={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"},GG={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"},XG={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"},JG={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"},QG={invalidPlaceholder:"Invalid placeholder: {{hint}}",empty:"(empty)",inputSubtitle:"Input · {{type}}",inputSubtitleNoType:"Input",outputSubtitle:"Output · {{type}}",outputSubtitleNoType:"Output",runtimeConst:"Runtime constant"},ZG={justNow:"Just now",minutesAgo:"{{n}} min ago",hoursAgo:"{{n}} hr ago",yesterday:"Yesterday",daysAgo:"{{n}} days ago",milliseconds:"{{n}} ms",seconds:"{{n}} s"},eX={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"},tX={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."},nX={title:"Print Output: {{instanceId}}",expand:"Expand",restore:"Restore"},rX={save:"Save",cancel:"Cancel"},sX={title:"Run with Params",noParams:"No input params in this flow",run:"Run",cancel:"Cancel"},iX={title:"Run with Preset",noPresets:"No presets available",default:"Default run",run:"Run",cancel:"Cancel"},oX={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"},aX={title:SG,nodes:NG,edges:jG,properties:CG,node:EG,nodeProps:_G,actions:PG,panel:AG,palette:IG,pipeline:TG,status:RG,roles:LG,phases:MG,types:OG,runContext:$G,shortcuts:DG,jumpPalette:FG,emptyCanvas:zG,sidebar:HG,validation:BG,composer:WG,topbar:VG,palette2:UG,run:KG,fileEdit:qG,settings:YG,schedule:GG,history:XG,nodePropsError:JG,placeholder:QG,time:ZG,userCheck:eX,userAsk:tX,toolPrint:nX,provideEdit:rX,runParams:sX,runPreset:iX,runConfig:oX},lX="Settings",cX={engine:"Engine Settings",preferences:"Global Preferences"},uX={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)."},dX={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..."}},fX={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."},pX={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."},hX={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)"},mX={title:"User Allowlist",description:"Only controls which usernames may register or sign in. Users set their own password on first sign-in.",enabled:"Allowlist enabled",open:"Open registration",refreshing:"Refreshing...",saving:"Saving...",file:"File",fileList:"File allowlist",envList:"Environment allowlist",readonly:"Read-only",userCount:"{{count}} users",remove:"Remove {{username}}",emptyFile:"No file allowlist configured. If env allowlist is also empty, every username can register.",emptyEnv:"AGENTFLOW_USER_WHITELIST / AGENTFLOW_ALLOWED_USERS is not configured",unionHint:"The file allowlist and env allowlist are combined. This only stores usernames, never passwords.",add:"Add"},gX={title:"System Status",normal:"Service normal",abnormal:"Some interfaces abnormal",cursorModels:"Cursor Models",opencodeModels:"OpenCode Models",claudeCodeModels:"Claude Code Models"},yX={title:"Shortcuts",projects:"Projects & Pipelines",flowEditor:"Node Canvas"},xX={title:"Language",description:"Select your preferred language for the interface",options:{zh:"中文",en:"English",ja:"日本語"}},wX={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."},bX={title:lX,crumb:cX,workspace:uX,cursor:dX,opencode:fX,claudeCode:pX,env:hX,allowlist:mX,system:gX,shortcuts:yX,language:xX,onboarding:wX},vX={thinking:"Thinking",result:"Result",reply:"Reply",error:"Error"},kX={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)"},SX={send:"Send",stop:"Stop",expand:"Expand",collapse:"Collapse",clear:"Clear"},NX={conversation:"Chat",conversationWithNumber:"Chat {{num}}",default:"Default"},jX={endSession:"End chat (will stop generation)",closeSession:"Close chat",newSession:"New chat",expandComposer:"Expand chat and output"},CX={hint:"Use the bottom input box for AI chat, with @node mentions, model selection, and more"},EX={aiLabels:vX,placeholders:kX,actions:SX,labels:NX,tooltips:jX,rightPanel:CX},_X="Projects",PX="All",AX="Archived",IX="Nodes",TX="My Nodes",RX="My Flows",LX="Skills",MX="Active Projects",OX="Archived Pipelines",$X="Global Nodes",DX="Manage node versions published to the current workspace marketplace, {{count}} total.",FX="Manage flow snippets published to the current workspace marketplace, {{count}} total.",zX="Global Skills",HX="Create New Project",BX="New Pipeline",WX="SEARCH PIPELINES...",VX="SEARCH NODES...",UX="SEARCH FLOW SNIPPETS...",KX="SEARCH SKILLS...",qX="Refresh Resources",YX="Loading pipelines...",GX="Loading global resources...",XX="Filter result: {{count}} items (matching title, description, path and tags)",JX="Archived pipelines can still be opened and edited; files are located in the _archived subdirectory of each pipelines directory.",QX="Manage your distributed node architectures and monitoring pipelines. Drag flow.yaml or .zip into this page to import shared flows.",ZX="Review all globally available node definitions, {{count}} total, including built-in, workspace, and marketplace nodes.",eJ="Review Composer-selectable skills, {{count}} total, including AgentFlow built-ins and workspace skills.",tJ="Executable building blocks for pipeline runtime",nJ="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.",rJ="Published local node packages",sJ="Only node versions published to this workspace marketplace appear here. Inspect details and delete versions that no flow uses.",iJ="Published flow snippets",oJ="Flow snippets published from Pipeline or Workspace canvases appear here. Search and inspect them, then load them from the canvas flow palette.",aJ="Operating guides for Composer and agents",lJ="Skills tell AI which rules to follow for a task, how to change flows, and how to reuse project conventions.",cJ="No archived projects.",uJ="No active pipelines; archived items are in the Archived tab.",dJ="No global nodes available.",fJ="No marketplace nodes have been published.",pJ="No flow snippets have been published. Select multiple canvas nodes and publish them first.",hJ="No skills available.",mJ="No description.",gJ='No node matches "{{query}}".',yJ='No flow snippet matches "{{query}}".',xJ='No skill matches "{{query}}".',wJ="{{inputs}} in / {{outputs}} out",bJ="Flow Snippet",vJ="{{nodes}} nodes / {{edges}} edges",kJ="Skill",SJ="Node detail",NJ="Flow snippet detail",jJ="Skill detail",CJ="Type",EJ="Source",_J="Package",PJ="Version",AJ="Path",IJ="Editable",TJ="Read only",RJ="Editable",LJ="Schema",MJ="Inputs",OJ="Outputs",$J="Runtime",DJ="Node Body",FJ="Files",zJ="Usage",HJ="No runtime manifest.",BJ="No node body or README.",WJ="No previewable files.",VJ="Select a file to preview.",UJ="Binary file preview is not supported.",KJ="Large file; showing the first 256KB only.",qJ="No pipelines using this node were found.",YJ="Node Management",GJ="Delete Node Version",XJ="Deleting...",JJ="AgentFlow checks all flow references before deleting; installed or used versions are kept.",QJ="Delete {{id}}@{{version}}? This cannot be undone.",ZJ="Deleted {{id}}@{{version}}.",eQ="{{count}} flow(s) still use it.",tQ="Flow Snippet Management",nQ="Delete Flow Snippet",rQ="Deleting...",sQ="Deleting it only removes this reusable marketplace snippet. Nodes already loaded onto canvases are not changed.",iQ="Delete {{id}}@{{version}}? This cannot be undone.",oQ="Deleted {{id}}@{{version}}.",aQ="No slots",lQ="Purpose",cQ="This node is an execution unit in a pipeline. Its schema affects canvas wiring, parameter input, and runtime scheduling.",uQ="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.",dQ="Scale",fQ="Flow Preview",pQ="Edges",hQ="Snippet JSON",mQ="{{count}} more edge(s)",gQ="No previewable nodes.",yQ="This skill is injected into Composer as context for AI, constraining its decisions, edit strategy, and output format.",xQ="SKILL.md Preview",wQ="No preview content available.",bQ="Select a resource to inspect details.",vQ="Failed to load pipeline list.",kQ="No pipelines in current workspace.",SQ="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.",NQ='No pipelines found matching "{{query}}". Try different keywords or clear the search.',jQ="Recent Activity",CQ="No recent activity",EQ="No recent activity matching the keyword",_Q="Recent Run",PQ="Recent Open",AQ={builtin:"Built-in",workspace:"Workspace",user:"User"},IQ={flow:"Flow",global:"Global",marketplace:"Marketplace"},TQ={all:"All",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},RQ={overview:"Overview",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},LQ="Open to edit this pipeline in the node canvas.",MQ={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>"},OQ={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"},$Q={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"},DQ={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"},FQ={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"},zQ={title:_X,all:PX,archived:AX,nodes:IX,myNodes:TX,myFlows:RX,skills:LX,activeProjects:MX,archivedPipelines:OX,globalNodes:$X,myNodesHint:DX,myFlowsHint:FX,globalSkills:zX,createNew:HX,newPipeline:BX,searchPipelines:WX,searchNodes:VX,searchFlows:UX,searchSkills:KX,refreshResources:qX,loadingPipelines:YX,loadingResources:GX,filterResult:XX,archivedHint:JX,activeHint:QX,nodesHint:ZX,skillsHint:eJ,nodesPurposeTitle:tJ,nodesPurposeDesc:nJ,myNodesPurposeTitle:rJ,myNodesPurposeDesc:sJ,myFlowsPurposeTitle:iJ,myFlowsPurposeDesc:oJ,skillsPurposeTitle:aJ,skillsPurposeDesc:lJ,noArchived:cJ,noActive:uJ,noNodes:dJ,noMyNodes:fJ,noMyFlows:pJ,noSkills:hJ,noDescription:mJ,noNodeMatch:gJ,noFlowSnippetMatch:yJ,noSkillMatch:xJ,nodeSlots:wJ,flowSnippet:bJ,flowSnippetNodes:vJ,skill:kJ,nodeDetail:SJ,flowDetail:NJ,skillDetail:jJ,detailType:CJ,detailSource:EJ,detailPackage:_J,detailVersion:PJ,detailPath:AJ,detailEditable:IJ,readOnly:TJ,editable:RJ,nodeSchema:LJ,nodeInputs:MJ,nodeOutputs:OJ,nodeRuntime:$J,nodeBody:DJ,nodeFiles:FJ,nodeUsage:zJ,noRuntimeManifest:HJ,noNodeBody:BJ,noNodeFiles:WJ,selectNodeFile:VJ,binaryFile:UJ,fileTruncated:KJ,noNodeUsage:qJ,myNodeManagement:YJ,deleteMyNode:GJ,deletingMyNode:XJ,deleteMyNodeHint:JJ,deleteMyNodeConfirm:QJ,deleteMyNodeSuccess:ZJ,deleteMyNodeUsedBy:eQ,myFlowManagement:tQ,deleteMyFlow:nQ,deletingMyFlow:rQ,deleteMyFlowHint:sQ,deleteMyFlowConfirm:iQ,deleteMyFlowSuccess:oQ,noSlots:aQ,resourceMeaning:lQ,nodesMeaning:cQ,myFlowsMeaning:uQ,flowSnippetScale:dQ,flowSnippetPreview:fQ,flowSnippetEdges:pQ,flowSnippetJson:hQ,flowSnippetMoreEdges:mQ,noFlowSnippetPreview:gQ,skillsMeaning:yQ,skillPreview:xQ,skillPreviewEmpty:wQ,selectResource:bQ,loadFailed:vQ,noPipelines:kQ,emptyHint:SQ,noMatch:NQ,recentActivity:jQ,noRecentActivity:CQ,noMatchRecent:EQ,recentRun:_Q,recentOpen:PQ,sourceBadge:AQ,resourceSource:IQ,resourceFilter:TQ,nodeDetailTabs:RQ,defaultCardDesc:LQ,hubCard:MQ,newPipelineModal:OQ,importModal:$Q,deleteModal:DQ,archiveModal:FQ},HQ="Back",BQ="Next",WQ="Skip",VQ="Done",UQ="Start Creating",KQ={intro:`Welcome to AgentFlow! This is a visual workflow orchestration tool.
|
|
204
|
+
|
|
205
|
+
Click the button below to create your first pipeline.`,hubIntro:`Don't want to start from scratch?
|
|
206
|
+
|
|
207
|
+
Browse ready-made pipelines on AgentFlow Hub — community-shared flows you can install and run in one click.`},qQ={intro:`Now you're in the flow editor.
|
|
208
|
+
|
|
209
|
+
Describe your requirements in natural language in the input box below, and AI will generate the flow graph.
|
|
210
|
+
|
|
211
|
+
The left node panel allows you to freely drag, delete, and adjust connections.`,introEmpty:`The canvas is empty. Start creating your flow!
|
|
212
|
+
|
|
213
|
+
Describe your requirements in natural language in the input box below, and AI will generate the flow graph.
|
|
214
|
+
|
|
215
|
+
The left node panel allows you to freely drag, delete, and adjust connections.`},YQ={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"},GQ={back:HQ,next:BQ,skip:WQ,done:VQ,startCreate:UQ,projects:KQ,flow:qQ,newPipeline:YQ},XQ={name:"AgentFlow",tagline:"AI 工作流编排"},JQ={projects:"项目",nodes:"Nodes",myNodes:"我的 Nodes",myFlows:"我的流程",skills:"Skills",mcps:"MCP",feedback:"意见反馈",flowEditor:"流程编辑器",settings:"设置",back:"返回"},QQ={loading:"加载中…",saving:"保存中…",save:"保存",cancel:"取消",delete:"删除",edit:"编辑",create:"创建",close:"关闭",confirm:"确认",copy:"复制",copied:"已复制!",refresh:"刷新",search:"搜索",filter:"筛选",success:"成功",error:"错误",warning:"警告",info:"信息",done:"完成",pending:"待处理",running:"运行中",notFound:"未找到",required:"必填",optional:"可选"},ZQ={success:"成功",failed:"失败",pending:"等待",running:"运行中",skipped:"跳过"},eZ={agent:"Agent 节点",control:"控制节点",tool:"工具节点",start:"开始",end:"结束"},tZ={online:"引擎在线",offline:"引擎离线",connecting:"连接中…"},nZ={hub:"AgentFlow Hub",docs:"文档",github:"GitHub 仓库"},rZ={app:XQ,nav:JQ,common:QQ,status:ZQ,nodeTypes:eZ,engine:tZ,links:nZ},sZ="流程编辑器",iZ="节点",oZ="连线",aZ="属性",lZ={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:"编辑内容"},cZ={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}}"},uZ={run:"运行流程",stop:"停止",resume:"继续",validate:"校验",export:"导出",import:"导入"},dZ={nodeList:"节点列表",runHistory:"运行历史",validation:"校验结果"},fZ={workspace:"工作区",loading:"加载中…",archived:"已归档",noPipelines:"暂无流水线",more:"更多",moreFlows:"更多流程",noRuns:"暂无运行记录",searchNodes:"搜索节点",noComponents:"暂无可用组件(检查节点库目录)",noMatch:"无匹配节点,请调整搜索词",selectPipeline:"从上方选择一条流水线以加载组件与画布",validationWarnings:"校验警告(与 agentflow validate 槽位检查一致)",output:"输出",model:"模型",userDir:"用户目录",toggleRecentActivity:"展开或收起最近打开或最近运行"},pZ={selectPipeline:"请从顶部下拉选择一条流水线",loadingProps:"加载节点属性…",pipelineId:"流水线 ID",diskPath:"磁盘路径",storageLocation:"存储位置",introduction:"介绍",introductionPlaceholder:"简要描述这条流水线的用途(写入 flow.yaml 的 ui.description)",metadata:"元数据",nodeCount:"节点数",nodesUnit:"个节点",loading:"加载中…",noRuns:"暂无运行记录(终端执行后会在工作区生成运行目录)"},hZ={saving:"保存中…",saved:"已保存",saveFailed:"保存失败",runInTerminal:"运行请使用终端"},mZ={requirement:"需求拆解",planning:"技术规划",code:"代码执行",test:"测试回归",normal:"普通"},gZ={phase:"阶段",allPhasesComplete:"所有阶段完成",currentPhaseComplete:"当前阶段完成,等待确认继续…"},yZ={node:"节点",text:"文本",file:"文件",bool:"布尔"},xZ={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:"等待"},wZ={title:"快捷键",general:"常规",saveDesc:"保存;节点属性侧栏打开时先提交节点再保存 flow",shortcutsLabel:"快捷键",jumpToNode:"按 ID 跳转到节点",openNodePalette:"打开节点面板",canvas:"画布",selectTool:"选择工具",panTool:"平移工具",holdSpacePan:"按住空格临时平移",saveViewport:"保存当前进入视角",selectAll:"全选所有节点",undo:"撤销画布修改",redo:"重做画布修改"},bZ={title:"跳转到节点",placeholder:"输入节点 ID 或名称…",empty:"未匹配到节点",hintNavigate:"切换",hintJump:"跳转",hintClose:"关闭"},vZ={title:"开始构建你的流程",text:"在下方 AI 输入框中描述你的流程,或从左侧面板拖拽节点到画布",composerHint:"使用 AI Composer 构建 AgentFlow",composerSub:"从左侧拖入节点,或在<strong>下方输入框</strong>中用自然语言描述工作流。<br/>按 <kbd>?</kbd> 查看快捷键。"},kZ={mainNav:"主导航"},SZ={flowWarningAriaLabel:"流程校验警告",reloadFromServer:"从服务器重新加载流程并刷新校验",reloadFromServerShort:"从服务器重新加载",closeBanner:"关闭校验警告横幅",nodePrefix:"节点",focusNodeAriaLabel:"在画布中选中并定位节点 {{nodeId}}",slotWarningCount:"槽位校验 {{count}} 条(已隐藏)",show:"显示",shortcutHint:"按 ? 查看快捷键",shortcutHintLabel:"快捷键",inputSlotNoEdge:' 的 input 槽位 "{{slotName}}"({{handle}})无对应 edge 连接',outputSlotNoEdge:' 的 output 槽位 "{{slotName}}"({{handle}})无对应 edge 连接'},NZ={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}} 步):
|
|
216
|
+
{{summary}}`,step:"步骤 {{current}}/{{total}}: {{description}}",phaseGeneration:`分阶段生成({{count}} 阶段):{{labels}}
|
|
217
|
+
当前:{{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}}"},jZ={currentPipeline:"当前流水线",backToEdit:"返回编辑",backToProjects:"返回项目",executionLog:"执行日志",history:"历史",pipelineSettings:"流水线设置",shortcutsLabel:"快捷键",shortcutsTitle:"快捷键 (?)",deletePipeline:"删除流水线",resumeTitle:"在同一 run 目录继续执行(uuid={{uuid}})",resumeTitleNoUuid:"尚未收到 apply-start,将发起新的 run",rerunTitle:"从头开始新的运行",runOptions:"运行选项",runWithParams:"带参数运行",runWithPreset:"指定预设运行",editRun:"编辑运行参数",startRun:"开始执行",stopRun:"停止后台运行"},CZ={nodePalette:"节点调色板",noPipelineSelected:"未选择流水线",moreRuns:"+{{count}} 更多",moreFlows:"+{{count}} 更多流程",runId:"运行 ID: {{id}}"},EZ={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}} 的分支"},_Z={close:"关闭",loading:"加载中…",placeholder:"文件内容",largeFileWarning:"文件较大,编辑器性能可能受影响",reset:"重置",aiEdit:"AI 修改",aiRunning:"AI 处理中…",save:"保存",saving:"保存中…",saved:"已保存"},PZ={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:"已复制"},AZ={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:"定时配置已保存"},IZ={title:"执行历史",summary:"执行结果汇总",successCount:"{{count}} 成功",failedCount:"{{count}} 失败",stoppedCount:"{{count}} 已停止",interruptedCount:"{{count}} 已中断",runningCount:"{{count}} 进行中",success:"成功",failed:"失败",stopped:"已停止",interrupted:"已中断",running:"进行中",unknown:"未知",runLabel:"运行 #{{id}}",enterRunView:"进入该次运行的画布与日志态"},TZ={invalidInstanceId:"实例 ID 格式无效:仅允许英文字母、数字、下划线、短横线,且不能以数字开头。",duplicateInstanceId:"该实例 ID 已存在,请换一个。",loadFlowFailed:"读取 flow 失败",loadNodesFailed:"读取节点库失败"},RZ={invalidPlaceholder:"无效占位符: {{hint}}",empty:"(空)",inputSubtitle:"输入 · {{type}}",inputSubtitleNoType:"输入",outputSubtitle:"输出 · {{type}}",outputSubtitleNoType:"输出",runtimeConst:"运行时常量"},LZ={justNow:"刚刚",minutesAgo:"{{n}} 分钟前",hoursAgo:"{{n}} 小时前",yesterday:"昨天",daysAgo:"{{n}} 天前",milliseconds:"{{n}} 毫秒",seconds:"{{n}} 秒"},MZ={title:"用户确认 ({{instanceId}})",edit:"编辑",save:"保存",cancel:"取消",aiEditPlaceholder:"输入 AI 修改指令,如:删除第二项、合并前两项…",aiEditBtn:"AI 修改",aiEditStarted:"AI 正在修改内容…",aiEditDone:"AI 修改完成",aiEditFailed:"AI 修改失败",contentSaved:"内容已保存",saveFailed:"保存失败",close:"关闭",continue:"继续执行",hint:"编辑或使用 AI 修改后点击保存,然后点击「继续执行」恢复流程"},OZ={title:"用户选择 ({{instanceId}})",hint:"请从下方选项中选择一项以继续流程",submitting:"提交中…",submitFailed:"提交失败",close:"关闭",noOptions:"该节点未配置选项,请先在编辑器中为 output 槽位添加条目。"},$Z={title:"Print 输出: {{instanceId}}",expand:"放大",restore:"还原"},DZ={save:"保存",cancel:"取消"},FZ={title:"带参数运行",noParams:"此流程无输入参数",run:"运行",cancel:"取消"},zZ={title:"指定预设运行",noPresets:"无可用预设",default:"默认运行",run:"运行",cancel:"取消"},HZ={preset:"预设",default:"默认",newPreset:"新建预设",deletePreset:"删除预设",presetNamePlaceholder:"预设名称",inputParams:"输入参数",noProvideNodes:"此流程无 provide 节点",filePathPlaceholder:"文件路径…",stringValuePlaceholder:"值…",presetSaved:"预设已保存",presetDeleted:"预设已删除",savePreset:"保存当前预设",expandInput:"编辑内容"},BZ={title:sZ,nodes:iZ,edges:oZ,properties:aZ,node:lZ,nodeProps:cZ,actions:uZ,panel:dZ,palette:fZ,pipeline:pZ,status:hZ,roles:mZ,phases:gZ,types:yZ,runContext:xZ,shortcuts:wZ,jumpPalette:bZ,emptyCanvas:vZ,sidebar:kZ,validation:SZ,composer:NZ,topbar:jZ,palette2:CZ,run:EZ,fileEdit:_Z,settings:PZ,schedule:AZ,history:IZ,nodePropsError:TZ,placeholder:RZ,time:LZ,userCheck:MZ,userAsk:OZ,toolPrint:$Z,provideEdit:DZ,runParams:FZ,runPreset:zZ,runConfig:HZ},WZ="设置",VZ={engine:"引擎设置",preferences:"全局首选项"},UZ={title:"工作区",currentPath:"当前工作区根目录",placeholder:"加载中…",copyPath:"复制路径",description:"流水线与节点清单将相对于此目录解析(由启动 UI 时传入)。"},KZ={title:"Cursor CLI",status:{cached:"已缓存",notCached:"未缓存"},modelPreviewLabel:"Cursor 模型名称列表",modelList:{cached:"模型清单已缓存",empty:"暂无模型列表",count:"{{count}} 条",fetchedAt:"更新 {{time}}",never:"尚未拉取",refresh:"刷新清单",fetching:"拉取中…"}},qZ={modelPreviewLabel:"OpenCode 模型名称列表",title:"OpenCode CLI",status:{ready:"就绪",notFound:"未找到"},provider:"方案 / Provider 标识",providerPlaceholder:"例如 bailian-coding-plan",saving:"正在保存并更新清单…",description:"对应 CLI opencode models <provider> 的参数;停止输入后会写入用户目录 config 并刷新 model-lists.json。"},YZ={title:"Claude Code CLI",status:{ready:"就绪",notFound:"未找到"},modelPreviewLabel:"Claude Code 模型名称列表",description:"内置模型列表(Claude Code CLI 无 models 子命令);刷新将探测 claude 二进制是否在 PATH 中。首次使用请先执行 claude /login。"},GZ={title:"环境变量",note:"当前登录用户私有,运行时优先于服务全局环境变量",noteAdmin:"可配置个人或全局环境变量;个人同名变量优先于全局",saving:"正在保存...",key:"键",value:"值",scope:"范围",personal:"个人",global:"全局",add:"添加",delete:"删除 {{key}}",invalidKey:"环境变量名必须以字母或下划线开头,且只能包含字母、数字和下划线。",newKey:"新环境变量键",newValue:"值(密钥请谨慎)"},XZ={title:"用户白名单",description:"只控制 username 是否允许注册或登录,密码由用户首次登录时自行设置。",enabled:"白名单已启用",open:"开放注册",refreshing:"刷新中...",saving:"保存中...",file:"文件",fileList:"文件白名单",envList:"环境变量白名单",readonly:"只读",userCount:"{{count}} 个用户",remove:"删除 {{username}}",emptyFile:"未配置文件白名单;如果环境变量也为空,则所有用户可注册。",emptyEnv:"未配置 AGENTFLOW_USER_WHITELIST / AGENTFLOW_ALLOWED_USERS",unionHint:"文件白名单与环境变量白名单取并集;这里只会保存用户名,不保存密码。",add:"添加"},JZ={title:"系统状态",normal:"服务正常",abnormal:"部分接口异常",cursorModels:"Cursor 模型",opencodeModels:"OpenCode 模型",claudeCodeModels:"Claude Code 模型"},QZ={title:"快捷入口",projects:"项目与流水线",flowEditor:"节点画布"},ZZ={title:"语言",description:"选择界面显示语言",options:{zh:"中文",en:"English",ja:"日本語"}},eee={title:"新手引导",description:"重新启动产品引导流程,了解 AgentFlow 的核心功能。",reset:"重置引导",resetSuccess:"已重置,下次访问将自动启动引导"},tee={title:WZ,crumb:VZ,workspace:UZ,cursor:KZ,opencode:qZ,claudeCode:YZ,env:GZ,allowlist:XZ,system:JZ,shortcuts:QZ,language:ZZ,onboarding:eee},nee={thinking:"思考",result:"结果",reply:"回复",error:"错误"},ree={input:"让 AI 协助编辑此节点…",waiting:"等待响应…",selectedEmpty:"在画布上选择节点,或在输入框用 @ 选择实例(Instances)或节点类型(Node)",textarea:"描述你的流程或让 AI 协助编辑(⌘/Ctrl+Enter 发送)"},see={send:"发送",stop:"停止",expand:"展开",collapse:"收起",clear:"清空"},iee={conversation:"对话",conversationWithNumber:"对话 {{num}}",default:"默认"},oee={endSession:"结束对话(将停止生成)",closeSession:"关闭对话",newSession:"新建对话",expandComposer:"展开对话与输出"},aee={hint:"使用底部输入框进行 AI 对话,支持 @节点、选择模型等功能"},lee={aiLabels:nee,placeholders:ree,actions:see,labels:iee,tooltips:oee,rightPanel:aee},cee="项目",uee="全部",dee="已归档",fee="Nodes",pee="我的 Nodes",hee="我的流程",mee="Skills",gee="活跃项目",yee="已归档流水线",xee="全局 Nodes",wee="管理当前工作区已发布到本地 Marketplace 的节点,共 {{count}} 个。",bee="管理当前工作区已发布到本地 Marketplace 的流程片段,共 {{count}} 个。",vee="全局 Skills",kee="创建新项目",See="新建流水线",Nee="搜索流水线…",jee="搜索 nodes…",Cee="搜索流程片段…",Eee="搜索 skills…",_ee="刷新资源",Pee="加载流水线列表…",Aee="加载全局资源…",Iee="筛选结果:{{count}} 条(匹配标题、描述、路径与标签)",Tee="已归档的流水线仍可打开与编辑;文件位于各 pipelines 目录下的 _archived。",Ree="管理分布式节点架构与监控流水线。可将 flow.yaml 或 .zip 拖入本页导入分享流程。",Lee="查看当前可用的全局节点定义,共 {{count}} 个;包含内置、工作区与 marketplace 节点。",Mee="查看当前 Composer 可选择的 skills,共 {{count}} 个;包含 AgentFlow 内置与工作区 skills。",Oee="流程运行时的可执行积木",$ee="Nodes 决定画布上能拖什么、节点有哪些输入输出,以及运行时走 agent、control、provide 或 marketplace 哪类逻辑。",Dee="已发布的本地节点包",Fee="这里仅显示你发布到当前 Workspace Marketplace 的节点版本;可查看详情并删除未被 Flow 使用的版本。",zee="已发布的流程片段",Hee="这里显示从 Pipeline 或 Workspace 画布发布的流程片段,可搜索、检查内容,并从画布的流程面板中加载复用。",Bee="Composer/Agent 的操作指南",Wee="Skills 告诉 AI 在特定任务里应遵守什么规则、如何修改 flow、如何复用项目约定。",Vee="暂无归档项目。",Uee="暂无未归档流水线;已归档项在 Archived 标签中查看。",Kee="暂无可用全局 nodes。",qee="暂无已发布的 marketplace nodes。",Yee="暂无已发布的流程片段。可在画布中选中多个节点后发布。",Gee="暂无可用 skills。",Xee="暂无描述。",Jee="未找到与「{{query}}」匹配的 node。",Qee="未找到与「{{query}}」匹配的流程片段。",Zee="未找到与「{{query}}」匹配的 skill。",ete="{{inputs}} in / {{outputs}} out",tte="流程片段",nte="{{nodes}} 节点 / {{edges}} 连线",rte="Skill",ste="Node 详情",ite="流程片段详情",ote="Skill 详情",ate="类型",lte="来源",cte="包",ute="版本",dte="路径",fte="可编辑",pte="只读",hte="可编辑",mte="Schema",gte="输入",yte="输出",xte="Runtime",wte="节点内容",bte="Files",vte="Usage",kte="暂无 runtime manifest。",Ste="暂无节点正文或 README。",Nte="暂无可预览文件。",jte="请选择文件查看内容。",Cte="二进制文件暂不支持预览。",Ete="文件较大,仅显示前 256KB。",_te="暂未发现使用此 node 的流水线。",Pte="节点管理",Ate="删除节点版本",Ite="删除中…",Tte="删除前会检查所有 Flow 引用;仍被安装或使用的版本不会被删除。",Rte="确定删除 {{id}}@{{version}}?此操作不可撤销。",Lte="已删除 {{id}}@{{version}}。",Mte="仍有 {{count}} 个 Flow 使用它。",Ote="流程片段管理",$te="删除流程片段",Dte="删除中…",Fte="删除后不会影响已经加载到画布里的节点,只会移除 Marketplace 中这个可复用片段。",zte="确定删除 {{id}}@{{version}}?此操作不可撤销。",Hte="已删除 {{id}}@{{version}}。",Bte="无槽位",Wte="作用",Vte="这个 node 是 pipeline 的执行单元。它的 schema 会影响画布连线、参数输入和运行时调度。",Ute="流程片段是固定化流程的一部分。加载时会复制这组节点、连线和布局到当前画布,不覆盖已有内容。",Kte="规模",qte="流程预览",Yte="连线",Gte="片段 JSON",Xte="还有 {{count}} 条连线",Jte="暂无可预览节点。",Qte="这个 skill 会作为 Composer 的上下文注入给 AI,用于约束 AI 的判断、修改方式和输出口径。",Zte="SKILL.md 预览",ene="暂无可预览内容。",tne="请选择一个资源查看详情。",nne="未能加载流水线列表。",rne="当前工作区暂无流水线。",sne="在仓库根目录执行 {{code1}} 并确认工作区包含 {{code2}} 或用户目录下的流水线;亦可点击 New Pipeline 新建。",ine="未找到与「{{query}}」匹配的流水线。可尝试其他关键词,或点击清除搜索。",one="最近打开或最近运行",ane="暂无打开或运行记录",lne="暂无与关键词匹配的最近记录",cne="最近运行",une="最近打开",dne={builtin:"内置",workspace:"工作区",user:"用户"},fne={flow:"Flow",global:"Global",marketplace:"Marketplace"},pne={all:"全部",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},hne={overview:"概览",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},mne="打开以在节点画布中编辑此流水线。",gne={eyebrow:"AgentFlow Hub",title:"浏览社区流程",desc:"发现并一键安装社区分享的现成流水线。",cta:"前往 Hub",cliHint:"或通过 CLI 安装:agentflow download <slug>"},yne={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:"关闭"},xne={title:"导入流水线",lead:"已选择文件「{{filename}}」。请确认流水线名称与保存位置;ZIP 将保留目录内脚本等文件。",nameLabel:"名称(必填)",namePlaceholder:"例如 my_shared_flow",nameHint:"须以英文字母开头,仅可使用字母、数字、下划线 _ 与连字符 -",locationLabel:"保存位置",userDir:"用户目录(~/agentflow/pipelines)",workspaceDir:"当前工作区(.workspace/agentflow/pipelines)",changeFile:"更换文件…",importFailed:"导入失败",importing:"导入中…",importAndOpen:"导入并打开",cancel:"取消",close:"关闭"},wne={title:"删除流水线",lead:"将永久删除磁盘上的流水线目录(含 flow.yaml、脚本等),无法撤销。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",deleteFailed:"删除失败",deleteTimeout:"删除请求超时,请重试(可先检查终端中的 UI 服务日志)",delete:"删除",deleting:"删除中…",confirmDelete:"确认删除",cancel:"取消",close:"关闭"},bne={title:"归档流水线",lead:"归档后流水线将移入「Archived」列表,仍可从该列表打开与编辑。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",archiveFailed:"归档失败",archive:"归档",archiving:"归档中…",confirmArchive:"确认归档",cancel:"取消",close:"关闭"},vne={title:cee,all:uee,archived:dee,nodes:fee,myNodes:pee,myFlows:hee,skills:mee,activeProjects:gee,archivedPipelines:yee,globalNodes:xee,myNodesHint:wee,myFlowsHint:bee,globalSkills:vee,createNew:kee,newPipeline:See,searchPipelines:Nee,searchNodes:jee,searchFlows:Cee,searchSkills:Eee,refreshResources:_ee,loadingPipelines:Pee,loadingResources:Aee,filterResult:Iee,archivedHint:Tee,activeHint:Ree,nodesHint:Lee,skillsHint:Mee,nodesPurposeTitle:Oee,nodesPurposeDesc:$ee,myNodesPurposeTitle:Dee,myNodesPurposeDesc:Fee,myFlowsPurposeTitle:zee,myFlowsPurposeDesc:Hee,skillsPurposeTitle:Bee,skillsPurposeDesc:Wee,noArchived:Vee,noActive:Uee,noNodes:Kee,noMyNodes:qee,noMyFlows:Yee,noSkills:Gee,noDescription:Xee,noNodeMatch:Jee,noFlowSnippetMatch:Qee,noSkillMatch:Zee,nodeSlots:ete,flowSnippet:tte,flowSnippetNodes:nte,skill:rte,nodeDetail:ste,flowDetail:ite,skillDetail:ote,detailType:ate,detailSource:lte,detailPackage:cte,detailVersion:ute,detailPath:dte,detailEditable:fte,readOnly:pte,editable:hte,nodeSchema:mte,nodeInputs:gte,nodeOutputs:yte,nodeRuntime:xte,nodeBody:wte,nodeFiles:bte,nodeUsage:vte,noRuntimeManifest:kte,noNodeBody:Ste,noNodeFiles:Nte,selectNodeFile:jte,binaryFile:Cte,fileTruncated:Ete,noNodeUsage:_te,myNodeManagement:Pte,deleteMyNode:Ate,deletingMyNode:Ite,deleteMyNodeHint:Tte,deleteMyNodeConfirm:Rte,deleteMyNodeSuccess:Lte,deleteMyNodeUsedBy:Mte,myFlowManagement:Ote,deleteMyFlow:$te,deletingMyFlow:Dte,deleteMyFlowHint:Fte,deleteMyFlowConfirm:zte,deleteMyFlowSuccess:Hte,noSlots:Bte,resourceMeaning:Wte,nodesMeaning:Vte,myFlowsMeaning:Ute,flowSnippetScale:Kte,flowSnippetPreview:qte,flowSnippetEdges:Yte,flowSnippetJson:Gte,flowSnippetMoreEdges:Xte,noFlowSnippetPreview:Jte,skillsMeaning:Qte,skillPreview:Zte,skillPreviewEmpty:ene,selectResource:tne,loadFailed:nne,noPipelines:rne,emptyHint:sne,noMatch:ine,recentActivity:one,noRecentActivity:ane,noMatchRecent:lne,recentRun:cne,recentOpen:une,sourceBadge:dne,resourceSource:fne,resourceFilter:pne,nodeDetailTabs:hne,defaultCardDesc:mne,hubCard:gne,newPipelineModal:yne,importModal:xne,deleteModal:wne,archiveModal:bne},kne="返回",Sne="下一步",Nne="跳过",jne="完成",Cne="开始创建",Ene={intro:`欢迎使用 AgentFlow!这是一个可视化流程编排工具。
|
|
218
|
+
|
|
219
|
+
点击下方按钮开始创建你的第一个流水线。`,hubIntro:`不想从零开始?
|
|
220
|
+
|
|
221
|
+
在 AgentFlow Hub 浏览社区分享的现成流水线,一键安装即可运行。`},_ne={intro:`现在进入流程编辑器。
|
|
222
|
+
|
|
223
|
+
在下方输入框用自然语言描述你的需求,AI 会自动生成流程图。
|
|
224
|
+
|
|
225
|
+
左侧节点面板可以自由拖拽、删除和调整连接。`,introEmpty:`画布为空,开始创建你的流程吧!
|
|
226
|
+
|
|
227
|
+
在下方输入框用自然语言描述需求,AI 会自动生成流程图。
|
|
228
|
+
|
|
229
|
+
左侧节点面板可以自由拖拽、删除和调整连接。`},Pne={guideTitle:"首次创建提示",guideDesc:"输入名称和描述后,AI 会自动生成流程图。你可以在编辑器中自由调整节点和连接。",nameHintGuide:"例如:MyFirstFlow(字母开头,支持数字和下划线)",descPlaceholderGuide:"例如:实现用户登录功能,包含注册、验证、授权",descHintGuide:"描述越详细,AI 生成的流程越准确",createGuide:"创建并开始编辑",typeNode:"节点引用类型",typeStr:"字符串类型",typeFile:"文件路径类型",typeBool:"布尔值类型"},Ane={back:kne,next:Sne,skip:Nne,done:jne,startCreate:Cne,projects:Ene,flow:_ne,newPipeline:Pne},Ine={en:{common:kG,flow:aX,settings:bX,composer:EX,project:zQ,onboarding:GQ},zh:{common:rZ,flow:BZ,settings:tee,composer:lee,project:vne,onboarding:Ane}};Wr.use(R2).use(vO).init({resources:Ine,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 Tne=[{code:"zh",name:"中文",flag:"🇨🇳"},{code:"en",name:"English",flag:"🇬🇧"}];function Rne(e){return Wr.changeLanguage(e)}const Vb="agentflow-settings-opencode-plan-v1";function Ux(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 L2(){return`e_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function Lne(e){return/^[A-Za-z_][A-Za-z0-9_]*$/.test(String(e||"").trim())}function Kl(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()||L2(),c=String(r.scope??t).trim()==="global"?"global":"user";!s&&!i||n.push({id:a,key:s,value:i,scope:c})}return n}function Z1(e){return Kl(e).map(({key:t,value:n})=>({key:t,value:n}))}function eC(){try{return localStorage.getItem(Vb)??""}catch{return""}}function Mne(e){return e?e.length<=6?"•".repeat(e.length):`${"•".repeat(Math.min(20,e.length-4))}${e.slice(-4)}`:""}function tC(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 One({authUser:e}){const{t,i18n:n}=Mn(["common","settings"]),r=n.language||"zh",[s,i]=h.useState(""),[a,l]=h.useState(""),[c,d]=h.useState({cursor:[],opencode:[],claudeCode:[],cursorFetchedAt:null,opencodeFetchedAt:null,claudeCodeFetchedAt:null}),[f,u]=h.useState(""),[p,m]=h.useState(!1),[y,b]=h.useState(!1),[k,g]=h.useState(""),[v,x]=h.useState([]),[N,_]=h.useState(""),[C,T]=h.useState(!1),[H,M]=h.useState(""),[F,D]=h.useState(""),[$,W]=h.useState(!1),[O,R]=h.useState(()=>new Set),[I,z]=h.useState(""),[P,L]=h.useState([]),[E,X]=h.useState(!1),[ee,V]=h.useState(""),[ie,fe]=h.useState([]),[me,ge]=h.useState([]),[Z,ae]=h.useState(""),[xe,pe]=h.useState(""),[_e,je]=h.useState(!1),[Ve,et]=h.useState(!1),[qe,dt]=h.useState(""),He=h.useRef(null),bt=h.useRef(!1),sn=h.useRef(!1),on=h.useRef(""),an=h.useCallback(async()=>{l("");try{const oe=await fetch("/api/ui-context");if(!oe.ok)throw new Error("HTTP "+oe.status);const Te=await oe.json();i(typeof Te.workspaceRoot=="string"?Te.workspaceRoot:"")}catch(oe){l(String(oe.message||oe)),i("")}},[]),Yt=h.useCallback(async()=>{u(""),m(!0);try{const oe=await fetch("/api/model-lists");if(!oe.ok)throw new Error("HTTP "+oe.status);const Te=await oe.json();d(Ux(Te))}catch(oe){u(String(oe.message||oe))}finally{m(!1)}},[]),En=h.useCallback(async()=>{_("");try{const oe=await fetch("/api/user-env"),Te=await oe.json().catch(()=>({}));if(!oe.ok)throw new Error(typeof Te.error=="string"?Te.error:"HTTP "+oe.status);const Ue=Kl(Array.isArray(Te.env)?Te.env:[],"user").map(cr=>({...cr,scope:"user"})),yn=[...e!=null&&e.isAdmin?Kl(Array.isArray(Te.globalEnv)?Te.globalEnv:[],"global").map(cr=>({...cr,scope:"global"})):[],...Ue];on.current=JSON.stringify(yn),x(yn)}catch(oe){x([]),_(String(oe.message||oe))}finally{sn.current=!0}},[e==null?void 0:e.isAdmin]),hn=h.useCallback(async()=>{if(e!=null&&e.isAdmin){X(!0),V("");try{const oe=await fetch("/api/feedback"),Te=await oe.json().catch(()=>({}));if(!oe.ok)throw new Error(typeof Te.error=="string"?Te.error:"HTTP "+oe.status);L(Array.isArray(Te.feedback)?Te.feedback:[])}catch(oe){V(String(oe.message||oe))}finally{X(!1)}}},[e==null?void 0:e.isAdmin]),ue=h.useCallback(async()=>{if(e!=null&&e.isAdmin){je(!0),dt("");try{const oe=await fetch("/api/admin/user-allowlist"),Te=await oe.json().catch(()=>({}));if(!oe.ok)throw new Error(typeof Te.error=="string"?Te.error:"HTTP "+oe.status);const Ue=Te.allowlist&&typeof Te.allowlist=="object"?Te.allowlist:{};fe(Array.isArray(Ue.fileUsers)?Ue.fileUsers.map(String):[]),ge(Array.isArray(Ue.envUsers)?Ue.envUsers.map(String):[]),ae(typeof Ue.path=="string"?Ue.path:"")}catch(oe){dt(String(oe.message||oe))}finally{je(!1)}}},[e==null?void 0:e.isAdmin]),ke=h.useCallback(async oe=>{if(e!=null&&e.isAdmin){et(!0),dt("");try{const Te=await fetch("/api/admin/user-allowlist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({users:oe})}),Ue=await Te.json().catch(()=>({}));if(!Te.ok)throw new Error(typeof Ue.error=="string"?Ue.error:"HTTP "+Te.status);const Ht=Ue.allowlist&&typeof Ue.allowlist=="object"?Ue.allowlist:{};fe(Array.isArray(Ht.fileUsers)?Ht.fileUsers.map(String):[]),ge(Array.isArray(Ht.envUsers)?Ht.envUsers.map(String):[]),ae(typeof Ht.path=="string"?Ht.path:"")}catch(Te){dt(String(Te.message||Te))}finally{et(!1)}}},[e==null?void 0:e.isAdmin]),De=h.useCallback(async oe=>{const Te=Kl(oe),Ue=Te.filter(yn=>yn.scope!=="global"),Ht=Te.filter(yn=>yn.scope==="global");T(!0),_("");try{const yn=await fetch("/api/user-env",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:Z1(Ue),...e!=null&&e.isAdmin?{globalEnv:Z1(Ht)}:{}})}),cr=await yn.json().catch(()=>({}));if(!yn.ok)throw new Error(typeof cr.error=="string"?cr.error:"HTTP "+yn.status);const Hs=Kl(Array.isArray(cr.env)?cr.env:[],"user").map(Zn=>({...Zn,scope:"user"})),hr=[...e!=null&&e.isAdmin?Kl(Array.isArray(cr.globalEnv)?cr.globalEnv:[],"global").map(Zn=>({...Zn,scope:"global"})):[],...Hs];on.current=JSON.stringify(hr),x(hr)}catch(yn){_(String(yn.message||yn))}finally{T(!1)}},[e==null?void 0:e.isAdmin]),rt=h.useCallback(async()=>{u(""),m(!0);try{const oe=await fetch("/api/update-model-lists",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:I.trim()})}),Te=await oe.json().catch(()=>({}));if(!oe.ok)throw new Error(typeof Te.error=="string"?Te.error:"HTTP "+oe.status);d(Ux(Te.modelLists))}catch(oe){u(String(oe.message||oe))}finally{m(!1)}},[I]);h.useEffect(()=>{an(),Yt(),En(),e!=null&&e.isAdmin&&(hn(),ue()),(async()=>{try{const oe=await fetch("/api/agentflow-config");if(oe.ok){const Te=await oe.json(),Ue=typeof Te.opencodeProvider=="string"?Te.opencodeProvider:"";z(Ue),He.current=Ue;try{localStorage.setItem(Vb,Ue)}catch{}}else{const Te=eC();z(Te),He.current=Te}}catch{const oe=eC();z(oe),He.current=oe}finally{bt.current=!0}})()},[e==null?void 0:e.isAdmin,an,hn,Yt,ue,En]),h.useEffect(()=>{if(!sn.current||JSON.stringify(Kl(v))===on.current)return;const Te=setTimeout(()=>{De(v)},350);return()=>clearTimeout(Te)},[v,De]),h.useEffect(()=>{if(!bt.current)return;const oe=I.trim();if(oe===He.current)return;const Te=setTimeout(()=>{(async()=>{b(!0),g("");try{const Ue=await fetch("/api/agentflow-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:oe})}),Ht=await Ue.json().catch(()=>({}));if(!Ue.ok)throw new Error(typeof Ht.error=="string"?Ht.error:"HTTP "+Ue.status);He.current=oe;try{localStorage.setItem(Vb,oe)}catch{}Ht.modelLists&&d(Ux(Ht.modelLists))}catch(Ue){g(String(Ue.message||Ue))}finally{b(!1)}})()},450);return()=>clearTimeout(Te)},[I]);const at=c.cursor.length>0,Lt=c.opencode.length>0,st=c.claudeCode.length>0,mn=ie.length>0||me.length>0,Zt=h.useCallback(()=>{var oe;s&&((oe=navigator.clipboard)==null||oe.writeText(s))},[s]),ar=h.useCallback(()=>{const oe=H.trim(),Te=F;if(oe){if(!Lne(oe)){_(t("settings:env.invalidKey"));return}x(Ue=>[...Ue,{id:L2(),key:oe,value:Te,scope:e!=null&&e.isAdmin&&$?"global":"user"}]),M(""),D("")}},[e==null?void 0:e.isAdmin,$,H,F,t]),_n=h.useCallback(oe=>{x(Te=>Te.filter(Ue=>Ue.id!==oe))},[]),gn=h.useCallback((oe,Te)=>{x(Ue=>Ue.map(Ht=>Ht.id===oe?{...Ht,...Te}:Ht))},[]),bn=h.useCallback(oe=>{R(Te=>{const Ue=new Set(Te);return Ue.has(oe)?Ue.delete(oe):Ue.add(oe),Ue})},[]),lr=h.useCallback(()=>{const oe=xe.trim();if(!oe)return;if(!/^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(oe)){dt("用户名须以字母开头,仅可使用字母、数字、下划线与连字符,最多 64 字符");return}if(new Set(ie.map(Ue=>String(Ue||"").trim().toLowerCase())).has(oe.toLowerCase())){pe("");return}pe(""),ke([...ie,oe])},[xe,ie,ke]),ve=h.useCallback(oe=>{const Te=String(oe||"").trim().toLowerCase();Te&&ke(ie.filter(Ue=>String(Ue||"").trim().toLowerCase()!==Te))},[ie,ke]),$e=h.useCallback(oe=>{const Te=oe.target.value;Rne(Te)},[]),nt=oe=>{const Te=tC(oe,r);return Te?t("settings:cursor.modelList.fetchedAt",{time:Te}):t("settings:cursor.modelList.never")},zt=oe=>tC(oe,r)||String(oe||"");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:Zt,"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"+(at?" af-set-badge--ok":" af-set-badge--muted"),children:t(at?"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:at?"check_circle":"hourglass_empty"})}),o.jsxs("div",{children:[o.jsx("p",{className:"af-set-cli-title",children:t(at?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),o.jsx("p",{className:"af-set-cli-mono",children:at?t("settings:cursor.modelList.count",{count:c.cursor.length})+" · "+nt(c.cursorFetchedAt):t("settings:cursor.modelList.refresh")})]})]}),at?o.jsx("pre",{className:"af-set-model-preview","aria-label":t("settings:cursor.modelPreviewLabel"),children:c.cursor.join(`
|
|
230
|
+
`)}):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>rt(),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"+(Lt?" af-set-badge--ok":" af-set-badge--err"),children:t(Lt?"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:oe=>z(oe.target.value),placeholder:t("settings:opencode.providerPlaceholder"),autoComplete:"off"}),y?o.jsx("p",{className:"af-set-hint af-set-hint--inline","aria-live":"polite",children:t("settings:opencode.saving")}):null,k?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",role:"alert",children:k}):null]}),Lt?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"af-set-cli-mono af-set-cli-mono--block",children:t("settings:cursor.modelList.count",{count:c.opencode.length})+" · "+nt(c.opencodeFetchedAt)}),o.jsx("pre",{className:"af-set-model-preview","aria-label":t("settings:opencode.modelPreviewLabel"),children:c.opencode.join(`
|
|
231
|
+
`)})]}):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>rt(),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"+(st?" af-set-badge--ok":" af-set-badge--err"),children:t(st?"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:st?"check_circle":"hourglass_empty"})}),o.jsxs("div",{children:[o.jsx("p",{className:"af-set-cli-title",children:t(st?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),o.jsx("p",{className:"af-set-cli-mono",children:st?t("settings:cursor.modelList.count",{count:c.claudeCode.length})+" · "+nt(c.claudeCodeFetchedAt):t("settings:cursor.modelList.refresh")})]})]}),o.jsx("p",{className:"af-set-p",children:t("settings:claudeCode.description")}),st?o.jsx("pre",{className:"af-set-model-preview","aria-label":t("settings:claudeCode.modelPreviewLabel"),children:c.claudeCode.join(`
|
|
232
|
+
`)}):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>rt(),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:C?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",{})]}),v.map(oe=>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:oe.key,onChange:Te=>gn(oe.id,{key:Te.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:oe.scope!=="global"?"is-active":"",onClick:()=>gn(oe.id,{scope:"user"}),children:t("settings:env.personal")}),o.jsx("button",{type:"button",className:oe.scope==="global"?"is-active":"",onClick:()=>gn(oe.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:O.has(oe.id)?"text":"password",value:oe.value,onChange:Te=>gn(oe.id,{value:Te.target.value}),placeholder:Mne(oe.value)||t("settings:env.newValue"),"aria-label":t("settings:env.value")}),o.jsx("button",{type:"button",className:"af-set-env-value-toggle",onClick:()=>bn(oe.id),"aria-label":O.has(oe.id)?"Hide value":"Show value",children:o.jsx("span",{className:"material-symbols-outlined",children:O.has(oe.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:oe.key}),onClick:()=>_n(oe.id),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})})]},oe.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:H,onChange:oe=>M(oe.target.value),"aria-label":t("settings:env.newKey")})}),e!=null&&e.isAdmin?o.jsx("div",{className:"af-set-env-cell af-set-env-cell--scope",children:o.jsxs("div",{className:"af-set-env-scope-switch",role:"group","aria-label":t("settings:env.scope"),children:[o.jsx("button",{type:"button",className:$?"":"is-active",onClick:()=>W(!1),children:t("settings:env.personal")}),o.jsx("button",{type:"button",className:$?"is-active":"",onClick:()=>W(!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:F,onChange:oe=>D(oe.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:ar,disabled:!H.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:t("settings:allowlist.title")}),o.jsx("p",{className:"af-set-card-subtitle",children:t("settings:allowlist.description")})]})]}),o.jsx("span",{className:"af-set-badge"+(mn?" af-set-badge--ok":" af-set-badge--muted"),children:t(mn?"settings:allowlist.enabled":"settings:allowlist.open")}),o.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:()=>void ue(),disabled:_e,children:t(_e?"settings:allowlist.refreshing":"common:common.refresh")})]}),qe?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:qe}):null,Z?o.jsxs("p",{className:"af-set-hint af-set-hint--inline",children:[t("settings:allowlist.file"),":",o.jsx("code",{children:Z})]}):null,o.jsxs("div",{className:"af-allowlist-grid",children:[o.jsxs("div",{className:"af-allowlist-main",children:[o.jsxs("div",{className:"af-allowlist-head",children:[o.jsx("span",{children:t("settings:allowlist.fileList")}),o.jsx("span",{children:Ve?t("settings:allowlist.saving"):t("settings:allowlist.userCount",{count:ie.length})})]}),o.jsx("div",{className:"af-allowlist-list",children:ie.length>0?ie.map(oe=>o.jsxs("div",{className:"af-allowlist-row",children:[o.jsx("span",{className:"af-allowlist-name",children:oe}),o.jsx("button",{type:"button",className:"af-set-env-del",onClick:()=>ve(oe),"aria-label":t("settings:allowlist.remove",{username:oe}),disabled:Ve,children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})]},oe)):o.jsx("div",{className:"af-allowlist-empty",children:t("settings:allowlist.emptyFile")})}),o.jsxs("div",{className:"af-allowlist-add",children:[o.jsx("input",{className:"af-set-input af-set-input--sm af-set-input--mono",value:xe,onChange:oe=>pe(oe.target.value),onKeyDown:oe=>{oe.key==="Enter"&&lr()},placeholder:"username",autoComplete:"off"}),o.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:lr,disabled:Ve||!xe.trim(),children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),t("settings:allowlist.add")]})]})]}),o.jsxs("div",{className:"af-allowlist-side",children:[o.jsxs("div",{className:"af-allowlist-head",children:[o.jsx("span",{children:t("settings:allowlist.envList")}),o.jsx("span",{children:t("settings:allowlist.readonly")})]}),o.jsx("div",{className:"af-allowlist-env-list",children:me.length>0?me.map(oe=>o.jsx("code",{children:oe},oe)):o.jsx("span",{children:t("settings:allowlist.emptyEnv")})}),o.jsx("p",{className:"af-set-hint af-set-hint--inline",children:t("settings:allowlist.unionHint")})]})]})]}):null,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:E,children:E?"刷新中...":"刷新"})]}),ee?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:ee}):null,o.jsx("div",{className:"af-feedback-list",children:P.length>0?P.map(oe=>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:oe.title||"未命名反馈"}),o.jsxs("p",{children:[o.jsx("span",{children:oe.username||oe.userId||"unknown"}),o.jsx("span",{children:zt(oe.createdAt)})]})]}),oe.contact?o.jsx("span",{className:"af-feedback-item__contact",children:oe.contact}):null]}),o.jsx("p",{className:"af-feedback-item__content",children:oe.content}),oe.pageUrl?o.jsx("code",{className:"af-feedback-item__url",children:oe.pageUrl}):null]},oe.id)):o.jsx("div",{className:"af-feedback-empty",children:E?"正在加载反馈...":"暂无反馈"})})]}):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:c.cursor.length})]}),o.jsx("div",{className:"af-set-meter-bar",children:o.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,c.cursor.length>0?12+c.cursor.length*3:4)}%`}})})]}),o.jsxs("div",{className:"af-set-meter",children:[o.jsxs("div",{className:"af-set-meter-row",children:[o.jsx("span",{children:t("settings:system.opencodeModels")}),o.jsx("span",{children:c.opencode.length})]}),o.jsx("div",{className:"af-set-meter-bar",children:o.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,c.opencode.length>0?12+c.opencode.length*3:4)}%`}})})]}),o.jsxs("div",{className:"af-set-meter",children:[o.jsxs("div",{className:"af-set-meter-row",children:[o.jsx("span",{children:t("settings:system.claudeCodeModels")}),o.jsx("span",{children:c.claudeCode.length})]}),o.jsx("div",{className:"af-set-meter-bar",children:o.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,c.claudeCode.length>0?12+c.claudeCode.length*3:4)}%`}})})]})]}),o.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:$e,"aria-label":t("settings:language.description"),children:Tne.map(oe=>o.jsxs("option",{value:oe.code,children:[oe.flag," ",oe.name]},oe.code))}),o.jsx("p",{className:"af-set-hint",children:t("settings:language.description")})]})]})]})]})]})})]})}function $ne(){const{navigate:e}=Ro(),[t,n]=h.useState(""),[r,s]=h.useState(""),[i,a]=h.useState(!1),[l,c]=h.useState(""),[d,f]=h.useState(!1),u=async p=>{if(p.preventDefault(),!i){a(!0),c("");try{const m=await fetch("/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:t,content:r,pageUrl:window.location.href})}),y=await m.json().catch(()=>({}));if(!m.ok)throw new Error(y.error||"提交失败");f(!0),n(""),s("")}catch(m){c(String(m.message||m))}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:u,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 M2(){return`m_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function nC(e,t=[]){const n=new Set((Array.isArray(t)?t:[]).map(String));return Object.entries(e&&typeof e=="object"?e:{}).map(([r,s])=>({id:M2(),key:r,value:String(s??""),private:n.has(r)}))}function rC(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 xm(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(`
|
|
233
|
+
`),description:String((e==null?void 0:e.description)||t.description||""),envRows:nC(t.env||(e==null?void 0:e.env),e==null?void 0:e.privateEnvKeys),headerRows:nC(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 Kx(){return xm({name:"",raw:{command:""}})}function Dne(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=rC(e.envRows),s=rC(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 sC(e){return e?e.ok?`${e.toolCount||0} tools enabled`:`Error - ${e.error||"Show Output"}`:"未检测"}function iC(e){return e?e.ok?"ok":"error":"unknown"}function oC({title:e,rows:t,onChange:n,placeholderKey:r="KEY",placeholderValue:s="value"}){const i=(a,l,c)=>n(t.map(d=>d.id===a?{...d,[l]:c}: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:M2(),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 Fne(){var $;const[e,t]=h.useState(""),[n,r]=h.useState([]),[s,i]=h.useState(Kx),[a,l]=h.useState(""),[c,d]=h.useState(!1),[f,u]=h.useState(!1),[p,m]=h.useState(!1),[y,b]=h.useState({}),[k,g]=h.useState(""),[v,x]=h.useState(""),N=h.useMemo(()=>n.find(W=>W.name===a)||null,[a,n]),_=N&&y[N.name]||null,C=h.useCallback(async()=>{d(!0),g("");try{const W=await fetch("/api/mcps"),O=await W.json().catch(()=>({}));if(!W.ok)throw new Error(O.error||"MCP HTTP "+W.status);const R=Array.isArray(O.servers)?O.servers:[];t(String(O.path||"")),r(R),a&&R.some(I=>I.name===a)&&i(xm(R.find(I=>I.name===a)))}catch(W){g(String(W.message||W))}finally{d(!1)}},[a]);h.useEffect(()=>{C()},[C]);const T=()=>{l(""),i(Kx()),x(""),g("")},H=W=>{l(W.name),i(xm(W)),x(""),g("")},M=async(W="")=>{m(!0),g(""),x("");try{const O=await fetch("/api/mcps/check",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(W?{name:W}:{})}),R=await O.json().catch(()=>({}));if(!O.ok)throw new Error(R.error||"检测 MCP 失败");const I=Array.isArray(R.results)?R.results:[];b(z=>{const P={...z};for(const L of I)L!=null&&L.name&&(P[L.name]=L);return P}),x(W?`已检测 ${W}。`:"已检测所有 MCP。")}catch(O){g(String(O.message||O))}finally{m(!1)}},F=async()=>{u(!0),g(""),x("");try{const W=Dne(s);if(!W.nextName)throw new Error("请填写 MCP 名称");const O=await fetch("/api/mcps",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(W)}),R=await O.json().catch(()=>({}));if(!O.ok)throw new Error(R.error||"保存 MCP 失败");const I=Array.isArray(R.servers)?R.servers:[];r(I),t(String(R.path||e)),l(W.nextName),i(xm(I.find(z=>z.name===W.nextName)||null)),b(z=>{const P={...z};return s.originalName&&s.originalName!==W.nextName&&delete P[s.originalName],delete P[W.nextName],P}),x("已保存。Cursor CLI 下次启动时会读取新配置。")}catch(W){g(String(W.message||W))}finally{u(!1)}},D=async W=>{if(W!=null&&W.name&&window.confirm(`删除 MCP "${W.name}"?`)){u(!0),g(""),x("");try{const O=await fetch("/api/mcps/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:W.name})}),R=await O.json().catch(()=>({}));if(!O.ok)throw new Error(R.error||"删除 MCP 失败");r(Array.isArray(R.servers)?R.servers:[]),l(""),i(Kx()),b(I=>{const z={...I};return delete z[W.name],z}),x("已删除。")}catch(O){g(String(O.message||O))}finally{u(!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:C,disabled:c||f,children:"刷新"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>M(),disabled:p||c||f||n.length===0,children:p?"检测中...":"检测状态"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:T,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:T,disabled:f,children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),"新增"]})]})]}),c?o.jsx("p",{className:"af-set-p",children:"加载中..."}):null,n.length===0&&!c?o.jsxs("div",{className:"af-mcp-empty",children:[o.jsx("p",{className:"af-set-p",children:"暂无 MCP server。"}),o.jsx("button",{type:"button",className:"af-set-footer-primary",onClick:T,disabled:f,children:"新增 MCP Server"})]}):null,o.jsx("div",{className:"af-mcp-server-list",children:n.map(W=>o.jsxs("button",{type:"button",className:"af-mcp-server-item"+(a===W.name?" af-mcp-server-item--active":""),onClick:()=>H(W),children:[o.jsx("span",{className:"material-symbols-outlined",children:W.type==="url"?"cloud":"terminal"}),o.jsxs("span",{children:[o.jsxs("span",{className:"af-mcp-server-title",children:[o.jsx("strong",{children:W.name}),o.jsx("small",{className:`af-mcp-server-health af-mcp-server-health--${iC(y[W.name])}`,children:sC(y[W.name])})]}),o.jsx("em",{children:W.url||[W.command,...W.args||[]].filter(Boolean).join(" ")})]})]},W.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:()=>D(N),disabled:f,children:"删除"})]}):null]}),k?o.jsx("p",{className:"af-mcp-error",children:k}):null,v?o.jsx("p",{className:"af-mcp-status",children:v}):null,_?o.jsxs("div",{className:`af-mcp-check af-mcp-check--${iC(_)}`,children:[o.jsxs("div",{className:"af-mcp-check-head",children:[o.jsx("strong",{children:sC(_)}),o.jsxs("span",{children:[_.elapsedMs||0,"ms"]})]}),_.error?o.jsx("p",{children:_.error}):null,($=_.tools)!=null&&$.length?o.jsx("div",{className:"af-mcp-tools-list",children:_.tools.map(W=>o.jsxs("div",{className:"af-mcp-tool-row",children:[o.jsx("strong",{children:W.name}),W.description?o.jsx("span",{children:W.description}):null]},W.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:W=>i(O=>({...O,name:W.target.value})),placeholder:"github"})]}),o.jsxs("label",{className:"af-set-label",children:["类型",o.jsxs("select",{className:"af-set-input",value:s.type,onChange:W=>i(O=>({...O,type:W.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:W=>i(O=>({...O,url:W.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:W=>i(O=>({...O,command:W.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:W=>i(O=>({...O,argsText:W.target.value})),placeholder:`mcp-server-example
|
|
234
|
+
--flag`})]})]}),o.jsxs("label",{className:"af-set-label af-mcp-field--wide",children:["描述",o.jsx("input",{className:"af-set-input",value:s.description,onChange:W=>i(O=>({...O,description:W.target.value})),placeholder:"这个 MCP 提供什么能力"})]}),o.jsx(oC,{title:"Headers",rows:s.headerRows,onChange:W=>i(O=>({...O,headerRows:W})),placeholderKey:"Authorization",placeholderValue:"Bearer ..."}),o.jsx(oC,{title:"Env",rows:s.envRows,onChange:W=>i(O=>({...O,envRows:W})),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:W=>i(O=>({...O,extraJson:W.target.value}))})]})]}),o.jsxs("div",{className:"af-mcp-actions",children:[o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:T,disabled:f,children:"清空"}),o.jsx("button",{type:"button",className:"af-set-footer-primary",onClick:F,disabled:f,children:f?"保存中...":"保存 MCP"})]})]})]})]})})]})}const zne=[{icon:"campaign",title:"首页 Feed 想加一个广告引导",question:"先判断入口、展示位、用户影响面,再决定弹框、浮层还是页面内引导。",context:["查客户端展示位逻辑","查历史需求与配置","查 m09 / Feed PV"],result:"原型 + PRD + TAPD 更新",tone:"pink"},{icon:"manage_search",title:"接到需求但不知道现有逻辑",question:"不用先找研发问一圈,直接从 Likee 代码、知识库、历史文档里拿上下文。",context:["客户端 / 后台 / 前端知识库","接口与配置链路","相关 Git 文档"],result:"背景结论 + 影响范围",tone:"cyan"},{icon:"query_stats",title:"运营要评估活动或入口价值",question:"先查人群规模、页面访问、历史转化,避免凭经验拍优先级。",context:["CK / Hive 查数","自动生成 SQL","指标口径解释"],result:"数据表 + 图表 + 结论",tone:"green"},{icon:"draw",title:"想快速把方案画给团队看",question:"把一句需求变成客户端或 H5 原型,让评审时先讨论体验,不只讨论文字。",context:["Likee 客户端样式","前端页面结构","交互状态与文案"],result:"HTML 原型 + Display 面板",tone:"amber"},{icon:"sync_alt",title:"需求写完后需要同步多个地方",question:"PRD、TAPD、Git 仓库和评审展示保持一致,减少重复复制和漏改。",context:["需求正文","变更记录","MR / 仓库路径"],result:"TAPD 更新 + Git 提交",tone:"violet"},{icon:"monitoring",title:"上线后要看效果和复盘",question:"沿用需求阶段的口径继续查数,把结果沉淀回下一轮需求线索。",context:["上线后 CK / Hive","分页面 / 分人群指标","实验和版本信息"],result:"复盘结论 + 后续建议",tone:"blue"}],Hne=[{label:"Use Case 01",title:"Likee 客户端知识库查询(如广告占位)",images:["/likee-context/usecase-ad-query.png"],trigger:"产品或运营想确认客户端已有逻辑,例如 Likee Android 里有哪些广告占位,以及相关常量和代码位置。",steps:["在「我的流程」加载 Likee Android 流程片段","在子 Agent 节点输入客户端逻辑问题","点击 Run Line,只执行当前链路","在右侧 Markdown Display 查看知识库查询结果"],outputs:["SETTING_ID / PAGE_ID 表格","客户端代码路径与口径说明","可继续用于 PRD 的背景材料"]},{label:"Use Case 02",title:"客户端原型设计",images:["/likee-context/usecase-prototype.png"],trigger:"业务已经明确要在 Likee 首页加入广告引导,需要先把弹框体验画出来给产品、设计、研发评审。",steps:["在 Workspace 打开原型生成流程","加载客户端原型 Skill","在子 Agent 中说明生成一个首页 dialog 弹框","查看 HTML Display 中的手机预览稿"],outputs:["Likee 风格手机原型","弹框文案与按钮状态","可直接用于评审的 Display 面板"]},{label:"Use Case 03",title:"前端 H5 原型设计",images:["/likee-context/usecase-h5-prototype.png"],trigger:"运营活动需要快速产出 Likee 风格 H5 页面,例如幸运转盘、积分排行榜、活动首页或结果页。",steps:["在 Workspace 打开 H5 原型生成流程","加载前端 H5 原型相关 Skill","在子 Agent 中说明活动结构、页面模块和运营规则","查看 HTML Display 中的可交互 H5 原型"],outputs:["Likee 风格 H5 页面","抽奖转盘与排行榜布局","活动规则和状态页","可用于评审的 HTML Display"]},{label:"Use Case 04",title:"CK / Hive 查数与 SQL 生成",images:["/likee-context/usecase-data-query.png"],trigger:"运营或产品需要快速验证一个数据问题,例如找出典型 UID、对比不同日期的视频上传分辨率占比,并保留可复用 SQL。",steps:["在 Workspace 打开查数流程","加载查数相关 Skill","在子 Agent 中说明数据口径、日期和筛选条件","查看 Markdown Display 中的数据结果和查询 SQL"],outputs:["查询结果表格","SQL 语句","口径说明","可继续接入 PRD 或复盘面板的数据结论"]},{label:"Use Case 05",title:"需求文档生成、数据补齐与同步",images:["/likee-context/usecase-prd.png","/likee-context/usecase-sync.png"],trigger:"需求进入评审和落库阶段,需要把 TAPD 信息、Hive 数据、原型内容组织成 PRD,并同步到 TAPD 和 Git 仓库。",steps:["先运行 TAPD / 数据查询节点,拿到迭代、页面 PV 和业务背景","把查询结果和原型 Display 内容接入 PRD 生成子 Agent","在 Markdown Display 查看完整需求文档","把 PRD content 接入 TAPD 更新节点和 Git 仓库提交节点"],outputs:["完整 PRD 文档","项目背景与 Top 页面数据","TAPD 需求更新成功","Git MR 链接"]},{label:"Use Case 06",title:"Display 模式做需求评审面板",images:["/likee-context/usecase-display.png"],trigger:"流程跑完后,需要把 PRD、原型、数据图表、展示位表格放在一个页面里给产品、运营、研发一起看。",steps:["在 Workspace 中完成查数、原型、PRD、同步节点执行","确认 Markdown / HTML / 图表 / 表格展示节点都有结果","切换顶部 DISPLAY 模式","使用生成链接把评审面板发给相关同学"],outputs:["PRD 长文档","客户端原型预览","图表与表格","统一展示链接"]}],Bne=[{name:"likee-client-ui",namespace:"智能助手 / 客户端原型",icon:"phone_iphone",mode:"客户端原型设计",usage:"生成 Likee 客户端风格页面、弹框、Feed 引导、个人页、活动入口等原型,适合产品评审前快速对齐体验。",examples:["首页 dialog 弹框","Feed 内引导","客户端红色主品牌视觉","移动端交互态"],tone:"pink"},{name:"tapd-likee",namespace:"智能助手 / TAPD",icon:"sync",mode:"需求系统交互",usage:"和 TAPD 交互,支持创建、同步、更新需求,把工作区生成的 PRD 或 Markdown 内容回写到需求系统。",examples:["创建 TAPD 需求","更新需求正文","同步处理人和链接","把结果回显到 Display"],tone:"green"},{name:"plain-language-response",namespace:"智能助手 / 回答风格",icon:"record_voice_over",mode:"业务化回答",usage:"用于把回答收敛成产品、运营更容易阅读的解释,避免直接把客户端代码库细节、函数调用链和实现细节暴露太多。",examples:["需求背景解释","代码结论转业务语言","评审材料摘要","减少实现细节噪音"],tone:"cyan"},{name:"create-likee-h5-style-html",namespace:"智能助手 / 前端 H5",icon:"language",mode:"H5 原型设计",usage:"创建 Likee H5 风格原型,适合运营活动、抽奖、排行榜、报告页、反馈表单、创作者认证页、订单列表等页面。",examples:["幸运转盘活动","积分排行榜","活动规则页","结果页和空状态"],tone:"amber"},{name:"analytics",namespace:"数据 / CK & Hive",icon:"query_stats",mode:"查数和 SQL 生成",usage:"面向 CK、Hive 的指标查询和 SQL 生成,适合 PV、UV、转化、分国家、分实验组、典型 UID 等数据问题。",examples:["自动生成 SQL","输出查询结果表","解释指标口径","沉淀复盘数据"],tone:"green"}],Wne=[["知识库","查客户端、后台、前端逻辑","广告、Feed、会员、增长、配置、接口调用链"],["数据","查 CK / Hive 并输出 SQL","PV、UV、转化、分页面、分国家、分实验组"],["产物","生成原型、PRD、Display 面板","Markdown、HTML 原型、图表、表格、交互预览"],["协作","同步 TAPD 与 Git 仓库","需求正文、变更记录、MR 链接、评审材料"]];function Kh({icon:e,title:t,label:n,tone:r="violet"}){return o.jsxs("div",{className:`likee-flow-node likee-flow-node-${r}`,children:[o.jsx("span",{className:"material-symbols-outlined",children:e}),o.jsxs("div",{children:[o.jsx("strong",{children:t}),o.jsx("small",{children:n})]})]})}function Vne(){return o.jsxs("div",{className:"likee-workspace-scene","aria-hidden":"true",children:[o.jsx("div",{className:"likee-scene-grid"}),o.jsxs("svg",{className:"likee-scene-lines",viewBox:"0 0 980 560",fill:"none",children:[o.jsx("path",{d:"M96 154 C236 96 330 122 444 194 C552 262 654 260 814 160"}),o.jsx("path",{d:"M118 350 C248 288 344 304 458 372 C578 444 704 420 858 310"}),o.jsx("path",{d:"M472 196 C512 248 524 302 486 372"}),o.jsx("path",{d:"M622 126 C670 198 696 258 682 354"})]}),o.jsx("div",{className:"likee-node-pos likee-node-a",children:o.jsx(Kh,{icon:"travel_explore",title:"全局上下文",label:"Likee 业务、代码、数据",tone:"pink"})}),o.jsx("div",{className:"likee-node-pos likee-node-b",children:o.jsx(Kh,{icon:"database",title:"CK / Hive",label:"自动 SQL 与指标口径",tone:"cyan"})}),o.jsx("div",{className:"likee-node-pos likee-node-c",children:o.jsx(Kh,{icon:"article",title:"需求文档",label:"PRD、变更说明、评审稿",tone:"amber"})}),o.jsx("div",{className:"likee-node-pos likee-node-d",children:o.jsx(Kh,{icon:"sync_alt",title:"TAPD / Git",label:"同步需求与版本资产",tone:"green"})}),o.jsxs("div",{className:"likee-phone-preview",children:[o.jsxs("div",{className:"likee-phone-top",children:[o.jsx("span",{children:"关注"}),o.jsx("strong",{children:"推荐"}),o.jsx("span",{children:"直播"})]}),o.jsxs("div",{className:"likee-phone-card",children:[o.jsx("div",{className:"likee-gift",children:"AD"}),o.jsx("h4",{children:"广告个性化引导弹框"}),o.jsx("p",{children:"保持推荐体验,同时解释权益与关闭路径。"}),o.jsx("button",{children:"继续"}),o.jsx("button",{className:"secondary",children:"稍后"})]})]}),o.jsxs("div",{className:"likee-display-panel",children:[o.jsxs("div",{className:"likee-panel-header",children:[o.jsx("span",{children:"DISPLAY"}),o.jsx("strong",{children:"需求资产面板"})]}),o.jsxs("div",{className:"likee-table-row",children:[o.jsx("span",{children:"需求"}),o.jsx("strong",{children:"首页广告个性化引导"})]}),o.jsxs("div",{className:"likee-table-row",children:[o.jsx("span",{children:"数据"}),o.jsx("strong",{children:"m09 PV Top 1"})]}),o.jsxs("div",{className:"likee-table-row",children:[o.jsx("span",{children:"同步"}),o.jsx("strong",{children:"TAPD + Git MR"})]})]})]})}function wm({kicker:e,title:t,children:n}){return o.jsxs("div",{className:"likee-section-copy",children:[o.jsx("p",{className:"likee-section-kicker",children:e}),o.jsx("h2",{children:t}),o.jsx("p",{children:n})]})}function Une(){return o.jsx("section",{id:"likee-skills",className:"likee-section likee-section-dark",children:o.jsxs("div",{className:"likee-section-inner likee-two-column likee-two-column-skills",children:[o.jsx(wm,{kicker:"SKILLS",title:"用 Skills 把 Likee 上下文变成可复用能力",children:"Skills 是工作区里可加载的能力包。手动搭建工作区时,只需要按场景加载对应 Skill。"}),o.jsx("div",{className:"likee-skill-grid",children:Bne.map(e=>o.jsxs("article",{className:`likee-skill-card likee-skill-${e.tone}`,children:[o.jsxs("div",{className:"likee-skill-head",children:[o.jsx("div",{className:"likee-skill-icon",children:o.jsx("span",{className:"material-symbols-outlined",children:e.icon})}),o.jsxs("div",{children:[o.jsx("h3",{children:e.name}),o.jsx("span",{children:e.namespace})]})]}),o.jsx("div",{className:"likee-skill-mode",children:e.mode}),o.jsx("p",{children:e.usage}),o.jsx("div",{className:"likee-skill-examples",children:e.examples.map(t=>o.jsx("strong",{children:t},t))})]},e.name))})]})})}function O2(){return o.jsxs("div",{className:"likee-page",children:[o.jsx("div",{className:"likee-top-actions",children:o.jsxs("a",{href:"/projects",className:"likee-home-link",children:[o.jsx("span",{className:"material-symbols-outlined",children:"arrow_back"}),"返回首页"]})}),o.jsxs("section",{className:"likee-hero",children:[o.jsx(Vne,{}),o.jsxs("div",{className:"likee-hero-content",children:[o.jsx("p",{className:"likee-eyebrow",children:"LIKEE CONTEXT WORKSPACE"}),o.jsx("h1",{children:"Likee Agent 工作台"}),o.jsx("p",{className:"likee-hero-subtitle",children:"提供 Likee 全局上下文,赋能需求挖掘、书写和运营。"}),o.jsxs("div",{className:"likee-signal-row",children:[o.jsx("span",{children:"查业务逻辑"}),o.jsx("span",{children:"查 CK / Hive"}),o.jsx("span",{children:"生成原型"}),o.jsx("span",{children:"生成 PRD"}),o.jsx("span",{children:"同步 TAPD / Git"})]}),o.jsxs("div",{className:"likee-hero-actions",children:[o.jsxs("a",{href:"/projects",className:"likee-primary-action",children:[o.jsx("span",{className:"material-symbols-outlined",children:"rocket_launch"}),"立即使用"]}),o.jsxs("a",{href:"#likee-scenarios",className:"likee-secondary-action",children:[o.jsx("span",{className:"material-symbols-outlined",children:"ads_click"}),"按场景查看"]}),o.jsxs("a",{href:"#likee-usecases",className:"likee-secondary-action",children:[o.jsx("span",{className:"material-symbols-outlined",children:"view_timeline"}),"查看 Use Cases"]}),o.jsxs("a",{href:"#likee-skills",className:"likee-secondary-action",children:[o.jsx("span",{className:"material-symbols-outlined",children:"extension"}),"查看 Skills"]})]})]})]}),o.jsx("section",{id:"likee-scenarios",className:"likee-section",children:o.jsxs("div",{className:"likee-section-inner",children:[o.jsx(wm,{kicker:"SCENARIO TRIGGERS",title:"打造 Likee 团队全景上下文",children:"不要求先会写 Prompt,也不要求知道该找哪个系统。选择一个业务场景,工作台会把需要的 Likee 上下文、数据查询和最终产物组织起来。"}),o.jsx("div",{className:"likee-scenario-grid",children:zne.map(e=>o.jsxs("article",{className:`likee-scenario-card likee-scenario-${e.tone}`,children:[o.jsx("div",{className:"likee-scenario-icon",children:o.jsx("span",{className:"material-symbols-outlined",children:e.icon})}),o.jsxs("div",{children:[o.jsx("h3",{children:e.title}),o.jsx("p",{children:e.question})]}),o.jsx("div",{className:"likee-scenario-context",children:e.context.map(t=>o.jsx("span",{children:t},t))}),o.jsxs("div",{className:"likee-scenario-result",children:[o.jsx("span",{children:"产出"}),o.jsx("strong",{children:e.result})]})]},e.title))})]})}),o.jsx("section",{id:"likee-usecases",className:"likee-section likee-section-muted",children:o.jsxs("div",{className:"likee-section-inner likee-two-column likee-usecase-layout",children:[o.jsx(wm,{kicker:"USE CASES",title:"沉淀 Likee 业务流水线",children:"这里展示的是平台里实际可跑的工作流:加载流程片段,在子 Agent 或 Run 节点输入业务问题,执行当前 line,最终在 Display、TAPD 和 Git 中拿到结果。"}),o.jsx("div",{className:"likee-usecase-stack",children:Hne.map(e=>o.jsxs("article",{className:"likee-usecase-card",children:[o.jsx("div",{className:`likee-usecase-media ${e.images.length>1?"likee-usecase-media-split":""}`,children:e.images.map((t,n)=>o.jsx("img",{src:t,alt:`${e.title} 工作区截图 ${n+1}`,loading:"lazy"},t))}),o.jsxs("div",{className:"likee-usecase-body",children:[o.jsx("div",{className:"likee-usecase-label",children:e.label}),o.jsx("h3",{children:e.title}),o.jsx("p",{children:e.trigger}),o.jsx("ol",{className:"likee-usecase-steps",children:e.steps.map(t=>o.jsx("li",{children:t},t))}),o.jsxs("div",{className:"likee-usecase-output",children:[o.jsx("span",{children:"实际产物"}),o.jsx("div",{children:e.outputs.map(t=>o.jsx("strong",{children:t},t))})]})]})]},e.label))})]})}),o.jsx(Une,{}),o.jsx("section",{className:"likee-section",children:o.jsxs("div",{className:"likee-section-inner likee-two-column likee-capability-layout",children:[o.jsx(wm,{kicker:"CAPABILITY MAP",title:"每个场景背后,都连接同一套 Likee 上下文能力",children:"工作台把知识库、CK / Hive、原型、PRD、TAPD 和 Git 放到同一条链路里。用户看到的是业务场景,系统处理的是上下文、产物和同步。"}),o.jsx("div",{className:"likee-capability-table",children:Wne.map(([e,t,n])=>o.jsxs("div",{className:"likee-capability-row",children:[o.jsx("span",{children:e}),o.jsx("strong",{children:t}),o.jsx("p",{children:n})]},e))})]})})]})}function $2(e){return t=>typeof t===e}var Kne=$2("function"),qne=e=>e===null,aC=e=>Object.prototype.toString.call(e).slice(8,-1)==="RegExp",lC=e=>!Yne(e)&&!qne(e)&&(Kne(e)||typeof e=="object"),Yne=$2("undefined");function Gne(e,t,n){return nre(n,e,t)?!0:(rre(n,e,t),e.constructor!==t.constructor?!1:Array.isArray(e)&&Array.isArray(t)?Xne(e,t,n):e instanceof Map&&t instanceof Map?Zne(e,t,n):e instanceof Set&&t instanceof Set?tre(e,t):e instanceof WeakMap||e instanceof WeakSet?!1:ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)?Jne(e,t):aC(e)&&aC(t)?e.source===t.source&&e.flags===t.flags:e instanceof Error&&t instanceof Error?Qne(e,t,n):e.valueOf!==Object.prototype.valueOf?e.valueOf()===t.valueOf():e.toString!==Object.prototype.toString?e.toString()===t.toString():ere(e,t,n))}function Np(e,t,n){return e===t||Number.isNaN(e)&&Number.isNaN(t)?!0:!e||!lC(e)||!t||!lC(t)?!1:Gne(e,t,n)}function Xne(e,t,n){const{length:r}=e;if(r!==t.length)return!1;for(let s=r;s--!==0;)if(!Np(e[s],t[s],n))return!1;return!0}function Jne(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 Qne(e,t,n){return e.message===t.message&&e.name===t.name&&Np(e.cause,t.cause,n)}function Zne(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(!Np(r[1],t.get(r[0]),n))return!1;return!0}function ere(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)&&!Np(e[i],t[i],n))return!1}return!0}function tre(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 nre(e,t,n){var r;return((r=e.get(t))==null?void 0:r.has(n))??!1}function rre(e,t,n){let r=e.get(t);r||(r=new WeakSet,e.set(t,r)),r.add(n)}function z0(e,t){return Np(e,t,new WeakMap)}function qx(){var e;return!!(typeof window<"u"&&((e=window==null?void 0:window.document)!=null&&e.createElement))}function sre(e,...t){e&&e.removeEventListener&&e.removeEventListener(...t)}function ire(e,...t){e&&e.addEventListener&&e.addEventListener(...t)}function ore(){const e=h.useRef(!0);return e.current?(e.current=!1,!0):e.current}function are(e,t){const n=ore();h.useEffect(()=>{if(!n)return e()},t)}function D2(e){const t=h.useRef(void 0);return h.useEffect(()=>{t.current=e}),t.current}function lre(e,t){const n=h.useRef(t);return z0(t,n.current)||(n.current=t),h.useMemo(e,n.current)}function cre(e){h.useEffect(()=>{e()},[])}function ure(e=0){const[t,n]=h.useState({height:qx()?window.innerHeight:0,width:qx()?window.innerWidth:0}),r=h.useRef(0),s=h.useRef(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(()=>{n({width:window.innerWidth,height:window.innerHeight})},e)});return h.useEffect(()=>{if(!qx())return()=>{};const i=s.current;return n({height:window.innerHeight,width:window.innerWidth}),ire(window,"resize",i),()=>{sre(window,"resize",i)}},[]),t}var dre=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","URL","WeakMap","WeakSet"],fre=["bigint","boolean","null","number","string","symbol","undefined"];function jp(e){const t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(pre(t))return t}function ro(e){return t=>jp(t)===e}function pre(e){return dre.includes(e)}function Ju(e){return t=>typeof t===e}function hre(e){return fre.includes(e)}var mre=["innerHTML","ownerDocument","style","attributes","nodeValue"],Cp=e=>Array.isArray(e),gre=e=>jp(e)==="AsyncGeneratorFunction",yre=ro("AsyncFunction"),xre=Ju("bigint"),wre=e=>e===!0||e===!1,bre=ro("Date"),vre=ro("Error"),fl=Ju("function"),kre=ro("GeneratorFunction"),Sre=e=>typeof e=="number"&&Number.isInteger(e),Ub=ro("Map"),F2=e=>Number.isNaN(e),H0=e=>e===null,z2=ro("Function"),Nre=ro("Promise"),jre=ro("RegExp"),Kb=ro("Set"),Ep=Ju("string"),Cre=Ju("symbol"),B0=Ju("undefined"),Ere=ro("WeakMap"),_re=ro("WeakSet"),W0=e=>H0(e)||B0(e),H2=e=>!B0(e),Pre=e=>Ju("number")(e)&&!F2(e),Are=e=>Ep(e)&&e.trim().length>0,Ire=e=>{if(!Ep(e)||e.length===0)return!1;const t=e.trim();return t.length>0&&Number.isFinite(Number(t))},fy=e=>!W0(e)&&(fl(e)||typeof e=="object"),B2=e=>{if(jp(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})},Tre=e=>H0(e)||hre(typeof e),Rre=e=>jp(e)==="URL",W2=e=>!W0(e)&&fl(e[Symbol.iterator]),Lre=e=>W2(e)&&fl(e.next)&&fl(e.throw),Mre=e=>fl(e)&&/^class\s/.test(e.toString()),Ore=(e,t)=>!Cp(e)||!fl(t)?!1:e.every(n=>t(n)),$re=e=>fy(e)&&!B2(e)&&e.nodeType===1&&Ep(e.nodeName)&&mre.every(t=>t in e),Dre=e=>Ep(e)&&e.length===0||Cp(e)&&e.length===0||fy(e)&&!Ub(e)&&!Kb(e)&&Object.keys(e).length===0||Kb(e)&&e.size===0||Ub(e)&&e.size===0,Fre=(e,t)=>!e||!t?!1:Object.getPrototypeOf(e)===t.prototype,zre=(e,t)=>Cp(e)?e.indexOf(t)>-1:!1,Hre=(e,t,n)=>{if(!fy(e)||!t)return!1;const r=e[t];return fl(n)?n(r):H2(r)};function At(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(Cp(e))return"Array";if(z2(e))return"Function";const t=jp(e);return t||"Object"}At.array=Cp;At.arrayOf=Ore;At.asyncGeneratorFunction=gre;At.asyncFunction=yre;At.bigint=xre;At.boolean=wre;At.class=Mre;At.date=bre;At.defined=H2;At.domElement=$re;At.empty=Dre;At.error=vre;At.function=fl;At.generator=Lre;At.generatorFunction=kre;At.instanceOf=Fre;At.integer=Sre;At.iterable=W2;At.map=Ub;At.nan=F2;At.null=H0;At.nullOrUndefined=W0;At.nonEmptyString=Are;At.number=Pre;At.numericString=Ire;At.object=fy;At.oneOf=zre;At.plainFunction=z2;At.plainObject=B2;At.primitive=Tre;At.promise=Nre;At.propertyOf=Hre;At.regexp=jre;At.set=Kb;At.string=Ep;At.symbol=Cre;At.undefined=B0;At.url=Rre;At.weakMap=Ere;At.weakSet=_re;var rs=At;/* v8 ignore next -- @preserve */var Bre=function(e){return Object.prototype.hasOwnProperty.call(e,"props")},Wre=function(e,t){return e+sp(t)},sp=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(Wre,""):Bre(e)&&Object.prototype.hasOwnProperty.call(e.props,"children")?sp(e.props.children):""};sp.default=sp;var Vre=sp;const Yx=hl(Vre);var V2={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(_){return _!=="constructor"&&_!=="prototype"&&_!=="__proto__"}function a(_){let C=0;const T=_.length,H=new Array(T);for(C;C<T;++C)H[C]=g(_[C]);return H}function l(_){const C={};if(p&&Object.getPrototypeOf(_)!==t)return p(_);const T=u(_);let H,M,F;for(H=0,M=T.length;H<M;++H)i(F=T[H])&&(C[F]=g(_[F]));return C}function c(_,C){const T=_.length,H=C.length;let M=0;const F=new Array(T+H);for(M;M<T;++M)F[M]=g(_[M]);for(M=0;M<H;++M)F[M+T]=g(C[M]);return F}const d=Object.prototype.propertyIsEnumerable;function f(_){const C=Object.keys(_),T=Object.getOwnPropertySymbols(_);for(let H=0,M=T.length;H<M;++H)d.call(_,T[H])&&C.push(T[H]);return C}const u=s!=null&&s.symbols?f:Object.keys,p=typeof(s==null?void 0:s.cloneProtoObject)=="function"?s.cloneProtoObject:void 0,m=typeof(s==null?void 0:s.isMergeableObject)=="function"?s.isMergeableObject:n(),y=(s==null?void 0:s.onlyDefinedProperties)===!0;function b(_){return typeof _!="object"||_===null}const k=s&&typeof s.mergeArray=="function"?s.mergeArray({clone:g,deepmerge:x,getKeys:u,isMergeableObject:m}):c;function g(_){return m(_)?Array.isArray(_)?a(_):l(_):_}function v(_,C){const T={},H=u(_),M=u(C);let F,D,$;for(F=0,D=H.length;F<D;++F)i($=H[F])&&M.indexOf($)===-1&&(T[$]=g(_[$]));for(F=0,D=M.length;F<D;++F)if(i($=M[F]))if($ in _)H.indexOf($)!==-1&&(p&&m(C[$])&&Object.getPrototypeOf(C[$])!==t?T[$]=p(C[$]):T[$]=x(_[$],C[$]));else{if(y&&typeof C[$]>"u")continue;T[$]=g(C[$])}return T}function x(_,C){if(y&&typeof C>"u")return g(_);const T=Array.isArray(C),H=Array.isArray(_);return b(C)?C:m(_)?T&&H?k(_,C):T!==H?g(C):v(_,C):g(C)}function N(){switch(arguments.length){case 0:return{};case 1:return g(arguments[0]);case 2:return x(arguments[0],arguments[1])}let _;for(let C=0,T=arguments.length;C<T;++C)_=x(_,arguments[C]);return _}return s!=null&&s.all?N:x}e.exports=r,e.exports.default=r,e.exports.deepmerge=r,Object.defineProperty(e.exports,"isMergeableObject",{get:n})})(V2);var Ure=V2.exports;const Kre=hl(Ure);var qre=new Error("Element already at target scroll position"),Yre=new Error("Scroll cancelled"),Gre=Math.min,cC=Date.now,Xre={left:uC("scrollLeft"),top:uC("scrollTop")};function uC(e){return function(n,r,s,i){s=s||{},typeof s=="function"&&(i=s,s={}),typeof i!="function"&&(i=Qre);var a=cC(),l=n[e],c=s.ease||Jre,d=isNaN(s.duration)?350:+s.duration,f=!1;return l===r?i(qre,n[e]):requestAnimationFrame(p),u;function u(){f=!0}function p(m){if(f)return i(Yre,n[e]);var y=cC(),b=Gre(1,(y-a)/d),k=c(b);n[e]=k*(r-l)+l,b<1?requestAnimationFrame(p):requestAnimationFrame(function(){i(null,n[e])})}}}function Jre(e){return .5*(1-Math.cos(Math.PI*e))}function Qre(){}const Zre=hl(Xre);var U2={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.Scrollparent=n()})(bf,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})})(U2);var ese=U2.exports;const K2=hl(ese),tse=["top","right","bottom","left"],dC=["start","end"],fC=tse.reduce((e,t)=>e.concat(t,t+"-"+dC[0],t+"-"+dC[1]),[]),Wu=Math.min,ic=Math.max,Ng=Math.round,qh=Math.floor,Po=e=>({x:e,y:e}),nse={left:"right",right:"left",bottom:"top",top:"bottom"};function qb(e,t,n){return ic(e,Wu(t,n))}function Qu(e,t){return typeof e=="function"?e(t):e}function ha(e){return e.split("-")[0]}function Ao(e){return e.split("-")[1]}function q2(e){return e==="x"?"y":"x"}function V0(e){return e==="y"?"height":"width"}function Ya(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function U0(e){return q2(Ya(e))}function Y2(e,t,n){n===void 0&&(n=!1);const r=Ao(e),s=U0(e),i=V0(s);let a=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=Cg(a)),[a,Cg(a)]}function rse(e){const t=Cg(e);return[jg(e),t,jg(t)]}function jg(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const pC=["left","right"],hC=["right","left"],sse=["top","bottom"],ise=["bottom","top"];function ose(e,t,n){switch(e){case"top":case"bottom":return n?t?hC:pC:t?pC:hC;case"left":case"right":return t?sse:ise;default:return[]}}function ase(e,t,n,r){const s=Ao(e);let i=ose(ha(e),n==="start",r);return s&&(i=i.map(a=>a+"-"+s),t&&(i=i.concat(i.map(jg)))),i}function Cg(e){const t=ha(e);return nse[t]+e.slice(t.length)}function lse(e){return{top:0,right:0,bottom:0,left:0,...e}}function G2(e){return typeof e!="number"?lse(e):{top:e,right:e,bottom:e,left:e}}function Eg(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 mC(e,t,n){let{reference:r,floating:s}=e;const i=Ya(t),a=U0(t),l=V0(a),c=ha(t),d=i==="y",f=r.x+r.width/2-s.width/2,u=r.y+r.height/2-s.height/2,p=r[l]/2-s[l]/2;let m;switch(c){case"top":m={x:f,y:r.y-s.height};break;case"bottom":m={x:f,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:u};break;case"left":m={x:r.x-s.width,y:u};break;default:m={x:r.x,y:r.y}}switch(Ao(t)){case"start":m[a]-=p*(n&&d?-1:1);break;case"end":m[a]+=p*(n&&d?-1:1);break}return m}async function cse(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:i,rects:a,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:p=!1,padding:m=0}=Qu(t,e),y=G2(m),k=l[p?u==="floating"?"reference":"floating":u],g=Eg(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:c})),v=u==="floating"?{x:r,y:s,width:a.floating.width,height:a.floating.height}:a.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),N=await(i.isElement==null?void 0:i.isElement(x))?await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1}:{x:1,y:1},_=Eg(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:x,strategy:c}):v);return{top:(g.top-_.top+y.top)/N.y,bottom:(_.bottom-g.bottom+y.bottom)/N.y,left:(g.left-_.left+y.left)/N.x,right:(_.right-g.right+y.right)/N.x}}const use=50,dse=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:cse},c=await(a.isRTL==null?void 0:a.isRTL(t));let d=await a.getElementRects({reference:e,floating:t,strategy:s}),{x:f,y:u}=mC(d,r,c),p=r,m=0;const y={};for(let b=0;b<i.length;b++){const k=i[b];if(!k)continue;const{name:g,fn:v}=k,{x,y:N,data:_,reset:C}=await v({x:f,y:u,initialPlacement:r,placement:p,strategy:s,middlewareData:y,rects:d,platform:l,elements:{reference:e,floating:t}});f=x??f,u=N??u,y[g]={...y[g],..._},C&&m<use&&(m++,typeof C=="object"&&(C.placement&&(p=C.placement),C.rects&&(d=C.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:s}):C.rects),{x:f,y:u}=mC(d,p,c)),b=-1)}return{x:f,y:u,placement:p,strategy:s,middlewareData:y}},fse=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:i,platform:a,elements:l,middlewareData:c}=t,{element:d,padding:f=0}=Qu(e,t)||{};if(d==null)return{};const u=G2(f),p={x:n,y:r},m=U0(s),y=V0(m),b=await a.getDimensions(d),k=m==="y",g=k?"top":"left",v=k?"bottom":"right",x=k?"clientHeight":"clientWidth",N=i.reference[y]+i.reference[m]-p[m]-i.floating[y],_=p[m]-i.reference[m],C=await(a.getOffsetParent==null?void 0:a.getOffsetParent(d));let T=C?C[x]:0;(!T||!await(a.isElement==null?void 0:a.isElement(C)))&&(T=l.floating[x]||i.floating[y]);const H=N/2-_/2,M=T/2-b[y]/2-1,F=Wu(u[g],M),D=Wu(u[v],M),$=F,W=T-b[y]-D,O=T/2-b[y]/2+H,R=qb($,O,W),I=!c.arrow&&Ao(s)!=null&&O!==R&&i.reference[y]/2-(O<$?F:D)-b[y]/2<0,z=I?O<$?O-$:O-W:0;return{[m]:p[m]+z,data:{[m]:R,centerOffset:O-R-z,...I&&{alignmentOffset:z}},reset:I}}});function pse(e,t,n){return(e?[...n.filter(s=>Ao(s)===e),...n.filter(s=>Ao(s)!==e)]:n.filter(s=>ha(s)===s)).filter(s=>e?Ao(s)===e||(t?jg(s)!==s:!1):!0)}const hse=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,r,s;const{rects:i,middlewareData:a,placement:l,platform:c,elements:d}=t,{crossAxis:f=!1,alignment:u,allowedPlacements:p=fC,autoAlignment:m=!0,...y}=Qu(e,t),b=u!==void 0||p===fC?pse(u||null,m,p):p,k=await c.detectOverflow(t,y),g=((n=a.autoPlacement)==null?void 0:n.index)||0,v=b[g];if(v==null)return{};const x=Y2(v,i,await(c.isRTL==null?void 0:c.isRTL(d.floating)));if(l!==v)return{reset:{placement:b[0]}};const N=[k[ha(v)],k[x[0]],k[x[1]]],_=[...((r=a.autoPlacement)==null?void 0:r.overflows)||[],{placement:v,overflows:N}],C=b[g+1];if(C)return{data:{index:g+1,overflows:_},reset:{placement:C}};const T=_.map(F=>{const D=Ao(F.placement);return[F.placement,D&&f?F.overflows.slice(0,2).reduce(($,W)=>$+W,0):F.overflows[0],F.overflows]}).sort((F,D)=>F[1]-D[1]),M=((s=T.filter(F=>F[2].slice(0,Ao(F[0])?2:3).every(D=>D<=0))[0])==null?void 0:s[0])||T[0][0];return M!==l?{data:{index:g+1,overflows:_},reset:{placement:M}}:{}}}},mse=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:i,rects:a,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:p,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:b=!0,...k}=Qu(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const g=ha(s),v=Ya(l),x=ha(l)===l,N=await(c.isRTL==null?void 0:c.isRTL(d.floating)),_=p||(x||!b?[Cg(l)]:rse(l)),C=y!=="none";!p&&C&&_.push(...ase(l,b,y,N));const T=[l,..._],H=await c.detectOverflow(t,k),M=[];let F=((r=i.flip)==null?void 0:r.overflows)||[];if(f&&M.push(H[g]),u){const O=Y2(s,a,N);M.push(H[O[0]],H[O[1]])}if(F=[...F,{placement:s,overflows:M}],!M.every(O=>O<=0)){var D,$;const O=(((D=i.flip)==null?void 0:D.index)||0)+1,R=T[O];if(R&&(!(u==="alignment"?v!==Ya(R):!1)||F.every(P=>Ya(P.placement)===v?P.overflows[0]>0:!0)))return{data:{index:O,overflows:F},reset:{placement:R}};let I=($=F.filter(z=>z.overflows[0]<=0).sort((z,P)=>z.overflows[1]-P.overflows[1])[0])==null?void 0:$.placement;if(!I)switch(m){case"bestFit":{var W;const z=(W=F.filter(P=>{if(C){const L=Ya(P.placement);return L===v||L==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(L=>L>0).reduce((L,E)=>L+E,0)]).sort((P,L)=>P[1]-L[1])[0])==null?void 0:W[0];z&&(I=z);break}case"initialPlacement":I=l;break}if(s!==I)return{reset:{placement:I}}}return{}}}},gse=new Set(["left","top"]);async function yse(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),a=ha(n),l=Ao(n),c=Ya(n)==="y",d=gse.has(a)?-1:1,f=i&&c?-1:1,u=Qu(t,e);let{mainAxis:p,crossAxis:m,alignmentAxis:y}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return l&&typeof y=="number"&&(m=l==="end"?y*-1:y),c?{x:m*f,y:p*d}:{x:p*d,y:m*f}}const xse=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:i,placement:a,middlewareData:l}=t,c=await yse(t,e);return a===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:i+c.y,data:{...c,placement:a}}}}},wse=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:i}=t,{mainAxis:a=!0,crossAxis:l=!1,limiter:c={fn:g=>{let{x:v,y:x}=g;return{x:v,y:x}}},...d}=Qu(e,t),f={x:n,y:r},u=await i.detectOverflow(t,d),p=Ya(ha(s)),m=q2(p);let y=f[m],b=f[p];if(a){const g=m==="y"?"top":"left",v=m==="y"?"bottom":"right",x=y+u[g],N=y-u[v];y=qb(x,y,N)}if(l){const g=p==="y"?"top":"left",v=p==="y"?"bottom":"right",x=b+u[g],N=b-u[v];b=qb(x,b,N)}const k=c.fn({...t,[m]:y,[p]:b});return{...k,data:{x:k.x-n,y:k.y-r,enabled:{[m]:a,[p]:l}}}}}};function py(){return typeof window<"u"}function Zu(e){return X2(e)?(e.nodeName||"").toLowerCase():"#document"}function ri(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Mo(e){var t;return(t=(X2(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function X2(e){return py()?e instanceof Node||e instanceof ri(e).Node:!1}function eo(e){return py()?e instanceof Element||e instanceof ri(e).Element:!1}function ya(e){return py()?e instanceof HTMLElement||e instanceof ri(e).HTMLElement:!1}function gC(e){return!py()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ri(e).ShadowRoot}function _p(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=to(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function bse(e){return/^(table|td|th)$/.test(Zu(e))}function hy(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const vse=/transform|translate|scale|rotate|perspective|filter/,kse=/paint|layout|strict|content/,Bl=e=>!!e&&e!=="none";let Gx;function K0(e){const t=eo(e)?to(e):e;return Bl(t.transform)||Bl(t.translate)||Bl(t.scale)||Bl(t.rotate)||Bl(t.perspective)||!q0()&&(Bl(t.backdropFilter)||Bl(t.filter))||vse.test(t.willChange||"")||kse.test(t.contain||"")}function Sse(e){let t=pl(e);for(;ya(t)&&!Vu(t);){if(K0(t))return t;if(hy(t))return null;t=pl(t)}return null}function q0(){return Gx==null&&(Gx=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Gx}function Vu(e){return/^(html|body|#document)$/.test(Zu(e))}function to(e){return ri(e).getComputedStyle(e)}function my(e){return eo(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function pl(e){if(Zu(e)==="html")return e;const t=e.assignedSlot||e.parentNode||gC(e)&&e.host||Mo(e);return gC(t)?t.host:t}function J2(e){const t=pl(e);return Vu(t)?e.ownerDocument?e.ownerDocument.body:e.body:ya(t)&&_p(t)?t:J2(t)}function ip(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=J2(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),a=ri(s);if(i){const l=Yb(a);return t.concat(a,a.visualViewport||[],_p(s)?s:[],l&&n?ip(l):[])}else return t.concat(s,ip(s,[],n))}function Yb(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Q2(e){const t=to(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=ya(e),i=s?e.offsetWidth:n,a=s?e.offsetHeight:r,l=Ng(n)!==i||Ng(r)!==a;return l&&(n=i,r=a),{width:n,height:r,$:l}}function Y0(e){return eo(e)?e:e.contextElement}function vu(e){const t=Y0(e);if(!ya(t))return Po(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=Q2(t);let a=(i?Ng(n.width):n.width)/r,l=(i?Ng(n.height):n.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const Nse=Po(0);function Z2(e){const t=ri(e);return!q0()||!t.visualViewport?Nse:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function jse(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ri(e)?!1:t}function gc(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=Y0(e);let a=Po(1);t&&(r?eo(r)&&(a=vu(r)):a=vu(e));const l=jse(i,n,r)?Z2(i):Po(0);let c=(s.left+l.x)/a.x,d=(s.top+l.y)/a.y,f=s.width/a.x,u=s.height/a.y;if(i){const p=ri(i),m=r&&eo(r)?ri(r):r;let y=p,b=Yb(y);for(;b&&r&&m!==y;){const k=vu(b),g=b.getBoundingClientRect(),v=to(b),x=g.left+(b.clientLeft+parseFloat(v.paddingLeft))*k.x,N=g.top+(b.clientTop+parseFloat(v.paddingTop))*k.y;c*=k.x,d*=k.y,f*=k.x,u*=k.y,c+=x,d+=N,y=ri(b),b=Yb(y)}}return Eg({width:f,height:u,x:c,y:d})}function gy(e,t){const n=my(e).scrollLeft;return t?t.left+n:gc(Mo(e)).left+n}function eR(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-gy(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function Cse(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",a=Mo(r),l=t?hy(t.floating):!1;if(r===a||l&&i)return n;let c={scrollLeft:0,scrollTop:0},d=Po(1);const f=Po(0),u=ya(r);if((u||!u&&!i)&&((Zu(r)!=="body"||_p(a))&&(c=my(r)),u)){const m=gc(r);d=vu(r),f.x=m.x+r.clientLeft,f.y=m.y+r.clientTop}const p=a&&!u&&!i?eR(a,c):Po(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+f.x+p.x,y:n.y*d.y-c.scrollTop*d.y+f.y+p.y}}function Ese(e){return Array.from(e.getClientRects())}function _se(e){const t=Mo(e),n=my(e),r=e.ownerDocument.body,s=ic(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=ic(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+gy(e);const l=-n.scrollTop;return to(r).direction==="rtl"&&(a+=ic(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:a,y:l}}const yC=25;function Pse(e,t){const n=ri(e),r=Mo(e),s=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,c=0;if(s){i=s.width,a=s.height;const f=q0();(!f||f&&t==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}const d=gy(r);if(d<=0){const f=r.ownerDocument,u=f.body,p=getComputedStyle(u),m=f.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,y=Math.abs(r.clientWidth-u.clientWidth-m);y<=yC&&(i-=y)}else d<=yC&&(i+=d);return{width:i,height:a,x:l,y:c}}function Ase(e,t){const n=gc(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=ya(e)?vu(e):Po(1),a=e.clientWidth*i.x,l=e.clientHeight*i.y,c=s*i.x,d=r*i.y;return{width:a,height:l,x:c,y:d}}function xC(e,t,n){let r;if(t==="viewport")r=Pse(e,n);else if(t==="document")r=_se(Mo(e));else if(eo(t))r=Ase(t,n);else{const s=Z2(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Eg(r)}function tR(e,t){const n=pl(e);return n===t||!eo(n)||Vu(n)?!1:to(n).position==="fixed"||tR(n,t)}function Ise(e,t){const n=t.get(e);if(n)return n;let r=ip(e,[],!1).filter(l=>eo(l)&&Zu(l)!=="body"),s=null;const i=to(e).position==="fixed";let a=i?pl(e):e;for(;eo(a)&&!Vu(a);){const l=to(a),c=K0(a);!c&&l.position==="fixed"&&(s=null),(i?!c&&!s:!c&&l.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||_p(a)&&!c&&tR(e,a))?r=r.filter(f=>f!==a):s=l,a=pl(a)}return t.set(e,r),r}function Tse(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const a=[...n==="clippingAncestors"?hy(t)?[]:Ise(t,this._c):[].concat(n),r],l=xC(t,a[0],s);let c=l.top,d=l.right,f=l.bottom,u=l.left;for(let p=1;p<a.length;p++){const m=xC(t,a[p],s);c=ic(m.top,c),d=Wu(m.right,d),f=Wu(m.bottom,f),u=ic(m.left,u)}return{width:d-u,height:f-c,x:u,y:c}}function Rse(e){const{width:t,height:n}=Q2(e);return{width:t,height:n}}function Lse(e,t,n){const r=ya(t),s=Mo(t),i=n==="fixed",a=gc(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=Po(0);function d(){c.x=gy(s)}if(r||!r&&!i)if((Zu(t)!=="body"||_p(s))&&(l=my(t)),r){const m=gc(t,!0,i,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}else s&&d();i&&!r&&s&&d();const f=s&&!r&&!i?eR(s,l):Po(0),u=a.left+l.scrollLeft-c.x-f.x,p=a.top+l.scrollTop-c.y-f.y;return{x:u,y:p,width:a.width,height:a.height}}function Xx(e){return to(e).position==="static"}function wC(e,t){if(!ya(e)||to(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Mo(e)===n&&(n=n.ownerDocument.body),n}function nR(e,t){const n=ri(e);if(hy(e))return n;if(!ya(e)){let s=pl(e);for(;s&&!Vu(s);){if(eo(s)&&!Xx(s))return s;s=pl(s)}return n}let r=wC(e,t);for(;r&&bse(r)&&Xx(r);)r=wC(r,t);return r&&Vu(r)&&Xx(r)&&!K0(r)?n:r||Sse(e)||n}const Mse=async function(e){const t=this.getOffsetParent||nR,n=this.getDimensions,r=await n(e.floating);return{reference:Lse(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ose(e){return to(e).direction==="rtl"}const $se={convertOffsetParentRelativeRectToViewportRelativeRect:Cse,getDocumentElement:Mo,getClippingRect:Tse,getOffsetParent:nR,getElementRects:Mse,getClientRects:Ese,getDimensions:Rse,getScale:vu,isElement:eo,isRTL:Ose};function rR(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Dse(e,t){let n=null,r;const s=Mo(e);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function a(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),i();const d=e.getBoundingClientRect(),{left:f,top:u,width:p,height:m}=d;if(l||t(),!p||!m)return;const y=qh(u),b=qh(s.clientWidth-(f+p)),k=qh(s.clientHeight-(u+m)),g=qh(f),x={rootMargin:-y+"px "+-b+"px "+-k+"px "+-g+"px",threshold:ic(0,Wu(1,c))||1};let N=!0;function _(C){const T=C[0].intersectionRatio;if(T!==c){if(!N)return a();T?a(!1,T):r=setTimeout(()=>{a(!1,1e-7)},1e3)}T===1&&!rR(d,e.getBoundingClientRect())&&a(),N=!1}try{n=new IntersectionObserver(_,{...x,root:s.ownerDocument})}catch{n=new IntersectionObserver(_,x)}n.observe(e)}return a(!0),i}function bC(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,d=Y0(e),f=s||i?[...d?ip(d):[],...t?ip(t):[]]:[];f.forEach(g=>{s&&g.addEventListener("scroll",n,{passive:!0}),i&&g.addEventListener("resize",n)});const u=d&&l?Dse(d,n):null;let p=-1,m=null;a&&(m=new ResizeObserver(g=>{let[v]=g;v&&v.target===d&&m&&t&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var x;(x=m)==null||x.observe(t)})),n()}),d&&!c&&m.observe(d),t&&m.observe(t));let y,b=c?gc(e):null;c&&k();function k(){const g=gc(e);b&&!rR(b,g)&&n(),b=g,y=requestAnimationFrame(k)}return n(),()=>{var g;f.forEach(v=>{s&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),u==null||u(),(g=m)==null||g.disconnect(),m=null,c&&cancelAnimationFrame(y)}}const Fse=xse,zse=hse,Hse=wse,Bse=mse,vC=fse,Wse=(e,t,n)=>{const r=new Map,s={platform:$se,...n},i={...s.platform,_c:r};return dse(e,t,{...s,platform:i})};var Vse=typeof document<"u",Use=function(){},bm=Vse?h.useLayoutEffect:Use;function _g(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(!_g(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)&&!_g(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function sR(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function kC(e,t){const n=sR(e);return Math.round(t*n)/n}function Jx(e){const t=h.useRef(e);return bm(()=>{t.current=e}),t}function SC(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:a}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[f,u]=h.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=h.useState(r);_g(p,r)||m(r);const[y,b]=h.useState(null),[k,g]=h.useState(null),v=h.useCallback(P=>{P!==C.current&&(C.current=P,b(P))},[]),x=h.useCallback(P=>{P!==T.current&&(T.current=P,g(P))},[]),N=i||y,_=a||k,C=h.useRef(null),T=h.useRef(null),H=h.useRef(f),M=c!=null,F=Jx(c),D=Jx(s),$=Jx(d),W=h.useCallback(()=>{if(!C.current||!T.current)return;const P={placement:t,strategy:n,middleware:p};D.current&&(P.platform=D.current),Wse(C.current,T.current,P).then(L=>{const E={...L,isPositioned:$.current!==!1};O.current&&!_g(H.current,E)&&(H.current=E,Fr.flushSync(()=>{u(E)}))})},[p,t,n,D,$]);bm(()=>{d===!1&&H.current.isPositioned&&(H.current.isPositioned=!1,u(P=>({...P,isPositioned:!1})))},[d]);const O=h.useRef(!1);bm(()=>(O.current=!0,()=>{O.current=!1}),[]),bm(()=>{if(N&&(C.current=N),_&&(T.current=_),N&&_){if(F.current)return F.current(N,_,W);W()}},[N,_,W,F,M]);const R=h.useMemo(()=>({reference:C,floating:T,setReference:v,setFloating:x}),[v,x]),I=h.useMemo(()=>({reference:N,floating:_}),[N,_]),z=h.useMemo(()=>{const P={position:n,left:0,top:0};if(!I.floating)return P;const L=kC(I.floating,f.x),E=kC(I.floating,f.y);return l?{...P,transform:"translate("+L+"px, "+E+"px)",...sR(I.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:L,top:E}},[n,l,I.floating,f.x,f.y]);return h.useMemo(()=>({...f,update:W,refs:R,elements:I,floatingStyles:z}),[f,W,R,I,z])}const Kse=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?vC({element:r.current,padding:s}).fn(n):{}:r?vC({element:r,padding:s}).fn(n):{}}}},NC=(e,t)=>{const n=Fse(e);return{name:n.name,fn:n.fn,options:[e,t]}},qse=(e,t)=>{const n=Hse(e);return{name:n.name,fn:n.fn,options:[e,t]}},Yse=(e,t)=>{const n=Bse(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gse=(e,t)=>{const n=zse(e);return{name:n.name,fn:n.fn,options:[e,t]}},Xse=(e,t)=>{const n=Kse(e);return{name:n.name,fn:n.fn,options:[e,t]}},Jse={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},Qse={beaconOptions:{offset:-18}},iR={back:"Back",close:"Close",last:"Last",next:"Next",nextWithProgress:"Next ({current} of {total})",open:"Open the dialog",skip:"Skip"},Zse={isFixed:!1,locale:iR,placement:"bottom"},eie={continuous:!1,debug:!1,run:!1,scrollToFirstStep:!1,steps:[]},Ft={INIT:"init",START:"start",STOP:"stop",RESET:"reset",PREV:"prev",NEXT:"next",GO:"go",CLOSE:"close",SKIP:"skip",UPDATE:"update",COMPLETE:"complete"},Ar={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"},Ye={INIT:"init",READY:"ready",BEACON_BEFORE:"beacon_before",BEACON:"beacon",TOOLTIP_BEFORE:"tooltip_before",TOOLTIP:"tooltip",COMPLETE:"complete"},bo={BUTTON_BACK:"button_back",BUTTON_CLOSE:"button_close",BUTTON_PRIMARY:"button_primary",BUTTON_SKIP:"button_skip",KEYBOARD:"keyboard",OVERLAY:"overlay"},Rt={IDLE:"idle",READY:"ready",WAITING:"waiting",RUNNING:"running",PAUSED:"paused",SKIPPED:"skipped",FINISHED:"finished"},tie="react-joyride-portal";function nie(e){const t={};for(const n in e)e[n]!==void 0&&(t[n]=e[n]);return t}function cu(...e){return Kre({all:!0,isMergeableObject:t=>!(!rs.plainObject(t)||h.isValidElement(t))})(...e)}function oR(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function ea(e,t={}){const{defaultValue:n,step:r,steps:s}=t;let i=Yx(e);if(i)(i.includes("{current}")||i.includes("{total}"))&&r&&s&&(i=i.replace("{current}",r.toString()).replace("{total}",s.toString()));else if(h.isValidElement(e)&&!Object.values(e.props).length&&oR(e.type)==="function")try{i=ea(e.type({}),t)}catch{i=Yx(n)}else i=Yx(n);return i}function Tr(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 rie(e,t){const n=nie(t);return{...e,...n}}function op(){}function sie(e){return Object.keys(e)}function Pg(e,...t){if(!rs.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 jC(e,...t){if(!rs.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 Gb(e,t,n){const r=i=>i.replace("{current}",String(t)).replace("{total}",String(n));if(oR(e)==="string")return r(e);if(!h.isValidElement(e))return e;const{children:s}=e.props;if(rs.string(s)&&s.includes("{current}"))return h.cloneElement(e,{children:r(s)});if(Array.isArray(s))return h.cloneElement(e,{children:s.map(i=>typeof i=="string"?r(i):Gb(i,t,n))});if(rs.function(e.type)&&!Object.values(e.props).length)try{return Gb(e.type({}),t,n)}catch{return e}return e}function CC(e){return sie(e).sort().reduce((t,n)=>(t[n]=e[n],t),{})}function G0(){var e;return!!(typeof window<"u"&&((e=window.document)!=null&&e.createElement))}function EC(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 X0(e){return e?e.getBoundingClientRect():null}function iie(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 ji(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 oie(e,t,n){const r=X0(e),s=ed(e),i=s?!s.isSameNode(Rs()):!1,a=n??td(e);let l=0,c=(r==null?void 0:r.top)??0;return i&&a?c=(r==null?void 0:r.top)??0:s instanceof HTMLElement&&(l=s.scrollTop,!i&&!a&&(c+=l),s.isSameNode(Rs())||(c+=Rs().scrollTop)),Math.floor(c-t)}function ed(e,t){if(!e)return Rs();const n=K2(e);if(n){if(n.isSameNode(Rs()))return t?document:Rs();if(!(n.scrollHeight>n.offsetHeight))return Rs()}return n}function aie(e){const t=e.getBoundingClientRect(),n=Rs(),r=t.top+t.height/2,s=window.innerHeight/2;return Math.max(0,n.scrollTop+r-s)}function lie(e,t){if(!e)return 0;const n=K2(e)??Rs(),r=parseFloat(getComputedStyle(e).scrollMarginTop)||0,s=X0(n),i=n.scrollTop??0,{offsetTop:a=0,scrollTop:l=0}=n;let c=e.getBoundingClientRect().top+l;if(a&&(aR(e)||cie(e))){const f=e.getBoundingClientRect(),u=f.top-((s==null?void 0:s.top)??0),p=u+f.height,m=n.clientHeight,y=m*.2;u>=y&&p<=m-y?c=i:c=u+i}const d=Math.floor(c-t-r);return d<0?0:d}function cie(e){return e.offsetParent!==document.body}function aR(e){if(!e)return!1;const t=ed(e);return t?!t.isSameNode(Rs()):!1}function td(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?td(e.parentNode,t):!1}function Yh(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 _C(e){const{isFirstStep:t,scrollToFirstStep:n,step:r,target:s,targetLifecycle:i}=e;if(r.skipScroll||t&&!n&&i!==Ye.TOOLTIP||r.placement==="center")return!1;const a=s!=null&&s.isConnected?ed(s):Rs(),l=a?!a.isSameNode(Rs()):!1;return(r.isFixed||td(s))&&!l?!1:a.scrollHeight>a.clientHeight}function Rs(){return document.scrollingElement??document.documentElement}function PC(e,t){const{duration:n,element:r}=t;let s=()=>{};const i=new Promise(a=>{const{scrollTop:l}=r,c=e>l?e-l:l-e;s=Zre.top(r,e,{duration:c<100?50:n},()=>{a()})});return{cancel:s,promise:i}}function uie(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 lR={backgroundColor:"transparent",border:0,borderRadius:0,color:"#555555",cursor:"pointer",fontSize:16,lineHeight:1,padding:0,WebkitAppearance:"none"},Gh={...lR,borderRadius:4,padding:8};function die(e,t){const{styles:n}=e,r=cu(n??{},t.styles??{});let{width:s}=t;G0()&&(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 cu({arrow:{alignItems:"center",color:t.arrowColor,display:"inline-flex",justifyContent:"center",position:"absolute"},beaconWrapper:{...lR,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(${uie(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:{...Gh,color:t.primaryColor,marginLeft:"auto",marginRight:5},buttonClose:{...Gh,color:t.textColor,height:12,padding:8,position:"absolute",right:0,top:0,width:12},buttonPrimary:{...Gh,backgroundColor:t.primaryColor,color:t.backgroundColor},buttonSkip:{...Gh,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 fie=["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 J0(e,t){if(!t)return null;const n=cu(Zse,jC(e,"arrowComponent","beaconComponent","floatingOptions","loaderComponent","locale","styles","tooltipComponent"),t),r=cu(Jse,e.options??{},jC(t,...fie)),s=die(e,{...n,...r}),i=cu(Qse,e.floatingOptions??{},n.floatingOptions??{});return{...n,...r,locale:cu(iR,e.locale??{},n.locale||{}),floatingOptions:i,spotlightPadding:pie(r.spotlightPadding),styles:s}}function pie(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 hie(e,t,n){const{action:r}=t,s=n&&[Ft.PREV,Ft.NEXT].includes(r);return e.skipBeacon||e.placement==="center"||s}function cR(e,t=!1){return rs.plainObject(e)?e.target?!0:(Tr(t,"tour","target is missing from the step"),!1):(Tr(t,"tour","step must be an object"),!1)}function uR(e,t=!1){return rs.array(e)?e.every(n=>cR(n,t)):(Tr(t,"tour","steps must be an array"),!1)}var mie=class{constructor(e){sr(this,"beaconPosition",null);sr(this,"debug");sr(this,"eventListeners",new Map);sr(this,"listeners",new Set);sr(this,"props");sr(this,"snapshot");sr(this,"state");sr(this,"steps");sr(this,"tooltipPosition",null);sr(this,"cleanupPositionData",()=>{this.beaconPosition=null,this.tooltipPosition=null});sr(this,"getPositionData",e=>e==="beacon"?this.beaconPosition:this.tooltipPosition);sr(this,"getServerSnapshot",()=>this.snapshot);sr(this,"getSnapshot",()=>this.snapshot);sr(this,"getEventState",()=>Pg(this.snapshot,"positioned"));sr(this,"getState",()=>Pg(this.snapshot,"positioned"));sr(this,"setPositionData",(e,t)=>{var r,s,i;((r=e==="beacon"?this.beaconPosition:this.tooltipPosition)==null?void 0:r.placement)!==t.placement&&Tr(this.debug,`step:${this.state.index}`,"positioned",`${e} ${t.placement}`),e==="beacon"?this.beaconPosition=t:this.tooltipPosition=t,(this.state.lifecycle===Ye.BEACON_BEFORE||this.state.lifecycle===Ye.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)});sr(this,"setSteps",e=>{this.steps=e,this.updateState({size:e.length})});sr(this,"dispatch",(e,t)=>{const n=this.eventListeners.get(e.type);if(n)for(const r of n)try{r(e,t)}catch{}});sr(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)}});sr(this,"subscribe",e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}));sr(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,!z0(s,l)){this.snapshot=Object.freeze({...l});for(const c of this.listeners)c(this.snapshot)}});const{initialStepIndex:t,stepIndex:n,steps:r=[]}=e??{},s=rs.number(n);let i=0;this.debug=(e==null?void 0:e.debug)??!1,s?(i=n,rs.number(t)&&Tr(this.debug,"tour","initialStepIndex is ignored in controlled mode")):rs.number(t)&&(t>=0&&t<r.length?i=t:r.length>0&&Tr(this.debug,"tour","initialStepIndex is out of bounds")),this.props=e??{steps:[]},this.steps=r,this.state={action:Ft.INIT,controlled:s,index:i,lifecycle:Ye.INIT,origin:null,positioned:!1,scrolling:!1,size:r.length,status:r.length?Rt.READY:Rt.IDLE,waiting:!1},this.snapshot=Object.freeze({...this.state})}applyTransitions(e){return e.status===Rt.WAITING&&e.size>0?{...e,status:Rt.RUNNING}:e}getStep(e){return J0(this.props,this.steps[e??this.state.index])}};function gie(e){return new mie(e)}function AC(e,t){return Math.min(Math.max(e,0),t)}function yie(e,t,n){const r=h.useRef(t),s=h.useRef(n);return r.current=t,s.current=n,h.useMemo(()=>{const i=()=>e.current.getSnapshot();return{close:(k=null)=>{const{index:g,status:v}=i();v===Rt.RUNNING&&e.current.updateState({action:Ft.CLOSE,index:g+1,origin:k,lifecycle:Ye.COMPLETE,positioned:!1,scrolling:!1,waiting:!1})},go:k=>{const{controlled:g,size:v,status:x}=i();if(g){Tr(r.current,"tour","go() is not supported in controlled mode");return}x===Rt.RUNNING&&e.current.updateState({action:Ft.GO,index:k,lifecycle:Ye.COMPLETE,positioned:!1,scrolling:!1,status:k<v?x:Rt.FINISHED,waiting:!1})},info:()=>Pg(e.current.getSnapshot(),"positioned"),next:k=>{const{index:g,size:v,status:x}=i();x===Rt.RUNNING&&e.current.updateState({action:Ft.NEXT,index:AC(g+1,v),lifecycle:Ye.COMPLETE,origin:k,positioned:!1,scrolling:!1,waiting:!1})},open:()=>{const{status:k}=i();k===Rt.RUNNING&&e.current.updateState({action:Ft.UPDATE,lifecycle:Ye.TOOLTIP_BEFORE,positioned:!1,scrolling:!1,waiting:!1})},prev:k=>{const{index:g,size:v,status:x}=i();x===Rt.RUNNING&&e.current.updateState({action:Ft.PREV,index:AC(g-1,v),lifecycle:Ye.COMPLETE,origin:k,positioned:!1,scrolling:!1,waiting:!1})},reset:(k=!1)=>{const{controlled:g}=i();if(g){Tr(r.current,"tour","reset() is not supported in controlled mode");return}s.current(),e.current.updateState({action:Ft.RESET,index:0,lifecycle:Ye.INIT,positioned:!1,scrolling:!1,status:k?Rt.RUNNING:Rt.READY,waiting:!1})},skip:k=>{const{status:g}=i();g===Rt.RUNNING&&e.current.updateState({action:Ft.SKIP,lifecycle:Ye.COMPLETE,origin:k,positioned:!1,scrolling:!1,status:Rt.SKIPPED,waiting:!1})},start:k=>{const{index:g,size:v}=i();s.current(),e.current.updateState({action:Ft.START,index:rs.number(k)?k:g,lifecycle:Ye.INIT,positioned:!1,scrolling:!1,status:v?Rt.RUNNING:Rt.WAITING,waiting:!1},!0)},stop:(k=!1)=>{const{index:g,status:v}=i();[Rt.FINISHED,Rt.SKIPPED].includes(v)||e.current.updateState({action:Ft.STOP,index:g+(k?1:0),lifecycle:Ye.COMPLETE,positioned:!1,scrolling:!1,status:Rt.PAUSED,waiting:!1})}}},[e])}const xie=new Set(["origin","positioned"]);function wie(e,t){const n=h.useRef(null);h.useEffect(()=>{if(!t)return;const r=e.current.getSnapshot();return Tr(!0,"tour","init",r),n.current=r,e.current.subscribe(s=>{const i=n.current;if(n.current=s,!i)return;const a={};let l=!1;for(const c of Object.keys(s))s[c]!==i[c]&&!xie.has(c)&&(a[c]={from:i[c],to:s[c]},(c==="status"||c==="size")&&(l=!0));Object.keys(a).length&&(!l&&s.index>=s.size||Tr(!0,l?"tour":`step:${s.index}`,"state",a))})},[t,e])}function bie(e,t,n){const r=h.useRef(e),s=h.useRef(t);return r.current=e,s.current=t,h.useCallback((i,a,l)=>{var d;const c={...n.current.getEventState(),error:null,scroll:null,step:a,type:i,...l};(d=r.current)==null||d.call(r,c,s.current),n.current.dispatch(c,s.current)},[n])}function Ha(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 vie(e){const{addFailure:t,controls:n,emitEvent:r,previousState:s,props:i,state:a,step:l,store:c}=e,{action:d,index:f,lifecycle:u,positioned:p,scrolling:m,size:y,status:b}=a,k=D2(l)??null,g=h.useRef(null),v=h.useRef(i),x=h.useRef(a),N=h.useRef(s),_=h.useRef(l),C=h.useRef(k),T=h.useRef(n),H=h.useRef(null),M=h.useRef(null),F=h.useRef(null);v.current=i,x.current=a,N.current=s,_.current=l,C.current=k,T.current=n;const D=()=>{H.current&&(clearInterval(H.current),H.current=null),M.current=null,F.current&&(F.current.cancel(),F.current=null)};h.useEffect(()=>{if(!N.current)return;const{hasChangedTo:$}=Ha(x.current,N.current);($("action",[Ft.NEXT,Ft.PREV,Ft.SKIP,Ft.CLOSE])||g.current===Ft.CLOSE&&d===Ft.START)&&(g.current=d)},[d]),h.useEffect(()=>{if(!N.current)return()=>{D()};const{hasChanged:$}=Ha(x.current,N.current),W=_.current;if($("index")&&D(),b!==Rt.RUNNING||!W||u!==Ye.INIT)return()=>{D()};const{hasChangedTo:O}=Ha(x.current,N.current);O("status",Rt.RUNNING)&&[Rt.IDLE,Rt.READY,Rt.PAUSED].includes(N.current.status)&&r(Ar.TOUR_START,W),c.current.cleanupPositionData();const{debug:R}=v.current;if(W.before&&!F.current){Tr(R,`step:${f}`,"before()",W),F.current={cancel:()=>{}},c.current.updateState({waiting:!0}),r(Ar.STEP_BEFORE_HOOK,W,{action:g.current??x.current.action});const I=()=>{F.current=null,c.current.updateState({action:g.current??x.current.action,waiting:!1,lifecycle:Ye.READY})},z=new AbortController,P=W.beforeTimeout;F.current={cancel:()=>z.abort()};const L=P?setTimeout(()=>{z.signal.aborted||(Tr(R,`step:${f}`,"before()","timed out",`${P}ms`),z.abort(),t(W,"before_hook"),r(Ar.ERROR,W,{error:new Error("Step before hook timed out")}),I())},P):null;W.before({...c.current.getState(),action:g.current??c.current.getState().action,step:W}).then(()=>{z.signal.aborted||(L&&clearTimeout(L),I())}).catch(E=>{z.signal.aborted||(L&&clearTimeout(L),t(W,"before_hook"),r(Ar.ERROR,W,{error:E instanceof Error?E:new Error(String(E))}),I())})}else if(!F.current){H.current&&M.current!==W.target&&D();const I=ji(W.target);if(I&&Yh(I))D(),c.current.updateState({action:g.current??Ft.UPDATE,lifecycle:Ye.READY,waiting:!1});else if(W.targetWaitTimeout===0)c.current.updateState({action:g.current??Ft.UPDATE,lifecycle:Ye.READY,waiting:!1});else if(!H.current){const{targetWaitTimeout:z}=W,P=Date.now();M.current=W.target,Tr(R,`step:${f}`,"polling","started",`${z}ms`),c.current.updateState({waiting:!0}),H.current=setInterval(()=>{const L=ji(W.target),E=Date.now()-P,X=E>=z;(L&&Yh(L)||X)&&(Tr(R,`step:${f}`,"polling",L&&Yh(L)?"found":"timed out",`${E}ms`),D(),c.current.updateState({action:g.current??Ft.UPDATE,lifecycle:Ye.READY,waiting:!1}))},100)}}return()=>{D()}},[t,r,f,u,b,c]),h.useEffect(()=>{if(!N.current)return;const{hasChanged:$,hasChangedTo:W,previous:O}=Ha(x.current,N.current),R=_.current;if(!R)return;const I=ji(R.target),z=!!I;if(z&&Yh(I)){if(W("lifecycle",Ye.READY)&&O.lifecycle===Ye.INIT&&r(Ar.STEP_BEFORE,R,{action:g.current??x.current.action}),W("lifecycle",Ye.READY)){const P=x.current,L=hie(R,P,v.current.continuous)?Ye.TOOLTIP:Ye.BEACON,E=ji(R.scrollTarget??R.spotlightTarget??R.target),X=_C({isFirstStep:P.index===0,scrollToFirstStep:v.current.scrollToFirstStep,step:R,target:E,targetLifecycle:L}),ee=L===Ye.TOOLTIP?Ye.TOOLTIP_BEFORE:Ye.BEACON_BEFORE;Tr(v.current.debug,`step:${f}`,"scroll",X?"needed":"skipped"),c.current.updateState({action:Ft.UPDATE,lifecycle:ee,scrolling:X})}}else if(x.current.status===Rt.RUNNING&&u!==Ye.INIT&&u!==Ye.COMPLETE&&$("lifecycle")){Tr(v.current.debug,`step:${f}`,z?"Target not visible":"Target not mounted",R),t(R,"target_not_found"),r(Ar.TARGET_NOT_FOUND,R);const P=x.current;P.controlled||c.current.updateState({action:Ft.UPDATE,index:P.index+(P.action===Ft.PREV?-1:1),lifecycle:Ye.INIT})}},[t,r,f,u,c]),h.useEffect(()=>{if(!N.current)return;const{hasChangedTo:$,previous:W}=Ha(x.current,N.current),O=_.current,R=C.current;if(O&&$("lifecycle",Ye.TOOLTIP_BEFORE)&&W.lifecycle===Ye.BEACON){const P=ji(O.scrollTarget??O.spotlightTarget??O.target);if(_C({isFirstStep:x.current.index===0,scrollToFirstStep:v.current.scrollToFirstStep,step:O,target:P,targetLifecycle:Ye.TOOLTIP})){c.current.updateState({scrolling:!0,positioned:!1});return}}const I=u===Ye.BEACON_BEFORE||u===Ye.TOOLTIP_BEFORE;if(O&&I&&!m){const P=u===Ye.TOOLTIP_BEFORE?Ye.TOOLTIP:Ye.BEACON;c.current.updateState({action:Ft.UPDATE,lifecycle:P})}O&&$("lifecycle",Ye.BEACON)&&r(Ar.BEACON,O),O&&$("lifecycle",Ye.TOOLTIP)&&r(Ar.TOOLTIP,O);const z=x.current;if((z.status===Rt.RUNNING||z.controlled&&z.status===Rt.PAUSED&&O)&&R&&$("lifecycle",Ye.COMPLETE)&&W.lifecycle===Ye.TOOLTIP&&(r(Ar.STEP_AFTER,R,{action:g.current??Ft.UPDATE,index:W.index??z.index,lifecycle:z.lifecycle}),R.after)){r(Ar.STEP_AFTER_HOOK,R,{action:g.current??Ft.UPDATE,index:W.index??z.index,lifecycle:z.lifecycle});try{R.after({...c.current.getState(),action:g.current??Ft.UPDATE,index:W.index??z.index,lifecycle:z.lifecycle,step:R})}catch{}}},[r,u,p,m,c]),h.useEffect(()=>{if(!N.current)return;const{hasChangedTo:$,previous:W}=Ha(x.current,N.current),O=_.current,R=C.current;y&&!O&&u===Ye.INIT&&c.current.updateState({action:Ft.UPDATE,lifecycle:Ye.COMPLETE,status:Rt.FINISHED}),!x.current.controlled&&b===Rt.RUNNING&&$("lifecycle",Ye.COMPLETE)&&f<y&&c.current.updateState({action:Ft.UPDATE,lifecycle:Ye.INIT}),$("lifecycle",Ye.COMPLETE)&&f>=y&&c.current.updateState({action:Ft.UPDATE,lifecycle:Ye.COMPLETE,status:Rt.FINISHED});const I=O??R??J0(v.current,v.current.steps[f-1]);if(I&&$("status",[Rt.FINISHED,Rt.SKIPPED])){let z;O?z=f:R?z=W.index??f:z=f-1,r(Ar.TOUR_END,I,{index:z}),x.current.controlled||T.current.reset(),g.current=null}O&&$("action",Ft.STOP)&&(g.current=null,r(Ar.TOUR_STATUS,O)),O&&$("action",Ft.RESET)&&(r(Ar.TOUR_STATUS,O),g.current=null)},[d,r,f,u,y,b,c])}function kie({controls:e,emitEvent:t,props:n,state:r,store:s}){const{debug:i,initialStepIndex:a,run:l,stepIndex:c,steps:d}=n,f=h.useRef(void 0),u=h.useRef(r),p=h.useRef(e);u.current=r,p.current=e,h.useEffect(()=>{const m=f.current;if(f.current=n,!m||n===m)return;const{hasChanged:y}=Ha(n,m);if(z0(m.steps,d)||(uR(d,i)?s.current.setSteps(d):(Tr(i,"tour","Steps are not valid",d),t(Ar.ERROR,d[0]??{target:"",content:""},{error:new Error("Steps are not valid")}))),y("run"))l?s.current.getState().size&&p.current.start(c??a):p.current.stop();else if(rs.number(c)&&y("stepIndex")){const b=rs.number(m.stepIndex)&&m.stepIndex<c?Ft.NEXT:Ft.PREV;[Rt.FINISHED,Rt.SKIPPED].includes(u.current.status)||s.current.updateState({action:b,index:c,lifecycle:Ye.INIT,positioned:!1},!0)}},[i,t,a,n,l,c,d,s])}function Sie(e,t){var l,c,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===Ye.BEACON_BEFORE&&(n!=null&&n.placement)){const u=Nie(n);["bottom"].includes(n.placement)||(a+=Math.floor(u-s))}else if(r===Ye.TOOLTIP_BEFORE){const{placement:u}=i;if(u==="top"){const p=((l=document.querySelector(".react-joyride__floater"))==null?void 0:l.getBoundingClientRect().height)??0,m=(c=i.floatingOptions)!=null&&c.hideArrow?0:i.arrowSize,y=i.offset+i.spotlightPadding.top+m;a-=p+y}else if(u==="left"||u==="right"){const p=((d=document.querySelector(".react-joyride__floater"))==null?void 0:d.getBoundingClientRect().height)??0,m=((f=ji(i.target))==null?void 0:f.getBoundingClientRect().height)??0,y=s+i.spotlightPadding.top+m/2-p/2;y<s&&(a-=s-y)}}return Math.max(0,a)}function Nie(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 jie({emitEvent:e,previousState:t,props:n,state:r,step:s,store:i}){const{index:a,lifecycle:l,positioned:c,scrolling:d,status:f}=r,u=h.useRef(null),p=h.useRef(r),m=h.useRef(t),y=h.useRef(n),b=h.useRef(s);p.current=r,m.current=t,y.current=n,b.current=s,h.useEffect(()=>()=>{var k;(k=u.current)==null||k.call(u)},[]),h.useEffect(()=>{var _;if(!m.current||!b.current)return;const{hasChangedTo:k}=Ha(p.current,m.current),g=b.current,{debug:v}=y.current,{scrollDuration:x}=g,N=l===Ye.BEACON_BEFORE||l===Ye.TOOLTIP_BEFORE;if(f===Rt.RUNNING&&N&&d&&k("positioned",!0)){const C=ji(g.scrollTarget??g.spotlightTarget??g.target),T=i.current.getPositionData("beacon"),H=ed(C),M=H?!H.isSameNode(Rs()):!1;(_=u.current)==null||_.call(u),(async()=>{if(M&&!td(H)){const z=Rs(),P=aie(H),L={initial:z.scrollTop,target:P,element:z,duration:x};e(Ar.SCROLL_START,g,{scroll:L});const{cancel:E,promise:X}=PC(P,{element:z,duration:x});u.current=E,await X,e(Ar.SCROLL_END,g,{scroll:L})}const D=Math.floor(lie(C,g.scrollOffset))||0,$=M?D:Sie(D,{beaconPosition:T,lifecycle:l,scrollOffset:g.scrollOffset,step:g});Tr(v,`step:${a}`,"scroll",M?"custom":"document",`${D} → ${$}`);const W=H,O={initial:W.scrollTop,target:$,element:W,duration:x};e(Ar.SCROLL_START,g,{scroll:O});const{cancel:R,promise:I}=PC($,{element:W,duration:x});u.current=R,await I,e(Ar.SCROLL_END,g,{scroll:O}),i.current.updateState({scrolling:!1})})().catch(()=>{i.current.updateState({scrolling:!1})})}},[e,a,l,c,d,f,i])}function Cie(e){const t=lre(()=>rie(eie,e),[e]),{debug:n,initialStepIndex:r,onEvent:s,run:i,stepIndex:a,steps:l}=t,c=h.useRef(gie(t)),d=jA.useSyncExternalStore(c.current.subscribe,c.current.getSnapshot,c.current.getServerSnapshot),[f,u]=h.useState([]),p=h.useCallback((_,C)=>{u(T=>[...T,{reason:C,step:_}])},[]),m=h.useCallback(()=>{u([])},[]);wie(c,n);const y=yie(c,n,m),b=bie(s,y,c),{index:k,size:g,status:v}=d,x=D2(d),N=h.useMemo(()=>J0(t,l[k]),[k,t,l]);return cre(()=>{i&&g&&uR(l,n)&&y.start(a??r)}),are(()=>{i&&g&&v===Rt.IDLE&&c.current.updateState({status:Rt.READY})},[i,g,v]),kie({controls:y,emitEvent:b,props:t,state:d,store:c}),vie({addFailure:p,controls:y,emitEvent:b,previousState:x,props:t,state:d,step:N,store:c}),jie({emitEvent:b,previousState:x,props:t,state:d,step:N,store:c}),{controls:y,failures:f,mergedProps:t,state:d,step:N,store:c}}function Eie(e){const[t,n]=h.useState(null);return h.useEffect(()=>{let r=null,s=!1;if(e)if(rs.domElement(e))r=e,s=!0;else{const i=document.querySelector(e);i&&(r=i)}else{const i=document.createElement("div");i.id=tie,document.body.appendChild(i),r=i}return n(r),()=>{!r||s||r.parentNode===document.body&&document.body.removeChild(r)}},[e]),t}const _ie={animation:"joyride-loader-spin 1s linear infinite",border:"5px solid rgba(0, 0, 0, 0.1)",borderRadius:"50%",borderTopColor:"#555"};function Pie({nonce:e,step:t}){const{loaderComponent:n}=t,r=!!n;if(h.useEffect(()=>{if(r||document.getElementById("joyride-loader-animation"))return op;const c=document.createElement("style");return c.id="joyride-loader-animation",e&&c.setAttribute("nonce",e),c.appendChild(document.createTextNode(`
|
|
235
|
+
@keyframes joyride-loader-spin {
|
|
236
|
+
to { transform: rotate(360deg); }
|
|
237
|
+
}
|
|
238
|
+
`)),document.head.appendChild(c),()=>{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 c=n;l=ct.createElement(c,{step:t})}else l=ct.createElement("div",{style:{..._ie,height:s,width:i,borderTopColor:t.primaryColor}});return ct.createElement("div",{className:"react-joyride__loader","data-testid":"loader",style:a},l)}const Aie={height:0,isFixed:!1,left:0,top:0,width:0};function Wd(e,t){const n=ji(e);if(!n)return Aie;const r=X0(n),s=td(n),i=oie(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 Iie(e,t,n){const[r,s]=h.useState(()=>Wd(e,t)),i=h.useRef(void 0),a=h.useRef(null),l=h.useRef(n),c=h.useRef(null),d=h.useCallback(()=>{clearTimeout(i.current),i.current=window.setTimeout(()=>{s(u=>{const p=Wd(e,t);return u.top===p.top&&u.left===p.left&&u.width===p.width&&u.height===p.height&&u.isFixed===p.isFixed?u:p})},100)},[e,t]);h.useEffect(()=>{let u=null;const p=y=>{a.current=ed(y,!0),a.current&&a.current.addEventListener("scroll",d,{passive:!0}),window.addEventListener("scroll",d,{passive:!0}),window.addEventListener("resize",d),typeof ResizeObserver<"u"&&(c.current=new ResizeObserver(d),c.current.observe(y)),s(Wd(e,t))},m=ji(e);return m?p(m):(u=new MutationObserver(()=>{const y=ji(e);y&&(u==null||u.disconnect(),u=null,p(y))}),u.observe(document.body,{childList:!0,subtree:!0})),()=>{var y;u==null||u.disconnect(),a.current&&a.current.removeEventListener("scroll",d),window.removeEventListener("scroll",d),window.removeEventListener("resize",d),(y=c.current)==null||y.disconnect(),clearTimeout(i.current)}},[e,t,d]),h.useEffect(()=>{l.current&&!n&&s(Wd(e,t)),l.current=n},[n,e,t]);let f=r;return l.current&&!n&&(f=Wd(e,t)),f}function Tie(e,t,n){let r=`M0 0H${e}V${t}H0Z`;return n&&(r+=` ${n}`),r}function IC(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 Rie=[Ye.BEACON_BEFORE,Ye.BEACON];function Lie(e){var I,z;const{blockTargetInteraction:t,continuous:n,hideOverlay:r,lifecycle:s,onClickOverlay:i,overlayClickAction:a,placement:l,portalElement:c,scrolling:d,spotlightPadding:f,spotlightRadius:u,spotlightTarget:p,styles:m,target:y,waiting:b}=e,k=ure(),g=Iie(p??y,f,d||b),v=h.useRef(null),x=(s===Ye.TOOLTIP||s===Ye.TOOLTIP_BEFORE)&&l!=="center",[N,_]=h.useState(!1),C=c?(I=v.current)==null?void 0:I.offsetParent:null,T=(C==null?void 0:C.clientWidth)??k.width,H=(C==null?void 0:C.clientHeight)??iie()??k.height,M=((z=m.overlay)==null?void 0:z.backgroundColor)??"rgba(0, 0, 0, 0.5)",F=h.useMemo(()=>{const{backgroundColor:P,mixBlendMode:L,...E}=m.overlay;return{height:H,pointerEvents:"none",...E}},[H,m.overlay]),D=x&&!d&&!b;h.useEffect(()=>{D?requestAnimationFrame(()=>_(!0)):_(!1)},[D]);const $=n&&Rie.includes(s),W=!n&&s!==Ye.TOOLTIP;if(r||!b&&($||W))return null;let O="";if(D)if(c&&C){const P=ji(p??y);if(P){const L=EC(P),E=EC(C);O=IC(L.left-E.left-f.left,L.top-E.top-f.top,P.offsetWidth+f.left+f.right,P.offsetHeight+f.top+f.bottom,u)}}else O=IC(g.left,g.top,g.width,g.height,u);const R=Tie(T,H,O);return ct.createElement("div",{ref:v,"aria-hidden":"true",className:"react-joyride__overlay","data-testid":"overlay",style:F},ct.createElement("svg",{className:"react-joyride__spotlight","data-testid":"spotlight",style:{height:H,left:0,position:g.isFixed?"fixed":"absolute",top:0,width:T}},ct.createElement("path",{d:R,fill:M,fillRule:"evenodd",onClick:i,style:{cursor:a?"pointer":"default",pointerEvents:"auto"}}),O&&ct.createElement("path",{d:O,fill:M,style:{opacity:N?0:1,pointerEvents:t?"auto":"none",transition:"opacity 0.2s"}}),O&&Object.keys(m.spotlight).length>0&&ct.createElement("path",{d:O,fill:"none",style:{pointerEvents:"none"},...m.spotlight})))}function dR(e){const{children:t,element:n}=e;return n?Fr.createPortal(t,n):null}const Mie='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), area[href], [tabindex]:not([tabindex="-1"]), [contenteditable]';function Oie(e,t){const n=h.useRef(null);h.useEffect(()=>{if(!e)return op;n.current=document.activeElement;const r=i=>{if(i.key!=="Tab")return;const a=[...e.querySelectorAll(Mie)],{shiftKey:l}=i;if(!a.length)return;i.preventDefault();let c=document.activeElement?a.indexOf(document.activeElement):0;c===-1||!l&&c+1===a.length?c=0:l&&c===0?c=a.length-1:c+=l?-1:1,a[c].focus()};e.addEventListener("keydown",r,!1);let s;{const i=e.querySelector(t);i&&(s=setTimeout(()=>{i.focus({preventScroll:!0})},100))}return()=>{var i;e.removeEventListener("keydown",r),s!==void 0&&clearTimeout(s),(i=n.current)==null||i.focus({preventScroll:!0})}},[e,t])}function ia(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 $ie(e,t,n){const[r]=e.split("-");switch(r){case"top":return{points:`0,0 ${t/2},${n} ${t},0`,...ia(e,t,n)};case"bottom":return{points:`${t},${n} ${t/2},0 0,${n}`,...ia(e,t,n)};case"left":return{points:`0,0 ${n},${t/2} 0,${t}`,...ia(e,t,n)};case"right":return{points:`${n},${t} ${n},0 0,${t/2}`,...ia(e,t,n)};default:return null}}function Die(e,t,n,r){if(!t)return{};const[s]=e.split("-");switch(s){case"top":return{bottom:-n,left:t.x??0,...ia(e,r,n)};case"bottom":return{top:-n,left:t.x??0,...ia(e,r,n)};case"left":return{right:-n,top:t.y??0,...ia(e,r,n)};case"right":return{left:-n,top:t.y??0,...ia(e,r,n)};default:return{}}}function Fie({arrowComponent:e,arrowRef:t,base:n,placement:r,position:s,size:i,styles:a}){const l=e;let c=null;if(l){if(!ia(r,n,i))return null;c=ct.createElement("span",{style:{flexShrink:0}},ct.createElement(l,{base:n,placement:r,size:i}))}else{const d=$ie(r,n,i);if(!d)return null;c=ct.createElement("svg",{height:d.height,width:d.width,xmlns:"http://www.w3.org/2000/svg"},ct.createElement("polygon",{fill:"currentColor",points:d.points}))}return ct.createElement("span",{ref:t,className:"react-joyride__arrow","data-testid":"arrow",style:{...a,...Die(r,s,i,n),...s?{}:{visibility:"hidden"}}},c)}function zie(e){const{beaconComponent:t,continuous:n,index:r,isLastStep:s,locale:i,nonce:a,onInteract:l,shouldFocus:c,size:d,step:f,styles:u}=e,p=h.useRef(null),m=!!t;h.useEffect(()=>{if(m||document.getElementById("joyride-beacon-animation"))return op;const k=document.createElement("style");k.id="joyride-beacon-animation",a&&k.setAttribute("nonce",a),k.appendChild(document.createTextNode(`
|
|
239
|
+
@keyframes joyride-beacon-inner {
|
|
240
|
+
20% {
|
|
241
|
+
opacity: 0.9;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
90% {
|
|
245
|
+
opacity: 0.7;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
@keyframes joyride-beacon-outer {
|
|
250
|
+
0% {
|
|
251
|
+
transform: scale(1);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
45% {
|
|
255
|
+
opacity: 0.7;
|
|
256
|
+
transform: scale(0.75);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
100% {
|
|
260
|
+
opacity: 0.9;
|
|
261
|
+
transform: scale(1);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
`)),document.head.appendChild(k);const g=setTimeout(()=>{rs.domElement(p.current)&&c&&p.current.focus()},0);return()=>{clearTimeout(g);const v=document.getElementById("joyride-beacon-animation");v!=null&&v.parentNode&&v.parentNode.removeChild(v)}},[m,a,c]);const y=ea(i.open);let b;if(t){const k=t;b=ct.createElement(k,{continuous:n,index:r,isLastStep:s,size:d,step:f})}else b=ct.createElement("span",{style:u.beacon},ct.createElement("span",{style:u.beaconOuter}),ct.createElement("span",{style:u.beaconInner}));return ct.createElement("button",{ref:p,"aria-label":y,className:"react-joyride__beacon","data-testid":"button-beacon",onClick:l,onMouseEnter:l,style:u.beaconWrapper,title:y,type:"button"},b)}function Hie({styles:e,...t}){const{color:n,height:r,width:s,...i}=e;return ct.createElement("button",{style:i,type:"button",...t},ct.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"},ct.createElement("g",null,ct.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 Bie(e){const{backProps:t,closeProps:n,index:r,isLastStep:s,primaryProps:i,skipProps:a,step:l,tooltipProps:c}=e,{buttons:d,content:f,styles:u,title:p}=l,m={};d.includes("primary")&&(m.primary=ct.createElement("button",{"data-testid":"button-primary",style:u.buttonPrimary,type:"button",...i})),d.includes("skip")&&!s&&(m.skip=ct.createElement("button",{"aria-live":"off","data-testid":"button-skip",style:u.buttonSkip,type:"button",...a})),d.includes("back")&&r>0&&(m.back=ct.createElement("button",{"data-testid":"button-back",style:u.buttonBack,type:"button",...t})),m.close=d.includes("close")&&ct.createElement(Hie,{"data-testid":"button-close",styles:u.buttonClose,...n});const y=p?{"aria-labelledby":"joyride-tooltip-title","aria-describedby":"joyride-tooltip-content"}:{"aria-label":ea(f),"aria-describedby":"joyride-tooltip-content"};return ct.createElement("div",{key:"JoyrideTooltip",className:"react-joyride__tooltip","data-joyride-step":r,...l.id&&{"data-joyride-id":l.id},style:u.tooltip,...c,...y},ct.createElement("div",{style:u.tooltipContainer},p&&ct.createElement("h4",{id:"joyride-tooltip-title",style:u.tooltipTitle},p),ct.createElement("div",{id:"joyride-tooltip-content",style:u.tooltipContent},f)),d.some(b=>b==="back"||b==="primary"||b==="skip")&&ct.createElement("div",{style:u.tooltipFooter},ct.createElement("div",{style:u.tooltipFooterSpacer},m.skip),m.back,m.primary),m.close)}function Wie(e){const{continuous:t,controls:n,index:r,isLastStep:s,size:i,step:a}=e,l=g=>{g.preventDefault(),n.prev(bo.BUTTON_BACK)},c=g=>{g.preventDefault(),a.closeButtonAction==="skip"?n.skip(bo.BUTTON_CLOSE):n.close(bo.BUTTON_CLOSE)},d=g=>{if(g.preventDefault(),!t){n.close(bo.BUTTON_PRIMARY);return}n.next(bo.BUTTON_PRIMARY)},f=g=>{g.preventDefault(),n.skip(bo.BUTTON_SKIP)},u=()=>{const{back:g,close:v,last:x,next:N,nextWithProgress:_,skip:C}=a.locale,T=ea(g),H=ea(v),M=ea(x),F=ea(N),D=ea(C);let $=v,W=H;if(t){if($=N,W=F,a.showProgress&&!s){const O=ea(_,{step:r+1,steps:i});$=Gb(_,r+1,i),W=O}s&&($=x,W=M)}return{backProps:{"aria-label":T,children:g,"data-action":"back",onClick:l,role:"button",title:T},closeProps:{"aria-label":H,children:v,"data-action":"close",onClick:c,role:"button",title:H},primaryProps:{"aria-label":W,children:$,"data-action":"primary",onClick:d,role:"button",title:W},skipProps:{"aria-label":D,children:C,"data-action":"skip",onClick:f,role:"button",title:D},tooltipProps:{"aria-modal":!0,role:"alertdialog"}}},{arrowComponent:p,beaconComponent:m,tooltipComponent:y,...b}=a;let k;if(y){const g=y;k=ct.createElement(g,{...u(),continuous:t,controls:n,index:r,isLastStep:s,size:i,step:b})}else k=ct.createElement(Bie,{...u(),continuous:t,controls:n,index:r,isLastStep:s,size:i,step:b});return k}function Vie(e){if(e.startsWith("left"))return["top","bottom"];if(e.startsWith("right"))return["bottom","top"]}function Uie(e,t,n){var r,s;return e?[Gse()]:((r=t.floatingOptions)==null?void 0:r.flipOptions)===!1?[]:[Yse({crossAxis:!1,fallbackPlacements:Vie(n),padding:20,...(s=t.floatingOptions)==null?void 0:s.flipOptions})]}function Kie(e){var L,E,X,ee,V;const{continuous:t,controls:n,index:r,lifecycle:s,nonce:i,open:a,portalElement:l,setPositionData:c,setTooltipRef:d,shouldScroll:f,size:u,step:p,target:m,updateState:y}=e,b=h.useRef(null),k=h.useRef({}),g=h.useRef({}),v=p.placement==="center",x=p.placement==="auto",N=h.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})}),[]),_=h.useMemo(()=>aR(m)?ed(m):void 0,[m]),C=h.useMemo(()=>td(m),[m]),T=h.useMemo(()=>_?{boundary:_,rootBoundary:"viewport"}:{},[_]),H=v||x?"bottom":p.placement,M=v?"fixed":((L=p.floatingOptions)==null?void 0:L.strategy)??(p.isFixed||C?"fixed":"absolute"),F=h.useMemo(()=>{var ie,fe,me,ge;return v?[{name:"center",fn:({rects:Z})=>({x:(window.innerWidth-Z.floating.width)/2,y:(window.innerHeight-Z.floating.height)/2})}]:[NC(({placement:Z})=>{var pe;let ae="right";Z.startsWith("top")?ae="top":Z.startsWith("bottom")?ae="bottom":Z.startsWith("left")&&(ae="left");const xe=p.spotlightTarget?0:p.spotlightPadding[ae];return p.offset+xe+((pe=p.floatingOptions)!=null&&pe.hideArrow?0:p.arrowSize)},[p.offset,p.spotlightPadding,p.spotlightTarget,p.arrowSize,(ie=p.floatingOptions)==null?void 0:ie.hideArrow]),...Uie(x,p,H),qse({padding:10,...T,...(fe=p.floatingOptions)==null?void 0:fe.shiftOptions}),...(me=p.floatingOptions)!=null&&me.hideArrow?[]:[Xse({element:b,padding:p.arrowSpacing},[p.arrowSpacing,p.arrowBase])],...((ge=p.floatingOptions)==null?void 0:ge.middleware)??[]]},[v,p,x,H,T]),D=SC({...v?{elements:{reference:N}}:{},placement:H,strategy:M,middleware:F}),$=SC({strategy:M,placement:p.beaconPlacement??(x||v?"bottom":p.placement),middleware:h.useMemo(()=>{var ie,fe;return[NC(((fe=(ie=p.floatingOptions)==null?void 0:ie.beaconOptions)==null?void 0:fe.offset)??-18)]},[(X=(E=p.floatingOptions)==null?void 0:E.beaconOptions)==null?void 0:X.offset]),whileElementsMounted:bC});g.current=D.middlewareData,k.current=$.middlewareData,h.useEffect(()=>{var me;const{floating:ie,reference:fe}=D.elements;if(!(!fe||!ie||s!==Ye.TOOLTIP))return bC(fe,ie,D.update,(me=p.floatingOptions)==null?void 0:me.autoUpdate)},[s,D.update,(ee=p.floatingOptions)==null?void 0:ee.autoUpdate,p.target,D.elements]),h.useEffect(()=>{!v&&m&&D.refs.setReference(m),m&&$.refs.setReference(m)},[$.refs,v,m,D.refs]),h.useEffect(()=>{D.isPositioned&&c("tooltip",{placement:D.placement,x:D.x??0,y:D.y??0,middlewareData:g.current})},[c,D.isPositioned,D.placement,D.x,D.y]),h.useEffect(()=>{$.isPositioned&&c("beacon",{placement:$.placement,x:$.x??0,y:$.y??0,middlewareData:k.current})},[c,$.isPositioned,$.placement,$.x,$.y]);const W=p.zIndex+100,O=h.useCallback(ie=>{ie.type==="mouseenter"&&p.beaconTrigger!=="hover"||y({lifecycle:Ye.TOOLTIP_BEFORE,positioned:!1})},[p.beaconTrigger,y]),R=h.useCallback(ie=>{ie&&(D.refs.setFloating(ie),d(ie))},[D.refs,d]),{arrow:I,floater:z}=p.styles;let P=null;if(s===Ye.TOOLTIP||s===Ye.TOOLTIP_BEFORE){const ie=CC({...z,...D.floatingStyles,zIndex:W,opacity:a&&D.isPositioned?1:0,...!a&&{transition:"none"}});P=ct.createElement("div",{ref:R,className:"react-joyride__floater","data-testid":"floater",id:`react-joyride-step-${r}`,style:ie},ct.createElement(Wie,{continuous:t,controls:n,index:r,isLastStep:r+1===u,size:u,step:p}),!v&&!((V=p.floatingOptions)!=null&&V.hideArrow)&&ct.createElement(Fie,{arrowComponent:p.arrowComponent,arrowRef:b,base:p.arrowBase,placement:D.placement,position:D.middlewareData.arrow,size:p.arrowSize,styles:I}))}else(s===Ye.BEACON||s===Ye.BEACON_BEFORE)&&(P=ct.createElement("div",{ref:$.refs.setFloating,className:"react-joyride__floater","data-testid":"floater-beacon",id:`react-joyride-step-${r}-beacon`,style:CC({...$.floatingStyles,zIndex:W})},ct.createElement(zie,{beaconComponent:p.beaconComponent,continuous:t,index:r,isLastStep:r+1===u,locale:p.locale,nonce:i,onInteract:O,shouldFocus:f,size:u,step:p,styles:p.styles})));return ct.createElement(dR,{element:l},P)}function qie(e){const{continuous:t,controls:n,index:r,lifecycle:s,nonce:i,portalElement:a,setPositionData:l,shouldScroll:c,size:d,step:f,updateState:u}=e,[p,m]=h.useState(null);Oie(f.disableFocusTrap?null:p,"[data-action=primary]");const y=ji(f.target),b=s===Ye.TOOLTIP;return!cR(f)||!rs.domElement(y)?null:ct.createElement(Kie,{key:`JoyrideStep-${r}`,continuous:t,controls:n,index:r,lifecycle:s,nonce:i,open:b,portalElement:a,setPositionData:l,setTooltipRef:m,shouldScroll:c,size:d,step:f,target:y,updateState:u})}function Yie({controls:e,mergedProps:t,state:n,step:r,store:s}){const{continuous:i,debug:a,nonce:l,portalElement:c,scrollToFirstStep:d}=t,f=Eie(c),{index:u,lifecycle:p,status:m}=n,y=m===Rt.RUNNING,[b,k]=h.useState(!1),g=h.useRef(null),v=(r==null?void 0:r.loaderDelay)??0;h.useEffect(()=>(n.waiting?v===0?k(!0):g.current=setTimeout(()=>{k(!0)},v):k(!1),()=>{g.current&&(clearTimeout(g.current),g.current=null)}),[v,n.waiting]),h.useEffect(()=>{if(!y)return;const _=C=>{!r||p!==Ye.TOOLTIP||C.key==="Escape"&&r.dismissKeyAction&&(r.dismissKeyAction==="next"?e.next(bo.KEYBOARD):e.close(bo.KEYBOARD))};return document.body.addEventListener("keydown",_,{passive:!0}),()=>{document.body.removeEventListener("keydown",_)}},[e,y,p,r]);const x=h.useCallback(()=>{(r==null?void 0:r.overlayClickAction)==="close"?e.close(bo.OVERLAY):(r==null?void 0:r.overlayClickAction)==="next"&&e.next(bo.OVERLAY)},[e,r==null?void 0:r.overlayClickAction]);if(!r||!y)return null;const N=n.action===Ft.START&&!r.skipBeacon&&r.placement!=="center";return ct.createElement(ct.Fragment,null,p!==Ye.INIT&&ct.createElement(qie,{...n,continuous:i,controls:e,debug:a,nonce:l,portalElement:f,setPositionData:s.current.setPositionData,shouldScroll:!r.skipScroll&&(u!==0||d),step:r,updateState:s.current.updateState}),ct.createElement(dR,{element:f},ct.createElement(ct.Fragment,null,b&&ct.createElement(Pie,{nonce:l,step:r}),!N&&ct.createElement(Lie,{...r,continuous:i,lifecycle:p,onClickOverlay:x,portalElement:c?f:null,scrolling:n.scrolling,waiting:n.waiting}))))}function Gie(e){const{controls:t,failures:n,mergedProps:r,state:s,step:i,store:a}=Cie(e);return{controls:t,failures:n,on:h.useCallback((l,c)=>a.current.on(l,c),[a]),state:h.useMemo(()=>Pg(s,"positioned"),[s]),step:i,Tour:G0()?ct.createElement(Yie,{controls:t,mergedProps:r,state:s,step:i,store:a}):null}}function Xie(e){const{Tour:t}=Gie(e);return t}function Jie(e){return G0()?ct.createElement(Xie,e):null}function Qie(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 Zie(e){return[{target:"body",content:e("onboarding:flow.intro"),disableBeacon:!0,placement:"center"}]}function eoe(e){return[{target:"body",content:e("onboarding:flow.introEmpty"),disableBeacon:!0,placement:"center"}]}const Qx="af:onboarding";function toe({page:e,hasNodes:t=!1}){const{t:n}=Mn(),[r,s]=h.useState(!1),[i,a]=h.useState([]),l=h.useRef(null),c=h.useMemo(()=>e==="projects"?Qie(n):t?Zie(n):eoe(n),[e,t,n]);return h.useEffect(()=>{const d=localStorage.getItem(Qx);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:",c),a(c),s(!0)},[e,t,c]),h.useEffect(()=>{if(!r)return;const d=f=>{var y;const u=f.target.closest("button");if(!u||!u.closest(".react-joyride__tooltip"))return;const m=(y=u.textContent)==null?void 0:y.trim();if(m===n("onboarding:done")||m===n("onboarding:startCreate")||m===n("onboarding:skip")){const b=localStorage.getItem(Qx)||"{}",k=JSON.parse(b);m===n("onboarding:skip")?(k.projects=!0,k.flow=!0,k.completed=!0):k[e]=!0,localStorage.setItem(Qx,JSON.stringify(k)),a([]),s(!1),e==="projects"&&(m===n("onboarding:done")||m===n("onboarding:startCreate"))&&(localStorage.setItem("af:newPipelineGuide","true"),setTimeout(()=>{const g=document.querySelector(".af-create-btn");g&&g.click()},500))}};return document.addEventListener("click",d,!0),()=>document.removeEventListener("click",d,!0)},[r,e,n]),!r||i.length===0?null:o.jsx(Jie,{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 noe(){const{navigate:e,path:t}=Ro(),[n,r]=h.useState([]),[s,i]=h.useState(!1);if(h.useEffect(()=>{let f=!1;const u=async()=>{try{const m=await fetch("/api/pipeline-recent-runs");if(!m.ok)return;const y=await m.json();if(f)return;const b=Array.isArray(y.runs)?y.runs:[];r(b.filter(k=>k&&k.status==="running"))}catch{}};u();const p=window.setInterval(u,3e3);return()=>{f=!0,window.clearInterval(p)}},[]),n.length===0)return null;const a=f=>{const u=new URLSearchParams({flowId:f.flowId,flowSource:f.flowSource||"workspace"});e(`/flow?${u.toString()}`),i(!1)},l=t==="/flow"?new URLSearchParams(window.location.search):null,c=(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===c?" af-run-indicator__item--current":""),onClick:()=>a(f),title:`${f.flowId} · ${f.runId}`,children:[o.jsx("span",{className:"af-run-indicator__dot"}),o.jsx("span",{className:"af-run-indicator__flow",children:f.flowId}),o.jsx("span",{className:"af-run-indicator__run",children:f.runId.slice(0,12)})]},`${f.flowId}:${f.runId}`))}),o.jsxs("button",{type:"button",className:"af-run-indicator__btn",onClick:()=>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`})]})]})}function fR(e){return e==="/likee-context"||e==="/likee_context"}class roe extends h.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 soe({authUser:e}){const{path:t}=Ro();return t==="/projects"||t==="/"?o.jsx(Oc,{authUser:e}):t==="/nodes"?o.jsx(Oc,{authUser:e,resourceKind:"nodes"}):t==="/my-nodes"?o.jsx(Oc,{authUser:e,resourceKind:"my-nodes"}):t==="/my-flows"?o.jsx(Oc,{authUser:e,resourceKind:"my-flows"}):t==="/skills"?o.jsx(Oc,{authUser:e,resourceKind:"skills"}):t==="/mcps"?o.jsx(Fne,{}):t==="/flow"?o.jsx(F7,{}):t==="/workspace"?o.jsx(gY,{}):t.startsWith("/display")?o.jsx(E2,{}):t==="/settings"?o.jsx(One,{authUser:e}):t==="/feedback"?o.jsx($ne,{}):fR(t)?o.jsx(O2,{}):o.jsx(Oc,{})}function ioe({children:e}){const[t,n]=h.useState({loading:!0,authenticated:!1,user:null,setupRequired:!1}),[r,s]=h.useState(""),[i,a]=h.useState(""),[l,c]=h.useState(!1),[d,f]=h.useState(""),u=async()=>{try{const y=await(await fetch("/api/auth/me")).json().catch(()=>({}));n({loading:!1,authenticated:!!y.authenticated,user:y.user||null,setupRequired:!!y.setupRequired}),f(y.error?String(y.error):"")}catch(m){n({loading:!1,authenticated:!1,user:null,setupRequired:!1}),f(String(m.message||m))}};h.useEffect(()=>{u()},[]);const p=async m=>{m.preventDefault(),c(!0),f("");try{const y=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:r,password:i})}),b=await y.json().catch(()=>({}));if(!y.ok)throw new Error(b.error||"登录失败");n({loading:!1,authenticated:!0,user:b.user||null,setupRequired:!1})}catch(y){f(String(y.message||y))}finally{c(!1)}};return t.loading?o.jsx("div",{className:"af-auth-screen",children:o.jsx("div",{className:"af-auth-panel",children:"Loading..."})}):t.authenticated?e({user:t.user,onLogout:async()=>{await fetch("/api/auth/logout",{method:"POST"}).catch(()=>{}),n({loading:!1,authenticated:!1,user:null,setupRequired:!1})}}):o.jsx("div",{className:"af-auth-screen",children:o.jsxs("form",{className:"af-auth-panel",onSubmit: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:m=>s(m.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:m=>a(m.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 ooe({authUser:e,onLogout:t}){const{path:n}=Ro(),r=n==="/flow"||n==="/workspace";return o.jsxs("div",{className:"af-app",children:[n!=="/settings"?o.jsx(toe,{page:r?"flow":"projects"}):null,r?null:o.jsx(_O,{authUser:e,onLogout:t}),o.jsx("div",{className:r?"af-main af-main--pipeline":"af-main",children:o.jsx(soe,{authUser:e})}),o.jsx(noe,{})]})}function aoe(){return o.jsx(roe,{children:o.jsx(cO,{children:o.jsx(loe,{})})})}function loe(){const{path:e}=Ro();return e.startsWith("/display")?o.jsx(E2,{}):fR(e)?o.jsx(O2,{}):o.jsx(ioe,{children:({user:t,onLogout:n})=>o.jsx(ooe,{authUser:t,onLogout:n})})}window.addEventListener("error",e=>{console.error("[AgentFlow UI global error]",e.error||e.message,{filename:e.filename,lineno:e.lineno,colno:e.colno})});window.addEventListener("unhandledrejection",e=>{console.error("[AgentFlow UI unhandled rejection]",e.reason)});const TC=document.querySelector('link[rel="icon"]');TC&&(TC.href=Y_);Zx.createRoot(document.getElementById("root")).render(o.jsx(ct.StrictMode,{children:o.jsx(aoe,{})}));
|