@fieldwangai/agentflow 0.1.85 → 0.1.87

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,250 +0,0 @@
1
- var BI=Object.defineProperty;var WI=(e,t,n)=>t in e?BI(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var cn=(e,t,n)=>WI(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var Vc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function oo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ej={exports:{}},Mp={},tj={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 _u=Symbol.for("react.element"),VI=Symbol.for("react.portal"),KI=Symbol.for("react.fragment"),UI=Symbol.for("react.strict_mode"),qI=Symbol.for("react.profiler"),YI=Symbol.for("react.provider"),GI=Symbol.for("react.context"),XI=Symbol.for("react.forward_ref"),JI=Symbol.for("react.suspense"),QI=Symbol.for("react.memo"),ZI=Symbol.for("react.lazy"),fv=Symbol.iterator;function eT(e){return e===null||typeof e!="object"?null:(e=fv&&e[fv]||e["@@iterator"],typeof e=="function"?e:null)}var nj={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},rj=Object.assign,sj={};function Nl(e,t,n){this.props=e,this.context=t,this.refs=sj,this.updater=n||nj}Nl.prototype.isReactComponent={};Nl.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")};Nl.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function ij(){}ij.prototype=Nl.prototype;function Xy(e,t,n){this.props=e,this.context=t,this.refs=sj,this.updater=n||nj}var Jy=Xy.prototype=new ij;Jy.constructor=Xy;rj(Jy,Nl.prototype);Jy.isPureReactComponent=!0;var pv=Array.isArray,oj=Object.prototype.hasOwnProperty,Qy={current:null},aj={key:!0,ref:!0,__self:!0,__source:!0};function lj(e,t,n){var r,s={},i=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)oj.call(t,r)&&!aj.hasOwnProperty(r)&&(s[r]=t[r]);var l=arguments.length-2;if(l===1)s.children=n;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];s.children=c}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)s[r]===void 0&&(s[r]=l[r]);return{$$typeof:_u,type:e,key:i,ref:o,props:s,_owner:Qy.current}}function tT(e,t){return{$$typeof:_u,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Zy(e){return typeof e=="object"&&e!==null&&e.$$typeof===_u}function nT(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var hv=/\/+/g;function Fh(e,t){return typeof e=="object"&&e!==null&&e.key!=null?nT(""+e.key):t.toString(36)}function uf(e,t,n,r,s){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case _u:case VI:o=!0}}if(o)return o=e,s=s(o),e=r===""?"."+Fh(o,0):r,pv(s)?(n="",e!=null&&(n=e.replace(hv,"$&/")+"/"),uf(s,t,n,"",function(u){return u})):s!=null&&(Zy(s)&&(s=tT(s,n+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(hv,"$&/")+"/")+e)),t.push(s)),1;if(o=0,r=r===""?".":r+":",pv(e))for(var l=0;l<e.length;l++){i=e[l];var c=r+Fh(i,l);o+=uf(i,t,n,c,s)}else if(c=eT(e),typeof c=="function")for(e=c.call(e),l=0;!(i=e.next()).done;)i=i.value,c=r+Fh(i,l++),o+=uf(i,t,n,c,s);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function gd(e,t,n){if(e==null)return e;var r=[],s=0;return uf(e,r,"","",function(i){return t.call(n,i,s++)}),r}function rT(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 cr={current:null},df={transition:null},sT={ReactCurrentDispatcher:cr,ReactCurrentBatchConfig:df,ReactCurrentOwner:Qy};function cj(){throw Error("act(...) is not supported in production builds of React.")}mt.Children={map:gd,forEach:function(e,t,n){gd(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return gd(e,function(){t++}),t},toArray:function(e){return gd(e,function(t){return t})||[]},only:function(e){if(!Zy(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};mt.Component=Nl;mt.Fragment=KI;mt.Profiler=qI;mt.PureComponent=Xy;mt.StrictMode=UI;mt.Suspense=JI;mt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=sT;mt.act=cj;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=rj({},e.props),s=e.key,i=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,o=Qy.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)oj.call(t,c)&&!aj.hasOwnProperty(c)&&(r[c]=t[c]===void 0&&l!==void 0?l[c]:t[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];r.children=l}return{$$typeof:_u,type:e.type,key:s,ref:i,props:r,_owner:o}};mt.createContext=function(e){return e={$$typeof:GI,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:YI,_context:e},e.Consumer=e};mt.createElement=lj;mt.createFactory=function(e){var t=lj.bind(null,e);return t.type=e,t};mt.createRef=function(){return{current:null}};mt.forwardRef=function(e){return{$$typeof:XI,render:e}};mt.isValidElement=Zy;mt.lazy=function(e){return{$$typeof:ZI,_payload:{_status:-1,_result:e},_init:rT}};mt.memo=function(e,t){return{$$typeof:QI,type:e,compare:t===void 0?null:t}};mt.startTransition=function(e){var t=df.transition;df.transition={};try{e()}finally{df.transition=t}};mt.unstable_act=cj;mt.useCallback=function(e,t){return cr.current.useCallback(e,t)};mt.useContext=function(e){return cr.current.useContext(e)};mt.useDebugValue=function(){};mt.useDeferredValue=function(e){return cr.current.useDeferredValue(e)};mt.useEffect=function(e,t){return cr.current.useEffect(e,t)};mt.useId=function(){return cr.current.useId()};mt.useImperativeHandle=function(e,t,n){return cr.current.useImperativeHandle(e,t,n)};mt.useInsertionEffect=function(e,t){return cr.current.useInsertionEffect(e,t)};mt.useLayoutEffect=function(e,t){return cr.current.useLayoutEffect(e,t)};mt.useMemo=function(e,t){return cr.current.useMemo(e,t)};mt.useReducer=function(e,t,n){return cr.current.useReducer(e,t,n)};mt.useRef=function(e){return cr.current.useRef(e)};mt.useState=function(e){return cr.current.useState(e)};mt.useSyncExternalStore=function(e,t,n){return cr.current.useSyncExternalStore(e,t,n)};mt.useTransition=function(){return cr.current.useTransition()};mt.version="18.3.1";tj.exports=mt;var m=tj.exports;const Ye=oo(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 iT=m,oT=Symbol.for("react.element"),aT=Symbol.for("react.fragment"),lT=Object.prototype.hasOwnProperty,cT=iT.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,uT={key:!0,ref:!0,__self:!0,__source:!0};function uj(e,t,n){var r,s={},i=null,o=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)lT.call(t,r)&&!uT.hasOwnProperty(r)&&(s[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)s[r]===void 0&&(s[r]=t[r]);return{$$typeof:oT,type:e,key:i,ref:o,props:s,_owner:cT.current}}Mp.Fragment=aT;Mp.jsx=uj;Mp.jsxs=uj;ej.exports=Mp;var a=ej.exports,sg={},dj={exports:{}},Hr={},fj={exports:{}},pj={};/**
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(I,H){var _=I.length;I.push(H);e:for(;0<_;){var Y=_-1>>>1,U=I[Y];if(0<s(U,H))I[Y]=H,I[_]=U,_=Y;else break e}}function n(I){return I.length===0?null:I[0]}function r(I){if(I.length===0)return null;var H=I[0],_=I.pop();if(_!==H){I[0]=_;e:for(var Y=0,U=I.length,V=U>>>1;Y<V;){var Z=2*(Y+1)-1,ue=I[Z],le=Z+1,we=I[le];if(0>s(ue,_))le<U&&0>s(we,ue)?(I[Y]=we,I[le]=_,Y=le):(I[Y]=ue,I[Z]=_,Y=Z);else if(le<U&&0>s(we,_))I[Y]=we,I[le]=_,Y=le;else break e}}return H}function s(I,H){var _=I.sortIndex-H.sortIndex;return _!==0?_:I.id-H.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],u=[],p=1,f=null,d=3,h=!1,y=!1,w=!1,k=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(I){for(var H=n(u);H!==null;){if(H.callback===null)r(u);else if(H.startTime<=I)r(u),H.sortIndex=H.expirationTime,t(c,H);else break;H=n(u)}}function S(I){if(w=!1,x(I),!y)if(n(c)!==null)y=!0,T(C);else{var H=n(u);H!==null&&O(S,H.startTime-I)}}function C(I,H){y=!1,w&&(w=!1,g(A),A=-1),h=!0;var _=d;try{for(x(H),f=n(c);f!==null&&(!(f.expirationTime>H)||I&&!F());){var Y=f.callback;if(typeof Y=="function"){f.callback=null,d=f.priorityLevel;var U=Y(f.expirationTime<=H);H=e.unstable_now(),typeof U=="function"?f.callback=U:f===n(c)&&r(c),x(H)}else r(c);f=n(c)}if(f!==null)var V=!0;else{var Z=n(u);Z!==null&&O(S,Z.startTime-H),V=!1}return V}finally{f=null,d=_,h=!1}}var j=!1,E=null,A=-1,D=5,W=-1;function F(){return!(e.unstable_now()-W<D)}function R(){if(E!==null){var I=e.unstable_now();W=I;var H=!0;try{H=E(!0,I)}finally{H?$():(j=!1,E=null)}}else j=!1}var $;if(typeof b=="function")$=function(){b(R)};else if(typeof MessageChannel<"u"){var P=new MessageChannel,L=P.port2;P.port1.onmessage=R,$=function(){L.postMessage(null)}}else $=function(){k(R,0)};function T(I){E=I,j||(j=!0,$())}function O(I,H){A=k(function(){I(e.unstable_now())},H)}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(I){I.callback=null},e.unstable_continueExecution=function(){y||h||(y=!0,T(C))},e.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<I?Math.floor(1e3/I):5},e.unstable_getCurrentPriorityLevel=function(){return d},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(I){switch(d){case 1:case 2:case 3:var H=3;break;default:H=d}var _=d;d=H;try{return I()}finally{d=_}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(I,H){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var _=d;d=I;try{return H()}finally{d=_}},e.unstable_scheduleCallback=function(I,H,_){var Y=e.unstable_now();switch(typeof _=="object"&&_!==null?(_=_.delay,_=typeof _=="number"&&0<_?Y+_:Y):_=Y,I){case 1:var U=-1;break;case 2:U=250;break;case 5:U=1073741823;break;case 4:U=1e4;break;default:U=5e3}return U=_+U,I={id:p++,callback:H,priorityLevel:I,startTime:_,expirationTime:U,sortIndex:-1},_>Y?(I.sortIndex=_,t(u,I),n(c)===null&&I===n(u)&&(w?(g(A),A=-1):w=!0,O(S,_-Y))):(I.sortIndex=U,t(c,I),y||h||(y=!0,T(C))),I},e.unstable_shouldYield=F,e.unstable_wrapCallback=function(I){var H=d;return function(){var _=d;d=H;try{return I.apply(this,arguments)}finally{d=_}}}})(pj);fj.exports=pj;var dT=fj.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 fT=m,Fr=dT;function ge(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 hj=new Set,Kc={};function Qo(e,t){sl(e,t),sl(e+"Capture",t)}function sl(e,t){for(Kc[e]=t,e=0;e<t.length;e++)hj.add(t[e])}var yi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ig=Object.prototype.hasOwnProperty,pT=/^[: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]*$/,mv={},gv={};function hT(e){return ig.call(gv,e)?!0:ig.call(mv,e)?!1:pT.test(e)?gv[e]=!0:(mv[e]=!0,!1)}function mT(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 gT(e,t,n,r){if(t===null||typeof t>"u"||mT(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 ur(e,t,n,r,s,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var Bn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Bn[e]=new ur(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Bn[t]=new ur(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Bn[e]=new ur(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Bn[e]=new ur(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){Bn[e]=new ur(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Bn[e]=new ur(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Bn[e]=new ur(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Bn[e]=new ur(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Bn[e]=new ur(e,5,!1,e.toLowerCase(),null,!1,!1)});var ex=/[\-:]([a-z])/g;function tx(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(ex,tx);Bn[t]=new ur(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(ex,tx);Bn[t]=new ur(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(ex,tx);Bn[t]=new ur(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Bn[e]=new ur(e,1,!1,e.toLowerCase(),null,!1,!1)});Bn.xlinkHref=new ur("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Bn[e]=new ur(e,1,!1,e.toLowerCase(),null,!0,!0)});function nx(e,t,n,r){var s=Bn.hasOwnProperty(t)?Bn[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(gT(t,n,s,r)&&(n=null),r||s===null?hT(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):s.mustUseProperty?e[s.propertyName]=n===null?s.type===3?!1:"":n:(t=s.attributeName,r=s.attributeNamespace,n===null?e.removeAttribute(t):(s=s.type,n=s===3||s===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var Si=fT.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,yd=Symbol.for("react.element"),Pa=Symbol.for("react.portal"),Aa=Symbol.for("react.fragment"),rx=Symbol.for("react.strict_mode"),og=Symbol.for("react.profiler"),mj=Symbol.for("react.provider"),gj=Symbol.for("react.context"),sx=Symbol.for("react.forward_ref"),ag=Symbol.for("react.suspense"),lg=Symbol.for("react.suspense_list"),ix=Symbol.for("react.memo"),$i=Symbol.for("react.lazy"),yj=Symbol.for("react.offscreen"),yv=Symbol.iterator;function Ql(e){return e===null||typeof e!="object"?null:(e=yv&&e[yv]||e["@@iterator"],typeof e=="function"?e:null)}var on=Object.assign,zh;function gc(e){if(zh===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);zh=t&&t[1]||""}return`
34
- `+zh+e}var Hh=!1;function Bh(e,t){if(!e||Hh)return"";Hh=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var r=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){r=u}e.call(t.prototype)}else{try{throw Error()}catch(u){r=u}e()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var s=u.stack.split(`
35
- `),i=r.stack.split(`
36
- `),o=s.length-1,l=i.length-1;1<=o&&0<=l&&s[o]!==i[l];)l--;for(;1<=o&&0<=l;o--,l--)if(s[o]!==i[l]){if(o!==1||l!==1)do if(o--,l--,0>l||s[o]!==i[l]){var c=`
37
- `+s[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{Hh=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?gc(e):""}function yT(e){switch(e.tag){case 5:return gc(e.type);case 16:return gc("Lazy");case 13:return gc("Suspense");case 19:return gc("SuspenseList");case 0:case 2:case 15:return e=Bh(e.type,!1),e;case 11:return e=Bh(e.type.render,!1),e;case 1:return e=Bh(e.type,!0),e;default:return""}}function cg(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 Aa:return"Fragment";case Pa:return"Portal";case og:return"Profiler";case rx:return"StrictMode";case ag:return"Suspense";case lg:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case gj:return(e.displayName||"Context")+".Consumer";case mj:return(e._context.displayName||"Context")+".Provider";case sx:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ix:return t=e.displayName||null,t!==null?t:cg(e.type)||"Memo";case $i:t=e._payload,e=e._init;try{return cg(e(t))}catch{}}return null}function xT(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 cg(t);case 8:return t===rx?"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 no(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function xj(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function wT(e){var t=xj(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.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 xd(e){e._valueTracker||(e._valueTracker=wT(e))}function wj(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=xj(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Rf(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 ug(e,t){var n=t.checked;return on({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function xv(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=no(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 bj(e,t){t=t.checked,t!=null&&nx(e,"checked",t,!1)}function dg(e,t){bj(e,t);var n=no(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")?fg(e,t.type,n):t.hasOwnProperty("defaultValue")&&fg(e,t.type,no(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function wv(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 fg(e,t,n){(t!=="number"||Rf(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var yc=Array.isArray;function Ua(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s<n.length;s++)t["$"+n[s]]=!0;for(n=0;n<e.length;n++)s=t.hasOwnProperty("$"+e[n].value),e[n].selected!==s&&(e[n].selected=s),s&&r&&(e[n].defaultSelected=!0)}else{for(n=""+no(n),t=null,s=0;s<e.length;s++){if(e[s].value===n){e[s].selected=!0,r&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function pg(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(ge(91));return on({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function bv(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(ge(92));if(yc(n)){if(1<n.length)throw Error(ge(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:no(n)}}function vj(e,t){var n=no(t.value),r=no(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 vv(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function kj(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 hg(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?kj(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var wd,Sj=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,s){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,s)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(wd=wd||document.createElement("div"),wd.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=wd.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Uc(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var jc={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},bT=["Webkit","ms","Moz","O"];Object.keys(jc).forEach(function(e){bT.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),jc[t]=jc[e]})});function Nj(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||jc.hasOwnProperty(e)&&jc[e]?(""+t).trim():t+"px"}function jj(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=Nj(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var vT=on({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 mg(e,t){if(t){if(vT[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(ge(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(ge(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(ge(61))}if(t.style!=null&&typeof t.style!="object")throw Error(ge(62))}}function gg(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 yg=null;function ox(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var xg=null,qa=null,Ya=null;function kv(e){if(e=Iu(e)){if(typeof xg!="function")throw Error(ge(280));var t=e.stateNode;t&&(t=Fp(t),xg(e.stateNode,e.type,t))}}function Cj(e){qa?Ya?Ya.push(e):Ya=[e]:qa=e}function Ej(){if(qa){var e=qa,t=Ya;if(Ya=qa=null,kv(e),t)for(e=0;e<t.length;e++)kv(t[e])}}function _j(e,t){return e(t)}function Pj(){}var Wh=!1;function Aj(e,t,n){if(Wh)return e(t,n);Wh=!0;try{return _j(e,t,n)}finally{Wh=!1,(qa!==null||Ya!==null)&&(Pj(),Ej())}}function qc(e,t){var n=e.stateNode;if(n===null)return null;var r=Fp(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(ge(231,t,typeof n));return n}var wg=!1;if(yi)try{var Zl={};Object.defineProperty(Zl,"passive",{get:function(){wg=!0}}),window.addEventListener("test",Zl,Zl),window.removeEventListener("test",Zl,Zl)}catch{wg=!1}function kT(e,t,n,r,s,i,o,l,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(p){this.onError(p)}}var Cc=!1,Mf=null,Lf=!1,bg=null,ST={onError:function(e){Cc=!0,Mf=e}};function NT(e,t,n,r,s,i,o,l,c){Cc=!1,Mf=null,kT.apply(ST,arguments)}function jT(e,t,n,r,s,i,o,l,c){if(NT.apply(this,arguments),Cc){if(Cc){var u=Mf;Cc=!1,Mf=null}else throw Error(ge(198));Lf||(Lf=!0,bg=u)}}function Zo(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 Ij(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 Sv(e){if(Zo(e)!==e)throw Error(ge(188))}function CT(e){var t=e.alternate;if(!t){if(t=Zo(e),t===null)throw Error(ge(188));return t!==e?null:e}for(var n=e,r=t;;){var s=n.return;if(s===null)break;var i=s.alternate;if(i===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===n)return Sv(s),e;if(i===r)return Sv(s),t;i=i.sibling}throw Error(ge(188))}if(n.return!==r.return)n=s,r=i;else{for(var o=!1,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){for(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)throw Error(ge(189))}}if(n.alternate!==r)throw Error(ge(190))}if(n.tag!==3)throw Error(ge(188));return n.stateNode.current===n?e:t}function Tj(e){return e=CT(e),e!==null?Rj(e):null}function Rj(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Rj(e);if(t!==null)return t;e=e.sibling}return null}var Mj=Fr.unstable_scheduleCallback,Nv=Fr.unstable_cancelCallback,ET=Fr.unstable_shouldYield,_T=Fr.unstable_requestPaint,mn=Fr.unstable_now,PT=Fr.unstable_getCurrentPriorityLevel,ax=Fr.unstable_ImmediatePriority,Lj=Fr.unstable_UserBlockingPriority,$f=Fr.unstable_NormalPriority,AT=Fr.unstable_LowPriority,$j=Fr.unstable_IdlePriority,Lp=null,Vs=null;function IT(e){if(Vs&&typeof Vs.onCommitFiberRoot=="function")try{Vs.onCommitFiberRoot(Lp,e,void 0,(e.current.flags&128)===128)}catch{}}var Cs=Math.clz32?Math.clz32:MT,TT=Math.log,RT=Math.LN2;function MT(e){return e>>>=0,e===0?32:31-(TT(e)/RT|0)|0}var bd=64,vd=4194304;function xc(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 Of(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~s;l!==0?r=xc(l):(i&=o,i!==0&&(r=xc(i)))}else o=n&~s,o!==0?r=xc(o):i!==0&&(r=xc(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,i=t&-t,s>=i||s===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-Cs(t),s=1<<n,r|=e[n],t&=~s;return r}function LT(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 $T(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes;0<i;){var o=31-Cs(i),l=1<<o,c=s[o];c===-1?(!(l&n)||l&r)&&(s[o]=LT(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}}function vg(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Oj(){var e=bd;return bd<<=1,!(bd&4194240)&&(bd=64),e}function Vh(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Pu(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Cs(t),e[t]=n}function OT(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var s=31-Cs(n),i=1<<s;t[s]=0,r[s]=-1,e[s]=-1,n&=~i}}function lx(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Cs(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}var It=0;function Dj(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Fj,cx,zj,Hj,Bj,kg=!1,kd=[],Ui=null,qi=null,Yi=null,Yc=new Map,Gc=new Map,Fi=[],DT="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 jv(e,t){switch(e){case"focusin":case"focusout":Ui=null;break;case"dragenter":case"dragleave":qi=null;break;case"mouseover":case"mouseout":Yi=null;break;case"pointerover":case"pointerout":Yc.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Gc.delete(t.pointerId)}}function ec(e,t,n,r,s,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[s]},t!==null&&(t=Iu(t),t!==null&&cx(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function FT(e,t,n,r,s){switch(t){case"focusin":return Ui=ec(Ui,e,t,n,r,s),!0;case"dragenter":return qi=ec(qi,e,t,n,r,s),!0;case"mouseover":return Yi=ec(Yi,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return Yc.set(i,ec(Yc.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,Gc.set(i,ec(Gc.get(i)||null,e,t,n,r,s)),!0}return!1}function Wj(e){var t=Eo(e.target);if(t!==null){var n=Zo(t);if(n!==null){if(t=n.tag,t===13){if(t=Ij(n),t!==null){e.blockedOn=t,Bj(e.priority,function(){zj(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 ff(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Sg(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);yg=r,n.target.dispatchEvent(r),yg=null}else return t=Iu(n),t!==null&&cx(t),e.blockedOn=n,!1;t.shift()}return!0}function Cv(e,t,n){ff(e)&&n.delete(t)}function zT(){kg=!1,Ui!==null&&ff(Ui)&&(Ui=null),qi!==null&&ff(qi)&&(qi=null),Yi!==null&&ff(Yi)&&(Yi=null),Yc.forEach(Cv),Gc.forEach(Cv)}function tc(e,t){e.blockedOn===t&&(e.blockedOn=null,kg||(kg=!0,Fr.unstable_scheduleCallback(Fr.unstable_NormalPriority,zT)))}function Xc(e){function t(s){return tc(s,e)}if(0<kd.length){tc(kd[0],e);for(var n=1;n<kd.length;n++){var r=kd[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Ui!==null&&tc(Ui,e),qi!==null&&tc(qi,e),Yi!==null&&tc(Yi,e),Yc.forEach(t),Gc.forEach(t),n=0;n<Fi.length;n++)r=Fi[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Fi.length&&(n=Fi[0],n.blockedOn===null);)Wj(n),n.blockedOn===null&&Fi.shift()}var Ga=Si.ReactCurrentBatchConfig,Df=!0;function HT(e,t,n,r){var s=It,i=Ga.transition;Ga.transition=null;try{It=1,ux(e,t,n,r)}finally{It=s,Ga.transition=i}}function BT(e,t,n,r){var s=It,i=Ga.transition;Ga.transition=null;try{It=4,ux(e,t,n,r)}finally{It=s,Ga.transition=i}}function ux(e,t,n,r){if(Df){var s=Sg(e,t,n,r);if(s===null)em(e,t,r,Ff,n),jv(e,r);else if(FT(s,e,t,n,r))r.stopPropagation();else if(jv(e,r),t&4&&-1<DT.indexOf(e)){for(;s!==null;){var i=Iu(s);if(i!==null&&Fj(i),i=Sg(e,t,n,r),i===null&&em(e,t,r,Ff,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else em(e,t,r,null,n)}}var Ff=null;function Sg(e,t,n,r){if(Ff=null,e=ox(r),e=Eo(e),e!==null)if(t=Zo(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Ij(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 Ff=e,null}function Vj(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(PT()){case ax:return 1;case Lj:return 4;case $f:case AT:return 16;case $j:return 536870912;default:return 16}default:return 16}}var Bi=null,dx=null,pf=null;function Kj(){if(pf)return pf;var e,t=dx,n=t.length,r,s="value"in Bi?Bi.value:Bi.textContent,i=s.length;for(e=0;e<n&&t[e]===s[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===s[i-r];r++);return pf=s.slice(e,1<r?1-r:void 0)}function hf(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 Sd(){return!0}function Ev(){return!1}function Br(e){function t(n,r,s,i,o){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Sd:Ev,this.isPropagationStopped=Ev,this}return on(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=Sd)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Sd)},persist:function(){},isPersistent:Sd}),t}var jl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},fx=Br(jl),Au=on({},jl,{view:0,detail:0}),WT=Br(Au),Kh,Uh,nc,$p=on({},Au,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:px,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!==nc&&(nc&&e.type==="mousemove"?(Kh=e.screenX-nc.screenX,Uh=e.screenY-nc.screenY):Uh=Kh=0,nc=e),Kh)},movementY:function(e){return"movementY"in e?e.movementY:Uh}}),_v=Br($p),VT=on({},$p,{dataTransfer:0}),KT=Br(VT),UT=on({},Au,{relatedTarget:0}),qh=Br(UT),qT=on({},jl,{animationName:0,elapsedTime:0,pseudoElement:0}),YT=Br(qT),GT=on({},jl,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),XT=Br(GT),JT=on({},jl,{data:0}),Pv=Br(JT),QT={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ZT={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"},eR={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function tR(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=eR[e])?!!t[e]:!1}function px(){return tR}var nR=on({},Au,{key:function(e){if(e.key){var t=QT[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=hf(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?ZT[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:px,charCode:function(e){return e.type==="keypress"?hf(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?hf(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),rR=Br(nR),sR=on({},$p,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Av=Br(sR),iR=on({},Au,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:px}),oR=Br(iR),aR=on({},jl,{propertyName:0,elapsedTime:0,pseudoElement:0}),lR=Br(aR),cR=on({},$p,{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}),uR=Br(cR),dR=[9,13,27,32],hx=yi&&"CompositionEvent"in window,Ec=null;yi&&"documentMode"in document&&(Ec=document.documentMode);var fR=yi&&"TextEvent"in window&&!Ec,Uj=yi&&(!hx||Ec&&8<Ec&&11>=Ec),Iv=" ",Tv=!1;function qj(e,t){switch(e){case"keyup":return dR.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Yj(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ia=!1;function pR(e,t){switch(e){case"compositionend":return Yj(t);case"keypress":return t.which!==32?null:(Tv=!0,Iv);case"textInput":return e=t.data,e===Iv&&Tv?null:e;default:return null}}function hR(e,t){if(Ia)return e==="compositionend"||!hx&&qj(e,t)?(e=Kj(),pf=dx=Bi=null,Ia=!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 Uj&&t.locale!=="ko"?null:t.data;default:return null}}var mR={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 Rv(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!mR[e.type]:t==="textarea"}function Gj(e,t,n,r){Cj(r),t=zf(t,"onChange"),0<t.length&&(n=new fx("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var _c=null,Jc=null;function gR(e){o1(e,0)}function Op(e){var t=Ma(e);if(wj(t))return e}function yR(e,t){if(e==="change")return t}var Xj=!1;if(yi){var Yh;if(yi){var Gh="oninput"in document;if(!Gh){var Mv=document.createElement("div");Mv.setAttribute("oninput","return;"),Gh=typeof Mv.oninput=="function"}Yh=Gh}else Yh=!1;Xj=Yh&&(!document.documentMode||9<document.documentMode)}function Lv(){_c&&(_c.detachEvent("onpropertychange",Jj),Jc=_c=null)}function Jj(e){if(e.propertyName==="value"&&Op(Jc)){var t=[];Gj(t,Jc,e,ox(e)),Aj(gR,t)}}function xR(e,t,n){e==="focusin"?(Lv(),_c=t,Jc=n,_c.attachEvent("onpropertychange",Jj)):e==="focusout"&&Lv()}function wR(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Op(Jc)}function bR(e,t){if(e==="click")return Op(t)}function vR(e,t){if(e==="input"||e==="change")return Op(t)}function kR(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var _s=typeof Object.is=="function"?Object.is:kR;function Qc(e,t){if(_s(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var s=n[r];if(!ig.call(t,s)||!_s(e[s],t[s]))return!1}return!0}function $v(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Ov(e,t){var n=$v(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=$v(n)}}function Qj(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Qj(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Zj(){for(var e=window,t=Rf();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Rf(e.document)}return t}function mx(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 SR(e){var t=Zj(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Qj(n.ownerDocument.documentElement,n)){if(r!==null&&mx(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!e.extend&&i>r&&(s=r,r=i,i=s),s=Ov(n,i);var o=Ov(n,r);s&&o&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>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 NR=yi&&"documentMode"in document&&11>=document.documentMode,Ta=null,Ng=null,Pc=null,jg=!1;function Dv(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;jg||Ta==null||Ta!==Rf(r)||(r=Ta,"selectionStart"in r&&mx(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}),Pc&&Qc(Pc,r)||(Pc=r,r=zf(Ng,"onSelect"),0<r.length&&(t=new fx("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Ta)))}function Nd(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Ra={animationend:Nd("Animation","AnimationEnd"),animationiteration:Nd("Animation","AnimationIteration"),animationstart:Nd("Animation","AnimationStart"),transitionend:Nd("Transition","TransitionEnd")},Xh={},e1={};yi&&(e1=document.createElement("div").style,"AnimationEvent"in window||(delete Ra.animationend.animation,delete Ra.animationiteration.animation,delete Ra.animationstart.animation),"TransitionEvent"in window||delete Ra.transitionend.transition);function Dp(e){if(Xh[e])return Xh[e];if(!Ra[e])return e;var t=Ra[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in e1)return Xh[e]=t[n];return e}var t1=Dp("animationend"),n1=Dp("animationiteration"),r1=Dp("animationstart"),s1=Dp("transitionend"),i1=new Map,Fv="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 ao(e,t){i1.set(e,t),Qo(t,[e])}for(var Jh=0;Jh<Fv.length;Jh++){var Qh=Fv[Jh],jR=Qh.toLowerCase(),CR=Qh[0].toUpperCase()+Qh.slice(1);ao(jR,"on"+CR)}ao(t1,"onAnimationEnd");ao(n1,"onAnimationIteration");ao(r1,"onAnimationStart");ao("dblclick","onDoubleClick");ao("focusin","onFocus");ao("focusout","onBlur");ao(s1,"onTransitionEnd");sl("onMouseEnter",["mouseout","mouseover"]);sl("onMouseLeave",["mouseout","mouseover"]);sl("onPointerEnter",["pointerout","pointerover"]);sl("onPointerLeave",["pointerout","pointerover"]);Qo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Qo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Qo("onBeforeInput",["compositionend","keypress","textInput","paste"]);Qo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Qo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Qo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var wc="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(" "),ER=new Set("cancel close invalid load scroll toggle".split(" ").concat(wc));function zv(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,jT(r,t,void 0,e),e.currentTarget=null}function o1(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],s=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var o=r.length-1;0<=o;o--){var l=r[o],c=l.instance,u=l.currentTarget;if(l=l.listener,c!==i&&s.isPropagationStopped())break e;zv(s,l,u),i=c}else for(o=0;o<r.length;o++){if(l=r[o],c=l.instance,u=l.currentTarget,l=l.listener,c!==i&&s.isPropagationStopped())break e;zv(s,l,u),i=c}}}if(Lf)throw e=bg,Lf=!1,bg=null,e}function Wt(e,t){var n=t[Ag];n===void 0&&(n=t[Ag]=new Set);var r=e+"__bubble";n.has(r)||(a1(t,e,2,!1),n.add(r))}function Zh(e,t,n){var r=0;t&&(r|=4),a1(n,e,r,t)}var jd="_reactListening"+Math.random().toString(36).slice(2);function Zc(e){if(!e[jd]){e[jd]=!0,hj.forEach(function(n){n!=="selectionchange"&&(ER.has(n)||Zh(n,!1,e),Zh(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[jd]||(t[jd]=!0,Zh("selectionchange",!1,t))}}function a1(e,t,n,r){switch(Vj(t)){case 1:var s=HT;break;case 4:s=BT;break;default:s=ux}n=s.bind(null,t,n,e),s=void 0,!wg||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),r?s!==void 0?e.addEventListener(t,n,{capture:!0,passive:s}):e.addEventListener(t,n,!0):s!==void 0?e.addEventListener(t,n,{passive:s}):e.addEventListener(t,n,!1)}function em(e,t,n,r,s){var i=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===s||l.nodeType===8&&l.parentNode===s)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===s||c.nodeType===8&&c.parentNode===s))return;o=o.return}for(;l!==null;){if(o=Eo(l),o===null)return;if(c=o.tag,c===5||c===6){r=i=o;continue e}l=l.parentNode}}r=r.return}Aj(function(){var u=i,p=ox(n),f=[];e:{var d=i1.get(e);if(d!==void 0){var h=fx,y=e;switch(e){case"keypress":if(hf(n)===0)break e;case"keydown":case"keyup":h=rR;break;case"focusin":y="focus",h=qh;break;case"focusout":y="blur",h=qh;break;case"beforeblur":case"afterblur":h=qh;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=_v;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=KT;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=oR;break;case t1:case n1:case r1:h=YT;break;case s1:h=lR;break;case"scroll":h=WT;break;case"wheel":h=uR;break;case"copy":case"cut":case"paste":h=XT;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=Av}var w=(t&4)!==0,k=!w&&e==="scroll",g=w?d!==null?d+"Capture":null:d;w=[];for(var b=u,x;b!==null;){x=b;var S=x.stateNode;if(x.tag===5&&S!==null&&(x=S,g!==null&&(S=qc(b,g),S!=null&&w.push(eu(b,S,x)))),k)break;b=b.return}0<w.length&&(d=new h(d,y,null,n,p),f.push({event:d,listeners:w}))}}if(!(t&7)){e:{if(d=e==="mouseover"||e==="pointerover",h=e==="mouseout"||e==="pointerout",d&&n!==yg&&(y=n.relatedTarget||n.fromElement)&&(Eo(y)||y[xi]))break e;if((h||d)&&(d=p.window===p?p:(d=p.ownerDocument)?d.defaultView||d.parentWindow:window,h?(y=n.relatedTarget||n.toElement,h=u,y=y?Eo(y):null,y!==null&&(k=Zo(y),y!==k||y.tag!==5&&y.tag!==6)&&(y=null)):(h=null,y=u),h!==y)){if(w=_v,S="onMouseLeave",g="onMouseEnter",b="mouse",(e==="pointerout"||e==="pointerover")&&(w=Av,S="onPointerLeave",g="onPointerEnter",b="pointer"),k=h==null?d:Ma(h),x=y==null?d:Ma(y),d=new w(S,b+"leave",h,n,p),d.target=k,d.relatedTarget=x,S=null,Eo(p)===u&&(w=new w(g,b+"enter",y,n,p),w.target=x,w.relatedTarget=k,S=w),k=S,h&&y)t:{for(w=h,g=y,b=0,x=w;x;x=wa(x))b++;for(x=0,S=g;S;S=wa(S))x++;for(;0<b-x;)w=wa(w),b--;for(;0<x-b;)g=wa(g),x--;for(;b--;){if(w===g||g!==null&&w===g.alternate)break t;w=wa(w),g=wa(g)}w=null}else w=null;h!==null&&Hv(f,d,h,w,!1),y!==null&&k!==null&&Hv(f,k,y,w,!0)}}e:{if(d=u?Ma(u):window,h=d.nodeName&&d.nodeName.toLowerCase(),h==="select"||h==="input"&&d.type==="file")var C=yR;else if(Rv(d))if(Xj)C=vR;else{C=wR;var j=xR}else(h=d.nodeName)&&h.toLowerCase()==="input"&&(d.type==="checkbox"||d.type==="radio")&&(C=bR);if(C&&(C=C(e,u))){Gj(f,C,n,p);break e}j&&j(e,d,u),e==="focusout"&&(j=d._wrapperState)&&j.controlled&&d.type==="number"&&fg(d,"number",d.value)}switch(j=u?Ma(u):window,e){case"focusin":(Rv(j)||j.contentEditable==="true")&&(Ta=j,Ng=u,Pc=null);break;case"focusout":Pc=Ng=Ta=null;break;case"mousedown":jg=!0;break;case"contextmenu":case"mouseup":case"dragend":jg=!1,Dv(f,n,p);break;case"selectionchange":if(NR)break;case"keydown":case"keyup":Dv(f,n,p)}var E;if(hx)e:{switch(e){case"compositionstart":var A="onCompositionStart";break e;case"compositionend":A="onCompositionEnd";break e;case"compositionupdate":A="onCompositionUpdate";break e}A=void 0}else Ia?qj(e,n)&&(A="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(A="onCompositionStart");A&&(Uj&&n.locale!=="ko"&&(Ia||A!=="onCompositionStart"?A==="onCompositionEnd"&&Ia&&(E=Kj()):(Bi=p,dx="value"in Bi?Bi.value:Bi.textContent,Ia=!0)),j=zf(u,A),0<j.length&&(A=new Pv(A,e,null,n,p),f.push({event:A,listeners:j}),E?A.data=E:(E=Yj(n),E!==null&&(A.data=E)))),(E=fR?pR(e,n):hR(e,n))&&(u=zf(u,"onBeforeInput"),0<u.length&&(p=new Pv("onBeforeInput","beforeinput",null,n,p),f.push({event:p,listeners:u}),p.data=E))}o1(f,t)})}function eu(e,t,n){return{instance:e,listener:t,currentTarget:n}}function zf(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=qc(e,n),i!=null&&r.unshift(eu(e,i,s)),i=qc(e,t),i!=null&&r.push(eu(e,i,s))),e=e.return}return r}function wa(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Hv(e,t,n,r,s){for(var i=t._reactName,o=[];n!==null&&n!==r;){var l=n,c=l.alternate,u=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&u!==null&&(l=u,s?(c=qc(n,i),c!=null&&o.unshift(eu(n,c,l))):s||(c=qc(n,i),c!=null&&o.push(eu(n,c,l)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var _R=/\r\n?/g,PR=/\u0000|\uFFFD/g;function Bv(e){return(typeof e=="string"?e:""+e).replace(_R,`
38
- `).replace(PR,"")}function Cd(e,t,n){if(t=Bv(t),Bv(e)!==t&&n)throw Error(ge(425))}function Hf(){}var Cg=null,Eg=null;function _g(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 Pg=typeof setTimeout=="function"?setTimeout:void 0,AR=typeof clearTimeout=="function"?clearTimeout:void 0,Wv=typeof Promise=="function"?Promise:void 0,IR=typeof queueMicrotask=="function"?queueMicrotask:typeof Wv<"u"?function(e){return Wv.resolve(null).then(e).catch(TR)}:Pg;function TR(e){setTimeout(function(){throw e})}function tm(e,t){var n=t,r=0;do{var s=n.nextSibling;if(e.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(r===0){e.removeChild(s),Xc(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);Xc(t)}function Gi(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 Vv(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 Cl=Math.random().toString(36).slice(2),zs="__reactFiber$"+Cl,tu="__reactProps$"+Cl,xi="__reactContainer$"+Cl,Ag="__reactEvents$"+Cl,RR="__reactListeners$"+Cl,MR="__reactHandles$"+Cl;function Eo(e){var t=e[zs];if(t)return t;for(var n=e.parentNode;n;){if(t=n[xi]||n[zs]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Vv(e);e!==null;){if(n=e[zs])return n;e=Vv(e)}return t}e=n,n=e.parentNode}return null}function Iu(e){return e=e[zs]||e[xi],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Ma(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(ge(33))}function Fp(e){return e[tu]||null}var Ig=[],La=-1;function lo(e){return{current:e}}function Kt(e){0>La||(e.current=Ig[La],Ig[La]=null,La--)}function Ft(e,t){La++,Ig[La]=e.current,e.current=t}var ro={},Qn=lo(ro),br=lo(!1),Fo=ro;function il(e,t){var n=e.type.contextTypes;if(!n)return ro;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function vr(e){return e=e.childContextTypes,e!=null}function Bf(){Kt(br),Kt(Qn)}function Kv(e,t,n){if(Qn.current!==ro)throw Error(ge(168));Ft(Qn,t),Ft(br,n)}function l1(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(ge(108,xT(e)||"Unknown",s));return on({},n,r)}function Wf(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ro,Fo=Qn.current,Ft(Qn,e),Ft(br,br.current),!0}function Uv(e,t,n){var r=e.stateNode;if(!r)throw Error(ge(169));n?(e=l1(e,t,Fo),r.__reactInternalMemoizedMergedChildContext=e,Kt(br),Kt(Qn),Ft(Qn,e)):Kt(br),Ft(br,n)}var ai=null,zp=!1,nm=!1;function c1(e){ai===null?ai=[e]:ai.push(e)}function LR(e){zp=!0,c1(e)}function co(){if(!nm&&ai!==null){nm=!0;var e=0,t=It;try{var n=ai;for(It=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}ai=null,zp=!1}catch(s){throw ai!==null&&(ai=ai.slice(e+1)),Mj(ax,co),s}finally{It=t,nm=!1}}return null}var $a=[],Oa=0,Vf=null,Kf=0,Yr=[],Gr=0,zo=null,ci=1,ui="";function bo(e,t){$a[Oa++]=Kf,$a[Oa++]=Vf,Vf=e,Kf=t}function u1(e,t,n){Yr[Gr++]=ci,Yr[Gr++]=ui,Yr[Gr++]=zo,zo=e;var r=ci;e=ui;var s=32-Cs(r)-1;r&=~(1<<s),n+=1;var i=32-Cs(t)+s;if(30<i){var o=s-s%5;i=(r&(1<<o)-1).toString(32),r>>=o,s-=o,ci=1<<32-Cs(t)+s|n<<s|r,ui=i+e}else ci=1<<i|n<<s|r,ui=e}function gx(e){e.return!==null&&(bo(e,1),u1(e,1,0))}function yx(e){for(;e===Vf;)Vf=$a[--Oa],$a[Oa]=null,Kf=$a[--Oa],$a[Oa]=null;for(;e===zo;)zo=Yr[--Gr],Yr[Gr]=null,ui=Yr[--Gr],Yr[Gr]=null,ci=Yr[--Gr],Yr[Gr]=null}var Or=null,Lr=null,Zt=!1,vs=null;function d1(e,t){var n=Qr(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 qv(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,Or=e,Lr=Gi(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Or=e,Lr=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=zo!==null?{id:ci,overflow:ui}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Qr(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Or=e,Lr=null,!0):!1;default:return!1}}function Tg(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Rg(e){if(Zt){var t=Lr;if(t){var n=t;if(!qv(e,t)){if(Tg(e))throw Error(ge(418));t=Gi(n.nextSibling);var r=Or;t&&qv(e,t)?d1(r,n):(e.flags=e.flags&-4097|2,Zt=!1,Or=e)}}else{if(Tg(e))throw Error(ge(418));e.flags=e.flags&-4097|2,Zt=!1,Or=e}}}function Yv(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Or=e}function Ed(e){if(e!==Or)return!1;if(!Zt)return Yv(e),Zt=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!_g(e.type,e.memoizedProps)),t&&(t=Lr)){if(Tg(e))throw f1(),Error(ge(418));for(;t;)d1(e,t),t=Gi(t.nextSibling)}if(Yv(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ge(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Lr=Gi(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Lr=null}}else Lr=Or?Gi(e.stateNode.nextSibling):null;return!0}function f1(){for(var e=Lr;e;)e=Gi(e.nextSibling)}function ol(){Lr=Or=null,Zt=!1}function xx(e){vs===null?vs=[e]:vs.push(e)}var $R=Si.ReactCurrentBatchConfig;function rc(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(ge(309));var r=n.stateNode}if(!r)throw Error(ge(147,e));var s=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(o){var l=s.refs;o===null?delete l[i]:l[i]=o},t._stringRef=i,t)}if(typeof e!="string")throw Error(ge(284));if(!n._owner)throw Error(ge(290,e))}return e}function _d(e,t){throw e=Object.prototype.toString.call(t),Error(ge(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Gv(e){var t=e._init;return t(e._payload)}function p1(e){function t(g,b){if(e){var x=g.deletions;x===null?(g.deletions=[b],g.flags|=16):x.push(b)}}function n(g,b){if(!e)return null;for(;b!==null;)t(g,b),b=b.sibling;return null}function r(g,b){for(g=new Map;b!==null;)b.key!==null?g.set(b.key,b):g.set(b.index,b),b=b.sibling;return g}function s(g,b){return g=Zi(g,b),g.index=0,g.sibling=null,g}function i(g,b,x){return g.index=x,e?(x=g.alternate,x!==null?(x=x.index,x<b?(g.flags|=2,b):x):(g.flags|=2,b)):(g.flags|=1048576,b)}function o(g){return e&&g.alternate===null&&(g.flags|=2),g}function l(g,b,x,S){return b===null||b.tag!==6?(b=cm(x,g.mode,S),b.return=g,b):(b=s(b,x),b.return=g,b)}function c(g,b,x,S){var C=x.type;return C===Aa?p(g,b,x.props.children,S,x.key):b!==null&&(b.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===$i&&Gv(C)===b.type)?(S=s(b,x.props),S.ref=rc(g,b,x),S.return=g,S):(S=vf(x.type,x.key,x.props,null,g.mode,S),S.ref=rc(g,b,x),S.return=g,S)}function u(g,b,x,S){return b===null||b.tag!==4||b.stateNode.containerInfo!==x.containerInfo||b.stateNode.implementation!==x.implementation?(b=um(x,g.mode,S),b.return=g,b):(b=s(b,x.children||[]),b.return=g,b)}function p(g,b,x,S,C){return b===null||b.tag!==7?(b=Ro(x,g.mode,S,C),b.return=g,b):(b=s(b,x),b.return=g,b)}function f(g,b,x){if(typeof b=="string"&&b!==""||typeof b=="number")return b=cm(""+b,g.mode,x),b.return=g,b;if(typeof b=="object"&&b!==null){switch(b.$$typeof){case yd:return x=vf(b.type,b.key,b.props,null,g.mode,x),x.ref=rc(g,null,b),x.return=g,x;case Pa:return b=um(b,g.mode,x),b.return=g,b;case $i:var S=b._init;return f(g,S(b._payload),x)}if(yc(b)||Ql(b))return b=Ro(b,g.mode,x,null),b.return=g,b;_d(g,b)}return null}function d(g,b,x,S){var C=b!==null?b.key:null;if(typeof x=="string"&&x!==""||typeof x=="number")return C!==null?null:l(g,b,""+x,S);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case yd:return x.key===C?c(g,b,x,S):null;case Pa:return x.key===C?u(g,b,x,S):null;case $i:return C=x._init,d(g,b,C(x._payload),S)}if(yc(x)||Ql(x))return C!==null?null:p(g,b,x,S,null);_d(g,x)}return null}function h(g,b,x,S,C){if(typeof S=="string"&&S!==""||typeof S=="number")return g=g.get(x)||null,l(b,g,""+S,C);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case yd:return g=g.get(S.key===null?x:S.key)||null,c(b,g,S,C);case Pa:return g=g.get(S.key===null?x:S.key)||null,u(b,g,S,C);case $i:var j=S._init;return h(g,b,x,j(S._payload),C)}if(yc(S)||Ql(S))return g=g.get(x)||null,p(b,g,S,C,null);_d(b,S)}return null}function y(g,b,x,S){for(var C=null,j=null,E=b,A=b=0,D=null;E!==null&&A<x.length;A++){E.index>A?(D=E,E=null):D=E.sibling;var W=d(g,E,x[A],S);if(W===null){E===null&&(E=D);break}e&&E&&W.alternate===null&&t(g,E),b=i(W,b,A),j===null?C=W:j.sibling=W,j=W,E=D}if(A===x.length)return n(g,E),Zt&&bo(g,A),C;if(E===null){for(;A<x.length;A++)E=f(g,x[A],S),E!==null&&(b=i(E,b,A),j===null?C=E:j.sibling=E,j=E);return Zt&&bo(g,A),C}for(E=r(g,E);A<x.length;A++)D=h(E,g,A,x[A],S),D!==null&&(e&&D.alternate!==null&&E.delete(D.key===null?A:D.key),b=i(D,b,A),j===null?C=D:j.sibling=D,j=D);return e&&E.forEach(function(F){return t(g,F)}),Zt&&bo(g,A),C}function w(g,b,x,S){var C=Ql(x);if(typeof C!="function")throw Error(ge(150));if(x=C.call(x),x==null)throw Error(ge(151));for(var j=C=null,E=b,A=b=0,D=null,W=x.next();E!==null&&!W.done;A++,W=x.next()){E.index>A?(D=E,E=null):D=E.sibling;var F=d(g,E,W.value,S);if(F===null){E===null&&(E=D);break}e&&E&&F.alternate===null&&t(g,E),b=i(F,b,A),j===null?C=F:j.sibling=F,j=F,E=D}if(W.done)return n(g,E),Zt&&bo(g,A),C;if(E===null){for(;!W.done;A++,W=x.next())W=f(g,W.value,S),W!==null&&(b=i(W,b,A),j===null?C=W:j.sibling=W,j=W);return Zt&&bo(g,A),C}for(E=r(g,E);!W.done;A++,W=x.next())W=h(E,g,A,W.value,S),W!==null&&(e&&W.alternate!==null&&E.delete(W.key===null?A:W.key),b=i(W,b,A),j===null?C=W:j.sibling=W,j=W);return e&&E.forEach(function(R){return t(g,R)}),Zt&&bo(g,A),C}function k(g,b,x,S){if(typeof x=="object"&&x!==null&&x.type===Aa&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case yd:e:{for(var C=x.key,j=b;j!==null;){if(j.key===C){if(C=x.type,C===Aa){if(j.tag===7){n(g,j.sibling),b=s(j,x.props.children),b.return=g,g=b;break e}}else if(j.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===$i&&Gv(C)===j.type){n(g,j.sibling),b=s(j,x.props),b.ref=rc(g,j,x),b.return=g,g=b;break e}n(g,j);break}else t(g,j);j=j.sibling}x.type===Aa?(b=Ro(x.props.children,g.mode,S,x.key),b.return=g,g=b):(S=vf(x.type,x.key,x.props,null,g.mode,S),S.ref=rc(g,b,x),S.return=g,g=S)}return o(g);case Pa:e:{for(j=x.key;b!==null;){if(b.key===j)if(b.tag===4&&b.stateNode.containerInfo===x.containerInfo&&b.stateNode.implementation===x.implementation){n(g,b.sibling),b=s(b,x.children||[]),b.return=g,g=b;break e}else{n(g,b);break}else t(g,b);b=b.sibling}b=um(x,g.mode,S),b.return=g,g=b}return o(g);case $i:return j=x._init,k(g,b,j(x._payload),S)}if(yc(x))return y(g,b,x,S);if(Ql(x))return w(g,b,x,S);_d(g,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,b!==null&&b.tag===6?(n(g,b.sibling),b=s(b,x),b.return=g,g=b):(n(g,b),b=cm(x,g.mode,S),b.return=g,g=b),o(g)):n(g,b)}return k}var al=p1(!0),h1=p1(!1),Uf=lo(null),qf=null,Da=null,wx=null;function bx(){wx=Da=qf=null}function vx(e){var t=Uf.current;Kt(Uf),e._currentValue=t}function Mg(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 Xa(e,t){qf=e,wx=Da=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(yr=!0),e.firstContext=null)}function es(e){var t=e._currentValue;if(wx!==e)if(e={context:e,memoizedValue:t,next:null},Da===null){if(qf===null)throw Error(ge(308));Da=e,qf.dependencies={lanes:0,firstContext:e}}else Da=Da.next=e;return t}var _o=null;function kx(e){_o===null?_o=[e]:_o.push(e)}function m1(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,kx(t)):(n.next=s.next,s.next=n),t.interleaved=n,wi(e,r)}function wi(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 Oi=!1;function Sx(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function g1(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 mi(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Xi(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,St&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,wi(e,n)}return s=r.interleaved,s===null?(t.next=t,kx(r)):(t.next=s.next,s.next=t),r.interleaved=t,wi(e,n)}function mf(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,lx(e,n)}}function Xv(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Yf(e,t,n,r){var s=e.updateQueue;Oi=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?i=u:o.next=u,o=c;var p=e.alternate;p!==null&&(p=p.updateQueue,l=p.lastBaseUpdate,l!==o&&(l===null?p.firstBaseUpdate=u:l.next=u,p.lastBaseUpdate=c))}if(i!==null){var f=s.baseState;o=0,p=u=c=null,l=i;do{var d=l.lane,h=l.eventTime;if((r&d)===d){p!==null&&(p=p.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var y=e,w=l;switch(d=t,h=n,w.tag){case 1:if(y=w.payload,typeof y=="function"){f=y.call(h,f,d);break e}f=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=w.payload,d=typeof y=="function"?y.call(h,f,d):y,d==null)break e;f=on({},f,d);break e;case 2:Oi=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,d=s.effects,d===null?s.effects=[l]:d.push(l))}else h={eventTime:h,lane:d,tag:l.tag,payload:l.payload,callback:l.callback,next:null},p===null?(u=p=h,c=f):p=p.next=h,o|=d;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;d=l,l=d.next,d.next=null,s.lastBaseUpdate=d,s.shared.pending=null}}while(!0);if(p===null&&(c=f),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=p,t=s.shared.interleaved,t!==null){s=t;do o|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);Bo|=o,e.lanes=o,e.memoizedState=f}}function Jv(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],s=r.callback;if(s!==null){if(r.callback=null,r=n,typeof s!="function")throw Error(ge(191,s));s.call(r)}}}var Tu={},Ks=lo(Tu),nu=lo(Tu),ru=lo(Tu);function Po(e){if(e===Tu)throw Error(ge(174));return e}function Nx(e,t){switch(Ft(ru,t),Ft(nu,e),Ft(Ks,Tu),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:hg(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=hg(t,e)}Kt(Ks),Ft(Ks,t)}function ll(){Kt(Ks),Kt(nu),Kt(ru)}function y1(e){Po(ru.current);var t=Po(Ks.current),n=hg(t,e.type);t!==n&&(Ft(nu,e),Ft(Ks,n))}function jx(e){nu.current===e&&(Kt(Ks),Kt(nu))}var rn=lo(0);function Gf(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 rm=[];function Cx(){for(var e=0;e<rm.length;e++)rm[e]._workInProgressVersionPrimary=null;rm.length=0}var gf=Si.ReactCurrentDispatcher,sm=Si.ReactCurrentBatchConfig,Ho=0,sn=null,In=null,$n=null,Xf=!1,Ac=!1,su=0,OR=0;function qn(){throw Error(ge(321))}function Ex(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!_s(e[n],t[n]))return!1;return!0}function _x(e,t,n,r,s,i){if(Ho=i,sn=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,gf.current=e===null||e.memoizedState===null?HR:BR,e=n(r,s),Ac){i=0;do{if(Ac=!1,su=0,25<=i)throw Error(ge(301));i+=1,$n=In=null,t.updateQueue=null,gf.current=WR,e=n(r,s)}while(Ac)}if(gf.current=Jf,t=In!==null&&In.next!==null,Ho=0,$n=In=sn=null,Xf=!1,t)throw Error(ge(300));return e}function Px(){var e=su!==0;return su=0,e}function Ls(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return $n===null?sn.memoizedState=$n=e:$n=$n.next=e,$n}function ts(){if(In===null){var e=sn.alternate;e=e!==null?e.memoizedState:null}else e=In.next;var t=$n===null?sn.memoizedState:$n.next;if(t!==null)$n=t,In=e;else{if(e===null)throw Error(ge(310));In=e,e={memoizedState:In.memoizedState,baseState:In.baseState,baseQueue:In.baseQueue,queue:In.queue,next:null},$n===null?sn.memoizedState=$n=e:$n=$n.next=e}return $n}function iu(e,t){return typeof t=="function"?t(e):t}function im(e){var t=ts(),n=t.queue;if(n===null)throw Error(ge(311));n.lastRenderedReducer=e;var r=In,s=r.baseQueue,i=n.pending;if(i!==null){if(s!==null){var o=s.next;s.next=i.next,i.next=o}r.baseQueue=s=i,n.pending=null}if(s!==null){i=s.next,r=r.baseState;var l=o=null,c=null,u=i;do{var p=u.lane;if((Ho&p)===p)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var f={lane:p,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=f,o=r):c=c.next=f,sn.lanes|=p,Bo|=p}u=u.next}while(u!==null&&u!==i);c===null?o=r:c.next=l,_s(r,t.memoizedState)||(yr=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){s=e;do i=s.lane,sn.lanes|=i,Bo|=i,s=s.next;while(s!==e)}else s===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function om(e){var t=ts(),n=t.queue;if(n===null)throw Error(ge(311));n.lastRenderedReducer=e;var r=n.dispatch,s=n.pending,i=t.memoizedState;if(s!==null){n.pending=null;var o=s=s.next;do i=e(i,o.action),o=o.next;while(o!==s);_s(i,t.memoizedState)||(yr=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function x1(){}function w1(e,t){var n=sn,r=ts(),s=t(),i=!_s(r.memoizedState,s);if(i&&(r.memoizedState=s,yr=!0),r=r.queue,Ax(k1.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||$n!==null&&$n.memoizedState.tag&1){if(n.flags|=2048,ou(9,v1.bind(null,n,r,s,t),void 0,null),Dn===null)throw Error(ge(349));Ho&30||b1(n,t,s)}return s}function b1(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=sn.updateQueue,t===null?(t={lastEffect:null,stores:null},sn.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function v1(e,t,n,r){t.value=n,t.getSnapshot=r,S1(t)&&N1(e)}function k1(e,t,n){return n(function(){S1(t)&&N1(e)})}function S1(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!_s(e,n)}catch{return!0}}function N1(e){var t=wi(e,1);t!==null&&Es(t,e,1,-1)}function Qv(e){var t=Ls();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:iu,lastRenderedState:e},t.queue=e,e=e.dispatch=zR.bind(null,sn,e),[t.memoizedState,e]}function ou(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=sn.updateQueue,t===null?(t={lastEffect:null,stores:null},sn.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 j1(){return ts().memoizedState}function yf(e,t,n,r){var s=Ls();sn.flags|=e,s.memoizedState=ou(1|t,n,void 0,r===void 0?null:r)}function Hp(e,t,n,r){var s=ts();r=r===void 0?null:r;var i=void 0;if(In!==null){var o=In.memoizedState;if(i=o.destroy,r!==null&&Ex(r,o.deps)){s.memoizedState=ou(t,n,i,r);return}}sn.flags|=e,s.memoizedState=ou(1|t,n,i,r)}function Zv(e,t){return yf(8390656,8,e,t)}function Ax(e,t){return Hp(2048,8,e,t)}function C1(e,t){return Hp(4,2,e,t)}function E1(e,t){return Hp(4,4,e,t)}function _1(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 P1(e,t,n){return n=n!=null?n.concat([e]):null,Hp(4,4,_1.bind(null,t,e),n)}function Ix(){}function A1(e,t){var n=ts();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Ex(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function I1(e,t){var n=ts();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Ex(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function T1(e,t,n){return Ho&21?(_s(n,t)||(n=Oj(),sn.lanes|=n,Bo|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,yr=!0),e.memoizedState=n)}function DR(e,t){var n=It;It=n!==0&&4>n?n:4,e(!0);var r=sm.transition;sm.transition={};try{e(!1),t()}finally{It=n,sm.transition=r}}function R1(){return ts().memoizedState}function FR(e,t,n){var r=Qi(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},M1(e))L1(t,n);else if(n=m1(e,t,n,r),n!==null){var s=lr();Es(n,e,r,s),$1(n,t,r)}}function zR(e,t,n){var r=Qi(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(M1(e))L1(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,l=i(o,n);if(s.hasEagerState=!0,s.eagerState=l,_s(l,o)){var c=t.interleaved;c===null?(s.next=s,kx(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}n=m1(e,t,s,r),n!==null&&(s=lr(),Es(n,e,r,s),$1(n,t,r))}}function M1(e){var t=e.alternate;return e===sn||t!==null&&t===sn}function L1(e,t){Ac=Xf=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function $1(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,lx(e,n)}}var Jf={readContext:es,useCallback:qn,useContext:qn,useEffect:qn,useImperativeHandle:qn,useInsertionEffect:qn,useLayoutEffect:qn,useMemo:qn,useReducer:qn,useRef:qn,useState:qn,useDebugValue:qn,useDeferredValue:qn,useTransition:qn,useMutableSource:qn,useSyncExternalStore:qn,useId:qn,unstable_isNewReconciler:!1},HR={readContext:es,useCallback:function(e,t){return Ls().memoizedState=[e,t===void 0?null:t],e},useContext:es,useEffect:Zv,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,yf(4194308,4,_1.bind(null,t,e),n)},useLayoutEffect:function(e,t){return yf(4194308,4,e,t)},useInsertionEffect:function(e,t){return yf(4,2,e,t)},useMemo:function(e,t){var n=Ls();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ls();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=FR.bind(null,sn,e),[r.memoizedState,e]},useRef:function(e){var t=Ls();return e={current:e},t.memoizedState=e},useState:Qv,useDebugValue:Ix,useDeferredValue:function(e){return Ls().memoizedState=e},useTransition:function(){var e=Qv(!1),t=e[0];return e=DR.bind(null,e[1]),Ls().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=sn,s=Ls();if(Zt){if(n===void 0)throw Error(ge(407));n=n()}else{if(n=t(),Dn===null)throw Error(ge(349));Ho&30||b1(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,Zv(k1.bind(null,r,i,e),[e]),r.flags|=2048,ou(9,v1.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Ls(),t=Dn.identifierPrefix;if(Zt){var n=ui,r=ci;n=(r&~(1<<32-Cs(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=su++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=OR++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},BR={readContext:es,useCallback:A1,useContext:es,useEffect:Ax,useImperativeHandle:P1,useInsertionEffect:C1,useLayoutEffect:E1,useMemo:I1,useReducer:im,useRef:j1,useState:function(){return im(iu)},useDebugValue:Ix,useDeferredValue:function(e){var t=ts();return T1(t,In.memoizedState,e)},useTransition:function(){var e=im(iu)[0],t=ts().memoizedState;return[e,t]},useMutableSource:x1,useSyncExternalStore:w1,useId:R1,unstable_isNewReconciler:!1},WR={readContext:es,useCallback:A1,useContext:es,useEffect:Ax,useImperativeHandle:P1,useInsertionEffect:C1,useLayoutEffect:E1,useMemo:I1,useReducer:om,useRef:j1,useState:function(){return om(iu)},useDebugValue:Ix,useDeferredValue:function(e){var t=ts();return In===null?t.memoizedState=e:T1(t,In.memoizedState,e)},useTransition:function(){var e=om(iu)[0],t=ts().memoizedState;return[e,t]},useMutableSource:x1,useSyncExternalStore:w1,useId:R1,unstable_isNewReconciler:!1};function xs(e,t){if(e&&e.defaultProps){t=on({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Lg(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:on({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Bp={isMounted:function(e){return(e=e._reactInternals)?Zo(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=lr(),s=Qi(e),i=mi(r,s);i.payload=t,n!=null&&(i.callback=n),t=Xi(e,i,s),t!==null&&(Es(t,e,s,r),mf(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=lr(),s=Qi(e),i=mi(r,s);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Xi(e,i,s),t!==null&&(Es(t,e,s,r),mf(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=lr(),r=Qi(e),s=mi(n,r);s.tag=2,t!=null&&(s.callback=t),t=Xi(e,s,r),t!==null&&(Es(t,e,r,n),mf(t,e,r))}};function e0(e,t,n,r,s,i,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,o):t.prototype&&t.prototype.isPureReactComponent?!Qc(n,r)||!Qc(s,i):!0}function O1(e,t,n){var r=!1,s=ro,i=t.contextType;return typeof i=="object"&&i!==null?i=es(i):(s=vr(t)?Fo:Qn.current,r=t.contextTypes,i=(r=r!=null)?il(e,s):ro),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Bp,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=i),t}function t0(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&&Bp.enqueueReplaceState(t,t.state,null)}function $g(e,t,n,r){var s=e.stateNode;s.props=n,s.state=e.memoizedState,s.refs={},Sx(e);var i=t.contextType;typeof i=="object"&&i!==null?s.context=es(i):(i=vr(t)?Fo:Qn.current,s.context=il(e,i)),s.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Lg(e,t,i,n),s.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(t=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),t!==s.state&&Bp.enqueueReplaceState(s,s.state,null),Yf(e,n,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function cl(e,t){try{var n="",r=t;do n+=yT(r),r=r.return;while(r);var s=n}catch(i){s=`
39
- Error generating stack: `+i.message+`
40
- `+i.stack}return{value:e,source:t,stack:s,digest:null}}function am(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Og(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var VR=typeof WeakMap=="function"?WeakMap:Map;function D1(e,t,n){n=mi(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Zf||(Zf=!0,qg=r),Og(e,t)},n}function F1(e,t,n){n=mi(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var s=t.value;n.payload=function(){return r(s)},n.callback=function(){Og(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Og(e,t),typeof r!="function"&&(Ji===null?Ji=new Set([this]):Ji.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function n0(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new VR;var s=new Set;r.set(t,s)}else s=r.get(t),s===void 0&&(s=new Set,r.set(t,s));s.has(n)||(s.add(n),e=s2.bind(null,e,t,n),t.then(e,e))}function r0(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 s0(e,t,n,r,s){return e.mode&1?(e.flags|=65536,e.lanes=s,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=mi(-1,1),t.tag=2,Xi(n,t,1))),n.lanes|=1),e)}var KR=Si.ReactCurrentOwner,yr=!1;function or(e,t,n,r){t.child=e===null?h1(t,null,n,r):al(t,e.child,n,r)}function i0(e,t,n,r,s){n=n.render;var i=t.ref;return Xa(t,s),r=_x(e,t,n,r,i,s),n=Px(),e!==null&&!yr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,bi(e,t,s)):(Zt&&n&&gx(t),t.flags|=1,or(e,t,r,s),t.child)}function o0(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!Fx(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,z1(e,t,i,r,s)):(e=vf(n.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&s)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:Qc,n(o,r)&&e.ref===t.ref)return bi(e,t,s)}return t.flags|=1,e=Zi(i,r),e.ref=t.ref,e.return=t,t.child=e}function z1(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(Qc(i,r)&&e.ref===t.ref)if(yr=!1,t.pendingProps=r=i,(e.lanes&s)!==0)e.flags&131072&&(yr=!0);else return t.lanes=e.lanes,bi(e,t,s)}return Dg(e,t,n,r,s)}function H1(e,t,n){var r=t.pendingProps,s=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ft(za,Tr),Tr|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Ft(za,Tr),Tr|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,Ft(za,Tr),Tr|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,Ft(za,Tr),Tr|=r;return or(e,t,s,n),t.child}function B1(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Dg(e,t,n,r,s){var i=vr(n)?Fo:Qn.current;return i=il(t,i),Xa(t,s),n=_x(e,t,n,r,i,s),r=Px(),e!==null&&!yr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,bi(e,t,s)):(Zt&&r&&gx(t),t.flags|=1,or(e,t,n,s),t.child)}function a0(e,t,n,r,s){if(vr(n)){var i=!0;Wf(t)}else i=!1;if(Xa(t,s),t.stateNode===null)xf(e,t),O1(t,n,r),$g(t,n,r,s),r=!0;else if(e===null){var o=t.stateNode,l=t.memoizedProps;o.props=l;var c=o.context,u=n.contextType;typeof u=="object"&&u!==null?u=es(u):(u=vr(n)?Fo:Qn.current,u=il(t,u));var p=n.getDerivedStateFromProps,f=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function";f||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==r||c!==u)&&t0(t,o,r,u),Oi=!1;var d=t.memoizedState;o.state=d,Yf(t,r,o,s),c=t.memoizedState,l!==r||d!==c||br.current||Oi?(typeof p=="function"&&(Lg(t,n,p,r),c=t.memoizedState),(l=Oi||e0(t,n,l,r,d,c,u))?(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=u,r=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,g1(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:xs(t.type,l),o.props=u,f=t.pendingProps,d=o.context,c=n.contextType,typeof c=="object"&&c!==null?c=es(c):(c=vr(n)?Fo:Qn.current,c=il(t,c));var h=n.getDerivedStateFromProps;(p=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==f||d!==c)&&t0(t,o,r,c),Oi=!1,d=t.memoizedState,o.state=d,Yf(t,r,o,s);var y=t.memoizedState;l!==f||d!==y||br.current||Oi?(typeof h=="function"&&(Lg(t,n,h,r),y=t.memoizedState),(u=Oi||e0(t,n,u,r,d,y,c)||!1)?(p||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,y,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,y,c)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=y),o.props=r,o.state=y,o.context=c,r=u):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),r=!1)}return Fg(e,t,n,r,i,s)}function Fg(e,t,n,r,s,i){B1(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return s&&Uv(t,n,!1),bi(e,t,i);r=t.stateNode,KR.current=t;var l=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=al(t,e.child,null,i),t.child=al(t,null,l,i)):or(e,t,l,i),t.memoizedState=r.state,s&&Uv(t,n,!0),t.child}function W1(e){var t=e.stateNode;t.pendingContext?Kv(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Kv(e,t.context,!1),Nx(e,t.containerInfo)}function l0(e,t,n,r,s){return ol(),xx(s),t.flags|=256,or(e,t,n,r),t.child}var zg={dehydrated:null,treeContext:null,retryLane:0};function Hg(e){return{baseLanes:e,cachePool:null,transitions:null}}function V1(e,t,n){var r=t.pendingProps,s=rn.current,i=!1,o=(t.flags&128)!==0,l;if((l=o)||(l=e!==null&&e.memoizedState===null?!1:(s&2)!==0),l?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),Ft(rn,s&1),e===null)return Rg(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,i?(r=t.mode,i=t.child,o={mode:"hidden",children:o},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=Kp(o,r,0,null),e=Ro(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Hg(n),t.memoizedState=zg,e):Tx(t,o));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return UR(e,t,o,r,l,s,n);if(i){i=r.fallback,o=t.mode,s=e.child,l=s.sibling;var c={mode:"hidden",children:r.children};return!(o&1)&&t.child!==s?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Zi(s,c),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?i=Zi(l,i):(i=Ro(i,o,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,o=e.child.memoizedState,o=o===null?Hg(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=e.childLanes&~n,t.memoizedState=zg,r}return i=e.child,e=i.sibling,r=Zi(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Tx(e,t){return t=Kp({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Pd(e,t,n,r){return r!==null&&xx(r),al(t,e.child,null,n),e=Tx(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function UR(e,t,n,r,s,i,o){if(n)return t.flags&256?(t.flags&=-257,r=am(Error(ge(422))),Pd(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,s=t.mode,r=Kp({mode:"visible",children:r.children},s,0,null),i=Ro(i,s,o,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&al(t,e.child,null,o),t.child.memoizedState=Hg(o),t.memoizedState=zg,i);if(!(t.mode&1))return Pd(e,t,o,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(ge(419)),r=am(i,r,void 0),Pd(e,t,o,r)}if(l=(o&e.childLanes)!==0,yr||l){if(r=Dn,r!==null){switch(o&-o){case 4:s=2;break;case 16:s=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|o)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,wi(e,s),Es(r,e,s,-1))}return Dx(),r=am(Error(ge(421))),Pd(e,t,o,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=i2.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,Lr=Gi(s.nextSibling),Or=t,Zt=!0,vs=null,e!==null&&(Yr[Gr++]=ci,Yr[Gr++]=ui,Yr[Gr++]=zo,ci=e.id,ui=e.overflow,zo=t),t=Tx(t,r.children),t.flags|=4096,t)}function c0(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Mg(e.return,t,n)}function lm(e,t,n,r,s){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=s)}function K1(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;if(or(e,t,r.children,n),r=rn.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&&c0(e,n,t);else if(e.tag===19)c0(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(Ft(rn,r),!(t.mode&1))t.memoizedState=null;else switch(s){case"forwards":for(n=t.child,s=null;n!==null;)e=n.alternate,e!==null&&Gf(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),lm(t,!1,s,n,i);break;case"backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&Gf(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}lm(t,!0,n,null,i);break;case"together":lm(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function xf(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function bi(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Bo|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(ge(153));if(t.child!==null){for(e=t.child,n=Zi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Zi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function qR(e,t,n){switch(t.tag){case 3:W1(t),ol();break;case 5:y1(t);break;case 1:vr(t.type)&&Wf(t);break;case 4:Nx(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;Ft(Uf,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(Ft(rn,rn.current&1),t.flags|=128,null):n&t.child.childLanes?V1(e,t,n):(Ft(rn,rn.current&1),e=bi(e,t,n),e!==null?e.sibling:null);Ft(rn,rn.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return K1(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),Ft(rn,rn.current),r)break;return null;case 22:case 23:return t.lanes=0,H1(e,t,n)}return bi(e,t,n)}var U1,Bg,q1,Y1;U1=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}};Bg=function(){};q1=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,Po(Ks.current);var i=null;switch(n){case"input":s=ug(e,s),r=ug(e,r),i=[];break;case"select":s=on({},s,{value:void 0}),r=on({},r,{value:void 0}),i=[];break;case"textarea":s=pg(e,s),r=pg(e,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Hf)}mg(n,r);var o;n=null;for(u in s)if(!r.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var l=s[u];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Kc.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var c=r[u];if(l=s!=null?s[u]:void 0,r.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(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||(i||(i=[]),i.push(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(i=i||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Kc.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&Wt("scroll",e),i||l===c||(i=[])):(i=i||[]).push(u,c))}n&&(i=i||[]).push("style",n);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};Y1=function(e,t,n,r){n!==r&&(t.flags|=4)};function sc(e,t){if(!Zt)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 Yn(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function YR(e,t,n){var r=t.pendingProps;switch(yx(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Yn(t),null;case 1:return vr(t.type)&&Bf(),Yn(t),null;case 3:return r=t.stateNode,ll(),Kt(br),Kt(Qn),Cx(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Ed(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,vs!==null&&(Xg(vs),vs=null))),Bg(e,t),Yn(t),null;case 5:jx(t);var s=Po(ru.current);if(n=t.type,e!==null&&t.stateNode!=null)q1(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(ge(166));return Yn(t),null}if(e=Po(Ks.current),Ed(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[zs]=t,r[tu]=i,e=(t.mode&1)!==0,n){case"dialog":Wt("cancel",r),Wt("close",r);break;case"iframe":case"object":case"embed":Wt("load",r);break;case"video":case"audio":for(s=0;s<wc.length;s++)Wt(wc[s],r);break;case"source":Wt("error",r);break;case"img":case"image":case"link":Wt("error",r),Wt("load",r);break;case"details":Wt("toggle",r);break;case"input":xv(r,i),Wt("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},Wt("invalid",r);break;case"textarea":bv(r,i),Wt("invalid",r)}mg(n,i),s=null;for(var o in i)if(i.hasOwnProperty(o)){var l=i[o];o==="children"?typeof l=="string"?r.textContent!==l&&(i.suppressHydrationWarning!==!0&&Cd(r.textContent,l,e),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&Cd(r.textContent,l,e),s=["children",""+l]):Kc.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&Wt("scroll",r)}switch(n){case"input":xd(r),wv(r,i,!0);break;case"textarea":xd(r),vv(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Hf)}r=s,t.updateQueue=r,r!==null&&(t.flags|=4)}else{o=s.nodeType===9?s:s.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=kj(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[zs]=t,e[tu]=r,U1(e,t,!1,!1),t.stateNode=e;e:{switch(o=gg(n,r),n){case"dialog":Wt("cancel",e),Wt("close",e),s=r;break;case"iframe":case"object":case"embed":Wt("load",e),s=r;break;case"video":case"audio":for(s=0;s<wc.length;s++)Wt(wc[s],e);s=r;break;case"source":Wt("error",e),s=r;break;case"img":case"image":case"link":Wt("error",e),Wt("load",e),s=r;break;case"details":Wt("toggle",e),s=r;break;case"input":xv(e,r),s=ug(e,r),Wt("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=on({},r,{value:void 0}),Wt("invalid",e);break;case"textarea":bv(e,r),s=pg(e,r),Wt("invalid",e);break;default:s=r}mg(n,s),l=s;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?jj(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&Sj(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Uc(e,c):typeof c=="number"&&Uc(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Kc.hasOwnProperty(i)?c!=null&&i==="onScroll"&&Wt("scroll",e):c!=null&&nx(e,i,c,o))}switch(n){case"input":xd(e),wv(e,r,!1);break;case"textarea":xd(e),vv(e);break;case"option":r.value!=null&&e.setAttribute("value",""+no(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?Ua(e,!!r.multiple,i,!1):r.defaultValue!=null&&Ua(e,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=Hf)}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 Yn(t),null;case 6:if(e&&t.stateNode!=null)Y1(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(ge(166));if(n=Po(ru.current),Po(Ks.current),Ed(t)){if(r=t.stateNode,n=t.memoizedProps,r[zs]=t,(i=r.nodeValue!==n)&&(e=Or,e!==null))switch(e.tag){case 3:Cd(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Cd(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[zs]=t,t.stateNode=r}return Yn(t),null;case 13:if(Kt(rn),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Zt&&Lr!==null&&t.mode&1&&!(t.flags&128))f1(),ol(),t.flags|=98560,i=!1;else if(i=Ed(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(ge(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(ge(317));i[zs]=t}else ol(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Yn(t),i=!1}else vs!==null&&(Xg(vs),vs=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||rn.current&1?Rn===0&&(Rn=3):Dx())),t.updateQueue!==null&&(t.flags|=4),Yn(t),null);case 4:return ll(),Bg(e,t),e===null&&Zc(t.stateNode.containerInfo),Yn(t),null;case 10:return vx(t.type._context),Yn(t),null;case 17:return vr(t.type)&&Bf(),Yn(t),null;case 19:if(Kt(rn),i=t.memoizedState,i===null)return Yn(t),null;if(r=(t.flags&128)!==0,o=i.rendering,o===null)if(r)sc(i,!1);else{if(Rn!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Gf(e),o!==null){for(t.flags|=128,sc(i,!1),r=o.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,o=i.alternate,o===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,e=o.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Ft(rn,rn.current&1|2),t.child}e=e.sibling}i.tail!==null&&mn()>ul&&(t.flags|=128,r=!0,sc(i,!1),t.lanes=4194304)}else{if(!r)if(e=Gf(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),sc(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!Zt)return Yn(t),null}else 2*mn()-i.renderingStartTime>ul&&n!==1073741824&&(t.flags|=128,r=!0,sc(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=mn(),t.sibling=null,n=rn.current,Ft(rn,r?n&1|2:n&1),t):(Yn(t),null);case 22:case 23:return Ox(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Tr&1073741824&&(Yn(t),t.subtreeFlags&6&&(t.flags|=8192)):Yn(t),null;case 24:return null;case 25:return null}throw Error(ge(156,t.tag))}function GR(e,t){switch(yx(t),t.tag){case 1:return vr(t.type)&&Bf(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ll(),Kt(br),Kt(Qn),Cx(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return jx(t),null;case 13:if(Kt(rn),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ge(340));ol()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Kt(rn),null;case 4:return ll(),null;case 10:return vx(t.type._context),null;case 22:case 23:return Ox(),null;case 24:return null;default:return null}}var Ad=!1,Gn=!1,XR=typeof WeakSet=="function"?WeakSet:Set,Le=null;function Fa(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){un(e,t,r)}else n.current=null}function Wg(e,t,n){try{n()}catch(r){un(e,t,r)}}var u0=!1;function JR(e,t){if(Cg=Df,e=Zj(),mx(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,u=0,p=0,f=e,d=null;t:for(;;){for(var h;f!==n||s!==0&&f.nodeType!==3||(l=o+s),f!==i||r!==0&&f.nodeType!==3||(c=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(h=f.firstChild)!==null;)d=f,f=h;for(;;){if(f===e)break t;if(d===n&&++u===s&&(l=o),d===i&&++p===r&&(c=o),(h=f.nextSibling)!==null)break;f=d,d=f.parentNode}f=h}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Eg={focusedElem:e,selectionRange:n},Df=!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 y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var w=y.memoizedProps,k=y.memoizedState,g=t.stateNode,b=g.getSnapshotBeforeUpdate(t.elementType===t.type?w:xs(t.type,w),k);g.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var x=t.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ge(163))}}catch(S){un(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,Le=e;break}Le=t.return}return y=u0,u0=!1,y}function Ic(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&Wg(t,n,i)}s=s.next}while(s!==r)}}function Wp(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 Vg(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 G1(e){var t=e.alternate;t!==null&&(e.alternate=null,G1(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[zs],delete t[tu],delete t[Ag],delete t[RR],delete t[MR])),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 X1(e){return e.tag===5||e.tag===3||e.tag===4}function d0(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||X1(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 Kg(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=Hf));else if(r!==4&&(e=e.child,e!==null))for(Kg(e,t,n),e=e.sibling;e!==null;)Kg(e,t,n),e=e.sibling}function Ug(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(Ug(e,t,n),e=e.sibling;e!==null;)Ug(e,t,n),e=e.sibling}var zn=null,ws=!1;function Ai(e,t,n){for(n=n.child;n!==null;)J1(e,t,n),n=n.sibling}function J1(e,t,n){if(Vs&&typeof Vs.onCommitFiberUnmount=="function")try{Vs.onCommitFiberUnmount(Lp,n)}catch{}switch(n.tag){case 5:Gn||Fa(n,t);case 6:var r=zn,s=ws;zn=null,Ai(e,t,n),zn=r,ws=s,zn!==null&&(ws?(e=zn,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):zn.removeChild(n.stateNode));break;case 18:zn!==null&&(ws?(e=zn,n=n.stateNode,e.nodeType===8?tm(e.parentNode,n):e.nodeType===1&&tm(e,n),Xc(e)):tm(zn,n.stateNode));break;case 4:r=zn,s=ws,zn=n.stateNode.containerInfo,ws=!0,Ai(e,t,n),zn=r,ws=s;break;case 0:case 11:case 14:case 15:if(!Gn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&Wg(n,t,o),s=s.next}while(s!==r)}Ai(e,t,n);break;case 1:if(!Gn&&(Fa(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){un(n,t,l)}Ai(e,t,n);break;case 21:Ai(e,t,n);break;case 22:n.mode&1?(Gn=(r=Gn)||n.memoizedState!==null,Ai(e,t,n),Gn=r):Ai(e,t,n);break;default:Ai(e,t,n)}}function f0(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new XR),t.forEach(function(r){var s=o2.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function hs(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];try{var i=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 5:zn=l.stateNode,ws=!1;break e;case 3:zn=l.stateNode.containerInfo,ws=!0;break e;case 4:zn=l.stateNode.containerInfo,ws=!0;break e}l=l.return}if(zn===null)throw Error(ge(160));J1(i,o,s),zn=null,ws=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(u){un(s,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Q1(t,e),t=t.sibling}function Q1(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(hs(t,e),Rs(e),r&4){try{Ic(3,e,e.return),Wp(3,e)}catch(w){un(e,e.return,w)}try{Ic(5,e,e.return)}catch(w){un(e,e.return,w)}}break;case 1:hs(t,e),Rs(e),r&512&&n!==null&&Fa(n,n.return);break;case 5:if(hs(t,e),Rs(e),r&512&&n!==null&&Fa(n,n.return),e.flags&32){var s=e.stateNode;try{Uc(s,"")}catch(w){un(e,e.return,w)}}if(r&4&&(s=e.stateNode,s!=null)){var i=e.memoizedProps,o=n!==null?n.memoizedProps:i,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&bj(s,i),gg(l,o);var u=gg(l,i);for(o=0;o<c.length;o+=2){var p=c[o],f=c[o+1];p==="style"?jj(s,f):p==="dangerouslySetInnerHTML"?Sj(s,f):p==="children"?Uc(s,f):nx(s,p,f,u)}switch(l){case"input":dg(s,i);break;case"textarea":vj(s,i);break;case"select":var d=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var h=i.value;h!=null?Ua(s,!!i.multiple,h,!1):d!==!!i.multiple&&(i.defaultValue!=null?Ua(s,!!i.multiple,i.defaultValue,!0):Ua(s,!!i.multiple,i.multiple?[]:"",!1))}s[tu]=i}catch(w){un(e,e.return,w)}}break;case 6:if(hs(t,e),Rs(e),r&4){if(e.stateNode===null)throw Error(ge(162));s=e.stateNode,i=e.memoizedProps;try{s.nodeValue=i}catch(w){un(e,e.return,w)}}break;case 3:if(hs(t,e),Rs(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Xc(t.containerInfo)}catch(w){un(e,e.return,w)}break;case 4:hs(t,e),Rs(e);break;case 13:hs(t,e),Rs(e),s=e.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(Lx=mn())),r&4&&f0(e);break;case 22:if(p=n!==null&&n.memoizedState!==null,e.mode&1?(Gn=(u=Gn)||p,hs(t,e),Gn=u):hs(t,e),Rs(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!p&&e.mode&1)for(Le=e,p=e.child;p!==null;){for(f=Le=p;Le!==null;){switch(d=Le,h=d.child,d.tag){case 0:case 11:case 14:case 15:Ic(4,d,d.return);break;case 1:Fa(d,d.return);var y=d.stateNode;if(typeof y.componentWillUnmount=="function"){r=d,n=d.return;try{t=r,y.props=t.memoizedProps,y.state=t.memoizedState,y.componentWillUnmount()}catch(w){un(r,n,w)}}break;case 5:Fa(d,d.return);break;case 22:if(d.memoizedState!==null){h0(f);continue}}h!==null?(h.return=d,Le=h):h0(f)}p=p.sibling}e:for(p=null,f=e;;){if(f.tag===5){if(p===null){p=f;try{s=f.stateNode,u?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=f.stateNode,c=f.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=Nj("display",o))}catch(w){un(e,e.return,w)}}}else if(f.tag===6){if(p===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(w){un(e,e.return,w)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;p===f&&(p=null),f=f.return}p===f&&(p=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:hs(t,e),Rs(e),r&4&&f0(e);break;case 21:break;default:hs(t,e),Rs(e)}}function Rs(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(X1(n)){var r=n;break e}n=n.return}throw Error(ge(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(Uc(s,""),r.flags&=-33);var i=d0(e);Ug(e,i,s);break;case 3:case 4:var o=r.stateNode.containerInfo,l=d0(e);Kg(e,l,o);break;default:throw Error(ge(161))}}catch(c){un(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function QR(e,t,n){Le=e,Z1(e)}function Z1(e,t,n){for(var r=(e.mode&1)!==0;Le!==null;){var s=Le,i=s.child;if(s.tag===22&&r){var o=s.memoizedState!==null||Ad;if(!o){var l=s.alternate,c=l!==null&&l.memoizedState!==null||Gn;l=Ad;var u=Gn;if(Ad=o,(Gn=c)&&!u)for(Le=s;Le!==null;)o=Le,c=o.child,o.tag===22&&o.memoizedState!==null?m0(s):c!==null?(c.return=o,Le=c):m0(s);for(;i!==null;)Le=i,Z1(i),i=i.sibling;Le=s,Ad=l,Gn=u}p0(e)}else s.subtreeFlags&8772&&i!==null?(i.return=s,Le=i):p0(e)}}function p0(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:Gn||Wp(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Gn)if(n===null)r.componentDidMount();else{var s=t.elementType===t.type?n.memoizedProps:xs(t.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&Jv(t,i,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}Jv(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 u=t.alternate;if(u!==null){var p=u.memoizedState;if(p!==null){var f=p.dehydrated;f!==null&&Xc(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(ge(163))}Gn||t.flags&512&&Vg(t)}catch(d){un(t,t.return,d)}}if(t===e){Le=null;break}if(n=t.sibling,n!==null){n.return=t.return,Le=n;break}Le=t.return}}function h0(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 m0(e){for(;Le!==null;){var t=Le;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Wp(4,t)}catch(c){un(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(c){un(t,s,c)}}var i=t.return;try{Vg(t)}catch(c){un(t,i,c)}break;case 5:var o=t.return;try{Vg(t)}catch(c){un(t,o,c)}}}catch(c){un(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 ZR=Math.ceil,Qf=Si.ReactCurrentDispatcher,Rx=Si.ReactCurrentOwner,Zr=Si.ReactCurrentBatchConfig,St=0,Dn=null,bn=null,Hn=0,Tr=0,za=lo(0),Rn=0,au=null,Bo=0,Vp=0,Mx=0,Tc=null,gr=null,Lx=0,ul=1/0,oi=null,Zf=!1,qg=null,Ji=null,Id=!1,Wi=null,ep=0,Rc=0,Yg=null,wf=-1,bf=0;function lr(){return St&6?mn():wf!==-1?wf:wf=mn()}function Qi(e){return e.mode&1?St&2&&Hn!==0?Hn&-Hn:$R.transition!==null?(bf===0&&(bf=Oj()),bf):(e=It,e!==0||(e=window.event,e=e===void 0?16:Vj(e.type)),e):1}function Es(e,t,n,r){if(50<Rc)throw Rc=0,Yg=null,Error(ge(185));Pu(e,n,r),(!(St&2)||e!==Dn)&&(e===Dn&&(!(St&2)&&(Vp|=n),Rn===4&&zi(e,Hn)),kr(e,r),n===1&&St===0&&!(t.mode&1)&&(ul=mn()+500,zp&&co()))}function kr(e,t){var n=e.callbackNode;$T(e,t);var r=Of(e,e===Dn?Hn:0);if(r===0)n!==null&&Nv(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Nv(n),t===1)e.tag===0?LR(g0.bind(null,e)):c1(g0.bind(null,e)),IR(function(){!(St&6)&&co()}),n=null;else{switch(Dj(r)){case 1:n=ax;break;case 4:n=Lj;break;case 16:n=$f;break;case 536870912:n=$j;break;default:n=$f}n=aC(n,eC.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function eC(e,t){if(wf=-1,bf=0,St&6)throw Error(ge(327));var n=e.callbackNode;if(Ja()&&e.callbackNode!==n)return null;var r=Of(e,e===Dn?Hn:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=tp(e,r);else{t=r;var s=St;St|=2;var i=nC();(Dn!==e||Hn!==t)&&(oi=null,ul=mn()+500,To(e,t));do try{n2();break}catch(l){tC(e,l)}while(!0);bx(),Qf.current=i,St=s,bn!==null?t=0:(Dn=null,Hn=0,t=Rn)}if(t!==0){if(t===2&&(s=vg(e),s!==0&&(r=s,t=Gg(e,s))),t===1)throw n=au,To(e,0),zi(e,r),kr(e,mn()),n;if(t===6)zi(e,r);else{if(s=e.current.alternate,!(r&30)&&!e2(s)&&(t=tp(e,r),t===2&&(i=vg(e),i!==0&&(r=i,t=Gg(e,i))),t===1))throw n=au,To(e,0),zi(e,r),kr(e,mn()),n;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(ge(345));case 2:vo(e,gr,oi);break;case 3:if(zi(e,r),(r&130023424)===r&&(t=Lx+500-mn(),10<t)){if(Of(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){lr(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=Pg(vo.bind(null,e,gr,oi),t);break}vo(e,gr,oi);break;case 4:if(zi(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var o=31-Cs(r);i=1<<o,o=t[o],o>s&&(s=o),r&=~i}if(r=s,r=mn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*ZR(r/1960))-r,10<r){e.timeoutHandle=Pg(vo.bind(null,e,gr,oi),r);break}vo(e,gr,oi);break;case 5:vo(e,gr,oi);break;default:throw Error(ge(329))}}}return kr(e,mn()),e.callbackNode===n?eC.bind(null,e):null}function Gg(e,t){var n=Tc;return e.current.memoizedState.isDehydrated&&(To(e,t).flags|=256),e=tp(e,t),e!==2&&(t=gr,gr=n,t!==null&&Xg(t)),e}function Xg(e){gr===null?gr=e:gr.push.apply(gr,e)}function e2(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var s=n[r],i=s.getSnapshot;s=s.value;try{if(!_s(i(),s))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function zi(e,t){for(t&=~Mx,t&=~Vp,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Cs(t),r=1<<n;e[n]=-1,t&=~r}}function g0(e){if(St&6)throw Error(ge(327));Ja();var t=Of(e,0);if(!(t&1))return kr(e,mn()),null;var n=tp(e,t);if(e.tag!==0&&n===2){var r=vg(e);r!==0&&(t=r,n=Gg(e,r))}if(n===1)throw n=au,To(e,0),zi(e,t),kr(e,mn()),n;if(n===6)throw Error(ge(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,vo(e,gr,oi),kr(e,mn()),null}function $x(e,t){var n=St;St|=1;try{return e(t)}finally{St=n,St===0&&(ul=mn()+500,zp&&co())}}function Wo(e){Wi!==null&&Wi.tag===0&&!(St&6)&&Ja();var t=St;St|=1;var n=Zr.transition,r=It;try{if(Zr.transition=null,It=1,e)return e()}finally{It=r,Zr.transition=n,St=t,!(St&6)&&co()}}function Ox(){Tr=za.current,Kt(za)}function To(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,AR(n)),bn!==null)for(n=bn.return;n!==null;){var r=n;switch(yx(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Bf();break;case 3:ll(),Kt(br),Kt(Qn),Cx();break;case 5:jx(r);break;case 4:ll();break;case 13:Kt(rn);break;case 19:Kt(rn);break;case 10:vx(r.type._context);break;case 22:case 23:Ox()}n=n.return}if(Dn=e,bn=e=Zi(e.current,null),Hn=Tr=t,Rn=0,au=null,Mx=Vp=Bo=0,gr=Tc=null,_o!==null){for(t=0;t<_o.length;t++)if(n=_o[t],r=n.interleaved,r!==null){n.interleaved=null;var s=r.next,i=n.pending;if(i!==null){var o=i.next;i.next=s,r.next=o}n.pending=r}_o=null}return e}function tC(e,t){do{var n=bn;try{if(bx(),gf.current=Jf,Xf){for(var r=sn.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}Xf=!1}if(Ho=0,$n=In=sn=null,Ac=!1,su=0,Rx.current=null,n===null||n.return===null){Rn=1,au=t,bn=null;break}e:{var i=e,o=n.return,l=n,c=t;if(t=Hn,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,p=l,f=p.tag;if(!(p.mode&1)&&(f===0||f===11||f===15)){var d=p.alternate;d?(p.updateQueue=d.updateQueue,p.memoizedState=d.memoizedState,p.lanes=d.lanes):(p.updateQueue=null,p.memoizedState=null)}var h=r0(o);if(h!==null){h.flags&=-257,s0(h,o,l,i,t),h.mode&1&&n0(i,u,t),t=h,c=u;var y=t.updateQueue;if(y===null){var w=new Set;w.add(c),t.updateQueue=w}else y.add(c);break e}else{if(!(t&1)){n0(i,u,t),Dx();break e}c=Error(ge(426))}}else if(Zt&&l.mode&1){var k=r0(o);if(k!==null){!(k.flags&65536)&&(k.flags|=256),s0(k,o,l,i,t),xx(cl(c,l));break e}}i=c=cl(c,l),Rn!==4&&(Rn=2),Tc===null?Tc=[i]:Tc.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var g=D1(i,c,t);Xv(i,g);break e;case 1:l=c;var b=i.type,x=i.stateNode;if(!(i.flags&128)&&(typeof b.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Ji===null||!Ji.has(x)))){i.flags|=65536,t&=-t,i.lanes|=t;var S=F1(i,l,t);Xv(i,S);break e}}i=i.return}while(i!==null)}sC(n)}catch(C){t=C,bn===n&&n!==null&&(bn=n=n.return);continue}break}while(!0)}function nC(){var e=Qf.current;return Qf.current=Jf,e===null?Jf:e}function Dx(){(Rn===0||Rn===3||Rn===2)&&(Rn=4),Dn===null||!(Bo&268435455)&&!(Vp&268435455)||zi(Dn,Hn)}function tp(e,t){var n=St;St|=2;var r=nC();(Dn!==e||Hn!==t)&&(oi=null,To(e,t));do try{t2();break}catch(s){tC(e,s)}while(!0);if(bx(),St=n,Qf.current=r,bn!==null)throw Error(ge(261));return Dn=null,Hn=0,Rn}function t2(){for(;bn!==null;)rC(bn)}function n2(){for(;bn!==null&&!ET();)rC(bn)}function rC(e){var t=oC(e.alternate,e,Tr);e.memoizedProps=e.pendingProps,t===null?sC(e):bn=t,Rx.current=null}function sC(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=GR(n,t),n!==null){n.flags&=32767,bn=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Rn=6,bn=null;return}}else if(n=YR(n,t,Tr),n!==null){bn=n;return}if(t=t.sibling,t!==null){bn=t;return}bn=t=e}while(t!==null);Rn===0&&(Rn=5)}function vo(e,t,n){var r=It,s=Zr.transition;try{Zr.transition=null,It=1,r2(e,t,n,r)}finally{Zr.transition=s,It=r}return null}function r2(e,t,n,r){do Ja();while(Wi!==null);if(St&6)throw Error(ge(327));n=e.finishedWork;var s=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(ge(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(OT(e,i),e===Dn&&(bn=Dn=null,Hn=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Id||(Id=!0,aC($f,function(){return Ja(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Zr.transition,Zr.transition=null;var o=It;It=1;var l=St;St|=4,Rx.current=null,JR(e,n),Q1(n,e),SR(Eg),Df=!!Cg,Eg=Cg=null,e.current=n,QR(n),_T(),St=l,It=o,Zr.transition=i}else e.current=n;if(Id&&(Id=!1,Wi=e,ep=s),i=e.pendingLanes,i===0&&(Ji=null),IT(n.stateNode),kr(e,mn()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)s=t[n],r(s.value,{componentStack:s.stack,digest:s.digest});if(Zf)throw Zf=!1,e=qg,qg=null,e;return ep&1&&e.tag!==0&&Ja(),i=e.pendingLanes,i&1?e===Yg?Rc++:(Rc=0,Yg=e):Rc=0,co(),null}function Ja(){if(Wi!==null){var e=Dj(ep),t=Zr.transition,n=It;try{if(Zr.transition=null,It=16>e?16:e,Wi===null)var r=!1;else{if(e=Wi,Wi=null,ep=0,St&6)throw Error(ge(331));var s=St;for(St|=4,Le=e.current;Le!==null;){var i=Le,o=i.child;if(Le.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(Le=u;Le!==null;){var p=Le;switch(p.tag){case 0:case 11:case 15:Ic(8,p,i)}var f=p.child;if(f!==null)f.return=p,Le=f;else for(;Le!==null;){p=Le;var d=p.sibling,h=p.return;if(G1(p),p===u){Le=null;break}if(d!==null){d.return=h,Le=d;break}Le=h}}}var y=i.alternate;if(y!==null){var w=y.child;if(w!==null){y.child=null;do{var k=w.sibling;w.sibling=null,w=k}while(w!==null)}}Le=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,Le=o;else e:for(;Le!==null;){if(i=Le,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Ic(9,i,i.return)}var g=i.sibling;if(g!==null){g.return=i.return,Le=g;break e}Le=i.return}}var b=e.current;for(Le=b;Le!==null;){o=Le;var x=o.child;if(o.subtreeFlags&2064&&x!==null)x.return=o,Le=x;else e:for(o=b;Le!==null;){if(l=Le,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Wp(9,l)}}catch(C){un(l,l.return,C)}if(l===o){Le=null;break e}var S=l.sibling;if(S!==null){S.return=l.return,Le=S;break e}Le=l.return}}if(St=s,co(),Vs&&typeof Vs.onPostCommitFiberRoot=="function")try{Vs.onPostCommitFiberRoot(Lp,e)}catch{}r=!0}return r}finally{It=n,Zr.transition=t}}return!1}function y0(e,t,n){t=cl(n,t),t=D1(e,t,1),e=Xi(e,t,1),t=lr(),e!==null&&(Pu(e,1,t),kr(e,t))}function un(e,t,n){if(e.tag===3)y0(e,e,n);else for(;t!==null;){if(t.tag===3){y0(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Ji===null||!Ji.has(r))){e=cl(n,e),e=F1(t,e,1),t=Xi(t,e,1),e=lr(),t!==null&&(Pu(t,1,e),kr(t,e));break}}t=t.return}}function s2(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=lr(),e.pingedLanes|=e.suspendedLanes&n,Dn===e&&(Hn&n)===n&&(Rn===4||Rn===3&&(Hn&130023424)===Hn&&500>mn()-Lx?To(e,0):Mx|=n),kr(e,t)}function iC(e,t){t===0&&(e.mode&1?(t=vd,vd<<=1,!(vd&130023424)&&(vd=4194304)):t=1);var n=lr();e=wi(e,t),e!==null&&(Pu(e,t,n),kr(e,n))}function i2(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),iC(e,n)}function o2(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(ge(314))}r!==null&&r.delete(t),iC(e,n)}var oC;oC=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||br.current)yr=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return yr=!1,qR(e,t,n);yr=!!(e.flags&131072)}else yr=!1,Zt&&t.flags&1048576&&u1(t,Kf,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;xf(e,t),e=t.pendingProps;var s=il(t,Qn.current);Xa(t,n),s=_x(null,t,r,e,s,n);var i=Px();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,vr(r)?(i=!0,Wf(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Sx(t),s.updater=Bp,t.stateNode=s,s._reactInternals=t,$g(t,r,e,n),t=Fg(null,t,r,!0,i,n)):(t.tag=0,Zt&&i&&gx(t),or(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(xf(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=l2(r),e=xs(r,e),s){case 0:t=Dg(null,t,r,e,n);break e;case 1:t=a0(null,t,r,e,n);break e;case 11:t=i0(null,t,r,e,n);break e;case 14:t=o0(null,t,r,xs(r.type,e),n);break e}throw Error(ge(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:xs(r,s),Dg(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:xs(r,s),a0(e,t,r,s,n);case 3:e:{if(W1(t),e===null)throw Error(ge(387));r=t.pendingProps,i=t.memoizedState,s=i.element,g1(e,t),Yf(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=cl(Error(ge(423)),t),t=l0(e,t,r,n,s);break e}else if(r!==s){s=cl(Error(ge(424)),t),t=l0(e,t,r,n,s);break e}else for(Lr=Gi(t.stateNode.containerInfo.firstChild),Or=t,Zt=!0,vs=null,n=h1(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ol(),r===s){t=bi(e,t,n);break e}or(e,t,r,n)}t=t.child}return t;case 5:return y1(t),e===null&&Rg(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,o=s.children,_g(r,s)?o=null:i!==null&&_g(r,i)&&(t.flags|=32),B1(e,t),or(e,t,o,n),t.child;case 6:return e===null&&Rg(t),null;case 13:return V1(e,t,n);case 4:return Nx(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=al(t,null,r,n):or(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:xs(r,s),i0(e,t,r,s,n);case 7:return or(e,t,t.pendingProps,n),t.child;case 8:return or(e,t,t.pendingProps.children,n),t.child;case 12:return or(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,i=t.memoizedProps,o=s.value,Ft(Uf,r._currentValue),r._currentValue=o,i!==null)if(_s(i.value,o)){if(i.children===s.children&&!br.current){t=bi(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){o=i.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=mi(-1,n&-n),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var p=u.pending;p===null?c.next=c:(c.next=p.next,p.next=c),u.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),Mg(i.return,n,t),l.lanes|=n;break}c=c.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(ge(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Mg(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}or(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,Xa(t,n),s=es(s),r=r(s),t.flags|=1,or(e,t,r,n),t.child;case 14:return r=t.type,s=xs(r,t.pendingProps),s=xs(r.type,s),o0(e,t,r,s,n);case 15:return z1(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:xs(r,s),xf(e,t),t.tag=1,vr(r)?(e=!0,Wf(t)):e=!1,Xa(t,n),O1(t,r,s),$g(t,r,s,n),Fg(null,t,r,!0,e,n);case 19:return K1(e,t,n);case 22:return H1(e,t,n)}throw Error(ge(156,t.tag))};function aC(e,t){return Mj(e,t)}function a2(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 Qr(e,t,n,r){return new a2(e,t,n,r)}function Fx(e){return e=e.prototype,!(!e||!e.isReactComponent)}function l2(e){if(typeof e=="function")return Fx(e)?1:0;if(e!=null){if(e=e.$$typeof,e===sx)return 11;if(e===ix)return 14}return 2}function Zi(e,t){var n=e.alternate;return n===null?(n=Qr(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 vf(e,t,n,r,s,i){var o=2;if(r=e,typeof e=="function")Fx(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Aa:return Ro(n.children,s,i,t);case rx:o=8,s|=8;break;case og:return e=Qr(12,n,t,s|2),e.elementType=og,e.lanes=i,e;case ag:return e=Qr(13,n,t,s),e.elementType=ag,e.lanes=i,e;case lg:return e=Qr(19,n,t,s),e.elementType=lg,e.lanes=i,e;case yj:return Kp(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case mj:o=10;break e;case gj:o=9;break e;case sx:o=11;break e;case ix:o=14;break e;case $i:o=16,r=null;break e}throw Error(ge(130,e==null?e:typeof e,""))}return t=Qr(o,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function Ro(e,t,n,r){return e=Qr(7,e,r,t),e.lanes=n,e}function Kp(e,t,n,r){return e=Qr(22,e,r,t),e.elementType=yj,e.lanes=n,e.stateNode={isHidden:!1},e}function cm(e,t,n){return e=Qr(6,e,null,t),e.lanes=n,e}function um(e,t,n){return t=Qr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function c2(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Vh(0),this.expirationTimes=Vh(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vh(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function zx(e,t,n,r,s,i,o,l,c){return e=new c2(e,t,n,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Qr(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Sx(i),e}function u2(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Pa,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function lC(e){if(!e)return ro;e=e._reactInternals;e:{if(Zo(e)!==e||e.tag!==1)throw Error(ge(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(ge(171))}if(e.tag===1){var n=e.type;if(vr(n))return l1(e,n,t)}return t}function cC(e,t,n,r,s,i,o,l,c){return e=zx(n,r,!0,e,s,i,o,l,c),e.context=lC(null),n=e.current,r=lr(),s=Qi(n),i=mi(r,s),i.callback=t??null,Xi(n,i,s),e.current.lanes=s,Pu(e,s,r),kr(e,r),e}function Up(e,t,n,r){var s=t.current,i=lr(),o=Qi(s);return n=lC(n),t.context===null?t.context=n:t.pendingContext=n,t=mi(i,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Xi(s,t,o),e!==null&&(Es(e,s,o,i),mf(e,s,o)),o}function np(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 x0(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Hx(e,t){x0(e,t),(e=e.alternate)&&x0(e,t)}function d2(){return null}var uC=typeof reportError=="function"?reportError:function(e){console.error(e)};function Bx(e){this._internalRoot=e}qp.prototype.render=Bx.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(ge(409));Up(e,t,null,null)};qp.prototype.unmount=Bx.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Wo(function(){Up(null,e,null,null)}),t[xi]=null}};function qp(e){this._internalRoot=e}qp.prototype.unstable_scheduleHydration=function(e){if(e){var t=Hj();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Fi.length&&t!==0&&t<Fi[n].priority;n++);Fi.splice(n,0,e),n===0&&Wj(e)}};function Wx(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Yp(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function w0(){}function f2(e,t,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var u=np(o);i.call(u)}}var o=cC(t,r,e,0,null,!1,!1,"",w0);return e._reactRootContainer=o,e[xi]=o.current,Zc(e.nodeType===8?e.parentNode:e),Wo(),o}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var u=np(c);l.call(u)}}var c=zx(e,0,!1,null,null,!1,!1,"",w0);return e._reactRootContainer=c,e[xi]=c.current,Zc(e.nodeType===8?e.parentNode:e),Wo(function(){Up(t,c,n,r)}),c}function Gp(e,t,n,r,s){var i=n._reactRootContainer;if(i){var o=i;if(typeof s=="function"){var l=s;s=function(){var c=np(o);l.call(c)}}Up(t,o,e,s)}else o=f2(n,t,e,s,r);return np(o)}Fj=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=xc(t.pendingLanes);n!==0&&(lx(t,n|1),kr(t,mn()),!(St&6)&&(ul=mn()+500,co()))}break;case 13:Wo(function(){var r=wi(e,1);if(r!==null){var s=lr();Es(r,e,1,s)}}),Hx(e,1)}};cx=function(e){if(e.tag===13){var t=wi(e,134217728);if(t!==null){var n=lr();Es(t,e,134217728,n)}Hx(e,134217728)}};zj=function(e){if(e.tag===13){var t=Qi(e),n=wi(e,t);if(n!==null){var r=lr();Es(n,e,t,r)}Hx(e,t)}};Hj=function(){return It};Bj=function(e,t){var n=It;try{return It=e,t()}finally{It=n}};xg=function(e,t,n){switch(t){case"input":if(dg(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var s=Fp(r);if(!s)throw Error(ge(90));wj(r),dg(r,s)}}}break;case"textarea":vj(e,n);break;case"select":t=n.value,t!=null&&Ua(e,!!n.multiple,t,!1)}};_j=$x;Pj=Wo;var p2={usingClientEntryPoint:!1,Events:[Iu,Ma,Fp,Cj,Ej,$x]},ic={findFiberByHostInstance:Eo,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},h2={bundleType:ic.bundleType,version:ic.version,rendererPackageName:ic.rendererPackageName,rendererConfig:ic.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Si.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Tj(e),e===null?null:e.stateNode},findFiberByHostInstance:ic.findFiberByHostInstance||d2,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 Td=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Td.isDisabled&&Td.supportsFiber)try{Lp=Td.inject(h2),Vs=Td}catch{}}Hr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=p2;Hr.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Wx(t))throw Error(ge(200));return u2(e,t,null,n)};Hr.createRoot=function(e,t){if(!Wx(e))throw Error(ge(299));var n=!1,r="",s=uC;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=zx(e,1,!1,null,null,n,!1,r,s),e[xi]=t.current,Zc(e.nodeType===8?e.parentNode:e),new Bx(t)};Hr.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(ge(188)):(e=Object.keys(e).join(","),Error(ge(268,e)));return e=Tj(t),e=e===null?null:e.stateNode,e};Hr.flushSync=function(e){return Wo(e)};Hr.hydrate=function(e,t,n){if(!Yp(t))throw Error(ge(200));return Gp(null,e,t,!0,n)};Hr.hydrateRoot=function(e,t,n){if(!Wx(e))throw Error(ge(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",o=uC;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=cC(t,null,e,1,n??null,s,!1,i,o),e[xi]=t.current,Zc(e),r)for(e=0;e<r.length;e++)n=r[e],s=n._getVersion,s=s(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,s]:t.mutableSourceEagerHydrationData.push(n,s);return new qp(t)};Hr.render=function(e,t,n){if(!Yp(t))throw Error(ge(200));return Gp(null,e,t,!1,n)};Hr.unmountComponentAtNode=function(e){if(!Yp(e))throw Error(ge(40));return e._reactRootContainer?(Wo(function(){Gp(null,null,e,!1,function(){e._reactRootContainer=null,e[xi]=null})}),!0):!1};Hr.unstable_batchedUpdates=$x;Hr.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Yp(n))throw Error(ge(200));if(e==null||e._reactInternals===void 0)throw Error(ge(38));return Gp(e,t,n,!1,r)};Hr.version="18.3.1-next-f1338f8080-20240426";function dC(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(dC)}catch(e){console.error(e)}}dC(),dj.exports=Hr;var ar=dj.exports,b0=ar;sg.createRoot=b0.createRoot,sg.hydrateRoot=b0.hydrateRoot;const fC=m.createContext(null);function Jg(e){let t=e||"/";return t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t||"/"}function m2(){const e=Jg(window.location.pathname);return e==="/"?(window.history.replaceState({},"","/projects"),"/projects"):e}function g2({children:e}){const[t,n]=m.useState(m2);m.useEffect(()=>{const i=()=>n(Jg(window.location.pathname));return window.addEventListener("popstate",i),()=>window.removeEventListener("popstate",i)},[]);const r=m.useCallback(i=>{const o=i.startsWith("/")?i:`/${i}`;let l;try{l=new URL(o,window.location.origin)}catch{l=new URL("/",window.location.origin)}const c=Jg(l.pathname),u=l.search||"";window.history.pushState({},"",c+u),n(c)},[]),s=m.useMemo(()=>({path:t,navigate:r}),[t,r]);return a.jsx(fC.Provider,{value:s,children:e})}function Js(){const e=m.useContext(fC);if(!e)throw new Error("useRoute must be used within RouteProvider");return e}function y2(){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 v0={};function Qg(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];typeof t[0]=="string"&&v0[t[0]]||(typeof t[0]=="string"&&(v0[t[0]]=new Date),y2(...t))}const pC=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}};function k0(e,t,n){e.loadNamespaces(t,pC(e,n))}function S0(e,t,n,r){typeof n=="string"&&(n=[n]),n.forEach(s=>{e.options.ns.indexOf(s)<0&&e.options.ns.push(s)}),e.loadLanguages(t,pC(e,r))}function x2(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=t.languages[0],s=t.options?t.options.fallbackLng:!1,i=t.languages[t.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const o=(l,c)=>{const u=t.services.backendConnector.state[`${l}|${c}`];return u===-1||u===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!o(t.isLanguageChangingTo,e)?!1:!!(t.hasResourceBundle(r,e)||!t.services.backendConnector.backend||t.options.resources&&!t.options.partialBundledLanguages||o(r,e)&&(!s||o(i,e)))}function w2(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(Qg("i18n.languages were undefined or empty",t.languages),!0):t.options.ignoreJSONStructure!==void 0?t.hasLoadedNamespace(e,{lng:n.lng,precheck:(s,i)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&s.services.backendConnector.backend&&s.isLanguageChangingTo&&!i(s.isLanguageChangingTo,e))return!1}}):x2(e,t,n)}const b2=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,v2={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},k2=e=>v2[e],S2=e=>e.replace(b2,k2);let Zg={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:S2};function N2(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Zg={...Zg,...e}}function j2(){return Zg}let hC;function C2(e){hC=e}function E2(){return hC}const _2={type:"3rdParty",init(e){N2(e.options.react),C2(e)}},P2=m.createContext();class A2{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const I2=(e,t)=>{const n=m.useRef();return m.useEffect(()=>{n.current=e},[e,t]),n.current};function dr(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=t,{i18n:r,defaultNS:s}=m.useContext(P2)||{},i=n||r||E2();if(i&&!i.reportNamespaces&&(i.reportNamespaces=new A2),!i){Qg("You will need to pass in an i18next instance by using initReactI18next");const x=(C,j)=>typeof j=="string"?j:j&&typeof j=="object"&&typeof j.defaultValue=="string"?j.defaultValue:Array.isArray(C)?C[C.length-1]:C,S=[x,{},!1];return S.t=x,S.i18n={},S.ready=!1,S}i.options.react&&i.options.react.wait!==void 0&&Qg("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const o={...j2(),...i.options.react,...t},{useSuspense:l,keyPrefix:c}=o;let u=e||s||i.options&&i.options.defaultNS;u=typeof u=="string"?[u]:u||["translation"],i.reportNamespaces.addUsedNamespaces&&i.reportNamespaces.addUsedNamespaces(u);const p=(i.isInitialized||i.initializedStoreOnce)&&u.every(x=>w2(x,i,o));function f(){return i.getFixedT(t.lng||null,o.nsMode==="fallback"?u:u[0],c)}const[d,h]=m.useState(f);let y=u.join();t.lng&&(y=`${t.lng}${y}`);const w=I2(y),k=m.useRef(!0);m.useEffect(()=>{const{bindI18n:x,bindI18nStore:S}=o;k.current=!0,!p&&!l&&(t.lng?S0(i,t.lng,u,()=>{k.current&&h(f)}):k0(i,u,()=>{k.current&&h(f)})),p&&w&&w!==y&&k.current&&h(f);function C(){k.current&&h(f)}return x&&i&&i.on(x,C),S&&i&&i.store.on(S,C),()=>{k.current=!1,x&&i&&x.split(" ").forEach(j=>i.off(j,C)),S&&i&&S.split(" ").forEach(j=>i.store.off(j,C))}},[i,y]);const g=m.useRef(!0);m.useEffect(()=>{k.current&&!g.current&&h(f),g.current=!1},[i,c]);const b=[d,i,p];if(b.t=d,b.i18n=i,b.ready=p,p||!p&&!l)return b;throw new Promise(x=>{t.lng?S0(i,t.lng,u,()=>x()):k0(i,u,()=>x())})}const mC="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",T2=[{to:"/projects",labelKey:"common:nav.projects",icon:"folder_open"},{to:"/nodes",labelKey:"common:nav.nodes",icon:"account_tree"},{to:"/my-nodes",labelKey:"common:nav.myNodes",icon:"deployed_code"},{to:"/my-flows",labelKey:"common:nav.myFlows",icon:"schema"},{to:"/skills",labelKey:"common:nav.skills",icon:"extension"},{to:"/mcps",labelKey:"common:nav.mcps",icon:"hub"},{to:"/schedules",label:"定时任务",icon:"event_busy"},{to:"/admin/usage",label:"管理看板",icon:"query_stats",adminOnly:!0},{to:"/feedback",labelKey:"common:nav.feedback",icon:"rate_review"},{to:"/settings",labelKey:"common:nav.settings",icon:"settings"}],R2=[{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 M2(e,t){return t==="/projects"?e==="/projects"||e==="/":e===t||e.startsWith(t+"/")}function L2({authUser:e,onLogout:t}){const{path:n,navigate:r}=Js(),{t:s}=dr(),[i,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":s("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:mC,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:T2.filter(l=>!l.adminOnly||(e==null?void 0:e.isAdmin)).map(l=>a.jsxs("button",{type:"button",className:"af-nav-link"+(M2(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:l.label||s(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)||""}),e!=null&&e.isAdmin?a.jsx("span",{className:"af-sidebar-admin-badge",children:"Admin"}):null,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"})})]}),!i&&R2.map(l=>{const c=s(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 $2="agentflow.pipelineRecent",O2=15;function D2(e){try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function F2(){if(typeof localStorage>"u")return[];const e=localStorage.getItem($2);return e?D2(e).filter(t=>t&&typeof t.flowId=="string"&&(t.flowSource==="user"||t.flowSource==="builtin"||t.flowSource==="admin"||t.flowSource==="workspace")&&t.kind==="opened"&&typeof t.at=="number"):[]}function z2(e,t){const n=e.filter(r=>r.id===t);return n.length===0||n.some(r=>(r.source??"user")==="user")?"user":n.some(r=>r.source==="workspace")?"workspace":n.some(r=>r.source==="admin")?"admin":n.some(r=>r.source==="builtin")?"builtin":n[0].source??"user"}function N0(e,t){const n=Date.now(),r=Math.max(0,n-e),s=Math.floor(r/1e3);if(s<60)return t("flow:time.justNow");const i=Math.floor(s/60);if(i<60)return t("flow:time.minutesAgo",{n:i});const o=Math.floor(i/60);if(o<24)return t("flow:time.hoursAgo",{n:o});const l=new Date(e),c=new Date,u=new Date(c);if(u.setDate(u.getDate()-1),l.toDateString()===u.toDateString())return t("flow:time.yesterday");const p=Math.floor(o/24);return p<7?t("flow:time.daysAgo",{n:p}):`${l.getMonth()+1}/${l.getDate()}`}function H2(e,t,n){const r=[];for(const s of e)!s||typeof s.flowId!="string"||typeof s.at!="number"||r.push({flowId:s.flowId,flowSource:z2(n,s.flowId),kind:"executed",at:s.at});for(const s of t)r.push({flowId:s.flowId,flowSource:s.flowSource,kind:"opened",at:s.at});return r.sort((s,i)=>i.at-s.at),r.slice(0,O2)}var Rr=Uint8Array,Ha=Uint16Array,B2=Int32Array,gC=new Rr([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]),yC=new Rr([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]),W2=new Rr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),xC=function(e,t){for(var n=new Ha(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var s=new B2(n[30]),r=1;r<30;++r)for(var i=n[r];i<n[r+1];++i)s[i]=i-n[r]<<5|r;return{b:n,r:s}},wC=xC(gC,2),bC=wC.b,V2=wC.r;bC[28]=258,V2[258]=28;var K2=xC(yC,0),U2=K2.b,ey=new Ha(32768);for(var Vt=0;Vt<32768;++Vt){var Ii=(Vt&43690)>>1|(Vt&21845)<<1;Ii=(Ii&52428)>>2|(Ii&13107)<<2,Ii=(Ii&61680)>>4|(Ii&3855)<<4,ey[Vt]=((Ii&65280)>>8|(Ii&255)<<8)>>1}var Mc=function(e,t,n){for(var r=e.length,s=0,i=new Ha(t);s<r;++s)e[s]&&++i[e[s]-1];var o=new Ha(t);for(s=1;s<t;++s)o[s]=o[s-1]+i[s-1]<<1;var l;if(n){l=new Ha(1<<t);var c=15-t;for(s=0;s<r;++s)if(e[s])for(var u=s<<4|e[s],p=t-e[s],f=o[e[s]-1]++<<p,d=f|(1<<p)-1;f<=d;++f)l[ey[f]>>c]=u}else for(l=new Ha(r),s=0;s<r;++s)e[s]&&(l[s]=ey[o[e[s]-1]++]>>15-e[s]);return l},Ru=new Rr(288);for(var Vt=0;Vt<144;++Vt)Ru[Vt]=8;for(var Vt=144;Vt<256;++Vt)Ru[Vt]=9;for(var Vt=256;Vt<280;++Vt)Ru[Vt]=7;for(var Vt=280;Vt<288;++Vt)Ru[Vt]=8;var vC=new Rr(32);for(var Vt=0;Vt<32;++Vt)vC[Vt]=5;var q2=Mc(Ru,9,1),Y2=Mc(vC,5,1),dm=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},ms=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},fm=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},G2=function(e){return(e+7)/8|0},Vx=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new Rr(e.subarray(t,n))},X2=["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"],qr=function(e,t,n){var r=new Error(t||X2[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,qr),!n)throw r;return r},J2=function(e,t,n,r){var s=e.length,i=r?r.length:0;if(!s||t.f&&!t.l)return n||new Rr(0);var o=!n,l=o||t.i!=2,c=t.i;o&&(n=new Rr(s*3));var u=function(ie){var ce=n.length;if(ie>ce){var pe=new Rr(Math.max(ce*2,ie));pe.set(n),n=pe}},p=t.f||0,f=t.p||0,d=t.b||0,h=t.l,y=t.d,w=t.m,k=t.n,g=s*8;do{if(!h){p=ms(e,f,1);var b=ms(e,f+1,3);if(f+=3,b)if(b==1)h=q2,y=Y2,w=9,k=5;else if(b==2){var j=ms(e,f,31)+257,E=ms(e,f+10,15)+4,A=j+ms(e,f+5,31)+1;f+=14;for(var D=new Rr(A),W=new Rr(19),F=0;F<E;++F)W[W2[F]]=ms(e,f+F*3,7);f+=E*3;for(var R=dm(W),$=(1<<R)-1,P=Mc(W,R,1),F=0;F<A;){var L=P[ms(e,f,$)];f+=L&15;var x=L>>4;if(x<16)D[F++]=x;else{var T=0,O=0;for(x==16?(O=3+ms(e,f,3),f+=2,T=D[F-1]):x==17?(O=3+ms(e,f,7),f+=3):x==18&&(O=11+ms(e,f,127),f+=7);O--;)D[F++]=T}}var I=D.subarray(0,j),H=D.subarray(j);w=dm(I),k=dm(H),h=Mc(I,w,1),y=Mc(H,k,1)}else qr(1);else{var x=G2(f)+4,S=e[x-4]|e[x-3]<<8,C=x+S;if(C>s){c&&qr(0);break}l&&u(d+S),n.set(e.subarray(x,C),d),t.b=d+=S,t.p=f=C*8,t.f=p;continue}if(f>g){c&&qr(0);break}}l&&u(d+131072);for(var _=(1<<w)-1,Y=(1<<k)-1,U=f;;U=f){var T=h[fm(e,f)&_],V=T>>4;if(f+=T&15,f>g){c&&qr(0);break}if(T||qr(2),V<256)n[d++]=V;else if(V==256){U=f,h=null;break}else{var Z=V-254;if(V>264){var F=V-257,ue=gC[F];Z=ms(e,f,(1<<ue)-1)+bC[F],f+=ue}var le=y[fm(e,f)&Y],we=le>>4;le||qr(3),f+=le&15;var H=U2[we];if(we>3){var ue=yC[we];H+=fm(e,f)&(1<<ue)-1,f+=ue}if(f>g){c&&qr(0);break}l&&u(d+131072);var re=d+Z;if(d<H){var ye=i-H,te=Math.min(H,re);for(ye+d<0&&qr(3);d<te;++d)n[d]=r[ye+d]}for(;d<re;++d)n[d]=n[d-H]}}t.l=h,t.p=U,t.b=d,t.f=p,h&&(p=1,t.m=w,t.d=y,t.n=k)}while(!p);return d!=n.length&&o?Vx(n,0,d):n.subarray(0,d)},Q2=new Rr(0),Hs=function(e,t){return e[t]|e[t+1]<<8},ks=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},pm=function(e,t){return ks(e,t)+ks(e,t+4)*4294967296};function Z2(e,t){return J2(e,{i:2},t&&t.out,t&&t.dictionary)}var ty=typeof TextDecoder<"u"&&new TextDecoder,eM=0;try{ty.decode(Q2,{stream:!0}),eM=1}catch{}var tM=function(e){for(var t="",n=0;;){var r=e[n++],s=(r>127)+(r>223)+(r>239);if(n+s>e.length)return{s:t,r:Vx(e,n-1)};s?s==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):s&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r)}};function nM(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(ty)return ty.decode(e);var s=tM(e),i=s.s,n=s.r;return n.length&&qr(8),i}}var rM=function(e,t){return t+30+Hs(e,t+26)+Hs(e,t+28)},sM=function(e,t,n){var r=Hs(e,t+28),s=nM(e.subarray(t+46,t+46+r),!(Hs(e,t+8)&2048)),i=t+46+r,o=ks(e,t+20),l=n&&o==4294967295?iM(e,i):[o,ks(e,t+24),ks(e,t+42)],c=l[0],u=l[1],p=l[2];return[Hs(e,t+10),c,u,s,i+Hs(e,t+30)+Hs(e,t+32),p]},iM=function(e,t){for(;Hs(e,t)!=1;t+=4+Hs(e,t+2));return[pm(e,t+12),pm(e,t+4),pm(e,t+20)]};function oM(e,t){for(var n={},r=e.length-22;ks(e,r)!=101010256;--r)(!r||e.length-r>65558)&&qr(13);var s=Hs(e,r+8);if(!s)return{};var i=ks(e,r+16),o=i==4294967295||s==65535;if(o){var l=ks(e,r-12);o=ks(e,l)==101075792,o&&(s=ks(e,l+32),i=ks(e,l+48))}for(var c=0;c<s;++c){var u=sM(e,i,o),p=u[0],f=u[1],d=u[2],h=u[3],y=u[4],w=u[5],k=rM(e,w);i=y,p?p==8?n[h]=Z2(e.subarray(k,k+f),{out:new Rr(d)}):qr(14,"unknown compression type "+p):n[h]=Vx(e,k,k+f)}return n}const aM=8*1024*1024,lM=500;function cM(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 uM(e){return e?e.split("/").some(n=>n==="__MACOSX"||n.startsWith("._")):!0}function dM(e){const t=e.toLowerCase();if(t==="flow.yaml"||t==="flow.yml")return"";const n="/flow.yaml",r="/flow.yml";let s=null;if(t.endsWith(n))s=e.slice(0,-n.length);else if(t.endsWith(r))s=e.slice(0,-r.length);else return null;return s.includes("/")?null:s}const fM=/^[a-zA-Z][a-zA-Z0-9_-]*$/;async function pM(e){try{const t=new Uint8Array(await e.arrayBuffer()),n=oM(t),r=new Map;let s=0,i=0;for(const[c,u]of Object.entries(n)){if(c.endsWith("/"))continue;const p=cM(c);if(!p||uM(p))continue;const f=(u==null?void 0:u.length)??0;if(s+=f,s>aM||(i+=1,i>lM))return null;r.set(p,f)}if(r.size===0)return null;const o=new Set;for(const c of r.keys()){const u=dM(c);u!==null&&o.add(u)}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 fM.test(l)?l:null}catch{return null}}const hm=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function hM({file:e,onClose:t,onImported:n}){const{t:r}=dr(),s=m.useId(),i=m.useRef(null),o=m.useRef(null),[l,c]=m.useState(""),[u,p]=m.useState("user"),[f,d]=m.useState(!1),[h,y]=m.useState(""),[w,k]=m.useState(null),g=w??e;m.useEffect(()=>{const C=requestAnimationFrame(()=>{var j;return(j=i.current)==null?void 0:j.focus()});return()=>cancelAnimationFrame(C)},[]),m.useEffect(()=>{let C=!1;return(async()=>{const j=g.name||"",E=j.toLowerCase();let A="";if(E.endsWith(".zip")){if(A=await pM(g)||"",!A){const D=j.replace(/\.zip$/i,"");hm.test(D)&&(A=D)}}else if(E.endsWith(".yaml")||E.endsWith(".yml")){const D=j.replace(/\.ya?ml$/i,"");hm.test(D)&&(A=D)}C||c(A)})(),()=>{C=!0}},[g]);const b=l.trim(),x=b.length>0&&hm.test(b);async function S(C){if(C.preventDefault(),!(!x||f)){d(!0),y("");try{const j=new FormData;j.set("flowId",b),j.set("targetSpace",u),j.set("file",g,g.name);const E=await fetch("/api/flows/import",{method:"POST",body:j}),A=await E.json().catch(()=>({}));if(!E.ok){y(typeof A.error=="string"?A.error:r("project:importModal.importFailed"));return}n({id:A.flowId,source:A.flowSource??"user"})}catch(j){y(String((j==null?void 0:j.message)||j))}finally{d(!1)}}}return a.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:C=>{C.target===C.currentTarget&&t()},children:a.jsxs("div",{ref:i,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":s,tabIndex:-1,onMouseDown:C=>C.stopPropagation(),children:[a.jsxs("div",{className:"af-shortcuts-panel__head",children:[a.jsx("h2",{id:s,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:S,children:[a.jsx("p",{className:"af-new-pipeline-lead",children:r("project:importModal.lead",{filename:g.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:C=>{var E;const j=(E=C.target.files)==null?void 0:E[0];j&&k(j),C.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:C=>c(C.target.value),"aria-invalid":b.length>0&&!x}),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 C;return(C=o.current)==null?void 0:C.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:!x||f,children:r(f?"project:importModal.importing":"project:importModal.importAndOpen")})]})]})]})})}const mM=/^[a-zA-Z][a-zA-Z0-9_-]*$/,j0="af:newPipelineGuide";function gM({open:e,onClose:t,onCreated:n}){const{t:r}=dr(),s=m.useId(),i=m.useRef(null),[o,l]=m.useState(""),[c,u]=m.useState(""),[p,f]=m.useState("user"),[d,h]=m.useState(!1),[y,w]=m.useState(""),[k,g]=m.useState(!1);m.useEffect(()=>{if(!e)return;l(""),u(""),f("user"),w(""),h(!1),localStorage.getItem(j0)==="true"&&g(!0);const E=requestAnimationFrame(()=>{var A;return(A=i.current)==null?void 0:A.focus()});return()=>cancelAnimationFrame(E)},[e]);const b=()=>{localStorage.removeItem(j0),g(!1)};if(!e)return null;const x=o.trim(),S=x.length>0&&mM.test(x);async function C(j){if(j.preventDefault(),!(!S||d)){h(!0),w(""),b();try{const E=await fetch("/api/flows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:x,description:c.trim(),targetSpace:p})}),A=await E.json().catch(()=>({}));if(!E.ok){w(typeof A.error=="string"?A.error:r("project:newPipelineModal.createFailed"));return}n({id:A.flowId,source:A.flowSource??"user"})}catch(E){w(String((E==null?void 0:E.message)||E))}finally{h(!1)}}}return a.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:j=>{j.target===j.currentTarget&&(b(),t())},children:a.jsxs("div",{ref:i,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":s,tabIndex:-1,onMouseDown:j=>j.stopPropagation(),children:[a.jsxs("div",{className:"af-shortcuts-panel__head",children:[a.jsx("h2",{id:s,className:"af-shortcuts-panel__title",children:r("project:newPipelineModal.title")}),a.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:()=>{b(),t()},"aria-label":r("project:newPipelineModal.close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),k?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:b,children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]})}):null,a.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:C,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":x.length>0&&!S}),a.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-hint",children:r(k?"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(k?"onboarding:newPipeline.descPlaceholderGuide":"project:newPipelineModal.descPlaceholder"),value:c,onChange:j=>u(j.target.value)}),k?a.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-guide-hint",children:r("onboarding:newPipeline.descHintGuide")}):null]}),y?a.jsx("p",{className:"af-err af-new-pipeline-err",children:y}):null,a.jsxs("div",{className:"af-new-pipeline-actions",children:[a.jsx("button",{type:"button",className:"af-btn-secondary",onClick:()=>{b(),t()},disabled:d,children:r("project:newPipelineModal.cancel")}),a.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!S||d,children:r(d?"project:newPipelineModal.creating":k?"onboarding:newPipeline.createGuide":"project:newPipelineModal.createAndOpen")})]})]})]})})}const kC="agentflow.pipelineViewPreference";function SC(e,t="user",n=!1){return`${String(t||"user")}:${String(e||"")}:${n?"archived":"active"}`}function NC(){if(typeof localStorage>"u")return{};try{const e=JSON.parse(localStorage.getItem(kC)||"{}");return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}catch{return{}}}function yM(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(kC,JSON.stringify(e))}catch{}}function Kx(e){return e==="display"?"display":"workspace"}function xM(e){const t=String(e||"").toLowerCase();return t==="builtin"||t==="admin"}function jC(e,t){const n=Kx(t);return n==="pipeline"&&xM(e==null?void 0:e.source)?"workspace":n}function wM(e){return(e==null?void 0:e.hasPipeline)!==!1&&(e==null?void 0:e.hasFlow)!==!1&&(e==null?void 0:e.flowYaml)!==!1}function bM(e,t,n,r=!1){if(!e)return;const s=NC();s[SC(e,t,r)]={view:Kx(n),at:Date.now()},yM(s)}function vM(e,t="workspace"){if(!(e!=null&&e.id))return Kx(t);const r=NC()[SC(e.id,e.source??"user",!!e.archived)],s=jC(e,(r==null?void 0:r.view)||t);return s==="pipeline"&&!wM(e)?"workspace":s}function kM(e,t="workspace"){const n=jC(e,t);if(!(e!=null&&e.id))return n==="display"?"/workspace?view=display":"/workspace";const r=new URLSearchParams({flowId:e.id,flowSource:e.source??"user"});return e.archived&&r.set("archived","1"),n==="display"&&r.set("view","display"),`/workspace?${r.toString()}`}function Rd(e,t="workspace"){return kM(e,vM(e,t))}function SM(e,t){const n=String(e||"").split(/[.-]/).map(i=>Number.parseInt(i,10)),r=String(t||"").split(/[.-]/).map(i=>Number.parseInt(i,10)),s=Math.max(n.length,r.length);for(let i=0;i<s;i+=1){const o=Number.isFinite(n[i])?n[i]:0,l=Number.isFinite(r[i])?r[i]:0;if(o!==l)return o>l?1:-1}return 0}function ny(e){return String((e==null?void 0:e.version)||"").trim()}function NM(e){const t=ny(e),n=[(e==null?void 0:e.agent)||"codex",(e==null?void 0:e.kind)||"skill"];return t&&n.push(`v${t}`),n.join(" · ")}function jM({onChanged:e,canManage:t=!1}){const[n,r]=m.useState({available:!1,version:"",loggedIn:!1,user:"",error:""}),[s,i]=m.useState([]),[o,l]=m.useState(""),[c,u]=m.useState(""),[p,f]=m.useState("keyword"),[d,h]=m.useState([]),[y,w]=m.useState({}),[k,g]=m.useState(""),[b,x]=m.useState(""),[S,C]=m.useState(""),j=m.useCallback(async()=>{x("");try{const[R,$]=await Promise.all([fetch("/api/skillhub/status"),fetch("/api/skillhub/list?target=agentflow&agent=codex")]),P=await R.json().catch(()=>({}));R.ok&&r({available:!!P.available,version:typeof P.version=="string"?P.version:"",loggedIn:!!P.loggedIn,user:typeof P.user=="string"?P.user:"",error:typeof P.error=="string"?P.error:""});const L=await $.json().catch(()=>({}));if(!$.ok)throw new Error(typeof L.error=="string"?L.error:"HTTP "+$.status);i(Array.isArray(L.skills)?L.skills:[]),l(typeof L.skillsRoot=="string"?L.skillsRoot:""),w({})}catch(R){x(String(R.message||R))}},[]);m.useEffect(()=>{j()},[j]);const E=m.useCallback(async()=>{const R=c.trim();if(R){g("search"),x(""),C("");try{const $=await fetch(`/api/skillhub/search?q=${encodeURIComponent(R)}&mode=${encodeURIComponent(p)}`),P=await $.json().catch(()=>({}));if(!$.ok)throw new Error(typeof P.error=="string"?P.error:"HTTP "+$.status);h(Array.isArray(P.items)?P.items:[])}catch($){x(String($.message||$))}finally{g("")}}},[c,p]),A=m.useCallback(async(R,$=!1)=>{if(!t)return;const P=R&&typeof R=="object"?R:null,L=String(P?P.slug||P.name||P.collection||P.skillId||P.id:R||"").trim();if(L){g(`install:${L}`),x(""),C("");try{const T=P?{slug:P.slug||"",skillId:P.skillId||"",collection:P.collection||"",collectionName:P.collection&&P.name||"",target:"agentflow",agent:"codex",force:$}:{slug:L,target:"agentflow",agent:"codex",force:$},O=await fetch("/api/skillhub/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)}),I=await O.json().catch(()=>({}));if(!O.ok)throw new Error(typeof I.error=="string"?I.error:"HTTP "+O.status);C($?`已更新 ${L}`:`已安装 ${L}`),await j(),typeof e=="function"&&await e()}catch(T){x(String(T.message||T))}finally{g("")}}},[t,j,e]),D=m.useCallback(async()=>{if(t&&s.length!==0){g("check-updates"),x(""),C("");try{const R=await Promise.all(s.map(async L=>{const T=String(L.name||"").trim();if(!T)return null;try{const O=await fetch(`/api/skillhub/search?q=${encodeURIComponent(T)}&mode=keyword`),I=await O.json().catch(()=>({}));if(!O.ok)throw new Error(typeof I.error=="string"?I.error:"HTTP "+O.status);const H=Array.isArray(I.items)?I.items:[],_=H.find(Z=>Z.slug===T||Z.name===T||Z.id===T)||H[0],Y=ny(L),U=String((_==null?void 0:_.version)||"").trim();let V="unknown";return _?Y&&U?V=SM(Y,U)<0?"update":"current":U&&(V="remote-only"):V="missing",[T,{state:V,latestVersion:U,installedVersion:Y,summary:(_==null?void 0:_.summary)||""}]}catch(O){return[T,{state:"error",error:String(O.message||O),installedVersion:ny(L)}]}})),$={};for(const L of R)L&&($[L[0]]=L[1]);w($);const P=Object.values($).filter(L=>L.state==="update").length;C(P>0?`发现 ${P} 个可更新 skill`:"已检查,暂无明确可更新项")}finally{g("")}}},[t,s]),W=m.useCallback(async R=>{if(!t)return;const $=String(R||"").trim();if($){g(`uninstall:${$}`),x(""),C("");try{const P=await fetch("/api/skillhub/uninstall",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:$,target:"agentflow",agent:"codex"})}),L=await P.json().catch(()=>({}));if(!P.ok)throw new Error(typeof L.error=="string"?L.error:"HTTP "+P.status);C(`已卸载 ${$}`),await j(),typeof e=="function"&&await e()}catch(P){x(String(P.message||P))}finally{g("")}}},[t,j,e]),F=m.useCallback(async()=>{if(t){g("update-cli"),x(""),C("");try{const R=await fetch("/api/skillhub/update",{method:"POST"}),$=await R.json().catch(()=>({}));if(!R.ok)throw new Error(typeof $.error=="string"?$.error:"HTTP "+R.status);C("SkillHub CLI 已更新"),await j()}catch(R){x(String(R.message||R))}finally{g("")}}},[t,j]);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:t?"搜索、安装、更新和卸载 AgentFlow 共享 skills。":"查看 AgentFlow 共享 skills;使用时在 Workspace 中通过 Load Skills 加载。"}),o?a.jsxs("p",{className:"af-set-hint af-set-hint--inline",children:["Skills Root:",a.jsx("code",{children:o})]}):null]}),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:n.loggedIn?`已登录 ${n.user}`:"未登录 SkillHub"}),a.jsx("span",{className:"af-set-badge"+(n.available?" af-set-badge--ok":" af-set-badge--err"),children:n.available?`v${n.version}`:"not found"})]}),a.jsxs("div",{className:"af-set-skillhub-toolbar",children:[a.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:j,disabled:!!k,children:"刷新"}),a.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:D,disabled:!t||!!k||s.length===0,children:k==="check-updates"?"检查中…":"检查更新"}),a.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:F,disabled:!t||!!k,children:k==="update-cli"?"更新中…":"更新 CLI"})]})]})]}),a.jsxs("div",{className:"af-set-skillhub-search",children:[a.jsxs("select",{className:"af-set-input af-set-input--sm af-set-skillhub-search-mode",value:p,onChange:R=>{f(R.target.value),h([])},children:[a.jsx("option",{value:"keyword",children:"关键词"}),a.jsx("option",{value:"skillId",children:"Skill ID"}),a.jsx("option",{value:"collectionId",children:"Collection ID"})]}),a.jsx("input",{className:"af-set-input af-set-input--sm",value:c,onChange:R=>u(R.target.value),onKeyDown:R=>{R.key==="Enter"&&E()},placeholder:p==="collectionId"?"输入 collection id,例如 1":p==="skillId"?"输入 skill id":"搜索 skill slug / 关键词,例如 android、issue-tracker"}),a.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:()=>E(),disabled:!c.trim()||k==="search",children:[a.jsx("span",{className:"material-symbols-outlined",children:"search"}),k==="search"?"搜索中…":"搜索"]})]}),b?a.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:b}):null,S?a.jsx("p",{className:"af-set-hint af-set-hint--inline",children:S}):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:s.length})]}),a.jsx("div",{className:"af-set-skillhub-list",children:s.length===0?a.jsx("div",{className:"af-set-skillhub-empty",children:"暂无 AgentFlow 共享 skills"}):s.map(R=>{const $=y[R.name],P=!$||$.state==="update"||$.state==="remote-only"||$.state==="unknown"||$.state==="error",L=k===`install:${R.name}`?"更新中…":($==null?void 0:$.state)==="current"?"已最新":($==null?void 0:$.state)==="update"&&$.latestVersion?`更新到 v${$.latestVersion}`:($==null?void 0:$.state)==="remote-only"&&$.latestVersion?`安装 v${$.latestVersion}`:"重装";return a.jsxs("div",{className:"af-set-skillhub-item",children:[a.jsxs("div",{children:[a.jsx("div",{className:"af-set-skillhub-title",children:R.displayName||R.name}),a.jsx("div",{className:"af-set-skillhub-meta",children:NM(R)}),a.jsx("div",{className:"af-set-skillhub-version-row",children:$?$.state==="update"?a.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--warn",children:["可更新 ",$.installedVersion?`v${$.installedVersion} -> `:"","v",$.latestVersion]}):$.state==="current"?a.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--ok",children:["已最新 v",$.latestVersion||$.installedVersion]}):$.state==="remote-only"?a.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:["远端 v",$.latestVersion,",本地版本未知"]}):$.state==="missing"?a.jsx("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:"未找到远端匹配项"}):$.state==="error"?a.jsx("span",{className:"af-set-skillhub-version af-set-skillhub-version--err",children:"检查失败"}):a.jsx("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:"状态未知"}):a.jsx("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:"未检查远端版本"})})]}),a.jsxs("div",{className:"af-set-skillhub-actions",children:[a.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>A(R.name,!0),disabled:!t||!!k||!P,children:L}),a.jsx("button",{type:"button",className:"af-set-btn-mini af-set-btn-mini--danger",onClick:()=>W(R.name),disabled:!t||!!k,children:"卸载"})]})]},`${R.agent}:${R.path}:${R.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:d.length})]}),a.jsx("div",{className:"af-set-skillhub-list",children:d.length===0?a.jsx("div",{className:"af-set-skillhub-empty",children:"输入关键词后搜索 SkillHub"}):d.map(R=>{const $=R.slug||R.name,P=R.kind==="collection"||R.collection,L=!P&&s.some(T=>T.name===$||T.name===R.name);return a.jsxs("div",{className:"af-set-skillhub-item",children:[a.jsxs("div",{children:[a.jsx("div",{className:"af-set-skillhub-title",children:R.name||$}),a.jsxs("div",{className:"af-set-skillhub-meta",children:[P?`collection:${R.collection}`:$,R.skillId?` · id:${R.skillId}`:"",R.version?` · ${R.version}`:""]}),R.summary?a.jsx("p",{className:"af-set-skillhub-summary",children:R.summary}):null]}),a.jsx("button",{type:"button",className:L?"af-set-btn-mini":"af-set-btn-add af-set-btn-add--compact",onClick:()=>A(R,L),disabled:!t||!!k,children:L?"更新":P?"安装合集":"安装"})]},R.id||$)})})]})]})]})}function Mo(e){return(Array.isArray(e==null?void 0:e.collections)?e.collections:[]).filter(n=>n&&typeof n=="object").map(n=>({id:String(n.id||n.name||"").trim(),name:String(n.name||n.id||"").trim(),skillKeys:Array.from(new Set((Array.isArray(n.skillKeys)?n.skillKeys:[]).map(r=>String(r||"").trim()).filter(Boolean))),builtin:!!n.builtin,createdAt:Number.isFinite(n.createdAt)?Number(n.createdAt):Date.now(),updatedAt:Number.isFinite(n.updatedAt)?Number(n.updatedAt):Date.now()})).filter(n=>n.id&&n.name)}function CM(e){return{version:1,collections:Mo({collections:e})}}function EM(e){const t=String(e||"").trim(),n=t.indexOf(":");return n>=0?t.slice(n+1).trim():t}function CC(e){const t=new Map,n=new Map;for(const r of Array.isArray(e)?e:[])r!=null&&r.key&&t.set(r.key,r.key),r!=null&&r.name&&(r!=null&&r.key)&&!n.has(r.name)&&n.set(r.name,r.key);return r=>{const s=String(r||"").trim();return s&&(t.get(s)||n.get(EM(s)))||""}}function dl(e,t){const n=CC(t);return Array.from(new Set((Array.isArray(e==null?void 0:e.skillKeys)?e.skillKeys:[]).map(r=>n(r)).filter(Boolean)))}function _M(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 PM(e,t){const n=new Set(Array.isArray(t)?t:[]);return(Array.isArray(e)?e:[]).filter(r=>!n.has(r))}function AM(e,t,n){const r=dl(e,n);if(r.length===0)return"empty";const s=r.filter(i=>t.has(i)).length;return s===0?"none":s===r.length?"all":"partial"}function IM(e,t,n){const r=String(e).trim().toLowerCase(),s=Mo({collections:n}).find(i=>i.id===r||i.name.toLowerCase()===r);return dl(s,t)}function TM(e,t,n,r){const s=(Array.isArray(n)?n:[]).map(u=>u.key).filter(Boolean),i=String(t).trim().toLowerCase(),o=Mo({collections:r}),l=IM(t,n,r),c=l.length>0?l:s;if(!e)return c;try{const u=localStorage.getItem(e);if(u!==null){const p=JSON.parse(u);if(Array.isArray(p)){const f=CC(n),d=Array.from(new Set(p.map(f).filter(Boolean)));if(s.length>0&&d.length===s.length)return c;const h=new Set(d),y=new Set(l),w=l.length>0&&l.every(g=>h.has(g)),k=o.some(g=>{if(!g.builtin||g.id===i||g.name.toLowerCase()===i)return!1;const b=dl(g,n);return b.length>0&&b.every(x=>h.has(x))});return l.length>0&&k&&!w?c:d}}}catch{}return c}function oc(e){return e==="builtin"?"af-proj-badge af-proj-badge--builtin":e==="secondary"?"af-proj-badge af-proj-badge--secondary":e==="primary"?"af-proj-badge af-proj-badge--primary":e==="muted"?"af-proj-badge af-proj-badge--muted":"af-proj-badge"}function RM(e){const t=e??"user";return t==="builtin"||t==="admin"?"af-project-card af-project-card--builtin":"af-project-card"}function MM(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 ry(e,t){return e==="builtin"?{label:t("project:sourceBadge.builtin"),tone:"builtin"}:e==="admin"?{label:t("project:sourceBadge.builtin"),tone:"builtin"}:e==="workspace"?{label:t("project:sourceBadge.workspace"),tone:"secondary"}:{label:t("project:sourceBadge.user"),tone:"primary"}}function EC(e){const t=e.source??"user";return t==="builtin"?`builtin/pipelines / ${e.id}`:t==="admin"?`admin builtin / ${e.ownerUserId||"-"} / ${e.id}`:t==="workspace"?e.archived?`.workspace/agentflow/pipelines/_archived / ${e.id}`:`.workspace/agentflow/pipelines / ${e.id}`:e.archived?`~/agentflow/pipelines/_archived / ${e.id}`:`~/agentflow/pipelines / ${e.id}`}const LM="project:defaultCardDesc";function _C(e,t){const n=e.description!=null?String(e.description).trim():"";return n!==""?n:t(LM)}function $M(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function hn({children:e,className:t="",query:n}){const r=n.trim(),s=String(e);if(!r)return a.jsx("span",{className:t,children:s});const i=new RegExp(`(${$M(r)})`,"gi"),o=s.split(i);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 OM(e,t,n){const r=[String(e.id),_C(e,n),EC(e),ry(e.source,n).label];return e.archived&&r.push(n("project:archived")),r.join(`
41
- `).toLowerCase()}function DM(e,t,n){return t?OM(e,t,n).includes(t):!0}function FM(e,t){const n=e.trim().toLowerCase();if(!n)return!0;const r=String(t.flowId).toLowerCase(),s=String(t.flowSource??"user").toLowerCase();return r.includes(n)||s.includes(n)}function mm(e,t){const n=e.trim().toLowerCase();return n?t.filter(Boolean).join(`
42
- `).toLowerCase().includes(n):!0}function C0(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 E0(e){return e!=null&&e.packageDir?e.packageDir:`marketplace/flow-snippets / ${(e==null?void 0:e.id)||""}`}const zM=["all","agent","control","provide","marketplace"],HM=["all","agent","control","provide"],PC="agentflow.projects.activityPanelOpen",sy="agentflow.projects.activitySelected";function BM(){if(typeof localStorage>"u")return!0;const e=localStorage.getItem(PC);return e!=="0"}function _0(e){return`${(e==null?void 0:e.flowSource)||"user"}:${(e==null?void 0:e.flowId)||""}`}function WM(){return typeof localStorage>"u"?"":localStorage.getItem(sy)||""}function Md(e){return!e||typeof e!="object"?[]:Object.entries(e).map(([t,n])=>({key:t,...n&&typeof n=="object"?n:{}}))}function Qt(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 Ti(e){return`${(e==null?void 0:e.id)||""}:${(e==null?void 0:e.version)||""}:${(e==null?void 0:e.packageDir)||""}`}function AC(e){var n;const t=(n=e==null?void 0:e.snippet)==null?void 0:n.instances;return Array.isArray(t)?t.filter(r=>r&&typeof r=="object"):t&&typeof t=="object"?Object.entries(t).map(([r,s])=>({...s&&typeof s=="object"?s:{},instanceId:(s==null?void 0:s.instanceId)||r})):[]}function IC(e){var n;const t=(n=e==null?void 0:e.snippet)==null?void 0:n.edges;return Array.isArray(t)?t.filter(r=>r&&typeof r=="object"):[]}function iy(e,t){return String((e==null?void 0:e.instanceId)||(e==null?void 0:e.id)||(e==null?void 0:e.nodeId)||`node_${t+1}`)}function P0(e,t){return String((e==null?void 0:e.label)||(e==null?void 0:e.displayName)||(e==null?void 0:e.name)||iy(e,t))}function VM(e){return String((e==null?void 0:e.definitionId)||(e==null?void 0:e.type)||(e==null?void 0:e.runtimeType)||"").replace(/^marketplace:/,"")}function A0(e,t){return String(t==="source"?(e==null?void 0:e.source)||(e==null?void 0:e.from)||(e==null?void 0:e.sourceId)||(e==null?void 0:e.fromNode)||(e==null?void 0:e.fromInstanceId)||"":(e==null?void 0:e.target)||(e==null?void 0:e.to)||(e==null?void 0:e.targetId)||(e==null?void 0:e.toNode)||(e==null?void 0:e.toInstanceId)||"")}function KM(e){const t=(e==null?void 0:e.sourceHandle)||(e==null?void 0:e.fromHandle)||(e==null?void 0:e.output)||(e==null?void 0:e.outputName),n=(e==null?void 0:e.targetHandle)||(e==null?void 0:e.toHandle)||(e==null?void 0:e.input)||(e==null?void 0:e.inputName);return t&&n?`${t} -> ${n}`:String(t||n||"")}function gm(e,t=16){const n=String(e||"").trim();return n.length<=t?n:`${n.slice(0,t-1)}…`}function UM(e){const t=Number(e==null?void 0:e.x),n=Number(e==null?void 0:e.y);return!Number.isFinite(t)||!Number.isFinite(n)?null:{x:t,y:n}}function qM(e,t){const n=e.map(p=>p.id),r=new Set(n),s=new Map(n.map(p=>[p,0])),i=new Map(n.map(p=>[p,[]]));t.forEach(p=>{var f;!r.has(p.sourceId)||!r.has(p.targetId)||(s.set(p.targetId,(s.get(p.targetId)||0)+1),(f=i.get(p.sourceId))==null||f.push(p.targetId))});const o=new Map,l=n.filter(p=>(s.get(p)||0)===0);l.length===0&&n[0]&&l.push(n[0]),l.forEach(p=>o.set(p,0));for(let p=0;p<l.length;p+=1){const f=l[p],d=(o.get(f)||0)+1;for(const h of i.get(f)||[])(!o.has(h)||d>o.get(h))&&(o.set(h,d),l.push(h))}n.forEach((p,f)=>{o.has(p)||o.set(p,f%3)});const c=new Map,u=new Map;return n.forEach(p=>{const f=o.get(p)||0,d=c.get(f)||0;c.set(f,d+1),u.set(p,{x:f*190,y:d*86})}),u}function YM(e){var w,k,g,b;const t=AC(e),n=IC(e),r=new Map(t.map((x,S)=>[iy(x,S),P0(x,S)])),s=t.map((x,S)=>({id:iy(x,S),title:P0(x,S),meta:VM(x)})),i=n.map((x,S)=>{const C=A0(x,"source"),j=A0(x,"target");return{key:(x==null?void 0:x.id)||`${C}-${j}-${S}`,sourceId:C,targetId:j,source:r.get(C)||C||"?",target:r.get(j)||j||"?",label:KM(x)}}),o=(k=(w=e==null?void 0:e.snippet)==null?void 0:w.ui)!=null&&k.nodePositions&&typeof e.snippet.ui.nodePositions=="object"?e.snippet.ui.nodePositions:{},l=(b=(g=e==null?void 0:e.snippet)==null?void 0:g.ui)!=null&&b.nodeSizes&&typeof e.snippet.ui.nodeSizes=="object"?e.snippet.ui.nodeSizes:{},c=qM(s,i),u=s.map(x=>{const S=UM(o[x.id])||c.get(x.id)||{x:0,y:0},C=l[x.id]&&typeof l[x.id]=="object"?l[x.id]:{},j=Number(C.width),E=Number(C.height),A=Math.max(132,Math.min(210,Number.isFinite(j)?j*.62:150)),D=Math.max(48,Math.min(76,Number.isFinite(E)?E*.46:54));return{...x,x:S.x,y:S.y,width:A,height:D}}),p=new Map(u.map(x=>[x.id,x])),f=i.map(x=>{const S=p.get(x.sourceId),C=p.get(x.targetId);if(!S||!C)return null;const j=S.x+S.width,E=S.y+S.height/2,A=C.x,D=C.y+C.height/2,W=Math.max(48,Math.abs(A-j)*.45);return{...x,path:`M ${j} ${E} C ${j+W} ${E}, ${A-W} ${D}, ${A} ${D}`,labelX:(j+A)/2,labelY:(E+D)/2}}).filter(Boolean),d=u.reduce((x,S)=>({minX:Math.min(x.minX,S.x),minY:Math.min(x.minY,S.y),maxX:Math.max(x.maxX,S.x+S.width),maxY:Math.max(x.maxY,S.y+S.height)}),{minX:0,minY:0,maxX:420,maxY:220}),h=36,y=`${d.minX-h} ${d.minY-h} ${Math.max(360,d.maxX-d.minX+h*2)} ${Math.max(180,d.maxY-d.minY+h*2)}`;return{nodes:s,edges:i,diagram:{nodes:u,edges:f,viewBox:y}}}function ba({resourceKind:e="",authUser:t=null}){var Ei,na,ra,os,as,po;const{t:n}=dr(),{navigate:r,path:s}=Js(),i=!!(t!=null&&t.isAdmin),[o,l]=m.useState(e||"all"),[c,u]=m.useState([]),[p,f]=m.useState([]),[d,h]=m.useState([]),[y,w]=m.useState([]),[k,g]=m.useState([]),[b,x]=m.useState(""),[S,C]=m.useState(!1),[j,E]=m.useState([]),[A,D]=m.useState(""),[W,F]=m.useState(""),[R,$]=m.useState(!1),[P,L]=m.useState(!1),[T,O]=m.useState(!1),[I,H]=m.useState(null),[_,Y]=m.useState(!1),[U,V]=m.useState(""),[Z,ue]=m.useState(BM),[le,we]=m.useState(WM),[re,ye]=m.useState("all"),[te,ie]=m.useState(""),[ce,pe]=m.useState("overview"),[De,He]=m.useState({}),[Ie,et]=m.useState(""),[ut,Ae]=m.useState({}),[Qe,qt]=m.useState(""),[Te,Ht]=m.useState(""),[st,dn]=m.useState({}),[ne,me]=m.useState(""),[Oe,Fe]=m.useState(""),[Ve,Et]=m.useState(""),[Lt,tt]=m.useState(""),[fn,kt]=m.useState(""),[Nt,tn]=m.useState(!1),[nn,tr]=m.useState(""),[Fn,Vn]=m.useState({hiddenBuiltins:[],promoted:[]}),gn=m.useRef(0),Yt=m.useRef(0),kn=m.useRef(0),yn=m.useCallback(async()=>{var ae,je;const B=++Yt.current;D("");try{const Ne=await fetch("/api/flows");if(B!==Yt.current)return;if(!Ne.ok)throw new Error("HTTP "+Ne.status);const We=await Ne.json();if(B!==Yt.current)return;u(Array.isArray(We)?We:[])}catch(Ne){if(B!==Yt.current)return;u([]),D(String(Ne.message||Ne))}try{const Ne=await fetch("/api/pipeline-recent-runs");if(B!==Yt.current)return;if(Ne.ok){const We=await Ne.json();if(B!==Yt.current)return;E(Array.isArray(We.runs)?We.runs:[])}else E([])}catch{if(B!==Yt.current)return;E([])}if(t!=null&&t.isAdmin)try{const Ne=await fetch("/api/admin/builtin-flows");if(B!==Yt.current)return;const We=await Ne.json().catch(()=>({}));Ne.ok&&Vn({hiddenBuiltins:Array.isArray((ae=We==null?void 0:We.config)==null?void 0:ae.hiddenBuiltins)?We.config.hiddenBuiltins:[],promoted:Array.isArray((je=We==null?void 0:We.config)==null?void 0:je.promoted)?We.config.promoted:[]})}catch{if(B!==Yt.current)return;Vn({hiddenBuiltins:[],promoted:[]})}else Vn({hiddenBuiltins:[],promoted:[]});$(!0)},[t==null?void 0:t.isAdmin]),Sn=m.useCallback(async(B,ae)=>{if(!(t!=null&&t.isAdmin)||!(B!=null&&B.id))return;const je=`${ae}:${B.source}:${B.id}`;tr(je),D("");try{const Ne=await fetch("/api/admin/builtin-flows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:ae,flowId:B.id,ownerUserId:B.ownerUserId||t.userId})}),We=await Ne.json().catch(()=>({}));if(!Ne.ok)throw new Error(We.error||"更新内置配置失败");await yn()}catch(Ne){D(String(Ne.message||Ne))}finally{tr("")}},[t==null?void 0:t.isAdmin,t==null?void 0:t.userId,yn]),Nn=m.useCallback(async()=>{const B=++kn.current;F(""),L(!1);const ae=e==="my-nodes"?"/api/nodes?scope=owned":"/api/nodes",je=e==="my-flows"?"/api/marketplace/flow-snippets?scope=owned":"/api/marketplace/flow-snippets";f([]),w([]),ie("");try{const[Ne,We,Mt,yt]=await Promise.all([fetch(ae),fetch("/api/skills"),fetch("/api/skill-collections"),fetch(je)]),_n=await Ne.json().catch(()=>({})),ls=await We.json().catch(()=>({})),ho=await Mt.json().catch(()=>({})),_i=await yt.json().catch(()=>({}));if(!Ne.ok)throw new Error(_n.error||"Nodes HTTP "+Ne.status);if(!We.ok)throw new Error(ls.error||"Skills HTTP "+We.status);if(!Mt.ok)throw new Error(ho.error||"Collections HTTP "+Mt.status);if(!yt.ok)throw new Error(_i.error||"Flow snippets HTTP "+yt.status);if(B!==kn.current)return;f(Array.isArray(_n.nodes)?_n.nodes:Array.isArray(_n)?_n:[]),h(Array.isArray(ls.skills)?ls.skills:[]),g(Mo(ho)),w(Array.isArray(_i.snippets)?_i.snippets:[])}catch(Ne){if(B!==kn.current)return;f([]),h([]),w([]),g([]),F(String(Ne.message||Ne))}finally{if(B!==kn.current)return;L(!0)}},[e]);m.useEffect(()=>{$(!1),yn(),Nn()},[yn,Nn]),m.useEffect(()=>{try{localStorage.setItem(PC,Z?"1":"0")}catch{}},[Z]),m.useEffect(()=>{try{le?localStorage.setItem(sy,le):localStorage.removeItem(sy)}catch{}},[le]),m.useEffect(()=>{let B=!1;return fetch("/api/ui-context").then(ae=>ae.json()).then(ae=>{B||tn(!!ae.hideCommunityLinks)}).catch(()=>{}),()=>{B=!0}},[]);const Kn=m.useCallback(async B=>{if(!i)return;const ae=Mo({collections:B});C(!0),F("");try{const je=await fetch("/api/skill-collections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(CM(ae))}),Ne=await je.json().catch(()=>({}));if(!je.ok)throw new Error(Ne.error||"Collections HTTP "+je.status);g(Mo(Ne))}catch(je){F(String(je.message||je))}finally{C(!1)}},[i]),ns=m.useCallback(()=>{if(!i)return;const B=b.trim();if(!B)return;const ae=B.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"collection",je=new Set(k.map(yt=>yt.id));let Ne=ae,We=2;for(;je.has(Ne);)Ne=`${ae}-${We++}`;const Mt=Date.now();Kn([...k,{id:Ne,name:B,skillKeys:[],createdAt:Mt,updatedAt:Mt}]),x(""),ye(`collection:${Ne}`)},[i,b,Kn,k]),Un=m.useCallback(B=>{if(!i)return;const ae=k.find(Ne=>Ne.id===B);if(ae!=null&&ae.builtin)return;const je=k.filter(Ne=>Ne.id!==B);re===`collection:${B}`&&ye("all"),Kn(je)},[i,re,Kn,k]),fr=m.useCallback((B,ae,je)=>{if(!i)return;const Ne=String(ae||"").trim();if(!Ne)return;const We=Date.now(),Mt=k.map(yt=>{if(yt.id!==B)return yt;const _n=new Set(yt.skillKeys||[]);return je?_n.add(Ne):_n.delete(Ne),{...yt,skillKeys:Array.from(_n),updatedAt:We}});Kn(Mt)},[i,Kn,k]),Wr=m.useCallback(async B=>{const ae=B==null?void 0:B.packageId,je=B==null?void 0:B.version;if(!ae||!je||!window.confirm(n("project:deleteMyNodeConfirm",{id:ae,version:je})))return;const Ne=Qt(B);Fe(Ne),Et(""),F("");try{const We=new URLSearchParams({id:ae,version:je}),Mt=await fetch(`/api/marketplace/node?${We.toString()}`,{method:"DELETE"}),yt=await Mt.json().catch(()=>({}));if(!Mt.ok||(yt==null?void 0:yt.ok)===!1){const _n=Array.isArray(yt==null?void 0:yt.usage)&&yt.usage.length>0?` ${n("project:deleteMyNodeUsedBy",{count:yt.usage.length})}`:"";throw new Error(((yt==null?void 0:yt.error)||"Delete failed")+_n)}Et(n("project:deleteMyNodeSuccess",{id:ae,version:je})),Ae(_n=>{const ls={..._n};return delete ls[Ne],ls}),dn(_n=>{const ls={};for(const[ho,_i]of Object.entries(_n))ho.startsWith(`${Ne}:`)||(ls[ho]=_i);return ls}),ie(""),await Nn()}catch(We){Et(String(We.message||We))}finally{Fe("")}},[Nn,n]),Vr=m.useCallback(async B=>{const ae=B==null?void 0:B.id,je=(B==null?void 0:B.version)||"1.0.0";if(!ae||!je||!window.confirm(n("project:deleteMyFlowConfirm",{id:ae,version:je})))return;const Ne=Ti(B);tt(Ne),kt(""),F("");try{const We=new URLSearchParams({id:ae,version:je}),Mt=await fetch(`/api/marketplace/flow-snippet?${We.toString()}`,{method:"DELETE"}),yt=await Mt.json().catch(()=>({}));if(!Mt.ok||(yt==null?void 0:yt.ok)===!1)throw new Error((yt==null?void 0:yt.error)||"Delete failed");kt(n("project:deleteMyFlowSuccess",{id:ae,version:je})),ie(""),await Nn()}catch(We){kt(String(We.message||We))}finally{tt("")}},[Nn,n]);m.useEffect(()=>{if(e==="nodes"||e==="my-nodes"||e==="my-flows"||e==="skills"){l(e),ye("all"),ie(""),pe("overview");return}l(B=>B==="archived"?"archived":"all")},[e]),m.useEffect(()=>{if(s!=="/projects"&&s!=="/")return;const B=new URLSearchParams(window.location.search),ae=B.get("tab");let je=!1;if(ae==="nodes"){r("/nodes");return}if(ae==="my-nodes"){r("/my-nodes");return}if(ae==="my-flows"){r("/my-flows");return}if(ae==="skills"){r("/skills");return}if(ae==="archived"?(l("archived"),B.delete("tab"),je=!0):ae&&(l("all"),B.delete("tab"),je=!0),B.get("new")==="1"&&(O(!0),B.delete("new"),je=!0),je){const Ne=B.toString();window.history.replaceState({},"",Ne?`/projects?${Ne}`:"/projects")}},[s,r]);const jr=m.useMemo(()=>H2(j,F2(),c),[j,c,s]),rs=m.useMemo(()=>jr.filter(B=>FM(U,B)),[jr,U]),an=U.trim().toLowerCase(),Cr=m.useMemo(()=>o==="archived"?c.filter(B=>B.archived):c.filter(B=>!B.archived),[c,o]),ee=m.useMemo(()=>Cr.filter(B=>DM(B,an,n)),[Cr,an,n]),be=m.useMemo(()=>new Set((Fn.promoted||[]).map(B=>String((B==null?void 0:B.id)||"").trim()).filter(Boolean)),[Fn.promoted]),Q=m.useMemo(()=>(Fn.hiddenBuiltins||[]).map(B=>String(B||"").trim()).filter(Boolean),[Fn.hiddenBuiltins]),oe=o==="nodes"||o==="my-nodes",Pe=o==="my-nodes",Be=o==="my-flows",jt=m.useMemo(()=>p.filter(B=>Pe&&B.source!=="marketplace"?!1:(re==="all"||(re==="marketplace"?B.source==="marketplace":B.type===re))&&mm(U,[B.id,B.label,B.displayName,B.description,B.type,B.source,B.packageId,B.version])),[p,Pe,U,re]),jn=m.useMemo(()=>{const B=new Map;for(const ae of k)B.set(ae.id,new Set(ae.skillKeys||[]));return B},[k]),nr=m.useMemo(()=>[{id:"all",label:"全部"},...k.map(B=>({id:`collection:${B.id}`,label:B.name,count:B.skillKeys.length,collection:B})),{id:"ungrouped",label:"未分组"}],[k]),Cn=m.useMemo(()=>d.filter(B=>{var Ne;const ae=Qt(B);let je=re==="all";if(re.startsWith("collection:")){const We=re.slice(11);je=!!((Ne=jn.get(We))!=null&&Ne.has(ae))}else re==="ungrouped"&&(je=!Array.from(jn.values()).some(We=>We.has(ae)));return je&&mm(U,[B.name,B.id,B.description,B.sourceLabel,B.source,B.path])}),[d,U,re,jn]),Mn=m.useMemo(()=>y.filter(B=>mm(U,[B.id,B.name,B.displayName,B.description,B.version,B.packageDir,Array.isArray(B.tags)?B.tags.join(" "):""])),[y,U]),xn=oe||Be||o==="skills",ze=m.useMemo(()=>jt.find(B=>Qt(B)===te)||jt[0]||null,[jt,te]),Rt=m.useMemo(()=>Cn.find(B=>Qt(B)===te)||Cn[0]||null,[Cn,te]),Ce=m.useMemo(()=>Mn.find(B=>Ti(B)===te)||Mn[0]||null,[Mn,te]),En=Rt?De[Qt(Rt)]:null,Ke=ze?ut[Qt(ze)]:null,Er=ze&&Te?st[`${Qt(ze)}:${Te}`]:null,ss=n(oe?"project:searchNodes":Be?"project:searchFlows":o==="skills"?"project:searchSkills":"project:searchPipelines");m.useEffect(()=>{if(o!=="skills"||!Rt)return;const B=Qt(Rt);if(De[B])return;let ae=!1;return et(B),fetch(`/api/skills/detail?key=${encodeURIComponent(B)}`).then(je=>je.json().then(Ne=>({ok:je.ok,json:Ne}))).then(({ok:je,json:Ne})=>{ae||je&&Ne.skill&&He(We=>({...We,[B]:Ne.skill}))}).catch(()=>{}).finally(()=>{ae||et("")}),()=>{ae=!0}},[o,Rt,De]),m.useEffect(()=>{if(!oe||!ze)return;const B=Qt(ze);if(ut[B])return;let ae=!1;return qt(B),fetch(`/api/nodes/detail?id=${encodeURIComponent(ze.id)}`).then(je=>je.json().then(Ne=>({ok:je.ok,json:Ne}))).then(({ok:je,json:Ne})=>{ae||je&&Ae(We=>({...We,[B]:Ne}))}).catch(()=>{}).finally(()=>{ae||qt("")}),()=>{ae=!0}},[oe,ze,ut]),m.useEffect(()=>{if(!oe)return;const B=Array.isArray(Ke==null?void 0:Ke.files)?Ke.files:[];Ht(ae=>{var je;return ae&&B.some(Ne=>Ne.path===ae)?ae:((je=B[0])==null?void 0:je.path)||""})},[oe,Ke]),m.useEffect(()=>{if(!oe||!ze||!Te)return;const B=`${Qt(ze)}:${Te}`;if(st[B])return;let ae=!1;return me(B),fetch(`/api/nodes/file?id=${encodeURIComponent(ze.id)}&path=${encodeURIComponent(Te)}`).then(je=>je.json().then(Ne=>({ok:je.ok,json:Ne}))).then(({ok:je,json:Ne})=>{ae||je&&dn(We=>({...We,[B]:Ne}))}).catch(()=>{}).finally(()=>{ae||me("")}),()=>{ae=!0}},[oe,ze,Te,st]),m.useEffect(()=>{Et("")},[te,o]);const is=B=>{r(Rd(B,"workspace"))},fo=B=>{we(_0(B)),r(Rd({id:B.flowId,source:B.flowSource,archived:!!B.archived},"workspace"))},ta=m.useCallback(B=>{var ae,je;B.preventDefault(),B.stopPropagation(),(je=(ae=B.dataTransfer)==null?void 0:ae.types)!=null&&je.includes("Files")&&(gn.current+=1,Y(!0))},[]),$l=m.useCallback(B=>{B.preventDefault(),B.stopPropagation(),gn.current-=1,gn.current<=0&&(gn.current=0,Y(!1))},[]),ke=m.useCallback(B=>{B.preventDefault(),B.stopPropagation()},[]),Ol=m.useCallback(B=>{var Ne,We;B.preventDefault(),B.stopPropagation(),gn.current=0,Y(!1);const ae=(We=(Ne=B.dataTransfer)==null?void 0:Ne.files)==null?void 0:We[0];if(!ae)return;const je=ae.name.toLowerCase();!je.endsWith(".yaml")&&!je.endsWith(".yml")&&!je.endsWith(".zip")||H(ae)},[]);return a.jsxs("div",{className:"af-projects"+(_?" af-projects--drop-target":""),onDragEnter:ta,onDragLeave:$l,onDragOver:ke,onDrop:Ol,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:o==="all"?"af-tab af-tab--active":"af-tab",onClick:()=>l("all"),children:n("project:all")}),a.jsx("button",{type:"button",className:o==="archived"?"af-tab af-tab--active":"af-tab",onClick:()=>l("archived"),children:n("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"+(U.trim()?" af-search--has-clear":""),type:"search",placeholder:ss,"aria-label":ss,autoComplete:"off",value:U,onChange:B=>V(B.target.value),onKeyDown:B=>{B.key==="Escape"&&(V(""),B.currentTarget.blur())}}),U.trim()?a.jsx("button",{type:"button",className:"af-search-clear","aria-label":"Clear search",onClick:()=>V(""),children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),xn?a.jsx("button",{type:"button",className:"af-btn-primary af-create-btn",onClick:()=>Nn(),children:n("project:refreshResources")}):a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"af-icon-btn"+(Z?" af-icon-btn--active":""),"aria-label":n("flow:palette.toggleRecentActivity"),"aria-expanded":Z,"aria-controls":"af-recent-activity-panel",onClick:()=>ue(B=>!B),children:a.jsx("span",{className:"material-symbols-outlined",children:"notifications"})}),a.jsx("button",{type:"button",className:"af-btn-primary af-create-btn",onClick:()=>O(!0),children:n("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:n(o==="my-nodes"?"project:myNodes":o==="my-flows"?"project:myFlows":o==="nodes"?"project:globalNodes":o==="skills"?"project:globalSkills":o==="archived"?"project:archivedPipelines":"project:activeProjects")}),a.jsx("p",{className:"af-projects-sub",children:an?n("project:filterResult",{count:o==="nodes"||o==="my-nodes"?jt.length:o==="my-flows"?Mn.length:o==="skills"?Cn.length:ee.length}):o==="my-nodes"?n("project:myNodesHint",{count:jt.length}):o==="my-flows"?n("project:myFlowsHint",{count:Mn.length}):o==="nodes"?n("project:nodesHint",{count:p.length}):o==="skills"?n("project:skillsHint",{count:d.length}):n(o==="archived"?"project:archivedHint":"project:activeHint")}),A?a.jsx("p",{className:"af-err af-projects-api-hint",children:A}):null,W&&xn?a.jsx("p",{className:"af-err af-projects-api-hint",children:W}):null]}),xn?a.jsxs("div",{className:"af-resource-toolbar",children:[o==="skills"?a.jsx(jM,{onChanged:Nn,canManage:!!(t!=null&&t.isAdmin)}):null,a.jsxs("div",{className:"af-resource-purpose",children:[a.jsx("span",{className:"material-symbols-outlined",children:Be?"schema":oe?Pe?"deployed_code":"account_tree":"extension"}),a.jsxs("div",{children:[a.jsx("h3",{children:n(Be?"project:myFlowsPurposeTitle":Pe?"project:myNodesPurposeTitle":oe?"project:nodesPurposeTitle":"project:skillsPurposeTitle")}),a.jsx("p",{children:n(Be?"project:myFlowsPurposeDesc":Pe?"project:myNodesPurposeDesc":oe?"project:nodesPurposeDesc":"project:skillsPurposeDesc")})]})]}),Be?null:a.jsx("div",{className:"af-resource-filter-row",children:(oe?(Pe?HM:zM).map(B=>({id:B,label:n(`project:resourceFilter.${B}`)})):nr).map(B=>B.collection?a.jsxs("span",{className:"af-resource-filter-chip"+(re===B.id?" af-resource-filter-chip--active":""),children:[a.jsxs("button",{type:"button",className:"af-resource-filter af-resource-filter--embedded",onClick:()=>{ye(B.id),ie("")},children:[B.label,a.jsx("em",{children:B.count}),B.collection.builtin?a.jsx("strong",{children:"built-in"}):null]}),i&&!B.collection.builtin?a.jsx("button",{type:"button",className:"af-resource-filter-chip__delete",disabled:S,"aria-label":`删除 ${B.collection.name}`,onClick:()=>Un(B.collection.id),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})}):null]},B.id):a.jsx("button",{type:"button",className:"af-resource-filter"+(re===B.id?" af-resource-filter--active":""),onClick:()=>{ye(B.id),ie("")},children:B.label},B.id))}),o==="skills"&&i?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:b,onChange:B=>x(B.target.value),onKeyDown:B=>{B.key==="Enter"&&ns()},placeholder:"新建 skill collection"}),a.jsxs("button",{type:"button",className:"af-set-btn-add af-set-btn-add--compact",disabled:!b.trim()||S,onClick:()=>ns(),children:[a.jsx("span",{className:"material-symbols-outlined",children:"add"}),"新建"]})]})}):null]}):null,oe?a.jsx("div",{className:"af-resource-grid",children:jt.length>0?jt.map(B=>a.jsxs("button",{type:"button",className:"af-resource-card"+(ze&&Qt(B)===Qt(ze)?" af-resource-card--active":""),onClick:()=>ie(Qt(B)),children:[a.jsxs("div",{className:"af-resource-card-head",children:[a.jsx("span",{className:oc(B.type==="control"?"secondary":B.type==="provide"?"primary":"muted"),children:a.jsx(hn,{query:U,children:B.type||"node"})}),a.jsx("span",{className:"af-resource-source",children:a.jsx(hn,{query:U,children:C0(B.source,n)})})]}),a.jsx("h3",{className:"af-project-title",children:a.jsx(hn,{query:U,children:B.label||B.displayName||B.id})}),a.jsx("p",{className:"af-project-desc",children:a.jsx(hn,{query:U,children:B.description||n("project:noDescription")})}),a.jsxs("div",{className:"af-resource-meta-row",children:[a.jsx("span",{children:a.jsx(hn,{query:U,children:B.id})}),a.jsx("span",{children:n("project:nodeSlots",{inputs:Object.keys(B.inputs||{}).length,outputs:Object.keys(B.outputs||{}).length})})]}),B.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(hn,{query:U,children:`${B.packageId}${B.version?` / ${B.version}`:""}`})})]}):null]},`${B.id}:${B.source||""}:${B.packageId||""}`)):P?a.jsx("div",{className:"af-projects-empty-block",children:a.jsx("p",{className:"af-projects-empty",children:an?n("project:noNodeMatch",{query:U.trim()}):n(Pe?"project:noMyNodes":"project:noNodes")})}):a.jsx("div",{className:"af-projects-empty-block",children:a.jsx("p",{className:"af-projects-empty",children:n("project:loadingResources")})})}):Be?a.jsx("div",{className:"af-resource-grid",children:Mn.length>0?Mn.map(B=>{const ae=AC(B),je=IC(B),Ne=Number.isFinite(Number(B.nodeCount))?Number(B.nodeCount):ae.length,We=Number.isFinite(Number(B.edgeCount))?Number(B.edgeCount):je.length;return a.jsxs("button",{type:"button",className:"af-resource-card"+(Ce&&Ti(B)===Ti(Ce)?" af-resource-card--active":""),onClick:()=>ie(Ti(B)),children:[a.jsxs("div",{className:"af-resource-card-head",children:[a.jsx("span",{className:oc("primary"),children:a.jsx(hn,{query:U,children:B.version?`v${B.version}`:"flow"})}),a.jsx("span",{className:"af-resource-source",children:n("project:flowSnippet")})]}),a.jsx("h3",{className:"af-project-title",children:a.jsx(hn,{query:U,children:B.displayName||B.name||B.id})}),a.jsx("p",{className:"af-project-desc",children:a.jsx(hn,{query:U,children:B.description||n("project:noDescription")})}),a.jsxs("div",{className:"af-resource-meta-row",children:[a.jsx("span",{children:n("project:flowSnippetNodes",{nodes:Ne,edges:We})}),a.jsx("span",{children:a.jsx(hn,{query:U,children:B.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(hn,{query:U,children:E0(B)})})]})]},Ti(B))}):P?a.jsx("div",{className:"af-projects-empty-block",children:a.jsx("p",{className:"af-projects-empty",children:an?n("project:noFlowSnippetMatch",{query:U.trim()}):n("project:noMyFlows")})}):a.jsx("div",{className:"af-projects-empty-block",children:a.jsx("p",{className:"af-projects-empty",children:n("project:loadingResources")})})}):o==="skills"?a.jsx("div",{className:"af-resource-grid",children:Cn.length>0?Cn.map(B=>a.jsxs("button",{type:"button",className:"af-resource-card"+(Rt&&Qt(B)===Qt(Rt)?" af-resource-card--active":""),onClick:()=>ie(Qt(B)),children:[a.jsxs("div",{className:"af-resource-card-head",children:[a.jsx("span",{className:oc(B.source==="builtin"?"muted":"primary"),children:a.jsx(hn,{query:U,children:B.sourceLabel||B.source||"skill"})}),a.jsx("span",{className:"af-resource-source",children:n("project:skill")})]}),a.jsx("h3",{className:"af-project-title",children:a.jsx(hn,{query:U,children:B.name||B.id})}),a.jsx("p",{className:"af-project-desc",children:a.jsx(hn,{query:U,children:B.description||n("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(hn,{query:U,children:B.path||B.key||""})})]}),a.jsxs("div",{className:"af-skill-card-collections",children:[k.filter(ae=>ae.skillKeys.includes(Qt(B))).slice(0,3).map(ae=>a.jsx("span",{children:ae.name},ae.id)),k.filter(ae=>ae.skillKeys.includes(Qt(B))).length===0?a.jsx("span",{className:"af-skill-card-collection-empty",children:"未分组"}):null]})]},B.key||`${B.source}:${B.name}`)):P?a.jsx("div",{className:"af-projects-empty-block",children:a.jsx("p",{className:"af-projects-empty",children:an?n("project:noSkillMatch",{query:U.trim()}):n("project:noSkills")})}):a.jsx("div",{className:"af-projects-empty-block",children:a.jsx("p",{className:"af-projects-empty",children:n("project:loadingResources")})})}):a.jsxs(a.Fragment,{children:[t!=null&&t.isAdmin&&o==="all"&&Q.length>0?a.jsxs("div",{className:"af-project-admin-panel",children:[a.jsxs("div",{children:[a.jsx("strong",{children:"已隐藏内置"}),a.jsx("span",{children:"这些包内置流水线不会出现在普通项目列表中。"})]}),a.jsx("div",{className:"af-project-admin-hidden-list",children:Q.map(B=>{const ae=nn===`show-builtin:builtin:${B}`;return a.jsxs("button",{type:"button",disabled:ae,onClick:()=>Sn({id:B,source:"builtin"},"show-builtin"),children:[a.jsx("span",{children:B}),a.jsx("em",{children:ae?"恢复中":"恢复"})]},B)})})]}):null,a.jsxs("div",{className:"af-project-grid",children:[ee.length>0?ee.map(B=>{const ae=(t==null?void 0:t.isAdmin)&&B.source==="user"&&!B.archived&&!be.has(B.id),je=(t==null?void 0:t.isAdmin)&&B.source==="admin",Ne=(t==null?void 0:t.isAdmin)&&B.source==="builtin",We=nn.endsWith(`:${B.source}:${B.id}`);return a.jsx("div",{className:RM(B.source),role:"button",tabIndex:0,onClick:()=>is(B),onKeyDown:Mt=>{(Mt.key==="Enter"||Mt.key===" ")&&(Mt.preventDefault(),is(B))},children:a.jsxs("div",{className:"af-project-card-body",children:[a.jsx("span",{className:oc(ry(B.source,n).tone),children:a.jsx(hn,{query:U,children:ry(B.source,n).label})}),B.archived?a.jsx("span",{className:oc("muted"),children:a.jsx(hn,{query:U,children:n("project:archived")})}):null,a.jsx("h3",{className:"af-project-title",children:a.jsx(hn,{query:U,children:B.id})}),a.jsx("p",{className:"af-project-desc",children:a.jsx(hn,{query:U,children:_C(B,n)})}),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(hn,{query:U,children:EC(B)})})]}),t!=null&&t.isAdmin?a.jsxs("div",{className:"af-project-admin-actions",onClick:Mt=>Mt.stopPropagation(),onKeyDown:Mt=>Mt.stopPropagation(),children:[ae?a.jsx("button",{type:"button",disabled:We,onClick:()=>Sn(B,"promote"),children:"设为内置"}):null,je?a.jsx("button",{type:"button",disabled:We,onClick:()=>Sn(B,"unpromote"),children:"取消内置"}):null,Ne?a.jsx("button",{type:"button",disabled:We,onClick:()=>Sn(B,"hide-builtin"),children:"隐藏内置"}):null]}):null]})},`${B.id}:${B.source??"user"}:${B.archived?"a":""}`)}):R?Cr.length===0?a.jsxs("div",{className:"af-projects-empty-block",children:[a.jsx("p",{className:"af-projects-empty",children:o==="archived"?n("project:noArchived"):c.length>0?n("project:noActive"):n(A?"project:loadFailed":"project:noPipelines")}),!A&&c.length===0&&o==="all"?a.jsx("p",{className:"af-projects-empty-hint",children:n("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:n("project:noMatch",{query:U.trim()})})}):a.jsx("div",{className:"af-projects-empty-block",children:a.jsx("p",{className:"af-projects-empty",children:n("project:loadingPipelines")})}),a.jsxs("button",{type:"button",className:"af-project-add",onClick:()=>O(!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:n("project:newPipeline")})]}),Nt?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"}),n("project:hubCard.eyebrow")]}),a.jsx("h3",{className:"af-hub-card__title",children:n("project:hubCard.title")}),a.jsx("p",{className:"af-hub-card__desc",children:n("project:hubCard.desc")}),a.jsxs("span",{className:"af-hub-card__cta",children:[n("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:n("project:hubCard.cliHint")})]})]})]})]}),xn?a.jsx("aside",{className:"af-resource-detail","aria-label":n(oe?"project:nodeDetail":Be?"project:flowDetail":"project:skillDetail"),children:oe&&ze?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:ze.label||ze.displayName||ze.id}),a.jsx("p",{children:ze.id})]})]}),a.jsx("div",{className:"af-resource-detail-tabs",children:["overview","schema","runtime","files","usage"].map(B=>a.jsx("button",{type:"button",className:"af-resource-detail-tab"+(ce===B?" af-resource-detail-tab--active":""),onClick:()=>pe(B),children:n(`project:nodeDetailTabs.${B}`)},B))}),Qe===Qt(ze)?a.jsx("p",{className:"af-resource-detail-desc",children:n("project:loadingResources")}):ce==="overview"?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"af-resource-detail-desc",children:ze.description||((Ei=Ke==null?void 0:Ke.node)==null?void 0:Ei.description)||n("project:noDescription")}),a.jsxs("dl",{className:"af-resource-detail-kv",children:[a.jsxs("div",{children:[a.jsx("dt",{children:n("project:detailType")}),a.jsx("dd",{children:ze.type||((na=Ke==null?void 0:Ke.node)==null?void 0:na.type)||"node"})]}),a.jsxs("div",{children:[a.jsx("dt",{children:n("project:detailSource")}),a.jsx("dd",{children:C0(ze.source,n)})]}),ze.packageId?a.jsxs("div",{children:[a.jsx("dt",{children:n("project:detailPackage")}),a.jsx("dd",{children:ze.packageId})]}):null,ze.version?a.jsxs("div",{children:[a.jsx("dt",{children:n("project:detailVersion")}),a.jsx("dd",{children:ze.version})]}):null,ze.packageDir||Ke!=null&&Ke.baseDir?a.jsxs("div",{children:[a.jsx("dt",{children:n("project:detailPath")}),a.jsx("dd",{children:ze.packageDir||(Ke==null?void 0:Ke.baseDir)})]}):null,a.jsxs("div",{children:[a.jsx("dt",{children:n("project:detailEditable")}),a.jsx("dd",{children:(Ke==null?void 0:Ke.readOnly)===!1?n("project:editable"):n("project:readOnly")})]})]}),Pe&&ze.source==="marketplace"?a.jsxs("div",{className:"af-resource-detail-section af-resource-danger-zone",children:[a.jsx("h4",{children:n("project:myNodeManagement")}),a.jsx("p",{children:n("project:deleteMyNodeHint")}),a.jsxs("button",{type:"button",className:"af-btn-secondary af-btn-danger",disabled:Oe===Qt(ze),onClick:()=>Wr(ze),children:[a.jsx("span",{className:"material-symbols-outlined",children:"delete"}),Oe===Qt(ze)?n("project:deletingMyNode"):n("project:deleteMyNode")]}),Ve?a.jsx("p",{className:"af-resource-action-message",children:Ve}):null]}):null,a.jsxs("div",{className:"af-resource-detail-section",children:[a.jsx("h4",{children:n("project:resourceMeaning")}),a.jsx("p",{children:n("project:nodesMeaning")})]})]}):ce==="schema"?a.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[a.jsx("h4",{children:n("project:nodeSchema")}),a.jsxs("div",{className:"af-resource-slot-group",children:[a.jsx("span",{children:n("project:nodeInputs")}),Md(((ra=Ke==null?void 0:Ke.node)==null?void 0:ra.inputs)||ze.inputs).length>0?Md(((os=Ke==null?void 0:Ke.node)==null?void 0:os.inputs)||ze.inputs).map(B=>a.jsxs("code",{children:[B.name||B.key,B.type?`: ${B.type}`:""]},B.key)):a.jsx("em",{children:n("project:noSlots")})]}),a.jsxs("div",{className:"af-resource-slot-group",children:[a.jsx("span",{children:n("project:nodeOutputs")}),Md(((as=Ke==null?void 0:Ke.node)==null?void 0:as.outputs)||ze.outputs).length>0?Md(((po=Ke==null?void 0:Ke.node)==null?void 0:po.outputs)||ze.outputs).map(B=>a.jsxs("code",{children:[B.name||B.key,B.type?`: ${B.type}`:""]},B.key)):a.jsx("em",{children:n("project:noSlots")})]})]}):ce==="runtime"?a.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[a.jsx("h4",{children:n("project:nodeRuntime")}),Ke!=null&&Ke.runtime?a.jsx("pre",{className:"af-resource-skill-preview",children:JSON.stringify(Ke.runtime,null,2)}):a.jsx("p",{children:n("project:noRuntimeManifest")}),Ke!=null&&Ke.body?a.jsxs(a.Fragment,{children:[a.jsx("h4",{className:"af-resource-detail-subtitle",children:n("project:nodeBody")}),a.jsx("pre",{className:"af-resource-skill-preview",children:Ke.body})]}):a.jsx("p",{children:n("project:noNodeBody")})]}):ce==="files"?a.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[a.jsx("h4",{children:n("project:nodeFiles")}),Array.isArray(Ke==null?void 0:Ke.files)&&Ke.files.length>0?a.jsxs("div",{className:"af-node-file-browser",children:[a.jsx("div",{className:"af-node-file-list",children:Ke.files.map(B=>a.jsxs("button",{type:"button",className:"af-node-file-item"+(Te===B.path?" af-node-file-item--active":""),onClick:()=>Ht(B.path),children:[a.jsx("span",{className:"material-symbols-outlined",children:"description"}),a.jsx("span",{children:B.path})]},B.path))}),a.jsxs("pre",{className:"af-resource-skill-preview",children:[ne===`${Qt(ze)}:${Te}`?n("project:loadingResources"):Er!=null&&Er.binary?n("project:binaryFile"):(Er==null?void 0:Er.content)||n("project:selectNodeFile"),Er!=null&&Er.truncated?`
43
-
44
- ${n("project:fileTruncated")}`:""]})]}):a.jsx("p",{children:n("project:noNodeFiles")})]}):a.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[a.jsx("h4",{children:n("project:nodeUsage")}),Array.isArray(Ke==null?void 0:Ke.usage)&&Ke.usage.length>0?a.jsx("div",{className:"af-node-usage-list",children:Ke.usage.map(B=>a.jsxs("div",{className:"af-node-usage-item",children:[a.jsx("strong",{children:B.flowId}),a.jsxs("span",{children:[B.flowSource,B.archived?` · ${n("project:archived")}`:""]}),a.jsx("em",{children:B.instances.map(ae=>ae.label||ae.instanceId).join(", ")})]},`${B.flowSource}:${B.flowId}:${B.archived?"a":""}`))}):a.jsx("p",{children:n("project:noNodeUsage")})]})]}):Be&&Ce?(()=>{const B=YM(Ce);return 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:Ce.displayName||Ce.name||Ce.id}),a.jsx("p",{children:Ce.id})]})]}),a.jsx("p",{className:"af-resource-detail-desc",children:Ce.description||n("project:noDescription")}),a.jsxs("dl",{className:"af-resource-detail-kv",children:[a.jsxs("div",{children:[a.jsx("dt",{children:n("project:detailVersion")}),a.jsx("dd",{children:Ce.version||"1.0.0"})]}),a.jsxs("div",{children:[a.jsx("dt",{children:n("project:detailPath")}),a.jsx("dd",{children:E0(Ce)})]}),a.jsxs("div",{children:[a.jsx("dt",{children:n("project:flowSnippetScale")}),a.jsx("dd",{children:n("project:flowSnippetNodes",{nodes:Number.isFinite(Number(Ce.nodeCount))?Number(Ce.nodeCount):B.nodes.length,edges:Number.isFinite(Number(Ce.edgeCount))?Number(Ce.edgeCount):B.edges.length})})]})]}),a.jsxs("div",{className:"af-resource-detail-section",children:[a.jsx("h4",{children:n("project:resourceMeaning")}),a.jsx("p",{children:n("project:myFlowsMeaning")})]}),a.jsxs("div",{className:"af-resource-detail-section af-resource-danger-zone",children:[a.jsx("h4",{children:n("project:myFlowManagement")}),a.jsx("p",{children:n("project:deleteMyFlowHint")}),a.jsxs("button",{type:"button",className:"af-btn-secondary af-btn-danger",disabled:Lt===Ti(Ce),onClick:()=>Vr(Ce),children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"delete"}),Lt===Ti(Ce)?n("project:deletingMyFlow"):n("project:deleteMyFlow")]}),fn?a.jsx("p",{className:"af-resource-action-message",children:fn}):null]}),a.jsxs("div",{className:"af-resource-detail-section",children:[a.jsx("h4",{children:n("project:flowSnippetPreview")}),B.diagram.nodes.length>0?a.jsx("div",{className:"af-flow-snippet-map",children:a.jsxs("svg",{viewBox:B.diagram.viewBox,role:"img","aria-label":n("project:flowSnippetPreview"),children:[a.jsx("defs",{children:a.jsx("marker",{id:"af-flow-snippet-arrow",markerWidth:"8",markerHeight:"8",refX:"7",refY:"4",orient:"auto",markerUnits:"strokeWidth",children:a.jsx("path",{d:"M 0 0 L 8 4 L 0 8 z"})})}),a.jsx("g",{className:"af-flow-snippet-map__edges",children:B.diagram.edges.map(ae=>a.jsxs("g",{children:[a.jsx("path",{d:ae.path}),ae.label?a.jsx("text",{x:ae.labelX,y:ae.labelY-5,textAnchor:"middle",children:gm(ae.label,18)}):null]},ae.key))}),a.jsx("g",{className:"af-flow-snippet-map__nodes",children:B.diagram.nodes.map((ae,je)=>a.jsxs("g",{transform:`translate(${ae.x} ${ae.y})`,children:[a.jsx("rect",{width:ae.width,height:ae.height,rx:"10"}),a.jsx("circle",{cx:"19",cy:ae.height/2,r:"12"}),a.jsx("text",{className:"af-flow-snippet-map__node-index",x:"19",y:ae.height/2+4,textAnchor:"middle",children:je+1}),a.jsx("text",{className:"af-flow-snippet-map__node-title",x:"40",y:ae.height/2-3,children:gm(ae.title)}),a.jsx("text",{className:"af-flow-snippet-map__node-meta",x:"40",y:ae.height/2+16,children:gm(ae.meta||ae.id,20)})]},ae.id))})]})}):a.jsx("p",{className:"af-resource-detail-desc",children:n("project:noFlowSnippetPreview")}),a.jsxs("details",{className:"af-flow-snippet-json",children:[a.jsx("summary",{children:n("project:flowSnippetJson")}),a.jsx("pre",{className:"af-resource-skill-preview",children:JSON.stringify(Ce.snippet||{},null,2)})]})]})]})})():o==="skills"&&Rt?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:Rt.name||Rt.id}),a.jsx("p",{children:Rt.sourceLabel||Rt.source})]})]}),a.jsx("p",{className:"af-resource-detail-desc",children:Rt.description||n("project:noDescription")}),a.jsxs("dl",{className:"af-resource-detail-kv",children:[a.jsxs("div",{children:[a.jsx("dt",{children:n("project:detailSource")}),a.jsx("dd",{children:Rt.sourceLabel||Rt.source})]}),a.jsxs("div",{children:[a.jsx("dt",{children:n("project:detailPath")}),a.jsx("dd",{children:Rt.path||Rt.key})]})]}),a.jsxs("div",{className:"af-resource-detail-section",children:[a.jsx("h4",{children:"Collections"}),k.length===0?a.jsx("p",{children:"暂无 collection。可在左侧新建后再添加。"}):a.jsx("div",{className:"af-skill-detail-collections",children:k.map(B=>{const ae=Qt(Rt),je=B.skillKeys.includes(ae);return a.jsxs("label",{className:"af-composer-skill-option af-skill-detail-collection-option",children:[a.jsx("input",{type:"checkbox",checked:je,disabled:S||!i,onChange:Ne=>fr(B.id,ae,Ne.target.checked)}),a.jsxs("span",{className:"af-composer-skill-option-main",children:[a.jsx("span",{className:"af-composer-skill-option-title",children:B.name}),a.jsxs("span",{className:"af-composer-skill-option-desc",children:[B.skillKeys.length," skills"]})]})]},B.id)})})]}),a.jsxs("div",{className:"af-resource-detail-section",children:[a.jsx("h4",{children:n("project:resourceMeaning")}),a.jsx("p",{children:n("project:skillsMeaning")})]}),a.jsxs("div",{className:"af-resource-detail-section",children:[a.jsx("h4",{children:n("project:skillPreview")}),a.jsx("pre",{className:"af-resource-skill-preview",children:Ie===Qt(Rt)?n("project:loadingResources"):(En==null?void 0:En.body)||(En==null?void 0:En.content)||n("project:skillPreviewEmpty")})]})]}):a.jsx("p",{className:"af-activity-empty",children:n("project:selectResource")})}):a.jsxs("aside",{id:"af-recent-activity-panel",className:"af-activity"+(Z?"":" af-activity--hidden"),"aria-hidden":!Z,"aria-label":n("project:recentActivity"),children:[a.jsxs("h2",{className:"af-activity-title",children:[a.jsx("span",{className:"af-activity-bullet"}),n("project:recentActivity")]}),a.jsx("div",{className:"af-activity-list",children:rs.length===0?a.jsx("p",{className:"af-activity-empty",children:jr.length===0?n("project:noRecentActivity"):n("project:noMatchRecent")}):rs.map(B=>{const ae=le===_0(B);return a.jsxs("button",{type:"button",className:"af-activity-row af-activity-row--action"+(ae?" af-activity-row--active":""),"aria-current":ae?"page":void 0,onClick:()=>fo(B),children:[a.jsxs("div",{className:"af-activity-row-top",children:[a.jsx("h4",{className:"af-activity-name",children:a.jsx(hn,{query:U,children:B.flowId})}),a.jsx("span",{className:"af-activity-time",children:N0(B.at,n)})]}),a.jsxs("div",{className:"af-activity-meta",children:[a.jsx("span",{className:MM(B.kind),children:B.kind==="executed"?"play_arrow":"visibility"}),a.jsxs("p",{className:"af-activity-text",children:[B.kind==="executed"?n("project:recentRun"):n("project:recentOpen")," · ",N0(B.at,n)]})]})]},`${B.kind}-${B.flowId}-${B.flowSource}-${B.at}`)})})]})]}),a.jsx(gM,{open:T,onClose:()=>O(!1),onCreated:async B=>{O(!1),await yn();const ae=B.source??"user";r(Rd({id:B.id,source:ae},"workspace"))}}),I?a.jsx(hM,{file:I,onClose:()=>H(null),onImported:async B=>{H(null),await yn();const ae=B.source??"user";r(Rd({id:B.id,source:ae},"workspace"))}},`${I.name}-${I.size}-${I.lastModified}`):null]})}function vn(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=vn(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var GM={value:()=>{}};function Xp(){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 kf(n)}function kf(e){this._=e}function XM(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",s=n.indexOf(".");if(s>=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}kf.prototype=Xp.prototype={constructor:kf,on:function(e,t){var n=this._,r=XM(e+"",n),s,i=-1,o=r.length;if(arguments.length<2){for(;++i<o;)if((s=(e=r[i]).type)&&(s=JM(n[s],e.name)))return s;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<o;)if(s=(e=r[i]).type)n[s]=I0(n[s],e.name,t);else if(t==null)for(s in n)n[s]=I0(n[s],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new kf(e)},call:function(e,t){if((s=arguments.length-2)>0)for(var n=new Array(s),r=0,s,i;r<s;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,s=i.length;r<s;++r)i[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],s=0,i=r.length;s<i;++s)r[s].value.apply(t,n)}};function JM(e,t){for(var n=0,r=e.length,s;n<r;++n)if((s=e[n]).name===t)return s.value}function I0(e,t,n){for(var r=0,s=e.length;r<s;++r)if(e[r].name===t){e[r]=GM,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var oy="http://www.w3.org/1999/xhtml";const T0={svg:"http://www.w3.org/2000/svg",xhtml:oy,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Jp(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),T0.hasOwnProperty(t)?{space:T0[t],local:e}:e}function QM(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===oy&&t.documentElement.namespaceURI===oy?t.createElement(e):t.createElementNS(n,e)}}function ZM(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function TC(e){var t=Jp(e);return(t.local?ZM:QM)(t)}function eL(){}function Ux(e){return e==null?eL:function(){return this.querySelector(e)}}function tL(e){typeof e!="function"&&(e=Ux(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],o=i.length,l=r[s]=new Array(o),c,u,p=0;p<o;++p)(c=i[p])&&(u=e.call(c,c.__data__,p,i))&&("__data__"in c&&(u.__data__=c.__data__),l[p]=u);return new zr(r,this._parents)}function nL(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function rL(){return[]}function RC(e){return e==null?rL:function(){return this.querySelectorAll(e)}}function sL(e){return function(){return nL(e.apply(this,arguments))}}function iL(e){typeof e=="function"?e=sL(e):e=RC(e);for(var t=this._groups,n=t.length,r=[],s=[],i=0;i<n;++i)for(var o=t[i],l=o.length,c,u=0;u<l;++u)(c=o[u])&&(r.push(e.call(c,c.__data__,u,o)),s.push(c));return new zr(r,s)}function MC(e){return function(){return this.matches(e)}}function LC(e){return function(t){return t.matches(e)}}var oL=Array.prototype.find;function aL(e){return function(){return oL.call(this.children,e)}}function lL(){return this.firstElementChild}function cL(e){return this.select(e==null?lL:aL(typeof e=="function"?e:LC(e)))}var uL=Array.prototype.filter;function dL(){return Array.from(this.children)}function fL(e){return function(){return uL.call(this.children,e)}}function pL(e){return this.selectAll(e==null?dL:fL(typeof e=="function"?e:LC(e)))}function hL(e){typeof e!="function"&&(e=MC(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],o=i.length,l=r[s]=[],c,u=0;u<o;++u)(c=i[u])&&e.call(c,c.__data__,u,i)&&l.push(c);return new zr(r,this._parents)}function $C(e){return new Array(e.length)}function mL(){return new zr(this._enter||this._groups.map($C),this._parents)}function rp(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}rp.prototype={constructor:rp,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 gL(e){return function(){return e}}function yL(e,t,n,r,s,i){for(var o=0,l,c=t.length,u=i.length;o<u;++o)(l=t[o])?(l.__data__=i[o],r[o]=l):n[o]=new rp(e,i[o]);for(;o<c;++o)(l=t[o])&&(s[o]=l)}function xL(e,t,n,r,s,i,o){var l,c,u=new Map,p=t.length,f=i.length,d=new Array(p),h;for(l=0;l<p;++l)(c=t[l])&&(d[l]=h=o.call(c,c.__data__,l,t)+"",u.has(h)?s[l]=c:u.set(h,c));for(l=0;l<f;++l)h=o.call(e,i[l],l,i)+"",(c=u.get(h))?(r[l]=c,c.__data__=i[l],u.delete(h)):n[l]=new rp(e,i[l]);for(l=0;l<p;++l)(c=t[l])&&u.get(d[l])===c&&(s[l]=c)}function wL(e){return e.__data__}function bL(e,t){if(!arguments.length)return Array.from(this,wL);var n=t?xL:yL,r=this._parents,s=this._groups;typeof e!="function"&&(e=gL(e));for(var i=s.length,o=new Array(i),l=new Array(i),c=new Array(i),u=0;u<i;++u){var p=r[u],f=s[u],d=f.length,h=vL(e.call(p,p&&p.__data__,u,r)),y=h.length,w=l[u]=new Array(y),k=o[u]=new Array(y),g=c[u]=new Array(d);n(p,f,w,k,g,h,t);for(var b=0,x=0,S,C;b<y;++b)if(S=w[b]){for(b>=x&&(x=b+1);!(C=k[x])&&++x<y;);S._next=C||null}}return o=new zr(o,r),o._enter=l,o._exit=c,o}function vL(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function kL(){return new zr(this._exit||this._groups.map($C),this._parents)}function SL(e,t,n){var r=this.enter(),s=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(s=t(s),s&&(s=s.selection())),n==null?i.remove():n(i),r&&s?r.merge(s).order():s}function NL(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,s=n.length,i=r.length,o=Math.min(s,i),l=new Array(s),c=0;c<o;++c)for(var u=n[c],p=r[c],f=u.length,d=l[c]=new Array(f),h,y=0;y<f;++y)(h=u[y]||p[y])&&(d[y]=h);for(;c<s;++c)l[c]=n[c];return new zr(l,this._parents)}function jL(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],s=r.length-1,i=r[s],o;--s>=0;)(o=r[s])&&(i&&o.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(o,i),i=o);return this}function CL(e){e||(e=EL);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var n=this._groups,r=n.length,s=new Array(r),i=0;i<r;++i){for(var o=n[i],l=o.length,c=s[i]=new Array(l),u,p=0;p<l;++p)(u=o[p])&&(c[p]=u);c.sort(t)}return new zr(s,this._parents).order()}function EL(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function _L(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function PL(){return Array.from(this)}function AL(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,i=r.length;s<i;++s){var o=r[s];if(o)return o}return null}function IL(){let e=0;for(const t of this)++e;return e}function TL(){return!this.node()}function RL(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var s=t[n],i=0,o=s.length,l;i<o;++i)(l=s[i])&&e.call(l,l.__data__,i,s);return this}function ML(e){return function(){this.removeAttribute(e)}}function LL(e){return function(){this.removeAttributeNS(e.space,e.local)}}function $L(e,t){return function(){this.setAttribute(e,t)}}function OL(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function DL(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function FL(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 zL(e,t){var n=Jp(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?LL:ML:typeof t=="function"?n.local?FL:DL:n.local?OL:$L)(n,t))}function OC(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function HL(e){return function(){this.style.removeProperty(e)}}function BL(e,t,n){return function(){this.style.setProperty(e,t,n)}}function WL(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function VL(e,t,n){return arguments.length>1?this.each((t==null?HL:typeof t=="function"?WL:BL)(e,t,n??"")):fl(this.node(),e)}function fl(e,t){return e.style.getPropertyValue(t)||OC(e).getComputedStyle(e,null).getPropertyValue(t)}function KL(e){return function(){delete this[e]}}function UL(e,t){return function(){this[e]=t}}function qL(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function YL(e,t){return arguments.length>1?this.each((t==null?KL:typeof t=="function"?qL:UL)(e,t)):this.node()[e]}function DC(e){return e.trim().split(/^|\s+/)}function qx(e){return e.classList||new FC(e)}function FC(e){this._node=e,this._names=DC(e.getAttribute("class")||"")}FC.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 zC(e,t){for(var n=qx(e),r=-1,s=t.length;++r<s;)n.add(t[r])}function HC(e,t){for(var n=qx(e),r=-1,s=t.length;++r<s;)n.remove(t[r])}function GL(e){return function(){zC(this,e)}}function XL(e){return function(){HC(this,e)}}function JL(e,t){return function(){(t.apply(this,arguments)?zC:HC)(this,e)}}function QL(e,t){var n=DC(e+"");if(arguments.length<2){for(var r=qx(this.node()),s=-1,i=n.length;++s<i;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof t=="function"?JL:t?GL:XL)(n,t))}function ZL(){this.textContent=""}function e$(e){return function(){this.textContent=e}}function t$(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function n$(e){return arguments.length?this.each(e==null?ZL:(typeof e=="function"?t$:e$)(e)):this.node().textContent}function r$(){this.innerHTML=""}function s$(e){return function(){this.innerHTML=e}}function i$(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function o$(e){return arguments.length?this.each(e==null?r$:(typeof e=="function"?i$:s$)(e)):this.node().innerHTML}function a$(){this.nextSibling&&this.parentNode.appendChild(this)}function l$(){return this.each(a$)}function c$(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function u$(){return this.each(c$)}function d$(e){var t=typeof e=="function"?e:TC(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function f$(){return null}function p$(e,t){var n=typeof e=="function"?e:TC(e),r=t==null?f$:typeof t=="function"?t:Ux(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function h$(){var e=this.parentNode;e&&e.removeChild(this)}function m$(){return this.each(h$)}function g$(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function y$(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function x$(e){return this.select(e?y$:g$)}function w$(e){return arguments.length?this.property("__data__",e):this.node().__data__}function b$(e){return function(t){e.call(this,t,this.__data__)}}function v$(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 k$(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,s=t.length,i;n<s;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function S$(e,t,n){return function(){var r=this.__on,s,i=b$(t);if(r){for(var o=0,l=r.length;o<l;++o)if((s=r[o]).type===e.type&&s.name===e.name){this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=i,s.options=n),s.value=t;return}}this.addEventListener(e.type,i,n),s={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(s):this.__on=[s]}}function N$(e,t,n){var r=v$(e+""),s,i=r.length,o;if(arguments.length<2){var l=this.node().__on;if(l){for(var c=0,u=l.length,p;c<u;++c)for(s=0,p=l[c];s<i;++s)if((o=r[s]).type===p.type&&o.name===p.name)return p.value}return}for(l=t?S$:k$,s=0;s<i;++s)this.each(l(r[s],t,n));return this}function BC(e,t,n){var r=OC(e),s=r.CustomEvent;typeof s=="function"?s=new s(t,n):(s=r.document.createEvent("Event"),n?(s.initEvent(t,n.bubbles,n.cancelable),s.detail=n.detail):s.initEvent(t,!1,!1)),e.dispatchEvent(s)}function j$(e,t){return function(){return BC(this,e,t)}}function C$(e,t){return function(){return BC(this,e,t.apply(this,arguments))}}function E$(e,t){return this.each((typeof t=="function"?C$:j$)(e,t))}function*_$(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,i=r.length,o;s<i;++s)(o=r[s])&&(yield o)}var WC=[null];function zr(e,t){this._groups=e,this._parents=t}function Mu(){return new zr([[document.documentElement]],WC)}function P$(){return this}zr.prototype=Mu.prototype={constructor:zr,select:tL,selectAll:iL,selectChild:cL,selectChildren:pL,filter:hL,data:bL,enter:mL,exit:kL,join:SL,merge:NL,selection:P$,order:jL,sort:CL,call:_L,nodes:PL,node:AL,size:IL,empty:TL,each:RL,attr:zL,style:VL,property:YL,classed:QL,text:n$,html:o$,raise:l$,lower:u$,append:d$,insert:p$,remove:m$,clone:x$,datum:w$,on:N$,dispatch:E$,[Symbol.iterator]:_$};function Mr(e){return typeof e=="string"?new zr([[document.querySelector(e)]],[document.documentElement]):new zr([[e]],WC)}function A$(e){let t;for(;t=e.sourceEvent;)e=t;return e}function bs(e,t){if(e=A$(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}}return[e.pageX,e.pageY]}const I$={passive:!1},lu={capture:!0,passive:!1};function ym(e){e.stopImmediatePropagation()}function Qa(e){e.preventDefault(),e.stopImmediatePropagation()}function VC(e){var t=e.document.documentElement,n=Mr(e).on("dragstart.drag",Qa,lu);"onselectstart"in t?n.on("selectstart.drag",Qa,lu):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function KC(e,t){var n=e.document.documentElement,r=Mr(e).on("dragstart.drag",null);t&&(r.on("click.drag",Qa,lu),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 Ld=e=>()=>e;function ay(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:i,x:o,y:l,dx:c,dy:u,dispatch:p}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:p}})}ay.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function T$(e){return!e.ctrlKey&&!e.button}function R$(){return this.parentNode}function M$(e,t){return t??{x:e.x,y:e.y}}function L$(){return navigator.maxTouchPoints||"ontouchstart"in this}function UC(){var e=T$,t=R$,n=M$,r=L$,s={},i=Xp("start","drag","end"),o=0,l,c,u,p,f=0;function d(S){S.on("mousedown.drag",h).filter(r).on("touchstart.drag",k).on("touchmove.drag",g,I$).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(S,C){if(!(p||!e.call(this,S,C))){var j=x(this,t.call(this,S,C),S,C,"mouse");j&&(Mr(S.view).on("mousemove.drag",y,lu).on("mouseup.drag",w,lu),VC(S.view),ym(S),u=!1,l=S.clientX,c=S.clientY,j("start",S))}}function y(S){if(Qa(S),!u){var C=S.clientX-l,j=S.clientY-c;u=C*C+j*j>f}s.mouse("drag",S)}function w(S){Mr(S.view).on("mousemove.drag mouseup.drag",null),KC(S.view,u),Qa(S),s.mouse("end",S)}function k(S,C){if(e.call(this,S,C)){var j=S.changedTouches,E=t.call(this,S,C),A=j.length,D,W;for(D=0;D<A;++D)(W=x(this,E,S,C,j[D].identifier,j[D]))&&(ym(S),W("start",S,j[D]))}}function g(S){var C=S.changedTouches,j=C.length,E,A;for(E=0;E<j;++E)(A=s[C[E].identifier])&&(Qa(S),A("drag",S,C[E]))}function b(S){var C=S.changedTouches,j=C.length,E,A;for(p&&clearTimeout(p),p=setTimeout(function(){p=null},500),E=0;E<j;++E)(A=s[C[E].identifier])&&(ym(S),A("end",S,C[E]))}function x(S,C,j,E,A,D){var W=i.copy(),F=bs(D||j,C),R,$,P;if((P=n.call(S,new ay("beforestart",{sourceEvent:j,target:d,identifier:A,active:o,x:F[0],y:F[1],dx:0,dy:0,dispatch:W}),E))!=null)return R=P.x-F[0]||0,$=P.y-F[1]||0,function L(T,O,I){var H=F,_;switch(T){case"start":s[A]=L,_=o++;break;case"end":delete s[A],--o;case"drag":F=bs(I||O,C),_=o;break}W.call(T,S,new ay(T,{sourceEvent:O,subject:P,target:d,identifier:A,active:_,x:F[0]+R,y:F[1]+$,dx:F[0]-H[0],dy:F[1]-H[1],dispatch:W}),E)}}return d.filter=function(S){return arguments.length?(e=typeof S=="function"?S:Ld(!!S),d):e},d.container=function(S){return arguments.length?(t=typeof S=="function"?S:Ld(S),d):t},d.subject=function(S){return arguments.length?(n=typeof S=="function"?S:Ld(S),d):n},d.touchable=function(S){return arguments.length?(r=typeof S=="function"?S:Ld(!!S),d):r},d.on=function(){var S=i.on.apply(i,arguments);return S===i?d:S},d.clickDistance=function(S){return arguments.length?(f=(S=+S)*S,d):Math.sqrt(f)},d}function Yx(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function qC(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Lu(){}var cu=.7,sp=1/cu,Za="\\s*([+-]?\\d+)\\s*",uu="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Us="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",$$=/^#([0-9a-f]{3,8})$/,O$=new RegExp(`^rgb\\(${Za},${Za},${Za}\\)$`),D$=new RegExp(`^rgb\\(${Us},${Us},${Us}\\)$`),F$=new RegExp(`^rgba\\(${Za},${Za},${Za},${uu}\\)$`),z$=new RegExp(`^rgba\\(${Us},${Us},${Us},${uu}\\)$`),H$=new RegExp(`^hsl\\(${uu},${Us},${Us}\\)$`),B$=new RegExp(`^hsla\\(${uu},${Us},${Us},${uu}\\)$`),R0={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};Yx(Lu,Vo,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:M0,formatHex:M0,formatHex8:W$,formatHsl:V$,formatRgb:L0,toString:L0});function M0(){return this.rgb().formatHex()}function W$(){return this.rgb().formatHex8()}function V$(){return YC(this).formatHsl()}function L0(){return this.rgb().formatRgb()}function Vo(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=$$.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?$0(t):n===3?new xr(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?$d(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?$d(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=O$.exec(e))?new xr(t[1],t[2],t[3],1):(t=D$.exec(e))?new xr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=F$.exec(e))?$d(t[1],t[2],t[3],t[4]):(t=z$.exec(e))?$d(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=H$.exec(e))?F0(t[1],t[2]/100,t[3]/100,1):(t=B$.exec(e))?F0(t[1],t[2]/100,t[3]/100,t[4]):R0.hasOwnProperty(e)?$0(R0[e]):e==="transparent"?new xr(NaN,NaN,NaN,0):null}function $0(e){return new xr(e>>16&255,e>>8&255,e&255,1)}function $d(e,t,n,r){return r<=0&&(e=t=n=NaN),new xr(e,t,n,r)}function K$(e){return e instanceof Lu||(e=Vo(e)),e?(e=e.rgb(),new xr(e.r,e.g,e.b,e.opacity)):new xr}function ly(e,t,n,r){return arguments.length===1?K$(e):new xr(e,t,n,r??1)}function xr(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Yx(xr,ly,qC(Lu,{brighter(e){return e=e==null?sp:Math.pow(sp,e),new xr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?cu:Math.pow(cu,e),new xr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new xr(Lo(this.r),Lo(this.g),Lo(this.b),ip(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:O0,formatHex:O0,formatHex8:U$,formatRgb:D0,toString:D0}));function O0(){return`#${Ao(this.r)}${Ao(this.g)}${Ao(this.b)}`}function U$(){return`#${Ao(this.r)}${Ao(this.g)}${Ao(this.b)}${Ao((isNaN(this.opacity)?1:this.opacity)*255)}`}function D0(){const e=ip(this.opacity);return`${e===1?"rgb(":"rgba("}${Lo(this.r)}, ${Lo(this.g)}, ${Lo(this.b)}${e===1?")":`, ${e})`}`}function ip(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Lo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ao(e){return e=Lo(e),(e<16?"0":"")+e.toString(16)}function F0(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ss(e,t,n,r)}function YC(e){if(e instanceof Ss)return new Ss(e.h,e.s,e.l,e.opacity);if(e instanceof Lu||(e=Vo(e)),!e)return new Ss;if(e instanceof Ss)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),i=Math.max(t,n,r),o=NaN,l=i-s,c=(i+s)/2;return l?(t===i?o=(n-r)/l+(n<r)*6:n===i?o=(r-t)/l+2:o=(t-n)/l+4,l/=c<.5?i+s:2-i-s,o*=60):l=c>0&&c<1?0:o,new Ss(o,l,c,e.opacity)}function q$(e,t,n,r){return arguments.length===1?YC(e):new Ss(e,t,n,r??1)}function Ss(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Yx(Ss,q$,qC(Lu,{brighter(e){return e=e==null?sp:Math.pow(sp,e),new Ss(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?cu:Math.pow(cu,e),new Ss(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,s=2*n-r;return new xr(xm(e>=240?e-240:e+120,s,r),xm(e,s,r),xm(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new Ss(z0(this.h),Od(this.s),Od(this.l),ip(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=ip(this.opacity);return`${e===1?"hsl(":"hsla("}${z0(this.h)}, ${Od(this.s)*100}%, ${Od(this.l)*100}%${e===1?")":`, ${e})`}`}}));function z0(e){return e=(e||0)%360,e<0?e+360:e}function Od(e){return Math.max(0,Math.min(1,e||0))}function xm(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 Gx=e=>()=>e;function Y$(e,t){return function(n){return e+n*t}}function G$(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 X$(e){return(e=+e)==1?GC:function(t,n){return n-t?G$(t,n,e):Gx(isNaN(t)?n:t)}}function GC(e,t){var n=t-e;return n?Y$(e,n):Gx(isNaN(e)?t:e)}const op=function e(t){var n=X$(t);function r(s,i){var o=n((s=ly(s)).r,(i=ly(i)).r),l=n(s.g,i.g),c=n(s.b,i.b),u=GC(s.opacity,i.opacity);return function(p){return s.r=o(p),s.g=l(p),s.b=c(p),s.opacity=u(p),s+""}}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(),s;return function(i){for(s=0;s<n;++s)r[s]=e[s]*(1-i)+t[s]*i;return r}}function Q$(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Z$(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,s=new Array(r),i=new Array(n),o;for(o=0;o<r;++o)s[o]=Lc(e[o],t[o]);for(;o<n;++o)i[o]=t[o];return function(l){for(o=0;o<r;++o)i[o]=s[o](l);return i}}function eO(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Ds(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function tO(e,t){var n={},r={},s;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(s in t)s in e?n[s]=Lc(e[s],t[s]):r[s]=t[s];return function(i){for(s in n)r[s]=n[s](i);return r}}var cy=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,wm=new RegExp(cy.source,"g");function nO(e){return function(){return e}}function rO(e){return function(t){return e(t)+""}}function XC(e,t){var n=cy.lastIndex=wm.lastIndex=0,r,s,i,o=-1,l=[],c=[];for(e=e+"",t=t+"";(r=cy.exec(e))&&(s=wm.exec(t));)(i=s.index)>n&&(i=t.slice(n,i),l[o]?l[o]+=i:l[++o]=i),(r=r[0])===(s=s[0])?l[o]?l[o]+=s:l[++o]=s:(l[++o]=null,c.push({i:o,x:Ds(r,s)})),n=wm.lastIndex;return n<t.length&&(i=t.slice(n),l[o]?l[o]+=i:l[++o]=i),l.length<2?c[0]?rO(c[0].x):nO(t):(t=c.length,function(u){for(var p=0,f;p<t;++p)l[(f=c[p]).i]=f.x(u);return l.join("")})}function Lc(e,t){var n=typeof t,r;return t==null||n==="boolean"?Gx(t):(n==="number"?Ds:n==="string"?(r=Vo(t))?(t=r,op):XC:t instanceof Vo?op:t instanceof Date?eO:Q$(t)?J$:Array.isArray(t)?Z$:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?tO:Ds)(e,t)}var H0=180/Math.PI,uy={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function JC(e,t,n,r,s,i){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:s,translateY:i,rotate:Math.atan2(t,e)*H0,skewX:Math.atan(c)*H0,scaleX:o,scaleY:l}}var Dd;function sO(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?uy:JC(t.a,t.b,t.c,t.d,t.e,t.f)}function iO(e){return e==null||(Dd||(Dd=document.createElementNS("http://www.w3.org/2000/svg","g")),Dd.setAttribute("transform",e),!(e=Dd.transform.baseVal.consolidate()))?uy:(e=e.matrix,JC(e.a,e.b,e.c,e.d,e.e,e.f))}function QC(e,t,n,r){function s(u){return u.length?u.pop()+" ":""}function i(u,p,f,d,h,y){if(u!==f||p!==d){var w=h.push("translate(",null,t,null,n);y.push({i:w-4,x:Ds(u,f)},{i:w-2,x:Ds(p,d)})}else(f||d)&&h.push("translate("+f+t+d+n)}function o(u,p,f,d){u!==p?(u-p>180?p+=360:p-u>180&&(u+=360),d.push({i:f.push(s(f)+"rotate(",null,r)-2,x:Ds(u,p)})):p&&f.push(s(f)+"rotate("+p+r)}function l(u,p,f,d){u!==p?d.push({i:f.push(s(f)+"skewX(",null,r)-2,x:Ds(u,p)}):p&&f.push(s(f)+"skewX("+p+r)}function c(u,p,f,d,h,y){if(u!==f||p!==d){var w=h.push(s(h)+"scale(",null,",",null,")");y.push({i:w-4,x:Ds(u,f)},{i:w-2,x:Ds(p,d)})}else(f!==1||d!==1)&&h.push(s(h)+"scale("+f+","+d+")")}return function(u,p){var f=[],d=[];return u=e(u),p=e(p),i(u.translateX,u.translateY,p.translateX,p.translateY,f,d),o(u.rotate,p.rotate,f,d),l(u.skewX,p.skewX,f,d),c(u.scaleX,u.scaleY,p.scaleX,p.scaleY,f,d),u=p=null,function(h){for(var y=-1,w=d.length,k;++y<w;)f[(k=d[y]).i]=k.x(h);return f.join("")}}}var oO=QC(sO,"px, ","px)","deg)"),aO=QC(iO,", ",")",")"),lO=1e-12;function B0(e){return((e=Math.exp(e))+1/e)/2}function cO(e){return((e=Math.exp(e))-1/e)/2}function uO(e){return((e=Math.exp(2*e))-1)/(e+1)}const Sf=function e(t,n,r){function s(i,o){var l=i[0],c=i[1],u=i[2],p=o[0],f=o[1],d=o[2],h=p-l,y=f-c,w=h*h+y*y,k,g;if(w<lO)g=Math.log(d/u)/t,k=function(E){return[l+E*h,c+E*y,u*Math.exp(t*E*g)]};else{var b=Math.sqrt(w),x=(d*d-u*u+r*w)/(2*u*n*b),S=(d*d-u*u-r*w)/(2*d*n*b),C=Math.log(Math.sqrt(x*x+1)-x),j=Math.log(Math.sqrt(S*S+1)-S);g=(j-C)/t,k=function(E){var A=E*g,D=B0(C),W=u/(n*b)*(D*uO(t*A+C)-cO(C));return[l+W*h,c+W*y,u*D/B0(t*A+C)]}}return k.duration=g*1e3*t/Math.SQRT2,k}return s.rho=function(i){var o=Math.max(.001,+i),l=o*o,c=l*l;return e(o,l,c)},s}(Math.SQRT2,2,4);var pl=0,bc=0,ac=0,ZC=1e3,ap,vc,lp=0,Ko=0,Qp=0,du=typeof performance=="object"&&performance.now?performance:Date,eE=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Xx(){return Ko||(eE(dO),Ko=du.now()+Qp)}function dO(){Ko=0}function cp(){this._call=this._time=this._next=null}cp.prototype=tE.prototype={constructor:cp,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Xx():+n)+(t==null?0:+t),!this._next&&vc!==this&&(vc?vc._next=this:ap=this,vc=this),this._call=e,this._time=n,dy()},stop:function(){this._call&&(this._call=null,this._time=1/0,dy())}};function tE(e,t,n){var r=new cp;return r.restart(e,t,n),r}function fO(){Xx(),++pl;for(var e=ap,t;e;)(t=Ko-e._time)>=0&&e._call.call(void 0,t),e=e._next;--pl}function W0(){Ko=(lp=du.now())+Qp,pl=bc=0;try{fO()}finally{pl=0,hO(),Ko=0}}function pO(){var e=du.now(),t=e-lp;t>ZC&&(Qp-=t,lp=e)}function hO(){for(var e,t=ap,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:ap=n);vc=e,dy(r)}function dy(e){if(!pl){bc&&(bc=clearTimeout(bc));var t=e-Ko;t>24?(e<1/0&&(bc=setTimeout(W0,e-du.now()-Qp)),ac&&(ac=clearInterval(ac))):(ac||(lp=du.now(),ac=setInterval(pO,ZC)),pl=1,eE(W0))}}function V0(e,t,n){var r=new cp;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var mO=Xp("start","end","cancel","interrupt"),gO=[],nE=0,K0=1,fy=2,Nf=3,U0=4,py=5,jf=6;function Zp(e,t,n,r,s,i){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;yO(e,n,{name:t,index:r,group:s,on:mO,tween:gO,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:nE})}function Jx(e,t){var n=Is(e,t);if(n.state>nE)throw new Error("too late; already scheduled");return n}function Qs(e,t){var n=Is(e,t);if(n.state>Nf)throw new Error("too late; already running");return n}function Is(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function yO(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=tE(i,0,n.time);function i(u){n.state=K0,n.timer.restart(o,n.delay,n.time),n.delay<=u&&o(u-n.delay)}function o(u){var p,f,d,h;if(n.state!==K0)return c();for(p in r)if(h=r[p],h.name===n.name){if(h.state===Nf)return V0(o);h.state===U0?(h.state=jf,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[p]):+p<t&&(h.state=jf,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[p])}if(V0(function(){n.state===Nf&&(n.state=U0,n.timer.restart(l,n.delay,n.time),l(u))}),n.state=fy,n.on.call("start",e,e.__data__,n.index,n.group),n.state===fy){for(n.state=Nf,s=new Array(d=n.tween.length),p=0,f=-1;p<d;++p)(h=n.tween[p].value.call(e,e.__data__,n.index,n.group))&&(s[++f]=h);s.length=f+1}}function l(u){for(var p=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=py,1),f=-1,d=s.length;++f<d;)s[f].call(e,p);n.state===py&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=jf,n.timer.stop(),delete r[t];for(var u in r)return;delete e.__transition}}function Cf(e,t){var n=e.__transition,r,s,i=!0,o;if(n){t=t==null?null:t+"";for(o in n){if((r=n[o]).name!==t){i=!1;continue}s=r.state>fy&&r.state<py,r.state=jf,r.timer.stop(),r.on.call(s?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[o]}i&&delete e.__transition}}function xO(e){return this.each(function(){Cf(this,e)})}function wO(e,t){var n,r;return function(){var s=Qs(this,e),i=s.tween;if(i!==n){r=n=i;for(var o=0,l=r.length;o<l;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}s.tween=r}}function bO(e,t,n){var r,s;if(typeof n!="function")throw new Error;return function(){var i=Qs(this,e),o=i.tween;if(o!==r){s=(r=o).slice();for(var l={name:t,value:n},c=0,u=s.length;c<u;++c)if(s[c].name===t){s[c]=l;break}c===u&&s.push(l)}i.tween=s}}function vO(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Is(this.node(),n).tween,s=0,i=r.length,o;s<i;++s)if((o=r[s]).name===e)return o.value;return null}return this.each((t==null?wO:bO)(n,e,t))}function Qx(e,t,n){var r=e._id;return e.each(function(){var s=Qs(this,r);(s.value||(s.value={}))[t]=n.apply(this,arguments)}),function(s){return Is(s,r).value[t]}}function rE(e,t){var n;return(typeof t=="number"?Ds:t instanceof Vo?op:(n=Vo(t))?(t=n,op):XC)(e,t)}function kO(e){return function(){this.removeAttribute(e)}}function SO(e){return function(){this.removeAttributeNS(e.space,e.local)}}function NO(e,t,n){var r,s=n+"",i;return function(){var o=this.getAttribute(e);return o===s?null:o===r?i:i=t(r=o,n)}}function jO(e,t,n){var r,s=n+"",i;return function(){var o=this.getAttributeNS(e.space,e.local);return o===s?null:o===r?i:i=t(r=o,n)}}function CO(e,t,n){var r,s,i;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===s?i:(s=c,i=t(r=o,l)))}}function EO(e,t,n){var r,s,i;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===s?i:(s=c,i=t(r=o,l)))}}function _O(e,t){var n=Jp(e),r=n==="transform"?aO:rE;return this.attrTween(e,typeof t=="function"?(n.local?EO:CO)(n,r,Qx(this,"attr."+e,t)):t==null?(n.local?SO:kO)(n):(n.local?jO:NO)(n,r,t))}function PO(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function AO(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function IO(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&AO(e,i)),n}return s._value=t,s}function TO(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&PO(e,i)),n}return s._value=t,s}function RO(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=Jp(e);return this.tween(n,(r.local?IO:TO)(r,t))}function MO(e,t){return function(){Jx(this,e).delay=+t.apply(this,arguments)}}function LO(e,t){return t=+t,function(){Jx(this,e).delay=t}}function $O(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?MO:LO)(t,e)):Is(this.node(),t).delay}function OO(e,t){return function(){Qs(this,e).duration=+t.apply(this,arguments)}}function DO(e,t){return t=+t,function(){Qs(this,e).duration=t}}function FO(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?OO:DO)(t,e)):Is(this.node(),t).duration}function zO(e,t){if(typeof t!="function")throw new Error;return function(){Qs(this,e).ease=t}}function HO(e){var t=this._id;return arguments.length?this.each(zO(t,e)):Is(this.node(),t).ease}function BO(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Qs(this,e).ease=n}}function WO(e){if(typeof e!="function")throw new Error;return this.each(BO(this._id,e))}function VO(e){typeof e!="function"&&(e=MC(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],o=i.length,l=r[s]=[],c,u=0;u<o;++u)(c=i[u])&&e.call(c,c.__data__,u,i)&&l.push(c);return new vi(r,this._parents,this._name,this._id)}function KO(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,s=n.length,i=Math.min(r,s),o=new Array(r),l=0;l<i;++l)for(var c=t[l],u=n[l],p=c.length,f=o[l]=new Array(p),d,h=0;h<p;++h)(d=c[h]||u[h])&&(f[h]=d);for(;l<r;++l)o[l]=t[l];return new vi(o,this._parents,this._name,this._id)}function UO(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 qO(e,t,n){var r,s,i=UO(t)?Jx:Qs;return function(){var o=i(this,e),l=o.on;l!==r&&(s=(r=l).copy()).on(t,n),o.on=s}}function YO(e,t){var n=this._id;return arguments.length<2?Is(this.node(),n).on.on(e):this.each(qO(n,e,t))}function GO(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function XO(){return this.on("end.remove",GO(this._id))}function JO(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Ux(e));for(var r=this._groups,s=r.length,i=new Array(s),o=0;o<s;++o)for(var l=r[o],c=l.length,u=i[o]=new Array(c),p,f,d=0;d<c;++d)(p=l[d])&&(f=e.call(p,p.__data__,d,l))&&("__data__"in p&&(f.__data__=p.__data__),u[d]=f,Zp(u[d],t,n,d,u,Is(p,n)));return new vi(i,this._parents,t,n)}function QO(e){var t=this._name,n=this._id;typeof e!="function"&&(e=RC(e));for(var r=this._groups,s=r.length,i=[],o=[],l=0;l<s;++l)for(var c=r[l],u=c.length,p,f=0;f<u;++f)if(p=c[f]){for(var d=e.call(p,p.__data__,f,c),h,y=Is(p,n),w=0,k=d.length;w<k;++w)(h=d[w])&&Zp(h,t,n,w,d,y);i.push(d),o.push(p)}return new vi(i,o,t,n)}var ZO=Mu.prototype.constructor;function eD(){return new ZO(this._groups,this._parents)}function tD(e,t){var n,r,s;return function(){var i=fl(this,e),o=(this.style.removeProperty(e),fl(this,e));return i===o?null:i===n&&o===r?s:s=t(n=i,r=o)}}function sE(e){return function(){this.style.removeProperty(e)}}function nD(e,t,n){var r,s=n+"",i;return function(){var o=fl(this,e);return o===s?null:o===r?i:i=t(r=o,n)}}function rD(e,t,n){var r,s,i;return function(){var o=fl(this,e),l=n(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(e),fl(this,e))),o===c?null:o===r&&c===s?i:(s=c,i=t(r=o,l))}}function sD(e,t){var n,r,s,i="style."+t,o="end."+i,l;return function(){var c=Qs(this,e),u=c.on,p=c.value[i]==null?l||(l=sE(t)):void 0;(u!==n||s!==p)&&(r=(n=u).copy()).on(o,s=p),c.on=r}}function iD(e,t,n){var r=(e+="")=="transform"?oO:rE;return t==null?this.styleTween(e,tD(e,r)).on("end.style."+e,sE(e)):typeof t=="function"?this.styleTween(e,rD(e,r,Qx(this,"style."+e,t))).each(sD(this._id,e)):this.styleTween(e,nD(e,r,t),n).on("end.style."+e,null)}function oD(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function aD(e,t,n){var r,s;function i(){var o=t.apply(this,arguments);return o!==s&&(r=(s=o)&&oD(e,o,n)),r}return i._value=t,i}function lD(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,aD(e,t,n??""))}function cD(e){return function(){this.textContent=e}}function uD(e){return function(){var t=e(this);this.textContent=t??""}}function dD(e){return this.tween("text",typeof e=="function"?uD(Qx(this,"text",e)):cD(e==null?"":e+""))}function fD(e){return function(t){this.textContent=e.call(this,t)}}function pD(e){var t,n;function r(){var s=e.apply(this,arguments);return s!==n&&(t=(n=s)&&fD(s)),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,pD(e))}function mD(){for(var e=this._name,t=this._id,n=iE(),r=this._groups,s=r.length,i=0;i<s;++i)for(var o=r[i],l=o.length,c,u=0;u<l;++u)if(c=o[u]){var p=Is(c,t);Zp(c,e,n,u,o,{time:p.time+p.delay+p.duration,delay:0,duration:p.duration,ease:p.ease})}return new vi(r,this._parents,e,n)}function gD(){var e,t,n=this,r=n._id,s=n.size();return new Promise(function(i,o){var l={value:o},c={value:function(){--s===0&&i()}};n.each(function(){var u=Qs(this,r),p=u.on;p!==e&&(t=(e=p).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(c)),u.on=t}),s===0&&i()})}var yD=0;function vi(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function iE(){return++yD}var si=Mu.prototype;vi.prototype={constructor:vi,select:JO,selectAll:QO,selectChild:si.selectChild,selectChildren:si.selectChildren,filter:VO,merge:KO,selection:eD,transition:mD,call:si.call,nodes:si.nodes,node:si.node,size:si.size,empty:si.empty,each:si.each,on:YO,attr:_O,attrTween:RO,style:iD,styleTween:lD,text:dD,textTween:hD,remove:XO,tween:vO,delay:$O,duration:FO,ease:HO,easeVarying:WO,end:gD,[Symbol.iterator]:si[Symbol.iterator]};function xD(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var wD={time:null,delay:0,duration:250,ease:xD};function bD(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 vD(e){var t,n;e instanceof vi?(t=e._id,e=e._name):(t=iE(),(n=wD).time=Xx(),e=e==null?null:e+"");for(var r=this._groups,s=r.length,i=0;i<s;++i)for(var o=r[i],l=o.length,c,u=0;u<l;++u)(c=o[u])&&Zp(c,e,t,u,o,n||bD(c,t));return new vi(r,this._parents,e,t)}Mu.prototype.interrupt=xO;Mu.prototype.transition=vD;const Fd=e=>()=>e;function kD(e,{sourceEvent:t,target:n,transform:r,dispatch:s}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:s}})}function di(e,t,n){this.k=e,this.x=t,this.y=n}di.prototype={constructor:di,scale:function(e){return e===1?this:new di(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new di(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 eh=new di(1,0,0);oE.prototype=di.prototype;function oE(e){for(;!e.__zoom;)if(!(e=e.parentNode))return eh;return e.__zoom}function bm(e){e.stopImmediatePropagation()}function lc(e){e.preventDefault(),e.stopImmediatePropagation()}function SD(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function ND(){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 q0(){return this.__zoom||eh}function jD(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function CD(){return navigator.maxTouchPoints||"ontouchstart"in this}function ED(e,t,n){var r=e.invertX(t[0][0])-n[0][0],s=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),o>i?(i+o)/2:Math.min(0,i)||Math.max(0,o))}function aE(){var e=SD,t=ND,n=ED,r=jD,s=CD,i=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],l=250,c=Sf,u=Xp("start","zoom","end"),p,f,d,h=500,y=150,w=0,k=10;function g(P){P.property("__zoom",q0).on("wheel.zoom",A,{passive:!1}).on("mousedown.zoom",D).on("dblclick.zoom",W).filter(s).on("touchstart.zoom",F).on("touchmove.zoom",R).on("touchend.zoom touchcancel.zoom",$).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(P,L,T,O){var I=P.selection?P.selection():P;I.property("__zoom",q0),P!==I?C(P,L,T,O):I.interrupt().each(function(){j(this,arguments).event(O).start().zoom(null,typeof L=="function"?L.apply(this,arguments):L).end()})},g.scaleBy=function(P,L,T,O){g.scaleTo(P,function(){var I=this.__zoom.k,H=typeof L=="function"?L.apply(this,arguments):L;return I*H},T,O)},g.scaleTo=function(P,L,T,O){g.transform(P,function(){var I=t.apply(this,arguments),H=this.__zoom,_=T==null?S(I):typeof T=="function"?T.apply(this,arguments):T,Y=H.invert(_),U=typeof L=="function"?L.apply(this,arguments):L;return n(x(b(H,U),_,Y),I,o)},T,O)},g.translateBy=function(P,L,T,O){g.transform(P,function(){return n(this.__zoom.translate(typeof L=="function"?L.apply(this,arguments):L,typeof T=="function"?T.apply(this,arguments):T),t.apply(this,arguments),o)},null,O)},g.translateTo=function(P,L,T,O,I){g.transform(P,function(){var H=t.apply(this,arguments),_=this.__zoom,Y=O==null?S(H):typeof O=="function"?O.apply(this,arguments):O;return n(eh.translate(Y[0],Y[1]).scale(_.k).translate(typeof L=="function"?-L.apply(this,arguments):-L,typeof T=="function"?-T.apply(this,arguments):-T),H,o)},O,I)};function b(P,L){return L=Math.max(i[0],Math.min(i[1],L)),L===P.k?P:new di(L,P.x,P.y)}function x(P,L,T){var O=L[0]-T[0]*P.k,I=L[1]-T[1]*P.k;return O===P.x&&I===P.y?P:new di(P.k,O,I)}function S(P){return[(+P[0][0]+ +P[1][0])/2,(+P[0][1]+ +P[1][1])/2]}function C(P,L,T,O){P.on("start.zoom",function(){j(this,arguments).event(O).start()}).on("interrupt.zoom end.zoom",function(){j(this,arguments).event(O).end()}).tween("zoom",function(){var I=this,H=arguments,_=j(I,H).event(O),Y=t.apply(I,H),U=T==null?S(Y):typeof T=="function"?T.apply(I,H):T,V=Math.max(Y[1][0]-Y[0][0],Y[1][1]-Y[0][1]),Z=I.__zoom,ue=typeof L=="function"?L.apply(I,H):L,le=c(Z.invert(U).concat(V/Z.k),ue.invert(U).concat(V/ue.k));return function(we){if(we===1)we=ue;else{var re=le(we),ye=V/re[2];we=new di(ye,U[0]-re[0]*ye,U[1]-re[1]*ye)}_.zoom(null,we)}})}function j(P,L,T){return!T&&P.__zooming||new E(P,L)}function E(P,L){this.that=P,this.args=L,this.active=0,this.sourceEvent=null,this.extent=t.apply(P,L),this.taps=0}E.prototype={event:function(P){return P&&(this.sourceEvent=P),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(P,L){return this.mouse&&P!=="mouse"&&(this.mouse[1]=L.invert(this.mouse[0])),this.touch0&&P!=="touch"&&(this.touch0[1]=L.invert(this.touch0[0])),this.touch1&&P!=="touch"&&(this.touch1[1]=L.invert(this.touch1[0])),this.that.__zoom=L,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(P){var L=Mr(this.that).datum();u.call(P,this.that,new kD(P,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:u}),L)}};function A(P,...L){if(!e.apply(this,arguments))return;var T=j(this,L).event(P),O=this.__zoom,I=Math.max(i[0],Math.min(i[1],O.k*Math.pow(2,r.apply(this,arguments)))),H=bs(P);if(T.wheel)(T.mouse[0][0]!==H[0]||T.mouse[0][1]!==H[1])&&(T.mouse[1]=O.invert(T.mouse[0]=H)),clearTimeout(T.wheel);else{if(O.k===I)return;T.mouse=[H,O.invert(H)],Cf(this),T.start()}lc(P),T.wheel=setTimeout(_,y),T.zoom("mouse",n(x(b(O,I),T.mouse[0],T.mouse[1]),T.extent,o));function _(){T.wheel=null,T.end()}}function D(P,...L){if(d||!e.apply(this,arguments))return;var T=P.currentTarget,O=j(this,L,!0).event(P),I=Mr(P.view).on("mousemove.zoom",U,!0).on("mouseup.zoom",V,!0),H=bs(P,T),_=P.clientX,Y=P.clientY;VC(P.view),bm(P),O.mouse=[H,this.__zoom.invert(H)],Cf(this),O.start();function U(Z){if(lc(Z),!O.moved){var ue=Z.clientX-_,le=Z.clientY-Y;O.moved=ue*ue+le*le>w}O.event(Z).zoom("mouse",n(x(O.that.__zoom,O.mouse[0]=bs(Z,T),O.mouse[1]),O.extent,o))}function V(Z){I.on("mousemove.zoom mouseup.zoom",null),KC(Z.view,O.moved),lc(Z),O.event(Z).end()}}function W(P,...L){if(e.apply(this,arguments)){var T=this.__zoom,O=bs(P.changedTouches?P.changedTouches[0]:P,this),I=T.invert(O),H=T.k*(P.shiftKey?.5:2),_=n(x(b(T,H),O,I),t.apply(this,L),o);lc(P),l>0?Mr(this).transition().duration(l).call(C,_,O,P):Mr(this).call(g.transform,_,O,P)}}function F(P,...L){if(e.apply(this,arguments)){var T=P.touches,O=T.length,I=j(this,L,P.changedTouches.length===O).event(P),H,_,Y,U;for(bm(P),_=0;_<O;++_)Y=T[_],U=bs(Y,this),U=[U,this.__zoom.invert(U),Y.identifier],I.touch0?!I.touch1&&I.touch0[2]!==U[2]&&(I.touch1=U,I.taps=0):(I.touch0=U,H=!0,I.taps=1+!!p);p&&(p=clearTimeout(p)),H&&(I.taps<2&&(f=U[0],p=setTimeout(function(){p=null},h)),Cf(this),I.start())}}function R(P,...L){if(this.__zooming){var T=j(this,L).event(P),O=P.changedTouches,I=O.length,H,_,Y,U;for(lc(P),H=0;H<I;++H)_=O[H],Y=bs(_,this),T.touch0&&T.touch0[2]===_.identifier?T.touch0[0]=Y:T.touch1&&T.touch1[2]===_.identifier&&(T.touch1[0]=Y);if(_=T.that.__zoom,T.touch1){var V=T.touch0[0],Z=T.touch0[1],ue=T.touch1[0],le=T.touch1[1],we=(we=ue[0]-V[0])*we+(we=ue[1]-V[1])*we,re=(re=le[0]-Z[0])*re+(re=le[1]-Z[1])*re;_=b(_,Math.sqrt(we/re)),Y=[(V[0]+ue[0])/2,(V[1]+ue[1])/2],U=[(Z[0]+le[0])/2,(Z[1]+le[1])/2]}else if(T.touch0)Y=T.touch0[0],U=T.touch0[1];else return;T.zoom("touch",n(x(_,Y,U),T.extent,o))}}function $(P,...L){if(this.__zooming){var T=j(this,L).event(P),O=P.changedTouches,I=O.length,H,_;for(bm(P),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),H=0;H<I;++H)_=O[H],T.touch0&&T.touch0[2]===_.identifier?delete T.touch0:T.touch1&&T.touch1[2]===_.identifier&&delete T.touch1;if(T.touch1&&!T.touch0&&(T.touch0=T.touch1,delete T.touch1),T.touch0)T.touch0[1]=this.__zoom.invert(T.touch0[0]);else if(T.end(),T.taps===2&&(_=bs(_,this),Math.hypot(f[0]-_[0],f[1]-_[1])<k)){var Y=Mr(this).on("dblclick.zoom");Y&&Y.apply(this,arguments)}}}return g.wheelDelta=function(P){return arguments.length?(r=typeof P=="function"?P:Fd(+P),g):r},g.filter=function(P){return arguments.length?(e=typeof P=="function"?P:Fd(!!P),g):e},g.touchable=function(P){return arguments.length?(s=typeof P=="function"?P:Fd(!!P),g):s},g.extent=function(P){return arguments.length?(t=typeof P=="function"?P:Fd([[+P[0][0],+P[0][1]],[+P[1][0],+P[1][1]]]),g):t},g.scaleExtent=function(P){return arguments.length?(i[0]=+P[0],i[1]=+P[1],g):[i[0],i[1]]},g.translateExtent=function(P){return arguments.length?(o[0][0]=+P[0][0],o[1][0]=+P[1][0],o[0][1]=+P[0][1],o[1][1]=+P[1][1],g):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},g.constrain=function(P){return arguments.length?(n=P,g):n},g.duration=function(P){return arguments.length?(l=+P,g):l},g.interpolate=function(P){return arguments.length?(c=P,g):c},g.on=function(){var P=u.on.apply(u,arguments);return P===u?g:P},g.clickDistance=function(P){return arguments.length?(w=(P=+P)*P,g):Math.sqrt(w)},g.tapDistance=function(P){return arguments.length?(k=+P,g):k},g}const Gs={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."},fu=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],lE=["Enter"," ","Escape"],cE={"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 hl;(function(e){e.Strict="strict",e.Loose="loose"})(hl||(hl={}));var $o;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})($o||($o={}));var pu;(function(e){e.Partial="partial",e.Full="full"})(pu||(pu={}));const uE={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Hi;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Hi||(Hi={}));var fi;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(fi||(fi={}));var $e;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})($e||($e={}));const Y0={[$e.Left]:$e.Right,[$e.Right]:$e.Left,[$e.Top]:$e.Bottom,[$e.Bottom]:$e.Top};function dE(e){return e===null?null:e?"valid":"invalid"}const fE=e=>"id"in e&&"source"in e&&"target"in e,_D=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Zx=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),$u=(e,t=[0,0])=>{const{width:n,height:r}=Ni(e),s=e.origin??t,i=n*s[0],o=r*s[1];return{x:e.position.x-i,y:e.position.y-o}},PD=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,s)=>{const i=typeof s=="string";let o=!t.nodeLookup&&!i?s:void 0;t.nodeLookup&&(o=i?t.nodeLookup.get(s):Zx(s)?s:t.nodeLookup.get(s.id));const l=o?up(o,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return th(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return nh(n)},Ou=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(s=>{(t.filter===void 0||t.filter(s))&&(n=th(n,up(s)),r=!0)}),r?nh(n):{x:0,y:0,width:0,height:0}},ew=(e,t,[n,r,s]=[0,0,1],i=!1,o=!1)=>{const l={...Fu(t,[n,r,s]),width:t.width/s,height:t.height/s},c=[];for(const u of e.values()){const{measured:p,selectable:f=!0,hidden:d=!1}=u;if(o&&!f||d)continue;const h=p.width??u.width??u.initialWidth??null,y=p.height??u.height??u.initialHeight??null,w=hu(l,gl(u)),k=(h??0)*(y??0),g=i&&w>0;(!u.internals.handleBounds||g||w>=k||u.dragging)&&c.push(u)}return c},AD=(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 ID(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(s=>s.id)):null;return e.forEach(s=>{s.measured.width&&s.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!s.hidden)&&(!r||r.has(s.id))&&n.set(s.id,s)}),n}async function TD({nodes:e,width:t,height:n,panZoom:r,minZoom:s,maxZoom:i},o){if(e.size===0)return Promise.resolve(!0);const l=ID(e,o),c=Ou(l),u=tw(c,t,n,(o==null?void 0:o.minZoom)??s,(o==null?void 0:o.maxZoom)??i,(o==null?void 0:o.padding)??.1);return await r.setViewport(u,{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 pE({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:s,onError:i}){const o=n.get(e),l=o.parentId?n.get(o.parentId):void 0,{x:c,y:u}=l?l.internals.positionAbsolute:{x:0,y:0},p=o.origin??r;let f=o.extent||s;if(o.extent==="parent"&&!o.expandParent)if(!l)i==null||i("005",Gs.error005());else{const h=l.measured.width,y=l.measured.height;h&&y&&(f=[[c,u],[c+h,u+y]])}else l&&yl(o.extent)&&(f=[[o.extent[0][0]+c,o.extent[0][1]+u],[o.extent[1][0]+c,o.extent[1][1]+u]]);const d=yl(f)?Uo(t,f,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&(i==null||i("015",Gs.error015())),{position:{x:d.x-c+(o.measured.width??0)*p[0],y:d.y-u+(o.measured.height??0)*p[1]},positionAbsolute:d}}async function RD({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:s}){const i=new Set(e.map(d=>d.id)),o=[];for(const d of n){if(d.deletable===!1)continue;const h=i.has(d.id),y=!h&&d.parentId&&o.find(w=>w.id===d.parentId);(h||y)&&o.push(d)}const l=new Set(t.map(d=>d.id)),c=r.filter(d=>d.deletable!==!1),p=AD(o,c);for(const d of c)l.has(d.id)&&!p.find(y=>y.id===d.id)&&p.push(d);if(!s)return{edges:p,nodes:o};const f=await s({nodes:o,edges:p});return typeof f=="boolean"?f?{edges:p,nodes:o}:{edges:[],nodes:[]}:f}const ml=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Uo=(e={x:0,y:0},t,n)=>({x:ml(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:ml(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function hE(e,t,n){const{width:r,height:s}=Ni(n),{x:i,y:o}=n.internals.positionAbsolute;return Uo(e,[[i,o],[i+r,o+s]],t)}const G0=(e,t,n)=>e<t?ml(Math.abs(e-t),1,t)/t:e>n?-ml(Math.abs(e-n),1,t)/t:0,mE=(e,t,n=15,r=40)=>{const s=G0(e.x,r,t.width-r)*n,i=G0(e.y,r,t.height-r)*n;return[s,i]},th=(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)}),hy=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),nh=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),gl=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Zx(e)?e.internals.positionAbsolute:$u(e,t);return{x:n,y:r,width:((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},up=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Zx(e)?e.internals.positionAbsolute:$u(e,t);return{x:n,y:r,x2:n+(((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0),y2:r+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},gE=(e,t)=>nh(th(hy(e),hy(t))),hu=(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)},X0=e=>Ns(e.width)&&Ns(e.height)&&Ns(e.x)&&Ns(e.y),Ns=e=>!isNaN(e)&&isFinite(e),MD=(e,t)=>{},Du=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Fu=({x:e,y:t},[n,r,s],i=!1,o=[1,1])=>{const l={x:(e-n)/s,y:(t-r)/s};return i?Du(l,o):l},dp=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r});function va(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 LD(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=va(e,n),s=va(e,t);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof e=="object"){const r=va(e.top??e.y??0,n),s=va(e.bottom??e.y??0,n),i=va(e.left??e.x??0,t),o=va(e.right??e.x??0,t);return{top:r,right:o,bottom:s,left:i,x:i+o,y:r+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function $D(e,t,n,r,s,i){const{x:o,y:l}=dp(e,[t,n,r]),{x:c,y:u}=dp({x:e.x+e.width,y:e.y+e.height},[t,n,r]),p=s-c,f=i-u;return{left:Math.floor(o),top:Math.floor(l),right:Math.floor(p),bottom:Math.floor(f)}}const tw=(e,t,n,r,s,i)=>{const o=LD(i,t,n),l=(t-o.x)/e.width,c=(n-o.y)/e.height,u=Math.min(l,c),p=ml(u,r,s),f=e.x+e.width/2,d=e.y+e.height/2,h=t/2-f*p,y=n/2-d*p,w=$D(e,h,y,p,t,n),k={left:Math.min(w.left-o.left,0),top:Math.min(w.top-o.top,0),right:Math.min(w.right-o.right,0),bottom:Math.min(w.bottom-o.bottom,0)};return{x:h-k.left+k.right,y:y-k.top+k.bottom,zoom:p}},mu=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function yl(e){return e!=null&&e!=="parent"}function Ni(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 yE(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 xE(e,t={width:0,height:0},n,r,s){const i={...e},o=r.get(n);if(o){const l=o.origin||s;i.x+=o.internals.positionAbsolute.x-(t.width??0)*l[0],i.y+=o.internals.positionAbsolute.y-(t.height??0)*l[1]}return i}function J0(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function OD(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}function DD(e){return{...cE,...e||{}}}function $c(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:i,y:o}=js(e),l=Fu({x:i-((s==null?void 0:s.left)??0),y:o-((s==null?void 0:s.top)??0)},r),{x:c,y:u}=n?Du(l,t):l;return{xSnapped:c,ySnapped:u,...l}}const nw=e=>({width:e.offsetWidth,height:e.offsetHeight}),wE=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},FD=["INPUT","SELECT","TEXTAREA"];function bE(e){var r,s;const t=((s=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:s[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:FD.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const vE=e=>"clientX"in e,js=(e,t)=>{var i,o;const n=vE(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,s=n?e.clientY:(o=e.touches)==null?void 0:o[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:s-((t==null?void 0:t.top)??0)}},Q0=(e,t,n,r,s)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(o=>{const l=o.getBoundingClientRect();return{id:o.getAttribute("data-handleid"),type:e,nodeId:s,position:o.getAttribute("data-handlepos"),x:(l.left-n.left)/r,y:(l.top-n.top)/r,...nw(o)}})};function kE({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:s,sourceControlY:i,targetControlX:o,targetControlY:l}){const c=e*.125+s*.375+o*.375+n*.125,u=t*.125+i*.375+l*.375+r*.125,p=Math.abs(c-e),f=Math.abs(u-t);return[c,u,p,f]}function zd(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Z0({pos:e,x1:t,y1:n,x2:r,y2:s,c:i}){switch(e){case $e.Left:return[t-zd(t-r,i),n];case $e.Right:return[t+zd(r-t,i),n];case $e.Top:return[t,n-zd(n-s,i)];case $e.Bottom:return[t,n+zd(s-n,i)]}}function SE({sourceX:e,sourceY:t,sourcePosition:n=$e.Bottom,targetX:r,targetY:s,targetPosition:i=$e.Top,curvature:o=.25}){const[l,c]=Z0({pos:n,x1:e,y1:t,x2:r,y2:s,c:o}),[u,p]=Z0({pos:i,x1:r,y1:s,x2:e,y2:t,c:o}),[f,d,h,y]=kE({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:p});return[`M${e},${t} C${l},${c} ${u},${p} ${r},${s}`,f,d,h,y]}function NE({sourceX:e,sourceY:t,targetX:n,targetY:r}){const s=Math.abs(n-e)/2,i=n<e?n+s:n-s,o=Math.abs(r-t)/2,l=r<t?r+o:r-o;return[i,l,s,o]}function zD({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:s=!1,zIndexMode:i="basic"}){if(i==="manual")return r;const o=s&&n?r+1e3:r,l=Math.max(e.parentId||s&&e.selected?e.internals.z:0,t.parentId||s&&t.selected?t.internals.z:0);return o+l}function HD({sourceNode:e,targetNode:t,width:n,height:r,transform:s}){const i=th(up(e),up(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const o={x:-s[0]/s[2],y:-s[1]/s[2],width:n/s[2],height:r/s[2]};return hu(o,nh(i))>0}const BD=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,WD=(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)),Ef=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||BD;let s;return fE(e)?s={...e}:s={...e,id:r(e)},WD(s,t)?t:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,t.concat(s))};function jE({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,i,o,l]=NE({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,i,o,l]}const ek={[$e.Left]:{x:-1,y:0},[$e.Right]:{x:1,y:0},[$e.Top]:{x:0,y:-1},[$e.Bottom]:{x:0,y:1}},VD=({source:e,sourcePosition:t=$e.Bottom,target:n})=>t===$e.Left||t===$e.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},tk=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function KD({source:e,sourcePosition:t=$e.Bottom,target:n,targetPosition:r=$e.Top,center:s,offset:i,stepPosition:o}){const l=ek[t],c=ek[r],u={x:e.x+l.x*i,y:e.y+l.y*i},p={x:n.x+c.x*i,y:n.y+c.y*i},f=VD({source:u,sourcePosition:t,target:p}),d=f.x!==0?"x":"y",h=f[d];let y=[],w,k;const g={x:0,y:0},b={x:0,y:0},[,,x,S]=NE({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[d]*c[d]===-1){d==="x"?(w=s.x??u.x+(p.x-u.x)*o,k=s.y??(u.y+p.y)/2):(w=s.x??(u.x+p.x)/2,k=s.y??u.y+(p.y-u.y)*o);const A=[{x:w,y:u.y},{x:w,y:p.y}],D=[{x:u.x,y:k},{x:p.x,y:k}];l[d]===h?y=d==="x"?A:D:y=d==="x"?D:A}else{const A=[{x:u.x,y:p.y}],D=[{x:p.x,y:u.y}];if(d==="x"?y=l.x===h?D:A:y=l.y===h?A:D,t===r){const P=Math.abs(e[d]-n[d]);if(P<=i){const L=Math.min(i-1,i-P);l[d]===h?g[d]=(u[d]>e[d]?-1:1)*L:b[d]=(p[d]>n[d]?-1:1)*L}}if(t!==r){const P=d==="x"?"y":"x",L=l[d]===c[P],T=u[P]>p[P],O=u[P]<p[P];(l[d]===1&&(!L&&T||L&&O)||l[d]!==1&&(!L&&O||L&&T))&&(y=d==="x"?A:D)}const W={x:u.x+g.x,y:u.y+g.y},F={x:p.x+b.x,y:p.y+b.y},R=Math.max(Math.abs(W.x-y[0].x),Math.abs(F.x-y[0].x)),$=Math.max(Math.abs(W.y-y[0].y),Math.abs(F.y-y[0].y));R>=$?(w=(W.x+F.x)/2,k=y[0].y):(w=y[0].x,k=(W.y+F.y)/2)}const C={x:u.x+g.x,y:u.y+g.y},j={x:p.x+b.x,y:p.y+b.y};return[[e,...C.x!==y[0].x||C.y!==y[0].y?[C]:[],...y,...j.x!==y[y.length-1].x||j.y!==y[y.length-1].y?[j]:[],n],w,k,x,S]}function UD(e,t,n,r){const s=Math.min(tk(e,t)/2,tk(t,n)/2,r),{x:i,y:o}=t;if(e.x===i&&i===n.x||e.y===o&&o===n.y)return`L${i} ${o}`;if(e.y===o){const u=e.x<n.x?-1:1,p=e.y<n.y?1:-1;return`L ${i+s*u},${o}Q ${i},${o} ${i},${o+s*p}`}const l=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${o+s*c}Q ${i},${o} ${i+s*l},${o}`}function my({sourceX:e,sourceY:t,sourcePosition:n=$e.Bottom,targetX:r,targetY:s,targetPosition:i=$e.Top,borderRadius:o=5,centerX:l,centerY:c,offset:u=20,stepPosition:p=.5}){const[f,d,h,y,w]=KD({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:s},targetPosition:i,center:{x:l,y:c},offset:u,stepPosition:p});let k=`M${f[0].x} ${f[0].y}`;for(let g=1;g<f.length-1;g++)k+=UD(f[g-1],f[g],f[g+1],o);return k+=`L${f[f.length-1].x} ${f[f.length-1].y}`,[k,d,h,y,w]}function nk(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function qD(e){var f;const{sourceNode:t,targetNode:n}=e;if(!nk(t)||!nk(n))return null;const r=t.internals.handleBounds||rk(t.handles),s=n.internals.handleBounds||rk(n.handles),i=sk((r==null?void 0:r.source)??[],e.sourceHandle),o=sk(e.connectionMode===hl.Strict?(s==null?void 0:s.target)??[]:((s==null?void 0:s.target)??[]).concat((s==null?void 0:s.source)??[]),e.targetHandle);if(!i||!o)return(f=e.onError)==null||f.call(e,"008",Gs.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=(i==null?void 0:i.position)||$e.Bottom,c=(o==null?void 0:o.position)||$e.Top,u=qo(t,i,l),p=qo(n,o,c);return{sourceX:u.x,sourceY:u.y,targetX:p.x,targetY:p.y,sourcePosition:l,targetPosition:c}}function rk(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 qo(e,t,n=$e.Left,r=!1){const s=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,i=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:o,height:l}=t??Ni(e);if(r)return{x:s+o/2,y:i+l/2};switch((t==null?void 0:t.position)??n){case $e.Top:return{x:s+o/2,y:i};case $e.Right:return{x:s+o,y:i+l/2};case $e.Bottom:return{x:s+o/2,y:i+l};case $e.Left:return{x:s,y:i+l/2}}}function sk(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function gy(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function YD(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:s}){const i=new Set;return e.reduce((o,l)=>([l.markerStart||r,l.markerEnd||s].forEach(c=>{if(c&&typeof c=="object"){const u=gy(c,t);i.has(u)||(o.push({id:u,color:c.color||n,...c}),i.add(u))}}),o),[]).sort((o,l)=>o.id.localeCompare(l.id))}const CE=1e3,GD=10,rw={nodeOrigin:[0,0],nodeExtent:fu,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},XD={...rw,checkEquality:!0};function sw(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function JD(e,t,n){const r=sw(rw,n);for(const s of e.values())if(s.parentId)ow(s,e,t,r);else{const i=$u(s,r.nodeOrigin),o=yl(s.extent)?s.extent:r.nodeExtent,l=Uo(i,o,Ni(s));s.internals.positionAbsolute=l}}function QD(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const s of e.handles){const i={id:s.id,width:s.width??1,height:s.height??1,nodeId:e.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?n.push(i):s.type==="target"&&r.push(i)}return{source:n,target:r}}function iw(e){return e==="manual"}function yy(e,t,n,r={}){var p,f;const s=sw(XD,r),i={i:0},o=new Map(t),l=s!=null&&s.elevateNodesOnSelect&&!iw(s.zIndexMode)?CE:0;let c=e.length>0,u=!1;t.clear(),n.clear();for(const d of e){let h=o.get(d.id);if(s.checkEquality&&d===(h==null?void 0:h.internals.userNode))t.set(d.id,h);else{const y=$u(d,s.nodeOrigin),w=yl(d.extent)?d.extent:s.nodeExtent,k=Uo(y,w,Ni(d));h={...s.defaults,...d,measured:{width:(p=d.measured)==null?void 0:p.width,height:(f=d.measured)==null?void 0:f.height},internals:{positionAbsolute:k,handleBounds:QD(d,h),z:EE(d,l,s.zIndexMode),userNode:d}},t.set(d.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),d.parentId&&ow(h,t,n,r,i),u||(u=d.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function ZD(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 ow(e,t,n,r,s){const{elevateNodesOnSelect:i,nodeOrigin:o,nodeExtent:l,zIndexMode:c}=sw(rw,r),u=e.parentId,p=t.get(u);if(!p){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}ZD(e,n),s&&!p.parentId&&p.internals.rootParentIndex===void 0&&c==="auto"&&(p.internals.rootParentIndex=++s.i,p.internals.z=p.internals.z+s.i*GD),s&&p.internals.rootParentIndex!==void 0&&(s.i=p.internals.rootParentIndex);const f=i&&!iw(c)?CE:0,{x:d,y:h,z:y}=eF(e,p,o,l,f,c),{positionAbsolute:w}=e.internals,k=d!==w.x||h!==w.y;(k||y!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:k?{x:d,y:h}:w,z:y}})}function EE(e,t,n){const r=Ns(e.zIndex)?e.zIndex:0;return iw(n)?r:r+(e.selected?t:0)}function eF(e,t,n,r,s,i){const{x:o,y:l}=t.internals.positionAbsolute,c=Ni(e),u=$u(e,n),p=yl(e.extent)?Uo(u,e.extent,c):u;let f=Uo({x:o+p.x,y:l+p.y},r,c);e.extent==="parent"&&(f=hE(f,c,t));const d=EE(e,s,i),h=t.internals.z??0;return{x:f.x,y:f.y,z:h>=d?h+1:d}}function aw(e,t,n,r=[0,0]){var o;const s=[],i=new Map;for(const l of e){const c=t.get(l.parentId);if(!c)continue;const u=((o=i.get(l.parentId))==null?void 0:o.expandedRect)??gl(c),p=gE(u,l.rect);i.set(l.parentId,{expandedRect:p,parent:c})}return i.size>0&&i.forEach(({expandedRect:l,parent:c},u)=>{var x;const p=c.internals.positionAbsolute,f=Ni(c),d=c.origin??r,h=l.x<p.x?Math.round(Math.abs(p.x-l.x)):0,y=l.y<p.y?Math.round(Math.abs(p.y-l.y)):0,w=Math.max(f.width,Math.round(l.width)),k=Math.max(f.height,Math.round(l.height)),g=(w-f.width)*d[0],b=(k-f.height)*d[1];(h>0||y>0||g||b)&&(s.push({id:u,type:"position",position:{x:c.position.x-h+g,y:c.position.y-y+b}}),(x=n.get(u))==null||x.forEach(S=>{e.some(C=>C.id===S.id)||s.push({id:S.id,type:"position",position:{x:S.position.x+h,y:S.position.y+y}})})),(f.width<l.width||f.height<l.height||h||y)&&s.push({id:u,type:"dimensions",setAttributes:!0,dimensions:{width:w+(h?d[0]*h-g:0),height:k+(y?d[1]*y-b:0)}})}),s}function tF(e,t,n,r,s,i,o){const l=r==null?void 0:r.querySelector(".xyflow__viewport");let c=!1;if(!l)return{changes:[],updatedInternals:c};const u=[],p=window.getComputedStyle(l),{m22:f}=new window.DOMMatrixReadOnly(p.transform),d=[];for(const h of e.values()){const y=t.get(h.id);if(!y)continue;if(y.hidden){t.set(y.id,{...y,internals:{...y.internals,handleBounds:void 0}}),c=!0;continue}const w=nw(h.nodeElement),k=y.measured.width!==w.width||y.measured.height!==w.height;if(!!(w.width&&w.height&&(k||!y.internals.handleBounds||h.force))){const b=h.nodeElement.getBoundingClientRect(),x=yl(y.extent)?y.extent:i;let{positionAbsolute:S}=y.internals;y.parentId&&y.extent==="parent"?S=hE(S,w,t.get(y.parentId)):x&&(S=Uo(S,x,w));const C={...y,measured:w,internals:{...y.internals,positionAbsolute:S,handleBounds:{source:Q0("source",h.nodeElement,b,f,y.id),target:Q0("target",h.nodeElement,b,f,y.id)}}};t.set(y.id,C),y.parentId&&ow(C,t,n,{nodeOrigin:s,zIndexMode:o}),c=!0,k&&(u.push({id:y.id,type:"dimensions",dimensions:w}),y.expandParent&&y.parentId&&d.push({id:y.id,parentId:y.parentId,rect:gl(C,s)}))}}if(d.length>0){const h=aw(d,t,n,s);u.push(...h)}return{changes:u,updatedInternals:c}}async function nF({delta:e,panZoom:t,transform:n,translateExtent:r,width:s,height:i}){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],[s,i]],r),l=!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2]);return Promise.resolve(l)}function ik(e,t,n,r,s,i){let o=s;const l=r.get(o)||new Map;r.set(o,l.set(n,t)),o=`${s}-${e}`;const c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),i){o=`${s}-${e}-${i}`;const u=r.get(o)||new Map;r.set(o,u.set(n,t))}}function _E(e,t,n){e.clear(),t.clear();for(const r of n){const{source:s,target:i,sourceHandle:o=null,targetHandle:l=null}=r,c={edgeId:r.id,source:s,target:i,sourceHandle:o,targetHandle:l},u=`${s}-${o}--${i}-${l}`,p=`${i}-${l}--${s}-${o}`;ik("source",c,p,e,s,o),ik("target",c,u,e,i,l),t.set(r.id,r)}}function PE(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:PE(n,t):!1}function ok(e,t,n){var s;let r=e;do{if((s=r==null?void 0:r.matches)!=null&&s.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function rF(e,t,n,r){const s=new Map;for(const[i,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!PE(o,e))&&(o.draggable||t&&typeof o.draggable>"u")){const l=e.get(i);l&&s.set(i,{id:i,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return s}function vm({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var o,l,c;const s=[];for(const[u,p]of t){const f=(o=n.get(u))==null?void 0:o.internals.userNode;f&&s.push({...f,position:p.position,dragging:r})}if(!e)return[s[0],s];const i=(l=n.get(e))==null?void 0:l.internals.userNode;return[i?{...i,position:((c=t.get(e))==null?void 0:c.position)||i.position,dragging:r}:s[0],s]}function sF({dragItems:e,snapGrid:t,x:n,y:r}){const s=e.values().next().value;if(!s)return null;const i={x:n-s.distance.x,y:r-s.distance.y},o=Du(i,t);return{x:o.x-i.x,y:o.y-i.y}}function iF({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:s}){let i={x:null,y:null},o=0,l=new Map,c=!1,u={x:0,y:0},p=null,f=!1,d=null,h=!1,y=!1,w=null;function k({noDragClassName:b,handleSelector:x,domNode:S,isSelectable:C,nodeId:j,nodeClickDistance:E=0}){d=Mr(S);function A({x:R,y:$}){const{nodeLookup:P,nodeExtent:L,snapGrid:T,snapToGrid:O,nodeOrigin:I,onNodeDrag:H,onSelectionDrag:_,onError:Y,updateNodePositions:U}=t();i={x:R,y:$};let V=!1;const Z=l.size>1,ue=Z&&L?hy(Ou(l)):null,le=Z&&O?sF({dragItems:l,snapGrid:T,x:R,y:$}):null;for(const[we,re]of l){if(!P.has(we))continue;let ye={x:R-re.distance.x,y:$-re.distance.y};O&&(ye=le?{x:Math.round(ye.x+le.x),y:Math.round(ye.y+le.y)}:Du(ye,T));let te=null;if(Z&&L&&!re.extent&&ue){const{positionAbsolute:pe}=re.internals,De=pe.x-ue.x+L[0][0],He=pe.x+re.measured.width-ue.x2+L[1][0],Ie=pe.y-ue.y+L[0][1],et=pe.y+re.measured.height-ue.y2+L[1][1];te=[[De,Ie],[He,et]]}const{position:ie,positionAbsolute:ce}=pE({nodeId:we,nextPosition:ye,nodeLookup:P,nodeExtent:te||L,nodeOrigin:I,onError:Y});V=V||re.position.x!==ie.x||re.position.y!==ie.y,re.position=ie,re.internals.positionAbsolute=ce}if(y=y||V,!!V&&(U(l,!0),w&&(r||H||!j&&_))){const[we,re]=vm({nodeId:j,dragItems:l,nodeLookup:P});r==null||r(w,l,we,re),H==null||H(w,we,re),j||_==null||_(w,re)}}async function D(){if(!p)return;const{transform:R,panBy:$,autoPanSpeed:P,autoPanOnNodeDrag:L}=t();if(!L){c=!1,cancelAnimationFrame(o);return}const[T,O]=mE(u,p,P);(T!==0||O!==0)&&(i.x=(i.x??0)-T/R[2],i.y=(i.y??0)-O/R[2],await $({x:T,y:O})&&A(i)),o=requestAnimationFrame(D)}function W(R){var Z;const{nodeLookup:$,multiSelectionActive:P,nodesDraggable:L,transform:T,snapGrid:O,snapToGrid:I,selectNodesOnDrag:H,onNodeDragStart:_,onSelectionDragStart:Y,unselectNodesAndEdges:U}=t();f=!0,(!H||!C)&&!P&&j&&((Z=$.get(j))!=null&&Z.selected||U()),C&&H&&j&&(e==null||e(j));const V=$c(R.sourceEvent,{transform:T,snapGrid:O,snapToGrid:I,containerBounds:p});if(i=V,l=rF($,L,V,j),l.size>0&&(n||_||!j&&Y)){const[ue,le]=vm({nodeId:j,dragItems:l,nodeLookup:$});n==null||n(R.sourceEvent,l,ue,le),_==null||_(R.sourceEvent,ue,le),j||Y==null||Y(R.sourceEvent,le)}}const F=UC().clickDistance(E).on("start",R=>{const{domNode:$,nodeDragThreshold:P,transform:L,snapGrid:T,snapToGrid:O}=t();p=($==null?void 0:$.getBoundingClientRect())||null,h=!1,y=!1,w=R.sourceEvent,P===0&&W(R),i=$c(R.sourceEvent,{transform:L,snapGrid:T,snapToGrid:O,containerBounds:p}),u=js(R.sourceEvent,p)}).on("drag",R=>{const{autoPanOnNodeDrag:$,transform:P,snapGrid:L,snapToGrid:T,nodeDragThreshold:O,nodeLookup:I}=t(),H=$c(R.sourceEvent,{transform:P,snapGrid:L,snapToGrid:T,containerBounds:p});if(w=R.sourceEvent,(R.sourceEvent.type==="touchmove"&&R.sourceEvent.touches.length>1||j&&!I.has(j))&&(h=!0),!h){if(!c&&$&&f&&(c=!0,D()),!f){const _=js(R.sourceEvent,p),Y=_.x-u.x,U=_.y-u.y;Math.sqrt(Y*Y+U*U)>O&&W(R)}(i.x!==H.xSnapped||i.y!==H.ySnapped)&&l&&f&&(u=js(R.sourceEvent,p),A(H))}}).on("end",R=>{if(!(!f||h)&&(c=!1,f=!1,cancelAnimationFrame(o),l.size>0)){const{nodeLookup:$,updateNodePositions:P,onNodeDragStop:L,onSelectionDragStop:T}=t();if(y&&(P(l,!1),y=!1),s||L||!j&&T){const[O,I]=vm({nodeId:j,dragItems:l,nodeLookup:$,dragging:!1});s==null||s(R.sourceEvent,l,O,I),L==null||L(R.sourceEvent,O,I),j||T==null||T(R.sourceEvent,I)}}}).filter(R=>{const $=R.target;return!R.button&&(!b||!ok($,`.${b}`,S))&&(!x||ok($,x,S))});d.call(F)}function g(){d==null||d.on(".drag",null)}return{update:k,destroy:g}}function oF(e,t,n){const r=[],s={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())hu(s,gl(i))>0&&r.push(i);return r}const aF=250;function lF(e,t,n,r){var l,c;let s=[],i=1/0;const o=oF(e,n,t+aF);for(const u of o){const p=[...((l=u.internals.handleBounds)==null?void 0:l.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const f of p){if(r.nodeId===f.nodeId&&r.type===f.type&&r.id===f.id)continue;const{x:d,y:h}=qo(u,f,f.position,!0),y=Math.sqrt(Math.pow(d-e.x,2)+Math.pow(h-e.y,2));y>t||(y<i?(s=[{...f,x:d,y:h}],i=y):y===i&&s.push({...f,x:d,y:h}))}}if(!s.length)return null;if(s.length>1){const u=r.type==="source"?"target":"source";return s.find(p=>p.type===u)??s[0]}return s[0]}function AE(e,t,n,r,s,i=!1){var u,p,f;const o=r.get(e);if(!o)return null;const l=s==="strict"?(u=o.internals.handleBounds)==null?void 0:u[t]:[...((p=o.internals.handleBounds)==null?void 0:p.source)??[],...((f=o.internals.handleBounds)==null?void 0:f.target)??[]],c=(n?l==null?void 0:l.find(d=>d.id===n):l==null?void 0:l[0])??null;return c&&i?{...c,...qo(o,c,c.position,!0)}:c}function IE(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function cF(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const TE=()=>!0;function uF(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:s,edgeUpdaterType:i,isTarget:o,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:p,flowId:f,panBy:d,cancelConnection:h,onConnectStart:y,onConnect:w,onConnectEnd:k,isValidConnection:g=TE,onReconnectEnd:b,updateConnection:x,getTransform:S,getFromHandle:C,autoPanSpeed:j,dragThreshold:E=1,handleDomNode:A}){const D=wE(e.target);let W=0,F;const{x:R,y:$}=js(e),P=IE(i,A),L=l==null?void 0:l.getBoundingClientRect();let T=!1;if(!L||!P)return;const O=AE(s,P,r,c,t);if(!O)return;let I=js(e,L),H=!1,_=null,Y=!1,U=null;function V(){if(!p||!L)return;const[ie,ce]=mE(I,L,j);d({x:ie,y:ce}),W=requestAnimationFrame(V)}const Z={...O,nodeId:s,type:P,position:O.position},ue=c.get(s);let we={inProgress:!0,isValid:null,from:qo(ue,Z,$e.Left,!0),fromHandle:Z,fromPosition:Z.position,fromNode:ue,to:I,toHandle:null,toPosition:Y0[Z.position],toNode:null,pointer:I};function re(){T=!0,x(we),y==null||y(e,{nodeId:s,handleId:r,handleType:P})}E===0&&re();function ye(ie){if(!T){const{x:et,y:ut}=js(ie),Ae=et-R,Qe=ut-$;if(!(Ae*Ae+Qe*Qe>E*E))return;re()}if(!C()||!Z){te(ie);return}const ce=S();I=js(ie,L),F=lF(Fu(I,ce,!1,[1,1]),n,c,Z),H||(V(),H=!0);const pe=RE(ie,{handle:F,connectionMode:t,fromNodeId:s,fromHandleId:r,fromType:o?"target":"source",isValidConnection:g,doc:D,lib:u,flowId:f,nodeLookup:c});U=pe.handleDomNode,_=pe.connection,Y=cF(!!F,pe.isValid);const De=c.get(s),He=De?qo(De,Z,$e.Left,!0):we.from,Ie={...we,from:He,isValid:Y,to:pe.toHandle&&Y?dp({x:pe.toHandle.x,y:pe.toHandle.y},ce):I,toHandle:pe.toHandle,toPosition:Y&&pe.toHandle?pe.toHandle.position:Y0[Z.position],toNode:pe.toHandle?c.get(pe.toHandle.nodeId):null,pointer:I};x(Ie),we=Ie}function te(ie){if(!("touches"in ie&&ie.touches.length>0)){if(T){(F||U)&&_&&Y&&(w==null||w(_));const{inProgress:ce,...pe}=we,De={...pe,toPosition:we.toHandle?we.toPosition:null};k==null||k(ie,De),i&&(b==null||b(ie,De))}h(),cancelAnimationFrame(W),H=!1,Y=!1,_=null,U=null,D.removeEventListener("mousemove",ye),D.removeEventListener("mouseup",te),D.removeEventListener("touchmove",ye),D.removeEventListener("touchend",te)}}D.addEventListener("mousemove",ye),D.addEventListener("mouseup",te),D.addEventListener("touchmove",ye),D.addEventListener("touchend",te)}function RE(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:i,doc:o,lib:l,flowId:c,isValidConnection:u=TE,nodeLookup:p}){const f=i==="target",d=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}=js(e),w=o.elementFromPoint(h,y),k=w!=null&&w.classList.contains(`${l}-flow__handle`)?w:d,g={handleDomNode:k,isValid:!1,connection:null,toHandle:null};if(k){const b=IE(void 0,k),x=k.getAttribute("data-nodeid"),S=k.getAttribute("data-handleid"),C=k.classList.contains("connectable"),j=k.classList.contains("connectableend");if(!x||!b)return g;const E={source:f?x:r,sourceHandle:f?S:s,target:f?r:x,targetHandle:f?s:S};g.connection=E;const D=C&&j&&(n===hl.Strict?f&&b==="source"||!f&&b==="target":x!==r||S!==s);g.isValid=D&&u(E),g.toHandle=AE(x,b,S,p,n,!0)}return g}const xy={onPointerDown:uF,isValid:RE};function dF({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const s=Mr(e);function i({translateExtent:l,width:c,height:u,zoomStep:p=1,pannable:f=!0,zoomable:d=!0,inversePan:h=!1}){const y=x=>{if(x.sourceEvent.type!=="wheel"||!t)return;const S=n(),C=x.sourceEvent.ctrlKey&&mu()?10:1,j=-x.sourceEvent.deltaY*(x.sourceEvent.deltaMode===1?.05:x.sourceEvent.deltaMode?1:.002)*p,E=S[2]*Math.pow(2,j*C);t.scaleTo(E)};let w=[0,0];const k=x=>{(x.sourceEvent.type==="mousedown"||x.sourceEvent.type==="touchstart")&&(w=[x.sourceEvent.clientX??x.sourceEvent.touches[0].clientX,x.sourceEvent.clientY??x.sourceEvent.touches[0].clientY])},g=x=>{const S=n();if(x.sourceEvent.type!=="mousemove"&&x.sourceEvent.type!=="touchmove"||!t)return;const C=[x.sourceEvent.clientX??x.sourceEvent.touches[0].clientX,x.sourceEvent.clientY??x.sourceEvent.touches[0].clientY],j=[C[0]-w[0],C[1]-w[1]];w=C;const E=r()*Math.max(S[2],Math.log(S[2]))*(h?-1:1),A={x:S[0]-j[0]*E,y:S[1]-j[1]*E},D=[[0,0],[c,u]];t.setViewportConstrained({x:A.x,y:A.y,zoom:S[2]},D,l)},b=aE().on("start",k).on("zoom",f?g:null).on("zoom.wheel",d?y:null);s.call(b,{})}function o(){s.on("zoom",null)}return{update:i,destroy:o,pointer:bs}}const rh=e=>({x:e.x,y:e.y,zoom:e.k}),km=({x:e,y:t,zoom:n})=>eh.translate(e,t).scale(n),Ba=(e,t)=>e.target.closest(`.${t}`),ME=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),fF=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Sm=(e,t=0,n=fF,r=()=>{})=>{const s=typeof t=="number"&&t>0;return s||r(),s?e.transition().duration(t).ease(n).on("end",r):e},LE=e=>{const t=e.ctrlKey&&mu()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function pF({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:i,zoomOnPinch:o,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return p=>{if(Ba(p,t))return p.ctrlKey&&p.preventDefault(),!1;p.preventDefault(),p.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(p.ctrlKey&&o){const k=bs(p),g=LE(p),b=f*Math.pow(2,g);r.scaleTo(n,b,k,p);return}const d=p.deltaMode===1?20:1;let h=s===$o.Vertical?0:p.deltaX*d,y=s===$o.Horizontal?0:p.deltaY*d;!mu()&&p.shiftKey&&s!==$o.Vertical&&(h=p.deltaY*d,y=0),r.translateBy(n,-(h/f)*i,-(y/f)*i,{internal:!0});const w=rh(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(p,w),e.panScrollTimeout=setTimeout(()=>{u==null||u(p,w),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(p,w))}}function hF({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,s){const i=r.type==="wheel",o=!t&&i&&!r.ctrlKey,l=Ba(r,e);if(r.ctrlKey&&i&&l&&r.preventDefault(),o||l)return null;r.preventDefault(),n.call(this,r,s)}}function mF({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,o,l;if((i=r.sourceEvent)!=null&&i.internal)return;const s=rh(r.transform);e.mouseButton=((o=r.sourceEvent)==null?void 0:o.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=s,((l=r.sourceEvent)==null?void 0:l.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,s))}}function gF({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return i=>{var o,l;e.usedRightMouseButton=!!(n&&ME(t,e.mouseButton??0)),(o=i.sourceEvent)!=null&&o.sync||r([i.transform.x,i.transform.y,i.transform.k]),s&&!((l=i.sourceEvent)!=null&&l.internal)&&(s==null||s(i.sourceEvent,rh(i.transform)))}}function yF({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:s,onPaneContextMenu:i}){return o=>{var l;if(!((l=o.sourceEvent)!=null&&l.internal)&&(e.isZoomingOrPanning=!1,i&&ME(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&i(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),s)){const c=rh(o.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(o.sourceEvent,c)},n?150:0)}}}function xF({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:i,userSelectionActive:o,noWheelClassName:l,noPanClassName:c,lib:u,connectionInProgress:p}){return f=>{var k;const d=e||t,h=n&&f.ctrlKey,y=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(Ba(f,`${u}-flow__node`)||Ba(f,`${u}-flow__edge`)))return!0;if(!r&&!d&&!s&&!i&&!n||o||p&&!y||Ba(f,l)&&y||Ba(f,c)&&(!y||s&&y&&!e)||!n&&f.ctrlKey&&y)return!1;if(!n&&f.type==="touchstart"&&((k=f.touches)==null?void 0:k.length)>1)return f.preventDefault(),!1;if(!d&&!s&&!h&&y||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const w=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||y)&&w}}function wF({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:s,onPanZoom:i,onPanZoomStart:o,onPanZoomEnd:l,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},p=e.getBoundingClientRect(),f=aE().scaleExtent([t,n]).translateExtent(r),d=Mr(e).call(f);b({x:s.x,y:s.y,zoom:ml(s.zoom,t,n)},[[0,0],[p.width,p.height]],r);const h=d.on("wheel.zoom"),y=d.on("dblclick.zoom");f.wheelDelta(LE);function w(F,R){return d?new Promise($=>{f==null||f.interpolate((R==null?void 0:R.interpolate)==="linear"?Lc:Sf).transform(Sm(d,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>$(!0)),F)}):Promise.resolve(!1)}function k({noWheelClassName:F,noPanClassName:R,onPaneContextMenu:$,userSelectionActive:P,panOnScroll:L,panOnDrag:T,panOnScrollMode:O,panOnScrollSpeed:I,preventScrolling:H,zoomOnPinch:_,zoomOnScroll:Y,zoomOnDoubleClick:U,zoomActivationKeyPressed:V,lib:Z,onTransformChange:ue,connectionInProgress:le,paneClickDistance:we,selectionOnDrag:re}){P&&!u.isZoomingOrPanning&&g();const ye=L&&!V&&!P;f.clickDistance(re?1/0:!Ns(we)||we<0?0:we);const te=ye?pF({zoomPanValues:u,noWheelClassName:F,d3Selection:d,d3Zoom:f,panOnScrollMode:O,panOnScrollSpeed:I,zoomOnPinch:_,onPanZoomStart:o,onPanZoom:i,onPanZoomEnd:l}):hF({noWheelClassName:F,preventScrolling:H,d3ZoomHandler:h});if(d.on("wheel.zoom",te,{passive:!1}),!P){const ce=mF({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:o});f.on("start",ce);const pe=gF({zoomPanValues:u,panOnDrag:T,onPaneContextMenu:!!$,onPanZoom:i,onTransformChange:ue});f.on("zoom",pe);const De=yF({zoomPanValues:u,panOnDrag:T,panOnScroll:L,onPaneContextMenu:$,onPanZoomEnd:l,onDraggingChange:c});f.on("end",De)}const ie=xF({zoomActivationKeyPressed:V,panOnDrag:T,zoomOnScroll:Y,panOnScroll:L,zoomOnDoubleClick:U,zoomOnPinch:_,userSelectionActive:P,noPanClassName:R,noWheelClassName:F,lib:Z,connectionInProgress:le});f.filter(ie),U?d.on("dblclick.zoom",y):d.on("dblclick.zoom",null)}function g(){f.on("zoom",null)}async function b(F,R,$){const P=km(F),L=f==null?void 0:f.constrain()(P,R,$);return L&&await w(L),new Promise(T=>T(L))}async function x(F,R){const $=km(F);return await w($,R),new Promise(P=>P($))}function S(F){if(d){const R=km(F),$=d.property("__zoom");($.k!==F.zoom||$.x!==F.x||$.y!==F.y)&&(f==null||f.transform(d,R,null,{sync:!0}))}}function C(){const F=d?oE(d.node()):{x:0,y:0,k:1};return{x:F.x,y:F.y,zoom:F.k}}function j(F,R){return d?new Promise($=>{f==null||f.interpolate((R==null?void 0:R.interpolate)==="linear"?Lc:Sf).scaleTo(Sm(d,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>$(!0)),F)}):Promise.resolve(!1)}function E(F,R){return d?new Promise($=>{f==null||f.interpolate((R==null?void 0:R.interpolate)==="linear"?Lc:Sf).scaleBy(Sm(d,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>$(!0)),F)}):Promise.resolve(!1)}function A(F){f==null||f.scaleExtent(F)}function D(F){f==null||f.translateExtent(F)}function W(F){const R=!Ns(F)||F<0?0:F;f==null||f.clickDistance(R)}return{update:k,destroy:g,setViewport:x,setViewportConstrained:b,getViewport:C,scaleTo:j,scaleBy:E,setScaleExtent:A,setTranslateExtent:D,syncViewport:S,setClickDistance:W}}var xl;(function(e){e.Line="line",e.Handle="handle"})(xl||(xl={}));function bF({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:s,affectsY:i}){const o=e-t,l=n-r,c=[o>0?1:o<0?-1:0,l>0?1:l<0?-1:0];return o&&s&&(c[0]=c[0]*-1),l&&i&&(c[1]=c[1]*-1),c}function ak(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),s=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:s}}function Ri(e,t){return Math.max(0,t-e)}function Mi(e,t){return Math.max(0,e-t)}function Hd(e,t,n){return Math.max(0,t-e,e-n)}function lk(e,t){return e?!t:t}function vF(e,t,n,r,s,i,o,l){let{affectsX:c,affectsY:u}=t;const{isHorizontal:p,isVertical:f}=t,d=p&&f,{xSnapped:h,ySnapped:y}=n,{minWidth:w,maxWidth:k,minHeight:g,maxHeight:b}=r,{x,y:S,width:C,height:j,aspectRatio:E}=e;let A=Math.floor(p?h-e.pointerX:0),D=Math.floor(f?y-e.pointerY:0);const W=C+(c?-A:A),F=j+(u?-D:D),R=-i[0]*C,$=-i[1]*j;let P=Hd(W,w,k),L=Hd(F,g,b);if(o){let I=0,H=0;c&&A<0?I=Ri(x+A+R,o[0][0]):!c&&A>0&&(I=Mi(x+W+R,o[1][0])),u&&D<0?H=Ri(S+D+$,o[0][1]):!u&&D>0&&(H=Mi(S+F+$,o[1][1])),P=Math.max(P,I),L=Math.max(L,H)}if(l){let I=0,H=0;c&&A>0?I=Mi(x+A,l[0][0]):!c&&A<0&&(I=Ri(x+W,l[1][0])),u&&D>0?H=Mi(S+D,l[0][1]):!u&&D<0&&(H=Ri(S+F,l[1][1])),P=Math.max(P,I),L=Math.max(L,H)}if(s){if(p){const I=Hd(W/E,g,b)*E;if(P=Math.max(P,I),o){let H=0;!c&&!u||c&&!u&&d?H=Mi(S+$+W/E,o[1][1])*E:H=Ri(S+$+(c?A:-A)/E,o[0][1])*E,P=Math.max(P,H)}if(l){let H=0;!c&&!u||c&&!u&&d?H=Ri(S+W/E,l[1][1])*E:H=Mi(S+(c?A:-A)/E,l[0][1])*E,P=Math.max(P,H)}}if(f){const I=Hd(F*E,w,k)/E;if(L=Math.max(L,I),o){let H=0;!c&&!u||u&&!c&&d?H=Mi(x+F*E+R,o[1][0])/E:H=Ri(x+(u?D:-D)*E+R,o[0][0])/E,L=Math.max(L,H)}if(l){let H=0;!c&&!u||u&&!c&&d?H=Ri(x+F*E,l[1][0])/E:H=Mi(x+(u?D:-D)*E,l[0][0])/E,L=Math.max(L,H)}}}D=D+(D<0?L:-L),A=A+(A<0?P:-P),s&&(d?W>F*E?D=(lk(c,u)?-A:A)/E:A=(lk(c,u)?-D:D)*E:p?(D=A/E,u=c):(A=D*E,c=u));const T=c?x+A:x,O=u?S+D:S;return{width:C+(c?-A:A),height:j+(u?-D:D),x:i[0]*A*(c?-1:1)+T,y:i[1]*D*(u?-1:1)+O}}const $E={width:0,height:0,x:0,y:0},kF={...$E,pointerX:0,pointerY:0,aspectRatio:1};function SF(e){return[[0,0],[e.measured.width,e.measured.height]]}function NF(e,t,n){const r=t.position.x+e.position.x,s=t.position.y+e.position.y,i=e.measured.width??0,o=e.measured.height??0,l=n[0]*i,c=n[1]*o;return[[r-l,s-c],[r+i-l,s+o-c]]}function jF({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:s}){const i=Mr(e);let o={controlDirection:ak("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:u,boundaries:p,keepAspectRatio:f,resizeDirection:d,onResizeStart:h,onResize:y,onResizeEnd:w,shouldResize:k}){let g={...$E},b={...kF};o={boundaries:p,resizeDirection:d,keepAspectRatio:f,controlDirection:ak(u)};let x,S=null,C=[],j,E,A,D=!1;const W=UC().on("start",F=>{const{nodeLookup:R,transform:$,snapGrid:P,snapToGrid:L,nodeOrigin:T,paneDomNode:O}=n();if(x=R.get(t),!x)return;S=(O==null?void 0:O.getBoundingClientRect())??null;const{xSnapped:I,ySnapped:H}=$c(F.sourceEvent,{transform:$,snapGrid:P,snapToGrid:L,containerBounds:S});g={width:x.measured.width??0,height:x.measured.height??0,x:x.position.x??0,y:x.position.y??0},b={...g,pointerX:I,pointerY:H,aspectRatio:g.width/g.height},j=void 0,x.parentId&&(x.extent==="parent"||x.expandParent)&&(j=R.get(x.parentId),E=j&&x.extent==="parent"?SF(j):void 0),C=[],A=void 0;for(const[_,Y]of R)if(Y.parentId===t&&(C.push({id:_,position:{...Y.position},extent:Y.extent}),Y.extent==="parent"||Y.expandParent)){const U=NF(Y,x,Y.origin??T);A?A=[[Math.min(U[0][0],A[0][0]),Math.min(U[0][1],A[0][1])],[Math.max(U[1][0],A[1][0]),Math.max(U[1][1],A[1][1])]]:A=U}h==null||h(F,{...g})}).on("drag",F=>{const{transform:R,snapGrid:$,snapToGrid:P,nodeOrigin:L}=n(),T=$c(F.sourceEvent,{transform:R,snapGrid:$,snapToGrid:P,containerBounds:S}),O=[];if(!x)return;const{x:I,y:H,width:_,height:Y}=g,U={},V=x.origin??L,{width:Z,height:ue,x:le,y:we}=vF(b,o.controlDirection,T,o.boundaries,o.keepAspectRatio,V,E,A),re=Z!==_,ye=ue!==Y,te=le!==I&&re,ie=we!==H&&ye;if(!te&&!ie&&!re&&!ye)return;if((te||ie||V[0]===1||V[1]===1)&&(U.x=te?le:g.x,U.y=ie?we:g.y,g.x=U.x,g.y=U.y,C.length>0)){const He=le-I,Ie=we-H;for(const et of C)et.position={x:et.position.x-He+V[0]*(Z-_),y:et.position.y-Ie+V[1]*(ue-Y)},O.push(et)}if((re||ye)&&(U.width=re&&(!o.resizeDirection||o.resizeDirection==="horizontal")?Z:g.width,U.height=ye&&(!o.resizeDirection||o.resizeDirection==="vertical")?ue:g.height,g.width=U.width,g.height=U.height),j&&x.expandParent){const He=V[0]*(U.width??0);U.x&&U.x<He&&(g.x=He,b.x=b.x-(U.x-He));const Ie=V[1]*(U.height??0);U.y&&U.y<Ie&&(g.y=Ie,b.y=b.y-(U.y-Ie))}const ce=bF({width:g.width,prevWidth:_,height:g.height,prevHeight:Y,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),pe={...g,direction:ce};(k==null?void 0:k(F,pe))!==!1&&(D=!0,y==null||y(F,pe),r(U,O))}).on("end",F=>{D&&(w==null||w(F,{...g}),s==null||s({...g}),D=!1)});i.call(W)}function c(){i.on(".drag",null)}return{update:l,destroy:c}}var OE={exports:{}},DE={},FE={exports:{}},zE={};/**
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 wl=m;function CF(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var EF=typeof Object.is=="function"?Object.is:CF,_F=wl.useState,PF=wl.useEffect,AF=wl.useLayoutEffect,IF=wl.useDebugValue;function TF(e,t){var n=t(),r=_F({inst:{value:n,getSnapshot:t}}),s=r[0].inst,i=r[1];return AF(function(){s.value=n,s.getSnapshot=t,Nm(s)&&i({inst:s})},[e,n,t]),PF(function(){return Nm(s)&&i({inst:s}),e(function(){Nm(s)&&i({inst:s})})},[e]),IF(n),n}function Nm(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!EF(e,n)}catch{return!0}}function RF(e,t){return t()}var MF=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?RF:TF;zE.useSyncExternalStore=wl.useSyncExternalStore!==void 0?wl.useSyncExternalStore:MF;FE.exports=zE;var HE=FE.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 sh=m,LF=HE;function $F(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var OF=typeof Object.is=="function"?Object.is:$F,DF=LF.useSyncExternalStore,FF=sh.useRef,zF=sh.useEffect,HF=sh.useMemo,BF=sh.useDebugValue;DE.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var i=FF(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=HF(function(){function c(h){if(!u){if(u=!0,p=h,h=r(h),s!==void 0&&o.hasValue){var y=o.value;if(s(y,h))return f=y}return f=h}if(y=f,OF(p,h))return y;var w=r(h);return s!==void 0&&s(y,w)?(p=h,y):(p=h,f=w)}var u=!1,p,f,d=n===void 0?null:n;return[function(){return c(t())},d===null?void 0:function(){return c(d())}]},[t,n,r,s]);var l=DF(e,i[0],i[1]);return zF(function(){o.hasValue=!0,o.value=l},[l]),BF(l),l};OE.exports=DE;var WF=OE.exports;const VF=oo(WF),KF={},ck=e=>{let t;const n=new Set,r=(p,f)=>{const d=typeof p=="function"?p(t):p;if(!Object.is(d,t)){const h=t;t=f??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(y=>y(t,h))}},s=()=>t,c={setState:r,getState:s,getInitialState:()=>u,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(KF?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=t=e(r,s,c);return c},UF=e=>e?ck(e):ck,{useDebugValue:qF}=Ye,{useSyncExternalStoreWithSelector:YF}=VF,GF=e=>e;function BE(e,t=GF,n){const r=YF(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return qF(r),r}const uk=(e,t)=>{const n=UF(e),r=(s,i=t)=>BE(n,s,i);return Object.assign(r,n),r},XF=(e,t)=>e?uk(e,t):uk;function en(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,s]of e)if(!Object.is(s,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const ih=m.createContext(null),JF=ih.Provider,WE=Gs.error001();function vt(e,t){const n=m.useContext(ih);if(n===null)throw new Error(WE);return BE(n,e,t)}function Ut(){const e=m.useContext(ih);if(e===null)throw new Error(WE);return m.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const dk={display:"none"},QF={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},VE="react-flow__node-desc",KE="react-flow__edge-desc",ZF="react-flow__aria-live",ez=e=>e.ariaLiveMessage,tz=e=>e.ariaLabelConfig;function nz({rfId:e}){const t=vt(ez);return a.jsx("div",{id:`${ZF}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:QF,children:t})}function rz({rfId:e,disableKeyboardA11y:t}){const n=vt(tz);return a.jsxs(a.Fragment,{children:[a.jsx("div",{id:`${VE}-${e}`,style:dk,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),a.jsx("div",{id:`${KE}-${e}`,style:dk,children:n["edge.a11yDescription.default"]}),!t&&a.jsx(nz,{rfId:e})]})}const oh=m.forwardRef(({position:e="top-left",children:t,className:n,style:r,...s},i)=>{const o=`${e}`.split("-");return a.jsx("div",{className:vn(["react-flow__panel",n,...o]),style:r,ref:i,...s,children:t})});oh.displayName="Panel";function sz({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:a.jsx(oh,{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 iz=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}},Bd=e=>e.id;function oz(e,t){return en(e.selectedNodes.map(Bd),t.selectedNodes.map(Bd))&&en(e.selectedEdges.map(Bd),t.selectedEdges.map(Bd))}function az({onSelectionChange:e}){const t=Ut(),{selectedNodes:n,selectedEdges:r}=vt(iz,oz);return m.useEffect(()=>{const s={nodes:n,edges:r};e==null||e(s),t.getState().onSelectionChangeHandlers.forEach(i=>i(s))},[n,r,e]),null}const lz=e=>!!e.onSelectionChangeHandlers;function cz({onSelectionChange:e}){const t=vt(lz);return e||t?a.jsx(az,{onSelectionChange:e}):null}const wy=typeof window<"u"?m.useLayoutEffect:m.useEffect,UE=[0,0],uz={x:0,y:0,zoom:1},dz=["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"],fk=[...dz,"rfId"],fz=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}),pk={translateExtent:fu,nodeOrigin:UE,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function pz(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:s,setTranslateExtent:i,setNodeExtent:o,reset:l,setDefaultNodesAndEdges:c}=vt(fz,en),u=Ut();wy(()=>(c(e.defaultNodes,e.defaultEdges),()=>{p.current=pk,l()}),[]);const p=m.useRef(pk);return wy(()=>{for(const f of fk){const d=e[f],h=p.current[f];d!==h&&(typeof e[f]>"u"||(f==="nodes"?t(d):f==="edges"?n(d):f==="minZoom"?r(d):f==="maxZoom"?s(d):f==="translateExtent"?i(d):f==="nodeExtent"?o(d):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:DD(d)}):f==="fitView"?u.setState({fitViewQueued:d}):f==="fitViewOptions"?u.setState({fitViewOptions:d}):u.setState({[f]:d})))}p.current=e},fk.map(f=>e[f])),null}function hk(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function hz(e){var r;const[t,n]=m.useState(e==="system"?null:e);return m.useEffect(()=>{if(e!=="system"){n(e);return}const s=hk(),i=()=>n(s!=null&&s.matches?"dark":"light");return i(),s==null||s.addEventListener("change",i),()=>{s==null||s.removeEventListener("change",i)}},[e]),t!==null?t:(r=hk())!=null&&r.matches?"dark":"light"}const mk=typeof document<"u"?document:null;function gu(e=null,t={target:mk,actInsideInputWithModifier:!0}){const[n,r]=m.useState(!1),s=m.useRef(!1),i=m.useRef(new Set([])),[o,l]=m.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
61
- `).replace(`
62
-
63
- `,`
64
- +`).split(`
65
- `)),p=u.reduce((f,d)=>f.concat(...d),[]);return[u,p]}return[[],[]]},[e]);return m.useEffect(()=>{const c=(t==null?void 0:t.target)??mk,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const p=h=>{var k,g;if(s.current=h.ctrlKey||h.metaKey||h.shiftKey||h.altKey,(!s.current||s.current&&!u)&&bE(h))return!1;const w=yk(h.code,l);if(i.current.add(h[w]),gk(o,i.current,!1)){const b=((g=(k=h.composedPath)==null?void 0:k.call(h))==null?void 0:g[0])||h.target,x=(b==null?void 0:b.nodeName)==="BUTTON"||(b==null?void 0:b.nodeName)==="A";t.preventDefault!==!1&&(s.current||!x)&&h.preventDefault(),r(!0)}},f=h=>{const y=yk(h.code,l);gk(o,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(h[y]),h.key==="Meta"&&i.current.clear(),s.current=!1},d=()=>{i.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",p),c==null||c.addEventListener("keyup",f),window.addEventListener("blur",d),window.addEventListener("contextmenu",d),()=>{c==null||c.removeEventListener("keydown",p),c==null||c.removeEventListener("keyup",f),window.removeEventListener("blur",d),window.removeEventListener("contextmenu",d)}}},[e,r]),n}function gk(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function yk(e,t){return t.includes(e)?"code":"key"}const mz=()=>{const e=Ut();return m.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,s,i],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??s,zoom:t.zoom??i},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:s,minZoom:i,maxZoom:o,panZoom:l}=e.getState(),c=tw(t,r,s,i,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:s,snapToGrid:i,domNode:o}=e.getState();if(!o)return t;const{x:l,y:c}=o.getBoundingClientRect(),u={x:t.x-l,y:t.y-c},p=n.snapGrid??s,f=n.snapToGrid??i;return Fu(u,r,f,p)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:s,y:i}=r.getBoundingClientRect(),o=dp(t,n);return{x:o.x+s,y:o.y+i}}}),[])};function qE(e,t){const n=[],r=new Map,s=[];for(const i of e)if(i.type==="add"){s.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const o=r.get(i.id);o?o.push(i):r.set(i.id,[i])}for(const i of t){const o=r.get(i.id);if(!o){n.push(i);continue}if(o[0].type==="remove")continue;if(o[0].type==="replace"){n.push({...o[0].item});continue}const l={...i};for(const c of o)gz(c,l);n.push(l)}return s.length&&s.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function gz(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 fp(e,t){return qE(e,t)}function lw(e,t){return qE(e,t)}function ko(e,t){return{id:e,type:"select",selected:t}}function Wa(e,t=new Set,n=!1){const r=[];for(const[s,i]of e){const o=t.has(s);!(i.selected===void 0&&!o)&&i.selected!==o&&(n&&(i.selected=o),r.push(ko(i.id,o)))}return r}function xk({items:e=[],lookup:t}){var s;const n=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,o]of e.entries()){const l=t.get(o.id),c=((s=l==null?void 0:l.internals)==null?void 0:s.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:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function wk(e){return{id:e.id,type:"remove"}}const bk=e=>_D(e),yz=e=>fE(e);function YE(e){return m.forwardRef(e)}function vk(e){const[t,n]=m.useState(BigInt(0)),[r]=m.useState(()=>xz(()=>n(s=>s+BigInt(1))));return wy(()=>{const s=r.get();s.length&&(e(s),r.reset())},[t]),r}function xz(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const GE=m.createContext(null);function wz({children:e}){const t=Ut(),n=m.useCallback(l=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:p,onNodesChange:f,nodeLookup:d,fitViewQueued:h,onNodesChangeMiddlewareMap:y}=t.getState();let w=c;for(const g of l)w=typeof g=="function"?g(w):g;let k=xk({items:w,lookup:d});for(const g of y.values())k=g(k);p&&u(w),k.length>0?f==null||f(k):h&&window.requestAnimationFrame(()=>{const{fitViewQueued:g,nodes:b,setNodes:x}=t.getState();g&&x(b)})},[]),r=vk(n),s=m.useCallback(l=>{const{edges:c=[],setEdges:u,hasDefaultEdges:p,onEdgesChange:f,edgeLookup:d}=t.getState();let h=c;for(const y of l)h=typeof y=="function"?y(h):y;p?u(h):f&&f(xk({items:h,lookup:d}))},[]),i=vk(s),o=m.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return a.jsx(GE.Provider,{value:o,children:e})}function bz(){const e=m.useContext(GE);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const vz=e=>!!e.panZoom;function El(){const e=mz(),t=Ut(),n=bz(),r=vt(vz),s=m.useMemo(()=>{const i=f=>t.getState().nodeLookup.get(f),o=f=>{n.nodeQueue.push(f)},l=f=>{n.edgeQueue.push(f)},c=f=>{var g,b;const{nodeLookup:d,nodeOrigin:h}=t.getState(),y=bk(f)?f:d.get(f.id),w=y.parentId?xE(y.position,y.measured,y.parentId,d,h):y.position,k={...y,position:w,width:((g=y.measured)==null?void 0:g.width)??y.width,height:((b=y.measured)==null?void 0:b.height)??y.height};return gl(k)},u=(f,d,h={replace:!1})=>{o(y=>y.map(w=>{if(w.id===f){const k=typeof d=="function"?d(w):d;return h.replace&&bk(k)?k:{...w,...k}}return w}))},p=(f,d,h={replace:!1})=>{l(y=>y.map(w=>{if(w.id===f){const k=typeof d=="function"?d(w):d;return h.replace&&yz(k)?k:{...w,...k}}return w}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var d;return(d=i(f))==null?void 0:d.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(d=>({...d}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:o,setEdges:l,addNodes:f=>{const d=Array.isArray(f)?f:[f];n.nodeQueue.push(h=>[...h,...d])},addEdges:f=>{const d=Array.isArray(f)?f:[f];n.edgeQueue.push(h=>[...h,...d])},toObject:()=>{const{nodes:f=[],edges:d=[],transform:h}=t.getState(),[y,w,k]=h;return{nodes:f.map(g=>({...g})),edges:d.map(g=>({...g})),viewport:{x:y,y:w,zoom:k}}},deleteElements:async({nodes:f=[],edges:d=[]})=>{const{nodes:h,edges:y,onNodesDelete:w,onEdgesDelete:k,triggerNodeChanges:g,triggerEdgeChanges:b,onDelete:x,onBeforeDelete:S}=t.getState(),{nodes:C,edges:j}=await RD({nodesToRemove:f,edgesToRemove:d,nodes:h,edges:y,onBeforeDelete:S}),E=j.length>0,A=C.length>0;if(E){const D=j.map(wk);k==null||k(j),b(D)}if(A){const D=C.map(wk);w==null||w(C),g(D)}return(A||E)&&(x==null||x({nodes:C,edges:j})),{deletedNodes:C,deletedEdges:j}},getIntersectingNodes:(f,d=!0,h)=>{const y=X0(f),w=y?f:c(f),k=h!==void 0;return w?(h||t.getState().nodes).filter(g=>{const b=t.getState().nodeLookup.get(g.id);if(b&&!y&&(g.id===f.id||!b.internals.positionAbsolute))return!1;const x=gl(k?g:b),S=hu(x,w);return d&&S>0||S>=x.width*x.height||S>=w.width*w.height}):[]},isNodeIntersecting:(f,d,h=!0)=>{const w=X0(f)?f:c(f);if(!w)return!1;const k=hu(w,d);return h&&k>0||k>=d.width*d.height||k>=w.width*w.height},updateNode:u,updateNodeData:(f,d,h={replace:!1})=>{u(f,y=>{const w=typeof d=="function"?d(y):d;return h.replace?{...y,data:w}:{...y,data:{...y.data,...w}}},h)},updateEdge:p,updateEdgeData:(f,d,h={replace:!1})=>{p(f,y=>{const w=typeof d=="function"?d(y):d;return h.replace?{...y,data:w}:{...y,data:{...y.data,...w}}},h)},getNodesBounds:f=>{const{nodeLookup:d,nodeOrigin:h}=t.getState();return PD(f,{nodeLookup:d,nodeOrigin:h})},getHandleConnections:({type:f,id:d,nodeId:h})=>{var y;return Array.from(((y=t.getState().connectionLookup.get(`${h}-${f}${d?`-${d}`:""}`))==null?void 0:y.values())??[])},getNodeConnections:({type:f,handleId:d,nodeId:h})=>{var y;return Array.from(((y=t.getState().connectionLookup.get(`${h}${f?d?`-${f}-${d}`:`-${f}`:""}`))==null?void 0:y.values())??[])},fitView:async f=>{const d=t.getState().fitViewResolver??OD();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:d}),n.nodeQueue.push(h=>[...h]),d.promise}}},[]);return m.useMemo(()=>({...s,...e,viewportInitialized:r}),[r])}const kk=e=>e.selected,kz=typeof window<"u"?window:void 0;function Sz({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=Ut(),{deleteElements:r}=El(),s=gu(e,{actInsideInputWithModifier:!1}),i=gu(t,{target:kz});m.useEffect(()=>{if(s){const{edges:o,nodes:l}=n.getState();r({nodes:l.filter(kk),edges:o.filter(kk)}),n.setState({nodesSelectionActive:!1})}},[s]),m.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function Nz(e){const t=Ut();m.useEffect(()=>{const n=()=>{var s,i,o,l;if(!e.current||!(((i=(s=e.current).checkVisibility)==null?void 0:i.call(s))??!0))return!1;const r=nw(e.current);(r.height===0||r.width===0)&&((l=(o=t.getState()).onError)==null||l.call(o,"004",Gs.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 ah={position:"absolute",width:"100%",height:"100%",top:0,left:0},jz=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Cz({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:i=$o.Free,zoomOnDoubleClick:o=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:u,minZoom:p,maxZoom:f,zoomActivationKeyCode:d,preventScrolling:h=!0,children:y,noWheelClassName:w,noPanClassName:k,onViewportChange:g,isControlledViewport:b,paneClickDistance:x,selectionOnDrag:S}){const C=Ut(),j=m.useRef(null),{userSelectionActive:E,lib:A,connectionInProgress:D}=vt(jz,en),W=gu(d),F=m.useRef();Nz(j);const R=m.useCallback($=>{g==null||g({x:$[0],y:$[1],zoom:$[2]}),b||C.setState({transform:$})},[g,b]);return m.useEffect(()=>{if(j.current){F.current=wF({domNode:j.current,minZoom:p,maxZoom:f,translateExtent:u,viewport:c,onDraggingChange:T=>C.setState(O=>O.paneDragging===T?O:{paneDragging:T}),onPanZoomStart:(T,O)=>{const{onViewportChangeStart:I,onMoveStart:H}=C.getState();H==null||H(T,O),I==null||I(O)},onPanZoom:(T,O)=>{const{onViewportChange:I,onMove:H}=C.getState();H==null||H(T,O),I==null||I(O)},onPanZoomEnd:(T,O)=>{const{onViewportChangeEnd:I,onMoveEnd:H}=C.getState();H==null||H(T,O),I==null||I(O)}});const{x:$,y:P,zoom:L}=F.current.getViewport();return C.setState({panZoom:F.current,transform:[$,P,L],domNode:j.current.closest(".react-flow")}),()=>{var T;(T=F.current)==null||T.destroy()}}},[]),m.useEffect(()=>{var $;($=F.current)==null||$.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:i,zoomOnDoubleClick:o,panOnDrag:l,zoomActivationKeyPressed:W,preventScrolling:h,noPanClassName:k,userSelectionActive:E,noWheelClassName:w,lib:A,onTransformChange:R,connectionInProgress:D,selectionOnDrag:S,paneClickDistance:x})},[e,t,n,r,s,i,o,l,W,h,k,E,w,A,R,D,S,x]),a.jsx("div",{className:"react-flow__renderer",ref:j,style:ah,children:y})}const Ez=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function _z(){const{userSelectionActive:e,userSelectionRect:t}=vt(Ez,en);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 jm=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},Pz=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function Az({isSelecting:e,selectionKeyPressed:t,selectionMode:n=pu.Full,panOnDrag:r,paneClickDistance:s,selectionOnDrag:i,onSelectionStart:o,onSelectionEnd:l,onPaneClick:c,onPaneContextMenu:u,onPaneScroll:p,onPaneMouseEnter:f,onPaneMouseMove:d,onPaneMouseLeave:h,children:y}){const w=Ut(),{userSelectionActive:k,elementsSelectable:g,dragging:b,connectionInProgress:x}=vt(Pz,en),S=g&&(e||k),C=m.useRef(null),j=m.useRef(),E=m.useRef(new Set),A=m.useRef(new Set),D=m.useRef(!1),W=I=>{if(D.current||x){D.current=!1;return}c==null||c(I),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},F=I=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){I.preventDefault();return}u==null||u(I)},R=p?I=>p(I):void 0,$=I=>{D.current&&(I.stopPropagation(),D.current=!1)},P=I=>{var ue,le;const{domNode:H}=w.getState();if(j.current=H==null?void 0:H.getBoundingClientRect(),!j.current)return;const _=I.target===C.current;if(!_&&!!I.target.closest(".nokey")||!e||!(i&&_||t)||I.button!==0||!I.isPrimary)return;(le=(ue=I.target)==null?void 0:ue.setPointerCapture)==null||le.call(ue,I.pointerId),D.current=!1;const{x:V,y:Z}=js(I.nativeEvent,j.current);w.setState({userSelectionRect:{width:0,height:0,startX:V,startY:Z,x:V,y:Z}}),_||(I.stopPropagation(),I.preventDefault())},L=I=>{const{userSelectionRect:H,transform:_,nodeLookup:Y,edgeLookup:U,connectionLookup:V,triggerNodeChanges:Z,triggerEdgeChanges:ue,defaultEdgeOptions:le,resetSelectedElements:we}=w.getState();if(!j.current||!H)return;const{x:re,y:ye}=js(I.nativeEvent,j.current),{startX:te,startY:ie}=H;if(!D.current){const Ie=t?0:s;if(Math.hypot(re-te,ye-ie)<=Ie)return;we(),o==null||o(I)}D.current=!0;const ce={startX:te,startY:ie,x:re<te?re:te,y:ye<ie?ye:ie,width:Math.abs(re-te),height:Math.abs(ye-ie)},pe=E.current,De=A.current;E.current=new Set(ew(Y,ce,_,n===pu.Partial,!0).map(Ie=>Ie.id)),A.current=new Set;const He=(le==null?void 0:le.selectable)??!0;for(const Ie of E.current){const et=V.get(Ie);if(et)for(const{edgeId:ut}of et.values()){const Ae=U.get(ut);Ae&&(Ae.selectable??He)&&A.current.add(ut)}}if(!J0(pe,E.current)){const Ie=Wa(Y,E.current,!0);Z(Ie)}if(!J0(De,A.current)){const Ie=Wa(U,A.current);ue(Ie)}w.setState({userSelectionRect:ce,userSelectionActive:!0,nodesSelectionActive:!1})},T=I=>{var H,_;I.button===0&&((_=(H=I.target)==null?void 0:H.releasePointerCapture)==null||_.call(H,I.pointerId),!k&&I.target===C.current&&w.getState().userSelectionRect&&(W==null||W(I)),w.setState({userSelectionActive:!1,userSelectionRect:null}),D.current&&(l==null||l(I),w.setState({nodesSelectionActive:E.current.size>0})))},O=r===!0||Array.isArray(r)&&r.includes(0);return a.jsxs("div",{className:vn(["react-flow__pane",{draggable:O,dragging:b,selection:e}]),onClick:S?void 0:jm(W,C),onContextMenu:jm(F,C),onWheel:jm(R,C),onPointerEnter:S?void 0:f,onPointerMove:S?L:d,onPointerUp:S?T:void 0,onPointerDownCapture:S?P:void 0,onClickCapture:S?$:void 0,onPointerLeave:h,ref:C,style:ah,children:[y,a.jsx(_z,{})]})}function by({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:o,nodeLookup:l,onError:c}=t.getState(),u=l.get(e);if(!u){c==null||c("012",Gs.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&o)&&(i({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var p;return(p=r==null?void 0:r.current)==null?void 0:p.blur()})):s([e])}function XE({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,nodeClickDistance:o}){const l=Ut(),[c,u]=m.useState(!1),p=m.useRef();return m.useEffect(()=>{p.current=iF({getStoreItems:()=>l.getState(),onNodeMouseDown:f=>{by({id:f,store:l,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),m.useEffect(()=>{if(!(t||!e.current||!p.current))return p.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:s,nodeClickDistance:o}),()=>{var f;(f=p.current)==null||f.destroy()}},[n,r,t,i,e,s,o]),c}const Iz=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function JE(){const e=Ut();return m.useCallback(n=>{const{nodeExtent:r,snapToGrid:s,snapGrid:i,nodesDraggable:o,onError:l,updateNodePositions:c,nodeLookup:u,nodeOrigin:p}=e.getState(),f=new Map,d=Iz(o),h=s?i[0]:5,y=s?i[1]:5,w=n.direction.x*h*n.factor,k=n.direction.y*y*n.factor;for(const[,g]of u){if(!d(g))continue;let b={x:g.internals.positionAbsolute.x+w,y:g.internals.positionAbsolute.y+k};s&&(b=Du(b,i));const{position:x,positionAbsolute:S}=pE({nodeId:g.id,nextPosition:b,nodeLookup:u,nodeExtent:r,nodeOrigin:p,onError:l});g.position=x,g.internals.positionAbsolute=S,f.set(g.id,g)}c(f)},[])}const cw=m.createContext(null),Tz=cw.Provider;cw.Consumer;const QE=()=>m.useContext(cw),Rz=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Mz=(e,t,n)=>r=>{const{connectionClickStartHandle:s,connectionMode:i,connection:o}=r,{fromHandle:l,toHandle:c,isValid:u}=o,p=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===t&&(l==null?void 0:l.type)===n,connectingTo:p,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===n,isPossibleEndHandle:i===hl.Strict?(l==null?void 0:l.type)!==n:e!==(l==null?void 0:l.nodeId)||t!==(l==null?void 0:l.id),connectionInProcess:!!l,clickConnectionInProcess:!!s,valid:p&&u}};function Lz({type:e="source",position:t=$e.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:o,onConnect:l,children:c,className:u,onMouseDown:p,onTouchStart:f,...d},h){var L,T;const y=o||null,w=e==="target",k=Ut(),g=QE(),{connectOnClick:b,noPanClassName:x,rfId:S}=vt(Rz,en),{connectingFrom:C,connectingTo:j,clickConnecting:E,isPossibleEndHandle:A,connectionInProcess:D,clickConnectionInProcess:W,valid:F}=vt(Mz(g,y,e),en);g||(T=(L=k.getState()).onError)==null||T.call(L,"010",Gs.error010());const R=O=>{const{defaultEdgeOptions:I,onConnect:H,hasDefaultEdges:_}=k.getState(),Y={...I,...O};if(_){const{edges:U,setEdges:V}=k.getState();V(Ef(Y,U))}H==null||H(Y),l==null||l(Y)},$=O=>{if(!g)return;const I=vE(O.nativeEvent);if(s&&(I&&O.button===0||!I)){const H=k.getState();xy.onPointerDown(O.nativeEvent,{handleDomNode:O.currentTarget,autoPanOnConnect:H.autoPanOnConnect,connectionMode:H.connectionMode,connectionRadius:H.connectionRadius,domNode:H.domNode,nodeLookup:H.nodeLookup,lib:H.lib,isTarget:w,handleId:y,nodeId:g,flowId:H.rfId,panBy:H.panBy,cancelConnection:H.cancelConnection,onConnectStart:H.onConnectStart,onConnectEnd:(..._)=>{var Y,U;return(U=(Y=k.getState()).onConnectEnd)==null?void 0:U.call(Y,..._)},updateConnection:H.updateConnection,onConnect:R,isValidConnection:n||((..._)=>{var Y,U;return((U=(Y=k.getState()).isValidConnection)==null?void 0:U.call(Y,..._))??!0}),getTransform:()=>k.getState().transform,getFromHandle:()=>k.getState().connection.fromHandle,autoPanSpeed:H.autoPanSpeed,dragThreshold:H.connectionDragThreshold})}I?p==null||p(O):f==null||f(O)},P=O=>{const{onClickConnectStart:I,onClickConnectEnd:H,connectionClickStartHandle:_,connectionMode:Y,isValidConnection:U,lib:V,rfId:Z,nodeLookup:ue,connection:le}=k.getState();if(!g||!_&&!s)return;if(!_){I==null||I(O.nativeEvent,{nodeId:g,handleId:y,handleType:e}),k.setState({connectionClickStartHandle:{nodeId:g,type:e,id:y}});return}const we=wE(O.target),re=n||U,{connection:ye,isValid:te}=xy.isValid(O.nativeEvent,{handle:{nodeId:g,id:y,type:e},connectionMode:Y,fromNodeId:_.nodeId,fromHandleId:_.id||null,fromType:_.type,isValidConnection:re,flowId:Z,doc:we,lib:V,nodeLookup:ue});te&&ye&&R(ye);const ie=structuredClone(le);delete ie.inProgress,ie.toPosition=ie.toHandle?ie.toHandle.position:null,H==null||H(O,ie),k.setState({connectionClickStartHandle:null})};return a.jsx("div",{"data-handleid":y,"data-nodeid":g,"data-handlepos":t,"data-id":`${S}-${g}-${y}-${e}`,className:vn(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",x,u,{source:!w,target:w,connectable:r,connectablestart:s,connectableend:i,clickconnecting:E,connectingfrom:C,connectingto:j,valid:F,connectionindicator:r&&(!D||A)&&(D||W?i:s)}]),onMouseDown:$,onTouchStart:$,onClick:b?P:void 0,ref:h,...d,children:c})}const Zn=m.memo(YE(Lz));function $z({data:e,isConnectable:t,sourcePosition:n=$e.Bottom}){return a.jsxs(a.Fragment,{children:[e==null?void 0:e.label,a.jsx(Zn,{type:"source",position:n,isConnectable:t})]})}function Oz({data:e,isConnectable:t,targetPosition:n=$e.Top,sourcePosition:r=$e.Bottom}){return a.jsxs(a.Fragment,{children:[a.jsx(Zn,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,a.jsx(Zn,{type:"source",position:r,isConnectable:t})]})}function Dz(){return null}function Fz({data:e,isConnectable:t,targetPosition:n=$e.Top}){return a.jsxs(a.Fragment,{children:[a.jsx(Zn,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const pp={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Sk={input:$z,default:Oz,output:Fz,group:Dz};function zz(e){var t,n,r,s;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((s=e.style)==null?void 0:s.height)}}const Hz=e=>{const{width:t,height:n,x:r,y:s}=Ou(e.nodeLookup,{filter:i=>!!i.selected});return{width:Ns(t)?t:null,height:Ns(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${s}px)`}};function Bz({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Ut(),{width:s,height:i,transformString:o,userSelectionActive:l}=vt(Hz,en),c=JE(),u=m.useRef(null);m.useEffect(()=>{var h;n||(h=u.current)==null||h.focus({preventScroll:!0})},[n]);const p=!l&&s!==null&&i!==null;if(XE({nodeRef:u,disabled:!p}),!p)return null;const f=e?h=>{const y=r.getState().nodes.filter(w=>w.selected);e(h,y)}:void 0,d=h=>{Object.prototype.hasOwnProperty.call(pp,h.key)&&(h.preventDefault(),c({direction:pp[h.key],factor:h.shiftKey?4:1}))};return a.jsx("div",{className:vn(["react-flow__nodesselection","react-flow__container",t]),style:{transform:o},children:a.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:d,style:{width:s,height:i}})})}const Nk=typeof window<"u"?window:void 0,Wz=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function ZE({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:o,paneClickDistance:l,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:p,selectionMode:f,onSelectionStart:d,onSelectionEnd:h,multiSelectionKeyCode:y,panActivationKeyCode:w,zoomActivationKeyCode:k,elementsSelectable:g,zoomOnScroll:b,zoomOnPinch:x,panOnScroll:S,panOnScrollSpeed:C,panOnScrollMode:j,zoomOnDoubleClick:E,panOnDrag:A,defaultViewport:D,translateExtent:W,minZoom:F,maxZoom:R,preventScrolling:$,onSelectionContextMenu:P,noWheelClassName:L,noPanClassName:T,disableKeyboardA11y:O,onViewportChange:I,isControlledViewport:H}){const{nodesSelectionActive:_,userSelectionActive:Y}=vt(Wz,en),U=gu(u,{target:Nk}),V=gu(w,{target:Nk}),Z=V||A,ue=V||S,le=p&&Z!==!0,we=U||Y||le;return Sz({deleteKeyCode:c,multiSelectionKeyCode:y}),a.jsx(Cz,{onPaneContextMenu:i,elementsSelectable:g,zoomOnScroll:b,zoomOnPinch:x,panOnScroll:ue,panOnScrollSpeed:C,panOnScrollMode:j,zoomOnDoubleClick:E,panOnDrag:!U&&Z,defaultViewport:D,translateExtent:W,minZoom:F,maxZoom:R,zoomActivationKeyCode:k,preventScrolling:$,noWheelClassName:L,noPanClassName:T,onViewportChange:I,isControlledViewport:H,paneClickDistance:l,selectionOnDrag:le,children:a.jsxs(Az,{onSelectionStart:d,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:o,panOnDrag:Z,isSelecting:!!we,selectionMode:f,selectionKeyPressed:U,paneClickDistance:l,selectionOnDrag:le,children:[e,_&&a.jsx(Bz,{onSelectionContextMenu:P,noPanClassName:T,disableKeyboardA11y:O})]})})}ZE.displayName="FlowRenderer";const Vz=m.memo(ZE),Kz=e=>t=>e?ew(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 Uz(e){return vt(m.useCallback(Kz(e),[e]),en)}const qz=e=>e.updateNodeInternals;function Yz(){const e=vt(qz),[t]=m.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(s=>{const i=s.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:s.target,force:!0})}),e(r)}));return m.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function Gz({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const s=Ut(),i=m.useRef(null),o=m.useRef(null),l=m.useRef(e.sourcePosition),c=m.useRef(e.targetPosition),u=m.useRef(t),p=n&&!!e.internals.handleBounds;return m.useEffect(()=>{i.current&&!e.hidden&&(!p||o.current!==i.current)&&(o.current&&(r==null||r.unobserve(o.current)),r==null||r.observe(i.current),o.current=i.current)},[p,e.hidden]),m.useEffect(()=>()=>{o.current&&(r==null||r.unobserve(o.current),o.current=null)},[]),m.useEffect(()=>{if(i.current){const f=u.current!==t,d=l.current!==e.sourcePosition,h=c.current!==e.targetPosition;(f||d||h)&&(u.current=t,l.current=e.sourcePosition,c.current=e.targetPosition,s.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function Xz({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:s,onContextMenu:i,onDoubleClick:o,nodesDraggable:l,elementsSelectable:c,nodesConnectable:u,nodesFocusable:p,resizeObserver:f,noDragClassName:d,noPanClassName:h,disableKeyboardA11y:y,rfId:w,nodeTypes:k,nodeClickDistance:g,onError:b}){const{node:x,internals:S,isParent:C}=vt(re=>{const ye=re.nodeLookup.get(e),te=re.parentLookup.has(e);return{node:ye,internals:ye.internals,isParent:te}},en);let j=x.type||"default",E=(k==null?void 0:k[j])||Sk[j];E===void 0&&(b==null||b("003",Gs.error003(j)),j="default",E=(k==null?void 0:k.default)||Sk.default);const A=!!(x.draggable||l&&typeof x.draggable>"u"),D=!!(x.selectable||c&&typeof x.selectable>"u"),W=!!(x.connectable||u&&typeof x.connectable>"u"),F=!!(x.focusable||p&&typeof x.focusable>"u"),R=Ut(),$=yE(x),P=Gz({node:x,nodeType:j,hasDimensions:$,resizeObserver:f}),L=XE({nodeRef:P,disabled:x.hidden||!A,noDragClassName:d,handleSelector:x.dragHandle,nodeId:e,isSelectable:D,nodeClickDistance:g}),T=JE();if(x.hidden)return null;const O=Ni(x),I=zz(x),H=D||A||t||n||r||s,_=n?re=>n(re,{...S.userNode}):void 0,Y=r?re=>r(re,{...S.userNode}):void 0,U=s?re=>s(re,{...S.userNode}):void 0,V=i?re=>i(re,{...S.userNode}):void 0,Z=o?re=>o(re,{...S.userNode}):void 0,ue=re=>{const{selectNodesOnDrag:ye,nodeDragThreshold:te}=R.getState();D&&(!ye||!A||te>0)&&by({id:e,store:R,nodeRef:P}),t&&t(re,{...S.userNode})},le=re=>{if(!(bE(re.nativeEvent)||y)){if(lE.includes(re.key)&&D){const ye=re.key==="Escape";by({id:e,store:R,unselect:ye,nodeRef:P})}else if(A&&x.selected&&Object.prototype.hasOwnProperty.call(pp,re.key)){re.preventDefault();const{ariaLabelConfig:ye}=R.getState();R.setState({ariaLiveMessage:ye["node.a11yDescription.ariaLiveMessage"]({direction:re.key.replace("Arrow","").toLowerCase(),x:~~S.positionAbsolute.x,y:~~S.positionAbsolute.y})}),T({direction:pp[re.key],factor:re.shiftKey?4:1})}}},we=()=>{var De;if(y||!((De=P.current)!=null&&De.matches(":focus-visible")))return;const{transform:re,width:ye,height:te,autoPanOnNodeFocus:ie,setCenter:ce}=R.getState();if(!ie)return;ew(new Map([[e,x]]),{x:0,y:0,width:ye,height:te},re,!0).length>0||ce(x.position.x+O.width/2,x.position.y+O.height/2,{zoom:re[2]})};return a.jsx("div",{className:vn(["react-flow__node",`react-flow__node-${j}`,{[h]:A},x.className,{selected:x.selected,selectable:D,parent:C,draggable:A,dragging:L}]),ref:P,style:{zIndex:S.z,transform:`translate(${S.positionAbsolute.x}px,${S.positionAbsolute.y}px)`,pointerEvents:H?"all":"none",visibility:$?"visible":"hidden",...x.style,...I},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:_,onMouseMove:Y,onMouseLeave:U,onContextMenu:V,onClick:ue,onDoubleClick:Z,onKeyDown:F?le:void 0,tabIndex:F?0:void 0,onFocus:F?we:void 0,role:x.ariaRole??(F?"group":void 0),"aria-roledescription":"node","aria-describedby":y?void 0:`${VE}-${w}`,"aria-label":x.ariaLabel,...x.domAttributes,children:a.jsx(Tz,{value:e,children:a.jsx(E,{id:e,data:x.data,type:j,positionAbsoluteX:S.positionAbsolute.x,positionAbsoluteY:S.positionAbsolute.y,selected:x.selected??!1,selectable:D,draggable:A,deletable:x.deletable??!0,isConnectable:W,sourcePosition:x.sourcePosition,targetPosition:x.targetPosition,dragging:L,dragHandle:x.dragHandle,zIndex:S.z,parentId:x.parentId,...O})})})}var Jz=m.memo(Xz);const Qz=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function e_(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,onError:i}=vt(Qz,en),o=Uz(e.onlyRenderVisibleElements),l=Yz();return a.jsx("div",{className:"react-flow__nodes",style:ah,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:s,nodeClickDistance:e.nodeClickDistance,onError:i},c))})}e_.displayName="NodeRenderer";const Zz=m.memo(e_);function e3(e){return vt(m.useCallback(n=>{if(!e)return n.edges.map(s=>s.id);const r=[];if(n.width&&n.height)for(const s of n.edges){const i=n.nodeLookup.get(s.source),o=n.nodeLookup.get(s.target);i&&o&&HD({sourceNode:i,targetNode:o,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[e]),en)}const t3=({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"})},n3=({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"})},jk={[fi.Arrow]:t3,[fi.ArrowClosed]:n3};function r3(e){const t=Ut();return m.useMemo(()=>{var s,i;return Object.prototype.hasOwnProperty.call(jk,e)?jk[e]:((i=(s=t.getState()).onError)==null||i.call(s,"009",Gs.error009(e)),null)},[e])}const s3=({id:e,type:t,color:n,width:r=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:o,orient:l="auto-start-reverse"})=>{const c=r3(t);return c?a.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:l,refX:"0",refY:"0",children:a.jsx(c,{color:n,strokeWidth:o})}):null},t_=({defaultColor:e,rfId:t})=>{const n=vt(i=>i.edges),r=vt(i=>i.defaultEdgeOptions),s=m.useMemo(()=>YD(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return s.length?a.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:a.jsx("defs",{children:s.map(i=>a.jsx(s3,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};t_.displayName="MarkerDefinitions";var i3=m.memo(t_);function n_({x:e,y:t,label:n,labelStyle:r,labelShowBg:s=!0,labelBgStyle:i,labelBgPadding:o=[2,4],labelBgBorderRadius:l=2,children:c,className:u,...p}){const[f,d]=m.useState({x:1,y:0,width:0,height:0}),h=vn(["react-flow__edge-textwrapper",u]),y=m.useRef(null);return m.useEffect(()=>{if(y.current){const w=y.current.getBBox();d({x:w.x,y:w.y,width:w.width,height:w.height})}},[n]),n?a.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:h,visibility:f.width?"visible":"hidden",...p,children:[s&&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:i,rx:l,ry:l}),a.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:y,style:r,children:n}),c]}):null}n_.displayName="EdgeText";const o3=m.memo(n_);function lh({path:e,labelX:t,labelY:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:o,labelBgPadding:l,labelBgBorderRadius:c,interactionWidth:u=20,...p}){return a.jsxs(a.Fragment,{children:[a.jsx("path",{...p,d:e,fill:"none",className:vn(["react-flow__edge-path",p.className])}),u?a.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,r&&Ns(t)&&Ns(n)?a.jsx(o3,{x:t,y:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:o,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function Ck({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===$e.Left||e===$e.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function r_({sourceX:e,sourceY:t,sourcePosition:n=$e.Bottom,targetX:r,targetY:s,targetPosition:i=$e.Top}){const[o,l]=Ck({pos:n,x1:e,y1:t,x2:r,y2:s}),[c,u]=Ck({pos:i,x1:r,y1:s,x2:e,y2:t}),[p,f,d,h]=kE({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:o,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${o},${l} ${c},${u} ${r},${s}`,p,f,d,h]}function s_(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:o,targetPosition:l,label:c,labelStyle:u,labelShowBg:p,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:h,style:y,markerEnd:w,markerStart:k,interactionWidth:g})=>{const[b,x,S]=r_({sourceX:n,sourceY:r,sourcePosition:o,targetX:s,targetY:i,targetPosition:l}),C=e.isInternal?void 0:t;return a.jsx(lh,{id:C,path:b,labelX:x,labelY:S,label:c,labelStyle:u,labelShowBg:p,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:h,style:y,markerEnd:w,markerStart:k,interactionWidth:g})})}const a3=s_({isInternal:!1}),i_=s_({isInternal:!0});a3.displayName="SimpleBezierEdge";i_.displayName="SimpleBezierEdgeInternal";function o_(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:f,style:d,sourcePosition:h=$e.Bottom,targetPosition:y=$e.Top,markerEnd:w,markerStart:k,pathOptions:g,interactionWidth:b})=>{const[x,S,C]=my({sourceX:n,sourceY:r,sourcePosition:h,targetX:s,targetY:i,targetPosition:y,borderRadius:g==null?void 0:g.borderRadius,offset:g==null?void 0:g.offset,stepPosition:g==null?void 0:g.stepPosition}),j=e.isInternal?void 0:t;return a.jsx(lh,{id:j,path:x,labelX:S,labelY:C,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:f,style:d,markerEnd:w,markerStart:k,interactionWidth:b})})}const a_=o_({isInternal:!1}),l_=o_({isInternal:!0});a_.displayName="SmoothStepEdge";l_.displayName="SmoothStepEdgeInternal";function c_(e){return m.memo(({id:t,...n})=>{var s;const r=e.isInternal?void 0:t;return a.jsx(a_,{...n,id:r,pathOptions:m.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(s=n.pathOptions)==null?void 0:s.offset])})})}const l3=c_({isInternal:!1}),u_=c_({isInternal:!0});l3.displayName="StepEdge";u_.displayName="StepEdgeInternal";function d_(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:y,interactionWidth:w})=>{const[k,g,b]=jE({sourceX:n,sourceY:r,targetX:s,targetY:i}),x=e.isInternal?void 0:t;return a.jsx(lh,{id:x,path:k,labelX:g,labelY:b,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:y,interactionWidth:w})})}const c3=d_({isInternal:!1}),f_=d_({isInternal:!0});c3.displayName="StraightEdge";f_.displayName="StraightEdgeInternal";function p_(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:o=$e.Bottom,targetPosition:l=$e.Top,label:c,labelStyle:u,labelShowBg:p,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:h,style:y,markerEnd:w,markerStart:k,pathOptions:g,interactionWidth:b})=>{const[x,S,C]=SE({sourceX:n,sourceY:r,sourcePosition:o,targetX:s,targetY:i,targetPosition:l,curvature:g==null?void 0:g.curvature}),j=e.isInternal?void 0:t;return a.jsx(lh,{id:j,path:x,labelX:S,labelY:C,label:c,labelStyle:u,labelShowBg:p,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:h,style:y,markerEnd:w,markerStart:k,interactionWidth:b})})}const u3=p_({isInternal:!1}),h_=p_({isInternal:!0});u3.displayName="BezierEdge";h_.displayName="BezierEdgeInternal";const Ek={default:h_,straight:f_,step:u_,smoothstep:l_,simplebezier:i_},_k={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},d3=(e,t,n)=>n===$e.Left?e-t:n===$e.Right?e+t:e,f3=(e,t,n)=>n===$e.Top?e-t:n===$e.Bottom?e+t:e,Pk="react-flow__edgeupdater";function Ak({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:i,onMouseOut:o,type:l}){return a.jsx("circle",{onMouseDown:s,onMouseEnter:i,onMouseOut:o,className:vn([Pk,`${Pk}-${l}`]),cx:d3(t,r,e),cy:f3(n,r,e),r,stroke:"transparent",fill:"transparent"})}function p3({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:s,targetX:i,targetY:o,sourcePosition:l,targetPosition:c,onReconnect:u,onReconnectStart:p,onReconnectEnd:f,setReconnecting:d,setUpdateHover:h}){const y=Ut(),w=(S,C)=>{if(S.button!==0)return;const{autoPanOnConnect:j,domNode:E,connectionMode:A,connectionRadius:D,lib:W,onConnectStart:F,cancelConnection:R,nodeLookup:$,rfId:P,panBy:L,updateConnection:T}=y.getState(),O=C.type==="target",I=(Y,U)=>{d(!1),f==null||f(Y,n,C.type,U)},H=Y=>u==null?void 0:u(n,Y),_=(Y,U)=>{d(!0),p==null||p(S,n,C.type),F==null||F(Y,U)};xy.onPointerDown(S.nativeEvent,{autoPanOnConnect:j,connectionMode:A,connectionRadius:D,domNode:E,handleId:C.id,nodeId:C.nodeId,nodeLookup:$,isTarget:O,edgeUpdaterType:C.type,lib:W,flowId:P,cancelConnection:R,panBy:L,isValidConnection:(...Y)=>{var U,V;return((V=(U=y.getState()).isValidConnection)==null?void 0:V.call(U,...Y))??!0},onConnect:H,onConnectStart:_,onConnectEnd:(...Y)=>{var U,V;return(V=(U=y.getState()).onConnectEnd)==null?void 0:V.call(U,...Y)},onReconnectEnd:I,updateConnection:T,getTransform:()=>y.getState().transform,getFromHandle:()=>y.getState().connection.fromHandle,dragThreshold:y.getState().connectionDragThreshold,handleDomNode:S.currentTarget})},k=S=>w(S,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),g=S=>w(S,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),b=()=>h(!0),x=()=>h(!1);return a.jsxs(a.Fragment,{children:[(e===!0||e==="source")&&a.jsx(Ak,{position:l,centerX:r,centerY:s,radius:t,onMouseDown:k,onMouseEnter:b,onMouseOut:x,type:"source"}),(e===!0||e==="target")&&a.jsx(Ak,{position:c,centerX:i,centerY:o,radius:t,onMouseDown:g,onMouseEnter:b,onMouseOut:x,type:"target"})]})}function h3({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:s,onDoubleClick:i,onContextMenu:o,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,reconnectRadius:p,onReconnect:f,onReconnectStart:d,onReconnectEnd:h,rfId:y,edgeTypes:w,noPanClassName:k,onError:g,disableKeyboardA11y:b}){let x=vt(ce=>ce.edgeLookup.get(e));const S=vt(ce=>ce.defaultEdgeOptions);x=S?{...S,...x}:x;let C=x.type||"default",j=(w==null?void 0:w[C])||Ek[C];j===void 0&&(g==null||g("011",Gs.error011(C)),C="default",j=(w==null?void 0:w.default)||Ek.default);const E=!!(x.focusable||t&&typeof x.focusable>"u"),A=typeof f<"u"&&(x.reconnectable||n&&typeof x.reconnectable>"u"),D=!!(x.selectable||r&&typeof x.selectable>"u"),W=m.useRef(null),[F,R]=m.useState(!1),[$,P]=m.useState(!1),L=Ut(),{zIndex:T,sourceX:O,sourceY:I,targetX:H,targetY:_,sourcePosition:Y,targetPosition:U}=vt(m.useCallback(ce=>{const pe=ce.nodeLookup.get(x.source),De=ce.nodeLookup.get(x.target);if(!pe||!De)return{zIndex:x.zIndex,..._k};const He=qD({id:e,sourceNode:pe,targetNode:De,sourceHandle:x.sourceHandle||null,targetHandle:x.targetHandle||null,connectionMode:ce.connectionMode,onError:g});return{zIndex:zD({selected:x.selected,zIndex:x.zIndex,sourceNode:pe,targetNode:De,elevateOnSelect:ce.elevateEdgesOnSelect,zIndexMode:ce.zIndexMode}),...He||_k}},[x.source,x.target,x.sourceHandle,x.targetHandle,x.selected,x.zIndex]),en),V=m.useMemo(()=>x.markerStart?`url('#${gy(x.markerStart,y)}')`:void 0,[x.markerStart,y]),Z=m.useMemo(()=>x.markerEnd?`url('#${gy(x.markerEnd,y)}')`:void 0,[x.markerEnd,y]);if(x.hidden||O===null||I===null||H===null||_===null)return null;const ue=ce=>{var Ie;const{addSelectedEdges:pe,unselectNodesAndEdges:De,multiSelectionActive:He}=L.getState();D&&(L.setState({nodesSelectionActive:!1}),x.selected&&He?(De({nodes:[],edges:[x]}),(Ie=W.current)==null||Ie.blur()):pe([e])),s&&s(ce,x)},le=i?ce=>{i(ce,{...x})}:void 0,we=o?ce=>{o(ce,{...x})}:void 0,re=l?ce=>{l(ce,{...x})}:void 0,ye=c?ce=>{c(ce,{...x})}:void 0,te=u?ce=>{u(ce,{...x})}:void 0,ie=ce=>{var pe;if(!b&&lE.includes(ce.key)&&D){const{unselectNodesAndEdges:De,addSelectedEdges:He}=L.getState();ce.key==="Escape"?((pe=W.current)==null||pe.blur(),De({edges:[x]})):He([e])}};return a.jsx("svg",{style:{zIndex:T},children:a.jsxs("g",{className:vn(["react-flow__edge",`react-flow__edge-${C}`,x.className,k,{selected:x.selected,animated:x.animated,inactive:!D&&!s,updating:F,selectable:D}]),onClick:ue,onDoubleClick:le,onContextMenu:we,onMouseEnter:re,onMouseMove:ye,onMouseLeave:te,onKeyDown:E?ie:void 0,tabIndex:E?0:void 0,role:x.ariaRole??(E?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":x.ariaLabel===null?void 0:x.ariaLabel||`Edge from ${x.source} to ${x.target}`,"aria-describedby":E?`${KE}-${y}`:void 0,ref:W,...x.domAttributes,children:[!$&&a.jsx(j,{id:e,source:x.source,target:x.target,type:x.type,selected:x.selected,animated:x.animated,selectable:D,deletable:x.deletable??!0,label:x.label,labelStyle:x.labelStyle,labelShowBg:x.labelShowBg,labelBgStyle:x.labelBgStyle,labelBgPadding:x.labelBgPadding,labelBgBorderRadius:x.labelBgBorderRadius,sourceX:O,sourceY:I,targetX:H,targetY:_,sourcePosition:Y,targetPosition:U,data:x.data,style:x.style,sourceHandleId:x.sourceHandle,targetHandleId:x.targetHandle,markerStart:V,markerEnd:Z,pathOptions:"pathOptions"in x?x.pathOptions:void 0,interactionWidth:x.interactionWidth}),A&&a.jsx(p3,{edge:x,isReconnectable:A,reconnectRadius:p,onReconnect:f,onReconnectStart:d,onReconnectEnd:h,sourceX:O,sourceY:I,targetX:H,targetY:_,sourcePosition:Y,targetPosition:U,setUpdateHover:R,setReconnecting:P})]})})}var m3=m.memo(h3);const g3=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function m_({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:s,onReconnect:i,onEdgeContextMenu:o,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:p,reconnectRadius:f,onEdgeDoubleClick:d,onReconnectStart:h,onReconnectEnd:y,disableKeyboardA11y:w}){const{edgesFocusable:k,edgesReconnectable:g,elementsSelectable:b,onError:x}=vt(g3,en),S=e3(t);return a.jsxs("div",{className:"react-flow__edges",children:[a.jsx(i3,{defaultColor:e,rfId:n}),S.map(C=>a.jsx(m3,{id:C,edgesFocusable:k,edgesReconnectable:g,elementsSelectable:b,noPanClassName:s,onReconnect:i,onContextMenu:o,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,onClick:p,reconnectRadius:f,onDoubleClick:d,onReconnectStart:h,onReconnectEnd:y,rfId:n,onError:x,edgeTypes:r,disableKeyboardA11y:w},C))]})}m_.displayName="EdgeRenderer";const y3=m.memo(m_),x3=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function w3({children:e}){const t=vt(x3);return a.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function b3(e){const t=El(),n=m.useRef(!1);m.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const v3=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function k3(e){const t=vt(v3),n=Ut();return m.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function S3(e){return e.connection.inProgress?{...e.connection,to:Fu(e.connection.to,e.transform)}:{...e.connection}}function N3(e){return S3}function j3(e){const t=N3();return vt(t,en)}const C3=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function E3({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:s,width:i,height:o,isValid:l,inProgress:c}=vt(C3,en);return!(i&&s&&c)?null:a.jsx("svg",{style:e,width:i,height:o,className:"react-flow__connectionline react-flow__container",children:a.jsx("g",{className:vn(["react-flow__connection",dE(l)]),children:a.jsx(g_,{style:t,type:n,CustomComponent:r,isValid:l})})})}const g_=({style:e,type:t=Hi.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:s,from:i,fromNode:o,fromHandle:l,fromPosition:c,to:u,toNode:p,toHandle:f,toPosition:d,pointer:h}=j3();if(!s)return;if(n)return a.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:l,fromX:i.x,fromY:i.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:d,connectionStatus:dE(r),toNode:p,toHandle:f,pointer:h});let y="";const w={sourceX:i.x,sourceY:i.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:d};switch(t){case Hi.Bezier:[y]=SE(w);break;case Hi.SimpleBezier:[y]=r_(w);break;case Hi.Step:[y]=my({...w,borderRadius:0});break;case Hi.SmoothStep:[y]=my(w);break;default:[y]=jE(w)}return a.jsx("path",{d:y,fill:"none",className:"react-flow__connection-path",style:e})};g_.displayName="ConnectionLine";const _3={};function Ik(e=_3){m.useRef(e),Ut(),m.useEffect(()=>{},[e])}function P3(){Ut(),m.useRef(!1),m.useEffect(()=>{},[])}function y_({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:i,onEdgeDoubleClick:o,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:p,onSelectionContextMenu:f,onSelectionStart:d,onSelectionEnd:h,connectionLineType:y,connectionLineStyle:w,connectionLineComponent:k,connectionLineContainerStyle:g,selectionKeyCode:b,selectionOnDrag:x,selectionMode:S,multiSelectionKeyCode:C,panActivationKeyCode:j,zoomActivationKeyCode:E,deleteKeyCode:A,onlyRenderVisibleElements:D,elementsSelectable:W,defaultViewport:F,translateExtent:R,minZoom:$,maxZoom:P,preventScrolling:L,defaultMarkerColor:T,zoomOnScroll:O,zoomOnPinch:I,panOnScroll:H,panOnScrollSpeed:_,panOnScrollMode:Y,zoomOnDoubleClick:U,panOnDrag:V,onPaneClick:Z,onPaneMouseEnter:ue,onPaneMouseMove:le,onPaneMouseLeave:we,onPaneScroll:re,onPaneContextMenu:ye,paneClickDistance:te,nodeClickDistance:ie,onEdgeContextMenu:ce,onEdgeMouseEnter:pe,onEdgeMouseMove:De,onEdgeMouseLeave:He,reconnectRadius:Ie,onReconnect:et,onReconnectStart:ut,onReconnectEnd:Ae,noDragClassName:Qe,noWheelClassName:qt,noPanClassName:Te,disableKeyboardA11y:Ht,nodeExtent:st,rfId:dn,viewport:ne,onViewportChange:me}){return Ik(e),Ik(t),P3(),b3(n),k3(ne),a.jsx(Vz,{onPaneClick:Z,onPaneMouseEnter:ue,onPaneMouseMove:le,onPaneMouseLeave:we,onPaneContextMenu:ye,onPaneScroll:re,paneClickDistance:te,deleteKeyCode:A,selectionKeyCode:b,selectionOnDrag:x,selectionMode:S,onSelectionStart:d,onSelectionEnd:h,multiSelectionKeyCode:C,panActivationKeyCode:j,zoomActivationKeyCode:E,elementsSelectable:W,zoomOnScroll:O,zoomOnPinch:I,zoomOnDoubleClick:U,panOnScroll:H,panOnScrollSpeed:_,panOnScrollMode:Y,panOnDrag:V,defaultViewport:F,translateExtent:R,minZoom:$,maxZoom:P,onSelectionContextMenu:f,preventScrolling:L,noDragClassName:Qe,noWheelClassName:qt,noPanClassName:Te,disableKeyboardA11y:Ht,onViewportChange:me,isControlledViewport:!!ne,children:a.jsxs(w3,{children:[a.jsx(y3,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:o,onReconnect:et,onReconnectStart:ut,onReconnectEnd:Ae,onlyRenderVisibleElements:D,onEdgeContextMenu:ce,onEdgeMouseEnter:pe,onEdgeMouseMove:De,onEdgeMouseLeave:He,reconnectRadius:Ie,defaultMarkerColor:T,noPanClassName:Te,disableKeyboardA11y:Ht,rfId:dn}),a.jsx(E3,{style:w,type:y,component:k,containerStyle:g}),a.jsx("div",{className:"react-flow__edgelabel-renderer"}),a.jsx(Zz,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:p,nodeClickDistance:ie,onlyRenderVisibleElements:D,noPanClassName:Te,noDragClassName:Qe,disableKeyboardA11y:Ht,nodeExtent:st,rfId:dn}),a.jsx("div",{className:"react-flow__viewport-portal"})]})})}y_.displayName="GraphView";const A3=m.memo(y_),Tk=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:o,fitViewOptions:l,minZoom:c=.5,maxZoom:u=2,nodeOrigin:p,nodeExtent:f,zIndexMode:d="basic"}={})=>{const h=new Map,y=new Map,w=new Map,k=new Map,g=r??t??[],b=n??e??[],x=p??[0,0],S=f??fu;_E(w,k,g);const{nodesInitialized:C}=yy(b,h,y,{nodeOrigin:x,nodeExtent:S,zIndexMode:d});let j=[0,0,1];if(o&&s&&i){const E=Ou(h,{filter:F=>!!((F.width||F.initialWidth)&&(F.height||F.initialHeight))}),{x:A,y:D,zoom:W}=tw(E,s,i,c,u,(l==null?void 0:l.padding)??.1);j=[A,D,W]}return{rfId:"1",width:s??0,height:i??0,transform:j,nodes:b,nodesInitialized:C,nodeLookup:h,parentLookup:y,edges:g,edgeLookup:k,connectionLookup:w,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:fu,nodeExtent:S,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:hl.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:x,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:l,fitViewResolver:null,connection:{...uE},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:MD,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:cE,zIndexMode:d,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},I3=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:o,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:p,nodeExtent:f,zIndexMode:d})=>XF((h,y)=>{async function w(){const{nodeLookup:k,panZoom:g,fitViewOptions:b,fitViewResolver:x,width:S,height:C,minZoom:j,maxZoom:E}=y();g&&(await TD({nodes:k,width:S,height:C,panZoom:g,minZoom:j,maxZoom:E},b),x==null||x.resolve(!0),h({fitViewResolver:null}))}return{...Tk({nodes:e,edges:t,width:s,height:i,fitView:o,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:p,nodeExtent:f,defaultNodes:n,defaultEdges:r,zIndexMode:d}),setNodes:k=>{const{nodeLookup:g,parentLookup:b,nodeOrigin:x,elevateNodesOnSelect:S,fitViewQueued:C,zIndexMode:j,nodesSelectionActive:E}=y(),{nodesInitialized:A,hasSelectedNodes:D}=yy(k,g,b,{nodeOrigin:x,nodeExtent:f,elevateNodesOnSelect:S,checkEquality:!0,zIndexMode:j}),W=E&&D;C&&A?(w(),h({nodes:k,nodesInitialized:A,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:W})):h({nodes:k,nodesInitialized:A,nodesSelectionActive:W})},setEdges:k=>{const{connectionLookup:g,edgeLookup:b}=y();_E(g,b,k),h({edges:k})},setDefaultNodesAndEdges:(k,g)=>{if(k){const{setNodes:b}=y();b(k),h({hasDefaultNodes:!0})}if(g){const{setEdges:b}=y();b(g),h({hasDefaultEdges:!0})}},updateNodeInternals:k=>{const{triggerNodeChanges:g,nodeLookup:b,parentLookup:x,domNode:S,nodeOrigin:C,nodeExtent:j,debug:E,fitViewQueued:A,zIndexMode:D}=y(),{changes:W,updatedInternals:F}=tF(k,b,x,S,C,j,D);F&&(JD(b,x,{nodeOrigin:C,nodeExtent:j,zIndexMode:D}),A?(w(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),(W==null?void 0:W.length)>0&&(E&&console.log("React Flow: trigger node changes",W),g==null||g(W)))},updateNodePositions:(k,g=!1)=>{const b=[];let x=[];const{nodeLookup:S,triggerNodeChanges:C,connection:j,updateConnection:E,onNodesChangeMiddlewareMap:A}=y();for(const[D,W]of k){const F=S.get(D),R=!!(F!=null&&F.expandParent&&(F!=null&&F.parentId)&&(W!=null&&W.position)),$={id:D,type:"position",position:R?{x:Math.max(0,W.position.x),y:Math.max(0,W.position.y)}:W.position,dragging:g};if(F&&j.inProgress&&j.fromNode.id===F.id){const P=qo(F,j.fromHandle,$e.Left,!0);E({...j,from:P})}R&&F.parentId&&b.push({id:D,parentId:F.parentId,rect:{...W.internals.positionAbsolute,width:W.measured.width??0,height:W.measured.height??0}}),x.push($)}if(b.length>0){const{parentLookup:D,nodeOrigin:W}=y(),F=aw(b,S,D,W);x.push(...F)}for(const D of A.values())x=D(x);C(x)},triggerNodeChanges:k=>{const{onNodesChange:g,setNodes:b,nodes:x,hasDefaultNodes:S,debug:C}=y();if(k!=null&&k.length){if(S){const j=fp(k,x);b(j)}C&&console.log("React Flow: trigger node changes",k),g==null||g(k)}},triggerEdgeChanges:k=>{const{onEdgesChange:g,setEdges:b,edges:x,hasDefaultEdges:S,debug:C}=y();if(k!=null&&k.length){if(S){const j=lw(k,x);b(j)}C&&console.log("React Flow: trigger edge changes",k),g==null||g(k)}},addSelectedNodes:k=>{const{multiSelectionActive:g,edgeLookup:b,nodeLookup:x,triggerNodeChanges:S,triggerEdgeChanges:C}=y();if(g){const j=k.map(E=>ko(E,!0));S(j);return}S(Wa(x,new Set([...k]),!0)),C(Wa(b))},addSelectedEdges:k=>{const{multiSelectionActive:g,edgeLookup:b,nodeLookup:x,triggerNodeChanges:S,triggerEdgeChanges:C}=y();if(g){const j=k.map(E=>ko(E,!0));C(j);return}C(Wa(b,new Set([...k]))),S(Wa(x,new Set,!0))},unselectNodesAndEdges:({nodes:k,edges:g}={})=>{const{edges:b,nodes:x,nodeLookup:S,triggerNodeChanges:C,triggerEdgeChanges:j}=y(),E=k||x,A=g||b,D=[];for(const F of E){if(!F.selected)continue;const R=S.get(F.id);R&&(R.selected=!1),D.push(ko(F.id,!1))}const W=[];for(const F of A)F.selected&&W.push(ko(F.id,!1));C(D),j(W)},setMinZoom:k=>{const{panZoom:g,maxZoom:b}=y();g==null||g.setScaleExtent([k,b]),h({minZoom:k})},setMaxZoom:k=>{const{panZoom:g,minZoom:b}=y();g==null||g.setScaleExtent([b,k]),h({maxZoom:k})},setTranslateExtent:k=>{var g;(g=y().panZoom)==null||g.setTranslateExtent(k),h({translateExtent:k})},resetSelectedElements:()=>{const{edges:k,nodes:g,triggerNodeChanges:b,triggerEdgeChanges:x,elementsSelectable:S}=y();if(!S)return;const C=g.reduce((E,A)=>A.selected?[...E,ko(A.id,!1)]:E,[]),j=k.reduce((E,A)=>A.selected?[...E,ko(A.id,!1)]:E,[]);b(C),x(j)},setNodeExtent:k=>{const{nodes:g,nodeLookup:b,parentLookup:x,nodeOrigin:S,elevateNodesOnSelect:C,nodeExtent:j,zIndexMode:E}=y();k[0][0]===j[0][0]&&k[0][1]===j[0][1]&&k[1][0]===j[1][0]&&k[1][1]===j[1][1]||(yy(g,b,x,{nodeOrigin:S,nodeExtent:k,elevateNodesOnSelect:C,checkEquality:!1,zIndexMode:E}),h({nodeExtent:k}))},panBy:k=>{const{transform:g,width:b,height:x,panZoom:S,translateExtent:C}=y();return nF({delta:k,panZoom:S,transform:g,translateExtent:C,width:b,height:x})},setCenter:async(k,g,b)=>{const{width:x,height:S,maxZoom:C,panZoom:j}=y();if(!j)return Promise.resolve(!1);const E=typeof(b==null?void 0:b.zoom)<"u"?b.zoom:C;return await j.setViewport({x:x/2-k*E,y:S/2-g*E,zoom:E},{duration:b==null?void 0:b.duration,ease:b==null?void 0:b.ease,interpolate:b==null?void 0:b.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{h({connection:{...uE}})},updateConnection:k=>{h({connection:k})},reset:()=>h({...Tk()})}},Object.is);function uw({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:i,initialMinZoom:o,initialMaxZoom:l,initialFitViewOptions:c,fitView:u,nodeOrigin:p,nodeExtent:f,zIndexMode:d,children:h}){const[y]=m.useState(()=>I3({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:u,minZoom:o,maxZoom:l,fitViewOptions:c,nodeOrigin:p,nodeExtent:f,zIndexMode:d}));return a.jsx(JF,{value:y,children:a.jsx(wz,{children:h})})}function T3({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:s,width:i,height:o,fitView:l,fitViewOptions:c,minZoom:u,maxZoom:p,nodeOrigin:f,nodeExtent:d,zIndexMode:h}){return m.useContext(ih)?a.jsx(a.Fragment,{children:e}):a.jsx(uw,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:s,initialWidth:i,initialHeight:o,fitView:l,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:p,nodeOrigin:f,nodeExtent:d,zIndexMode:h,children:e})}const R3={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function M3({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i,edgeTypes:o,onNodeClick:l,onEdgeClick:c,onInit:u,onMove:p,onMoveStart:f,onMoveEnd:d,onConnect:h,onConnectStart:y,onConnectEnd:w,onClickConnectStart:k,onClickConnectEnd:g,onNodeMouseEnter:b,onNodeMouseMove:x,onNodeMouseLeave:S,onNodeContextMenu:C,onNodeDoubleClick:j,onNodeDragStart:E,onNodeDrag:A,onNodeDragStop:D,onNodesDelete:W,onEdgesDelete:F,onDelete:R,onSelectionChange:$,onSelectionDragStart:P,onSelectionDrag:L,onSelectionDragStop:T,onSelectionContextMenu:O,onSelectionStart:I,onSelectionEnd:H,onBeforeDelete:_,connectionMode:Y,connectionLineType:U=Hi.Bezier,connectionLineStyle:V,connectionLineComponent:Z,connectionLineContainerStyle:ue,deleteKeyCode:le="Backspace",selectionKeyCode:we="Shift",selectionOnDrag:re=!1,selectionMode:ye=pu.Full,panActivationKeyCode:te="Space",multiSelectionKeyCode:ie=mu()?"Meta":"Control",zoomActivationKeyCode:ce=mu()?"Meta":"Control",snapToGrid:pe,snapGrid:De,onlyRenderVisibleElements:He=!1,selectNodesOnDrag:Ie,nodesDraggable:et,autoPanOnNodeFocus:ut,nodesConnectable:Ae,nodesFocusable:Qe,nodeOrigin:qt=UE,edgesFocusable:Te,edgesReconnectable:Ht,elementsSelectable:st=!0,defaultViewport:dn=uz,minZoom:ne=.5,maxZoom:me=2,translateExtent:Oe=fu,preventScrolling:Fe=!0,nodeExtent:Ve,defaultMarkerColor:Et="#b1b1b7",zoomOnScroll:Lt=!0,zoomOnPinch:tt=!0,panOnScroll:fn=!1,panOnScrollSpeed:kt=.5,panOnScrollMode:Nt=$o.Free,zoomOnDoubleClick:tn=!0,panOnDrag:nn=!0,onPaneClick:tr,onPaneMouseEnter:Fn,onPaneMouseMove:Vn,onPaneMouseLeave:gn,onPaneScroll:Yt,onPaneContextMenu:kn,paneClickDistance:yn=1,nodeClickDistance:Sn=0,children:Nn,onReconnect:Kn,onReconnectStart:ns,onReconnectEnd:Un,onEdgeContextMenu:fr,onEdgeDoubleClick:Wr,onEdgeMouseEnter:Vr,onEdgeMouseMove:jr,onEdgeMouseLeave:rs,reconnectRadius:an=10,onNodesChange:Cr,onEdgesChange:ee,noDragClassName:be="nodrag",noWheelClassName:Q="nowheel",noPanClassName:oe="nopan",fitView:Pe,fitViewOptions:Be,connectOnClick:jt,attributionPosition:jn,proOptions:nr,defaultEdgeOptions:Cn,elevateNodesOnSelect:Mn=!0,elevateEdgesOnSelect:xn=!1,disableKeyboardA11y:ze=!1,autoPanOnConnect:Rt,autoPanOnNodeDrag:Ce,autoPanSpeed:En,connectionRadius:Ke,isValidConnection:Er,onError:ss,style:is,id:fo,nodeDragThreshold:ta,connectionDragThreshold:$l,viewport:ke,onViewportChange:Ol,width:Ei,height:na,colorMode:ra="light",debug:os,onScroll:as,ariaLabelConfig:po,zIndexMode:B="basic",...ae},je){const Ne=fo||"1",We=hz(ra),Mt=m.useCallback(yt=>{yt.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),as==null||as(yt)},[as]);return a.jsx("div",{"data-testid":"rf__wrapper",...ae,onScroll:Mt,style:{...is,...R3},ref:je,className:vn(["react-flow",s,We]),id:fo,role:"application",children:a.jsxs(T3,{nodes:e,edges:t,width:Ei,height:na,fitView:Pe,fitViewOptions:Be,minZoom:ne,maxZoom:me,nodeOrigin:qt,nodeExtent:Ve,zIndexMode:B,children:[a.jsx(pz,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:y,onConnectEnd:w,onClickConnectStart:k,onClickConnectEnd:g,nodesDraggable:et,autoPanOnNodeFocus:ut,nodesConnectable:Ae,nodesFocusable:Qe,edgesFocusable:Te,edgesReconnectable:Ht,elementsSelectable:st,elevateNodesOnSelect:Mn,elevateEdgesOnSelect:xn,minZoom:ne,maxZoom:me,nodeExtent:Ve,onNodesChange:Cr,onEdgesChange:ee,snapToGrid:pe,snapGrid:De,connectionMode:Y,translateExtent:Oe,connectOnClick:jt,defaultEdgeOptions:Cn,fitView:Pe,fitViewOptions:Be,onNodesDelete:W,onEdgesDelete:F,onDelete:R,onNodeDragStart:E,onNodeDrag:A,onNodeDragStop:D,onSelectionDrag:L,onSelectionDragStart:P,onSelectionDragStop:T,onMove:p,onMoveStart:f,onMoveEnd:d,noPanClassName:oe,nodeOrigin:qt,rfId:Ne,autoPanOnConnect:Rt,autoPanOnNodeDrag:Ce,autoPanSpeed:En,onError:ss,connectionRadius:Ke,isValidConnection:Er,selectNodesOnDrag:Ie,nodeDragThreshold:ta,connectionDragThreshold:$l,onBeforeDelete:_,debug:os,ariaLabelConfig:po,zIndexMode:B}),a.jsx(A3,{onInit:u,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:b,onNodeMouseMove:x,onNodeMouseLeave:S,onNodeContextMenu:C,onNodeDoubleClick:j,nodeTypes:i,edgeTypes:o,connectionLineType:U,connectionLineStyle:V,connectionLineComponent:Z,connectionLineContainerStyle:ue,selectionKeyCode:we,selectionOnDrag:re,selectionMode:ye,deleteKeyCode:le,multiSelectionKeyCode:ie,panActivationKeyCode:te,zoomActivationKeyCode:ce,onlyRenderVisibleElements:He,defaultViewport:dn,translateExtent:Oe,minZoom:ne,maxZoom:me,preventScrolling:Fe,zoomOnScroll:Lt,zoomOnPinch:tt,zoomOnDoubleClick:tn,panOnScroll:fn,panOnScrollSpeed:kt,panOnScrollMode:Nt,panOnDrag:nn,onPaneClick:tr,onPaneMouseEnter:Fn,onPaneMouseMove:Vn,onPaneMouseLeave:gn,onPaneScroll:Yt,onPaneContextMenu:kn,paneClickDistance:yn,nodeClickDistance:Sn,onSelectionContextMenu:O,onSelectionStart:I,onSelectionEnd:H,onReconnect:Kn,onReconnectStart:ns,onReconnectEnd:Un,onEdgeContextMenu:fr,onEdgeDoubleClick:Wr,onEdgeMouseEnter:Vr,onEdgeMouseMove:jr,onEdgeMouseLeave:rs,reconnectRadius:an,defaultMarkerColor:Et,noDragClassName:be,noWheelClassName:Q,noPanClassName:oe,rfId:Ne,disableKeyboardA11y:ze,nodeExtent:Ve,viewport:ke,onViewportChange:Ol}),a.jsx(cz,{onSelectionChange:$}),Nn,a.jsx(sz,{proOptions:nr,position:jn}),a.jsx(rz,{rfId:Ne,disableKeyboardA11y:ze})]})})}var x_=YE(M3);function L3(){const e=Ut();return m.useCallback(t=>{const{domNode:n,updateNodeInternals:r}=e.getState(),s=Array.isArray(t)?t:[t],i=new Map;s.forEach(o=>{const l=n==null?void 0:n.querySelector(`.react-flow__node[data-id="${o}"]`);l&&i.set(o,{id:o,nodeElement:l,force:!0})}),requestAnimationFrame(()=>r(i,{triggerFitView:!1}))},[])}function $3(e){const[t,n]=m.useState(e),r=m.useCallback(s=>n(i=>fp(s,i)),[]);return[t,n,r]}function O3(e){const[t,n]=m.useState(e),r=m.useCallback(s=>n(i=>lw(s,i)),[]);return[t,n,r]}function D3({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:vn(["react-flow__background-pattern",n,r])})}function F3({radius:e,className:t}){return a.jsx("circle",{cx:e,cy:e,r:e,className:vn(["react-flow__background-pattern","dots",t])})}var eo;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(eo||(eo={}));const z3={[eo.Dots]:1,[eo.Lines]:1,[eo.Cross]:6},H3=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function w_({id:e,variant:t=eo.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=0,color:o,bgColor:l,style:c,className:u,patternClassName:p}){const f=m.useRef(null),{transform:d,patternId:h}=vt(H3,en),y=r||z3[t],w=t===eo.Dots,k=t===eo.Cross,g=Array.isArray(n)?n:[n,n],b=[g[0]*d[2]||1,g[1]*d[2]||1],x=y*d[2],S=Array.isArray(i)?i:[i,i],C=k?[x,x]:b,j=[S[0]*d[2]||1+C[0]/2,S[1]*d[2]||1+C[1]/2],E=`${h}${e||""}`;return a.jsxs("svg",{className:vn(["react-flow__background",u]),style:{...c,...ah,"--xy-background-color-props":l,"--xy-background-pattern-color-props":o},ref:f,"data-testid":"rf__background",children:[a.jsx("pattern",{id:E,x:d[0]%b[0],y:d[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${j[0]},-${j[1]})`,children:w?a.jsx(F3,{radius:x/2,className:p}):a.jsx(D3,{dimensions:C,lineWidth:s,variant:t,className:p})}),a.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${E})`})]})}w_.displayName="Background";const b_=m.memo(w_);function B3(){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 W3(){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 V3(){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 K3(){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 U3(){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 Wd({children:e,className:t,...n}){return a.jsx("button",{type:"button",className:vn(["react-flow__controls-button",t]),...n,children:e})}const q3=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function v_({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:o,onFitView:l,onInteractiveChange:c,className:u,children:p,position:f="bottom-left",orientation:d="vertical","aria-label":h}){const y=Ut(),{isInteractive:w,minZoomReached:k,maxZoomReached:g,ariaLabelConfig:b}=vt(q3,en),{zoomIn:x,zoomOut:S,fitView:C}=El(),j=()=>{x(),i==null||i()},E=()=>{S(),o==null||o()},A=()=>{C(s),l==null||l()},D=()=>{y.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),c==null||c(!w)},W=d==="horizontal"?"horizontal":"vertical";return a.jsxs(oh,{className:vn(["react-flow__controls",W,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":h??b["controls.ariaLabel"],children:[t&&a.jsxs(a.Fragment,{children:[a.jsx(Wd,{onClick:j,className:"react-flow__controls-zoomin",title:b["controls.zoomIn.ariaLabel"],"aria-label":b["controls.zoomIn.ariaLabel"],disabled:g,children:a.jsx(B3,{})}),a.jsx(Wd,{onClick:E,className:"react-flow__controls-zoomout",title:b["controls.zoomOut.ariaLabel"],"aria-label":b["controls.zoomOut.ariaLabel"],disabled:k,children:a.jsx(W3,{})})]}),n&&a.jsx(Wd,{className:"react-flow__controls-fitview",onClick:A,title:b["controls.fitView.ariaLabel"],"aria-label":b["controls.fitView.ariaLabel"],children:a.jsx(V3,{})}),r&&a.jsx(Wd,{className:"react-flow__controls-interactive",onClick:D,title:b["controls.interactive.ariaLabel"],"aria-label":b["controls.interactive.ariaLabel"],children:w?a.jsx(U3,{}):a.jsx(K3,{})}),p]})}v_.displayName="Controls";m.memo(v_);function Y3({id:e,x:t,y:n,width:r,height:s,style:i,color:o,strokeColor:l,strokeWidth:c,className:u,borderRadius:p,shapeRendering:f,selected:d,onClick:h}){const{background:y,backgroundColor:w}=i||{},k=o||y||w;return a.jsx("rect",{className:vn(["react-flow__minimap-node",{selected:d},u]),x:t,y:n,rx:p,ry:p,width:r,height:s,style:{fill:k,stroke:l,strokeWidth:c},shapeRendering:f,onClick:h?g=>h(g,e):void 0})}const G3=m.memo(Y3),X3=e=>e.nodes.map(t=>t.id),Cm=e=>e instanceof Function?e:()=>e;function J3({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:i=G3,onClick:o}){const l=vt(X3,en),c=Cm(t),u=Cm(e),p=Cm(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return a.jsx(a.Fragment,{children:l.map(d=>a.jsx(Z3,{id:d,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:p,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:i,onClick:o,shapeRendering:f},d))})}function Q3({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:i,shapeRendering:o,NodeComponent:l,onClick:c}){const{node:u,x:p,y:f,width:d,height:h}=vt(y=>{const w=y.nodeLookup.get(e);if(!w)return{node:void 0,x:0,y:0,width:0,height:0};const k=w.internals.userNode,{x:g,y:b}=w.internals.positionAbsolute,{width:x,height:S}=Ni(k);return{node:k,x:g,y:b,width:x,height:S}},en);return!u||u.hidden||!yE(u)?null:a.jsx(l,{x:p,y:f,width:d,height:h,style:u.style,selected:!!u.selected,className:r(u),color:t(u),borderRadius:s,strokeColor:n(u),strokeWidth:i,shapeRendering:o,onClick:c,id:u.id})}const Z3=m.memo(Q3);var e4=m.memo(J3);const t4=200,n4=150,r4=e=>!e.hidden,s4=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?gE(Ou(e.nodeLookup,{filter:r4}),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 k_({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:o,nodeComponent:l,bgColor:c,maskColor:u,maskStrokeColor:p,maskStrokeWidth:f,position:d="bottom-right",onClick:h,onNodeClick:y,pannable:w=!1,zoomable:k=!1,ariaLabel:g,inversePan:b,zoomStep:x=1,offsetScale:S=5}){const C=Ut(),j=m.useRef(null),{boundingRect:E,viewBB:A,rfId:D,panZoom:W,translateExtent:F,flowWidth:R,flowHeight:$,ariaLabelConfig:P}=vt(s4,en),L=(e==null?void 0:e.width)??t4,T=(e==null?void 0:e.height)??n4,O=E.width/L,I=E.height/T,H=Math.max(O,I),_=H*L,Y=H*T,U=S*H,V=E.x-(_-E.width)/2-U,Z=E.y-(Y-E.height)/2-U,ue=_+U*2,le=Y+U*2,we=`${i4}-${D}`,re=m.useRef(0),ye=m.useRef();re.current=H,m.useEffect(()=>{if(j.current&&W)return ye.current=dF({domNode:j.current,panZoom:W,getTransform:()=>C.getState().transform,getViewScale:()=>re.current}),()=>{var pe;(pe=ye.current)==null||pe.destroy()}},[W]),m.useEffect(()=>{var pe;(pe=ye.current)==null||pe.update({translateExtent:F,width:R,height:$,inversePan:b,pannable:w,zoomStep:x,zoomable:k})},[w,k,b,x,F,R,$]);const te=h?pe=>{var Ie;const[De,He]=((Ie=ye.current)==null?void 0:Ie.pointer(pe))||[0,0];h(pe,{x:De,y:He})}:void 0,ie=y?m.useCallback((pe,De)=>{const He=C.getState().nodeLookup.get(De).internals.userNode;y(pe,He)},[]):void 0,ce=g??P["minimap.ariaLabel"];return a.jsx(oh,{position:d,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*H: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:vn(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:a.jsxs("svg",{width:L,height:T,viewBox:`${V} ${Z} ${ue} ${le}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":we,ref:j,onClick:te,children:[ce&&a.jsx("title",{id:we,children:ce}),a.jsx(e4,{onClick:ie,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:o,nodeComponent:l}),a.jsx("path",{className:"react-flow__minimap-mask",d:`M${V-U},${Z-U}h${ue+U*2}v${le+U*2}h${-ue-U*2}z
66
- M${A.x},${A.y}h${A.width}v${A.height}h${-A.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}k_.displayName="MiniMap";m.memo(k_);const o4=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,a4={[xl.Line]:"right",[xl.Handle]:"bottom-right"};function l4({nodeId:e,position:t,variant:n=xl.Handle,className:r,style:s=void 0,children:i,color:o,minWidth:l=10,minHeight:c=10,maxWidth:u=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:d,autoScale:h=!0,shouldResize:y,onResizeStart:w,onResize:k,onResizeEnd:g}){const b=QE(),x=typeof e=="string"?e:b,S=Ut(),C=m.useRef(null),j=n===xl.Handle,E=vt(m.useCallback(o4(j&&h),[j,h]),en),A=m.useRef(null),D=t??a4[n];m.useEffect(()=>{if(!(!C.current||!x))return A.current||(A.current=jF({domNode:C.current,nodeId:x,getStoreItems:()=>{const{nodeLookup:F,transform:R,snapGrid:$,snapToGrid:P,nodeOrigin:L,domNode:T}=S.getState();return{nodeLookup:F,transform:R,snapGrid:$,snapToGrid:P,nodeOrigin:L,paneDomNode:T}},onChange:(F,R)=>{const{triggerNodeChanges:$,nodeLookup:P,parentLookup:L,nodeOrigin:T}=S.getState(),O=[],I={x:F.x,y:F.y},H=P.get(x);if(H&&H.expandParent&&H.parentId){const _=H.origin??T,Y=F.width??H.measured.width??0,U=F.height??H.measured.height??0,V={id:H.id,parentId:H.parentId,rect:{width:Y,height:U,...xE({x:F.x??H.position.x,y:F.y??H.position.y},{width:Y,height:U},H.parentId,P,_)}},Z=aw([V],P,L,T);O.push(...Z),I.x=F.x?Math.max(_[0]*Y,F.x):void 0,I.y=F.y?Math.max(_[1]*U,F.y):void 0}if(I.x!==void 0&&I.y!==void 0){const _={id:x,type:"position",position:{...I}};O.push(_)}if(F.width!==void 0&&F.height!==void 0){const Y={id:x,type:"dimensions",resizing:!0,setAttributes:d?d==="horizontal"?"width":"height":!0,dimensions:{width:F.width,height:F.height}};O.push(Y)}for(const _ of R){const Y={..._,type:"position"};O.push(Y)}$(O)},onEnd:({width:F,height:R})=>{const $={id:x,type:"dimensions",resizing:!1,dimensions:{width:F,height:R}};S.getState().triggerNodeChanges([$])}})),A.current.update({controlPosition:D,boundaries:{minWidth:l,minHeight:c,maxWidth:u,maxHeight:p},keepAspectRatio:f,resizeDirection:d,onResizeStart:w,onResize:k,onResizeEnd:g,shouldResize:y}),()=>{var F;(F=A.current)==null||F.destroy()}},[D,l,c,u,p,f,w,k,g,y]);const W=D.split("-");return a.jsx("div",{className:vn(["react-flow__resize-control","nodrag",...W,n,r]),ref:C,style:{...s,scale:E,...o&&{[j?"backgroundColor":"borderColor"]:o}},children:i})}const dw=m.memo(l4),c4="modulepreload",u4=function(e){return"/"+e},Rk={},d4=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.allSettled(n.map(c=>{if(c=u4(c),c in Rk)return;Rk[c]=!0;const u=c.endsWith(".css"),p=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${p}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":c4,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((d,h)=>{f.addEventListener("load",d),f.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return s.then(o=>{for(const l of o||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})};function f4(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const p4=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,h4=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,m4={};function Mk(e,t){return(m4.jsx?h4:p4).test(e)}const g4=/[ \t\n\f\r]/g;function y4(e){return typeof e=="object"?e.type==="text"?Lk(e.value):!1:Lk(e)}function Lk(e){return e.replace(g4,"")===""}class zu{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}zu.prototype.normal={};zu.prototype.property={};zu.prototype.space=void 0;function S_(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new zu(n,r,t)}function vy(e){return e.toLowerCase()}class Nr{constructor(t,n){this.attribute=n,this.property=t}}Nr.prototype.attribute="";Nr.prototype.booleanish=!1;Nr.prototype.boolean=!1;Nr.prototype.commaOrSpaceSeparated=!1;Nr.prototype.commaSeparated=!1;Nr.prototype.defined=!1;Nr.prototype.mustUseProperty=!1;Nr.prototype.number=!1;Nr.prototype.overloadedBoolean=!1;Nr.prototype.property="";Nr.prototype.spaceSeparated=!1;Nr.prototype.space=void 0;let x4=0;const lt=ea(),wn=ea(),ky=ea(),xe=ea(),Ot=ea(),el=ea(),Ir=ea();function ea(){return 2**++x4}const Sy=Object.freeze(Object.defineProperty({__proto__:null,boolean:lt,booleanish:wn,commaOrSpaceSeparated:Ir,commaSeparated:el,number:xe,overloadedBoolean:ky,spaceSeparated:Ot},Symbol.toStringTag,{value:"Module"})),Em=Object.keys(Sy);class fw extends Nr{constructor(t,n,r,s){let i=-1;if(super(t,n),$k(this,"space",s),typeof r=="number")for(;++i<Em.length;){const o=Em[i];$k(this,Em[i],(r&Sy[o])===Sy[o])}}}fw.prototype.defined=!0;function $k(e,t,n){n&&(e[t]=n)}function _l(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new fw(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[vy(r)]=r,n[vy(i.attribute)]=r}return new zu(t,n,e.space)}const N_=_l({properties:{ariaActiveDescendant:null,ariaAtomic:wn,ariaAutoComplete:null,ariaBusy:wn,ariaChecked:wn,ariaColCount:xe,ariaColIndex:xe,ariaColSpan:xe,ariaControls:Ot,ariaCurrent:null,ariaDescribedBy:Ot,ariaDetails:null,ariaDisabled:wn,ariaDropEffect:Ot,ariaErrorMessage:null,ariaExpanded:wn,ariaFlowTo:Ot,ariaGrabbed:wn,ariaHasPopup:null,ariaHidden:wn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ot,ariaLevel:xe,ariaLive:null,ariaModal:wn,ariaMultiLine:wn,ariaMultiSelectable:wn,ariaOrientation:null,ariaOwns:Ot,ariaPlaceholder:null,ariaPosInSet:xe,ariaPressed:wn,ariaReadOnly:wn,ariaRelevant:null,ariaRequired:wn,ariaRoleDescription:Ot,ariaRowCount:xe,ariaRowIndex:xe,ariaRowSpan:xe,ariaSelected:wn,ariaSetSize:xe,ariaSort:null,ariaValueMax:xe,ariaValueMin:xe,ariaValueNow:xe,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function j_(e,t){return t in e?e[t]:t}function C_(e,t){return j_(e,t.toLowerCase())}const w4=_l({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:el,acceptCharset:Ot,accessKey:Ot,action:null,allow:null,allowFullScreen:lt,allowPaymentRequest:lt,allowUserMedia:lt,alt:null,as:null,async:lt,autoCapitalize:null,autoComplete:Ot,autoFocus:lt,autoPlay:lt,blocking:Ot,capture:null,charSet:null,checked:lt,cite:null,className:Ot,cols:xe,colSpan:null,content:null,contentEditable:wn,controls:lt,controlsList:Ot,coords:xe|el,crossOrigin:null,data:null,dateTime:null,decoding:null,default:lt,defer:lt,dir:null,dirName:null,disabled:lt,download:ky,draggable:wn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:lt,formTarget:null,headers:Ot,height:xe,hidden:ky,high:xe,href:null,hrefLang:null,htmlFor:Ot,httpEquiv:Ot,id:null,imageSizes:null,imageSrcSet:null,inert:lt,inputMode:null,integrity:null,is:null,isMap:lt,itemId:null,itemProp:Ot,itemRef:Ot,itemScope:lt,itemType:Ot,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:lt,low:xe,manifest:null,max:null,maxLength:xe,media:null,method:null,min:null,minLength:xe,multiple:lt,muted:lt,name:null,nonce:null,noModule:lt,noValidate:lt,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:lt,optimum:xe,pattern:null,ping:Ot,placeholder:null,playsInline:lt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:lt,referrerPolicy:null,rel:Ot,required:lt,reversed:lt,rows:xe,rowSpan:xe,sandbox:Ot,scope:null,scoped:lt,seamless:lt,selected:lt,shadowRootClonable:lt,shadowRootDelegatesFocus:lt,shadowRootMode:null,shape:null,size:xe,sizes:null,slot:null,span:xe,spellCheck:wn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:xe,step:null,style:null,tabIndex:xe,target:null,title:null,translate:null,type:null,typeMustMatch:lt,useMap:null,value:wn,width:xe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ot,axis:null,background:null,bgColor:null,border:xe,borderColor:null,bottomMargin:xe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:lt,declare:lt,event:null,face:null,frame:null,frameBorder:null,hSpace:xe,leftMargin:xe,link:null,longDesc:null,lowSrc:null,marginHeight:xe,marginWidth:xe,noResize:lt,noHref:lt,noShade:lt,noWrap:lt,object:null,profile:null,prompt:null,rev:null,rightMargin:xe,rules:null,scheme:null,scrolling:wn,standby:null,summary:null,text:null,topMargin:xe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:xe,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:lt,disableRemotePlayback:lt,prefix:null,property:null,results:xe,security:null,unselectable:null},space:"html",transform:C_}),b4=_l({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:Ir,accentHeight:xe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:xe,amplitude:xe,arabicForm:null,ascent:xe,attributeName:null,attributeType:null,azimuth:xe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:xe,by:null,calcMode:null,capHeight:xe,className:Ot,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:xe,diffuseConstant:xe,direction:null,display:null,dur:null,divisor:xe,dominantBaseline:null,download:lt,dx:null,dy:null,edgeMode:null,editable:null,elevation:xe,enableBackground:null,end:null,event:null,exponent:xe,externalResourcesRequired:null,fill:null,fillOpacity:xe,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:el,g2:el,glyphName:el,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:xe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:xe,horizOriginX:xe,horizOriginY:xe,id:null,ideographic:xe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:xe,k:xe,k1:xe,k2:xe,k3:xe,k4:xe,kernelMatrix:Ir,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:xe,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:xe,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:xe,overlineThickness:xe,paintOrder:null,panose1:null,path:null,pathLength:xe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ot,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:xe,pointsAtY:xe,pointsAtZ:xe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ir,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ir,rev:Ir,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ir,requiredFeatures:Ir,requiredFonts:Ir,requiredFormats:Ir,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:xe,specularExponent:xe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:xe,strikethroughThickness:xe,string:null,stroke:null,strokeDashArray:Ir,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:xe,strokeOpacity:xe,strokeWidth:null,style:null,surfaceScale:xe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ir,tabIndex:xe,tableValues:null,target:null,targetX:xe,targetY:xe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ir,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:xe,underlineThickness:xe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:xe,values:null,vAlphabetic:xe,vMathematical:xe,vectorEffect:null,vHanging:xe,vIdeographic:xe,version:null,vertAdvY:xe,vertOriginX:xe,vertOriginY:xe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:xe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:j_}),E_=_l({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()}}),__=_l({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:C_}),P_=_l({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),v4={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"},k4=/[A-Z]/g,Ok=/-[a-z]/g,S4=/^data[-\w.:]+$/i;function N4(e,t){const n=vy(t);let r=t,s=Nr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&S4.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(Ok,C4);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!Ok.test(i)){let o=i.replace(k4,j4);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}s=fw}return new s(r,t)}function j4(e){return"-"+e.toLowerCase()}function C4(e){return e.charAt(1).toUpperCase()}const E4=S_([N_,w4,E_,__,P_],"html"),pw=S_([N_,b4,E_,__,P_],"svg");function _4(e){return e.join(" ").trim()}var hw={},Dk=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,P4=/\n/g,A4=/^\s*/,I4=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,T4=/^:\s*/,R4=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,M4=/^[;\s]*/,L4=/^\s+|\s+$/g,$4=`
67
- `,Fk="/",zk="*",No="",O4="comment",D4="declaration";function F4(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function s(y){var w=y.match(P4);w&&(n+=w.length);var k=y.lastIndexOf($4);r=~k?y.length-k:r+y.length}function i(){var y={line:n,column:r};return function(w){return w.position=new o(y),u(),w}}function o(y){this.start=y,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function l(y){var w=new Error(t.source+":"+n+":"+r+": "+y);if(w.reason=y,w.filename=t.source,w.line=n,w.column=r,w.source=e,!t.silent)throw w}function c(y){var w=y.exec(e);if(w){var k=w[0];return s(k),e=e.slice(k.length),w}}function u(){c(A4)}function p(y){var w;for(y=y||[];w=f();)w!==!1&&y.push(w);return y}function f(){var y=i();if(!(Fk!=e.charAt(0)||zk!=e.charAt(1))){for(var w=2;No!=e.charAt(w)&&(zk!=e.charAt(w)||Fk!=e.charAt(w+1));)++w;if(w+=2,No===e.charAt(w-1))return l("End of comment missing");var k=e.slice(2,w-2);return r+=2,s(k),e=e.slice(w),r+=2,y({type:O4,comment:k})}}function d(){var y=i(),w=c(I4);if(w){if(f(),!c(T4))return l("property missing ':'");var k=c(R4),g=y({type:D4,property:Hk(w[0].replace(Dk,No)),value:k?Hk(k[0].replace(Dk,No)):No});return c(M4),g}}function h(){var y=[];p(y);for(var w;w=d();)w!==!1&&(y.push(w),p(y));return y}return u(),h()}function Hk(e){return e?e.replace(L4,No):No}var z4=F4,H4=Vc&&Vc.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(hw,"__esModule",{value:!0});hw.default=W4;const B4=H4(z4);function W4(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,B4.default)(e),s=typeof t=="function";return r.forEach(i=>{if(i.type!=="declaration")return;const{property:o,value:l}=i;s?t(o,l,i):l&&(n=n||{},n[o]=l)}),n}var ch={};Object.defineProperty(ch,"__esModule",{value:!0});ch.camelCase=void 0;var V4=/^--[a-zA-Z0-9_-]+$/,K4=/-([a-z])/g,U4=/^[^-]+$/,q4=/^-(webkit|moz|ms|o|khtml)-/,Y4=/^-(ms)-/,G4=function(e){return!e||U4.test(e)||V4.test(e)},X4=function(e,t){return t.toUpperCase()},Bk=function(e,t){return"".concat(t,"-")},J4=function(e,t){return t===void 0&&(t={}),G4(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(Y4,Bk):e=e.replace(q4,Bk),e.replace(K4,X4))};ch.camelCase=J4;var Q4=Vc&&Vc.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Z4=Q4(hw),e5=ch;function Ny(e,t){var n={};return!e||typeof e!="string"||(0,Z4.default)(e,function(r,s){r&&s&&(n[(0,e5.camelCase)(r,t)]=s)}),n}Ny.default=Ny;var t5=Ny;const n5=oo(t5),A_=I_("end"),mw=I_("start");function I_(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 r5(e){const t=mw(e),n=A_(e);if(t&&n)return{start:t,end:n}}function Oc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Wk(e.position):"start"in e||"end"in e?Wk(e):"line"in e||"column"in e?jy(e):""}function jy(e){return Vk(e&&e.line)+":"+Vk(e&&e.column)}function Wk(e){return jy(e&&e.start)+"-"+jy(e&&e.end)}function Vk(e){return e&&typeof e=="number"?e:1}class er extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},o=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?s=t:!i.cause&&t&&(o=!0,s=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=l?l.line:void 0,this.name=Oc(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}er.prototype.file="";er.prototype.name="";er.prototype.reason="";er.prototype.message="";er.prototype.stack="";er.prototype.column=void 0;er.prototype.line=void 0;er.prototype.ancestors=void 0;er.prototype.cause=void 0;er.prototype.fatal=void 0;er.prototype.place=void 0;er.prototype.ruleId=void 0;er.prototype.source=void 0;const gw={}.hasOwnProperty,s5=new Map,i5=/[A-Z]/g,o5=new Set(["table","tbody","thead","tfoot","tr"]),a5=new Set(["td","th"]),T_="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function l5(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=g5(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=m5(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?pw:E4,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=R_(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function R_(e,t,n){if(t.type==="element")return c5(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return u5(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return f5(e,t,n);if(t.type==="mdxjsEsm")return d5(e,t);if(t.type==="root")return p5(e,t,n);if(t.type==="text")return h5(e,t)}function c5(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=pw,e.schema=s),e.ancestors.push(t);const i=L_(e,t.tagName,!1),o=y5(e,t);let l=xw(e,t);return o5.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!y4(c):!0})),M_(e,o,i,t),yw(o,l),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function u5(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)}yu(e,t.position)}function d5(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);yu(e,t.position)}function f5(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=pw,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:L_(e,t.name,!0),o=x5(e,t),l=xw(e,t);return M_(e,o,i,t),yw(o,l),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function p5(e,t,n){const r={};return yw(r,xw(e,t)),e.create(t,e.Fragment,r,n)}function h5(e,t){return t.value}function M_(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function yw(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function m5(e,t,n){return r;function r(s,i,o,l){const u=Array.isArray(o.children)?n:t;return l?u(i,o,l):u(i,o)}}function g5(e,t){return n;function n(r,s,i,o){const l=Array.isArray(i.children),c=mw(r);return t(s,i,o,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function y5(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&gw.call(t.properties,s)){const i=w5(e,s,t.properties[s]);if(i){const[o,l]=i;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&a5.has(t.tagName)?r=l:n[o]=l}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function x5(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const o=i.expression;o.type;const l=o.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else yu(e,t.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,i=e.evaluater.evaluateExpression(l.expression)}else yu(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function xw(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:s5;for(;++r<t.children.length;){const i=t.children[r];let o;if(e.passKeys){const c=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(c){const u=s.get(c)||0;o=c+"-"+u,s.set(c,u+1)}}const l=R_(e,i,o);l!==void 0&&n.push(l)}return n}function w5(e,t,n){const r=N4(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?f4(n):_4(n)),r.property==="style"){let s=typeof n=="object"?n:b5(e,String(n));return e.stylePropertyNameCase==="css"&&(s=v5(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?v4[r.property]||r.property:r.attribute,n]}}function b5(e,t){try{return n5(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new er("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=T_+"#cannot-parse-style-attribute",s}}function L_(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let i=-1,o;for(;++i<s.length;){const l=Mk(s[i])?{type:"Identifier",name:s[i]}:{type:"Literal",value:s[i]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(i&&l.type==="Literal"),optional:!1}:l}r=o}else r=Mk(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return gw.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);yu(e)}function yu(e,t){const n=new er("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=T_+"#cannot-handle-mdx-estrees-without-createevaluater",n}function v5(e){const t={};let n;for(n in e)gw.call(e,n)&&(t[k5(n)]=e[n]);return t}function k5(e){let t=e.replace(i5,S5);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function S5(e){return"-"+e.toLowerCase()}const _m={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"]},N5={};function j5(e,t){const n=N5,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return $_(e,r,s)}function $_(e,t,n){if(C5(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 Kk(e.children,t,n)}return Array.isArray(e)?Kk(e,t,n):""}function Kk(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=$_(e[s],t,n);return r.join("")}function C5(e){return!!(e&&typeof e=="object")}const Uk=document.createElement("i");function ww(e){const t="&"+e+";";Uk.innerHTML=t;const n=Uk.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Xs(e,t,n,r){const s=e.length;let i=0,o;if(t<0?t=-t>s?0:s+t:t=t>s?s: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);i<r.length;)o=r.slice(i,i+1e4),o.unshift(t,0),e.splice(...o),i+=1e4,t+=1e4}function Xr(e,t){return e.length>0?(Xs(e,e.length,0,t),e):t}const qk={}.hasOwnProperty;function E5(e){const t={};let n=-1;for(;++n<e.length;)_5(t,e[n]);return t}function _5(e,t){let n;for(n in t){const s=(qk.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){qk.call(s,o)||(s[o]=[]);const l=i[o];P5(s[o],Array.isArray(l)?l:l?[l]:[])}}}function P5(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Xs(e,0,0,r)}function O_(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 tl(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Bs=uo(/[A-Za-z]/),$r=uo(/[\dA-Za-z]/),A5=uo(/[#-'*+\--9=?A-Z^-~]/);function Cy(e){return e!==null&&(e<32||e===127)}const Ey=uo(/\d/),I5=uo(/[\dA-Fa-f]/),T5=uo(/[!-/:-@[-`{-~]/);function rt(e){return e!==null&&e<-2}function Sr(e){return e!==null&&(e<0||e===32)}function Ct(e){return e===-2||e===-1||e===32}const R5=uo(new RegExp("\\p{P}|\\p{S}","u")),M5=uo(/\s/);function uo(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Pl(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&$r(e.charCodeAt(n+1))&&$r(e.charCodeAt(n+2)))s=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const l=e.charCodeAt(n+1);i<56320&&l>56319&&l<57344?(o=String.fromCharCode(i,l),s=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+s+1,o=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function zt(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(c){return Ct(c)?(e.enter(n),l(c)):t(c)}function l(c){return Ct(c)&&i++<s?(e.consume(c),l):(e.exit(n),t(c))}}const L5={tokenize:$5};function $5(e){const t=e.attempt(this.parser.constructs.contentInitial,r,s);let n;return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),zt(e,t,"linePrefix")}function s(l){return e.enter("paragraph"),i(l)}function i(l){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,o(l)}function o(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return rt(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),o)}}const O5={tokenize:D5},Yk={tokenize:F5};function D5(e){const t=this,n=[];let r=0,s,i,o;return l;function l(x){if(r<n.length){const S=n[r];return t.containerState=S[1],e.attempt(S[0].continuation,c,u)(x)}return u(x)}function c(x){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&b();const S=t.events.length;let C=S,j;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){j=t.events[C][1].end;break}g(r);let E=S;for(;E<t.events.length;)t.events[E][1].end={...j},E++;return Xs(t.events,C+1,0,t.events.slice(S)),t.events.length=E,u(x)}return l(x)}function u(x){if(r===n.length){if(!s)return d(x);if(s.currentConstruct&&s.currentConstruct.concrete)return y(x);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Yk,p,f)(x)}function p(x){return s&&b(),g(r),d(x)}function f(x){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,y(x)}function d(x){return t.containerState={},e.attempt(Yk,h,y)(x)}function h(x){return r++,n.push([t.currentConstruct,t.containerState]),d(x)}function y(x){if(x===null){s&&b(),g(0),e.consume(x);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),w(x)}function w(x){if(x===null){k(e.exit("chunkFlow"),!0),g(0),e.consume(x);return}return rt(x)?(e.consume(x),k(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(x),w)}function k(x,S){const C=t.sliceStream(x);if(S&&C.push(null),x.previous=i,i&&(i.next=x),i=x,s.defineSkip(x.start),s.write(C),t.parser.lazy[x.start.line]){let j=s.events.length;for(;j--;)if(s.events[j][1].start.offset<o&&(!s.events[j][1].end||s.events[j][1].end.offset>o))return;const E=t.events.length;let A=E,D,W;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){if(D){W=t.events[A][1].end;break}D=!0}for(g(r),j=E;j<t.events.length;)t.events[j][1].end={...W},j++;Xs(t.events,A+1,0,t.events.slice(E)),t.events.length=j}}function g(x){let S=n.length;for(;S-- >x;){const C=n[S];t.containerState=C[1],C[0].exit.call(t,e)}n.length=x}function b(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function F5(e,t,n){return zt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Gk(e){if(e===null||Sr(e)||M5(e))return 1;if(R5(e))return 2}function bw(e,t,n){const r=[];let s=-1;for(;++s<e.length;){const i=e[s].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const _y={name:"attention",resolveAll:z5,tokenize:H5};function z5(e,t){let n=-1,r,s,i,o,l,c,u,p;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[r][1].end},d={...e[n][1].start};Xk(f,-c),Xk(d,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:d},i={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:c>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[r][1].end={...o.start},e[n][1].start={...l.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Xr(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Xr(u,[["enter",s,t],["enter",o,t],["exit",o,t],["enter",i,t]]),u=Xr(u,bw(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Xr(u,[["exit",i,t],["enter",l,t],["exit",l,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,u=Xr(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,Xs(e,r-1,n-r+3,u),n=r+u.length-p-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function H5(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=Gk(r);let i;return o;function o(c){return i=c,e.enter("attentionSequence"),l(c)}function l(c){if(c===i)return e.consume(c),l;const u=e.exit("attentionSequence"),p=Gk(c),f=!p||p===2&&s||n.includes(c),d=!s||s===2&&p||n.includes(r);return u._open=!!(i===42?f:f&&(s||!d)),u._close=!!(i===42?d:d&&(p||!f)),t(c)}}function Xk(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const B5={name:"autolink",tokenize:W5};function W5(e,t,n){let r=0;return s;function s(h){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(h){return Bs(h)?(e.consume(h),o):h===64?n(h):u(h)}function o(h){return h===43||h===45||h===46||$r(h)?(r=1,l(h)):u(h)}function l(h){return h===58?(e.consume(h),r=0,c):(h===43||h===45||h===46||$r(h))&&r++<32?(e.consume(h),l):(r=0,u(h))}function c(h){return h===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):h===null||h===32||h===60||Cy(h)?n(h):(e.consume(h),c)}function u(h){return h===64?(e.consume(h),p):A5(h)?(e.consume(h),u):n(h)}function p(h){return $r(h)?f(h):n(h)}function f(h){return h===46?(e.consume(h),r=0,p):h===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):d(h)}function d(h){if((h===45||$r(h))&&r++<63){const y=h===45?d:f;return e.consume(h),y}return n(h)}}const uh={partial:!0,tokenize:V5};function V5(e,t,n){return r;function r(i){return Ct(i)?zt(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||rt(i)?t(i):n(i)}}const D_={continuation:{tokenize:U5},exit:q5,name:"blockQuote",tokenize:K5};function K5(e,t,n){const r=this;return s;function s(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"),i}return n(o)}function i(o){return Ct(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function U5(e,t,n){const r=this;return s;function s(o){return Ct(o)?zt(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(D_,t,n)(o)}}function q5(e){e.exit("blockQuote")}const F_={name:"characterEscape",tokenize:Y5};function Y5(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),s}function s(i){return T5(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const z_={name:"characterReference",tokenize:G5};function G5(e,t,n){const r=this;let s=0,i,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"),u):(e.enter("characterReferenceValue"),i=31,o=$r,p(f))}function u(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=I5,p):(e.enter("characterReferenceValue"),i=7,o=Ey,p(f))}function p(f){if(f===59&&s){const d=e.exit("characterReferenceValue");return o===$r&&!ww(r.sliceSerialize(d))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(f)&&s++<i?(e.consume(f),p):n(f)}}const Jk={partial:!0,tokenize:J5},Qk={concrete:!0,name:"codeFenced",tokenize:X5};function X5(e,t,n){const r=this,s={partial:!0,tokenize:C};let i=0,o=0,l;return c;function c(j){return u(j)}function u(j){const E=r.events[r.events.length-1];return i=E&&E[1].type==="linePrefix"?E[2].sliceSerialize(E[1],!0).length:0,l=j,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(j)}function p(j){return j===l?(o++,e.consume(j),p):o<3?n(j):(e.exit("codeFencedFenceSequence"),Ct(j)?zt(e,f,"whitespace")(j):f(j))}function f(j){return j===null||rt(j)?(e.exit("codeFencedFence"),r.interrupt?t(j):e.check(Jk,w,S)(j)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),d(j))}function d(j){return j===null||rt(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(j)):Ct(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),zt(e,h,"whitespace")(j)):j===96&&j===l?n(j):(e.consume(j),d)}function h(j){return j===null||rt(j)?f(j):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),y(j))}function y(j){return j===null||rt(j)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(j)):j===96&&j===l?n(j):(e.consume(j),y)}function w(j){return e.attempt(s,S,k)(j)}function k(j){return e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),g}function g(j){return i>0&&Ct(j)?zt(e,b,"linePrefix",i+1)(j):b(j)}function b(j){return j===null||rt(j)?e.check(Jk,w,S)(j):(e.enter("codeFlowValue"),x(j))}function x(j){return j===null||rt(j)?(e.exit("codeFlowValue"),b(j)):(e.consume(j),x)}function S(j){return e.exit("codeFenced"),t(j)}function C(j,E,A){let D=0;return W;function W(L){return j.enter("lineEnding"),j.consume(L),j.exit("lineEnding"),F}function F(L){return j.enter("codeFencedFence"),Ct(L)?zt(j,R,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):R(L)}function R(L){return L===l?(j.enter("codeFencedFenceSequence"),$(L)):A(L)}function $(L){return L===l?(D++,j.consume(L),$):D>=o?(j.exit("codeFencedFenceSequence"),Ct(L)?zt(j,P,"whitespace")(L):P(L)):A(L)}function P(L){return L===null||rt(L)?(j.exit("codeFencedFence"),E(L)):A(L)}}}function J5(e,t,n){const r=this;return s;function s(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const Pm={name:"codeIndented",tokenize:Z5},Q5={partial:!0,tokenize:eH};function Z5(e,t,n){const r=this;return s;function s(u){return e.enter("codeIndented"),zt(e,i,"linePrefix",5)(u)}function i(u){const p=r.events[r.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?c(u):rt(u)?e.attempt(Q5,o,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||rt(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function eH(e,t,n){const r=this;return s;function s(o){return r.parser.lazy[r.now().line]?n(o):rt(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):zt(e,i,"linePrefix",5)(o)}function i(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):rt(o)?s(o):n(o)}}const tH={name:"codeText",previous:rH,resolve:nH,tokenize:sH};function nH(e){let t=e.length-4,n=3,r,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)s===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(s=r):(r===t||e[r][1].type==="lineEnding")&&(e[s][1].type="codeTextData",r!==s+2&&(e[s][1].end=e[r-1][1].end,e.splice(s+2,r-s-2),t-=r-s-2,r=s+2),s=void 0);return e}function rH(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function sH(e,t,n){let r=0,s,i;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?(i=e.enter("codeTextSequence"),s=0,p(f)):rt(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||rt(f)?(e.exit("codeTextData"),c(f)):(e.consume(f),u)}function p(f){return f===96?(e.consume(f),s++,p):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(i.type="codeTextData",u(f))}}class iH{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const s=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&cc(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),cc(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),cc(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);cc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);cc(this.left,n.reverse())}}}function cc(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 H_(e){const t={};let n=-1,r,s,i,o,l,c,u;const p=new iH(e);for(;++n<p.length;){for(;n in t;)n=t[n];if(r=p.get(n),n&&r[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type==="lineEndingBlank"&&(i+=2),i<c.length&&c[i][1].type==="content"))for(;++i<c.length&&c[i][1].type!=="content";)c[i][1].type==="chunkText"&&(c[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,oH(p,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,s=void 0;i--;)if(o=p.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(s&&(p.get(s)[1].type="lineEndingBlank"),o[1].type="lineEnding",s=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;s&&(r[1].end={...p.get(s)[1].start},l=p.slice(s,n),l.unshift(r),p.splice(s,n-s+1,l))}}return Xs(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!u}function oH(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const i=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const l=o.events,c=[],u={};let p,f,d=-1,h=n,y=0,w=0;const k=[w];for(;h;){for(;e.get(++s)[1]!==h;);i.push(s),h._tokenizer||(p=r.sliceStream(h),h.next||p.push(null),f&&o.defineSkip(h.start),h._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(p),h._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),f=h,h=h.next}for(h=n;++d<l.length;)l[d][0]==="exit"&&l[d-1][0]==="enter"&&l[d][1].type===l[d-1][1].type&&l[d][1].start.line!==l[d][1].end.line&&(w=d+1,k.push(w),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(o.events=[],h?(h._tokenizer=void 0,h.previous=void 0):k.pop(),d=k.length;d--;){const g=l.slice(k[d],k[d+1]),b=i.pop();c.push([b,b+g.length-1]),e.splice(b,2,g)}for(c.reverse(),d=-1;++d<c.length;)u[y+c[d][0]]=y+c[d][1],y+=c[d][1]-c[d][0]-1;return u}const aH={resolve:cH,tokenize:uH},lH={partial:!0,tokenize:dH};function cH(e){return H_(e),e}function uH(e,t){let n;return r;function r(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(l)}function s(l){return l===null?i(l):rt(l)?e.check(lH,o,i)(l):(e.consume(l),s)}function i(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,s}}function dH(e,t,n){const r=this;return s;function s(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),zt(e,i,"linePrefix")}function i(o){if(o===null||rt(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 B_(e,t,n,r,s,i,o,l,c){const u=c||Number.POSITIVE_INFINITY;let p=0;return f;function f(g){return g===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(g),e.exit(i),d):g===null||g===32||g===41||Cy(g)?n(g):(e.enter(r),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),w(g))}function d(g){return g===62?(e.enter(i),e.consume(g),e.exit(i),e.exit(s),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),h(g))}function h(g){return g===62?(e.exit("chunkString"),e.exit(l),d(g)):g===null||g===60||rt(g)?n(g):(e.consume(g),g===92?y:h)}function y(g){return g===60||g===62||g===92?(e.consume(g),h):h(g)}function w(g){return!p&&(g===null||g===41||Sr(g))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(r),t(g)):p<u&&g===40?(e.consume(g),p++,w):g===41?(e.consume(g),p--,w):g===null||g===32||g===40||Cy(g)?n(g):(e.consume(g),g===92?k:w)}function k(g){return g===40||g===41||g===92?(e.consume(g),w):w(g)}}function W_(e,t,n,r,s,i){const o=this;let l=0,c;return u;function u(h){return e.enter(r),e.enter(s),e.consume(h),e.exit(s),e.enter(i),p}function p(h){return l>999||h===null||h===91||h===93&&!c||h===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?n(h):h===93?(e.exit(i),e.enter(s),e.consume(h),e.exit(s),e.exit(r),t):rt(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),f(h))}function f(h){return h===null||h===91||h===93||rt(h)||l++>999?(e.exit("chunkString"),p(h)):(e.consume(h),c||(c=!Ct(h)),h===92?d:f)}function d(h){return h===91||h===92||h===93?(e.consume(h),l++,f):f(h)}}function V_(e,t,n,r,s,i){let o;return l;function l(d){return d===34||d===39||d===40?(e.enter(r),e.enter(s),e.consume(d),e.exit(s),o=d===40?41:d,c):n(d)}function c(d){return d===o?(e.enter(s),e.consume(d),e.exit(s),e.exit(r),t):(e.enter(i),u(d))}function u(d){return d===o?(e.exit(i),c(o)):d===null?n(d):rt(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),zt(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(d))}function p(d){return d===o||d===null||rt(d)?(e.exit("chunkString"),u(d)):(e.consume(d),d===92?f:p)}function f(d){return d===o||d===92?(e.consume(d),p):p(d)}}function Dc(e,t){let n;return r;function r(s){return rt(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):Ct(s)?zt(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const fH={name:"definition",tokenize:hH},pH={partial:!0,tokenize:mH};function hH(e,t,n){const r=this;let s;return i;function i(h){return e.enter("definition"),o(h)}function o(h){return W_.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function l(h){return s=tl(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 Sr(h)?Dc(e,u)(h):u(h)}function u(h){return B_(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function p(h){return e.attempt(pH,f,f)(h)}function f(h){return Ct(h)?zt(e,d,"whitespace")(h):d(h)}function d(h){return h===null||rt(h)?(e.exit("definition"),r.parser.defined.push(s),t(h)):n(h)}}function mH(e,t,n){return r;function r(l){return Sr(l)?Dc(e,s)(l):n(l)}function s(l){return V_(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return Ct(l)?zt(e,o,"whitespace")(l):o(l)}function o(l){return l===null||rt(l)?t(l):n(l)}}const gH={name:"hardBreakEscape",tokenize:yH};function yH(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return rt(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const xH={name:"headingAtx",resolve:wH,tokenize:bH};function wH(e,t){let n=e.length-2,r=3,s,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Xs(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function bH(e,t,n){let r=0;return s;function s(p){return e.enter("atxHeading"),i(p)}function i(p){return e.enter("atxHeadingSequence"),o(p)}function o(p){return p===35&&r++<6?(e.consume(p),o):p===null||Sr(p)?(e.exit("atxHeadingSequence"),l(p)):n(p)}function l(p){return p===35?(e.enter("atxHeadingSequence"),c(p)):p===null||rt(p)?(e.exit("atxHeading"),t(p)):Ct(p)?zt(e,l,"whitespace")(p):(e.enter("atxHeadingText"),u(p))}function c(p){return p===35?(e.consume(p),c):(e.exit("atxHeadingSequence"),l(p))}function u(p){return p===null||p===35||Sr(p)?(e.exit("atxHeadingText"),l(p)):(e.consume(p),u)}}const vH=["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"],Zk=["pre","script","style","textarea"],kH={concrete:!0,name:"htmlFlow",resolveTo:jH,tokenize:CH},SH={partial:!0,tokenize:_H},NH={partial:!0,tokenize:EH};function jH(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 CH(e,t,n){const r=this;let s,i,o,l,c;return u;function u(V){return p(V)}function p(V){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(V),f}function f(V){return V===33?(e.consume(V),d):V===47?(e.consume(V),i=!0,w):V===63?(e.consume(V),s=3,r.interrupt?t:_):Bs(V)?(e.consume(V),o=String.fromCharCode(V),k):n(V)}function d(V){return V===45?(e.consume(V),s=2,h):V===91?(e.consume(V),s=5,l=0,y):Bs(V)?(e.consume(V),s=4,r.interrupt?t:_):n(V)}function h(V){return V===45?(e.consume(V),r.interrupt?t:_):n(V)}function y(V){const Z="CDATA[";return V===Z.charCodeAt(l++)?(e.consume(V),l===Z.length?r.interrupt?t:R:y):n(V)}function w(V){return Bs(V)?(e.consume(V),o=String.fromCharCode(V),k):n(V)}function k(V){if(V===null||V===47||V===62||Sr(V)){const Z=V===47,ue=o.toLowerCase();return!Z&&!i&&Zk.includes(ue)?(s=1,r.interrupt?t(V):R(V)):vH.includes(o.toLowerCase())?(s=6,Z?(e.consume(V),g):r.interrupt?t(V):R(V)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(V):i?b(V):x(V))}return V===45||$r(V)?(e.consume(V),o+=String.fromCharCode(V),k):n(V)}function g(V){return V===62?(e.consume(V),r.interrupt?t:R):n(V)}function b(V){return Ct(V)?(e.consume(V),b):W(V)}function x(V){return V===47?(e.consume(V),W):V===58||V===95||Bs(V)?(e.consume(V),S):Ct(V)?(e.consume(V),x):W(V)}function S(V){return V===45||V===46||V===58||V===95||$r(V)?(e.consume(V),S):C(V)}function C(V){return V===61?(e.consume(V),j):Ct(V)?(e.consume(V),C):x(V)}function j(V){return V===null||V===60||V===61||V===62||V===96?n(V):V===34||V===39?(e.consume(V),c=V,E):Ct(V)?(e.consume(V),j):A(V)}function E(V){return V===c?(e.consume(V),c=null,D):V===null||rt(V)?n(V):(e.consume(V),E)}function A(V){return V===null||V===34||V===39||V===47||V===60||V===61||V===62||V===96||Sr(V)?C(V):(e.consume(V),A)}function D(V){return V===47||V===62||Ct(V)?x(V):n(V)}function W(V){return V===62?(e.consume(V),F):n(V)}function F(V){return V===null||rt(V)?R(V):Ct(V)?(e.consume(V),F):n(V)}function R(V){return V===45&&s===2?(e.consume(V),T):V===60&&s===1?(e.consume(V),O):V===62&&s===4?(e.consume(V),Y):V===63&&s===3?(e.consume(V),_):V===93&&s===5?(e.consume(V),H):rt(V)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(SH,U,$)(V)):V===null||rt(V)?(e.exit("htmlFlowData"),$(V)):(e.consume(V),R)}function $(V){return e.check(NH,P,U)(V)}function P(V){return e.enter("lineEnding"),e.consume(V),e.exit("lineEnding"),L}function L(V){return V===null||rt(V)?$(V):(e.enter("htmlFlowData"),R(V))}function T(V){return V===45?(e.consume(V),_):R(V)}function O(V){return V===47?(e.consume(V),o="",I):R(V)}function I(V){if(V===62){const Z=o.toLowerCase();return Zk.includes(Z)?(e.consume(V),Y):R(V)}return Bs(V)&&o.length<8?(e.consume(V),o+=String.fromCharCode(V),I):R(V)}function H(V){return V===93?(e.consume(V),_):R(V)}function _(V){return V===62?(e.consume(V),Y):V===45&&s===2?(e.consume(V),_):R(V)}function Y(V){return V===null||rt(V)?(e.exit("htmlFlowData"),U(V)):(e.consume(V),Y)}function U(V){return e.exit("htmlFlow"),t(V)}}function EH(e,t,n){const r=this;return s;function s(o){return rt(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):n(o)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function _H(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(uh,t,n)}}const PH={name:"htmlText",tokenize:AH};function AH(e,t,n){const r=this;let s,i,o;return l;function l(_){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(_),c}function c(_){return _===33?(e.consume(_),u):_===47?(e.consume(_),C):_===63?(e.consume(_),x):Bs(_)?(e.consume(_),A):n(_)}function u(_){return _===45?(e.consume(_),p):_===91?(e.consume(_),i=0,y):Bs(_)?(e.consume(_),b):n(_)}function p(_){return _===45?(e.consume(_),h):n(_)}function f(_){return _===null?n(_):_===45?(e.consume(_),d):rt(_)?(o=f,O(_)):(e.consume(_),f)}function d(_){return _===45?(e.consume(_),h):f(_)}function h(_){return _===62?T(_):_===45?d(_):f(_)}function y(_){const Y="CDATA[";return _===Y.charCodeAt(i++)?(e.consume(_),i===Y.length?w:y):n(_)}function w(_){return _===null?n(_):_===93?(e.consume(_),k):rt(_)?(o=w,O(_)):(e.consume(_),w)}function k(_){return _===93?(e.consume(_),g):w(_)}function g(_){return _===62?T(_):_===93?(e.consume(_),g):w(_)}function b(_){return _===null||_===62?T(_):rt(_)?(o=b,O(_)):(e.consume(_),b)}function x(_){return _===null?n(_):_===63?(e.consume(_),S):rt(_)?(o=x,O(_)):(e.consume(_),x)}function S(_){return _===62?T(_):x(_)}function C(_){return Bs(_)?(e.consume(_),j):n(_)}function j(_){return _===45||$r(_)?(e.consume(_),j):E(_)}function E(_){return rt(_)?(o=E,O(_)):Ct(_)?(e.consume(_),E):T(_)}function A(_){return _===45||$r(_)?(e.consume(_),A):_===47||_===62||Sr(_)?D(_):n(_)}function D(_){return _===47?(e.consume(_),T):_===58||_===95||Bs(_)?(e.consume(_),W):rt(_)?(o=D,O(_)):Ct(_)?(e.consume(_),D):T(_)}function W(_){return _===45||_===46||_===58||_===95||$r(_)?(e.consume(_),W):F(_)}function F(_){return _===61?(e.consume(_),R):rt(_)?(o=F,O(_)):Ct(_)?(e.consume(_),F):D(_)}function R(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(e.consume(_),s=_,$):rt(_)?(o=R,O(_)):Ct(_)?(e.consume(_),R):(e.consume(_),P)}function $(_){return _===s?(e.consume(_),s=void 0,L):_===null?n(_):rt(_)?(o=$,O(_)):(e.consume(_),$)}function P(_){return _===null||_===34||_===39||_===60||_===61||_===96?n(_):_===47||_===62||Sr(_)?D(_):(e.consume(_),P)}function L(_){return _===47||_===62||Sr(_)?D(_):n(_)}function T(_){return _===62?(e.consume(_),e.exit("htmlTextData"),e.exit("htmlText"),t):n(_)}function O(_){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),I}function I(_){return Ct(_)?zt(e,H,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):H(_)}function H(_){return e.enter("htmlTextData"),o(_)}}const vw={name:"labelEnd",resolveAll:MH,resolveTo:LH,tokenize:$H},IH={tokenize:OH},TH={tokenize:DH},RH={tokenize:FH};function MH(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const s=r.type==="labelImage"?4:2;r.type="data",t+=s}}return e.length!==n.length&&Xs(e,0,e.length,n),e}function LH(e,t){let n=e.length,r=0,s,i,o,l;for(;n--;)if(s=e[n][1],i){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(i=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(o=n);const c={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[i][1].start},end:{...e[o][1].end}},p={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",c,t],["enter",u,t]],l=Xr(l,e.slice(i+1,i+r+3)),l=Xr(l,[["enter",p,t]]),l=Xr(l,bw(t.parser.constructs.insideSpan.null,e.slice(i+r+4,o-3),t)),l=Xr(l,[["exit",p,t],e[o-2],e[o-1],["exit",u,t]]),l=Xr(l,e.slice(o+1)),l=Xr(l,[["exit",c,t]]),Xs(e,i,e.length,l),e}function $H(e,t,n){const r=this;let s=r.events.length,i,o;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){i=r.events[s][1];break}return l;function l(d){return i?i._inactive?f(d):(o=r.parser.defined.includes(tl(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelEnd"),c):n(d)}function c(d){return d===40?e.attempt(IH,p,o?p:f)(d):d===91?e.attempt(TH,p,o?u:f)(d):o?p(d):f(d)}function u(d){return e.attempt(RH,p,f)(d)}function p(d){return t(d)}function f(d){return i._balanced=!0,n(d)}}function OH(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),s}function s(f){return Sr(f)?Dc(e,i)(f):i(f)}function i(f){return f===41?p(f):B_(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function o(f){return Sr(f)?Dc(e,c)(f):p(f)}function l(f){return n(f)}function c(f){return f===34||f===39||f===40?V_(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):p(f)}function u(f){return Sr(f)?Dc(e,p)(f):p(f)}function p(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function DH(e,t,n){const r=this;return s;function s(l){return W_.call(r,e,i,o,"reference","referenceMarker","referenceString")(l)}function i(l){return r.parser.defined.includes(tl(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function o(l){return n(l)}}function FH(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),s}function s(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const zH={name:"labelStartImage",resolveAll:vw.resolveAll,tokenize:HH};function HH(e,t,n){const r=this;return s;function s(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),i}function i(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),o):n(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const BH={name:"labelStartLink",resolveAll:vw.resolveAll,tokenize:WH};function WH(e,t,n){const r=this;return s;function s(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const Am={name:"lineEnding",tokenize:VH};function VH(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),zt(e,t,"linePrefix")}}const _f={name:"thematicBreak",tokenize:KH};function KH(e,t,n){let r=0,s;return i;function i(u){return e.enter("thematicBreak"),o(u)}function o(u){return s=u,l(u)}function l(u){return u===s?(e.enter("thematicBreakSequence"),c(u)):r>=3&&(u===null||rt(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===s?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),Ct(u)?zt(e,l,"whitespace")(u):l(u))}}const mr={continuation:{tokenize:GH},exit:JH,name:"list",tokenize:YH},UH={partial:!0,tokenize:QH},qH={partial:!0,tokenize:XH};function YH(e,t,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,o=0;return l;function l(h){const y=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:Ey(h)){if(r.containerState.type||(r.containerState.type=y,e.enter(y,{_container:!0})),y==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(_f,n,u)(h):u(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(h)}return n(h)}function c(h){return Ey(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"),u(h)):n(h)}function u(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check(uh,r.interrupt?n:p,e.attempt(UH,d,f))}function p(h){return r.containerState.initialBlankLine=!0,i++,d(h)}function f(h){return Ct(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),d):n(h)}function d(h){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function GH(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(uh,s,i);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,zt(e,t,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!Ct(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(qH,t,o)(l))}function o(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,zt(e,e.attempt(mr,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function XH(e,t,n){const r=this;return zt(e,s,"listItemIndent",r.containerState.size+1);function s(i){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(i):n(i)}}function JH(e){e.exit(this.containerState.type)}function QH(e,t,n){const r=this;return zt(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const o=r.events[r.events.length-1];return!Ct(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const eS={name:"setextUnderline",resolveTo:ZH,tokenize:eB};function ZH(e,t){let n=e.length,r,s,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",i?(e.splice(s,0,["enter",o,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function eB(e,t,n){const r=this;let s;return i;function i(u){let p=r.events.length,f;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){f=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),s=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===s?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),Ct(u)?zt(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||rt(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const tB={tokenize:nB};function nB(e){const t=this,n=e.attempt(uh,r,e.attempt(this.parser.constructs.flowInitial,s,zt(e,e.attempt(this.parser.constructs.flow,s,e.attempt(aH,s)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const rB={resolveAll:U_()},sB=K_("string"),iB=K_("text");function K_(e){return{resolveAll:U_(e==="text"?oB:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],i=n.attempt(s,o,l);return o;function o(p){return u(p)?i(p):l(p)}function l(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),c}function c(p){return u(p)?(n.exit("data"),i(p)):(n.consume(p),c)}function u(p){if(p===null)return!0;const f=s[p];let d=-1;if(f)for(;++d<f.length;){const h=f[d];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function U_(e){return t;function t(n,r){let s=-1,i;for(;++s<=n.length;)i===void 0?n[s]&&n[s][1].type==="data"&&(i=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==i+2&&(n[i][1].end=n[s-1][1].end,n.splice(i+2,s-i-2),s=i+2),i=void 0);return e?e(n,r):n}}function oB(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],s=t.sliceStream(r);let i=s.length,o=-1,l=0,c;for(;i--;){const u=s[i];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)l++,o--;if(o)break;o=-1}else if(u===-2)c=!0,l++;else if(u!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const u={type:n===e.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:r.start._bufferIndex+o,_index:r.start._index+i,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const aB={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:D_},lB={91:fH},cB={[-2]:Pm,[-1]:Pm,32:Pm},uB={35:xH,42:_f,45:[eS,_f],60:kH,61:eS,95:_f,96:Qk,126:Qk},dB={38:z_,92:F_},fB={[-5]:Am,[-4]:Am,[-3]:Am,33:zH,38:z_,42:_y,60:[B5,PH],91:BH,92:[gH,F_],93:vw,95:_y,96:tH},pB={null:[_y,rB]},hB={null:[42,95]},mB={null:[]},gB=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:hB,contentInitial:lB,disable:mB,document:aB,flow:uB,flowInitial:cB,insideSpan:pB,string:dB,text:fB},Symbol.toStringTag,{value:"Module"}));function yB(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},i=[];let o=[],l=[];const c={attempt:E(C),check:E(j),consume:b,enter:x,exit:S,interrupt:E(j,{interrupt:!0})},u={code:null,containerState:{},defineSkip:w,events:[],now:y,parser:e,previous:null,sliceSerialize:d,sliceStream:h,write:f};let p=t.tokenize.call(u,c);return t.resolveAll&&i.push(t),u;function f(F){return o=Xr(o,F),k(),o[o.length-1]!==null?[]:(A(t,0),u.events=bw(i,u.events,u),u.events)}function d(F,R){return wB(h(F),R)}function h(F){return xB(o,F)}function y(){const{_bufferIndex:F,_index:R,line:$,column:P,offset:L}=r;return{_bufferIndex:F,_index:R,line:$,column:P,offset:L}}function w(F){s[F.line]=F.column,W()}function k(){let F;for(;r._index<o.length;){const R=o[r._index];if(typeof R=="string")for(F=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===F&&r._bufferIndex<R.length;)g(R.charCodeAt(r._bufferIndex));else g(R)}}function g(F){p=p(F)}function b(F){rt(F)?(r.line++,r.column=1,r.offset+=F===-3?2:1,W()):F!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=F}function x(F,R){const $=R||{};return $.type=F,$.start=y(),u.events.push(["enter",$,u]),l.push($),$}function S(F){const R=l.pop();return R.end=y(),u.events.push(["exit",R,u]),R}function C(F,R){A(F,R.from)}function j(F,R){R.restore()}function E(F,R){return $;function $(P,L,T){let O,I,H,_;return Array.isArray(P)?U(P):"tokenize"in P?U([P]):Y(P);function Y(le){return we;function we(re){const ye=re!==null&&le[re],te=re!==null&&le.null,ie=[...Array.isArray(ye)?ye:ye?[ye]:[],...Array.isArray(te)?te:te?[te]:[]];return U(ie)(re)}}function U(le){return O=le,I=0,le.length===0?T:V(le[I])}function V(le){return we;function we(re){return _=D(),H=le,le.partial||(u.currentConstruct=le),le.name&&u.parser.constructs.disable.null.includes(le.name)?ue():le.tokenize.call(R?Object.assign(Object.create(u),R):u,c,Z,ue)(re)}}function Z(le){return F(H,_),L}function ue(le){return _.restore(),++I<O.length?V(O[I]):T}}}function A(F,R){F.resolveAll&&!i.includes(F)&&i.push(F),F.resolve&&Xs(u.events,R,u.events.length-R,F.resolve(u.events.slice(R),u)),F.resolveTo&&(u.events=F.resolveTo(u.events,u))}function D(){const F=y(),R=u.previous,$=u.currentConstruct,P=u.events.length,L=Array.from(l);return{from:P,restore:T};function T(){r=F,u.previous=R,u.currentConstruct=$,u.events.length=P,l=L,W()}}function W(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function xB(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,i=t.end._bufferIndex;let o;if(n===s)o=[e[n].slice(r,i)];else{if(o=e.slice(n,s),r>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(r):o.shift()}i>0&&o.push(e[s].slice(0,i))}return o}function wB(e,t){let n=-1;const r=[];let s;for(;++n<e.length;){const i=e[n];let o;if(typeof i=="string")o=i;else switch(i){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&&s)continue;o=" ";break}default:o=String.fromCharCode(i)}s=i===-2,r.push(o)}return r.join("")}function bB(e){const r={constructs:E5([gB,...(e||{}).extensions||[]]),content:s(L5),defined:[],document:s(O5),flow:s(tB),lazy:{},string:s(sB),text:s(iB)};return r;function s(i){return o;function o(l){return yB(r,i,l)}}}function vB(e){for(;!H_(e););return e}const tS=/[\0\t\n\r]/g;function kB(){let e=1,t="",n=!0,r;return s;function s(i,o,l){const c=[];let u,p,f,d,h;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),f=0,t="",n&&(i.charCodeAt(0)===65279&&f++,n=void 0);f<i.length;){if(tS.lastIndex=f,u=tS.exec(i),d=u&&u.index!==void 0?u.index:i.length,h=i.charCodeAt(d),!u){t=i.slice(f);break}if(h===10&&f===d&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),f<d&&(c.push(i.slice(f,d)),e+=d-f),h){case 0:{c.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,c.push(-2);e++<p;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}f=d+1}return l&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const SB=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function NB(e){return e.replace(SB,jB)}function jB(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return O_(n.slice(i?2:1),i?16:10)}return ww(n)||e}const q_={}.hasOwnProperty;function CB(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),EB(n)(vB(bB(n).document().write(kB()(e,t,!0))))}function EB(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Ae),autolinkProtocol:D,autolinkEmail:D,atxHeading:i(He),blockQuote:i(te),characterEscape:D,characterReference:D,codeFenced:i(ie),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(ie,o),codeText:i(ce,o),codeTextData:D,data:D,codeFlowValue:D,definition:i(pe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(De),hardBreakEscape:i(Ie),hardBreakTrailing:i(Ie),htmlFlow:i(et,o),htmlFlowData:D,htmlText:i(et,o),htmlTextData:D,image:i(ut),label:o,link:i(Ae),listItem:i(qt),listItemValue:d,listOrdered:i(Qe,f),listUnordered:i(Qe),paragraph:i(Te),reference:V,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(He),strong:i(Ht),thematicBreak:i(dn)},exit:{atxHeading:c(),atxHeadingSequence:C,autolink:c(),autolinkEmail:ye,autolinkProtocol:re,blockQuote:c(),characterEscapeValue:W,characterReferenceMarkerHexadecimal:ue,characterReferenceMarkerNumeric:ue,characterReferenceValue:le,characterReference:we,codeFenced:c(k),codeFencedFence:w,codeFencedFenceInfo:h,codeFencedFenceMeta:y,codeFlowValue:W,codeIndented:c(g),codeText:c(L),codeTextData:W,data:W,definition:c(),definitionDestinationString:S,definitionLabelString:b,definitionTitleString:x,emphasis:c(),hardBreakEscape:c(R),hardBreakTrailing:c(R),htmlFlow:c($),htmlFlowData:W,htmlText:c(P),htmlTextData:W,image:c(O),label:H,labelText:I,lineEnding:F,link:c(T),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:Z,resourceDestinationString:_,resourceTitleString:Y,resource:U,setextHeading:c(A),setextHeadingLineSequence:E,setextHeadingText:j,strong:c(),thematicBreak:c()}};Y_(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(ne){let me={type:"root",children:[]};const Oe={stack:[me],tokenStack:[],config:t,enter:l,exit:u,buffer:o,resume:p,data:n},Fe=[];let Ve=-1;for(;++Ve<ne.length;)if(ne[Ve][1].type==="listOrdered"||ne[Ve][1].type==="listUnordered")if(ne[Ve][0]==="enter")Fe.push(Ve);else{const Et=Fe.pop();Ve=s(ne,Et,Ve)}for(Ve=-1;++Ve<ne.length;){const Et=t[ne[Ve][0]];q_.call(Et,ne[Ve][1].type)&&Et[ne[Ve][1].type].call(Object.assign({sliceSerialize:ne[Ve][2].sliceSerialize},Oe),ne[Ve][1])}if(Oe.tokenStack.length>0){const Et=Oe.tokenStack[Oe.tokenStack.length-1];(Et[1]||nS).call(Oe,void 0,Et[0])}for(me.position={start:Li(ne.length>0?ne[0][1].start:{line:1,column:1,offset:0}),end:Li(ne.length>0?ne[ne.length-2][1].end:{line:1,column:1,offset:0})},Ve=-1;++Ve<t.transforms.length;)me=t.transforms[Ve](me)||me;return me}function s(ne,me,Oe){let Fe=me-1,Ve=-1,Et=!1,Lt,tt,fn,kt;for(;++Fe<=Oe;){const Nt=ne[Fe];switch(Nt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Nt[0]==="enter"?Ve++:Ve--,kt=void 0;break}case"lineEndingBlank":{Nt[0]==="enter"&&(Lt&&!kt&&!Ve&&!fn&&(fn=Fe),kt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:kt=void 0}if(!Ve&&Nt[0]==="enter"&&Nt[1].type==="listItemPrefix"||Ve===-1&&Nt[0]==="exit"&&(Nt[1].type==="listUnordered"||Nt[1].type==="listOrdered")){if(Lt){let tn=Fe;for(tt=void 0;tn--;){const nn=ne[tn];if(nn[1].type==="lineEnding"||nn[1].type==="lineEndingBlank"){if(nn[0]==="exit")continue;tt&&(ne[tt][1].type="lineEndingBlank",Et=!0),nn[1].type="lineEnding",tt=tn}else if(!(nn[1].type==="linePrefix"||nn[1].type==="blockQuotePrefix"||nn[1].type==="blockQuotePrefixWhitespace"||nn[1].type==="blockQuoteMarker"||nn[1].type==="listItemIndent"))break}fn&&(!tt||fn<tt)&&(Lt._spread=!0),Lt.end=Object.assign({},tt?ne[tt][1].start:Nt[1].end),ne.splice(tt||Fe,0,["exit",Lt,Nt[2]]),Fe++,Oe++}if(Nt[1].type==="listItemPrefix"){const tn={type:"listItem",_spread:!1,start:Object.assign({},Nt[1].start),end:void 0};Lt=tn,ne.splice(Fe,0,["enter",tn,Nt[2]]),Fe++,Oe++,fn=void 0,kt=!0}}}return ne[me][1]._spread=Et,Oe}function i(ne,me){return Oe;function Oe(Fe){l.call(this,ne(Fe),Fe),me&&me.call(this,Fe)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(ne,me,Oe){this.stack[this.stack.length-1].children.push(ne),this.stack.push(ne),this.tokenStack.push([me,Oe||void 0]),ne.position={start:Li(me.start),end:void 0}}function c(ne){return me;function me(Oe){ne&&ne.call(this,Oe),u.call(this,Oe)}}function u(ne,me){const Oe=this.stack.pop(),Fe=this.tokenStack.pop();if(Fe)Fe[0].type!==ne.type&&(me?me.call(this,ne,Fe[0]):(Fe[1]||nS).call(this,ne,Fe[0]));else throw new Error("Cannot close `"+ne.type+"` ("+Oc({start:ne.start,end:ne.end})+"): it’s not open");Oe.position.end=Li(ne.end)}function p(){return j5(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function d(ne){if(this.data.expectingFirstListItemValue){const me=this.stack[this.stack.length-2];me.start=Number.parseInt(this.sliceSerialize(ne),10),this.data.expectingFirstListItemValue=void 0}}function h(){const ne=this.resume(),me=this.stack[this.stack.length-1];me.lang=ne}function y(){const ne=this.resume(),me=this.stack[this.stack.length-1];me.meta=ne}function w(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function k(){const ne=this.resume(),me=this.stack[this.stack.length-1];me.value=ne.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){const ne=this.resume(),me=this.stack[this.stack.length-1];me.value=ne.replace(/(\r?\n|\r)$/g,"")}function b(ne){const me=this.resume(),Oe=this.stack[this.stack.length-1];Oe.label=me,Oe.identifier=tl(this.sliceSerialize(ne)).toLowerCase()}function x(){const ne=this.resume(),me=this.stack[this.stack.length-1];me.title=ne}function S(){const ne=this.resume(),me=this.stack[this.stack.length-1];me.url=ne}function C(ne){const me=this.stack[this.stack.length-1];if(!me.depth){const Oe=this.sliceSerialize(ne).length;me.depth=Oe}}function j(){this.data.setextHeadingSlurpLineEnding=!0}function E(ne){const me=this.stack[this.stack.length-1];me.depth=this.sliceSerialize(ne).codePointAt(0)===61?1:2}function A(){this.data.setextHeadingSlurpLineEnding=void 0}function D(ne){const Oe=this.stack[this.stack.length-1].children;let Fe=Oe[Oe.length-1];(!Fe||Fe.type!=="text")&&(Fe=st(),Fe.position={start:Li(ne.start),end:void 0},Oe.push(Fe)),this.stack.push(Fe)}function W(ne){const me=this.stack.pop();me.value+=this.sliceSerialize(ne),me.position.end=Li(ne.end)}function F(ne){const me=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Oe=me.children[me.children.length-1];Oe.position.end=Li(ne.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(me.type)&&(D.call(this,ne),W.call(this,ne))}function R(){this.data.atHardBreak=!0}function $(){const ne=this.resume(),me=this.stack[this.stack.length-1];me.value=ne}function P(){const ne=this.resume(),me=this.stack[this.stack.length-1];me.value=ne}function L(){const ne=this.resume(),me=this.stack[this.stack.length-1];me.value=ne}function T(){const ne=this.stack[this.stack.length-1];if(this.data.inReference){const me=this.data.referenceType||"shortcut";ne.type+="Reference",ne.referenceType=me,delete ne.url,delete ne.title}else delete ne.identifier,delete ne.label;this.data.referenceType=void 0}function O(){const ne=this.stack[this.stack.length-1];if(this.data.inReference){const me=this.data.referenceType||"shortcut";ne.type+="Reference",ne.referenceType=me,delete ne.url,delete ne.title}else delete ne.identifier,delete ne.label;this.data.referenceType=void 0}function I(ne){const me=this.sliceSerialize(ne),Oe=this.stack[this.stack.length-2];Oe.label=NB(me),Oe.identifier=tl(me).toLowerCase()}function H(){const ne=this.stack[this.stack.length-1],me=this.resume(),Oe=this.stack[this.stack.length-1];if(this.data.inReference=!0,Oe.type==="link"){const Fe=ne.children;Oe.children=Fe}else Oe.alt=me}function _(){const ne=this.resume(),me=this.stack[this.stack.length-1];me.url=ne}function Y(){const ne=this.resume(),me=this.stack[this.stack.length-1];me.title=ne}function U(){this.data.inReference=void 0}function V(){this.data.referenceType="collapsed"}function Z(ne){const me=this.resume(),Oe=this.stack[this.stack.length-1];Oe.label=me,Oe.identifier=tl(this.sliceSerialize(ne)).toLowerCase(),this.data.referenceType="full"}function ue(ne){this.data.characterReferenceType=ne.type}function le(ne){const me=this.sliceSerialize(ne),Oe=this.data.characterReferenceType;let Fe;Oe?(Fe=O_(me,Oe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Fe=ww(me);const Ve=this.stack[this.stack.length-1];Ve.value+=Fe}function we(ne){const me=this.stack.pop();me.position.end=Li(ne.end)}function re(ne){W.call(this,ne);const me=this.stack[this.stack.length-1];me.url=this.sliceSerialize(ne)}function ye(ne){W.call(this,ne);const me=this.stack[this.stack.length-1];me.url="mailto:"+this.sliceSerialize(ne)}function te(){return{type:"blockquote",children:[]}}function ie(){return{type:"code",lang:null,meta:null,value:""}}function ce(){return{type:"inlineCode",value:""}}function pe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function De(){return{type:"emphasis",children:[]}}function He(){return{type:"heading",depth:0,children:[]}}function Ie(){return{type:"break"}}function et(){return{type:"html",value:""}}function ut(){return{type:"image",title:null,url:"",alt:null}}function Ae(){return{type:"link",title:null,url:"",children:[]}}function Qe(ne){return{type:"list",ordered:ne.type==="listOrdered",start:null,spread:ne._spread,children:[]}}function qt(ne){return{type:"listItem",spread:ne._spread,checked:null,children:[]}}function Te(){return{type:"paragraph",children:[]}}function Ht(){return{type:"strong",children:[]}}function st(){return{type:"text",value:""}}function dn(){return{type:"thematicBreak"}}}function Li(e){return{line:e.line,column:e.column,offset:e.offset}}function Y_(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Y_(e,r):_B(e,r)}}function _B(e,t){let n;for(n in t)if(q_.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 nS(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Oc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Oc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Oc({start:t.start,end:t.end})+") is still open")}function PB(e){const t=this;t.parser=n;function n(r){return CB(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function AB(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 IB(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
70
- `}]}function TB(e,t){const n=t.value?t.value+`
71
- `:"",r={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(r.className=["language-"+s[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function RB(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function MB(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function LB(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=Pl(r.toLowerCase()),i=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=i+1,l+=1,e.footnoteCounts.set(r,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function $B(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 OB(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function G_(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const s=e.all(t),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const o=s[s.length-1];return o&&o.type==="text"?o.value+=r:s.push({type:"text",value:r}),s}function DB(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return G_(e,t);const s={src:Pl(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,i),e.applyData(t,i)}function FB(e,t){const n={src:Pl(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 zB(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 HB(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return G_(e,t);const s={href:Pl(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function BB(e,t){const n={href:Pl(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 WB(e,t,n){const r=e.all(t),s=n?VB(n):X_(t),i={},o=[];if(typeof t.checked=="boolean"){const p=r[0];let f;p&&p.type==="element"&&p.tagName==="p"?f=p:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const p=r[l];(s||l!==0||p.type!=="element"||p.tagName!=="p")&&o.push({type:"text",value:`
72
- `}),p.type==="element"&&p.tagName==="p"&&!s?o.push(...p.children):o.push(p)}const c=r[r.length-1];c&&(s||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:`
73
- `});const u={type:"element",tagName:"li",properties:i,children:o};return e.patch(t,u),e.applyData(t,u)}function VB(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=X_(n[r])}return t}function X_(e){const t=e.spread;return t??e.children.length>1}function KB(e,t){const n={},r=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<r.length;){const o=r[s];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 i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function UB(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function qB(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function YB(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function GB(e,t){const n=e.all(t),r=n.shift(),s=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],o),s.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=mw(t.children[1]),c=A_(t.children[t.children.length-1]);l&&c&&(o.position={start:l,end:c}),s.push(o)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function XB(e,t,n){const r=n?n.children:void 0,i=(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 u=[];for(;++c<l;){const f=t.children[c],d={},h=o?o[c]:void 0;h&&(d.align=h);let y={type:"element",tagName:i,properties:d,children:[]};f&&(y.children=e.all(f),e.patch(f,y),y=e.applyData(f,y)),u.push(y)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,p),e.applyData(t,p)}function JB(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const rS=9,sS=32;function QB(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const i=[];for(;r;)i.push(iS(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(iS(t.slice(s),s>0,!1)),i.join("")}function iS(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===rS||i===sS;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===rS||i===sS;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function ZB(e,t){const n={type:"text",value:QB(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function e6(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const t6={blockquote:AB,break:IB,code:TB,delete:RB,emphasis:MB,footnoteReference:LB,heading:$B,html:OB,imageReference:DB,image:FB,inlineCode:zB,linkReference:HB,link:BB,listItem:WB,list:KB,paragraph:UB,root:qB,strong:YB,table:GB,tableCell:JB,tableRow:XB,text:ZB,thematicBreak:e6,toml:Vd,yaml:Vd,definition:Vd,footnoteDefinition:Vd};function Vd(){}const J_=-1,dh=0,Fc=1,hp=2,kw=3,Sw=4,Nw=5,jw=6,Q_=7,Z_=8,oS=typeof self=="object"?self:globalThis,n6=(e,t)=>{const n=(s,i)=>(e.set(i,s),s),r=s=>{if(e.has(s))return e.get(s);const[i,o]=t[s];switch(i){case dh:case J_:return n(o,s);case Fc:{const l=n([],s);for(const c of o)l.push(r(c));return l}case hp:{const l=n({},s);for(const[c,u]of o)l[r(c)]=r(u);return l}case kw:return n(new Date(o),s);case Sw:{const{source:l,flags:c}=o;return n(new RegExp(l,c),s)}case Nw:{const l=n(new Map,s);for(const[c,u]of o)l.set(r(c),r(u));return l}case jw:{const l=n(new Set,s);for(const c of o)l.add(r(c));return l}case Q_:{const{name:l,message:c}=o;return n(new oS[l](c),s)}case Z_:return n(BigInt(o),s);case"BigInt":return n(Object(BigInt(o)),s);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 oS[i](o),s)};return r},aS=e=>n6(new Map,e)(0),ka="",{toString:r6}={},{keys:s6}=Object,uc=e=>{const t=typeof e;if(t!=="object"||!e)return[dh,t];const n=r6.call(e).slice(8,-1);switch(n){case"Array":return[Fc,ka];case"Object":return[hp,ka];case"Date":return[kw,ka];case"RegExp":return[Sw,ka];case"Map":return[Nw,ka];case"Set":return[jw,ka];case"DataView":return[Fc,n]}return n.includes("Array")?[Fc,n]:n.includes("Error")?[Q_,n]:[hp,n]},Kd=([e,t])=>e===dh&&(t==="function"||t==="symbol"),i6=(e,t,n,r)=>{const s=(o,l)=>{const c=r.push(o)-1;return n.set(l,c),c},i=o=>{if(n.has(o))return n.get(o);let[l,c]=uc(o);switch(l){case dh:{let p=o;switch(c){case"bigint":l=Z_,p=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);p=null;break;case"undefined":return s([J_],o)}return s([l,p],o)}case Fc:{if(c){let d=o;return c==="DataView"?d=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(d=new Uint8Array(o)),s([c,[...d]],o)}const p=[],f=s([l,p],o);for(const d of o)p.push(i(d));return f}case hp:{if(c)switch(c){case"BigInt":return s([c,o.toString()],o);case"Boolean":case"Number":case"String":return s([c,o.valueOf()],o)}if(t&&"toJSON"in o)return i(o.toJSON());const p=[],f=s([l,p],o);for(const d of s6(o))(e||!Kd(uc(o[d])))&&p.push([i(d),i(o[d])]);return f}case kw:return s([l,o.toISOString()],o);case Sw:{const{source:p,flags:f}=o;return s([l,{source:p,flags:f}],o)}case Nw:{const p=[],f=s([l,p],o);for(const[d,h]of o)(e||!(Kd(uc(d))||Kd(uc(h))))&&p.push([i(d),i(h)]);return f}case jw:{const p=[],f=s([l,p],o);for(const d of o)(e||!Kd(uc(d)))&&p.push(i(d));return f}}const{message:u}=o;return s([l,{name:c,message:u}],o)};return i},lS=(e,{json:t,lossy:n}={})=>{const r=[];return i6(!(t||n),!!t,new Map,r)(e),r},mp=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?aS(lS(e,t)):structuredClone(e):(e,t)=>aS(lS(e,t));function o6(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 a6(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function l6(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||o6,r=e.options.footnoteBackLabel||a6,s=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[c]);if(!u)continue;const p=e.all(u),f=String(u.identifier).toUpperCase(),d=Pl(f.toLowerCase());let h=0;const y=[],w=e.footnoteCounts.get(f);for(;w!==void 0&&++h<=w;){y.length>0&&y.push({type:"text",value:" "});let b=typeof n=="string"?n:n(c,h);typeof b=="string"&&(b={type:"text",value:b}),y.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+d+(h>1?"-"+h:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,h),className:["data-footnote-backref"]},children:Array.isArray(b)?b:[b]})}const k=p[p.length-1];if(k&&k.type==="element"&&k.tagName==="p"){const b=k.children[k.children.length-1];b&&b.type==="text"?b.value+=" ":k.children.push({type:"text",value:" "}),k.children.push(...y)}else p.push(...y);const g={type:"element",tagName:"li",properties:{id:t+"fn-"+d},children:e.wrap(p,!0)};e.patch(u,g),l.push(g)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...mp(o),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
74
- `},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
75
- `}]}}const eP=function(e){if(e==null)return f6;if(typeof e=="function")return fh(e);if(typeof e=="object")return Array.isArray(e)?c6(e):u6(e);if(typeof e=="string")return d6(e);throw new Error("Expected function, string, or object as test")};function c6(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=eP(e[n]);return fh(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function u6(e){const t=e;return fh(n);function n(r){const s=r;let i;for(i in e)if(s[i]!==t[i])return!1;return!0}}function d6(e){return fh(t);function t(n){return n&&n.type===e}}function fh(e){return t;function t(n,r,s){return!!(p6(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function f6(){return!0}function p6(e){return e!==null&&typeof e=="object"&&"type"in e}const tP=[],h6=!0,cS=!1,m6="skip";function g6(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const i=eP(s),o=r?-1:1;l(e,void 0,[])();function l(c,u,p){const f=c&&typeof c=="object"?c:{};if(typeof f.type=="string"){const h=typeof f.tagName=="string"?f.tagName:typeof f.name=="string"?f.name:void 0;Object.defineProperty(d,"name",{value:"node ("+(c.type+(h?"<"+h+">":""))+")"})}return d;function d(){let h=tP,y,w,k;if((!t||i(c,u,p[p.length-1]||void 0))&&(h=y6(n(c,p)),h[0]===cS))return h;if("children"in c&&c.children){const g=c;if(g.children&&h[0]!==m6)for(w=(r?g.children.length:-1)+o,k=p.concat(g);w>-1&&w<g.children.length;){const b=g.children[w];if(y=l(b,w,k)(),y[0]===cS)return y;w=typeof y[1]=="number"?y[1]:w+o}}return h}}}function y6(e){return Array.isArray(e)?e:typeof e=="number"?[h6,e]:e==null?tP:[e]}function nP(e,t,n,r){let s,i,o;typeof t=="function"&&typeof n!="function"?(i=void 0,o=t,s=n):(i=t,o=n,s=r),g6(e,i,l,s);function l(c,u){const p=u[u.length-1],f=p?p.children.indexOf(c):void 0;return o(c,f,p)}}const Py={}.hasOwnProperty,x6={};function w6(e,t){const n=t||x6,r=new Map,s=new Map,i=new Map,o={...t6,...n.handlers},l={all:u,applyData:v6,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:o,one:c,options:n,patch:b6,wrap:S6};return nP(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const f=p.type==="definition"?r:s,d=String(p.identifier).toUpperCase();f.has(d)||f.set(d,p)}}),l;function c(p,f){const d=p.type,h=l.handlers[d];if(Py.call(l.handlers,d)&&h)return h(l,p,f);if(l.options.passThrough&&l.options.passThrough.includes(d)){if("children"in p){const{children:w,...k}=p,g=mp(k);return g.children=l.all(p),g}return mp(p)}return(l.options.unknownHandler||k6)(l,p,f)}function u(p){const f=[];if("children"in p){const d=p.children;let h=-1;for(;++h<d.length;){const y=l.one(d[h],p);if(y){if(h&&d[h-1].type==="break"&&(!Array.isArray(y)&&y.type==="text"&&(y.value=uS(y.value)),!Array.isArray(y)&&y.type==="element")){const w=y.children[0];w&&w.type==="text"&&(w.value=uS(w.value))}Array.isArray(y)?f.push(...y):f.push(y)}}}return f}}function b6(e,t){e.position&&(t.position=r5(e))}function v6(e,t){let n=t;if(e&&e.data){const r=e.data.hName,s=e.data.hChildren,i=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const o="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:o}}n.type==="element"&&i&&Object.assign(n.properties,mp(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function k6(e,t){const n=t.data||{},r="value"in t&&!(Py.call(n,"hProperties")||Py.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 S6(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 uS(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function dS(e,t){const n=w6(e,t),r=n.one(e,void 0),s=l6(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
79
- `},s),i}function N6(e,t){return e&&"run"in e?async function(n,r){const s=dS(n,{file:r,...t});await e.run(s,r)}:function(n,r){return dS(n,{file:r,...e||t})}}function fS(e){if(e)throw e}var Pf=Object.prototype.hasOwnProperty,rP=Object.prototype.toString,pS=Object.defineProperty,hS=Object.getOwnPropertyDescriptor,mS=function(t){return typeof Array.isArray=="function"?Array.isArray(t):rP.call(t)==="[object Array]"},gS=function(t){if(!t||rP.call(t)!=="[object Object]")return!1;var n=Pf.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Pf.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||Pf.call(t,s)},yS=function(t,n){pS&&n.name==="__proto__"?pS(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},xS=function(t,n){if(n==="__proto__")if(Pf.call(t,n)){if(hS)return hS(t,n).value}else return;return t[n]},j6=function e(){var t,n,r,s,i,o,l=arguments[0],c=1,u=arguments.length,p=!1;for(typeof l=="boolean"&&(p=l,l=arguments[1]||{},c=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});c<u;++c)if(t=arguments[c],t!=null)for(n in t)r=xS(l,n),s=xS(t,n),l!==s&&(p&&s&&(gS(s)||(i=mS(s)))?(i?(i=!1,o=r&&mS(r)?r:[]):o=r&&gS(r)?r:{},yS(l,{name:n,newValue:e(p,o,s)})):typeof s<"u"&&yS(l,{name:n,newValue:s}));return l};const Im=oo(j6);function Ay(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 C6(){const e=[],t={run:n,use:r};return t;function n(...s){let i=-1;const o=s.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);l(null,...s);function l(c,...u){const p=e[++i];let f=-1;if(c){o(c);return}for(;++f<s.length;)(u[f]===null||u[f]===void 0)&&(u[f]=s[f]);s=u,p?E6(p,l)(...u):o(null,...u)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function E6(e,t){let n;return r;function r(...o){const l=e.length>o.length;let c;l&&o.push(s);try{c=e.apply(this,o)}catch(u){const p=u;if(l&&n)throw p;return s(p)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,s):c instanceof Error?s(c):i(c))}function s(o,...l){n||(n=!0,t(o,...l))}function i(o){s(null,o)}}const $s={basename:_6,dirname:P6,extname:A6,join:I6,sep:"/"};function _6(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Hu(e);let n=0,r=-1,s=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,l=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else o<0&&(i=!0,o=s+1),l>-1&&(e.codePointAt(s)===t.codePointAt(l--)?l<0&&(r=s):(l=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function P6(e){if(Hu(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 A6(e){Hu(e);let t=e.length,n=-1,r=0,s=-1,i=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?s<0?s=t:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function I6(...e){let t=-1,n;for(;++t<e.length;)Hu(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":T6(n)}function T6(e){Hu(e);const t=e.codePointAt(0)===47;let n=R6(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function R6(e,t){let n="",r=0,s=-1,i=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(!(s===o-1||i===1))if(s!==o-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),s=o,i=0;continue}}else if(n.length>0){n="",r=0,s=o,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,o):n=e.slice(s+1,o),r=o-s-1;s=o,i=0}else l===46&&i>-1?i++:i=-1}return n}function Hu(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const M6={cwd:L6};function L6(){return"/"}function Iy(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function $6(e){if(typeof e=="string")e=new URL(e);else if(!Iy(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 O6(e)}function O6(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const Tm=["history","path","basename","stem","extname","dirname"];class sP{constructor(t){let n;t?Iy(t)?n={path:t}:typeof t=="string"||D6(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":M6.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Tm.length;){const i=Tm[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let s;for(s in n)Tm.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?$s.basename(this.path):void 0}set basename(t){Mm(t,"basename"),Rm(t,"basename"),this.path=$s.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?$s.dirname(this.path):void 0}set dirname(t){wS(this.basename,"dirname"),this.path=$s.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?$s.extname(this.path):void 0}set extname(t){if(Rm(t,"extname"),wS(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=$s.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Iy(t)&&(t=$6(t)),Mm(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?$s.basename(this.path,this.extname):void 0}set stem(t){Mm(t,"stem"),Rm(t,"stem"),this.path=$s.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const s=this.message(t,n,r);throw s.fatal=!0,s}info(t,n,r){const s=this.message(t,n,r);return s.fatal=void 0,s}message(t,n,r){const s=new er(t,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Rm(e,t){if(e&&e.includes($s.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+$s.sep+"`")}function Mm(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function wS(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function D6(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const F6=function(e){const r=this.constructor.prototype,s=r[e],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},z6={}.hasOwnProperty;class Cw extends F6{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=C6()}copy(){const t=new Cw;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Im(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Om("data",this.frozen),this.namespace[t]=n,this):z6.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Om("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const s=n.call(t,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Ud(t),r=this.parser||this.Parser;return Lm("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Lm("process",this.parser||this.Parser),$m("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,o){const l=Ud(t),c=r.parse(l);r.run(c,l,function(p,f,d){if(p||!f||!d)return u(p);const h=f,y=r.stringify(h,d);W6(y)?d.value=y:d.result=y,u(p,d)});function u(p,f){p||!f?o(p):i?i(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),Lm("processSync",this.parser||this.Parser),$m("processSync",this.compiler||this.Compiler),this.process(t,s),vS("processSync","process",n),r;function s(i,o){n=!0,fS(i),r=o}}run(t,n,r){bS(t),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(o,l){const c=Ud(n);s.run(t,c,u);function u(p,f,d){const h=f||t;p?l(p):o?o(h):r(void 0,h,d)}}}runSync(t,n){let r=!1,s;return this.run(t,n,i),vS("runSync","run",r),s;function i(o,l){fS(o),s=l,r=!0}}stringify(t,n){this.freeze();const r=Ud(n),s=this.compiler||this.Compiler;return $m("stringify",s),bS(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(Om("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 i(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[p,...f]=u;c(p,f)}else o(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function o(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(u.plugins),u.settings&&(s.settings=Im(!0,s.settings,u.settings))}function l(u){let p=-1;if(u!=null)if(Array.isArray(u))for(;++p<u.length;){const f=u[p];i(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,p){let f=-1,d=-1;for(;++f<r.length;)if(r[f][0]===u){d=f;break}if(d===-1)r.push([u,...p]);else if(p.length>0){let[h,...y]=p;const w=r[d][1];Ay(w)&&Ay(h)&&(h=Im(!0,w,h)),r[d]=[u,h,...y]}}}}const H6=new Cw().freeze();function Lm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function $m(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Om(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 bS(e){if(!Ay(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function vS(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Ud(e){return B6(e)?e:new sP(e)}function B6(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function W6(e){return typeof e=="string"||V6(e)}function V6(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const K6="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",kS=[],SS={allowDangerousHtml:!0},U6=/^(https?|ircs?|mailto|xmpp)$/i,q6=[{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 iP(e){const t=Y6(e),n=G6(e);return X6(t.runSync(t.parse(n),n),e)}function Y6(e){const t=e.rehypePlugins||kS,n=e.remarkPlugins||kS,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...SS}:SS;return H6().use(PB).use(n).use(N6,r).use(t)}function G6(e){const t=e.children||"",n=new sP;return typeof t=="string"&&(n.value=t),n}function X6(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||J6;for(const p of q6)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+K6+p.id,void 0);return nP(e,u),l5(e,{Fragment:a.Fragment,components:s,ignoreInvalidStyle:!0,jsx:a.jsx,jsxs:a.jsxs,passKeys:!0,passNode:!0});function u(p,f,d){if(p.type==="raw"&&d&&typeof f=="number")return o?d.children.splice(f,1):d.children[f]={type:"text",value:p.value},f;if(p.type==="element"){let h;for(h in _m)if(Object.hasOwn(_m,h)&&Object.hasOwn(p.properties,h)){const y=p.properties[h],w=_m[h];(w===null||w.includes(p.tagName))&&(p.properties[h]=c(String(y||""),h,p))}}if(p.type==="element"){let h=n?!n.includes(p.tagName):i?i.includes(p.tagName):!1;if(!h&&r&&typeof f=="number"&&(h=!r(p,f,d)),h&&d&&typeof f=="number")return l&&p.children?d.children.splice(f,1,...p.children):d.children.splice(f,1),f}}}function J6(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||r!==-1&&t>r||U6.test(e.slice(0,t))?e:""}const Q6=new Set(["echarts"]),Z6=new Set(["line","bar","pie","scatter","radar","heatmap","tree","treemap","sunburst","sankey","graph","gauge","funnel"]),e8=new Set(["onclick","ondblclick","onmousedown","onmouseup","onmouseover","onmouseout","onmousemove","onmouseenter","onmouseleave","oncontextmenu","onkeydown","onkeyup","onkeypress","onload","onerror"]),t8=["#7c9cff","#a8e66f","#ffcf5c","#68d8d6","#ff8fb3","#b79cff","#f59e73","#8bd17c"];function to(e){return e&&typeof e=="object"&&!Array.isArray(e)}function Yo(e,t){if(!to(e))return{...t};const n={...e};for(const[r,s]of Object.entries(t))n[r]==null?n[r]=s:to(n[r])&&to(s)&&(n[r]=Yo(n[r],s));return n}function ph(e,t){return e==null?e:Array.isArray(e)?e.map(n=>to(n)?Yo(n,t):n):to(e)?Yo(e,t):e}function n8(e){let t=String(e||"").trim();if(!t)return"";const n=t.match(/```(?:json|chart|echarts)?\s*\n?([\s\S]*?)```/i);if(n!=null&&n[1])t=n[1].trim();else{const r=t.indexOf("{"),s=t.lastIndexOf("}");r>=0&&s>r&&(t=t.slice(r,s+1).trim())}return t.replace(/^json\s*\n/i,"").trim()}function Ty(e,t="$"){if(e!=null){if(typeof e=="string"){if(/<\s*(script|iframe|object|embed|link|meta)\b/i.test(e))throw new Error(`${t} contains unsafe HTML`);if(/\bjavascript\s*:/i.test(e)||/\bdata\s*:\s*text\/html/i.test(e))throw new Error(`${t} contains unsafe URL text`);return}if(Array.isArray(e)){e.forEach((n,r)=>Ty(n,`${t}[${r}]`));return}if(typeof e=="object")for(const[n,r]of Object.entries(e)){if(/^on[A-Z]/.test(n)||e8.has(n.toLowerCase()))throw new Error(`${t}.${n} is not allowed`);Ty(r,`${t}.${n}`)}}}function r8(e){const t=Array.isArray(e)?e:[e].filter(Boolean);if(!t.length)throw new Error("option.series is required");for(const n of t){const r=String((n==null?void 0:n.type)||"").trim();if(!Z6.has(r))throw new Error(`series.type "${r||"(empty)"}" is not allowed`)}return t}function s8(e){const t={trigger:"item",renderMode:"richText",backgroundColor:"rgba(20, 22, 28, 0.96)",borderColor:"rgba(124, 156, 255, 0.28)",textStyle:{color:"rgba(255, 255, 255, 0.92)"}};return!e||typeof e!="object"||Array.isArray(e)?t:Yo(e,t)}function i8(e,t){const n={left:"center",top:12,textStyle:{color:"rgba(255, 255, 255, 0.9)",fontSize:15,fontWeight:700},subtextStyle:{color:"rgba(255, 255, 255, 0.52)"}};return Array.isArray(e)?e.map((r,s)=>{if(!to(r))return r;const i=s===0&&t&&r.text==null?{...r,text:t}:r;return Yo(i,n)}):to(e)?Yo(t&&e.text==null?{...e,text:t}:e,n):t?{...n,text:t}:e}function o8(e,t){const n={top:t?42:14,textStyle:{color:"rgba(255, 255, 255, 0.72)"},itemGap:14};return e==null?e:ph(e,n)}function NS(e,t="rgba(255, 255, 255, 0.62)"){return ph(e,{nameTextStyle:{color:t},axisLabel:{color:"rgba(255, 255, 255, 0.58)"},axisLine:{lineStyle:{color:"rgba(255, 255, 255, 0.22)"}},axisTick:{lineStyle:{color:"rgba(255, 255, 255, 0.18)"}},splitLine:{lineStyle:{color:"rgba(255, 255, 255, 0.12)"}}})}function a8(e,t){const n={left:52,right:42,top:t?78:42,bottom:42,containLabel:!0};return e==null?n:ph(e,n)}function l8(e){const t={axisName:{color:"rgba(255, 255, 255, 0.68)"},splitLine:{lineStyle:{color:"rgba(255, 255, 255, 0.12)"}},splitArea:{areaStyle:{color:["rgba(255, 255, 255, 0.025)","rgba(255, 255, 255, 0.045)"]}},axisLine:{lineStyle:{color:"rgba(255, 255, 255, 0.16)"}}};return e==null?e:ph(e,t)}function c8(e,t,n){const r=i8(e.title,n),s=!!(Array.isArray(r)?r:[r]).filter(Boolean).some(o=>to(o)&&o.text),i=e.legend!=null&&e.legend!==!1;return{...e,backgroundColor:e.backgroundColor??"transparent",color:e.color??t8,textStyle:Yo(e.textStyle,{color:"rgba(255, 255, 255, 0.78)"}),title:r,tooltip:s8(e.tooltip),legend:o8(e.legend,s),grid:e.xAxis!=null||e.yAxis!=null?a8(e.grid,s||i):e.grid,xAxis:NS(e.xAxis),yAxis:NS(e.yAxis),radar:l8(e.radar),series:t}}function u8(e){const t=n8(e);if(!t)return{ok:!1,error:"No chart content"};try{const n=JSON.parse(t);if(!n||typeof n!="object"||Array.isArray(n))throw new Error("ChartSpec must be a JSON object");if(n.type!=="chart")throw new Error('type must be "chart"');if(n.version!=="1.0")throw new Error('version must be "1.0"');if(!Q6.has(n.renderer))throw new Error('renderer must be "echarts"');if(!n.option||typeof n.option!="object"||Array.isArray(n.option))throw new Error("option must be an ECharts option object");Ty(n);const r=r8(n.option.series),s=n.title==null?"":String(n.title),i=c8(n.option,r,s);return{ok:!0,spec:{...n,title:s,option:i}}}catch(n){return{ok:!1,error:String((n==null?void 0:n.message)||n)}}}function pi(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 oP(e){const t=pi(e);return t.length>1&&t.every(n=>/^:?-{3,}:?$/.test(n))}function aP(e){return pi(e).map(t=>t.startsWith(":")&&t.endsWith(":")?"center":t.endsWith(":")?"right":"left")}function d8(e){return/^\s*(sequenceDiagram|flowchart\s+(?:TD|TB|BT|LR|RL)|graph\s+(?:TD|TB|BT|LR|RL))\b/i.test(String(e||""))}function f8(e){const t=String(e||"").split(/\r?\n/).map(l=>l.replace(/%%.*$/,"").trim()).filter(Boolean),n=new Map,r=[];let s="TD";const i=(l,c="")=>{const u=String(l||"").replace(/[^A-Za-z0-9_]/g,"_")||`N${n.size+1}`;return n.has(u)?c&&(n.get(u).label=c):n.set(u,{id:u,label:c||u}),u},o=l=>{const c=String(l||"").trim().replace(/[;,]+$/,""),u=c.match(/^([A-Za-z][A-Za-z0-9_]*)(?:\[(.+?)\]|\((.+?)\)|\{(.+?)\})?$/);return u?i(u[1],u[2]||u[3]||u[4]||u[1]):i(c.replace(/[^A-Za-z0-9_]/g,"_"),c)};for(const l of t){const c=l.match(/^(graph|flowchart)\s+(TD|TB|BT|LR|RL)\b/i);if(c){s=c[2].toUpperCase();continue}const u=l.match(/^(.+?)\s*-{1,2}>+\s*(.+)$/);if(u){r.push({from:o(u[1]),to:o(u[2])});continue}o(l)}return{nodes:Array.from(n.values()),edges:r,direction:s}}function p8({code:e}){const t=m.useMemo(()=>f8(e),[e]),n=t.direction==="LR"||t.direction==="RL",r=150,s=46,i=n?102:38,o=n?34:72,l=new Map;t.nodes.forEach((p,f)=>{l.set(p.id,{x:28+(n?f*(r+i):f%3*(r+i)),y:28+(n?f%3*(s+o):f*(s+o))})});const c=Math.max(520,...Array.from(l.values()).map(p=>p.x+r+28)),u=Math.max(220,...Array.from(l.values()).map(p=>p.y+s+28));return a.jsxs("svg",{viewBox:`0 0 ${c} ${u}`,role:"img","aria-label":"Mermaid flowchart preview",children:[a.jsx("defs",{children:a.jsx("marker",{id:"af-md-mermaid-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:a.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z"})})}),t.edges.map((p,f)=>{const d=l.get(p.from),h=l.get(p.to);if(!d||!h)return null;const y=n?`M ${d.x+r} ${d.y+s/2} C ${(d.x+h.x+r)/2} ${d.y+s/2}, ${(d.x+h.x+r)/2} ${h.y+s/2}, ${h.x} ${h.y+s/2}`:`M ${d.x+r/2} ${d.y+s} C ${d.x+r/2} ${d.y+s+28}, ${h.x+r/2} ${h.y-28}, ${h.x+r/2} ${h.y}`;return a.jsx("path",{className:"af-md-mermaid-edge",d:y,markerEnd:"url(#af-md-mermaid-arrow)"},`${p.from}-${p.to}-${f}`)}),t.nodes.map(p=>{const f=l.get(p.id);return a.jsxs("g",{children:[a.jsx("rect",{className:"af-md-mermaid-box",x:f.x,y:f.y,width:r,height:s,rx:"8"}),a.jsx("text",{className:"af-md-mermaid-text",x:f.x+r/2,y:f.y+s/2+5,textAnchor:"middle",children:p.label.slice(0,24)})]},p.id)})]})}function h8(e){const t=String(e||"").split(/\r?\n/).map(i=>i.replace(/%%.*$/,"").trim()).filter(Boolean),n=new Map,r=[],s=(i,o="")=>{const l=String(i||"").trim();l&&(n.has(l)||n.set(l,o||l))};for(const i of t){if(/^sequenceDiagram\b/i.test(i))continue;const o=i.match(/^(participant|actor)\s+([A-Za-z0-9_]+)(?:\s+as\s+(.+))?$/i);if(o){s(o[2],o[3]||o[2]);continue}const l=i.match(/^([A-Za-z0-9_]+)\s*[-=]+>>\+?\s*([A-Za-z0-9_]+)\s*:\s*(.+)$/);if(l){s(l[1]),s(l[2]),r.push({type:"message",from:l[1],to:l[2],text:l[3]});continue}const c=i.match(/^note\s+(?:over|right of|left of)\s+([^:]+):\s*(.+)$/i);r.push({type:"note",text:c?c[2]:i})}return{participants:Array.from(n,([i,o])=>({id:i,label:o})),rows:r}}function m8({code:e}){const t=m.useMemo(()=>h8(e),[e]),n=t.participants.length?t.participants:[{id:"A",label:"A"},{id:"B",label:"B"}],r=190,s=48,i=26,o=44,l=48,c=Math.max(620,s*2+n.length*r),u=Math.max(220,i+o+Math.max(1,t.rows.length)*l+34),p=f=>{const d=Math.max(0,n.findIndex(h=>h.id===f));return s+d*r+r/2};return a.jsxs("svg",{viewBox:`0 0 ${c} ${u}`,role:"img","aria-label":"Mermaid sequence diagram preview",children:[a.jsx("defs",{children:a.jsx("marker",{id:"af-md-sequence-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:a.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z"})})}),n.map((f,d)=>{const h=s+d*r+r/2;return a.jsxs("g",{children:[a.jsx("rect",{className:"af-md-mermaid-box",x:h-68,y:i,width:"136",height:"34",rx:"8"}),a.jsx("text",{className:"af-md-mermaid-text",x:h,y:i+22,textAnchor:"middle",children:f.label.slice(0,18)}),a.jsx("line",{className:"af-md-sequence-life",x1:h,y1:i+o,x2:h,y2:u-18})]},f.id)}),t.rows.map((f,d)=>{const h=i+o+d*l+24;if(f.type!=="message")return a.jsxs("g",{children:[a.jsx("rect",{className:"af-md-sequence-note",x:s,y:h-17,width:c-s*2,height:"30",rx:"7"}),a.jsx("text",{className:"af-md-mermaid-text",x:s+12,y:h+4,children:f.text.slice(0,120)})]},`note-${d}`);const y=p(f.from),w=p(f.to),k=(y+w)/2;return a.jsxs("g",{children:[a.jsx("line",{className:"af-md-mermaid-edge",x1:y,y1:h,x2:w,y2:h,markerEnd:"url(#af-md-sequence-arrow)"}),a.jsx("text",{className:"af-md-sequence-label",x:k,y:h-8,textAnchor:"middle",children:f.text.slice(0,72)})]},`msg-${d}`)})]})}function lP({code:e}){const t=String(e||"").trim();if(!t)return null;const n=/^sequenceDiagram\b/i.test(t);return a.jsx("div",{className:"af-md-mermaid-preview",children:n?a.jsx(m8,{code:t}):a.jsx(p8,{code:t})})}function g8(e){const t=String(e||"").replace(/\r\n/g,`
80
- `).split(`
81
- `),n=[];let r=[],s=!1;const i=()=>{r.length&&(n.push({type:"markdown",text:r.join(`
82
- `)}),r=[])};for(let o=0;o<t.length;){const l=t[o]||"",c=l.match(/^\s*```\s*(mermaid|mmd)\s*$/i);if(!s&&c){i();const u=[];for(o++;o<t.length&&!/^\s*```\s*$/.test(t[o]||"");)u.push(t[o]||""),o++;o<t.length&&o++,n.push({type:"mermaid",text:u.join(`
83
- `)});continue}if(!s&&d8(l)){i();const u=[];for(;o<t.length;){const p=t[o]||"";if(u.length>0&&(!p.trim()||/^-{3,}\s*$/.test(p)||/^#{1,6}\s+/.test(p)))break;u.push(p),o++}n.push({type:"mermaid",text:u.join(`
84
- `)});continue}if(/^\s*```/.test(l)){s=!s,r.push(l),o++;continue}if(!s&&o+1<t.length&&pi(l).length>1&&oP(t[o+1])){i();const u=pi(l),p=aP(t[o+1]),f=[];for(o+=2;o<t.length&&t[o].trim()&&pi(t[o]).length>1;)f.push(pi(t[o])),o++;n.push({type:"table",headers:u,align:p,rows:f});continue}r.push(l),o++}return i(),n}function jS(e,t=""){const n=String(e||"").trim();if(!n||/^(?:https?:|data:|blob:|file:|javascript:|mailto:|tel:)/i.test(n)||n.startsWith("/")||n.startsWith("#")||!t||n.startsWith("outputs/"))return n;const r=String(t||"").split("/").filter(Boolean);r.pop();const s=[...r,...n.split("/")].filter(Boolean),i=[];for(const o of s)if(o!=="."){if(o===".."){if(i.length===0)return n;i.pop();continue}i.push(o)}return i.join("/")}function cP(e){const t=String(e||"").replace(/\r\n/g,`
85
- `).split(`
86
- `);let n=!1;return t.map(r=>{if(/^\s*```/.test(r))return n=!n,r;if(n)return r;let s="",i=0,o=!1;for(;i<r.length;){const l=r[i];if(l==="`"){o=!o,s+=l,i+=1;continue}if(!(!o&&/^https?:\/\//i.test(r.slice(i)))){s+=l,i+=1;continue}if((i>0?r[i-1]:"")==="("){s+=l,i+=1;continue}let p=i;for(;p<r.length&&!/\s|<|>/.test(r[p]);)p+=1;let f=r.slice(i,p),d="";for(;/[.,;:!?)}\]]$/.test(f);)d=f.slice(-1)+d,f=f.slice(0,-1);f?s+=`[${f}](${f})${d}`:s+=r.slice(i,p),i=p}return s}).join(`
87
- `)}function uP(e,t=!1,n=""){const r=s=>{const i=String(s||"").trim();if(!i)return"";if(/^(?:https?:|data:|blob:|file:|javascript:|mailto:|tel:)/i.test(i)||i.startsWith("#"))return i;const o=jS(i,n);return e?e(o,{kind:"link",download:!0}):o};return{...t?{p:({children:s})=>a.jsx(a.Fragment,{children:s})}:{},code:({inline:s,className:i,children:o})=>{var u;const l=((u=String(i||"").match(/language-(\w+)/i))==null?void 0:u[1])||"",c=String(o||"").replace(/\n$/,"");return!s&&/^(mermaid|mmd)$/i.test(l)?a.jsx(lP,{code:c}):s?a.jsx("code",{className:i,children:o}):a.jsx("code",{className:i,children:o})},img:({src:s,alt:i})=>a.jsx("img",{src:e?e(jS(s,n)):s||"",alt:i||"",loading:"lazy"}),a:({href:s,children:i})=>a.jsx("a",{href:r(s),target:"_blank",rel:"noopener noreferrer",children:i})}}function CS({children:e,resolveSrc:t,basePath:n=""}){return a.jsx(iP,{components:uP(t,!0,n),children:cP(e)})}function Ew({content:e,resolveSrc:t,basePath:n=""}){const r=m.useMemo(()=>g8(e),[e]),s=m.useMemo(()=>uP(t,!1,n),[n,t]);return a.jsx(a.Fragment,{children:r.map((i,o)=>i.type==="mermaid"?a.jsx(lP,{code:i.text},`mermaid-${o}`):i.type!=="table"?a.jsx(iP,{components:s,children:cP(i.text)},`md-${o}`):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:i.headers.map((l,c)=>a.jsx("th",{style:{textAlign:i.align[c]||"left"},children:a.jsx(CS,{resolveSrc:t,basePath:n,children:l})},c))})}),a.jsx("tbody",{children:i.rows.map((l,c)=>a.jsx("tr",{children:i.headers.map((u,p)=>a.jsx("td",{style:{textAlign:i.align[p]||"left"},children:a.jsx(CS,{resolveSrc:t,basePath:n,children:l[p]||""})},p))},c))})]})},`table-${o}`))})}function y8(e,t=","){const n=[];let r=[],s="",i=!1;const o=String(e||"").replace(/\r\n/g,`
88
- `);for(let l=0;l<o.length;l+=1){const c=o[l],u=o[l+1];if(i){c==='"'&&u==='"'?(s+='"',l+=1):c==='"'?i=!1:s+=c;continue}c==='"'?i=!0:c===t?(r.push(s.trim()),s=""):c===`
89
- `?(r.push(s.trim()),n.push(r),r=[],s=""):s+=c}return(s||r.length)&&(r.push(s.trim()),n.push(r)),n.filter(l=>l.some(c=>String(c||"").trim()))}function Ms(e){if(e==null)return"";if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function x8(e){if(Array.isArray(e)){if(e.every(s=>s&&typeof s=="object"&&!Array.isArray(s))){const s=Array.from(new Set(e.flatMap(i=>Object.keys(i))));return{columns:s.map(i=>({key:i,label:i,align:"left"})),rows:e.map(i=>s.map(o=>Ms(i[o])))}}if(e.every(Array.isArray)&&e.length>0){const s=e[0].map((i,o)=>Ms(i)||`Column ${o+1}`);return{columns:s.map((i,o)=>({key:String(o),label:i,align:"left"})),rows:e.slice(1).map(i=>s.map((o,l)=>Ms(i[l])))}}}if(!e||typeof e!="object")return null;const t=Array.isArray(e.columns)?e.columns:Array.isArray(e.headers)?e.headers:[],n=Array.isArray(e.rows)?e.rows:Array.isArray(e.data)?e.data:[];let r=t.map((s,i)=>s&&typeof s=="object"?{key:String(s.key||s.name||s.field||i),label:String(s.label||s.title||s.name||s.key||`Column ${i+1}`),align:["left","center","right"].includes(s.align)?s.align:"left"}:{key:String(i),label:Ms(s)||`Column ${i+1}`,align:"left"});return r.length===0&&n.every(s=>s&&typeof s=="object"&&!Array.isArray(s))&&(r=Array.from(new Set(n.flatMap(s=>Object.keys(s)))).map(s=>({key:s,label:s,align:"left"}))),r.length===0&&n.every(Array.isArray)&&n.length>0?(r=n[0].map((s,i)=>({key:String(i),label:Ms(s)||`Column ${i+1}`,align:"left"})),{columns:r,rows:n.slice(1).map(s=>r.map((i,o)=>Ms(s[o])))}):{columns:r,rows:n.map(s=>Array.isArray(s)?r.map((i,o)=>Ms(s[o])):s&&typeof s=="object"?r.map(i=>Ms(s[i.key])):r.map((i,o)=>o===0?Ms(s):""))}}function w8(e){const t=String(e||"").trim();if(!t)return{columns:[],rows:[],error:""};const n=t.match(/^```(?:json|table|csv|tsv|markdown|md)?\s*\n?([\s\S]*?)```\s*$/i),r=n?n[1].trim():t;try{const l=x8(JSON.parse(r));if(l&&l.columns.length)return{...l,error:""}}catch{}const s=r.replace(/\r\n/g,`
90
- `).split(`
91
- `).filter(l=>l.trim());if(s.length>=2&&pi(s[0]).length>1&&oP(s[1])){const l=pi(s[0]),c=aP(s[1]);return{columns:l.map((u,p)=>({key:String(p),label:u,align:c[p]||"left"})),rows:s.slice(2).map(u=>pi(u)),error:""}}const i=r.includes(" ")?" ":",",o=y8(r,i);return o.length>0&&o[0].length>1?{columns:o[0].map((c,u)=>c||`Column ${u+1}`).map((c,u)=>({key:String(u),label:c,align:"left"})),rows:o.slice(1),error:""}:{columns:[],rows:[],error:"No table data detected"}}function _w({content:e}){const t=m.useMemo(()=>w8(e),[e]);return t.error||t.columns.length===0?a.jsxs("div",{className:"af-work-display-table-empty",children:[a.jsx("strong",{children:"Table data error"}),a.jsx("span",{children:t.error||"No columns found"})]}):a.jsx("div",{className:"af-work-display-table-wrap af-work-display-table-wrap--standalone",children:a.jsxs("table",{className:"af-work-display-table",children:[a.jsx("thead",{children:a.jsx("tr",{children:t.columns.map((n,r)=>a.jsx("th",{style:{textAlign:n.align||"left"},children:n.label},`${n.key}-${r}`))})}),a.jsx("tbody",{children:t.rows.map((n,r)=>a.jsx("tr",{children:t.columns.map((s,i)=>a.jsx("td",{style:{textAlign:s.align||"left"},children:Ms(n[i])},`${s.key}-${i}`))},r))})]})})}function Pw({content:e}){const t=m.useRef(null),n=m.useMemo(()=>u8(e),[e]),[r,s]=m.useState({loading:!1,error:""});return m.useEffect(()=>{if(!n.ok){s({loading:!1,error:n.error||"Invalid chart spec"});return}let i=!1,o=null,l=null,c=null;return s({loading:!0,error:""}),d4(()=>import("./index-DgQRkS4v.js"),[]).then(u=>{i||!t.current||(o=u.init(t.current,"dark",{renderer:"canvas"}),o.setOption(n.spec.option,!0),c=()=>o==null?void 0:o.resize(),typeof ResizeObserver<"u"&&(l=new ResizeObserver(c),l.observe(t.current)),window.addEventListener("resize",c),window.requestAnimationFrame(c),i||s({loading:!1,error:""}))}).catch(u=>{i||s({loading:!1,error:String((u==null?void 0:u.message)||u)})}),()=>{var u,p;i=!0,c&&window.removeEventListener("resize",c),(u=l==null?void 0:l.disconnect)==null||u.call(l),(p=o==null?void 0:o.dispose)==null||p.call(o)}},[n]),!n.ok||r.error?a.jsxs("div",{className:"af-work-display-chart-error",children:[a.jsx("strong",{children:"Chart configuration error"}),a.jsx("span",{children:r.error||n.error})]}):a.jsxs("div",{className:"af-work-display-chart",children:[a.jsx("div",{ref:t,className:"af-work-display-chart__canvas"}),r.loading?a.jsx("div",{className:"af-work-display-chart__loading",children:"Loading chart..."}):null]})}/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */function dP(e){return typeof e>"u"||e===null}function b8(e){return typeof e=="object"&&e!==null}function v8(e){return Array.isArray(e)?e:dP(e)?[]:[e]}function k8(e,t){var n,r,s,i;if(t)for(i=Object.keys(t),n=0,r=i.length;n<r;n+=1)s=i[n],e[s]=t[s];return e}function S8(e,t){var n="",r;for(r=0;r<t;r+=1)n+=e;return n}function N8(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var j8=dP,C8=b8,E8=v8,_8=S8,P8=N8,A8=k8,Aw={isNothing:j8,isObject:C8,toArray:E8,repeat:_8,isNegativeZero:P8,extend:A8};function fP(e,t){var n="",r=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(n+=`
92
-
93
- `+e.mark.snippet),r+" "+n):r}function xu(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=fP(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}xu.prototype=Object.create(Error.prototype);xu.prototype.constructor=xu;xu.prototype.toString=function(t){return this.name+": "+fP(this,t)};var jo=xu,I8=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],T8=["scalar","sequence","mapping"];function R8(e){var t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(r){t[String(r)]=n})}),t}function M8(e,t){if(t=t||{},Object.keys(t).forEach(function(n){if(I8.indexOf(n)===-1)throw new jo('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=R8(t.styleAliases||null),T8.indexOf(this.kind)===-1)throw new jo('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var Xn=M8;function ES(e,t){var n=[];return e[t].forEach(function(r){var s=n.length;n.forEach(function(i,o){i.tag===r.tag&&i.kind===r.kind&&i.multi===r.multi&&(s=o)}),n[s]=r}),n}function L8(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},t,n;function r(s){s.multi?(e.multi[s.kind].push(s),e.multi.fallback.push(s)):e[s.kind][s.tag]=e.fallback[s.tag]=s}for(t=0,n=arguments.length;t<n;t+=1)arguments[t].forEach(r);return e}function Ry(e){return this.extend(e)}Ry.prototype.extend=function(t){var n=[],r=[];if(t instanceof Xn)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 jo("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(i){if(!(i instanceof Xn))throw new jo("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(i.loadKind&&i.loadKind!=="scalar")throw new jo("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(i.multi)throw new jo("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),r.forEach(function(i){if(!(i instanceof Xn))throw new jo("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var s=Object.create(Ry.prototype);return s.implicit=(this.implicit||[]).concat(n),s.explicit=(this.explicit||[]).concat(r),s.compiledImplicit=ES(s,"implicit"),s.compiledExplicit=ES(s,"explicit"),s.compiledTypeMap=L8(s.compiledImplicit,s.compiledExplicit),s};var $8=Ry,O8=new Xn("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),D8=new Xn("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),F8=new Xn("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),z8=new $8({explicit:[O8,D8,F8]});function H8(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function B8(){return null}function W8(e){return e===null}var V8=new Xn("tag:yaml.org,2002:null",{kind:"scalar",resolve:H8,construct:B8,predicate:W8,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function K8(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 U8(e){return e==="true"||e==="True"||e==="TRUE"}function q8(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var Y8=new Xn("tag:yaml.org,2002:bool",{kind:"scalar",resolve:K8,construct:U8,predicate:q8,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 G8(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function X8(e){return 48<=e&&e<=55}function J8(e){return 48<=e&&e<=57}function Q8(e){if(e===null)return!1;var t=e.length,n=0,r=!1,s;if(!t)return!1;if(s=e[n],(s==="-"||s==="+")&&(s=e[++n]),s==="0"){if(n+1===t)return!0;if(s=e[++n],s==="b"){for(n++;n<t;n++)if(s=e[n],s!=="_"){if(s!=="0"&&s!=="1")return!1;r=!0}return r&&s!=="_"}if(s==="x"){for(n++;n<t;n++)if(s=e[n],s!=="_"){if(!G8(e.charCodeAt(n)))return!1;r=!0}return r&&s!=="_"}if(s==="o"){for(n++;n<t;n++)if(s=e[n],s!=="_"){if(!X8(e.charCodeAt(n)))return!1;r=!0}return r&&s!=="_"}}if(s==="_")return!1;for(;n<t;n++)if(s=e[n],s!=="_"){if(!J8(e.charCodeAt(n)))return!1;r=!0}return!(!r||s==="_")}function Z8(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 eW(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!Aw.isNegativeZero(e)}var tW=new Xn("tag:yaml.org,2002:int",{kind:"scalar",resolve:Q8,construct:Z8,predicate:eW,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"]}}),nW=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function rW(e){return!(e===null||!nW.test(e)||e[e.length-1]==="_")}function sW(e){var t,n;return t=e.replace(/_/g,"").toLowerCase(),n=t[0]==="-"?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),t===".inf"?n===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:t===".nan"?NaN:n*parseFloat(t,10)}var iW=/^[-+]?[0-9]+e/;function oW(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(Aw.isNegativeZero(e))return"-0.0";return n=e.toString(10),iW.test(n)?n.replace("e",".e"):n}function aW(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||Aw.isNegativeZero(e))}var lW=new Xn("tag:yaml.org,2002:float",{kind:"scalar",resolve:rW,construct:sW,predicate:aW,represent:oW,defaultStyle:"lowercase"}),cW=z8.extend({implicit:[V8,Y8,tW,lW]}),uW=cW,pP=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),hP=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 dW(e){return e===null?!1:pP.exec(e)!==null||hP.exec(e)!==null}function fW(e){var t,n,r,s,i,o,l,c=0,u=null,p,f,d;if(t=pP.exec(e),t===null&&(t=hP.exec(e)),t===null)throw new Error("Date resolve error");if(n=+t[1],r=+t[2]-1,s=+t[3],!t[4])return new Date(Date.UTC(n,r,s));if(i=+t[4],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]&&(p=+t[10],f=+(t[11]||0),u=(p*60+f)*6e4,t[9]==="-"&&(u=-u)),d=new Date(Date.UTC(n,r,s,i,o,l,c)),u&&d.setTime(d.getTime()-u),d}function pW(e){return e.toISOString()}var hW=new Xn("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:dW,construct:fW,instanceOf:Date,represent:pW});function mW(e){return e==="<<"||e===null}var gW=new Xn("tag:yaml.org,2002:merge",{kind:"scalar",resolve:mW}),Iw=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
94
- \r`;function yW(e){if(e===null)return!1;var t,n,r=0,s=e.length,i=Iw;for(n=0;n<s;n++)if(t=i.indexOf(e.charAt(n)),!(t>64)){if(t<0)return!1;r+=6}return r%8===0}function xW(e){var t,n,r=e.replace(/[\r\n=]/g,""),s=r.length,i=Iw,o=0,l=[];for(t=0;t<s;t++)t%4===0&&t&&(l.push(o>>16&255),l.push(o>>8&255),l.push(o&255)),o=o<<6|i.indexOf(r.charAt(t));return n=s%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 wW(e){var t="",n=0,r,s,i=e.length,o=Iw;for(r=0;r<i;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 s=i%3,s===0?(t+=o[n>>18&63],t+=o[n>>12&63],t+=o[n>>6&63],t+=o[n&63]):s===2?(t+=o[n>>10&63],t+=o[n>>4&63],t+=o[n<<2&63],t+=o[64]):s===1&&(t+=o[n>>2&63],t+=o[n<<4&63],t+=o[64],t+=o[64]),t}function bW(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var vW=new Xn("tag:yaml.org,2002:binary",{kind:"scalar",resolve:yW,construct:xW,predicate:bW,represent:wW}),kW=Object.prototype.hasOwnProperty,SW=Object.prototype.toString;function NW(e){if(e===null)return!0;var t=[],n,r,s,i,o,l=e;for(n=0,r=l.length;n<r;n+=1){if(s=l[n],o=!1,SW.call(s)!=="[object Object]")return!1;for(i in s)if(kW.call(s,i))if(!o)o=!0;else return!1;if(!o)return!1;if(t.indexOf(i)===-1)t.push(i);else return!1}return!0}function jW(e){return e!==null?e:[]}var CW=new Xn("tag:yaml.org,2002:omap",{kind:"sequence",resolve:NW,construct:jW}),EW=Object.prototype.toString;function _W(e){if(e===null)return!0;var t,n,r,s,i,o=e;for(i=new Array(o.length),t=0,n=o.length;t<n;t+=1){if(r=o[t],EW.call(r)!=="[object Object]"||(s=Object.keys(r),s.length!==1))return!1;i[t]=[s[0],r[s[0]]]}return!0}function PW(e){if(e===null)return[];var t,n,r,s,i,o=e;for(i=new Array(o.length),t=0,n=o.length;t<n;t+=1)r=o[t],s=Object.keys(r),i[t]=[s[0],r[s[0]]];return i}var AW=new Xn("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:_W,construct:PW}),IW=Object.prototype.hasOwnProperty;function TW(e){if(e===null)return!0;var t,n=e;for(t in n)if(IW.call(n,t)&&n[t]!==null)return!1;return!0}function RW(e){return e!==null?e:{}}var MW=new Xn("tag:yaml.org,2002:set",{kind:"mapping",resolve:TW,construct:RW});uW.extend({implicit:[hW,gW],explicit:[vW,CW,AW,MW]});function _S(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
95
- `:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"…":e===95?" ":e===76?"\u2028":e===80?"\u2029":""}var LW=new Array(256),$W=new Array(256);for(var Sa=0;Sa<256;Sa++)LW[Sa]=_S(Sa)?1:0,$W[Sa]=_S(Sa);const wu=["requirement","planning","code","test","normal"],PS={普通:"normal",技术规划:"planning",代码执行:"code",测试回归:"test",需求拆解:"requirement"};function Tw(e,t){var s,i,o,l,c,u,p,f,d,h,y,w,k,g;const n=b=>{const x={type:(b==null?void 0:b.type)??"node",name:(b==null?void 0:b.name)??"",value:(b==null?void 0:b.value)??(b==null?void 0:b.default)??""};return(b==null?void 0:b.required)===!0&&(x.required=!0),(b==null?void 0:b.description)!=null&&String(b.description).trim()&&(x.description=String(b.description)),(b==null?void 0:b.showOnNode)!=null&&(x.showOnNode=!!b.showOnNode),x},r={};for(const b of e){if((s=b==null?void 0:b.data)!=null&&s.isWorkspaceGroup)continue;const x=t[b.id]&&typeof t[b.id]=="object"?{...t[b.id]}:{},S=((i=b.data)==null?void 0:i.definitionId)||b.id,C=((o=b.data)==null?void 0:o.inputs)??[],j=((l=b.data)==null?void 0:l.outputs)??[],E=((c=b.data)==null?void 0:c.role)!=null?String(b.data.role).trim():"",A=x.role!=null?String(x.role).trim():"",D=PS[E]||E,W=PS[A]||A,F=wu.includes(D)?D:wu.includes(W)?W:"normal",R=Array.isArray(C)?C.map(n):Array.isArray(x.input)?x.input.map(ue=>n(ue)):[],$=Array.isArray(j)?j.map(n):Array.isArray(x.output)?x.output.map(ue=>n(ue)):[],P=((u=b.data)==null?void 0:u.label)!=null?String(b.data.label):x.label!=null?String(x.label):b.id,L=(p=b.data)==null?void 0:p.body,T=L!=null?String(L):x.body!=null?String(x.body):"";let O=((f=b.data)==null?void 0:f.model)!=null&&String(b.data.model).trim()!==""?String(b.data.model).trim():x.model!=null&&String(x.model).trim()!==""?String(x.model).trim():void 0;(O===""||O==="default")&&(O=void 0);const I={...x,definitionId:S,label:P,role:F,model:O,input:R,output:$},H=((d=b.data)==null?void 0:d.marketplaceRef)||x.marketplaceRef;H?I.marketplaceRef=String(H):delete I.marketplaceRef;const _=((h=b.data)==null?void 0:h.marketplacePackageId)||x.marketplacePackageId;_?I.marketplacePackageId=String(_):delete I.marketplacePackageId;const Y=((y=b.data)==null?void 0:y.marketplaceVersion)||x.marketplaceVersion;Y?I.marketplaceVersion=String(Y):delete I.marketplaceVersion,S.startsWith("provide_")||T.trim()===""?delete I.body:I.body=T;const U=Array.isArray((w=b.data)==null?void 0:w.images)?b.data.images:Array.isArray(x.images)?x.images:[];U.length>0?I.images=U:delete I.images;const V=(k=b.data)==null?void 0:k.script,Z=V!=null?String(V):x.script!=null?String(x.script):"";Z.trim()===""?delete I.script:I.script=Z;for(const ue of["scriptRef","implementationRef","implementationMode"]){const le=(g=b.data)==null?void 0:g[ue],we=le!=null?String(le):x[ue]!=null?String(x[ue]):"";we.trim()===""?delete I[ue]:I[ue]=we.trim()}delete I.temperature,delete I.maxTokens,delete I.description,r[b.id]=I}return r}function zc(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function OW(e,t){const n=String(e||"node").replace(/_copy(?:_\d+)?$/i,"");let r=`${n}_copy`,s=2;for(;t.has(r);)r=`${n}_copy_${s}`,s+=1;return t.add(r),r}function DW(e,t,n){const r=(e||[]).filter(o=>o==null?void 0:o.selected);if(r.length===0)return null;const s=new Set(r.map(o=>o.id)),i=(t||[]).filter(o=>s.has(o.source)&&s.has(o.target));return{version:1,nodes:r.map(o=>zc(o)),edges:i.map(o=>zc(o)),instances:Tw(r,n||{})}}function FW(e,t,n,r,s={}){var f;if(!e||!Array.isArray(e.nodes)||e.nodes.length===0)return null;const i=s.offset||{x:48,y:48},o=new Set((t||[]).map(d=>d.id)),l=new Map;for(const d of e.nodes)l.set(d.id,OW(d.id,o));const c=e.nodes.map(d=>{var y,w;const h=l.get(d.id);return{...zc(d),id:h,selected:!0,dragging:!1,position:{x:Number(((y=d.position)==null?void 0:y.x)||0)+i.x,y:Number(((w=d.position)==null?void 0:w.y)||0)+i.y}}}),u=(e.edges||[]).filter(d=>l.has(d.source)&&l.has(d.target)).map((d,h)=>{const y=l.get(d.source),w=l.get(d.target);return{...zc(d),id:`e-${y}-${w}-${Date.now()}-${h}`,source:y,target:w,selected:!1}}),p={...r||{}};for(const[d,h]of l.entries()){const y=(f=e.instances)==null?void 0:f[d];y&&(p[h]={...zc(y),label:y.label!=null?String(y.label):h})}return{nodes:[...(t||[]).map(d=>({...d,selected:!1})),...c],edges:[...(n||[]).map(d=>({...d,selected:!1})),...u],instances:p,pastedNodeIds:c.map(d=>d.id)}}function Tn(e){switch(gp(e)){case"text":return"#2196f3";case"file":return"#4caf50";case"node":return"#ff9800";case"bool":return"#9c27b0";default:return"#9e9e9e"}}function gp(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 zW(e,t){const n=gp(e),r=gp(t);return!n||!r?!1:n==="any"||r==="any"?!0:n===r}const HW=new Set(["workspaceContext","skillsContext","mcpContext"]);function My(e){const t=gp(e==null?void 0:e.type),n=String((e==null?void 0:e.name)||(e==null?void 0:e.id)||"").trim();return t==="text"&&HW.has(n)?`${t}+${n}`:t}function BW(e){return My(e)}function bu(e,t){if(!e||!t||!zW(e.type,t.type))return!1;const n=My(e),r=My(t),s=n.includes("+"),i=r.includes("+");return s||i?n===r:!0}function WW(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 Ly(e,t,n){var l;const r=n==="source"?"outputs":"inputs",i=WW(t,n==="source"?"output":"input");return i<0?null:(Array.isArray((l=e==null?void 0:e.data)==null?void 0:l[r])?e.data[r]:[])[i]||null}const yp=/\[image\s+(\d+)\]/gi;function ji(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 VW(e){return`image ${ji(e).length+1}`}function KW(e,t){const n=String(e||""),r=`[${t}]`;return n.trim()?`${n.replace(/[ \t]+$/u,"")} ${r}`:r}function UW(e,t){const n=ji(e),r=String(t||""),s=new Set;yp.lastIndex=0;let i;for(;i=yp.exec(r);)s.add(`image ${i[1]}`.toLowerCase());return s.size===0?[]:n.filter(o=>s.has(String(o.label||"").toLowerCase()))}function qW(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 mP(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 Hc(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 gP({files:e,body:t,images:n}){const r=Array.from(e||[]);if(r.length===0)return null;let s=String(t||"");const i=ji(n);for(const o of r){const l=await qW(o),c=VW(i);i.push({id:`${Date.now().toString(36)}-${i.length+1}`,label:c,...l}),s=KW(s,c)}return{body:s,images:i}}function ii(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function YW(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 GW(e){return["true","1","yes","on"].includes(String((e==null?void 0:e.value)??(e==null?void 0:e.default)??"").trim().toLowerCase())}function Pt(e){e.stopPropagation()}function XW(e){return String(e||"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function JW(e,t){const n=`\\[${XW(t)}\\]`;return String(e||"").replace(new RegExp(`[ \\t]*${n}`,"gi"),"").replace(/[ \t]+\n/g,`
96
- `).replace(/\n{3,}/g,`
97
-
98
- `).trimEnd()}function Dm(e){return String(e||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function QW(e){const t=String(e||"");let n="",r=0;yp.lastIndex=0;let s;for(;s=yp.exec(t);)n+=Dm(t.slice(r,s.index)),n+=`<span class="af-flow-node__image-token">${Dm(s[0])}</span>`,r=s.index+s[0].length;return n+=Dm(t.slice(r)),n||" "}function ZW(e,t){const n=window.getComputedStyle(e),r=Number.parseFloat(n.lineHeight)||18,s=Number.parseFloat(n.paddingTop)||0,i=Number.parseFloat(n.paddingBottom)||0,o=Number.parseFloat(n.borderTopWidth)||0,l=Number.parseFloat(n.borderBottomWidth)||0,c=String(t||"").split(/\r\n|\r|\n/).length,u=Math.min(Math.max(c,2),8);return Math.ceil(u*r+s+i+o+l)}function e9({data:e,selected:t,id:n,deleteNode:r,onProvideExpand:s,onProvideValueChange:i,onNodeBodyChange:o,onNodeImagesChange:l,modelLists:c,onModelChange:u}){var ee,be;const{t:p}=dr(),f=(e==null?void 0:e.inputs)??[],d=(e==null?void 0:e.outputs)??[],h=((e==null?void 0:e.schemaType)??"agent").toLowerCase(),y=YW(e),w=(e==null?void 0:e.isRunMode)??!1,k=!!(e!=null&&e.readOnly),g=(e==null?void 0:e.isExecuting)??!1,b=(e==null?void 0:e.isDim)??!1,x=(e==null?void 0:e.nodeStatus)??null,S=(e==null?void 0:e.nodeElapsed)??null,C=(e==null?void 0:e.definitionId)||"",j=C.startsWith("provide_"),E=C==="provide_bool",A=C==="provide_str",D=C==="provide_file",W=C==="provide_password",F=C==="agent_subAgent",R=C==="control_agent_toBool",$=(F||R)&&!w,P=E?GW(d[0]):!1,L=j?String(((ee=d[0])==null?void 0:ee.value)??((be=d[0])==null?void 0:be.default)??(e==null?void 0:e.body)??""):"",T=String((e==null?void 0:e.body)||""),O=(e==null?void 0:e.displayLabel)||(e==null?void 0:e.label)||p("flow:node.fallbackLabel"),I=!j&&!$&&(e!=null&&e.showBodyPreview)?String((e==null?void 0:e.body)||"").trim():"",H=ji(e==null?void 0:e.images),_=E||A||D||W||$||!!I,Y=m.useRef(!1),U=m.useRef(!1),V=m.useRef(null),Z=m.useRef(null),ue=m.useRef(null),le=m.useRef(null),we=m.useRef(null),[re,ye]=m.useState(L),[te,ie]=m.useState(!1),[ce,pe]=m.useState(T),[De,He]=m.useState(!1),[Ie,et]=m.useState({visible:!1,top:0,height:100}),[ut,Ae]=m.useState(!1),Qe=m.useCallback(()=>{const Q=Z.current;if(!Q)return;const oe=Math.max(1,Q.scrollHeight),Pe=Math.max(1,Q.clientHeight),Be=oe>Pe+1,jt=Be?Math.max(12,Pe/oe*100):100,jn=Math.max(0,100-jt),nr=Be?Math.min(jn,Q.scrollTop/Math.max(1,oe-Pe)*jn):0;et({visible:Be,top:nr,height:jt})},[]);m.useEffect(()=>{Y.current||ye(L)},[n,L]),m.useEffect(()=>{U.current||pe(T)},[n,T]),m.useEffect(()=>{const Q=Z.current;if(!Q)return;if($){Q.style.minHeight="",Q.style.height="",ue.current&&(ue.current.style.minHeight="",ue.current.style.height="");return}const oe=ZW(Q,ce);Q.style.minHeight=`${oe}px`,Q.style.height="",ue.current&&(ue.current.style.minHeight=`${oe}px`,ue.current.style.height="")},[ce,$]),m.useEffect(()=>{if(!$)return;const Q=window.requestAnimationFrame(Qe),oe=Z.current;if(!oe||typeof ResizeObserver>"u")return()=>window.cancelAnimationFrame(Q);const Pe=new ResizeObserver(Qe);return Pe.observe(oe),()=>{window.cancelAnimationFrame(Q),Pe.disconnect()}},[ce,$,Qe]),m.useEffect(()=>{const Q=V.current,oe=e==null?void 0:e.onNodeContentResize;if(!$||!Q||!oe||typeof ResizeObserver>"u")return;let Pe=0;const Be=()=>{window.cancelAnimationFrame(Pe),Pe=window.requestAnimationFrame(()=>oe(n))},jt=new ResizeObserver(Be);return jt.observe(Q),Be(),()=>{window.cancelAnimationFrame(Pe),jt.disconnect()}},[e==null?void 0:e.onNodeContentResize,$,n]),m.useEffect(()=>{if(!ut)return;const Q=window.setTimeout(()=>{const oe=we.current;if(!oe)return;oe.focus();const Pe=oe.value.length;oe.setSelectionRange(Pe,Pe)},0);return()=>window.clearTimeout(Q)},[ut]);const qt=Array.isArray(c==null?void 0:c.cursor)?c.cursor:[],Te=Array.isArray(c==null?void 0:c.opencode)?c.opencode:[],Ht=Array.isArray(c==null?void 0:c.claudeCode)?c.claudeCode:[],st=((e==null?void 0:e.model)??"").trim(),dn=h==="agent"&&!C.startsWith("tool_nodejs"),ne=new Set(qt.map(ii)),me=new Set(Te.map(ii)),Oe=new Set(Ht.map(ii)),Fe=st?st.startsWith("cursor:")||st.startsWith("opencode:")||st.startsWith("claude-code:")?st:Oe.has(st)?`claude-code:${st}`:me.has(st)?`opencode:${st}`:ne.has(st)?`cursor:${st}`:st:"",Ve=st&&!Fe.startsWith("cursor:")&&!Fe.startsWith("opencode:")&&!Fe.startsWith("claude-code:")&&!ne.has(st)&&!me.has(st)&&!Oe.has(st),Et=st.startsWith("cursor:")?st.slice(7):st.startsWith("opencode:")?st.slice(9):st.startsWith("claude-code:")?st.slice(12):st,Lt=Q=>{if(k)return;const oe=Q.target.value;u&&u(n,oe)},tt=Q=>{Q.stopPropagation(),!k&&r&&r(n)},fn=Q=>{Q.stopPropagation(),s&&s()},kt=Q=>{Q.stopPropagation(),!k&&(i==null||i(n,Q.target.value==="true"?"true":"false"))},Nt=Q=>{if(Q.stopPropagation(),k)return;const oe=Q.target.value;ye(oe),Y.current||i==null||i(n,oe)},tn=Q=>{Q.stopPropagation(),Y.current=!0},nn=Q=>{if(Q.stopPropagation(),k)return;Y.current=!1;const oe=Q.currentTarget.value;ye(oe),i==null||i(n,oe)},tr=()=>{k||i==null||i(n,re)},Fn=Q=>{if(Q.stopPropagation(),k)return;if(typeof(e==null?void 0:e.onOpenProvideFilePicker)=="function"){e.onOpenProvideFilePicker(n,re);return}const oe=window.prompt("文件路径",re);oe!=null&&(ye(oe),i==null||i(n,oe))},Vn=Q=>{Q.stopPropagation(),ie(oe=>!oe)},gn=Q=>{if(pe(Q),o==null||o(n,Q),l){const oe=UW(H,Q);(oe.length!==H.length||oe.some((Pe,Be)=>{var jt;return Pe.id!==((jt=H[Be])==null?void 0:jt.id)}))&&l(n,oe)}},Yt=Q=>{if(Q.stopPropagation(),k)return;const oe=Q.target.value;U.current?pe(oe):gn(oe)},kn=Q=>{Q.stopPropagation(),!k&&(U.current=!0,He(!0))},yn=Q=>{if(Q.stopPropagation(),k)return;U.current=!1,He(!1);const oe=Q.currentTarget.value;gn(oe)},Sn=()=>{k||(U.current=!1,He(!1),gn(ce))},Nn=Q=>{Q.stopPropagation(),Q.preventDefault(),!k&&Ae(!0)},Kn=()=>{Ae(!1),Sn()},ns=Q=>{Q.stopPropagation(),Q.key==="Escape"&&(Q.preventDefault(),Kn())},Un=m.useCallback(Q=>{const oe=Z.current;if(!oe)return;const Pe=Math.max(0,oe.scrollHeight-oe.clientHeight);oe.scrollTop=Math.min(1,Math.max(0,Q))*Pe,Qe()},[Qe]),fr=m.useCallback((Q,oe=0)=>{const Pe=le.current;if(!Pe)return 0;const Be=Pe.getBoundingClientRect(),jt=Ie.height/100*Be.height,jn=Math.max(1,Be.height-jt);return(Q-Be.top-oe)/jn},[Ie.height]),Wr=m.useCallback(Q=>{var ze,Rt;if(!Ie.visible)return;Q.preventDefault(),Q.stopPropagation();const oe=le.current;if(!oe)return;const Pe=oe.getBoundingClientRect(),Be=Ie.top/100*Pe.height,jt=Ie.height/100*Pe.height,nr=Q.clientY>=Pe.top+Be&&Q.clientY<=Pe.top+Be+jt?Q.clientY-Pe.top-Be:jt/2;Un(fr(Q.clientY,nr));const Cn=Q.pointerId;(Rt=(ze=Q.currentTarget).setPointerCapture)==null||Rt.call(ze,Cn);const Mn=Ce=>{Ce.preventDefault(),Un(fr(Ce.clientY,nr))},xn=()=>{window.removeEventListener("pointermove",Mn),window.removeEventListener("pointerup",xn),window.removeEventListener("pointercancel",xn)};window.addEventListener("pointermove",Mn),window.addEventListener("pointerup",xn),window.addEventListener("pointercancel",xn)},[fr,Ie.height,Ie.top,Ie.visible,Un]),Vr=async Q=>{if(k)return;const oe=await gP({files:Q,body:ce,images:H});oe&&(pe(oe.body),o==null||o(n,oe.body),l==null||l(n,oe.images))},jr=(Q,oe)=>{if(Q.stopPropagation(),k)return;const Pe=H.filter(jt=>jt.id!==oe.id),Be=JW(ce,oe.label);pe(Be),o==null||o(n,Be),l==null||l(n,Pe)},rs=Q=>{if(k)return;const oe=mP(Q);oe.length!==0&&(Q.preventDefault(),Q.stopPropagation(),Vr(oe).catch(()=>{}))},an=Q=>{if(k)return;const oe=Hc(Q);oe.length!==0&&(Q.preventDefault(),Q.stopPropagation(),Vr(oe).catch(()=>{}))},Cr=()=>{const Q=Z.current,oe=ue.current;!Q||!oe||(oe.scrollTop=Q.scrollTop,oe.scrollLeft=Q.scrollLeft)};return a.jsxs("div",{className:"af-flow-node"+(t?" af-flow-node--selected":"")+(g?" af-flow-node--executing":"")+(x==="success"?" af-flow-node--done":"")+(x==="failed"?" af-flow-node--failed":"")+(x==="running"&&!g?" af-flow-node--running-disk":"")+(b?" af-flow-node--dim":"")+($?" af-flow-node--inline-body-editor":"")+(A?" af-flow-node--provide-text":"")+(W?" af-flow-node--provide-password":"")+" 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__title af-flow-node__title--chrome",title:`${O}${n?` (${n})`:""}${y?` · ${y}`:""}`,children:O}),!w&&dn&&a.jsxs("div",{className:"af-flow-node__model-wrap nodrag",onPointerDown:Pt,onMouseDown:Pt,onClick:Pt,children:[a.jsxs("select",{className:"af-flow-node__model nodrag",value:Fe,onChange:Lt,onPointerDown:Pt,onMouseDown:Pt,onClick:Pt,"aria-label":p("flow:node.model"),title:Et||p("flow:node.defaultModel"),disabled:k,children:[a.jsx("option",{value:"",children:p("flow:node.defaultModel")}),Ve&&a.jsx("option",{value:st,children:st}),qt.length>0&&a.jsx("optgroup",{label:"Cursor",children:qt.map(Q=>a.jsx("option",{value:`cursor:${ii(Q)}`,children:ii(Q)},`c-${Q}`))}),Te.length>0&&a.jsx("optgroup",{label:"OpenCode",children:Te.map(Q=>a.jsx("option",{value:`opencode:${ii(Q)}`,children:ii(Q)},`o-${Q}`))}),Ht.length>0&&a.jsx("optgroup",{label:"Claude Code",children:Ht.map(Q=>a.jsx("option",{value:`claude-code:${ii(Q)}`,children:ii(Q)},`cc-${Q}`))})]}),a.jsx("span",{className:"af-flow-node__model-arrow material-symbols-outlined",children:"expand_more"})]}),g&&a.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--executing",children:"EXECUTING"}),x==="running"&&!g&&a.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--running-disk",title:p("flow:node.diskRunning"),children:"RUNNING"}),x==="success"&&a.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--done",children:S!=null&&String(S).trim()!==""?S:"--"}),x==="failed"&&a.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--failed",children:"FAILED"}),!w&&j&&!E&&!A&&!D&&!W&&a.jsx("button",{type:"button",className:"af-flow-node__expand",onClick:fn,"aria-label":p("flow:node.expandProvide"),title:p("flow:node.expandProvide"),children:a.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})}),!w&&a.jsx("button",{type:"button",className:"af-flow-node__delete",disabled:k,onClick:tt,"aria-label":p("flow:node.deleteNode"),title:p("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((Q,oe)=>{if(Q.showOnNode===!1)return null;const Pe=p("flow:node.inputTooltip",{name:Q.name||`#${oe}`,type:Q.type})+(Q.default!=null&&Q.default!==""?p("flow:node.defaultSuffix",{value:Q.default}):""),Be=Q.name||`#${oe+1}`;return a.jsxs("div",{className:"af-flow-node__port-row",title:Pe,children:[a.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--in",children:[Be,Q.required?a.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),a.jsx(Zn,{type:"target",position:$e.Left,id:`input-${oe}`,className:"af-flow-node__handle",style:{background:Tn(Q.type)},title:Pe})]},`in-${oe}`)})}),a.jsxs("div",{className:"af-flow-node__title-wrap",children:[E?a.jsxs("select",{className:"af-flow-node__bool-select nodrag"+(P?" af-flow-node__bool-select--true":""),value:P?"true":"false",onChange:kt,onPointerDown:Pt,onMouseDown:Pt,onClick:Pt,"aria-label":"Boolean value",title:P?"true":"false",disabled:k,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:re,onChange:Nt,onCompositionStart:tn,onCompositionEnd:nn,onBlur:tr,onPointerDown:Pt,onMouseDown:Pt,onClick:Pt,placeholder:"输入文本",rows:2,readOnly:k}):D?a.jsxs("div",{className:"af-flow-node__file-value nodrag",onPointerDown:Pt,onMouseDown:Pt,onClick:Pt,children:[a.jsx("input",{className:"af-flow-node__file-input nodrag",value:re,onChange:Nt,onCompositionStart:tn,onCompositionEnd:nn,onBlur:tr,placeholder:"选择或输入文件路径",title:re||"选择或输入文件路径",readOnly:k}),a.jsx("button",{type:"button",className:"af-flow-node__file-picker nodrag",disabled:k,onClick:Fn,"aria-label":"选择文件",title:"选择文件",children:a.jsx("span",{className:"material-symbols-outlined",children:"folder_open"})})]}):W?a.jsxs("div",{className:"af-flow-node__password-value nodrag",onPointerDown:Pt,onMouseDown:Pt,onClick:Pt,children:[a.jsx("input",{className:"af-flow-node__password-input nodrag",type:te?"text":"password",value:re,onChange:Nt,onCompositionStart:tn,onCompositionEnd:nn,onBlur:tr,placeholder:"输入密码或密钥",title:te?re:"密码已隐藏",autoComplete:"off",readOnly:k}),a.jsx("button",{type:"button",className:"af-flow-node__password-toggle nodrag",disabled:k,onClick:Vn,"aria-label":te?"隐藏密码":"预览密码",title:te?"隐藏密码":"预览密码",children:a.jsx("span",{className:"material-symbols-outlined",children:te?"visibility_off":"visibility"})})]}):$?a.jsxs("div",{ref:V,className:"af-flow-node__prompt-stack nodrag"+(De?" af-flow-node__prompt-stack--composing":""),children:[a.jsx("pre",{ref:ue,className:"af-flow-node__prompt-backdrop","aria-hidden":"true",dangerouslySetInnerHTML:{__html:QW(ce)+`
99
- `}}),a.jsx("textarea",{ref:Z,className:"af-flow-node__prompt-editor nodrag",value:ce,onChange:Yt,onCompositionStart:kn,onCompositionEnd:yn,onBlur:Sn,onPaste:rs,onDrop:an,onScroll:Q=>{Cr(),Qe()},onPointerDown:Pt,onMouseDown:Pt,onClick:Pt,onKeyDown:Pt,onDragOver:Q=>{Hc(Q).length>0&&Q.preventDefault()},placeholder:R?"输入判断条件 / prompt":"输入 prompt",rows:2,readOnly:k}),!k&&a.jsx("button",{type:"button",className:"af-flow-node__prompt-expand nodrag",onPointerDown:Pt,onMouseDown:Pt,onClick:Nn,"aria-label":"放大编辑",title:"放大编辑",children:a.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})}),a.jsx("div",{ref:le,className:"af-flow-node__prompt-scrollbar"+(Ie.visible?" af-flow-node__prompt-scrollbar--visible":""),onPointerDown:Wr,"aria-hidden":"true",children:a.jsx("span",{style:{height:`${Ie.height}%`,top:`${Ie.top}%`}})})]}):null,$&&H.length>0?a.jsx("div",{className:"af-flow-node__image-chips",children:H.map((Q,oe)=>a.jsxs("span",{className:"af-flow-node__image-chip",title:Q.name,children:[a.jsx("img",{src:Q.dataUrl,alt:""}),a.jsxs("span",{children:["[",Q.label||`image ${oe+1}`,"]"]}),a.jsx("button",{type:"button",className:"af-flow-node__image-remove nodrag",disabled:k,onClick:Pe=>jr(Pe,Q),onPointerDown:Pt,onMouseDown:Pt,"aria-label":`删除 ${Q.label||`image ${oe+1}`}`,title:"删除图片",children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},Q.id||oe))}):null,I?a.jsx("span",{className:"af-flow-node__prompt-preview",title:I,children:I}):null,_?null:a.jsx("span",{className:"af-flow-node__body-title",title:O,children:O})]}),a.jsx("div",{className:"af-flow-node__ports af-flow-node__ports--out",children:d.map((Q,oe)=>{if(Q.showOnNode===!1)return null;const Pe=p("flow:node.outputTooltip",{name:Q.name||`#${oe}`,type:Q.type})+(Q.default!=null&&Q.default!==""?p("flow:node.defaultSuffix",{value:Q.default}):""),Be=Q.name||`#${oe+1}`;return a.jsxs("div",{className:"af-flow-node__port-row",title:Pe,children:[a.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--out",children:[Be,Q.required?a.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),a.jsx(Zn,{type:"source",position:$e.Right,id:`output-${oe}`,className:"af-flow-node__handle",style:{background:Tn(Q.type)},title:Pe})]},`out-${oe}`)})})]}),ut?ar.createPortal(a.jsx("div",{className:"af-flow-node-full-editor nodrag",onPointerDown:Pt,onMouseDown:Pt,onClick:Pt,onWheel:Pt,children:a.jsxs("div",{className:"af-flow-node-full-editor__panel",children:[a.jsxs("div",{className:"af-flow-node-full-editor__header",children:[a.jsxs("div",{children:[a.jsx("div",{className:"af-flow-node-full-editor__title",children:O}),a.jsx("div",{className:"af-flow-node-full-editor__hint",children:"编辑 prompt,Esc 关闭"})]}),a.jsx("button",{type:"button",className:"af-flow-node-full-editor__close",onClick:Kn,"aria-label":"关闭",title:"关闭",children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsx("textarea",{ref:we,className:"af-flow-node-full-editor__textarea",value:ce,onChange:Yt,onCompositionStart:kn,onCompositionEnd:yn,onPaste:rs,onDrop:an,onKeyDown:ns,onDragOver:Q=>{Hc(Q).length>0&&Q.preventDefault()},placeholder:R?"输入判断条件 / prompt":"输入 prompt",readOnly:k})]})}),document.body):null]})}const vu="flowNode";function $y(e){const t=e.type||"node",n=e.showOnNode!=null,r={type:t,name:e.name||"",default:e.value!==void 0&&e.value!==null?String(e.value):e.default!==void 0?String(e.default):""};return e.required!=null&&(r.required=!!e.required),e.description!=null&&(r.description=String(e.description)),r.showOnNode=n?!!e.showOnNode:!!r.required||String(t).trim().toLowerCase()==="node",r._showOnNodeExplicit=n,r}const t9={agent_subAgent:["SubAgent"],control_start:["Start"],control_end:["End"],control_agent_toBool:["Agent ToBool"],control_anyOne:["Any One"],control_cancelled:["Cancelled","Cancel Check"],control_cd_workspace:["CD Workspace"],control_delay:["Delay"],control_if:["If Branch"],control_interval_loop:["Interval Loop"],control_load_skills:["Load Skills"],control_load_mcp:["Load MCP"],workspace_scheduled_run:["Scheduled Run"],workspace_run:["Run"],control_user_workspace:["User Workspace"],control_toBool:["To Bool","Code ToBool"],control_wait_until:["Wait Until"],tool_git_checkout:["Git Checkout"],tool_get_env:["Get Env"],tool_load_key:["Load Key"],tool_set_run_env:["Set Run Env","Set Env"],tool_display_share_link:["Display Share Link","Share Link"],tool_nodejs:["Node.js Script"],tool_print:["Print"],tool_save_key:["Save Key"],tool_user_ask:["UserAsk"],tool_user_check:["User Confirm"],provide_file:["File"],provide_password:["Password"],provide_bool:["Boolean"],provide_text:["Text"],provide_str:["Text"],display_markdown:["Markdown Display"],display_mermaid:["Mermaid Display"],display_ascii:["ASCII Display"],display_chart:["Chart Display"],display_table:["Table Display"]};function n9(e,t,n){const r=String((n==null?void 0:n.displayName)||"").trim(),s=String(t||"").trim();return!r||!s||r===s?s:(t9[e]||[]).includes(s)?r:s}const r9={tool_git_checkout:new Set(["targetDir","pullIfExists","includeSubmodules","workspaceContext","commit","changed"]),control_load_skills:new Set(["mergeMode","workspaceContext","skillsContext","loadedCount","summary"]),control_load_mcp:new Set(["workspaceContext","mcpContext","loadedCount","summary"]),agent_subAgent:new Set(["workspaceContext","skillsContext","mcpContext"])},s9={control_cd_workspace:new Set(["mode","label","cwd","previous"]),control_user_workspace:new Set(["cwd"]),display_markdown:new Set(["prev","next"]),display_mermaid:new Set(["prev","next"]),display_ascii:new Set(["prev","next"]),display_html:new Set(["prev","next"]),display_image:new Set(["prev","next"]),display_chart:new Set(["prev","next"]),display_table:new Set(["prev","next"]),tool_git_checkout:new Set(["branch","targetDir","pullIfExists","includeSubmodules","repoPath","commit","changed"]),tool_gitlab_create_mr:new Set(["repoPath","workspaceContext","sourceBranch","targetBranch","title","description","draft","labels","push","remote","tokenEnv","gitlabApiBase","removeSourceBranch","squash","created","mrIid","projectId","message"])},i9=new Set(["display_markdown","display_mermaid","display_ascii","display_html","display_image","display_chart","display_table"]);function o9(e,t){if(!i9.has(String(e||"")))return!1;const n=String((t==null?void 0:t.name)||"");return n==="content"||n==="src"}function a9(e){const t=String((e==null?void 0:e.marketplaceDefinitionId)||(e==null?void 0:e.id)||"").trim();return t.startsWith("marketplace:")?t:""}function l9(e,t){const n=String((e==null?void 0:e.baseDefinitionId)||"").trim();return n||t}function yP(e){const t=String(e??"");return/^[A-Za-z0-9_@%+=:,./-]+$/.test(t)?t:"'"+t.replace(/'/g,"'\\''")+"'"}function c9(e,t){const n=String((e==null?void 0:e.language)||"").trim().toLowerCase(),r=String(t||"").trim().toLowerCase();return n.includes("python")||r.endsWith(".py")?"python3":n.includes("shell")||n==="bash"||r.endsWith(".sh")||r.endsWith(".bash")?"bash":"node"}function u9(e){const t=String(e??"").trim();return t?t.includes("${")?t:yP(t):""}function d9(e){if(String((e==null?void 0:e.baseDefinitionId)||"").trim()!=="tool_nodejs")return"";const t=e!=null&&e.runtime&&typeof e.runtime=="object"?e.runtime:{},n=String(t.entry||"").trim().replace(/^\/+/,"");if(n){const r=String((e==null?void 0:e.packageDir)||"").trim().replace(/\/+$/,""),s=r?`${r}/${n}`:`\${flowDir}/${n}`,i=Array.isArray(t.args)?t.args.map(u9).filter(Boolean):[];return[c9(t,n),yP(s),...i].join(" ")}return String(t.command||"").trim()}function AS(e,t,n){return!Array.isArray(t)||!Array.isArray(n)||n.length===0?t:t.map((r,s)=>{var u,p;const i=n[s],l=n.find(f=>(f==null?void 0:f.name)&&f.name===r.name)||i;if(!l)return r;const c=r.showOnNode===!1&&l.showOnNode==null&&((u=r9[e])==null?void 0:u.has(r.name));return{...r,...r.required==null&&l.required!=null?{required:!!l.required}:{},...r.description==null&&l.description!=null?{description:String(l.description)}:{},...c?{showOnNode:!0}:{},...!r._showOnNodeExplicit&&l.showOnNode!=null?{showOnNode:!!l.showOnNode}:{},...!r._showOnNodeExplicit&&l.showOnNode==null?{showOnNode:!!r.required||String(r.type||"").trim().toLowerCase()==="node"}:{},...!r._showOnNodeExplicit&&o9(e,r)?{showOnNode:!0}:{},...(p=s9[e])!=null&&p.has(r.name)?{showOnNode:!1}:{}}})}function f9(e){var s,i;const t=Array.isArray((s=e==null?void 0:e.data)==null?void 0:s.inputs)?e.data.inputs:[],n=Array.isArray((i=e==null?void 0:e.data)==null?void 0:i.outputs)?e.data.outputs:[],r=o=>o.map(l=>{const c=$y(l);return{type:String(c.type||"node"),name:String(c.name??""),default:String(c.default??""),required:!!c.required,description:String(c.description??""),showOnNode:c.showOnNode!=null?c.showOnNode!==!1:!!c.required||String(c.type||"").trim().toLowerCase()==="node"}});return{inputs:r(t),outputs:r(n)}}function xP(e,t,n,r,s){var I,H,_,Y,U,V,Z,ue,le,we,re,ye,te,ie,ce,pe,De,He,Ie,et,ut;const i=((I=e.data)==null?void 0:I.definitionId)||String(e.id).replace(/-\d+$/,""),o=n.find(Ae=>Ae.id===i),l=t[e.id];let c=[],u=[],p=((H=e.data)==null?void 0:H.label)??e.id,f,d,h,y,w;const k=!!l;l&&(Array.isArray(l.input)&&(c=l.input.map($y)),Array.isArray(l.output)&&(u=l.output.map($y)),l.label&&(p=String(l.label)),l.role&&typeof l.role=="string"&&(f=l.role),l.model!=null&&(d=String(l.model).trim()),l.body!=null&&(h=String(l.body)),Array.isArray(l.images)&&(y=l.images),l.script!=null&&(w=String(l.script)));const g=f??(typeof((_=e.data)==null?void 0:_.role)=="string"?e.data.role:"普通"),b=d??((Y=e.data)==null?void 0:Y.model)??void 0,x=(o==null?void 0:o.description)!=null?String(o.description).trim():"",S=x!==""?x:void 0,C=h??((U=e.data)==null?void 0:U.body)??"",j=Array.isArray(y)?y:Array.isArray((V=e.data)==null?void 0:V.images)?e.data.images:[],E=d9(o),A=w!==void 0?w:((Z=e.data)==null?void 0:Z.script)!=null?String(e.data.script):E,D=String(e.id),W=(ue=r==null?void 0:r[s])==null?void 0:ue[D],F=(le=W==null?void 0:W.label)==null?void 0:le.label,R=W==null?void 0:W.body,$=W==null?void 0:W.description;k||(c.length===0&&((we=o==null?void 0:o.inputs)!=null&&we.length)&&(c=o.inputs.map(Ae=>({...Ae}))),u.length===0&&((re=o==null?void 0:o.outputs)!=null&&re.length)&&(u=o.outputs.map(Ae=>({...Ae}))));const P=l9(o,(o==null?void 0:o.id)??i),L=(l==null?void 0:l.marketplaceRef)||((ye=e.data)==null?void 0:ye.marketplaceRef)||a9(o);if(P==="agent_subAgent"&&!u.some(Ae=>(Ae==null?void 0:Ae.name)==="result")){const Ae=(te=o==null?void 0:o.outputs)==null?void 0:te.find(Qe=>(Qe==null?void 0:Qe.name)==="result");u=[...u,Ae?{...Ae}:{type:"text",name:"result",default:""}]}if((P==="display_markdown"||P==="display_mermaid"||P==="display_ascii"||P==="display_chart"||P==="display_table")&&!u.some(Ae=>(Ae==null?void 0:Ae.name)==="next")){const Ae=(ie=o==null?void 0:o.outputs)==null?void 0:ie.find(Qe=>(Qe==null?void 0:Qe.name)==="next");u=[...u,Ae?{...Ae}:{type:"node",name:"next",default:""}]}if(P==="workspace_run"){if(!c.some(Ae=>(Ae==null?void 0:Ae.name)==="prev")){const Ae=(ce=o==null?void 0:o.inputs)==null?void 0:ce.find(Qe=>(Qe==null?void 0:Qe.name)==="prev");c=[Ae?{...Ae}:{type:"node",name:"prev",default:""},...c]}if(!u.some(Ae=>(Ae==null?void 0:Ae.name)==="next")){const Ae=(pe=o==null?void 0:o.outputs)==null?void 0:pe.find(Qe=>(Qe==null?void 0:Qe.name)==="next");u=[...u,Ae?{...Ae}:{type:"node",name:"next",default:""}]}}c=AS(P,c,o==null?void 0:o.inputs),u=AS(P,u,o==null?void 0:o.outputs),P.startsWith("provide_")&&u[0]&&String(u[0].default??u[0].value??"").trim()===""&&String(C).trim()!==""&&(u=u.map((Ae,Qe)=>Qe===0?{...Ae,default:C,value:C}:Ae));const T=n9(P,p,o),O=P==="tool_nodejs"||String(A).trim()!=="";return{...e,type:"flowNode",data:{...e.data,label:F||p,displayLabel:T,definitionDisplayName:o==null?void 0:o.displayName,definitionId:P,...L?{marketplaceRef:L}:{},...l!=null&&l.marketplacePackageId||(De=e.data)!=null&&De.marketplacePackageId||o!=null&&o.packageId?{marketplacePackageId:(l==null?void 0:l.marketplacePackageId)||((He=e.data)==null?void 0:He.marketplacePackageId)||(o==null?void 0:o.packageId)}:{},...l!=null&&l.marketplaceVersion||(Ie=e.data)!=null&&Ie.marketplaceVersion||o!=null&&o.version?{marketplaceVersion:(l==null?void 0:l.marketplaceVersion)||((et=e.data)==null?void 0:et.marketplaceVersion)||(o==null?void 0:o.version)}:{},schemaType:((ut=e.data)==null?void 0:ut.schemaType)??e.type??"agent",role:g,model:b,body:R||C,images:j,script:A,inputs:c,outputs:u,description:$||S,originalLabel:p,originalBody:C,...O?{script:A}:{}}}}function p9(e,t){const n=new Map(t.map(r=>[r.id,r]));return e.filter(r=>{var p,f,d,h;const s=n.get(r.source),i=n.get(r.target),o=((f=(p=s==null?void 0:s.data)==null?void 0:p.outputs)==null?void 0:f.length)??0,l=((h=(d=i==null?void 0:i.data)==null?void 0:d.inputs)==null?void 0:h.length)??0,c=r.sourceHandle?parseInt(String(r.sourceHandle).replace("output-",""),10):0,u=r.targetHandle?parseInt(String(r.targetHandle).replace("input-",""),10):0;return s&&i&&c>=0&&c<o&&u>=0&&u<l})}function IS(e,t){const n=new RegExp(`^${t}-(\\d+)$`).exec(String(e||""));if(!n)return 0;const r=Number.parseInt(n[1],10);return Number.isFinite(r)&&r>=0?r:0}function TS(e,t){return!Array.isArray(e)||!e[t]||e[t].showOnNode===!0?e:e.map((n,r)=>r===t?{...n,showOnNode:!0}:n)}function Fm(e,t){const n=String((t==null?void 0:t.source)||""),r=String((t==null?void 0:t.target)||"");if(!n||!r)return e;const s=IS(t==null?void 0:t.sourceHandle,"output"),i=IS(t==null?void 0:t.targetHandle,"input");let o=!1;const l=(e||[]).map(c=>{var u,p,f,d;if(c.id===n){const h=TS((u=c.data)==null?void 0:u.outputs,s);if(h!==((p=c.data)==null?void 0:p.outputs))return o=!0,{...c,data:{...c.data,outputs:h}}}if(c.id===r){const h=TS((f=c.data)==null?void 0:f.inputs,i);if(h!==((d=c.data)==null?void 0:d.inputs))return o=!0,{...c,data:{...c.data,inputs:h}}}return c});return o?l:e}function h9(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 RS(e){return e.key==="?"||e.key==="/"&&e.shiftKey}function m9(){return typeof navigator>"u"?!1:/Mac|iPhone|iPod|iPad/i.test(navigator.platform||navigator.userAgent||"")}function g9({children:e}){return a.jsx("kbd",{className:"af-kbd",children:e})}function gs({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(g9,{children:t})]},n))})}function y9({open:e,onClose:t}){const{t:n}=dr(),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 i=m9()?"⌘":"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(gs,{keys:[i,"S"]})]}),a.jsxs("li",{className:"af-shortcuts-row",children:[a.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.shortcutsLabel")}),a.jsx(gs,{keys:["?"]})]}),a.jsxs("li",{className:"af-shortcuts-row",children:[a.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.jumpToNode")}),a.jsx(gs,{keys:[i,"K"]})]}),a.jsxs("li",{className:"af-shortcuts-row",children:[a.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.openNodePalette")}),a.jsx(gs,{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(gs,{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(gs,{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(gs,{keys:["Space"]})]}),a.jsxs("li",{className:"af-shortcuts-row",children:[a.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.saveViewport")}),a.jsx(gs,{keys:["F"]})]}),a.jsxs("li",{className:"af-shortcuts-row",children:[a.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.selectAll")}),a.jsx(gs,{keys:[i,"A"]})]}),a.jsxs("li",{className:"af-shortcuts-row",children:[a.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.undo")}),a.jsx(gs,{keys:[i,"Z"]})]}),a.jsxs("li",{className:"af-shortcuts-row",children:[a.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.redo")}),a.jsx(gs,{keys:[i,"Shift","Z"]})]})]})]})]})]})})}function x9(e,t){if(!t)return 1;const n=t.toLowerCase(),r=(e.id||"").toLowerCase(),s=(e.label||"").toLowerCase(),i=(e.definitionId||"").toLowerCase();return r===n?100:r.startsWith(n)?80:r.includes(n)?60:s.startsWith(n)?40:s.includes(n)?30:i.includes(n)?15:0}function w9({open:e,onClose:t,onJump:n,nodes:r}){const{t:s}=dr(),[i,o]=m.useState(""),[l,c]=m.useState(0),u=m.useRef(null),p=m.useRef(null);m.useEffect(()=>{if(!e)return;o(""),c(0);const y=requestAnimationFrame(()=>{var w;return(w=u.current)==null?void 0:w.focus()});return()=>cancelAnimationFrame(y)},[e]);const f=m.useMemo(()=>{const y=(r||[]).map(g=>{var b,x,S;return{id:g.id,label:((b=g.data)==null?void 0:b.label)||"",definitionId:((x=g.data)==null?void 0:x.definitionId)||"",schemaType:((S=g.data)==null?void 0:S.schemaType)||""}}),w=i.trim(),k=y.map(g=>({e:g,s:x9(g,w)})).filter(g=>g.s>0);return k.sort((g,b)=>b.s-g.s||g.e.id.localeCompare(b.e.id)),k.slice(0,50).map(g=>g.e)},[r,i]);if(m.useEffect(()=>{l>=f.length&&c(0)},[f.length,l]),m.useEffect(()=>{var w;const y=(w=p.current)==null?void 0:w.querySelector(`[data-idx="${l}"]`);y&&y.scrollIntoView({block:"nearest"})},[l]),!e)return null;const d=y=>{const w=f[y];w&&(n(w.id),t())},h=y=>{if(y.key==="Escape"){y.preventDefault(),t();return}if(y.key==="ArrowDown"){y.preventDefault(),c(w=>Math.min(f.length-1,w+1));return}if(y.key==="ArrowUp"){y.preventDefault(),c(w=>Math.max(0,w-1));return}y.key==="Enter"&&(y.preventDefault(),d(l))};return a.jsx("div",{className:"af-jump-overlay",role:"presentation",onMouseDown:y=>{y.target===y.currentTarget&&t()},children:a.jsxs("div",{className:"af-jump-panel",role:"dialog","aria-modal":"true","aria-label":s("flow:jumpPalette.title"),onMouseDown:y=>y.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:u,type:"text",className:"af-jump-panel__input",placeholder:s("flow:jumpPalette.placeholder"),value:i,onChange:y=>{o(y.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:s("flow:jumpPalette.empty")}):a.jsx("ul",{ref:p,className:"af-jump-panel__list",role:"listbox",children:f.map((y,w)=>a.jsxs("li",{"data-idx":w,role:"option","aria-selected":w===l,className:"af-jump-panel__item"+(w===l?" af-jump-panel__item--active":""),onMouseEnter:()=>c(w),onMouseDown:k=>{k.preventDefault(),d(w)},children:[a.jsx("span",{className:"af-jump-panel__id",children:y.id}),y.label&&y.label!==y.id&&a.jsx("span",{className:"af-jump-panel__label",children:y.label}),y.definitionId&&a.jsx("span",{className:"af-jump-panel__tag",children:y.definitionId})]},y.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:"↓"})," ",s("flow:jumpPalette.hintNavigate")]}),a.jsxs("span",{children:[a.jsx("kbd",{className:"af-kbd",children:"Enter"})," ",s("flow:jumpPalette.hintJump")]}),a.jsxs("span",{children:[a.jsx("kbd",{className:"af-kbd",children:"Esc"})," ",s("flow:jumpPalette.hintClose")]})]})]})})}function MS(e){const t=Number(e||0);if(!Number.isFinite(t)||t<=0)return"-";const n=new Date(t),r=s=>String(s).padStart(2,"0");return`${r(n.getMonth()+1)}-${r(n.getDate())} ${r(n.getHours())}:${r(n.getMinutes())}:${r(n.getSeconds())}`}function b9(e){const t=Number(e||0);if(!Number.isFinite(t)||t<=0)return"-";if(t<1e3)return`${Math.round(t)}ms`;const n=Math.round(t/1e3);if(n<60)return`${n}s`;const r=Math.floor(n/60),s=n%60;return`${r}m${String(s).padStart(2,"0")}s`}function LS(e){if(!e||typeof e!="object")return"";if(e.line)return String(e.line);if(e.text)return String(e.text);if(e.error)return String(e.error);if(e.message)return String(e.message);if(e.status)return String(e.status);if(e.type==="graph"){const n=Array.isArray(e.displayNodeIds)?e.displayNodeIds.join(", "):"";return n?`graph updated: ${n}`:"graph updated"}const t=JSON.stringify(e);return t.length>4e3?`${t.slice(0,4e3)}
100
- ... [truncated]`:t}function zm(e){return String((e==null?void 0:e.nodeId)||(e==null?void 0:e.runNodeId)||"")}function $S(e){const t=String(e||"").toLowerCase();return t.includes("success")?"success":t.includes("fail")||t.includes("error")?"failed":t.includes("skip")||t.includes("disabled")?"skipped":t.includes("running")?"running":t.includes("stop")?"stopped":"idle"}function v9({flowParams:e,scheduleNodeId:t="",runNodeId:n="",lastRunId:r="",label:s="",onClose:i}){const[o,l]=m.useState([]),[c,u]=m.useState(""),[p,f]=m.useState(null),[d,h]=m.useState(!1),[y,w]=m.useState(!1),[k,g]=m.useState(""),[b,x]=m.useState(""),S=m.useCallback(async()=>{if(e!=null&&e.flowId){h(!0),g("");try{const A=new URLSearchParams;A.set("flowId",e.flowId),A.set("flowSource",e.flowSource||"user"),t?A.set("scheduleNodeId",t):n&&A.set("runNodeId",n),A.set("limit","80");const D=await fetch(`/api/workspace/run-logs?${A.toString()}`),W=await D.json().catch(()=>({}));if(!D.ok)throw new Error(W.error||"读取日志失败");const F=Array.isArray(W.runs)?W.runs:[];l(F),u(R=>{const $=F[0]||null;return $&&String($.status||"")==="running"&&$.runId!==R?$.runId:R&&F.some(P=>P.runId===R)?R:r&&F.some(P=>P.runId===r)?r:($==null?void 0:$.runId)||""})}catch(A){g(String(A.message||A)),l([])}finally{h(!1)}}},[e==null?void 0:e.flowId,e==null?void 0:e.flowSource,r,n,t]),C=m.useCallback(async A=>{if(!A){f(null);return}w(!0);try{const D=await fetch(`/api/workspace/run-logs/${encodeURIComponent(A)}`),W=await D.json().catch(()=>({}));if(!D.ok)throw new Error(W.error||"读取日志详情失败");f(W)}catch(D){f({error:String(D.message||D),events:[]})}finally{w(!1)}},[]);m.useEffect(()=>{S()},[S]),m.useEffect(()=>{C(c)},[C,c]),m.useEffect(()=>{const A=o.find(W=>W.runId===c),D=window.setInterval(()=>{S(),(!A||A.status==="running")&&c&&C(c)},2e3);return()=>window.clearInterval(D)},[C,S,o,c]);const j=m.useMemo(()=>{const A=Array.isArray(p==null?void 0:p.events)?p.events:[],D=b.trim().toLowerCase();return D?A.filter(W=>String(W.type||"").toLowerCase().includes(D)||zm(W).toLowerCase().includes(D)||LS(W).toLowerCase().includes(D)):A},[p==null?void 0:p.events,b]),E=(p==null?void 0:p.run)||o.find(A=>A.runId===c)||null;return a.jsxs("div",{className:"af-work-run-logs",children:[a.jsxs("div",{className:"af-pipeline-drawer-head",children:[a.jsx("h2",{className:"af-pipeline-drawer-title",children:"执行日志"}),a.jsx("button",{type:"button",className:"af-pipeline-drawer-close af-icon-btn",onClick:i,"aria-label":"关闭日志侧栏",children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsxs("div",{className:"af-work-run-logs__meta",children:[a.jsx("span",{children:s||t||n||"Workspace Run"}),a.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>void S(),title:"刷新日志","aria-label":"刷新日志",children:a.jsx("span",{className:"material-symbols-outlined",children:"refresh"})})]}),k?a.jsx("div",{className:"af-work-run-logs__error",children:k}):null,a.jsxs("div",{className:"af-work-run-logs__body",children:[a.jsxs("div",{className:"af-work-run-logs__list",children:[a.jsx("div",{className:"af-work-run-logs__section-title",children:"最近执行"}),d?a.jsx("div",{className:"af-work-run-logs__empty",children:"Loading..."}):null,!d&&o.length===0?a.jsx("div",{className:"af-work-run-logs__empty",children:"暂无执行日志"}):null,o.map(A=>a.jsxs("button",{type:"button",className:"af-work-run-logs__run"+(A.runId===c?" af-work-run-logs__run--active":""),onClick:()=>u(A.runId),title:A.runId,children:[a.jsx("span",{className:`af-work-run-logs__status af-work-run-logs__status--${$S(A.status)}`,children:A.status||"unknown"}),a.jsx("span",{children:MS(A.startedAt)}),a.jsx("span",{children:b9(A.durationMs)})]},A.runId))]}),a.jsxs("div",{className:"af-work-run-logs__detail",children:[a.jsxs("div",{className:"af-work-run-logs__detail-head",children:[a.jsxs("div",{children:[a.jsx("div",{className:"af-work-run-logs__section-title",children:"详情"}),a.jsx("div",{className:"af-work-run-logs__run-id",children:(E==null?void 0:E.runId)||"-"})]}),E?a.jsx("span",{className:`af-work-run-logs__status af-work-run-logs__status--${$S(E.status)}`,children:E.status}):null]}),a.jsxs("label",{className:"af-work-run-logs__search",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),a.jsx("input",{value:b,onChange:A=>x(A.target.value),placeholder:"搜索事件、节点、错误"})]}),y?a.jsx("div",{className:"af-work-run-logs__empty",children:"Loading..."}):null,p!=null&&p.error?a.jsx("div",{className:"af-work-run-logs__error",children:p.error}):null,!y&&!j.length?a.jsx("div",{className:"af-work-run-logs__empty",children:"暂无事件"}):null,a.jsx("div",{className:"af-work-run-logs__events",children:j.map((A,D)=>a.jsxs("div",{className:"af-work-run-logs__event",children:[a.jsx("span",{className:"af-work-run-logs__event-time",children:MS(A.ts)}),a.jsx("span",{className:"af-work-run-logs__event-type",children:A.type||"event"}),zm(A)?a.jsx("span",{className:"af-work-run-logs__event-node",children:zm(A)}):null,a.jsx("pre",{children:LS(A)})]},`${A.ts||D}-${D}`))})]})]})]})}const wP=new Set(["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"]),k9=["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"];function S9(e,t){const n=e.slice(0,t),r=n.lastIndexOf("${");if(r<0)return null;const s=n.slice(r+2);return s.includes("}")?null:{atIndex:r,query:s}}function N9(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 OS(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 bP(e,{inputNames:t,outputNames:n}){const r=e.trim();if(!r)return!1;if(r.startsWith("input.")){const s=r.slice(6).trim();return s!==""&&t.has(s)}if(r.startsWith("output.")){const s=r.slice(7).trim();return s!==""&&n.has(s)}if(wP.has(r)||t.has(r)||n.has(r))return!0;if(!r.includes(".")){const s=`${r}.md`;if(t.has(s)||n.has(s))return!0}return!1}function vP(e){return{inputNames:OS(e==null?void 0:e.inputs),outputNames:OS(e==null?void 0:e.outputs)}}function j9(e,t,n){const r=vP(t),s=N9(e),i=[];for(const o of s)if(!bP(o.key,r)){const l=o.key.trim()===""?n("flow:placeholder.empty"):o.key.trim();i.push({start:o.start,end:o.end,message:n("flow:placeholder.invalidPlaceholder",{hint:l})})}return i}function C9(e,t){const n=vP(t),r=/\$\{([^}]*)\}/g,s=[];let i=0,o;for(;(o=r.exec(e))!==null;){o.index>i&&s.push({kind:"plain",text:e.slice(i,o.index)});const l=o[0],c=bP(o[1],n);s.push({kind:c?"ph-valid":"ph-invalid",text:l}),i=o.index+l.length}return i<e.length&&s.push({kind:"plain",text:e.slice(i)}),s}function E9(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function _9(e){return e.map(t=>{const n=E9(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 P9(e,t){const n=[];for(const r of(e==null?void 0:e.inputs)??[]){const s=(r==null?void 0:r.name)!=null?String(r.name).trim():"";if(!s)continue;const i=(r==null?void 0:r.type)!=null?String(r.type):"";n.push({section:"input",insert:`input.${s}`,label:s,subtitle:i?t("flow:placeholder.inputSubtitle",{type:i}):t("flow:placeholder.inputSubtitleNoType")})}for(const r of(e==null?void 0:e.outputs)??[]){const s=(r==null?void 0:r.name)!=null?String(r.name).trim():"";if(!s)continue;const i=(r==null?void 0:r.type)!=null?String(r.type):"";n.push({section:"output",insert:`output.${s}`,label:s,subtitle:i?t("flow:placeholder.outputSubtitle",{type:i}):t("flow:placeholder.outputSubtitleNoType")})}for(const r of k9)wP.has(r)&&n.push({section:"runtime",insert:r,label:r,subtitle:t("flow:placeholder.runtimeConst")});return n}function A9(e,t){const n=t.toLowerCase();return n?e.filter(r=>[r.insert,r.label,r.subtitle??""].map(i=>String(i).toLowerCase()).some(i=>i.includes(n))):e}function I9(e,t){if(!e||t<0)return null;const n=Math.min(t,e.value.length),r=getComputedStyle(e),s=document.createElement("div");s.setAttribute("aria-hidden","true"),s.style.visibility="hidden",s.style.position="fixed",s.style.top="0",s.style.left="-99999px",s.style.whiteSpace="pre-wrap",s.style.wordWrap="break-word",s.style.overflow="hidden";const i=e.clientWidth;if(i<=0)return null;s.style.width=`${i}px`,s.style.font=r.font,s.style.lineHeight=r.lineHeight,s.style.padding=r.padding,s.style.border=r.border,s.style.boxSizing=r.boxSizing,s.style.letterSpacing=r.letterSpacing,s.style.textIndent=r.textIndent,s.style.tabSize=r.tabSize||"8",s.textContent=e.value.slice(0,n);const o=document.createElement("span");o.textContent="​",s.appendChild(o),document.body.appendChild(s);const l=o.getBoundingClientRect(),c=parseFloat(r.lineHeight),u=Number.isFinite(c)&&c>0?c:l.height||16;return document.body.removeChild(s),{top:l.top,left:l.left,bottom:l.bottom,height:u}}function qd({value:e,onChange:t,disabled:n,placeholder:r,rows:s=8,textareaClassName:i,ioSlots:o,variant:l="drawer",images:c,onImagesChange:u}){const{t:p}=dr(),f=m.useId(),d=m.useRef(null),h=m.useRef(null),[y,w]=m.useState(0),[k,g]=m.useState(0),[b,x]=m.useState(null),S=m.useMemo(()=>ji(c),[c]),C=m.useMemo(()=>j9(e,o,p),[e,o,p]),j=C.length>0,E=m.useMemo(()=>C9(e,o),[e,o]),A=m.useMemo(()=>_9(E),[E]),D=m.useMemo(()=>n?null:S9(e,y),[e,y,n]),W=m.useMemo(()=>{if(!D)return[];const T=P9(o,p);return A9(T,D.query)},[D,o,p]);m.useEffect(()=>{g(T=>{const O=Math.max(0,W.length-1);return Math.min(Math.max(0,T),O)})},[W.length]);const F=m.useCallback(()=>{const T=d.current;if(!T||!D||W.length===0){x(null);return}const O=I9(T,y);if(!O){x(null);return}const I=4,H=44,_=13.5*16,Y=Math.min(W.length*H+8,_);let U=O.bottom+I;U+Y>window.innerHeight-8&&(U=Math.max(8,O.top-Y-I));const V=288;let Z=O.left;Z=Math.max(8,Math.min(Z,window.innerWidth-V-8)),x({top:U,left:Z})},[D,W.length,y]);m.useLayoutEffect(()=>{if(!D||W.length===0){x(null);return}const T=requestAnimationFrame(()=>F());return()=>cancelAnimationFrame(T)},[D,W.length,y,e,F]),m.useEffect(()=>{if(!D||W.length===0)return;const T=()=>F();return window.addEventListener("scroll",T,!0),window.addEventListener("resize",T),()=>{window.removeEventListener("scroll",T,!0),window.removeEventListener("resize",T)}},[D,W.length,F]);const R=m.useCallback(T=>{if(!D)return;const{atIndex:O}=D,I=e.slice(0,O)+"${"+T+"}"+e.slice(y);t(I);const H=O+T.length+3;queueMicrotask(()=>{const _=d.current;_&&(_.focus(),_.setSelectionRange(H,H)),w(H)})},[D,e,y,t]),$=m.useCallback(()=>{const T=d.current,O=h.current;!T||!O||(O.scrollTop=T.scrollTop,O.scrollLeft=T.scrollLeft,D&&W.length>0&&queueMicrotask(()=>F()))},[D,W.length,F]),P=m.useCallback(T=>{if(!n&&D&&W.length>0&&(T.key==="ArrowDown"||T.key==="ArrowUp"||T.key==="Enter")){if(T.key==="ArrowDown")T.preventDefault(),g(O=>(O+1)%W.length);else if(T.key==="ArrowUp")T.preventDefault(),g(O=>(O-1+W.length)%W.length);else if(T.key==="Enter"&&!T.shiftKey){T.preventDefault();const O=W[k];O&&R(O.insert)}}},[n,D,W,k,R]),L=m.useCallback(async T=>{if(n||typeof u!="function")return!1;const O=await gP({files:T,body:e,images:S});return O?(t(O.body),u(O.images),queueMicrotask(()=>{const I=d.current;if(!I)return;I.focus();const H=O.body.length;I.setSelectionRange(H,H),w(H)}),!0):!1},[n,S,t,u,e]);return a.jsxs("div",{className:"af-body-prompt-editor"+(l==="expand"?" af-body-prompt-editor--expand":""),children:[S.length>0?a.jsx("div",{className:"af-body-image-list","aria-label":"image attachments",children:S.map((T,O)=>a.jsxs("span",{className:"af-body-image-chip",title:T.name,children:[a.jsx("img",{src:T.dataUrl,alt:""}),a.jsxs("span",{children:["[",T.label||`image ${O+1}`,"]"]})]},T.id||O))}):null,a.jsxs("div",{className:"af-body-prompt-stack",children:[a.jsx("pre",{ref:h,className:"af-body-prompt-backdrop "+i,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:A+`
101
- `}}),a.jsx("textarea",{ref:d,className:"af-body-prompt-textarea "+i,rows:s,value:e,disabled:n,placeholder:r,spellCheck:!1,"aria-invalid":j,"aria-describedby":j?f:void 0,onChange:T=>{t(T.target.value),w(T.target.selectionStart??T.target.value.length)},onSelect:T=>{const O=T.target;O instanceof HTMLTextAreaElement&&w(O.selectionStart??0)},onClick:T=>{const O=T.target;O instanceof HTMLTextAreaElement&&w(O.selectionStart??0)},onKeyUp:T=>{const O=T.target;O instanceof HTMLTextAreaElement&&w(O.selectionStart??O.value.length)},onKeyDown:P,onPaste:T=>{const O=mP(T);O.length!==0&&(T.preventDefault(),L(O).catch(()=>{}))},onDragOver:T=>{Hc(T).length>0&&T.preventDefault()},onDrop:T=>{const O=Hc(T);O.length!==0&&(T.preventDefault(),L(O).catch(()=>{}))},onScroll:$})]}),D&&W.length>0&&b?ar.createPortal(a.jsx("ul",{className:"af-body-ph-menu af-body-ph-menu--pop af-composer-mention-menu",role:"listbox","aria-label":p("flow:nodeProps.placeholderSlots"),style:{position:"fixed",top:b.top,left:b.left,right:"auto",bottom:"auto",margin:0,zIndex:2e4},children:W.map((T,O)=>a.jsx("li",{role:"option","aria-selected":O===k,children:a.jsxs("button",{type:"button",className:"af-composer-mention-item"+(O===k?" af-composer-mention-item--active":""),onMouseDown:I=>I.preventDefault(),onMouseEnter:()=>g(O),onClick:()=>R(T.insert),children:[a.jsx("span",{className:"af-composer-mention-id",children:`\${${T.insert}}`}),T.subtitle?a.jsx("span",{className:"af-composer-mention-sub",children:T.subtitle}):null]})},`${T.section}-${T.insert}`))}),document.body):null,j?a.jsx("p",{id:f,className:"af-body-ph-issues",role:"status",children:C.map(T=>T.message).join(" · ")}):null]})}const T9=/^[a-zA-Z_][a-zA-Z0-9_-]*$/;function Yd(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function DS({kind:e,label:t,slots:n,onSlotsChange:r,disabled:s,requiredReadonly:i=!0}){const{t:o}=dr(),l=()=>r([...n,{type:"text",name:"",default:"",required:!1,showOnNode:!1}]),c=f=>r(n.filter((d,h)=>h!==f)),u=(f,d,h)=>{const y=n.map((w,k)=>{if(k!==f)return w;const g={...w,[d]:h};return d==="required"&&h===!0&&(g.showOnNode=!0),g});r(y)},p=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:s,"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:p})}),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.description")}),a.jsx("span",{children:o("flow:nodeProps.required")}),a.jsx("span",{children:o("flow:nodeProps.showOnNode")}),a.jsx("span",{})]}),n.map((f,d)=>a.jsxs("div",{className:"af-node-props-io-row",children:[a.jsxs("span",{className:"af-node-props-io-handle",title:`${p}-${d}`,children:[p,"-",d]}),a.jsx("select",{className:"af-node-props-input af-node-props-io-cell",value:f.type,onChange:h=>u(d,"type",h.target.value),disabled:s,"aria-label":o("flow:nodeProps.pinTypeAriaLabel",{label:t,index:d}),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=>u(d,"name",h.target.value),disabled:s,spellCheck:!1,autoComplete:"off","aria-label":o("flow:nodeProps.pinNameAriaLabel",{label:t,index:d})}),a.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:f.default,onChange:h=>u(d,"default",h.target.value),disabled:s,spellCheck:!1,autoComplete:"off","aria-label":o("flow:nodeProps.pinDefaultAriaLabel",{label:t,index:d})}),a.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:f.description||"",onChange:h=>u(d,"description",h.target.value),disabled:s,spellCheck:!1,autoComplete:"off","aria-label":o("flow:nodeProps.pinDescriptionAriaLabel",{label:t,index:d})}),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=>{i||u(d,"required",h.target.checked)},disabled:s||i,"aria-label":o("flow:nodeProps.pinRequiredAriaLabel",{label:t,index:d})})}),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=>u(d,"showOnNode",h.target.checked),disabled:s,"aria-label":o("flow:nodeProps.pinShowOnNodeAriaLabel",{label:t,index:d})})}),a.jsx("button",{type:"button",className:"af-icon-btn af-node-props-io-remove",onClick:()=>c(d),disabled:s,"aria-label":o("flow:nodeProps.deletePinAriaLabel",{label:t,index:d}),title:o("flow:nodeProps.deletePin"),children:a.jsx("span",{className:"material-symbols-outlined",children:"delete"})})]},`${p}-${d}`))]}):null]})}function R9({draft:e,setDraft:t,definitionId:n,systemPromptReadonly:r,modelLists:s,disabled:i,onIdBlur:o,onClose:l,onPublishToMarketplace:c,allowEditRequiredPins:u=!1,error:p,ioSlots:f}){const{t:d}=dr(),[h,y]=m.useState(!1),[w,k]=m.useState(!1),[g,b]=m.useState({status:"idle",message:""}),x=m.useCallback(R=>{t($=>$&&{...$,...R})},[t]),{cursorList:S,opencodeList:C,claudeCodeList:j,currentNotInLists:E}=m.useMemo(()=>{const R=Array.isArray(s==null?void 0:s.cursor)?s.cursor:[],$=Array.isArray(s==null?void 0:s.opencode)?s.opencode:[],P=Array.isArray(s==null?void 0:s.claudeCode)?s.claudeCode:[],L=new Set([...R,...$,...P].map(Yd)),T=((e==null?void 0:e.model)??"").trim(),O=T.startsWith("cursor:")?T.slice(7):T.startsWith("opencode:")?T.slice(9):T.startsWith("claude-code:")?T.slice(12):T,I=T&&!L.has(O)?T:"";return{cursorList:R,opencodeList:$,claudeCodeList:P,currentNotInLists:I}},[s,e==null?void 0:e.model]);if(!e)return null;const A=String(e.script??""),D=n==="tool_nodejs"||A.trim()!=="",W=typeof c=="function"&&!i&&(e==null?void 0:e.newId),F=async()=>{if(W){b({status:"running",message:d("flow:nodeProps.publishRunning")});try{const R=await c(e,n);b({status:"success",message:R!=null&&R.definitionId?d("flow:nodeProps.publishSuccessWithId",{id:R.definitionId}):d("flow:nodeProps.publishSuccess")})}catch(R){b({status:"error",message:String((R==null?void 0:R.message)||R)})}}};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:d("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:F,disabled:!W||g.status==="running",title:d("flow:nodeProps.publishToMarketplaceHint"),children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"inventory_2"}),g.status==="running"?d("flow:nodeProps.publishing"):d("flow:nodeProps.publishToMarketplace")]}),a.jsx("button",{type:"button",className:"af-btn-ghost af-node-props-close-secondary",onClick:l,children:d("common:common.close")})]})]}),a.jsxs("div",{className:"af-pipeline-drawer-body af-node-props-body",children:[p?a.jsx("p",{className:"af-err af-node-props-err",children:p}):null,g.message?a.jsx("p",{className:`af-node-props-market-status af-node-props-market-status--${g.status}`,children:g.message}):null,a.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[a.jsx("span",{className:"af-node-props-label",children:d("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:[d("flow:nodeProps.instanceId"),a.jsx("span",{className:"af-node-props-hint",children:d("flow:node.displayNameHint")})]}),a.jsx("input",{type:"text",className:"af-node-props-input",value:e.newId,onChange:R=>x({newId:R.target.value}),onBlur:o,disabled:i,spellCheck:!1,autoComplete:"off","aria-label":d("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:[d("flow:node.displayName"),"(LABEL)"]}),a.jsx("input",{type:"text",className:"af-node-props-input",value:e.label,onChange:R=>x({label:R.target.value}),disabled:i,spellCheck:!1})]}),a.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[a.jsxs("span",{className:"af-node-props-label",children:[d("flow:node.role"),"(ROLE)"]}),a.jsx("select",{className:"af-node-props-select",value:wu.includes(e.role)?e.role:d("flow:roles.normal"),onChange:R=>x({role:R.target.value}),disabled:i,children:wu.map(R=>a.jsx("option",{value:R,children:R},R))})]}),a.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[a.jsxs("span",{className:"af-node-props-label",children:[d("flow:node.model"),"(MODEL)"]}),a.jsx("span",{className:"af-node-props-sublabel",children:d("flow:node.modelHint")}),a.jsxs("select",{className:"af-node-props-select",value:(()=>{const R=(e.model||"").trim();return R?E||R:""})(),onChange:R=>x({model:R.target.value}),disabled:i,"aria-label":d("flow:nodeProps.modelAriaLabel"),children:[a.jsx("option",{value:"",children:d("flow:node.defaultModel")}),E?a.jsxs("option",{value:E,children:[E,d("flow:nodeProps.yamlValueNotInList")]}):null,S.length>0?a.jsx("optgroup",{label:"Cursor",children:S.map(R=>a.jsx("option",{value:Yd(R),children:R},`c-${R}`))}):null,C.length>0?a.jsx("optgroup",{label:"OpenCode",children:C.map(R=>a.jsx("option",{value:Yd(R),children:R},`o-${R}`))}):null,j.length>0?a.jsx("optgroup",{label:"Claude Code",children:j.map(R=>a.jsx("option",{value:`claude-code:${Yd(R)}`,children:R},`cc-${R}`))}):null]})]}),a.jsx(DS,{kind:"input",label:d("flow:nodeProps.inputPins"),slots:Array.isArray(e.inputs)?e.inputs:[],onSlotsChange:R=>x({inputs:R}),disabled:i,requiredReadonly:!u}),a.jsx(DS,{kind:"output",label:d("flow:nodeProps.outputPins"),slots:Array.isArray(e.outputs)?e.outputs:[],onSlotsChange:R=>x({outputs:R}),disabled:i,requiredReadonly:!u}),D?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:[d("flow:node.directCommand"),"(script)",a.jsx("span",{className:"af-node-props-hint",children:d("flow:node.scriptHint")})]}),a.jsx("button",{type:"button",className:"af-icon-btn af-node-props-expand",onClick:()=>k(!0),"aria-label":d("flow:nodeProps.expandEditScript"),title:d("flow:nodeProps.expand"),disabled:i,children:a.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),a.jsx(qd,{value:A,onChange:R=>x({script:R}),disabled:i,placeholder:d("flow:nodeProps.scriptPlaceholder"),rows:6,textareaClassName:"af-pipeline-drawer-textarea af-node-props-body-textarea af-node-props-script-textarea",ioSlots:f,variant:"drawer"})]}):null,a.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[a.jsx("span",{className:"af-node-props-label",children:"Script file(scriptRef)"}),a.jsxs("span",{className:"af-node-props-sublabel",children:["Relative path under this flow, for example nodes/",e.id,"/script.mjs"]}),a.jsx("input",{type:"text",className:"af-node-props-input",value:e.scriptRef||"",onChange:R=>x({scriptRef:R.target.value}),disabled:i,spellCheck:!1,autoComplete:"off"})]}),a.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[a.jsx("span",{className:"af-node-props-label",children:"Implementation file(implementationRef)"}),a.jsxs("span",{className:"af-node-props-sublabel",children:["Relative path under this flow, for example nodes/",e.id,"/implementation.md"]}),a.jsx("input",{type:"text",className:"af-node-props-input",value:e.implementationRef||"",onChange:R=>x({implementationRef:R.target.value}),disabled:i,spellCheck:!1,autoComplete:"off"})]}),a.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[a.jsx("span",{className:"af-node-props-label",children:"Implementation mode"}),a.jsxs("select",{className:"af-node-props-select",value:e.implementationMode||"",onChange:R=>x({implementationMode:R.target.value}),disabled:i,children:[a.jsx("option",{value:"",children:"auto"}),a.jsx("option",{value:"script",children:"script"}),a.jsx("option",{value:"steps",children:"steps"}),a.jsx("option",{value:"hybrid",children:"hybrid"})]})]}),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:d("flow:node.userPrompt")}),a.jsx("button",{type:"button",className:"af-icon-btn af-node-props-expand",onClick:()=>y(!0),"aria-label":d("flow:nodeProps.expandEdit"),title:d("flow:nodeProps.expand"),disabled:i,children:a.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),a.jsx(qd,{value:e.body,onChange:R=>x({body:R}),images:e.images,onImagesChange:R=>x({images:R}),disabled:i,placeholder:d("flow:nodeProps.bodyPlaceholder"),rows:8,textareaClassName:"af-pipeline-drawer-textarea af-node-props-body-textarea",ioSlots:f,variant:"drawer"})]}),a.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[a.jsx("span",{className:"af-node-props-label",children:d("flow:node.systemDescription")}),a.jsx("textarea",{className:"af-pipeline-drawer-textarea af-node-props-system-readonly",rows:4,readOnly:!0,value:r||d("flow:nodeProps.noDescription"),spellCheck:!1})]})]}),w?a.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":d("flow:nodeProps.editScript"),onMouseDown:R=>{R.target===R.currentTarget&&k(!1)},children: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:d("flow:node.directCommand")}),a.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>k(!1),"aria-label":d("flow:nodeProps.collapse"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsx(qd,{value:A,onChange:R=>x({script:R}),disabled:i,placeholder:d("flow:nodeProps.scriptPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:f,variant:"expand"})]})}):null,h?a.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":d("flow:nodeProps.editUserPrompt"),onMouseDown:R=>{R.target===R.currentTarget&&y(!1)},children: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:d("flow:node.body")}),a.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>y(!1),"aria-label":d("flow:nodeProps.collapse"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsx(qd,{value:e.body,onChange:R=>x({body:R}),images:e.images,onImagesChange:R=>x({images:R}),disabled:i,placeholder:d("flow:nodeProps.bodyPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:f,variant:"expand"})]})}):null]})}function M9({open:e,onClose:t,flowId:n,flowSource:r,onArchived:s}){const{t:i}=dr(),o=m.useId(),l=m.useRef(null),[c,u]=m.useState(""),[p,f]=m.useState(!1),[d,h]=m.useState("");if(m.useEffect(()=>{if(!e)return;u(""),h(""),f(!1);const g=requestAnimationFrame(()=>{var b;return(b=l.current)==null?void 0:b.focus()});return()=>cancelAnimationFrame(g)},[e,n]),!e)return null;const y=c.trim(),w=y===n;async function k(g){if(g.preventDefault(),!(!w||p)){f(!0),h("");try{const b=await fetch("/api/flow/archive",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:n,flowSource:r,confirmFlowId:y})}),x=await b.json().catch(()=>({}));if(!b.ok){h(typeof x.error=="string"?x.error:i("project:archiveModal.archiveFailed"));return}s()}catch(b){h(String((b==null?void 0:b.message)||b))}finally{f(!1)}}}return a.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:g=>{g.target===g.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:g=>g.stopPropagation(),children:[a.jsxs("div",{className:"af-shortcuts-panel__head",children:[a.jsx("h2",{id:o,className:"af-shortcuts-panel__title",children:i("project:archiveModal.title")}),a.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":i("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:k,children:[a.jsx("p",{className:"af-new-pipeline-lead",children:i("project:archiveModal.lead",{flowId:n})}),a.jsxs("label",{className:"af-new-pipeline-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:i("project:archiveModal.confirmLabel")}),a.jsx("input",{type:"text",className:"af-new-pipeline-input",value:c,onChange:g=>u(g.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":y.length>0&&!w})]}),d?a.jsx("p",{className:"af-err af-new-pipeline-err",children:d}):null,a.jsxs("div",{className:"af-new-pipeline-actions",children:[a.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:p,children:i("project:archiveModal.cancel")}),a.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!w||p,children:i(p?"project:archiveModal.archiving":"project:archiveModal.confirmArchive")})]})]})]})})}function L9({open:e,onClose:t,flowId:n,flowSource:r,flowArchived:s=!1,onDeleted:i}){const{t:o}=dr(),l=m.useId(),c=m.useRef(null),[u,p]=m.useState(""),[f,d]=m.useState(!1),[h,y]=m.useState("");if(m.useEffect(()=>{if(!e)return;p(""),y(""),d(!1);const b=requestAnimationFrame(()=>{var x;return(x=c.current)==null?void 0:x.focus()});return()=>cancelAnimationFrame(b)},[e,n]),!e)return null;const w=u.trim(),k=w===n;async function g(b){if(b.preventDefault(),!k||f)return;d(!0),y("");let x=null;try{const S=new AbortController;x=setTimeout(()=>S.abort(),15e3);const C=await fetch("/api/flow/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:n,flowSource:r,confirmFlowId:w,flowArchived:s}),signal:S.signal}),j=await C.json().catch(()=>({}));if(!C.ok){y(typeof j.error=="string"?j.error:o("project:deleteModal.deleteFailed"));return}try{for(let E=localStorage.length-1;E>=0;E--){const A=localStorage.key(E);A&&(A.startsWith(`af:composer-sessions:${n}:${r}`)||A.startsWith(`af:composer-active-session:${n}:${r}`)||A.startsWith(`af:workspace-composer:${n}:${r}`))&&localStorage.removeItem(A)}}catch{}await i()}catch(S){if((S==null?void 0:S.name)==="AbortError"){y(o("project:deleteModal.deleteTimeout"));return}y(String((S==null?void 0:S.message)||S))}finally{x&&clearTimeout(x),d(!1)}}return a.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:b=>{b.target===b.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:b=>b.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:g,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:u,onChange:b=>p(b.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":w.length>0&&!k})]}),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:!k||f,children:o(f?"project:deleteModal.deleting":"project:deleteModal.confirmDelete")})]})]})]})})}const FS=80,$9=220;function O9(e){if(!e||typeof e!="object")return e;const{selected:t,dragging:n,resizing:r,className:s,positionAbsolute:i,measured:o,internals:l,...c}=e;return c}function D9(e){if(!e||typeof e!="object")return e;const{selected:t,className:n,...r}=e;return r}function Gd(e,t,n){const r={nodes:Array.isArray(e)?e.map(O9):[],edges:Array.isArray(t)?t.map(D9):[],extra:n&&typeof n=="object"?n:{}},s=JSON.stringify(r);return{value:JSON.parse(s),signature:s}}function Hm(e,t){const n=[...e,t];return n.length>FS?n.slice(n.length-FS):n}function F9({nodes:e,edges:t,extra:n,enabled:r=!0,onRestore:s}){const[i,o]=m.useState(0),l=m.useRef([]),c=m.useRef([]),u=m.useRef(null),p=m.useRef(null),f=m.useRef(null),d=m.useRef(null),h=m.useRef(!1),y=m.useCallback(()=>o(C=>C+1),[]),w=m.useCallback(()=>{d.current&&(window.clearTimeout(d.current),d.current=null)},[]),k=m.useCallback(()=>{w();const C=p.current,j=f.current;return p.current=null,f.current=null,!C||!j||C.signature===j.signature?(j&&(u.current=j),!1):(l.current=Hm(l.current,C),c.current=[],u.current=j,y(),!0)},[y,w]),g=m.useCallback((C=[],j=[],E={})=>{w(),l.current=[],c.current=[],p.current=null,f.current=null,u.current=Gd(C,j,E),h.current=!1,y()},[y,w]),b=m.useCallback(C=>{h.current=!0,u.current=C,p.current=null,f.current=null,w(),s==null||s(C.value),y()},[y,w,s]),x=m.useCallback(()=>{k();const C=u.current||Gd(e,t,n),j=l.current.pop();return j?(c.current=Hm(c.current,C),b(j),!0):(y(),!1)},[y,t,n,k,e,b]),S=m.useCallback(()=>{k();const C=u.current||Gd(e,t,n),j=c.current.pop();return j?(l.current=Hm(l.current,C),b(j),!0):(y(),!1)},[y,t,n,k,e,b]);return m.useEffect(()=>()=>w(),[w]),m.useEffect(()=>{if(!r)return;const C=Gd(e,t,n);if(!u.current){u.current=C;return}if(h.current){h.current=!1,u.current=C;return}C.signature!==u.current.signature&&(p.current||(p.current=u.current),f.current=C,w(),d.current=window.setTimeout(()=>{k()},$9))},[w,t,r,n,k,e]),{canUndo:l.current.length>0||!!p.current,canRedo:c.current.length>0,resetHistory:g,undo:x,redo:S,version:i}}const z9="af:workspace-graph:v2",zS="agentflow.workspace.sidebarCollapsed",Ca=["DISPLAY","CONTROL","TOOL","PROVIDE","AGENT"],H9=new Set(["control_start","control_end","control_load_skills","control_load_mcp"]),B9={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:""}]},W9={id:"workspace_scheduled_run",displayName:"Scheduled Run",label:"Scheduled Run",description:"Run the downstream workspace subgraph on a schedule.",type:"control",inputs:[{type:"node",name:"prev",default:""}],outputs:[{type:"node",name:"next",default:""}]},V9={id:"control_load_skills",displayName:"Load Skills",label:"Load Skills",description:"Load the currently selected Workspace skill collection for downstream agent nodes.",type:"control",inputs:[{type:"node",name:"prev",default:""},{type:"text",name:"skillKeys",default:"",showOnNode:!1}],outputs:[{type:"node",name:"next",default:""},{type:"text",name:"skillsContext",default:"",showOnNode:!0}]},K9={id:"control_load_mcp",displayName:"Load MCP",label:"Load MCP",description:"Load selected Cursor MCP server tool manifests for downstream agent nodes.",type:"control",inputs:[{type:"node",name:"prev",default:""},{type:"text",name:"serverNames",default:"",showOnNode:!1}],outputs:[{type:"node",name:"next",default:""},{type:"text",name:"mcpContext",default:"",showOnNode:!0}]},U9=new Set(["png","jpg","jpeg","gif","webp","svg"]),kP=320,SP=180,NP=960,xp=96,jP=900,Xd=52,Go=240,Xo=160,Oy="display-ref:",ku="0 9 * * *",q9="Asia/Shanghai",Y9="0.1.85";function G9(){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 Os(e){const t=new URLSearchParams;return e.flowId&&t.set("flowId",e.flowId),e.flowSource&&t.set("flowSource",e.flowSource),e.archived&&t.set("archived","1"),t}function wp(e){if(!e)return!1;const t=String(e.type||"");if(t&&/^image\//i.test(t))return!0;const n=String(e.name||"").toLowerCase().split(".").pop();return U9.has(n)}function bp(e,t,n={}){const r=String(e||"").trim();if(!r)return"";if(/^(?:https?:|data:|blob:|file:)/i.test(r)||r.startsWith("/"))return r;const s=Os(t||{});return s.set("path",r),n.download&&s.set("download","1"),`/api/workspace/file/raw?${s.toString()}`}function X9(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 J9(e){const t=String((e==null?void 0:e.username)||(e==null?void 0:e.userId)||"").trim();return t?`${zS}:${t}`:zS}function Q9(e){try{const t=window.localStorage.getItem(e);if(t==="false")return!1;if(t==="true")return!0}catch{}return!0}function HS(e){return!e||typeof e.closest!="function"?!1:!!e.closest("input, textarea, select, [contenteditable='true']")}function Z9(e){var t;if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)return Number(e.selectionStart??0)!==Number(e.selectionEnd??0);if(e instanceof Element&&e.closest('[contenteditable="true"]')){const n=(t=window.getSelection)==null?void 0:t.call(window);return!!(n&&!n.isCollapsed)}return!1}function eV(e){return!e||typeof e.closest!="function"?!1:!!e.closest(".af-flow-node__prompt-stack")&&!Z9(e)}function tV(e){const t=String(e||"").trim();if(!t)return"";if(/^运行完成/.test(t))return"运行完成";if(/^运行暂停/.test(t))return"运行暂停";if(/^运行停止/.test(t))return"运行停止";if(/^思考中/.test(t))return"模型正在思考";if(/^生成回复中/.test(t))return"模型正在生成回复";if(/^Timing\s+(.+?):\s+(\d+)ms/i.test(t)){const n=t.match(/^Timing\s+(.+?):\s+(\d+)ms/i);return`耗时:${(n==null?void 0:n[1])||"step"} ${(n==null?void 0:n[2])||"0"}ms`}if(/^工具\s+(.+?)(?:\s+\((started|completed)\))?$/i.test(t)){const n=t.match(/^工具\s+(.+?)(?:\s+\((started|completed)\))?$/i),r=String((n==null?void 0:n[1])||"tool").trim(),s=String((n==null?void 0:n[2])||"").toLowerCase();if(r==="thinking")return"模型正在思考";const i=r==="readToolCall"?"读取文件/上下文":r==="grepToolCall"?"搜索代码":r==="editToolCall"?"编辑文件":r;return s==="completed"?`完成:${i}`:`执行:${i}`}return/^\[stderr\]/.test(t)?t:""}function nV(e){const t=String(e||"").trim();return t?/^模型/.test(t)?"model":/^(执行|完成|耗时):/.test(t)?"tool":/^运行/.test(t)?"run":/^\[stderr\]/.test(t)?"error":"other":"other"}function Co(e){const t=Math.max(0,Number(e)||0);if(t<1e3)return`${t}ms`;if(t<6e4)return`${(t/1e3).toFixed(t<1e4?1:0)}s`;const n=Math.floor(t/6e4),r=Math.round(t%6e4/1e3);return`${n}m${r?`${r}s`:""}`}function rV(e,t){const n=typeof e=="string"?e:String((e==null?void 0:e.text)||""),r=typeof e=="object"?Number(e==null?void 0:e.stepMs):NaN,s=typeof e=="object"?Number(e==null?void 0:e.totalMs):NaN,i=Number.isFinite(r)&&Number.isFinite(s)?`(+${Co(r)} / 总 ${Co(s)})`:"";return`${t+1}. ${n}${i}`}function CP(e){if(String((e==null?void 0:e.type)||"")!=="raw")return null;const t=String((e==null?void 0:e.text)||"").trim();if(!t)return null;try{return JSON.parse(t)}catch{return null}}function Ea(...e){for(const t of e){const n=Number(t);if(Number.isFinite(n))return n}return NaN}function sV(e){const t=e!=null&&e.tool_call&&typeof e.tool_call=="object"?e.tool_call:{},n=Object.keys(t).find(r=>/ToolCall$/i.test(r))||"";return n||String((e==null?void 0:e.name)||(e==null?void 0:e.tool)||"tool_call")}function iV(e){const t=e!=null&&e.tool_call&&typeof e.tool_call=="object"?e.tool_call:{},n=Object.keys(t).find(r=>/ToolCall$/i.test(r))||"";return n&&t[n]&&typeof t[n]=="object"?t[n]:{}}function oV(e,t){var s;const n=String(((s=t==null?void 0:t.args)==null?void 0:s.command)||"");return/ck_fetch\.py/.test(n)?"CK 查询":/collect_important_mails\.py|list_mails_by_date\.py|read_mail_content\.py/.test(n)?"邮件脚本":/npm\s+run\s+build|build:web-ui/.test(n)?"前端构建":/python3/.test(n)?"Python 脚本":{shellToolCall:"Shell 命令",readToolCall:"读取文件/上下文",grepToolCall:"搜索代码",globToolCall:"查找文件",editToolCall:"编辑文件",writeToolCall:"写入文件"}[e]||e||"工具调用"}function aV(e){var i,o,l;const t=CP(e);if(!t||typeof t!="object")return null;const n=String(t.type||""),r=String(t.subtype||""),s=Ea(t.timestamp_ms,t.completedAtMs,t.startedAtMs,e==null?void 0:e.ts,Date.now());if(n==="tool_call"&&r==="completed"){const c=iV(t),u=sV(t),p=Ea(t.startedAtMs,c==null?void 0:c.startedAtMs),f=Ea(t.completedAtMs,c==null?void 0:c.completedAtMs),d=((i=c==null?void 0:c.result)==null?void 0:i.success)||((o=c==null?void 0:c.result)==null?void 0:o.failure)||{},h=Number.isFinite(p)&&Number.isFinite(f)?Math.max(0,f-p):Ea(d.executionTime,d.localExecutionTimeMs),y=String(((l=c==null?void 0:c.args)==null?void 0:l.command)||d.command||"").trim(),w=y?y.split(`
102
- `).find(Boolean)||y:"";return{kind:"tool",label:oV(u,c),durationMs:Number.isFinite(h)?h:null,at:s,detail:w?w.slice(0,90):""}}if(n==="result"){const c=Ea(t.duration_ms,t.duration_api_ms);return{kind:"total",label:"运行总耗时",durationMs:Number.isFinite(c)?c:null,at:s,detail:t.is_error?"失败结束":"成功结束"}}return n==="connection"?{kind:"network",label:r==="reconnecting"?"连接重连":r==="reconnected"?"连接恢复":"连接事件",durationMs:null,at:s,detail:""}:n==="retry"?{kind:"network",label:r==="resuming"?"会话恢复":r==="starting"?"开始重试":"重试事件",durationMs:null,at:s,detail:""}:null}function BS(e,t,n,r){const s=(Array.isArray(e)?e:[]).map(k=>typeof k=="string"?{text:k}:k).filter(k=>k&&String(k.text||"").trim()),i=Array.isArray(t)?t:[],o=[...i].reverse().find(k=>(k==null?void 0:k.kind)==="total"&&Number.isFinite(Number(k.durationMs))),l=[...s].reverse().find(k=>Number.isFinite(Number(k.totalMs))),c=Number.isFinite(Number(r))&&Number.isFinite(Number(n))?Math.max(0,Number(r)-Number(n)):NaN,u=Ea(o==null?void 0:o.durationMs,l==null?void 0:l.totalMs,c),p=s.filter(k=>k.kind==="model").reduce((k,g)=>k+(Number(g.stepMs)||0),0),f=i.filter(k=>(k==null?void 0:k.kind)==="tool"),d=f.reduce((k,g)=>k+(Number(g.durationMs)||0),0),h=i.filter(k=>(k==null?void 0:k.kind)==="network").length,y=[...s.filter(k=>Number(k.stepMs)>=1e3).map(k=>({label:k.text,durationMs:Number(k.stepMs),detail:"Activity 间隔"})),...f.filter(k=>Number(k.durationMs)>=1e3).map(k=>({label:k.label,durationMs:Number(k.durationMs),detail:k.detail||"工具实际执行"}))].sort((k,g)=>g.durationMs-k.durationMs).slice(0,6),w=["耗时概览"];return Number.isFinite(u)&&w.push(`- 当前总耗时:${Co(u)}`),p>0&&w.push(`- 模型相关间隔:约 ${Co(p)}(按 Activity 间隔估算)`),f.length>0&&w.push(`- 工具实际执行:${Co(d)}(${f.length} 次完成事件)`),h>0&&w.push(`- 网络/会话恢复事件:${h} 次`),y.length>0&&(w.push(""),w.push("慢步骤"),y.forEach((k,g)=>{const b=k.detail?` · ${k.detail}`:"";w.push(`${g+1}. ${k.label}:${Co(k.durationMs)}${b}`)})),s.length>0&&(w.push(""),w.push("最近 Activity"),s.slice(-10).forEach((k,g)=>{w.push(rV(k,g))})),f.length>0&&(w.push(""),w.push("最近工具完成"),f.slice(-8).forEach((k,g)=>{const b=Number.isFinite(Number(k.durationMs))?` ${Co(k.durationMs)}`:"",x=k.detail?` · ${k.detail}`:"";w.push(`${g+1}. ${k.label}${b}${x}`)})),w.join(`
103
- `)}function WS(e){if(String((e==null?void 0:e.type)||"")!=="raw"||String((e==null?void 0:e.eventType)||"")!=="thinking")return"";const t=CP(e);if((t==null?void 0:t.type)!=="thinking")return"";const n=String((t==null?void 0:t.subtype)||"");return n&&n!=="delta"?"":String((t==null?void 0:t.text)||(t==null?void 0:t.delta)||(t==null?void 0:t.thinking)||"").trim()}function EP(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 _P(e){const t=String((e==null?void 0:e.marketplaceDefinitionId)||(e==null?void 0:e.id)||"").trim();return t.startsWith("marketplace:")?t:""}function Rw(e){if(!e)return"";const t=String(e.baseDefinitionId||"").trim();return t||String(e.id||"").trim()}function PP(e){const t=String(e??"");return/^[A-Za-z0-9_@%+=:,./-]+$/.test(t)?t:"'"+t.replace(/'/g,"'\\''")+"'"}function lV(e,t){const n=String((e==null?void 0:e.language)||"").trim().toLowerCase(),r=String(t||"").trim().toLowerCase();return n.includes("python")||r.endsWith(".py")?"python3":n.includes("shell")||n==="bash"||r.endsWith(".sh")||r.endsWith(".bash")?"bash":"node"}function cV(e){const t=String(e??"").trim();return t?t.includes("${")?t:PP(t):""}function AP(e){if(String((e==null?void 0:e.baseDefinitionId)||"").trim()!=="tool_nodejs")return"";const t=e!=null&&e.runtime&&typeof e.runtime=="object"?e.runtime:{},n=String(t.entry||"").trim().replace(/^\/+/,"");if(n){const s=String((e==null?void 0:e.packageDir)||"").trim().replace(/\/+$/,""),i=s?`${s}/${n}`:`\${flowDir}/${n}`,o=Array.isArray(t.args)?t.args.map(cV).filter(Boolean):[];return[lV(t,n),PP(i),...o].join(" ")}return String(t.command||"").trim()}function kc(e){const t=String(Rw(e)||(e==null?void 0:e.id)||"");return t==="workspace_run"||t==="workspace_scheduled_run"?"CONTROL":t.startsWith("display_")?"DISPLAY":/^control/i.test(t)?"CONTROL":/^tool/i.test(t)?"TOOL":/^provide/i.test(t)?"PROVIDE":"AGENT"}function VS(e){return e==="DISPLAY"?"preview":e==="CONTROL"?"account_tree":e==="TOOL"?"build":e==="PROVIDE"?"database":"smart_toy"}function vp(e){return String((e==null?void 0:e.displayName)||(e==null?void 0:e.label)||(e==null?void 0:e.id)||"Node")}function Sc(e){return vp(e)}function Dy(e){return String((e==null?void 0:e.description)||(e==null?void 0:e.body)||"").replace(/\s+/g," ").trim()}function Jd(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 KS(e,t,n){const r=String((t==null?void 0:t.name)||(t==null?void 0:t.id)||`#${n+1}`).trim(),s=String((t==null?void 0:t.type)||"").trim(),i=String((t==null?void 0:t.default)??(t==null?void 0:t.value)??"").trim();return[e,r,s?`type: ${s}`:"",i?`default: ${i}`:""].filter(Boolean).join(" · ")}function US(e,t){const n=Array.isArray(e)?e:[],r=n.slice(0,4),s=Math.max(0,n.length-r.length);return{list:n,shown:r,hidden:s,kind:t}}function Bm(e,t){const n=String((e==null?void 0:e.source)||""),r=String((e==null?void 0:e.target)||"");if(!n||!r)return!1;const s=new Map(t.map(l=>[l.id,l])),i=Ly(s.get(n),e.sourceHandle||"output-0","source"),o=Ly(s.get(r),e.targetHandle||"input-0","target");return!!(i&&o&&bu(i,o))}function uV(e,t){const n=String((e==null?void 0:e.nodeId)||""),r=String((e==null?void 0:e.handleId)||""),s=(e==null?void 0:e.handleType)==="target"?"target":(e==null?void 0:e.handleType)==="source"?"source":"";if(!n||!r||!s)return null;const i=t.find(l=>l.id===n),o=Ly(i,r,s);return o?{nodeId:n,handleId:r,handleType:s,slot:o,slotType:BW(o)}:null}function dV(e,t){return t?e.map((n,r)=>{const s=Array.isArray(t.handleType==="source"?n.inputs:n.outputs)?t.handleType==="source"?n.inputs:n.outputs:[];for(let i=0;i<s.length;i+=1){const o=s[i];if(!(t.handleType==="source"?bu(t.slot,o):bu(o,t.slot)))continue;const c=kc(n);return{def:n,order:r,category:c,categoryRank:Ca.indexOf(c),slot:o,slotIndex:i,displayLabel:Sc(n),description:Dy(n)}}return null}).filter(Boolean).sort((n,r)=>{var o,l;const s=(o=n.slot)!=null&&o.required?0:1,i=(l=r.slot)!=null&&l.required?0:1;return s-i||n.slotIndex-r.slotIndex||n.categoryRank-r.categoryRank||n.order-r.order}):[]}function fV(e,t,n){var i,o,l,c;if(!n)return[];const r=[],s=n.handleType==="source";for(const u of e||[]){if(!u||u.id===n.nodeId)continue;const p=Array.isArray(s?(i=u.data)==null?void 0:i.inputs:(o=u.data)==null?void 0:o.outputs)?s?u.data.inputs:u.data.outputs:[];for(let f=0;f<p.length;f+=1){const d=p[f];if((d==null?void 0:d.showOnNode)===!1||!(s?bu(n.slot,d):bu(d,n.slot)))continue;const y=s?{source:n.nodeId,sourceHandle:n.handleId,target:u.id,targetHandle:`input-${f}`}:{source:u.id,sourceHandle:`output-${f}`,target:n.nodeId,targetHandle:n.handleId},w=(t||[]).some(k=>k.target===y.target&&k.targetHandle===y.targetHandle);r.push({node:u,nodeId:u.id,nodeLabel:((l=u.data)==null?void 0:l.label)||u.id,definitionId:((c=u.data)==null?void 0:c.definitionId)||"",slot:d,slotIndex:f,handleId:s?y.targetHandle:y.sourceHandle,connection:y,occupied:w})}}return r.sort((u,p)=>{var w,k,g,b,x,S,C,j;const f=Number(((k=(w=u.node)==null?void 0:w.position)==null?void 0:k.y)||0),d=Number(((b=(g=p.node)==null?void 0:g.position)==null?void 0:b.y)||0),h=Number(((S=(x=u.node)==null?void 0:x.position)==null?void 0:S.x)||0),y=Number(((j=(C=p.node)==null?void 0:C.position)==null?void 0:j.x)||0);return f-d||h-y||u.slotIndex-p.slotIndex||String(u.nodeId).localeCompare(String(p.nodeId))})}function Va(e,t=!1){if(t)return"folder";const n=String(e||"").toLowerCase().split(".").pop();return n==="md"||n==="markdown"?"article":n==="html"?"web":["csv","tsv"].includes(n)?"table":["js","jsx","ts","tsx","mjs","cjs"].includes(n)?"code":["yaml","yml","json"].includes(n)?"data_object":"draft"}function pV(e,t){const n=String(e||"node").replace(/^(agent|control|provide|tool|display)_/i,"").replace(/[^a-zA-Z0-9_]+/g,"_").replace(/^_+|_+$/g,"")||"node",r=new Set(t.map(s=>s.id));for(let s=1;s<1e4;s++){const i=`${n}_${s}`;if(!r.has(i))return i}return`${n}_${Date.now().toString(36)}`}function hV(e){return(e==null?void 0:e.default)!=null?String(e.default):(e==null?void 0:e.value)!=null?String(e.value):""}function mV(e){const t=Number(e);if(!Number.isFinite(t)||t<=0)return ku;const n=Math.max(1,Math.min(1440,Math.round(t)));return n<60?`*/${n} * * * *`:n===60?"0 * * * *":n<1440&&n%60===0?`0 */${n/60} * * *`:ku}function Vi(e,t=0,n=0,r=59){const s=Math.max(n,Math.min(r,Number.parseInt(String(e??t),10)||t));return String(s).padStart(2,"0")}function Mw(e){const t=String(e||"").trim().match(/^(\d{1,2}):(\d{1,2})$/);return t?`${Vi(t[1],9,0,23)}:${Vi(t[2],0,0,59)}`:"09:00"}function Nc(e,t,n,r,s){const i=Mw(t),[o,l]=i.split(":").map(u=>Number.parseInt(u,10)),c=String(e||"daily");if(c==="weekly"){const u=Math.max(0,Math.min(6,Number.parseInt(String(n??1),10)||1));return`${l} ${o} * * ${u}`}if(c==="monthly"){const u=Math.max(1,Math.min(31,Number.parseInt(String(r??1),10)||1));return`${l} ${o} ${u} * *`}return c==="custom"?String(s||"").trim()||ku:`${l} ${o} * * *`}function gV(e){const n=String(e||ku).trim().split(/\s+/);if(n.length!==5)return{scheduleType:"custom",time:"09:00",weekday:1,monthDay:1};const[r,s,i,o,l]=n,c=Number.parseInt(r,10),u=Number.parseInt(s,10),p=Number.isFinite(c)&&Number.isFinite(u)&&r===String(c)&&s===String(u),f=p?`${Vi(u,9,0,23)}:${Vi(c,0,0,59)}`:"09:00";return p&&i==="*"&&o==="*"&&l==="*"?{scheduleType:"daily",time:f,weekday:1,monthDay:1}:p&&i==="*"&&o==="*"&&/^\d+$/.test(l)?{scheduleType:"weekly",time:f,weekday:Math.max(0,Math.min(6,Number.parseInt(l,10))),monthDay:1}:p&&/^\d+$/.test(i)&&o==="*"&&l==="*"?{scheduleType:"monthly",time:f,weekday:1,monthDay:Math.max(1,Math.min(31,Number.parseInt(i,10)))}:{scheduleType:"custom",time:f,weekday:1,monthDay:1}}function Lw(e){let t={};const n=String(e||"").trim();if(n)try{t=JSON.parse(n)}catch{t={}}const r=Number(t.intervalMinutes),s=mV(r),i=typeof t.cron=="string"&&t.cron.trim()?t.cron.trim():s,o=gV(i),l=["daily","weekly","monthly","custom"].includes(t.scheduleType)?t.scheduleType:o.scheduleType,c=Mw(t.time||o.time||"09:00"),u=Math.max(0,Math.min(6,Number.parseInt(String(t.weekday??o.weekday??1),10)||1)),p=Math.max(1,Math.min(31,Number.parseInt(String(t.monthDay??o.monthDay??1),10)||1)),f=Nc(l,c,u,p,i);return{enabled:t.enabled===!0,scheduleType:l,time:c,weekday:u,monthDay:p,cron:f,timezone:q9,targetRunNodeId:typeof t.targetRunNodeId=="string"?t.targetRunNodeId.trim():"",overlapPolicy:"skip"}}function yV(e){const t=Lw(JSON.stringify(e||{}));return JSON.stringify(t)}function xV(e){const t=Number(e||0);return!Number.isFinite(t)||t<=0?"-":new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function wV(e){return e==="weekly"?"每周":e==="monthly"?"每月":e==="custom"?"高级 Cron":"每天"}function qS(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"&&e.trim()){const t=Date.parse(e);if(Number.isFinite(t))return t}return 0}function Qd(e){const t={};for(const n of Array.isArray(e)?e:[]){const r=String((n==null?void 0:n.scheduleNodeId)||(n==null?void 0:n.runNodeId)||"").trim();r&&(t[r]={nextAt:qS(n.nextRunAt),lastAt:qS(n.lastTriggeredAt),lastStatus:String(n.lastStatus||(n.enabled?"armed":"disabled")),lastError:String(n.lastError||""),lastRunId:String(n.lastRunId||""),targetRunNodeId:String(n.targetRunNodeId||n.runNodeId||""),cron:String(n.cron||""),timezone:String(n.timezone||"")})}return t}function Bc(e){var t;return!!((t=e==null?void 0:e.data)!=null&&t.isWorkspaceGroup)}function kp(e){return e>0?`Group ${e+1}`:"Group"}function bV(e){return(Array.isArray(e)?e:[]).map((n,r)=>{const s=String((n==null?void 0:n.id)||`group_${r+1}`).trim(),i=Number(n==null?void 0:n.x),o=Number(n==null?void 0:n.y),l=Number(n==null?void 0:n.width),c=Number(n==null?void 0:n.height);return!s||!Number.isFinite(i)||!Number.isFinite(o)||!Number.isFinite(l)||!Number.isFinite(c)?null:{id:s,title:String((n==null?void 0:n.title)||kp(r)).trim()||kp(r),color:String((n==null?void 0:n.color)||"purple").trim()||"purple",x:i,y:o,width:Math.max(Go,Math.round(l)),height:Math.max(Xo,Math.round(c))}}).filter(Boolean)}function vV(e){var n;return bV((n=e==null?void 0:e.ui)==null?void 0:n.groups).map(r=>({id:r.id,type:vu,position:{x:r.x,y:r.y},width:r.width,height:r.height,selected:!1,draggable:!0,selectable:!0,zIndex:0,data:{isWorkspaceGroup:!0,label:r.title,title:r.title,color:r.color,nodeSize:{width:r.width,height:r.height}}}))}function Fy(e){const t=Number(e==null?void 0:e.width),n=Number(e==null?void 0:e.height);return!Number.isFinite(t)||!Number.isFinite(n)?null:{width:Math.max(Go,Math.round(t)),height:Math.max(Xo,Math.round(n))}}function Zd(e){return(Array.isArray(e)?e:[]).map(t=>({type:(t==null?void 0:t.type)||"node",name:(t==null?void 0:t.name)||"",default:hV(t),required:!!(t!=null&&t.required),description:String((t==null?void 0:t.description)||""),showOnNode:(t==null?void 0:t.showOnNode)!=null?t.showOnNode!==!1:!!(t!=null&&t.required)||String((t==null?void 0:t.type)||"node").trim().toLowerCase()==="node"}))}function IP(e){const t=(e==null?void 0:e.data)||{},n=r=>(Array.isArray(r)?r:[]).map((s,i)=>(s==null?void 0:s.showOnNode)===!1?"":[i,String((s==null?void 0:s.type)||""),String((s==null?void 0:s.name)||""),s!=null&&s.required?"1":"0"].join(":")).filter(Boolean).join("|");return`${n(t.inputs)}=>${n(t.outputs)}`}function kV(e){var s,i,o,l;const t=(e==null?void 0:e.data)||{},n=t!=null&&t.displaySize&&typeof t.displaySize=="object"?t.displaySize:{},r=t!=null&&t.nodeSize&&typeof t.nodeSize=="object"?t.nodeSize:{};return[IP(e),Number((e==null?void 0:e.width)||0)||"",Number((e==null?void 0:e.height)||0)||"",Number(((s=e==null?void 0:e.measured)==null?void 0:s.width)||0)||"",Number(((i=e==null?void 0:e.measured)==null?void 0:i.height)||0)||"",Number(r.width||0)||"",Number(r.height||0)||"",Number(n.width||0)||"",Number(n.height||0)||"",t!=null&&t.isExecuting?"executing":"",(t==null?void 0:t.nodeStatus)||"",(l=(o=t==null?void 0:t.runningRunNodeIds)==null?void 0:o.has)!=null&&l.call(o,e==null?void 0:e.id)?"running-run":""].join("::")}function ef(e,t){var h,y;const n=e!=null&&e.instances&&typeof e.instances=="object"?e.instances:{},r=LP(n),s=Array.isArray(e==null?void 0:e.edges)?e.edges:[],i=(h=e==null?void 0:e.ui)!=null&&h.nodePositions&&typeof e.ui.nodePositions=="object"?e.ui.nodePositions:{},o=(y=e==null?void 0:e.ui)!=null&&y.nodeSizes&&typeof e.ui.nodeSizes=="object"?e.ui.nodeSizes:{},l=new Set(Object.keys(r));for(const w of s)w!=null&&w.source&&l.add(String(w.source)),w!=null&&w.target&&l.add(String(w.target));const u=Array.from(l).map(w=>{const k=r[w]||{},g=k.definitionId||w,b=t.find(F=>F.id===g),x=Rw(b)||g,S=t.find(F=>F.id===x)||b,C=k.marketplaceRef||_P(b),j=AP(b),E=i[w]&&typeof i[w].x=="number"&&typeof i[w].y=="number"?i[w]:{x:320+l.size*20,y:180+l.size*12},A=!!Dt(x),D=o[w]&&typeof o[w].width=="number"&&typeof o[w].height=="number"?{width:o[w].width,height:o[w].height}:null,W=nl(D,{display:A});return{id:w,type:vu,position:E,...W?{width:W.width,height:W.height}:{},data:{label:k.label||vp(b)||vp(S)||w,definitionId:x,...C?{marketplaceRef:C}:{},...b!=null&&b.packageId?{marketplacePackageId:b.packageId}:{},...b!=null&&b.version?{marketplaceVersion:b.version}:{},schemaType:EP(x,S||b),role:k.role||"normal",model:k.model||void 0,body:k.body||"",script:k.script||j||"",scriptRef:k.scriptRef||"",implementationRef:k.implementationRef||"",implementationMode:k.implementationMode||"",displayReloadKey:k.displayReloadKey||"",...W?{nodeSize:W}:{},...A&&W?{displaySize:W}:{}}}}).map(w=>xP(w,r,t)),p=vV(e),f=s.filter(w=>(w==null?void 0:w.source)&&(w==null?void 0:w.target)).filter(w=>!p.some(k=>k.id===String(w.source)||k.id===String(w.target))).map((w,k)=>({id:w.id||`we-${w.source}-${w.target}-${k}`,source:String(w.source),target:String(w.target),sourceHandle:w.sourceHandle??void 0,targetHandle:w.targetHandle??void 0,markerEnd:{type:fi.ArrowClosed}})),d=[...p,...u];return{nodes:d,edges:p9(f,d),instances:r}}function YS(e){return`${Oy}${e}`}function Wm(e){const t=String(e||"");return t.startsWith(Oy)?t.slice(Oy.length):t}function TP(e){if(!e||typeof e!="object")return null;const t=Number(e.x),n=Number(e.y),r=Number(e.zoom);return!Number.isFinite(t)||!Number.isFinite(n)||!Number.isFinite(r)?null:{x:t,y:n,zoom:Math.min(Math.max(r,.1),4)}}function zy(e,t=[]){const n=new Map((Array.isArray(t)?t:[]).filter(f=>{var d;return Dt((d=f==null?void 0:f.data)==null?void 0:d.definitionId)}).map(f=>[f.id,f])),r=Array.isArray(e==null?void 0:e.nodeIds)?e.nodeIds:[],s=[],i=new Set;for(const f of r){const d=String(f||"").trim();!d||i.has(d)||!n.has(d)||(i.add(d),s.push(d))}const o={},l=e!=null&&e.nodePositions&&typeof e.nodePositions=="object"?e.nodePositions:{};s.forEach((f,d)=>{const h=l[f];o[f]=h&&typeof h.x=="number"&&typeof h.y=="number"?{x:h.x,y:h.y}:{x:180+d*36,y:120+d*28}});const c={},u=e!=null&&e.nodeSizes&&typeof e.nodeSizes=="object"?e.nodeSizes:{};s.forEach(f=>{const d=nl(u[f],{display:!0});d&&(c[f]=d)});const p=TP(e==null?void 0:e.viewport);return{nodeIds:s,nodePositions:o,nodeSizes:c,...p?{viewport:p}:{}}}function SV(e,t=[]){return zy(e,t)}const Vm=[{value:"1",label:"1 天"},{value:"7",label:"7 天"},{value:"30",label:"30 天"},{value:"90",label:"90 天"},{value:"365",label:"1 年"},{value:"permanent",label:"永久"}];function Km(e={}){return{title:"",layout:"gallery",nodeIds:[],expiresInDays:30,permanent:!1,...e}}function GS(e={}){return e.permanent?"permanent":String(e.expiresInDays||30)}function XS(e={}){if(e.permanent)return{expiresMode:"permanent",permanent:!0};const t=Number(e.expiresInDays||30);return{expiresMode:"days",expiresInDays:Number.isFinite(t)?t:30}}function NV(e={}){if(!e.expiresAt)return"永久有效";const t=Date.parse(String(e.expiresAt||""));return Number.isFinite(t)?`有效期至 ${new Date(t).toLocaleString()}`:"永久有效"}function JS(e={}){return new URL(e.url||`/display/${e.id||""}`,window.location.origin).href}const RP="af:workspace:canvas-clipboard",MP="agentflow.workspace.canvas-clipboard";function jV(e){return JSON.stringify({type:MP,version:1,clipboard:e})}function CV(e){try{const t=JSON.parse(String(e||""));if((t==null?void 0:t.type)!==MP)return null;const n=t.clipboard;return!n||!Array.isArray(n.nodes)||n.nodes.length===0?null:n}catch{return null}}function EV(e){try{localStorage.setItem(RP,jV(e))}catch{}}function _V(){try{return CV(localStorage.getItem(RP))}catch{return null}}function PV(e){const t=Number.isFinite(e)?e:1;return Math.min(Math.max(t,.75),1)}async function QS(e){var n;const t=String(e||"");if(!t)return!1;try{if((n=navigator.clipboard)!=null&&n.writeText)return await navigator.clipboard.writeText(t),!0}catch{}try{const r=document.createElement("textarea");r.value=t,r.setAttribute("readonly",""),r.style.position="fixed",r.style.left="-9999px",r.style.top="0",document.body.appendChild(r),r.focus(),r.select();const s=document.execCommand("copy");return document.body.removeChild(r),s}catch{return!1}}function ZS(e,t,n){const r=Number(e);return!Number.isFinite(r)||r<=0?0:Math.min(n,Math.max(t,Math.round(r)))}function nl(e,{display:t=!1}={}){if(!e||typeof e!="object")return null;const n=Number(e.width),r=Number(e.height);return!Number.isFinite(n)||!Number.isFinite(r)||n<=0||r<=0?null:t?{width:Math.round(n),height:Math.round(r)}:{width:ZS(n,SP,NP)||kP,height:ZS(r,xp,jP)||xp}}function _a(e){var s,i,o,l,c,u,p,f,d,h,y;const t=!!Dt((s=e==null?void 0:e.data)==null?void 0:s.definitionId),n=Number(((o=(i=e==null?void 0:e.data)==null?void 0:i.displaySize)==null?void 0:o.width)||((c=(l=e==null?void 0:e.data)==null?void 0:l.nodeSize)==null?void 0:c.width)||(e==null?void 0:e.width)||(t?(u=e==null?void 0:e.measured)==null?void 0:u.width:0)||0),r=Number(((f=(p=e==null?void 0:e.data)==null?void 0:p.displaySize)==null?void 0:f.height)||((h=(d=e==null?void 0:e.data)==null?void 0:d.nodeSize)==null?void 0:h.height)||(e==null?void 0:e.height)||(t?(y=e==null?void 0:e.measured)==null?void 0:y.height:0)||0);return nl({width:n,height:r},{display:t})}function dc(e,t,n){var p,f,d,h,y,w,k,g,b,x,S,C,j;const r=(e||[]).filter(E=>!Bc(E)),s=(e||[]).filter(Bc),i=LP(Tw(r,n||{})),o=t.map(E=>({source:E.source,target:E.target,sourceHandle:E.sourceHandle??null,targetHandle:E.targetHandle??null})).filter(E=>!s.some(A=>A.id===E.source||A.id===E.target)),l={},c={},u=[];for(const E of r){l[E.id]={x:((p=E.position)==null?void 0:p.x)||0,y:((f=E.position)==null?void 0:f.y)||0};const A=_a(E);A&&(c[E.id]=A)}for(const E of s){const A=Number(((h=(d=E.data)==null?void 0:d.nodeSize)==null?void 0:h.width)||E.width||((y=E.measured)==null?void 0:y.width)||0),D=Number(((k=(w=E.data)==null?void 0:w.nodeSize)==null?void 0:k.height)||E.height||((g=E.measured)==null?void 0:g.height)||0);u.push({id:E.id,title:String(((b=E.data)==null?void 0:b.title)||((x=E.data)==null?void 0:x.label)||"Group"),color:String(((S=E.data)==null?void 0:S.color)||"purple"),x:Number(((C=E.position)==null?void 0:C.x)||0),y:Number(((j=E.position)==null?void 0:j.y)||0),width:Math.max(Go,Math.round(A||Go)),height:Math.max(Xo,Math.round(D||Xo))})}return{version:1,instances:i,edges:o,ui:{nodePositions:l,nodeSizes:c,groups:u}}}function LP(e){const t={};for(const[n,r]of Object.entries(e||{})){const s=String((r==null?void 0:r.definitionId)||n);if(!!Dt(s)||s.startsWith("provide_")||!Array.isArray(r==null?void 0:r.output)){t[n]=r;continue}t[n]={...r,output:r.output.map(o=>({...o,value:"",default:""}))}}return t}function Dt(e){const t=String(e||"");return t==="display_markdown"?"markdown":t==="display_mermaid"?"mermaid":t==="display_ascii"?"ascii":t==="display_html"?"html":t==="display_image"?"image":t==="display_chart"?"chart":t==="display_table"?"table":""}function Oo(e){const t=[...(e==null?void 0:e.inputs)||[],...(e==null?void 0:e.outputs)||[]],r=Dt(e==null?void 0:e.definitionId)==="image"?"src":"content",s=l=>String((l==null?void 0:l.value)??(l==null?void 0:l.default)??""),i=l=>s(l).trim(),o=t.find(l=>(l==null?void 0:l.name)===r&&i(l))||t.find(l=>(l==null?void 0:l.name)==="filePath"&&i(l))||t.find(l=>(l==null?void 0:l.type)==="text"&&i(l));return String((e==null?void 0:e.body)||(o?s(o):""))}function bl(e,t=""){const n=String(e||"").trim();if(!n||n.length>260||/[\r\n<>]/.test(n)||/^(?:https?:|data:|blob:|file:|javascript:|mailto:|tel:)/i.test(n))return"";const r=n.replace(/^\/+/,"");if(r.includes("..")||r.startsWith("."))return"";const s=r.split("?")[0].split("#")[0].toLowerCase().split(".").pop()||"";return({html:new Set(["html","htm"]),markdown:new Set(["md","markdown","txt"]),mermaid:new Set(["mmd","mermaid","txt"]),ascii:new Set(["txt","log"]),chart:new Set(["json"]),table:new Set(["json","csv","tsv"])}[t]||new Set(["html","htm","md","markdown","txt","json","csv","tsv"])).has(s)?r:""}function AV(e){let t=String(e||"").replace(/\r\n/g,`
104
- `).trim();return t.includes(`
105
- `)||(t=t.replace(/\s+(resultFile|result|outParams|outParams\.[A-Za-z_][A-Za-z0-9_-]*)\s*:/g,`
106
- $1:`).replace(/(^|\n)outParams:\s+([A-Za-z_][A-Za-z0-9_-]*\s*:)/g,`$1outParams:
107
- $2`)),t}function gi(e){const t=String(e||"").trim();if(!t)return String(e||"");const n=t.match(/---agentflow\b([\s\S]*?)---end/i);if(n!=null&&n[1]){const o=AV(n[1]),l=o.match(/^resultFile\s*:\s*["']?([^"'\n]+)["']?/m);if(l!=null&&l[1])return l[1].trim();const c=o.match(/^result\s*:\s*(.*)$/m);if(c){const p=String(c[1]||"").trim();return p==="|"||p===">"?o.slice((c.index||0)+c[0].length).split(`
108
- `).filter(d=>/^\s+/.test(d)||!d.trim()).map(d=>d.replace(/^\s{2}/,"")).join(`
109
- `).replace(/\s+$/g,""):p.replace(/^["']|["']$/g,"")}const u=t.replace(n[0],"").trim();if(u)return u}if(!/["']result["']\s*:|["']outParams["']\s*:|["']resultFile["']\s*:/i.test(t))return String(e||"");const r=[t],s=t.indexOf("{"),i=t.lastIndexOf("}");s>=0&&i>s&&r.unshift(t.slice(s,i+1));for(const o of r)try{const l=JSON.parse(o);if(l&&typeof l=="object"&&!Array.isArray(l)&&(Object.prototype.hasOwnProperty.call(l,"result")||Object.prototype.hasOwnProperty.call(l,"resultFile"))){const c=l.resultFile||l.result;return typeof c=="string"?c:JSON.stringify(c,null,2)}}catch{}return String(e||"")}async function vl(e,t){const n=Os(e);n.set("path",t);const r=await fetch(`/api/workspace/file?${n.toString()}`),s=await r.json().catch(()=>({}));if(!r.ok)throw new Error(s.error||`读取文件失败:${t}`);return String(s.content||"")}async function Hy(e,t,n){const r=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e,path:t,content:String(n||"")})}),s=await r.json().catch(()=>({}));if(!r.ok)throw new Error(s.error||`写入文件失败:${t}`);return s.path||t}function IV(e,t=[],n=[]){const r=String(e||"");if(!r)return"";const s=new Map(t.map(i=>[i.id,i]));return(Array.isArray(n)?n:[]).filter(i=>String((i==null?void 0:i.target)||"")===r).slice(0,4).map(i=>{const o=s.get(String((i==null?void 0:i.source)||""));if(!o)return"";const l=o.data||{},c=String(l.body||"").trim(),u=[`- upstreamId: ${o.id}`,` label: ${String(l.label||o.id).trim()}`,` definitionId: ${String(l.definitionId||"").trim()}`];return c&&u.push(` task: ${c.slice(0,4e3)}`),u.join(`
110
- `)}).filter(Boolean).join(`
111
-
112
- `)}function Al(e){let t=gi(e).trim();if(!t)return"";const n=t.match(/```(?:html|HTML)?\s*\n?([\s\S]*?)```/);if(n&&n[1])t=n[1].trim();else{const i=t.match(/```(?:html|HTML)?\s*\n?([\s\S]*)$/);i&&i[1]&&(t=i[1].trim())}t=t.replace(/^html\s*\n/i,"").replace(/```\s*$/g,"").trim();const s=[/<!doctype\b/i,/<html\b/i,/<head\b/i,/<body\b/i,/<style\b/i,/<script\b/i,/<main\b/i,/<section\b/i,/<article\b/i,/<div\b/i,/<svg\b/i,/<canvas\b/i].reduce((i,o)=>{const l=o.exec(t);return l?i<0?l.index:Math.min(i,l.index):i},-1);return s>0&&(t=t.slice(s).trim()),t}function TV(e){const t=Al(e);return t.trim()?/<[^>]*$/g.test(t)?"HTML 内容末尾存在未闭合标签,可能是生成或保存时被截断。":/^(?:<!doctype\b|<html\b)/i.test(t)&&!/<\/html\s*>/i.test(t)?"完整 HTML 文档缺少 </html> 结束标签,可能是生成或保存时被截断。":"":""}function Io(e,t){return e==="html"?TV(t):""}function $P(e,t=""){const n=Al(e);if(!n.trim())return"";const s=`<base target="_self"><script>
113
- (() => {
114
- const frameId = ${JSON.stringify(String(t||""))};
115
- const postSize = () => {
116
- const doc = document.documentElement;
117
- const body = document.body;
118
- const height = Math.ceil(Math.max(
119
- doc ? doc.scrollHeight : 0,
120
- doc ? doc.offsetHeight : 0,
121
- doc ? doc.clientHeight : 0,
122
- body ? body.scrollHeight : 0,
123
- body ? body.offsetHeight : 0,
124
- body ? body.clientHeight : 0,
125
- window.innerHeight || 0
126
- ));
127
- window.parent.postMessage({ source: "agentflow-html-display-size", frameId, height }, "*");
128
- };
129
- document.addEventListener("click", (event) => {
130
- const link = event.target && event.target.closest ? event.target.closest("a[href]") : null;
131
- if (!link) return;
132
- const rawHref = String(link.getAttribute("href") || "").trim();
133
- if (!rawHref || rawHref.startsWith("#")) return;
134
- if (/^(?:javascript|mailto|tel):/i.test(rawHref)) return;
135
- event.preventDefault();
136
- window.location.href = link.href;
137
- }, true);
138
- window.addEventListener("load", postSize);
139
- window.addEventListener("resize", postSize);
140
- requestAnimationFrame(postSize);
141
- setTimeout(postSize, 60);
142
- setTimeout(postSize, 300);
143
- if (typeof ResizeObserver !== "undefined") {
144
- const resizeObserver = new ResizeObserver(postSize);
145
- resizeObserver.observe(document.documentElement);
146
- if (document.body) resizeObserver.observe(document.body);
147
- }
148
- if (typeof MutationObserver !== "undefined") {
149
- const mutationObserver = new MutationObserver(postSize);
150
- mutationObserver.observe(document.documentElement, { childList: true, subtree: true, attributes: true, characterData: true });
151
- }
152
- })();
153
- <\/script>`;return/<script\b[^>]*>\s*\(\(\)\s*=>\s*\{\s*document\.addEventListener\("click"/i.test(n)?n:/<head\b[^>]*>/i.test(n)?n.replace(/<head\b([^>]*)>/i,`<head$1>${s}`):/<html\b[^>]*>/i.test(n)?n.replace(/<html\b([^>]*)>/i,`<html$1><head>${s}</head>`):`<!doctype html><html><head>${s}</head><body>${n}</body></html>`}function RV(e,t){const n=String(e).trim().replace(/[\\/:*?"<>|]+/g,"-").replace(/\s+/g,"-").replace(/^-+|-+$/g,"")||"html-render",r=String(t).replace(/^\.+/,"")||"png";return`${n}.${r}`}function MV(e,t){const n=document.createElement("a");n.href=e,n.download=t,document.body.appendChild(n),n.click(),n.remove()}function LV(e,t){const n=URL.createObjectURL(e);try{MV(n,t)}finally{window.setTimeout(()=>URL.revokeObjectURL(n),1e3)}}function OP(e){var t;try{return(e==null?void 0:e.contentDocument)||((t=e==null?void 0:e.contentWindow)==null?void 0:t.document)||null}catch{return null}}function $V(e){const t=OP(e);return t!=null&&t.documentElement?`${t.doctype?`<!DOCTYPE ${t.doctype.name}${t.doctype.publicId?` PUBLIC "${t.doctype.publicId}"`:""}${t.doctype.systemId?` "${t.doctype.systemId}"`:""}>`:"<!DOCTYPE html>"}
154
- ${t.documentElement.outerHTML}`:""}function Um(e){var n;if(!e)return null;const t=(n=e.getBoundingClientRect)==null?void 0:n.call(e);return{rectWidth:t!=null&&t.width?Math.round(t.width):null,rectHeight:t!=null&&t.height?Math.round(t.height):null,clientWidth:e.clientWidth||null,clientHeight:e.clientHeight||null,scrollWidth:e.scrollWidth||null,scrollHeight:e.scrollHeight||null,offsetWidth:e.offsetWidth||null,offsetHeight:e.offsetHeight||null}}function OV(e,t,n,r={}){var k;const s=(k=e==null?void 0:e.getBoundingClientRect)==null?void 0:k.call(e),i=OP(e),o=i==null?void 0:i.documentElement,l=i==null?void 0:i.body,c=(r==null?void 0:r.card)||null,u=(r==null?void 0:r.displayBody)||null,p=(r==null?void 0:r.scroller)||null,f=(r==null?void 0:r.displaySize)||null,d={fallbackWidth:Number(t)||null,fallbackHeight:Number(n)||null,displaySizeWidth:Number((f==null?void 0:f.width)||0)||null,displaySizeHeight:Number((f==null?void 0:f.height)||0)||null,rectWidth:s!=null&&s.width?Math.round(s.width):null,rectHeight:s!=null&&s.height?Math.round(s.height):null,iframeClientWidth:(e==null?void 0:e.clientWidth)||null,iframeClientHeight:(e==null?void 0:e.clientHeight)||null,docScrollWidth:(o==null?void 0:o.scrollWidth)||null,docScrollHeight:(o==null?void 0:o.scrollHeight)||null,bodyScrollWidth:(l==null?void 0:l.scrollWidth)||null,bodyScrollHeight:(l==null?void 0:l.scrollHeight)||null,docOffsetWidth:(o==null?void 0:o.offsetWidth)||null,bodyOffsetWidth:(l==null?void 0:l.offsetWidth)||null,card:Um(c),displayBody:Um(u),scroller:Um(p)},h=[Number(t)||0,Number((f==null?void 0:f.width)||0),Number((c==null?void 0:c.clientWidth)||0),Number((c==null?void 0:c.scrollWidth)||0),Number((u==null?void 0:u.clientWidth)||0),Number((u==null?void 0:u.scrollWidth)||0),Number((p==null?void 0:p.clientWidth)||0),Number((p==null?void 0:p.scrollWidth)||0),Number(s==null?void 0:s.width)||0,Number(e==null?void 0:e.clientWidth)||0,Number((o==null?void 0:o.scrollWidth)||0),Number((l==null?void 0:l.scrollWidth)||0),Number((o==null?void 0:o.offsetWidth)||0),Number((l==null?void 0:l.offsetWidth)||0)].map(g=>Math.ceil(g)).filter(g=>g>0),y=Math.max(1,...h.length?h:[960]),w=Math.max(1,Math.round(Number(n)||(s==null?void 0:s.height)||(e==null?void 0:e.clientHeight)||640),Math.ceil(Number((o==null?void 0:o.scrollHeight)||0)),Math.ceil(Number((l==null?void 0:l.scrollHeight)||0)));return{width:y,height:w,debug:d}}async function DV({flowParams:e,content:t,sourceFilePath:n,iframe:r,width:s,height:i,filename:o,snapshotElements:l,displaySize:c}){const u=OV(r,s,i,{...l||{},displaySize:c}),p=$V(r),f=await fetch("/api/workspace/html-screenshot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e,content:p||t,sourceFilePath:n||"",width:u.width,height:u.height,filename:o})});if(!f.ok){const h=await f.json().catch(()=>({}));throw new Error(h.error||"截图失败")}const d=await f.blob();LV(d,o)}function FV(e){const n=[...(e==null?void 0:e.inputs)||[],...(e==null?void 0:e.outputs)||[]].find(r=>(r==null?void 0:r.name)==="alt");return String((n==null?void 0:n.value)||(n==null?void 0:n.default)||(e==null?void 0:e.label)||"Image preview")}function DP(e){return e==="mermaid"?"account_tree":e==="ascii"?"notes":e==="html"?"html":e==="image"?"image":e==="chart"?"bar_chart":e==="table"?"table":"article"}function zV(e){const t=String(e||"").split(/\r?\n/).map(l=>l.replace(/%%.*$/,"").trim()).filter(Boolean),n=new Map,r=[];let s="TD";const i=(l,c="")=>{const u=String(l||"").replace(/[^A-Za-z0-9_]/g,"_")||`N${n.size+1}`;return n.has(u)?c&&(n.get(u).label=c):n.set(u,{id:u,label:c||u}),u},o=l=>{const c=String(l||"").trim().replace(/[;,]+$/,""),u=c.match(/^([A-Za-z][A-Za-z0-9_]*)(?:\[(.+?)\]|\((.+?)\)|\{(.+?)\})?$/);return u?i(u[1],u[2]||u[3]||u[4]||u[1]):i(c.replace(/[^A-Za-z0-9_]/g,"_"),c)};for(const l of t){const c=l.match(/^(graph|flowchart)\s+(TD|TB|BT|LR|RL)\b/i);if(c){s=c[2].toUpperCase();continue}const u=l.match(/^(.+?)\s*-{1,2}>+\s*(.+)$/);if(u){r.push({from:o(u[1]),to:o(u[2])});continue}o(l)}return{nodes:Array.from(n.values()),edges:r,direction:s}}function FP({code:e}){const t=m.useMemo(()=>zV(e),[e]);if(!String(e||"").trim())return null;const n=t.direction==="LR"||t.direction==="RL",r=142,s=44,i=n?96:32,o=n?30:68,l=new Map;t.nodes.forEach((p,f)=>{l.set(p.id,{x:24+(n?f*(r+i):f%3*(r+i)),y:24+(n?f%3*(s+o):f*(s+o))})});const c=Math.max(360,...Array.from(l.values()).map(p=>p.x+r+24)),u=Math.max(180,...Array.from(l.values()).map(p=>p.y+s+24));return a.jsx("div",{className:"af-work-node__mermaid-preview",children:a.jsxs("svg",{viewBox:`0 0 ${c} ${u}`,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((p,f)=>{const d=l.get(p.from),h=l.get(p.to);if(!d||!h)return null;const y=n?`M ${d.x+r} ${d.y+s/2} C ${(d.x+h.x+r)/2} ${d.y+s/2}, ${(d.x+h.x+r)/2} ${h.y+s/2}, ${h.x} ${h.y+s/2}`:`M ${d.x+r/2} ${d.y+s} C ${d.x+r/2} ${d.y+s+28}, ${h.x+r/2} ${h.y-28}, ${h.x+r/2} ${h.y}`;return a.jsx("path",{className:"af-work-node__mermaid-edge",d:y,markerEnd:"url(#af-work-arrow)"},`${p.from}-${p.to}-${f}`)}),t.nodes.map(p=>{const f=l.get(p.id);return a.jsxs("g",{children:[a.jsx("rect",{className:"af-work-node__mermaid-box",x:f.x,y:f.y,width:r,height:s,rx:"8"}),a.jsx("text",{className:"af-work-node__mermaid-text",x:f.x+r/2,y:f.y+s/2+5,textAnchor:"middle",children:p.label.slice(0,22)})]},p.id)})]})})}function ys({className:e="",children:t}){const n=m.useRef(null),r=m.useRef(null),[s,i]=m.useState({visible:!1,top:0,height:100}),o=m.useCallback(()=>{const p=n.current;if(!p)return;const f=Math.max(1,p.scrollHeight),d=Math.max(1,p.clientHeight),h=f>d+1,y=h?Math.max(12,d/f*100):100,w=Math.max(0,100-y),k=h?Math.min(w,p.scrollTop/Math.max(1,f-d)*w):0;i({visible:h,top:k,height:y})},[]);m.useEffect(()=>{const p=requestAnimationFrame(o),f=n.current;if(!f||typeof ResizeObserver>"u")return()=>cancelAnimationFrame(p);const d=new ResizeObserver(o);d.observe(f);for(const h of Array.from(f.children))d.observe(h);return()=>{cancelAnimationFrame(p),d.disconnect()}},[t,o]);const l=m.useCallback(p=>{const f=n.current;if(!f)return;const d=Math.max(0,f.scrollHeight-f.clientHeight);f.scrollTop=Math.min(1,Math.max(0,p))*d,o()},[o]),c=m.useCallback((p,f=0)=>{const d=r.current;if(!d)return 0;const h=d.getBoundingClientRect(),y=s.height/100*h.height,w=Math.max(1,h.height-y);return(p-h.top-f)/w},[s.height]),u=m.useCallback(p=>{var S,C;if(!s.visible)return;p.preventDefault(),p.stopPropagation();const f=r.current;if(!f)return;const d=f.getBoundingClientRect(),h=s.top/100*d.height,y=s.height/100*d.height,k=p.clientY>=d.top+h&&p.clientY<=d.top+h+y?p.clientY-d.top-h:y/2;l(c(p.clientY,k));const g=p.pointerId;(C=(S=p.currentTarget).setPointerCapture)==null||C.call(S,g);const b=j=>{j.preventDefault(),l(c(j.clientY,k))},x=()=>{window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",x)};window.addEventListener("pointermove",b),window.addEventListener("pointerup",x),window.addEventListener("pointercancel",x)},[c,l,s.height,s.top,s.visible]);return a.jsxs("div",{className:`af-visible-scroll-frame ${e}`,children:[a.jsx("div",{ref:n,className:`af-visible-scroll-frame__scroller ${e}`,onScroll:o,children:t}),a.jsx("div",{ref:r,className:"af-visible-scrollbar"+(s.visible?" af-visible-scrollbar--visible":""),onPointerDown:u,"aria-hidden":"true",children:a.jsx("span",{style:{height:`${s.height}%`,top:`${s.top}%`}})})]})}function zP({data:e,flowParams:t,htmlFrameRef:n,htmlFrameVersion:r=0}){const s=Dt(e==null?void 0:e.definitionId),i=Oo(e),o=s==="image"?i:gi(i),l=s==="image"?"":bl(o,s),[c,u]=m.useState(""),[p,f]=m.useState(""),[d,h]=m.useState(!1);m.useEffect(()=>{let S=!1;return l?(h(!0),f(""),u(""),vl(t,l).then(C=>{S||u(C)}).catch(C=>{S||f(String(C.message||C))}).finally(()=>{S||h(!1)}),()=>{S=!0}):(u(""),f(""),h(!1),()=>{S=!0})},[l,t==null?void 0:t.flowId,t==null?void 0:t.flowSource,t==null?void 0:t.archived,e==null?void 0:e.displayReloadKey]);const y=l?c:o,w=s==="html"?Al(y):gi(y),k=m.useRef(""),[g,b]=m.useState(0);if(k.current||(k.current=`html-display-${Math.random().toString(36).slice(2,10)}`),m.useEffect(()=>{if(s!=="html"){b(0);return}const S=k.current,C=j=>{const E=n.current;if(!E||j.source!==E.contentWindow)return;const A=j.data&&typeof j.data=="object"?j.data:null;if(!A||A.source!=="agentflow-html-display-size"||A.frameId!==S)return;const D=Math.ceil(Number(A.height||0));!Number.isFinite(D)||D<=0||b(Math.min(2e5,Math.max(220,D)))};return b(0),window.addEventListener("message",C),()=>window.removeEventListener("message",C)},[w,n,r,s]),!s)return null;const x=Io(s,w);if(d)return a.jsxs(ys,{className:"af-work-display-empty",children:["Loading ",l,"..."]});if(p)return a.jsx(ys,{className:"af-work-display-empty",children:p});if(x)return a.jsx(ys,{className:"af-work-display-empty",children:x});if(!w.trim())return a.jsx(ys,{className:"af-work-display-empty",children:"No display content"});if(s==="html")return a.jsx(ys,{className:"af-work-display-body af-work-display-body--html",children:a.jsx("iframe",{ref:n,className:"af-work-display-html-frame",style:g>0?{height:`${g}px`}:void 0,title:(e==null?void 0:e.label)||"HTML preview",sandbox:"allow-scripts allow-forms allow-modals",srcDoc:$P(w,k.current)},r)});if(s==="image"){const S=bp(w,t);return a.jsx(ys,{className:"af-work-display-body af-work-display-body--image",children:a.jsx("img",{className:"af-work-display-image",src:S,alt:FV(e),loading:"lazy"})})}return s==="markdown"?a.jsx(ys,{className:"af-work-display-body af-work-display-body--markdown",children:a.jsx(Ew,{content:w,basePath:l,resolveSrc:(S,C)=>bp(S,t,C)})}):s==="chart"?a.jsx(ys,{className:"af-work-display-body af-work-display-body--chart",children:a.jsx(Pw,{content:w})}):s==="table"?a.jsx(ys,{className:"af-work-display-body af-work-display-body--table",children:a.jsx(_w,{content:w})}):s==="mermaid"?a.jsxs(ys,{className:"af-work-display-body",children:[a.jsx(FP,{code:w}),a.jsx("pre",{className:"af-work-node__diagram af-work-node__diagram--mermaid",children:w})]}):a.jsx(ys,{className:"af-work-display-body af-work-display-body--ascii",children:a.jsx("pre",{className:"af-work-node__diagram af-work-node__diagram--ascii",children:w})})}function HV({node:e,onClose:t}){var i,o,l;const n=m.useRef(null),r=Dt((i=e==null?void 0:e.data)==null?void 0:i.definitionId),s=((o=e==null?void 0:e.data)==null?void 0:o.label)||(r==="html"?"HTML 展示":r==="markdown"?"Markdown 展示":"Display 预览");return m.useEffect(()=>{const c=u=>{u.key==="Escape"&&(t==null||t())};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[t]),e?ar.createPortal(a.jsx("div",{className:"af-display-preview-overlay",role:"dialog","aria-modal":"true","aria-label":"全屏预览",children:a.jsxs("div",{className:"af-display-preview-shell",children:[a.jsxs("div",{className:"af-display-preview-head",children:[a.jsxs("div",{className:"af-display-preview-title",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:DP(r)}),a.jsx("strong",{children:s}),a.jsx("span",{children:e.id})]}),a.jsx("button",{type:"button",className:"af-display-preview-close",onClick:t,"aria-label":"关闭全屏预览",title:"关闭",children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),a.jsx("div",{className:"af-display-preview-content",children:a.jsx(zP,{data:e.data,flowParams:(l=e.data)==null?void 0:l.flowParams,htmlFrameRef:n})})]})}),document.body):null}function BV({node:e}){var d,h,y,w,k,g,b,x,S,C,j;const t=Dt((d=e==null?void 0:e.data)==null?void 0:d.definitionId),n=Oo(e==null?void 0:e.data),r=t==="image"?n:gi(n),s=t==="image"?"":bl(r,t),[i,o]=m.useState(""),[l,c]=m.useState(!1);m.useEffect(()=>{var A;let E=!1;return s?(c(!0),o(""),vl(((A=e==null?void 0:e.data)==null?void 0:A.flowParams)||{},s).then(D=>{E||o(D)}).catch(()=>{E||o("")}).finally(()=>{E||c(!1)}),()=>{E=!0}):(o(""),c(!1),()=>{E=!0})},[s,(y=(h=e==null?void 0:e.data)==null?void 0:h.flowParams)==null?void 0:y.flowId,(k=(w=e==null?void 0:e.data)==null?void 0:w.flowParams)==null?void 0:k.flowSource,(b=(g=e==null?void 0:e.data)==null?void 0:g.flowParams)==null?void 0:b.archived,(x=e==null?void 0:e.data)==null?void 0:x.displayReloadKey]);const u=s?i:r,p=t==="html"?Al(u):gi(u),f=Io(t,p);return l?a.jsx("div",{className:"af-display-picker-preview__empty",children:"Loading"}):f?a.jsx("div",{className:"af-display-picker-preview__empty",children:f}):p.trim()?t==="html"?a.jsx("iframe",{title:((S=e==null?void 0:e.data)==null?void 0:S.label)||(e==null?void 0:e.id),sandbox:"allow-scripts allow-forms allow-modals",srcDoc:$P(p)}):t==="image"?a.jsx("img",{src:bp(p,(C=e==null?void 0:e.data)==null?void 0:C.flowParams),alt:((j=e==null?void 0:e.data)==null?void 0:j.label)||(e==null?void 0:e.id),loading:"lazy"}):t==="markdown"?a.jsx("div",{className:"af-display-picker-preview__markdown",children:a.jsx(Ew,{content:p,basePath:s,resolveSrc:(E,A)=>{var D;return bp(E,(D=e==null?void 0:e.data)==null?void 0:D.flowParams,A)}})}):t==="chart"?a.jsx(Pw,{content:p}):t==="table"?a.jsx(_w,{content:p}):t==="mermaid"?a.jsxs("div",{className:"af-display-picker-preview__diagram",children:[a.jsx(FP,{code:p}),a.jsx("pre",{children:p})]}):a.jsx("pre",{className:"af-display-picker-preview__pre",children:p}):a.jsx("div",{className:"af-display-picker-preview__empty",children:"No content"})}function WV({value:e,onChange:t,onUploadImage:n,readOnly:r=!1}){const s=m.useRef(null),i=m.useRef(null),o=m.useRef(null),[l,c]=m.useState(!1),[u,p]=m.useState({visible:!1,top:0,height:100}),f=m.useCallback(()=>{const g=s.current;if(!g)return;const b=Math.max(1,g.scrollHeight),x=Math.max(1,g.clientHeight),S=b>x+1,C=S?Math.max(12,x/b*100):100,j=Math.max(0,100-C),E=S?Math.min(j,g.scrollTop/Math.max(1,b-x)*j):0;p({visible:S,top:E,height:C})},[]);m.useEffect(()=>{const g=requestAnimationFrame(f),b=s.current;if(!b||typeof ResizeObserver>"u")return()=>cancelAnimationFrame(g);const x=new ResizeObserver(f);return x.observe(b),()=>{cancelAnimationFrame(g),x.disconnect()}},[f,e]);const d=m.useCallback(g=>{const b=s.current;if(!b)return;const x=Math.max(0,b.scrollHeight-b.clientHeight);b.scrollTop=Math.min(1,Math.max(0,g))*x,f()},[f]),h=m.useCallback((g,b=0)=>{const x=o.current;if(!x)return 0;const S=x.getBoundingClientRect(),C=u.height/100*S.height,j=Math.max(1,S.height-C);return(g-S.top-b)/j},[u.height]),y=m.useCallback(g=>{if(!u.visible)return;g.preventDefault(),g.stopPropagation();const b=o.current;if(!b)return;const x=b.getBoundingClientRect(),S=u.top/100*x.height,C=u.height/100*x.height,E=g.clientY>=x.top+S&&g.clientY<=x.top+S+C?g.clientY-x.top-S:C/2;d(h(g.clientY,E));const A=W=>{W.preventDefault(),d(h(W.clientY,E))},D=()=>{window.removeEventListener("pointermove",A),window.removeEventListener("pointerup",D),window.removeEventListener("pointercancel",D)};window.addEventListener("pointermove",A),window.addEventListener("pointerup",D),window.addEventListener("pointercancel",D)},[h,d,u.height,u.top,u.visible]),w=m.useCallback(g=>{const b=String(e||""),x=s.current,S=Number((x==null?void 0:x.selectionStart)??b.length),C=Number((x==null?void 0:x.selectionEnd)??S),j=b.slice(0,S),E=b.slice(C),A=j&&!j.endsWith(`
155
- `)?`
156
- `:"",D=E&&!E.startsWith(`
157
- `)?`
158
- `:"",W=`${j}${A}${g}${D}${E}`;t==null||t(W),window.requestAnimationFrame(()=>{var R,$;const F=j.length+A.length+g.length;(R=s.current)==null||R.focus(),($=s.current)==null||$.setSelectionRange(F,F)})},[t,e]),k=m.useCallback(async g=>{if(!r&&!(!g||l)){c(!0);try{const b=await(n==null?void 0:n(g)),x=String(b||"").trim();if(x){const S=String(g.name||"image").replace(/\.[^.]+$/g,"").trim()||"image";w(`![${S}](${x})`)}}finally{c(!1)}}},[w,n,r,l]);return a.jsxs("div",{className:"af-work-display-editor nodrag nopan",onClick:g=>g.stopPropagation(),onDragOver:g=>{var x;Array.from(((x=g.dataTransfer)==null?void 0:x.items)||[]).some(S=>String((S==null?void 0:S.type)||"").startsWith("image/"))&&(g.preventDefault(),g.dataTransfer.dropEffect="copy")},onDrop:g=>{var x;const b=Array.from(((x=g.dataTransfer)==null?void 0:x.files)||[]).find(wp);b&&(g.preventDefault(),k(b))},children:[a.jsxs("div",{className:"af-work-display-editor__toolbar",children:[a.jsx("button",{type:"button",className:"af-work-display-card__action",disabled:l||r,onClick:()=>{var g;return(g=i.current)==null?void 0:g.click()},"aria-label":"上传图片",title:"上传图片",children:a.jsx("span",{className:"material-symbols-outlined",children:l?"hourglass_top":"add_photo_alternate"})}),a.jsx("input",{ref:i,className:"af-hidden-file-input",type:"file",accept:"image/*",onChange:g=>{var x;const b=(x=g.target.files)==null?void 0:x[0];g.target.value="",b&&k(b)}})]}),a.jsx("textarea",{ref:s,className:"af-work-display-editor__textarea",value:e,onChange:g=>t==null?void 0:t(g.target.value),onScroll:f,onKeyDown:g=>{g.key==="Escape"&&g.stopPropagation()},placeholder:"输入 Markdown 内容",spellCheck:!1,readOnly:r}),a.jsx("div",{ref:o,className:"af-work-display-editor__scrollbar"+(u.visible?" af-work-display-editor__scrollbar--visible":""),onPointerDown:y,"aria-hidden":"true",children:a.jsx("span",{style:{height:`${u.height}%`,top:`${u.top}%`}})})]})}function VV({nodeId:e,data:t}){const n=t==null?void 0:t.nodeChatActive,r=!!(t!=null&&t.selected),s=(t==null?void 0:t.nodeChat)||{},i=Array.isArray(s.messages)?s.messages:[],o=String(s.draft||""),[l,c]=m.useState(o),u=m.useRef(!1),p=String(s.candidateContent||""),f=!!s.running,d=!!(t!=null&&t.readOnly),h=String(s.error||"");return m.useEffect(()=>{u.current||c(o)},[o]),!n&&!r?null:n?a.jsxs("div",{className:"af-work-node-chat nodrag nopan",onClick:y=>y.stopPropagation(),children:[a.jsxs("div",{className:"af-work-node-chat__head",children:[a.jsxs("div",{children:[a.jsx("strong",{children:"继续微调"}),a.jsx("span",{children:(t==null?void 0:t.label)||e})]}),a.jsx("button",{type:"button",onClick:()=>{var y;return(y=t==null?void 0:t.onCloseNodeChat)==null?void 0:y.call(t)},"aria-label":"关闭节点微调",children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),i.length>0||f||h||p.trim()?a.jsxs("div",{className:"af-work-node-chat__messages",children:[i.slice(-4).map((y,w)=>a.jsxs("div",{className:`af-work-node-chat__msg af-work-node-chat__msg--${y.role==="assistant"?"assistant":"user"}`,children:[a.jsx("span",{children:y.role==="assistant"?"AI":"你"}),a.jsx("p",{children:y.text})]},`${y.at||w}-${w}`)),f?a.jsx("div",{className:"af-work-node-chat__pending",children:"生成中..."}):null,h?a.jsx("div",{className:"af-work-node-chat__error",children:h}):null]}):null,a.jsxs("div",{className:"af-work-node-chat__composer",children:[a.jsx("button",{type:"button",className:"af-work-node-chat__add",disabled:f||d,"aria-label":"添加上下文",children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add"})}),a.jsx("textarea",{className:"af-work-node-chat__input",rows:2,value:l,disabled:f||d,placeholder:"描述你想怎么调整这个展示",onCompositionStart:()=>{u.current=!0},onCompositionEnd:y=>{var k;u.current=!1;const w=y.currentTarget.value;c(w),(k=t==null?void 0:t.onUpdateNodeChatDraft)==null||k.call(t,e,w)},onChange:y=>{var k;const w=y.target.value;c(w),u.current||(k=t==null?void 0:t.onUpdateNodeChatDraft)==null||k.call(t,e,w)},onKeyDown:y=>{var w,k;y.isComposing||(w=y.nativeEvent)!=null&&w.isComposing||y.keyCode===229||(y.metaKey||y.ctrlKey)&&y.key==="Enter"&&(y.preventDefault(),(k=t==null?void 0:t.onSendNodeChat)==null||k.call(t,e,l))}}),a.jsx("button",{type:"button",className:"af-work-node-chat__send",disabled:f||d||!l.trim(),onClick:()=>{var y;return(y=t==null?void 0:t.onSendNodeChat)==null?void 0:y.call(t,e,l)},"aria-label":"发送",children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_upward"})})]}),a.jsxs("div",{className:"af-work-node-chat__actions",children:[a.jsx("button",{type:"button",disabled:f||d||!p.trim(),onClick:()=>{var y;return(y=t==null?void 0:t.onApplyNodeChatCandidate)==null?void 0:y.call(t,e,"replace")},children:"替换当前内容"}),a.jsx("button",{type:"button",disabled:f||d||!p.trim(),onClick:()=>{var y;return(y=t==null?void 0:t.onApplyNodeChatCandidate)==null?void 0:y.call(t,e,"append")},children:"追加"})]})]}):a.jsxs("button",{type:"button",className:"af-work-node-chat-anchor nodrag nopan",onClick:y=>{var w;y.stopPropagation(),(w=t==null?void 0:t.onToggleNodeChat)==null||w.call(t,e)},title:"微调这个节点","aria-label":"微调这个节点",children:[a.jsx("span",{className:"material-symbols-outlined af-work-node-chat-anchor__plus","aria-hidden":!0,children:"add"}),a.jsx("span",{className:"af-work-node-chat-anchor__label",children:"继续微调这个展示"}),a.jsx("span",{className:"material-symbols-outlined af-work-node-chat-anchor__expand","aria-hidden":!0,children:"open_in_full"})]})}function KV(e){return e==="mermaid"?"mmd":e==="ascii"?"txt":e==="html"?"html":e==="image"?"txt":e==="chart"||e==="table"?"json":"md"}function UV(e){return String(e).trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)||"display"}function eN(e,t){const n=Dt(t==null?void 0:t.definitionId)||"markdown";return`outputs/${UV((t==null?void 0:t.label)||e||n)}.${KV(n)}`}function qV({id:e,data:t,selected:n,deleteNode:r}){var we,re,ye;const s=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],o=(Array.isArray(t==null?void 0:t.outputs)?t.outputs:[]).map((te,ie)=>({slot:te,idx:ie})).sort((te,ie)=>{var Ie,et,ut,Ae;const ce=String(((Ie=te.slot)==null?void 0:Ie.name)||"").trim(),pe=String(((et=ie.slot)==null?void 0:et.name)||"").trim();if(ce==="next"&&pe!=="next")return-1;if(pe==="next"&&ce!=="next")return 1;const De=String(((ut=te.slot)==null?void 0:ut.type)||"").trim(),He=String(((Ae=ie.slot)==null?void 0:Ae.type)||"").trim();return De==="node"&&He!=="node"?-1:He==="node"&&De!=="node"?1:te.idx-ie.idx}),l=Dt(t==null?void 0:t.definitionId),c=m.useRef(null),u=m.useRef(null),[p,f]=m.useState(0),[d,h]=m.useState(!1),[y,w]=m.useState(!1),[k,g]=m.useState(!1),[b,x]=m.useState(""),[S,C]=m.useState(""),[j,E]=m.useState(!1),[A,D]=m.useState(!1),W=m.useRef(null),F=Oo(t),R=l==="markdown"?gi(F):"",$=l==="markdown"?bl(R,"markdown"):"",P=l==="markdown"?$?S:R:"",L=!!(t!=null&&t.readOnly),T=!!(t!=null&&t.displayPageMode);m.useEffect(()=>{let te=!1;return l!=="markdown"||!$?(C(""),E(!1),()=>{te=!0}):(E(!0),vl((t==null?void 0:t.flowParams)||{},$).then(ie=>{te||C(ie)}).catch(ie=>{var ce;te||(C(""),(ce=t==null?void 0:t.onStatus)==null||ce.call(t,String(ie.message||ie)))}).finally(()=>{te||E(!1)}),()=>{te=!0})},[l,$,(we=t==null?void 0:t.flowParams)==null?void 0:we.flowId,(re=t==null?void 0:t.flowParams)==null?void 0:re.flowSource,(ye=t==null?void 0:t.flowParams)==null?void 0:ye.archived,t==null?void 0:t.displayReloadKey]),m.useEffect(()=>{if(!y)return;const te=()=>w(!1);return window.addEventListener("pointerup",te,!0),window.addEventListener("pointercancel",te,!0),window.addEventListener("mouseup",te,!0),window.addEventListener("blur",te),()=>{window.removeEventListener("pointerup",te,!0),window.removeEventListener("pointercancel",te,!0),window.removeEventListener("mouseup",te,!0),window.removeEventListener("blur",te)}},[y]),m.useEffect(()=>{k||x(String(P||""))},[P,k]);const O=(t==null?void 0:t.label)||(l==="mermaid"?"Mermaid":l==="ascii"?"ASCII":l==="html"?"HTML":l==="image"?"Image":l==="chart"?"Chart":l==="table"?"Table":"Markdown"),I=String((t==null?void 0:t.sourceNodeId)||e),H=(t==null?void 0:t.sharingDisplayNodeId)===I,_=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,Y=m.useCallback(async()=>{var Qe,qt,Te,Ht,st,dn,ne,me,Oe,Fe;if(l!=="html"||d)return;const te=Oo(t),ie=bl(te,l);let ce=te;if(ie)try{ce=await vl((t==null?void 0:t.flowParams)||{},ie)}catch(Ve){h(!1),console.warn("Failed to read HTML display file before saving image.",Ve);return}const pe=Al(ce);if(!pe.trim())return;const De=Io(l,pe);if(De){console.warn(De);return}const He=(qt=(Qe=u.current)==null?void 0:Qe.getBoundingClientRect)==null?void 0:qt.call(Qe),Ie=(Ht=(Te=c.current)==null?void 0:Te.querySelector)==null?void 0:Ht.call(Te,".af-work-display-body"),et=(dn=(st=c.current)==null?void 0:st.querySelector)==null?void 0:dn.call(st,".af-visible-scroll-frame__scroller"),ut=Math.round(Math.max(Number((He==null?void 0:He.width)||0),Number((_==null?void 0:_.width)||0),Number(((ne=c.current)==null?void 0:ne.clientWidth)||0),Number((Ie==null?void 0:Ie.clientWidth)||0),Number((et==null?void 0:et.clientWidth)||0),Math.max(320,Number((_==null?void 0:_.width)||960)-2))),Ae=Math.round(Math.max(Number((He==null?void 0:He.height)||0),Number((_==null?void 0:_.height)||0),Number(((me=c.current)==null?void 0:me.clientHeight)||0),Number((Ie==null?void 0:Ie.clientHeight)||0),Number((et==null?void 0:et.clientHeight)||0),Math.max(180,Number((_==null?void 0:_.height)||640)-46)));h(!0);try{await DV({flowParams:(t==null?void 0:t.flowParams)||{},content:pe,sourceFilePath:ie,iframe:u.current,width:ut,height:Ae,filename:RV((t==null?void 0:t.label)||e||"html-render","png"),snapshotElements:{card:c.current,displayBody:Ie,scroller:et},displaySize:_}),(Oe=t==null?void 0:t.onStatus)==null||Oe.call(t,"已导出 HTML 展示截图")}catch(Ve){const Et=String((Ve==null?void 0:Ve.message)||Ve||"截图失败");(Fe=t==null?void 0:t.onStatus)==null||Fe.call(t,`HTML 截图失败:${Et}`),console.warn("Failed to save HTML display as PNG.",Ve)}finally{h(!1)}},[t,_==null?void 0:_.height,_==null?void 0:_.width,e,l,d]),U=m.useCallback(te=>{var ie;L||!te||l!=="image"||(ie=t==null?void 0:t.onUploadImageToDisplayNode)==null||ie.call(t,e,te)},[t,e,l,L]),V=m.useCallback(te=>{var ie,ce;(ie=te==null?void 0:te.stopPropagation)==null||ie.call(te),!L&&((ce=t==null?void 0:t.onSetDisplayNodeContent)==null||ce.call(t,e,"","replace",{logChat:!1,reloadDisplay:!0,statusMessage:"已清空 Display 内容"}),l==="markdown"&&(x(""),g(!1)))},[t,e,l,L]),Z=m.useCallback(te=>{var pe,De;L||l!=="image"||!(Array.from(((pe=te.dataTransfer)==null?void 0:pe.files)||[]).some(wp)||Array.from(((De=te.dataTransfer)==null?void 0:De.items)||[]).some(He=>String((He==null?void 0:He.type)||"").startsWith("image/")))||(te.preventDefault(),te.stopPropagation(),te.dataTransfer.dropEffect="copy",D(!0))},[l,L]),ue=m.useCallback(te=>{l==="image"&&(te.currentTarget.contains(te.relatedTarget)||D(!1))},[l]),le=m.useCallback(te=>{var ce;if(l!=="image")return;const ie=Array.from(((ce=te.dataTransfer)==null?void 0:ce.files)||[]).find(wp);ie&&(te.preventDefault(),te.stopPropagation(),D(!1),U(ie))},[l,U]);return a.jsxs("div",{className:"af-work-display-card"+(_?" af-work-display-card--sized":"")+(n?" af-work-display-card--selected":"")+(y?" af-work-display-card--resizing":"")+(A?" af-work-display-card--image-drop":"")+(T?" af-work-display-card--presentation":"")+(t!=null&&t.isExecuting?" af-work-display-card--executing":"")+((t==null?void 0:t.nodeStatus)==="success"?" af-work-display-card--done":"")+((t==null?void 0:t.nodeStatus)==="failed"?" af-work-display-card--failed":""),style:_?{width:_.width,height:_.height}:void 0,ref:c,onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,onDragOver:Z,onDragLeave:ue,onDrop:le,children:[a.jsx(dw,{className:"af-work-display-resize nodrag",position:"bottom-right",minWidth:320,minHeight:180,onResizeStart:()=>w(!0),onResizeEnd:()=>w(!1),children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_full"})}),s.map((te,ie)=>{if(te.showOnNode===!1)return null;const ce=`${4.15+ie*1.75}rem`,pe=te.name||`#${ie+1}`;return a.jsxs(m.Fragment,{children:[a.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:ce},children:pe}),a.jsx(Zn,{type:"target",position:$e.Left,id:`input-${ie}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:ce,background:Tn(te.type)},title:`${pe} · ${te.type}`})]},`in-${ie}`)}),o.map(({slot:te,idx:ie},ce)=>{if(te.showOnNode===!1)return null;const pe=`${4.15+ce*1.75}rem`,De=te.name||`#${ie+1}`;return a.jsxs(m.Fragment,{children:[a.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:pe},children:De}),a.jsx(Zn,{type:"source",position:$e.Right,id:`output-${ie}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:pe,background:Tn(te.type)},title:`${De} · ${te.type}`})]},`out-${ie}`)}),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:DP(l)}),a.jsx("strong",{children:O}),a.jsx("span",{children:(t==null?void 0:t.definitionId)||"display"})]}),l==="html"?a.jsxs("div",{className:"af-work-display-card__html-controls nodrag",onClick:te=>te.stopPropagation(),children:[a.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>{var te,ie,ce,pe;try{(pe=(ce=(ie=(te=u.current)==null?void 0:te.contentWindow)==null?void 0:ie.history)==null?void 0:ce.back)==null||pe.call(ce)}catch{}},"aria-label":"后退",title:"后退",children:a.jsx("span",{className:"material-symbols-outlined",children:"arrow_back"})}),a.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>{var te,ie,ce,pe;try{(pe=(ce=(ie=(te=u.current)==null?void 0:te.contentWindow)==null?void 0:ie.history)==null?void 0:ce.forward)==null||pe.call(ce)}catch{}},"aria-label":"前进",title:"前进",children:a.jsx("span",{className:"material-symbols-outlined",children:"arrow_forward"})}),a.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>f(te=>te+1),"aria-label":"刷新",title:"刷新",children:a.jsx("span",{className:"material-symbols-outlined",children:"refresh"})}),a.jsx("button",{type:"button",className:"af-work-display-card__action",disabled:d,onClick:Y,"aria-label":"截图另存为图片",title:"截图另存为图片",children:a.jsx("span",{className:"material-symbols-outlined",children:d?"hourglass_empty":"photo_camera"})})]}):null,l==="markdown"?k?a.jsxs("div",{className:"af-work-display-card__html-controls nodrag",onClick:te=>te.stopPropagation(),children:[a.jsx("button",{type:"button",className:"af-work-display-card__action",disabled:L||j,onClick:async()=>{var te,ie,ce;if($){try{const pe=await Hy((t==null?void 0:t.flowParams)||{},$,b);C(b),(te=t==null?void 0:t.onSetDisplayNodeContent)==null||te.call(t,e,pe,"replace",{logChat:!1,reloadDisplay:!0,statusMessage:`已更新 ${pe}`}),g(!1)}catch(pe){(ie=t==null?void 0:t.onStatus)==null||ie.call(t,String(pe.message||pe))}return}(ce=t==null?void 0:t.onSetDisplayNodeContent)==null||ce.call(t,e,b,"replace",{logChat:!1,statusMessage:"已更新 Markdown 内容"}),g(!1)},"aria-label":"保存并预览",title:"保存并预览",children:a.jsx("span",{className:"material-symbols-outlined",children:"done"})}),a.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>{x(String(P||"")),g(!1)},"aria-label":"取消编辑",title:"取消编辑",children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}):a.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:L||j,onClick:te=>{te.stopPropagation(),x(String(P||"")),g(!0)},"aria-label":"编辑 Markdown",title:"编辑 Markdown",children:a.jsx("span",{className:"material-symbols-outlined",children:"edit"})}):null,l==="image"?a.jsxs(a.Fragment,{children:[a.jsx("input",{ref:W,className:"af-hidden-file-input",type:"file",accept:"image/*",onChange:te=>{var ce;const ie=(ce=te.target.files)==null?void 0:ce[0];te.target.value="",ie&&U(ie)}}),a.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:L,onClick:te=>{var ie;te.stopPropagation(),(ie=W.current)==null||ie.click()},"aria-label":"上传图片",title:"上传图片",children:a.jsx("span",{className:"material-symbols-outlined",children:"upload"})})]}):null,a.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",onClick:te=>{var ie;te.stopPropagation(),(ie=t==null?void 0:t.onOpenDisplayPreview)==null||ie.call(t,I)},"aria-label":"全屏预览",title:"全屏预览",children:a.jsx("span",{className:"material-symbols-outlined",children:"fullscreen"})}),a.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:H,onClick:te=>{var ie;te.stopPropagation(),(ie=t==null?void 0:t.onShareDisplayNode)==null||ie.call(t,I)},"aria-label":"分享展示",title:"分享展示",children:a.jsx("span",{className:"material-symbols-outlined",children:H?"hourglass_empty":"ios_share"})}),a.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:L,onClick:V,"aria-label":"清空内容",title:"清空内容",children:a.jsx("span",{className:"material-symbols-outlined",children:"delete_sweep"})}),a.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:L,onClick:()=>{var te;return(te=t==null?void 0:t.onSaveDisplayNodeToFile)==null?void 0:te.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",disabled:L,onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),l==="markdown"&&k?a.jsx(WV,{value:b,onChange:x,onUploadImage:t==null?void 0:t.onUploadWorkspaceImage,readOnly:L}):a.jsx(zP,{data:t,flowParams:t==null?void 0:t.flowParams,htmlFrameRef:u,htmlFrameVersion:p}),a.jsx(VV,{nodeId:e,data:t})]})}function YV({id:e,data:t,selected:n,deleteNode:r}){var u,p,f;const s=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],i=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],o=((p=(u=t==null?void 0:t.runningRunNodeIds)==null?void 0:u.has)==null?void 0:p.call(u,e))||((f=t==null?void 0:t.runningRunNodeIds)==null?void 0:f[e])===!0||(t==null?void 0:t.isExecuting)||(t==null?void 0:t.nodeStatus)==="running";t==null||t.optimizingSchedule;const l=(t==null?void 0:t.nodeStatus)==="stopped",c=!!(t!=null&&t.readOnly);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":"")+(l?" af-work-run-card--stopped":""),onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,children:[s.map((d,h)=>{if(d.showOnNode===!1)return null;const y=`${2.25+h*1.75}rem`,w=d.name||`#${h+1}`;return a.jsxs(m.Fragment,{children:[a.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:y},children:w}),a.jsx(Zn,{type:"target",position:$e.Left,id:`input-${h}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:y,background:Tn(d.type)},title:`${w} · ${d.type}`})]},`in-${h}`)}),i.map((d,h)=>{if(d.showOnNode===!1)return null;const y=`${2.25+h*1.75}rem`,w=d.name||`#${h+1}`;return a.jsxs(m.Fragment,{children:[a.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:y},children:w}),a.jsx(Zn,{type:"source",position:$e.Right,id:`output-${h}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:y,background:Tn(d.type)},title:`${w} · ${d.type}`})]},`out-${h}`)}),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",disabled:c,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-run-card__actions",children:[a.jsxs("button",{type:"button",className:"af-work-run-card__button nodrag"+(o?" af-work-run-card__button--stop":""),disabled:c,onClick:d=>{var h,y;d.stopPropagation(),o?(h=t==null?void 0:t.onStopWorkspaceNode)==null||h.call(t,e):(y=t==null?void 0:t.onRunWorkspaceNode)==null||y.call(t,e)},children:[a.jsx("span",{className:"material-symbols-outlined",children:o?"stop_circle":"play_arrow"}),a.jsx("span",{children:o?"Stop":"Run line"})]}),a.jsxs("button",{type:"button",className:"af-work-run-card__button af-work-run-card__logs nodrag",onClick:d=>{var h;d.stopPropagation(),(h=t==null?void 0:t.onOpenWorkspaceRunLogs)==null||h.call(t,{nodeId:e,runNodeId:e,scheduleNodeId:"",label:(t==null?void 0:t.label)||"Run"})},children:[a.jsx("span",{className:"material-symbols-outlined",children:"article"}),a.jsx("span",{children:"Logs"})]})]})]})}function GV({id:e,data:t,selected:n,deleteNode:r}){var S,C,j;const s=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],i=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],o=Lw((t==null?void 0:t.body)||""),l=(t==null?void 0:t.scheduledRunState)||{},c=((C=(S=t==null?void 0:t.runningRunNodeIds)==null?void 0:S.has)==null?void 0:C.call(S,e))||((j=t==null?void 0:t.runningRunNodeIds)==null?void 0:j[e])===!0||(t==null?void 0:t.isExecuting)||(t==null?void 0:t.nodeStatus)==="running",u=(t==null?void 0:t.optimizingSchedule)===!0,p=(t==null?void 0:t.nodeStatus)==="stopped",f=!!(t!=null&&t.readOnly),d=E=>{var A;(A=t==null?void 0:t.onChangeScheduledRunConfig)==null||A.call(t,e,{...o,...E})},h=E=>{d({scheduleType:E,cron:Nc(E,o.time,o.weekday,o.monthDay,o.cron)})},y=E=>{d({time:E,cron:Nc(o.scheduleType,E,o.weekday,o.monthDay,o.cron)})},[w,k]=Mw(o.time).split(":"),g=(E,A)=>{y(`${Vi(E,9,0,23)}:${Vi(A,0,0,59)}`)},b=E=>{d({weekday:E,cron:Nc(o.scheduleType,o.time,E,o.monthDay,o.cron)})},x=E=>{d({monthDay:E,cron:Nc(o.scheduleType,o.time,o.weekday,E,o.cron)})};return a.jsxs("div",{className:"af-work-run-card af-work-schedule-card"+(n?" af-work-run-card--selected":"")+(o.enabled?" af-work-schedule-card--enabled":"")+(c?" af-work-run-card--running":"")+(t!=null&&t.isExecuting?" af-work-run-card--executing":"")+((t==null?void 0:t.nodeStatus)==="success"?" af-work-run-card--done":"")+((t==null?void 0:t.nodeStatus)==="failed"?" af-work-run-card--failed":"")+(p?" af-work-run-card--stopped":""),onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,children:[s.map((E,A)=>{if(E.showOnNode===!1)return null;const D=`${2.25+A*1.75}rem`,W=E.name||`#${A+1}`;return a.jsxs(m.Fragment,{children:[a.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:D},children:W}),a.jsx(Zn,{type:"target",position:$e.Left,id:`input-${A}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:D,background:Tn(E.type)},title:`${W} · ${E.type}`})]},`in-${A}`)}),i.map((E,A)=>{if(E.showOnNode===!1)return null;const D=`${2.25+A*1.75}rem`,W=E.name||`#${A+1}`;return a.jsxs(m.Fragment,{children:[a.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:D},children:W}),a.jsx(Zn,{type:"source",position:$e.Right,id:`output-${A}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:D,background:Tn(E.type)},title:`${W} · ${E.type}`})]},`out-${A}`)}),a.jsxs("div",{className:"af-work-run-card__head",children:[a.jsx("span",{className:"material-symbols-outlined",children:"event_repeat"}),a.jsx("strong",{children:(t==null?void 0:t.label)||"Scheduled Run"}),a.jsx("span",{children:(t==null?void 0:t.definitionId)||"workspace_scheduled_run"}),a.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",disabled:f,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-schedule-card__body nodrag",children:[a.jsxs("label",{className:"af-work-schedule-card__toggle",children:[a.jsx("input",{type:"checkbox",checked:o.enabled,disabled:f,onChange:E=>d({enabled:E.target.checked})}),a.jsx("span",{children:o.enabled?"定时开启":"定时关闭"})]}),a.jsxs("label",{className:"af-work-schedule-card__field",children:[a.jsx("span",{children:"频率"}),a.jsxs("select",{value:o.scheduleType,disabled:f,onChange:E=>h(E.target.value),children:[a.jsx("option",{value:"daily",children:"每天"}),a.jsx("option",{value:"weekly",children:"每周"}),a.jsx("option",{value:"monthly",children:"每月"}),a.jsx("option",{value:"custom",children:"高级 Cron"})]})]}),o.scheduleType!=="custom"?a.jsxs("label",{className:"af-work-schedule-card__field",children:[a.jsx("span",{children:"时间"}),a.jsxs("div",{className:"af-work-schedule-time-selects",children:[a.jsx("select",{value:w,disabled:f,"aria-label":"小时",onChange:E=>g(E.target.value,k),children:Array.from({length:24},(E,A)=>Vi(A,0,0,23)).map(E=>a.jsxs("option",{value:E,children:[E," 时"]},E))}),a.jsx("select",{value:k,disabled:f,"aria-label":"分钟",onChange:E=>g(w,E.target.value),children:Array.from({length:12},(E,A)=>Vi(A*5,0,0,59)).map(E=>a.jsxs("option",{value:E,children:[E," 分"]},E))})]})]}):null,o.scheduleType==="weekly"?a.jsxs("label",{className:"af-work-schedule-card__field",children:[a.jsx("span",{children:"星期"}),a.jsxs("select",{value:o.weekday,disabled:f,onChange:E=>b(E.target.value),children:[a.jsx("option",{value:1,children:"周一"}),a.jsx("option",{value:2,children:"周二"}),a.jsx("option",{value:3,children:"周三"}),a.jsx("option",{value:4,children:"周四"}),a.jsx("option",{value:5,children:"周五"}),a.jsx("option",{value:6,children:"周六"}),a.jsx("option",{value:0,children:"周日"})]})]}):null,o.scheduleType==="monthly"?a.jsxs("label",{className:"af-work-schedule-card__field",children:[a.jsx("span",{children:"日期"}),a.jsx("select",{value:o.monthDay,disabled:f,onChange:E=>x(E.target.value),children:Array.from({length:31},(E,A)=>A+1).map(E=>a.jsxs("option",{value:E,children:[E," 日"]},E))})]}):null,o.scheduleType==="custom"?a.jsxs("label",{className:"af-work-schedule-card__field",children:[a.jsx("span",{children:"Cron"}),a.jsx("input",{type:"text",value:o.cron,disabled:f,spellCheck:!1,placeholder:ku,onChange:E=>d({cron:E.target.value})})]}):null,a.jsxs("div",{className:"af-work-schedule-card__meta",children:[a.jsxs("span",{children:[wV(o.scheduleType)," ",o.scheduleType==="custom"?"":o.time]}),a.jsxs("span",{children:["Next ",xV(l.nextAt)]}),a.jsx("span",{children:c?"running":l.lastStatus||"idle"})]}),l.lastError?a.jsx("div",{className:"af-work-schedule-card__error",children:l.lastError}):null,a.jsxs("div",{className:"af-work-schedule-card__actions",children:[a.jsxs("button",{type:"button",className:"af-work-run-card__button af-work-schedule-card__run-now nodrag"+(c?" af-work-run-card__button--stop":""),disabled:f||u,onClick:E=>{var A,D;E.stopPropagation(),c?(A=t==null?void 0:t.onStopWorkspaceNode)==null||A.call(t,e):(D=t==null?void 0:t.onRunWorkspaceNode)==null||D.call(t,e)},children:[a.jsx("span",{className:"material-symbols-outlined",children:c?"stop_circle":"play_arrow"}),a.jsx("span",{children:c?"停止":"立即运行"})]}),a.jsxs("button",{type:"button",className:"af-work-run-card__button af-work-schedule-card__optimize nodrag"+(u?" af-work-schedule-card__optimize--running":""),disabled:f||c||u,title:"为下游节点提前生成 implementation",onClick:E=>{var A;E.stopPropagation(),(A=t==null?void 0:t.onOptimizeWorkspaceSchedule)==null||A.call(t,e)},children:[a.jsx("span",{className:"material-symbols-outlined",children:u?"sync":"auto_fix_high"}),a.jsx("span",{children:u?"优化中":"优化"})]}),a.jsxs("button",{type:"button",className:"af-work-run-card__button af-work-schedule-card__logs nodrag",onClick:E=>{var A;E.stopPropagation(),(A=t==null?void 0:t.onOpenWorkspaceRunLogs)==null||A.call(t,{nodeId:e,scheduleNodeId:e,runNodeId:l.targetRunNodeId||e,lastRunId:l.lastRunId||"",label:(t==null?void 0:t.label)||"Scheduled Run"})},children:[a.jsx("span",{className:"material-symbols-outlined",children:"article"}),a.jsx("span",{children:"日志"})]})]})]})]})}function XV({id:e,data:t,selected:n,deleteNode:r}){const{setNodes:s}=El(),i=!!(t!=null&&t.readOnly),o=Fy(t==null?void 0:t.nodeSize)||{width:Go,height:Xo},l=m.useCallback(c=>{var u,p;c.button!==0||c.metaKey||c.ctrlKey||c.shiftKey||(p=(u=c.target)==null?void 0:u.closest)!=null&&p.call(u,".af-work-group-node__resize, .af-work-group-node__delete")||s(f=>WP(f,e))},[e,s]);return a.jsxs("div",{className:"af-work-group-node"+(n?" af-work-group-node--selected":""),style:{width:o.width,height:o.height},onPointerDownCapture:l,children:[i?null:a.jsx(dw,{className:"af-work-group-node__resize nodrag",minWidth:Go,minHeight:Xo,position:"bottom-right",children:a.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})}),a.jsxs("div",{className:"af-work-group-node__title nodrag",children:[a.jsx("span",{children:(t==null?void 0:t.title)||(t==null?void 0:t.label)||"Group"}),a.jsx("button",{type:"button",className:"af-work-group-node__delete",disabled:i,onClick:c=>{c.stopPropagation(),r==null||r(e)},"aria-label":"删除分组",title:"删除分组",children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]})]})}function JV(e){var y,w,k,g,b,x,S,C,j,E,A,D,W,F,R;const{setEdges:t,setNodes:n}=El(),r=(y=e.data)==null?void 0:y.onSyncNodePropDraft,s=!!((w=e.data)!=null&&w.readOnly),[i,o]=m.useState(!1),l=(k=e.data)!=null&&k.nodeSize&&Number(e.data.nodeSize.width)>0&&Number(e.data.nodeSize.height)>0?{width:Number(e.data.nodeSize.width),height:Number(e.data.nodeSize.height)}:null,c=m.useCallback($=>{s||(n(P=>P.filter(L=>L.id!==$)),t(P=>P.filter(L=>L.source!==$&&L.target!==$)))},[s,t,n]),u=m.useCallback($=>{var P,L;$.button!==0||$.metaKey||$.ctrlKey||$.shiftKey||(L=(P=$.target)==null?void 0:P.closest)!=null&&L.call(P,".react-flow__handle, .af-work-display-resize")||(n(T=>WP(T,e.id)),t(T=>e7(T)))},[e.id,t,n]),p=m.useCallback(($,P)=>{s||(n(L=>L.map(T=>T.id===$?{...T,data:{...T.data,model:P}}:T)),r==null||r($,{model:P}))},[s,n,r]),f=m.useCallback(($,P)=>{s||(n(L=>L.map(T=>{var I;if(T.id!==$)return T;const O=Array.isArray((I=T.data)==null?void 0:I.outputs)&&T.data.outputs.length?T.data.outputs.map((H,_)=>_===0?{...H,default:P,value:P}:H):[{type:"bool",name:"value",default:P,value:P}];return{...T,data:{...T.data,body:"",outputs:O}}})),r==null||r($,L=>({body:"",outputs:Array.isArray(L==null?void 0:L.outputs)&&L.outputs.length?L.outputs.map((O,I)=>I===0?{...O,default:P,value:P}:O):[{type:"bool",name:"value",default:P,value:P}]})))},[s,n,r]),d=m.useCallback(($,P)=>{s||(n(L=>L.map(T=>T.id===$?{...T,data:{...T.data,body:P}}:T)),r==null||r($,{body:P}))},[s,n,r]),h=m.useCallback(($,P)=>{if(s)return;const L=ji(P);n(T=>T.map(O=>O.id===$?{...O,data:{...O.data,images:L}}:O)),r==null||r($,{images:L})},[s,n,r]);return(g=e.data)!=null&&g.isWorkspaceGroup?a.jsx(XV,{...e,deleteNode:c}):Dt((b=e.data)==null?void 0:b.definitionId)?a.jsx(qV,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c}):((x=e.data)==null?void 0:x.definitionId)==="workspace_run"?a.jsx(YV,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c}):((S=e.data)==null?void 0:S.definitionId)==="workspace_scheduled_run"?a.jsx(GV,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c}):((C=e.data)==null?void 0:C.definitionId)==="control_load_skills"?a.jsx(p7,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c,skills:(j=e.data)==null?void 0:j.skills,skillCollections:(E=e.data)==null?void 0:E.skillCollections,onChangeSkillKeys:(A=e.data)==null?void 0:A.onChangeLoadSkillKeys}):((D=e.data)==null?void 0:D.definitionId)==="control_load_mcp"?a.jsx(h7,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c,servers:(W=e.data)==null?void 0:W.mcpServers,onChangeMcpNames:(F=e.data)==null?void 0:F.onChangeLoadMcpNames}):a.jsxs("div",{className:"af-work-flow-node"+(e.selected?" af-work-flow-node--selected":"")+(i?" af-work-flow-node--resizing":""),style:l?{width:l.width,height:l.height}:void 0,onPointerDownCapture:u,children:[s?null:a.jsx(dw,{className:"af-work-display-resize af-work-flow-resize nodrag",position:"bottom-right",minWidth:SP,minHeight:xp,maxWidth:NP,maxHeight:jP,onResizeStart:()=>o(!0),onResizeEnd:()=>o(!1),children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_full"})}),a.jsx(e9,{...e,deleteNode:c,modelLists:(R=e.data)==null?void 0:R.modelLists,onModelChange:p,onProvideValueChange:f,onNodeBodyChange:d,onNodeImagesChange:h})]})}const QV={[vu]:JV};function $w(e,t=[]){for(const n of e||[])n.type==="file"&&t.push(n),Array.isArray(n.children)&&$w(n.children,t);return t}function HP(e,t){const n=String(t||"");if(!n)return null;for(const r of e||[]){if(r.path===n)return r;const s=Array.isArray(r.children)?HP(r.children,n):null;if(s)return s}return null}function ZV(e){const t=String(e||"").replace(/\\/g,"/").replace(/^\/+|\/+$/g,"");return!t||!t.includes("/")?"":t.split("/").slice(0,-1).join("/")}function BP(e,t=[]){for(const n of e||[])n.type==="directory"&&(t.push(n.path),Array.isArray(n.children)&&BP(n.children,t));return t}function tf(e){const t=String(e||"").replace(/\\/g,"/").split("/").filter(Boolean),n=[];for(let r=1;r<t.length;r++)n.push(t.slice(0,r).join("/"));return n}function WP(e,t){const n=String(t||"");let r=!1;const s=(e||[]).map(i=>{const o=i.id===n;return i.selected===o?i:(r=!0,{...i,selected:o})});return r?s:e}function e7(e){let t=!1;const n=(e||[]).map(r=>r.selected?(t=!0,{...r,selected:!1}):r);return t?n:e}function t7(e){return[...e||[]].sort((t,n)=>t.type!==n.type?t.type==="directory"?-1:1:String(t.name||"").localeCompare(String(n.name||"")))}function n7(e,t,n=0){const r=String(t||"").replace(/\\/g,"/").split("/").filter(Boolean);if(r.length===0)return e;const s=(i,o,l)=>{const c=r[o],u=l?`${l}/${c}`:c,p=o===r.length-1;let f=!1;const d=(Array.isArray(i)?i:[]).map(h=>h.name!==c?h:(f=!0,p?{...h,type:"file",name:c,path:u,icon:Va(c),size:n}:{...h,type:"directory",name:c,path:u,icon:Va(c,!0),children:s(h.children||[],o+1,u)}));return f||d.push(p?{type:"file",name:c,path:u,icon:Va(c),size:n}:{type:"directory",name:c,path:u,icon:Va(c,!0),children:s([],o+1,u)}),t7(d)};return s(e||[],0,"")}function r7(e){const t=Number(e||0);return!Number.isFinite(t)||t<=0?"":t<1024?`${t} B`:t<1024*1024?`${Math.round(t/102.4)/10} KB`:`${Math.round(t/1024/102.4)/10} MB`}function VP({items:e,onOpen:t,selectedPath:n,collapsedDirs:r,onToggleDir:s,onSelect:i,onFileDragStart:o}){return a.jsx("ul",{className:"af-work-files",children:(e||[]).map(l=>{var f;const c=l.type==="directory",u=c&&(r==null?void 0:r.has(l.path)),p=n===l.path;return a.jsxs("li",{children:[a.jsx("div",{className:"af-work-file-row",children:a.jsxs("button",{type:"button",className:"af-work-file af-work-file--"+l.type+(p?" af-work-file--selected":""),draggable:!c,onDragStart:d=>{c||o==null||o(d,l)},onClick:()=>{i==null||i(l),c&&(s==null||s(l.path))},onDoubleClick:()=>{c||t(l)},title:l.path,children:[c?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:l.icon||Va(l.name,c)}),a.jsx("span",{children:l.name})]})}),c&&!u&&((f=l.children)!=null&&f.length)?a.jsx(VP,{items:l.children,onOpen:t,selectedPath:n,collapsedDirs:r,onToggleDir:s,onSelect:i,onFileDragStart:o}):null]},l.path)})})}function s7({files:e,query:t,onQueryChange:n,onSelect:r,onUpload:s,onClose:i}){const o=m.useMemo(()=>$w(e),[e]),l=String(t||"").trim().toLowerCase(),c=o.filter(u=>l?`${u.path} ${u.name}`.toLowerCase().includes(l):!0);return a.jsx("div",{className:"af-flow-snippet-modal-overlay",onMouseDown:i,children:a.jsxs("div",{className:"af-flow-snippet-modal af-work-file-picker-modal",role:"dialog","aria-modal":"true","aria-label":"选择文件",onMouseDown:u=>u.stopPropagation(),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",children:"folder_open"}),"选择文件"]}),a.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:i,"aria-label":"关闭",children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsxs("div",{className:"af-flow-snippet-modal__body",children:[a.jsxs("div",{className:"af-work-file-picker-modal__tools",children:[a.jsx("input",{value:t,onChange:u=>n(u.target.value),placeholder:"搜索文件路径...",autoFocus:!0}),a.jsxs("button",{type:"button",onClick:()=>s==null?void 0:s(""),children:[a.jsx("span",{className:"material-symbols-outlined",children:"upload_file"}),"上传"]})]}),a.jsxs("div",{className:"af-work-file-picker-modal__list",children:[c.map(u=>a.jsxs("button",{type:"button",className:"af-work-file-picker-modal__item",onClick:()=>r(u),children:[a.jsx("span",{className:"material-symbols-outlined",children:u.icon||Va(u.name)}),a.jsxs("span",{className:"af-work-file-picker-modal__main",children:[a.jsx("strong",{children:u.name}),a.jsx("small",{children:u.path})]}),u.size?a.jsx("em",{children:r7(u.size)}):null]},u.path)),c.length===0?a.jsx("div",{className:"af-work-file-picker-modal__empty",children:"没有匹配文件,可先上传或调整搜索词。"}):null]})]})]})})}function i7({messages:e,running:t,showRunningIndicator:n=!0}){const r=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((s,i)=>{const o=s.kind==="run-log"||s.kind==="run-summary"||s.kind==="activity"||s.kind==="prompt"||s.kind==="raw"||s.kind==="thinking"||s.kind==="result"||s.kind==="assistant"?"reply":s.role==="user"?"user-msg":s.error?"error":"reply",l=s.kind==="run-summary"?"Steps":s.kind==="run-log"?"Run":s.kind==="activity"?"Activity":s.kind==="prompt"?"Prompt":s.kind==="raw"?"Raw Trace":s.kind==="thinking"?"Thinking":s.kind==="result"?"Result":s.kind==="assistant"?"Response":s.role==="user"?"You":s.error?"Error":"Reply";return a.jsxs("section",{className:`af-composer-ai-block af-composer-ai-block--${o}${s.kind?` af-composer-ai-block--kind-${s.kind}`:""}`,children:[a.jsx("div",{className:"af-composer-ai-block-label",children:l}),a.jsx("div",{className:"af-composer-ai-block-body",children:s.text})]},`${i}-${s.role}-${String(s.text||"").slice(0,24)}`)}),n&&t&&!r?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,n&&t&&r?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 Sp(e){const t=String(e||"").trim();if(!t)return[];try{const n=JSON.parse(t);if(Array.isArray(n))return n.map(String).filter(Boolean)}catch{}return t.split(/[\n,]+/).map(n=>n.trim()).filter(Boolean)}function o7(e){const t=Sp((e==null?void 0:e.body)||"");if(t.length>0)return t;const r=(Array.isArray(e==null?void 0:e.inputs)?e.inputs:[]).find(s=>(s==null?void 0:s.name)==="skillsContext"||(s==null?void 0:s.name)==="skillKeys"||(s==null?void 0:s.type)==="text");return Sp((r==null?void 0:r.default)||(r==null?void 0:r.value)||"")}function a7(e){return JSON.stringify(Array.from(new Set((e||[]).map(String).filter(Boolean))))}function l7(e){const t=Sp((e==null?void 0:e.body)||"");if(t.length>0)return t;const r=(Array.isArray(e==null?void 0:e.inputs)?e.inputs:[]).find(s=>(s==null?void 0:s.name)==="mcpContext"||(s==null?void 0:s.name)==="serverNames"||(s==null?void 0:s.type)==="text");return Sp((r==null?void 0:r.default)||(r==null?void 0:r.value)||"")}function c7(e){return JSON.stringify(Array.from(new Set((e||[]).map(String).filter(Boolean))))}function tN(e){var r,s,i,o,l,c,u,p,f;if(!e)return null;const{inputs:t,outputs:n}=f9(e);return{id:e.id,newId:e.id,label:String(((r=e.data)==null?void 0:r.label)??e.id),role:String(((s=e.data)==null?void 0:s.role)??"normal"),model:String(((i=e.data)==null?void 0:i.model)??""),body:String(((o=e.data)==null?void 0:o.body)??""),images:ji((l=e.data)==null?void 0:l.images),script:String(((c=e.data)==null?void 0:c.script)??""),scriptRef:String(((u=e.data)==null?void 0:u.scriptRef)??""),implementationRef:String(((p=e.data)==null?void 0:p.implementationRef)??""),implementationMode:String(((f=e.data)==null?void 0:f.implementationMode)??""),inputs:t,outputs:n}}function nN(e){return(Array.isArray(e)?e:[]).map(t=>({type:String((t==null?void 0:t.type)??"node").trim()||"node",name:String((t==null?void 0:t.name)??""),default:String((t==null?void 0:t.default)??""),required:!!(t!=null&&t.required),showOnNode:(t==null?void 0:t.showOnNode)!=null?t.showOnNode!==!1:!!(t!=null&&t.required)||String((t==null?void 0:t.type)??"node").trim().toLowerCase()==="node"}))}function u7(e,t,n){var p,f;const r=String(((p=e==null?void 0:e.data)==null?void 0:p.definitionId)??n),s=r.startsWith("provide_"),i=String((t==null?void 0:t.role)||"").trim(),o=wu.includes(i)?i:"normal",l=String((t==null?void 0:t.model)||"").trim(),c={...e.data,label:String((t==null?void 0:t.label)||"").trim()||n,role:o,model:l===""||l==="default"?void 0:l,body:s?"":String((t==null?void 0:t.body)??""),images:s?[]:ji(t==null?void 0:t.images),inputs:nN(t==null?void 0:t.inputs),outputs:s&&Array.isArray((f=e.data)==null?void 0:f.outputs)?e.data.outputs:nN(t==null?void 0:t.outputs)},u=String((t==null?void 0:t.script)??"").trim();r==="tool_nodejs"||u!==""?c.script=String((t==null?void 0:t.script)??""):delete c.script;for(const d of["scriptRef","implementationRef","implementationMode"]){const h=String((t==null?void 0:t[d])??"").trim();h?c[d]=h:delete c[d]}return c}function rN({nodes:e,edges:t,instances:n,selectedNode:r,draft:s,allowRename:i=!1}){if(!s||!r)return{ok:!1,error:""};const o=r.id,l=String(s.newId||"").trim(),c=i?l:o;if(i){if(!T9.test(c))return{ok:!1,error:"Invalid instance id"};if(e.some(w=>w.id===c&&w.id!==o))return{ok:!1,error:"Duplicate instance id"}}const u=u7(r,s,c),p=r.data||{};if(!(c!==o||p.label!==u.label||p.role!==u.role||p.model!==u.model||p.body!==u.body||JSON.stringify(ji(p.images))!==JSON.stringify(u.images)||(p.script??void 0)!==(u.script??void 0)||(p.scriptRef??void 0)!==(u.scriptRef??void 0)||(p.implementationRef??void 0)!==(u.implementationRef??void 0)||(p.implementationMode??void 0)!==(u.implementationMode??void 0)||JSON.stringify(p.inputs||[])!==JSON.stringify(u.inputs||[])||JSON.stringify(p.outputs||[])!==JSON.stringify(u.outputs||[])))return{ok:!0,changed:!1,nextId:c,nodes:e,edges:t,instances:n};const d=e.map(w=>w.id===o?{...w,id:c,selected:!0,data:u}:w);let h=t,y=n;if(c!==o){y={...n||{}};const w={...y[o]||{}};delete y[o],y[c]=w,h=t.map((k,g)=>({...k,source:k.source===o?c:k.source,target:k.target===o?c:k.target,id:`we-${k.source===o?c:k.source}-${k.target===o?c:k.target}-${g}`}))}return{ok:!0,changed:!0,nextId:c,nodes:d,edges:h,instances:y}}function d7(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}function f7(e,t,n){if(!e||!t||!n)return n;const r={...e};for(const s of["newId","label","role","model","body","images","script","scriptRef","implementationRef","implementationMode","inputs","outputs"])d7(e[s],t[s])&&(r[s]=n[s]);return r}function p7({id:e,data:t,selected:n,deleteNode:r,skills:s,skillCollections:i,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:[],u=Array.isArray(s)?s:[],p=Array.isArray(i)?i:[],[f,d]=m.useState(!1),[h,y]=m.useState(""),[w,k]=m.useState(()=>new Set),g=m.useRef(null),b=m.useRef(null),[x,S]=m.useState({visible:!1,top:0,height:100}),C=m.useMemo(()=>new Set(o7(t)),[t]),j=m.useMemo(()=>new Map(u.map(L=>[L.key,L])),[u]),E=m.useMemo(()=>{const L=new Set,T=p.map(I=>{const H=dl(I,u).map(_=>j.get(_)).filter(Boolean);for(const _ of H)L.add(_.key);return{...I,skills:H}}).filter(I=>I.skills.length>0),O=u.filter(I=>!L.has(I.key));return{collectionGroups:T,ungrouped:O}},[j,p,u]);m.useEffect(()=>{k(L=>{let T=!1;const O=new Set(L);for(const I of E.collectionGroups)O.has(I.id)||(O.add(I.id),T=!0);return T?O:L})},[E.collectionGroups]);const A=m.useMemo(()=>{const L=h.trim().toLowerCase();if(!L)return E;const T=I=>[I==null?void 0:I.key,I==null?void 0:I.name,I==null?void 0:I.description].map(_=>String(_||"").toLowerCase()).join(" ").includes(L);return{collectionGroups:E.collectionGroups.map(I=>{const _=[I==null?void 0:I.id,I==null?void 0:I.name,I==null?void 0:I.description].map(Y=>String(Y||"").toLowerCase()).join(" ").includes(L)?I.skills:I.skills.filter(T);return{...I,skills:_}}).filter(I=>I.skills.length>0),ungrouped:E.ungrouped.filter(T)}},[E,h]),D=m.useCallback((L,T)=>{const O=new Set(C);for(const I of L)T?O.add(I):O.delete(I);o==null||o(e,Array.from(O))},[e,C,o]),W=m.useCallback(L=>{k(T=>{const O=new Set(T);return O.has(L)?O.delete(L):O.add(L),O})},[]),F=m.useCallback(()=>{const L=g.current;if(!L)return;const T=Math.max(1,L.scrollHeight),O=Math.max(1,L.clientHeight),I=T>O+1,H=I?Math.max(12,O/T*100):100,_=Math.max(0,100-H),Y=I?Math.min(_,L.scrollTop/Math.max(1,T-O)*_):0;S({visible:I,top:Y,height:H})},[]);m.useEffect(()=>{if(!f)return;const L=requestAnimationFrame(F);return()=>cancelAnimationFrame(L)},[w,A,C.size,f,F]);const R=m.useCallback(L=>{const T=g.current;if(!T)return;const O=Math.max(0,T.scrollHeight-T.clientHeight);T.scrollTop=Math.min(1,Math.max(0,L))*O,F()},[F]),$=m.useCallback((L,T=0)=>{const O=b.current;if(!O)return 0;const I=O.getBoundingClientRect(),H=x.height/100*I.height,_=Math.max(1,I.height-H);return(L-I.top-T)/_},[x.height]),P=m.useCallback(L=>{var ue,le;if(!x.visible)return;L.preventDefault(),L.stopPropagation();const T=b.current;if(!T)return;const O=T.getBoundingClientRect(),I=x.top/100*O.height,H=x.height/100*O.height,Y=L.clientY>=O.top+I&&L.clientY<=O.top+I+H?L.clientY-O.top-I:H/2;R($(L.clientY,Y));const U=L.pointerId;(le=(ue=L.currentTarget).setPointerCapture)==null||le.call(ue,U);const V=we=>{we.preventDefault(),R($(we.clientY,Y))},Z=()=>{window.removeEventListener("pointermove",V),window.removeEventListener("pointerup",Z),window.removeEventListener("pointercancel",Z)};window.addEventListener("pointermove",V),window.addEventListener("pointerup",Z),window.addEventListener("pointercancel",Z)},[$,R,x.height,x.top,x.visible]);return a.jsxs("div",{className:"af-work-load-skills-card"+(n?" af-work-load-skills-card--selected":""),onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,children:[l.map((L,T)=>{if(L.showOnNode===!1)return null;const O=`${2.6+T*1.7}rem`,I=L.name||`#${T+1}`;return a.jsxs(m.Fragment,{children:[a.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:O},children:I}),a.jsx(Zn,{type:"target",position:$e.Left,id:`input-${T}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:O,background:Tn(L.type)},title:`${I} · ${L.type}`})]},`in-${T}`)}),c.map((L,T)=>{if(L.showOnNode===!1)return null;const O=`${2.6+T*1.7}rem`,I=L.name||`#${T+1}`;return a.jsxs(m.Fragment,{children:[a.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:O},children:I}),a.jsx(Zn,{type:"source",position:$e.Right,id:`output-${T}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:O,background:Tn(L.type)},title:`${I} · ${L.type}`})]},`out-${T}`)}),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:L=>{var T;L.stopPropagation(),f||(T=t==null?void 0:t.onRefreshSkills)==null||T.call(t),d(O=>!O)},children:[a.jsx("span",{children:C.size>0?`${C.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:L=>L.stopPropagation(),children:[a.jsxs("div",{className:"af-work-load-skills-search",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),a.jsx("input",{type:"search",value:h,onChange:L=>y(L.target.value),placeholder:"搜索 Skills...",spellCheck:!1,autoComplete:"off","aria-label":"搜索 Skills"}),h?a.jsx("button",{type:"button",onClick:()=>y(""),"aria-label":"清空搜索",children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),a.jsxs("div",{ref:g,className:"af-work-load-skills-menu",onScroll:F,children:[A.collectionGroups.map(L=>{const T=L.skills.map(_=>_.key),O=T.filter(_=>C.has(_)).length,I=T.length>0&&O===T.length,H=w.has(L.id);return a.jsxs("section",{className:"af-work-load-skills-menu__group"+(H?" af-work-load-skills-menu__group--collapsed":""),children:[a.jsxs("div",{className:"af-work-load-skills-menu__group-head",children:[a.jsx("input",{type:"checkbox",checked:I,onChange:_=>D(T,_.target.checked),"aria-label":`选择 ${L.name}`}),a.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-toggle",onClick:()=>W(L.id),"aria-expanded":!H,children:a.jsxs("span",{className:"af-work-load-skills-menu__group-main",children:[a.jsx("span",{children:L.name}),L.description?a.jsx("em",{children:L.description}):null]})}),a.jsxs("small",{children:[O,"/",T.length]}),a.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-arrow",onClick:()=>W(L.id),"aria-label":H?`展开 ${L.name}`:`收起 ${L.name}`,children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:H?"chevron_right":"expand_more"})})]}),H?null:a.jsx("div",{className:"af-work-load-skills-menu__options",children:L.skills.map(_=>a.jsxs("label",{className:"af-work-load-skills-menu__option",children:[a.jsx("input",{type:"checkbox",checked:C.has(_.key),onChange:Y=>D([_.key],Y.target.checked)}),a.jsxs("span",{className:"af-work-load-skills-menu__option-main",children:[a.jsx("span",{className:"af-work-load-skills-menu__option-title",children:_.name}),_.description?a.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:_.description}):null]})]},`${L.id}:${_.key}`))})]},L.id)}),A.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:A.ungrouped.length})]}),a.jsx("div",{className:"af-work-load-skills-menu__options",children:A.ungrouped.map(L=>a.jsxs("label",{className:"af-work-load-skills-menu__option",children:[a.jsx("input",{type:"checkbox",checked:C.has(L.key),onChange:T=>D([L.key],T.target.checked)}),a.jsxs("span",{className:"af-work-load-skills-menu__option-main",children:[a.jsx("span",{className:"af-work-load-skills-menu__option-title",children:L.name}),L.description?a.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:L.description}):null]})]},`ungrouped:${L.key}`))})]}):null,A.collectionGroups.length===0&&A.ungrouped.length===0?a.jsx("div",{className:"af-work-load-skills-menu__empty",children:"没有匹配的 Skills"}):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:b,className:"af-work-load-skills-scrollbar"+(x.visible?" af-work-load-skills-scrollbar--visible":""),onPointerDown:P,"aria-hidden":"true",children:a.jsx("span",{style:{height:`${x.height}%`,top:`${x.top}%`}})})]}):null]})]})}function h7({id:e,data:t,selected:n,deleteNode:r,servers:s=[],onChangeMcpNames:i}){const o=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],l=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],[c,u]=m.useState(!1),[p,f]=m.useState(""),d=m.useMemo(()=>new Set(l7(t)),[t]),h=m.useMemo(()=>(Array.isArray(s)?s:[]).map(k=>({name:String((k==null?void 0:k.name)||""),description:String((k==null?void 0:k.description)||""),detail:String((k==null?void 0:k.url)||[k==null?void 0:k.command,...Array.isArray(k==null?void 0:k.args)?k.args:[]].filter(Boolean).join(" ")||""),type:String((k==null?void 0:k.type)||"")})).filter(k=>k.name),[s]),y=m.useMemo(()=>{const k=p.trim().toLowerCase();return k?h.filter(g=>[g.name,g.description,g.detail,g.type].join(" ").toLowerCase().includes(k)):h},[p,h]),w=m.useCallback((k,g)=>{const b=new Set(d);for(const x of k)g?b.add(x):b.delete(x);i==null||i(e,Array.from(b))},[e,d,i]);return a.jsxs("div",{className:"af-work-load-skills-card"+(n?" af-work-load-skills-card--selected":""),onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,children:[o.map((k,g)=>{if(k.showOnNode===!1)return null;const b=`${2.6+g*1.7}rem`,x=k.name||`#${g+1}`;return a.jsxs(m.Fragment,{children:[a.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:b},children:x}),a.jsx(Zn,{type:"target",position:$e.Left,id:`input-${g}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:b,background:Tn(k.type)},title:`${x} · ${k.type}`})]},`in-${g}`)}),l.map((k,g)=>{if(k.showOnNode===!1)return null;const b=`${2.6+g*1.7}rem`,x=k.name||`#${g+1}`;return a.jsxs(m.Fragment,{children:[a.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:b},children:x}),a.jsx(Zn,{type:"source",position:$e.Right,id:`output-${g}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:b,background:Tn(k.type)},title:`${x} · ${k.type}`})]},`out-${g}`)}),a.jsxs("div",{className:"af-work-load-skills-card__head",children:[a.jsx("span",{className:"material-symbols-outlined",children:"hub"}),a.jsx("strong",{children:(t==null?void 0:t.label)||"Load MCP"}),a.jsx("span",{children:(t==null?void 0:t.definitionId)||"control_load_mcp"}),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:k=>{var g;k.stopPropagation(),c||(g=t==null?void 0:t.onRefreshMcps)==null||g.call(t),u(b=>!b)},children:[a.jsx("span",{children:d.size>0?`${d.size} MCP selected`:"选择 MCP"}),a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:c?"expand_less":"expand_more"})]}),c?a.jsxs("div",{className:"af-work-load-skills-menu-shell",onClick:k=>k.stopPropagation(),children:[a.jsxs("div",{className:"af-work-load-skills-search",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),a.jsx("input",{type:"search",value:p,onChange:k=>f(k.target.value),placeholder:"搜索 MCP...",spellCheck:!1,autoComplete:"off","aria-label":"搜索 MCP"}),p?a.jsx("button",{type:"button",onClick:()=>f(""),"aria-label":"清空搜索",children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),a.jsxs("div",{className:"af-work-load-skills-menu",children:[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:"MCP Servers"}),a.jsx("small",{children:y.length})]}),a.jsx("div",{className:"af-work-load-skills-menu__options",children:y.map(k=>a.jsxs("label",{className:"af-work-load-skills-menu__option",children:[a.jsx("input",{type:"checkbox",checked:d.has(k.name),onChange:g=>w([k.name],g.target.checked)}),a.jsxs("span",{className:"af-work-load-skills-menu__option-main",children:[a.jsx("span",{className:"af-work-load-skills-menu__option-title",children:k.name}),k.description||k.detail?a.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:k.description||k.detail}):null]})]},k.name))})]}),y.length===0?a.jsx("div",{className:"af-work-load-skills-menu__empty",children:"没有匹配的 MCP"}):null,a.jsx("button",{type:"button",className:"af-work-load-skills-menu__clear",onClick:()=>i==null?void 0:i(e,[]),children:"清空"})]})]}):null]})]})}function m7(){var av,lv;const{t:e,i18n:t}=dr(),{navigate:n}=Js(),r=El(),s=L3(),i=m.useMemo(G9,[]),[o,l]=m.useState(()=>new URLSearchParams(window.location.search).get("view")==="display"?"display":"workspace"),[c,u]=m.useState(!1),[p,f]=m.useState(!1),[d,h]=$3([]),[y,w,k]=O3([]),g=m.useRef([]),b=m.useRef([]),x=m.useRef(null),[S,C]=m.useState(()=>zy(null,[])),j=m.useRef(S),[E,A]=m.useState(null),D=m.useRef(null),[W,F]=m.useState([]),R=m.useRef(new Map),$=m.useRef(new Map),P=m.useRef(null),L=m.useRef(null),T=m.useRef(null),[O,I]=m.useState(null),[H,_]=m.useState({}),Y=m.useRef({}),U=m.useRef(!1),V=m.useRef(null),[Z,ue]=m.useState([]),[le,we]=m.useState(""),[re,ye]=m.useState("nodes"),[te,ie]=m.useState([]),[ce,pe]=m.useState(!1),[De,He]=m.useState(""),[Ie,et]=m.useState(!1),[ut,Ae]=m.useState({name:"",id:"",description:""}),[Qe,qt]=m.useState(!1),[Te,Ht]=m.useState(""),[st,dn]=m.useState(""),ne=m.useRef(null),[me,Oe]=m.useState(!1),[Fe,Ve]=m.useState(!1),[Et,Lt]=m.useState(""),[tt,fn]=m.useState(null),[kt,Nt]=m.useState(()=>Km()),[tn,nn]=m.useState(""),[tr,Fn]=m.useState(!1),[Vn,gn]=m.useState(""),[Yt,kn]=m.useState(!1),[yn,Sn]=m.useState([]),[Nn,Kn]=m.useState(!1),[ns,Un]=m.useState(""),[fr,Wr]=m.useState(""),[Vr,jr]=m.useState(""),[rs,an]=m.useState(!1),[Cr,ee]=m.useState(""),[be,Q]=m.useState(""),[oe,Pe]=m.useState(!1),[Be,jt]=m.useState("nodes"),[jn,nr]=m.useState(""),[Cn,Mn]=m.useState(0),[xn,ze]=m.useState(""),Rt=m.useRef(""),[Ce,En]=m.useState(null),Ke=m.useRef(null),[Er,ss]=m.useState(""),[is,fo]=m.useState([]),[ta,$l]=m.useState(""),[ke,Ol]=m.useState(!0),[Ei,na]=m.useState(""),[ra,os]=m.useState(()=>new Set),[as,po]=m.useState(""),[B,ae]=m.useState({nodeId:"",query:""}),[je,Ne]=m.useState(!1),We=m.useRef(null),Mt=m.useRef(null),yt=m.useRef(""),[_n,ls]=m.useState(()=>{try{const v=Number(window.localStorage.getItem("agentflow.workspace.filesPaneHeight")||0);if(Number.isFinite(v)&&v>=160)return v}catch{}return 360}),[ho,_i]=m.useState(!1),[sa,RA]=m.useState({cursor:[],opencode:[],claudeCode:[]}),[ei,MA]=m.useState(""),[cs,LA]=m.useState([]),[Xw,Jw]=m.useState(!1),[us,Dl]=m.useState([]),[ia,$A]=m.useState([]),[Qw,OA]=m.useState(!1),[Zw,eb]=m.useState([]),tb=m.useCallback(v=>{ne.current&&window.clearTimeout(ne.current),dn(v),ne.current=window.setTimeout(()=>{dn(""),ne.current=null},3800)},[]),qu=m.useCallback(v=>{const N=String(v||"").trim();if(!N)return;const M=()=>s(N);window.requestAnimationFrame(M),window.setTimeout(M,80)},[s]);m.useEffect(()=>{try{window.localStorage.setItem("agentflow.workspace.filesPaneHeight",String(Math.round(_n)))}catch{}},[_n]);const bh=m.useCallback(v=>{const N=We.current;if(!N)return;const M=N.getBoundingClientRect(),z=16,K=150,G=230,J=M.top+z,X=M.bottom-z,q=Math.max(K,X-J-G),se=Math.min(Math.max(v-J,K),q);ls(se)},[]),DA=m.useCallback(v=>{v.preventDefault(),v.stopPropagation(),_i(!0),bh(v.clientY);const N=z=>{z.preventDefault(),bh(z.clientY)},M=()=>{_i(!1),window.removeEventListener("pointermove",N,!0),window.removeEventListener("pointerup",M,!0),window.removeEventListener("pointercancel",M,!0)};window.addEventListener("pointermove",N,!0),window.addEventListener("pointerup",M,!0),window.addEventListener("pointercancel",M,!0)},[bh]);m.useEffect(()=>()=>{ne.current&&window.clearTimeout(ne.current)},[]);const[FA,nb]=m.useState(()=>new Set),[Yu,vh]=m.useState(!1),kh=m.useRef(null),rb=m.useRef(null),sb=m.useRef(null),[zA,HA]=m.useState({}),[Fl,ib]=m.useState(""),[Kr,ob]=m.useState(!1),[ab,Gu]=m.useState([]),[lb,Ur]=m.useState([]),[Sh,zl]=m.useState("workspace"),[Nh,Hl]=m.useState(!1),[Bl,Wl]=m.useState(null),[BA,jh]=m.useState(!0),[cb,ub]=m.useState(""),[oa,aa]=m.useState({}),[rr,db]=m.useState(null),[fb,pb]=m.useState(!1),la=m.useMemo(()=>fb?J9(rr):"",[fb,rr]),[Vl,Xu]=m.useState(!0);m.useEffect(()=>{la&&Xu(Q9(la))},[la]),m.useEffect(()=>{if(la)try{window.localStorage.setItem(la,Vl?"true":"false")}catch{}},[Vl,la]);const[Ch,Ju]=m.useState(!1),[Eh,hb]=m.useState(!1),[_h,mb]=m.useState("pan"),[gb,WA]=m.useState({}),Kl=m.useRef({}),[yb,mo]=m.useState({}),Ul=m.useRef(new Map),ca=m.useRef(new Set),[xb,ua]=m.useState(()=>new Set),[Ph,da]=m.useState({}),[wb,bb]=m.useState(""),[VA,de]=m.useState(""),ti=m.useMemo(()=>X9(i),[i]),[vb,kb]=m.useState(""),Qu=i.flowSource||"user",Sb=m.useMemo(()=>new Set(Object.values(gb||{}).map(v=>String((v==null?void 0:v.runNodeId)||"").trim()).filter(Boolean)),[gb]),go=m.useCallback(v=>{const N=Kl.current||{},M=typeof v=="function"?v(N):v,z=M&&typeof M=="object"&&!Array.isArray(M)?M:{};return Kl.current=z,WA(z),z},[]),Nb=!!(i.flowId&&!i.archived&&(Qu==="user"||Qu==="workspace"));m.useEffect(()=>{i.flowId&&bM(i.flowId,i.flowSource||"user","workspace",!!i.archived)},[i]),m.useEffect(()=>{const v=()=>{l(new URLSearchParams(window.location.search).get("view")==="display"?"display":"workspace")};return window.addEventListener("popstate",v),()=>window.removeEventListener("popstate",v)},[]),m.useEffect(()=>{Gu([]),Ur([]),zl("workspace"),jh(!0)},[i]);const Pn=m.useCallback(async()=>{const v=Os(i),N=await fetch(`/api/workspace/files?${v.toString()}`),M=await N.json();if(!N.ok)throw new Error(M.error||"读取 workspace 失败");const z=M.files||[];fo(z),os(new Set(BP(z))),$l(M.root||"")},[i]),Zu=m.useCallback(async()=>{pe(!0),He("");try{const v=await fetch("/api/marketplace/flow-snippets"),N=await v.json().catch(()=>({}));if(!v.ok)throw new Error(N.error||"读取流程片段失败");ie(Array.isArray(N.snippets)?N.snippets:[])}catch(v){He(String(v.message||v)),ie([])}finally{pe(!1)}},[]),Bt=m.useCallback(async(v=d,N=y)=>{var G;if(!U.current)return;if(!ke)throw de("Readonly workspace"),new Error("Readonly workspace");const M=dc(v,N,Y.current);M.ui={...M.ui||{},...D.current?{viewport:D.current}:{},displayPage:SV(j.current,v)};const z=await fetch("/api/workspace/graph",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,graph:M})}),K=await z.json();if(!z.ok)throw new Error(K.error||"保存 workspace graph 失败");Y.current=((G=K.graph)==null?void 0:G.instances)||M.instances,_(Y.current),mo(Qd(K.workspaceSchedules||[])),de("Workspace graph saved")},[y,i,d,ke]),KA=m.useCallback(v=>{var M;const N=(M=v==null?void 0:v.extra)!=null&&M.instances&&typeof v.extra.instances=="object"?v.extra.instances:{};Y.current=N,_(N),h(Array.isArray(v==null?void 0:v.nodes)?v.nodes:[]),w(Array.isArray(v==null?void 0:v.edges)?v.edges:[]),ze(""),I(null)},[w,h]),UA=m.useMemo(()=>({instances:H}),[H]),qA=F9({nodes:d,edges:y,extra:UA,enabled:U.current,onRestore:KA}),{resetHistory:ed,undo:jb,redo:Cb}=qA,fa=m.useCallback(async()=>{var qe,Ge;U.current=!1;const v=Os(i),N=Os(i);N.set("lang",String(t.language||"zh").startsWith("zh")?"zh":"en");const[M,z]=await Promise.all([fetch(`/api/nodes?${N.toString()}`),fetch(`/api/workspace/graph?${v.toString()}`),Pn()]),K=await M.json(),G=await z.json();if(!M.ok)throw new Error(K.error||"读取节点定义失败");if(!z.ok)throw new Error(G.error||"读取 workspace graph 失败");const J=[...(Array.isArray(K)?K:K.nodes||[]).filter(wt=>!H9.has(wt.id)),V9,K9,B9,W9];ue(J);const X=G.graph||JSON.parse(localStorage.getItem(z9)||"null")||{},q=ef(X,J),se=zy((qe=X==null?void 0:X.ui)==null?void 0:qe.displayPage,q.nodes),he=TP((Ge=X==null?void 0:X.ui)==null?void 0:Ge.viewport);Y.current=q.instances,_(q.instances),h(q.nodes),w(q.edges),mo(Qd(G.workspaceSchedules||[])),C(se),j.current=se,A(he),D.current=he,F([]),ed(q.nodes,q.edges,{instances:q.instances});const Se=G.writable!==!1;Ol(Se),de(Se?"Workspace ready":"Readonly workspace"),U.current=!0},[i,t.language,Pn,ed,w,h]),YA=m.useCallback(async(v,N)=>{const M={packageId:(v==null?void 0:v.newId)||(v==null?void 0:v.id)||(v==null?void 0:v.label),label:(v==null?void 0:v.label)||(v==null?void 0:v.newId)||(v==null?void 0:v.id),version:"1.0.0",definitionId:N,body:(v==null?void 0:v.body)||"",script:(v==null?void 0:v.script)||"",scriptRef:(v==null?void 0:v.scriptRef)||"",implementationRef:(v==null?void 0:v.implementationRef)||"",implementationMode:(v==null?void 0:v.implementationMode)||"",inputs:Array.isArray(v==null?void 0:v.inputs)?v.inputs:[],outputs:Array.isArray(v==null?void 0:v.outputs)?v.outputs:[],flowId:i.flowId,flowSource:i.flowSource||"user",archived:!!i.archived},z=await fetch("/api/marketplace/publish-node-from-instance",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(M)}),K=await z.json().catch(()=>({}));if(!z.ok||(K==null?void 0:K.ok)===!1)throw new Error((K==null?void 0:K.error)||"Publish failed");return await fa(),de(`Published node ${K.definitionId||K.id||M.packageId}`),K},[i,fa]),Eb=m.useCallback((v="workspace")=>{Hl(!0),Wl(null),En(null),zl(v||"workspace")},[]),_b=m.useCallback((v={})=>{Wl({scheduleNodeId:String(v.scheduleNodeId||""),runNodeId:String(v.runNodeId||v.nodeId||""),lastRunId:String(v.lastRunId||""),label:String(v.label||"")}),Hl(!1),En(null),ze("")},[]),Pb=m.useCallback(async(v="")=>{const N=String(v||"").trim();if(!(!N||!ke)){bb(N),de(`Optimizing scheduled run: ${N}`);try{await Bt(g.current,b.current);const M=dc(g.current,b.current,Y.current),z=await fetch("/api/workspace/run/optimize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,runNodeId:N,graph:M,model:ei||""})}),K=await z.json().catch(()=>({}));if(!z.ok||K.ok===!1)throw new Error(K.error||"优化失败");const G=K.graph||M,J=ef(G,Z);Y.current=J.instances,_(J.instances),h(J.nodes),w(J.edges),mo(Qd(K.workspaceSchedules||[])),ed(J.nodes,J.edges,{instances:J.instances});const X=Array.isArray(K.optimized)?K.optimized.length:0;de(X>0?`已生成 ${X} 个 implementation`:"没有需要优化的节点")}catch(M){de(String(M.message||M))}finally{bb("")}}},[ei,b,i,g,Z,ed,Bt,w,h,ke]),Ab=m.useCallback(async(v="")=>{const N=String(v||"").trim(),M=Kl.current||{},z=Object.entries(M).find(([se,he])=>se===N||String((he==null?void 0:he.runNodeId)||"")===N)||Object.entries(M)[0]||null,K=(z==null?void 0:z[0])||"",G=(z==null?void 0:z[1])||null,J=String((G==null?void 0:G.runNodeId)||N||"").trim(),X=new Set([J,...Array.isArray(G==null?void 0:G.plannedNodeIds)?G.plannedNodeIds:[]].map(se=>String(se||"").trim()).filter(Boolean));K&&ca.current.add(K);const q=K?Ul.current.get(K):null;q&&(q.abort(),Ul.current.delete(K)),K&&go(se=>{const he={...se};return delete he[K],he}),ua(se=>{const he=new Set(se);for(const Se of X)he.delete(Se);return he}),da(se=>{var Se;const he={...se};for(const qe of X)qe&&(!he[qe]||((Se=he[qe])==null?void 0:Se.status)==="running")&&(he[qe]={status:"stopped"});return he}),de(J?`Workspace run stopped: ${J}`:"Workspace run stopped"),Ur(se=>se.map(he=>(K?he.id===K:!J||he.runNodeId===J)&&he.status==="running"?{...he,status:"stopped",endedAt:Date.now(),messages:[...Array.isArray(he.messages)?he.messages:[],{role:"assistant",kind:"status",text:"Workspace run stopped.",at:Date.now()}].slice(-160)}:he));try{await fetch("/api/workspace/run/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,runId:K,runNodeId:J})})}catch{}},[i,go]),Ib=m.useCallback(async()=>{if(i.flowId)try{const v=Os(i),N=await fetch(`/api/workspace/run/status?${v.toString()}`),M=await N.json().catch(()=>({}));if(!N.ok||!M.running)return;const z=Array.isArray(M.runs)&&M.runs.length?M.runs:[{runId:`run-restored-${M.startedAt||Date.now()}`,runNodeId:M.runNodeId||"",startedAt:M.startedAt||Date.now(),plannedNodeIds:[]}],K={},G=[];for(const J of z){const X=String((J==null?void 0:J.runNodeId)||"").trim(),q=String((J==null?void 0:J.runId)||`run-restored-${(J==null?void 0:J.startedAt)||Date.now()}-${X}`).trim();q&&(K[q]={id:q,runNodeId:X,plannedNodeIds:Array.isArray(J==null?void 0:J.plannedNodeIds)?J.plannedNodeIds:[],startedAt:(J==null?void 0:J.startedAt)||Date.now()},X&&G.push(X))}if(!Object.keys(K).length)return;go(J=>({...J,...K})),ua(J=>{const X=new Set(J);for(const q of G)X.add(q);return X}),da(J=>{const X={...J};for(const q of G)X[q]={status:"running"};return X}),de(G.length?`Workspace run still running: ${G.join(", ")}`:"Workspace run still running"),Ur(J=>{const X=[...J];for(const[q,se]of Object.entries(K)){if(X.some(Se=>Se.id===q||Se.status==="running"&&Se.runNodeId===se.runNodeId))continue;const he=String(se.runNodeId||"");X.push({id:q,label:he?`Run ${he}`:"Workspace Run",runNodeId:he,status:"running",startedAt:se.startedAt||Date.now(),steps:he?[{id:he,label:he,status:"running"}]:[],messages:[{role:"assistant",kind:"run-summary",text:"Workspace run is still running in the background.",at:Date.now()}]})}return[...X.slice(-8)]})}catch{}},[i,go]),Tb=m.useCallback(async v=>{if(!ke){de("Readonly workspace");return}if(!v)return;if(Object.values(Kl.current||{}).find(_e=>String((_e==null?void 0:_e.runNodeId)||"")===String(v||""))){de(`Workspace run already running: ${v}`);return}let M=d,z=y,K=Y.current;const G=Ke.current;if(G!=null&&G.id){const _e=M.find(Ue=>Ue.id===G.id),Ee=rN({nodes:M,edges:z,instances:K,selectedNode:_e,draft:G,allowRename:!1});if(Ee!=null&&Ee.error){ss(Ee.error),de(Ee.error);return}Ee!=null&&Ee.ok&&Ee.changed&&(M=Ee.nodes,z=Ee.edges,K=Ee.instances,Y.current=K,_(K),h(M),w(z),qu(Ee.nextId||G.id))}const J=dc(M,z,K),X=`run-${Date.now()}-${String(v).replace(/[^a-z0-9_-]+/gi,"_")}`,q=`Run ${v}`;let se=[v];try{const _e=await fetch("/api/workspace/run/plan",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,graph:J,runNodeId:v})}),Ee=await _e.json().catch(()=>({}));if(!_e.ok||(Ee==null?void 0:Ee.ok)===!1)throw new Error(Ee.error||"Workspace run plan failed");se=Array.isArray(Ee.plannedNodeIds)&&Ee.plannedNodeIds.length?Ee.plannedNodeIds.map(Xe=>String(Xe||"").trim()).filter(Boolean):[v],se=Array.from(new Set([v,...se].filter(Boolean)));const Ue=Ee.conflict||null;if(Ue!=null&&Ue.runNodeId||Ue!=null&&Ue.runId){const Xe=Array.isArray(Ue.conflictNodeIds)&&Ue.conflictNodeIds.length?`: ${Ue.conflictNodeIds.join(", ")}`:"";de(`Run ${v} conflicts with running ${Ue.runNodeId||Ue.runId}${Xe}`);return}}catch(_e){de(String(_e.message||_e));return}const he=new Set(se),Se=Object.values(Kl.current||{}).find(_e=>(Array.isArray(_e==null?void 0:_e.plannedNodeIds)?_e.plannedNodeIds:[]).some(Ee=>he.has(String(Ee||"").trim())));if(Se){const _e=(Array.isArray(Se.plannedNodeIds)?Se.plannedNodeIds:[]).map(Ee=>String(Ee||"").trim()).filter(Ee=>Ee&&he.has(Ee));de(`Run ${v} conflicts with running ${Se.runNodeId||"workspace run"}${_e.length?`: ${_e.join(", ")}`:""}`);return}const qe=new AbortController;Ul.current.set(X,qe),ca.current.delete(X),go(_e=>({..._e,[X]:{id:X,runNodeId:v,plannedNodeIds:se,startedAt:Date.now()}})),ua(_e=>new Set([..._e,v])),da(_e=>({..._e,[v]:{status:"running"}})),de(`Running ${v}...`),zl(X),Ur(_e=>[..._e.slice(-7),{id:X,label:q,runNodeId:v,status:"running",startedAt:Date.now(),steps:[],messages:[{role:"assistant",kind:"run-summary",text:"准备运行...",at:Date.now()}]}]);let Ge=v;const wt=()=>ca.current.has(X),$t=_e=>{const Ee=new Set((_e||[]).map(Ue=>String(Ue||"").trim()).filter(Boolean));Ee.size||Ee.add(String(v||"")),ua(Ue=>{const Xe=new Set(Ue);for(const xt of Ee)Xe.delete(xt);return Xe})},ln=(_e,Ee)=>{const Ue=new Set((_e||[]).map(Xe=>String(Xe||"").trim()).filter(Boolean));Ue.size||Ue.add(String(v||"")),da(Xe=>{var pt;const xt={...Xe};for(const Re of Ue)Re&&(!xt[Re]||((pt=xt[Re])==null?void 0:pt.status)==="running")&&(xt[Re]={status:Ee});return xt})};try{await Bt(M,z);const _e=await fetch("/api/workspace/run",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/x-ndjson"},signal:qe.signal,body:JSON.stringify({...i,graph:J,runNodeId:v,runSessionId:X,model:ei,selectedSkills:us,stream:!0})});if(!_e.ok){const fe=await _e.json().catch(()=>({}));throw new Error(fe.error||"Workspace run failed")}if(!_e.body)throw new Error("Workspace run stream unavailable");const Ee=_e.body.getReader(),Ue=new TextDecoder;let Xe="",xt=[],pt=[];const Re=(fe,nt)=>{var dt,_t;const Je=d.find(Gt=>Gt.id===fe),at=String(((dt=Je==null?void 0:Je.data)==null?void 0:dt.label)||fe||"").trim(),ve=String(nt||((_t=Je==null?void 0:Je.data)==null?void 0:_t.definitionId)||"").trim();return ve&&ve!==at?`${at} (${ve})`:at},bt=(fe,nt,Je)=>{const at=String(fe||"").trim();at&&Ur(ve=>ve.map(dt=>{if(dt.id!==X)return dt;const Gt=[...Array.isArray(dt.steps)?dt.steps:[]],it=Gt.findIndex(ir=>ir.id===at),ht={id:at,label:Re(at,nt),status:Je};it>=0?Gt[it]={...Gt[it],...ht}:Gt.push(ht);const Xt=Gt.map((ir,ya)=>{const yo=ir.status==="done"?"[done]":ir.status==="failed"?"[failed]":"[running]";return`${ya+1}. ${yo} ${ir.label}`}).join(`
159
- `),At=Array.isArray(dt.messages)?dt.messages:[],Jt=At.findIndex(ir=>ir.kind==="run-summary"),pn={role:"assistant",kind:"run-summary",text:Xt||"准备运行...",at:Date.now()},sr=[...At];return Jt>=0?sr[Jt]=pn:sr.unshift(pn),{...dt,steps:Gt,messages:sr.slice(-160)}}))},Pr=fe=>{const nt=String(fe||"").trim();if(!nt)return;const Je=Ge;Ge=nt,ua(at=>{const ve=new Set(at);return Je&&Je!==nt&&Je!==v&&ve.delete(Je),v&&ve.add(v),ve.add(nt),ve}),da(at=>{var ve;return{...at,...Je&&Je!==nt&&Je!==v&&((ve=at[Je])==null?void 0:ve.status)==="running"?{[Je]:{status:"success"}}:{},...v?{[v]:{status:"running"}}:{},[nt]:{status:"running"}}})},Dh=fe=>{const nt=String(fe||"").trim();nt&&(ua(Je=>{const at=new Set(Je);return at.delete(nt),at}),da(Je=>({...Je,[nt]:{status:"success"}})))},cv=(fe,nt)=>{const Je=String(nt||"");if(!Je.trim())return;const at=["assistant","thinking","result","error","prompt"].includes(fe)?fe:"assistant";Ur(ve=>ve.map(dt=>{if(dt.id!==X)return dt;let _t=Array.isArray(dt.messages)?dt.messages:[];if(at==="result"){const ht=[..._t].reverse().find(Xt=>Xt.kind==="assistant");if(String((ht==null?void 0:ht.text)||"").trim()===Je.trim())return dt}if(at==="assistant"){const ht=_t.findIndex(Xt=>Xt.kind==="result"&&String(Xt.text||"").trim()===Je.trim());ht>=0&&(_t=_t.filter((Xt,At)=>At!==ht))}const Gt=[..._t],it=Gt[Gt.length-1];return it&&it.kind===at&&!it.error?Gt[Gt.length-1]={...it,text:`${it.text||""}${it.text?`
160
- `:""}${Je}`}:Gt.push({role:"assistant",kind:at,text:Je,...at==="error"?{error:!0}:{},at:Date.now()}),{...dt,messages:Gt.slice(-160)}}))},fd=fe=>{const nt=String(fe||"");nt.trim()&&Ur(Je=>Je.map(at=>{var Gt;if(at.id!==X)return at;const ve=Array.isArray(at.messages)?at.messages:[],dt=ve.findIndex(it=>it.kind==="thinking"),_t=[...ve];if(dt>=0){const it=String(((Gt=_t[dt])==null?void 0:Gt.text)||"");_t[dt]={..._t[dt],text:`${it}${it&&!it.endsWith(`
161
- `),""}${nt}`,at:Date.now()}}else{const it=_t.findIndex(ht=>ht.kind==="activity");_t.splice(it>=0?it+1:_t.length,0,{role:"assistant",kind:"thinking",text:nt,at:Date.now()})}return{...at,messages:_t.slice(-160)}}))},Pi=(fe,nt=null)=>{const Je=tV(fe);Je&&Ur(at=>at.map(ve=>{if(ve.id!==X)return ve;const dt=Number(nt==null?void 0:nt.ts)||Date.now(),_t=Number(ve.startedAt)||dt,Gt=Number(ve.lastActivityAt)||_t,it=Math.max(0,dt-Gt),ht=Number.isFinite(Number(nt==null?void 0:nt.runElapsedMs))?Math.max(0,Number(nt.runElapsedMs)):Math.max(0,dt-_t),Xt=Array.isArray(ve.activities)?ve.activities:[],At=Xt[Xt.length-1],pn=(typeof At=="string"?At:String((At==null?void 0:At.text)||""))===Je?Xt:[...Xt,{text:Je,kind:nV(Je),stepMs:it,totalMs:ht,at:dt}].slice(-30),sr=Array.isArray(ve.timingEntries)?ve.timingEntries:[],ir=Array.isArray(ve.messages)?ve.messages:[],ya=ir.findIndex(xo=>xo.kind==="activity"),yo={role:"assistant",kind:"activity",text:BS(pn,sr,_t,dt),at:Date.now()},Ar=[...ir];if(ya>=0)Ar[ya]=yo;else{const xo=Ar.findIndex(md=>md.kind==="run-summary");Ar.splice(xo>=0?xo+1:0,0,yo)}return{...ve,activities:pn,lastActivityAt:dt,messages:Ar.slice(-160)}}))},uv=fe=>{const nt=String((fe==null?void 0:fe.source)||"runner"),Je=String((fe==null?void 0:fe.stream)||""),at=String((fe==null?void 0:fe.eventType)||"event"),ve=String((fe==null?void 0:fe.text)||"").trim();if(!ve)return;const dt=`[${nt}${Je?`:${Je}`:""}] ${at}
162
- ${ve}`,_t=aV(fe);Ur(Gt=>Gt.map(it=>{if(it.id!==X)return it;const Xt=[...Array.isArray(it.rawTrace)?it.rawTrace:[],dt].slice(-80),At=Array.isArray(it.timingEntries)?it.timingEntries:[],Jt=_t?[...At,_t].slice(-80):At,pn=Array.isArray(it.activities)?it.activities:[],sr=Number(it.startedAt)||Number(fe==null?void 0:fe.ts)||Date.now(),ir=Number(_t==null?void 0:_t.at)||Number(fe==null?void 0:fe.ts)||Date.now(),ya=Array.isArray(it.messages)?it.messages:[],yo={role:"assistant",kind:"raw",text:Xt.join(`
163
-
164
- ---
165
-
166
- `),at:Date.now()},Ar=[...ya],xo=Ar.findIndex(xa=>xa.kind==="activity");if(_t){const xa={role:"assistant",kind:"activity",text:BS(pn,Jt,sr,ir),at:Date.now()};if(xo>=0)Ar[xo]=xa;else{const dv=Ar.findIndex(HI=>HI.kind==="run-summary");Ar.splice(dv>=0?dv+1:0,0,xa)}}const md=Ar.findIndex(xa=>xa.kind==="raw");return md>=0?Ar[md]=yo:Ar.push(yo),{...it,rawTrace:Xt,timingEntries:Jt,messages:Ar.slice(-160)}}))},zI=fe=>{Ur(nt=>nt.map(Je=>Je.id===X?{...Je,status:fe,endedAt:Date.now()}:Je))},pd=fe=>{const nt=new Set,Je=String((fe==null?void 0:fe.nodeId)||"").trim();Je&&nt.add(Je);for(const at of Array.isArray(fe==null?void 0:fe.displayNodeIds)?fe.displayNodeIds:[]){const ve=String(at||"").trim();ve&&nt.add(ve)}for(const at of Array.isArray(fe==null?void 0:fe.touchedNodeIds)?fe.touchedNodeIds:[]){const ve=String(at||"").trim();ve&&nt.add(ve)}if(nt.size===0)for(const at of Array.isArray(fe==null?void 0:fe.order)?fe.order:[]){const ve=String(at||"").trim();ve&&nt.add(ve)}return nt},hd=(fe,nt=null)=>{const Je=ef(fe||J,Z),at=new Map(Je.nodes.map(it=>[it.id,it])),ve=Je.instances||{},dt=nt instanceof Set?nt:null,_t=(it,ht)=>{const Xt={...it||ht};Array.isArray(ht==null?void 0:ht.output)&&(Xt.output=ht.output);for(const At of["scriptRef","implementationRef","implementationMode"])(ht==null?void 0:ht[At])!=null&&String(ht[At]).trim()!==""&&(Xt[At]=ht[At]);return Xt},Gt=(it,ht)=>{const Xt={...it||{}};Array.isArray(ht==null?void 0:ht.outputs)&&(Xt.outputs=ht.outputs);for(const At of["scriptRef","implementationRef","implementationMode"])(ht==null?void 0:ht[At])!=null&&String(ht[At]).trim()!==""&&(Xt[At]=ht[At]);return Xt};h(it=>{const ht=new Set(it.map(Jt=>Jt.id)),At={...dc(it,b.current,Y.current).instances||{}};for(const[Jt,pn]of Object.entries(ve)){if(dt&&!dt.has(Jt)||!ht.has(Jt))continue;const sr=At[Jt];Dt((pn==null?void 0:pn.definitionId)||(sr==null?void 0:sr.definitionId))?At[Jt]=pn:Array.isArray(pn==null?void 0:pn.output)&&(At[Jt]=_t(sr,pn))}return Y.current=At,_(At),it.map(Jt=>{var sr,ir;if(dt&&!dt.has(Jt.id))return Jt;const pn=at.get(Jt.id);return pn?Dt(((sr=pn.data)==null?void 0:sr.definitionId)||((ir=Jt.data)==null?void 0:ir.definitionId))?{...Jt,data:{...Jt.data,...pn.data}}:{...Jt,data:Gt(Jt.data,pn.data)}:Jt})})};for(;;){const{value:fe,done:nt}=await Ee.read();if(nt)break;Xe+=Ue.decode(fe,{stream:!0});const Je=Xe.split(`
167
- `);Xe=Je.pop()||"";for(const at of Je){if(!at.trim())continue;const ve=JSON.parse(at);if(ve.type==="error")throw new Error(ve.error||"Workspace run failed");if(ve.type==="stopped"){ca.current.add(X),xt=Array.isArray(ve.order)?ve.order:xt,Pi("运行停止",ve);continue}if(ve.type==="node-start"&&(de(`Running ${ve.nodeId}...`),Pr(ve.nodeId),bt(ve.nodeId,ve.definitionId,"running")),ve.type==="node-done"&&(Dh(ve.nodeId),bt(ve.nodeId,ve.definitionId,"done")),ve.type==="status"&&Pi(ve.line||ve.message||"",ve),ve.type==="paused"&&(pt=Array.isArray(ve.nodeIds)?ve.nodeIds:[],Pi("运行暂停",ve)),ve.type==="natural"&&(ve.kind==="thinking"?fd(ve.text||""):cv(ve.kind,ve.text||"")),ve.type==="raw"){const dt=WS(ve);dt&&fd(dt),uv(ve)}ve.type==="graph"&&ve.graph&&hd(ve.graph,pd(ve)),ve.type==="done"&&(ve.graph&&hd(ve.graph,pd(ve)),xt=Array.isArray(ve.order)?ve.order:[],pt=Array.isArray(ve.pauseNodeIds)?ve.pauseNodeIds:pt,Pi(pt.length?"运行暂停":"运行完成",ve))}}if(Xe.trim()){const fe=JSON.parse(Xe);if(fe.type==="error")throw new Error(fe.error||"Workspace run failed");if(fe.type==="stopped"&&(ca.current.add(X),Pi("运行停止",fe)),fe.type==="node-start"&&(de(`Running ${fe.nodeId}...`),Pr(fe.nodeId),bt(fe.nodeId,fe.definitionId,"running")),fe.type==="node-done"&&(Dh(fe.nodeId),bt(fe.nodeId,fe.definitionId,"done")),fe.type==="status"&&Pi(fe.line||fe.message||"",fe),fe.type==="paused"&&(pt=Array.isArray(fe.nodeIds)?fe.nodeIds:[],Pi("运行暂停",fe)),fe.type==="natural"&&(fe.kind==="thinking"?fd(fe.text||""):cv(fe.kind,fe.text||"")),fe.type==="raw"){const nt=WS(fe);nt&&fd(nt),uv(fe)}fe.type==="graph"&&fe.graph&&hd(fe.graph,pd(fe)),fe.type==="done"&&(fe.graph&&hd(fe.graph,pd(fe)),xt=Array.isArray(fe.order)?fe.order:[],pt=Array.isArray(fe.pauseNodeIds)?fe.pauseNodeIds:pt,Pi(pt.length?"运行暂停":"运行完成",fe))}wt()&&($t(se),ln(se,"stopped")),de(wt()?`Workspace run stopped: ${v}`:pt.length?`Workspace run paused at ${pt.join(", ")}`:`Workspace run done: ${xt.length?xt.join(" -> "):v}`),wt()||ln(se,pt.length?"paused":"success"),zI(wt()?"stopped":pt.length?"paused":"done"),wt()||await Pn()}catch(_e){if(wt()||(_e==null?void 0:_e.name)==="AbortError"){$t(se),ln(se,"stopped"),de(`Workspace run stopped: ${v}`),Ur(Ee=>Ee.map(Ue=>Ue.id===X?{...Ue,status:"stopped",endedAt:Date.now()}:Ue));return}$t(se),ln([v,Ge].filter(Boolean),"failed"),de(String(_e.message||_e)),Ur(Ee=>Ee.map(Ue=>Ue.id===X?{...Ue,status:"failed",endedAt:Date.now(),messages:[...Array.isArray(Ue.messages)?Ue.messages:[],{role:"assistant",error:!0,text:String(_e.message||_e),at:Date.now()}].slice(-160)}:Ue))}finally{Ul.current.get(X)===qe&&Ul.current.delete(X),go(_e=>{const Ee={..._e};return delete Ee[X],Ee}),ca.current.delete(X),$t(se)}},[ei,y,i,Pn,d,Z,qu,Bt,us,w,h,go,ke]),td=m.useCallback(async()=>{try{const N=await(await fetch("/api/skills")).json().catch(()=>({})),M=Array.isArray(N.skills)?N.skills.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):""})):[];LA(M),Jw(!0)}catch{Jw(!0)}},[]),nd=m.useCallback(async()=>{try{const N=await(await fetch("/api/mcps")).json().catch(()=>({})),M=Array.isArray(N.servers)?N.servers.map(z=>({name:String((z==null?void 0:z.name)||""),type:String((z==null?void 0:z.type)||""),url:String((z==null?void 0:z.url)||""),command:String((z==null?void 0:z.command)||""),args:Array.isArray(z==null?void 0:z.args)?z.args.map(String):[],description:String((z==null?void 0:z.description)||"")})).filter(z=>z.name):[];eb(M)}catch{eb([])}},[]);m.useEffect(()=>{fa().catch(v=>de(String(v.message||v))),Zu(),fetch("/api/model-lists").then(v=>v.json()).then(v=>RA({cursor:Array.isArray(v.cursor)?v.cursor.map(String):[],opencode:Array.isArray(v.opencode)?v.opencode.map(String):[],claudeCode:Array.isArray(v.claudeCode)?v.claudeCode.map(String):[]})).catch(()=>{}),td(),nd(),Ib(),fetch("/api/skill-collections").then(v=>v.json()).then(v=>{$A(Mo(v)),OA(!0)}).catch(()=>{}),fetch("/api/auth/me").then(v=>v.json()).then(v=>{db(v.user||null),pb(!0)}).catch(()=>{db(null),pb(!0)})},[fa,Zu,nd,td,Ib,ti]),m.useEffect(()=>{if(kb(""),!(!Xw||!Qw)){if(!ti){Dl([]);return}Dl(TM(ti,"workspace",cs,ia)),kb(ti)}},[ia,Qw,cs,Xw,ti]),m.useEffect(()=>{if(!(vb!==ti||!ti))try{localStorage.setItem(ti,JSON.stringify(us))}catch{}},[us,ti,vb]),m.useEffect(()=>{Y.current=H},[H]),m.useEffect(()=>{g.current=d},[d]),m.useEffect(()=>{const v=R.current,N=new Map,M=[];for(const J of d){const X=IP(J);N.set(J.id,X),v.get(J.id)!==X&&M.push(J.id)}if(R.current=N,M.length===0)return;const z=()=>M.forEach(J=>s(J)),K=window.requestAnimationFrame(z),G=window.setTimeout(z,80);return()=>{window.cancelAnimationFrame(K),window.clearTimeout(G)}},[d,s]),m.useEffect(()=>{b.current=y},[y]),m.useEffect(()=>{j.current=S},[S]),m.useEffect(()=>{D.current=E},[E]),m.useEffect(()=>{Ke.current=Ce},[Ce]),m.useEffect(()=>{Rt.current=xn},[xn]),m.useEffect(()=>{T.current=O},[O]),m.useEffect(()=>{if(!O)return;const v=M=>{M.key==="Escape"&&I(null)},N=M=>{var z,K;(K=(z=M.target)==null?void 0:z.closest)!=null&&K.call(z,".af-connect-node-menu")||I(null)};return document.addEventListener("keydown",v),document.addEventListener("pointerdown",N),()=>{document.removeEventListener("keydown",v),document.removeEventListener("pointerdown",N)}},[O]),m.useEffect(()=>{if(U.current&&ke)return V.current&&window.clearTimeout(V.current),V.current=window.setTimeout(()=>{Bt().catch(v=>de(String(v.message||v)))},650),()=>{V.current&&window.clearTimeout(V.current)}},[d,y,S,Bt,ke]);const ql=m.useMemo(()=>d.filter(v=>{var N;return((N=v==null?void 0:v.data)==null?void 0:N.definitionId)==="workspace_scheduled_run"}).map(v=>{var N;return{id:v.id,config:Lw(((N=v.data)==null?void 0:N.body)||"")}}),[d]),GA=m.useMemo(()=>ql.map(v=>`${v.id}:${v.config.enabled?"1":"0"}:${v.config.cron}:${v.config.timezone}`).join("|"),[ql]);m.useEffect(()=>{if(!U.current||o!=="workspace"||!i.flowId){mo({});return}if(!ql.length){mo({});return}let v=!1;const N=async()=>{try{const z=Os(i),K=await fetch(`/api/workspace/schedules?${z.toString()}`),G=await K.json().catch(()=>({}));if(!K.ok)throw new Error(G.error||"读取 Workspace 定时状态失败");v||mo(Qd(G.schedules||[]))}catch{v||mo(z=>{var G;const K={};for(const J of ql)K[J.id]={...z[J.id]||{},lastStatus:((G=z[J.id])==null?void 0:G.lastStatus)||"unknown"};return K})}};N();const M=window.setInterval(N,5e3);return()=>{v=!0,window.clearInterval(M)}},[i,ql,GA,o]);const Rb=m.useCallback((v,N)=>{if(!ke){de("Readonly workspace");return}const M=a7(N),z=q=>Array.isArray(q)?q.map(se=>(se==null?void 0:se.name)!=="skillKeys"&&(se==null?void 0:se.name)!=="skillsContext"&&(se==null?void 0:se.type)!=="text"?se:{...se,default:M,value:M}):[],K=d.map(q=>{var se;return q.id!==v?q:{...q,data:{...q.data,body:M,inputs:z((se=q.data)==null?void 0:se.inputs)}}}),G=Y.current||{},J=G[v]&&typeof G[v]=="object"?G[v]:{},X={...G,[v]:{...J,body:M,input:z(J.input)}};Y.current=X,h(K),_(X),En(q=>!q||q.id!==v?q:{...q,body:M,inputs:z(q.inputs)}),Bt(K,y).catch(q=>de(String(q.message||q)))},[y,d,Bt,h,ke]),Mb=m.useCallback((v,N)=>{if(!ke){de("Readonly workspace");return}const M=c7(N),z=q=>Array.isArray(q)?q.map(se=>(se==null?void 0:se.name)!=="serverNames"&&(se==null?void 0:se.name)!=="mcpContext"&&(se==null?void 0:se.type)!=="text"?se:{...se,default:M,value:M}):[],K=d.map(q=>{var se;return q.id!==v?q:{...q,data:{...q.data,body:M,inputs:z((se=q.data)==null?void 0:se.inputs)}}}),G=Y.current||{},J=G[v]&&typeof G[v]=="object"?G[v]:{},X={...G,[v]:{...J,body:M,input:z(J.input)}};Y.current=X,h(K),_(X),En(q=>!q||q.id!==v?q:{...q,body:M,inputs:z(q.inputs)}),Bt(K,y).catch(q=>de(String(q.message||q)))},[y,d,Bt,h,ke]),Lb=m.useCallback((v,N)=>{if(!ke){de("Readonly workspace");return}const M=yV(N),z=d.map(X=>X.id===v?{...X,data:{...X.data,body:M}}:X),K=Y.current||{},G=K[v]&&typeof K[v]=="object"?K[v]:{},J={...K,[v]:{...G,body:M}};Y.current=J,h(z),_(J),En(X=>(X==null?void 0:X.id)===v?{...X,body:M}:X),Bt(z,y).catch(X=>de(String(X.message||X)))},[y,d,Bt,h,ke]),$b=m.useCallback(v=>{const N=String(v||"").trim();N&&(ub(M=>M===N?"":N),aa(M=>({...M,[N]:M[N]||{sessionId:`nodechat_${Date.now()}_${N.replace(/[^a-z0-9_-]+/gi,"_")}`,messages:[],draft:"",candidateContent:"",running:!1,error:""}})))},[]),Ob=m.useCallback((v,N)=>{const M=String(v||"").trim();M&&aa(z=>({...z,[M]:{...z[M]||{sessionId:`nodechat_${Date.now()}_${M.replace(/[^a-z0-9_-]+/gi,"_")}`,messages:[]},draft:String(N||""),error:""}}))},[]),_r=m.useCallback((v,N,M="replace",z={})=>{var Ee,Ue;if(!ke){de("Readonly workspace");return}const K=String(v||"").trim();if(!K)return;const G=g.current.find(Xe=>Xe.id===K),J=Dt((Ee=G==null?void 0:G.data)==null?void 0:Ee.definitionId),X=gi(N),q=J==="html"?Al(X):String(X||""),se=G?Oo(G.data):"",he=M==="append"&&String(se||"").trim()?`${String(se).replace(/\s+$/g,"")}
168
-
169
- ${q.trim()}`:q,Se=J==="image"?"src":"content",qe=z!=null&&z.reloadDisplay?Date.now():(Ue=G==null?void 0:G.data)==null?void 0:Ue.displayReloadKey,Ge=Xe=>{let xt=!1;return(Array.isArray(Xe)?Xe:[]).map(Re=>{const bt=String((Re==null?void 0:Re.name)||""),Pr=String((Re==null?void 0:Re.type)||"");return bt===Se||bt==="filePath"||Pr==="text"?xt?{...Re,default:"",value:""}:(xt=!0,{...Re,default:he,value:he}):Re})},wt=g.current.map(Xe=>{var xt,pt;return Xe.id!==K?Xe:{...Xe,data:{...Xe.data,body:he,...qe?{displayReloadKey:qe}:{},inputs:Ge((xt=Xe.data)==null?void 0:xt.inputs),outputs:Ge((pt=Xe.data)==null?void 0:pt.outputs)}}}),$t=Y.current||{},ln=$t[K]&&typeof $t[K]=="object"?$t[K]:{},_e={...$t,[K]:{...ln,body:he,input:Ge(ln.input),output:Ge(ln.output)}};Y.current=_e,h(wt),_(_e),En(Xe=>(Xe==null?void 0:Xe.id)===K?{...Xe,body:he}:Xe),(z==null?void 0:z.logChat)!==!1&&aa(Xe=>{var xt;return{...Xe,[K]:{...Xe[K]||{},candidateContent:"",messages:[...(xt=Xe[K])!=null&&xt.messages&&Array.isArray(Xe[K].messages)?Xe[K].messages:[],{role:"assistant",text:M==="append"?"已追加到当前节点内容。":"已替换当前节点内容。",at:Date.now()}]}}}),Bt(wt,b.current).catch(Xe=>de(String(Xe.message||Xe))),de(String((z==null?void 0:z.statusMessage)||"")||(M==="append"?"已追加节点内容":"已替换节点内容"))},[Bt,h,ke]),rd=m.useCallback(async(v,N="")=>{if(!ke)return de("Readonly workspace"),"";if(!v)return"";try{const M=new FormData;M.set("file",v),M.set("dir",String(N||"")),i.flowId&&M.set("flowId",i.flowId),i.flowSource&&M.set("flowSource",i.flowSource),i.archived&&M.set("archived","1");const z=await fetch("/api/workspace/upload",{method:"POST",body:M}),K=await z.json().catch(()=>({}));if(!z.ok)throw new Error(K.error||"上传文件失败");const G=String(K.path||"").trim();if(!G)throw new Error("上传文件失败:未返回路径");return await Pn(),os(J=>{const X=new Set(J);for(const q of tf(G))X.delete(q);return X}),de(`已上传 ${G}`),G}catch(M){return de(String(M.message||M)),""}},[i,Pn,ke]),sd=m.useCallback(async v=>wp(v)?rd(v,"img"):(de("请选择图片文件"),""),[rd]),Db=m.useCallback((v="")=>{var N;if(!ke){de("Readonly workspace");return}yt.current=String(v||""),(N=Mt.current)==null||N.click()},[ke]),XA=m.useCallback(async v=>{const N=Array.from(v.target.files||[]);if(v.target.value="",!N.length)return;const M=yt.current||"";Ne(!0);try{let z="";for(const K of N){const G=await rd(K,M);G&&(z=G)}N.length>1&&de(`已上传 ${N.length} 个文件${z?`,最后一个:${z}`:""}`)}catch(z){de(String(z.message||z))}finally{Ne(!1)}},[rd]),Fb=m.useCallback(async(v,N)=>{const M=String(v||"").trim();if(!M)return;const z=await sd(N);z&&_r(M,z,"replace",{logChat:!1,statusMessage:`已上传图片 ${z}`})},[_r,sd]),zb=m.useCallback((v,N="replace")=>{var K;const M=String(v||"").trim(),z=String(((K=oa[M])==null?void 0:K.candidateContent)||"").trim();!M||!z||_r(M,z,N)},[oa,_r]),Hb=m.useCallback(async(v,N=void 0)=>{var wt,$t,ln;if(!ke){de("Readonly workspace");return}const M=String(v||"").trim();if(!M)return;const z=oa[M]||{},K=String(N!==void 0?N:z.draft||"").trim();if(!K||z.running)return;const G=g.current.find(_e=>_e.id===M);if(!G)return;const J=Dt((wt=G.data)==null?void 0:wt.definitionId)||"markdown",X=Oo(G.data);let q=bl(X,J),se=gi(X);if(q)try{se=await vl(i,q)}catch(_e){de(String(_e.message||_e))}else if(J!=="image"&&String(se||"").trim()){const _e=Io(J,se);if(_e){de(`${_e} 未进入微调。`);return}try{const Ee=await Hy(i,eN(M,G.data),se);await Pn(),_r(M,Ee,"replace",{logChat:!1,reloadDisplay:!0,statusMessage:`已将展示保存为 ${Ee}`}),q=Ee,se=""}catch(Ee){de(String(Ee.message||Ee));return}}const he=IV(M,g.current,b.current),Se={role:"user",text:K,at:Date.now()},qe=Array.isArray(z.messages)?z.messages:[],Ge=z.sessionId||`nodechat_${Date.now()}_${M.replace(/[^a-z0-9_-]+/gi,"_")}`;aa(_e=>({..._e,[M]:{...z,sessionId:Ge,messages:[...qe,Se],draft:"",running:!0,error:""}}));try{const _e=await fetch("/api/workspace/node-chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,sessionId:Ge,node:{id:M,label:(($t=G.data)==null?void 0:$t.label)||M,definitionId:((ln=G.data)==null?void 0:ln.definitionId)||""},nodeKind:J,currentContent:q?"":se,sourceContext:he,targetFilePath:q,messages:qe,message:K,model:ei})}),Ee=await _e.json().catch(()=>({}));if(!_e.ok)throw new Error(Ee.error||"节点微调失败");const Ue=String(Ee.candidateContent||Ee.reply||"").trim(),Xe=!!Ee.directFileEdit,xt=String(Ee.artifactPath||q||"").trim();if(Xe&&xt){const pt=Io(J,Ue);if(pt)throw new Error(`${pt} 文件已由 agent 修改,请检查 ${xt}。`);await Pn(),_r(M,xt,"replace",{logChat:!1,reloadDisplay:!0,statusMessage:`已按微调描述更新 ${xt}`})}else if(Ue){const pt=Io(J,Ue);if(pt)throw new Error(`${pt} 已取消写入,避免覆盖当前展示文件。`);if(q){const Re=await Hy(i,q,Ue);await Pn(),_r(M,Re,"replace",{logChat:!1,statusMessage:`已按微调描述更新 ${Re}`})}else _r(M,Ue,"replace",{logChat:!1,statusMessage:"已按微调描述更新展示内容"})}aa(pt=>{var Re;return{...pt,[M]:{...pt[M]||{},sessionId:String(Ee.sessionId||Ge),running:!1,candidateContent:"",messages:[...(Re=pt[M])!=null&&Re.messages&&Array.isArray(pt[M].messages)?pt[M].messages:[...qe,Se],{role:"assistant",text:Ue||Xe?xt?`已更新文件 ${xt}。`:"已按你的描述更新当前展示。":"没有生成可更新的内容。",at:Date.now()}]}}})}catch(_e){const Ee=String(_e.message||_e);aa(Ue=>({...Ue,[M]:{...Ue[M]||{},running:!1,error:Ee}})),de(Ee)}},[ei,i,Pn,oa,_r,ke]),Bb=m.useCallback(async(v,N)=>{if(!ke){de("Readonly workspace");return}const M=Dt(N==null?void 0:N.definitionId)||"markdown",z=Oo(N),K=bl(z,M);let G=gi(z);if(K)try{G=await vl(i,K)}catch(se){de(String(se.message||se));return}if(!String(G||"").trim()){de("展示节点没有可保存内容");return}const J=Io(M,G);if(J){de(`${J} 未保存文件。`);return}const X=eN(v,N),q=window.prompt("保存到 workspace 相对路径",X);if(q)try{const se=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:q,content:G})}),he=await se.json().catch(()=>({}));if(!se.ok)throw new Error(he.error||"保存文件失败");const Se=he.path||q,qe=Os(i);qe.set("path",Se);const Ge=await fetch(`/api/workspace/file?${qe.toString()}`);if(!Ge.ok){const wt=await Ge.json().catch(()=>({}));throw new Error(wt.error||`保存后读取失败:${Se}`)}await Pn(),fo(wt=>n7(wt,Se,String(G||"").length)),os(wt=>{const $t=new Set(wt);for(const ln of tf(Se))$t.delete(ln);return $t}),_r(v,Se,"replace",{logChat:!1,statusMessage:`已保存并引用 ${Se}`}),de(`已保存 ${Se}`)}catch(se){de(String(se.message||se))}},[i,Pn,_r,ke]),Wb=m.useCallback(v=>{var K,G,J;const N=String(v||"").trim();if(!N||tn)return;const M=g.current.find(X=>X.id===N);if(!M||!Dt((K=M==null?void 0:M.data)==null?void 0:K.definitionId)){de("展示节点不可用");return}const z=String(((G=M.data)==null?void 0:G.label)||((J=M.data)==null?void 0:J.displayName)||N).trim()||"AgentFlow Display";Nt(Km({title:z,layout:"single",nodeIds:[N]})),Lt(""),fn(null),Oe(!0)},[tn]),id=m.useCallback((v,N)=>{const M=String(v||"");M&&En(z=>{if(!z||z.id!==M)return z;const K=typeof N=="function"?N(z):N;return!K||typeof K!="object"?z:{...z,...K}})},[]),Vb=m.useCallback((v,N)=>{const M=String(v||"");!M||!ke||(h(z=>z.map(K=>{var J;if(K.id!==M)return K;const G=Array.isArray((J=K.data)==null?void 0:J.outputs)&&K.data.outputs.length?K.data.outputs.map((X,q)=>q===0?{...X,default:N,value:N}:X):[{type:"file",name:"value",default:N,value:N}];return{...K,data:{...K.data,body:"",outputs:G}}})),id(M,z=>({body:"",outputs:Array.isArray(z==null?void 0:z.outputs)&&z.outputs.length?z.outputs.map((G,J)=>J===0?{...G,default:N,value:N}:G):[{type:"file",name:"value",default:N,value:N}]})),de(`已选择文件 ${N}`))},[h,id,ke]),Kb=m.useCallback(v=>{ae({nodeId:String(v||""),query:""})},[]),Ah=m.useCallback(()=>{ae({nodeId:"",query:""})},[]),JA=m.useCallback(v=>{const N=String((v==null?void 0:v.path)||"").trim();!N||!B.nodeId||(Vb(B.nodeId,N),Ah())},[Ah,B.nodeId,Vb]),ds=m.useMemo(()=>d.map(v=>{var N,M;return{...v,data:{...v.data,selected:v.selected===!0,modelLists:sa,showBodyPreview:!0,isExecuting:xb.has(v.id),nodeStatus:((N=Ph[v.id])==null?void 0:N.status)??null,nodeElapsed:((M=Ph[v.id])==null?void 0:M.elapsed)??null,flowParams:i,readOnly:!ke,onRunWorkspaceNode:Tb,onStopWorkspaceNode:Ab,onOpenWorkspaceRunLogs:_b,onOptimizeWorkspaceSchedule:Pb,optimizingSchedule:wb===v.id,runningRunNodeIds:Sb,scheduledRunState:yb[v.id]||null,onChangeScheduledRunConfig:Lb,skills:cs,skillCollections:ia,onChangeLoadSkillKeys:Rb,onRefreshSkills:td,mcpServers:Zw,onChangeLoadMcpNames:Mb,onRefreshMcps:nd,onSaveDisplayNodeToFile:Bb,onShareDisplayNode:Wb,onOpenDisplayPreview:Q,sharingDisplayNodeId:tn,onUploadWorkspaceImage:sd,onUploadImageToDisplayNode:Fb,onOpenProvideFilePicker:Kb,onStatus:de,nodeChatActive:cb===v.id,nodeChat:oa[v.id]||null,onSetDisplayNodeContent:_r,onToggleNodeChat:$b,onCloseNodeChat:()=>ub(""),onUpdateNodeChatDraft:Ob,onSendNodeChat:Hb,onApplyNodeChatCandidate:zb,onSyncNodePropDraft:id}}}),[cb,zb,Mb,Rb,Lb,i,Zw,sa,oa,d,Kb,_b,Pb,wb,nd,td,Tb,Sb,Bb,yb,Hb,_r,Wb,tn,ia,cs,Ab,id,$b,Ob,Fb,sd,xb,Ph,ke]),Ih=m.useMemo(()=>new Map(ds.map(v=>[v.id,v])),[ds]),Ub=be?Ih.get(be):null,Yl=m.useMemo(()=>{const v=new Set(W);return S.nodeIds.map((N,M)=>{var X;const z=Ih.get(N);if(!z||!Dt((X=z.data)==null?void 0:X.definitionId))return null;const K=_a(z)||{width:520,height:320},G=nl(S.nodeSizes[N]||K,{display:!0})||K,J=S.nodePositions[N]||{x:180+M*36,y:120+M*28};return{...z,id:YS(N),position:J,selected:v.has(N),width:G.width,height:G.height,data:{...z.data,sourceNodeId:N,displayPageMode:!0,readOnly:!0,selected:v.has(N),displaySize:G,nodeSize:G}}}).filter(Boolean)},[S,Ih,W]),pa=m.useMemo(()=>ds.filter(v=>{var N;return Dt((N=v==null?void 0:v.data)==null?void 0:N.definitionId)}),[ds]),Ze=o==="display";m.useEffect(()=>{if(!Ze||!S.viewport)return;const v=S.viewport,N=()=>{try{r.setViewport(v,{duration:0})}catch{}},M=window.requestAnimationFrame(()=>window.requestAnimationFrame(N));return()=>window.cancelAnimationFrame(M)},[S.viewport,Ze,r]),m.useEffect(()=>{if(Ze||!E)return;const v=E,N=()=>{try{r.setViewport(v,{duration:0})}catch{}},M=window.requestAnimationFrame(()=>window.requestAnimationFrame(N));return()=>window.cancelAnimationFrame(M)},[Ze,r,E]),m.useEffect(()=>{const v=$.current,N=new Map,M=[];for(const J of[...ds,...Yl]){const X=kV(J);N.set(J.id,X),v.get(J.id)!==X&&M.push(J.id)}if($.current=N,M.length===0)return;const z=()=>M.forEach(J=>s(J)),K=window.requestAnimationFrame(z),G=window.setTimeout(z,80);return()=>{window.cancelAnimationFrame(K),window.clearTimeout(G)}},[Yl,ds,s]);const Tt=m.useMemo(()=>d.find(v=>v.id===xn)||null,[d,xn]),Th=m.useRef({id:"",draft:null}),QA=m.useMemo(()=>{const v=tN(Tt);return v?JSON.stringify(v):""},[Tt]);m.useEffect(()=>{if(!Tt){Th.current={id:"",draft:null},En(null),ss("");return}const v=tN(Tt),N=Th.current;Th.current={id:Tt.id,draft:v},En(M=>!M||M.id!==Tt.id||N.id!==Tt.id||!N.draft?v:f7(M,N.draft,v)),ss("")},[Tt==null?void 0:Tt.id,QA]);const Rh=m.useCallback((v=!1)=>{if(!Ce||!Tt)return!1;if(!ke)return ss("Readonly workspace"),de("Readonly workspace"),!1;ss("");const N=rN({nodes:d,edges:y,instances:Y.current,selectedNode:Tt,draft:Ce,allowRename:v});return N!=null&&N.error?(ss(N.error),!1):(!(N!=null&&N.ok)||!N.changed||(Y.current=N.instances,_(N.instances),h(N.nodes),w(N.edges),N.nextId!==Tt.id&&ze(N.nextId),qu(N.nextId)),!0)},[y,Ce,d,Tt,w,h,qu,ke]);m.useEffect(()=>{if(!ke||!Ce||!Tt)return;const v=window.setTimeout(()=>{Rh(!1)},350);return()=>window.clearTimeout(v)},[Ce==null?void 0:Ce.label,Ce==null?void 0:Ce.role,Ce==null?void 0:Ce.model,Ce==null?void 0:Ce.body,JSON.stringify((Ce==null?void 0:Ce.images)||[]),Ce==null?void 0:Ce.script,Ce==null?void 0:Ce.scriptRef,Ce==null?void 0:Ce.implementationRef,Ce==null?void 0:Ce.implementationMode,JSON.stringify((Ce==null?void 0:Ce.inputs)||[]),JSON.stringify((Ce==null?void 0:Ce.outputs)||[]),Rh,Tt==null?void 0:Tt.id,ke]);const ZA=m.useMemo(()=>{const v=new Map(ds.map(N=>[N.id,N]));return y.map(N=>{var se,he,Se,qe;const M=v.get(N.source),z=v.get(N.target),K=/^output-(\d+)$/.exec(N.sourceHandle||""),G=/^input-(\d+)$/.exec(N.targetHandle||""),J=M&&K?(he=(se=M.data)==null?void 0:se.outputs)==null?void 0:he[parseInt(K[1],10)]:null,X=z&&G?(qe=(Se=z.data)==null?void 0:Se.inputs)==null?void 0:qe[parseInt(G[1],10)]:null,q=J!=null&&J.type?Tn(J.type):X!=null&&X.type?Tn(X.type):"";return q?{...N,style:{...N.style||{},stroke:q,strokeWidth:2},markerEnd:{type:fi.ArrowClosed,color:q}}:N})},[y,ds]),eI=Ze?Yl:ds,tI=Ze?[]:ZA,nI=m.useMemo(()=>Ze?Yl.map(v=>({...v,id:Wm(v.id)})):ds,[Yl,ds,Ze]),rI=m.useCallback(v=>{const N=String(v||"").trim();if(!N)return;const M=Ze?YS(N):N;Ze?F([N]):(h(K=>K.map(G=>({...G,selected:G.id===M}))),w(K=>K.map(G=>({...G,selected:!1}))),ze(M));const z=()=>{var se,he,Se;const K=r.getNode(M);if(!K)return;const G=(se=r.getInternalNode)==null?void 0:se.call(r,M),J=((he=G==null?void 0:G.measured)==null?void 0:he.width)??(G==null?void 0:G.width)??K.width??260,X=((Se=G==null?void 0:G.measured)==null?void 0:Se.height)??(G==null?void 0:G.height)??K.height??120,{zoom:q}=r.getViewport();r.setCenter(K.position.x+J/2,K.position.y+X/2,{zoom:PV(q),duration:240})};window.requestAnimationFrame(()=>window.requestAnimationFrame(z))},[Ze,r,w,h]),qb=m.useCallback(()=>{const v=r.getViewport(),N={x:Number(v.x)||0,y:Number(v.y)||0,zoom:Math.min(Math.max(Number(v.zoom)||1,.1),4)};if(Ze){const M={...j.current,viewport:N};j.current=M,C(M),de("已固定 Display 进入视角")}else D.current=N,A(N),de("已固定 Workspace 进入视角");Bt(g.current,b.current).catch(M=>de(String(M.message||M)))},[Ze,r,Bt]),Mh=m.useMemo(()=>{const v=le.trim().toLowerCase(),N={DISPLAY:[],CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const M of Z)v&&![M.id,M.label,M.displayName,M.description].some(z=>String(z||"").toLowerCase().includes(v))||N[kc(M)].push(M);for(const M of Ca)N[M].sort((z,K)=>z.id.localeCompare(K.id));return N},[Z,le]),Gl=m.useMemo(()=>{const v=jn.trim().toLowerCase();return Z.filter(N=>!v||[N.id,N.label,N.displayName,N.description].some(M=>String(M||"").toLowerCase().includes(v))).sort((N,M)=>{const z=Ca.indexOf(kc(N)),K=Ca.indexOf(kc(M));return z!==K?z-K:Sc(N).localeCompare(Sc(M))}).slice(0,30)},[Z,jn]),Xl=m.useMemo(()=>{const v=jn.trim().toLowerCase();return te.filter(N=>!v||[N.id,N.version,N.displayName,N.name,N.description,...Array.isArray(N.tags)?N.tags:[]].some(M=>String(M||"").toLowerCase().includes(v))).sort((N,M)=>String(N.displayName||N.name||N.id).localeCompare(String(M.displayName||M.name||M.id))).slice(0,30)},[te,jn]);m.useEffect(()=>{Mn(0)},[jn,oe,Be]),m.useEffect(()=>{if(!oe)return;const v=window.setTimeout(()=>{var N;return(N=sb.current)==null?void 0:N.focus()},0);return()=>window.clearTimeout(v)},[oe]);const sI=m.useMemo(()=>{const v=Ei.trim().toLowerCase();return v?$w(is).filter(N=>N.path.toLowerCase().includes(v)):is},[Ei,is]),fs=m.useMemo(()=>HP(is,as),[is,as]),ni=(fs==null?void 0:fs.type)==="directory"?fs.path:ZV((fs==null?void 0:fs.path)||""),iI=m.useCallback(v=>{var N,M;(M=(N=v.target)==null?void 0:N.closest)!=null&&M.call(N,".af-work-file")||po("")},[]),oI=[...(sa.cursor||[]).map(v=>({label:`Cursor · ${v.split(" - ")[0]}`,value:`cursor:${v.split(" - ")[0]}`})),...(sa.opencode||[]).map(v=>({label:`OpenCode · ${v.split(" - ")[0]}`,value:`opencode:${v.split(" - ")[0]}`})),...(sa.claudeCode||[]).map(v=>({label:`Claude · ${v.split(" - ")[0]}`,value:`claude-code:${v.split(" - ")[0]}`}))],Lh=m.useMemo(()=>new Set(us),[us]),ha=m.useMemo(()=>{const v=new Map(cs.map(G=>[G.key,G])),N=new Set,M=new Set,z=ia.map(G=>{const J=dl(G,cs).map(X=>v.get(X)).filter(Boolean);for(const X of J)N.add(X.key),M.add(String(X.name||X.id||X.key||"").trim());return{...G,skills:J}}).filter(G=>G.skills.length>0),K=cs.filter(G=>{const J=String(G.name||G.id||G.key||"").trim();return!N.has(G.key)&&!M.has(J)});return{groups:z,ungrouped:K}},[ia,cs]);m.useEffect(()=>{nb(v=>{let N=!1;const M=new Set(v);for(const z of ha.groups)M.has(z.id)||(M.add(z.id),N=!0);return N?M:v})},[ha.groups]);const An=m.useMemo(()=>{const v=d.filter(N=>N.selected);return v.length>0?v:xn?d.filter(N=>N.id===xn):[]},[d,xn]),od=m.useMemo(()=>An.map(v=>v.id),[An]),Yb=m.useCallback(()=>{if(Ze)return;if(!ke){de("Readonly workspace");return}const v=(g.current||[]).filter(X=>(X==null?void 0:X.selected)&&!Bc(X));if(v.length<2){de("选择至少两个节点后按 G 创建 Group");return}const N=v.reduce((X,q)=>{var Ge,wt,$t,ln,_e,Ee,Ue,Xe,xt,pt,Re,bt;const se=Number(((Ge=q.position)==null?void 0:Ge.x)||0),he=Number(((wt=q.position)==null?void 0:wt.y)||0),Se=Number((($t=q.measured)==null?void 0:$t.width)||q.width||((_e=(ln=q.data)==null?void 0:ln.nodeSize)==null?void 0:_e.width)||((Ue=(Ee=q.data)==null?void 0:Ee.displaySize)==null?void 0:Ue.width)||kP),qe=Number(((Xe=q.measured)==null?void 0:Xe.height)||q.height||((pt=(xt=q.data)==null?void 0:xt.nodeSize)==null?void 0:pt.height)||((bt=(Re=q.data)==null?void 0:Re.displaySize)==null?void 0:bt.height)||xp);return{minX:Math.min(X.minX,se),minY:Math.min(X.minY,he),maxX:Math.max(X.maxX,se+Se),maxY:Math.max(X.maxY,he+qe)}},{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});if(!Number.isFinite(N.minX)||!Number.isFinite(N.minY))return;const M=new Set((g.current||[]).map(X=>X.id));let z=1,K=`group_${z}`;for(;M.has(K);)z+=1,K=`group_${z}`;const G=Fy({width:N.maxX-N.minX+Xd*2,height:N.maxY-N.minY+Xd*2})||{width:Go,height:Xo},J={id:K,type:vu,position:{x:N.minX-Xd,y:N.minY-Xd},width:G.width,height:G.height,selected:!0,draggable:!0,selectable:!0,zIndex:0,data:{isWorkspaceGroup:!0,label:kp(z-1),title:kp(z-1),color:"purple",nodeSize:G}};h(X=>[J,...X.map(q=>({...q,selected:!1}))]),w(X=>X.map(q=>({...q,selected:!1}))),ze(""),de(`Created group for ${v.length} nodes`)},[Ze,w,h,ke]),ad=m.useMemo(()=>d.filter(v=>{var N;return Dt((N=v==null?void 0:v.data)==null?void 0:N.definitionId)}),[d]),$h=m.useMemo(()=>An.filter(v=>{var N;return Dt((N=v==null?void 0:v.data)==null?void 0:N.definitionId)}).map(v=>v.id),[An]),aI=m.useMemo(()=>{const v=String((rr==null?void 0:rr.username)||(rr==null?void 0:rr.userId)||"").trim();return v?v.slice(0,1).toUpperCase():"?"},[rr]),Oh=m.useMemo(()=>new Set(od),[od]),ld=m.useMemo(()=>y.filter(v=>Oh.has(v.source)&&Oh.has(v.target)),[y,Oh]),Gb=m.useCallback(v=>{const N=v==="display"?"display":"workspace";l(N),ze(""),F([]),I(null),Pe(!1),an(!1);const M=Os(i);N==="display"&&M.set("view","display");const z=`/workspace${M.toString()?`?${M.toString()}`:""}`;window.history.pushState({},"",z)},[i]),Xb=m.useCallback(v=>{var z;const N=String(v||"").trim();if(!N)return;const M=g.current.find(K=>K.id===N);if(!M||!Dt((z=M.data)==null?void 0:z.definitionId)){de("展示节点不可用");return}C(K=>{if(K.nodeIds.includes(N))return K;const G=K.nodeIds.length,J=_a(M);return{nodeIds:[...K.nodeIds,N],nodePositions:{...K.nodePositions,[N]:{x:180+G*36,y:120+G*28}},nodeSizes:{...K.nodeSizes,...J?{[N]:J}:{}}}}),F([N])},[]),Jb=m.useCallback(v=>{const N=String(v||"").trim();N&&(C(M=>{const z=M.nodeIds.filter(J=>J!==N),K={...M.nodePositions},G={...M.nodeSizes};return delete K[N],delete G[N],{nodeIds:z,nodePositions:K,nodeSizes:G}}),F(M=>M.filter(z=>z!==N)))},[]),Qb=m.useCallback(v=>{const N=String(v||"").trim();N&&(j.current.nodeIds.includes(N)?Jb(N):Xb(N))},[Xb,Jb]),cd=m.useMemo(()=>{const v=Cr.trim().toLowerCase();return v?pa.filter(N=>{var M,z;return[N.id,(M=N.data)==null?void 0:M.label,(z=N.data)==null?void 0:z.definitionId].filter(Boolean).some(K=>String(K).toLowerCase().includes(v))}):pa},[pa,Cr]),Zb=m.useMemo(()=>{const v=cd.length,N=v<=1?1:v<=4?2:3,M=Array.from({length:N},()=>({height:0,nodes:[]}));for(const z of cd){const K=_a(z)||{width:420,height:260},G=Math.max(1,Number(K.width)||420),J=Math.max(1,Number(K.height)||260),X=Math.min(26,Math.max(5.5,J/G*16))+3.2;let q=M[0];for(const se of M)se.height<q.height&&(q=se);q.nodes.push(z),q.height+=X}return M.map(z=>z.nodes)},[cd]),lI=m.useCallback(v=>{var G,J;const N=S.nodeIds.includes(v.id),M=_a(v)||{width:420,height:260},z=Math.max(1,Math.round(Number(M.width)||420)),K=Math.max(1,Math.round(Number(M.height)||260));return a.jsxs("button",{type:"button",className:"af-display-picker-card"+(N?" af-display-picker-card--selected":""),style:{"--af-display-picker-card-ratio":`${z} / ${K}`},onClick:()=>Qb(v.id),children:[a.jsx("span",{className:"af-display-picker-card__check","aria-hidden":!0,children:a.jsx("input",{type:"checkbox",checked:N,readOnly:!0,tabIndex:-1})}),a.jsx("span",{className:"af-display-picker-card__preview",children:a.jsx(BV,{node:v})}),a.jsxs("span",{className:"af-display-picker-card__meta",children:[a.jsx("strong",{children:((G=v.data)==null?void 0:G.label)||v.id}),a.jsxs("small",{children:[Dt((J=v.data)==null?void 0:J.definitionId)," · ",v.id]})]})]},v.id)},[S.nodeIds,Qb]),ev=m.useMemo(()=>{const v=le.trim().toLowerCase();return v?te.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(v))):te},[te,le]),tv=m.useCallback((v,N)=>{const M=String(v||"snippet_node").trim().replace(/[^a-zA-Z0-9_]+/g,"_").replace(/^_+|_+$/g,"")||"snippet_node";let z=`${M}_${Date.now().toString(36)}`,K=2;for(;N.has(z);)z=`${M}_${Date.now().toString(36)}_${K}`,K+=1;return N.add(z),z},[]),Jl=m.useCallback((v,N)=>{var xt,pt;if(!ke){de("Readonly workspace");return}const M=v!=null&&v.snippet&&typeof v.snippet=="object"?v.snippet:{},z=M.instances&&typeof M.instances=="object"?M.instances:{},K=Object.keys(z);if(K.length===0)return;const G=new Set(g.current.map(Re=>Re.id)),J={};for(const Re of K)J[Re]=tv(Re,G);const X=(xt=M.ui)!=null&&xt.nodePositions&&typeof M.ui.nodePositions=="object"?M.ui.nodePositions:{},q=(pt=M.ui)!=null&&pt.nodeSizes&&typeof M.ui.nodeSizes=="object"?M.ui.nodeSizes:{},se=K.map(Re=>{const bt=X[Re];return{id:Re,x:typeof(bt==null?void 0:bt.x)=="number"?bt.x:0,y:typeof(bt==null?void 0:bt.y)=="number"?bt.y:0}}),he=Math.min(...se.map(Re=>Re.x)),Se=Math.min(...se.map(Re=>Re.y));let qe=N||{x:360+g.current.length*24,y:180+g.current.length*18};if(!N){const Re=document.querySelector(".af-workspace-canvas .react-flow");if(Re){const bt=Re.getBoundingClientRect();qe=r.screenToFlowPosition({x:bt.left+bt.width*.48,y:bt.top+bt.height*.32})}}const Ge={},wt={},$t={};for(const Re of se){const bt=J[Re.id];Ge[bt]={...z[Re.id]||{}},wt[bt]={x:qe.x+(Re.x-he),y:qe.y+(Re.y-Se)};const Pr=q[Re.id];typeof(Pr==null?void 0:Pr.width)=="number"&&typeof(Pr==null?void 0:Pr.height)=="number"&&($t[bt]={width:Pr.width,height:Pr.height})}const ln=new Set(K),_e=(Array.isArray(M.edges)?M.edges:[]).filter(Re=>ln.has(Re==null?void 0:Re.source)&&ln.has(Re==null?void 0:Re.target)).map(Re=>({source:J[Re.source],target:J[Re.target],sourceHandle:Re.sourceHandle??null,targetHandle:Re.targetHandle??null})),Ee=ef({instances:Ge,edges:_e,ui:{nodePositions:wt,nodeSizes:$t}},Z),Ue=Ee.nodes.map(Re=>Re.id),Xe=Ee.nodes.map(Re=>({...Re,selected:!0}));Y.current={...Y.current,...Ee.instances},_(Y.current),h(Re=>[...Re.map(bt=>({...bt,selected:!1})),...Xe]),w(Re=>[...Re.map(bt=>({...bt,selected:!1})),...Ee.edges.map(bt=>({...bt,selected:!1}))]),ze(""),F([]),de(`已添加流程片段:${v.displayName||v.id}(已选中 ${Ue.length} 个节点)`)},[tv,Z,r,w,h,ke]),cI=m.useCallback(()=>{var M,z;if(An.length<2){He("请先在 workspace 画布上选择至少两个节点。"),ye("flows");return}const v=An[0],N=An.length===2?`${((M=v.data)==null?void 0:M.label)||v.id} 片段`:`${((z=v.data)==null?void 0:z.label)||v.id} 等 ${An.length} 个节点`;Ae({name:N,id:N.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),description:""}),Ht(""),et(!0),ye("flows")},[An]),uI=m.useCallback(async()=>{var K,G;if(An.length<2)return;const v=ut.name.trim();if(!v){Ht("请填写片段名称。");return}const N={},M={};for(const J of An){N[J.id]={x:((K=J.position)==null?void 0:K.x)||0,y:((G=J.position)==null?void 0:G.y)||0};const X=_a(J);X&&(M[J.id]=X)}const z=ld.map(J=>({source:J.source,target:J.target,sourceHandle:J.sourceHandle??null,targetHandle:J.targetHandle??null}));qt(!0),Ht("");try{const J=await fetch("/api/marketplace/publish-flow-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:ut.id,name:v,displayName:v,version:"1.0.0",description:ut.description,snippet:{instances:Tw(An,Y.current),edges:z,ui:{nodePositions:N,nodeSizes:M}}})}),X=await J.json().catch(()=>({}));if(!J.ok||X.ok===!1)throw new Error(X.error||"发布流程片段失败");et(!1),de(`流程片段已发布:${X.id||v}`),tb(`流程片段已发布:${X.id||v}`),await Zu(),ye("flows")}catch(J){Ht(String(J.message||J))}finally{qt(!1)}},[Zu,ut,ld,An,tb]);m.useCallback(()=>{if(ad.length===0){de("当前 workspace 没有 display 节点");return}const v=$h.length>0?$h:ad.map(M=>M.id),N=i.flowId?`${i.flowId} 展示页`:"AgentFlow Display";Nt(Km({title:N,layout:"gallery",nodeIds:v})),Lt(""),fn(null),Oe(!0)},[i.flowId,$h,ad]);const dI=m.useCallback(v=>{Nt(N=>{const M=Array.isArray(N.nodeIds)?N.nodeIds:[];return M.includes(v)?{...N,nodeIds:M.filter(z=>z!==v)}:{...N,nodeIds:[...M,v]}})},[]),ps=m.useCallback(async()=>{Kn(!0),Un("");try{const v=await fetch("/api/display/shares"),N=await v.json().catch(()=>({}));if(!v.ok)throw new Error(N.error||"读取分享列表失败");Sn(Array.isArray(N.shares)?N.shares:[])}catch(v){Un(String(v.message||v)),Sn([])}finally{Kn(!1)}},[]),fI=m.useCallback(()=>{kn(!0),jr(""),ps()},[ps]),pI=m.useCallback(async()=>{var M,z;const v=kt.title.trim(),N=Array.isArray(kt.nodeIds)?kt.nodeIds:[];if(N.length===0){Lt("请选择至少一个 display 节点。");return}Ve(!0),Lt(""),fn(null);try{await Bt(d,y);const K=await fetch("/api/display/share",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,title:v,layout:kt.layout,nodeIds:N,...XS(kt)})}),G=await K.json().catch(()=>({}));if(!K.ok||G.ok===!1)throw new Error(G.error||"发布展示页失败");const J=new URL(G.url||`/display/${((M=G.share)==null?void 0:M.id)||""}`,window.location.origin).href;fn({...G,absoluteUrl:J}),de((z=G.share)!=null&&z.expiresAt?"展示页已生成":"展示页已生成:永久有效"),Yt&&ps()}catch(K){Lt(String(K.message||K))}finally{Ve(!1)}},[kt,Yt,y,i,ps,d,Bt]),hI=m.useCallback(async()=>{var N,M;const v=Array.isArray(S.nodeIds)?S.nodeIds:[];if(v.length===0){Lt("请先添加至少一个展示节点。"),de("请先添加至少一个展示节点"),an(!0);return}Ve(!0),Lt("");try{await Bt(d,y);const z=i.flowId?`${i.flowId} 展示页`:"AgentFlow Display",K=await fetch("/api/display/share",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,title:z,layout:"canvas",nodeIds:v,...XS(kt)})}),G=await K.json().catch(()=>({}));if(!K.ok||G.ok===!1)throw new Error(G.error||"生成展示链接失败");const J=new URL(G.url||`/display/${((N=G.share)==null?void 0:N.id)||""}`,window.location.origin).href;fn({...G,absoluteUrl:J}),Fn(!0),de((M=G.share)!=null&&M.expiresAt?"展示链接已生成":"展示链接已生成:永久有效"),Yt&&ps()}catch(z){const K=String(z.message||z);Lt(K),de(K)}finally{Ve(!1)}},[S.nodeIds,kt,Yt,y,i,ps,d,Bt]),nv=m.useCallback(async()=>{const v=tt==null?void 0:tt.absoluteUrl;if(!v)return;const N=await QS(v);gn(N?"copied":"failed"),window.setTimeout(()=>gn(""),1600)},[tt==null?void 0:tt.absoluteUrl]),mI=m.useCallback(async v=>{const N=JS(v),M=await QS(N);jr(M?String((v==null?void 0:v.id)||""):"failed"),window.setTimeout(()=>jr(""),1600)},[]),gI=m.useCallback(async(v,N)=>{const M=String((v==null?void 0:v.id)||"");if(M){Wr(M),Un("");try{const z=N==="permanent"?{id:M,expiresMode:"permanent",permanent:!0}:{id:M,expiresMode:"days",expiresInDays:Number(N||30)},K=await fetch("/api/display/share",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(z)}),G=await K.json().catch(()=>({}));if(!K.ok||G.ok===!1)throw new Error(G.error||"更新分享有效期失败");await ps(),de("分享有效期已更新")}catch(z){Un(String(z.message||z))}finally{Wr("")}}},[ps]),yI=m.useCallback(async v=>{const N=String((v==null?void 0:v.id)||"");if(N){Wr(N),Un("");try{const M=await fetch(`/api/display/share?id=${encodeURIComponent(N)}`,{method:"DELETE"}),z=await M.json().catch(()=>({}));if(!M.ok||z.ok===!1)throw new Error(z.error||"撤销分享失败");await ps(),de("分享已撤销")}catch(M){Un(String(M.message||M))}finally{Wr("")}}},[ps]),xI=m.useCallback(v=>{h(N=>N.map(M=>M.id===v?{...M,selected:!1}:M)),ze(N=>N===v?"":N)},[h]),ma=m.useCallback(()=>{const v=kh.current;if(!v)return;const N=v.getBoundingClientRect(),M=Math.min(420,Math.max(320,N.width+160)),z=12,K=Math.max(180,N.top-z*2),G=Math.min(560,K);HA({position:"fixed",left:Math.max(12,Math.min(window.innerWidth-M-12,N.left)),top:Math.max(z,N.top-G-z),width:M,maxHeight:G,zIndex:1e4})},[]);m.useEffect(()=>{if(!Yu)return;ma();const v=M=>{var K,G;const z=M.target;(K=kh.current)!=null&&K.contains(z)||(G=rb.current)!=null&&G.contains(z)||vh(!1)},N=M=>{M.key==="Escape"&&vh(!1)};return window.addEventListener("pointerdown",v),window.addEventListener("keydown",N),window.addEventListener("resize",ma),window.addEventListener("scroll",ma,!0),()=>{window.removeEventListener("pointerdown",v),window.removeEventListener("keydown",N),window.removeEventListener("resize",ma),window.removeEventListener("scroll",ma,!0)}},[Yu,ma]);const wI=m.useCallback(v=>{var z,K,G;if(o==="display"){const J=[];let X=!1;C(q=>{var Se,qe;const se={...q.nodePositions},he={...q.nodeSizes};for(const Ge of v||[]){const wt=Wm(Ge==null?void 0:Ge.id);if(!(!wt||!q.nodeIds.includes(wt))){if(Ge.type==="select"){Ge.selected&&J.push(wt);continue}if(Ge.type==="position"&&Ge.position){se[wt]={x:Ge.position.x,y:Ge.position.y},X=!0;continue}if(Ge.type==="dimensions"&&((Se=Ge.dimensions)!=null&&Se.width)&&((qe=Ge.dimensions)!=null&&qe.height)){const $t=nl({width:Math.round(Number(Ge.dimensions.width)),height:Math.round(Number(Ge.dimensions.height))},{display:!0});$t&&(he[wt]=$t,X=!0)}}}return X?{...q,nodePositions:se,nodeSizes:he}:q}),(v||[]).some(q=>(q==null?void 0:q.type)==="select")&&F(J);return}if(!ke){const J=(v||[]).filter(X=>(X==null?void 0:X.type)==="select");J.length>0&&h(X=>fp(J,X));return}const N=new Map;for(const J of v||[])if((J==null?void 0:J.type)==="dimensions"&&((z=J.dimensions)!=null&&z.width)&&((K=J.dimensions)!=null&&K.height)){const X=d.find(qe=>qe.id===J.id),q=Bc(X),se=!!Dt((G=X==null?void 0:X.data)==null?void 0:G.definitionId),he={width:Math.round(Number(J.dimensions.width)),height:Math.round(Number(J.dimensions.height))},Se=q?Fy(he):nl(he,{display:se});Se&&N.set(J.id,Se)}const M=Array.from(N.keys());if(h(J=>fp(v,J).map(X=>{var se;const q=N.get(X.id);return q?Bc(X)?{...X,width:q.width,height:q.height,data:{...X.data,nodeSize:q}}:Dt((se=X.data)==null?void 0:se.definitionId)?{...X,width:q.width,height:q.height,data:{...X.data,nodeSize:q,displaySize:q}}:{...X,width:q.width,height:q.height,data:{...X.data,nodeSize:q}}:X})),M.length>0){const J=()=>M.forEach(X=>s(X));window.requestAnimationFrame(J),window.setTimeout(J,80)}},[d,h,s,o,ke]),bI=m.useCallback(v=>{if(o!=="display"){if(!ke){const N=(v||[]).filter(M=>(M==null?void 0:M.type)==="select");N.length>0&&w(M=>lw(N,M));return}k(v)}},[k,w,o,ke]),ga=m.useCallback(()=>{const v=document.querySelector(".af-workspace-canvas .react-flow");if(v){const N=v.getBoundingClientRect();return r.screenToFlowPosition({x:N.left+N.width*.48,y:N.top+N.height*.32})}return{x:360+d.length*36,y:180+d.length*28}},[d.length,r]),ud=m.useCallback(()=>{var v,N,M;if(Tt){const z=Number(((v=Tt.measured)==null?void 0:v.width)||Tt.width||260);return{x:Number(((N=Tt.position)==null?void 0:N.x)||0)+z+140,y:Number(((M=Tt.position)==null?void 0:M.y)||0)}}return ga()},[ga,Tt]),ri=m.useCallback((v,N={})=>{if(!ke)return de("Readonly workspace"),null;if(!v)return null;const M=Rw(v)||v.id,z=_P(v),K=AP(v),G=N.id||pV(M,d),J=Zd(v.inputs),X=Zd(v.outputs),q={definitionId:M,...z?{marketplaceRef:z}:{},...v.packageId?{marketplacePackageId:v.packageId}:{},...v.version?{marketplaceVersion:v.version}:{},label:N.label||vp(v),role:"normal",body:N.body||"",...N.script||K?{script:N.script||K}:{},...N.scriptRef?{scriptRef:N.scriptRef}:{},...N.implementationRef?{implementationRef:N.implementationRef}:{},...N.implementationMode?{implementationMode:N.implementationMode}:{},input:N.inputs||J,output:N.outputs||X},se={id:G,type:vu,position:N.position||ga(),data:{label:q.label,definitionId:M,...z?{marketplaceRef:z}:{},...v.packageId?{marketplacePackageId:v.packageId}:{},...v.version?{marketplaceVersion:v.version}:{},schemaType:EP(M,v),role:"normal",body:q.body,...q.script?{script:q.script}:{},...q.scriptRef?{scriptRef:q.scriptRef}:{},...q.implementationRef?{implementationRef:q.implementationRef}:{},...q.implementationMode?{implementationMode:q.implementationMode}:{},inputs:q.input,outputs:q.output}},he={...xP(se,{...Y.current,[G]:q},Z),selected:!0};return h(Se=>[...Se.map(qe=>({...qe,selected:!1})),he]),N.openProperties&&ze(G),G},[ga,d,Z,h,ke]),vI=m.useCallback(v=>Bm(v,g.current),[]),kI=m.useCallback(v=>{if(!ke){de("Readonly workspace");return}if(!Bm(v,g.current)){de("端口类型不匹配,已取消连线");return}I(null),h(N=>Fm(N,v)),w(N=>{const M=N.filter(z=>!(z.target===v.target&&z.targetHandle===v.targetHandle));return Ef({...v,markerEnd:{type:fi.ArrowClosed}},M)})},[w,h,ke]),SI=m.useCallback((v,N)=>{if(!ke)return;const M=uV(N,g.current);L.current=M?{...M,preferExisting:!!(v!=null&&v.shiftKey)}:null,I(null)},[ke]),NI=m.useCallback((v,N)=>{var ln,_e,Ee,Ue;if(!ke)return;const M=L.current;if(L.current=null,!M||N!=null&&N.toNode)return;const z=dV(Z,M),K=fV(g.current,b.current,M);if(z.length===0&&K.length===0){de(`没有匹配 ${M.slotType} 端口的节点`);return}const J=!!(v!=null&&v.shiftKey||M.preferExisting)?K.length>0?"existing":"create":z.length>0?"create":"existing",X=((_e=(ln=v==null?void 0:v.changedTouches)==null?void 0:ln[0])==null?void 0:_e.clientX)??(v==null?void 0:v.clientX),q=((Ue=(Ee=v==null?void 0:v.changedTouches)==null?void 0:Ee[0])==null?void 0:Ue.clientY)??(v==null?void 0:v.clientY);if(!Number.isFinite(X)||!Number.isFinite(q))return;const se=document.querySelector(".af-workspace-canvas .react-flow");if(!se)return;const he=se.getBoundingClientRect(),Se=320,qe=Math.max(z.length,K.length),Ge=Math.min(480,150+qe*58),wt=Math.max(12,Math.min(X-he.left,he.width-Se-12)),$t=Math.max(12,Math.min(q-he.top,he.height-Ge-12));I({left:wt,top:$t,flowPosition:r.screenToFlowPosition({x:X,y:q}),draft:M,candidates:z,existingCandidates:K,mode:J,query:""})},[Z,r,ke]),jI=m.useCallback(v=>{if(!ke){de("Readonly workspace"),I(null);return}const N=T.current;if(!N||!(v!=null&&v.def))return;const M=ri(v.def,{position:N.flowPosition});if(!M)return;const z=N.draft.handleType==="source"?{source:N.draft.nodeId,sourceHandle:N.draft.handleId,target:M,targetHandle:`input-${v.slotIndex}`}:{source:M,sourceHandle:`output-${v.slotIndex}`,target:N.draft.nodeId,targetHandle:N.draft.handleId};h(K=>Fm(K,z)),w(K=>{const G=K.filter(J=>!(J.target===z.target&&J.targetHandle===z.targetHandle));return Ef({...z,markerEnd:{type:fi.ArrowClosed}},G)}),I(null)},[ri,w,ke]),CI=m.useCallback(v=>{if(!ke){de("Readonly workspace"),I(null);return}const N=v==null?void 0:v.connection;if(!N||!Bm(N,g.current)){de("端口类型不匹配,已取消连线"),I(null);return}h(M=>Fm(M,N)),w(M=>{const z=M.filter(K=>!(K.target===N.target&&K.targetHandle===N.targetHandle));return Ef({...N,markerEnd:{type:fi.ArrowClosed}},z)}),I(null)},[w,h,ke]),rv=m.useCallback(v=>{v&&(ri(v,{position:ud()}),Pe(!1),nr(""))},[ri,ud]),sv=m.useCallback(v=>{v&&(Jl(v,ud()),Pe(!1),nr(""))},[Jl,ud]),EI=m.useCallback(v=>{var M,z,K;if(Ze)return;const N=v==null?void 0:v.target;HS(N)||(M=N==null?void 0:N.closest)!=null&&M.call(N,"button, a, [role='button'], .react-flow__handle")||(K=(z=x.current)==null?void 0:z.focus)==null||K.call(z,{preventScroll:!0})},[Ze]);m.useEffect(()=>{const v=N=>{var se;if(N.defaultPrevented)return;const M=h9(N.target)||HS(N.target);if((N.metaKey||N.ctrlKey)&&N.key.toLowerCase()==="s"){N.preventDefault(),Bt().catch(he=>de(String(he.message||he)));return}if((N.metaKey||N.ctrlKey)&&N.key.toLowerCase()==="k"){N.preventDefault(),N.stopPropagation(),hb(he=>!he);return}if(Eh)return;if(Ch){(N.key==="Escape"||RS(N))&&(N.preventDefault(),Ju(!1));return}const z=N.key.toLowerCase(),K=(N.metaKey||N.ctrlKey)&&z==="c",G=(N.metaKey||N.ctrlKey)&&z==="v",J=M&&K&&eV(N.target);if(M&&!J)return;const X=(N.metaKey||N.ctrlKey)&&!N.shiftKey&&z==="z",q=(N.metaKey||N.ctrlKey)&&(N.shiftKey&&z==="z"||z==="y");if(X||q){if(Ze){N.preventDefault(),N.stopPropagation(),de("展示页布局会自动保存");return}if(!ke){N.preventDefault(),de("Readonly workspace");return}N.preventDefault(),N.stopPropagation();const he=X?jb():Cb();de(he?X?"Undo canvas change":"Redo canvas change":X?"Nothing to undo":"Nothing to redo");return}if(K){if(Ze)return;const he=Rt.current,Se=(g.current||[]).some(Ge=>Ge==null?void 0:Ge.selected)?g.current:(g.current||[]).map(Ge=>he&&Ge.id===he?{...Ge,selected:!0}:Ge),qe=DW(Se,b.current,Y.current);qe&&(N.preventDefault(),N.stopPropagation(),P.current=qe,EV(qe),J&&typeof((se=N.target)==null?void 0:se.blur)=="function"&&N.target.blur(),de(`Copied ${qe.nodes.length} node${qe.nodes.length>1?"s":""}`));return}if(G){if(Ze){N.preventDefault(),N.stopPropagation();return}if(!ke){N.preventDefault(),de("Readonly workspace");return}const he=P.current||_V();he&&!P.current&&(P.current=he);const Se=FW(he,g.current,b.current,Y.current);Se&&(N.preventDefault(),N.stopPropagation(),Y.current=Se.instances,_(Se.instances),h(Se.nodes),w(Se.edges),de(`Pasted ${Se.pastedNodeIds.length} node${Se.pastedNodeIds.length>1?"s":""}`));return}if(RS(N)&&!N.metaKey&&!N.ctrlKey&&!N.altKey){N.preventDefault(),Ju(!0);return}if(z==="g"&&!N.metaKey&&!N.ctrlKey&&!N.altKey){N.preventDefault(),Yb();return}if(N.key==="a"||N.key==="A"){if(N.metaKey||N.ctrlKey){N.preventDefault(),Ze?F(j.current.nodeIds):(h(he=>he.map(Se=>({...Se,selected:!0}))),w(he=>he.map(Se=>({...Se,selected:!1}))));return}if(N.altKey)return;if(Ze){N.preventDefault(),an(!0);return}if(!ke){N.preventDefault(),de("Readonly workspace");return}N.preventDefault(),Pe(!0);return}if((N.key==="v"||N.key==="V")&&!N.metaKey&&!N.ctrlKey&&!N.altKey){N.preventDefault(),mb("select");return}if((N.key==="h"||N.key==="H")&&!N.metaKey&&!N.ctrlKey&&!N.altKey){N.preventDefault(),mb("pan");return}(N.key==="f"||N.key==="F")&&!N.metaKey&&!N.ctrlKey&&!N.altKey&&(N.preventDefault(),qb())};return window.addEventListener("keydown",v,!0),()=>window.removeEventListener("keydown",v,!0)},[Yb,Ze,Eh,qb,Cb,Bt,Ch,w,h,jb,ke]);const _I=m.useCallback(v=>{os(N=>{const M=new Set(N);return M.has(v)?M.delete(v):M.add(v),M})},[]),PI=m.useCallback((v,N)=>{v.dataTransfer.effectAllowed="copy",v.dataTransfer.setData("application/x-agentflow-workspace-file",JSON.stringify({path:N.path,name:N.name,type:N.type})),v.dataTransfer.setData("text/plain",N.path)},[]),AI=m.useCallback((v,N)=>{v.dataTransfer.effectAllowed="move",v.dataTransfer.setData("application/agentflow-node",N.id),v.dataTransfer.setData("text/plain",N.id)},[]),dd=m.useCallback(async(v,N)=>{const M=String((v==null?void 0:v.name)||(v==null?void 0:v.path)||"").toLowerCase(),z=M.split(".").pop(),K=z==="html"?"display_html":z==="csv"||z==="tsv"||z==="json"&&/\b(table|data|rows|report)\b/i.test(M)?"display_table":["png","jpg","jpeg","gif","webp","svg"].includes(z)?"display_image":"display_markdown",G=Z.find(Se=>Se.id===K);if(!G){de("展示节点不可用");return}const J=K==="display_image";let X=String(v.path||"");if(!J){const Se=Os(i);Se.set("path",v.path);const qe=await fetch(`/api/workspace/file?${Se.toString()}`),Ge=await qe.json();if(!qe.ok)throw new Error(Ge.error||"读取文件失败");X=String(Ge.content||"")}const q=K==="display_image"?"src":"content",se=Zd(G.inputs).map(Se=>Se.name===q?{...Se,default:X,value:X}:Se),he=Zd(G.outputs).map(Se=>Se.name===q?{...Se,default:X,value:X}:Se);ri(G,{label:v.name||"Display",body:X,inputs:se,outputs:he,position:N}),de(`已创建展示:${v.path}`)},[ri,i,Z]),II=m.useCallback(v=>{if(!ke){de("Readonly workspace");return}dd(v,ga()).catch(N=>de(String(N.message||N)))},[dd,ga,ke]),TI=m.useCallback(v=>{if(!ke){v.preventDefault(),de("Readonly workspace");return}const N=v.dataTransfer.getData("application/x-agentflow-workspace-file");if(N){v.preventDefault();let J;try{J=JSON.parse(N)}catch{return}if(!(J!=null&&J.path))return;const X=r.screenToFlowPosition({x:v.clientX,y:v.clientY});dd(J,X).catch(q=>de(String(q.message||q)));return}const M=v.dataTransfer.getData("application/agentflow-snippet");if(M){const J=te.find(q=>`${q.id}@${q.version}`===M);if(!J)return;v.preventDefault();const X=r.screenToFlowPosition({x:v.clientX,y:v.clientY});Jl(J,X);return}const z=v.dataTransfer.getData("application/agentflow-node");if(!z)return;const K=Z.find(J=>J.id===z);if(!K)return;v.preventDefault();const G=r.screenToFlowPosition({x:v.clientX,y:v.clientY});ri(K,{position:G})},[dd,ri,te,Jl,Z,r,ke]),RI=m.useCallback(v=>{if(!ke)return;const N=Array.from(v.dataTransfer.types||[]);!N.includes("application/x-agentflow-workspace-file")&&!N.includes("application/agentflow-node")&&!N.includes("application/agentflow-snippet")||(v.preventDefault(),v.dataTransfer.dropEffect=N.includes("application/agentflow-node")||N.includes("application/agentflow-snippet")?"move":"copy")},[ke]),MI=m.useCallback(async(v="")=>{if(!ke){de("Readonly workspace");return}const N=window.prompt("新文件名",v?`${v}/notes.md`:"notes.md");if(!N)return;const M=v&&!N.includes("/")?`${v}/${N}`:N;try{const z=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:M,content:""})}),K=await z.json();if(!z.ok)throw new Error(K.error||"创建文件失败");await Pn(),os(G=>{const J=new Set(G);for(const X of tf(K.path||M))J.delete(X);return J}),de(`已创建 ${K.path}`)}catch(z){de(String(z.message||z))}},[i,Pn,ke]),LI=m.useCallback(async(v="")=>{if(!ke){de("Readonly workspace");return}const N=window.prompt("新文件夹名",v?`${v}/docs`:"docs");if(!N)return;const M=v&&!N.includes("/")?`${v}/${N}`:N;try{const z=await fetch("/api/workspace/folder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:M})}),K=await z.json();if(!z.ok)throw new Error(K.error||"创建文件夹失败");await Pn(),os(G=>{const J=new Set(G);for(const X of tf(K.path||M))J.delete(X);return K.path&&J.delete(K.path),J}),de(`已创建 ${K.path}`)}catch(z){de(String(z.message||z))}},[i,Pn,ke]),$I=m.useCallback(async v=>{if(!ke){de("Readonly workspace");return}if(!(!(v!=null&&v.path)||!window.confirm(`删除 ${v.path}?`)))try{const N=await fetch("/api/workspace/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:v.path})}),M=await N.json();if(!N.ok)throw new Error(M.error||"删除失败");de(`已删除 ${M.path}`),await Pn()}catch(N){de(String(N.message||N))}},[i,Pn,ke]),iv=m.useCallback(async()=>{if(!ke){de("Readonly workspace");return}const v=Fl.trim();if(!v||Kr)return;const N=dc(d,y,Y.current);ib(""),ob(!0),Eb("workspace"),Gu(M=>[...M,{role:"user",text:v,at:Date.now()}]);try{await Bt(d,y);const M=await fetch("/api/workspace/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,prompt:v,outputKind:"markdown",workspaceGraph:N,allowFlowYaml:!1,model:ei,selectedSkills:us,selectedNodeIds:od})}),z=await M.json();if(!M.ok)throw new Error(z.error||"生成失败");const K=String(z.content||"").trim();Gu(G=>[...G,{role:"assistant",text:K,at:Date.now()}]),await fa(),de("AI 生成完成")}catch(M){const z=String(M.message||M);Gu(K=>[...K,{role:"assistant",text:z,error:!0,at:Date.now()}]),de(z)}finally{ob(!1)}},[ei,Kr,Fl,y,i,fa,d,Eb,Bt,od,us,ke]),pr=lb.find(v=>v.id===Sh)||null,OI=pr?Array.isArray(pr.messages)?pr.messages:[]:ab,ov=pr?pr.status==="running":Kr,DI=pr?pr.status==="running"?`${pr.label} running`:pr.status==="paused"?`${pr.label} paused`:pr.status==="failed"?`${pr.label} failed`:`${pr.label} done`:Kr?"Workspace agent running":ab.length>0?"Workspace conversation":"Ready",FI=String(i.flowId||"").trim()||"Workspace";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:()=>n("/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} · ${ta}`:ta||"PROJECT",children:[a.jsx("span",{className:"af-pipeline-brand-name",children:FI}),a.jsxs("span",{className:"af-pipeline-brand-ver",children:["V",Y9,"-STABLE"]})]}),a.jsxs("div",{className:"af-view-switch","aria-label":"视图切换",children:[a.jsx("button",{type:"button",className:o==="workspace"?"af-view-switch__active":"",onClick:()=>Gb("workspace"),children:"Workspace"}),a.jsx("button",{type:"button",className:o==="display"?"af-view-switch__active":"",onClick:()=>Gb("display"),children:"Display"})]})]}),a.jsxs("div",{className:"af-pipeline-top-right af-workspace-actions",children:[a.jsx("span",{className:"af-workspace-save-status",children:VA}),Ze?a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:"af-workspace-display-share-btn",disabled:Fe||!(tt!=null&&tt.absoluteUrl)&&S.nodeIds.length===0,onClick:()=>{gn(""),Fn(!0)},title:tt!=null&&tt.absoluteUrl?"查看展示链接":S.nodeIds.length===0?"先添加展示节点":"生成展示链接",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:Fe?"hourglass_empty":"ios_share"}),Fe?"生成中":tt!=null&&tt.absoluteUrl?"展示链接":"生成链接"]}),a.jsxs("button",{type:"button",className:"af-workspace-display-share-btn",disabled:pa.length===0,onClick:()=>an(!0),title:pa.length===0?"当前 workspace 没有 display 节点":"选择展示节点 (A)",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add_to_photos"}),"添加展示"]})]}):null,a.jsxs("button",{type:"button",className:"af-workspace-display-share-btn",onClick:fI,title:"查看我的展示分享",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"folder_shared"}),"我的分享"]}),a.jsx("button",{type:"button",className:"af-icon-btn",disabled:!Nb,onClick:()=>u(!0),"aria-label":e("project:archiveModal.title"),title:e("project:archiveModal.title"),children:a.jsx("span",{className:"material-symbols-outlined",children:"archive"})}),a.jsx("button",{type:"button",className:"af-icon-btn af-icon-btn--danger",disabled:!Nb,onClick:()=>f(!0),"aria-label":e("flow:topbar.deletePipeline"),title:e("flow:topbar.deletePipeline"),children:a.jsx("span",{className:"material-symbols-outlined",children:"delete_forever"})}),a.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>Ju(!0),"aria-label":"快捷键",title:"快捷键 (?)",children:a.jsx("span",{className:"material-symbols-outlined",children:"help"})}),a.jsx("button",{type:"button",className:"af-composer-topbar-btn"+(Nh?" af-composer-topbar-btn--active":"")+(Kr?" af-composer-topbar-btn--running":""),disabled:Ze,onClick:()=>{Wl(null),Hl(v=>!v)},children:"AI"}),a.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!ke,onClick:()=>Bt().catch(v=>de(String(v.message||v))),children:"Save"})]})]}),st?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:st}),a.jsx("button",{type:"button",onClick:()=>dn(""),"aria-label":"关闭发布提示",children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}):null,a.jsxs("div",{className:"af-workspace-body"+(!Ze&&(Nh||Ce)?" af-workspace-body--drawer":"")+(!Ze&&Vl?" af-workspace-body--sidebar-collapsed":"")+(Ze?" af-workspace-body--display-mode":""),children:[!Ze&&Vl?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:()=>Pe(!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:()=>Xu(!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:()=>Xu(!1),"aria-label":"展开侧边栏",title:(rr==null?void 0:rr.username)||(rr==null?void 0:rr.userId)||"展开侧边栏",children:aI})]})}):null,Ze?null:a.jsxs("aside",{ref:We,className:"af-workspace-sidebar"+(ho?" af-workspace-sidebar--resizing":""),"aria-hidden":Vl,style:{"--af-work-files-pane-height":`${Math.round(_n)}px`},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:()=>Xu(!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",disabled:!ke,onClick:()=>MI(ni),"aria-label":"新增文件",title:ni?`在 ${ni} 新增文件`:"新增文件",children:a.jsx("span",{className:"material-symbols-outlined",children:"note_add"})}),a.jsx("button",{type:"button",className:"af-icon-btn",disabled:!ke,onClick:()=>LI(ni),"aria-label":"新增文件夹",title:ni?`在 ${ni} 新增文件夹`:"新增文件夹",children:a.jsx("span",{className:"material-symbols-outlined",children:"create_new_folder"})}),a.jsx("button",{type:"button",className:"af-icon-btn",disabled:!ke||je,onClick:()=>Db(ni),"aria-label":"上传文件",title:ni?`上传到 ${ni}`:"上传文件",children:a.jsx("span",{className:"material-symbols-outlined",children:je?"hourglass_top":"upload_file"})}),a.jsx("button",{type:"button",className:"af-icon-btn",disabled:!ke||!fs,onClick:()=>$I(fs),"aria-label":"删除选中项",title:fs?`删除 ${fs.path}`:"先选择文件或文件夹",children:a.jsx("span",{className:"material-symbols-outlined",children:"delete"})}),a.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>void Pn(),"aria-label":"刷新文件",title:"刷新文件",children:a.jsx("span",{className:"material-symbols-outlined",children:"refresh"})}),a.jsx("input",{ref:Mt,type:"file",multiple:!0,className:"af-visually-hidden",onChange:XA})]})]}),a.jsx("input",{className:"af-workspace-search",value:Ei,onChange:v=>na(v.target.value),placeholder:"搜索文件..."}),a.jsx("div",{className:"af-workspace-files-scroll",onClick:iI,children:a.jsx(VP,{items:sI,onOpen:II,selectedPath:as,collapsedDirs:ra,onToggleDir:_I,onSelect:v=>po(v.path||""),onFileDragStart:PI})})]}),a.jsx("button",{type:"button",className:"af-workspace-sidebar-resizer",onPointerDown:DA,role:"separator","aria-orientation":"horizontal","aria-label":"调整 Files 和 Palette 区域大小",title:"拖动调整 Files / Palette 高度"}),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:re==="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:le,onChange:v=>we(v.target.value),placeholder:re==="flows"?"搜索流程片段...":"搜索节点...","aria-label":re==="flows"?"搜索流程片段":"搜索节点"})]}),a.jsxs("div",{className:"af-palette-tabs",role:"tablist","aria-label":"Palette 类型",children:[a.jsxs("button",{type:"button",role:"tab","aria-selected":re==="nodes",className:"af-palette-tab"+(re==="nodes"?" af-palette-tab--active":""),onClick:()=>ye("nodes"),children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"category"}),"节点"]}),a.jsxs("button",{type:"button",role:"tab","aria-selected":re==="flows",className:"af-palette-tab"+(re==="flows"?" af-palette-tab--active":""),onClick:()=>ye("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:re==="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:cI,disabled:An.length<2,title:An.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:["已选 ",An.length," 节点 / ",ld.length," 连线"]})]})}),De?a.jsx("p",{className:"af-err af-palette-list-err",children:De}):null,ce?a.jsx("p",{className:"af-palette-empty",children:"正在加载流程片段..."}):ev.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:ev.map(v=>{const N=`${v.id}@${v.version}`,M=v.displayName||v.name||v.id,z=v.description||`${v.nodeCount||0} 个节点,${v.edgeCount||0} 条连线`;return a.jsxs("button",{type:"button",className:"af-palette-card af-flow-snippet-card",draggable:!0,onDragStart:K=>{K.dataTransfer.effectAllowed="move",K.dataTransfer.setData("application/agentflow-snippet",N),K.dataTransfer.setData("text/plain",N)},onClick:()=>Jl(v),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:[v.id,"@",v.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:[v.nodeCount||0," nodes"]}),a.jsxs("span",{children:[v.edgeCount||0," edges"]})]})]},N)})})]}):a.jsx("p",{className:"af-palette-empty",children:le.trim()?"没有匹配的流程片段":"暂无流程片段。选择多个节点后发布。"})]}):a.jsxs(a.Fragment,{children:[Ca.map(v=>{var N;return(N=Mh[v])!=null&&N.length?a.jsxs("section",{className:`af-palette-section af-flow-palette-section--${v}`,children:[a.jsx("h3",{className:"af-palette-cat",children:v}),a.jsx("div",{className:"af-palette-cards",children:Mh[v].map(M=>{const z=US(M.inputs,"input"),K=US(M.outputs,"output"),G=Dy(M),J=Sc(M);return a.jsxs("button",{type:"button",className:"af-palette-card",draggable:!0,onDragStart:X=>AI(X,M),onClick:()=>ri(M),title:G||M.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:VS(v)})}),a.jsxs("span",{className:"af-palette-card-main",children:[a.jsx("span",{className:"af-palette-card-label",children:J}),J!==M.id?a.jsx("span",{className:"af-palette-card-id",children:M.id}):null]})]}),G?a.jsx("span",{className:"af-palette-card-desc",children:G}):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((X,q)=>a.jsxs("span",{className:"af-palette-card-port",title:KS("input",X,q),children:[a.jsx("span",{className:"af-palette-card-port-dot",style:{background:Tn(X==null?void 0:X.type)}}),a.jsx("span",{className:"af-palette-card-port-name",children:Jd(X,q)})]},`in-${q}`)),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:[K.list.length," OUT"]}),a.jsxs("span",{className:"af-palette-card-port-list",children:[K.shown.map((X,q)=>a.jsxs("span",{className:"af-palette-card-port",title:KS("output",X,q),children:[a.jsx("span",{className:"af-palette-card-port-name",children:Jd(X,q)}),a.jsx("span",{className:"af-palette-card-port-dot",style:{background:Tn(X==null?void 0:X.type)}})]},`out-${q}`)),K.hidden>0?a.jsxs("span",{className:"af-palette-card-port-more",children:["+",K.hidden]}):null]})]})]})]},M.id)})})]},v):null}),Z.length>0&&le.trim()&&Ca.every(v=>{var N;return!((N=Mh[v])!=null&&N.length)})?a.jsx("p",{className:"af-palette-empty",children:"没有匹配的节点"}):null]})})]})]}),a.jsxs("main",{ref:x,className:"af-workspace-canvas",tabIndex:-1,onPointerDownCapture:EI,children:[a.jsx(x_,{className:"af-flow-canvas af-workspace-flow"+(_h==="pan"?" af-flow-canvas--tool-pan":" af-flow-canvas--tool-select")+(Ze?" af-workspace-flow--display-mode":""),nodes:eI,edges:tI,nodeTypes:QV,onNodesChange:wI,onEdgesChange:bI,onConnect:Ze?void 0:kI,onConnectStart:Ze?void 0:SI,onConnectEnd:Ze?void 0:NI,isValidConnection:Ze?void 0:vI,onNodeClick:(v,N)=>{var M;if(Ze){F([Wm(N.id)]);return}if((M=N==null?void 0:N.data)!=null&&M.isWorkspaceGroup){ze("");return}if(v.detail>=3){Hl(!1),h(z=>z.map(K=>({...K,selected:K.id===N.id}))),w(z=>z.map(K=>({...K,selected:!1}))),ze(N.id);return}xn&&ze(N.id)},onNodeDoubleClick:v=>{v.preventDefault()},onPaneClick:()=>{Ze?F([]):ze("")},onDrop:Ze?void 0:TI,onDragOver:Ze?void 0:RI,nodesDraggable:Ze?!0:ke,nodesConnectable:Ze?!1:ke,edgesReconnectable:Ze?!1:ke,deleteKeyCode:Ze?null:ke?["Backspace","Delete"]:null,selectionOnDrag:_h==="select",panOnDrag:_h==="pan"?!0:[1,2],panActivationKeyCode:"Space",proOptions:{hideAttribution:!0},fitView:!1,minZoom:.1,maxZoom:4,children:a.jsx(b_,{color:"rgba(255,255,255,0.12)",gap:22,size:1})}),!Ze&&O?(()=>{var X;const v=String(O.query||"").trim().toLowerCase(),N=O.mode==="create"?"create":"existing",M=Array.isArray(O.candidates)?O.candidates:[],z=Array.isArray(O.existingCandidates)?O.existingCandidates:[],K=v?M.filter(q=>{var se,he,Se;return[(se=q.def)==null?void 0:se.id,q.displayLabel,q.description,(he=q.slot)==null?void 0:he.name,(Se=q.slot)==null?void 0:Se.type].filter(Boolean).some(qe=>String(qe).toLowerCase().includes(v))}):M,G=v?z.filter(q=>{var se,he;return[q.nodeId,q.nodeLabel,q.definitionId,(se=q.slot)==null?void 0:se.name,(he=q.slot)==null?void 0:he.type].filter(Boolean).some(Se=>String(Se).toLowerCase().includes(v))}):z,J=O.draft.handleType==="source"?"IN":"OUT";return a.jsxs("div",{className:"af-connect-node-menu",style:{left:O.left,top:O.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:Tn((X=O.draft.slot)==null?void 0:X.type)},"aria-hidden":!0}),a.jsxs("span",{children:["匹配 ",O.draft.slotType," 节点"]})]}),a.jsx("button",{type:"button",className:"af-connect-node-menu__close","aria-label":"关闭",onClick:()=>I(null),children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),a.jsxs("div",{className:"af-connect-node-menu__tabs",role:"tablist","aria-label":"连接方式",children:[a.jsxs("button",{type:"button",className:N==="existing"?"af-connect-node-menu__tab af-connect-node-menu__tab--active":"af-connect-node-menu__tab",disabled:z.length===0,onClick:()=>I(q=>q&&{...q,mode:"existing",query:""}),children:["连接已有 ",a.jsx("span",{children:z.length})]}),a.jsxs("button",{type:"button",className:N==="create"?"af-connect-node-menu__tab af-connect-node-menu__tab--active":"af-connect-node-menu__tab",disabled:M.length===0,onClick:()=>I(q=>q&&{...q,mode:"create",query:""}),children:["新建节点 ",a.jsx("span",{children:M.length})]})]}),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:O.query,onChange:q=>I(se=>se&&{...se,query:q.target.value}),placeholder:"搜索节点",autoFocus:!0})]}),a.jsxs("div",{className:"af-connect-node-menu__list",children:[N==="create"?K.map(q=>{var Se,qe;const se=q.displayLabel||((Se=q.def)==null?void 0:Se.id),he=Jd(q.slot,q.slotIndex);return a.jsxs("button",{type:"button",className:"af-connect-node-menu__item",onClick:()=>jI(q),title:q.description||q.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:se}),se!==q.def.id?a.jsx("span",{className:"af-connect-node-menu__item-id",children:q.def.id}):null]}),a.jsxs("span",{className:"af-connect-node-menu__port",children:[a.jsx("span",{children:J}),a.jsx("span",{className:"af-connect-node-menu__port-dot",style:{background:Tn((qe=q.slot)==null?void 0:qe.type)},"aria-hidden":!0}),a.jsx("span",{className:"af-connect-node-menu__port-name",children:he})]})]},`${q.def.id}-${q.slotIndex}`)}):G.map(q=>{var Se;const se=q.nodeLabel||q.nodeId,he=Jd(q.slot,q.slotIndex);return a.jsxs("button",{type:"button",className:"af-connect-node-menu__item",onClick:()=>CI(q),title:`${q.definitionId||q.nodeId} · ${he}`,children:[a.jsxs("span",{className:"af-connect-node-menu__item-main",children:[a.jsx("span",{className:"af-connect-node-menu__item-label",children:se}),a.jsxs("span",{className:"af-connect-node-menu__item-id",children:[q.definitionId?`${q.definitionId} · `:"",q.nodeId]})]}),a.jsxs("span",{className:"af-connect-node-menu__port",children:[a.jsx("span",{children:J}),a.jsx("span",{className:"af-connect-node-menu__port-dot",style:{background:Tn((Se=q.slot)==null?void 0:Se.type)},"aria-hidden":!0}),a.jsx("span",{className:"af-connect-node-menu__port-name",children:he}),q.occupied?a.jsx("span",{className:"af-connect-node-menu__port-badge",children:"替换"}):null]})]},`${q.nodeId}-${q.handleId}`)}),(N==="create"?K.length:G.length)===0?a.jsx("div",{className:"af-connect-node-menu__empty",children:"没有匹配结果"}):null]})]})})():null,!Ze&&!BA?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:()=>jh(!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:An.length===0?a.jsx("span",{className:"af-composer-selected-empty",children:"选择画布节点后,可作为本次 Workspace AI 的上下文。"}):An.map(v=>{var K,G;const N=String(((K=v.data)==null?void 0:K.label)??v.id),M=(G=v.data)!=null&&G.definitionId?String(v.data.definitionId):"",z=M&&M!==N?`${N} · ${v.id} · ${M}`:`${N} · ${v.id}`;return a.jsxs("div",{className:"af-composer-node-chip",title:z,children:[a.jsx("span",{className:"af-composer-node-chip-kind",children:M||"node"}),a.jsx("span",{className:"af-composer-node-chip-label",children:N}),a.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>xI(v.id),"aria-label":`取消选择 ${v.id}`,children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},v.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:Fl,rows:2,onChange:v=>ib(v.target.value),onKeyDown:v=>{(v.metaKey||v.ctrlKey)&&v.key==="Enter"&&(v.preventDefault(),iv())},placeholder:"描述你想在 workspace 中生成、分析或展示的内容",autoComplete:"off",spellCheck:!1,disabled:!ke})}),a.jsxs("div",{className:"af-composer-toolbar",children:[a.jsxs("div",{className:"af-composer-skills-field",children:[a.jsxs("button",{ref:kh,type:"button",className:"af-composer-skills-button"+(us.length>0?" af-composer-skills-button--active":""),disabled:Kr||!ke,"aria-haspopup":"listbox","aria-expanded":Yu,onClick:()=>vh(v=>!v),children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"extension"}),a.jsx("span",{children:us.length>0?`Skills ${us.length}`:"Skills"})]}),Yu&&!Kr?ar.createPortal(a.jsx("div",{ref:rb,className:"af-composer-skills-menu",role:"listbox","aria-label":"Skills",style:zA,children:cs.length===0?a.jsx("div",{className:"af-composer-skills-empty",children:"No skills found"}):a.jsxs(a.Fragment,{children:[ha.groups.map(v=>{const N=dl(v,cs),M=AM(v,Lh,cs),z=FA.has(v.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:K=>{const G=K.target.checked;Dl(J=>G?_M(J,N):PM(J,N))}}),a.jsxs("span",{className:"af-composer-skill-group-title-main",children:[a.jsx("span",{children:v.name}),v.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?`展开 ${v.name}`:`收起 ${v.name}`,onClick:()=>{nb(K=>{const G=new Set(K);return G.has(v.id)?G.delete(v.id):G.add(v.id),G})},children:[a.jsx("span",{children:v.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:v.skills.map(K=>a.jsxs("label",{className:"af-composer-skill-option",children:[a.jsx("input",{type:"checkbox",checked:Lh.has(K.key),onChange:G=>{const J=G.target.checked;Dl(X=>J?X.includes(K.key)?X:[...X,K.key]:X.filter(q=>q!==K.key))}}),a.jsxs("span",{className:"af-composer-skill-option-main",children:[a.jsx("span",{className:"af-composer-skill-option-title",children:K.name}),K.description?a.jsx("span",{className:"af-composer-skill-option-desc",children:K.description}):null]})]},`${v.id}:${K.key}`))})]},v.id)}),ha.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:ha.ungrouped.length})]}),ha.ungrouped.map(v=>a.jsxs("label",{className:"af-composer-skill-option",children:[a.jsx("input",{type:"checkbox",checked:Lh.has(v.key),onChange:N=>{const M=N.target.checked;Dl(z=>M?z.includes(v.key)?z:[...z,v.key]:z.filter(K=>K!==v.key))}}),a.jsxs("span",{className:"af-composer-skill-option-main",children:[a.jsx("span",{className:"af-composer-skill-option-title",children:v.name}),v.description?a.jsx("span",{className:"af-composer-skill-option-desc",children:v.description}):null]})]},`ungrouped:${v.key}`))]}):null]})}),document.body):null]}),a.jsx("label",{className:"af-composer-model-field",children:a.jsxs("select",{className:"af-composer-model-select",value:ei,onChange:v=>MA(v.target.value),"aria-label":"模型",children:[a.jsx("option",{value:"",children:"默认模型"}),oI.map(v=>a.jsx("option",{value:v.value,children:v.label},v.value))]})}),a.jsx("button",{type:"button",className:"af-composer-send"+(Fl.trim()&&!Kr?" af-composer-send--active":"")+(Kr?" af-composer-send--stop":""),disabled:Kr||!Fl.trim()||!ke,"aria-label":Kr?"Running":"Send",onClick:()=>void iv(),children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:Kr?"sync":"arrow_upward"})})]})]})]})}):Ze?null:a.jsx("button",{type:"button",className:"af-workspace-composer-fab",onClick:()=>jh(!1),"aria-label":"展开 AI 输入框",title:"展开 AI 输入框",children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"auto_awesome"})})]}),!Ze&&Nh?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:()=>Hl(!1),"aria-label":"关闭 AI 对话侧栏",children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsxs("div",{className:"af-composer-session-tabs",children:[a.jsx("button",{type:"button",className:"af-composer-session-tab"+(Sh==="workspace"?" af-composer-session-tab--active":""),onClick:()=>zl("workspace"),children:a.jsx("span",{className:"af-composer-session-label",children:"Workspace"})}),lb.map(v=>a.jsx("button",{type:"button",className:"af-composer-session-tab"+(Sh===v.id?" af-composer-session-tab--active":"")+(v.status==="running"?" af-composer-session-tab--running":""),onClick:()=>zl(v.id),title:v.runNodeId||v.label,children:a.jsx("span",{className:"af-composer-session-label",children:v.label})},v.id))]}),a.jsx("div",{className:"af-composer-sidebar-status"+(ov?" af-composer-sidebar-status--running":""),role:"status","aria-live":"polite",children:DI}),a.jsx("div",{className:"af-composer-sidebar-thread",children:a.jsx(i7,{messages:OI,running:ov,showRunningIndicator:!pr})})]})}):!Ze&&Ce&&Tt?a.jsx("aside",{className:"af-pipeline-drawer af-workspace-node-drawer","aria-label":"Workspace Node Properties",children:a.jsx(R9,{draft:Ce,setDraft:En,definitionId:String(((av=Tt.data)==null?void 0:av.definitionId)||Tt.id),systemPromptReadonly:String(((lv=Tt.data)==null?void 0:lv.description)||""),modelLists:sa,disabled:!ke,onIdBlur:()=>Rh(!0),onClose:()=>ze(""),onPublishToMarketplace:YA,error:Er,ioSlots:{inputs:Array.isArray(Ce==null?void 0:Ce.inputs)?Ce.inputs:[],outputs:Array.isArray(Ce==null?void 0:Ce.outputs)?Ce.outputs:[]}})}):null,!Ze&&Bl?ar.createPortal(a.jsx("div",{className:"af-workspace-run-logs-overlay",role:"presentation",onMouseDown:()=>Wl(null),children:a.jsx("aside",{className:"af-workspace-run-logs-drawer","aria-label":"Workspace Run Logs",onMouseDown:v=>v.stopPropagation(),children:a.jsx(v9,{flowParams:i,scheduleNodeId:Bl.scheduleNodeId,runNodeId:Bl.runNodeId,lastRunId:Bl.lastRunId,label:Bl.label,onClose:()=>Wl(null)})})}),document.body):null,a.jsx(y9,{open:Ch,onClose:()=>Ju(!1)}),a.jsx(w9,{open:Eh,onClose:()=>hb(!1),onJump:rI,nodes:nI}),a.jsx(M9,{open:c,onClose:()=>u(!1),flowId:i.flowId||"",flowSource:Qu,onArchived:()=>{u(!1),n("/projects?tab=archived")}}),a.jsx(L9,{open:p&&!!i.flowId,onClose:()=>f(!1),flowId:i.flowId||"",flowSource:Qu,flowArchived:!!i.archived,onDeleted:async()=>{f(!1),n("/projects")}}),Ie?ar.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:()=>et(!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:ut.name,onChange:v=>{const N=v.target.value;Ae(M=>({...M,name:N,id:M.id?M.id:N.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:ut.id,onChange:v=>Ae(N=>({...N,id:v.target.value})),placeholder:"content-cleanup-snippet"})]}),a.jsxs("label",{className:"af-flow-snippet-field",children:[a.jsx("span",{children:"说明"}),a.jsx("textarea",{value:ut.description,onChange:v=>Ae(N=>({...N,description:v.target.value})),placeholder:"这段流程适合什么 workspace 场景、需要接哪些上下游。",rows:4})]}),a.jsxs("div",{className:"af-flow-snippet-summary",children:["将发布 ",An.length," 个节点和 ",ld.length," 条内部连线。"]}),Te?a.jsx("div",{className:"af-flow-snippet-error",children:Te}):null]}),a.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[a.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>et(!1),children:"取消"}),a.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:Qe||!ut.name.trim(),onClick:()=>void uI(),children:Qe?"发布中...":"发布"})]})]})}),document.body):null,Ub?a.jsx(HV,{node:Ub,onClose:()=>Q("")}):null,me?ar.createPortal(a.jsx("div",{className:"af-flow-snippet-modal-overlay",children:a.jsxs("div",{className:"af-flow-snippet-modal af-display-share-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:"present_to_all"}),"发布展示页"]}),a.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>Oe(!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:kt.title,onChange:v=>Nt(N=>({...N,title:v.target.value})),placeholder:"展示页标题",autoFocus:!0})]}),a.jsxs("label",{className:"af-flow-snippet-field",children:[a.jsx("span",{children:"布局"}),a.jsxs("select",{className:"af-display-share-select",value:kt.layout,onChange:v=>Nt(N=>({...N,layout:v.target.value})),children:[a.jsx("option",{value:"gallery",children:"Gallery"}),a.jsx("option",{value:"document",children:"Document"}),a.jsx("option",{value:"slides",children:"Slides"})]})]}),a.jsxs("label",{className:"af-flow-snippet-field",children:[a.jsx("span",{children:"有效期"}),a.jsx("select",{className:"af-display-share-select",value:GS(kt),onChange:v=>{const N=v.target.value;Nt(M=>({...M,permanent:N==="permanent",expiresInDays:N==="permanent"?M.expiresInDays||30:Number(N)}))},children:Vm.map(v=>a.jsx("option",{value:v.value,children:v.label},v.value))})]}),a.jsx("div",{className:"af-display-share-node-list",role:"group","aria-label":"选择展示节点",children:ad.map(v=>{var M,z;const N=Array.isArray(kt.nodeIds)&&kt.nodeIds.includes(v.id);return a.jsxs("label",{className:"af-display-share-node-row",children:[a.jsx("input",{type:"checkbox",checked:N,onChange:()=>dI(v.id)}),a.jsxs("span",{className:"af-display-share-node-row__main",children:[a.jsx("strong",{children:((M=v.data)==null?void 0:M.label)||v.id}),a.jsxs("small",{children:[Dt((z=v.data)==null?void 0:z.definitionId)," · ",v.id]})]})]},v.id)})}),tt!=null&&tt.absoluteUrl?a.jsxs("div",{className:"af-display-share-result",children:[a.jsx("input",{type:"text",readOnly:!0,value:tt.absoluteUrl,onFocus:v=>v.target.select()}),a.jsx("button",{type:"button",onClick:()=>window.open(tt.absoluteUrl,"_blank","noopener,noreferrer"),children:"打开"}),a.jsx("button",{type:"button",onClick:()=>void nv(),children:Vn==="copied"?"已复制":Vn==="failed"?"复制失败":"复制"})]}):null,Et?a.jsx("div",{className:"af-flow-snippet-error",children:Et}):null]}),a.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[a.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>Oe(!1),children:"取消"}),a.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:Fe||!Array.isArray(kt.nodeIds)||kt.nodeIds.length===0,onClick:()=>void pI(),children:Fe?"生成中...":"生成链接"})]})]})}),document.body):null,tr?ar.createPortal(a.jsx("div",{className:"af-flow-snippet-modal-overlay",children:a.jsxs("div",{className:"af-flow-snippet-modal af-display-link-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:"link"}),"展示链接"]}),a.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>{gn(""),Fn(!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:[tt!=null&&tt.absoluteUrl?a.jsxs("div",{className:"af-display-link-modal__url",children:[a.jsx("input",{type:"text",readOnly:!0,value:tt.absoluteUrl,onFocus:v=>v.target.select(),autoFocus:!0}),a.jsxs("button",{type:"button",onClick:()=>window.open(tt.absoluteUrl,"_blank","noopener,noreferrer"),children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_new"}),"打开"]}),a.jsxs("button",{type:"button",onClick:()=>void nv(),children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:Vn==="copied"?"check":"content_copy"}),Vn==="copied"?"已复制":Vn==="failed"?"复制失败":"复制"]})]}):a.jsx("div",{className:"af-display-link-modal__empty",children:"还没有生成展示链接"}),a.jsxs("label",{className:"af-flow-snippet-field",children:[a.jsx("span",{children:"新链接有效期"}),a.jsx("select",{className:"af-display-share-select",value:GS(kt),onChange:v=>{const N=v.target.value;Nt(M=>({...M,permanent:N==="permanent",expiresInDays:N==="permanent"?M.expiresInDays||30:Number(N)}))},children:Vm.map(v=>a.jsx("option",{value:v.value,children:v.label},v.value))})]}),Et?a.jsx("div",{className:"af-flow-snippet-error",children:Et}):null]}),a.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[a.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>{gn(""),Fn(!1)},children:"关闭"}),a.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:Fe||S.nodeIds.length===0,onClick:()=>void hI(),children:Fe?"生成中...":tt!=null&&tt.absoluteUrl?"更新链接":"生成链接"})]})]})}),document.body):null,Yt?ar.createPortal(a.jsx("div",{className:"af-flow-snippet-modal-overlay",children:a.jsxs("div",{className:"af-flow-snippet-modal af-display-shares-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:"folder_shared"}),"我的分享"]}),a.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>kn(!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("div",{className:"af-display-shares-toolbar",children:[a.jsx("span",{children:yn.length?`${yn.length} 个分享`:"暂无分享"}),a.jsxs("button",{type:"button",onClick:()=>void ps(),disabled:Nn,children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"refresh"}),"刷新"]})]}),ns?a.jsx("div",{className:"af-flow-snippet-error",children:ns}):null,Nn?a.jsx("div",{className:"af-display-link-modal__empty",children:"Loading..."}):null,!Nn&&yn.length===0?a.jsx("div",{className:"af-display-link-modal__empty",children:"还没有创建过展示分享"}):null,a.jsx("div",{className:"af-display-shares-list",children:yn.map(v=>{const N=JS(v),M=fr===v.id,z=v.expiresAt?String(v.expiresInDays||30):"permanent";return a.jsxs("article",{className:"af-display-share-item",children:[a.jsxs("div",{className:"af-display-share-item__main",children:[a.jsx("strong",{children:v.title||"AgentFlow Display"}),a.jsxs("span",{children:[v.flowId||"-"," · ",v.layout||"gallery"," · ",Array.isArray(v.nodeIds)?v.nodeIds.length:0," nodes"]}),a.jsx("small",{children:NV(v)})]}),a.jsx("input",{className:"af-display-share-item__url",type:"text",readOnly:!0,value:N,onFocus:K=>K.target.select()}),a.jsx("select",{className:"af-display-share-select",value:z,disabled:M,onChange:K=>void gI(v,K.target.value),"aria-label":"修改分享有效期",children:Vm.map(K=>a.jsx("option",{value:K.value,children:K.label},K.value))}),a.jsxs("div",{className:"af-display-share-item__actions",children:[a.jsxs("button",{type:"button",onClick:()=>window.open(N,"_blank","noopener,noreferrer"),children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_new"}),"打开"]}),a.jsxs("button",{type:"button",onClick:()=>void mI(v),children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:Vr===v.id?"check":"content_copy"}),Vr===v.id?"已复制":"复制"]}),a.jsxs("button",{type:"button",className:"af-display-share-item__danger",disabled:M,onClick:()=>void yI(v),children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:M?"hourglass_empty":"link_off"}),"撤销"]})]})]},v.id)})})]})]})}),document.body):null,rs?ar.createPortal(a.jsx("div",{className:"af-flow-snippet-modal-overlay",children:a.jsxs("div",{className:"af-flow-snippet-modal af-display-picker-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:"add_to_photos"}),"选择展示节点"]}),a.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>an(!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-display-picker-search",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),a.jsx("input",{type:"search",value:Cr,onChange:v=>ee(v.target.value),placeholder:"搜索展示节点...",autoFocus:!0})]}),a.jsx("div",{className:"af-display-picker-grid",role:"group","aria-label":"选择展示节点",style:{"--af-display-picker-columns":Zb.length||1},children:cd.length>0?Zb.map((v,N)=>a.jsx("div",{className:"af-display-picker-column",children:v.map(lI)},`display-picker-column-${N}`)):a.jsx("div",{className:"af-display-picker-empty",children:pa.length===0?"当前 Workspace 没有 display 节点":"没有匹配的展示节点"})})]}),a.jsx("div",{className:"af-flow-snippet-modal__foot",children:a.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",onClick:()=>an(!1),children:"完成"})})]})}),document.body):null,B.nodeId?ar.createPortal(a.jsx(s7,{files:is,query:B.query,onQueryChange:v=>ae(N=>({...N,query:v})),onSelect:JA,onUpload:Db,onClose:Ah}),document.body):null,!Ze&&oe?ar.createPortal(a.jsx("div",{className:"af-workspace-quick-add-backdrop",onMouseDown:()=>Pe(!1),children:a.jsxs("div",{className:"af-workspace-quick-add",role:"dialog","aria-modal":"true","aria-label":"Add workspace node",onMouseDown:v=>v.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":Be==="nodes",className:"af-workspace-quick-add__tab"+(Be==="nodes"?" af-workspace-quick-add__tab--active":""),onClick:()=>jt("nodes"),children:"节点"}),a.jsx("button",{type:"button",role:"tab","aria-selected":Be==="flows",className:"af-workspace-quick-add__tab"+(Be==="flows"?" af-workspace-quick-add__tab--active":""),onClick:()=>jt("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:sb,value:jn,onChange:v=>nr(v.target.value),onKeyDown:v=>{if(v.key==="Escape")v.preventDefault(),Pe(!1);else if(v.key==="ArrowDown"){v.preventDefault();const N=Be==="flows"?Xl.length:Gl.length;Mn(M=>Math.min(Math.max(0,N-1),M+1))}else v.key==="ArrowUp"?(v.preventDefault(),Mn(N=>Math.max(0,N-1))):v.key==="Tab"?(v.preventDefault(),jt(N=>N==="nodes"?"flows":"nodes")):v.key==="Enter"&&(v.preventDefault(),Be==="flows"?sv(Xl[Cn]||Xl[0]):rv(Gl[Cn]||Gl[0]))},placeholder:Be==="flows"?"搜索流程片段...":"搜索节点...","aria-label":Be==="flows"?"搜索流程片段":"搜索节点"})]}),a.jsx("div",{className:"af-workspace-quick-add__list",children:Be==="flows"?Xl.length===0?a.jsx("div",{className:"af-workspace-quick-add__empty",children:ce?"正在加载流程片段...":De||"没有匹配的流程片段"}):Xl.map((v,N)=>{const M=v.displayName||v.name||v.id,z=v.snippet&&typeof v.snippet=="object"?v.snippet.instances:null,K=v.snippet&&typeof v.snippet=="object"?v.snippet.edges:null,G=Number.isFinite(Number(v.nodeCount))?Number(v.nodeCount):Object.keys(z||{}).length,J=Number.isFinite(Number(v.edgeCount))?Number(v.edgeCount):Array.isArray(K)?K.length:0;return a.jsxs("button",{type:"button",className:"af-workspace-quick-add__item"+(N===Cn?" af-workspace-quick-add__item--active":""),onMouseEnter:()=>Mn(N),onClick:()=>sv(v),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:M}),a.jsxs("span",{className:"af-workspace-quick-add__meta",children:[v.id,v.version?` · v${v.version}`:""]}),a.jsx("span",{className:"af-workspace-quick-add__desc",children:v.description||`${G} 节点 / ${J} 连线`})]}),a.jsx("span",{className:"af-workspace-quick-add__cat",children:"FLOW"})]},`${v.id}@${v.version}`)}):Gl.length===0?a.jsx("div",{className:"af-workspace-quick-add__empty",children:"没有匹配的节点"}):Gl.map((v,N)=>{const M=kc(v),z=Sc(v),K=Dy(v);return a.jsxs("button",{type:"button",className:"af-workspace-quick-add__item"+(N===Cn?" af-workspace-quick-add__item--active":""),onMouseEnter:()=>Mn(N),onClick:()=>rv(v),children:[a.jsx("span",{className:"af-workspace-quick-add__icon material-symbols-outlined","aria-hidden":!0,children:VS(M)}),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:v.id}),K?a.jsx("span",{className:"af-workspace-quick-add__desc",children:K}):null]}),a.jsx("span",{className:"af-workspace-quick-add__cat",children:M})]},v.id)})})]})}),document.body):null]})]})}function g7(){return a.jsx(uw,{children:a.jsx(m7,{})})}function y7(e){const t=[...(e==null?void 0:e.inputs)||[],...(e==null?void 0:e.outputs)||[]],n=(e==null?void 0:e.kind)==="image"?"src":"content",r=o=>String((o==null?void 0:o.value)??(o==null?void 0:o.default)??""),s=o=>r(o).trim(),i=t.find(o=>(o==null?void 0:o.name)===n&&s(o))||t.find(o=>(o==null?void 0:o.name)==="filePath"&&s(o))||t.find(o=>(o==null?void 0:o.type)==="text"&&s(o));return String((e==null?void 0:e.body)||(i?r(i):""))}function x7(e){return e==="mermaid"?"account_tree":e==="ascii"?"notes":e==="html"?"html":e==="image"?"image":e==="chart"?"bar_chart":e==="table"?"table":"article"}function w7(e){let t=String(e||"").replace(/\r\n/g,`
170
- `).trim();return t.includes(`
171
- `)||(t=t.replace(/\s+(resultFile|result|outParams|outParams\.[A-Za-z_][A-Za-z0-9_-]*)\s*:/g,`
172
- $1:`).replace(/(^|\n)outParams:\s+([A-Za-z_][A-Za-z0-9_-]*\s*:)/g,`$1outParams:
173
- $2`)),t}function KP(e){const t=String(e||"").trim();if(!t)return String(e||"");const n=t.match(/---agentflow\b([\s\S]*?)---end/i);if(n!=null&&n[1]){const o=w7(n[1]),l=o.match(/^resultFile\s*:\s*["']?([^"'\n]+)["']?/m);if(l!=null&&l[1])return l[1].trim();const c=o.match(/^result\s*:\s*(.*)$/m);if(c){const p=String(c[1]||"").trim();return p==="|"||p===">"?o.slice((c.index||0)+c[0].length).split(`
174
- `).filter(d=>/^\s+/.test(d)||!d.trim()).map(d=>d.replace(/^\s{2}/,"")).join(`
175
- `).replace(/\s+$/g,""):p.replace(/^["']|["']$/g,"")}const u=t.replace(n[0],"").trim();if(u)return u}if(!/["']result["']\s*:|["']outParams["']\s*:|["']resultFile["']\s*:/i.test(t))return String(e||"");const r=[t],s=t.indexOf("{"),i=t.lastIndexOf("}");s>=0&&i>s&&r.unshift(t.slice(s,i+1));for(const o of r)try{const l=JSON.parse(o);if(l&&typeof l=="object"&&!Array.isArray(l)&&(Object.prototype.hasOwnProperty.call(l,"result")||Object.prototype.hasOwnProperty.call(l,"resultFile"))){const c=l.resultFile||l.result;return typeof c=="string"?c:JSON.stringify(c,null,2)}}catch{}return String(e||"")}function Ow(e){let t=KP(e).trim();if(!t)return"";const n=t.match(/```(?:html|HTML)?\s*\n?([\s\S]*?)```/);if(n&&n[1])t=n[1].trim();else{const i=t.match(/```(?:html|HTML)?\s*\n?([\s\S]*)$/);i&&i[1]&&(t=i[1].trim())}t=t.replace(/^html\s*\n/i,"").replace(/```\s*$/g,"").trim();const s=[/<!doctype\b/i,/<html\b/i,/<head\b/i,/<body\b/i,/<style\b/i,/<script\b/i,/<main\b/i,/<section\b/i,/<article\b/i,/<div\b/i,/<svg\b/i,/<canvas\b/i].reduce((i,o)=>{const l=o.exec(t);return l?i<0?l.index:Math.min(i,l.index):i},-1);return s>0&&(t=t.slice(s).trim()),t}function b7(e){const t=Ow(e);return t.trim()?/<[^>]*$/g.test(t)?"HTML 内容末尾存在未闭合标签,可能是生成或保存时被截断。":/^(?:<!doctype\b|<html\b)/i.test(t)&&!/<\/html\s*>/i.test(t)?"完整 HTML 文档缺少 </html> 结束标签,可能是生成或保存时被截断。":"":""}function v7(e){const t=Ow(e);if(!t.trim())return"";const n=`<base target="_self"><script>
176
- (() => {
177
- document.addEventListener("click", (event) => {
178
- const link = event.target && event.target.closest ? event.target.closest("a[href]") : null;
179
- if (!link) return;
180
- const rawHref = String(link.getAttribute("href") || "").trim();
181
- if (!rawHref || rawHref.startsWith("#")) return;
182
- if (/^(?:javascript|mailto|tel):/i.test(rawHref)) return;
183
- event.preventDefault();
184
- window.location.href = link.href;
185
- }, true);
186
- })();
187
- <\/script>`;return/<script\b[^>]*>\s*\(\(\)\s*=>\s*\{\s*document\.addEventListener\("click"/i.test(t)?t:/<head\b[^>]*>/i.test(t)?t.replace(/<head\b([^>]*)>/i,`<head$1>${n}`):/<html\b[^>]*>/i.test(t)?t.replace(/<html\b([^>]*)>/i,`<html$1><head>${n}</head>`):`<!doctype html><html><head>${n}</head><body>${t}</body></html>`}function UP(e,t,n={}){const r=String(e||"").trim();if(!r)return"";if(/^(?:https?:|data:|blob:|file:)/i.test(r)||r.startsWith("/"))return r;const s=new URLSearchParams;return s.set("id",t),s.set("path",r),n.download&&s.set("download","1"),`/api/display/file/raw?${s.toString()}`}function k7(e,t,n={}){const r=String(e||"").trim();return r?UP(r,t,n):""}function S7({className:e="",children:t}){const n=m.useRef(null),r=m.useRef(null),[s,i]=m.useState({visible:!1,top:0,height:100}),o=m.useCallback(()=>{const p=n.current;if(!p)return;const f=Math.max(1,p.scrollHeight),d=Math.max(1,p.clientHeight),h=f>d+1,y=h?Math.max(12,d/f*100):100,w=Math.max(0,100-y),k=h?Math.min(w,p.scrollTop/Math.max(1,f-d)*w):0;i({visible:h,top:k,height:y})},[]);m.useEffect(()=>{const p=requestAnimationFrame(o),f=n.current;if(!f||typeof ResizeObserver>"u")return()=>cancelAnimationFrame(p);const d=new ResizeObserver(o);d.observe(f);for(const h of Array.from(f.children))d.observe(h);return()=>{cancelAnimationFrame(p),d.disconnect()}},[t,o]);const l=m.useCallback(p=>{const f=n.current;if(!f)return;const d=Math.max(0,f.scrollHeight-f.clientHeight);f.scrollTop=Math.min(1,Math.max(0,p))*d,o()},[o]),c=m.useCallback((p,f=0)=>{const d=r.current;if(!d)return 0;const h=d.getBoundingClientRect(),y=s.height/100*h.height,w=Math.max(1,h.height-y);return(p-h.top-f)/w},[s.height]),u=m.useCallback(p=>{if(!s.visible)return;p.preventDefault(),p.stopPropagation();const f=r.current;if(!f)return;const d=f.getBoundingClientRect(),h=s.top/100*d.height,y=s.height/100*d.height,k=p.clientY>=d.top+h&&p.clientY<=d.top+h+y?p.clientY-d.top-h:y/2;l(c(p.clientY,k));const g=x=>{x.preventDefault(),l(c(x.clientY,k))},b=()=>{window.removeEventListener("pointermove",g),window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",b)};window.addEventListener("pointermove",g),window.addEventListener("pointerup",b),window.addEventListener("pointercancel",b)},[c,l,s.height,s.top,s.visible]);return a.jsxs("div",{className:`af-public-display-node__body ${e} nowheel nopan nodrag`,children:[a.jsx("div",{ref:n,className:`af-public-display-node__scroller ${e} nowheel nopan nodrag`,onScroll:o,children:t}),a.jsx("div",{ref:r,className:"af-public-display-scrollbar"+(s.visible?" af-public-display-scrollbar--visible":""),onPointerDown:u,"aria-hidden":"true",children:a.jsx("span",{style:{height:`${s.height}%`,top:`${s.top}%`}})})]})}function By({node:e,shareId:t,style:n,bare:r=!1}){const s=y7(e),i=e.kind==="html"?Ow(s):KP(s),o=e.kind==="html"?b7(i):"",l=`af-public-display-node__body--${e.kind||"unknown"}`;return a.jsxs("section",{className:`af-public-display-node af-public-display-node--${e.kind||"unknown"}${r?" af-public-display-node--bare":""}`,style:n,children:[r?null:a.jsx("div",{className:"af-public-display-node__head",children:a.jsxs("div",{className:"af-public-display-node__title",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:x7(e.kind)}),a.jsx("strong",{children:e.label||e.id}),a.jsx("em",{children:e.definitionId||e.kind||"display"})]})}),a.jsx(S7,{className:l,children:o?a.jsx("div",{className:"af-public-display-empty",children:o}):i.trim()?a.jsxs(a.Fragment,{children:[e.kind==="html"?a.jsx("iframe",{title:e.label||e.id,sandbox:"allow-scripts allow-forms allow-modals",srcDoc:v7(i)}):null,e.kind==="image"?a.jsx("img",{src:UP(i,t),alt:e.label||e.id,loading:"lazy"}):null,e.kind==="markdown"?a.jsx("div",{className:"af-public-display-markdown",children:a.jsx(Ew,{content:i,resolveSrc:(c,u)=>k7(c,t,u)})}):null,e.kind==="chart"?a.jsx(Pw,{content:i}):null,e.kind==="table"?a.jsx(_w,{content:i}):null,e.kind==="mermaid"||e.kind==="ascii"?a.jsx("pre",{children:i}):null]}):a.jsx("div",{className:"af-public-display-empty",children:"No display content"})})]})}function N7({data:e}){return a.jsx(By,{node:e==null?void 0:e.node,shareId:e==null?void 0:e.shareId})}const j7={publicDisplay:N7};function C7(e){const t=String(e||"").split("/").filter(Boolean);return t[0]==="display"&&t[1]?decodeURIComponent(t[1]):new URLSearchParams(window.location.search).get("id")||""}function qP(){var l,c,u,p;const{path:e}=Js(),t=m.useMemo(()=>C7(e),[e]),[n,r]=m.useState({loading:!0,error:"",share:null,nodes:[]});m.useEffect(()=>{let f=!1;async function d(){if(!t){r({loading:!1,error:"Missing display share id",share:null,nodes:[]});return}r(h=>({...h,loading:!0,error:""}));try{const h=await fetch(`/api/display/share?id=${encodeURIComponent(t)}`),y=await h.json().catch(()=>({}));if(!h.ok)throw new Error(y.error||"展示页不存在");f||r({loading:!1,error:"",share:y.share||null,nodes:Array.isArray(y.nodes)?y.nodes:[]})}catch(h){f||r({loading:!1,error:String((h==null?void 0:h.message)||h),share:null,nodes:[]})}}return d(),()=>{f=!0}},[t]);const s=m.useMemo(()=>(Array.isArray(n.nodes)?n.nodes:[]).map((d,h)=>{const y=d.position&&typeof d.position.x=="number"&&typeof d.position.y=="number"?d.position:{x:120+h*40,y:100+h*32},w=d.size&&typeof d.size.width=="number"&&typeof d.size.height=="number"?d.size:{width:520,height:320};return{id:d.id,type:"publicDisplay",position:y,data:{node:d,shareId:t},selectable:!1,draggable:!1,style:{width:Math.max(1,Number(w.width)||520),height:Math.max(1,Number(w.height)||320)}}}),[t,n.nodes]),i=m.useMemo(()=>{var w;const f=(w=n.share)==null?void 0:w.viewport;if(!f||typeof f!="object")return null;const d=Number(f.x),h=Number(f.y),y=Number(f.zoom);return!Number.isFinite(d)||!Number.isFinite(h)||!Number.isFinite(y)?null:{x:d,y:h,zoom:Math.min(Math.max(y,.1),4)}},[(l=n.share)==null?void 0:l.viewport]);if(n.loading)return a.jsx("main",{className:"af-public-display-page",children:a.jsx("div",{className:"af-public-display-status",children:"Loading..."})});if(n.error)return a.jsx("main",{className:"af-public-display-page",children:a.jsxs("div",{className:"af-public-display-status af-public-display-status--error",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"error"}),a.jsx("span",{children:n.error})]})});const o=String(((c=n.share)==null?void 0:c.layout)||"").trim()||"gallery";if(o!=="canvas"){if(o==="single")return a.jsx("main",{className:"af-public-display-page af-public-display-page--single",children:a.jsx("div",{className:"af-public-display-grid",children:(n.nodes||[]).map(d=>a.jsx(By,{node:d,shareId:t,bare:!0},d.id))})});const f=o==="slides"?"af-public-display-page--slides":o==="document"?"af-public-display-page--document":"af-public-display-page--gallery";return a.jsxs("main",{className:`af-public-display-page ${f}`,children:[a.jsxs("header",{className:"af-public-display-hero",children:[a.jsxs("div",{children:[a.jsx("p",{children:"AgentFlow Display"}),a.jsx("h1",{children:((u=n.share)==null?void 0:u.title)||"AgentFlow Display"})]}),a.jsx("span",{children:(p=n.share)!=null&&p.expiresAt?`有效期至 ${new Date(n.share.expiresAt).toLocaleString()}`:"永久有效"})]}),a.jsx("div",{className:"af-public-display-grid",children:(n.nodes||[]).map(d=>a.jsx(By,{node:d,shareId:t},d.id))})]})}return a.jsx("main",{className:"af-public-display-page af-public-display-page--canvas",children:a.jsx(uw,{children:a.jsx(x_,{className:"af-public-display-flow",nodes:s,edges:[],nodeTypes:j7,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,panOnDrag:!0,noPanClassName:"nopan",noDragClassName:"nodrag",noWheelClassName:"nowheel",panOnScroll:!0,zoomOnScroll:!0,zoomOnPinch:!0,defaultViewport:i||void 0,fitView:!i,fitViewOptions:{padding:.18,duration:180},minZoom:.1,maxZoom:4,proOptions:{hideAttribution:!0},children:a.jsx(b_,{color:"rgba(255,255,255,0.12)",gap:22,size:1})})})})}const ot=e=>typeof e=="string",fc=()=>{let e,t;const n=new Promise((r,s)=>{e=r,t=s});return n.resolve=e,n.reject=t,n},sN=e=>e==null?"":""+e,E7=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},_7=/###/g,iN=e=>e&&e.indexOf("###")>-1?e.replace(_7,"."):e,oN=e=>!e||ot(e),Wc=(e,t,n)=>{const r=ot(t)?t.split("."):t;let s=0;for(;s<r.length-1;){if(oN(e))return{};const i=iN(r[s]);!e[i]&&n&&(e[i]=new n),Object.prototype.hasOwnProperty.call(e,i)?e=e[i]:e={},++s}return oN(e)?{}:{obj:e,k:iN(r[s])}},aN=(e,t,n)=>{const{obj:r,k:s}=Wc(e,t,Object);if(r!==void 0||t.length===1){r[s]=n;return}let i=t[t.length-1],o=t.slice(0,t.length-1),l=Wc(e,o,Object);for(;l.obj===void 0&&o.length;)i=`${o[o.length-1]}.${i}`,o=o.slice(0,o.length-1),l=Wc(e,o,Object),l&&l.obj&&typeof l.obj[`${l.k}.${i}`]<"u"&&(l.obj=void 0);l.obj[`${l.k}.${i}`]=n},P7=(e,t,n,r)=>{const{obj:s,k:i}=Wc(e,t,Object);s[i]=s[i]||[],s[i].push(n)},Np=(e,t)=>{const{obj:n,k:r}=Wc(e,t);if(n)return n[r]},A7=(e,t,n)=>{const r=Np(e,n);return r!==void 0?r:Np(t,n)},YP=(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]):YP(e[r],t[r],n):e[r]=t[r]);return e},Na=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var I7={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const T7=e=>ot(e)?e.replace(/[&<>"'\/]/g,t=>I7[t]):e;class R7{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 M7=[" ",",","?","!",";"],L7=new R7(20),$7=(e,t,n)=>{t=t||"",n=n||"";const r=M7.filter(o=>t.indexOf(o)<0&&n.indexOf(o)<0);if(r.length===0)return!0;const s=L7.getRegExp(`(${r.map(o=>o==="?"?"\\?":o).join("|")})`);let i=!s.test(e);if(!i){const o=e.indexOf(n);o>0&&!s.test(e.substring(0,o))&&(i=!0)}return i},Wy=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return e[t];const r=t.split(n);let s=e;for(let i=0;i<r.length;){if(!s||typeof s!="object")return;let o,l="";for(let c=i;c<r.length;++c)if(c!==i&&(l+=n),l+=r[c],o=s[l],o!==void 0){if(["string","number","boolean"].indexOf(typeof o)>-1&&c<r.length-1)continue;i+=c-i+1;break}s=o}return s},jp=e=>e&&e.replace("_","-"),O7={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 Cp{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||O7,this.options=n,this.debug=n.debug}log(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"log","",!0)}warn(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"warn","",!0)}error(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"error","")}deprecate(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"warn","WARNING DEPRECATED: ",!0)}forward(t,n,r,s){return s&&!this.debug?null:(ot(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new Cp(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new Cp(this.logger,t)}}var Ws=new Cp;class hh{constructor(){this.observers={}}on(t,n){return t.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const s=this.observers[r].get(n)||0;this.observers[r].set(n,s+1)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t].delete(n)}}emit(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];this.observers[t]&&Array.from(this.observers[t].entries()).forEach(o=>{let[l,c]=o;for(let u=0;u<c;u++)l(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(o=>{let[l,c]=o;for(let u=0;u<c;u++)l.apply(l,[t,...r])})}}class lN extends hh{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const i=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,o=s.ignoreJSONStructure!==void 0?s.ignoreJSONStructure:this.options.ignoreJSONStructure;let l;t.indexOf(".")>-1?l=t.split("."):(l=[t,n],r&&(Array.isArray(r)?l.push(...r):ot(r)&&i?l.push(...r.split(i)):l.push(r)));const c=Np(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:Wy(this.data&&this.data[t]&&this.data[t][n],r,i)}addResource(t,n,r,s){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator;let l=[t,n];r&&(l=l.concat(o?r.split(o):r)),t.indexOf(".")>-1&&(l=t.split("."),s=n,n=l[1]),this.addNamespaces(n),aN(this.data,l,s),i.silent||this.emit("added",t,n,r,s)}addResources(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const i in r)(ot(r[i])||Array.isArray(r[i]))&&this.addResource(t,n,i,r[i],{silent:!0});s.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,s,i){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},l=[t,n];t.indexOf(".")>-1&&(l=t.split("."),s=r,r=n,n=l[1]),this.addNamespaces(n);let c=Np(this.data,l)||{};o.skipCopy||(r=JSON.parse(JSON.stringify(r))),s?YP(c,r,i):c={...c,...r},aN(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(s=>n[s]&&Object.keys(n[s]).length>0)}toJSON(){return this.data}}var GP={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,s){return e.forEach(i=>{this.processors[i]&&(t=this.processors[i].process(t,n,r,s))}),t}};const cN={};class Ep extends hh{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),E7(["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 s=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let i=n.ns||this.options.defaultNS||[];const o=r&&t.indexOf(r)>-1,l=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!$7(t,r,s);if(o&&!l){const c=t.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:t,namespaces:ot(i)?[i]:i};const u=t.split(r);(r!==s||r===s&&this.options.ns.indexOf(u[0])>-1)&&(i=u.shift()),t=u.join(s)}return{key:t,namespaces:ot(i)?[i]:i}}translate(t,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const s=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:o,namespaces:l}=this.extractFromKey(t[t.length-1],n),c=l[l.length-1],u=n.lng||this.language,p=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(p){const S=n.nsSeparator||this.options.nsSeparator;return s?{res:`${c}${S}${o}`,usedKey:o,exactUsedKey:o,usedLng:u,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:`${c}${S}${o}`}return s?{res:o,usedKey:o,exactUsedKey:o,usedLng:u,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:o}const f=this.resolve(t,n);let d=f&&f.res;const h=f&&f.usedKey||o,y=f&&f.exactUsedKey||o,w=Object.prototype.toString.apply(d),k=["[object Number]","[object Function]","[object RegExp]"],g=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject,x=!ot(d)&&typeof d!="boolean"&&typeof d!="number";if(b&&d&&x&&k.indexOf(w)<0&&!(ot(g)&&Array.isArray(d))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const S=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,d,{...n,ns:l}):`key '${o} (${this.language})' returned an object instead of string.`;return s?(f.res=S,f.usedParams=this.getUsedParamsDetails(n),f):S}if(i){const S=Array.isArray(d),C=S?[]:{},j=S?y:h;for(const E in d)if(Object.prototype.hasOwnProperty.call(d,E)){const A=`${j}${i}${E}`;C[E]=this.translate(A,{...n,joinArrays:!1,ns:l}),C[E]===A&&(C[E]=d[E])}d=C}}else if(b&&ot(g)&&Array.isArray(d))d=d.join(g),d&&(d=this.extendTranslation(d,t,n,r));else{let S=!1,C=!1;const j=n.count!==void 0&&!ot(n.count),E=Ep.hasDefaultValue(n),A=j?this.pluralResolver.getSuffix(u,n.count,n):"",D=n.ordinal&&j?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",W=j&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),F=W&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${A}`]||n[`defaultValue${D}`]||n.defaultValue;!this.isValidLookup(d)&&E&&(S=!0,d=F),this.isValidLookup(d)||(C=!0,d=o);const $=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&C?void 0:d,P=E&&F!==d&&this.options.updateMissing;if(C||S||P){if(this.logger.log(P?"updateKey":"missingKey",u,c,o,P?F:d),i){const I=this.resolve(o,{...n,keySeparator:!1});I&&I.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 L=[];const T=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&T&&T[0])for(let I=0;I<T.length;I++)L.push(T[I]);else this.options.saveMissingTo==="all"?L=this.languageUtils.toResolveHierarchy(n.lng||this.language):L.push(n.lng||this.language);const O=(I,H,_)=>{const Y=E&&_!==d?_:$;this.options.missingKeyHandler?this.options.missingKeyHandler(I,c,H,Y,P,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(I,c,H,Y,P,n),this.emit("missingKey",I,c,H,d)};this.options.saveMissing&&(this.options.saveMissingPlurals&&j?L.forEach(I=>{const H=this.pluralResolver.getSuffixes(I,n);W&&n[`defaultValue${this.options.pluralSeparator}zero`]&&H.indexOf(`${this.options.pluralSeparator}zero`)<0&&H.push(`${this.options.pluralSeparator}zero`),H.forEach(_=>{O([I],o+_,n[`defaultValue${_}`]||F)})}):O(L,o,F))}d=this.extendTranslation(d,t,n,f,r),C&&d===o&&this.options.appendNamespaceToMissingKey&&(d=`${c}:${o}`),(C||S)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?d=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}:${o}`:o,S?d:void 0):d=this.options.parseMissingKeyHandler(d))}return s?(f.res=d,f.usedParams=this.getUsedParamsDetails(n),f):d}extendTranslation(t,n,r,s,i){var o=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||s.usedLng,s.usedNS,s.usedKey,{resolved:s});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const u=ot(t)&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let p;if(u){const d=t.match(this.interpolator.nestingRegexp);p=d&&d.length}let f=r.replace&&!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||s.usedLng,r),u){const d=t.match(this.interpolator.nestingRegexp),h=d&&d.length;p<h&&(r.nest=!1)}!r.lng&&this.options.compatibilityAPI!=="v1"&&s&&s.res&&(r.lng=this.language||s.usedLng),r.nest!==!1&&(t=this.interpolator.nest(t,function(){for(var d=arguments.length,h=new Array(d),y=0;y<d;y++)h[y]=arguments[y];return i&&i[0]===h[0]&&!r.context?(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=GP.handle(c,t,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...s,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r,s,i,o,l;return ot(t)&&(t=[t]),t.forEach(c=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(c,n),p=u.key;s=p;let f=u.namespaces;this.options.fallbackNS&&(f=f.concat(this.options.fallbackNS));const d=n.count!==void 0&&!ot(n.count),h=d&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),y=n.context!==void 0&&(ot(n.context)||typeof n.context=="number")&&n.context!=="",w=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);f.forEach(k=>{this.isValidLookup(r)||(l=k,!cN[`${w[0]}-${k}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(l)&&(cN[`${w[0]}-${k}`]=!0,this.logger.warn(`key "${s}" for languages "${w.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!!!")),w.forEach(g=>{if(this.isValidLookup(r))return;o=g;const b=[p];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(b,p,g,k,n);else{let S;d&&(S=this.pluralResolver.getSuffix(g,n.count,n));const C=`${this.options.pluralSeparator}zero`,j=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(d&&(b.push(p+S),n.ordinal&&S.indexOf(j)===0&&b.push(p+S.replace(j,this.options.pluralSeparator)),h&&b.push(p+C)),y){const E=`${p}${this.options.contextSeparator}${n.context}`;b.push(E),d&&(b.push(E+S),n.ordinal&&S.indexOf(j)===0&&b.push(E+S.replace(j,this.options.pluralSeparator)),h&&b.push(E+C))}}let x;for(;x=b.pop();)this.isValidLookup(r)||(i=x,r=this.getResource(g,k,x,n))}))})}),{res:r,usedKey:s,exactUsedKey:i,usedLng:o,usedNS:l}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,r,s):this.resourceStore.getResource(t,n,r,s)}getUsedParamsDetails(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&!ot(t.replace);let s=r?t.replace:t;if(r&&typeof t.count<"u"&&(s.count=t.count),this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),!r){s={...s};for(const i of n)delete s[i]}return s}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,n.length)&&t[r]!==void 0)return!0;return!1}}const qm=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=jp(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=jp(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 s=Intl.getCanonicalLocales(t)[0];if(s&&this.options.lowerCaseLng&&(s=s.toLowerCase()),s)return s}catch{}const n=["hans","hant","latn","cyrl","cans","mong","arab"];let r=t.split("-");return this.options.lowerCaseLng?r=r.map(s=>s.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=qm(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]=qm(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=qm(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const s=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(s))&&(n=s)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const s=this.getLanguagePartFromCode(r);if(this.isSupportedCode(s))return n=s;n=this.options.supportedLngs.find(i=>{if(i===s)return i;if(!(i.indexOf("-")<0&&s.indexOf("-")<0)&&(i.indexOf("-")>0&&s.indexOf("-")<0&&i.substring(0,i.indexOf("-"))===s||i.indexOf(s)===0&&s.length>1))return i})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),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),s=[],i=o=>{o&&(this.isSupportedCode(o)?s.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"&&i(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&i(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&i(this.getLanguagePartFromCode(t))):ot(t)&&i(this.formatLanguageCode(t)),r.forEach(o=>{s.indexOf(o)<0&&i(this.formatLanguageCode(o))}),s}}let D7=[{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}],F7={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 z7=["v1","v2","v3"],H7=["v4"],dN={zero:0,one:1,two:2,few:3,many:4,other:5},B7=()=>{const e={};return D7.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:F7[t.fc]}})}),e};class W7{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||H7.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=B7(),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=jp(t==="dev"?"en":t),s=n.ordinal?"ordinal":"cardinal",i=JSON.stringify({cleanedCode:r,type:s});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let o;try{o=new Intl.PluralRules(r,{type:s})}catch{if(!t.match(/-|_/))return;const c=this.languageUtils.getLanguagePartFromCode(t);o=this.getRule(c,n)}return this.pluralRulesCache[i]=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(s=>`${n}${s}`)}getSuffixes(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((s,i)=>dN[s]-dN[i]).map(s=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${s}`):r.numbers.map(s=>this.getSuffix(t,s,n)):[]}getSuffix(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const s=this.getRule(t,r);return s?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${s.select(n)}`:this.getSuffixRetroCompatible(s,n):(this.logger.warn(`no plural rule found for: ${t}`),"")}getSuffixRetroCompatible(t,n){const r=t.noAbs?t.plurals(n):t.plurals(Math.abs(n));let s=t.numbers[r];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(s===2?s="plural":s===1&&(s=""));const i=()=>this.options.prepend&&s.toString()?this.options.prepend+s.toString():s.toString();return this.options.compatibilityJSON==="v1"?s===1?"":typeof s=="number"?`_plural_${s.toString()}`:i():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?i():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!z7.includes(this.options.compatibilityJSON)}}const fN=function(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=A7(e,t,n);return!i&&s&&ot(n)&&(i=Wy(e,n,r),i===void 0&&(i=Wy(t,n,r))),i},Ym=e=>e.replace(/\$/g,"$$$$");class V7{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:s,prefix:i,prefixEscaped:o,suffix:l,suffixEscaped:c,formatSeparator:u,unescapeSuffix:p,unescapePrefix:f,nestingPrefix:d,nestingPrefixEscaped:h,nestingSuffix:y,nestingSuffixEscaped:w,nestingOptionsSeparator:k,maxReplaces:g,alwaysFormat:b}=t.interpolation;this.escape=n!==void 0?n:T7,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=i?Na(i):o||"{{",this.suffix=l?Na(l):c||"}}",this.formatSeparator=u||",",this.unescapePrefix=p?"":f||"-",this.unescapeSuffix=this.unescapePrefix?"":p||"",this.nestingPrefix=d?Na(d):h||Na("$t("),this.nestingSuffix=y?Na(y):w||Na(")"),this.nestingOptionsSeparator=k||",",this.maxReplaces=g||1e3,this.alwaysFormat=b!==void 0?b:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,r)=>n&&n.source===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(t,n,r,s){let i,o,l;const c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=h=>{if(h.indexOf(this.formatSeparator)<0){const g=fN(n,c,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(g,void 0,r,{...s,...n,interpolationkey:h}):g}const y=h.split(this.formatSeparator),w=y.shift().trim(),k=y.join(this.formatSeparator).trim();return this.format(fN(n,c,w,this.options.keySeparator,this.options.ignoreJSONStructure),k,r,{...s,...n,interpolationkey:w})};this.resetRegExp();const p=s&&s.missingInterpolationHandler||this.options.missingInterpolationHandler,f=s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>Ym(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?Ym(this.escape(h)):Ym(h)}].forEach(h=>{for(l=0;i=h.regex.exec(t);){const y=i[1].trim();if(o=u(y),o===void 0)if(typeof p=="function"){const k=p(t,i,s);o=ot(k)?k:""}else if(s&&Object.prototype.hasOwnProperty.call(s,y))o="";else if(f){o=i[0];continue}else this.logger.warn(`missed to pass in variable ${y} for interpolating ${t}`),o="";else!ot(o)&&!this.useRawValueToEscape&&(o=sN(o));const w=h.safeValue(o);if(t=t.replace(i[0],w),f?(h.regex.lastIndex+=o.length,h.regex.lastIndex-=i[0].length):h.regex.lastIndex=0,l++,l>=this.maxReplaces)break}}),t}nest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s,i,o;const l=(c,u)=>{const p=this.nestingOptionsSeparator;if(c.indexOf(p)<0)return c;const f=c.split(new RegExp(`${p}[ ]*{`));let d=`{${f[1]}`;c=f[0],d=this.interpolate(d,o);const h=d.match(/'/g),y=d.match(/"/g);(h&&h.length%2===0&&!y||y.length%2!==0)&&(d=d.replace(/'/g,'"'));try{o=JSON.parse(d),u&&(o={...u,...o})}catch(w){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,w),`${c}${p}${d}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,c};for(;s=this.nestingRegexp.exec(t);){let c=[];o={...r},o=o.replace&&!ot(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let u=!1;if(s[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(s[1])){const p=s[1].split(this.formatSeparator).map(f=>f.trim());s[1]=p.shift(),c=p,u=!0}if(i=n(l.call(this,s[1].trim(),o),o),i&&s[0]===t&&!ot(i))return i;ot(i)||(i=sN(i)),i||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${t}`),i=""),u&&(i=c.reduce((p,f)=>this.format(p,f,r.lng,{...r,interpolationkey:s[1].trim()}),i.trim())),t=t.replace(s[0],i),this.regexp.lastIndex=0}return t}}const K7=e=>{let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const s=r[1].substring(0,r[1].length-1);t==="currency"&&s.indexOf(":")<0?n.currency||(n.currency=s.trim()):t==="relativetime"&&s.indexOf(":")<0?n.range||(n.range=s.trim()):s.split(";").forEach(o=>{if(o){const[l,...c]=o.split(":"),u=c.join(":").trim().replace(/^'+|'+$/g,""),p=l.trim();n[p]||(n[p]=u),u==="false"&&(n[p]=!1),u==="true"&&(n[p]=!0),isNaN(u)||(n[p]=parseInt(u,10))}})}return{formatName:t,formatOptions:n}},ja=e=>{const t={};return(n,r,s)=>{let i=s;s&&s.interpolationkey&&s.formatParams&&s.formatParams[s.interpolationkey]&&s[s.interpolationkey]&&(i={...i,[s.interpolationkey]:void 0});const o=r+JSON.stringify(i);let l=t[o];return l||(l=e(jp(r),s),t[o]=l),l(n)}};class U7{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Ws.create("formatter"),this.options=t,this.formats={number:ja((n,r)=>{const s=new Intl.NumberFormat(n,{...r});return i=>s.format(i)}),currency:ja((n,r)=>{const s=new Intl.NumberFormat(n,{...r,style:"currency"});return i=>s.format(i)}),datetime:ja((n,r)=>{const s=new Intl.DateTimeFormat(n,{...r});return i=>s.format(i)}),relativetime:ja((n,r)=>{const s=new Intl.RelativeTimeFormat(n,{...r});return i=>s.format(i,r.range||"day")}),list:ja((n,r)=>{const s=new Intl.ListFormat(n,{...r});return i=>s.format(i)})},this.init(t)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};this.formatSeparator=n.interpolation.formatSeparator||","}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=ja(n)}format(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const i=n.split(this.formatSeparator);if(i.length>1&&i[0].indexOf("(")>1&&i[0].indexOf(")")<0&&i.find(l=>l.indexOf(")")>-1)){const l=i.findIndex(c=>c.indexOf(")")>-1);i[0]=[i[0],...i.splice(1,l)].join(this.formatSeparator)}return i.reduce((l,c)=>{const{formatName:u,formatOptions:p}=K7(c);if(this.formats[u]){let f=l;try{const d=s&&s.formatParams&&s.formatParams[s.interpolationkey]||{},h=d.locale||d.lng||s.locale||s.lng||r;f=this.formats[u](l,h,{...p,...s,...d})}catch(d){this.logger.warn(d)}return f}else this.logger.warn(`there was no format function for ${u}`);return l},t)}}const q7=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class Y7 extends hh{constructor(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=t,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=s,this.logger=Ws.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=s.maxParallelReads||10,this.readingCalls=0,this.maxRetries=s.maxRetries>=0?s.maxRetries:5,this.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,s.backend,s)}queueLoad(t,n,r,s){const i={},o={},l={},c={};return t.forEach(u=>{let p=!0;n.forEach(f=>{const d=`${u}|${f}`;!r.reload&&this.store.hasResourceBundle(u,f)?this.state[d]=2:this.state[d]<0||(this.state[d]===1?o[d]===void 0&&(o[d]=!0):(this.state[d]=1,p=!1,o[d]===void 0&&(o[d]=!0),i[d]===void 0&&(i[d]=!0),c[f]===void 0&&(c[f]=!0)))}),p||(l[u]=!0)}),(Object.keys(i).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:s}),{toLoad:Object.keys(i),pending:Object.keys(o),toLoadLanguages:Object.keys(l),toLoadNamespaces:Object.keys(c)}}loaded(t,n,r){const s=t.split("|"),i=s[0],o=s[1];n&&this.emit("failedLoading",i,o,n),!n&&r&&this.store.addResourceBundle(i,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=>{P7(c.loaded,[i],o),q7(c,t),n&&c.errors.push(n),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(u=>{l[u]||(l[u]={});const p=c.loaded[u];p.length&&p.forEach(f=>{l[u][f]===void 0&&(l[u][f]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",l),this.queue=this.queue.filter(c=>!c.done)}read(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,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:s,wait:i,callback:o});return}this.readingCalls++;const l=(u,p)=>{if(this.readingCalls--,this.waitingReads.length>0){const f=this.waitingReads.shift();this.read(f.lng,f.ns,f.fcName,f.tried,f.wait,f.callback)}if(u&&p&&s<this.maxRetries){setTimeout(()=>{this.read.call(this,t,n,r,s+1,i*2,o)},i);return}o(u,p)},c=this.backend[r].bind(this.backend);if(c.length===2){try{const u=c(t,n);u&&typeof u.then=="function"?u.then(p=>l(null,p)).catch(l):l(null,u)}catch(u){l(u)}return}return c(t,n,l)}prepareLoading(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),s&&s();ot(t)&&(t=this.languageUtils.toResolveHierarchy(t)),ot(n)&&(n=[n]);const i=this.queueLoad(t,n,r,s);if(!i.toLoad.length)return i.pending.length||s(),null;i.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("|"),s=r[0],i=r[1];this.read(s,i,"read",void 0,void 0,(o,l)=>{o&&this.logger.warn(`${n}loading namespace ${i} for language ${s} failed`,o),!o&&l&&this.logger.log(`${n}loaded namespace ${i} for language ${s}`,l),this.loaded(t,o,l)})}saveMissing(t,n,r,s,i){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:i},u=this.backend.create.bind(this.backend);if(u.length<6)try{let p;u.length===5?p=u(t,n,r,s,c):p=u(t,n,r,s),p&&typeof p.then=="function"?p.then(f=>l(null,f)).catch(l):l(null,p)}catch(p){l(p)}else u(t,n,r,s,l,c)}!t||!t[0]||this.store.addResource(t[0],n,r,s)}}}const pN=()=>({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}}),hN=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),nf=()=>{},G7=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class Su extends hh{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=hN(t),this.services={},this.logger=Ws,this.modules={external:[]},G7(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 s=pN();this.options={...s,...this.options,...hN(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...s.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);const i=p=>p?typeof p=="function"?new p:p:null;if(!this.options.isClone){this.modules.logger?Ws.init(i(this.modules.logger),this.options):Ws.init(null,this.options);let p;this.modules.formatter?p=this.modules.formatter:typeof Intl<"u"&&(p=U7);const f=new uN(this.options);this.store=new lN(this.options.resources,this.options);const d=this.services;d.logger=Ws,d.resourceStore=this.store,d.languageUtils=f,d.pluralResolver=new W7(f,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),p&&(!this.options.interpolation.format||this.options.interpolation.format===s.interpolation.format)&&(d.formatter=i(p),d.formatter.init(d,this.options),this.options.interpolation.format=d.formatter.format.bind(d.formatter)),d.interpolator=new V7(this.options),d.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},d.backendConnector=new Y7(i(this.modules.backend),d.resourceStore,d,this.options),d.backendConnector.on("*",function(h){for(var y=arguments.length,w=new Array(y>1?y-1:0),k=1;k<y;k++)w[k-1]=arguments[k];t.emit(h,...w)}),this.modules.languageDetector&&(d.languageDetector=i(this.modules.languageDetector),d.languageDetector.init&&d.languageDetector.init(d,this.options.detection,this.options)),this.modules.i18nFormat&&(d.i18nFormat=i(this.modules.i18nFormat),d.i18nFormat.init&&d.i18nFormat.init(this)),this.translator=new Ep(this.services,this.options),this.translator.on("*",function(h){for(var y=arguments.length,w=new Array(y>1?y-1:0),k=1;k<y;k++)w[k-1]=arguments[k];t.emit(h,...w)}),this.modules.external.forEach(h=>{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,r||(r=nf),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const p=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);p.length>0&&p[0]!=="dev"&&(this.options.lng=p[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(p=>{this[p]=function(){return t.store[p](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(p=>{this[p]=function(){return t.store[p](...arguments),t}});const c=fc(),u=()=>{const p=(f,d)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),c.resolve(d),r(f,d)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return p(null,this.t.bind(this));this.changeLanguage(this.options.lng,p)};return this.options.resources||!this.options.initImmediate?u():setTimeout(u,0),c}loadResources(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:nf;const s=ot(t)?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(s&&s.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const i=[],o=l=>{if(!l||l==="cimode")return;this.services.languageUtils.toResolveHierarchy(l).forEach(u=>{u!=="cimode"&&i.indexOf(u)<0&&i.push(u)})};s?o(s):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(i,this.options.ns,l=>{!l&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(l)})}else r(null)}reloadResources(t,n,r){const s=fc();return typeof t=="function"&&(r=t,t=void 0),typeof n=="function"&&(r=n,n=void 0),t||(t=this.languages),n||(n=this.options.ns),r||(r=nf),this.services.backendConnector.reload(t,n,i=>{s.resolve(),r(i)}),s}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&GP.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1))for(let n=0;n<this.languages.length;n++){const r=this.languages[n];if(!(["cimode","dev"].indexOf(r)>-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(t,n){var r=this;this.isLanguageChangingTo=t;const s=fc();this.emit("languageChanging",t);const i=c=>{this.language=c,this.languages=this.services.languageUtils.toResolveHierarchy(c),this.resolvedLanguage=void 0,this.setResolvedLanguage(c)},o=(c,u)=>{u?(i(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,s.resolve(function(){return r.t(...arguments)}),n&&n(c,function(){return r.t(...arguments)})},l=c=>{!t&&!c&&this.services.languageDetector&&(c=[]);const u=ot(c)?c:this.services.languageUtils.getBestMatchFromCodes(c);u&&(this.language||i(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,p=>{o(p,u)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?l(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(l):this.services.languageDetector.detect(l):l(t),s}getFixedT(t,n,r){var s=this;const i=function(o,l){let c;if(typeof l!="object"){for(var u=arguments.length,p=new Array(u>2?u-2:0),f=2;f<u;f++)p[f-2]=arguments[f];c=s.options.overloadTranslationOptionHandler([o,l].concat(p))}else c={...l};c.lng=c.lng||i.lng,c.lngs=c.lngs||i.lngs,c.ns=c.ns||i.ns,c.keyPrefix!==""&&(c.keyPrefix=c.keyPrefix||r||i.keyPrefix);const d=s.options.keySeparator||".";let h;return c.keyPrefix&&Array.isArray(o)?h=o.map(y=>`${c.keyPrefix}${d}${y}`):h=c.keyPrefix?`${c.keyPrefix}${d}${o}`:o,s.t(h,c)};return ot(t)?i.lng=t:i.lngs=t,i.ns=n,i.keyPrefix=r,i}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],s=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const o=(l,c)=>{const u=this.services.backendConnector.state[`${l}|${c}`];return u===-1||u===0||u===2};if(n.precheck){const l=n.precheck(this,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)&&(!s||o(i,t)))}loadNamespaces(t,n){const r=fc();return this.options.ns?(ot(t)&&(t=[t]),t.forEach(s=>{this.options.ns.indexOf(s)<0&&this.options.ns.push(s)}),this.loadResources(s=>{r.resolve(),n&&n(s)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=fc();ot(t)&&(t=[t]);const s=this.options.preload||[],i=t.filter(o=>s.indexOf(o)<0&&this.services.languageUtils.isSupportedCode(o));return i.length?(this.options.preload=s.concat(i),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(pN());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 Su(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:nf;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const s={...this.options,...t,isClone:!0},i=new Su(s);return(t.debug!==void 0||t.prefix!==void 0)&&(i.logger=i.logger.clone(t)),["store","services","language"].forEach(l=>{i[l]=this[l]}),i.services={...this.services},i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},r&&(i.store=new lN(this.store.data,s),i.services.resourceStore=i.store),i.translator=new Ep(i.services,s),i.translator.on("*",function(l){for(var c=arguments.length,u=new Array(c>1?c-1:0),p=1;p<c;p++)u[p-1]=arguments[p];i.emit(l,...u)}),i.init(s,n),i.translator.options=s,i.translator.backendConnector.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},i}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Wn=Su.createInstance();Wn.createInstance=Su.createInstance;Wn.createInstance;Wn.dir;Wn.init;Wn.loadResources;Wn.reloadResources;Wn.use;Wn.changeLanguage;Wn.getFixedT;Wn.t;Wn.exists;Wn.setDefaultNamespace;Wn.hasLoadedNamespace;Wn.loadNamespaces;Wn.loadLanguages;function X7(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Nu(e){"@babel/helpers - typeof";return Nu=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},Nu(e)}function J7(e,t){if(Nu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Nu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Q7(e){var t=J7(e,"string");return Nu(t)=="symbol"?t:t+""}function Z7(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,Q7(r.key),r)}}function eK(e,t,n){return t&&Z7(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var XP=[],tK=XP.forEach,nK=XP.slice;function rK(e){return tK.call(nK.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}var mN=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,sK=function(t,n,r){var s=r||{};s.path=s.path||"/";var i=encodeURIComponent(n),o="".concat(t,"=").concat(i);if(s.maxAge>0){var l=s.maxAge-0;if(Number.isNaN(l))throw new Error("maxAge should be a Number");o+="; Max-Age=".concat(Math.floor(l))}if(s.domain){if(!mN.test(s.domain))throw new TypeError("option domain is invalid");o+="; Domain=".concat(s.domain)}if(s.path){if(!mN.test(s.path))throw new TypeError("option path is invalid");o+="; Path=".concat(s.path)}if(s.expires){if(typeof s.expires.toUTCString!="function")throw new TypeError("option expires is invalid");o+="; Expires=".concat(s.expires.toUTCString())}if(s.httpOnly&&(o+="; HttpOnly"),s.secure&&(o+="; Secure"),s.sameSite){var c=typeof s.sameSite=="string"?s.sameSite.toLowerCase():s.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,s){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(i.expires=new Date,i.expires.setTime(i.expires.getTime()+r*60*1e3)),s&&(i.domain=s),document.cookie=sK(t,encodeURIComponent(n),i)},read:function(t){for(var n="".concat(t,"="),r=document.cookie.split(";"),s=0;s<r.length;s++){for(var i=r[s];i.charAt(0)===" ";)i=i.substring(1,i.length);if(i.indexOf(n)===0)return i.substring(n.length,i.length)}return null},remove:function(t){this.create(t,"",-1)}},iK={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)}},oK={name:"querystring",lookup:function(t){var n;if(typeof window<"u"){var r=window.location.search;!window.location.search&&window.location.hash&&window.location.hash.indexOf("?")>-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));for(var s=r.substring(1),i=s.split("&"),o=0;o<i.length;o++){var l=i[o].indexOf("=");if(l>0){var c=i[o].substring(0,l);c===t.lookupQuerystring&&(n=i[o].substring(l+1))}}}return n}},pc=null,yN=function(){if(pc!==null)return pc;try{pc=window!=="undefined"&&window.localStorage!==null;var t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{pc=!1}return pc},aK={name:"localStorage",lookup:function(t){var n;if(t.lookupLocalStorage&&yN()){var r=window.localStorage.getItem(t.lookupLocalStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupLocalStorage&&yN()&&window.localStorage.setItem(n.lookupLocalStorage,t)}},hc=null,xN=function(){if(hc!==null)return hc;try{hc=window!=="undefined"&&window.sessionStorage!==null;var t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{hc=!1}return hc},lK={name:"sessionStorage",lookup:function(t){var n;if(t.lookupSessionStorage&&xN()){var r=window.sessionStorage.getItem(t.lookupSessionStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupSessionStorage&&xN()&&window.sessionStorage.setItem(n.lookupSessionStorage,t)}},cK={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}},uK={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}},dK={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}},fK={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]}},JP=!1;try{document.cookie,JP=!0}catch{}var QP=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];JP||QP.splice(1,1);function pK(){return{order:QP,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(t){return t}}}var ZP=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};X7(this,e),this.type="languageDetector",this.detectors={},this.init(t,n)}return eK(e,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n||{languageUtils:{}},this.options=rK(r,this.options||{},pK()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=function(i){return i.replace("-","_")}),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=s,this.addDetector(iK),this.addDetector(oK),this.addDetector(aK),this.addDetector(lK),this.addDetector(cK),this.addDetector(uK),this.addDetector(dK),this.addDetector(fK)}},{key:"addDetector",value:function(n){return this.detectors[n.name]=n,this}},{key:"detect",value:function(n){var r=this;n||(n=this.options.order);var s=[];return n.forEach(function(i){if(r.detectors[i]){var o=r.detectors[i].lookup(r.options);o&&typeof o=="string"&&(o=[o]),o&&(s=s.concat(o))}}),s=s.map(function(i){return r.options.convertDetectedLanguage(i)}),this.services.languageUtils.getBestMatchFromCodes?s:s.length>0?s[0]:null}},{key:"cacheUserLanguage",value:function(n,r){var s=this;r||(r=this.options.caches),r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(n)>-1||r.forEach(function(i){s.detectors[i]&&s.detectors[i].cacheUserLanguage(n,s.options)}))}}])}();ZP.type="languageDetector";const hK={name:"AgentFlow",tagline:"AI Workflow Orchestration"},mK={projects:"Projects",nodes:"Nodes",myNodes:"My Nodes",myFlows:"My Flows",skills:"Skills",mcps:"MCP",feedback:"Feedback",flowEditor:"Flow Editor",settings:"Settings",back:"Back"},gK={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"},yK={success:"Success",failed:"Failed",pending:"Pending",running:"Running",skipped:"Skipped"},xK={agent:"Agent",control:"Control",tool:"Tool",start:"Start",end:"End"},wK={online:"Engine Online",offline:"Engine Offline",connecting:"Connecting…"},bK={hub:"AgentFlow Hub",docs:"Documentation",github:"GitHub Repository"},vK={app:hK,nav:mK,common:gK,status:yK,nodeTypes:xK,engine:wK,links:bK},kK="Flow Editor",SK="Nodes",NK="Edges",jK="Properties",CK={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"},EK={title:"Node Properties",noInputPins:"No input pins",noOutputPins:"No output pins",type:"Type",name:"Name",defaultValue:"Default / value",description:"Description / format",required:"Req",showOnNode:"Card",requiredHint:"Mark this pin as required so users know it must be connected or given a value",showOnNodeHint:"Show this pin name on the canvas node card; hidden pins can still be connected",pinRequiredAriaLabel:"{{label}} {{index}} required",pinShowOnNodeAriaLabel:"{{label}} {{index}} show on node card",pinDescriptionAriaLabel:"{{label}} {{index}} format description",conversationOutput:"Conversation & Output",addPin:"Add Pin",addPinAriaLabel:"Add {{label}}",handleHint:"Matches Handle index on canvas ({{prefix}}-0, {{prefix}}-1…). After adding/removing/reordering, existing connections may break — check validation after saving.",handle:"Handle",pinTypeAriaLabel:"{{label}} {{index}} type",pinNameAriaLabel:"{{label}} {{index}} name",pinDefaultAriaLabel:"{{label}} {{index}} default",deletePinAriaLabel:"Delete {{label}} {{index}}",deletePin:"Delete this pin",instanceId:"Node ID",yamlValueNotInList:"(YAML value, not in current list)",inputPins:"Input Pins (INPUT)",outputPins:"Output Pins (OUTPUT)",expand:"Expand",collapse:"Collapse",expandEditScript:"Expand edit script",expandEdit:"Expand edit",editScript:"Edit script",editUserPrompt:"Edit user prompt",scriptPlaceholder:"instances.*.script — full shell command; supports ${workspaceRoot}, ${pipelineWorkspace}, ${flowDir}, ${runDir} and slot names (don't quote placeholders)",scriptPlaceholderExpand:"instances.*.script — full shell command; don't quote ${workspaceRoot}, ${pipelineWorkspace}, ${flowDir} placeholders",bodyPlaceholder:"instances.*.body — supports multiline and ${variables}; type ${ to pick a slot",bodyPlaceholderExpand:"instances.*.body — supports multiline and ${variables}",noDescription:"(No description in current node definition)",modelAriaLabel:"Model",placeholderSlots:"Placeholders: input/output slots",publishToMarketplace:"Publish Node",publishToMarketplaceHint:"Publish the current node to the workspace local marketplace",publishing:"Publishing…",publishRunning:"Publishing to local marketplace…",publishSuccess:"Node published to local marketplace",publishSuccessWithId:"Node published: {{id}}"},_K={run:"Run Flow",stop:"Stop",resume:"Resume",validate:"Validate",export:"Export",import:"Import"},PK={nodeList:"Node List",runHistory:"Run History",validation:"Validation Results"},AK={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"},IK={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)"},TK={saving:"Saving...",saved:"Saved",saveFailed:"Save failed",runInTerminal:"Please use terminal to run"},RK={requirement:"Requirement Analysis",planning:"Technical Planning",code:"Code Execution",test:"Test Regression",normal:"Normal"},MK={phase:"Phase",allPhasesComplete:"All phases completed",currentPhaseComplete:"Current phase completed, waiting for confirmation..."},LK={node:"Node",text:"Text",file:"File",bool:"Boolean"},$K={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"},OK={title:"Keyboard Shortcuts",general:"General",saveDesc:"Save; when node properties sidebar is open, submit node first then save flow",shortcutsLabel:"Keyboard Shortcuts",jumpToNode:"Jump to node by ID",openNodePalette:"Open node palette",canvas:"Canvas",selectTool:"Select Tool",panTool:"Pan Tool",holdSpacePan:"Hold Space to temporarily pan",saveViewport:"Save current entry view",selectAll:"Select all nodes",undo:"Undo canvas change",redo:"Redo canvas change"},DK={title:"Jump to node",placeholder:"Type node ID or label…",empty:"No matching nodes",hintNavigate:"navigate",hintJump:"jump",hintClose:"close"},FK={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."},zK={mainNav:"Main Navigation"},HK={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'},BK={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):
188
- {{summary}}`,step:"Step {{current}}/{{total}}: {{description}}",phaseGeneration:`Phased generation ({{count}} phases): {{labels}}
189
- 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}}"},WK={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"},VK={nodePalette:"Node Palette",noPipelineSelected:"No pipeline selected",moreRuns:"+{{count}} more",moreFlows:"+{{count}} more flows",runId:"Run ID: {{id}}"},KK={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}}"},UK={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"},qK={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"},YK={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"},GK={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"},XK={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"},QK={justNow:"Just now",minutesAgo:"{{n}} min ago",hoursAgo:"{{n}} hr ago",yesterday:"Yesterday",daysAgo:"{{n}} days ago",milliseconds:"{{n}} ms",seconds:"{{n}} s"},ZK={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"},eU={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."},tU={title:"Print Output: {{instanceId}}",expand:"Expand",restore:"Restore"},nU={save:"Save",cancel:"Cancel"},rU={title:"Run with Params",noParams:"No input params in this flow",run:"Run",cancel:"Cancel"},sU={title:"Run with Preset",noPresets:"No presets available",default:"Default run",run:"Run",cancel:"Cancel"},iU={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"},oU={title:kK,nodes:SK,edges:NK,properties:jK,node:CK,nodeProps:EK,actions:_K,panel:PK,palette:AK,pipeline:IK,status:TK,roles:RK,phases:MK,types:LK,runContext:$K,shortcuts:OK,jumpPalette:DK,emptyCanvas:FK,sidebar:zK,validation:HK,composer:BK,topbar:WK,palette2:VK,run:KK,fileEdit:UK,settings:qK,schedule:YK,history:GK,nodePropsError:XK,placeholder:JK,time:QK,userCheck:ZK,userAsk:eU,toolPrint:tU,provideEdit:nU,runParams:rU,runPreset:sU,runConfig:iU},aU="Settings",lU={engine:"Engine Settings",preferences:"Global Preferences"},cU={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)."},uU={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..."}},dU={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."},fU={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."},pU={title:"Environment Variables",note:"Private to the current signed-in user; overrides service-level env at runtime",noteAdmin:"Configure personal or global env; personal values override global values",saving:"Saving...",key:"Key",value:"Value",scope:"Scope",personal:"Personal",global:"Global",add:"Add",delete:"Delete {{key}}",invalidKey:"Env key must start with a letter or underscore, and only contain letters, numbers, and underscores.",newKey:"New env key",newValue:"Value (be careful with secrets)"},hU={title:"User Allowlist",description:"Only controls which usernames may register or sign in. Users set their own password on first sign-in.",enabled:"Allowlist enabled",open:"Open registration",refreshing:"Refreshing...",saving:"Saving...",file:"File",fileList:"File allowlist",envList:"Environment allowlist",readonly:"Read-only",userCount:"{{count}} users",remove:"Remove {{username}}",emptyFile:"No file allowlist configured. If env allowlist is also empty, every username can register.",emptyEnv:"AGENTFLOW_USER_WHITELIST / AGENTFLOW_ALLOWED_USERS is not configured",unionHint:"The file allowlist and env allowlist are combined. This only stores usernames, never passwords.",add:"Add"},mU={title:"System Status",normal:"Service normal",abnormal:"Some interfaces abnormal",cursorModels:"Cursor Models",opencodeModels:"OpenCode Models",claudeCodeModels:"Claude Code Models"},gU={title:"Shortcuts",projects:"Projects & Pipelines",flowEditor:"Node Canvas"},yU={title:"Language",description:"Select your preferred language for the interface",options:{zh:"中文",en:"English",ja:"日本語"}},xU={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."},wU={title:aU,crumb:lU,workspace:cU,cursor:uU,opencode:dU,claudeCode:fU,env:pU,allowlist:hU,system:mU,shortcuts:gU,language:yU,onboarding:xU},bU={thinking:"Thinking",result:"Result",reply:"Reply",error:"Error"},vU={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)"},kU={send:"Send",stop:"Stop",expand:"Expand",collapse:"Collapse",clear:"Clear"},SU={conversation:"Chat",conversationWithNumber:"Chat {{num}}",default:"Default"},NU={endSession:"End chat (will stop generation)",closeSession:"Close chat",newSession:"New chat",expandComposer:"Expand chat and output"},jU={hint:"Use the bottom input box for AI chat, with @node mentions, model selection, and more"},CU={aiLabels:bU,placeholders:vU,actions:kU,labels:SU,tooltips:NU,rightPanel:jU},EU="Projects",_U="All",PU="Archived",AU="Nodes",IU="My Nodes",TU="My Flows",RU="Skills",MU="Active Projects",LU="Archived Pipelines",$U="Global Nodes",OU="Manage node versions published to the current workspace marketplace, {{count}} total.",DU="Manage flow snippets published to the current workspace marketplace, {{count}} total.",FU="Global Skills",zU="Create New Project",HU="New Pipeline",BU="SEARCH PIPELINES...",WU="SEARCH NODES...",VU="SEARCH FLOW SNIPPETS...",KU="SEARCH SKILLS...",UU="Refresh Resources",qU="Loading pipelines...",YU="Loading global resources...",GU="Filter result: {{count}} items (matching title, description, path and tags)",XU="Archived pipelines can still be opened and edited; files are located in the _archived subdirectory of each pipelines directory.",JU="Manage your distributed node architectures and monitoring pipelines. Drag flow.yaml or .zip into this page to import shared flows.",QU="Review all globally available node definitions, {{count}} total, including built-in, workspace, and marketplace nodes.",ZU="Review Composer-selectable skills, {{count}} total, including AgentFlow built-ins and workspace skills.",eq="Executable building blocks for pipeline runtime",tq="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.",nq="Published local node packages",rq="Only node versions published to this workspace marketplace appear here. Inspect details and delete versions that no flow uses.",sq="Published flow snippets",iq="Flow snippets published from Pipeline or Workspace canvases appear here. Search and inspect them, then load them from the canvas flow palette.",oq="Operating guides for Composer and agents",aq="Skills tell AI which rules to follow for a task, how to change flows, and how to reuse project conventions.",lq="No archived projects.",cq="No active pipelines; archived items are in the Archived tab.",uq="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.",pq="No skills available.",hq="No description.",mq='No node matches "{{query}}".',gq='No flow snippet matches "{{query}}".',yq='No skill matches "{{query}}".',xq="{{inputs}} in / {{outputs}} out",wq="Flow Snippet",bq="{{nodes}} nodes / {{edges}} edges",vq="Skill",kq="Node detail",Sq="Flow snippet detail",Nq="Skill detail",jq="Type",Cq="Source",Eq="Package",_q="Version",Pq="Path",Aq="Editable",Iq="Read only",Tq="Editable",Rq="Schema",Mq="Inputs",Lq="Outputs",$q="Runtime",Oq="Node Body",Dq="Files",Fq="Usage",zq="No runtime manifest.",Hq="No node body or README.",Bq="No previewable files.",Wq="Select a file to preview.",Vq="Binary file preview is not supported.",Kq="Large file; showing the first 256KB only.",Uq="No pipelines using this node were found.",qq="Node Management",Yq="Delete Node Version",Gq="Deleting...",Xq="AgentFlow checks all flow references before deleting; installed or used versions are kept.",Jq="Delete {{id}}@{{version}}? This cannot be undone.",Qq="Deleted {{id}}@{{version}}.",Zq="{{count}} flow(s) still use it.",eY="Flow Snippet Management",tY="Delete Flow Snippet",nY="Deleting...",rY="Deleting it only removes this reusable marketplace snippet. Nodes already loaded onto canvases are not changed.",sY="Delete {{id}}@{{version}}? This cannot be undone.",iY="Deleted {{id}}@{{version}}.",oY="No slots",aY="Purpose",lY="This node is an execution unit in a pipeline. Its schema affects canvas wiring, parameter input, and runtime scheduling.",cY="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.",uY="Scale",dY="Flow Preview",fY="Edges",pY="Snippet JSON",hY="{{count}} more edge(s)",mY="No previewable nodes.",gY="This skill is injected into Composer as context for AI, constraining its decisions, edit strategy, and output format.",yY="SKILL.md Preview",xY="No preview content available.",wY="Select a resource to inspect details.",bY="Failed to load pipeline list.",vY="No pipelines in current workspace.",kY="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.",SY='No pipelines found matching "{{query}}". Try different keywords or clear the search.',NY="Recent Activity",jY="No recent activity",CY="No recent activity matching the keyword",EY="Recent Run",_Y="Recent Open",PY={builtin:"Built-in",workspace:"Workspace",user:"User"},AY={flow:"Flow",global:"Global",marketplace:"Marketplace"},IY={all:"All",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},TY={overview:"Overview",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},RY="Open to edit this pipeline in the node canvas.",MY={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>"},LY={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"},$Y={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"},OY={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"},DY={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"},FY={title:EU,all:_U,archived:PU,nodes:AU,myNodes:IU,myFlows:TU,skills:RU,activeProjects:MU,archivedPipelines:LU,globalNodes:$U,myNodesHint:OU,myFlowsHint:DU,globalSkills:FU,createNew:zU,newPipeline:HU,searchPipelines:BU,searchNodes:WU,searchFlows:VU,searchSkills:KU,refreshResources:UU,loadingPipelines:qU,loadingResources:YU,filterResult:GU,archivedHint:XU,activeHint:JU,nodesHint:QU,skillsHint:ZU,nodesPurposeTitle:eq,nodesPurposeDesc:tq,myNodesPurposeTitle:nq,myNodesPurposeDesc:rq,myFlowsPurposeTitle:sq,myFlowsPurposeDesc:iq,skillsPurposeTitle:oq,skillsPurposeDesc:aq,noArchived:lq,noActive:cq,noNodes:uq,noMyNodes:dq,noMyFlows:fq,noSkills:pq,noDescription:hq,noNodeMatch:mq,noFlowSnippetMatch:gq,noSkillMatch:yq,nodeSlots:xq,flowSnippet:wq,flowSnippetNodes:bq,skill:vq,nodeDetail:kq,flowDetail:Sq,skillDetail:Nq,detailType:jq,detailSource:Cq,detailPackage:Eq,detailVersion:_q,detailPath:Pq,detailEditable:Aq,readOnly:Iq,editable:Tq,nodeSchema:Rq,nodeInputs:Mq,nodeOutputs:Lq,nodeRuntime:$q,nodeBody:Oq,nodeFiles:Dq,nodeUsage:Fq,noRuntimeManifest:zq,noNodeBody:Hq,noNodeFiles:Bq,selectNodeFile:Wq,binaryFile:Vq,fileTruncated:Kq,noNodeUsage:Uq,myNodeManagement:qq,deleteMyNode:Yq,deletingMyNode:Gq,deleteMyNodeHint:Xq,deleteMyNodeConfirm:Jq,deleteMyNodeSuccess:Qq,deleteMyNodeUsedBy:Zq,myFlowManagement:eY,deleteMyFlow:tY,deletingMyFlow:nY,deleteMyFlowHint:rY,deleteMyFlowConfirm:sY,deleteMyFlowSuccess:iY,noSlots:oY,resourceMeaning:aY,nodesMeaning:lY,myFlowsMeaning:cY,flowSnippetScale:uY,flowSnippetPreview:dY,flowSnippetEdges:fY,flowSnippetJson:pY,flowSnippetMoreEdges:hY,noFlowSnippetPreview:mY,skillsMeaning:gY,skillPreview:yY,skillPreviewEmpty:xY,selectResource:wY,loadFailed:bY,noPipelines:vY,emptyHint:kY,noMatch:SY,recentActivity:NY,noRecentActivity:jY,noMatchRecent:CY,recentRun:EY,recentOpen:_Y,sourceBadge:PY,resourceSource:AY,resourceFilter:IY,nodeDetailTabs:TY,defaultCardDesc:RY,hubCard:MY,newPipelineModal:LY,importModal:$Y,deleteModal:OY,archiveModal:DY},zY="Back",HY="Next",BY="Skip",WY="Done",VY="Start Creating",KY={intro:`Welcome to AgentFlow! This is a visual workflow orchestration tool.
190
-
191
- Click the button below to create your first pipeline.`,hubIntro:`Don't want to start from scratch?
192
-
193
- Browse ready-made pipelines on AgentFlow Hub — community-shared flows you can install and run in one click.`},UY={intro:`Now you're in the flow editor.
194
-
195
- Describe your requirements in natural language in the input box below, and AI will generate the flow graph.
196
-
197
- The left node panel allows you to freely drag, delete, and adjust connections.`,introEmpty:`The canvas is empty. Start creating your flow!
198
-
199
- Describe your requirements in natural language in the input box below, and AI will generate the flow graph.
200
-
201
- The left node panel allows you to freely drag, delete, and adjust connections.`},qY={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"},YY={back:zY,next:HY,skip:BY,done:WY,startCreate:VY,projects:KY,flow:UY,newPipeline:qY},GY={name:"AgentFlow",tagline:"AI 工作流编排"},XY={projects:"项目",nodes:"Nodes",myNodes:"我的 Nodes",myFlows:"我的流程",skills:"Skills",mcps:"MCP",feedback:"意见反馈",flowEditor:"流程编辑器",settings:"设置",back:"返回"},JY={loading:"加载中…",saving:"保存中…",save:"保存",cancel:"取消",delete:"删除",edit:"编辑",create:"创建",close:"关闭",confirm:"确认",copy:"复制",copied:"已复制!",refresh:"刷新",search:"搜索",filter:"筛选",success:"成功",error:"错误",warning:"警告",info:"信息",done:"完成",pending:"待处理",running:"运行中",notFound:"未找到",required:"必填",optional:"可选"},QY={success:"成功",failed:"失败",pending:"等待",running:"运行中",skipped:"跳过"},ZY={agent:"Agent 节点",control:"控制节点",tool:"工具节点",start:"开始",end:"结束"},eG={online:"引擎在线",offline:"引擎离线",connecting:"连接中…"},tG={hub:"AgentFlow Hub",docs:"文档",github:"GitHub 仓库"},nG={app:GY,nav:XY,common:JY,status:QY,nodeTypes:ZY,engine:eG,links:tG},rG="流程编辑器",sG="节点",iG="连线",oG="属性",aG={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:"编辑内容"},lG={title:"节点属性",noInputPins:"当前无输入引脚",noOutputPins:"当前无输出引脚",type:"类型",name:"名称",defaultValue:"默认值 / value",description:"描述 / 格式",required:"必填",showOnNode:"卡片",requiredHint:"标记为必填,用于提示用户该槽位必须提供值或连线",showOnNodeHint:"是否在画布节点卡片旁展示这个引脚名称;关闭后仍可连线",pinRequiredAriaLabel:"{{label}} {{index}} 是否必填",pinShowOnNodeAriaLabel:"{{label}} {{index}} 是否在节点卡片展示",pinDescriptionAriaLabel:"{{label}} {{index}} 格式描述",conversationOutput:"对话与输出",addPin:"添加引脚",addPinAriaLabel:"添加{{label}}",handleHint:"与画布上 Handle 序号一致({{prefix}}-0、{{prefix}}-1…)。增删或调整顺序后,原有连线可能失效,保存后请留意校验提示。",handle:"Handle",pinTypeAriaLabel:"{{label}} {{index}} 类型",pinNameAriaLabel:"{{label}} {{index}} 名称",pinDefaultAriaLabel:"{{label}} {{index}} 默认值",deletePinAriaLabel:"删除 {{label}} {{index}}",deletePin:"删除此引脚",instanceId:"节点 ID",yamlValueNotInList:"(YAML 中的值,不在当前列表)",inputPins:"输入引脚(INPUT)",outputPins:"输出引脚(OUTPUT)",expand:"展开",collapse:"收起",expandEditScript:"展开编辑 script",expandEdit:"展开编辑",editScript:"编辑 script",editUserPrompt:"编辑用户提示",scriptPlaceholder:"instances.*.script,完整 shell 命令;支持 ${workspaceRoot}、${pipelineWorkspace}、${flowDir}、${runDir} 与各槽位名(勿对占位符再包双引号)",scriptPlaceholderExpand:"instances.*.script,完整 shell 命令;勿对 ${workspaceRoot}、${pipelineWorkspace}、${flowDir} 等占位符再包双引号",bodyPlaceholder:"instances.*.body,支持多行与 ${变量};输入 ${ 选择槽位",bodyPlaceholderExpand:"instances.*.body,支持多行与 ${变量}",noDescription:"(当前节点定义无 description)",modelAriaLabel:"模型",placeholderSlots:"占位符:输入输出槽位",publishToMarketplace:"发布节点",publishToMarketplaceHint:"将当前节点发布到 Workspace 本地节点市场",publishing:"发布中…",publishRunning:"正在发布到本地节点市场…",publishSuccess:"节点已发布到本地节点市场",publishSuccessWithId:"节点已发布:{{id}}"},cG={run:"运行流程",stop:"停止",resume:"继续",validate:"校验",export:"导出",import:"导入"},uG={nodeList:"节点列表",runHistory:"运行历史",validation:"校验结果"},dG={workspace:"工作区",loading:"加载中…",archived:"已归档",noPipelines:"暂无流水线",more:"更多",moreFlows:"更多流程",noRuns:"暂无运行记录",searchNodes:"搜索节点",noComponents:"暂无可用组件(检查节点库目录)",noMatch:"无匹配节点,请调整搜索词",selectPipeline:"从上方选择一条流水线以加载组件与画布",validationWarnings:"校验警告(与 agentflow validate 槽位检查一致)",output:"输出",model:"模型",userDir:"用户目录",toggleRecentActivity:"展开或收起最近打开或最近运行"},fG={selectPipeline:"请从顶部下拉选择一条流水线",loadingProps:"加载节点属性…",pipelineId:"流水线 ID",diskPath:"磁盘路径",storageLocation:"存储位置",introduction:"介绍",introductionPlaceholder:"简要描述这条流水线的用途(写入 flow.yaml 的 ui.description)",metadata:"元数据",nodeCount:"节点数",nodesUnit:"个节点",loading:"加载中…",noRuns:"暂无运行记录(终端执行后会在工作区生成运行目录)"},pG={saving:"保存中…",saved:"已保存",saveFailed:"保存失败",runInTerminal:"运行请使用终端"},hG={requirement:"需求拆解",planning:"技术规划",code:"代码执行",test:"测试回归",normal:"普通"},mG={phase:"阶段",allPhasesComplete:"所有阶段完成",currentPhaseComplete:"当前阶段完成,等待确认继续…"},gG={node:"节点",text:"文本",file:"文件",bool:"布尔"},yG={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:"等待"},xG={title:"快捷键",general:"常规",saveDesc:"保存;节点属性侧栏打开时先提交节点再保存 flow",shortcutsLabel:"快捷键",jumpToNode:"按 ID 跳转到节点",openNodePalette:"打开节点面板",canvas:"画布",selectTool:"选择工具",panTool:"平移工具",holdSpacePan:"按住空格临时平移",saveViewport:"保存当前进入视角",selectAll:"全选所有节点",undo:"撤销画布修改",redo:"重做画布修改"},wG={title:"跳转到节点",placeholder:"输入节点 ID 或名称…",empty:"未匹配到节点",hintNavigate:"切换",hintJump:"跳转",hintClose:"关闭"},bG={title:"开始构建你的流程",text:"在下方 AI 输入框中描述你的流程,或从左侧面板拖拽节点到画布",composerHint:"使用 AI Composer 构建 AgentFlow",composerSub:"从左侧拖入节点,或在<strong>下方输入框</strong>中用自然语言描述工作流。<br/>按 <kbd>?</kbd> 查看快捷键。"},vG={mainNav:"主导航"},kG={flowWarningAriaLabel:"流程校验警告",reloadFromServer:"从服务器重新加载流程并刷新校验",reloadFromServerShort:"从服务器重新加载",closeBanner:"关闭校验警告横幅",nodePrefix:"节点",focusNodeAriaLabel:"在画布中选中并定位节点 {{nodeId}}",slotWarningCount:"槽位校验 {{count}} 条(已隐藏)",show:"显示",shortcutHint:"按 ? 查看快捷键",shortcutHintLabel:"快捷键",inputSlotNoEdge:' 的 input 槽位 "{{slotName}}"({{handle}})无对应 edge 连接',outputSlotNoEdge:' 的 output 槽位 "{{slotName}}"({{handle}})无对应 edge 连接'},SG={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}} 步):
202
- {{summary}}`,step:"步骤 {{current}}/{{total}}: {{description}}",phaseGeneration:`分阶段生成({{count}} 阶段):{{labels}}
203
- 当前:{{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}}"},NG={currentPipeline:"当前流水线",backToEdit:"返回编辑",backToProjects:"返回项目",executionLog:"执行日志",history:"历史",pipelineSettings:"流水线设置",shortcutsLabel:"快捷键",shortcutsTitle:"快捷键 (?)",deletePipeline:"删除流水线",resumeTitle:"在同一 run 目录继续执行(uuid={{uuid}})",resumeTitleNoUuid:"尚未收到 apply-start,将发起新的 run",rerunTitle:"从头开始新的运行",runOptions:"运行选项",runWithParams:"带参数运行",runWithPreset:"指定预设运行",editRun:"编辑运行参数",startRun:"开始执行",stopRun:"停止后台运行"},jG={nodePalette:"节点调色板",noPipelineSelected:"未选择流水线",moreRuns:"+{{count}} 更多",moreFlows:"+{{count}} 更多流程",runId:"运行 ID: {{id}}"},CG={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}} 的分支"},EG={close:"关闭",loading:"加载中…",placeholder:"文件内容",largeFileWarning:"文件较大,编辑器性能可能受影响",reset:"重置",aiEdit:"AI 修改",aiRunning:"AI 处理中…",save:"保存",saving:"保存中…",saved:"已保存"},_G={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:"已复制"},PG={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:"定时配置已保存"},AG={title:"执行历史",summary:"执行结果汇总",successCount:"{{count}} 成功",failedCount:"{{count}} 失败",stoppedCount:"{{count}} 已停止",interruptedCount:"{{count}} 已中断",runningCount:"{{count}} 进行中",success:"成功",failed:"失败",stopped:"已停止",interrupted:"已中断",running:"进行中",unknown:"未知",runLabel:"运行 #{{id}}",enterRunView:"进入该次运行的画布与日志态"},IG={invalidInstanceId:"实例 ID 格式无效:仅允许英文字母、数字、下划线、短横线,且不能以数字开头。",duplicateInstanceId:"该实例 ID 已存在,请换一个。",loadFlowFailed:"读取 flow 失败",loadNodesFailed:"读取节点库失败"},TG={invalidPlaceholder:"无效占位符: {{hint}}",empty:"(空)",inputSubtitle:"输入 · {{type}}",inputSubtitleNoType:"输入",outputSubtitle:"输出 · {{type}}",outputSubtitleNoType:"输出",runtimeConst:"运行时常量"},RG={justNow:"刚刚",minutesAgo:"{{n}} 分钟前",hoursAgo:"{{n}} 小时前",yesterday:"昨天",daysAgo:"{{n}} 天前",milliseconds:"{{n}} 毫秒",seconds:"{{n}} 秒"},MG={title:"用户确认 ({{instanceId}})",edit:"编辑",save:"保存",cancel:"取消",aiEditPlaceholder:"输入 AI 修改指令,如:删除第二项、合并前两项…",aiEditBtn:"AI 修改",aiEditStarted:"AI 正在修改内容…",aiEditDone:"AI 修改完成",aiEditFailed:"AI 修改失败",contentSaved:"内容已保存",saveFailed:"保存失败",close:"关闭",continue:"继续执行",hint:"编辑或使用 AI 修改后点击保存,然后点击「继续执行」恢复流程"},LG={title:"用户选择 ({{instanceId}})",hint:"请从下方选项中选择一项以继续流程",submitting:"提交中…",submitFailed:"提交失败",close:"关闭",noOptions:"该节点未配置选项,请先在编辑器中为 output 槽位添加条目。"},$G={title:"Print 输出: {{instanceId}}",expand:"放大",restore:"还原"},OG={save:"保存",cancel:"取消"},DG={title:"带参数运行",noParams:"此流程无输入参数",run:"运行",cancel:"取消"},FG={title:"指定预设运行",noPresets:"无可用预设",default:"默认运行",run:"运行",cancel:"取消"},zG={preset:"预设",default:"默认",newPreset:"新建预设",deletePreset:"删除预设",presetNamePlaceholder:"预设名称",inputParams:"输入参数",noProvideNodes:"此流程无 provide 节点",filePathPlaceholder:"文件路径…",stringValuePlaceholder:"值…",presetSaved:"预设已保存",presetDeleted:"预设已删除",savePreset:"保存当前预设",expandInput:"编辑内容"},HG={title:rG,nodes:sG,edges:iG,properties:oG,node:aG,nodeProps:lG,actions:cG,panel:uG,palette:dG,pipeline:fG,status:pG,roles:hG,phases:mG,types:gG,runContext:yG,shortcuts:xG,jumpPalette:wG,emptyCanvas:bG,sidebar:vG,validation:kG,composer:SG,topbar:NG,palette2:jG,run:CG,fileEdit:EG,settings:_G,schedule:PG,history:AG,nodePropsError:IG,placeholder:TG,time:RG,userCheck:MG,userAsk:LG,toolPrint:$G,provideEdit:OG,runParams:DG,runPreset:FG,runConfig:zG},BG="设置",WG={engine:"引擎设置",preferences:"全局首选项"},VG={title:"工作区",currentPath:"当前工作区根目录",placeholder:"加载中…",copyPath:"复制路径",description:"流水线与节点清单将相对于此目录解析(由启动 UI 时传入)。"},KG={title:"Cursor CLI",status:{cached:"已缓存",notCached:"未缓存"},modelPreviewLabel:"Cursor 模型名称列表",modelList:{cached:"模型清单已缓存",empty:"暂无模型列表",count:"{{count}} 条",fetchedAt:"更新 {{time}}",never:"尚未拉取",refresh:"刷新清单",fetching:"拉取中…"}},UG={modelPreviewLabel:"OpenCode 模型名称列表",title:"OpenCode CLI",status:{ready:"就绪",notFound:"未找到"},provider:"方案 / Provider 标识",providerPlaceholder:"例如 bailian-coding-plan",saving:"正在保存并更新清单…",description:"对应 CLI opencode models <provider> 的参数;停止输入后会写入用户目录 config 并刷新 model-lists.json。"},qG={title:"Claude Code CLI",status:{ready:"就绪",notFound:"未找到"},modelPreviewLabel:"Claude Code 模型名称列表",description:"内置模型列表(Claude Code CLI 无 models 子命令);刷新将探测 claude 二进制是否在 PATH 中。首次使用请先执行 claude /login。"},YG={title:"环境变量",note:"当前登录用户私有,运行时优先于服务全局环境变量",noteAdmin:"可配置个人或全局环境变量;个人同名变量优先于全局",saving:"正在保存...",key:"键",value:"值",scope:"范围",personal:"个人",global:"全局",add:"添加",delete:"删除 {{key}}",invalidKey:"环境变量名必须以字母或下划线开头,且只能包含字母、数字和下划线。",newKey:"新环境变量键",newValue:"值(密钥请谨慎)"},GG={title:"用户白名单",description:"只控制 username 是否允许注册或登录,密码由用户首次登录时自行设置。",enabled:"白名单已启用",open:"开放注册",refreshing:"刷新中...",saving:"保存中...",file:"文件",fileList:"文件白名单",envList:"环境变量白名单",readonly:"只读",userCount:"{{count}} 个用户",remove:"删除 {{username}}",emptyFile:"未配置文件白名单;如果环境变量也为空,则所有用户可注册。",emptyEnv:"未配置 AGENTFLOW_USER_WHITELIST / AGENTFLOW_ALLOWED_USERS",unionHint:"文件白名单与环境变量白名单取并集;这里只会保存用户名,不保存密码。",add:"添加"},XG={title:"系统状态",normal:"服务正常",abnormal:"部分接口异常",cursorModels:"Cursor 模型",opencodeModels:"OpenCode 模型",claudeCodeModels:"Claude Code 模型"},JG={title:"快捷入口",projects:"项目与流水线",flowEditor:"节点画布"},QG={title:"语言",description:"选择界面显示语言",options:{zh:"中文",en:"English",ja:"日本語"}},ZG={title:"新手引导",description:"重新启动产品引导流程,了解 AgentFlow 的核心功能。",reset:"重置引导",resetSuccess:"已重置,下次访问将自动启动引导"},eX={title:BG,crumb:WG,workspace:VG,cursor:KG,opencode:UG,claudeCode:qG,env:YG,allowlist:GG,system:XG,shortcuts:JG,language:QG,onboarding:ZG},tX={thinking:"思考",result:"结果",reply:"回复",error:"错误"},nX={input:"让 AI 协助编辑此节点…",waiting:"等待响应…",selectedEmpty:"在画布上选择节点,或在输入框用 @ 选择实例(Instances)或节点类型(Node)",textarea:"描述你的流程或让 AI 协助编辑(⌘/Ctrl+Enter 发送)"},rX={send:"发送",stop:"停止",expand:"展开",collapse:"收起",clear:"清空"},sX={conversation:"对话",conversationWithNumber:"对话 {{num}}",default:"默认"},iX={endSession:"结束对话(将停止生成)",closeSession:"关闭对话",newSession:"新建对话",expandComposer:"展开对话与输出"},oX={hint:"使用底部输入框进行 AI 对话,支持 @节点、选择模型等功能"},aX={aiLabels:tX,placeholders:nX,actions:rX,labels:sX,tooltips:iX,rightPanel:oX},lX="项目",cX="全部",uX="已归档",dX="Nodes",fX="我的 Nodes",pX="我的流程",hX="Skills",mX="活跃项目",gX="已归档流水线",yX="全局 Nodes",xX="管理当前工作区已发布到本地 Marketplace 的节点,共 {{count}} 个。",wX="管理当前工作区已发布到本地 Marketplace 的流程片段,共 {{count}} 个。",bX="全局 Skills",vX="创建新项目",kX="新建流水线",SX="搜索流水线…",NX="搜索 nodes…",jX="搜索流程片段…",CX="搜索 skills…",EX="刷新资源",_X="加载流水线列表…",PX="加载全局资源…",AX="筛选结果:{{count}} 条(匹配标题、描述、路径与标签)",IX="已归档的流水线仍可打开与编辑;文件位于各 pipelines 目录下的 _archived。",TX="管理分布式节点架构与监控流水线。可将 flow.yaml 或 .zip 拖入本页导入分享流程。",RX="查看当前可用的全局节点定义,共 {{count}} 个;包含内置、工作区与 marketplace 节点。",MX="查看当前 Composer 可选择的 skills,共 {{count}} 个;包含 AgentFlow 内置与工作区 skills。",LX="流程运行时的可执行积木",$X="Nodes 决定画布上能拖什么、节点有哪些输入输出,以及运行时走 agent、control、provide 或 marketplace 哪类逻辑。",OX="已发布的本地节点包",DX="这里仅显示你发布到当前 Workspace Marketplace 的节点版本;可查看详情并删除未被 Flow 使用的版本。",FX="已发布的流程片段",zX="这里显示从 Pipeline 或 Workspace 画布发布的流程片段,可搜索、检查内容,并从画布的流程面板中加载复用。",HX="Composer/Agent 的操作指南",BX="Skills 告诉 AI 在特定任务里应遵守什么规则、如何修改 flow、如何复用项目约定。",WX="暂无归档项目。",VX="暂无未归档流水线;已归档项在 Archived 标签中查看。",KX="暂无可用全局 nodes。",UX="暂无已发布的 marketplace nodes。",qX="暂无已发布的流程片段。可在画布中选中多个节点后发布。",YX="暂无可用 skills。",GX="暂无描述。",XX="未找到与「{{query}}」匹配的 node。",JX="未找到与「{{query}}」匹配的流程片段。",QX="未找到与「{{query}}」匹配的 skill。",ZX="{{inputs}} in / {{outputs}} out",eJ="流程片段",tJ="{{nodes}} 节点 / {{edges}} 连线",nJ="Skill",rJ="Node 详情",sJ="流程片段详情",iJ="Skill 详情",oJ="类型",aJ="来源",lJ="包",cJ="版本",uJ="路径",dJ="可编辑",fJ="只读",pJ="可编辑",hJ="Schema",mJ="输入",gJ="输出",yJ="Runtime",xJ="节点内容",wJ="Files",bJ="Usage",vJ="暂无 runtime manifest。",kJ="暂无节点正文或 README。",SJ="暂无可预览文件。",NJ="请选择文件查看内容。",jJ="二进制文件暂不支持预览。",CJ="文件较大,仅显示前 256KB。",EJ="暂未发现使用此 node 的流水线。",_J="节点管理",PJ="删除节点版本",AJ="删除中…",IJ="删除前会检查所有 Flow 引用;仍被安装或使用的版本不会被删除。",TJ="确定删除 {{id}}@{{version}}?此操作不可撤销。",RJ="已删除 {{id}}@{{version}}。",MJ="仍有 {{count}} 个 Flow 使用它。",LJ="流程片段管理",$J="删除流程片段",OJ="删除中…",DJ="删除后不会影响已经加载到画布里的节点,只会移除 Marketplace 中这个可复用片段。",FJ="确定删除 {{id}}@{{version}}?此操作不可撤销。",zJ="已删除 {{id}}@{{version}}。",HJ="无槽位",BJ="作用",WJ="这个 node 是 pipeline 的执行单元。它的 schema 会影响画布连线、参数输入和运行时调度。",VJ="流程片段是固定化流程的一部分。加载时会复制这组节点、连线和布局到当前画布,不覆盖已有内容。",KJ="规模",UJ="流程预览",qJ="连线",YJ="片段 JSON",GJ="还有 {{count}} 条连线",XJ="暂无可预览节点。",JJ="这个 skill 会作为 Composer 的上下文注入给 AI,用于约束 AI 的判断、修改方式和输出口径。",QJ="SKILL.md 预览",ZJ="暂无可预览内容。",eQ="请选择一个资源查看详情。",tQ="未能加载流水线列表。",nQ="当前工作区暂无流水线。",rQ="在仓库根目录执行 {{code1}} 并确认工作区包含 {{code2}} 或用户目录下的流水线;亦可点击 New Pipeline 新建。",sQ="未找到与「{{query}}」匹配的流水线。可尝试其他关键词,或点击清除搜索。",iQ="最近打开或最近运行",oQ="暂无打开或运行记录",aQ="暂无与关键词匹配的最近记录",lQ="最近运行",cQ="最近打开",uQ={builtin:"内置",workspace:"工作区",user:"用户"},dQ={flow:"Flow",global:"Global",marketplace:"Marketplace"},fQ={all:"全部",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},pQ={overview:"概览",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},hQ="打开以在节点画布中编辑此流水线。",mQ={eyebrow:"AgentFlow Hub",title:"浏览社区流程",desc:"发现并一键安装社区分享的现成流水线。",cta:"前往 Hub",cliHint:"或通过 CLI 安装:agentflow download <slug>"},gQ={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:"关闭"},yQ={title:"导入流水线",lead:"已选择文件「{{filename}}」。请确认流水线名称与保存位置;ZIP 将保留目录内脚本等文件。",nameLabel:"名称(必填)",namePlaceholder:"例如 my_shared_flow",nameHint:"须以英文字母开头,仅可使用字母、数字、下划线 _ 与连字符 -",locationLabel:"保存位置",userDir:"用户目录(~/agentflow/pipelines)",workspaceDir:"当前工作区(.workspace/agentflow/pipelines)",changeFile:"更换文件…",importFailed:"导入失败",importing:"导入中…",importAndOpen:"导入并打开",cancel:"取消",close:"关闭"},xQ={title:"删除流水线",lead:"将永久删除磁盘上的流水线目录(含 flow.yaml、脚本等),无法撤销。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",deleteFailed:"删除失败",deleteTimeout:"删除请求超时,请重试(可先检查终端中的 UI 服务日志)",delete:"删除",deleting:"删除中…",confirmDelete:"确认删除",cancel:"取消",close:"关闭"},wQ={title:"归档流水线",lead:"归档后流水线将移入「Archived」列表,仍可从该列表打开与编辑。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",archiveFailed:"归档失败",archive:"归档",archiving:"归档中…",confirmArchive:"确认归档",cancel:"取消",close:"关闭"},bQ={title:lX,all:cX,archived:uX,nodes:dX,myNodes:fX,myFlows:pX,skills:hX,activeProjects:mX,archivedPipelines:gX,globalNodes:yX,myNodesHint:xX,myFlowsHint:wX,globalSkills:bX,createNew:vX,newPipeline:kX,searchPipelines:SX,searchNodes:NX,searchFlows:jX,searchSkills:CX,refreshResources:EX,loadingPipelines:_X,loadingResources:PX,filterResult:AX,archivedHint:IX,activeHint:TX,nodesHint:RX,skillsHint:MX,nodesPurposeTitle:LX,nodesPurposeDesc:$X,myNodesPurposeTitle:OX,myNodesPurposeDesc:DX,myFlowsPurposeTitle:FX,myFlowsPurposeDesc:zX,skillsPurposeTitle:HX,skillsPurposeDesc:BX,noArchived:WX,noActive:VX,noNodes:KX,noMyNodes:UX,noMyFlows:qX,noSkills:YX,noDescription:GX,noNodeMatch:XX,noFlowSnippetMatch:JX,noSkillMatch:QX,nodeSlots:ZX,flowSnippet:eJ,flowSnippetNodes:tJ,skill:nJ,nodeDetail:rJ,flowDetail:sJ,skillDetail:iJ,detailType:oJ,detailSource:aJ,detailPackage:lJ,detailVersion:cJ,detailPath:uJ,detailEditable:dJ,readOnly:fJ,editable:pJ,nodeSchema:hJ,nodeInputs:mJ,nodeOutputs:gJ,nodeRuntime:yJ,nodeBody:xJ,nodeFiles:wJ,nodeUsage:bJ,noRuntimeManifest:vJ,noNodeBody:kJ,noNodeFiles:SJ,selectNodeFile:NJ,binaryFile:jJ,fileTruncated:CJ,noNodeUsage:EJ,myNodeManagement:_J,deleteMyNode:PJ,deletingMyNode:AJ,deleteMyNodeHint:IJ,deleteMyNodeConfirm:TJ,deleteMyNodeSuccess:RJ,deleteMyNodeUsedBy:MJ,myFlowManagement:LJ,deleteMyFlow:$J,deletingMyFlow:OJ,deleteMyFlowHint:DJ,deleteMyFlowConfirm:FJ,deleteMyFlowSuccess:zJ,noSlots:HJ,resourceMeaning:BJ,nodesMeaning:WJ,myFlowsMeaning:VJ,flowSnippetScale:KJ,flowSnippetPreview:UJ,flowSnippetEdges:qJ,flowSnippetJson:YJ,flowSnippetMoreEdges:GJ,noFlowSnippetPreview:XJ,skillsMeaning:JJ,skillPreview:QJ,skillPreviewEmpty:ZJ,selectResource:eQ,loadFailed:tQ,noPipelines:nQ,emptyHint:rQ,noMatch:sQ,recentActivity:iQ,noRecentActivity:oQ,noMatchRecent:aQ,recentRun:lQ,recentOpen:cQ,sourceBadge:uQ,resourceSource:dQ,resourceFilter:fQ,nodeDetailTabs:pQ,defaultCardDesc:hQ,hubCard:mQ,newPipelineModal:gQ,importModal:yQ,deleteModal:xQ,archiveModal:wQ},vQ="返回",kQ="下一步",SQ="跳过",NQ="完成",jQ="开始创建",CQ={intro:`欢迎使用 AgentFlow!这是一个可视化流程编排工具。
204
-
205
- 点击下方按钮开始创建你的第一个流水线。`,hubIntro:`不想从零开始?
206
-
207
- 在 AgentFlow Hub 浏览社区分享的现成流水线,一键安装即可运行。`},EQ={intro:`现在进入流程编辑器。
208
-
209
- 在下方输入框用自然语言描述你的需求,AI 会自动生成流程图。
210
-
211
- 左侧节点面板可以自由拖拽、删除和调整连接。`,introEmpty:`画布为空,开始创建你的流程吧!
212
-
213
- 在下方输入框用自然语言描述需求,AI 会自动生成流程图。
214
-
215
- 左侧节点面板可以自由拖拽、删除和调整连接。`},_Q={guideTitle:"首次创建提示",guideDesc:"输入名称和描述后,AI 会自动生成流程图。你可以在编辑器中自由调整节点和连接。",nameHintGuide:"例如:MyFirstFlow(字母开头,支持数字和下划线)",descPlaceholderGuide:"例如:实现用户登录功能,包含注册、验证、授权",descHintGuide:"描述越详细,AI 生成的流程越准确",createGuide:"创建并开始编辑",typeNode:"节点引用类型",typeStr:"字符串类型",typeFile:"文件路径类型",typeBool:"布尔值类型"},PQ={back:vQ,next:kQ,skip:SQ,done:NQ,startCreate:jQ,projects:CQ,flow:EQ,newPipeline:_Q},AQ={en:{common:vK,flow:oU,settings:wU,composer:CU,project:FY,onboarding:YY},zh:{common:nG,flow:HG,settings:eX,composer:aX,project:bQ,onboarding:PQ}};Wn.use(ZP).use(_2).init({resources:AQ,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 IQ=[{code:"zh",name:"中文",flag:"🇨🇳"},{code:"en",name:"English",flag:"🇬🇧"}];function TQ(e){return Wn.changeLanguage(e)}const Vy="agentflow-settings-opencode-plan-v1";function Gm(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 eA(){return`e_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function RQ(e){return/^[A-Za-z_][A-Za-z0-9_]*$/.test(String(e||"").trim())}function So(e,t="user"){if(!Array.isArray(e))return[];const n=[];for(const r of e){if(!r||typeof r!="object")continue;const s=String(r.key??"").trim(),i=String(r.value??""),o=String(r.id??"").trim()||eA(),c=String(r.scope??t).trim()==="global"?"global":"user";!s&&!i||n.push({id:o,key:s,value:i,scope:c})}return n}function wN(e){return So(e).map(({key:t,value:n})=>({key:t,value:n}))}function bN(){try{return localStorage.getItem(Vy)??""}catch{return""}}function MQ(e){return e?e.length<=6?"•".repeat(e.length):`${"•".repeat(Math.min(20,e.length-4))}${e.slice(-4)}`:""}function vN(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 LQ({authUser:e}){const{t,i18n:n}=dr(["common","settings"]),r=n.language||"zh",[s,i]=m.useState(""),[o,l]=m.useState(""),[c,u]=m.useState({cursor:[],opencode:[],claudeCode:[],cursorFetchedAt:null,opencodeFetchedAt:null,claudeCodeFetchedAt:null}),[p,f]=m.useState(""),[d,h]=m.useState(!1),[y,w]=m.useState(!1),[k,g]=m.useState(""),[b,x]=m.useState([]),[S,C]=m.useState(""),[j,E]=m.useState(!1),[A,D]=m.useState(""),[W,F]=m.useState(""),[R,$]=m.useState(!1),[P,L]=m.useState(()=>new Set),[T,O]=m.useState(""),[I,H]=m.useState([]),[_,Y]=m.useState(!1),[U,V]=m.useState(""),[Z,ue]=m.useState([]),[le,we]=m.useState([]),[re,ye]=m.useState(""),[te,ie]=m.useState(""),[ce,pe]=m.useState(!1),[De,He]=m.useState(!1),[Ie,et]=m.useState(""),[ut,Ae]=m.useState(""),[Qe,qt]=m.useState(""),[Te,Ht]=m.useState(null),[st,dn]=m.useState(!1),[ne,me]=m.useState(!1),[Oe,Fe]=m.useState(""),Ve=m.useRef(null),Et=m.useRef(!1),Lt=m.useRef(!1),tt=m.useRef(""),fn=m.useCallback(async()=>{l("");try{const ee=await fetch("/api/ui-context");if(!ee.ok)throw new Error("HTTP "+ee.status);const be=await ee.json();i(typeof be.workspaceRoot=="string"?be.workspaceRoot:"")}catch(ee){l(String(ee.message||ee)),i("")}},[]),kt=m.useCallback(async()=>{f(""),h(!0);try{const ee=await fetch("/api/model-lists");if(!ee.ok)throw new Error("HTTP "+ee.status);const be=await ee.json();u(Gm(be))}catch(ee){f(String(ee.message||ee))}finally{h(!1)}},[]),Nt=m.useCallback(async()=>{C("");try{const ee=await fetch("/api/user-env"),be=await ee.json().catch(()=>({}));if(!ee.ok)throw new Error(typeof be.error=="string"?be.error:"HTTP "+ee.status);const Q=So(Array.isArray(be.env)?be.env:[],"user").map(Be=>({...Be,scope:"user"})),Pe=[...e!=null&&e.isAdmin?So(Array.isArray(be.globalEnv)?be.globalEnv:[],"global").map(Be=>({...Be,scope:"global"})):[],...Q];tt.current=JSON.stringify(Pe),x(Pe)}catch(ee){x([]),C(String(ee.message||ee))}finally{Lt.current=!0}},[e==null?void 0:e.isAdmin]),tn=m.useCallback(async()=>{if(e!=null&&e.isAdmin){Y(!0),V("");try{const ee=await fetch("/api/feedback"),be=await ee.json().catch(()=>({}));if(!ee.ok)throw new Error(typeof be.error=="string"?be.error:"HTTP "+ee.status);H(Array.isArray(be.feedback)?be.feedback:[])}catch(ee){V(String(ee.message||ee))}finally{Y(!1)}}},[e==null?void 0:e.isAdmin]),nn=m.useCallback(async()=>{if(e!=null&&e.isAdmin){pe(!0),et("");try{const ee=await fetch("/api/admin/user-allowlist"),be=await ee.json().catch(()=>({}));if(!ee.ok)throw new Error(typeof be.error=="string"?be.error:"HTTP "+ee.status);const Q=be.allowlist&&typeof be.allowlist=="object"?be.allowlist:{};ue(Array.isArray(Q.fileUsers)?Q.fileUsers.map(String):[]),we(Array.isArray(Q.envUsers)?Q.envUsers.map(String):[]),ye(typeof Q.path=="string"?Q.path:"")}catch(ee){et(String(ee.message||ee))}finally{pe(!1)}}},[e==null?void 0:e.isAdmin]),tr=m.useCallback(async ee=>{if(e!=null&&e.isAdmin){He(!0),et("");try{const be=await fetch("/api/admin/user-allowlist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({users:ee})}),Q=await be.json().catch(()=>({}));if(!be.ok)throw new Error(typeof Q.error=="string"?Q.error:"HTTP "+be.status);const oe=Q.allowlist&&typeof Q.allowlist=="object"?Q.allowlist:{};ue(Array.isArray(oe.fileUsers)?oe.fileUsers.map(String):[]),we(Array.isArray(oe.envUsers)?oe.envUsers.map(String):[]),ye(typeof oe.path=="string"?oe.path:"")}catch(be){et(String(be.message||be))}finally{He(!1)}}},[e==null?void 0:e.isAdmin]),Fn=m.useCallback(async()=>{if(e!=null&&e.isAdmin){dn(!0),Fe("");try{const ee=await fetch("/api/admin/storage-config"),be=await ee.json().catch(()=>({}));if(!ee.ok)throw new Error(typeof be.error=="string"?be.error:"HTTP "+ee.status);const Q=be.config&&typeof be.config=="object"?be.config:{};Ht(Q),Ae(typeof Q.dataRoot=="string"?Q.dataRoot:""),qt(typeof Q.skillsRoot=="string"?Q.skillsRoot:"")}catch(ee){Fe(String(ee.message||ee))}finally{dn(!1)}}},[e==null?void 0:e.isAdmin]),Vn=m.useCallback(async()=>{if(e!=null&&e.isAdmin){me(!0),Fe("");try{const ee=await fetch("/api/admin/storage-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dataRoot:ut.trim(),skillsRoot:Qe.trim(),migrateLegacySkills:!0})}),be=await ee.json().catch(()=>({}));if(!ee.ok)throw new Error(typeof be.error=="string"?be.error:"HTTP "+ee.status);const Q=be.config&&typeof be.config=="object"?be.config:{};Ht(Q),Ae(typeof Q.dataRoot=="string"?Q.dataRoot:""),qt(typeof Q.skillsRoot=="string"?Q.skillsRoot:"")}catch(ee){Fe(String(ee.message||ee))}finally{me(!1)}}},[e==null?void 0:e.isAdmin,ut,Qe]),gn=m.useCallback(async ee=>{const be=So(ee),Q=be.filter(Pe=>Pe.scope!=="global"),oe=be.filter(Pe=>Pe.scope==="global");E(!0),C("");try{const Pe=await fetch("/api/user-env",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:wN(Q),...e!=null&&e.isAdmin?{globalEnv:wN(oe)}:{}})}),Be=await Pe.json().catch(()=>({}));if(!Pe.ok)throw new Error(typeof Be.error=="string"?Be.error:"HTTP "+Pe.status);const jt=So(Array.isArray(Be.env)?Be.env:[],"user").map(Cn=>({...Cn,scope:"user"})),nr=[...e!=null&&e.isAdmin?So(Array.isArray(Be.globalEnv)?Be.globalEnv:[],"global").map(Cn=>({...Cn,scope:"global"})):[],...jt];tt.current=JSON.stringify(nr),x(nr)}catch(Pe){C(String(Pe.message||Pe))}finally{E(!1)}},[e==null?void 0:e.isAdmin]),Yt=m.useCallback(async()=>{f(""),h(!0);try{const ee=await fetch("/api/update-model-lists",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:T.trim()})}),be=await ee.json().catch(()=>({}));if(!ee.ok)throw new Error(typeof be.error=="string"?be.error:"HTTP "+ee.status);u(Gm(be.modelLists))}catch(ee){f(String(ee.message||ee))}finally{h(!1)}},[T]);m.useEffect(()=>{fn(),kt(),Nt(),e!=null&&e.isAdmin&&(tn(),nn(),Fn()),(async()=>{try{const ee=await fetch("/api/agentflow-config");if(ee.ok){const be=await ee.json(),Q=typeof be.opencodeProvider=="string"?be.opencodeProvider:"";O(Q),Ve.current=Q;try{localStorage.setItem(Vy,Q)}catch{}}else{const be=bN();O(be),Ve.current=be}}catch{const ee=bN();O(ee),Ve.current=ee}finally{Et.current=!0}})()},[e==null?void 0:e.isAdmin,fn,tn,kt,Fn,nn,Nt]),m.useEffect(()=>{if(!Lt.current||JSON.stringify(So(b))===tt.current)return;const be=setTimeout(()=>{gn(b)},350);return()=>clearTimeout(be)},[b,gn]),m.useEffect(()=>{if(!Et.current)return;const ee=T.trim();if(ee===Ve.current)return;const be=setTimeout(()=>{(async()=>{w(!0),g("");try{const Q=await fetch("/api/agentflow-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:ee})}),oe=await Q.json().catch(()=>({}));if(!Q.ok)throw new Error(typeof oe.error=="string"?oe.error:"HTTP "+Q.status);Ve.current=ee;try{localStorage.setItem(Vy,ee)}catch{}oe.modelLists&&u(Gm(oe.modelLists))}catch(Q){g(String(Q.message||Q))}finally{w(!1)}})()},450);return()=>clearTimeout(be)},[T]);const kn=c.cursor.length>0,yn=c.opencode.length>0,Sn=c.claudeCode.length>0,Nn=Z.length>0||le.length>0,Kn=m.useCallback(()=>{var ee;s&&((ee=navigator.clipboard)==null||ee.writeText(s))},[s]),ns=m.useCallback(()=>{const ee=A.trim(),be=W;if(ee){if(!RQ(ee)){C(t("settings:env.invalidKey"));return}x(Q=>[{id:eA(),key:ee,value:be,scope:e!=null&&e.isAdmin&&R?"global":"user"},...Q]),D(""),F("")}},[e==null?void 0:e.isAdmin,R,A,W,t]),Un=m.useCallback(ee=>{x(be=>be.filter(Q=>Q.id!==ee))},[]),fr=m.useCallback((ee,be)=>{x(Q=>Q.map(oe=>oe.id===ee?{...oe,...be}:oe))},[]),Wr=m.useCallback(ee=>{L(be=>{const Q=new Set(be);return Q.has(ee)?Q.delete(ee):Q.add(ee),Q})},[]),Vr=m.useCallback(()=>{const ee=te.trim();if(!ee)return;if(!/^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(ee)){et("用户名须以字母开头,仅可使用字母、数字、下划线与连字符,最多 64 字符");return}if(new Set(Z.map(Q=>String(Q||"").trim().toLowerCase())).has(ee.toLowerCase())){ie("");return}ie(""),tr([...Z,ee])},[te,Z,tr]),jr=m.useCallback(ee=>{const be=String(ee||"").trim().toLowerCase();be&&tr(Z.filter(Q=>String(Q||"").trim().toLowerCase()!==be))},[Z,tr]),rs=m.useCallback(ee=>{const be=ee.target.value;TQ(be)},[]),an=ee=>{const be=vN(ee,r);return be?t("settings:cursor.modelList.fetchedAt",{time:be}):t("settings:cursor.modelList.never")},Cr=ee=>vN(ee,r)||String(ee||"");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":t("settings:title"),children:[a.jsx("span",{className:"af-settings-crumb-muted",children:t("settings:crumb.engine")}),a.jsx("span",{className:"af-settings-crumb-sep","aria-hidden":!0,children:"/"}),a.jsx("span",{className:"af-settings-crumb-active",children:t("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:[t("common:app.name")," ",t("settings:title")]}),a.jsx("p",{className:"af-settings-lead",children:t("settings:workspace.description")}),o?a.jsx("p",{className:"af-err af-settings-api-hint",children:o}):null,p?a.jsx("p",{className:"af-err af-settings-api-hint",children:p}):null,S?a.jsx("p",{className:"af-err af-settings-api-hint",children:S}):null,Oe?a.jsx("p",{className:"af-err af-settings-api-hint",children:Oe}):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:t("settings:workspace.title")})]}),a.jsx("label",{className:"af-set-label",htmlFor:"af-workspace-path",children:t("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:s,placeholder:t("common:loading")}),a.jsx("button",{type:"button",className:"af-set-input-suffix",onClick:Kn,"aria-label":t("settings:workspace.copyPath"),disabled:!s,children:a.jsx("span",{className:"material-symbols-outlined",children:"content_copy"})})]}),a.jsx("p",{className:"af-set-hint",children:t("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"+(kn?" af-set-badge--ok":" af-set-badge--muted"),children:t(kn?"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:kn?"check_circle":"hourglass_empty"})}),a.jsxs("div",{children:[a.jsx("p",{className:"af-set-cli-title",children:t(kn?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),a.jsx("p",{className:"af-set-cli-mono",children:kn?t("settings:cursor.modelList.count",{count:c.cursor.length})+" · "+an(c.cursorFetchedAt):t("settings:cursor.modelList.refresh")})]})]}),kn?a.jsx("pre",{className:"af-set-model-preview","aria-label":t("settings:cursor.modelPreviewLabel"),children:c.cursor.join(`
216
- `)}):null,a.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>Yt(),disabled:d,children:t(d?"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"+(yn?" af-set-badge--ok":" af-set-badge--err"),children:t(yn?"settings:opencode.status.ready":"settings:opencode.status.notFound")})]}),a.jsx("p",{className:"af-set-p",children:t("settings:opencode.description")}),a.jsxs("div",{children:[a.jsx("label",{className:"af-set-label-sm",htmlFor:"af-opencode-plan",children:t("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:T,onChange:ee=>O(ee.target.value),placeholder:t("settings:opencode.providerPlaceholder"),autoComplete:"off"}),y?a.jsx("p",{className:"af-set-hint af-set-hint--inline","aria-live":"polite",children:t("settings:opencode.saving")}):null,k?a.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",role:"alert",children:k}):null]}),yn?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"af-set-cli-mono af-set-cli-mono--block",children:t("settings:cursor.modelList.count",{count:c.opencode.length})+" · "+an(c.opencodeFetchedAt)}),a.jsx("pre",{className:"af-set-model-preview","aria-label":t("settings:opencode.modelPreviewLabel"),children:c.opencode.join(`
217
- `)})]}):null,a.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>Yt(),disabled:d,children:t(d?"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:t("settings:claudeCode.title")}),a.jsx("span",{className:"af-set-badge"+(Sn?" af-set-badge--ok":" af-set-badge--err"),children:t(Sn?"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:Sn?"check_circle":"hourglass_empty"})}),a.jsxs("div",{children:[a.jsx("p",{className:"af-set-cli-title",children:t(Sn?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),a.jsx("p",{className:"af-set-cli-mono",children:Sn?t("settings:cursor.modelList.count",{count:c.claudeCode.length})+" · "+an(c.claudeCodeFetchedAt):t("settings:cursor.modelList.refresh")})]})]}),a.jsx("p",{className:"af-set-p",children:t("settings:claudeCode.description")}),Sn?a.jsx("pre",{className:"af-set-model-preview","aria-label":t("settings:claudeCode.modelPreviewLabel"),children:c.claudeCode.join(`
218
- `)}):null,a.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>Yt(),disabled:d,children:t(d?"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:t("settings:env.title")})]}),a.jsx("span",{className:"af-set-env-note",children:j?t("settings:env.saving"):e!=null&&e.isAdmin?t("settings:env.noteAdmin"):t("settings:env.note")})]}),a.jsxs("div",{className:"af-set-env-rows"+(e!=null&&e.isAdmin?" af-set-env-rows--admin":""),children:[a.jsxs("div",{className:"af-set-env-row af-set-env-row--header","aria-hidden":!0,children:[a.jsx("span",{children:t("settings:env.key")}),e!=null&&e.isAdmin?a.jsx("span",{children:t("settings:env.scope")}):null,a.jsx("span",{children:t("settings:env.value")}),a.jsx("span",{})]}),a.jsxs("div",{className:"af-set-env-row af-set-env-row--draft"+(e!=null&&e.isAdmin?" af-set-env-row--scoped":""),children:[a.jsx("div",{className:"af-set-env-cell",children:a.jsx("input",{className:"af-set-env-inline af-set-env-inline--key",placeholder:"KEY_NAME",value:A,onChange:ee=>D(ee.target.value),"aria-label":t("settings:env.newKey")})}),e!=null&&e.isAdmin?a.jsx("div",{className:"af-set-env-cell af-set-env-cell--scope",children:a.jsxs("div",{className:"af-set-env-scope-switch",role:"group","aria-label":t("settings:env.scope"),children:[a.jsx("button",{type:"button",className:R?"":"is-active",onClick:()=>$(!1),children:t("settings:env.personal")}),a.jsx("button",{type:"button",className:R?"is-active":"",onClick:()=>$(!0),children:t("settings:env.global")})]})}):null,a.jsx("div",{className:"af-set-env-cell af-set-env-cell--grow af-set-env-cell--value",children:a.jsx("input",{className:"af-set-env-inline af-set-env-inline--value",type:"password",placeholder:t("settings:env.newValue"),value:W,onChange:ee=>F(ee.target.value),"aria-label":t("settings:env.newValue")})}),a.jsx("div",{className:"af-set-env-actions",children:a.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:ns,disabled:!A.trim(),children:[a.jsx("span",{className:"material-symbols-outlined",children:"add"}),t("settings:env.add")]})})]}),b.map(ee=>a.jsxs("div",{className:"af-set-env-row"+(e!=null&&e.isAdmin?" af-set-env-row--scoped":""),children:[a.jsx("div",{className:"af-set-env-cell",children:a.jsx("input",{className:"af-set-env-inline af-set-env-inline--key",value:ee.key,onChange:be=>fr(ee.id,{key:be.target.value}),"aria-label":t("settings:env.key"),spellCheck:!1})}),e!=null&&e.isAdmin?a.jsx("div",{className:"af-set-env-cell af-set-env-cell--scope",children:a.jsxs("div",{className:"af-set-env-scope-switch",role:"group","aria-label":t("settings:env.scope"),children:[a.jsx("button",{type:"button",className:ee.scope!=="global"?"is-active":"",onClick:()=>fr(ee.id,{scope:"user"}),children:t("settings:env.personal")}),a.jsx("button",{type:"button",className:ee.scope==="global"?"is-active":"",onClick:()=>fr(ee.id,{scope:"global"}),children:t("settings:env.global")})]})}):null,a.jsxs("div",{className:"af-set-env-cell af-set-env-cell--grow af-set-env-cell--value",children:[a.jsx("input",{className:"af-set-env-inline af-set-env-inline--value",type:P.has(ee.id)?"text":"password",value:ee.value,onChange:be=>fr(ee.id,{value:be.target.value}),placeholder:MQ(ee.value)||t("settings:env.newValue"),"aria-label":t("settings:env.value")}),a.jsx("button",{type:"button",className:"af-set-env-value-toggle",onClick:()=>Wr(ee.id),"aria-label":P.has(ee.id)?"Hide value":"Show value",children:a.jsx("span",{className:"material-symbols-outlined",children:P.has(ee.id)?"visibility_off":"visibility"})})]}),a.jsx("div",{className:"af-set-env-actions",children:a.jsx("button",{type:"button",className:"af-set-env-del","aria-label":t("settings:env.delete",{key:ee.key}),onClick:()=>Un(ee.id),children:a.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})})]},ee.id))]})]}),e!=null&&e.isAdmin?a.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--low",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:"hard_drive_2"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"af-set-h2",children:"AgentFlow Data Root"}),a.jsx("p",{className:"af-set-card-subtitle",children:"配置整个 AgentFlow 数据目录的位置,保存时会迁移当前数据。"})]})]}),a.jsx("span",{className:"af-set-badge"+(Te!=null&&Te.envLocked?" af-set-badge--err":" af-set-badge--ok"),children:Te!=null&&Te.envLocked?"Env locked":"Configurable"}),a.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:()=>void Fn(),disabled:st||ne,children:st?"刷新中...":"刷新"})]}),Oe?a.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:Oe}):null,a.jsx("label",{className:"af-set-label-sm",htmlFor:"af-agentflow-data-root",children:"Data Root"}),a.jsxs("div",{className:"af-set-input-wrap",children:[a.jsx("input",{id:"af-agentflow-data-root",className:"af-set-input af-set-input--mono",type:"text",value:ut,onChange:ee=>Ae(ee.target.value),placeholder:"/data1/services/mengmai/agentflow",autoComplete:"off",disabled:!!(Te!=null&&Te.envLocked)||ne}),a.jsx("button",{type:"button",className:"af-set-input-suffix",onClick:()=>void Vn(),"aria-label":"保存 AgentFlow Data Root",disabled:ne||!!(Te!=null&&Te.envLocked),children:a.jsx("span",{className:"material-symbols-outlined",children:ne?"hourglass_empty":"save"})})]}),a.jsxs("p",{className:"af-set-hint",children:["当前目录:",a.jsx("code",{children:(Te==null?void 0:Te.dataRoot)||ut||"-"}),Te!=null&&Te.configPath?a.jsxs(a.Fragment,{children:[";配置文件:",a.jsx("code",{children:Te.configPath})]}):null]}),a.jsxs("p",{className:"af-set-hint",children:["这个目录包含 ",a.jsx("code",{children:"users/"}),"、",a.jsx("code",{children:"pipelines/"}),"、",a.jsx("code",{children:"runBuild/"}),"、",a.jsx("code",{children:"auth/"})," 和 admin 配置。 保存到新绝对路径时会复制旧目录内容;旧目录不会自动删除。",Te!=null&&Te.envLocked?" 当前设置了 AGENTFLOW_HOME,需要改环境变量才能生效。":""]}),a.jsx("label",{className:"af-set-label-sm",htmlFor:"af-agentflow-skills-root",children:"Skills Root"}),a.jsxs("div",{className:"af-set-input-wrap",children:[a.jsx("input",{id:"af-agentflow-skills-root",className:"af-set-input af-set-input--mono",type:"text",value:Qe,onChange:ee=>qt(ee.target.value),placeholder:"/data1/services/mengmai/agentflow/skills",autoComplete:"off",disabled:!!(Te!=null&&Te.skillsEnvLocked)||ne}),a.jsx("button",{type:"button",className:"af-set-input-suffix",onClick:()=>void Vn(),"aria-label":"保存 AgentFlow Skills Root",disabled:ne||!!(Te!=null&&Te.skillsEnvLocked),children:a.jsx("span",{className:"material-symbols-outlined",children:ne?"hourglass_empty":"save"})})]}),a.jsxs("p",{className:"af-set-hint",children:["当前 Skills:",a.jsx("code",{children:(Te==null?void 0:Te.skillsRoot)||Qe||"-"}),Te!=null&&Te.legacySkillsRootExists?a.jsxs(a.Fragment,{children:[";保存时会补迁移旧目录 ",a.jsx("code",{children:Te.legacySkillsRoot})," 中缺失的 skills。"]}):null]}),a.jsxs("p",{className:"af-set-hint",children:["SkillHub 新安装、更新和卸载都作用于 Skills Root;普通用户只通过 Workspace 的 Load Skills 使用。",Te!=null&&Te.skillsEnvLocked?" 当前设置了 AGENTFLOW_SKILLS_ROOT,需要改环境变量才能生效。":""]})]}):null,e!=null&&e.isAdmin?a.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--allowlist",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:"manage_accounts"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"af-set-h2",children:t("settings:allowlist.title")}),a.jsx("p",{className:"af-set-card-subtitle",children:t("settings:allowlist.description")})]})]}),a.jsx("span",{className:"af-set-badge"+(Nn?" af-set-badge--ok":" af-set-badge--muted"),children:t(Nn?"settings:allowlist.enabled":"settings:allowlist.open")}),a.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:()=>void nn(),disabled:ce,children:t(ce?"settings:allowlist.refreshing":"common:common.refresh")})]}),Ie?a.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:Ie}):null,re?a.jsxs("p",{className:"af-set-hint af-set-hint--inline",children:[t("settings:allowlist.file"),":",a.jsx("code",{children:re})]}):null,a.jsxs("div",{className:"af-allowlist-grid",children:[a.jsxs("div",{className:"af-allowlist-main",children:[a.jsxs("div",{className:"af-allowlist-head",children:[a.jsx("span",{children:t("settings:allowlist.fileList")}),a.jsx("span",{children:De?t("settings:allowlist.saving"):t("settings:allowlist.userCount",{count:Z.length})})]}),a.jsx("div",{className:"af-allowlist-list",children:Z.length>0?Z.map(ee=>a.jsxs("div",{className:"af-allowlist-row",children:[a.jsx("span",{className:"af-allowlist-name",children:ee}),a.jsx("button",{type:"button",className:"af-set-env-del",onClick:()=>jr(ee),"aria-label":t("settings:allowlist.remove",{username:ee}),disabled:De,children:a.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})]},ee)):a.jsx("div",{className:"af-allowlist-empty",children:t("settings:allowlist.emptyFile")})}),a.jsxs("div",{className:"af-allowlist-add",children:[a.jsx("input",{className:"af-set-input af-set-input--sm af-set-input--mono",value:te,onChange:ee=>ie(ee.target.value),onKeyDown:ee=>{ee.key==="Enter"&&Vr()},placeholder:"username",autoComplete:"off"}),a.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:Vr,disabled:De||!te.trim(),children:[a.jsx("span",{className:"material-symbols-outlined",children:"add"}),t("settings:allowlist.add")]})]})]}),a.jsxs("div",{className:"af-allowlist-side",children:[a.jsxs("div",{className:"af-allowlist-head",children:[a.jsx("span",{children:t("settings:allowlist.envList")}),a.jsx("span",{children:t("settings:allowlist.readonly")})]}),a.jsx("div",{className:"af-allowlist-env-list",children:le.length>0?le.map(ee=>a.jsx("code",{children:ee},ee)):a.jsx("span",{children:t("settings:allowlist.emptyEnv")})}),a.jsx("p",{className:"af-set-hint af-set-hint--inline",children:t("settings:allowlist.unionHint")})]})]})]}):null,e!=null&&e.isAdmin?a.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--feedback",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:"rate_review"})}),a.jsx("h2",{className:"af-set-h2",children:"意见反馈"})]}),a.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:()=>void tn(),disabled:_,children:_?"刷新中...":"刷新"})]}),U?a.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:U}):null,a.jsx("div",{className:"af-feedback-list",children:I.length>0?I.map(ee=>a.jsxs("article",{className:"af-feedback-item",children:[a.jsxs("header",{className:"af-feedback-item__head",children:[a.jsxs("div",{children:[a.jsx("h3",{children:ee.title||"未命名反馈"}),a.jsxs("p",{children:[a.jsx("span",{children:ee.username||ee.userId||"unknown"}),a.jsx("span",{children:Cr(ee.createdAt)})]})]}),ee.contact?a.jsx("span",{className:"af-feedback-item__contact",children:ee.contact}):null]}),a.jsx("p",{className:"af-feedback-item__content",children:ee.content}),ee.pageUrl?a.jsx("code",{className:"af-feedback-item__url",children:ee.pageUrl}):null]},ee.id)):a.jsx("div",{className:"af-feedback-empty",children:_?"正在加载反馈...":"暂无反馈"})})]}):null]}),a.jsxs("aside",{className:"af-settings-rail","aria-label":t("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:t("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:t(!o&&!p?"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:t("settings:system.cursorModels")}),a.jsx("span",{children:c.cursor.length})]}),a.jsx("div",{className:"af-set-meter-bar",children:a.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,c.cursor.length>0?12+c.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:t("settings:system.opencodeModels")}),a.jsx("span",{children:c.opencode.length})]}),a.jsx("div",{className:"af-set-meter-bar",children:a.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,c.opencode.length>0?12+c.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:t("settings:system.claudeCodeModels")}),a.jsx("span",{children:c.claudeCode.length})]}),a.jsx("div",{className:"af-set-meter-bar",children:a.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,c.claudeCode.length>0?12+c.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:t("settings:language.title")}),a.jsxs("div",{className:"af-set-language-selector",children:[a.jsx("select",{className:"af-set-input af-set-input--sm",value:r,onChange:rs,"aria-label":t("settings:language.description"),children:IQ.map(ee=>a.jsxs("option",{value:ee.code,children:[ee.flag," ",ee.name]},ee.code))}),a.jsx("p",{className:"af-set-hint",children:t("settings:language.description")})]})]})]})]})]})})]})}function hr(e){return new Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(Math.max(0,Number(e||0)))}function rf(e){return`${Math.round(Math.max(0,Math.min(1,Number(e||0)))*100)}%`}function Xm(e){const t=Math.max(0,Number(e||0));if(!t)return"-";const n=Math.round(t/1e3);if(n<60)return`${n}s`;const r=Math.round(n/60);if(r<60)return`${r}m`;const s=Math.round(r/60);return s<48?`${s}h`:`${Math.round(s/24)}d`}function $Q(e){const t=String(e||"");return t.includes("-")?t.slice(5):t}function Jm(e){if(!e)return"无运行记录";try{return new Intl.DateTimeFormat(void 0,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(Number(e)))}catch{return String(e)}}function OQ(e){const t=String(e||"").trim();return t?t.length>18?t.slice(0,8)+"..."+t.slice(-6):t:"-"}function DQ(e){const t=String(e||"unknown");return t==="success"?"成功":t==="failed"?"失败":t==="running"?"运行中":t==="stopped"?"已停止":t==="interrupted"?"中断":"未知"}function FQ({authUser:e}){const[t,n]=m.useState(null),[r,s]=m.useState(!1),[i,o]=m.useState(""),l=m.useCallback(async()=>{if(e!=null&&e.isAdmin){s(!0),o("");try{const h=await fetch("/api/admin/usage-dashboard"),y=await h.json().catch(()=>({}));if(!h.ok)throw new Error(typeof y.error=="string"?y.error:"HTTP "+h.status);n(y)}catch(h){n(null),o(String((h==null?void 0:h.message)||h))}finally{s(!1)}}},[e==null?void 0:e.isAdmin]);m.useEffect(()=>{l()},[l]);const c=Array.isArray(t==null?void 0:t.dailyTrend)?t.dailyTrend:[],u=m.useMemo(()=>{const w={top:20,right:24,bottom:42,left:42},k=980-w.left-w.right,g=250-w.top-w.bottom,b=c.length>0?c:[],x=Math.max(1,...b.map(D=>Number(D.runs||0))),S=Math.max(1,...b.flatMap(D=>[Number(D.users||0),Number(D.pipelines||0)])),C=D=>w.left+(b.length<=1?k/2:D*k/(b.length-1)),j=D=>w.top+g-Math.max(0,Number(D||0))/x*g,E=D=>w.top+g-Math.max(0,Number(D||0))/S*g,A=D=>b.map((W,F)=>`${F===0?"M":"L"} ${C(F)} ${E(W[D])}`).join(" ");return{width:980,height:250,margin:w,innerHeight:g,rows:b,x:C,yRuns:j,yLine:E,lineUsers:A("users"),linePipelines:A("pipelines"),barWidth:Math.min(34,Math.max(12,k/Math.max(1,b.length)*.44))}},[c]),p=(t==null?void 0:t.usage)||{},f=(t==null?void 0:t.totals)||{},d=Array.isArray(t==null?void 0:t.recentRuns)?t.recentRuns:[];return e!=null&&e.isAdmin?a.jsxs("main",{className:"af-admin-usage-page",children:[a.jsxs("section",{className:"af-admin-usage-hero",children:[a.jsxs("div",{children:[a.jsx("p",{className:"af-admin-usage-eyebrow",children:"Admin / Usage"}),a.jsx("h1",{children:"管理看板"}),a.jsx("p",{children:"重点观察使用率、每日趋势、成功率与各用户流水线活跃度。"})]}),a.jsxs("button",{type:"button",onClick:()=>void l(),disabled:r,children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"refresh"}),r?"刷新中":"刷新"]})]}),i?a.jsx("div",{className:"af-project-admin-usage__error",children:i}):null,a.jsxs("section",{className:"af-admin-usage-rate-grid","aria-label":"使用率",children:[a.jsxs("div",{children:[a.jsx("span",{children:"7日活跃用户率"}),a.jsx("strong",{children:rf(p.activeUserRate)}),a.jsxs("em",{children:[hr(p.activeUsers)," / ",hr(f.users)," users"]})]}),a.jsxs("div",{children:[a.jsx("span",{children:"7日流水线使用率"}),a.jsx("strong",{children:rf(p.activePipelineRate)}),a.jsxs("em",{children:[hr(p.activePipelines)," / ",hr(f.activePipelines)," active"]})]}),a.jsxs("div",{children:[a.jsx("span",{children:"7日 Run"}),a.jsx("strong",{children:hr(p.runs)}),a.jsxs("em",{children:[hr(p.avgRunsPerDay)," / day"]})]}),a.jsxs("div",{children:[a.jsx("span",{children:"7日成功率"}),a.jsx("strong",{children:rf(p.successRate)}),a.jsxs("em",{children:["失败率 ",rf(p.failureRate)," · avg ",Xm(p.avgDurationMs)]})]})]}),a.jsxs("section",{className:"af-project-admin-usage af-admin-usage-trend",children:[a.jsx("div",{className:"af-project-admin-usage__head",children:a.jsxs("div",{children:[a.jsx("strong",{children:"每日趋势"}),a.jsx("span",{children:"上方看趋势,下方看最近 50 次具体运行。"})]})}),a.jsxs("div",{className:"af-admin-usage-chart",role:"img","aria-label":"最近 14 天运行趋势",children:[a.jsxs("div",{className:"af-admin-usage-chart__legend",children:[a.jsxs("span",{children:[a.jsx("i",{className:"af-admin-usage-chart__swatch af-admin-usage-chart__swatch--runs"}),"Runs"]}),a.jsxs("span",{children:[a.jsx("i",{className:"af-admin-usage-chart__swatch af-admin-usage-chart__swatch--users"}),"活跃用户"]}),a.jsxs("span",{children:[a.jsx("i",{className:"af-admin-usage-chart__swatch af-admin-usage-chart__swatch--pipelines"}),"活跃流水线"]})]}),a.jsx("div",{className:"af-admin-usage-chart__canvas",children:a.jsxs("svg",{viewBox:`0 0 ${u.width} ${u.height}`,preserveAspectRatio:"xMidYMid meet",children:[a.jsx("line",{className:"af-admin-usage-chart__axis",x1:u.margin.left,y1:u.margin.top+u.innerHeight,x2:u.width-u.margin.right,y2:u.margin.top+u.innerHeight}),[.25,.5,.75,1].map(h=>a.jsx("line",{className:"af-admin-usage-chart__grid",x1:u.margin.left,y1:u.margin.top+u.innerHeight-u.innerHeight*h,x2:u.width-u.margin.right,y2:u.margin.top+u.innerHeight-u.innerHeight*h},h)),u.rows.map((h,y)=>{const w=u.x(y),k=u.yRuns(h.runs),g=u.margin.top+u.innerHeight,b=Math.max(2,g-k);return a.jsxs("g",{children:[a.jsx("rect",{className:"af-admin-usage-chart__run-bar",x:w-u.barWidth/2,y:g-b,width:u.barWidth,height:b,rx:"5",children:a.jsx("title",{children:`${h.date}: ${h.runs} runs`})}),a.jsx("text",{className:"af-admin-usage-chart__value",x:w,y:g+22,children:hr(h.runs)}),a.jsx("text",{className:"af-admin-usage-chart__date",x:w,y:g+42,children:$Q(h.date)})]},h.date)}),u.rows.length>0?a.jsxs(a.Fragment,{children:[a.jsx("path",{className:"af-admin-usage-chart__line af-admin-usage-chart__line--users",d:u.lineUsers}),a.jsx("path",{className:"af-admin-usage-chart__line af-admin-usage-chart__line--pipelines",d:u.linePipelines}),u.rows.map((h,y)=>{const w=u.x(y);return a.jsxs("g",{children:[a.jsx("circle",{className:"af-admin-usage-chart__point af-admin-usage-chart__point--users",cx:w,cy:u.yLine(h.users),r:"3.5"}),a.jsx("circle",{className:"af-admin-usage-chart__point af-admin-usage-chart__point--pipelines",cx:w,cy:u.yLine(h.pipelines),r:"3.5"})]},`${h.date}-points`)})]}):null]})})]}),a.jsx("div",{className:"af-project-admin-usage__table-wrap",children:a.jsxs("table",{className:"af-project-admin-usage__table af-admin-usage-table--recent",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"用户"}),a.jsx("th",{children:"流水线"}),a.jsx("th",{children:"运行时间"}),a.jsx("th",{children:"状态"}),a.jsx("th",{children:"耗时"}),a.jsx("th",{children:"Run ID"})]})}),a.jsx("tbody",{children:d.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:6,children:"暂无运行明细"})}):d.map(h=>a.jsxs("tr",{children:[a.jsxs("td",{children:[a.jsx("strong",{children:h.username||h.userId||"-"}),a.jsx("span",{children:h.userId||"-"})]}),a.jsxs("td",{children:[a.jsx("strong",{children:h.flowId||"-"}),a.jsxs("span",{children:[h.runType==="workspace"?"Workspace Run":"Pipeline"," · ",h.flowSource||"user"]})]}),a.jsxs("td",{children:[a.jsx("strong",{children:Jm(h.at)}),h.endedAt?a.jsxs("span",{children:["结束 ",Jm(h.endedAt)]}):a.jsx("span",{children:"未结束"})]}),a.jsx("td",{children:a.jsx("span",{className:"af-project-admin-usage__chips",children:a.jsx("em",{children:DQ(h.status)})})}),a.jsx("td",{children:Xm(h.durationMs)}),a.jsx("td",{children:a.jsx("code",{className:"af-admin-usage-run-id",children:OQ(h.runId)})})]},`${h.userId}:${h.flowSource}:${h.flowId}:${h.runId}:${h.at}`))})]})})]}),a.jsxs("section",{className:"af-project-admin-usage",children:[a.jsx("div",{className:"af-project-admin-usage__head",children:a.jsxs("div",{children:[a.jsx("strong",{children:"用户使用明细"}),a.jsx("span",{children:"按用户汇总 Pipeline 数、Run 次数和最近运行。"})]})}),a.jsx("div",{className:"af-project-admin-usage__table-wrap",children:a.jsxs("table",{className:"af-project-admin-usage__table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"User"}),a.jsx("th",{children:"Pipeline"}),a.jsx("th",{children:"Runs"}),a.jsx("th",{children:"状态"}),a.jsx("th",{children:"最近运行"})]})}),a.jsx("tbody",{children:r&&!t?a.jsx("tr",{children:a.jsx("td",{colSpan:5,children:"正在加载..."})}):((t==null?void 0:t.users)||[]).length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:5,children:"暂无用户数据"})}):((t==null?void 0:t.users)||[]).map(h=>{var y,w,k,g,b,x,S,C,j,E,A;return a.jsxs("tr",{children:[a.jsxs("td",{children:[a.jsx("strong",{children:h.username||h.userId}),a.jsxs("span",{children:[h.userId,h.isAdmin?" · admin":""]})]}),a.jsxs("td",{children:[a.jsx("strong",{children:hr((y=h.pipelines)==null?void 0:y.total)}),a.jsxs("span",{children:[hr((w=h.pipelines)==null?void 0:w.active)," active / ",hr((k=h.pipelines)==null?void 0:k.archived)," archived"]})]}),a.jsxs("td",{children:[a.jsx("strong",{children:hr((g=h.runs)==null?void 0:g.total)}),a.jsxs("span",{children:["avg ",Xm((b=h.runs)==null?void 0:b.avgDurationMs)]})]}),a.jsx("td",{children:a.jsxs("span",{className:"af-project-admin-usage__chips",children:[a.jsxs("em",{children:["成功 ",hr((x=h.runs)==null?void 0:x.success)]}),a.jsxs("em",{children:["失败 ",hr((S=h.runs)==null?void 0:S.failed)]}),a.jsxs("em",{children:["运行中 ",hr((C=h.runs)==null?void 0:C.running)]})]})}),a.jsx("td",{children:(j=h.runs)!=null&&j.lastRunAt?a.jsxs(a.Fragment,{children:[a.jsx("strong",{children:((E=h.runs)==null?void 0:E.lastRunFlowId)||"-"}),a.jsxs("span",{children:[((A=h.runs)==null?void 0:A.lastRunStatus)||"unknown"," · ",Jm(h.runs.lastRunAt)]})]}):a.jsx("span",{children:"无运行记录"})})]},h.userId)})})]})})]})]}):a.jsx("main",{className:"af-admin-usage-page",children:a.jsx("section",{className:"af-project-admin-usage",children:a.jsx("div",{className:"af-project-admin-usage__head",children:a.jsxs("div",{children:[a.jsx("strong",{children:"管理看板"}),a.jsx("span",{children:"需要管理员权限。"})]})})})})}function zQ(){const{navigate:e}=Js(),[t,n]=m.useState(""),[r,s]=m.useState(""),[i,o]=m.useState(!1),[l,c]=m.useState(""),[u,p]=m.useState(!1),f=async d=>{if(d.preventDefault(),!i){o(!0),c("");try{const h=await fetch("/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:t,content:r,pageUrl:window.location.href})}),y=await h.json().catch(()=>({}));if(!h.ok)throw new Error(y.error||"提交失败");p(!0),n(""),s("")}catch(h){c(String(h.message||h))}finally{o(!1)}}};return a.jsx("main",{className:"af-feedback-page",children:a.jsxs("section",{className:"af-feedback-panel",children:[a.jsxs("div",{className:"af-feedback-head",children:[a.jsxs("div",{children:[a.jsx("span",{className:"af-feedback-eyebrow",children:"Feedback"}),a.jsx("h1",{children:"意见反馈"}),a.jsx("p",{children:"提交使用中遇到的问题、改进建议或功能需求,管理员会在设置页统一查看。"})]}),a.jsxs("button",{type:"button",className:"af-feedback-back",onClick:()=>e("/projects"),children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_back"}),"返回"]})]}),u?a.jsxs("div",{className:"af-feedback-success",role:"status",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"check_circle"}),a.jsxs("div",{children:[a.jsx("strong",{children:"已提交"}),a.jsx("span",{children:"感谢反馈,管理员可以在设置页查看这条记录。"})]})]}):null,a.jsxs("form",{className:"af-feedback-form",onSubmit:f,children:[a.jsxs("label",{className:"af-feedback-field",children:[a.jsx("span",{children:"标题"}),a.jsx("input",{value:t,onChange:d=>n(d.target.value),placeholder:"一句话说明问题或建议",maxLength:120,required:!0})]}),a.jsxs("label",{className:"af-feedback-field",children:[a.jsx("span",{children:"反馈内容"}),a.jsx("textarea",{value:r,onChange:d=>s(d.target.value),placeholder:"描述具体场景、期望表现、实际表现或复现步骤",maxLength:5e3,rows:9,required:!0})]}),l?a.jsx("p",{className:"af-err af-feedback-error",children:l}):null,a.jsx("div",{className:"af-feedback-actions",children:a.jsxs("button",{type:"submit",className:"af-feedback-submit",disabled:i||!t.trim()||!r.trim(),children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:i?"hourglass_empty":"send"}),i?"提交中...":"提交反馈"]})})]})]})})}function tA(){return`m_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function kN(e,t=[]){const n=new Set((Array.isArray(t)?t:[]).map(String));return Object.entries(e&&typeof e=="object"?e:{}).map(([r,s])=>({id:tA(),key:r,value:String(s??""),private:n.has(r)}))}function SN(e){const t={};for(const n of Array.isArray(e)?e:[]){const r=String((n==null?void 0:n.key)||"").trim();r&&(t[r]=String((n==null?void 0:n.value)??""))}return t}function Af(e=null){const t=e!=null&&e.raw&&typeof e.raw=="object"?e.raw:{},n=Array.isArray(t.args)?t.args:Array.isArray(e==null?void 0:e.args)?e.args:[];return{originalName:String((e==null?void 0:e.name)||""),name:String((e==null?void 0:e.name)||""),type:e!=null&&e.url||t.url?"url":"command",url:String((e==null?void 0:e.url)||t.url||""),command:String((e==null?void 0:e.command)||t.command||""),argsText:n.map(String).join(`
219
- `),description:String((e==null?void 0:e.description)||t.description||""),envRows:kN(t.env||(e==null?void 0:e.env),e==null?void 0:e.privateEnvKeys),headerRows:kN(t.headers||(e==null?void 0:e.headers),e==null?void 0:e.privateHeaderKeys),extraJson:JSON.stringify(Object.fromEntries(Object.entries(t).filter(([r])=>!["url","command","args","env","headers","description","__agentflowPrivateKeys"].includes(r))),null,2)}}function Qm(){return Af({name:"",raw:{command:""}})}function HQ(e){const n={...e.extraJson.trim()?JSON.parse(e.extraJson):{}};if(e.type==="url")n.url=e.url.trim();else{n.command=e.command.trim();const i=e.argsText.split(/\r?\n/g).map(o=>o.trim()).filter(Boolean);i.length&&(n.args=i)}const r=SN(e.envRows),s=SN(e.headerRows);return Object.keys(r).length&&(n.env=r),Object.keys(s).length&&(n.headers=s),e.description.trim()&&(n.description=e.description.trim()),{name:e.originalName,nextName:e.name.trim(),server:n,privateEnvKeys:e.envRows.filter(i=>i.private).map(i=>String(i.key||"").trim()).filter(Boolean),privateHeaderKeys:e.headerRows.filter(i=>i.private).map(i=>String(i.key||"").trim()).filter(Boolean)}}function NN(e){return e?e.ok?`${e.toolCount||0} tools enabled`:`Error - ${e.error||"Show Output"}`:"未检测"}function jN(e){return e?e.ok?"ok":"error":"unknown"}function CN({title:e,rows:t,onChange:n,placeholderKey:r="KEY",placeholderValue:s="value"}){const i=(o,l,c)=>n(t.map(u=>u.id===o?{...u,[l]:c}:u));return a.jsxs("div",{className:"af-mcp-field",children:[a.jsxs("div",{className:"af-mcp-field-head",children:[a.jsx("span",{children:e}),a.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>n([...t,{id:tA(),key:"",value:"",private:!0}]),children:"添加"})]}),a.jsxs("div",{className:"af-mcp-kv-list",children:[t.length===0?a.jsx("p",{className:"af-set-hint",children:"暂无"}):null,t.map(o=>a.jsxs("div",{className:"af-mcp-kv-row",children:[a.jsx("input",{className:"af-set-input af-set-input--mono",value:o.key,placeholder:r,onChange:l=>i(o.id,"key",l.target.value)}),a.jsx("input",{className:"af-set-input af-set-input--mono",value:o.value,placeholder:s,onChange:l=>i(o.id,"value",l.target.value)}),a.jsxs("label",{className:"af-mcp-private-toggle",title:"只保存到当前 AgentFlow 用户的个人配置",children:[a.jsx("input",{type:"checkbox",checked:!!o.private,onChange:l=>i(o.id,"private",l.target.checked)}),a.jsx("span",{children:"个人"})]}),a.jsx("button",{type:"button",className:"af-set-env-del",onClick:()=>n(t.filter(l=>l.id!==o.id)),"aria-label":"删除",children:a.jsx("span",{className:"material-symbols-outlined",children:"delete"})})]},o.id))]})]})}function BQ(){var R;const[e,t]=m.useState(""),[n,r]=m.useState([]),[s,i]=m.useState(Qm),[o,l]=m.useState(""),[c,u]=m.useState(!1),[p,f]=m.useState(!1),[d,h]=m.useState(!1),[y,w]=m.useState({}),[k,g]=m.useState(""),[b,x]=m.useState(""),S=m.useMemo(()=>n.find($=>$.name===o)||null,[o,n]),C=S&&y[S.name]||null,j=m.useCallback(async()=>{u(!0),g("");try{const $=await fetch("/api/mcps"),P=await $.json().catch(()=>({}));if(!$.ok)throw new Error(P.error||"MCP HTTP "+$.status);const L=Array.isArray(P.servers)?P.servers:[];t(String(P.path||"")),r(L),o&&L.some(T=>T.name===o)&&i(Af(L.find(T=>T.name===o)))}catch($){g(String($.message||$))}finally{u(!1)}},[o]);m.useEffect(()=>{j()},[j]);const E=()=>{l(""),i(Qm()),x(""),g("")},A=$=>{l($.name),i(Af($)),x(""),g("")},D=async($="")=>{h(!0),g(""),x("");try{const P=await fetch("/api/mcps/check",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($?{name:$}:{})}),L=await P.json().catch(()=>({}));if(!P.ok)throw new Error(L.error||"检测 MCP 失败");const T=Array.isArray(L.results)?L.results:[];w(O=>{const I={...O};for(const H of T)H!=null&&H.name&&(I[H.name]=H);return I}),x($?`已检测 ${$}。`:"已检测所有 MCP。")}catch(P){g(String(P.message||P))}finally{h(!1)}},W=async()=>{f(!0),g(""),x("");try{const $=HQ(s);if(!$.nextName)throw new Error("请填写 MCP 名称");const P=await fetch("/api/mcps",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)}),L=await P.json().catch(()=>({}));if(!P.ok)throw new Error(L.error||"保存 MCP 失败");const T=Array.isArray(L.servers)?L.servers:[];r(T),t(String(L.path||e)),l($.nextName),i(Af(T.find(O=>O.name===$.nextName)||null)),w(O=>{const I={...O};return s.originalName&&s.originalName!==$.nextName&&delete I[s.originalName],delete I[$.nextName],I}),x("已保存。Cursor CLI 下次启动时会读取新配置。")}catch($){g(String($.message||$))}finally{f(!1)}},F=async $=>{if($!=null&&$.name&&window.confirm(`删除 MCP "${$.name}"?`)){f(!0),g(""),x("");try{const P=await fetch("/api/mcps/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:$.name})}),L=await P.json().catch(()=>({}));if(!P.ok)throw new Error(L.error||"删除 MCP 失败");r(Array.isArray(L.servers)?L.servers:[]),l(""),i(Qm()),w(T=>{const O={...T};return delete O[$.name],O}),x("已删除。")}catch(P){g(String(P.message||P))}finally{f(!1)}}};return a.jsxs("main",{className:"af-settings-page",children:[a.jsxs("header",{className:"af-settings-top",children:[a.jsxs("div",{className:"af-settings-crumb",children:[a.jsx("span",{className:"af-settings-crumb-muted",children:"AgentFlow"}),a.jsx("span",{className:"af-settings-crumb-sep",children:"/"}),a.jsx("span",{className:"af-settings-crumb-active",children:"MCP"})]}),a.jsxs("div",{className:"af-settings-top-right",children:[a.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:j,disabled:c||p,children:"刷新"}),a.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>D(),disabled:d||c||p||n.length===0,children:d?"检测中...":"检测状态"}),a.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:E,disabled:p,children:"新增 MCP"})]})]}),a.jsx("div",{className:"af-settings-body",children:a.jsxs("div",{className:"af-settings-inner",children:[a.jsxs("section",{className:"af-settings-hero",children:[a.jsx("h1",{className:"af-settings-h1",children:"MCP 管理"}),a.jsxs("p",{className:"af-settings-lead",children:["新增、编辑和删除 Cursor MCP server。当前配置文件:",a.jsx("span",{className:"af-settings-code",children:e||"~/.cursor/mcp.json"})]})]}),a.jsxs("div",{className:"af-mcp-layout",children:[a.jsxs("section",{className:"af-set-card af-mcp-list-card",children:[a.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[a.jsx("h2",{className:"af-set-h2",children:"Servers"}),a.jsxs("div",{className:"af-mcp-list-head-actions",children:[a.jsx("span",{className:"af-set-badge af-set-badge--muted",children:n.length}),a.jsxs("button",{type:"button",className:"af-set-btn-mini",onClick:E,disabled:p,children:[a.jsx("span",{className:"material-symbols-outlined",children:"add"}),"新增"]})]})]}),c?a.jsx("p",{className:"af-set-p",children:"加载中..."}):null,n.length===0&&!c?a.jsxs("div",{className:"af-mcp-empty",children:[a.jsx("p",{className:"af-set-p",children:"暂无 MCP server。"}),a.jsx("button",{type:"button",className:"af-set-footer-primary",onClick:E,disabled:p,children:"新增 MCP Server"})]}):null,a.jsx("div",{className:"af-mcp-server-list",children:n.map($=>a.jsxs("button",{type:"button",className:"af-mcp-server-item"+(o===$.name?" af-mcp-server-item--active":""),onClick:()=>A($),children:[a.jsx("span",{className:"material-symbols-outlined",children:$.type==="url"?"cloud":"terminal"}),a.jsxs("span",{children:[a.jsxs("span",{className:"af-mcp-server-title",children:[a.jsx("strong",{children:$.name}),a.jsx("small",{className:`af-mcp-server-health af-mcp-server-health--${jN(y[$.name])}`,children:NN(y[$.name])})]}),a.jsx("em",{children:$.url||[$.command,...$.args||[]].filter(Boolean).join(" ")})]})]},$.name))})]}),a.jsxs("section",{className:"af-set-card af-mcp-editor-card",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:S?"编辑 MCP":"新增 MCP"}),a.jsx("p",{className:"af-set-p af-set-p--tight",children:"保存后会写入 Cursor MCP 配置。已运行的 agent 进程不会热更新,下一次启动会读取新配置。"})]}),S?a.jsxs("div",{className:"af-mcp-editor-actions",children:[a.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>D(S.name),disabled:d||p,children:d?"检测中...":"检测"}),a.jsx("button",{type:"button",className:"af-set-btn-mini af-set-btn-mini--danger",onClick:()=>F(S),disabled:p,children:"删除"})]}):null]}),k?a.jsx("p",{className:"af-mcp-error",children:k}):null,b?a.jsx("p",{className:"af-mcp-status",children:b}):null,C?a.jsxs("div",{className:`af-mcp-check af-mcp-check--${jN(C)}`,children:[a.jsxs("div",{className:"af-mcp-check-head",children:[a.jsx("strong",{children:NN(C)}),a.jsxs("span",{children:[C.elapsedMs||0,"ms"]})]}),C.error?a.jsx("p",{children:C.error}):null,(R=C.tools)!=null&&R.length?a.jsx("div",{className:"af-mcp-tools-list",children:C.tools.map($=>a.jsxs("div",{className:"af-mcp-tool-row",children:[a.jsx("strong",{children:$.name}),$.description?a.jsx("span",{children:$.description}):null]},$.name))}):null]}):null,a.jsxs("div",{className:"af-mcp-form",children:[a.jsxs("label",{className:"af-set-label",children:["MCP 名称",a.jsx("input",{className:"af-set-input af-set-input--mono",value:s.name,onChange:$=>i(P=>({...P,name:$.target.value})),placeholder:"github"})]}),a.jsxs("label",{className:"af-set-label",children:["类型",a.jsxs("select",{className:"af-set-input",value:s.type,onChange:$=>i(P=>({...P,type:$.target.value})),children:[a.jsx("option",{value:"url",children:"URL / HTTP"}),a.jsx("option",{value:"command",children:"Command / stdio"})]})]}),s.type==="url"?a.jsxs("label",{className:"af-set-label af-mcp-field--wide",children:["URL",a.jsx("input",{className:"af-set-input af-set-input--mono",value:s.url,onChange:$=>i(P=>({...P,url:$.target.value})),placeholder:"http://127.0.0.1:3845/mcp"})]}):a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"af-set-label",children:["Command",a.jsx("input",{className:"af-set-input af-set-input--mono",value:s.command,onChange:$=>i(P=>({...P,command:$.target.value})),placeholder:"uvx"})]}),a.jsxs("label",{className:"af-set-label",children:["Args,每行一个",a.jsx("textarea",{className:"af-set-input af-mcp-textarea af-set-input--mono",rows:4,value:s.argsText,onChange:$=>i(P=>({...P,argsText:$.target.value})),placeholder:`mcp-server-example
220
- --flag`})]})]}),a.jsxs("label",{className:"af-set-label af-mcp-field--wide",children:["描述",a.jsx("input",{className:"af-set-input",value:s.description,onChange:$=>i(P=>({...P,description:$.target.value})),placeholder:"这个 MCP 提供什么能力"})]}),a.jsx(CN,{title:"Headers",rows:s.headerRows,onChange:$=>i(P=>({...P,headerRows:$})),placeholderKey:"Authorization",placeholderValue:"Bearer ..."}),a.jsx(CN,{title:"Env",rows:s.envRows,onChange:$=>i(P=>({...P,envRows:$})),placeholderKey:"TOKEN",placeholderValue:"..."}),a.jsxs("label",{className:"af-set-label af-mcp-field--wide",children:["额外 JSON 字段",a.jsx("textarea",{className:"af-set-input af-mcp-textarea af-set-input--mono",rows:5,value:s.extraJson,onChange:$=>i(P=>({...P,extraJson:$.target.value}))})]})]}),a.jsxs("div",{className:"af-mcp-actions",children:[a.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:E,disabled:p,children:"清空"}),a.jsx("button",{type:"button",className:"af-set-footer-primary",onClick:W,disabled:p,children:p?"保存中...":"保存 MCP"})]})]})]})]})})]})}function EN(e){if(!e)return"-";const t=typeof e=="number"?e:Date.parse(String(e));return Number.isFinite(t)?new Date(t).toLocaleString():String(e)}function WQ(e){return(e==null?void 0:e.kind)==="workspace"?"Workspace":"Pipeline"}function VQ(e){if(e!=null&&e.running)return"运行中";if(!(e!=null&&e.enabled))return"已停用";const t=String((e==null?void 0:e.lastStatus)||"").trim();return!t||t==="armed"||t==="enabled"?"已启用":t==="success"?"上次成功":t==="failed"?"上次失败":t==="invalid"?"配置异常":t.startsWith("skipped")?"已跳过":t}function KQ(){const[e,t]=m.useState([]),[n,r]=m.useState(!1),[s,i]=m.useState(""),[o,l]=m.useState(""),c=m.useCallback(async()=>{r(!0),i("");try{const f=await fetch("/api/schedules"),d=await f.json().catch(()=>({}));if(!f.ok)throw new Error(d.error||"读取定时任务失败");t(Array.isArray(d.schedules)?d.schedules:[])}catch(f){i(String(f.message||f)),t([])}finally{r(!1)}},[]);m.useEffect(()=>{c()},[c]);const u=m.useCallback(async f=>{const d=`${f.kind}:${f.flowSource||"user"}:${f.flowId||""}:${f.scheduleNodeId||""}`;l(d),i("");try{const h=await fetch("/api/schedule/toggle",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:f.kind,flowId:f.flowId,flowSource:f.flowSource||"user",scheduleNodeId:f.scheduleNodeId||"",enabled:!f.enabled})}),y=await h.json().catch(()=>({}));if(!h.ok||y.success===!1)throw new Error(y.error||"更新定时任务失败");await c()}catch(h){i(String(h.message||h))}finally{l("")}},[c]),p=m.useMemo(()=>{const f=e.filter(h=>h.enabled).length,d=e.filter(h=>h.kind==="workspace").length;return{total:e.length,enabled:f,workspace:d,pipeline:e.length-d}},[e]);return a.jsxs("div",{className:"af-settings-page af-schedules-page",children:[a.jsxs("div",{className:"af-settings-top",children:[a.jsxs("div",{className:"af-settings-crumb",children:[a.jsx("span",{className:"af-settings-crumb-muted",children:"AgentFlow"}),a.jsx("span",{className:"af-settings-crumb-sep",children:"/"}),a.jsx("span",{className:"af-settings-crumb-active",children:"定时任务"})]}),a.jsxs("button",{type:"button",className:"af-schedules-refresh",onClick:()=>void c(),disabled:n,children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:n?"hourglass_empty":"refresh"}),"刷新"]})]}),a.jsx("div",{className:"af-settings-body",children:a.jsxs("div",{className:"af-settings-inner",children:[a.jsxs("section",{className:"af-settings-hero",children:[a.jsx("h1",{className:"af-settings-h1",children:"定时任务"}),a.jsx("p",{className:"af-settings-lead",children:"统一查看服务器上的 Pipeline 定时任务和 Workspace Scheduled Run,并在这里快捷启停。"})]}),a.jsxs("div",{className:"af-schedules-summary","aria-label":"定时任务汇总",children:[a.jsxs("div",{children:[a.jsx("span",{children:"全部"}),a.jsx("strong",{children:p.total})]}),a.jsxs("div",{children:[a.jsx("span",{children:"启用中"}),a.jsx("strong",{children:p.enabled})]}),a.jsxs("div",{children:[a.jsx("span",{children:"Workspace"}),a.jsx("strong",{children:p.workspace})]}),a.jsxs("div",{children:[a.jsx("span",{children:"Pipeline"}),a.jsx("strong",{children:p.pipeline})]})]}),s?a.jsx("div",{className:"af-schedules-error",children:s}):null,n?a.jsx("div",{className:"af-schedules-empty",children:"Loading..."}):null,!n&&e.length===0?a.jsx("div",{className:"af-schedules-empty",children:"暂无定时任务"}):null,a.jsx("div",{className:"af-schedules-list",children:e.map(f=>{const d=`${f.kind}:${f.flowSource||"user"}:${f.flowId||""}:${f.scheduleNodeId||""}`,h=o===d;return a.jsxs("article",{className:"af-schedule-card",children:[a.jsxs("div",{className:"af-schedule-card__main",children:[a.jsxs("div",{className:"af-schedule-card__title-row",children:[a.jsx("strong",{children:f.label||f.flowId||"-"}),a.jsx("span",{className:`af-schedule-badge af-schedule-badge--${f.kind||"pipeline"}`,children:WQ(f)}),a.jsx("span",{className:`af-schedule-state ${f.enabled?"af-schedule-state--on":"af-schedule-state--off"}`,children:VQ(f)})]}),a.jsxs("div",{className:"af-schedule-card__meta",children:[a.jsx("span",{children:f.flowId||"-"}),a.jsx("span",{children:f.flowSource||"user"}),f.scheduleNodeId?a.jsx("span",{children:f.scheduleNodeId}):null]}),a.jsxs("div",{className:"af-schedule-card__grid",children:[a.jsxs("div",{children:[a.jsx("span",{children:"Cron"}),a.jsx("strong",{children:f.cron||"-"})]}),a.jsxs("div",{children:[a.jsx("span",{children:"时区"}),a.jsx("strong",{children:f.timezone||"Asia/Shanghai"})]}),a.jsxs("div",{children:[a.jsx("span",{children:"下次执行"}),a.jsx("strong",{children:EN(f.nextRunAt)})]}),a.jsxs("div",{children:[a.jsx("span",{children:"最近执行"}),a.jsx("strong",{children:EN(f.lastTriggeredAt)})]})]}),f.lastError?a.jsx("p",{className:"af-schedule-card__error",children:f.lastError}):null]}),a.jsx("div",{className:"af-schedule-card__actions",children:a.jsxs("button",{type:"button",className:f.enabled?"af-schedule-toggle af-schedule-toggle--on":"af-schedule-toggle af-schedule-toggle--off",disabled:h,"aria-pressed":f.enabled,title:f.enabled?"点击停用":"点击启用",onClick:()=>void u(f),children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:h?"hourglass_empty":f.enabled?"toggle_on":"toggle_off"}),f.enabled?"已启用":"已停用"]})})]},d)})})]})})]})}const UQ=[{icon:"campaign",title:"首页 Feed 想加一个广告引导",question:"先判断入口、展示位、用户影响面,再决定弹框、浮层还是页面内引导。",context:["查客户端展示位逻辑","查历史需求与配置","查 m09 / Feed PV"],result:"原型 + PRD + TAPD 更新",tone:"pink"},{icon:"manage_search",title:"接到需求但不知道现有逻辑",question:"不用先找研发问一圈,直接从 Likee 代码、知识库、历史文档里拿上下文。",context:["客户端 / 后台 / 前端知识库","接口与配置链路","相关 Git 文档"],result:"背景结论 + 影响范围",tone:"cyan"},{icon:"query_stats",title:"运营要评估活动或入口价值",question:"先查人群规模、页面访问、历史转化,避免凭经验拍优先级。",context:["CK / Hive 查数","自动生成 SQL","指标口径解释"],result:"数据表 + 图表 + 结论",tone:"green"},{icon:"draw",title:"想快速把方案画给团队看",question:"把一句需求变成客户端或 H5 原型,让评审时先讨论体验,不只讨论文字。",context:["Likee 客户端样式","前端页面结构","交互状态与文案"],result:"HTML 原型 + Display 面板",tone:"amber"},{icon:"sync_alt",title:"需求写完后需要同步多个地方",question:"PRD、TAPD、Git 仓库和评审展示保持一致,减少重复复制和漏改。",context:["需求正文","变更记录","MR / 仓库路径"],result:"TAPD 更新 + Git 提交",tone:"violet"},{icon:"monitoring",title:"上线后要看效果和复盘",question:"沿用需求阶段的口径继续查数,把结果沉淀回下一轮需求线索。",context:["上线后 CK / Hive","分页面 / 分人群指标","实验和版本信息"],result:"复盘结论 + 后续建议",tone:"blue"}],qQ=[{label:"Use Case 01",title:"Likee 客户端知识库查询(如广告占位)",images:["/likee-context/usecase-ad-query.png"],trigger:"产品或运营想确认客户端已有逻辑,例如 Likee Android 里有哪些广告占位,以及相关常量和代码位置。",steps:["在「我的流程」加载 Likee Android 流程片段","在子 Agent 节点输入客户端逻辑问题","点击 Run Line,只执行当前链路","在右侧 Markdown Display 查看知识库查询结果"],outputs:["SETTING_ID / PAGE_ID 表格","客户端代码路径与口径说明","可继续用于 PRD 的背景材料"]},{label:"Use Case 02",title:"客户端原型设计",images:["/likee-context/usecase-prototype.png"],trigger:"业务已经明确要在 Likee 首页加入广告引导,需要先把弹框体验画出来给产品、设计、研发评审。",steps:["在 Workspace 打开原型生成流程","加载客户端原型 Skill","在子 Agent 中说明生成一个首页 dialog 弹框","查看 HTML Display 中的手机预览稿"],outputs:["Likee 风格手机原型","弹框文案与按钮状态","可直接用于评审的 Display 面板"]},{label:"Use Case 03",title:"前端 H5 原型设计",images:["/likee-context/usecase-h5-prototype.png"],trigger:"运营活动需要快速产出 Likee 风格 H5 页面,例如幸运转盘、积分排行榜、活动首页或结果页。",steps:["在 Workspace 打开 H5 原型生成流程","加载前端 H5 原型相关 Skill","在子 Agent 中说明活动结构、页面模块和运营规则","查看 HTML Display 中的可交互 H5 原型"],outputs:["Likee 风格 H5 页面","抽奖转盘与排行榜布局","活动规则和状态页","可用于评审的 HTML Display"]},{label:"Use Case 04",title:"CK / Hive 查数与 SQL 生成",images:["/likee-context/usecase-data-query.png"],trigger:"运营或产品需要快速验证一个数据问题,例如找出典型 UID、对比不同日期的视频上传分辨率占比,并保留可复用 SQL。",steps:["在 Workspace 打开查数流程","加载查数相关 Skill","在子 Agent 中说明数据口径、日期和筛选条件","查看 Markdown Display 中的数据结果和查询 SQL"],outputs:["查询结果表格","SQL 语句","口径说明","可继续接入 PRD 或复盘面板的数据结论"]},{label:"Use Case 05",title:"需求文档生成、数据补齐与同步",images:["/likee-context/usecase-prd.png","/likee-context/usecase-sync.png"],trigger:"需求进入评审和落库阶段,需要把 TAPD 信息、Hive 数据、原型内容组织成 PRD,并同步到 TAPD 和 Git 仓库。",steps:["先运行 TAPD / 数据查询节点,拿到迭代、页面 PV 和业务背景","把查询结果和原型 Display 内容接入 PRD 生成子 Agent","在 Markdown Display 查看完整需求文档","把 PRD content 接入 TAPD 更新节点和 Git 仓库提交节点"],outputs:["完整 PRD 文档","项目背景与 Top 页面数据","TAPD 需求更新成功","Git MR 链接"]},{label:"Use Case 06",title:"Display 模式做需求评审面板",images:["/likee-context/usecase-display.png"],trigger:"流程跑完后,需要把 PRD、原型、数据图表、展示位表格放在一个页面里给产品、运营、研发一起看。",steps:["在 Workspace 中完成查数、原型、PRD、同步节点执行","确认 Markdown / HTML / 图表 / 表格展示节点都有结果","切换顶部 DISPLAY 模式","使用生成链接把评审面板发给相关同学"],outputs:["PRD 长文档","客户端原型预览","图表与表格","统一展示链接"]}],YQ=[{name:"likee-client-ui",namespace:"智能助手 / 客户端原型",icon:"phone_iphone",mode:"客户端原型设计",usage:"生成 Likee 客户端风格页面、弹框、Feed 引导、个人页、活动入口等原型,适合产品评审前快速对齐体验。",examples:["首页 dialog 弹框","Feed 内引导","客户端红色主品牌视觉","移动端交互态"],tone:"pink"},{name:"tapd-likee",namespace:"智能助手 / TAPD",icon:"sync",mode:"需求系统交互",usage:"和 TAPD 交互,支持创建、同步、更新需求,把工作区生成的 PRD 或 Markdown 内容回写到需求系统。",examples:["创建 TAPD 需求","更新需求正文","同步处理人和链接","把结果回显到 Display"],tone:"green"},{name:"plain-language-response",namespace:"智能助手 / 回答风格",icon:"record_voice_over",mode:"业务化回答",usage:"用于把回答收敛成产品、运营更容易阅读的解释,避免直接把客户端代码库细节、函数调用链和实现细节暴露太多。",examples:["需求背景解释","代码结论转业务语言","评审材料摘要","减少实现细节噪音"],tone:"cyan"},{name:"create-likee-h5-style-html",namespace:"智能助手 / 前端 H5",icon:"language",mode:"H5 原型设计",usage:"创建 Likee H5 风格原型,适合运营活动、抽奖、排行榜、报告页、反馈表单、创作者认证页、订单列表等页面。",examples:["幸运转盘活动","积分排行榜","活动规则页","结果页和空状态"],tone:"amber"},{name:"analytics",namespace:"数据 / CK & Hive",icon:"query_stats",mode:"查数和 SQL 生成",usage:"面向 CK、Hive 的指标查询和 SQL 生成,适合 PV、UV、转化、分国家、分实验组、典型 UID 等数据问题。",examples:["自动生成 SQL","输出查询结果表","解释指标口径","沉淀复盘数据"],tone:"green"}],GQ=[["知识库","查客户端、后台、前端逻辑","广告、Feed、会员、增长、配置、接口调用链"],["数据","查 CK / Hive 并输出 SQL","PV、UV、转化、分页面、分国家、分实验组"],["产物","生成原型、PRD、Display 面板","Markdown、HTML 原型、图表、表格、交互预览"],["协作","同步 TAPD 与 Git 仓库","需求正文、变更记录、MR 链接、评审材料"]];function sf({icon:e,title:t,label:n,tone:r="violet"}){return a.jsxs("div",{className:`likee-flow-node likee-flow-node-${r}`,children:[a.jsx("span",{className:"material-symbols-outlined",children:e}),a.jsxs("div",{children:[a.jsx("strong",{children:t}),a.jsx("small",{children:n})]})]})}function XQ(){return a.jsxs("div",{className:"likee-workspace-scene","aria-hidden":"true",children:[a.jsx("div",{className:"likee-scene-grid"}),a.jsxs("svg",{className:"likee-scene-lines",viewBox:"0 0 980 560",fill:"none",children:[a.jsx("path",{d:"M96 154 C236 96 330 122 444 194 C552 262 654 260 814 160"}),a.jsx("path",{d:"M118 350 C248 288 344 304 458 372 C578 444 704 420 858 310"}),a.jsx("path",{d:"M472 196 C512 248 524 302 486 372"}),a.jsx("path",{d:"M622 126 C670 198 696 258 682 354"})]}),a.jsx("div",{className:"likee-node-pos likee-node-a",children:a.jsx(sf,{icon:"travel_explore",title:"全局上下文",label:"Likee 业务、代码、数据",tone:"pink"})}),a.jsx("div",{className:"likee-node-pos likee-node-b",children:a.jsx(sf,{icon:"database",title:"CK / Hive",label:"自动 SQL 与指标口径",tone:"cyan"})}),a.jsx("div",{className:"likee-node-pos likee-node-c",children:a.jsx(sf,{icon:"article",title:"需求文档",label:"PRD、变更说明、评审稿",tone:"amber"})}),a.jsx("div",{className:"likee-node-pos likee-node-d",children:a.jsx(sf,{icon:"sync_alt",title:"TAPD / Git",label:"同步需求与版本资产",tone:"green"})}),a.jsxs("div",{className:"likee-phone-preview",children:[a.jsxs("div",{className:"likee-phone-top",children:[a.jsx("span",{children:"关注"}),a.jsx("strong",{children:"推荐"}),a.jsx("span",{children:"直播"})]}),a.jsxs("div",{className:"likee-phone-card",children:[a.jsx("div",{className:"likee-gift",children:"AD"}),a.jsx("h4",{children:"广告个性化引导弹框"}),a.jsx("p",{children:"保持推荐体验,同时解释权益与关闭路径。"}),a.jsx("button",{children:"继续"}),a.jsx("button",{className:"secondary",children:"稍后"})]})]}),a.jsxs("div",{className:"likee-display-panel",children:[a.jsxs("div",{className:"likee-panel-header",children:[a.jsx("span",{children:"DISPLAY"}),a.jsx("strong",{children:"需求资产面板"})]}),a.jsxs("div",{className:"likee-table-row",children:[a.jsx("span",{children:"需求"}),a.jsx("strong",{children:"首页广告个性化引导"})]}),a.jsxs("div",{className:"likee-table-row",children:[a.jsx("span",{children:"数据"}),a.jsx("strong",{children:"m09 PV Top 1"})]}),a.jsxs("div",{className:"likee-table-row",children:[a.jsx("span",{children:"同步"}),a.jsx("strong",{children:"TAPD + Git MR"})]})]})]})}function If({kicker:e,title:t,children:n}){return a.jsxs("div",{className:"likee-section-copy",children:[a.jsx("p",{className:"likee-section-kicker",children:e}),a.jsx("h2",{children:t}),a.jsx("p",{children:n})]})}function JQ(){return a.jsx("section",{id:"likee-skills",className:"likee-section likee-section-dark",children:a.jsxs("div",{className:"likee-section-inner likee-two-column likee-two-column-skills",children:[a.jsx(If,{kicker:"SKILLS",title:"用 Skills 把 Likee 上下文变成可复用能力",children:"Skills 是工作区里可加载的能力包。手动搭建工作区时,只需要按场景加载对应 Skill。"}),a.jsx("div",{className:"likee-skill-grid",children:YQ.map(e=>a.jsxs("article",{className:`likee-skill-card likee-skill-${e.tone}`,children:[a.jsxs("div",{className:"likee-skill-head",children:[a.jsx("div",{className:"likee-skill-icon",children:a.jsx("span",{className:"material-symbols-outlined",children:e.icon})}),a.jsxs("div",{children:[a.jsx("h3",{children:e.name}),a.jsx("span",{children:e.namespace})]})]}),a.jsx("div",{className:"likee-skill-mode",children:e.mode}),a.jsx("p",{children:e.usage}),a.jsx("div",{className:"likee-skill-examples",children:e.examples.map(t=>a.jsx("strong",{children:t},t))})]},e.name))})]})})}function nA(){return a.jsxs("div",{className:"likee-page",children:[a.jsx("div",{className:"likee-top-actions",children:a.jsxs("a",{href:"/projects",className:"likee-home-link",children:[a.jsx("span",{className:"material-symbols-outlined",children:"arrow_back"}),"返回首页"]})}),a.jsxs("section",{className:"likee-hero",children:[a.jsx(XQ,{}),a.jsxs("div",{className:"likee-hero-content",children:[a.jsx("p",{className:"likee-eyebrow",children:"LIKEE CONTEXT WORKSPACE"}),a.jsx("h1",{children:"Likee Agent 工作台"}),a.jsx("p",{className:"likee-hero-subtitle",children:"提供 Likee 全局上下文,赋能需求挖掘、书写和运营。"}),a.jsxs("div",{className:"likee-signal-row",children:[a.jsx("span",{children:"查业务逻辑"}),a.jsx("span",{children:"查 CK / Hive"}),a.jsx("span",{children:"生成原型"}),a.jsx("span",{children:"生成 PRD"}),a.jsx("span",{children:"同步 TAPD / Git"})]}),a.jsxs("div",{className:"likee-hero-actions",children:[a.jsxs("a",{href:"/projects",className:"likee-primary-action",children:[a.jsx("span",{className:"material-symbols-outlined",children:"rocket_launch"}),"立即使用"]}),a.jsxs("a",{href:"#likee-scenarios",className:"likee-secondary-action",children:[a.jsx("span",{className:"material-symbols-outlined",children:"ads_click"}),"按场景查看"]}),a.jsxs("a",{href:"#likee-usecases",className:"likee-secondary-action",children:[a.jsx("span",{className:"material-symbols-outlined",children:"view_timeline"}),"查看 Use Cases"]}),a.jsxs("a",{href:"#likee-skills",className:"likee-secondary-action",children:[a.jsx("span",{className:"material-symbols-outlined",children:"extension"}),"查看 Skills"]})]})]})]}),a.jsx("section",{id:"likee-scenarios",className:"likee-section",children:a.jsxs("div",{className:"likee-section-inner",children:[a.jsx(If,{kicker:"SCENARIO TRIGGERS",title:"打造 Likee 团队全景上下文",children:"不要求先会写 Prompt,也不要求知道该找哪个系统。选择一个业务场景,工作台会把需要的 Likee 上下文、数据查询和最终产物组织起来。"}),a.jsx("div",{className:"likee-scenario-grid",children:UQ.map(e=>a.jsxs("article",{className:`likee-scenario-card likee-scenario-${e.tone}`,children:[a.jsx("div",{className:"likee-scenario-icon",children:a.jsx("span",{className:"material-symbols-outlined",children:e.icon})}),a.jsxs("div",{children:[a.jsx("h3",{children:e.title}),a.jsx("p",{children:e.question})]}),a.jsx("div",{className:"likee-scenario-context",children:e.context.map(t=>a.jsx("span",{children:t},t))}),a.jsxs("div",{className:"likee-scenario-result",children:[a.jsx("span",{children:"产出"}),a.jsx("strong",{children:e.result})]})]},e.title))})]})}),a.jsx("section",{id:"likee-usecases",className:"likee-section likee-section-muted",children:a.jsxs("div",{className:"likee-section-inner likee-two-column likee-usecase-layout",children:[a.jsx(If,{kicker:"USE CASES",title:"沉淀 Likee 业务流水线",children:"这里展示的是平台里实际可跑的工作流:加载流程片段,在子 Agent 或 Run 节点输入业务问题,执行当前 line,最终在 Display、TAPD 和 Git 中拿到结果。"}),a.jsx("div",{className:"likee-usecase-stack",children:qQ.map(e=>a.jsxs("article",{className:"likee-usecase-card",children:[a.jsx("div",{className:`likee-usecase-media ${e.images.length>1?"likee-usecase-media-split":""}`,children:e.images.map((t,n)=>a.jsx("img",{src:t,alt:`${e.title} 工作区截图 ${n+1}`,loading:"lazy"},t))}),a.jsxs("div",{className:"likee-usecase-body",children:[a.jsx("div",{className:"likee-usecase-label",children:e.label}),a.jsx("h3",{children:e.title}),a.jsx("p",{children:e.trigger}),a.jsx("ol",{className:"likee-usecase-steps",children:e.steps.map(t=>a.jsx("li",{children:t},t))}),a.jsxs("div",{className:"likee-usecase-output",children:[a.jsx("span",{children:"实际产物"}),a.jsx("div",{children:e.outputs.map(t=>a.jsx("strong",{children:t},t))})]})]})]},e.label))})]})}),a.jsx(JQ,{}),a.jsx("section",{className:"likee-section",children:a.jsxs("div",{className:"likee-section-inner likee-two-column likee-capability-layout",children:[a.jsx(If,{kicker:"CAPABILITY MAP",title:"每个场景背后,都连接同一套 Likee 上下文能力",children:"工作台把知识库、CK / Hive、原型、PRD、TAPD 和 Git 放到同一条链路里。用户看到的是业务场景,系统处理的是上下文、产物和同步。"}),a.jsx("div",{className:"likee-capability-table",children:GQ.map(([e,t,n])=>a.jsxs("div",{className:"likee-capability-row",children:[a.jsx("span",{children:e}),a.jsx("strong",{children:t}),a.jsx("p",{children:n})]},e))})]})})]})}function rA(e){return t=>typeof t===e}var QQ=rA("function"),ZQ=e=>e===null,_N=e=>Object.prototype.toString.call(e).slice(8,-1)==="RegExp",PN=e=>!eZ(e)&&!ZQ(e)&&(QQ(e)||typeof e=="object"),eZ=rA("undefined");function tZ(e,t,n){return lZ(n,e,t)?!0:(cZ(n,e,t),e.constructor!==t.constructor?!1:Array.isArray(e)&&Array.isArray(t)?nZ(e,t,n):e instanceof Map&&t instanceof Map?iZ(e,t,n):e instanceof Set&&t instanceof Set?aZ(e,t):e instanceof WeakMap||e instanceof WeakSet?!1:ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)?rZ(e,t):_N(e)&&_N(t)?e.source===t.source&&e.flags===t.flags:e instanceof Error&&t instanceof Error?sZ(e,t,n):e.valueOf!==Object.prototype.valueOf?e.valueOf()===t.valueOf():e.toString!==Object.prototype.toString?e.toString()===t.toString():oZ(e,t,n))}function Bu(e,t,n){return e===t||Number.isNaN(e)&&Number.isNaN(t)?!0:!e||!PN(e)||!t||!PN(t)?!1:tZ(e,t,n)}function nZ(e,t,n){const{length:r}=e;if(r!==t.length)return!1;for(let s=r;s--!==0;)if(!Bu(e[s],t[s],n))return!1;return!0}function rZ(e,t){if(e.byteLength!==t.byteLength)return!1;const n=new DataView(e.buffer),r=new DataView(t.buffer);let s=e.byteLength;for(;s--;)if(n.getUint8(s)!==r.getUint8(s))return!1;return!0}function sZ(e,t,n){return e.message===t.message&&e.name===t.name&&Bu(e.cause,t.cause,n)}function iZ(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(!Bu(r[1],t.get(r[0]),n))return!1;return!0}function oZ(e,t,n){const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(let s=r.length;s--!==0;)if(!Object.prototype.hasOwnProperty.call(t,r[s]))return!1;for(let s=r.length;s--!==0;){const i=r[s];if(!(i==="_owner"&&e.$$typeof)&&!Bu(e[i],t[i],n))return!1}return!0}function aZ(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 lZ(e,t,n){var r;return((r=e.get(t))==null?void 0:r.has(n))??!1}function cZ(e,t,n){let r=e.get(t);r||(r=new WeakSet,e.set(t,r)),r.add(n)}function Dw(e,t){return Bu(e,t,new WeakMap)}function Zm(){var e;return!!(typeof window<"u"&&((e=window==null?void 0:window.document)!=null&&e.createElement))}function uZ(e,...t){e&&e.removeEventListener&&e.removeEventListener(...t)}function dZ(e,...t){e&&e.addEventListener&&e.addEventListener(...t)}function fZ(){const e=m.useRef(!0);return e.current?(e.current=!1,!0):e.current}function pZ(e,t){const n=fZ();m.useEffect(()=>{if(!n)return e()},t)}function sA(e){const t=m.useRef(void 0);return m.useEffect(()=>{t.current=e}),t.current}function hZ(e,t){const n=m.useRef(t);return Dw(t,n.current)||(n.current=t),m.useMemo(e,n.current)}function mZ(e){m.useEffect(()=>{e()},[])}function gZ(e=0){const[t,n]=m.useState({height:Zm()?window.innerHeight:0,width:Zm()?window.innerWidth:0}),r=m.useRef(0),s=m.useRef(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(()=>{n({width:window.innerWidth,height:window.innerHeight})},e)});return m.useEffect(()=>{if(!Zm())return()=>{};const i=s.current;return n({height:window.innerHeight,width:window.innerWidth}),dZ(window,"resize",i),()=>{uZ(window,"resize",i)}},[]),t}var yZ=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","URL","WeakMap","WeakSet"],xZ=["bigint","boolean","null","number","string","symbol","undefined"];function Wu(e){const t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(wZ(t))return t}function Ts(e){return t=>Wu(t)===e}function wZ(e){return yZ.includes(e)}function Il(e){return t=>typeof t===e}function bZ(e){return xZ.includes(e)}var vZ=["innerHTML","ownerDocument","style","attributes","nodeValue"],Vu=e=>Array.isArray(e),kZ=e=>Wu(e)==="AsyncGeneratorFunction",SZ=Ts("AsyncFunction"),NZ=Il("bigint"),jZ=e=>e===!0||e===!1,CZ=Ts("Date"),EZ=Ts("Error"),so=Il("function"),_Z=Ts("GeneratorFunction"),PZ=e=>typeof e=="number"&&Number.isInteger(e),Ky=Ts("Map"),iA=e=>Number.isNaN(e),Fw=e=>e===null,oA=Ts("Function"),AZ=Ts("Promise"),IZ=Ts("RegExp"),Uy=Ts("Set"),Ku=Il("string"),TZ=Il("symbol"),zw=Il("undefined"),RZ=Ts("WeakMap"),MZ=Ts("WeakSet"),Hw=e=>Fw(e)||zw(e),aA=e=>!zw(e),LZ=e=>Il("number")(e)&&!iA(e),$Z=e=>Ku(e)&&e.trim().length>0,OZ=e=>{if(!Ku(e)||e.length===0)return!1;const t=e.trim();return t.length>0&&Number.isFinite(Number(t))},mh=e=>!Hw(e)&&(so(e)||typeof e=="object"),lA=e=>{if(Wu(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})},DZ=e=>Fw(e)||bZ(typeof e),FZ=e=>Wu(e)==="URL",cA=e=>!Hw(e)&&so(e[Symbol.iterator]),zZ=e=>cA(e)&&so(e.next)&&so(e.throw),HZ=e=>so(e)&&/^class\s/.test(e.toString()),BZ=(e,t)=>!Vu(e)||!so(t)?!1:e.every(n=>t(n)),WZ=e=>mh(e)&&!lA(e)&&e.nodeType===1&&Ku(e.nodeName)&&vZ.every(t=>t in e),VZ=e=>Ku(e)&&e.length===0||Vu(e)&&e.length===0||mh(e)&&!Ky(e)&&!Uy(e)&&Object.keys(e).length===0||Uy(e)&&e.size===0||Ky(e)&&e.size===0,KZ=(e,t)=>!e||!t?!1:Object.getPrototypeOf(e)===t.prototype,UZ=(e,t)=>Vu(e)?e.indexOf(t)>-1:!1,qZ=(e,t,n)=>{if(!mh(e)||!t)return!1;const r=e[t];return so(n)?n(r):aA(r)};function ct(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(Vu(e))return"Array";if(oA(e))return"Function";const t=Wu(e);return t||"Object"}ct.array=Vu;ct.arrayOf=BZ;ct.asyncGeneratorFunction=kZ;ct.asyncFunction=SZ;ct.bigint=NZ;ct.boolean=jZ;ct.class=HZ;ct.date=CZ;ct.defined=aA;ct.domElement=WZ;ct.empty=VZ;ct.error=EZ;ct.function=so;ct.generator=zZ;ct.generatorFunction=_Z;ct.instanceOf=KZ;ct.integer=PZ;ct.iterable=cA;ct.map=Ky;ct.nan=iA;ct.null=Fw;ct.nullOrUndefined=Hw;ct.nonEmptyString=$Z;ct.number=LZ;ct.numericString=OZ;ct.object=mh;ct.oneOf=UZ;ct.plainFunction=oA;ct.plainObject=lA;ct.primitive=DZ;ct.promise=AZ;ct.propertyOf=qZ;ct.regexp=IZ;ct.set=Uy;ct.string=Ku;ct.symbol=TZ;ct.undefined=zw;ct.url=FZ;ct.weakMap=RZ;ct.weakSet=MZ;var Jn=ct;/* v8 ignore next -- @preserve */var YZ=function(e){return Object.prototype.hasOwnProperty.call(e,"props")},GZ=function(e,t){return e+ju(t)},ju=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(GZ,""):YZ(e)&&Object.prototype.hasOwnProperty.call(e.props,"children")?ju(e.props.children):""};ju.default=ju;var XZ=ju;const eg=oo(XZ);var uA={exports:{}};(function(e){const t=Object.getPrototypeOf({});function n(){return function(i){return typeof i=="object"&&i!==null&&!(i instanceof RegExp)&&!(i instanceof Date)}}function r(s){function i(C){return C!=="constructor"&&C!=="prototype"&&C!=="__proto__"}function o(C){let j=0;const E=C.length,A=new Array(E);for(j;j<E;++j)A[j]=g(C[j]);return A}function l(C){const j={};if(d&&Object.getPrototypeOf(C)!==t)return d(C);const E=f(C);let A,D,W;for(A=0,D=E.length;A<D;++A)i(W=E[A])&&(j[W]=g(C[W]));return j}function c(C,j){const E=C.length,A=j.length;let D=0;const W=new Array(E+A);for(D;D<E;++D)W[D]=g(C[D]);for(D=0;D<A;++D)W[D+E]=g(j[D]);return W}const u=Object.prototype.propertyIsEnumerable;function p(C){const j=Object.keys(C),E=Object.getOwnPropertySymbols(C);for(let A=0,D=E.length;A<D;++A)u.call(C,E[A])&&j.push(E[A]);return j}const f=s!=null&&s.symbols?p:Object.keys,d=typeof(s==null?void 0:s.cloneProtoObject)=="function"?s.cloneProtoObject:void 0,h=typeof(s==null?void 0:s.isMergeableObject)=="function"?s.isMergeableObject:n(),y=(s==null?void 0:s.onlyDefinedProperties)===!0;function w(C){return typeof C!="object"||C===null}const k=s&&typeof s.mergeArray=="function"?s.mergeArray({clone:g,deepmerge:x,getKeys:f,isMergeableObject:h}):c;function g(C){return h(C)?Array.isArray(C)?o(C):l(C):C}function b(C,j){const E={},A=f(C),D=f(j);let W,F,R;for(W=0,F=A.length;W<F;++W)i(R=A[W])&&D.indexOf(R)===-1&&(E[R]=g(C[R]));for(W=0,F=D.length;W<F;++W)if(i(R=D[W]))if(R in C)A.indexOf(R)!==-1&&(d&&h(j[R])&&Object.getPrototypeOf(j[R])!==t?E[R]=d(j[R]):E[R]=x(C[R],j[R]));else{if(y&&typeof j[R]>"u")continue;E[R]=g(j[R])}return E}function x(C,j){if(y&&typeof j>"u")return g(C);const E=Array.isArray(j),A=Array.isArray(C);return w(j)?j:h(C)?E&&A?k(C,j):E!==A?g(j):b(C,j):g(j)}function S(){switch(arguments.length){case 0:return{};case 1:return g(arguments[0]);case 2:return x(arguments[0],arguments[1])}let C;for(let j=0,E=arguments.length;j<E;++j)C=x(C,arguments[j]);return C}return s!=null&&s.all?S:x}e.exports=r,e.exports.default=r,e.exports.deepmerge=r,Object.defineProperty(e.exports,"isMergeableObject",{get:n})})(uA);var JZ=uA.exports;const QZ=oo(JZ);var ZZ=new Error("Element already at target scroll position"),eee=new Error("Scroll cancelled"),tee=Math.min,AN=Date.now,nee={left:IN("scrollLeft"),top:IN("scrollTop")};function IN(e){return function(n,r,s,i){s=s||{},typeof s=="function"&&(i=s,s={}),typeof i!="function"&&(i=see);var o=AN(),l=n[e],c=s.ease||ree,u=isNaN(s.duration)?350:+s.duration,p=!1;return l===r?i(ZZ,n[e]):requestAnimationFrame(d),f;function f(){p=!0}function d(h){if(p)return i(eee,n[e]);var y=AN(),w=tee(1,(y-o)/u),k=c(w);n[e]=k*(r-l)+l,w<1?requestAnimationFrame(d):requestAnimationFrame(function(){i(null,n[e])})}}}function ree(e){return .5*(1-Math.cos(Math.PI*e))}function see(){}const iee=oo(nee);var dA={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.Scrollparent=n()})(Vc,function(){function t(r){var s=getComputedStyle(r,null).getPropertyValue("overflow");return s.indexOf("scroll")>-1||s.indexOf("auto")>-1}function n(r){if(r instanceof HTMLElement||r instanceof SVGElement){for(var s=r.parentNode;s.parentNode;){if(t(s))return s;s=s.parentNode}return document.scrollingElement||document.documentElement}}return n})})(dA);var oee=dA.exports;const fA=oo(oee),aee=["top","right","bottom","left"],TN=["start","end"],RN=aee.reduce((e,t)=>e.concat(t,t+"-"+TN[0],t+"-"+TN[1]),[]),kl=Math.min,Do=Math.max,_p=Math.round,of=Math.floor,qs=e=>({x:e,y:e}),lee={left:"right",right:"left",bottom:"top",top:"bottom"};function qy(e,t,n){return Do(e,kl(t,n))}function Tl(e,t){return typeof e=="function"?e(t):e}function ki(e){return e.split("-")[0]}function Ys(e){return e.split("-")[1]}function pA(e){return e==="x"?"y":"x"}function Bw(e){return e==="y"?"height":"width"}function Ki(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Ww(e){return pA(Ki(e))}function hA(e,t,n){n===void 0&&(n=!1);const r=Ys(e),s=Ww(e),i=Bw(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=Ap(o)),[o,Ap(o)]}function cee(e){const t=Ap(e);return[Pp(e),t,Pp(t)]}function Pp(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const MN=["left","right"],LN=["right","left"],uee=["top","bottom"],dee=["bottom","top"];function fee(e,t,n){switch(e){case"top":case"bottom":return n?t?LN:MN:t?MN:LN;case"left":case"right":return t?uee:dee;default:return[]}}function pee(e,t,n,r){const s=Ys(e);let i=fee(ki(e),n==="start",r);return s&&(i=i.map(o=>o+"-"+s),t&&(i=i.concat(i.map(Pp)))),i}function Ap(e){const t=ki(e);return lee[t]+e.slice(t.length)}function hee(e){return{top:0,right:0,bottom:0,left:0,...e}}function mA(e){return typeof e!="number"?hee(e):{top:e,right:e,bottom:e,left:e}}function Ip(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function $N(e,t,n){let{reference:r,floating:s}=e;const i=Ki(t),o=Ww(t),l=Bw(o),c=ki(t),u=i==="y",p=r.x+r.width/2-s.width/2,f=r.y+r.height/2-s.height/2,d=r[l]/2-s[l]/2;let h;switch(c){case"top":h={x:p,y:r.y-s.height};break;case"bottom":h={x:p,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:f};break;case"left":h={x:r.x-s.width,y:f};break;default:h={x:r.x,y:r.y}}switch(Ys(t)){case"start":h[o]-=d*(n&&u?-1:1);break;case"end":h[o]+=d*(n&&u?-1:1);break}return h}async function mee(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:i,rects:o,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:p="viewport",elementContext:f="floating",altBoundary:d=!1,padding:h=0}=Tl(t,e),y=mA(h),k=l[d?f==="floating"?"reference":"floating":f],g=Ip(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(k)))==null||n?k:k.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:u,rootBoundary:p,strategy:c})),b=f==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),S=await(i.isElement==null?void 0:i.isElement(x))?await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1}:{x:1,y:1},C=Ip(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:b,offsetParent:x,strategy:c}):b);return{top:(g.top-C.top+y.top)/S.y,bottom:(C.bottom-g.bottom+y.bottom)/S.y,left:(g.left-C.left+y.left)/S.x,right:(C.right-g.right+y.right)/S.x}}const gee=50,yee=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=n,l=o.detectOverflow?o:{...o,detectOverflow:mee},c=await(o.isRTL==null?void 0:o.isRTL(t));let u=await o.getElementRects({reference:e,floating:t,strategy:s}),{x:p,y:f}=$N(u,r,c),d=r,h=0;const y={};for(let w=0;w<i.length;w++){const k=i[w];if(!k)continue;const{name:g,fn:b}=k,{x,y:S,data:C,reset:j}=await b({x:p,y:f,initialPlacement:r,placement:d,strategy:s,middlewareData:y,rects:u,platform:l,elements:{reference:e,floating:t}});p=x??p,f=S??f,y[g]={...y[g],...C},j&&h<gee&&(h++,typeof j=="object"&&(j.placement&&(d=j.placement),j.rects&&(u=j.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:s}):j.rects),{x:p,y:f}=$N(u,d,c)),w=-1)}return{x:p,y:f,placement:d,strategy:s,middlewareData:y}},xee=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:i,platform:o,elements:l,middlewareData:c}=t,{element:u,padding:p=0}=Tl(e,t)||{};if(u==null)return{};const f=mA(p),d={x:n,y:r},h=Ww(s),y=Bw(h),w=await o.getDimensions(u),k=h==="y",g=k?"top":"left",b=k?"bottom":"right",x=k?"clientHeight":"clientWidth",S=i.reference[y]+i.reference[h]-d[h]-i.floating[y],C=d[h]-i.reference[h],j=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let E=j?j[x]:0;(!E||!await(o.isElement==null?void 0:o.isElement(j)))&&(E=l.floating[x]||i.floating[y]);const A=S/2-C/2,D=E/2-w[y]/2-1,W=kl(f[g],D),F=kl(f[b],D),R=W,$=E-w[y]-F,P=E/2-w[y]/2+A,L=qy(R,P,$),T=!c.arrow&&Ys(s)!=null&&P!==L&&i.reference[y]/2-(P<R?W:F)-w[y]/2<0,O=T?P<R?P-R:P-$:0;return{[h]:d[h]+O,data:{[h]:L,centerOffset:P-L-O,...T&&{alignmentOffset:O}},reset:T}}});function wee(e,t,n){return(e?[...n.filter(s=>Ys(s)===e),...n.filter(s=>Ys(s)!==e)]:n.filter(s=>ki(s)===s)).filter(s=>e?Ys(s)===e||(t?Pp(s)!==s:!1):!0)}const bee=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,r,s;const{rects:i,middlewareData:o,placement:l,platform:c,elements:u}=t,{crossAxis:p=!1,alignment:f,allowedPlacements:d=RN,autoAlignment:h=!0,...y}=Tl(e,t),w=f!==void 0||d===RN?wee(f||null,h,d):d,k=await c.detectOverflow(t,y),g=((n=o.autoPlacement)==null?void 0:n.index)||0,b=w[g];if(b==null)return{};const x=hA(b,i,await(c.isRTL==null?void 0:c.isRTL(u.floating)));if(l!==b)return{reset:{placement:w[0]}};const S=[k[ki(b)],k[x[0]],k[x[1]]],C=[...((r=o.autoPlacement)==null?void 0:r.overflows)||[],{placement:b,overflows:S}],j=w[g+1];if(j)return{data:{index:g+1,overflows:C},reset:{placement:j}};const E=C.map(W=>{const F=Ys(W.placement);return[W.placement,F&&p?W.overflows.slice(0,2).reduce((R,$)=>R+$,0):W.overflows[0],W.overflows]}).sort((W,F)=>W[1]-F[1]),D=((s=E.filter(W=>W[2].slice(0,Ys(W[0])?2:3).every(F=>F<=0))[0])==null?void 0:s[0])||E[0][0];return D!==l?{data:{index:g+1,overflows:C},reset:{placement:D}}:{}}}},vee=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:i,rects:o,initialPlacement:l,platform:c,elements:u}=t,{mainAxis:p=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:w=!0,...k}=Tl(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const g=ki(s),b=Ki(l),x=ki(l)===l,S=await(c.isRTL==null?void 0:c.isRTL(u.floating)),C=d||(x||!w?[Ap(l)]:cee(l)),j=y!=="none";!d&&j&&C.push(...pee(l,w,y,S));const E=[l,...C],A=await c.detectOverflow(t,k),D=[];let W=((r=i.flip)==null?void 0:r.overflows)||[];if(p&&D.push(A[g]),f){const P=hA(s,o,S);D.push(A[P[0]],A[P[1]])}if(W=[...W,{placement:s,overflows:D}],!D.every(P=>P<=0)){var F,R;const P=(((F=i.flip)==null?void 0:F.index)||0)+1,L=E[P];if(L&&(!(f==="alignment"?b!==Ki(L):!1)||W.every(I=>Ki(I.placement)===b?I.overflows[0]>0:!0)))return{data:{index:P,overflows:W},reset:{placement:L}};let T=(R=W.filter(O=>O.overflows[0]<=0).sort((O,I)=>O.overflows[1]-I.overflows[1])[0])==null?void 0:R.placement;if(!T)switch(h){case"bestFit":{var $;const O=($=W.filter(I=>{if(j){const H=Ki(I.placement);return H===b||H==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(H=>H>0).reduce((H,_)=>H+_,0)]).sort((I,H)=>I[1]-H[1])[0])==null?void 0:$[0];O&&(T=O);break}case"initialPlacement":T=l;break}if(s!==T)return{reset:{placement:T}}}return{}}}},kee=new Set(["left","top"]);async function See(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=ki(n),l=Ys(n),c=Ki(n)==="y",u=kee.has(o)?-1:1,p=i&&c?-1:1,f=Tl(t,e);let{mainAxis:d,crossAxis:h,alignmentAxis:y}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof y=="number"&&(h=l==="end"?y*-1:y),c?{x:h*p,y:d*u}:{x:d*u,y:h*p}}const Nee=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:i,placement:o,middlewareData:l}=t,c=await See(t,e);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:i+c.y,data:{...c,placement:o}}}}},jee=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:i}=t,{mainAxis:o=!0,crossAxis:l=!1,limiter:c={fn:g=>{let{x:b,y:x}=g;return{x:b,y:x}}},...u}=Tl(e,t),p={x:n,y:r},f=await i.detectOverflow(t,u),d=Ki(ki(s)),h=pA(d);let y=p[h],w=p[d];if(o){const g=h==="y"?"top":"left",b=h==="y"?"bottom":"right",x=y+f[g],S=y-f[b];y=qy(x,y,S)}if(l){const g=d==="y"?"top":"left",b=d==="y"?"bottom":"right",x=w+f[g],S=w-f[b];w=qy(x,w,S)}const k=c.fn({...t,[h]:y,[d]:w});return{...k,data:{x:k.x-n,y:k.y-r,enabled:{[h]:o,[d]:l}}}}}};function gh(){return typeof window<"u"}function Rl(e){return gA(e)?(e.nodeName||"").toLowerCase():"#document"}function Dr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Zs(e){var t;return(t=(gA(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function gA(e){return gh()?e instanceof Node||e instanceof Dr(e).Node:!1}function Ps(e){return gh()?e instanceof Element||e instanceof Dr(e).Element:!1}function Ci(e){return gh()?e instanceof HTMLElement||e instanceof Dr(e).HTMLElement:!1}function ON(e){return!gh()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Dr(e).ShadowRoot}function Uu(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=As(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function Cee(e){return/^(table|td|th)$/.test(Rl(e))}function yh(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Eee=/transform|translate|scale|rotate|perspective|filter/,_ee=/paint|layout|strict|content/,wo=e=>!!e&&e!=="none";let tg;function Vw(e){const t=Ps(e)?As(e):e;return wo(t.transform)||wo(t.translate)||wo(t.scale)||wo(t.rotate)||wo(t.perspective)||!Kw()&&(wo(t.backdropFilter)||wo(t.filter))||Eee.test(t.willChange||"")||_ee.test(t.contain||"")}function Pee(e){let t=io(e);for(;Ci(t)&&!Sl(t);){if(Vw(t))return t;if(yh(t))return null;t=io(t)}return null}function Kw(){return tg==null&&(tg=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),tg}function Sl(e){return/^(html|body|#document)$/.test(Rl(e))}function As(e){return Dr(e).getComputedStyle(e)}function xh(e){return Ps(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function io(e){if(Rl(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ON(e)&&e.host||Zs(e);return ON(t)?t.host:t}function yA(e){const t=io(e);return Sl(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ci(t)&&Uu(t)?t:yA(t)}function Cu(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=yA(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),o=Dr(s);if(i){const l=Yy(o);return t.concat(o,o.visualViewport||[],Uu(s)?s:[],l&&n?Cu(l):[])}else return t.concat(s,Cu(s,[],n))}function Yy(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function xA(e){const t=As(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=Ci(e),i=s?e.offsetWidth:n,o=s?e.offsetHeight:r,l=_p(n)!==i||_p(r)!==o;return l&&(n=i,r=o),{width:n,height:r,$:l}}function Uw(e){return Ps(e)?e:e.contextElement}function rl(e){const t=Uw(e);if(!Ci(t))return qs(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=xA(t);let o=(i?_p(n.width):n.width)/r,l=(i?_p(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const Aee=qs(0);function wA(e){const t=Dr(e);return!Kw()||!t.visualViewport?Aee:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Iee(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Dr(e)?!1:t}function Jo(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=Uw(e);let o=qs(1);t&&(r?Ps(r)&&(o=rl(r)):o=rl(e));const l=Iee(i,n,r)?wA(i):qs(0);let c=(s.left+l.x)/o.x,u=(s.top+l.y)/o.y,p=s.width/o.x,f=s.height/o.y;if(i){const d=Dr(i),h=r&&Ps(r)?Dr(r):r;let y=d,w=Yy(y);for(;w&&r&&h!==y;){const k=rl(w),g=w.getBoundingClientRect(),b=As(w),x=g.left+(w.clientLeft+parseFloat(b.paddingLeft))*k.x,S=g.top+(w.clientTop+parseFloat(b.paddingTop))*k.y;c*=k.x,u*=k.y,p*=k.x,f*=k.y,c+=x,u+=S,y=Dr(w),w=Yy(y)}}return Ip({width:p,height:f,x:c,y:u})}function wh(e,t){const n=xh(e).scrollLeft;return t?t.left+n:Jo(Zs(e)).left+n}function bA(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-wh(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function Tee(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",o=Zs(r),l=t?yh(t.floating):!1;if(r===o||l&&i)return n;let c={scrollLeft:0,scrollTop:0},u=qs(1);const p=qs(0),f=Ci(r);if((f||!f&&!i)&&((Rl(r)!=="body"||Uu(o))&&(c=xh(r)),f)){const h=Jo(r);u=rl(r),p.x=h.x+r.clientLeft,p.y=h.y+r.clientTop}const d=o&&!f&&!i?bA(o,c):qs(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+p.x+d.x,y:n.y*u.y-c.scrollTop*u.y+p.y+d.y}}function Ree(e){return Array.from(e.getClientRects())}function Mee(e){const t=Zs(e),n=xh(e),r=e.ownerDocument.body,s=Do(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Do(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+wh(e);const l=-n.scrollTop;return As(r).direction==="rtl"&&(o+=Do(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:o,y:l}}const DN=25;function Lee(e,t){const n=Dr(e),r=Zs(e),s=n.visualViewport;let i=r.clientWidth,o=r.clientHeight,l=0,c=0;if(s){i=s.width,o=s.height;const p=Kw();(!p||p&&t==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}const u=wh(r);if(u<=0){const p=r.ownerDocument,f=p.body,d=getComputedStyle(f),h=p.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,y=Math.abs(r.clientWidth-f.clientWidth-h);y<=DN&&(i-=y)}else u<=DN&&(i+=u);return{width:i,height:o,x:l,y:c}}function $ee(e,t){const n=Jo(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=Ci(e)?rl(e):qs(1),o=e.clientWidth*i.x,l=e.clientHeight*i.y,c=s*i.x,u=r*i.y;return{width:o,height:l,x:c,y:u}}function FN(e,t,n){let r;if(t==="viewport")r=Lee(e,n);else if(t==="document")r=Mee(Zs(e));else if(Ps(t))r=$ee(t,n);else{const s=wA(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Ip(r)}function vA(e,t){const n=io(e);return n===t||!Ps(n)||Sl(n)?!1:As(n).position==="fixed"||vA(n,t)}function Oee(e,t){const n=t.get(e);if(n)return n;let r=Cu(e,[],!1).filter(l=>Ps(l)&&Rl(l)!=="body"),s=null;const i=As(e).position==="fixed";let o=i?io(e):e;for(;Ps(o)&&!Sl(o);){const l=As(o),c=Vw(o);!c&&l.position==="fixed"&&(s=null),(i?!c&&!s:!c&&l.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||Uu(o)&&!c&&vA(e,o))?r=r.filter(p=>p!==o):s=l,o=io(o)}return t.set(e,r),r}function Dee(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const o=[...n==="clippingAncestors"?yh(t)?[]:Oee(t,this._c):[].concat(n),r],l=FN(t,o[0],s);let c=l.top,u=l.right,p=l.bottom,f=l.left;for(let d=1;d<o.length;d++){const h=FN(t,o[d],s);c=Do(h.top,c),u=kl(h.right,u),p=kl(h.bottom,p),f=Do(h.left,f)}return{width:u-f,height:p-c,x:f,y:c}}function Fee(e){const{width:t,height:n}=xA(e);return{width:t,height:n}}function zee(e,t,n){const r=Ci(t),s=Zs(t),i=n==="fixed",o=Jo(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=qs(0);function u(){c.x=wh(s)}if(r||!r&&!i)if((Rl(t)!=="body"||Uu(s))&&(l=xh(t)),r){const h=Jo(t,!0,i,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else s&&u();i&&!r&&s&&u();const p=s&&!r&&!i?bA(s,l):qs(0),f=o.left+l.scrollLeft-c.x-p.x,d=o.top+l.scrollTop-c.y-p.y;return{x:f,y:d,width:o.width,height:o.height}}function ng(e){return As(e).position==="static"}function zN(e,t){if(!Ci(e)||As(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Zs(e)===n&&(n=n.ownerDocument.body),n}function kA(e,t){const n=Dr(e);if(yh(e))return n;if(!Ci(e)){let s=io(e);for(;s&&!Sl(s);){if(Ps(s)&&!ng(s))return s;s=io(s)}return n}let r=zN(e,t);for(;r&&Cee(r)&&ng(r);)r=zN(r,t);return r&&Sl(r)&&ng(r)&&!Vw(r)?n:r||Pee(e)||n}const Hee=async function(e){const t=this.getOffsetParent||kA,n=this.getDimensions,r=await n(e.floating);return{reference:zee(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Bee(e){return As(e).direction==="rtl"}const Wee={convertOffsetParentRelativeRectToViewportRelativeRect:Tee,getDocumentElement:Zs,getClippingRect:Dee,getOffsetParent:kA,getElementRects:Hee,getClientRects:Ree,getDimensions:Fee,getScale:rl,isElement:Ps,isRTL:Bee};function SA(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Vee(e,t){let n=null,r;const s=Zs(e);function i(){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),i();const u=e.getBoundingClientRect(),{left:p,top:f,width:d,height:h}=u;if(l||t(),!d||!h)return;const y=of(f),w=of(s.clientWidth-(p+d)),k=of(s.clientHeight-(f+h)),g=of(p),x={rootMargin:-y+"px "+-w+"px "+-k+"px "+-g+"px",threshold:Do(0,kl(1,c))||1};let S=!0;function C(j){const E=j[0].intersectionRatio;if(E!==c){if(!S)return o();E?o(!1,E):r=setTimeout(()=>{o(!1,1e-7)},1e3)}E===1&&!SA(u,e.getBoundingClientRect())&&o(),S=!1}try{n=new IntersectionObserver(C,{...x,root:s.ownerDocument})}catch{n=new IntersectionObserver(C,x)}n.observe(e)}return o(!0),i}function HN(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=Uw(e),p=s||i?[...u?Cu(u):[],...t?Cu(t):[]]:[];p.forEach(g=>{s&&g.addEventListener("scroll",n,{passive:!0}),i&&g.addEventListener("resize",n)});const f=u&&l?Vee(u,n):null;let d=-1,h=null;o&&(h=new ResizeObserver(g=>{let[b]=g;b&&b.target===u&&h&&t&&(h.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var x;(x=h)==null||x.observe(t)})),n()}),u&&!c&&h.observe(u),t&&h.observe(t));let y,w=c?Jo(e):null;c&&k();function k(){const g=Jo(e);w&&!SA(w,g)&&n(),w=g,y=requestAnimationFrame(k)}return n(),()=>{var g;p.forEach(b=>{s&&b.removeEventListener("scroll",n),i&&b.removeEventListener("resize",n)}),f==null||f(),(g=h)==null||g.disconnect(),h=null,c&&cancelAnimationFrame(y)}}const Kee=Nee,Uee=bee,qee=jee,Yee=vee,BN=xee,Gee=(e,t,n)=>{const r=new Map,s={platform:Wee,...n},i={...s.platform,_c:r};return yee(e,t,{...s,platform:i})};var Xee=typeof document<"u",Jee=function(){},Tf=Xee?m.useLayoutEffect:Jee;function Tp(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Tp(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&e.$$typeof)&&!Tp(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function NA(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function WN(e,t){const n=NA(e);return Math.round(t*n)/n}function rg(e){const t=m.useRef(e);return Tf(()=>{t.current=e}),t}function VN(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:o}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[p,f]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[d,h]=m.useState(r);Tp(d,r)||h(r);const[y,w]=m.useState(null),[k,g]=m.useState(null),b=m.useCallback(I=>{I!==j.current&&(j.current=I,w(I))},[]),x=m.useCallback(I=>{I!==E.current&&(E.current=I,g(I))},[]),S=i||y,C=o||k,j=m.useRef(null),E=m.useRef(null),A=m.useRef(p),D=c!=null,W=rg(c),F=rg(s),R=rg(u),$=m.useCallback(()=>{if(!j.current||!E.current)return;const I={placement:t,strategy:n,middleware:d};F.current&&(I.platform=F.current),Gee(j.current,E.current,I).then(H=>{const _={...H,isPositioned:R.current!==!1};P.current&&!Tp(A.current,_)&&(A.current=_,ar.flushSync(()=>{f(_)}))})},[d,t,n,F,R]);Tf(()=>{u===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,f(I=>({...I,isPositioned:!1})))},[u]);const P=m.useRef(!1);Tf(()=>(P.current=!0,()=>{P.current=!1}),[]),Tf(()=>{if(S&&(j.current=S),C&&(E.current=C),S&&C){if(W.current)return W.current(S,C,$);$()}},[S,C,$,W,D]);const L=m.useMemo(()=>({reference:j,floating:E,setReference:b,setFloating:x}),[b,x]),T=m.useMemo(()=>({reference:S,floating:C}),[S,C]),O=m.useMemo(()=>{const I={position:n,left:0,top:0};if(!T.floating)return I;const H=WN(T.floating,p.x),_=WN(T.floating,p.y);return l?{...I,transform:"translate("+H+"px, "+_+"px)",...NA(T.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:H,top:_}},[n,l,T.floating,p.x,p.y]);return m.useMemo(()=>({...p,update:$,refs:L,elements:T,floatingStyles:O}),[p,$,L,T,O])}const Qee=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?BN({element:r.current,padding:s}).fn(n):{}:r?BN({element:r,padding:s}).fn(n):{}}}},KN=(e,t)=>{const n=Kee(e);return{name:n.name,fn:n.fn,options:[e,t]}},Zee=(e,t)=>{const n=qee(e);return{name:n.name,fn:n.fn,options:[e,t]}},ete=(e,t)=>{const n=Yee(e);return{name:n.name,fn:n.fn,options:[e,t]}},tte=(e,t)=>{const n=Uee(e);return{name:n.name,fn:n.fn,options:[e,t]}},nte=(e,t)=>{const n=Qee(e);return{name:n.name,fn:n.fn,options:[e,t]}},rte={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},ste={beaconOptions:{offset:-18}},jA={back:"Back",close:"Close",last:"Last",next:"Next",nextWithProgress:"Next ({current} of {total})",open:"Open the dialog",skip:"Skip"},ite={isFixed:!1,locale:jA,placement:"bottom"},ote={continuous:!1,debug:!1,run:!1,scrollToFirstStep:!1,steps:[]},gt={INIT:"init",START:"start",STOP:"stop",RESET:"reset",PREV:"prev",NEXT:"next",GO:"go",CLOSE:"close",SKIP:"skip",UPDATE:"update",COMPLETE:"complete"},Ln={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"},Me={INIT:"init",READY:"ready",BEACON_BEFORE:"beacon_before",BEACON:"beacon",TOOLTIP_BEFORE:"tooltip_before",TOOLTIP:"tooltip",COMPLETE:"complete"},Fs={BUTTON_BACK:"button_back",BUTTON_CLOSE:"button_close",BUTTON_PRIMARY:"button_primary",BUTTON_SKIP:"button_skip",KEYBOARD:"keyboard",OVERLAY:"overlay"},ft={IDLE:"idle",READY:"ready",WAITING:"waiting",RUNNING:"running",PAUSED:"paused",SKIPPED:"skipped",FINISHED:"finished"},ate="react-joyride-portal";function lte(e){const t={};for(const n in e)e[n]!==void 0&&(t[n]=e[n]);return t}function Ka(...e){return QZ({all:!0,isMergeableObject:t=>!(!Jn.plainObject(t)||m.isValidElement(t))})(...e)}function CA(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function li(e,t={}){const{defaultValue:n,step:r,steps:s}=t;let i=eg(e);if(i)(i.includes("{current}")||i.includes("{total}"))&&r&&s&&(i=i.replace("{current}",r.toString()).replace("{total}",s.toString()));else if(m.isValidElement(e)&&!Object.values(e.props).length&&CA(e.type)==="function")try{i=li(e.type({}),t)}catch{i=eg(n)}else i=eg(n);return i}function On(e,t,n,...r){if(!e)return;const s=new Date,i=`${String(s.getHours()).padStart(2,"0")}:${String(s.getMinutes()).padStart(2,"0")}:${String(s.getSeconds()).padStart(2,"0")}.${String(s.getMilliseconds()).padStart(3,"0")}`;console.log(`${t} %c${n}%c ${i}`,"font-weight: bold","color: gray; font-weight: normal",...r)}function cte(e,t){const n=lte(t);return{...e,...n}}function Eu(){}function ute(e){return Object.keys(e)}function Rp(e,...t){if(!Jn.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 UN(e,...t){if(!Jn.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 Gy(e,t,n){const r=i=>i.replace("{current}",String(t)).replace("{total}",String(n));if(CA(e)==="string")return r(e);if(!m.isValidElement(e))return e;const{children:s}=e.props;if(Jn.string(s)&&s.includes("{current}"))return m.cloneElement(e,{children:r(s)});if(Array.isArray(s))return m.cloneElement(e,{children:s.map(i=>typeof i=="string"?r(i):Gy(i,t,n))});if(Jn.function(e.type)&&!Object.values(e.props).length)try{return Gy(e.type({}),t,n)}catch{return e}return e}function qN(e){return ute(e).sort().reduce((t,n)=>(t[n]=e[n],t),{})}function qw(){var e;return!!(typeof window<"u"&&((e=window.document)!=null&&e.createElement))}function YN(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 Yw(e){return e?e.getBoundingClientRect():null}function dte(e=!1){const{body:t,documentElement:n}=document;if(!t||!n)return 0;if(e){const r=[t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight].sort((i,o)=>i-o),s=Math.floor(r.length/2);return r.length%2===0?(r[s-1]+r[s])/2:r[s]}return Math.max(t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight)}function Jr(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 fte(e,t,n){const r=Yw(e),s=Ml(e),i=s?!s.isSameNode(wr()):!1,o=n??Ll(e);let l=0,c=(r==null?void 0:r.top)??0;return i&&o?c=(r==null?void 0:r.top)??0:s instanceof HTMLElement&&(l=s.scrollTop,!i&&!o&&(c+=l),s.isSameNode(wr())||(c+=wr().scrollTop)),Math.floor(c-t)}function Ml(e,t){if(!e)return wr();const n=fA(e);if(n){if(n.isSameNode(wr()))return t?document:wr();if(!(n.scrollHeight>n.offsetHeight))return wr()}return n}function pte(e){const t=e.getBoundingClientRect(),n=wr(),r=t.top+t.height/2,s=window.innerHeight/2;return Math.max(0,n.scrollTop+r-s)}function hte(e,t){if(!e)return 0;const n=fA(e)??wr(),r=parseFloat(getComputedStyle(e).scrollMarginTop)||0,s=Yw(n),i=n.scrollTop??0,{offsetTop:o=0,scrollTop:l=0}=n;let c=e.getBoundingClientRect().top+l;if(o&&(EA(e)||mte(e))){const p=e.getBoundingClientRect(),f=p.top-((s==null?void 0:s.top)??0),d=f+p.height,h=n.clientHeight,y=h*.2;f>=y&&d<=h-y?c=i:c=f+i}const u=Math.floor(c-t-r);return u<0?0:u}function mte(e){return e.offsetParent!==document.body}function EA(e){if(!e)return!1;const t=Ml(e);return t?!t.isSameNode(wr()):!1}function Ll(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?Ll(e.parentNode,t):!1}function af(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 GN(e){const{isFirstStep:t,scrollToFirstStep:n,step:r,target:s,targetLifecycle:i}=e;if(r.skipScroll||t&&!n&&i!==Me.TOOLTIP||r.placement==="center")return!1;const o=s!=null&&s.isConnected?Ml(s):wr(),l=o?!o.isSameNode(wr()):!1;return(r.isFixed||Ll(s))&&!l?!1:o.scrollHeight>o.clientHeight}function wr(){return document.scrollingElement??document.documentElement}function XN(e,t){const{duration:n,element:r}=t;let s=()=>{};const i=new Promise(o=>{const{scrollTop:l}=r,c=e>l?e-l:l-e;s=iee.top(r,e,{duration:c<100?50:n},()=>{o()})});return{cancel:s,promise:i}}function gte(e){const t=e.replace(/^#?([\da-f])([\da-f])([\da-f])$/i,(r,s,i,o)=>s+s+i+i+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 _A={backgroundColor:"transparent",border:0,borderRadius:0,color:"#555555",cursor:"pointer",fontSize:16,lineHeight:1,padding:0,WebkitAppearance:"none"},lf={..._A,borderRadius:4,padding:8};function yte(e,t){const{styles:n}=e,r=Ka(n??{},t.styles??{});let{width:s}=t;qw()&&(s=typeof s=="number"&&window.innerWidth<s?window.innerWidth-30:s);const i={bottom:0,left:0,overflow:"hidden",position:"absolute",right:0,top:0,zIndex:t.zIndex};return Ka({arrow:{alignItems:"center",color:t.arrowColor,display:"inline-flex",justifyContent:"center",position:"absolute"},beaconWrapper:{..._A,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(${gte(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:{...lf,color:t.primaryColor,marginLeft:"auto",marginRight:5},buttonClose:{...lf,color:t.textColor,height:12,padding:8,position:"absolute",right:0,top:0,width:12},buttonPrimary:{...lf,backgroundColor:t.primaryColor,color:t.backgroundColor},buttonSkip:{...lf,color:t.textColor,fontSize:14},floater:{display:"inline-block",filter:"drop-shadow(0 0 3px rgba(0, 0, 0, 0.3))",maxWidth:"100%",transition:"opacity 0.3s"},loader:{alignItems:"center",display:"flex",height:48,inset:0,justifyContent:"center",pointerEvents:"none",position:"fixed",width:48,zIndex:t.zIndex+1},overlay:{...i,backgroundColor:t.overlayColor},spotlight:{},tooltip:{backgroundColor:t.backgroundColor,borderRadius:5,boxSizing:"border-box",color:t.textColor,fontSize:16,maxWidth:"100%",padding:12,position:"relative",width:s},tooltipContainer:{lineHeight:1.4,textAlign:"center"},tooltipTitle:{fontSize:18,margin:0},tooltipContent:{paddingBottom:12,paddingTop:12},tooltipFooter:{alignItems:"center",display:"flex",justifyContent:"flex-end"},tooltipFooterSpacer:{flex:1}},r)}const xte=["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 Gw(e,t){if(!t)return null;const n=Ka(ite,UN(e,"arrowComponent","beaconComponent","floatingOptions","loaderComponent","locale","styles","tooltipComponent"),t),r=Ka(rte,e.options??{},UN(t,...xte)),s=yte(e,{...n,...r}),i=Ka(ste,e.floatingOptions??{},n.floatingOptions??{});return{...n,...r,locale:Ka(jA,e.locale??{},n.locale||{}),floatingOptions:i,spotlightPadding:wte(r.spotlightPadding),styles:s}}function wte(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 bte(e,t,n){const{action:r}=t,s=n&&[gt.PREV,gt.NEXT].includes(r);return e.skipBeacon||e.placement==="center"||s}function PA(e,t=!1){return Jn.plainObject(e)?e.target?!0:(On(t,"tour","target is missing from the step"),!1):(On(t,"tour","step must be an object"),!1)}function AA(e,t=!1){return Jn.array(e)?e.every(n=>PA(n,t)):(On(t,"tour","steps must be an array"),!1)}var vte=class{constructor(e){cn(this,"beaconPosition",null);cn(this,"debug");cn(this,"eventListeners",new Map);cn(this,"listeners",new Set);cn(this,"props");cn(this,"snapshot");cn(this,"state");cn(this,"steps");cn(this,"tooltipPosition",null);cn(this,"cleanupPositionData",()=>{this.beaconPosition=null,this.tooltipPosition=null});cn(this,"getPositionData",e=>e==="beacon"?this.beaconPosition:this.tooltipPosition);cn(this,"getServerSnapshot",()=>this.snapshot);cn(this,"getSnapshot",()=>this.snapshot);cn(this,"getEventState",()=>Rp(this.snapshot,"positioned"));cn(this,"getState",()=>Rp(this.snapshot,"positioned"));cn(this,"setPositionData",(e,t)=>{var r,s,i;((r=e==="beacon"?this.beaconPosition:this.tooltipPosition)==null?void 0:r.placement)!==t.placement&&On(this.debug,`step:${this.state.index}`,"positioned",`${e} ${t.placement}`),e==="beacon"?this.beaconPosition=t:this.tooltipPosition=t,(this.state.lifecycle===Me.BEACON_BEFORE||this.state.lifecycle===Me.TOOLTIP_BEFORE)&&!this.state.positioned&&this.updateState({positioned:!0});const n=(i=(s=this.getStep())==null?void 0:s.floatingOptions)==null?void 0:i.onPosition;n&&n(t)});cn(this,"setSteps",e=>{this.steps=e,this.updateState({size:e.length})});cn(this,"dispatch",(e,t)=>{const n=this.eventListeners.get(e.type);if(n)for(const r of n)try{r(e,t)}catch{}});cn(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)}});cn(this,"subscribe",e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}));cn(this,"updateState",(e,t=!1)=>{const{controlled:n,index:r}=this.state,s=this.snapshot,i=n&&!t&&e.index!==void 0?r:e.index??r,o={action:e.action??this.state.action,controlled:n,index:i,lifecycle:e.lifecycle??this.state.lifecycle,origin:e.origin??null,positioned:e.positioned??this.state.positioned,scrolling:e.scrolling??this.state.scrolling,size:e.size??this.state.size,status:e.status??this.state.status,waiting:e.waiting??this.state.waiting},l=this.applyTransitions(o);if(this.state=l,!Dw(s,l)){this.snapshot=Object.freeze({...l});for(const c of this.listeners)c(this.snapshot)}});const{initialStepIndex:t,stepIndex:n,steps:r=[]}=e??{},s=Jn.number(n);let i=0;this.debug=(e==null?void 0:e.debug)??!1,s?(i=n,Jn.number(t)&&On(this.debug,"tour","initialStepIndex is ignored in controlled mode")):Jn.number(t)&&(t>=0&&t<r.length?i=t:r.length>0&&On(this.debug,"tour","initialStepIndex is out of bounds")),this.props=e??{steps:[]},this.steps=r,this.state={action:gt.INIT,controlled:s,index:i,lifecycle:Me.INIT,origin:null,positioned:!1,scrolling:!1,size:r.length,status:r.length?ft.READY:ft.IDLE,waiting:!1},this.snapshot=Object.freeze({...this.state})}applyTransitions(e){return e.status===ft.WAITING&&e.size>0?{...e,status:ft.RUNNING}:e}getStep(e){return Gw(this.props,this.steps[e??this.state.index])}};function kte(e){return new vte(e)}function JN(e,t){return Math.min(Math.max(e,0),t)}function Ste(e,t,n){const r=m.useRef(t),s=m.useRef(n);return r.current=t,s.current=n,m.useMemo(()=>{const i=()=>e.current.getSnapshot();return{close:(k=null)=>{const{index:g,status:b}=i();b===ft.RUNNING&&e.current.updateState({action:gt.CLOSE,index:g+1,origin:k,lifecycle:Me.COMPLETE,positioned:!1,scrolling:!1,waiting:!1})},go:k=>{const{controlled:g,size:b,status:x}=i();if(g){On(r.current,"tour","go() is not supported in controlled mode");return}x===ft.RUNNING&&e.current.updateState({action:gt.GO,index:k,lifecycle:Me.COMPLETE,positioned:!1,scrolling:!1,status:k<b?x:ft.FINISHED,waiting:!1})},info:()=>Rp(e.current.getSnapshot(),"positioned"),next:k=>{const{index:g,size:b,status:x}=i();x===ft.RUNNING&&e.current.updateState({action:gt.NEXT,index:JN(g+1,b),lifecycle:Me.COMPLETE,origin:k,positioned:!1,scrolling:!1,waiting:!1})},open:()=>{const{status:k}=i();k===ft.RUNNING&&e.current.updateState({action:gt.UPDATE,lifecycle:Me.TOOLTIP_BEFORE,positioned:!1,scrolling:!1,waiting:!1})},prev:k=>{const{index:g,size:b,status:x}=i();x===ft.RUNNING&&e.current.updateState({action:gt.PREV,index:JN(g-1,b),lifecycle:Me.COMPLETE,origin:k,positioned:!1,scrolling:!1,waiting:!1})},reset:(k=!1)=>{const{controlled:g}=i();if(g){On(r.current,"tour","reset() is not supported in controlled mode");return}s.current(),e.current.updateState({action:gt.RESET,index:0,lifecycle:Me.INIT,positioned:!1,scrolling:!1,status:k?ft.RUNNING:ft.READY,waiting:!1})},skip:k=>{const{status:g}=i();g===ft.RUNNING&&e.current.updateState({action:gt.SKIP,lifecycle:Me.COMPLETE,origin:k,positioned:!1,scrolling:!1,status:ft.SKIPPED,waiting:!1})},start:k=>{const{index:g,size:b}=i();s.current(),e.current.updateState({action:gt.START,index:Jn.number(k)?k:g,lifecycle:Me.INIT,positioned:!1,scrolling:!1,status:b?ft.RUNNING:ft.WAITING,waiting:!1},!0)},stop:(k=!1)=>{const{index:g,status:b}=i();[ft.FINISHED,ft.SKIPPED].includes(b)||e.current.updateState({action:gt.STOP,index:g+(k?1:0),lifecycle:Me.COMPLETE,positioned:!1,scrolling:!1,status:ft.PAUSED,waiting:!1})}}},[e])}const Nte=new Set(["origin","positioned"]);function jte(e,t){const n=m.useRef(null);m.useEffect(()=>{if(!t)return;const r=e.current.getSnapshot();return On(!0,"tour","init",r),n.current=r,e.current.subscribe(s=>{const i=n.current;if(n.current=s,!i)return;const o={};let l=!1;for(const c of Object.keys(s))s[c]!==i[c]&&!Nte.has(c)&&(o[c]={from:i[c],to:s[c]},(c==="status"||c==="size")&&(l=!0));Object.keys(o).length&&(!l&&s.index>=s.size||On(!0,l?"tour":`step:${s.index}`,"state",o))})},[t,e])}function Cte(e,t,n){const r=m.useRef(e),s=m.useRef(t);return r.current=e,s.current=t,m.useCallback((i,o,l)=>{var u;const c={...n.current.getEventState(),error:null,scroll:null,step:o,type:i,...l};(u=r.current)==null||u.call(r,c,s.current),n.current.dispatch(c,s.current)},[n])}function Di(e,t){return{hasChanged(n){return e[n]!==t[n]},hasChangedTo(n,r){const s=e[n],i=t[n];return Array.isArray(r)?r.includes(s)&&!r.includes(i):s===r&&i!==r},previous:t}}function Ete(e){const{addFailure:t,controls:n,emitEvent:r,previousState:s,props:i,state:o,step:l,store:c}=e,{action:u,index:p,lifecycle:f,positioned:d,scrolling:h,size:y,status:w}=o,k=sA(l)??null,g=m.useRef(null),b=m.useRef(i),x=m.useRef(o),S=m.useRef(s),C=m.useRef(l),j=m.useRef(k),E=m.useRef(n),A=m.useRef(null),D=m.useRef(null),W=m.useRef(null);b.current=i,x.current=o,S.current=s,C.current=l,j.current=k,E.current=n;const F=()=>{A.current&&(clearInterval(A.current),A.current=null),D.current=null,W.current&&(W.current.cancel(),W.current=null)};m.useEffect(()=>{if(!S.current)return;const{hasChangedTo:R}=Di(x.current,S.current);(R("action",[gt.NEXT,gt.PREV,gt.SKIP,gt.CLOSE])||g.current===gt.CLOSE&&u===gt.START)&&(g.current=u)},[u]),m.useEffect(()=>{if(!S.current)return()=>{F()};const{hasChanged:R}=Di(x.current,S.current),$=C.current;if(R("index")&&F(),w!==ft.RUNNING||!$||f!==Me.INIT)return()=>{F()};const{hasChangedTo:P}=Di(x.current,S.current);P("status",ft.RUNNING)&&[ft.IDLE,ft.READY,ft.PAUSED].includes(S.current.status)&&r(Ln.TOUR_START,$),c.current.cleanupPositionData();const{debug:L}=b.current;if($.before&&!W.current){On(L,`step:${p}`,"before()",$),W.current={cancel:()=>{}},c.current.updateState({waiting:!0}),r(Ln.STEP_BEFORE_HOOK,$,{action:g.current??x.current.action});const T=()=>{W.current=null,c.current.updateState({action:g.current??x.current.action,waiting:!1,lifecycle:Me.READY})},O=new AbortController,I=$.beforeTimeout;W.current={cancel:()=>O.abort()};const H=I?setTimeout(()=>{O.signal.aborted||(On(L,`step:${p}`,"before()","timed out",`${I}ms`),O.abort(),t($,"before_hook"),r(Ln.ERROR,$,{error:new Error("Step before hook timed out")}),T())},I):null;$.before({...c.current.getState(),action:g.current??c.current.getState().action,step:$}).then(()=>{O.signal.aborted||(H&&clearTimeout(H),T())}).catch(_=>{O.signal.aborted||(H&&clearTimeout(H),t($,"before_hook"),r(Ln.ERROR,$,{error:_ instanceof Error?_:new Error(String(_))}),T())})}else if(!W.current){A.current&&D.current!==$.target&&F();const T=Jr($.target);if(T&&af(T))F(),c.current.updateState({action:g.current??gt.UPDATE,lifecycle:Me.READY,waiting:!1});else if($.targetWaitTimeout===0)c.current.updateState({action:g.current??gt.UPDATE,lifecycle:Me.READY,waiting:!1});else if(!A.current){const{targetWaitTimeout:O}=$,I=Date.now();D.current=$.target,On(L,`step:${p}`,"polling","started",`${O}ms`),c.current.updateState({waiting:!0}),A.current=setInterval(()=>{const H=Jr($.target),_=Date.now()-I,Y=_>=O;(H&&af(H)||Y)&&(On(L,`step:${p}`,"polling",H&&af(H)?"found":"timed out",`${_}ms`),F(),c.current.updateState({action:g.current??gt.UPDATE,lifecycle:Me.READY,waiting:!1}))},100)}}return()=>{F()}},[t,r,p,f,w,c]),m.useEffect(()=>{if(!S.current)return;const{hasChanged:R,hasChangedTo:$,previous:P}=Di(x.current,S.current),L=C.current;if(!L)return;const T=Jr(L.target),O=!!T;if(O&&af(T)){if($("lifecycle",Me.READY)&&P.lifecycle===Me.INIT&&r(Ln.STEP_BEFORE,L,{action:g.current??x.current.action}),$("lifecycle",Me.READY)){const I=x.current,H=bte(L,I,b.current.continuous)?Me.TOOLTIP:Me.BEACON,_=Jr(L.scrollTarget??L.spotlightTarget??L.target),Y=GN({isFirstStep:I.index===0,scrollToFirstStep:b.current.scrollToFirstStep,step:L,target:_,targetLifecycle:H}),U=H===Me.TOOLTIP?Me.TOOLTIP_BEFORE:Me.BEACON_BEFORE;On(b.current.debug,`step:${p}`,"scroll",Y?"needed":"skipped"),c.current.updateState({action:gt.UPDATE,lifecycle:U,scrolling:Y})}}else if(x.current.status===ft.RUNNING&&f!==Me.INIT&&f!==Me.COMPLETE&&R("lifecycle")){On(b.current.debug,`step:${p}`,O?"Target not visible":"Target not mounted",L),t(L,"target_not_found"),r(Ln.TARGET_NOT_FOUND,L);const I=x.current;I.controlled||c.current.updateState({action:gt.UPDATE,index:I.index+(I.action===gt.PREV?-1:1),lifecycle:Me.INIT})}},[t,r,p,f,c]),m.useEffect(()=>{if(!S.current)return;const{hasChangedTo:R,previous:$}=Di(x.current,S.current),P=C.current,L=j.current;if(P&&R("lifecycle",Me.TOOLTIP_BEFORE)&&$.lifecycle===Me.BEACON){const I=Jr(P.scrollTarget??P.spotlightTarget??P.target);if(GN({isFirstStep:x.current.index===0,scrollToFirstStep:b.current.scrollToFirstStep,step:P,target:I,targetLifecycle:Me.TOOLTIP})){c.current.updateState({scrolling:!0,positioned:!1});return}}const T=f===Me.BEACON_BEFORE||f===Me.TOOLTIP_BEFORE;if(P&&T&&!h){const I=f===Me.TOOLTIP_BEFORE?Me.TOOLTIP:Me.BEACON;c.current.updateState({action:gt.UPDATE,lifecycle:I})}P&&R("lifecycle",Me.BEACON)&&r(Ln.BEACON,P),P&&R("lifecycle",Me.TOOLTIP)&&r(Ln.TOOLTIP,P);const O=x.current;if((O.status===ft.RUNNING||O.controlled&&O.status===ft.PAUSED&&P)&&L&&R("lifecycle",Me.COMPLETE)&&$.lifecycle===Me.TOOLTIP&&(r(Ln.STEP_AFTER,L,{action:g.current??gt.UPDATE,index:$.index??O.index,lifecycle:O.lifecycle}),L.after)){r(Ln.STEP_AFTER_HOOK,L,{action:g.current??gt.UPDATE,index:$.index??O.index,lifecycle:O.lifecycle});try{L.after({...c.current.getState(),action:g.current??gt.UPDATE,index:$.index??O.index,lifecycle:O.lifecycle,step:L})}catch{}}},[r,f,d,h,c]),m.useEffect(()=>{if(!S.current)return;const{hasChangedTo:R,previous:$}=Di(x.current,S.current),P=C.current,L=j.current;y&&!P&&f===Me.INIT&&c.current.updateState({action:gt.UPDATE,lifecycle:Me.COMPLETE,status:ft.FINISHED}),!x.current.controlled&&w===ft.RUNNING&&R("lifecycle",Me.COMPLETE)&&p<y&&c.current.updateState({action:gt.UPDATE,lifecycle:Me.INIT}),R("lifecycle",Me.COMPLETE)&&p>=y&&c.current.updateState({action:gt.UPDATE,lifecycle:Me.COMPLETE,status:ft.FINISHED});const T=P??L??Gw(b.current,b.current.steps[p-1]);if(T&&R("status",[ft.FINISHED,ft.SKIPPED])){let O;P?O=p:L?O=$.index??p:O=p-1,r(Ln.TOUR_END,T,{index:O}),x.current.controlled||E.current.reset(),g.current=null}P&&R("action",gt.STOP)&&(g.current=null,r(Ln.TOUR_STATUS,P)),P&&R("action",gt.RESET)&&(r(Ln.TOUR_STATUS,P),g.current=null)},[u,r,p,f,y,w,c])}function _te({controls:e,emitEvent:t,props:n,state:r,store:s}){const{debug:i,initialStepIndex:o,run:l,stepIndex:c,steps:u}=n,p=m.useRef(void 0),f=m.useRef(r),d=m.useRef(e);f.current=r,d.current=e,m.useEffect(()=>{const h=p.current;if(p.current=n,!h||n===h)return;const{hasChanged:y}=Di(n,h);if(Dw(h.steps,u)||(AA(u,i)?s.current.setSteps(u):(On(i,"tour","Steps are not valid",u),t(Ln.ERROR,u[0]??{target:"",content:""},{error:new Error("Steps are not valid")}))),y("run"))l?s.current.getState().size&&d.current.start(c??o):d.current.stop();else if(Jn.number(c)&&y("stepIndex")){const w=Jn.number(h.stepIndex)&&h.stepIndex<c?gt.NEXT:gt.PREV;[ft.FINISHED,ft.SKIPPED].includes(f.current.status)||s.current.updateState({action:w,index:c,lifecycle:Me.INIT,positioned:!1},!0)}},[i,t,o,n,l,c,u,s])}function Pte(e,t){var l,c,u,p;const{beaconPosition:n,lifecycle:r,scrollOffset:s,step:i}=t;if(i.scrollTarget||i.spotlightTarget)return Math.max(0,e);let o=e-i.spotlightPadding.top;if(r===Me.BEACON_BEFORE&&(n!=null&&n.placement)){const f=Ate(n);["bottom"].includes(n.placement)||(o+=Math.floor(f-s))}else if(r===Me.TOOLTIP_BEFORE){const{placement:f}=i;if(f==="top"){const d=((l=document.querySelector(".react-joyride__floater"))==null?void 0:l.getBoundingClientRect().height)??0,h=(c=i.floatingOptions)!=null&&c.hideArrow?0:i.arrowSize,y=i.offset+i.spotlightPadding.top+h;o-=d+y}else if(f==="left"||f==="right"){const d=((u=document.querySelector(".react-joyride__floater"))==null?void 0:u.getBoundingClientRect().height)??0,h=((p=Jr(i.target))==null?void 0:p.getBoundingClientRect().height)??0,y=s+i.spotlightPadding.top+h/2-d/2;y<s&&(o-=s-y)}}return Math.max(0,o)}function Ate(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 Ite({emitEvent:e,previousState:t,props:n,state:r,step:s,store:i}){const{index:o,lifecycle:l,positioned:c,scrolling:u,status:p}=r,f=m.useRef(null),d=m.useRef(r),h=m.useRef(t),y=m.useRef(n),w=m.useRef(s);d.current=r,h.current=t,y.current=n,w.current=s,m.useEffect(()=>()=>{var k;(k=f.current)==null||k.call(f)},[]),m.useEffect(()=>{var C;if(!h.current||!w.current)return;const{hasChangedTo:k}=Di(d.current,h.current),g=w.current,{debug:b}=y.current,{scrollDuration:x}=g,S=l===Me.BEACON_BEFORE||l===Me.TOOLTIP_BEFORE;if(p===ft.RUNNING&&S&&u&&k("positioned",!0)){const j=Jr(g.scrollTarget??g.spotlightTarget??g.target),E=i.current.getPositionData("beacon"),A=Ml(j),D=A?!A.isSameNode(wr()):!1;(C=f.current)==null||C.call(f),(async()=>{if(D&&!Ll(A)){const O=wr(),I=pte(A),H={initial:O.scrollTop,target:I,element:O,duration:x};e(Ln.SCROLL_START,g,{scroll:H});const{cancel:_,promise:Y}=XN(I,{element:O,duration:x});f.current=_,await Y,e(Ln.SCROLL_END,g,{scroll:H})}const F=Math.floor(hte(j,g.scrollOffset))||0,R=D?F:Pte(F,{beaconPosition:E,lifecycle:l,scrollOffset:g.scrollOffset,step:g});On(b,`step:${o}`,"scroll",D?"custom":"document",`${F} → ${R}`);const $=A,P={initial:$.scrollTop,target:R,element:$,duration:x};e(Ln.SCROLL_START,g,{scroll:P});const{cancel:L,promise:T}=XN(R,{element:$,duration:x});f.current=L,await T,e(Ln.SCROLL_END,g,{scroll:P}),i.current.updateState({scrolling:!1})})().catch(()=>{i.current.updateState({scrolling:!1})})}},[e,o,l,c,u,p,i])}function Tte(e){const t=hZ(()=>cte(ote,e),[e]),{debug:n,initialStepIndex:r,onEvent:s,run:i,stepIndex:o,steps:l}=t,c=m.useRef(kte(t)),u=HE.useSyncExternalStore(c.current.subscribe,c.current.getSnapshot,c.current.getServerSnapshot),[p,f]=m.useState([]),d=m.useCallback((C,j)=>{f(E=>[...E,{reason:j,step:C}])},[]),h=m.useCallback(()=>{f([])},[]);jte(c,n);const y=Ste(c,n,h),w=Cte(s,y,c),{index:k,size:g,status:b}=u,x=sA(u),S=m.useMemo(()=>Gw(t,l[k]),[k,t,l]);return mZ(()=>{i&&g&&AA(l,n)&&y.start(o??r)}),pZ(()=>{i&&g&&b===ft.IDLE&&c.current.updateState({status:ft.READY})},[i,g,b]),_te({controls:y,emitEvent:w,props:t,state:u,store:c}),Ete({addFailure:d,controls:y,emitEvent:w,previousState:x,props:t,state:u,step:S,store:c}),Ite({emitEvent:w,previousState:x,props:t,state:u,step:S,store:c}),{controls:y,failures:p,mergedProps:t,state:u,step:S,store:c}}function Rte(e){const[t,n]=m.useState(null);return m.useEffect(()=>{let r=null,s=!1;if(e)if(Jn.domElement(e))r=e,s=!0;else{const i=document.querySelector(e);i&&(r=i)}else{const i=document.createElement("div");i.id=ate,document.body.appendChild(i),r=i}return n(r),()=>{!r||s||r.parentNode===document.body&&document.body.removeChild(r)}},[e]),t}const Mte={animation:"joyride-loader-spin 1s linear infinite",border:"5px solid rgba(0, 0, 0, 0.1)",borderRadius:"50%",borderTopColor:"#555"};function Lte({nonce:e,step:t}){const{loaderComponent:n}=t,r=!!n;if(m.useEffect(()=>{if(r||document.getElementById("joyride-loader-animation"))return Eu;const c=document.createElement("style");return c.id="joyride-loader-animation",e&&c.setAttribute("nonce",e),c.appendChild(document.createTextNode(`
221
- @keyframes joyride-loader-spin {
222
- to { transform: rotate(360deg); }
223
- }
224
- `)),document.head.appendChild(c),()=>{const u=document.getElementById("joyride-loader-animation");u!=null&&u.parentNode&&u.parentNode.removeChild(u)}},[r,e]),n===null)return null;const{height:s,width:i,...o}=t.styles.loader;let l;if(n){const c=n;l=Ye.createElement(c,{step:t})}else l=Ye.createElement("div",{style:{...Mte,height:s,width:i,borderTopColor:t.primaryColor}});return Ye.createElement("div",{className:"react-joyride__loader","data-testid":"loader",style:o},l)}const $te={height:0,isFixed:!1,left:0,top:0,width:0};function mc(e,t){const n=Jr(e);if(!n)return $te;const r=Yw(n),s=Ll(n),i=fte(n,t.top,s);return{height:Math.round(((r==null?void 0:r.height)??0)+t.top+t.bottom),isFixed:s,left:Math.round(((r==null?void 0:r.left)??0)-t.left),top:i,width:Math.round(((r==null?void 0:r.width)??0)+t.left+t.right)}}function Ote(e,t,n){const[r,s]=m.useState(()=>mc(e,t)),i=m.useRef(void 0),o=m.useRef(null),l=m.useRef(n),c=m.useRef(null),u=m.useCallback(()=>{clearTimeout(i.current),i.current=window.setTimeout(()=>{s(f=>{const d=mc(e,t);return f.top===d.top&&f.left===d.left&&f.width===d.width&&f.height===d.height&&f.isFixed===d.isFixed?f:d})},100)},[e,t]);m.useEffect(()=>{let f=null;const d=y=>{o.current=Ml(y,!0),o.current&&o.current.addEventListener("scroll",u,{passive:!0}),window.addEventListener("scroll",u,{passive:!0}),window.addEventListener("resize",u),typeof ResizeObserver<"u"&&(c.current=new ResizeObserver(u),c.current.observe(y)),s(mc(e,t))},h=Jr(e);return h?d(h):(f=new MutationObserver(()=>{const y=Jr(e);y&&(f==null||f.disconnect(),f=null,d(y))}),f.observe(document.body,{childList:!0,subtree:!0})),()=>{var y;f==null||f.disconnect(),o.current&&o.current.removeEventListener("scroll",u),window.removeEventListener("scroll",u),window.removeEventListener("resize",u),(y=c.current)==null||y.disconnect(),clearTimeout(i.current)}},[e,t,u]),m.useEffect(()=>{l.current&&!n&&s(mc(e,t)),l.current=n},[n,e,t]);let p=r;return l.current&&!n&&(p=mc(e,t)),p}function Dte(e,t,n){let r=`M0 0H${e}V${t}H0Z`;return n&&(r+=` ${n}`),r}function QN(e,t,n,r,s){if(n<=0||r<=0)return"";const i=Math.max(0,Math.min(s,n/2,r/2));let o=`M${e+i} ${t}`;return o+=`H${e+n-i}`,o+=`A${i} ${i} 0 0 1 ${e+n} ${t+i}`,o+=`V${t+r-i}`,o+=`A${i} ${i} 0 0 1 ${e+n-i} ${t+r}`,o+=`H${e+i}`,o+=`A${i} ${i} 0 0 1 ${e} ${t+r-i}`,o+=`V${t+i}`,o+=`A${i} ${i} 0 0 1 ${e+i} ${t}Z`,o}const Fte=[Me.BEACON_BEFORE,Me.BEACON];function zte(e){var T,O;const{blockTargetInteraction:t,continuous:n,hideOverlay:r,lifecycle:s,onClickOverlay:i,overlayClickAction:o,placement:l,portalElement:c,scrolling:u,spotlightPadding:p,spotlightRadius:f,spotlightTarget:d,styles:h,target:y,waiting:w}=e,k=gZ(),g=Ote(d??y,p,u||w),b=m.useRef(null),x=(s===Me.TOOLTIP||s===Me.TOOLTIP_BEFORE)&&l!=="center",[S,C]=m.useState(!1),j=c?(T=b.current)==null?void 0:T.offsetParent:null,E=(j==null?void 0:j.clientWidth)??k.width,A=(j==null?void 0:j.clientHeight)??dte()??k.height,D=((O=h.overlay)==null?void 0:O.backgroundColor)??"rgba(0, 0, 0, 0.5)",W=m.useMemo(()=>{const{backgroundColor:I,mixBlendMode:H,..._}=h.overlay;return{height:A,pointerEvents:"none",..._}},[A,h.overlay]),F=x&&!u&&!w;m.useEffect(()=>{F?requestAnimationFrame(()=>C(!0)):C(!1)},[F]);const R=n&&Fte.includes(s),$=!n&&s!==Me.TOOLTIP;if(r||!w&&(R||$))return null;let P="";if(F)if(c&&j){const I=Jr(d??y);if(I){const H=YN(I),_=YN(j);P=QN(H.left-_.left-p.left,H.top-_.top-p.top,I.offsetWidth+p.left+p.right,I.offsetHeight+p.top+p.bottom,f)}}else P=QN(g.left,g.top,g.width,g.height,f);const L=Dte(E,A,P);return Ye.createElement("div",{ref:b,"aria-hidden":"true",className:"react-joyride__overlay","data-testid":"overlay",style:W},Ye.createElement("svg",{className:"react-joyride__spotlight","data-testid":"spotlight",style:{height:A,left:0,position:g.isFixed?"fixed":"absolute",top:0,width:E}},Ye.createElement("path",{d:L,fill:D,fillRule:"evenodd",onClick:i,style:{cursor:o?"pointer":"default",pointerEvents:"auto"}}),P&&Ye.createElement("path",{d:P,fill:D,style:{opacity:S?0:1,pointerEvents:t?"auto":"none",transition:"opacity 0.2s"}}),P&&Object.keys(h.spotlight).length>0&&Ye.createElement("path",{d:P,fill:"none",style:{pointerEvents:"none"},...h.spotlight})))}function IA(e){const{children:t,element:n}=e;return n?ar.createPortal(t,n):null}const Hte='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), area[href], [tabindex]:not([tabindex="-1"]), [contenteditable]';function Bte(e,t){const n=m.useRef(null);m.useEffect(()=>{if(!e)return Eu;n.current=document.activeElement;const r=i=>{if(i.key!=="Tab")return;const o=[...e.querySelectorAll(Hte)],{shiftKey:l}=i;if(!o.length)return;i.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 s;{const i=e.querySelector(t);i&&(s=setTimeout(()=>{i.focus({preventScroll:!0})},100))}return()=>{var i;e.removeEventListener("keydown",r),s!==void 0&&clearTimeout(s),(i=n.current)==null||i.focus({preventScroll:!0})}},[e,t])}function hi(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 Wte(e,t,n){const[r]=e.split("-");switch(r){case"top":return{points:`0,0 ${t/2},${n} ${t},0`,...hi(e,t,n)};case"bottom":return{points:`${t},${n} ${t/2},0 0,${n}`,...hi(e,t,n)};case"left":return{points:`0,0 ${n},${t/2} 0,${t}`,...hi(e,t,n)};case"right":return{points:`${n},${t} ${n},0 0,${t/2}`,...hi(e,t,n)};default:return null}}function Vte(e,t,n,r){if(!t)return{};const[s]=e.split("-");switch(s){case"top":return{bottom:-n,left:t.x??0,...hi(e,r,n)};case"bottom":return{top:-n,left:t.x??0,...hi(e,r,n)};case"left":return{right:-n,top:t.y??0,...hi(e,r,n)};case"right":return{left:-n,top:t.y??0,...hi(e,r,n)};default:return{}}}function Kte({arrowComponent:e,arrowRef:t,base:n,placement:r,position:s,size:i,styles:o}){const l=e;let c=null;if(l){if(!hi(r,n,i))return null;c=Ye.createElement("span",{style:{flexShrink:0}},Ye.createElement(l,{base:n,placement:r,size:i}))}else{const u=Wte(r,n,i);if(!u)return null;c=Ye.createElement("svg",{height:u.height,width:u.width,xmlns:"http://www.w3.org/2000/svg"},Ye.createElement("polygon",{fill:"currentColor",points:u.points}))}return Ye.createElement("span",{ref:t,className:"react-joyride__arrow","data-testid":"arrow",style:{...o,...Vte(r,s,i,n),...s?{}:{visibility:"hidden"}}},c)}function Ute(e){const{beaconComponent:t,continuous:n,index:r,isLastStep:s,locale:i,nonce:o,onInteract:l,shouldFocus:c,size:u,step:p,styles:f}=e,d=m.useRef(null),h=!!t;m.useEffect(()=>{if(h||document.getElementById("joyride-beacon-animation"))return Eu;const k=document.createElement("style");k.id="joyride-beacon-animation",o&&k.setAttribute("nonce",o),k.appendChild(document.createTextNode(`
225
- @keyframes joyride-beacon-inner {
226
- 20% {
227
- opacity: 0.9;
228
- }
229
-
230
- 90% {
231
- opacity: 0.7;
232
- }
233
- }
234
-
235
- @keyframes joyride-beacon-outer {
236
- 0% {
237
- transform: scale(1);
238
- }
239
-
240
- 45% {
241
- opacity: 0.7;
242
- transform: scale(0.75);
243
- }
244
-
245
- 100% {
246
- opacity: 0.9;
247
- transform: scale(1);
248
- }
249
- }
250
- `)),document.head.appendChild(k);const g=setTimeout(()=>{Jn.domElement(d.current)&&c&&d.current.focus()},0);return()=>{clearTimeout(g);const b=document.getElementById("joyride-beacon-animation");b!=null&&b.parentNode&&b.parentNode.removeChild(b)}},[h,o,c]);const y=li(i.open);let w;if(t){const k=t;w=Ye.createElement(k,{continuous:n,index:r,isLastStep:s,size:u,step:p})}else w=Ye.createElement("span",{style:f.beacon},Ye.createElement("span",{style:f.beaconOuter}),Ye.createElement("span",{style:f.beaconInner}));return Ye.createElement("button",{ref:d,"aria-label":y,className:"react-joyride__beacon","data-testid":"button-beacon",onClick:l,onMouseEnter:l,style:f.beaconWrapper,title:y,type:"button"},w)}function qte({styles:e,...t}){const{color:n,height:r,width:s,...i}=e;return Ye.createElement("button",{style:i,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 s=="number"?`${s}px`:s,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 Yte(e){const{backProps:t,closeProps:n,index:r,isLastStep:s,primaryProps:i,skipProps:o,step:l,tooltipProps:c}=e,{buttons:u,content:p,styles:f,title:d}=l,h={};u.includes("primary")&&(h.primary=Ye.createElement("button",{"data-testid":"button-primary",style:f.buttonPrimary,type:"button",...i})),u.includes("skip")&&!s&&(h.skip=Ye.createElement("button",{"aria-live":"off","data-testid":"button-skip",style:f.buttonSkip,type:"button",...o})),u.includes("back")&&r>0&&(h.back=Ye.createElement("button",{"data-testid":"button-back",style:f.buttonBack,type:"button",...t})),h.close=u.includes("close")&&Ye.createElement(qte,{"data-testid":"button-close",styles:f.buttonClose,...n});const y=d?{"aria-labelledby":"joyride-tooltip-title","aria-describedby":"joyride-tooltip-content"}:{"aria-label":li(p),"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,...y},Ye.createElement("div",{style:f.tooltipContainer},d&&Ye.createElement("h4",{id:"joyride-tooltip-title",style:f.tooltipTitle},d),Ye.createElement("div",{id:"joyride-tooltip-content",style:f.tooltipContent},p)),u.some(w=>w==="back"||w==="primary"||w==="skip")&&Ye.createElement("div",{style:f.tooltipFooter},Ye.createElement("div",{style:f.tooltipFooterSpacer},h.skip),h.back,h.primary),h.close)}function Gte(e){const{continuous:t,controls:n,index:r,isLastStep:s,size:i,step:o}=e,l=g=>{g.preventDefault(),n.prev(Fs.BUTTON_BACK)},c=g=>{g.preventDefault(),o.closeButtonAction==="skip"?n.skip(Fs.BUTTON_CLOSE):n.close(Fs.BUTTON_CLOSE)},u=g=>{if(g.preventDefault(),!t){n.close(Fs.BUTTON_PRIMARY);return}n.next(Fs.BUTTON_PRIMARY)},p=g=>{g.preventDefault(),n.skip(Fs.BUTTON_SKIP)},f=()=>{const{back:g,close:b,last:x,next:S,nextWithProgress:C,skip:j}=o.locale,E=li(g),A=li(b),D=li(x),W=li(S),F=li(j);let R=b,$=A;if(t){if(R=S,$=W,o.showProgress&&!s){const P=li(C,{step:r+1,steps:i});R=Gy(C,r+1,i),$=P}s&&(R=x,$=D)}return{backProps:{"aria-label":E,children:g,"data-action":"back",onClick:l,role:"button",title:E},closeProps:{"aria-label":A,children:b,"data-action":"close",onClick:c,role:"button",title:A},primaryProps:{"aria-label":$,children:R,"data-action":"primary",onClick:u,role:"button",title:$},skipProps:{"aria-label":F,children:j,"data-action":"skip",onClick:p,role:"button",title:F},tooltipProps:{"aria-modal":!0,role:"alertdialog"}}},{arrowComponent:d,beaconComponent:h,tooltipComponent:y,...w}=o;let k;if(y){const g=y;k=Ye.createElement(g,{...f(),continuous:t,controls:n,index:r,isLastStep:s,size:i,step:w})}else k=Ye.createElement(Yte,{...f(),continuous:t,controls:n,index:r,isLastStep:s,size:i,step:w});return k}function Xte(e){if(e.startsWith("left"))return["top","bottom"];if(e.startsWith("right"))return["bottom","top"]}function Jte(e,t,n){var r,s;return e?[tte()]:((r=t.floatingOptions)==null?void 0:r.flipOptions)===!1?[]:[ete({crossAxis:!1,fallbackPlacements:Xte(n),padding:20,...(s=t.floatingOptions)==null?void 0:s.flipOptions})]}function Qte(e){var H,_,Y,U,V;const{continuous:t,controls:n,index:r,lifecycle:s,nonce:i,open:o,portalElement:l,setPositionData:c,setTooltipRef:u,shouldScroll:p,size:f,step:d,target:h,updateState:y}=e,w=m.useRef(null),k=m.useRef({}),g=m.useRef({}),b=d.placement==="center",x=d.placement==="auto",S=m.useMemo(()=>({getBoundingClientRect:()=>({x:window.innerWidth/2,y:window.innerHeight/2,top:window.innerHeight/2,left:window.innerWidth/2,bottom:window.innerHeight/2,right:window.innerWidth/2,width:0,height:0})}),[]),C=m.useMemo(()=>EA(h)?Ml(h):void 0,[h]),j=m.useMemo(()=>Ll(h),[h]),E=m.useMemo(()=>C?{boundary:C,rootBoundary:"viewport"}:{},[C]),A=b||x?"bottom":d.placement,D=b?"fixed":((H=d.floatingOptions)==null?void 0:H.strategy)??(d.isFixed||j?"fixed":"absolute"),W=m.useMemo(()=>{var Z,ue,le,we;return b?[{name:"center",fn:({rects:re})=>({x:(window.innerWidth-re.floating.width)/2,y:(window.innerHeight-re.floating.height)/2})}]:[KN(({placement:re})=>{var ie;let ye="right";re.startsWith("top")?ye="top":re.startsWith("bottom")?ye="bottom":re.startsWith("left")&&(ye="left");const te=d.spotlightTarget?0:d.spotlightPadding[ye];return d.offset+te+((ie=d.floatingOptions)!=null&&ie.hideArrow?0:d.arrowSize)},[d.offset,d.spotlightPadding,d.spotlightTarget,d.arrowSize,(Z=d.floatingOptions)==null?void 0:Z.hideArrow]),...Jte(x,d,A),Zee({padding:10,...E,...(ue=d.floatingOptions)==null?void 0:ue.shiftOptions}),...(le=d.floatingOptions)!=null&&le.hideArrow?[]:[nte({element:w,padding:d.arrowSpacing},[d.arrowSpacing,d.arrowBase])],...((we=d.floatingOptions)==null?void 0:we.middleware)??[]]},[b,d,x,A,E]),F=VN({...b?{elements:{reference:S}}:{},placement:A,strategy:D,middleware:W}),R=VN({strategy:D,placement:d.beaconPlacement??(x||b?"bottom":d.placement),middleware:m.useMemo(()=>{var Z,ue;return[KN(((ue=(Z=d.floatingOptions)==null?void 0:Z.beaconOptions)==null?void 0:ue.offset)??-18)]},[(Y=(_=d.floatingOptions)==null?void 0:_.beaconOptions)==null?void 0:Y.offset]),whileElementsMounted:HN});g.current=F.middlewareData,k.current=R.middlewareData,m.useEffect(()=>{var le;const{floating:Z,reference:ue}=F.elements;if(!(!ue||!Z||s!==Me.TOOLTIP))return HN(ue,Z,F.update,(le=d.floatingOptions)==null?void 0:le.autoUpdate)},[s,F.update,(U=d.floatingOptions)==null?void 0:U.autoUpdate,d.target,F.elements]),m.useEffect(()=>{!b&&h&&F.refs.setReference(h),h&&R.refs.setReference(h)},[R.refs,b,h,F.refs]),m.useEffect(()=>{F.isPositioned&&c("tooltip",{placement:F.placement,x:F.x??0,y:F.y??0,middlewareData:g.current})},[c,F.isPositioned,F.placement,F.x,F.y]),m.useEffect(()=>{R.isPositioned&&c("beacon",{placement:R.placement,x:R.x??0,y:R.y??0,middlewareData:k.current})},[c,R.isPositioned,R.placement,R.x,R.y]);const $=d.zIndex+100,P=m.useCallback(Z=>{Z.type==="mouseenter"&&d.beaconTrigger!=="hover"||y({lifecycle:Me.TOOLTIP_BEFORE,positioned:!1})},[d.beaconTrigger,y]),L=m.useCallback(Z=>{Z&&(F.refs.setFloating(Z),u(Z))},[F.refs,u]),{arrow:T,floater:O}=d.styles;let I=null;if(s===Me.TOOLTIP||s===Me.TOOLTIP_BEFORE){const Z=qN({...O,...F.floatingStyles,zIndex:$,opacity:o&&F.isPositioned?1:0,...!o&&{transition:"none"}});I=Ye.createElement("div",{ref:L,className:"react-joyride__floater","data-testid":"floater",id:`react-joyride-step-${r}`,style:Z},Ye.createElement(Gte,{continuous:t,controls:n,index:r,isLastStep:r+1===f,size:f,step:d}),!b&&!((V=d.floatingOptions)!=null&&V.hideArrow)&&Ye.createElement(Kte,{arrowComponent:d.arrowComponent,arrowRef:w,base:d.arrowBase,placement:F.placement,position:F.middlewareData.arrow,size:d.arrowSize,styles:T}))}else(s===Me.BEACON||s===Me.BEACON_BEFORE)&&(I=Ye.createElement("div",{ref:R.refs.setFloating,className:"react-joyride__floater","data-testid":"floater-beacon",id:`react-joyride-step-${r}-beacon`,style:qN({...R.floatingStyles,zIndex:$})},Ye.createElement(Ute,{beaconComponent:d.beaconComponent,continuous:t,index:r,isLastStep:r+1===f,locale:d.locale,nonce:i,onInteract:P,shouldFocus:p,size:f,step:d,styles:d.styles})));return Ye.createElement(IA,{element:l},I)}function Zte(e){const{continuous:t,controls:n,index:r,lifecycle:s,nonce:i,portalElement:o,setPositionData:l,shouldScroll:c,size:u,step:p,updateState:f}=e,[d,h]=m.useState(null);Bte(p.disableFocusTrap?null:d,"[data-action=primary]");const y=Jr(p.target),w=s===Me.TOOLTIP;return!PA(p)||!Jn.domElement(y)?null:Ye.createElement(Qte,{key:`JoyrideStep-${r}`,continuous:t,controls:n,index:r,lifecycle:s,nonce:i,open:w,portalElement:o,setPositionData:l,setTooltipRef:h,shouldScroll:c,size:u,step:p,target:y,updateState:f})}function ene({controls:e,mergedProps:t,state:n,step:r,store:s}){const{continuous:i,debug:o,nonce:l,portalElement:c,scrollToFirstStep:u}=t,p=Rte(c),{index:f,lifecycle:d,status:h}=n,y=h===ft.RUNNING,[w,k]=m.useState(!1),g=m.useRef(null),b=(r==null?void 0:r.loaderDelay)??0;m.useEffect(()=>(n.waiting?b===0?k(!0):g.current=setTimeout(()=>{k(!0)},b):k(!1),()=>{g.current&&(clearTimeout(g.current),g.current=null)}),[b,n.waiting]),m.useEffect(()=>{if(!y)return;const C=j=>{!r||d!==Me.TOOLTIP||j.key==="Escape"&&r.dismissKeyAction&&(r.dismissKeyAction==="next"?e.next(Fs.KEYBOARD):e.close(Fs.KEYBOARD))};return document.body.addEventListener("keydown",C,{passive:!0}),()=>{document.body.removeEventListener("keydown",C)}},[e,y,d,r]);const x=m.useCallback(()=>{(r==null?void 0:r.overlayClickAction)==="close"?e.close(Fs.OVERLAY):(r==null?void 0:r.overlayClickAction)==="next"&&e.next(Fs.OVERLAY)},[e,r==null?void 0:r.overlayClickAction]);if(!r||!y)return null;const S=n.action===gt.START&&!r.skipBeacon&&r.placement!=="center";return Ye.createElement(Ye.Fragment,null,d!==Me.INIT&&Ye.createElement(Zte,{...n,continuous:i,controls:e,debug:o,nonce:l,portalElement:p,setPositionData:s.current.setPositionData,shouldScroll:!r.skipScroll&&(f!==0||u),step:r,updateState:s.current.updateState}),Ye.createElement(IA,{element:p},Ye.createElement(Ye.Fragment,null,w&&Ye.createElement(Lte,{nonce:l,step:r}),!S&&Ye.createElement(zte,{...r,continuous:i,lifecycle:d,onClickOverlay:x,portalElement:c?p:null,scrolling:n.scrolling,waiting:n.waiting}))))}function tne(e){const{controls:t,failures:n,mergedProps:r,state:s,step:i,store:o}=Tte(e);return{controls:t,failures:n,on:m.useCallback((l,c)=>o.current.on(l,c),[o]),state:m.useMemo(()=>Rp(s,"positioned"),[s]),step:i,Tour:qw()?Ye.createElement(ene,{controls:t,mergedProps:r,state:s,step:i,store:o}):null}}function nne(e){const{Tour:t}=tne(e);return t}function rne(e){return qw()?Ye.createElement(nne,e):null}function sne(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 ine(e){return[{target:"body",content:e("onboarding:flow.intro"),disableBeacon:!0,placement:"center"}]}function one(e){return[{target:"body",content:e("onboarding:flow.introEmpty"),disableBeacon:!0,placement:"center"}]}const cf="af:onboarding";function ane({page:e,hasNodes:t=!1}){const{t:n}=dr(),[r,s]=m.useState(!1),[i,o]=m.useState([]),l=m.useRef(null),c=m.useMemo(()=>e==="projects"?sne(n):t?ine(n):one(n),[e,t,n]);return m.useEffect(()=>{const u=localStorage.getItem(cf),p=u?JSON.parse(u):{};if(p.completed||p[e]){s(!1),o([]);return}localStorage.setItem(cf,JSON.stringify({...p,[e]:!0})),o(c),s(!0)},[e,t,c]),m.useEffect(()=>{if(!r)return;const u=p=>{var y;const f=p.target.closest("button");if(!f||!f.closest(".react-joyride__tooltip"))return;const h=(y=f.textContent)==null?void 0:y.trim();if(h===n("onboarding:done")||h===n("onboarding:startCreate")||h===n("onboarding:skip")){const w=localStorage.getItem(cf)||"{}",k=JSON.parse(w);h===n("onboarding:skip")?(k.projects=!0,k.flow=!0,k.completed=!0):k[e]=!0,localStorage.setItem(cf,JSON.stringify(k)),o([]),s(!1),e==="projects"&&(h===n("onboarding:done")||h===n("onboarding:startCreate"))&&(localStorage.setItem("af:newPipelineGuide","true"),setTimeout(()=>{const g=document.querySelector(".af-create-btn");g&&g.click()},500))}};return document.addEventListener("click",u,!0),()=>document.removeEventListener("click",u,!0)},[r,e,n]),!r||i.length===0?null:a.jsx(rne,{ref:l,steps:i,run:r,continuous:!0,showSkipButton:!0,showProgress:i.length>1,styles:{options:{primaryColor:"#7c4dff",textColor:"#ffffff",backgroundColor:"#1a1a1a",arrowColor:"#1a1a1a",overlayColor:"rgba(0, 0, 0, 0.4)",zIndex:1e4},tooltip:{borderRadius:"1.5rem",padding:"1.5rem"},buttonNext:{borderRadius:"9999px",padding:"0.625rem 1.5rem"},buttonSkip:{borderRadius:"9999px",color:"#9ecaff"},buttonClose:{display:"none"}},locale:{back:n("onboarding:back"),next:n("onboarding:next"),skip:n("onboarding:skip"),last:n(e==="projects"?"onboarding:startCreate":"onboarding:done")},floaterProps:{disableAnimation:!0},scrollToFirstStep:!0})}function lne(){const{navigate:e,path:t}=Js(),[n,r]=m.useState([]),[s,i]=m.useState(!1);if(m.useEffect(()=>{let p=!1;const f=async()=>{try{const h=await fetch("/api/pipeline-recent-runs");if(!h.ok)return;const y=await h.json();if(p)return;const w=Array.isArray(y.runs)?y.runs:[];r(w.filter(k=>k&&k.status==="running"))}catch{}};f();const d=window.setInterval(f,3e3);return()=>{p=!0,window.clearInterval(d)}},[]),n.length===0)return null;const o=p=>{const f=new URLSearchParams({flowId:p.flowId,flowSource:p.flowSource||"workspace"});e(`/flow?${f.toString()}`),i(!1)},l=t==="/flow"?new URLSearchParams(window.location.search):null,c=(l==null?void 0:l.get("flowId"))||"",u=n.length===1;return a.jsxs("div",{className:"af-run-indicator",role:"status","aria-live":"polite",children:[s&&!u&&a.jsx("div",{className:"af-run-indicator__menu",onMouseLeave:()=>i(!1),children:n.map(p=>a.jsxs("button",{type:"button",className:"af-run-indicator__item"+(p.flowId===c?" af-run-indicator__item--current":""),onClick:()=>o(p),title:`${p.flowId} · ${p.runId}`,children:[a.jsx("span",{className:"af-run-indicator__dot"}),a.jsx("span",{className:"af-run-indicator__flow",children:p.flowId}),a.jsx("span",{className:"af-run-indicator__run",children:p.runId.slice(0,12)})]},`${p.flowId}:${p.runId}`))}),a.jsxs("button",{type:"button",className:"af-run-indicator__btn",onClick:()=>u?o(n[0]):i(p=>!p),title:u?`${n[0].flowId} 运行中,点击跳转`:`${n.length} 个 pipeline 运行中`,children:[a.jsx("span",{className:"af-run-indicator__pulse"}),a.jsx("span",{className:"af-run-indicator__label",children:u?n[0].flowId:`${n.length} running`})]})]})}function TA(e){return e==="/likee-context"||e==="/likee_context"}function cne(){const{navigate:e}=Js();return m.useEffect(()=>{const t=new URLSearchParams(window.location.search),n=new URLSearchParams,r=t.get("flowId")||"",s=t.get("flowSource")||"";r&&n.set("flowId",r),s&&n.set("flowSource",s),t.get("flowArchived")&&n.set("archived",t.get("flowArchived")),e(`/workspace${n.toString()?`?${n.toString()}`:""}`)},[e]),null}class une extends m.Component{constructor(t){super(t),this.state={error:null,info:null}}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,n){console.error("[AgentFlow UI render error]",t,n),this.setState({error:t,info:n})}render(){var r,s,i;if(!this.state.error)return this.props.children;const t=String(((r=this.state.error)==null?void 0:r.stack)||((s=this.state.error)==null?void 0:s.message)||this.state.error),n=String(((i=this.state.info)==null?void 0:i.componentStack)||"");return 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 dne({authUser:e}){const{path:t}=Js();return t==="/projects"||t==="/"?a.jsx(ba,{authUser:e}):t==="/nodes"?a.jsx(ba,{authUser:e,resourceKind:"nodes"}):t==="/my-nodes"?a.jsx(ba,{authUser:e,resourceKind:"my-nodes"}):t==="/my-flows"?a.jsx(ba,{authUser:e,resourceKind:"my-flows"}):t==="/skills"?a.jsx(ba,{authUser:e,resourceKind:"skills"}):t==="/mcps"?a.jsx(BQ,{}):t==="/schedules"?a.jsx(KQ,{}):t==="/flow"?a.jsx(cne,{}):t==="/workspace"?a.jsx(g7,{}):t.startsWith("/display")?a.jsx(qP,{}):t==="/settings"?a.jsx(LQ,{authUser:e}):t==="/admin/usage"?a.jsx(FQ,{authUser:e}):t==="/feedback"?a.jsx(zQ,{}):TA(t)?a.jsx(nA,{}):a.jsx(ba,{})}function fne({children:e}){const[t,n]=m.useState({loading:!0,authenticated:!1,user:null,setupRequired:!1}),[r,s]=m.useState(""),[i,o]=m.useState(""),[l,c]=m.useState(!1),[u,p]=m.useState(""),f=async()=>{try{const y=await(await fetch("/api/auth/me")).json().catch(()=>({}));n({loading:!1,authenticated:!!y.authenticated,user:y.user||null,setupRequired:!!y.setupRequired}),p(y.error?String(y.error):"")}catch(h){n({loading:!1,authenticated:!1,user:null,setupRequired:!1}),p(String(h.message||h))}};m.useEffect(()=>{f()},[]);const d=async h=>{h.preventDefault(),c(!0),p("");try{const y=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:r,password:i})}),w=await y.json().catch(()=>({}));if(!y.ok)throw new Error(w.error||"登录失败");n({loading:!1,authenticated:!0,user:w.user||null,setupRequired:!1})}catch(y){p(String(y.message||y))}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:d,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=>s(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:i,onChange:h=>o(h.target.value),autoComplete:t.setupRequired?"new-password":"current-password"})]}),u?a.jsx("p",{className:"af-auth-error",children:u}):null,a.jsx("button",{className:"af-auth-submit",type:"submit",disabled:l||!r.trim()||i.length<4,children:l?"处理中...":t.setupRequired?"创建并登录":"登录"})]})})}function pne({authUser:e,onLogout:t}){const{path:n}=Js(),r=n==="/flow"||n==="/workspace";return a.jsxs("div",{className:"af-app",children:[n!=="/settings"?a.jsx(ane,{page:r?"flow":"projects"}):null,r?null:a.jsx(L2,{authUser:e,onLogout:t}),a.jsx("div",{className:r?"af-main af-main--pipeline":"af-main",children:a.jsx(dne,{authUser:e})}),a.jsx(lne,{})]})}function hne(){return a.jsx(une,{children:a.jsx(g2,{children:a.jsx(mne,{})})})}function mne(){const{path:e}=Js();return e.startsWith("/display")?a.jsx(qP,{}):TA(e)?a.jsx(nA,{}):a.jsx(fne,{children:({user:t,onLogout:n})=>a.jsx(pne,{authUser:t,onLogout:n})})}window.addEventListener("error",e=>{console.error("[AgentFlow UI global error]",e.error||e.message,{filename:e.filename,lineno:e.lineno,colno:e.colno})});window.addEventListener("unhandledrejection",e=>{console.error("[AgentFlow UI unhandled rejection]",e.reason)});const ZN=document.querySelector('link[rel="icon"]');ZN&&(ZN.href=mC);sg.createRoot(document.getElementById("root")).render(a.jsx(Ye.StrictMode,{children:a.jsx(hne,{})}));