@fieldwangai/agentflow 0.1.34 → 0.1.35
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/agent-runners.mjs +17 -0
- package/bin/lib/composer-agent.mjs +2 -0
- package/bin/lib/composer-skill-router.mjs +23 -4
- package/bin/lib/skill-registry.mjs +46 -2
- package/bin/lib/ui-server.mjs +884 -13
- package/builtin/web-ui/dist/assets/index-BzmhleR9.css +1 -0
- package/builtin/web-ui/dist/assets/index-DEeZI5V6.js +214 -0
- package/builtin/web-ui/dist/index.html +2 -2
- package/package.json +1 -1
- package/builtin/web-ui/dist/assets/index-B1j_UaHw.js +0 -202
- package/builtin/web-ui/dist/assets/index-ChiTnW0H.css +0 -1
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
var LT=Object.defineProperty;var OT=(e,t,n)=>t in e?LT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var wn=(e,t,n)=>OT(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var Lu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Xo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var j1={exports:{}},Lh={},C1={exports:{}},mt={};/**
|
|
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 vd=Symbol.for("react.element"),MT=Symbol.for("react.portal"),$T=Symbol.for("react.fragment"),DT=Symbol.for("react.strict_mode"),FT=Symbol.for("react.profiler"),zT=Symbol.for("react.provider"),BT=Symbol.for("react.context"),HT=Symbol.for("react.forward_ref"),UT=Symbol.for("react.suspense"),WT=Symbol.for("react.memo"),VT=Symbol.for("react.lazy"),A0=Symbol.iterator;function KT(e){return e===null||typeof e!="object"?null:(e=A0&&e[A0]||e["@@iterator"],typeof e=="function"?e:null)}var E1={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_1=Object.assign,P1={};function mc(e,t,n){this.props=e,this.context=t,this.refs=P1,this.updater=n||E1}mc.prototype.isReactComponent={};mc.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")};mc.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function A1(){}A1.prototype=mc.prototype;function Gx(e,t,n){this.props=e,this.context=t,this.refs=P1,this.updater=n||E1}var Xx=Gx.prototype=new A1;Xx.constructor=Gx;_1(Xx,mc.prototype);Xx.isPureReactComponent=!0;var I0=Array.isArray,I1=Object.prototype.hasOwnProperty,Jx={current:null},T1={key:!0,ref:!0,__self:!0,__source:!0};function R1(e,t,n){var r,i={},s=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)I1.call(t,r)&&!T1.hasOwnProperty(r)&&(i[r]=t[r]);var l=arguments.length-2;if(l===1)i.children=n;else if(1<l){for(var c=Array(l),d=0;d<l;d++)c[d]=arguments[d+2];i.children=c}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)i[r]===void 0&&(i[r]=l[r]);return{$$typeof:vd,type:e,key:s,ref:o,props:i,_owner:Jx.current}}function qT(e,t){return{$$typeof:vd,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Qx(e){return typeof e=="object"&&e!==null&&e.$$typeof===vd}function YT(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var T0=/\/+/g;function Um(e,t){return typeof e=="object"&&e!==null&&e.key!=null?YT(""+e.key):t.toString(36)}function lp(e,t,n,r,i){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case vd:case MT:o=!0}}if(o)return o=e,i=i(o),e=r===""?"."+Um(o,0):r,I0(i)?(n="",e!=null&&(n=e.replace(T0,"$&/")+"/"),lp(i,t,n,"",function(d){return d})):i!=null&&(Qx(i)&&(i=qT(i,n+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(T0,"$&/")+"/")+e)),t.push(i)),1;if(o=0,r=r===""?".":r+":",I0(e))for(var l=0;l<e.length;l++){s=e[l];var c=r+Um(s,l);o+=lp(s,t,n,c,i)}else if(c=KT(e),typeof c=="function")for(e=c.call(e),l=0;!(s=e.next()).done;)s=s.value,c=r+Um(s,l++),o+=lp(s,t,n,c,i);else if(s==="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 o}function xf(e,t,n){if(e==null)return e;var r=[],i=0;return lp(e,r,"","",function(s){return t.call(n,s,i++)}),r}function GT(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Ar={current:null},cp={transition:null},XT={ReactCurrentDispatcher:Ar,ReactCurrentBatchConfig:cp,ReactCurrentOwner:Jx};function L1(){throw Error("act(...) is not supported in production builds of React.")}mt.Children={map:xf,forEach:function(e,t,n){xf(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return xf(e,function(){t++}),t},toArray:function(e){return xf(e,function(t){return t})||[]},only:function(e){if(!Qx(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};mt.Component=mc;mt.Fragment=$T;mt.Profiler=FT;mt.PureComponent=Gx;mt.StrictMode=DT;mt.Suspense=UT;mt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=XT;mt.act=L1;mt.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=_1({},e.props),i=e.key,s=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,o=Jx.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)I1.call(t,c)&&!T1.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:vd,type:e.type,key:i,ref:s,props:r,_owner:o}};mt.createContext=function(e){return e={$$typeof:BT,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:zT,_context:e},e.Consumer=e};mt.createElement=R1;mt.createFactory=function(e){var t=R1.bind(null,e);return t.type=e,t};mt.createRef=function(){return{current:null}};mt.forwardRef=function(e){return{$$typeof:HT,render:e}};mt.isValidElement=Qx;mt.lazy=function(e){return{$$typeof:VT,_payload:{_status:-1,_result:e},_init:GT}};mt.memo=function(e,t){return{$$typeof:WT,type:e,compare:t===void 0?null:t}};mt.startTransition=function(e){var t=cp.transition;cp.transition={};try{e()}finally{cp.transition=t}};mt.unstable_act=L1;mt.useCallback=function(e,t){return Ar.current.useCallback(e,t)};mt.useContext=function(e){return Ar.current.useContext(e)};mt.useDebugValue=function(){};mt.useDeferredValue=function(e){return Ar.current.useDeferredValue(e)};mt.useEffect=function(e,t){return Ar.current.useEffect(e,t)};mt.useId=function(){return Ar.current.useId()};mt.useImperativeHandle=function(e,t,n){return Ar.current.useImperativeHandle(e,t,n)};mt.useInsertionEffect=function(e,t){return Ar.current.useInsertionEffect(e,t)};mt.useLayoutEffect=function(e,t){return Ar.current.useLayoutEffect(e,t)};mt.useMemo=function(e,t){return Ar.current.useMemo(e,t)};mt.useReducer=function(e,t,n){return Ar.current.useReducer(e,t,n)};mt.useRef=function(e){return Ar.current.useRef(e)};mt.useState=function(e){return Ar.current.useState(e)};mt.useSyncExternalStore=function(e,t,n){return Ar.current.useSyncExternalStore(e,t,n)};mt.useTransition=function(){return Ar.current.useTransition()};mt.version="18.3.1";C1.exports=mt;var m=C1.exports;const Ye=Xo(m);/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.production.min.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var JT=m,QT=Symbol.for("react.element"),ZT=Symbol.for("react.fragment"),e2=Object.prototype.hasOwnProperty,t2=JT.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,n2={key:!0,ref:!0,__self:!0,__source:!0};function O1(e,t,n){var r,i={},s=null,o=null;n!==void 0&&(s=""+n),t.key!==void 0&&(s=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)e2.call(t,r)&&!n2.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)i[r]===void 0&&(i[r]=t[r]);return{$$typeof:QT,type:e,key:s,ref:o,props:i,_owner:t2.current}}Lh.Fragment=ZT;Lh.jsx=O1;Lh.jsxs=O1;j1.exports=Lh;var a=j1.exports,ay={},M1={exports:{}},ui={},$1={exports:{}},D1={};/**
|
|
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,R){var C=P.length;P.push(R);e:for(;0<C;){var G=C-1>>>1,J=P[G];if(0<i(J,R))P[G]=R,P[C]=J,C=G;else break e}}function n(P){return P.length===0?null:P[0]}function r(P){if(P.length===0)return null;var R=P[0],C=P.pop();if(C!==R){P[0]=C;e:for(var G=0,J=P.length,B=J>>>1;G<B;){var te=2*(G+1)-1,de=P[te],ce=te+1,ue=P[ce];if(0>i(de,C))ce<J&&0>i(ue,de)?(P[G]=ue,P[ce]=C,G=ce):(P[G]=de,P[te]=C,G=te);else if(ce<J&&0>i(ue,C))P[G]=ue,P[ce]=C,G=ce;else break e}}return R}function i(P,R){var C=P.sortIndex-R.sortIndex;return C!==0?C:P.id-R.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],d=[],u=1,f=null,p=3,h=!1,g=!1,b=!1,S=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(P){for(var R=n(d);R!==null;){if(R.callback===null)r(d);else if(R.startTime<=P)r(d),R.sortIndex=R.expirationTime,t(c,R);else break;R=n(d)}}function k(P){if(b=!1,v(P),!g)if(n(c)!==null)g=!0,O(E);else{var R=n(d);R!==null&&U(k,R.startTime-P)}}function E(P,R){g=!1,b&&(b=!1,x($),$=-1),h=!0;var C=p;try{for(v(R),f=n(c);f!==null&&(!(f.expirationTime>R)||P&&!L());){var G=f.callback;if(typeof G=="function"){f.callback=null,p=f.priorityLevel;var J=G(f.expirationTime<=R);R=e.unstable_now(),typeof J=="function"?f.callback=J:f===n(c)&&r(c),v(R)}else r(c);f=n(c)}if(f!==null)var B=!0;else{var te=n(d);te!==null&&U(k,te.startTime-R),B=!1}return B}finally{f=null,p=C,h=!1}}var j=!1,A=null,$=-1,I=5,F=-1;function L(){return!(e.unstable_now()-F<I)}function T(){if(A!==null){var P=e.unstable_now();F=P;var R=!0;try{R=A(!0,P)}finally{R?q():(j=!1,A=null)}}else j=!1}var q;if(typeof w=="function")q=function(){w(T)};else if(typeof MessageChannel<"u"){var D=new MessageChannel,W=D.port2;D.port1.onmessage=T,q=function(){W.postMessage(null)}}else q=function(){S(T,0)};function O(P){A=P,j||(j=!0,q())}function U(P,R){$=S(function(){P(e.unstable_now())},R)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(P){P.callback=null},e.unstable_continueExecution=function(){g||h||(g=!0,O(E))},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"):I=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 R=3;break;default:R=p}var C=p;p=R;try{return P()}finally{p=C}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(P,R){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var C=p;p=P;try{return R()}finally{p=C}},e.unstable_scheduleCallback=function(P,R,C){var G=e.unstable_now();switch(typeof C=="object"&&C!==null?(C=C.delay,C=typeof C=="number"&&0<C?G+C:G):C=G,P){case 1:var J=-1;break;case 2:J=250;break;case 5:J=1073741823;break;case 4:J=1e4;break;default:J=5e3}return J=C+J,P={id:u++,callback:R,priorityLevel:P,startTime:C,expirationTime:J,sortIndex:-1},C>G?(P.sortIndex=C,t(d,P),n(c)===null&&P===n(d)&&(b?(x($),$=-1):b=!0,U(k,C-G))):(P.sortIndex=J,t(c,P),g||h||(g=!0,O(E))),P},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(P){var R=p;return function(){var C=p;p=R;try{return P.apply(this,arguments)}finally{p=C}}}})(D1);$1.exports=D1;var r2=$1.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 i2=m,li=r2;function be(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 F1=new Set,Ou={};function Ha(e,t){Yl(e,t),Yl(e+"Capture",t)}function Yl(e,t){for(Ou[e]=t,e=0;e<t.length;e++)F1.add(t[e])}var Gs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ly=Object.prototype.hasOwnProperty,s2=/^[: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]*$/,R0={},L0={};function o2(e){return ly.call(L0,e)?!0:ly.call(R0,e)?!1:s2.test(e)?L0[e]=!0:(R0[e]=!0,!1)}function a2(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 l2(e,t,n,r){if(t===null||typeof t>"u"||a2(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 Ir(e,t,n,r,i,s,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var sr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){sr[e]=new Ir(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];sr[t]=new Ir(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){sr[e]=new Ir(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){sr[e]=new Ir(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){sr[e]=new Ir(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){sr[e]=new Ir(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){sr[e]=new Ir(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){sr[e]=new Ir(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){sr[e]=new Ir(e,5,!1,e.toLowerCase(),null,!1,!1)});var Zx=/[\-:]([a-z])/g;function ew(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(Zx,ew);sr[t]=new Ir(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(Zx,ew);sr[t]=new Ir(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(Zx,ew);sr[t]=new Ir(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){sr[e]=new Ir(e,1,!1,e.toLowerCase(),null,!1,!1)});sr.xlinkHref=new Ir("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){sr[e]=new Ir(e,1,!1,e.toLowerCase(),null,!0,!0)});function tw(e,t,n,r){var i=sr.hasOwnProperty(t)?sr[t]:null;(i!==null?i.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(l2(t,n,i,r)&&(n=null),r||i===null?o2(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type===3?!1:"":n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var no=i2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,wf=Symbol.for("react.element"),xl=Symbol.for("react.portal"),wl=Symbol.for("react.fragment"),nw=Symbol.for("react.strict_mode"),cy=Symbol.for("react.profiler"),z1=Symbol.for("react.provider"),B1=Symbol.for("react.context"),rw=Symbol.for("react.forward_ref"),uy=Symbol.for("react.suspense"),dy=Symbol.for("react.suspense_list"),iw=Symbol.for("react.memo"),ko=Symbol.for("react.lazy"),H1=Symbol.for("react.offscreen"),O0=Symbol.iterator;function Hc(e){return e===null||typeof e!="object"?null:(e=O0&&e[O0]||e["@@iterator"],typeof e=="function"?e:null)}var hn=Object.assign,Wm;function au(e){if(Wm===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Wm=t&&t[1]||""}return`
|
|
34
|
-
`+Wm+e}var Vm=!1;function Km(e,t){if(!e||Vm)return"";Vm=!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 i=d.stack.split(`
|
|
35
|
-
`),s=r.stack.split(`
|
|
36
|
-
`),o=i.length-1,l=s.length-1;1<=o&&0<=l&&i[o]!==s[l];)l--;for(;1<=o&&0<=l;o--,l--)if(i[o]!==s[l]){if(o!==1||l!==1)do if(o--,l--,0>l||i[o]!==s[l]){var c=`
|
|
37
|
-
`+i[o].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{Vm=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?au(e):""}function c2(e){switch(e.tag){case 5:return au(e.type);case 16:return au("Lazy");case 13:return au("Suspense");case 19:return au("SuspenseList");case 0:case 2:case 15:return e=Km(e.type,!1),e;case 11:return e=Km(e.type.render,!1),e;case 1:return e=Km(e.type,!0),e;default:return""}}function fy(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 wl:return"Fragment";case xl:return"Portal";case cy:return"Profiler";case nw:return"StrictMode";case uy:return"Suspense";case dy:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case B1:return(e.displayName||"Context")+".Consumer";case z1:return(e._context.displayName||"Context")+".Provider";case rw:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case iw:return t=e.displayName||null,t!==null?t:fy(e.type)||"Memo";case ko:t=e._payload,e=e._init;try{return fy(e(t))}catch{}}return null}function u2(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 fy(t);case 8:return t===nw?"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 Uo(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function U1(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function d2(e){var t=U1(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 i=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function vf(e){e._valueTracker||(e._valueTracker=d2(e))}function W1(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=U1(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Ip(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 py(e,t){var n=t.checked;return hn({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function M0(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Uo(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 V1(e,t){t=t.checked,t!=null&&tw(e,"checked",t,!1)}function hy(e,t){V1(e,t);var n=Uo(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")?my(e,t.type,n):t.hasOwnProperty("defaultValue")&&my(e,t.type,Uo(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function $0(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 my(e,t,n){(t!=="number"||Ip(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var lu=Array.isArray;function $l(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Uo(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function gy(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(be(91));return hn({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function D0(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(be(92));if(lu(n)){if(1<n.length)throw Error(be(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Uo(n)}}function K1(e,t){var n=Uo(t.value),r=Uo(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 F0(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function q1(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 yy(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?q1(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var bf,Y1=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(bf=bf||document.createElement("div"),bf.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=bf.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Mu(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var yu={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},f2=["Webkit","ms","Moz","O"];Object.keys(yu).forEach(function(e){f2.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),yu[t]=yu[e]})});function G1(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||yu.hasOwnProperty(e)&&yu[e]?(""+t).trim():t+"px"}function X1(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=G1(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var p2=hn({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 xy(e,t){if(t){if(p2[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(be(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(be(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(be(61))}if(t.style!=null&&typeof t.style!="object")throw Error(be(62))}}function wy(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 vy=null;function sw(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var by=null,Dl=null,Fl=null;function z0(e){if(e=Sd(e)){if(typeof by!="function")throw Error(be(280));var t=e.stateNode;t&&(t=Fh(t),by(e.stateNode,e.type,t))}}function J1(e){Dl?Fl?Fl.push(e):Fl=[e]:Dl=e}function Q1(){if(Dl){var e=Dl,t=Fl;if(Fl=Dl=null,z0(e),t)for(e=0;e<t.length;e++)z0(t[e])}}function Z1(e,t){return e(t)}function ej(){}var qm=!1;function tj(e,t,n){if(qm)return e(t,n);qm=!0;try{return Z1(e,t,n)}finally{qm=!1,(Dl!==null||Fl!==null)&&(ej(),Q1())}}function $u(e,t){var n=e.stateNode;if(n===null)return null;var r=Fh(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(be(231,t,typeof n));return n}var ky=!1;if(Gs)try{var Uc={};Object.defineProperty(Uc,"passive",{get:function(){ky=!0}}),window.addEventListener("test",Uc,Uc),window.removeEventListener("test",Uc,Uc)}catch{ky=!1}function h2(e,t,n,r,i,s,o,l,c){var d=Array.prototype.slice.call(arguments,3);try{t.apply(n,d)}catch(u){this.onError(u)}}var xu=!1,Tp=null,Rp=!1,Sy=null,m2={onError:function(e){xu=!0,Tp=e}};function g2(e,t,n,r,i,s,o,l,c){xu=!1,Tp=null,h2.apply(m2,arguments)}function y2(e,t,n,r,i,s,o,l,c){if(g2.apply(this,arguments),xu){if(xu){var d=Tp;xu=!1,Tp=null}else throw Error(be(198));Rp||(Rp=!0,Sy=d)}}function Ua(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function nj(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 B0(e){if(Ua(e)!==e)throw Error(be(188))}function x2(e){var t=e.alternate;if(!t){if(t=Ua(e),t===null)throw Error(be(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var s=i.alternate;if(s===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===n)return B0(i),e;if(s===r)return B0(i),t;s=s.sibling}throw Error(be(188))}if(n.return!==r.return)n=i,r=s;else{for(var o=!1,l=i.child;l;){if(l===n){o=!0,n=i,r=s;break}if(l===r){o=!0,r=i,n=s;break}l=l.sibling}if(!o){for(l=s.child;l;){if(l===n){o=!0,n=s,r=i;break}if(l===r){o=!0,r=s,n=i;break}l=l.sibling}if(!o)throw Error(be(189))}}if(n.alternate!==r)throw Error(be(190))}if(n.tag!==3)throw Error(be(188));return n.stateNode.current===n?e:t}function rj(e){return e=x2(e),e!==null?ij(e):null}function ij(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=ij(e);if(t!==null)return t;e=e.sibling}return null}var sj=li.unstable_scheduleCallback,H0=li.unstable_cancelCallback,w2=li.unstable_shouldYield,v2=li.unstable_requestPaint,En=li.unstable_now,b2=li.unstable_getCurrentPriorityLevel,ow=li.unstable_ImmediatePriority,oj=li.unstable_UserBlockingPriority,Lp=li.unstable_NormalPriority,k2=li.unstable_LowPriority,aj=li.unstable_IdlePriority,Oh=null,vs=null;function S2(e){if(vs&&typeof vs.onCommitFiberRoot=="function")try{vs.onCommitFiberRoot(Oh,e,void 0,(e.current.flags&128)===128)}catch{}}var Ki=Math.clz32?Math.clz32:C2,N2=Math.log,j2=Math.LN2;function C2(e){return e>>>=0,e===0?32:31-(N2(e)/j2|0)|0}var kf=64,Sf=4194304;function cu(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 Op(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,s=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~i;l!==0?r=cu(l):(s&=o,s!==0&&(r=cu(s)))}else o=n&~i,o!==0?r=cu(o):s!==0&&(r=cu(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,s=t&-t,i>=s||i===16&&(s&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-Ki(t),i=1<<n,r|=e[n],t&=~i;return r}function E2(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 _2(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,s=e.pendingLanes;0<s;){var o=31-Ki(s),l=1<<o,c=i[o];c===-1?(!(l&n)||l&r)&&(i[o]=E2(l,t)):c<=t&&(e.expiredLanes|=l),s&=~l}}function Ny(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function lj(){var e=kf;return kf<<=1,!(kf&4194240)&&(kf=64),e}function Ym(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function bd(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ki(t),e[t]=n}function P2(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 i=31-Ki(n),s=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~s}}function aw(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ki(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var At=0;function cj(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var uj,lw,dj,fj,pj,jy=!1,Nf=[],To=null,Ro=null,Lo=null,Du=new Map,Fu=new Map,jo=[],A2="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 U0(e,t){switch(e){case"focusin":case"focusout":To=null;break;case"dragenter":case"dragleave":Ro=null;break;case"mouseover":case"mouseout":Lo=null;break;case"pointerover":case"pointerout":Du.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Fu.delete(t.pointerId)}}function Wc(e,t,n,r,i,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:s,targetContainers:[i]},t!==null&&(t=Sd(t),t!==null&&lw(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function I2(e,t,n,r,i){switch(t){case"focusin":return To=Wc(To,e,t,n,r,i),!0;case"dragenter":return Ro=Wc(Ro,e,t,n,r,i),!0;case"mouseover":return Lo=Wc(Lo,e,t,n,r,i),!0;case"pointerover":var s=i.pointerId;return Du.set(s,Wc(Du.get(s)||null,e,t,n,r,i)),!0;case"gotpointercapture":return s=i.pointerId,Fu.set(s,Wc(Fu.get(s)||null,e,t,n,r,i)),!0}return!1}function hj(e){var t=ka(e.target);if(t!==null){var n=Ua(t);if(n!==null){if(t=n.tag,t===13){if(t=nj(n),t!==null){e.blockedOn=t,pj(e.priority,function(){dj(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 up(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Cy(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);vy=r,n.target.dispatchEvent(r),vy=null}else return t=Sd(n),t!==null&&lw(t),e.blockedOn=n,!1;t.shift()}return!0}function W0(e,t,n){up(e)&&n.delete(t)}function T2(){jy=!1,To!==null&&up(To)&&(To=null),Ro!==null&&up(Ro)&&(Ro=null),Lo!==null&&up(Lo)&&(Lo=null),Du.forEach(W0),Fu.forEach(W0)}function Vc(e,t){e.blockedOn===t&&(e.blockedOn=null,jy||(jy=!0,li.unstable_scheduleCallback(li.unstable_NormalPriority,T2)))}function zu(e){function t(i){return Vc(i,e)}if(0<Nf.length){Vc(Nf[0],e);for(var n=1;n<Nf.length;n++){var r=Nf[n];r.blockedOn===e&&(r.blockedOn=null)}}for(To!==null&&Vc(To,e),Ro!==null&&Vc(Ro,e),Lo!==null&&Vc(Lo,e),Du.forEach(t),Fu.forEach(t),n=0;n<jo.length;n++)r=jo[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<jo.length&&(n=jo[0],n.blockedOn===null);)hj(n),n.blockedOn===null&&jo.shift()}var zl=no.ReactCurrentBatchConfig,Mp=!0;function R2(e,t,n,r){var i=At,s=zl.transition;zl.transition=null;try{At=1,cw(e,t,n,r)}finally{At=i,zl.transition=s}}function L2(e,t,n,r){var i=At,s=zl.transition;zl.transition=null;try{At=4,cw(e,t,n,r)}finally{At=i,zl.transition=s}}function cw(e,t,n,r){if(Mp){var i=Cy(e,t,n,r);if(i===null)ig(e,t,r,$p,n),U0(e,r);else if(I2(i,e,t,n,r))r.stopPropagation();else if(U0(e,r),t&4&&-1<A2.indexOf(e)){for(;i!==null;){var s=Sd(i);if(s!==null&&uj(s),s=Cy(e,t,n,r),s===null&&ig(e,t,r,$p,n),s===i)break;i=s}i!==null&&r.stopPropagation()}else ig(e,t,r,null,n)}}var $p=null;function Cy(e,t,n,r){if($p=null,e=sw(r),e=ka(e),e!==null)if(t=Ua(e),t===null)e=null;else if(n=t.tag,n===13){if(e=nj(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 $p=e,null}function mj(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(b2()){case ow:return 1;case oj:return 4;case Lp:case k2:return 16;case aj:return 536870912;default:return 16}default:return 16}}var _o=null,uw=null,dp=null;function gj(){if(dp)return dp;var e,t=uw,n=t.length,r,i="value"in _o?_o.value:_o.textContent,s=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[s-r];r++);return dp=i.slice(e,1<r?1-r:void 0)}function fp(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 jf(){return!0}function V0(){return!1}function di(e){function t(n,r,i,s,o){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(s):s[l]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?jf:V0,this.isPropagationStopped=V0,this}return hn(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=jf)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=jf)},persist:function(){},isPersistent:jf}),t}var gc={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},dw=di(gc),kd=hn({},gc,{view:0,detail:0}),O2=di(kd),Gm,Xm,Kc,Mh=hn({},kd,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:fw,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!==Kc&&(Kc&&e.type==="mousemove"?(Gm=e.screenX-Kc.screenX,Xm=e.screenY-Kc.screenY):Xm=Gm=0,Kc=e),Gm)},movementY:function(e){return"movementY"in e?e.movementY:Xm}}),K0=di(Mh),M2=hn({},Mh,{dataTransfer:0}),$2=di(M2),D2=hn({},kd,{relatedTarget:0}),Jm=di(D2),F2=hn({},gc,{animationName:0,elapsedTime:0,pseudoElement:0}),z2=di(F2),B2=hn({},gc,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),H2=di(B2),U2=hn({},gc,{data:0}),q0=di(U2),W2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},V2={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"},K2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function q2(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=K2[e])?!!t[e]:!1}function fw(){return q2}var Y2=hn({},kd,{key:function(e){if(e.key){var t=W2[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=fp(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?V2[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:fw,charCode:function(e){return e.type==="keypress"?fp(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?fp(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),G2=di(Y2),X2=hn({},Mh,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Y0=di(X2),J2=hn({},kd,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:fw}),Q2=di(J2),Z2=hn({},gc,{propertyName:0,elapsedTime:0,pseudoElement:0}),eR=di(Z2),tR=hn({},Mh,{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}),nR=di(tR),rR=[9,13,27,32],pw=Gs&&"CompositionEvent"in window,wu=null;Gs&&"documentMode"in document&&(wu=document.documentMode);var iR=Gs&&"TextEvent"in window&&!wu,yj=Gs&&(!pw||wu&&8<wu&&11>=wu),G0=" ",X0=!1;function xj(e,t){switch(e){case"keyup":return rR.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function wj(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var vl=!1;function sR(e,t){switch(e){case"compositionend":return wj(t);case"keypress":return t.which!==32?null:(X0=!0,G0);case"textInput":return e=t.data,e===G0&&X0?null:e;default:return null}}function oR(e,t){if(vl)return e==="compositionend"||!pw&&xj(e,t)?(e=gj(),dp=uw=_o=null,vl=!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 yj&&t.locale!=="ko"?null:t.data;default:return null}}var aR={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 J0(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!aR[e.type]:t==="textarea"}function vj(e,t,n,r){J1(r),t=Dp(t,"onChange"),0<t.length&&(n=new dw("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var vu=null,Bu=null;function lR(e){Ij(e,0)}function $h(e){var t=Sl(e);if(W1(t))return e}function cR(e,t){if(e==="change")return t}var bj=!1;if(Gs){var Qm;if(Gs){var Zm="oninput"in document;if(!Zm){var Q0=document.createElement("div");Q0.setAttribute("oninput","return;"),Zm=typeof Q0.oninput=="function"}Qm=Zm}else Qm=!1;bj=Qm&&(!document.documentMode||9<document.documentMode)}function Z0(){vu&&(vu.detachEvent("onpropertychange",kj),Bu=vu=null)}function kj(e){if(e.propertyName==="value"&&$h(Bu)){var t=[];vj(t,Bu,e,sw(e)),tj(lR,t)}}function uR(e,t,n){e==="focusin"?(Z0(),vu=t,Bu=n,vu.attachEvent("onpropertychange",kj)):e==="focusout"&&Z0()}function dR(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return $h(Bu)}function fR(e,t){if(e==="click")return $h(t)}function pR(e,t){if(e==="input"||e==="change")return $h(t)}function hR(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Yi=typeof Object.is=="function"?Object.is:hR;function Hu(e,t){if(Yi(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 i=n[r];if(!ly.call(t,i)||!Yi(e[i],t[i]))return!1}return!0}function eb(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function tb(e,t){var n=eb(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=eb(n)}}function Sj(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Sj(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Nj(){for(var e=window,t=Ip();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ip(e.document)}return t}function hw(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 mR(e){var t=Nj(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Sj(n.ownerDocument.documentElement,n)){if(r!==null&&hw(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 i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!e.extend&&s>r&&(i=r,r=s,s=i),i=tb(n,s);var o=tb(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.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 gR=Gs&&"documentMode"in document&&11>=document.documentMode,bl=null,Ey=null,bu=null,_y=!1;function nb(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;_y||bl==null||bl!==Ip(r)||(r=bl,"selectionStart"in r&&hw(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}),bu&&Hu(bu,r)||(bu=r,r=Dp(Ey,"onSelect"),0<r.length&&(t=new dw("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=bl)))}function Cf(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var kl={animationend:Cf("Animation","AnimationEnd"),animationiteration:Cf("Animation","AnimationIteration"),animationstart:Cf("Animation","AnimationStart"),transitionend:Cf("Transition","TransitionEnd")},eg={},jj={};Gs&&(jj=document.createElement("div").style,"AnimationEvent"in window||(delete kl.animationend.animation,delete kl.animationiteration.animation,delete kl.animationstart.animation),"TransitionEvent"in window||delete kl.transitionend.transition);function Dh(e){if(eg[e])return eg[e];if(!kl[e])return e;var t=kl[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in jj)return eg[e]=t[n];return e}var Cj=Dh("animationend"),Ej=Dh("animationiteration"),_j=Dh("animationstart"),Pj=Dh("transitionend"),Aj=new Map,rb="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 Jo(e,t){Aj.set(e,t),Ha(t,[e])}for(var tg=0;tg<rb.length;tg++){var ng=rb[tg],yR=ng.toLowerCase(),xR=ng[0].toUpperCase()+ng.slice(1);Jo(yR,"on"+xR)}Jo(Cj,"onAnimationEnd");Jo(Ej,"onAnimationIteration");Jo(_j,"onAnimationStart");Jo("dblclick","onDoubleClick");Jo("focusin","onFocus");Jo("focusout","onBlur");Jo(Pj,"onTransitionEnd");Yl("onMouseEnter",["mouseout","mouseover"]);Yl("onMouseLeave",["mouseout","mouseover"]);Yl("onPointerEnter",["pointerout","pointerover"]);Yl("onPointerLeave",["pointerout","pointerover"]);Ha("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Ha("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Ha("onBeforeInput",["compositionend","keypress","textInput","paste"]);Ha("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Ha("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Ha("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var uu="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(" "),wR=new Set("cancel close invalid load scroll toggle".split(" ").concat(uu));function ib(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,y2(r,t,void 0,e),e.currentTarget=null}function Ij(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;e:{var s=void 0;if(t)for(var o=r.length-1;0<=o;o--){var l=r[o],c=l.instance,d=l.currentTarget;if(l=l.listener,c!==s&&i.isPropagationStopped())break e;ib(i,l,d),s=c}else for(o=0;o<r.length;o++){if(l=r[o],c=l.instance,d=l.currentTarget,l=l.listener,c!==s&&i.isPropagationStopped())break e;ib(i,l,d),s=c}}}if(Rp)throw e=Sy,Rp=!1,Sy=null,e}function qt(e,t){var n=t[Ry];n===void 0&&(n=t[Ry]=new Set);var r=e+"__bubble";n.has(r)||(Tj(t,e,2,!1),n.add(r))}function rg(e,t,n){var r=0;t&&(r|=4),Tj(n,e,r,t)}var Ef="_reactListening"+Math.random().toString(36).slice(2);function Uu(e){if(!e[Ef]){e[Ef]=!0,F1.forEach(function(n){n!=="selectionchange"&&(wR.has(n)||rg(n,!1,e),rg(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ef]||(t[Ef]=!0,rg("selectionchange",!1,t))}}function Tj(e,t,n,r){switch(mj(t)){case 1:var i=R2;break;case 4:i=L2;break;default:i=cw}n=i.bind(null,t,n,e),i=void 0,!ky||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),r?i!==void 0?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):i!==void 0?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function ig(e,t,n,r,i){var s=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var l=r.stateNode.containerInfo;if(l===i||l.nodeType===8&&l.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===i||c.nodeType===8&&c.parentNode===i))return;o=o.return}for(;l!==null;){if(o=ka(l),o===null)return;if(c=o.tag,c===5||c===6){r=s=o;continue e}l=l.parentNode}}r=r.return}tj(function(){var d=s,u=sw(n),f=[];e:{var p=Aj.get(e);if(p!==void 0){var h=dw,g=e;switch(e){case"keypress":if(fp(n)===0)break e;case"keydown":case"keyup":h=G2;break;case"focusin":g="focus",h=Jm;break;case"focusout":g="blur",h=Jm;break;case"beforeblur":case"afterblur":h=Jm;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":h=K0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=$2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=Q2;break;case Cj:case Ej:case _j:h=z2;break;case Pj:h=eR;break;case"scroll":h=O2;break;case"wheel":h=nR;break;case"copy":case"cut":case"paste":h=H2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=Y0}var b=(t&4)!==0,S=!b&&e==="scroll",x=b?p!==null?p+"Capture":null:p;b=[];for(var w=d,v;w!==null;){v=w;var k=v.stateNode;if(v.tag===5&&k!==null&&(v=k,x!==null&&(k=$u(w,x),k!=null&&b.push(Wu(w,k,v)))),S)break;w=w.return}0<b.length&&(p=new h(p,g,null,n,u),f.push({event:p,listeners:b}))}}if(!(t&7)){e:{if(p=e==="mouseover"||e==="pointerover",h=e==="mouseout"||e==="pointerout",p&&n!==vy&&(g=n.relatedTarget||n.fromElement)&&(ka(g)||g[Xs]))break e;if((h||p)&&(p=u.window===u?u:(p=u.ownerDocument)?p.defaultView||p.parentWindow:window,h?(g=n.relatedTarget||n.toElement,h=d,g=g?ka(g):null,g!==null&&(S=Ua(g),g!==S||g.tag!==5&&g.tag!==6)&&(g=null)):(h=null,g=d),h!==g)){if(b=K0,k="onMouseLeave",x="onMouseEnter",w="mouse",(e==="pointerout"||e==="pointerover")&&(b=Y0,k="onPointerLeave",x="onPointerEnter",w="pointer"),S=h==null?p:Sl(h),v=g==null?p:Sl(g),p=new b(k,w+"leave",h,n,u),p.target=S,p.relatedTarget=v,k=null,ka(u)===d&&(b=new b(x,w+"enter",g,n,u),b.target=v,b.relatedTarget=S,k=b),S=k,h&&g)t:{for(b=h,x=g,w=0,v=b;v;v=ll(v))w++;for(v=0,k=x;k;k=ll(k))v++;for(;0<w-v;)b=ll(b),w--;for(;0<v-w;)x=ll(x),v--;for(;w--;){if(b===x||x!==null&&b===x.alternate)break t;b=ll(b),x=ll(x)}b=null}else b=null;h!==null&&sb(f,p,h,b,!1),g!==null&&S!==null&&sb(f,S,g,b,!0)}}e:{if(p=d?Sl(d):window,h=p.nodeName&&p.nodeName.toLowerCase(),h==="select"||h==="input"&&p.type==="file")var E=cR;else if(J0(p))if(bj)E=pR;else{E=dR;var j=uR}else(h=p.nodeName)&&h.toLowerCase()==="input"&&(p.type==="checkbox"||p.type==="radio")&&(E=fR);if(E&&(E=E(e,d))){vj(f,E,n,u);break e}j&&j(e,p,d),e==="focusout"&&(j=p._wrapperState)&&j.controlled&&p.type==="number"&&my(p,"number",p.value)}switch(j=d?Sl(d):window,e){case"focusin":(J0(j)||j.contentEditable==="true")&&(bl=j,Ey=d,bu=null);break;case"focusout":bu=Ey=bl=null;break;case"mousedown":_y=!0;break;case"contextmenu":case"mouseup":case"dragend":_y=!1,nb(f,n,u);break;case"selectionchange":if(gR)break;case"keydown":case"keyup":nb(f,n,u)}var A;if(pw)e:{switch(e){case"compositionstart":var $="onCompositionStart";break e;case"compositionend":$="onCompositionEnd";break e;case"compositionupdate":$="onCompositionUpdate";break e}$=void 0}else vl?xj(e,n)&&($="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&($="onCompositionStart");$&&(yj&&n.locale!=="ko"&&(vl||$!=="onCompositionStart"?$==="onCompositionEnd"&&vl&&(A=gj()):(_o=u,uw="value"in _o?_o.value:_o.textContent,vl=!0)),j=Dp(d,$),0<j.length&&($=new q0($,e,null,n,u),f.push({event:$,listeners:j}),A?$.data=A:(A=wj(n),A!==null&&($.data=A)))),(A=iR?sR(e,n):oR(e,n))&&(d=Dp(d,"onBeforeInput"),0<d.length&&(u=new q0("onBeforeInput","beforeinput",null,n,u),f.push({event:u,listeners:d}),u.data=A))}Ij(f,t)})}function Wu(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Dp(e,t){for(var n=t+"Capture",r=[];e!==null;){var i=e,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=$u(e,n),s!=null&&r.unshift(Wu(e,s,i)),s=$u(e,t),s!=null&&r.push(Wu(e,s,i))),e=e.return}return r}function ll(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function sb(e,t,n,r,i){for(var s=t._reactName,o=[];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,i?(c=$u(n,s),c!=null&&o.unshift(Wu(n,c,l))):i||(c=$u(n,s),c!=null&&o.push(Wu(n,c,l)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var vR=/\r\n?/g,bR=/\u0000|\uFFFD/g;function ob(e){return(typeof e=="string"?e:""+e).replace(vR,`
|
|
38
|
-
`).replace(bR,"")}function _f(e,t,n){if(t=ob(t),ob(e)!==t&&n)throw Error(be(425))}function Fp(){}var Py=null,Ay=null;function Iy(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 Ty=typeof setTimeout=="function"?setTimeout:void 0,kR=typeof clearTimeout=="function"?clearTimeout:void 0,ab=typeof Promise=="function"?Promise:void 0,SR=typeof queueMicrotask=="function"?queueMicrotask:typeof ab<"u"?function(e){return ab.resolve(null).then(e).catch(NR)}:Ty;function NR(e){setTimeout(function(){throw e})}function sg(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){e.removeChild(i),zu(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);zu(t)}function Oo(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 lb(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 yc=Math.random().toString(36).slice(2),gs="__reactFiber$"+yc,Vu="__reactProps$"+yc,Xs="__reactContainer$"+yc,Ry="__reactEvents$"+yc,jR="__reactListeners$"+yc,CR="__reactHandles$"+yc;function ka(e){var t=e[gs];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Xs]||n[gs]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=lb(e);e!==null;){if(n=e[gs])return n;e=lb(e)}return t}e=n,n=e.parentNode}return null}function Sd(e){return e=e[gs]||e[Xs],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Sl(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(be(33))}function Fh(e){return e[Vu]||null}var Ly=[],Nl=-1;function Qo(e){return{current:e}}function Gt(e){0>Nl||(e.current=Ly[Nl],Ly[Nl]=null,Nl--)}function Bt(e,t){Nl++,Ly[Nl]=e.current,e.current=t}var Wo={},mr=Qo(Wo),Wr=Qo(!1),Ta=Wo;function Gl(e,t){var n=e.type.contextTypes;if(!n)return Wo;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Vr(e){return e=e.childContextTypes,e!=null}function zp(){Gt(Wr),Gt(mr)}function cb(e,t,n){if(mr.current!==Wo)throw Error(be(168));Bt(mr,t),Bt(Wr,n)}function Rj(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(be(108,u2(e)||"Unknown",i));return hn({},n,r)}function Bp(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Wo,Ta=mr.current,Bt(mr,e),Bt(Wr,Wr.current),!0}function ub(e,t,n){var r=e.stateNode;if(!r)throw Error(be(169));n?(e=Rj(e,t,Ta),r.__reactInternalMemoizedMergedChildContext=e,Gt(Wr),Gt(mr),Bt(mr,e)):Gt(Wr),Bt(Wr,n)}var Bs=null,zh=!1,og=!1;function Lj(e){Bs===null?Bs=[e]:Bs.push(e)}function ER(e){zh=!0,Lj(e)}function Zo(){if(!og&&Bs!==null){og=!0;var e=0,t=At;try{var n=Bs;for(At=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Bs=null,zh=!1}catch(i){throw Bs!==null&&(Bs=Bs.slice(e+1)),sj(ow,Zo),i}finally{At=t,og=!1}}return null}var jl=[],Cl=0,Hp=null,Up=0,yi=[],xi=0,Ra=null,Ws=1,Vs="";function xa(e,t){jl[Cl++]=Up,jl[Cl++]=Hp,Hp=e,Up=t}function Oj(e,t,n){yi[xi++]=Ws,yi[xi++]=Vs,yi[xi++]=Ra,Ra=e;var r=Ws;e=Vs;var i=32-Ki(r)-1;r&=~(1<<i),n+=1;var s=32-Ki(t)+i;if(30<s){var o=i-i%5;s=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Ws=1<<32-Ki(t)+i|n<<i|r,Vs=s+e}else Ws=1<<s|n<<i|r,Vs=e}function mw(e){e.return!==null&&(xa(e,1),Oj(e,1,0))}function gw(e){for(;e===Hp;)Hp=jl[--Cl],jl[Cl]=null,Up=jl[--Cl],jl[Cl]=null;for(;e===Ra;)Ra=yi[--xi],yi[xi]=null,Vs=yi[--xi],yi[xi]=null,Ws=yi[--xi],yi[xi]=null}var oi=null,ii=null,nn=!1,Bi=null;function Mj(e,t){var n=bi(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 db(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,oi=e,ii=Oo(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,oi=e,ii=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Ra!==null?{id:Ws,overflow:Vs}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=bi(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,oi=e,ii=null,!0):!1;default:return!1}}function Oy(e){return(e.mode&1)!==0&&(e.flags&128)===0}function My(e){if(nn){var t=ii;if(t){var n=t;if(!db(e,t)){if(Oy(e))throw Error(be(418));t=Oo(n.nextSibling);var r=oi;t&&db(e,t)?Mj(r,n):(e.flags=e.flags&-4097|2,nn=!1,oi=e)}}else{if(Oy(e))throw Error(be(418));e.flags=e.flags&-4097|2,nn=!1,oi=e}}}function fb(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;oi=e}function Pf(e){if(e!==oi)return!1;if(!nn)return fb(e),nn=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Iy(e.type,e.memoizedProps)),t&&(t=ii)){if(Oy(e))throw $j(),Error(be(418));for(;t;)Mj(e,t),t=Oo(t.nextSibling)}if(fb(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(be(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){ii=Oo(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}ii=null}}else ii=oi?Oo(e.stateNode.nextSibling):null;return!0}function $j(){for(var e=ii;e;)e=Oo(e.nextSibling)}function Xl(){ii=oi=null,nn=!1}function yw(e){Bi===null?Bi=[e]:Bi.push(e)}var _R=no.ReactCurrentBatchConfig;function qc(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(be(309));var r=n.stateNode}if(!r)throw Error(be(147,e));var i=r,s=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===s?t.ref:(t=function(o){var l=i.refs;o===null?delete l[s]:l[s]=o},t._stringRef=s,t)}if(typeof e!="string")throw Error(be(284));if(!n._owner)throw Error(be(290,e))}return e}function Af(e,t){throw e=Object.prototype.toString.call(t),Error(be(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function pb(e){var t=e._init;return t(e._payload)}function Dj(e){function t(x,w){if(e){var v=x.deletions;v===null?(x.deletions=[w],x.flags|=16):v.push(w)}}function n(x,w){if(!e)return null;for(;w!==null;)t(x,w),w=w.sibling;return null}function r(x,w){for(x=new Map;w!==null;)w.key!==null?x.set(w.key,w):x.set(w.index,w),w=w.sibling;return x}function i(x,w){return x=Fo(x,w),x.index=0,x.sibling=null,x}function s(x,w,v){return x.index=v,e?(v=x.alternate,v!==null?(v=v.index,v<w?(x.flags|=2,w):v):(x.flags|=2,w)):(x.flags|=1048576,w)}function o(x){return e&&x.alternate===null&&(x.flags|=2),x}function l(x,w,v,k){return w===null||w.tag!==6?(w=pg(v,x.mode,k),w.return=x,w):(w=i(w,v),w.return=x,w)}function c(x,w,v,k){var E=v.type;return E===wl?u(x,w,v.props.children,k,v.key):w!==null&&(w.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===ko&&pb(E)===w.type)?(k=i(w,v.props),k.ref=qc(x,w,v),k.return=x,k):(k=wp(v.type,v.key,v.props,null,x.mode,k),k.ref=qc(x,w,v),k.return=x,k)}function d(x,w,v,k){return w===null||w.tag!==4||w.stateNode.containerInfo!==v.containerInfo||w.stateNode.implementation!==v.implementation?(w=hg(v,x.mode,k),w.return=x,w):(w=i(w,v.children||[]),w.return=x,w)}function u(x,w,v,k,E){return w===null||w.tag!==7?(w=Ea(v,x.mode,k,E),w.return=x,w):(w=i(w,v),w.return=x,w)}function f(x,w,v){if(typeof w=="string"&&w!==""||typeof w=="number")return w=pg(""+w,x.mode,v),w.return=x,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case wf:return v=wp(w.type,w.key,w.props,null,x.mode,v),v.ref=qc(x,null,w),v.return=x,v;case xl:return w=hg(w,x.mode,v),w.return=x,w;case ko:var k=w._init;return f(x,k(w._payload),v)}if(lu(w)||Hc(w))return w=Ea(w,x.mode,v,null),w.return=x,w;Af(x,w)}return null}function p(x,w,v,k){var E=w!==null?w.key:null;if(typeof v=="string"&&v!==""||typeof v=="number")return E!==null?null:l(x,w,""+v,k);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case wf:return v.key===E?c(x,w,v,k):null;case xl:return v.key===E?d(x,w,v,k):null;case ko:return E=v._init,p(x,w,E(v._payload),k)}if(lu(v)||Hc(v))return E!==null?null:u(x,w,v,k,null);Af(x,v)}return null}function h(x,w,v,k,E){if(typeof k=="string"&&k!==""||typeof k=="number")return x=x.get(v)||null,l(w,x,""+k,E);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case wf:return x=x.get(k.key===null?v:k.key)||null,c(w,x,k,E);case xl:return x=x.get(k.key===null?v:k.key)||null,d(w,x,k,E);case ko:var j=k._init;return h(x,w,v,j(k._payload),E)}if(lu(k)||Hc(k))return x=x.get(v)||null,u(w,x,k,E,null);Af(w,k)}return null}function g(x,w,v,k){for(var E=null,j=null,A=w,$=w=0,I=null;A!==null&&$<v.length;$++){A.index>$?(I=A,A=null):I=A.sibling;var F=p(x,A,v[$],k);if(F===null){A===null&&(A=I);break}e&&A&&F.alternate===null&&t(x,A),w=s(F,w,$),j===null?E=F:j.sibling=F,j=F,A=I}if($===v.length)return n(x,A),nn&&xa(x,$),E;if(A===null){for(;$<v.length;$++)A=f(x,v[$],k),A!==null&&(w=s(A,w,$),j===null?E=A:j.sibling=A,j=A);return nn&&xa(x,$),E}for(A=r(x,A);$<v.length;$++)I=h(A,x,$,v[$],k),I!==null&&(e&&I.alternate!==null&&A.delete(I.key===null?$:I.key),w=s(I,w,$),j===null?E=I:j.sibling=I,j=I);return e&&A.forEach(function(L){return t(x,L)}),nn&&xa(x,$),E}function b(x,w,v,k){var E=Hc(v);if(typeof E!="function")throw Error(be(150));if(v=E.call(v),v==null)throw Error(be(151));for(var j=E=null,A=w,$=w=0,I=null,F=v.next();A!==null&&!F.done;$++,F=v.next()){A.index>$?(I=A,A=null):I=A.sibling;var L=p(x,A,F.value,k);if(L===null){A===null&&(A=I);break}e&&A&&L.alternate===null&&t(x,A),w=s(L,w,$),j===null?E=L:j.sibling=L,j=L,A=I}if(F.done)return n(x,A),nn&&xa(x,$),E;if(A===null){for(;!F.done;$++,F=v.next())F=f(x,F.value,k),F!==null&&(w=s(F,w,$),j===null?E=F:j.sibling=F,j=F);return nn&&xa(x,$),E}for(A=r(x,A);!F.done;$++,F=v.next())F=h(A,x,$,F.value,k),F!==null&&(e&&F.alternate!==null&&A.delete(F.key===null?$:F.key),w=s(F,w,$),j===null?E=F:j.sibling=F,j=F);return e&&A.forEach(function(T){return t(x,T)}),nn&&xa(x,$),E}function S(x,w,v,k){if(typeof v=="object"&&v!==null&&v.type===wl&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case wf:e:{for(var E=v.key,j=w;j!==null;){if(j.key===E){if(E=v.type,E===wl){if(j.tag===7){n(x,j.sibling),w=i(j,v.props.children),w.return=x,x=w;break e}}else if(j.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===ko&&pb(E)===j.type){n(x,j.sibling),w=i(j,v.props),w.ref=qc(x,j,v),w.return=x,x=w;break e}n(x,j);break}else t(x,j);j=j.sibling}v.type===wl?(w=Ea(v.props.children,x.mode,k,v.key),w.return=x,x=w):(k=wp(v.type,v.key,v.props,null,x.mode,k),k.ref=qc(x,w,v),k.return=x,x=k)}return o(x);case xl:e:{for(j=v.key;w!==null;){if(w.key===j)if(w.tag===4&&w.stateNode.containerInfo===v.containerInfo&&w.stateNode.implementation===v.implementation){n(x,w.sibling),w=i(w,v.children||[]),w.return=x,x=w;break e}else{n(x,w);break}else t(x,w);w=w.sibling}w=hg(v,x.mode,k),w.return=x,x=w}return o(x);case ko:return j=v._init,S(x,w,j(v._payload),k)}if(lu(v))return g(x,w,v,k);if(Hc(v))return b(x,w,v,k);Af(x,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,w!==null&&w.tag===6?(n(x,w.sibling),w=i(w,v),w.return=x,x=w):(n(x,w),w=pg(v,x.mode,k),w.return=x,x=w),o(x)):n(x,w)}return S}var Jl=Dj(!0),Fj=Dj(!1),Wp=Qo(null),Vp=null,El=null,xw=null;function ww(){xw=El=Vp=null}function vw(e){var t=Wp.current;Gt(Wp),e._currentValue=t}function $y(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 Bl(e,t){Vp=e,xw=El=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Fr=!0),e.firstContext=null)}function Si(e){var t=e._currentValue;if(xw!==e)if(e={context:e,memoizedValue:t,next:null},El===null){if(Vp===null)throw Error(be(308));El=e,Vp.dependencies={lanes:0,firstContext:e}}else El=El.next=e;return t}var Sa=null;function bw(e){Sa===null?Sa=[e]:Sa.push(e)}function zj(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,bw(t)):(n.next=i.next,i.next=n),t.interleaved=n,Js(e,r)}function Js(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 So=!1;function kw(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Bj(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 Ys(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Mo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ct&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Js(e,n)}return i=r.interleaved,i===null?(t.next=t,bw(r)):(t.next=i.next,i.next=t),r.interleaved=t,Js(e,n)}function pp(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,aw(e,n)}}function hb(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=t:s=s.next=t}else i=s=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,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 Kp(e,t,n,r){var i=e.updateQueue;So=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,d=c.next;c.next=null,o===null?s=d:o.next=d,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,l=u.lastBaseUpdate,l!==o&&(l===null?u.firstBaseUpdate=d:l.next=d,u.lastBaseUpdate=c))}if(s!==null){var f=i.baseState;o=0,u=d=c=null,l=s;do{var p=l.lane,h=l.eventTime;if((r&p)===p){u!==null&&(u=u.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var g=e,b=l;switch(p=t,h=n,b.tag){case 1:if(g=b.payload,typeof g=="function"){f=g.call(h,f,p);break e}f=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=b.payload,p=typeof g=="function"?g.call(h,f,p):g,p==null)break e;f=hn({},f,p);break e;case 2:So=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,p=i.effects,p===null?i.effects=[l]:p.push(l))}else h={eventTime:h,lane:p,tag:l.tag,payload:l.payload,callback:l.callback,next:null},u===null?(d=u=h,c=f):u=u.next=h,o|=p;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;p=l,l=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(!0);if(u===null&&(c=f),i.baseState=c,i.firstBaseUpdate=d,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else s===null&&(i.shared.lanes=0);Oa|=o,e.lanes=o,e.memoizedState=f}}function mb(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(be(191,i));i.call(r)}}}var Nd={},bs=Qo(Nd),Ku=Qo(Nd),qu=Qo(Nd);function Na(e){if(e===Nd)throw Error(be(174));return e}function Sw(e,t){switch(Bt(qu,t),Bt(Ku,e),Bt(bs,Nd),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:yy(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=yy(t,e)}Gt(bs),Bt(bs,t)}function Ql(){Gt(bs),Gt(Ku),Gt(qu)}function Hj(e){Na(qu.current);var t=Na(bs.current),n=yy(t,e.type);t!==n&&(Bt(Ku,e),Bt(bs,n))}function Nw(e){Ku.current===e&&(Gt(bs),Gt(Ku))}var fn=Qo(0);function qp(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 ag=[];function jw(){for(var e=0;e<ag.length;e++)ag[e]._workInProgressVersionPrimary=null;ag.length=0}var hp=no.ReactCurrentDispatcher,lg=no.ReactCurrentBatchConfig,La=0,pn=null,Hn=null,Gn=null,Yp=!1,ku=!1,Yu=0,PR=0;function dr(){throw Error(be(321))}function Cw(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Yi(e[n],t[n]))return!1;return!0}function Ew(e,t,n,r,i,s){if(La=s,pn=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,hp.current=e===null||e.memoizedState===null?RR:LR,e=n(r,i),ku){s=0;do{if(ku=!1,Yu=0,25<=s)throw Error(be(301));s+=1,Gn=Hn=null,t.updateQueue=null,hp.current=OR,e=n(r,i)}while(ku)}if(hp.current=Gp,t=Hn!==null&&Hn.next!==null,La=0,Gn=Hn=pn=null,Yp=!1,t)throw Error(be(300));return e}function _w(){var e=Yu!==0;return Yu=0,e}function fs(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Gn===null?pn.memoizedState=Gn=e:Gn=Gn.next=e,Gn}function Ni(){if(Hn===null){var e=pn.alternate;e=e!==null?e.memoizedState:null}else e=Hn.next;var t=Gn===null?pn.memoizedState:Gn.next;if(t!==null)Gn=t,Hn=e;else{if(e===null)throw Error(be(310));Hn=e,e={memoizedState:Hn.memoizedState,baseState:Hn.baseState,baseQueue:Hn.baseQueue,queue:Hn.queue,next:null},Gn===null?pn.memoizedState=Gn=e:Gn=Gn.next=e}return Gn}function Gu(e,t){return typeof t=="function"?t(e):t}function cg(e){var t=Ni(),n=t.queue;if(n===null)throw Error(be(311));n.lastRenderedReducer=e;var r=Hn,i=r.baseQueue,s=n.pending;if(s!==null){if(i!==null){var o=i.next;i.next=s.next,s.next=o}r.baseQueue=i=s,n.pending=null}if(i!==null){s=i.next,r=r.baseState;var l=o=null,c=null,d=s;do{var u=d.lane;if((La&u)===u)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 f={lane:u,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null};c===null?(l=c=f,o=r):c=c.next=f,pn.lanes|=u,Oa|=u}d=d.next}while(d!==null&&d!==s);c===null?o=r:c.next=l,Yi(r,t.memoizedState)||(Fr=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){i=e;do s=i.lane,pn.lanes|=s,Oa|=s,i=i.next;while(i!==e)}else i===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function ug(e){var t=Ni(),n=t.queue;if(n===null)throw Error(be(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,s=t.memoizedState;if(i!==null){n.pending=null;var o=i=i.next;do s=e(s,o.action),o=o.next;while(o!==i);Yi(s,t.memoizedState)||(Fr=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),n.lastRenderedState=s}return[s,r]}function Uj(){}function Wj(e,t){var n=pn,r=Ni(),i=t(),s=!Yi(r.memoizedState,i);if(s&&(r.memoizedState=i,Fr=!0),r=r.queue,Pw(qj.bind(null,n,r,e),[e]),r.getSnapshot!==t||s||Gn!==null&&Gn.memoizedState.tag&1){if(n.flags|=2048,Xu(9,Kj.bind(null,n,r,i,t),void 0,null),Jn===null)throw Error(be(349));La&30||Vj(n,t,i)}return i}function Vj(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=pn.updateQueue,t===null?(t={lastEffect:null,stores:null},pn.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Kj(e,t,n,r){t.value=n,t.getSnapshot=r,Yj(t)&&Gj(e)}function qj(e,t,n){return n(function(){Yj(t)&&Gj(e)})}function Yj(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Yi(e,n)}catch{return!0}}function Gj(e){var t=Js(e,1);t!==null&&qi(t,e,1,-1)}function gb(e){var t=fs();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Gu,lastRenderedState:e},t.queue=e,e=e.dispatch=TR.bind(null,pn,e),[t.memoizedState,e]}function Xu(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=pn.updateQueue,t===null?(t={lastEffect:null,stores:null},pn.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 Xj(){return Ni().memoizedState}function mp(e,t,n,r){var i=fs();pn.flags|=e,i.memoizedState=Xu(1|t,n,void 0,r===void 0?null:r)}function Bh(e,t,n,r){var i=Ni();r=r===void 0?null:r;var s=void 0;if(Hn!==null){var o=Hn.memoizedState;if(s=o.destroy,r!==null&&Cw(r,o.deps)){i.memoizedState=Xu(t,n,s,r);return}}pn.flags|=e,i.memoizedState=Xu(1|t,n,s,r)}function yb(e,t){return mp(8390656,8,e,t)}function Pw(e,t){return Bh(2048,8,e,t)}function Jj(e,t){return Bh(4,2,e,t)}function Qj(e,t){return Bh(4,4,e,t)}function Zj(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 eC(e,t,n){return n=n!=null?n.concat([e]):null,Bh(4,4,Zj.bind(null,t,e),n)}function Aw(){}function tC(e,t){var n=Ni();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Cw(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function nC(e,t){var n=Ni();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Cw(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function rC(e,t,n){return La&21?(Yi(n,t)||(n=lj(),pn.lanes|=n,Oa|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Fr=!0),e.memoizedState=n)}function AR(e,t){var n=At;At=n!==0&&4>n?n:4,e(!0);var r=lg.transition;lg.transition={};try{e(!1),t()}finally{At=n,lg.transition=r}}function iC(){return Ni().memoizedState}function IR(e,t,n){var r=Do(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},sC(e))oC(t,n);else if(n=zj(e,t,n,r),n!==null){var i=Pr();qi(n,e,r,i),aC(n,t,r)}}function TR(e,t,n){var r=Do(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(sC(e))oC(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,l=s(o,n);if(i.hasEagerState=!0,i.eagerState=l,Yi(l,o)){var c=t.interleaved;c===null?(i.next=i,bw(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}finally{}n=zj(e,t,i,r),n!==null&&(i=Pr(),qi(n,e,r,i),aC(n,t,r))}}function sC(e){var t=e.alternate;return e===pn||t!==null&&t===pn}function oC(e,t){ku=Yp=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function aC(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,aw(e,n)}}var Gp={readContext:Si,useCallback:dr,useContext:dr,useEffect:dr,useImperativeHandle:dr,useInsertionEffect:dr,useLayoutEffect:dr,useMemo:dr,useReducer:dr,useRef:dr,useState:dr,useDebugValue:dr,useDeferredValue:dr,useTransition:dr,useMutableSource:dr,useSyncExternalStore:dr,useId:dr,unstable_isNewReconciler:!1},RR={readContext:Si,useCallback:function(e,t){return fs().memoizedState=[e,t===void 0?null:t],e},useContext:Si,useEffect:yb,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,mp(4194308,4,Zj.bind(null,t,e),n)},useLayoutEffect:function(e,t){return mp(4194308,4,e,t)},useInsertionEffect:function(e,t){return mp(4,2,e,t)},useMemo:function(e,t){var n=fs();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=fs();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=IR.bind(null,pn,e),[r.memoizedState,e]},useRef:function(e){var t=fs();return e={current:e},t.memoizedState=e},useState:gb,useDebugValue:Aw,useDeferredValue:function(e){return fs().memoizedState=e},useTransition:function(){var e=gb(!1),t=e[0];return e=AR.bind(null,e[1]),fs().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=pn,i=fs();if(nn){if(n===void 0)throw Error(be(407));n=n()}else{if(n=t(),Jn===null)throw Error(be(349));La&30||Vj(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,yb(qj.bind(null,r,s,e),[e]),r.flags|=2048,Xu(9,Kj.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=fs(),t=Jn.identifierPrefix;if(nn){var n=Vs,r=Ws;n=(r&~(1<<32-Ki(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Yu++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=PR++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},LR={readContext:Si,useCallback:tC,useContext:Si,useEffect:Pw,useImperativeHandle:eC,useInsertionEffect:Jj,useLayoutEffect:Qj,useMemo:nC,useReducer:cg,useRef:Xj,useState:function(){return cg(Gu)},useDebugValue:Aw,useDeferredValue:function(e){var t=Ni();return rC(t,Hn.memoizedState,e)},useTransition:function(){var e=cg(Gu)[0],t=Ni().memoizedState;return[e,t]},useMutableSource:Uj,useSyncExternalStore:Wj,useId:iC,unstable_isNewReconciler:!1},OR={readContext:Si,useCallback:tC,useContext:Si,useEffect:Pw,useImperativeHandle:eC,useInsertionEffect:Jj,useLayoutEffect:Qj,useMemo:nC,useReducer:ug,useRef:Xj,useState:function(){return ug(Gu)},useDebugValue:Aw,useDeferredValue:function(e){var t=Ni();return Hn===null?t.memoizedState=e:rC(t,Hn.memoizedState,e)},useTransition:function(){var e=ug(Gu)[0],t=Ni().memoizedState;return[e,t]},useMutableSource:Uj,useSyncExternalStore:Wj,useId:iC,unstable_isNewReconciler:!1};function Di(e,t){if(e&&e.defaultProps){t=hn({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Dy(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:hn({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Hh={isMounted:function(e){return(e=e._reactInternals)?Ua(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Pr(),i=Do(e),s=Ys(r,i);s.payload=t,n!=null&&(s.callback=n),t=Mo(e,s,i),t!==null&&(qi(t,e,i,r),pp(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Pr(),i=Do(e),s=Ys(r,i);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=Mo(e,s,i),t!==null&&(qi(t,e,i,r),pp(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Pr(),r=Do(e),i=Ys(n,r);i.tag=2,t!=null&&(i.callback=t),t=Mo(e,i,r),t!==null&&(qi(t,e,r,n),pp(t,e,r))}};function xb(e,t,n,r,i,s,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,s,o):t.prototype&&t.prototype.isPureReactComponent?!Hu(n,r)||!Hu(i,s):!0}function lC(e,t,n){var r=!1,i=Wo,s=t.contextType;return typeof s=="object"&&s!==null?s=Si(s):(i=Vr(t)?Ta:mr.current,r=t.contextTypes,s=(r=r!=null)?Gl(e,i):Wo),t=new t(n,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Hh,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=s),t}function wb(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&&Hh.enqueueReplaceState(t,t.state,null)}function Fy(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},kw(e);var s=t.contextType;typeof s=="object"&&s!==null?i.context=Si(s):(s=Vr(t)?Ta:mr.current,i.context=Gl(e,s)),i.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(Dy(e,t,s,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(t=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),t!==i.state&&Hh.enqueueReplaceState(i,i.state,null),Kp(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function Zl(e,t){try{var n="",r=t;do n+=c2(r),r=r.return;while(r);var i=n}catch(s){i=`
|
|
39
|
-
Error generating stack: `+s.message+`
|
|
40
|
-
`+s.stack}return{value:e,source:t,stack:i,digest:null}}function dg(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function zy(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var MR=typeof WeakMap=="function"?WeakMap:Map;function cC(e,t,n){n=Ys(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Jp||(Jp=!0,Xy=r),zy(e,t)},n}function uC(e,t,n){n=Ys(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){zy(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){zy(e,t),typeof r!="function"&&($o===null?$o=new Set([this]):$o.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function vb(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new MR;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=XR.bind(null,e,t,n),t.then(e,e))}function bb(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 kb(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,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=Ys(-1,1),t.tag=2,Mo(n,t,1))),n.lanes|=1),e)}var $R=no.ReactCurrentOwner,Fr=!1;function Er(e,t,n,r){t.child=e===null?Fj(t,null,n,r):Jl(t,e.child,n,r)}function Sb(e,t,n,r,i){n=n.render;var s=t.ref;return Bl(t,i),r=Ew(e,t,n,r,s,i),n=_w(),e!==null&&!Fr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Qs(e,t,i)):(nn&&n&&mw(t),t.flags|=1,Er(e,t,r,i),t.child)}function Nb(e,t,n,r,i){if(e===null){var s=n.type;return typeof s=="function"&&!Dw(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=s,dC(e,t,s,r,i)):(e=wp(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!(e.lanes&i)){var o=s.memoizedProps;if(n=n.compare,n=n!==null?n:Hu,n(o,r)&&e.ref===t.ref)return Qs(e,t,i)}return t.flags|=1,e=Fo(s,r),e.ref=t.ref,e.return=t,t.child=e}function dC(e,t,n,r,i){if(e!==null){var s=e.memoizedProps;if(Hu(s,r)&&e.ref===t.ref)if(Fr=!1,t.pendingProps=r=s,(e.lanes&i)!==0)e.flags&131072&&(Fr=!0);else return t.lanes=e.lanes,Qs(e,t,i)}return By(e,t,n,r,i)}function fC(e,t,n){var r=t.pendingProps,i=r.children,s=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Bt(Pl,ti),ti|=n;else{if(!(n&1073741824))return e=s!==null?s.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Bt(Pl,ti),ti|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,Bt(Pl,ti),ti|=r}else s!==null?(r=s.baseLanes|n,t.memoizedState=null):r=n,Bt(Pl,ti),ti|=r;return Er(e,t,i,n),t.child}function pC(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function By(e,t,n,r,i){var s=Vr(n)?Ta:mr.current;return s=Gl(t,s),Bl(t,i),n=Ew(e,t,n,r,s,i),r=_w(),e!==null&&!Fr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Qs(e,t,i)):(nn&&r&&mw(t),t.flags|=1,Er(e,t,n,i),t.child)}function jb(e,t,n,r,i){if(Vr(n)){var s=!0;Bp(t)}else s=!1;if(Bl(t,i),t.stateNode===null)gp(e,t),lC(t,n,r),Fy(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,l=t.memoizedProps;o.props=l;var c=o.context,d=n.contextType;typeof d=="object"&&d!==null?d=Si(d):(d=Vr(n)?Ta:mr.current,d=Gl(t,d));var u=n.getDerivedStateFromProps,f=typeof u=="function"||typeof o.getSnapshotBeforeUpdate=="function";f||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==r||c!==d)&&wb(t,o,r,d),So=!1;var p=t.memoizedState;o.state=p,Kp(t,r,o,i),c=t.memoizedState,l!==r||p!==c||Wr.current||So?(typeof u=="function"&&(Dy(t,n,u,r),c=t.memoizedState),(l=So||xb(t,n,l,r,p,c,d))?(f||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=d,r=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,Bj(e,t),l=t.memoizedProps,d=t.type===t.elementType?l:Di(t.type,l),o.props=d,f=t.pendingProps,p=o.context,c=n.contextType,typeof c=="object"&&c!==null?c=Si(c):(c=Vr(n)?Ta:mr.current,c=Gl(t,c));var h=n.getDerivedStateFromProps;(u=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==f||p!==c)&&wb(t,o,r,c),So=!1,p=t.memoizedState,o.state=p,Kp(t,r,o,i);var g=t.memoizedState;l!==f||p!==g||Wr.current||So?(typeof h=="function"&&(Dy(t,n,h,r),g=t.memoizedState),(d=So||xb(t,n,d,r,p,g,c)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,g,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,g,c)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=g),o.props=r,o.state=g,o.context=c,r=d):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),r=!1)}return Hy(e,t,n,r,s,i)}function Hy(e,t,n,r,i,s){pC(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return i&&ub(t,n,!1),Qs(e,t,s);r=t.stateNode,$R.current=t;var l=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Jl(t,e.child,null,s),t.child=Jl(t,null,l,s)):Er(e,t,l,s),t.memoizedState=r.state,i&&ub(t,n,!0),t.child}function hC(e){var t=e.stateNode;t.pendingContext?cb(e,t.pendingContext,t.pendingContext!==t.context):t.context&&cb(e,t.context,!1),Sw(e,t.containerInfo)}function Cb(e,t,n,r,i){return Xl(),yw(i),t.flags|=256,Er(e,t,n,r),t.child}var Uy={dehydrated:null,treeContext:null,retryLane:0};function Wy(e){return{baseLanes:e,cachePool:null,transitions:null}}function mC(e,t,n){var r=t.pendingProps,i=fn.current,s=!1,o=(t.flags&128)!==0,l;if((l=o)||(l=e!==null&&e.memoizedState===null?!1:(i&2)!==0),l?(s=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),Bt(fn,i&1),e===null)return My(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):(o=r.children,e=r.fallback,s?(r=t.mode,s=t.child,o={mode:"hidden",children:o},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=Vh(o,r,0,null),e=Ea(e,r,n,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=Wy(n),t.memoizedState=Uy,e):Iw(t,o));if(i=e.memoizedState,i!==null&&(l=i.dehydrated,l!==null))return DR(e,t,o,r,l,i,n);if(s){s=r.fallback,o=t.mode,i=e.child,l=i.sibling;var c={mode:"hidden",children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Fo(i,c),r.subtreeFlags=i.subtreeFlags&14680064),l!==null?s=Fo(l,s):(s=Ea(s,o,n,null),s.flags|=2),s.return=t,r.return=t,r.sibling=s,t.child=r,r=s,s=t.child,o=e.child.memoizedState,o=o===null?Wy(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=e.childLanes&~n,t.memoizedState=Uy,r}return s=e.child,e=s.sibling,r=Fo(s,{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 Iw(e,t){return t=Vh({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function If(e,t,n,r){return r!==null&&yw(r),Jl(t,e.child,null,n),e=Iw(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function DR(e,t,n,r,i,s,o){if(n)return t.flags&256?(t.flags&=-257,r=dg(Error(be(422))),If(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=r.fallback,i=t.mode,r=Vh({mode:"visible",children:r.children},i,0,null),s=Ea(s,i,o,null),s.flags|=2,r.return=t,s.return=t,r.sibling=s,t.child=r,t.mode&1&&Jl(t,e.child,null,o),t.child.memoizedState=Wy(o),t.memoizedState=Uy,s);if(!(t.mode&1))return If(e,t,o,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var l=r.dgst;return r=l,s=Error(be(419)),r=dg(s,r,void 0),If(e,t,o,r)}if(l=(o&e.childLanes)!==0,Fr||l){if(r=Jn,r!==null){switch(o&-o){case 4:i=2;break;case 16:i=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:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,Js(e,i),qi(r,e,i,-1))}return $w(),r=dg(Error(be(421))),If(e,t,o,r)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=JR.bind(null,e),i._reactRetry=t,null):(e=s.treeContext,ii=Oo(i.nextSibling),oi=t,nn=!0,Bi=null,e!==null&&(yi[xi++]=Ws,yi[xi++]=Vs,yi[xi++]=Ra,Ws=e.id,Vs=e.overflow,Ra=t),t=Iw(t,r.children),t.flags|=4096,t)}function Eb(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),$y(e.return,t,n)}function fg(e,t,n,r,i){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=i)}function gC(e,t,n){var r=t.pendingProps,i=r.revealOrder,s=r.tail;if(Er(e,t,r.children,n),r=fn.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Eb(e,n,t);else if(e.tag===19)Eb(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(Bt(fn,r),!(t.mode&1))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&qp(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),fg(t,!1,i,n,s);break;case"backwards":for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&qp(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}fg(t,!0,n,null,s);break;case"together":fg(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function gp(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Qs(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Oa|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(be(153));if(t.child!==null){for(e=t.child,n=Fo(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Fo(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function FR(e,t,n){switch(t.tag){case 3:hC(t),Xl();break;case 5:Hj(t);break;case 1:Vr(t.type)&&Bp(t);break;case 4:Sw(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;Bt(Wp,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(Bt(fn,fn.current&1),t.flags|=128,null):n&t.child.childLanes?mC(e,t,n):(Bt(fn,fn.current&1),e=Qs(e,t,n),e!==null?e.sibling:null);Bt(fn,fn.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return gC(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Bt(fn,fn.current),r)break;return null;case 22:case 23:return t.lanes=0,fC(e,t,n)}return Qs(e,t,n)}var yC,Vy,xC,wC;yC=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}};Vy=function(){};xC=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,Na(bs.current);var s=null;switch(n){case"input":i=py(e,i),r=py(e,r),s=[];break;case"select":i=hn({},i,{value:void 0}),r=hn({},r,{value:void 0}),s=[];break;case"textarea":i=gy(e,i),r=gy(e,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Fp)}xy(n,r);var o;n=null;for(d in i)if(!r.hasOwnProperty(d)&&i.hasOwnProperty(d)&&i[d]!=null)if(d==="style"){var l=i[d];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else d!=="dangerouslySetInnerHTML"&&d!=="children"&&d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&d!=="autoFocus"&&(Ou.hasOwnProperty(d)?s||(s=[]):(s=s||[]).push(d,null));for(d in r){var c=r[d];if(l=i!=null?i[d]:void 0,r.hasOwnProperty(d)&&c!==l&&(c!=null||l!=null))if(d==="style")if(l){for(o in l)!l.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in c)c.hasOwnProperty(o)&&l[o]!==c[o]&&(n||(n={}),n[o]=c[o])}else n||(s||(s=[]),s.push(d,n)),n=c;else d==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(s=s||[]).push(d,c)):d==="children"?typeof c!="string"&&typeof c!="number"||(s=s||[]).push(d,""+c):d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&(Ou.hasOwnProperty(d)?(c!=null&&d==="onScroll"&&qt("scroll",e),s||l===c||(s=[])):(s=s||[]).push(d,c))}n&&(s=s||[]).push("style",n);var d=s;(t.updateQueue=d)&&(t.flags|=4)}};wC=function(e,t,n,r){n!==r&&(t.flags|=4)};function Yc(e,t){if(!nn)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 fr(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function zR(e,t,n){var r=t.pendingProps;switch(gw(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return fr(t),null;case 1:return Vr(t.type)&&zp(),fr(t),null;case 3:return r=t.stateNode,Ql(),Gt(Wr),Gt(mr),jw(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Pf(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Bi!==null&&(Zy(Bi),Bi=null))),Vy(e,t),fr(t),null;case 5:Nw(t);var i=Na(qu.current);if(n=t.type,e!==null&&t.stateNode!=null)xC(e,t,n,r,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(be(166));return fr(t),null}if(e=Na(bs.current),Pf(t)){r=t.stateNode,n=t.type;var s=t.memoizedProps;switch(r[gs]=t,r[Vu]=s,e=(t.mode&1)!==0,n){case"dialog":qt("cancel",r),qt("close",r);break;case"iframe":case"object":case"embed":qt("load",r);break;case"video":case"audio":for(i=0;i<uu.length;i++)qt(uu[i],r);break;case"source":qt("error",r);break;case"img":case"image":case"link":qt("error",r),qt("load",r);break;case"details":qt("toggle",r);break;case"input":M0(r,s),qt("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},qt("invalid",r);break;case"textarea":D0(r,s),qt("invalid",r)}xy(n,s),i=null;for(var o in s)if(s.hasOwnProperty(o)){var l=s[o];o==="children"?typeof l=="string"?r.textContent!==l&&(s.suppressHydrationWarning!==!0&&_f(r.textContent,l,e),i=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(s.suppressHydrationWarning!==!0&&_f(r.textContent,l,e),i=["children",""+l]):Ou.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&qt("scroll",r)}switch(n){case"input":vf(r),$0(r,s,!0);break;case"textarea":vf(r),F0(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=Fp)}r=i,t.updateQueue=r,r!==null&&(t.flags|=4)}else{o=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=q1(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[gs]=t,e[Vu]=r,yC(e,t,!1,!1),t.stateNode=e;e:{switch(o=wy(n,r),n){case"dialog":qt("cancel",e),qt("close",e),i=r;break;case"iframe":case"object":case"embed":qt("load",e),i=r;break;case"video":case"audio":for(i=0;i<uu.length;i++)qt(uu[i],e);i=r;break;case"source":qt("error",e),i=r;break;case"img":case"image":case"link":qt("error",e),qt("load",e),i=r;break;case"details":qt("toggle",e),i=r;break;case"input":M0(e,r),i=py(e,r),qt("invalid",e);break;case"option":i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=hn({},r,{value:void 0}),qt("invalid",e);break;case"textarea":D0(e,r),i=gy(e,r),qt("invalid",e);break;default:i=r}xy(n,i),l=i;for(s in l)if(l.hasOwnProperty(s)){var c=l[s];s==="style"?X1(e,c):s==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&Y1(e,c)):s==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Mu(e,c):typeof c=="number"&&Mu(e,""+c):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(Ou.hasOwnProperty(s)?c!=null&&s==="onScroll"&&qt("scroll",e):c!=null&&tw(e,s,c,o))}switch(n){case"input":vf(e),$0(e,r,!1);break;case"textarea":vf(e),F0(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Uo(r.value));break;case"select":e.multiple=!!r.multiple,s=r.value,s!=null?$l(e,!!r.multiple,s,!1):r.defaultValue!=null&&$l(e,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=Fp)}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 fr(t),null;case 6:if(e&&t.stateNode!=null)wC(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(be(166));if(n=Na(qu.current),Na(bs.current),Pf(t)){if(r=t.stateNode,n=t.memoizedProps,r[gs]=t,(s=r.nodeValue!==n)&&(e=oi,e!==null))switch(e.tag){case 3:_f(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&_f(r.nodeValue,n,(e.mode&1)!==0)}s&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[gs]=t,t.stateNode=r}return fr(t),null;case 13:if(Gt(fn),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(nn&&ii!==null&&t.mode&1&&!(t.flags&128))$j(),Xl(),t.flags|=98560,s=!1;else if(s=Pf(t),r!==null&&r.dehydrated!==null){if(e===null){if(!s)throw Error(be(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(be(317));s[gs]=t}else Xl(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;fr(t),s=!1}else Bi!==null&&(Zy(Bi),Bi=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||fn.current&1?Wn===0&&(Wn=3):$w())),t.updateQueue!==null&&(t.flags|=4),fr(t),null);case 4:return Ql(),Vy(e,t),e===null&&Uu(t.stateNode.containerInfo),fr(t),null;case 10:return vw(t.type._context),fr(t),null;case 17:return Vr(t.type)&&zp(),fr(t),null;case 19:if(Gt(fn),s=t.memoizedState,s===null)return fr(t),null;if(r=(t.flags&128)!==0,o=s.rendering,o===null)if(r)Yc(s,!1);else{if(Wn!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=qp(e),o!==null){for(t.flags|=128,Yc(s,!1),r=o.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)s=n,e=r,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,e=o.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Bt(fn,fn.current&1|2),t.child}e=e.sibling}s.tail!==null&&En()>ec&&(t.flags|=128,r=!0,Yc(s,!1),t.lanes=4194304)}else{if(!r)if(e=qp(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Yc(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!nn)return fr(t),null}else 2*En()-s.renderingStartTime>ec&&n!==1073741824&&(t.flags|=128,r=!0,Yc(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(n=s.last,n!==null?n.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=En(),t.sibling=null,n=fn.current,Bt(fn,r?n&1|2:n&1),t):(fr(t),null);case 22:case 23:return Mw(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?ti&1073741824&&(fr(t),t.subtreeFlags&6&&(t.flags|=8192)):fr(t),null;case 24:return null;case 25:return null}throw Error(be(156,t.tag))}function BR(e,t){switch(gw(t),t.tag){case 1:return Vr(t.type)&&zp(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ql(),Gt(Wr),Gt(mr),jw(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Nw(t),null;case 13:if(Gt(fn),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(be(340));Xl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Gt(fn),null;case 4:return Ql(),null;case 10:return vw(t.type._context),null;case 22:case 23:return Mw(),null;case 24:return null;default:return null}}var Tf=!1,pr=!1,HR=typeof WeakSet=="function"?WeakSet:Set,Le=null;function _l(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){vn(e,t,r)}else n.current=null}function Ky(e,t,n){try{n()}catch(r){vn(e,t,r)}}var _b=!1;function UR(e,t){if(Py=Mp,e=Nj(),hw(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 i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,d=0,u=0,f=e,p=null;t:for(;;){for(var h;f!==n||i!==0&&f.nodeType!==3||(l=o+i),f!==s||r!==0&&f.nodeType!==3||(c=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(h=f.firstChild)!==null;)p=f,f=h;for(;;){if(f===e)break t;if(p===n&&++d===i&&(l=o),p===s&&++u===r&&(c=o),(h=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=h}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ay={focusedElem:e,selectionRange:n},Mp=!1,Le=t;Le!==null;)if(t=Le,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Le=e;else for(;Le!==null;){t=Le;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var b=g.memoizedProps,S=g.memoizedState,x=t.stateNode,w=x.getSnapshotBeforeUpdate(t.elementType===t.type?b:Di(t.type,b),S);x.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var v=t.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(be(163))}}catch(k){vn(t,t.return,k)}if(e=t.sibling,e!==null){e.return=t.return,Le=e;break}Le=t.return}return g=_b,_b=!1,g}function Su(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,s!==void 0&&Ky(t,n,s)}i=i.next}while(i!==r)}}function Uh(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 qy(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 vC(e){var t=e.alternate;t!==null&&(e.alternate=null,vC(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[gs],delete t[Vu],delete t[Ry],delete t[jR],delete t[CR])),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 bC(e){return e.tag===5||e.tag===3||e.tag===4}function Pb(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||bC(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 Yy(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=Fp));else if(r!==4&&(e=e.child,e!==null))for(Yy(e,t,n),e=e.sibling;e!==null;)Yy(e,t,n),e=e.sibling}function Gy(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(Gy(e,t,n),e=e.sibling;e!==null;)Gy(e,t,n),e=e.sibling}var nr=null,Fi=!1;function go(e,t,n){for(n=n.child;n!==null;)kC(e,t,n),n=n.sibling}function kC(e,t,n){if(vs&&typeof vs.onCommitFiberUnmount=="function")try{vs.onCommitFiberUnmount(Oh,n)}catch{}switch(n.tag){case 5:pr||_l(n,t);case 6:var r=nr,i=Fi;nr=null,go(e,t,n),nr=r,Fi=i,nr!==null&&(Fi?(e=nr,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):nr.removeChild(n.stateNode));break;case 18:nr!==null&&(Fi?(e=nr,n=n.stateNode,e.nodeType===8?sg(e.parentNode,n):e.nodeType===1&&sg(e,n),zu(e)):sg(nr,n.stateNode));break;case 4:r=nr,i=Fi,nr=n.stateNode.containerInfo,Fi=!0,go(e,t,n),nr=r,Fi=i;break;case 0:case 11:case 14:case 15:if(!pr&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Ky(n,t,o),i=i.next}while(i!==r)}go(e,t,n);break;case 1:if(!pr&&(_l(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){vn(n,t,l)}go(e,t,n);break;case 21:go(e,t,n);break;case 22:n.mode&1?(pr=(r=pr)||n.memoizedState!==null,go(e,t,n),pr=r):go(e,t,n);break;default:go(e,t,n)}}function Ab(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new HR),t.forEach(function(r){var i=QR.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Mi(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var s=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 5:nr=l.stateNode,Fi=!1;break e;case 3:nr=l.stateNode.containerInfo,Fi=!0;break e;case 4:nr=l.stateNode.containerInfo,Fi=!0;break e}l=l.return}if(nr===null)throw Error(be(160));kC(s,o,i),nr=null,Fi=!1;var c=i.alternate;c!==null&&(c.return=null),i.return=null}catch(d){vn(i,t,d)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)SC(t,e),t=t.sibling}function SC(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Mi(t,e),ds(e),r&4){try{Su(3,e,e.return),Uh(3,e)}catch(b){vn(e,e.return,b)}try{Su(5,e,e.return)}catch(b){vn(e,e.return,b)}}break;case 1:Mi(t,e),ds(e),r&512&&n!==null&&_l(n,n.return);break;case 5:if(Mi(t,e),ds(e),r&512&&n!==null&&_l(n,n.return),e.flags&32){var i=e.stateNode;try{Mu(i,"")}catch(b){vn(e,e.return,b)}}if(r&4&&(i=e.stateNode,i!=null)){var s=e.memoizedProps,o=n!==null?n.memoizedProps:s,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&s.type==="radio"&&s.name!=null&&V1(i,s),wy(l,o);var d=wy(l,s);for(o=0;o<c.length;o+=2){var u=c[o],f=c[o+1];u==="style"?X1(i,f):u==="dangerouslySetInnerHTML"?Y1(i,f):u==="children"?Mu(i,f):tw(i,u,f,d)}switch(l){case"input":hy(i,s);break;case"textarea":K1(i,s);break;case"select":var p=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var h=s.value;h!=null?$l(i,!!s.multiple,h,!1):p!==!!s.multiple&&(s.defaultValue!=null?$l(i,!!s.multiple,s.defaultValue,!0):$l(i,!!s.multiple,s.multiple?[]:"",!1))}i[Vu]=s}catch(b){vn(e,e.return,b)}}break;case 6:if(Mi(t,e),ds(e),r&4){if(e.stateNode===null)throw Error(be(162));i=e.stateNode,s=e.memoizedProps;try{i.nodeValue=s}catch(b){vn(e,e.return,b)}}break;case 3:if(Mi(t,e),ds(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{zu(t.containerInfo)}catch(b){vn(e,e.return,b)}break;case 4:Mi(t,e),ds(e);break;case 13:Mi(t,e),ds(e),i=e.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(Lw=En())),r&4&&Ab(e);break;case 22:if(u=n!==null&&n.memoizedState!==null,e.mode&1?(pr=(d=pr)||u,Mi(t,e),pr=d):Mi(t,e),ds(e),r&8192){if(d=e.memoizedState!==null,(e.stateNode.isHidden=d)&&!u&&e.mode&1)for(Le=e,u=e.child;u!==null;){for(f=Le=u;Le!==null;){switch(p=Le,h=p.child,p.tag){case 0:case 11:case 14:case 15:Su(4,p,p.return);break;case 1:_l(p,p.return);var g=p.stateNode;if(typeof g.componentWillUnmount=="function"){r=p,n=p.return;try{t=r,g.props=t.memoizedProps,g.state=t.memoizedState,g.componentWillUnmount()}catch(b){vn(r,n,b)}}break;case 5:_l(p,p.return);break;case 22:if(p.memoizedState!==null){Tb(f);continue}}h!==null?(h.return=p,Le=h):Tb(f)}u=u.sibling}e:for(u=null,f=e;;){if(f.tag===5){if(u===null){u=f;try{i=f.stateNode,d?(s=i.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(l=f.stateNode,c=f.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=G1("display",o))}catch(b){vn(e,e.return,b)}}}else if(f.tag===6){if(u===null)try{f.stateNode.nodeValue=d?"":f.memoizedProps}catch(b){vn(e,e.return,b)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;u===f&&(u=null),f=f.return}u===f&&(u=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Mi(t,e),ds(e),r&4&&Ab(e);break;case 21:break;default:Mi(t,e),ds(e)}}function ds(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(bC(n)){var r=n;break e}n=n.return}throw Error(be(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(Mu(i,""),r.flags&=-33);var s=Pb(e);Gy(e,s,i);break;case 3:case 4:var o=r.stateNode.containerInfo,l=Pb(e);Yy(e,l,o);break;default:throw Error(be(161))}}catch(c){vn(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function WR(e,t,n){Le=e,NC(e)}function NC(e,t,n){for(var r=(e.mode&1)!==0;Le!==null;){var i=Le,s=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||Tf;if(!o){var l=i.alternate,c=l!==null&&l.memoizedState!==null||pr;l=Tf;var d=pr;if(Tf=o,(pr=c)&&!d)for(Le=i;Le!==null;)o=Le,c=o.child,o.tag===22&&o.memoizedState!==null?Rb(i):c!==null?(c.return=o,Le=c):Rb(i);for(;s!==null;)Le=s,NC(s),s=s.sibling;Le=i,Tf=l,pr=d}Ib(e)}else i.subtreeFlags&8772&&s!==null?(s.return=i,Le=s):Ib(e)}}function Ib(e){for(;Le!==null;){var t=Le;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:pr||Uh(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!pr)if(n===null)r.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:Di(t.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;s!==null&&mb(t,s,r);break;case 3:var o=t.updateQueue;if(o!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}mb(t,o,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 u=d.memoizedState;if(u!==null){var f=u.dehydrated;f!==null&&zu(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(be(163))}pr||t.flags&512&&qy(t)}catch(p){vn(t,t.return,p)}}if(t===e){Le=null;break}if(n=t.sibling,n!==null){n.return=t.return,Le=n;break}Le=t.return}}function Tb(e){for(;Le!==null;){var t=Le;if(t===e){Le=null;break}var n=t.sibling;if(n!==null){n.return=t.return,Le=n;break}Le=t.return}}function Rb(e){for(;Le!==null;){var t=Le;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Uh(4,t)}catch(c){vn(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var i=t.return;try{r.componentDidMount()}catch(c){vn(t,i,c)}}var s=t.return;try{qy(t)}catch(c){vn(t,s,c)}break;case 5:var o=t.return;try{qy(t)}catch(c){vn(t,o,c)}}}catch(c){vn(t,t.return,c)}if(t===e){Le=null;break}var l=t.sibling;if(l!==null){l.return=t.return,Le=l;break}Le=t.return}}var VR=Math.ceil,Xp=no.ReactCurrentDispatcher,Tw=no.ReactCurrentOwner,ki=no.ReactCurrentBatchConfig,Ct=0,Jn=null,Tn=null,rr=0,ti=0,Pl=Qo(0),Wn=0,Ju=null,Oa=0,Wh=0,Rw=0,Nu=null,$r=null,Lw=0,ec=1/0,zs=null,Jp=!1,Xy=null,$o=null,Rf=!1,Po=null,Qp=0,ju=0,Jy=null,yp=-1,xp=0;function Pr(){return Ct&6?En():yp!==-1?yp:yp=En()}function Do(e){return e.mode&1?Ct&2&&rr!==0?rr&-rr:_R.transition!==null?(xp===0&&(xp=lj()),xp):(e=At,e!==0||(e=window.event,e=e===void 0?16:mj(e.type)),e):1}function qi(e,t,n,r){if(50<ju)throw ju=0,Jy=null,Error(be(185));bd(e,n,r),(!(Ct&2)||e!==Jn)&&(e===Jn&&(!(Ct&2)&&(Wh|=n),Wn===4&&Co(e,rr)),Kr(e,r),n===1&&Ct===0&&!(t.mode&1)&&(ec=En()+500,zh&&Zo()))}function Kr(e,t){var n=e.callbackNode;_2(e,t);var r=Op(e,e===Jn?rr:0);if(r===0)n!==null&&H0(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&H0(n),t===1)e.tag===0?ER(Lb.bind(null,e)):Lj(Lb.bind(null,e)),SR(function(){!(Ct&6)&&Zo()}),n=null;else{switch(cj(r)){case 1:n=ow;break;case 4:n=oj;break;case 16:n=Lp;break;case 536870912:n=aj;break;default:n=Lp}n=TC(n,jC.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function jC(e,t){if(yp=-1,xp=0,Ct&6)throw Error(be(327));var n=e.callbackNode;if(Hl()&&e.callbackNode!==n)return null;var r=Op(e,e===Jn?rr:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Zp(e,r);else{t=r;var i=Ct;Ct|=2;var s=EC();(Jn!==e||rr!==t)&&(zs=null,ec=En()+500,Ca(e,t));do try{YR();break}catch(l){CC(e,l)}while(!0);ww(),Xp.current=s,Ct=i,Tn!==null?t=0:(Jn=null,rr=0,t=Wn)}if(t!==0){if(t===2&&(i=Ny(e),i!==0&&(r=i,t=Qy(e,i))),t===1)throw n=Ju,Ca(e,0),Co(e,r),Kr(e,En()),n;if(t===6)Co(e,r);else{if(i=e.current.alternate,!(r&30)&&!KR(i)&&(t=Zp(e,r),t===2&&(s=Ny(e),s!==0&&(r=s,t=Qy(e,s))),t===1))throw n=Ju,Ca(e,0),Co(e,r),Kr(e,En()),n;switch(e.finishedWork=i,e.finishedLanes=r,t){case 0:case 1:throw Error(be(345));case 2:wa(e,$r,zs);break;case 3:if(Co(e,r),(r&130023424)===r&&(t=Lw+500-En(),10<t)){if(Op(e,0)!==0)break;if(i=e.suspendedLanes,(i&r)!==r){Pr(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=Ty(wa.bind(null,e,$r,zs),t);break}wa(e,$r,zs);break;case 4:if(Co(e,r),(r&4194240)===r)break;for(t=e.eventTimes,i=-1;0<r;){var o=31-Ki(r);s=1<<o,o=t[o],o>i&&(i=o),r&=~s}if(r=i,r=En()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*VR(r/1960))-r,10<r){e.timeoutHandle=Ty(wa.bind(null,e,$r,zs),r);break}wa(e,$r,zs);break;case 5:wa(e,$r,zs);break;default:throw Error(be(329))}}}return Kr(e,En()),e.callbackNode===n?jC.bind(null,e):null}function Qy(e,t){var n=Nu;return e.current.memoizedState.isDehydrated&&(Ca(e,t).flags|=256),e=Zp(e,t),e!==2&&(t=$r,$r=n,t!==null&&Zy(t)),e}function Zy(e){$r===null?$r=e:$r.push.apply($r,e)}function KR(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 i=n[r],s=i.getSnapshot;i=i.value;try{if(!Yi(s(),i))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 Co(e,t){for(t&=~Rw,t&=~Wh,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Ki(t),r=1<<n;e[n]=-1,t&=~r}}function Lb(e){if(Ct&6)throw Error(be(327));Hl();var t=Op(e,0);if(!(t&1))return Kr(e,En()),null;var n=Zp(e,t);if(e.tag!==0&&n===2){var r=Ny(e);r!==0&&(t=r,n=Qy(e,r))}if(n===1)throw n=Ju,Ca(e,0),Co(e,t),Kr(e,En()),n;if(n===6)throw Error(be(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,wa(e,$r,zs),Kr(e,En()),null}function Ow(e,t){var n=Ct;Ct|=1;try{return e(t)}finally{Ct=n,Ct===0&&(ec=En()+500,zh&&Zo())}}function Ma(e){Po!==null&&Po.tag===0&&!(Ct&6)&&Hl();var t=Ct;Ct|=1;var n=ki.transition,r=At;try{if(ki.transition=null,At=1,e)return e()}finally{At=r,ki.transition=n,Ct=t,!(Ct&6)&&Zo()}}function Mw(){ti=Pl.current,Gt(Pl)}function Ca(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,kR(n)),Tn!==null)for(n=Tn.return;n!==null;){var r=n;switch(gw(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&zp();break;case 3:Ql(),Gt(Wr),Gt(mr),jw();break;case 5:Nw(r);break;case 4:Ql();break;case 13:Gt(fn);break;case 19:Gt(fn);break;case 10:vw(r.type._context);break;case 22:case 23:Mw()}n=n.return}if(Jn=e,Tn=e=Fo(e.current,null),rr=ti=t,Wn=0,Ju=null,Rw=Wh=Oa=0,$r=Nu=null,Sa!==null){for(t=0;t<Sa.length;t++)if(n=Sa[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,s=n.pending;if(s!==null){var o=s.next;s.next=i,r.next=o}n.pending=r}Sa=null}return e}function CC(e,t){do{var n=Tn;try{if(ww(),hp.current=Gp,Yp){for(var r=pn.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}Yp=!1}if(La=0,Gn=Hn=pn=null,ku=!1,Yu=0,Tw.current=null,n===null||n.return===null){Wn=1,Ju=t,Tn=null;break}e:{var s=e,o=n.return,l=n,c=t;if(t=rr,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=c,u=l,f=u.tag;if(!(u.mode&1)&&(f===0||f===11||f===15)){var p=u.alternate;p?(u.updateQueue=p.updateQueue,u.memoizedState=p.memoizedState,u.lanes=p.lanes):(u.updateQueue=null,u.memoizedState=null)}var h=bb(o);if(h!==null){h.flags&=-257,kb(h,o,l,s,t),h.mode&1&&vb(s,d,t),t=h,c=d;var g=t.updateQueue;if(g===null){var b=new Set;b.add(c),t.updateQueue=b}else g.add(c);break e}else{if(!(t&1)){vb(s,d,t),$w();break e}c=Error(be(426))}}else if(nn&&l.mode&1){var S=bb(o);if(S!==null){!(S.flags&65536)&&(S.flags|=256),kb(S,o,l,s,t),yw(Zl(c,l));break e}}s=c=Zl(c,l),Wn!==4&&(Wn=2),Nu===null?Nu=[s]:Nu.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t;var x=cC(s,c,t);hb(s,x);break e;case 1:l=c;var w=s.type,v=s.stateNode;if(!(s.flags&128)&&(typeof w.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&($o===null||!$o.has(v)))){s.flags|=65536,t&=-t,s.lanes|=t;var k=uC(s,l,t);hb(s,k);break e}}s=s.return}while(s!==null)}PC(n)}catch(E){t=E,Tn===n&&n!==null&&(Tn=n=n.return);continue}break}while(!0)}function EC(){var e=Xp.current;return Xp.current=Gp,e===null?Gp:e}function $w(){(Wn===0||Wn===3||Wn===2)&&(Wn=4),Jn===null||!(Oa&268435455)&&!(Wh&268435455)||Co(Jn,rr)}function Zp(e,t){var n=Ct;Ct|=2;var r=EC();(Jn!==e||rr!==t)&&(zs=null,Ca(e,t));do try{qR();break}catch(i){CC(e,i)}while(!0);if(ww(),Ct=n,Xp.current=r,Tn!==null)throw Error(be(261));return Jn=null,rr=0,Wn}function qR(){for(;Tn!==null;)_C(Tn)}function YR(){for(;Tn!==null&&!w2();)_C(Tn)}function _C(e){var t=IC(e.alternate,e,ti);e.memoizedProps=e.pendingProps,t===null?PC(e):Tn=t,Tw.current=null}function PC(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=BR(n,t),n!==null){n.flags&=32767,Tn=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Wn=6,Tn=null;return}}else if(n=zR(n,t,ti),n!==null){Tn=n;return}if(t=t.sibling,t!==null){Tn=t;return}Tn=t=e}while(t!==null);Wn===0&&(Wn=5)}function wa(e,t,n){var r=At,i=ki.transition;try{ki.transition=null,At=1,GR(e,t,n,r)}finally{ki.transition=i,At=r}return null}function GR(e,t,n,r){do Hl();while(Po!==null);if(Ct&6)throw Error(be(327));n=e.finishedWork;var i=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(be(177));e.callbackNode=null,e.callbackPriority=0;var s=n.lanes|n.childLanes;if(P2(e,s),e===Jn&&(Tn=Jn=null,rr=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Rf||(Rf=!0,TC(Lp,function(){return Hl(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=ki.transition,ki.transition=null;var o=At;At=1;var l=Ct;Ct|=4,Tw.current=null,UR(e,n),SC(n,e),mR(Ay),Mp=!!Py,Ay=Py=null,e.current=n,WR(n),v2(),Ct=l,At=o,ki.transition=s}else e.current=n;if(Rf&&(Rf=!1,Po=e,Qp=i),s=e.pendingLanes,s===0&&($o=null),S2(n.stateNode),Kr(e,En()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)i=t[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(Jp)throw Jp=!1,e=Xy,Xy=null,e;return Qp&1&&e.tag!==0&&Hl(),s=e.pendingLanes,s&1?e===Jy?ju++:(ju=0,Jy=e):ju=0,Zo(),null}function Hl(){if(Po!==null){var e=cj(Qp),t=ki.transition,n=At;try{if(ki.transition=null,At=16>e?16:e,Po===null)var r=!1;else{if(e=Po,Po=null,Qp=0,Ct&6)throw Error(be(331));var i=Ct;for(Ct|=4,Le=e.current;Le!==null;){var s=Le,o=s.child;if(Le.flags&16){var l=s.deletions;if(l!==null){for(var c=0;c<l.length;c++){var d=l[c];for(Le=d;Le!==null;){var u=Le;switch(u.tag){case 0:case 11:case 15:Su(8,u,s)}var f=u.child;if(f!==null)f.return=u,Le=f;else for(;Le!==null;){u=Le;var p=u.sibling,h=u.return;if(vC(u),u===d){Le=null;break}if(p!==null){p.return=h,Le=p;break}Le=h}}}var g=s.alternate;if(g!==null){var b=g.child;if(b!==null){g.child=null;do{var S=b.sibling;b.sibling=null,b=S}while(b!==null)}}Le=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,Le=o;else e:for(;Le!==null;){if(s=Le,s.flags&2048)switch(s.tag){case 0:case 11:case 15:Su(9,s,s.return)}var x=s.sibling;if(x!==null){x.return=s.return,Le=x;break e}Le=s.return}}var w=e.current;for(Le=w;Le!==null;){o=Le;var v=o.child;if(o.subtreeFlags&2064&&v!==null)v.return=o,Le=v;else e:for(o=w;Le!==null;){if(l=Le,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Uh(9,l)}}catch(E){vn(l,l.return,E)}if(l===o){Le=null;break e}var k=l.sibling;if(k!==null){k.return=l.return,Le=k;break e}Le=l.return}}if(Ct=i,Zo(),vs&&typeof vs.onPostCommitFiberRoot=="function")try{vs.onPostCommitFiberRoot(Oh,e)}catch{}r=!0}return r}finally{At=n,ki.transition=t}}return!1}function Ob(e,t,n){t=Zl(n,t),t=cC(e,t,1),e=Mo(e,t,1),t=Pr(),e!==null&&(bd(e,1,t),Kr(e,t))}function vn(e,t,n){if(e.tag===3)Ob(e,e,n);else for(;t!==null;){if(t.tag===3){Ob(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&($o===null||!$o.has(r))){e=Zl(n,e),e=uC(t,e,1),t=Mo(t,e,1),e=Pr(),t!==null&&(bd(t,1,e),Kr(t,e));break}}t=t.return}}function XR(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Pr(),e.pingedLanes|=e.suspendedLanes&n,Jn===e&&(rr&n)===n&&(Wn===4||Wn===3&&(rr&130023424)===rr&&500>En()-Lw?Ca(e,0):Rw|=n),Kr(e,t)}function AC(e,t){t===0&&(e.mode&1?(t=Sf,Sf<<=1,!(Sf&130023424)&&(Sf=4194304)):t=1);var n=Pr();e=Js(e,t),e!==null&&(bd(e,t,n),Kr(e,n))}function JR(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),AC(e,n)}function QR(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(be(314))}r!==null&&r.delete(t),AC(e,n)}var IC;IC=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Wr.current)Fr=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Fr=!1,FR(e,t,n);Fr=!!(e.flags&131072)}else Fr=!1,nn&&t.flags&1048576&&Oj(t,Up,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;gp(e,t),e=t.pendingProps;var i=Gl(t,mr.current);Bl(t,n),i=Ew(null,t,r,e,i,n);var s=_w();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Vr(r)?(s=!0,Bp(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,kw(t),i.updater=Hh,t.stateNode=i,i._reactInternals=t,Fy(t,r,e,n),t=Hy(null,t,r,!0,s,n)):(t.tag=0,nn&&s&&mw(t),Er(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(gp(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=eL(r),e=Di(r,e),i){case 0:t=By(null,t,r,e,n);break e;case 1:t=jb(null,t,r,e,n);break e;case 11:t=Sb(null,t,r,e,n);break e;case 14:t=Nb(null,t,r,Di(r.type,e),n);break e}throw Error(be(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Di(r,i),By(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Di(r,i),jb(e,t,r,i,n);case 3:e:{if(hC(t),e===null)throw Error(be(387));r=t.pendingProps,s=t.memoizedState,i=s.element,Bj(e,t),Kp(t,r,null,n);var o=t.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=Zl(Error(be(423)),t),t=Cb(e,t,r,n,i);break e}else if(r!==i){i=Zl(Error(be(424)),t),t=Cb(e,t,r,n,i);break e}else for(ii=Oo(t.stateNode.containerInfo.firstChild),oi=t,nn=!0,Bi=null,n=Fj(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Xl(),r===i){t=Qs(e,t,n);break e}Er(e,t,r,n)}t=t.child}return t;case 5:return Hj(t),e===null&&My(t),r=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,Iy(r,i)?o=null:s!==null&&Iy(r,s)&&(t.flags|=32),pC(e,t),Er(e,t,o,n),t.child;case 6:return e===null&&My(t),null;case 13:return mC(e,t,n);case 4:return Sw(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Jl(t,null,r,n):Er(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Di(r,i),Sb(e,t,r,i,n);case 7:return Er(e,t,t.pendingProps,n),t.child;case 8:return Er(e,t,t.pendingProps.children,n),t.child;case 12:return Er(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,s=t.memoizedProps,o=i.value,Bt(Wp,r._currentValue),r._currentValue=o,s!==null)if(Yi(s.value,o)){if(s.children===i.children&&!Wr.current){t=Qs(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var l=s.dependencies;if(l!==null){o=s.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(s.tag===1){c=Ys(-1,n&-n),c.tag=2;var d=s.updateQueue;if(d!==null){d=d.shared;var u=d.pending;u===null?c.next=c:(c.next=u.next,u.next=c),d.pending=c}}s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),$y(s.return,n,t),l.lanes|=n;break}c=c.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(be(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),$y(o,n,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Er(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,Bl(t,n),i=Si(i),r=r(i),t.flags|=1,Er(e,t,r,n),t.child;case 14:return r=t.type,i=Di(r,t.pendingProps),i=Di(r.type,i),Nb(e,t,r,i,n);case 15:return dC(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Di(r,i),gp(e,t),t.tag=1,Vr(r)?(e=!0,Bp(t)):e=!1,Bl(t,n),lC(t,r,i),Fy(t,r,i,n),Hy(null,t,r,!0,e,n);case 19:return gC(e,t,n);case 22:return fC(e,t,n)}throw Error(be(156,t.tag))};function TC(e,t){return sj(e,t)}function ZR(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 bi(e,t,n,r){return new ZR(e,t,n,r)}function Dw(e){return e=e.prototype,!(!e||!e.isReactComponent)}function eL(e){if(typeof e=="function")return Dw(e)?1:0;if(e!=null){if(e=e.$$typeof,e===rw)return 11;if(e===iw)return 14}return 2}function Fo(e,t){var n=e.alternate;return n===null?(n=bi(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 wp(e,t,n,r,i,s){var o=2;if(r=e,typeof e=="function")Dw(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case wl:return Ea(n.children,i,s,t);case nw:o=8,i|=8;break;case cy:return e=bi(12,n,t,i|2),e.elementType=cy,e.lanes=s,e;case uy:return e=bi(13,n,t,i),e.elementType=uy,e.lanes=s,e;case dy:return e=bi(19,n,t,i),e.elementType=dy,e.lanes=s,e;case H1:return Vh(n,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case z1:o=10;break e;case B1:o=9;break e;case rw:o=11;break e;case iw:o=14;break e;case ko:o=16,r=null;break e}throw Error(be(130,e==null?e:typeof e,""))}return t=bi(o,n,t,i),t.elementType=e,t.type=r,t.lanes=s,t}function Ea(e,t,n,r){return e=bi(7,e,r,t),e.lanes=n,e}function Vh(e,t,n,r){return e=bi(22,e,r,t),e.elementType=H1,e.lanes=n,e.stateNode={isHidden:!1},e}function pg(e,t,n){return e=bi(6,e,null,t),e.lanes=n,e}function hg(e,t,n){return t=bi(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function tL(e,t,n,r,i){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=Ym(0),this.expirationTimes=Ym(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ym(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Fw(e,t,n,r,i,s,o,l,c){return e=new tL(e,t,n,l,c),t===1?(t=1,s===!0&&(t|=8)):t=0,s=bi(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},kw(s),e}function nL(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:xl,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function RC(e){if(!e)return Wo;e=e._reactInternals;e:{if(Ua(e)!==e||e.tag!==1)throw Error(be(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Vr(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(be(171))}if(e.tag===1){var n=e.type;if(Vr(n))return Rj(e,n,t)}return t}function LC(e,t,n,r,i,s,o,l,c){return e=Fw(n,r,!0,e,i,s,o,l,c),e.context=RC(null),n=e.current,r=Pr(),i=Do(n),s=Ys(r,i),s.callback=t??null,Mo(n,s,i),e.current.lanes=i,bd(e,i,r),Kr(e,r),e}function Kh(e,t,n,r){var i=t.current,s=Pr(),o=Do(i);return n=RC(n),t.context===null?t.context=n:t.pendingContext=n,t=Ys(s,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Mo(i,t,o),e!==null&&(qi(e,i,o,s),pp(e,i,o)),o}function eh(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 Mb(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function zw(e,t){Mb(e,t),(e=e.alternate)&&Mb(e,t)}function rL(){return null}var OC=typeof reportError=="function"?reportError:function(e){console.error(e)};function Bw(e){this._internalRoot=e}qh.prototype.render=Bw.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(be(409));Kh(e,t,null,null)};qh.prototype.unmount=Bw.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ma(function(){Kh(null,e,null,null)}),t[Xs]=null}};function qh(e){this._internalRoot=e}qh.prototype.unstable_scheduleHydration=function(e){if(e){var t=fj();e={blockedOn:null,target:e,priority:t};for(var n=0;n<jo.length&&t!==0&&t<jo[n].priority;n++);jo.splice(n,0,e),n===0&&hj(e)}};function Hw(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Yh(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function $b(){}function iL(e,t,n,r,i){if(i){if(typeof r=="function"){var s=r;r=function(){var d=eh(o);s.call(d)}}var o=LC(t,r,e,0,null,!1,!1,"",$b);return e._reactRootContainer=o,e[Xs]=o.current,Uu(e.nodeType===8?e.parentNode:e),Ma(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r=="function"){var l=r;r=function(){var d=eh(c);l.call(d)}}var c=Fw(e,0,!1,null,null,!1,!1,"",$b);return e._reactRootContainer=c,e[Xs]=c.current,Uu(e.nodeType===8?e.parentNode:e),Ma(function(){Kh(t,c,n,r)}),c}function Gh(e,t,n,r,i){var s=n._reactRootContainer;if(s){var o=s;if(typeof i=="function"){var l=i;i=function(){var c=eh(o);l.call(c)}}Kh(t,o,e,i)}else o=iL(n,t,e,i,r);return eh(o)}uj=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=cu(t.pendingLanes);n!==0&&(aw(t,n|1),Kr(t,En()),!(Ct&6)&&(ec=En()+500,Zo()))}break;case 13:Ma(function(){var r=Js(e,1);if(r!==null){var i=Pr();qi(r,e,1,i)}}),zw(e,1)}};lw=function(e){if(e.tag===13){var t=Js(e,134217728);if(t!==null){var n=Pr();qi(t,e,134217728,n)}zw(e,134217728)}};dj=function(e){if(e.tag===13){var t=Do(e),n=Js(e,t);if(n!==null){var r=Pr();qi(n,e,t,r)}zw(e,t)}};fj=function(){return At};pj=function(e,t){var n=At;try{return At=e,t()}finally{At=n}};by=function(e,t,n){switch(t){case"input":if(hy(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 i=Fh(r);if(!i)throw Error(be(90));W1(r),hy(r,i)}}}break;case"textarea":K1(e,n);break;case"select":t=n.value,t!=null&&$l(e,!!n.multiple,t,!1)}};Z1=Ow;ej=Ma;var sL={usingClientEntryPoint:!1,Events:[Sd,Sl,Fh,J1,Q1,Ow]},Gc={findFiberByHostInstance:ka,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},oL={bundleType:Gc.bundleType,version:Gc.version,rendererPackageName:Gc.rendererPackageName,rendererConfig:Gc.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:no.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=rj(e),e===null?null:e.stateNode},findFiberByHostInstance:Gc.findFiberByHostInstance||rL,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 Lf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Lf.isDisabled&&Lf.supportsFiber)try{Oh=Lf.inject(oL),vs=Lf}catch{}}ui.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=sL;ui.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Hw(t))throw Error(be(200));return nL(e,t,null,n)};ui.createRoot=function(e,t){if(!Hw(e))throw Error(be(299));var n=!1,r="",i=OC;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=Fw(e,1,!1,null,null,n,!1,r,i),e[Xs]=t.current,Uu(e.nodeType===8?e.parentNode:e),new Bw(t)};ui.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(be(188)):(e=Object.keys(e).join(","),Error(be(268,e)));return e=rj(t),e=e===null?null:e.stateNode,e};ui.flushSync=function(e){return Ma(e)};ui.hydrate=function(e,t,n){if(!Yh(t))throw Error(be(200));return Gh(null,e,t,!0,n)};ui.hydrateRoot=function(e,t,n){if(!Hw(e))throw Error(be(405));var r=n!=null&&n.hydratedSources||null,i=!1,s="",o=OC;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=LC(t,null,e,1,n??null,i,!1,s,o),e[Xs]=t.current,Uu(e),r)for(e=0;e<r.length;e++)n=r[e],i=n._getVersion,i=i(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,i]:t.mutableSourceEagerHydrationData.push(n,i);return new qh(t)};ui.render=function(e,t,n){if(!Yh(t))throw Error(be(200));return Gh(null,e,t,!1,n)};ui.unmountComponentAtNode=function(e){if(!Yh(e))throw Error(be(40));return e._reactRootContainer?(Ma(function(){Gh(null,null,e,!1,function(){e._reactRootContainer=null,e[Xs]=null})}),!0):!1};ui.unstable_batchedUpdates=Ow;ui.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Yh(n))throw Error(be(200));if(e==null||e._reactInternals===void 0)throw Error(be(38));return Gh(e,t,n,!1,r)};ui.version="18.3.1-next-f1338f8080-20240426";function MC(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(MC)}catch(e){console.error(e)}}MC(),M1.exports=ui;var Dr=M1.exports,Db=Dr;ay.createRoot=Db.createRoot,ay.hydrateRoot=Db.hydrateRoot;const $C=m.createContext(null);function ex(e){let t=e||"/";return t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t||"/"}function aL(){const e=ex(window.location.pathname);return e==="/"?(window.history.replaceState({},"","/projects"),"/projects"):e}function lL({children:e}){const[t,n]=m.useState(aL);m.useEffect(()=>{const s=()=>n(ex(window.location.pathname));return window.addEventListener("popstate",s),()=>window.removeEventListener("popstate",s)},[]);const r=m.useCallback(s=>{const o=s.startsWith("/")?s:`/${s}`;let l;try{l=new URL(o,window.location.origin)}catch{l=new URL("/",window.location.origin)}const c=ex(l.pathname),d=l.search||"";window.history.pushState({},"",c+d),n(c)},[]),i=m.useMemo(()=>({path:t,navigate:r}),[t,r]);return a.jsx($C.Provider,{value:i,children:e})}function Wa(){const e=m.useContext($C);if(!e)throw new Error("useRoute must be used within RouteProvider");return e}function cL(){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 Fb={};function tx(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];typeof t[0]=="string"&&Fb[t[0]]||(typeof t[0]=="string"&&(Fb[t[0]]=new Date),cL(...t))}const DC=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}};function zb(e,t,n){e.loadNamespaces(t,DC(e,n))}function Bb(e,t,n,r){typeof n=="string"&&(n=[n]),n.forEach(i=>{e.options.ns.indexOf(i)<0&&e.options.ns.push(i)}),e.loadLanguages(t,DC(e,r))}function uL(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=t.languages[0],i=t.options?t.options.fallbackLng:!1,s=t.languages[t.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const o=(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&&!o(t.isLanguageChangingTo,e)?!1:!!(t.hasResourceBundle(r,e)||!t.services.backendConnector.backend||t.options.resources&&!t.options.partialBundledLanguages||o(r,e)&&(!i||o(s,e)))}function dL(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(tx("i18n.languages were undefined or empty",t.languages),!0):t.options.ignoreJSONStructure!==void 0?t.hasLoadedNamespace(e,{lng:n.lng,precheck:(i,s)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&i.services.backendConnector.backend&&i.isLanguageChangingTo&&!s(i.isLanguageChangingTo,e))return!1}}):uL(e,t,n)}const fL=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,pL={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},hL=e=>pL[e],mL=e=>e.replace(fL,hL);let nx={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:mL};function gL(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};nx={...nx,...e}}function yL(){return nx}let FC;function xL(e){FC=e}function wL(){return FC}const vL={type:"3rdParty",init(e){gL(e.options.react),xL(e)}},bL=m.createContext();class kL{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const SL=(e,t)=>{const n=m.useRef();return m.useEffect(()=>{n.current=e},[e,t]),n.current};function Ut(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=t,{i18n:r,defaultNS:i}=m.useContext(bL)||{},s=n||r||wL();if(s&&!s.reportNamespaces&&(s.reportNamespaces=new kL),!s){tx("You will need to pass in an i18next instance by using initReactI18next");const v=(E,j)=>typeof j=="string"?j:j&&typeof j=="object"&&typeof j.defaultValue=="string"?j.defaultValue:Array.isArray(E)?E[E.length-1]:E,k=[v,{},!1];return k.t=v,k.i18n={},k.ready=!1,k}s.options.react&&s.options.react.wait!==void 0&&tx("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const o={...yL(),...s.options.react,...t},{useSuspense:l,keyPrefix:c}=o;let d=e||i||s.options&&s.options.defaultNS;d=typeof d=="string"?[d]:d||["translation"],s.reportNamespaces.addUsedNamespaces&&s.reportNamespaces.addUsedNamespaces(d);const u=(s.isInitialized||s.initializedStoreOnce)&&d.every(v=>dL(v,s,o));function f(){return s.getFixedT(t.lng||null,o.nsMode==="fallback"?d:d[0],c)}const[p,h]=m.useState(f);let g=d.join();t.lng&&(g=`${t.lng}${g}`);const b=SL(g),S=m.useRef(!0);m.useEffect(()=>{const{bindI18n:v,bindI18nStore:k}=o;S.current=!0,!u&&!l&&(t.lng?Bb(s,t.lng,d,()=>{S.current&&h(f)}):zb(s,d,()=>{S.current&&h(f)})),u&&b&&b!==g&&S.current&&h(f);function E(){S.current&&h(f)}return v&&s&&s.on(v,E),k&&s&&s.store.on(k,E),()=>{S.current=!1,v&&s&&v.split(" ").forEach(j=>s.off(j,E)),k&&s&&k.split(" ").forEach(j=>s.store.off(j,E))}},[s,g]);const x=m.useRef(!0);m.useEffect(()=>{S.current&&!x.current&&h(f),x.current=!1},[s,c]);const w=[p,s,u];if(w.t=p,w.i18n=s,w.ready=u,u||!u&&!l)return w;throw new Promise(v=>{t.lng?Bb(s,t.lng,d,()=>v()):zb(s,d,()=>v())})}const zC="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",NL=[{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:"/settings",labelKey:"common:nav.settings",icon:"settings"}],jL=[{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 CL(e,t){return t==="/projects"?e==="/projects"||e==="/":e===t||e.startsWith(t+"/")}function EL({authUser:e,onLogout:t}){const{path:n,navigate:r}=Wa(),{t:i}=Ut(),[s,o]=m.useState(!1);return m.useEffect(()=>{let l=!1;return fetch("/api/ui-context").then(c=>c.json()).then(c=>{l||o(!!c.hideCommunityLinks)}).catch(()=>{}),()=>{l=!0}},[]),a.jsxs("aside",{className:"af-sidebar","aria-label":i("flow:sidebar.mainNav"),children:[a.jsxs("div",{className:"af-brand",children:[a.jsx("div",{className:"af-brand-mark","aria-hidden":!0,children:a.jsx("img",{src:zC,alt:"",width:"36",height:"36",decoding:"async"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"af-brand-title",children:"Agentflow"}),a.jsx("p",{className:"af-brand-tag",children:"Orchestration Engine"})]})]}),a.jsx("nav",{className:"af-nav",children:NL.map(l=>a.jsxs("button",{type:"button",className:"af-nav-link"+(CL(n,l.to)?" af-nav-link--active":""),onClick:()=>r(l.to),children:[a.jsx("span",{className:"material-symbols-outlined",children:l.icon}),a.jsx("span",{children:i(l.labelKey)})]},l.to))}),a.jsxs("div",{className:"af-sidebar-footer",children:[a.jsxs("div",{className:"af-sidebar-user",title:(e==null?void 0:e.username)||(e==null?void 0:e.userId)||"",children:[a.jsx("span",{className:"material-symbols-outlined",children:"person"}),a.jsx("span",{children:(e==null?void 0:e.username)||(e==null?void 0:e.userId)||""}),a.jsx("button",{type:"button",className:"af-sidebar-logout",onClick:t,"aria-label":"Logout",title:"Logout",children:a.jsx("span",{className:"material-symbols-outlined",children:"logout"})})]}),!s&&jL.map(l=>{const c=i(l.labelKey);return a.jsx("a",{className:"af-sidebar-ext",href:l.href,target:"_blank",rel:"noopener noreferrer","aria-label":c,title:c,children:a.jsx("span",{className:"material-symbols-outlined",children:l.icon})},l.href)})]})]})}const BC="agentflow.pipelineRecent",_L=50,PL=15;function AL(e){try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function HC(){if(typeof localStorage>"u")return[];const e=localStorage.getItem(BC);return e?AL(e).filter(t=>t&&typeof t.flowId=="string"&&(t.flowSource==="user"||t.flowSource==="builtin"||t.flowSource==="workspace")&&t.kind==="opened"&&typeof t.at=="number"):[]}function Of(e,t){if(typeof localStorage>"u")return;const n=Date.now(),r=HC(),s=[{flowId:e,flowSource:t,kind:"opened",at:n},...r.filter(o=>!(o.flowId===e&&o.flowSource===t))].slice(0,_L);try{localStorage.setItem(BC,JSON.stringify(s))}catch{}}function IL(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==="builtin")?"builtin":n[0].source??"user"}function rx(e,t){const n=Date.now(),r=Math.max(0,n-e),i=Math.floor(r/1e3);if(i<60)return t("flow:time.justNow");const s=Math.floor(i/60);if(s<60)return t("flow:time.minutesAgo",{n:s});const o=Math.floor(s/60);if(o<24)return t("flow:time.hoursAgo",{n:o});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 u=Math.floor(o/24);return u<7?t("flow:time.daysAgo",{n:u}):`${l.getMonth()+1}/${l.getDate()}`}function TL(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 RL(e,t,n){const r=[];for(const i of e)!i||typeof i.flowId!="string"||typeof i.at!="number"||r.push({flowId:i.flowId,flowSource:IL(n,i.flowId),kind:"executed",at:i.at});for(const i of t)r.push({flowId:i.flowId,flowSource:i.flowSource,kind:"opened",at:i.at});return r.sort((i,s)=>s.at-i.at),r.slice(0,PL)}var ni=Uint8Array,Al=Uint16Array,LL=Int32Array,UC=new ni([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]),WC=new ni([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]),OL=new ni([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),VC=function(e,t){for(var n=new Al(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new LL(n[30]),r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)i[s]=s-n[r]<<5|r;return{b:n,r:i}},KC=VC(UC,2),qC=KC.b,ML=KC.r;qC[28]=258,ML[258]=28;var $L=VC(WC,0),DL=$L.b,ix=new Al(32768);for(var Yt=0;Yt<32768;++Yt){var yo=(Yt&43690)>>1|(Yt&21845)<<1;yo=(yo&52428)>>2|(yo&13107)<<2,yo=(yo&61680)>>4|(yo&3855)<<4,ix[Yt]=((yo&65280)>>8|(yo&255)<<8)>>1}var Cu=function(e,t,n){for(var r=e.length,i=0,s=new Al(t);i<r;++i)e[i]&&++s[e[i]-1];var o=new Al(t);for(i=1;i<t;++i)o[i]=o[i-1]+s[i-1]<<1;var l;if(n){l=new Al(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var d=i<<4|e[i],u=t-e[i],f=o[e[i]-1]++<<u,p=f|(1<<u)-1;f<=p;++f)l[ix[f]>>c]=d}else for(l=new Al(r),i=0;i<r;++i)e[i]&&(l[i]=ix[o[e[i]-1]++]>>15-e[i]);return l},jd=new ni(288);for(var Yt=0;Yt<144;++Yt)jd[Yt]=8;for(var Yt=144;Yt<256;++Yt)jd[Yt]=9;for(var Yt=256;Yt<280;++Yt)jd[Yt]=7;for(var Yt=280;Yt<288;++Yt)jd[Yt]=8;var YC=new ni(32);for(var Yt=0;Yt<32;++Yt)YC[Yt]=5;var FL=Cu(jd,9,1),zL=Cu(YC,5,1),mg=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},$i=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},gg=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},BL=function(e){return(e+7)/8|0},Uw=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new ni(e.subarray(t,n))},HL=["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"],gi=function(e,t,n){var r=new Error(t||HL[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,gi),!n)throw r;return r},UL=function(e,t,n,r){var i=e.length,s=r?r.length:0;if(!i||t.f&&!t.l)return n||new ni(0);var o=!n,l=o||t.i!=2,c=t.i;o&&(n=new ni(i*3));var d=function(pe){var ae=n.length;if(pe>ae){var me=new ni(Math.max(ae*2,pe));me.set(n),n=me}},u=t.f||0,f=t.p||0,p=t.b||0,h=t.l,g=t.d,b=t.m,S=t.n,x=i*8;do{if(!h){u=$i(e,f,1);var w=$i(e,f+1,3);if(f+=3,w)if(w==1)h=FL,g=zL,b=9,S=5;else if(w==2){var j=$i(e,f,31)+257,A=$i(e,f+10,15)+4,$=j+$i(e,f+5,31)+1;f+=14;for(var I=new ni($),F=new ni(19),L=0;L<A;++L)F[OL[L]]=$i(e,f+L*3,7);f+=A*3;for(var T=mg(F),q=(1<<T)-1,D=Cu(F,T,1),L=0;L<$;){var W=D[$i(e,f,q)];f+=W&15;var v=W>>4;if(v<16)I[L++]=v;else{var O=0,U=0;for(v==16?(U=3+$i(e,f,3),f+=2,O=I[L-1]):v==17?(U=3+$i(e,f,7),f+=3):v==18&&(U=11+$i(e,f,127),f+=7);U--;)I[L++]=O}}var P=I.subarray(0,j),R=I.subarray(j);b=mg(P),S=mg(R),h=Cu(P,b,1),g=Cu(R,S,1)}else gi(1);else{var v=BL(f)+4,k=e[v-4]|e[v-3]<<8,E=v+k;if(E>i){c&&gi(0);break}l&&d(p+k),n.set(e.subarray(v,E),p),t.b=p+=k,t.p=f=E*8,t.f=u;continue}if(f>x){c&&gi(0);break}}l&&d(p+131072);for(var C=(1<<b)-1,G=(1<<S)-1,J=f;;J=f){var O=h[gg(e,f)&C],B=O>>4;if(f+=O&15,f>x){c&&gi(0);break}if(O||gi(2),B<256)n[p++]=B;else if(B==256){J=f,h=null;break}else{var te=B-254;if(B>264){var L=B-257,de=UC[L];te=$i(e,f,(1<<de)-1)+qC[L],f+=de}var ce=g[gg(e,f)&G],ue=ce>>4;ce||gi(3),f+=ce&15;var R=DL[ue];if(ue>3){var de=WC[ue];R+=gg(e,f)&(1<<de)-1,f+=de}if(f>x){c&&gi(0);break}l&&d(p+131072);var re=p+te;if(p<R){var ge=s-R,se=Math.min(R,re);for(ge+p<0&&gi(3);p<se;++p)n[p]=r[ge+p]}for(;p<re;++p)n[p]=n[p-R]}}t.l=h,t.p=J,t.b=p,t.f=u,h&&(u=1,t.m=b,t.d=g,t.n=S)}while(!u);return p!=n.length&&o?Uw(n,0,p):n.subarray(0,p)},WL=new ni(0),ys=function(e,t){return e[t]|e[t+1]<<8},Hi=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},yg=function(e,t){return Hi(e,t)+Hi(e,t+4)*4294967296};function VL(e,t){return UL(e,{i:2},t&&t.out,t&&t.dictionary)}var sx=typeof TextDecoder<"u"&&new TextDecoder,KL=0;try{sx.decode(WL,{stream:!0}),KL=1}catch{}var qL=function(e){for(var t="",n=0;;){var r=e[n++],i=(r>127)+(r>223)+(r>239);if(n+i>e.length)return{s:t,r:Uw(e,n-1)};i?i==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)):i&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 YL(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(sx)return sx.decode(e);var i=qL(e),s=i.s,n=i.r;return n.length&&gi(8),s}}var GL=function(e,t){return t+30+ys(e,t+26)+ys(e,t+28)},XL=function(e,t,n){var r=ys(e,t+28),i=YL(e.subarray(t+46,t+46+r),!(ys(e,t+8)&2048)),s=t+46+r,o=Hi(e,t+20),l=n&&o==4294967295?JL(e,s):[o,Hi(e,t+24),Hi(e,t+42)],c=l[0],d=l[1],u=l[2];return[ys(e,t+10),c,d,i,s+ys(e,t+30)+ys(e,t+32),u]},JL=function(e,t){for(;ys(e,t)!=1;t+=4+ys(e,t+2));return[yg(e,t+12),yg(e,t+4),yg(e,t+20)]};function QL(e,t){for(var n={},r=e.length-22;Hi(e,r)!=101010256;--r)(!r||e.length-r>65558)&&gi(13);var i=ys(e,r+8);if(!i)return{};var s=Hi(e,r+16),o=s==4294967295||i==65535;if(o){var l=Hi(e,r-12);o=Hi(e,l)==101075792,o&&(i=Hi(e,l+32),s=Hi(e,l+48))}for(var c=0;c<i;++c){var d=XL(e,s,o),u=d[0],f=d[1],p=d[2],h=d[3],g=d[4],b=d[5],S=GL(e,b);s=g,u?u==8?n[h]=VL(e.subarray(S,S+f),{out:new ni(p)}):gi(14,"unknown compression type "+u):n[h]=Uw(e,S,S+f)}return n}const ZL=8*1024*1024,eO=500;function tO(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 nO(e){return e?e.split("/").some(n=>n==="__MACOSX"||n.startsWith("._")):!0}function rO(e){const t=e.toLowerCase();if(t==="flow.yaml"||t==="flow.yml")return"";const n="/flow.yaml",r="/flow.yml";let i=null;if(t.endsWith(n))i=e.slice(0,-n.length);else if(t.endsWith(r))i=e.slice(0,-r.length);else return null;return i.includes("/")?null:i}const iO=/^[a-zA-Z][a-zA-Z0-9_-]*$/;async function sO(e){try{const t=new Uint8Array(await e.arrayBuffer()),n=QL(t),r=new Map;let i=0,s=0;for(const[c,d]of Object.entries(n)){if(c.endsWith("/"))continue;const u=tO(c);if(!u||nO(u))continue;const f=(d==null?void 0:d.length)??0;if(i+=f,i>ZL||(s+=1,s>eO))return null;r.set(u,f)}if(r.size===0)return null;const o=new Set;for(const c of r.keys()){const d=rO(c);d!==null&&o.add(d)}if(o.size!==1)return null;const[l]=[...o];if(l==="")return null;for(const c of r.keys())if(!(c===l||c.startsWith(`${l}/`)))return null;return iO.test(l)?l:null}catch{return null}}const xg=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function oO({file:e,onClose:t,onImported:n}){const{t:r}=Ut(),i=m.useId(),s=m.useRef(null),o=m.useRef(null),[l,c]=m.useState(""),[d,u]=m.useState("user"),[f,p]=m.useState(!1),[h,g]=m.useState(""),[b,S]=m.useState(null),x=b??e;m.useEffect(()=>{const E=requestAnimationFrame(()=>{var j;return(j=s.current)==null?void 0:j.focus()});return()=>cancelAnimationFrame(E)},[]),m.useEffect(()=>{let E=!1;return(async()=>{const j=x.name||"",A=j.toLowerCase();let $="";if(A.endsWith(".zip")){if($=await sO(x)||"",!$){const I=j.replace(/\.zip$/i,"");xg.test(I)&&($=I)}}else if(A.endsWith(".yaml")||A.endsWith(".yml")){const I=j.replace(/\.ya?ml$/i,"");xg.test(I)&&($=I)}E||c($)})(),()=>{E=!0}},[x]);const w=l.trim(),v=w.length>0&&xg.test(w);async function k(E){if(E.preventDefault(),!(!v||f)){p(!0),g("");try{const j=new FormData;j.set("flowId",w),j.set("targetSpace",d),j.set("file",x,x.name);const A=await fetch("/api/flows/import",{method:"POST",body:j}),$=await A.json().catch(()=>({}));if(!A.ok){g(typeof $.error=="string"?$.error:r("project:importModal.importFailed"));return}n({id:$.flowId,source:$.flowSource??"user"})}catch(j){g(String((j==null?void 0:j.message)||j))}finally{p(!1)}}}return a.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:E=>{E.target===E.currentTarget&&t()},children:a.jsxs("div",{ref:s,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":i,tabIndex:-1,onMouseDown:E=>E.stopPropagation(),children:[a.jsxs("div",{className:"af-shortcuts-panel__head",children:[a.jsx("h2",{id:i,className:"af-shortcuts-panel__title",children:r("project:importModal.title")}),a.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":r("project:importModal.close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:k,children:[a.jsx("p",{className:"af-new-pipeline-lead",children:r("project:importModal.lead",{filename:x.name})}),a.jsx("input",{ref:o,type:"file",className:"af-import-file-input",accept:".yaml,.yml,.zip,application/zip","aria-hidden":!0,tabIndex:-1,onChange:E=>{var A;const j=(A=E.target.files)==null?void 0:A[0];j&&S(j),E.target.value=""}}),a.jsxs("label",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:r("project:importModal.nameLabel")}),a.jsx("input",{className:"af-new-pipeline-input",type:"text",name:"importFlowId",autoComplete:"off",spellCheck:!1,placeholder:r("project:importModal.namePlaceholder"),value:l,onChange:E=>c(E.target.value),"aria-invalid":w.length>0&&!v}),a.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-hint",children:r("project:importModal.nameHint")})]}),a.jsx("div",{className:"af-import-repick",children:a.jsx("button",{type:"button",className:"af-btn-secondary af-import-repick-btn",onClick:()=>{var E;return(E=o.current)==null?void 0:E.click()},children:r("project:importModal.changeFile")})}),h?a.jsx("p",{className:"af-err af-new-pipeline-err",children:h}):null,a.jsxs("div",{className:"af-new-pipeline-actions",children:[a.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:f,children:r("project:importModal.cancel")}),a.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!v||f,children:r(f?"project:importModal.importing":"project:importModal.importAndOpen")})]})]})]})})}const aO=/^[a-zA-Z][a-zA-Z0-9_-]*$/,Hb="af:newPipelineGuide";function lO({open:e,onClose:t,onCreated:n}){const{t:r}=Ut(),i=m.useId(),s=m.useRef(null),[o,l]=m.useState(""),[c,d]=m.useState(""),[u,f]=m.useState("user"),[p,h]=m.useState(!1),[g,b]=m.useState(""),[S,x]=m.useState(!1);m.useEffect(()=>{if(!e)return;l(""),d(""),f("user"),b(""),h(!1),localStorage.getItem(Hb)==="true"&&x(!0);const A=requestAnimationFrame(()=>{var $;return($=s.current)==null?void 0:$.focus()});return()=>cancelAnimationFrame(A)},[e]);const w=()=>{localStorage.removeItem(Hb),x(!1)};if(!e)return null;const v=o.trim(),k=v.length>0&&aO.test(v);async function E(j){if(j.preventDefault(),!(!k||p)){h(!0),b(""),w();try{const A=await fetch("/api/flows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:v,description:c.trim(),targetSpace:u})}),$=await A.json().catch(()=>({}));if(!A.ok){b(typeof $.error=="string"?$.error:r("project:newPipelineModal.createFailed"));return}n({id:$.flowId,source:$.flowSource??"user"})}catch(A){b(String((A==null?void 0:A.message)||A))}finally{h(!1)}}}return a.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:j=>{j.target===j.currentTarget&&(w(),t())},children:a.jsxs("div",{ref:s,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":i,tabIndex:-1,onMouseDown:j=>j.stopPropagation(),children:[a.jsxs("div",{className:"af-shortcuts-panel__head",children:[a.jsx("h2",{id:i,className:"af-shortcuts-panel__title",children:r("project:newPipelineModal.title")}),a.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:()=>{w(),t()},"aria-label":r("project:newPipelineModal.close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),S?a.jsx("div",{className:"af-new-pipeline-guide",children:a.jsxs("div",{className:"af-new-pipeline-guide-content",children:[a.jsx("span",{className:"material-symbols-outlined af-new-pipeline-guide-icon",children:"lightbulb"}),a.jsxs("div",{className:"af-new-pipeline-guide-text",children:[a.jsx("p",{children:a.jsx("strong",{children:r("onboarding:newPipeline.guideTitle")})}),a.jsx("p",{children:r("onboarding:newPipeline.guideDesc")})]}),a.jsx("button",{type:"button",className:"af-new-pipeline-guide-close",onClick:w,children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]})}):null,a.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:E,children:[a.jsx("p",{className:"af-new-pipeline-lead",children:r("project:newPipelineModal.lead")}),a.jsxs("label",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:r("project:newPipelineModal.nameLabel")}),a.jsx("input",{className:"af-new-pipeline-input",type:"text",name:"pipelineName",autoComplete:"off",spellCheck:!1,placeholder:r("project:newPipelineModal.namePlaceholder"),value:o,onChange:j=>l(j.target.value),"aria-invalid":v.length>0&&!k}),a.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-hint",children:r(S?"onboarding:newPipeline.nameHintGuide":"project:newPipelineModal.nameHint")})]}),a.jsxs("label",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:r("project:newPipelineModal.descLabel")}),a.jsx("textarea",{className:"af-pipeline-drawer-textarea af-new-pipeline-textarea",name:"pipelineDescription",rows:3,placeholder:r(S?"onboarding:newPipeline.descPlaceholderGuide":"project:newPipelineModal.descPlaceholder"),value:c,onChange:j=>d(j.target.value)}),S?a.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-guide-hint",children:r("onboarding:newPipeline.descHintGuide")}):null]}),g?a.jsx("p",{className:"af-err af-new-pipeline-err",children:g}):null,a.jsxs("div",{className:"af-new-pipeline-actions",children:[a.jsx("button",{type:"button",className:"af-btn-secondary",onClick:()=>{w(),t()},disabled:p,children:r("project:newPipelineModal.cancel")}),a.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!k||p,children:r(p?"project:newPipelineModal.creating":S?"onboarding:newPipeline.createGuide":"project:newPipelineModal.createAndOpen")})]})]})]})})}const GC="agentflow.pipelineViewPreference";function XC(e,t="user",n=!1){return`${String(t||"user")}:${String(e||"")}:${n?"archived":"active"}`}function JC(){if(typeof localStorage>"u")return{};try{const e=JSON.parse(localStorage.getItem(GC)||"{}");return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}catch{return{}}}function cO(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(GC,JSON.stringify(e))}catch{}}function th(e){return e==="pipeline"?"pipeline":"workspace"}function uO(e){return(e==null?void 0:e.hasPipeline)!==!1&&(e==null?void 0:e.hasFlow)!==!1&&(e==null?void 0:e.flowYaml)!==!1}function QC(e,t,n,r=!1){if(!e)return;const i=JC();i[XC(e,t,r)]={view:th(n),at:Date.now()},cO(i)}function dO(e,t="workspace"){if(!(e!=null&&e.id))return th(t);const r=JC()[XC(e.id,e.source??"user",!!e.archived)],i=th((r==null?void 0:r.view)||t);return i==="pipeline"&&!uO(e)?"workspace":i}function Ww(e,t="workspace"){if(!(e!=null&&e.id))return t==="pipeline"?"/flow":"/workspace";const n=new URLSearchParams({flowId:e.id,flowSource:e.source??"user"});return e.archived&&n.set(t==="pipeline"?"flowArchived":"archived","1"),`/${th(t)==="pipeline"?"flow":"workspace"}?${n.toString()}`}function Mf(e,t="workspace"){return Ww(e,dO(e,t))}function fO({onChanged:e}){const[t,n]=m.useState({available:!1,version:"",loggedIn:!1,user:"",error:""}),[r,i]=m.useState([]),[s,o]=m.useState(""),[l,c]=m.useState([]),[d,u]=m.useState(""),[f,p]=m.useState(""),[h,g]=m.useState(""),b=m.useCallback(async()=>{p("");try{const[k,E]=await Promise.all([fetch("/api/skillhub/status"),fetch("/api/skillhub/list?target=global&agent=codex")]),j=await k.json().catch(()=>({}));k.ok&&n({available:!!j.available,version:typeof j.version=="string"?j.version:"",loggedIn:!!j.loggedIn,user:typeof j.user=="string"?j.user:"",error:typeof j.error=="string"?j.error:""});const A=await E.json().catch(()=>({}));if(!E.ok)throw new Error(typeof A.error=="string"?A.error:"HTTP "+E.status);i(Array.isArray(A.skills)?A.skills:[])}catch(k){p(String(k.message||k))}},[]);m.useEffect(()=>{b()},[b]);const S=m.useCallback(async()=>{const k=s.trim();if(k){u("search"),p(""),g("");try{const E=await fetch(`/api/skillhub/search?q=${encodeURIComponent(k)}`),j=await E.json().catch(()=>({}));if(!E.ok)throw new Error(typeof j.error=="string"?j.error:"HTTP "+E.status);c(Array.isArray(j.items)?j.items:[])}catch(E){p(String(E.message||E))}finally{u("")}}},[s]),x=m.useCallback(async(k,E=!1)=>{const j=String(k||"").trim();if(j){u(`install:${j}`),p(""),g("");try{const A=await fetch("/api/skillhub/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:j,target:"global",agent:"codex",force:E})}),$=await A.json().catch(()=>({}));if(!A.ok)throw new Error(typeof $.error=="string"?$.error:"HTTP "+A.status);g(E?`已更新 ${j}`:`已安装 ${j}`),await b(),typeof e=="function"&&await e()}catch(A){p(String(A.message||A))}finally{u("")}}},[b,e]),w=m.useCallback(async k=>{const E=String(k||"").trim();if(E){u(`uninstall:${E}`),p(""),g("");try{const j=await fetch("/api/skillhub/uninstall",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:E,target:"global",agent:"codex"})}),A=await j.json().catch(()=>({}));if(!j.ok)throw new Error(typeof A.error=="string"?A.error:"HTTP "+j.status);g(`已卸载 ${E}`),await b(),typeof e=="function"&&await e()}catch(j){p(String(j.message||j))}finally{u("")}}},[b,e]),v=m.useCallback(async()=>{u("update-cli"),p(""),g("");try{const k=await fetch("/api/skillhub/update",{method:"POST"}),E=await k.json().catch(()=>({}));if(!k.ok)throw new Error(typeof E.error=="string"?E.error:"HTTP "+k.status);g("SkillHub CLI 已更新"),await b()}catch(k){p(String(k.message||k))}finally{u("")}},[b]);return a.jsxs("section",{className:"af-set-card af-set-card--span-all af-set-skillhub",children:[a.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"af-set-h2",children:"SkillHub"}),a.jsx("p",{className:"af-set-p af-set-p--tight",children:"搜索、安装、更新和卸载 Codex 全局 skills。"})]}),a.jsxs("div",{className:"af-set-skillhub-head-actions",children:[a.jsxs("div",{className:"af-set-skillhub-status",children:[a.jsx("span",{className:"material-symbols-outlined af-set-icon--tertiary",children:"extension"}),a.jsx("span",{children:t.loggedIn?`已登录 ${t.user}`:"未登录 SkillHub"}),a.jsx("span",{className:"af-set-badge"+(t.available?" af-set-badge--ok":" af-set-badge--err"),children:t.available?`v${t.version}`:"not found"})]}),a.jsxs("div",{className:"af-set-skillhub-toolbar",children:[a.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:b,disabled:!!d,children:"刷新"}),a.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:v,disabled:!!d,children:d==="update-cli"?"更新中…":"更新 CLI"})]})]})]}),a.jsxs("div",{className:"af-set-skillhub-search",children:[a.jsx("input",{className:"af-set-input af-set-input--sm",value:s,onChange:k=>o(k.target.value),onKeyDown:k=>{k.key==="Enter"&&S()},placeholder:"搜索 skill slug / 关键词,例如 android、issue-tracker"}),a.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:()=>S(),disabled:!s.trim()||d==="search",children:[a.jsx("span",{className:"material-symbols-outlined",children:"search"}),d==="search"?"搜索中…":"搜索"]})]}),f?a.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:f}):null,h?a.jsx("p",{className:"af-set-hint af-set-hint--inline",children:h}):null,a.jsxs("div",{className:"af-set-skillhub-grid",children:[a.jsxs("div",{className:"af-set-skillhub-pane",children:[a.jsxs("div",{className:"af-set-skillhub-pane-head",children:[a.jsx("h3",{children:"已安装"}),a.jsx("span",{children:r.length})]}),a.jsx("div",{className:"af-set-skillhub-list",children:r.length===0?a.jsx("div",{className:"af-set-skillhub-empty",children:"暂无 Codex 全局 skills"}):r.map(k=>a.jsxs("div",{className:"af-set-skillhub-item",children:[a.jsxs("div",{children:[a.jsx("div",{className:"af-set-skillhub-title",children:k.name}),a.jsxs("div",{className:"af-set-skillhub-meta",children:[k.agent||"codex"," · ",k.kind||"skill"]})]}),a.jsxs("div",{className:"af-set-skillhub-actions",children:[a.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>x(k.name,!0),disabled:!!d,children:"更新"}),a.jsx("button",{type:"button",className:"af-set-btn-mini af-set-btn-mini--danger",onClick:()=>w(k.name),disabled:!!d,children:"卸载"})]})]},`${k.agent}:${k.path}:${k.name}`))})]}),a.jsxs("div",{className:"af-set-skillhub-pane",children:[a.jsxs("div",{className:"af-set-skillhub-pane-head",children:[a.jsx("h3",{children:"搜索结果"}),a.jsx("span",{children:l.length})]}),a.jsx("div",{className:"af-set-skillhub-list",children:l.length===0?a.jsx("div",{className:"af-set-skillhub-empty",children:"输入关键词后搜索 SkillHub"}):l.map(k=>{const E=k.slug||k.name,j=r.some(A=>A.name===E||A.name===k.name);return a.jsxs("div",{className:"af-set-skillhub-item",children:[a.jsxs("div",{children:[a.jsx("div",{className:"af-set-skillhub-title",children:k.name||E}),a.jsxs("div",{className:"af-set-skillhub-meta",children:[E,k.version?` · ${k.version}`:""]}),k.summary?a.jsx("p",{className:"af-set-skillhub-summary",children:k.summary}):null]}),a.jsx("button",{type:"button",className:j?"af-set-btn-mini":"af-set-btn-add af-set-btn-add--compact",onClick:()=>x(E,j),disabled:!!d,children:j?"更新":"安装"})]},k.id||E)})})]})]})]})}function zo(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 pO(e){return{version:1,collections:zo({collections:e})}}function Vo(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 ZC(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 eE(e,t){const n=new Set(Array.isArray(t)?t:[]);return(Array.isArray(e)?e:[]).filter(r=>!n.has(r))}function tE(e,t,n){const r=Vo(e,n);if(r.length===0)return"empty";const i=r.filter(s=>t.has(s)).length;return i===0?"none":i===r.length?"all":"partial"}function hO(e,t,n){const r=String(e||"").trim().toLowerCase(),i=zo({collections:n}).find(s=>s.id===r||s.name.toLowerCase()===r);return Vo(i,t)}function nE(e,t,n,r){const i=(Array.isArray(n)?n:[]).map(d=>d.key).filter(Boolean),s=String(t||"").trim().toLowerCase(),o=zo({collections:r}),l=hO(t,n,r),c=l.length>0?l:i;if(!e)return c;try{const d=localStorage.getItem(e);if(d!==null){const u=JSON.parse(d);if(Array.isArray(u)){const f=new Set(i),p=u.map(String).filter(x=>f.has(x));if(i.length>0&&p.length===i.length)return c;const h=new Set(p),g=new Set(l),b=l.length>0&&l.every(x=>h.has(x)),S=o.some(x=>{if(!x.builtin||x.id===s||x.name.toLowerCase()===s)return!1;const w=Vo(x,n);return w.length>0&&w.every(v=>h.has(v))});return l.length>0&&S&&!b?c:p}}}catch{}return c}function Xc(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 mO(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 ox(e,t){return e==="builtin"?{label:t("project:sourceBadge.builtin"),tone:"muted"}:e==="workspace"?{label:t("project:sourceBadge.workspace"),tone:"secondary"}:{label:t("project:sourceBadge.user"),tone:"primary"}}function rE(e){const t=e.source??"user";return t==="builtin"?`builtin/pipelines / ${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 gO="project:defaultCardDesc";function iE(e,t){const n=e.description!=null?String(e.description).trim():"";return n!==""?n:t(gO)}function yO(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Cn({children:e,className:t="",query:n}){const r=n.trim(),i=String(e);if(!r)return a.jsx("span",{className:t,children:i});const s=new RegExp(`(${yO(r)})`,"gi"),o=i.split(s);return a.jsx("span",{className:t,children:o.map((l,c)=>c%2===1?a.jsx("mark",{className:"af-search-hit",children:l},c):a.jsx("span",{children:l},c))})}function xO(e,t,n){const r=[String(e.id),iE(e,n),rE(e),ox(e.source,n).label];return e.archived&&r.push(n("project:archived")),r.join(`
|
|
41
|
-
`).toLowerCase()}function wO(e,t,n){return t?xO(e,t,n).includes(t):!0}function vO(e,t){const n=e.trim().toLowerCase();if(!n)return!0;const r=String(t.flowId).toLowerCase(),i=String(t.flowSource??"user").toLowerCase();return r.includes(n)||i.includes(n)}function wg(e,t){const n=e.trim().toLowerCase();return n?t.filter(Boolean).join(`
|
|
42
|
-
`).toLowerCase().includes(n):!0}function Ub(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 Wb(e){return e!=null&&e.packageDir?e.packageDir:`marketplace/flow-snippets / ${(e==null?void 0:e.id)||""}`}const bO=["all","agent","control","provide","marketplace"],kO=["all","agent","control","provide"];function $f(e){return!e||typeof e!="object"?[]:Object.entries(e).map(([t,n])=>({key:t,...n&&typeof n=="object"?n:{}}))}function tn(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 Jc(e){return`${(e==null?void 0:e.id)||""}:${(e==null?void 0:e.version)||""}:${(e==null?void 0:e.packageDir)||""}`}function cl({resourceKind:e=""}){var Xr,Fn,Jr,br,ln,kr,Sr,Qr;const{t}=Ut(),{navigate:n,path:r}=Wa(),[i,s]=m.useState(e||"all"),[o,l]=m.useState([]),[c,d]=m.useState([]),[u,f]=m.useState([]),[p,h]=m.useState([]),[g,b]=m.useState([]),[S,x]=m.useState(""),[w,v]=m.useState(!1),[k,E]=m.useState([]),[j,A]=m.useState(""),[$,I]=m.useState(""),[F,L]=m.useState(!1),[T,q]=m.useState(!1),[D,W]=m.useState(!1),[O,U]=m.useState(null),[P,R]=m.useState(!1),[C,G]=m.useState(""),[J,B]=m.useState(!0),[te,de]=m.useState("all"),[ce,ue]=m.useState(""),[re,ge]=m.useState("overview"),[se,pe]=m.useState({}),[ae,me]=m.useState(""),[ze,st]=m.useState({}),[Ke,Ee]=m.useState(""),[It,sn]=m.useState(""),[Wt,mn]=m.useState({}),[on,bn]=m.useState(""),[xr,_n]=m.useState(""),[oe,ye]=m.useState(""),[Ue,Ge]=m.useState(!1),Qe=m.useRef(0),Et=m.useRef(0),kn=m.useCallback(async()=>{const V=++Et.current;A("");try{const ve=await fetch("/api/flows");if(V!==Et.current)return;if(!ve.ok)throw new Error("HTTP "+ve.status);const Ie=await ve.json();if(V!==Et.current)return;l(Array.isArray(Ie)?Ie:[])}catch(ve){if(V!==Et.current)return;l([]),A(String(ve.message||ve))}try{const ve=await fetch("/api/pipeline-recent-runs");if(V!==Et.current)return;if(ve.ok){const Ie=await ve.json();if(V!==Et.current)return;E(Array.isArray(Ie.runs)?Ie.runs:[])}else E([])}catch{if(V!==Et.current)return;E([])}L(!0)},[]),gt=m.useCallback(async()=>{I(""),q(!1);try{const[V,ve,Ie,He]=await Promise.all([fetch("/api/nodes"),fetch("/api/skills"),fetch("/api/skill-collections"),fetch("/api/marketplace/flow-snippets")]),ft=await V.json().catch(()=>({})),Je=await ve.json().catch(()=>({})),xt=await Ie.json().catch(()=>({})),nt=await He.json().catch(()=>({}));if(!V.ok)throw new Error(ft.error||"Nodes HTTP "+V.status);if(!ve.ok)throw new Error(Je.error||"Skills HTTP "+ve.status);if(!Ie.ok)throw new Error(xt.error||"Collections HTTP "+Ie.status);if(!He.ok)throw new Error(nt.error||"Flow snippets HTTP "+He.status);d(Array.isArray(ft.nodes)?ft.nodes:Array.isArray(ft)?ft:[]),f(Array.isArray(Je.skills)?Je.skills:[]),b(zo(xt)),h(Array.isArray(nt.snippets)?nt.snippets:[])}catch(V){d([]),f([]),h([]),b([]),I(String(V.message||V))}finally{q(!0)}},[]);m.useEffect(()=>{L(!1),kn(),gt()},[kn,gt]),m.useEffect(()=>{let V=!1;return fetch("/api/ui-context").then(ve=>ve.json()).then(ve=>{V||Ge(!!ve.hideCommunityLinks)}).catch(()=>{}),()=>{V=!0}},[]);const Sn=m.useCallback(async V=>{const ve=zo({collections:V});v(!0),I("");try{const Ie=await fetch("/api/skill-collections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(pO(ve))}),He=await Ie.json().catch(()=>({}));if(!Ie.ok)throw new Error(He.error||"Collections HTTP "+Ie.status);b(zo(He))}catch(Ie){I(String(Ie.message||Ie))}finally{v(!1)}},[]),On=m.useCallback(()=>{const V=S.trim();if(!V)return;const ve=V.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"collection",Ie=new Set(g.map(xt=>xt.id));let He=ve,ft=2;for(;Ie.has(He);)He=`${ve}-${ft++}`;const Je=Date.now();Sn([...g,{id:He,name:V,skillKeys:[],createdAt:Je,updatedAt:Je}]),x(""),de(`collection:${He}`)},[S,Sn,g]),Rt=m.useCallback(V=>{const ve=g.find(He=>He.id===V);if(ve!=null&&ve.builtin)return;const Ie=g.filter(He=>He.id!==V);te===`collection:${V}`&&de("all"),Sn(Ie)},[te,Sn,g]),fe=m.useCallback((V,ve,Ie)=>{const He=String(ve||"").trim();if(!He)return;const ft=Date.now(),Je=g.map(xt=>{if(xt.id!==V)return xt;const nt=new Set(xt.skillKeys||[]);return Ie?nt.add(He):nt.delete(He),{...xt,skillKeys:Array.from(nt),updatedAt:ft}});Sn(Je)},[Sn,g]),Pe=m.useCallback(async V=>{const ve=V==null?void 0:V.packageId,Ie=V==null?void 0:V.version;if(!ve||!Ie||!window.confirm(t("project:deleteMyNodeConfirm",{id:ve,version:Ie})))return;const He=tn(V);_n(He),ye(""),I("");try{const ft=new URLSearchParams({id:ve,version:Ie}),Je=await fetch(`/api/marketplace/node?${ft.toString()}`,{method:"DELETE"}),xt=await Je.json().catch(()=>({}));if(!Je.ok||(xt==null?void 0:xt.ok)===!1){const nt=Array.isArray(xt==null?void 0:xt.usage)&&xt.usage.length>0?` ${t("project:deleteMyNodeUsedBy",{count:xt.usage.length})}`:"";throw new Error(((xt==null?void 0:xt.error)||"Delete failed")+nt)}ye(t("project:deleteMyNodeSuccess",{id:ve,version:Ie})),st(nt=>{const qn={...nt};return delete qn[He],qn}),mn(nt=>{const qn={};for(const[Ei,_i]of Object.entries(nt))Ei.startsWith(`${He}:`)||(qn[Ei]=_i);return qn}),ue(""),await gt()}catch(ft){ye(String(ft.message||ft))}finally{_n("")}},[gt,t]);m.useEffect(()=>{if(e==="nodes"||e==="my-nodes"||e==="my-flows"||e==="skills"){s(e),de("all"),ue(""),ge("overview");return}s(V=>V==="archived"?"archived":"all")},[e]),m.useEffect(()=>{if(r!=="/projects"&&r!=="/")return;const V=new URLSearchParams(window.location.search);let ve=!1;if(V.get("tab")==="nodes"){n("/nodes");return}if(V.get("tab")==="my-nodes"){n("/my-nodes");return}if(V.get("tab")==="my-flows"){n("/my-flows");return}if(V.get("tab")==="skills"){n("/skills");return}if(V.get("tab")==="archived"&&(s("archived"),V.delete("tab"),ve=!0),V.get("new")==="1"&&(W(!0),V.delete("new"),ve=!0),ve){const Ie=V.toString();window.history.replaceState({},"",Ie?`/projects?${Ie}`:"/projects")}},[r,n]);const Mt=m.useMemo(()=>RL(k,HC(),o),[k,o,r]),Mn=m.useMemo(()=>Mt.filter(V=>vO(C,V)),[Mt,C]),dt=C.trim().toLowerCase(),$n=m.useMemo(()=>i==="archived"?o.filter(V=>V.archived):o.filter(V=>!V.archived),[o,i]),Ci=m.useMemo(()=>$n.filter(V=>wO(V,dt,t)),[$n,dt,t]),an=i==="nodes"||i==="my-nodes",wr=i==="my-nodes",ar=i==="my-flows",lr=m.useMemo(()=>c.filter(V=>wr&&V.source!=="marketplace"?!1:(te==="all"||(te==="marketplace"?V.source==="marketplace":V.type===te))&&wg(C,[V.id,V.label,V.displayName,V.description,V.type,V.source,V.packageId,V.version])),[c,wr,C,te]),fi=m.useMemo(()=>{const V=new Map;for(const ve of g)V.set(ve.id,new Set(ve.skillKeys||[]));return V},[g]),Zi=m.useMemo(()=>[{id:"all",label:"全部"},...g.map(V=>({id:`collection:${V.id}`,label:V.name,count:V.skillKeys.length,collection:V})),{id:"ungrouped",label:"未分组"}],[g]),cr=m.useMemo(()=>u.filter(V=>{var He;const ve=tn(V);let Ie=te==="all";if(te.startsWith("collection:")){const ft=te.slice(11);Ie=!!((He=fi.get(ft))!=null&&He.has(ve))}else te==="ungrouped"&&(Ie=!Array.from(fi.values()).some(ft=>ft.has(ve)));return Ie&&wg(C,[V.name,V.id,V.description,V.sourceLabel,V.source,V.path])}),[u,C,te,fi]),Qn=m.useMemo(()=>p.filter(V=>wg(C,[V.id,V.name,V.displayName,V.description,V.version,V.packageDir,Array.isArray(V.tags)?V.tags.join(" "):""])),[p,C]),es=an||ar||i==="skills",Xe=m.useMemo(()=>lr.find(V=>tn(V)===ce)||lr[0]||null,[lr,ce]),_t=m.useMemo(()=>cr.find(V=>tn(V)===ce)||cr[0]||null,[cr,ce]),$t=m.useMemo(()=>Qn.find(V=>Jc(V)===ce)||Qn[0]||null,[Qn,ce]),Vt=_t?se[tn(_t)]:null,Be=Xe?ze[tn(Xe)]:null,Dn=Xe&&It?Wt[`${tn(Xe)}:${It}`]:null,Ce=t(an?"project:searchNodes":ar?"project:searchFlows":i==="skills"?"project:searchSkills":"project:searchPipelines");m.useEffect(()=>{if(i!=="skills"||!_t)return;const V=tn(_t);if(se[V])return;let ve=!1;return me(V),fetch(`/api/skills/detail?key=${encodeURIComponent(V)}`).then(Ie=>Ie.json().then(He=>({ok:Ie.ok,json:He}))).then(({ok:Ie,json:He})=>{ve||Ie&&He.skill&&pe(ft=>({...ft,[V]:He.skill}))}).catch(()=>{}).finally(()=>{ve||me("")}),()=>{ve=!0}},[i,_t,se]),m.useEffect(()=>{if(!an||!Xe)return;const V=tn(Xe);if(ze[V])return;let ve=!1;return Ee(V),fetch(`/api/nodes/detail?id=${encodeURIComponent(Xe.id)}`).then(Ie=>Ie.json().then(He=>({ok:Ie.ok,json:He}))).then(({ok:Ie,json:He})=>{ve||Ie&&st(ft=>({...ft,[V]:He}))}).catch(()=>{}).finally(()=>{ve||Ee("")}),()=>{ve=!0}},[an,Xe,ze]),m.useEffect(()=>{if(!an)return;const V=Array.isArray(Be==null?void 0:Be.files)?Be.files:[];sn(ve=>{var Ie;return ve&&V.some(He=>He.path===ve)?ve:((Ie=V[0])==null?void 0:Ie.path)||""})},[an,Be]),m.useEffect(()=>{if(!an||!Xe||!It)return;const V=`${tn(Xe)}:${It}`;if(Wt[V])return;let ve=!1;return bn(V),fetch(`/api/nodes/file?id=${encodeURIComponent(Xe.id)}&path=${encodeURIComponent(It)}`).then(Ie=>Ie.json().then(He=>({ok:Ie.ok,json:He}))).then(({ok:Ie,json:He})=>{ve||Ie&&mn(ft=>({...ft,[V]:He}))}).catch(()=>{}).finally(()=>{ve||bn("")}),()=>{ve=!0}},[an,Xe,It,Wt]),m.useEffect(()=>{ye("")},[ce,i]);const gn=V=>{n(Mf(V,"workspace"))},vr=V=>{n(Mf({id:V.flowId,source:V.flowSource,archived:!!V.archived},"workspace"))},at=m.useCallback(V=>{var ve,Ie;V.preventDefault(),V.stopPropagation(),(Ie=(ve=V.dataTransfer)==null?void 0:ve.types)!=null&&Ie.includes("Files")&&(Qe.current+=1,R(!0))},[]),pi=m.useCallback(V=>{V.preventDefault(),V.stopPropagation(),Qe.current-=1,Qe.current<=0&&(Qe.current=0,R(!1))},[]),Vn=m.useCallback(V=>{V.preventDefault(),V.stopPropagation()},[]),Kn=m.useCallback(V=>{var He,ft;V.preventDefault(),V.stopPropagation(),Qe.current=0,R(!1);const ve=(ft=(He=V.dataTransfer)==null?void 0:He.files)==null?void 0:ft[0];if(!ve)return;const Ie=ve.name.toLowerCase();!Ie.endsWith(".yaml")&&!Ie.endsWith(".yml")&&!Ie.endsWith(".zip")||U(ve)},[]);return a.jsxs("div",{className:"af-projects"+(P?" af-projects--drop-target":""),onDragEnter:at,onDragLeave:pi,onDragOver:Vn,onDrop:Kn,children:[a.jsxs("header",{className:"af-projects-top",children:[e?a.jsx("div",{className:"af-projects-tabs af-projects-tabs--empty","aria-hidden":!0}):a.jsxs("div",{className:"af-projects-tabs",children:[a.jsx("button",{type:"button",className:i==="all"?"af-tab af-tab--active":"af-tab",onClick:()=>s("all"),children:t("project:all")}),a.jsx("button",{type:"button",className:i==="archived"?"af-tab af-tab--active":"af-tab",onClick:()=>s("archived"),children:t("project:archived")})]}),a.jsxs("div",{className:"af-projects-top-right",children:[a.jsxs("div",{className:"af-search-wrap",children:[a.jsx("span",{className:"material-symbols-outlined af-search-icon",children:"search"}),a.jsx("input",{className:"af-search"+(C.trim()?" af-search--has-clear":""),type:"search",placeholder:Ce,"aria-label":Ce,autoComplete:"off",value:C,onChange:V=>G(V.target.value),onKeyDown:V=>{V.key==="Escape"&&(G(""),V.currentTarget.blur())}}),C.trim()?a.jsx("button",{type:"button",className:"af-search-clear","aria-label":"Clear search",onClick:()=>G(""),children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),es?a.jsx("button",{type:"button",className:"af-btn-primary af-create-btn",onClick:()=>gt(),children:t("project:refreshResources")}):a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"af-icon-btn"+(J?" af-icon-btn--active":""),"aria-label":t("flow:palette.toggleRecentActivity"),"aria-expanded":J,"aria-controls":"af-recent-activity-panel",onClick:()=>B(V=>!V),children:a.jsx("span",{className:"material-symbols-outlined",children:"notifications"})}),a.jsx("button",{type:"button",className:"af-btn-primary af-create-btn",onClick:()=>W(!0),children:t("project:createNew")})]})]})]}),a.jsxs("div",{className:"af-projects-body",children:[a.jsxs("section",{className:"af-projects-main",children:[a.jsxs("header",{className:"af-projects-section-head",children:[a.jsx("h2",{className:"af-projects-h2",children:t(i==="my-nodes"?"project:myNodes":i==="my-flows"?"project:myFlows":i==="nodes"?"project:globalNodes":i==="skills"?"project:globalSkills":i==="archived"?"project:archivedPipelines":"project:activeProjects")}),a.jsx("p",{className:"af-projects-sub",children:dt?t("project:filterResult",{count:i==="nodes"||i==="my-nodes"?lr.length:i==="my-flows"?Qn.length:i==="skills"?cr.length:Ci.length}):i==="my-nodes"?t("project:myNodesHint",{count:lr.length}):i==="my-flows"?t("project:myFlowsHint",{count:Qn.length}):i==="nodes"?t("project:nodesHint",{count:c.length}):i==="skills"?t("project:skillsHint",{count:u.length}):t(i==="archived"?"project:archivedHint":"project:activeHint")}),j?a.jsx("p",{className:"af-err af-projects-api-hint",children:j}):null,$&&es?a.jsx("p",{className:"af-err af-projects-api-hint",children:$}):null]}),es?a.jsxs("div",{className:"af-resource-toolbar",children:[i==="skills"?a.jsx(fO,{onChanged:gt}):null,a.jsxs("div",{className:"af-resource-purpose",children:[a.jsx("span",{className:"material-symbols-outlined",children:ar?"schema":an?wr?"deployed_code":"account_tree":"extension"}),a.jsxs("div",{children:[a.jsx("h3",{children:t(ar?"project:myFlowsPurposeTitle":wr?"project:myNodesPurposeTitle":an?"project:nodesPurposeTitle":"project:skillsPurposeTitle")}),a.jsx("p",{children:t(ar?"project:myFlowsPurposeDesc":wr?"project:myNodesPurposeDesc":an?"project:nodesPurposeDesc":"project:skillsPurposeDesc")})]})]}),ar?null:a.jsx("div",{className:"af-resource-filter-row",children:(an?(wr?kO:bO).map(V=>({id:V,label:t(`project:resourceFilter.${V}`)})):Zi).map(V=>V.collection?a.jsxs("span",{className:"af-resource-filter-chip"+(te===V.id?" af-resource-filter-chip--active":""),children:[a.jsxs("button",{type:"button",className:"af-resource-filter af-resource-filter--embedded",onClick:()=>{de(V.id),ue("")},children:[V.label,a.jsx("em",{children:V.count}),V.collection.builtin?a.jsx("strong",{children:"built-in"}):null]}),V.collection.builtin?null:a.jsx("button",{type:"button",className:"af-resource-filter-chip__delete",disabled:w,"aria-label":`删除 ${V.collection.name}`,onClick:()=>Rt(V.collection.id),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},V.id):a.jsx("button",{type:"button",className:"af-resource-filter"+(te===V.id?" af-resource-filter--active":""),onClick:()=>{de(V.id),ue("")},children:V.label},V.id))}),i==="skills"?a.jsx("div",{className:"af-skill-collections-manager",children:a.jsxs("div",{className:"af-skill-collections-create",children:[a.jsx("input",{className:"af-set-input af-set-input--sm",value:S,onChange:V=>x(V.target.value),onKeyDown:V=>{V.key==="Enter"&&On()},placeholder:"新建 skill collection"}),a.jsxs("button",{type:"button",className:"af-set-btn-add af-set-btn-add--compact",disabled:!S.trim()||w,onClick:()=>On(),children:[a.jsx("span",{className:"material-symbols-outlined",children:"add"}),"新建"]})]})}):null]}):null,an?a.jsx("div",{className:"af-resource-grid",children:lr.length>0?lr.map(V=>a.jsxs("button",{type:"button",className:"af-resource-card"+(Xe&&tn(V)===tn(Xe)?" af-resource-card--active":""),onClick:()=>ue(tn(V)),children:[a.jsxs("div",{className:"af-resource-card-head",children:[a.jsx("span",{className:Xc(V.type==="control"?"secondary":V.type==="provide"?"primary":"muted"),children:a.jsx(Cn,{query:C,children:V.type||"node"})}),a.jsx("span",{className:"af-resource-source",children:a.jsx(Cn,{query:C,children:Ub(V.source,t)})})]}),a.jsx("h3",{className:"af-project-title",children:a.jsx(Cn,{query:C,children:V.label||V.displayName||V.id})}),a.jsx("p",{className:"af-project-desc",children:a.jsx(Cn,{query:C,children:V.description||t("project:noDescription")})}),a.jsxs("div",{className:"af-resource-meta-row",children:[a.jsx("span",{children:a.jsx(Cn,{query:C,children:V.id})}),a.jsx("span",{children:t("project:nodeSlots",{inputs:Object.keys(V.inputs||{}).length,outputs:Object.keys(V.outputs||{}).length})})]}),V.packageId?a.jsxs("div",{className:"af-project-path",children:[a.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"deployed_code"}),a.jsx("span",{className:"af-path-text",children:a.jsx(Cn,{query:C,children:`${V.packageId}${V.version?` / ${V.version}`:""}`})})]}):null]},`${V.id}:${V.source||""}:${V.packageId||""}`)):T?a.jsx("div",{className:"af-projects-empty-block",children:a.jsx("p",{className:"af-projects-empty",children:dt?t("project:noNodeMatch",{query:C.trim()}):t(wr?"project:noMyNodes":"project:noNodes")})}):a.jsx("div",{className:"af-projects-empty-block",children:a.jsx("p",{className:"af-projects-empty",children:t("project:loadingResources")})})}):ar?a.jsx("div",{className:"af-resource-grid",children:Qn.length>0?Qn.map(V=>{const ve=V.snippet&&Array.isArray(V.snippet.instances)?V.snippet.instances:[],Ie=V.snippet&&Array.isArray(V.snippet.edges)?V.snippet.edges:[],He=Number.isFinite(Number(V.nodeCount))?Number(V.nodeCount):ve.length,ft=Number.isFinite(Number(V.edgeCount))?Number(V.edgeCount):Ie.length;return a.jsxs("button",{type:"button",className:"af-resource-card"+($t&&Jc(V)===Jc($t)?" af-resource-card--active":""),onClick:()=>ue(Jc(V)),children:[a.jsxs("div",{className:"af-resource-card-head",children:[a.jsx("span",{className:Xc("primary"),children:a.jsx(Cn,{query:C,children:V.version?`v${V.version}`:"flow"})}),a.jsx("span",{className:"af-resource-source",children:t("project:flowSnippet")})]}),a.jsx("h3",{className:"af-project-title",children:a.jsx(Cn,{query:C,children:V.displayName||V.name||V.id})}),a.jsx("p",{className:"af-project-desc",children:a.jsx(Cn,{query:C,children:V.description||t("project:noDescription")})}),a.jsxs("div",{className:"af-resource-meta-row",children:[a.jsx("span",{children:t("project:flowSnippetNodes",{nodes:He,edges:ft})}),a.jsx("span",{children:a.jsx(Cn,{query:C,children:V.id})})]}),a.jsxs("div",{className:"af-project-path",children:[a.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"schema"}),a.jsx("span",{className:"af-path-text",children:a.jsx(Cn,{query:C,children:Wb(V)})})]})]},Jc(V))}):T?a.jsx("div",{className:"af-projects-empty-block",children:a.jsx("p",{className:"af-projects-empty",children:dt?t("project:noFlowSnippetMatch",{query:C.trim()}):t("project:noMyFlows")})}):a.jsx("div",{className:"af-projects-empty-block",children:a.jsx("p",{className:"af-projects-empty",children:t("project:loadingResources")})})}):i==="skills"?a.jsx("div",{className:"af-resource-grid",children:cr.length>0?cr.map(V=>a.jsxs("button",{type:"button",className:"af-resource-card"+(_t&&tn(V)===tn(_t)?" af-resource-card--active":""),onClick:()=>ue(tn(V)),children:[a.jsxs("div",{className:"af-resource-card-head",children:[a.jsx("span",{className:Xc(V.source==="builtin"?"muted":"primary"),children:a.jsx(Cn,{query:C,children:V.sourceLabel||V.source||"skill"})}),a.jsx("span",{className:"af-resource-source",children:t("project:skill")})]}),a.jsx("h3",{className:"af-project-title",children:a.jsx(Cn,{query:C,children:V.name||V.id})}),a.jsx("p",{className:"af-project-desc",children:a.jsx(Cn,{query:C,children:V.description||t("project:noDescription")})}),a.jsxs("div",{className:"af-project-path",children:[a.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"extension"}),a.jsx("span",{className:"af-path-text",children:a.jsx(Cn,{query:C,children:V.path||V.key||""})})]}),a.jsxs("div",{className:"af-skill-card-collections",children:[g.filter(ve=>ve.skillKeys.includes(tn(V))).slice(0,3).map(ve=>a.jsx("span",{children:ve.name},ve.id)),g.filter(ve=>ve.skillKeys.includes(tn(V))).length===0?a.jsx("span",{className:"af-skill-card-collection-empty",children:"未分组"}):null]})]},V.key||`${V.source}:${V.name}`)):T?a.jsx("div",{className:"af-projects-empty-block",children:a.jsx("p",{className:"af-projects-empty",children:dt?t("project:noSkillMatch",{query:C.trim()}):t("project:noSkills")})}):a.jsx("div",{className:"af-projects-empty-block",children:a.jsx("p",{className:"af-projects-empty",children:t("project:loadingResources")})})}):a.jsxs("div",{className:"af-project-grid",children:[Ci.length>0?Ci.map(V=>a.jsx("button",{type:"button",className:"af-project-card",onClick:()=>gn(V),children:a.jsxs("div",{className:"af-project-card-body",children:[a.jsx("span",{className:Xc(ox(V.source,t).tone),children:a.jsx(Cn,{query:C,children:ox(V.source,t).label})}),V.archived?a.jsx("span",{className:Xc("muted"),children:a.jsx(Cn,{query:C,children:t("project:archived")})}):null,a.jsx("h3",{className:"af-project-title",children:a.jsx(Cn,{query:C,children:V.id})}),a.jsx("p",{className:"af-project-desc",children:a.jsx(Cn,{query:C,children:iE(V,t)})}),a.jsxs("div",{className:"af-project-path",children:[a.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"database"}),a.jsx("span",{className:"af-path-text",children:a.jsx(Cn,{query:C,children:rE(V)})})]})]})},`${V.id}:${V.source??"user"}:${V.archived?"a":""}`)):F?$n.length===0?a.jsxs("div",{className:"af-projects-empty-block",children:[a.jsx("p",{className:"af-projects-empty",children:i==="archived"?t("project:noArchived"):o.length>0?t("project:noActive"):t(j?"project:loadFailed":"project:noPipelines")}),!j&&o.length===0&&i==="all"?a.jsx("p",{className:"af-projects-empty-hint",children:t("project:emptyHint",{code1:"agentflow ui",code2:".agentflow/pipelines"})}):null]}):a.jsx("div",{className:"af-projects-empty-block",children:a.jsx("p",{className:"af-projects-empty",children:t("project:noMatch",{query:C.trim()})})}):a.jsx("div",{className:"af-projects-empty-block",children:a.jsx("p",{className:"af-projects-empty",children:t("project:loadingPipelines")})}),a.jsxs("button",{type:"button",className:"af-project-add",onClick:()=>W(!0),children:[a.jsx("span",{className:"material-symbols-outlined af-project-add-icon",children:"add_circle"}),a.jsx("span",{className:"af-project-add-label",children:t("project:newPipeline")})]}),Ue?null:a.jsxs("a",{className:"af-hub-card",href:"https://agentflow-hub.com",target:"_blank",rel:"noopener noreferrer",children:[a.jsx("div",{className:"af-hub-card__glow","aria-hidden":!0}),a.jsxs("span",{className:"af-hub-card__eyebrow",children:[a.jsx("span",{className:"material-symbols-outlined af-hub-card__eyebrow-icon",children:"hub"}),t("project:hubCard.eyebrow")]}),a.jsx("h3",{className:"af-hub-card__title",children:t("project:hubCard.title")}),a.jsx("p",{className:"af-hub-card__desc",children:t("project:hubCard.desc")}),a.jsxs("span",{className:"af-hub-card__cta",children:[t("project:hubCard.cta"),a.jsx("span",{className:"material-symbols-outlined af-hub-card__cta-icon",children:"arrow_outward"})]}),a.jsx("code",{className:"af-hub-card__cli",children:t("project:hubCard.cliHint")})]})]})]}),es?a.jsx("aside",{className:"af-resource-detail","aria-label":t(an?"project:nodeDetail":ar?"project:flowDetail":"project:skillDetail"),children:an&&Xe?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"af-resource-detail-head",children:[a.jsx("span",{className:"material-symbols-outlined",children:"account_tree"}),a.jsxs("div",{children:[a.jsx("h3",{children:Xe.label||Xe.displayName||Xe.id}),a.jsx("p",{children:Xe.id})]})]}),a.jsx("div",{className:"af-resource-detail-tabs",children:["overview","schema","runtime","files","usage"].map(V=>a.jsx("button",{type:"button",className:"af-resource-detail-tab"+(re===V?" af-resource-detail-tab--active":""),onClick:()=>ge(V),children:t(`project:nodeDetailTabs.${V}`)},V))}),Ke===tn(Xe)?a.jsx("p",{className:"af-resource-detail-desc",children:t("project:loadingResources")}):re==="overview"?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"af-resource-detail-desc",children:Xe.description||((Xr=Be==null?void 0:Be.node)==null?void 0:Xr.description)||t("project:noDescription")}),a.jsxs("dl",{className:"af-resource-detail-kv",children:[a.jsxs("div",{children:[a.jsx("dt",{children:t("project:detailType")}),a.jsx("dd",{children:Xe.type||((Fn=Be==null?void 0:Be.node)==null?void 0:Fn.type)||"node"})]}),a.jsxs("div",{children:[a.jsx("dt",{children:t("project:detailSource")}),a.jsx("dd",{children:Ub(Xe.source,t)})]}),Xe.packageId?a.jsxs("div",{children:[a.jsx("dt",{children:t("project:detailPackage")}),a.jsx("dd",{children:Xe.packageId})]}):null,Xe.version?a.jsxs("div",{children:[a.jsx("dt",{children:t("project:detailVersion")}),a.jsx("dd",{children:Xe.version})]}):null,Xe.packageDir||Be!=null&&Be.baseDir?a.jsxs("div",{children:[a.jsx("dt",{children:t("project:detailPath")}),a.jsx("dd",{children:Xe.packageDir||(Be==null?void 0:Be.baseDir)})]}):null,a.jsxs("div",{children:[a.jsx("dt",{children:t("project:detailEditable")}),a.jsx("dd",{children:(Be==null?void 0:Be.readOnly)===!1?t("project:editable"):t("project:readOnly")})]})]}),wr&&Xe.source==="marketplace"?a.jsxs("div",{className:"af-resource-detail-section af-resource-danger-zone",children:[a.jsx("h4",{children:t("project:myNodeManagement")}),a.jsx("p",{children:t("project:deleteMyNodeHint")}),a.jsxs("button",{type:"button",className:"af-btn-secondary af-btn-danger",disabled:xr===tn(Xe),onClick:()=>Pe(Xe),children:[a.jsx("span",{className:"material-symbols-outlined",children:"delete"}),xr===tn(Xe)?t("project:deletingMyNode"):t("project:deleteMyNode")]}),oe?a.jsx("p",{className:"af-resource-action-message",children:oe}):null]}):null,a.jsxs("div",{className:"af-resource-detail-section",children:[a.jsx("h4",{children:t("project:resourceMeaning")}),a.jsx("p",{children:t("project:nodesMeaning")})]})]}):re==="schema"?a.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[a.jsx("h4",{children:t("project:nodeSchema")}),a.jsxs("div",{className:"af-resource-slot-group",children:[a.jsx("span",{children:t("project:nodeInputs")}),$f(((Jr=Be==null?void 0:Be.node)==null?void 0:Jr.inputs)||Xe.inputs).length>0?$f(((br=Be==null?void 0:Be.node)==null?void 0:br.inputs)||Xe.inputs).map(V=>a.jsxs("code",{children:[V.name||V.key,V.type?`: ${V.type}`:""]},V.key)):a.jsx("em",{children:t("project:noSlots")})]}),a.jsxs("div",{className:"af-resource-slot-group",children:[a.jsx("span",{children:t("project:nodeOutputs")}),$f(((ln=Be==null?void 0:Be.node)==null?void 0:ln.outputs)||Xe.outputs).length>0?$f(((kr=Be==null?void 0:Be.node)==null?void 0:kr.outputs)||Xe.outputs).map(V=>a.jsxs("code",{children:[V.name||V.key,V.type?`: ${V.type}`:""]},V.key)):a.jsx("em",{children:t("project:noSlots")})]})]}):re==="runtime"?a.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[a.jsx("h4",{children:t("project:nodeRuntime")}),Be!=null&&Be.runtime?a.jsx("pre",{className:"af-resource-skill-preview",children:JSON.stringify(Be.runtime,null,2)}):a.jsx("p",{children:t("project:noRuntimeManifest")}),Be!=null&&Be.body?a.jsxs(a.Fragment,{children:[a.jsx("h4",{className:"af-resource-detail-subtitle",children:t("project:nodeBody")}),a.jsx("pre",{className:"af-resource-skill-preview",children:Be.body})]}):a.jsx("p",{children:t("project:noNodeBody")})]}):re==="files"?a.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[a.jsx("h4",{children:t("project:nodeFiles")}),Array.isArray(Be==null?void 0:Be.files)&&Be.files.length>0?a.jsxs("div",{className:"af-node-file-browser",children:[a.jsx("div",{className:"af-node-file-list",children:Be.files.map(V=>a.jsxs("button",{type:"button",className:"af-node-file-item"+(It===V.path?" af-node-file-item--active":""),onClick:()=>sn(V.path),children:[a.jsx("span",{className:"material-symbols-outlined",children:"description"}),a.jsx("span",{children:V.path})]},V.path))}),a.jsxs("pre",{className:"af-resource-skill-preview",children:[on===`${tn(Xe)}:${It}`?t("project:loadingResources"):Dn!=null&&Dn.binary?t("project:binaryFile"):(Dn==null?void 0:Dn.content)||t("project:selectNodeFile"),Dn!=null&&Dn.truncated?`
|
|
43
|
-
|
|
44
|
-
${t("project:fileTruncated")}`:""]})]}):a.jsx("p",{children:t("project:noNodeFiles")})]}):a.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[a.jsx("h4",{children:t("project:nodeUsage")}),Array.isArray(Be==null?void 0:Be.usage)&&Be.usage.length>0?a.jsx("div",{className:"af-node-usage-list",children:Be.usage.map(V=>a.jsxs("div",{className:"af-node-usage-item",children:[a.jsx("strong",{children:V.flowId}),a.jsxs("span",{children:[V.flowSource,V.archived?` · ${t("project:archived")}`:""]}),a.jsx("em",{children:V.instances.map(ve=>ve.label||ve.instanceId).join(", ")})]},`${V.flowSource}:${V.flowId}:${V.archived?"a":""}`))}):a.jsx("p",{children:t("project:noNodeUsage")})]})]}):ar&&$t?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"af-resource-detail-head",children:[a.jsx("span",{className:"material-symbols-outlined",children:"schema"}),a.jsxs("div",{children:[a.jsx("h3",{children:$t.displayName||$t.name||$t.id}),a.jsx("p",{children:$t.id})]})]}),a.jsx("p",{className:"af-resource-detail-desc",children:$t.description||t("project:noDescription")}),a.jsxs("dl",{className:"af-resource-detail-kv",children:[a.jsxs("div",{children:[a.jsx("dt",{children:t("project:detailVersion")}),a.jsx("dd",{children:$t.version||"1.0.0"})]}),a.jsxs("div",{children:[a.jsx("dt",{children:t("project:detailPath")}),a.jsx("dd",{children:Wb($t)})]}),a.jsxs("div",{children:[a.jsx("dt",{children:t("project:flowSnippetScale")}),a.jsx("dd",{children:t("project:flowSnippetNodes",{nodes:Number.isFinite(Number($t.nodeCount))?Number($t.nodeCount):Array.isArray((Sr=$t.snippet)==null?void 0:Sr.instances)?$t.snippet.instances.length:0,edges:Number.isFinite(Number($t.edgeCount))?Number($t.edgeCount):Array.isArray((Qr=$t.snippet)==null?void 0:Qr.edges)?$t.snippet.edges.length:0})})]})]}),a.jsxs("div",{className:"af-resource-detail-section",children:[a.jsx("h4",{children:t("project:resourceMeaning")}),a.jsx("p",{children:t("project:myFlowsMeaning")})]}),a.jsxs("div",{className:"af-resource-detail-section",children:[a.jsx("h4",{children:t("project:flowSnippetPreview")}),a.jsx("pre",{className:"af-resource-skill-preview",children:JSON.stringify($t.snippet||{},null,2)})]})]}):i==="skills"&&_t?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"af-resource-detail-head",children:[a.jsx("span",{className:"material-symbols-outlined",children:"extension"}),a.jsxs("div",{children:[a.jsx("h3",{children:_t.name||_t.id}),a.jsx("p",{children:_t.sourceLabel||_t.source})]})]}),a.jsx("p",{className:"af-resource-detail-desc",children:_t.description||t("project:noDescription")}),a.jsxs("dl",{className:"af-resource-detail-kv",children:[a.jsxs("div",{children:[a.jsx("dt",{children:t("project:detailSource")}),a.jsx("dd",{children:_t.sourceLabel||_t.source})]}),a.jsxs("div",{children:[a.jsx("dt",{children:t("project:detailPath")}),a.jsx("dd",{children:_t.path||_t.key})]})]}),a.jsxs("div",{className:"af-resource-detail-section",children:[a.jsx("h4",{children:"Collections"}),g.length===0?a.jsx("p",{children:"暂无 collection。可在左侧新建后再添加。"}):a.jsx("div",{className:"af-skill-detail-collections",children:g.map(V=>{const ve=tn(_t),Ie=V.skillKeys.includes(ve);return a.jsxs("label",{className:"af-composer-skill-option af-skill-detail-collection-option",children:[a.jsx("input",{type:"checkbox",checked:Ie,disabled:w,onChange:He=>fe(V.id,ve,He.target.checked)}),a.jsxs("span",{className:"af-composer-skill-option-main",children:[a.jsx("span",{className:"af-composer-skill-option-title",children:V.name}),a.jsxs("span",{className:"af-composer-skill-option-desc",children:[V.skillKeys.length," skills"]})]})]},V.id)})})]}),a.jsxs("div",{className:"af-resource-detail-section",children:[a.jsx("h4",{children:t("project:resourceMeaning")}),a.jsx("p",{children:t("project:skillsMeaning")})]}),a.jsxs("div",{className:"af-resource-detail-section",children:[a.jsx("h4",{children:t("project:skillPreview")}),a.jsx("pre",{className:"af-resource-skill-preview",children:ae===tn(_t)?t("project:loadingResources"):(Vt==null?void 0:Vt.body)||(Vt==null?void 0:Vt.content)||t("project:skillPreviewEmpty")})]})]}):a.jsx("p",{className:"af-activity-empty",children:t("project:selectResource")})}):a.jsxs("aside",{id:"af-recent-activity-panel",className:"af-activity"+(J?"":" af-activity--hidden"),"aria-hidden":!J,"aria-label":t("project:recentActivity"),children:[a.jsxs("h2",{className:"af-activity-title",children:[a.jsx("span",{className:"af-activity-bullet"}),t("project:recentActivity")]}),a.jsx("div",{className:"af-activity-list",children:Mn.length===0?a.jsx("p",{className:"af-activity-empty",children:Mt.length===0?t("project:noRecentActivity"):t("project:noMatchRecent")}):Mn.map(V=>a.jsxs("button",{type:"button",className:"af-activity-row af-activity-row--action",onClick:()=>vr(V),children:[a.jsxs("div",{className:"af-activity-row-top",children:[a.jsx("h4",{className:"af-activity-name",children:a.jsx(Cn,{query:C,children:V.flowId})}),a.jsx("span",{className:"af-activity-time",children:rx(V.at,t)})]}),a.jsxs("div",{className:"af-activity-meta",children:[a.jsx("span",{className:mO(V.kind),children:V.kind==="executed"?"play_arrow":"visibility"}),a.jsxs("p",{className:"af-activity-text",children:[V.kind==="executed"?t("project:recentRun"):t("project:recentOpen")," · ",rx(V.at,t)]})]})]},`${V.kind}-${V.flowId}-${V.flowSource}-${V.at}`))})]})]}),a.jsx(lO,{open:D,onClose:()=>W(!1),onCreated:async V=>{W(!1),await kn();const ve=V.source??"user";n(Mf({id:V.id,source:ve},"workspace"))}}),O?a.jsx(oO,{file:O,onClose:()=>U(null),onImported:async V=>{U(null),await kn();const ve=V.source??"user";n(Mf({id:V.id,source:ve},"workspace"))}},`${O.name}-${O.size}-${O.lastModified}`):null]})}function Ln(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=Ln(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var SO={value:()=>{}};function Xh(){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 vp(n)}function vp(e){this._=e}function NO(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}vp.prototype=Xh.prototype={constructor:vp,on:function(e,t){var n=this._,r=NO(e+"",n),i,s=-1,o=r.length;if(arguments.length<2){for(;++s<o;)if((i=(e=r[s]).type)&&(i=jO(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<o;)if(i=(e=r[s]).type)n[i]=Vb(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Vb(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new vp(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,s;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],r=0,i=s.length;r<i;++r)s[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],i=0,s=r.length;i<s;++i)r[i].value.apply(t,n)}};function jO(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function Vb(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=SO,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var ax="http://www.w3.org/1999/xhtml";const Kb={svg:"http://www.w3.org/2000/svg",xhtml:ax,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Jh(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Kb.hasOwnProperty(t)?{space:Kb[t],local:e}:e}function CO(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===ax&&t.documentElement.namespaceURI===ax?t.createElement(e):t.createElementNS(n,e)}}function EO(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function sE(e){var t=Jh(e);return(t.local?EO:CO)(t)}function _O(){}function Vw(e){return e==null?_O:function(){return this.querySelector(e)}}function PO(e){typeof e!="function"&&(e=Vw(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var s=t[i],o=s.length,l=r[i]=new Array(o),c,d,u=0;u<o;++u)(c=s[u])&&(d=e.call(c,c.__data__,u,s))&&("__data__"in c&&(d.__data__=c.__data__),l[u]=d);return new ci(r,this._parents)}function AO(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function IO(){return[]}function oE(e){return e==null?IO:function(){return this.querySelectorAll(e)}}function TO(e){return function(){return AO(e.apply(this,arguments))}}function RO(e){typeof e=="function"?e=TO(e):e=oE(e);for(var t=this._groups,n=t.length,r=[],i=[],s=0;s<n;++s)for(var o=t[s],l=o.length,c,d=0;d<l;++d)(c=o[d])&&(r.push(e.call(c,c.__data__,d,o)),i.push(c));return new ci(r,i)}function aE(e){return function(){return this.matches(e)}}function lE(e){return function(t){return t.matches(e)}}var LO=Array.prototype.find;function OO(e){return function(){return LO.call(this.children,e)}}function MO(){return this.firstElementChild}function $O(e){return this.select(e==null?MO:OO(typeof e=="function"?e:lE(e)))}var DO=Array.prototype.filter;function FO(){return Array.from(this.children)}function zO(e){return function(){return DO.call(this.children,e)}}function BO(e){return this.selectAll(e==null?FO:zO(typeof e=="function"?e:lE(e)))}function HO(e){typeof e!="function"&&(e=aE(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var s=t[i],o=s.length,l=r[i]=[],c,d=0;d<o;++d)(c=s[d])&&e.call(c,c.__data__,d,s)&&l.push(c);return new ci(r,this._parents)}function cE(e){return new Array(e.length)}function UO(){return new ci(this._enter||this._groups.map(cE),this._parents)}function nh(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}nh.prototype={constructor:nh,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 WO(e){return function(){return e}}function VO(e,t,n,r,i,s){for(var o=0,l,c=t.length,d=s.length;o<d;++o)(l=t[o])?(l.__data__=s[o],r[o]=l):n[o]=new nh(e,s[o]);for(;o<c;++o)(l=t[o])&&(i[o]=l)}function KO(e,t,n,r,i,s,o){var l,c,d=new Map,u=t.length,f=s.length,p=new Array(u),h;for(l=0;l<u;++l)(c=t[l])&&(p[l]=h=o.call(c,c.__data__,l,t)+"",d.has(h)?i[l]=c:d.set(h,c));for(l=0;l<f;++l)h=o.call(e,s[l],l,s)+"",(c=d.get(h))?(r[l]=c,c.__data__=s[l],d.delete(h)):n[l]=new nh(e,s[l]);for(l=0;l<u;++l)(c=t[l])&&d.get(p[l])===c&&(i[l]=c)}function qO(e){return e.__data__}function YO(e,t){if(!arguments.length)return Array.from(this,qO);var n=t?KO:VO,r=this._parents,i=this._groups;typeof e!="function"&&(e=WO(e));for(var s=i.length,o=new Array(s),l=new Array(s),c=new Array(s),d=0;d<s;++d){var u=r[d],f=i[d],p=f.length,h=GO(e.call(u,u&&u.__data__,d,r)),g=h.length,b=l[d]=new Array(g),S=o[d]=new Array(g),x=c[d]=new Array(p);n(u,f,b,S,x,h,t);for(var w=0,v=0,k,E;w<g;++w)if(k=b[w]){for(w>=v&&(v=w+1);!(E=S[v])&&++v<g;);k._next=E||null}}return o=new ci(o,r),o._enter=l,o._exit=c,o}function GO(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function XO(){return new ci(this._exit||this._groups.map(cE),this._parents)}function JO(e,t,n){var r=this.enter(),i=this,s=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?s.remove():n(s),r&&i?r.merge(i).order():i}function QO(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,s=r.length,o=Math.min(i,s),l=new Array(i),c=0;c<o;++c)for(var d=n[c],u=r[c],f=d.length,p=l[c]=new Array(f),h,g=0;g<f;++g)(h=d[g]||u[g])&&(p[g]=h);for(;c<i;++c)l[c]=n[c];return new ci(l,this._parents)}function ZO(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,s=r[i],o;--i>=0;)(o=r[i])&&(s&&o.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(o,s),s=o);return this}function eM(e){e||(e=tM);function t(f,p){return f&&p?e(f.__data__,p.__data__):!f-!p}for(var n=this._groups,r=n.length,i=new Array(r),s=0;s<r;++s){for(var o=n[s],l=o.length,c=i[s]=new Array(l),d,u=0;u<l;++u)(d=o[u])&&(c[u]=d);c.sort(t)}return new ci(i,this._parents).order()}function tM(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function nM(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function rM(){return Array.from(this)}function iM(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,s=r.length;i<s;++i){var o=r[i];if(o)return o}return null}function sM(){let e=0;for(const t of this)++e;return e}function oM(){return!this.node()}function aM(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],s=0,o=i.length,l;s<o;++s)(l=i[s])&&e.call(l,l.__data__,s,i);return this}function lM(e){return function(){this.removeAttribute(e)}}function cM(e){return function(){this.removeAttributeNS(e.space,e.local)}}function uM(e,t){return function(){this.setAttribute(e,t)}}function dM(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function fM(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function pM(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 hM(e,t){var n=Jh(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?cM:lM:typeof t=="function"?n.local?pM:fM:n.local?dM:uM)(n,t))}function uE(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function mM(e){return function(){this.style.removeProperty(e)}}function gM(e,t,n){return function(){this.style.setProperty(e,t,n)}}function yM(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function xM(e,t,n){return arguments.length>1?this.each((t==null?mM:typeof t=="function"?yM:gM)(e,t,n??"")):tc(this.node(),e)}function tc(e,t){return e.style.getPropertyValue(t)||uE(e).getComputedStyle(e,null).getPropertyValue(t)}function wM(e){return function(){delete this[e]}}function vM(e,t){return function(){this[e]=t}}function bM(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function kM(e,t){return arguments.length>1?this.each((t==null?wM:typeof t=="function"?bM:vM)(e,t)):this.node()[e]}function dE(e){return e.trim().split(/^|\s+/)}function Kw(e){return e.classList||new fE(e)}function fE(e){this._node=e,this._names=dE(e.getAttribute("class")||"")}fE.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 pE(e,t){for(var n=Kw(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function hE(e,t){for(var n=Kw(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function SM(e){return function(){pE(this,e)}}function NM(e){return function(){hE(this,e)}}function jM(e,t){return function(){(t.apply(this,arguments)?pE:hE)(this,e)}}function CM(e,t){var n=dE(e+"");if(arguments.length<2){for(var r=Kw(this.node()),i=-1,s=n.length;++i<s;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?jM:t?SM:NM)(n,t))}function EM(){this.textContent=""}function _M(e){return function(){this.textContent=e}}function PM(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function AM(e){return arguments.length?this.each(e==null?EM:(typeof e=="function"?PM:_M)(e)):this.node().textContent}function IM(){this.innerHTML=""}function TM(e){return function(){this.innerHTML=e}}function RM(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function LM(e){return arguments.length?this.each(e==null?IM:(typeof e=="function"?RM:TM)(e)):this.node().innerHTML}function OM(){this.nextSibling&&this.parentNode.appendChild(this)}function MM(){return this.each(OM)}function $M(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function DM(){return this.each($M)}function FM(e){var t=typeof e=="function"?e:sE(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function zM(){return null}function BM(e,t){var n=typeof e=="function"?e:sE(e),r=t==null?zM:typeof t=="function"?t:Vw(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function HM(){var e=this.parentNode;e&&e.removeChild(this)}function UM(){return this.each(HM)}function WM(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function VM(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function KM(e){return this.select(e?VM:WM)}function qM(e){return arguments.length?this.property("__data__",e):this.node().__data__}function YM(e){return function(t){e.call(this,t,this.__data__)}}function GM(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 XM(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,s;n<i;++n)s=t[n],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++r]=s;++r?t.length=r:delete this.__on}}}function JM(e,t,n){return function(){var r=this.__on,i,s=YM(t);if(r){for(var o=0,l=r.length;o<l;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=s,i.options=n),i.value=t;return}}this.addEventListener(e.type,s,n),i={type:e.type,name:e.name,value:t,listener:s,options:n},r?r.push(i):this.__on=[i]}}function QM(e,t,n){var r=GM(e+""),i,s=r.length,o;if(arguments.length<2){var l=this.node().__on;if(l){for(var c=0,d=l.length,u;c<d;++c)for(i=0,u=l[c];i<s;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(l=t?JM:XM,i=0;i<s;++i)this.each(l(r[i],t,n));return this}function mE(e,t,n){var r=uE(e),i=r.CustomEvent;typeof i=="function"?i=new i(t,n):(i=r.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function ZM(e,t){return function(){return mE(this,e,t)}}function e$(e,t){return function(){return mE(this,e,t.apply(this,arguments))}}function t$(e,t){return this.each((typeof t=="function"?e$:ZM)(e,t))}function*n$(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,s=r.length,o;i<s;++i)(o=r[i])&&(yield o)}var gE=[null];function ci(e,t){this._groups=e,this._parents=t}function Cd(){return new ci([[document.documentElement]],gE)}function r$(){return this}ci.prototype=Cd.prototype={constructor:ci,select:PO,selectAll:RO,selectChild:$O,selectChildren:BO,filter:HO,data:YO,enter:UO,exit:XO,join:JO,merge:QO,selection:r$,order:ZO,sort:eM,call:nM,nodes:rM,node:iM,size:sM,empty:oM,each:aM,attr:hM,style:xM,property:kM,classed:CM,text:AM,html:LM,raise:MM,lower:DM,append:FM,insert:BM,remove:UM,clone:KM,datum:qM,on:QM,dispatch:t$,[Symbol.iterator]:n$};function ri(e){return typeof e=="string"?new ci([[document.querySelector(e)]],[document.documentElement]):new ci([[e]],gE)}function i$(e){let t;for(;t=e.sourceEvent;)e=t;return e}function zi(e,t){if(e=i$(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 i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}const s$={passive:!1},Qu={capture:!0,passive:!1};function vg(e){e.stopImmediatePropagation()}function Ul(e){e.preventDefault(),e.stopImmediatePropagation()}function yE(e){var t=e.document.documentElement,n=ri(e).on("dragstart.drag",Ul,Qu);"onselectstart"in t?n.on("selectstart.drag",Ul,Qu):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function xE(e,t){var n=e.document.documentElement,r=ri(e).on("dragstart.drag",null);t&&(r.on("click.drag",Ul,Qu),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 Df=e=>()=>e;function lx(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:s,x:o,y:l,dx:c,dy:d,dispatch:u}){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:i,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:o,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:u}})}lx.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function o$(e){return!e.ctrlKey&&!e.button}function a$(){return this.parentNode}function l$(e,t){return t??{x:e.x,y:e.y}}function c$(){return navigator.maxTouchPoints||"ontouchstart"in this}function wE(){var e=o$,t=a$,n=l$,r=c$,i={},s=Xh("start","drag","end"),o=0,l,c,d,u,f=0;function p(k){k.on("mousedown.drag",h).filter(r).on("touchstart.drag",S).on("touchmove.drag",x,s$).on("touchend.drag touchcancel.drag",w).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(k,E){if(!(u||!e.call(this,k,E))){var j=v(this,t.call(this,k,E),k,E,"mouse");j&&(ri(k.view).on("mousemove.drag",g,Qu).on("mouseup.drag",b,Qu),yE(k.view),vg(k),d=!1,l=k.clientX,c=k.clientY,j("start",k))}}function g(k){if(Ul(k),!d){var E=k.clientX-l,j=k.clientY-c;d=E*E+j*j>f}i.mouse("drag",k)}function b(k){ri(k.view).on("mousemove.drag mouseup.drag",null),xE(k.view,d),Ul(k),i.mouse("end",k)}function S(k,E){if(e.call(this,k,E)){var j=k.changedTouches,A=t.call(this,k,E),$=j.length,I,F;for(I=0;I<$;++I)(F=v(this,A,k,E,j[I].identifier,j[I]))&&(vg(k),F("start",k,j[I]))}}function x(k){var E=k.changedTouches,j=E.length,A,$;for(A=0;A<j;++A)($=i[E[A].identifier])&&(Ul(k),$("drag",k,E[A]))}function w(k){var E=k.changedTouches,j=E.length,A,$;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),A=0;A<j;++A)($=i[E[A].identifier])&&(vg(k),$("end",k,E[A]))}function v(k,E,j,A,$,I){var F=s.copy(),L=zi(I||j,E),T,q,D;if((D=n.call(k,new lx("beforestart",{sourceEvent:j,target:p,identifier:$,active:o,x:L[0],y:L[1],dx:0,dy:0,dispatch:F}),A))!=null)return T=D.x-L[0]||0,q=D.y-L[1]||0,function W(O,U,P){var R=L,C;switch(O){case"start":i[$]=W,C=o++;break;case"end":delete i[$],--o;case"drag":L=zi(P||U,E),C=o;break}F.call(O,k,new lx(O,{sourceEvent:U,subject:D,target:p,identifier:$,active:C,x:L[0]+T,y:L[1]+q,dx:L[0]-R[0],dy:L[1]-R[1],dispatch:F}),A)}}return p.filter=function(k){return arguments.length?(e=typeof k=="function"?k:Df(!!k),p):e},p.container=function(k){return arguments.length?(t=typeof k=="function"?k:Df(k),p):t},p.subject=function(k){return arguments.length?(n=typeof k=="function"?k:Df(k),p):n},p.touchable=function(k){return arguments.length?(r=typeof k=="function"?k:Df(!!k),p):r},p.on=function(){var k=s.on.apply(s,arguments);return k===s?p:k},p.clickDistance=function(k){return arguments.length?(f=(k=+k)*k,p):Math.sqrt(f)},p}function qw(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function vE(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Ed(){}var Zu=.7,rh=1/Zu,Wl="\\s*([+-]?\\d+)\\s*",ed="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ks="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",u$=/^#([0-9a-f]{3,8})$/,d$=new RegExp(`^rgb\\(${Wl},${Wl},${Wl}\\)$`),f$=new RegExp(`^rgb\\(${ks},${ks},${ks}\\)$`),p$=new RegExp(`^rgba\\(${Wl},${Wl},${Wl},${ed}\\)$`),h$=new RegExp(`^rgba\\(${ks},${ks},${ks},${ed}\\)$`),m$=new RegExp(`^hsl\\(${ed},${ks},${ks}\\)$`),g$=new RegExp(`^hsla\\(${ed},${ks},${ks},${ed}\\)$`),qb={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};qw(Ed,$a,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Yb,formatHex:Yb,formatHex8:y$,formatHsl:x$,formatRgb:Gb,toString:Gb});function Yb(){return this.rgb().formatHex()}function y$(){return this.rgb().formatHex8()}function x$(){return bE(this).formatHsl()}function Gb(){return this.rgb().formatRgb()}function $a(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=u$.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Xb(t):n===3?new zr(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Ff(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Ff(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=d$.exec(e))?new zr(t[1],t[2],t[3],1):(t=f$.exec(e))?new zr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=p$.exec(e))?Ff(t[1],t[2],t[3],t[4]):(t=h$.exec(e))?Ff(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=m$.exec(e))?Zb(t[1],t[2]/100,t[3]/100,1):(t=g$.exec(e))?Zb(t[1],t[2]/100,t[3]/100,t[4]):qb.hasOwnProperty(e)?Xb(qb[e]):e==="transparent"?new zr(NaN,NaN,NaN,0):null}function Xb(e){return new zr(e>>16&255,e>>8&255,e&255,1)}function Ff(e,t,n,r){return r<=0&&(e=t=n=NaN),new zr(e,t,n,r)}function w$(e){return e instanceof Ed||(e=$a(e)),e?(e=e.rgb(),new zr(e.r,e.g,e.b,e.opacity)):new zr}function cx(e,t,n,r){return arguments.length===1?w$(e):new zr(e,t,n,r??1)}function zr(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}qw(zr,cx,vE(Ed,{brighter(e){return e=e==null?rh:Math.pow(rh,e),new zr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Zu:Math.pow(Zu,e),new zr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new zr(_a(this.r),_a(this.g),_a(this.b),ih(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:Jb,formatHex:Jb,formatHex8:v$,formatRgb:Qb,toString:Qb}));function Jb(){return`#${ja(this.r)}${ja(this.g)}${ja(this.b)}`}function v$(){return`#${ja(this.r)}${ja(this.g)}${ja(this.b)}${ja((isNaN(this.opacity)?1:this.opacity)*255)}`}function Qb(){const e=ih(this.opacity);return`${e===1?"rgb(":"rgba("}${_a(this.r)}, ${_a(this.g)}, ${_a(this.b)}${e===1?")":`, ${e})`}`}function ih(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function _a(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ja(e){return e=_a(e),(e<16?"0":"")+e.toString(16)}function Zb(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ui(e,t,n,r)}function bE(e){if(e instanceof Ui)return new Ui(e.h,e.s,e.l,e.opacity);if(e instanceof Ed||(e=$a(e)),!e)return new Ui;if(e instanceof Ui)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),s=Math.max(t,n,r),o=NaN,l=s-i,c=(s+i)/2;return l?(t===s?o=(n-r)/l+(n<r)*6:n===s?o=(r-t)/l+2:o=(t-n)/l+4,l/=c<.5?s+i:2-s-i,o*=60):l=c>0&&c<1?0:o,new Ui(o,l,c,e.opacity)}function b$(e,t,n,r){return arguments.length===1?bE(e):new Ui(e,t,n,r??1)}function Ui(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}qw(Ui,b$,vE(Ed,{brighter(e){return e=e==null?rh:Math.pow(rh,e),new Ui(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Zu:Math.pow(Zu,e),new Ui(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,i=2*n-r;return new zr(bg(e>=240?e-240:e+120,i,r),bg(e,i,r),bg(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Ui(ek(this.h),zf(this.s),zf(this.l),ih(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=ih(this.opacity);return`${e===1?"hsl(":"hsla("}${ek(this.h)}, ${zf(this.s)*100}%, ${zf(this.l)*100}%${e===1?")":`, ${e})`}`}}));function ek(e){return e=(e||0)%360,e<0?e+360:e}function zf(e){return Math.max(0,Math.min(1,e||0))}function bg(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 Yw=e=>()=>e;function k$(e,t){return function(n){return e+n*t}}function S$(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 N$(e){return(e=+e)==1?kE:function(t,n){return n-t?S$(t,n,e):Yw(isNaN(t)?n:t)}}function kE(e,t){var n=t-e;return n?k$(e,n):Yw(isNaN(e)?t:e)}const sh=function e(t){var n=N$(t);function r(i,s){var o=n((i=cx(i)).r,(s=cx(s)).r),l=n(i.g,s.g),c=n(i.b,s.b),d=kE(i.opacity,s.opacity);return function(u){return i.r=o(u),i.g=l(u),i.b=c(u),i.opacity=d(u),i+""}}return r.gamma=e,r}(1);function j$(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(s){for(i=0;i<n;++i)r[i]=e[i]*(1-s)+t[i]*s;return r}}function C$(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function E$(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=new Array(r),s=new Array(n),o;for(o=0;o<r;++o)i[o]=Eu(e[o],t[o]);for(;o<n;++o)s[o]=t[o];return function(l){for(o=0;o<r;++o)s[o]=i[o](l);return s}}function _$(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function hs(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function P$(e,t){var n={},r={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?n[i]=Eu(e[i],t[i]):r[i]=t[i];return function(s){for(i in n)r[i]=n[i](s);return r}}var ux=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,kg=new RegExp(ux.source,"g");function A$(e){return function(){return e}}function I$(e){return function(t){return e(t)+""}}function SE(e,t){var n=ux.lastIndex=kg.lastIndex=0,r,i,s,o=-1,l=[],c=[];for(e=e+"",t=t+"";(r=ux.exec(e))&&(i=kg.exec(t));)(s=i.index)>n&&(s=t.slice(n,s),l[o]?l[o]+=s:l[++o]=s),(r=r[0])===(i=i[0])?l[o]?l[o]+=i:l[++o]=i:(l[++o]=null,c.push({i:o,x:hs(r,i)})),n=kg.lastIndex;return n<t.length&&(s=t.slice(n),l[o]?l[o]+=s:l[++o]=s),l.length<2?c[0]?I$(c[0].x):A$(t):(t=c.length,function(d){for(var u=0,f;u<t;++u)l[(f=c[u]).i]=f.x(d);return l.join("")})}function Eu(e,t){var n=typeof t,r;return t==null||n==="boolean"?Yw(t):(n==="number"?hs:n==="string"?(r=$a(t))?(t=r,sh):SE:t instanceof $a?sh:t instanceof Date?_$:C$(t)?j$:Array.isArray(t)?E$:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?P$:hs)(e,t)}var tk=180/Math.PI,dx={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function NE(e,t,n,r,i,s){var o,l,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(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,o=-o),{translateX:i,translateY:s,rotate:Math.atan2(t,e)*tk,skewX:Math.atan(c)*tk,scaleX:o,scaleY:l}}var Bf;function T$(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?dx:NE(t.a,t.b,t.c,t.d,t.e,t.f)}function R$(e){return e==null||(Bf||(Bf=document.createElementNS("http://www.w3.org/2000/svg","g")),Bf.setAttribute("transform",e),!(e=Bf.transform.baseVal.consolidate()))?dx:(e=e.matrix,NE(e.a,e.b,e.c,e.d,e.e,e.f))}function jE(e,t,n,r){function i(d){return d.length?d.pop()+" ":""}function s(d,u,f,p,h,g){if(d!==f||u!==p){var b=h.push("translate(",null,t,null,n);g.push({i:b-4,x:hs(d,f)},{i:b-2,x:hs(u,p)})}else(f||p)&&h.push("translate("+f+t+p+n)}function o(d,u,f,p){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),p.push({i:f.push(i(f)+"rotate(",null,r)-2,x:hs(d,u)})):u&&f.push(i(f)+"rotate("+u+r)}function l(d,u,f,p){d!==u?p.push({i:f.push(i(f)+"skewX(",null,r)-2,x:hs(d,u)}):u&&f.push(i(f)+"skewX("+u+r)}function c(d,u,f,p,h,g){if(d!==f||u!==p){var b=h.push(i(h)+"scale(",null,",",null,")");g.push({i:b-4,x:hs(d,f)},{i:b-2,x:hs(u,p)})}else(f!==1||p!==1)&&h.push(i(h)+"scale("+f+","+p+")")}return function(d,u){var f=[],p=[];return d=e(d),u=e(u),s(d.translateX,d.translateY,u.translateX,u.translateY,f,p),o(d.rotate,u.rotate,f,p),l(d.skewX,u.skewX,f,p),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,f,p),d=u=null,function(h){for(var g=-1,b=p.length,S;++g<b;)f[(S=p[g]).i]=S.x(h);return f.join("")}}}var L$=jE(T$,"px, ","px)","deg)"),O$=jE(R$,", ",")",")"),M$=1e-12;function nk(e){return((e=Math.exp(e))+1/e)/2}function $$(e){return((e=Math.exp(e))-1/e)/2}function D$(e){return((e=Math.exp(2*e))-1)/(e+1)}const bp=function e(t,n,r){function i(s,o){var l=s[0],c=s[1],d=s[2],u=o[0],f=o[1],p=o[2],h=u-l,g=f-c,b=h*h+g*g,S,x;if(b<M$)x=Math.log(p/d)/t,S=function(A){return[l+A*h,c+A*g,d*Math.exp(t*A*x)]};else{var w=Math.sqrt(b),v=(p*p-d*d+r*b)/(2*d*n*w),k=(p*p-d*d-r*b)/(2*p*n*w),E=Math.log(Math.sqrt(v*v+1)-v),j=Math.log(Math.sqrt(k*k+1)-k);x=(j-E)/t,S=function(A){var $=A*x,I=nk(E),F=d/(n*w)*(I*D$(t*$+E)-$$(E));return[l+F*h,c+F*g,d*I/nk(t*$+E)]}}return S.duration=x*1e3*t/Math.SQRT2,S}return i.rho=function(s){var o=Math.max(.001,+s),l=o*o,c=l*l;return e(o,l,c)},i}(Math.SQRT2,2,4);var nc=0,du=0,Qc=0,CE=1e3,oh,fu,ah=0,Da=0,Qh=0,td=typeof performance=="object"&&performance.now?performance:Date,EE=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Gw(){return Da||(EE(F$),Da=td.now()+Qh)}function F$(){Da=0}function lh(){this._call=this._time=this._next=null}lh.prototype=_E.prototype={constructor:lh,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Gw():+n)+(t==null?0:+t),!this._next&&fu!==this&&(fu?fu._next=this:oh=this,fu=this),this._call=e,this._time=n,fx()},stop:function(){this._call&&(this._call=null,this._time=1/0,fx())}};function _E(e,t,n){var r=new lh;return r.restart(e,t,n),r}function z$(){Gw(),++nc;for(var e=oh,t;e;)(t=Da-e._time)>=0&&e._call.call(void 0,t),e=e._next;--nc}function rk(){Da=(ah=td.now())+Qh,nc=du=0;try{z$()}finally{nc=0,H$(),Da=0}}function B$(){var e=td.now(),t=e-ah;t>CE&&(Qh-=t,ah=e)}function H$(){for(var e,t=oh,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:oh=n);fu=e,fx(r)}function fx(e){if(!nc){du&&(du=clearTimeout(du));var t=e-Da;t>24?(e<1/0&&(du=setTimeout(rk,e-td.now()-Qh)),Qc&&(Qc=clearInterval(Qc))):(Qc||(ah=td.now(),Qc=setInterval(B$,CE)),nc=1,EE(rk))}}function ik(e,t,n){var r=new lh;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var U$=Xh("start","end","cancel","interrupt"),W$=[],PE=0,sk=1,px=2,kp=3,ok=4,hx=5,Sp=6;function Zh(e,t,n,r,i,s){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;V$(e,n,{name:t,index:r,group:i,on:U$,tween:W$,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:PE})}function Xw(e,t){var n=Ji(e,t);if(n.state>PE)throw new Error("too late; already scheduled");return n}function _s(e,t){var n=Ji(e,t);if(n.state>kp)throw new Error("too late; already running");return n}function Ji(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function V$(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=_E(s,0,n.time);function s(d){n.state=sk,n.timer.restart(o,n.delay,n.time),n.delay<=d&&o(d-n.delay)}function o(d){var u,f,p,h;if(n.state!==sk)return c();for(u in r)if(h=r[u],h.name===n.name){if(h.state===kp)return ik(o);h.state===ok?(h.state=Sp,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[u]):+u<t&&(h.state=Sp,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[u])}if(ik(function(){n.state===kp&&(n.state=ok,n.timer.restart(l,n.delay,n.time),l(d))}),n.state=px,n.on.call("start",e,e.__data__,n.index,n.group),n.state===px){for(n.state=kp,i=new Array(p=n.tween.length),u=0,f=-1;u<p;++u)(h=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(i[++f]=h);i.length=f+1}}function l(d){for(var u=d<n.duration?n.ease.call(null,d/n.duration):(n.timer.restart(c),n.state=hx,1),f=-1,p=i.length;++f<p;)i[f].call(e,u);n.state===hx&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Sp,n.timer.stop(),delete r[t];for(var d in r)return;delete e.__transition}}function Np(e,t){var n=e.__transition,r,i,s=!0,o;if(n){t=t==null?null:t+"";for(o in n){if((r=n[o]).name!==t){s=!1;continue}i=r.state>px&&r.state<hx,r.state=Sp,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[o]}s&&delete e.__transition}}function K$(e){return this.each(function(){Np(this,e)})}function q$(e,t){var n,r;return function(){var i=_s(this,e),s=i.tween;if(s!==n){r=n=s;for(var o=0,l=r.length;o<l;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function Y$(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var s=_s(this,e),o=s.tween;if(o!==r){i=(r=o).slice();for(var l={name:t,value:n},c=0,d=i.length;c<d;++c)if(i[c].name===t){i[c]=l;break}c===d&&i.push(l)}s.tween=i}}function G$(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Ji(this.node(),n).tween,i=0,s=r.length,o;i<s;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?q$:Y$)(n,e,t))}function Jw(e,t,n){var r=e._id;return e.each(function(){var i=_s(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return Ji(i,r).value[t]}}function AE(e,t){var n;return(typeof t=="number"?hs:t instanceof $a?sh:(n=$a(t))?(t=n,sh):SE)(e,t)}function X$(e){return function(){this.removeAttribute(e)}}function J$(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Q$(e,t,n){var r,i=n+"",s;return function(){var o=this.getAttribute(e);return o===i?null:o===r?s:s=t(r=o,n)}}function Z$(e,t,n){var r,i=n+"",s;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?s:s=t(r=o,n)}}function eD(e,t,n){var r,i,s;return function(){var o,l=n(this),c;return l==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=l+"",o===c?null:o===r&&c===i?s:(i=c,s=t(r=o,l)))}}function tD(e,t,n){var r,i,s;return function(){var o,l=n(this),c;return l==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=l+"",o===c?null:o===r&&c===i?s:(i=c,s=t(r=o,l)))}}function nD(e,t){var n=Jh(e),r=n==="transform"?O$:AE;return this.attrTween(e,typeof t=="function"?(n.local?tD:eD)(n,r,Jw(this,"attr."+e,t)):t==null?(n.local?J$:X$)(n):(n.local?Z$:Q$)(n,r,t))}function rD(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function iD(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function sD(e,t){var n,r;function i(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&iD(e,s)),n}return i._value=t,i}function oD(e,t){var n,r;function i(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&rD(e,s)),n}return i._value=t,i}function aD(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=Jh(e);return this.tween(n,(r.local?sD:oD)(r,t))}function lD(e,t){return function(){Xw(this,e).delay=+t.apply(this,arguments)}}function cD(e,t){return t=+t,function(){Xw(this,e).delay=t}}function uD(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?lD:cD)(t,e)):Ji(this.node(),t).delay}function dD(e,t){return function(){_s(this,e).duration=+t.apply(this,arguments)}}function fD(e,t){return t=+t,function(){_s(this,e).duration=t}}function pD(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?dD:fD)(t,e)):Ji(this.node(),t).duration}function hD(e,t){if(typeof t!="function")throw new Error;return function(){_s(this,e).ease=t}}function mD(e){var t=this._id;return arguments.length?this.each(hD(t,e)):Ji(this.node(),t).ease}function gD(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;_s(this,e).ease=n}}function yD(e){if(typeof e!="function")throw new Error;return this.each(gD(this._id,e))}function xD(e){typeof e!="function"&&(e=aE(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var s=t[i],o=s.length,l=r[i]=[],c,d=0;d<o;++d)(c=s[d])&&e.call(c,c.__data__,d,s)&&l.push(c);return new Zs(r,this._parents,this._name,this._id)}function wD(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,i=n.length,s=Math.min(r,i),o=new Array(r),l=0;l<s;++l)for(var c=t[l],d=n[l],u=c.length,f=o[l]=new Array(u),p,h=0;h<u;++h)(p=c[h]||d[h])&&(f[h]=p);for(;l<r;++l)o[l]=t[l];return new Zs(o,this._parents,this._name,this._id)}function vD(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 bD(e,t,n){var r,i,s=vD(t)?Xw:_s;return function(){var o=s(this,e),l=o.on;l!==r&&(i=(r=l).copy()).on(t,n),o.on=i}}function kD(e,t){var n=this._id;return arguments.length<2?Ji(this.node(),n).on.on(e):this.each(bD(n,e,t))}function SD(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function ND(){return this.on("end.remove",SD(this._id))}function jD(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Vw(e));for(var r=this._groups,i=r.length,s=new Array(i),o=0;o<i;++o)for(var l=r[o],c=l.length,d=s[o]=new Array(c),u,f,p=0;p<c;++p)(u=l[p])&&(f=e.call(u,u.__data__,p,l))&&("__data__"in u&&(f.__data__=u.__data__),d[p]=f,Zh(d[p],t,n,p,d,Ji(u,n)));return new Zs(s,this._parents,t,n)}function CD(e){var t=this._name,n=this._id;typeof e!="function"&&(e=oE(e));for(var r=this._groups,i=r.length,s=[],o=[],l=0;l<i;++l)for(var c=r[l],d=c.length,u,f=0;f<d;++f)if(u=c[f]){for(var p=e.call(u,u.__data__,f,c),h,g=Ji(u,n),b=0,S=p.length;b<S;++b)(h=p[b])&&Zh(h,t,n,b,p,g);s.push(p),o.push(u)}return new Zs(s,o,t,n)}var ED=Cd.prototype.constructor;function _D(){return new ED(this._groups,this._parents)}function PD(e,t){var n,r,i;return function(){var s=tc(this,e),o=(this.style.removeProperty(e),tc(this,e));return s===o?null:s===n&&o===r?i:i=t(n=s,r=o)}}function IE(e){return function(){this.style.removeProperty(e)}}function AD(e,t,n){var r,i=n+"",s;return function(){var o=tc(this,e);return o===i?null:o===r?s:s=t(r=o,n)}}function ID(e,t,n){var r,i,s;return function(){var o=tc(this,e),l=n(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(e),tc(this,e))),o===c?null:o===r&&c===i?s:(i=c,s=t(r=o,l))}}function TD(e,t){var n,r,i,s="style."+t,o="end."+s,l;return function(){var c=_s(this,e),d=c.on,u=c.value[s]==null?l||(l=IE(t)):void 0;(d!==n||i!==u)&&(r=(n=d).copy()).on(o,i=u),c.on=r}}function RD(e,t,n){var r=(e+="")=="transform"?L$:AE;return t==null?this.styleTween(e,PD(e,r)).on("end.style."+e,IE(e)):typeof t=="function"?this.styleTween(e,ID(e,r,Jw(this,"style."+e,t))).each(TD(this._id,e)):this.styleTween(e,AD(e,r,t),n).on("end.style."+e,null)}function LD(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function OD(e,t,n){var r,i;function s(){var o=t.apply(this,arguments);return o!==i&&(r=(i=o)&&LD(e,o,n)),r}return s._value=t,s}function MD(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,OD(e,t,n??""))}function $D(e){return function(){this.textContent=e}}function DD(e){return function(){var t=e(this);this.textContent=t??""}}function FD(e){return this.tween("text",typeof e=="function"?DD(Jw(this,"text",e)):$D(e==null?"":e+""))}function zD(e){return function(t){this.textContent=e.call(this,t)}}function BD(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&zD(i)),t}return r._value=e,r}function HD(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,BD(e))}function UD(){for(var e=this._name,t=this._id,n=TE(),r=this._groups,i=r.length,s=0;s<i;++s)for(var o=r[s],l=o.length,c,d=0;d<l;++d)if(c=o[d]){var u=Ji(c,t);Zh(c,e,n,d,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Zs(r,this._parents,e,n)}function WD(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(s,o){var l={value:o},c={value:function(){--i===0&&s()}};n.each(function(){var d=_s(this,r),u=d.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(c)),d.on=t}),i===0&&s()})}var VD=0;function Zs(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function TE(){return++VD}var Ds=Cd.prototype;Zs.prototype={constructor:Zs,select:jD,selectAll:CD,selectChild:Ds.selectChild,selectChildren:Ds.selectChildren,filter:xD,merge:wD,selection:_D,transition:UD,call:Ds.call,nodes:Ds.nodes,node:Ds.node,size:Ds.size,empty:Ds.empty,each:Ds.each,on:kD,attr:nD,attrTween:aD,style:RD,styleTween:MD,text:FD,textTween:HD,remove:ND,tween:G$,delay:uD,duration:pD,ease:mD,easeVarying:yD,end:WD,[Symbol.iterator]:Ds[Symbol.iterator]};function KD(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var qD={time:null,delay:0,duration:250,ease:KD};function YD(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 GD(e){var t,n;e instanceof Zs?(t=e._id,e=e._name):(t=TE(),(n=qD).time=Gw(),e=e==null?null:e+"");for(var r=this._groups,i=r.length,s=0;s<i;++s)for(var o=r[s],l=o.length,c,d=0;d<l;++d)(c=o[d])&&Zh(c,e,t,d,o,n||YD(c,t));return new Zs(r,this._parents,e,t)}Cd.prototype.interrupt=K$;Cd.prototype.transition=GD;const Hf=e=>()=>e;function XD(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){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:i}})}function Ks(e,t,n){this.k=e,this.x=t,this.y=n}Ks.prototype={constructor:Ks,scale:function(e){return e===1?this:new Ks(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ks(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 em=new Ks(1,0,0);RE.prototype=Ks.prototype;function RE(e){for(;!e.__zoom;)if(!(e=e.parentNode))return em;return e.__zoom}function Sg(e){e.stopImmediatePropagation()}function Zc(e){e.preventDefault(),e.stopImmediatePropagation()}function JD(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function QD(){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 ak(){return this.__zoom||em}function ZD(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function eF(){return navigator.maxTouchPoints||"ontouchstart"in this}function tF(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>s?(s+o)/2:Math.min(0,s)||Math.max(0,o))}function LE(){var e=JD,t=QD,n=tF,r=ZD,i=eF,s=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],l=250,c=bp,d=Xh("start","zoom","end"),u,f,p,h=500,g=150,b=0,S=10;function x(D){D.property("__zoom",ak).on("wheel.zoom",$,{passive:!1}).on("mousedown.zoom",I).on("dblclick.zoom",F).filter(i).on("touchstart.zoom",L).on("touchmove.zoom",T).on("touchend.zoom touchcancel.zoom",q).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}x.transform=function(D,W,O,U){var P=D.selection?D.selection():D;P.property("__zoom",ak),D!==P?E(D,W,O,U):P.interrupt().each(function(){j(this,arguments).event(U).start().zoom(null,typeof W=="function"?W.apply(this,arguments):W).end()})},x.scaleBy=function(D,W,O,U){x.scaleTo(D,function(){var P=this.__zoom.k,R=typeof W=="function"?W.apply(this,arguments):W;return P*R},O,U)},x.scaleTo=function(D,W,O,U){x.transform(D,function(){var P=t.apply(this,arguments),R=this.__zoom,C=O==null?k(P):typeof O=="function"?O.apply(this,arguments):O,G=R.invert(C),J=typeof W=="function"?W.apply(this,arguments):W;return n(v(w(R,J),C,G),P,o)},O,U)},x.translateBy=function(D,W,O,U){x.transform(D,function(){return n(this.__zoom.translate(typeof W=="function"?W.apply(this,arguments):W,typeof O=="function"?O.apply(this,arguments):O),t.apply(this,arguments),o)},null,U)},x.translateTo=function(D,W,O,U,P){x.transform(D,function(){var R=t.apply(this,arguments),C=this.__zoom,G=U==null?k(R):typeof U=="function"?U.apply(this,arguments):U;return n(em.translate(G[0],G[1]).scale(C.k).translate(typeof W=="function"?-W.apply(this,arguments):-W,typeof O=="function"?-O.apply(this,arguments):-O),R,o)},U,P)};function w(D,W){return W=Math.max(s[0],Math.min(s[1],W)),W===D.k?D:new Ks(W,D.x,D.y)}function v(D,W,O){var U=W[0]-O[0]*D.k,P=W[1]-O[1]*D.k;return U===D.x&&P===D.y?D:new Ks(D.k,U,P)}function k(D){return[(+D[0][0]+ +D[1][0])/2,(+D[0][1]+ +D[1][1])/2]}function E(D,W,O,U){D.on("start.zoom",function(){j(this,arguments).event(U).start()}).on("interrupt.zoom end.zoom",function(){j(this,arguments).event(U).end()}).tween("zoom",function(){var P=this,R=arguments,C=j(P,R).event(U),G=t.apply(P,R),J=O==null?k(G):typeof O=="function"?O.apply(P,R):O,B=Math.max(G[1][0]-G[0][0],G[1][1]-G[0][1]),te=P.__zoom,de=typeof W=="function"?W.apply(P,R):W,ce=c(te.invert(J).concat(B/te.k),de.invert(J).concat(B/de.k));return function(ue){if(ue===1)ue=de;else{var re=ce(ue),ge=B/re[2];ue=new Ks(ge,J[0]-re[0]*ge,J[1]-re[1]*ge)}C.zoom(null,ue)}})}function j(D,W,O){return!O&&D.__zooming||new A(D,W)}function A(D,W){this.that=D,this.args=W,this.active=0,this.sourceEvent=null,this.extent=t.apply(D,W),this.taps=0}A.prototype={event:function(D){return D&&(this.sourceEvent=D),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(D,W){return this.mouse&&D!=="mouse"&&(this.mouse[1]=W.invert(this.mouse[0])),this.touch0&&D!=="touch"&&(this.touch0[1]=W.invert(this.touch0[0])),this.touch1&&D!=="touch"&&(this.touch1[1]=W.invert(this.touch1[0])),this.that.__zoom=W,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(D){var W=ri(this.that).datum();d.call(D,this.that,new XD(D,{sourceEvent:this.sourceEvent,target:x,transform:this.that.__zoom,dispatch:d}),W)}};function $(D,...W){if(!e.apply(this,arguments))return;var O=j(this,W).event(D),U=this.__zoom,P=Math.max(s[0],Math.min(s[1],U.k*Math.pow(2,r.apply(this,arguments)))),R=zi(D);if(O.wheel)(O.mouse[0][0]!==R[0]||O.mouse[0][1]!==R[1])&&(O.mouse[1]=U.invert(O.mouse[0]=R)),clearTimeout(O.wheel);else{if(U.k===P)return;O.mouse=[R,U.invert(R)],Np(this),O.start()}Zc(D),O.wheel=setTimeout(C,g),O.zoom("mouse",n(v(w(U,P),O.mouse[0],O.mouse[1]),O.extent,o));function C(){O.wheel=null,O.end()}}function I(D,...W){if(p||!e.apply(this,arguments))return;var O=D.currentTarget,U=j(this,W,!0).event(D),P=ri(D.view).on("mousemove.zoom",J,!0).on("mouseup.zoom",B,!0),R=zi(D,O),C=D.clientX,G=D.clientY;yE(D.view),Sg(D),U.mouse=[R,this.__zoom.invert(R)],Np(this),U.start();function J(te){if(Zc(te),!U.moved){var de=te.clientX-C,ce=te.clientY-G;U.moved=de*de+ce*ce>b}U.event(te).zoom("mouse",n(v(U.that.__zoom,U.mouse[0]=zi(te,O),U.mouse[1]),U.extent,o))}function B(te){P.on("mousemove.zoom mouseup.zoom",null),xE(te.view,U.moved),Zc(te),U.event(te).end()}}function F(D,...W){if(e.apply(this,arguments)){var O=this.__zoom,U=zi(D.changedTouches?D.changedTouches[0]:D,this),P=O.invert(U),R=O.k*(D.shiftKey?.5:2),C=n(v(w(O,R),U,P),t.apply(this,W),o);Zc(D),l>0?ri(this).transition().duration(l).call(E,C,U,D):ri(this).call(x.transform,C,U,D)}}function L(D,...W){if(e.apply(this,arguments)){var O=D.touches,U=O.length,P=j(this,W,D.changedTouches.length===U).event(D),R,C,G,J;for(Sg(D),C=0;C<U;++C)G=O[C],J=zi(G,this),J=[J,this.__zoom.invert(J),G.identifier],P.touch0?!P.touch1&&P.touch0[2]!==J[2]&&(P.touch1=J,P.taps=0):(P.touch0=J,R=!0,P.taps=1+!!u);u&&(u=clearTimeout(u)),R&&(P.taps<2&&(f=J[0],u=setTimeout(function(){u=null},h)),Np(this),P.start())}}function T(D,...W){if(this.__zooming){var O=j(this,W).event(D),U=D.changedTouches,P=U.length,R,C,G,J;for(Zc(D),R=0;R<P;++R)C=U[R],G=zi(C,this),O.touch0&&O.touch0[2]===C.identifier?O.touch0[0]=G:O.touch1&&O.touch1[2]===C.identifier&&(O.touch1[0]=G);if(C=O.that.__zoom,O.touch1){var B=O.touch0[0],te=O.touch0[1],de=O.touch1[0],ce=O.touch1[1],ue=(ue=de[0]-B[0])*ue+(ue=de[1]-B[1])*ue,re=(re=ce[0]-te[0])*re+(re=ce[1]-te[1])*re;C=w(C,Math.sqrt(ue/re)),G=[(B[0]+de[0])/2,(B[1]+de[1])/2],J=[(te[0]+ce[0])/2,(te[1]+ce[1])/2]}else if(O.touch0)G=O.touch0[0],J=O.touch0[1];else return;O.zoom("touch",n(v(C,G,J),O.extent,o))}}function q(D,...W){if(this.__zooming){var O=j(this,W).event(D),U=D.changedTouches,P=U.length,R,C;for(Sg(D),p&&clearTimeout(p),p=setTimeout(function(){p=null},h),R=0;R<P;++R)C=U[R],O.touch0&&O.touch0[2]===C.identifier?delete O.touch0:O.touch1&&O.touch1[2]===C.identifier&&delete O.touch1;if(O.touch1&&!O.touch0&&(O.touch0=O.touch1,delete O.touch1),O.touch0)O.touch0[1]=this.__zoom.invert(O.touch0[0]);else if(O.end(),O.taps===2&&(C=zi(C,this),Math.hypot(f[0]-C[0],f[1]-C[1])<S)){var G=ri(this).on("dblclick.zoom");G&&G.apply(this,arguments)}}}return x.wheelDelta=function(D){return arguments.length?(r=typeof D=="function"?D:Hf(+D),x):r},x.filter=function(D){return arguments.length?(e=typeof D=="function"?D:Hf(!!D),x):e},x.touchable=function(D){return arguments.length?(i=typeof D=="function"?D:Hf(!!D),x):i},x.extent=function(D){return arguments.length?(t=typeof D=="function"?D:Hf([[+D[0][0],+D[0][1]],[+D[1][0],+D[1][1]]]),x):t},x.scaleExtent=function(D){return arguments.length?(s[0]=+D[0],s[1]=+D[1],x):[s[0],s[1]]},x.translateExtent=function(D){return arguments.length?(o[0][0]=+D[0][0],o[1][0]=+D[1][0],o[0][1]=+D[0][1],o[1][1]=+D[1][1],x):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},x.constrain=function(D){return arguments.length?(n=D,x):n},x.duration=function(D){return arguments.length?(l=+D,x):l},x.interpolate=function(D){return arguments.length?(c=D,x):c},x.on=function(){var D=d.on.apply(d,arguments);return D===d?x:D},x.clickDistance=function(D){return arguments.length?(b=(D=+D)*D,x):Math.sqrt(b)},x.tapDistance=function(D){return arguments.length?(S=+D,x):S},x}const Cs={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."},nd=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],OE=["Enter"," ","Escape"],ME={"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 rc;(function(e){e.Strict="strict",e.Loose="loose"})(rc||(rc={}));var Pa;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Pa||(Pa={}));var rd;(function(e){e.Partial="partial",e.Full="full"})(rd||(rd={}));const $E={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Eo;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Eo||(Eo={}));var qr;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(qr||(qr={}));var Fe;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Fe||(Fe={}));const lk={[Fe.Left]:Fe.Right,[Fe.Right]:Fe.Left,[Fe.Top]:Fe.Bottom,[Fe.Bottom]:Fe.Top};function DE(e){return e===null?null:e?"valid":"invalid"}const FE=e=>"id"in e&&"source"in e&&"target"in e,nF=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Qw=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),_d=(e,t=[0,0])=>{const{width:n,height:r}=ro(e),i=e.origin??t,s=n*i[0],o=r*i[1];return{x:e.position.x-s,y:e.position.y-o}},rF=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,i)=>{const s=typeof i=="string";let o=!t.nodeLookup&&!s?i:void 0;t.nodeLookup&&(o=s?t.nodeLookup.get(i):Qw(i)?i:t.nodeLookup.get(i.id));const l=o?ch(o,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return tm(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return nm(n)},Pd=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(i=>{(t.filter===void 0||t.filter(i))&&(n=tm(n,ch(i)),r=!0)}),r?nm(n):{x:0,y:0,width:0,height:0}},Zw=(e,t,[n,r,i]=[0,0,1],s=!1,o=!1)=>{const l={...Id(t,[n,r,i]),width:t.width/i,height:t.height/i},c=[];for(const d of e.values()){const{measured:u,selectable:f=!0,hidden:p=!1}=d;if(o&&!f||p)continue;const h=u.width??d.width??d.initialWidth??null,g=u.height??d.height??d.initialHeight??null,b=id(l,sc(d)),S=(h??0)*(g??0),x=s&&b>0;(!d.internals.handleBounds||x||b>=S||d.dragging)&&c.push(d)}return c},iF=(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 sF(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(i=>i.id)):null;return e.forEach(i=>{i.measured.width&&i.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!i.hidden)&&(!r||r.has(i.id))&&n.set(i.id,i)}),n}async function oF({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:s},o){if(e.size===0)return Promise.resolve(!0);const l=sF(e,o),c=Pd(l),d=ev(c,t,n,(o==null?void 0:o.minZoom)??i,(o==null?void 0:o.maxZoom)??s,(o==null?void 0:o.padding)??.1);return await r.setViewport(d,{duration:o==null?void 0:o.duration,ease:o==null?void 0:o.ease,interpolate:o==null?void 0:o.interpolate}),Promise.resolve(!0)}function zE({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:s}){const o=n.get(e),l=o.parentId?n.get(o.parentId):void 0,{x:c,y:d}=l?l.internals.positionAbsolute:{x:0,y:0},u=o.origin??r;let f=o.extent||i;if(o.extent==="parent"&&!o.expandParent)if(!l)s==null||s("005",Cs.error005());else{const h=l.measured.width,g=l.measured.height;h&&g&&(f=[[c,d],[c+h,d+g]])}else l&&oc(o.extent)&&(f=[[o.extent[0][0]+c,o.extent[0][1]+d],[o.extent[1][0]+c,o.extent[1][1]+d]]);const p=oc(f)?Fa(t,f,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&(s==null||s("015",Cs.error015())),{position:{x:p.x-c+(o.measured.width??0)*u[0],y:p.y-d+(o.measured.height??0)*u[1]},positionAbsolute:p}}async function aF({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){const s=new Set(e.map(p=>p.id)),o=[];for(const p of n){if(p.deletable===!1)continue;const h=s.has(p.id),g=!h&&p.parentId&&o.find(b=>b.id===p.parentId);(h||g)&&o.push(p)}const l=new Set(t.map(p=>p.id)),c=r.filter(p=>p.deletable!==!1),u=iF(o,c);for(const p of c)l.has(p.id)&&!u.find(g=>g.id===p.id)&&u.push(p);if(!i)return{edges:u,nodes:o};const f=await i({nodes:o,edges:u});return typeof f=="boolean"?f?{edges:u,nodes:o}:{edges:[],nodes:[]}:f}const ic=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Fa=(e={x:0,y:0},t,n)=>({x:ic(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:ic(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function BE(e,t,n){const{width:r,height:i}=ro(n),{x:s,y:o}=n.internals.positionAbsolute;return Fa(e,[[s,o],[s+r,o+i]],t)}const ck=(e,t,n)=>e<t?ic(Math.abs(e-t),1,t)/t:e>n?-ic(Math.abs(e-n),1,t)/t:0,HE=(e,t,n=15,r=40)=>{const i=ck(e.x,r,t.width-r)*n,s=ck(e.y,r,t.height-r)*n;return[i,s]},tm=(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)}),mx=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),nm=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),sc=(e,t=[0,0])=>{var i,s;const{x:n,y:r}=Qw(e)?e.internals.positionAbsolute:_d(e,t);return{x:n,y:r,width:((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0,height:((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0}},ch=(e,t=[0,0])=>{var i,s;const{x:n,y:r}=Qw(e)?e.internals.positionAbsolute:_d(e,t);return{x:n,y:r,x2:n+(((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0),y2:r+(((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0)}},UE=(e,t)=>nm(tm(mx(e),mx(t))),id=(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)},uk=e=>Wi(e.width)&&Wi(e.height)&&Wi(e.x)&&Wi(e.y),Wi=e=>!isNaN(e)&&isFinite(e),lF=(e,t)=>{},Ad=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Id=({x:e,y:t},[n,r,i],s=!1,o=[1,1])=>{const l={x:(e-n)/i,y:(t-r)/i};return s?Ad(l,o):l},uh=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function ul(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 cF(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=ul(e,n),i=ul(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e=="object"){const r=ul(e.top??e.y??0,n),i=ul(e.bottom??e.y??0,n),s=ul(e.left??e.x??0,t),o=ul(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:s,x:s+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function uF(e,t,n,r,i,s){const{x:o,y:l}=uh(e,[t,n,r]),{x:c,y:d}=uh({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,f=s-d;return{left:Math.floor(o),top:Math.floor(l),right:Math.floor(u),bottom:Math.floor(f)}}const ev=(e,t,n,r,i,s)=>{const o=cF(s,t,n),l=(t-o.x)/e.width,c=(n-o.y)/e.height,d=Math.min(l,c),u=ic(d,r,i),f=e.x+e.width/2,p=e.y+e.height/2,h=t/2-f*u,g=n/2-p*u,b=uF(e,h,g,u,t,n),S={left:Math.min(b.left-o.left,0),top:Math.min(b.top-o.top,0),right:Math.min(b.right-o.right,0),bottom:Math.min(b.bottom-o.bottom,0)};return{x:h-S.left+S.right,y:g-S.top+S.bottom,zoom:u}},sd=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function oc(e){return e!=null&&e!=="parent"}function ro(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 WE(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 VE(e,t={width:0,height:0},n,r,i){const s={...e},o=r.get(n);if(o){const l=o.origin||i;s.x+=o.internals.positionAbsolute.x-(t.width??0)*l[0],s.y+=o.internals.positionAbsolute.y-(t.height??0)*l[1]}return s}function dk(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function dF(){let e,t;return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}}function fF(e){return{...ME,...e||{}}}function _u(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){const{x:s,y:o}=Vi(e),l=Id({x:s-((i==null?void 0:i.left)??0),y:o-((i==null?void 0:i.top)??0)},r),{x:c,y:d}=n?Ad(l,t):l;return{xSnapped:c,ySnapped:d,...l}}const tv=e=>({width:e.offsetWidth,height:e.offsetHeight}),KE=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},pF=["INPUT","SELECT","TEXTAREA"];function qE(e){var r,i;const t=((i=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:i[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:pF.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const YE=e=>"clientX"in e,Vi=(e,t)=>{var s,o;const n=YE(e),r=n?e.clientX:(s=e.touches)==null?void 0:s[0].clientX,i=n?e.clientY:(o=e.touches)==null?void 0:o[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},fk=(e,t,n,r,i)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(o=>{const l=o.getBoundingClientRect();return{id:o.getAttribute("data-handleid"),type:e,nodeId:i,position:o.getAttribute("data-handlepos"),x:(l.left-n.left)/r,y:(l.top-n.top)/r,...tv(o)}})};function GE({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:s,targetControlX:o,targetControlY:l}){const c=e*.125+i*.375+o*.375+n*.125,d=t*.125+s*.375+l*.375+r*.125,u=Math.abs(c-e),f=Math.abs(d-t);return[c,d,u,f]}function Uf(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function pk({pos:e,x1:t,y1:n,x2:r,y2:i,c:s}){switch(e){case Fe.Left:return[t-Uf(t-r,s),n];case Fe.Right:return[t+Uf(r-t,s),n];case Fe.Top:return[t,n-Uf(n-i,s)];case Fe.Bottom:return[t,n+Uf(i-n,s)]}}function XE({sourceX:e,sourceY:t,sourcePosition:n=Fe.Bottom,targetX:r,targetY:i,targetPosition:s=Fe.Top,curvature:o=.25}){const[l,c]=pk({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[d,u]=pk({pos:s,x1:r,y1:i,x2:e,y2:t,c:o}),[f,p,h,g]=GE({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:l,sourceControlY:c,targetControlX:d,targetControlY:u});return[`M${e},${t} C${l},${c} ${d},${u} ${r},${i}`,f,p,h,g]}function JE({sourceX:e,sourceY:t,targetX:n,targetY:r}){const i=Math.abs(n-e)/2,s=n<e?n+i:n-i,o=Math.abs(r-t)/2,l=r<t?r+o:r-o;return[s,l,i,o]}function hF({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:s="basic"}){if(s==="manual")return r;const o=i&&n?r+1e3:r,l=Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0);return o+l}function mF({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){const s=tm(ch(e),ch(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const o={x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]};return id(o,nm(s))>0}const gF=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,yF=(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)),od=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||gF;let i;return FE(e)?i={...e}:i={...e,id:r(e)},yF(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function QE({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[i,s,o,l]=JE({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,s,o,l]}const hk={[Fe.Left]:{x:-1,y:0},[Fe.Right]:{x:1,y:0},[Fe.Top]:{x:0,y:-1},[Fe.Bottom]:{x:0,y:1}},xF=({source:e,sourcePosition:t=Fe.Bottom,target:n})=>t===Fe.Left||t===Fe.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},mk=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function wF({source:e,sourcePosition:t=Fe.Bottom,target:n,targetPosition:r=Fe.Top,center:i,offset:s,stepPosition:o}){const l=hk[t],c=hk[r],d={x:e.x+l.x*s,y:e.y+l.y*s},u={x:n.x+c.x*s,y:n.y+c.y*s},f=xF({source:d,sourcePosition:t,target:u}),p=f.x!==0?"x":"y",h=f[p];let g=[],b,S;const x={x:0,y:0},w={x:0,y:0},[,,v,k]=JE({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[p]*c[p]===-1){p==="x"?(b=i.x??d.x+(u.x-d.x)*o,S=i.y??(d.y+u.y)/2):(b=i.x??(d.x+u.x)/2,S=i.y??d.y+(u.y-d.y)*o);const $=[{x:b,y:d.y},{x:b,y:u.y}],I=[{x:d.x,y:S},{x:u.x,y:S}];l[p]===h?g=p==="x"?$:I:g=p==="x"?I:$}else{const $=[{x:d.x,y:u.y}],I=[{x:u.x,y:d.y}];if(p==="x"?g=l.x===h?I:$:g=l.y===h?$:I,t===r){const D=Math.abs(e[p]-n[p]);if(D<=s){const W=Math.min(s-1,s-D);l[p]===h?x[p]=(d[p]>e[p]?-1:1)*W:w[p]=(u[p]>n[p]?-1:1)*W}}if(t!==r){const D=p==="x"?"y":"x",W=l[p]===c[D],O=d[D]>u[D],U=d[D]<u[D];(l[p]===1&&(!W&&O||W&&U)||l[p]!==1&&(!W&&U||W&&O))&&(g=p==="x"?$:I)}const F={x:d.x+x.x,y:d.y+x.y},L={x:u.x+w.x,y:u.y+w.y},T=Math.max(Math.abs(F.x-g[0].x),Math.abs(L.x-g[0].x)),q=Math.max(Math.abs(F.y-g[0].y),Math.abs(L.y-g[0].y));T>=q?(b=(F.x+L.x)/2,S=g[0].y):(b=g[0].x,S=(F.y+L.y)/2)}const E={x:d.x+x.x,y:d.y+x.y},j={x:u.x+w.x,y:u.y+w.y};return[[e,...E.x!==g[0].x||E.y!==g[0].y?[E]:[],...g,...j.x!==g[g.length-1].x||j.y!==g[g.length-1].y?[j]:[],n],b,S,v,k]}function vF(e,t,n,r){const i=Math.min(mk(e,t)/2,mk(t,n)/2,r),{x:s,y:o}=t;if(e.x===s&&s===n.x||e.y===o&&o===n.y)return`L${s} ${o}`;if(e.y===o){const d=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${s+i*d},${o}Q ${s},${o} ${s},${o+i*u}`}const l=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${s},${o+i*c}Q ${s},${o} ${s+i*l},${o}`}function gx({sourceX:e,sourceY:t,sourcePosition:n=Fe.Bottom,targetX:r,targetY:i,targetPosition:s=Fe.Top,borderRadius:o=5,centerX:l,centerY:c,offset:d=20,stepPosition:u=.5}){const[f,p,h,g,b]=wF({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:s,center:{x:l,y:c},offset:d,stepPosition:u});let S=`M${f[0].x} ${f[0].y}`;for(let x=1;x<f.length-1;x++)S+=vF(f[x-1],f[x],f[x+1],o);return S+=`L${f[f.length-1].x} ${f[f.length-1].y}`,[S,p,h,g,b]}function gk(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function bF(e){var f;const{sourceNode:t,targetNode:n}=e;if(!gk(t)||!gk(n))return null;const r=t.internals.handleBounds||yk(t.handles),i=n.internals.handleBounds||yk(n.handles),s=xk((r==null?void 0:r.source)??[],e.sourceHandle),o=xk(e.connectionMode===rc.Strict?(i==null?void 0:i.target)??[]:((i==null?void 0:i.target)??[]).concat((i==null?void 0:i.source)??[]),e.targetHandle);if(!s||!o)return(f=e.onError)==null||f.call(e,"008",Cs.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=(s==null?void 0:s.position)||Fe.Bottom,c=(o==null?void 0:o.position)||Fe.Top,d=za(t,s,l),u=za(n,o,c);return{sourceX:d.x,sourceY:d.y,targetX:u.x,targetY:u.y,sourcePosition:l,targetPosition:c}}function yk(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 za(e,t,n=Fe.Left,r=!1){const i=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,s=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:o,height:l}=t??ro(e);if(r)return{x:i+o/2,y:s+l/2};switch((t==null?void 0:t.position)??n){case Fe.Top:return{x:i+o/2,y:s};case Fe.Right:return{x:i+o,y:s+l/2};case Fe.Bottom:return{x:i+o/2,y:s+l};case Fe.Left:return{x:i,y:s+l/2}}}function xk(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function yx(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function kF(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){const s=new Set;return e.reduce((o,l)=>([l.markerStart||r,l.markerEnd||i].forEach(c=>{if(c&&typeof c=="object"){const d=yx(c,t);s.has(d)||(o.push({id:d,color:c.color||n,...c}),s.add(d))}}),o),[]).sort((o,l)=>o.id.localeCompare(l.id))}const ZE=1e3,SF=10,nv={nodeOrigin:[0,0],nodeExtent:nd,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},NF={...nv,checkEquality:!0};function rv(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function jF(e,t,n){const r=rv(nv,n);for(const i of e.values())if(i.parentId)sv(i,e,t,r);else{const s=_d(i,r.nodeOrigin),o=oc(i.extent)?i.extent:r.nodeExtent,l=Fa(s,o,ro(i));i.internals.positionAbsolute=l}}function CF(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const i of e.handles){const s={id:i.id,width:i.width??1,height:i.height??1,nodeId:e.id,x:i.x,y:i.y,position:i.position,type:i.type};i.type==="source"?n.push(s):i.type==="target"&&r.push(s)}return{source:n,target:r}}function iv(e){return e==="manual"}function xx(e,t,n,r={}){var u,f;const i=rv(NF,r),s={i:0},o=new Map(t),l=i!=null&&i.elevateNodesOnSelect&&!iv(i.zIndexMode)?ZE:0;let c=e.length>0,d=!1;t.clear(),n.clear();for(const p of e){let h=o.get(p.id);if(i.checkEquality&&p===(h==null?void 0:h.internals.userNode))t.set(p.id,h);else{const g=_d(p,i.nodeOrigin),b=oc(p.extent)?p.extent:i.nodeExtent,S=Fa(g,b,ro(p));h={...i.defaults,...p,measured:{width:(u=p.measured)==null?void 0:u.width,height:(f=p.measured)==null?void 0:f.height},internals:{positionAbsolute:S,handleBounds:CF(p,h),z:e_(p,l,i.zIndexMode),userNode:p}},t.set(p.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),p.parentId&&sv(h,t,n,r,s),d||(d=p.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:d}}function EF(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 sv(e,t,n,r,i){const{elevateNodesOnSelect:s,nodeOrigin:o,nodeExtent:l,zIndexMode:c}=rv(nv,r),d=e.parentId,u=t.get(d);if(!u){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}EF(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c==="auto"&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*SF),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);const f=s&&!iv(c)?ZE:0,{x:p,y:h,z:g}=_F(e,u,o,l,f,c),{positionAbsolute:b}=e.internals,S=p!==b.x||h!==b.y;(S||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:S?{x:p,y:h}:b,z:g}})}function e_(e,t,n){const r=Wi(e.zIndex)?e.zIndex:0;return iv(n)?r:r+(e.selected?t:0)}function _F(e,t,n,r,i,s){const{x:o,y:l}=t.internals.positionAbsolute,c=ro(e),d=_d(e,n),u=oc(e.extent)?Fa(d,e.extent,c):d;let f=Fa({x:o+u.x,y:l+u.y},r,c);e.extent==="parent"&&(f=BE(f,c,t));const p=e_(e,i,s),h=t.internals.z??0;return{x:f.x,y:f.y,z:h>=p?h+1:p}}function ov(e,t,n,r=[0,0]){var o;const i=[],s=new Map;for(const l of e){const c=t.get(l.parentId);if(!c)continue;const d=((o=s.get(l.parentId))==null?void 0:o.expandedRect)??sc(c),u=UE(d,l.rect);s.set(l.parentId,{expandedRect:u,parent:c})}return s.size>0&&s.forEach(({expandedRect:l,parent:c},d)=>{var v;const u=c.internals.positionAbsolute,f=ro(c),p=c.origin??r,h=l.x<u.x?Math.round(Math.abs(u.x-l.x)):0,g=l.y<u.y?Math.round(Math.abs(u.y-l.y)):0,b=Math.max(f.width,Math.round(l.width)),S=Math.max(f.height,Math.round(l.height)),x=(b-f.width)*p[0],w=(S-f.height)*p[1];(h>0||g>0||x||w)&&(i.push({id:d,type:"position",position:{x:c.position.x-h+x,y:c.position.y-g+w}}),(v=n.get(d))==null||v.forEach(k=>{e.some(E=>E.id===k.id)||i.push({id:k.id,type:"position",position:{x:k.position.x+h,y:k.position.y+g}})})),(f.width<l.width||f.height<l.height||h||g)&&i.push({id:d,type:"dimensions",setAttributes:!0,dimensions:{width:b+(h?p[0]*h-x:0),height:S+(g?p[1]*g-w:0)}})}),i}function PF(e,t,n,r,i,s,o){const l=r==null?void 0:r.querySelector(".xyflow__viewport");let c=!1;if(!l)return{changes:[],updatedInternals:c};const d=[],u=window.getComputedStyle(l),{m22:f}=new window.DOMMatrixReadOnly(u.transform),p=[];for(const h of e.values()){const g=t.get(h.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const b=tv(h.nodeElement),S=g.measured.width!==b.width||g.measured.height!==b.height;if(!!(b.width&&b.height&&(S||!g.internals.handleBounds||h.force))){const w=h.nodeElement.getBoundingClientRect(),v=oc(g.extent)?g.extent:s;let{positionAbsolute:k}=g.internals;g.parentId&&g.extent==="parent"?k=BE(k,b,t.get(g.parentId)):v&&(k=Fa(k,v,b));const E={...g,measured:b,internals:{...g.internals,positionAbsolute:k,handleBounds:{source:fk("source",h.nodeElement,w,f,g.id),target:fk("target",h.nodeElement,w,f,g.id)}}};t.set(g.id,E),g.parentId&&sv(E,t,n,{nodeOrigin:i,zIndexMode:o}),c=!0,S&&(d.push({id:g.id,type:"dimensions",dimensions:b}),g.expandParent&&g.parentId&&p.push({id:g.id,parentId:g.parentId,rect:sc(E,i)}))}}if(p.length>0){const h=ov(p,t,n,i);d.push(...h)}return{changes:d,updatedInternals:c}}async function AF({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:s}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,s]],r),l=!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2]);return Promise.resolve(l)}function wk(e,t,n,r,i,s){let o=i;const l=r.get(o)||new Map;r.set(o,l.set(n,t)),o=`${i}-${e}`;const c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),s){o=`${i}-${e}-${s}`;const d=r.get(o)||new Map;r.set(o,d.set(n,t))}}function t_(e,t,n){e.clear(),t.clear();for(const r of n){const{source:i,target:s,sourceHandle:o=null,targetHandle:l=null}=r,c={edgeId:r.id,source:i,target:s,sourceHandle:o,targetHandle:l},d=`${i}-${o}--${s}-${l}`,u=`${s}-${l}--${i}-${o}`;wk("source",c,u,e,i,o),wk("target",c,d,e,s,l),t.set(r.id,r)}}function n_(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:n_(n,t):!1}function vk(e,t,n){var i;let r=e;do{if((i=r==null?void 0:r.matches)!=null&&i.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function IF(e,t,n,r){const i=new Map;for(const[s,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!n_(o,e))&&(o.draggable||t&&typeof o.draggable>"u")){const l=e.get(s);l&&i.set(s,{id:s,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 i}function Ng({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var o,l,c;const i=[];for(const[d,u]of t){const f=(o=n.get(d))==null?void 0:o.internals.userNode;f&&i.push({...f,position:u.position,dragging:r})}if(!e)return[i[0],i];const s=(l=n.get(e))==null?void 0:l.internals.userNode;return[s?{...s,position:((c=t.get(e))==null?void 0:c.position)||s.position,dragging:r}:i[0],i]}function TF({dragItems:e,snapGrid:t,x:n,y:r}){const i=e.values().next().value;if(!i)return null;const s={x:n-i.distance.x,y:r-i.distance.y},o=Ad(s,t);return{x:o.x-s.x,y:o.y-s.y}}function RF({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let s={x:null,y:null},o=0,l=new Map,c=!1,d={x:0,y:0},u=null,f=!1,p=null,h=!1,g=!1,b=null;function S({noDragClassName:w,handleSelector:v,domNode:k,isSelectable:E,nodeId:j,nodeClickDistance:A=0}){p=ri(k);function $({x:T,y:q}){const{nodeLookup:D,nodeExtent:W,snapGrid:O,snapToGrid:U,nodeOrigin:P,onNodeDrag:R,onSelectionDrag:C,onError:G,updateNodePositions:J}=t();s={x:T,y:q};let B=!1;const te=l.size>1,de=te&&W?mx(Pd(l)):null,ce=te&&U?TF({dragItems:l,snapGrid:O,x:T,y:q}):null;for(const[ue,re]of l){if(!D.has(ue))continue;let ge={x:T-re.distance.x,y:q-re.distance.y};U&&(ge=ce?{x:Math.round(ge.x+ce.x),y:Math.round(ge.y+ce.y)}:Ad(ge,O));let se=null;if(te&&W&&!re.extent&&de){const{positionAbsolute:me}=re.internals,ze=me.x-de.x+W[0][0],st=me.x+re.measured.width-de.x2+W[1][0],Ke=me.y-de.y+W[0][1],Ee=me.y+re.measured.height-de.y2+W[1][1];se=[[ze,Ke],[st,Ee]]}const{position:pe,positionAbsolute:ae}=zE({nodeId:ue,nextPosition:ge,nodeLookup:D,nodeExtent:se||W,nodeOrigin:P,onError:G});B=B||re.position.x!==pe.x||re.position.y!==pe.y,re.position=pe,re.internals.positionAbsolute=ae}if(g=g||B,!!B&&(J(l,!0),b&&(r||R||!j&&C))){const[ue,re]=Ng({nodeId:j,dragItems:l,nodeLookup:D});r==null||r(b,l,ue,re),R==null||R(b,ue,re),j||C==null||C(b,re)}}async function I(){if(!u)return;const{transform:T,panBy:q,autoPanSpeed:D,autoPanOnNodeDrag:W}=t();if(!W){c=!1,cancelAnimationFrame(o);return}const[O,U]=HE(d,u,D);(O!==0||U!==0)&&(s.x=(s.x??0)-O/T[2],s.y=(s.y??0)-U/T[2],await q({x:O,y:U})&&$(s)),o=requestAnimationFrame(I)}function F(T){var te;const{nodeLookup:q,multiSelectionActive:D,nodesDraggable:W,transform:O,snapGrid:U,snapToGrid:P,selectNodesOnDrag:R,onNodeDragStart:C,onSelectionDragStart:G,unselectNodesAndEdges:J}=t();f=!0,(!R||!E)&&!D&&j&&((te=q.get(j))!=null&&te.selected||J()),E&&R&&j&&(e==null||e(j));const B=_u(T.sourceEvent,{transform:O,snapGrid:U,snapToGrid:P,containerBounds:u});if(s=B,l=IF(q,W,B,j),l.size>0&&(n||C||!j&&G)){const[de,ce]=Ng({nodeId:j,dragItems:l,nodeLookup:q});n==null||n(T.sourceEvent,l,de,ce),C==null||C(T.sourceEvent,de,ce),j||G==null||G(T.sourceEvent,ce)}}const L=wE().clickDistance(A).on("start",T=>{const{domNode:q,nodeDragThreshold:D,transform:W,snapGrid:O,snapToGrid:U}=t();u=(q==null?void 0:q.getBoundingClientRect())||null,h=!1,g=!1,b=T.sourceEvent,D===0&&F(T),s=_u(T.sourceEvent,{transform:W,snapGrid:O,snapToGrid:U,containerBounds:u}),d=Vi(T.sourceEvent,u)}).on("drag",T=>{const{autoPanOnNodeDrag:q,transform:D,snapGrid:W,snapToGrid:O,nodeDragThreshold:U,nodeLookup:P}=t(),R=_u(T.sourceEvent,{transform:D,snapGrid:W,snapToGrid:O,containerBounds:u});if(b=T.sourceEvent,(T.sourceEvent.type==="touchmove"&&T.sourceEvent.touches.length>1||j&&!P.has(j))&&(h=!0),!h){if(!c&&q&&f&&(c=!0,I()),!f){const C=Vi(T.sourceEvent,u),G=C.x-d.x,J=C.y-d.y;Math.sqrt(G*G+J*J)>U&&F(T)}(s.x!==R.xSnapped||s.y!==R.ySnapped)&&l&&f&&(d=Vi(T.sourceEvent,u),$(R))}}).on("end",T=>{if(!(!f||h)&&(c=!1,f=!1,cancelAnimationFrame(o),l.size>0)){const{nodeLookup:q,updateNodePositions:D,onNodeDragStop:W,onSelectionDragStop:O}=t();if(g&&(D(l,!1),g=!1),i||W||!j&&O){const[U,P]=Ng({nodeId:j,dragItems:l,nodeLookup:q,dragging:!1});i==null||i(T.sourceEvent,l,U,P),W==null||W(T.sourceEvent,U,P),j||O==null||O(T.sourceEvent,P)}}}).filter(T=>{const q=T.target;return!T.button&&(!w||!vk(q,`.${w}`,k))&&(!v||vk(q,v,k))});p.call(L)}function x(){p==null||p.on(".drag",null)}return{update:S,destroy:x}}function LF(e,t,n){const r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const s of t.values())id(i,sc(s))>0&&r.push(s);return r}const OF=250;function MF(e,t,n,r){var l,c;let i=[],s=1/0;const o=LF(e,n,t+OF);for(const d of o){const u=[...((l=d.internals.handleBounds)==null?void 0:l.source)??[],...((c=d.internals.handleBounds)==null?void 0:c.target)??[]];for(const f of u){if(r.nodeId===f.nodeId&&r.type===f.type&&r.id===f.id)continue;const{x:p,y:h}=za(d,f,f.position,!0),g=Math.sqrt(Math.pow(p-e.x,2)+Math.pow(h-e.y,2));g>t||(g<s?(i=[{...f,x:p,y:h}],s=g):g===s&&i.push({...f,x:p,y:h}))}}if(!i.length)return null;if(i.length>1){const d=r.type==="source"?"target":"source";return i.find(u=>u.type===d)??i[0]}return i[0]}function r_(e,t,n,r,i,s=!1){var d,u,f;const o=r.get(e);if(!o)return null;const l=i==="strict"?(d=o.internals.handleBounds)==null?void 0:d[t]:[...((u=o.internals.handleBounds)==null?void 0:u.source)??[],...((f=o.internals.handleBounds)==null?void 0:f.target)??[]],c=(n?l==null?void 0:l.find(p=>p.id===n):l==null?void 0:l[0])??null;return c&&s?{...c,...za(o,c,c.position,!0)}:c}function i_(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function $F(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const s_=()=>!0;function DF(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:s,isTarget:o,domNode:l,nodeLookup:c,lib:d,autoPanOnConnect:u,flowId:f,panBy:p,cancelConnection:h,onConnectStart:g,onConnect:b,onConnectEnd:S,isValidConnection:x=s_,onReconnectEnd:w,updateConnection:v,getTransform:k,getFromHandle:E,autoPanSpeed:j,dragThreshold:A=1,handleDomNode:$}){const I=KE(e.target);let F=0,L;const{x:T,y:q}=Vi(e),D=i_(s,$),W=l==null?void 0:l.getBoundingClientRect();let O=!1;if(!W||!D)return;const U=r_(i,D,r,c,t);if(!U)return;let P=Vi(e,W),R=!1,C=null,G=!1,J=null;function B(){if(!u||!W)return;const[pe,ae]=HE(P,W,j);p({x:pe,y:ae}),F=requestAnimationFrame(B)}const te={...U,nodeId:i,type:D,position:U.position},de=c.get(i);let ue={inProgress:!0,isValid:null,from:za(de,te,Fe.Left,!0),fromHandle:te,fromPosition:te.position,fromNode:de,to:P,toHandle:null,toPosition:lk[te.position],toNode:null,pointer:P};function re(){O=!0,v(ue),g==null||g(e,{nodeId:i,handleId:r,handleType:D})}A===0&&re();function ge(pe){if(!O){const{x:Ee,y:It}=Vi(pe),sn=Ee-T,Wt=It-q;if(!(sn*sn+Wt*Wt>A*A))return;re()}if(!E()||!te){se(pe);return}const ae=k();P=Vi(pe,W),L=MF(Id(P,ae,!1,[1,1]),n,c,te),R||(B(),R=!0);const me=o_(pe,{handle:L,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?"target":"source",isValidConnection:x,doc:I,lib:d,flowId:f,nodeLookup:c});J=me.handleDomNode,C=me.connection,G=$F(!!L,me.isValid);const ze=c.get(i),st=ze?za(ze,te,Fe.Left,!0):ue.from,Ke={...ue,from:st,isValid:G,to:me.toHandle&&G?uh({x:me.toHandle.x,y:me.toHandle.y},ae):P,toHandle:me.toHandle,toPosition:G&&me.toHandle?me.toHandle.position:lk[te.position],toNode:me.toHandle?c.get(me.toHandle.nodeId):null,pointer:P};v(Ke),ue=Ke}function se(pe){if(!("touches"in pe&&pe.touches.length>0)){if(O){(L||J)&&C&&G&&(b==null||b(C));const{inProgress:ae,...me}=ue,ze={...me,toPosition:ue.toHandle?ue.toPosition:null};S==null||S(pe,ze),s&&(w==null||w(pe,ze))}h(),cancelAnimationFrame(F),R=!1,G=!1,C=null,J=null,I.removeEventListener("mousemove",ge),I.removeEventListener("mouseup",se),I.removeEventListener("touchmove",ge),I.removeEventListener("touchend",se)}}I.addEventListener("mousemove",ge),I.addEventListener("mouseup",se),I.addEventListener("touchmove",ge),I.addEventListener("touchend",se)}function o_(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:s,doc:o,lib:l,flowId:c,isValidConnection:d=s_,nodeLookup:u}){const f=s==="target",p=t?o.querySelector(`.${l}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:h,y:g}=Vi(e),b=o.elementFromPoint(h,g),S=b!=null&&b.classList.contains(`${l}-flow__handle`)?b:p,x={handleDomNode:S,isValid:!1,connection:null,toHandle:null};if(S){const w=i_(void 0,S),v=S.getAttribute("data-nodeid"),k=S.getAttribute("data-handleid"),E=S.classList.contains("connectable"),j=S.classList.contains("connectableend");if(!v||!w)return x;const A={source:f?v:r,sourceHandle:f?k:i,target:f?r:v,targetHandle:f?i:k};x.connection=A;const I=E&&j&&(n===rc.Strict?f&&w==="source"||!f&&w==="target":v!==r||k!==i);x.isValid=I&&d(A),x.toHandle=r_(v,w,k,u,n,!0)}return x}const wx={onPointerDown:DF,isValid:o_};function FF({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const i=ri(e);function s({translateExtent:l,width:c,height:d,zoomStep:u=1,pannable:f=!0,zoomable:p=!0,inversePan:h=!1}){const g=v=>{if(v.sourceEvent.type!=="wheel"||!t)return;const k=n(),E=v.sourceEvent.ctrlKey&&sd()?10:1,j=-v.sourceEvent.deltaY*(v.sourceEvent.deltaMode===1?.05:v.sourceEvent.deltaMode?1:.002)*u,A=k[2]*Math.pow(2,j*E);t.scaleTo(A)};let b=[0,0];const S=v=>{(v.sourceEvent.type==="mousedown"||v.sourceEvent.type==="touchstart")&&(b=[v.sourceEvent.clientX??v.sourceEvent.touches[0].clientX,v.sourceEvent.clientY??v.sourceEvent.touches[0].clientY])},x=v=>{const k=n();if(v.sourceEvent.type!=="mousemove"&&v.sourceEvent.type!=="touchmove"||!t)return;const E=[v.sourceEvent.clientX??v.sourceEvent.touches[0].clientX,v.sourceEvent.clientY??v.sourceEvent.touches[0].clientY],j=[E[0]-b[0],E[1]-b[1]];b=E;const A=r()*Math.max(k[2],Math.log(k[2]))*(h?-1:1),$={x:k[0]-j[0]*A,y:k[1]-j[1]*A},I=[[0,0],[c,d]];t.setViewportConstrained({x:$.x,y:$.y,zoom:k[2]},I,l)},w=LE().on("start",S).on("zoom",f?x:null).on("zoom.wheel",p?g:null);i.call(w,{})}function o(){i.on("zoom",null)}return{update:s,destroy:o,pointer:zi}}const rm=e=>({x:e.x,y:e.y,zoom:e.k}),jg=({x:e,y:t,zoom:n})=>em.translate(e,t).scale(n),Il=(e,t)=>e.target.closest(`.${t}`),a_=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),zF=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Cg=(e,t=0,n=zF,r=()=>{})=>{const i=typeof t=="number"&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on("end",r):e},l_=e=>{const t=e.ctrlKey&&sd()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function BF({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:s,zoomOnPinch:o,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:d}){return u=>{if(Il(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(u.ctrlKey&&o){const S=zi(u),x=l_(u),w=f*Math.pow(2,x);r.scaleTo(n,w,S,u);return}const p=u.deltaMode===1?20:1;let h=i===Pa.Vertical?0:u.deltaX*p,g=i===Pa.Horizontal?0:u.deltaY*p;!sd()&&u.shiftKey&&i!==Pa.Vertical&&(h=u.deltaY*p,g=0),r.translateBy(n,-(h/f)*s,-(g/f)*s,{internal:!0});const b=rm(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(u,b),e.panScrollTimeout=setTimeout(()=>{d==null||d(u,b),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(u,b))}}function HF({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){const s=r.type==="wheel",o=!t&&s&&!r.ctrlKey,l=Il(r,e);if(r.ctrlKey&&s&&l&&r.preventDefault(),o||l)return null;r.preventDefault(),n.call(this,r,i)}}function UF({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var s,o,l;if((s=r.sourceEvent)!=null&&s.internal)return;const i=rm(r.transform);e.mouseButton=((o=r.sourceEvent)==null?void 0:o.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=i,((l=r.sourceEvent)==null?void 0:l.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,i))}}function WF({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return s=>{var o,l;e.usedRightMouseButton=!!(n&&a_(t,e.mouseButton??0)),(o=s.sourceEvent)!=null&&o.sync||r([s.transform.x,s.transform.y,s.transform.k]),i&&!((l=s.sourceEvent)!=null&&l.internal)&&(i==null||i(s.sourceEvent,rm(s.transform)))}}function VF({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:s}){return o=>{var l;if(!((l=o.sourceEvent)!=null&&l.internal)&&(e.isZoomingOrPanning=!1,s&&a_(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&s(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){const c=rm(o.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i==null||i(o.sourceEvent,c)},n?150:0)}}}function KF({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:o,noWheelClassName:l,noPanClassName:c,lib:d,connectionInProgress:u}){return f=>{var S;const p=e||t,h=n&&f.ctrlKey,g=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(Il(f,`${d}-flow__node`)||Il(f,`${d}-flow__edge`)))return!0;if(!r&&!p&&!i&&!s&&!n||o||u&&!g||Il(f,l)&&g||Il(f,c)&&(!g||i&&g&&!e)||!n&&f.ctrlKey&&g)return!1;if(!n&&f.type==="touchstart"&&((S=f.touches)==null?void 0:S.length)>1)return f.preventDefault(),!1;if(!p&&!i&&!h&&g||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const b=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||g)&&b}}function qF({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:s,onPanZoomStart:o,onPanZoomEnd:l,onDraggingChange:c}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),f=LE().scaleExtent([t,n]).translateExtent(r),p=ri(e).call(f);w({x:i.x,y:i.y,zoom:ic(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);const h=p.on("wheel.zoom"),g=p.on("dblclick.zoom");f.wheelDelta(l_);function b(L,T){return p?new Promise(q=>{f==null||f.interpolate((T==null?void 0:T.interpolate)==="linear"?Eu:bp).transform(Cg(p,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>q(!0)),L)}):Promise.resolve(!1)}function S({noWheelClassName:L,noPanClassName:T,onPaneContextMenu:q,userSelectionActive:D,panOnScroll:W,panOnDrag:O,panOnScrollMode:U,panOnScrollSpeed:P,preventScrolling:R,zoomOnPinch:C,zoomOnScroll:G,zoomOnDoubleClick:J,zoomActivationKeyPressed:B,lib:te,onTransformChange:de,connectionInProgress:ce,paneClickDistance:ue,selectionOnDrag:re}){D&&!d.isZoomingOrPanning&&x();const ge=W&&!B&&!D;f.clickDistance(re?1/0:!Wi(ue)||ue<0?0:ue);const se=ge?BF({zoomPanValues:d,noWheelClassName:L,d3Selection:p,d3Zoom:f,panOnScrollMode:U,panOnScrollSpeed:P,zoomOnPinch:C,onPanZoomStart:o,onPanZoom:s,onPanZoomEnd:l}):HF({noWheelClassName:L,preventScrolling:R,d3ZoomHandler:h});if(p.on("wheel.zoom",se,{passive:!1}),!D){const ae=UF({zoomPanValues:d,onDraggingChange:c,onPanZoomStart:o});f.on("start",ae);const me=WF({zoomPanValues:d,panOnDrag:O,onPaneContextMenu:!!q,onPanZoom:s,onTransformChange:de});f.on("zoom",me);const ze=VF({zoomPanValues:d,panOnDrag:O,panOnScroll:W,onPaneContextMenu:q,onPanZoomEnd:l,onDraggingChange:c});f.on("end",ze)}const pe=KF({zoomActivationKeyPressed:B,panOnDrag:O,zoomOnScroll:G,panOnScroll:W,zoomOnDoubleClick:J,zoomOnPinch:C,userSelectionActive:D,noPanClassName:T,noWheelClassName:L,lib:te,connectionInProgress:ce});f.filter(pe),J?p.on("dblclick.zoom",g):p.on("dblclick.zoom",null)}function x(){f.on("zoom",null)}async function w(L,T,q){const D=jg(L),W=f==null?void 0:f.constrain()(D,T,q);return W&&await b(W),new Promise(O=>O(W))}async function v(L,T){const q=jg(L);return await b(q,T),new Promise(D=>D(q))}function k(L){if(p){const T=jg(L),q=p.property("__zoom");(q.k!==L.zoom||q.x!==L.x||q.y!==L.y)&&(f==null||f.transform(p,T,null,{sync:!0}))}}function E(){const L=p?RE(p.node()):{x:0,y:0,k:1};return{x:L.x,y:L.y,zoom:L.k}}function j(L,T){return p?new Promise(q=>{f==null||f.interpolate((T==null?void 0:T.interpolate)==="linear"?Eu:bp).scaleTo(Cg(p,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>q(!0)),L)}):Promise.resolve(!1)}function A(L,T){return p?new Promise(q=>{f==null||f.interpolate((T==null?void 0:T.interpolate)==="linear"?Eu:bp).scaleBy(Cg(p,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>q(!0)),L)}):Promise.resolve(!1)}function $(L){f==null||f.scaleExtent(L)}function I(L){f==null||f.translateExtent(L)}function F(L){const T=!Wi(L)||L<0?0:L;f==null||f.clickDistance(T)}return{update:S,destroy:x,setViewport:v,setViewportConstrained:w,getViewport:E,scaleTo:j,scaleBy:A,setScaleExtent:$,setTranslateExtent:I,syncViewport:k,setClickDistance:F}}var ac;(function(e){e.Line="line",e.Handle="handle"})(ac||(ac={}));function YF({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:s}){const o=e-t,l=n-r,c=[o>0?1:o<0?-1:0,l>0?1:l<0?-1:0];return o&&i&&(c[0]=c[0]*-1),l&&s&&(c[1]=c[1]*-1),c}function bk(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),i=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:i}}function xo(e,t){return Math.max(0,t-e)}function wo(e,t){return Math.max(0,e-t)}function Wf(e,t,n){return Math.max(0,t-e,e-n)}function kk(e,t){return e?!t:t}function GF(e,t,n,r,i,s,o,l){let{affectsX:c,affectsY:d}=t;const{isHorizontal:u,isVertical:f}=t,p=u&&f,{xSnapped:h,ySnapped:g}=n,{minWidth:b,maxWidth:S,minHeight:x,maxHeight:w}=r,{x:v,y:k,width:E,height:j,aspectRatio:A}=e;let $=Math.floor(u?h-e.pointerX:0),I=Math.floor(f?g-e.pointerY:0);const F=E+(c?-$:$),L=j+(d?-I:I),T=-s[0]*E,q=-s[1]*j;let D=Wf(F,b,S),W=Wf(L,x,w);if(o){let P=0,R=0;c&&$<0?P=xo(v+$+T,o[0][0]):!c&&$>0&&(P=wo(v+F+T,o[1][0])),d&&I<0?R=xo(k+I+q,o[0][1]):!d&&I>0&&(R=wo(k+L+q,o[1][1])),D=Math.max(D,P),W=Math.max(W,R)}if(l){let P=0,R=0;c&&$>0?P=wo(v+$,l[0][0]):!c&&$<0&&(P=xo(v+F,l[1][0])),d&&I>0?R=wo(k+I,l[0][1]):!d&&I<0&&(R=xo(k+L,l[1][1])),D=Math.max(D,P),W=Math.max(W,R)}if(i){if(u){const P=Wf(F/A,x,w)*A;if(D=Math.max(D,P),o){let R=0;!c&&!d||c&&!d&&p?R=wo(k+q+F/A,o[1][1])*A:R=xo(k+q+(c?$:-$)/A,o[0][1])*A,D=Math.max(D,R)}if(l){let R=0;!c&&!d||c&&!d&&p?R=xo(k+F/A,l[1][1])*A:R=wo(k+(c?$:-$)/A,l[0][1])*A,D=Math.max(D,R)}}if(f){const P=Wf(L*A,b,S)/A;if(W=Math.max(W,P),o){let R=0;!c&&!d||d&&!c&&p?R=wo(v+L*A+T,o[1][0])/A:R=xo(v+(d?I:-I)*A+T,o[0][0])/A,W=Math.max(W,R)}if(l){let R=0;!c&&!d||d&&!c&&p?R=xo(v+L*A,l[1][0])/A:R=wo(v+(d?I:-I)*A,l[0][0])/A,W=Math.max(W,R)}}}I=I+(I<0?W:-W),$=$+($<0?D:-D),i&&(p?F>L*A?I=(kk(c,d)?-$:$)/A:$=(kk(c,d)?-I:I)*A:u?(I=$/A,d=c):($=I*A,c=d));const O=c?v+$:v,U=d?k+I:k;return{width:E+(c?-$:$),height:j+(d?-I:I),x:s[0]*$*(c?-1:1)+O,y:s[1]*I*(d?-1:1)+U}}const c_={width:0,height:0,x:0,y:0},XF={...c_,pointerX:0,pointerY:0,aspectRatio:1};function JF(e){return[[0,0],[e.measured.width,e.measured.height]]}function QF(e,t,n){const r=t.position.x+e.position.x,i=t.position.y+e.position.y,s=e.measured.width??0,o=e.measured.height??0,l=n[0]*s,c=n[1]*o;return[[r-l,i-c],[r+s-l,i+o-c]]}function ZF({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){const s=ri(e);let o={controlDirection:bk("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:u,keepAspectRatio:f,resizeDirection:p,onResizeStart:h,onResize:g,onResizeEnd:b,shouldResize:S}){let x={...c_},w={...XF};o={boundaries:u,resizeDirection:p,keepAspectRatio:f,controlDirection:bk(d)};let v,k=null,E=[],j,A,$,I=!1;const F=wE().on("start",L=>{const{nodeLookup:T,transform:q,snapGrid:D,snapToGrid:W,nodeOrigin:O,paneDomNode:U}=n();if(v=T.get(t),!v)return;k=(U==null?void 0:U.getBoundingClientRect())??null;const{xSnapped:P,ySnapped:R}=_u(L.sourceEvent,{transform:q,snapGrid:D,snapToGrid:W,containerBounds:k});x={width:v.measured.width??0,height:v.measured.height??0,x:v.position.x??0,y:v.position.y??0},w={...x,pointerX:P,pointerY:R,aspectRatio:x.width/x.height},j=void 0,v.parentId&&(v.extent==="parent"||v.expandParent)&&(j=T.get(v.parentId),A=j&&v.extent==="parent"?JF(j):void 0),E=[],$=void 0;for(const[C,G]of T)if(G.parentId===t&&(E.push({id:C,position:{...G.position},extent:G.extent}),G.extent==="parent"||G.expandParent)){const J=QF(G,v,G.origin??O);$?$=[[Math.min(J[0][0],$[0][0]),Math.min(J[0][1],$[0][1])],[Math.max(J[1][0],$[1][0]),Math.max(J[1][1],$[1][1])]]:$=J}h==null||h(L,{...x})}).on("drag",L=>{const{transform:T,snapGrid:q,snapToGrid:D,nodeOrigin:W}=n(),O=_u(L.sourceEvent,{transform:T,snapGrid:q,snapToGrid:D,containerBounds:k}),U=[];if(!v)return;const{x:P,y:R,width:C,height:G}=x,J={},B=v.origin??W,{width:te,height:de,x:ce,y:ue}=GF(w,o.controlDirection,O,o.boundaries,o.keepAspectRatio,B,A,$),re=te!==C,ge=de!==G,se=ce!==P&&re,pe=ue!==R&≥if(!se&&!pe&&!re&&!ge)return;if((se||pe||B[0]===1||B[1]===1)&&(J.x=se?ce:x.x,J.y=pe?ue:x.y,x.x=J.x,x.y=J.y,E.length>0)){const st=ce-P,Ke=ue-R;for(const Ee of E)Ee.position={x:Ee.position.x-st+B[0]*(te-C),y:Ee.position.y-Ke+B[1]*(de-G)},U.push(Ee)}if((re||ge)&&(J.width=re&&(!o.resizeDirection||o.resizeDirection==="horizontal")?te:x.width,J.height=ge&&(!o.resizeDirection||o.resizeDirection==="vertical")?de:x.height,x.width=J.width,x.height=J.height),j&&v.expandParent){const st=B[0]*(J.width??0);J.x&&J.x<st&&(x.x=st,w.x=w.x-(J.x-st));const Ke=B[1]*(J.height??0);J.y&&J.y<Ke&&(x.y=Ke,w.y=w.y-(J.y-Ke))}const ae=YF({width:x.width,prevWidth:C,height:x.height,prevHeight:G,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),me={...x,direction:ae};(S==null?void 0:S(L,me))!==!1&&(I=!0,g==null||g(L,me),r(J,U))}).on("end",L=>{I&&(b==null||b(L,{...x}),i==null||i({...x}),I=!1)});s.call(F)}function c(){s.on(".drag",null)}return{update:l,destroy:c}}var u_={exports:{}},d_={},f_={exports:{}},p_={};/**
|
|
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 lc=m;function e3(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var t3=typeof Object.is=="function"?Object.is:e3,n3=lc.useState,r3=lc.useEffect,i3=lc.useLayoutEffect,s3=lc.useDebugValue;function o3(e,t){var n=t(),r=n3({inst:{value:n,getSnapshot:t}}),i=r[0].inst,s=r[1];return i3(function(){i.value=n,i.getSnapshot=t,Eg(i)&&s({inst:i})},[e,n,t]),r3(function(){return Eg(i)&&s({inst:i}),e(function(){Eg(i)&&s({inst:i})})},[e]),s3(n),n}function Eg(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!t3(e,n)}catch{return!0}}function a3(e,t){return t()}var l3=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?a3:o3;p_.useSyncExternalStore=lc.useSyncExternalStore!==void 0?lc.useSyncExternalStore:l3;f_.exports=p_;var h_=f_.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 im=m,c3=h_;function u3(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var d3=typeof Object.is=="function"?Object.is:u3,f3=c3.useSyncExternalStore,p3=im.useRef,h3=im.useEffect,m3=im.useMemo,g3=im.useDebugValue;d_.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var s=p3(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=m3(function(){function c(h){if(!d){if(d=!0,u=h,h=r(h),i!==void 0&&o.hasValue){var g=o.value;if(i(g,h))return f=g}return f=h}if(g=f,d3(u,h))return g;var b=r(h);return i!==void 0&&i(g,b)?(u=h,g):(u=h,f=b)}var d=!1,u,f,p=n===void 0?null:n;return[function(){return c(t())},p===null?void 0:function(){return c(p())}]},[t,n,r,i]);var l=f3(e,s[0],s[1]);return h3(function(){o.hasValue=!0,o.value=l},[l]),g3(l),l};u_.exports=d_;var y3=u_.exports;const x3=Xo(y3),w3={},Sk=e=>{let t;const n=new Set,r=(u,f)=>{const p=typeof u=="function"?u(t):u;if(!Object.is(p,t)){const h=t;t=f??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(g=>g(t,h))}},i=()=>t,c={setState:r,getState:i,getInitialState:()=>d,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(w3?"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,i,c);return c},v3=e=>e?Sk(e):Sk,{useDebugValue:b3}=Ye,{useSyncExternalStoreWithSelector:k3}=x3,S3=e=>e;function m_(e,t=S3,n){const r=k3(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return b3(r),r}const Nk=(e,t)=>{const n=v3(e),r=(i,s=t)=>m_(n,i,s);return Object.assign(r,n),r},N3=(e,t)=>e?Nk(e,t):Nk;function rn(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,i]of e)if(!Object.is(i,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 sm=m.createContext(null),j3=sm.Provider,g_=Cs.error001();function kt(e,t){const n=m.useContext(sm);if(n===null)throw new Error(g_);return m_(n,e,t)}function Xt(){const e=m.useContext(sm);if(e===null)throw new Error(g_);return m.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const jk={display:"none"},C3={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},y_="react-flow__node-desc",x_="react-flow__edge-desc",E3="react-flow__aria-live",_3=e=>e.ariaLiveMessage,P3=e=>e.ariaLabelConfig;function A3({rfId:e}){const t=kt(_3);return a.jsx("div",{id:`${E3}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:C3,children:t})}function I3({rfId:e,disableKeyboardA11y:t}){const n=kt(P3);return a.jsxs(a.Fragment,{children:[a.jsx("div",{id:`${y_}-${e}`,style:jk,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),a.jsx("div",{id:`${x_}-${e}`,style:jk,children:n["edge.a11yDescription.default"]}),!t&&a.jsx(A3,{rfId:e})]})}const cc=m.forwardRef(({position:e="top-left",children:t,className:n,style:r,...i},s)=>{const o=`${e}`.split("-");return a.jsx("div",{className:Ln(["react-flow__panel",n,...o]),style:r,ref:s,...i,children:t})});cc.displayName="Panel";function T3({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:a.jsx(cc,{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:a.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const R3=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}},Vf=e=>e.id;function L3(e,t){return rn(e.selectedNodes.map(Vf),t.selectedNodes.map(Vf))&&rn(e.selectedEdges.map(Vf),t.selectedEdges.map(Vf))}function O3({onSelectionChange:e}){const t=Xt(),{selectedNodes:n,selectedEdges:r}=kt(R3,L3);return m.useEffect(()=>{const i={nodes:n,edges:r};e==null||e(i),t.getState().onSelectionChangeHandlers.forEach(s=>s(i))},[n,r,e]),null}const M3=e=>!!e.onSelectionChangeHandlers;function $3({onSelectionChange:e}){const t=kt(M3);return e||t?a.jsx(O3,{onSelectionChange:e}):null}const vx=typeof window<"u"?m.useLayoutEffect:m.useEffect,w_=[0,0],D3={x:0,y:0,zoom:1},F3=["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"],Ck=[...F3,"rfId"],z3=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}),Ek={translateExtent:nd,nodeOrigin:w_,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function B3(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:s,setNodeExtent:o,reset:l,setDefaultNodesAndEdges:c}=kt(z3,rn),d=Xt();vx(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=Ek,l()}),[]);const u=m.useRef(Ek);return vx(()=>{for(const f of Ck){const p=e[f],h=u.current[f];p!==h&&(typeof e[f]>"u"||(f==="nodes"?t(p):f==="edges"?n(p):f==="minZoom"?r(p):f==="maxZoom"?i(p):f==="translateExtent"?s(p):f==="nodeExtent"?o(p):f==="ariaLabelConfig"?d.setState({ariaLabelConfig:fF(p)}):f==="fitView"?d.setState({fitViewQueued:p}):f==="fitViewOptions"?d.setState({fitViewOptions:p}):d.setState({[f]:p})))}u.current=e},Ck.map(f=>e[f])),null}function _k(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function H3(e){var r;const[t,n]=m.useState(e==="system"?null:e);return m.useEffect(()=>{if(e!=="system"){n(e);return}const i=_k(),s=()=>n(i!=null&&i.matches?"dark":"light");return s(),i==null||i.addEventListener("change",s),()=>{i==null||i.removeEventListener("change",s)}},[e]),t!==null?t:(r=_k())!=null&&r.matches?"dark":"light"}const Pk=typeof document<"u"?document:null;function ad(e=null,t={target:Pk,actInsideInputWithModifier:!0}){const[n,r]=m.useState(!1),i=m.useRef(!1),s=m.useRef(new Set([])),[o,l]=m.useMemo(()=>{if(e!==null){const d=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
|
|
61
|
-
`).replace(`
|
|
62
|
-
|
|
63
|
-
`,`
|
|
64
|
-
+`).split(`
|
|
65
|
-
`)),u=d.reduce((f,p)=>f.concat(...p),[]);return[d,u]}return[[],[]]},[e]);return m.useEffect(()=>{const c=(t==null?void 0:t.target)??Pk,d=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const u=h=>{var S,x;if(i.current=h.ctrlKey||h.metaKey||h.shiftKey||h.altKey,(!i.current||i.current&&!d)&&qE(h))return!1;const b=Ik(h.code,l);if(s.current.add(h[b]),Ak(o,s.current,!1)){const w=((x=(S=h.composedPath)==null?void 0:S.call(h))==null?void 0:x[0])||h.target,v=(w==null?void 0:w.nodeName)==="BUTTON"||(w==null?void 0:w.nodeName)==="A";t.preventDefault!==!1&&(i.current||!v)&&h.preventDefault(),r(!0)}},f=h=>{const g=Ik(h.code,l);Ak(o,s.current,!0)?(r(!1),s.current.clear()):s.current.delete(h[g]),h.key==="Meta"&&s.current.clear(),i.current=!1},p=()=>{s.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",u),c==null||c.addEventListener("keyup",f),window.addEventListener("blur",p),window.addEventListener("contextmenu",p),()=>{c==null||c.removeEventListener("keydown",u),c==null||c.removeEventListener("keyup",f),window.removeEventListener("blur",p),window.removeEventListener("contextmenu",p)}}},[e,r]),n}function Ak(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(i=>t.has(i)))}function Ik(e,t){return t.includes(e)?"code":"key"}const U3=()=>{const e=Xt();return m.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,i,s],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??s},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:i,minZoom:s,maxZoom:o,panZoom:l}=e.getState(),c=ev(t,r,i,s,o,(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:i,snapToGrid:s,domNode:o}=e.getState();if(!o)return t;const{x:l,y:c}=o.getBoundingClientRect(),d={x:t.x-l,y:t.y-c},u=n.snapGrid??i,f=n.snapToGrid??s;return Id(d,r,f,u)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:i,y:s}=r.getBoundingClientRect(),o=uh(t,n);return{x:o.x+i,y:o.y+s}}}),[])};function v_(e,t){const n=[],r=new Map,i=[];for(const s of e)if(s.type==="add"){i.push(s);continue}else if(s.type==="remove"||s.type==="replace")r.set(s.id,[s]);else{const o=r.get(s.id);o?o.push(s):r.set(s.id,[s])}for(const s of t){const o=r.get(s.id);if(!o){n.push(s);continue}if(o[0].type==="remove")continue;if(o[0].type==="replace"){n.push({...o[0].item});continue}const l={...s};for(const c of o)W3(c,l);n.push(l)}return i.length&&i.forEach(s=>{s.index!==void 0?n.splice(s.index,0,{...s.item}):n.push({...s.item})}),n}function W3(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 av(e,t){return v_(e,t)}function b_(e,t){return v_(e,t)}function va(e,t){return{id:e,type:"select",selected:t}}function Tl(e,t=new Set,n=!1){const r=[];for(const[i,s]of e){const o=t.has(i);!(s.selected===void 0&&!o)&&s.selected!==o&&(n&&(s.selected=o),r.push(va(s.id,o)))}return r}function Tk({items:e=[],lookup:t}){var i;const n=[],r=new Map(e.map(s=>[s.id,s]));for(const[s,o]of e.entries()){const l=t.get(o.id),c=((i=l==null?void 0:l.internals)==null?void 0:i.userNode)??l;c!==void 0&&c!==o&&n.push({id:o.id,item:o,type:"replace"}),c===void 0&&n.push({item:o,type:"add",index:s})}for(const[s]of t)r.get(s)===void 0&&n.push({id:s,type:"remove"});return n}function Rk(e){return{id:e.id,type:"remove"}}const Lk=e=>nF(e),V3=e=>FE(e);function k_(e){return m.forwardRef(e)}function Ok(e){const[t,n]=m.useState(BigInt(0)),[r]=m.useState(()=>K3(()=>n(i=>i+BigInt(1))));return vx(()=>{const i=r.get();i.length&&(e(i),r.reset())},[t]),r}function K3(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const S_=m.createContext(null);function q3({children:e}){const t=Xt(),n=m.useCallback(l=>{const{nodes:c=[],setNodes:d,hasDefaultNodes:u,onNodesChange:f,nodeLookup:p,fitViewQueued:h,onNodesChangeMiddlewareMap:g}=t.getState();let b=c;for(const x of l)b=typeof x=="function"?x(b):x;let S=Tk({items:b,lookup:p});for(const x of g.values())S=x(S);u&&d(b),S.length>0?f==null||f(S):h&&window.requestAnimationFrame(()=>{const{fitViewQueued:x,nodes:w,setNodes:v}=t.getState();x&&v(w)})},[]),r=Ok(n),i=m.useCallback(l=>{const{edges:c=[],setEdges:d,hasDefaultEdges:u,onEdgesChange:f,edgeLookup:p}=t.getState();let h=c;for(const g of l)h=typeof g=="function"?g(h):g;u?d(h):f&&f(Tk({items:h,lookup:p}))},[]),s=Ok(i),o=m.useMemo(()=>({nodeQueue:r,edgeQueue:s}),[]);return a.jsx(S_.Provider,{value:o,children:e})}function Y3(){const e=m.useContext(S_);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const G3=e=>!!e.panZoom;function Va(){const e=U3(),t=Xt(),n=Y3(),r=kt(G3),i=m.useMemo(()=>{const s=f=>t.getState().nodeLookup.get(f),o=f=>{n.nodeQueue.push(f)},l=f=>{n.edgeQueue.push(f)},c=f=>{var x,w;const{nodeLookup:p,nodeOrigin:h}=t.getState(),g=Lk(f)?f:p.get(f.id),b=g.parentId?VE(g.position,g.measured,g.parentId,p,h):g.position,S={...g,position:b,width:((x=g.measured)==null?void 0:x.width)??g.width,height:((w=g.measured)==null?void 0:w.height)??g.height};return sc(S)},d=(f,p,h={replace:!1})=>{o(g=>g.map(b=>{if(b.id===f){const S=typeof p=="function"?p(b):p;return h.replace&&Lk(S)?S:{...b,...S}}return b}))},u=(f,p,h={replace:!1})=>{l(g=>g.map(b=>{if(b.id===f){const S=typeof p=="function"?p(b):p;return h.replace&&V3(S)?S:{...b,...S}}return b}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var p;return(p=s(f))==null?void 0:p.internals.userNode},getInternalNode:s,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(p=>({...p}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:o,setEdges:l,addNodes:f=>{const p=Array.isArray(f)?f:[f];n.nodeQueue.push(h=>[...h,...p])},addEdges:f=>{const p=Array.isArray(f)?f:[f];n.edgeQueue.push(h=>[...h,...p])},toObject:()=>{const{nodes:f=[],edges:p=[],transform:h}=t.getState(),[g,b,S]=h;return{nodes:f.map(x=>({...x})),edges:p.map(x=>({...x})),viewport:{x:g,y:b,zoom:S}}},deleteElements:async({nodes:f=[],edges:p=[]})=>{const{nodes:h,edges:g,onNodesDelete:b,onEdgesDelete:S,triggerNodeChanges:x,triggerEdgeChanges:w,onDelete:v,onBeforeDelete:k}=t.getState(),{nodes:E,edges:j}=await aF({nodesToRemove:f,edgesToRemove:p,nodes:h,edges:g,onBeforeDelete:k}),A=j.length>0,$=E.length>0;if(A){const I=j.map(Rk);S==null||S(j),w(I)}if($){const I=E.map(Rk);b==null||b(E),x(I)}return($||A)&&(v==null||v({nodes:E,edges:j})),{deletedNodes:E,deletedEdges:j}},getIntersectingNodes:(f,p=!0,h)=>{const g=uk(f),b=g?f:c(f),S=h!==void 0;return b?(h||t.getState().nodes).filter(x=>{const w=t.getState().nodeLookup.get(x.id);if(w&&!g&&(x.id===f.id||!w.internals.positionAbsolute))return!1;const v=sc(S?x:w),k=id(v,b);return p&&k>0||k>=v.width*v.height||k>=b.width*b.height}):[]},isNodeIntersecting:(f,p,h=!0)=>{const b=uk(f)?f:c(f);if(!b)return!1;const S=id(b,p);return h&&S>0||S>=p.width*p.height||S>=b.width*b.height},updateNode:d,updateNodeData:(f,p,h={replace:!1})=>{d(f,g=>{const b=typeof p=="function"?p(g):p;return h.replace?{...g,data:b}:{...g,data:{...g.data,...b}}},h)},updateEdge:u,updateEdgeData:(f,p,h={replace:!1})=>{u(f,g=>{const b=typeof p=="function"?p(g):p;return h.replace?{...g,data:b}:{...g,data:{...g.data,...b}}},h)},getNodesBounds:f=>{const{nodeLookup:p,nodeOrigin:h}=t.getState();return rF(f,{nodeLookup:p,nodeOrigin:h})},getHandleConnections:({type:f,id:p,nodeId:h})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${h}-${f}${p?`-${p}`:""}`))==null?void 0:g.values())??[])},getNodeConnections:({type:f,handleId:p,nodeId:h})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${h}${f?p?`-${f}-${p}`:`-${f}`:""}`))==null?void 0:g.values())??[])},fitView:async f=>{const p=t.getState().fitViewResolver??dF();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:p}),n.nodeQueue.push(h=>[...h]),p.promise}}},[]);return m.useMemo(()=>({...i,...e,viewportInitialized:r}),[r])}const Mk=e=>e.selected,X3=typeof window<"u"?window:void 0;function J3({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=Xt(),{deleteElements:r}=Va(),i=ad(e,{actInsideInputWithModifier:!1}),s=ad(t,{target:X3});m.useEffect(()=>{if(i){const{edges:o,nodes:l}=n.getState();r({nodes:l.filter(Mk),edges:o.filter(Mk)}),n.setState({nodesSelectionActive:!1})}},[i]),m.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])}function Q3(e){const t=Xt();m.useEffect(()=>{const n=()=>{var i,s,o,l;if(!e.current||!(((s=(i=e.current).checkVisibility)==null?void 0:s.call(i))??!0))return!1;const r=tv(e.current);(r.height===0||r.width===0)&&((l=(o=t.getState()).onError)==null||l.call(o,"004",Cs.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 om={position:"absolute",width:"100%",height:"100%",top:0,left:0},Z3=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function ez({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:s=Pa.Free,zoomOnDoubleClick:o=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:d,minZoom:u,maxZoom:f,zoomActivationKeyCode:p,preventScrolling:h=!0,children:g,noWheelClassName:b,noPanClassName:S,onViewportChange:x,isControlledViewport:w,paneClickDistance:v,selectionOnDrag:k}){const E=Xt(),j=m.useRef(null),{userSelectionActive:A,lib:$,connectionInProgress:I}=kt(Z3,rn),F=ad(p),L=m.useRef();Q3(j);const T=m.useCallback(q=>{x==null||x({x:q[0],y:q[1],zoom:q[2]}),w||E.setState({transform:q})},[x,w]);return m.useEffect(()=>{if(j.current){L.current=qF({domNode:j.current,minZoom:u,maxZoom:f,translateExtent:d,viewport:c,onDraggingChange:O=>E.setState(U=>U.paneDragging===O?U:{paneDragging:O}),onPanZoomStart:(O,U)=>{const{onViewportChangeStart:P,onMoveStart:R}=E.getState();R==null||R(O,U),P==null||P(U)},onPanZoom:(O,U)=>{const{onViewportChange:P,onMove:R}=E.getState();R==null||R(O,U),P==null||P(U)},onPanZoomEnd:(O,U)=>{const{onViewportChangeEnd:P,onMoveEnd:R}=E.getState();R==null||R(O,U),P==null||P(U)}});const{x:q,y:D,zoom:W}=L.current.getViewport();return E.setState({panZoom:L.current,transform:[q,D,W],domNode:j.current.closest(".react-flow")}),()=>{var O;(O=L.current)==null||O.destroy()}}},[]),m.useEffect(()=>{var q;(q=L.current)==null||q.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:s,zoomOnDoubleClick:o,panOnDrag:l,zoomActivationKeyPressed:F,preventScrolling:h,noPanClassName:S,userSelectionActive:A,noWheelClassName:b,lib:$,onTransformChange:T,connectionInProgress:I,selectionOnDrag:k,paneClickDistance:v})},[e,t,n,r,i,s,o,l,F,h,S,A,b,$,T,I,k,v]),a.jsx("div",{className:"react-flow__renderer",ref:j,style:om,children:g})}const tz=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function nz(){const{userSelectionActive:e,userSelectionRect:t}=kt(tz,rn);return e&&t?a.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 _g=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},rz=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function iz({isSelecting:e,selectionKeyPressed:t,selectionMode:n=rd.Full,panOnDrag:r,paneClickDistance:i,selectionOnDrag:s,onSelectionStart:o,onSelectionEnd:l,onPaneClick:c,onPaneContextMenu:d,onPaneScroll:u,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:h,children:g}){const b=Xt(),{userSelectionActive:S,elementsSelectable:x,dragging:w,connectionInProgress:v}=kt(rz,rn),k=x&&(e||S),E=m.useRef(null),j=m.useRef(),A=m.useRef(new Set),$=m.useRef(new Set),I=m.useRef(!1),F=P=>{if(I.current||v){I.current=!1;return}c==null||c(P),b.getState().resetSelectedElements(),b.setState({nodesSelectionActive:!1})},L=P=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){P.preventDefault();return}d==null||d(P)},T=u?P=>u(P):void 0,q=P=>{I.current&&(P.stopPropagation(),I.current=!1)},D=P=>{var de,ce;const{domNode:R}=b.getState();if(j.current=R==null?void 0:R.getBoundingClientRect(),!j.current)return;const C=P.target===E.current;if(!C&&!!P.target.closest(".nokey")||!e||!(s&&C||t)||P.button!==0||!P.isPrimary)return;(ce=(de=P.target)==null?void 0:de.setPointerCapture)==null||ce.call(de,P.pointerId),I.current=!1;const{x:B,y:te}=Vi(P.nativeEvent,j.current);b.setState({userSelectionRect:{width:0,height:0,startX:B,startY:te,x:B,y:te}}),C||(P.stopPropagation(),P.preventDefault())},W=P=>{const{userSelectionRect:R,transform:C,nodeLookup:G,edgeLookup:J,connectionLookup:B,triggerNodeChanges:te,triggerEdgeChanges:de,defaultEdgeOptions:ce,resetSelectedElements:ue}=b.getState();if(!j.current||!R)return;const{x:re,y:ge}=Vi(P.nativeEvent,j.current),{startX:se,startY:pe}=R;if(!I.current){const Ke=t?0:i;if(Math.hypot(re-se,ge-pe)<=Ke)return;ue(),o==null||o(P)}I.current=!0;const ae={startX:se,startY:pe,x:re<se?re:se,y:ge<pe?ge:pe,width:Math.abs(re-se),height:Math.abs(ge-pe)},me=A.current,ze=$.current;A.current=new Set(Zw(G,ae,C,n===rd.Partial,!0).map(Ke=>Ke.id)),$.current=new Set;const st=(ce==null?void 0:ce.selectable)??!0;for(const Ke of A.current){const Ee=B.get(Ke);if(Ee)for(const{edgeId:It}of Ee.values()){const sn=J.get(It);sn&&(sn.selectable??st)&&$.current.add(It)}}if(!dk(me,A.current)){const Ke=Tl(G,A.current,!0);te(Ke)}if(!dk(ze,$.current)){const Ke=Tl(J,$.current);de(Ke)}b.setState({userSelectionRect:ae,userSelectionActive:!0,nodesSelectionActive:!1})},O=P=>{var R,C;P.button===0&&((C=(R=P.target)==null?void 0:R.releasePointerCapture)==null||C.call(R,P.pointerId),!S&&P.target===E.current&&b.getState().userSelectionRect&&(F==null||F(P)),b.setState({userSelectionActive:!1,userSelectionRect:null}),I.current&&(l==null||l(P),b.setState({nodesSelectionActive:A.current.size>0})))},U=r===!0||Array.isArray(r)&&r.includes(0);return a.jsxs("div",{className:Ln(["react-flow__pane",{draggable:U,dragging:w,selection:e}]),onClick:k?void 0:_g(F,E),onContextMenu:_g(L,E),onWheel:_g(T,E),onPointerEnter:k?void 0:f,onPointerMove:k?W:p,onPointerUp:k?O:void 0,onPointerDownCapture:k?D:void 0,onClickCapture:k?q:void 0,onPointerLeave:h,ref:E,style:om,children:[g,a.jsx(nz,{})]})}function bx({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:i,unselectNodesAndEdges:s,multiSelectionActive:o,nodeLookup:l,onError:c}=t.getState(),d=l.get(e);if(!d){c==null||c("012",Cs.error012(e));return}t.setState({nodesSelectionActive:!1}),d.selected?(n||d.selected&&o)&&(s({nodes:[d],edges:[]}),requestAnimationFrame(()=>{var u;return(u=r==null?void 0:r.current)==null?void 0:u.blur()})):i([e])}function N_({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:s,nodeClickDistance:o}){const l=Xt(),[c,d]=m.useState(!1),u=m.useRef();return m.useEffect(()=>{u.current=RF({getStoreItems:()=>l.getState(),onNodeMouseDown:f=>{bx({id:f,store:l,nodeRef:e})},onDragStart:()=>{d(!0)},onDragStop:()=>{d(!1)}})},[]),m.useEffect(()=>{if(!(t||!e.current||!u.current))return u.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:s,nodeId:i,nodeClickDistance:o}),()=>{var f;(f=u.current)==null||f.destroy()}},[n,r,t,s,e,i,o]),c}const sz=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function j_(){const e=Xt();return m.useCallback(n=>{const{nodeExtent:r,snapToGrid:i,snapGrid:s,nodesDraggable:o,onError:l,updateNodePositions:c,nodeLookup:d,nodeOrigin:u}=e.getState(),f=new Map,p=sz(o),h=i?s[0]:5,g=i?s[1]:5,b=n.direction.x*h*n.factor,S=n.direction.y*g*n.factor;for(const[,x]of d){if(!p(x))continue;let w={x:x.internals.positionAbsolute.x+b,y:x.internals.positionAbsolute.y+S};i&&(w=Ad(w,s));const{position:v,positionAbsolute:k}=zE({nodeId:x.id,nextPosition:w,nodeLookup:d,nodeExtent:r,nodeOrigin:u,onError:l});x.position=v,x.internals.positionAbsolute=k,f.set(x.id,x)}c(f)},[])}const lv=m.createContext(null),oz=lv.Provider;lv.Consumer;const C_=()=>m.useContext(lv),az=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),lz=(e,t,n)=>r=>{const{connectionClickStartHandle:i,connectionMode:s,connection:o}=r,{fromHandle:l,toHandle:c,isValid:d}=o,u=(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:u,clickConnecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.id)===t&&(i==null?void 0:i.type)===n,isPossibleEndHandle:s===rc.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:!!i,valid:u&&d}};function cz({type:e="source",position:t=Fe.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:s=!0,id:o,onConnect:l,children:c,className:d,onMouseDown:u,onTouchStart:f,...p},h){var W,O;const g=o||null,b=e==="target",S=Xt(),x=C_(),{connectOnClick:w,noPanClassName:v,rfId:k}=kt(az,rn),{connectingFrom:E,connectingTo:j,clickConnecting:A,isPossibleEndHandle:$,connectionInProcess:I,clickConnectionInProcess:F,valid:L}=kt(lz(x,g,e),rn);x||(O=(W=S.getState()).onError)==null||O.call(W,"010",Cs.error010());const T=U=>{const{defaultEdgeOptions:P,onConnect:R,hasDefaultEdges:C}=S.getState(),G={...P,...U};if(C){const{edges:J,setEdges:B}=S.getState();B(od(G,J))}R==null||R(G),l==null||l(G)},q=U=>{if(!x)return;const P=YE(U.nativeEvent);if(i&&(P&&U.button===0||!P)){const R=S.getState();wx.onPointerDown(U.nativeEvent,{handleDomNode:U.currentTarget,autoPanOnConnect:R.autoPanOnConnect,connectionMode:R.connectionMode,connectionRadius:R.connectionRadius,domNode:R.domNode,nodeLookup:R.nodeLookup,lib:R.lib,isTarget:b,handleId:g,nodeId:x,flowId:R.rfId,panBy:R.panBy,cancelConnection:R.cancelConnection,onConnectStart:R.onConnectStart,onConnectEnd:(...C)=>{var G,J;return(J=(G=S.getState()).onConnectEnd)==null?void 0:J.call(G,...C)},updateConnection:R.updateConnection,onConnect:T,isValidConnection:n||((...C)=>{var G,J;return((J=(G=S.getState()).isValidConnection)==null?void 0:J.call(G,...C))??!0}),getTransform:()=>S.getState().transform,getFromHandle:()=>S.getState().connection.fromHandle,autoPanSpeed:R.autoPanSpeed,dragThreshold:R.connectionDragThreshold})}P?u==null||u(U):f==null||f(U)},D=U=>{const{onClickConnectStart:P,onClickConnectEnd:R,connectionClickStartHandle:C,connectionMode:G,isValidConnection:J,lib:B,rfId:te,nodeLookup:de,connection:ce}=S.getState();if(!x||!C&&!i)return;if(!C){P==null||P(U.nativeEvent,{nodeId:x,handleId:g,handleType:e}),S.setState({connectionClickStartHandle:{nodeId:x,type:e,id:g}});return}const ue=KE(U.target),re=n||J,{connection:ge,isValid:se}=wx.isValid(U.nativeEvent,{handle:{nodeId:x,id:g,type:e},connectionMode:G,fromNodeId:C.nodeId,fromHandleId:C.id||null,fromType:C.type,isValidConnection:re,flowId:te,doc:ue,lib:B,nodeLookup:de});se&&ge&&T(ge);const pe=structuredClone(ce);delete pe.inProgress,pe.toPosition=pe.toHandle?pe.toHandle.position:null,R==null||R(U,pe),S.setState({connectionClickStartHandle:null})};return a.jsx("div",{"data-handleid":g,"data-nodeid":x,"data-handlepos":t,"data-id":`${k}-${x}-${g}-${e}`,className:Ln(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",v,d,{source:!b,target:b,connectable:r,connectablestart:i,connectableend:s,clickconnecting:A,connectingfrom:E,connectingto:j,valid:L,connectionindicator:r&&(!I||$)&&(I||F?s:i)}]),onMouseDown:q,onTouchStart:q,onClick:w?D:void 0,ref:h,...p,children:c})}const ji=m.memo(k_(cz));function uz({data:e,isConnectable:t,sourcePosition:n=Fe.Bottom}){return a.jsxs(a.Fragment,{children:[e==null?void 0:e.label,a.jsx(ji,{type:"source",position:n,isConnectable:t})]})}function dz({data:e,isConnectable:t,targetPosition:n=Fe.Top,sourcePosition:r=Fe.Bottom}){return a.jsxs(a.Fragment,{children:[a.jsx(ji,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,a.jsx(ji,{type:"source",position:r,isConnectable:t})]})}function fz(){return null}function pz({data:e,isConnectable:t,targetPosition:n=Fe.Top}){return a.jsxs(a.Fragment,{children:[a.jsx(ji,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const dh={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},$k={input:uz,default:dz,output:pz,group:fz};function hz(e){var t,n,r,i;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??((i=e.style)==null?void 0:i.height)}}const mz=e=>{const{width:t,height:n,x:r,y:i}=Pd(e.nodeLookup,{filter:s=>!!s.selected});return{width:Wi(t)?t:null,height:Wi(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function gz({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Xt(),{width:i,height:s,transformString:o,userSelectionActive:l}=kt(mz,rn),c=j_(),d=m.useRef(null);m.useEffect(()=>{var h;n||(h=d.current)==null||h.focus({preventScroll:!0})},[n]);const u=!l&&i!==null&&s!==null;if(N_({nodeRef:d,disabled:!u}),!u)return null;const f=e?h=>{const g=r.getState().nodes.filter(b=>b.selected);e(h,g)}:void 0,p=h=>{Object.prototype.hasOwnProperty.call(dh,h.key)&&(h.preventDefault(),c({direction:dh[h.key],factor:h.shiftKey?4:1}))};return a.jsx("div",{className:Ln(["react-flow__nodesselection","react-flow__container",t]),style:{transform:o},children:a.jsx("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:p,style:{width:i,height:s}})})}const Dk=typeof window<"u"?window:void 0,yz=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function E_({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:s,onPaneScroll:o,paneClickDistance:l,deleteKeyCode:c,selectionKeyCode:d,selectionOnDrag:u,selectionMode:f,onSelectionStart:p,onSelectionEnd:h,multiSelectionKeyCode:g,panActivationKeyCode:b,zoomActivationKeyCode:S,elementsSelectable:x,zoomOnScroll:w,zoomOnPinch:v,panOnScroll:k,panOnScrollSpeed:E,panOnScrollMode:j,zoomOnDoubleClick:A,panOnDrag:$,defaultViewport:I,translateExtent:F,minZoom:L,maxZoom:T,preventScrolling:q,onSelectionContextMenu:D,noWheelClassName:W,noPanClassName:O,disableKeyboardA11y:U,onViewportChange:P,isControlledViewport:R}){const{nodesSelectionActive:C,userSelectionActive:G}=kt(yz,rn),J=ad(d,{target:Dk}),B=ad(b,{target:Dk}),te=B||$,de=B||k,ce=u&&te!==!0,ue=J||G||ce;return J3({deleteKeyCode:c,multiSelectionKeyCode:g}),a.jsx(ez,{onPaneContextMenu:s,elementsSelectable:x,zoomOnScroll:w,zoomOnPinch:v,panOnScroll:de,panOnScrollSpeed:E,panOnScrollMode:j,zoomOnDoubleClick:A,panOnDrag:!J&&te,defaultViewport:I,translateExtent:F,minZoom:L,maxZoom:T,zoomActivationKeyCode:S,preventScrolling:q,noWheelClassName:W,noPanClassName:O,onViewportChange:P,isControlledViewport:R,paneClickDistance:l,selectionOnDrag:ce,children:a.jsxs(iz,{onSelectionStart:p,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:s,onPaneScroll:o,panOnDrag:te,isSelecting:!!ue,selectionMode:f,selectionKeyPressed:J,paneClickDistance:l,selectionOnDrag:ce,children:[e,C&&a.jsx(gz,{onSelectionContextMenu:D,noPanClassName:O,disableKeyboardA11y:U})]})})}E_.displayName="FlowRenderer";const xz=m.memo(E_),wz=e=>t=>e?Zw(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 vz(e){return kt(m.useCallback(wz(e),[e]),rn)}const bz=e=>e.updateNodeInternals;function kz(){const e=kt(bz),[t]=m.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(i=>{const s=i.target.getAttribute("data-id");r.set(s,{id:s,nodeElement:i.target,force:!0})}),e(r)}));return m.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function Sz({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const i=Xt(),s=m.useRef(null),o=m.useRef(null),l=m.useRef(e.sourcePosition),c=m.useRef(e.targetPosition),d=m.useRef(t),u=n&&!!e.internals.handleBounds;return m.useEffect(()=>{s.current&&!e.hidden&&(!u||o.current!==s.current)&&(o.current&&(r==null||r.unobserve(o.current)),r==null||r.observe(s.current),o.current=s.current)},[u,e.hidden]),m.useEffect(()=>()=>{o.current&&(r==null||r.unobserve(o.current),o.current=null)},[]),m.useEffect(()=>{if(s.current){const f=d.current!==t,p=l.current!==e.sourcePosition,h=c.current!==e.targetPosition;(f||p||h)&&(d.current=t,l.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:s.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),s}function Nz({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:s,onDoubleClick:o,nodesDraggable:l,elementsSelectable:c,nodesConnectable:d,nodesFocusable:u,resizeObserver:f,noDragClassName:p,noPanClassName:h,disableKeyboardA11y:g,rfId:b,nodeTypes:S,nodeClickDistance:x,onError:w}){const{node:v,internals:k,isParent:E}=kt(re=>{const ge=re.nodeLookup.get(e),se=re.parentLookup.has(e);return{node:ge,internals:ge.internals,isParent:se}},rn);let j=v.type||"default",A=(S==null?void 0:S[j])||$k[j];A===void 0&&(w==null||w("003",Cs.error003(j)),j="default",A=(S==null?void 0:S.default)||$k.default);const $=!!(v.draggable||l&&typeof v.draggable>"u"),I=!!(v.selectable||c&&typeof v.selectable>"u"),F=!!(v.connectable||d&&typeof v.connectable>"u"),L=!!(v.focusable||u&&typeof v.focusable>"u"),T=Xt(),q=WE(v),D=Sz({node:v,nodeType:j,hasDimensions:q,resizeObserver:f}),W=N_({nodeRef:D,disabled:v.hidden||!$,noDragClassName:p,handleSelector:v.dragHandle,nodeId:e,isSelectable:I,nodeClickDistance:x}),O=j_();if(v.hidden)return null;const U=ro(v),P=hz(v),R=I||$||t||n||r||i,C=n?re=>n(re,{...k.userNode}):void 0,G=r?re=>r(re,{...k.userNode}):void 0,J=i?re=>i(re,{...k.userNode}):void 0,B=s?re=>s(re,{...k.userNode}):void 0,te=o?re=>o(re,{...k.userNode}):void 0,de=re=>{const{selectNodesOnDrag:ge,nodeDragThreshold:se}=T.getState();I&&(!ge||!$||se>0)&&bx({id:e,store:T,nodeRef:D}),t&&t(re,{...k.userNode})},ce=re=>{if(!(qE(re.nativeEvent)||g)){if(OE.includes(re.key)&&I){const ge=re.key==="Escape";bx({id:e,store:T,unselect:ge,nodeRef:D})}else if($&&v.selected&&Object.prototype.hasOwnProperty.call(dh,re.key)){re.preventDefault();const{ariaLabelConfig:ge}=T.getState();T.setState({ariaLiveMessage:ge["node.a11yDescription.ariaLiveMessage"]({direction:re.key.replace("Arrow","").toLowerCase(),x:~~k.positionAbsolute.x,y:~~k.positionAbsolute.y})}),O({direction:dh[re.key],factor:re.shiftKey?4:1})}}},ue=()=>{var ze;if(g||!((ze=D.current)!=null&&ze.matches(":focus-visible")))return;const{transform:re,width:ge,height:se,autoPanOnNodeFocus:pe,setCenter:ae}=T.getState();if(!pe)return;Zw(new Map([[e,v]]),{x:0,y:0,width:ge,height:se},re,!0).length>0||ae(v.position.x+U.width/2,v.position.y+U.height/2,{zoom:re[2]})};return a.jsx("div",{className:Ln(["react-flow__node",`react-flow__node-${j}`,{[h]:$},v.className,{selected:v.selected,selectable:I,parent:E,draggable:$,dragging:W}]),ref:D,style:{zIndex:k.z,transform:`translate(${k.positionAbsolute.x}px,${k.positionAbsolute.y}px)`,pointerEvents:R?"all":"none",visibility:q?"visible":"hidden",...v.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:C,onMouseMove:G,onMouseLeave:J,onContextMenu:B,onClick:de,onDoubleClick:te,onKeyDown:L?ce:void 0,tabIndex:L?0:void 0,onFocus:L?ue:void 0,role:v.ariaRole??(L?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${y_}-${b}`,"aria-label":v.ariaLabel,...v.domAttributes,children:a.jsx(oz,{value:e,children:a.jsx(A,{id:e,data:v.data,type:j,positionAbsoluteX:k.positionAbsolute.x,positionAbsoluteY:k.positionAbsolute.y,selected:v.selected??!1,selectable:I,draggable:$,deletable:v.deletable??!0,isConnectable:F,sourcePosition:v.sourcePosition,targetPosition:v.targetPosition,dragging:W,dragHandle:v.dragHandle,zIndex:k.z,parentId:v.parentId,...U})})})}var jz=m.memo(Nz);const Cz=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function __(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,onError:s}=kt(Cz,rn),o=vz(e.onlyRenderVisibleElements),l=kz();return a.jsx("div",{className:"react-flow__nodes",style:om,children:o.map(c=>a.jsx(jz,{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:i,nodeClickDistance:e.nodeClickDistance,onError:s},c))})}__.displayName="NodeRenderer";const Ez=m.memo(__);function _z(e){return kt(m.useCallback(n=>{if(!e)return n.edges.map(i=>i.id);const r=[];if(n.width&&n.height)for(const i of n.edges){const s=n.nodeLookup.get(i.source),o=n.nodeLookup.get(i.target);s&&o&&mF({sourceNode:s,targetNode:o,width:n.width,height:n.height,transform:n.transform})&&r.push(i.id)}return r},[e]),rn)}const Pz=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return a.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},Az=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return a.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Fk={[qr.Arrow]:Pz,[qr.ArrowClosed]:Az};function Iz(e){const t=Xt();return m.useMemo(()=>{var i,s;return Object.prototype.hasOwnProperty.call(Fk,e)?Fk[e]:((s=(i=t.getState()).onError)==null||s.call(i,"009",Cs.error009(e)),null)},[e])}const Tz=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:s="strokeWidth",strokeWidth:o,orient:l="auto-start-reverse"})=>{const c=Iz(t);return c?a.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:l,refX:"0",refY:"0",children:a.jsx(c,{color:n,strokeWidth:o})}):null},P_=({defaultColor:e,rfId:t})=>{const n=kt(s=>s.edges),r=kt(s=>s.defaultEdgeOptions),i=m.useMemo(()=>kF(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return i.length?a.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:a.jsx("defs",{children:i.map(s=>a.jsx(Tz,{id:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient},s.id))})}):null};P_.displayName="MarkerDefinitions";var Rz=m.memo(P_);function A_({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:s,labelBgPadding:o=[2,4],labelBgBorderRadius:l=2,children:c,className:d,...u}){const[f,p]=m.useState({x:1,y:0,width:0,height:0}),h=Ln(["react-flow__edge-textwrapper",d]),g=m.useRef(null);return m.useEffect(()=>{if(g.current){const b=g.current.getBBox();p({x:b.x,y:b.y,width:b.width,height:b.height})}},[n]),n?a.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:h,visibility:f.width?"visible":"hidden",...u,children:[i&&a.jsx("rect",{width:f.width+2*o[0],x:-o[0],y:-o[1],height:f.height+2*o[1],className:"react-flow__edge-textbg",style:s,rx:l,ry:l}),a.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:g,style:r,children:n}),c]}):null}A_.displayName="EdgeText";const Lz=m.memo(A_);function am({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:s,labelBgStyle:o,labelBgPadding:l,labelBgBorderRadius:c,interactionWidth:d=20,...u}){return a.jsxs(a.Fragment,{children:[a.jsx("path",{...u,d:e,fill:"none",className:Ln(["react-flow__edge-path",u.className])}),d?a.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:d,className:"react-flow__edge-interaction"}):null,r&&Wi(t)&&Wi(n)?a.jsx(Lz,{x:t,y:n,label:r,labelStyle:i,labelShowBg:s,labelBgStyle:o,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function zk({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===Fe.Left||e===Fe.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function I_({sourceX:e,sourceY:t,sourcePosition:n=Fe.Bottom,targetX:r,targetY:i,targetPosition:s=Fe.Top}){const[o,l]=zk({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,d]=zk({pos:s,x1:r,y1:i,x2:e,y2:t}),[u,f,p,h]=GE({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:l,targetControlX:c,targetControlY:d});return[`M${e},${t} C${o},${l} ${c},${d} ${r},${i}`,u,f,p,h]}function T_(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,sourcePosition:o,targetPosition:l,label:c,labelStyle:d,labelShowBg:u,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:g,markerEnd:b,markerStart:S,interactionWidth:x})=>{const[w,v,k]=I_({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:s,targetPosition:l}),E=e.isInternal?void 0:t;return a.jsx(am,{id:E,path:w,labelX:v,labelY:k,label:c,labelStyle:d,labelShowBg:u,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:g,markerEnd:b,markerStart:S,interactionWidth:x})})}const Oz=T_({isInternal:!1}),R_=T_({isInternal:!0});Oz.displayName="SimpleBezierEdge";R_.displayName="SimpleBezierEdgeInternal";function L_(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:f,style:p,sourcePosition:h=Fe.Bottom,targetPosition:g=Fe.Top,markerEnd:b,markerStart:S,pathOptions:x,interactionWidth:w})=>{const[v,k,E]=gx({sourceX:n,sourceY:r,sourcePosition:h,targetX:i,targetY:s,targetPosition:g,borderRadius:x==null?void 0:x.borderRadius,offset:x==null?void 0:x.offset,stepPosition:x==null?void 0:x.stepPosition}),j=e.isInternal?void 0:t;return a.jsx(am,{id:j,path:v,labelX:k,labelY:E,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:f,style:p,markerEnd:b,markerStart:S,interactionWidth:w})})}const O_=L_({isInternal:!1}),M_=L_({isInternal:!0});O_.displayName="SmoothStepEdge";M_.displayName="SmoothStepEdgeInternal";function $_(e){return m.memo(({id:t,...n})=>{var i;const r=e.isInternal?void 0:t;return a.jsx(O_,{...n,id:r,pathOptions:m.useMemo(()=>{var s;return{borderRadius:0,offset:(s=n.pathOptions)==null?void 0:s.offset}},[(i=n.pathOptions)==null?void 0:i.offset])})})}const Mz=$_({isInternal:!1}),D_=$_({isInternal:!0});Mz.displayName="StepEdge";D_.displayName="StepEdgeInternal";function F_(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:f,style:p,markerEnd:h,markerStart:g,interactionWidth:b})=>{const[S,x,w]=QE({sourceX:n,sourceY:r,targetX:i,targetY:s}),v=e.isInternal?void 0:t;return a.jsx(am,{id:v,path:S,labelX:x,labelY:w,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:f,style:p,markerEnd:h,markerStart:g,interactionWidth:b})})}const $z=F_({isInternal:!1}),z_=F_({isInternal:!0});$z.displayName="StraightEdge";z_.displayName="StraightEdgeInternal";function B_(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,sourcePosition:o=Fe.Bottom,targetPosition:l=Fe.Top,label:c,labelStyle:d,labelShowBg:u,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:g,markerEnd:b,markerStart:S,pathOptions:x,interactionWidth:w})=>{const[v,k,E]=XE({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:s,targetPosition:l,curvature:x==null?void 0:x.curvature}),j=e.isInternal?void 0:t;return a.jsx(am,{id:j,path:v,labelX:k,labelY:E,label:c,labelStyle:d,labelShowBg:u,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:g,markerEnd:b,markerStart:S,interactionWidth:w})})}const Dz=B_({isInternal:!1}),H_=B_({isInternal:!0});Dz.displayName="BezierEdge";H_.displayName="BezierEdgeInternal";const Bk={default:H_,straight:z_,step:D_,smoothstep:M_,simplebezier:R_},Hk={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Fz=(e,t,n)=>n===Fe.Left?e-t:n===Fe.Right?e+t:e,zz=(e,t,n)=>n===Fe.Top?e-t:n===Fe.Bottom?e+t:e,Uk="react-flow__edgeupdater";function Wk({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:s,onMouseOut:o,type:l}){return a.jsx("circle",{onMouseDown:i,onMouseEnter:s,onMouseOut:o,className:Ln([Uk,`${Uk}-${l}`]),cx:Fz(t,r,e),cy:zz(n,r,e),r,stroke:"transparent",fill:"transparent"})}function Bz({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:s,targetY:o,sourcePosition:l,targetPosition:c,onReconnect:d,onReconnectStart:u,onReconnectEnd:f,setReconnecting:p,setUpdateHover:h}){const g=Xt(),b=(k,E)=>{if(k.button!==0)return;const{autoPanOnConnect:j,domNode:A,connectionMode:$,connectionRadius:I,lib:F,onConnectStart:L,cancelConnection:T,nodeLookup:q,rfId:D,panBy:W,updateConnection:O}=g.getState(),U=E.type==="target",P=(G,J)=>{p(!1),f==null||f(G,n,E.type,J)},R=G=>d==null?void 0:d(n,G),C=(G,J)=>{p(!0),u==null||u(k,n,E.type),L==null||L(G,J)};wx.onPointerDown(k.nativeEvent,{autoPanOnConnect:j,connectionMode:$,connectionRadius:I,domNode:A,handleId:E.id,nodeId:E.nodeId,nodeLookup:q,isTarget:U,edgeUpdaterType:E.type,lib:F,flowId:D,cancelConnection:T,panBy:W,isValidConnection:(...G)=>{var J,B;return((B=(J=g.getState()).isValidConnection)==null?void 0:B.call(J,...G))??!0},onConnect:R,onConnectStart:C,onConnectEnd:(...G)=>{var J,B;return(B=(J=g.getState()).onConnectEnd)==null?void 0:B.call(J,...G)},onReconnectEnd:P,updateConnection:O,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:k.currentTarget})},S=k=>b(k,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),x=k=>b(k,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),w=()=>h(!0),v=()=>h(!1);return a.jsxs(a.Fragment,{children:[(e===!0||e==="source")&&a.jsx(Wk,{position:l,centerX:r,centerY:i,radius:t,onMouseDown:S,onMouseEnter:w,onMouseOut:v,type:"source"}),(e===!0||e==="target")&&a.jsx(Wk,{position:c,centerX:s,centerY:o,radius:t,onMouseDown:x,onMouseEnter:w,onMouseOut:v,type:"target"})]})}function Hz({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:s,onContextMenu:o,onMouseEnter:l,onMouseMove:c,onMouseLeave:d,reconnectRadius:u,onReconnect:f,onReconnectStart:p,onReconnectEnd:h,rfId:g,edgeTypes:b,noPanClassName:S,onError:x,disableKeyboardA11y:w}){let v=kt(ae=>ae.edgeLookup.get(e));const k=kt(ae=>ae.defaultEdgeOptions);v=k?{...k,...v}:v;let E=v.type||"default",j=(b==null?void 0:b[E])||Bk[E];j===void 0&&(x==null||x("011",Cs.error011(E)),E="default",j=(b==null?void 0:b.default)||Bk.default);const A=!!(v.focusable||t&&typeof v.focusable>"u"),$=typeof f<"u"&&(v.reconnectable||n&&typeof v.reconnectable>"u"),I=!!(v.selectable||r&&typeof v.selectable>"u"),F=m.useRef(null),[L,T]=m.useState(!1),[q,D]=m.useState(!1),W=Xt(),{zIndex:O,sourceX:U,sourceY:P,targetX:R,targetY:C,sourcePosition:G,targetPosition:J}=kt(m.useCallback(ae=>{const me=ae.nodeLookup.get(v.source),ze=ae.nodeLookup.get(v.target);if(!me||!ze)return{zIndex:v.zIndex,...Hk};const st=bF({id:e,sourceNode:me,targetNode:ze,sourceHandle:v.sourceHandle||null,targetHandle:v.targetHandle||null,connectionMode:ae.connectionMode,onError:x});return{zIndex:hF({selected:v.selected,zIndex:v.zIndex,sourceNode:me,targetNode:ze,elevateOnSelect:ae.elevateEdgesOnSelect,zIndexMode:ae.zIndexMode}),...st||Hk}},[v.source,v.target,v.sourceHandle,v.targetHandle,v.selected,v.zIndex]),rn),B=m.useMemo(()=>v.markerStart?`url('#${yx(v.markerStart,g)}')`:void 0,[v.markerStart,g]),te=m.useMemo(()=>v.markerEnd?`url('#${yx(v.markerEnd,g)}')`:void 0,[v.markerEnd,g]);if(v.hidden||U===null||P===null||R===null||C===null)return null;const de=ae=>{var Ke;const{addSelectedEdges:me,unselectNodesAndEdges:ze,multiSelectionActive:st}=W.getState();I&&(W.setState({nodesSelectionActive:!1}),v.selected&&st?(ze({nodes:[],edges:[v]}),(Ke=F.current)==null||Ke.blur()):me([e])),i&&i(ae,v)},ce=s?ae=>{s(ae,{...v})}:void 0,ue=o?ae=>{o(ae,{...v})}:void 0,re=l?ae=>{l(ae,{...v})}:void 0,ge=c?ae=>{c(ae,{...v})}:void 0,se=d?ae=>{d(ae,{...v})}:void 0,pe=ae=>{var me;if(!w&&OE.includes(ae.key)&&I){const{unselectNodesAndEdges:ze,addSelectedEdges:st}=W.getState();ae.key==="Escape"?((me=F.current)==null||me.blur(),ze({edges:[v]})):st([e])}};return a.jsx("svg",{style:{zIndex:O},children:a.jsxs("g",{className:Ln(["react-flow__edge",`react-flow__edge-${E}`,v.className,S,{selected:v.selected,animated:v.animated,inactive:!I&&!i,updating:L,selectable:I}]),onClick:de,onDoubleClick:ce,onContextMenu:ue,onMouseEnter:re,onMouseMove:ge,onMouseLeave:se,onKeyDown:A?pe:void 0,tabIndex:A?0:void 0,role:v.ariaRole??(A?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":v.ariaLabel===null?void 0:v.ariaLabel||`Edge from ${v.source} to ${v.target}`,"aria-describedby":A?`${x_}-${g}`:void 0,ref:F,...v.domAttributes,children:[!q&&a.jsx(j,{id:e,source:v.source,target:v.target,type:v.type,selected:v.selected,animated:v.animated,selectable:I,deletable:v.deletable??!0,label:v.label,labelStyle:v.labelStyle,labelShowBg:v.labelShowBg,labelBgStyle:v.labelBgStyle,labelBgPadding:v.labelBgPadding,labelBgBorderRadius:v.labelBgBorderRadius,sourceX:U,sourceY:P,targetX:R,targetY:C,sourcePosition:G,targetPosition:J,data:v.data,style:v.style,sourceHandleId:v.sourceHandle,targetHandleId:v.targetHandle,markerStart:B,markerEnd:te,pathOptions:"pathOptions"in v?v.pathOptions:void 0,interactionWidth:v.interactionWidth}),$&&a.jsx(Bz,{edge:v,isReconnectable:$,reconnectRadius:u,onReconnect:f,onReconnectStart:p,onReconnectEnd:h,sourceX:U,sourceY:P,targetX:R,targetY:C,sourcePosition:G,targetPosition:J,setUpdateHover:T,setReconnecting:D})]})})}var Uz=m.memo(Hz);const Wz=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function U_({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:s,onEdgeContextMenu:o,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:d,onEdgeClick:u,reconnectRadius:f,onEdgeDoubleClick:p,onReconnectStart:h,onReconnectEnd:g,disableKeyboardA11y:b}){const{edgesFocusable:S,edgesReconnectable:x,elementsSelectable:w,onError:v}=kt(Wz,rn),k=_z(t);return a.jsxs("div",{className:"react-flow__edges",children:[a.jsx(Rz,{defaultColor:e,rfId:n}),k.map(E=>a.jsx(Uz,{id:E,edgesFocusable:S,edgesReconnectable:x,elementsSelectable:w,noPanClassName:i,onReconnect:s,onContextMenu:o,onMouseEnter:l,onMouseMove:c,onMouseLeave:d,onClick:u,reconnectRadius:f,onDoubleClick:p,onReconnectStart:h,onReconnectEnd:g,rfId:n,onError:v,edgeTypes:r,disableKeyboardA11y:b},E))]})}U_.displayName="EdgeRenderer";const Vz=m.memo(U_),Kz=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function qz({children:e}){const t=kt(Kz);return a.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function Yz(e){const t=Va(),n=m.useRef(!1);m.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Gz=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function Xz(e){const t=kt(Gz),n=Xt();return m.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Jz(e){return e.connection.inProgress?{...e.connection,to:Id(e.connection.to,e.transform)}:{...e.connection}}function Qz(e){return Jz}function Zz(e){const t=Qz();return kt(t,rn)}const e4=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function t4({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:i,width:s,height:o,isValid:l,inProgress:c}=kt(e4,rn);return!(s&&i&&c)?null:a.jsx("svg",{style:e,width:s,height:o,className:"react-flow__connectionline react-flow__container",children:a.jsx("g",{className:Ln(["react-flow__connection",DE(l)]),children:a.jsx(W_,{style:t,type:n,CustomComponent:r,isValid:l})})})}const W_=({style:e,type:t=Eo.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:i,from:s,fromNode:o,fromHandle:l,fromPosition:c,to:d,toNode:u,toHandle:f,toPosition:p,pointer:h}=Zz();if(!i)return;if(n)return a.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:l,fromX:s.x,fromY:s.y,toX:d.x,toY:d.y,fromPosition:c,toPosition:p,connectionStatus:DE(r),toNode:u,toHandle:f,pointer:h});let g="";const b={sourceX:s.x,sourceY:s.y,sourcePosition:c,targetX:d.x,targetY:d.y,targetPosition:p};switch(t){case Eo.Bezier:[g]=XE(b);break;case Eo.SimpleBezier:[g]=I_(b);break;case Eo.Step:[g]=gx({...b,borderRadius:0});break;case Eo.SmoothStep:[g]=gx(b);break;default:[g]=QE(b)}return a.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};W_.displayName="ConnectionLine";const n4={};function Vk(e=n4){m.useRef(e),Xt(),m.useEffect(()=>{},[e])}function r4(){Xt(),m.useRef(!1),m.useEffect(()=>{},[])}function V_({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:s,onEdgeDoubleClick:o,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:d,onNodeContextMenu:u,onSelectionContextMenu:f,onSelectionStart:p,onSelectionEnd:h,connectionLineType:g,connectionLineStyle:b,connectionLineComponent:S,connectionLineContainerStyle:x,selectionKeyCode:w,selectionOnDrag:v,selectionMode:k,multiSelectionKeyCode:E,panActivationKeyCode:j,zoomActivationKeyCode:A,deleteKeyCode:$,onlyRenderVisibleElements:I,elementsSelectable:F,defaultViewport:L,translateExtent:T,minZoom:q,maxZoom:D,preventScrolling:W,defaultMarkerColor:O,zoomOnScroll:U,zoomOnPinch:P,panOnScroll:R,panOnScrollSpeed:C,panOnScrollMode:G,zoomOnDoubleClick:J,panOnDrag:B,onPaneClick:te,onPaneMouseEnter:de,onPaneMouseMove:ce,onPaneMouseLeave:ue,onPaneScroll:re,onPaneContextMenu:ge,paneClickDistance:se,nodeClickDistance:pe,onEdgeContextMenu:ae,onEdgeMouseEnter:me,onEdgeMouseMove:ze,onEdgeMouseLeave:st,reconnectRadius:Ke,onReconnect:Ee,onReconnectStart:It,onReconnectEnd:sn,noDragClassName:Wt,noWheelClassName:mn,noPanClassName:on,disableKeyboardA11y:bn,nodeExtent:xr,rfId:_n,viewport:oe,onViewportChange:ye}){return Vk(e),Vk(t),r4(),Yz(n),Xz(oe),a.jsx(xz,{onPaneClick:te,onPaneMouseEnter:de,onPaneMouseMove:ce,onPaneMouseLeave:ue,onPaneContextMenu:ge,onPaneScroll:re,paneClickDistance:se,deleteKeyCode:$,selectionKeyCode:w,selectionOnDrag:v,selectionMode:k,onSelectionStart:p,onSelectionEnd:h,multiSelectionKeyCode:E,panActivationKeyCode:j,zoomActivationKeyCode:A,elementsSelectable:F,zoomOnScroll:U,zoomOnPinch:P,zoomOnDoubleClick:J,panOnScroll:R,panOnScrollSpeed:C,panOnScrollMode:G,panOnDrag:B,defaultViewport:L,translateExtent:T,minZoom:q,maxZoom:D,onSelectionContextMenu:f,preventScrolling:W,noDragClassName:Wt,noWheelClassName:mn,noPanClassName:on,disableKeyboardA11y:bn,onViewportChange:ye,isControlledViewport:!!oe,children:a.jsxs(qz,{children:[a.jsx(Vz,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:Ee,onReconnectStart:It,onReconnectEnd:sn,onlyRenderVisibleElements:I,onEdgeContextMenu:ae,onEdgeMouseEnter:me,onEdgeMouseMove:ze,onEdgeMouseLeave:st,reconnectRadius:Ke,defaultMarkerColor:O,noPanClassName:on,disableKeyboardA11y:bn,rfId:_n}),a.jsx(t4,{style:b,type:g,component:S,containerStyle:x}),a.jsx("div",{className:"react-flow__edgelabel-renderer"}),a.jsx(Ez,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:s,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:d,onNodeContextMenu:u,nodeClickDistance:pe,onlyRenderVisibleElements:I,noPanClassName:on,noDragClassName:Wt,disableKeyboardA11y:bn,nodeExtent:xr,rfId:_n}),a.jsx("div",{className:"react-flow__viewport-portal"})]})})}V_.displayName="GraphView";const i4=m.memo(V_),Kk=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:o,fitViewOptions:l,minZoom:c=.5,maxZoom:d=2,nodeOrigin:u,nodeExtent:f,zIndexMode:p="basic"}={})=>{const h=new Map,g=new Map,b=new Map,S=new Map,x=r??t??[],w=n??e??[],v=u??[0,0],k=f??nd;t_(b,S,x);const{nodesInitialized:E}=xx(w,h,g,{nodeOrigin:v,nodeExtent:k,zIndexMode:p});let j=[0,0,1];if(o&&i&&s){const A=Pd(h,{filter:L=>!!((L.width||L.initialWidth)&&(L.height||L.initialHeight))}),{x:$,y:I,zoom:F}=ev(A,i,s,c,d,(l==null?void 0:l.padding)??.1);j=[$,I,F]}return{rfId:"1",width:i??0,height:s??0,transform:j,nodes:w,nodesInitialized:E,nodeLookup:h,parentLookup:g,edges:x,edgeLookup:S,connectionLookup:b,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:d,translateExtent:nd,nodeExtent:k,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:rc.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:v,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:o??!1,fitViewOptions:l,fitViewResolver:null,connection:{...$E},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:lF,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:ME,zIndexMode:p,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},s4=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:o,fitViewOptions:l,minZoom:c,maxZoom:d,nodeOrigin:u,nodeExtent:f,zIndexMode:p})=>N3((h,g)=>{async function b(){const{nodeLookup:S,panZoom:x,fitViewOptions:w,fitViewResolver:v,width:k,height:E,minZoom:j,maxZoom:A}=g();x&&(await oF({nodes:S,width:k,height:E,panZoom:x,minZoom:j,maxZoom:A},w),v==null||v.resolve(!0),h({fitViewResolver:null}))}return{...Kk({nodes:e,edges:t,width:i,height:s,fitView:o,fitViewOptions:l,minZoom:c,maxZoom:d,nodeOrigin:u,nodeExtent:f,defaultNodes:n,defaultEdges:r,zIndexMode:p}),setNodes:S=>{const{nodeLookup:x,parentLookup:w,nodeOrigin:v,elevateNodesOnSelect:k,fitViewQueued:E,zIndexMode:j,nodesSelectionActive:A}=g(),{nodesInitialized:$,hasSelectedNodes:I}=xx(S,x,w,{nodeOrigin:v,nodeExtent:f,elevateNodesOnSelect:k,checkEquality:!0,zIndexMode:j}),F=A&&I;E&&$?(b(),h({nodes:S,nodesInitialized:$,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:F})):h({nodes:S,nodesInitialized:$,nodesSelectionActive:F})},setEdges:S=>{const{connectionLookup:x,edgeLookup:w}=g();t_(x,w,S),h({edges:S})},setDefaultNodesAndEdges:(S,x)=>{if(S){const{setNodes:w}=g();w(S),h({hasDefaultNodes:!0})}if(x){const{setEdges:w}=g();w(x),h({hasDefaultEdges:!0})}},updateNodeInternals:S=>{const{triggerNodeChanges:x,nodeLookup:w,parentLookup:v,domNode:k,nodeOrigin:E,nodeExtent:j,debug:A,fitViewQueued:$,zIndexMode:I}=g(),{changes:F,updatedInternals:L}=PF(S,w,v,k,E,j,I);L&&(jF(w,v,{nodeOrigin:E,nodeExtent:j,zIndexMode:I}),$?(b(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),(F==null?void 0:F.length)>0&&(A&&console.log("React Flow: trigger node changes",F),x==null||x(F)))},updateNodePositions:(S,x=!1)=>{const w=[];let v=[];const{nodeLookup:k,triggerNodeChanges:E,connection:j,updateConnection:A,onNodesChangeMiddlewareMap:$}=g();for(const[I,F]of S){const L=k.get(I),T=!!(L!=null&&L.expandParent&&(L!=null&&L.parentId)&&(F!=null&&F.position)),q={id:I,type:"position",position:T?{x:Math.max(0,F.position.x),y:Math.max(0,F.position.y)}:F.position,dragging:x};if(L&&j.inProgress&&j.fromNode.id===L.id){const D=za(L,j.fromHandle,Fe.Left,!0);A({...j,from:D})}T&&L.parentId&&w.push({id:I,parentId:L.parentId,rect:{...F.internals.positionAbsolute,width:F.measured.width??0,height:F.measured.height??0}}),v.push(q)}if(w.length>0){const{parentLookup:I,nodeOrigin:F}=g(),L=ov(w,k,I,F);v.push(...L)}for(const I of $.values())v=I(v);E(v)},triggerNodeChanges:S=>{const{onNodesChange:x,setNodes:w,nodes:v,hasDefaultNodes:k,debug:E}=g();if(S!=null&&S.length){if(k){const j=av(S,v);w(j)}E&&console.log("React Flow: trigger node changes",S),x==null||x(S)}},triggerEdgeChanges:S=>{const{onEdgesChange:x,setEdges:w,edges:v,hasDefaultEdges:k,debug:E}=g();if(S!=null&&S.length){if(k){const j=b_(S,v);w(j)}E&&console.log("React Flow: trigger edge changes",S),x==null||x(S)}},addSelectedNodes:S=>{const{multiSelectionActive:x,edgeLookup:w,nodeLookup:v,triggerNodeChanges:k,triggerEdgeChanges:E}=g();if(x){const j=S.map(A=>va(A,!0));k(j);return}k(Tl(v,new Set([...S]),!0)),E(Tl(w))},addSelectedEdges:S=>{const{multiSelectionActive:x,edgeLookup:w,nodeLookup:v,triggerNodeChanges:k,triggerEdgeChanges:E}=g();if(x){const j=S.map(A=>va(A,!0));E(j);return}E(Tl(w,new Set([...S]))),k(Tl(v,new Set,!0))},unselectNodesAndEdges:({nodes:S,edges:x}={})=>{const{edges:w,nodes:v,nodeLookup:k,triggerNodeChanges:E,triggerEdgeChanges:j}=g(),A=S||v,$=x||w,I=[];for(const L of A){if(!L.selected)continue;const T=k.get(L.id);T&&(T.selected=!1),I.push(va(L.id,!1))}const F=[];for(const L of $)L.selected&&F.push(va(L.id,!1));E(I),j(F)},setMinZoom:S=>{const{panZoom:x,maxZoom:w}=g();x==null||x.setScaleExtent([S,w]),h({minZoom:S})},setMaxZoom:S=>{const{panZoom:x,minZoom:w}=g();x==null||x.setScaleExtent([w,S]),h({maxZoom:S})},setTranslateExtent:S=>{var x;(x=g().panZoom)==null||x.setTranslateExtent(S),h({translateExtent:S})},resetSelectedElements:()=>{const{edges:S,nodes:x,triggerNodeChanges:w,triggerEdgeChanges:v,elementsSelectable:k}=g();if(!k)return;const E=x.reduce((A,$)=>$.selected?[...A,va($.id,!1)]:A,[]),j=S.reduce((A,$)=>$.selected?[...A,va($.id,!1)]:A,[]);w(E),v(j)},setNodeExtent:S=>{const{nodes:x,nodeLookup:w,parentLookup:v,nodeOrigin:k,elevateNodesOnSelect:E,nodeExtent:j,zIndexMode:A}=g();S[0][0]===j[0][0]&&S[0][1]===j[0][1]&&S[1][0]===j[1][0]&&S[1][1]===j[1][1]||(xx(x,w,v,{nodeOrigin:k,nodeExtent:S,elevateNodesOnSelect:E,checkEquality:!1,zIndexMode:A}),h({nodeExtent:S}))},panBy:S=>{const{transform:x,width:w,height:v,panZoom:k,translateExtent:E}=g();return AF({delta:S,panZoom:k,transform:x,translateExtent:E,width:w,height:v})},setCenter:async(S,x,w)=>{const{width:v,height:k,maxZoom:E,panZoom:j}=g();if(!j)return Promise.resolve(!1);const A=typeof(w==null?void 0:w.zoom)<"u"?w.zoom:E;return await j.setViewport({x:v/2-S*A,y:k/2-x*A,zoom:A},{duration:w==null?void 0:w.duration,ease:w==null?void 0:w.ease,interpolate:w==null?void 0:w.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{h({connection:{...$E}})},updateConnection:S=>{h({connection:S})},reset:()=>h({...Kk()})}},Object.is);function cv({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:s,initialMinZoom:o,initialMaxZoom:l,initialFitViewOptions:c,fitView:d,nodeOrigin:u,nodeExtent:f,zIndexMode:p,children:h}){const[g]=m.useState(()=>s4({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:d,minZoom:o,maxZoom:l,fitViewOptions:c,nodeOrigin:u,nodeExtent:f,zIndexMode:p}));return a.jsx(j3,{value:g,children:a.jsx(q3,{children:h})})}function o4({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:s,height:o,fitView:l,fitViewOptions:c,minZoom:d,maxZoom:u,nodeOrigin:f,nodeExtent:p,zIndexMode:h}){return m.useContext(sm)?a.jsx(a.Fragment,{children:e}):a.jsx(cv,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:s,initialHeight:o,fitView:l,initialFitViewOptions:c,initialMinZoom:d,initialMaxZoom:u,nodeOrigin:f,nodeExtent:p,zIndexMode:h,children:e})}const a4={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function l4({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:s,edgeTypes:o,onNodeClick:l,onEdgeClick:c,onInit:d,onMove:u,onMoveStart:f,onMoveEnd:p,onConnect:h,onConnectStart:g,onConnectEnd:b,onClickConnectStart:S,onClickConnectEnd:x,onNodeMouseEnter:w,onNodeMouseMove:v,onNodeMouseLeave:k,onNodeContextMenu:E,onNodeDoubleClick:j,onNodeDragStart:A,onNodeDrag:$,onNodeDragStop:I,onNodesDelete:F,onEdgesDelete:L,onDelete:T,onSelectionChange:q,onSelectionDragStart:D,onSelectionDrag:W,onSelectionDragStop:O,onSelectionContextMenu:U,onSelectionStart:P,onSelectionEnd:R,onBeforeDelete:C,connectionMode:G,connectionLineType:J=Eo.Bezier,connectionLineStyle:B,connectionLineComponent:te,connectionLineContainerStyle:de,deleteKeyCode:ce="Backspace",selectionKeyCode:ue="Shift",selectionOnDrag:re=!1,selectionMode:ge=rd.Full,panActivationKeyCode:se="Space",multiSelectionKeyCode:pe=sd()?"Meta":"Control",zoomActivationKeyCode:ae=sd()?"Meta":"Control",snapToGrid:me,snapGrid:ze,onlyRenderVisibleElements:st=!1,selectNodesOnDrag:Ke,nodesDraggable:Ee,autoPanOnNodeFocus:It,nodesConnectable:sn,nodesFocusable:Wt,nodeOrigin:mn=w_,edgesFocusable:on,edgesReconnectable:bn,elementsSelectable:xr=!0,defaultViewport:_n=D3,minZoom:oe=.5,maxZoom:ye=2,translateExtent:Ue=nd,preventScrolling:Ge=!0,nodeExtent:Qe,defaultMarkerColor:Et="#b1b1b7",zoomOnScroll:kn=!0,zoomOnPinch:gt=!0,panOnScroll:Sn=!1,panOnScrollSpeed:On=.5,panOnScrollMode:Rt=Pa.Free,zoomOnDoubleClick:fe=!0,panOnDrag:Pe=!0,onPaneClick:Mt,onPaneMouseEnter:Mn,onPaneMouseMove:dt,onPaneMouseLeave:$n,onPaneScroll:Ci,onPaneContextMenu:an,paneClickDistance:wr=1,nodeClickDistance:ar=0,children:lr,onReconnect:fi,onReconnectStart:Zi,onReconnectEnd:cr,onEdgeContextMenu:Qn,onEdgeDoubleClick:es,onEdgeMouseEnter:Xe,onEdgeMouseMove:_t,onEdgeMouseLeave:$t,reconnectRadius:Vt=10,onNodesChange:Be,onEdgesChange:Dn,noDragClassName:Ce="nodrag",noWheelClassName:gn="nowheel",noPanClassName:vr="nopan",fitView:at,fitViewOptions:pi,connectOnClick:Vn,attributionPosition:Kn,proOptions:Xr,defaultEdgeOptions:Fn,elevateNodesOnSelect:Jr=!0,elevateEdgesOnSelect:br=!1,disableKeyboardA11y:ln=!1,autoPanOnConnect:kr,autoPanOnNodeDrag:Sr,autoPanSpeed:Qr,connectionRadius:V,isValidConnection:ve,onError:Ie,style:He,id:ft,nodeDragThreshold:Je,connectionDragThreshold:xt,viewport:nt,onViewportChange:qn,width:Ei,height:_i,colorMode:Nn="light",debug:As,onScroll:zn,ariaLabelConfig:Pi,zIndexMode:Ai="basic",...qa},Is){const Ts=ft||"1",Rs=H3(Nn),rt=m.useCallback(ts=>{ts.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),zn==null||zn(ts)},[zn]);return a.jsx("div",{"data-testid":"rf__wrapper",...qa,onScroll:rt,style:{...He,...a4},ref:Is,className:Ln(["react-flow",i,Rs]),id:ft,role:"application",children:a.jsxs(o4,{nodes:e,edges:t,width:Ei,height:_i,fitView:at,fitViewOptions:pi,minZoom:oe,maxZoom:ye,nodeOrigin:mn,nodeExtent:Qe,zIndexMode:Ai,children:[a.jsx(B3,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:g,onConnectEnd:b,onClickConnectStart:S,onClickConnectEnd:x,nodesDraggable:Ee,autoPanOnNodeFocus:It,nodesConnectable:sn,nodesFocusable:Wt,edgesFocusable:on,edgesReconnectable:bn,elementsSelectable:xr,elevateNodesOnSelect:Jr,elevateEdgesOnSelect:br,minZoom:oe,maxZoom:ye,nodeExtent:Qe,onNodesChange:Be,onEdgesChange:Dn,snapToGrid:me,snapGrid:ze,connectionMode:G,translateExtent:Ue,connectOnClick:Vn,defaultEdgeOptions:Fn,fitView:at,fitViewOptions:pi,onNodesDelete:F,onEdgesDelete:L,onDelete:T,onNodeDragStart:A,onNodeDrag:$,onNodeDragStop:I,onSelectionDrag:W,onSelectionDragStart:D,onSelectionDragStop:O,onMove:u,onMoveStart:f,onMoveEnd:p,noPanClassName:vr,nodeOrigin:mn,rfId:Ts,autoPanOnConnect:kr,autoPanOnNodeDrag:Sr,autoPanSpeed:Qr,onError:Ie,connectionRadius:V,isValidConnection:ve,selectNodesOnDrag:Ke,nodeDragThreshold:Je,connectionDragThreshold:xt,onBeforeDelete:C,debug:As,ariaLabelConfig:Pi,zIndexMode:Ai}),a.jsx(i4,{onInit:d,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:w,onNodeMouseMove:v,onNodeMouseLeave:k,onNodeContextMenu:E,onNodeDoubleClick:j,nodeTypes:s,edgeTypes:o,connectionLineType:J,connectionLineStyle:B,connectionLineComponent:te,connectionLineContainerStyle:de,selectionKeyCode:ue,selectionOnDrag:re,selectionMode:ge,deleteKeyCode:ce,multiSelectionKeyCode:pe,panActivationKeyCode:se,zoomActivationKeyCode:ae,onlyRenderVisibleElements:st,defaultViewport:_n,translateExtent:Ue,minZoom:oe,maxZoom:ye,preventScrolling:Ge,zoomOnScroll:kn,zoomOnPinch:gt,zoomOnDoubleClick:fe,panOnScroll:Sn,panOnScrollSpeed:On,panOnScrollMode:Rt,panOnDrag:Pe,onPaneClick:Mt,onPaneMouseEnter:Mn,onPaneMouseMove:dt,onPaneMouseLeave:$n,onPaneScroll:Ci,onPaneContextMenu:an,paneClickDistance:wr,nodeClickDistance:ar,onSelectionContextMenu:U,onSelectionStart:P,onSelectionEnd:R,onReconnect:fi,onReconnectStart:Zi,onReconnectEnd:cr,onEdgeContextMenu:Qn,onEdgeDoubleClick:es,onEdgeMouseEnter:Xe,onEdgeMouseMove:_t,onEdgeMouseLeave:$t,reconnectRadius:Vt,defaultMarkerColor:Et,noDragClassName:Ce,noWheelClassName:gn,noPanClassName:vr,rfId:Ts,disableKeyboardA11y:ln,nodeExtent:Qe,viewport:nt,onViewportChange:qn}),a.jsx($3,{onSelectionChange:q}),lr,a.jsx(T3,{proOptions:Xr,position:Kn}),a.jsx(I3,{rfId:Ts,disableKeyboardA11y:ln})]})})}var K_=k_(l4);function q_(){const e=Xt();return m.useCallback(t=>{const{domNode:n,updateNodeInternals:r}=e.getState(),i=Array.isArray(t)?t:[t],s=new Map;i.forEach(o=>{const l=n==null?void 0:n.querySelector(`.react-flow__node[data-id="${o}"]`);l&&s.set(o,{id:o,nodeElement:l,force:!0})}),requestAnimationFrame(()=>r(s,{triggerFitView:!1}))},[])}function Y_(e){const[t,n]=m.useState(e),r=m.useCallback(i=>n(s=>av(i,s)),[]);return[t,n,r]}function G_(e){const[t,n]=m.useState(e),r=m.useCallback(i=>n(s=>b_(i,s)),[]);return[t,n,r]}function c4({dimensions:e,lineWidth:t,variant:n,className:r}){return a.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Ln(["react-flow__background-pattern",n,r])})}function u4({radius:e,className:t}){return a.jsx("circle",{cx:e,cy:e,r:e,className:Ln(["react-flow__background-pattern","dots",t])})}var Bo;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Bo||(Bo={}));const d4={[Bo.Dots]:1,[Bo.Lines]:1,[Bo.Cross]:6},f4=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function X_({id:e,variant:t=Bo.Dots,gap:n=20,size:r,lineWidth:i=1,offset:s=0,color:o,bgColor:l,style:c,className:d,patternClassName:u}){const f=m.useRef(null),{transform:p,patternId:h}=kt(f4,rn),g=r||d4[t],b=t===Bo.Dots,S=t===Bo.Cross,x=Array.isArray(n)?n:[n,n],w=[x[0]*p[2]||1,x[1]*p[2]||1],v=g*p[2],k=Array.isArray(s)?s:[s,s],E=S?[v,v]:w,j=[k[0]*p[2]||1+E[0]/2,k[1]*p[2]||1+E[1]/2],A=`${h}${e||""}`;return a.jsxs("svg",{className:Ln(["react-flow__background",d]),style:{...c,...om,"--xy-background-color-props":l,"--xy-background-pattern-color-props":o},ref:f,"data-testid":"rf__background",children:[a.jsx("pattern",{id:A,x:p[0]%w[0],y:p[1]%w[1],width:w[0],height:w[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${j[0]},-${j[1]})`,children:b?a.jsx(u4,{radius:v/2,className:u}):a.jsx(c4,{dimensions:E,lineWidth:i,variant:t,className:u})}),a.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${A})`})]})}X_.displayName="Background";const J_=m.memo(X_);function p4(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:a.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function h4(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:a.jsx("path",{d:"M0 0h32v4.2H0z"})})}function m4(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:a.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 g4(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:a.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 y4(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:a.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 Kf({children:e,className:t,...n}){return a.jsx("button",{type:"button",className:Ln(["react-flow__controls-button",t]),...n,children:e})}const x4=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Q_({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:s,onZoomOut:o,onFitView:l,onInteractiveChange:c,className:d,children:u,position:f="bottom-left",orientation:p="vertical","aria-label":h}){const g=Xt(),{isInteractive:b,minZoomReached:S,maxZoomReached:x,ariaLabelConfig:w}=kt(x4,rn),{zoomIn:v,zoomOut:k,fitView:E}=Va(),j=()=>{v(),s==null||s()},A=()=>{k(),o==null||o()},$=()=>{E(i),l==null||l()},I=()=>{g.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),c==null||c(!b)},F=p==="horizontal"?"horizontal":"vertical";return a.jsxs(cc,{className:Ln(["react-flow__controls",F,d]),position:f,style:e,"data-testid":"rf__controls","aria-label":h??w["controls.ariaLabel"],children:[t&&a.jsxs(a.Fragment,{children:[a.jsx(Kf,{onClick:j,className:"react-flow__controls-zoomin",title:w["controls.zoomIn.ariaLabel"],"aria-label":w["controls.zoomIn.ariaLabel"],disabled:x,children:a.jsx(p4,{})}),a.jsx(Kf,{onClick:A,className:"react-flow__controls-zoomout",title:w["controls.zoomOut.ariaLabel"],"aria-label":w["controls.zoomOut.ariaLabel"],disabled:S,children:a.jsx(h4,{})})]}),n&&a.jsx(Kf,{className:"react-flow__controls-fitview",onClick:$,title:w["controls.fitView.ariaLabel"],"aria-label":w["controls.fitView.ariaLabel"],children:a.jsx(m4,{})}),r&&a.jsx(Kf,{className:"react-flow__controls-interactive",onClick:I,title:w["controls.interactive.ariaLabel"],"aria-label":w["controls.interactive.ariaLabel"],children:b?a.jsx(y4,{}):a.jsx(g4,{})}),u]})}Q_.displayName="Controls";const w4=m.memo(Q_);function v4({id:e,x:t,y:n,width:r,height:i,style:s,color:o,strokeColor:l,strokeWidth:c,className:d,borderRadius:u,shapeRendering:f,selected:p,onClick:h}){const{background:g,backgroundColor:b}=s||{},S=o||g||b;return a.jsx("rect",{className:Ln(["react-flow__minimap-node",{selected:p},d]),x:t,y:n,rx:u,ry:u,width:r,height:i,style:{fill:S,stroke:l,strokeWidth:c},shapeRendering:f,onClick:h?x=>h(x,e):void 0})}const b4=m.memo(v4),k4=e=>e.nodes.map(t=>t.id),Pg=e=>e instanceof Function?e:()=>e;function S4({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:s=b4,onClick:o}){const l=kt(k4,rn),c=Pg(t),d=Pg(e),u=Pg(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return a.jsx(a.Fragment,{children:l.map(p=>a.jsx(j4,{id:p,nodeColorFunc:c,nodeStrokeColorFunc:d,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:s,onClick:o,shapeRendering:f},p))})}function N4({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:s,shapeRendering:o,NodeComponent:l,onClick:c}){const{node:d,x:u,y:f,width:p,height:h}=kt(g=>{const b=g.nodeLookup.get(e);if(!b)return{node:void 0,x:0,y:0,width:0,height:0};const S=b.internals.userNode,{x,y:w}=b.internals.positionAbsolute,{width:v,height:k}=ro(S);return{node:S,x,y:w,width:v,height:k}},rn);return!d||d.hidden||!WE(d)?null:a.jsx(l,{x:u,y:f,width:p,height:h,style:d.style,selected:!!d.selected,className:r(d),color:t(d),borderRadius:i,strokeColor:n(d),strokeWidth:s,shapeRendering:o,onClick:c,id:d.id})}const j4=m.memo(N4);var C4=m.memo(S4);const E4=200,_4=150,P4=e=>!e.hidden,A4=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?UE(Pd(e.nodeLookup,{filter:P4}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},I4="react-flow__minimap-desc";function Z_({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i="",nodeBorderRadius:s=5,nodeStrokeWidth:o,nodeComponent:l,bgColor:c,maskColor:d,maskStrokeColor:u,maskStrokeWidth:f,position:p="bottom-right",onClick:h,onNodeClick:g,pannable:b=!1,zoomable:S=!1,ariaLabel:x,inversePan:w,zoomStep:v=1,offsetScale:k=5}){const E=Xt(),j=m.useRef(null),{boundingRect:A,viewBB:$,rfId:I,panZoom:F,translateExtent:L,flowWidth:T,flowHeight:q,ariaLabelConfig:D}=kt(A4,rn),W=(e==null?void 0:e.width)??E4,O=(e==null?void 0:e.height)??_4,U=A.width/W,P=A.height/O,R=Math.max(U,P),C=R*W,G=R*O,J=k*R,B=A.x-(C-A.width)/2-J,te=A.y-(G-A.height)/2-J,de=C+J*2,ce=G+J*2,ue=`${I4}-${I}`,re=m.useRef(0),ge=m.useRef();re.current=R,m.useEffect(()=>{if(j.current&&F)return ge.current=FF({domNode:j.current,panZoom:F,getTransform:()=>E.getState().transform,getViewScale:()=>re.current}),()=>{var me;(me=ge.current)==null||me.destroy()}},[F]),m.useEffect(()=>{var me;(me=ge.current)==null||me.update({translateExtent:L,width:T,height:q,inversePan:w,pannable:b,zoomStep:v,zoomable:S})},[b,S,w,v,L,T,q]);const se=h?me=>{var Ke;const[ze,st]=((Ke=ge.current)==null?void 0:Ke.pointer(me))||[0,0];h(me,{x:ze,y:st})}:void 0,pe=g?m.useCallback((me,ze)=>{const st=E.getState().nodeLookup.get(ze).internals.userNode;g(me,st)},[]):void 0,ae=x??D["minimap.ariaLabel"];return a.jsx(cc,{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 u=="string"?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*R: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 o=="number"?o:void 0},className:Ln(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:a.jsxs("svg",{width:W,height:O,viewBox:`${B} ${te} ${de} ${ce}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ue,ref:j,onClick:se,children:[ae&&a.jsx("title",{id:ue,children:ae}),a.jsx(C4,{onClick:pe,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:l}),a.jsx("path",{className:"react-flow__minimap-mask",d:`M${B-J},${te-J}h${de+J*2}v${ce+J*2}h${-de-J*2}z
|
|
66
|
-
M${$.x},${$.y}h${$.width}v${$.height}h${-$.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Z_.displayName="MiniMap";const T4=m.memo(Z_),R4=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,L4={[ac.Line]:"right",[ac.Handle]:"bottom-right"};function O4({nodeId:e,position:t,variant:n=ac.Handle,className:r,style:i=void 0,children:s,color:o,minWidth:l=10,minHeight:c=10,maxWidth:d=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:p,autoScale:h=!0,shouldResize:g,onResizeStart:b,onResize:S,onResizeEnd:x}){const w=C_(),v=typeof e=="string"?e:w,k=Xt(),E=m.useRef(null),j=n===ac.Handle,A=kt(m.useCallback(R4(j&&h),[j,h]),rn),$=m.useRef(null),I=t??L4[n];m.useEffect(()=>{if(!(!E.current||!v))return $.current||($.current=ZF({domNode:E.current,nodeId:v,getStoreItems:()=>{const{nodeLookup:L,transform:T,snapGrid:q,snapToGrid:D,nodeOrigin:W,domNode:O}=k.getState();return{nodeLookup:L,transform:T,snapGrid:q,snapToGrid:D,nodeOrigin:W,paneDomNode:O}},onChange:(L,T)=>{const{triggerNodeChanges:q,nodeLookup:D,parentLookup:W,nodeOrigin:O}=k.getState(),U=[],P={x:L.x,y:L.y},R=D.get(v);if(R&&R.expandParent&&R.parentId){const C=R.origin??O,G=L.width??R.measured.width??0,J=L.height??R.measured.height??0,B={id:R.id,parentId:R.parentId,rect:{width:G,height:J,...VE({x:L.x??R.position.x,y:L.y??R.position.y},{width:G,height:J},R.parentId,D,C)}},te=ov([B],D,W,O);U.push(...te),P.x=L.x?Math.max(C[0]*G,L.x):void 0,P.y=L.y?Math.max(C[1]*J,L.y):void 0}if(P.x!==void 0&&P.y!==void 0){const C={id:v,type:"position",position:{...P}};U.push(C)}if(L.width!==void 0&&L.height!==void 0){const G={id:v,type:"dimensions",resizing:!0,setAttributes:p?p==="horizontal"?"width":"height":!0,dimensions:{width:L.width,height:L.height}};U.push(G)}for(const C of T){const G={...C,type:"position"};U.push(G)}q(U)},onEnd:({width:L,height:T})=>{const q={id:v,type:"dimensions",resizing:!1,dimensions:{width:L,height:T}};k.getState().triggerNodeChanges([q])}})),$.current.update({controlPosition:I,boundaries:{minWidth:l,minHeight:c,maxWidth:d,maxHeight:u},keepAspectRatio:f,resizeDirection:p,onResizeStart:b,onResize:S,onResizeEnd:x,shouldResize:g}),()=>{var L;(L=$.current)==null||L.destroy()}},[I,l,c,d,u,f,b,S,x,g]);const F=I.split("-");return a.jsx("div",{className:Ln(["react-flow__resize-control","nodrag",...F,n,r]),ref:E,style:{...i,scale:A,...o&&{[j?"backgroundColor":"borderColor"]:o}},children:s})}const M4=m.memo(O4);function $4(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const D4=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,F4=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,z4={};function qk(e,t){return(z4.jsx?F4:D4).test(e)}const B4=/[ \t\n\f\r]/g;function H4(e){return typeof e=="object"?e.type==="text"?Yk(e.value):!1:Yk(e)}function Yk(e){return e.replace(B4,"")===""}let Td=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};Td.prototype.normal={};Td.prototype.property={};Td.prototype.space=void 0;function eP(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Td(n,r,t)}function kx(e){return e.toLowerCase()}class Gr{constructor(t,n){this.attribute=n,this.property=t}}Gr.prototype.attribute="";Gr.prototype.booleanish=!1;Gr.prototype.boolean=!1;Gr.prototype.commaOrSpaceSeparated=!1;Gr.prototype.commaSeparated=!1;Gr.prototype.defined=!1;Gr.prototype.mustUseProperty=!1;Gr.prototype.number=!1;Gr.prototype.overloadedBoolean=!1;Gr.prototype.property="";Gr.prototype.spaceSeparated=!1;Gr.prototype.space=void 0;let U4=0;const ct=Ka(),An=Ka(),Sx=Ka(),Se=Ka(),zt=Ka(),Vl=Ka(),ei=Ka();function Ka(){return 2**++U4}const Nx=Object.freeze(Object.defineProperty({__proto__:null,boolean:ct,booleanish:An,commaOrSpaceSeparated:ei,commaSeparated:Vl,number:Se,overloadedBoolean:Sx,spaceSeparated:zt},Symbol.toStringTag,{value:"Module"})),Ag=Object.keys(Nx);class uv extends Gr{constructor(t,n,r,i){let s=-1;if(super(t,n),Gk(this,"space",i),typeof r=="number")for(;++s<Ag.length;){const o=Ag[s];Gk(this,Ag[s],(r&Nx[o])===Nx[o])}}}uv.prototype.defined=!0;function Gk(e,t,n){n&&(e[t]=n)}function xc(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new uv(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[kx(r)]=r,n[kx(s.attribute)]=r}return new Td(t,n,e.space)}const tP=xc({properties:{ariaActiveDescendant:null,ariaAtomic:An,ariaAutoComplete:null,ariaBusy:An,ariaChecked:An,ariaColCount:Se,ariaColIndex:Se,ariaColSpan:Se,ariaControls:zt,ariaCurrent:null,ariaDescribedBy:zt,ariaDetails:null,ariaDisabled:An,ariaDropEffect:zt,ariaErrorMessage:null,ariaExpanded:An,ariaFlowTo:zt,ariaGrabbed:An,ariaHasPopup:null,ariaHidden:An,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:zt,ariaLevel:Se,ariaLive:null,ariaModal:An,ariaMultiLine:An,ariaMultiSelectable:An,ariaOrientation:null,ariaOwns:zt,ariaPlaceholder:null,ariaPosInSet:Se,ariaPressed:An,ariaReadOnly:An,ariaRelevant:null,ariaRequired:An,ariaRoleDescription:zt,ariaRowCount:Se,ariaRowIndex:Se,ariaRowSpan:Se,ariaSelected:An,ariaSetSize:Se,ariaSort:null,ariaValueMax:Se,ariaValueMin:Se,ariaValueNow:Se,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function nP(e,t){return t in e?e[t]:t}function rP(e,t){return nP(e,t.toLowerCase())}const W4=xc({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Vl,acceptCharset:zt,accessKey:zt,action:null,allow:null,allowFullScreen:ct,allowPaymentRequest:ct,allowUserMedia:ct,alt:null,as:null,async:ct,autoCapitalize:null,autoComplete:zt,autoFocus:ct,autoPlay:ct,blocking:zt,capture:null,charSet:null,checked:ct,cite:null,className:zt,cols:Se,colSpan:null,content:null,contentEditable:An,controls:ct,controlsList:zt,coords:Se|Vl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ct,defer:ct,dir:null,dirName:null,disabled:ct,download:Sx,draggable:An,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ct,formTarget:null,headers:zt,height:Se,hidden:Sx,high:Se,href:null,hrefLang:null,htmlFor:zt,httpEquiv:zt,id:null,imageSizes:null,imageSrcSet:null,inert:ct,inputMode:null,integrity:null,is:null,isMap:ct,itemId:null,itemProp:zt,itemRef:zt,itemScope:ct,itemType:zt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ct,low:Se,manifest:null,max:null,maxLength:Se,media:null,method:null,min:null,minLength:Se,multiple:ct,muted:ct,name:null,nonce:null,noModule:ct,noValidate:ct,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:ct,optimum:Se,pattern:null,ping:zt,placeholder:null,playsInline:ct,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ct,referrerPolicy:null,rel:zt,required:ct,reversed:ct,rows:Se,rowSpan:Se,sandbox:zt,scope:null,scoped:ct,seamless:ct,selected:ct,shadowRootClonable:ct,shadowRootDelegatesFocus:ct,shadowRootMode:null,shape:null,size:Se,sizes:null,slot:null,span:Se,spellCheck:An,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Se,step:null,style:null,tabIndex:Se,target:null,title:null,translate:null,type:null,typeMustMatch:ct,useMap:null,value:An,width:Se,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:zt,axis:null,background:null,bgColor:null,border:Se,borderColor:null,bottomMargin:Se,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ct,declare:ct,event:null,face:null,frame:null,frameBorder:null,hSpace:Se,leftMargin:Se,link:null,longDesc:null,lowSrc:null,marginHeight:Se,marginWidth:Se,noResize:ct,noHref:ct,noShade:ct,noWrap:ct,object:null,profile:null,prompt:null,rev:null,rightMargin:Se,rules:null,scheme:null,scrolling:An,standby:null,summary:null,text:null,topMargin:Se,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Se,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ct,disableRemotePlayback:ct,prefix:null,property:null,results:Se,security:null,unselectable:null},space:"html",transform:rP}),V4=xc({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:ei,accentHeight:Se,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Se,amplitude:Se,arabicForm:null,ascent:Se,attributeName:null,attributeType:null,azimuth:Se,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Se,by:null,calcMode:null,capHeight:Se,className:zt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Se,diffuseConstant:Se,direction:null,display:null,dur:null,divisor:Se,dominantBaseline:null,download:ct,dx:null,dy:null,edgeMode:null,editable:null,elevation:Se,enableBackground:null,end:null,event:null,exponent:Se,externalResourcesRequired:null,fill:null,fillOpacity:Se,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:Vl,g2:Vl,glyphName:Vl,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Se,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Se,horizOriginX:Se,horizOriginY:Se,id:null,ideographic:Se,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Se,k:Se,k1:Se,k2:Se,k3:Se,k4:Se,kernelMatrix:ei,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Se,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:Se,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:Se,overlineThickness:Se,paintOrder:null,panose1:null,path:null,pathLength:Se,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:zt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Se,pointsAtY:Se,pointsAtZ:Se,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ei,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ei,rev:ei,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ei,requiredFeatures:ei,requiredFonts:ei,requiredFormats:ei,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:Se,specularExponent:Se,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Se,strikethroughThickness:Se,string:null,stroke:null,strokeDashArray:ei,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Se,strokeOpacity:Se,strokeWidth:null,style:null,surfaceScale:Se,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ei,tabIndex:Se,tableValues:null,target:null,targetX:Se,targetY:Se,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ei,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Se,underlineThickness:Se,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Se,values:null,vAlphabetic:Se,vMathematical:Se,vectorEffect:null,vHanging:Se,vIdeographic:Se,version:null,vertAdvY:Se,vertOriginX:Se,vertOriginY:Se,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Se,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:nP}),iP=xc({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()}}),sP=xc({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:rP}),oP=xc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),K4={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"},q4=/[A-Z]/g,Xk=/-[a-z]/g,Y4=/^data[-\w.:]+$/i;function G4(e,t){const n=kx(t);let r=t,i=Gr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Y4.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(Xk,J4);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!Xk.test(s)){let o=s.replace(q4,X4);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=uv}return new i(r,t)}function X4(e){return"-"+e.toLowerCase()}function J4(e){return e.charAt(1).toUpperCase()}const Q4=eP([tP,W4,iP,sP,oP],"html"),dv=eP([tP,V4,iP,sP,oP],"svg");function Z4(e){return e.join(" ").trim()}var fv={},Jk=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,eB=/\n/g,tB=/^\s*/,nB=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,rB=/^:\s*/,iB=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,sB=/^[;\s]*/,oB=/^\s+|\s+$/g,aB=`
|
|
67
|
-
`,Qk="/",Zk="*",ba="",lB="comment",cB="declaration";function uB(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 i(g){var b=g.match(eB);b&&(n+=b.length);var S=g.lastIndexOf(aB);r=~S?g.length-S:r+g.length}function s(){var g={line:n,column:r};return function(b){return b.position=new o(g),d(),b}}function o(g){this.start=g,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function l(g){var b=new Error(t.source+":"+n+":"+r+": "+g);if(b.reason=g,b.filename=t.source,b.line=n,b.column=r,b.source=e,!t.silent)throw b}function c(g){var b=g.exec(e);if(b){var S=b[0];return i(S),e=e.slice(S.length),b}}function d(){c(tB)}function u(g){var b;for(g=g||[];b=f();)b!==!1&&g.push(b);return g}function f(){var g=s();if(!(Qk!=e.charAt(0)||Zk!=e.charAt(1))){for(var b=2;ba!=e.charAt(b)&&(Zk!=e.charAt(b)||Qk!=e.charAt(b+1));)++b;if(b+=2,ba===e.charAt(b-1))return l("End of comment missing");var S=e.slice(2,b-2);return r+=2,i(S),e=e.slice(b),r+=2,g({type:lB,comment:S})}}function p(){var g=s(),b=c(nB);if(b){if(f(),!c(rB))return l("property missing ':'");var S=c(iB),x=g({type:cB,property:eS(b[0].replace(Jk,ba)),value:S?eS(S[0].replace(Jk,ba)):ba});return c(sB),x}}function h(){var g=[];u(g);for(var b;b=p();)b!==!1&&(g.push(b),u(g));return g}return d(),h()}function eS(e){return e?e.replace(oB,ba):ba}var dB=uB,fB=Lu&&Lu.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(fv,"__esModule",{value:!0});fv.default=hB;const pB=fB(dB);function hB(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,pB.default)(e),i=typeof t=="function";return r.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:l}=s;i?t(o,l,s):l&&(n=n||{},n[o]=l)}),n}var lm={};Object.defineProperty(lm,"__esModule",{value:!0});lm.camelCase=void 0;var mB=/^--[a-zA-Z0-9_-]+$/,gB=/-([a-z])/g,yB=/^[^-]+$/,xB=/^-(webkit|moz|ms|o|khtml)-/,wB=/^-(ms)-/,vB=function(e){return!e||yB.test(e)||mB.test(e)},bB=function(e,t){return t.toUpperCase()},tS=function(e,t){return"".concat(t,"-")},kB=function(e,t){return t===void 0&&(t={}),vB(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(wB,tS):e=e.replace(xB,tS),e.replace(gB,bB))};lm.camelCase=kB;var SB=Lu&&Lu.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},NB=SB(fv),jB=lm;function jx(e,t){var n={};return!e||typeof e!="string"||(0,NB.default)(e,function(r,i){r&&i&&(n[(0,jB.camelCase)(r,t)]=i)}),n}jx.default=jx;var CB=jx;const EB=Xo(CB),aP=lP("end"),pv=lP("start");function lP(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=pv(e),n=aP(e);if(t&&n)return{start:t,end:n}}function Pu(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?nS(e.position):"start"in e||"end"in e?nS(e):"line"in e||"column"in e?Cx(e):""}function Cx(e){return rS(e&&e.line)+":"+rS(e&&e.column)}function nS(e){return Cx(e&&e.start)+"-"+Cx(e&&e.end)}function rS(e){return e&&typeof e=="number"?e:1}class gr extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(o=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?s.ruleId=r:(s.source=r.slice(0,c),s.ruleId=r.slice(c+1))}if(!s.place&&s.ancestors&&s.ancestors){const c=s.ancestors[s.ancestors.length-1];c&&(s.place=c.position)}const l=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=l?l.line:void 0,this.name=Pu(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}gr.prototype.file="";gr.prototype.name="";gr.prototype.reason="";gr.prototype.message="";gr.prototype.stack="";gr.prototype.column=void 0;gr.prototype.line=void 0;gr.prototype.ancestors=void 0;gr.prototype.cause=void 0;gr.prototype.fatal=void 0;gr.prototype.place=void 0;gr.prototype.ruleId=void 0;gr.prototype.source=void 0;const hv={}.hasOwnProperty,PB=new Map,AB=/[A-Z]/g,IB=new Set(["table","tbody","thead","tfoot","tr"]),TB=new Set(["td","th"]),cP="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function RB(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=BB(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=zB(n,t.jsx,t.jsxs)}const i={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"?dv:Q4,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=uP(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function uP(e,t,n){if(t.type==="element")return LB(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return OB(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return $B(e,t,n);if(t.type==="mdxjsEsm")return MB(e,t);if(t.type==="root")return DB(e,t,n);if(t.type==="text")return FB(e,t)}function LB(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=dv,e.schema=i),e.ancestors.push(t);const s=fP(e,t.tagName,!1),o=HB(e,t);let l=gv(e,t);return IB.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!H4(c):!0})),dP(e,o,s,t),mv(o,l),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function OB(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)}ld(e,t.position)}function MB(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ld(e,t.position)}function $B(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=dv,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:fP(e,t.name,!0),o=UB(e,t),l=gv(e,t);return dP(e,o,s,t),mv(o,l),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function DB(e,t,n){const r={};return mv(r,gv(e,t)),e.create(t,e.Fragment,r,n)}function FB(e,t){return t.value}function dP(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function mv(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function zB(e,t,n){return r;function r(i,s,o,l){const d=Array.isArray(o.children)?n:t;return l?d(s,o,l):d(s,o)}}function BB(e,t){return n;function n(r,i,s,o){const l=Array.isArray(s.children),c=pv(r);return t(i,s,o,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function HB(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&hv.call(t.properties,i)){const s=WB(e,i,t.properties[i]);if(s){const[o,l]=s;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&TB.has(t.tagName)?r=l:n[o]=l}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function UB(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const o=s.expression;o.type;const l=o.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else ld(e,t.position);else{const i=r.name;let s;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,s=e.evaluater.evaluateExpression(l.expression)}else ld(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function gv(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:PB;for(;++r<t.children.length;){const s=t.children[r];let o;if(e.passKeys){const c=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(c){const d=i.get(c)||0;o=c+"-"+d,i.set(c,d+1)}}const l=uP(e,s,o);l!==void 0&&n.push(l)}return n}function WB(e,t,n){const r=G4(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?$4(n):Z4(n)),r.property==="style"){let i=typeof n=="object"?n:VB(e,String(n));return e.stylePropertyNameCase==="css"&&(i=KB(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?K4[r.property]||r.property:r.attribute,n]}}function VB(e,t){try{return EB(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new gr("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=cP+"#cannot-parse-style-attribute",i}}function fP(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let s=-1,o;for(;++s<i.length;){const l=qk(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(s&&l.type==="Literal"),optional:!1}:l}r=o}else r=qk(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return hv.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);ld(e)}function ld(e,t){const n=new gr("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=cP+"#cannot-handle-mdx-estrees-without-createevaluater",n}function KB(e){const t={};let n;for(n in e)hv.call(e,n)&&(t[qB(n)]=e[n]);return t}function qB(e){let t=e.replace(AB,YB);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function YB(e){return"-"+e.toLowerCase()}const Ig={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"]},GB={};function XB(e,t){const n=GB,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return pP(e,r,i)}function pP(e,t,n){if(JB(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 iS(e.children,t,n)}return Array.isArray(e)?iS(e,t,n):""}function iS(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=pP(e[i],t,n);return r.join("")}function JB(e){return!!(e&&typeof e=="object")}const sS=document.createElement("i");function yv(e){const t="&"+e+";";sS.innerHTML=t;const n=sS.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Es(e,t,n,r){const i=e.length;let s=0,o;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);s<r.length;)o=r.slice(s,s+1e4),o.unshift(t,0),e.splice(...o),s+=1e4,t+=1e4}function wi(e,t){return e.length>0?(Es(e,e.length,0,t),e):t}const oS={}.hasOwnProperty;function QB(e){const t={};let n=-1;for(;++n<e.length;)ZB(t,e[n]);return t}function ZB(e,t){let n;for(n in t){const i=(oS.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let o;if(s)for(o in s){oS.call(i,o)||(i[o]=[]);const l=s[o];e5(i[o],Array.isArray(l)?l:l?[l]:[])}}}function e5(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Es(e,0,0,r)}function hP(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 Kl(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const xs=ea(/[A-Za-z]/),si=ea(/[\dA-Za-z]/),t5=ea(/[#-'*+\--9=?A-Z^-~]/);function Ex(e){return e!==null&&(e<32||e===127)}const _x=ea(/\d/),n5=ea(/[\dA-Fa-f]/),r5=ea(/[!-/:-@[-`{-~]/);function tt(e){return e!==null&&e<-2}function Yr(e){return e!==null&&(e<0||e===32)}function Pt(e){return e===-2||e===-1||e===32}const i5=ea(new RegExp("\\p{P}|\\p{S}","u")),s5=ea(/\s/);function ea(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function wc(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const s=e.charCodeAt(n);let o="";if(s===37&&si(e.charCodeAt(n+1))&&si(e.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const l=e.charCodeAt(n+1);s<56320&&l>56319&&l<57344?(o=String.fromCharCode(s,l),i=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function Ht(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(c){return Pt(c)?(e.enter(n),l(c)):t(c)}function l(c){return Pt(c)&&s++<i?(e.consume(c),l):(e.exit(n),t(c))}}const o5={tokenize:a5};function a5(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Ht(e,t,"linePrefix")}function i(l){return e.enter("paragraph"),s(l)}function s(l){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,o(l)}function o(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return tt(l)?(e.consume(l),e.exit("chunkText"),s):(e.consume(l),o)}}const l5={tokenize:c5},aS={tokenize:u5};function c5(e){const t=this,n=[];let r=0,i,s,o;return l;function l(v){if(r<n.length){const k=n[r];return t.containerState=k[1],e.attempt(k[0].continuation,c,d)(v)}return d(v)}function c(v){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&w();const k=t.events.length;let E=k,j;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){j=t.events[E][1].end;break}x(r);let A=k;for(;A<t.events.length;)t.events[A][1].end={...j},A++;return Es(t.events,E+1,0,t.events.slice(k)),t.events.length=A,d(v)}return l(v)}function d(v){if(r===n.length){if(!i)return p(v);if(i.currentConstruct&&i.currentConstruct.concrete)return g(v);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(aS,u,f)(v)}function u(v){return i&&w(),x(r),p(v)}function f(v){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,g(v)}function p(v){return t.containerState={},e.attempt(aS,h,g)(v)}function h(v){return r++,n.push([t.currentConstruct,t.containerState]),p(v)}function g(v){if(v===null){i&&w(),x(0),e.consume(v);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),b(v)}function b(v){if(v===null){S(e.exit("chunkFlow"),!0),x(0),e.consume(v);return}return tt(v)?(e.consume(v),S(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(v),b)}function S(v,k){const E=t.sliceStream(v);if(k&&E.push(null),v.previous=s,s&&(s.next=v),s=v,i.defineSkip(v.start),i.write(E),t.parser.lazy[v.start.line]){let j=i.events.length;for(;j--;)if(i.events[j][1].start.offset<o&&(!i.events[j][1].end||i.events[j][1].end.offset>o))return;const A=t.events.length;let $=A,I,F;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){if(I){F=t.events[$][1].end;break}I=!0}for(x(r),j=A;j<t.events.length;)t.events[j][1].end={...F},j++;Es(t.events,$+1,0,t.events.slice(A)),t.events.length=j}}function x(v){let k=n.length;for(;k-- >v;){const E=n[k];t.containerState=E[1],E[0].exit.call(t,e)}n.length=v}function w(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function u5(e,t,n){return Ht(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function lS(e){if(e===null||Yr(e)||s5(e))return 1;if(i5(e))return 2}function xv(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const s=e[i].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const Px={name:"attention",resolveAll:d5,tokenize:f5};function d5(e,t){let n=-1,r,i,s,o,l,c,d,u;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[r][1].end},p={...e[n][1].start};cS(f,-c),cS(p,c),o={type:c>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},s={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[r][1].end={...o.start},e[n][1].start={...l.end},d=[],e[r][1].end.offset-e[r][1].start.offset&&(d=wi(d,[["enter",e[r][1],t],["exit",e[r][1],t]])),d=wi(d,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),d=wi(d,xv(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),d=wi(d,[["exit",s,t],["enter",l,t],["exit",l,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,d=wi(d,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,Es(e,r-1,n-r+3,d),n=r+d.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function f5(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=lS(r);let s;return o;function o(c){return s=c,e.enter("attentionSequence"),l(c)}function l(c){if(c===s)return e.consume(c),l;const d=e.exit("attentionSequence"),u=lS(c),f=!u||u===2&&i||n.includes(c),p=!i||i===2&&u||n.includes(r);return d._open=!!(s===42?f:f&&(i||!p)),d._close=!!(s===42?p:p&&(u||!f)),t(c)}}function cS(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const p5={name:"autolink",tokenize:h5};function h5(e,t,n){let r=0;return i;function i(h){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(h){return xs(h)?(e.consume(h),o):h===64?n(h):d(h)}function o(h){return h===43||h===45||h===46||si(h)?(r=1,l(h)):d(h)}function l(h){return h===58?(e.consume(h),r=0,c):(h===43||h===45||h===46||si(h))&&r++<32?(e.consume(h),l):(r=0,d(h))}function c(h){return h===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):h===null||h===32||h===60||Ex(h)?n(h):(e.consume(h),c)}function d(h){return h===64?(e.consume(h),u):t5(h)?(e.consume(h),d):n(h)}function u(h){return si(h)?f(h):n(h)}function f(h){return h===46?(e.consume(h),r=0,u):h===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):p(h)}function p(h){if((h===45||si(h))&&r++<63){const g=h===45?p:f;return e.consume(h),g}return n(h)}}const cm={partial:!0,tokenize:m5};function m5(e,t,n){return r;function r(s){return Pt(s)?Ht(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||tt(s)?t(s):n(s)}}const mP={continuation:{tokenize:y5},exit:x5,name:"blockQuote",tokenize:g5};function g5(e,t,n){const r=this;return i;function i(o){if(o===62){const l=r.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),s}return n(o)}function s(o){return Pt(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function y5(e,t,n){const r=this;return i;function i(o){return Pt(o)?Ht(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return e.attempt(mP,t,n)(o)}}function x5(e){e.exit("blockQuote")}const gP={name:"characterEscape",tokenize:w5};function w5(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),i}function i(s){return r5(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const yP={name:"characterReference",tokenize:v5};function v5(e,t,n){const r=this;let i=0,s,o;return l;function l(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),c}function c(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),d):(e.enter("characterReferenceValue"),s=31,o=si,u(f))}function d(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,o=n5,u):(e.enter("characterReferenceValue"),s=7,o=_x,u(f))}function u(f){if(f===59&&i){const p=e.exit("characterReferenceValue");return o===si&&!yv(r.sliceSerialize(p))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(f)&&i++<s?(e.consume(f),u):n(f)}}const uS={partial:!0,tokenize:k5},dS={concrete:!0,name:"codeFenced",tokenize:b5};function b5(e,t,n){const r=this,i={partial:!0,tokenize:E};let s=0,o=0,l;return c;function c(j){return d(j)}function d(j){const A=r.events[r.events.length-1];return s=A&&A[1].type==="linePrefix"?A[2].sliceSerialize(A[1],!0).length:0,l=j,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(j)}function u(j){return j===l?(o++,e.consume(j),u):o<3?n(j):(e.exit("codeFencedFenceSequence"),Pt(j)?Ht(e,f,"whitespace")(j):f(j))}function f(j){return j===null||tt(j)?(e.exit("codeFencedFence"),r.interrupt?t(j):e.check(uS,b,k)(j)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(j))}function p(j){return j===null||tt(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(j)):Pt(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ht(e,h,"whitespace")(j)):j===96&&j===l?n(j):(e.consume(j),p)}function h(j){return j===null||tt(j)?f(j):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(j))}function g(j){return j===null||tt(j)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(j)):j===96&&j===l?n(j):(e.consume(j),g)}function b(j){return e.attempt(i,k,S)(j)}function S(j){return e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),x}function x(j){return s>0&&Pt(j)?Ht(e,w,"linePrefix",s+1)(j):w(j)}function w(j){return j===null||tt(j)?e.check(uS,b,k)(j):(e.enter("codeFlowValue"),v(j))}function v(j){return j===null||tt(j)?(e.exit("codeFlowValue"),w(j)):(e.consume(j),v)}function k(j){return e.exit("codeFenced"),t(j)}function E(j,A,$){let I=0;return F;function F(W){return j.enter("lineEnding"),j.consume(W),j.exit("lineEnding"),L}function L(W){return j.enter("codeFencedFence"),Pt(W)?Ht(j,T,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(W):T(W)}function T(W){return W===l?(j.enter("codeFencedFenceSequence"),q(W)):$(W)}function q(W){return W===l?(I++,j.consume(W),q):I>=o?(j.exit("codeFencedFenceSequence"),Pt(W)?Ht(j,D,"whitespace")(W):D(W)):$(W)}function D(W){return W===null||tt(W)?(j.exit("codeFencedFence"),A(W)):$(W)}}}function k5(e,t,n){const r=this;return i;function i(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const Tg={name:"codeIndented",tokenize:N5},S5={partial:!0,tokenize:j5};function N5(e,t,n){const r=this;return i;function i(d){return e.enter("codeIndented"),Ht(e,s,"linePrefix",5)(d)}function s(d){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(d):n(d)}function o(d){return d===null?c(d):tt(d)?e.attempt(S5,o,c)(d):(e.enter("codeFlowValue"),l(d))}function l(d){return d===null||tt(d)?(e.exit("codeFlowValue"),o(d)):(e.consume(d),l)}function c(d){return e.exit("codeIndented"),t(d)}}function j5(e,t,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):tt(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):Ht(e,s,"linePrefix",5)(o)}function s(o){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):tt(o)?i(o):n(o)}}const C5={name:"codeText",previous:_5,resolve:E5,tokenize:P5};function E5(e){let t=e.length-4,n=3,r,i;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;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function _5(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function P5(e,t,n){let r=0,i,s;return o;function o(f){return e.enter("codeText"),e.enter("codeTextSequence"),l(f)}function l(f){return f===96?(e.consume(f),r++,l):(e.exit("codeTextSequence"),c(f))}function c(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),c):f===96?(s=e.enter("codeTextSequence"),i=0,u(f)):tt(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),c):(e.enter("codeTextData"),d(f))}function d(f){return f===null||f===32||f===96||tt(f)?(e.exit("codeTextData"),c(f)):(e.consume(f),d)}function u(f){return f===96?(e.consume(f),i++,u):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(s.type="codeTextData",d(f))}}class A5{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 i=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&eu(this.left,r),s.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),eu(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),eu(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);eu(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);eu(this.left,n.reverse())}}}function eu(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 xP(e){const t={};let n=-1,r,i,s,o,l,c,d;const u=new A5(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type==="chunkFlow"&&u.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,s=0,s<c.length&&c[s][1].type==="lineEndingBlank"&&(s+=2),s<c.length&&c[s][1].type==="content"))for(;++s<c.length&&c[s][1].type!=="content";)c[s][1].type==="chunkText"&&(c[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,I5(u,n)),n=t[n],d=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(o=u.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(r[1].end={...u.get(i)[1].start},l=u.slice(i,n),l.unshift(r),u.splice(i,n-i+1,l))}}return Es(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!d}function I5(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const s=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const l=o.events,c=[],d={};let u,f,p=-1,h=n,g=0,b=0;const S=[b];for(;h;){for(;e.get(++i)[1]!==h;);s.push(i),h._tokenizer||(u=r.sliceStream(h),h.next||u.push(null),f&&o.defineSkip(h.start),h._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),h._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),f=h,h=h.next}for(h=n;++p<l.length;)l[p][0]==="exit"&&l[p-1][0]==="enter"&&l[p][1].type===l[p-1][1].type&&l[p][1].start.line!==l[p][1].end.line&&(b=p+1,S.push(b),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(o.events=[],h?(h._tokenizer=void 0,h.previous=void 0):S.pop(),p=S.length;p--;){const x=l.slice(S[p],S[p+1]),w=s.pop();c.push([w,w+x.length-1]),e.splice(w,2,x)}for(c.reverse(),p=-1;++p<c.length;)d[g+c[p][0]]=g+c[p][1],g+=c[p][1]-c[p][0]-1;return d}const T5={resolve:L5,tokenize:O5},R5={partial:!0,tokenize:M5};function L5(e){return xP(e),e}function O5(e,t){let n;return r;function r(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(l)}function i(l){return l===null?s(l):tt(l)?e.check(R5,o,s)(l):(e.consume(l),i)}function s(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function o(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function M5(e,t,n){const r=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Ht(e,s,"linePrefix")}function s(o){if(o===null||tt(o))return n(o);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(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function wP(e,t,n,r,i,s,o,l,c){const d=c||Number.POSITIVE_INFINITY;let u=0;return f;function f(x){return x===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(x),e.exit(s),p):x===null||x===32||x===41||Ex(x)?n(x):(e.enter(r),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),b(x))}function p(x){return x===62?(e.enter(s),e.consume(x),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),h(x))}function h(x){return x===62?(e.exit("chunkString"),e.exit(l),p(x)):x===null||x===60||tt(x)?n(x):(e.consume(x),x===92?g:h)}function g(x){return x===60||x===62||x===92?(e.consume(x),h):h(x)}function b(x){return!u&&(x===null||x===41||Yr(x))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(r),t(x)):u<d&&x===40?(e.consume(x),u++,b):x===41?(e.consume(x),u--,b):x===null||x===32||x===40||Ex(x)?n(x):(e.consume(x),x===92?S:b)}function S(x){return x===40||x===41||x===92?(e.consume(x),b):b(x)}}function vP(e,t,n,r,i,s){const o=this;let l=0,c;return d;function d(h){return e.enter(r),e.enter(i),e.consume(h),e.exit(i),e.enter(s),u}function u(h){return l>999||h===null||h===91||h===93&&!c||h===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?n(h):h===93?(e.exit(s),e.enter(i),e.consume(h),e.exit(i),e.exit(r),t):tt(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),f(h))}function f(h){return h===null||h===91||h===93||tt(h)||l++>999?(e.exit("chunkString"),u(h)):(e.consume(h),c||(c=!Pt(h)),h===92?p:f)}function p(h){return h===91||h===92||h===93?(e.consume(h),l++,f):f(h)}}function bP(e,t,n,r,i,s){let o;return l;function l(p){return p===34||p===39||p===40?(e.enter(r),e.enter(i),e.consume(p),e.exit(i),o=p===40?41:p,c):n(p)}function c(p){return p===o?(e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):(e.enter(s),d(p))}function d(p){return p===o?(e.exit(s),c(o)):p===null?n(p):tt(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),Ht(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(p))}function u(p){return p===o||p===null||tt(p)?(e.exit("chunkString"),d(p)):(e.consume(p),p===92?f:u)}function f(p){return p===o||p===92?(e.consume(p),u):u(p)}}function Au(e,t){let n;return r;function r(i){return tt(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Pt(i)?Ht(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const $5={name:"definition",tokenize:F5},D5={partial:!0,tokenize:z5};function F5(e,t,n){const r=this;let i;return s;function s(h){return e.enter("definition"),o(h)}function o(h){return vP.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function l(h){return i=Kl(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),c):n(h)}function c(h){return Yr(h)?Au(e,d)(h):d(h)}function d(h){return wP(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function u(h){return e.attempt(D5,f,f)(h)}function f(h){return Pt(h)?Ht(e,p,"whitespace")(h):p(h)}function p(h){return h===null||tt(h)?(e.exit("definition"),r.parser.defined.push(i),t(h)):n(h)}}function z5(e,t,n){return r;function r(l){return Yr(l)?Au(e,i)(l):n(l)}function i(l){return bP(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function s(l){return Pt(l)?Ht(e,o,"whitespace")(l):o(l)}function o(l){return l===null||tt(l)?t(l):n(l)}}const B5={name:"hardBreakEscape",tokenize:H5};function H5(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return tt(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const U5={name:"headingAtx",resolve:W5,tokenize:V5};function W5(e,t){let n=e.length-2,r=3,i,s;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&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Es(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function V5(e,t,n){let r=0;return i;function i(u){return e.enter("atxHeading"),s(u)}function s(u){return e.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&r++<6?(e.consume(u),o):u===null||Yr(u)?(e.exit("atxHeadingSequence"),l(u)):n(u)}function l(u){return u===35?(e.enter("atxHeadingSequence"),c(u)):u===null||tt(u)?(e.exit("atxHeading"),t(u)):Pt(u)?Ht(e,l,"whitespace")(u):(e.enter("atxHeadingText"),d(u))}function c(u){return u===35?(e.consume(u),c):(e.exit("atxHeadingSequence"),l(u))}function d(u){return u===null||u===35||Yr(u)?(e.exit("atxHeadingText"),l(u)):(e.consume(u),d)}}const K5=["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"],fS=["pre","script","style","textarea"],q5={concrete:!0,name:"htmlFlow",resolveTo:X5,tokenize:J5},Y5={partial:!0,tokenize:Z5},G5={partial:!0,tokenize:Q5};function X5(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 J5(e,t,n){const r=this;let i,s,o,l,c;return d;function d(B){return u(B)}function u(B){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(B),f}function f(B){return B===33?(e.consume(B),p):B===47?(e.consume(B),s=!0,b):B===63?(e.consume(B),i=3,r.interrupt?t:C):xs(B)?(e.consume(B),o=String.fromCharCode(B),S):n(B)}function p(B){return B===45?(e.consume(B),i=2,h):B===91?(e.consume(B),i=5,l=0,g):xs(B)?(e.consume(B),i=4,r.interrupt?t:C):n(B)}function h(B){return B===45?(e.consume(B),r.interrupt?t:C):n(B)}function g(B){const te="CDATA[";return B===te.charCodeAt(l++)?(e.consume(B),l===te.length?r.interrupt?t:T:g):n(B)}function b(B){return xs(B)?(e.consume(B),o=String.fromCharCode(B),S):n(B)}function S(B){if(B===null||B===47||B===62||Yr(B)){const te=B===47,de=o.toLowerCase();return!te&&!s&&fS.includes(de)?(i=1,r.interrupt?t(B):T(B)):K5.includes(o.toLowerCase())?(i=6,te?(e.consume(B),x):r.interrupt?t(B):T(B)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(B):s?w(B):v(B))}return B===45||si(B)?(e.consume(B),o+=String.fromCharCode(B),S):n(B)}function x(B){return B===62?(e.consume(B),r.interrupt?t:T):n(B)}function w(B){return Pt(B)?(e.consume(B),w):F(B)}function v(B){return B===47?(e.consume(B),F):B===58||B===95||xs(B)?(e.consume(B),k):Pt(B)?(e.consume(B),v):F(B)}function k(B){return B===45||B===46||B===58||B===95||si(B)?(e.consume(B),k):E(B)}function E(B){return B===61?(e.consume(B),j):Pt(B)?(e.consume(B),E):v(B)}function j(B){return B===null||B===60||B===61||B===62||B===96?n(B):B===34||B===39?(e.consume(B),c=B,A):Pt(B)?(e.consume(B),j):$(B)}function A(B){return B===c?(e.consume(B),c=null,I):B===null||tt(B)?n(B):(e.consume(B),A)}function $(B){return B===null||B===34||B===39||B===47||B===60||B===61||B===62||B===96||Yr(B)?E(B):(e.consume(B),$)}function I(B){return B===47||B===62||Pt(B)?v(B):n(B)}function F(B){return B===62?(e.consume(B),L):n(B)}function L(B){return B===null||tt(B)?T(B):Pt(B)?(e.consume(B),L):n(B)}function T(B){return B===45&&i===2?(e.consume(B),O):B===60&&i===1?(e.consume(B),U):B===62&&i===4?(e.consume(B),G):B===63&&i===3?(e.consume(B),C):B===93&&i===5?(e.consume(B),R):tt(B)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Y5,J,q)(B)):B===null||tt(B)?(e.exit("htmlFlowData"),q(B)):(e.consume(B),T)}function q(B){return e.check(G5,D,J)(B)}function D(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),W}function W(B){return B===null||tt(B)?q(B):(e.enter("htmlFlowData"),T(B))}function O(B){return B===45?(e.consume(B),C):T(B)}function U(B){return B===47?(e.consume(B),o="",P):T(B)}function P(B){if(B===62){const te=o.toLowerCase();return fS.includes(te)?(e.consume(B),G):T(B)}return xs(B)&&o.length<8?(e.consume(B),o+=String.fromCharCode(B),P):T(B)}function R(B){return B===93?(e.consume(B),C):T(B)}function C(B){return B===62?(e.consume(B),G):B===45&&i===2?(e.consume(B),C):T(B)}function G(B){return B===null||tt(B)?(e.exit("htmlFlowData"),J(B)):(e.consume(B),G)}function J(B){return e.exit("htmlFlow"),t(B)}}function Q5(e,t,n){const r=this;return i;function i(o){return tt(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function Z5(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(cm,t,n)}}const eH={name:"htmlText",tokenize:tH};function tH(e,t,n){const r=this;let i,s,o;return l;function l(C){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(C),c}function c(C){return C===33?(e.consume(C),d):C===47?(e.consume(C),E):C===63?(e.consume(C),v):xs(C)?(e.consume(C),$):n(C)}function d(C){return C===45?(e.consume(C),u):C===91?(e.consume(C),s=0,g):xs(C)?(e.consume(C),w):n(C)}function u(C){return C===45?(e.consume(C),h):n(C)}function f(C){return C===null?n(C):C===45?(e.consume(C),p):tt(C)?(o=f,U(C)):(e.consume(C),f)}function p(C){return C===45?(e.consume(C),h):f(C)}function h(C){return C===62?O(C):C===45?p(C):f(C)}function g(C){const G="CDATA[";return C===G.charCodeAt(s++)?(e.consume(C),s===G.length?b:g):n(C)}function b(C){return C===null?n(C):C===93?(e.consume(C),S):tt(C)?(o=b,U(C)):(e.consume(C),b)}function S(C){return C===93?(e.consume(C),x):b(C)}function x(C){return C===62?O(C):C===93?(e.consume(C),x):b(C)}function w(C){return C===null||C===62?O(C):tt(C)?(o=w,U(C)):(e.consume(C),w)}function v(C){return C===null?n(C):C===63?(e.consume(C),k):tt(C)?(o=v,U(C)):(e.consume(C),v)}function k(C){return C===62?O(C):v(C)}function E(C){return xs(C)?(e.consume(C),j):n(C)}function j(C){return C===45||si(C)?(e.consume(C),j):A(C)}function A(C){return tt(C)?(o=A,U(C)):Pt(C)?(e.consume(C),A):O(C)}function $(C){return C===45||si(C)?(e.consume(C),$):C===47||C===62||Yr(C)?I(C):n(C)}function I(C){return C===47?(e.consume(C),O):C===58||C===95||xs(C)?(e.consume(C),F):tt(C)?(o=I,U(C)):Pt(C)?(e.consume(C),I):O(C)}function F(C){return C===45||C===46||C===58||C===95||si(C)?(e.consume(C),F):L(C)}function L(C){return C===61?(e.consume(C),T):tt(C)?(o=L,U(C)):Pt(C)?(e.consume(C),L):I(C)}function T(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(e.consume(C),i=C,q):tt(C)?(o=T,U(C)):Pt(C)?(e.consume(C),T):(e.consume(C),D)}function q(C){return C===i?(e.consume(C),i=void 0,W):C===null?n(C):tt(C)?(o=q,U(C)):(e.consume(C),q)}function D(C){return C===null||C===34||C===39||C===60||C===61||C===96?n(C):C===47||C===62||Yr(C)?I(C):(e.consume(C),D)}function W(C){return C===47||C===62||Yr(C)?I(C):n(C)}function O(C){return C===62?(e.consume(C),e.exit("htmlTextData"),e.exit("htmlText"),t):n(C)}function U(C){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),P}function P(C){return Pt(C)?Ht(e,R,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):R(C)}function R(C){return e.enter("htmlTextData"),o(C)}}const wv={name:"labelEnd",resolveAll:sH,resolveTo:oH,tokenize:aH},nH={tokenize:lH},rH={tokenize:cH},iH={tokenize:uH};function sH(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 i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&Es(e,0,e.length,n),e}function oH(e,t){let n=e.length,r=0,i,s,o,l;for(;n--;)if(i=e[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=n);const c={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},d={type:"label",start:{...e[s][1].start},end:{...e[o][1].end}},u={type:"labelText",start:{...e[s+r+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",c,t],["enter",d,t]],l=wi(l,e.slice(s+1,s+r+3)),l=wi(l,[["enter",u,t]]),l=wi(l,xv(t.parser.constructs.insideSpan.null,e.slice(s+r+4,o-3),t)),l=wi(l,[["exit",u,t],e[o-2],e[o-1],["exit",d,t]]),l=wi(l,e.slice(o+1)),l=wi(l,[["exit",c,t]]),Es(e,s,e.length,l),e}function aH(e,t,n){const r=this;let i=r.events.length,s,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return l;function l(p){return s?s._inactive?f(p):(o=r.parser.defined.includes(Kl(r.sliceSerialize({start:s.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(nH,u,o?u:f)(p):p===91?e.attempt(rH,u,o?d:f)(p):o?u(p):f(p)}function d(p){return e.attempt(iH,u,f)(p)}function u(p){return t(p)}function f(p){return s._balanced=!0,n(p)}}function lH(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),i}function i(f){return Yr(f)?Au(e,s)(f):s(f)}function s(f){return f===41?u(f):wP(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function o(f){return Yr(f)?Au(e,c)(f):u(f)}function l(f){return n(f)}function c(f){return f===34||f===39||f===40?bP(e,d,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):u(f)}function d(f){return Yr(f)?Au(e,u)(f):u(f)}function u(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function cH(e,t,n){const r=this;return i;function i(l){return vP.call(r,e,s,o,"reference","referenceMarker","referenceString")(l)}function s(l){return r.parser.defined.includes(Kl(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function o(l){return n(l)}}function uH(e,t,n){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),i}function i(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}const dH={name:"labelStartImage",resolveAll:wv.resolveAll,tokenize:fH};function fH(e,t,n){const r=this;return i;function i(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),s}function s(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),o):n(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const pH={name:"labelStartLink",resolveAll:wv.resolveAll,tokenize:hH};function hH(e,t,n){const r=this;return i;function i(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const Rg={name:"lineEnding",tokenize:mH};function mH(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ht(e,t,"linePrefix")}}const jp={name:"thematicBreak",tokenize:gH};function gH(e,t,n){let r=0,i;return s;function s(d){return e.enter("thematicBreak"),o(d)}function o(d){return i=d,l(d)}function l(d){return d===i?(e.enter("thematicBreakSequence"),c(d)):r>=3&&(d===null||tt(d))?(e.exit("thematicBreak"),t(d)):n(d)}function c(d){return d===i?(e.consume(d),r++,c):(e.exit("thematicBreakSequence"),Pt(d)?Ht(e,l,"whitespace")(d):l(d))}}const Mr={continuation:{tokenize:vH},exit:kH,name:"list",tokenize:wH},yH={partial:!0,tokenize:SH},xH={partial:!0,tokenize:bH};function wH(e,t,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return l;function l(h){const g=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:_x(h)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(jp,n,d)(h):d(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(h)}return n(h)}function c(h){return _x(h)&&++o<10?(e.consume(h),c):(!r.interrupt||o<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),d(h)):n(h)}function d(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check(cm,r.interrupt?n:u,e.attempt(yH,p,f))}function u(h){return r.containerState.initialBlankLine=!0,s++,p(h)}function f(h){return Pt(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),p):n(h)}function p(h){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function vH(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(cm,i,s);function i(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ht(e,t,"listItemIndent",r.containerState.size+1)(l)}function s(l){return r.containerState.furtherBlankLines||!Pt(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(xH,t,o)(l))}function o(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ht(e,e.attempt(Mr,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function bH(e,t,n){const r=this;return Ht(e,i,"listItemIndent",r.containerState.size+1);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(s):n(s)}}function kH(e){e.exit(this.containerState.type)}function SH(e,t,n){const r=this;return Ht(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=r.events[r.events.length-1];return!Pt(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const pS={name:"setextUnderline",resolveTo:NH,tokenize:jH};function NH(e,t){let n=e.length,r,i,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",o,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function jH(e,t,n){const r=this;let i;return s;function s(d){let u=r.events.length,f;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){f=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),i=d,o(d)):n(d)}function o(d){return e.enter("setextHeadingLineSequence"),l(d)}function l(d){return d===i?(e.consume(d),l):(e.exit("setextHeadingLineSequence"),Pt(d)?Ht(e,c,"lineSuffix")(d):c(d))}function c(d){return d===null||tt(d)?(e.exit("setextHeadingLine"),t(d)):n(d)}}const CH={tokenize:EH};function EH(e){const t=this,n=e.attempt(cm,r,e.attempt(this.parser.constructs.flowInitial,i,Ht(e,e.attempt(this.parser.constructs.flow,i,e.attempt(T5,i)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const _H={resolveAll:SP()},PH=kP("string"),AH=kP("text");function kP(e){return{resolveAll:SP(e==="text"?IH:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],s=n.attempt(i,o,l);return o;function o(u){return d(u)?s(u):l(u)}function l(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),c}function c(u){return d(u)?(n.exit("data"),s(u)):(n.consume(u),c)}function d(u){if(u===null)return!0;const f=i[u];let p=-1;if(f)for(;++p<f.length;){const h=f[p];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function SP(e){return t;function t(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return e?e(n,r):n}}function IH(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],i=t.sliceStream(r);let s=i.length,o=-1,l=0,c;for(;s--;){const d=i[s];if(typeof d=="string"){for(o=d.length;d.charCodeAt(o-1)===32;)l++,o--;if(o)break;o=-1}else if(d===-2)c=!0,l++;else if(d!==-1){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const d={type:n===e.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:r.start._bufferIndex+o,_index:r.start._index+s,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 TH={42:Mr,43:Mr,45:Mr,48:Mr,49:Mr,50:Mr,51:Mr,52:Mr,53:Mr,54:Mr,55:Mr,56:Mr,57:Mr,62:mP},RH={91:$5},LH={[-2]:Tg,[-1]:Tg,32:Tg},OH={35:U5,42:jp,45:[pS,jp],60:q5,61:pS,95:jp,96:dS,126:dS},MH={38:yP,92:gP},$H={[-5]:Rg,[-4]:Rg,[-3]:Rg,33:dH,38:yP,42:Px,60:[p5,eH],91:pH,92:[B5,gP],93:wv,95:Px,96:C5},DH={null:[Px,_H]},FH={null:[42,95]},zH={null:[]},BH=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:FH,contentInitial:RH,disable:zH,document:TH,flow:OH,flowInitial:LH,insideSpan:DH,string:MH,text:$H},Symbol.toStringTag,{value:"Module"}));function HH(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 i={},s=[];let o=[],l=[];const c={attempt:A(E),check:A(j),consume:w,enter:v,exit:k,interrupt:A(j,{interrupt:!0})},d={code:null,containerState:{},defineSkip:b,events:[],now:g,parser:e,previous:null,sliceSerialize:p,sliceStream:h,write:f};let u=t.tokenize.call(d,c);return t.resolveAll&&s.push(t),d;function f(L){return o=wi(o,L),S(),o[o.length-1]!==null?[]:($(t,0),d.events=xv(s,d.events,d),d.events)}function p(L,T){return WH(h(L),T)}function h(L){return UH(o,L)}function g(){const{_bufferIndex:L,_index:T,line:q,column:D,offset:W}=r;return{_bufferIndex:L,_index:T,line:q,column:D,offset:W}}function b(L){i[L.line]=L.column,F()}function S(){let L;for(;r._index<o.length;){const T=o[r._index];if(typeof T=="string")for(L=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===L&&r._bufferIndex<T.length;)x(T.charCodeAt(r._bufferIndex));else x(T)}}function x(L){u=u(L)}function w(L){tt(L)?(r.line++,r.column=1,r.offset+=L===-3?2:1,F()):L!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),d.previous=L}function v(L,T){const q=T||{};return q.type=L,q.start=g(),d.events.push(["enter",q,d]),l.push(q),q}function k(L){const T=l.pop();return T.end=g(),d.events.push(["exit",T,d]),T}function E(L,T){$(L,T.from)}function j(L,T){T.restore()}function A(L,T){return q;function q(D,W,O){let U,P,R,C;return Array.isArray(D)?J(D):"tokenize"in D?J([D]):G(D);function G(ce){return ue;function ue(re){const ge=re!==null&&ce[re],se=re!==null&&ce.null,pe=[...Array.isArray(ge)?ge:ge?[ge]:[],...Array.isArray(se)?se:se?[se]:[]];return J(pe)(re)}}function J(ce){return U=ce,P=0,ce.length===0?O:B(ce[P])}function B(ce){return ue;function ue(re){return C=I(),R=ce,ce.partial||(d.currentConstruct=ce),ce.name&&d.parser.constructs.disable.null.includes(ce.name)?de():ce.tokenize.call(T?Object.assign(Object.create(d),T):d,c,te,de)(re)}}function te(ce){return L(R,C),W}function de(ce){return C.restore(),++P<U.length?B(U[P]):O}}}function $(L,T){L.resolveAll&&!s.includes(L)&&s.push(L),L.resolve&&Es(d.events,T,d.events.length-T,L.resolve(d.events.slice(T),d)),L.resolveTo&&(d.events=L.resolveTo(d.events,d))}function I(){const L=g(),T=d.previous,q=d.currentConstruct,D=d.events.length,W=Array.from(l);return{from:D,restore:O};function O(){r=L,d.previous=T,d.currentConstruct=q,d.events.length=D,l=W,F()}}function F(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function UH(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,s=t.end._bufferIndex;let o;if(n===i)o=[e[n].slice(r,s)];else{if(o=e.slice(n,i),r>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(r):o.shift()}s>0&&o.push(e[i].slice(0,s))}return o}function WH(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const s=e[n];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
|
|
68
|
-
`;break}case-3:{o=`\r
|
|
69
|
-
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,r.push(o)}return r.join("")}function VH(e){const r={constructs:QB([BH,...(e||{}).extensions||[]]),content:i(o5),defined:[],document:i(l5),flow:i(CH),lazy:{},string:i(PH),text:i(AH)};return r;function i(s){return o;function o(l){return HH(r,s,l)}}}function KH(e){for(;!xP(e););return e}const hS=/[\0\t\n\r]/g;function qH(){let e=1,t="",n=!0,r;return i;function i(s,o,l){const c=[];let d,u,f,p,h;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),f=0,t="",n&&(s.charCodeAt(0)===65279&&f++,n=void 0);f<s.length;){if(hS.lastIndex=f,d=hS.exec(s),p=d&&d.index!==void 0?d.index:s.length,h=s.charCodeAt(p),!d){t=s.slice(f);break}if(h===10&&f===p&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),f<p&&(c.push(s.slice(f,p)),e+=p-f),h){case 0:{c.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,c.push(-2);e++<u;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}f=p+1}return l&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const YH=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function GH(e){return e.replace(YH,XH)}function XH(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return hP(n.slice(s?2:1),s?16:10)}return yv(n)||e}const NP={}.hasOwnProperty;function JH(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),QH(n)(KH(VH(n).document().write(qH()(e,t,!0))))}function QH(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(sn),autolinkProtocol:I,autolinkEmail:I,atxHeading:s(st),blockQuote:s(se),characterEscape:I,characterReference:I,codeFenced:s(pe),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(pe,o),codeText:s(ae,o),codeTextData:I,data:I,codeFlowValue:I,definition:s(me),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(ze),hardBreakEscape:s(Ke),hardBreakTrailing:s(Ke),htmlFlow:s(Ee,o),htmlFlowData:I,htmlText:s(Ee,o),htmlTextData:I,image:s(It),label:o,link:s(sn),listItem:s(mn),listItemValue:p,listOrdered:s(Wt,f),listUnordered:s(Wt),paragraph:s(on),reference:B,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(st),strong:s(bn),thematicBreak:s(_n)},exit:{atxHeading:c(),atxHeadingSequence:E,autolink:c(),autolinkEmail:ge,autolinkProtocol:re,blockQuote:c(),characterEscapeValue:F,characterReferenceMarkerHexadecimal:de,characterReferenceMarkerNumeric:de,characterReferenceValue:ce,characterReference:ue,codeFenced:c(S),codeFencedFence:b,codeFencedFenceInfo:h,codeFencedFenceMeta:g,codeFlowValue:F,codeIndented:c(x),codeText:c(W),codeTextData:F,data:F,definition:c(),definitionDestinationString:k,definitionLabelString:w,definitionTitleString:v,emphasis:c(),hardBreakEscape:c(T),hardBreakTrailing:c(T),htmlFlow:c(q),htmlFlowData:F,htmlText:c(D),htmlTextData:F,image:c(U),label:R,labelText:P,lineEnding:L,link:c(O),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:te,resourceDestinationString:C,resourceTitleString:G,resource:J,setextHeading:c($),setextHeadingLineSequence:A,setextHeadingText:j,strong:c(),thematicBreak:c()}};jP(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(oe){let ye={type:"root",children:[]};const Ue={stack:[ye],tokenStack:[],config:t,enter:l,exit:d,buffer:o,resume:u,data:n},Ge=[];let Qe=-1;for(;++Qe<oe.length;)if(oe[Qe][1].type==="listOrdered"||oe[Qe][1].type==="listUnordered")if(oe[Qe][0]==="enter")Ge.push(Qe);else{const Et=Ge.pop();Qe=i(oe,Et,Qe)}for(Qe=-1;++Qe<oe.length;){const Et=t[oe[Qe][0]];NP.call(Et,oe[Qe][1].type)&&Et[oe[Qe][1].type].call(Object.assign({sliceSerialize:oe[Qe][2].sliceSerialize},Ue),oe[Qe][1])}if(Ue.tokenStack.length>0){const Et=Ue.tokenStack[Ue.tokenStack.length-1];(Et[1]||mS).call(Ue,void 0,Et[0])}for(ye.position={start:vo(oe.length>0?oe[0][1].start:{line:1,column:1,offset:0}),end:vo(oe.length>0?oe[oe.length-2][1].end:{line:1,column:1,offset:0})},Qe=-1;++Qe<t.transforms.length;)ye=t.transforms[Qe](ye)||ye;return ye}function i(oe,ye,Ue){let Ge=ye-1,Qe=-1,Et=!1,kn,gt,Sn,On;for(;++Ge<=Ue;){const Rt=oe[Ge];switch(Rt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Rt[0]==="enter"?Qe++:Qe--,On=void 0;break}case"lineEndingBlank":{Rt[0]==="enter"&&(kn&&!On&&!Qe&&!Sn&&(Sn=Ge),On=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:On=void 0}if(!Qe&&Rt[0]==="enter"&&Rt[1].type==="listItemPrefix"||Qe===-1&&Rt[0]==="exit"&&(Rt[1].type==="listUnordered"||Rt[1].type==="listOrdered")){if(kn){let fe=Ge;for(gt=void 0;fe--;){const Pe=oe[fe];if(Pe[1].type==="lineEnding"||Pe[1].type==="lineEndingBlank"){if(Pe[0]==="exit")continue;gt&&(oe[gt][1].type="lineEndingBlank",Et=!0),Pe[1].type="lineEnding",gt=fe}else if(!(Pe[1].type==="linePrefix"||Pe[1].type==="blockQuotePrefix"||Pe[1].type==="blockQuotePrefixWhitespace"||Pe[1].type==="blockQuoteMarker"||Pe[1].type==="listItemIndent"))break}Sn&&(!gt||Sn<gt)&&(kn._spread=!0),kn.end=Object.assign({},gt?oe[gt][1].start:Rt[1].end),oe.splice(gt||Ge,0,["exit",kn,Rt[2]]),Ge++,Ue++}if(Rt[1].type==="listItemPrefix"){const fe={type:"listItem",_spread:!1,start:Object.assign({},Rt[1].start),end:void 0};kn=fe,oe.splice(Ge,0,["enter",fe,Rt[2]]),Ge++,Ue++,Sn=void 0,On=!0}}}return oe[ye][1]._spread=Et,Ue}function s(oe,ye){return Ue;function Ue(Ge){l.call(this,oe(Ge),Ge),ye&&ye.call(this,Ge)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(oe,ye,Ue){this.stack[this.stack.length-1].children.push(oe),this.stack.push(oe),this.tokenStack.push([ye,Ue||void 0]),oe.position={start:vo(ye.start),end:void 0}}function c(oe){return ye;function ye(Ue){oe&&oe.call(this,Ue),d.call(this,Ue)}}function d(oe,ye){const Ue=this.stack.pop(),Ge=this.tokenStack.pop();if(Ge)Ge[0].type!==oe.type&&(ye?ye.call(this,oe,Ge[0]):(Ge[1]||mS).call(this,oe,Ge[0]));else throw new Error("Cannot close `"+oe.type+"` ("+Pu({start:oe.start,end:oe.end})+"): it’s not open");Ue.position.end=vo(oe.end)}function u(){return XB(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function p(oe){if(this.data.expectingFirstListItemValue){const ye=this.stack[this.stack.length-2];ye.start=Number.parseInt(this.sliceSerialize(oe),10),this.data.expectingFirstListItemValue=void 0}}function h(){const oe=this.resume(),ye=this.stack[this.stack.length-1];ye.lang=oe}function g(){const oe=this.resume(),ye=this.stack[this.stack.length-1];ye.meta=oe}function b(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){const oe=this.resume(),ye=this.stack[this.stack.length-1];ye.value=oe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const oe=this.resume(),ye=this.stack[this.stack.length-1];ye.value=oe.replace(/(\r?\n|\r)$/g,"")}function w(oe){const ye=this.resume(),Ue=this.stack[this.stack.length-1];Ue.label=ye,Ue.identifier=Kl(this.sliceSerialize(oe)).toLowerCase()}function v(){const oe=this.resume(),ye=this.stack[this.stack.length-1];ye.title=oe}function k(){const oe=this.resume(),ye=this.stack[this.stack.length-1];ye.url=oe}function E(oe){const ye=this.stack[this.stack.length-1];if(!ye.depth){const Ue=this.sliceSerialize(oe).length;ye.depth=Ue}}function j(){this.data.setextHeadingSlurpLineEnding=!0}function A(oe){const ye=this.stack[this.stack.length-1];ye.depth=this.sliceSerialize(oe).codePointAt(0)===61?1:2}function $(){this.data.setextHeadingSlurpLineEnding=void 0}function I(oe){const Ue=this.stack[this.stack.length-1].children;let Ge=Ue[Ue.length-1];(!Ge||Ge.type!=="text")&&(Ge=xr(),Ge.position={start:vo(oe.start),end:void 0},Ue.push(Ge)),this.stack.push(Ge)}function F(oe){const ye=this.stack.pop();ye.value+=this.sliceSerialize(oe),ye.position.end=vo(oe.end)}function L(oe){const ye=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ue=ye.children[ye.children.length-1];Ue.position.end=vo(oe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ye.type)&&(I.call(this,oe),F.call(this,oe))}function T(){this.data.atHardBreak=!0}function q(){const oe=this.resume(),ye=this.stack[this.stack.length-1];ye.value=oe}function D(){const oe=this.resume(),ye=this.stack[this.stack.length-1];ye.value=oe}function W(){const oe=this.resume(),ye=this.stack[this.stack.length-1];ye.value=oe}function O(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=ye,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function U(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=ye,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function P(oe){const ye=this.sliceSerialize(oe),Ue=this.stack[this.stack.length-2];Ue.label=GH(ye),Ue.identifier=Kl(ye).toLowerCase()}function R(){const oe=this.stack[this.stack.length-1],ye=this.resume(),Ue=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ue.type==="link"){const Ge=oe.children;Ue.children=Ge}else Ue.alt=ye}function C(){const oe=this.resume(),ye=this.stack[this.stack.length-1];ye.url=oe}function G(){const oe=this.resume(),ye=this.stack[this.stack.length-1];ye.title=oe}function J(){this.data.inReference=void 0}function B(){this.data.referenceType="collapsed"}function te(oe){const ye=this.resume(),Ue=this.stack[this.stack.length-1];Ue.label=ye,Ue.identifier=Kl(this.sliceSerialize(oe)).toLowerCase(),this.data.referenceType="full"}function de(oe){this.data.characterReferenceType=oe.type}function ce(oe){const ye=this.sliceSerialize(oe),Ue=this.data.characterReferenceType;let Ge;Ue?(Ge=hP(ye,Ue==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ge=yv(ye);const Qe=this.stack[this.stack.length-1];Qe.value+=Ge}function ue(oe){const ye=this.stack.pop();ye.position.end=vo(oe.end)}function re(oe){F.call(this,oe);const ye=this.stack[this.stack.length-1];ye.url=this.sliceSerialize(oe)}function ge(oe){F.call(this,oe);const ye=this.stack[this.stack.length-1];ye.url="mailto:"+this.sliceSerialize(oe)}function se(){return{type:"blockquote",children:[]}}function pe(){return{type:"code",lang:null,meta:null,value:""}}function ae(){return{type:"inlineCode",value:""}}function me(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ze(){return{type:"emphasis",children:[]}}function st(){return{type:"heading",depth:0,children:[]}}function Ke(){return{type:"break"}}function Ee(){return{type:"html",value:""}}function It(){return{type:"image",title:null,url:"",alt:null}}function sn(){return{type:"link",title:null,url:"",children:[]}}function Wt(oe){return{type:"list",ordered:oe.type==="listOrdered",start:null,spread:oe._spread,children:[]}}function mn(oe){return{type:"listItem",spread:oe._spread,checked:null,children:[]}}function on(){return{type:"paragraph",children:[]}}function bn(){return{type:"strong",children:[]}}function xr(){return{type:"text",value:""}}function _n(){return{type:"thematicBreak"}}}function vo(e){return{line:e.line,column:e.column,offset:e.offset}}function jP(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?jP(e,r):ZH(e,r)}}function ZH(e,t){let n;for(n in t)if(NP.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 mS(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Pu({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Pu({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Pu({start:t.start,end:t.end})+") is still open")}function e8(e){const t=this;t.parser=n;function n(r){return JH(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function t8(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 n8(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
70
|
-
`}]}function r8(e,t){const n=t.value?t.value+`
|
|
71
|
-
`:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function i8(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function s8(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function o8(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=wc(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let o,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=s+1,l+=1,e.footnoteCounts.set(r,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,c);const d={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,d),e.applyData(t,d)}function a8(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 l8(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function CP(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 i=e.all(t),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=r:i.push({type:"text",value:r}),i}function c8(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return CP(e,t);const i={src:wc(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)}function u8(e,t){const n={src:wc(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 d8(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 f8(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return CP(e,t);const i={href:wc(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function p8(e,t){const n={href:wc(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 h8(e,t,n){const r=e.all(t),i=n?m8(n):EP(t),s={},o=[];if(typeof t.checked=="boolean"){const u=r[0];let f;u&&u.type==="element"&&u.tagName==="p"?f=u:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const u=r[l];(i||l!==0||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
|
|
72
|
-
`}),u.type==="element"&&u.tagName==="p"&&!i?o.push(...u.children):o.push(u)}const c=r[r.length-1];c&&(i||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:`
|
|
73
|
-
`});const d={type:"element",tagName:"li",properties:s,children:o};return e.patch(t,d),e.applyData(t,d)}function m8(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=EP(n[r])}return t}function EP(e){const t=e.spread;return t??e.children.length>1}function g8(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const o=r[i];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,s),e.applyData(t,s)}function y8(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function x8(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function w8(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function v8(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],o),i.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=pv(t.children[1]),c=aP(t.children[t.children.length-1]);l&&c&&(o.position={start:l,end:c}),i.push(o)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)}function b8(e,t,n){const r=n?n.children:void 0,s=(r?r.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,l=o?o.length:t.children.length;let c=-1;const d=[];for(;++c<l;){const f=t.children[c],p={},h=o?o[c]:void 0;h&&(p.align=h);let g={type:"element",tagName:s,properties:p,children:[]};f&&(g.children=e.all(f),e.patch(f,g),g=e.applyData(f,g)),d.push(g)}const u={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(t,u),e.applyData(t,u)}function k8(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const gS=9,yS=32;function S8(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const s=[];for(;r;)s.push(xS(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return s.push(xS(t.slice(i),i>0,!1)),s.join("")}function xS(e,t,n){let r=0,i=e.length;if(t){let s=e.codePointAt(r);for(;s===gS||s===yS;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(i-1);for(;s===gS||s===yS;)i--,s=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function N8(e,t){const n={type:"text",value:S8(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function j8(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const C8={blockquote:t8,break:n8,code:r8,delete:i8,emphasis:s8,footnoteReference:o8,heading:a8,html:l8,imageReference:c8,image:u8,inlineCode:d8,linkReference:f8,link:p8,listItem:h8,list:g8,paragraph:y8,root:x8,strong:w8,table:v8,tableCell:k8,tableRow:b8,text:N8,thematicBreak:j8,toml:qf,yaml:qf,definition:qf,footnoteDefinition:qf};function qf(){}const _P=-1,um=0,Iu=1,fh=2,vv=3,bv=4,kv=5,Sv=6,PP=7,AP=8,wS=typeof self=="object"?self:globalThis,E8=(e,t)=>{const n=(i,s)=>(e.set(s,i),i),r=i=>{if(e.has(i))return e.get(i);const[s,o]=t[i];switch(s){case um:case _P:return n(o,i);case Iu:{const l=n([],i);for(const c of o)l.push(r(c));return l}case fh:{const l=n({},i);for(const[c,d]of o)l[r(c)]=r(d);return l}case vv:return n(new Date(o),i);case bv:{const{source:l,flags:c}=o;return n(new RegExp(l,c),i)}case kv:{const l=n(new Map,i);for(const[c,d]of o)l.set(r(c),r(d));return l}case Sv:{const l=n(new Set,i);for(const c of o)l.add(r(c));return l}case PP:{const{name:l,message:c}=o;return n(new wS[l](c),i)}case AP:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return n(new DataView(l),o)}}return n(new wS[s](o),i)};return r},vS=e=>E8(new Map,e)(0),dl="",{toString:_8}={},{keys:P8}=Object,tu=e=>{const t=typeof e;if(t!=="object"||!e)return[um,t];const n=_8.call(e).slice(8,-1);switch(n){case"Array":return[Iu,dl];case"Object":return[fh,dl];case"Date":return[vv,dl];case"RegExp":return[bv,dl];case"Map":return[kv,dl];case"Set":return[Sv,dl];case"DataView":return[Iu,n]}return n.includes("Array")?[Iu,n]:n.includes("Error")?[PP,n]:[fh,n]},Yf=([e,t])=>e===um&&(t==="function"||t==="symbol"),A8=(e,t,n,r)=>{const i=(o,l)=>{const c=r.push(o)-1;return n.set(l,c),c},s=o=>{if(n.has(o))return n.get(o);let[l,c]=tu(o);switch(l){case um:{let u=o;switch(c){case"bigint":l=AP,u=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);u=null;break;case"undefined":return i([_P],o)}return i([l,u],o)}case Iu:{if(c){let p=o;return c==="DataView"?p=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(p=new Uint8Array(o)),i([c,[...p]],o)}const u=[],f=i([l,u],o);for(const p of o)u.push(s(p));return f}case fh:{if(c)switch(c){case"BigInt":return i([c,o.toString()],o);case"Boolean":case"Number":case"String":return i([c,o.valueOf()],o)}if(t&&"toJSON"in o)return s(o.toJSON());const u=[],f=i([l,u],o);for(const p of P8(o))(e||!Yf(tu(o[p])))&&u.push([s(p),s(o[p])]);return f}case vv:return i([l,o.toISOString()],o);case bv:{const{source:u,flags:f}=o;return i([l,{source:u,flags:f}],o)}case kv:{const u=[],f=i([l,u],o);for(const[p,h]of o)(e||!(Yf(tu(p))||Yf(tu(h))))&&u.push([s(p),s(h)]);return f}case Sv:{const u=[],f=i([l,u],o);for(const p of o)(e||!Yf(tu(p)))&&u.push(s(p));return f}}const{message:d}=o;return i([l,{name:c,message:d}],o)};return s},bS=(e,{json:t,lossy:n}={})=>{const r=[];return A8(!(t||n),!!t,new Map,r)(e),r},ph=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?vS(bS(e,t)):structuredClone(e):(e,t)=>vS(bS(e,t));function I8(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 T8(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function R8(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||I8,r=e.options.footnoteBackLabel||T8,i=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",o=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 u=e.all(d),f=String(d.identifier).toUpperCase(),p=wc(f.toLowerCase());let h=0;const g=[],b=e.footnoteCounts.get(f);for(;b!==void 0&&++h<=b;){g.length>0&&g.push({type:"text",value:" "});let w=typeof n=="string"?n:n(c,h);typeof w=="string"&&(w={type:"text",value:w}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+p+(h>1?"-"+h:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,h),className:["data-footnote-backref"]},children:Array.isArray(w)?w:[w]})}const S=u[u.length-1];if(S&&S.type==="element"&&S.tagName==="p"){const w=S.children[S.children.length-1];w&&w.type==="text"?w.value+=" ":S.children.push({type:"text",value:" "}),S.children.push(...g)}else u.push(...g);const x={type:"element",tagName:"li",properties:{id:t+"fn-"+p},children:e.wrap(u,!0)};e.patch(d,x),l.push(x)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...ph(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
74
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
|
|
75
|
-
`}]}}const IP=function(e){if(e==null)return $8;if(typeof e=="function")return dm(e);if(typeof e=="object")return Array.isArray(e)?L8(e):O8(e);if(typeof e=="string")return M8(e);throw new Error("Expected function, string, or object as test")};function L8(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=IP(e[n]);return dm(r);function r(...i){let s=-1;for(;++s<t.length;)if(t[s].apply(this,i))return!0;return!1}}function O8(e){const t=e;return dm(n);function n(r){const i=r;let s;for(s in e)if(i[s]!==t[s])return!1;return!0}}function M8(e){return dm(t);function t(n){return n&&n.type===e}}function dm(e){return t;function t(n,r,i){return!!(D8(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function $8(){return!0}function D8(e){return e!==null&&typeof e=="object"&&"type"in e}const TP=[],F8=!0,kS=!1,z8="skip";function B8(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const s=IP(i),o=r?-1:1;l(e,void 0,[])();function l(c,d,u){const f=c&&typeof c=="object"?c:{};if(typeof f.type=="string"){const h=typeof f.tagName=="string"?f.tagName:typeof f.name=="string"?f.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(c.type+(h?"<"+h+">":""))+")"})}return p;function p(){let h=TP,g,b,S;if((!t||s(c,d,u[u.length-1]||void 0))&&(h=H8(n(c,u)),h[0]===kS))return h;if("children"in c&&c.children){const x=c;if(x.children&&h[0]!==z8)for(b=(r?x.children.length:-1)+o,S=u.concat(x);b>-1&&b<x.children.length;){const w=x.children[b];if(g=l(w,b,S)(),g[0]===kS)return g;b=typeof g[1]=="number"?g[1]:b+o}}return h}}}function H8(e){return Array.isArray(e)?e:typeof e=="number"?[F8,e]:e==null?TP:[e]}function RP(e,t,n,r){let i,s,o;typeof t=="function"&&typeof n!="function"?(s=void 0,o=t,i=n):(s=t,o=n,i=r),B8(e,s,l,i);function l(c,d){const u=d[d.length-1],f=u?u.children.indexOf(c):void 0;return o(c,f,u)}}const Ax={}.hasOwnProperty,U8={};function W8(e,t){const n=t||U8,r=new Map,i=new Map,s=new Map,o={...C8,...n.handlers},l={all:d,applyData:K8,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:c,options:n,patch:V8,wrap:Y8};return RP(e,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const f=u.type==="definition"?r:i,p=String(u.identifier).toUpperCase();f.has(p)||f.set(p,u)}}),l;function c(u,f){const p=u.type,h=l.handlers[p];if(Ax.call(l.handlers,p)&&h)return h(l,u,f);if(l.options.passThrough&&l.options.passThrough.includes(p)){if("children"in u){const{children:b,...S}=u,x=ph(S);return x.children=l.all(u),x}return ph(u)}return(l.options.unknownHandler||q8)(l,u,f)}function d(u){const f=[];if("children"in u){const p=u.children;let h=-1;for(;++h<p.length;){const g=l.one(p[h],u);if(g){if(h&&p[h-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=SS(g.value)),!Array.isArray(g)&&g.type==="element")){const b=g.children[0];b&&b.type==="text"&&(b.value=SS(b.value))}Array.isArray(g)?f.push(...g):f.push(g)}}}return f}}function V8(e,t){e.position&&(t.position=_B(e))}function K8(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,s=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const o="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:o}}n.type==="element"&&s&&Object.assign(n.properties,ph(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function q8(e,t){const n=t.data||{},r="value"in t&&!(Ax.call(n,"hProperties")||Ax.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Y8(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 SS(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function NS(e,t){const n=W8(e,t),r=n.one(e,void 0),i=R8(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
|
|
79
|
-
`},i),s}function G8(e,t){return e&&"run"in e?async function(n,r){const i=NS(n,{file:r,...t});await e.run(i,r)}:function(n,r){return NS(n,{file:r,...e||t})}}function jS(e){if(e)throw e}var Cp=Object.prototype.hasOwnProperty,LP=Object.prototype.toString,CS=Object.defineProperty,ES=Object.getOwnPropertyDescriptor,_S=function(t){return typeof Array.isArray=="function"?Array.isArray(t):LP.call(t)==="[object Array]"},PS=function(t){if(!t||LP.call(t)!=="[object Object]")return!1;var n=Cp.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Cp.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||Cp.call(t,i)},AS=function(t,n){CS&&n.name==="__proto__"?CS(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},IS=function(t,n){if(n==="__proto__")if(Cp.call(t,n)){if(ES)return ES(t,n).value}else return;return t[n]},X8=function e(){var t,n,r,i,s,o,l=arguments[0],c=1,d=arguments.length,u=!1;for(typeof l=="boolean"&&(u=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=IS(l,n),i=IS(t,n),l!==i&&(u&&i&&(PS(i)||(s=_S(i)))?(s?(s=!1,o=r&&_S(r)?r:[]):o=r&&PS(r)?r:{},AS(l,{name:n,newValue:e(u,o,i)})):typeof i<"u"&&AS(l,{name:n,newValue:i}));return l};const Lg=Xo(X8);function Ix(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 J8(){const e=[],t={run:n,use:r};return t;function n(...i){let s=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);l(null,...i);function l(c,...d){const u=e[++s];let f=-1;if(c){o(c);return}for(;++f<i.length;)(d[f]===null||d[f]===void 0)&&(d[f]=i[f]);i=d,u?Q8(u,l)(...d):o(null,...d)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function Q8(e,t){let n;return r;function r(...o){const l=e.length>o.length;let c;l&&o.push(i);try{c=e.apply(this,o)}catch(d){const u=d;if(l&&n)throw u;return i(u)}l||(c&&c.then&&typeof c.then=="function"?c.then(s,i):c instanceof Error?i(c):s(c))}function i(o,...l){n||(n=!0,t(o,...l))}function s(o){i(null,o)}}const ps={basename:Z8,dirname:e6,extname:t6,join:n6,sep:"/"};function Z8(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Rd(e);let n=0,r=-1,i=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,l=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else o<0&&(s=!0,o=i+1),l>-1&&(e.codePointAt(i)===t.codePointAt(l--)?l<0&&(r=i):(l=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function e6(e){if(Rd(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 t6(e){Rd(e);let t=e.length,n=-1,r=0,i=-1,s=0,o;for(;t--;){const l=e.codePointAt(t);if(l===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),l===46?i<0?i=t:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function n6(...e){let t=-1,n;for(;++t<e.length;)Rd(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":r6(n)}function r6(e){Rd(e);const t=e.codePointAt(0)===47;let n=i6(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function i6(e,t){let n="",r=0,i=-1,s=0,o=-1,l,c;for(;++o<=e.length;){if(o<e.length)l=e.codePointAt(o);else{if(l===47)break;l=47}if(l===47){if(!(i===o-1||s===1))if(i!==o-1&&s===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("/")),i=o,s=0;continue}}else if(n.length>0){n="",r=0,i=o,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,s=0}else l===46&&s>-1?s++:s=-1}return n}function Rd(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const s6={cwd:o6};function o6(){return"/"}function Tx(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function a6(e){if(typeof e=="string")e=new URL(e);else if(!Tx(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 l6(e)}function l6(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 i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const Og=["history","path","basename","stem","extname","dirname"];class OP{constructor(t){let n;t?Tx(t)?n={path:t}:typeof t=="string"||c6(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":s6.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Og.length;){const s=Og[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)Og.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?ps.basename(this.path):void 0}set basename(t){$g(t,"basename"),Mg(t,"basename"),this.path=ps.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?ps.dirname(this.path):void 0}set dirname(t){TS(this.basename,"dirname"),this.path=ps.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?ps.extname(this.path):void 0}set extname(t){if(Mg(t,"extname"),TS(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=ps.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Tx(t)&&(t=a6(t)),$g(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?ps.basename(this.path,this.extname):void 0}set stem(t){$g(t,"stem"),Mg(t,"stem"),this.path=ps.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new gr(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Mg(e,t){if(e&&e.includes(ps.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ps.sep+"`")}function $g(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function TS(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function c6(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const u6=function(e){const r=this.constructor.prototype,i=r[e],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s},d6={}.hasOwnProperty;class Nv extends u6{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=J8()}copy(){const t=new Nv;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Lg(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(zg("data",this.frozen),this.namespace[t]=n,this):d6.call(this.namespace,t)&&this.namespace[t]||void 0:t?(zg("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 i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Gf(t),r=this.parser||this.Parser;return Dg("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Dg("process",this.parser||this.Parser),Fg("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,o){const l=Gf(t),c=r.parse(l);r.run(c,l,function(u,f,p){if(u||!f||!p)return d(u);const h=f,g=r.stringify(h,p);h6(g)?p.value=g:p.result=g,d(u,p)});function d(u,f){u||!f?o(u):s?s(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),Dg("processSync",this.parser||this.Parser),Fg("processSync",this.compiler||this.Compiler),this.process(t,i),LS("processSync","process",n),r;function i(s,o){n=!0,jS(s),r=o}}run(t,n,r){RS(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(o,l){const c=Gf(n);i.run(t,c,d);function d(u,f,p){const h=f||t;u?l(u):o?o(h):r(void 0,h,p)}}}runSync(t,n){let r=!1,i;return this.run(t,n,s),LS("runSync","run",r),i;function s(o,l){jS(o),i=l,r=!0}}stringify(t,n){this.freeze();const r=Gf(n),i=this.compiler||this.Compiler;return Fg("stringify",i),RS(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(zg("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function s(d){if(typeof d=="function")c(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[u,...f]=d;c(u,f)}else o(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function o(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&&(i.settings=Lg(!0,i.settings,d.settings))}function l(d){let u=-1;if(d!=null)if(Array.isArray(d))for(;++u<d.length;){const f=d[u];s(f)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function c(d,u){let f=-1,p=-1;for(;++f<r.length;)if(r[f][0]===d){p=f;break}if(p===-1)r.push([d,...u]);else if(u.length>0){let[h,...g]=u;const b=r[p][1];Ix(b)&&Ix(h)&&(h=Lg(!0,b,h)),r[p]=[d,h,...g]}}}}const f6=new Nv().freeze();function Dg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Fg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function zg(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 RS(e){if(!Ix(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function LS(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Gf(e){return p6(e)?e:new OP(e)}function p6(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function h6(e){return typeof e=="string"||m6(e)}function m6(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const g6="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",OS=[],MS={allowDangerousHtml:!0},y6=/^(https?|ircs?|mailto|xmpp)$/i,x6=[{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 Ld(e){const t=w6(e),n=v6(e);return b6(t.runSync(t.parse(n),n),e)}function w6(e){const t=e.rehypePlugins||OS,n=e.remarkPlugins||OS,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...MS}:MS;return f6().use(e8).use(n).use(G8,r).use(t)}function v6(e){const t=e.children||"",n=new OP;return typeof t=="string"&&(n.value=t),n}function b6(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,s=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||k6;for(const u of x6)Object.hasOwn(t,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+g6+u.id,void 0);return RP(e,d),RB(e,{Fragment:a.Fragment,components:i,ignoreInvalidStyle:!0,jsx:a.jsx,jsxs:a.jsxs,passKeys:!0,passNode:!0});function d(u,f,p){if(u.type==="raw"&&p&&typeof f=="number")return o?p.children.splice(f,1):p.children[f]={type:"text",value:u.value},f;if(u.type==="element"){let h;for(h in Ig)if(Object.hasOwn(Ig,h)&&Object.hasOwn(u.properties,h)){const g=u.properties[h],b=Ig[h];(b===null||b.includes(u.tagName))&&(u.properties[h]=c(String(g||""),h,u))}}if(u.type==="element"){let h=n?!n.includes(u.tagName):s?s.includes(u.tagName):!1;if(!h&&r&&typeof f=="number"&&(h=!r(u,f,p)),h&&p&&typeof f=="number")return l&&u.children?p.children.splice(f,1,...u.children):p.children.splice(f,1),f}}}function k6(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||y6.test(e.slice(0,t))?e:""}function S6(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function hh(e){if(e==null)return"null";if(typeof e!="object")return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(r=>hh(r)).join(",")}]`;const t=e;return`{${Object.keys(t).sort().map(r=>`${JSON.stringify(r)}:${hh(t[r])}`).join(",")}}`}function $S(e){return hh({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 cd(e){const t=e.sourceHandle??"",n=e.targetHandle??"";return`${e.source}|${t}|${e.target}|${n}`}function DS(e){return hh({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 FS(e,t){return!S6(t)||!("selected"in t)||t.selected===e.selected?e:{...e,selected:!!t.selected}}function zS(e,t=!1){const n=new Map;for(const r of e){const i=cd(r);if(t&&n.has(i))throw new Error(`存在重复连线键: ${i}`);n.set(i,r)}return n}function N6(e,t,n,r){const i=new Map(e.map(w=>[w.id,w])),s=new Set(n.map(w=>w.id)),o=new Set,l=[],c=[],d=n.map(w=>{const v=i.get(w.id);return v?$S(v)===$S(w)?(o.add(w.id),v):(c.push(w.id),FS(w,v)):(l.push(w.id),w)}),u=zS(t),f=zS(r,!0),p=new Set,h=[],g=[],b=r.map(w=>{const v=cd(w),k=u.get(v);return k?DS(k)===DS(w)?(p.add(v),k):(g.push(v),FS(w,k)):(h.push(v),w)}),S=e.filter(w=>!s.has(w.id)).map(w=>w.id),x=t.map(w=>cd(w)).filter(w=>!f.has(w));return{nodes:d,edges:b,changes:{addedNodeIds:l,updatedNodeIds:c,removedNodeIds:S,addedEdgeKeys:h,updatedEdgeKeys:g,removedEdgeKeys:x},stats:{nodeAdded:l.length,nodeRemoved:S.length,nodeReused:o.size,edgeAdded:h.length,edgeRemoved:x.length,edgeReused:p.size,nextEdgeCount:f.size}}}/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */function MP(e){return typeof e>"u"||e===null}function j6(e){return typeof e=="object"&&e!==null}function C6(e){return Array.isArray(e)?e:MP(e)?[]:[e]}function E6(e,t){var n,r,i,s;if(t)for(s=Object.keys(t),n=0,r=s.length;n<r;n+=1)i=s[n],e[i]=t[i];return e}function _6(e,t){var n="",r;for(r=0;r<t;r+=1)n+=e;return n}function P6(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var A6=MP,I6=j6,T6=C6,R6=_6,L6=P6,O6=E6,Un={isNothing:A6,isObject:I6,toArray:T6,repeat:R6,isNegativeZero:L6,extend:O6};function $P(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 ud(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=$P(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}ud.prototype=Object.create(Error.prototype);ud.prototype.constructor=ud;ud.prototype.toString=function(t){return this.name+": "+$P(this,t)};var _r=ud;function Bg(e,t,n,r,i){var s="",o="",l=Math.floor(i/2)-1;return r-t>l&&(s=" ... ",t=r-l+s.length),n-r>l&&(o=" ...",n=r+l-o.length),{str:s+e.slice(t,n).replace(/\t/g,"→")+o,pos:r-t+s.length}}function Hg(e,t){return Un.repeat(" ",t-e.length)+e}function M6(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],i=[],s,o=-1;s=n.exec(e.buffer);)i.push(s.index),r.push(s.index+s[0].length),e.position<=s.index&&o<0&&(o=r.length-2);o<0&&(o=r.length-1);var l="",c,d,u=Math.min(e.line+t.linesAfter,i.length).toString().length,f=t.maxLength-(t.indent+u+3);for(c=1;c<=t.linesBefore&&!(o-c<0);c++)d=Bg(e.buffer,r[o-c],i[o-c],e.position-(r[o]-r[o-c]),f),l=Un.repeat(" ",t.indent)+Hg((e.line-c+1).toString(),u)+" | "+d.str+`
|
|
82
|
-
`+l;for(d=Bg(e.buffer,r[o],i[o],e.position,f),l+=Un.repeat(" ",t.indent)+Hg((e.line+1).toString(),u)+" | "+d.str+`
|
|
83
|
-
`,l+=Un.repeat("-",t.indent+u+3+d.pos)+`^
|
|
84
|
-
`,c=1;c<=t.linesAfter&&!(o+c>=i.length);c++)d=Bg(e.buffer,r[o+c],i[o+c],e.position-(r[o]-r[o+c]),f),l+=Un.repeat(" ",t.indent)+Hg((e.line+c+1).toString(),u)+" | "+d.str+`
|
|
85
|
-
`;return l.replace(/\n$/,"")}var $6=M6,D6=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],F6=["scalar","sequence","mapping"];function z6(e){var t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(r){t[String(r)]=n})}),t}function B6(e,t){if(t=t||{},Object.keys(t).forEach(function(n){if(D6.indexOf(n)===-1)throw new _r('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=z6(t.styleAliases||null),F6.indexOf(this.kind)===-1)throw new _r('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var ir=B6;function BS(e,t){var n=[];return e[t].forEach(function(r){var i=n.length;n.forEach(function(s,o){s.tag===r.tag&&s.kind===r.kind&&s.multi===r.multi&&(i=o)}),n[i]=r}),n}function H6(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},t,n;function r(i){i.multi?(e.multi[i.kind].push(i),e.multi.fallback.push(i)):e[i.kind][i.tag]=e.fallback[i.tag]=i}for(t=0,n=arguments.length;t<n;t+=1)arguments[t].forEach(r);return e}function Rx(e){return this.extend(e)}Rx.prototype.extend=function(t){var n=[],r=[];if(t instanceof ir)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 _r("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(s){if(!(s instanceof ir))throw new _r("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(s.loadKind&&s.loadKind!=="scalar")throw new _r("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(s.multi)throw new _r("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),r.forEach(function(s){if(!(s instanceof ir))throw new _r("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(Rx.prototype);return i.implicit=(this.implicit||[]).concat(n),i.explicit=(this.explicit||[]).concat(r),i.compiledImplicit=BS(i,"implicit"),i.compiledExplicit=BS(i,"explicit"),i.compiledTypeMap=H6(i.compiledImplicit,i.compiledExplicit),i};var DP=Rx,FP=new ir("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),zP=new ir("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),BP=new ir("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),HP=new DP({explicit:[FP,zP,BP]});function U6(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function W6(){return null}function V6(e){return e===null}var UP=new ir("tag:yaml.org,2002:null",{kind:"scalar",resolve:U6,construct:W6,predicate:V6,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function K6(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 q6(e){return e==="true"||e==="True"||e==="TRUE"}function Y6(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var WP=new ir("tag:yaml.org,2002:bool",{kind:"scalar",resolve:K6,construct:q6,predicate:Y6,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 G6(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function X6(e){return 48<=e&&e<=55}function J6(e){return 48<=e&&e<=57}function Q6(e){if(e===null)return!1;var t=e.length,n=0,r=!1,i;if(!t)return!1;if(i=e[n],(i==="-"||i==="+")&&(i=e[++n]),i==="0"){if(n+1===t)return!0;if(i=e[++n],i==="b"){for(n++;n<t;n++)if(i=e[n],i!=="_"){if(i!=="0"&&i!=="1")return!1;r=!0}return r&&i!=="_"}if(i==="x"){for(n++;n<t;n++)if(i=e[n],i!=="_"){if(!G6(e.charCodeAt(n)))return!1;r=!0}return r&&i!=="_"}if(i==="o"){for(n++;n<t;n++)if(i=e[n],i!=="_"){if(!X6(e.charCodeAt(n)))return!1;r=!0}return r&&i!=="_"}}if(i==="_")return!1;for(;n<t;n++)if(i=e[n],i!=="_"){if(!J6(e.charCodeAt(n)))return!1;r=!0}return!(!r||i==="_")}function Z6(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 e9(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!Un.isNegativeZero(e)}var VP=new ir("tag:yaml.org,2002:int",{kind:"scalar",resolve:Q6,construct:Z6,predicate:e9,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"]}}),t9=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function n9(e){return!(e===null||!t9.test(e)||e[e.length-1]==="_")}function r9(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 i9=/^[-+]?[0-9]+e/;function s9(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(Un.isNegativeZero(e))return"-0.0";return n=e.toString(10),i9.test(n)?n.replace("e",".e"):n}function o9(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||Un.isNegativeZero(e))}var KP=new ir("tag:yaml.org,2002:float",{kind:"scalar",resolve:n9,construct:r9,predicate:o9,represent:s9,defaultStyle:"lowercase"}),qP=HP.extend({implicit:[UP,WP,VP,KP]}),YP=qP,GP=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),XP=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 a9(e){return e===null?!1:GP.exec(e)!==null||XP.exec(e)!==null}function l9(e){var t,n,r,i,s,o,l,c=0,d=null,u,f,p;if(t=GP.exec(e),t===null&&(t=XP.exec(e)),t===null)throw new Error("Date resolve error");if(n=+t[1],r=+t[2]-1,i=+t[3],!t[4])return new Date(Date.UTC(n,r,i));if(s=+t[4],o=+t[5],l=+t[6],t[7]){for(c=t[7].slice(0,3);c.length<3;)c+="0";c=+c}return t[9]&&(u=+t[10],f=+(t[11]||0),d=(u*60+f)*6e4,t[9]==="-"&&(d=-d)),p=new Date(Date.UTC(n,r,i,s,o,l,c)),d&&p.setTime(p.getTime()-d),p}function c9(e){return e.toISOString()}var JP=new ir("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:a9,construct:l9,instanceOf:Date,represent:c9});function u9(e){return e==="<<"||e===null}var QP=new ir("tag:yaml.org,2002:merge",{kind:"scalar",resolve:u9}),jv=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
86
|
-
\r`;function d9(e){if(e===null)return!1;var t,n,r=0,i=e.length,s=jv;for(n=0;n<i;n++)if(t=s.indexOf(e.charAt(n)),!(t>64)){if(t<0)return!1;r+=6}return r%8===0}function f9(e){var t,n,r=e.replace(/[\r\n=]/g,""),i=r.length,s=jv,o=0,l=[];for(t=0;t<i;t++)t%4===0&&t&&(l.push(o>>16&255),l.push(o>>8&255),l.push(o&255)),o=o<<6|s.indexOf(r.charAt(t));return n=i%4*6,n===0?(l.push(o>>16&255),l.push(o>>8&255),l.push(o&255)):n===18?(l.push(o>>10&255),l.push(o>>2&255)):n===12&&l.push(o>>4&255),new Uint8Array(l)}function p9(e){var t="",n=0,r,i,s=e.length,o=jv;for(r=0;r<s;r++)r%3===0&&r&&(t+=o[n>>18&63],t+=o[n>>12&63],t+=o[n>>6&63],t+=o[n&63]),n=(n<<8)+e[r];return i=s%3,i===0?(t+=o[n>>18&63],t+=o[n>>12&63],t+=o[n>>6&63],t+=o[n&63]):i===2?(t+=o[n>>10&63],t+=o[n>>4&63],t+=o[n<<2&63],t+=o[64]):i===1&&(t+=o[n>>2&63],t+=o[n<<4&63],t+=o[64],t+=o[64]),t}function h9(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var ZP=new ir("tag:yaml.org,2002:binary",{kind:"scalar",resolve:d9,construct:f9,predicate:h9,represent:p9}),m9=Object.prototype.hasOwnProperty,g9=Object.prototype.toString;function y9(e){if(e===null)return!0;var t=[],n,r,i,s,o,l=e;for(n=0,r=l.length;n<r;n+=1){if(i=l[n],o=!1,g9.call(i)!=="[object Object]")return!1;for(s in i)if(m9.call(i,s))if(!o)o=!0;else return!1;if(!o)return!1;if(t.indexOf(s)===-1)t.push(s);else return!1}return!0}function x9(e){return e!==null?e:[]}var eA=new ir("tag:yaml.org,2002:omap",{kind:"sequence",resolve:y9,construct:x9}),w9=Object.prototype.toString;function v9(e){if(e===null)return!0;var t,n,r,i,s,o=e;for(s=new Array(o.length),t=0,n=o.length;t<n;t+=1){if(r=o[t],w9.call(r)!=="[object Object]"||(i=Object.keys(r),i.length!==1))return!1;s[t]=[i[0],r[i[0]]]}return!0}function b9(e){if(e===null)return[];var t,n,r,i,s,o=e;for(s=new Array(o.length),t=0,n=o.length;t<n;t+=1)r=o[t],i=Object.keys(r),s[t]=[i[0],r[i[0]]];return s}var tA=new ir("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:v9,construct:b9}),k9=Object.prototype.hasOwnProperty;function S9(e){if(e===null)return!0;var t,n=e;for(t in n)if(k9.call(n,t)&&n[t]!==null)return!1;return!0}function N9(e){return e!==null?e:{}}var nA=new ir("tag:yaml.org,2002:set",{kind:"mapping",resolve:S9,construct:N9}),Cv=YP.extend({implicit:[JP,QP],explicit:[ZP,eA,tA,nA]}),Ko=Object.prototype.hasOwnProperty,mh=1,rA=2,iA=3,gh=4,Ug=1,j9=2,HS=3,C9=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,E9=/[\x85\u2028\u2029]/,_9=/[,\[\]\{\}]/,sA=/^(?:!|!!|![a-z\-]+!)$/i,oA=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function US(e){return Object.prototype.toString.call(e)}function Ss(e){return e===10||e===13}function Aa(e){return e===9||e===32}function Br(e){return e===9||e===32||e===10||e===13}function Rl(e){return e===44||e===91||e===93||e===123||e===125}function P9(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}function A9(e){return e===120?2:e===117?4:e===85?8:0}function I9(e){return 48<=e&&e<=57?e-48:-1}function WS(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 T9(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function aA(e,t,n){t==="__proto__"?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:n}):e[t]=n}var lA=new Array(256),cA=new Array(256);for(var fl=0;fl<256;fl++)lA[fl]=WS(fl)?1:0,cA[fl]=WS(fl);function R9(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||Cv,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 uA(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=$6(n),new _r(t,n)}function Ve(e,t){throw uA(e,t)}function yh(e,t){e.onWarning&&e.onWarning.call(null,uA(e,t))}var VS={YAML:function(t,n,r){var i,s,o;t.version!==null&&Ve(t,"duplication of %YAML directive"),r.length!==1&&Ve(t,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(r[0]),i===null&&Ve(t,"ill-formed argument of the YAML directive"),s=parseInt(i[1],10),o=parseInt(i[2],10),s!==1&&Ve(t,"unacceptable YAML version of the document"),t.version=r[0],t.checkLineBreaks=o<2,o!==1&&o!==2&&yh(t,"unsupported YAML version of the document")},TAG:function(t,n,r){var i,s;r.length!==2&&Ve(t,"TAG directive accepts exactly two arguments"),i=r[0],s=r[1],sA.test(i)||Ve(t,"ill-formed tag handle (first argument) of the TAG directive"),Ko.call(t.tagMap,i)&&Ve(t,'there is a previously declared suffix for "'+i+'" tag handle'),oA.test(s)||Ve(t,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch{Ve(t,"tag prefix is malformed: "+s)}t.tagMap[i]=s}};function Ho(e,t,n,r){var i,s,o,l;if(t<n){if(l=e.input.slice(t,n),r)for(i=0,s=l.length;i<s;i+=1)o=l.charCodeAt(i),o===9||32<=o&&o<=1114111||Ve(e,"expected valid JSON character");else C9.test(l)&&Ve(e,"the stream contains non-printable characters");e.result+=l}}function KS(e,t,n,r){var i,s,o,l;for(Un.isObject(n)||Ve(e,"cannot merge mappings; the provided source object is unacceptable"),i=Object.keys(n),o=0,l=i.length;o<l;o+=1)s=i[o],Ko.call(t,s)||(aA(t,s,n[s]),r[s]=!0)}function Ll(e,t,n,r,i,s,o,l,c){var d,u;if(Array.isArray(i))for(i=Array.prototype.slice.call(i),d=0,u=i.length;d<u;d+=1)Array.isArray(i[d])&&Ve(e,"nested arrays are not supported inside keys"),typeof i=="object"&&US(i[d])==="[object Object]"&&(i[d]="[object Object]");if(typeof i=="object"&&US(i)==="[object Object]"&&(i="[object Object]"),i=String(i),t===null&&(t={}),r==="tag:yaml.org,2002:merge")if(Array.isArray(s))for(d=0,u=s.length;d<u;d+=1)KS(e,t,s[d],n);else KS(e,t,s,n);else!e.json&&!Ko.call(n,i)&&Ko.call(t,i)&&(e.line=o||e.line,e.lineStart=l||e.lineStart,e.position=c||e.position,Ve(e,"duplicated mapping key")),aA(t,i,s),delete n[i];return t}function Ev(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++):Ve(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function Rn(e,t,n){for(var r=0,i=e.input.charCodeAt(e.position);i!==0;){for(;Aa(i);)i===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),i=e.input.charCodeAt(++e.position);if(t&&i===35)do i=e.input.charCodeAt(++e.position);while(i!==10&&i!==13&&i!==0);if(Ss(i))for(Ev(e),i=e.input.charCodeAt(e.position),r++,e.lineIndent=0;i===32;)e.lineIndent++,i=e.input.charCodeAt(++e.position);else break}return n!==-1&&r!==0&&e.lineIndent<n&&yh(e,"deficient indentation"),r}function fm(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||Br(n)))}function _v(e,t){t===1?e.result+=" ":t>1&&(e.result+=Un.repeat(`
|
|
88
|
-
`,t-1))}function L9(e,t,n){var r,i,s,o,l,c,d,u,f=e.kind,p=e.result,h;if(h=e.input.charCodeAt(e.position),Br(h)||Rl(h)||h===35||h===38||h===42||h===33||h===124||h===62||h===39||h===34||h===37||h===64||h===96||(h===63||h===45)&&(i=e.input.charCodeAt(e.position+1),Br(i)||n&&Rl(i)))return!1;for(e.kind="scalar",e.result="",s=o=e.position,l=!1;h!==0;){if(h===58){if(i=e.input.charCodeAt(e.position+1),Br(i)||n&&Rl(i))break}else if(h===35){if(r=e.input.charCodeAt(e.position-1),Br(r))break}else{if(e.position===e.lineStart&&fm(e)||n&&Rl(h))break;if(Ss(h))if(c=e.line,d=e.lineStart,u=e.lineIndent,Rn(e,!1,-1),e.lineIndent>=t){l=!0,h=e.input.charCodeAt(e.position);continue}else{e.position=o,e.line=c,e.lineStart=d,e.lineIndent=u;break}}l&&(Ho(e,s,o,!1),_v(e,e.line-c),s=o=e.position,l=!1),Aa(h)||(o=e.position+1),h=e.input.charCodeAt(++e.position)}return Ho(e,s,o,!1),e.result?!0:(e.kind=f,e.result=p,!1)}function O9(e,t){var n,r,i;if(n=e.input.charCodeAt(e.position),n!==39)return!1;for(e.kind="scalar",e.result="",e.position++,r=i=e.position;(n=e.input.charCodeAt(e.position))!==0;)if(n===39)if(Ho(e,r,e.position,!0),n=e.input.charCodeAt(++e.position),n===39)r=e.position,e.position++,i=e.position;else return!0;else Ss(n)?(Ho(e,r,i,!0),_v(e,Rn(e,!1,t)),r=i=e.position):e.position===e.lineStart&&fm(e)?Ve(e,"unexpected end of the document within a single quoted scalar"):(e.position++,i=e.position);Ve(e,"unexpected end of the stream within a single quoted scalar")}function M9(e,t){var n,r,i,s,o,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 Ho(e,n,e.position,!0),e.position++,!0;if(l===92){if(Ho(e,n,e.position,!0),l=e.input.charCodeAt(++e.position),Ss(l))Rn(e,!1,t);else if(l<256&&lA[l])e.result+=cA[l],e.position++;else if((o=A9(l))>0){for(i=o,s=0;i>0;i--)l=e.input.charCodeAt(++e.position),(o=P9(l))>=0?s=(s<<4)+o:Ve(e,"expected hexadecimal character");e.result+=T9(s),e.position++}else Ve(e,"unknown escape sequence");n=r=e.position}else Ss(l)?(Ho(e,n,r,!0),_v(e,Rn(e,!1,t)),n=r=e.position):e.position===e.lineStart&&fm(e)?Ve(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}Ve(e,"unexpected end of the stream within a double quoted scalar")}function $9(e,t){var n=!0,r,i,s,o=e.tag,l,c=e.anchor,d,u,f,p,h,g=Object.create(null),b,S,x,w;if(w=e.input.charCodeAt(e.position),w===91)u=93,h=!1,l=[];else if(w===123)u=125,h=!0,l={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=l),w=e.input.charCodeAt(++e.position);w!==0;){if(Rn(e,!0,t),w=e.input.charCodeAt(e.position),w===u)return e.position++,e.tag=o,e.anchor=c,e.kind=h?"mapping":"sequence",e.result=l,!0;n?w===44&&Ve(e,"expected the node content, but found ','"):Ve(e,"missed comma between flow collection entries"),S=b=x=null,f=p=!1,w===63&&(d=e.input.charCodeAt(e.position+1),Br(d)&&(f=p=!0,e.position++,Rn(e,!0,t))),r=e.line,i=e.lineStart,s=e.position,uc(e,t,mh,!1,!0),S=e.tag,b=e.result,Rn(e,!0,t),w=e.input.charCodeAt(e.position),(p||e.line===r)&&w===58&&(f=!0,w=e.input.charCodeAt(++e.position),Rn(e,!0,t),uc(e,t,mh,!1,!0),x=e.result),h?Ll(e,l,g,S,b,x,r,i,s):f?l.push(Ll(e,null,g,S,b,x,r,i,s)):l.push(b),Rn(e,!0,t),w=e.input.charCodeAt(e.position),w===44?(n=!0,w=e.input.charCodeAt(++e.position)):n=!1}Ve(e,"unexpected end of the stream within a flow collection")}function D9(e,t){var n,r,i=Ug,s=!1,o=!1,l=t,c=0,d=!1,u,f;if(f=e.input.charCodeAt(e.position),f===124)r=!1;else if(f===62)r=!0;else return!1;for(e.kind="scalar",e.result="";f!==0;)if(f=e.input.charCodeAt(++e.position),f===43||f===45)Ug===i?i=f===43?HS:j9:Ve(e,"repeat of a chomping mode identifier");else if((u=I9(f))>=0)u===0?Ve(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?Ve(e,"repeat of an indentation width identifier"):(l=t+u-1,o=!0);else break;if(Aa(f)){do f=e.input.charCodeAt(++e.position);while(Aa(f));if(f===35)do f=e.input.charCodeAt(++e.position);while(!Ss(f)&&f!==0)}for(;f!==0;){for(Ev(e),e.lineIndent=0,f=e.input.charCodeAt(e.position);(!o||e.lineIndent<l)&&f===32;)e.lineIndent++,f=e.input.charCodeAt(++e.position);if(!o&&e.lineIndent>l&&(l=e.lineIndent),Ss(f)){c++;continue}if(e.lineIndent<l){i===HS?e.result+=Un.repeat(`
|
|
89
|
-
`,s?1+c:c):i===Ug&&s&&(e.result+=`
|
|
90
|
-
`);break}for(r?Aa(f)?(d=!0,e.result+=Un.repeat(`
|
|
91
|
-
`,s?1+c:c)):d?(d=!1,e.result+=Un.repeat(`
|
|
92
|
-
`,c+1)):c===0?s&&(e.result+=" "):e.result+=Un.repeat(`
|
|
93
|
-
`,c):e.result+=Un.repeat(`
|
|
94
|
-
`,s?1+c:c),s=!0,o=!0,c=0,n=e.position;!Ss(f)&&f!==0;)f=e.input.charCodeAt(++e.position);Ho(e,n,e.position,!1)}return!0}function qS(e,t){var n,r=e.tag,i=e.anchor,s=[],o,l=!1,c;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=s),c=e.input.charCodeAt(e.position);c!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,Ve(e,"tab characters must not be used in indentation")),!(c!==45||(o=e.input.charCodeAt(e.position+1),!Br(o))));){if(l=!0,e.position++,Rn(e,!0,-1)&&e.lineIndent<=t){s.push(null),c=e.input.charCodeAt(e.position);continue}if(n=e.line,uc(e,t,iA,!1,!0),s.push(e.result),Rn(e,!0,-1),c=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&c!==0)Ve(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break}return l?(e.tag=r,e.anchor=i,e.kind="sequence",e.result=s,!0):!1}function F9(e,t,n){var r,i,s,o,l,c,d=e.tag,u=e.anchor,f={},p=Object.create(null),h=null,g=null,b=null,S=!1,x=!1,w;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=f),w=e.input.charCodeAt(e.position);w!==0;){if(!S&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,Ve(e,"tab characters must not be used in indentation")),r=e.input.charCodeAt(e.position+1),s=e.line,(w===63||w===58)&&Br(r))w===63?(S&&(Ll(e,f,p,h,g,null,o,l,c),h=g=b=null),x=!0,S=!0,i=!0):S?(S=!1,i=!0):Ve(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,w=r;else{if(o=e.line,l=e.lineStart,c=e.position,!uc(e,n,rA,!1,!0))break;if(e.line===s){for(w=e.input.charCodeAt(e.position);Aa(w);)w=e.input.charCodeAt(++e.position);if(w===58)w=e.input.charCodeAt(++e.position),Br(w)||Ve(e,"a whitespace character is expected after the key-value separator within a block mapping"),S&&(Ll(e,f,p,h,g,null,o,l,c),h=g=b=null),x=!0,S=!1,i=!1,h=e.tag,g=e.result;else if(x)Ve(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=d,e.anchor=u,!0}else if(x)Ve(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=d,e.anchor=u,!0}if((e.line===s||e.lineIndent>t)&&(S&&(o=e.line,l=e.lineStart,c=e.position),uc(e,t,gh,!0,i)&&(S?g=e.result:b=e.result),S||(Ll(e,f,p,h,g,b,o,l,c),h=g=b=null),Rn(e,!0,-1),w=e.input.charCodeAt(e.position)),(e.line===s||e.lineIndent>t)&&w!==0)Ve(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return S&&Ll(e,f,p,h,g,null,o,l,c),x&&(e.tag=d,e.anchor=u,e.kind="mapping",e.result=f),x}function z9(e){var t,n=!1,r=!1,i,s,o;if(o=e.input.charCodeAt(e.position),o!==33)return!1;if(e.tag!==null&&Ve(e,"duplication of a tag property"),o=e.input.charCodeAt(++e.position),o===60?(n=!0,o=e.input.charCodeAt(++e.position)):o===33?(r=!0,i="!!",o=e.input.charCodeAt(++e.position)):i="!",t=e.position,n){do o=e.input.charCodeAt(++e.position);while(o!==0&&o!==62);e.position<e.length?(s=e.input.slice(t,e.position),o=e.input.charCodeAt(++e.position)):Ve(e,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!Br(o);)o===33&&(r?Ve(e,"tag suffix cannot contain exclamation marks"):(i=e.input.slice(t-1,e.position+1),sA.test(i)||Ve(e,"named tag handle cannot contain such characters"),r=!0,t=e.position+1)),o=e.input.charCodeAt(++e.position);s=e.input.slice(t,e.position),_9.test(s)&&Ve(e,"tag suffix cannot contain flow indicator characters")}s&&!oA.test(s)&&Ve(e,"tag name cannot contain such characters: "+s);try{s=decodeURIComponent(s)}catch{Ve(e,"tag name is malformed: "+s)}return n?e.tag=s:Ko.call(e.tagMap,i)?e.tag=e.tagMap[i]+s:i==="!"?e.tag="!"+s:i==="!!"?e.tag="tag:yaml.org,2002:"+s:Ve(e,'undeclared tag handle "'+i+'"'),!0}function B9(e){var t,n;if(n=e.input.charCodeAt(e.position),n!==38)return!1;for(e.anchor!==null&&Ve(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;n!==0&&!Br(n)&&!Rl(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&Ve(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function H9(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&&!Br(r)&&!Rl(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&Ve(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),Ko.call(e.anchorMap,n)||Ve(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],Rn(e,!0,-1),!0}function uc(e,t,n,r,i){var s,o,l,c=1,d=!1,u=!1,f,p,h,g,b,S;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,s=o=l=gh===n||iA===n,r&&Rn(e,!0,-1)&&(d=!0,e.lineIndent>t?c=1:e.lineIndent===t?c=0:e.lineIndent<t&&(c=-1)),c===1)for(;z9(e)||B9(e);)Rn(e,!0,-1)?(d=!0,l=s,e.lineIndent>t?c=1:e.lineIndent===t?c=0:e.lineIndent<t&&(c=-1)):l=!1;if(l&&(l=d||i),(c===1||gh===n)&&(mh===n||rA===n?b=t:b=t+1,S=e.position-e.lineStart,c===1?l&&(qS(e,S)||F9(e,S,b))||$9(e,b)?u=!0:(o&&D9(e,b)||O9(e,b)||M9(e,b)?u=!0:H9(e)?(u=!0,(e.tag!==null||e.anchor!==null)&&Ve(e,"alias node should not have any properties")):L9(e,b,mh===n)&&(u=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):c===0&&(u=l&&qS(e,S))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&Ve(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),f=0,p=e.implicitTypes.length;f<p;f+=1)if(g=e.implicitTypes[f],g.resolve(e.result)){e.result=g.construct(e.result),e.tag=g.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(Ko.call(e.typeMap[e.kind||"fallback"],e.tag))g=e.typeMap[e.kind||"fallback"][e.tag];else for(g=null,h=e.typeMap.multi[e.kind||"fallback"],f=0,p=h.length;f<p;f+=1)if(e.tag.slice(0,h[f].tag.length)===h[f].tag){g=h[f];break}g||Ve(e,"unknown tag !<"+e.tag+">"),e.result!==null&&g.kind!==e.kind&&Ve(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+g.kind+'", not "'+e.kind+'"'),g.resolve(e.result,e.tag)?(e.result=g.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):Ve(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||u}function U9(e){var t=e.position,n,r,i,s=!1,o;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(o=e.input.charCodeAt(e.position))!==0&&(Rn(e,!0,-1),o=e.input.charCodeAt(e.position),!(e.lineIndent>0||o!==37));){for(s=!0,o=e.input.charCodeAt(++e.position),n=e.position;o!==0&&!Br(o);)o=e.input.charCodeAt(++e.position);for(r=e.input.slice(n,e.position),i=[],r.length<1&&Ve(e,"directive name must not be less than one character in length");o!==0;){for(;Aa(o);)o=e.input.charCodeAt(++e.position);if(o===35){do o=e.input.charCodeAt(++e.position);while(o!==0&&!Ss(o));break}if(Ss(o))break;for(n=e.position;o!==0&&!Br(o);)o=e.input.charCodeAt(++e.position);i.push(e.input.slice(n,e.position))}o!==0&&Ev(e),Ko.call(VS,r)?VS[r](e,r,i):yh(e,'unknown document directive "'+r+'"')}if(Rn(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,Rn(e,!0,-1)):s&&Ve(e,"directives end mark is expected"),uc(e,e.lineIndent-1,gh,!1,!0),Rn(e,!0,-1),e.checkLineBreaks&&E9.test(e.input.slice(t,e.position))&&yh(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&fm(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,Rn(e,!0,-1));return}if(e.position<e.length-1)Ve(e,"end of the stream or a document separator is expected");else return}function dA(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 R9(e,t),r=e.indexOf("\0");for(r!==-1&&(n.position=r,Ve(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;)U9(n);return n.documents}function W9(e,t,n){t!==null&&typeof t=="object"&&typeof n>"u"&&(n=t,t=null);var r=dA(e,n);if(typeof t!="function")return r;for(var i=0,s=r.length;i<s;i+=1)t(r[i])}function V9(e,t){var n=dA(e,t);if(n.length!==0){if(n.length===1)return n[0];throw new _r("expected a single document in the stream, but found more")}}var K9=W9,q9=V9,fA={loadAll:K9,load:q9},pA=Object.prototype.toString,hA=Object.prototype.hasOwnProperty,Pv=65279,Y9=9,dd=10,G9=13,X9=32,J9=33,Q9=34,Lx=35,Z9=37,eU=38,tU=39,nU=42,mA=44,rU=45,xh=58,iU=61,sU=62,oU=63,aU=64,gA=91,yA=93,lU=96,xA=123,cU=124,wA=125,yr={};yr[0]="\\0";yr[7]="\\a";yr[8]="\\b";yr[9]="\\t";yr[10]="\\n";yr[11]="\\v";yr[12]="\\f";yr[13]="\\r";yr[27]="\\e";yr[34]='\\"';yr[92]="\\\\";yr[133]="\\N";yr[160]="\\_";yr[8232]="\\L";yr[8233]="\\P";var uU=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],dU=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function fU(e,t){var n,r,i,s,o,l,c;if(t===null)return{};for(n={},r=Object.keys(t),i=0,s=r.length;i<s;i+=1)o=r[i],l=String(t[o]),o.slice(0,2)==="!!"&&(o="tag:yaml.org,2002:"+o.slice(2)),c=e.compiledTypeMap.fallback[o],c&&hA.call(c.styleAliases,l)&&(l=c.styleAliases[l]),n[o]=l;return n}function pU(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 _r("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+n+Un.repeat("0",r-t.length)+t}var hU=1,fd=2;function mU(e){this.schema=e.schema||Cv,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=Un.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=fU(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==='"'?fd:hU,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 YS(e,t){for(var n=Un.repeat(" ",t),r=0,i=-1,s="",o,l=e.length;r<l;)i=e.indexOf(`
|
|
96
|
-
`,r),i===-1?(o=e.slice(r),r=l):(o=e.slice(r,i+1),r=i+1),o.length&&o!==`
|
|
97
|
-
`&&(s+=n),s+=o;return s}function Ox(e,t){return`
|
|
98
|
-
`+Un.repeat(" ",e.indent*t)}function gU(e,t){var n,r,i;for(n=0,r=e.implicitTypes.length;n<r;n+=1)if(i=e.implicitTypes[n],i.resolve(t))return!0;return!1}function wh(e){return e===X9||e===Y9}function pd(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==Pv||65536<=e&&e<=1114111}function GS(e){return pd(e)&&e!==Pv&&e!==G9&&e!==dd}function XS(e,t,n){var r=GS(e),i=r&&!wh(e);return(n?r:r&&e!==mA&&e!==gA&&e!==yA&&e!==xA&&e!==wA)&&e!==Lx&&!(t===xh&&!i)||GS(t)&&!wh(t)&&e===Lx||t===xh&&i}function yU(e){return pd(e)&&e!==Pv&&!wh(e)&&e!==rU&&e!==oU&&e!==xh&&e!==mA&&e!==gA&&e!==yA&&e!==xA&&e!==wA&&e!==Lx&&e!==eU&&e!==nU&&e!==J9&&e!==cU&&e!==iU&&e!==sU&&e!==tU&&e!==Q9&&e!==Z9&&e!==aU&&e!==lU}function xU(e){return!wh(e)&&e!==xh}function pu(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 vA(e){var t=/^\n* /;return t.test(e)}var bA=1,Mx=2,kA=3,SA=4,gl=5;function wU(e,t,n,r,i,s,o,l){var c,d=0,u=null,f=!1,p=!1,h=r!==-1,g=-1,b=yU(pu(e,0))&&xU(pu(e,e.length-1));if(t||o)for(c=0;c<e.length;d>=65536?c+=2:c++){if(d=pu(e,c),!pd(d))return gl;b=b&&XS(d,u,l),u=d}else{for(c=0;c<e.length;d>=65536?c+=2:c++){if(d=pu(e,c),d===dd)f=!0,h&&(p=p||c-g-1>r&&e[g+1]!==" ",g=c);else if(!pd(d))return gl;b=b&&XS(d,u,l),u=d}p=p||h&&c-g-1>r&&e[g+1]!==" "}return!f&&!p?b&&!o&&!i(e)?bA:s===fd?gl:Mx:n>9&&vA(e)?gl:o?s===fd?gl:Mx:p?SA:kA}function vU(e,t,n,r,i){e.dump=function(){if(t.length===0)return e.quotingType===fd?'""':"''";if(!e.noCompatMode&&(uU.indexOf(t)!==-1||dU.test(t)))return e.quotingType===fd?'"'+t+'"':"'"+t+"'";var s=e.indent*Math.max(1,n),o=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-s),l=r||e.flowLevel>-1&&n>=e.flowLevel;function c(d){return gU(e,d)}switch(wU(t,l,e.indent,o,c,e.quotingType,e.forceQuotes&&!r,i)){case bA:return t;case Mx:return"'"+t.replace(/'/g,"''")+"'";case kA:return"|"+JS(t,e.indent)+QS(YS(t,s));case SA:return">"+JS(t,e.indent)+QS(YS(bU(t,o),s));case gl:return'"'+kU(t)+'"';default:throw new _r("impossible error: invalid scalar style")}}()}function JS(e,t){var n=vA(e)?String(t):"",r=e[e.length-1]===`
|
|
99
|
-
`,i=r&&(e[e.length-2]===`
|
|
100
|
-
`||e===`
|
|
101
|
-
`),s=i?"+":r?"":"-";return n+s+`
|
|
102
|
-
`}function QS(e){return e[e.length-1]===`
|
|
103
|
-
`?e.slice(0,-1):e}function bU(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,ZS(e.slice(0,d),t)}(),i=e[0]===`
|
|
105
|
-
`||e[0]===" ",s,o;o=n.exec(e);){var l=o[1],c=o[2];s=c[0]===" ",r+=l+(!i&&!s&&c!==""?`
|
|
106
|
-
`:"")+ZS(c,t),i=s}return r}function ZS(e,t){if(e===""||e[0]===" ")return e;for(var n=/ [^ ]/g,r,i=0,s,o=0,l=0,c="";r=n.exec(e);)l=r.index,l-i>t&&(s=o>i?o:l,c+=`
|
|
107
|
-
`+e.slice(i,s),i=s+1),o=l;return c+=`
|
|
108
|
-
`,e.length-i>t&&o>i?c+=e.slice(i,o)+`
|
|
109
|
-
`+e.slice(o+1):c+=e.slice(i),c.slice(1)}function kU(e){for(var t="",n=0,r,i=0;i<e.length;n>=65536?i+=2:i++)n=pu(e,i),r=yr[n],!r&&pd(n)?(t+=e[i],n>=65536&&(t+=e[i+1])):t+=r||pU(n);return t}function SU(e,t,n){var r="",i=e.tag,s,o,l;for(s=0,o=n.length;s<o;s+=1)l=n[s],e.replacer&&(l=e.replacer.call(n,String(s),l)),(eo(e,t,l,!1,!1)||typeof l>"u"&&eo(e,t,null,!1,!1))&&(r!==""&&(r+=","+(e.condenseFlow?"":" ")),r+=e.dump);e.tag=i,e.dump="["+r+"]"}function eN(e,t,n,r){var i="",s=e.tag,o,l,c;for(o=0,l=n.length;o<l;o+=1)c=n[o],e.replacer&&(c=e.replacer.call(n,String(o),c)),(eo(e,t+1,c,!0,!0,!1,!0)||typeof c>"u"&&eo(e,t+1,null,!0,!0,!1,!0))&&((!r||i!=="")&&(i+=Ox(e,t)),e.dump&&dd===e.dump.charCodeAt(0)?i+="-":i+="- ",i+=e.dump);e.tag=s,e.dump=i||"[]"}function NU(e,t,n){var r="",i=e.tag,s=Object.keys(n),o,l,c,d,u;for(o=0,l=s.length;o<l;o+=1)u="",r!==""&&(u+=", "),e.condenseFlow&&(u+='"'),c=s[o],d=n[c],e.replacer&&(d=e.replacer.call(n,c,d)),eo(e,t,c,!1,!1)&&(e.dump.length>1024&&(u+="? "),u+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),eo(e,t,d,!1,!1)&&(u+=e.dump,r+=u));e.tag=i,e.dump="{"+r+"}"}function jU(e,t,n,r){var i="",s=e.tag,o=Object.keys(n),l,c,d,u,f,p;if(e.sortKeys===!0)o.sort();else if(typeof e.sortKeys=="function")o.sort(e.sortKeys);else if(e.sortKeys)throw new _r("sortKeys must be a boolean or a function");for(l=0,c=o.length;l<c;l+=1)p="",(!r||i!=="")&&(p+=Ox(e,t)),d=o[l],u=n[d],e.replacer&&(u=e.replacer.call(n,d,u)),eo(e,t+1,d,!0,!0,!0)&&(f=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,f&&(e.dump&&dd===e.dump.charCodeAt(0)?p+="?":p+="? "),p+=e.dump,f&&(p+=Ox(e,t)),eo(e,t+1,u,!0,f)&&(e.dump&&dd===e.dump.charCodeAt(0)?p+=":":p+=": ",p+=e.dump,i+=p));e.tag=s,e.dump=i||"{}"}function tN(e,t,n){var r,i,s,o,l,c;for(i=n?e.explicitTypes:e.implicitTypes,s=0,o=i.length;s<o;s+=1)if(l=i[s],(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,pA.call(l.represent)==="[object Function]")r=l.represent(t,c);else if(hA.call(l.represent,c))r=l.represent[c](t,c);else throw new _r("!<"+l.tag+'> tag resolver accepts not "'+c+'" style');e.dump=r}return!0}return!1}function eo(e,t,n,r,i,s,o){e.tag=null,e.dump=n,tN(e,n,!1)||tN(e,n,!0);var l=pA.call(e.dump),c=r,d;r&&(r=e.flowLevel<0||e.flowLevel>t);var u=l==="[object Object]"||l==="[object Array]",f,p;if(u&&(f=e.duplicates.indexOf(n),p=f!==-1),(e.tag!==null&&e.tag!=="?"||p||e.indent!==2&&t>0)&&(i=!1),p&&e.usedDuplicates[f])e.dump="*ref_"+f;else{if(u&&p&&!e.usedDuplicates[f]&&(e.usedDuplicates[f]=!0),l==="[object Object]")r&&Object.keys(e.dump).length!==0?(jU(e,t,e.dump,i),p&&(e.dump="&ref_"+f+e.dump)):(NU(e,t,e.dump),p&&(e.dump="&ref_"+f+" "+e.dump));else if(l==="[object Array]")r&&e.dump.length!==0?(e.noArrayIndent&&!o&&t>0?eN(e,t-1,e.dump,i):eN(e,t,e.dump,i),p&&(e.dump="&ref_"+f+e.dump)):(SU(e,t,e.dump),p&&(e.dump="&ref_"+f+" "+e.dump));else if(l==="[object String]")e.tag!=="?"&&vU(e,e.dump,t,s,c);else{if(l==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new _r("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 CU(e,t){var n=[],r=[],i,s;for($x(e,n,r),i=0,s=r.length;i<s;i+=1)t.duplicates.push(n[r[i]]);t.usedDuplicates=new Array(s)}function $x(e,t,n){var r,i,s;if(e!==null&&typeof e=="object")if(i=t.indexOf(e),i!==-1)n.indexOf(i)===-1&&n.push(i);else if(t.push(e),Array.isArray(e))for(i=0,s=e.length;i<s;i+=1)$x(e[i],t,n);else for(r=Object.keys(e),i=0,s=r.length;i<s;i+=1)$x(e[r[i]],t,n)}function EU(e,t){t=t||{};var n=new mU(t);n.noRefs||CU(e,n);var r=e;return n.replacer&&(r=n.replacer.call({"":r},"",r)),eo(n,0,r,!0,!0)?n.dump+`
|
|
110
|
-
`:""}var _U=EU,PU={dump:_U};function Av(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 AU=ir,IU=DP,TU=HP,RU=qP,LU=YP,OU=Cv,MU=fA.load,$U=fA.loadAll,DU=PU.dump,FU=_r,zU={binary:ZP,float:KP,map:BP,null:UP,pairs:tA,set:nA,timestamp:JP,bool:WP,int:VP,merge:QP,omap:eA,seq:zP,str:FP},BU=Av("safeLoad","load"),HU=Av("safeLoadAll","loadAll"),UU=Av("safeDump","dump"),NA={Type:AU,Schema:IU,FAILSAFE_SCHEMA:TU,JSON_SCHEMA:RU,CORE_SCHEMA:LU,DEFAULT_SCHEMA:OU,load:MU,loadAll:$U,dump:DU,YAMLException:FU,types:zU,safeLoad:BU,safeLoadAll:HU,safeDump:UU};const qo=["requirement","planning","code","test","normal"],Dx={普通:"normal",技术规划:"planning",代码执行:"code",测试回归:"test",需求拆解:"requirement"},WU=["agent","control","provide","condition","jump","condition_jump","start","end"];function VU(e){return WU.includes(e)?e:"agent"}function KU(e){const t=(e||"").toLowerCase();return t.startsWith("control_")?"control":t.startsWith("agent_")?"agent":t.startsWith("provide_")?"provide":(t.startsWith("tool_"),"agent")}function qU(e){var t;if(!(e!=null&&e.trim()))return{nodes:[],edges:[],instances:{}};try{const n=NA.load(e);if(!n||typeof n!="object")return{error:"flow.yaml 格式无效:根内容不是对象"};const r=n,i=r.instances&&typeof r.instances=="object"?r.instances:{},s=Array.isArray(r.edges)?r.edges:Array.isArray((t=r.flow)==null?void 0:t.edges)?r.flow.edges:[],o=r.ui&&typeof r.ui=="object"?r.ui:{},l=o.nodePositions&&typeof o.nodePositions=="object"?o.nodePositions:{},c=typeof o.description=="string"&&o.description.trim()?o.description.trim():void 0,d=new Set(Object.keys(i));for(const p of s)p!=null&&p.source&&d.add(String(p.source)),p!=null&&p.target&&d.add(String(p.target));const u=Array.from(d).map(p=>{const h=i[p],g=l[p]&&typeof l[p].x=="number"&&typeof l[p].y=="number"?{x:l[p].x,y:l[p].y}:{x:0,y:0},b=(h==null?void 0:h.definitionId)??p,S=KU(b),x=(h==null?void 0:h.label)!=null?String(h.label):p,w=(h==null?void 0:h.role)!=null?String(h.role).trim():"",v=Dx[w]||w,k=qo.includes(v)?v:"normal",E=(h==null?void 0:h.model)!=null?String(h.model).trim():void 0,j=(h==null?void 0:h.body)!=null?String(h.body):"",A=(h==null?void 0:h.script)!=null?String(h.script):"",$=Array.isArray(h==null?void 0:h.images)?h.images:[];return{id:p,type:VU(S),position:g,data:{label:x,definitionId:b,schemaType:S,role:k,model:E||void 0,body:j,images:$,...A.trim()!==""?{script:A}:{}}}}),f=s.filter(p=>(p==null?void 0:p.source)&&(p==null?void 0:p.target)).map((p,h)=>({id:`e-${p.source}-${p.target}-${h}`,source:String(p.source),target:String(p.target),sourceHandle:p.sourceHandle??void 0,targetHandle:p.targetHandle??void 0,markerEnd:{type:qr.ArrowClosed}}));return{nodes:u,edges:f,instances:i,description:c}}catch(n){const r=n instanceof Error?n.message:String(n);let i="";if(/bad indentation of a mapping entry|expected.*scalar|mapping values are not allowed/i.test(r)){const s=r.match(/\((\d+):/);i=`
|
|
111
|
-
|
|
112
|
-
💡 提示:通常由 ${s?`第 ${s[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}${i}`}}}function pm(e,t){var i,s,o,l,c,d,u,f,p;const n=h=>{const g={type:(h==null?void 0:h.type)??"node",name:(h==null?void 0:h.name)??"",value:(h==null?void 0:h.value)??(h==null?void 0:h.default)??""};return(h==null?void 0:h.required)===!0&&(g.required=!0),(h==null?void 0:h.showOnNode)!=null&&(g.showOnNode=!!h.showOnNode),g},r={};for(const h of e){const g=t[h.id]&&typeof t[h.id]=="object"?{...t[h.id]}:{},b=((i=h.data)==null?void 0:i.definitionId)||h.id,S=((s=h.data)==null?void 0:s.inputs)??[],x=((o=h.data)==null?void 0:o.outputs)??[],w=((l=h.data)==null?void 0:l.role)!=null?String(h.data.role).trim():"",v=g.role!=null?String(g.role).trim():"",k=Dx[w]||w,E=Dx[v]||v,j=qo.includes(k)?k:qo.includes(E)?E:"normal",A=Array.isArray(S)?S.map(n):Array.isArray(g.input)?g.input.map(U=>n(U)):[],$=Array.isArray(x)?x.map(n):Array.isArray(g.output)?g.output.map(U=>n(U)):[],I=((c=h.data)==null?void 0:c.label)!=null?String(h.data.label):g.label!=null?String(g.label):h.id,F=(d=h.data)==null?void 0:d.body,L=F!=null?String(F):g.body!=null?String(g.body):"";let T=((u=h.data)==null?void 0:u.model)!=null&&String(h.data.model).trim()!==""?String(h.data.model).trim():g.model!=null&&String(g.model).trim()!==""?String(g.model).trim():void 0;(T===""||T==="default")&&(T=void 0);const q={...g,definitionId:b,label:I,role:j,model:T,input:A,output:$};b.startsWith("provide_")||L.trim()===""?delete q.body:q.body=L;const D=Array.isArray((f=h.data)==null?void 0:f.images)?h.data.images:Array.isArray(g.images)?g.images:[];D.length>0?q.images=D:delete q.images;const W=(p=h.data)==null?void 0:p.script,O=W!=null?String(W):g.script!=null?String(g.script):"";O.trim()===""?delete q.script:q.script=O,delete q.temperature,delete q.maxTokens,delete q.description,r[h.id]=q}return r}function nN(e,t,n,r){const i=pm(e,n),s=t.map(d=>({source:d.source,target:d.target,sourceHandle:d.sourceHandle??null,targetHandle:d.targetHandle??null})),o={};for(const d of e){const u=d.position??{x:0,y:0};o[d.id]={x:u.x,y:u.y}}const l={nodePositions:o};(r==null?void 0:r.description)!=null&&String(r.description).trim()!==""&&(l.description=String(r.description).trim());const c={instances:i,edges:s,ui:l};return NA.dump(c,{lineWidth:-1})}function YU(e){var i,s;const t={inputNames:[],outputNames:[]},n=Array.isArray((i=e.data)==null?void 0:i.inputs)?e.data.inputs:[],r=Array.isArray((s=e.data)==null?void 0:s.outputs)?e.data.outputs:[];for(let o=0;o<n.length;o++){const l=n[o],c=(l&&l.name!=null?String(l.name).trim():"")||`input-${o}`;t.inputNames.push(c)}for(let o=0;o<r.length;o++){const l=r[o],c=(l&&l.name!=null?String(l.name).trim():"")||`output-${o}`;t.outputNames.push(c)}return t}function GU(e,t,n){var c,d,u;const r=new Set(e.map(f=>f.id)),i={};for(const f of e)i[f.id]=YU(f);const s=new Map,o=new Map;for(const f of t)f.target&&r.has(f.target)&&(s.has(f.target)||s.set(f.target,new Set),f.targetHandle&&s.get(f.target).add(f.targetHandle)),f.source&&r.has(f.source)&&(o.has(f.source)||o.set(f.source,new Set),f.sourceHandle&&o.get(f.source).add(f.sourceHandle));const l=[];for(const f of e){const p=((c=f.data)==null?void 0:c.definitionId)!=null?String(f.data.definitionId):"",h=i[f.id]||{inputNames:[],outputNames:[]},g=h.inputNames.length,b=h.outputNames.length;if(!(p==="control_start"||p.startsWith("provide_"))&&g>0)for(let w=0;w<g;w++){const v=`input-${w}`;if(!((d=s.get(f.id))==null?void 0:d.has(v))){const E=h.inputNames[w]||v;l.push({nodeId:f.id,suffix:n("flow:validation.inputSlotNoEdge",{slotName:E,handle:v}),key:`${f.id}-${v}-in`})}}if(!(p==="control_end")&&b>0)for(let w=0;w<b;w++){const v=`output-${w}`;if(!((u=o.get(f.id))==null?void 0:u.has(v))){const E=h.outputNames[w]||v;l.push({nodeId:f.id,suffix:n("flow:validation.outputSlotNoEdge",{slotName:E,handle:v}),key:`${f.id}-${v}-out`})}}}return l}const vh=/\[image\s+(\d+)\]/gi;function Hr(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 XU(e){return`image ${Hr(e).length+1}`}function JU(e,t){const n=String(e||""),r=`[${t}]`;return n.trim()?`${n.replace(/[ \t]+$/u,"")} ${r}`:r}function QU(e,t){const n=Hr(e),r=String(t||""),i=new Set;vh.lastIndex=0;let s;for(;s=vh.exec(r);)i.add(`image ${s[1]}`.toLowerCase());return i.size===0?[]:n.filter(o=>i.has(String(o.label||"").toLowerCase()))}function ZU(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 jA(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 bh(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 CA({files:e,body:t,images:n}){const r=Array.from(e||[]);if(r.length===0)return null;let i=String(t||"");const s=Hr(n);for(const o of r){const l=await ZU(o),c=XU(s);s.push({id:`${Date.now().toString(36)}-${s.length+1}`,label:c,...l}),i=JU(i,c)}return{body:i,images:s}}function Fx(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 eW={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_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"]};function tW(e,t,n){const r=String((n==null?void 0:n.displayName)||"").trim(),i=String(t||"").trim();return!r||!i||r===i?i:(eW[e]||[]).includes(i)?r:i}const nW={tool_git_checkout:new Set(["targetDir","pullIfExists","includeSubmodules","workspaceContext","commit","changed"]),control_load_skills:new Set(["mergeMode","workspaceContext","skillsContext","loadedCount","summary"]),agent_subAgent:new Set(["workspaceContext","skillsContext"])},rW={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"])};function rN(e,t,n){return!Array.isArray(t)||!Array.isArray(n)||n.length===0?t:t.map((r,i)=>{var d,u;const s=n[i],l=n.find(f=>(f==null?void 0:f.name)&&f.name===r.name)||s;if(!l)return r;const c=r.showOnNode===!1&&l.showOnNode==null&&((d=nW[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"}:{},...(u=rW[e])!=null&&u.has(r.name)?{showOnNode:!1}:{}}})}function EA(e){var i,s;const t=Array.isArray((i=e==null?void 0:e.data)==null?void 0:i.inputs)?e.data.inputs:[],n=Array.isArray((s=e==null?void 0:e.data)==null?void 0:s.outputs)?e.data.outputs:[],r=o=>o.map(l=>{const c=Fx(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 hd(e,t,n,r,i){var O,U,P,R,C,G,J,B,te,de,ce,ue,re,ge,se,pe;const s=((O=e.data)==null?void 0:O.definitionId)||String(e.id).replace(/-\d+$/,""),o=n.find(ae=>ae.id===s),l=t[e.id];let c=[],d=[],u=((U=e.data)==null?void 0:U.label)??e.id,f,p,h,g,b;const S=!!l;l&&(Array.isArray(l.input)&&(c=l.input.map(Fx)),Array.isArray(l.output)&&(d=l.output.map(Fx)),l.label&&(u=String(l.label)),l.role&&typeof l.role=="string"&&(f=l.role),l.model!=null&&(p=String(l.model).trim()),l.body!=null&&(h=String(l.body)),Array.isArray(l.images)&&(g=l.images),l.script!=null&&(b=String(l.script)));const x=f??(typeof((P=e.data)==null?void 0:P.role)=="string"?e.data.role:"普通"),w=p??((R=e.data)==null?void 0:R.model)??void 0,v=(o==null?void 0:o.description)!=null?String(o.description).trim():"",k=v!==""?v:void 0,E=h??((C=e.data)==null?void 0:C.body)??"",j=Array.isArray(g)?g:Array.isArray((G=e.data)==null?void 0:G.images)?e.data.images:[],A=b!==void 0?b:((J=e.data)==null?void 0:J.script)!=null?String(e.data.script):"",$=String(e.id),I=(B=r==null?void 0:r[i])==null?void 0:B[$],F=(te=I==null?void 0:I.label)==null?void 0:te.label,L=I==null?void 0:I.body,T=I==null?void 0:I.description;S||(c.length===0&&((de=o==null?void 0:o.inputs)!=null&&de.length)&&(c=o.inputs.map(ae=>({...ae}))),d.length===0&&((ce=o==null?void 0:o.outputs)!=null&&ce.length)&&(d=o.outputs.map(ae=>({...ae}))));const q=(o==null?void 0:o.id)??s;if(q==="agent_subAgent"&&!d.some(ae=>(ae==null?void 0:ae.name)==="result")){const ae=(ue=o==null?void 0:o.outputs)==null?void 0:ue.find(me=>(me==null?void 0:me.name)==="result");d=[...d,ae?{...ae}:{type:"text",name:"result",default:""}]}if((q==="display_markdown"||q==="display_mermaid"||q==="display_ascii")&&!d.some(ae=>(ae==null?void 0:ae.name)==="next")){const ae=(re=o==null?void 0:o.outputs)==null?void 0:re.find(me=>(me==null?void 0:me.name)==="next");d=[...d,ae?{...ae}:{type:"node",name:"next",default:""}]}if(q==="workspace_run"){if(!c.some(ae=>(ae==null?void 0:ae.name)==="prev")){const ae=(ge=o==null?void 0:o.inputs)==null?void 0:ge.find(me=>(me==null?void 0:me.name)==="prev");c=[ae?{...ae}:{type:"node",name:"prev",default:""},...c]}if(!d.some(ae=>(ae==null?void 0:ae.name)==="next")){const ae=(se=o==null?void 0:o.outputs)==null?void 0:se.find(me=>(me==null?void 0:me.name)==="next");d=[...d,ae?{...ae}:{type:"node",name:"next",default:""}]}}c=rN(q,c,o==null?void 0:o.inputs),d=rN(q,d,o==null?void 0:o.outputs),q.startsWith("provide_")&&d[0]&&String(d[0].default??d[0].value??"").trim()===""&&String(E).trim()!==""&&(d=d.map((ae,me)=>me===0?{...ae,default:E,value:E}:ae));const D=tW(q,F||u,o),W=q==="tool_nodejs"||String(A).trim()!=="";return{...e,type:"flowNode",data:{...e.data,label:F||u,displayLabel:D,definitionDisplayName:o==null?void 0:o.displayName,definitionId:q,schemaType:((pe=e.data)==null?void 0:pe.schemaType)??e.type??"agent",role:x,model:w,body:L||E,images:j,script:A,inputs:c,outputs:d,description:T||k,originalLabel:u,originalBody:E,...W?{script:A}:{}}}}function _A(e,t){const n=new Map(t.map(r=>[r.id,r]));return e.filter(r=>{var u,f,p,h;const i=n.get(r.source),s=n.get(r.target),o=((f=(u=i==null?void 0:i.data)==null?void 0:u.outputs)==null?void 0:f.length)??0,l=((h=(p=s==null?void 0:s.data)==null?void 0:p.inputs)==null?void 0:h.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 i&&s&&c>=0&&c<o&&d>=0&&d<l})}function In(e){switch(kh(e)){case"text":return"#2196f3";case"file":return"#4caf50";case"node":return"#ff9800";case"bool":return"#9c27b0";default:return"#9e9e9e"}}function kh(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 iW(e,t){const n=kh(e),r=kh(t);return!n||!r?!1:n==="any"||r==="any"?!0:n===r}const sW=new Set(["workspaceContext","skillsContext"]);function zx(e){const t=kh(e==null?void 0:e.type),n=String((e==null?void 0:e.name)||(e==null?void 0:e.id)||"").trim();return t==="text"&&sW.has(n)?`${t}+${n}`:t}function PA(e){return zx(e)}function dc(e,t){if(!e||!t||!iW(e.type,t.type))return!1;const n=zx(e),r=zx(t),i=n.includes("+"),s=r.includes("+");return i||s?n===r:!0}function oW(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 fc(e,t,n){var l;const r=n==="source"?"outputs":"inputs",s=oW(t,n==="source"?"output":"input");return s<0?null:(Array.isArray((l=e==null?void 0:e.data)==null?void 0:l[r])?e.data[r]:[])[s]||null}function Fs(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function aW(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 lW(e){return["true","1","yes","on"].includes(String((e==null?void 0:e.value)??(e==null?void 0:e.default)??"").trim().toLowerCase())}function Pn(e){e.stopPropagation()}function cW(e){return String(e||"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function uW(e,t){const n=`\\[${cW(t)}\\]`;return String(e||"").replace(new RegExp(`[ \\t]*${n}`,"gi"),"").replace(/[ \t]+\n/g,`
|
|
124
|
-
`).replace(/\n{3,}/g,`
|
|
125
|
-
|
|
126
|
-
`).trimEnd()}function Wg(e){return String(e||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function dW(e){const t=String(e||"");let n="",r=0;vh.lastIndex=0;let i;for(;i=vh.exec(t);)n+=Wg(t.slice(r,i.index)),n+=`<span class="af-flow-node__image-token">${Wg(i[0])}</span>`,r=i.index+i[0].length;return n+=Wg(t.slice(r)),n||" "}function AA({data:e,selected:t,id:n,deleteNode:r,onProvideExpand:i,onProvideValueChange:s,onNodeBodyChange:o,onNodeImagesChange:l,modelLists:c,onModelChange:d}){var On,Rt;const{t:u}=Ut(),f=(e==null?void 0:e.inputs)??[],p=(e==null?void 0:e.outputs)??[],h=((e==null?void 0:e.schemaType)??"agent").toLowerCase(),g=aW(e),b=(e==null?void 0:e.isRunMode)??!1,S=(e==null?void 0:e.isExecuting)??!1,x=(e==null?void 0:e.isDim)??!1,w=(e==null?void 0:e.nodeStatus)??null,v=(e==null?void 0:e.nodeElapsed)??null,k=(e==null?void 0:e.definitionId)||"",E=k.startsWith("provide_"),j=k==="provide_bool",A=k==="provide_str",$=k==="provide_file",I=k==="agent_subAgent",F=I&&!b,L=j?lW(p[0]):!1,T=E?String(((On=p[0])==null?void 0:On.value)??((Rt=p[0])==null?void 0:Rt.default)??(e==null?void 0:e.body)??""):"",q=String((e==null?void 0:e.body)||""),D=(e==null?void 0:e.displayLabel)||(e==null?void 0:e.label)||u("flow:node.fallbackLabel"),W=!E&&!F&&(e!=null&&e.showBodyPreview)?String((e==null?void 0:e.body)||"").trim():"",O=Hr(e==null?void 0:e.images),U=m.useRef(!1),P=m.useRef(!1),R=m.useRef(null),C=m.useRef(null),[G,J]=m.useState(T),[B,te]=m.useState(q);m.useEffect(()=>{U.current||J(T)},[n,T]),m.useEffect(()=>{P.current||te(q)},[n,q]),m.useEffect(()=>{const fe=R.current;fe&&(fe.style.height="auto",fe.style.height=`${Math.min(Math.max(fe.scrollHeight,76),180)}px`,C.current&&(C.current.style.height=fe.style.height))},[B]);const de=Array.isArray(c==null?void 0:c.cursor)?c.cursor:[],ce=Array.isArray(c==null?void 0:c.opencode)?c.opencode:[],ue=Array.isArray(c==null?void 0:c.claudeCode)?c.claudeCode:[],re=((e==null?void 0:e.model)??"").trim(),ge=h==="agent"&&!k.startsWith("tool_nodejs"),se=new Set(de.map(Fs)),pe=new Set(ce.map(Fs)),ae=new Set(ue.map(Fs)),me=re?re.startsWith("cursor:")||re.startsWith("opencode:")||re.startsWith("claude-code:")?re:ae.has(re)?`claude-code:${re}`:pe.has(re)?`opencode:${re}`:se.has(re)?`cursor:${re}`:re:"",ze=re&&!me.startsWith("cursor:")&&!me.startsWith("opencode:")&&!me.startsWith("claude-code:")&&!se.has(re)&&!pe.has(re)&&!ae.has(re),st=re.startsWith("cursor:")?re.slice(7):re.startsWith("opencode:")?re.slice(9):re.startsWith("claude-code:")?re.slice(12):re,Ke=fe=>{const Pe=fe.target.value;d&&d(n,Pe)},Ee=fe=>{fe.stopPropagation(),r&&r(n)},It=fe=>{fe.stopPropagation(),i&&i()},sn=fe=>{fe.stopPropagation(),s==null||s(n,fe.target.value==="true"?"true":"false")},Wt=fe=>{fe.stopPropagation();const Pe=fe.target.value;J(Pe),U.current||s==null||s(n,Pe)},mn=fe=>{fe.stopPropagation(),U.current=!0},on=fe=>{fe.stopPropagation(),U.current=!1;const Pe=fe.currentTarget.value;J(Pe),s==null||s(n,Pe)},bn=()=>{s==null||s(n,G)},xr=fe=>{fe.stopPropagation();const Pe=window.prompt("文件路径",G);Pe!=null&&(J(Pe),s==null||s(n,Pe))},_n=fe=>{if(te(fe),o==null||o(n,fe),l){const Pe=QU(O,fe);(Pe.length!==O.length||Pe.some((Mt,Mn)=>{var dt;return Mt.id!==((dt=O[Mn])==null?void 0:dt.id)}))&&l(n,Pe)}},oe=fe=>{fe.stopPropagation();const Pe=fe.target.value;P.current?te(Pe):_n(Pe)},ye=fe=>{fe.stopPropagation(),P.current=!0},Ue=fe=>{fe.stopPropagation(),P.current=!1;const Pe=fe.currentTarget.value;_n(Pe)},Ge=()=>{_n(B)},Qe=async fe=>{const Pe=await CA({files:fe,body:B,images:O});Pe&&(te(Pe.body),o==null||o(n,Pe.body),l==null||l(n,Pe.images))},Et=(fe,Pe)=>{fe.stopPropagation();const Mt=O.filter(dt=>dt.id!==Pe.id),Mn=uW(B,Pe.label);te(Mn),o==null||o(n,Mn),l==null||l(n,Mt)},kn=fe=>{const Pe=jA(fe);Pe.length!==0&&(fe.preventDefault(),fe.stopPropagation(),Qe(Pe).catch(()=>{}))},gt=fe=>{const Pe=bh(fe);Pe.length!==0&&(fe.preventDefault(),fe.stopPropagation(),Qe(Pe).catch(()=>{}))},Sn=()=>{const fe=R.current,Pe=C.current;!fe||!Pe||(Pe.scrollTop=fe.scrollTop,Pe.scrollLeft=fe.scrollLeft)};return a.jsxs("div",{className:"af-flow-node"+(t?" af-flow-node--selected":"")+(S?" af-flow-node--executing":"")+(w==="success"?" af-flow-node--done":"")+(w==="failed"?" af-flow-node--failed":"")+(w==="running"&&!S?" af-flow-node--running-disk":"")+(x?" af-flow-node--dim":"")+" af-flow-node--"+h.replace(/[^a-z0-9_-]/g,""),"data-schema":h,children:[a.jsxs("div",{className:"af-flow-node__chrome",children:[a.jsx("span",{className:"af-flow-node__type",title:g,children:g}),n&&a.jsx("span",{className:"af-flow-node__id",title:n,children:n}),!b&&ge&&a.jsxs("div",{className:"af-flow-node__model-wrap nodrag",onPointerDown:Pn,onMouseDown:Pn,onClick:Pn,children:[a.jsxs("select",{className:"af-flow-node__model nodrag",value:me,onChange:Ke,onPointerDown:Pn,onMouseDown:Pn,onClick:Pn,"aria-label":u("flow:node.model"),title:st||u("flow:node.defaultModel"),children:[a.jsx("option",{value:"",children:u("flow:node.defaultModel")}),ze&&a.jsx("option",{value:re,children:re}),de.length>0&&a.jsx("optgroup",{label:"Cursor",children:de.map(fe=>a.jsx("option",{value:`cursor:${Fs(fe)}`,children:Fs(fe)},`c-${fe}`))}),ce.length>0&&a.jsx("optgroup",{label:"OpenCode",children:ce.map(fe=>a.jsx("option",{value:`opencode:${Fs(fe)}`,children:Fs(fe)},`o-${fe}`))}),ue.length>0&&a.jsx("optgroup",{label:"Claude Code",children:ue.map(fe=>a.jsx("option",{value:`claude-code:${Fs(fe)}`,children:Fs(fe)},`cc-${fe}`))})]}),a.jsx("span",{className:"af-flow-node__model-arrow material-symbols-outlined",children:"expand_more"})]}),S&&a.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--executing",children:"EXECUTING"}),w==="running"&&!S&&a.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--running-disk",title:u("flow:node.diskRunning"),children:"RUNNING"}),w==="success"&&a.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--done",children:v!=null&&String(v).trim()!==""?v:"--"}),w==="failed"&&a.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--failed",children:"FAILED"}),!b&&E&&!j&&!A&&!$&&a.jsx("button",{type:"button",className:"af-flow-node__expand",onClick:It,"aria-label":u("flow:node.expandProvide"),title:u("flow:node.expandProvide"),children:a.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})}),!b&&a.jsx("button",{type:"button",className:"af-flow-node__delete",onClick:Ee,"aria-label":u("flow:node.deleteNode"),title:u("flow:node.deleteNode"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsxs("div",{className:"af-flow-node__body",children:[a.jsx("div",{className:"af-flow-node__ports af-flow-node__ports--in",children:f.map((fe,Pe)=>{if(fe.showOnNode===!1)return null;const Mt=u("flow:node.inputTooltip",{name:fe.name||`#${Pe}`,type:fe.type})+(fe.default!=null&&fe.default!==""?u("flow:node.defaultSuffix",{value:fe.default}):""),Mn=fe.name||`#${Pe+1}`;return a.jsxs("div",{className:"af-flow-node__port-row",title:Mt,children:[a.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--in",children:[Mn,fe.required?a.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),a.jsx(ji,{type:"target",position:Fe.Left,id:`input-${Pe}`,className:"af-flow-node__handle",style:{background:In(fe.type)},title:Mt})]},`in-${Pe}`)})}),a.jsxs("div",{className:"af-flow-node__title-wrap",children:[a.jsx("span",{className:"af-flow-node__title",children:D}),j?a.jsxs("select",{className:"af-flow-node__bool-select nodrag"+(L?" af-flow-node__bool-select--true":""),value:L?"true":"false",onChange:sn,onPointerDown:Pn,onMouseDown:Pn,onClick:Pn,"aria-label":"Boolean value",title:L?"true":"false",children:[a.jsx("option",{value:"false",children:"false"}),a.jsx("option",{value:"true",children:"true"})]}):A?a.jsx("textarea",{className:"af-flow-node__inline-text nodrag",value:G,onChange:Wt,onCompositionStart:mn,onCompositionEnd:on,onBlur:bn,onPointerDown:Pn,onMouseDown:Pn,onClick:Pn,placeholder:"输入文本",rows:2}):$?a.jsxs("div",{className:"af-flow-node__file-value nodrag",onPointerDown:Pn,onMouseDown:Pn,onClick:Pn,children:[a.jsx("input",{className:"af-flow-node__file-input nodrag",value:G,onChange:Wt,onCompositionStart:mn,onCompositionEnd:on,onBlur:bn,placeholder:"选择或输入文件路径",title:G||"选择或输入文件路径"}),a.jsx("button",{type:"button",className:"af-flow-node__file-picker nodrag",onClick:xr,"aria-label":"选择文件",title:"选择文件",children:a.jsx("span",{className:"material-symbols-outlined",children:"folder_open"})})]}):I&&!b?a.jsxs("div",{className:"af-flow-node__prompt-stack nodrag",onPointerDown:Pn,onMouseDown:Pn,onClick:Pn,children:[a.jsx("pre",{ref:C,className:"af-flow-node__prompt-backdrop","aria-hidden":"true",dangerouslySetInnerHTML:{__html:dW(B)+`
|
|
127
|
-
`}}),a.jsx("textarea",{ref:R,className:"af-flow-node__prompt-editor nodrag",value:B,onChange:oe,onCompositionStart:ye,onCompositionEnd:Ue,onBlur:Ge,onPaste:kn,onDrop:gt,onScroll:Sn,onDragOver:fe=>{bh(fe).length>0&&fe.preventDefault()},placeholder:"输入 prompt",rows:2})]}):null,I&&O.length>0?a.jsx("div",{className:"af-flow-node__image-chips",children:O.map((fe,Pe)=>a.jsxs("span",{className:"af-flow-node__image-chip",title:fe.name,children:[a.jsx("img",{src:fe.dataUrl,alt:""}),a.jsxs("span",{children:["[",fe.label||`image ${Pe+1}`,"]"]}),a.jsx("button",{type:"button",className:"af-flow-node__image-remove nodrag",onClick:Mt=>Et(Mt,fe),onPointerDown:Pn,onMouseDown:Pn,"aria-label":`删除 ${fe.label||`image ${Pe+1}`}`,title:"删除图片",children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},fe.id||Pe))}):null,W?a.jsx("span",{className:"af-flow-node__prompt-preview",title:W,children:W}):null]}),a.jsx("div",{className:"af-flow-node__ports af-flow-node__ports--out",children:p.map((fe,Pe)=>{if(fe.showOnNode===!1)return null;const Mt=u("flow:node.outputTooltip",{name:fe.name||`#${Pe}`,type:fe.type})+(fe.default!=null&&fe.default!==""?u("flow:node.defaultSuffix",{value:fe.default}):""),Mn=fe.name||`#${Pe+1}`;return a.jsxs("div",{className:"af-flow-node__port-row",title:Mt,children:[a.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--out",children:[Mn,fe.required?a.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),a.jsx(ji,{type:"source",position:Fe.Right,id:`output-${Pe}`,className:"af-flow-node__handle",style:{background:In(fe.type)},title:Mt})]},`out-${Pe}`)})})]})]})}const Od="flowNode";function IA(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 Sh(e){return e.key==="?"||e.key==="/"&&e.shiftKey}function fW(){return typeof navigator>"u"?!1:/Mac|iPhone|iPod|iPad/i.test(navigator.platform||navigator.userAgent||"")}function pW({open:e,onClose:t,flowId:n,flowSource:r,onArchived:i}){const{t:s}=Ut(),o=m.useId(),l=m.useRef(null),[c,d]=m.useState(""),[u,f]=m.useState(!1),[p,h]=m.useState("");if(m.useEffect(()=>{if(!e)return;d(""),h(""),f(!1);const x=requestAnimationFrame(()=>{var w;return(w=l.current)==null?void 0:w.focus()});return()=>cancelAnimationFrame(x)},[e,n]),!e)return null;const g=c.trim(),b=g===n;async function S(x){if(x.preventDefault(),!(!b||u)){f(!0),h("");try{const w=await fetch("/api/flow/archive",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:n,flowSource:r,confirmFlowId:g})}),v=await w.json().catch(()=>({}));if(!w.ok){h(typeof v.error=="string"?v.error:s("project:archiveModal.archiveFailed"));return}i()}catch(w){h(String((w==null?void 0:w.message)||w))}finally{f(!1)}}}return a.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:x=>{x.target===x.currentTarget&&t()},children:a.jsxs("div",{ref:l,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":o,tabIndex:-1,onMouseDown:x=>x.stopPropagation(),children:[a.jsxs("div",{className:"af-shortcuts-panel__head",children:[a.jsx("h2",{id:o,className:"af-shortcuts-panel__title",children:s("project:archiveModal.title")}),a.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":s("project:archiveModal.close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:S,children:[a.jsx("p",{className:"af-new-pipeline-lead",children:s("project:archiveModal.lead",{flowId:n})}),a.jsxs("label",{className:"af-new-pipeline-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:s("project:archiveModal.confirmLabel")}),a.jsx("input",{type:"text",className:"af-new-pipeline-input",value:c,onChange:x=>d(x.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":g.length>0&&!b})]}),p?a.jsx("p",{className:"af-err af-new-pipeline-err",children:p}):null,a.jsxs("div",{className:"af-new-pipeline-actions",children:[a.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:u,children:s("project:archiveModal.cancel")}),a.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!b||u,children:s(u?"project:archiveModal.archiving":"project:archiveModal.confirmArchive")})]})]})]})})}function iN({open:e,title:t,message:n,confirmLabel:r,cancelLabel:i,destructive:s=!1,secondaryLabel:o,secondaryDestructive:l=!1,onSecondary:c,onConfirm:d,onCancel:u}){const{t:f}=Ut(),p=m.useId(),h=m.useRef(null);if(m.useEffect(()=>{if(!e)return;const x=requestAnimationFrame(()=>{var v;return(v=h.current)==null?void 0:v.focus()});function w(v){v.key==="Escape"&&u(),v.key==="Enter"&&d()}return window.addEventListener("keydown",w),()=>{cancelAnimationFrame(x),window.removeEventListener("keydown",w)}},[e,u,d]),!e)return null;const g=r??f("common:common.confirm","确定"),b=i??f("common:common.cancel","取消"),S=t??f("common:common.confirmTitle","请确认");return a.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:x=>{x.target===x.currentTarget&&u()},children:a.jsxs("div",{ref:h,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":p,tabIndex:-1,onMouseDown:x=>x.stopPropagation(),children:[a.jsxs("div",{className:"af-shortcuts-panel__head",children:[a.jsx("h2",{id:p,className:"af-shortcuts-panel__title",children:S}),a.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:u,"aria-label":b,children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsxs("div",{className:"af-shortcuts-panel__body af-new-pipeline-form",children:[a.jsx("p",{className:"af-new-pipeline-lead",children:n}),a.jsxs("div",{className:"af-new-pipeline-actions",children:[a.jsx("button",{type:"button",className:"af-btn-secondary",onClick:u,children:b}),o&&c?a.jsx("button",{type:"button",className:l?"af-btn-secondary af-btn-destructive":"af-btn-secondary",onClick:c,children:o}):null,a.jsx("button",{type:"button",className:s?"af-btn-primary af-btn-destructive":"af-btn-primary",onClick:d,autoFocus:!0,children:g})]})]})]})})}function hW({open:e,onClose:t,flowId:n,flowSource:r,flowArchived:i=!1,onDeleted:s}){const{t:o}=Ut(),l=m.useId(),c=m.useRef(null),[d,u]=m.useState(""),[f,p]=m.useState(!1),[h,g]=m.useState("");if(m.useEffect(()=>{if(!e)return;u(""),g(""),p(!1);const w=requestAnimationFrame(()=>{var v;return(v=c.current)==null?void 0:v.focus()});return()=>cancelAnimationFrame(w)},[e,n]),!e)return null;const b=d.trim(),S=b===n;async function x(w){if(w.preventDefault(),!S||f)return;p(!0),g("");let v=null;try{const k=new AbortController;v=setTimeout(()=>k.abort(),15e3);const E=await fetch("/api/flow/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:n,flowSource:r,confirmFlowId:b,flowArchived:i}),signal:k.signal}),j=await E.json().catch(()=>({}));if(!E.ok){g(typeof j.error=="string"?j.error:o("project:deleteModal.deleteFailed"));return}try{for(let A=localStorage.length-1;A>=0;A--){const $=localStorage.key(A);$&&($.startsWith(`af:composer-sessions:${n}:${r}`)||$.startsWith(`af:composer-active-session:${n}:${r}`)||$.startsWith(`af:workspace-composer:${n}:${r}`))&&localStorage.removeItem($)}}catch{}await s()}catch(k){if((k==null?void 0:k.name)==="AbortError"){g(o("project:deleteModal.deleteTimeout"));return}g(String((k==null?void 0:k.message)||k))}finally{v&&clearTimeout(v),p(!1)}}return a.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:w=>{w.target===w.currentTarget&&t()},children:a.jsxs("div",{ref:c,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":l,tabIndex:-1,onMouseDown:w=>w.stopPropagation(),children:[a.jsxs("div",{className:"af-shortcuts-panel__head",children:[a.jsx("h2",{id:l,className:"af-shortcuts-panel__title",children:o("project:deleteModal.title")}),a.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":o("project:deleteModal.close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:x,children:[a.jsx("p",{className:"af-new-pipeline-lead",children:o("project:deleteModal.lead",{flowId:n})}),a.jsxs("label",{className:"af-new-pipeline-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:o("project:deleteModal.confirmLabel")}),a.jsx("input",{type:"text",className:"af-new-pipeline-input",value:d,onChange:w=>u(w.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":b.length>0&&!S})]}),h?a.jsx("p",{className:"af-err af-new-pipeline-err",children:h}):null,a.jsxs("div",{className:"af-new-pipeline-actions",children:[a.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:f,children:o("project:deleteModal.cancel")}),a.jsx("button",{type:"submit",className:"af-btn-primary af-btn-destructive",disabled:!S||f,children:o(f?"project:deleteModal.deleting":"project:deleteModal.confirmDelete")})]})]})]})})}function mW({children:e}){return a.jsx("kbd",{className:"af-kbd",children:e})}function bo({keys:e}){return a.jsx("span",{className:"af-shortcuts-keys",children:e.map((t,n)=>a.jsxs("span",{children:[n>0?a.jsx("span",{className:"af-shortcuts-keys__plus",children:"+"}):null,a.jsx(mW,{children:t})]},n))})}function TA({open:e,onClose:t}){const{t:n}=Ut(),r=m.useRef(null);if(m.useEffect(()=>{if(!e)return;const o=requestAnimationFrame(()=>{var l;return(l=r.current)==null?void 0:l.focus()});return()=>cancelAnimationFrame(o)},[e]),!e)return null;const s=fW()?"⌘":"Ctrl";return a.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:o=>{o.target===o.currentTarget&&t()},children:a.jsxs("div",{ref:r,className:"af-shortcuts-panel",role:"dialog","aria-modal":"true","aria-labelledby":"af-shortcuts-title",tabIndex:-1,onMouseDown:o=>o.stopPropagation(),children:[a.jsxs("div",{className:"af-shortcuts-panel__head",children:[a.jsx("h2",{id:"af-shortcuts-title",className:"af-shortcuts-panel__title",children:n("flow:shortcuts.title")}),a.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":n("common:common.close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsxs("div",{className:"af-shortcuts-panel__body",children:[a.jsxs("section",{className:"af-shortcuts-section",children:[a.jsx("h3",{className:"af-shortcuts-cat",children:n("flow:shortcuts.general")}),a.jsxs("ul",{className:"af-shortcuts-list",children:[a.jsxs("li",{className:"af-shortcuts-row",children:[a.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.saveDesc")}),a.jsx(bo,{keys:[s,"S"]})]}),a.jsxs("li",{className:"af-shortcuts-row",children:[a.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.shortcutsLabel")}),a.jsx(bo,{keys:["?"]})]}),a.jsxs("li",{className:"af-shortcuts-row",children:[a.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.jumpToNode")}),a.jsx(bo,{keys:[s,"K"]})]}),a.jsxs("li",{className:"af-shortcuts-row",children:[a.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.openNodePalette")}),a.jsx(bo,{keys:["A"]})]})]})]}),a.jsxs("section",{className:"af-shortcuts-section",children:[a.jsx("h3",{className:"af-shortcuts-cat",children:n("flow:shortcuts.canvas")}),a.jsxs("ul",{className:"af-shortcuts-list",children:[a.jsxs("li",{className:"af-shortcuts-row",children:[a.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.selectTool")}),a.jsx(bo,{keys:["V"]})]}),a.jsxs("li",{className:"af-shortcuts-row",children:[a.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.panTool")}),a.jsx(bo,{keys:["H"]})]}),a.jsxs("li",{className:"af-shortcuts-row",children:[a.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.holdSpacePan")}),a.jsx(bo,{keys:["Space"]})]}),a.jsxs("li",{className:"af-shortcuts-row",children:[a.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.selectAll")}),a.jsx(bo,{keys:[s,"A"]})]})]})]})]})]})})}function gW(e,t){if(!t)return 1;const n=t.toLowerCase(),r=(e.id||"").toLowerCase(),i=(e.label||"").toLowerCase(),s=(e.definitionId||"").toLowerCase();return r===n?100:r.startsWith(n)?80:r.includes(n)?60:i.startsWith(n)?40:i.includes(n)?30:s.includes(n)?15:0}function yW({open:e,onClose:t,onJump:n,nodes:r}){const{t:i}=Ut(),[s,o]=m.useState(""),[l,c]=m.useState(0),d=m.useRef(null),u=m.useRef(null);m.useEffect(()=>{if(!e)return;o(""),c(0);const g=requestAnimationFrame(()=>{var b;return(b=d.current)==null?void 0:b.focus()});return()=>cancelAnimationFrame(g)},[e]);const f=m.useMemo(()=>{const g=(r||[]).map(x=>{var w,v,k;return{id:x.id,label:((w=x.data)==null?void 0:w.label)||"",definitionId:((v=x.data)==null?void 0:v.definitionId)||"",schemaType:((k=x.data)==null?void 0:k.schemaType)||""}}),b=s.trim(),S=g.map(x=>({e:x,s:gW(x,b)})).filter(x=>x.s>0);return S.sort((x,w)=>w.s-x.s||x.e.id.localeCompare(w.e.id)),S.slice(0,50).map(x=>x.e)},[r,s]);if(m.useEffect(()=>{l>=f.length&&c(0)},[f.length,l]),m.useEffect(()=>{var b;const g=(b=u.current)==null?void 0:b.querySelector(`[data-idx="${l}"]`);g&&g.scrollIntoView({block:"nearest"})},[l]),!e)return null;const p=g=>{const b=f[g];b&&(n(b.id),t())},h=g=>{if(g.key==="Escape"){g.preventDefault(),t();return}if(g.key==="ArrowDown"){g.preventDefault(),c(b=>Math.min(f.length-1,b+1));return}if(g.key==="ArrowUp"){g.preventDefault(),c(b=>Math.max(0,b-1));return}g.key==="Enter"&&(g.preventDefault(),p(l))};return a.jsx("div",{className:"af-jump-overlay",role:"presentation",onMouseDown:g=>{g.target===g.currentTarget&&t()},children:a.jsxs("div",{className:"af-jump-panel",role:"dialog","aria-modal":"true","aria-label":i("flow:jumpPalette.title"),onMouseDown:g=>g.stopPropagation(),children:[a.jsxs("div",{className:"af-jump-panel__input-wrap",children:[a.jsx("span",{className:"af-jump-panel__icon material-symbols-outlined","aria-hidden":!0,children:"search"}),a.jsx("input",{ref:d,type:"text",className:"af-jump-panel__input",placeholder:i("flow:jumpPalette.placeholder"),value:s,onChange:g=>{o(g.target.value),c(0)},onKeyDown:h,spellCheck:!1,autoComplete:"off"}),a.jsx("span",{className:"af-jump-panel__count",children:f.length})]}),f.length===0?a.jsx("div",{className:"af-jump-panel__empty",children:i("flow:jumpPalette.empty")}):a.jsx("ul",{ref:u,className:"af-jump-panel__list",role:"listbox",children:f.map((g,b)=>a.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:S=>{S.preventDefault(),p(b)},children:[a.jsx("span",{className:"af-jump-panel__id",children:g.id}),g.label&&g.label!==g.id&&a.jsx("span",{className:"af-jump-panel__label",children:g.label}),g.definitionId&&a.jsx("span",{className:"af-jump-panel__tag",children:g.definitionId})]},g.id))}),a.jsxs("div",{className:"af-jump-panel__hint",children:[a.jsxs("span",{children:[a.jsx("kbd",{className:"af-kbd",children:"↑"}),a.jsx("kbd",{className:"af-kbd",children:"↓"})," ",i("flow:jumpPalette.hintNavigate")]}),a.jsxs("span",{children:[a.jsx("kbd",{className:"af-kbd",children:"Enter"})," ",i("flow:jumpPalette.hintJump")]}),a.jsxs("span",{children:[a.jsx("kbd",{className:"af-kbd",children:"Esc"})," ",i("flow:jumpPalette.hintClose")]})]})]})})}function xW({open:e,onClose:t,flowId:n,flowSource:r,flowArchived:i=!1,filePath:s,fileName:o,onSaved:l,onAiEdit:c}){const{t:d}=Ut(),u=m.useId(),f=m.useRef(null),p=m.useRef(null),[h,g]=m.useState(""),[b,S]=m.useState(""),[x,w]=m.useState(!1),[v,k]=m.useState(!1),[E,j]=m.useState(!1),[A,$]=m.useState(""),[I,F]=m.useState("");if(m.useEffect(()=>{if(!e||!s)return;g(""),S(""),$(""),F(""),w(!0),k(!1),j(!1);const O=new URLSearchParams({flowId:n,flowSource:r,archived:i?"1":"0",path:s});(async()=>{try{const P=await fetch(`/api/pipeline-file-content?${O}`),R=await P.json();if(!P.ok)throw new Error(R.error||"HTTP "+P.status);g(R.content||""),S(R.content||"")}catch(P){$(P.message||String(P))}finally{w(!1)}})();const U=requestAnimationFrame(()=>{var P;return(P=f.current)==null?void 0:P.focus()});return()=>cancelAnimationFrame(U)},[e,s,n,r,i]),!e)return null;const L=h!==b;async function T(O){if(O.preventDefault(),!v){k(!0),$(""),F("");try{const U=new URLSearchParams({flowId:n,flowSource:r,archived:i?"1":"0",path:s}),P=await fetch(`/api/pipeline-file-save?${U}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:h})}),R=await P.json();if(!P.ok)throw new Error(R.error||"HTTP "+P.status);S(h),F(d("flow:fileEdit.saved")),l&&l()}catch(U){$(U.message||String(U))}finally{k(!1)}}}async function q(){if(!(!c||E||!h)){j(!0),$("");try{const O=await c(h);typeof O=="string"&&O&&g(O)}catch(O){$(O.message||String(O))}finally{j(!1)}}}function D(){g(b),$(""),F("")}const W=h.length>1e5;return a.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:O=>{O.target===O.currentTarget&&t()},children:a.jsxs("div",{ref:f,className:"af-shortcuts-panel af-file-edit-panel",role:"dialog","aria-modal":"true","aria-labelledby":u,tabIndex:-1,onMouseDown:O=>O.stopPropagation(),children:[a.jsxs("div",{className:"af-shortcuts-panel__head",children:[a.jsx("h2",{id:u,className:"af-shortcuts-panel__title",children:o||s}),a.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":d("flow:fileEdit.close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsx("div",{className:"af-file-edit-body",children:x?a.jsx("div",{className:"af-file-edit-loading",children:d("flow:fileEdit.loading")}):A&&!h?a.jsx("div",{className:"af-file-edit-error",children:A}):a.jsxs(a.Fragment,{children:[W&&a.jsx("div",{className:"af-file-edit-warning",children:d("flow:fileEdit.largeFileWarning")}),a.jsx("textarea",{ref:p,className:"af-file-edit-textarea",value:h,onChange:O=>g(O.target.value),spellCheck:!1,placeholder:d("flow:fileEdit.placeholder")})]})}),(A||I)&&!x&&a.jsx("div",{className:`af-file-edit-status${I?" af-file-edit-status--success":""}`,children:I||A}),a.jsxs("div",{className:"af-file-edit-actions",children:[a.jsx("button",{type:"button",className:"af-btn-secondary",onClick:D,disabled:!L||v||E,children:d("flow:fileEdit.reset")}),c&&a.jsx("button",{type:"button",className:"af-btn-secondary af-btn-ai",onClick:q,disabled:E||v||!h,children:d(E?"flow:fileEdit.aiRunning":"flow:fileEdit.aiEdit")}),a.jsx("button",{type:"button",className:"af-btn-primary",onClick:T,disabled:!L||v||E,children:d(v?"flow:fileEdit.saving":"flow:fileEdit.save")})]})]})})}const RA=new Set(["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"]),wW=["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"];function vW(e,t){const n=e.slice(0,t),r=n.lastIndexOf("${");if(r<0)return null;const i=n.slice(r+2);return i.includes("}")?null:{atIndex:r,query:i}}function bW(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 sN(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 LA(e,{inputNames:t,outputNames:n}){const r=e.trim();if(!r)return!1;if(r.startsWith("input.")){const i=r.slice(6).trim();return i!==""&&t.has(i)}if(r.startsWith("output.")){const i=r.slice(7).trim();return i!==""&&n.has(i)}if(RA.has(r)||t.has(r)||n.has(r))return!0;if(!r.includes(".")){const i=`${r}.md`;if(t.has(i)||n.has(i))return!0}return!1}function OA(e){return{inputNames:sN(e==null?void 0:e.inputs),outputNames:sN(e==null?void 0:e.outputs)}}function kW(e,t,n){const r=OA(t),i=bW(e),s=[];for(const o of i)if(!LA(o.key,r)){const l=o.key.trim()===""?n("flow:placeholder.empty"):o.key.trim();s.push({start:o.start,end:o.end,message:n("flow:placeholder.invalidPlaceholder",{hint:l})})}return s}function SW(e,t){const n=OA(t),r=/\$\{([^}]*)\}/g,i=[];let s=0,o;for(;(o=r.exec(e))!==null;){o.index>s&&i.push({kind:"plain",text:e.slice(s,o.index)});const l=o[0],c=LA(o[1],n);i.push({kind:c?"ph-valid":"ph-invalid",text:l}),s=o.index+l.length}return s<e.length&&i.push({kind:"plain",text:e.slice(s)}),i}function NW(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function jW(e){return e.map(t=>{const n=NW(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 CW(e,t){const n=[];for(const r of(e==null?void 0:e.inputs)??[]){const i=(r==null?void 0:r.name)!=null?String(r.name).trim():"";if(!i)continue;const s=(r==null?void 0:r.type)!=null?String(r.type):"";n.push({section:"input",insert:`input.${i}`,label:i,subtitle:s?t("flow:placeholder.inputSubtitle",{type:s}):t("flow:placeholder.inputSubtitleNoType")})}for(const r of(e==null?void 0:e.outputs)??[]){const i=(r==null?void 0:r.name)!=null?String(r.name).trim():"";if(!i)continue;const s=(r==null?void 0:r.type)!=null?String(r.type):"";n.push({section:"output",insert:`output.${i}`,label:i,subtitle:s?t("flow:placeholder.outputSubtitle",{type:s}):t("flow:placeholder.outputSubtitleNoType")})}for(const r of wW)RA.has(r)&&n.push({section:"runtime",insert:r,label:r,subtitle:t("flow:placeholder.runtimeConst")});return n}function EW(e,t){const n=t.toLowerCase();return n?e.filter(r=>[r.insert,r.label,r.subtitle??""].map(s=>String(s).toLowerCase()).some(s=>s.includes(n))):e}function _W(e,t){if(!e||t<0)return null;const n=Math.min(t,e.value.length),r=getComputedStyle(e),i=document.createElement("div");i.setAttribute("aria-hidden","true"),i.style.visibility="hidden",i.style.position="fixed",i.style.top="0",i.style.left="-99999px",i.style.whiteSpace="pre-wrap",i.style.wordWrap="break-word",i.style.overflow="hidden";const s=e.clientWidth;if(s<=0)return null;i.style.width=`${s}px`,i.style.font=r.font,i.style.lineHeight=r.lineHeight,i.style.padding=r.padding,i.style.border=r.border,i.style.boxSizing=r.boxSizing,i.style.letterSpacing=r.letterSpacing,i.style.textIndent=r.textIndent,i.style.tabSize=r.tabSize||"8",i.textContent=e.value.slice(0,n);const o=document.createElement("span");o.textContent="",i.appendChild(o),document.body.appendChild(i);const l=o.getBoundingClientRect(),c=parseFloat(r.lineHeight),d=Number.isFinite(c)&&c>0?c:l.height||16;return document.body.removeChild(i),{top:l.top,left:l.left,bottom:l.bottom,height:d}}function Xf({value:e,onChange:t,disabled:n,placeholder:r,rows:i=8,textareaClassName:s,ioSlots:o,variant:l="drawer",images:c,onImagesChange:d}){const{t:u}=Ut(),f=m.useId(),p=m.useRef(null),h=m.useRef(null),[g,b]=m.useState(0),[S,x]=m.useState(0),[w,v]=m.useState(null),k=m.useMemo(()=>Hr(c),[c]),E=m.useMemo(()=>kW(e,o,u),[e,o,u]),j=E.length>0,A=m.useMemo(()=>SW(e,o),[e,o]),$=m.useMemo(()=>jW(A),[A]),I=m.useMemo(()=>n?null:vW(e,g),[e,g,n]),F=m.useMemo(()=>{if(!I)return[];const O=CW(o,u);return EW(O,I.query)},[I,o,u]);m.useEffect(()=>{x(O=>{const U=Math.max(0,F.length-1);return Math.min(Math.max(0,O),U)})},[F.length]);const L=m.useCallback(()=>{const O=p.current;if(!O||!I||F.length===0){v(null);return}const U=_W(O,g);if(!U){v(null);return}const P=4,R=44,C=13.5*16,G=Math.min(F.length*R+8,C);let J=U.bottom+P;J+G>window.innerHeight-8&&(J=Math.max(8,U.top-G-P));const B=288;let te=U.left;te=Math.max(8,Math.min(te,window.innerWidth-B-8)),v({top:J,left:te})},[I,F.length,g]);m.useLayoutEffect(()=>{if(!I||F.length===0){v(null);return}const O=requestAnimationFrame(()=>L());return()=>cancelAnimationFrame(O)},[I,F.length,g,e,L]),m.useEffect(()=>{if(!I||F.length===0)return;const O=()=>L();return window.addEventListener("scroll",O,!0),window.addEventListener("resize",O),()=>{window.removeEventListener("scroll",O,!0),window.removeEventListener("resize",O)}},[I,F.length,L]);const T=m.useCallback(O=>{if(!I)return;const{atIndex:U}=I,P=e.slice(0,U)+"${"+O+"}"+e.slice(g);t(P);const R=U+O.length+3;queueMicrotask(()=>{const C=p.current;C&&(C.focus(),C.setSelectionRange(R,R)),b(R)})},[I,e,g,t]),q=m.useCallback(()=>{const O=p.current,U=h.current;!O||!U||(U.scrollTop=O.scrollTop,U.scrollLeft=O.scrollLeft,I&&F.length>0&&queueMicrotask(()=>L()))},[I,F.length,L]),D=m.useCallback(O=>{if(!n&&I&&F.length>0&&(O.key==="ArrowDown"||O.key==="ArrowUp"||O.key==="Enter")){if(O.key==="ArrowDown")O.preventDefault(),x(U=>(U+1)%F.length);else if(O.key==="ArrowUp")O.preventDefault(),x(U=>(U-1+F.length)%F.length);else if(O.key==="Enter"&&!O.shiftKey){O.preventDefault();const U=F[S];U&&T(U.insert)}}},[n,I,F,S,T]),W=m.useCallback(async O=>{if(n||typeof d!="function")return!1;const U=await CA({files:O,body:e,images:k});return U?(t(U.body),d(U.images),queueMicrotask(()=>{const P=p.current;if(!P)return;P.focus();const R=U.body.length;P.setSelectionRange(R,R),b(R)}),!0):!1},[n,k,t,d,e]);return a.jsxs("div",{className:"af-body-prompt-editor"+(l==="expand"?" af-body-prompt-editor--expand":""),children:[k.length>0?a.jsx("div",{className:"af-body-image-list","aria-label":"image attachments",children:k.map((O,U)=>a.jsxs("span",{className:"af-body-image-chip",title:O.name,children:[a.jsx("img",{src:O.dataUrl,alt:""}),a.jsxs("span",{children:["[",O.label||`image ${U+1}`,"]"]})]},O.id||U))}):null,a.jsxs("div",{className:"af-body-prompt-stack",children:[a.jsx("pre",{ref:h,className:"af-body-prompt-backdrop "+s,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:$+`
|
|
128
|
-
`}}),a.jsx("textarea",{ref:p,className:"af-body-prompt-textarea "+s,rows:i,value:e,disabled:n,placeholder:r,spellCheck:!1,"aria-invalid":j,"aria-describedby":j?f:void 0,onChange:O=>{t(O.target.value),b(O.target.selectionStart??O.target.value.length)},onSelect:O=>{const U=O.target;U instanceof HTMLTextAreaElement&&b(U.selectionStart??0)},onClick:O=>{const U=O.target;U instanceof HTMLTextAreaElement&&b(U.selectionStart??0)},onKeyUp:O=>{const U=O.target;U instanceof HTMLTextAreaElement&&b(U.selectionStart??U.value.length)},onKeyDown:D,onPaste:O=>{const U=jA(O);U.length!==0&&(O.preventDefault(),W(U).catch(()=>{}))},onDragOver:O=>{bh(O).length>0&&O.preventDefault()},onDrop:O=>{const U=bh(O);U.length!==0&&(O.preventDefault(),W(U).catch(()=>{}))},onScroll:q})]}),I&&F.length>0&&w?Dr.createPortal(a.jsx("ul",{className:"af-body-ph-menu af-body-ph-menu--pop af-composer-mention-menu",role:"listbox","aria-label":u("flow:nodeProps.placeholderSlots"),style:{position:"fixed",top:w.top,left:w.left,right:"auto",bottom:"auto",margin:0,zIndex:2e4},children:F.map((O,U)=>a.jsx("li",{role:"option","aria-selected":U===S,children:a.jsxs("button",{type:"button",className:"af-composer-mention-item"+(U===S?" af-composer-mention-item--active":""),onMouseDown:P=>P.preventDefault(),onMouseEnter:()=>x(U),onClick:()=>T(O.insert),children:[a.jsx("span",{className:"af-composer-mention-id",children:`\${${O.insert}}`}),O.subtitle?a.jsx("span",{className:"af-composer-mention-sub",children:O.subtitle}):null]})},`${O.section}-${O.insert}`))}),document.body):null,j?a.jsx("p",{id:f,className:"af-body-ph-issues",role:"status",children:E.map(O=>O.message).join(" · ")}):null]})}const MA=/^[a-zA-Z_][a-zA-Z0-9_-]*$/;function Jf(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function oN({kind:e,label:t,slots:n,onSlotsChange:r,disabled:i,requiredReadonly:s=!0}){const{t:o}=Ut(),l=()=>r([...n,{type:"text",name:"",default:"",required:!1,showOnNode:!1}]),c=f=>r(n.filter((p,h)=>h!==f)),d=(f,p,h)=>{const g=n.map((b,S)=>{if(S!==f)return b;const x={...b,[p]:h};return p==="required"&&h===!0&&(x.showOnNode=!0),x});r(g)},u=e==="input"?"input":"output";return a.jsxs("div",{className:"af-node-props-field af-node-props-field--io",children:[a.jsxs("div",{className:"af-node-props-io-head",children:[a.jsx("span",{className:"af-node-props-label",children:t}),a.jsx("button",{type:"button",className:"af-btn-ghost af-node-props-io-add",onClick:l,disabled:i,"aria-label":o("flow:nodeProps.addPinAriaLabel",{label:t}),children:o("flow:nodeProps.addPin")})]}),a.jsx("p",{className:"af-node-props-io-hint",children:o("flow:nodeProps.handleHint",{prefix:u})}),n.length===0?a.jsx("p",{className:"af-node-props-io-empty",children:o(e==="input"?"flow:nodeProps.noInputPins":"flow:nodeProps.noOutputPins")}):null,n.length>0?a.jsxs("div",{className:"af-node-props-io-table",role:"group","aria-label":t,children:[a.jsxs("div",{className:"af-node-props-io-table-head","aria-hidden":!0,children:[a.jsx("span",{children:o("flow:nodeProps.handle")}),a.jsx("span",{children:o("flow:nodeProps.type")}),a.jsx("span",{children:o("flow:nodeProps.name")}),a.jsx("span",{children:o("flow:nodeProps.defaultValue")}),a.jsx("span",{children:o("flow:nodeProps.required")}),a.jsx("span",{children:o("flow:nodeProps.showOnNode")}),a.jsx("span",{})]}),n.map((f,p)=>a.jsxs("div",{className:"af-node-props-io-row",children:[a.jsxs("span",{className:"af-node-props-io-handle",title:`${u}-${p}`,children:[u,"-",p]}),a.jsx("select",{className:"af-node-props-input af-node-props-io-cell",value:f.type,onChange:h=>d(p,"type",h.target.value),disabled:i,"aria-label":o("flow:nodeProps.pinTypeAriaLabel",{label:t,index:p}),children:["node","text","file","bool"].map(h=>a.jsx("option",{value:h,children:h},h))}),a.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:f.name,onChange:h=>d(p,"name",h.target.value),disabled:i,spellCheck:!1,autoComplete:"off","aria-label":o("flow:nodeProps.pinNameAriaLabel",{label:t,index:p})}),a.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:f.default,onChange:h=>d(p,"default",h.target.value),disabled:i,spellCheck:!1,autoComplete:"off","aria-label":o("flow:nodeProps.pinDefaultAriaLabel",{label:t,index:p})}),a.jsx("label",{className:"af-node-props-io-flag",title:o("flow:nodeProps.requiredHint"),children:a.jsx("input",{type:"checkbox",checked:!!f.required,onChange:h=>{s||d(p,"required",h.target.checked)},disabled:i||s,"aria-label":o("flow:nodeProps.pinRequiredAriaLabel",{label:t,index:p})})}),a.jsx("label",{className:"af-node-props-io-flag",title:o("flow:nodeProps.showOnNodeHint"),children:a.jsx("input",{type:"checkbox",checked:f.showOnNode!==!1,onChange:h=>d(p,"showOnNode",h.target.checked),disabled:i,"aria-label":o("flow:nodeProps.pinShowOnNodeAriaLabel",{label:t,index:p})})}),a.jsx("button",{type:"button",className:"af-icon-btn af-node-props-io-remove",onClick:()=>c(p),disabled:i,"aria-label":o("flow:nodeProps.deletePinAriaLabel",{label:t,index:p}),title:o("flow:nodeProps.deletePin"),children:a.jsx("span",{className:"material-symbols-outlined",children:"delete"})})]},`${u}-${p}`))]}):null]})}function $A({draft:e,setDraft:t,definitionId:n,systemPromptReadonly:r,modelLists:i,disabled:s,onIdBlur:o,onClose:l,onPublishToMarketplace:c,allowEditRequiredPins:d=!1,error:u,ioSlots:f}){const{t:p}=Ut(),[h,g]=m.useState(!1),[b,S]=m.useState(!1),[x,w]=m.useState({status:"idle",message:""}),v=m.useCallback(T=>{t(q=>q&&{...q,...T})},[t]),{cursorList:k,opencodeList:E,claudeCodeList:j,currentNotInLists:A}=m.useMemo(()=>{const T=Array.isArray(i==null?void 0:i.cursor)?i.cursor:[],q=Array.isArray(i==null?void 0:i.opencode)?i.opencode:[],D=Array.isArray(i==null?void 0:i.claudeCode)?i.claudeCode:[],W=new Set([...T,...q,...D].map(Jf)),O=((e==null?void 0:e.model)??"").trim(),U=O.startsWith("cursor:")?O.slice(7):O.startsWith("opencode:")?O.slice(9):O.startsWith("claude-code:")?O.slice(12):O,P=O&&!W.has(U)?O:"";return{cursorList:T,opencodeList:q,claudeCodeList:D,currentNotInLists:P}},[i,e==null?void 0:e.model]);if(!e)return null;const $=String(e.script??""),I=n==="tool_nodejs"||$.trim()!=="",F=typeof c=="function"&&!s&&(e==null?void 0:e.newId),L=async()=>{if(F){w({status:"running",message:p("flow:nodeProps.publishRunning")});try{const T=await c(e,n);w({status:"success",message:T!=null&&T.definitionId?p("flow:nodeProps.publishSuccessWithId",{id:T.definitionId}):p("flow:nodeProps.publishSuccess")})}catch(T){w({status:"error",message:String((T==null?void 0:T.message)||T)})}}};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"af-pipeline-drawer-head af-node-props-head",children:[a.jsx("h2",{className:"af-pipeline-drawer-title",children:p("flow:nodeProps.title")}),a.jsxs("div",{className:"af-node-props-head-actions",children:[a.jsxs("button",{type:"button",className:"af-btn-ghost af-node-props-market-btn",onClick:L,disabled:!F||x.status==="running",title:p("flow:nodeProps.publishToMarketplaceHint"),children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"inventory_2"}),x.status==="running"?p("flow:nodeProps.publishing"):p("flow:nodeProps.publishToMarketplace")]}),a.jsx("button",{type:"button",className:"af-btn-ghost af-node-props-close-secondary",onClick:l,children:p("common:common.close")})]})]}),a.jsxs("div",{className:"af-pipeline-drawer-body af-node-props-body",children:[u?a.jsx("p",{className:"af-err af-node-props-err",children:u}):null,x.message?a.jsx("p",{className:`af-node-props-market-status af-node-props-market-status--${x.status}`,children:x.message}):null,a.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[a.jsx("span",{className:"af-node-props-label",children:p("flow:node.nodeType")}),a.jsx("div",{className:"af-pipeline-drawer-readonly af-node-props-readonly-mono",children:n})]}),a.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[a.jsxs("span",{className:"af-node-props-label",children:[p("flow:nodeProps.instanceId"),a.jsx("span",{className:"af-node-props-hint",children:p("flow:node.displayNameHint")})]}),a.jsx("input",{type:"text",className:"af-node-props-input",value:e.newId,onChange:T=>v({newId:T.target.value}),onBlur:o,disabled:s,spellCheck:!1,autoComplete:"off","aria-label":p("flow:nodeProps.instanceId")})]}),a.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[a.jsxs("span",{className:"af-node-props-label",children:[p("flow:node.displayName"),"(LABEL)"]}),a.jsx("input",{type:"text",className:"af-node-props-input",value:e.label,onChange:T=>v({label:T.target.value}),disabled:s,spellCheck:!1})]}),a.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[a.jsxs("span",{className:"af-node-props-label",children:[p("flow:node.role"),"(ROLE)"]}),a.jsx("select",{className:"af-node-props-select",value:qo.includes(e.role)?e.role:p("flow:roles.normal"),onChange:T=>v({role:T.target.value}),disabled:s,children:qo.map(T=>a.jsx("option",{value:T,children:T},T))})]}),a.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[a.jsxs("span",{className:"af-node-props-label",children:[p("flow:node.model"),"(MODEL)"]}),a.jsx("span",{className:"af-node-props-sublabel",children:p("flow:node.modelHint")}),a.jsxs("select",{className:"af-node-props-select",value:(()=>{const T=(e.model||"").trim();return T?A||T:""})(),onChange:T=>v({model:T.target.value}),disabled:s,"aria-label":p("flow:nodeProps.modelAriaLabel"),children:[a.jsx("option",{value:"",children:p("flow:node.defaultModel")}),A?a.jsxs("option",{value:A,children:[A,p("flow:nodeProps.yamlValueNotInList")]}):null,k.length>0?a.jsx("optgroup",{label:"Cursor",children:k.map(T=>a.jsx("option",{value:Jf(T),children:T},`c-${T}`))}):null,E.length>0?a.jsx("optgroup",{label:"OpenCode",children:E.map(T=>a.jsx("option",{value:Jf(T),children:T},`o-${T}`))}):null,j.length>0?a.jsx("optgroup",{label:"Claude Code",children:j.map(T=>a.jsx("option",{value:`claude-code:${Jf(T)}`,children:T},`cc-${T}`))}):null]})]}),a.jsx(oN,{kind:"input",label:p("flow:nodeProps.inputPins"),slots:Array.isArray(e.inputs)?e.inputs:[],onSlotsChange:T=>v({inputs:T}),disabled:s,requiredReadonly:!d}),a.jsx(oN,{kind:"output",label:p("flow:nodeProps.outputPins"),slots:Array.isArray(e.outputs)?e.outputs:[],onSlotsChange:T=>v({outputs:T}),disabled:s,requiredReadonly:!d}),I?a.jsxs("div",{className:"af-pipeline-drawer-field af-node-props-field af-node-props-field--prompt",children:[a.jsxs("div",{className:"af-node-props-prompt-head",children:[a.jsxs("span",{className:"af-node-props-label",children:[p("flow:node.directCommand"),"(script)",a.jsx("span",{className:"af-node-props-hint",children:p("flow:node.scriptHint")})]}),a.jsx("button",{type:"button",className:"af-icon-btn af-node-props-expand",onClick:()=>S(!0),"aria-label":p("flow:nodeProps.expandEditScript"),title:p("flow:nodeProps.expand"),disabled:s,children:a.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),a.jsx(Xf,{value:$,onChange:T=>v({script:T}),disabled:s,placeholder:p("flow:nodeProps.scriptPlaceholder"),rows:6,textareaClassName:"af-pipeline-drawer-textarea af-node-props-body-textarea af-node-props-script-textarea",ioSlots:f,variant:"drawer"})]}):null,a.jsxs("div",{className:"af-pipeline-drawer-field af-node-props-field af-node-props-field--prompt",children:[a.jsxs("div",{className:"af-node-props-prompt-head",children:[a.jsx("span",{className:"af-node-props-label",children:p("flow:node.userPrompt")}),a.jsx("button",{type:"button",className:"af-icon-btn af-node-props-expand",onClick:()=>g(!0),"aria-label":p("flow:nodeProps.expandEdit"),title:p("flow:nodeProps.expand"),disabled:s,children:a.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),a.jsx(Xf,{value:e.body,onChange:T=>v({body:T}),images:e.images,onImagesChange:T=>v({images:T}),disabled:s,placeholder:p("flow:nodeProps.bodyPlaceholder"),rows:8,textareaClassName:"af-pipeline-drawer-textarea af-node-props-body-textarea",ioSlots:f,variant:"drawer"})]}),a.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[a.jsx("span",{className:"af-node-props-label",children:p("flow:node.systemDescription")}),a.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?a.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":p("flow:nodeProps.editScript"),onMouseDown:T=>{T.target===T.currentTarget&&S(!1)},children:a.jsxs("div",{className:"af-node-props-expand-panel",children:[a.jsxs("div",{className:"af-node-props-expand-head",children:[a.jsx("span",{className:"af-node-props-expand-title",children:p("flow:node.directCommand")}),a.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>S(!1),"aria-label":p("flow:nodeProps.collapse"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsx(Xf,{value:$,onChange:T=>v({script:T}),disabled:s,placeholder:p("flow:nodeProps.scriptPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:f,variant:"expand"})]})}):null,h?a.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":p("flow:nodeProps.editUserPrompt"),onMouseDown:T=>{T.target===T.currentTarget&&g(!1)},children:a.jsxs("div",{className:"af-node-props-expand-panel",children:[a.jsxs("div",{className:"af-node-props-expand-head",children:[a.jsx("span",{className:"af-node-props-expand-title",children:p("flow:node.body")}),a.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>g(!1),"aria-label":p("flow:nodeProps.collapse"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsx(Xf,{value:e.body,onChange:T=>v({body:T}),images:e.images,onImagesChange:T=>v({images:T}),disabled:s,placeholder:p("flow:nodeProps.bodyPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:f,variant:"expand"})]})}):null]})}function Iv(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 PW(e){const t=Iv(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 DA(e){try{return JSON.stringify(JSON.parse(e.trim()),null,2)}catch{return e}}function aN({text:e}){const{t}=Ut(),n=e||"";return n.trim()?a.jsx("div",{className:"af-run-ctx-md",children:a.jsx(Ld,{children:n})}):a.jsx("div",{className:"af-run-ctx-hint",children:t("flow:runContext.empty")})}function lN({o:e}){var r;const{t}=Ut(),n=Iv(e);if(n==="image"||e.encoding==="base64"&&((r=e.mimeType)!=null&&r.startsWith("image/"))){const s=`data:${e.mimeType||"image/png"};base64,${e.content||""}`;return a.jsxs("div",{className:"af-run-ctx-media",children:[a.jsx("img",{className:"af-run-ctx-img",src:s,alt:e.slot||"output",loading:"lazy"}),e.truncated?a.jsx("div",{className:"af-run-ctx-hint",children:t("flow:runContext.imageTruncated")}):null]})}if(n==="json")return a.jsx("pre",{className:"af-run-ctx-pre",children:DA(e.content||"")});if(n==="markdown"){const i=e.content||"";return i.trim()?a.jsx("div",{className:"af-run-ctx-md",children:a.jsx(Ld,{children:i})}):a.jsx("div",{className:"af-run-ctx-hint",children:t("flow:runContext.empty")})}return a.jsx("pre",{className:"af-run-ctx-pre",children:e.content!=null&&e.content!==""?e.content:t("flow:runContext.empty")})}function cN(e){return PW(e)}function uN(e){var r;if(!e)return null;const t=Iv(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"?DA(String(n)):String(n)}function dN({text:e,title:t,copiedLabel:n}){const[r,i]=m.useState(!1);if(!e)return null;const s=async()=>{try{await navigator.clipboard.writeText(e),i(!0),window.setTimeout(()=>i(!1),1400)}catch{}};return a.jsx("button",{type:"button",className:"af-icon-btn af-run-ctx-copy-btn",onClick:s,title:r?n:t,"aria-label":r?n:t,children:a.jsx("span",{className:"material-symbols-outlined",children:r?"check":"content_copy"})})}const fN=2e4,FA="af:run-node-ctx-width";function Ep(){return typeof window>"u"?416:Math.min(26*16,window.innerWidth-32)}function Ao(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):Ao(Ep())}function AW(){try{const e=localStorage.getItem(FA);if(e==null)return Ao(Ep());const t=parseInt(e,10);return Number.isFinite(t)?Ao(t):Ao(Ep())}catch{return Ao(Ep())}}async function pN(e,t,n,r){const i=new URLSearchParams({flowId:e,instanceId:t});n&&String(n).trim()&&i.set("runId",String(n).trim());const s=await fetch(`/api/node-exec-context?${i.toString()}`,{signal:r}),o=await s.text();let l;try{l=JSON.parse(o)}catch{throw new Error(o.startsWith("<!")||o.startsWith("<html")?"apiConnectError":"invalidJson")}if(!s.ok)throw new Error(l.error||"HTTP "+s.status);return l}function IW(e,t){const n=`flow:runContext.${t}`,r=e(n);return r!==n?r:t}function TW({instanceId:e,flowId:t,runId:n,nodeStatus:r,onClose:i}){const{t:s}=Ut(),[o,l]=m.useState(()=>typeof window<"u"&&window.matchMedia("(max-width: 960px)").matches),[c,d]=m.useState(AW),u=m.useRef({active:!1,pointerId:-1,startX:0,startW:416}),[f,p]=m.useState(!0),[h,g]=m.useState(""),[b,S]=m.useState([]),[x,w]=m.useState(null),[v,k]=m.useState(null),E=m.useRef(null),j=m.useRef(null),A=m.useRef(0),$=m.useRef(0);m.useLayoutEffect(()=>{const P=window.matchMedia("(max-width: 960px)"),R=()=>l(P.matches);return P.addEventListener("change",R),()=>P.removeEventListener("change",R)},[]),m.useEffect(()=>{function P(){d(R=>Ao(R))}return window.addEventListener("resize",P),()=>window.removeEventListener("resize",P)},[]);const I=m.useCallback(()=>{d(P=>{const R=Ao(P);try{localStorage.setItem(FA,String(R))}catch{}return R})},[]),F=m.useCallback(P=>{if(o||P.button!==0)return;P.preventDefault();const R=P.currentTarget;u.current={active:!0,pointerId:P.pointerId,startX:P.clientX,startW:c},R.setPointerCapture(P.pointerId)},[o,c]),L=m.useCallback(P=>{const R=u.current;if(!R.active||P.pointerId!==R.pointerId)return;const C=R.startX-P.clientX;d(Ao(R.startW+C))},[]),T=m.useCallback(P=>{const R=u.current;if(!(!R.active||P.pointerId!==R.pointerId)){R.active=!1;try{P.currentTarget.releasePointerCapture(P.pointerId)}catch{}I()}},[I]),q=m.useCallback(()=>{const P=u.current;P.active&&(P.active=!1,I())},[I]),D=m.useCallback(P=>{const R=Array.isArray(P)?P:[];S(R),w(C=>C&&R.some(G=>G.execId===C)?C:R.length>0?R[R.length-1].execId:null)},[]),W=m.useCallback(()=>{if(!e||!t)return;const P=++A.current,R=new AbortController,C=window.setTimeout(()=>R.abort(),fN);(async()=>{try{const G=await pN(t,e,n,R.signal);if(P!==A.current)return;D(Array.isArray(G.rounds)?G.rounds:[])}catch{}finally{window.clearTimeout(C)}})()},[e,t,n,D]);m.useEffect(()=>{if(!e||!t){p(!1),g(""),S([]);return}const P=++$.current;p(!0),g(""),S([]),w(null);const R=new AbortController,C=window.setTimeout(()=>R.abort(),fN);return(async()=>{try{const G=await pN(t,e,n,R.signal);if(P!==$.current)return;D(Array.isArray(G.rounds)?G.rounds:[])}catch(G){if(P!==$.current)return;const J=(G==null?void 0:G.name)==="AbortError"?"requestTimeout":G.message||String(G);g(J)}finally{window.clearTimeout(C),P===$.current&&p(!1)}})(),()=>{R.abort(),$.current++,A.current++}},[e,t,n,D]),m.useEffect(()=>{r&&W()},[r,W]),m.useEffect(()=>{clearInterval(j.current);const P=b.length>0?b[b.length-1]:null;return(r==="running"&&b.length===0||!!(P&&P.status==="running"))&&e&&t&&(j.current=setInterval(()=>W(),2e3)),()=>clearInterval(j.current)},[b,e,t,n,r,W]),m.useEffect(()=>{E.current&&(E.current.scrollTop=0)},[x]);const O=b.find(P=>P.execId===x),U=o?void 0:{width:`${c}px`};return a.jsxs("aside",{className:"af-run-ctx-panel",style:U,"aria-label":s("flow:runContext.title"),children:[o?null:a.jsx("div",{className:"af-run-ctx-resize",role:"separator","aria-orientation":"vertical","aria-label":s("flow:runContext.resizeHandle"),onPointerDown:F,onPointerMove:L,onPointerUp:T,onPointerCancel:T,onLostPointerCapture:q}),a.jsxs("div",{className:"af-run-ctx-panel__main",children:[a.jsxs("div",{className:"af-run-ctx-head",children:[a.jsx("h2",{className:"af-run-ctx-title",title:e,children:e}),a.jsx("button",{type:"button",className:"af-icon-btn",onClick:i,"aria-label":s("common:common.close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),f&&a.jsx("div",{className:"af-run-ctx-placeholder",children:s("common:common.loading")}),h&&a.jsx("div",{className:"af-run-ctx-error",children:IW(s,h)}),!f&&!h&&b.length===0&&a.jsx("div",{className:"af-run-ctx-placeholder",children:s(r==="running"?"flow:runContext.executingNoArtifacts":"flow:runContext.noData")}),b.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"af-run-ctx-rounds af-run-ctx-rounds--select af-run-ctx-round--"+LW((O==null?void 0:O.status)||""),children:[a.jsx("span",{className:"af-run-ctx-round-dot","aria-hidden":!0}),a.jsx("select",{className:"af-run-ctx-round-select",value:String(x??""),onChange:P=>{const R=P.target.value;w(R==="latest"?"latest":Number(R))},children:[...b].reverse().map(P=>{const R=P.execId==="latest"?s("flow:runContext.latest"):`#${P.execId}`,C=OW(s,P.status),G=P.finishedAt?` · ${RW(P.finishedAt)}`:"";return a.jsx("option",{value:String(P.execId),children:`${R} · ${C}${G}`},P.execId)})})]}),O&&a.jsxs("div",{className:"af-run-ctx-body",ref:E,children:[O.inputs&&O.inputs.length>0&&a.jsxs("section",{className:"af-run-ctx-section",children:[a.jsxs("h3",{className:"af-run-ctx-section-title",children:[a.jsx("span",{className:"material-symbols-outlined af-run-ctx-section-icon","aria-hidden":!0,children:"input"}),"Inputs"]}),O.inputs.map((P,R)=>a.jsxs("div",{className:"af-run-ctx-output-slot",children:[a.jsx("div",{className:"af-run-ctx-slot-head",children:a.jsx("div",{className:"af-run-ctx-slot-name",children:P.slot})}),a.jsx("pre",{className:"af-run-ctx-slot-text",children:P.value})]},`${P.slot}-${R}`))]}),O.prompt!=null&&a.jsxs("section",{className:"af-run-ctx-section",children:[a.jsxs("h3",{className:"af-run-ctx-section-title",children:[a.jsx("span",{className:"material-symbols-outlined af-run-ctx-section-icon","aria-hidden":!0,children:"description"}),"Prompt",a.jsx("button",{type:"button",className:"af-icon-btn af-run-ctx-section-expand",onClick:()=>k("prompt"),title:s("flow:nodeProps.expand"),children:a.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),a.jsx(aN,{text:O.prompt})]}),O.outputs&&O.outputs.length>0&&a.jsxs("section",{className:"af-run-ctx-section",children:[a.jsxs("h3",{className:"af-run-ctx-section-title",children:[a.jsx("span",{className:"material-symbols-outlined af-run-ctx-section-icon","aria-hidden":!0,children:"output"}),"Outputs",a.jsx("button",{type:"button",className:"af-icon-btn af-run-ctx-section-expand",onClick:()=>k("output"),title:s("flow:nodeProps.expand"),children:a.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),O.outputs.map((P,R)=>{const C=cN(P),G=uN(P);return a.jsxs("div",{className:"af-run-ctx-output-slot",children:[a.jsxs("div",{className:"af-run-ctx-slot-head",children:[a.jsx("div",{className:"af-run-ctx-slot-name",children:P.slot}),C?a.jsx("span",{className:"af-run-ctx-format-badge",title:s("flow:runContext.detectedContentType"),children:C}):null,a.jsx(dN,{text:G,title:s("common:common.copy"),copiedLabel:s("common:common.copied")})]}),a.jsx(lN,{o:P})]},`${P.slot}-${R}`)})]}),!O.prompt&&(!O.outputs||O.outputs.length===0)&&a.jsx("div",{className:"af-run-ctx-placeholder",children:s("flow:runContext.roundNoContent")})]})]})]}),v&&O&&a.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true",onClick:P=>{P.target===P.currentTarget&&k(null)},children:a.jsxs("div",{className:"af-node-props-expand-panel",children:[a.jsxs("div",{className:"af-node-props-expand-head",children:[a.jsx("span",{className:"af-node-props-expand-title",children:v==="prompt"?"Prompt":"Outputs"}),a.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>k(null),"aria-label":s("common:common.close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsxs("div",{className:"af-node-props-expand-body af-run-ctx-expand-body",children:[v==="prompt"&&O.prompt!=null&&a.jsx(aN,{text:O.prompt}),v==="output"&&O.outputs&&O.outputs.map((P,R)=>{const C=cN(P),G=uN(P);return a.jsxs("div",{className:"af-run-ctx-output-slot",style:{marginBottom:"1rem"},children:[a.jsxs("div",{className:"af-run-ctx-slot-head",children:[a.jsx("div",{className:"af-run-ctx-slot-name",children:P.slot}),C?a.jsx("span",{className:"af-run-ctx-format-badge",children:C}):null,a.jsx(dN,{text:G,title:s("common:common.copy"),copiedLabel:s("common:common.copied")})]}),a.jsx(lN,{o:P})]},`${P.slot}-${R}`)})]})]})})]})}function RW(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 LW(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 OW(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 MW({flowId:e,flowSource:t,flowArchived:n,provideNodes:r,edges:i,nodes:s,onCliInputsChange:o,onBackToEdit:l}){const{t:c}=Ut(),[d,u]=m.useState({}),[f,p]=m.useState(null),[h,g]=m.useState({}),[b,S]=m.useState(!0),[x,w]=m.useState(!1),[v,k]=m.useState(""),[E,j]=m.useState(!1),[A,$]=m.useState(null),I=m.useRef(null),F=m.useRef(!0),L=m.useRef({});m.useMemo(()=>{var C,G,J;const R={};for(const B of r){const te=(J=(G=(C=B.data)==null?void 0:C.outputs)==null?void 0:G[0])==null?void 0:J.default;te!=null&&te!==""&&(R[B.id]=String(te))}return L.current=R,R},[r]);const T=m.useMemo(()=>{var C;const R={};for(const G of s){if(!((C=G.data)!=null&&C.inputs))continue;const J=G.data.inputs;for(let B=0;B<J.length;B++){const te=J[B];if(!(te!=null&&te.name))continue;const de=i.find(ue=>ue.target===G.id&&ue.targetHandle===`input-${B}`);if(!(de!=null&&de.source))continue;r.find(ue=>ue.id===de.source)&&(R[de.source]=te.name)}}return R},[s,i,r]);m.useEffect(()=>(F.current=!0,()=>{F.current=!1}),[]),m.useEffect(()=>{if(!e){S(!1);return}S(!0);const R=new URLSearchParams({flowId:e,flowSource:t||"user"});n&&R.set("archived","1"),fetch(`/api/flow/run-config?${R.toString()}`).then(C=>{if(!C.ok)throw new Error(`HTTP ${C.status}`);return C.json()}).then(C=>{var J;if(!F.current)return;u(C.presets||{}),p(C.activePreset||null);const G=C.activePreset&&((J=C.presets)!=null&&J[C.activePreset])?C.presets[C.activePreset]:{};g({...L.current,...G}),S(!1)}).catch(()=>{F.current&&(g(L.current),S(!1))})},[e,t,n]),m.useEffect(()=>{var C;if(!o)return;const R={};for(const[G,J]of Object.entries(h)){const B=T[G];if(!B)continue;const te=r.find(ce=>ce.id===G);if(!te)continue;(((C=te.data)==null?void 0:C.definitionId)||"").startsWith("provide_file")?R[B]={type:"file",path:J}:R[B]={type:"str",value:J}}o(R)},[h,T,r,o]);const q=m.useCallback((R,C)=>{g(G=>({...G,[R]:C}))},[]),D=m.useCallback(R=>{R!==f&&(p(R),R&&d[R]?g({...L.current,...d[R]}):g(L.current))},[f,d]),W=m.useCallback(async()=>{if(v.trim()){w(!0);try{const R={...d,[v.trim()]:h},C={flowId:e,flowSource:t,archived:n,presets:R,activePreset:v.trim()};(await fetch("/api/flow/run-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(C)})).ok&&(u(R),p(v.trim()),k(""),j(!1))}finally{w(!1)}}},[e,t,n,d,h,v]),O=m.useCallback(async()=>{if(f){w(!0);try{const R={...d};delete R[f];const C=Object.keys(R)[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:R,activePreset:C})})).ok&&(u(R),p(C),C&&R[C]?g({...L.current,...R[C]}):g(L.current))}finally{w(!1)}}},[e,t,n,d,f]),U=m.useCallback(async()=>{if(f){w(!0);try{const R={...d,[f]:h};(await fetch("/api/flow/run-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:e,flowSource:t,archived:n,presets:R,activePreset:f})})).ok&&u(R)}finally{w(!1)}}},[e,t,n,d,f,h]),P=Object.keys(d);return P.length>0,b?a.jsx("aside",{className:"af-run-config-panel",children:a.jsx("div",{className:"af-run-config-loading",children:c("common.loading")})}):a.jsxs("aside",{className:"af-run-config-panel",children:[a.jsxs("div",{className:"af-run-config-preset",children:[a.jsx("label",{className:"af-run-config-preset-label",children:c("flow:runConfig.preset")}),a.jsxs("div",{className:"af-run-config-preset-row",children:[a.jsxs("select",{className:"af-run-config-preset-select",value:f||"",onChange:R=>D(R.target.value||null),disabled:x,children:[a.jsx("option",{value:"",children:c("flow:runConfig.default")}),P.map(R=>a.jsx("option",{value:R,children:R},R))]}),a.jsx("button",{type:"button",className:"af-run-config-preset-btn af-run-config-preset-btn--new",onClick:()=>j(!0),disabled:x,title:c("flow:runConfig.newPreset"),children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add"})}),f&&a.jsx("button",{type:"button",className:"af-run-config-preset-btn af-run-config-preset-btn--save",onClick:U,disabled:x,title:c("flow:runConfig.savePreset"),children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"save"})}),f&&a.jsx("button",{type:"button",className:"af-run-config-preset-btn af-run-config-preset-btn--delete",onClick:O,disabled:x,title:c("flow:runConfig.deletePreset"),children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"delete"})})]})]}),E&&a.jsxs("div",{className:"af-run-config-save-dialog",children:[a.jsx("input",{type:"text",className:"af-run-config-save-input",placeholder:c("flow:runConfig.presetNamePlaceholder"),value:v,onChange:R=>k(R.target.value),disabled:x}),a.jsxs("div",{className:"af-run-config-save-actions",children:[a.jsx("button",{type:"button",className:"af-btn-primary",onClick:W,disabled:x||!v.trim(),children:c(x?"common.saving":"common.save")}),a.jsx("button",{type:"button",className:"af-btn-outline",onClick:()=>{j(!1),k("")},disabled:x,children:c("common.cancel")})]})]}),a.jsxs("div",{className:"af-run-config-inputs",children:[a.jsx("div",{className:"af-run-config-inputs-header",children:c("flow:runConfig.inputParams")}),r.length===0?a.jsx("div",{className:"af-run-config-empty",children:c("flow:runConfig.noProvideNodes")}):a.jsx("div",{className:"af-run-config-input-list",children:r.map(R=>{var ue,re;const C=((ue=R.data)==null?void 0:ue.definitionId)||"",G=C.startsWith("provide_file"),J=C==="provide_bool",B=((re=R.data)==null?void 0:re.label)||R.id,te=R.id,de=h[te]||"",ce=["true","1","yes","on"].includes(String(de).trim().toLowerCase());return a.jsxs("div",{className:"af-run-config-input-item",children:[a.jsxs("div",{className:"af-run-config-input-head",children:[a.jsx("span",{className:"af-run-config-input-icon material-symbols-outlined"+(G?" af-run-config-input-icon--file":""),"aria-hidden":!0,children:G?"description":J?"toggle_on":"text_fields"}),a.jsx("span",{className:"af-run-config-input-label",children:B}),J?null:a.jsx("button",{type:"button",className:"af-run-config-input-expand",onClick:()=>$({instanceId:te,label:B,content:de}),"aria-label":c("flow:runConfig.expandInput"),title:c("flow:runConfig.expandInput"),children:a.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),a.jsx("div",{className:"af-run-config-input-id",children:te}),J?a.jsx("button",{type:"button",className:"af-run-config-bool-toggle"+(ce?" af-run-config-bool-toggle--true":""),onClick:()=>q(te,ce?"false":"true"),"aria-pressed":ce,children:ce?"true":"false"}):a.jsx("input",{type:"text",className:"af-run-config-input-field",value:de,onChange:ge=>q(te,ge.target.value),placeholder:c(G?"flow:runConfig.filePathPlaceholder":"flow:runConfig.stringValuePlaceholder")})]},te)})})]}),A&&Dr.createPortal(a.jsx("div",{className:"af-provide-edit-overlay",children:a.jsxs("div",{className:"af-provide-edit-modal",role:"dialog","aria-modal":"true",children:[a.jsxs("div",{className:"af-provide-edit-modal__head",children:[a.jsx("span",{className:"material-symbols-outlined",children:"edit_document"}),a.jsx("span",{className:"af-provide-edit-modal__title",children:A.label}),a.jsx("button",{type:"button",className:"af-provide-edit-modal__close",onClick:()=>$(null),"aria-label":c("common:close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsx("div",{className:"af-provide-edit-modal__body",children:a.jsx("textarea",{ref:I,className:"af-provide-edit-modal__textarea",defaultValue:A.content,autoFocus:!0})}),a.jsxs("div",{className:"af-provide-edit-modal__foot",children:[a.jsxs("button",{type:"button",className:"af-provide-edit-modal__btn af-provide-edit-modal__btn--save",onClick:()=>{!A||!I.current||(q(A.instanceId,I.current.value),$(null))},children:[a.jsx("span",{className:"material-symbols-outlined",children:"save"}),c("flow:provideEdit.save")]}),a.jsxs("button",{type:"button",className:"af-provide-edit-modal__btn",onClick:()=>$(null),children:[a.jsx("span",{className:"material-symbols-outlined",children:"close"}),c("flow:provideEdit.cancel")]})]})]})}),document.body)]})}const zA={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"]},$W={"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 DW(e){return!e||e<1024?`${e||0} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}function FW(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 zW(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 hN(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(zA))if(r.includes(e))return n;return"other"}function BW({event:e,defaultExpanded:t}){const[n,r]=m.useState(!!t),i=$W[e.tag]||"#a8a8a8",s=e.payload,o=s&&typeof s=="object",l=o?typeof s.text=="string"?s.text:"":String(s||""),c=o?s.meta:null,d=m.useMemo(()=>l?l.slice(0,140).replace(/\s+/g," "):o?Object.keys(s).filter(h=>h!=="text"&&h!=="meta").slice(0,3).map(h=>{const g=s[h];return g==null?`${h}:null`:typeof g=="object"?`${h}:{…}`:`${h}:${String(g).slice(0,30)}`}).join(" "):"",[s,l,o]),u=m.useCallback(f=>{f.stopPropagation();const p=o?JSON.stringify(s,null,2):String(s);try{navigator.clipboard.writeText(p)}catch{}},[s,o]);return a.jsxs("div",{style:{borderLeft:`3px solid ${i}`,background:n?"#1c1b1b":"#131313",marginBottom:4,borderRadius:4,cursor:"pointer",transition:"background 120ms"},onClick:()=>r(f=>!f),children:[a.jsxs("div",{style:{padding:"6px 10px",display:"flex",alignItems:"center",gap:10,fontSize:12},children:[a.jsx("span",{style:{color:"#9a9a9a",fontFamily:"monospace",flexShrink:0},children:FW(e.ts)}),a.jsx("span",{style:{color:i,fontWeight:600,fontFamily:"monospace",flexShrink:0,padding:"1px 6px",background:"rgba(255,255,255,0.04)",borderRadius:3},children:e.tag}),a.jsx("span",{style:{color:"#c5c2c1",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:"monospace"},children:d}),n&&a.jsx("button",{type:"button",onClick:u,style:{background:"rgba(124,77,255,0.15)",color:"#e8deff",border:"none",borderRadius:3,padding:"2px 8px",fontSize:11,cursor:"pointer"},children:"Copy"})]}),n&&a.jsxs("div",{style:{padding:"0 10px 10px 10px",borderTop:"1px solid rgba(255,255,255,0.04)"},children:[c&&Object.keys(c).length>0&&a.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?a.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}):o?a.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(s,null,2)}):null]})]})}function HW({open:e,onClose:t,flowId:n}){var $;const[r,i]=m.useState([]),[s,o]=m.useState(!1),[l,c]=m.useState(null),[d,u]=m.useState(null),[f,p]=m.useState(!1),[h,g]=m.useState(!0),[b,S]=m.useState({ai:!0,flow:!0,step:!0,output:!0,error:!0}),[x,w]=m.useState(""),v=m.useRef(null),k=m.useCallback(async()=>{o(!0);try{const I=h&&n?`?flowId=${encodeURIComponent(n)}`:"",L=await(await fetch(`/api/composer-logs${I}`)).json();i(Array.isArray(L.sessions)?L.sessions:[])}catch{i([])}finally{o(!1)}},[n,h]),E=m.useCallback(async I=>{if(!I){u(null);return}p(!0);try{const L=await(await fetch(`/api/composer-logs/${encodeURIComponent(I)}`)).json();u(L)}catch{u(null)}finally{p(!1)}},[]);m.useEffect(()=>{e&&k()},[e,k]),m.useEffect(()=>{if(!(!e||!l))return E(l),v.current=setInterval(()=>E(l),2e3),()=>{v.current&&clearInterval(v.current),v.current=null}},[e,l,E]);const j=m.useMemo(()=>{const I=(d==null?void 0:d.events)||[],F=x.trim().toLowerCase();return I.filter(L=>{const T=hN(L.tag,L.payload);return!b[T]&&T!=="other"?!1:F?[L.tag,JSON.stringify(L.payload||"")].join(" ").toLowerCase().includes(F):!0})},[d,b,x]),A=m.useMemo(()=>{const I=(d==null?void 0:d.events)||[],F={};for(const L of I){const T=hN(L.tag,L.payload);F[T]=(F[T]||0)+1}return F},[d]);return e?a.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:[a.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:[a.jsx("span",{style:{fontWeight:600,fontSize:14},children:"Composer Logs"}),a.jsx("span",{style:{fontSize:11,color:"#9a9a9a"},children:n?`flowId: ${n}`:"no flow selected"}),a.jsxs("label",{style:{fontSize:11,color:"#9a9a9a",display:"flex",alignItems:"center",gap:4,cursor:"pointer"},children:[a.jsx("input",{type:"checkbox",checked:h,onChange:I=>g(I.target.checked),disabled:!n}),"仅显示当前 flow"]}),a.jsx("button",{type:"button",onClick:k,style:{background:"rgba(124,77,255,0.15)",color:"#e8deff",border:"none",borderRadius:4,padding:"4px 10px",fontSize:12,cursor:"pointer"},children:"Refresh"}),a.jsx("span",{style:{flex:1}}),a.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"})]}),a.jsxs("div",{style:{flex:1,display:"flex",overflow:"hidden",minHeight:0},children:[a.jsxs("div",{style:{width:280,borderRight:"1px solid rgba(255,255,255,0.06)",overflowY:"auto",background:"#0e0e0e",flexShrink:0},children:[s&&a.jsx("div",{style:{padding:12,fontSize:12,color:"#9a9a9a"},children:"Loading…"}),!s&&r.length===0&&a.jsx("div",{style:{padding:12,fontSize:12,color:"#9a9a9a"},children:h&&n?"no sessions for this flow":"no sessions"}),r.map(I=>{const F=l===I.sessionId;return a.jsxs("div",{onClick:()=>c(I.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:[a.jsx("div",{style:{fontSize:12,fontWeight:600,color:"#e5e2e1"},children:zW(I.mtime)}),a.jsx("div",{style:{fontSize:11,color:"#9ecaff",marginTop:2,fontFamily:"monospace"},children:I.flowId||"(no flow)"}),I.promptPreview&&a.jsx("div",{style:{fontSize:11,color:"#9a9a9a",marginTop:4,overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:I.promptPreview}),a.jsxs("div",{style:{fontSize:10,color:"#6a6a6a",marginTop:4},children:[DW(I.size)," · ",I.model||"default"]})]},I.sessionId)})]}),a.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",minHeight:0},children:[a.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(zA).map(I=>a.jsxs("button",{type:"button",onClick:()=>S(F=>({...F,[I]:!F[I]})),style:{background:b[I]?"rgba(124,77,255,0.25)":"transparent",color:b[I]?"#e8deff":"#6a6a6a",border:`1px solid ${b[I]?"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:[I," ",A[I]!=null?`(${A[I]})`:""]},I)),a.jsx("input",{type:"text",placeholder:"search…",value:x,onChange:I=>w(I.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}})]}),a.jsxs("div",{style:{flex:1,overflowY:"auto",padding:12,minHeight:0},children:[!l&&a.jsx("div",{style:{color:"#9a9a9a",fontSize:12,padding:20,textAlign:"center"},children:"Select a session on the left to view events"}),f&&!d&&a.jsx("div",{style:{color:"#9a9a9a",fontSize:12,padding:20},children:"Loading…"}),d&&j.length===0&&a.jsxs("div",{style:{color:"#9a9a9a",fontSize:12,padding:20},children:["No events match current filter (",(($=d.events)==null?void 0:$.length)||0," total)"]}),j.map((I,F)=>a.jsx(BW,{event:I,defaultExpanded:I.tag==="error"},`${I.ts}_${F}`))]})]})]})]}):null}const UW="0.1.34";function mN(e){const t=Math.max(0,Number(e)||0),n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4),i=Math.floor(t%6e4/1e3);return`${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}:${String(i).padStart(2,"0")}`}function Vg(e,t){return t==="running"?mN(e):e==null||!Number.isFinite(e)||e<=0?"--":mN(e)}const BA=m.createContext({modelLists:{cursor:[],opencode:[]},onModelChange:()=>{}});function WW(e){const{setNodes:t}=Va(),{modelLists:n,onModelChange:r}=m.useContext(BA),i=m.useCallback(d=>{t(u=>u.filter(f=>f.id!==d))},[t]),s=m.useCallback(()=>{var p,h,g,b,S,x,w,v;const d=((p=e.data)==null?void 0:p.definitionId)||"",u=((h=e.data)==null?void 0:h.label)||e.id,f=((S=(b=(g=e.data)==null?void 0:g.outputs)==null?void 0:b[0])==null?void 0:S.value)||((v=(w=(x=e.data)==null?void 0:x.outputs)==null?void 0:w[0])==null?void 0:v.default)||"";window.__provideEditContent={instanceId:e.id,label:u,definitionId:d,content:f},window.dispatchEvent(new CustomEvent("provide-expand"))},[e.id,e.data]),o=m.useCallback((d,u)=>{t(f=>f.map(p=>{var g;if(p.id!==d)return p;const h=Array.isArray((g=p.data)==null?void 0:g.outputs)&&p.data.outputs.length?p.data.outputs.map((b,S)=>S===0?{...b,default:u,value:u}:b):[{type:"bool",name:"value",default:u,value:u}];return{...p,data:{...p.data,body:"",outputs:h}}}))},[t]),l=m.useCallback((d,u)=>{t(f=>f.map(p=>p.id===d?{...p,data:{...p.data,body:u}}:p))},[t]),c=m.useCallback((d,u)=>{t(f=>f.map(p=>p.id===d?{...p,data:{...p.data,images:Hr(u)}}:p))},[t]);return a.jsx(AA,{...e,deleteNode:i,onProvideExpand:s,onProvideValueChange:o,onNodeBodyChange:l,onNodeImagesChange:c,modelLists:n,onModelChange:r})}const VW={[Od]:WW},hu=["CONTROL","TOOL","PROVIDE","AGENT"],KW=1200,gN="af-flow-node--sync-flash",yN="af-flow-edge--sync-flash";function xN(e,t){const n=String(e||"").trim();return n?n.split(/\s+/).includes(t)?n:`${n} ${t}`:t}function wN(e,t){const n=String(e||"").trim();return n?n.split(/\s+/).filter(r=>r&&r!==t).join(" "):""}function Tv(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 qW(e){const t=Tv(e);return t==="CONTROL"?"control":t==="PROVIDE"?"provide":t==="TOOL"?"tool":"agent"}function Qf(e){return(Array.isArray(e)?e:[]).map(n=>{const r=String((n==null?void 0:n.name)||(n==null?void 0:n.id)||"").trim(),i=String((n==null?void 0:n.type)||"").trim();return!r&&!i?"":i?`${r||"-"}: ${i}`:r}).filter(Boolean)}function HA(e){return String((e==null?void 0:e.label)||"").trim()||String((e==null?void 0:e.id)||"").trim()}function UA(e){return String((e==null?void 0:e.description)||(e==null?void 0:e.body)||"").replace(/\s+/g," ").trim()}function Kg(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 vN(e,t,n){const r=String((t==null?void 0:t.name)||(t==null?void 0:t.id)||`#${n+1}`).trim(),i=String((t==null?void 0:t.type)||"").trim(),s=String((t==null?void 0:t.default)??(t==null?void 0:t.value)??"").trim();return[e,r,i?`type: ${i}`:"",s?`default: ${s}`:""].filter(Boolean).join(" · ")}function bN(e,t){const n=Array.isArray(e)?e:[],r=n.slice(0,4),i=Math.max(0,n.length-r.length);return{list:n,shown:r,hidden:i,kind:t}}function YW(e){return e==="CONTROL"?"account_tree":e==="TOOL"?"build":e==="PROVIDE"?"database":"smart_toy"}function GW(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 WA(e,t,n,r,i){const s=qW(e),o={id:t,type:Od,position:n,data:{label:e.label??e.id,definitionId:e.id,schemaType:s,inputs:Array.isArray(e.inputs)?e.inputs.map(l=>({...l})):[],outputs:Array.isArray(e.outputs)?e.outputs.map(l=>({...l})):[]}};return hd(o,r,i)}function kN(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 i=new Map(t.map(d=>[d.id,d])),s=i.get(n),o=i.get(r),l=fc(s,e.sourceHandle||"output-0","source"),c=fc(o,e.targetHandle||"input-0","target");return!l||!c?!1:dc(l,c)}function XW(e,t){const n=String((e==null?void 0:e.nodeId)||""),r=String((e==null?void 0:e.handleId)||""),i=(e==null?void 0:e.handleType)==="target"?"target":(e==null?void 0:e.handleType)==="source"?"source":"";if(!n||!r||!i)return null;const s=t.find(l=>l.id===n),o=fc(s,r,i);return o?{nodeId:n,handleId:r,handleType:i,slot:o,slotType:PA(o)}:null}function JW(e,t,n){var o;const r=WA(e,`__candidate_${e.id}`,{x:0,y:0},{},t),i=n.handleType==="source"?"inputs":"outputs",s=Array.isArray((o=r.data)==null?void 0:o[i])?r.data[i]:[];for(let l=0;l<s.length;l+=1){const c=s[l];if(n.handleType==="source"?dc(n.slot,c):dc(c,n.slot))return{slot:c,slotIndex:l,hydrated:r}}return null}function QW(e,t){return t?e.map((n,r)=>{const i=JW(n,e,t);if(!i)return null;const s=Tv(n);return{def:n,order:r,category:s,categoryRank:hu.indexOf(s),slot:i.slot,slotIndex:i.slotIndex,displayLabel:HA(i.hydrated.data||n),description:UA(n)}}).filter(Boolean).sort((n,r)=>{var o,l;const i=(o=n.slot)!=null&&o.required?0:1,s=(l=r.slot)!=null&&l.required?0:1;return i-s||n.slotIndex-r.slotIndex||n.categoryRank-r.categoryRank||n.order-r.order}):[]}const ZW=/@([a-zA-Z_][a-zA-Z0-9_]*)/g;function eV(e){const t=new Set,n=[];let r;const i=new RegExp(ZW.source,"g");for(;(r=i.exec(e))!==null;){const s=r[1];t.has(s)||(t.add(s),n.push(s))}return n}function SN(e,t){const n=e.slice(0,t),r=n.lastIndexOf("@");if(r<0)return null;const i=n.slice(r+1);return/[\s\n]/.test(i)?null:{atIndex:r,query:i}}function Hs(e){const t=String(e||"").indexOf(" - ");return t>=0?e.slice(0,t).trim():String(e||"").trim()}function Zf(e,t,n,r){const i=(e||"").trim();if(!i)return"";if(i.startsWith("opencode:")||i.startsWith("claude-code:"))return i;const s=Array.isArray(t)?t:[],o=Array.isArray(n)?n:[],l=Array.isArray(r)?r:[],c=s.map(Hs),d=o.map(Hs);return l.map(Hs).includes(i)&&!c.includes(i)&&!d.includes(i)?`claude-code:${i}`:d.includes(i)&&!c.includes(i)?`opencode:${i}`:i}function tV(e){if(e==null)return"";const t=String(e).trim();return t?t.length<=26?t:`${t.slice(0,12)}…${t.slice(-10)}`:""}function qg(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 nV({steps:e}){const{t}=Ut();return!e||e.length===0?null:a.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(),i=n.model||n.executorModel,s=[`${n.index+1}. ${r||"—"}`,n.nodeRole?t("flow:composer.stepRoleLabel",{role:n.nodeRole}):"",n.instanceId?t("flow:composer.stepInstanceLabel",{instanceId:n.instanceId}):"",i?`${t("flow:palette.model")}:${i}`:""].filter(Boolean).join(`
|
|
129
|
-
`),o=n.status||"pending";return a.jsxs("div",{className:"af-composer-step-chip"+(o==="done"?" af-composer-step-chip--done":"")+(o==="running"?" af-composer-step-chip--running":"")+(o==="error"?" af-composer-step-chip--error":"")+(o==="pending"?" af-composer-step-chip--pending":""),role:"listitem",title:s,children:[a.jsx("span",{className:"af-composer-step-chip-idx",children:n.index+1}),a.jsx("span",{className:"af-composer-step-chip-main",children:n.nodeRole||i?a.jsxs("span",{className:"af-composer-step-chip-meta",children:[n.nodeRole?a.jsx("span",{className:"af-composer-step-chip-role",children:n.nodeRole}):null,i?a.jsx("span",{className:"af-composer-step-chip-model",children:tV(i)}):null]}):null})]},n.index)})})}function rV(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 iV(e){const t=[];for(const n of e){if(!n||typeof n.text!="string"||!n.text.trim())continue;const i=typeof n.kind=="string"&&n.kind?n.kind:"assistant",s=t[t.length-1];s&&s.kind===i?s.text+=i==="error"||i==="result"?`
|
|
130
|
-
${n.text}`:n.text:t.push({kind:i,text:n.text})}return t}function sV(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 oV(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 NN({thread:e,liveSegments:t,running:n,className:r="",autoScroll:i=!0}){const{t:s}=Ut(),o=m.useRef(null),l=["af-composer-ai-stack","af-composer-ai-stack--in-panel","af-composer-thread-stack",r].filter(Boolean).join(" ");return m.useEffect(()=>{if(!i||!o.current)return;const c=o.current;requestAnimationFrame(()=>{c.scrollTop=c.scrollHeight})},[e,t,i]),a.jsxs("div",{ref:o,className:l,children:[e.map((c,d)=>c.type==="user"?a.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--user-msg",children:[a.jsx("div",{className:"af-composer-ai-block-label",children:s("flow:composer.yourQuestion")}),a.jsx("div",{className:"af-composer-ai-block-body",children:c.text})]},`composer-u-${d}-${c.text.slice(0,48)}`):a.jsx("div",{className:"af-composer-thread-assistant",children:a.jsx(jN,{segments:c.segments,running:!1})},`composer-a-${d}`)),a.jsx("div",{className:"af-composer-thread-assistant",children:a.jsx(jN,{segments:t,running:n})})]})}function jN({segments:e,running:t=!1}){const{t:n}=Ut(),r=e.filter(f=>f.kind==="assistant").map(f=>f.text).join(""),i=e.filter(f=>f.kind==="result").map(f=>f.text).join(""),s=rV(r,i),o=e.filter(f=>f.kind==="error").map(f=>f.text).join(`
|
|
131
|
-
`),l=e.filter(f=>f.kind!=="error"),c=s?l.filter(f=>f.kind!=="result"):l,d=iV(c),u=!!(d.length>0||o);return a.jsxs(a.Fragment,{children:[d.map((f,p)=>a.jsxs("section",{className:oV(f.kind),children:[a.jsx("div",{className:"af-composer-ai-block-label",children:sV(f.kind,n)}),a.jsx("div",{className:"af-composer-ai-block-body",children:f.text})]},`${f.kind}-${p}`)),t&&!u?a.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--reply af-composer-ai-block--pending",children:[a.jsx("div",{className:"af-composer-ai-block-label",children:n("flow:composer.reply")}),a.jsx("div",{className:"af-composer-ai-block-body",children:n("flow:composer.waiting")})]}):null,o?a.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--error",children:[a.jsx("div",{className:"af-composer-ai-block-label",children:n("flow:composer.error")}),a.jsx("div",{className:"af-composer-ai-block-body",children:o})]}):null]})}function aV({fitViewEpoch:e}){const{fitView:t}=Va(),n=m.useRef(t);return n.current=t,m.useEffect(()=>{if(e>0){const r=requestAnimationFrame(()=>n.current({padding:.2,duration:200,maxZoom:1}));return()=>cancelAnimationFrame(r)}},[e]),null}function lV({onReady:e}){const t=q_();return m.useEffect(()=>(e(t),()=>e(null)),[e,t]),null}function CN(e){const t=Number.isFinite(e)?e:1;return Math.min(Math.max(t,.75),1)}const _p=1500,EN=500,cV=262144,uV=2e3;function Yg(e){return typeof e!="string"?"":e.length<=uV?e:`[log line truncated, ${e.length} chars]`}const dV=_p;function fV(e){const t=e.match(/^\[([^\]]+)\]\s+\[([^\]]+)\]\s+([\s\S]*)$/);if(!t)return null;const[,n,r,i]=t;if(r==="cli")try{const s=JSON.parse(i);return s&&s.event==="node-start"?{ts:n,type:"node-start",text:`节点 ${s.instanceId||""}${s.label?` · ${s.label}`:""} 开始`}:s&&s.event==="node-done"?{ts:n,type:"node-done",text:`节点 ${s.instanceId||""} 完成${s.elapsed?` (${s.elapsed})`:""}`}:s&&s.event==="node-failed"?{ts:n,type:"node-failed",text:`节点 ${s.instanceId||""} 失败${s.error?`: ${s.error}`:""}`}:s&&s.event==="apply-start"?{ts:n,type:"info",text:`[apply-start] uuid=${s.uuid||""}`}:{ts:n,type:"info",text:Yg(i)}}catch{return{ts:n,type:"info",text:Yg(i)}}return{ts:n,type:"log",text:Yg(`[${r}] ${i}`)}}function _N(e){if(!e)return[];const t=[],n=e.split(`
|
|
132
|
-
`);for(let r=n.length-1;r>=0&&t.length<dV;r--){const i=n[r];if(!i)continue;const s=fV(i);s&&t.push(s)}return t.reverse(),t}function pV(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 i of n){const s=e[i],o=t[i];if(!o)return!1;if(s!==o&&(s.status!==o.status||(s.elapsed??null)!==(o.elapsed??null)))return!1}return!0}function hV(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 mV({fitViewEpoch:e,canvasTool:t,nodes:n,edges:r,onNodesChange:i,onEdgesChange:s,onConnect:o,onConnectStart:l,onConnectEnd:c,isValidConnection:d,onNodesDelete:u,onNodeClick:f,onNodeDoubleClick:p,onEdgeClick:h,onFlowInit:g,onDrop:b,onDragOver:S,hideMinimapAndControls:x,bottomSlot:w}){const{t:v}=Ut(),k=!i,E=k||t==="pan"?!0:[1,2],j=k?!1:t==="select",A="af-flow-canvas"+(k?" af-flow-canvas--run-mode":"")+(t==="pan"?" af-flow-canvas--tool-pan":" af-flow-canvas--tool-select"),$=m.useCallback(()=>{},[]),I=m.useMemo(()=>{const F=new Map(n.map(W=>[W.id,W])),L=new Set(n.filter(W=>W.selected).map(W=>W.id)),T=L.size>0,q=(W,O)=>{const U=/^#([0-9a-f]{6})$/i.exec(W);if(!U)return W;const P=parseInt(U[1],16);return`rgba(${P>>16&255}, ${P>>8&255}, ${P&255}, ${O})`},D="#ff5169";return r.map(W=>{var pe,ae,me,ze;const O=F.get(W.source),U=F.get(W.target),P=/^output-(\d+)$/.exec(W.sourceHandle||""),R=/^input-(\d+)$/.exec(W.targetHandle||""),C=O&&P?(ae=(pe=O.data)==null?void 0:pe.outputs)==null?void 0:ae[parseInt(P[1],10)]:null,G=U&&R?(ze=(me=U.data)==null?void 0:me.inputs)==null?void 0:ze[parseInt(R[1],10)]:null,J=C!=null&&C.type?In(C.type):null,B=G!=null&&G.type?In(G.type):null,te=J&&B&&J!==B,de=T&&(L.has(W.source)||L.has(W.target)),ce=W.style||{};if(te){const st=W.selected?.95:de?.85:.78,Ke=q(D,st);return{...W,className:((W.className||"")+" af-flow-edge--type-mismatch"+(de?" af-flow-edge--adjacent":"")).trim(),style:{...ce,stroke:Ke,strokeWidth:de?2.75:2.5,strokeDasharray:"6 4"},markerEnd:W.markerEnd&&typeof W.markerEnd=="object"?{...W.markerEnd,color:Ke}:{type:qr.ArrowClosed,color:Ke}}}const ue=J||B;if(!ue)return de?{...W,className:((W.className||"")+" af-flow-edge--adjacent").trim(),style:{...ce,strokeWidth:2.5}}:W;const re=de||W.selected?.7:.38,ge=q(ue,re),se=de?2.5:ce.strokeWidth??2;return{...W,className:((W.className||"")+(de?" af-flow-edge--adjacent":"")).trim(),style:{...ce,stroke:ge,strokeWidth:se},markerEnd:W.markerEnd&&typeof W.markerEnd=="object"?{...W.markerEnd,color:ge}:{type:qr.ArrowClosed,color:ge}}})},[n,r]);return a.jsxs(K_,{className:A,nodes:n,edges:I,onNodesChange:i||$,onEdgesChange:s||$,onConnect:k?void 0:o,onConnectStart:k?void 0:l,onConnectEnd:k?void 0:c,isValidConnection:k?void 0:d,onNodesDelete:k?void 0:u,onNodeClick:f,onNodeDoubleClick:k?void 0:p,onEdgeClick:k?void 0:h,onInit:g,onDrop:k?void 0:b,onDragOver:k?void 0:S,nodeTypes:VW,selectionOnDrag:j,panOnDrag:E,nodesDraggable:!k,nodesConnectable:!k,elementsSelectable:!k,edgesFocusable:!k,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:[a.jsx(J_,{gap:20,size:1,color:"rgba(28, 27, 27, 0.9)"}),a.jsx(cc,{position:"bottom-center",className:"af-flow-bottom-unified-panel"+(x?" af-flow-bottom-unified-panel--solo":""),children:a.jsxs("div",{className:"af-flow-bottom-unified-row"+(x?" af-flow-bottom-unified-row--solo":""),children:[x?null:a.jsx("div",{className:"af-flow-bottom-unified__side af-flow-bottom-unified__side--minimap",children:a.jsx(T4,{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 T;const L=(((T=F.data)==null?void 0:T.schemaType)??"agent").toLowerCase();return L==="control"?"rgba(237, 108, 2, 0.85)":L==="provide"?"rgba(0, 228, 117, 0.35)":L==="tool"?"rgba(124, 77, 255, 0.75)":"rgba(158, 202, 255, 0.5)"}})}),a.jsx("div",{className:"af-flow-bottom-unified__center",children:w}),x?null:a.jsx("div",{className:"af-flow-bottom-unified__side af-flow-bottom-unified__side--zoom",children:a.jsx(w4,{position:"bottom-right",showInteractive:!1,className:"af-flow-bottom-controls"})})]})}),!x&&a.jsx(cc,{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:L})=>a.jsxs("span",{className:"af-pin-legend__item",children:[a.jsx("span",{className:"af-pin-legend__dot",style:{background:L}}),a.jsx("span",{className:"af-pin-legend__label",children:F})]},F))}),a.jsx(aV,{fitViewEpoch:e}),!k&&n.length===0?a.jsxs("div",{className:"af-flow-empty-hint",children:[a.jsx("span",{className:"af-flow-empty-hint-icon material-symbols-outlined",children:"account_tree"}),a.jsx("p",{className:"af-flow-empty-hint-text",children:v("flow:emptyCanvas.composerHint")}),a.jsx("p",{className:"af-flow-empty-hint-sub",dangerouslySetInnerHTML:{__html:v("flow:emptyCanvas.composerSub")}})]}):null]})}function PN(e){if(!window.location.pathname.startsWith("/flow"))return;if(!e){window.history.replaceState({},"","/flow");return}const t=new URLSearchParams({flowId:e.id,flowSource:e.source??"user"});e.archived&&t.set("flowArchived","1"),window.history.replaceState({},"","/flow?"+t.toString())}function gV(e){return e==="builtin"?"workspace":e??"user"}function pl(e,t){return t(e==="builtin"?"flow:settings.builtin":e==="workspace"?"flow:palette.workspace":"flow:palette.userDir")}const VA="af:run-console-height",Tu=230,nu={enabled:!1,cron:"",timezone:"Asia/Shanghai",preset:"",overlapPolicy:"skip",misfirePolicy:"skip",nextRunAt:null},ep={};function Pp(e){if(!Number.isFinite(e))return Tu;const t=Math.max(240,Math.floor(window.innerHeight*.88));return Math.min(Math.max(Math.round(e),96),t)}function yV(){try{const e=localStorage.getItem(VA);if(e==null)return Tu;const t=parseInt(e,10);return Number.isFinite(t)?Pp(t):Tu}catch{return Tu}}function xV(){var E0,_0;const{t:e,i18n:t}=Ut(),{navigate:n,path:r}=Wa(),i=m.useRef(null),s=m.useCallback(y=>{i.current=typeof y=="function"?y:null},[]),[o,l]=m.useState([]),[c,d]=m.useState(""),[u,f]=m.useState(null),[p,h]=m.useState(0),[g,b]=m.useState(""),[S,x]=m.useState(""),[w,v]=m.useState(""),[k,E]=m.useState(""),[j,A]=m.useState(!1),[$,I]=m.useState(""),[F,L]=m.useState(!1),[T,q]=m.useState(""),[D,W]=m.useState(!1),[O,U]=m.useState(!1),[P,R]=m.useState(!1),[C,G]=m.useState(null),[J,B]=m.useState(!1),[te,de]=m.useState(!1),ce=m.useRef(!1),[ue,re]=m.useState([]),[ge,se]=m.useState(""),[pe,ae]=m.useState("nodes"),me=m.useRef(null),[ze,st]=m.useState([]),[Ke,Ee]=m.useState(!1),[It,sn]=m.useState(""),[Wt,mn]=m.useState(!1),[on,bn]=m.useState({name:"",id:"",description:""}),[xr,_n]=m.useState(!1),[oe,ye]=m.useState(""),[Ue,Ge]=m.useState(""),Qe=m.useRef(null),[Et,kn]=m.useState([]),[gt,Sn]=m.useState(!1),[On,Rt]=m.useState(""),[fe,Pe]=m.useState(""),[Mt,Mn]=m.useState(null),[dt,$n]=m.useState(null),[Ci,an]=m.useState([]),[wr,ar]=m.useState(""),[lr,fi]=m.useState(!1),Zi=m.useCallback(y=>{Qe.current&&window.clearTimeout(Qe.current),Ge(y),Qe.current=window.setTimeout(()=>{Ge(""),Qe.current=null},3800)},[]),cr=m.useCallback(y=>{const N=String(y||"").trim();N&&window.requestAnimationFrame(()=>{var M;(M=i.current)==null||M.call(i,N)})},[]);m.useEffect(()=>()=>{Qe.current&&window.clearTimeout(Qe.current)},[]);const[Qn,es]=m.useState(!1),[Xe,_t]=m.useState({files:[]}),[$t,Vt]=m.useState(!1),[Be,Dn]=m.useState(!0);m.useEffect(()=>{let y=!1;const N=()=>{fetch("/api/flows",{method:"HEAD"}).then(z=>{y||Dn(z.ok)}).catch(()=>{y||Dn(!1)})};N();const M=window.setInterval(N,5e3);return()=>{y=!0,window.clearInterval(M)}},[]),m.useEffect(()=>{let y=!1;return fetch("/api/dev-info").then(N=>N.json()).then(N=>{y||ve(!!(N!=null&&N.isDev))}).catch(()=>{}),()=>{y=!0}},[]),m.useEffect(()=>{u!=null&&u.id&&QC(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[Ce,gn]=m.useState("edit"),[vr,at]=m.useState([]),pi=m.useRef(0),[Vn,Kn]=m.useState(new Set),[Xr,Fn]=m.useState({}),[Jr,br]=m.useState(null),[ln,kr]=m.useState(0),[Sr,Qr]=m.useState(!1),[V,ve]=m.useState(!1),[Ie,He]=m.useState(!1),[ft,Je]=m.useState(yV),xt=m.useRef({active:!1,pointerId:-1,startY:0,startH:Tu}),[nt,qn]=m.useState(null),[Ei,_i]=m.useState(null),[Nn,As]=m.useState({}),zn=m.useRef(Nn);m.useEffect(()=>{zn.current=Nn},[Nn]);const[Pi,Ai]=m.useState(!1),[qa,Is]=m.useState(!1),[Ts,Rs]=m.useState({}),[rt,ts]=m.useState({}),[Ya,na]=m.useState(null),[cn,Ii]=m.useState(nu),[Bd,Hd]=m.useState(!1),[Zr,ra]=m.useState(!1),[yn,ns]=m.useState(""),[Ga,so]=m.useState(""),[St,Xa]=m.useState(ep),[Jt,Ls]=m.useState(null),Ja=m.useRef(0),rs=m.useRef(null),Qa=m.useRef(null),is=m.useRef(!0),ia=m.useRef(!1),[un,Os]=m.useState(null),[Nr,Za]=m.useState(null),[Ud,sa]=m.useState(!1),[el,tl]=m.useState(""),[nl,oa]=m.useState(!1),vm=m.useRef(null),[Ti,jc]=m.useState(null),[aa,la]=m.useState(!1),[Cc,Wd]=m.useState(null),[ca,Ec]=m.useState(!1),[oo,ua]=m.useState(null),rl=m.useRef(null),[jr,_]=m.useState(""),[K,X]=m.useState(0),[Z,ne]=m.useState(0),[le,we]=m.useState("pan"),[Ne,$e]=m.useState(!1),[qe,Lt]=m.useState(!1),Zn=m.useRef(null),Qt=m.useRef(null),er=m.useRef(null),[We,wt]=m.useState(0),[De,Kt]=m.useState(null),[Oe,vt]=m.useState(""),[ke,Zt]=m.useState({cursor:[],opencode:[],claudeCode:[]}),[da,Kv]=m.useState(""),[bm,sne]=m.useState(""),[Ms,RI]=m.useState([]),[fa,_c]=m.useState([]),[qv,LI]=m.useState(!1),[Vd,OI]=m.useState([]),[Yv,MI]=m.useState(!1),[$I,DI]=m.useState(()=>new Set),[Kd,km]=m.useState(!1),Sm=m.useRef(null),Gv=m.useRef(null),[FI,zI]=m.useState({}),qd=m.useCallback(y=>{if(!y)return null;const N=y.id,M=y.source??"user",z=y.archived?"archived":"";return{sessionsKey:`af:composer-sessions:${N}:${M}${z?":"+z:""}`,activeKey:`af:composer-active-session:${N}:${M}${z?":"+z:""}`}},[]),Xv=m.useCallback(y=>{if(!y)return"";const N=y.id,M=y.source??"user",z=y.archived?"archived":"";return`af:composer-skills:pipeline:${N}:${M}${z?":"+z:""}`},[]),Jv=m.useCallback(y=>{const N=qd(y);if(!N)return{sessions:[],activeSessionId:null};try{const M=localStorage.getItem(N.sessionsKey);if(!M)return{sessions:[],activeSessionId:null};const z=JSON.parse(M);if(!Array.isArray(z))return{sessions:[],activeSessionId:null};const H=z.filter(Q=>Q&&typeof Q.id=="string").map(Q=>({...Q,running:!1,statusLine:Q.running?e("flow:composer.pageRefreshReset"):Q.statusLine,steps:[]}));let Y=null;try{Y=localStorage.getItem(N.activeKey),Y&&!H.some(Q=>Q.id===Y)&&(Y=null)}catch{Y=null}return{sessions:H,activeSessionId:Y}}catch{return{sessions:[],activeSessionId:null}}},[qd]),Yd=m.useCallback((y,N,M)=>{const z=qd(y);if(z)try{localStorage.setItem(z.sessionsKey,JSON.stringify(N)),M?localStorage.setItem(z.activeKey,M):localStorage.removeItem(z.activeKey)}catch{}},[qd]),pa=m.useRef(0),Gd=m.useRef({sessions:[],activeSessionId:null,flowKey:null}),[Ri,ss]=m.useState([]),[ur,ao]=m.useState(null),lo=m.useMemo(()=>Xv(u),[Xv,u]),[Qv,Zv]=m.useState(""),Xd=m.useMemo(()=>{if(!u)return null;const y=u.id,N=u.source??"user",M=u.archived?"archived":"";return`${y}:${N}${M?":"+M:""}`},[u]),Nm=m.useRef(!1);m.useEffect(()=>{if(!Xd){ss([]),ao(null),Gd.current={sessions:[],activeSessionId:null,flowKey:null};return}const y=Gd.current;if(y.flowKey===Xd)return;y.flowKey=Xd,Nm.current&&y.sessions.length>0&&Yd(u,y.sessions,y.activeSessionId);const{sessions:N,activeSessionId:M}=Jv(u);if(N.length===0){const z=`session-1-${Date.now()}`,H={id:z,label:e("flow:composer.conversationLabel",{n:1}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null};y.sessions=[H],y.activeSessionId=z,ss([H]),ao(z)}else{const z=N[N.length-1];if(z&&(!z.thread||z.thread.length===0))pa.current=qg(N),y.sessions=N,y.activeSessionId=z.id,ss(N),ao(z.id);else{const Y=qg(N)+1;pa.current=Y;const Q=`session-${Y}-${Date.now()}`,ee={id:Q,label:e("flow:composer.conversationLabel",{n:Y}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null},he=[...N,ee];y.sessions=he,y.activeSessionId=Q,ss(he),ao(Q)}}Nm.current=!0},[Xd,u,Jv,Yd]);const jn=m.useMemo(()=>Ri.find(y=>y.id===ur)||null,[Ri,ur]),xn=(jn==null?void 0:jn.running)??!1,Pc=(jn==null?void 0:jn.statusLine)??"",Ac=(jn==null?void 0:jn.segments)??[],Ic=(jn==null?void 0:jn.thread)??[],e0=(jn==null?void 0:jn.steps)??[];jn==null||jn.outputDismissed;const lt=(jn==null?void 0:jn.phaseContext)??null,t0=m.useRef([]),[jm,Jd]=m.useState(!1),Qd=m.useRef(null),n0=m.useRef(null);m.useEffect(()=>{const y=n0.current;y&&requestAnimationFrame(()=>{y.scrollTop=y.scrollHeight})},[Ic,Ac]);const Cm=m.useRef(null),Em=m.useRef(!1),BI=m.useRef(null),r0=m.useCallback(y=>{const N=++pa.current,M=`session-${N}-${Date.now()}`,z={id:M,label:y||e("flow:composer.conversationLabel",{n:N}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null};return ss(H=>[...H,z]),ao(M),M},[]);m.useEffect(()=>{!u||!Nm.current||(Gd.current.sessions=Ri,Gd.current.activeSessionId=ur,Yd(u,Ri,ur))},[Ri,ur,u,Yd]),m.useEffect(()=>{pa.current=Math.max(pa.current,qg(Ri))},[Ri]);const i0=m.useCallback(y=>{var N;Cm.current===y&&((N=Qd.current)==null||N.abort()),ss(M=>{const z=M.filter(Y=>Y.id!==y);if(M.some((Y,Q)=>Y.id===y&&M.findIndex(ee=>ee.id===ur)===Q)||ur===y){const Y=z;Y.length>0?ao(Y[Y.length-1].id):setTimeout(()=>{pa.current=0;const Q=++pa.current,ee=`session-${Q}-${Date.now()}`,he={id:ee,label:e("flow:composer.conversationLabel",{n:Q}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null};ss(je=>[...je,he]),ao(ee)},0)}return z})},[ur]),Tr=m.useCallback(y=>{ss(N=>{const M=N.findIndex(Y=>Y.id===ur);if(M<0)return N;const z={...N[M]};y(z);const H=[...N];return H[M]=z,H})},[ur]),s0=m.useCallback(y=>{Tr(N=>{N.running=y})},[Tr]),os=m.useCallback(y=>{Tr(N=>{N.statusLine=y})},[Tr]),as=m.useCallback(y=>{Tr(N=>{typeof y=="function"?N.segments=y(N.segments):N.segments=y})},[Tr]),o0=m.useCallback(y=>{Tr(N=>{typeof y=="function"?N.thread=y(N.thread):N.thread=y})},[Tr]),Tc=m.useCallback(y=>{Tr(N=>{typeof y=="function"?N.steps=y(N.steps):N.steps=y})},[Tr]),a0=m.useCallback(y=>{Tr(N=>{N.outputDismissed=y})},[Tr]),Rc=m.useCallback(y=>{Tr(N=>{N.phaseContext=typeof y=="function"?y(N.phaseContext):y})},[Tr]),l0=m.useCallback(y=>{ao(y),ss(N=>{const M=N.findIndex(H=>H.id===y);if(M<0||!N[M].outputDismissed)return N;const z=[...N];return z[M]={...N[M],outputDismissed:!1},z})},[]);m.useEffect(()=>{t0.current=Ac},[Ac]);const hi=m.useRef({}),c0=m.useRef(!1),ha=m.useRef(null),co=m.useRef(null),Lc=m.useRef(!1),_m=m.useRef(0),Zd=m.useRef(""),[bt,pt,HI]=Y_([]),[dn,en,UI]=G_([]),uo=m.useRef(bt),ef=m.useRef(dn),Pm=m.useRef(null),u0=m.useRef(null),tf=m.useRef(null),[Rr,fo]=m.useState(null),Li=m.useMemo(()=>bt.filter(y=>{var N;return(((N=y.data)==null?void 0:N.definitionId)||"").startsWith("provide_")}),[bt]),il=m.useMemo(()=>{var N;const y={};for(const M of bt){if(!((N=M.data)!=null&&N.inputs))continue;const z=M.data.inputs;for(let H=0;H<z.length;H++){const Y=z[H];if(!(Y!=null&&Y.name))continue;const Q=dn.find(he=>he.target===M.id&&he.targetHandle===`input-${H}`);if(!(Q!=null&&Q.source))continue;Li.find(he=>he.id===Q.source)&&(y[Q.source]=Y.name)}}return y},[bt,dn,Li]),Oc=m.useMemo(()=>{if(Ce==="edit"||Vn.size===0)return null;const y=new Set(Vn);for(const N of dn)Vn.has(N.source)&&y.add(N.target),Vn.has(N.target)&&y.add(N.source);return y},[Ce,Vn,dn]),WI=m.useMemo(()=>Ce==="edit"?bt:bt.map(y=>{var N,M;return{...y,draggable:!1,connectable:!1,data:{...y.data,isRunMode:!0,isExecuting:Vn.has(y.id),nodeStatus:((N=Xr[y.id])==null?void 0:N.status)??null,nodeElapsed:((M=Xr[y.id])==null?void 0:M.elapsed)??null,isDim:Oc?!Oc.has(y.id):!1}}}),[Ce,bt,Vn,Xr,Oc]),VI=m.useMemo(()=>Oc?dn.map(y=>{const N=Vn.has(y.source)||Vn.has(y.target),M=y.className?y.className.replace(/\s?af-flow-edge--(dim|focus)\b/g,""):"",z=N?"af-flow-edge--focus":"af-flow-edge--dim";return{...y,className:(M?M+" ":"")+z}}):dn,[dn,Vn,Oc]);m.useEffect(()=>{if(!u){ts({}),na(null),Ii(nu),Xa(ep),Ls(null),ns(""),so("");return}const y=new URLSearchParams({flowId:u.id,flowSource:u.source||"user"});u.archived&&y.set("archived","1"),fetch(`/api/flow/run-config?${y.toString()}`).then(N=>N.json()).then(N=>{ts(N.presets||{}),na(N.activePreset||null)}).catch(()=>{ts({}),na(null)})},[u==null?void 0:u.id,u==null?void 0:u.source,u==null?void 0:u.archived]);const po=m.useCallback(y=>{Ja.current+=1,Ii(y)},[]),ho=m.useCallback(async(y,N={})=>{if(!y)return;const M=!!N.quiet,z=!!N.force,H=Ja.current;M||(Hd(!0),ns(""),so(""));const Y=new URLSearchParams({flowId:y.id,flowSource:y.source||"user"});y.archived&&Y.set("archived","1");try{const Q=await fetch(`/api/flow/schedule?${Y.toString()}`),ee=await Q.json().catch(()=>({}));if(!Q.ok)throw new Error(ee.error||`HTTP ${Q.status}`);if(!z&&Ja.current!==H)return;Ii({...nu,...ee.schedule||{}}),Xa(ee.state&&typeof ee.state=="object"?ee.state:ep),Ls(ee.status||null)}catch(Q){if(!z&&Ja.current!==H)return;Ii(nu),Xa(ep),Ls(null),ns(String(Q.message||Q))}finally{Hd(!1)}},[]);m.useEffect(()=>{if(!u)return;let y=!1;return(async()=>{await ho(u)})(),()=>{y=!0}},[u==null?void 0:u.id,u==null?void 0:u.source,u==null?void 0:u.archived,ho]),m.useEffect(()=>{var M,z,H,Y;if(!Ya||!rt[Ya]||Li.length===0)return;const y=rt[Ya],N={};for(const Q of Li){const ee=il[Q.id];if(!ee)continue;const he=((M=Q.data)==null?void 0:M.definitionId)||"",je=y[Q.id]??((Y=(H=(z=Q.data)==null?void 0:z.outputs)==null?void 0:H[0])==null?void 0:Y.default)??"";he.startsWith("provide_file")?N[ee]={type:"file",path:je}:N[ee]={type:"str",value:je}}Object.keys(N).length>0&&As(N)},[Ya,rt,Li,il]);const KI=m.useCallback(()=>{if(!oo||!rl.current)return;const y=rl.current.value;pt(N=>N.map(M=>{var z,H;return M.id!==oo.instanceId?M:{...M,data:{...M.data,outputs:((H=(z=M.data)==null?void 0:z.outputs)==null?void 0:H.map((Y,Q)=>Q===0?{...Y,default:y}:Y))||[{type:"text",name:"value",default:y}]}}})),ua(null)},[oo,pt]),Ze=m.useMemo(()=>{const y=bt.filter(N=>N.selected);return y.length===1?y[0]:null},[bt]),ls=m.useMemo(()=>u?GU(bt,dn,e):[],[u,bt,dn,e]),qI=m.useMemo(()=>ls.map(y=>y.key).join("|"),[ls]),d0=m.useMemo(()=>ls.some(y=>String((y==null?void 0:y.level)||"warning").toLowerCase()==="error"),[ls]);m.useLayoutEffect(()=>{B(ls.length>0&&!d0)},[qI,u==null?void 0:u.id,u==null?void 0:u.source,ls.length,d0]),er.current=Ze,m.useEffect(()=>{uo.current=bt},[bt]),m.useEffect(()=>{ef.current=dn},[dn]),m.useEffect(()=>{u0.current=Rr},[Rr]),m.useEffect(()=>{if(!Rr)return;const y=M=>{M.key==="Escape"&&fo(null)},N=M=>{var z,H;(H=(z=M.target)==null?void 0:z.closest)!=null&&H.call(z,".af-connect-node-menu")||fo(null)};return document.addEventListener("keydown",y),document.addEventListener("pointerdown",N),()=>{document.removeEventListener("keydown",y),document.removeEventListener("pointerdown",N)}},[Rr]),m.useEffect(()=>()=>{co.current!=null&&(clearTimeout(co.current),co.current=null)},[]);const Am=m.useMemo(()=>{var N;if(!Ze)return null;const y=(N=Ze.data)==null?void 0:N.definitionId;return ue.find(M=>M.id===y)??null},[Ze,ue]),Im=m.useMemo(()=>{const y={CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const N of ue){const M=Tv(N);y[M].push(N)}for(const N of hu)y[N].sort((M,z)=>M.id.localeCompare(z.id));return y},[ue]),nf=m.useMemo(()=>{const y=ge.trim().toLowerCase();if(!y)return Im;const N={CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const M of hu)N[M]=Im[M].filter(z=>GW(z,y));return N},[Im,ge]),YI=m.useMemo(()=>hu.reduce((y,N)=>y+nf[N].length,0),[nf]),rf=m.useMemo(()=>ue.filter(y=>{const N=String(y.id??""),M=String(y.source??"");return N.startsWith("marketplace:")||M==="marketplace"||M==="collection"}),[ue]),f0=m.useMemo(()=>{const y=new Set;for(const N of rf){const M=String(N.id??"");if(M&&(y.add(M),M.startsWith("marketplace:"))){const z=M.slice(12),[H]=z.split("@");H&&y.add(`marketplace:${H}`)}}return y},[rf]),sf=m.useCallback(async()=>{d("");try{const y=await fetch("/api/flows");if(!y.ok)throw new Error("HTTP "+y.status);l(await y.json())}catch(y){d(String(y.message||y))}},[]);m.useEffect(()=>{sf()},[sf]),m.useEffect(()=>{if(r!=="/flow")return;const y=new URLSearchParams(window.location.search);y.get("new")==="1"&&!y.get("flowId")&&n("/projects?new=1")},[r,n]),m.useEffect(()=>{let y=!1;const N=()=>{fetch("/api/model-lists").then(z=>z.json()).then(z=>{y||Zt({cursor:Array.isArray(z.cursor)?z.cursor.map(String):[],opencode:Array.isArray(z.opencode)?z.opencode.map(String):[],claudeCode:Array.isArray(z.claudeCode)?z.claudeCode.map(String):[]})}).catch(()=>{})};N();const M=setTimeout(N,4e3);return()=>{y=!0,clearTimeout(M)}},[]),m.useEffect(()=>{let y=!1;return fetch("/api/skills").then(N=>N.json()).then(N=>{if(y)return;const M=Array.isArray(N.skills)?N.skills.filter(z=>z&&typeof z.key=="string"&&z.key.trim()).map(z=>({key:String(z.key),name:String(z.name||z.id||z.key),description:z.description?String(z.description):"",sourceLabel:z.sourceLabel?String(z.sourceLabel):""})):[];RI(M),LI(!0)}).catch(()=>{}),()=>{y=!0}},[]),m.useEffect(()=>{let y=!1;return fetch("/api/skill-collections").then(N=>N.json()).then(N=>{y||(OI(zo(N)),MI(!0))}).catch(()=>{}),()=>{y=!0}},[]),m.useEffect(()=>{if(Zv(""),!(!qv||!Yv)){if(!lo){_c([]);return}_c(nE(lo,"pipeline",Ms,Vd)),Zv(lo)}},[Vd,Yv,Ms,qv,lo]),m.useEffect(()=>{if(!(Qv!==lo||!lo))try{localStorage.setItem(lo,JSON.stringify(fa))}catch{}},[fa,lo,Qv]);const p0=m.useCallback(async y=>{const N=y.source??"user",M=!!y.archived,z=new URLSearchParams({flowId:y.id,flowSource:N});M&&z.set("archived","1");const H=new URLSearchParams({flowId:y.id,flowSource:N});M&&H.set("archived","1"),H.set("lang",String(t.language||"zh").startsWith("zh")?"zh":"en");const[Y,Q]=await Promise.all([fetch("/api/flow?"+z.toString()),fetch("/api/nodes?"+H.toString())]),ee=await Y.json();if(!Y.ok||ee.error)throw new Error(ee.error||e("flow:nodePropsError.loadFlowFailed"));const he=await Q.json();if(!Q.ok)throw new Error(e("flow:nodePropsError.loadNodesFailed"));const je=Array.isArray(he)?he:Array.isArray(he==null?void 0:he.nodes)?he.nodes:[],Te=!Array.isArray(he)&&(he==null?void 0:he.pipelineTranslations)||{},ie=qU(ee.flowYaml||"");if(ie.error)throw new Error(ie.error);const _e={...ie.instances||{}},xe=ie.nodes.map(Dt=>hd(Dt,_e,je,Te,y.id)),et=_A(ie.edges,xe);return{flowSource:N,paletteList:je,instances:_e,flowDescriptionText:ie.description??"",nodes:xe,edges:et}},[t.language,e]),mi=m.useCallback(async(y,N={})=>{const M=!!N.preserveComposer,z=M&&!!N.incrementalSync;Lc.current=!1,_m.current+=1,f(y),x(""),M||(v(""),se(""),$n(null),b(""),I(""),q(""),_(""),o0([]),as([]),Tc([]),a0(!1),Rc(null),we("pan")),z||(hi.current={},pt([]),en([])),PN(y);try{const H=await p0(y);if(re(H.paletteList),hi.current=H.instances,b(H.flowDescriptionText),I(y.id||""),z){const Y=uo.current,Q=ef.current;try{const ee=N6(Y,Q,H.nodes,H.edges),he=new Set([...ee.changes.addedNodeIds,...ee.changes.updatedNodeIds]),je=new Set([...ee.changes.addedEdgeKeys,...ee.changes.updatedEdgeKeys]),Te=he.size>0?ee.nodes.map(_e=>he.has(_e.id)?{..._e,className:xN(_e.className,gN)}:_e):ee.nodes,ie=je.size>0?ee.edges.map(_e=>je.has(cd(_e))?{..._e,className:xN(_e.className,yN)}:_e):ee.edges;pt(Te),en(ie),co.current!=null&&(clearTimeout(co.current),co.current=null),(he.size>0||je.size>0)&&(co.current=window.setTimeout(()=>{co.current=null,he.size>0&&pt(_e=>_e.map(xe=>{if(!he.has(xe.id))return xe;const et=wN(xe.className,gN);return et===String(xe.className||"")?xe:{...xe,className:et}})),je.size>0&&en(_e=>_e.map(xe=>{if(!je.has(cd(xe)))return xe;const et=wN(xe.className,yN);return et===String(xe.className||"")?xe:{...xe,className:et}}))},KW))}catch{pt(H.nodes),en(H.edges)}}else pt(H.nodes),en(H.edges),h(Y=>Y+1);Of(y.id,H.flowSource),wt(Y=>Y+1);try{Zd.current=nN(H.nodes,H.edges,H.instances,{description:H.flowDescriptionText})}catch{Zd.current=""}Lc.current=!0}catch(H){x(String(H.message||H))}},[p0,pt,en]),of=m.useCallback(async()=>{if(!(u!=null&&u.id))return;const y=u.source??"user",N=new URLSearchParams({flowId:u.id,flowSource:y});u.archived&&N.set("archived","1"),N.set("lang",String(t.language||"zh").startsWith("zh")?"zh":"en");const M=await fetch("/api/nodes?"+N.toString()),z=await M.json();if(!M.ok)throw new Error((z==null?void 0:z.error)||e("flow:nodePropsError.loadNodesFailed"));const H=Array.isArray(z)?z:Array.isArray(z==null?void 0:z.nodes)?z.nodes:[];re(H)},[u,e,t.language]),Tm=m.useCallback(async()=>{Sn(!0),Rt("");try{const y=await fetch("/api/marketplace/nodes"),N=await y.json().catch(()=>({}));if(!y.ok)throw new Error((N==null?void 0:N.error)||"Failed to load marketplace nodes");kn(Array.isArray(N==null?void 0:N.nodes)?N.nodes:[])}catch(y){Rt(String(y.message||y)),kn([])}finally{Sn(!1)}},[]),af=m.useCallback(async()=>{Ee(!0),sn("");try{const y=await fetch("/api/marketplace/flow-snippets"),N=await y.json().catch(()=>({}));if(!y.ok)throw new Error((N==null?void 0:N.error)||"Failed to load flow snippets");st(Array.isArray(N==null?void 0:N.snippets)?N.snippets:[])}catch(y){sn(String(y.message||y)),st([])}finally{Ee(!1)}},[]);m.useEffect(()=>{u&&(Tm(),af())},[u==null?void 0:u.id,u==null?void 0:u.source,u==null?void 0:u.archived,Tm,af]);const GI=m.useCallback(async y=>{if(!u||!y)return;const N=y.definitionId||`marketplace:${y.id}${y.version?`@${y.version}`:""}`;if(N){Pe(N),Rt("");try{const M=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:N})}),z=await M.json().catch(()=>({}));if(!M.ok||(z==null?void 0:z.ok)===!1)throw new Error((z==null?void 0:z.error)||"Failed to install marketplace node");await of()}catch(M){Rt(String(M.message||M))}finally{Pe("")}}},[u,of]),XI=m.useCallback(async(y,N)=>{const M={packageId:(y==null?void 0:y.newId)||(y==null?void 0:y.id)||(y==null?void 0:y.label),label:(y==null?void 0:y.label)||(y==null?void 0:y.newId)||(y==null?void 0:y.id),version:"1.0.0",definitionId:N,body:(y==null?void 0:y.body)||"",script:(y==null?void 0:y.script)||"",inputs:Array.isArray(y==null?void 0:y.inputs)?y.inputs:[],outputs:Array.isArray(y==null?void 0:y.outputs)?y.outputs:[],flowId:u==null?void 0:u.id,flowSource:(u==null?void 0:u.source)||"user"},z=await fetch("/api/marketplace/publish-node-from-instance",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(M)}),H=await z.json();if(!z.ok||(H==null?void 0:H.ok)===!1)throw new Error((H==null?void 0:H.error)||"Publish failed");return await of(),H},[of,u]),h0=m.useCallback(async()=>{var z;if(!u||ce.current)return;const y=u.id,N=u.source??"user",M=((z=er.current)==null?void 0:z.id)??null;ce.current=!0,de(!0);try{await mi({id:y,source:N,archived:u.archived},{preserveComposer:!0,incrementalSync:!0}),M&&pt(H=>H.map(Y=>({...Y,selected:Y.id===M})))}finally{ce.current=!1,de(!1)}},[u,u==null?void 0:u.archived,mi,pt]);m.useEffect(()=>{if(c0.current||o.length===0)return;const y=new URLSearchParams(window.location.search),N=y.get("flowId");if(!N)return;const M=y.get("flowSource")??"user",z=y.get("flowArchived")==="1",H=o.find(Y=>Y.id===N&&(Y.source??"user")===M&&!!Y.archived===z);H&&(c0.current=!0,mi(H))},[o,mi]);const lf=m.useRef(0);m.useEffect(()=>{if(!u)return;const y=u.id,N=u.source??"user",M=!!u.archived;lf.current=0;let z=!1;const H=async()=>{var ee;if(z)return;const Q=new URLSearchParams({flowId:y,flowSource:N,v:String(lf.current)});M&&Q.set("archived","1");try{const he=await fetch("/api/flow-editor-sync-poll?"+Q.toString());if(!he.ok||z)return;const je=await he.json();if(z)return;if(je.changed){lf.current=je.version;const Te=((ee=er.current)==null?void 0:ee.id)??null;await mi({id:y,source:N,archived:M},{preserveComposer:!0,incrementalSync:!0}),await ho({id:y,source:N,archived:M},{quiet:!0,force:!0}),Te&&pt(ie=>ie.map(_e=>({..._e,selected:_e.id===Te})))}else lf.current=je.version}catch{}},Y=window.setInterval(H,2e3);return H(),()=>{z=!0,window.clearInterval(Y)}},[u==null?void 0:u.id,u==null?void 0:u.source,u==null?void 0:u.archived,mi,ho,pt]);const JI=m.useMemo(()=>w?w.startsWith(e("flow:status.saveFailed"))?" af-palette-tip--error":w===e("flow:status.saved")?" af-palette-tip--success":" af-palette-tip--info":"",[w]);m.useEffect(()=>{if(!w)return;w===e("flow:status.saved")||w.startsWith(e("flow:status.runInTerminal"));const y=w.startsWith(e("flow:status.runInTerminal"))?5200:2800,N=window.setTimeout(()=>v(""),y);return()=>clearTimeout(N)},[w,e]),m.useEffect(()=>{E("")},[u==null?void 0:u.id,u==null?void 0:u.source]),m.useEffect(()=>{const y=()=>{window.__provideEditContent&&(ua(window.__provideEditContent),window.__provideEditContent=null)};return window.addEventListener("provide-expand",y),()=>window.removeEventListener("provide-expand",y)},[]),m.useEffect(()=>{var ee,he,je,Te,ie,_e,xe;if(!Ze){Kt(null);return}const y=hi.current[Ze.id]||{},{inputs:N,outputs:M}=EA(Ze),z=String(((ee=Ze.data)==null?void 0:ee.definitionId)??Ze.id??""),H=((he=Ze.data)==null?void 0:he.script)!=null?String(Ze.data.script):void 0,Y=y.script!=null?String(y.script):void 0,Q=z==="tool_nodejs"||H&&H.trim()!==""||Y&&Y.trim()!==""?String(H??Y??""):"";Kt({id:Ze.id,newId:Ze.id,label:String(((je=Ze.data)==null?void 0:je.label)??Ze.id),role:((Te=Ze.data)==null?void 0:Te.role)??"普通",model:String(((ie=Ze.data)==null?void 0:ie.model)??y.model??""),body:String(((_e=Ze.data)==null?void 0:_e.body)??y.body??""),images:Hr(((xe=Ze.data)==null?void 0:xe.images)??y.images),script:Q,inputs:N,outputs:M})},[Ze==null?void 0:Ze.id,We]),m.useEffect(()=>{u&&(Ze||(Qt.current=null,$n(y=>y==="node"?null:y)))},[u,Ze==null?void 0:Ze.id]);const cf=m.useCallback(()=>{Qt.current=null,$n(y=>y==="settings"||y==="history"?y:"node")},[]),QI=m.useCallback((y,N)=>{y.metaKey||y.ctrlKey||y.shiftKey||Ce!=="edit"&&_i((N==null?void 0:N.id)??null)},[Ce]),ZI=m.useCallback((y,N)=>{Ce==="edit"&&(y.preventDefault(),pt(M=>M.map(z=>({...z,selected:z.id===N.id}))),en(M=>M.map(z=>({...z,selected:!1}))),cf())},[cf,Ce,en,pt]),eT=m.useCallback((y,N)=>{if(Ce!=="edit")return;const M=y.metaKey||y.ctrlKey||y.shiftKey;en(z=>z.map(H=>H.id===N.id?{...H,selected:!H.selected||!M}:M?H:{...H,selected:!1})),M||pt(z=>z.map(H=>({...H,selected:!1})))},[Ce,en,pt]),tT=m.useCallback(y=>kN(y,uo.current),[]),nT=m.useCallback(y=>{if(!kN(y,uo.current)){v("端口类型不匹配,已取消连线");return}fo(null),en(N=>{const M=N.filter(z=>!(z.target===y.target&&z.targetHandle===y.targetHandle));return od({...y,markerEnd:{type:qr.ArrowClosed}},M)})},[en]),rT=m.useCallback((y,N)=>{Pm.current=XW(N,uo.current),fo(null)},[]),iT=m.useCallback((y,N)=>{var xe,et,Dt,Tt;const M=Pm.current;if(Pm.current=null,!u||!M||N!=null&&N.toNode)return;const z=QW(ue,M);if(z.length===0){v(`没有匹配 ${M.slotType} 端口的节点`);return}const H=((et=(xe=y==null?void 0:y.changedTouches)==null?void 0:xe[0])==null?void 0:et.clientX)??(y==null?void 0:y.clientX),Y=((Tt=(Dt=y==null?void 0:y.changedTouches)==null?void 0:Dt[0])==null?void 0:Tt.clientY)??(y==null?void 0:y.clientY);if(!Number.isFinite(H)||!Number.isFinite(Y))return;const Q=ha.current,ee=document.querySelector(".af-pipeline-flow .react-flow");if(!Q||!ee)return;const he=ee.getBoundingClientRect(),je=320,Te=Math.min(440,104+z.length*58),ie=Math.max(12,Math.min(H-he.left,he.width-je-12)),_e=Math.max(12,Math.min(Y-he.top,he.height-Te-12));fo({left:ie,top:_e,flowPosition:Q.screenToFlowPosition({x:H,y:Y}),draft:M,candidates:z,query:""})},[ue,u]),sT=m.useCallback(y=>{for(const N of y)delete hi.current[N.id]},[]),oT=m.useCallback(y=>{ha.current=y},[]),aT=m.useCallback(y=>{pt(M=>M.map(z=>({...z,selected:z.id===y}))),en(M=>M.map(z=>({...z,selected:!1}))),cf();const N=()=>{var he,je,Te;const M=ha.current;if(!(M!=null&&M.getNode))return;const z=M.getNode(y);if(!z)return;const H=(he=M.getInternalNode)==null?void 0:he.call(M,y),Y=((je=H==null?void 0:H.measured)==null?void 0:je.width)??(H==null?void 0:H.width)??z.width??200,Q=((Te=H==null?void 0:H.measured)==null?void 0:Te.height)??(H==null?void 0:H.height)??z.height??88,{zoom:ee}=M.getViewport();M.setCenter(z.position.x+Y/2,z.position.y+Q/2,{zoom:CN(ee),duration:220})};requestAnimationFrame(()=>requestAnimationFrame(N))},[pt,en,cf]),lT=m.useCallback(y=>{pt(M=>M.map(z=>({...z,selected:z.id===y}))),en(M=>M.map(z=>({...z,selected:!1})));const N=()=>{var je,Te,ie;const M=ha.current;if(!(M!=null&&M.getNode))return;const z=M.getNode(y);if(!z)return;const H=(je=M.getInternalNode)==null?void 0:je.call(M,y),Y=((Te=H==null?void 0:H.measured)==null?void 0:Te.width)??(H==null?void 0:H.width)??z.width??200,Q=((ie=H==null?void 0:H.measured)==null?void 0:ie.height)??(H==null?void 0:H.height)??z.height??88,{zoom:ee}=M.getViewport(),he=CN(ee);M.setCenter(z.position.x+Y/2,z.position.y+Q/2,{zoom:he,duration:260})};requestAnimationFrame(()=>requestAnimationFrame(N))},[pt,en]),sl=m.useCallback((y,N)=>{const M=`node-${Date.now()}`;return WA(y,M,N,hi.current,ue)},[ue]),m0=m.useCallback(y=>{if(!u||!y)return;let N={x:180,y:160};const M=ha.current,z=document.querySelector(".af-pipeline-flow .react-flow");if(M&&z){const H=z.getBoundingClientRect();N=M.screenToFlowPosition({x:H.left+H.width*.45,y:H.top+H.height*.38})}pt(H=>[...H,sl(y,N)])},[u,pt,sl]),cT=m.useCallback(y=>{const N=u0.current;if(!u||!N||!(y!=null&&y.def))return;const M=sl(y.def,N.flowPosition),z=N.draft.handleType==="source"?{source:N.draft.nodeId,sourceHandle:N.draft.handleId,target:M.id,targetHandle:`input-${y.slotIndex}`}:{source:M.id,sourceHandle:`output-${y.slotIndex}`,target:N.draft.nodeId,targetHandle:N.draft.handleId};pt(H=>[...H,M]),en(H=>{const Y=H.filter(Q=>!(Q.target===z.target&&Q.targetHandle===z.targetHandle));return od({...z,markerEnd:{type:qr.ArrowClosed}},Y)}),fo(null)},[u,sl,pt,en]),uT=m.useCallback(y=>{y.preventDefault(),y.dataTransfer.dropEffect="move"},[]),dT=m.useCallback(y=>{var Q;if(y.preventDefault(),!u)return;const N=ha.current;if(!N)return;const M=N.screenToFlowPosition({x:y.clientX,y:y.clientY}),z=y.dataTransfer.getData("application/agentflow-snippet");if(z){const ee=ze.find(he=>`${he.id}@${he.version}`===z);ee&&((Q=tf.current)==null||Q.call(tf,ee,M));return}const H=y.dataTransfer.getData("application/agentflow-node");if(!H)return;const Y=ue.find(ee=>ee.id===H);Y&&pt(ee=>[...ee,sl(Y,M)])},[u,ue,ze,pt,sl]),cs=m.useCallback(async(y,N)=>{if(!u)return;const M=nN(y,N,hi.current,{description:g});if(M!==Zd.current){v(e("flow:status.saving"));try{const z=gV(u.source),H=await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:z,flowYaml:M,...u.archived?{flowArchived:!0}:{}})}),Y=await H.json();if(!H.ok||!Y.success)throw new Error(Y.error||e("flow:status.saveFailed"));if(Zd.current=M,v(e("flow:status.saved")),u.source==="builtin"&&z==="workspace"){const Q={id:u.id,source:"workspace",path:void 0};f(Q),PN(Q),Of(u.id,"workspace")}}catch(z){v(e("flow:status.saveFailed")+": "+(z.message||z))}}},[u,g]);m.useEffect(()=>{if(!u||!Lc.current||Ce!=="edit"||u.archived)return;const y=_m.current,N=setTimeout(()=>{y===_m.current&&Lc.current&&cs(uo.current,ef.current)},400);return()=>clearTimeout(N)},[bt,dn,g,Ce,u,cs]);const uf=m.useCallback(async y=>{if(!u||u.archived)return;const N=u.source??"user";if(!(N!=="user"&&N!=="workspace")&&N!==y){A(!0),E("");try{const M=await fetch("/api/flow/move",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,fromSource:N,toSource:y})}),z=await M.json().catch(()=>({}));if(!M.ok)throw new Error(typeof z.error=="string"?z.error:e("flow:composer.requestFailed"));const H=z.flowSource==="workspace"||z.flowSource==="user"?z.flowSource:y;let Y={id:u.id,source:H,archived:u.archived};try{const Q=await fetch("/api/flows");if(Q.ok){const ee=await Q.json(),he=Array.isArray(ee)?ee.find(je=>je.id===u.id&&(je.source??"user")===H&&!!je.archived==!!u.archived):null;he&&(Y=he)}}catch{}await mi(Y,{preserveComposer:!0}),Of(u.id,H)}catch(M){E(String(M.message||M))}finally{A(!1)}}},[u,mi]),Rm=m.useCallback(async()=>{if(u){ra(!0),ns(""),so("");try{const y=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:cn})}),N=await y.json().catch(()=>({}));if(!y.ok||!N.success)throw new Error(N.error||"Failed to save schedule");Ii({...nu,...N.schedule||{}}),so(e("flow:schedule.saved")),await ho(u,{quiet:!0,force:!0})}catch(y){ns(String(y.message||y))}finally{ra(!1)}}},[u,cn,ho,e]),fT=m.useCallback(async()=>{u&&(await cs(uo.current,ef.current),!u.archived&&u.source!=="builtin"&&await Rm())},[u,cs,Rm]),df=m.useCallback(async()=>{if(!u||!$.trim())return;const y=$.trim();if(y===u.id){q("");return}L(!0),q("");try{const N=await fetch("/api/flow/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source??"user",newFlowId:y})}),M=await N.json().catch(()=>({}));if(!N.ok)throw new Error(typeof M.error=="string"?M.error:e("flow:composer.requestFailed"));let z={id:M.flowId,source:M.flowSource??u.source,archived:u.archived};try{const H=await fetch("/api/flows");if(H.ok){const Y=await H.json(),Q=Array.isArray(Y)?Y.find(ee=>ee.id===M.flowId&&(ee.source??"user")===(M.flowSource??u.source)):null;Q&&(z=Q)}}catch{}await mi(z,{preserveComposer:!0}),Of(M.flowId,M.flowSource??u.source)}catch(N){q(String(N.message||N))}finally{L(!1)}},[u,$,mi]),g0=m.useCallback(y=>{navigator.clipboard.writeText(y).then(()=>{W(!0),setTimeout(()=>W(!1),2e3)}).catch(()=>{})},[]),Lm=m.useCallback(()=>{cs(bt,dn)},[cs,bt,dn]),pT=m.useCallback((y,N)=>{const M=N.trim()===""||N==="default"?void 0:N.trim(),z=bt.map(H=>H.id===y?{...H,data:{...H.data,model:M}}:H);pt(z),cs(z,dn)},[bt,dn,pt,cs]),ff=m.useCallback(()=>{var et,Dt;if(!De||!u||!Ze)return!1;const y=Ze.id,N=De.newId.trim();if(vt(""),!MA.test(N))return vt(e("flow:nodePropsError.invalidInstanceId")),!1;if(bt.some(Tt=>Tt.id===N&&Tt.id!==y))return vt(e("flow:nodePropsError.duplicateInstanceId")),!1;const M=De.role.trim(),z=qo.includes(M)?M:"普通",H=De.model.trim(),Y=Tt=>(Array.isArray(Tt)?Tt:[]).map(Nt=>({type:String((Nt==null?void 0:Nt.type)??"节点").trim()||"节点",name:String((Nt==null?void 0:Nt.name)??""),default:String((Nt==null?void 0:Nt.default)??""),required:!!(Nt!=null&&Nt.required),showOnNode:(Nt==null?void 0:Nt.showOnNode)!=null?Nt.showOnNode!==!1:!!(Nt!=null&&Nt.required)||String((Nt==null?void 0:Nt.type)??"节点").trim().toLowerCase()==="node"})),Q=Y(De.inputs),ee=Y(De.outputs),he=String(((et=Ze.data)==null?void 0:et.definitionId)??N),je=he.startsWith("provide_"),Te={...Ze.data,label:De.label.trim()||N,role:z,model:H===""||H==="default"?void 0:H,body:je?"":De.body,images:je?[]:Hr(De.images),inputs:Q,outputs:je&&Array.isArray((Dt=Ze.data)==null?void 0:Dt.outputs)?Ze.data.outputs:ee},ie=String(De.script??"").trim();he==="tool_nodejs"||ie!==""?Te.script=String(De.script??""):delete Te.script;let _e,xe=dn;if(N!==y){const Tt={...hi.current},Nt={...Tt[y]||{}};delete Tt[y],Tt[N]=Nt,hi.current=Tt,_e=bt.map(it=>it.id!==y?it:{...it,id:N,selected:!0,data:Te}),xe=dn.map((it,Ae)=>({...it,source:it.source===y?N:it.source,target:it.target===y?N:it.target,id:`e-${it.source===y?N:it.source}-${it.target===y?N:it.target}-${Ae}`}))}else _e=bt.map(Tt=>Tt.id===y?{...Tt,data:Te}:Tt);return pt(_e),en(xe),cr(N),cs(_e,xe),!0},[De,u,Ze,bt,dn,pt,en,cr,cs]),Om=m.useCallback(()=>{var Dt,Tt;if(!De||!u||!Ze)return!1;const y=Ze.id,N=De.role.trim(),M=qo.includes(N)?N:"普通",z=De.model.trim(),H=Nt=>(Array.isArray(Nt)?Nt:[]).map(it=>({type:String((it==null?void 0:it.type)??"节点").trim()||"节点",name:String((it==null?void 0:it.name)??""),default:String((it==null?void 0:it.default)??""),required:!!(it!=null&&it.required),showOnNode:(it==null?void 0:it.showOnNode)!=null?it.showOnNode!==!1:!!(it!=null&&it.required)||String((it==null?void 0:it.type)??"节点").trim().toLowerCase()==="node"})),Y=H(De.inputs),Q=H(De.outputs),ee=String(((Dt=Ze.data)==null?void 0:Dt.definitionId)??y),he=ee.startsWith("provide_"),je=De.label.trim()||y,Te=z===""||z==="default"?void 0:z,ie={...Ze.data,label:je,role:M,model:Te,body:he?"":De.body,images:he?[]:Hr(De.images),inputs:Y,outputs:he&&Array.isArray((Tt=Ze.data)==null?void 0:Tt.outputs)?Ze.data.outputs:Q},_e=String(De.script??"").trim();ee==="tool_nodejs"||_e!==""?ie.script=String(De.script??""):delete ie.script;const xe=Ze.data||{};return(xe.label!==ie.label||xe.role!==ie.role||xe.model!==ie.model||xe.body!==ie.body||JSON.stringify(Hr(xe.images))!==JSON.stringify(ie.images)||(xe.script??void 0)!==(ie.script??void 0)||JSON.stringify(xe.inputs||[])!==JSON.stringify(Y)||JSON.stringify(xe.outputs||[])!==JSON.stringify(Q))&&(pt(Nt=>Nt.map(it=>it.id===y?{...it,data:ie}:it)),cr(y)),!0},[De,u,Ze,pt,cr]),y0=m.useRef(Om);m.useEffect(()=>{y0.current=Om},[Om]),m.useEffect(()=>{if(!De||!u||!Lc.current||Ce!=="edit")return;const y=setTimeout(()=>{y0.current()},400);return()=>clearTimeout(y)},[De,u,Ce]);const hT=m.useCallback(()=>{if(!(!De||!Ze)){if(De.newId.trim()===Ze.id){vt("");return}ff()}},[De,Ze,ff]);m.useEffect(()=>{const y=N=>{var z,H,Y;if(Ce!=="edit")return;const M=IA(N.target);if((N.metaKey||N.ctrlKey)&&N.key.toLowerCase()==="s"){if(dt==="node"&&Ze&&De){N.preventDefault(),N.stopPropagation(),ff()||Lm();return}if(M)return;N.preventDefault(),N.stopPropagation(),Lm();return}if((N.metaKey||N.ctrlKey)&&N.key.toLowerCase()==="k"){N.preventDefault(),N.stopPropagation(),Lt(Q=>!Q);return}if(!qe){if(Ne){if(N.key==="Escape"){N.preventDefault(),$e(!1);return}if(Sh(N)&&!N.metaKey&&!N.ctrlKey&&!N.altKey){N.preventDefault(),$e(!1);return}(N.key==="v"||N.key==="V"||N.key==="h"||N.key==="H")&&!N.metaKey&&!N.ctrlKey&&!N.altKey&&N.preventDefault();return}if(!M){if((N.key==="a"||N.key==="A")&&!N.metaKey&&!N.ctrlKey&&!N.altKey){N.preventDefault(),N.stopPropagation(),(z=me.current)==null||z.focus(),(Y=(H=me.current)==null?void 0:H.select)==null||Y.call(H);return}if((N.metaKey||N.ctrlKey)&&N.key.toLowerCase()==="a"){N.preventDefault(),N.stopPropagation(),pt(Q=>Q.map(ee=>({...ee,selected:!0}))),en(Q=>Q.map(ee=>({...ee,selected:!1})));return}if(Sh(N)&&!N.metaKey&&!N.ctrlKey&&!N.altKey){N.preventDefault(),$e(Q=>!Q);return}if((N.key==="v"||N.key==="V")&&!N.metaKey&&!N.ctrlKey&&!N.altKey){N.preventDefault(),we("select");return}if((N.key==="h"||N.key==="H")&&!N.metaKey&&!N.ctrlKey&&!N.altKey){N.preventDefault(),we("pan");return}}}};return window.addEventListener("keydown",y,!0),()=>window.removeEventListener("keydown",y,!0)},[Lm,Ne,qe,dt,Ze,De,ff,Ce]),m.useEffect(()=>{if(Ce!=="running"||Jr==null)return;let y=Math.floor((Date.now()-Jr)/1e3);const N=setInterval(()=>{const M=Date.now()-Jr,z=Math.floor(M/1e3);z!==y&&(y=z,kr(M))},500);return()=>clearInterval(N)},[Ce,Jr]),m.useEffect(()=>{const y=Qa.current;!y||!y.parentElement||is.current&&(ia.current=!0,y.scrollIntoView({behavior:"auto",block:"end"}),requestAnimationFrame(()=>{ia.current=!1}))},[vr]),m.useEffect(()=>{const y=Qa.current;if(!y)return;const N=y.parentElement;if(!N)return;const M=()=>{if(ia.current)return;const z=N.scrollHeight-N.scrollTop-N.clientHeight;is.current=z<40};return N.addEventListener("scroll",M,{passive:!0}),()=>N.removeEventListener("scroll",M)},[Sr,Ce]),m.useEffect(()=>{if(Ce==="edit"||!Sr)return;is.current=!0;const y=Qa.current;y&&(ia.current=!0,y.scrollIntoView({behavior:"auto",block:"end"}),requestAnimationFrame(()=>{ia.current=!1}))},[Ce,Sr]),m.useEffect(()=>{vr.length>_p+EN&&at(y=>y.length>_p+EN?y.slice(-_p):y)},[vr]);const mT=m.useCallback(y=>{if(y.button!==0)return;y.preventDefault();const N=y.currentTarget;xt.current={active:!0,pointerId:y.pointerId,startY:y.clientY,startH:ft},N.setPointerCapture(y.pointerId)},[ft]),gT=m.useCallback(y=>{const N=xt.current;if(!N.active||y.pointerId!==N.pointerId)return;const M=N.startY-y.clientY;Je(Pp(N.startH+M))},[]),pf=m.useCallback(()=>{Je(y=>{const N=Pp(y);try{localStorage.setItem(VA,String(N))}catch{}return N})},[]),x0=m.useCallback(y=>{const N=xt.current;if(!(!N.active||y.pointerId!==N.pointerId)){N.active=!1;try{y.currentTarget.releasePointerCapture(y.pointerId)}catch{}pf()}},[pf]),yT=m.useCallback(()=>{const y=xt.current;y.active&&(y.active=!1,pf())},[pf]);m.useEffect(()=>{function y(){Je(N=>Pp(N))}return window.addEventListener("resize",y),()=>window.removeEventListener("resize",y)},[]);const us=m.useCallback(async(y={})=>{if(!u)return;const N=y.runUuid!=null&&String(y.runUuid).trim()?String(y.runUuid).trim():null,M=y.cliInputsOverride??zn.current,z=!!y.prepareOnly;if(gn(z?"ready":"running"),at(z?[]:[{ts:new Date().toISOString(),type:"info",text:N?e("flow:run.connectingApiResume",{uuid:N}):e("flow:run.connectingApi")}]),Kn(new Set),Fn({}),Qr(!z),$n(null),N||qn(null),z)return;if(!N){const Y=Date.now();br(Y),kr(0)}const H=new AbortController;rs.current=H;try{const Y=await fetch("/api/flow/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source||"user",...N?{uuid:N}:{},cliInputs:M}),signal:H.signal});if(!Y.ok){const ie=await Y.json().catch(()=>({error:e("flow:composer.requestFailed")}));at(_e=>[..._e,{ts:new Date().toISOString(),type:"error",text:ie.error||e("flow:composer.requestFailed")}]),gn("error");return}if(at(ie=>[...ie,{ts:new Date().toISOString(),type:"info",text:e("flow:run.connectedReceiving")}]),!Y.body){at(ie=>[...ie,{ts:new Date().toISOString(),type:"error",text:e("flow:run.noBody")}]),gn("error");return}const Q=Y.body.getReader(),ee=new TextDecoder;let he="";const je=ie=>{const _e=ie.ts||new Date().toISOString();if(ie.type==="event")if(ie.event==="node-start")Kn(xe=>new Set(xe).add(ie.instanceId)),Fn(xe=>({...xe,[ie.instanceId]:{status:"running",startMs:Date.now()}})),at(xe=>[...xe,{ts:_e,type:"node-start",text:ie.label?e("flow:run.nodeStartWithLabel",{instanceId:ie.instanceId,label:ie.label}):e("flow:run.nodeStart",{instanceId:ie.instanceId})}]);else if(ie.event==="node-done"){Kn(et=>{const Dt=new Set(et);return Dt.delete(ie.instanceId),Dt});const xe=ie.elapsed??null;Fn(et=>({...et,[ie.instanceId]:{status:"success",elapsed:xe}})),at(et=>[...et,{ts:_e,type:"node-done",text:xe?e("flow:run.nodeDoneWithElapsed",{instanceId:ie.instanceId,elapsed:xe}):e("flow:run.nodeDone",{instanceId:ie.instanceId})}])}else if(ie.event==="node-failed")Kn(xe=>{const et=new Set(xe);return et.delete(ie.instanceId),et}),Fn(xe=>({...xe,[ie.instanceId]:{status:"failed",elapsed:ie.elapsed??null}})),at(xe=>[...xe,{ts:_e,type:"node-failed",text:e("flow:run.nodeFailed",{instanceId:ie.instanceId})}]);else if(ie.event==="apply-start"){if(ie.uuid&&qn(String(ie.uuid)),typeof ie.runStartTime=="number"&&ie.runStartTime>0)br(ie.runStartTime),kr(Math.max(0,Date.now()-ie.runStartTime));else if(typeof ie.totalExecutedMs=="number"&&ie.totalExecutedMs>0){const xe=Date.now()-ie.totalExecutedMs;br(xe),kr(ie.totalExecutedMs)}at(xe=>[...xe,{ts:_e,type:"info",text:e("flow:run.pipelineStart",{uuid:ie.uuid||"?"})}])}else ie.event==="apply-done"?at(xe=>[...xe,{ts:_e,type:"info",text:ie.totalElapsed?e("flow:run.pipelineDoneWithElapsed",{elapsed:ie.totalElapsed}):e("flow:run.pipelineDone")}]):ie.event==="apply-paused"?at(xe=>[...xe,{ts:_e,type:"warn",text:e("flow:run.pipelinePaused",{nodes:(ie.pendingNodes||[]).join(", ")})}]):at(xe=>[...xe,{ts:_e,type:"event",text:`[${ie.event}] ${JSON.stringify(ie)}`}]);else ie.type==="user-check-content"?(Os({instanceId:ie.instanceId,execId:ie.execId??1,inputPath:ie.inputPath,outputPath:ie.outputPath,content:ie.content||""}),Za(ie.content||""),sa(!1),tl(""),oa(!1),at(xe=>[...xe,{ts:_e,type:"user-check",text:e("flow:run.userCheckContent",{instanceId:ie.instanceId})}])):ie.type==="user-ask-prompt"?(jc({instanceId:ie.instanceId,execId:ie.execId??1,question:ie.question||"",options:Array.isArray(ie.options)?ie.options:[]}),la(!1),at(xe=>[...xe,{ts:_e,type:"user-ask",text:e("flow:run.userAskPrompt",{instanceId:ie.instanceId,defaultValue:`等待用户选择 (${ie.instanceId})`})}])):ie.type==="tool-print-content"?(Wd({instanceId:ie.instanceId,execId:ie.execId??1,content:ie.content||"",createdAt:Date.now()}),Ec(!1)):ie.type==="log"?at(xe=>[...xe,{ts:_e,type:"log",text:ie.text!=null?String(ie.text):""}]):ie.type==="error"?at(xe=>[...xe,{ts:_e,type:"error",text:ie.message||e("flow:run.unknownError")}]):ie.type==="done"?at(xe=>[...xe,{ts:_e,type:"done",text:e("flow:run.executionEnd",{exitCode:ie.exitCode??"?"})}]):at(xe=>[...xe,{ts:_e,type:"log",text:JSON.stringify(ie)}])},Te=ie=>{if(ie.trim())try{je(JSON.parse(ie))}catch{at(_e=>[..._e,{ts:new Date().toISOString(),type:"log",text:ie}])}};for(;;){const{done:ie,value:_e}=await Q.read();he+=ee.decode(_e??new Uint8Array,{stream:!ie});const xe=he.split(`
|
|
133
|
-
`);he=xe.pop()??"";for(const et of xe)Te(et);if(ie)break}he.trim()&&Te(he),gn("done")}catch(Y){Y.name==="AbortError"?(at(Q=>[...Q,{ts:new Date().toISOString(),type:"warn",text:e("flow:run.executionStopped")}]),gn("stopped")):(at(Q=>[...Q,{ts:new Date().toISOString(),type:"error",text:Y.message||e("flow:run.unknownError")}]),gn("error"))}finally{rs.current=null,Kn(new Set)}},[u]),[xT,Mm]=m.useState(!1),wT=m.useCallback(()=>{Mm(!0)},[]),vT=m.useCallback(async()=>{if(Mm(!1),rs.current&&(rs.current.abort(),rs.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{}gn("stopped"),Kn(new Set)},[u]),ma=m.useCallback(()=>{gn("edit"),Kn(new Set),Fn({}),_i(null),qn(null)},[]),[bT,hf]=m.useState(!1),kT=m.useCallback(async()=>{if(hf(!1),rs.current&&(rs.current.abort(),rs.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{}ma()},[u,ma]),ST=m.useCallback(()=>{hf(!1),n("/projects")},[n]),NT=m.useCallback(y=>{const N=y.runId!=null&&String(y.runId).trim()?String(y.runId).trim():null,M=y.flowId!=null&&String(y.flowId).trim()?String(y.flowId).trim():(u==null?void 0:u.id)!=null?String(u.id):null;qn(N);const z=y.status||"unknown";let H="stopped";z==="success"?H="done":z==="failed"?H="error":z==="running"?H="running":H="stopped",gn(H);const Y=typeof y.at=="number"?y.at:null;if(H==="running"&&Y!=null?(br(Y),kr(Math.max(0,Date.now()-Y))):Y!=null&&typeof y.endedAt=="number"&&y.endedAt>Y?(br(null),kr(y.endedAt-Y)):(br(null),kr(Math.max(0,y.durationMs??0))),at([]),Kn(new Set),Fn({}),_i(null),$n(null),Qr(!1),N&&M){const Q=new URLSearchParams({flowId:M,runId:N});fetch(`/api/run-node-statuses?${Q}`).then(ee=>ee.json()).then(ee=>{const he=ee.statuses&&typeof ee.statuses=="object"?ee.statuses:{},je={};for(const[Te,ie]of Object.entries(he))ie&&typeof ie=="object"&&typeof ie.status=="string"&&(je[Te]={status:ie.status,...ie.elapsed!=null&&String(ie.elapsed).trim()!==""?{elapsed:String(ie.elapsed)}:{}});Fn(je)}).catch(()=>{})}},[u==null?void 0:u.id]);m.useEffect(()=>{if(!(u!=null&&u.id)||Ce!=="edit")return;let y=!1;return(async()=>{try{const N=await fetch("/api/pipeline-recent-runs"),M=await N.json();if(y||!N.ok)return;const H=(Array.isArray(M.runs)?M.runs:[]).find(ee=>ee.flowId===u.id&&ee.status==="running");if(!H||y)return;const Y=H.runId||null;qn(Y),gn("running"),Qr(!0),br(H.at||Date.now()),pi.current=0;const Q=[{ts:new Date().toISOString(),type:"info",text:`[resume] 检测到活跃 run ${Y},已恢复运行视图`}];if(Y){const ee=new URLSearchParams({flowId:u.id,runId:Y}),je=await(await fetch(`/api/run-node-statuses?${ee}`)).json();if(y)return;const Te=je.statuses&&typeof je.statuses=="object"?je.statuses:{},ie={},_e=new Set;for(const[xe,et]of Object.entries(Te))et&&typeof et=="object"&&typeof et.status=="string"&&(ie[xe]={status:et.status,...et.elapsed!=null&&String(et.elapsed).trim()!==""?{elapsed:String(et.elapsed)}:{}},et.status==="running"&&_e.add(xe));Fn(ie),Kn(_e);try{const xe=new URLSearchParams({flowId:u.id,runId:Y,sinceBytes:"0",tailBytes:"262144"}),et=await fetch(`/api/run-log?${xe}`);if(et.ok){const Dt=await et.json();if(!y){pi.current=Number(Dt.bytes||0);const Tt=_N(typeof Dt.text=="string"?Dt.text:"");at([...Tt,...Q]);return}}}catch{}}at(Q)}catch{}})(),()=>{y=!0}},[u==null?void 0:u.id]),m.useEffect(()=>{if(Ce==="edit"||!(u!=null&&u.id)||!nt)return;let y=!1,N=null;const M=async()=>{try{const z=new URLSearchParams({flowId:u.id,runId:nt}),H=await fetch(`/api/run-node-statuses?${z}`);if(!H.ok)return;const Y=await H.json();if(y)return;const Q=Y.statuses&&typeof Y.statuses=="object"?Y.statuses:{},ee={},he=new Set;for(const[je,Te]of Object.entries(Q))Te&&typeof Te=="object"&&typeof Te.status=="string"&&(ee[je]={status:Te.status,...Te.elapsed!=null&&String(Te.elapsed).trim()!==""?{elapsed:String(Te.elapsed)}:{}},Te.status==="running"&&he.add(je));Fn(je=>pV(je,ee)?je:ee),Kn(je=>hV(je,he)?je:he);try{const je=new URLSearchParams({flowId:u.id,runId:nt,sinceBytes:String(pi.current||0),tailBytes:String(cV)}),Te=await fetch(`/api/run-log?${je}`);if(Te.ok){const ie=await Te.json();if(y)return;const _e=Number(ie.bytes||0),xe=typeof ie.text=="string"?ie.text:"";if(xe){const et=_N(xe);et.length>0&&at(Dt=>[...Dt,...et])}pi.current=_e}}catch{}try{const je=await fetch("/api/pipeline-recent-runs");if(!je.ok)return;const Te=await je.json();if(y)return;const _e=(Array.isArray(Te.runs)?Te.runs:[]).find(xe=>xe.flowId===u.id&&xe.runId===nt);if(_e&&_e.status){const xe=_e.status;xe==="running"?gn(et=>et==="running"?et:"running"):xe==="success"?gn("done"):xe==="failed"?gn("error"):(xe==="stopped"||xe==="interrupted")&&gn("stopped")}}catch{}}catch{}};return M(),N=window.setInterval(M,2500),()=>{y=!0,N&&window.clearInterval(N)}},[Ce,u==null?void 0:u.id,nt]),m.useEffect(()=>{if(dt!=="history"||!u)return;let y=!1;return(async()=>{fi(!0),ar("");try{const N=await fetch("/api/pipeline-recent-runs"),M=await N.json();if(!N.ok)throw new Error(M.error||"HTTP "+N.status);y||an(Array.isArray(M.runs)?M.runs:[])}catch(N){y||(ar(String(N.message||N)),an([]))}finally{y||fi(!1)}})(),()=>{y=!0}},[dt,u]),m.useEffect(()=>{if(!u){_t({files:[]});return}let y=!1;return(async()=>{Vt(!0);try{const N=new URLSearchParams({flowId:u.id,flowSource:u.source||"user",archived:u.archived?"1":"0"}),M=await fetch(`/api/pipeline-files?${N}`),z=await M.json();if(!M.ok)throw new Error(z.error||"HTTP "+M.status);y||_t({files:Array.isArray(z.files)?z.files:[],path:z.path,error:z.error})}catch(N){y||_t({files:[],error:N.message||String(N)})}finally{y||Vt(!1)}})(),()=>{y=!0}},[u]);const Mc=m.useMemo(()=>u?Ci.filter(y=>y&&y.flowId===u.id).sort((y,N)=>N.at-y.at):[],[Ci,u]),Cr=m.useMemo(()=>{let y=0,N=0,M=0,z=0,H=0;for(const Y of Mc){const Q=Y.status||"unknown";Q==="success"?y+=1:Q==="failed"?N+=1:Q==="running"?M+=1:Q==="stopped"?z+=1:Q==="interrupted"&&(H+=1)}return{success:y,failed:N,running:M,stopped:z,interrupted:H}},[Mc]),$c=m.useMemo(()=>u?SN(jr,K):null,[u,jr,K]),Oi=m.useMemo(()=>{if(!$c||!u)return[];const y=$c.query.toLowerCase(),N=H=>y?H.some(Y=>Y&&String(Y).toLowerCase().includes(y)):!0,M=bt.map(H=>{var je,Te;const Y=H.id,Q=String(((je=H.data)==null?void 0:je.label)??Y),ee=(Te=H.data)!=null&&Te.definitionId?String(H.data.definitionId):"",he=[Q!==Y?Q:"",ee&&ee!==Y?ee:""].filter(Boolean);return{id:Y,label:Q,defId:ee,subs:he}}).filter(({id:H,label:Y,defId:Q})=>N([H,Y,Q])).sort((H,Y)=>H.id.localeCompare(Y.id)).slice(0,18).map(({id:H,label:Y,defId:Q})=>{const ee=[Y!==H?Y:null,Q||null].filter(Boolean).join(" · ")||void 0;return{kind:"instance",id:H,title:H,subtitle:ee}}),z=ue.filter(H=>H&&H.id&&N([H.id,H.label,H.description])).sort((H,Y)=>H.id.localeCompare(Y.id)).slice(0,22).map(H=>({kind:"definition",id:H.id,title:H.id,subtitle:H.label&&H.label!==H.id?String(H.label):String(H.type||"")}));return[...M,...z]},[$c,bt,ue,u]),Dc=m.useMemo(()=>{const y=Oi.filter(M=>M.kind==="instance"),N=Oi.filter(M=>M.kind==="definition");return{instances:y,definitions:N}},[Oi]);m.useEffect(()=>{ne(y=>{const N=Math.max(0,Oi.length-1);return Math.min(Math.max(0,y),N)})},[Oi]);const w0=m.useMemo(()=>eV(jr),[jr]),tr=m.useMemo(()=>bt.filter(y=>y.selected),[bt]),$m=m.useMemo(()=>new Set(tr.map(y=>y.id)),[tr]),mf=m.useMemo(()=>dn.filter(y=>$m.has(y.source)&&$m.has(y.target)),[dn,$m]),v0=m.useMemo(()=>{const y=ge.trim().toLowerCase();return y?ze.filter(N=>[N.id,N.version,N.displayName,N.name,N.description,...Array.isArray(N.tags)?N.tags:[]].filter(Boolean).some(M=>String(M).toLowerCase().includes(y))):ze},[ze,ge]),b0=m.useCallback((y,N)=>{const M=String(y||"snippet-node").trim().replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")||"snippet-node",z=Date.now().toString(36);let H=`${M}-${z}`,Y=2;for(;N.has(H);)H=`${M}-${z}-${Y}`,Y+=1;return N.add(H),H},[]),k0=m.useCallback((y,N)=>{var it;if(!u||!y)return;const M=y.snippet&&typeof y.snippet=="object"?y.snippet:{},z=M.instances&&typeof M.instances=="object"?M.instances:{},H=Object.keys(z);if(H.length===0)return;const Y=new Set(uo.current.map(Ae=>Ae.id)),Q={};for(const Ae of H)Q[Ae]=b0(Ae,Y);const ee=(it=M.ui)!=null&&it.nodePositions&&typeof M.ui.nodePositions=="object"?M.ui.nodePositions:{},he=H.map(Ae=>{const jt=ee[Ae];return{id:Ae,x:typeof(jt==null?void 0:jt.x)=="number"?jt.x:0,y:typeof(jt==null?void 0:jt.y)=="number"?jt.y:0}}),je=Math.min(...he.map(Ae=>Ae.x)),Te=Math.min(...he.map(Ae=>Ae.y));let ie=N||{x:180,y:160};const _e=ha.current,xe=document.querySelector(".af-pipeline-flow .react-flow");if(!N&&_e&&xe){const Ae=xe.getBoundingClientRect();ie=_e.screenToFlowPosition({x:Ae.left+Ae.width*.48,y:Ae.top+Ae.height*.32})}const et={};for(const Ae of H)et[Q[Ae]]={...z[Ae]||{}};hi.current={...hi.current,...et};const Dt=H.map(Ae=>{const jt=z[Ae]||{},Bn=he.find($s=>$s.id===Ae)||{x:0,y:0},mo={id:Q[Ae],type:"flowNode",selected:!0,position:{x:ie.x+(Bn.x-je),y:ie.y+(Bn.y-Te)},data:{label:jt.label||Q[Ae],definitionId:jt.definitionId||Ae,role:jt.role||"normal",body:jt.body||"",script:jt.script||""}};return hd(mo,hi.current,ue,{},u.id)}),Tt=new Set(H),Nt=(Array.isArray(M.edges)?M.edges:[]).filter(Ae=>Tt.has(Ae==null?void 0:Ae.source)&&Tt.has(Ae==null?void 0:Ae.target)).map((Ae,jt)=>({id:`e-${Q[Ae.source]}-${Q[Ae.target]}-${Date.now()}-${jt}`,source:Q[Ae.source],target:Q[Ae.target],sourceHandle:Ae.sourceHandle??void 0,targetHandle:Ae.targetHandle??void 0,markerEnd:{type:qr.ArrowClosed}}));pt(Ae=>[...Ae.map(jt=>({...jt,selected:!1})),...Dt]),en(Ae=>[...Ae.map(jt=>({...jt,selected:!1})),...Nt]),v(`已添加流程片段:${y.displayName||y.id}`)},[b0,ue,u,en,pt]);tf.current=k0;const jT=m.useCallback(()=>{var M,z;if(tr.length<2){sn("请先在画布上选择至少两个节点。"),ae("flows");return}const y=tr[0],N=tr.length===2?`${((M=y.data)==null?void 0:M.label)||y.id} 片段`:`${((z=y.data)==null?void 0:z.label)||y.id} 等 ${tr.length} 个节点`;bn({name:N,id:N.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),description:""}),ye(""),mn(!0),ae("flows")},[tr]),CT=m.useCallback(async()=>{var H,Y;if(!u||tr.length<2)return;const y=on.name.trim();if(!y){ye("请填写片段名称。");return}const N=pm(tr,hi.current),M={};for(const Q of tr)M[Q.id]={x:((H=Q.position)==null?void 0:H.x)||0,y:((Y=Q.position)==null?void 0:Y.y)||0};const z=mf.map(Q=>({source:Q.source,target:Q.target,sourceHandle:Q.sourceHandle??null,targetHandle:Q.targetHandle??null}));_n(!0),ye("");try{const Q=await fetch("/api/marketplace/publish-flow-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:on.id,name:y,displayName:y,version:"1.0.0",description:on.description,snippet:{instances:N,edges:z,ui:{nodePositions:M}}})}),ee=await Q.json().catch(()=>({}));if(!Q.ok||(ee==null?void 0:ee.ok)===!1)throw new Error((ee==null?void 0:ee.error)||"Publish failed");mn(!1),v(`流程片段已发布:${ee.id||y}`),Zi(`流程片段已发布:${ee.id||y}`),await af(),ae("flows")}catch(Q){ye(String(Q.message||Q))}finally{_n(!1)}},[u,tr,mf,on,af,Zi]),gf=m.useMemo(()=>{const y=[],N=new Set;for(const H of tr)N.add(H.id),y.push({node:H,kind:"canvas"});const M=new Map(bt.map(H=>[H.id,H])),z=new Map(ue.map(H=>[H.id,H]));for(const H of w0){if(N.has(H))continue;const Y=M.get(H);if(Y){N.add(H),y.push({node:Y,kind:"mention"});continue}const Q=z.get(H);Q&&(N.add(H),y.push({definition:Q,kind:"definition"}))}return y},[tr,w0,bt,ue]),Lr=m.useMemo(()=>{const y=Array.isArray(ke==null?void 0:ke.cursor)?ke.cursor:[],N=Array.isArray(ke==null?void 0:ke.opencode)?ke.opencode:[],M=Array.isArray(ke==null?void 0:ke.claudeCode)?ke.claudeCode:[],z=N.map(je=>`opencode:${Hs(je)}`),H=M.map(je=>`claude-code:${Hs(je)}`),Y=new Set([...y,...N,...M].map(Hs).concat(z).concat(H)),Q=(da||"").trim(),ee=Zf(da,y,N,M),he=ee&&!Y.has(ee)&&!Y.has(Q)?Q:"";return{cursorList:y,opencodeList:N,claudeCodeList:M,currentNotInLists:he}},[ke,da]),Dm=m.useMemo(()=>new Set(fa),[fa]),Fm=fa.length,yf=m.useMemo(()=>{const y=new Map(Ms.map(Y=>[Y.key,Y])),N=new Set,M=new Set,z=Vd.map(Y=>{const Q=Vo(Y,Ms).map(ee=>y.get(ee)).filter(Boolean);for(const ee of Q)N.add(ee.key),M.add(String(ee.name||ee.id||ee.key||"").trim());return{...Y,skills:Q}}).filter(Y=>Y.skills.length>0),H=Ms.filter(Y=>{const Q=String(Y.name||Y.id||Y.key||"").trim();return!N.has(Y.key)&&!M.has(Q)});return{groups:z,ungrouped:H}},[Vd,Ms]),ol=m.useCallback(()=>{const y=Sm.current;if(!y)return;const N=y.getBoundingClientRect(),M=Math.min(400,Math.max(300,window.innerWidth-24)),z=Math.min(Math.max(12,N.right-M),window.innerWidth-M-12),H=Math.max(140,N.top-22),Y=Math.min(360,H);zI({position:"fixed",left:`${z}px`,top:`${Math.max(12,N.top-Y-10)}px`,width:`${M}px`,maxHeight:`${Y}px`})},[]);m.useEffect(()=>{const y=Array.isArray(ke==null?void 0:ke.cursor)?ke.cursor:[],N=Array.isArray(ke==null?void 0:ke.opencode)?ke.opencode:[],M=Array.isArray(ke==null?void 0:ke.claudeCode)?ke.claudeCode:[];Kv(z=>{const H=Zf(z,y,N,M);return H===z?z:H})},[ke.cursor,ke.opencode,ke.claudeCode]),m.useEffect(()=>{if(!Kd)return;ol();const y=M=>{var H,Y;const z=M.target;(H=Sm.current)!=null&&H.contains(z)||(Y=Gv.current)!=null&&Y.contains(z)||km(!1)},N=M=>{M.key==="Escape"&&km(!1)};return window.addEventListener("resize",ol),window.addEventListener("scroll",ol,!0),document.addEventListener("pointerdown",y),document.addEventListener("keydown",N),()=>{window.removeEventListener("resize",ol),window.removeEventListener("scroll",ol,!0),document.removeEventListener("pointerdown",y),document.removeEventListener("keydown",N)}},[Kd,ol]);const ga=m.useCallback(async(y,N={})=>{var it;if(!u||Em.current)return;const M=N.phaseContextSnapshot,z=(typeof y=="string"?y:jr).trim();if(!z)return;const H=t0.current;Em.current=!0,s0(!0),os(e("flow:composer.connecting")),$n(Ae=>Ae!=="composer"?"composer":Ae);const Y=[...Ic];if(H.length>0&&Y.push({type:"assistant",segments:[...H]}),o0([...Y,{type:"user",text:z}]),Y.filter(Ae=>Ae.type==="user").length===0){const Ae=z.replace(/\s+/g," ").slice(0,30)+(z.length>30?"…":"");ss(jt=>jt.map(Bn=>Bn.id===ur?{...Bn,label:Ae}:Bn))}const Q=Y.map(Ae=>Ae.type==="user"?{role:"user",text:Ae.text}:{role:"assistant",text:(Ae.segments||[]).filter(Bn=>Bn.kind==="assistant"||Bn.kind==="result").map(Bn=>Bn.text).join(`
|
|
134
|
-
`)}).filter(Ae=>Ae.text),ee=M??lt;_(""),as([]),Tc([]),a0(!1);const he=new AbortController;Qd.current=he,Cm.current=ur;let je=null;const Te=Array.isArray(ke==null?void 0:ke.cursor)?ke.cursor:[],ie=Array.isArray(ke==null?void 0:ke.opencode)?ke.opencode:[],_e=Array.isArray(ke==null?void 0:ke.claudeCode)?ke.claudeCode:[],xe=Zf(da,Te,ie,_e),et=gf.filter(Ae=>Ae.kind!=="definition"&&Ae.node).map(Ae=>Ae.node.id),Dt=u;let Tt=!1,Nt=!1;try{je=setTimeout(()=>he.abort(),12e4);const Ae={prompt:z,model:xe,flowId:u.id,flowSource:u.source??"user",...u.archived?{flowArchived:!0}:{},contextInstanceIds:et,thread:Q,selectedSkills:fa};ee&&ee.nextPhase&&!ee.isLastPhase&&(Ae.phaseContext={phaseIndex:ee.nextPhase.index,phases:ee.phases,userPromptOriginal:ee.userPromptOriginal||z}),bm&&(Ae.phaseRole=bm);const jt=await fetch("/api/composer-agent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ae),signal:he.signal});if(je&&(clearTimeout(je),je=null),!jt.ok){let zc=jt.statusText||e("flow:composer.requestFailed");try{const Bc=await jt.json();Bc&&Bc.error&&(zc=String(Bc.error))}catch{}os(zc),as([{kind:"error",text:zc}]);return}const Bn=(it=jt.body)==null?void 0:it.getReader();if(!Bn){os(e("flow:composer.cannotReadStream"));return}const mo=new TextDecoder;let $s="";for(;;){const{done:zc,value:Bc}=await Bn.read();if(zc)break;for($s+=mo.decode(Bc,{stream:!0});;){const Hm=$s.indexOf(`
|
|
135
|
-
`);if(Hm<0)break;const P0=$s.slice(0,Hm).trim();if($s=$s.slice(Hm+1),!P0)continue;let Me;try{Me=JSON.parse(P0)}catch{continue}if(Me.type==="status"&&typeof Me.line=="string"&&os(Me.line),Me.type==="natural"&&typeof Me.text=="string"&&Me.text){const Ft=typeof Me.kind=="string"&&Me.kind?Me.kind:"assistant";as(Ot=>[...Ot,{kind:Ft,text:Me.text}])}if(Me.type==="error"&&Me.message){Nt=!0;const Ft=Me.code?` [${Me.code}]`:"",Ot=String(Me.message)+Ft;os(Ot),as(Or=>[...Or,{kind:"error",text:Ot}])}if(Me.type==="plan"&&Array.isArray(Me.steps)){Tc(Me.steps.map(Ot=>({...Ot,status:"pending"})));const Ft=Me.steps.map((Ot,Or)=>`${Or+1}. ${Ot.description||Ot.type}`).join(`
|
|
136
|
-
`);as(Ot=>[...Ot,{kind:"assistant",text:e("flow:composer.taskPlan",{count:Me.steps.length,summary:Ft})}])}if(Me.type==="step-start"){const Ft=Me.index??0,Ot=Me.total??0,Or=Me.tier?` [${Me.tier}]`:"",TT=Me.model?` (${Me.model})`:"";os(e("flow:composer.step",{current:Ft+1,total:Ot,description:(Me.description||"")+Or+TT})),Tc(RT=>RT.map(al=>al.index===Ft?{...al,status:"running",model:Me.model,tier:Me.tier,nodeRole:Me.nodeRole??al.nodeRole,instanceId:Me.instanceId??al.instanceId,instanceLabel:Me.instanceLabel??al.instanceLabel}:al))}if(Me.type==="step-progress"){const Ft=Me.index??0,Ot=Me.total??0;os(e("flow:composer.step",{current:Ft+1,total:Ot,description:Me.description||""}))}if(Me.type==="step-done"){const Ft=Me.index??0;Tc(Ot=>Ot.map(Or=>Or.index===Ft?{...Or,status:Me.success?"done":"error"}:Or))}if(Me.type==="phase-plan"&&Array.isArray(Me.phases)){Rc(Ot=>({...Ot||{},phases:Me.phases,currentPhase:Me.currentPhase??0,phaseTotal:Me.phaseTotal??Me.phases.length,phaseName:Me.phaseName||"",isLastPhase:!1,nextPhase:null,userPromptOriginal:(Ot==null?void 0:Ot.userPromptOriginal)||z}));const Ft=Me.phases.map((Ot,Or)=>`${Or+1}. ${Ot.label}`).join(" → ");as(Ot=>[...Ot,{kind:"assistant",text:e("flow:composer.phaseGeneration",{count:Me.phases.length,labels:Ft,current:Me.phaseName||""})}])}Me.type==="phase-complete"&&(Rc(Ft=>{var Or;return{...Ft||{},phases:Me.phases||(Ft==null?void 0:Ft.phases)||[],currentPhase:Me.phaseIndex??0,phaseTotal:Me.phaseTotal??((Or=Me.phases)==null?void 0:Or.length)??0,phaseName:Me.phaseName||"",isLastPhase:!!Me.isLastPhase,nextPhase:Me.nextPhase||null,userPromptOriginal:Me.userPromptOriginal||(Ft==null?void 0:Ft.userPromptOriginal)||z}}),!Me.isLastPhase&&Me.nextPhase&&as(Ft=>[...Ft,{kind:"assistant",text:e("flow:composer.phaseComplete",{phaseName:Me.phaseName||e("flow:composer.nextPhase"),nextPhase:Me.nextPhase.label})}])),Me.type==="done"&&(Tt=!0,os(Ft=>Ft||e("flow:composer.done")))}}}catch(Ae){const jt=Ae;if(jt.name==="AbortError"){const Bn=e(je?"flow:composer.connectTimeout":"flow:composer.aborted");os(Bn),as(mo=>[...mo,{kind:"error",text:Bn}])}else{const Bn=jt.code||jt.name||"UNKNOWN",mo=`${jt.message||String(Ae)} [${Bn}]`;os(mo),as($s=>[...$s,{kind:"error",text:mo}])}}finally{if(Em.current=!1,s0(!1),Qd.current=null,Cm.current=null,je&&clearTimeout(je),Tt&&Dt){const Ae={id:Dt.id,source:Dt.source??"user",archived:Dt.archived};(async()=>(await mi(Ae,{preserveComposer:!0,incrementalSync:!0}),await ho(Ae,{quiet:!0,force:!0})))()}}},[u,jr,da,ke,gf,mi,ho,Ic,ur,lt,bm,fa]);BI.current=ga;const S0=m.useCallback(()=>{!lt||lt.isLastPhase||(Rc(null),ga(e("flow:composer.skipRemainingPhases")))},[lt,ga]),N0=m.useCallback(()=>{if(!lt||lt.isLastPhase||!lt.nextPhase)return;const y=String(lt.nextPhase.label||"").trim()||e("flow:composer.nextPhase");ga(e("flow:composer.continuePhase",{label:y}),{phaseContextSnapshot:lt})},[lt,ga]);m.useEffect(()=>{if(!jm)return;const y=N=>{N.key==="Escape"&&Jd(!1)};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[jm]),m.useEffect(()=>{Ce!=="edit"&&Jd(!1)},[Ce]),m.useLayoutEffect(()=>{const y=Zn.current;if(!y)return;if(!u){y.style.height="";return}y.style.height="0px";const N=getComputedStyle(y),M=parseFloat(N.lineHeight),z=(parseFloat(N.paddingTop)||0)+(parseFloat(N.paddingBottom)||0),H=Number.isFinite(M)&&M>0?M:13*1.45,Y=z+H*2,Q=z+H*10,ee=Math.min(Math.max(y.scrollHeight,Y),Q);y.style.height=`${ee}px`},[jr,u]);const zm=m.useCallback(y=>{const N=jr,M=K,z=SN(N,M);if(!z)return;const H=N.slice(0,z.atIndex)+`@${y} `+N.slice(M);_(H);const Y=z.atIndex+y.length+2;queueMicrotask(()=>{const Q=Zn.current;Q&&(Q.focus(),Q.setSelectionRange(Y,Y)),X(Y)})},[jr,K]),Bm=m.useCallback(y=>{_(N=>{const M=`@${y}`,z=N.indexOf(M);return z<0?N:N.slice(0,z)+N.slice(z+M.length)})},[]),j0=m.useCallback(y=>{y.kind==="canvas"?pt(N=>N.map(M=>M.id===y.node.id?{...M,selected:!1}:M)):y.kind==="mention"?Bm(y.node.id):Bm(y.definition.id)},[pt,Bm]),ET=m.useCallback(()=>{$n(y=>y==="history"?null:"history")},[]),_T=m.useCallback(()=>{$n(y=>y==="settings"?null:"settings")},[]),PT=m.useCallback(()=>{$n(y=>y==="composer"?null:"composer")},[]),Fc=m.useCallback(()=>{$n(y=>(y==="node"&&er.current&&(Qt.current=er.current.id),null))},[]),C0=m.useCallback(()=>{$e(y=>!y)},[]),AT=()=>{if(!u)return null;const y=Zr||u.archived||u.source==="builtin",N=Jt!=null&&Jt.running?e("flow:schedule.running"):cn.enabled?e("flow:schedule.waiting"):e("flow:schedule.disabled"),M=Jt!=null&&Jt.running?"running":cn.enabled?"waiting":"disabled",z=Et.slice(0,12),H=u.archived||u.source==="builtin";return a.jsxs("section",{className:"af-pipeline-settings-page","aria-label":e("flow:settings.title"),children:[a.jsxs("aside",{className:"af-pipeline-settings-nav","aria-label":e("flow:settings.sectionNav"),children:[a.jsx("div",{className:"af-pipeline-settings-nav-title",children:e("flow:settings.title")}),a.jsxs("a",{href:"#pipeline-basic",className:"af-pipeline-settings-nav-item af-pipeline-settings-nav-item--active",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"badge"}),e("flow:settings.basicInfo")]}),a.jsxs("a",{href:"#pipeline-storage",className:"af-pipeline-settings-nav-item",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"folder_open"}),e("flow:settings.storageAndPath")]}),a.jsxs("a",{href:"#pipeline-marketplace",className:"af-pipeline-settings-nav-item",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"deployed_code"}),e("flow:settings.nodeMarketplace")]}),a.jsxs("a",{href:"#pipeline-schedule",className:"af-pipeline-settings-nav-item",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"schedule"}),e("flow:schedule.title")]}),a.jsxs("a",{href:"#pipeline-metadata",className:"af-pipeline-settings-nav-item",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"dataset"}),e("flow:pipeline.metadata")]}),a.jsxs("button",{type:"button",className:"af-pipeline-settings-nav-link",onClick:()=>n("/settings"),children:[e("flow:settings.globalSettings"),a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_new"})]})]}),a.jsxs("main",{className:"af-pipeline-settings-main",children:[a.jsxs("div",{className:"af-pipeline-settings-main-head",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"af-pipeline-settings-title",children:e("flow:settings.title")}),a.jsx("p",{className:"af-pipeline-settings-subtitle",children:e("flow:settings.subtitle")})]}),a.jsxs("button",{type:"button",className:"af-btn-secondary",onClick:Fc,children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_back"}),e("flow:settings.backToCanvas")]})]}),a.jsxs("section",{id:"pipeline-basic",className:"af-pipeline-settings-section",children:[a.jsxs("div",{className:"af-pipeline-settings-section-head",children:[a.jsx("span",{className:"af-pipeline-settings-section-index",children:"1."}),a.jsx("h2",{children:e("flow:settings.basicInfo")})]}),a.jsxs("div",{className:"af-pipeline-settings-grid af-pipeline-settings-grid--two",children:[a.jsxs("div",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.pipelineId")}),(u.source==="user"||u.source==="workspace")&&!u.archived?a.jsxs("div",{className:"af-pipeline-rename-row",children:[a.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:$,onChange:Y=>{I(Y.target.value),q("")},onKeyDown:Y=>{Y.key==="Enter"&&(Y.preventDefault(),df())},onBlur:()=>{$.trim()&&$.trim()!==u.id&&df()},placeholder:u.id,disabled:F,spellCheck:!1}),a.jsx("span",{className:"af-pipeline-drawer-badge",children:pl(u.source??"user",e)})]}):a.jsxs("div",{className:"af-pipeline-drawer-readonly",children:[u.id,a.jsx("span",{className:"af-pipeline-drawer-badge",children:pl(u.source??"user",e)}),u.archived?a.jsx("span",{className:"af-pipeline-drawer-badge af-pipeline-drawer-badge--muted",children:e("flow:settings.archived")}):null]}),T?a.jsx("p",{className:"af-err af-pipeline-drawer-err",children:T}):null]}),a.jsxs("div",{className:"af-pipeline-settings-kv-block",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:settings.owner")}),a.jsxs("div",{className:"af-pipeline-drawer-readonly",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"person"}),u.owner||"bigo"]})]})]}),a.jsxs("label",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.introduction")}),a.jsx("textarea",{className:"af-pipeline-drawer-textarea af-pipeline-settings-textarea",value:g,onChange:Y=>b(Y.target.value),placeholder:e("flow:pipeline.introductionPlaceholder"),rows:4,spellCheck:!1})]})]}),a.jsxs("section",{id:"pipeline-storage",className:"af-pipeline-settings-section",children:[a.jsxs("div",{className:"af-pipeline-settings-section-head",children:[a.jsx("span",{className:"af-pipeline-settings-section-index",children:"2."}),a.jsx("h2",{children:e("flow:settings.storageAndPath")})]}),typeof u.path=="string"&&u.path?a.jsxs("div",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.diskPath")}),a.jsxs("div",{className:"af-pipeline-drawer-readonly af-pipeline-drawer-readonly--mono af-pipeline-path-row",children:[a.jsx("span",{className:"af-pipeline-path-text",children:u.path}),a.jsx("button",{type:"button",className:"af-icon-btn af-pipeline-copy-btn",onClick:()=>g0(u.path),title:e("flow:settings.copyPath"),children:a.jsx("span",{className:"material-symbols-outlined",children:D?"check":"content_copy"})})]})]}):null,u.source==="user"||u.source==="workspace"?u.archived?a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.archivedNote")}):a.jsxs("div",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.storageLocation")}),a.jsx("div",{className:"af-pipeline-move-actions",children:u.source==="user"?a.jsx("button",{type:"button",className:"af-btn-secondary",disabled:j,onClick:()=>uf("workspace"),children:e(j?"flow:settings.moveBusy":"flow:settings.moveToWorkspace")}):a.jsx("button",{type:"button",className:"af-btn-secondary",disabled:j,onClick:()=>uf("user"),children:e(j?"flow:settings.moveBusy":"flow:settings.moveToUserDir")})}),k?a.jsx("p",{className:"af-err af-pipeline-drawer-err",children:k}):null]}):a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.builtinNote")})]}),a.jsxs("section",{id:"pipeline-marketplace",className:"af-pipeline-settings-section",children:[a.jsxs("div",{className:"af-pipeline-settings-section-head",children:[a.jsx("span",{className:"af-pipeline-settings-section-index",children:"3."}),a.jsx("h2",{children:e("flow:settings.nodeMarketplace")})]}),a.jsxs("div",{className:"af-pipeline-market-row",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"af-pipeline-market-count",children:[Et.length," ",e("flow:settings.marketNodesUnit")]}),a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.marketplaceHint")})]}),a.jsxs("button",{type:"button",className:"af-btn-secondary",onClick:Tm,disabled:gt,children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"refresh"}),e(gt?"common:common.loading":"common:common.refresh")]})]}),On?a.jsx("p",{className:"af-err af-pipeline-drawer-err",children:On}):null,gt?a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("common:common.loading")}):z.length>0?a.jsx("div",{className:"af-pipeline-market-list",children:z.map(Y=>{const Q=Y.definitionId||`marketplace:${Y.id}${Y.version?`@${Y.version}`:""}`,ee=f0.has(Q)||f0.has(`marketplace:${Y.id}`),he=rf.find(_e=>String(_e.id)===Q||String(_e.id)===`marketplace:${Y.id}`),je=fe===Q,Te=Qf(Y.inputs||Y.input),ie=Qf(Y.outputs||Y.output);return a.jsxs("div",{className:"af-pipeline-market-item",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:ee?"check_circle":"extension"}),a.jsxs("div",{className:"af-pipeline-market-main",children:[a.jsxs("div",{className:"af-pipeline-market-title-row",children:[a.jsx("strong",{children:Y.displayName||Y.label||Y.id}),a.jsx("span",{children:Y.version?`v${Y.version}`:Q})]}),a.jsx("p",{className:"af-pipeline-market-purpose",children:Y.description||e("flow:settings.marketplaceNoDescription")}),a.jsxs("div",{className:"af-pipeline-market-io",children:[a.jsxs("div",{children:[a.jsx("span",{className:"af-pipeline-market-io-label",children:"Inputs"}),a.jsx("div",{className:"af-pipeline-market-chips",children:Te.length>0?Te.map(_e=>a.jsx("span",{className:"af-pipeline-market-chip",children:_e},`in-${Q}-${_e}`)):a.jsx("span",{className:"af-pipeline-market-chip af-pipeline-market-chip--muted",children:e("flow:settings.noInputs")})})]}),a.jsxs("div",{children:[a.jsx("span",{className:"af-pipeline-market-io-label",children:"Outputs"}),a.jsx("div",{className:"af-pipeline-market-chips",children:ie.length>0?ie.map(_e=>a.jsx("span",{className:"af-pipeline-market-chip",children:_e},`out-${Q}-${_e}`)):a.jsx("span",{className:"af-pipeline-market-chip af-pipeline-market-chip--muted",children:e("flow:settings.noOutputs")})})]})]})]}),a.jsxs("div",{className:"af-pipeline-market-actions",children:[a.jsx("button",{type:"button",className:"af-btn-secondary af-pipeline-market-action",onClick:()=>Mn(Y),children:e("flow:settings.previewNode")}),a.jsx("button",{type:"button",className:ee?"af-btn-secondary af-pipeline-market-action":"af-btn-primary af-pipeline-market-action",disabled:H||je,onClick:()=>{ee&&he?(m0(he),$n(null)):GI(Y)},children:e(je?"flow:settings.installingNode":ee?"flow:settings.addInstalledNode":"flow:settings.installNode")})]})]},Q)})}):a.jsx("div",{className:"af-pipeline-settings-empty",children:e("flow:settings.marketplaceEmpty")})]}),a.jsxs("section",{id:"pipeline-schedule",className:"af-pipeline-settings-section",children:[a.jsxs("div",{className:"af-pipeline-settings-section-head",children:[a.jsx("span",{className:"af-pipeline-settings-section-index",children:"4."}),a.jsx("h2",{children:e("flow:schedule.title")})]}),Bd?a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("common:common.loading")}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"af-pipeline-settings-schedule-grid",children:[a.jsxs("label",{className:"af-new-pipeline-radio af-pipeline-settings-checkbox",children:[a.jsx("input",{type:"checkbox",checked:!!cn.enabled,disabled:y,onChange:Y=>po(Q=>({...Q,enabled:Y.target.checked}))}),a.jsx("span",{children:e("flow:schedule.enabled")})]}),a.jsxs("label",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.cron")}),a.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:cn.cron||"",disabled:y,onChange:Y=>po(Q=>({...Q,cron:Y.target.value})),placeholder:"0 9 * * *",spellCheck:!1})]}),a.jsxs("label",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.timezone")}),a.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:cn.timezone||"",disabled:y,onChange:Y=>po(Q=>({...Q,timezone:Y.target.value})),placeholder:"Asia/Shanghai",spellCheck:!1})]}),a.jsxs("label",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.preset")}),a.jsxs("select",{className:"af-pipeline-flow-select",value:cn.preset||"",disabled:y,onChange:Y=>po(Q=>({...Q,preset:Y.target.value})),children:[a.jsx("option",{value:"",children:e("flow:schedule.defaultPreset")}),Object.keys(rt).map(Y=>a.jsx("option",{value:Y,children:Y},Y))]})]})]}),a.jsxs("div",{className:"af-pipeline-settings-schedule-status",children:[a.jsx("span",{className:`af-pipeline-settings-status-dot af-pipeline-settings-status-dot--${M}`}),a.jsx("span",{children:cn.nextRunAt?e("flow:schedule.nextRun",{time:new Date(cn.nextRunAt).toLocaleString()}):e("flow:schedule.noNextRun")}),a.jsxs("span",{children:[e("flow:schedule.runtime"),":",N]})]}),a.jsxs("dl",{className:"af-pipeline-meta-dl af-pipeline-settings-dl",children:[St.lastTriggeredAt?a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:schedule.lastTriggeredAt")}),a.jsx("dd",{children:new Date(St.lastTriggeredAt).toLocaleString()})]}):null,St.lastSkippedAt?a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:schedule.lastSkippedAt")}),a.jsxs("dd",{children:[new Date(St.lastSkippedAt).toLocaleString(),St.lastSkipReason?` · ${St.lastSkipReason}`:""]})]}):null,St.lastRunUuid?a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:schedule.lastRun")}),a.jsx("dd",{children:St.lastRunUuid})]}):null,St.lastExitCode!=null?a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:schedule.lastExit")}),a.jsx("dd",{children:String(St.lastExitCode)})]}):null,St.lastFinishedAt?a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:schedule.lastFinishedAt")}),a.jsx("dd",{children:new Date(St.lastFinishedAt).toLocaleString()})]}):null]}),Jt!=null&&Jt.lastError||St.lastError?a.jsx("p",{className:"af-err af-pipeline-drawer-err",children:(Jt==null?void 0:Jt.lastError)||St.lastError}):null,u.archived||u.source==="builtin"?a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.readonlyNote")}):null,yn?a.jsx("p",{className:"af-err af-pipeline-drawer-err",children:yn}):null,Ga?a.jsx("p",{className:"af-pipeline-drawer-muted",children:Ga}):null]})]}),a.jsxs("section",{id:"pipeline-metadata",className:"af-pipeline-settings-section",children:[a.jsxs("div",{className:"af-pipeline-settings-section-head",children:[a.jsx("span",{className:"af-pipeline-settings-section-index",children:"5."}),a.jsx("h2",{children:e("flow:pipeline.metadata")})]}),a.jsxs("dl",{className:"af-pipeline-meta-dl af-pipeline-settings-dl",children:[a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:pipeline.nodeCount")}),a.jsxs("dd",{children:[bt.length," ",e("flow:pipeline.nodesUnit")]})]}),a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:settings.marketplaceNodes")}),a.jsx("dd",{children:rf.length})]}),a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:settings.source")}),a.jsx("dd",{children:pl(u.source??"user",e)})]})]})]})]}),a.jsxs("aside",{className:"af-pipeline-settings-side","aria-label":e("flow:settings.overview"),children:[a.jsxs("section",{className:"af-pipeline-settings-side-card",children:[a.jsxs("div",{className:"af-pipeline-settings-overview-head",children:[a.jsx("span",{className:"af-pipeline-settings-overview-icon material-symbols-outlined","aria-hidden":!0,children:"account_tree"}),a.jsxs("div",{children:[a.jsx("h2",{children:u.id}),a.jsx("span",{className:`af-pipeline-settings-status af-pipeline-settings-status--${M}`,children:N})]})]}),a.jsxs("dl",{className:"af-pipeline-settings-side-dl",children:[a.jsxs("div",{children:[a.jsx("dt",{children:e("flow:pipeline.nodeCount")}),a.jsx("dd",{children:bt.length})]}),a.jsxs("div",{children:[a.jsx("dt",{children:e("flow:settings.owner")}),a.jsx("dd",{children:u.owner||"bigo"})]}),a.jsxs("div",{children:[a.jsx("dt",{children:e("flow:settings.source")}),a.jsx("dd",{children:pl(u.source??"user",e)})]})]})]}),a.jsxs("section",{className:"af-pipeline-settings-side-card",children:[a.jsx("h2",{children:e("flow:settings.quickActions")}),a.jsxs("button",{type:"button",className:"af-btn-primary af-pipeline-settings-side-action",onClick:()=>void fT(),disabled:Zr,children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"save"}),e(Zr?"flow:settings.savingChanges":"flow:settings.saveChanges")]}),a.jsxs("button",{type:"button",className:"af-btn-secondary af-pipeline-settings-side-action",onClick:Fc,children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_back"}),e("flow:settings.backToCanvas")]})]}),a.jsxs("section",{className:"af-pipeline-settings-side-card",children:[a.jsx("h2",{children:e("flow:settings.help")}),a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.helpText")}),a.jsx("button",{type:"button",className:"af-pipeline-drawer-link",onClick:()=>n("/settings"),children:e("flow:settings.globalSettings")})]})]})]})},IT=()=>{const y=Mt;if(!y)return null;const N=y.definitionId||`marketplace:${y.id}${y.version?`@${y.version}`:""}`,M=y.displayName||y.label||y.id,z=Qf(y.inputs||y.input),H=Qf(y.outputs||y.output);return Dr.createPortal(a.jsx("div",{className:"af-market-preview-overlay",role:"dialog","aria-modal":"true","aria-label":e("flow:settings.nodePreviewTitle"),onMouseDown:Y=>{Y.target===Y.currentTarget&&Mn(null)},children:a.jsxs("div",{className:"af-market-preview-dialog",children:[a.jsxs("div",{className:"af-market-preview-head",children:[a.jsxs("div",{children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:settings.nodePreviewTitle")}),a.jsx("h2",{children:M})]}),a.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>Mn(null),"aria-label":e("flow:settings.closePreview"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsxs("div",{className:"af-market-preview-body",children:[a.jsx("section",{className:"af-market-preview-visual","aria-label":e("flow:settings.nodeStylePreview"),children:a.jsxs("div",{className:"af-market-preview-node",children:[a.jsx("div",{className:"af-market-preview-node-ports af-market-preview-node-ports--left",children:(z.length>0?z:[""]).slice(0,4).map((Y,Q)=>a.jsx("span",{title:Y},`preview-in-${Q}`))}),a.jsxs("div",{className:"af-market-preview-node-main",children:[a.jsx("span",{className:"af-market-preview-node-icon material-symbols-outlined","aria-hidden":!0,children:"extension"}),a.jsx("strong",{children:M}),a.jsx("span",{children:N})]}),a.jsx("div",{className:"af-market-preview-node-ports af-market-preview-node-ports--right",children:(H.length>0?H:[""]).slice(0,4).map((Y,Q)=>a.jsx("span",{title:Y},`preview-out-${Q}`))})]})}),a.jsxs("section",{className:"af-market-preview-section",children:[a.jsx("h3",{children:e("flow:settings.nodeFunction")}),a.jsx("p",{children:y.description||e("flow:settings.marketplaceNoDescription")})]}),a.jsxs("div",{className:"af-market-preview-io-grid",children:[a.jsxs("section",{className:"af-market-preview-section",children:[a.jsx("h3",{children:"Inputs"}),a.jsx("div",{className:"af-pipeline-market-chips af-market-preview-chips",children:z.length>0?z.map(Y=>a.jsx("span",{className:"af-pipeline-market-chip",children:Y},`preview-input-${Y}`)):a.jsx("span",{className:"af-pipeline-market-chip af-pipeline-market-chip--muted",children:e("flow:settings.noInputs")})})]}),a.jsxs("section",{className:"af-market-preview-section",children:[a.jsx("h3",{children:"Outputs"}),a.jsx("div",{className:"af-pipeline-market-chips af-market-preview-chips",children:H.length>0?H.map(Y=>a.jsx("span",{className:"af-pipeline-market-chip",children:Y},`preview-output-${Y}`)):a.jsx("span",{className:"af-pipeline-market-chip af-pipeline-market-chip--muted",children:e("flow:settings.noOutputs")})})]})]}),a.jsxs("section",{className:"af-market-preview-section",children:[a.jsx("h3",{children:e("flow:settings.nodePackageInfo")}),a.jsxs("dl",{className:"af-market-preview-dl",children:[a.jsxs("div",{children:[a.jsx("dt",{children:e("flow:settings.definitionId")}),a.jsx("dd",{children:N})]}),a.jsxs("div",{children:[a.jsx("dt",{children:e("flow:settings.version")}),a.jsx("dd",{children:y.version||"-"})]}),a.jsxs("div",{children:[a.jsx("dt",{children:e("flow:settings.packagePath")}),a.jsx("dd",{children:y.packageDir||"-"})]}),a.jsxs("div",{children:[a.jsx("dt",{children:e("flow:settings.packagedFiles")}),a.jsx("dd",{children:Array.isArray(y.packagedFiles)&&y.packagedFiles.length>0?y.packagedFiles.map(Y=>Y.to||Y).join(", "):"-"})]})]})]})]})]})}),document.body)};return a.jsxs(cv,{children:[a.jsx(lV,{onReady:s}),a.jsxs(BA.Provider,{value:{modelLists:ke,onModelChange:pT},children:[a.jsxs("div",{className:"af-pipeline-page"+(Ce!=="edit"?" af-pipeline-page--run-mode":""),children:[a.jsxs("header",{className:"af-pipeline-top",children:[a.jsxs("div",{className:"af-pipeline-top-left",children:[a.jsx("button",{type:"button",className:"af-icon-btn af-pipeline-back",onClick:()=>{Ce==="running"?hf(!0):Ce!=="edit"?ma():n("/projects")},"aria-label":e(Ce!=="edit"?"flow:topbar.backToEdit":"flow:topbar.backToProjects"),title:e(Ce!=="edit"?"flow:topbar.backToEdit":"flow:topbar.backToProjects"),children:a.jsx("span",{className:"material-symbols-outlined",children:"arrow_back"})}),a.jsxs("div",{className:"af-pipeline-brand",children:[a.jsx("span",{className:"af-pipeline-brand-name",children:"PIPELINE"}),a.jsxs("span",{className:"af-pipeline-brand-ver",children:["V",UW,"-STABLE"]})]}),a.jsxs("div",{className:"af-view-switch","aria-label":"视图切换",children:[a.jsx("button",{type:"button",className:"af-view-switch__active",children:"Pipeline"}),a.jsx("button",{type:"button",onClick:()=>n(Ww(u,"workspace")),children:"Workspace"})]})]}),a.jsxs("div",{className:"af-pipeline-top-right af-flow-toolbar-actions",children:[V&&a.jsx("button",{type:"button",className:"af-icon-btn"+(Ie?" af-icon-btn--active":""),"aria-label":"Composer Logs (dev)",title:"Composer Logs (dev)",onClick:()=>He(y=>!y),children:a.jsx("span",{className:"material-symbols-outlined",children:"description"})}),Ce==="running"&&a.jsxs("div",{className:"af-run-timer",children:[a.jsx("span",{className:"af-run-timer__dot"}),a.jsx("span",{className:"af-run-timer__label",children:"RUNTIME"}),a.jsx("span",{className:"af-run-timer__value",children:Vg(ln,"running")})]}),Ce==="stopped"&&a.jsxs("div",{className:"af-run-timer af-run-timer--stopped",children:[a.jsx("span",{className:"af-run-timer__label",children:"PAUSED"}),a.jsx("span",{className:"af-run-timer__value",children:Vg(ln,"stopped")})]}),(Ce==="done"||Ce==="error")&&a.jsxs("div",{className:"af-run-timer"+(Ce==="error"?" af-run-timer--error":" af-run-timer--done"),children:[a.jsx("span",{className:"af-run-timer__label",children:Ce==="error"?"FAILED":"COMPLETED"}),a.jsx("span",{className:"af-run-timer__value",children:Vg(ln,Ce)})]}),Ce!=="edit"&&a.jsx("button",{type:"button",className:"af-icon-btn"+(Sr?" af-icon-btn--active":""),"aria-label":e("flow:topbar.executionLog"),title:e("flow:topbar.executionLog"),onClick:()=>Qr(y=>!y),children:a.jsx("span",{className:"material-symbols-outlined",children:"terminal"})}),Ce==="edit"&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"af-icon-btn"+(dt==="history"?" af-icon-btn--active":""),"aria-label":e("flow:topbar.history"),title:e("flow:topbar.history"),disabled:!u,onClick:ET,children:a.jsx("span",{className:"material-symbols-outlined",children:"history"})}),a.jsx("button",{type:"button",className:"af-icon-btn"+(dt==="settings"?" af-icon-btn--active":""),onClick:_T,"aria-label":e("flow:topbar.pipelineSettings"),title:e("flow:topbar.pipelineSettings"),disabled:!u,children:a.jsx("span",{className:"material-symbols-outlined",children:"settings"})}),a.jsx("button",{type:"button",className:"af-composer-topbar-btn"+(dt==="composer"?" af-composer-topbar-btn--active":"")+(xn?" af-composer-topbar-btn--running":""),onClick:PT,"aria-label":"AI Composer",title:"AI Composer",disabled:!u,children:"AI"}),a.jsx("button",{type:"button",className:"af-icon-btn af-shortcuts-trigger"+(Ne?" af-icon-btn--active":""),onClick:C0,"aria-label":e("flow:topbar.shortcutsLabel"),title:e("flow:topbar.shortcutsTitle"),disabled:!u,children:a.jsx("span",{className:"af-shortcuts-trigger__mark","aria-hidden":!0,children:"?"})}),a.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||u.source==="builtin"||u.source!=="user"&&u.source!=="workspace",onClick:()=>R(!0),children:a.jsx("span",{className:"material-symbols-outlined",children:"delete_forever"})}),a.jsx("button",{type:"button",className:"af-btn-pipeline-archive",disabled:!u||u.source==="builtin"||u.archived||u.source!=="user"&&u.source!=="workspace",onClick:()=>U(!0),children:"Archive"})]}),Ce==="running"?a.jsxs("button",{type:"button",className:"af-btn-run-stop",onClick:wT,title:e("flow:run.pauseRun"),children:[a.jsx("span",{className:"material-symbols-outlined",children:"pause"}),"Pause"]}):Ce==="ready"?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!u,onClick:()=>void us(),title:e("flow:topbar.startRun"),children:e("flow:topbar.startRun")}),a.jsxs("button",{type:"button",className:"af-btn-pipeline-save",onClick:ma,children:[a.jsx("span",{className:"material-symbols-outlined",children:"edit"}),"Edit"]})]}):Ce==="stopped"?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!u,onClick:()=>void us({runUuid:nt}),title:nt?e("flow:topbar.resumeTitle",{uuid:nt}):e("flow:topbar.resumeTitleNoUuid"),children:"Resume"}),a.jsxs("button",{type:"button",className:"af-btn-pipeline-save",onClick:ma,children:[a.jsx("span",{className:"material-symbols-outlined",children:"edit"}),"Edit"]})]}):Ce==="done"||Ce==="error"?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!u,onClick:()=>void us(),title:e("flow:topbar.rerunTitle"),children:"Run"}),a.jsxs("button",{type:"button",className:"af-btn-pipeline-save",onClick:ma,children:[a.jsx("span",{className:"material-symbols-outlined",children:"edit"}),"Edit"]})]}):a.jsxs("div",{className:"af-run-btn-group",children:[a.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg af-run-btn-main",disabled:!u,onClick:()=>void us(),children:"Run"}),a.jsx("button",{type:"button",className:"af-run-btn-dropdown",disabled:!u,onClick:()=>Ai(y=>!y),"aria-label":e("flow:topbar.runOptions"),"aria-expanded":Pi,children:a.jsx("span",{className:"material-symbols-outlined",children:"arrow_drop_down"})}),Pi&&u&&a.jsxs("div",{className:"af-run-dropdown-menu",children:[a.jsxs("button",{type:"button",className:"af-run-dropdown-item",onClick:()=>{var N,M,z,H,Y;Ai(!1);const y={};for(const Q of Li){const ee=il[Q.id];ee&&(y[ee]=((N=Nn[ee])==null?void 0:N.value)??((M=Nn[ee])==null?void 0:M.path)??((Y=(H=(z=Q.data)==null?void 0:z.outputs)==null?void 0:H[0])==null?void 0:Y.default)??"")}Rs(y),Is(!0)},children:[a.jsx("span",{className:"material-symbols-outlined",children:"edit_note"}),e("flow:topbar.runWithParams")]}),a.jsxs("button",{type:"button",className:"af-run-dropdown-item",onClick:()=>{Ai(!1),us({prepareOnly:!0})},children:[a.jsx("span",{className:"material-symbols-outlined",children:"tune"}),e("flow:topbar.editRun")]}),a.jsx("div",{className:"af-run-dropdown-divider"}),a.jsxs("div",{className:"af-run-dropdown-section",children:[a.jsx("span",{className:"af-run-dropdown-section-label",children:e("flow:topbar.runWithPreset")}),a.jsxs("button",{type:"button",className:"af-run-dropdown-item",onClick:()=>{Ai(!1),us()},children:[a.jsx("span",{className:"material-symbols-outlined",children:"play_arrow"}),e("flow:runPreset.default")]}),Object.keys(rt).map(y=>a.jsxs("button",{type:"button",className:"af-run-dropdown-item",onClick:()=>{var z;Ai(!1);const N=rt[y]||{},M={};for(const H of Li){const Y=il[H.id];if(!Y)continue;const Q=((z=H.data)==null?void 0:z.definitionId)||"",ee=N[H.id]??"";Q.startsWith("provide_file")?M[Y]={type:"file",path:ee}:M[Y]={type:"str",value:ee}}us({cliInputsOverride:M})},children:[a.jsx("span",{className:"material-symbols-outlined",children:"bookmark"}),y]},y))]})]})]})]})]}),Ue?a.jsxs("div",{className:"af-flow-snippet-toast",role:"status","aria-live":"polite",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"check_circle"}),a.jsx("span",{children:Ue}),a.jsx("button",{type:"button",onClick:()=>Ge(""),"aria-label":"关闭发布提示",children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}):null,a.jsxs("div",{className:"af-pipeline-body"+(Ce!=="edit"?" af-pipeline-body--run-mode":""),children:[Ce==="edit"&&dt!=="settings"?a.jsxs("aside",{className:"af-node-palette af-flow-left-panel",id:"af-node-palette","aria-label":e("flow:palette2.nodePalette"),children:[a.jsxs("div",{className:`af-palette-workspace${Qn?" af-palette-workspace--expanded":""}`,children:[a.jsxs("button",{type:"button",className:"af-palette-workspace-head",onClick:()=>es(y=>!y),"aria-expanded":Qn,children:[a.jsx("span",{className:"af-palette-workspace-icon material-symbols-outlined","aria-hidden":!0,children:"folder_open"}),a.jsx("span",{className:"af-palette-workspace-label",children:e("flow:palette.workspace")}),a.jsx("span",{className:"af-palette-workspace-chevron material-symbols-outlined","aria-hidden":!0,children:Qn?"expand_less":"expand_more"})]}),a.jsx("div",{className:"af-palette-workspace-path",title:u&&(u.path||Xe.path)||"",children:u?u.id:e("flow:palette2.noPipelineSelected")}),Qn&&a.jsx("div",{className:"af-palette-workspace-tree",children:$t?a.jsx("div",{className:"af-palette-workspace-loading",children:e("flow:palette.loading")}):Xe.error?a.jsx("div",{className:"af-palette-workspace-empty",children:Xe.error}):u?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"af-palette-workspace-group",children:[a.jsxs("div",{className:"af-palette-workspace-group-head",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"folder"}),a.jsx("span",{children:u.id}),a.jsxs("span",{className:"af-palette-workspace-count",children:["(",Xe.files.length,")"]})]}),Xe.files.length>0?a.jsx("ul",{className:"af-palette-workspace-list",children:Xe.files.filter(y=>y.type==="file").map(y=>a.jsxs("li",{className:"af-palette-workspace-item af-palette-workspace-item--clickable",title:y.path,onClick:()=>G({filePath:y.path,fileName:y.name}),children:[a.jsx("span",{className:"material-symbols-outlined af-palette-workspace-item-icon","aria-hidden":!0,children:y.icon}),a.jsx("span",{className:"af-palette-workspace-item-label",children:y.name}),y.size!=null&&a.jsx("span",{className:"af-palette-workspace-item-size",children:y.size<1024?`${y.size}B`:y.size<1024*1024?`${(y.size/1024).toFixed(1)}KB`:`${(y.size/1024/1024).toFixed(1)}MB`})]},y.path))}):Xe.files.filter(y=>y.type==="directory").length===0?a.jsx("div",{className:"af-palette-workspace-empty",children:"暂无文件"}):null]}),Xe.files.filter(y=>{var N;return y.type==="directory"&&((N=y.children)==null?void 0:N.length)>0}).map(y=>a.jsxs("div",{className:"af-palette-workspace-group af-palette-workspace-group--sub",children:[a.jsxs("div",{className:"af-palette-workspace-group-head",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:y.icon}),a.jsxs("span",{children:[y.name,"/"]}),a.jsxs("span",{className:"af-palette-workspace-count",children:["(",y.children.length,")"]})]}),a.jsx("ul",{className:"af-palette-workspace-list",children:y.children.map(N=>a.jsxs("li",{className:`af-palette-workspace-item${N.type==="file"?" af-palette-workspace-item--clickable":""}`,title:N.path,onClick:N.type==="file"?()=>G({filePath:N.path,fileName:N.name}):void 0,children:[a.jsx("span",{className:"material-symbols-outlined af-palette-workspace-item-icon","aria-hidden":!0,children:N.icon}),a.jsx("span",{className:"af-palette-workspace-item-label",children:N.name}),N.type==="file"&&N.size!=null&&a.jsx("span",{className:"af-palette-workspace-item-size",children:N.size<1024?`${N.size}B`:N.size<1024*1024?`${(N.size/1024).toFixed(1)}KB`:`${(N.size/1024/1024).toFixed(1)}MB`})]},N.path))})]},y.path))]}):a.jsx("div",{className:"af-palette-workspace-empty",children:e("flow:palette2.noPipelineSelected")})})]}),a.jsxs("div",{className:"af-node-palette-head",children:[a.jsxs("h2",{className:"af-node-palette-title",children:[a.jsx("span",{children:"Palette"}),a.jsx("span",{className:"af-node-palette-title-kbd","aria-label":"快捷键 A",children:"A"})]}),a.jsxs("label",{className:"af-palette-search-wrap",children:[a.jsx("span",{className:"af-visually-hidden",children:pe==="flows"?"搜索流程片段":e("flow:palette.searchNodes")}),a.jsx("span",{className:"af-palette-search-icon material-symbols-outlined","aria-hidden":!0,children:"search"}),a.jsx("input",{ref:me,type:"search",className:"af-palette-search-input",value:ge,onChange:y=>se(y.target.value),placeholder:(pe==="flows"?"搜索流程片段":e("flow:palette.searchNodes"))+"…","aria-label":pe==="flows"?"搜索流程片段":e("flow:palette.searchNodes")})]}),a.jsxs("div",{className:"af-palette-tabs",role:"tablist","aria-label":"Palette 类型",children:[a.jsxs("button",{type:"button",role:"tab","aria-selected":pe==="nodes",className:"af-palette-tab"+(pe==="nodes"?" af-palette-tab--active":""),onClick:()=>ae("nodes"),children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"category"}),"节点"]}),a.jsxs("button",{type:"button",role:"tab","aria-selected":pe==="flows",className:"af-palette-tab"+(pe==="flows"?" af-palette-tab--active":""),onClick:()=>ae("flows"),children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"account_tree"}),"流程"]})]})]}),c?a.jsx("p",{className:"af-err af-palette-list-err",children:c}):null,a.jsx("div",{className:"af-node-palette-scroll",children:pe==="flows"?a.jsxs(a.Fragment,{children:[a.jsx("section",{className:"af-palette-section af-flow-palette-section--snippets",children:a.jsxs("div",{className:"af-flow-snippet-actions",children:[a.jsxs("button",{type:"button",className:"af-flow-snippet-publish-btn",onClick:jT,disabled:!u||tr.length<2,title:tr.length<2?"选择至少两个节点后发布流程片段":"发布选中的流程片段",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"ios_share"}),"发布选中片段"]}),a.jsxs("span",{className:"af-flow-snippet-selection",children:["已选 ",tr.length," 节点 / ",mf.length," 连线"]})]})}),It?a.jsx("p",{className:"af-err af-palette-list-err",children:It}):null,Ke?a.jsx("p",{className:"af-palette-empty",children:"正在加载流程片段…"}):v0.length>0?a.jsxs("section",{className:"af-palette-section af-flow-palette-section--snippets",children:[a.jsx("h3",{className:"af-palette-cat",children:"FLOW SNIPPETS"}),a.jsx("div",{className:"af-palette-cards",children:v0.map(y=>{const N=`${y.id}@${y.version}`,M=y.displayName||y.name||y.id,z=y.description||`${y.nodeCount||0} 个节点,${y.edgeCount||0} 条连线`;return a.jsxs("button",{type:"button",className:"af-palette-card af-flow-snippet-card",onClick:()=>k0(y),draggable:!!u,onDragStart:H=>{H.dataTransfer.setData("application/agentflow-snippet",N),H.dataTransfer.effectAllowed="move"},disabled:!u,title:z,children:[a.jsxs("span",{className:"af-palette-card-head",children:[a.jsx("span",{className:"af-palette-card-icon","aria-hidden":!0,children:a.jsx("span",{className:"material-symbols-outlined",children:"account_tree"})}),a.jsxs("span",{className:"af-palette-card-main",children:[a.jsx("span",{className:"af-palette-card-label",children:M}),a.jsxs("span",{className:"af-palette-card-id",children:[y.id,"@",y.version]})]})]}),z?a.jsx("span",{className:"af-palette-card-desc",children:z}):null,a.jsxs("span",{className:"af-flow-snippet-meta","aria-hidden":!0,children:[a.jsxs("span",{children:[y.nodeCount||0," nodes"]}),a.jsxs("span",{children:[y.edgeCount||0," edges"]})]})]},N)})})]}):a.jsx("p",{className:"af-palette-empty",children:ge.trim()?"无匹配流程片段":"暂无流程片段。选择多个节点后发布。"})]}):a.jsxs(a.Fragment,{children:[hu.filter(y=>nf[y].length>0).map(y=>a.jsxs("section",{className:`af-palette-section af-flow-palette-section--${y}`,children:[a.jsx("h3",{className:"af-palette-cat",children:y}),a.jsx("div",{className:"af-palette-cards",children:nf[y].map(N=>{const M=bN(N.inputs,"input"),z=bN(N.outputs,"output"),Y=N.id==="control_load_skills"?"从当前 Skills collection 或上游上下文自动注入 Skills,通常无需手填参数。":UA(N),Q=HA(N);return a.jsxs("button",{type:"button",className:"af-palette-card",onClick:()=>m0(N),draggable:!!u,onDragStart:ee=>{ee.dataTransfer.setData("application/agentflow-node",N.id),ee.dataTransfer.effectAllowed="move"},disabled:!u,title:Y||N.id,children:[a.jsxs("span",{className:"af-palette-card-head",children:[a.jsx("span",{className:"af-palette-card-icon","aria-hidden":!0,children:a.jsx("span",{className:"material-symbols-outlined",children:YW(y)})}),a.jsxs("span",{className:"af-palette-card-main",children:[a.jsx("span",{className:"af-palette-card-label",children:Q}),Q!==N.id?a.jsx("span",{className:"af-palette-card-id",children:N.id}):null]})]}),Y?a.jsx("span",{className:"af-palette-card-desc",children:Y}):null,a.jsxs("span",{className:"af-palette-card-ports","aria-hidden":!0,children:[a.jsxs("span",{className:"af-palette-card-port-side af-palette-card-port-side--in",children:[a.jsxs("span",{className:"af-palette-card-port-count",children:[M.list.length," IN"]}),a.jsxs("span",{className:"af-palette-card-port-list",children:[M.shown.map((ee,he)=>a.jsxs("span",{className:"af-palette-card-port",title:vN("input",ee,he),children:[a.jsx("span",{className:"af-palette-card-port-dot",style:{background:In(ee==null?void 0:ee.type)}}),a.jsx("span",{className:"af-palette-card-port-name",children:Kg(ee,he)})]},`in-${he}`)),M.hidden>0?a.jsxs("span",{className:"af-palette-card-port-more",children:["+",M.hidden]}):null]})]}),a.jsxs("span",{className:"af-palette-card-port-side af-palette-card-port-side--out",children:[a.jsxs("span",{className:"af-palette-card-port-count",children:[z.list.length," OUT"]}),a.jsxs("span",{className:"af-palette-card-port-list",children:[z.shown.map((ee,he)=>a.jsxs("span",{className:"af-palette-card-port",title:vN("output",ee,he),children:[a.jsx("span",{className:"af-palette-card-port-name",children:Kg(ee,he)}),a.jsx("span",{className:"af-palette-card-port-dot",style:{background:In(ee==null?void 0:ee.type)}})]},`out-${he}`)),z.hidden>0?a.jsxs("span",{className:"af-palette-card-port-more",children:["+",z.hidden]}):null]})]})]})]},N.id)})})]},y)),u&&ue.length===0?a.jsx("p",{className:"af-palette-empty",children:e("flow:palette.noComponents")}):null,u&&ue.length>0&&ge.trim()&&YI===0?a.jsx("p",{className:"af-palette-empty",children:e("flow:palette.noMatch")}):null,u?null:a.jsx("p",{className:"af-palette-empty",children:e("flow:palette.selectPipeline")})]})}),a.jsxs("footer",{className:"af-palette-engine",children:[a.jsxs("div",{className:"af-palette-engine-head",children:[a.jsx("span",{className:"af-palette-engine-dot"+(Be?"":" af-palette-engine-dot--offline"),"aria-hidden":!0}),a.jsx("span",{className:"af-palette-engine-label",children:e(Be?"common:engine.online":"common:engine.offline")})]}),w?a.jsx("div",{className:"af-palette-tip"+JI,role:"status","aria-live":"polite",children:w}):null]})]}):Ce!=="edit"&&u?a.jsx(MW,{flowId:u.id,flowSource:u.source||"user",flowArchived:u.archived,provideNodes:Li,edges:dn,nodes:bt,onCliInputsChange:As,onBackToEdit:ma}):null,a.jsxs("div",{className:"af-pipeline-main-stack",children:[a.jsxs("div",{className:"af-pipeline-canvas-col",children:[S?a.jsx("div",{className:"af-banner af-banner--err af-pipeline-banner",children:S}):null,u&&ls.length>0&&!J?a.jsxs("div",{className:"af-banner af-banner--warn af-flow-slot-warnings",role:"region","aria-label":e("flow:validation.flowWarningAriaLabel"),children:[a.jsxs("div",{className:"af-flow-slot-warnings-head",children:[a.jsx("div",{className:"af-flow-slot-warnings-title",children:e("flow:palette.validationWarnings")}),a.jsxs("div",{className:"af-flow-slot-warnings-head-actions",children:[a.jsx("button",{type:"button",className:"af-icon-btn",disabled:te,"aria-label":e("flow:validation.reloadFromServer"),title:e("flow:validation.reloadFromServerShort"),onClick:()=>void h0(),children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"refresh"})}),a.jsx("button",{type:"button",className:"af-icon-btn","aria-label":e("flow:validation.closeBanner"),title:e("common:common.close"),onClick:()=>B(!0),children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]})]}),a.jsx("ul",{className:"af-flow-slot-warnings-list",children:ls.map(y=>a.jsxs("li",{children:[e("flow:validation.nodePrefix"),' "',a.jsx("a",{href:"#",className:"af-flow-slot-warning-node-link","aria-label":e("flow:validation.focusNodeAriaLabel",{nodeId:y.nodeId}),onClick:N=>{N.preventDefault(),aT(y.nodeId)},children:y.nodeId}),'"',y.suffix]},y.key))})]}):null,u&&ls.length>0&&J?a.jsxs("div",{className:"af-banner af-banner--warn af-flow-slot-warnings af-flow-slot-warnings--collapsed",role:"status","aria-live":"polite",children:[a.jsx("span",{className:"af-flow-slot-warnings-collapsed-text",children:e("flow:validation.slotWarningCount",{count:ls.length})}),a.jsxs("button",{type:"button",className:"af-flow-slot-warnings-kbd-hint",onClick:C0,title:e("flow:validation.shortcutHint"),children:[a.jsx("kbd",{children:"?"})," ",e("flow:validation.shortcutHintLabel")]}),a.jsxs("div",{className:"af-flow-slot-warnings-collapsed-actions",children:[a.jsx("button",{type:"button",className:"af-flow-slot-warnings-collapsed-btn",onClick:()=>B(!1),children:e("flow:validation.show")}),a.jsx("button",{type:"button",className:"af-flow-slot-warnings-collapsed-btn",disabled:te,onClick:()=>void h0(),children:e("common:common.refresh")})]})]}):null,dt==="settings"&&u&&Ce==="edit"?AT():a.jsx("div",{className:"af-react-flow-wrap af-pipeline-flow",children:u?a.jsxs(a.Fragment,{children:[a.jsx(mV,{fitViewEpoch:p,canvasTool:le,nodes:WI,edges:VI,onNodesChange:Ce!=="edit"?void 0:HI,onEdgesChange:Ce!=="edit"?void 0:UI,onConnect:Ce!=="edit"?void 0:nT,onConnectStart:Ce!=="edit"?void 0:rT,onConnectEnd:Ce!=="edit"?void 0:iT,isValidConnection:Ce!=="edit"?void 0:tT,onNodesDelete:Ce!=="edit"?void 0:sT,onNodeClick:QI,onNodeDoubleClick:ZI,onEdgeClick:eT,onFlowInit:oT,onDrop:dT,onDragOver:uT,hideMinimapAndControls:!!(u&&dt),bottomSlot:Ce==="edit"?a.jsx("div",{className:"af-bottom-composer-stack af-flow-bottom-composer",children:a.jsxs("div",{className:"af-pipeline-composer-inner",children:[a.jsx("div",{className:"af-composer-selected","aria-label":e("flow:composer.selectedNodesAriaLabel"),children:gf.length===0?a.jsx("span",{className:"af-composer-selected-empty",children:e("flow:composer.selectedNodesEmpty")}):gf.map((y,N)=>{var he,je;if(y.kind==="definition"){const Te=y.definition,ie=String(Te.label??Te.id),_e=[Te.id,Te.description?String(Te.description).slice(0,120):""].filter(Boolean).join(" — ");return a.jsxs("div",{className:"af-composer-node-chip af-composer-node-chip--definition",title:_e,children:[a.jsx("span",{className:"af-composer-node-chip-label",children:ie}),a.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>j0(y),"aria-label":e("flow:composer.removeFromInput",{id:Te.id}),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},`def-${Te.id}`)}const M=y.node,z=y.kind,H=String(((he=M.data)==null?void 0:he.label)??M.id),Y=(je=M.data)!=null&&je.definitionId?String(M.data.definitionId):"",Q=Y&&Y!==H?`${H} · ${M.id} · ${Y}`:`${H} · ${M.id}`,ee=z==="canvas"?e("flow:composer.deselectNode",{id:M.id}):e("flow:composer.removeFromInput",{id:M.id});return a.jsxs("div",{className:"af-composer-node-chip"+(z==="mention"?" af-composer-node-chip--mention":""),title:Q,children:[a.jsx("span",{className:"af-composer-node-chip-label",children:H}),a.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>j0(y),"aria-label":ee,children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},M.id)})}),a.jsxs("div",{className:"af-composer-card af-composer-card--input-only",children:[a.jsxs("div",{className:"af-composer-input-wrap",children:[a.jsx("textarea",{ref:Zn,className:"af-composer-textarea",placeholder:e("flow:composer.inputPlaceholder"),disabled:!u,value:jr,rows:2,onChange:y=>{_(y.target.value),X(y.target.selectionStart??y.target.value.length)},onSelect:y=>{const N=y.target;N instanceof HTMLTextAreaElement&&X(N.selectionStart??0)},onKeyDown:y=>{if((y.metaKey||y.ctrlKey)&&y.key==="Enter"){y.preventDefault(),ga();return}if($c&&Oi.length>0&&(y.key==="ArrowDown"||y.key==="ArrowUp"||y.key==="Enter")){if(y.key==="ArrowDown")y.preventDefault(),ne(N=>(N+1)%Oi.length);else if(y.key==="ArrowUp")y.preventDefault(),ne(N=>(N-1+Oi.length)%Oi.length);else if(y.key==="Enter"){y.preventDefault();const N=Oi[Z];N&&zm(N.id)}}},onKeyUp:y=>{const N=y.target;N instanceof HTMLTextAreaElement&&X(N.selectionStart??N.value.length)},onClick:y=>{const N=y.target;N instanceof HTMLTextAreaElement&&X(N.selectionStart??0)},"aria-label":e("flow:composer.inputAriaLabel"),autoComplete:"off",spellCheck:!1}),$c&&u&&Oi.length>0?a.jsxs("ul",{className:"af-composer-mention-menu",role:"listbox","aria-label":e("flow:composer.mentionAriaLabel"),children:[Dc.instances.length>0?a.jsx("li",{className:"af-composer-mention-section",role:"presentation",children:a.jsx("div",{className:"af-composer-mention-section-title",children:"Instances"})}):null,Dc.instances.map((y,N)=>{const M=N;return a.jsx("li",{role:"option","aria-selected":M===Z,children:a.jsxs("button",{type:"button",className:"af-composer-mention-item"+(M===Z?" af-composer-mention-item--active":""),onMouseDown:z=>z.preventDefault(),onMouseEnter:()=>ne(M),onClick:()=>zm(y.id),children:[a.jsx("span",{className:"af-composer-mention-id",children:y.title}),y.subtitle?a.jsx("span",{className:"af-composer-mention-sub",children:y.subtitle}):null]})},`i-${y.id}`)}),Dc.definitions.length>0?a.jsx("li",{className:"af-composer-mention-section",role:"presentation",children:a.jsx("div",{className:"af-composer-mention-section-title",children:"Node"})}):null,Dc.definitions.map((y,N)=>{const M=Dc.instances.length+N;return a.jsx("li",{role:"option","aria-selected":M===Z,children:a.jsxs("button",{type:"button",className:"af-composer-mention-item"+(M===Z?" af-composer-mention-item--active":""),onMouseDown:z=>z.preventDefault(),onMouseEnter:()=>ne(M),onClick:()=>zm(y.id),children:[a.jsx("span",{className:"af-composer-mention-id",children:y.title}),y.subtitle?a.jsx("span",{className:"af-composer-mention-sub",children:y.subtitle}):null]})},`d-${y.id}`)})]}):null]}),a.jsxs("div",{className:"af-composer-toolbar",children:[Ri.length>0&&a.jsx("label",{className:"af-composer-session-field",children:a.jsxs("select",{className:"af-composer-session-select",value:ur||"",onChange:y=>{y.target.value==="__new__"?r0():l0(y.target.value)},disabled:xn,"aria-label":e("flow:composer.switchConversation"),children:[Ri.map(y=>a.jsxs("option",{value:y.id,children:[y.label,y.running?" ⏳":""]},y.id)),a.jsxs("option",{value:"__new__",children:["+ ",e("flow:composer.newConversation")]})]})}),a.jsxs("div",{className:"af-composer-skills-field",children:[a.jsxs("button",{ref:Sm,type:"button",className:"af-composer-skills-button"+(Fm>0?" af-composer-skills-button--active":""),disabled:!u||xn,"aria-haspopup":"listbox","aria-expanded":Kd,onClick:()=>km(y=>!y),children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"extension"}),a.jsx("span",{children:Fm>0?`Skills ${Fm}`:"Skills"})]}),Kd&&!xn?Dr.createPortal(a.jsx("div",{ref:Gv,className:"af-composer-skills-menu",role:"listbox","aria-label":"Composer skills",style:FI,children:Ms.length===0?a.jsx("div",{className:"af-composer-skills-empty",children:"No skills found"}):a.jsxs(a.Fragment,{children:[yf.groups.map(y=>{const N=Vo(y,Ms),M=tE(y,Dm,Ms),z=$I.has(y.id);return a.jsxs("div",{className:"af-composer-skill-group af-composer-skill-group--framed"+(z?" af-composer-skill-group--collapsed":""),children:[a.jsxs("div",{className:"af-composer-skill-group-title af-composer-skill-group-title--selectable",children:[a.jsxs("label",{className:"af-composer-skill-group-check",children:[a.jsx("input",{type:"checkbox",checked:M==="all",disabled:N.length===0,onChange:H=>{const Y=H.target.checked;_c(Q=>Y?ZC(Q,N):eE(Q,N))}}),a.jsxs("span",{className:"af-composer-skill-group-title-main",children:[a.jsx("span",{children:y.name}),y.builtin?a.jsx("em",{children:"built-in"}):null,M==="partial"?a.jsx("em",{children:"partial"}):null]})]}),a.jsxs("button",{type:"button",className:"af-composer-skill-group-toggle","aria-label":z?`展开 ${y.name}`:`收起 ${y.name}`,onClick:()=>{DI(H=>{const Y=new Set(H);return Y.has(y.id)?Y.delete(y.id):Y.add(y.id),Y})},children:[a.jsx("span",{children:y.skills.length}),a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:z?"expand_more":"expand_less"})]})]}),z?null:a.jsx("div",{className:"af-composer-skill-group-items",children:y.skills.map(H=>a.jsxs("label",{className:"af-composer-skill-option",children:[a.jsx("input",{type:"checkbox",checked:Dm.has(H.key),onChange:Y=>{const Q=Y.target.checked;_c(ee=>Q?ee.includes(H.key)?ee:[...ee,H.key]:ee.filter(he=>he!==H.key))}}),a.jsxs("span",{className:"af-composer-skill-option-main",children:[a.jsx("span",{className:"af-composer-skill-option-title",children:H.name}),H.description?a.jsx("span",{className:"af-composer-skill-option-desc",children:H.description}):null]})]},`${y.id}:${H.key}`))})]},y.id)}),yf.ungrouped.length>0?a.jsxs("div",{className:"af-composer-skill-group",children:[a.jsxs("div",{className:"af-composer-skill-group-title",children:[a.jsx("span",{children:"Ungrouped"}),a.jsx("span",{children:yf.ungrouped.length})]}),yf.ungrouped.map(y=>a.jsxs("label",{className:"af-composer-skill-option",children:[a.jsx("input",{type:"checkbox",checked:Dm.has(y.key),onChange:N=>{const M=N.target.checked;_c(z=>M?z.includes(y.key)?z:[...z,y.key]:z.filter(H=>H!==y.key))}}),a.jsxs("span",{className:"af-composer-skill-option-main",children:[a.jsx("span",{className:"af-composer-skill-option-title",children:y.name}),y.description?a.jsx("span",{className:"af-composer-skill-option-desc",children:y.description}):null]})]},`ungrouped:${y.key}`))]}):null]})}),document.body):null]}),a.jsxs("label",{className:"af-composer-model-field",children:[a.jsx("span",{className:"af-visually-hidden",children:e("flow:composer.modelLabel")}),a.jsxs("select",{className:"af-composer-model-select",value:(da||"").trim()?Lr.currentNotInLists?Lr.currentNotInLists:Zf(da,Lr.cursorList,Lr.opencodeList,Lr.claudeCodeList):"",onChange:y=>Kv(y.target.value),disabled:!u||xn,"aria-label":e("flow:composer.modelAriaLabel"),children:[a.jsx("option",{value:"",children:e("flow:composer.modelDefault")}),Lr.currentNotInLists?a.jsxs("option",{value:Lr.currentNotInLists,children:[Lr.currentNotInLists,e("flow:composer.modelNotInList")]}):null,Lr.cursorList.length>0?a.jsx("optgroup",{label:"Cursor",children:Lr.cursorList.map(y=>a.jsx("option",{value:Hs(y),children:y},`composer-c-${y}`))}):null,Lr.opencodeList.length>0?a.jsx("optgroup",{label:"OpenCode",children:Lr.opencodeList.map(y=>a.jsx("option",{value:`opencode:${Hs(y)}`,children:y},`composer-o-${y}`))}):null,Lr.claudeCodeList.length>0?a.jsx("optgroup",{label:"Claude Code",children:Lr.claudeCodeList.map(y=>a.jsx("option",{value:`claude-code:${Hs(y)}`,children:y},`composer-cc-${y}`))}):null]})]}),a.jsx("button",{type:"button",className:"af-composer-send"+(u&&jr.trim()&&!xn?" af-composer-send--active":"")+(xn?" af-composer-send--stop":""),disabled:!u||!xn&&!jr.trim(),"aria-label":e(xn?"flow:composer.stopGeneration":"flow:composer.send"),title:xn?e("flow:composer.stopGeneration"):void 0,onClick:()=>{var y;if(xn){(y=Qd.current)==null||y.abort();return}ga()},children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:xn?"stop":"arrow_upward"})})]})]}),jm?Dr.createPortal(a.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:y=>{y.target===y.currentTarget&&Jd(!1)},children:a.jsxs("div",{className:"af-node-props-expand-panel af-composer-thread-dialog-panel",children:[a.jsxs("div",{className:"af-node-props-expand-head af-composer-thread-dialog-head",children:[a.jsxs("div",{className:"af-composer-thread-dialog-head-main",children:[a.jsx("span",{className:"af-node-props-expand-title",children:e("flow:nodeProps.conversationOutput")}),a.jsx("div",{className:"af-composer-thread-dialog-status"+(xn?" af-composer-thread-dialog-status--running":""),role:"status","aria-live":"polite",title:Pc||void 0,children:xn&&!Pc?e("flow:composer.executing"):Pc||e("flow:composer.ready")})]}),a.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>Jd(!1),"aria-label":e("flow:composer.collapseAriaLabel"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),e0.length>1&&!(lt&&Array.isArray(lt.phases)&<.phases.length>1)?a.jsx("div",{className:"af-composer-steps-track-wrap",children:a.jsx(nV,{steps:e0})}):null,lt&&Array.isArray(lt.phases)&<.phases.length>1?a.jsx("div",{className:"af-composer-phase-bar","aria-label":e("flow:composer.phaseProgress"),children:lt.phases.map((y,N)=>{const M=y.status||(N<(lt.currentPhase??0)?"done":N===(lt.currentPhase??0)?xn?"running":lt.nextPhase||lt.isLastPhase?"done":"running":"pending");return a.jsxs("div",{className:"af-composer-phase-item"+(M==="done"?" af-composer-phase-item--done":"")+(M==="running"?" af-composer-phase-item--running":"")+(M==="pending"?" af-composer-phase-item--pending":""),title:`${y.label}${y.description?":"+y.description:""}`,children:[a.jsx("span",{className:"af-composer-phase-dot","aria-hidden":!0,children:M==="done"?a.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"0.85rem"},children:"check"}):a.jsx("span",{children:N+1})}),a.jsx("span",{className:"af-composer-phase-label",children:y.label})]},y.name||N)})}):null,a.jsx("div",{className:"af-composer-thread-dialog-scroll",children:a.jsx(NN,{thread:Ic,liveSegments:Ac,running:xn})}),lt&&!lt.isLastPhase&<.nextPhase&&!xn?a.jsxs("div",{className:"af-composer-phase-review af-composer-phase-review--minimal","aria-label":e("flow:composer.phaseReviewLabel"),children:[a.jsx("span",{className:"af-composer-phase-auto-hint",children:e("flow:composer.phaseReviewHint",{nextPhase:lt.nextPhase.label})}),a.jsxs("div",{className:"af-composer-phase-review-buttons",children:[a.jsx("button",{type:"button",className:"af-composer-phase-btn af-composer-phase-btn--continue",onClick:N0,children:e("flow:composer.phaseReviewContinue",{label:lt.nextPhase.label})}),a.jsx("button",{type:"button",className:"af-composer-phase-btn af-composer-phase-btn--skip",onClick:S0,children:e("flow:composer.phaseReviewSkip")})]})]}):null]})}),document.body):null]})}):null}),Rr&&Ce==="edit"?(()=>{var z;const y=String(Rr.query||"").trim().toLowerCase(),N=y?Rr.candidates.filter(H=>{var Y,Q,ee;return[(Y=H.def)==null?void 0:Y.id,H.displayLabel,H.description,(Q=H.slot)==null?void 0:Q.name,(ee=H.slot)==null?void 0:ee.type].filter(Boolean).some(he=>String(he).toLowerCase().includes(y))}):Rr.candidates,M=Rr.draft.handleType==="source"?"IN":"OUT";return a.jsxs("div",{className:"af-connect-node-menu",style:{left:Rr.left,top:Rr.top},role:"dialog","aria-label":"选择匹配节点",children:[a.jsxs("div",{className:"af-connect-node-menu__head",children:[a.jsxs("div",{className:"af-connect-node-menu__title",children:[a.jsx("span",{className:"af-connect-node-menu__dot",style:{background:In((z=Rr.draft.slot)==null?void 0:z.type)},"aria-hidden":!0}),a.jsxs("span",{children:["匹配 ",Rr.draft.slotType," 节点"]})]}),a.jsx("button",{type:"button",className:"af-connect-node-menu__close","aria-label":"关闭",onClick:()=>fo(null),children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),a.jsxs("label",{className:"af-connect-node-menu__search",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),a.jsx("input",{type:"search",value:Rr.query,onChange:H=>fo(Y=>Y&&{...Y,query:H.target.value}),placeholder:"搜索节点",autoFocus:!0})]}),a.jsxs("div",{className:"af-connect-node-menu__list",children:[N.map(H=>{var ee,he;const Y=H.displayLabel||((ee=H.def)==null?void 0:ee.id),Q=Kg(H.slot,H.slotIndex);return a.jsxs("button",{type:"button",className:"af-connect-node-menu__item",onClick:()=>cT(H),title:H.description||H.def.id,children:[a.jsxs("span",{className:"af-connect-node-menu__item-main",children:[a.jsx("span",{className:"af-connect-node-menu__item-label",children:Y}),Y!==H.def.id?a.jsx("span",{className:"af-connect-node-menu__item-id",children:H.def.id}):null]}),a.jsxs("span",{className:"af-connect-node-menu__port",children:[a.jsx("span",{children:M}),a.jsx("span",{className:"af-connect-node-menu__port-dot",style:{background:In((he=H.slot)==null?void 0:he.type)},"aria-hidden":!0}),a.jsx("span",{className:"af-connect-node-menu__port-name",children:Q})]})]},`${H.def.id}-${H.slotIndex}`)}),N.length===0?a.jsx("div",{className:"af-connect-node-menu__empty",children:"没有匹配结果"}):null]})]})})():null]}):a.jsx("div",{className:"af-placeholder af-pipeline-placeholder",children:e("flow:pipeline.selectPipeline")})})]}),Ce!=="edit"&&Sr&&a.jsxs("div",{className:"af-run-console",style:{height:ft},children:[a.jsx("div",{className:"af-run-console__resize",role:"separator","aria-orientation":"horizontal","aria-label":e("flow:run.resizeConsole"),onPointerDown:mT,onPointerMove:gT,onPointerUp:x0,onPointerCancel:x0,onLostPointerCapture:yT}),a.jsxs("div",{className:"af-run-console__head",children:[a.jsxs("span",{className:"af-run-console__title",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"terminal"}),"EXECUTION CONSOLE"]}),a.jsxs("div",{className:"af-run-console__head-right",children:[Ce==="running"&&a.jsx("span",{className:"af-run-console__live-badge",children:"LIVE"}),a.jsx("button",{type:"button",className:"af-icon-btn af-run-console__close",onClick:()=>Qr(!1),"aria-label":e("flow:run.closeLog"),children:a.jsx("span",{className:"material-symbols-outlined",children:"expand_more"})})]})]}),a.jsxs("div",{className:"af-run-console__body",children:[vr.map((y,N)=>a.jsxs("div",{className:"af-run-console__line"+(y.type==="error"?" af-run-console__line--error":"")+(y.type==="warn"?" af-run-console__line--warn":"")+(y.type==="node-start"?" af-run-console__line--start":"")+(y.type==="node-done"?" af-run-console__line--done":"")+(y.type==="node-failed"?" af-run-console__line--error":"")+(y.type==="done"?" af-run-console__line--done":""),children:[a.jsxs("span",{className:"af-run-console__ts",children:["[",y.ts?new Date(y.ts).toLocaleTimeString():"--:--:--","]"]}),a.jsx("span",{className:"af-run-console__text",children:y.text!=null?String(y.text):""})]},N)),a.jsx("div",{ref:Qa})]})]})]}),Ce!=="edit"&&Ei&&u?a.jsx(TW,{instanceId:Ei,flowId:u.id,runId:nt,nodeStatus:((E0=Xr[Ei])==null?void 0:E0.status)??null,onClose:()=>_i(null)}):null,dt&&dt!=="settings"&&u&&Ce==="edit"?a.jsx("aside",{className:"af-pipeline-drawer"+(dt==="node"?" af-pipeline-drawer--wide":"")+(dt==="composer"?" af-pipeline-drawer--wide":""),"aria-label":dt==="settings"?e("flow:settings.title"):dt==="history"?e("flow:history.title"):dt==="composer"?"AI Composer":e("flow:nodeProps.title"),children:dt==="composer"?a.jsxs("div",{className:"af-composer-sidebar",children:[a.jsxs("div",{className:"af-pipeline-drawer-head",children:[a.jsx("h2",{className:"af-pipeline-drawer-title",children:"AI Composer"}),a.jsx("button",{type:"button",className:"af-pipeline-drawer-close af-icon-btn",onClick:Fc,"aria-label":e("flow:composer.closeSidebar"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),Ri.length>0&&a.jsxs("div",{className:"af-composer-session-tabs",children:[Ri.map(y=>a.jsxs("button",{type:"button",ref:N=>{N&&y.id===ur&&N.scrollIntoView({block:"nearest",inline:"nearest"})},className:["af-composer-session-tab",y.id===ur?"af-composer-session-tab--active":"",y.running?"af-composer-session-tab--running":""].filter(Boolean).join(" "),onClick:()=>l0(y.id),title:y.label,children:[a.jsx("span",{className:"af-composer-session-label",children:y.label}),a.jsx("span",{className:"af-composer-session-close",role:"button",tabIndex:0,onClick:N=>{N.stopPropagation(),i0(y.id)},onKeyDown:N=>{N.key!=="Enter"&&N.key!==" "||(N.preventDefault(),N.stopPropagation(),i0(y.id))},title:y.running?e("flow:composer.endConversation"):e("flow:composer.closeConversation"),children:a.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"0.75rem"},children:"close"})})]},y.id)),a.jsx("button",{type:"button",className:"af-composer-session-add",onClick:()=>r0(),title:e("flow:composer.newConversation"),children:a.jsx("span",{className:"material-symbols-outlined",children:"add"})})]}),a.jsx("div",{className:"af-composer-sidebar-status"+(xn?" af-composer-sidebar-status--running":""),role:"status","aria-live":"polite",children:xn&&!Pc?e("flow:composer.executing"):Pc||e("flow:composer.ready")}),lt&&Array.isArray(lt.phases)&<.phases.length>1?a.jsx("div",{className:"af-composer-phase-bar","aria-label":e("flow:composer.phaseProgress"),children:lt.phases.map((y,N)=>{const M=y.status||(N<(lt.currentPhase??0)?"done":N===(lt.currentPhase??0)?xn?"running":lt.isLastPhase&&N===lt.phases.length-1||lt.nextPhase?"done":"running":"pending");return a.jsxs("div",{className:"af-composer-phase-item"+(M==="done"?" af-composer-phase-item--done":"")+(M==="running"?" af-composer-phase-item--running":"")+(M==="pending"?" af-composer-phase-item--pending":""),title:`${y.label}${y.description?":"+y.description:""}`,children:[a.jsx("span",{className:"af-composer-phase-dot","aria-hidden":!0,children:M==="done"?a.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"0.85rem"},children:"check"}):a.jsx("span",{children:N+1})}),a.jsx("span",{className:"af-composer-phase-label",children:y.label})]},y.name||N)})}):null,a.jsx("div",{className:"af-composer-sidebar-thread",ref:n0,children:a.jsx(NN,{thread:Ic,liveSegments:Ac,running:xn})}),lt&&!lt.isLastPhase&<.nextPhase&&!xn?a.jsxs("div",{className:"af-composer-phase-review af-composer-phase-review--minimal","aria-label":e("flow:composer.phaseReviewLabel"),children:[a.jsx("span",{className:"af-composer-phase-auto-hint",children:e("flow:composer.phaseReviewHint",{nextPhase:lt.nextPhase.label})}),a.jsxs("div",{className:"af-composer-phase-review-buttons",children:[a.jsx("button",{type:"button",className:"af-composer-phase-btn af-composer-phase-btn--continue",onClick:N0,children:e("flow:composer.phaseReviewContinue",{label:lt.nextPhase.label})}),a.jsx("button",{type:"button",className:"af-composer-phase-btn af-composer-phase-btn--skip",onClick:S0,children:e("flow:composer.phaseReviewSkip")})]})]}):null]}):dt==="node"&&Ze?De?a.jsx($A,{draft:De,setDraft:Kt,definitionId:String(((_0=Ze.data)==null?void 0:_0.definitionId)??Ze.id),systemPromptReadonly:String((Am==null?void 0:Am.description)??""),modelLists:ke,disabled:!u,onIdBlur:hT,onClose:Fc,onPublishToMarketplace:XI,error:Oe,ioSlots:{inputs:Array.isArray(De==null?void 0:De.inputs)?De.inputs:[],outputs:Array.isArray(De==null?void 0:De.outputs)?De.outputs:[]}}):a.jsx("div",{className:"af-pipeline-drawer-body",children:a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:pipeline.loadingProps")})}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"af-pipeline-drawer-head",children:[a.jsx("h2",{className:"af-pipeline-drawer-title",children:e(dt==="settings"?"flow:settings.title":"flow:history.title")}),a.jsx("button",{type:"button",className:"af-pipeline-drawer-close af-icon-btn",onClick:Fc,"aria-label":e("flow:composer.closeSidebar"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsx("div",{className:"af-pipeline-drawer-body",children:dt==="settings"?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.pipelineId")}),(u.source==="user"||u.source==="workspace")&&!u.archived?a.jsxs("div",{className:"af-pipeline-rename-row",children:[a.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:$,onChange:y=>{I(y.target.value),q("")},onKeyDown:y=>{y.key==="Enter"&&(y.preventDefault(),df())},onBlur:()=>{$.trim()&&$.trim()!==u.id&&df()},placeholder:u.id,disabled:F,spellCheck:!1}),a.jsx("span",{className:"af-pipeline-drawer-badge",children:pl(u.source??"user",e)})]}):a.jsxs("div",{className:"af-pipeline-drawer-readonly",children:[u.id,a.jsx("span",{className:"af-pipeline-drawer-badge",children:pl(u.source??"user",e)}),u.archived?a.jsx("span",{className:"af-pipeline-drawer-badge af-pipeline-drawer-badge--muted",children:e("flow:settings.archived")}):null]}),T?a.jsx("p",{className:"af-err af-pipeline-drawer-err",children:T}):null]}),typeof u.path=="string"&&u.path?a.jsxs("div",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.diskPath")}),a.jsxs("div",{className:"af-pipeline-drawer-readonly af-pipeline-drawer-readonly--mono af-pipeline-path-row",children:[a.jsx("span",{className:"af-pipeline-path-text",children:u.path}),a.jsx("button",{type:"button",className:"af-icon-btn af-pipeline-copy-btn",onClick:()=>g0(u.path),title:e("flow:settings.copyPath"),children:a.jsx("span",{className:"material-symbols-outlined",children:D?"check":"content_copy"})})]})]}):null,u.source==="user"||u.source==="workspace"?u.archived?a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.archivedNote")}):a.jsxs("div",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.storageLocation")}),a.jsx("div",{className:"af-pipeline-move-actions",children:u.source==="user"?a.jsx("button",{type:"button",className:"af-btn-secondary",disabled:j,onClick:()=>uf("workspace"),children:e(j?"flow:settings.moveBusy":"flow:settings.moveToWorkspace")}):a.jsx("button",{type:"button",className:"af-btn-secondary",disabled:j,onClick:()=>uf("user"),children:e(j?"flow:settings.moveBusy":"flow:settings.moveToUserDir")})}),k?a.jsx("p",{className:"af-err af-pipeline-drawer-err",children:k}):null]}):a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.builtinNote")}),a.jsxs("label",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.introduction")}),a.jsx("textarea",{className:"af-pipeline-drawer-textarea",value:g,onChange:y=>b(y.target.value),placeholder:e("flow:pipeline.introductionPlaceholder"),rows:5,spellCheck:!1})]}),a.jsxs("div",{className:"af-pipeline-meta-card",children:[a.jsx("h3",{className:"af-pipeline-meta-title",children:e("flow:schedule.title")}),Bd?a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("common:common.loading")}):a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"af-new-pipeline-radio",children:[a.jsx("input",{type:"checkbox",checked:!!cn.enabled,disabled:Zr||u.archived||u.source==="builtin",onChange:y=>po(N=>({...N,enabled:y.target.checked}))}),a.jsx("span",{children:e("flow:schedule.enabled")})]}),a.jsxs("label",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.cron")}),a.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:cn.cron||"",disabled:Zr||u.archived||u.source==="builtin",onChange:y=>po(N=>({...N,cron:y.target.value})),placeholder:"0 9 * * *",spellCheck:!1})]}),a.jsxs("label",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.timezone")}),a.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:cn.timezone||"",disabled:Zr||u.archived||u.source==="builtin",onChange:y=>po(N=>({...N,timezone:y.target.value})),placeholder:"Asia/Shanghai",spellCheck:!1})]}),a.jsxs("label",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.preset")}),a.jsxs("select",{className:"af-pipeline-flow-select",value:cn.preset||"",disabled:Zr||u.archived||u.source==="builtin",onChange:y=>po(N=>({...N,preset:y.target.value})),children:[a.jsx("option",{value:"",children:e("flow:schedule.defaultPreset")}),Object.keys(rt).map(y=>a.jsx("option",{value:y,children:y},y))]})]}),a.jsx("div",{className:"af-pipeline-drawer-readonly",children:a.jsx("span",{children:e("flow:schedule.overlapSkip")})}),cn.nextRunAt?a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.nextRun",{time:new Date(cn.nextRunAt).toLocaleString()})}):a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.noNextRun")}),a.jsxs("dl",{className:"af-pipeline-meta-dl",children:[a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:schedule.runtime")}),a.jsx("dd",{children:Jt!=null&&Jt.running?e("flow:schedule.running"):cn.enabled?e("flow:schedule.waiting"):e("flow:schedule.disabled")})]}),St.lastTriggeredAt?a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:schedule.lastTriggeredAt")}),a.jsx("dd",{children:new Date(St.lastTriggeredAt).toLocaleString()})]}):null,St.lastSkippedAt?a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:schedule.lastSkippedAt")}),a.jsxs("dd",{children:[new Date(St.lastSkippedAt).toLocaleString(),St.lastSkipReason?` · ${St.lastSkipReason}`:""]})]}):null,St.lastRunUuid?a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:schedule.lastRun")}),a.jsx("dd",{children:St.lastRunUuid})]}):null,St.lastExitCode!=null?a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:schedule.lastExit")}),a.jsx("dd",{children:String(St.lastExitCode)})]}):null,St.lastFinishedAt?a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:schedule.lastFinishedAt")}),a.jsx("dd",{children:new Date(St.lastFinishedAt).toLocaleString()})]}):null]}),Jt!=null&&Jt.lastError||St.lastError?a.jsx("p",{className:"af-err af-pipeline-drawer-err",children:(Jt==null?void 0:Jt.lastError)||St.lastError}):null,u.archived||u.source==="builtin"?a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.readonlyNote")}):null,yn?a.jsx("p",{className:"af-err af-pipeline-drawer-err",children:yn}):null,Ga?a.jsx("p",{className:"af-pipeline-drawer-muted",children:Ga}):null,a.jsx("button",{type:"button",className:"af-btn-secondary",disabled:Zr||u.archived||u.source==="builtin",onClick:Rm,children:e(Zr?"flow:schedule.saving":"flow:schedule.save")})]})]}),a.jsxs("div",{className:"af-pipeline-meta-card",children:[a.jsx("h3",{className:"af-pipeline-meta-title",children:e("flow:pipeline.metadata")}),a.jsx("dl",{className:"af-pipeline-meta-dl",children:a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:pipeline.nodeCount")}),a.jsxs("dd",{children:[bt.length," ",e("flow:pipeline.nodesUnit")]})]})})]}),a.jsx("button",{type:"button",className:"af-pipeline-drawer-link",onClick:()=>n("/settings"),children:e("flow:settings.globalSettings")})]}):a.jsxs(a.Fragment,{children:[a.jsxs("p",{className:"af-pipeline-drawer-lead",children:[e("flow:settings.currentPipeline"),a.jsx("strong",{children:u.id})]}),lr?a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("common:common.loading")}):wr?a.jsx("p",{className:"af-err af-pipeline-drawer-err",children:wr}):Mc.length===0?a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:pipeline.noRuns")}):a.jsxs(a.Fragment,{children:[Cr.success+Cr.failed+Cr.running+Cr.stopped+Cr.interrupted>0?a.jsxs("div",{className:"af-exec-history-summary","aria-label":e("flow:history.summary"),children:[Cr.success>0?a.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--success",children:e("flow:history.successCount",{count:Cr.success})}):null,Cr.failed>0?a.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--failed",children:e("flow:history.failedCount",{count:Cr.failed})}):null,Cr.stopped>0?a.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--stopped",children:e("flow:history.stoppedCount",{count:Cr.stopped})}):null,Cr.interrupted>0?a.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--interrupted",children:e("flow:history.interruptedCount",{count:Cr.interrupted})}):null,Cr.running>0?a.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--running",children:e("flow:history.runningCount",{count:Cr.running})}):null]}):null,a.jsx("ul",{className:"af-exec-history-list",children:Mc.map((y,N)=>{const M=y.status||"unknown",z=M==="success"?"af-exec-history-card--success":M==="failed"?"af-exec-history-card--failed":M==="stopped"?"af-exec-history-card--stopped":M==="interrupted"?"af-exec-history-card--interrupted":M==="running"?"af-exec-history-card--running":"af-exec-history-card--unknown",H=e(M==="success"?"flow:history.success":M==="failed"?"flow:history.failed":M==="stopped"?"flow:history.stopped":M==="interrupted"?"flow:history.interrupted":M==="running"?"flow:history.running":"flow:history.unknown"),Y=M==="success"?"check_circle":M==="failed"?"error":M==="stopped"?"stop_circle":M==="interrupted"?"sync_disabled":M==="running"?"progress_activity":"help",Q=y.runId||`${y.at}-${N}`,ee=y.runId!=null&&y.runId.length>=6?e("flow:history.runLabel",{id:y.runId.length>8?y.runId.slice(-8):y.runId}):e("flow:history.runLabel",{id:Mc.length-N});return a.jsx("li",{className:"af-exec-history-list-item",children:a.jsxs("button",{type:"button",className:`af-exec-history-card ${z}`,onClick:()=>NT(y),title:e("flow:history.enterRunView"),children:[a.jsxs("div",{className:"af-exec-history-card-top",children:[a.jsx("span",{className:"af-exec-history-card-title",children:ee}),a.jsx("span",{className:"af-exec-history-card-time",children:rx(y.at,e)})]}),a.jsxs("div",{className:"af-exec-history-card-bottom",children:[a.jsxs("span",{className:"af-exec-history-card-status",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:Y}),H]}),a.jsxs("span",{className:"af-exec-history-card-duration",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"timer"}),TL(y.durationMs,e)]})]})]})},`${u.id}-${Q}`)})})]})]})})]})}):null]}),a.jsx(iN,{open:xT,title:e("flow:run.pauseTitle",{defaultValue:"暂停运行"}),message:e("flow:run.pauseConfirm"),confirmLabel:e("flow:run.pauseConfirmOk",{defaultValue:"暂停"}),onConfirm:vT,onCancel:()=>Mm(!1)}),a.jsx(iN,{open:bT,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:ST,onSecondary:kT,onCancel:()=>hf(!1)}),a.jsx(TA,{open:Ne,onClose:()=>$e(!1)}),IT(),a.jsx(yW,{open:qe,onClose:()=>Lt(!1),onJump:lT,nodes:bt}),a.jsx(HW,{open:Ie,onClose:()=>He(!1),flowId:(u==null?void 0:u.id)??""}),a.jsx(pW,{open:O,onClose:()=>U(!1),flowId:(u==null?void 0:u.id)??"",flowSource:(u==null?void 0:u.source)??"user",onArchived:async()=>{U(!1),await sf(),n("/projects?tab=archived")}}),a.jsx(hW,{open:P&&!!(u!=null&&u.id),onClose:()=>R(!1),flowId:(u==null?void 0:u.id)??"",flowSource:(u==null?void 0:u.source)??"user",flowArchived:!!(u!=null&&u.archived),onDeleted:async()=>{R(!1),f(null),pt([]),en([]),Rc(null),await sf(),n("/projects")}}),Wt&&Dr.createPortal(a.jsx("div",{className:"af-flow-snippet-modal-overlay",children:a.jsxs("div",{className:"af-flow-snippet-modal",role:"dialog","aria-modal":"true","aria-label":"发布流程片段",children:[a.jsxs("div",{className:"af-flow-snippet-modal__head",children:[a.jsxs("span",{className:"af-flow-snippet-modal__title",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"ios_share"}),"发布流程片段"]}),a.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>mn(!1),"aria-label":e("common:common.close"),children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),a.jsxs("div",{className:"af-flow-snippet-modal__body",children:[a.jsxs("label",{className:"af-flow-snippet-field",children:[a.jsx("span",{children:"名称"}),a.jsx("input",{type:"text",value:on.name,onChange:y=>{const N=y.target.value;bn(M=>({...M,name:N,id:M.id?M.id:N.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")}))},placeholder:"例如:PR 检查片段",autoFocus:!0})]}),a.jsxs("label",{className:"af-flow-snippet-field",children:[a.jsx("span",{children:"ID"}),a.jsx("input",{type:"text",value:on.id,onChange:y=>bn(N=>({...N,id:y.target.value})),placeholder:"pr-check-snippet"})]}),a.jsxs("label",{className:"af-flow-snippet-field",children:[a.jsx("span",{children:"说明"}),a.jsx("textarea",{value:on.description,onChange:y=>bn(N=>({...N,description:y.target.value})),placeholder:"这段流程适合什么场景、需要接哪些上下游。",rows:4})]}),a.jsxs("div",{className:"af-flow-snippet-summary",children:["将发布 ",tr.length," 个节点和 ",mf.length," 条内部连线。"]}),oe?a.jsx("div",{className:"af-flow-snippet-error",children:oe}):null]}),a.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[a.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>mn(!1),children:"取消"}),a.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:xr||!on.name.trim(),onClick:()=>void CT(),children:xr?"发布中…":"发布"})]})]})}),document.body),a.jsx(xW,{open:!!C,onClose:()=>G(null),flowId:(u==null?void 0:u.id)??"",flowSource:(u==null?void 0:u.source)??"user",flowArchived:!!(u!=null&&u.archived),filePath:(C==null?void 0:C.filePath)??"",fileName:(C==null?void 0:C.fileName)??"",onSaved:()=>{_t(y=>({...y}))}})]}),un&&Ce!=="edit"&&Dr.createPortal(a.jsx("div",{className:"af-user-check-modal-overlay",children:a.jsxs("div",{className:"af-user-check-modal",role:"dialog","aria-modal":"true",children:[a.jsxs("div",{className:"af-user-check-modal__head",children:[a.jsxs("span",{className:"af-user-check-modal__title",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"fact_check"}),e("flow:userCheck.title",{instanceId:un.instanceId})]}),a.jsx("div",{className:"af-user-check-modal__actions",children:Ud?a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:"af-user-check-modal__btn af-user-check-modal__btn--save",onClick:async()=>{if(!un||!u||!nt)return;const y=Nr||un.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:nt,instanceId:un.instanceId,content:y})})).ok?(Os(M=>M&&{...M,content:y}),sa(!1),at(M=>[...M,{ts:new Date().toISOString(),type:"info",text:e("flow:userCheck.contentSaved")}])):at(M=>[...M,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}catch{at(N=>[...N,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}},children:[a.jsx("span",{className:"material-symbols-outlined",children:"save"}),e("flow:userCheck.save")]}),a.jsxs("button",{type:"button",className:"af-user-check-modal__btn",onClick:()=>{Za(un.content),sa(!1)},children:[a.jsx("span",{className:"material-symbols-outlined",children:"close"}),e("flow:userCheck.cancel")]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:"af-user-check-modal__btn",onClick:()=>sa(!0),children:[a.jsx("span",{className:"material-symbols-outlined",children:"edit"}),e("flow:userCheck.edit")]}),a.jsx("button",{type:"button",className:"af-user-check-modal__btn",onClick:()=>Os(null),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]})})]}),a.jsx("div",{className:"af-user-check-modal__body",children:Ud?a.jsx("textarea",{ref:vm,className:"af-user-check-modal__textarea",value:Nr||un.content,onChange:y=>Za(y.target.value)}):a.jsx("div",{className:"af-user-check-modal__preview",children:a.jsx("pre",{children:Nr||un.content})})}),a.jsxs("div",{className:"af-user-check-modal__ai-bar",children:[a.jsx("input",{type:"text",className:"af-user-check-modal__ai-input",placeholder:e("flow:userCheck.aiEditPlaceholder"),value:el,onChange:y=>tl(y.target.value),disabled:nl}),a.jsxs("button",{type:"button",className:"af-user-check-modal__btn af-user-check-modal__btn--ai",disabled:nl||!el.trim(),onClick:()=>{!un||!u||!nt||!el.trim()||(oa(!0),at(y=>[...y,{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:nt,instanceId:un.instanceId,content:Nr||un.content,prompt:el})}).then(y=>y.json()).then(y=>{oa(!1),y.ok&&y.content?(Za(y.content),sa(!0),tl(""),at(N=>[...N,{ts:new Date().toISOString(),type:"info",text:e("flow:userCheck.aiEditDone")}])):at(N=>[...N,{ts:new Date().toISOString(),type:"error",text:y.error||e("flow:userCheck.aiEditFailed")}])}).catch(()=>{oa(!1),at(y=>[...y,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.aiEditFailed")}])}))},children:[nl?a.jsx("span",{className:"material-symbols-outlined af-spin",children:"sync"}):a.jsx("span",{className:"material-symbols-outlined",children:"auto_fix_high"}),e("flow:userCheck.aiEditBtn")]})]}),a.jsxs("div",{className:"af-user-check-modal__foot",children:[a.jsx("span",{className:"af-user-check-modal__hint",children:e("flow:userCheck.hint")}),a.jsxs("button",{type:"button",className:"af-user-check-modal__btn af-user-check-modal__btn--continue",onClick:async()=>{if(!un||!u||!nt)return;const y=Nr||un.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:nt,instanceId:un.instanceId,content:y})})).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:nt,instanceId:un.instanceId,execId:un.execId})}),Os(null),tl(""),us({runUuid:nt})):at(M=>[...M,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}catch{at(N=>[...N,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}},children:[a.jsx("span",{className:"material-symbols-outlined",children:"play_arrow"}),e("flow:userCheck.continue")]})]})]})}),document.body),Ti&&Ce!=="edit"&&Dr.createPortal(a.jsx("div",{className:"af-user-ask-modal-overlay",children:a.jsxs("div",{className:"af-user-ask-modal",role:"dialog","aria-modal":"true",children:[a.jsxs("div",{className:"af-user-ask-modal__head",children:[a.jsxs("span",{className:"af-user-ask-modal__title",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"help"}),e("flow:userAsk.title",{instanceId:Ti.instanceId})]}),a.jsx("div",{className:"af-user-ask-modal__actions",children:a.jsx("button",{type:"button",className:"af-user-ask-modal__btn",onClick:()=>jc(null),"aria-label":e("flow:userAsk.close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})})]}),a.jsxs("div",{className:"af-user-ask-modal__body",children:[Ti.question.trim()?a.jsx("div",{className:"af-user-ask-modal__question",children:a.jsx("pre",{children:Ti.question})}):null,Ti.options.length===0?a.jsx("div",{className:"af-user-ask-modal__empty",children:e("flow:userAsk.noOptions")}):a.jsx("div",{className:"af-user-ask-modal__options",children:Ti.options.map(y=>a.jsxs("button",{type:"button",className:"af-user-ask-option",disabled:aa,onClick:async()=>{if(!(!Ti||!u||!nt)){la(!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:nt,instanceId:Ti.instanceId,execId:Ti.execId,branch:y.name,selectedIndex:y.index,selectedLabel:y.label})})).ok?(jc(null),la(!1),us({runUuid:nt})):(la(!1),at(M=>[...M,{ts:new Date().toISOString(),type:"error",text:e("flow:userAsk.submitFailed")}]))}catch{la(!1),at(N=>[...N,{ts:new Date().toISOString(),type:"error",text:e("flow:userAsk.submitFailed")}])}}},children:[a.jsxs("span",{className:"af-user-ask-option__index",children:["[",y.index,"]"]}),a.jsx("span",{className:"af-user-ask-option__label",children:y.label})]},y.name))})]}),a.jsx("div",{className:"af-user-ask-modal__foot",children:a.jsx("span",{className:"af-user-ask-modal__hint",children:e(aa?"flow:userAsk.submitting":"flow:userAsk.hint")})})]})}),document.body),Cc&&Ce!=="edit"&&a.jsxs("div",{className:"af-tool-print-toast"+(ca?" af-tool-print-toast--expanded":""),role:"status","aria-live":"polite",children:[a.jsxs("div",{className:"af-tool-print-toast__head",children:[a.jsx("span",{className:"material-symbols-outlined",children:"print"}),a.jsx("span",{className:"af-tool-print-toast__title",children:e("flow:toolPrint.title",{instanceId:Cc.instanceId})}),a.jsx("button",{type:"button",className:"af-tool-print-toast__close",onClick:()=>Ec(y=>!y),"aria-label":e(ca?"flow:toolPrint.restore":"flow:toolPrint.expand"),title:e(ca?"flow:toolPrint.restore":"flow:toolPrint.expand"),children:a.jsx("span",{className:"material-symbols-outlined",children:ca?"close_fullscreen":"open_in_full"})}),a.jsx("button",{type:"button",className:"af-tool-print-toast__close",onClick:()=>Wd(null),"aria-label":e("common:close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsx("div",{className:"af-tool-print-toast__body",children:a.jsx("div",{className:"af-tool-print-toast__markdown",children:a.jsx(Ld,{children:Cc.content})})})]}),oo&&a.jsx("div",{className:"af-provide-edit-overlay",children:a.jsxs("div",{className:"af-provide-edit-modal",role:"dialog","aria-modal":"true",children:[a.jsxs("div",{className:"af-provide-edit-modal__head",children:[a.jsx("span",{className:"material-symbols-outlined",children:"edit_document"}),a.jsx("span",{className:"af-provide-edit-modal__title",children:oo.label}),a.jsx("button",{type:"button",className:"af-provide-edit-modal__close",onClick:()=>ua(null),"aria-label":e("common:close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsx("div",{className:"af-provide-edit-modal__body",children:a.jsx("textarea",{ref:rl,className:"af-provide-edit-modal__textarea",defaultValue:oo.content,autoFocus:!0})}),a.jsxs("div",{className:"af-provide-edit-modal__foot",children:[a.jsxs("button",{type:"button",className:"af-provide-edit-modal__btn af-provide-edit-modal__btn--save",onClick:KI,children:[a.jsx("span",{className:"material-symbols-outlined",children:"save"}),e("flow:provideEdit.save")]}),a.jsxs("button",{type:"button",className:"af-provide-edit-modal__btn",onClick:()=>ua(null),children:[a.jsx("span",{className:"material-symbols-outlined",children:"close"}),e("flow:provideEdit.cancel")]})]})]})}),qa&&a.jsx("div",{className:"af-run-params-overlay",children:a.jsxs("div",{className:"af-run-params-modal",role:"dialog","aria-modal":"true",children:[a.jsxs("div",{className:"af-run-params-modal__head",children:[a.jsx("span",{className:"material-symbols-outlined",children:"edit_note"}),a.jsx("span",{className:"af-run-params-modal__title",children:e("flow:runParams.title")}),a.jsx("button",{type:"button",className:"af-run-params-modal__close",onClick:()=>Is(!1),"aria-label":e("common:close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsx("div",{className:"af-run-params-modal__body",children:Li.length===0?a.jsx("div",{className:"af-run-params-empty",children:e("flow:runParams.noParams")}):a.jsx("div",{className:"af-run-params-list",children:Li.map(y=>{var he,je;const N=il[y.id];if(!N)return null;const M=((he=y.data)==null?void 0:he.definitionId)||"",z=M.startsWith("provide_file"),H=M==="provide_bool",Y=((je=y.data)==null?void 0:je.label)||y.id,Q=Ts[N]??"",ee=["true","1","yes","on"].includes(String(Q).trim().toLowerCase());return a.jsxs("div",{className:"af-run-params-item",children:[a.jsxs("div",{className:"af-run-params-item__head",children:[a.jsx("span",{className:"af-run-params-item__icon material-symbols-outlined"+(z?" af-run-params-item__icon--file":""),children:z?"description":H?"toggle_on":"text_fields"}),a.jsx("span",{className:"af-run-params-item__label",children:Y}),a.jsx("span",{className:"af-run-params-item__slot",children:N})]}),H?a.jsx("button",{type:"button",className:"af-run-config-bool-toggle"+(ee?" af-run-config-bool-toggle--true":""),onClick:()=>Rs(Te=>({...Te,[N]:ee?"false":"true"})),"aria-pressed":ee,children:ee?"true":"false"}):a.jsx("input",{type:"text",className:"af-run-params-item__input",value:Q,onChange:Te=>Rs(ie=>({...ie,[N]:Te.target.value})),placeholder:e(z?"flow:runConfig.filePathPlaceholder":"flow:runConfig.stringValuePlaceholder")})]},y.id)})})}),a.jsxs("div",{className:"af-run-params-modal__foot",children:[a.jsxs("button",{type:"button",className:"af-run-params-modal__btn af-run-params-modal__btn--run",onClick:()=>{var N;const y={};for(const M of Li){const z=il[M.id];if(!z)continue;const H=((N=M.data)==null?void 0:N.definitionId)||"",Y=Ts[z]??"";H.startsWith("provide_file")?y[z]={type:"file",path:Y}:y[z]={type:"str",value:Y}}Is(!1),Ai(!1),us({cliInputsOverride:y})},children:[a.jsx("span",{className:"material-symbols-outlined",children:"play_arrow"}),e("flow:runParams.run")]}),a.jsxs("button",{type:"button",className:"af-run-params-modal__btn",onClick:()=>Is(!1),children:[a.jsx("span",{className:"material-symbols-outlined",children:"close"}),e("flow:runParams.cancel")]})]})]})})]})]})}const wV="af:workspace-graph:v2",yl=["DISPLAY","CONTROL","TOOL","PROVIDE","AGENT"],vV=new Set(["control_start","control_end","control_load_skills"]),bV={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:""}]},kV={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:""}],outputs:[{type:"node",name:"next",default:""},{type:"text",name:"skillsContext",default:""}]},SV="0.1.34";function NV(){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 tp(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 jV(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:workspace-composer:${t}:${n}${e!=null&&e.archived?":archived":""}`}function CV(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 EV(e){return!e||typeof e.closest!="function"?!1:!!e.closest("input, textarea, select, [contenteditable='true']")}function AN(e){return(Array.isArray(e)?e:[]).filter(t=>t&&(t.role==="user"||t.role==="assistant")&&typeof t.text=="string").map(t=>({role:t.role,text:t.text,...t.error?{error:!0}:{},...typeof t.at=="number"?{at:t.at}:{}})).slice(-80)}function KA(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 mu(e){const t=String((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 IN(e){return e==="DISPLAY"?"preview":e==="CONTROL"?"account_tree":e==="TOOL"?"build":e==="PROVIDE"?"database":"smart_toy"}function Rv(e){return String((e==null?void 0:e.displayName)||(e==null?void 0:e.label)||(e==null?void 0:e.id)||"Node")}function gu(e){return Rv(e)}function Bx(e){return String((e==null?void 0:e.description)||(e==null?void 0:e.body)||"").replace(/\s+/g," ").trim()}function Gg(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 TN(e,t,n){const r=String((t==null?void 0:t.name)||(t==null?void 0:t.id)||`#${n+1}`).trim(),i=String((t==null?void 0:t.type)||"").trim(),s=String((t==null?void 0:t.default)??(t==null?void 0:t.value)??"").trim();return[e,r,i?`type: ${i}`:"",s?`default: ${s}`:""].filter(Boolean).join(" · ")}function RN(e,t){const n=Array.isArray(e)?e:[],r=n.slice(0,4),i=Math.max(0,n.length-r.length);return{list:n,shown:r,hidden:i,kind:t}}function LN(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 i=new Map(t.map(l=>[l.id,l])),s=fc(i.get(n),e.sourceHandle||"output-0","source"),o=fc(i.get(r),e.targetHandle||"input-0","target");return!!(s&&o&&dc(s,o))}function _V(e,t){const n=String((e==null?void 0:e.nodeId)||""),r=String((e==null?void 0:e.handleId)||""),i=(e==null?void 0:e.handleType)==="target"?"target":(e==null?void 0:e.handleType)==="source"?"source":"";if(!n||!r||!i)return null;const s=t.find(l=>l.id===n),o=fc(s,r,i);return o?{nodeId:n,handleId:r,handleType:i,slot:o,slotType:PA(o)}:null}function PV(e,t){return t?e.map((n,r)=>{const i=Array.isArray(t.handleType==="source"?n.inputs:n.outputs)?t.handleType==="source"?n.inputs:n.outputs:[];for(let s=0;s<i.length;s+=1){const o=i[s];if(!(t.handleType==="source"?dc(t.slot,o):dc(o,t.slot)))continue;const c=mu(n);return{def:n,order:r,category:c,categoryRank:yl.indexOf(c),slot:o,slotIndex:s,displayLabel:gu(n),description:Bx(n)}}return null}).filter(Boolean).sort((n,r)=>{var o,l;const i=(o=n.slot)!=null&&o.required?0:1,s=(l=r.slot)!=null&&l.required?0:1;return i-s||n.slotIndex-r.slotIndex||n.categoryRank-r.categoryRank||n.order-r.order}):[]}function AV(e,t=!1){if(t)return"folder";const n=String(e||"").toLowerCase().split(".").pop();return n==="md"||n==="markdown"?"article":["js","jsx","ts","tsx","mjs","cjs"].includes(n)?"code":["yaml","yml","json"].includes(n)?"data_object":"draft"}function IV(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(i=>i.id));for(let i=1;i<1e4;i++){const s=`${n}_${i}`;if(!r.has(s))return s}return`${n}_${Date.now().toString(36)}`}function TV(e){return(e==null?void 0:e.default)!=null?String(e.default):(e==null?void 0:e.value)!=null?String(e.value):""}function np(e){return(Array.isArray(e)?e:[]).map(t=>({type:(t==null?void 0:t.type)||"node",name:(t==null?void 0:t.name)||"",default:TV(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 Xg(e,t){var u,f;const n=e!=null&&e.instances&&typeof e.instances=="object"?e.instances:{},r=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:{},s=(f=e==null?void 0:e.ui)!=null&&f.nodeSizes&&typeof e.ui.nodeSizes=="object"?e.ui.nodeSizes:{},o=new Set(Object.keys(n));for(const p of r)p!=null&&p.source&&o.add(String(p.source)),p!=null&&p.target&&o.add(String(p.target));const c=Array.from(o).map(p=>{const h=n[p]||{},g=h.definitionId||p,b=t.find(v=>v.id===g),S=i[p]&&typeof i[p].x=="number"&&typeof i[p].y=="number"?i[p]:{x:320+o.size*20,y:180+o.size*12},x=s[p]&&typeof s[p].width=="number"&&typeof s[p].height=="number"?{width:s[p].width,height:s[p].height}:null,w=!!ta(g);return{id:p,type:Od,position:S,...w&&x?{width:x.width,height:x.height}:{},data:{label:h.label||Rv(b)||p,definitionId:g,schemaType:KA(g,b),role:h.role||"normal",model:h.model||void 0,body:h.body||"",script:h.script||"",...w&&x?{displaySize:x}:{}}}}).map(p=>hd(p,n,t)),d=r.filter(p=>(p==null?void 0:p.source)&&(p==null?void 0:p.target)).map((p,h)=>({id:p.id||`we-${p.source}-${p.target}-${h}`,source:String(p.source),target:String(p.target),sourceHandle:p.sourceHandle??void 0,targetHandle:p.targetHandle??void 0,markerEnd:{type:qr.ArrowClosed}}));return{nodes:c,edges:_A(d,c),instances:n}}function Jg(e,t,n){var l,c,d,u,f,p,h,g,b;const r=pm(e,n||{}),i=t.map(S=>({source:S.source,target:S.target,sourceHandle:S.sourceHandle??null,targetHandle:S.targetHandle??null})),s={},o={};for(const S of e)if(s[S.id]={x:((l=S.position)==null?void 0:l.x)||0,y:((c=S.position)==null?void 0:c.y)||0},ta((d=S.data)==null?void 0:d.definitionId)){const x=Number(((f=(u=S.data)==null?void 0:u.displaySize)==null?void 0:f.width)||S.width||((p=S.measured)==null?void 0:p.width)||0),w=Number(((g=(h=S.data)==null?void 0:h.displaySize)==null?void 0:g.height)||S.height||((b=S.measured)==null?void 0:b.height)||0);x>0&&w>0&&(o[S.id]={width:x,height:w})}return{version:1,instances:r,edges:i,ui:{nodePositions:s,nodeSizes:o}}}function ta(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":""}function qA(e){const t=[...(e==null?void 0:e.inputs)||[],...(e==null?void 0:e.outputs)||[]],r=ta(e==null?void 0:e.definitionId)==="image"?"src":"content",i=t.find(s=>(s==null?void 0:s.name)===r&&String((s==null?void 0:s.default)||"").trim())||t.find(s=>(s==null?void 0:s.name)==="filePath"&&String((s==null?void 0:s.default)||"").trim())||t.find(s=>(s==null?void 0:s.type)==="text"&&String((s==null?void 0:s.default)||"").trim());return String((e==null?void 0:e.body)||(i==null?void 0:i.default)||"")}function RV(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.default)||(e==null?void 0:e.label)||"Image preview")}function LV(e){return e==="mermaid"?"account_tree":e==="ascii"?"notes":e==="html"?"html":e==="image"?"image":"article"}function Ol(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 OV(e){const t=Ol(e);return t.length>1&&t.every(n=>/^:?-{3,}:?$/.test(n))}function MV(e){return Ol(e).map(t=>t.startsWith(":")&&t.endsWith(":")?"center":t.endsWith(":")?"right":"left")}function $V(e){const t=String(e||"").replace(/\r\n/g,`
|
|
137
|
-
`).split(`
|
|
138
|
-
`),n=[];let r=[],i=!1;const s=()=>{r.length&&(n.push({type:"markdown",text:r.join(`
|
|
139
|
-
`)}),r=[])};for(let o=0;o<t.length;){const l=t[o]||"";if(/^\s*```/.test(l)){i=!i,r.push(l),o++;continue}if(!i&&o+1<t.length&&Ol(l).length>1&&OV(t[o+1])){s();const c=Ol(l),d=MV(t[o+1]),u=[];for(o+=2;o<t.length&&t[o].trim()&&Ol(t[o]).length>1;)u.push(Ol(t[o])),o++;n.push({type:"table",headers:c,align:d,rows:u});continue}r.push(l),o++}return s(),n}function ON({children:e}){return a.jsx(Ld,{components:{p:({children:t})=>a.jsx(a.Fragment,{children:t})},children:String(e||"")})}function DV({content:e}){const t=m.useMemo(()=>$V(e),[e]);return a.jsx(a.Fragment,{children:t.map((n,r)=>n.type!=="table"?a.jsx(Ld,{children:n.text},`md-${r}`):a.jsx("div",{className:"af-work-display-table-wrap",children:a.jsxs("table",{className:"af-work-display-table",children:[a.jsx("thead",{children:a.jsx("tr",{children:n.headers.map((i,s)=>a.jsx("th",{style:{textAlign:n.align[s]||"left"},children:a.jsx(ON,{children:i})},s))})}),a.jsx("tbody",{children:n.rows.map((i,s)=>a.jsx("tr",{children:n.headers.map((o,l)=>a.jsx("td",{style:{textAlign:n.align[l]||"left"},children:a.jsx(ON,{children:i[l]||""})},l))},s))})]})},`table-${r}`))})}function FV(e){const t=String(e||"").split(/\r?\n/).map(l=>l.replace(/%%.*$/,"").trim()).filter(Boolean),n=new Map,r=[];let i="TD";const s=(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},o=l=>{const c=String(l||"").trim().replace(/[;,]+$/,""),d=c.match(/^([A-Za-z][A-Za-z0-9_]*)(?:\[(.+?)\]|\((.+?)\)|\{(.+?)\})?$/);return d?s(d[1],d[2]||d[3]||d[4]||d[1]):s(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){i=c[2].toUpperCase();continue}const d=l.match(/^(.+?)\s*-{1,2}>+\s*(.+)$/);if(d){r.push({from:o(d[1]),to:o(d[2])});continue}o(l)}return{nodes:Array.from(n.values()),edges:r,direction:i}}function zV({code:e}){const t=m.useMemo(()=>FV(e),[e]);if(!String(e||"").trim())return null;const n=t.direction==="LR"||t.direction==="RL",r=142,i=44,s=n?96:32,o=n?30:68,l=new Map;t.nodes.forEach((u,f)=>{l.set(u.id,{x:24+(n?f*(r+s):f%3*(r+s)),y:24+(n?f%3*(i+o):f*(i+o))})});const c=Math.max(360,...Array.from(l.values()).map(u=>u.x+r+24)),d=Math.max(180,...Array.from(l.values()).map(u=>u.y+i+24));return a.jsx("div",{className:"af-work-node__mermaid-preview",children:a.jsxs("svg",{viewBox:`0 0 ${c} ${d}`,role:"img","aria-label":"Mermaid preview",children:[a.jsx("defs",{children:a.jsx("marker",{id:"af-work-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:a.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z"})})}),t.edges.map((u,f)=>{const p=l.get(u.from),h=l.get(u.to);if(!p||!h)return null;const g=n?`M ${p.x+r} ${p.y+i/2} C ${(p.x+h.x+r)/2} ${p.y+i/2}, ${(p.x+h.x+r)/2} ${h.y+i/2}, ${h.x} ${h.y+i/2}`:`M ${p.x+r/2} ${p.y+i} C ${p.x+r/2} ${p.y+i+28}, ${h.x+r/2} ${h.y-28}, ${h.x+r/2} ${h.y}`;return a.jsx("path",{className:"af-work-node__mermaid-edge",d:g,markerEnd:"url(#af-work-arrow)"},`${u.from}-${u.to}-${f}`)}),t.nodes.map(u=>{const f=l.get(u.id);return a.jsxs("g",{children:[a.jsx("rect",{className:"af-work-node__mermaid-box",x:f.x,y:f.y,width:r,height:i,rx:"8"}),a.jsx("text",{className:"af-work-node__mermaid-text",x:f.x+r/2,y:f.y+i/2+5,textAnchor:"middle",children:u.label.slice(0,22)})]},u.id)})]})})}function BV({data:e}){const t=ta(e==null?void 0:e.definitionId);if(!t)return null;const n=qA(e);return n.trim()?t==="html"?a.jsx("div",{className:"af-work-display-body af-work-display-body--html",children:a.jsx("iframe",{className:"af-work-display-html-frame",title:(e==null?void 0:e.label)||"HTML preview",sandbox:"",srcDoc:n})}):t==="image"?a.jsx("div",{className:"af-work-display-body af-work-display-body--image",children:a.jsx("img",{className:"af-work-display-image",src:n,alt:RV(e),loading:"lazy"})}):t==="markdown"?a.jsx("div",{className:"af-work-display-body af-work-display-body--markdown",children:a.jsx(DV,{content:n})}):t==="mermaid"?a.jsxs("div",{className:"af-work-display-body",children:[a.jsx(zV,{code:n}),a.jsx("pre",{className:"af-work-node__diagram af-work-node__diagram--mermaid",children:n})]}):a.jsx("pre",{className:"af-work-display-body af-work-node__diagram af-work-node__diagram--ascii",children:n}):a.jsx("div",{className:"af-work-display-empty",children:"No display content"})}function HV(e){return e==="mermaid"?"mmd":e==="ascii"?"txt":e==="html"?"html":e==="image"?"txt":"md"}function UV(e){return String(e).trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)||"display"}function WV(e,t){const n=ta(t==null?void 0:t.definitionId)||"markdown";return`outputs/${UV((t==null?void 0:t.label)||e||n)}.${HV(n)}`}function VV({id:e,data:t,selected:n,deleteNode:r}){const i=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],o=(Array.isArray(t==null?void 0:t.outputs)?t.outputs:[]).map((u,f)=>({slot:u,idx:f})).sort((u,f)=>{var S,x,w,v;const p=String(((S=u.slot)==null?void 0:S.name)||"").trim(),h=String(((x=f.slot)==null?void 0:x.name)||"").trim();if(p==="next"&&h!=="next")return-1;if(h==="next"&&p!=="next")return 1;const g=String(((w=u.slot)==null?void 0:w.type)||"").trim(),b=String(((v=f.slot)==null?void 0:v.type)||"").trim();return g==="node"&&b!=="node"?-1:b==="node"&&g!=="node"?1:u.idx-f.idx}),l=ta(t==null?void 0:t.definitionId),c=(t==null?void 0:t.label)||(l==="mermaid"?"Mermaid":l==="ascii"?"ASCII":l==="html"?"HTML":l==="image"?"Image":"Markdown"),d=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;return a.jsxs("div",{className:"af-work-display-card"+(d?" af-work-display-card--sized":"")+(n?" af-work-display-card--selected":"")+(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:d?{width:d.width,height:d.height}:void 0,children:[a.jsx(M4,{className:"af-work-display-resize nodrag",position:"bottom-right",minWidth:320,minHeight:180,maxWidth:1200,maxHeight:1e3,children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_full"})}),i.map((u,f)=>{if(u.showOnNode===!1)return null;const p=`${4.15+f*1.75}rem`,h=u.name||`#${f+1}`;return a.jsxs(m.Fragment,{children:[a.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:p},children:h}),a.jsx(ji,{type:"target",position:Fe.Left,id:`input-${f}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:p,background:In(u.type)},title:`${h} · ${u.type}`})]},`in-${f}`)}),o.map(({slot:u,idx:f},p)=>{if(u.showOnNode===!1)return null;const h=`${4.15+p*1.75}rem`,g=u.name||`#${f+1}`;return a.jsxs(m.Fragment,{children:[a.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:h},children:g}),a.jsx(ji,{type:"source",position:Fe.Right,id:`output-${f}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:h,background:In(u.type)},title:`${g} · ${u.type}`})]},`out-${f}`)}),a.jsxs("div",{className:"af-work-display-card__head",children:[a.jsxs("div",{className:"af-work-display-card__title",children:[a.jsx("span",{className:"material-symbols-outlined",children:LV(l)}),a.jsx("strong",{children:c}),a.jsx("span",{children:(t==null?void 0:t.definitionId)||"display"})]}),a.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",onClick:()=>{var u;return(u=t==null?void 0:t.onSaveDisplayNodeToFile)==null?void 0:u.call(t,e,t)},"aria-label":"另存为文件",title:"另存为文件",children:a.jsx("span",{className:"material-symbols-outlined",children:"save"})}),a.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsx(BV,{data:t})]})}function KV({id:e,data:t,selected:n,deleteNode:r}){const i=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],s=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],o=(t==null?void 0:t.runningRunNodeId)===e;return a.jsxs("div",{className:"af-work-run-card"+(n?" af-work-run-card--selected":"")+(o?" 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":""),children:[i.map((l,c)=>{if(l.showOnNode===!1)return null;const d=`${2.25+c*1.75}rem`,u=l.name||`#${c+1}`;return a.jsxs(m.Fragment,{children:[a.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:d},children:u}),a.jsx(ji,{type:"target",position:Fe.Left,id:`input-${c}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:d,background:In(l.type)},title:`${u} · ${l.type}`})]},`in-${c}`)}),s.map((l,c)=>{if(l.showOnNode===!1)return null;const d=`${2.25+c*1.75}rem`,u=l.name||`#${c+1}`;return a.jsxs(m.Fragment,{children:[a.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:d},children:u}),a.jsx(ji,{type:"source",position:Fe.Right,id:`output-${c}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:d,background:In(l.type)},title:`${u} · ${l.type}`})]},`out-${c}`)}),a.jsxs("div",{className:"af-work-run-card__head",children:[a.jsx("span",{className:"material-symbols-outlined",children:"play_circle"}),a.jsx("strong",{children:(t==null?void 0:t.label)||"Run"}),a.jsx("span",{children:(t==null?void 0:t.definitionId)||"workspace_run"}),a.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsxs("button",{type:"button",className:"af-work-run-card__button nodrag",disabled:o,onClick:l=>{var c;l.stopPropagation(),(c=t==null?void 0:t.onRunWorkspaceNode)==null||c.call(t,e)},children:[a.jsx("span",{className:"material-symbols-outlined"+(o?" af-spin":""),children:o?"sync":"play_arrow"}),a.jsx("span",{children:o?"Running":"Run line"})]})]})}function qV(e){var c,d,u,f,p,h,g;const{setEdges:t,setNodes:n}=Va(),r=m.useCallback(b=>{n(S=>S.filter(x=>x.id!==b)),t(S=>S.filter(x=>x.source!==b&&x.target!==b))},[t,n]),i=m.useCallback((b,S)=>{n(x=>x.map(w=>w.id===b?{...w,data:{...w.data,model:S}}:w))},[n]),s=m.useCallback((b,S)=>{n(x=>x.map(w=>{var k;if(w.id!==b)return w;const v=Array.isArray((k=w.data)==null?void 0:k.outputs)&&w.data.outputs.length?w.data.outputs.map((E,j)=>j===0?{...E,default:S,value:S}:E):[{type:"bool",name:"value",default:S,value:S}];return{...w,data:{...w.data,body:"",outputs:v}}}))},[n]),o=m.useCallback((b,S)=>{n(x=>x.map(w=>w.id===b?{...w,data:{...w.data,body:S}}:w))},[n]),l=m.useCallback((b,S)=>{n(x=>x.map(w=>w.id===b?{...w,data:{...w.data,images:Hr(S)}}:w))},[n]);return ta((c=e.data)==null?void 0:c.definitionId)?a.jsx(VV,{...e,deleteNode:r}):((d=e.data)==null?void 0:d.definitionId)==="workspace_run"?a.jsx(KV,{...e,deleteNode:r}):((u=e.data)==null?void 0:u.definitionId)==="control_load_skills"?a.jsx(QV,{...e,deleteNode:r,skills:(f=e.data)==null?void 0:f.skills,skillCollections:(p=e.data)==null?void 0:p.skillCollections,onChangeSkillKeys:(h=e.data)==null?void 0:h.onChangeLoadSkillKeys}):a.jsx("div",{className:"af-work-flow-node",children:a.jsx(AA,{...e,deleteNode:r,modelLists:(g=e.data)==null?void 0:g.modelLists,onModelChange:i,onProvideValueChange:s,onNodeBodyChange:o,onNodeImagesChange:l})})}const YV={[Od]:qV};function YA(e,t=[]){for(const n of e||[])n.type==="file"&&t.push(n),Array.isArray(n.children)&&YA(n.children,t);return t}function GA(e,t=[]){for(const n of e||[])n.type==="directory"&&(t.push(n.path),Array.isArray(n.children)&&GA(n.children,t));return t}function XA({items:e,onOpen:t,collapsedDirs:n,onToggleDir:r,onCreateFile:i,onCreateFolder:s,onDelete:o,onFileDragStart:l}){return a.jsx("ul",{className:"af-work-files",children:(e||[]).map(c=>{var f;const d=c.type==="directory",u=d&&(n==null?void 0:n.has(c.path));return a.jsxs("li",{children:[a.jsxs("div",{className:"af-work-file-row",children:[a.jsxs("button",{type:"button",className:"af-work-file af-work-file--"+c.type,draggable:!d,onDragStart:p=>{d||l==null||l(p,c)},onClick:()=>d?r==null?void 0:r(c.path):t(c),title:c.path,children:[d?a.jsx("span",{className:"material-symbols-outlined af-work-file__chevron",children:u?"chevron_right":"expand_more"}):null,a.jsx("span",{className:"material-symbols-outlined",children:c.icon||AV(c.name,d)}),a.jsx("span",{children:c.name})]}),d?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"af-work-file-action",onClick:()=>i==null?void 0:i(c.path),title:"新增文件","aria-label":`在 ${c.name} 新增文件`,children:a.jsx("span",{className:"material-symbols-outlined",children:"note_add"})}),a.jsx("button",{type:"button",className:"af-work-file-action",onClick:()=>s==null?void 0:s(c.path),title:"新增文件夹","aria-label":`在 ${c.name} 新增文件夹`,children:a.jsx("span",{className:"material-symbols-outlined",children:"create_new_folder"})})]}):null,a.jsx("button",{type:"button",className:"af-work-file-action af-work-file-action--danger",onClick:()=>o==null?void 0:o(c),title:"删除","aria-label":`删除 ${c.name}`,children:a.jsx("span",{className:"material-symbols-outlined",children:"delete"})})]}),d&&!u&&((f=c.children)!=null&&f.length)?a.jsx(XA,{items:c.children,onOpen:t,collapsedDirs:n,onToggleDir:r,onCreateFile:i,onCreateFolder:s,onDelete:o,onFileDragStart:l}):null]},c.path)})})}function GV({messages:e,running:t}){const n=e.length>0;return a.jsxs("div",{className:"af-composer-ai-stack af-composer-ai-stack--in-panel af-composer-thread-stack",children:[e.map((r,i)=>{const s=r.kind==="run-log"?"reply":r.role==="user"?"user-msg":r.error?"error":"reply",o=r.kind==="run-log"?"Run":r.role==="user"?"You":r.error?"Error":"Reply";return a.jsxs("section",{className:`af-composer-ai-block af-composer-ai-block--${s}`,children:[a.jsx("div",{className:"af-composer-ai-block-label",children:o}),a.jsx("div",{className:"af-composer-ai-block-body",children:r.text})]},`${i}-${r.role}-${String(r.text||"").slice(0,24)}`)}),t&&!n?a.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--reply af-composer-ai-block--pending",children:[a.jsx("div",{className:"af-composer-ai-block-label",children:"Reply"}),a.jsx("div",{className:"af-composer-ai-block-body",children:"Waiting..."})]}):null,t&&n?a.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--thinking",children:[a.jsx("div",{className:"af-composer-ai-block-label",children:"Thinking"}),a.jsx("div",{className:"af-composer-ai-block-body",children:"Workspace agent is running..."})]}):null]})}function MN(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 XV(e){const t=MN((e==null?void 0:e.body)||"");if(t.length>0)return t;const n=Array.isArray(e==null?void 0:e.outputs)?e.outputs:[],r=Array.isArray(e==null?void 0:e.inputs)?e.inputs:[],i=[...n,...r].find(s=>(s==null?void 0:s.name)==="skillsContext"||(s==null?void 0:s.type)==="text");return MN((i==null?void 0:i.default)||(i==null?void 0:i.value)||"")}function JV(e){return JSON.stringify(Array.from(new Set((e||[]).map(String).filter(Boolean))))}function QV({id:e,data:t,selected:n,deleteNode:r,skills:i,skillCollections:s,onChangeSkillKeys:o}){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(i)?i:[],u=Array.isArray(s)?s:[],[f,p]=m.useState(!1),h=m.useRef(null),g=m.useRef(null),[b,S]=m.useState({visible:!1,top:0,height:100}),x=m.useMemo(()=>new Set(XV(t)),[t]),w=m.useMemo(()=>new Map(d.map(I=>[I.key,I])),[d]),v=m.useMemo(()=>{const I=new Set,F=u.map(T=>{const q=Vo(T,d).map(D=>w.get(D)).filter(Boolean);for(const D of q)I.add(D.key);return{...T,skills:q}}).filter(T=>T.skills.length>0),L=d.filter(T=>!I.has(T.key));return{collectionGroups:F,ungrouped:L}},[w,u,d]),k=m.useCallback((I,F)=>{const L=new Set(x);for(const T of I)F?L.add(T):L.delete(T);o==null||o(e,Array.from(L))},[e,x,o]),E=m.useCallback(()=>{const I=h.current;if(!I)return;const F=Math.max(1,I.scrollHeight),L=Math.max(1,I.clientHeight),T=F>L+1,q=T?Math.max(12,L/F*100):100,D=Math.max(0,100-q),W=T?Math.min(D,I.scrollTop/Math.max(1,F-L)*D):0;S({visible:T,top:W,height:q})},[]);m.useEffect(()=>{if(!f)return;const I=requestAnimationFrame(E);return()=>cancelAnimationFrame(I)},[f,v,x.size,E]);const j=m.useCallback(I=>{const F=h.current;if(!F)return;const L=Math.max(0,F.scrollHeight-F.clientHeight);F.scrollTop=Math.min(1,Math.max(0,I))*L,E()},[E]),A=m.useCallback((I,F=0)=>{const L=g.current;if(!L)return 0;const T=L.getBoundingClientRect(),q=b.height/100*T.height,D=Math.max(1,T.height-q);return(I-T.top-F)/D},[b.height]),$=m.useCallback(I=>{var R,C;if(!b.visible)return;I.preventDefault(),I.stopPropagation();const F=g.current;if(!F)return;const L=F.getBoundingClientRect(),T=b.top/100*L.height,q=b.height/100*L.height,W=I.clientY>=L.top+T&&I.clientY<=L.top+T+q?I.clientY-L.top-T:q/2;j(A(I.clientY,W));const O=I.pointerId;(C=(R=I.currentTarget).setPointerCapture)==null||C.call(R,O);const U=G=>{G.preventDefault(),j(A(G.clientY,W))},P=()=>{window.removeEventListener("pointermove",U),window.removeEventListener("pointerup",P),window.removeEventListener("pointercancel",P)};window.addEventListener("pointermove",U),window.addEventListener("pointerup",P),window.addEventListener("pointercancel",P)},[A,j,b.height,b.top,b.visible]);return a.jsxs("div",{className:"af-work-load-skills-card"+(n?" af-work-load-skills-card--selected":""),children:[l.map((I,F)=>{if(I.showOnNode===!1)return null;const L=`${2.6+F*1.7}rem`,T=I.name||`#${F+1}`;return a.jsxs(m.Fragment,{children:[a.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:L},children:T}),a.jsx(ji,{type:"target",position:Fe.Left,id:`input-${F}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:L,background:In(I.type)},title:`${T} · ${I.type}`})]},`in-${F}`)}),c.map((I,F)=>{if(I.showOnNode===!1)return null;const L=`${2.6+F*1.7}rem`,T=I.name||`#${F+1}`;return a.jsxs(m.Fragment,{children:[a.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:L},children:T}),a.jsx(ji,{type:"source",position:Fe.Right,id:`output-${F}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:L,background:In(I.type)},title:`${T} · ${I.type}`})]},`out-${F}`)}),a.jsxs("div",{className:"af-work-load-skills-card__head",children:[a.jsx("span",{className:"material-symbols-outlined",children:"extension"}),a.jsx("strong",{children:(t==null?void 0:t.label)||"Load Skills"}),a.jsx("span",{children:(t==null?void 0:t.definitionId)||"control_load_skills"}),a.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsxs("div",{className:"af-work-load-skills-card__body nodrag",children:[a.jsxs("button",{type:"button",className:"af-work-load-skills-card__select",onClick:I=>{I.stopPropagation(),p(F=>!F)},children:[a.jsx("span",{children:x.size>0?`${x.size} skills selected`:"选择 Skills"}),a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:f?"expand_less":"expand_more"})]}),f?a.jsxs("div",{className:"af-work-load-skills-menu-shell",onClick:I=>I.stopPropagation(),children:[a.jsxs("div",{ref:h,className:"af-work-load-skills-menu",onScroll:E,children:[v.collectionGroups.map(I=>{const F=I.skills.map(q=>q.key),L=F.filter(q=>x.has(q)).length,T=F.length>0&&L===F.length;return a.jsxs("section",{className:"af-work-load-skills-menu__group",children:[a.jsxs("label",{className:"af-work-load-skills-menu__group-head",children:[a.jsx("input",{type:"checkbox",checked:T,onChange:q=>k(F,q.target.checked)}),a.jsx("span",{children:I.name}),a.jsxs("small",{children:[L,"/",F.length]})]}),a.jsx("div",{className:"af-work-load-skills-menu__options",children:I.skills.map(q=>a.jsxs("label",{className:"af-work-load-skills-menu__option",children:[a.jsx("input",{type:"checkbox",checked:x.has(q.key),onChange:D=>k([q.key],D.target.checked)}),a.jsx("span",{children:q.name})]},`${I.id}:${q.key}`))})]},I.id)}),v.ungrouped.length>0?a.jsxs("section",{className:"af-work-load-skills-menu__group",children:[a.jsxs("div",{className:"af-work-load-skills-menu__group-head af-work-load-skills-menu__group-head--plain",children:[a.jsx("span",{children:"Ungrouped"}),a.jsx("small",{children:v.ungrouped.length})]}),a.jsx("div",{className:"af-work-load-skills-menu__options",children:v.ungrouped.map(I=>a.jsxs("label",{className:"af-work-load-skills-menu__option",children:[a.jsx("input",{type:"checkbox",checked:x.has(I.key),onChange:F=>k([I.key],F.target.checked)}),a.jsx("span",{children:I.name})]},`ungrouped:${I.key}`))})]}):null,a.jsx("button",{type:"button",className:"af-work-load-skills-menu__clear",onClick:()=>o==null?void 0:o(e,[]),children:"清空"})]}),a.jsx("div",{ref:g,className:"af-work-load-skills-scrollbar"+(b.visible?" af-work-load-skills-scrollbar--visible":""),onPointerDown:$,"aria-hidden":"true",children:a.jsx("span",{style:{height:`${b.height}%`,top:`${b.top}%`}})})]}):null]})]})}function ZV(){var rl,jr;const{i18n:e}=Ut(),{navigate:t}=Wa(),n=Va(),r=q_(),i=m.useMemo(NV,[]),[s,o]=Y_([]),[l,c,d]=G_([]),u=m.useRef([]),f=m.useRef(null),p=m.useRef(null),[h,g]=m.useState(null),[b,S]=m.useState({}),x=m.useRef({}),w=m.useRef(!1),v=m.useRef(null),[k,E]=m.useState([]),[j,A]=m.useState(""),[$,I]=m.useState("nodes"),[F,L]=m.useState([]),[T,q]=m.useState(!1),[D,W]=m.useState(""),[O,U]=m.useState(!1),[P,R]=m.useState({name:"",id:"",description:""}),[C,G]=m.useState(!1),[J,B]=m.useState(""),[te,de]=m.useState(""),ce=m.useRef(null),[ue,re]=m.useState(!1),[ge,se]=m.useState("nodes"),[pe,ae]=m.useState(""),[me,ze]=m.useState(0),[st,Ke]=m.useState(""),[Ee,It]=m.useState(null),[sn,Wt]=m.useState(""),[mn,on]=m.useState([]),[bn,xr]=m.useState(""),[_n,oe]=m.useState(""),[ye,Ue]=m.useState(()=>new Set),[Ge,Qe]=m.useState({cursor:[],opencode:[],claudeCode:[]}),[Et,kn]=m.useState(""),[gt,Sn]=m.useState([]),[On,Rt]=m.useState(!1),[fe,Pe]=m.useState([]),[Mt,Mn]=m.useState([]),[dt,$n]=m.useState(!1),Ci=m.useCallback(_=>{ce.current&&window.clearTimeout(ce.current),de(_),ce.current=window.setTimeout(()=>{de(""),ce.current=null},3800)},[]),an=m.useCallback(_=>{const K=String(_||"").trim();K&&window.requestAnimationFrame(()=>{r(K)})},[r]);m.useEffect(()=>()=>{ce.current&&window.clearTimeout(ce.current)},[]);const[wr,ar]=m.useState(()=>new Set),[lr,fi]=m.useState(!1),Zi=m.useRef(null),cr=m.useRef(null),Qn=m.useRef(null),[es,Xe]=m.useState({}),[_t,$t]=m.useState(""),[Vt,Be]=m.useState(!1),[Dn,Ce]=m.useState([]),[gn,vr]=m.useState(!1),[at,pi]=m.useState(!1),[Vn,Kn]=m.useState(!1),[Xr,Fn]=m.useState(!1),[Jr,br]=m.useState("pan"),[ln,kr]=m.useState(null),[Sr,Qr]=m.useState(""),[V,ve]=m.useState(()=>new Set),[Ie,He]=m.useState({}),[ft,Je]=m.useState(""),xt=m.useMemo(()=>jV(i),[i]),nt=m.useMemo(()=>CV(i),[i]),qn=m.useRef(!1),[Ei,_i]=m.useState("");m.useEffect(()=>{i.flowId&&QC(i.flowId,i.flowSource||"user","workspace",!!i.archived)},[i]),m.useEffect(()=>{if(qn.current=!1,!xt){Ce([]),qn.current=!0;return}try{const _=localStorage.getItem(xt);Ce(_?AN(JSON.parse(_)):[])}catch{Ce([])}finally{qn.current=!0}},[xt]),m.useEffect(()=>{if(!(!qn.current||!xt))try{localStorage.setItem(xt,JSON.stringify(AN(Dn)))}catch{}},[Dn,xt]);const Nn=m.useCallback(async()=>{const _=tp(i),K=await fetch(`/api/workspace/files?${_.toString()}`),X=await K.json();if(!K.ok)throw new Error(X.error||"读取 workspace 失败");const Z=X.files||[];on(Z),Ue(new Set(GA(Z))),xr(X.root||"")},[i]),As=m.useCallback(async()=>{q(!0),W("");try{const _=await fetch("/api/marketplace/flow-snippets"),K=await _.json().catch(()=>({}));if(!_.ok)throw new Error(K.error||"读取流程片段失败");L(Array.isArray(K.snippets)?K.snippets:[])}catch(_){W(String(_.message||_)),L([])}finally{q(!1)}},[]),zn=m.useCallback(async(_=s,K=l)=>{var le;if(!w.current)return;const X=Jg(_,K,x.current),Z=await fetch("/api/workspace/graph",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,graph:X})}),ne=await Z.json();if(!Z.ok)throw new Error(ne.error||"保存 workspace graph 失败");x.current=((le=ne.graph)==null?void 0:le.instances)||X.instances,S(x.current),Je("Workspace graph saved")},[l,i,s]),Pi=m.useCallback(async()=>{w.current=!1;const _=tp(i),K=tp(i);K.set("lang",String(e.language||"zh").startsWith("zh")?"zh":"en");const[X,Z]=await Promise.all([fetch(`/api/nodes?${K.toString()}`),fetch(`/api/workspace/graph?${_.toString()}`),Nn()]),ne=await X.json(),le=await Z.json();if(!X.ok)throw new Error(ne.error||"读取节点定义失败");if(!Z.ok)throw new Error(le.error||"读取 workspace graph 失败");const we=[...(Array.isArray(ne)?ne:ne.nodes||[]).filter(qe=>!vV.has(qe.id)),kV,bV];E(we);const Ne=le.graph||JSON.parse(localStorage.getItem(wV)||"null")||{},$e=Xg(Ne,we);x.current=$e.instances,S($e.instances),o($e.nodes),c($e.edges),Je(le.writable?"Workspace ready":"Readonly workspace"),w.current=!0},[i,e.language,Nn,c,o]),Ai=m.useCallback(async(_,K)=>{const X={packageId:(_==null?void 0:_.newId)||(_==null?void 0:_.id)||(_==null?void 0:_.label),label:(_==null?void 0:_.label)||(_==null?void 0:_.newId)||(_==null?void 0:_.id),version:"1.0.0",definitionId:K,body:(_==null?void 0:_.body)||"",script:(_==null?void 0:_.script)||"",inputs:Array.isArray(_==null?void 0:_.inputs)?_.inputs:[],outputs:Array.isArray(_==null?void 0:_.outputs)?_.outputs:[],flowId:i.flowId,flowSource:i.flowSource||"user",archived:!!i.archived},Z=await fetch("/api/marketplace/publish-node-from-instance",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(X)}),ne=await Z.json().catch(()=>({}));if(!Z.ok||(ne==null?void 0:ne.ok)===!1)throw new Error((ne==null?void 0:ne.error)||"Publish failed");return await Pi(),Je(`Published node ${ne.definitionId||ne.id||X.packageId}`),ne},[i,Pi]),qa=m.useCallback(async _=>{if(!_||Sr)return;const K=Jg(s,l,x.current);Qr(_),ve(new Set([_])),He({[_]:{status:"running"}}),Je(`Running ${_}...`),vr(!0),Ce(X=>[...X,{role:"assistant",kind:"run-log",text:`Run started: ${_}`,at:Date.now()}]);try{await zn(s,l);const X=await fetch("/api/workspace/run",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/x-ndjson"},body:JSON.stringify({...i,graph:K,runNodeId:_,model:Et,selectedSkills:fe,stream:!0})});if(!X.ok){const We=await X.json().catch(()=>({}));throw new Error(We.error||"Workspace run failed")}if(!X.body)throw new Error("Workspace run stream unavailable");const Z=X.body.getReader(),ne=new TextDecoder;let le="",we=[],Ne=[],$e=_;const qe=We=>{const wt=String(We||"").trim();wt&&Ce(De=>[...De,{role:"assistant",kind:"run-log",text:wt,at:Date.now()}])},Lt=We=>{const wt=String(We||"").trim();if(!wt)return;const De=$e;$e=wt,ve(new Set([wt])),He(Kt=>{var Oe;return{...Kt,...De&&De!==wt&&((Oe=Kt[De])==null?void 0:Oe.status)==="running"?{[De]:{status:"success"}}:{},[wt]:{status:"running"}}})},Zn=We=>{const wt=String(We||"").trim();wt&&(ve(De=>{const Kt=new Set(De);return Kt.delete(wt),Kt}),He(De=>({...De,[wt]:{status:"success"}})))},Qt=We=>{const wt=String(We||"");wt.trim()&&Ce(De=>{const Kt=[...De],Oe=Kt[Kt.length-1];return Oe&&Oe.role==="assistant"&&!Oe.kind&&!Oe.error?Kt[Kt.length-1]={...Oe,text:`${Oe.text||""}${Oe.text?`
|
|
140
|
-
`:""}${wt}`}:Kt.push({role:"assistant",text:wt,at:Date.now()}),Kt})},er=We=>{const wt=Xg(We||K,k);x.current=wt.instances,S(wt.instances),o(wt.nodes),c(wt.edges)};for(;;){const{value:We,done:wt}=await Z.read();if(wt)break;le+=ne.decode(We,{stream:!0});const De=le.split(`
|
|
141
|
-
`);le=De.pop()||"";for(const Kt of De){if(!Kt.trim())continue;const Oe=JSON.parse(Kt);if(Oe.type==="error")throw new Error(Oe.error||"Workspace run failed");if(Oe.type==="node-start"&&(Je(`Running ${Oe.nodeId}...`),Lt(Oe.nodeId),qe(`Started ${Oe.nodeId}${Oe.definitionId?` (${Oe.definitionId})`:""}`)),Oe.type==="node-done"&&(Zn(Oe.nodeId),qe(`Completed ${Oe.nodeId}${Oe.definitionId?` (${Oe.definitionId})`:""}`)),Oe.type==="status"&&qe(Oe.line||Oe.message||""),Oe.type==="paused"&&(Ne=Array.isArray(Oe.nodeIds)?Oe.nodeIds:[],qe(Oe.message||(Ne.length?`Paused at ${Ne.join(", ")}`:"Paused"))),Oe.type==="natural"&&Oe.kind==="assistant"&&Qt(Oe.text||""),Oe.type==="graph"&&Oe.graph&&er(Oe.graph),Oe.type==="done"){Oe.graph&&er(Oe.graph),we=Array.isArray(Oe.order)?Oe.order:[];const vt=Ne.length>0;Ne=Array.isArray(Oe.pauseNodeIds)?Oe.pauseNodeIds:Ne,Ne.length?vt||qe(`Run paused at ${Ne.join(", ")}`):qe(`Run finished${we.length?`: ${we.join(" -> ")}`:""}`)}}}if(le.trim()){const We=JSON.parse(le);if(We.type==="error")throw new Error(We.error||"Workspace run failed");if(We.type==="node-start"&&(Je(`Running ${We.nodeId}...`),Lt(We.nodeId),qe(`Started ${We.nodeId}${We.definitionId?` (${We.definitionId})`:""}`)),We.type==="node-done"&&(Zn(We.nodeId),qe(`Completed ${We.nodeId}${We.definitionId?` (${We.definitionId})`:""}`)),We.type==="status"&&qe(We.line||We.message||""),We.type==="paused"&&(Ne=Array.isArray(We.nodeIds)?We.nodeIds:[],qe(We.message||(Ne.length?`Paused at ${Ne.join(", ")}`:"Paused"))),We.type==="natural"&&We.kind==="assistant"&&Qt(We.text||""),We.type==="graph"&&We.graph&&er(We.graph),We.type==="done"){We.graph&&er(We.graph),we=Array.isArray(We.order)?We.order:[];const wt=Ne.length>0;Ne=Array.isArray(We.pauseNodeIds)?We.pauseNodeIds:Ne,Ne.length?wt||qe(`Run paused at ${Ne.join(", ")}`):qe(`Run finished${we.length?`: ${we.join(" -> ")}`:""}`)}}Je(Ne.length?`Workspace run paused at ${Ne.join(", ")}`:`Workspace run done: ${we.length?we.join(" -> "):_}`),await Nn()}catch(X){ve(new Set),He(Z=>{var le;const ne=(le=Object.entries(Z).find(([,we])=>(we==null?void 0:we.status)==="running"))==null?void 0:le[0];return ne?{...Z,[ne]:{status:"failed"}}:Z}),Je(String(X.message||X)),Ce(Z=>[...Z,{role:"assistant",error:!0,text:String(X.message||X),at:Date.now()}])}finally{Qr(""),ve(new Set)}},[Et,l,i,Nn,s,k,Sr,zn,fe,c,o]);m.useEffect(()=>{Pi().catch(_=>Je(String(_.message||_))),As(),fetch("/api/model-lists").then(_=>_.json()).then(_=>Qe({cursor:Array.isArray(_.cursor)?_.cursor.map(String):[],opencode:Array.isArray(_.opencode)?_.opencode.map(String):[],claudeCode:Array.isArray(_.claudeCode)?_.claudeCode.map(String):[]})).catch(()=>{}),fetch("/api/skills").then(_=>_.json()).then(_=>{const K=Array.isArray(_.skills)?_.skills.map(X=>({key:String(X.key),name:String(X.name||X.id||X.key),description:X.description?String(X.description):"",sourceLabel:X.sourceLabel?String(X.sourceLabel):""})):[];Sn(K),Rt(!0)}).catch(()=>{}),fetch("/api/skill-collections").then(_=>_.json()).then(_=>{Mn(zo(_)),$n(!0)}).catch(()=>{}),fetch("/api/auth/me").then(_=>_.json()).then(_=>kr(_.user||null)).catch(()=>kr(null))},[Pi,As,nt]),m.useEffect(()=>{if(_i(""),!(!On||!dt)){if(!nt){Pe([]);return}Pe(nE(nt,"workspace",gt,Mt)),_i(nt)}},[Mt,dt,gt,On,nt]),m.useEffect(()=>{if(!(Ei!==nt||!nt))try{localStorage.setItem(nt,JSON.stringify(fe))}catch{}},[fe,nt,Ei]),m.useEffect(()=>{x.current=b},[b]),m.useEffect(()=>{u.current=s},[s]),m.useEffect(()=>{p.current=h},[h]),m.useEffect(()=>{if(!h)return;const _=X=>{X.key==="Escape"&&g(null)},K=X=>{var Z,ne;(ne=(Z=X.target)==null?void 0:Z.closest)!=null&&ne.call(Z,".af-connect-node-menu")||g(null)};return document.addEventListener("keydown",_),document.addEventListener("pointerdown",K),()=>{document.removeEventListener("keydown",_),document.removeEventListener("pointerdown",K)}},[h]),m.useEffect(()=>{if(w.current)return v.current&&window.clearTimeout(v.current),v.current=window.setTimeout(()=>{zn().catch(_=>Je(String(_.message||_)))},650),()=>{v.current&&window.clearTimeout(v.current)}},[s,l,zn]);const Is=m.useCallback((_,K)=>{const X=JV(K),Z=$e=>Array.isArray($e)?$e.map(qe=>(qe==null?void 0:qe.name)!=="skillsContext"&&(qe==null?void 0:qe.type)!=="text"?qe:{...qe,default:X,value:X}):[],ne=s.map($e=>{var qe,Lt;return $e.id!==_?$e:{...$e,data:{...$e.data,body:X,inputs:Z((qe=$e.data)==null?void 0:qe.inputs),outputs:Z((Lt=$e.data)==null?void 0:Lt.outputs)}}}),le=x.current||{},we=le[_]&&typeof le[_]=="object"?le[_]:{},Ne={...le,[_]:{...we,body:X,input:Z(we.input),output:Z(we.output)}};x.current=Ne,o(ne),S(Ne),zn(ne,l).catch($e=>Je(String($e.message||$e)))},[l,s,zn,o]),Ts=m.useCallback(async(_,K)=>{const X=qA(K);if(!String(X||"").trim()){Je("展示节点没有可保存内容");return}const Z=WV(_,K),ne=window.prompt("保存到 workspace 相对路径",Z);if(ne)try{const le=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:ne,content:X})}),we=await le.json().catch(()=>({}));if(!le.ok)throw new Error(we.error||"保存文件失败");Je(`已保存 ${we.path||ne}`),await Nn()}catch(le){Je(String(le.message||le))}},[i,Nn]),Rs=m.useMemo(()=>s.map(_=>{var K,X;return{..._,data:{..._.data,modelLists:Ge,showBodyPreview:!0,isExecuting:V.has(_.id),nodeStatus:((K=Ie[_.id])==null?void 0:K.status)??null,nodeElapsed:((X=Ie[_.id])==null?void 0:X.elapsed)??null,onRunWorkspaceNode:qa,runningRunNodeId:Sr,skills:gt,skillCollections:Mt,onChangeLoadSkillKeys:Is,onSaveDisplayNodeToFile:Ts}}}),[Is,Ge,s,qa,Sr,Ts,Mt,gt,V,Ie]),rt=m.useMemo(()=>s.find(_=>_.id===st)||null,[s,st]);m.useEffect(()=>{var X,Z,ne,le,we,Ne;if(!rt){It(null),Wt("");return}const{inputs:_,outputs:K}=EA(rt);It({id:rt.id,newId:rt.id,label:String(((X=rt.data)==null?void 0:X.label)??rt.id),role:String(((Z=rt.data)==null?void 0:Z.role)??"normal"),model:String(((ne=rt.data)==null?void 0:ne.model)??""),body:String(((le=rt.data)==null?void 0:le.body)??""),images:Hr((we=rt.data)==null?void 0:we.images),script:String(((Ne=rt.data)==null?void 0:Ne.script)??""),inputs:_,outputs:K}),Wt("")},[rt==null?void 0:rt.id]);const ts=m.useCallback((_=!1)=>{var De,Kt;if(!Ee||!rt)return!1;const K=rt.id,X=String(Ee.newId||"").trim(),Z=_?X:K;if(Wt(""),_){if(!MA.test(Z))return Wt("Invalid instance id"),!1;if(s.some(Oe=>Oe.id===Z&&Oe.id!==K))return Wt("Duplicate instance id"),!1}const ne=String(Ee.role||"").trim(),le=qo.includes(ne)?ne:"normal",we=String(Ee.model||"").trim(),Ne=Oe=>(Array.isArray(Oe)?Oe:[]).map(vt=>({type:String((vt==null?void 0:vt.type)??"node").trim()||"node",name:String((vt==null?void 0:vt.name)??""),default:String((vt==null?void 0:vt.default)??""),required:!!(vt!=null&&vt.required),showOnNode:(vt==null?void 0:vt.showOnNode)!=null?vt.showOnNode!==!1:!!(vt!=null&&vt.required)||String((vt==null?void 0:vt.type)??"node").trim().toLowerCase()==="node"})),$e=String(((De=rt.data)==null?void 0:De.definitionId)??Z),qe=$e.startsWith("provide_"),Lt={...rt.data,label:String(Ee.label||"").trim()||Z,role:le,model:we===""||we==="default"?void 0:we,body:qe?"":String(Ee.body??""),images:qe?[]:Hr(Ee.images),inputs:Ne(Ee.inputs),outputs:qe&&Array.isArray((Kt=rt.data)==null?void 0:Kt.outputs)?rt.data.outputs:Ne(Ee.outputs)},Zn=String(Ee.script??"").trim();$e==="tool_nodejs"||Zn!==""?Lt.script=String(Ee.script??""):delete Lt.script;const Qt=rt.data||{};if(!(Z!==K||Qt.label!==Lt.label||Qt.role!==Lt.role||Qt.model!==Lt.model||Qt.body!==Lt.body||JSON.stringify(Hr(Qt.images))!==JSON.stringify(Lt.images)||(Qt.script??void 0)!==(Lt.script??void 0)||JSON.stringify(Qt.inputs||[])!==JSON.stringify(Lt.inputs||[])||JSON.stringify(Qt.outputs||[])!==JSON.stringify(Lt.outputs||[])))return!0;let We=s.map(Oe=>Oe.id===K?{...Oe,id:Z,selected:!0,data:Lt}:Oe),wt=l;if(Z!==K){const Oe={...x.current},vt={...Oe[K]||{}};delete Oe[K],Oe[Z]=vt,x.current=Oe,S(Oe),wt=l.map((ke,Zt)=>({...ke,source:ke.source===K?Z:ke.source,target:ke.target===K?Z:ke.target,id:`we-${ke.source===K?Z:ke.source}-${ke.target===K?Z:ke.target}-${Zt}`})),Ke(Z)}return o(We),c(wt),an(Z),!0},[l,Ee,s,rt,c,o,an]);m.useEffect(()=>{if(!Ee||!rt)return;const _=window.setTimeout(()=>{ts(!1)},350);return()=>window.clearTimeout(_)},[Ee==null?void 0:Ee.label,Ee==null?void 0:Ee.role,Ee==null?void 0:Ee.model,Ee==null?void 0:Ee.body,JSON.stringify((Ee==null?void 0:Ee.images)||[]),Ee==null?void 0:Ee.script,JSON.stringify((Ee==null?void 0:Ee.inputs)||[]),JSON.stringify((Ee==null?void 0:Ee.outputs)||[]),ts,rt==null?void 0:rt.id]);const Ya=m.useMemo(()=>{const _=new Map(Rs.map(K=>[K.id,K]));return l.map(K=>{var qe,Lt,Zn,Qt;const X=_.get(K.source),Z=_.get(K.target),ne=/^output-(\d+)$/.exec(K.sourceHandle||""),le=/^input-(\d+)$/.exec(K.targetHandle||""),we=X&&ne?(Lt=(qe=X.data)==null?void 0:qe.outputs)==null?void 0:Lt[parseInt(ne[1],10)]:null,Ne=Z&&le?(Qt=(Zn=Z.data)==null?void 0:Zn.inputs)==null?void 0:Qt[parseInt(le[1],10)]:null,$e=we!=null&&we.type?In(we.type):Ne!=null&&Ne.type?In(Ne.type):"";return $e?{...K,style:{...K.style||{},stroke:$e,strokeWidth:2},markerEnd:{type:qr.ArrowClosed,color:$e}}:K})},[l,Rs]),na=m.useMemo(()=>{const _=j.trim().toLowerCase(),K={DISPLAY:[],CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const X of k)_&&![X.id,X.label,X.displayName,X.description].some(Z=>String(Z||"").toLowerCase().includes(_))||K[mu(X)].push(X);for(const X of yl)K[X].sort((Z,ne)=>Z.id.localeCompare(ne.id));return K},[k,j]),cn=m.useMemo(()=>{const _=pe.trim().toLowerCase();return k.filter(K=>!_||[K.id,K.label,K.displayName,K.description].some(X=>String(X||"").toLowerCase().includes(_))).sort((K,X)=>{const Z=yl.indexOf(mu(K)),ne=yl.indexOf(mu(X));return Z!==ne?Z-ne:gu(K).localeCompare(gu(X))}).slice(0,30)},[k,pe]),Ii=m.useMemo(()=>{const _=pe.trim().toLowerCase();return F.filter(K=>!_||[K.id,K.version,K.displayName,K.name,K.description,...Array.isArray(K.tags)?K.tags:[]].some(X=>String(X||"").toLowerCase().includes(_))).sort((K,X)=>String(K.displayName||K.name||K.id).localeCompare(String(X.displayName||X.name||X.id))).slice(0,30)},[F,pe]);m.useEffect(()=>{ze(0)},[pe,ue,ge]),m.useEffect(()=>{if(!ue)return;const _=window.setTimeout(()=>{var K;return(K=Qn.current)==null?void 0:K.focus()},0);return()=>window.clearTimeout(_)},[ue]);const Bd=m.useMemo(()=>{const _=_n.trim().toLowerCase();return _?YA(mn).filter(K=>K.path.toLowerCase().includes(_)):mn},[_n,mn]),Hd=[...(Ge.cursor||[]).map(_=>({label:`Cursor · ${_.split(" - ")[0]}`,value:`cursor:${_.split(" - ")[0]}`})),...(Ge.opencode||[]).map(_=>({label:`OpenCode · ${_.split(" - ")[0]}`,value:`opencode:${_.split(" - ")[0]}`})),...(Ge.claudeCode||[]).map(_=>({label:`Claude · ${_.split(" - ")[0]}`,value:`claude-code:${_.split(" - ")[0]}`}))],Zr=m.useMemo(()=>new Set(fe),[fe]),ra=m.useMemo(()=>{const _=new Map(gt.map(le=>[le.key,le])),K=new Set,X=new Set,Z=Mt.map(le=>{const we=Vo(le,gt).map(Ne=>_.get(Ne)).filter(Boolean);for(const Ne of we)K.add(Ne.key),X.add(String(Ne.name||Ne.id||Ne.key||"").trim());return{...le,skills:we}}).filter(le=>le.skills.length>0),ne=gt.filter(le=>{const we=String(le.name||le.id||le.key||"").trim();return!K.has(le.key)&&!X.has(we)});return{groups:Z,ungrouped:ne}},[Mt,gt]),yn=m.useMemo(()=>{const _=s.filter(K=>K.selected);return _.length>0?_:st?s.filter(K=>K.id===st):[]},[s,st]),ns=m.useMemo(()=>yn.map(_=>_.id),[yn]),Ga=m.useMemo(()=>{const _=String((ln==null?void 0:ln.username)||(ln==null?void 0:ln.userId)||"").trim();return _?_.slice(0,1).toUpperCase():"?"},[ln]),so=m.useMemo(()=>new Set(ns),[ns]),St=m.useMemo(()=>l.filter(_=>so.has(_.source)&&so.has(_.target)),[l,so]),Xa=m.useMemo(()=>{const _=j.trim().toLowerCase();return _?F.filter(K=>[K.id,K.version,K.displayName,K.name,K.description,...Array.isArray(K.tags)?K.tags:[]].filter(Boolean).some(X=>String(X).toLowerCase().includes(_))):F},[F,j]),Jt=m.useCallback((_,K)=>{const X=String(_||"snippet_node").trim().replace(/[^a-zA-Z0-9_]+/g,"_").replace(/^_+|_+$/g,"")||"snippet_node";let Z=`${X}_${Date.now().toString(36)}`,ne=2;for(;K.has(Z);)Z=`${X}_${Date.now().toString(36)}_${ne}`,ne+=1;return K.add(Z),Z},[]),Ls=m.useCallback((_,K)=>{var Oe,vt;const X=_!=null&&_.snippet&&typeof _.snippet=="object"?_.snippet:{},Z=X.instances&&typeof X.instances=="object"?X.instances:{},ne=Object.keys(Z);if(ne.length===0)return;const le=new Set(u.current.map(ke=>ke.id)),we={};for(const ke of ne)we[ke]=Jt(ke,le);const Ne=(Oe=X.ui)!=null&&Oe.nodePositions&&typeof X.ui.nodePositions=="object"?X.ui.nodePositions:{},$e=ne.map(ke=>{const Zt=Ne[ke];return{id:ke,x:typeof(Zt==null?void 0:Zt.x)=="number"?Zt.x:0,y:typeof(Zt==null?void 0:Zt.y)=="number"?Zt.y:0}}),qe=Math.min(...$e.map(ke=>ke.x)),Lt=Math.min(...$e.map(ke=>ke.y));let Zn=K||{x:360+u.current.length*24,y:180+u.current.length*18};if(!K){const ke=document.querySelector(".af-workspace-canvas .react-flow");if(ke){const Zt=ke.getBoundingClientRect();Zn=n.screenToFlowPosition({x:Zt.left+Zt.width*.48,y:Zt.top+Zt.height*.32})}}const Qt={},er={};for(const ke of $e){const Zt=we[ke.id];Qt[Zt]={...Z[ke.id]||{}},er[Zt]={x:Zn.x+(ke.x-qe),y:Zn.y+(ke.y-Lt)}}const We=new Set(ne),wt=(Array.isArray(X.edges)?X.edges:[]).filter(ke=>We.has(ke==null?void 0:ke.source)&&We.has(ke==null?void 0:ke.target)).map(ke=>({source:we[ke.source],target:we[ke.target],sourceHandle:ke.sourceHandle??null,targetHandle:ke.targetHandle??null})),De=Xg({instances:Qt,edges:wt,ui:{nodePositions:er}},k),Kt=De.nodes.map(ke=>({...ke,selected:!0}));x.current={...x.current,...De.instances},S(x.current),o(ke=>[...ke.map(Zt=>({...Zt,selected:!1})),...Kt]),c(ke=>[...ke.map(Zt=>({...Zt,selected:!1})),...De.edges]),Ke(((vt=Kt[0])==null?void 0:vt.id)||""),Je(`已添加流程片段:${_.displayName||_.id}`)},[Jt,k,n,c,o]),Ja=m.useCallback(()=>{var X,Z;if(yn.length<2){W("请先在 workspace 画布上选择至少两个节点。"),I("flows");return}const _=yn[0],K=yn.length===2?`${((X=_.data)==null?void 0:X.label)||_.id} 片段`:`${((Z=_.data)==null?void 0:Z.label)||_.id} 等 ${yn.length} 个节点`;R({name:K,id:K.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),description:""}),B(""),U(!0),I("flows")},[yn]),rs=m.useCallback(async()=>{var Z,ne;if(yn.length<2)return;const _=P.name.trim();if(!_){B("请填写片段名称。");return}const K={};for(const le of yn)K[le.id]={x:((Z=le.position)==null?void 0:Z.x)||0,y:((ne=le.position)==null?void 0:ne.y)||0};const X=St.map(le=>({source:le.source,target:le.target,sourceHandle:le.sourceHandle??null,targetHandle:le.targetHandle??null}));G(!0),B("");try{const le=await fetch("/api/marketplace/publish-flow-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:P.id,name:_,displayName:_,version:"1.0.0",description:P.description,snippet:{instances:pm(yn,x.current),edges:X,ui:{nodePositions:K}}})}),we=await le.json().catch(()=>({}));if(!le.ok||we.ok===!1)throw new Error(we.error||"发布流程片段失败");U(!1),Je(`流程片段已发布:${we.id||_}`),Ci(`流程片段已发布:${we.id||_}`),await As(),I("flows")}catch(le){B(String(le.message||le))}finally{G(!1)}},[As,P,St,yn,Ci]),Qa=m.useCallback(_=>{o(K=>K.map(X=>X.id===_?{...X,selected:!1}:X)),Ke(K=>K===_?"":K)},[o]),is=m.useCallback(()=>{const _=Zi.current;if(!_)return;const K=_.getBoundingClientRect(),X=Math.min(420,Math.max(320,K.width+160)),Z=12,ne=Math.max(180,K.top-Z*2),le=Math.min(560,ne);Xe({position:"fixed",left:Math.max(12,Math.min(window.innerWidth-X-12,K.left)),top:Math.max(Z,K.top-le-Z),width:X,maxHeight:le,zIndex:1e4})},[]);m.useEffect(()=>{if(!lr)return;is();const _=X=>{var ne,le;const Z=X.target;(ne=Zi.current)!=null&&ne.contains(Z)||(le=cr.current)!=null&&le.contains(Z)||fi(!1)},K=X=>{X.key==="Escape"&&fi(!1)};return window.addEventListener("pointerdown",_),window.addEventListener("keydown",K),window.addEventListener("resize",is),window.addEventListener("scroll",is,!0),()=>{window.removeEventListener("pointerdown",_),window.removeEventListener("keydown",K),window.removeEventListener("resize",is),window.removeEventListener("scroll",is,!0)}},[lr,is]);const ia=m.useCallback(_=>{var X,Z;const K=new Map;for(const ne of _||[])(ne==null?void 0:ne.type)==="dimensions"&&((X=ne.dimensions)!=null&&X.width)&&((Z=ne.dimensions)!=null&&Z.height)&&K.set(ne.id,{width:Math.round(Number(ne.dimensions.width)),height:Math.round(Number(ne.dimensions.height))});o(ne=>av(_,ne).map(le=>{var Ne;const we=K.get(le.id);return!we||!ta((Ne=le.data)==null?void 0:Ne.definitionId)?le:{...le,data:{...le.data,displaySize:we}}}))},[o]),un=m.useCallback(()=>{const _=document.querySelector(".af-workspace-canvas .react-flow");if(_){const K=_.getBoundingClientRect();return n.screenToFlowPosition({x:K.left+K.width*.48,y:K.top+K.height*.32})}return{x:360+s.length*36,y:180+s.length*28}},[s.length,n]),Os=m.useCallback(()=>{var _,K,X;if(rt){const Z=Number(((_=rt.measured)==null?void 0:_.width)||rt.width||260);return{x:Number(((K=rt.position)==null?void 0:K.x)||0)+Z+140,y:Number(((X=rt.position)==null?void 0:X.y)||0)}}return un()},[un,rt]),Nr=m.useCallback((_,K={})=>{if(!_)return null;const X=K.id||IV(_.id,s),Z=np(_.inputs),ne=np(_.outputs),le={definitionId:_.id,label:K.label||Rv(_),role:"normal",body:K.body||"",input:K.inputs||Z,output:K.outputs||ne},we={id:X,type:Od,position:K.position||un(),data:{label:le.label,definitionId:_.id,schemaType:KA(_.id,_),role:"normal",body:le.body,inputs:le.input,outputs:le.output}},Ne={...hd(we,{...x.current,[X]:le},k),selected:!0};return o($e=>[...$e.map(qe=>({...qe,selected:!1})),Ne]),Ke(X),X},[un,s,k,o]),Za=m.useCallback(_=>LN(_,u.current),[]),Ud=m.useCallback(_=>{if(!LN(_,u.current)){Je("端口类型不匹配,已取消连线");return}g(null),c(K=>{const X=K.filter(Z=>!(Z.target===_.target&&Z.targetHandle===_.targetHandle));return od({..._,markerEnd:{type:qr.ArrowClosed}},X)})},[c]),sa=m.useCallback((_,K)=>{f.current=_V(K,u.current),g(null)},[]),el=m.useCallback((_,K)=>{var Qt,er,We,wt;const X=f.current;if(f.current=null,!X||K!=null&&K.toNode)return;const Z=PV(k,X);if(Z.length===0){Je(`没有匹配 ${X.slotType} 端口的节点`);return}const ne=((er=(Qt=_==null?void 0:_.changedTouches)==null?void 0:Qt[0])==null?void 0:er.clientX)??(_==null?void 0:_.clientX),le=((wt=(We=_==null?void 0:_.changedTouches)==null?void 0:We[0])==null?void 0:wt.clientY)??(_==null?void 0:_.clientY);if(!Number.isFinite(ne)||!Number.isFinite(le))return;const we=document.querySelector(".af-workspace-canvas .react-flow");if(!we)return;const Ne=we.getBoundingClientRect(),$e=320,qe=Math.min(440,104+Z.length*58),Lt=Math.max(12,Math.min(ne-Ne.left,Ne.width-$e-12)),Zn=Math.max(12,Math.min(le-Ne.top,Ne.height-qe-12));g({left:Lt,top:Zn,flowPosition:n.screenToFlowPosition({x:ne,y:le}),draft:X,candidates:Z,query:""})},[k,n]),tl=m.useCallback(_=>{const K=p.current;if(!K||!(_!=null&&_.def))return;const X=Nr(_.def,{position:K.flowPosition});if(!X)return;const Z=K.draft.handleType==="source"?{source:K.draft.nodeId,sourceHandle:K.draft.handleId,target:X,targetHandle:`input-${_.slotIndex}`}:{source:X,sourceHandle:`output-${_.slotIndex}`,target:K.draft.nodeId,targetHandle:K.draft.handleId};c(ne=>{const le=ne.filter(we=>!(we.target===Z.target&&we.targetHandle===Z.targetHandle));return od({...Z,markerEnd:{type:qr.ArrowClosed}},le)}),g(null)},[Nr,c]),nl=m.useCallback(_=>{_&&(Nr(_,{position:Os()}),re(!1),ae(""))},[Nr,Os]),oa=m.useCallback(_=>{_&&(Ls(_,Os()),re(!1),ae(""))},[Ls,Os]);m.useEffect(()=>{const _=K=>{if(K.defaultPrevented)return;const X=IA(K.target)||EV(K.target);if((K.metaKey||K.ctrlKey)&&K.key.toLowerCase()==="s"){K.preventDefault(),zn().catch(Z=>Je(String(Z.message||Z)));return}if(Xr){(K.key==="Escape"||Sh(K))&&(K.preventDefault(),Fn(!1));return}if(!X){if(Sh(K)&&!K.metaKey&&!K.ctrlKey&&!K.altKey){K.preventDefault(),Fn(!0);return}if(K.key==="a"||K.key==="A"){if(K.metaKey||K.ctrlKey){K.preventDefault(),o(Z=>Z.map(ne=>({...ne,selected:!0}))),c(Z=>Z.map(ne=>({...ne,selected:!1})));return}if(K.altKey)return;K.preventDefault(),re(!0);return}if((K.key==="v"||K.key==="V")&&!K.metaKey&&!K.ctrlKey&&!K.altKey){K.preventDefault(),br("select");return}(K.key==="h"||K.key==="H")&&!K.metaKey&&!K.ctrlKey&&!K.altKey&&(K.preventDefault(),br("pan"))}};return window.addEventListener("keydown",_,!0),()=>window.removeEventListener("keydown",_,!0)},[zn,Xr,c,o]);const vm=m.useCallback(_=>{Ue(K=>{const X=new Set(K);return X.has(_)?X.delete(_):X.add(_),X})},[]),Ti=m.useCallback((_,K)=>{_.dataTransfer.effectAllowed="copy",_.dataTransfer.setData("application/x-agentflow-workspace-file",JSON.stringify({path:K.path,name:K.name,type:K.type})),_.dataTransfer.setData("text/plain",K.path)},[]),jc=m.useCallback((_,K)=>{_.dataTransfer.effectAllowed="move",_.dataTransfer.setData("application/agentflow-node",K.id),_.dataTransfer.setData("text/plain",K.id)},[]),aa=m.useCallback(async(_,K)=>{const X=k.find(qe=>qe.id==="display_markdown");if(!X){Je("Markdown Display 节点不可用");return}const Z=tp(i);Z.set("path",_.path);const ne=await fetch(`/api/workspace/file?${Z.toString()}`),le=await ne.json();if(!ne.ok)throw new Error(le.error||"读取文件失败");const we=String(le.content||""),Ne=np(X.inputs).map(qe=>qe.name==="content"?{...qe,default:we}:qe),$e=np(X.outputs).map(qe=>qe.name==="content"?{...qe,default:we}:qe);Nr(X,{label:_.name||"Markdown",body:we,inputs:Ne,outputs:$e,position:K}),Je(`已创建 Markdown 展示:${_.path}`)},[Nr,i,k]),la=m.useCallback(_=>{aa(_,un()).catch(K=>Je(String(K.message||K)))},[aa,un]),Cc=m.useCallback(_=>{const K=_.dataTransfer.getData("application/x-agentflow-workspace-file");if(K){_.preventDefault();let we;try{we=JSON.parse(K)}catch{return}if(!(we!=null&&we.path))return;const Ne=n.screenToFlowPosition({x:_.clientX,y:_.clientY});aa(we,Ne).catch($e=>Je(String($e.message||$e)));return}const X=_.dataTransfer.getData("application/agentflow-snippet");if(X){const we=F.find($e=>`${$e.id}@${$e.version}`===X);if(!we)return;_.preventDefault();const Ne=n.screenToFlowPosition({x:_.clientX,y:_.clientY});Ls(we,Ne);return}const Z=_.dataTransfer.getData("application/agentflow-node");if(!Z)return;const ne=k.find(we=>we.id===Z);if(!ne)return;_.preventDefault();const le=n.screenToFlowPosition({x:_.clientX,y:_.clientY});Nr(ne,{position:le})},[aa,Nr,F,Ls,k,n]),Wd=m.useCallback(_=>{const K=Array.from(_.dataTransfer.types||[]);!K.includes("application/x-agentflow-workspace-file")&&!K.includes("application/agentflow-node")&&!K.includes("application/agentflow-snippet")||(_.preventDefault(),_.dataTransfer.dropEffect=K.includes("application/agentflow-node")||K.includes("application/agentflow-snippet")?"move":"copy")},[]),ca=m.useCallback(async(_="")=>{const K=window.prompt("新文件名",_?`${_}/notes.md`:"notes.md");if(!K)return;const X=_&&!K.includes("/")?`${_}/${K}`:K;try{const Z=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:X,content:""})}),ne=await Z.json();if(!Z.ok)throw new Error(ne.error||"创建文件失败");Je(`已创建 ${ne.path}`),await Nn()}catch(Z){Je(String(Z.message||Z))}},[i,Nn]),Ec=m.useCallback(async(_="")=>{const K=window.prompt("新文件夹名",_?`${_}/docs`:"docs");if(!K)return;const X=_&&!K.includes("/")?`${_}/${K}`:K;try{const Z=await fetch("/api/workspace/folder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:X})}),ne=await Z.json();if(!Z.ok)throw new Error(ne.error||"创建文件夹失败");Ue(le=>{const we=new Set(le);return _&&we.delete(_),we}),Je(`已创建 ${ne.path}`),await Nn()}catch(Z){Je(String(Z.message||Z))}},[i,Nn]),oo=m.useCallback(async _=>{if(!(!(_!=null&&_.path)||!window.confirm(`删除 ${_.path}?`)))try{const K=await fetch("/api/workspace/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:_.path})}),X=await K.json();if(!K.ok)throw new Error(X.error||"删除失败");Je(`已删除 ${X.path}`),await Nn()}catch(K){Je(String(K.message||K))}},[i,Nn]),ua=m.useCallback(async()=>{const _=_t.trim();if(!_||Vt)return;const K=Jg(s,l,x.current);$t(""),Be(!0),vr(!0),Ce(X=>[...X,{role:"user",text:_,at:Date.now()}]);try{await zn(s,l);const X=await fetch("/api/workspace/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,prompt:_,outputKind:"markdown",workspaceGraph:K,allowFlowYaml:!1,model:Et,selectedSkills:fe,selectedNodeIds:ns})}),Z=await X.json();if(!X.ok)throw new Error(Z.error||"生成失败");const ne=String(Z.content||"").trim();Ce(le=>[...le,{role:"assistant",text:ne,at:Date.now()}]),await Pi(),Je("AI 生成完成")}catch(X){const Z=String(X.message||X);Ce(ne=>[...ne,{role:"assistant",text:Z,error:!0,at:Date.now()}]),Je(Z)}finally{Be(!1)}},[Et,Vt,_t,l,i,Pi,s,zn,ns,fe]);return a.jsxs("div",{className:"af-workspace-page",children:[a.jsxs("header",{className:"af-pipeline-top af-workspace-top",children:[a.jsxs("div",{className:"af-pipeline-top-left",children:[a.jsx("button",{type:"button",className:"af-icon-btn af-pipeline-back",onClick:()=>t("/projects"),"aria-label":"返回",children:a.jsx("span",{className:"material-symbols-outlined",children:"arrow_back"})}),a.jsxs("div",{className:"af-pipeline-brand",title:i.flowId?`${i.flowId} · ${bn}`:bn||"PROJECT",children:[a.jsx("span",{className:"af-pipeline-brand-name",children:"WORKSPACE"}),a.jsxs("span",{className:"af-pipeline-brand-ver",children:["V",SV,"-STABLE"]})]}),a.jsxs("div",{className:"af-view-switch","aria-label":"视图切换",children:[a.jsx("button",{type:"button",onClick:()=>{t(Ww({id:i.flowId,source:i.flowSource||"user",archived:!!i.archived},"pipeline"))},children:"Pipeline"}),a.jsx("button",{type:"button",className:"af-view-switch__active",children:"Workspace"})]})]}),a.jsxs("div",{className:"af-pipeline-top-right af-workspace-actions",children:[a.jsx("span",{className:"af-workspace-save-status",children:ft}),a.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>Fn(!0),"aria-label":"快捷键",title:"快捷键 (?)",children:a.jsx("span",{className:"material-symbols-outlined",children:"help"})}),a.jsx("button",{type:"button",className:"af-composer-topbar-btn"+(gn?" af-composer-topbar-btn--active":"")+(Vt?" af-composer-topbar-btn--running":""),onClick:()=>vr(_=>!_),children:"AI"}),a.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",onClick:()=>zn().catch(_=>Je(String(_.message||_))),children:"Save"})]})]}),te?a.jsxs("div",{className:"af-flow-snippet-toast",role:"status","aria-live":"polite",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"check_circle"}),a.jsx("span",{children:te}),a.jsx("button",{type:"button",onClick:()=>de(""),"aria-label":"关闭发布提示",children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}):null,a.jsxs("div",{className:"af-workspace-body"+(gn||Ee?" af-workspace-body--drawer":"")+(Vn?" af-workspace-body--sidebar-collapsed":""),children:[Vn?a.jsx("nav",{className:"af-workspace-rail","aria-label":"Workspace sidebar",children:a.jsxs("div",{className:"af-workspace-rail__stack",children:[a.jsxs("button",{type:"button",className:"af-workspace-rail__primary",onClick:()=>re(!0),"aria-label":"添加节点",title:"添加节点",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add"}),a.jsx("span",{className:"af-workspace-rail__dot","aria-hidden":!0})]}),a.jsx("button",{type:"button",className:"af-workspace-rail__btn",onClick:()=>Kn(!1),"aria-label":"展开文件",title:"展开文件",children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"folder"})}),a.jsx("span",{className:"af-workspace-rail__divider","aria-hidden":!0}),a.jsx("button",{type:"button",className:"af-workspace-rail__avatar",onClick:()=>Kn(!1),"aria-label":"展开侧边栏",title:(ln==null?void 0:ln.username)||(ln==null?void 0:ln.userId)||"展开侧边栏",children:Ga})]})}):null,a.jsxs("aside",{className:"af-workspace-sidebar","aria-hidden":Vn,children:[a.jsxs("section",{className:"af-workspace-files-section",children:[a.jsxs("div",{className:"af-workspace-sidebar-head",children:[a.jsx("h2",{children:"Files"}),a.jsxs("div",{className:"af-workspace-sidebar-actions",children:[a.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>Kn(!0),"aria-label":"最小化侧边栏",title:"最小化侧边栏",children:a.jsx("span",{className:"material-symbols-outlined",children:"keyboard_double_arrow_left"})}),a.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>ca(""),"aria-label":"新增文件",title:"新增文件",children:a.jsx("span",{className:"material-symbols-outlined",children:"note_add"})}),a.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>Ec(""),"aria-label":"新增文件夹",title:"新增文件夹",children:a.jsx("span",{className:"material-symbols-outlined",children:"create_new_folder"})}),a.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>void Nn(),"aria-label":"刷新文件",title:"刷新文件",children:a.jsx("span",{className:"material-symbols-outlined",children:"refresh"})})]})]}),a.jsx("input",{className:"af-workspace-search",value:_n,onChange:_=>oe(_.target.value),placeholder:"搜索文件..."}),a.jsx("div",{className:"af-workspace-files-scroll",children:a.jsx(XA,{items:Bd,onOpen:la,collapsedDirs:ye,onToggleDir:vm,onCreateFile:ca,onCreateFolder:Ec,onDelete:oo,onFileDragStart:Ti})})]}),a.jsxs("section",{className:"af-workspace-nodes-section",children:[a.jsxs("div",{className:"af-node-palette-head af-workspace-node-palette-head",children:[a.jsxs("h2",{className:"af-node-palette-title",children:[a.jsx("span",{children:"Palette"}),a.jsx("span",{className:"af-node-palette-title-kbd","aria-label":"快捷键 A",children:"A"})]}),a.jsxs("label",{className:"af-palette-search-wrap",children:[a.jsx("span",{className:"af-visually-hidden",children:$==="flows"?"搜索流程片段":"搜索节点"}),a.jsx("span",{className:"af-palette-search-icon material-symbols-outlined","aria-hidden":!0,children:"search"}),a.jsx("input",{type:"search",className:"af-palette-search-input",value:j,onChange:_=>A(_.target.value),placeholder:$==="flows"?"搜索流程片段...":"搜索节点...","aria-label":$==="flows"?"搜索流程片段":"搜索节点"})]}),a.jsxs("div",{className:"af-palette-tabs",role:"tablist","aria-label":"Palette 类型",children:[a.jsxs("button",{type:"button",role:"tab","aria-selected":$==="nodes",className:"af-palette-tab"+($==="nodes"?" af-palette-tab--active":""),onClick:()=>I("nodes"),children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"category"}),"节点"]}),a.jsxs("button",{type:"button",role:"tab","aria-selected":$==="flows",className:"af-palette-tab"+($==="flows"?" af-palette-tab--active":""),onClick:()=>I("flows"),children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"account_tree"}),"流程"]})]})]}),a.jsx("div",{className:"af-node-palette-scroll af-workspace-node-palette-scroll",children:$==="flows"?a.jsxs(a.Fragment,{children:[a.jsx("section",{className:"af-palette-section af-flow-palette-section--snippets",children:a.jsxs("div",{className:"af-flow-snippet-actions",children:[a.jsxs("button",{type:"button",className:"af-flow-snippet-publish-btn",onClick:Ja,disabled:yn.length<2,title:yn.length<2?"选择至少两个节点后发布流程片段":"发布选中的流程片段",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"ios_share"}),"发布选中片段"]}),a.jsxs("span",{className:"af-flow-snippet-selection",children:["已选 ",yn.length," 节点 / ",St.length," 连线"]})]})}),D?a.jsx("p",{className:"af-err af-palette-list-err",children:D}):null,T?a.jsx("p",{className:"af-palette-empty",children:"正在加载流程片段..."}):Xa.length>0?a.jsxs("section",{className:"af-palette-section af-flow-palette-section--snippets",children:[a.jsx("h3",{className:"af-palette-cat",children:"FLOW SNIPPETS"}),a.jsx("div",{className:"af-palette-cards",children:Xa.map(_=>{const K=`${_.id}@${_.version}`,X=_.displayName||_.name||_.id,Z=_.description||`${_.nodeCount||0} 个节点,${_.edgeCount||0} 条连线`;return a.jsxs("button",{type:"button",className:"af-palette-card af-flow-snippet-card",draggable:!0,onDragStart:ne=>{ne.dataTransfer.effectAllowed="move",ne.dataTransfer.setData("application/agentflow-snippet",K),ne.dataTransfer.setData("text/plain",K)},onClick:()=>Ls(_),title:Z,children:[a.jsxs("span",{className:"af-palette-card-head",children:[a.jsx("span",{className:"af-palette-card-icon","aria-hidden":!0,children:a.jsx("span",{className:"material-symbols-outlined",children:"account_tree"})}),a.jsxs("span",{className:"af-palette-card-main",children:[a.jsx("span",{className:"af-palette-card-label",children:X}),a.jsxs("span",{className:"af-palette-card-id",children:[_.id,"@",_.version]})]})]}),Z?a.jsx("span",{className:"af-palette-card-desc",children:Z}):null,a.jsxs("span",{className:"af-flow-snippet-meta","aria-hidden":!0,children:[a.jsxs("span",{children:[_.nodeCount||0," nodes"]}),a.jsxs("span",{children:[_.edgeCount||0," edges"]})]})]},K)})})]}):a.jsx("p",{className:"af-palette-empty",children:j.trim()?"没有匹配的流程片段":"暂无流程片段。选择多个节点后发布。"})]}):a.jsxs(a.Fragment,{children:[yl.map(_=>{var K;return(K=na[_])!=null&&K.length?a.jsxs("section",{className:`af-palette-section af-flow-palette-section--${_}`,children:[a.jsx("h3",{className:"af-palette-cat",children:_}),a.jsx("div",{className:"af-palette-cards",children:na[_].map(X=>{const Z=RN(X.inputs,"input"),ne=RN(X.outputs,"output"),le=Bx(X),we=gu(X);return a.jsxs("button",{type:"button",className:"af-palette-card",draggable:!0,onDragStart:Ne=>jc(Ne,X),onClick:()=>Nr(X),title:le||X.id,children:[a.jsxs("span",{className:"af-palette-card-head",children:[a.jsx("span",{className:"af-palette-card-icon","aria-hidden":!0,children:a.jsx("span",{className:"material-symbols-outlined",children:IN(_)})}),a.jsxs("span",{className:"af-palette-card-main",children:[a.jsx("span",{className:"af-palette-card-label",children:we}),we!==X.id?a.jsx("span",{className:"af-palette-card-id",children:X.id}):null]})]}),le?a.jsx("span",{className:"af-palette-card-desc",children:le}):null,a.jsxs("span",{className:"af-palette-card-ports","aria-hidden":!0,children:[a.jsxs("span",{className:"af-palette-card-port-side af-palette-card-port-side--in",children:[a.jsxs("span",{className:"af-palette-card-port-count",children:[Z.list.length," IN"]}),a.jsxs("span",{className:"af-palette-card-port-list",children:[Z.shown.map((Ne,$e)=>a.jsxs("span",{className:"af-palette-card-port",title:TN("input",Ne,$e),children:[a.jsx("span",{className:"af-palette-card-port-dot",style:{background:In(Ne==null?void 0:Ne.type)}}),a.jsx("span",{className:"af-palette-card-port-name",children:Gg(Ne,$e)})]},`in-${$e}`)),Z.hidden>0?a.jsxs("span",{className:"af-palette-card-port-more",children:["+",Z.hidden]}):null]})]}),a.jsxs("span",{className:"af-palette-card-port-side af-palette-card-port-side--out",children:[a.jsxs("span",{className:"af-palette-card-port-count",children:[ne.list.length," OUT"]}),a.jsxs("span",{className:"af-palette-card-port-list",children:[ne.shown.map((Ne,$e)=>a.jsxs("span",{className:"af-palette-card-port",title:TN("output",Ne,$e),children:[a.jsx("span",{className:"af-palette-card-port-name",children:Gg(Ne,$e)}),a.jsx("span",{className:"af-palette-card-port-dot",style:{background:In(Ne==null?void 0:Ne.type)}})]},`out-${$e}`)),ne.hidden>0?a.jsxs("span",{className:"af-palette-card-port-more",children:["+",ne.hidden]}):null]})]})]})]},X.id)})})]},_):null}),k.length>0&&j.trim()&&yl.every(_=>{var K;return!((K=na[_])!=null&&K.length)})?a.jsx("p",{className:"af-palette-empty",children:"没有匹配的节点"}):null]})})]})]}),a.jsxs("main",{className:"af-workspace-canvas",children:[a.jsx(K_,{className:"af-flow-canvas af-workspace-flow"+(Jr==="pan"?" af-flow-canvas--tool-pan":" af-flow-canvas--tool-select"),nodes:Rs,edges:Ya,nodeTypes:YV,onNodesChange:ia,onEdgesChange:d,onConnect:Ud,onConnectStart:sa,onConnectEnd:el,isValidConnection:Za,onNodeClick:(_,K)=>{st&&Ke(K.id)},onNodeDoubleClick:(_,K)=>{_.preventDefault(),vr(!1),o(X=>X.map(Z=>({...Z,selected:Z.id===K.id}))),c(X=>X.map(Z=>({...Z,selected:!1}))),Ke(K.id)},onPaneClick:()=>Ke(""),onDrop:Cc,onDragOver:Wd,selectionOnDrag:Jr==="select",panOnDrag:Jr==="pan"?!0:[1,2],panActivationKeyCode:"Space",proOptions:{hideAttribution:!0},fitView:!1,minZoom:.1,maxZoom:4,children:a.jsx(J_,{color:"rgba(255,255,255,0.12)",gap:22,size:1})}),h?(()=>{var Z;const _=String(h.query||"").trim().toLowerCase(),K=_?h.candidates.filter(ne=>{var le,we,Ne;return[(le=ne.def)==null?void 0:le.id,ne.displayLabel,ne.description,(we=ne.slot)==null?void 0:we.name,(Ne=ne.slot)==null?void 0:Ne.type].filter(Boolean).some($e=>String($e).toLowerCase().includes(_))}):h.candidates,X=h.draft.handleType==="source"?"IN":"OUT";return a.jsxs("div",{className:"af-connect-node-menu",style:{left:h.left,top:h.top},role:"dialog","aria-label":"选择匹配节点",children:[a.jsxs("div",{className:"af-connect-node-menu__head",children:[a.jsxs("div",{className:"af-connect-node-menu__title",children:[a.jsx("span",{className:"af-connect-node-menu__dot",style:{background:In((Z=h.draft.slot)==null?void 0:Z.type)},"aria-hidden":!0}),a.jsxs("span",{children:["匹配 ",h.draft.slotType," 节点"]})]}),a.jsx("button",{type:"button",className:"af-connect-node-menu__close","aria-label":"关闭",onClick:()=>g(null),children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),a.jsxs("label",{className:"af-connect-node-menu__search",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),a.jsx("input",{type:"search",value:h.query,onChange:ne=>g(le=>le&&{...le,query:ne.target.value}),placeholder:"搜索节点",autoFocus:!0})]}),a.jsxs("div",{className:"af-connect-node-menu__list",children:[K.map(ne=>{var Ne,$e;const le=ne.displayLabel||((Ne=ne.def)==null?void 0:Ne.id),we=Gg(ne.slot,ne.slotIndex);return a.jsxs("button",{type:"button",className:"af-connect-node-menu__item",onClick:()=>tl(ne),title:ne.description||ne.def.id,children:[a.jsxs("span",{className:"af-connect-node-menu__item-main",children:[a.jsx("span",{className:"af-connect-node-menu__item-label",children:le}),le!==ne.def.id?a.jsx("span",{className:"af-connect-node-menu__item-id",children:ne.def.id}):null]}),a.jsxs("span",{className:"af-connect-node-menu__port",children:[a.jsx("span",{children:X}),a.jsx("span",{className:"af-connect-node-menu__port-dot",style:{background:In(($e=ne.slot)==null?void 0:$e.type)},"aria-hidden":!0}),a.jsx("span",{className:"af-connect-node-menu__port-name",children:we})]})]},`${ne.def.id}-${ne.slotIndex}`)}),K.length===0?a.jsx("div",{className:"af-connect-node-menu__empty",children:"没有匹配结果"}):null]})]})})():null,at?a.jsx("button",{type:"button",className:"af-workspace-composer-fab",onClick:()=>pi(!1),"aria-label":"展开 AI 输入框",title:"展开 AI 输入框",children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"auto_awesome"})}):a.jsx("div",{className:"af-workspace-composer af-bottom-composer-stack af-flow-bottom-composer",children:a.jsxs("div",{className:"af-pipeline-composer-inner",children:[a.jsx("button",{type:"button",className:"af-workspace-composer-minimize",onClick:()=>pi(!0),"aria-label":"最小化 AI 输入框",title:"最小化",children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"remove"})}),a.jsx("div",{className:"af-composer-selected","aria-label":"Selected workspace nodes",children:yn.length===0?a.jsx("span",{className:"af-composer-selected-empty",children:"选择画布节点后,可作为本次 Workspace AI 的上下文。"}):yn.map(_=>{var ne,le;const K=String(((ne=_.data)==null?void 0:ne.label)??_.id),X=(le=_.data)!=null&&le.definitionId?String(_.data.definitionId):"",Z=X&&X!==K?`${K} · ${_.id} · ${X}`:`${K} · ${_.id}`;return a.jsxs("div",{className:"af-composer-node-chip",title:Z,children:[a.jsx("span",{className:"af-composer-node-chip-kind",children:X||"node"}),a.jsx("span",{className:"af-composer-node-chip-label",children:K}),a.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>Qa(_.id),"aria-label":`取消选择 ${_.id}`,children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},_.id)})}),a.jsxs("div",{className:"af-composer-card af-composer-card--input-only",children:[a.jsx("div",{className:"af-composer-input-wrap",children:a.jsx("textarea",{className:"af-composer-textarea",value:_t,rows:2,onChange:_=>$t(_.target.value),onKeyDown:_=>{(_.metaKey||_.ctrlKey)&&_.key==="Enter"&&(_.preventDefault(),ua())},placeholder:"描述你想在 workspace 中生成、分析或展示的内容",autoComplete:"off",spellCheck:!1})}),a.jsxs("div",{className:"af-composer-toolbar",children:[a.jsxs("div",{className:"af-composer-skills-field",children:[a.jsxs("button",{ref:Zi,type:"button",className:"af-composer-skills-button"+(fe.length>0?" af-composer-skills-button--active":""),disabled:Vt,"aria-haspopup":"listbox","aria-expanded":lr,onClick:()=>fi(_=>!_),children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"extension"}),a.jsx("span",{children:fe.length>0?`Skills ${fe.length}`:"Skills"})]}),lr&&!Vt?Dr.createPortal(a.jsx("div",{ref:cr,className:"af-composer-skills-menu",role:"listbox","aria-label":"Skills",style:es,children:gt.length===0?a.jsx("div",{className:"af-composer-skills-empty",children:"No skills found"}):a.jsxs(a.Fragment,{children:[ra.groups.map(_=>{const K=Vo(_,gt),X=tE(_,Zr,gt),Z=wr.has(_.id);return a.jsxs("div",{className:"af-composer-skill-group af-composer-skill-group--framed"+(Z?" af-composer-skill-group--collapsed":""),children:[a.jsxs("div",{className:"af-composer-skill-group-title af-composer-skill-group-title--selectable",children:[a.jsxs("label",{className:"af-composer-skill-group-check",children:[a.jsx("input",{type:"checkbox",checked:X==="all",disabled:K.length===0,onChange:ne=>{const le=ne.target.checked;Pe(we=>le?ZC(we,K):eE(we,K))}}),a.jsxs("span",{className:"af-composer-skill-group-title-main",children:[a.jsx("span",{children:_.name}),_.builtin?a.jsx("em",{children:"built-in"}):null,X==="partial"?a.jsx("em",{children:"partial"}):null]})]}),a.jsxs("button",{type:"button",className:"af-composer-skill-group-toggle","aria-label":Z?`展开 ${_.name}`:`收起 ${_.name}`,onClick:()=>{ar(ne=>{const le=new Set(ne);return le.has(_.id)?le.delete(_.id):le.add(_.id),le})},children:[a.jsx("span",{children:_.skills.length}),a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:Z?"expand_more":"expand_less"})]})]}),Z?null:a.jsx("div",{className:"af-composer-skill-group-items",children:_.skills.map(ne=>a.jsxs("label",{className:"af-composer-skill-option",children:[a.jsx("input",{type:"checkbox",checked:Zr.has(ne.key),onChange:le=>{const we=le.target.checked;Pe(Ne=>we?Ne.includes(ne.key)?Ne:[...Ne,ne.key]:Ne.filter($e=>$e!==ne.key))}}),a.jsxs("span",{className:"af-composer-skill-option-main",children:[a.jsx("span",{className:"af-composer-skill-option-title",children:ne.name}),ne.description?a.jsx("span",{className:"af-composer-skill-option-desc",children:ne.description}):null]})]},`${_.id}:${ne.key}`))})]},_.id)}),ra.ungrouped.length>0?a.jsxs("div",{className:"af-composer-skill-group",children:[a.jsxs("div",{className:"af-composer-skill-group-title",children:[a.jsx("span",{children:"Ungrouped"}),a.jsx("span",{children:ra.ungrouped.length})]}),ra.ungrouped.map(_=>a.jsxs("label",{className:"af-composer-skill-option",children:[a.jsx("input",{type:"checkbox",checked:Zr.has(_.key),onChange:K=>{const X=K.target.checked;Pe(Z=>X?Z.includes(_.key)?Z:[...Z,_.key]:Z.filter(ne=>ne!==_.key))}}),a.jsxs("span",{className:"af-composer-skill-option-main",children:[a.jsx("span",{className:"af-composer-skill-option-title",children:_.name}),_.description?a.jsx("span",{className:"af-composer-skill-option-desc",children:_.description}):null]})]},`ungrouped:${_.key}`))]}):null]})}),document.body):null]}),a.jsx("label",{className:"af-composer-model-field",children:a.jsxs("select",{className:"af-composer-model-select",value:Et,onChange:_=>kn(_.target.value),"aria-label":"模型",children:[a.jsx("option",{value:"",children:"默认模型"}),Hd.map(_=>a.jsx("option",{value:_.value,children:_.label},_.value))]})}),a.jsx("button",{type:"button",className:"af-composer-send"+(_t.trim()&&!Vt?" af-composer-send--active":"")+(Vt?" af-composer-send--stop":""),disabled:Vt||!_t.trim(),"aria-label":Vt?"Running":"Send",onClick:()=>void ua(),children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:Vt?"sync":"arrow_upward"})})]})]})]})})]}),gn?a.jsx("aside",{className:"af-pipeline-drawer af-pipeline-drawer--wide af-workspace-composer-drawer","aria-label":"Workspace AI Composer",children:a.jsxs("div",{className:"af-composer-sidebar",children:[a.jsxs("div",{className:"af-pipeline-drawer-head",children:[a.jsx("h2",{className:"af-pipeline-drawer-title",children:"AI Composer"}),a.jsx("button",{type:"button",className:"af-pipeline-drawer-close af-icon-btn",onClick:()=>vr(!1),"aria-label":"关闭 AI 对话侧栏",children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsx("div",{className:"af-composer-session-tabs",children:a.jsx("button",{type:"button",className:"af-composer-session-tab af-composer-session-tab--active",children:a.jsx("span",{className:"af-composer-session-label",children:"Workspace"})})}),a.jsx("div",{className:"af-composer-sidebar-status"+(Vt?" af-composer-sidebar-status--running":""),role:"status","aria-live":"polite",children:Vt?"Workspace agent running":Dn.length>0?"Workspace conversation":"Ready"}),a.jsx("div",{className:"af-composer-sidebar-thread",children:a.jsx(GV,{messages:Dn,running:Vt})})]})}):Ee&&rt?a.jsx("aside",{className:"af-pipeline-drawer af-workspace-node-drawer","aria-label":"Workspace Node Properties",children:a.jsx($A,{draft:Ee,setDraft:It,definitionId:String(((rl=rt.data)==null?void 0:rl.definitionId)||rt.id),systemPromptReadonly:String(((jr=rt.data)==null?void 0:jr.description)||""),modelLists:Ge,disabled:!1,onIdBlur:()=>ts(!0),onClose:()=>Ke(""),onPublishToMarketplace:Ai,error:sn,ioSlots:{inputs:Array.isArray(Ee==null?void 0:Ee.inputs)?Ee.inputs:[],outputs:Array.isArray(Ee==null?void 0:Ee.outputs)?Ee.outputs:[]}})}):null,a.jsx(TA,{open:Xr,onClose:()=>Fn(!1)}),O?Dr.createPortal(a.jsx("div",{className:"af-flow-snippet-modal-overlay",children:a.jsxs("div",{className:"af-flow-snippet-modal",role:"dialog","aria-modal":"true","aria-label":"发布流程片段",children:[a.jsxs("div",{className:"af-flow-snippet-modal__head",children:[a.jsxs("span",{className:"af-flow-snippet-modal__title",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"ios_share"}),"发布流程片段"]}),a.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>U(!1),"aria-label":"关闭",children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),a.jsxs("div",{className:"af-flow-snippet-modal__body",children:[a.jsxs("label",{className:"af-flow-snippet-field",children:[a.jsx("span",{children:"名称"}),a.jsx("input",{type:"text",value:P.name,onChange:_=>{const K=_.target.value;R(X=>({...X,name:K,id:X.id?X.id:K.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")}))},placeholder:"例如:内容整理片段",autoFocus:!0})]}),a.jsxs("label",{className:"af-flow-snippet-field",children:[a.jsx("span",{children:"ID"}),a.jsx("input",{type:"text",value:P.id,onChange:_=>R(K=>({...K,id:_.target.value})),placeholder:"content-cleanup-snippet"})]}),a.jsxs("label",{className:"af-flow-snippet-field",children:[a.jsx("span",{children:"说明"}),a.jsx("textarea",{value:P.description,onChange:_=>R(K=>({...K,description:_.target.value})),placeholder:"这段流程适合什么 workspace 场景、需要接哪些上下游。",rows:4})]}),a.jsxs("div",{className:"af-flow-snippet-summary",children:["将发布 ",yn.length," 个节点和 ",St.length," 条内部连线。"]}),J?a.jsx("div",{className:"af-flow-snippet-error",children:J}):null]}),a.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[a.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>U(!1),children:"取消"}),a.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:C||!P.name.trim(),onClick:()=>void rs(),children:C?"发布中...":"发布"})]})]})}),document.body):null,ue?Dr.createPortal(a.jsx("div",{className:"af-workspace-quick-add-backdrop",onMouseDown:()=>re(!1),children:a.jsxs("div",{className:"af-workspace-quick-add",role:"dialog","aria-modal":"true","aria-label":"Add workspace node",onMouseDown:_=>_.stopPropagation(),children:[a.jsxs("div",{className:"af-workspace-quick-add__tabs",role:"tablist","aria-label":"选择添加类型",children:[a.jsx("button",{type:"button",role:"tab","aria-selected":ge==="nodes",className:"af-workspace-quick-add__tab"+(ge==="nodes"?" af-workspace-quick-add__tab--active":""),onClick:()=>se("nodes"),children:"节点"}),a.jsx("button",{type:"button",role:"tab","aria-selected":ge==="flows",className:"af-workspace-quick-add__tab"+(ge==="flows"?" af-workspace-quick-add__tab--active":""),onClick:()=>se("flows"),children:"流程"})]}),a.jsxs("div",{className:"af-workspace-quick-add__search",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),a.jsx("input",{ref:Qn,value:pe,onChange:_=>ae(_.target.value),onKeyDown:_=>{if(_.key==="Escape")_.preventDefault(),re(!1);else if(_.key==="ArrowDown"){_.preventDefault();const K=ge==="flows"?Ii.length:cn.length;ze(X=>Math.min(Math.max(0,K-1),X+1))}else _.key==="ArrowUp"?(_.preventDefault(),ze(K=>Math.max(0,K-1))):_.key==="Tab"?(_.preventDefault(),se(K=>K==="nodes"?"flows":"nodes")):_.key==="Enter"&&(_.preventDefault(),ge==="flows"?oa(Ii[me]||Ii[0]):nl(cn[me]||cn[0]))},placeholder:ge==="flows"?"搜索流程片段...":"搜索节点...","aria-label":ge==="flows"?"搜索流程片段":"搜索节点"})]}),a.jsx("div",{className:"af-workspace-quick-add__list",children:ge==="flows"?Ii.length===0?a.jsx("div",{className:"af-workspace-quick-add__empty",children:T?"正在加载流程片段...":D||"没有匹配的流程片段"}):Ii.map((_,K)=>{const X=_.displayName||_.name||_.id,Z=_.snippet&&typeof _.snippet=="object"?_.snippet.instances:null,ne=_.snippet&&typeof _.snippet=="object"?_.snippet.edges:null,le=Number.isFinite(Number(_.nodeCount))?Number(_.nodeCount):Object.keys(Z||{}).length,we=Number.isFinite(Number(_.edgeCount))?Number(_.edgeCount):Array.isArray(ne)?ne.length:0;return a.jsxs("button",{type:"button",className:"af-workspace-quick-add__item"+(K===me?" af-workspace-quick-add__item--active":""),onMouseEnter:()=>ze(K),onClick:()=>oa(_),children:[a.jsx("span",{className:"af-workspace-quick-add__icon material-symbols-outlined","aria-hidden":!0,children:"schema"}),a.jsxs("span",{className:"af-workspace-quick-add__main",children:[a.jsx("span",{className:"af-workspace-quick-add__label",children:X}),a.jsxs("span",{className:"af-workspace-quick-add__meta",children:[_.id,_.version?` · v${_.version}`:""]}),a.jsx("span",{className:"af-workspace-quick-add__desc",children:_.description||`${le} 节点 / ${we} 连线`})]}),a.jsx("span",{className:"af-workspace-quick-add__cat",children:"FLOW"})]},`${_.id}@${_.version}`)}):cn.length===0?a.jsx("div",{className:"af-workspace-quick-add__empty",children:"没有匹配的节点"}):cn.map((_,K)=>{const X=mu(_),Z=gu(_),ne=Bx(_);return a.jsxs("button",{type:"button",className:"af-workspace-quick-add__item"+(K===me?" af-workspace-quick-add__item--active":""),onMouseEnter:()=>ze(K),onClick:()=>nl(_),children:[a.jsx("span",{className:"af-workspace-quick-add__icon material-symbols-outlined","aria-hidden":!0,children:IN(X)}),a.jsxs("span",{className:"af-workspace-quick-add__main",children:[a.jsx("span",{className:"af-workspace-quick-add__label",children:Z}),a.jsx("span",{className:"af-workspace-quick-add__meta",children:_.id}),ne?a.jsx("span",{className:"af-workspace-quick-add__desc",children:ne}):null]}),a.jsx("span",{className:"af-workspace-quick-add__cat",children:X})]},_.id)})})]})}),document.body):null]})]})}function e7(){return a.jsx(cv,{children:a.jsx(ZV,{})})}const ot=e=>typeof e=="string",ru=()=>{let e,t;const n=new Promise((r,i)=>{e=r,t=i});return n.resolve=e,n.reject=t,n},$N=e=>e==null?"":""+e,t7=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},n7=/###/g,DN=e=>e&&e.indexOf("###")>-1?e.replace(n7,"."):e,FN=e=>!e||ot(e),Ru=(e,t,n)=>{const r=ot(t)?t.split("."):t;let i=0;for(;i<r.length-1;){if(FN(e))return{};const s=DN(r[i]);!e[s]&&n&&(e[s]=new n),Object.prototype.hasOwnProperty.call(e,s)?e=e[s]:e={},++i}return FN(e)?{}:{obj:e,k:DN(r[i])}},zN=(e,t,n)=>{const{obj:r,k:i}=Ru(e,t,Object);if(r!==void 0||t.length===1){r[i]=n;return}let s=t[t.length-1],o=t.slice(0,t.length-1),l=Ru(e,o,Object);for(;l.obj===void 0&&o.length;)s=`${o[o.length-1]}.${s}`,o=o.slice(0,o.length-1),l=Ru(e,o,Object),l&&l.obj&&typeof l.obj[`${l.k}.${s}`]<"u"&&(l.obj=void 0);l.obj[`${l.k}.${s}`]=n},r7=(e,t,n,r)=>{const{obj:i,k:s}=Ru(e,t,Object);i[s]=i[s]||[],i[s].push(n)},Nh=(e,t)=>{const{obj:n,k:r}=Ru(e,t);if(n)return n[r]},i7=(e,t,n)=>{const r=Nh(e,n);return r!==void 0?r:Nh(t,n)},JA=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?ot(e[r])||e[r]instanceof String||ot(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):JA(e[r],t[r],n):e[r]=t[r]);return e},hl=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var s7={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const o7=e=>ot(e)?e.replace(/[&<>"'\/]/g,t=>s7[t]):e;class a7{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 l7=[" ",",","?","!",";"],c7=new a7(20),u7=(e,t,n)=>{t=t||"",n=n||"";const r=l7.filter(o=>t.indexOf(o)<0&&n.indexOf(o)<0);if(r.length===0)return!0;const i=c7.getRegExp(`(${r.map(o=>o==="?"?"\\?":o).join("|")})`);let s=!i.test(e);if(!s){const o=e.indexOf(n);o>0&&!i.test(e.substring(0,o))&&(s=!0)}return s},Hx=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 i=e;for(let s=0;s<r.length;){if(!i||typeof i!="object")return;let o,l="";for(let c=s;c<r.length;++c)if(c!==s&&(l+=n),l+=r[c],o=i[l],o!==void 0){if(["string","number","boolean"].indexOf(typeof o)>-1&&c<r.length-1)continue;s+=c-s+1;break}i=o}return i},jh=e=>e&&e.replace("_","-"),d7={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 Ch{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||d7,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,i){return i&&!this.debug?null:(ot(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new Ch(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new Ch(this.logger,t)}}var ws=new Ch;class hm{constructor(){this.observers={}}on(t,n){return t.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const i=this.observers[r].get(n)||0;this.observers[r].set(n,i+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),i=1;i<n;i++)r[i-1]=arguments[i];this.observers[t]&&Array.from(this.observers[t].entries()).forEach(o=>{let[l,c]=o;for(let d=0;d<c;d++)l(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(o=>{let[l,c]=o;for(let d=0;d<c;d++)l.apply(l,[t,...r])})}}class BN extends hm{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 i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,o=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let l;t.indexOf(".")>-1?l=t.split("."):(l=[t,n],r&&(Array.isArray(r)?l.push(...r):ot(r)&&s?l.push(...r.split(s)):l.push(r)));const c=Nh(this.data,l);return!c&&!n&&!r&&t.indexOf(".")>-1&&(t=l[0],n=l[1],r=l.slice(2).join(".")),c||!o||!ot(r)?c:Hx(this.data&&this.data[t]&&this.data[t][n],r,s)}addResource(t,n,r,i){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const o=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let l=[t,n];r&&(l=l.concat(o?r.split(o):r)),t.indexOf(".")>-1&&(l=t.split("."),i=n,n=l[1]),this.addNamespaces(n),zN(this.data,l,i),s.silent||this.emit("added",t,n,r,i)}addResources(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const s in r)(ot(r[s])||Array.isArray(r[s]))&&this.addResource(t,n,s,r[s],{silent:!0});i.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,i,s){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},l=[t,n];t.indexOf(".")>-1&&(l=t.split("."),i=r,r=n,n=l[1]),this.addNamespaces(n);let c=Nh(this.data,l)||{};o.skipCopy||(r=JSON.parse(JSON.stringify(r))),i?JA(c,r,s):c={...c,...r},zN(this.data,l,c),o.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(i=>n[i]&&Object.keys(n[i]).length>0)}toJSON(){return this.data}}var QA={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(s=>{this.processors[s]&&(t=this.processors[s].process(t,n,r,i))}),t}};const HN={};class Eh extends hm{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),t7(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=ws.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 i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let s=n.ns||this.options.defaultNS||[];const o=r&&t.indexOf(r)>-1,l=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!u7(t,r,i);if(o&&!l){const c=t.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:t,namespaces:ot(s)?[s]:s};const d=t.split(r);(r!==i||r===i&&this.options.ns.indexOf(d[0])>-1)&&(s=d.shift()),t=d.join(i)}return{key:t,namespaces:ot(s)?[s]:s}}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 i=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,s=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:o,namespaces:l}=this.extractFromKey(t[t.length-1],n),c=l[l.length-1],d=n.lng||this.language,u=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d&&d.toLowerCase()==="cimode"){if(u){const k=n.nsSeparator||this.options.nsSeparator;return i?{res:`${c}${k}${o}`,usedKey:o,exactUsedKey:o,usedLng:d,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:`${c}${k}${o}`}return i?{res:o,usedKey:o,exactUsedKey:o,usedLng:d,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:o}const f=this.resolve(t,n);let p=f&&f.res;const h=f&&f.usedKey||o,g=f&&f.exactUsedKey||o,b=Object.prototype.toString.apply(p),S=["[object Number]","[object Function]","[object RegExp]"],x=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,w=!this.i18nFormat||this.i18nFormat.handleAsObject,v=!ot(p)&&typeof p!="boolean"&&typeof p!="number";if(w&&p&&v&&S.indexOf(b)<0&&!(ot(x)&&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 k=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,p,{...n,ns:l}):`key '${o} (${this.language})' returned an object instead of string.`;return i?(f.res=k,f.usedParams=this.getUsedParamsDetails(n),f):k}if(s){const k=Array.isArray(p),E=k?[]:{},j=k?g:h;for(const A in p)if(Object.prototype.hasOwnProperty.call(p,A)){const $=`${j}${s}${A}`;E[A]=this.translate($,{...n,joinArrays:!1,ns:l}),E[A]===$&&(E[A]=p[A])}p=E}}else if(w&&ot(x)&&Array.isArray(p))p=p.join(x),p&&(p=this.extendTranslation(p,t,n,r));else{let k=!1,E=!1;const j=n.count!==void 0&&!ot(n.count),A=Eh.hasDefaultValue(n),$=j?this.pluralResolver.getSuffix(d,n.count,n):"",I=n.ordinal&&j?this.pluralResolver.getSuffix(d,n.count,{ordinal:!1}):"",F=j&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),L=F&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${$}`]||n[`defaultValue${I}`]||n.defaultValue;!this.isValidLookup(p)&&A&&(k=!0,p=L),this.isValidLookup(p)||(E=!0,p=o);const q=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&E?void 0:p,D=A&&L!==p&&this.options.updateMissing;if(E||k||D){if(this.logger.log(D?"updateKey":"missingKey",d,c,o,D?L:p),s){const P=this.resolve(o,{...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 W=[];const O=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&O&&O[0])for(let P=0;P<O.length;P++)W.push(O[P]);else this.options.saveMissingTo==="all"?W=this.languageUtils.toResolveHierarchy(n.lng||this.language):W.push(n.lng||this.language);const U=(P,R,C)=>{const G=A&&C!==p?C:q;this.options.missingKeyHandler?this.options.missingKeyHandler(P,c,R,G,D,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(P,c,R,G,D,n),this.emit("missingKey",P,c,R,p)};this.options.saveMissing&&(this.options.saveMissingPlurals&&j?W.forEach(P=>{const R=this.pluralResolver.getSuffixes(P,n);F&&n[`defaultValue${this.options.pluralSeparator}zero`]&&R.indexOf(`${this.options.pluralSeparator}zero`)<0&&R.push(`${this.options.pluralSeparator}zero`),R.forEach(C=>{U([P],o+C,n[`defaultValue${C}`]||L)})}):U(W,o,L))}p=this.extendTranslation(p,t,n,f,r),E&&p===o&&this.options.appendNamespaceToMissingKey&&(p=`${c}:${o}`),(E||k)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?p=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}:${o}`:o,k?p:void 0):p=this.options.parseMissingKeyHandler(p))}return i?(f.res=p,f.usedParams=this.getUsedParamsDetails(n),f):p}extendTranslation(t,n,r,i,s){var o=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const d=ot(t)&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let u;if(d){const p=t.match(this.interpolator.nestingRegexp);u=p&&p.length}let f=r.replace&&!ot(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(f={...this.options.interpolation.defaultVariables,...f}),t=this.interpolator.interpolate(t,f,r.lng||this.language||i.usedLng,r),d){const p=t.match(this.interpolator.nestingRegexp),h=p&&p.length;u<h&&(r.nest=!1)}!r.lng&&this.options.compatibilityAPI!=="v1"&&i&&i.res&&(r.lng=this.language||i.usedLng),r.nest!==!1&&(t=this.interpolator.nest(t,function(){for(var p=arguments.length,h=new Array(p),g=0;g<p;g++)h[g]=arguments[g];return s&&s[0]===h[0]&&!r.context?(o.logger.warn(`It seems you are nesting recursively key: ${h[0]} in key: ${n[0]}`),null):o.translate(...h,n)},r)),r.interpolation&&this.interpolator.reset()}const l=r.postProcess||this.options.postProcess,c=ot(l)?[l]:l;return t!=null&&c&&c.length&&r.applyPostProcessor!==!1&&(t=QA.handle(c,t,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r,i,s,o,l;return ot(t)&&(t=[t]),t.forEach(c=>{if(this.isValidLookup(r))return;const d=this.extractFromKey(c,n),u=d.key;i=u;let f=d.namespaces;this.options.fallbackNS&&(f=f.concat(this.options.fallbackNS));const p=n.count!==void 0&&!ot(n.count),h=p&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),g=n.context!==void 0&&(ot(n.context)||typeof n.context=="number")&&n.context!=="",b=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);f.forEach(S=>{this.isValidLookup(r)||(l=S,!HN[`${b[0]}-${S}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(l)&&(HN[`${b[0]}-${S}`]=!0,this.logger.warn(`key "${i}" 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(x=>{if(this.isValidLookup(r))return;o=x;const w=[u];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(w,u,x,S,n);else{let k;p&&(k=this.pluralResolver.getSuffix(x,n.count,n));const E=`${this.options.pluralSeparator}zero`,j=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(p&&(w.push(u+k),n.ordinal&&k.indexOf(j)===0&&w.push(u+k.replace(j,this.options.pluralSeparator)),h&&w.push(u+E)),g){const A=`${u}${this.options.contextSeparator}${n.context}`;w.push(A),p&&(w.push(A+k),n.ordinal&&k.indexOf(j)===0&&w.push(A+k.replace(j,this.options.pluralSeparator)),h&&w.push(A+E))}}let v;for(;v=w.pop();)this.isValidLookup(r)||(s=v,r=this.getResource(x,S,v,n))}))})}),{res:r,usedKey:i,exactUsedKey:s,usedLng:o,usedNS:l}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,r,i):this.resourceStore.getResource(t,n,r,i)}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&&!ot(t.replace);let i=r?t.replace:t;if(r&&typeof t.count<"u"&&(i.count=t.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!r){i={...i};for(const s of n)delete i[s]}return i}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 Qg=e=>e.charAt(0).toUpperCase()+e.slice(1);class UN{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ws.create("languageUtils")}getScriptPartFromCode(t){if(t=jh(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=jh(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(ot(t)&&t.indexOf("-")>-1){if(typeof Intl<"u"&&typeof Intl.getCanonicalLocales<"u")try{let i=Intl.getCanonicalLocales(t)[0];if(i&&this.options.lowerCaseLng&&(i=i.toLowerCase()),i)return i}catch{}const n=["hans","hant","latn","cyrl","cans","mong","arab"];let r=t.split("-");return this.options.lowerCaseLng?r=r.map(i=>i.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=Qg(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]=Qg(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=Qg(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 i=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(i))&&(n=i)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const i=this.getLanguagePartFromCode(r);if(this.isSupportedCode(i))return n=i;n=this.options.supportedLngs.find(s=>{if(s===i)return s;if(!(s.indexOf("-")<0&&i.indexOf("-")<0)&&(s.indexOf("-")>0&&i.indexOf("-")<0&&s.substring(0,s.indexOf("-"))===i||s.indexOf(i)===0&&i.length>1))return s})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),ot(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),i=[],s=o=>{o&&(this.isSupportedCode(o)?i.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return ot(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(t))):ot(t)&&s(this.formatLanguageCode(t)),r.forEach(o=>{i.indexOf(o)<0&&s(this.formatLanguageCode(o))}),i}}let f7=[{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}],p7={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 h7=["v1","v2","v3"],m7=["v4"],WN={zero:0,one:1,two:2,few:3,many:4,other:5},g7=()=>{const e={};return f7.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:p7[t.fc]}})}),e};class y7{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=ws.create("pluralResolver"),(!this.options.compatibilityJSON||m7.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=g7(),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=jh(t==="dev"?"en":t),i=n.ordinal?"ordinal":"cardinal",s=JSON.stringify({cleanedCode:r,type:i});if(s in this.pluralRulesCache)return this.pluralRulesCache[s];let o;try{o=new Intl.PluralRules(r,{type:i})}catch{if(!t.match(/-|_/))return;const c=this.languageUtils.getLanguagePartFromCode(t);o=this.getRule(c,n)}return this.pluralRulesCache[s]=o,o}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(i=>`${n}${i}`)}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((i,s)=>WN[i]-WN[s]).map(i=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i}`):r.numbers.map(i=>this.getSuffix(t,i,n)):[]}getSuffix(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=this.getRule(t,r);return i?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i.select(n)}`:this.getSuffixRetroCompatible(i,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 i=t.numbers[r];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(i===2?i="plural":i===1&&(i=""));const s=()=>this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString();return this.options.compatibilityJSON==="v1"?i===1?"":typeof i=="number"?`_plural_${i.toString()}`:s():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?s():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!h7.includes(this.options.compatibilityJSON)}}const VN=function(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=i7(e,t,n);return!s&&i&&ot(n)&&(s=Hx(e,n,r),s===void 0&&(s=Hx(t,n,r))),s},Zg=e=>e.replace(/\$/g,"$$$$");class x7{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=ws.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:i,prefix:s,prefixEscaped:o,suffix:l,suffixEscaped:c,formatSeparator:d,unescapeSuffix:u,unescapePrefix:f,nestingPrefix:p,nestingPrefixEscaped:h,nestingSuffix:g,nestingSuffixEscaped:b,nestingOptionsSeparator:S,maxReplaces:x,alwaysFormat:w}=t.interpolation;this.escape=n!==void 0?n:o7,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=s?hl(s):o||"{{",this.suffix=l?hl(l):c||"}}",this.formatSeparator=d||",",this.unescapePrefix=u?"":f||"-",this.unescapeSuffix=this.unescapePrefix?"":u||"",this.nestingPrefix=p?hl(p):h||hl("$t("),this.nestingSuffix=g?hl(g):b||hl(")"),this.nestingOptionsSeparator=S||",",this.maxReplaces=x||1e3,this.alwaysFormat=w!==void 0?w:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,r)=>n&&n.source===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(t,n,r,i){let s,o,l;const c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},d=h=>{if(h.indexOf(this.formatSeparator)<0){const x=VN(n,c,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(x,void 0,r,{...i,...n,interpolationkey:h}):x}const g=h.split(this.formatSeparator),b=g.shift().trim(),S=g.join(this.formatSeparator).trim();return this.format(VN(n,c,b,this.options.keySeparator,this.options.ignoreJSONStructure),S,r,{...i,...n,interpolationkey:b})};this.resetRegExp();const u=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,f=i&&i.interpolation&&i.interpolation.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>Zg(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?Zg(this.escape(h)):Zg(h)}].forEach(h=>{for(l=0;s=h.regex.exec(t);){const g=s[1].trim();if(o=d(g),o===void 0)if(typeof u=="function"){const S=u(t,s,i);o=ot(S)?S:""}else if(i&&Object.prototype.hasOwnProperty.call(i,g))o="";else if(f){o=s[0];continue}else this.logger.warn(`missed to pass in variable ${g} for interpolating ${t}`),o="";else!ot(o)&&!this.useRawValueToEscape&&(o=$N(o));const b=h.safeValue(o);if(t=t.replace(s[0],b),f?(h.regex.lastIndex+=o.length,h.regex.lastIndex-=s[0].length):h.regex.lastIndex=0,l++,l>=this.maxReplaces)break}}),t}nest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,s,o;const l=(c,d)=>{const u=this.nestingOptionsSeparator;if(c.indexOf(u)<0)return c;const f=c.split(new RegExp(`${u}[ ]*{`));let p=`{${f[1]}`;c=f[0],p=this.interpolate(p,o);const h=p.match(/'/g),g=p.match(/"/g);(h&&h.length%2===0&&!g||g.length%2!==0)&&(p=p.replace(/'/g,'"'));try{o=JSON.parse(p),d&&(o={...d,...o})}catch(b){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,b),`${c}${u}${p}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,c};for(;i=this.nestingRegexp.exec(t);){let c=[];o={...r},o=o.replace&&!ot(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let d=!1;if(i[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(i[1])){const u=i[1].split(this.formatSeparator).map(f=>f.trim());i[1]=u.shift(),c=u,d=!0}if(s=n(l.call(this,i[1].trim(),o),o),s&&i[0]===t&&!ot(s))return s;ot(s)||(s=$N(s)),s||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${t}`),s=""),d&&(s=c.reduce((u,f)=>this.format(u,f,r.lng,{...r,interpolationkey:i[1].trim()}),s.trim())),t=t.replace(i[0],s),this.regexp.lastIndex=0}return t}}const w7=e=>{let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const i=r[1].substring(0,r[1].length-1);t==="currency"&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):t==="relativetime"&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach(o=>{if(o){const[l,...c]=o.split(":"),d=c.join(":").trim().replace(/^'+|'+$/g,""),u=l.trim();n[u]||(n[u]=d),d==="false"&&(n[u]=!1),d==="true"&&(n[u]=!0),isNaN(d)||(n[u]=parseInt(d,10))}})}return{formatName:t,formatOptions:n}},ml=e=>{const t={};return(n,r,i)=>{let s=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(s={...s,[i.interpolationkey]:void 0});const o=r+JSON.stringify(s);let l=t[o];return l||(l=e(jh(r),i),t[o]=l),l(n)}};class v7{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=ws.create("formatter"),this.options=t,this.formats={number:ml((n,r)=>{const i=new Intl.NumberFormat(n,{...r});return s=>i.format(s)}),currency:ml((n,r)=>{const i=new Intl.NumberFormat(n,{...r,style:"currency"});return s=>i.format(s)}),datetime:ml((n,r)=>{const i=new Intl.DateTimeFormat(n,{...r});return s=>i.format(s)}),relativetime:ml((n,r)=>{const i=new Intl.RelativeTimeFormat(n,{...r});return s=>i.format(s,r.range||"day")}),list:ml((n,r)=>{const i=new Intl.ListFormat(n,{...r});return s=>i.format(s)})},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()]=ml(n)}format(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=n.split(this.formatSeparator);if(s.length>1&&s[0].indexOf("(")>1&&s[0].indexOf(")")<0&&s.find(l=>l.indexOf(")")>-1)){const l=s.findIndex(c=>c.indexOf(")")>-1);s[0]=[s[0],...s.splice(1,l)].join(this.formatSeparator)}return s.reduce((l,c)=>{const{formatName:d,formatOptions:u}=w7(c);if(this.formats[d]){let f=l;try{const p=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},h=p.locale||p.lng||i.locale||i.lng||r;f=this.formats[d](l,h,{...u,...i,...p})}catch(p){this.logger.warn(p)}return f}else this.logger.warn(`there was no format function for ${d}`);return l},t)}}const b7=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class k7 extends hm{constructor(t,n,r){let i=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=i,this.logger=ws.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,i.backend,i)}queueLoad(t,n,r,i){const s={},o={},l={},c={};return t.forEach(d=>{let u=!0;n.forEach(f=>{const p=`${d}|${f}`;!r.reload&&this.store.hasResourceBundle(d,f)?this.state[p]=2:this.state[p]<0||(this.state[p]===1?o[p]===void 0&&(o[p]=!0):(this.state[p]=1,u=!1,o[p]===void 0&&(o[p]=!0),s[p]===void 0&&(s[p]=!0),c[f]===void 0&&(c[f]=!0)))}),u||(l[d]=!0)}),(Object.keys(s).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(s),pending:Object.keys(o),toLoadLanguages:Object.keys(l),toLoadNamespaces:Object.keys(c)}}loaded(t,n,r){const i=t.split("|"),s=i[0],o=i[1];n&&this.emit("failedLoading",s,o,n),!n&&r&&this.store.addResourceBundle(s,o,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=>{r7(c.loaded,[s],o),b7(c,t),n&&c.errors.push(n),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(d=>{l[d]||(l[d]={});const u=c.loaded[d];u.length&&u.forEach(f=>{l[d][f]===void 0&&(l[d][f]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",l),this.queue=this.queue.filter(c=>!c.done)}read(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,o=arguments.length>5?arguments[5]:void 0;if(!t.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:i,wait:s,callback:o});return}this.readingCalls++;const l=(d,u)=>{if(this.readingCalls--,this.waitingReads.length>0){const f=this.waitingReads.shift();this.read(f.lng,f.ns,f.fcName,f.tried,f.wait,f.callback)}if(d&&u&&i<this.maxRetries){setTimeout(()=>{this.read.call(this,t,n,r,i+1,s*2,o)},s);return}o(d,u)},c=this.backend[r].bind(this.backend);if(c.length===2){try{const d=c(t,n);d&&typeof d.then=="function"?d.then(u=>l(null,u)).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]:{},i=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."),i&&i();ot(t)&&(t=this.languageUtils.toResolveHierarchy(t)),ot(n)&&(n=[n]);const s=this.queueLoad(t,n,r,i);if(!s.toLoad.length)return s.pending.length||i(),null;s.toLoad.forEach(o=>{this.loadOne(o)})}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("|"),i=r[0],s=r[1];this.read(i,s,"read",void 0,void 0,(o,l)=>{o&&this.logger.warn(`${n}loading namespace ${s} for language ${i} failed`,o),!o&&l&&this.logger.log(`${n}loaded namespace ${s} for language ${i}`,l),this.loaded(t,o,l)})}saveMissing(t,n,r,i,s){let o=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={...o,isUpdate:s},d=this.backend.create.bind(this.backend);if(d.length<6)try{let u;d.length===5?u=d(t,n,r,i,c):u=d(t,n,r,i),u&&typeof u.then=="function"?u.then(f=>l(null,f)).catch(l):l(null,u)}catch(u){l(u)}else d(t,n,r,i,l,c)}!t||!t[0]||this.store.addResource(t[0],n,r,i)}}}const KN=()=>({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]),ot(e[1])&&(t.defaultValue=e[1]),ot(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}}),qN=e=>(ot(e.ns)&&(e.ns=[e.ns]),ot(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),ot(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),rp=()=>{},S7=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class md extends hm{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=qN(t),this.services={},this.logger=ws,this.modules={external:[]},S7(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&&(ot(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const i=KN();this.options={...i,...this.options,...qN(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...i.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);const s=u=>u?typeof u=="function"?new u:u:null;if(!this.options.isClone){this.modules.logger?ws.init(s(this.modules.logger),this.options):ws.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:typeof Intl<"u"&&(u=v7);const f=new UN(this.options);this.store=new BN(this.options.resources,this.options);const p=this.services;p.logger=ws,p.resourceStore=this.store,p.languageUtils=f,p.pluralResolver=new y7(f,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),u&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(p.formatter=s(u),p.formatter.init(p,this.options),this.options.interpolation.format=p.formatter.format.bind(p.formatter)),p.interpolator=new x7(this.options),p.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},p.backendConnector=new k7(s(this.modules.backend),p.resourceStore,p,this.options),p.backendConnector.on("*",function(h){for(var g=arguments.length,b=new Array(g>1?g-1:0),S=1;S<g;S++)b[S-1]=arguments[S];t.emit(h,...b)}),this.modules.languageDetector&&(p.languageDetector=s(this.modules.languageDetector),p.languageDetector.init&&p.languageDetector.init(p,this.options.detection,this.options)),this.modules.i18nFormat&&(p.i18nFormat=s(this.modules.i18nFormat),p.i18nFormat.init&&p.i18nFormat.init(this)),this.translator=new Eh(this.services,this.options),this.translator.on("*",function(h){for(var g=arguments.length,b=new Array(g>1?g-1:0),S=1;S<g;S++)b[S-1]=arguments[S];t.emit(h,...b)}),this.modules.external.forEach(h=>{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,r||(r=rp),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&u[0]!=="dev"&&(this.options.lng=u[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(u=>{this[u]=function(){return t.store[u](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(u=>{this[u]=function(){return t.store[u](...arguments),t}});const c=ru(),d=()=>{const u=(f,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(f,p)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return u(null,this.t.bind(this));this.changeLanguage(this.options.lng,u)};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]:rp;const i=ot(t)?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(i&&i.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const s=[],o=l=>{if(!l||l==="cimode")return;this.services.languageUtils.toResolveHierarchy(l).forEach(d=>{d!=="cimode"&&s.indexOf(d)<0&&s.push(d)})};i?o(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(c=>o(c)),this.options.preload&&this.options.preload.forEach(l=>o(l)),this.services.backendConnector.load(s,this.options.ns,l=>{!l&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(l)})}else r(null)}reloadResources(t,n,r){const i=ru();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=rp),this.services.backendConnector.reload(t,n,s=>{i.resolve(),r(s)}),i}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"&&QA.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 i=ru();this.emit("languageChanging",t);const s=c=>{this.language=c,this.languages=this.services.languageUtils.toResolveHierarchy(c),this.resolvedLanguage=void 0,this.setResolvedLanguage(c)},o=(c,d)=>{d?(s(d),this.translator.changeLanguage(d),this.isLanguageChangingTo=void 0,this.emit("languageChanged",d),this.logger.log("languageChanged",d)):this.isLanguageChangingTo=void 0,i.resolve(function(){return r.t(...arguments)}),n&&n(c,function(){return r.t(...arguments)})},l=c=>{!t&&!c&&this.services.languageDetector&&(c=[]);const d=ot(c)?c:this.services.languageUtils.getBestMatchFromCodes(c);d&&(this.language||s(d),this.translator.language||this.translator.changeLanguage(d),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(d)),this.loadResources(d,u=>{o(u,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),i}getFixedT(t,n,r){var i=this;const s=function(o,l){let c;if(typeof l!="object"){for(var d=arguments.length,u=new Array(d>2?d-2:0),f=2;f<d;f++)u[f-2]=arguments[f];c=i.options.overloadTranslationOptionHandler([o,l].concat(u))}else c={...l};c.lng=c.lng||s.lng,c.lngs=c.lngs||s.lngs,c.ns=c.ns||s.ns,c.keyPrefix!==""&&(c.keyPrefix=c.keyPrefix||r||s.keyPrefix);const p=i.options.keySeparator||".";let h;return c.keyPrefix&&Array.isArray(o)?h=o.map(g=>`${c.keyPrefix}${p}${g}`):h=c.keyPrefix?`${c.keyPrefix}${p}${o}`:o,i.t(h,c)};return ot(t)?s.lng=t:s.lngs=t,s.ns=n,s.keyPrefix=r,s}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],i=this.options?this.options.fallbackLng:!1,s=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const o=(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,o);if(l!==void 0)return l}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(r,t)&&(!i||o(s,t)))}loadNamespaces(t,n){const r=ru();return this.options.ns?(ot(t)&&(t=[t]),t.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{r.resolve(),n&&n(i)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=ru();ot(t)&&(t=[t]);const i=this.options.preload||[],s=t.filter(o=>i.indexOf(o)<0&&this.services.languageUtils.isSupportedCode(o));return s.length?(this.options.preload=i.concat(s),this.loadResources(o=>{r.resolve(),n&&n(o)}),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 UN(KN());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 md(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:rp;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const i={...this.options,...t,isClone:!0},s=new md(i);return(t.debug!==void 0||t.prefix!==void 0)&&(s.logger=s.logger.clone(t)),["store","services","language"].forEach(l=>{s[l]=this[l]}),s.services={...this.services},s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},r&&(s.store=new BN(this.store.data,i),s.services.resourceStore=s.store),s.translator=new Eh(s.services,i),s.translator.on("*",function(l){for(var c=arguments.length,d=new Array(c>1?c-1:0),u=1;u<c;u++)d[u-1]=arguments[u];s.emit(l,...d)}),s.init(i,n),s.translator.options=i,s.translator.backendConnector.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},s}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const or=md.createInstance();or.createInstance=md.createInstance;or.createInstance;or.dir;or.init;or.loadResources;or.reloadResources;or.use;or.changeLanguage;or.getFixedT;or.t;or.exists;or.setDefaultNamespace;or.hasLoadedNamespace;or.loadNamespaces;or.loadLanguages;function N7(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function gd(e){"@babel/helpers - typeof";return gd=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},gd(e)}function j7(e,t){if(gd(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(gd(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function C7(e){var t=j7(e,"string");return gd(t)=="symbol"?t:t+""}function E7(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,C7(r.key),r)}}function _7(e,t,n){return t&&E7(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var ZA=[],P7=ZA.forEach,A7=ZA.slice;function I7(e){return P7.call(A7.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}var YN=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,T7=function(t,n,r){var i=r||{};i.path=i.path||"/";var s=encodeURIComponent(n),o="".concat(t,"=").concat(s);if(i.maxAge>0){var l=i.maxAge-0;if(Number.isNaN(l))throw new Error("maxAge should be a Number");o+="; Max-Age=".concat(Math.floor(l))}if(i.domain){if(!YN.test(i.domain))throw new TypeError("option domain is invalid");o+="; Domain=".concat(i.domain)}if(i.path){if(!YN.test(i.path))throw new TypeError("option path is invalid");o+="; Path=".concat(i.path)}if(i.expires){if(typeof i.expires.toUTCString!="function")throw new TypeError("option expires is invalid");o+="; Expires=".concat(i.expires.toUTCString())}if(i.httpOnly&&(o+="; HttpOnly"),i.secure&&(o+="; Secure"),i.sameSite){var c=typeof i.sameSite=="string"?i.sameSite.toLowerCase():i.sameSite;switch(c){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return o},GN={create:function(t,n,r,i){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(s.expires=new Date,s.expires.setTime(s.expires.getTime()+r*60*1e3)),i&&(s.domain=i),document.cookie=T7(t,encodeURIComponent(n),s)},read:function(t){for(var n="".concat(t,"="),r=document.cookie.split(";"),i=0;i<r.length;i++){for(var s=r[i];s.charAt(0)===" ";)s=s.substring(1,s.length);if(s.indexOf(n)===0)return s.substring(n.length,s.length)}return null},remove:function(t){this.create(t,"",-1)}},R7={name:"cookie",lookup:function(t){var n;if(t.lookupCookie&&typeof document<"u"){var r=GN.read(t.lookupCookie);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupCookie&&typeof document<"u"&&GN.create(n.lookupCookie,t,n.cookieMinutes,n.cookieDomain,n.cookieOptions)}},L7={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 i=r.substring(1),s=i.split("&"),o=0;o<s.length;o++){var l=s[o].indexOf("=");if(l>0){var c=s[o].substring(0,l);c===t.lookupQuerystring&&(n=s[o].substring(l+1))}}}return n}},iu=null,XN=function(){if(iu!==null)return iu;try{iu=window!=="undefined"&&window.localStorage!==null;var t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{iu=!1}return iu},O7={name:"localStorage",lookup:function(t){var n;if(t.lookupLocalStorage&&XN()){var r=window.localStorage.getItem(t.lookupLocalStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupLocalStorage&&XN()&&window.localStorage.setItem(n.lookupLocalStorage,t)}},su=null,JN=function(){if(su!==null)return su;try{su=window!=="undefined"&&window.sessionStorage!==null;var t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{su=!1}return su},M7={name:"sessionStorage",lookup:function(t){var n;if(t.lookupSessionStorage&&JN()){var r=window.sessionStorage.getItem(t.lookupSessionStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupSessionStorage&&JN()&&window.sessionStorage.setItem(n.lookupSessionStorage,t)}},$7={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}},D7={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}},F7={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}},z7={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]}},eI=!1;try{document.cookie,eI=!0}catch{}var tI=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];eI||tI.splice(1,1);function B7(){return{order:tI,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(t){return t}}}var nI=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};N7(this,e),this.type="languageDetector",this.detectors={},this.init(t,n)}return _7(e,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n||{languageUtils:{}},this.options=I7(r,this.options||{},B7()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=function(s){return s.replace("-","_")}),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(R7),this.addDetector(L7),this.addDetector(O7),this.addDetector(M7),this.addDetector($7),this.addDetector(D7),this.addDetector(F7),this.addDetector(z7)}},{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 i=[];return n.forEach(function(s){if(r.detectors[s]){var o=r.detectors[s].lookup(r.options);o&&typeof o=="string"&&(o=[o]),o&&(i=i.concat(o))}}),i=i.map(function(s){return r.options.convertDetectedLanguage(s)}),this.services.languageUtils.getBestMatchFromCodes?i:i.length>0?i[0]:null}},{key:"cacheUserLanguage",value:function(n,r){var i=this;r||(r=this.options.caches),r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(n)>-1||r.forEach(function(s){i.detectors[s]&&i.detectors[s].cacheUserLanguage(n,i.options)}))}}])}();nI.type="languageDetector";const H7={name:"AgentFlow",tagline:"AI Workflow Orchestration"},U7={projects:"Projects",nodes:"Nodes",myNodes:"My Nodes",myFlows:"My Flows",skills:"Skills",flowEditor:"Flow Editor",settings:"Settings",back:"Back"},W7={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"},V7={success:"Success",failed:"Failed",pending:"Pending",running:"Running",skipped:"Skipped"},K7={agent:"Agent",control:"Control",tool:"Tool",start:"Start",end:"End"},q7={online:"Engine Online",offline:"Engine Offline",connecting:"Connecting…"},Y7={hub:"AgentFlow Hub",docs:"Documentation",github:"GitHub Repository"},G7={app:H7,nav:U7,common:W7,status:V7,nodeTypes:K7,engine:q7,links:Y7},X7="Flow Editor",J7="Nodes",Q7="Edges",Z7="Properties",eK={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"},tK={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}}"},nK={run:"Run Flow",stop:"Stop",resume:"Resume",validate:"Validate",export:"Export",import:"Import"},rK={nodeList:"Node List",runHistory:"Run History",validation:"Validation Results"},iK={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"},sK={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)"},oK={saving:"Saving...",saved:"Saved",saveFailed:"Save failed",runInTerminal:"Please use terminal to run"},aK={requirement:"Requirement Analysis",planning:"Technical Planning",code:"Code Execution",test:"Test Regression",normal:"Normal"},lK={phase:"Phase",allPhasesComplete:"All phases completed",currentPhaseComplete:"Current phase completed, waiting for confirmation..."},cK={node:"Node",text:"Text",file:"File",bool:"Boolean"},uK={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"},dK={title:"Keyboard Shortcuts",general:"General",saveDesc:"Save; when node properties sidebar is open, submit node first then save flow",shortcutsLabel:"Keyboard Shortcuts",jumpToNode:"Jump to node by ID",openNodePalette:"Open node palette",canvas:"Canvas",selectTool:"Select Tool",panTool:"Pan Tool",holdSpacePan:"Hold Space to temporarily pan",selectAll:"Select all nodes"},fK={title:"Jump to node",placeholder:"Type node ID or label…",empty:"No matching nodes",hintNavigate:"navigate",hintJump:"jump",hintClose:"close"},pK={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."},hK={mainNav:"Main Navigation"},mK={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'},gK={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):
|
|
142
|
-
{{summary}}`,step:"Step {{current}}/{{total}}: {{description}}",phaseGeneration:`Phased generation ({{count}} phases): {{labels}}
|
|
143
|
-
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}}"},yK={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"},xK={nodePalette:"Node Palette",noPipelineSelected:"No pipeline selected",moreRuns:"+{{count}} more",moreFlows:"+{{count}} more flows",runId:"Run ID: {{id}}"},wK={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}}"},vK={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"},bK={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"},kK={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"},SK={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"},NK={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"},jK={invalidPlaceholder:"Invalid placeholder: {{hint}}",empty:"(empty)",inputSubtitle:"Input · {{type}}",inputSubtitleNoType:"Input",outputSubtitle:"Output · {{type}}",outputSubtitleNoType:"Output",runtimeConst:"Runtime constant"},CK={justNow:"Just now",minutesAgo:"{{n}} min ago",hoursAgo:"{{n}} hr ago",yesterday:"Yesterday",daysAgo:"{{n}} days ago",milliseconds:"{{n}} ms",seconds:"{{n}} s"},EK={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"},_K={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."},PK={title:"Print Output: {{instanceId}}",expand:"Expand",restore:"Restore"},AK={save:"Save",cancel:"Cancel"},IK={title:"Run with Params",noParams:"No input params in this flow",run:"Run",cancel:"Cancel"},TK={title:"Run with Preset",noPresets:"No presets available",default:"Default run",run:"Run",cancel:"Cancel"},RK={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"},LK={title:X7,nodes:J7,edges:Q7,properties:Z7,node:eK,nodeProps:tK,actions:nK,panel:rK,palette:iK,pipeline:sK,status:oK,roles:aK,phases:lK,types:cK,runContext:uK,shortcuts:dK,jumpPalette:fK,emptyCanvas:pK,sidebar:hK,validation:mK,composer:gK,topbar:yK,palette2:xK,run:wK,fileEdit:vK,settings:bK,schedule:kK,history:SK,nodePropsError:NK,placeholder:jK,time:CK,userCheck:EK,userAsk:_K,toolPrint:PK,provideEdit:AK,runParams:IK,runPreset:TK,runConfig:RK},OK="Settings",MK={engine:"Engine Settings",preferences:"Global Preferences"},$K={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)."},DK={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..."}},FK={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."},zK={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."},BK={title:"Environment Variables",note:"Private to the current signed-in user; overrides service-level env at runtime",saving:"Saving...",key:"Key",value:"Value",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)"},HK={title:"System Status",normal:"Service normal",abnormal:"Some interfaces abnormal",cursorModels:"Cursor Models",opencodeModels:"OpenCode Models",claudeCodeModels:"Claude Code Models"},UK={title:"Shortcuts",projects:"Projects & Pipelines",flowEditor:"Node Canvas"},WK={title:"Language",description:"Select your preferred language for the interface",options:{zh:"中文",en:"English",ja:"日本語"}},VK={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."},KK={title:OK,crumb:MK,workspace:$K,cursor:DK,opencode:FK,claudeCode:zK,env:BK,system:HK,shortcuts:UK,language:WK,onboarding:VK},qK={thinking:"Thinking",result:"Result",reply:"Reply",error:"Error"},YK={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)"},GK={send:"Send",stop:"Stop",expand:"Expand",collapse:"Collapse",clear:"Clear"},XK={conversation:"Chat",conversationWithNumber:"Chat {{num}}",default:"Default"},JK={endSession:"End chat (will stop generation)",closeSession:"Close chat",newSession:"New chat",expandComposer:"Expand chat and output"},QK={hint:"Use the bottom input box for AI chat, with @node mentions, model selection, and more"},ZK={aiLabels:qK,placeholders:YK,actions:GK,labels:XK,tooltips:JK,rightPanel:QK},eq="Projects",tq="All",nq="Archived",rq="Nodes",iq="My Nodes",sq="My Flows",oq="Skills",aq="Active Projects",lq="Archived Pipelines",cq="Global Nodes",uq="Manage node versions published to the current workspace marketplace, {{count}} total.",dq="Manage flow snippets published to the current workspace marketplace, {{count}} total.",fq="Global Skills",pq="Create New Project",hq="New Pipeline",mq="SEARCH PIPELINES...",gq="SEARCH NODES...",yq="SEARCH FLOW SNIPPETS...",xq="SEARCH SKILLS...",wq="Refresh Resources",vq="Loading pipelines...",bq="Loading global resources...",kq="Filter result: {{count}} items (matching title, description, path and tags)",Sq="Archived pipelines can still be opened and edited; files are located in the _archived subdirectory of each pipelines directory.",Nq="Manage your distributed node architectures and monitoring pipelines. Drag flow.yaml or .zip into this page to import shared flows.",jq="Review all globally available node definitions, {{count}} total, including built-in, workspace, and marketplace nodes.",Cq="Review Composer-selectable skills, {{count}} total, including AgentFlow built-ins and workspace skills.",Eq="Executable building blocks for pipeline runtime",_q="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.",Pq="Published local node packages",Aq="Only node versions published to this workspace marketplace appear here. Inspect details and delete versions that no flow uses.",Iq="Published flow snippets",Tq="Flow snippets published from Pipeline or Workspace canvases appear here. Search and inspect them, then load them from the canvas flow palette.",Rq="Operating guides for Composer and agents",Lq="Skills tell AI which rules to follow for a task, how to change flows, and how to reuse project conventions.",Oq="No archived projects.",Mq="No active pipelines; archived items are in the Archived tab.",$q="No global nodes available.",Dq="No marketplace nodes have been published.",Fq="No flow snippets have been published. Select multiple canvas nodes and publish them first.",zq="No skills available.",Bq="No description.",Hq='No node matches "{{query}}".',Uq='No flow snippet matches "{{query}}".',Wq='No skill matches "{{query}}".',Vq="{{inputs}} in / {{outputs}} out",Kq="Flow Snippet",qq="{{nodes}} nodes / {{edges}} edges",Yq="Skill",Gq="Node detail",Xq="Flow snippet detail",Jq="Skill detail",Qq="Type",Zq="Source",eY="Package",tY="Version",nY="Path",rY="Editable",iY="Read only",sY="Editable",oY="Schema",aY="Inputs",lY="Outputs",cY="Runtime",uY="Node Body",dY="Files",fY="Usage",pY="No runtime manifest.",hY="No node body or README.",mY="No previewable files.",gY="Select a file to preview.",yY="Binary file preview is not supported.",xY="Large file; showing the first 256KB only.",wY="No pipelines using this node were found.",vY="Node Management",bY="Delete Node Version",kY="Deleting...",SY="AgentFlow checks all flow references before deleting; installed or used versions are kept.",NY="Delete {{id}}@{{version}}? This cannot be undone.",jY="Deleted {{id}}@{{version}}.",CY="{{count}} flow(s) still use it.",EY="No slots",_Y="Purpose",PY="This node is an execution unit in a pipeline. Its schema affects canvas wiring, parameter input, and runtime scheduling.",AY="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.",IY="Scale",TY="Snippet JSON",RY="This skill is injected into Composer as context for AI, constraining its decisions, edit strategy, and output format.",LY="SKILL.md Preview",OY="No preview content available.",MY="Select a resource to inspect details.",$Y="Failed to load pipeline list.",DY="No pipelines in current workspace.",FY="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.",zY='No pipelines found matching "{{query}}". Try different keywords or clear the search.',BY="Recent Activity",HY="No recent activity",UY="No recent activity matching the keyword",WY="Recent Run",VY="Recent Open",KY={builtin:"Built-in",workspace:"Workspace",user:"User"},qY={flow:"Flow",global:"Global",marketplace:"Marketplace"},YY={all:"All",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},GY={overview:"Overview",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},XY="Open to edit this pipeline in the node canvas.",JY={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>"},QY={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"},ZY={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"},eG={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"},tG={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"},nG={title:eq,all:tq,archived:nq,nodes:rq,myNodes:iq,myFlows:sq,skills:oq,activeProjects:aq,archivedPipelines:lq,globalNodes:cq,myNodesHint:uq,myFlowsHint:dq,globalSkills:fq,createNew:pq,newPipeline:hq,searchPipelines:mq,searchNodes:gq,searchFlows:yq,searchSkills:xq,refreshResources:wq,loadingPipelines:vq,loadingResources:bq,filterResult:kq,archivedHint:Sq,activeHint:Nq,nodesHint:jq,skillsHint:Cq,nodesPurposeTitle:Eq,nodesPurposeDesc:_q,myNodesPurposeTitle:Pq,myNodesPurposeDesc:Aq,myFlowsPurposeTitle:Iq,myFlowsPurposeDesc:Tq,skillsPurposeTitle:Rq,skillsPurposeDesc:Lq,noArchived:Oq,noActive:Mq,noNodes:$q,noMyNodes:Dq,noMyFlows:Fq,noSkills:zq,noDescription:Bq,noNodeMatch:Hq,noFlowSnippetMatch:Uq,noSkillMatch:Wq,nodeSlots:Vq,flowSnippet:Kq,flowSnippetNodes:qq,skill:Yq,nodeDetail:Gq,flowDetail:Xq,skillDetail:Jq,detailType:Qq,detailSource:Zq,detailPackage:eY,detailVersion:tY,detailPath:nY,detailEditable:rY,readOnly:iY,editable:sY,nodeSchema:oY,nodeInputs:aY,nodeOutputs:lY,nodeRuntime:cY,nodeBody:uY,nodeFiles:dY,nodeUsage:fY,noRuntimeManifest:pY,noNodeBody:hY,noNodeFiles:mY,selectNodeFile:gY,binaryFile:yY,fileTruncated:xY,noNodeUsage:wY,myNodeManagement:vY,deleteMyNode:bY,deletingMyNode:kY,deleteMyNodeHint:SY,deleteMyNodeConfirm:NY,deleteMyNodeSuccess:jY,deleteMyNodeUsedBy:CY,noSlots:EY,resourceMeaning:_Y,nodesMeaning:PY,myFlowsMeaning:AY,flowSnippetScale:IY,flowSnippetPreview:TY,skillsMeaning:RY,skillPreview:LY,skillPreviewEmpty:OY,selectResource:MY,loadFailed:$Y,noPipelines:DY,emptyHint:FY,noMatch:zY,recentActivity:BY,noRecentActivity:HY,noMatchRecent:UY,recentRun:WY,recentOpen:VY,sourceBadge:KY,resourceSource:qY,resourceFilter:YY,nodeDetailTabs:GY,defaultCardDesc:XY,hubCard:JY,newPipelineModal:QY,importModal:ZY,deleteModal:eG,archiveModal:tG},rG="Back",iG="Next",sG="Skip",oG="Done",aG="Start Creating",lG={intro:`Welcome to AgentFlow! This is a visual workflow orchestration tool.
|
|
144
|
-
|
|
145
|
-
Click the button below to create your first pipeline.`,hubIntro:`Don't want to start from scratch?
|
|
146
|
-
|
|
147
|
-
Browse ready-made pipelines on AgentFlow Hub — community-shared flows you can install and run in one click.`},cG={intro:`Now you're in the flow editor.
|
|
148
|
-
|
|
149
|
-
Describe your requirements in natural language in the input box below, and AI will generate the flow graph.
|
|
150
|
-
|
|
151
|
-
The left node panel allows you to freely drag, delete, and adjust connections.`,introEmpty:`The canvas is empty. Start creating your flow!
|
|
152
|
-
|
|
153
|
-
Describe your requirements in natural language in the input box below, and AI will generate the flow graph.
|
|
154
|
-
|
|
155
|
-
The left node panel allows you to freely drag, delete, and adjust connections.`},uG={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"},dG={back:rG,next:iG,skip:sG,done:oG,startCreate:aG,projects:lG,flow:cG,newPipeline:uG},fG={name:"AgentFlow",tagline:"AI 工作流编排"},pG={projects:"项目",nodes:"Nodes",myNodes:"我的 Nodes",myFlows:"我的流程",skills:"Skills",flowEditor:"流程编辑器",settings:"设置",back:"返回"},hG={loading:"加载中…",saving:"保存中…",save:"保存",cancel:"取消",delete:"删除",edit:"编辑",create:"创建",close:"关闭",confirm:"确认",copy:"复制",copied:"已复制!",refresh:"刷新",search:"搜索",filter:"筛选",success:"成功",error:"错误",warning:"警告",info:"信息",done:"完成",pending:"待处理",running:"运行中",notFound:"未找到",required:"必填",optional:"可选"},mG={success:"成功",failed:"失败",pending:"等待",running:"运行中",skipped:"跳过"},gG={agent:"Agent 节点",control:"控制节点",tool:"工具节点",start:"开始",end:"结束"},yG={online:"引擎在线",offline:"引擎离线",connecting:"连接中…"},xG={hub:"AgentFlow Hub",docs:"文档",github:"GitHub 仓库"},wG={app:fG,nav:pG,common:hG,status:mG,nodeTypes:gG,engine:yG,links:xG},vG="流程编辑器",bG="节点",kG="连线",SG="属性",NG={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:"编辑内容"},jG={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}}"},CG={run:"运行流程",stop:"停止",resume:"继续",validate:"校验",export:"导出",import:"导入"},EG={nodeList:"节点列表",runHistory:"运行历史",validation:"校验结果"},_G={workspace:"工作区",loading:"加载中…",archived:"已归档",noPipelines:"暂无流水线",more:"更多",moreFlows:"更多流程",noRuns:"暂无运行记录",searchNodes:"搜索节点",noComponents:"暂无可用组件(检查节点库目录)",noMatch:"无匹配节点,请调整搜索词",selectPipeline:"从上方选择一条流水线以加载组件与画布",validationWarnings:"校验警告(与 agentflow validate 槽位检查一致)",output:"输出",model:"模型",userDir:"用户目录",toggleRecentActivity:"展开或收起最近打开或最近运行"},PG={selectPipeline:"请从顶部下拉选择一条流水线",loadingProps:"加载节点属性…",pipelineId:"流水线 ID",diskPath:"磁盘路径",storageLocation:"存储位置",introduction:"介绍",introductionPlaceholder:"简要描述这条流水线的用途(写入 flow.yaml 的 ui.description)",metadata:"元数据",nodeCount:"节点数",nodesUnit:"个节点",loading:"加载中…",noRuns:"暂无运行记录(终端执行后会在工作区生成运行目录)"},AG={saving:"保存中…",saved:"已保存",saveFailed:"保存失败",runInTerminal:"运行请使用终端"},IG={requirement:"需求拆解",planning:"技术规划",code:"代码执行",test:"测试回归",normal:"普通"},TG={phase:"阶段",allPhasesComplete:"所有阶段完成",currentPhaseComplete:"当前阶段完成,等待确认继续…"},RG={node:"节点",text:"文本",file:"文件",bool:"布尔"},LG={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:"等待"},OG={title:"快捷键",general:"常规",saveDesc:"保存;节点属性侧栏打开时先提交节点再保存 flow",shortcutsLabel:"快捷键",jumpToNode:"按 ID 跳转到节点",openNodePalette:"打开节点面板",canvas:"画布",selectTool:"选择工具",panTool:"平移工具",holdSpacePan:"按住空格临时平移",selectAll:"全选所有节点"},MG={title:"跳转到节点",placeholder:"输入节点 ID 或名称…",empty:"未匹配到节点",hintNavigate:"切换",hintJump:"跳转",hintClose:"关闭"},$G={title:"开始构建你的流程",text:"在下方 AI 输入框中描述你的流程,或从左侧面板拖拽节点到画布",composerHint:"使用 AI Composer 构建 AgentFlow",composerSub:"从左侧拖入节点,或在<strong>下方输入框</strong>中用自然语言描述工作流。<br/>按 <kbd>?</kbd> 查看快捷键。"},DG={mainNav:"主导航"},FG={flowWarningAriaLabel:"流程校验警告",reloadFromServer:"从服务器重新加载流程并刷新校验",reloadFromServerShort:"从服务器重新加载",closeBanner:"关闭校验警告横幅",nodePrefix:"节点",focusNodeAriaLabel:"在画布中选中并定位节点 {{nodeId}}",slotWarningCount:"槽位校验 {{count}} 条(已隐藏)",show:"显示",shortcutHint:"按 ? 查看快捷键",shortcutHintLabel:"快捷键",inputSlotNoEdge:' 的 input 槽位 "{{slotName}}"({{handle}})无对应 edge 连接',outputSlotNoEdge:' 的 output 槽位 "{{slotName}}"({{handle}})无对应 edge 连接'},zG={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}} 步):
|
|
156
|
-
{{summary}}`,step:"步骤 {{current}}/{{total}}: {{description}}",phaseGeneration:`分阶段生成({{count}} 阶段):{{labels}}
|
|
157
|
-
当前:{{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}}"},BG={currentPipeline:"当前流水线",backToEdit:"返回编辑",backToProjects:"返回项目",executionLog:"执行日志",history:"历史",pipelineSettings:"流水线设置",shortcutsLabel:"快捷键",shortcutsTitle:"快捷键 (?)",deletePipeline:"删除流水线",resumeTitle:"在同一 run 目录继续执行(uuid={{uuid}})",resumeTitleNoUuid:"尚未收到 apply-start,将发起新的 run",rerunTitle:"从头开始新的运行",runOptions:"运行选项",runWithParams:"带参数运行",runWithPreset:"指定预设运行",editRun:"编辑运行参数",startRun:"开始执行",stopRun:"停止后台运行"},HG={nodePalette:"节点调色板",noPipelineSelected:"未选择流水线",moreRuns:"+{{count}} 更多",moreFlows:"+{{count}} 更多流程",runId:"运行 ID: {{id}}"},UG={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}} 的分支"},WG={close:"关闭",loading:"加载中…",placeholder:"文件内容",largeFileWarning:"文件较大,编辑器性能可能受影响",reset:"重置",aiEdit:"AI 修改",aiRunning:"AI 处理中…",save:"保存",saving:"保存中…",saved:"已保存"},VG={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:"已复制"},KG={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:"定时配置已保存"},qG={title:"执行历史",summary:"执行结果汇总",successCount:"{{count}} 成功",failedCount:"{{count}} 失败",stoppedCount:"{{count}} 已停止",interruptedCount:"{{count}} 已中断",runningCount:"{{count}} 进行中",success:"成功",failed:"失败",stopped:"已停止",interrupted:"已中断",running:"进行中",unknown:"未知",runLabel:"运行 #{{id}}",enterRunView:"进入该次运行的画布与日志态"},YG={invalidInstanceId:"实例 ID 格式无效:仅允许英文字母、数字、下划线、短横线,且不能以数字开头。",duplicateInstanceId:"该实例 ID 已存在,请换一个。",loadFlowFailed:"读取 flow 失败",loadNodesFailed:"读取节点库失败"},GG={invalidPlaceholder:"无效占位符: {{hint}}",empty:"(空)",inputSubtitle:"输入 · {{type}}",inputSubtitleNoType:"输入",outputSubtitle:"输出 · {{type}}",outputSubtitleNoType:"输出",runtimeConst:"运行时常量"},XG={justNow:"刚刚",minutesAgo:"{{n}} 分钟前",hoursAgo:"{{n}} 小时前",yesterday:"昨天",daysAgo:"{{n}} 天前",milliseconds:"{{n}} 毫秒",seconds:"{{n}} 秒"},JG={title:"用户确认 ({{instanceId}})",edit:"编辑",save:"保存",cancel:"取消",aiEditPlaceholder:"输入 AI 修改指令,如:删除第二项、合并前两项…",aiEditBtn:"AI 修改",aiEditStarted:"AI 正在修改内容…",aiEditDone:"AI 修改完成",aiEditFailed:"AI 修改失败",contentSaved:"内容已保存",saveFailed:"保存失败",close:"关闭",continue:"继续执行",hint:"编辑或使用 AI 修改后点击保存,然后点击「继续执行」恢复流程"},QG={title:"用户选择 ({{instanceId}})",hint:"请从下方选项中选择一项以继续流程",submitting:"提交中…",submitFailed:"提交失败",close:"关闭",noOptions:"该节点未配置选项,请先在编辑器中为 output 槽位添加条目。"},ZG={title:"Print 输出: {{instanceId}}",expand:"放大",restore:"还原"},eX={save:"保存",cancel:"取消"},tX={title:"带参数运行",noParams:"此流程无输入参数",run:"运行",cancel:"取消"},nX={title:"指定预设运行",noPresets:"无可用预设",default:"默认运行",run:"运行",cancel:"取消"},rX={preset:"预设",default:"默认",newPreset:"新建预设",deletePreset:"删除预设",presetNamePlaceholder:"预设名称",inputParams:"输入参数",noProvideNodes:"此流程无 provide 节点",filePathPlaceholder:"文件路径…",stringValuePlaceholder:"值…",presetSaved:"预设已保存",presetDeleted:"预设已删除",savePreset:"保存当前预设",expandInput:"编辑内容"},iX={title:vG,nodes:bG,edges:kG,properties:SG,node:NG,nodeProps:jG,actions:CG,panel:EG,palette:_G,pipeline:PG,status:AG,roles:IG,phases:TG,types:RG,runContext:LG,shortcuts:OG,jumpPalette:MG,emptyCanvas:$G,sidebar:DG,validation:FG,composer:zG,topbar:BG,palette2:HG,run:UG,fileEdit:WG,settings:VG,schedule:KG,history:qG,nodePropsError:YG,placeholder:GG,time:XG,userCheck:JG,userAsk:QG,toolPrint:ZG,provideEdit:eX,runParams:tX,runPreset:nX,runConfig:rX},sX="设置",oX={engine:"引擎设置",preferences:"全局首选项"},aX={title:"工作区",currentPath:"当前工作区根目录",placeholder:"加载中…",copyPath:"复制路径",description:"流水线与节点清单将相对于此目录解析(由启动 UI 时传入)。"},lX={title:"Cursor CLI",status:{cached:"已缓存",notCached:"未缓存"},modelPreviewLabel:"Cursor 模型名称列表",modelList:{cached:"模型清单已缓存",empty:"暂无模型列表",count:"{{count}} 条",fetchedAt:"更新 {{time}}",never:"尚未拉取",refresh:"刷新清单",fetching:"拉取中…"}},cX={modelPreviewLabel:"OpenCode 模型名称列表",title:"OpenCode CLI",status:{ready:"就绪",notFound:"未找到"},provider:"方案 / Provider 标识",providerPlaceholder:"例如 bailian-coding-plan",saving:"正在保存并更新清单…",description:"对应 CLI opencode models <provider> 的参数;停止输入后会写入用户目录 config 并刷新 model-lists.json。"},uX={title:"Claude Code CLI",status:{ready:"就绪",notFound:"未找到"},modelPreviewLabel:"Claude Code 模型名称列表",description:"内置模型列表(Claude Code CLI 无 models 子命令);刷新将探测 claude 二进制是否在 PATH 中。首次使用请先执行 claude /login。"},dX={title:"环境变量",note:"当前登录用户私有,运行时优先于服务全局环境变量",saving:"正在保存...",key:"键",value:"值",add:"添加",delete:"删除 {{key}}",invalidKey:"环境变量名必须以字母或下划线开头,且只能包含字母、数字和下划线。",newKey:"新环境变量键",newValue:"值(密钥请谨慎)"},fX={title:"系统状态",normal:"服务正常",abnormal:"部分接口异常",cursorModels:"Cursor 模型",opencodeModels:"OpenCode 模型",claudeCodeModels:"Claude Code 模型"},pX={title:"快捷入口",projects:"项目与流水线",flowEditor:"节点画布"},hX={title:"语言",description:"选择界面显示语言",options:{zh:"中文",en:"English",ja:"日本語"}},mX={title:"新手引导",description:"重新启动产品引导流程,了解 AgentFlow 的核心功能。",reset:"重置引导",resetSuccess:"已重置,下次访问将自动启动引导"},gX={title:sX,crumb:oX,workspace:aX,cursor:lX,opencode:cX,claudeCode:uX,env:dX,system:fX,shortcuts:pX,language:hX,onboarding:mX},yX={thinking:"思考",result:"结果",reply:"回复",error:"错误"},xX={input:"让 AI 协助编辑此节点…",waiting:"等待响应…",selectedEmpty:"在画布上选择节点,或在输入框用 @ 选择实例(Instances)或节点类型(Node)",textarea:"描述你的流程或让 AI 协助编辑(⌘/Ctrl+Enter 发送)"},wX={send:"发送",stop:"停止",expand:"展开",collapse:"收起",clear:"清空"},vX={conversation:"对话",conversationWithNumber:"对话 {{num}}",default:"默认"},bX={endSession:"结束对话(将停止生成)",closeSession:"关闭对话",newSession:"新建对话",expandComposer:"展开对话与输出"},kX={hint:"使用底部输入框进行 AI 对话,支持 @节点、选择模型等功能"},SX={aiLabels:yX,placeholders:xX,actions:wX,labels:vX,tooltips:bX,rightPanel:kX},NX="项目",jX="全部",CX="已归档",EX="Nodes",_X="我的 Nodes",PX="我的流程",AX="Skills",IX="活跃项目",TX="已归档流水线",RX="全局 Nodes",LX="管理当前工作区已发布到本地 Marketplace 的节点,共 {{count}} 个。",OX="管理当前工作区已发布到本地 Marketplace 的流程片段,共 {{count}} 个。",MX="全局 Skills",$X="创建新项目",DX="新建流水线",FX="搜索流水线…",zX="搜索 nodes…",BX="搜索流程片段…",HX="搜索 skills…",UX="刷新资源",WX="加载流水线列表…",VX="加载全局资源…",KX="筛选结果:{{count}} 条(匹配标题、描述、路径与标签)",qX="已归档的流水线仍可打开与编辑;文件位于各 pipelines 目录下的 _archived。",YX="管理分布式节点架构与监控流水线。可将 flow.yaml 或 .zip 拖入本页导入分享流程。",GX="查看当前可用的全局节点定义,共 {{count}} 个;包含内置、工作区与 marketplace 节点。",XX="查看当前 Composer 可选择的 skills,共 {{count}} 个;包含 AgentFlow 内置与工作区 skills。",JX="流程运行时的可执行积木",QX="Nodes 决定画布上能拖什么、节点有哪些输入输出,以及运行时走 agent、control、provide 或 marketplace 哪类逻辑。",ZX="已发布的本地节点包",eJ="这里仅显示你发布到当前 Workspace Marketplace 的节点版本;可查看详情并删除未被 Flow 使用的版本。",tJ="已发布的流程片段",nJ="这里显示从 Pipeline 或 Workspace 画布发布的流程片段,可搜索、检查内容,并从画布的流程面板中加载复用。",rJ="Composer/Agent 的操作指南",iJ="Skills 告诉 AI 在特定任务里应遵守什么规则、如何修改 flow、如何复用项目约定。",sJ="暂无归档项目。",oJ="暂无未归档流水线;已归档项在 Archived 标签中查看。",aJ="暂无可用全局 nodes。",lJ="暂无已发布的 marketplace nodes。",cJ="暂无已发布的流程片段。可在画布中选中多个节点后发布。",uJ="暂无可用 skills。",dJ="暂无描述。",fJ="未找到与「{{query}}」匹配的 node。",pJ="未找到与「{{query}}」匹配的流程片段。",hJ="未找到与「{{query}}」匹配的 skill。",mJ="{{inputs}} in / {{outputs}} out",gJ="流程片段",yJ="{{nodes}} 节点 / {{edges}} 连线",xJ="Skill",wJ="Node 详情",vJ="流程片段详情",bJ="Skill 详情",kJ="类型",SJ="来源",NJ="包",jJ="版本",CJ="路径",EJ="可编辑",_J="只读",PJ="可编辑",AJ="Schema",IJ="输入",TJ="输出",RJ="Runtime",LJ="节点内容",OJ="Files",MJ="Usage",$J="暂无 runtime manifest。",DJ="暂无节点正文或 README。",FJ="暂无可预览文件。",zJ="请选择文件查看内容。",BJ="二进制文件暂不支持预览。",HJ="文件较大,仅显示前 256KB。",UJ="暂未发现使用此 node 的流水线。",WJ="节点管理",VJ="删除节点版本",KJ="删除中…",qJ="删除前会检查所有 Flow 引用;仍被安装或使用的版本不会被删除。",YJ="确定删除 {{id}}@{{version}}?此操作不可撤销。",GJ="已删除 {{id}}@{{version}}。",XJ="仍有 {{count}} 个 Flow 使用它。",JJ="无槽位",QJ="作用",ZJ="这个 node 是 pipeline 的执行单元。它的 schema 会影响画布连线、参数输入和运行时调度。",eQ="流程片段是固定化流程的一部分。加载时会复制这组节点、连线和布局到当前画布,不覆盖已有内容。",tQ="规模",nQ="片段 JSON",rQ="这个 skill 会作为 Composer 的上下文注入给 AI,用于约束 AI 的判断、修改方式和输出口径。",iQ="SKILL.md 预览",sQ="暂无可预览内容。",oQ="请选择一个资源查看详情。",aQ="未能加载流水线列表。",lQ="当前工作区暂无流水线。",cQ="在仓库根目录执行 {{code1}} 并确认工作区包含 {{code2}} 或用户目录下的流水线;亦可点击 New Pipeline 新建。",uQ="未找到与「{{query}}」匹配的流水线。可尝试其他关键词,或点击清除搜索。",dQ="最近打开或最近运行",fQ="暂无打开或运行记录",pQ="暂无与关键词匹配的最近记录",hQ="最近运行",mQ="最近打开",gQ={builtin:"内置",workspace:"工作区",user:"用户"},yQ={flow:"Flow",global:"Global",marketplace:"Marketplace"},xQ={all:"全部",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},wQ={overview:"概览",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},vQ="打开以在节点画布中编辑此流水线。",bQ={eyebrow:"AgentFlow Hub",title:"浏览社区流程",desc:"发现并一键安装社区分享的现成流水线。",cta:"前往 Hub",cliHint:"或通过 CLI 安装:agentflow download <slug>"},kQ={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:"关闭"},SQ={title:"导入流水线",lead:"已选择文件「{{filename}}」。请确认流水线名称与保存位置;ZIP 将保留目录内脚本等文件。",nameLabel:"名称(必填)",namePlaceholder:"例如 my_shared_flow",nameHint:"须以英文字母开头,仅可使用字母、数字、下划线 _ 与连字符 -",locationLabel:"保存位置",userDir:"用户目录(~/agentflow/pipelines)",workspaceDir:"当前工作区(.workspace/agentflow/pipelines)",changeFile:"更换文件…",importFailed:"导入失败",importing:"导入中…",importAndOpen:"导入并打开",cancel:"取消",close:"关闭"},NQ={title:"删除流水线",lead:"将永久删除磁盘上的流水线目录(含 flow.yaml、脚本等),无法撤销。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",deleteFailed:"删除失败",deleteTimeout:"删除请求超时,请重试(可先检查终端中的 UI 服务日志)",delete:"删除",deleting:"删除中…",confirmDelete:"确认删除",cancel:"取消",close:"关闭"},jQ={title:"归档流水线",lead:"归档后流水线将移入「Archived」列表,仍可从该列表打开与编辑。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",archiveFailed:"归档失败",archive:"归档",archiving:"归档中…",confirmArchive:"确认归档",cancel:"取消",close:"关闭"},CQ={title:NX,all:jX,archived:CX,nodes:EX,myNodes:_X,myFlows:PX,skills:AX,activeProjects:IX,archivedPipelines:TX,globalNodes:RX,myNodesHint:LX,myFlowsHint:OX,globalSkills:MX,createNew:$X,newPipeline:DX,searchPipelines:FX,searchNodes:zX,searchFlows:BX,searchSkills:HX,refreshResources:UX,loadingPipelines:WX,loadingResources:VX,filterResult:KX,archivedHint:qX,activeHint:YX,nodesHint:GX,skillsHint:XX,nodesPurposeTitle:JX,nodesPurposeDesc:QX,myNodesPurposeTitle:ZX,myNodesPurposeDesc:eJ,myFlowsPurposeTitle:tJ,myFlowsPurposeDesc:nJ,skillsPurposeTitle:rJ,skillsPurposeDesc:iJ,noArchived:sJ,noActive:oJ,noNodes:aJ,noMyNodes:lJ,noMyFlows:cJ,noSkills:uJ,noDescription:dJ,noNodeMatch:fJ,noFlowSnippetMatch:pJ,noSkillMatch:hJ,nodeSlots:mJ,flowSnippet:gJ,flowSnippetNodes:yJ,skill:xJ,nodeDetail:wJ,flowDetail:vJ,skillDetail:bJ,detailType:kJ,detailSource:SJ,detailPackage:NJ,detailVersion:jJ,detailPath:CJ,detailEditable:EJ,readOnly:_J,editable:PJ,nodeSchema:AJ,nodeInputs:IJ,nodeOutputs:TJ,nodeRuntime:RJ,nodeBody:LJ,nodeFiles:OJ,nodeUsage:MJ,noRuntimeManifest:$J,noNodeBody:DJ,noNodeFiles:FJ,selectNodeFile:zJ,binaryFile:BJ,fileTruncated:HJ,noNodeUsage:UJ,myNodeManagement:WJ,deleteMyNode:VJ,deletingMyNode:KJ,deleteMyNodeHint:qJ,deleteMyNodeConfirm:YJ,deleteMyNodeSuccess:GJ,deleteMyNodeUsedBy:XJ,noSlots:JJ,resourceMeaning:QJ,nodesMeaning:ZJ,myFlowsMeaning:eQ,flowSnippetScale:tQ,flowSnippetPreview:nQ,skillsMeaning:rQ,skillPreview:iQ,skillPreviewEmpty:sQ,selectResource:oQ,loadFailed:aQ,noPipelines:lQ,emptyHint:cQ,noMatch:uQ,recentActivity:dQ,noRecentActivity:fQ,noMatchRecent:pQ,recentRun:hQ,recentOpen:mQ,sourceBadge:gQ,resourceSource:yQ,resourceFilter:xQ,nodeDetailTabs:wQ,defaultCardDesc:vQ,hubCard:bQ,newPipelineModal:kQ,importModal:SQ,deleteModal:NQ,archiveModal:jQ},EQ="返回",_Q="下一步",PQ="跳过",AQ="完成",IQ="开始创建",TQ={intro:`欢迎使用 AgentFlow!这是一个可视化流程编排工具。
|
|
158
|
-
|
|
159
|
-
点击下方按钮开始创建你的第一个流水线。`,hubIntro:`不想从零开始?
|
|
160
|
-
|
|
161
|
-
在 AgentFlow Hub 浏览社区分享的现成流水线,一键安装即可运行。`},RQ={intro:`现在进入流程编辑器。
|
|
162
|
-
|
|
163
|
-
在下方输入框用自然语言描述你的需求,AI 会自动生成流程图。
|
|
164
|
-
|
|
165
|
-
左侧节点面板可以自由拖拽、删除和调整连接。`,introEmpty:`画布为空,开始创建你的流程吧!
|
|
166
|
-
|
|
167
|
-
在下方输入框用自然语言描述需求,AI 会自动生成流程图。
|
|
168
|
-
|
|
169
|
-
左侧节点面板可以自由拖拽、删除和调整连接。`},LQ={guideTitle:"首次创建提示",guideDesc:"输入名称和描述后,AI 会自动生成流程图。你可以在编辑器中自由调整节点和连接。",nameHintGuide:"例如:MyFirstFlow(字母开头,支持数字和下划线)",descPlaceholderGuide:"例如:实现用户登录功能,包含注册、验证、授权",descHintGuide:"描述越详细,AI 生成的流程越准确",createGuide:"创建并开始编辑",typeNode:"节点引用类型",typeStr:"字符串类型",typeFile:"文件路径类型",typeBool:"布尔值类型"},OQ={back:EQ,next:_Q,skip:PQ,done:AQ,startCreate:IQ,projects:TQ,flow:RQ,newPipeline:LQ},MQ={en:{common:G7,flow:LK,settings:KK,composer:ZK,project:nG,onboarding:dG},zh:{common:wG,flow:iX,settings:gX,composer:SX,project:CQ,onboarding:OQ}};or.use(nI).use(vL).init({resources:MQ,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 $Q=[{code:"zh",name:"中文",flag:"🇨🇳"},{code:"en",name:"English",flag:"🇬🇧"}];function DQ(e){return or.changeLanguage(e)}const Ux="agentflow-settings-opencode-plan-v1";function ey(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 rI(){return`e_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function FQ(e){return/^[A-Za-z_][A-Za-z0-9_]*$/.test(String(e||"").trim())}function ip(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(!n||typeof n!="object")continue;const r=String(n.key??"").trim(),i=String(n.value??""),s=String(n.id??"").trim()||rI();!r&&!i||t.push({id:s,key:r,value:i})}return t}function QN(){try{return localStorage.getItem(Ux)??""}catch{return""}}function zQ(e){return e?e.length<=6?"•".repeat(e.length):`${"•".repeat(Math.min(20,e.length-4))}${e.slice(-4)}`:""}function BQ(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 HQ(){const{t:e,i18n:t}=Ut(["common","settings"]),n=t.language||"zh",[r,i]=m.useState(""),[s,o]=m.useState(""),[l,c]=m.useState({cursor:[],opencode:[],claudeCode:[],cursorFetchedAt:null,opencodeFetchedAt:null,claudeCodeFetchedAt:null}),[d,u]=m.useState(""),[f,p]=m.useState(!1),[h,g]=m.useState(!1),[b,S]=m.useState(""),[x,w]=m.useState([]),[v,k]=m.useState(""),[E,j]=m.useState(!1),[A,$]=m.useState(""),[I,F]=m.useState(""),[L,T]=m.useState(""),q=m.useRef(null),D=m.useRef(!1),W=m.useRef(!1),O=m.useRef(""),U=m.useCallback(async()=>{o("");try{const se=await fetch("/api/ui-context");if(!se.ok)throw new Error("HTTP "+se.status);const pe=await se.json();i(typeof pe.workspaceRoot=="string"?pe.workspaceRoot:"")}catch(se){o(String(se.message||se)),i("")}},[]),P=m.useCallback(async()=>{u(""),p(!0);try{const se=await fetch("/api/model-lists");if(!se.ok)throw new Error("HTTP "+se.status);const pe=await se.json();c(ey(pe))}catch(se){u(String(se.message||se))}finally{p(!1)}},[]),R=m.useCallback(async()=>{k("");try{const se=await fetch("/api/user-env"),pe=await se.json().catch(()=>({}));if(!se.ok)throw new Error(typeof pe.error=="string"?pe.error:"HTTP "+se.status);const ae=ip(Array.isArray(pe.env)?pe.env:[]);O.current=JSON.stringify(ae),w(ae)}catch(se){w([]),k(String(se.message||se))}finally{W.current=!0}},[]),C=m.useCallback(async se=>{const pe=ip(se);j(!0),k("");try{const ae=await fetch("/api/user-env",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:pe})}),me=await ae.json().catch(()=>({}));if(!ae.ok)throw new Error(typeof me.error=="string"?me.error:"HTTP "+ae.status);const ze=ip(Array.isArray(me.env)?me.env:[]);O.current=JSON.stringify(ze),w(ze)}catch(ae){k(String(ae.message||ae))}finally{j(!1)}},[]),G=m.useCallback(async()=>{u(""),p(!0);try{const se=await fetch("/api/update-model-lists",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:L.trim()})}),pe=await se.json().catch(()=>({}));if(!se.ok)throw new Error(typeof pe.error=="string"?pe.error:"HTTP "+se.status);c(ey(pe.modelLists))}catch(se){u(String(se.message||se))}finally{p(!1)}},[L]);m.useEffect(()=>{U(),P(),R(),(async()=>{try{const se=await fetch("/api/agentflow-config");if(se.ok){const pe=await se.json(),ae=typeof pe.opencodeProvider=="string"?pe.opencodeProvider:"";T(ae),q.current=ae;try{localStorage.setItem(Ux,ae)}catch{}}else{const pe=QN();T(pe),q.current=pe}}catch{const se=QN();T(se),q.current=se}finally{D.current=!0}})()},[U,P,R]),m.useEffect(()=>{if(!W.current||JSON.stringify(ip(x))===O.current)return;const pe=setTimeout(()=>{C(x)},350);return()=>clearTimeout(pe)},[x,C]),m.useEffect(()=>{if(!D.current)return;const se=L.trim();if(se===q.current)return;const pe=setTimeout(()=>{(async()=>{g(!0),S("");try{const ae=await fetch("/api/agentflow-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:se})}),me=await ae.json().catch(()=>({}));if(!ae.ok)throw new Error(typeof me.error=="string"?me.error:"HTTP "+ae.status);q.current=se;try{localStorage.setItem(Ux,se)}catch{}me.modelLists&&c(ey(me.modelLists))}catch(ae){S(String(ae.message||ae))}finally{g(!1)}})()},450);return()=>clearTimeout(pe)},[L]);const J=l.cursor.length>0,B=l.opencode.length>0,te=l.claudeCode.length>0,de=m.useCallback(()=>{var se;r&&((se=navigator.clipboard)==null||se.writeText(r))},[r]),ce=m.useCallback(()=>{const se=A.trim(),pe=I;if(se){if(!FQ(se)){k(e("settings:env.invalidKey"));return}w(ae=>[...ae,{id:rI(),key:se,value:pe}]),$(""),F("")}},[A,I,e]),ue=m.useCallback(se=>{w(pe=>pe.filter(ae=>ae.id!==se))},[]),re=m.useCallback(se=>{const pe=se.target.value;DQ(pe)},[]),ge=se=>{const pe=BQ(se,n);return pe?e("settings:cursor.modelList.fetchedAt",{time:pe}):e("settings:cursor.modelList.never")};return a.jsxs("div",{className:"af-settings-page",children:[a.jsx("header",{className:"af-settings-top",children:a.jsxs("div",{className:"af-settings-crumb","aria-label":e("settings:title"),children:[a.jsx("span",{className:"af-settings-crumb-muted",children:e("settings:crumb.engine")}),a.jsx("span",{className:"af-settings-crumb-sep","aria-hidden":!0,children:"/"}),a.jsx("span",{className:"af-settings-crumb-active",children:e("settings:crumb.preferences")})]})}),a.jsx("div",{className:"af-settings-body",children:a.jsxs("div",{className:"af-settings-inner",children:[a.jsxs("header",{className:"af-settings-hero",children:[a.jsxs("h1",{className:"af-settings-h1",children:[e("common:app.name")," ",e("settings:title")]}),a.jsx("p",{className:"af-settings-lead",children:e("settings:workspace.description")}),s?a.jsx("p",{className:"af-err af-settings-api-hint",children:s}):null,d?a.jsx("p",{className:"af-err af-settings-api-hint",children:d}):null,v?a.jsx("p",{className:"af-err af-settings-api-hint",children:v}):null]}),a.jsxs("div",{className:"af-settings-layout",children:[a.jsxs("div",{className:"af-settings-bento",children:[a.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--low af-set-workspace",children:[a.jsxs("div",{className:"af-set-card-inner",children:[a.jsxs("div",{className:"af-set-card-head",children:[a.jsx("span",{className:"material-symbols-outlined af-set-icon af-set-icon--secondary",children:"folder_managed"}),a.jsx("h2",{className:"af-set-h2",children:e("settings:workspace.title")})]}),a.jsx("label",{className:"af-set-label",htmlFor:"af-workspace-path",children:e("settings:workspace.currentPath")}),a.jsxs("div",{className:"af-set-input-wrap",children:[a.jsx("input",{id:"af-workspace-path",className:"af-set-input af-set-input--mono",type:"text",readOnly:!0,value:r,placeholder:e("common:loading")}),a.jsx("button",{type:"button",className:"af-set-input-suffix",onClick:de,"aria-label":e("settings:workspace.copyPath"),disabled:!r,children:a.jsx("span",{className:"material-symbols-outlined",children:"content_copy"})})]}),a.jsx("p",{className:"af-set-hint",children:e("settings:workspace.description")})]}),a.jsx("div",{className:"af-set-watermark","aria-hidden":!0,children:a.jsx("span",{className:"material-symbols-outlined",children:"account_tree"})})]}),a.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--high",children:[a.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[a.jsx("h2",{className:"af-set-h2 af-set-h2--caps",children:"Cursor CLI"}),a.jsx("span",{className:"af-set-badge"+(J?" af-set-badge--ok":" af-set-badge--muted"),children:e(J?"settings:cursor.status.cached":"settings:cursor.status.notCached")})]}),a.jsxs("div",{className:"af-set-cli-block",children:[a.jsx("div",{className:"af-set-cli-icon",children:a.jsx("span",{className:"material-symbols-outlined af-set-icon--tertiary",children:J?"check_circle":"hourglass_empty"})}),a.jsxs("div",{children:[a.jsx("p",{className:"af-set-cli-title",children:e(J?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),a.jsx("p",{className:"af-set-cli-mono",children:J?e("settings:cursor.modelList.count",{count:l.cursor.length})+" · "+ge(l.cursorFetchedAt):e("settings:cursor.modelList.refresh")})]})]}),J?a.jsx("pre",{className:"af-set-model-preview","aria-label":e("settings:cursor.modelPreviewLabel"),children:l.cursor.join(`
|
|
170
|
-
`)}):null,a.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>G(),disabled:f,children:e(f?"settings:cursor.modelList.fetching":"settings:cursor.modelList.refresh")})]}),a.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--high",children:[a.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[a.jsx("h2",{className:"af-set-h2 af-set-h2--caps",children:"OpenCode"}),a.jsx("span",{className:"af-set-badge"+(B?" af-set-badge--ok":" af-set-badge--err"),children:e(B?"settings:opencode.status.ready":"settings:opencode.status.notFound")})]}),a.jsx("p",{className:"af-set-p",children:e("settings:opencode.description")}),a.jsxs("div",{children:[a.jsx("label",{className:"af-set-label-sm",htmlFor:"af-opencode-plan",children:e("settings:opencode.provider")}),a.jsx("input",{id:"af-opencode-plan",className:"af-set-input af-set-input--sm af-set-input--mono",type:"text",value:L,onChange:se=>T(se.target.value),placeholder:e("settings:opencode.providerPlaceholder"),autoComplete:"off"}),h?a.jsx("p",{className:"af-set-hint af-set-hint--inline","aria-live":"polite",children:e("settings:opencode.saving")}):null,b?a.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",role:"alert",children:b}):null]}),B?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"af-set-cli-mono af-set-cli-mono--block",children:e("settings:cursor.modelList.count",{count:l.opencode.length})+" · "+ge(l.opencodeFetchedAt)}),a.jsx("pre",{className:"af-set-model-preview","aria-label":e("settings:opencode.modelPreviewLabel"),children:l.opencode.join(`
|
|
171
|
-
`)})]}):null,a.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>G(),disabled:f,children:e(f?"settings:cursor.modelList.fetching":"settings:cursor.modelList.refresh")})]}),a.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--high",children:[a.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[a.jsx("h2",{className:"af-set-h2 af-set-h2--caps",children:e("settings:claudeCode.title")}),a.jsx("span",{className:"af-set-badge"+(te?" af-set-badge--ok":" af-set-badge--err"),children:e(te?"settings:claudeCode.status.ready":"settings:claudeCode.status.notFound")})]}),a.jsxs("div",{className:"af-set-cli-block",children:[a.jsx("div",{className:"af-set-cli-icon",children:a.jsx("span",{className:"material-symbols-outlined af-set-icon--tertiary",children:te?"check_circle":"hourglass_empty"})}),a.jsxs("div",{children:[a.jsx("p",{className:"af-set-cli-title",children:e(te?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),a.jsx("p",{className:"af-set-cli-mono",children:te?e("settings:cursor.modelList.count",{count:l.claudeCode.length})+" · "+ge(l.claudeCodeFetchedAt):e("settings:cursor.modelList.refresh")})]})]}),a.jsx("p",{className:"af-set-p",children:e("settings:claudeCode.description")}),te?a.jsx("pre",{className:"af-set-model-preview","aria-label":e("settings:claudeCode.modelPreviewLabel"),children:l.claudeCode.join(`
|
|
172
|
-
`)}):null,a.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>G(),disabled:f,children:e(f?"settings:cursor.modelList.fetching":"settings:cursor.modelList.refresh")})]}),a.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--low af-set-env",children:[a.jsxs("div",{className:"af-set-env-head",children:[a.jsxs("div",{className:"af-set-card-head",children:[a.jsx("div",{className:"af-set-env-icon-wrap",children:a.jsx("span",{className:"material-symbols-outlined af-set-icon--primary",children:"variables"})}),a.jsx("h2",{className:"af-set-h2",children:e("settings:env.title")})]}),a.jsx("span",{className:"af-set-env-note",children:e(E?"settings:env.saving":"settings:env.note")})]}),a.jsxs("div",{className:"af-set-env-rows",children:[x.map(se=>a.jsxs("div",{className:"af-set-env-row",children:[a.jsxs("div",{className:"af-set-env-cell",children:[a.jsx("span",{className:"af-set-env-k",children:e("settings:env.key")}),a.jsx("code",{className:"af-set-code-key",children:se.key||"—"})]}),a.jsxs("div",{className:"af-set-env-cell af-set-env-cell--grow",children:[a.jsx("span",{className:"af-set-env-k",children:e("settings:env.value")}),a.jsx("code",{className:"af-set-code-val",children:zQ(se.value)})]}),a.jsx("div",{className:"af-set-env-actions",children:a.jsx("button",{type:"button",className:"af-set-env-del","aria-label":e("settings:env.delete",{key:se.key}),onClick:()=>ue(se.id),children:a.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})})]},se.id)),a.jsxs("div",{className:"af-set-env-row af-set-env-row--draft",children:[a.jsx("div",{className:"af-set-env-cell",children:a.jsx("input",{className:"af-set-input af-set-input--dashed af-set-input--mono",placeholder:"KEY_NAME",value:A,onChange:se=>$(se.target.value),"aria-label":e("settings:env.newKey")})}),a.jsx("div",{className:"af-set-env-cell af-set-env-cell--grow",children:a.jsx("input",{className:"af-set-input af-set-input--dashed af-set-input--mono",type:"password",placeholder:e("settings:env.newValue"),value:I,onChange:se=>F(se.target.value),"aria-label":e("settings:env.newValue")})}),a.jsx("div",{className:"af-set-env-actions",children:a.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:ce,disabled:!A.trim(),children:[a.jsx("span",{className:"material-symbols-outlined",children:"add"}),e("settings:env.add")]})})]})]})]})]}),a.jsxs("aside",{className:"af-settings-rail","aria-label":e("settings:title"),children:[a.jsxs("div",{className:"af-set-rail-card af-set-rail-card--accent",children:[a.jsxs("div",{className:"af-set-rail-inner",children:[a.jsx("h3",{className:"af-set-rail-h3",children:e("settings:system.title")}),a.jsxs("div",{className:"af-set-health-line",children:[a.jsx("span",{className:"af-set-pulse-dot","aria-hidden":!0}),a.jsx("span",{className:"af-set-health-label",children:e(!s&&!d?"settings:system.normal":"settings:system.abnormal")})]}),a.jsxs("div",{className:"af-set-meter",children:[a.jsxs("div",{className:"af-set-meter-row",children:[a.jsx("span",{children:e("settings:system.cursorModels")}),a.jsx("span",{children:l.cursor.length})]}),a.jsx("div",{className:"af-set-meter-bar",children:a.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,l.cursor.length>0?12+l.cursor.length*3:4)}%`}})})]}),a.jsxs("div",{className:"af-set-meter",children:[a.jsxs("div",{className:"af-set-meter-row",children:[a.jsx("span",{children:e("settings:system.opencodeModels")}),a.jsx("span",{children:l.opencode.length})]}),a.jsx("div",{className:"af-set-meter-bar",children:a.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,l.opencode.length>0?12+l.opencode.length*3:4)}%`}})})]}),a.jsxs("div",{className:"af-set-meter",children:[a.jsxs("div",{className:"af-set-meter-row",children:[a.jsx("span",{children:e("settings:system.claudeCodeModels")}),a.jsx("span",{children:l.claudeCode.length})]}),a.jsx("div",{className:"af-set-meter-bar",children:a.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,l.claudeCode.length>0?12+l.claudeCode.length*3:4)}%`}})})]})]}),a.jsx("div",{className:"af-set-rail-watermark","aria-hidden":!0,children:a.jsx("span",{className:"material-symbols-outlined",children:"vital_signs"})})]}),a.jsxs("div",{className:"af-set-rail-card",children:[a.jsx("h3",{className:"af-set-rail-h3 af-set-rail-h3--sm",children:e("settings:language.title")}),a.jsxs("div",{className:"af-set-language-selector",children:[a.jsx("select",{className:"af-set-input af-set-input--sm",value:n,onChange:re,"aria-label":e("settings:language.description"),children:$Q.map(se=>a.jsxs("option",{value:se.code,children:[se.flag," ",se.name]},se.code))}),a.jsx("p",{className:"af-set-hint",children:e("settings:language.description")})]})]})]})]})]})})]})}function iI(e){return t=>typeof t===e}var UQ=iI("function"),WQ=e=>e===null,ZN=e=>Object.prototype.toString.call(e).slice(8,-1)==="RegExp",e1=e=>!VQ(e)&&!WQ(e)&&(UQ(e)||typeof e=="object"),VQ=iI("undefined");function KQ(e,t,n){return ZQ(n,e,t)?!0:(eZ(n,e,t),e.constructor!==t.constructor?!1:Array.isArray(e)&&Array.isArray(t)?qQ(e,t,n):e instanceof Map&&t instanceof Map?XQ(e,t,n):e instanceof Set&&t instanceof Set?QQ(e,t):e instanceof WeakMap||e instanceof WeakSet?!1:ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)?YQ(e,t):ZN(e)&&ZN(t)?e.source===t.source&&e.flags===t.flags:e instanceof Error&&t instanceof Error?GQ(e,t,n):e.valueOf!==Object.prototype.valueOf?e.valueOf()===t.valueOf():e.toString!==Object.prototype.toString?e.toString()===t.toString():JQ(e,t,n))}function Md(e,t,n){return e===t||Number.isNaN(e)&&Number.isNaN(t)?!0:!e||!e1(e)||!t||!e1(t)?!1:KQ(e,t,n)}function qQ(e,t,n){const{length:r}=e;if(r!==t.length)return!1;for(let i=r;i--!==0;)if(!Md(e[i],t[i],n))return!1;return!0}function YQ(e,t){if(e.byteLength!==t.byteLength)return!1;const n=new DataView(e.buffer),r=new DataView(t.buffer);let i=e.byteLength;for(;i--;)if(n.getUint8(i)!==r.getUint8(i))return!1;return!0}function GQ(e,t,n){return e.message===t.message&&e.name===t.name&&Md(e.cause,t.cause,n)}function XQ(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(!Md(r[1],t.get(r[0]),n))return!1;return!0}function JQ(e,t,n){const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(let i=r.length;i--!==0;)if(!Object.prototype.hasOwnProperty.call(t,r[i]))return!1;for(let i=r.length;i--!==0;){const s=r[i];if(!(s==="_owner"&&e.$$typeof)&&!Md(e[s],t[s],n))return!1}return!0}function QQ(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 ZQ(e,t,n){var r;return((r=e.get(t))==null?void 0:r.has(n))??!1}function eZ(e,t,n){let r=e.get(t);r||(r=new WeakSet,e.set(t,r)),r.add(n)}function Lv(e,t){return Md(e,t,new WeakMap)}function ty(){var e;return!!(typeof window<"u"&&((e=window==null?void 0:window.document)!=null&&e.createElement))}function tZ(e,...t){e&&e.removeEventListener&&e.removeEventListener(...t)}function nZ(e,...t){e&&e.addEventListener&&e.addEventListener(...t)}function rZ(){const e=m.useRef(!0);return e.current?(e.current=!1,!0):e.current}function iZ(e,t){const n=rZ();m.useEffect(()=>{if(!n)return e()},t)}function sI(e){const t=m.useRef(void 0);return m.useEffect(()=>{t.current=e}),t.current}function sZ(e,t){const n=m.useRef(t);return Lv(t,n.current)||(n.current=t),m.useMemo(e,n.current)}function oZ(e){m.useEffect(()=>{e()},[])}function aZ(e=0){const[t,n]=m.useState({height:ty()?window.innerHeight:0,width:ty()?window.innerWidth:0}),r=m.useRef(0),i=m.useRef(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(()=>{n({width:window.innerWidth,height:window.innerHeight})},e)});return m.useEffect(()=>{if(!ty())return()=>{};const s=i.current;return n({height:window.innerHeight,width:window.innerWidth}),nZ(window,"resize",s),()=>{tZ(window,"resize",s)}},[]),t}var lZ=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","URL","WeakMap","WeakSet"],cZ=["bigint","boolean","null","number","string","symbol","undefined"];function $d(e){const t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(uZ(t))return t}function Qi(e){return t=>$d(t)===e}function uZ(e){return lZ.includes(e)}function vc(e){return t=>typeof t===e}function dZ(e){return cZ.includes(e)}var fZ=["innerHTML","ownerDocument","style","attributes","nodeValue"],Dd=e=>Array.isArray(e),pZ=e=>$d(e)==="AsyncGeneratorFunction",hZ=Qi("AsyncFunction"),mZ=vc("bigint"),gZ=e=>e===!0||e===!1,yZ=Qi("Date"),xZ=Qi("Error"),Yo=vc("function"),wZ=Qi("GeneratorFunction"),vZ=e=>typeof e=="number"&&Number.isInteger(e),Wx=Qi("Map"),oI=e=>Number.isNaN(e),Ov=e=>e===null,aI=Qi("Function"),bZ=Qi("Promise"),kZ=Qi("RegExp"),Vx=Qi("Set"),Fd=vc("string"),SZ=vc("symbol"),Mv=vc("undefined"),NZ=Qi("WeakMap"),jZ=Qi("WeakSet"),$v=e=>Ov(e)||Mv(e),lI=e=>!Mv(e),CZ=e=>vc("number")(e)&&!oI(e),EZ=e=>Fd(e)&&e.trim().length>0,_Z=e=>{if(!Fd(e)||e.length===0)return!1;const t=e.trim();return t.length>0&&Number.isFinite(Number(t))},mm=e=>!$v(e)&&(Yo(e)||typeof e=="object"),cI=e=>{if($d(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})},PZ=e=>Ov(e)||dZ(typeof e),AZ=e=>$d(e)==="URL",uI=e=>!$v(e)&&Yo(e[Symbol.iterator]),IZ=e=>uI(e)&&Yo(e.next)&&Yo(e.throw),TZ=e=>Yo(e)&&/^class\s/.test(e.toString()),RZ=(e,t)=>!Dd(e)||!Yo(t)?!1:e.every(n=>t(n)),LZ=e=>mm(e)&&!cI(e)&&e.nodeType===1&&Fd(e.nodeName)&&fZ.every(t=>t in e),OZ=e=>Fd(e)&&e.length===0||Dd(e)&&e.length===0||mm(e)&&!Wx(e)&&!Vx(e)&&Object.keys(e).length===0||Vx(e)&&e.size===0||Wx(e)&&e.size===0,MZ=(e,t)=>!e||!t?!1:Object.getPrototypeOf(e)===t.prototype,$Z=(e,t)=>Dd(e)?e.indexOf(t)>-1:!1,DZ=(e,t,n)=>{if(!mm(e)||!t)return!1;const r=e[t];return Yo(n)?n(r):lI(r)};function ut(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(Dd(e))return"Array";if(aI(e))return"Function";const t=$d(e);return t||"Object"}ut.array=Dd;ut.arrayOf=RZ;ut.asyncGeneratorFunction=pZ;ut.asyncFunction=hZ;ut.bigint=mZ;ut.boolean=gZ;ut.class=TZ;ut.date=yZ;ut.defined=lI;ut.domElement=LZ;ut.empty=OZ;ut.error=xZ;ut.function=Yo;ut.generator=IZ;ut.generatorFunction=wZ;ut.instanceOf=MZ;ut.integer=vZ;ut.iterable=uI;ut.map=Wx;ut.nan=oI;ut.null=Ov;ut.nullOrUndefined=$v;ut.nonEmptyString=EZ;ut.number=CZ;ut.numericString=_Z;ut.object=mm;ut.oneOf=$Z;ut.plainFunction=aI;ut.plainObject=cI;ut.primitive=PZ;ut.promise=bZ;ut.propertyOf=DZ;ut.regexp=kZ;ut.set=Vx;ut.string=Fd;ut.symbol=SZ;ut.undefined=Mv;ut.url=AZ;ut.weakMap=NZ;ut.weakSet=jZ;var hr=ut;/* v8 ignore next -- @preserve */var FZ=function(e){return Object.prototype.hasOwnProperty.call(e,"props")},zZ=function(e,t){return e+yd(t)},yd=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(zZ,""):FZ(e)&&Object.prototype.hasOwnProperty.call(e.props,"children")?yd(e.props.children):""};yd.default=yd;var BZ=yd;const ny=Xo(BZ);var dI={exports:{}};(function(e){const t=Object.getPrototypeOf({});function n(){return function(s){return typeof s=="object"&&s!==null&&!(s instanceof RegExp)&&!(s instanceof Date)}}function r(i){function s(E){return E!=="constructor"&&E!=="prototype"&&E!=="__proto__"}function o(E){let j=0;const A=E.length,$=new Array(A);for(j;j<A;++j)$[j]=x(E[j]);return $}function l(E){const j={};if(p&&Object.getPrototypeOf(E)!==t)return p(E);const A=f(E);let $,I,F;for($=0,I=A.length;$<I;++$)s(F=A[$])&&(j[F]=x(E[F]));return j}function c(E,j){const A=E.length,$=j.length;let I=0;const F=new Array(A+$);for(I;I<A;++I)F[I]=x(E[I]);for(I=0;I<$;++I)F[I+A]=x(j[I]);return F}const d=Object.prototype.propertyIsEnumerable;function u(E){const j=Object.keys(E),A=Object.getOwnPropertySymbols(E);for(let $=0,I=A.length;$<I;++$)d.call(E,A[$])&&j.push(A[$]);return j}const f=i!=null&&i.symbols?u:Object.keys,p=typeof(i==null?void 0:i.cloneProtoObject)=="function"?i.cloneProtoObject:void 0,h=typeof(i==null?void 0:i.isMergeableObject)=="function"?i.isMergeableObject:n(),g=(i==null?void 0:i.onlyDefinedProperties)===!0;function b(E){return typeof E!="object"||E===null}const S=i&&typeof i.mergeArray=="function"?i.mergeArray({clone:x,deepmerge:v,getKeys:f,isMergeableObject:h}):c;function x(E){return h(E)?Array.isArray(E)?o(E):l(E):E}function w(E,j){const A={},$=f(E),I=f(j);let F,L,T;for(F=0,L=$.length;F<L;++F)s(T=$[F])&&I.indexOf(T)===-1&&(A[T]=x(E[T]));for(F=0,L=I.length;F<L;++F)if(s(T=I[F]))if(T in E)$.indexOf(T)!==-1&&(p&&h(j[T])&&Object.getPrototypeOf(j[T])!==t?A[T]=p(j[T]):A[T]=v(E[T],j[T]));else{if(g&&typeof j[T]>"u")continue;A[T]=x(j[T])}return A}function v(E,j){if(g&&typeof j>"u")return x(E);const A=Array.isArray(j),$=Array.isArray(E);return b(j)?j:h(E)?A&&$?S(E,j):A!==$?x(j):w(E,j):x(j)}function k(){switch(arguments.length){case 0:return{};case 1:return x(arguments[0]);case 2:return v(arguments[0],arguments[1])}let E;for(let j=0,A=arguments.length;j<A;++j)E=v(E,arguments[j]);return E}return i!=null&&i.all?k:v}e.exports=r,e.exports.default=r,e.exports.deepmerge=r,Object.defineProperty(e.exports,"isMergeableObject",{get:n})})(dI);var HZ=dI.exports;const UZ=Xo(HZ);var WZ=new Error("Element already at target scroll position"),VZ=new Error("Scroll cancelled"),KZ=Math.min,t1=Date.now,qZ={left:n1("scrollLeft"),top:n1("scrollTop")};function n1(e){return function(n,r,i,s){i=i||{},typeof i=="function"&&(s=i,i={}),typeof s!="function"&&(s=GZ);var o=t1(),l=n[e],c=i.ease||YZ,d=isNaN(i.duration)?350:+i.duration,u=!1;return l===r?s(WZ,n[e]):requestAnimationFrame(p),f;function f(){u=!0}function p(h){if(u)return s(VZ,n[e]);var g=t1(),b=KZ(1,(g-o)/d),S=c(b);n[e]=S*(r-l)+l,b<1?requestAnimationFrame(p):requestAnimationFrame(function(){s(null,n[e])})}}}function YZ(e){return .5*(1-Math.cos(Math.PI*e))}function GZ(){}const XZ=Xo(qZ);var fI={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.Scrollparent=n()})(Lu,function(){function t(r){var i=getComputedStyle(r,null).getPropertyValue("overflow");return i.indexOf("scroll")>-1||i.indexOf("auto")>-1}function n(r){if(r instanceof HTMLElement||r instanceof SVGElement){for(var i=r.parentNode;i.parentNode;){if(t(i))return i;i=i.parentNode}return document.scrollingElement||document.documentElement}}return n})})(fI);var JZ=fI.exports;const pI=Xo(JZ),QZ=["top","right","bottom","left"],r1=["start","end"],i1=QZ.reduce((e,t)=>e.concat(t,t+"-"+r1[0],t+"-"+r1[1]),[]),pc=Math.min,Ia=Math.max,_h=Math.round,sp=Math.floor,Ns=e=>({x:e,y:e}),ZZ={left:"right",right:"left",bottom:"top",top:"bottom"};function Kx(e,t,n){return Ia(e,pc(t,n))}function bc(e,t){return typeof e=="function"?e(t):e}function to(e){return e.split("-")[0]}function js(e){return e.split("-")[1]}function hI(e){return e==="x"?"y":"x"}function Dv(e){return e==="y"?"height":"width"}function Io(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Fv(e){return hI(Io(e))}function mI(e,t,n){n===void 0&&(n=!1);const r=js(e),i=Fv(e),s=Dv(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=Ah(o)),[o,Ah(o)]}function eee(e){const t=Ah(e);return[Ph(e),t,Ph(t)]}function Ph(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const s1=["left","right"],o1=["right","left"],tee=["top","bottom"],nee=["bottom","top"];function ree(e,t,n){switch(e){case"top":case"bottom":return n?t?o1:s1:t?s1:o1;case"left":case"right":return t?tee:nee;default:return[]}}function iee(e,t,n,r){const i=js(e);let s=ree(to(e),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(Ph)))),s}function Ah(e){const t=to(e);return ZZ[t]+e.slice(t.length)}function see(e){return{top:0,right:0,bottom:0,left:0,...e}}function gI(e){return typeof e!="number"?see(e):{top:e,right:e,bottom:e,left:e}}function Ih(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function a1(e,t,n){let{reference:r,floating:i}=e;const s=Io(t),o=Fv(t),l=Dv(o),c=to(t),d=s==="y",u=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,p=r[l]/2-i[l]/2;let h;switch(c){case"top":h={x:u,y:r.y-i.height};break;case"bottom":h={x:u,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:f};break;case"left":h={x:r.x-i.width,y:f};break;default:h={x:r.x,y:r.y}}switch(js(t)){case"start":h[o]-=p*(n&&d?-1:1);break;case"end":h[o]+=p*(n&&d?-1:1);break}return h}async function oee(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:s,rects:o,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:p=!1,padding:h=0}=bc(t,e),g=gI(h),S=l[p?f==="floating"?"reference":"floating":f],x=Ih(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(S)))==null||n?S:S.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:d,rootBoundary:u,strategy:c})),w=f==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,v=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),k=await(s.isElement==null?void 0:s.isElement(v))?await(s.getScale==null?void 0:s.getScale(v))||{x:1,y:1}:{x:1,y:1},E=Ih(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:w,offsetParent:v,strategy:c}):w);return{top:(x.top-E.top+g.top)/k.y,bottom:(E.bottom-x.bottom+g.bottom)/k.y,left:(x.left-E.left+g.left)/k.x,right:(E.right-x.right+g.right)/k.x}}const aee=50,lee=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,l=o.detectOverflow?o:{...o,detectOverflow:oee},c=await(o.isRTL==null?void 0:o.isRTL(t));let d=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:f}=a1(d,r,c),p=r,h=0;const g={};for(let b=0;b<s.length;b++){const S=s[b];if(!S)continue;const{name:x,fn:w}=S,{x:v,y:k,data:E,reset:j}=await w({x:u,y:f,initialPlacement:r,placement:p,strategy:i,middlewareData:g,rects:d,platform:l,elements:{reference:e,floating:t}});u=v??u,f=k??f,g[x]={...g[x],...E},j&&h<aee&&(h++,typeof j=="object"&&(j.placement&&(p=j.placement),j.rects&&(d=j.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):j.rects),{x:u,y:f}=a1(d,p,c)),b=-1)}return{x:u,y:f,placement:p,strategy:i,middlewareData:g}},cee=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:o,elements:l,middlewareData:c}=t,{element:d,padding:u=0}=bc(e,t)||{};if(d==null)return{};const f=gI(u),p={x:n,y:r},h=Fv(i),g=Dv(h),b=await o.getDimensions(d),S=h==="y",x=S?"top":"left",w=S?"bottom":"right",v=S?"clientHeight":"clientWidth",k=s.reference[g]+s.reference[h]-p[h]-s.floating[g],E=p[h]-s.reference[h],j=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let A=j?j[v]:0;(!A||!await(o.isElement==null?void 0:o.isElement(j)))&&(A=l.floating[v]||s.floating[g]);const $=k/2-E/2,I=A/2-b[g]/2-1,F=pc(f[x],I),L=pc(f[w],I),T=F,q=A-b[g]-L,D=A/2-b[g]/2+$,W=Kx(T,D,q),O=!c.arrow&&js(i)!=null&&D!==W&&s.reference[g]/2-(D<T?F:L)-b[g]/2<0,U=O?D<T?D-T:D-q:0;return{[h]:p[h]+U,data:{[h]:W,centerOffset:D-W-U,...O&&{alignmentOffset:U}},reset:O}}});function uee(e,t,n){return(e?[...n.filter(i=>js(i)===e),...n.filter(i=>js(i)!==e)]:n.filter(i=>to(i)===i)).filter(i=>e?js(i)===e||(t?Ph(i)!==i:!1):!0)}const dee=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,r,i;const{rects:s,middlewareData:o,placement:l,platform:c,elements:d}=t,{crossAxis:u=!1,alignment:f,allowedPlacements:p=i1,autoAlignment:h=!0,...g}=bc(e,t),b=f!==void 0||p===i1?uee(f||null,h,p):p,S=await c.detectOverflow(t,g),x=((n=o.autoPlacement)==null?void 0:n.index)||0,w=b[x];if(w==null)return{};const v=mI(w,s,await(c.isRTL==null?void 0:c.isRTL(d.floating)));if(l!==w)return{reset:{placement:b[0]}};const k=[S[to(w)],S[v[0]],S[v[1]]],E=[...((r=o.autoPlacement)==null?void 0:r.overflows)||[],{placement:w,overflows:k}],j=b[x+1];if(j)return{data:{index:x+1,overflows:E},reset:{placement:j}};const A=E.map(F=>{const L=js(F.placement);return[F.placement,L&&u?F.overflows.slice(0,2).reduce((T,q)=>T+q,0):F.overflows[0],F.overflows]}).sort((F,L)=>F[1]-L[1]),I=((i=A.filter(F=>F[2].slice(0,js(F[0])?2:3).every(L=>L<=0))[0])==null?void 0:i[0])||A[0][0];return I!==l?{data:{index:x+1,overflows:E},reset:{placement:I}}:{}}}},fee=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:b=!0,...S}=bc(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const x=to(i),w=Io(l),v=to(l)===l,k=await(c.isRTL==null?void 0:c.isRTL(d.floating)),E=p||(v||!b?[Ah(l)]:eee(l)),j=g!=="none";!p&&j&&E.push(...iee(l,b,g,k));const A=[l,...E],$=await c.detectOverflow(t,S),I=[];let F=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&I.push($[x]),f){const D=mI(i,o,k);I.push($[D[0]],$[D[1]])}if(F=[...F,{placement:i,overflows:I}],!I.every(D=>D<=0)){var L,T;const D=(((L=s.flip)==null?void 0:L.index)||0)+1,W=A[D];if(W&&(!(f==="alignment"?w!==Io(W):!1)||F.every(P=>Io(P.placement)===w?P.overflows[0]>0:!0)))return{data:{index:D,overflows:F},reset:{placement:W}};let O=(T=F.filter(U=>U.overflows[0]<=0).sort((U,P)=>U.overflows[1]-P.overflows[1])[0])==null?void 0:T.placement;if(!O)switch(h){case"bestFit":{var q;const U=(q=F.filter(P=>{if(j){const R=Io(P.placement);return R===w||R==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(R=>R>0).reduce((R,C)=>R+C,0)]).sort((P,R)=>P[1]-R[1])[0])==null?void 0:q[0];U&&(O=U);break}case"initialPlacement":O=l;break}if(i!==O)return{reset:{placement:O}}}return{}}}},pee=new Set(["left","top"]);async function hee(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=to(n),l=js(n),c=Io(n)==="y",d=pee.has(o)?-1:1,u=s&&c?-1:1,f=bc(t,e);let{mainAxis:p,crossAxis:h,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof g=="number"&&(h=l==="end"?g*-1:g),c?{x:h*u,y:p*d}:{x:p*d,y:h*u}}const mee=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:o,middlewareData:l}=t,c=await hee(t,e);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:s+c.y,data:{...c,placement:o}}}}},gee=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:s}=t,{mainAxis:o=!0,crossAxis:l=!1,limiter:c={fn:x=>{let{x:w,y:v}=x;return{x:w,y:v}}},...d}=bc(e,t),u={x:n,y:r},f=await s.detectOverflow(t,d),p=Io(to(i)),h=hI(p);let g=u[h],b=u[p];if(o){const x=h==="y"?"top":"left",w=h==="y"?"bottom":"right",v=g+f[x],k=g-f[w];g=Kx(v,g,k)}if(l){const x=p==="y"?"top":"left",w=p==="y"?"bottom":"right",v=b+f[x],k=b-f[w];b=Kx(v,b,k)}const S=c.fn({...t,[h]:g,[p]:b});return{...S,data:{x:S.x-n,y:S.y-r,enabled:{[h]:o,[p]:l}}}}}};function gm(){return typeof window<"u"}function kc(e){return yI(e)?(e.nodeName||"").toLowerCase():"#document"}function ai(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ps(e){var t;return(t=(yI(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function yI(e){return gm()?e instanceof Node||e instanceof ai(e).Node:!1}function Gi(e){return gm()?e instanceof Element||e instanceof ai(e).Element:!1}function io(e){return gm()?e instanceof HTMLElement||e instanceof ai(e).HTMLElement:!1}function l1(e){return!gm()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ai(e).ShadowRoot}function zd(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Xi(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function yee(e){return/^(table|td|th)$/.test(kc(e))}function ym(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const xee=/transform|translate|scale|rotate|perspective|filter/,wee=/paint|layout|strict|content/,ya=e=>!!e&&e!=="none";let ry;function zv(e){const t=Gi(e)?Xi(e):e;return ya(t.transform)||ya(t.translate)||ya(t.scale)||ya(t.rotate)||ya(t.perspective)||!Bv()&&(ya(t.backdropFilter)||ya(t.filter))||xee.test(t.willChange||"")||wee.test(t.contain||"")}function vee(e){let t=Go(e);for(;io(t)&&!hc(t);){if(zv(t))return t;if(ym(t))return null;t=Go(t)}return null}function Bv(){return ry==null&&(ry=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ry}function hc(e){return/^(html|body|#document)$/.test(kc(e))}function Xi(e){return ai(e).getComputedStyle(e)}function xm(e){return Gi(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Go(e){if(kc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||l1(e)&&e.host||Ps(e);return l1(t)?t.host:t}function xI(e){const t=Go(e);return hc(t)?e.ownerDocument?e.ownerDocument.body:e.body:io(t)&&zd(t)?t:xI(t)}function xd(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=xI(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),o=ai(i);if(s){const l=qx(o);return t.concat(o,o.visualViewport||[],zd(i)?i:[],l&&n?xd(l):[])}else return t.concat(i,xd(i,[],n))}function qx(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function wI(e){const t=Xi(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=io(e),s=i?e.offsetWidth:n,o=i?e.offsetHeight:r,l=_h(n)!==s||_h(r)!==o;return l&&(n=s,r=o),{width:n,height:r,$:l}}function Hv(e){return Gi(e)?e:e.contextElement}function ql(e){const t=Hv(e);if(!io(t))return Ns(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=wI(t);let o=(s?_h(n.width):n.width)/r,l=(s?_h(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const bee=Ns(0);function vI(e){const t=ai(e);return!Bv()||!t.visualViewport?bee:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function kee(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ai(e)?!1:t}function Ba(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=Hv(e);let o=Ns(1);t&&(r?Gi(r)&&(o=ql(r)):o=ql(e));const l=kee(s,n,r)?vI(s):Ns(0);let c=(i.left+l.x)/o.x,d=(i.top+l.y)/o.y,u=i.width/o.x,f=i.height/o.y;if(s){const p=ai(s),h=r&&Gi(r)?ai(r):r;let g=p,b=qx(g);for(;b&&r&&h!==g;){const S=ql(b),x=b.getBoundingClientRect(),w=Xi(b),v=x.left+(b.clientLeft+parseFloat(w.paddingLeft))*S.x,k=x.top+(b.clientTop+parseFloat(w.paddingTop))*S.y;c*=S.x,d*=S.y,u*=S.x,f*=S.y,c+=v,d+=k,g=ai(b),b=qx(g)}}return Ih({width:u,height:f,x:c,y:d})}function wm(e,t){const n=xm(e).scrollLeft;return t?t.left+n:Ba(Ps(e)).left+n}function bI(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-wm(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function See(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",o=Ps(r),l=t?ym(t.floating):!1;if(r===o||l&&s)return n;let c={scrollLeft:0,scrollTop:0},d=Ns(1);const u=Ns(0),f=io(r);if((f||!f&&!s)&&((kc(r)!=="body"||zd(o))&&(c=xm(r)),f)){const h=Ba(r);d=ql(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}const p=o&&!f&&!s?bI(o,c):Ns(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+u.x+p.x,y:n.y*d.y-c.scrollTop*d.y+u.y+p.y}}function Nee(e){return Array.from(e.getClientRects())}function jee(e){const t=Ps(e),n=xm(e),r=e.ownerDocument.body,i=Ia(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Ia(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+wm(e);const l=-n.scrollTop;return Xi(r).direction==="rtl"&&(o+=Ia(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:l}}const c1=25;function Cee(e,t){const n=ai(e),r=Ps(e),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,l=0,c=0;if(i){s=i.width,o=i.height;const u=Bv();(!u||u&&t==="fixed")&&(l=i.offsetLeft,c=i.offsetTop)}const d=wm(r);if(d<=0){const u=r.ownerDocument,f=u.body,p=getComputedStyle(f),h=u.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,g=Math.abs(r.clientWidth-f.clientWidth-h);g<=c1&&(s-=g)}else d<=c1&&(s+=d);return{width:s,height:o,x:l,y:c}}function Eee(e,t){const n=Ba(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=io(e)?ql(e):Ns(1),o=e.clientWidth*s.x,l=e.clientHeight*s.y,c=i*s.x,d=r*s.y;return{width:o,height:l,x:c,y:d}}function u1(e,t,n){let r;if(t==="viewport")r=Cee(e,n);else if(t==="document")r=jee(Ps(e));else if(Gi(t))r=Eee(t,n);else{const i=vI(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Ih(r)}function kI(e,t){const n=Go(e);return n===t||!Gi(n)||hc(n)?!1:Xi(n).position==="fixed"||kI(n,t)}function _ee(e,t){const n=t.get(e);if(n)return n;let r=xd(e,[],!1).filter(l=>Gi(l)&&kc(l)!=="body"),i=null;const s=Xi(e).position==="fixed";let o=s?Go(e):e;for(;Gi(o)&&!hc(o);){const l=Xi(o),c=zv(o);!c&&l.position==="fixed"&&(i=null),(s?!c&&!i:!c&&l.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||zd(o)&&!c&&kI(e,o))?r=r.filter(u=>u!==o):i=l,o=Go(o)}return t.set(e,r),r}function Pee(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?ym(t)?[]:_ee(t,this._c):[].concat(n),r],l=u1(t,o[0],i);let c=l.top,d=l.right,u=l.bottom,f=l.left;for(let p=1;p<o.length;p++){const h=u1(t,o[p],i);c=Ia(h.top,c),d=pc(h.right,d),u=pc(h.bottom,u),f=Ia(h.left,f)}return{width:d-f,height:u-c,x:f,y:c}}function Aee(e){const{width:t,height:n}=wI(e);return{width:t,height:n}}function Iee(e,t,n){const r=io(t),i=Ps(t),s=n==="fixed",o=Ba(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=Ns(0);function d(){c.x=wm(i)}if(r||!r&&!s)if((kc(t)!=="body"||zd(i))&&(l=xm(t)),r){const h=Ba(t,!0,s,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else i&&d();s&&!r&&i&&d();const u=i&&!r&&!s?bI(i,l):Ns(0),f=o.left+l.scrollLeft-c.x-u.x,p=o.top+l.scrollTop-c.y-u.y;return{x:f,y:p,width:o.width,height:o.height}}function iy(e){return Xi(e).position==="static"}function d1(e,t){if(!io(e)||Xi(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ps(e)===n&&(n=n.ownerDocument.body),n}function SI(e,t){const n=ai(e);if(ym(e))return n;if(!io(e)){let i=Go(e);for(;i&&!hc(i);){if(Gi(i)&&!iy(i))return i;i=Go(i)}return n}let r=d1(e,t);for(;r&&yee(r)&&iy(r);)r=d1(r,t);return r&&hc(r)&&iy(r)&&!zv(r)?n:r||vee(e)||n}const Tee=async function(e){const t=this.getOffsetParent||SI,n=this.getDimensions,r=await n(e.floating);return{reference:Iee(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ree(e){return Xi(e).direction==="rtl"}const Lee={convertOffsetParentRelativeRectToViewportRelativeRect:See,getDocumentElement:Ps,getClippingRect:Pee,getOffsetParent:SI,getElementRects:Tee,getClientRects:Nee,getDimensions:Aee,getScale:ql,isElement:Gi,isRTL:Ree};function NI(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Oee(e,t){let n=null,r;const i=Ps(e);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function o(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),s();const d=e.getBoundingClientRect(),{left:u,top:f,width:p,height:h}=d;if(l||t(),!p||!h)return;const g=sp(f),b=sp(i.clientWidth-(u+p)),S=sp(i.clientHeight-(f+h)),x=sp(u),v={rootMargin:-g+"px "+-b+"px "+-S+"px "+-x+"px",threshold:Ia(0,pc(1,c))||1};let k=!0;function E(j){const A=j[0].intersectionRatio;if(A!==c){if(!k)return o();A?o(!1,A):r=setTimeout(()=>{o(!1,1e-7)},1e3)}A===1&&!NI(d,e.getBoundingClientRect())&&o(),k=!1}try{n=new IntersectionObserver(E,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(E,v)}n.observe(e)}return o(!0),s}function f1(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,d=Hv(e),u=i||s?[...d?xd(d):[],...t?xd(t):[]]:[];u.forEach(x=>{i&&x.addEventListener("scroll",n,{passive:!0}),s&&x.addEventListener("resize",n)});const f=d&&l?Oee(d,n):null;let p=-1,h=null;o&&(h=new ResizeObserver(x=>{let[w]=x;w&&w.target===d&&h&&t&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var v;(v=h)==null||v.observe(t)})),n()}),d&&!c&&h.observe(d),t&&h.observe(t));let g,b=c?Ba(e):null;c&&S();function S(){const x=Ba(e);b&&!NI(b,x)&&n(),b=x,g=requestAnimationFrame(S)}return n(),()=>{var x;u.forEach(w=>{i&&w.removeEventListener("scroll",n),s&&w.removeEventListener("resize",n)}),f==null||f(),(x=h)==null||x.disconnect(),h=null,c&&cancelAnimationFrame(g)}}const Mee=mee,$ee=dee,Dee=gee,Fee=fee,p1=cee,zee=(e,t,n)=>{const r=new Map,i={platform:Lee,...n},s={...i.platform,_c:r};return lee(e,t,{...i,platform:s})};var Bee=typeof document<"u",Hee=function(){},Ap=Bee?m.useLayoutEffect:Hee;function Th(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Th(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&e.$$typeof)&&!Th(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function jI(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function h1(e,t){const n=jI(e);return Math.round(t*n)/n}function sy(e){const t=m.useRef(e);return Ap(()=>{t.current=e}),t}function m1(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[u,f]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=m.useState(r);Th(p,r)||h(r);const[g,b]=m.useState(null),[S,x]=m.useState(null),w=m.useCallback(P=>{P!==j.current&&(j.current=P,b(P))},[]),v=m.useCallback(P=>{P!==A.current&&(A.current=P,x(P))},[]),k=s||g,E=o||S,j=m.useRef(null),A=m.useRef(null),$=m.useRef(u),I=c!=null,F=sy(c),L=sy(i),T=sy(d),q=m.useCallback(()=>{if(!j.current||!A.current)return;const P={placement:t,strategy:n,middleware:p};L.current&&(P.platform=L.current),zee(j.current,A.current,P).then(R=>{const C={...R,isPositioned:T.current!==!1};D.current&&!Th($.current,C)&&($.current=C,Dr.flushSync(()=>{f(C)}))})},[p,t,n,L,T]);Ap(()=>{d===!1&&$.current.isPositioned&&($.current.isPositioned=!1,f(P=>({...P,isPositioned:!1})))},[d]);const D=m.useRef(!1);Ap(()=>(D.current=!0,()=>{D.current=!1}),[]),Ap(()=>{if(k&&(j.current=k),E&&(A.current=E),k&&E){if(F.current)return F.current(k,E,q);q()}},[k,E,q,F,I]);const W=m.useMemo(()=>({reference:j,floating:A,setReference:w,setFloating:v}),[w,v]),O=m.useMemo(()=>({reference:k,floating:E}),[k,E]),U=m.useMemo(()=>{const P={position:n,left:0,top:0};if(!O.floating)return P;const R=h1(O.floating,u.x),C=h1(O.floating,u.y);return l?{...P,transform:"translate("+R+"px, "+C+"px)",...jI(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:R,top:C}},[n,l,O.floating,u.x,u.y]);return m.useMemo(()=>({...u,update:q,refs:W,elements:O,floatingStyles:U}),[u,q,W,O,U])}const Uee=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?p1({element:r.current,padding:i}).fn(n):{}:r?p1({element:r,padding:i}).fn(n):{}}}},g1=(e,t)=>{const n=Mee(e);return{name:n.name,fn:n.fn,options:[e,t]}},Wee=(e,t)=>{const n=Dee(e);return{name:n.name,fn:n.fn,options:[e,t]}},Vee=(e,t)=>{const n=Fee(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kee=(e,t)=>{const n=$ee(e);return{name:n.name,fn:n.fn,options:[e,t]}},qee=(e,t)=>{const n=Uee(e);return{name:n.name,fn:n.fn,options:[e,t]}},Yee={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},Gee={beaconOptions:{offset:-18}},CI={back:"Back",close:"Close",last:"Last",next:"Next",nextWithProgress:"Next ({current} of {total})",open:"Open the dialog",skip:"Skip"},Xee={isFixed:!1,locale:CI,placement:"bottom"},Jee={continuous:!1,debug:!1,run:!1,scrollToFirstStep:!1,steps:[]},yt={INIT:"init",START:"start",STOP:"stop",RESET:"reset",PREV:"prev",NEXT:"next",GO:"go",CLOSE:"close",SKIP:"skip",UPDATE:"update",COMPLETE:"complete"},Yn={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"},Re={INIT:"init",READY:"ready",BEACON_BEFORE:"beacon_before",BEACON:"beacon",TOOLTIP_BEFORE:"tooltip_before",TOOLTIP:"tooltip",COMPLETE:"complete"},ms={BUTTON_BACK:"button_back",BUTTON_CLOSE:"button_close",BUTTON_PRIMARY:"button_primary",BUTTON_SKIP:"button_skip",KEYBOARD:"keyboard",OVERLAY:"overlay"},ht={IDLE:"idle",READY:"ready",WAITING:"waiting",RUNNING:"running",PAUSED:"paused",SKIPPED:"skipped",FINISHED:"finished"},Qee="react-joyride-portal";function Zee(e){const t={};for(const n in e)e[n]!==void 0&&(t[n]=e[n]);return t}function Ml(...e){return UZ({all:!0,isMergeableObject:t=>!(!hr.plainObject(t)||m.isValidElement(t))})(...e)}function EI(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function Us(e,t={}){const{defaultValue:n,step:r,steps:i}=t;let s=ny(e);if(s)(s.includes("{current}")||s.includes("{total}"))&&r&&i&&(s=s.replace("{current}",r.toString()).replace("{total}",i.toString()));else if(m.isValidElement(e)&&!Object.values(e.props).length&&EI(e.type)==="function")try{s=Us(e.type({}),t)}catch{s=ny(n)}else s=ny(n);return s}function Xn(e,t,n,...r){if(!e)return;const i=new Date,s=`${String(i.getHours()).padStart(2,"0")}:${String(i.getMinutes()).padStart(2,"0")}:${String(i.getSeconds()).padStart(2,"0")}.${String(i.getMilliseconds()).padStart(3,"0")}`;console.log(`${t} %c${n}%c ${s}`,"font-weight: bold","color: gray; font-weight: normal",...r)}function ete(e,t){const n=Zee(t);return{...e,...n}}function wd(){}function tte(e){return Object.keys(e)}function Rh(e,...t){if(!hr.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 y1(e,...t){if(!hr.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 Yx(e,t,n){const r=s=>s.replace("{current}",String(t)).replace("{total}",String(n));if(EI(e)==="string")return r(e);if(!m.isValidElement(e))return e;const{children:i}=e.props;if(hr.string(i)&&i.includes("{current}"))return m.cloneElement(e,{children:r(i)});if(Array.isArray(i))return m.cloneElement(e,{children:i.map(s=>typeof s=="string"?r(s):Yx(s,t,n))});if(hr.function(e.type)&&!Object.values(e.props).length)try{return Yx(e.type({}),t,n)}catch{return e}return e}function x1(e){return tte(e).sort().reduce((t,n)=>(t[n]=e[n],t),{})}function Uv(){var e;return!!(typeof window<"u"&&((e=window.document)!=null&&e.createElement))}function w1(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 Wv(e){return e?e.getBoundingClientRect():null}function nte(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((s,o)=>s-o),i=Math.floor(r.length/2);return r.length%2===0?(r[i-1]+r[i])/2:r[i]}return Math.max(t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight)}function vi(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 rte(e,t,n){const r=Wv(e),i=Sc(e),s=i?!i.isSameNode(Ur()):!1,o=n??Nc(e);let l=0,c=(r==null?void 0:r.top)??0;return s&&o?c=(r==null?void 0:r.top)??0:i instanceof HTMLElement&&(l=i.scrollTop,!s&&!o&&(c+=l),i.isSameNode(Ur())||(c+=Ur().scrollTop)),Math.floor(c-t)}function Sc(e,t){if(!e)return Ur();const n=pI(e);if(n){if(n.isSameNode(Ur()))return t?document:Ur();if(!(n.scrollHeight>n.offsetHeight))return Ur()}return n}function ite(e){const t=e.getBoundingClientRect(),n=Ur(),r=t.top+t.height/2,i=window.innerHeight/2;return Math.max(0,n.scrollTop+r-i)}function ste(e,t){if(!e)return 0;const n=pI(e)??Ur(),r=parseFloat(getComputedStyle(e).scrollMarginTop)||0,i=Wv(n),s=n.scrollTop??0,{offsetTop:o=0,scrollTop:l=0}=n;let c=e.getBoundingClientRect().top+l;if(o&&(_I(e)||ote(e))){const u=e.getBoundingClientRect(),f=u.top-((i==null?void 0:i.top)??0),p=f+u.height,h=n.clientHeight,g=h*.2;f>=g&&p<=h-g?c=s:c=f+s}const d=Math.floor(c-t-r);return d<0?0:d}function ote(e){return e.offsetParent!==document.body}function _I(e){if(!e)return!1;const t=Sc(e);return t?!t.isSameNode(Ur()):!1}function Nc(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?Nc(e.parentNode,t):!1}function op(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 v1(e){const{isFirstStep:t,scrollToFirstStep:n,step:r,target:i,targetLifecycle:s}=e;if(r.skipScroll||t&&!n&&s!==Re.TOOLTIP||r.placement==="center")return!1;const o=i!=null&&i.isConnected?Sc(i):Ur(),l=o?!o.isSameNode(Ur()):!1;return(r.isFixed||Nc(i))&&!l?!1:o.scrollHeight>o.clientHeight}function Ur(){return document.scrollingElement??document.documentElement}function b1(e,t){const{duration:n,element:r}=t;let i=()=>{};const s=new Promise(o=>{const{scrollTop:l}=r,c=e>l?e-l:l-e;i=XZ.top(r,e,{duration:c<100?50:n},()=>{o()})});return{cancel:i,promise:s}}function ate(e){const t=e.replace(/^#?([\da-f])([\da-f])([\da-f])$/i,(r,i,s,o)=>i+i+s+s+o+o),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 PI={backgroundColor:"transparent",border:0,borderRadius:0,color:"#555555",cursor:"pointer",fontSize:16,lineHeight:1,padding:0,WebkitAppearance:"none"},ap={...PI,borderRadius:4,padding:8};function lte(e,t){const{styles:n}=e,r=Ml(n??{},t.styles??{});let{width:i}=t;Uv()&&(i=typeof i=="number"&&window.innerWidth<i?window.innerWidth-30:i);const s={bottom:0,left:0,overflow:"hidden",position:"absolute",right:0,top:0,zIndex:t.zIndex};return Ml({arrow:{alignItems:"center",color:t.arrowColor,display:"inline-flex",justifyContent:"center",position:"absolute"},beaconWrapper:{...PI,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(${ate(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:{...ap,color:t.primaryColor,marginLeft:"auto",marginRight:5},buttonClose:{...ap,color:t.textColor,height:12,padding:8,position:"absolute",right:0,top:0,width:12},buttonPrimary:{...ap,backgroundColor:t.primaryColor,color:t.backgroundColor},buttonSkip:{...ap,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:{...s,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:i},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 cte=["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 Vv(e,t){if(!t)return null;const n=Ml(Xee,y1(e,"arrowComponent","beaconComponent","floatingOptions","loaderComponent","locale","styles","tooltipComponent"),t),r=Ml(Yee,e.options??{},y1(t,...cte)),i=lte(e,{...n,...r}),s=Ml(Gee,e.floatingOptions??{},n.floatingOptions??{});return{...n,...r,locale:Ml(CI,e.locale??{},n.locale||{}),floatingOptions:s,spotlightPadding:ute(r.spotlightPadding),styles:i}}function ute(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 dte(e,t,n){const{action:r}=t,i=n&&[yt.PREV,yt.NEXT].includes(r);return e.skipBeacon||e.placement==="center"||i}function AI(e,t=!1){return hr.plainObject(e)?e.target?!0:(Xn(t,"tour","target is missing from the step"),!1):(Xn(t,"tour","step must be an object"),!1)}function II(e,t=!1){return hr.array(e)?e.every(n=>AI(n,t)):(Xn(t,"tour","steps must be an array"),!1)}var fte=class{constructor(e){wn(this,"beaconPosition",null);wn(this,"debug");wn(this,"eventListeners",new Map);wn(this,"listeners",new Set);wn(this,"props");wn(this,"snapshot");wn(this,"state");wn(this,"steps");wn(this,"tooltipPosition",null);wn(this,"cleanupPositionData",()=>{this.beaconPosition=null,this.tooltipPosition=null});wn(this,"getPositionData",e=>e==="beacon"?this.beaconPosition:this.tooltipPosition);wn(this,"getServerSnapshot",()=>this.snapshot);wn(this,"getSnapshot",()=>this.snapshot);wn(this,"getEventState",()=>Rh(this.snapshot,"positioned"));wn(this,"getState",()=>Rh(this.snapshot,"positioned"));wn(this,"setPositionData",(e,t)=>{var r,i,s;((r=e==="beacon"?this.beaconPosition:this.tooltipPosition)==null?void 0:r.placement)!==t.placement&&Xn(this.debug,`step:${this.state.index}`,"positioned",`${e} ${t.placement}`),e==="beacon"?this.beaconPosition=t:this.tooltipPosition=t,(this.state.lifecycle===Re.BEACON_BEFORE||this.state.lifecycle===Re.TOOLTIP_BEFORE)&&!this.state.positioned&&this.updateState({positioned:!0});const n=(s=(i=this.getStep())==null?void 0:i.floatingOptions)==null?void 0:s.onPosition;n&&n(t)});wn(this,"setSteps",e=>{this.steps=e,this.updateState({size:e.length})});wn(this,"dispatch",(e,t)=>{const n=this.eventListeners.get(e.type);if(n)for(const r of n)try{r(e,t)}catch{}});wn(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)}});wn(this,"subscribe",e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}));wn(this,"updateState",(e,t=!1)=>{const{controlled:n,index:r}=this.state,i=this.snapshot,s=n&&!t&&e.index!==void 0?r:e.index??r,o={action:e.action??this.state.action,controlled:n,index:s,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(o);if(this.state=l,!Lv(i,l)){this.snapshot=Object.freeze({...l});for(const c of this.listeners)c(this.snapshot)}});const{initialStepIndex:t,stepIndex:n,steps:r=[]}=e??{},i=hr.number(n);let s=0;this.debug=(e==null?void 0:e.debug)??!1,i?(s=n,hr.number(t)&&Xn(this.debug,"tour","initialStepIndex is ignored in controlled mode")):hr.number(t)&&(t>=0&&t<r.length?s=t:r.length>0&&Xn(this.debug,"tour","initialStepIndex is out of bounds")),this.props=e??{steps:[]},this.steps=r,this.state={action:yt.INIT,controlled:i,index:s,lifecycle:Re.INIT,origin:null,positioned:!1,scrolling:!1,size:r.length,status:r.length?ht.READY:ht.IDLE,waiting:!1},this.snapshot=Object.freeze({...this.state})}applyTransitions(e){return e.status===ht.WAITING&&e.size>0?{...e,status:ht.RUNNING}:e}getStep(e){return Vv(this.props,this.steps[e??this.state.index])}};function pte(e){return new fte(e)}function k1(e,t){return Math.min(Math.max(e,0),t)}function hte(e,t,n){const r=m.useRef(t),i=m.useRef(n);return r.current=t,i.current=n,m.useMemo(()=>{const s=()=>e.current.getSnapshot();return{close:(S=null)=>{const{index:x,status:w}=s();w===ht.RUNNING&&e.current.updateState({action:yt.CLOSE,index:x+1,origin:S,lifecycle:Re.COMPLETE,positioned:!1,scrolling:!1,waiting:!1})},go:S=>{const{controlled:x,size:w,status:v}=s();if(x){Xn(r.current,"tour","go() is not supported in controlled mode");return}v===ht.RUNNING&&e.current.updateState({action:yt.GO,index:S,lifecycle:Re.COMPLETE,positioned:!1,scrolling:!1,status:S<w?v:ht.FINISHED,waiting:!1})},info:()=>Rh(e.current.getSnapshot(),"positioned"),next:S=>{const{index:x,size:w,status:v}=s();v===ht.RUNNING&&e.current.updateState({action:yt.NEXT,index:k1(x+1,w),lifecycle:Re.COMPLETE,origin:S,positioned:!1,scrolling:!1,waiting:!1})},open:()=>{const{status:S}=s();S===ht.RUNNING&&e.current.updateState({action:yt.UPDATE,lifecycle:Re.TOOLTIP_BEFORE,positioned:!1,scrolling:!1,waiting:!1})},prev:S=>{const{index:x,size:w,status:v}=s();v===ht.RUNNING&&e.current.updateState({action:yt.PREV,index:k1(x-1,w),lifecycle:Re.COMPLETE,origin:S,positioned:!1,scrolling:!1,waiting:!1})},reset:(S=!1)=>{const{controlled:x}=s();if(x){Xn(r.current,"tour","reset() is not supported in controlled mode");return}i.current(),e.current.updateState({action:yt.RESET,index:0,lifecycle:Re.INIT,positioned:!1,scrolling:!1,status:S?ht.RUNNING:ht.READY,waiting:!1})},skip:S=>{const{status:x}=s();x===ht.RUNNING&&e.current.updateState({action:yt.SKIP,lifecycle:Re.COMPLETE,origin:S,positioned:!1,scrolling:!1,status:ht.SKIPPED,waiting:!1})},start:S=>{const{index:x,size:w}=s();i.current(),e.current.updateState({action:yt.START,index:hr.number(S)?S:x,lifecycle:Re.INIT,positioned:!1,scrolling:!1,status:w?ht.RUNNING:ht.WAITING,waiting:!1},!0)},stop:(S=!1)=>{const{index:x,status:w}=s();[ht.FINISHED,ht.SKIPPED].includes(w)||e.current.updateState({action:yt.STOP,index:x+(S?1:0),lifecycle:Re.COMPLETE,positioned:!1,scrolling:!1,status:ht.PAUSED,waiting:!1})}}},[e])}const mte=new Set(["origin","positioned"]);function gte(e,t){const n=m.useRef(null);m.useEffect(()=>{if(!t)return;const r=e.current.getSnapshot();return Xn(!0,"tour","init",r),n.current=r,e.current.subscribe(i=>{const s=n.current;if(n.current=i,!s)return;const o={};let l=!1;for(const c of Object.keys(i))i[c]!==s[c]&&!mte.has(c)&&(o[c]={from:s[c],to:i[c]},(c==="status"||c==="size")&&(l=!0));Object.keys(o).length&&(!l&&i.index>=i.size||Xn(!0,l?"tour":`step:${i.index}`,"state",o))})},[t,e])}function yte(e,t,n){const r=m.useRef(e),i=m.useRef(t);return r.current=e,i.current=t,m.useCallback((s,o,l)=>{var d;const c={...n.current.getEventState(),error:null,scroll:null,step:o,type:s,...l};(d=r.current)==null||d.call(r,c,i.current),n.current.dispatch(c,i.current)},[n])}function No(e,t){return{hasChanged(n){return e[n]!==t[n]},hasChangedTo(n,r){const i=e[n],s=t[n];return Array.isArray(r)?r.includes(i)&&!r.includes(s):i===r&&s!==r},previous:t}}function xte(e){const{addFailure:t,controls:n,emitEvent:r,previousState:i,props:s,state:o,step:l,store:c}=e,{action:d,index:u,lifecycle:f,positioned:p,scrolling:h,size:g,status:b}=o,S=sI(l)??null,x=m.useRef(null),w=m.useRef(s),v=m.useRef(o),k=m.useRef(i),E=m.useRef(l),j=m.useRef(S),A=m.useRef(n),$=m.useRef(null),I=m.useRef(null),F=m.useRef(null);w.current=s,v.current=o,k.current=i,E.current=l,j.current=S,A.current=n;const L=()=>{$.current&&(clearInterval($.current),$.current=null),I.current=null,F.current&&(F.current.cancel(),F.current=null)};m.useEffect(()=>{if(!k.current)return;const{hasChangedTo:T}=No(v.current,k.current);(T("action",[yt.NEXT,yt.PREV,yt.SKIP,yt.CLOSE])||x.current===yt.CLOSE&&d===yt.START)&&(x.current=d)},[d]),m.useEffect(()=>{if(!k.current)return()=>{L()};const{hasChanged:T}=No(v.current,k.current),q=E.current;if(T("index")&&L(),b!==ht.RUNNING||!q||f!==Re.INIT)return()=>{L()};const{hasChangedTo:D}=No(v.current,k.current);D("status",ht.RUNNING)&&[ht.IDLE,ht.READY,ht.PAUSED].includes(k.current.status)&&r(Yn.TOUR_START,q),c.current.cleanupPositionData();const{debug:W}=w.current;if(q.before&&!F.current){Xn(W,`step:${u}`,"before()",q),F.current={cancel:()=>{}},c.current.updateState({waiting:!0}),r(Yn.STEP_BEFORE_HOOK,q,{action:x.current??v.current.action});const O=()=>{F.current=null,c.current.updateState({action:x.current??v.current.action,waiting:!1,lifecycle:Re.READY})},U=new AbortController,P=q.beforeTimeout;F.current={cancel:()=>U.abort()};const R=P?setTimeout(()=>{U.signal.aborted||(Xn(W,`step:${u}`,"before()","timed out",`${P}ms`),U.abort(),t(q,"before_hook"),r(Yn.ERROR,q,{error:new Error("Step before hook timed out")}),O())},P):null;q.before({...c.current.getState(),action:x.current??c.current.getState().action,step:q}).then(()=>{U.signal.aborted||(R&&clearTimeout(R),O())}).catch(C=>{U.signal.aborted||(R&&clearTimeout(R),t(q,"before_hook"),r(Yn.ERROR,q,{error:C instanceof Error?C:new Error(String(C))}),O())})}else if(!F.current){$.current&&I.current!==q.target&&L();const O=vi(q.target);if(O&&op(O))L(),c.current.updateState({action:x.current??yt.UPDATE,lifecycle:Re.READY,waiting:!1});else if(q.targetWaitTimeout===0)c.current.updateState({action:x.current??yt.UPDATE,lifecycle:Re.READY,waiting:!1});else if(!$.current){const{targetWaitTimeout:U}=q,P=Date.now();I.current=q.target,Xn(W,`step:${u}`,"polling","started",`${U}ms`),c.current.updateState({waiting:!0}),$.current=setInterval(()=>{const R=vi(q.target),C=Date.now()-P,G=C>=U;(R&&op(R)||G)&&(Xn(W,`step:${u}`,"polling",R&&op(R)?"found":"timed out",`${C}ms`),L(),c.current.updateState({action:x.current??yt.UPDATE,lifecycle:Re.READY,waiting:!1}))},100)}}return()=>{L()}},[t,r,u,f,b,c]),m.useEffect(()=>{if(!k.current)return;const{hasChanged:T,hasChangedTo:q,previous:D}=No(v.current,k.current),W=E.current;if(!W)return;const O=vi(W.target),U=!!O;if(U&&op(O)){if(q("lifecycle",Re.READY)&&D.lifecycle===Re.INIT&&r(Yn.STEP_BEFORE,W,{action:x.current??v.current.action}),q("lifecycle",Re.READY)){const P=v.current,R=dte(W,P,w.current.continuous)?Re.TOOLTIP:Re.BEACON,C=vi(W.scrollTarget??W.spotlightTarget??W.target),G=v1({isFirstStep:P.index===0,scrollToFirstStep:w.current.scrollToFirstStep,step:W,target:C,targetLifecycle:R}),J=R===Re.TOOLTIP?Re.TOOLTIP_BEFORE:Re.BEACON_BEFORE;Xn(w.current.debug,`step:${u}`,"scroll",G?"needed":"skipped"),c.current.updateState({action:yt.UPDATE,lifecycle:J,scrolling:G})}}else if(v.current.status===ht.RUNNING&&f!==Re.INIT&&f!==Re.COMPLETE&&T("lifecycle")){Xn(w.current.debug,`step:${u}`,U?"Target not visible":"Target not mounted",W),t(W,"target_not_found"),r(Yn.TARGET_NOT_FOUND,W);const P=v.current;P.controlled||c.current.updateState({action:yt.UPDATE,index:P.index+(P.action===yt.PREV?-1:1),lifecycle:Re.INIT})}},[t,r,u,f,c]),m.useEffect(()=>{if(!k.current)return;const{hasChangedTo:T,previous:q}=No(v.current,k.current),D=E.current,W=j.current;if(D&&T("lifecycle",Re.TOOLTIP_BEFORE)&&q.lifecycle===Re.BEACON){const P=vi(D.scrollTarget??D.spotlightTarget??D.target);if(v1({isFirstStep:v.current.index===0,scrollToFirstStep:w.current.scrollToFirstStep,step:D,target:P,targetLifecycle:Re.TOOLTIP})){c.current.updateState({scrolling:!0,positioned:!1});return}}const O=f===Re.BEACON_BEFORE||f===Re.TOOLTIP_BEFORE;if(D&&O&&!h){const P=f===Re.TOOLTIP_BEFORE?Re.TOOLTIP:Re.BEACON;c.current.updateState({action:yt.UPDATE,lifecycle:P})}D&&T("lifecycle",Re.BEACON)&&r(Yn.BEACON,D),D&&T("lifecycle",Re.TOOLTIP)&&r(Yn.TOOLTIP,D);const U=v.current;if((U.status===ht.RUNNING||U.controlled&&U.status===ht.PAUSED&&D)&&W&&T("lifecycle",Re.COMPLETE)&&q.lifecycle===Re.TOOLTIP&&(r(Yn.STEP_AFTER,W,{action:x.current??yt.UPDATE,index:q.index??U.index,lifecycle:U.lifecycle}),W.after)){r(Yn.STEP_AFTER_HOOK,W,{action:x.current??yt.UPDATE,index:q.index??U.index,lifecycle:U.lifecycle});try{W.after({...c.current.getState(),action:x.current??yt.UPDATE,index:q.index??U.index,lifecycle:U.lifecycle,step:W})}catch{}}},[r,f,p,h,c]),m.useEffect(()=>{if(!k.current)return;const{hasChangedTo:T,previous:q}=No(v.current,k.current),D=E.current,W=j.current;g&&!D&&f===Re.INIT&&c.current.updateState({action:yt.UPDATE,lifecycle:Re.COMPLETE,status:ht.FINISHED}),!v.current.controlled&&b===ht.RUNNING&&T("lifecycle",Re.COMPLETE)&&u<g&&c.current.updateState({action:yt.UPDATE,lifecycle:Re.INIT}),T("lifecycle",Re.COMPLETE)&&u>=g&&c.current.updateState({action:yt.UPDATE,lifecycle:Re.COMPLETE,status:ht.FINISHED});const O=D??W??Vv(w.current,w.current.steps[u-1]);if(O&&T("status",[ht.FINISHED,ht.SKIPPED])){let U;D?U=u:W?U=q.index??u:U=u-1,r(Yn.TOUR_END,O,{index:U}),v.current.controlled||A.current.reset(),x.current=null}D&&T("action",yt.STOP)&&(x.current=null,r(Yn.TOUR_STATUS,D)),D&&T("action",yt.RESET)&&(r(Yn.TOUR_STATUS,D),x.current=null)},[d,r,u,f,g,b,c])}function wte({controls:e,emitEvent:t,props:n,state:r,store:i}){const{debug:s,initialStepIndex:o,run:l,stepIndex:c,steps:d}=n,u=m.useRef(void 0),f=m.useRef(r),p=m.useRef(e);f.current=r,p.current=e,m.useEffect(()=>{const h=u.current;if(u.current=n,!h||n===h)return;const{hasChanged:g}=No(n,h);if(Lv(h.steps,d)||(II(d,s)?i.current.setSteps(d):(Xn(s,"tour","Steps are not valid",d),t(Yn.ERROR,d[0]??{target:"",content:""},{error:new Error("Steps are not valid")}))),g("run"))l?i.current.getState().size&&p.current.start(c??o):p.current.stop();else if(hr.number(c)&&g("stepIndex")){const b=hr.number(h.stepIndex)&&h.stepIndex<c?yt.NEXT:yt.PREV;[ht.FINISHED,ht.SKIPPED].includes(f.current.status)||i.current.updateState({action:b,index:c,lifecycle:Re.INIT,positioned:!1},!0)}},[s,t,o,n,l,c,d,i])}function vte(e,t){var l,c,d,u;const{beaconPosition:n,lifecycle:r,scrollOffset:i,step:s}=t;if(s.scrollTarget||s.spotlightTarget)return Math.max(0,e);let o=e-s.spotlightPadding.top;if(r===Re.BEACON_BEFORE&&(n!=null&&n.placement)){const f=bte(n);["bottom"].includes(n.placement)||(o+=Math.floor(f-i))}else if(r===Re.TOOLTIP_BEFORE){const{placement:f}=s;if(f==="top"){const p=((l=document.querySelector(".react-joyride__floater"))==null?void 0:l.getBoundingClientRect().height)??0,h=(c=s.floatingOptions)!=null&&c.hideArrow?0:s.arrowSize,g=s.offset+s.spotlightPadding.top+h;o-=p+g}else if(f==="left"||f==="right"){const p=((d=document.querySelector(".react-joyride__floater"))==null?void 0:d.getBoundingClientRect().height)??0,h=((u=vi(s.target))==null?void 0:u.getBoundingClientRect().height)??0,g=i+s.spotlightPadding.top+h/2-p/2;g<i&&(o-=i-g)}}return Math.max(0,o)}function bte(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 kte({emitEvent:e,previousState:t,props:n,state:r,step:i,store:s}){const{index:o,lifecycle:l,positioned:c,scrolling:d,status:u}=r,f=m.useRef(null),p=m.useRef(r),h=m.useRef(t),g=m.useRef(n),b=m.useRef(i);p.current=r,h.current=t,g.current=n,b.current=i,m.useEffect(()=>()=>{var S;(S=f.current)==null||S.call(f)},[]),m.useEffect(()=>{var E;if(!h.current||!b.current)return;const{hasChangedTo:S}=No(p.current,h.current),x=b.current,{debug:w}=g.current,{scrollDuration:v}=x,k=l===Re.BEACON_BEFORE||l===Re.TOOLTIP_BEFORE;if(u===ht.RUNNING&&k&&d&&S("positioned",!0)){const j=vi(x.scrollTarget??x.spotlightTarget??x.target),A=s.current.getPositionData("beacon"),$=Sc(j),I=$?!$.isSameNode(Ur()):!1;(E=f.current)==null||E.call(f),(async()=>{if(I&&!Nc($)){const U=Ur(),P=ite($),R={initial:U.scrollTop,target:P,element:U,duration:v};e(Yn.SCROLL_START,x,{scroll:R});const{cancel:C,promise:G}=b1(P,{element:U,duration:v});f.current=C,await G,e(Yn.SCROLL_END,x,{scroll:R})}const L=Math.floor(ste(j,x.scrollOffset))||0,T=I?L:vte(L,{beaconPosition:A,lifecycle:l,scrollOffset:x.scrollOffset,step:x});Xn(w,`step:${o}`,"scroll",I?"custom":"document",`${L} → ${T}`);const q=$,D={initial:q.scrollTop,target:T,element:q,duration:v};e(Yn.SCROLL_START,x,{scroll:D});const{cancel:W,promise:O}=b1(T,{element:q,duration:v});f.current=W,await O,e(Yn.SCROLL_END,x,{scroll:D}),s.current.updateState({scrolling:!1})})().catch(()=>{s.current.updateState({scrolling:!1})})}},[e,o,l,c,d,u,s])}function Ste(e){const t=sZ(()=>ete(Jee,e),[e]),{debug:n,initialStepIndex:r,onEvent:i,run:s,stepIndex:o,steps:l}=t,c=m.useRef(pte(t)),d=h_.useSyncExternalStore(c.current.subscribe,c.current.getSnapshot,c.current.getServerSnapshot),[u,f]=m.useState([]),p=m.useCallback((E,j)=>{f(A=>[...A,{reason:j,step:E}])},[]),h=m.useCallback(()=>{f([])},[]);gte(c,n);const g=hte(c,n,h),b=yte(i,g,c),{index:S,size:x,status:w}=d,v=sI(d),k=m.useMemo(()=>Vv(t,l[S]),[S,t,l]);return oZ(()=>{s&&x&&II(l,n)&&g.start(o??r)}),iZ(()=>{s&&x&&w===ht.IDLE&&c.current.updateState({status:ht.READY})},[s,x,w]),wte({controls:g,emitEvent:b,props:t,state:d,store:c}),xte({addFailure:p,controls:g,emitEvent:b,previousState:v,props:t,state:d,step:k,store:c}),kte({emitEvent:b,previousState:v,props:t,state:d,step:k,store:c}),{controls:g,failures:u,mergedProps:t,state:d,step:k,store:c}}function Nte(e){const[t,n]=m.useState(null);return m.useEffect(()=>{let r=null,i=!1;if(e)if(hr.domElement(e))r=e,i=!0;else{const s=document.querySelector(e);s&&(r=s)}else{const s=document.createElement("div");s.id=Qee,document.body.appendChild(s),r=s}return n(r),()=>{!r||i||r.parentNode===document.body&&document.body.removeChild(r)}},[e]),t}const jte={animation:"joyride-loader-spin 1s linear infinite",border:"5px solid rgba(0, 0, 0, 0.1)",borderRadius:"50%",borderTopColor:"#555"};function Cte({nonce:e,step:t}){const{loaderComponent:n}=t,r=!!n;if(m.useEffect(()=>{if(r||document.getElementById("joyride-loader-animation"))return wd;const c=document.createElement("style");return c.id="joyride-loader-animation",e&&c.setAttribute("nonce",e),c.appendChild(document.createTextNode(`
|
|
173
|
-
@keyframes joyride-loader-spin {
|
|
174
|
-
to { transform: rotate(360deg); }
|
|
175
|
-
}
|
|
176
|
-
`)),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:i,width:s,...o}=t.styles.loader;let l;if(n){const c=n;l=Ye.createElement(c,{step:t})}else l=Ye.createElement("div",{style:{...jte,height:i,width:s,borderTopColor:t.primaryColor}});return Ye.createElement("div",{className:"react-joyride__loader","data-testid":"loader",style:o},l)}const Ete={height:0,isFixed:!1,left:0,top:0,width:0};function ou(e,t){const n=vi(e);if(!n)return Ete;const r=Wv(n),i=Nc(n),s=rte(n,t.top,i);return{height:Math.round(((r==null?void 0:r.height)??0)+t.top+t.bottom),isFixed:i,left:Math.round(((r==null?void 0:r.left)??0)-t.left),top:s,width:Math.round(((r==null?void 0:r.width)??0)+t.left+t.right)}}function _te(e,t,n){const[r,i]=m.useState(()=>ou(e,t)),s=m.useRef(void 0),o=m.useRef(null),l=m.useRef(n),c=m.useRef(null),d=m.useCallback(()=>{clearTimeout(s.current),s.current=window.setTimeout(()=>{i(f=>{const p=ou(e,t);return f.top===p.top&&f.left===p.left&&f.width===p.width&&f.height===p.height&&f.isFixed===p.isFixed?f:p})},100)},[e,t]);m.useEffect(()=>{let f=null;const p=g=>{o.current=Sc(g,!0),o.current&&o.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(g)),i(ou(e,t))},h=vi(e);return h?p(h):(f=new MutationObserver(()=>{const g=vi(e);g&&(f==null||f.disconnect(),f=null,p(g))}),f.observe(document.body,{childList:!0,subtree:!0})),()=>{var g;f==null||f.disconnect(),o.current&&o.current.removeEventListener("scroll",d),window.removeEventListener("scroll",d),window.removeEventListener("resize",d),(g=c.current)==null||g.disconnect(),clearTimeout(s.current)}},[e,t,d]),m.useEffect(()=>{l.current&&!n&&i(ou(e,t)),l.current=n},[n,e,t]);let u=r;return l.current&&!n&&(u=ou(e,t)),u}function Pte(e,t,n){let r=`M0 0H${e}V${t}H0Z`;return n&&(r+=` ${n}`),r}function S1(e,t,n,r,i){if(n<=0||r<=0)return"";const s=Math.max(0,Math.min(i,n/2,r/2));let o=`M${e+s} ${t}`;return o+=`H${e+n-s}`,o+=`A${s} ${s} 0 0 1 ${e+n} ${t+s}`,o+=`V${t+r-s}`,o+=`A${s} ${s} 0 0 1 ${e+n-s} ${t+r}`,o+=`H${e+s}`,o+=`A${s} ${s} 0 0 1 ${e} ${t+r-s}`,o+=`V${t+s}`,o+=`A${s} ${s} 0 0 1 ${e+s} ${t}Z`,o}const Ate=[Re.BEACON_BEFORE,Re.BEACON];function Ite(e){var O,U;const{blockTargetInteraction:t,continuous:n,hideOverlay:r,lifecycle:i,onClickOverlay:s,overlayClickAction:o,placement:l,portalElement:c,scrolling:d,spotlightPadding:u,spotlightRadius:f,spotlightTarget:p,styles:h,target:g,waiting:b}=e,S=aZ(),x=_te(p??g,u,d||b),w=m.useRef(null),v=(i===Re.TOOLTIP||i===Re.TOOLTIP_BEFORE)&&l!=="center",[k,E]=m.useState(!1),j=c?(O=w.current)==null?void 0:O.offsetParent:null,A=(j==null?void 0:j.clientWidth)??S.width,$=(j==null?void 0:j.clientHeight)??nte()??S.height,I=((U=h.overlay)==null?void 0:U.backgroundColor)??"rgba(0, 0, 0, 0.5)",F=m.useMemo(()=>{const{backgroundColor:P,mixBlendMode:R,...C}=h.overlay;return{height:$,pointerEvents:"none",...C}},[$,h.overlay]),L=v&&!d&&!b;m.useEffect(()=>{L?requestAnimationFrame(()=>E(!0)):E(!1)},[L]);const T=n&&Ate.includes(i),q=!n&&i!==Re.TOOLTIP;if(r||!b&&(T||q))return null;let D="";if(L)if(c&&j){const P=vi(p??g);if(P){const R=w1(P),C=w1(j);D=S1(R.left-C.left-u.left,R.top-C.top-u.top,P.offsetWidth+u.left+u.right,P.offsetHeight+u.top+u.bottom,f)}}else D=S1(x.left,x.top,x.width,x.height,f);const W=Pte(A,$,D);return Ye.createElement("div",{ref:w,"aria-hidden":"true",className:"react-joyride__overlay","data-testid":"overlay",style:F},Ye.createElement("svg",{className:"react-joyride__spotlight","data-testid":"spotlight",style:{height:$,left:0,position:x.isFixed?"fixed":"absolute",top:0,width:A}},Ye.createElement("path",{d:W,fill:I,fillRule:"evenodd",onClick:s,style:{cursor:o?"pointer":"default",pointerEvents:"auto"}}),D&&Ye.createElement("path",{d:D,fill:I,style:{opacity:k?0:1,pointerEvents:t?"auto":"none",transition:"opacity 0.2s"}}),D&&Object.keys(h.spotlight).length>0&&Ye.createElement("path",{d:D,fill:"none",style:{pointerEvents:"none"},...h.spotlight})))}function TI(e){const{children:t,element:n}=e;return n?Dr.createPortal(t,n):null}const Tte='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), area[href], [tabindex]:not([tabindex="-1"]), [contenteditable]';function Rte(e,t){const n=m.useRef(null);m.useEffect(()=>{if(!e)return wd;n.current=document.activeElement;const r=s=>{if(s.key!=="Tab")return;const o=[...e.querySelectorAll(Tte)],{shiftKey:l}=s;if(!o.length)return;s.preventDefault();let c=document.activeElement?o.indexOf(document.activeElement):0;c===-1||!l&&c+1===o.length?c=0:l&&c===0?c=o.length-1:c+=l?-1:1,o[c].focus()};e.addEventListener("keydown",r,!1);let i;{const s=e.querySelector(t);s&&(i=setTimeout(()=>{s.focus({preventScroll:!0})},100))}return()=>{var s;e.removeEventListener("keydown",r),i!==void 0&&clearTimeout(i),(s=n.current)==null||s.focus({preventScroll:!0})}},[e,t])}function qs(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 Lte(e,t,n){const[r]=e.split("-");switch(r){case"top":return{points:`0,0 ${t/2},${n} ${t},0`,...qs(e,t,n)};case"bottom":return{points:`${t},${n} ${t/2},0 0,${n}`,...qs(e,t,n)};case"left":return{points:`0,0 ${n},${t/2} 0,${t}`,...qs(e,t,n)};case"right":return{points:`${n},${t} ${n},0 0,${t/2}`,...qs(e,t,n)};default:return null}}function Ote(e,t,n,r){if(!t)return{};const[i]=e.split("-");switch(i){case"top":return{bottom:-n,left:t.x??0,...qs(e,r,n)};case"bottom":return{top:-n,left:t.x??0,...qs(e,r,n)};case"left":return{right:-n,top:t.y??0,...qs(e,r,n)};case"right":return{left:-n,top:t.y??0,...qs(e,r,n)};default:return{}}}function Mte({arrowComponent:e,arrowRef:t,base:n,placement:r,position:i,size:s,styles:o}){const l=e;let c=null;if(l){if(!qs(r,n,s))return null;c=Ye.createElement("span",{style:{flexShrink:0}},Ye.createElement(l,{base:n,placement:r,size:s}))}else{const d=Lte(r,n,s);if(!d)return null;c=Ye.createElement("svg",{height:d.height,width:d.width,xmlns:"http://www.w3.org/2000/svg"},Ye.createElement("polygon",{fill:"currentColor",points:d.points}))}return Ye.createElement("span",{ref:t,className:"react-joyride__arrow","data-testid":"arrow",style:{...o,...Ote(r,i,s,n),...i?{}:{visibility:"hidden"}}},c)}function $te(e){const{beaconComponent:t,continuous:n,index:r,isLastStep:i,locale:s,nonce:o,onInteract:l,shouldFocus:c,size:d,step:u,styles:f}=e,p=m.useRef(null),h=!!t;m.useEffect(()=>{if(h||document.getElementById("joyride-beacon-animation"))return wd;const S=document.createElement("style");S.id="joyride-beacon-animation",o&&S.setAttribute("nonce",o),S.appendChild(document.createTextNode(`
|
|
177
|
-
@keyframes joyride-beacon-inner {
|
|
178
|
-
20% {
|
|
179
|
-
opacity: 0.9;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
90% {
|
|
183
|
-
opacity: 0.7;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
@keyframes joyride-beacon-outer {
|
|
188
|
-
0% {
|
|
189
|
-
transform: scale(1);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
45% {
|
|
193
|
-
opacity: 0.7;
|
|
194
|
-
transform: scale(0.75);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
100% {
|
|
198
|
-
opacity: 0.9;
|
|
199
|
-
transform: scale(1);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
`)),document.head.appendChild(S);const x=setTimeout(()=>{hr.domElement(p.current)&&c&&p.current.focus()},0);return()=>{clearTimeout(x);const w=document.getElementById("joyride-beacon-animation");w!=null&&w.parentNode&&w.parentNode.removeChild(w)}},[h,o,c]);const g=Us(s.open);let b;if(t){const S=t;b=Ye.createElement(S,{continuous:n,index:r,isLastStep:i,size:d,step:u})}else b=Ye.createElement("span",{style:f.beacon},Ye.createElement("span",{style:f.beaconOuter}),Ye.createElement("span",{style:f.beaconInner}));return Ye.createElement("button",{ref:p,"aria-label":g,className:"react-joyride__beacon","data-testid":"button-beacon",onClick:l,onMouseEnter:l,style:f.beaconWrapper,title:g,type:"button"},b)}function Dte({styles:e,...t}){const{color:n,height:r,width:i,...s}=e;return Ye.createElement("button",{style:s,type:"button",...t},Ye.createElement("svg",{height:typeof r=="number"?`${r}px`:r,preserveAspectRatio:"xMidYMid",version:"1.1",viewBox:"0 0 18 18",width:typeof i=="number"?`${i}px`:i,xmlns:"http://www.w3.org/2000/svg"},Ye.createElement("g",null,Ye.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 Fte(e){const{backProps:t,closeProps:n,index:r,isLastStep:i,primaryProps:s,skipProps:o,step:l,tooltipProps:c}=e,{buttons:d,content:u,styles:f,title:p}=l,h={};d.includes("primary")&&(h.primary=Ye.createElement("button",{"data-testid":"button-primary",style:f.buttonPrimary,type:"button",...s})),d.includes("skip")&&!i&&(h.skip=Ye.createElement("button",{"aria-live":"off","data-testid":"button-skip",style:f.buttonSkip,type:"button",...o})),d.includes("back")&&r>0&&(h.back=Ye.createElement("button",{"data-testid":"button-back",style:f.buttonBack,type:"button",...t})),h.close=d.includes("close")&&Ye.createElement(Dte,{"data-testid":"button-close",styles:f.buttonClose,...n});const g=p?{"aria-labelledby":"joyride-tooltip-title","aria-describedby":"joyride-tooltip-content"}:{"aria-label":Us(u),"aria-describedby":"joyride-tooltip-content"};return Ye.createElement("div",{key:"JoyrideTooltip",className:"react-joyride__tooltip","data-joyride-step":r,...l.id&&{"data-joyride-id":l.id},style:f.tooltip,...c,...g},Ye.createElement("div",{style:f.tooltipContainer},p&&Ye.createElement("h4",{id:"joyride-tooltip-title",style:f.tooltipTitle},p),Ye.createElement("div",{id:"joyride-tooltip-content",style:f.tooltipContent},u)),d.some(b=>b==="back"||b==="primary"||b==="skip")&&Ye.createElement("div",{style:f.tooltipFooter},Ye.createElement("div",{style:f.tooltipFooterSpacer},h.skip),h.back,h.primary),h.close)}function zte(e){const{continuous:t,controls:n,index:r,isLastStep:i,size:s,step:o}=e,l=x=>{x.preventDefault(),n.prev(ms.BUTTON_BACK)},c=x=>{x.preventDefault(),o.closeButtonAction==="skip"?n.skip(ms.BUTTON_CLOSE):n.close(ms.BUTTON_CLOSE)},d=x=>{if(x.preventDefault(),!t){n.close(ms.BUTTON_PRIMARY);return}n.next(ms.BUTTON_PRIMARY)},u=x=>{x.preventDefault(),n.skip(ms.BUTTON_SKIP)},f=()=>{const{back:x,close:w,last:v,next:k,nextWithProgress:E,skip:j}=o.locale,A=Us(x),$=Us(w),I=Us(v),F=Us(k),L=Us(j);let T=w,q=$;if(t){if(T=k,q=F,o.showProgress&&!i){const D=Us(E,{step:r+1,steps:s});T=Yx(E,r+1,s),q=D}i&&(T=v,q=I)}return{backProps:{"aria-label":A,children:x,"data-action":"back",onClick:l,role:"button",title:A},closeProps:{"aria-label":$,children:w,"data-action":"close",onClick:c,role:"button",title:$},primaryProps:{"aria-label":q,children:T,"data-action":"primary",onClick:d,role:"button",title:q},skipProps:{"aria-label":L,children:j,"data-action":"skip",onClick:u,role:"button",title:L},tooltipProps:{"aria-modal":!0,role:"alertdialog"}}},{arrowComponent:p,beaconComponent:h,tooltipComponent:g,...b}=o;let S;if(g){const x=g;S=Ye.createElement(x,{...f(),continuous:t,controls:n,index:r,isLastStep:i,size:s,step:b})}else S=Ye.createElement(Fte,{...f(),continuous:t,controls:n,index:r,isLastStep:i,size:s,step:b});return S}function Bte(e){if(e.startsWith("left"))return["top","bottom"];if(e.startsWith("right"))return["bottom","top"]}function Hte(e,t,n){var r,i;return e?[Kee()]:((r=t.floatingOptions)==null?void 0:r.flipOptions)===!1?[]:[Vee({crossAxis:!1,fallbackPlacements:Bte(n),padding:20,...(i=t.floatingOptions)==null?void 0:i.flipOptions})]}function Ute(e){var R,C,G,J,B;const{continuous:t,controls:n,index:r,lifecycle:i,nonce:s,open:o,portalElement:l,setPositionData:c,setTooltipRef:d,shouldScroll:u,size:f,step:p,target:h,updateState:g}=e,b=m.useRef(null),S=m.useRef({}),x=m.useRef({}),w=p.placement==="center",v=p.placement==="auto",k=m.useMemo(()=>({getBoundingClientRect:()=>({x:window.innerWidth/2,y:window.innerHeight/2,top:window.innerHeight/2,left:window.innerWidth/2,bottom:window.innerHeight/2,right:window.innerWidth/2,width:0,height:0})}),[]),E=m.useMemo(()=>_I(h)?Sc(h):void 0,[h]),j=m.useMemo(()=>Nc(h),[h]),A=m.useMemo(()=>E?{boundary:E,rootBoundary:"viewport"}:{},[E]),$=w||v?"bottom":p.placement,I=w?"fixed":((R=p.floatingOptions)==null?void 0:R.strategy)??(p.isFixed||j?"fixed":"absolute"),F=m.useMemo(()=>{var te,de,ce,ue;return w?[{name:"center",fn:({rects:re})=>({x:(window.innerWidth-re.floating.width)/2,y:(window.innerHeight-re.floating.height)/2})}]:[g1(({placement:re})=>{var pe;let ge="right";re.startsWith("top")?ge="top":re.startsWith("bottom")?ge="bottom":re.startsWith("left")&&(ge="left");const se=p.spotlightTarget?0:p.spotlightPadding[ge];return p.offset+se+((pe=p.floatingOptions)!=null&&pe.hideArrow?0:p.arrowSize)},[p.offset,p.spotlightPadding,p.spotlightTarget,p.arrowSize,(te=p.floatingOptions)==null?void 0:te.hideArrow]),...Hte(v,p,$),Wee({padding:10,...A,...(de=p.floatingOptions)==null?void 0:de.shiftOptions}),...(ce=p.floatingOptions)!=null&&ce.hideArrow?[]:[qee({element:b,padding:p.arrowSpacing},[p.arrowSpacing,p.arrowBase])],...((ue=p.floatingOptions)==null?void 0:ue.middleware)??[]]},[w,p,v,$,A]),L=m1({...w?{elements:{reference:k}}:{},placement:$,strategy:I,middleware:F}),T=m1({strategy:I,placement:p.beaconPlacement??(v||w?"bottom":p.placement),middleware:m.useMemo(()=>{var te,de;return[g1(((de=(te=p.floatingOptions)==null?void 0:te.beaconOptions)==null?void 0:de.offset)??-18)]},[(G=(C=p.floatingOptions)==null?void 0:C.beaconOptions)==null?void 0:G.offset]),whileElementsMounted:f1});x.current=L.middlewareData,S.current=T.middlewareData,m.useEffect(()=>{var ce;const{floating:te,reference:de}=L.elements;if(!(!de||!te||i!==Re.TOOLTIP))return f1(de,te,L.update,(ce=p.floatingOptions)==null?void 0:ce.autoUpdate)},[i,L.update,(J=p.floatingOptions)==null?void 0:J.autoUpdate,p.target,L.elements]),m.useEffect(()=>{!w&&h&&L.refs.setReference(h),h&&T.refs.setReference(h)},[T.refs,w,h,L.refs]),m.useEffect(()=>{L.isPositioned&&c("tooltip",{placement:L.placement,x:L.x??0,y:L.y??0,middlewareData:x.current})},[c,L.isPositioned,L.placement,L.x,L.y]),m.useEffect(()=>{T.isPositioned&&c("beacon",{placement:T.placement,x:T.x??0,y:T.y??0,middlewareData:S.current})},[c,T.isPositioned,T.placement,T.x,T.y]);const q=p.zIndex+100,D=m.useCallback(te=>{te.type==="mouseenter"&&p.beaconTrigger!=="hover"||g({lifecycle:Re.TOOLTIP_BEFORE,positioned:!1})},[p.beaconTrigger,g]),W=m.useCallback(te=>{te&&(L.refs.setFloating(te),d(te))},[L.refs,d]),{arrow:O,floater:U}=p.styles;let P=null;if(i===Re.TOOLTIP||i===Re.TOOLTIP_BEFORE){const te=x1({...U,...L.floatingStyles,zIndex:q,opacity:o&&L.isPositioned?1:0,...!o&&{transition:"none"}});P=Ye.createElement("div",{ref:W,className:"react-joyride__floater","data-testid":"floater",id:`react-joyride-step-${r}`,style:te},Ye.createElement(zte,{continuous:t,controls:n,index:r,isLastStep:r+1===f,size:f,step:p}),!w&&!((B=p.floatingOptions)!=null&&B.hideArrow)&&Ye.createElement(Mte,{arrowComponent:p.arrowComponent,arrowRef:b,base:p.arrowBase,placement:L.placement,position:L.middlewareData.arrow,size:p.arrowSize,styles:O}))}else(i===Re.BEACON||i===Re.BEACON_BEFORE)&&(P=Ye.createElement("div",{ref:T.refs.setFloating,className:"react-joyride__floater","data-testid":"floater-beacon",id:`react-joyride-step-${r}-beacon`,style:x1({...T.floatingStyles,zIndex:q})},Ye.createElement($te,{beaconComponent:p.beaconComponent,continuous:t,index:r,isLastStep:r+1===f,locale:p.locale,nonce:s,onInteract:D,shouldFocus:u,size:f,step:p,styles:p.styles})));return Ye.createElement(TI,{element:l},P)}function Wte(e){const{continuous:t,controls:n,index:r,lifecycle:i,nonce:s,portalElement:o,setPositionData:l,shouldScroll:c,size:d,step:u,updateState:f}=e,[p,h]=m.useState(null);Rte(u.disableFocusTrap?null:p,"[data-action=primary]");const g=vi(u.target),b=i===Re.TOOLTIP;return!AI(u)||!hr.domElement(g)?null:Ye.createElement(Ute,{key:`JoyrideStep-${r}`,continuous:t,controls:n,index:r,lifecycle:i,nonce:s,open:b,portalElement:o,setPositionData:l,setTooltipRef:h,shouldScroll:c,size:d,step:u,target:g,updateState:f})}function Vte({controls:e,mergedProps:t,state:n,step:r,store:i}){const{continuous:s,debug:o,nonce:l,portalElement:c,scrollToFirstStep:d}=t,u=Nte(c),{index:f,lifecycle:p,status:h}=n,g=h===ht.RUNNING,[b,S]=m.useState(!1),x=m.useRef(null),w=(r==null?void 0:r.loaderDelay)??0;m.useEffect(()=>(n.waiting?w===0?S(!0):x.current=setTimeout(()=>{S(!0)},w):S(!1),()=>{x.current&&(clearTimeout(x.current),x.current=null)}),[w,n.waiting]),m.useEffect(()=>{if(!g)return;const E=j=>{!r||p!==Re.TOOLTIP||j.key==="Escape"&&r.dismissKeyAction&&(r.dismissKeyAction==="next"?e.next(ms.KEYBOARD):e.close(ms.KEYBOARD))};return document.body.addEventListener("keydown",E,{passive:!0}),()=>{document.body.removeEventListener("keydown",E)}},[e,g,p,r]);const v=m.useCallback(()=>{(r==null?void 0:r.overlayClickAction)==="close"?e.close(ms.OVERLAY):(r==null?void 0:r.overlayClickAction)==="next"&&e.next(ms.OVERLAY)},[e,r==null?void 0:r.overlayClickAction]);if(!r||!g)return null;const k=n.action===yt.START&&!r.skipBeacon&&r.placement!=="center";return Ye.createElement(Ye.Fragment,null,p!==Re.INIT&&Ye.createElement(Wte,{...n,continuous:s,controls:e,debug:o,nonce:l,portalElement:u,setPositionData:i.current.setPositionData,shouldScroll:!r.skipScroll&&(f!==0||d),step:r,updateState:i.current.updateState}),Ye.createElement(TI,{element:u},Ye.createElement(Ye.Fragment,null,b&&Ye.createElement(Cte,{nonce:l,step:r}),!k&&Ye.createElement(Ite,{...r,continuous:s,lifecycle:p,onClickOverlay:v,portalElement:c?u:null,scrolling:n.scrolling,waiting:n.waiting}))))}function Kte(e){const{controls:t,failures:n,mergedProps:r,state:i,step:s,store:o}=Ste(e);return{controls:t,failures:n,on:m.useCallback((l,c)=>o.current.on(l,c),[o]),state:m.useMemo(()=>Rh(i,"positioned"),[i]),step:s,Tour:Uv()?Ye.createElement(Vte,{controls:t,mergedProps:r,state:i,step:s,store:o}):null}}function qte(e){const{Tour:t}=Kte(e);return t}function Yte(e){return Uv()?Ye.createElement(qte,e):null}function Gte(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 Xte(e){return[{target:"body",content:e("onboarding:flow.intro"),disableBeacon:!0,placement:"center"}]}function Jte(e){return[{target:"body",content:e("onboarding:flow.introEmpty"),disableBeacon:!0,placement:"center"}]}const oy="af:onboarding";function Qte({page:e,hasNodes:t=!1}){const{t:n}=Ut(),[r,i]=m.useState(!1),[s,o]=m.useState([]),l=m.useRef(null),c=m.useMemo(()=>e==="projects"?Gte(n):t?Xte(n):Jte(n),[e,t,n]);return m.useEffect(()=>{const d=localStorage.getItem(oy);console.log("[Onboarding] localStorage:",d);const u=d?JSON.parse(d):{};if(console.log("[Onboarding] progress:",u,"page:",e),u.completed||u[e]){console.log("[Onboarding] skipped - already done"),i(!1),o([]);return}console.log("[Onboarding] starting with steps:",c),o(c),i(!0)},[e,t,c]),m.useEffect(()=>{if(!r)return;const d=u=>{var g;const f=u.target.closest("button");if(!f||!f.closest(".react-joyride__tooltip"))return;const h=(g=f.textContent)==null?void 0:g.trim();if(h===n("onboarding:done")||h===n("onboarding:startCreate")||h===n("onboarding:skip")){const b=localStorage.getItem(oy)||"{}",S=JSON.parse(b);h===n("onboarding:skip")?(S.projects=!0,S.flow=!0,S.completed=!0):S[e]=!0,localStorage.setItem(oy,JSON.stringify(S)),o([]),i(!1),e==="projects"&&(h===n("onboarding:done")||h===n("onboarding:startCreate"))&&(localStorage.setItem("af:newPipelineGuide","true"),setTimeout(()=>{const x=document.querySelector(".af-create-btn");x&&x.click()},500))}};return document.addEventListener("click",d,!0),()=>document.removeEventListener("click",d,!0)},[r,e,n]),!r||s.length===0?null:a.jsx(Yte,{ref:l,steps:s,run:r,continuous:!0,showSkipButton:!0,showProgress:s.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 Zte(){const{navigate:e,path:t}=Wa(),[n,r]=m.useState([]),[i,s]=m.useState(!1);if(m.useEffect(()=>{let u=!1;const f=async()=>{try{const h=await fetch("/api/pipeline-recent-runs");if(!h.ok)return;const g=await h.json();if(u)return;const b=Array.isArray(g.runs)?g.runs:[];r(b.filter(S=>S&&S.status==="running"))}catch{}};f();const p=window.setInterval(f,3e3);return()=>{u=!0,window.clearInterval(p)}},[]),n.length===0)return null;const o=u=>{const f=new URLSearchParams({flowId:u.flowId,flowSource:u.flowSource||"workspace"});e(`/flow?${f.toString()}`),s(!1)},l=t==="/flow"?new URLSearchParams(window.location.search):null,c=(l==null?void 0:l.get("flowId"))||"",d=n.length===1;return a.jsxs("div",{className:"af-run-indicator",role:"status","aria-live":"polite",children:[i&&!d&&a.jsx("div",{className:"af-run-indicator__menu",onMouseLeave:()=>s(!1),children:n.map(u=>a.jsxs("button",{type:"button",className:"af-run-indicator__item"+(u.flowId===c?" af-run-indicator__item--current":""),onClick:()=>o(u),title:`${u.flowId} · ${u.runId}`,children:[a.jsx("span",{className:"af-run-indicator__dot"}),a.jsx("span",{className:"af-run-indicator__flow",children:u.flowId}),a.jsx("span",{className:"af-run-indicator__run",children:u.runId.slice(0,12)})]},`${u.flowId}:${u.runId}`))}),a.jsxs("button",{type:"button",className:"af-run-indicator__btn",onClick:()=>d?o(n[0]):s(u=>!u),title:d?`${n[0].flowId} 运行中,点击跳转`:`${n.length} 个 pipeline 运行中`,children:[a.jsx("span",{className:"af-run-indicator__pulse"}),a.jsx("span",{className:"af-run-indicator__label",children:d?n[0].flowId:`${n.length} running`})]})]})}class ene extends m.Component{constructor(t){super(t),this.state={error:null,info:null}}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,n){console.error("[AgentFlow UI render error]",t,n),this.setState({error:t,info:n})}render(){var r,i,s;if(!this.state.error)return this.props.children;const t=String(((r=this.state.error)==null?void 0:r.stack)||((i=this.state.error)==null?void 0:i.message)||this.state.error),n=String(((s=this.state.info)==null?void 0:s.componentStack)||"");return a.jsx("div",{className:"af-auth-screen",children:a.jsxs("div",{className:"af-auth-panel af-ui-error-panel",children:[a.jsxs("div",{className:"af-auth-brand",children:[a.jsx("span",{className:"material-symbols-outlined",children:"error"}),a.jsxs("div",{children:[a.jsx("h1",{children:"AgentFlow UI Error"}),a.jsx("p",{children:"页面渲染失败,下面是调试堆栈。"})]})]}),a.jsx("pre",{children:t}),n?a.jsx("pre",{children:n}):null]})})}}function tne(){const{path:e}=Wa();return e==="/projects"||e==="/"?a.jsx(cl,{}):e==="/nodes"?a.jsx(cl,{resourceKind:"nodes"}):e==="/my-nodes"?a.jsx(cl,{resourceKind:"my-nodes"}):e==="/my-flows"?a.jsx(cl,{resourceKind:"my-flows"}):e==="/skills"?a.jsx(cl,{resourceKind:"skills"}):e==="/flow"?a.jsx(xV,{}):e==="/workspace"?a.jsx(e7,{}):e==="/settings"?a.jsx(HQ,{}):a.jsx(cl,{})}function nne({children:e}){const[t,n]=m.useState({loading:!0,authenticated:!1,user:null,setupRequired:!1}),[r,i]=m.useState(""),[s,o]=m.useState(""),[l,c]=m.useState(!1),[d,u]=m.useState(""),f=async()=>{try{const g=await(await fetch("/api/auth/me")).json().catch(()=>({}));n({loading:!1,authenticated:!!g.authenticated,user:g.user||null,setupRequired:!!g.setupRequired})}catch(h){n({loading:!1,authenticated:!1,user:null,setupRequired:!1}),u(String(h.message||h))}};m.useEffect(()=>{f()},[]);const p=async h=>{h.preventDefault(),c(!0),u("");try{const g=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:r,password:s})}),b=await g.json().catch(()=>({}));if(!g.ok)throw new Error(b.error||"登录失败");n({loading:!1,authenticated:!0,user:b.user||null,setupRequired:!1})}catch(g){u(String(g.message||g))}finally{c(!1)}};return t.loading?a.jsx("div",{className:"af-auth-screen",children:a.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})}}):a.jsx("div",{className:"af-auth-screen",children:a.jsxs("form",{className:"af-auth-panel",onSubmit:p,children:[a.jsxs("div",{className:"af-auth-brand",children:[a.jsx("span",{className:"material-symbols-outlined",children:"account_circle"}),a.jsxs("div",{children:[a.jsx("h1",{children:"AgentFlow"}),a.jsx("p",{children:t.setupRequired?"初始化管理员账号":"登录或创建用户"})]})]}),a.jsxs("label",{className:"af-auth-field",children:[a.jsx("span",{children:"用户名"}),a.jsx("input",{value:r,onChange:h=>i(h.target.value),autoComplete:"username",autoFocus:!0})]}),a.jsxs("label",{className:"af-auth-field",children:[a.jsx("span",{children:"密码"}),a.jsx("input",{type:"password",value:s,onChange:h=>o(h.target.value),autoComplete:t.setupRequired?"new-password":"current-password"})]}),d?a.jsx("p",{className:"af-auth-error",children:d}):null,a.jsx("button",{className:"af-auth-submit",type:"submit",disabled:l||!r.trim()||s.length<4,children:l?"处理中...":t.setupRequired?"创建并登录":"登录"})]})})}function rne({authUser:e,onLogout:t}){const{path:n}=Wa(),r=n==="/flow"||n==="/workspace";return a.jsxs("div",{className:"af-app",children:[n!=="/settings"?a.jsx(Qte,{page:r?"flow":"projects"}):null,r?null:a.jsx(EL,{authUser:e,onLogout:t}),a.jsx("div",{className:r?"af-main af-main--pipeline":"af-main",children:a.jsx(tne,{})}),a.jsx(Zte,{})]})}function ine(){return a.jsx(ene,{children:a.jsx(lL,{children:a.jsx(nne,{children:({user:e,onLogout:t})=>a.jsx(rne,{authUser:e,onLogout:t})})})})}window.addEventListener("error",e=>{console.error("[AgentFlow UI global error]",e.error||e.message,{filename:e.filename,lineno:e.lineno,colno:e.colno})});window.addEventListener("unhandledrejection",e=>{console.error("[AgentFlow UI unhandled rejection]",e.reason)});const N1=document.querySelector('link[rel="icon"]');N1&&(N1.href=zC);ay.createRoot(document.getElementById("root")).render(a.jsx(Ye.StrictMode,{children:a.jsx(ine,{})}));
|