@fieldwangai/agentflow 0.1.30 → 0.1.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/lib/agent-runners.mjs +26 -2
- package/bin/lib/api-runner.mjs +26 -3
- package/bin/lib/apply.mjs +6 -5
- package/bin/lib/catalog-flows.mjs +4 -1
- package/bin/lib/composer-agent.mjs +2 -1
- package/bin/lib/locales/en.json +4 -0
- package/bin/lib/locales/zh.json +6 -2
- package/bin/lib/node-execute.mjs +1 -1
- package/bin/lib/paths.mjs +5 -0
- package/bin/lib/scheduler.mjs +3 -2
- package/bin/lib/ui-server.mjs +621 -6
- package/bin/lib/user-env.mjs +83 -0
- package/bin/pipeline/get-env.mjs +5 -29
- package/bin/pipeline/pre-process-node.mjs +28 -6
- package/bin/pipeline/run-tool-nodejs.mjs +7 -0
- package/builtin/nodes/agent_subAgent.md +6 -3
- package/builtin/nodes/control_cd_workspace.md +8 -6
- package/builtin/nodes/control_load_skills.md +2 -0
- package/builtin/nodes/control_user_workspace.md +20 -0
- package/builtin/nodes/display_ascii.md +5 -0
- package/builtin/nodes/display_markdown.md +5 -0
- package/builtin/nodes/display_mermaid.md +5 -0
- package/builtin/nodes/tool_git_checkout.md +3 -0
- package/builtin/web-ui/dist/assets/index-BVWwQpvg.css +1 -0
- package/builtin/web-ui/dist/assets/index-CvNy1n3f.js +197 -0
- package/builtin/web-ui/dist/index.html +2 -2
- package/package.json +1 -1
- package/skills/agentflow-workspace-ascii/SKILL.md +42 -0
- package/skills/agentflow-workspace-graph/SKILL.md +67 -0
- package/skills/agentflow-workspace-markdown/SKILL.md +44 -0
- package/skills/agentflow-workspace-mermaid/SKILL.md +43 -0
- package/builtin/web-ui/dist/assets/index-NdVOJLL9.js +0 -196
- package/builtin/web-ui/dist/assets/index-naVI6LZj.css +0 -1
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
var BA=Object.defineProperty;var HA=(e,t,n)=>t in e?BA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Kt=(e,t,n)=>HA(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var Vc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function mo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var MN={exports:{}},zp={},$N={exports:{}},ot={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var Pu=Symbol.for("react.element"),UA=Symbol.for("react.portal"),VA=Symbol.for("react.fragment"),WA=Symbol.for("react.strict_mode"),KA=Symbol.for("react.profiler"),qA=Symbol.for("react.provider"),YA=Symbol.for("react.context"),GA=Symbol.for("react.forward_ref"),XA=Symbol.for("react.suspense"),JA=Symbol.for("react.memo"),QA=Symbol.for("react.lazy"),Fv=Symbol.iterator;function ZA(e){return e===null||typeof e!="object"?null:(e=Fv&&e[Fv]||e["@@iterator"],typeof e=="function"?e:null)}var DN={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},FN=Object.assign,zN={};function kl(e,t,n){this.props=e,this.context=t,this.refs=zN,this.updater=n||DN}kl.prototype.isReactComponent={};kl.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")};kl.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function BN(){}BN.prototype=kl.prototype;function rx(e,t,n){this.props=e,this.context=t,this.refs=zN,this.updater=n||DN}var ix=rx.prototype=new BN;ix.constructor=rx;FN(ix,kl.prototype);ix.isPureReactComponent=!0;var zv=Array.isArray,HN=Object.prototype.hasOwnProperty,sx={current:null},UN={key:!0,ref:!0,__self:!0,__source:!0};function VN(e,t,n){var r,i={},s=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)HN.call(t,r)&&!UN.hasOwnProperty(r)&&(i[r]=t[r]);var c=arguments.length-2;if(c===1)i.children=n;else if(1<c){for(var l=Array(c),u=0;u<c;u++)l[u]=arguments[u+2];i.children=l}if(e&&e.defaultProps)for(r in c=e.defaultProps,c)i[r]===void 0&&(i[r]=c[r]);return{$$typeof:Pu,type:e,key:s,ref:o,props:i,_owner:sx.current}}function eT(e,t){return{$$typeof:Pu,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function ox(e){return typeof e=="object"&&e!==null&&e.$$typeof===Pu}function tT(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Bv=/\/+/g;function em(e,t){return typeof e=="object"&&e!==null&&e.key!=null?tT(""+e.key):t.toString(36)}function yf(e,t,n,r,i){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case Pu:case UA:o=!0}}if(o)return o=e,i=i(o),e=r===""?"."+em(o,0):r,zv(i)?(n="",e!=null&&(n=e.replace(Bv,"$&/")+"/"),yf(i,t,n,"",function(u){return u})):i!=null&&(ox(i)&&(i=eT(i,n+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(Bv,"$&/")+"/")+e)),t.push(i)),1;if(o=0,r=r===""?".":r+":",zv(e))for(var c=0;c<e.length;c++){s=e[c];var l=r+em(s,c);o+=yf(s,t,n,l,i)}else if(l=ZA(e),typeof l=="function")for(e=l.call(e),c=0;!(s=e.next()).done;)s=s.value,l=r+em(s,c++),o+=yf(s,t,n,l,i);else if(s==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function jd(e,t,n){if(e==null)return e;var r=[],i=0;return yf(e,r,"","",function(s){return t.call(n,s,i++)}),r}function nT(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 Jn={current:null},xf={transition:null},rT={ReactCurrentDispatcher:Jn,ReactCurrentBatchConfig:xf,ReactCurrentOwner:sx};function WN(){throw Error("act(...) is not supported in production builds of React.")}ot.Children={map:jd,forEach:function(e,t,n){jd(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return jd(e,function(){t++}),t},toArray:function(e){return jd(e,function(t){return t})||[]},only:function(e){if(!ox(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};ot.Component=kl;ot.Fragment=VA;ot.Profiler=KA;ot.PureComponent=rx;ot.StrictMode=WA;ot.Suspense=XA;ot.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=rT;ot.act=WN;ot.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=FN({},e.props),i=e.key,s=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,o=sx.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(l in t)HN.call(t,l)&&!UN.hasOwnProperty(l)&&(r[l]=t[l]===void 0&&c!==void 0?c[l]:t[l])}var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){c=Array(l);for(var u=0;u<l;u++)c[u]=arguments[u+2];r.children=c}return{$$typeof:Pu,type:e.type,key:i,ref:s,props:r,_owner:o}};ot.createContext=function(e){return e={$$typeof:YA,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:qA,_context:e},e.Consumer=e};ot.createElement=VN;ot.createFactory=function(e){var t=VN.bind(null,e);return t.type=e,t};ot.createRef=function(){return{current:null}};ot.forwardRef=function(e){return{$$typeof:GA,render:e}};ot.isValidElement=ox;ot.lazy=function(e){return{$$typeof:QA,_payload:{_status:-1,_result:e},_init:nT}};ot.memo=function(e,t){return{$$typeof:JA,type:e,compare:t===void 0?null:t}};ot.startTransition=function(e){var t=xf.transition;xf.transition={};try{e()}finally{xf.transition=t}};ot.unstable_act=WN;ot.useCallback=function(e,t){return Jn.current.useCallback(e,t)};ot.useContext=function(e){return Jn.current.useContext(e)};ot.useDebugValue=function(){};ot.useDeferredValue=function(e){return Jn.current.useDeferredValue(e)};ot.useEffect=function(e,t){return Jn.current.useEffect(e,t)};ot.useId=function(){return Jn.current.useId()};ot.useImperativeHandle=function(e,t,n){return Jn.current.useImperativeHandle(e,t,n)};ot.useInsertionEffect=function(e,t){return Jn.current.useInsertionEffect(e,t)};ot.useLayoutEffect=function(e,t){return Jn.current.useLayoutEffect(e,t)};ot.useMemo=function(e,t){return Jn.current.useMemo(e,t)};ot.useReducer=function(e,t,n){return Jn.current.useReducer(e,t,n)};ot.useRef=function(e){return Jn.current.useRef(e)};ot.useState=function(e){return Jn.current.useState(e)};ot.useSyncExternalStore=function(e,t,n){return Jn.current.useSyncExternalStore(e,t,n)};ot.useTransition=function(){return Jn.current.useTransition()};ot.version="18.3.1";$N.exports=ot;var m=$N.exports;const De=mo(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,sT=Symbol.for("react.element"),oT=Symbol.for("react.fragment"),aT=Object.prototype.hasOwnProperty,lT=iT.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,cT={key:!0,ref:!0,__self:!0,__source:!0};function KN(e,t,n){var r,i={},s=null,o=null;n!==void 0&&(s=""+n),t.key!==void 0&&(s=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)aT.call(t,r)&&!cT.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)i[r]===void 0&&(i[r]=t[r]);return{$$typeof:sT,type:e,key:s,ref:o,props:i,_owner:lT.current}}zp.Fragment=oT;zp.jsx=KN;zp.jsxs=KN;MN.exports=zp;var a=MN.exports,mg={},qN={exports:{}},Tr={},YN={exports:{}},GN={};/**
|
|
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){var E=_.length;_.push(I);e:for(;0<E;){var Y=E-1>>>1,G=_[Y];if(0<i(G,I))_[Y]=I,_[E]=G,E=Y;else break e}}function n(_){return _.length===0?null:_[0]}function r(_){if(_.length===0)return null;var I=_[0],E=_.pop();if(E!==I){_[0]=E;e:for(var Y=0,G=_.length,F=G>>>1;Y<F;){var Z=2*(Y+1)-1,oe=_[Z],ue=Z+1,ce=_[ue];if(0>i(oe,E))ue<G&&0>i(ce,oe)?(_[Y]=ce,_[ue]=E,Y=ue):(_[Y]=oe,_[Z]=E,Y=Z);else if(ue<G&&0>i(ce,E))_[Y]=ce,_[ue]=E,Y=ue;else break e}}return I}function i(_,I){var E=_.sortIndex-I.sortIndex;return E!==0?E:_.id-I.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,c=o.now();e.unstable_now=function(){return o.now()-c}}var l=[],u=[],p=1,f=null,d=3,h=!1,y=!1,b=!1,k=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(_){for(var I=n(u);I!==null;){if(I.callback===null)r(u);else if(I.startTime<=_)r(u),I.sortIndex=I.expirationTime,t(l,I);else break;I=n(u)}}function S(_){if(b=!1,w(_),!y)if(n(l)!==null)y=!0,D(C);else{var I=n(u);I!==null&&K(S,I.startTime-_)}}function C(_,I){y=!1,b&&(b=!1,g(R),R=-1),h=!0;var E=d;try{for(w(I),f=n(l);f!==null&&(!(f.expirationTime>I)||_&&!L());){var Y=f.callback;if(typeof Y=="function"){f.callback=null,d=f.priorityLevel;var G=Y(f.expirationTime<=I);I=e.unstable_now(),typeof G=="function"?f.callback=G:f===n(l)&&r(l),w(I)}else r(l);f=n(l)}if(f!==null)var F=!0;else{var Z=n(u);Z!==null&&K(S,Z.startTime-I),F=!1}return F}finally{f=null,d=E,h=!1}}var N=!1,P=null,R=-1,M=5,U=-1;function L(){return!(e.unstable_now()-U<M)}function A(){if(P!==null){var _=e.unstable_now();U=_;var I=!0;try{I=P(!0,_)}finally{I?V():(N=!1,P=null)}}else N=!1}var V;if(typeof v=="function")V=function(){v(A)};else if(typeof MessageChannel<"u"){var T=new MessageChannel,$=T.port2;T.port1.onmessage=A,V=function(){$.postMessage(null)}}else V=function(){k(A,0)};function D(_){P=_,N||(N=!0,V())}function K(_,I){R=k(function(){_(e.unstable_now())},I)}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(_){_.callback=null},e.unstable_continueExecution=function(){y||h||(y=!0,D(C))},e.unstable_forceFrameRate=function(_){0>_||125<_?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<_?Math.floor(1e3/_):5},e.unstable_getCurrentPriorityLevel=function(){return d},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function(_){switch(d){case 1:case 2:case 3:var I=3;break;default:I=d}var E=d;d=I;try{return _()}finally{d=E}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(_,I){switch(_){case 1:case 2:case 3:case 4:case 5:break;default:_=3}var E=d;d=_;try{return I()}finally{d=E}},e.unstable_scheduleCallback=function(_,I,E){var Y=e.unstable_now();switch(typeof E=="object"&&E!==null?(E=E.delay,E=typeof E=="number"&&0<E?Y+E:Y):E=Y,_){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=E+G,_={id:p++,callback:I,priorityLevel:_,startTime:E,expirationTime:G,sortIndex:-1},E>Y?(_.sortIndex=E,t(u,_),n(l)===null&&_===n(u)&&(b?(g(R),R=-1):b=!0,K(S,E-Y))):(_.sortIndex=G,t(l,_),y||h||(y=!0,D(C))),_},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(_){var I=d;return function(){var E=d;d=I;try{return _.apply(this,arguments)}finally{d=E}}}})(GN);YN.exports=GN;var uT=YN.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 dT=m,Ir=uT;function he(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 XN=new Set,Wc={};function na(e,t){tl(e,t),tl(e+"Capture",t)}function tl(e,t){for(Wc[e]=t,e=0;e<t.length;e++)XN.add(t[e])}var ls=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),gg=Object.prototype.hasOwnProperty,fT=/^[: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]*$/,Hv={},Uv={};function pT(e){return gg.call(Uv,e)?!0:gg.call(Hv,e)?!1:fT.test(e)?Uv[e]=!0:(Hv[e]=!0,!1)}function hT(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 mT(e,t,n,r){if(t===null||typeof t>"u"||hT(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 Qn(e,t,n,r,i,s,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var Tn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Tn[e]=new Qn(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Tn[t]=new Qn(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Tn[e]=new Qn(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Tn[e]=new Qn(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){Tn[e]=new Qn(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Tn[e]=new Qn(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Tn[e]=new Qn(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Tn[e]=new Qn(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Tn[e]=new Qn(e,5,!1,e.toLowerCase(),null,!1,!1)});var ax=/[\-:]([a-z])/g;function lx(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(ax,lx);Tn[t]=new Qn(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(ax,lx);Tn[t]=new Qn(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(ax,lx);Tn[t]=new Qn(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Tn[e]=new Qn(e,1,!1,e.toLowerCase(),null,!1,!1)});Tn.xlinkHref=new Qn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Tn[e]=new Qn(e,1,!1,e.toLowerCase(),null,!0,!0)});function cx(e,t,n,r){var i=Tn.hasOwnProperty(t)?Tn[t]:null;(i!==null?i.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(mT(t,n,i,r)&&(n=null),r||i===null?pT(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type===3?!1:"":n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var ms=dT.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Cd=Symbol.for("react.element"),ja=Symbol.for("react.portal"),Ca=Symbol.for("react.fragment"),ux=Symbol.for("react.strict_mode"),yg=Symbol.for("react.profiler"),JN=Symbol.for("react.provider"),QN=Symbol.for("react.context"),dx=Symbol.for("react.forward_ref"),xg=Symbol.for("react.suspense"),wg=Symbol.for("react.suspense_list"),fx=Symbol.for("react.memo"),zs=Symbol.for("react.lazy"),ZN=Symbol.for("react.offscreen"),Vv=Symbol.iterator;function Zl(e){return e===null||typeof e!="object"?null:(e=Vv&&e[Vv]||e["@@iterator"],typeof e=="function"?e:null)}var Ut=Object.assign,tm;function yc(e){if(tm===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);tm=t&&t[1]||""}return`
|
|
34
|
+
`+tm+e}var nm=!1;function rm(e,t){if(!e||nm)return"";nm=!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 i=u.stack.split(`
|
|
35
|
+
`),s=r.stack.split(`
|
|
36
|
+
`),o=i.length-1,c=s.length-1;1<=o&&0<=c&&i[o]!==s[c];)c--;for(;1<=o&&0<=c;o--,c--)if(i[o]!==s[c]){if(o!==1||c!==1)do if(o--,c--,0>c||i[o]!==s[c]){var l=`
|
|
37
|
+
`+i[o].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}while(1<=o&&0<=c);break}}}finally{nm=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?yc(e):""}function gT(e){switch(e.tag){case 5:return yc(e.type);case 16:return yc("Lazy");case 13:return yc("Suspense");case 19:return yc("SuspenseList");case 0:case 2:case 15:return e=rm(e.type,!1),e;case 11:return e=rm(e.type.render,!1),e;case 1:return e=rm(e.type,!0),e;default:return""}}function vg(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 Ca:return"Fragment";case ja:return"Portal";case yg:return"Profiler";case ux:return"StrictMode";case xg:return"Suspense";case wg:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case QN:return(e.displayName||"Context")+".Consumer";case JN:return(e._context.displayName||"Context")+".Provider";case dx:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case fx:return t=e.displayName||null,t!==null?t:vg(e.type)||"Memo";case zs:t=e._payload,e=e._init;try{return vg(e(t))}catch{}}return null}function yT(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 vg(t);case 8:return t===ux?"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 ao(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function e1(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function xT(e){var t=e1(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ed(e){e._valueTracker||(e._valueTracker=xT(e))}function t1(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=e1(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function zf(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function bg(e,t){var n=t.checked;return Ut({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Wv(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ao(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 n1(e,t){t=t.checked,t!=null&&cx(e,"checked",t,!1)}function kg(e,t){n1(e,t);var n=ao(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")?Sg(e,t.type,n):t.hasOwnProperty("defaultValue")&&Sg(e,t.type,ao(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Kv(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 Sg(e,t,n){(t!=="number"||zf(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var xc=Array.isArray;function Va(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=""+ao(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Ng(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(he(91));return Ut({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function qv(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(he(92));if(xc(n)){if(1<n.length)throw Error(he(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:ao(n)}}function r1(e,t){var n=ao(t.value),r=ao(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 Yv(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function i1(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 jg(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?i1(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var _d,s1=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(_d=_d||document.createElement("div"),_d.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=_d.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Kc(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ec={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},wT=["Webkit","ms","Moz","O"];Object.keys(Ec).forEach(function(e){wT.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ec[t]=Ec[e]})});function o1(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Ec.hasOwnProperty(e)&&Ec[e]?(""+t).trim():t+"px"}function a1(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=o1(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var vT=Ut({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 Cg(e,t){if(t){if(vT[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(he(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(he(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(he(61))}if(t.style!=null&&typeof t.style!="object")throw Error(he(62))}}function Eg(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 _g=null;function px(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Pg=null,Wa=null,Ka=null;function Gv(e){if(e=Tu(e)){if(typeof Pg!="function")throw Error(he(280));var t=e.stateNode;t&&(t=Wp(t),Pg(e.stateNode,e.type,t))}}function l1(e){Wa?Ka?Ka.push(e):Ka=[e]:Wa=e}function c1(){if(Wa){var e=Wa,t=Ka;if(Ka=Wa=null,Gv(e),t)for(e=0;e<t.length;e++)Gv(t[e])}}function u1(e,t){return e(t)}function d1(){}var im=!1;function f1(e,t,n){if(im)return e(t,n);im=!0;try{return u1(e,t,n)}finally{im=!1,(Wa!==null||Ka!==null)&&(d1(),c1())}}function qc(e,t){var n=e.stateNode;if(n===null)return null;var r=Wp(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(he(231,t,typeof n));return n}var Ig=!1;if(ls)try{var ec={};Object.defineProperty(ec,"passive",{get:function(){Ig=!0}}),window.addEventListener("test",ec,ec),window.removeEventListener("test",ec,ec)}catch{Ig=!1}function bT(e,t,n,r,i,s,o,c,l){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(p){this.onError(p)}}var _c=!1,Bf=null,Hf=!1,Ag=null,kT={onError:function(e){_c=!0,Bf=e}};function ST(e,t,n,r,i,s,o,c,l){_c=!1,Bf=null,bT.apply(kT,arguments)}function NT(e,t,n,r,i,s,o,c,l){if(ST.apply(this,arguments),_c){if(_c){var u=Bf;_c=!1,Bf=null}else throw Error(he(198));Hf||(Hf=!0,Ag=u)}}function ra(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 p1(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 Xv(e){if(ra(e)!==e)throw Error(he(188))}function jT(e){var t=e.alternate;if(!t){if(t=ra(e),t===null)throw Error(he(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var s=i.alternate;if(s===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===n)return Xv(i),e;if(s===r)return Xv(i),t;s=s.sibling}throw Error(he(188))}if(n.return!==r.return)n=i,r=s;else{for(var o=!1,c=i.child;c;){if(c===n){o=!0,n=i,r=s;break}if(c===r){o=!0,r=i,n=s;break}c=c.sibling}if(!o){for(c=s.child;c;){if(c===n){o=!0,n=s,r=i;break}if(c===r){o=!0,r=s,n=i;break}c=c.sibling}if(!o)throw Error(he(189))}}if(n.alternate!==r)throw Error(he(190))}if(n.tag!==3)throw Error(he(188));return n.stateNode.current===n?e:t}function h1(e){return e=jT(e),e!==null?m1(e):null}function m1(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=m1(e);if(t!==null)return t;e=e.sibling}return null}var g1=Ir.unstable_scheduleCallback,Jv=Ir.unstable_cancelCallback,CT=Ir.unstable_shouldYield,ET=Ir.unstable_requestPaint,rn=Ir.unstable_now,_T=Ir.unstable_getCurrentPriorityLevel,hx=Ir.unstable_ImmediatePriority,y1=Ir.unstable_UserBlockingPriority,Uf=Ir.unstable_NormalPriority,PT=Ir.unstable_LowPriority,x1=Ir.unstable_IdlePriority,Bp=null,Mi=null;function IT(e){if(Mi&&typeof Mi.onCommitFiberRoot=="function")try{Mi.onCommitFiberRoot(Bp,e,void 0,(e.current.flags&128)===128)}catch{}}var ui=Math.clz32?Math.clz32:RT,AT=Math.log,TT=Math.LN2;function RT(e){return e>>>=0,e===0?32:31-(AT(e)/TT|0)|0}var Pd=64,Id=4194304;function wc(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 Vf(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,s=e.pingedLanes,o=n&268435455;if(o!==0){var c=o&~i;c!==0?r=wc(c):(s&=o,s!==0&&(r=wc(s)))}else o=n&~i,o!==0?r=wc(o):s!==0&&(r=wc(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,s=t&-t,i>=s||i===16&&(s&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-ui(t),i=1<<n,r|=e[n],t&=~i;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 OT(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,s=e.pendingLanes;0<s;){var o=31-ui(s),c=1<<o,l=i[o];l===-1?(!(c&n)||c&r)&&(i[o]=LT(c,t)):l<=t&&(e.expiredLanes|=c),s&=~c}}function Tg(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function w1(){var e=Pd;return Pd<<=1,!(Pd&4194240)&&(Pd=64),e}function sm(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Iu(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-ui(t),e[t]=n}function MT(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-ui(n),s=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~s}}function mx(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-ui(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var vt=0;function v1(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var b1,gx,k1,S1,N1,Rg=!1,Ad=[],Xs=null,Js=null,Qs=null,Yc=new Map,Gc=new Map,Us=[],$T="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 Qv(e,t){switch(e){case"focusin":case"focusout":Xs=null;break;case"dragenter":case"dragleave":Js=null;break;case"mouseover":case"mouseout":Qs=null;break;case"pointerover":case"pointerout":Yc.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Gc.delete(t.pointerId)}}function tc(e,t,n,r,i,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:s,targetContainers:[i]},t!==null&&(t=Tu(t),t!==null&&gx(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function DT(e,t,n,r,i){switch(t){case"focusin":return Xs=tc(Xs,e,t,n,r,i),!0;case"dragenter":return Js=tc(Js,e,t,n,r,i),!0;case"mouseover":return Qs=tc(Qs,e,t,n,r,i),!0;case"pointerover":var s=i.pointerId;return Yc.set(s,tc(Yc.get(s)||null,e,t,n,r,i)),!0;case"gotpointercapture":return s=i.pointerId,Gc.set(s,tc(Gc.get(s)||null,e,t,n,r,i)),!0}return!1}function j1(e){var t=Mo(e.target);if(t!==null){var n=ra(t);if(n!==null){if(t=n.tag,t===13){if(t=p1(n),t!==null){e.blockedOn=t,N1(e.priority,function(){k1(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 wf(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Lg(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);_g=r,n.target.dispatchEvent(r),_g=null}else return t=Tu(n),t!==null&&gx(t),e.blockedOn=n,!1;t.shift()}return!0}function Zv(e,t,n){wf(e)&&n.delete(t)}function FT(){Rg=!1,Xs!==null&&wf(Xs)&&(Xs=null),Js!==null&&wf(Js)&&(Js=null),Qs!==null&&wf(Qs)&&(Qs=null),Yc.forEach(Zv),Gc.forEach(Zv)}function nc(e,t){e.blockedOn===t&&(e.blockedOn=null,Rg||(Rg=!0,Ir.unstable_scheduleCallback(Ir.unstable_NormalPriority,FT)))}function Xc(e){function t(i){return nc(i,e)}if(0<Ad.length){nc(Ad[0],e);for(var n=1;n<Ad.length;n++){var r=Ad[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Xs!==null&&nc(Xs,e),Js!==null&&nc(Js,e),Qs!==null&&nc(Qs,e),Yc.forEach(t),Gc.forEach(t),n=0;n<Us.length;n++)r=Us[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Us.length&&(n=Us[0],n.blockedOn===null);)j1(n),n.blockedOn===null&&Us.shift()}var qa=ms.ReactCurrentBatchConfig,Wf=!0;function zT(e,t,n,r){var i=vt,s=qa.transition;qa.transition=null;try{vt=1,yx(e,t,n,r)}finally{vt=i,qa.transition=s}}function BT(e,t,n,r){var i=vt,s=qa.transition;qa.transition=null;try{vt=4,yx(e,t,n,r)}finally{vt=i,qa.transition=s}}function yx(e,t,n,r){if(Wf){var i=Lg(e,t,n,r);if(i===null)mm(e,t,r,Kf,n),Qv(e,r);else if(DT(i,e,t,n,r))r.stopPropagation();else if(Qv(e,r),t&4&&-1<$T.indexOf(e)){for(;i!==null;){var s=Tu(i);if(s!==null&&b1(s),s=Lg(e,t,n,r),s===null&&mm(e,t,r,Kf,n),s===i)break;i=s}i!==null&&r.stopPropagation()}else mm(e,t,r,null,n)}}var Kf=null;function Lg(e,t,n,r){if(Kf=null,e=px(r),e=Mo(e),e!==null)if(t=ra(e),t===null)e=null;else if(n=t.tag,n===13){if(e=p1(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 Kf=e,null}function C1(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(_T()){case hx:return 1;case y1:return 4;case Uf:case PT:return 16;case x1:return 536870912;default:return 16}default:return 16}}var Ks=null,xx=null,vf=null;function E1(){if(vf)return vf;var e,t=xx,n=t.length,r,i="value"in Ks?Ks.value:Ks.textContent,s=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[s-r];r++);return vf=i.slice(e,1<r?1-r:void 0)}function bf(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 Td(){return!0}function e0(){return!1}function Rr(e){function t(n,r,i,s,o){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var c in e)e.hasOwnProperty(c)&&(n=e[c],this[c]=n?n(s):s[c]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Td:e0,this.isPropagationStopped=e0,this}return Ut(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=Td)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Td)},persist:function(){},isPersistent:Td}),t}var Sl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},wx=Rr(Sl),Au=Ut({},Sl,{view:0,detail:0}),HT=Rr(Au),om,am,rc,Hp=Ut({},Au,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:vx,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!==rc&&(rc&&e.type==="mousemove"?(om=e.screenX-rc.screenX,am=e.screenY-rc.screenY):am=om=0,rc=e),om)},movementY:function(e){return"movementY"in e?e.movementY:am}}),t0=Rr(Hp),UT=Ut({},Hp,{dataTransfer:0}),VT=Rr(UT),WT=Ut({},Au,{relatedTarget:0}),lm=Rr(WT),KT=Ut({},Sl,{animationName:0,elapsedTime:0,pseudoElement:0}),qT=Rr(KT),YT=Ut({},Sl,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),GT=Rr(YT),XT=Ut({},Sl,{data:0}),n0=Rr(XT),JT={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},QT={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"},ZT={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function e2(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=ZT[e])?!!t[e]:!1}function vx(){return e2}var t2=Ut({},Au,{key:function(e){if(e.key){var t=JT[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=bf(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?QT[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:vx,charCode:function(e){return e.type==="keypress"?bf(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?bf(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),n2=Rr(t2),r2=Ut({},Hp,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),r0=Rr(r2),i2=Ut({},Au,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:vx}),s2=Rr(i2),o2=Ut({},Sl,{propertyName:0,elapsedTime:0,pseudoElement:0}),a2=Rr(o2),l2=Ut({},Hp,{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}),c2=Rr(l2),u2=[9,13,27,32],bx=ls&&"CompositionEvent"in window,Pc=null;ls&&"documentMode"in document&&(Pc=document.documentMode);var d2=ls&&"TextEvent"in window&&!Pc,_1=ls&&(!bx||Pc&&8<Pc&&11>=Pc),i0=" ",s0=!1;function P1(e,t){switch(e){case"keyup":return u2.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function I1(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ea=!1;function f2(e,t){switch(e){case"compositionend":return I1(t);case"keypress":return t.which!==32?null:(s0=!0,i0);case"textInput":return e=t.data,e===i0&&s0?null:e;default:return null}}function p2(e,t){if(Ea)return e==="compositionend"||!bx&&P1(e,t)?(e=E1(),vf=xx=Ks=null,Ea=!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 _1&&t.locale!=="ko"?null:t.data;default:return null}}var h2={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 o0(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!h2[e.type]:t==="textarea"}function A1(e,t,n,r){l1(r),t=qf(t,"onChange"),0<t.length&&(n=new wx("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Ic=null,Jc=null;function m2(e){H1(e,0)}function Up(e){var t=Ia(e);if(t1(t))return e}function g2(e,t){if(e==="change")return t}var T1=!1;if(ls){var cm;if(ls){var um="oninput"in document;if(!um){var a0=document.createElement("div");a0.setAttribute("oninput","return;"),um=typeof a0.oninput=="function"}cm=um}else cm=!1;T1=cm&&(!document.documentMode||9<document.documentMode)}function l0(){Ic&&(Ic.detachEvent("onpropertychange",R1),Jc=Ic=null)}function R1(e){if(e.propertyName==="value"&&Up(Jc)){var t=[];A1(t,Jc,e,px(e)),f1(m2,t)}}function y2(e,t,n){e==="focusin"?(l0(),Ic=t,Jc=n,Ic.attachEvent("onpropertychange",R1)):e==="focusout"&&l0()}function x2(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Up(Jc)}function w2(e,t){if(e==="click")return Up(t)}function v2(e,t){if(e==="input"||e==="change")return Up(t)}function b2(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var fi=typeof Object.is=="function"?Object.is:b2;function Qc(e,t){if(fi(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!gg.call(t,i)||!fi(e[i],t[i]))return!1}return!0}function c0(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function u0(e,t){var n=c0(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=c0(n)}}function L1(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?L1(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function O1(){for(var e=window,t=zf();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=zf(e.document)}return t}function kx(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 k2(e){var t=O1(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&L1(n.ownerDocument.documentElement,n)){if(r!==null&&kx(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!e.extend&&s>r&&(i=r,r=s,s=i),i=u0(n,s);var o=u0(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var S2=ls&&"documentMode"in document&&11>=document.documentMode,_a=null,Og=null,Ac=null,Mg=!1;function d0(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Mg||_a==null||_a!==zf(r)||(r=_a,"selectionStart"in r&&kx(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}),Ac&&Qc(Ac,r)||(Ac=r,r=qf(Og,"onSelect"),0<r.length&&(t=new wx("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=_a)))}function Rd(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Pa={animationend:Rd("Animation","AnimationEnd"),animationiteration:Rd("Animation","AnimationIteration"),animationstart:Rd("Animation","AnimationStart"),transitionend:Rd("Transition","TransitionEnd")},dm={},M1={};ls&&(M1=document.createElement("div").style,"AnimationEvent"in window||(delete Pa.animationend.animation,delete Pa.animationiteration.animation,delete Pa.animationstart.animation),"TransitionEvent"in window||delete Pa.transitionend.transition);function Vp(e){if(dm[e])return dm[e];if(!Pa[e])return e;var t=Pa[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in M1)return dm[e]=t[n];return e}var $1=Vp("animationend"),D1=Vp("animationiteration"),F1=Vp("animationstart"),z1=Vp("transitionend"),B1=new Map,f0="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 go(e,t){B1.set(e,t),na(t,[e])}for(var fm=0;fm<f0.length;fm++){var pm=f0[fm],N2=pm.toLowerCase(),j2=pm[0].toUpperCase()+pm.slice(1);go(N2,"on"+j2)}go($1,"onAnimationEnd");go(D1,"onAnimationIteration");go(F1,"onAnimationStart");go("dblclick","onDoubleClick");go("focusin","onFocus");go("focusout","onBlur");go(z1,"onTransitionEnd");tl("onMouseEnter",["mouseout","mouseover"]);tl("onMouseLeave",["mouseout","mouseover"]);tl("onPointerEnter",["pointerout","pointerover"]);tl("onPointerLeave",["pointerout","pointerover"]);na("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));na("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));na("onBeforeInput",["compositionend","keypress","textInput","paste"]);na("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));na("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));na("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var vc="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(" "),C2=new Set("cancel close invalid load scroll toggle".split(" ").concat(vc));function p0(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,NT(r,t,void 0,e),e.currentTarget=null}function H1(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;e:{var s=void 0;if(t)for(var o=r.length-1;0<=o;o--){var c=r[o],l=c.instance,u=c.currentTarget;if(c=c.listener,l!==s&&i.isPropagationStopped())break e;p0(i,c,u),s=l}else for(o=0;o<r.length;o++){if(c=r[o],l=c.instance,u=c.currentTarget,c=c.listener,l!==s&&i.isPropagationStopped())break e;p0(i,c,u),s=l}}}if(Hf)throw e=Ag,Hf=!1,Ag=null,e}function It(e,t){var n=t[Bg];n===void 0&&(n=t[Bg]=new Set);var r=e+"__bubble";n.has(r)||(U1(t,e,2,!1),n.add(r))}function hm(e,t,n){var r=0;t&&(r|=4),U1(n,e,r,t)}var Ld="_reactListening"+Math.random().toString(36).slice(2);function Zc(e){if(!e[Ld]){e[Ld]=!0,XN.forEach(function(n){n!=="selectionchange"&&(C2.has(n)||hm(n,!1,e),hm(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ld]||(t[Ld]=!0,hm("selectionchange",!1,t))}}function U1(e,t,n,r){switch(C1(t)){case 1:var i=zT;break;case 4:i=BT;break;default:i=yx}n=i.bind(null,t,n,e),i=void 0,!Ig||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),r?i!==void 0?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):i!==void 0?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function mm(e,t,n,r,i){var s=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var c=r.stateNode.containerInfo;if(c===i||c.nodeType===8&&c.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&(l=o.stateNode.containerInfo,l===i||l.nodeType===8&&l.parentNode===i))return;o=o.return}for(;c!==null;){if(o=Mo(c),o===null)return;if(l=o.tag,l===5||l===6){r=s=o;continue e}c=c.parentNode}}r=r.return}f1(function(){var u=s,p=px(n),f=[];e:{var d=B1.get(e);if(d!==void 0){var h=wx,y=e;switch(e){case"keypress":if(bf(n)===0)break e;case"keydown":case"keyup":h=n2;break;case"focusin":y="focus",h=lm;break;case"focusout":y="blur",h=lm;break;case"beforeblur":case"afterblur":h=lm;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=t0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=VT;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=s2;break;case $1:case D1:case F1:h=qT;break;case z1:h=a2;break;case"scroll":h=HT;break;case"wheel":h=c2;break;case"copy":case"cut":case"paste":h=GT;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=r0}var b=(t&4)!==0,k=!b&&e==="scroll",g=b?d!==null?d+"Capture":null:d;b=[];for(var v=u,w;v!==null;){w=v;var S=w.stateNode;if(w.tag===5&&S!==null&&(w=S,g!==null&&(S=qc(v,g),S!=null&&b.push(eu(v,S,w)))),k)break;v=v.return}0<b.length&&(d=new h(d,y,null,n,p),f.push({event:d,listeners:b}))}}if(!(t&7)){e:{if(d=e==="mouseover"||e==="pointerover",h=e==="mouseout"||e==="pointerout",d&&n!==_g&&(y=n.relatedTarget||n.fromElement)&&(Mo(y)||y[cs]))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?Mo(y):null,y!==null&&(k=ra(y),y!==k||y.tag!==5&&y.tag!==6)&&(y=null)):(h=null,y=u),h!==y)){if(b=t0,S="onMouseLeave",g="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(b=r0,S="onPointerLeave",g="onPointerEnter",v="pointer"),k=h==null?d:Ia(h),w=y==null?d:Ia(y),d=new b(S,v+"leave",h,n,p),d.target=k,d.relatedTarget=w,S=null,Mo(p)===u&&(b=new b(g,v+"enter",y,n,p),b.target=w,b.relatedTarget=k,S=b),k=S,h&&y)t:{for(b=h,g=y,v=0,w=b;w;w=ga(w))v++;for(w=0,S=g;S;S=ga(S))w++;for(;0<v-w;)b=ga(b),v--;for(;0<w-v;)g=ga(g),w--;for(;v--;){if(b===g||g!==null&&b===g.alternate)break t;b=ga(b),g=ga(g)}b=null}else b=null;h!==null&&h0(f,d,h,b,!1),y!==null&&k!==null&&h0(f,k,y,b,!0)}}e:{if(d=u?Ia(u):window,h=d.nodeName&&d.nodeName.toLowerCase(),h==="select"||h==="input"&&d.type==="file")var C=g2;else if(o0(d))if(T1)C=v2;else{C=x2;var N=y2}else(h=d.nodeName)&&h.toLowerCase()==="input"&&(d.type==="checkbox"||d.type==="radio")&&(C=w2);if(C&&(C=C(e,u))){A1(f,C,n,p);break e}N&&N(e,d,u),e==="focusout"&&(N=d._wrapperState)&&N.controlled&&d.type==="number"&&Sg(d,"number",d.value)}switch(N=u?Ia(u):window,e){case"focusin":(o0(N)||N.contentEditable==="true")&&(_a=N,Og=u,Ac=null);break;case"focusout":Ac=Og=_a=null;break;case"mousedown":Mg=!0;break;case"contextmenu":case"mouseup":case"dragend":Mg=!1,d0(f,n,p);break;case"selectionchange":if(S2)break;case"keydown":case"keyup":d0(f,n,p)}var P;if(bx)e:{switch(e){case"compositionstart":var R="onCompositionStart";break e;case"compositionend":R="onCompositionEnd";break e;case"compositionupdate":R="onCompositionUpdate";break e}R=void 0}else Ea?P1(e,n)&&(R="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(R="onCompositionStart");R&&(_1&&n.locale!=="ko"&&(Ea||R!=="onCompositionStart"?R==="onCompositionEnd"&&Ea&&(P=E1()):(Ks=p,xx="value"in Ks?Ks.value:Ks.textContent,Ea=!0)),N=qf(u,R),0<N.length&&(R=new n0(R,e,null,n,p),f.push({event:R,listeners:N}),P?R.data=P:(P=I1(n),P!==null&&(R.data=P)))),(P=d2?f2(e,n):p2(e,n))&&(u=qf(u,"onBeforeInput"),0<u.length&&(p=new n0("onBeforeInput","beforeinput",null,n,p),f.push({event:p,listeners:u}),p.data=P))}H1(f,t)})}function eu(e,t,n){return{instance:e,listener:t,currentTarget:n}}function qf(e,t){for(var n=t+"Capture",r=[];e!==null;){var i=e,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=qc(e,n),s!=null&&r.unshift(eu(e,s,i)),s=qc(e,t),s!=null&&r.push(eu(e,s,i))),e=e.return}return r}function ga(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function h0(e,t,n,r,i){for(var s=t._reactName,o=[];n!==null&&n!==r;){var c=n,l=c.alternate,u=c.stateNode;if(l!==null&&l===r)break;c.tag===5&&u!==null&&(c=u,i?(l=qc(n,s),l!=null&&o.unshift(eu(n,l,c))):i||(l=qc(n,s),l!=null&&o.push(eu(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var E2=/\r\n?/g,_2=/\u0000|\uFFFD/g;function m0(e){return(typeof e=="string"?e:""+e).replace(E2,`
|
|
38
|
+
`).replace(_2,"")}function Od(e,t,n){if(t=m0(t),m0(e)!==t&&n)throw Error(he(425))}function Yf(){}var $g=null,Dg=null;function Fg(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 zg=typeof setTimeout=="function"?setTimeout:void 0,P2=typeof clearTimeout=="function"?clearTimeout:void 0,g0=typeof Promise=="function"?Promise:void 0,I2=typeof queueMicrotask=="function"?queueMicrotask:typeof g0<"u"?function(e){return g0.resolve(null).then(e).catch(A2)}:zg;function A2(e){setTimeout(function(){throw e})}function gm(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){e.removeChild(i),Xc(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);Xc(t)}function Zs(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 y0(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 Nl=Math.random().toString(36).slice(2),Ti="__reactFiber$"+Nl,tu="__reactProps$"+Nl,cs="__reactContainer$"+Nl,Bg="__reactEvents$"+Nl,T2="__reactListeners$"+Nl,R2="__reactHandles$"+Nl;function Mo(e){var t=e[Ti];if(t)return t;for(var n=e.parentNode;n;){if(t=n[cs]||n[Ti]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=y0(e);e!==null;){if(n=e[Ti])return n;e=y0(e)}return t}e=n,n=e.parentNode}return null}function Tu(e){return e=e[Ti]||e[cs],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Ia(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(he(33))}function Wp(e){return e[tu]||null}var Hg=[],Aa=-1;function yo(e){return{current:e}}function Tt(e){0>Aa||(e.current=Hg[Aa],Hg[Aa]=null,Aa--)}function Ct(e,t){Aa++,Hg[Aa]=e.current,e.current=t}var lo={},Hn=yo(lo),fr=yo(!1),Ko=lo;function nl(e,t){var n=e.type.contextTypes;if(!n)return lo;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function pr(e){return e=e.childContextTypes,e!=null}function Gf(){Tt(fr),Tt(Hn)}function x0(e,t,n){if(Hn.current!==lo)throw Error(he(168));Ct(Hn,t),Ct(fr,n)}function V1(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(he(108,yT(e)||"Unknown",i));return Ut({},n,r)}function Xf(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||lo,Ko=Hn.current,Ct(Hn,e),Ct(fr,fr.current),!0}function w0(e,t,n){var r=e.stateNode;if(!r)throw Error(he(169));n?(e=V1(e,t,Ko),r.__reactInternalMemoizedMergedChildContext=e,Tt(fr),Tt(Hn),Ct(Hn,e)):Tt(fr),Ct(fr,n)}var es=null,Kp=!1,ym=!1;function W1(e){es===null?es=[e]:es.push(e)}function L2(e){Kp=!0,W1(e)}function xo(){if(!ym&&es!==null){ym=!0;var e=0,t=vt;try{var n=es;for(vt=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}es=null,Kp=!1}catch(i){throw es!==null&&(es=es.slice(e+1)),g1(hx,xo),i}finally{vt=t,ym=!1}}return null}var Ta=[],Ra=0,Jf=null,Qf=0,Fr=[],zr=0,qo=null,rs=1,is="";function To(e,t){Ta[Ra++]=Qf,Ta[Ra++]=Jf,Jf=e,Qf=t}function K1(e,t,n){Fr[zr++]=rs,Fr[zr++]=is,Fr[zr++]=qo,qo=e;var r=rs;e=is;var i=32-ui(r)-1;r&=~(1<<i),n+=1;var s=32-ui(t)+i;if(30<s){var o=i-i%5;s=(r&(1<<o)-1).toString(32),r>>=o,i-=o,rs=1<<32-ui(t)+i|n<<i|r,is=s+e}else rs=1<<s|n<<i|r,is=e}function Sx(e){e.return!==null&&(To(e,1),K1(e,1,0))}function Nx(e){for(;e===Jf;)Jf=Ta[--Ra],Ta[Ra]=null,Qf=Ta[--Ra],Ta[Ra]=null;for(;e===qo;)qo=Fr[--zr],Fr[zr]=null,is=Fr[--zr],Fr[zr]=null,rs=Fr[--zr],Fr[zr]=null}var Er=null,jr=null,$t=!1,si=null;function q1(e,t){var n=Vr(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 v0(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,Er=e,jr=Zs(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Er=e,jr=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=qo!==null?{id:rs,overflow:is}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Vr(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Er=e,jr=null,!0):!1;default:return!1}}function Ug(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Vg(e){if($t){var t=jr;if(t){var n=t;if(!v0(e,t)){if(Ug(e))throw Error(he(418));t=Zs(n.nextSibling);var r=Er;t&&v0(e,t)?q1(r,n):(e.flags=e.flags&-4097|2,$t=!1,Er=e)}}else{if(Ug(e))throw Error(he(418));e.flags=e.flags&-4097|2,$t=!1,Er=e}}}function b0(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Er=e}function Md(e){if(e!==Er)return!1;if(!$t)return b0(e),$t=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Fg(e.type,e.memoizedProps)),t&&(t=jr)){if(Ug(e))throw Y1(),Error(he(418));for(;t;)q1(e,t),t=Zs(t.nextSibling)}if(b0(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(he(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){jr=Zs(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}jr=null}}else jr=Er?Zs(e.stateNode.nextSibling):null;return!0}function Y1(){for(var e=jr;e;)e=Zs(e.nextSibling)}function rl(){jr=Er=null,$t=!1}function jx(e){si===null?si=[e]:si.push(e)}var O2=ms.ReactCurrentBatchConfig;function ic(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(he(309));var r=n.stateNode}if(!r)throw Error(he(147,e));var i=r,s=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===s?t.ref:(t=function(o){var c=i.refs;o===null?delete c[s]:c[s]=o},t._stringRef=s,t)}if(typeof e!="string")throw Error(he(284));if(!n._owner)throw Error(he(290,e))}return e}function $d(e,t){throw e=Object.prototype.toString.call(t),Error(he(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function k0(e){var t=e._init;return t(e._payload)}function G1(e){function t(g,v){if(e){var w=g.deletions;w===null?(g.deletions=[v],g.flags|=16):w.push(v)}}function n(g,v){if(!e)return null;for(;v!==null;)t(g,v),v=v.sibling;return null}function r(g,v){for(g=new Map;v!==null;)v.key!==null?g.set(v.key,v):g.set(v.index,v),v=v.sibling;return g}function i(g,v){return g=ro(g,v),g.index=0,g.sibling=null,g}function s(g,v,w){return g.index=w,e?(w=g.alternate,w!==null?(w=w.index,w<v?(g.flags|=2,v):w):(g.flags|=2,v)):(g.flags|=1048576,v)}function o(g){return e&&g.alternate===null&&(g.flags|=2),g}function c(g,v,w,S){return v===null||v.tag!==6?(v=Nm(w,g.mode,S),v.return=g,v):(v=i(v,w),v.return=g,v)}function l(g,v,w,S){var C=w.type;return C===Ca?p(g,v,w.props.children,S,w.key):v!==null&&(v.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===zs&&k0(C)===v.type)?(S=i(v,w.props),S.ref=ic(g,v,w),S.return=g,S):(S=_f(w.type,w.key,w.props,null,g.mode,S),S.ref=ic(g,v,w),S.return=g,S)}function u(g,v,w,S){return v===null||v.tag!==4||v.stateNode.containerInfo!==w.containerInfo||v.stateNode.implementation!==w.implementation?(v=jm(w,g.mode,S),v.return=g,v):(v=i(v,w.children||[]),v.return=g,v)}function p(g,v,w,S,C){return v===null||v.tag!==7?(v=Bo(w,g.mode,S,C),v.return=g,v):(v=i(v,w),v.return=g,v)}function f(g,v,w){if(typeof v=="string"&&v!==""||typeof v=="number")return v=Nm(""+v,g.mode,w),v.return=g,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Cd:return w=_f(v.type,v.key,v.props,null,g.mode,w),w.ref=ic(g,null,v),w.return=g,w;case ja:return v=jm(v,g.mode,w),v.return=g,v;case zs:var S=v._init;return f(g,S(v._payload),w)}if(xc(v)||Zl(v))return v=Bo(v,g.mode,w,null),v.return=g,v;$d(g,v)}return null}function d(g,v,w,S){var C=v!==null?v.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return C!==null?null:c(g,v,""+w,S);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Cd:return w.key===C?l(g,v,w,S):null;case ja:return w.key===C?u(g,v,w,S):null;case zs:return C=w._init,d(g,v,C(w._payload),S)}if(xc(w)||Zl(w))return C!==null?null:p(g,v,w,S,null);$d(g,w)}return null}function h(g,v,w,S,C){if(typeof S=="string"&&S!==""||typeof S=="number")return g=g.get(w)||null,c(v,g,""+S,C);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case Cd:return g=g.get(S.key===null?w:S.key)||null,l(v,g,S,C);case ja:return g=g.get(S.key===null?w:S.key)||null,u(v,g,S,C);case zs:var N=S._init;return h(g,v,w,N(S._payload),C)}if(xc(S)||Zl(S))return g=g.get(w)||null,p(v,g,S,C,null);$d(v,S)}return null}function y(g,v,w,S){for(var C=null,N=null,P=v,R=v=0,M=null;P!==null&&R<w.length;R++){P.index>R?(M=P,P=null):M=P.sibling;var U=d(g,P,w[R],S);if(U===null){P===null&&(P=M);break}e&&P&&U.alternate===null&&t(g,P),v=s(U,v,R),N===null?C=U:N.sibling=U,N=U,P=M}if(R===w.length)return n(g,P),$t&&To(g,R),C;if(P===null){for(;R<w.length;R++)P=f(g,w[R],S),P!==null&&(v=s(P,v,R),N===null?C=P:N.sibling=P,N=P);return $t&&To(g,R),C}for(P=r(g,P);R<w.length;R++)M=h(P,g,R,w[R],S),M!==null&&(e&&M.alternate!==null&&P.delete(M.key===null?R:M.key),v=s(M,v,R),N===null?C=M:N.sibling=M,N=M);return e&&P.forEach(function(L){return t(g,L)}),$t&&To(g,R),C}function b(g,v,w,S){var C=Zl(w);if(typeof C!="function")throw Error(he(150));if(w=C.call(w),w==null)throw Error(he(151));for(var N=C=null,P=v,R=v=0,M=null,U=w.next();P!==null&&!U.done;R++,U=w.next()){P.index>R?(M=P,P=null):M=P.sibling;var L=d(g,P,U.value,S);if(L===null){P===null&&(P=M);break}e&&P&&L.alternate===null&&t(g,P),v=s(L,v,R),N===null?C=L:N.sibling=L,N=L,P=M}if(U.done)return n(g,P),$t&&To(g,R),C;if(P===null){for(;!U.done;R++,U=w.next())U=f(g,U.value,S),U!==null&&(v=s(U,v,R),N===null?C=U:N.sibling=U,N=U);return $t&&To(g,R),C}for(P=r(g,P);!U.done;R++,U=w.next())U=h(P,g,R,U.value,S),U!==null&&(e&&U.alternate!==null&&P.delete(U.key===null?R:U.key),v=s(U,v,R),N===null?C=U:N.sibling=U,N=U);return e&&P.forEach(function(A){return t(g,A)}),$t&&To(g,R),C}function k(g,v,w,S){if(typeof w=="object"&&w!==null&&w.type===Ca&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Cd:e:{for(var C=w.key,N=v;N!==null;){if(N.key===C){if(C=w.type,C===Ca){if(N.tag===7){n(g,N.sibling),v=i(N,w.props.children),v.return=g,g=v;break e}}else if(N.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===zs&&k0(C)===N.type){n(g,N.sibling),v=i(N,w.props),v.ref=ic(g,N,w),v.return=g,g=v;break e}n(g,N);break}else t(g,N);N=N.sibling}w.type===Ca?(v=Bo(w.props.children,g.mode,S,w.key),v.return=g,g=v):(S=_f(w.type,w.key,w.props,null,g.mode,S),S.ref=ic(g,v,w),S.return=g,g=S)}return o(g);case ja:e:{for(N=w.key;v!==null;){if(v.key===N)if(v.tag===4&&v.stateNode.containerInfo===w.containerInfo&&v.stateNode.implementation===w.implementation){n(g,v.sibling),v=i(v,w.children||[]),v.return=g,g=v;break e}else{n(g,v);break}else t(g,v);v=v.sibling}v=jm(w,g.mode,S),v.return=g,g=v}return o(g);case zs:return N=w._init,k(g,v,N(w._payload),S)}if(xc(w))return y(g,v,w,S);if(Zl(w))return b(g,v,w,S);$d(g,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,v!==null&&v.tag===6?(n(g,v.sibling),v=i(v,w),v.return=g,g=v):(n(g,v),v=Nm(w,g.mode,S),v.return=g,g=v),o(g)):n(g,v)}return k}var il=G1(!0),X1=G1(!1),Zf=yo(null),ep=null,La=null,Cx=null;function Ex(){Cx=La=ep=null}function _x(e){var t=Zf.current;Tt(Zf),e._currentValue=t}function Wg(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 Ya(e,t){ep=e,Cx=La=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(lr=!0),e.firstContext=null)}function Kr(e){var t=e._currentValue;if(Cx!==e)if(e={context:e,memoizedValue:t,next:null},La===null){if(ep===null)throw Error(he(308));La=e,ep.dependencies={lanes:0,firstContext:e}}else La=La.next=e;return t}var $o=null;function Px(e){$o===null?$o=[e]:$o.push(e)}function J1(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Px(t)):(n.next=i.next,i.next=n),t.interleaved=n,us(e,r)}function us(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 Bs=!1;function Ix(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Q1(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 as(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function eo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,pt&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,us(e,n)}return i=r.interleaved,i===null?(t.next=t,Px(r)):(t.next=i.next,i.next=t),r.interleaved=t,us(e,n)}function kf(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,mx(e,n)}}function S0(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=t:s=s.next=t}else i=s=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function tp(e,t,n,r){var i=e.updateQueue;Bs=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,c=i.shared.pending;if(c!==null){i.shared.pending=null;var l=c,u=l.next;l.next=null,o===null?s=u:o.next=u,o=l;var p=e.alternate;p!==null&&(p=p.updateQueue,c=p.lastBaseUpdate,c!==o&&(c===null?p.firstBaseUpdate=u:c.next=u,p.lastBaseUpdate=l))}if(s!==null){var f=i.baseState;o=0,p=u=l=null,c=s;do{var d=c.lane,h=c.eventTime;if((r&d)===d){p!==null&&(p=p.next={eventTime:h,lane:0,tag:c.tag,payload:c.payload,callback:c.callback,next:null});e:{var y=e,b=c;switch(d=t,h=n,b.tag){case 1:if(y=b.payload,typeof y=="function"){f=y.call(h,f,d);break e}f=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=b.payload,d=typeof y=="function"?y.call(h,f,d):y,d==null)break e;f=Ut({},f,d);break e;case 2:Bs=!0}}c.callback!==null&&c.lane!==0&&(e.flags|=64,d=i.effects,d===null?i.effects=[c]:d.push(c))}else h={eventTime:h,lane:d,tag:c.tag,payload:c.payload,callback:c.callback,next:null},p===null?(u=p=h,l=f):p=p.next=h,o|=d;if(c=c.next,c===null){if(c=i.shared.pending,c===null)break;d=c,c=d.next,d.next=null,i.lastBaseUpdate=d,i.shared.pending=null}}while(!0);if(p===null&&(l=f),i.baseState=l,i.firstBaseUpdate=u,i.lastBaseUpdate=p,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else s===null&&(i.shared.lanes=0);Go|=o,e.lanes=o,e.memoizedState=f}}function N0(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(he(191,i));i.call(r)}}}var Ru={},$i=yo(Ru),nu=yo(Ru),ru=yo(Ru);function Do(e){if(e===Ru)throw Error(he(174));return e}function Ax(e,t){switch(Ct(ru,t),Ct(nu,e),Ct($i,Ru),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:jg(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=jg(t,e)}Tt($i),Ct($i,t)}function sl(){Tt($i),Tt(nu),Tt(ru)}function Z1(e){Do(ru.current);var t=Do($i.current),n=jg(t,e.type);t!==n&&(Ct(nu,e),Ct($i,n))}function Tx(e){nu.current===e&&(Tt($i),Tt(nu))}var Bt=yo(0);function np(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 xm=[];function Rx(){for(var e=0;e<xm.length;e++)xm[e]._workInProgressVersionPrimary=null;xm.length=0}var Sf=ms.ReactCurrentDispatcher,wm=ms.ReactCurrentBatchConfig,Yo=0,Ht=null,pn=null,kn=null,rp=!1,Tc=!1,iu=0,M2=0;function $n(){throw Error(he(321))}function Lx(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!fi(e[n],t[n]))return!1;return!0}function Ox(e,t,n,r,i,s){if(Yo=s,Ht=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Sf.current=e===null||e.memoizedState===null?z2:B2,e=n(r,i),Tc){s=0;do{if(Tc=!1,iu=0,25<=s)throw Error(he(301));s+=1,kn=pn=null,t.updateQueue=null,Sf.current=H2,e=n(r,i)}while(Tc)}if(Sf.current=ip,t=pn!==null&&pn.next!==null,Yo=0,kn=pn=Ht=null,rp=!1,t)throw Error(he(300));return e}function Mx(){var e=iu!==0;return iu=0,e}function _i(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return kn===null?Ht.memoizedState=kn=e:kn=kn.next=e,kn}function qr(){if(pn===null){var e=Ht.alternate;e=e!==null?e.memoizedState:null}else e=pn.next;var t=kn===null?Ht.memoizedState:kn.next;if(t!==null)kn=t,pn=e;else{if(e===null)throw Error(he(310));pn=e,e={memoizedState:pn.memoizedState,baseState:pn.baseState,baseQueue:pn.baseQueue,queue:pn.queue,next:null},kn===null?Ht.memoizedState=kn=e:kn=kn.next=e}return kn}function su(e,t){return typeof t=="function"?t(e):t}function vm(e){var t=qr(),n=t.queue;if(n===null)throw Error(he(311));n.lastRenderedReducer=e;var r=pn,i=r.baseQueue,s=n.pending;if(s!==null){if(i!==null){var o=i.next;i.next=s.next,s.next=o}r.baseQueue=i=s,n.pending=null}if(i!==null){s=i.next,r=r.baseState;var c=o=null,l=null,u=s;do{var p=u.lane;if((Yo&p)===p)l!==null&&(l=l.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};l===null?(c=l=f,o=r):l=l.next=f,Ht.lanes|=p,Go|=p}u=u.next}while(u!==null&&u!==s);l===null?o=r:l.next=c,fi(r,t.memoizedState)||(lr=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=l,n.lastRenderedState=r}if(e=n.interleaved,e!==null){i=e;do s=i.lane,Ht.lanes|=s,Go|=s,i=i.next;while(i!==e)}else i===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function bm(e){var t=qr(),n=t.queue;if(n===null)throw Error(he(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,s=t.memoizedState;if(i!==null){n.pending=null;var o=i=i.next;do s=e(s,o.action),o=o.next;while(o!==i);fi(s,t.memoizedState)||(lr=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),n.lastRenderedState=s}return[s,r]}function ej(){}function tj(e,t){var n=Ht,r=qr(),i=t(),s=!fi(r.memoizedState,i);if(s&&(r.memoizedState=i,lr=!0),r=r.queue,$x(ij.bind(null,n,r,e),[e]),r.getSnapshot!==t||s||kn!==null&&kn.memoizedState.tag&1){if(n.flags|=2048,ou(9,rj.bind(null,n,r,i,t),void 0,null),Nn===null)throw Error(he(349));Yo&30||nj(n,t,i)}return i}function nj(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ht.updateQueue,t===null?(t={lastEffect:null,stores:null},Ht.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function rj(e,t,n,r){t.value=n,t.getSnapshot=r,sj(t)&&oj(e)}function ij(e,t,n){return n(function(){sj(t)&&oj(e)})}function sj(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!fi(e,n)}catch{return!0}}function oj(e){var t=us(e,1);t!==null&&di(t,e,1,-1)}function j0(e){var t=_i();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:su,lastRenderedState:e},t.queue=e,e=e.dispatch=F2.bind(null,Ht,e),[t.memoizedState,e]}function ou(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Ht.updateQueue,t===null?(t={lastEffect:null,stores:null},Ht.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 aj(){return qr().memoizedState}function Nf(e,t,n,r){var i=_i();Ht.flags|=e,i.memoizedState=ou(1|t,n,void 0,r===void 0?null:r)}function qp(e,t,n,r){var i=qr();r=r===void 0?null:r;var s=void 0;if(pn!==null){var o=pn.memoizedState;if(s=o.destroy,r!==null&&Lx(r,o.deps)){i.memoizedState=ou(t,n,s,r);return}}Ht.flags|=e,i.memoizedState=ou(1|t,n,s,r)}function C0(e,t){return Nf(8390656,8,e,t)}function $x(e,t){return qp(2048,8,e,t)}function lj(e,t){return qp(4,2,e,t)}function cj(e,t){return qp(4,4,e,t)}function uj(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 dj(e,t,n){return n=n!=null?n.concat([e]):null,qp(4,4,uj.bind(null,t,e),n)}function Dx(){}function fj(e,t){var n=qr();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Lx(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function pj(e,t){var n=qr();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Lx(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function hj(e,t,n){return Yo&21?(fi(n,t)||(n=w1(),Ht.lanes|=n,Go|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,lr=!0),e.memoizedState=n)}function $2(e,t){var n=vt;vt=n!==0&&4>n?n:4,e(!0);var r=wm.transition;wm.transition={};try{e(!1),t()}finally{vt=n,wm.transition=r}}function mj(){return qr().memoizedState}function D2(e,t,n){var r=no(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},gj(e))yj(t,n);else if(n=J1(e,t,n,r),n!==null){var i=Xn();di(n,e,r,i),xj(n,t,r)}}function F2(e,t,n){var r=no(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(gj(e))yj(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,c=s(o,n);if(i.hasEagerState=!0,i.eagerState=c,fi(c,o)){var l=t.interleaved;l===null?(i.next=i,Px(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}n=J1(e,t,i,r),n!==null&&(i=Xn(),di(n,e,r,i),xj(n,t,r))}}function gj(e){var t=e.alternate;return e===Ht||t!==null&&t===Ht}function yj(e,t){Tc=rp=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function xj(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,mx(e,n)}}var ip={readContext:Kr,useCallback:$n,useContext:$n,useEffect:$n,useImperativeHandle:$n,useInsertionEffect:$n,useLayoutEffect:$n,useMemo:$n,useReducer:$n,useRef:$n,useState:$n,useDebugValue:$n,useDeferredValue:$n,useTransition:$n,useMutableSource:$n,useSyncExternalStore:$n,useId:$n,unstable_isNewReconciler:!1},z2={readContext:Kr,useCallback:function(e,t){return _i().memoizedState=[e,t===void 0?null:t],e},useContext:Kr,useEffect:C0,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Nf(4194308,4,uj.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Nf(4194308,4,e,t)},useInsertionEffect:function(e,t){return Nf(4,2,e,t)},useMemo:function(e,t){var n=_i();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=_i();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=D2.bind(null,Ht,e),[r.memoizedState,e]},useRef:function(e){var t=_i();return e={current:e},t.memoizedState=e},useState:j0,useDebugValue:Dx,useDeferredValue:function(e){return _i().memoizedState=e},useTransition:function(){var e=j0(!1),t=e[0];return e=$2.bind(null,e[1]),_i().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Ht,i=_i();if($t){if(n===void 0)throw Error(he(407));n=n()}else{if(n=t(),Nn===null)throw Error(he(349));Yo&30||nj(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,C0(ij.bind(null,r,s,e),[e]),r.flags|=2048,ou(9,rj.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=_i(),t=Nn.identifierPrefix;if($t){var n=is,r=rs;n=(r&~(1<<32-ui(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=iu++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=M2++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},B2={readContext:Kr,useCallback:fj,useContext:Kr,useEffect:$x,useImperativeHandle:dj,useInsertionEffect:lj,useLayoutEffect:cj,useMemo:pj,useReducer:vm,useRef:aj,useState:function(){return vm(su)},useDebugValue:Dx,useDeferredValue:function(e){var t=qr();return hj(t,pn.memoizedState,e)},useTransition:function(){var e=vm(su)[0],t=qr().memoizedState;return[e,t]},useMutableSource:ej,useSyncExternalStore:tj,useId:mj,unstable_isNewReconciler:!1},H2={readContext:Kr,useCallback:fj,useContext:Kr,useEffect:$x,useImperativeHandle:dj,useInsertionEffect:lj,useLayoutEffect:cj,useMemo:pj,useReducer:bm,useRef:aj,useState:function(){return bm(su)},useDebugValue:Dx,useDeferredValue:function(e){var t=qr();return pn===null?t.memoizedState=e:hj(t,pn.memoizedState,e)},useTransition:function(){var e=bm(su)[0],t=qr().memoizedState;return[e,t]},useMutableSource:ej,useSyncExternalStore:tj,useId:mj,unstable_isNewReconciler:!1};function ni(e,t){if(e&&e.defaultProps){t=Ut({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Kg(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Ut({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Yp={isMounted:function(e){return(e=e._reactInternals)?ra(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Xn(),i=no(e),s=as(r,i);s.payload=t,n!=null&&(s.callback=n),t=eo(e,s,i),t!==null&&(di(t,e,i,r),kf(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Xn(),i=no(e),s=as(r,i);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=eo(e,s,i),t!==null&&(di(t,e,i,r),kf(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Xn(),r=no(e),i=as(n,r);i.tag=2,t!=null&&(i.callback=t),t=eo(e,i,r),t!==null&&(di(t,e,r,n),kf(t,e,r))}};function E0(e,t,n,r,i,s,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,s,o):t.prototype&&t.prototype.isPureReactComponent?!Qc(n,r)||!Qc(i,s):!0}function wj(e,t,n){var r=!1,i=lo,s=t.contextType;return typeof s=="object"&&s!==null?s=Kr(s):(i=pr(t)?Ko:Hn.current,r=t.contextTypes,s=(r=r!=null)?nl(e,i):lo),t=new t(n,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Yp,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=s),t}function _0(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&&Yp.enqueueReplaceState(t,t.state,null)}function qg(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},Ix(e);var s=t.contextType;typeof s=="object"&&s!==null?i.context=Kr(s):(s=pr(t)?Ko:Hn.current,i.context=nl(e,s)),i.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(Kg(e,t,s,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(t=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),t!==i.state&&Yp.enqueueReplaceState(i,i.state,null),tp(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function ol(e,t){try{var n="",r=t;do n+=gT(r),r=r.return;while(r);var i=n}catch(s){i=`
|
|
39
|
+
Error generating stack: `+s.message+`
|
|
40
|
+
`+s.stack}return{value:e,source:t,stack:i,digest:null}}function km(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Yg(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var U2=typeof WeakMap=="function"?WeakMap:Map;function vj(e,t,n){n=as(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){op||(op=!0,iy=r),Yg(e,t)},n}function bj(e,t,n){n=as(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){Yg(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){Yg(e,t),typeof r!="function"&&(to===null?to=new Set([this]):to.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function P0(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new U2;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=rR.bind(null,e,t,n),t.then(e,e))}function I0(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 A0(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=as(-1,1),t.tag=2,eo(n,t,1))),n.lanes|=1),e)}var V2=ms.ReactCurrentOwner,lr=!1;function Yn(e,t,n,r){t.child=e===null?X1(t,null,n,r):il(t,e.child,n,r)}function T0(e,t,n,r,i){n=n.render;var s=t.ref;return Ya(t,i),r=Ox(e,t,n,r,s,i),n=Mx(),e!==null&&!lr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,ds(e,t,i)):($t&&n&&Sx(t),t.flags|=1,Yn(e,t,r,i),t.child)}function R0(e,t,n,r,i){if(e===null){var s=n.type;return typeof s=="function"&&!Kx(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=s,kj(e,t,s,r,i)):(e=_f(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!(e.lanes&i)){var o=s.memoizedProps;if(n=n.compare,n=n!==null?n:Qc,n(o,r)&&e.ref===t.ref)return ds(e,t,i)}return t.flags|=1,e=ro(s,r),e.ref=t.ref,e.return=t,t.child=e}function kj(e,t,n,r,i){if(e!==null){var s=e.memoizedProps;if(Qc(s,r)&&e.ref===t.ref)if(lr=!1,t.pendingProps=r=s,(e.lanes&i)!==0)e.flags&131072&&(lr=!0);else return t.lanes=e.lanes,ds(e,t,i)}return Gg(e,t,n,r,i)}function Sj(e,t,n){var r=t.pendingProps,i=r.children,s=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ct(Ma,kr),kr|=n;else{if(!(n&1073741824))return e=s!==null?s.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Ct(Ma,kr),kr|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,Ct(Ma,kr),kr|=r}else s!==null?(r=s.baseLanes|n,t.memoizedState=null):r=n,Ct(Ma,kr),kr|=r;return Yn(e,t,i,n),t.child}function Nj(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Gg(e,t,n,r,i){var s=pr(n)?Ko:Hn.current;return s=nl(t,s),Ya(t,i),n=Ox(e,t,n,r,s,i),r=Mx(),e!==null&&!lr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,ds(e,t,i)):($t&&r&&Sx(t),t.flags|=1,Yn(e,t,n,i),t.child)}function L0(e,t,n,r,i){if(pr(n)){var s=!0;Xf(t)}else s=!1;if(Ya(t,i),t.stateNode===null)jf(e,t),wj(t,n,r),qg(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,c=t.memoizedProps;o.props=c;var l=o.context,u=n.contextType;typeof u=="object"&&u!==null?u=Kr(u):(u=pr(n)?Ko:Hn.current,u=nl(t,u));var p=n.getDerivedStateFromProps,f=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function";f||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(c!==r||l!==u)&&_0(t,o,r,u),Bs=!1;var d=t.memoizedState;o.state=d,tp(t,r,o,i),l=t.memoizedState,c!==r||d!==l||fr.current||Bs?(typeof p=="function"&&(Kg(t,n,p,r),l=t.memoizedState),(c=Bs||E0(t,n,c,r,d,l,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=l),o.props=r,o.state=l,o.context=u,r=c):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,Q1(e,t),c=t.memoizedProps,u=t.type===t.elementType?c:ni(t.type,c),o.props=u,f=t.pendingProps,d=o.context,l=n.contextType,typeof l=="object"&&l!==null?l=Kr(l):(l=pr(n)?Ko:Hn.current,l=nl(t,l));var h=n.getDerivedStateFromProps;(p=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(c!==f||d!==l)&&_0(t,o,r,l),Bs=!1,d=t.memoizedState,o.state=d,tp(t,r,o,i);var y=t.memoizedState;c!==f||d!==y||fr.current||Bs?(typeof h=="function"&&(Kg(t,n,h,r),y=t.memoizedState),(u=Bs||E0(t,n,u,r,d,y,l)||!1)?(p||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,y,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,y,l)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||c===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||c===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=y),o.props=r,o.state=y,o.context=l,r=u):(typeof o.componentDidUpdate!="function"||c===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||c===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),r=!1)}return Xg(e,t,n,r,s,i)}function Xg(e,t,n,r,i,s){Nj(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return i&&w0(t,n,!1),ds(e,t,s);r=t.stateNode,V2.current=t;var c=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=il(t,e.child,null,s),t.child=il(t,null,c,s)):Yn(e,t,c,s),t.memoizedState=r.state,i&&w0(t,n,!0),t.child}function jj(e){var t=e.stateNode;t.pendingContext?x0(e,t.pendingContext,t.pendingContext!==t.context):t.context&&x0(e,t.context,!1),Ax(e,t.containerInfo)}function O0(e,t,n,r,i){return rl(),jx(i),t.flags|=256,Yn(e,t,n,r),t.child}var Jg={dehydrated:null,treeContext:null,retryLane:0};function Qg(e){return{baseLanes:e,cachePool:null,transitions:null}}function Cj(e,t,n){var r=t.pendingProps,i=Bt.current,s=!1,o=(t.flags&128)!==0,c;if((c=o)||(c=e!==null&&e.memoizedState===null?!1:(i&2)!==0),c?(s=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),Ct(Bt,i&1),e===null)return Vg(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=r.children,e=r.fallback,s?(r=t.mode,s=t.child,o={mode:"hidden",children:o},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=Jp(o,r,0,null),e=Bo(e,r,n,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=Qg(n),t.memoizedState=Jg,e):Fx(t,o));if(i=e.memoizedState,i!==null&&(c=i.dehydrated,c!==null))return W2(e,t,o,r,c,i,n);if(s){s=r.fallback,o=t.mode,i=e.child,c=i.sibling;var l={mode:"hidden",children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=l,t.deletions=null):(r=ro(i,l),r.subtreeFlags=i.subtreeFlags&14680064),c!==null?s=ro(c,s):(s=Bo(s,o,n,null),s.flags|=2),s.return=t,r.return=t,r.sibling=s,t.child=r,r=s,s=t.child,o=e.child.memoizedState,o=o===null?Qg(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=e.childLanes&~n,t.memoizedState=Jg,r}return s=e.child,e=s.sibling,r=ro(s,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Fx(e,t){return t=Jp({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Dd(e,t,n,r){return r!==null&&jx(r),il(t,e.child,null,n),e=Fx(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function W2(e,t,n,r,i,s,o){if(n)return t.flags&256?(t.flags&=-257,r=km(Error(he(422))),Dd(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=r.fallback,i=t.mode,r=Jp({mode:"visible",children:r.children},i,0,null),s=Bo(s,i,o,null),s.flags|=2,r.return=t,s.return=t,r.sibling=s,t.child=r,t.mode&1&&il(t,e.child,null,o),t.child.memoizedState=Qg(o),t.memoizedState=Jg,s);if(!(t.mode&1))return Dd(e,t,o,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var c=r.dgst;return r=c,s=Error(he(419)),r=km(s,r,void 0),Dd(e,t,o,r)}if(c=(o&e.childLanes)!==0,lr||c){if(r=Nn,r!==null){switch(o&-o){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,us(e,i),di(r,e,i,-1))}return Wx(),r=km(Error(he(421))),Dd(e,t,o,r)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=iR.bind(null,e),i._reactRetry=t,null):(e=s.treeContext,jr=Zs(i.nextSibling),Er=t,$t=!0,si=null,e!==null&&(Fr[zr++]=rs,Fr[zr++]=is,Fr[zr++]=qo,rs=e.id,is=e.overflow,qo=t),t=Fx(t,r.children),t.flags|=4096,t)}function M0(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Wg(e.return,t,n)}function Sm(e,t,n,r,i){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=i)}function Ej(e,t,n){var r=t.pendingProps,i=r.revealOrder,s=r.tail;if(Yn(e,t,r.children,n),r=Bt.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&&M0(e,n,t);else if(e.tag===19)M0(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(Ct(Bt,r),!(t.mode&1))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&np(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Sm(t,!1,i,n,s);break;case"backwards":for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&np(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Sm(t,!0,n,null,s);break;case"together":Sm(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function jf(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function ds(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Go|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(he(153));if(t.child!==null){for(e=t.child,n=ro(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ro(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function K2(e,t,n){switch(t.tag){case 3:jj(t),rl();break;case 5:Z1(t);break;case 1:pr(t.type)&&Xf(t);break;case 4:Ax(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;Ct(Zf,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(Ct(Bt,Bt.current&1),t.flags|=128,null):n&t.child.childLanes?Cj(e,t,n):(Ct(Bt,Bt.current&1),e=ds(e,t,n),e!==null?e.sibling:null);Ct(Bt,Bt.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Ej(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Ct(Bt,Bt.current),r)break;return null;case 22:case 23:return t.lanes=0,Sj(e,t,n)}return ds(e,t,n)}var _j,Zg,Pj,Ij;_j=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Zg=function(){};Pj=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,Do($i.current);var s=null;switch(n){case"input":i=bg(e,i),r=bg(e,r),s=[];break;case"select":i=Ut({},i,{value:void 0}),r=Ut({},r,{value:void 0}),s=[];break;case"textarea":i=Ng(e,i),r=Ng(e,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Yf)}Cg(n,r);var o;n=null;for(u in i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u==="style"){var c=i[u];for(o in c)c.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Wc.hasOwnProperty(u)?s||(s=[]):(s=s||[]).push(u,null));for(u in r){var l=r[u];if(c=i!=null?i[u]:void 0,r.hasOwnProperty(u)&&l!==c&&(l!=null||c!=null))if(u==="style")if(c){for(o in c)!c.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in l)l.hasOwnProperty(o)&&c[o]!==l[o]&&(n||(n={}),n[o]=l[o])}else n||(s||(s=[]),s.push(u,n)),n=l;else u==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,c=c?c.__html:void 0,l!=null&&c!==l&&(s=s||[]).push(u,l)):u==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(u,""+l):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Wc.hasOwnProperty(u)?(l!=null&&u==="onScroll"&&It("scroll",e),s||c===l||(s=[])):(s=s||[]).push(u,l))}n&&(s=s||[]).push("style",n);var u=s;(t.updateQueue=u)&&(t.flags|=4)}};Ij=function(e,t,n,r){n!==r&&(t.flags|=4)};function sc(e,t){if(!$t)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 Dn(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function q2(e,t,n){var r=t.pendingProps;switch(Nx(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Dn(t),null;case 1:return pr(t.type)&&Gf(),Dn(t),null;case 3:return r=t.stateNode,sl(),Tt(fr),Tt(Hn),Rx(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Md(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,si!==null&&(ay(si),si=null))),Zg(e,t),Dn(t),null;case 5:Tx(t);var i=Do(ru.current);if(n=t.type,e!==null&&t.stateNode!=null)Pj(e,t,n,r,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(he(166));return Dn(t),null}if(e=Do($i.current),Md(t)){r=t.stateNode,n=t.type;var s=t.memoizedProps;switch(r[Ti]=t,r[tu]=s,e=(t.mode&1)!==0,n){case"dialog":It("cancel",r),It("close",r);break;case"iframe":case"object":case"embed":It("load",r);break;case"video":case"audio":for(i=0;i<vc.length;i++)It(vc[i],r);break;case"source":It("error",r);break;case"img":case"image":case"link":It("error",r),It("load",r);break;case"details":It("toggle",r);break;case"input":Wv(r,s),It("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},It("invalid",r);break;case"textarea":qv(r,s),It("invalid",r)}Cg(n,s),i=null;for(var o in s)if(s.hasOwnProperty(o)){var c=s[o];o==="children"?typeof c=="string"?r.textContent!==c&&(s.suppressHydrationWarning!==!0&&Od(r.textContent,c,e),i=["children",c]):typeof c=="number"&&r.textContent!==""+c&&(s.suppressHydrationWarning!==!0&&Od(r.textContent,c,e),i=["children",""+c]):Wc.hasOwnProperty(o)&&c!=null&&o==="onScroll"&&It("scroll",r)}switch(n){case"input":Ed(r),Kv(r,s,!0);break;case"textarea":Ed(r),Yv(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=Yf)}r=i,t.updateQueue=r,r!==null&&(t.flags|=4)}else{o=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=i1(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[Ti]=t,e[tu]=r,_j(e,t,!1,!1),t.stateNode=e;e:{switch(o=Eg(n,r),n){case"dialog":It("cancel",e),It("close",e),i=r;break;case"iframe":case"object":case"embed":It("load",e),i=r;break;case"video":case"audio":for(i=0;i<vc.length;i++)It(vc[i],e);i=r;break;case"source":It("error",e),i=r;break;case"img":case"image":case"link":It("error",e),It("load",e),i=r;break;case"details":It("toggle",e),i=r;break;case"input":Wv(e,r),i=bg(e,r),It("invalid",e);break;case"option":i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=Ut({},r,{value:void 0}),It("invalid",e);break;case"textarea":qv(e,r),i=Ng(e,r),It("invalid",e);break;default:i=r}Cg(n,i),c=i;for(s in c)if(c.hasOwnProperty(s)){var l=c[s];s==="style"?a1(e,l):s==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&s1(e,l)):s==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&Kc(e,l):typeof l=="number"&&Kc(e,""+l):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(Wc.hasOwnProperty(s)?l!=null&&s==="onScroll"&&It("scroll",e):l!=null&&cx(e,s,l,o))}switch(n){case"input":Ed(e),Kv(e,r,!1);break;case"textarea":Ed(e),Yv(e);break;case"option":r.value!=null&&e.setAttribute("value",""+ao(r.value));break;case"select":e.multiple=!!r.multiple,s=r.value,s!=null?Va(e,!!r.multiple,s,!1):r.defaultValue!=null&&Va(e,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=Yf)}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 Dn(t),null;case 6:if(e&&t.stateNode!=null)Ij(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(he(166));if(n=Do(ru.current),Do($i.current),Md(t)){if(r=t.stateNode,n=t.memoizedProps,r[Ti]=t,(s=r.nodeValue!==n)&&(e=Er,e!==null))switch(e.tag){case 3:Od(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Od(r.nodeValue,n,(e.mode&1)!==0)}s&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Ti]=t,t.stateNode=r}return Dn(t),null;case 13:if(Tt(Bt),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if($t&&jr!==null&&t.mode&1&&!(t.flags&128))Y1(),rl(),t.flags|=98560,s=!1;else if(s=Md(t),r!==null&&r.dehydrated!==null){if(e===null){if(!s)throw Error(he(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(he(317));s[Ti]=t}else rl(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Dn(t),s=!1}else si!==null&&(ay(si),si=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||Bt.current&1?gn===0&&(gn=3):Wx())),t.updateQueue!==null&&(t.flags|=4),Dn(t),null);case 4:return sl(),Zg(e,t),e===null&&Zc(t.stateNode.containerInfo),Dn(t),null;case 10:return _x(t.type._context),Dn(t),null;case 17:return pr(t.type)&&Gf(),Dn(t),null;case 19:if(Tt(Bt),s=t.memoizedState,s===null)return Dn(t),null;if(r=(t.flags&128)!==0,o=s.rendering,o===null)if(r)sc(s,!1);else{if(gn!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=np(e),o!==null){for(t.flags|=128,sc(s,!1),r=o.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)s=n,e=r,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,e=o.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Ct(Bt,Bt.current&1|2),t.child}e=e.sibling}s.tail!==null&&rn()>al&&(t.flags|=128,r=!0,sc(s,!1),t.lanes=4194304)}else{if(!r)if(e=np(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),sc(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!$t)return Dn(t),null}else 2*rn()-s.renderingStartTime>al&&n!==1073741824&&(t.flags|=128,r=!0,sc(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(n=s.last,n!==null?n.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=rn(),t.sibling=null,n=Bt.current,Ct(Bt,r?n&1|2:n&1),t):(Dn(t),null);case 22:case 23:return Vx(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?kr&1073741824&&(Dn(t),t.subtreeFlags&6&&(t.flags|=8192)):Dn(t),null;case 24:return null;case 25:return null}throw Error(he(156,t.tag))}function Y2(e,t){switch(Nx(t),t.tag){case 1:return pr(t.type)&&Gf(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return sl(),Tt(fr),Tt(Hn),Rx(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Tx(t),null;case 13:if(Tt(Bt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(he(340));rl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Tt(Bt),null;case 4:return sl(),null;case 10:return _x(t.type._context),null;case 22:case 23:return Vx(),null;case 24:return null;default:return null}}var Fd=!1,zn=!1,G2=typeof WeakSet=="function"?WeakSet:Set,Ie=null;function Oa(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){qt(e,t,r)}else n.current=null}function ey(e,t,n){try{n()}catch(r){qt(e,t,r)}}var $0=!1;function X2(e,t){if($g=Wf,e=O1(),kx(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,c=-1,l=-1,u=0,p=0,f=e,d=null;t:for(;;){for(var h;f!==n||i!==0&&f.nodeType!==3||(c=o+i),f!==s||r!==0&&f.nodeType!==3||(l=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===i&&(c=o),d===s&&++p===r&&(l=o),(h=f.nextSibling)!==null)break;f=d,d=f.parentNode}f=h}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Dg={focusedElem:e,selectionRange:n},Wf=!1,Ie=t;Ie!==null;)if(t=Ie,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ie=e;else for(;Ie!==null;){t=Ie;try{var y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var b=y.memoizedProps,k=y.memoizedState,g=t.stateNode,v=g.getSnapshotBeforeUpdate(t.elementType===t.type?b:ni(t.type,b),k);g.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(he(163))}}catch(S){qt(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,Ie=e;break}Ie=t.return}return y=$0,$0=!1,y}function Rc(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,s!==void 0&&ey(t,n,s)}i=i.next}while(i!==r)}}function Gp(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 ty(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 Aj(e){var t=e.alternate;t!==null&&(e.alternate=null,Aj(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ti],delete t[tu],delete t[Bg],delete t[T2],delete t[R2])),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 Tj(e){return e.tag===5||e.tag===3||e.tag===4}function D0(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Tj(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 ny(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=Yf));else if(r!==4&&(e=e.child,e!==null))for(ny(e,t,n),e=e.sibling;e!==null;)ny(e,t,n),e=e.sibling}function ry(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(ry(e,t,n),e=e.sibling;e!==null;)ry(e,t,n),e=e.sibling}var Pn=null,ri=!1;function Ls(e,t,n){for(n=n.child;n!==null;)Rj(e,t,n),n=n.sibling}function Rj(e,t,n){if(Mi&&typeof Mi.onCommitFiberUnmount=="function")try{Mi.onCommitFiberUnmount(Bp,n)}catch{}switch(n.tag){case 5:zn||Oa(n,t);case 6:var r=Pn,i=ri;Pn=null,Ls(e,t,n),Pn=r,ri=i,Pn!==null&&(ri?(e=Pn,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Pn.removeChild(n.stateNode));break;case 18:Pn!==null&&(ri?(e=Pn,n=n.stateNode,e.nodeType===8?gm(e.parentNode,n):e.nodeType===1&&gm(e,n),Xc(e)):gm(Pn,n.stateNode));break;case 4:r=Pn,i=ri,Pn=n.stateNode.containerInfo,ri=!0,Ls(e,t,n),Pn=r,ri=i;break;case 0:case 11:case 14:case 15:if(!zn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&ey(n,t,o),i=i.next}while(i!==r)}Ls(e,t,n);break;case 1:if(!zn&&(Oa(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(c){qt(n,t,c)}Ls(e,t,n);break;case 21:Ls(e,t,n);break;case 22:n.mode&1?(zn=(r=zn)||n.memoizedState!==null,Ls(e,t,n),zn=r):Ls(e,t,n);break;default:Ls(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 G2),t.forEach(function(r){var i=sR.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function ei(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var s=e,o=t,c=o;e:for(;c!==null;){switch(c.tag){case 5:Pn=c.stateNode,ri=!1;break e;case 3:Pn=c.stateNode.containerInfo,ri=!0;break e;case 4:Pn=c.stateNode.containerInfo,ri=!0;break e}c=c.return}if(Pn===null)throw Error(he(160));Rj(s,o,i),Pn=null,ri=!1;var l=i.alternate;l!==null&&(l.return=null),i.return=null}catch(u){qt(i,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Lj(t,e),t=t.sibling}function Lj(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(ei(t,e),Ei(e),r&4){try{Rc(3,e,e.return),Gp(3,e)}catch(b){qt(e,e.return,b)}try{Rc(5,e,e.return)}catch(b){qt(e,e.return,b)}}break;case 1:ei(t,e),Ei(e),r&512&&n!==null&&Oa(n,n.return);break;case 5:if(ei(t,e),Ei(e),r&512&&n!==null&&Oa(n,n.return),e.flags&32){var i=e.stateNode;try{Kc(i,"")}catch(b){qt(e,e.return,b)}}if(r&4&&(i=e.stateNode,i!=null)){var s=e.memoizedProps,o=n!==null?n.memoizedProps:s,c=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{c==="input"&&s.type==="radio"&&s.name!=null&&n1(i,s),Eg(c,o);var u=Eg(c,s);for(o=0;o<l.length;o+=2){var p=l[o],f=l[o+1];p==="style"?a1(i,f):p==="dangerouslySetInnerHTML"?s1(i,f):p==="children"?Kc(i,f):cx(i,p,f,u)}switch(c){case"input":kg(i,s);break;case"textarea":r1(i,s);break;case"select":var d=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var h=s.value;h!=null?Va(i,!!s.multiple,h,!1):d!==!!s.multiple&&(s.defaultValue!=null?Va(i,!!s.multiple,s.defaultValue,!0):Va(i,!!s.multiple,s.multiple?[]:"",!1))}i[tu]=s}catch(b){qt(e,e.return,b)}}break;case 6:if(ei(t,e),Ei(e),r&4){if(e.stateNode===null)throw Error(he(162));i=e.stateNode,s=e.memoizedProps;try{i.nodeValue=s}catch(b){qt(e,e.return,b)}}break;case 3:if(ei(t,e),Ei(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Xc(t.containerInfo)}catch(b){qt(e,e.return,b)}break;case 4:ei(t,e),Ei(e);break;case 13:ei(t,e),Ei(e),i=e.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(Hx=rn())),r&4&&F0(e);break;case 22:if(p=n!==null&&n.memoizedState!==null,e.mode&1?(zn=(u=zn)||p,ei(t,e),zn=u):ei(t,e),Ei(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!p&&e.mode&1)for(Ie=e,p=e.child;p!==null;){for(f=Ie=p;Ie!==null;){switch(d=Ie,h=d.child,d.tag){case 0:case 11:case 14:case 15:Rc(4,d,d.return);break;case 1:Oa(d,d.return);var y=d.stateNode;if(typeof y.componentWillUnmount=="function"){r=d,n=d.return;try{t=r,y.props=t.memoizedProps,y.state=t.memoizedState,y.componentWillUnmount()}catch(b){qt(r,n,b)}}break;case 5:Oa(d,d.return);break;case 22:if(d.memoizedState!==null){B0(f);continue}}h!==null?(h.return=d,Ie=h):B0(f)}p=p.sibling}e:for(p=null,f=e;;){if(f.tag===5){if(p===null){p=f;try{i=f.stateNode,u?(s=i.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(c=f.stateNode,l=f.memoizedProps.style,o=l!=null&&l.hasOwnProperty("display")?l.display:null,c.style.display=o1("display",o))}catch(b){qt(e,e.return,b)}}}else if(f.tag===6){if(p===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(b){qt(e,e.return,b)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;p===f&&(p=null),f=f.return}p===f&&(p=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:ei(t,e),Ei(e),r&4&&F0(e);break;case 21:break;default:ei(t,e),Ei(e)}}function Ei(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Tj(n)){var r=n;break e}n=n.return}throw Error(he(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(Kc(i,""),r.flags&=-33);var s=D0(e);ry(e,s,i);break;case 3:case 4:var o=r.stateNode.containerInfo,c=D0(e);ny(e,c,o);break;default:throw Error(he(161))}}catch(l){qt(e,e.return,l)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function J2(e,t,n){Ie=e,Oj(e)}function Oj(e,t,n){for(var r=(e.mode&1)!==0;Ie!==null;){var i=Ie,s=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||Fd;if(!o){var c=i.alternate,l=c!==null&&c.memoizedState!==null||zn;c=Fd;var u=zn;if(Fd=o,(zn=l)&&!u)for(Ie=i;Ie!==null;)o=Ie,l=o.child,o.tag===22&&o.memoizedState!==null?H0(i):l!==null?(l.return=o,Ie=l):H0(i);for(;s!==null;)Ie=s,Oj(s),s=s.sibling;Ie=i,Fd=c,zn=u}z0(e)}else i.subtreeFlags&8772&&s!==null?(s.return=i,Ie=s):z0(e)}}function z0(e){for(;Ie!==null;){var t=Ie;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:zn||Gp(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!zn)if(n===null)r.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:ni(t.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;s!==null&&N0(t,s,r);break;case 3:var o=t.updateQueue;if(o!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}N0(t,o,n)}break;case 5:var c=t.stateNode;if(n===null&&t.flags&4){n=c;var l=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.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(he(163))}zn||t.flags&512&&ty(t)}catch(d){qt(t,t.return,d)}}if(t===e){Ie=null;break}if(n=t.sibling,n!==null){n.return=t.return,Ie=n;break}Ie=t.return}}function B0(e){for(;Ie!==null;){var t=Ie;if(t===e){Ie=null;break}var n=t.sibling;if(n!==null){n.return=t.return,Ie=n;break}Ie=t.return}}function H0(e){for(;Ie!==null;){var t=Ie;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Gp(4,t)}catch(l){qt(t,n,l)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var i=t.return;try{r.componentDidMount()}catch(l){qt(t,i,l)}}var s=t.return;try{ty(t)}catch(l){qt(t,s,l)}break;case 5:var o=t.return;try{ty(t)}catch(l){qt(t,o,l)}}}catch(l){qt(t,t.return,l)}if(t===e){Ie=null;break}var c=t.sibling;if(c!==null){c.return=t.return,Ie=c;break}Ie=t.return}}var Q2=Math.ceil,sp=ms.ReactCurrentDispatcher,zx=ms.ReactCurrentOwner,Wr=ms.ReactCurrentBatchConfig,pt=0,Nn=null,cn=null,In=0,kr=0,Ma=yo(0),gn=0,au=null,Go=0,Xp=0,Bx=0,Lc=null,ar=null,Hx=0,al=1/0,Zi=null,op=!1,iy=null,to=null,zd=!1,qs=null,ap=0,Oc=0,sy=null,Cf=-1,Ef=0;function Xn(){return pt&6?rn():Cf!==-1?Cf:Cf=rn()}function no(e){return e.mode&1?pt&2&&In!==0?In&-In:O2.transition!==null?(Ef===0&&(Ef=w1()),Ef):(e=vt,e!==0||(e=window.event,e=e===void 0?16:C1(e.type)),e):1}function di(e,t,n,r){if(50<Oc)throw Oc=0,sy=null,Error(he(185));Iu(e,n,r),(!(pt&2)||e!==Nn)&&(e===Nn&&(!(pt&2)&&(Xp|=n),gn===4&&Vs(e,In)),hr(e,r),n===1&&pt===0&&!(t.mode&1)&&(al=rn()+500,Kp&&xo()))}function hr(e,t){var n=e.callbackNode;OT(e,t);var r=Vf(e,e===Nn?In:0);if(r===0)n!==null&&Jv(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Jv(n),t===1)e.tag===0?L2(U0.bind(null,e)):W1(U0.bind(null,e)),I2(function(){!(pt&6)&&xo()}),n=null;else{switch(v1(r)){case 1:n=hx;break;case 4:n=y1;break;case 16:n=Uf;break;case 536870912:n=x1;break;default:n=Uf}n=Uj(n,Mj.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Mj(e,t){if(Cf=-1,Ef=0,pt&6)throw Error(he(327));var n=e.callbackNode;if(Ga()&&e.callbackNode!==n)return null;var r=Vf(e,e===Nn?In:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=lp(e,r);else{t=r;var i=pt;pt|=2;var s=Dj();(Nn!==e||In!==t)&&(Zi=null,al=rn()+500,zo(e,t));do try{tR();break}catch(c){$j(e,c)}while(!0);Ex(),sp.current=s,pt=i,cn!==null?t=0:(Nn=null,In=0,t=gn)}if(t!==0){if(t===2&&(i=Tg(e),i!==0&&(r=i,t=oy(e,i))),t===1)throw n=au,zo(e,0),Vs(e,r),hr(e,rn()),n;if(t===6)Vs(e,r);else{if(i=e.current.alternate,!(r&30)&&!Z2(i)&&(t=lp(e,r),t===2&&(s=Tg(e),s!==0&&(r=s,t=oy(e,s))),t===1))throw n=au,zo(e,0),Vs(e,r),hr(e,rn()),n;switch(e.finishedWork=i,e.finishedLanes=r,t){case 0:case 1:throw Error(he(345));case 2:Ro(e,ar,Zi);break;case 3:if(Vs(e,r),(r&130023424)===r&&(t=Hx+500-rn(),10<t)){if(Vf(e,0)!==0)break;if(i=e.suspendedLanes,(i&r)!==r){Xn(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=zg(Ro.bind(null,e,ar,Zi),t);break}Ro(e,ar,Zi);break;case 4:if(Vs(e,r),(r&4194240)===r)break;for(t=e.eventTimes,i=-1;0<r;){var o=31-ui(r);s=1<<o,o=t[o],o>i&&(i=o),r&=~s}if(r=i,r=rn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Q2(r/1960))-r,10<r){e.timeoutHandle=zg(Ro.bind(null,e,ar,Zi),r);break}Ro(e,ar,Zi);break;case 5:Ro(e,ar,Zi);break;default:throw Error(he(329))}}}return hr(e,rn()),e.callbackNode===n?Mj.bind(null,e):null}function oy(e,t){var n=Lc;return e.current.memoizedState.isDehydrated&&(zo(e,t).flags|=256),e=lp(e,t),e!==2&&(t=ar,ar=n,t!==null&&ay(t)),e}function ay(e){ar===null?ar=e:ar.push.apply(ar,e)}function Z2(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],s=i.getSnapshot;i=i.value;try{if(!fi(s(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Vs(e,t){for(t&=~Bx,t&=~Xp,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-ui(t),r=1<<n;e[n]=-1,t&=~r}}function U0(e){if(pt&6)throw Error(he(327));Ga();var t=Vf(e,0);if(!(t&1))return hr(e,rn()),null;var n=lp(e,t);if(e.tag!==0&&n===2){var r=Tg(e);r!==0&&(t=r,n=oy(e,r))}if(n===1)throw n=au,zo(e,0),Vs(e,t),hr(e,rn()),n;if(n===6)throw Error(he(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Ro(e,ar,Zi),hr(e,rn()),null}function Ux(e,t){var n=pt;pt|=1;try{return e(t)}finally{pt=n,pt===0&&(al=rn()+500,Kp&&xo())}}function Xo(e){qs!==null&&qs.tag===0&&!(pt&6)&&Ga();var t=pt;pt|=1;var n=Wr.transition,r=vt;try{if(Wr.transition=null,vt=1,e)return e()}finally{vt=r,Wr.transition=n,pt=t,!(pt&6)&&xo()}}function Vx(){kr=Ma.current,Tt(Ma)}function zo(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,P2(n)),cn!==null)for(n=cn.return;n!==null;){var r=n;switch(Nx(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Gf();break;case 3:sl(),Tt(fr),Tt(Hn),Rx();break;case 5:Tx(r);break;case 4:sl();break;case 13:Tt(Bt);break;case 19:Tt(Bt);break;case 10:_x(r.type._context);break;case 22:case 23:Vx()}n=n.return}if(Nn=e,cn=e=ro(e.current,null),In=kr=t,gn=0,au=null,Bx=Xp=Go=0,ar=Lc=null,$o!==null){for(t=0;t<$o.length;t++)if(n=$o[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,s=n.pending;if(s!==null){var o=s.next;s.next=i,r.next=o}n.pending=r}$o=null}return e}function $j(e,t){do{var n=cn;try{if(Ex(),Sf.current=ip,rp){for(var r=Ht.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}rp=!1}if(Yo=0,kn=pn=Ht=null,Tc=!1,iu=0,zx.current=null,n===null||n.return===null){gn=1,au=t,cn=null;break}e:{var s=e,o=n.return,c=n,l=t;if(t=In,c.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var u=l,p=c,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=I0(o);if(h!==null){h.flags&=-257,A0(h,o,c,s,t),h.mode&1&&P0(s,u,t),t=h,l=u;var y=t.updateQueue;if(y===null){var b=new Set;b.add(l),t.updateQueue=b}else y.add(l);break e}else{if(!(t&1)){P0(s,u,t),Wx();break e}l=Error(he(426))}}else if($t&&c.mode&1){var k=I0(o);if(k!==null){!(k.flags&65536)&&(k.flags|=256),A0(k,o,c,s,t),jx(ol(l,c));break e}}s=l=ol(l,c),gn!==4&&(gn=2),Lc===null?Lc=[s]:Lc.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t;var g=vj(s,l,t);S0(s,g);break e;case 1:c=l;var v=s.type,w=s.stateNode;if(!(s.flags&128)&&(typeof v.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(to===null||!to.has(w)))){s.flags|=65536,t&=-t,s.lanes|=t;var S=bj(s,c,t);S0(s,S);break e}}s=s.return}while(s!==null)}zj(n)}catch(C){t=C,cn===n&&n!==null&&(cn=n=n.return);continue}break}while(!0)}function Dj(){var e=sp.current;return sp.current=ip,e===null?ip:e}function Wx(){(gn===0||gn===3||gn===2)&&(gn=4),Nn===null||!(Go&268435455)&&!(Xp&268435455)||Vs(Nn,In)}function lp(e,t){var n=pt;pt|=2;var r=Dj();(Nn!==e||In!==t)&&(Zi=null,zo(e,t));do try{eR();break}catch(i){$j(e,i)}while(!0);if(Ex(),pt=n,sp.current=r,cn!==null)throw Error(he(261));return Nn=null,In=0,gn}function eR(){for(;cn!==null;)Fj(cn)}function tR(){for(;cn!==null&&!CT();)Fj(cn)}function Fj(e){var t=Hj(e.alternate,e,kr);e.memoizedProps=e.pendingProps,t===null?zj(e):cn=t,zx.current=null}function zj(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=Y2(n,t),n!==null){n.flags&=32767,cn=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{gn=6,cn=null;return}}else if(n=q2(n,t,kr),n!==null){cn=n;return}if(t=t.sibling,t!==null){cn=t;return}cn=t=e}while(t!==null);gn===0&&(gn=5)}function Ro(e,t,n){var r=vt,i=Wr.transition;try{Wr.transition=null,vt=1,nR(e,t,n,r)}finally{Wr.transition=i,vt=r}return null}function nR(e,t,n,r){do Ga();while(qs!==null);if(pt&6)throw Error(he(327));n=e.finishedWork;var i=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(he(177));e.callbackNode=null,e.callbackPriority=0;var s=n.lanes|n.childLanes;if(MT(e,s),e===Nn&&(cn=Nn=null,In=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||zd||(zd=!0,Uj(Uf,function(){return Ga(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=Wr.transition,Wr.transition=null;var o=vt;vt=1;var c=pt;pt|=4,zx.current=null,X2(e,n),Lj(n,e),k2(Dg),Wf=!!$g,Dg=$g=null,e.current=n,J2(n),ET(),pt=c,vt=o,Wr.transition=s}else e.current=n;if(zd&&(zd=!1,qs=e,ap=i),s=e.pendingLanes,s===0&&(to=null),IT(n.stateNode),hr(e,rn()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)i=t[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(op)throw op=!1,e=iy,iy=null,e;return ap&1&&e.tag!==0&&Ga(),s=e.pendingLanes,s&1?e===sy?Oc++:(Oc=0,sy=e):Oc=0,xo(),null}function Ga(){if(qs!==null){var e=v1(ap),t=Wr.transition,n=vt;try{if(Wr.transition=null,vt=16>e?16:e,qs===null)var r=!1;else{if(e=qs,qs=null,ap=0,pt&6)throw Error(he(331));var i=pt;for(pt|=4,Ie=e.current;Ie!==null;){var s=Ie,o=s.child;if(Ie.flags&16){var c=s.deletions;if(c!==null){for(var l=0;l<c.length;l++){var u=c[l];for(Ie=u;Ie!==null;){var p=Ie;switch(p.tag){case 0:case 11:case 15:Rc(8,p,s)}var f=p.child;if(f!==null)f.return=p,Ie=f;else for(;Ie!==null;){p=Ie;var d=p.sibling,h=p.return;if(Aj(p),p===u){Ie=null;break}if(d!==null){d.return=h,Ie=d;break}Ie=h}}}var y=s.alternate;if(y!==null){var b=y.child;if(b!==null){y.child=null;do{var k=b.sibling;b.sibling=null,b=k}while(b!==null)}}Ie=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,Ie=o;else e:for(;Ie!==null;){if(s=Ie,s.flags&2048)switch(s.tag){case 0:case 11:case 15:Rc(9,s,s.return)}var g=s.sibling;if(g!==null){g.return=s.return,Ie=g;break e}Ie=s.return}}var v=e.current;for(Ie=v;Ie!==null;){o=Ie;var w=o.child;if(o.subtreeFlags&2064&&w!==null)w.return=o,Ie=w;else e:for(o=v;Ie!==null;){if(c=Ie,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:Gp(9,c)}}catch(C){qt(c,c.return,C)}if(c===o){Ie=null;break e}var S=c.sibling;if(S!==null){S.return=c.return,Ie=S;break e}Ie=c.return}}if(pt=i,xo(),Mi&&typeof Mi.onPostCommitFiberRoot=="function")try{Mi.onPostCommitFiberRoot(Bp,e)}catch{}r=!0}return r}finally{vt=n,Wr.transition=t}}return!1}function V0(e,t,n){t=ol(n,t),t=vj(e,t,1),e=eo(e,t,1),t=Xn(),e!==null&&(Iu(e,1,t),hr(e,t))}function qt(e,t,n){if(e.tag===3)V0(e,e,n);else for(;t!==null;){if(t.tag===3){V0(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(to===null||!to.has(r))){e=ol(n,e),e=bj(t,e,1),t=eo(t,e,1),e=Xn(),t!==null&&(Iu(t,1,e),hr(t,e));break}}t=t.return}}function rR(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Xn(),e.pingedLanes|=e.suspendedLanes&n,Nn===e&&(In&n)===n&&(gn===4||gn===3&&(In&130023424)===In&&500>rn()-Hx?zo(e,0):Bx|=n),hr(e,t)}function Bj(e,t){t===0&&(e.mode&1?(t=Id,Id<<=1,!(Id&130023424)&&(Id=4194304)):t=1);var n=Xn();e=us(e,t),e!==null&&(Iu(e,t,n),hr(e,n))}function iR(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Bj(e,n)}function sR(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(he(314))}r!==null&&r.delete(t),Bj(e,n)}var Hj;Hj=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||fr.current)lr=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return lr=!1,K2(e,t,n);lr=!!(e.flags&131072)}else lr=!1,$t&&t.flags&1048576&&K1(t,Qf,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;jf(e,t),e=t.pendingProps;var i=nl(t,Hn.current);Ya(t,n),i=Ox(null,t,r,e,i,n);var s=Mx();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,pr(r)?(s=!0,Xf(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Ix(t),i.updater=Yp,t.stateNode=i,i._reactInternals=t,qg(t,r,e,n),t=Xg(null,t,r,!0,s,n)):(t.tag=0,$t&&s&&Sx(t),Yn(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(jf(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=aR(r),e=ni(r,e),i){case 0:t=Gg(null,t,r,e,n);break e;case 1:t=L0(null,t,r,e,n);break e;case 11:t=T0(null,t,r,e,n);break e;case 14:t=R0(null,t,r,ni(r.type,e),n);break e}throw Error(he(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:ni(r,i),Gg(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:ni(r,i),L0(e,t,r,i,n);case 3:e:{if(jj(t),e===null)throw Error(he(387));r=t.pendingProps,s=t.memoizedState,i=s.element,Q1(e,t),tp(t,r,null,n);var o=t.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=ol(Error(he(423)),t),t=O0(e,t,r,n,i);break e}else if(r!==i){i=ol(Error(he(424)),t),t=O0(e,t,r,n,i);break e}else for(jr=Zs(t.stateNode.containerInfo.firstChild),Er=t,$t=!0,si=null,n=X1(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(rl(),r===i){t=ds(e,t,n);break e}Yn(e,t,r,n)}t=t.child}return t;case 5:return Z1(t),e===null&&Vg(t),r=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,Fg(r,i)?o=null:s!==null&&Fg(r,s)&&(t.flags|=32),Nj(e,t),Yn(e,t,o,n),t.child;case 6:return e===null&&Vg(t),null;case 13:return Cj(e,t,n);case 4:return Ax(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=il(t,null,r,n):Yn(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:ni(r,i),T0(e,t,r,i,n);case 7:return Yn(e,t,t.pendingProps,n),t.child;case 8:return Yn(e,t,t.pendingProps.children,n),t.child;case 12:return Yn(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,s=t.memoizedProps,o=i.value,Ct(Zf,r._currentValue),r._currentValue=o,s!==null)if(fi(s.value,o)){if(s.children===i.children&&!fr.current){t=ds(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var c=s.dependencies;if(c!==null){o=s.child;for(var l=c.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=as(-1,n&-n),l.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var p=u.pending;p===null?l.next=l:(l.next=p.next,p.next=l),u.pending=l}}s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),Wg(s.return,n,t),c.lanes|=n;break}l=l.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(he(341));o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Wg(o,n,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Yn(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,Ya(t,n),i=Kr(i),r=r(i),t.flags|=1,Yn(e,t,r,n),t.child;case 14:return r=t.type,i=ni(r,t.pendingProps),i=ni(r.type,i),R0(e,t,r,i,n);case 15:return kj(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:ni(r,i),jf(e,t),t.tag=1,pr(r)?(e=!0,Xf(t)):e=!1,Ya(t,n),wj(t,r,i),qg(t,r,i,n),Xg(null,t,r,!0,e,n);case 19:return Ej(e,t,n);case 22:return Sj(e,t,n)}throw Error(he(156,t.tag))};function Uj(e,t){return g1(e,t)}function oR(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 Vr(e,t,n,r){return new oR(e,t,n,r)}function Kx(e){return e=e.prototype,!(!e||!e.isReactComponent)}function aR(e){if(typeof e=="function")return Kx(e)?1:0;if(e!=null){if(e=e.$$typeof,e===dx)return 11;if(e===fx)return 14}return 2}function ro(e,t){var n=e.alternate;return n===null?(n=Vr(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 _f(e,t,n,r,i,s){var o=2;if(r=e,typeof e=="function")Kx(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Ca:return Bo(n.children,i,s,t);case ux:o=8,i|=8;break;case yg:return e=Vr(12,n,t,i|2),e.elementType=yg,e.lanes=s,e;case xg:return e=Vr(13,n,t,i),e.elementType=xg,e.lanes=s,e;case wg:return e=Vr(19,n,t,i),e.elementType=wg,e.lanes=s,e;case ZN:return Jp(n,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case JN:o=10;break e;case QN:o=9;break e;case dx:o=11;break e;case fx:o=14;break e;case zs:o=16,r=null;break e}throw Error(he(130,e==null?e:typeof e,""))}return t=Vr(o,n,t,i),t.elementType=e,t.type=r,t.lanes=s,t}function Bo(e,t,n,r){return e=Vr(7,e,r,t),e.lanes=n,e}function Jp(e,t,n,r){return e=Vr(22,e,r,t),e.elementType=ZN,e.lanes=n,e.stateNode={isHidden:!1},e}function Nm(e,t,n){return e=Vr(6,e,null,t),e.lanes=n,e}function jm(e,t,n){return t=Vr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function lR(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=sm(0),this.expirationTimes=sm(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=sm(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function qx(e,t,n,r,i,s,o,c,l){return e=new lR(e,t,n,c,l),t===1?(t=1,s===!0&&(t|=8)):t=0,s=Vr(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ix(s),e}function cR(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ja,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function Vj(e){if(!e)return lo;e=e._reactInternals;e:{if(ra(e)!==e||e.tag!==1)throw Error(he(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(pr(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(he(171))}if(e.tag===1){var n=e.type;if(pr(n))return V1(e,n,t)}return t}function Wj(e,t,n,r,i,s,o,c,l){return e=qx(n,r,!0,e,i,s,o,c,l),e.context=Vj(null),n=e.current,r=Xn(),i=no(n),s=as(r,i),s.callback=t??null,eo(n,s,i),e.current.lanes=i,Iu(e,i,r),hr(e,r),e}function Qp(e,t,n,r){var i=t.current,s=Xn(),o=no(i);return n=Vj(n),t.context===null?t.context=n:t.pendingContext=n,t=as(s,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=eo(i,t,o),e!==null&&(di(e,i,o,s),kf(e,i,o)),o}function cp(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function W0(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Yx(e,t){W0(e,t),(e=e.alternate)&&W0(e,t)}function uR(){return null}var Kj=typeof reportError=="function"?reportError:function(e){console.error(e)};function Gx(e){this._internalRoot=e}Zp.prototype.render=Gx.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(he(409));Qp(e,t,null,null)};Zp.prototype.unmount=Gx.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Xo(function(){Qp(null,e,null,null)}),t[cs]=null}};function Zp(e){this._internalRoot=e}Zp.prototype.unstable_scheduleHydration=function(e){if(e){var t=S1();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Us.length&&t!==0&&t<Us[n].priority;n++);Us.splice(n,0,e),n===0&&j1(e)}};function Xx(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function eh(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function K0(){}function dR(e,t,n,r,i){if(i){if(typeof r=="function"){var s=r;r=function(){var u=cp(o);s.call(u)}}var o=Wj(t,r,e,0,null,!1,!1,"",K0);return e._reactRootContainer=o,e[cs]=o.current,Zc(e.nodeType===8?e.parentNode:e),Xo(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r=="function"){var c=r;r=function(){var u=cp(l);c.call(u)}}var l=qx(e,0,!1,null,null,!1,!1,"",K0);return e._reactRootContainer=l,e[cs]=l.current,Zc(e.nodeType===8?e.parentNode:e),Xo(function(){Qp(t,l,n,r)}),l}function th(e,t,n,r,i){var s=n._reactRootContainer;if(s){var o=s;if(typeof i=="function"){var c=i;i=function(){var l=cp(o);c.call(l)}}Qp(t,o,e,i)}else o=dR(n,t,e,i,r);return cp(o)}b1=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=wc(t.pendingLanes);n!==0&&(mx(t,n|1),hr(t,rn()),!(pt&6)&&(al=rn()+500,xo()))}break;case 13:Xo(function(){var r=us(e,1);if(r!==null){var i=Xn();di(r,e,1,i)}}),Yx(e,1)}};gx=function(e){if(e.tag===13){var t=us(e,134217728);if(t!==null){var n=Xn();di(t,e,134217728,n)}Yx(e,134217728)}};k1=function(e){if(e.tag===13){var t=no(e),n=us(e,t);if(n!==null){var r=Xn();di(n,e,t,r)}Yx(e,t)}};S1=function(){return vt};N1=function(e,t){var n=vt;try{return vt=e,t()}finally{vt=n}};Pg=function(e,t,n){switch(t){case"input":if(kg(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=Wp(r);if(!i)throw Error(he(90));t1(r),kg(r,i)}}}break;case"textarea":r1(e,n);break;case"select":t=n.value,t!=null&&Va(e,!!n.multiple,t,!1)}};u1=Ux;d1=Xo;var fR={usingClientEntryPoint:!1,Events:[Tu,Ia,Wp,l1,c1,Ux]},oc={findFiberByHostInstance:Mo,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},pR={bundleType:oc.bundleType,version:oc.version,rendererPackageName:oc.rendererPackageName,rendererConfig:oc.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ms.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=h1(e),e===null?null:e.stateNode},findFiberByHostInstance:oc.findFiberByHostInstance||uR,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 Bd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Bd.isDisabled&&Bd.supportsFiber)try{Bp=Bd.inject(pR),Mi=Bd}catch{}}Tr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=fR;Tr.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Xx(t))throw Error(he(200));return cR(e,t,null,n)};Tr.createRoot=function(e,t){if(!Xx(e))throw Error(he(299));var n=!1,r="",i=Kj;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=qx(e,1,!1,null,null,n,!1,r,i),e[cs]=t.current,Zc(e.nodeType===8?e.parentNode:e),new Gx(t)};Tr.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(he(188)):(e=Object.keys(e).join(","),Error(he(268,e)));return e=h1(t),e=e===null?null:e.stateNode,e};Tr.flushSync=function(e){return Xo(e)};Tr.hydrate=function(e,t,n){if(!eh(t))throw Error(he(200));return th(null,e,t,!0,n)};Tr.hydrateRoot=function(e,t,n){if(!Xx(e))throw Error(he(405));var r=n!=null&&n.hydratedSources||null,i=!1,s="",o=Kj;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=Wj(t,null,e,1,n??null,i,!1,s,o),e[cs]=t.current,Zc(e),r)for(e=0;e<r.length;e++)n=r[e],i=n._getVersion,i=i(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,i]:t.mutableSourceEagerHydrationData.push(n,i);return new Zp(t)};Tr.render=function(e,t,n){if(!eh(t))throw Error(he(200));return th(null,e,t,!1,n)};Tr.unmountComponentAtNode=function(e){if(!eh(e))throw Error(he(40));return e._reactRootContainer?(Xo(function(){th(null,null,e,!1,function(){e._reactRootContainer=null,e[cs]=null})}),!0):!1};Tr.unstable_batchedUpdates=Ux;Tr.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!eh(n))throw Error(he(200));if(e==null||e._reactInternals===void 0)throw Error(he(38));return th(e,t,n,!1,r)};Tr.version="18.3.1-next-f1338f8080-20240426";function qj(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(qj)}catch(e){console.error(e)}}qj(),qN.exports=Tr;var Hr=qN.exports,q0=Hr;mg.createRoot=q0.createRoot,mg.hydrateRoot=q0.hydrateRoot;const Yj=m.createContext(null);function ly(e){let t=e||"/";return t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t||"/"}function hR(){const e=ly(window.location.pathname);return e==="/"?(window.history.replaceState({},"","/projects"),"/projects"):e}function mR({children:e}){const[t,n]=m.useState(hR);m.useEffect(()=>{const s=()=>n(ly(window.location.pathname));return window.addEventListener("popstate",s),()=>window.removeEventListener("popstate",s)},[]);const r=m.useCallback(s=>{const o=s.startsWith("/")?s:`/${s}`;let c;try{c=new URL(o,window.location.origin)}catch{c=new URL("/",window.location.origin)}const l=ly(c.pathname),u=c.search||"";window.history.pushState({},"",l+u),n(l)},[]),i=m.useMemo(()=>({path:t,navigate:r}),[t,r]);return a.jsx(Yj.Provider,{value:i,children:e})}function ia(){const e=m.useContext(Yj);if(!e)throw new Error("useRoute must be used within RouteProvider");return e}function gR(){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 Y0={};function cy(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];typeof t[0]=="string"&&Y0[t[0]]||(typeof t[0]=="string"&&(Y0[t[0]]=new Date),gR(...t))}const Gj=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}};function G0(e,t,n){e.loadNamespaces(t,Gj(e,n))}function X0(e,t,n,r){typeof n=="string"&&(n=[n]),n.forEach(i=>{e.options.ns.indexOf(i)<0&&e.options.ns.push(i)}),e.loadLanguages(t,Gj(e,r))}function yR(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=t.languages[0],i=t.options?t.options.fallbackLng:!1,s=t.languages[t.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const o=(c,l)=>{const u=t.services.backendConnector.state[`${c}|${l}`];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)&&(!i||o(s,e)))}function xR(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(cy("i18n.languages were undefined or empty",t.languages),!0):t.options.ignoreJSONStructure!==void 0?t.hasLoadedNamespace(e,{lng:n.lng,precheck:(i,s)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&i.services.backendConnector.backend&&i.isLanguageChangingTo&&!s(i.isLanguageChangingTo,e))return!1}}):yR(e,t,n)}const wR=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,vR={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},bR=e=>vR[e],kR=e=>e.replace(wR,bR);let uy={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:kR};function SR(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};uy={...uy,...e}}function NR(){return uy}let Xj;function jR(e){Xj=e}function CR(){return Xj}const ER={type:"3rdParty",init(e){SR(e.options.react),jR(e)}},_R=m.createContext();class PR{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const IR=(e,t)=>{const n=m.useRef();return m.useEffect(()=>{n.current=e},[e,t]),n.current};function _t(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=t,{i18n:r,defaultNS:i}=m.useContext(_R)||{},s=n||r||CR();if(s&&!s.reportNamespaces&&(s.reportNamespaces=new PR),!s){cy("You will need to pass in an i18next instance by using initReactI18next");const w=(C,N)=>typeof N=="string"?N:N&&typeof N=="object"&&typeof N.defaultValue=="string"?N.defaultValue:Array.isArray(C)?C[C.length-1]:C,S=[w,{},!1];return S.t=w,S.i18n={},S.ready=!1,S}s.options.react&&s.options.react.wait!==void 0&&cy("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const o={...NR(),...s.options.react,...t},{useSuspense:c,keyPrefix:l}=o;let u=e||i||s.options&&s.options.defaultNS;u=typeof u=="string"?[u]:u||["translation"],s.reportNamespaces.addUsedNamespaces&&s.reportNamespaces.addUsedNamespaces(u);const p=(s.isInitialized||s.initializedStoreOnce)&&u.every(w=>xR(w,s,o));function f(){return s.getFixedT(t.lng||null,o.nsMode==="fallback"?u:u[0],l)}const[d,h]=m.useState(f);let y=u.join();t.lng&&(y=`${t.lng}${y}`);const b=IR(y),k=m.useRef(!0);m.useEffect(()=>{const{bindI18n:w,bindI18nStore:S}=o;k.current=!0,!p&&!c&&(t.lng?X0(s,t.lng,u,()=>{k.current&&h(f)}):G0(s,u,()=>{k.current&&h(f)})),p&&b&&b!==y&&k.current&&h(f);function C(){k.current&&h(f)}return w&&s&&s.on(w,C),S&&s&&s.store.on(S,C),()=>{k.current=!1,w&&s&&w.split(" ").forEach(N=>s.off(N,C)),S&&s&&S.split(" ").forEach(N=>s.store.off(N,C))}},[s,y]);const g=m.useRef(!0);m.useEffect(()=>{k.current&&!g.current&&h(f),g.current=!1},[s,l]);const v=[d,s,p];if(v.t=d,v.i18n=s,v.ready=p,p||!p&&!c)return v;throw new Promise(w=>{t.lng?X0(s,t.lng,u,()=>w()):G0(s,u,()=>w())})}const Jj="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",AR=[{to:"/projects",labelKey:"common:nav.projects",icon:"folder_open"},{to:"/nodes",labelKey:"common:nav.nodes",icon:"account_tree"},{to:"/skills",labelKey:"common:nav.skills",icon:"extension"},{to:"/settings",labelKey:"common:nav.settings",icon:"settings"}],TR=[{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 RR(e,t){return t==="/projects"?e==="/projects"||e==="/":e===t||e.startsWith(t+"/")}function LR({authUser:e,onLogout:t}){const{path:n,navigate:r}=ia(),{t:i}=_t(),[s,o]=m.useState(!1);return m.useEffect(()=>{let c=!1;return fetch("/api/ui-context").then(l=>l.json()).then(l=>{c||o(!!l.hideCommunityLinks)}).catch(()=>{}),()=>{c=!0}},[]),a.jsxs("aside",{className:"af-sidebar","aria-label":i("flow:sidebar.mainNav"),children:[a.jsxs("div",{className:"af-brand",children:[a.jsx("div",{className:"af-brand-mark","aria-hidden":!0,children:a.jsx("img",{src:Jj,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:AR.map(c=>a.jsxs("button",{type:"button",className:"af-nav-link"+(RR(n,c.to)?" af-nav-link--active":""),onClick:()=>r(c.to),children:[a.jsx("span",{className:"material-symbols-outlined",children:c.icon}),a.jsx("span",{children:i(c.labelKey)})]},c.to))}),a.jsxs("div",{className:"af-sidebar-footer",children:[a.jsxs("div",{className:"af-sidebar-user",title:(e==null?void 0:e.username)||(e==null?void 0:e.userId)||"",children:[a.jsx("span",{className:"material-symbols-outlined",children:"person"}),a.jsx("span",{children:(e==null?void 0:e.username)||(e==null?void 0:e.userId)||""}),a.jsx("button",{type:"button",className:"af-sidebar-logout",onClick:t,"aria-label":"Logout",title:"Logout",children:a.jsx("span",{className:"material-symbols-outlined",children:"logout"})})]}),!s&&TR.map(c=>{const l=i(c.labelKey);return a.jsx("a",{className:"af-sidebar-ext",href:c.href,target:"_blank",rel:"noopener noreferrer","aria-label":l,title:l,children:a.jsx("span",{className:"material-symbols-outlined",children:c.icon})},c.href)})]})]})}const Qj="agentflow.pipelineRecent",OR=50,MR=15;function $R(e){try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function Zj(){if(typeof localStorage>"u")return[];const e=localStorage.getItem(Qj);return e?$R(e).filter(t=>t&&typeof t.flowId=="string"&&(t.flowSource==="user"||t.flowSource==="builtin"||t.flowSource==="workspace")&&t.kind==="opened"&&typeof t.at=="number"):[]}function Hd(e,t){if(typeof localStorage>"u")return;const n=Date.now(),r=Zj(),s=[{flowId:e,flowSource:t,kind:"opened",at:n},...r.filter(o=>!(o.flowId===e&&o.flowSource===t))].slice(0,OR);try{localStorage.setItem(Qj,JSON.stringify(s))}catch{}}function DR(e,t){const n=e.filter(r=>r.id===t);return n.length===0||n.some(r=>(r.source??"user")==="user")?"user":n.some(r=>r.source==="workspace")?"workspace":n.some(r=>r.source==="builtin")?"builtin":n[0].source??"user"}function dy(e,t){const n=Date.now(),r=Math.max(0,n-e),i=Math.floor(r/1e3);if(i<60)return t("flow:time.justNow");const s=Math.floor(i/60);if(s<60)return t("flow:time.minutesAgo",{n:s});const o=Math.floor(s/60);if(o<24)return t("flow:time.hoursAgo",{n:o});const c=new Date(e),l=new Date,u=new Date(l);if(u.setDate(u.getDate()-1),c.toDateString()===u.toDateString())return t("flow:time.yesterday");const p=Math.floor(o/24);return p<7?t("flow:time.daysAgo",{n:p}):`${c.getMonth()+1}/${c.getDate()}`}function FR(e,t){if(e==null||!Number.isFinite(e)||e<=0)return"--";if(e<1e3)return t("flow:time.milliseconds",{n:Math.max(1,Math.round(e))});const n=e/1e3;return t("flow:time.seconds",{n:n>=10?Math.round(n):n.toFixed(1)})}function zR(e,t,n){const r=[];for(const i of e)!i||typeof i.flowId!="string"||typeof i.at!="number"||r.push({flowId:i.flowId,flowSource:DR(n,i.flowId),kind:"executed",at:i.at});for(const i of t)r.push({flowId:i.flowId,flowSource:i.flowSource,kind:"opened",at:i.at});return r.sort((i,s)=>s.at-i.at),r.slice(0,MR)}var Sr=Uint8Array,$a=Uint16Array,BR=Int32Array,eC=new Sr([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]),tC=new Sr([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]),HR=new Sr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),nC=function(e,t){for(var n=new $a(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new BR(n[30]),r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)i[s]=s-n[r]<<5|r;return{b:n,r:i}},rC=nC(eC,2),iC=rC.b,UR=rC.r;iC[28]=258,UR[258]=28;var VR=nC(tC,0),WR=VR.b,fy=new $a(32768);for(var At=0;At<32768;++At){var Os=(At&43690)>>1|(At&21845)<<1;Os=(Os&52428)>>2|(Os&13107)<<2,Os=(Os&61680)>>4|(Os&3855)<<4,fy[At]=((Os&65280)>>8|(Os&255)<<8)>>1}var Mc=function(e,t,n){for(var r=e.length,i=0,s=new $a(t);i<r;++i)e[i]&&++s[e[i]-1];var o=new $a(t);for(i=1;i<t;++i)o[i]=o[i-1]+s[i-1]<<1;var c;if(n){c=new $a(1<<t);var l=15-t;for(i=0;i<r;++i)if(e[i])for(var u=i<<4|e[i],p=t-e[i],f=o[e[i]-1]++<<p,d=f|(1<<p)-1;f<=d;++f)c[fy[f]>>l]=u}else for(c=new $a(r),i=0;i<r;++i)e[i]&&(c[i]=fy[o[e[i]-1]++]>>15-e[i]);return c},Lu=new Sr(288);for(var At=0;At<144;++At)Lu[At]=8;for(var At=144;At<256;++At)Lu[At]=9;for(var At=256;At<280;++At)Lu[At]=7;for(var At=280;At<288;++At)Lu[At]=8;var sC=new Sr(32);for(var At=0;At<32;++At)sC[At]=5;var KR=Mc(Lu,9,1),qR=Mc(sC,5,1),Cm=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},ti=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},Em=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},YR=function(e){return(e+7)/8|0},Jx=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new Sr(e.subarray(t,n))},GR=["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"],Dr=function(e,t,n){var r=new Error(t||GR[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,Dr),!n)throw r;return r},XR=function(e,t,n,r){var i=e.length,s=r?r.length:0;if(!i||t.f&&!t.l)return n||new Sr(0);var o=!n,c=o||t.i!=2,l=t.i;o&&(n=new Sr(i*3));var u=function(de){var me=n.length;if(de>me){var Se=new Sr(Math.max(me*2,de));Se.set(n),n=Se}},p=t.f||0,f=t.p||0,d=t.b||0,h=t.l,y=t.d,b=t.m,k=t.n,g=i*8;do{if(!h){p=ti(e,f,1);var v=ti(e,f+1,3);if(f+=3,v)if(v==1)h=KR,y=qR,b=9,k=5;else if(v==2){var N=ti(e,f,31)+257,P=ti(e,f+10,15)+4,R=N+ti(e,f+5,31)+1;f+=14;for(var M=new Sr(R),U=new Sr(19),L=0;L<P;++L)U[HR[L]]=ti(e,f+L*3,7);f+=P*3;for(var A=Cm(U),V=(1<<A)-1,T=Mc(U,A,1),L=0;L<R;){var $=T[ti(e,f,V)];f+=$&15;var w=$>>4;if(w<16)M[L++]=w;else{var D=0,K=0;for(w==16?(K=3+ti(e,f,3),f+=2,D=M[L-1]):w==17?(K=3+ti(e,f,7),f+=3):w==18&&(K=11+ti(e,f,127),f+=7);K--;)M[L++]=D}}var _=M.subarray(0,N),I=M.subarray(N);b=Cm(_),k=Cm(I),h=Mc(_,b,1),y=Mc(I,k,1)}else Dr(1);else{var w=YR(f)+4,S=e[w-4]|e[w-3]<<8,C=w+S;if(C>i){l&&Dr(0);break}c&&u(d+S),n.set(e.subarray(w,C),d),t.b=d+=S,t.p=f=C*8,t.f=p;continue}if(f>g){l&&Dr(0);break}}c&&u(d+131072);for(var E=(1<<b)-1,Y=(1<<k)-1,G=f;;G=f){var D=h[Em(e,f)&E],F=D>>4;if(f+=D&15,f>g){l&&Dr(0);break}if(D||Dr(2),F<256)n[d++]=F;else if(F==256){G=f,h=null;break}else{var Z=F-254;if(F>264){var L=F-257,oe=eC[L];Z=ti(e,f,(1<<oe)-1)+iC[L],f+=oe}var ue=y[Em(e,f)&Y],ce=ue>>4;ue||Dr(3),f+=ue&15;var I=WR[ce];if(ce>3){var oe=tC[ce];I+=Em(e,f)&(1<<oe)-1,f+=oe}if(f>g){l&&Dr(0);break}c&&u(d+131072);var le=d+Z;if(d<I){var ve=s-I,ie=Math.min(I,le);for(ve+d<0&&Dr(3);d<ie;++d)n[d]=r[ve+d]}for(;d<le;++d)n[d]=n[d-I]}}t.l=h,t.p=G,t.b=d,t.f=p,h&&(p=1,t.m=b,t.d=y,t.n=k)}while(!p);return d!=n.length&&o?Jx(n,0,d):n.subarray(0,d)},JR=new Sr(0),Ri=function(e,t){return e[t]|e[t+1]<<8},oi=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},_m=function(e,t){return oi(e,t)+oi(e,t+4)*4294967296};function QR(e,t){return XR(e,{i:2},t&&t.out,t&&t.dictionary)}var py=typeof TextDecoder<"u"&&new TextDecoder,ZR=0;try{py.decode(JR,{stream:!0}),ZR=1}catch{}var eL=function(e){for(var t="",n=0;;){var r=e[n++],i=(r>127)+(r>223)+(r>239);if(n+i>e.length)return{s:t,r:Jx(e,n-1)};i?i==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r)}};function tL(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(py)return py.decode(e);var i=eL(e),s=i.s,n=i.r;return n.length&&Dr(8),s}}var nL=function(e,t){return t+30+Ri(e,t+26)+Ri(e,t+28)},rL=function(e,t,n){var r=Ri(e,t+28),i=tL(e.subarray(t+46,t+46+r),!(Ri(e,t+8)&2048)),s=t+46+r,o=oi(e,t+20),c=n&&o==4294967295?iL(e,s):[o,oi(e,t+24),oi(e,t+42)],l=c[0],u=c[1],p=c[2];return[Ri(e,t+10),l,u,i,s+Ri(e,t+30)+Ri(e,t+32),p]},iL=function(e,t){for(;Ri(e,t)!=1;t+=4+Ri(e,t+2));return[_m(e,t+12),_m(e,t+4),_m(e,t+20)]};function sL(e,t){for(var n={},r=e.length-22;oi(e,r)!=101010256;--r)(!r||e.length-r>65558)&&Dr(13);var i=Ri(e,r+8);if(!i)return{};var s=oi(e,r+16),o=s==4294967295||i==65535;if(o){var c=oi(e,r-12);o=oi(e,c)==101075792,o&&(i=oi(e,c+32),s=oi(e,c+48))}for(var l=0;l<i;++l){var u=rL(e,s,o),p=u[0],f=u[1],d=u[2],h=u[3],y=u[4],b=u[5],k=nL(e,b);s=y,p?p==8?n[h]=QR(e.subarray(k,k+f),{out:new Sr(d)}):Dr(14,"unknown compression type "+p):n[h]=Jx(e,k,k+f)}return n}const oL=8*1024*1024,aL=500;function lL(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 cL(e){return e?e.split("/").some(n=>n==="__MACOSX"||n.startsWith("._")):!0}function uL(e){const t=e.toLowerCase();if(t==="flow.yaml"||t==="flow.yml")return"";const n="/flow.yaml",r="/flow.yml";let i=null;if(t.endsWith(n))i=e.slice(0,-n.length);else if(t.endsWith(r))i=e.slice(0,-r.length);else return null;return i.includes("/")?null:i}const dL=/^[a-zA-Z][a-zA-Z0-9_-]*$/;async function fL(e){try{const t=new Uint8Array(await e.arrayBuffer()),n=sL(t),r=new Map;let i=0,s=0;for(const[l,u]of Object.entries(n)){if(l.endsWith("/"))continue;const p=lL(l);if(!p||cL(p))continue;const f=(u==null?void 0:u.length)??0;if(i+=f,i>oL||(s+=1,s>aL))return null;r.set(p,f)}if(r.size===0)return null;const o=new Set;for(const l of r.keys()){const u=uL(l);u!==null&&o.add(u)}if(o.size!==1)return null;const[c]=[...o];if(c==="")return null;for(const l of r.keys())if(!(l===c||l.startsWith(`${c}/`)))return null;return dL.test(c)?c:null}catch{return null}}const Pm=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function pL({file:e,onClose:t,onImported:n}){const{t:r}=_t(),i=m.useId(),s=m.useRef(null),o=m.useRef(null),[c,l]=m.useState(""),[u,p]=m.useState("user"),[f,d]=m.useState(!1),[h,y]=m.useState(""),[b,k]=m.useState(null),g=b??e;m.useEffect(()=>{const C=requestAnimationFrame(()=>{var N;return(N=s.current)==null?void 0:N.focus()});return()=>cancelAnimationFrame(C)},[]),m.useEffect(()=>{let C=!1;return(async()=>{const N=g.name||"",P=N.toLowerCase();let R="";if(P.endsWith(".zip")){if(R=await fL(g)||"",!R){const M=N.replace(/\.zip$/i,"");Pm.test(M)&&(R=M)}}else if(P.endsWith(".yaml")||P.endsWith(".yml")){const M=N.replace(/\.ya?ml$/i,"");Pm.test(M)&&(R=M)}C||l(R)})(),()=>{C=!0}},[g]);const v=c.trim(),w=v.length>0&&Pm.test(v);async function S(C){if(C.preventDefault(),!(!w||f)){d(!0),y("");try{const N=new FormData;N.set("flowId",v),N.set("targetSpace",u),N.set("file",g,g.name);const P=await fetch("/api/flows/import",{method:"POST",body:N}),R=await P.json().catch(()=>({}));if(!P.ok){y(typeof R.error=="string"?R.error:r("project:importModal.importFailed"));return}n({id:R.flowId,source:R.flowSource??"user"})}catch(N){y(String((N==null?void 0:N.message)||N))}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:s,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":i,tabIndex:-1,onMouseDown:C=>C.stopPropagation(),children:[a.jsxs("div",{className:"af-shortcuts-panel__head",children:[a.jsx("h2",{id:i,className:"af-shortcuts-panel__title",children:r("project:importModal.title")}),a.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":r("project:importModal.close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit: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 P;const N=(P=C.target.files)==null?void 0:P[0];N&&k(N),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:c,onChange:C=>l(C.target.value),"aria-invalid":v.length>0&&!w}),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:!w||f,children:r(f?"project:importModal.importing":"project:importModal.importAndOpen")})]})]})]})})}const hL=/^[a-zA-Z][a-zA-Z0-9_-]*$/,J0="af:newPipelineGuide";function mL({open:e,onClose:t,onCreated:n}){const{t:r}=_t(),i=m.useId(),s=m.useRef(null),[o,c]=m.useState(""),[l,u]=m.useState(""),[p,f]=m.useState("user"),[d,h]=m.useState(!1),[y,b]=m.useState(""),[k,g]=m.useState(!1);m.useEffect(()=>{if(!e)return;c(""),u(""),f("user"),b(""),h(!1),localStorage.getItem(J0)==="true"&&g(!0);const P=requestAnimationFrame(()=>{var R;return(R=s.current)==null?void 0:R.focus()});return()=>cancelAnimationFrame(P)},[e]);const v=()=>{localStorage.removeItem(J0),g(!1)};if(!e)return null;const w=o.trim(),S=w.length>0&&hL.test(w);async function C(N){if(N.preventDefault(),!(!S||d)){h(!0),b(""),v();try{const P=await fetch("/api/flows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:w,description:l.trim(),targetSpace:p})}),R=await P.json().catch(()=>({}));if(!P.ok){b(typeof R.error=="string"?R.error:r("project:newPipelineModal.createFailed"));return}n({id:R.flowId,source:R.flowSource??"user"})}catch(P){b(String((P==null?void 0:P.message)||P))}finally{h(!1)}}}return a.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:N=>{N.target===N.currentTarget&&(v(),t())},children:a.jsxs("div",{ref:s,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":i,tabIndex:-1,onMouseDown:N=>N.stopPropagation(),children:[a.jsxs("div",{className:"af-shortcuts-panel__head",children:[a.jsx("h2",{id:i,className:"af-shortcuts-panel__title",children:r("project:newPipelineModal.title")}),a.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:()=>{v(),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:v,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:N=>c(N.target.value),"aria-invalid":w.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:l,onChange:N=>u(N.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:()=>{v(),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 oC="agentflow.pipelineViewPreference";function aC(e,t="user",n=!1){return`${String(t||"user")}:${String(e||"")}:${n?"archived":"active"}`}function lC(){if(typeof localStorage>"u")return{};try{const e=JSON.parse(localStorage.getItem(oC)||"{}");return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}catch{return{}}}function gL(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(oC,JSON.stringify(e))}catch{}}function up(e){return e==="pipeline"?"pipeline":"workspace"}function yL(e){return(e==null?void 0:e.hasPipeline)!==!1&&(e==null?void 0:e.hasFlow)!==!1&&(e==null?void 0:e.flowYaml)!==!1}function cC(e,t,n,r=!1){if(!e)return;const i=lC();i[aC(e,t,r)]={view:up(n),at:Date.now()},gL(i)}function xL(e,t="workspace"){if(!(e!=null&&e.id))return up(t);const r=lC()[aC(e.id,e.source??"user",!!e.archived)],i=up((r==null?void 0:r.view)||t);return i==="pipeline"&&!yL(e)?"workspace":i}function Qx(e,t="workspace"){if(!(e!=null&&e.id))return t==="pipeline"?"/flow":"/workspace";const n=new URLSearchParams({flowId:e.id,flowSource:e.source??"user"});return e.archived&&n.set(t==="pipeline"?"flowArchived":"archived","1"),`/${up(t)==="pipeline"?"flow":"workspace"}?${n.toString()}`}function Ud(e,t="workspace"){return Qx(e,xL(e,t))}function wL({onChanged:e}){const[t,n]=m.useState({available:!1,version:"",loggedIn:!1,user:"",error:""}),[r,i]=m.useState([]),[s,o]=m.useState(""),[c,l]=m.useState([]),[u,p]=m.useState(""),[f,d]=m.useState(""),[h,y]=m.useState(""),b=m.useCallback(async()=>{d("");try{const[S,C]=await Promise.all([fetch("/api/skillhub/status"),fetch("/api/skillhub/list?target=global&agent=codex")]),N=await S.json().catch(()=>({}));S.ok&&n({available:!!N.available,version:typeof N.version=="string"?N.version:"",loggedIn:!!N.loggedIn,user:typeof N.user=="string"?N.user:"",error:typeof N.error=="string"?N.error:""});const P=await C.json().catch(()=>({}));if(!C.ok)throw new Error(typeof P.error=="string"?P.error:"HTTP "+C.status);i(Array.isArray(P.skills)?P.skills:[])}catch(S){d(String(S.message||S))}},[]);m.useEffect(()=>{b()},[b]);const k=m.useCallback(async()=>{const S=s.trim();if(S){p("search"),d(""),y("");try{const C=await fetch(`/api/skillhub/search?q=${encodeURIComponent(S)}`),N=await C.json().catch(()=>({}));if(!C.ok)throw new Error(typeof N.error=="string"?N.error:"HTTP "+C.status);l(Array.isArray(N.items)?N.items:[])}catch(C){d(String(C.message||C))}finally{p("")}}},[s]),g=m.useCallback(async(S,C=!1)=>{const N=String(S||"").trim();if(N){p(`install:${N}`),d(""),y("");try{const P=await fetch("/api/skillhub/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:N,target:"global",agent:"codex",force:C})}),R=await P.json().catch(()=>({}));if(!P.ok)throw new Error(typeof R.error=="string"?R.error:"HTTP "+P.status);y(C?`已更新 ${N}`:`已安装 ${N}`),await b(),typeof e=="function"&&await e()}catch(P){d(String(P.message||P))}finally{p("")}}},[b,e]),v=m.useCallback(async S=>{const C=String(S||"").trim();if(C){p(`uninstall:${C}`),d(""),y("");try{const N=await fetch("/api/skillhub/uninstall",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:C,target:"global",agent:"codex"})}),P=await N.json().catch(()=>({}));if(!N.ok)throw new Error(typeof P.error=="string"?P.error:"HTTP "+N.status);y(`已卸载 ${C}`),await b(),typeof e=="function"&&await e()}catch(N){d(String(N.message||N))}finally{p("")}}},[b,e]),w=m.useCallback(async()=>{p("update-cli"),d(""),y("");try{const S=await fetch("/api/skillhub/update",{method:"POST"}),C=await S.json().catch(()=>({}));if(!S.ok)throw new Error(typeof C.error=="string"?C.error:"HTTP "+S.status);y("SkillHub CLI 已更新"),await b()}catch(S){d(String(S.message||S))}finally{p("")}},[b]);return a.jsxs("section",{className:"af-set-card af-set-card--span-all af-set-skillhub",children:[a.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"af-set-h2",children:"SkillHub"}),a.jsx("p",{className:"af-set-p af-set-p--tight",children:"搜索、安装、更新和卸载 Codex 全局 skills。"})]}),a.jsxs("div",{className:"af-set-skillhub-head-actions",children:[a.jsxs("div",{className:"af-set-skillhub-status",children:[a.jsx("span",{className:"material-symbols-outlined af-set-icon--tertiary",children:"extension"}),a.jsx("span",{children:t.loggedIn?`已登录 ${t.user}`:"未登录 SkillHub"}),a.jsx("span",{className:"af-set-badge"+(t.available?" af-set-badge--ok":" af-set-badge--err"),children:t.available?`v${t.version}`:"not found"})]}),a.jsxs("div",{className:"af-set-skillhub-toolbar",children:[a.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:b,disabled:!!u,children:"刷新"}),a.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:w,disabled:!!u,children:u==="update-cli"?"更新中…":"更新 CLI"})]})]})]}),a.jsxs("div",{className:"af-set-skillhub-search",children:[a.jsx("input",{className:"af-set-input af-set-input--sm",value:s,onChange:S=>o(S.target.value),onKeyDown:S=>{S.key==="Enter"&&k()},placeholder:"搜索 skill slug / 关键词,例如 android、issue-tracker"}),a.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:()=>k(),disabled:!s.trim()||u==="search",children:[a.jsx("span",{className:"material-symbols-outlined",children:"search"}),u==="search"?"搜索中…":"搜索"]})]}),f?a.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:f}):null,h?a.jsx("p",{className:"af-set-hint af-set-hint--inline",children:h}):null,a.jsxs("div",{className:"af-set-skillhub-grid",children:[a.jsxs("div",{className:"af-set-skillhub-pane",children:[a.jsxs("div",{className:"af-set-skillhub-pane-head",children:[a.jsx("h3",{children:"已安装"}),a.jsx("span",{children:r.length})]}),a.jsx("div",{className:"af-set-skillhub-list",children:r.length===0?a.jsx("div",{className:"af-set-skillhub-empty",children:"暂无 Codex 全局 skills"}):r.map(S=>a.jsxs("div",{className:"af-set-skillhub-item",children:[a.jsxs("div",{children:[a.jsx("div",{className:"af-set-skillhub-title",children:S.name}),a.jsxs("div",{className:"af-set-skillhub-meta",children:[S.agent||"codex"," · ",S.kind||"skill"]})]}),a.jsxs("div",{className:"af-set-skillhub-actions",children:[a.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>g(S.name,!0),disabled:!!u,children:"更新"}),a.jsx("button",{type:"button",className:"af-set-btn-mini af-set-btn-mini--danger",onClick:()=>v(S.name),disabled:!!u,children:"卸载"})]})]},`${S.agent}:${S.path}:${S.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:c.length})]}),a.jsx("div",{className:"af-set-skillhub-list",children:c.length===0?a.jsx("div",{className:"af-set-skillhub-empty",children:"输入关键词后搜索 SkillHub"}):c.map(S=>{const C=S.slug||S.name,N=r.some(P=>P.name===C||P.name===S.name);return a.jsxs("div",{className:"af-set-skillhub-item",children:[a.jsxs("div",{children:[a.jsx("div",{className:"af-set-skillhub-title",children:S.name||C}),a.jsxs("div",{className:"af-set-skillhub-meta",children:[C,S.version?` · ${S.version}`:""]}),S.summary?a.jsx("p",{className:"af-set-skillhub-summary",children:S.summary}):null]}),a.jsx("button",{type:"button",className:N?"af-set-btn-mini":"af-set-btn-add af-set-btn-add--compact",onClick:()=>g(C,N),disabled:!!u,children:N?"更新":"安装"})]},S.id||C)})})]})]})]})}function io(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 vL(e){return{version:1,collections:io({collections:e})}}function co(e,t){const n=new Set((Array.isArray(t)?t:[]).map(r=>r.key).filter(Boolean));return(Array.isArray(e==null?void 0:e.skillKeys)?e.skillKeys:[]).filter(r=>n.has(r))}function uC(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 dC(e,t){const n=new Set(Array.isArray(t)?t:[]);return(Array.isArray(e)?e:[]).filter(r=>!n.has(r))}function fC(e,t,n){const r=co(e,n);if(r.length===0)return"empty";const i=r.filter(s=>t.has(s)).length;return i===0?"none":i===r.length?"all":"partial"}function bL(e,t,n){const r=String(e||"").trim().toLowerCase(),i=io({collections:n}).find(s=>s.id===r||s.name.toLowerCase()===r);return co(i,t)}function pC(e,t,n,r){const i=(Array.isArray(n)?n:[]).map(u=>u.key).filter(Boolean),s=String(t||"").trim().toLowerCase(),o=io({collections:r}),c=bL(t,n,r),l=c.length>0?c:i;if(!e)return l;try{const u=localStorage.getItem(e);if(u!==null){const p=JSON.parse(u);if(Array.isArray(p)){const f=new Set(i),d=p.map(String).filter(g=>f.has(g));if(i.length>0&&d.length===i.length)return l;const h=new Set(d),y=new Set(c),b=c.length>0&&c.every(g=>h.has(g)),k=o.some(g=>{if(!g.builtin||g.id===s||g.name.toLowerCase()===s)return!1;const v=co(g,n);return v.length>0&&v.every(w=>h.has(w))});return c.length>0&&k&&!b?l:d}}}catch{}return l}function Vd(e){return e==="secondary"?"af-proj-badge af-proj-badge--secondary":e==="primary"?"af-proj-badge af-proj-badge--primary":e==="muted"?"af-proj-badge af-proj-badge--muted":"af-proj-badge"}function kL(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 hy(e,t){return e==="builtin"?{label:t("project:sourceBadge.builtin"),tone:"muted"}:e==="workspace"?{label:t("project:sourceBadge.workspace"),tone:"secondary"}:{label:t("project:sourceBadge.user"),tone:"primary"}}function hC(e){const t=e.source??"user";return t==="builtin"?`builtin/pipelines / ${e.id}`:t==="workspace"?e.archived?`.workspace/agentflow/pipelines/_archived / ${e.id}`:`.workspace/agentflow/pipelines / ${e.id}`:e.archived?`~/agentflow/pipelines/_archived / ${e.id}`:`~/agentflow/pipelines / ${e.id}`}const SL="project:defaultCardDesc";function mC(e,t){const n=e.description!=null?String(e.description).trim():"";return n!==""?n:t(SL)}function NL(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Fn({children:e,className:t="",query:n}){const r=n.trim(),i=String(e);if(!r)return a.jsx("span",{className:t,children:i});const s=new RegExp(`(${NL(r)})`,"gi"),o=i.split(s);return a.jsx("span",{className:t,children:o.map((c,l)=>l%2===1?a.jsx("mark",{className:"af-search-hit",children:c},l):a.jsx("span",{children:c},l))})}function jL(e,t,n){const r=[String(e.id),mC(e,n),hC(e),hy(e.source,n).label];return e.archived&&r.push(n("project:archived")),r.join(`
|
|
41
|
+
`).toLowerCase()}function CL(e,t,n){return t?jL(e,t,n).includes(t):!0}function EL(e,t){const n=e.trim().toLowerCase();if(!n)return!0;const r=String(t.flowId).toLowerCase(),i=String(t.flowSource??"user").toLowerCase();return r.includes(n)||i.includes(n)}function Q0(e,t){const n=e.trim().toLowerCase();return n?t.filter(Boolean).join(`
|
|
42
|
+
`).toLowerCase().includes(n):!0}function Z0(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")}const _L=["all","agent","control","provide","marketplace"];function Wd(e){return!e||typeof e!="object"?[]:Object.entries(e).map(([t,n])=>({key:t,...n&&typeof n=="object"?n:{}}))}function nn(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 Kd({resourceKind:e=""}){var Gr,Je,Lr,Xr,wt,Ln;const{t}=_t(),{navigate:n,path:r}=ia(),[i,s]=m.useState(e||"all"),[o,c]=m.useState([]),[l,u]=m.useState([]),[p,f]=m.useState([]),[d,h]=m.useState([]),[y,b]=m.useState(""),[k,g]=m.useState(!1),[v,w]=m.useState([]),[S,C]=m.useState(""),[N,P]=m.useState(""),[R,M]=m.useState(!1),[U,L]=m.useState(!1),[A,V]=m.useState(!1),[T,$]=m.useState(null),[D,K]=m.useState(!1),[_,I]=m.useState(""),[E,Y]=m.useState(!0),[G,F]=m.useState("all"),[Z,oe]=m.useState(""),[ue,ce]=m.useState("overview"),[le,ve]=m.useState({}),[ie,de]=m.useState(""),[me,Se]=m.useState({}),[Ve,Fe]=m.useState(""),[ze,ht]=m.useState(""),[yn,Yt]=m.useState({}),[at,Rt]=m.useState(""),[Zn,jn]=m.useState(!1),xn=m.useRef(0),Gt=m.useRef(0),ne=m.useCallback(async()=>{const q=++Gt.current;C("");try{const ye=await fetch("/api/flows");if(q!==Gt.current)return;if(!ye.ok)throw new Error("HTTP "+ye.status);const Ne=await ye.json();if(q!==Gt.current)return;c(Array.isArray(Ne)?Ne:[])}catch(ye){if(q!==Gt.current)return;c([]),C(String(ye.message||ye))}try{const ye=await fetch("/api/pipeline-recent-runs");if(q!==Gt.current)return;if(ye.ok){const Ne=await ye.json();if(q!==Gt.current)return;w(Array.isArray(Ne.runs)?Ne.runs:[])}else w([])}catch{if(q!==Gt.current)return;w([])}M(!0)},[]),fe=m.useCallback(async()=>{P(""),L(!1);try{const[q,ye,Ne]=await Promise.all([fetch("/api/nodes"),fetch("/api/skills"),fetch("/api/skill-collections")]),$e=await q.json().catch(()=>({})),xt=await ye.json().catch(()=>({})),Wn=await Ne.json().catch(()=>({}));if(!q.ok)throw new Error($e.error||"Nodes HTTP "+q.status);if(!ye.ok)throw new Error(xt.error||"Skills HTTP "+ye.status);if(!Ne.ok)throw new Error(Wn.error||"Collections HTTP "+Ne.status);u(Array.isArray($e.nodes)?$e.nodes:Array.isArray($e)?$e:[]),f(Array.isArray(xt.skills)?xt.skills:[]),h(io(Wn))}catch(q){u([]),f([]),h([]),P(String(q.message||q))}finally{L(!0)}},[]);m.useEffect(()=>{M(!1),ne(),fe()},[ne,fe]),m.useEffect(()=>{let q=!1;return fetch("/api/ui-context").then(ye=>ye.json()).then(ye=>{q||jn(!!ye.hideCommunityLinks)}).catch(()=>{}),()=>{q=!0}},[]);const Le=m.useCallback(async q=>{const ye=io({collections:q});g(!0),P("");try{const Ne=await fetch("/api/skill-collections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(vL(ye))}),$e=await Ne.json().catch(()=>({}));if(!Ne.ok)throw new Error($e.error||"Collections HTTP "+Ne.status);h(io($e))}catch(Ne){P(String(Ne.message||Ne))}finally{g(!1)}},[]),Ye=m.useCallback(()=>{const q=y.trim();if(!q)return;const ye=q.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"collection",Ne=new Set(d.map(_n=>_n.id));let $e=ye,xt=2;for(;Ne.has($e);)$e=`${ye}-${xt++}`;const Wn=Date.now();Le([...d,{id:$e,name:q,skillKeys:[],createdAt:Wn,updatedAt:Wn}]),b(""),F(`collection:${$e}`)},[y,Le,d]),We=m.useCallback(q=>{const ye=d.find($e=>$e.id===q);if(ye!=null&&ye.builtin)return;const Ne=d.filter($e=>$e.id!==q);G===`collection:${q}`&&F("all"),Le(Ne)},[G,Le,d]),Vt=m.useCallback((q,ye,Ne)=>{const $e=String(ye||"").trim();if(!$e)return;const xt=Date.now(),Wn=d.map(_n=>{if(_n.id!==q)return _n;const tr=new Set(_n.skillKeys||[]);return Ne?tr.add($e):tr.delete($e),{..._n,skillKeys:Array.from(tr),updatedAt:xt}});Le(Wn)},[Le,d]);m.useEffect(()=>{if(e==="nodes"||e==="skills"){s(e),F("all"),oe(""),ce("overview");return}s(q=>q==="archived"?"archived":"all")},[e]),m.useEffect(()=>{if(r!=="/projects"&&r!=="/")return;const q=new URLSearchParams(window.location.search);let ye=!1;if(q.get("tab")==="nodes"){n("/nodes");return}if(q.get("tab")==="skills"){n("/skills");return}if(q.get("tab")==="archived"&&(s("archived"),q.delete("tab"),ye=!0),q.get("new")==="1"&&(V(!0),q.delete("new"),ye=!0),ye){const Ne=q.toString();window.history.replaceState({},"",Ne?`/projects?${Ne}`:"/projects")}},[r,n]);const Xt=m.useMemo(()=>zR(v,Zj(),o),[v,o,r]),sn=m.useMemo(()=>Xt.filter(q=>EL(_,q)),[Xt,_]),yt=_.trim().toLowerCase(),Cn=m.useMemo(()=>i==="archived"?o.filter(q=>q.archived):o.filter(q=>!q.archived),[o,i]),xe=m.useMemo(()=>Cn.filter(q=>CL(q,yt,t)),[Cn,yt,t]),st=m.useMemo(()=>l.filter(q=>(G==="all"||(G==="marketplace"?q.source==="marketplace":q.type===G))&&Q0(_,[q.id,q.label,q.displayName,q.description,q.type,q.source,q.packageId,q.version])),[l,_,G]),Lt=m.useMemo(()=>{const q=new Map;for(const ye of d)q.set(ye.id,new Set(ye.skillKeys||[]));return q},[d]),Ke=m.useMemo(()=>[{id:"all",label:"全部"},...d.map(q=>({id:`collection:${q.id}`,label:q.name,count:q.skillKeys.length,collection:q})),{id:"ungrouped",label:"未分组"}],[d]),wn=m.useMemo(()=>p.filter(q=>{var $e;const ye=nn(q);let Ne=G==="all";if(G.startsWith("collection:")){const xt=G.slice(11);Ne=!!(($e=Lt.get(xt))!=null&&$e.has(ye))}else G==="ungrouped"&&(Ne=!Array.from(Lt.values()).some(xt=>xt.has(ye)));return Ne&&Q0(_,[q.name,q.id,q.description,q.sourceLabel,q.source,q.path])}),[p,_,G,Lt]),on=i==="nodes"||i==="skills",Be=m.useMemo(()=>st.find(q=>nn(q)===Z)||st[0]||null,[st,Z]),He=m.useMemo(()=>wn.find(q=>nn(q)===Z)||wn[0]||null,[wn,Z]),Pt=He?le[nn(He)]:null,Ce=Be?me[nn(Be)]:null,Ot=Be&&ze?yn[`${nn(Be)}:${ze}`]:null,Yr=t(i==="nodes"?"project:searchNodes":i==="skills"?"project:searchSkills":"project:searchPipelines");m.useEffect(()=>{if(i!=="skills"||!He)return;const q=nn(He);if(le[q])return;let ye=!1;return de(q),fetch(`/api/skills/detail?key=${encodeURIComponent(q)}`).then(Ne=>Ne.json().then($e=>({ok:Ne.ok,json:$e}))).then(({ok:Ne,json:$e})=>{ye||Ne&&$e.skill&&ve(xt=>({...xt,[q]:$e.skill}))}).catch(()=>{}).finally(()=>{ye||de("")}),()=>{ye=!0}},[i,He,le]),m.useEffect(()=>{if(i!=="nodes"||!Be)return;const q=nn(Be);if(me[q])return;let ye=!1;return Fe(q),fetch(`/api/nodes/detail?id=${encodeURIComponent(Be.id)}`).then(Ne=>Ne.json().then($e=>({ok:Ne.ok,json:$e}))).then(({ok:Ne,json:$e})=>{ye||Ne&&Se(xt=>({...xt,[q]:$e}))}).catch(()=>{}).finally(()=>{ye||Fe("")}),()=>{ye=!0}},[i,Be,me]),m.useEffect(()=>{if(i!=="nodes")return;const q=Array.isArray(Ce==null?void 0:Ce.files)?Ce.files:[];ht(ye=>{var Ne;return ye&&q.some($e=>$e.path===ye)?ye:((Ne=q[0])==null?void 0:Ne.path)||""})},[i,Ce]),m.useEffect(()=>{if(i!=="nodes"||!Be||!ze)return;const q=`${nn(Be)}:${ze}`;if(yn[q])return;let ye=!1;return Rt(q),fetch(`/api/nodes/file?id=${encodeURIComponent(Be.id)}&path=${encodeURIComponent(ze)}`).then(Ne=>Ne.json().then($e=>({ok:Ne.ok,json:$e}))).then(({ok:Ne,json:$e})=>{ye||Ne&&Yt(xt=>({...xt,[q]:$e}))}).catch(()=>{}).finally(()=>{ye||Rt("")}),()=>{ye=!0}},[i,Be,ze,yn]);const er=q=>{n(Ud(q,"workspace"))},Jt=q=>{n(Ud({id:q.flowId,source:q.flowSource,archived:!!q.archived},"workspace"))},En=m.useCallback(q=>{var ye,Ne;q.preventDefault(),q.stopPropagation(),(Ne=(ye=q.dataTransfer)==null?void 0:ye.types)!=null&&Ne.includes("Files")&&(xn.current+=1,K(!0))},[]),xi=m.useCallback(q=>{q.preventDefault(),q.stopPropagation(),xn.current-=1,xn.current<=0&&(xn.current=0,K(!1))},[]),xs=m.useCallback(q=>{q.preventDefault(),q.stopPropagation()},[]),Ki=m.useCallback(q=>{var $e,xt;q.preventDefault(),q.stopPropagation(),xn.current=0,K(!1);const ye=(xt=($e=q.dataTransfer)==null?void 0:$e.files)==null?void 0:xt[0];if(!ye)return;const Ne=ye.name.toLowerCase();!Ne.endsWith(".yaml")&&!Ne.endsWith(".yml")&&!Ne.endsWith(".zip")||$(ye)},[]);return a.jsxs("div",{className:"af-projects"+(D?" af-projects--drop-target":""),onDragEnter:En,onDragLeave:xi,onDragOver:xs,onDrop:Ki,children:[a.jsxs("header",{className:"af-projects-top",children:[e?a.jsx("div",{className:"af-projects-tabs af-projects-tabs--empty","aria-hidden":!0}):a.jsxs("div",{className:"af-projects-tabs",children:[a.jsx("button",{type:"button",className:i==="all"?"af-tab af-tab--active":"af-tab",onClick:()=>s("all"),children:t("project:all")}),a.jsx("button",{type:"button",className:i==="archived"?"af-tab af-tab--active":"af-tab",onClick:()=>s("archived"),children:t("project:archived")})]}),a.jsxs("div",{className:"af-projects-top-right",children:[a.jsxs("div",{className:"af-search-wrap",children:[a.jsx("span",{className:"material-symbols-outlined af-search-icon",children:"search"}),a.jsx("input",{className:"af-search"+(_.trim()?" af-search--has-clear":""),type:"search",placeholder:Yr,"aria-label":Yr,autoComplete:"off",value:_,onChange:q=>I(q.target.value),onKeyDown:q=>{q.key==="Escape"&&(I(""),q.currentTarget.blur())}}),_.trim()?a.jsx("button",{type:"button",className:"af-search-clear","aria-label":"Clear search",onClick:()=>I(""),children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),on?a.jsx("button",{type:"button",className:"af-btn-primary af-create-btn",onClick:()=>fe(),children:t("project:refreshResources")}):a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"af-icon-btn"+(E?" af-icon-btn--active":""),"aria-label":t("flow:palette.toggleRecentActivity"),"aria-expanded":E,"aria-controls":"af-recent-activity-panel",onClick:()=>Y(q=>!q),children:a.jsx("span",{className:"material-symbols-outlined",children:"notifications"})}),a.jsx("button",{type:"button",className:"af-btn-primary af-create-btn",onClick:()=>V(!0),children:t("project:createNew")})]})]})]}),a.jsxs("div",{className:"af-projects-body",children:[a.jsxs("section",{className:"af-projects-main",children:[a.jsxs("header",{className:"af-projects-section-head",children:[a.jsx("h2",{className:"af-projects-h2",children:t(i==="nodes"?"project:globalNodes":i==="skills"?"project:globalSkills":i==="archived"?"project:archivedPipelines":"project:activeProjects")}),a.jsx("p",{className:"af-projects-sub",children:yt?t("project:filterResult",{count:i==="nodes"?st.length:i==="skills"?wn.length:xe.length}):i==="nodes"?t("project:nodesHint",{count:l.length}):i==="skills"?t("project:skillsHint",{count:p.length}):t(i==="archived"?"project:archivedHint":"project:activeHint")}),S?a.jsx("p",{className:"af-err af-projects-api-hint",children:S}):null,N&&on?a.jsx("p",{className:"af-err af-projects-api-hint",children:N}):null]}),on?a.jsxs("div",{className:"af-resource-toolbar",children:[i==="skills"?a.jsx(wL,{onChanged:fe}):null,a.jsxs("div",{className:"af-resource-purpose",children:[a.jsx("span",{className:"material-symbols-outlined",children:i==="nodes"?"account_tree":"extension"}),a.jsxs("div",{children:[a.jsx("h3",{children:t(i==="nodes"?"project:nodesPurposeTitle":"project:skillsPurposeTitle")}),a.jsx("p",{children:t(i==="nodes"?"project:nodesPurposeDesc":"project:skillsPurposeDesc")})]})]}),a.jsx("div",{className:"af-resource-filter-row",children:(i==="nodes"?_L.map(q=>({id:q,label:t(`project:resourceFilter.${q}`)})):Ke).map(q=>q.collection?a.jsxs("span",{className:"af-resource-filter-chip"+(G===q.id?" af-resource-filter-chip--active":""),children:[a.jsxs("button",{type:"button",className:"af-resource-filter af-resource-filter--embedded",onClick:()=>{F(q.id),oe("")},children:[q.label,a.jsx("em",{children:q.count}),q.collection.builtin?a.jsx("strong",{children:"built-in"}):null]}),q.collection.builtin?null:a.jsx("button",{type:"button",className:"af-resource-filter-chip__delete",disabled:k,"aria-label":`删除 ${q.collection.name}`,onClick:()=>We(q.collection.id),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},q.id):a.jsx("button",{type:"button",className:"af-resource-filter"+(G===q.id?" af-resource-filter--active":""),onClick:()=>{F(q.id),oe("")},children:q.label},q.id))}),i==="skills"?a.jsx("div",{className:"af-skill-collections-manager",children:a.jsxs("div",{className:"af-skill-collections-create",children:[a.jsx("input",{className:"af-set-input af-set-input--sm",value:y,onChange:q=>b(q.target.value),onKeyDown:q=>{q.key==="Enter"&&Ye()},placeholder:"新建 skill collection"}),a.jsxs("button",{type:"button",className:"af-set-btn-add af-set-btn-add--compact",disabled:!y.trim()||k,onClick:()=>Ye(),children:[a.jsx("span",{className:"material-symbols-outlined",children:"add"}),"新建"]})]})}):null]}):null,i==="nodes"?a.jsx("div",{className:"af-resource-grid",children:st.length>0?st.map(q=>a.jsxs("button",{type:"button",className:"af-resource-card"+(Be&&nn(q)===nn(Be)?" af-resource-card--active":""),onClick:()=>oe(nn(q)),children:[a.jsxs("div",{className:"af-resource-card-head",children:[a.jsx("span",{className:Vd(q.type==="control"?"secondary":q.type==="provide"?"primary":"muted"),children:a.jsx(Fn,{query:_,children:q.type||"node"})}),a.jsx("span",{className:"af-resource-source",children:a.jsx(Fn,{query:_,children:Z0(q.source,t)})})]}),a.jsx("h3",{className:"af-project-title",children:a.jsx(Fn,{query:_,children:q.label||q.displayName||q.id})}),a.jsx("p",{className:"af-project-desc",children:a.jsx(Fn,{query:_,children:q.description||t("project:noDescription")})}),a.jsxs("div",{className:"af-resource-meta-row",children:[a.jsx("span",{children:a.jsx(Fn,{query:_,children:q.id})}),a.jsx("span",{children:t("project:nodeSlots",{inputs:Object.keys(q.inputs||{}).length,outputs:Object.keys(q.outputs||{}).length})})]}),q.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(Fn,{query:_,children:`${q.packageId}${q.version?` / ${q.version}`:""}`})})]}):null]},`${q.id}:${q.source||""}:${q.packageId||""}`)):U?a.jsx("div",{className:"af-projects-empty-block",children:a.jsx("p",{className:"af-projects-empty",children:yt?t("project:noNodeMatch",{query:_.trim()}):t("project:noNodes")})}):a.jsx("div",{className:"af-projects-empty-block",children:a.jsx("p",{className:"af-projects-empty",children:t("project:loadingResources")})})}):i==="skills"?a.jsx("div",{className:"af-resource-grid",children:wn.length>0?wn.map(q=>a.jsxs("button",{type:"button",className:"af-resource-card"+(He&&nn(q)===nn(He)?" af-resource-card--active":""),onClick:()=>oe(nn(q)),children:[a.jsxs("div",{className:"af-resource-card-head",children:[a.jsx("span",{className:Vd(q.source==="builtin"?"muted":"primary"),children:a.jsx(Fn,{query:_,children:q.sourceLabel||q.source||"skill"})}),a.jsx("span",{className:"af-resource-source",children:t("project:skill")})]}),a.jsx("h3",{className:"af-project-title",children:a.jsx(Fn,{query:_,children:q.name||q.id})}),a.jsx("p",{className:"af-project-desc",children:a.jsx(Fn,{query:_,children:q.description||t("project:noDescription")})}),a.jsxs("div",{className:"af-project-path",children:[a.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"extension"}),a.jsx("span",{className:"af-path-text",children:a.jsx(Fn,{query:_,children:q.path||q.key||""})})]}),a.jsxs("div",{className:"af-skill-card-collections",children:[d.filter(ye=>ye.skillKeys.includes(nn(q))).slice(0,3).map(ye=>a.jsx("span",{children:ye.name},ye.id)),d.filter(ye=>ye.skillKeys.includes(nn(q))).length===0?a.jsx("span",{className:"af-skill-card-collection-empty",children:"未分组"}):null]})]},q.key||`${q.source}:${q.name}`)):U?a.jsx("div",{className:"af-projects-empty-block",children:a.jsx("p",{className:"af-projects-empty",children:yt?t("project:noSkillMatch",{query:_.trim()}):t("project:noSkills")})}):a.jsx("div",{className:"af-projects-empty-block",children:a.jsx("p",{className:"af-projects-empty",children:t("project:loadingResources")})})}):a.jsxs("div",{className:"af-project-grid",children:[xe.length>0?xe.map(q=>a.jsx("button",{type:"button",className:"af-project-card",onClick:()=>er(q),children:a.jsxs("div",{className:"af-project-card-body",children:[a.jsx("span",{className:Vd(hy(q.source,t).tone),children:a.jsx(Fn,{query:_,children:hy(q.source,t).label})}),q.archived?a.jsx("span",{className:Vd("muted"),children:a.jsx(Fn,{query:_,children:t("project:archived")})}):null,a.jsx("h3",{className:"af-project-title",children:a.jsx(Fn,{query:_,children:q.id})}),a.jsx("p",{className:"af-project-desc",children:a.jsx(Fn,{query:_,children:mC(q,t)})}),a.jsxs("div",{className:"af-project-path",children:[a.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"database"}),a.jsx("span",{className:"af-path-text",children:a.jsx(Fn,{query:_,children:hC(q)})})]})]})},`${q.id}:${q.source??"user"}:${q.archived?"a":""}`)):R?Cn.length===0?a.jsxs("div",{className:"af-projects-empty-block",children:[a.jsx("p",{className:"af-projects-empty",children:i==="archived"?t("project:noArchived"):o.length>0?t("project:noActive"):t(S?"project:loadFailed":"project:noPipelines")}),!S&&o.length===0&&i==="all"?a.jsx("p",{className:"af-projects-empty-hint",children:t("project:emptyHint",{code1:"agentflow ui",code2:".agentflow/pipelines"})}):null]}):a.jsx("div",{className:"af-projects-empty-block",children:a.jsx("p",{className:"af-projects-empty",children:t("project:noMatch",{query:_.trim()})})}):a.jsx("div",{className:"af-projects-empty-block",children:a.jsx("p",{className:"af-projects-empty",children:t("project:loadingPipelines")})}),a.jsxs("button",{type:"button",className:"af-project-add",onClick:()=>V(!0),children:[a.jsx("span",{className:"material-symbols-outlined af-project-add-icon",children:"add_circle"}),a.jsx("span",{className:"af-project-add-label",children:t("project:newPipeline")})]}),Zn?null:a.jsxs("a",{className:"af-hub-card",href:"https://agentflow-hub.com",target:"_blank",rel:"noopener noreferrer",children:[a.jsx("div",{className:"af-hub-card__glow","aria-hidden":!0}),a.jsxs("span",{className:"af-hub-card__eyebrow",children:[a.jsx("span",{className:"material-symbols-outlined af-hub-card__eyebrow-icon",children:"hub"}),t("project:hubCard.eyebrow")]}),a.jsx("h3",{className:"af-hub-card__title",children:t("project:hubCard.title")}),a.jsx("p",{className:"af-hub-card__desc",children:t("project:hubCard.desc")}),a.jsxs("span",{className:"af-hub-card__cta",children:[t("project:hubCard.cta"),a.jsx("span",{className:"material-symbols-outlined af-hub-card__cta-icon",children:"arrow_outward"})]}),a.jsx("code",{className:"af-hub-card__cli",children:t("project:hubCard.cliHint")})]})]})]}),on?a.jsx("aside",{className:"af-resource-detail","aria-label":t(i==="nodes"?"project:nodeDetail":"project:skillDetail"),children:i==="nodes"&&Be?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:Be.label||Be.displayName||Be.id}),a.jsx("p",{children:Be.id})]})]}),a.jsx("div",{className:"af-resource-detail-tabs",children:["overview","schema","runtime","files","usage"].map(q=>a.jsx("button",{type:"button",className:"af-resource-detail-tab"+(ue===q?" af-resource-detail-tab--active":""),onClick:()=>ce(q),children:t(`project:nodeDetailTabs.${q}`)},q))}),Ve===nn(Be)?a.jsx("p",{className:"af-resource-detail-desc",children:t("project:loadingResources")}):ue==="overview"?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"af-resource-detail-desc",children:Be.description||((Gr=Ce==null?void 0:Ce.node)==null?void 0:Gr.description)||t("project:noDescription")}),a.jsxs("dl",{className:"af-resource-detail-kv",children:[a.jsxs("div",{children:[a.jsx("dt",{children:t("project:detailType")}),a.jsx("dd",{children:Be.type||((Je=Ce==null?void 0:Ce.node)==null?void 0:Je.type)||"node"})]}),a.jsxs("div",{children:[a.jsx("dt",{children:t("project:detailSource")}),a.jsx("dd",{children:Z0(Be.source,t)})]}),Be.packageId?a.jsxs("div",{children:[a.jsx("dt",{children:t("project:detailPackage")}),a.jsx("dd",{children:Be.packageId})]}):null,Be.version?a.jsxs("div",{children:[a.jsx("dt",{children:t("project:detailVersion")}),a.jsx("dd",{children:Be.version})]}):null,Be.packageDir||Ce!=null&&Ce.baseDir?a.jsxs("div",{children:[a.jsx("dt",{children:t("project:detailPath")}),a.jsx("dd",{children:Be.packageDir||(Ce==null?void 0:Ce.baseDir)})]}):null,a.jsxs("div",{children:[a.jsx("dt",{children:t("project:detailEditable")}),a.jsx("dd",{children:(Ce==null?void 0:Ce.readOnly)===!1?t("project:editable"):t("project:readOnly")})]})]}),a.jsxs("div",{className:"af-resource-detail-section",children:[a.jsx("h4",{children:t("project:resourceMeaning")}),a.jsx("p",{children:t("project:nodesMeaning")})]})]}):ue==="schema"?a.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[a.jsx("h4",{children:t("project:nodeSchema")}),a.jsxs("div",{className:"af-resource-slot-group",children:[a.jsx("span",{children:t("project:nodeInputs")}),Wd(((Lr=Ce==null?void 0:Ce.node)==null?void 0:Lr.inputs)||Be.inputs).length>0?Wd(((Xr=Ce==null?void 0:Ce.node)==null?void 0:Xr.inputs)||Be.inputs).map(q=>a.jsxs("code",{children:[q.name||q.key,q.type?`: ${q.type}`:""]},q.key)):a.jsx("em",{children:t("project:noSlots")})]}),a.jsxs("div",{className:"af-resource-slot-group",children:[a.jsx("span",{children:t("project:nodeOutputs")}),Wd(((wt=Ce==null?void 0:Ce.node)==null?void 0:wt.outputs)||Be.outputs).length>0?Wd(((Ln=Ce==null?void 0:Ce.node)==null?void 0:Ln.outputs)||Be.outputs).map(q=>a.jsxs("code",{children:[q.name||q.key,q.type?`: ${q.type}`:""]},q.key)):a.jsx("em",{children:t("project:noSlots")})]})]}):ue==="runtime"?a.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[a.jsx("h4",{children:t("project:nodeRuntime")}),Ce!=null&&Ce.runtime?a.jsx("pre",{className:"af-resource-skill-preview",children:JSON.stringify(Ce.runtime,null,2)}):a.jsx("p",{children:t("project:noRuntimeManifest")}),Ce!=null&&Ce.body?a.jsxs(a.Fragment,{children:[a.jsx("h4",{className:"af-resource-detail-subtitle",children:t("project:nodeBody")}),a.jsx("pre",{className:"af-resource-skill-preview",children:Ce.body})]}):a.jsx("p",{children:t("project:noNodeBody")})]}):ue==="files"?a.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[a.jsx("h4",{children:t("project:nodeFiles")}),Array.isArray(Ce==null?void 0:Ce.files)&&Ce.files.length>0?a.jsxs("div",{className:"af-node-file-browser",children:[a.jsx("div",{className:"af-node-file-list",children:Ce.files.map(q=>a.jsxs("button",{type:"button",className:"af-node-file-item"+(ze===q.path?" af-node-file-item--active":""),onClick:()=>ht(q.path),children:[a.jsx("span",{className:"material-symbols-outlined",children:"description"}),a.jsx("span",{children:q.path})]},q.path))}),a.jsxs("pre",{className:"af-resource-skill-preview",children:[at===`${nn(Be)}:${ze}`?t("project:loadingResources"):Ot!=null&&Ot.binary?t("project:binaryFile"):(Ot==null?void 0:Ot.content)||t("project:selectNodeFile"),Ot!=null&&Ot.truncated?`
|
|
43
|
+
|
|
44
|
+
${t("project:fileTruncated")}`:""]})]}):a.jsx("p",{children:t("project:noNodeFiles")})]}):a.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[a.jsx("h4",{children:t("project:nodeUsage")}),Array.isArray(Ce==null?void 0:Ce.usage)&&Ce.usage.length>0?a.jsx("div",{className:"af-node-usage-list",children:Ce.usage.map(q=>a.jsxs("div",{className:"af-node-usage-item",children:[a.jsx("strong",{children:q.flowId}),a.jsxs("span",{children:[q.flowSource,q.archived?` · ${t("project:archived")}`:""]}),a.jsx("em",{children:q.instances.map(ye=>ye.label||ye.instanceId).join(", ")})]},`${q.flowSource}:${q.flowId}:${q.archived?"a":""}`))}):a.jsx("p",{children:t("project:noNodeUsage")})]})]}):i==="skills"&&He?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:He.name||He.id}),a.jsx("p",{children:He.sourceLabel||He.source})]})]}),a.jsx("p",{className:"af-resource-detail-desc",children:He.description||t("project:noDescription")}),a.jsxs("dl",{className:"af-resource-detail-kv",children:[a.jsxs("div",{children:[a.jsx("dt",{children:t("project:detailSource")}),a.jsx("dd",{children:He.sourceLabel||He.source})]}),a.jsxs("div",{children:[a.jsx("dt",{children:t("project:detailPath")}),a.jsx("dd",{children:He.path||He.key})]})]}),a.jsxs("div",{className:"af-resource-detail-section",children:[a.jsx("h4",{children:"Collections"}),d.length===0?a.jsx("p",{children:"暂无 collection。可在左侧新建后再添加。"}):a.jsx("div",{className:"af-skill-detail-collections",children:d.map(q=>{const ye=nn(He),Ne=q.skillKeys.includes(ye);return a.jsxs("label",{className:"af-composer-skill-option af-skill-detail-collection-option",children:[a.jsx("input",{type:"checkbox",checked:Ne,disabled:k,onChange:$e=>Vt(q.id,ye,$e.target.checked)}),a.jsxs("span",{className:"af-composer-skill-option-main",children:[a.jsx("span",{className:"af-composer-skill-option-title",children:q.name}),a.jsxs("span",{className:"af-composer-skill-option-desc",children:[q.skillKeys.length," skills"]})]})]},q.id)})})]}),a.jsxs("div",{className:"af-resource-detail-section",children:[a.jsx("h4",{children:t("project:resourceMeaning")}),a.jsx("p",{children:t("project:skillsMeaning")})]}),a.jsxs("div",{className:"af-resource-detail-section",children:[a.jsx("h4",{children:t("project:skillPreview")}),a.jsx("pre",{className:"af-resource-skill-preview",children:ie===nn(He)?t("project:loadingResources"):(Pt==null?void 0:Pt.body)||(Pt==null?void 0:Pt.content)||t("project:skillPreviewEmpty")})]})]}):a.jsx("p",{className:"af-activity-empty",children:t("project:selectResource")})}):a.jsxs("aside",{id:"af-recent-activity-panel",className:"af-activity"+(E?"":" af-activity--hidden"),"aria-hidden":!E,"aria-label":t("project:recentActivity"),children:[a.jsxs("h2",{className:"af-activity-title",children:[a.jsx("span",{className:"af-activity-bullet"}),t("project:recentActivity")]}),a.jsx("div",{className:"af-activity-list",children:sn.length===0?a.jsx("p",{className:"af-activity-empty",children:Xt.length===0?t("project:noRecentActivity"):t("project:noMatchRecent")}):sn.map(q=>a.jsxs("button",{type:"button",className:"af-activity-row af-activity-row--action",onClick:()=>Jt(q),children:[a.jsxs("div",{className:"af-activity-row-top",children:[a.jsx("h4",{className:"af-activity-name",children:a.jsx(Fn,{query:_,children:q.flowId})}),a.jsx("span",{className:"af-activity-time",children:dy(q.at,t)})]}),a.jsxs("div",{className:"af-activity-meta",children:[a.jsx("span",{className:kL(q.kind),children:q.kind==="executed"?"play_arrow":"visibility"}),a.jsxs("p",{className:"af-activity-text",children:[q.kind==="executed"?t("project:recentRun"):t("project:recentOpen")," · ",dy(q.at,t)]})]})]},`${q.kind}-${q.flowId}-${q.flowSource}-${q.at}`))})]})]}),a.jsx(mL,{open:A,onClose:()=>V(!1),onCreated:async q=>{V(!1),await ne();const ye=q.source??"user";n(Ud({id:q.id,source:ye},"workspace"))}}),T?a.jsx(pL,{file:T,onClose:()=>$(null),onImported:async q=>{$(null),await ne();const ye=q.source??"user";n(Ud({id:q.id,source:ye},"workspace"))}},`${T.name}-${T.size}-${T.lastModified}`):null]})}function dn(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=dn(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var PL={value:()=>{}};function nh(){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 Pf(n)}function Pf(e){this._=e}function IL(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Pf.prototype=nh.prototype={constructor:Pf,on:function(e,t){var n=this._,r=IL(e+"",n),i,s=-1,o=r.length;if(arguments.length<2){for(;++s<o;)if((i=(e=r[s]).type)&&(i=AL(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<o;)if(i=(e=r[s]).type)n[i]=eb(n[i],e.name,t);else if(t==null)for(i in n)n[i]=eb(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Pf(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,s;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],r=0,i=s.length;r<i;++r)s[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,s=r.length;i<s;++i)r[i].value.apply(t,n)}};function AL(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function eb(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=PL,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var my="http://www.w3.org/1999/xhtml";const tb={svg:"http://www.w3.org/2000/svg",xhtml:my,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function rh(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),tb.hasOwnProperty(t)?{space:tb[t],local:e}:e}function TL(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===my&&t.documentElement.namespaceURI===my?t.createElement(e):t.createElementNS(n,e)}}function RL(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function gC(e){var t=rh(e);return(t.local?RL:TL)(t)}function LL(){}function Zx(e){return e==null?LL:function(){return this.querySelector(e)}}function OL(e){typeof e!="function"&&(e=Zx(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var s=t[i],o=s.length,c=r[i]=new Array(o),l,u,p=0;p<o;++p)(l=s[p])&&(u=e.call(l,l.__data__,p,s))&&("__data__"in l&&(u.__data__=l.__data__),c[p]=u);return new Ar(r,this._parents)}function ML(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function $L(){return[]}function yC(e){return e==null?$L:function(){return this.querySelectorAll(e)}}function DL(e){return function(){return ML(e.apply(this,arguments))}}function FL(e){typeof e=="function"?e=DL(e):e=yC(e);for(var t=this._groups,n=t.length,r=[],i=[],s=0;s<n;++s)for(var o=t[s],c=o.length,l,u=0;u<c;++u)(l=o[u])&&(r.push(e.call(l,l.__data__,u,o)),i.push(l));return new Ar(r,i)}function xC(e){return function(){return this.matches(e)}}function wC(e){return function(t){return t.matches(e)}}var zL=Array.prototype.find;function BL(e){return function(){return zL.call(this.children,e)}}function HL(){return this.firstElementChild}function UL(e){return this.select(e==null?HL:BL(typeof e=="function"?e:wC(e)))}var VL=Array.prototype.filter;function WL(){return Array.from(this.children)}function KL(e){return function(){return VL.call(this.children,e)}}function qL(e){return this.selectAll(e==null?WL:KL(typeof e=="function"?e:wC(e)))}function YL(e){typeof e!="function"&&(e=xC(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var s=t[i],o=s.length,c=r[i]=[],l,u=0;u<o;++u)(l=s[u])&&e.call(l,l.__data__,u,s)&&c.push(l);return new Ar(r,this._parents)}function vC(e){return new Array(e.length)}function GL(){return new Ar(this._enter||this._groups.map(vC),this._parents)}function dp(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}dp.prototype={constructor:dp,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 XL(e){return function(){return e}}function JL(e,t,n,r,i,s){for(var o=0,c,l=t.length,u=s.length;o<u;++o)(c=t[o])?(c.__data__=s[o],r[o]=c):n[o]=new dp(e,s[o]);for(;o<l;++o)(c=t[o])&&(i[o]=c)}function QL(e,t,n,r,i,s,o){var c,l,u=new Map,p=t.length,f=s.length,d=new Array(p),h;for(c=0;c<p;++c)(l=t[c])&&(d[c]=h=o.call(l,l.__data__,c,t)+"",u.has(h)?i[c]=l:u.set(h,l));for(c=0;c<f;++c)h=o.call(e,s[c],c,s)+"",(l=u.get(h))?(r[c]=l,l.__data__=s[c],u.delete(h)):n[c]=new dp(e,s[c]);for(c=0;c<p;++c)(l=t[c])&&u.get(d[c])===l&&(i[c]=l)}function ZL(e){return e.__data__}function eO(e,t){if(!arguments.length)return Array.from(this,ZL);var n=t?QL:JL,r=this._parents,i=this._groups;typeof e!="function"&&(e=XL(e));for(var s=i.length,o=new Array(s),c=new Array(s),l=new Array(s),u=0;u<s;++u){var p=r[u],f=i[u],d=f.length,h=tO(e.call(p,p&&p.__data__,u,r)),y=h.length,b=c[u]=new Array(y),k=o[u]=new Array(y),g=l[u]=new Array(d);n(p,f,b,k,g,h,t);for(var v=0,w=0,S,C;v<y;++v)if(S=b[v]){for(v>=w&&(w=v+1);!(C=k[w])&&++w<y;);S._next=C||null}}return o=new Ar(o,r),o._enter=c,o._exit=l,o}function tO(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function nO(){return new Ar(this._exit||this._groups.map(vC),this._parents)}function rO(e,t,n){var r=this.enter(),i=this,s=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?s.remove():n(s),r&&i?r.merge(i).order():i}function iO(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,s=r.length,o=Math.min(i,s),c=new Array(i),l=0;l<o;++l)for(var u=n[l],p=r[l],f=u.length,d=c[l]=new Array(f),h,y=0;y<f;++y)(h=u[y]||p[y])&&(d[y]=h);for(;l<i;++l)c[l]=n[l];return new Ar(c,this._parents)}function sO(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,s=r[i],o;--i>=0;)(o=r[i])&&(s&&o.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(o,s),s=o);return this}function oO(e){e||(e=aO);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var n=this._groups,r=n.length,i=new Array(r),s=0;s<r;++s){for(var o=n[s],c=o.length,l=i[s]=new Array(c),u,p=0;p<c;++p)(u=o[p])&&(l[p]=u);l.sort(t)}return new Ar(i,this._parents).order()}function aO(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function lO(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function cO(){return Array.from(this)}function uO(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,s=r.length;i<s;++i){var o=r[i];if(o)return o}return null}function dO(){let e=0;for(const t of this)++e;return e}function fO(){return!this.node()}function pO(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],s=0,o=i.length,c;s<o;++s)(c=i[s])&&e.call(c,c.__data__,s,i);return this}function hO(e){return function(){this.removeAttribute(e)}}function mO(e){return function(){this.removeAttributeNS(e.space,e.local)}}function gO(e,t){return function(){this.setAttribute(e,t)}}function yO(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function xO(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function wO(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 vO(e,t){var n=rh(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?mO:hO:typeof t=="function"?n.local?wO:xO:n.local?yO:gO)(n,t))}function bC(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function bO(e){return function(){this.style.removeProperty(e)}}function kO(e,t,n){return function(){this.style.setProperty(e,t,n)}}function SO(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function NO(e,t,n){return arguments.length>1?this.each((t==null?bO:typeof t=="function"?SO:kO)(e,t,n??"")):ll(this.node(),e)}function ll(e,t){return e.style.getPropertyValue(t)||bC(e).getComputedStyle(e,null).getPropertyValue(t)}function jO(e){return function(){delete this[e]}}function CO(e,t){return function(){this[e]=t}}function EO(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function _O(e,t){return arguments.length>1?this.each((t==null?jO:typeof t=="function"?EO:CO)(e,t)):this.node()[e]}function kC(e){return e.trim().split(/^|\s+/)}function ew(e){return e.classList||new SC(e)}function SC(e){this._node=e,this._names=kC(e.getAttribute("class")||"")}SC.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 NC(e,t){for(var n=ew(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function jC(e,t){for(var n=ew(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function PO(e){return function(){NC(this,e)}}function IO(e){return function(){jC(this,e)}}function AO(e,t){return function(){(t.apply(this,arguments)?NC:jC)(this,e)}}function TO(e,t){var n=kC(e+"");if(arguments.length<2){for(var r=ew(this.node()),i=-1,s=n.length;++i<s;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?AO:t?PO:IO)(n,t))}function RO(){this.textContent=""}function LO(e){return function(){this.textContent=e}}function OO(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function MO(e){return arguments.length?this.each(e==null?RO:(typeof e=="function"?OO:LO)(e)):this.node().textContent}function $O(){this.innerHTML=""}function DO(e){return function(){this.innerHTML=e}}function FO(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function zO(e){return arguments.length?this.each(e==null?$O:(typeof e=="function"?FO:DO)(e)):this.node().innerHTML}function BO(){this.nextSibling&&this.parentNode.appendChild(this)}function HO(){return this.each(BO)}function UO(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function VO(){return this.each(UO)}function WO(e){var t=typeof e=="function"?e:gC(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function KO(){return null}function qO(e,t){var n=typeof e=="function"?e:gC(e),r=t==null?KO:typeof t=="function"?t:Zx(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function YO(){var e=this.parentNode;e&&e.removeChild(this)}function GO(){return this.each(YO)}function XO(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function JO(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function QO(e){return this.select(e?JO:XO)}function ZO(e){return arguments.length?this.property("__data__",e):this.node().__data__}function eM(e){return function(t){e.call(this,t,this.__data__)}}function tM(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 nM(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,s;n<i;++n)s=t[n],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++r]=s;++r?t.length=r:delete this.__on}}}function rM(e,t,n){return function(){var r=this.__on,i,s=eM(t);if(r){for(var o=0,c=r.length;o<c;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=s,i.options=n),i.value=t;return}}this.addEventListener(e.type,s,n),i={type:e.type,name:e.name,value:t,listener:s,options:n},r?r.push(i):this.__on=[i]}}function iM(e,t,n){var r=tM(e+""),i,s=r.length,o;if(arguments.length<2){var c=this.node().__on;if(c){for(var l=0,u=c.length,p;l<u;++l)for(i=0,p=c[l];i<s;++i)if((o=r[i]).type===p.type&&o.name===p.name)return p.value}return}for(c=t?rM:nM,i=0;i<s;++i)this.each(c(r[i],t,n));return this}function CC(e,t,n){var r=bC(e),i=r.CustomEvent;typeof i=="function"?i=new i(t,n):(i=r.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function sM(e,t){return function(){return CC(this,e,t)}}function oM(e,t){return function(){return CC(this,e,t.apply(this,arguments))}}function aM(e,t){return this.each((typeof t=="function"?oM:sM)(e,t))}function*lM(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,s=r.length,o;i<s;++i)(o=r[i])&&(yield o)}var EC=[null];function Ar(e,t){this._groups=e,this._parents=t}function Ou(){return new Ar([[document.documentElement]],EC)}function cM(){return this}Ar.prototype=Ou.prototype={constructor:Ar,select:OL,selectAll:FL,selectChild:UL,selectChildren:qL,filter:YL,data:eO,enter:GL,exit:nO,join:rO,merge:iO,selection:cM,order:sO,sort:oO,call:lO,nodes:cO,node:uO,size:dO,empty:fO,each:pO,attr:vO,style:NO,property:_O,classed:TO,text:MO,html:zO,raise:HO,lower:VO,append:WO,insert:qO,remove:GO,clone:QO,datum:ZO,on:iM,dispatch:aM,[Symbol.iterator]:lM};function Nr(e){return typeof e=="string"?new Ar([[document.querySelector(e)]],[document.documentElement]):new Ar([[e]],EC)}function uM(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ii(e,t){if(e=uM(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}const dM={passive:!1},lu={capture:!0,passive:!1};function Im(e){e.stopImmediatePropagation()}function Xa(e){e.preventDefault(),e.stopImmediatePropagation()}function _C(e){var t=e.document.documentElement,n=Nr(e).on("dragstart.drag",Xa,lu);"onselectstart"in t?n.on("selectstart.drag",Xa,lu):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function PC(e,t){var n=e.document.documentElement,r=Nr(e).on("dragstart.drag",null);t&&(r.on("click.drag",Xa,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 qd=e=>()=>e;function gy(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:s,x:o,y:c,dx:l,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:i,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:c,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:p}})}gy.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function fM(e){return!e.ctrlKey&&!e.button}function pM(){return this.parentNode}function hM(e,t){return t??{x:e.x,y:e.y}}function mM(){return navigator.maxTouchPoints||"ontouchstart"in this}function IC(){var e=fM,t=pM,n=hM,r=mM,i={},s=nh("start","drag","end"),o=0,c,l,u,p,f=0;function d(S){S.on("mousedown.drag",h).filter(r).on("touchstart.drag",k).on("touchmove.drag",g,dM).on("touchend.drag touchcancel.drag",v).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 N=w(this,t.call(this,S,C),S,C,"mouse");N&&(Nr(S.view).on("mousemove.drag",y,lu).on("mouseup.drag",b,lu),_C(S.view),Im(S),u=!1,c=S.clientX,l=S.clientY,N("start",S))}}function y(S){if(Xa(S),!u){var C=S.clientX-c,N=S.clientY-l;u=C*C+N*N>f}i.mouse("drag",S)}function b(S){Nr(S.view).on("mousemove.drag mouseup.drag",null),PC(S.view,u),Xa(S),i.mouse("end",S)}function k(S,C){if(e.call(this,S,C)){var N=S.changedTouches,P=t.call(this,S,C),R=N.length,M,U;for(M=0;M<R;++M)(U=w(this,P,S,C,N[M].identifier,N[M]))&&(Im(S),U("start",S,N[M]))}}function g(S){var C=S.changedTouches,N=C.length,P,R;for(P=0;P<N;++P)(R=i[C[P].identifier])&&(Xa(S),R("drag",S,C[P]))}function v(S){var C=S.changedTouches,N=C.length,P,R;for(p&&clearTimeout(p),p=setTimeout(function(){p=null},500),P=0;P<N;++P)(R=i[C[P].identifier])&&(Im(S),R("end",S,C[P]))}function w(S,C,N,P,R,M){var U=s.copy(),L=ii(M||N,C),A,V,T;if((T=n.call(S,new gy("beforestart",{sourceEvent:N,target:d,identifier:R,active:o,x:L[0],y:L[1],dx:0,dy:0,dispatch:U}),P))!=null)return A=T.x-L[0]||0,V=T.y-L[1]||0,function $(D,K,_){var I=L,E;switch(D){case"start":i[R]=$,E=o++;break;case"end":delete i[R],--o;case"drag":L=ii(_||K,C),E=o;break}U.call(D,S,new gy(D,{sourceEvent:K,subject:T,target:d,identifier:R,active:E,x:L[0]+A,y:L[1]+V,dx:L[0]-I[0],dy:L[1]-I[1],dispatch:U}),P)}}return d.filter=function(S){return arguments.length?(e=typeof S=="function"?S:qd(!!S),d):e},d.container=function(S){return arguments.length?(t=typeof S=="function"?S:qd(S),d):t},d.subject=function(S){return arguments.length?(n=typeof S=="function"?S:qd(S),d):n},d.touchable=function(S){return arguments.length?(r=typeof S=="function"?S:qd(!!S),d):r},d.on=function(){var S=s.on.apply(s,arguments);return S===s?d:S},d.clickDistance=function(S){return arguments.length?(f=(S=+S)*S,d):Math.sqrt(f)},d}function tw(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function AC(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Mu(){}var cu=.7,fp=1/cu,Ja="\\s*([+-]?\\d+)\\s*",uu="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Di="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",gM=/^#([0-9a-f]{3,8})$/,yM=new RegExp(`^rgb\\(${Ja},${Ja},${Ja}\\)$`),xM=new RegExp(`^rgb\\(${Di},${Di},${Di}\\)$`),wM=new RegExp(`^rgba\\(${Ja},${Ja},${Ja},${uu}\\)$`),vM=new RegExp(`^rgba\\(${Di},${Di},${Di},${uu}\\)$`),bM=new RegExp(`^hsl\\(${uu},${Di},${Di}\\)$`),kM=new RegExp(`^hsla\\(${uu},${Di},${Di},${uu}\\)$`),nb={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};tw(Mu,Jo,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:rb,formatHex:rb,formatHex8:SM,formatHsl:NM,formatRgb:ib,toString:ib});function rb(){return this.rgb().formatHex()}function SM(){return this.rgb().formatHex8()}function NM(){return TC(this).formatHsl()}function ib(){return this.rgb().formatRgb()}function Jo(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=gM.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?sb(t):n===3?new cr(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Yd(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Yd(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=yM.exec(e))?new cr(t[1],t[2],t[3],1):(t=xM.exec(e))?new cr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=wM.exec(e))?Yd(t[1],t[2],t[3],t[4]):(t=vM.exec(e))?Yd(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=bM.exec(e))?lb(t[1],t[2]/100,t[3]/100,1):(t=kM.exec(e))?lb(t[1],t[2]/100,t[3]/100,t[4]):nb.hasOwnProperty(e)?sb(nb[e]):e==="transparent"?new cr(NaN,NaN,NaN,0):null}function sb(e){return new cr(e>>16&255,e>>8&255,e&255,1)}function Yd(e,t,n,r){return r<=0&&(e=t=n=NaN),new cr(e,t,n,r)}function jM(e){return e instanceof Mu||(e=Jo(e)),e?(e=e.rgb(),new cr(e.r,e.g,e.b,e.opacity)):new cr}function yy(e,t,n,r){return arguments.length===1?jM(e):new cr(e,t,n,r??1)}function cr(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}tw(cr,yy,AC(Mu,{brighter(e){return e=e==null?fp:Math.pow(fp,e),new cr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?cu:Math.pow(cu,e),new cr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new cr(Ho(this.r),Ho(this.g),Ho(this.b),pp(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:ob,formatHex:ob,formatHex8:CM,formatRgb:ab,toString:ab}));function ob(){return`#${Fo(this.r)}${Fo(this.g)}${Fo(this.b)}`}function CM(){return`#${Fo(this.r)}${Fo(this.g)}${Fo(this.b)}${Fo((isNaN(this.opacity)?1:this.opacity)*255)}`}function ab(){const e=pp(this.opacity);return`${e===1?"rgb(":"rgba("}${Ho(this.r)}, ${Ho(this.g)}, ${Ho(this.b)}${e===1?")":`, ${e})`}`}function pp(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ho(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Fo(e){return e=Ho(e),(e<16?"0":"")+e.toString(16)}function lb(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ai(e,t,n,r)}function TC(e){if(e instanceof ai)return new ai(e.h,e.s,e.l,e.opacity);if(e instanceof Mu||(e=Jo(e)),!e)return new ai;if(e instanceof ai)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),s=Math.max(t,n,r),o=NaN,c=s-i,l=(s+i)/2;return c?(t===s?o=(n-r)/c+(n<r)*6:n===s?o=(r-t)/c+2:o=(t-n)/c+4,c/=l<.5?s+i:2-s-i,o*=60):c=l>0&&l<1?0:o,new ai(o,c,l,e.opacity)}function EM(e,t,n,r){return arguments.length===1?TC(e):new ai(e,t,n,r??1)}function ai(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}tw(ai,EM,AC(Mu,{brighter(e){return e=e==null?fp:Math.pow(fp,e),new ai(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?cu:Math.pow(cu,e),new ai(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new cr(Am(e>=240?e-240:e+120,i,r),Am(e,i,r),Am(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new ai(cb(this.h),Gd(this.s),Gd(this.l),pp(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=pp(this.opacity);return`${e===1?"hsl(":"hsla("}${cb(this.h)}, ${Gd(this.s)*100}%, ${Gd(this.l)*100}%${e===1?")":`, ${e})`}`}}));function cb(e){return e=(e||0)%360,e<0?e+360:e}function Gd(e){return Math.max(0,Math.min(1,e||0))}function Am(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 nw=e=>()=>e;function _M(e,t){return function(n){return e+n*t}}function PM(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 IM(e){return(e=+e)==1?RC:function(t,n){return n-t?PM(t,n,e):nw(isNaN(t)?n:t)}}function RC(e,t){var n=t-e;return n?_M(e,n):nw(isNaN(e)?t:e)}const hp=function e(t){var n=IM(t);function r(i,s){var o=n((i=yy(i)).r,(s=yy(s)).r),c=n(i.g,s.g),l=n(i.b,s.b),u=RC(i.opacity,s.opacity);return function(p){return i.r=o(p),i.g=c(p),i.b=l(p),i.opacity=u(p),i+""}}return r.gamma=e,r}(1);function AM(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(s){for(i=0;i<n;++i)r[i]=e[i]*(1-s)+t[i]*s;return r}}function TM(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function RM(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=new Array(r),s=new Array(n),o;for(o=0;o<r;++o)i[o]=$c(e[o],t[o]);for(;o<n;++o)s[o]=t[o];return function(c){for(o=0;o<r;++o)s[o]=i[o](c);return s}}function LM(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Ii(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function OM(e,t){var n={},r={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?n[i]=$c(e[i],t[i]):r[i]=t[i];return function(s){for(i in n)r[i]=n[i](s);return r}}var xy=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Tm=new RegExp(xy.source,"g");function MM(e){return function(){return e}}function $M(e){return function(t){return e(t)+""}}function LC(e,t){var n=xy.lastIndex=Tm.lastIndex=0,r,i,s,o=-1,c=[],l=[];for(e=e+"",t=t+"";(r=xy.exec(e))&&(i=Tm.exec(t));)(s=i.index)>n&&(s=t.slice(n,s),c[o]?c[o]+=s:c[++o]=s),(r=r[0])===(i=i[0])?c[o]?c[o]+=i:c[++o]=i:(c[++o]=null,l.push({i:o,x:Ii(r,i)})),n=Tm.lastIndex;return n<t.length&&(s=t.slice(n),c[o]?c[o]+=s:c[++o]=s),c.length<2?l[0]?$M(l[0].x):MM(t):(t=l.length,function(u){for(var p=0,f;p<t;++p)c[(f=l[p]).i]=f.x(u);return c.join("")})}function $c(e,t){var n=typeof t,r;return t==null||n==="boolean"?nw(t):(n==="number"?Ii:n==="string"?(r=Jo(t))?(t=r,hp):LC:t instanceof Jo?hp:t instanceof Date?LM:TM(t)?AM:Array.isArray(t)?RM:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?OM:Ii)(e,t)}var ub=180/Math.PI,wy={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function OC(e,t,n,r,i,s){var o,c,l;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(l=e*n+t*r)&&(n-=e*l,r-=t*l),(c=Math.sqrt(n*n+r*r))&&(n/=c,r/=c,l/=c),e*r<t*n&&(e=-e,t=-t,l=-l,o=-o),{translateX:i,translateY:s,rotate:Math.atan2(t,e)*ub,skewX:Math.atan(l)*ub,scaleX:o,scaleY:c}}var Xd;function DM(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?wy:OC(t.a,t.b,t.c,t.d,t.e,t.f)}function FM(e){return e==null||(Xd||(Xd=document.createElementNS("http://www.w3.org/2000/svg","g")),Xd.setAttribute("transform",e),!(e=Xd.transform.baseVal.consolidate()))?wy:(e=e.matrix,OC(e.a,e.b,e.c,e.d,e.e,e.f))}function MC(e,t,n,r){function i(u){return u.length?u.pop()+" ":""}function s(u,p,f,d,h,y){if(u!==f||p!==d){var b=h.push("translate(",null,t,null,n);y.push({i:b-4,x:Ii(u,f)},{i:b-2,x:Ii(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(i(f)+"rotate(",null,r)-2,x:Ii(u,p)})):p&&f.push(i(f)+"rotate("+p+r)}function c(u,p,f,d){u!==p?d.push({i:f.push(i(f)+"skewX(",null,r)-2,x:Ii(u,p)}):p&&f.push(i(f)+"skewX("+p+r)}function l(u,p,f,d,h,y){if(u!==f||p!==d){var b=h.push(i(h)+"scale(",null,",",null,")");y.push({i:b-4,x:Ii(u,f)},{i:b-2,x:Ii(p,d)})}else(f!==1||d!==1)&&h.push(i(h)+"scale("+f+","+d+")")}return function(u,p){var f=[],d=[];return u=e(u),p=e(p),s(u.translateX,u.translateY,p.translateX,p.translateY,f,d),o(u.rotate,p.rotate,f,d),c(u.skewX,p.skewX,f,d),l(u.scaleX,u.scaleY,p.scaleX,p.scaleY,f,d),u=p=null,function(h){for(var y=-1,b=d.length,k;++y<b;)f[(k=d[y]).i]=k.x(h);return f.join("")}}}var zM=MC(DM,"px, ","px)","deg)"),BM=MC(FM,", ",")",")"),HM=1e-12;function db(e){return((e=Math.exp(e))+1/e)/2}function UM(e){return((e=Math.exp(e))-1/e)/2}function VM(e){return((e=Math.exp(2*e))-1)/(e+1)}const If=function e(t,n,r){function i(s,o){var c=s[0],l=s[1],u=s[2],p=o[0],f=o[1],d=o[2],h=p-c,y=f-l,b=h*h+y*y,k,g;if(b<HM)g=Math.log(d/u)/t,k=function(P){return[c+P*h,l+P*y,u*Math.exp(t*P*g)]};else{var v=Math.sqrt(b),w=(d*d-u*u+r*b)/(2*u*n*v),S=(d*d-u*u-r*b)/(2*d*n*v),C=Math.log(Math.sqrt(w*w+1)-w),N=Math.log(Math.sqrt(S*S+1)-S);g=(N-C)/t,k=function(P){var R=P*g,M=db(C),U=u/(n*v)*(M*VM(t*R+C)-UM(C));return[c+U*h,l+U*y,u*M/db(t*R+C)]}}return k.duration=g*1e3*t/Math.SQRT2,k}return i.rho=function(s){var o=Math.max(.001,+s),c=o*o,l=c*c;return e(o,c,l)},i}(Math.SQRT2,2,4);var cl=0,bc=0,ac=0,$C=1e3,mp,kc,gp=0,Qo=0,ih=0,du=typeof performance=="object"&&performance.now?performance:Date,DC=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function rw(){return Qo||(DC(WM),Qo=du.now()+ih)}function WM(){Qo=0}function yp(){this._call=this._time=this._next=null}yp.prototype=FC.prototype={constructor:yp,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?rw():+n)+(t==null?0:+t),!this._next&&kc!==this&&(kc?kc._next=this:mp=this,kc=this),this._call=e,this._time=n,vy()},stop:function(){this._call&&(this._call=null,this._time=1/0,vy())}};function FC(e,t,n){var r=new yp;return r.restart(e,t,n),r}function KM(){rw(),++cl;for(var e=mp,t;e;)(t=Qo-e._time)>=0&&e._call.call(void 0,t),e=e._next;--cl}function fb(){Qo=(gp=du.now())+ih,cl=bc=0;try{KM()}finally{cl=0,YM(),Qo=0}}function qM(){var e=du.now(),t=e-gp;t>$C&&(ih-=t,gp=e)}function YM(){for(var e,t=mp,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:mp=n);kc=e,vy(r)}function vy(e){if(!cl){bc&&(bc=clearTimeout(bc));var t=e-Qo;t>24?(e<1/0&&(bc=setTimeout(fb,e-du.now()-ih)),ac&&(ac=clearInterval(ac))):(ac||(gp=du.now(),ac=setInterval(qM,$C)),cl=1,DC(fb))}}function pb(e,t,n){var r=new yp;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var GM=nh("start","end","cancel","interrupt"),XM=[],zC=0,hb=1,by=2,Af=3,mb=4,ky=5,Tf=6;function sh(e,t,n,r,i,s){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;JM(e,n,{name:t,index:r,group:i,on:GM,tween:XM,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:zC})}function iw(e,t){var n=gi(e,t);if(n.state>zC)throw new Error("too late; already scheduled");return n}function Vi(e,t){var n=gi(e,t);if(n.state>Af)throw new Error("too late; already running");return n}function gi(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function JM(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=FC(s,0,n.time);function s(u){n.state=hb,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!==hb)return l();for(p in r)if(h=r[p],h.name===n.name){if(h.state===Af)return pb(o);h.state===mb?(h.state=Tf,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[p]):+p<t&&(h.state=Tf,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[p])}if(pb(function(){n.state===Af&&(n.state=mb,n.timer.restart(c,n.delay,n.time),c(u))}),n.state=by,n.on.call("start",e,e.__data__,n.index,n.group),n.state===by){for(n.state=Af,i=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))&&(i[++f]=h);i.length=f+1}}function c(u){for(var p=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(l),n.state=ky,1),f=-1,d=i.length;++f<d;)i[f].call(e,p);n.state===ky&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=Tf,n.timer.stop(),delete r[t];for(var u in r)return;delete e.__transition}}function Rf(e,t){var n=e.__transition,r,i,s=!0,o;if(n){t=t==null?null:t+"";for(o in n){if((r=n[o]).name!==t){s=!1;continue}i=r.state>by&&r.state<ky,r.state=Tf,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[o]}s&&delete e.__transition}}function QM(e){return this.each(function(){Rf(this,e)})}function ZM(e,t){var n,r;return function(){var i=Vi(this,e),s=i.tween;if(s!==n){r=n=s;for(var o=0,c=r.length;o<c;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function e$(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var s=Vi(this,e),o=s.tween;if(o!==r){i=(r=o).slice();for(var c={name:t,value:n},l=0,u=i.length;l<u;++l)if(i[l].name===t){i[l]=c;break}l===u&&i.push(c)}s.tween=i}}function t$(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=gi(this.node(),n).tween,i=0,s=r.length,o;i<s;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?ZM:e$)(n,e,t))}function sw(e,t,n){var r=e._id;return e.each(function(){var i=Vi(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return gi(i,r).value[t]}}function BC(e,t){var n;return(typeof t=="number"?Ii:t instanceof Jo?hp:(n=Jo(t))?(t=n,hp):LC)(e,t)}function n$(e){return function(){this.removeAttribute(e)}}function r$(e){return function(){this.removeAttributeNS(e.space,e.local)}}function i$(e,t,n){var r,i=n+"",s;return function(){var o=this.getAttribute(e);return o===i?null:o===r?s:s=t(r=o,n)}}function s$(e,t,n){var r,i=n+"",s;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?s:s=t(r=o,n)}}function o$(e,t,n){var r,i,s;return function(){var o,c=n(this),l;return c==null?void this.removeAttribute(e):(o=this.getAttribute(e),l=c+"",o===l?null:o===r&&l===i?s:(i=l,s=t(r=o,c)))}}function a$(e,t,n){var r,i,s;return function(){var o,c=n(this),l;return c==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),l=c+"",o===l?null:o===r&&l===i?s:(i=l,s=t(r=o,c)))}}function l$(e,t){var n=rh(e),r=n==="transform"?BM:BC;return this.attrTween(e,typeof t=="function"?(n.local?a$:o$)(n,r,sw(this,"attr."+e,t)):t==null?(n.local?r$:n$)(n):(n.local?s$:i$)(n,r,t))}function c$(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function u$(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function d$(e,t){var n,r;function i(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&u$(e,s)),n}return i._value=t,i}function f$(e,t){var n,r;function i(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&c$(e,s)),n}return i._value=t,i}function p$(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=rh(e);return this.tween(n,(r.local?d$:f$)(r,t))}function h$(e,t){return function(){iw(this,e).delay=+t.apply(this,arguments)}}function m$(e,t){return t=+t,function(){iw(this,e).delay=t}}function g$(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?h$:m$)(t,e)):gi(this.node(),t).delay}function y$(e,t){return function(){Vi(this,e).duration=+t.apply(this,arguments)}}function x$(e,t){return t=+t,function(){Vi(this,e).duration=t}}function w$(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?y$:x$)(t,e)):gi(this.node(),t).duration}function v$(e,t){if(typeof t!="function")throw new Error;return function(){Vi(this,e).ease=t}}function b$(e){var t=this._id;return arguments.length?this.each(v$(t,e)):gi(this.node(),t).ease}function k$(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Vi(this,e).ease=n}}function S$(e){if(typeof e!="function")throw new Error;return this.each(k$(this._id,e))}function N$(e){typeof e!="function"&&(e=xC(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var s=t[i],o=s.length,c=r[i]=[],l,u=0;u<o;++u)(l=s[u])&&e.call(l,l.__data__,u,s)&&c.push(l);return new fs(r,this._parents,this._name,this._id)}function j$(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,i=n.length,s=Math.min(r,i),o=new Array(r),c=0;c<s;++c)for(var l=t[c],u=n[c],p=l.length,f=o[c]=new Array(p),d,h=0;h<p;++h)(d=l[h]||u[h])&&(f[h]=d);for(;c<r;++c)o[c]=t[c];return new fs(o,this._parents,this._name,this._id)}function C$(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 E$(e,t,n){var r,i,s=C$(t)?iw:Vi;return function(){var o=s(this,e),c=o.on;c!==r&&(i=(r=c).copy()).on(t,n),o.on=i}}function _$(e,t){var n=this._id;return arguments.length<2?gi(this.node(),n).on.on(e):this.each(E$(n,e,t))}function P$(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function I$(){return this.on("end.remove",P$(this._id))}function A$(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Zx(e));for(var r=this._groups,i=r.length,s=new Array(i),o=0;o<i;++o)for(var c=r[o],l=c.length,u=s[o]=new Array(l),p,f,d=0;d<l;++d)(p=c[d])&&(f=e.call(p,p.__data__,d,c))&&("__data__"in p&&(f.__data__=p.__data__),u[d]=f,sh(u[d],t,n,d,u,gi(p,n)));return new fs(s,this._parents,t,n)}function T$(e){var t=this._name,n=this._id;typeof e!="function"&&(e=yC(e));for(var r=this._groups,i=r.length,s=[],o=[],c=0;c<i;++c)for(var l=r[c],u=l.length,p,f=0;f<u;++f)if(p=l[f]){for(var d=e.call(p,p.__data__,f,l),h,y=gi(p,n),b=0,k=d.length;b<k;++b)(h=d[b])&&sh(h,t,n,b,d,y);s.push(d),o.push(p)}return new fs(s,o,t,n)}var R$=Ou.prototype.constructor;function L$(){return new R$(this._groups,this._parents)}function O$(e,t){var n,r,i;return function(){var s=ll(this,e),o=(this.style.removeProperty(e),ll(this,e));return s===o?null:s===n&&o===r?i:i=t(n=s,r=o)}}function HC(e){return function(){this.style.removeProperty(e)}}function M$(e,t,n){var r,i=n+"",s;return function(){var o=ll(this,e);return o===i?null:o===r?s:s=t(r=o,n)}}function $$(e,t,n){var r,i,s;return function(){var o=ll(this,e),c=n(this),l=c+"";return c==null&&(l=c=(this.style.removeProperty(e),ll(this,e))),o===l?null:o===r&&l===i?s:(i=l,s=t(r=o,c))}}function D$(e,t){var n,r,i,s="style."+t,o="end."+s,c;return function(){var l=Vi(this,e),u=l.on,p=l.value[s]==null?c||(c=HC(t)):void 0;(u!==n||i!==p)&&(r=(n=u).copy()).on(o,i=p),l.on=r}}function F$(e,t,n){var r=(e+="")=="transform"?zM:BC;return t==null?this.styleTween(e,O$(e,r)).on("end.style."+e,HC(e)):typeof t=="function"?this.styleTween(e,$$(e,r,sw(this,"style."+e,t))).each(D$(this._id,e)):this.styleTween(e,M$(e,r,t),n).on("end.style."+e,null)}function z$(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function B$(e,t,n){var r,i;function s(){var o=t.apply(this,arguments);return o!==i&&(r=(i=o)&&z$(e,o,n)),r}return s._value=t,s}function H$(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,B$(e,t,n??""))}function U$(e){return function(){this.textContent=e}}function V$(e){return function(){var t=e(this);this.textContent=t??""}}function W$(e){return this.tween("text",typeof e=="function"?V$(sw(this,"text",e)):U$(e==null?"":e+""))}function K$(e){return function(t){this.textContent=e.call(this,t)}}function q$(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&K$(i)),t}return r._value=e,r}function Y$(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,q$(e))}function G$(){for(var e=this._name,t=this._id,n=UC(),r=this._groups,i=r.length,s=0;s<i;++s)for(var o=r[s],c=o.length,l,u=0;u<c;++u)if(l=o[u]){var p=gi(l,t);sh(l,e,n,u,o,{time:p.time+p.delay+p.duration,delay:0,duration:p.duration,ease:p.ease})}return new fs(r,this._parents,e,n)}function X$(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(s,o){var c={value:o},l={value:function(){--i===0&&s()}};n.each(function(){var u=Vi(this,r),p=u.on;p!==e&&(t=(e=p).copy(),t._.cancel.push(c),t._.interrupt.push(c),t._.end.push(l)),u.on=t}),i===0&&s()})}var J$=0;function fs(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function UC(){return++J$}var Ji=Ou.prototype;fs.prototype={constructor:fs,select:A$,selectAll:T$,selectChild:Ji.selectChild,selectChildren:Ji.selectChildren,filter:N$,merge:j$,selection:L$,transition:G$,call:Ji.call,nodes:Ji.nodes,node:Ji.node,size:Ji.size,empty:Ji.empty,each:Ji.each,on:_$,attr:l$,attrTween:p$,style:F$,styleTween:H$,text:W$,textTween:Y$,remove:I$,tween:t$,delay:g$,duration:w$,ease:b$,easeVarying:S$,end:X$,[Symbol.iterator]:Ji[Symbol.iterator]};function Q$(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Z$={time:null,delay:0,duration:250,ease:Q$};function eD(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 tD(e){var t,n;e instanceof fs?(t=e._id,e=e._name):(t=UC(),(n=Z$).time=rw(),e=e==null?null:e+"");for(var r=this._groups,i=r.length,s=0;s<i;++s)for(var o=r[s],c=o.length,l,u=0;u<c;++u)(l=o[u])&&sh(l,e,t,u,o,n||eD(l,t));return new fs(r,this._parents,e,t)}Ou.prototype.interrupt=QM;Ou.prototype.transition=tD;const Jd=e=>()=>e;function nD(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function ss(e,t,n){this.k=e,this.x=t,this.y=n}ss.prototype={constructor:ss,scale:function(e){return e===1?this:new ss(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ss(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 oh=new ss(1,0,0);VC.prototype=ss.prototype;function VC(e){for(;!e.__zoom;)if(!(e=e.parentNode))return oh;return e.__zoom}function Rm(e){e.stopImmediatePropagation()}function lc(e){e.preventDefault(),e.stopImmediatePropagation()}function rD(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function iD(){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 gb(){return this.__zoom||oh}function sD(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function oD(){return navigator.maxTouchPoints||"ontouchstart"in this}function aD(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>s?(s+o)/2:Math.min(0,s)||Math.max(0,o))}function WC(){var e=rD,t=iD,n=aD,r=sD,i=oD,s=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],c=250,l=If,u=nh("start","zoom","end"),p,f,d,h=500,y=150,b=0,k=10;function g(T){T.property("__zoom",gb).on("wheel.zoom",R,{passive:!1}).on("mousedown.zoom",M).on("dblclick.zoom",U).filter(i).on("touchstart.zoom",L).on("touchmove.zoom",A).on("touchend.zoom touchcancel.zoom",V).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(T,$,D,K){var _=T.selection?T.selection():T;_.property("__zoom",gb),T!==_?C(T,$,D,K):_.interrupt().each(function(){N(this,arguments).event(K).start().zoom(null,typeof $=="function"?$.apply(this,arguments):$).end()})},g.scaleBy=function(T,$,D,K){g.scaleTo(T,function(){var _=this.__zoom.k,I=typeof $=="function"?$.apply(this,arguments):$;return _*I},D,K)},g.scaleTo=function(T,$,D,K){g.transform(T,function(){var _=t.apply(this,arguments),I=this.__zoom,E=D==null?S(_):typeof D=="function"?D.apply(this,arguments):D,Y=I.invert(E),G=typeof $=="function"?$.apply(this,arguments):$;return n(w(v(I,G),E,Y),_,o)},D,K)},g.translateBy=function(T,$,D,K){g.transform(T,function(){return n(this.__zoom.translate(typeof $=="function"?$.apply(this,arguments):$,typeof D=="function"?D.apply(this,arguments):D),t.apply(this,arguments),o)},null,K)},g.translateTo=function(T,$,D,K,_){g.transform(T,function(){var I=t.apply(this,arguments),E=this.__zoom,Y=K==null?S(I):typeof K=="function"?K.apply(this,arguments):K;return n(oh.translate(Y[0],Y[1]).scale(E.k).translate(typeof $=="function"?-$.apply(this,arguments):-$,typeof D=="function"?-D.apply(this,arguments):-D),I,o)},K,_)};function v(T,$){return $=Math.max(s[0],Math.min(s[1],$)),$===T.k?T:new ss($,T.x,T.y)}function w(T,$,D){var K=$[0]-D[0]*T.k,_=$[1]-D[1]*T.k;return K===T.x&&_===T.y?T:new ss(T.k,K,_)}function S(T){return[(+T[0][0]+ +T[1][0])/2,(+T[0][1]+ +T[1][1])/2]}function C(T,$,D,K){T.on("start.zoom",function(){N(this,arguments).event(K).start()}).on("interrupt.zoom end.zoom",function(){N(this,arguments).event(K).end()}).tween("zoom",function(){var _=this,I=arguments,E=N(_,I).event(K),Y=t.apply(_,I),G=D==null?S(Y):typeof D=="function"?D.apply(_,I):D,F=Math.max(Y[1][0]-Y[0][0],Y[1][1]-Y[0][1]),Z=_.__zoom,oe=typeof $=="function"?$.apply(_,I):$,ue=l(Z.invert(G).concat(F/Z.k),oe.invert(G).concat(F/oe.k));return function(ce){if(ce===1)ce=oe;else{var le=ue(ce),ve=F/le[2];ce=new ss(ve,G[0]-le[0]*ve,G[1]-le[1]*ve)}E.zoom(null,ce)}})}function N(T,$,D){return!D&&T.__zooming||new P(T,$)}function P(T,$){this.that=T,this.args=$,this.active=0,this.sourceEvent=null,this.extent=t.apply(T,$),this.taps=0}P.prototype={event:function(T){return T&&(this.sourceEvent=T),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(T,$){return this.mouse&&T!=="mouse"&&(this.mouse[1]=$.invert(this.mouse[0])),this.touch0&&T!=="touch"&&(this.touch0[1]=$.invert(this.touch0[0])),this.touch1&&T!=="touch"&&(this.touch1[1]=$.invert(this.touch1[0])),this.that.__zoom=$,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(T){var $=Nr(this.that).datum();u.call(T,this.that,new nD(T,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:u}),$)}};function R(T,...$){if(!e.apply(this,arguments))return;var D=N(this,$).event(T),K=this.__zoom,_=Math.max(s[0],Math.min(s[1],K.k*Math.pow(2,r.apply(this,arguments)))),I=ii(T);if(D.wheel)(D.mouse[0][0]!==I[0]||D.mouse[0][1]!==I[1])&&(D.mouse[1]=K.invert(D.mouse[0]=I)),clearTimeout(D.wheel);else{if(K.k===_)return;D.mouse=[I,K.invert(I)],Rf(this),D.start()}lc(T),D.wheel=setTimeout(E,y),D.zoom("mouse",n(w(v(K,_),D.mouse[0],D.mouse[1]),D.extent,o));function E(){D.wheel=null,D.end()}}function M(T,...$){if(d||!e.apply(this,arguments))return;var D=T.currentTarget,K=N(this,$,!0).event(T),_=Nr(T.view).on("mousemove.zoom",G,!0).on("mouseup.zoom",F,!0),I=ii(T,D),E=T.clientX,Y=T.clientY;_C(T.view),Rm(T),K.mouse=[I,this.__zoom.invert(I)],Rf(this),K.start();function G(Z){if(lc(Z),!K.moved){var oe=Z.clientX-E,ue=Z.clientY-Y;K.moved=oe*oe+ue*ue>b}K.event(Z).zoom("mouse",n(w(K.that.__zoom,K.mouse[0]=ii(Z,D),K.mouse[1]),K.extent,o))}function F(Z){_.on("mousemove.zoom mouseup.zoom",null),PC(Z.view,K.moved),lc(Z),K.event(Z).end()}}function U(T,...$){if(e.apply(this,arguments)){var D=this.__zoom,K=ii(T.changedTouches?T.changedTouches[0]:T,this),_=D.invert(K),I=D.k*(T.shiftKey?.5:2),E=n(w(v(D,I),K,_),t.apply(this,$),o);lc(T),c>0?Nr(this).transition().duration(c).call(C,E,K,T):Nr(this).call(g.transform,E,K,T)}}function L(T,...$){if(e.apply(this,arguments)){var D=T.touches,K=D.length,_=N(this,$,T.changedTouches.length===K).event(T),I,E,Y,G;for(Rm(T),E=0;E<K;++E)Y=D[E],G=ii(Y,this),G=[G,this.__zoom.invert(G),Y.identifier],_.touch0?!_.touch1&&_.touch0[2]!==G[2]&&(_.touch1=G,_.taps=0):(_.touch0=G,I=!0,_.taps=1+!!p);p&&(p=clearTimeout(p)),I&&(_.taps<2&&(f=G[0],p=setTimeout(function(){p=null},h)),Rf(this),_.start())}}function A(T,...$){if(this.__zooming){var D=N(this,$).event(T),K=T.changedTouches,_=K.length,I,E,Y,G;for(lc(T),I=0;I<_;++I)E=K[I],Y=ii(E,this),D.touch0&&D.touch0[2]===E.identifier?D.touch0[0]=Y:D.touch1&&D.touch1[2]===E.identifier&&(D.touch1[0]=Y);if(E=D.that.__zoom,D.touch1){var F=D.touch0[0],Z=D.touch0[1],oe=D.touch1[0],ue=D.touch1[1],ce=(ce=oe[0]-F[0])*ce+(ce=oe[1]-F[1])*ce,le=(le=ue[0]-Z[0])*le+(le=ue[1]-Z[1])*le;E=v(E,Math.sqrt(ce/le)),Y=[(F[0]+oe[0])/2,(F[1]+oe[1])/2],G=[(Z[0]+ue[0])/2,(Z[1]+ue[1])/2]}else if(D.touch0)Y=D.touch0[0],G=D.touch0[1];else return;D.zoom("touch",n(w(E,Y,G),D.extent,o))}}function V(T,...$){if(this.__zooming){var D=N(this,$).event(T),K=T.changedTouches,_=K.length,I,E;for(Rm(T),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),I=0;I<_;++I)E=K[I],D.touch0&&D.touch0[2]===E.identifier?delete D.touch0:D.touch1&&D.touch1[2]===E.identifier&&delete D.touch1;if(D.touch1&&!D.touch0&&(D.touch0=D.touch1,delete D.touch1),D.touch0)D.touch0[1]=this.__zoom.invert(D.touch0[0]);else if(D.end(),D.taps===2&&(E=ii(E,this),Math.hypot(f[0]-E[0],f[1]-E[1])<k)){var Y=Nr(this).on("dblclick.zoom");Y&&Y.apply(this,arguments)}}}return g.wheelDelta=function(T){return arguments.length?(r=typeof T=="function"?T:Jd(+T),g):r},g.filter=function(T){return arguments.length?(e=typeof T=="function"?T:Jd(!!T),g):e},g.touchable=function(T){return arguments.length?(i=typeof T=="function"?T:Jd(!!T),g):i},g.extent=function(T){return arguments.length?(t=typeof T=="function"?T:Jd([[+T[0][0],+T[0][1]],[+T[1][0],+T[1][1]]]),g):t},g.scaleExtent=function(T){return arguments.length?(s[0]=+T[0],s[1]=+T[1],g):[s[0],s[1]]},g.translateExtent=function(T){return arguments.length?(o[0][0]=+T[0][0],o[1][0]=+T[1][0],o[0][1]=+T[0][1],o[1][1]=+T[1][1],g):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},g.constrain=function(T){return arguments.length?(n=T,g):n},g.duration=function(T){return arguments.length?(c=+T,g):c},g.interpolate=function(T){return arguments.length?(l=T,g):l},g.on=function(){var T=u.on.apply(u,arguments);return T===u?g:T},g.clickDistance=function(T){return arguments.length?(b=(T=+T)*T,g):Math.sqrt(b)},g.tapDistance=function(T){return arguments.length?(k=+T,g):k},g}const Hi={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]],KC=["Enter"," ","Escape"],qC={"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 ul;(function(e){e.Strict="strict",e.Loose="loose"})(ul||(ul={}));var Uo;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Uo||(Uo={}));var pu;(function(e){e.Partial="partial",e.Full="full"})(pu||(pu={}));const YC={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ws;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ws||(Ws={}));var _r;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(_r||(_r={}));var Re;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Re||(Re={}));const yb={[Re.Left]:Re.Right,[Re.Right]:Re.Left,[Re.Top]:Re.Bottom,[Re.Bottom]:Re.Top};function GC(e){return e===null?null:e?"valid":"invalid"}const XC=e=>"id"in e&&"source"in e&&"target"in e,lD=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),ow=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),$u=(e,t=[0,0])=>{const{width:n,height:r}=gs(e),i=e.origin??t,s=n*i[0],o=r*i[1];return{x:e.position.x-s,y:e.position.y-o}},cD=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,i)=>{const s=typeof i=="string";let o=!t.nodeLookup&&!s?i:void 0;t.nodeLookup&&(o=s?t.nodeLookup.get(i):ow(i)?i:t.nodeLookup.get(i.id));const c=o?xp(o,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return ah(r,c)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return lh(n)},Du=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(i=>{(t.filter===void 0||t.filter(i))&&(n=ah(n,xp(i)),r=!0)}),r?lh(n):{x:0,y:0,width:0,height:0}},aw=(e,t,[n,r,i]=[0,0,1],s=!1,o=!1)=>{const c={...zu(t,[n,r,i]),width:t.width/i,height:t.height/i},l=[];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,b=hu(c,fl(u)),k=(h??0)*(y??0),g=s&&b>0;(!u.internals.handleBounds||g||b>=k||u.dragging)&&l.push(u)}return l},uD=(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 dD(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(i=>i.id)):null;return e.forEach(i=>{i.measured.width&&i.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!i.hidden)&&(!r||r.has(i.id))&&n.set(i.id,i)}),n}async function fD({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:s},o){if(e.size===0)return Promise.resolve(!0);const c=dD(e,o),l=Du(c),u=lw(l,t,n,(o==null?void 0:o.minZoom)??i,(o==null?void 0:o.maxZoom)??s,(o==null?void 0:o.padding)??.1);return await r.setViewport(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 JC({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:s}){const o=n.get(e),c=o.parentId?n.get(o.parentId):void 0,{x:l,y:u}=c?c.internals.positionAbsolute:{x:0,y:0},p=o.origin??r;let f=o.extent||i;if(o.extent==="parent"&&!o.expandParent)if(!c)s==null||s("005",Hi.error005());else{const h=c.measured.width,y=c.measured.height;h&&y&&(f=[[l,u],[l+h,u+y]])}else c&&pl(o.extent)&&(f=[[o.extent[0][0]+l,o.extent[0][1]+u],[o.extent[1][0]+l,o.extent[1][1]+u]]);const d=pl(f)?Zo(t,f,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&(s==null||s("015",Hi.error015())),{position:{x:d.x-l+(o.measured.width??0)*p[0],y:d.y-u+(o.measured.height??0)*p[1]},positionAbsolute:d}}async function pD({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){const s=new Set(e.map(d=>d.id)),o=[];for(const d of n){if(d.deletable===!1)continue;const h=s.has(d.id),y=!h&&d.parentId&&o.find(b=>b.id===d.parentId);(h||y)&&o.push(d)}const c=new Set(t.map(d=>d.id)),l=r.filter(d=>d.deletable!==!1),p=uD(o,l);for(const d of l)c.has(d.id)&&!p.find(y=>y.id===d.id)&&p.push(d);if(!i)return{edges:p,nodes:o};const f=await i({nodes:o,edges:p});return typeof f=="boolean"?f?{edges:p,nodes:o}:{edges:[],nodes:[]}:f}const dl=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Zo=(e={x:0,y:0},t,n)=>({x:dl(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:dl(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function QC(e,t,n){const{width:r,height:i}=gs(n),{x:s,y:o}=n.internals.positionAbsolute;return Zo(e,[[s,o],[s+r,o+i]],t)}const xb=(e,t,n)=>e<t?dl(Math.abs(e-t),1,t)/t:e>n?-dl(Math.abs(e-n),1,t)/t:0,ZC=(e,t,n=15,r=40)=>{const i=xb(e.x,r,t.width-r)*n,s=xb(e.y,r,t.height-r)*n;return[i,s]},ah=(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)}),Sy=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),lh=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),fl=(e,t=[0,0])=>{var i,s;const{x:n,y:r}=ow(e)?e.internals.positionAbsolute:$u(e,t);return{x:n,y:r,width:((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0,height:((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0}},xp=(e,t=[0,0])=>{var i,s;const{x:n,y:r}=ow(e)?e.internals.positionAbsolute:$u(e,t);return{x:n,y:r,x2:n+(((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0),y2:r+(((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0)}},eE=(e,t)=>lh(ah(Sy(e),Sy(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)},wb=e=>li(e.width)&&li(e.height)&&li(e.x)&&li(e.y),li=e=>!isNaN(e)&&isFinite(e),hD=(e,t)=>{},Fu=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),zu=({x:e,y:t},[n,r,i],s=!1,o=[1,1])=>{const c={x:(e-n)/i,y:(t-r)/i};return s?Fu(c,o):c},wp=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function ya(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 mD(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=ya(e,n),i=ya(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e=="object"){const r=ya(e.top??e.y??0,n),i=ya(e.bottom??e.y??0,n),s=ya(e.left??e.x??0,t),o=ya(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:s,x:s+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function gD(e,t,n,r,i,s){const{x:o,y:c}=wp(e,[t,n,r]),{x:l,y:u}=wp({x:e.x+e.width,y:e.y+e.height},[t,n,r]),p=i-l,f=s-u;return{left:Math.floor(o),top:Math.floor(c),right:Math.floor(p),bottom:Math.floor(f)}}const lw=(e,t,n,r,i,s)=>{const o=mD(s,t,n),c=(t-o.x)/e.width,l=(n-o.y)/e.height,u=Math.min(c,l),p=dl(u,r,i),f=e.x+e.width/2,d=e.y+e.height/2,h=t/2-f*p,y=n/2-d*p,b=gD(e,h,y,p,t,n),k={left:Math.min(b.left-o.left,0),top:Math.min(b.top-o.top,0),right:Math.min(b.right-o.right,0),bottom:Math.min(b.bottom-o.bottom,0)};return{x:h-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 pl(e){return e!=null&&e!=="parent"}function gs(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 tE(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 nE(e,t={width:0,height:0},n,r,i){const s={...e},o=r.get(n);if(o){const c=o.origin||i;s.x+=o.internals.positionAbsolute.x-(t.width??0)*c[0],s.y+=o.internals.positionAbsolute.y-(t.height??0)*c[1]}return s}function vb(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function yD(){let e,t;return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}}function xD(e){return{...qC,...e||{}}}function Dc(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){const{x:s,y:o}=ci(e),c=zu({x:s-((i==null?void 0:i.left)??0),y:o-((i==null?void 0:i.top)??0)},r),{x:l,y:u}=n?Fu(c,t):c;return{xSnapped:l,ySnapped:u,...c}}const cw=e=>({width:e.offsetWidth,height:e.offsetHeight}),rE=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},wD=["INPUT","SELECT","TEXTAREA"];function iE(e){var r,i;const t=((i=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:i[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:wD.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const sE=e=>"clientX"in e,ci=(e,t)=>{var s,o;const n=sE(e),r=n?e.clientX:(s=e.touches)==null?void 0:s[0].clientX,i=n?e.clientY:(o=e.touches)==null?void 0:o[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},bb=(e,t,n,r,i)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(o=>{const c=o.getBoundingClientRect();return{id:o.getAttribute("data-handleid"),type:e,nodeId:i,position:o.getAttribute("data-handlepos"),x:(c.left-n.left)/r,y:(c.top-n.top)/r,...cw(o)}})};function oE({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:s,targetControlX:o,targetControlY:c}){const l=e*.125+i*.375+o*.375+n*.125,u=t*.125+s*.375+c*.375+r*.125,p=Math.abs(l-e),f=Math.abs(u-t);return[l,u,p,f]}function Qd(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function kb({pos:e,x1:t,y1:n,x2:r,y2:i,c:s}){switch(e){case Re.Left:return[t-Qd(t-r,s),n];case Re.Right:return[t+Qd(r-t,s),n];case Re.Top:return[t,n-Qd(n-i,s)];case Re.Bottom:return[t,n+Qd(i-n,s)]}}function aE({sourceX:e,sourceY:t,sourcePosition:n=Re.Bottom,targetX:r,targetY:i,targetPosition:s=Re.Top,curvature:o=.25}){const[c,l]=kb({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[u,p]=kb({pos:s,x1:r,y1:i,x2:e,y2:t,c:o}),[f,d,h,y]=oE({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:c,sourceControlY:l,targetControlX:u,targetControlY:p});return[`M${e},${t} C${c},${l} ${u},${p} ${r},${i}`,f,d,h,y]}function lE({sourceX:e,sourceY:t,targetX:n,targetY:r}){const i=Math.abs(n-e)/2,s=n<e?n+i:n-i,o=Math.abs(r-t)/2,c=r<t?r+o:r-o;return[s,c,i,o]}function vD({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:s="basic"}){if(s==="manual")return r;const o=i&&n?r+1e3:r,c=Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0);return o+c}function bD({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){const s=ah(xp(e),xp(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const o={x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]};return hu(o,lh(s))>0}const kD=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,SD=(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)),gu=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||kD;let i;return XC(e)?i={...e}:i={...e,id:r(e)},SD(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function cE({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[i,s,o,c]=lE({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,s,o,c]}const Sb={[Re.Left]:{x:-1,y:0},[Re.Right]:{x:1,y:0},[Re.Top]:{x:0,y:-1},[Re.Bottom]:{x:0,y:1}},ND=({source:e,sourcePosition:t=Re.Bottom,target:n})=>t===Re.Left||t===Re.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},Nb=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function jD({source:e,sourcePosition:t=Re.Bottom,target:n,targetPosition:r=Re.Top,center:i,offset:s,stepPosition:o}){const c=Sb[t],l=Sb[r],u={x:e.x+c.x*s,y:e.y+c.y*s},p={x:n.x+l.x*s,y:n.y+l.y*s},f=ND({source:u,sourcePosition:t,target:p}),d=f.x!==0?"x":"y",h=f[d];let y=[],b,k;const g={x:0,y:0},v={x:0,y:0},[,,w,S]=lE({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(c[d]*l[d]===-1){d==="x"?(b=i.x??u.x+(p.x-u.x)*o,k=i.y??(u.y+p.y)/2):(b=i.x??(u.x+p.x)/2,k=i.y??u.y+(p.y-u.y)*o);const R=[{x:b,y:u.y},{x:b,y:p.y}],M=[{x:u.x,y:k},{x:p.x,y:k}];c[d]===h?y=d==="x"?R:M:y=d==="x"?M:R}else{const R=[{x:u.x,y:p.y}],M=[{x:p.x,y:u.y}];if(d==="x"?y=c.x===h?M:R:y=c.y===h?R:M,t===r){const T=Math.abs(e[d]-n[d]);if(T<=s){const $=Math.min(s-1,s-T);c[d]===h?g[d]=(u[d]>e[d]?-1:1)*$:v[d]=(p[d]>n[d]?-1:1)*$}}if(t!==r){const T=d==="x"?"y":"x",$=c[d]===l[T],D=u[T]>p[T],K=u[T]<p[T];(c[d]===1&&(!$&&D||$&&K)||c[d]!==1&&(!$&&K||$&&D))&&(y=d==="x"?R:M)}const U={x:u.x+g.x,y:u.y+g.y},L={x:p.x+v.x,y:p.y+v.y},A=Math.max(Math.abs(U.x-y[0].x),Math.abs(L.x-y[0].x)),V=Math.max(Math.abs(U.y-y[0].y),Math.abs(L.y-y[0].y));A>=V?(b=(U.x+L.x)/2,k=y[0].y):(b=y[0].x,k=(U.y+L.y)/2)}const C={x:u.x+g.x,y:u.y+g.y},N={x:p.x+v.x,y:p.y+v.y};return[[e,...C.x!==y[0].x||C.y!==y[0].y?[C]:[],...y,...N.x!==y[y.length-1].x||N.y!==y[y.length-1].y?[N]:[],n],b,k,w,S]}function CD(e,t,n,r){const i=Math.min(Nb(e,t)/2,Nb(t,n)/2,r),{x:s,y:o}=t;if(e.x===s&&s===n.x||e.y===o&&o===n.y)return`L${s} ${o}`;if(e.y===o){const u=e.x<n.x?-1:1,p=e.y<n.y?1:-1;return`L ${s+i*u},${o}Q ${s},${o} ${s},${o+i*p}`}const c=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${s},${o+i*l}Q ${s},${o} ${s+i*c},${o}`}function Ny({sourceX:e,sourceY:t,sourcePosition:n=Re.Bottom,targetX:r,targetY:i,targetPosition:s=Re.Top,borderRadius:o=5,centerX:c,centerY:l,offset:u=20,stepPosition:p=.5}){const[f,d,h,y,b]=jD({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:s,center:{x:c,y:l},offset:u,stepPosition:p});let k=`M${f[0].x} ${f[0].y}`;for(let g=1;g<f.length-1;g++)k+=CD(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,b]}function jb(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function ED(e){var f;const{sourceNode:t,targetNode:n}=e;if(!jb(t)||!jb(n))return null;const r=t.internals.handleBounds||Cb(t.handles),i=n.internals.handleBounds||Cb(n.handles),s=Eb((r==null?void 0:r.source)??[],e.sourceHandle),o=Eb(e.connectionMode===ul.Strict?(i==null?void 0:i.target)??[]:((i==null?void 0:i.target)??[]).concat((i==null?void 0:i.source)??[]),e.targetHandle);if(!s||!o)return(f=e.onError)==null||f.call(e,"008",Hi.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const c=(s==null?void 0:s.position)||Re.Bottom,l=(o==null?void 0:o.position)||Re.Top,u=ea(t,s,c),p=ea(n,o,l);return{sourceX:u.x,sourceY:u.y,targetX:p.x,targetY:p.y,sourcePosition:c,targetPosition:l}}function Cb(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 ea(e,t,n=Re.Left,r=!1){const i=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,s=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:o,height:c}=t??gs(e);if(r)return{x:i+o/2,y:s+c/2};switch((t==null?void 0:t.position)??n){case Re.Top:return{x:i+o/2,y:s};case Re.Right:return{x:i+o,y:s+c/2};case Re.Bottom:return{x:i+o/2,y:s+c};case Re.Left:return{x:i,y:s+c/2}}}function Eb(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function jy(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function _D(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){const s=new Set;return e.reduce((o,c)=>([c.markerStart||r,c.markerEnd||i].forEach(l=>{if(l&&typeof l=="object"){const u=jy(l,t);s.has(u)||(o.push({id:u,color:l.color||n,...l}),s.add(u))}}),o),[]).sort((o,c)=>o.id.localeCompare(c.id))}const uE=1e3,PD=10,uw={nodeOrigin:[0,0],nodeExtent:fu,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},ID={...uw,checkEquality:!0};function dw(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function AD(e,t,n){const r=dw(uw,n);for(const i of e.values())if(i.parentId)pw(i,e,t,r);else{const s=$u(i,r.nodeOrigin),o=pl(i.extent)?i.extent:r.nodeExtent,c=Zo(s,o,gs(i));i.internals.positionAbsolute=c}}function TD(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const i of e.handles){const s={id:i.id,width:i.width??1,height:i.height??1,nodeId:e.id,x:i.x,y:i.y,position:i.position,type:i.type};i.type==="source"?n.push(s):i.type==="target"&&r.push(s)}return{source:n,target:r}}function fw(e){return e==="manual"}function Cy(e,t,n,r={}){var p,f;const i=dw(ID,r),s={i:0},o=new Map(t),c=i!=null&&i.elevateNodesOnSelect&&!fw(i.zIndexMode)?uE:0;let l=e.length>0,u=!1;t.clear(),n.clear();for(const d of e){let h=o.get(d.id);if(i.checkEquality&&d===(h==null?void 0:h.internals.userNode))t.set(d.id,h);else{const y=$u(d,i.nodeOrigin),b=pl(d.extent)?d.extent:i.nodeExtent,k=Zo(y,b,gs(d));h={...i.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:TD(d,h),z:dE(d,c,i.zIndexMode),userNode:d}},t.set(d.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(l=!1),d.parentId&&pw(h,t,n,r,s),u||(u=d.selected??!1)}return{nodesInitialized:l,hasSelectedNodes:u}}function RD(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 pw(e,t,n,r,i){const{elevateNodesOnSelect:s,nodeOrigin:o,nodeExtent:c,zIndexMode:l}=dw(uw,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}RD(e,n),i&&!p.parentId&&p.internals.rootParentIndex===void 0&&l==="auto"&&(p.internals.rootParentIndex=++i.i,p.internals.z=p.internals.z+i.i*PD),i&&p.internals.rootParentIndex!==void 0&&(i.i=p.internals.rootParentIndex);const f=s&&!fw(l)?uE:0,{x:d,y:h,z:y}=LD(e,p,o,c,f,l),{positionAbsolute:b}=e.internals,k=d!==b.x||h!==b.y;(k||y!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:k?{x:d,y:h}:b,z:y}})}function dE(e,t,n){const r=li(e.zIndex)?e.zIndex:0;return fw(n)?r:r+(e.selected?t:0)}function LD(e,t,n,r,i,s){const{x:o,y:c}=t.internals.positionAbsolute,l=gs(e),u=$u(e,n),p=pl(e.extent)?Zo(u,e.extent,l):u;let f=Zo({x:o+p.x,y:c+p.y},r,l);e.extent==="parent"&&(f=QC(f,l,t));const d=dE(e,i,s),h=t.internals.z??0;return{x:f.x,y:f.y,z:h>=d?h+1:d}}function hw(e,t,n,r=[0,0]){var o;const i=[],s=new Map;for(const c of e){const l=t.get(c.parentId);if(!l)continue;const u=((o=s.get(c.parentId))==null?void 0:o.expandedRect)??fl(l),p=eE(u,c.rect);s.set(c.parentId,{expandedRect:p,parent:l})}return s.size>0&&s.forEach(({expandedRect:c,parent:l},u)=>{var w;const p=l.internals.positionAbsolute,f=gs(l),d=l.origin??r,h=c.x<p.x?Math.round(Math.abs(p.x-c.x)):0,y=c.y<p.y?Math.round(Math.abs(p.y-c.y)):0,b=Math.max(f.width,Math.round(c.width)),k=Math.max(f.height,Math.round(c.height)),g=(b-f.width)*d[0],v=(k-f.height)*d[1];(h>0||y>0||g||v)&&(i.push({id:u,type:"position",position:{x:l.position.x-h+g,y:l.position.y-y+v}}),(w=n.get(u))==null||w.forEach(S=>{e.some(C=>C.id===S.id)||i.push({id:S.id,type:"position",position:{x:S.position.x+h,y:S.position.y+y}})})),(f.width<c.width||f.height<c.height||h||y)&&i.push({id:u,type:"dimensions",setAttributes:!0,dimensions:{width:b+(h?d[0]*h-g:0),height:k+(y?d[1]*y-v:0)}})}),i}function OD(e,t,n,r,i,s,o){const c=r==null?void 0:r.querySelector(".xyflow__viewport");let l=!1;if(!c)return{changes:[],updatedInternals:l};const u=[],p=window.getComputedStyle(c),{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}}),l=!0;continue}const b=cw(h.nodeElement),k=y.measured.width!==b.width||y.measured.height!==b.height;if(!!(b.width&&b.height&&(k||!y.internals.handleBounds||h.force))){const v=h.nodeElement.getBoundingClientRect(),w=pl(y.extent)?y.extent:s;let{positionAbsolute:S}=y.internals;y.parentId&&y.extent==="parent"?S=QC(S,b,t.get(y.parentId)):w&&(S=Zo(S,w,b));const C={...y,measured:b,internals:{...y.internals,positionAbsolute:S,handleBounds:{source:bb("source",h.nodeElement,v,f,y.id),target:bb("target",h.nodeElement,v,f,y.id)}}};t.set(y.id,C),y.parentId&&pw(C,t,n,{nodeOrigin:i,zIndexMode:o}),l=!0,k&&(u.push({id:y.id,type:"dimensions",dimensions:b}),y.expandParent&&y.parentId&&d.push({id:y.id,parentId:y.parentId,rect:fl(C,i)}))}}if(d.length>0){const h=hw(d,t,n,i);u.push(...h)}return{changes:u,updatedInternals:l}}async function MD({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:s}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,s]],r),c=!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2]);return Promise.resolve(c)}function _b(e,t,n,r,i,s){let o=i;const c=r.get(o)||new Map;r.set(o,c.set(n,t)),o=`${i}-${e}`;const l=r.get(o)||new Map;if(r.set(o,l.set(n,t)),s){o=`${i}-${e}-${s}`;const u=r.get(o)||new Map;r.set(o,u.set(n,t))}}function fE(e,t,n){e.clear(),t.clear();for(const r of n){const{source:i,target:s,sourceHandle:o=null,targetHandle:c=null}=r,l={edgeId:r.id,source:i,target:s,sourceHandle:o,targetHandle:c},u=`${i}-${o}--${s}-${c}`,p=`${s}-${c}--${i}-${o}`;_b("source",l,p,e,i,o),_b("target",l,u,e,s,c),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 Pb(e,t,n){var i;let r=e;do{if((i=r==null?void 0:r.matches)!=null&&i.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function $D(e,t,n,r){const i=new Map;for(const[s,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!pE(o,e))&&(o.draggable||t&&typeof o.draggable>"u")){const c=e.get(s);c&&i.set(s,{id:s,position:c.position||{x:0,y:0},distance:{x:n.x-c.internals.positionAbsolute.x,y:n.y-c.internals.positionAbsolute.y},extent:c.extent,parentId:c.parentId,origin:c.origin,expandParent:c.expandParent,internals:{positionAbsolute:c.internals.positionAbsolute||{x:0,y:0}},measured:{width:c.measured.width??0,height:c.measured.height??0}})}return i}function Lm({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var o,c,l;const i=[];for(const[u,p]of t){const f=(o=n.get(u))==null?void 0:o.internals.userNode;f&&i.push({...f,position:p.position,dragging:r})}if(!e)return[i[0],i];const s=(c=n.get(e))==null?void 0:c.internals.userNode;return[s?{...s,position:((l=t.get(e))==null?void 0:l.position)||s.position,dragging:r}:i[0],i]}function DD({dragItems:e,snapGrid:t,x:n,y:r}){const i=e.values().next().value;if(!i)return null;const s={x:n-i.distance.x,y:r-i.distance.y},o=Fu(s,t);return{x:o.x-s.x,y:o.y-s.y}}function FD({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let s={x:null,y:null},o=0,c=new Map,l=!1,u={x:0,y:0},p=null,f=!1,d=null,h=!1,y=!1,b=null;function k({noDragClassName:v,handleSelector:w,domNode:S,isSelectable:C,nodeId:N,nodeClickDistance:P=0}){d=Nr(S);function R({x:A,y:V}){const{nodeLookup:T,nodeExtent:$,snapGrid:D,snapToGrid:K,nodeOrigin:_,onNodeDrag:I,onSelectionDrag:E,onError:Y,updateNodePositions:G}=t();s={x:A,y:V};let F=!1;const Z=c.size>1,oe=Z&&$?Sy(Du(c)):null,ue=Z&&K?DD({dragItems:c,snapGrid:D,x:A,y:V}):null;for(const[ce,le]of c){if(!T.has(ce))continue;let ve={x:A-le.distance.x,y:V-le.distance.y};K&&(ve=ue?{x:Math.round(ve.x+ue.x),y:Math.round(ve.y+ue.y)}:Fu(ve,D));let ie=null;if(Z&&$&&!le.extent&&oe){const{positionAbsolute:Se}=le.internals,Ve=Se.x-oe.x+$[0][0],Fe=Se.x+le.measured.width-oe.x2+$[1][0],ze=Se.y-oe.y+$[0][1],ht=Se.y+le.measured.height-oe.y2+$[1][1];ie=[[Ve,ze],[Fe,ht]]}const{position:de,positionAbsolute:me}=JC({nodeId:ce,nextPosition:ve,nodeLookup:T,nodeExtent:ie||$,nodeOrigin:_,onError:Y});F=F||le.position.x!==de.x||le.position.y!==de.y,le.position=de,le.internals.positionAbsolute=me}if(y=y||F,!!F&&(G(c,!0),b&&(r||I||!N&&E))){const[ce,le]=Lm({nodeId:N,dragItems:c,nodeLookup:T});r==null||r(b,c,ce,le),I==null||I(b,ce,le),N||E==null||E(b,le)}}async function M(){if(!p)return;const{transform:A,panBy:V,autoPanSpeed:T,autoPanOnNodeDrag:$}=t();if(!$){l=!1,cancelAnimationFrame(o);return}const[D,K]=ZC(u,p,T);(D!==0||K!==0)&&(s.x=(s.x??0)-D/A[2],s.y=(s.y??0)-K/A[2],await V({x:D,y:K})&&R(s)),o=requestAnimationFrame(M)}function U(A){var Z;const{nodeLookup:V,multiSelectionActive:T,nodesDraggable:$,transform:D,snapGrid:K,snapToGrid:_,selectNodesOnDrag:I,onNodeDragStart:E,onSelectionDragStart:Y,unselectNodesAndEdges:G}=t();f=!0,(!I||!C)&&!T&&N&&((Z=V.get(N))!=null&&Z.selected||G()),C&&I&&N&&(e==null||e(N));const F=Dc(A.sourceEvent,{transform:D,snapGrid:K,snapToGrid:_,containerBounds:p});if(s=F,c=$D(V,$,F,N),c.size>0&&(n||E||!N&&Y)){const[oe,ue]=Lm({nodeId:N,dragItems:c,nodeLookup:V});n==null||n(A.sourceEvent,c,oe,ue),E==null||E(A.sourceEvent,oe,ue),N||Y==null||Y(A.sourceEvent,ue)}}const L=IC().clickDistance(P).on("start",A=>{const{domNode:V,nodeDragThreshold:T,transform:$,snapGrid:D,snapToGrid:K}=t();p=(V==null?void 0:V.getBoundingClientRect())||null,h=!1,y=!1,b=A.sourceEvent,T===0&&U(A),s=Dc(A.sourceEvent,{transform:$,snapGrid:D,snapToGrid:K,containerBounds:p}),u=ci(A.sourceEvent,p)}).on("drag",A=>{const{autoPanOnNodeDrag:V,transform:T,snapGrid:$,snapToGrid:D,nodeDragThreshold:K,nodeLookup:_}=t(),I=Dc(A.sourceEvent,{transform:T,snapGrid:$,snapToGrid:D,containerBounds:p});if(b=A.sourceEvent,(A.sourceEvent.type==="touchmove"&&A.sourceEvent.touches.length>1||N&&!_.has(N))&&(h=!0),!h){if(!l&&V&&f&&(l=!0,M()),!f){const E=ci(A.sourceEvent,p),Y=E.x-u.x,G=E.y-u.y;Math.sqrt(Y*Y+G*G)>K&&U(A)}(s.x!==I.xSnapped||s.y!==I.ySnapped)&&c&&f&&(u=ci(A.sourceEvent,p),R(I))}}).on("end",A=>{if(!(!f||h)&&(l=!1,f=!1,cancelAnimationFrame(o),c.size>0)){const{nodeLookup:V,updateNodePositions:T,onNodeDragStop:$,onSelectionDragStop:D}=t();if(y&&(T(c,!1),y=!1),i||$||!N&&D){const[K,_]=Lm({nodeId:N,dragItems:c,nodeLookup:V,dragging:!1});i==null||i(A.sourceEvent,c,K,_),$==null||$(A.sourceEvent,K,_),N||D==null||D(A.sourceEvent,_)}}}).filter(A=>{const V=A.target;return!A.button&&(!v||!Pb(V,`.${v}`,S))&&(!w||Pb(V,w,S))});d.call(L)}function g(){d==null||d.on(".drag",null)}return{update:k,destroy:g}}function zD(e,t,n){const r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const s of t.values())hu(i,fl(s))>0&&r.push(s);return r}const BD=250;function HD(e,t,n,r){var c,l;let i=[],s=1/0;const o=zD(e,n,t+BD);for(const u of o){const p=[...((c=u.internals.handleBounds)==null?void 0:c.source)??[],...((l=u.internals.handleBounds)==null?void 0:l.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}=ea(u,f,f.position,!0),y=Math.sqrt(Math.pow(d-e.x,2)+Math.pow(h-e.y,2));y>t||(y<s?(i=[{...f,x:d,y:h}],s=y):y===s&&i.push({...f,x:d,y:h}))}}if(!i.length)return null;if(i.length>1){const u=r.type==="source"?"target":"source";return i.find(p=>p.type===u)??i[0]}return i[0]}function hE(e,t,n,r,i,s=!1){var u,p,f;const o=r.get(e);if(!o)return null;const c=i==="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)??[]],l=(n?c==null?void 0:c.find(d=>d.id===n):c==null?void 0:c[0])??null;return l&&s?{...l,...ea(o,l,l.position,!0)}:l}function mE(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function UD(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const gE=()=>!0;function VD(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:s,isTarget:o,domNode:c,nodeLookup:l,lib:u,autoPanOnConnect:p,flowId:f,panBy:d,cancelConnection:h,onConnectStart:y,onConnect:b,onConnectEnd:k,isValidConnection:g=gE,onReconnectEnd:v,updateConnection:w,getTransform:S,getFromHandle:C,autoPanSpeed:N,dragThreshold:P=1,handleDomNode:R}){const M=rE(e.target);let U=0,L;const{x:A,y:V}=ci(e),T=mE(s,R),$=c==null?void 0:c.getBoundingClientRect();let D=!1;if(!$||!T)return;const K=hE(i,T,r,l,t);if(!K)return;let _=ci(e,$),I=!1,E=null,Y=!1,G=null;function F(){if(!p||!$)return;const[de,me]=ZC(_,$,N);d({x:de,y:me}),U=requestAnimationFrame(F)}const Z={...K,nodeId:i,type:T,position:K.position},oe=l.get(i);let ce={inProgress:!0,isValid:null,from:ea(oe,Z,Re.Left,!0),fromHandle:Z,fromPosition:Z.position,fromNode:oe,to:_,toHandle:null,toPosition:yb[Z.position],toNode:null,pointer:_};function le(){D=!0,w(ce),y==null||y(e,{nodeId:i,handleId:r,handleType:T})}P===0&&le();function ve(de){if(!D){const{x:ht,y:yn}=ci(de),Yt=ht-A,at=yn-V;if(!(Yt*Yt+at*at>P*P))return;le()}if(!C()||!Z){ie(de);return}const me=S();_=ci(de,$),L=HD(zu(_,me,!1,[1,1]),n,l,Z),I||(F(),I=!0);const Se=yE(de,{handle:L,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?"target":"source",isValidConnection:g,doc:M,lib:u,flowId:f,nodeLookup:l});G=Se.handleDomNode,E=Se.connection,Y=UD(!!L,Se.isValid);const Ve=l.get(i),Fe=Ve?ea(Ve,Z,Re.Left,!0):ce.from,ze={...ce,from:Fe,isValid:Y,to:Se.toHandle&&Y?wp({x:Se.toHandle.x,y:Se.toHandle.y},me):_,toHandle:Se.toHandle,toPosition:Y&&Se.toHandle?Se.toHandle.position:yb[Z.position],toNode:Se.toHandle?l.get(Se.toHandle.nodeId):null,pointer:_};w(ze),ce=ze}function ie(de){if(!("touches"in de&&de.touches.length>0)){if(D){(L||G)&&E&&Y&&(b==null||b(E));const{inProgress:me,...Se}=ce,Ve={...Se,toPosition:ce.toHandle?ce.toPosition:null};k==null||k(de,Ve),s&&(v==null||v(de,Ve))}h(),cancelAnimationFrame(U),I=!1,Y=!1,E=null,G=null,M.removeEventListener("mousemove",ve),M.removeEventListener("mouseup",ie),M.removeEventListener("touchmove",ve),M.removeEventListener("touchend",ie)}}M.addEventListener("mousemove",ve),M.addEventListener("mouseup",ie),M.addEventListener("touchmove",ve),M.addEventListener("touchend",ie)}function yE(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:s,doc:o,lib:c,flowId:l,isValidConnection:u=gE,nodeLookup:p}){const f=s==="target",d=t?o.querySelector(`.${c}-flow__handle[data-id="${l}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:h,y}=ci(e),b=o.elementFromPoint(h,y),k=b!=null&&b.classList.contains(`${c}-flow__handle`)?b:d,g={handleDomNode:k,isValid:!1,connection:null,toHandle:null};if(k){const v=mE(void 0,k),w=k.getAttribute("data-nodeid"),S=k.getAttribute("data-handleid"),C=k.classList.contains("connectable"),N=k.classList.contains("connectableend");if(!w||!v)return g;const P={source:f?w:r,sourceHandle:f?S:i,target:f?r:w,targetHandle:f?i:S};g.connection=P;const M=C&&N&&(n===ul.Strict?f&&v==="source"||!f&&v==="target":w!==r||S!==i);g.isValid=M&&u(P),g.toHandle=hE(w,v,S,p,n,!0)}return g}const Ey={onPointerDown:VD,isValid:yE};function WD({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const i=Nr(e);function s({translateExtent:c,width:l,height:u,zoomStep:p=1,pannable:f=!0,zoomable:d=!0,inversePan:h=!1}){const y=w=>{if(w.sourceEvent.type!=="wheel"||!t)return;const S=n(),C=w.sourceEvent.ctrlKey&&mu()?10:1,N=-w.sourceEvent.deltaY*(w.sourceEvent.deltaMode===1?.05:w.sourceEvent.deltaMode?1:.002)*p,P=S[2]*Math.pow(2,N*C);t.scaleTo(P)};let b=[0,0];const k=w=>{(w.sourceEvent.type==="mousedown"||w.sourceEvent.type==="touchstart")&&(b=[w.sourceEvent.clientX??w.sourceEvent.touches[0].clientX,w.sourceEvent.clientY??w.sourceEvent.touches[0].clientY])},g=w=>{const S=n();if(w.sourceEvent.type!=="mousemove"&&w.sourceEvent.type!=="touchmove"||!t)return;const C=[w.sourceEvent.clientX??w.sourceEvent.touches[0].clientX,w.sourceEvent.clientY??w.sourceEvent.touches[0].clientY],N=[C[0]-b[0],C[1]-b[1]];b=C;const P=r()*Math.max(S[2],Math.log(S[2]))*(h?-1:1),R={x:S[0]-N[0]*P,y:S[1]-N[1]*P},M=[[0,0],[l,u]];t.setViewportConstrained({x:R.x,y:R.y,zoom:S[2]},M,c)},v=WC().on("start",k).on("zoom",f?g:null).on("zoom.wheel",d?y:null);i.call(v,{})}function o(){i.on("zoom",null)}return{update:s,destroy:o,pointer:ii}}const ch=e=>({x:e.x,y:e.y,zoom:e.k}),Om=({x:e,y:t,zoom:n})=>oh.translate(e,t).scale(n),Da=(e,t)=>e.target.closest(`.${t}`),xE=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),KD=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Mm=(e,t=0,n=KD,r=()=>{})=>{const i=typeof t=="number"&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on("end",r):e},wE=e=>{const t=e.ctrlKey&&mu()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function qD({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:s,zoomOnPinch:o,onPanZoomStart:c,onPanZoom:l,onPanZoomEnd:u}){return p=>{if(Da(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=ii(p),g=wE(p),v=f*Math.pow(2,g);r.scaleTo(n,v,k,p);return}const d=p.deltaMode===1?20:1;let h=i===Uo.Vertical?0:p.deltaX*d,y=i===Uo.Horizontal?0:p.deltaY*d;!mu()&&p.shiftKey&&i!==Uo.Vertical&&(h=p.deltaY*d,y=0),r.translateBy(n,-(h/f)*s,-(y/f)*s,{internal:!0});const b=ch(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(l==null||l(p,b),e.panScrollTimeout=setTimeout(()=>{u==null||u(p,b),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,c==null||c(p,b))}}function YD({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){const s=r.type==="wheel",o=!t&&s&&!r.ctrlKey,c=Da(r,e);if(r.ctrlKey&&s&&c&&r.preventDefault(),o||c)return null;r.preventDefault(),n.call(this,r,i)}}function GD({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var s,o,c;if((s=r.sourceEvent)!=null&&s.internal)return;const i=ch(r.transform);e.mouseButton=((o=r.sourceEvent)==null?void 0:o.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=i,((c=r.sourceEvent)==null?void 0:c.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,i))}}function XD({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return s=>{var o,c;e.usedRightMouseButton=!!(n&&xE(t,e.mouseButton??0)),(o=s.sourceEvent)!=null&&o.sync||r([s.transform.x,s.transform.y,s.transform.k]),i&&!((c=s.sourceEvent)!=null&&c.internal)&&(i==null||i(s.sourceEvent,ch(s.transform)))}}function JD({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:s}){return o=>{var c;if(!((c=o.sourceEvent)!=null&&c.internal)&&(e.isZoomingOrPanning=!1,s&&xE(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&s(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){const l=ch(o.transform);e.prevViewport=l,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i==null||i(o.sourceEvent,l)},n?150:0)}}}function QD({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:o,noWheelClassName:c,noPanClassName:l,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"&&(Da(f,`${u}-flow__node`)||Da(f,`${u}-flow__edge`)))return!0;if(!r&&!d&&!i&&!s&&!n||o||p&&!y||Da(f,c)&&y||Da(f,l)&&(!y||i&&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&&!i&&!h&&y||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const b=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||y)&&b}}function ZD({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:s,onPanZoomStart:o,onPanZoomEnd:c,onDraggingChange:l}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},p=e.getBoundingClientRect(),f=WC().scaleExtent([t,n]).translateExtent(r),d=Nr(e).call(f);v({x:i.x,y:i.y,zoom:dl(i.zoom,t,n)},[[0,0],[p.width,p.height]],r);const h=d.on("wheel.zoom"),y=d.on("dblclick.zoom");f.wheelDelta(wE);function b(L,A){return d?new Promise(V=>{f==null||f.interpolate((A==null?void 0:A.interpolate)==="linear"?$c:If).transform(Mm(d,A==null?void 0:A.duration,A==null?void 0:A.ease,()=>V(!0)),L)}):Promise.resolve(!1)}function k({noWheelClassName:L,noPanClassName:A,onPaneContextMenu:V,userSelectionActive:T,panOnScroll:$,panOnDrag:D,panOnScrollMode:K,panOnScrollSpeed:_,preventScrolling:I,zoomOnPinch:E,zoomOnScroll:Y,zoomOnDoubleClick:G,zoomActivationKeyPressed:F,lib:Z,onTransformChange:oe,connectionInProgress:ue,paneClickDistance:ce,selectionOnDrag:le}){T&&!u.isZoomingOrPanning&&g();const ve=$&&!F&&!T;f.clickDistance(le?1/0:!li(ce)||ce<0?0:ce);const ie=ve?qD({zoomPanValues:u,noWheelClassName:L,d3Selection:d,d3Zoom:f,panOnScrollMode:K,panOnScrollSpeed:_,zoomOnPinch:E,onPanZoomStart:o,onPanZoom:s,onPanZoomEnd:c}):YD({noWheelClassName:L,preventScrolling:I,d3ZoomHandler:h});if(d.on("wheel.zoom",ie,{passive:!1}),!T){const me=GD({zoomPanValues:u,onDraggingChange:l,onPanZoomStart:o});f.on("start",me);const Se=XD({zoomPanValues:u,panOnDrag:D,onPaneContextMenu:!!V,onPanZoom:s,onTransformChange:oe});f.on("zoom",Se);const Ve=JD({zoomPanValues:u,panOnDrag:D,panOnScroll:$,onPaneContextMenu:V,onPanZoomEnd:c,onDraggingChange:l});f.on("end",Ve)}const de=QD({zoomActivationKeyPressed:F,panOnDrag:D,zoomOnScroll:Y,panOnScroll:$,zoomOnDoubleClick:G,zoomOnPinch:E,userSelectionActive:T,noPanClassName:A,noWheelClassName:L,lib:Z,connectionInProgress:ue});f.filter(de),G?d.on("dblclick.zoom",y):d.on("dblclick.zoom",null)}function g(){f.on("zoom",null)}async function v(L,A,V){const T=Om(L),$=f==null?void 0:f.constrain()(T,A,V);return $&&await b($),new Promise(D=>D($))}async function w(L,A){const V=Om(L);return await b(V,A),new Promise(T=>T(V))}function S(L){if(d){const A=Om(L),V=d.property("__zoom");(V.k!==L.zoom||V.x!==L.x||V.y!==L.y)&&(f==null||f.transform(d,A,null,{sync:!0}))}}function C(){const L=d?VC(d.node()):{x:0,y:0,k:1};return{x:L.x,y:L.y,zoom:L.k}}function N(L,A){return d?new Promise(V=>{f==null||f.interpolate((A==null?void 0:A.interpolate)==="linear"?$c:If).scaleTo(Mm(d,A==null?void 0:A.duration,A==null?void 0:A.ease,()=>V(!0)),L)}):Promise.resolve(!1)}function P(L,A){return d?new Promise(V=>{f==null||f.interpolate((A==null?void 0:A.interpolate)==="linear"?$c:If).scaleBy(Mm(d,A==null?void 0:A.duration,A==null?void 0:A.ease,()=>V(!0)),L)}):Promise.resolve(!1)}function R(L){f==null||f.scaleExtent(L)}function M(L){f==null||f.translateExtent(L)}function U(L){const A=!li(L)||L<0?0:L;f==null||f.clickDistance(A)}return{update:k,destroy:g,setViewport:w,setViewportConstrained:v,getViewport:C,scaleTo:N,scaleBy:P,setScaleExtent:R,setTranslateExtent:M,syncViewport:S,setClickDistance:U}}var hl;(function(e){e.Line="line",e.Handle="handle"})(hl||(hl={}));function eF({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:s}){const o=e-t,c=n-r,l=[o>0?1:o<0?-1:0,c>0?1:c<0?-1:0];return o&&i&&(l[0]=l[0]*-1),c&&s&&(l[1]=l[1]*-1),l}function Ib(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),i=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:i}}function Ms(e,t){return Math.max(0,t-e)}function $s(e,t){return Math.max(0,e-t)}function Zd(e,t,n){return Math.max(0,t-e,e-n)}function Ab(e,t){return e?!t:t}function tF(e,t,n,r,i,s,o,c){let{affectsX:l,affectsY:u}=t;const{isHorizontal:p,isVertical:f}=t,d=p&&f,{xSnapped:h,ySnapped:y}=n,{minWidth:b,maxWidth:k,minHeight:g,maxHeight:v}=r,{x:w,y:S,width:C,height:N,aspectRatio:P}=e;let R=Math.floor(p?h-e.pointerX:0),M=Math.floor(f?y-e.pointerY:0);const U=C+(l?-R:R),L=N+(u?-M:M),A=-s[0]*C,V=-s[1]*N;let T=Zd(U,b,k),$=Zd(L,g,v);if(o){let _=0,I=0;l&&R<0?_=Ms(w+R+A,o[0][0]):!l&&R>0&&(_=$s(w+U+A,o[1][0])),u&&M<0?I=Ms(S+M+V,o[0][1]):!u&&M>0&&(I=$s(S+L+V,o[1][1])),T=Math.max(T,_),$=Math.max($,I)}if(c){let _=0,I=0;l&&R>0?_=$s(w+R,c[0][0]):!l&&R<0&&(_=Ms(w+U,c[1][0])),u&&M>0?I=$s(S+M,c[0][1]):!u&&M<0&&(I=Ms(S+L,c[1][1])),T=Math.max(T,_),$=Math.max($,I)}if(i){if(p){const _=Zd(U/P,g,v)*P;if(T=Math.max(T,_),o){let I=0;!l&&!u||l&&!u&&d?I=$s(S+V+U/P,o[1][1])*P:I=Ms(S+V+(l?R:-R)/P,o[0][1])*P,T=Math.max(T,I)}if(c){let I=0;!l&&!u||l&&!u&&d?I=Ms(S+U/P,c[1][1])*P:I=$s(S+(l?R:-R)/P,c[0][1])*P,T=Math.max(T,I)}}if(f){const _=Zd(L*P,b,k)/P;if($=Math.max($,_),o){let I=0;!l&&!u||u&&!l&&d?I=$s(w+L*P+A,o[1][0])/P:I=Ms(w+(u?M:-M)*P+A,o[0][0])/P,$=Math.max($,I)}if(c){let I=0;!l&&!u||u&&!l&&d?I=Ms(w+L*P,c[1][0])/P:I=$s(w+(u?M:-M)*P,c[0][0])/P,$=Math.max($,I)}}}M=M+(M<0?$:-$),R=R+(R<0?T:-T),i&&(d?U>L*P?M=(Ab(l,u)?-R:R)/P:R=(Ab(l,u)?-M:M)*P:p?(M=R/P,u=l):(R=M*P,l=u));const D=l?w+R:w,K=u?S+M:S;return{width:C+(l?-R:R),height:N+(u?-M:M),x:s[0]*R*(l?-1:1)+D,y:s[1]*M*(u?-1:1)+K}}const vE={width:0,height:0,x:0,y:0},nF={...vE,pointerX:0,pointerY:0,aspectRatio:1};function rF(e){return[[0,0],[e.measured.width,e.measured.height]]}function iF(e,t,n){const r=t.position.x+e.position.x,i=t.position.y+e.position.y,s=e.measured.width??0,o=e.measured.height??0,c=n[0]*s,l=n[1]*o;return[[r-c,i-l],[r+s-c,i+o-l]]}function sF({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){const s=Nr(e);let o={controlDirection:Ib("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function c({controlPosition:u,boundaries:p,keepAspectRatio:f,resizeDirection:d,onResizeStart:h,onResize:y,onResizeEnd:b,shouldResize:k}){let g={...vE},v={...nF};o={boundaries:p,resizeDirection:d,keepAspectRatio:f,controlDirection:Ib(u)};let w,S=null,C=[],N,P,R,M=!1;const U=IC().on("start",L=>{const{nodeLookup:A,transform:V,snapGrid:T,snapToGrid:$,nodeOrigin:D,paneDomNode:K}=n();if(w=A.get(t),!w)return;S=(K==null?void 0:K.getBoundingClientRect())??null;const{xSnapped:_,ySnapped:I}=Dc(L.sourceEvent,{transform:V,snapGrid:T,snapToGrid:$,containerBounds:S});g={width:w.measured.width??0,height:w.measured.height??0,x:w.position.x??0,y:w.position.y??0},v={...g,pointerX:_,pointerY:I,aspectRatio:g.width/g.height},N=void 0,w.parentId&&(w.extent==="parent"||w.expandParent)&&(N=A.get(w.parentId),P=N&&w.extent==="parent"?rF(N):void 0),C=[],R=void 0;for(const[E,Y]of A)if(Y.parentId===t&&(C.push({id:E,position:{...Y.position},extent:Y.extent}),Y.extent==="parent"||Y.expandParent)){const G=iF(Y,w,Y.origin??D);R?R=[[Math.min(G[0][0],R[0][0]),Math.min(G[0][1],R[0][1])],[Math.max(G[1][0],R[1][0]),Math.max(G[1][1],R[1][1])]]:R=G}h==null||h(L,{...g})}).on("drag",L=>{const{transform:A,snapGrid:V,snapToGrid:T,nodeOrigin:$}=n(),D=Dc(L.sourceEvent,{transform:A,snapGrid:V,snapToGrid:T,containerBounds:S}),K=[];if(!w)return;const{x:_,y:I,width:E,height:Y}=g,G={},F=w.origin??$,{width:Z,height:oe,x:ue,y:ce}=tF(v,o.controlDirection,D,o.boundaries,o.keepAspectRatio,F,P,R),le=Z!==E,ve=oe!==Y,ie=ue!==_&&le,de=ce!==I&&ve;if(!ie&&!de&&!le&&!ve)return;if((ie||de||F[0]===1||F[1]===1)&&(G.x=ie?ue:g.x,G.y=de?ce:g.y,g.x=G.x,g.y=G.y,C.length>0)){const Fe=ue-_,ze=ce-I;for(const ht of C)ht.position={x:ht.position.x-Fe+F[0]*(Z-E),y:ht.position.y-ze+F[1]*(oe-Y)},K.push(ht)}if((le||ve)&&(G.width=le&&(!o.resizeDirection||o.resizeDirection==="horizontal")?Z:g.width,G.height=ve&&(!o.resizeDirection||o.resizeDirection==="vertical")?oe:g.height,g.width=G.width,g.height=G.height),N&&w.expandParent){const Fe=F[0]*(G.width??0);G.x&&G.x<Fe&&(g.x=Fe,v.x=v.x-(G.x-Fe));const ze=F[1]*(G.height??0);G.y&&G.y<ze&&(g.y=ze,v.y=v.y-(G.y-ze))}const me=eF({width:g.width,prevWidth:E,height:g.height,prevHeight:Y,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),Se={...g,direction:me};(k==null?void 0:k(L,Se))!==!1&&(M=!0,y==null||y(L,Se),r(G,K))}).on("end",L=>{M&&(b==null||b(L,{...g}),i==null||i({...g}),M=!1)});s.call(U)}function l(){s.on(".drag",null)}return{update:c,destroy:l}}var bE={exports:{}},kE={},SE={exports:{}},NE={};/**
|
|
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 ml=m;function oF(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var aF=typeof Object.is=="function"?Object.is:oF,lF=ml.useState,cF=ml.useEffect,uF=ml.useLayoutEffect,dF=ml.useDebugValue;function fF(e,t){var n=t(),r=lF({inst:{value:n,getSnapshot:t}}),i=r[0].inst,s=r[1];return uF(function(){i.value=n,i.getSnapshot=t,$m(i)&&s({inst:i})},[e,n,t]),cF(function(){return $m(i)&&s({inst:i}),e(function(){$m(i)&&s({inst:i})})},[e]),dF(n),n}function $m(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!aF(e,n)}catch{return!0}}function pF(e,t){return t()}var hF=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?pF:fF;NE.useSyncExternalStore=ml.useSyncExternalStore!==void 0?ml.useSyncExternalStore:hF;SE.exports=NE;var jE=SE.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 uh=m,mF=jE;function gF(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var yF=typeof Object.is=="function"?Object.is:gF,xF=mF.useSyncExternalStore,wF=uh.useRef,vF=uh.useEffect,bF=uh.useMemo,kF=uh.useDebugValue;kE.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var s=wF(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=bF(function(){function l(h){if(!u){if(u=!0,p=h,h=r(h),i!==void 0&&o.hasValue){var y=o.value;if(i(y,h))return f=y}return f=h}if(y=f,yF(p,h))return y;var b=r(h);return i!==void 0&&i(y,b)?(p=h,y):(p=h,f=b)}var u=!1,p,f,d=n===void 0?null:n;return[function(){return l(t())},d===null?void 0:function(){return l(d())}]},[t,n,r,i]);var c=xF(e,s[0],s[1]);return vF(function(){o.hasValue=!0,o.value=c},[c]),kF(c),c};bE.exports=kE;var SF=bE.exports;const NF=mo(SF),jF={},Tb=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))}},i=()=>t,l={setState:r,getState:i,getInitialState:()=>u,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(jF?"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,i,l);return l},CF=e=>e?Tb(e):Tb,{useDebugValue:EF}=De,{useSyncExternalStoreWithSelector:_F}=NF,PF=e=>e;function CE(e,t=PF,n){const r=_F(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return EF(r),r}const Rb=(e,t)=>{const n=CF(e),r=(i,s=t)=>CE(n,i,s);return Object.assign(r,n),r},IF=(e,t)=>e?Rb(e,t):Rb;function Dt(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,i]of e)if(!Object.is(i,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const dh=m.createContext(null),AF=dh.Provider,EE=Hi.error001();function dt(e,t){const n=m.useContext(dh);if(n===null)throw new Error(EE);return CE(n,e,t)}function Ft(){const e=m.useContext(dh);if(e===null)throw new Error(EE);return m.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Lb={display:"none"},TF={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},_E="react-flow__node-desc",PE="react-flow__edge-desc",RF="react-flow__aria-live",LF=e=>e.ariaLiveMessage,OF=e=>e.ariaLabelConfig;function MF({rfId:e}){const t=dt(LF);return a.jsx("div",{id:`${RF}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:TF,children:t})}function $F({rfId:e,disableKeyboardA11y:t}){const n=dt(OF);return a.jsxs(a.Fragment,{children:[a.jsx("div",{id:`${_E}-${e}`,style:Lb,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),a.jsx("div",{id:`${PE}-${e}`,style:Lb,children:n["edge.a11yDescription.default"]}),!t&&a.jsx(MF,{rfId:e})]})}const gl=m.forwardRef(({position:e="top-left",children:t,className:n,style:r,...i},s)=>{const o=`${e}`.split("-");return a.jsx("div",{className:dn(["react-flow__panel",n,...o]),style:r,ref:s,...i,children:t})});gl.displayName="Panel";function DF({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:a.jsx(gl,{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 FF=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}},ef=e=>e.id;function zF(e,t){return Dt(e.selectedNodes.map(ef),t.selectedNodes.map(ef))&&Dt(e.selectedEdges.map(ef),t.selectedEdges.map(ef))}function BF({onSelectionChange:e}){const t=Ft(),{selectedNodes:n,selectedEdges:r}=dt(FF,zF);return m.useEffect(()=>{const i={nodes:n,edges:r};e==null||e(i),t.getState().onSelectionChangeHandlers.forEach(s=>s(i))},[n,r,e]),null}const HF=e=>!!e.onSelectionChangeHandlers;function UF({onSelectionChange:e}){const t=dt(HF);return e||t?a.jsx(BF,{onSelectionChange:e}):null}const _y=typeof window<"u"?m.useLayoutEffect:m.useEffect,IE=[0,0],VF={x:0,y:0,zoom:1},WF=["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"],Ob=[...WF,"rfId"],KF=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}),Mb={translateExtent:fu,nodeOrigin:IE,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function qF(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:s,setNodeExtent:o,reset:c,setDefaultNodesAndEdges:l}=dt(KF,Dt),u=Ft();_y(()=>(l(e.defaultNodes,e.defaultEdges),()=>{p.current=Mb,c()}),[]);const p=m.useRef(Mb);return _y(()=>{for(const f of Ob){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"?i(d):f==="translateExtent"?s(d):f==="nodeExtent"?o(d):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:xD(d)}):f==="fitView"?u.setState({fitViewQueued:d}):f==="fitViewOptions"?u.setState({fitViewOptions:d}):u.setState({[f]:d})))}p.current=e},Ob.map(f=>e[f])),null}function $b(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function YF(e){var r;const[t,n]=m.useState(e==="system"?null:e);return m.useEffect(()=>{if(e!=="system"){n(e);return}const i=$b(),s=()=>n(i!=null&&i.matches?"dark":"light");return s(),i==null||i.addEventListener("change",s),()=>{i==null||i.removeEventListener("change",s)}},[e]),t!==null?t:(r=$b())!=null&&r.matches?"dark":"light"}const Db=typeof document<"u"?document:null;function yu(e=null,t={target:Db,actInsideInputWithModifier:!0}){const[n,r]=m.useState(!1),i=m.useRef(!1),s=m.useRef(new Set([])),[o,c]=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 l=(t==null?void 0:t.target)??Db,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const p=h=>{var k,g;if(i.current=h.ctrlKey||h.metaKey||h.shiftKey||h.altKey,(!i.current||i.current&&!u)&&iE(h))return!1;const b=zb(h.code,c);if(s.current.add(h[b]),Fb(o,s.current,!1)){const v=((g=(k=h.composedPath)==null?void 0:k.call(h))==null?void 0:g[0])||h.target,w=(v==null?void 0:v.nodeName)==="BUTTON"||(v==null?void 0:v.nodeName)==="A";t.preventDefault!==!1&&(i.current||!w)&&h.preventDefault(),r(!0)}},f=h=>{const y=zb(h.code,c);Fb(o,s.current,!0)?(r(!1),s.current.clear()):s.current.delete(h[y]),h.key==="Meta"&&s.current.clear(),i.current=!1},d=()=>{s.current.clear(),r(!1)};return l==null||l.addEventListener("keydown",p),l==null||l.addEventListener("keyup",f),window.addEventListener("blur",d),window.addEventListener("contextmenu",d),()=>{l==null||l.removeEventListener("keydown",p),l==null||l.removeEventListener("keyup",f),window.removeEventListener("blur",d),window.removeEventListener("contextmenu",d)}}},[e,r]),n}function Fb(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(i=>t.has(i)))}function zb(e,t){return t.includes(e)?"code":"key"}const GF=()=>{const e=Ft();return m.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,i,s],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??s},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:i,minZoom:s,maxZoom:o,panZoom:c}=e.getState(),l=lw(t,r,i,s,o,(n==null?void 0:n.padding)??.1);return c?(await c.setViewport(l,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:i,snapToGrid:s,domNode:o}=e.getState();if(!o)return t;const{x:c,y:l}=o.getBoundingClientRect(),u={x:t.x-c,y:t.y-l},p=n.snapGrid??i,f=n.snapToGrid??s;return zu(u,r,f,p)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:i,y:s}=r.getBoundingClientRect(),o=wp(t,n);return{x:o.x+i,y:o.y+s}}}),[])};function AE(e,t){const n=[],r=new Map,i=[];for(const s of e)if(s.type==="add"){i.push(s);continue}else if(s.type==="remove"||s.type==="replace")r.set(s.id,[s]);else{const o=r.get(s.id);o?o.push(s):r.set(s.id,[s])}for(const s of t){const o=r.get(s.id);if(!o){n.push(s);continue}if(o[0].type==="remove")continue;if(o[0].type==="replace"){n.push({...o[0].item});continue}const c={...s};for(const l of o)XF(l,c);n.push(c)}return i.length&&i.forEach(s=>{s.index!==void 0?n.splice(s.index,0,{...s.item}):n.push({...s.item})}),n}function XF(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 mw(e,t){return AE(e,t)}function TE(e,t){return AE(e,t)}function Lo(e,t){return{id:e,type:"select",selected:t}}function Fa(e,t=new Set,n=!1){const r=[];for(const[i,s]of e){const o=t.has(i);!(s.selected===void 0&&!o)&&s.selected!==o&&(n&&(s.selected=o),r.push(Lo(s.id,o)))}return r}function Bb({items:e=[],lookup:t}){var i;const n=[],r=new Map(e.map(s=>[s.id,s]));for(const[s,o]of e.entries()){const c=t.get(o.id),l=((i=c==null?void 0:c.internals)==null?void 0:i.userNode)??c;l!==void 0&&l!==o&&n.push({id:o.id,item:o,type:"replace"}),l===void 0&&n.push({item:o,type:"add",index:s})}for(const[s]of t)r.get(s)===void 0&&n.push({id:s,type:"remove"});return n}function Hb(e){return{id:e.id,type:"remove"}}const Ub=e=>lD(e),JF=e=>XC(e);function RE(e){return m.forwardRef(e)}function Vb(e){const[t,n]=m.useState(BigInt(0)),[r]=m.useState(()=>QF(()=>n(i=>i+BigInt(1))));return _y(()=>{const i=r.get();i.length&&(e(i),r.reset())},[t]),r}function QF(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const LE=m.createContext(null);function ZF({children:e}){const t=Ft(),n=m.useCallback(c=>{const{nodes:l=[],setNodes:u,hasDefaultNodes:p,onNodesChange:f,nodeLookup:d,fitViewQueued:h,onNodesChangeMiddlewareMap:y}=t.getState();let b=l;for(const g of c)b=typeof g=="function"?g(b):g;let k=Bb({items:b,lookup:d});for(const g of y.values())k=g(k);p&&u(b),k.length>0?f==null||f(k):h&&window.requestAnimationFrame(()=>{const{fitViewQueued:g,nodes:v,setNodes:w}=t.getState();g&&w(v)})},[]),r=Vb(n),i=m.useCallback(c=>{const{edges:l=[],setEdges:u,hasDefaultEdges:p,onEdgesChange:f,edgeLookup:d}=t.getState();let h=l;for(const y of c)h=typeof y=="function"?y(h):y;p?u(h):f&&f(Bb({items:h,lookup:d}))},[]),s=Vb(i),o=m.useMemo(()=>({nodeQueue:r,edgeQueue:s}),[]);return a.jsx(LE.Provider,{value:o,children:e})}function e3(){const e=m.useContext(LE);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const t3=e=>!!e.panZoom;function sa(){const e=GF(),t=Ft(),n=e3(),r=dt(t3),i=m.useMemo(()=>{const s=f=>t.getState().nodeLookup.get(f),o=f=>{n.nodeQueue.push(f)},c=f=>{n.edgeQueue.push(f)},l=f=>{var g,v;const{nodeLookup:d,nodeOrigin:h}=t.getState(),y=Ub(f)?f:d.get(f.id),b=y.parentId?nE(y.position,y.measured,y.parentId,d,h):y.position,k={...y,position:b,width:((g=y.measured)==null?void 0:g.width)??y.width,height:((v=y.measured)==null?void 0:v.height)??y.height};return fl(k)},u=(f,d,h={replace:!1})=>{o(y=>y.map(b=>{if(b.id===f){const k=typeof d=="function"?d(b):d;return h.replace&&Ub(k)?k:{...b,...k}}return b}))},p=(f,d,h={replace:!1})=>{c(y=>y.map(b=>{if(b.id===f){const k=typeof d=="function"?d(b):d;return h.replace&&JF(k)?k:{...b,...k}}return b}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var d;return(d=s(f))==null?void 0:d.internals.userNode},getInternalNode:s,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(d=>({...d}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:o,setEdges:c,addNodes:f=>{const d=Array.isArray(f)?f:[f];n.nodeQueue.push(h=>[...h,...d])},addEdges:f=>{const d=Array.isArray(f)?f:[f];n.edgeQueue.push(h=>[...h,...d])},toObject:()=>{const{nodes:f=[],edges:d=[],transform:h}=t.getState(),[y,b,k]=h;return{nodes:f.map(g=>({...g})),edges:d.map(g=>({...g})),viewport:{x:y,y:b,zoom:k}}},deleteElements:async({nodes:f=[],edges:d=[]})=>{const{nodes:h,edges:y,onNodesDelete:b,onEdgesDelete:k,triggerNodeChanges:g,triggerEdgeChanges:v,onDelete:w,onBeforeDelete:S}=t.getState(),{nodes:C,edges:N}=await pD({nodesToRemove:f,edgesToRemove:d,nodes:h,edges:y,onBeforeDelete:S}),P=N.length>0,R=C.length>0;if(P){const M=N.map(Hb);k==null||k(N),v(M)}if(R){const M=C.map(Hb);b==null||b(C),g(M)}return(R||P)&&(w==null||w({nodes:C,edges:N})),{deletedNodes:C,deletedEdges:N}},getIntersectingNodes:(f,d=!0,h)=>{const y=wb(f),b=y?f:l(f),k=h!==void 0;return b?(h||t.getState().nodes).filter(g=>{const v=t.getState().nodeLookup.get(g.id);if(v&&!y&&(g.id===f.id||!v.internals.positionAbsolute))return!1;const w=fl(k?g:v),S=hu(w,b);return d&&S>0||S>=w.width*w.height||S>=b.width*b.height}):[]},isNodeIntersecting:(f,d,h=!0)=>{const b=wb(f)?f:l(f);if(!b)return!1;const k=hu(b,d);return h&&k>0||k>=d.width*d.height||k>=b.width*b.height},updateNode:u,updateNodeData:(f,d,h={replace:!1})=>{u(f,y=>{const b=typeof d=="function"?d(y):d;return h.replace?{...y,data:b}:{...y,data:{...y.data,...b}}},h)},updateEdge:p,updateEdgeData:(f,d,h={replace:!1})=>{p(f,y=>{const b=typeof d=="function"?d(y):d;return h.replace?{...y,data:b}:{...y,data:{...y.data,...b}}},h)},getNodesBounds:f=>{const{nodeLookup:d,nodeOrigin:h}=t.getState();return cD(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??yD();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:d}),n.nodeQueue.push(h=>[...h]),d.promise}}},[]);return m.useMemo(()=>({...i,...e,viewportInitialized:r}),[r])}const Wb=e=>e.selected,n3=typeof window<"u"?window:void 0;function r3({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=Ft(),{deleteElements:r}=sa(),i=yu(e,{actInsideInputWithModifier:!1}),s=yu(t,{target:n3});m.useEffect(()=>{if(i){const{edges:o,nodes:c}=n.getState();r({nodes:c.filter(Wb),edges:o.filter(Wb)}),n.setState({nodesSelectionActive:!1})}},[i]),m.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])}function i3(e){const t=Ft();m.useEffect(()=>{const n=()=>{var i,s,o,c;if(!e.current||!(((s=(i=e.current).checkVisibility)==null?void 0:s.call(i))??!0))return!1;const r=cw(e.current);(r.height===0||r.width===0)&&((c=(o=t.getState()).onError)==null||c.call(o,"004",Hi.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 fh={position:"absolute",width:"100%",height:"100%",top:0,left:0},s3=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function o3({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:s=Uo.Free,zoomOnDoubleClick:o=!0,panOnDrag:c=!0,defaultViewport:l,translateExtent:u,minZoom:p,maxZoom:f,zoomActivationKeyCode:d,preventScrolling:h=!0,children:y,noWheelClassName:b,noPanClassName:k,onViewportChange:g,isControlledViewport:v,paneClickDistance:w,selectionOnDrag:S}){const C=Ft(),N=m.useRef(null),{userSelectionActive:P,lib:R,connectionInProgress:M}=dt(s3,Dt),U=yu(d),L=m.useRef();i3(N);const A=m.useCallback(V=>{g==null||g({x:V[0],y:V[1],zoom:V[2]}),v||C.setState({transform:V})},[g,v]);return m.useEffect(()=>{if(N.current){L.current=ZD({domNode:N.current,minZoom:p,maxZoom:f,translateExtent:u,viewport:l,onDraggingChange:D=>C.setState(K=>K.paneDragging===D?K:{paneDragging:D}),onPanZoomStart:(D,K)=>{const{onViewportChangeStart:_,onMoveStart:I}=C.getState();I==null||I(D,K),_==null||_(K)},onPanZoom:(D,K)=>{const{onViewportChange:_,onMove:I}=C.getState();I==null||I(D,K),_==null||_(K)},onPanZoomEnd:(D,K)=>{const{onViewportChangeEnd:_,onMoveEnd:I}=C.getState();I==null||I(D,K),_==null||_(K)}});const{x:V,y:T,zoom:$}=L.current.getViewport();return C.setState({panZoom:L.current,transform:[V,T,$],domNode:N.current.closest(".react-flow")}),()=>{var D;(D=L.current)==null||D.destroy()}}},[]),m.useEffect(()=>{var V;(V=L.current)==null||V.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:s,zoomOnDoubleClick:o,panOnDrag:c,zoomActivationKeyPressed:U,preventScrolling:h,noPanClassName:k,userSelectionActive:P,noWheelClassName:b,lib:R,onTransformChange:A,connectionInProgress:M,selectionOnDrag:S,paneClickDistance:w})},[e,t,n,r,i,s,o,c,U,h,k,P,b,R,A,M,S,w]),a.jsx("div",{className:"react-flow__renderer",ref:N,style:fh,children:y})}const a3=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function l3(){const{userSelectionActive:e,userSelectionRect:t}=dt(a3,Dt);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 Dm=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},c3=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function u3({isSelecting:e,selectionKeyPressed:t,selectionMode:n=pu.Full,panOnDrag:r,paneClickDistance:i,selectionOnDrag:s,onSelectionStart:o,onSelectionEnd:c,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:p,onPaneMouseEnter:f,onPaneMouseMove:d,onPaneMouseLeave:h,children:y}){const b=Ft(),{userSelectionActive:k,elementsSelectable:g,dragging:v,connectionInProgress:w}=dt(c3,Dt),S=g&&(e||k),C=m.useRef(null),N=m.useRef(),P=m.useRef(new Set),R=m.useRef(new Set),M=m.useRef(!1),U=_=>{if(M.current||w){M.current=!1;return}l==null||l(_),b.getState().resetSelectedElements(),b.setState({nodesSelectionActive:!1})},L=_=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){_.preventDefault();return}u==null||u(_)},A=p?_=>p(_):void 0,V=_=>{M.current&&(_.stopPropagation(),M.current=!1)},T=_=>{var oe,ue;const{domNode:I}=b.getState();if(N.current=I==null?void 0:I.getBoundingClientRect(),!N.current)return;const E=_.target===C.current;if(!E&&!!_.target.closest(".nokey")||!e||!(s&&E||t)||_.button!==0||!_.isPrimary)return;(ue=(oe=_.target)==null?void 0:oe.setPointerCapture)==null||ue.call(oe,_.pointerId),M.current=!1;const{x:F,y:Z}=ci(_.nativeEvent,N.current);b.setState({userSelectionRect:{width:0,height:0,startX:F,startY:Z,x:F,y:Z}}),E||(_.stopPropagation(),_.preventDefault())},$=_=>{const{userSelectionRect:I,transform:E,nodeLookup:Y,edgeLookup:G,connectionLookup:F,triggerNodeChanges:Z,triggerEdgeChanges:oe,defaultEdgeOptions:ue,resetSelectedElements:ce}=b.getState();if(!N.current||!I)return;const{x:le,y:ve}=ci(_.nativeEvent,N.current),{startX:ie,startY:de}=I;if(!M.current){const ze=t?0:i;if(Math.hypot(le-ie,ve-de)<=ze)return;ce(),o==null||o(_)}M.current=!0;const me={startX:ie,startY:de,x:le<ie?le:ie,y:ve<de?ve:de,width:Math.abs(le-ie),height:Math.abs(ve-de)},Se=P.current,Ve=R.current;P.current=new Set(aw(Y,me,E,n===pu.Partial,!0).map(ze=>ze.id)),R.current=new Set;const Fe=(ue==null?void 0:ue.selectable)??!0;for(const ze of P.current){const ht=F.get(ze);if(ht)for(const{edgeId:yn}of ht.values()){const Yt=G.get(yn);Yt&&(Yt.selectable??Fe)&&R.current.add(yn)}}if(!vb(Se,P.current)){const ze=Fa(Y,P.current,!0);Z(ze)}if(!vb(Ve,R.current)){const ze=Fa(G,R.current);oe(ze)}b.setState({userSelectionRect:me,userSelectionActive:!0,nodesSelectionActive:!1})},D=_=>{var I,E;_.button===0&&((E=(I=_.target)==null?void 0:I.releasePointerCapture)==null||E.call(I,_.pointerId),!k&&_.target===C.current&&b.getState().userSelectionRect&&(U==null||U(_)),b.setState({userSelectionActive:!1,userSelectionRect:null}),M.current&&(c==null||c(_),b.setState({nodesSelectionActive:P.current.size>0})))},K=r===!0||Array.isArray(r)&&r.includes(0);return a.jsxs("div",{className:dn(["react-flow__pane",{draggable:K,dragging:v,selection:e}]),onClick:S?void 0:Dm(U,C),onContextMenu:Dm(L,C),onWheel:Dm(A,C),onPointerEnter:S?void 0:f,onPointerMove:S?$:d,onPointerUp:S?D:void 0,onPointerDownCapture:S?T:void 0,onClickCapture:S?V:void 0,onPointerLeave:h,ref:C,style:fh,children:[y,a.jsx(l3,{})]})}function Py({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:i,unselectNodesAndEdges:s,multiSelectionActive:o,nodeLookup:c,onError:l}=t.getState(),u=c.get(e);if(!u){l==null||l("012",Hi.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&o)&&(s({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var p;return(p=r==null?void 0:r.current)==null?void 0:p.blur()})):i([e])}function OE({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:s,nodeClickDistance:o}){const c=Ft(),[l,u]=m.useState(!1),p=m.useRef();return m.useEffect(()=>{p.current=FD({getStoreItems:()=>c.getState(),onNodeMouseDown:f=>{Py({id:f,store:c,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:s,nodeId:i,nodeClickDistance:o}),()=>{var f;(f=p.current)==null||f.destroy()}},[n,r,t,s,e,i,o]),l}const d3=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function ME(){const e=Ft();return m.useCallback(n=>{const{nodeExtent:r,snapToGrid:i,snapGrid:s,nodesDraggable:o,onError:c,updateNodePositions:l,nodeLookup:u,nodeOrigin:p}=e.getState(),f=new Map,d=d3(o),h=i?s[0]:5,y=i?s[1]:5,b=n.direction.x*h*n.factor,k=n.direction.y*y*n.factor;for(const[,g]of u){if(!d(g))continue;let v={x:g.internals.positionAbsolute.x+b,y:g.internals.positionAbsolute.y+k};i&&(v=Fu(v,s));const{position:w,positionAbsolute:S}=JC({nodeId:g.id,nextPosition:v,nodeLookup:u,nodeExtent:r,nodeOrigin:p,onError:c});g.position=w,g.internals.positionAbsolute=S,f.set(g.id,g)}l(f)},[])}const gw=m.createContext(null),f3=gw.Provider;gw.Consumer;const $E=()=>m.useContext(gw),p3=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),h3=(e,t,n)=>r=>{const{connectionClickStartHandle:i,connectionMode:s,connection:o}=r,{fromHandle:c,toHandle:l,isValid:u}=o,p=(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===t&&(l==null?void 0:l.type)===n;return{connectingFrom:(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n,connectingTo:p,clickConnecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.id)===t&&(i==null?void 0:i.type)===n,isPossibleEndHandle:s===ul.Strict?(c==null?void 0:c.type)!==n:e!==(c==null?void 0:c.nodeId)||t!==(c==null?void 0:c.id),connectionInProcess:!!c,clickConnectionInProcess:!!i,valid:p&&u}};function m3({type:e="source",position:t=Re.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:s=!0,id:o,onConnect:c,children:l,className:u,onMouseDown:p,onTouchStart:f,...d},h){var $,D;const y=o||null,b=e==="target",k=Ft(),g=$E(),{connectOnClick:v,noPanClassName:w,rfId:S}=dt(p3,Dt),{connectingFrom:C,connectingTo:N,clickConnecting:P,isPossibleEndHandle:R,connectionInProcess:M,clickConnectionInProcess:U,valid:L}=dt(h3(g,y,e),Dt);g||(D=($=k.getState()).onError)==null||D.call($,"010",Hi.error010());const A=K=>{const{defaultEdgeOptions:_,onConnect:I,hasDefaultEdges:E}=k.getState(),Y={..._,...K};if(E){const{edges:G,setEdges:F}=k.getState();F(gu(Y,G))}I==null||I(Y),c==null||c(Y)},V=K=>{if(!g)return;const _=sE(K.nativeEvent);if(i&&(_&&K.button===0||!_)){const I=k.getState();Ey.onPointerDown(K.nativeEvent,{handleDomNode:K.currentTarget,autoPanOnConnect:I.autoPanOnConnect,connectionMode:I.connectionMode,connectionRadius:I.connectionRadius,domNode:I.domNode,nodeLookup:I.nodeLookup,lib:I.lib,isTarget:b,handleId:y,nodeId:g,flowId:I.rfId,panBy:I.panBy,cancelConnection:I.cancelConnection,onConnectStart:I.onConnectStart,onConnectEnd:(...E)=>{var Y,G;return(G=(Y=k.getState()).onConnectEnd)==null?void 0:G.call(Y,...E)},updateConnection:I.updateConnection,onConnect:A,isValidConnection:n||((...E)=>{var Y,G;return((G=(Y=k.getState()).isValidConnection)==null?void 0:G.call(Y,...E))??!0}),getTransform:()=>k.getState().transform,getFromHandle:()=>k.getState().connection.fromHandle,autoPanSpeed:I.autoPanSpeed,dragThreshold:I.connectionDragThreshold})}_?p==null||p(K):f==null||f(K)},T=K=>{const{onClickConnectStart:_,onClickConnectEnd:I,connectionClickStartHandle:E,connectionMode:Y,isValidConnection:G,lib:F,rfId:Z,nodeLookup:oe,connection:ue}=k.getState();if(!g||!E&&!i)return;if(!E){_==null||_(K.nativeEvent,{nodeId:g,handleId:y,handleType:e}),k.setState({connectionClickStartHandle:{nodeId:g,type:e,id:y}});return}const ce=rE(K.target),le=n||G,{connection:ve,isValid:ie}=Ey.isValid(K.nativeEvent,{handle:{nodeId:g,id:y,type:e},connectionMode:Y,fromNodeId:E.nodeId,fromHandleId:E.id||null,fromType:E.type,isValidConnection:le,flowId:Z,doc:ce,lib:F,nodeLookup:oe});ie&&ve&&A(ve);const de=structuredClone(ue);delete de.inProgress,de.toPosition=de.toHandle?de.toHandle.position:null,I==null||I(K,de),k.setState({connectionClickStartHandle:null})};return a.jsx("div",{"data-handleid":y,"data-nodeid":g,"data-handlepos":t,"data-id":`${S}-${g}-${y}-${e}`,className:dn(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",w,u,{source:!b,target:b,connectable:r,connectablestart:i,connectableend:s,clickconnecting:P,connectingfrom:C,connectingto:N,valid:L,connectionindicator:r&&(!M||R)&&(M||U?s:i)}]),onMouseDown:V,onTouchStart:V,onClick:v?T:void 0,ref:h,...d,children:l})}const pi=m.memo(RE(m3));function g3({data:e,isConnectable:t,sourcePosition:n=Re.Bottom}){return a.jsxs(a.Fragment,{children:[e==null?void 0:e.label,a.jsx(pi,{type:"source",position:n,isConnectable:t})]})}function y3({data:e,isConnectable:t,targetPosition:n=Re.Top,sourcePosition:r=Re.Bottom}){return a.jsxs(a.Fragment,{children:[a.jsx(pi,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,a.jsx(pi,{type:"source",position:r,isConnectable:t})]})}function x3(){return null}function w3({data:e,isConnectable:t,targetPosition:n=Re.Top}){return a.jsxs(a.Fragment,{children:[a.jsx(pi,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const vp={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Kb={input:g3,default:y3,output:w3,group:x3};function v3(e){var t,n,r,i;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((i=e.style)==null?void 0:i.height)}}const b3=e=>{const{width:t,height:n,x:r,y:i}=Du(e.nodeLookup,{filter:s=>!!s.selected});return{width:li(t)?t:null,height:li(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function k3({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Ft(),{width:i,height:s,transformString:o,userSelectionActive:c}=dt(b3,Dt),l=ME(),u=m.useRef(null);m.useEffect(()=>{var h;n||(h=u.current)==null||h.focus({preventScroll:!0})},[n]);const p=!c&&i!==null&&s!==null;if(OE({nodeRef:u,disabled:!p}),!p)return null;const f=e?h=>{const y=r.getState().nodes.filter(b=>b.selected);e(h,y)}:void 0,d=h=>{Object.prototype.hasOwnProperty.call(vp,h.key)&&(h.preventDefault(),l({direction:vp[h.key],factor:h.shiftKey?4:1}))};return a.jsx("div",{className:dn(["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:i,height:s}})})}const qb=typeof window<"u"?window:void 0,S3=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function DE({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:s,onPaneScroll:o,paneClickDistance:c,deleteKeyCode:l,selectionKeyCode:u,selectionOnDrag:p,selectionMode:f,onSelectionStart:d,onSelectionEnd:h,multiSelectionKeyCode:y,panActivationKeyCode:b,zoomActivationKeyCode:k,elementsSelectable:g,zoomOnScroll:v,zoomOnPinch:w,panOnScroll:S,panOnScrollSpeed:C,panOnScrollMode:N,zoomOnDoubleClick:P,panOnDrag:R,defaultViewport:M,translateExtent:U,minZoom:L,maxZoom:A,preventScrolling:V,onSelectionContextMenu:T,noWheelClassName:$,noPanClassName:D,disableKeyboardA11y:K,onViewportChange:_,isControlledViewport:I}){const{nodesSelectionActive:E,userSelectionActive:Y}=dt(S3,Dt),G=yu(u,{target:qb}),F=yu(b,{target:qb}),Z=F||R,oe=F||S,ue=p&&Z!==!0,ce=G||Y||ue;return r3({deleteKeyCode:l,multiSelectionKeyCode:y}),a.jsx(o3,{onPaneContextMenu:s,elementsSelectable:g,zoomOnScroll:v,zoomOnPinch:w,panOnScroll:oe,panOnScrollSpeed:C,panOnScrollMode:N,zoomOnDoubleClick:P,panOnDrag:!G&&Z,defaultViewport:M,translateExtent:U,minZoom:L,maxZoom:A,zoomActivationKeyCode:k,preventScrolling:V,noWheelClassName:$,noPanClassName:D,onViewportChange:_,isControlledViewport:I,paneClickDistance:c,selectionOnDrag:ue,children:a.jsxs(u3,{onSelectionStart:d,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:s,onPaneScroll:o,panOnDrag:Z,isSelecting:!!ce,selectionMode:f,selectionKeyPressed:G,paneClickDistance:c,selectionOnDrag:ue,children:[e,E&&a.jsx(k3,{onSelectionContextMenu:T,noPanClassName:D,disableKeyboardA11y:K})]})})}DE.displayName="FlowRenderer";const N3=m.memo(DE),j3=e=>t=>e?aw(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 C3(e){return dt(m.useCallback(j3(e),[e]),Dt)}const E3=e=>e.updateNodeInternals;function _3(){const e=dt(E3),[t]=m.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(i=>{const s=i.target.getAttribute("data-id");r.set(s,{id:s,nodeElement:i.target,force:!0})}),e(r)}));return m.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function P3({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const i=Ft(),s=m.useRef(null),o=m.useRef(null),c=m.useRef(e.sourcePosition),l=m.useRef(e.targetPosition),u=m.useRef(t),p=n&&!!e.internals.handleBounds;return m.useEffect(()=>{s.current&&!e.hidden&&(!p||o.current!==s.current)&&(o.current&&(r==null||r.unobserve(o.current)),r==null||r.observe(s.current),o.current=s.current)},[p,e.hidden]),m.useEffect(()=>()=>{o.current&&(r==null||r.unobserve(o.current),o.current=null)},[]),m.useEffect(()=>{if(s.current){const f=u.current!==t,d=c.current!==e.sourcePosition,h=l.current!==e.targetPosition;(f||d||h)&&(u.current=t,c.current=e.sourcePosition,l.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:s.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),s}function I3({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:s,onDoubleClick:o,nodesDraggable:c,elementsSelectable:l,nodesConnectable:u,nodesFocusable:p,resizeObserver:f,noDragClassName:d,noPanClassName:h,disableKeyboardA11y:y,rfId:b,nodeTypes:k,nodeClickDistance:g,onError:v}){const{node:w,internals:S,isParent:C}=dt(le=>{const ve=le.nodeLookup.get(e),ie=le.parentLookup.has(e);return{node:ve,internals:ve.internals,isParent:ie}},Dt);let N=w.type||"default",P=(k==null?void 0:k[N])||Kb[N];P===void 0&&(v==null||v("003",Hi.error003(N)),N="default",P=(k==null?void 0:k.default)||Kb.default);const R=!!(w.draggable||c&&typeof w.draggable>"u"),M=!!(w.selectable||l&&typeof w.selectable>"u"),U=!!(w.connectable||u&&typeof w.connectable>"u"),L=!!(w.focusable||p&&typeof w.focusable>"u"),A=Ft(),V=tE(w),T=P3({node:w,nodeType:N,hasDimensions:V,resizeObserver:f}),$=OE({nodeRef:T,disabled:w.hidden||!R,noDragClassName:d,handleSelector:w.dragHandle,nodeId:e,isSelectable:M,nodeClickDistance:g}),D=ME();if(w.hidden)return null;const K=gs(w),_=v3(w),I=M||R||t||n||r||i,E=n?le=>n(le,{...S.userNode}):void 0,Y=r?le=>r(le,{...S.userNode}):void 0,G=i?le=>i(le,{...S.userNode}):void 0,F=s?le=>s(le,{...S.userNode}):void 0,Z=o?le=>o(le,{...S.userNode}):void 0,oe=le=>{const{selectNodesOnDrag:ve,nodeDragThreshold:ie}=A.getState();M&&(!ve||!R||ie>0)&&Py({id:e,store:A,nodeRef:T}),t&&t(le,{...S.userNode})},ue=le=>{if(!(iE(le.nativeEvent)||y)){if(KC.includes(le.key)&&M){const ve=le.key==="Escape";Py({id:e,store:A,unselect:ve,nodeRef:T})}else if(R&&w.selected&&Object.prototype.hasOwnProperty.call(vp,le.key)){le.preventDefault();const{ariaLabelConfig:ve}=A.getState();A.setState({ariaLiveMessage:ve["node.a11yDescription.ariaLiveMessage"]({direction:le.key.replace("Arrow","").toLowerCase(),x:~~S.positionAbsolute.x,y:~~S.positionAbsolute.y})}),D({direction:vp[le.key],factor:le.shiftKey?4:1})}}},ce=()=>{var Ve;if(y||!((Ve=T.current)!=null&&Ve.matches(":focus-visible")))return;const{transform:le,width:ve,height:ie,autoPanOnNodeFocus:de,setCenter:me}=A.getState();if(!de)return;aw(new Map([[e,w]]),{x:0,y:0,width:ve,height:ie},le,!0).length>0||me(w.position.x+K.width/2,w.position.y+K.height/2,{zoom:le[2]})};return a.jsx("div",{className:dn(["react-flow__node",`react-flow__node-${N}`,{[h]:R},w.className,{selected:w.selected,selectable:M,parent:C,draggable:R,dragging:$}]),ref:T,style:{zIndex:S.z,transform:`translate(${S.positionAbsolute.x}px,${S.positionAbsolute.y}px)`,pointerEvents:I?"all":"none",visibility:V?"visible":"hidden",...w.style,..._},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:E,onMouseMove:Y,onMouseLeave:G,onContextMenu:F,onClick:oe,onDoubleClick:Z,onKeyDown:L?ue:void 0,tabIndex:L?0:void 0,onFocus:L?ce:void 0,role:w.ariaRole??(L?"group":void 0),"aria-roledescription":"node","aria-describedby":y?void 0:`${_E}-${b}`,"aria-label":w.ariaLabel,...w.domAttributes,children:a.jsx(f3,{value:e,children:a.jsx(P,{id:e,data:w.data,type:N,positionAbsoluteX:S.positionAbsolute.x,positionAbsoluteY:S.positionAbsolute.y,selected:w.selected??!1,selectable:M,draggable:R,deletable:w.deletable??!0,isConnectable:U,sourcePosition:w.sourcePosition,targetPosition:w.targetPosition,dragging:$,dragHandle:w.dragHandle,zIndex:S.z,parentId:w.parentId,...K})})})}var A3=m.memo(I3);const T3=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function FE(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,onError:s}=dt(T3,Dt),o=C3(e.onlyRenderVisibleElements),c=_3();return a.jsx("div",{className:"react-flow__nodes",style:fh,children:o.map(l=>a.jsx(A3,{id:l,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:c,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,nodeClickDistance:e.nodeClickDistance,onError:s},l))})}FE.displayName="NodeRenderer";const R3=m.memo(FE);function L3(e){return dt(m.useCallback(n=>{if(!e)return n.edges.map(i=>i.id);const r=[];if(n.width&&n.height)for(const i of n.edges){const s=n.nodeLookup.get(i.source),o=n.nodeLookup.get(i.target);s&&o&&bD({sourceNode:s,targetNode:o,width:n.width,height:n.height,transform:n.transform})&&r.push(i.id)}return r},[e]),Dt)}const O3=({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"})},M3=({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"})},Yb={[_r.Arrow]:O3,[_r.ArrowClosed]:M3};function $3(e){const t=Ft();return m.useMemo(()=>{var i,s;return Object.prototype.hasOwnProperty.call(Yb,e)?Yb[e]:((s=(i=t.getState()).onError)==null||s.call(i,"009",Hi.error009(e)),null)},[e])}const D3=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:s="strokeWidth",strokeWidth:o,orient:c="auto-start-reverse"})=>{const l=$3(t);return l?a.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:c,refX:"0",refY:"0",children:a.jsx(l,{color:n,strokeWidth:o})}):null},zE=({defaultColor:e,rfId:t})=>{const n=dt(s=>s.edges),r=dt(s=>s.defaultEdgeOptions),i=m.useMemo(()=>_D(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return i.length?a.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:a.jsx("defs",{children:i.map(s=>a.jsx(D3,{id:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient},s.id))})}):null};zE.displayName="MarkerDefinitions";var F3=m.memo(zE);function BE({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:s,labelBgPadding:o=[2,4],labelBgBorderRadius:c=2,children:l,className:u,...p}){const[f,d]=m.useState({x:1,y:0,width:0,height:0}),h=dn(["react-flow__edge-textwrapper",u]),y=m.useRef(null);return m.useEffect(()=>{if(y.current){const b=y.current.getBBox();d({x:b.x,y:b.y,width:b.width,height:b.height})}},[n]),n?a.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:h,visibility:f.width?"visible":"hidden",...p,children:[i&&a.jsx("rect",{width:f.width+2*o[0],x:-o[0],y:-o[1],height:f.height+2*o[1],className:"react-flow__edge-textbg",style:s,rx:c,ry:c}),a.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:y,style:r,children:n}),l]}):null}BE.displayName="EdgeText";const z3=m.memo(BE);function ph({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:s,labelBgStyle:o,labelBgPadding:c,labelBgBorderRadius:l,interactionWidth:u=20,...p}){return a.jsxs(a.Fragment,{children:[a.jsx("path",{...p,d:e,fill:"none",className:dn(["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&&li(t)&&li(n)?a.jsx(z3,{x:t,y:n,label:r,labelStyle:i,labelShowBg:s,labelBgStyle:o,labelBgPadding:c,labelBgBorderRadius:l}):null]})}function Gb({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===Re.Left||e===Re.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function HE({sourceX:e,sourceY:t,sourcePosition:n=Re.Bottom,targetX:r,targetY:i,targetPosition:s=Re.Top}){const[o,c]=Gb({pos:n,x1:e,y1:t,x2:r,y2:i}),[l,u]=Gb({pos:s,x1:r,y1:i,x2:e,y2:t}),[p,f,d,h]=oE({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${o},${c} ${l},${u} ${r},${i}`,p,f,d,h]}function UE(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,sourcePosition:o,targetPosition:c,label:l,labelStyle:u,labelShowBg:p,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:h,style:y,markerEnd:b,markerStart:k,interactionWidth:g})=>{const[v,w,S]=HE({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:s,targetPosition:c}),C=e.isInternal?void 0:t;return a.jsx(ph,{id:C,path:v,labelX:w,labelY:S,label:l,labelStyle:u,labelShowBg:p,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:h,style:y,markerEnd:b,markerStart:k,interactionWidth:g})})}const B3=UE({isInternal:!1}),VE=UE({isInternal:!0});B3.displayName="SimpleBezierEdge";VE.displayName="SimpleBezierEdgeInternal";function WE(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,label:o,labelStyle:c,labelShowBg:l,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:f,style:d,sourcePosition:h=Re.Bottom,targetPosition:y=Re.Top,markerEnd:b,markerStart:k,pathOptions:g,interactionWidth:v})=>{const[w,S,C]=Ny({sourceX:n,sourceY:r,sourcePosition:h,targetX:i,targetY:s,targetPosition:y,borderRadius:g==null?void 0:g.borderRadius,offset:g==null?void 0:g.offset,stepPosition:g==null?void 0:g.stepPosition}),N=e.isInternal?void 0:t;return a.jsx(ph,{id:N,path:w,labelX:S,labelY:C,label:o,labelStyle:c,labelShowBg:l,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:f,style:d,markerEnd:b,markerStart:k,interactionWidth:v})})}const KE=WE({isInternal:!1}),qE=WE({isInternal:!0});KE.displayName="SmoothStepEdge";qE.displayName="SmoothStepEdgeInternal";function YE(e){return m.memo(({id:t,...n})=>{var i;const r=e.isInternal?void 0:t;return a.jsx(KE,{...n,id:r,pathOptions:m.useMemo(()=>{var s;return{borderRadius:0,offset:(s=n.pathOptions)==null?void 0:s.offset}},[(i=n.pathOptions)==null?void 0:i.offset])})})}const H3=YE({isInternal:!1}),GE=YE({isInternal:!0});H3.displayName="StepEdge";GE.displayName="StepEdgeInternal";function XE(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,label:o,labelStyle:c,labelShowBg:l,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:y,interactionWidth:b})=>{const[k,g,v]=cE({sourceX:n,sourceY:r,targetX:i,targetY:s}),w=e.isInternal?void 0:t;return a.jsx(ph,{id:w,path:k,labelX:g,labelY:v,label:o,labelStyle:c,labelShowBg:l,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:y,interactionWidth:b})})}const U3=XE({isInternal:!1}),JE=XE({isInternal:!0});U3.displayName="StraightEdge";JE.displayName="StraightEdgeInternal";function QE(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,sourcePosition:o=Re.Bottom,targetPosition:c=Re.Top,label:l,labelStyle:u,labelShowBg:p,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:h,style:y,markerEnd:b,markerStart:k,pathOptions:g,interactionWidth:v})=>{const[w,S,C]=aE({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:s,targetPosition:c,curvature:g==null?void 0:g.curvature}),N=e.isInternal?void 0:t;return a.jsx(ph,{id:N,path:w,labelX:S,labelY:C,label:l,labelStyle:u,labelShowBg:p,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:h,style:y,markerEnd:b,markerStart:k,interactionWidth:v})})}const V3=QE({isInternal:!1}),ZE=QE({isInternal:!0});V3.displayName="BezierEdge";ZE.displayName="BezierEdgeInternal";const Xb={default:ZE,straight:JE,step:GE,smoothstep:qE,simplebezier:VE},Jb={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},W3=(e,t,n)=>n===Re.Left?e-t:n===Re.Right?e+t:e,K3=(e,t,n)=>n===Re.Top?e-t:n===Re.Bottom?e+t:e,Qb="react-flow__edgeupdater";function Zb({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:s,onMouseOut:o,type:c}){return a.jsx("circle",{onMouseDown:i,onMouseEnter:s,onMouseOut:o,className:dn([Qb,`${Qb}-${c}`]),cx:W3(t,r,e),cy:K3(n,r,e),r,stroke:"transparent",fill:"transparent"})}function q3({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:s,targetY:o,sourcePosition:c,targetPosition:l,onReconnect:u,onReconnectStart:p,onReconnectEnd:f,setReconnecting:d,setUpdateHover:h}){const y=Ft(),b=(S,C)=>{if(S.button!==0)return;const{autoPanOnConnect:N,domNode:P,connectionMode:R,connectionRadius:M,lib:U,onConnectStart:L,cancelConnection:A,nodeLookup:V,rfId:T,panBy:$,updateConnection:D}=y.getState(),K=C.type==="target",_=(Y,G)=>{d(!1),f==null||f(Y,n,C.type,G)},I=Y=>u==null?void 0:u(n,Y),E=(Y,G)=>{d(!0),p==null||p(S,n,C.type),L==null||L(Y,G)};Ey.onPointerDown(S.nativeEvent,{autoPanOnConnect:N,connectionMode:R,connectionRadius:M,domNode:P,handleId:C.id,nodeId:C.nodeId,nodeLookup:V,isTarget:K,edgeUpdaterType:C.type,lib:U,flowId:T,cancelConnection:A,panBy:$,isValidConnection:(...Y)=>{var G,F;return((F=(G=y.getState()).isValidConnection)==null?void 0:F.call(G,...Y))??!0},onConnect:I,onConnectStart:E,onConnectEnd:(...Y)=>{var G,F;return(F=(G=y.getState()).onConnectEnd)==null?void 0:F.call(G,...Y)},onReconnectEnd:_,updateConnection:D,getTransform:()=>y.getState().transform,getFromHandle:()=>y.getState().connection.fromHandle,dragThreshold:y.getState().connectionDragThreshold,handleDomNode:S.currentTarget})},k=S=>b(S,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),g=S=>b(S,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),v=()=>h(!0),w=()=>h(!1);return a.jsxs(a.Fragment,{children:[(e===!0||e==="source")&&a.jsx(Zb,{position:c,centerX:r,centerY:i,radius:t,onMouseDown:k,onMouseEnter:v,onMouseOut:w,type:"source"}),(e===!0||e==="target")&&a.jsx(Zb,{position:l,centerX:s,centerY:o,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:w,type:"target"})]})}function Y3({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:s,onContextMenu:o,onMouseEnter:c,onMouseMove:l,onMouseLeave:u,reconnectRadius:p,onReconnect:f,onReconnectStart:d,onReconnectEnd:h,rfId:y,edgeTypes:b,noPanClassName:k,onError:g,disableKeyboardA11y:v}){let w=dt(me=>me.edgeLookup.get(e));const S=dt(me=>me.defaultEdgeOptions);w=S?{...S,...w}:w;let C=w.type||"default",N=(b==null?void 0:b[C])||Xb[C];N===void 0&&(g==null||g("011",Hi.error011(C)),C="default",N=(b==null?void 0:b.default)||Xb.default);const P=!!(w.focusable||t&&typeof w.focusable>"u"),R=typeof f<"u"&&(w.reconnectable||n&&typeof w.reconnectable>"u"),M=!!(w.selectable||r&&typeof w.selectable>"u"),U=m.useRef(null),[L,A]=m.useState(!1),[V,T]=m.useState(!1),$=Ft(),{zIndex:D,sourceX:K,sourceY:_,targetX:I,targetY:E,sourcePosition:Y,targetPosition:G}=dt(m.useCallback(me=>{const Se=me.nodeLookup.get(w.source),Ve=me.nodeLookup.get(w.target);if(!Se||!Ve)return{zIndex:w.zIndex,...Jb};const Fe=ED({id:e,sourceNode:Se,targetNode:Ve,sourceHandle:w.sourceHandle||null,targetHandle:w.targetHandle||null,connectionMode:me.connectionMode,onError:g});return{zIndex:vD({selected:w.selected,zIndex:w.zIndex,sourceNode:Se,targetNode:Ve,elevateOnSelect:me.elevateEdgesOnSelect,zIndexMode:me.zIndexMode}),...Fe||Jb}},[w.source,w.target,w.sourceHandle,w.targetHandle,w.selected,w.zIndex]),Dt),F=m.useMemo(()=>w.markerStart?`url('#${jy(w.markerStart,y)}')`:void 0,[w.markerStart,y]),Z=m.useMemo(()=>w.markerEnd?`url('#${jy(w.markerEnd,y)}')`:void 0,[w.markerEnd,y]);if(w.hidden||K===null||_===null||I===null||E===null)return null;const oe=me=>{var ze;const{addSelectedEdges:Se,unselectNodesAndEdges:Ve,multiSelectionActive:Fe}=$.getState();M&&($.setState({nodesSelectionActive:!1}),w.selected&&Fe?(Ve({nodes:[],edges:[w]}),(ze=U.current)==null||ze.blur()):Se([e])),i&&i(me,w)},ue=s?me=>{s(me,{...w})}:void 0,ce=o?me=>{o(me,{...w})}:void 0,le=c?me=>{c(me,{...w})}:void 0,ve=l?me=>{l(me,{...w})}:void 0,ie=u?me=>{u(me,{...w})}:void 0,de=me=>{var Se;if(!v&&KC.includes(me.key)&&M){const{unselectNodesAndEdges:Ve,addSelectedEdges:Fe}=$.getState();me.key==="Escape"?((Se=U.current)==null||Se.blur(),Ve({edges:[w]})):Fe([e])}};return a.jsx("svg",{style:{zIndex:D},children:a.jsxs("g",{className:dn(["react-flow__edge",`react-flow__edge-${C}`,w.className,k,{selected:w.selected,animated:w.animated,inactive:!M&&!i,updating:L,selectable:M}]),onClick:oe,onDoubleClick:ue,onContextMenu:ce,onMouseEnter:le,onMouseMove:ve,onMouseLeave:ie,onKeyDown:P?de:void 0,tabIndex:P?0:void 0,role:w.ariaRole??(P?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":w.ariaLabel===null?void 0:w.ariaLabel||`Edge from ${w.source} to ${w.target}`,"aria-describedby":P?`${PE}-${y}`:void 0,ref:U,...w.domAttributes,children:[!V&&a.jsx(N,{id:e,source:w.source,target:w.target,type:w.type,selected:w.selected,animated:w.animated,selectable:M,deletable:w.deletable??!0,label:w.label,labelStyle:w.labelStyle,labelShowBg:w.labelShowBg,labelBgStyle:w.labelBgStyle,labelBgPadding:w.labelBgPadding,labelBgBorderRadius:w.labelBgBorderRadius,sourceX:K,sourceY:_,targetX:I,targetY:E,sourcePosition:Y,targetPosition:G,data:w.data,style:w.style,sourceHandleId:w.sourceHandle,targetHandleId:w.targetHandle,markerStart:F,markerEnd:Z,pathOptions:"pathOptions"in w?w.pathOptions:void 0,interactionWidth:w.interactionWidth}),R&&a.jsx(q3,{edge:w,isReconnectable:R,reconnectRadius:p,onReconnect:f,onReconnectStart:d,onReconnectEnd:h,sourceX:K,sourceY:_,targetX:I,targetY:E,sourcePosition:Y,targetPosition:G,setUpdateHover:A,setReconnecting:T})]})})}var G3=m.memo(Y3);const X3=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function e_({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:s,onEdgeContextMenu:o,onEdgeMouseEnter:c,onEdgeMouseMove:l,onEdgeMouseLeave:u,onEdgeClick:p,reconnectRadius:f,onEdgeDoubleClick:d,onReconnectStart:h,onReconnectEnd:y,disableKeyboardA11y:b}){const{edgesFocusable:k,edgesReconnectable:g,elementsSelectable:v,onError:w}=dt(X3,Dt),S=L3(t);return a.jsxs("div",{className:"react-flow__edges",children:[a.jsx(F3,{defaultColor:e,rfId:n}),S.map(C=>a.jsx(G3,{id:C,edgesFocusable:k,edgesReconnectable:g,elementsSelectable:v,noPanClassName:i,onReconnect:s,onContextMenu:o,onMouseEnter:c,onMouseMove:l,onMouseLeave:u,onClick:p,reconnectRadius:f,onDoubleClick:d,onReconnectStart:h,onReconnectEnd:y,rfId:n,onError:w,edgeTypes:r,disableKeyboardA11y:b},C))]})}e_.displayName="EdgeRenderer";const J3=m.memo(e_),Q3=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Z3({children:e}){const t=dt(Q3);return a.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function ez(e){const t=sa(),n=m.useRef(!1);m.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const tz=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function nz(e){const t=dt(tz),n=Ft();return m.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function rz(e){return e.connection.inProgress?{...e.connection,to:zu(e.connection.to,e.transform)}:{...e.connection}}function iz(e){return rz}function sz(e){const t=iz();return dt(t,Dt)}const oz=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function az({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:i,width:s,height:o,isValid:c,inProgress:l}=dt(oz,Dt);return!(s&&i&&l)?null:a.jsx("svg",{style:e,width:s,height:o,className:"react-flow__connectionline react-flow__container",children:a.jsx("g",{className:dn(["react-flow__connection",GC(c)]),children:a.jsx(t_,{style:t,type:n,CustomComponent:r,isValid:c})})})}const t_=({style:e,type:t=Ws.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:i,from:s,fromNode:o,fromHandle:c,fromPosition:l,to:u,toNode:p,toHandle:f,toPosition:d,pointer:h}=sz();if(!i)return;if(n)return a.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:c,fromX:s.x,fromY:s.y,toX:u.x,toY:u.y,fromPosition:l,toPosition:d,connectionStatus:GC(r),toNode:p,toHandle:f,pointer:h});let y="";const b={sourceX:s.x,sourceY:s.y,sourcePosition:l,targetX:u.x,targetY:u.y,targetPosition:d};switch(t){case Ws.Bezier:[y]=aE(b);break;case Ws.SimpleBezier:[y]=HE(b);break;case Ws.Step:[y]=Ny({...b,borderRadius:0});break;case Ws.SmoothStep:[y]=Ny(b);break;default:[y]=cE(b)}return a.jsx("path",{d:y,fill:"none",className:"react-flow__connection-path",style:e})};t_.displayName="ConnectionLine";const lz={};function ek(e=lz){m.useRef(e),Ft(),m.useEffect(()=>{},[e])}function cz(){Ft(),m.useRef(!1),m.useEffect(()=>{},[])}function n_({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:s,onEdgeDoubleClick:o,onNodeMouseEnter:c,onNodeMouseMove:l,onNodeMouseLeave:u,onNodeContextMenu:p,onSelectionContextMenu:f,onSelectionStart:d,onSelectionEnd:h,connectionLineType:y,connectionLineStyle:b,connectionLineComponent:k,connectionLineContainerStyle:g,selectionKeyCode:v,selectionOnDrag:w,selectionMode:S,multiSelectionKeyCode:C,panActivationKeyCode:N,zoomActivationKeyCode:P,deleteKeyCode:R,onlyRenderVisibleElements:M,elementsSelectable:U,defaultViewport:L,translateExtent:A,minZoom:V,maxZoom:T,preventScrolling:$,defaultMarkerColor:D,zoomOnScroll:K,zoomOnPinch:_,panOnScroll:I,panOnScrollSpeed:E,panOnScrollMode:Y,zoomOnDoubleClick:G,panOnDrag:F,onPaneClick:Z,onPaneMouseEnter:oe,onPaneMouseMove:ue,onPaneMouseLeave:ce,onPaneScroll:le,onPaneContextMenu:ve,paneClickDistance:ie,nodeClickDistance:de,onEdgeContextMenu:me,onEdgeMouseEnter:Se,onEdgeMouseMove:Ve,onEdgeMouseLeave:Fe,reconnectRadius:ze,onReconnect:ht,onReconnectStart:yn,onReconnectEnd:Yt,noDragClassName:at,noWheelClassName:Rt,noPanClassName:Zn,disableKeyboardA11y:jn,nodeExtent:xn,rfId:Gt,viewport:ne,onViewportChange:fe}){return ek(e),ek(t),cz(),ez(n),nz(ne),a.jsx(N3,{onPaneClick:Z,onPaneMouseEnter:oe,onPaneMouseMove:ue,onPaneMouseLeave:ce,onPaneContextMenu:ve,onPaneScroll:le,paneClickDistance:ie,deleteKeyCode:R,selectionKeyCode:v,selectionOnDrag:w,selectionMode:S,onSelectionStart:d,onSelectionEnd:h,multiSelectionKeyCode:C,panActivationKeyCode:N,zoomActivationKeyCode:P,elementsSelectable:U,zoomOnScroll:K,zoomOnPinch:_,zoomOnDoubleClick:G,panOnScroll:I,panOnScrollSpeed:E,panOnScrollMode:Y,panOnDrag:F,defaultViewport:L,translateExtent:A,minZoom:V,maxZoom:T,onSelectionContextMenu:f,preventScrolling:$,noDragClassName:at,noWheelClassName:Rt,noPanClassName:Zn,disableKeyboardA11y:jn,onViewportChange:fe,isControlledViewport:!!ne,children:a.jsxs(Z3,{children:[a.jsx(J3,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:ht,onReconnectStart:yn,onReconnectEnd:Yt,onlyRenderVisibleElements:M,onEdgeContextMenu:me,onEdgeMouseEnter:Se,onEdgeMouseMove:Ve,onEdgeMouseLeave:Fe,reconnectRadius:ze,defaultMarkerColor:D,noPanClassName:Zn,disableKeyboardA11y:jn,rfId:Gt}),a.jsx(az,{style:b,type:y,component:k,containerStyle:g}),a.jsx("div",{className:"react-flow__edgelabel-renderer"}),a.jsx(R3,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:s,onNodeMouseEnter:c,onNodeMouseMove:l,onNodeMouseLeave:u,onNodeContextMenu:p,nodeClickDistance:de,onlyRenderVisibleElements:M,noPanClassName:Zn,noDragClassName:at,disableKeyboardA11y:jn,nodeExtent:xn,rfId:Gt}),a.jsx("div",{className:"react-flow__viewport-portal"})]})})}n_.displayName="GraphView";const uz=m.memo(n_),tk=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:o,fitViewOptions:c,minZoom:l=.5,maxZoom:u=2,nodeOrigin:p,nodeExtent:f,zIndexMode:d="basic"}={})=>{const h=new Map,y=new Map,b=new Map,k=new Map,g=r??t??[],v=n??e??[],w=p??[0,0],S=f??fu;fE(b,k,g);const{nodesInitialized:C}=Cy(v,h,y,{nodeOrigin:w,nodeExtent:S,zIndexMode:d});let N=[0,0,1];if(o&&i&&s){const P=Du(h,{filter:L=>!!((L.width||L.initialWidth)&&(L.height||L.initialHeight))}),{x:R,y:M,zoom:U}=lw(P,i,s,l,u,(c==null?void 0:c.padding)??.1);N=[R,M,U]}return{rfId:"1",width:i??0,height:s??0,transform:N,nodes:v,nodesInitialized:C,nodeLookup:h,parentLookup:y,edges:g,edgeLookup:k,connectionLookup:b,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:l,maxZoom:u,translateExtent:fu,nodeExtent:S,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:ul.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:w,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:c,fitViewResolver:null,connection:{...YC},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:hD,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:qC,zIndexMode:d,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},dz=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:o,fitViewOptions:c,minZoom:l,maxZoom:u,nodeOrigin:p,nodeExtent:f,zIndexMode:d})=>IF((h,y)=>{async function b(){const{nodeLookup:k,panZoom:g,fitViewOptions:v,fitViewResolver:w,width:S,height:C,minZoom:N,maxZoom:P}=y();g&&(await fD({nodes:k,width:S,height:C,panZoom:g,minZoom:N,maxZoom:P},v),w==null||w.resolve(!0),h({fitViewResolver:null}))}return{...tk({nodes:e,edges:t,width:i,height:s,fitView:o,fitViewOptions:c,minZoom:l,maxZoom:u,nodeOrigin:p,nodeExtent:f,defaultNodes:n,defaultEdges:r,zIndexMode:d}),setNodes:k=>{const{nodeLookup:g,parentLookup:v,nodeOrigin:w,elevateNodesOnSelect:S,fitViewQueued:C,zIndexMode:N,nodesSelectionActive:P}=y(),{nodesInitialized:R,hasSelectedNodes:M}=Cy(k,g,v,{nodeOrigin:w,nodeExtent:f,elevateNodesOnSelect:S,checkEquality:!0,zIndexMode:N}),U=P&&M;C&&R?(b(),h({nodes:k,nodesInitialized:R,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:U})):h({nodes:k,nodesInitialized:R,nodesSelectionActive:U})},setEdges:k=>{const{connectionLookup:g,edgeLookup:v}=y();fE(g,v,k),h({edges:k})},setDefaultNodesAndEdges:(k,g)=>{if(k){const{setNodes:v}=y();v(k),h({hasDefaultNodes:!0})}if(g){const{setEdges:v}=y();v(g),h({hasDefaultEdges:!0})}},updateNodeInternals:k=>{const{triggerNodeChanges:g,nodeLookup:v,parentLookup:w,domNode:S,nodeOrigin:C,nodeExtent:N,debug:P,fitViewQueued:R,zIndexMode:M}=y(),{changes:U,updatedInternals:L}=OD(k,v,w,S,C,N,M);L&&(AD(v,w,{nodeOrigin:C,nodeExtent:N,zIndexMode:M}),R?(b(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),(U==null?void 0:U.length)>0&&(P&&console.log("React Flow: trigger node changes",U),g==null||g(U)))},updateNodePositions:(k,g=!1)=>{const v=[];let w=[];const{nodeLookup:S,triggerNodeChanges:C,connection:N,updateConnection:P,onNodesChangeMiddlewareMap:R}=y();for(const[M,U]of k){const L=S.get(M),A=!!(L!=null&&L.expandParent&&(L!=null&&L.parentId)&&(U!=null&&U.position)),V={id:M,type:"position",position:A?{x:Math.max(0,U.position.x),y:Math.max(0,U.position.y)}:U.position,dragging:g};if(L&&N.inProgress&&N.fromNode.id===L.id){const T=ea(L,N.fromHandle,Re.Left,!0);P({...N,from:T})}A&&L.parentId&&v.push({id:M,parentId:L.parentId,rect:{...U.internals.positionAbsolute,width:U.measured.width??0,height:U.measured.height??0}}),w.push(V)}if(v.length>0){const{parentLookup:M,nodeOrigin:U}=y(),L=hw(v,S,M,U);w.push(...L)}for(const M of R.values())w=M(w);C(w)},triggerNodeChanges:k=>{const{onNodesChange:g,setNodes:v,nodes:w,hasDefaultNodes:S,debug:C}=y();if(k!=null&&k.length){if(S){const N=mw(k,w);v(N)}C&&console.log("React Flow: trigger node changes",k),g==null||g(k)}},triggerEdgeChanges:k=>{const{onEdgesChange:g,setEdges:v,edges:w,hasDefaultEdges:S,debug:C}=y();if(k!=null&&k.length){if(S){const N=TE(k,w);v(N)}C&&console.log("React Flow: trigger edge changes",k),g==null||g(k)}},addSelectedNodes:k=>{const{multiSelectionActive:g,edgeLookup:v,nodeLookup:w,triggerNodeChanges:S,triggerEdgeChanges:C}=y();if(g){const N=k.map(P=>Lo(P,!0));S(N);return}S(Fa(w,new Set([...k]),!0)),C(Fa(v))},addSelectedEdges:k=>{const{multiSelectionActive:g,edgeLookup:v,nodeLookup:w,triggerNodeChanges:S,triggerEdgeChanges:C}=y();if(g){const N=k.map(P=>Lo(P,!0));C(N);return}C(Fa(v,new Set([...k]))),S(Fa(w,new Set,!0))},unselectNodesAndEdges:({nodes:k,edges:g}={})=>{const{edges:v,nodes:w,nodeLookup:S,triggerNodeChanges:C,triggerEdgeChanges:N}=y(),P=k||w,R=g||v,M=[];for(const L of P){if(!L.selected)continue;const A=S.get(L.id);A&&(A.selected=!1),M.push(Lo(L.id,!1))}const U=[];for(const L of R)L.selected&&U.push(Lo(L.id,!1));C(M),N(U)},setMinZoom:k=>{const{panZoom:g,maxZoom:v}=y();g==null||g.setScaleExtent([k,v]),h({minZoom:k})},setMaxZoom:k=>{const{panZoom:g,minZoom:v}=y();g==null||g.setScaleExtent([v,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:v,triggerEdgeChanges:w,elementsSelectable:S}=y();if(!S)return;const C=g.reduce((P,R)=>R.selected?[...P,Lo(R.id,!1)]:P,[]),N=k.reduce((P,R)=>R.selected?[...P,Lo(R.id,!1)]:P,[]);v(C),w(N)},setNodeExtent:k=>{const{nodes:g,nodeLookup:v,parentLookup:w,nodeOrigin:S,elevateNodesOnSelect:C,nodeExtent:N,zIndexMode:P}=y();k[0][0]===N[0][0]&&k[0][1]===N[0][1]&&k[1][0]===N[1][0]&&k[1][1]===N[1][1]||(Cy(g,v,w,{nodeOrigin:S,nodeExtent:k,elevateNodesOnSelect:C,checkEquality:!1,zIndexMode:P}),h({nodeExtent:k}))},panBy:k=>{const{transform:g,width:v,height:w,panZoom:S,translateExtent:C}=y();return MD({delta:k,panZoom:S,transform:g,translateExtent:C,width:v,height:w})},setCenter:async(k,g,v)=>{const{width:w,height:S,maxZoom:C,panZoom:N}=y();if(!N)return Promise.resolve(!1);const P=typeof(v==null?void 0:v.zoom)<"u"?v.zoom:C;return await N.setViewport({x:w/2-k*P,y:S/2-g*P,zoom:P},{duration:v==null?void 0:v.duration,ease:v==null?void 0:v.ease,interpolate:v==null?void 0:v.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{h({connection:{...YC}})},updateConnection:k=>{h({connection:k})},reset:()=>h({...tk()})}},Object.is);function yw({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:s,initialMinZoom:o,initialMaxZoom:c,initialFitViewOptions:l,fitView:u,nodeOrigin:p,nodeExtent:f,zIndexMode:d,children:h}){const[y]=m.useState(()=>dz({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:u,minZoom:o,maxZoom:c,fitViewOptions:l,nodeOrigin:p,nodeExtent:f,zIndexMode:d}));return a.jsx(AF,{value:y,children:a.jsx(ZF,{children:h})})}function fz({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:s,height:o,fitView:c,fitViewOptions:l,minZoom:u,maxZoom:p,nodeOrigin:f,nodeExtent:d,zIndexMode:h}){return m.useContext(dh)?a.jsx(a.Fragment,{children:e}):a.jsx(yw,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:s,initialHeight:o,fitView:c,initialFitViewOptions:l,initialMinZoom:u,initialMaxZoom:p,nodeOrigin:f,nodeExtent:d,zIndexMode:h,children:e})}const pz={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function hz({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:s,edgeTypes:o,onNodeClick:c,onEdgeClick:l,onInit:u,onMove:p,onMoveStart:f,onMoveEnd:d,onConnect:h,onConnectStart:y,onConnectEnd:b,onClickConnectStart:k,onClickConnectEnd:g,onNodeMouseEnter:v,onNodeMouseMove:w,onNodeMouseLeave:S,onNodeContextMenu:C,onNodeDoubleClick:N,onNodeDragStart:P,onNodeDrag:R,onNodeDragStop:M,onNodesDelete:U,onEdgesDelete:L,onDelete:A,onSelectionChange:V,onSelectionDragStart:T,onSelectionDrag:$,onSelectionDragStop:D,onSelectionContextMenu:K,onSelectionStart:_,onSelectionEnd:I,onBeforeDelete:E,connectionMode:Y,connectionLineType:G=Ws.Bezier,connectionLineStyle:F,connectionLineComponent:Z,connectionLineContainerStyle:oe,deleteKeyCode:ue="Backspace",selectionKeyCode:ce="Shift",selectionOnDrag:le=!1,selectionMode:ve=pu.Full,panActivationKeyCode:ie="Space",multiSelectionKeyCode:de=mu()?"Meta":"Control",zoomActivationKeyCode:me=mu()?"Meta":"Control",snapToGrid:Se,snapGrid:Ve,onlyRenderVisibleElements:Fe=!1,selectNodesOnDrag:ze,nodesDraggable:ht,autoPanOnNodeFocus:yn,nodesConnectable:Yt,nodesFocusable:at,nodeOrigin:Rt=IE,edgesFocusable:Zn,edgesReconnectable:jn,elementsSelectable:xn=!0,defaultViewport:Gt=VF,minZoom:ne=.5,maxZoom:fe=2,translateExtent:Le=fu,preventScrolling:Ye=!0,nodeExtent:We,defaultMarkerColor:Vt="#b1b1b7",zoomOnScroll:Xt=!0,zoomOnPinch:sn=!0,panOnScroll:yt=!1,panOnScrollSpeed:Cn=.5,panOnScrollMode:xe=Uo.Free,zoomOnDoubleClick:st=!0,panOnDrag:Lt=!0,onPaneClick:Ke,onPaneMouseEnter:wn,onPaneMouseMove:on,onPaneMouseLeave:Be,onPaneScroll:He,onPaneContextMenu:Pt,paneClickDistance:Ce=1,nodeClickDistance:Ot=0,children:Yr,onReconnect:er,onReconnectStart:Jt,onReconnectEnd:En,onEdgeContextMenu:xi,onEdgeDoubleClick:xs,onEdgeMouseEnter:Ki,onEdgeMouseMove:Gr,onEdgeMouseLeave:Je,reconnectRadius:Lr=10,onNodesChange:Xr,onEdgesChange:wt,noDragClassName:Ln="nodrag",noWheelClassName:q="nowheel",noPanClassName:ye="nopan",fitView:Ne,fitViewOptions:$e,connectOnClick:xt,attributionPosition:Wn,proOptions:_n,defaultEdgeOptions:tr,elevateNodesOnSelect:ws=!0,elevateEdgesOnSelect:qi=!1,disableKeyboardA11y:vs=!1,autoPanOnConnect:Qt,autoPanOnNodeDrag:vo,autoPanSpeed:bs,connectionRadius:bo,isValidConnection:Zt,onError:Yi,style:ko,id:So,nodeDragThreshold:yr,connectionDragThreshold:aa,viewport:ks,onViewportChange:wi,width:Ss,height:Ns,colorMode:ft="light",debug:js,onScroll:bt,ariaLabelConfig:Cs,zIndexMode:vi="basic",...xr},B){const X=So||"1",Q=YF(ft),te=m.useCallback(re=>{re.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),bt==null||bt(re)},[bt]);return a.jsx("div",{"data-testid":"rf__wrapper",...xr,onScroll:te,style:{...ko,...pz},ref:B,className:dn(["react-flow",i,Q]),id:So,role:"application",children:a.jsxs(fz,{nodes:e,edges:t,width:Ss,height:Ns,fitView:Ne,fitViewOptions:$e,minZoom:ne,maxZoom:fe,nodeOrigin:Rt,nodeExtent:We,zIndexMode:vi,children:[a.jsx(qF,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:y,onConnectEnd:b,onClickConnectStart:k,onClickConnectEnd:g,nodesDraggable:ht,autoPanOnNodeFocus:yn,nodesConnectable:Yt,nodesFocusable:at,edgesFocusable:Zn,edgesReconnectable:jn,elementsSelectable:xn,elevateNodesOnSelect:ws,elevateEdgesOnSelect:qi,minZoom:ne,maxZoom:fe,nodeExtent:We,onNodesChange:Xr,onEdgesChange:wt,snapToGrid:Se,snapGrid:Ve,connectionMode:Y,translateExtent:Le,connectOnClick:xt,defaultEdgeOptions:tr,fitView:Ne,fitViewOptions:$e,onNodesDelete:U,onEdgesDelete:L,onDelete:A,onNodeDragStart:P,onNodeDrag:R,onNodeDragStop:M,onSelectionDrag:$,onSelectionDragStart:T,onSelectionDragStop:D,onMove:p,onMoveStart:f,onMoveEnd:d,noPanClassName:ye,nodeOrigin:Rt,rfId:X,autoPanOnConnect:Qt,autoPanOnNodeDrag:vo,autoPanSpeed:bs,onError:Yi,connectionRadius:bo,isValidConnection:Zt,selectNodesOnDrag:ze,nodeDragThreshold:yr,connectionDragThreshold:aa,onBeforeDelete:E,debug:js,ariaLabelConfig:Cs,zIndexMode:vi}),a.jsx(uz,{onInit:u,onNodeClick:c,onEdgeClick:l,onNodeMouseEnter:v,onNodeMouseMove:w,onNodeMouseLeave:S,onNodeContextMenu:C,onNodeDoubleClick:N,nodeTypes:s,edgeTypes:o,connectionLineType:G,connectionLineStyle:F,connectionLineComponent:Z,connectionLineContainerStyle:oe,selectionKeyCode:ce,selectionOnDrag:le,selectionMode:ve,deleteKeyCode:ue,multiSelectionKeyCode:de,panActivationKeyCode:ie,zoomActivationKeyCode:me,onlyRenderVisibleElements:Fe,defaultViewport:Gt,translateExtent:Le,minZoom:ne,maxZoom:fe,preventScrolling:Ye,zoomOnScroll:Xt,zoomOnPinch:sn,zoomOnDoubleClick:st,panOnScroll:yt,panOnScrollSpeed:Cn,panOnScrollMode:xe,panOnDrag:Lt,onPaneClick:Ke,onPaneMouseEnter:wn,onPaneMouseMove:on,onPaneMouseLeave:Be,onPaneScroll:He,onPaneContextMenu:Pt,paneClickDistance:Ce,nodeClickDistance:Ot,onSelectionContextMenu:K,onSelectionStart:_,onSelectionEnd:I,onReconnect:er,onReconnectStart:Jt,onReconnectEnd:En,onEdgeContextMenu:xi,onEdgeDoubleClick:xs,onEdgeMouseEnter:Ki,onEdgeMouseMove:Gr,onEdgeMouseLeave:Je,reconnectRadius:Lr,defaultMarkerColor:Vt,noDragClassName:Ln,noWheelClassName:q,noPanClassName:ye,rfId:X,disableKeyboardA11y:vs,nodeExtent:We,viewport:ks,onViewportChange:wi}),a.jsx(UF,{onSelectionChange:V}),Yr,a.jsx(DF,{proOptions:_n,position:Wn}),a.jsx($F,{rfId:X,disableKeyboardA11y:vs})]})})}var r_=RE(hz);function i_(e){const[t,n]=m.useState(e),r=m.useCallback(i=>n(s=>mw(i,s)),[]);return[t,n,r]}function s_(e){const[t,n]=m.useState(e),r=m.useCallback(i=>n(s=>TE(i,s)),[]);return[t,n,r]}function mz({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:dn(["react-flow__background-pattern",n,r])})}function gz({radius:e,className:t}){return a.jsx("circle",{cx:e,cy:e,r:e,className:dn(["react-flow__background-pattern","dots",t])})}var so;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(so||(so={}));const yz={[so.Dots]:1,[so.Lines]:1,[so.Cross]:6},xz=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function o_({id:e,variant:t=so.Dots,gap:n=20,size:r,lineWidth:i=1,offset:s=0,color:o,bgColor:c,style:l,className:u,patternClassName:p}){const f=m.useRef(null),{transform:d,patternId:h}=dt(xz,Dt),y=r||yz[t],b=t===so.Dots,k=t===so.Cross,g=Array.isArray(n)?n:[n,n],v=[g[0]*d[2]||1,g[1]*d[2]||1],w=y*d[2],S=Array.isArray(s)?s:[s,s],C=k?[w,w]:v,N=[S[0]*d[2]||1+C[0]/2,S[1]*d[2]||1+C[1]/2],P=`${h}${e||""}`;return a.jsxs("svg",{className:dn(["react-flow__background",u]),style:{...l,...fh,"--xy-background-color-props":c,"--xy-background-pattern-color-props":o},ref:f,"data-testid":"rf__background",children:[a.jsx("pattern",{id:P,x:d[0]%v[0],y:d[1]%v[1],width:v[0],height:v[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${N[0]},-${N[1]})`,children:b?a.jsx(gz,{radius:w/2,className:p}):a.jsx(mz,{dimensions:C,lineWidth:i,variant:t,className:p})}),a.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${P})`})]})}o_.displayName="Background";const a_=m.memo(o_);function wz(){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 vz(){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 bz(){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 kz(){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 Sz(){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 tf({children:e,className:t,...n}){return a.jsx("button",{type:"button",className:dn(["react-flow__controls-button",t]),...n,children:e})}const Nz=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function l_({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:s,onZoomOut:o,onFitView:c,onInteractiveChange:l,className:u,children:p,position:f="bottom-left",orientation:d="vertical","aria-label":h}){const y=Ft(),{isInteractive:b,minZoomReached:k,maxZoomReached:g,ariaLabelConfig:v}=dt(Nz,Dt),{zoomIn:w,zoomOut:S,fitView:C}=sa(),N=()=>{w(),s==null||s()},P=()=>{S(),o==null||o()},R=()=>{C(i),c==null||c()},M=()=>{y.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),l==null||l(!b)},U=d==="horizontal"?"horizontal":"vertical";return a.jsxs(gl,{className:dn(["react-flow__controls",U,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":h??v["controls.ariaLabel"],children:[t&&a.jsxs(a.Fragment,{children:[a.jsx(tf,{onClick:N,className:"react-flow__controls-zoomin",title:v["controls.zoomIn.ariaLabel"],"aria-label":v["controls.zoomIn.ariaLabel"],disabled:g,children:a.jsx(wz,{})}),a.jsx(tf,{onClick:P,className:"react-flow__controls-zoomout",title:v["controls.zoomOut.ariaLabel"],"aria-label":v["controls.zoomOut.ariaLabel"],disabled:k,children:a.jsx(vz,{})})]}),n&&a.jsx(tf,{className:"react-flow__controls-fitview",onClick:R,title:v["controls.fitView.ariaLabel"],"aria-label":v["controls.fitView.ariaLabel"],children:a.jsx(bz,{})}),r&&a.jsx(tf,{className:"react-flow__controls-interactive",onClick:M,title:v["controls.interactive.ariaLabel"],"aria-label":v["controls.interactive.ariaLabel"],children:b?a.jsx(Sz,{}):a.jsx(kz,{})}),p]})}l_.displayName="Controls";const jz=m.memo(l_);function Cz({id:e,x:t,y:n,width:r,height:i,style:s,color:o,strokeColor:c,strokeWidth:l,className:u,borderRadius:p,shapeRendering:f,selected:d,onClick:h}){const{background:y,backgroundColor:b}=s||{},k=o||y||b;return a.jsx("rect",{className:dn(["react-flow__minimap-node",{selected:d},u]),x:t,y:n,rx:p,ry:p,width:r,height:i,style:{fill:k,stroke:c,strokeWidth:l},shapeRendering:f,onClick:h?g=>h(g,e):void 0})}const Ez=m.memo(Cz),_z=e=>e.nodes.map(t=>t.id),Fm=e=>e instanceof Function?e:()=>e;function Pz({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:s=Ez,onClick:o}){const c=dt(_z,Dt),l=Fm(t),u=Fm(e),p=Fm(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return a.jsx(a.Fragment,{children:c.map(d=>a.jsx(Az,{id:d,nodeColorFunc:l,nodeStrokeColorFunc:u,nodeClassNameFunc:p,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:s,onClick:o,shapeRendering:f},d))})}function Iz({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:s,shapeRendering:o,NodeComponent:c,onClick:l}){const{node:u,x:p,y:f,width:d,height:h}=dt(y=>{const b=y.nodeLookup.get(e);if(!b)return{node:void 0,x:0,y:0,width:0,height:0};const k=b.internals.userNode,{x:g,y:v}=b.internals.positionAbsolute,{width:w,height:S}=gs(k);return{node:k,x:g,y:v,width:w,height:S}},Dt);return!u||u.hidden||!tE(u)?null:a.jsx(c,{x:p,y:f,width:d,height:h,style:u.style,selected:!!u.selected,className:r(u),color:t(u),borderRadius:i,strokeColor:n(u),strokeWidth:s,shapeRendering:o,onClick:l,id:u.id})}const Az=m.memo(Iz);var Tz=m.memo(Pz);const Rz=200,Lz=150,Oz=e=>!e.hidden,Mz=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?eE(Du(e.nodeLookup,{filter:Oz}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},$z="react-flow__minimap-desc";function c_({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i="",nodeBorderRadius:s=5,nodeStrokeWidth:o,nodeComponent:c,bgColor:l,maskColor:u,maskStrokeColor:p,maskStrokeWidth:f,position:d="bottom-right",onClick:h,onNodeClick:y,pannable:b=!1,zoomable:k=!1,ariaLabel:g,inversePan:v,zoomStep:w=1,offsetScale:S=5}){const C=Ft(),N=m.useRef(null),{boundingRect:P,viewBB:R,rfId:M,panZoom:U,translateExtent:L,flowWidth:A,flowHeight:V,ariaLabelConfig:T}=dt(Mz,Dt),$=(e==null?void 0:e.width)??Rz,D=(e==null?void 0:e.height)??Lz,K=P.width/$,_=P.height/D,I=Math.max(K,_),E=I*$,Y=I*D,G=S*I,F=P.x-(E-P.width)/2-G,Z=P.y-(Y-P.height)/2-G,oe=E+G*2,ue=Y+G*2,ce=`${$z}-${M}`,le=m.useRef(0),ve=m.useRef();le.current=I,m.useEffect(()=>{if(N.current&&U)return ve.current=WD({domNode:N.current,panZoom:U,getTransform:()=>C.getState().transform,getViewScale:()=>le.current}),()=>{var Se;(Se=ve.current)==null||Se.destroy()}},[U]),m.useEffect(()=>{var Se;(Se=ve.current)==null||Se.update({translateExtent:L,width:A,height:V,inversePan:v,pannable:b,zoomStep:w,zoomable:k})},[b,k,v,w,L,A,V]);const ie=h?Se=>{var ze;const[Ve,Fe]=((ze=ve.current)==null?void 0:ze.pointer(Se))||[0,0];h(Se,{x:Ve,y:Fe})}:void 0,de=y?m.useCallback((Se,Ve)=>{const Fe=C.getState().nodeLookup.get(Ve).internals.userNode;y(Se,Fe)},[]):void 0,me=g??T["minimap.ariaLabel"];return a.jsx(gl,{position:d,style:{...e,"--xy-minimap-background-color-props":typeof l=="string"?l: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*I: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:dn(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:a.jsxs("svg",{width:$,height:D,viewBox:`${F} ${Z} ${oe} ${ue}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ce,ref:N,onClick:ie,children:[me&&a.jsx("title",{id:ce,children:me}),a.jsx(Tz,{onClick:de,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:c}),a.jsx("path",{className:"react-flow__minimap-mask",d:`M${F-G},${Z-G}h${oe+G*2}v${ue+G*2}h${-oe-G*2}z
|
|
66
|
+
M${R.x},${R.y}h${R.width}v${R.height}h${-R.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}c_.displayName="MiniMap";const Dz=m.memo(c_),Fz=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,zz={[hl.Line]:"right",[hl.Handle]:"bottom-right"};function Bz({nodeId:e,position:t,variant:n=hl.Handle,className:r,style:i=void 0,children:s,color:o,minWidth:c=10,minHeight:l=10,maxWidth:u=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:d,autoScale:h=!0,shouldResize:y,onResizeStart:b,onResize:k,onResizeEnd:g}){const v=$E(),w=typeof e=="string"?e:v,S=Ft(),C=m.useRef(null),N=n===hl.Handle,P=dt(m.useCallback(Fz(N&&h),[N,h]),Dt),R=m.useRef(null),M=t??zz[n];m.useEffect(()=>{if(!(!C.current||!w))return R.current||(R.current=sF({domNode:C.current,nodeId:w,getStoreItems:()=>{const{nodeLookup:L,transform:A,snapGrid:V,snapToGrid:T,nodeOrigin:$,domNode:D}=S.getState();return{nodeLookup:L,transform:A,snapGrid:V,snapToGrid:T,nodeOrigin:$,paneDomNode:D}},onChange:(L,A)=>{const{triggerNodeChanges:V,nodeLookup:T,parentLookup:$,nodeOrigin:D}=S.getState(),K=[],_={x:L.x,y:L.y},I=T.get(w);if(I&&I.expandParent&&I.parentId){const E=I.origin??D,Y=L.width??I.measured.width??0,G=L.height??I.measured.height??0,F={id:I.id,parentId:I.parentId,rect:{width:Y,height:G,...nE({x:L.x??I.position.x,y:L.y??I.position.y},{width:Y,height:G},I.parentId,T,E)}},Z=hw([F],T,$,D);K.push(...Z),_.x=L.x?Math.max(E[0]*Y,L.x):void 0,_.y=L.y?Math.max(E[1]*G,L.y):void 0}if(_.x!==void 0&&_.y!==void 0){const E={id:w,type:"position",position:{..._}};K.push(E)}if(L.width!==void 0&&L.height!==void 0){const Y={id:w,type:"dimensions",resizing:!0,setAttributes:d?d==="horizontal"?"width":"height":!0,dimensions:{width:L.width,height:L.height}};K.push(Y)}for(const E of A){const Y={...E,type:"position"};K.push(Y)}V(K)},onEnd:({width:L,height:A})=>{const V={id:w,type:"dimensions",resizing:!1,dimensions:{width:L,height:A}};S.getState().triggerNodeChanges([V])}})),R.current.update({controlPosition:M,boundaries:{minWidth:c,minHeight:l,maxWidth:u,maxHeight:p},keepAspectRatio:f,resizeDirection:d,onResizeStart:b,onResize:k,onResizeEnd:g,shouldResize:y}),()=>{var L;(L=R.current)==null||L.destroy()}},[M,c,l,u,p,f,b,k,g,y]);const U=M.split("-");return a.jsx("div",{className:dn(["react-flow__resize-control","nodrag",...U,n,r]),ref:C,style:{...i,scale:P,...o&&{[N?"backgroundColor":"borderColor"]:o}},children:s})}const Hz=m.memo(Bz);function Uz(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Vz=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Wz=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Kz={};function nk(e,t){return(Kz.jsx?Wz:Vz).test(e)}const qz=/[ \t\n\f\r]/g;function Yz(e){return typeof e=="object"?e.type==="text"?rk(e.value):!1:rk(e)}function rk(e){return e.replace(qz,"")===""}let Bu=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};Bu.prototype.normal={};Bu.prototype.property={};Bu.prototype.space=void 0;function u_(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Bu(n,r,t)}function Iy(e){return e.toLowerCase()}class gr{constructor(t,n){this.attribute=n,this.property=t}}gr.prototype.attribute="";gr.prototype.booleanish=!1;gr.prototype.boolean=!1;gr.prototype.commaOrSpaceSeparated=!1;gr.prototype.commaSeparated=!1;gr.prototype.defined=!1;gr.prototype.mustUseProperty=!1;gr.prototype.number=!1;gr.prototype.overloadedBoolean=!1;gr.prototype.property="";gr.prototype.spaceSeparated=!1;gr.prototype.space=void 0;let Gz=0;const tt=oa(),ln=oa(),Ay=oa(),ge=oa(),jt=oa(),Qa=oa(),br=oa();function oa(){return 2**++Gz}const Ty=Object.freeze(Object.defineProperty({__proto__:null,boolean:tt,booleanish:ln,commaOrSpaceSeparated:br,commaSeparated:Qa,number:ge,overloadedBoolean:Ay,spaceSeparated:jt},Symbol.toStringTag,{value:"Module"})),zm=Object.keys(Ty);class xw extends gr{constructor(t,n,r,i){let s=-1;if(super(t,n),ik(this,"space",i),typeof r=="number")for(;++s<zm.length;){const o=zm[s];ik(this,zm[s],(r&Ty[o])===Ty[o])}}}xw.prototype.defined=!0;function ik(e,t,n){n&&(e[t]=n)}function jl(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new xw(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[Iy(r)]=r,n[Iy(s.attribute)]=r}return new Bu(t,n,e.space)}const d_=jl({properties:{ariaActiveDescendant:null,ariaAtomic:ln,ariaAutoComplete:null,ariaBusy:ln,ariaChecked:ln,ariaColCount:ge,ariaColIndex:ge,ariaColSpan:ge,ariaControls:jt,ariaCurrent:null,ariaDescribedBy:jt,ariaDetails:null,ariaDisabled:ln,ariaDropEffect:jt,ariaErrorMessage:null,ariaExpanded:ln,ariaFlowTo:jt,ariaGrabbed:ln,ariaHasPopup:null,ariaHidden:ln,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:jt,ariaLevel:ge,ariaLive:null,ariaModal:ln,ariaMultiLine:ln,ariaMultiSelectable:ln,ariaOrientation:null,ariaOwns:jt,ariaPlaceholder:null,ariaPosInSet:ge,ariaPressed:ln,ariaReadOnly:ln,ariaRelevant:null,ariaRequired:ln,ariaRoleDescription:jt,ariaRowCount:ge,ariaRowIndex:ge,ariaRowSpan:ge,ariaSelected:ln,ariaSetSize:ge,ariaSort:null,ariaValueMax:ge,ariaValueMin:ge,ariaValueNow:ge,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function f_(e,t){return t in e?e[t]:t}function p_(e,t){return f_(e,t.toLowerCase())}const Xz=jl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Qa,acceptCharset:jt,accessKey:jt,action:null,allow:null,allowFullScreen:tt,allowPaymentRequest:tt,allowUserMedia:tt,alt:null,as:null,async:tt,autoCapitalize:null,autoComplete:jt,autoFocus:tt,autoPlay:tt,blocking:jt,capture:null,charSet:null,checked:tt,cite:null,className:jt,cols:ge,colSpan:null,content:null,contentEditable:ln,controls:tt,controlsList:jt,coords:ge|Qa,crossOrigin:null,data:null,dateTime:null,decoding:null,default:tt,defer:tt,dir:null,dirName:null,disabled:tt,download:Ay,draggable:ln,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:tt,formTarget:null,headers:jt,height:ge,hidden:Ay,high:ge,href:null,hrefLang:null,htmlFor:jt,httpEquiv:jt,id:null,imageSizes:null,imageSrcSet:null,inert:tt,inputMode:null,integrity:null,is:null,isMap:tt,itemId:null,itemProp:jt,itemRef:jt,itemScope:tt,itemType:jt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:tt,low:ge,manifest:null,max:null,maxLength:ge,media:null,method:null,min:null,minLength:ge,multiple:tt,muted:tt,name:null,nonce:null,noModule:tt,noValidate:tt,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:tt,optimum:ge,pattern:null,ping:jt,placeholder:null,playsInline:tt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:tt,referrerPolicy:null,rel:jt,required:tt,reversed:tt,rows:ge,rowSpan:ge,sandbox:jt,scope:null,scoped:tt,seamless:tt,selected:tt,shadowRootClonable:tt,shadowRootDelegatesFocus:tt,shadowRootMode:null,shape:null,size:ge,sizes:null,slot:null,span:ge,spellCheck:ln,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ge,step:null,style:null,tabIndex:ge,target:null,title:null,translate:null,type:null,typeMustMatch:tt,useMap:null,value:ln,width:ge,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:jt,axis:null,background:null,bgColor:null,border:ge,borderColor:null,bottomMargin:ge,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:tt,declare:tt,event:null,face:null,frame:null,frameBorder:null,hSpace:ge,leftMargin:ge,link:null,longDesc:null,lowSrc:null,marginHeight:ge,marginWidth:ge,noResize:tt,noHref:tt,noShade:tt,noWrap:tt,object:null,profile:null,prompt:null,rev:null,rightMargin:ge,rules:null,scheme:null,scrolling:ln,standby:null,summary:null,text:null,topMargin:ge,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ge,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:tt,disableRemotePlayback:tt,prefix:null,property:null,results:ge,security:null,unselectable:null},space:"html",transform:p_}),Jz=jl({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:br,accentHeight:ge,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ge,amplitude:ge,arabicForm:null,ascent:ge,attributeName:null,attributeType:null,azimuth:ge,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ge,by:null,calcMode:null,capHeight:ge,className:jt,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:ge,diffuseConstant:ge,direction:null,display:null,dur:null,divisor:ge,dominantBaseline:null,download:tt,dx:null,dy:null,edgeMode:null,editable:null,elevation:ge,enableBackground:null,end:null,event:null,exponent:ge,externalResourcesRequired:null,fill:null,fillOpacity:ge,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:Qa,g2:Qa,glyphName:Qa,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ge,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ge,horizOriginX:ge,horizOriginY:ge,id:null,ideographic:ge,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ge,k:ge,k1:ge,k2:ge,k3:ge,k4:ge,kernelMatrix:br,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ge,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:ge,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:ge,overlineThickness:ge,paintOrder:null,panose1:null,path:null,pathLength:ge,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:jt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ge,pointsAtY:ge,pointsAtZ:ge,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:br,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:br,rev:br,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:br,requiredFeatures:br,requiredFonts:br,requiredFormats:br,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:ge,specularExponent:ge,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ge,strikethroughThickness:ge,string:null,stroke:null,strokeDashArray:br,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ge,strokeOpacity:ge,strokeWidth:null,style:null,surfaceScale:ge,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:br,tabIndex:ge,tableValues:null,target:null,targetX:ge,targetY:ge,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:br,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ge,underlineThickness:ge,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ge,values:null,vAlphabetic:ge,vMathematical:ge,vectorEffect:null,vHanging:ge,vIdeographic:ge,version:null,vertAdvY:ge,vertOriginX:ge,vertOriginY:ge,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ge,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:f_}),h_=jl({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()}}),m_=jl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:p_}),g_=jl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Qz={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"},Zz=/[A-Z]/g,sk=/-[a-z]/g,e4=/^data[-\w.:]+$/i;function t4(e,t){const n=Iy(t);let r=t,i=gr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&e4.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(sk,r4);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!sk.test(s)){let o=s.replace(Zz,n4);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=xw}return new i(r,t)}function n4(e){return"-"+e.toLowerCase()}function r4(e){return e.charAt(1).toUpperCase()}const i4=u_([d_,Xz,h_,m_,g_],"html"),ww=u_([d_,Jz,h_,m_,g_],"svg");function s4(e){return e.join(" ").trim()}var vw={},ok=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,o4=/\n/g,a4=/^\s*/,l4=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,c4=/^:\s*/,u4=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,d4=/^[;\s]*/,f4=/^\s+|\s+$/g,p4=`
|
|
67
|
+
`,ak="/",lk="*",Oo="",h4="comment",m4="declaration";function g4(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(y){var b=y.match(o4);b&&(n+=b.length);var k=y.lastIndexOf(p4);r=~k?y.length-k:r+y.length}function s(){var y={line:n,column:r};return function(b){return b.position=new o(y),u(),b}}function o(y){this.start=y,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function c(y){var b=new Error(t.source+":"+n+":"+r+": "+y);if(b.reason=y,b.filename=t.source,b.line=n,b.column=r,b.source=e,!t.silent)throw b}function l(y){var b=y.exec(e);if(b){var k=b[0];return i(k),e=e.slice(k.length),b}}function u(){l(a4)}function p(y){var b;for(y=y||[];b=f();)b!==!1&&y.push(b);return y}function f(){var y=s();if(!(ak!=e.charAt(0)||lk!=e.charAt(1))){for(var b=2;Oo!=e.charAt(b)&&(lk!=e.charAt(b)||ak!=e.charAt(b+1));)++b;if(b+=2,Oo===e.charAt(b-1))return c("End of comment missing");var k=e.slice(2,b-2);return r+=2,i(k),e=e.slice(b),r+=2,y({type:h4,comment:k})}}function d(){var y=s(),b=l(l4);if(b){if(f(),!l(c4))return c("property missing ':'");var k=l(u4),g=y({type:m4,property:ck(b[0].replace(ok,Oo)),value:k?ck(k[0].replace(ok,Oo)):Oo});return l(d4),g}}function h(){var y=[];p(y);for(var b;b=d();)b!==!1&&(y.push(b),p(y));return y}return u(),h()}function ck(e){return e?e.replace(f4,Oo):Oo}var y4=g4,x4=Vc&&Vc.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(vw,"__esModule",{value:!0});vw.default=v4;const w4=x4(y4);function v4(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,w4.default)(e),i=typeof t=="function";return r.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:c}=s;i?t(o,c,s):c&&(n=n||{},n[o]=c)}),n}var hh={};Object.defineProperty(hh,"__esModule",{value:!0});hh.camelCase=void 0;var b4=/^--[a-zA-Z0-9_-]+$/,k4=/-([a-z])/g,S4=/^[^-]+$/,N4=/^-(webkit|moz|ms|o|khtml)-/,j4=/^-(ms)-/,C4=function(e){return!e||S4.test(e)||b4.test(e)},E4=function(e,t){return t.toUpperCase()},uk=function(e,t){return"".concat(t,"-")},_4=function(e,t){return t===void 0&&(t={}),C4(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(j4,uk):e=e.replace(N4,uk),e.replace(k4,E4))};hh.camelCase=_4;var P4=Vc&&Vc.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},I4=P4(vw),A4=hh;function Ry(e,t){var n={};return!e||typeof e!="string"||(0,I4.default)(e,function(r,i){r&&i&&(n[(0,A4.camelCase)(r,t)]=i)}),n}Ry.default=Ry;var T4=Ry;const R4=mo(T4),y_=x_("end"),bw=x_("start");function x_(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 L4(e){const t=bw(e),n=y_(e);if(t&&n)return{start:t,end:n}}function Fc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?dk(e.position):"start"in e||"end"in e?dk(e):"line"in e||"column"in e?Ly(e):""}function Ly(e){return fk(e&&e.line)+":"+fk(e&&e.column)}function dk(e){return Ly(e&&e.start)+"-"+Ly(e&&e.end)}function fk(e){return e&&typeof e=="number"?e:1}class Un extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(o=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?s.ruleId=r:(s.source=r.slice(0,l),s.ruleId=r.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const c=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=c?c.line:void 0,this.name=Fc(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Un.prototype.file="";Un.prototype.name="";Un.prototype.reason="";Un.prototype.message="";Un.prototype.stack="";Un.prototype.column=void 0;Un.prototype.line=void 0;Un.prototype.ancestors=void 0;Un.prototype.cause=void 0;Un.prototype.fatal=void 0;Un.prototype.place=void 0;Un.prototype.ruleId=void 0;Un.prototype.source=void 0;const kw={}.hasOwnProperty,O4=new Map,M4=/[A-Z]/g,$4=new Set(["table","tbody","thead","tfoot","tr"]),D4=new Set(["td","th"]),w_="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function F4(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=q4(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=K4(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?ww:i4,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=v_(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function v_(e,t,n){if(t.type==="element")return z4(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return B4(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return U4(e,t,n);if(t.type==="mdxjsEsm")return H4(e,t);if(t.type==="root")return V4(e,t,n);if(t.type==="text")return W4(e,t)}function z4(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=ww,e.schema=i),e.ancestors.push(t);const s=k_(e,t.tagName,!1),o=Y4(e,t);let c=Nw(e,t);return $4.has(t.tagName)&&(c=c.filter(function(l){return typeof l=="string"?!Yz(l):!0})),b_(e,o,s,t),Sw(o,c),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function B4(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)}xu(e,t.position)}function H4(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);xu(e,t.position)}function U4(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=ww,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:k_(e,t.name,!0),o=G4(e,t),c=Nw(e,t);return b_(e,o,s,t),Sw(o,c),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function V4(e,t,n){const r={};return Sw(r,Nw(e,t)),e.create(t,e.Fragment,r,n)}function W4(e,t){return t.value}function b_(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Sw(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function K4(e,t,n){return r;function r(i,s,o,c){const u=Array.isArray(o.children)?n:t;return c?u(s,o,c):u(s,o)}}function q4(e,t){return n;function n(r,i,s,o){const c=Array.isArray(s.children),l=bw(r);return t(i,s,o,c,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function Y4(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&kw.call(t.properties,i)){const s=X4(e,i,t.properties[i]);if(s){const[o,c]=s;e.tableCellAlignToStyle&&o==="align"&&typeof c=="string"&&D4.has(t.tagName)?r=c:n[o]=c}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function G4(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const o=s.expression;o.type;const c=o.properties[0];c.type,Object.assign(n,e.evaluater.evaluateExpression(c.argument))}else xu(e,t.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const c=r.value.data.estree.body[0];c.type,s=e.evaluater.evaluateExpression(c.expression)}else xu(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function Nw(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:O4;for(;++r<t.children.length;){const s=t.children[r];let o;if(e.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const u=i.get(l)||0;o=l+"-"+u,i.set(l,u+1)}}const c=v_(e,s,o);c!==void 0&&n.push(c)}return n}function X4(e,t,n){const r=t4(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Uz(n):s4(n)),r.property==="style"){let i=typeof n=="object"?n:J4(e,String(n));return e.stylePropertyNameCase==="css"&&(i=Q4(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?Qz[r.property]||r.property:r.attribute,n]}}function J4(e,t){try{return R4(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new Un("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=w_+"#cannot-parse-style-attribute",i}}function k_(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let s=-1,o;for(;++s<i.length;){const c=nk(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};o=o?{type:"MemberExpression",object:o,property:c,computed:!!(s&&c.type==="Literal"),optional:!1}:c}r=o}else r=nk(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return kw.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);xu(e)}function xu(e,t){const n=new Un("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=w_+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Q4(e){const t={};let n;for(n in e)kw.call(e,n)&&(t[Z4(n)]=e[n]);return t}function Z4(e){let t=e.replace(M4,e5);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function e5(e){return"-"+e.toLowerCase()}const Bm={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"]},t5={};function n5(e,t){const n=t5,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return S_(e,r,i)}function S_(e,t,n){if(r5(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 pk(e.children,t,n)}return Array.isArray(e)?pk(e,t,n):""}function pk(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=S_(e[i],t,n);return r.join("")}function r5(e){return!!(e&&typeof e=="object")}const hk=document.createElement("i");function jw(e){const t="&"+e+";";hk.innerHTML=t;const n=hk.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ui(e,t,n,r){const i=e.length;let s=0,o;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);s<r.length;)o=r.slice(s,s+1e4),o.unshift(t,0),e.splice(...o),s+=1e4,t+=1e4}function Br(e,t){return e.length>0?(Ui(e,e.length,0,t),e):t}const mk={}.hasOwnProperty;function i5(e){const t={};let n=-1;for(;++n<e.length;)s5(t,e[n]);return t}function s5(e,t){let n;for(n in t){const i=(mk.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let o;if(s)for(o in s){mk.call(i,o)||(i[o]=[]);const c=s[o];o5(i[o],Array.isArray(c)?c:c?[c]:[])}}}function o5(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Ui(e,0,0,r)}function N_(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 Za(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Li=wo(/[A-Za-z]/),Cr=wo(/[\dA-Za-z]/),a5=wo(/[#-'*+\--9=?A-Z^-~]/);function Oy(e){return e!==null&&(e<32||e===127)}const My=wo(/\d/),l5=wo(/[\dA-Fa-f]/),c5=wo(/[!-/:-@[-`{-~]/);function Ue(e){return e!==null&&e<-2}function mr(e){return e!==null&&(e<0||e===32)}function gt(e){return e===-2||e===-1||e===32}const u5=wo(new RegExp("\\p{P}|\\p{S}","u")),d5=wo(/\s/);function wo(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Cl(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const s=e.charCodeAt(n);let o="";if(s===37&&Cr(e.charCodeAt(n+1))&&Cr(e.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const c=e.charCodeAt(n+1);s<56320&&c>56319&&c<57344?(o=String.fromCharCode(s,c),i=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function Et(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(l){return gt(l)?(e.enter(n),c(l)):t(l)}function c(l){return gt(l)&&s++<i?(e.consume(l),c):(e.exit(n),t(l))}}const f5={tokenize:p5};function p5(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),Et(e,t,"linePrefix")}function i(c){return e.enter("paragraph"),s(c)}function s(c){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,o(c)}function o(c){if(c===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(c);return}return Ue(c)?(e.consume(c),e.exit("chunkText"),s):(e.consume(c),o)}}const h5={tokenize:m5},gk={tokenize:g5};function m5(e){const t=this,n=[];let r=0,i,s,o;return c;function c(w){if(r<n.length){const S=n[r];return t.containerState=S[1],e.attempt(S[0].continuation,l,u)(w)}return u(w)}function l(w){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();const S=t.events.length;let C=S,N;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){N=t.events[C][1].end;break}g(r);let P=S;for(;P<t.events.length;)t.events[P][1].end={...N},P++;return Ui(t.events,C+1,0,t.events.slice(S)),t.events.length=P,u(w)}return c(w)}function u(w){if(r===n.length){if(!i)return d(w);if(i.currentConstruct&&i.currentConstruct.concrete)return y(w);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(gk,p,f)(w)}function p(w){return i&&v(),g(r),d(w)}function f(w){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,y(w)}function d(w){return t.containerState={},e.attempt(gk,h,y)(w)}function h(w){return r++,n.push([t.currentConstruct,t.containerState]),d(w)}function y(w){if(w===null){i&&v(),g(0),e.consume(w);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),b(w)}function b(w){if(w===null){k(e.exit("chunkFlow"),!0),g(0),e.consume(w);return}return Ue(w)?(e.consume(w),k(e.exit("chunkFlow")),r=0,t.interrupt=void 0,c):(e.consume(w),b)}function k(w,S){const C=t.sliceStream(w);if(S&&C.push(null),w.previous=s,s&&(s.next=w),s=w,i.defineSkip(w.start),i.write(C),t.parser.lazy[w.start.line]){let N=i.events.length;for(;N--;)if(i.events[N][1].start.offset<o&&(!i.events[N][1].end||i.events[N][1].end.offset>o))return;const P=t.events.length;let R=P,M,U;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){if(M){U=t.events[R][1].end;break}M=!0}for(g(r),N=P;N<t.events.length;)t.events[N][1].end={...U},N++;Ui(t.events,R+1,0,t.events.slice(P)),t.events.length=N}}function g(w){let S=n.length;for(;S-- >w;){const C=n[S];t.containerState=C[1],C[0].exit.call(t,e)}n.length=w}function v(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function g5(e,t,n){return Et(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function yk(e){if(e===null||mr(e)||d5(e))return 1;if(u5(e))return 2}function Cw(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const s=e[i].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const $y={name:"attention",resolveAll:y5,tokenize:x5};function y5(e,t){let n=-1,r,i,s,o,c,l,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;l=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,-l),xk(d,l),o={type:l>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},c={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:d},s={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...o.start},end:{...c.end}},e[r][1].end={...o.start},e[n][1].start={...c.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Br(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Br(u,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),u=Br(u,Cw(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Br(u,[["exit",s,t],["enter",c,t],["exit",c,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,u=Br(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,Ui(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 x5(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=yk(r);let s;return o;function o(l){return s=l,e.enter("attentionSequence"),c(l)}function c(l){if(l===s)return e.consume(l),c;const u=e.exit("attentionSequence"),p=yk(l),f=!p||p===2&&i||n.includes(l),d=!i||i===2&&p||n.includes(r);return u._open=!!(s===42?f:f&&(i||!d)),u._close=!!(s===42?d:d&&(p||!f)),t(l)}}function xk(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const w5={name:"autolink",tokenize:v5};function v5(e,t,n){let r=0;return i;function i(h){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(h){return Li(h)?(e.consume(h),o):h===64?n(h):u(h)}function o(h){return h===43||h===45||h===46||Cr(h)?(r=1,c(h)):u(h)}function c(h){return h===58?(e.consume(h),r=0,l):(h===43||h===45||h===46||Cr(h))&&r++<32?(e.consume(h),c):(r=0,u(h))}function l(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||Oy(h)?n(h):(e.consume(h),l)}function u(h){return h===64?(e.consume(h),p):a5(h)?(e.consume(h),u):n(h)}function p(h){return Cr(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||Cr(h))&&r++<63){const y=h===45?d:f;return e.consume(h),y}return n(h)}}const mh={partial:!0,tokenize:b5};function b5(e,t,n){return r;function r(s){return gt(s)?Et(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||Ue(s)?t(s):n(s)}}const j_={continuation:{tokenize:S5},exit:N5,name:"blockQuote",tokenize:k5};function k5(e,t,n){const r=this;return i;function i(o){if(o===62){const c=r.containerState;return c.open||(e.enter("blockQuote",{_container:!0}),c.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),s}return n(o)}function s(o){return gt(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function S5(e,t,n){const r=this;return i;function i(o){return gt(o)?Et(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return e.attempt(j_,t,n)(o)}}function N5(e){e.exit("blockQuote")}const C_={name:"characterEscape",tokenize:j5};function j5(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),i}function i(s){return c5(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const E_={name:"characterReference",tokenize:C5};function C5(e,t,n){const r=this;let i=0,s,o;return c;function c(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),l}function l(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),s=31,o=Cr,p(f))}function u(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,o=l5,p):(e.enter("characterReferenceValue"),s=7,o=My,p(f))}function p(f){if(f===59&&i){const d=e.exit("characterReferenceValue");return o===Cr&&!jw(r.sliceSerialize(d))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(f)&&i++<s?(e.consume(f),p):n(f)}}const wk={partial:!0,tokenize:_5},vk={concrete:!0,name:"codeFenced",tokenize:E5};function E5(e,t,n){const r=this,i={partial:!0,tokenize:C};let s=0,o=0,c;return l;function l(N){return u(N)}function u(N){const P=r.events[r.events.length-1];return s=P&&P[1].type==="linePrefix"?P[2].sliceSerialize(P[1],!0).length:0,c=N,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(N)}function p(N){return N===c?(o++,e.consume(N),p):o<3?n(N):(e.exit("codeFencedFenceSequence"),gt(N)?Et(e,f,"whitespace")(N):f(N))}function f(N){return N===null||Ue(N)?(e.exit("codeFencedFence"),r.interrupt?t(N):e.check(wk,b,S)(N)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),d(N))}function d(N){return N===null||Ue(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(N)):gt(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Et(e,h,"whitespace")(N)):N===96&&N===c?n(N):(e.consume(N),d)}function h(N){return N===null||Ue(N)?f(N):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),y(N))}function y(N){return N===null||Ue(N)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(N)):N===96&&N===c?n(N):(e.consume(N),y)}function b(N){return e.attempt(i,S,k)(N)}function k(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),g}function g(N){return s>0&>(N)?Et(e,v,"linePrefix",s+1)(N):v(N)}function v(N){return N===null||Ue(N)?e.check(wk,b,S)(N):(e.enter("codeFlowValue"),w(N))}function w(N){return N===null||Ue(N)?(e.exit("codeFlowValue"),v(N)):(e.consume(N),w)}function S(N){return e.exit("codeFenced"),t(N)}function C(N,P,R){let M=0;return U;function U($){return N.enter("lineEnding"),N.consume($),N.exit("lineEnding"),L}function L($){return N.enter("codeFencedFence"),gt($)?Et(N,A,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):A($)}function A($){return $===c?(N.enter("codeFencedFenceSequence"),V($)):R($)}function V($){return $===c?(M++,N.consume($),V):M>=o?(N.exit("codeFencedFenceSequence"),gt($)?Et(N,T,"whitespace")($):T($)):R($)}function T($){return $===null||Ue($)?(N.exit("codeFencedFence"),P($)):R($)}}}function _5(e,t,n){const r=this;return i;function i(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const Hm={name:"codeIndented",tokenize:I5},P5={partial:!0,tokenize:A5};function I5(e,t,n){const r=this;return i;function i(u){return e.enter("codeIndented"),Et(e,s,"linePrefix",5)(u)}function s(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?l(u):Ue(u)?e.attempt(P5,o,l)(u):(e.enter("codeFlowValue"),c(u))}function c(u){return u===null||Ue(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),c)}function l(u){return e.exit("codeIndented"),t(u)}}function A5(e,t,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):Ue(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):Et(e,s,"linePrefix",5)(o)}function s(o){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(o):Ue(o)?i(o):n(o)}}const T5={name:"codeText",previous:L5,resolve:R5,tokenize:O5};function R5(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function L5(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function O5(e,t,n){let r=0,i,s;return o;function o(f){return e.enter("codeText"),e.enter("codeTextSequence"),c(f)}function c(f){return f===96?(e.consume(f),r++,c):(e.exit("codeTextSequence"),l(f))}function l(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),l):f===96?(s=e.enter("codeTextSequence"),i=0,p(f)):Ue(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||Ue(f)?(e.exit("codeTextData"),l(f)):(e.consume(f),u)}function p(f){return f===96?(e.consume(f),i++,p):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(s.type="codeTextData",u(f))}}class M5{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&cc(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),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 __(e){const t={};let n=-1,r,i,s,o,c,l,u;const p=new M5(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"&&(l=r[1]._tokenizer.events,s=0,s<l.length&&l[s][1].type==="lineEndingBlank"&&(s+=2),s<l.length&&l[s][1].type==="content"))for(;++s<l.length&&l[s][1].type!=="content";)l[s][1].type==="chunkText"&&(l[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,$5(p,n)),n=t[n],u=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(o=p.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(p.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(r[1].end={...p.get(i)[1].start},c=p.slice(i,n),c.unshift(r),p.splice(i,n-i+1,c))}}return Ui(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!u}function $5(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const s=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const c=o.events,l=[],u={};let p,f,d=-1,h=n,y=0,b=0;const k=[b];for(;h;){for(;e.get(++i)[1]!==h;);s.push(i),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<c.length;)c[d][0]==="exit"&&c[d-1][0]==="enter"&&c[d][1].type===c[d-1][1].type&&c[d][1].start.line!==c[d][1].end.line&&(b=d+1,k.push(b),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(o.events=[],h?(h._tokenizer=void 0,h.previous=void 0):k.pop(),d=k.length;d--;){const g=c.slice(k[d],k[d+1]),v=s.pop();l.push([v,v+g.length-1]),e.splice(v,2,g)}for(l.reverse(),d=-1;++d<l.length;)u[y+l[d][0]]=y+l[d][1],y+=l[d][1]-l[d][0]-1;return u}const D5={resolve:z5,tokenize:B5},F5={partial:!0,tokenize:H5};function z5(e){return __(e),e}function B5(e,t){let n;return r;function r(c){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(c)}function i(c){return c===null?s(c):Ue(c)?e.check(F5,o,s)(c):(e.consume(c),i)}function s(c){return e.exit("chunkContent"),e.exit("content"),t(c)}function o(c){return e.consume(c),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function H5(e,t,n){const r=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Et(e,s,"linePrefix")}function s(o){if(o===null||Ue(o))return n(o);const c=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function P_(e,t,n,r,i,s,o,c,l){const u=l||Number.POSITIVE_INFINITY;let p=0;return f;function f(g){return g===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(g),e.exit(s),d):g===null||g===32||g===41||Oy(g)?n(g):(e.enter(r),e.enter(o),e.enter(c),e.enter("chunkString",{contentType:"string"}),b(g))}function d(g){return g===62?(e.enter(s),e.consume(g),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(c),e.enter("chunkString",{contentType:"string"}),h(g))}function h(g){return g===62?(e.exit("chunkString"),e.exit(c),d(g)):g===null||g===60||Ue(g)?n(g):(e.consume(g),g===92?y:h)}function y(g){return g===60||g===62||g===92?(e.consume(g),h):h(g)}function b(g){return!p&&(g===null||g===41||mr(g))?(e.exit("chunkString"),e.exit(c),e.exit(o),e.exit(r),t(g)):p<u&&g===40?(e.consume(g),p++,b):g===41?(e.consume(g),p--,b):g===null||g===32||g===40||Oy(g)?n(g):(e.consume(g),g===92?k:b)}function k(g){return g===40||g===41||g===92?(e.consume(g),b):b(g)}}function I_(e,t,n,r,i,s){const o=this;let c=0,l;return u;function u(h){return e.enter(r),e.enter(i),e.consume(h),e.exit(i),e.enter(s),p}function p(h){return c>999||h===null||h===91||h===93&&!l||h===94&&!c&&"_hiddenFootnoteSupport"in o.parser.constructs?n(h):h===93?(e.exit(s),e.enter(i),e.consume(h),e.exit(i),e.exit(r),t):Ue(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||Ue(h)||c++>999?(e.exit("chunkString"),p(h)):(e.consume(h),l||(l=!gt(h)),h===92?d:f)}function d(h){return h===91||h===92||h===93?(e.consume(h),c++,f):f(h)}}function A_(e,t,n,r,i,s){let o;return c;function c(d){return d===34||d===39||d===40?(e.enter(r),e.enter(i),e.consume(d),e.exit(i),o=d===40?41:d,l):n(d)}function l(d){return d===o?(e.enter(i),e.consume(d),e.exit(i),e.exit(r),t):(e.enter(s),u(d))}function u(d){return d===o?(e.exit(s),l(o)):d===null?n(d):Ue(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),Et(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(d))}function p(d){return d===o||d===null||Ue(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 zc(e,t){let n;return r;function r(i){return Ue(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):gt(i)?Et(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const U5={name:"definition",tokenize:W5},V5={partial:!0,tokenize:K5};function W5(e,t,n){const r=this;let i;return s;function s(h){return e.enter("definition"),o(h)}function o(h){return I_.call(r,e,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function c(h){return i=Za(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),l):n(h)}function l(h){return mr(h)?zc(e,u)(h):u(h)}function u(h){return P_(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function p(h){return e.attempt(V5,f,f)(h)}function f(h){return gt(h)?Et(e,d,"whitespace")(h):d(h)}function d(h){return h===null||Ue(h)?(e.exit("definition"),r.parser.defined.push(i),t(h)):n(h)}}function K5(e,t,n){return r;function r(c){return mr(c)?zc(e,i)(c):n(c)}function i(c){return A_(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function s(c){return gt(c)?Et(e,o,"whitespace")(c):o(c)}function o(c){return c===null||Ue(c)?t(c):n(c)}}const q5={name:"hardBreakEscape",tokenize:Y5};function Y5(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return Ue(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const G5={name:"headingAtx",resolve:X5,tokenize:J5};function X5(e,t){let n=e.length-2,r=3,i,s;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Ui(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function J5(e,t,n){let r=0;return i;function i(p){return e.enter("atxHeading"),s(p)}function s(p){return e.enter("atxHeadingSequence"),o(p)}function o(p){return p===35&&r++<6?(e.consume(p),o):p===null||mr(p)?(e.exit("atxHeadingSequence"),c(p)):n(p)}function c(p){return p===35?(e.enter("atxHeadingSequence"),l(p)):p===null||Ue(p)?(e.exit("atxHeading"),t(p)):gt(p)?Et(e,c,"whitespace")(p):(e.enter("atxHeadingText"),u(p))}function l(p){return p===35?(e.consume(p),l):(e.exit("atxHeadingSequence"),c(p))}function u(p){return p===null||p===35||mr(p)?(e.exit("atxHeadingText"),c(p)):(e.consume(p),u)}}const Q5=["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"],bk=["pre","script","style","textarea"],Z5={concrete:!0,name:"htmlFlow",resolveTo:nB,tokenize:rB},eB={partial:!0,tokenize:sB},tB={partial:!0,tokenize:iB};function nB(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 rB(e,t,n){const r=this;let i,s,o,c,l;return u;function u(F){return p(F)}function p(F){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(F),f}function f(F){return F===33?(e.consume(F),d):F===47?(e.consume(F),s=!0,b):F===63?(e.consume(F),i=3,r.interrupt?t:E):Li(F)?(e.consume(F),o=String.fromCharCode(F),k):n(F)}function d(F){return F===45?(e.consume(F),i=2,h):F===91?(e.consume(F),i=5,c=0,y):Li(F)?(e.consume(F),i=4,r.interrupt?t:E):n(F)}function h(F){return F===45?(e.consume(F),r.interrupt?t:E):n(F)}function y(F){const Z="CDATA[";return F===Z.charCodeAt(c++)?(e.consume(F),c===Z.length?r.interrupt?t:A:y):n(F)}function b(F){return Li(F)?(e.consume(F),o=String.fromCharCode(F),k):n(F)}function k(F){if(F===null||F===47||F===62||mr(F)){const Z=F===47,oe=o.toLowerCase();return!Z&&!s&&bk.includes(oe)?(i=1,r.interrupt?t(F):A(F)):Q5.includes(o.toLowerCase())?(i=6,Z?(e.consume(F),g):r.interrupt?t(F):A(F)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(F):s?v(F):w(F))}return F===45||Cr(F)?(e.consume(F),o+=String.fromCharCode(F),k):n(F)}function g(F){return F===62?(e.consume(F),r.interrupt?t:A):n(F)}function v(F){return gt(F)?(e.consume(F),v):U(F)}function w(F){return F===47?(e.consume(F),U):F===58||F===95||Li(F)?(e.consume(F),S):gt(F)?(e.consume(F),w):U(F)}function S(F){return F===45||F===46||F===58||F===95||Cr(F)?(e.consume(F),S):C(F)}function C(F){return F===61?(e.consume(F),N):gt(F)?(e.consume(F),C):w(F)}function N(F){return F===null||F===60||F===61||F===62||F===96?n(F):F===34||F===39?(e.consume(F),l=F,P):gt(F)?(e.consume(F),N):R(F)}function P(F){return F===l?(e.consume(F),l=null,M):F===null||Ue(F)?n(F):(e.consume(F),P)}function R(F){return F===null||F===34||F===39||F===47||F===60||F===61||F===62||F===96||mr(F)?C(F):(e.consume(F),R)}function M(F){return F===47||F===62||gt(F)?w(F):n(F)}function U(F){return F===62?(e.consume(F),L):n(F)}function L(F){return F===null||Ue(F)?A(F):gt(F)?(e.consume(F),L):n(F)}function A(F){return F===45&&i===2?(e.consume(F),D):F===60&&i===1?(e.consume(F),K):F===62&&i===4?(e.consume(F),Y):F===63&&i===3?(e.consume(F),E):F===93&&i===5?(e.consume(F),I):Ue(F)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(eB,G,V)(F)):F===null||Ue(F)?(e.exit("htmlFlowData"),V(F)):(e.consume(F),A)}function V(F){return e.check(tB,T,G)(F)}function T(F){return e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),$}function $(F){return F===null||Ue(F)?V(F):(e.enter("htmlFlowData"),A(F))}function D(F){return F===45?(e.consume(F),E):A(F)}function K(F){return F===47?(e.consume(F),o="",_):A(F)}function _(F){if(F===62){const Z=o.toLowerCase();return bk.includes(Z)?(e.consume(F),Y):A(F)}return Li(F)&&o.length<8?(e.consume(F),o+=String.fromCharCode(F),_):A(F)}function I(F){return F===93?(e.consume(F),E):A(F)}function E(F){return F===62?(e.consume(F),Y):F===45&&i===2?(e.consume(F),E):A(F)}function Y(F){return F===null||Ue(F)?(e.exit("htmlFlowData"),G(F)):(e.consume(F),Y)}function G(F){return e.exit("htmlFlow"),t(F)}}function iB(e,t,n){const r=this;return i;function i(o){return Ue(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function sB(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(mh,t,n)}}const oB={name:"htmlText",tokenize:aB};function aB(e,t,n){const r=this;let i,s,o;return c;function c(E){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(E),l}function l(E){return E===33?(e.consume(E),u):E===47?(e.consume(E),C):E===63?(e.consume(E),w):Li(E)?(e.consume(E),R):n(E)}function u(E){return E===45?(e.consume(E),p):E===91?(e.consume(E),s=0,y):Li(E)?(e.consume(E),v):n(E)}function p(E){return E===45?(e.consume(E),h):n(E)}function f(E){return E===null?n(E):E===45?(e.consume(E),d):Ue(E)?(o=f,K(E)):(e.consume(E),f)}function d(E){return E===45?(e.consume(E),h):f(E)}function h(E){return E===62?D(E):E===45?d(E):f(E)}function y(E){const Y="CDATA[";return E===Y.charCodeAt(s++)?(e.consume(E),s===Y.length?b:y):n(E)}function b(E){return E===null?n(E):E===93?(e.consume(E),k):Ue(E)?(o=b,K(E)):(e.consume(E),b)}function k(E){return E===93?(e.consume(E),g):b(E)}function g(E){return E===62?D(E):E===93?(e.consume(E),g):b(E)}function v(E){return E===null||E===62?D(E):Ue(E)?(o=v,K(E)):(e.consume(E),v)}function w(E){return E===null?n(E):E===63?(e.consume(E),S):Ue(E)?(o=w,K(E)):(e.consume(E),w)}function S(E){return E===62?D(E):w(E)}function C(E){return Li(E)?(e.consume(E),N):n(E)}function N(E){return E===45||Cr(E)?(e.consume(E),N):P(E)}function P(E){return Ue(E)?(o=P,K(E)):gt(E)?(e.consume(E),P):D(E)}function R(E){return E===45||Cr(E)?(e.consume(E),R):E===47||E===62||mr(E)?M(E):n(E)}function M(E){return E===47?(e.consume(E),D):E===58||E===95||Li(E)?(e.consume(E),U):Ue(E)?(o=M,K(E)):gt(E)?(e.consume(E),M):D(E)}function U(E){return E===45||E===46||E===58||E===95||Cr(E)?(e.consume(E),U):L(E)}function L(E){return E===61?(e.consume(E),A):Ue(E)?(o=L,K(E)):gt(E)?(e.consume(E),L):M(E)}function A(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),i=E,V):Ue(E)?(o=A,K(E)):gt(E)?(e.consume(E),A):(e.consume(E),T)}function V(E){return E===i?(e.consume(E),i=void 0,$):E===null?n(E):Ue(E)?(o=V,K(E)):(e.consume(E),V)}function T(E){return E===null||E===34||E===39||E===60||E===61||E===96?n(E):E===47||E===62||mr(E)?M(E):(e.consume(E),T)}function $(E){return E===47||E===62||mr(E)?M(E):n(E)}function D(E){return E===62?(e.consume(E),e.exit("htmlTextData"),e.exit("htmlText"),t):n(E)}function K(E){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),_}function _(E){return gt(E)?Et(e,I,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):I(E)}function I(E){return e.enter("htmlTextData"),o(E)}}const Ew={name:"labelEnd",resolveAll:dB,resolveTo:fB,tokenize:pB},lB={tokenize:hB},cB={tokenize:mB},uB={tokenize:gB};function dB(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&Ui(e,0,e.length,n),e}function fB(e,t){let n=e.length,r=0,i,s,o,c;for(;n--;)if(i=e[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=n);const l={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[s][1].start},end:{...e[o][1].end}},p={type:"labelText",start:{...e[s+r+2][1].end},end:{...e[o-2][1].start}};return c=[["enter",l,t],["enter",u,t]],c=Br(c,e.slice(s+1,s+r+3)),c=Br(c,[["enter",p,t]]),c=Br(c,Cw(t.parser.constructs.insideSpan.null,e.slice(s+r+4,o-3),t)),c=Br(c,[["exit",p,t],e[o-2],e[o-1],["exit",u,t]]),c=Br(c,e.slice(o+1)),c=Br(c,[["exit",l,t]]),Ui(e,s,e.length,c),e}function pB(e,t,n){const r=this;let i=r.events.length,s,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return c;function c(d){return s?s._inactive?f(d):(o=r.parser.defined.includes(Za(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelEnd"),l):n(d)}function l(d){return d===40?e.attempt(lB,p,o?p:f)(d):d===91?e.attempt(cB,p,o?u:f)(d):o?p(d):f(d)}function u(d){return e.attempt(uB,p,f)(d)}function p(d){return t(d)}function f(d){return s._balanced=!0,n(d)}}function hB(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),i}function i(f){return mr(f)?zc(e,s)(f):s(f)}function s(f){return f===41?p(f):P_(e,o,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function o(f){return mr(f)?zc(e,l)(f):p(f)}function c(f){return n(f)}function l(f){return f===34||f===39||f===40?A_(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):p(f)}function u(f){return mr(f)?zc(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 mB(e,t,n){const r=this;return i;function i(c){return I_.call(r,e,s,o,"reference","referenceMarker","referenceString")(c)}function s(c){return r.parser.defined.includes(Za(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(c):n(c)}function o(c){return n(c)}}function gB(e,t,n){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),i}function i(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}const yB={name:"labelStartImage",resolveAll:Ew.resolveAll,tokenize:xB};function xB(e,t,n){const r=this;return i;function i(c){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(c),e.exit("labelImageMarker"),s}function s(c){return c===91?(e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelImage"),o):n(c)}function o(c){return c===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(c):t(c)}}const wB={name:"labelStartLink",resolveAll:Ew.resolveAll,tokenize:vB};function vB(e,t,n){const r=this;return i;function i(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const Um={name:"lineEnding",tokenize:bB};function bB(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Et(e,t,"linePrefix")}}const Lf={name:"thematicBreak",tokenize:kB};function kB(e,t,n){let r=0,i;return s;function s(u){return e.enter("thematicBreak"),o(u)}function o(u){return i=u,c(u)}function c(u){return u===i?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||Ue(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===i?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),gt(u)?Et(e,c,"whitespace")(u):c(u))}}const or={continuation:{tokenize:CB},exit:_B,name:"list",tokenize:jB},SB={partial:!0,tokenize:PB},NB={partial:!0,tokenize:EB};function jB(e,t,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return c;function c(h){const y=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:My(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(Lf,n,u)(h):u(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(h)}return n(h)}function l(h){return My(h)&&++o<10?(e.consume(h),l):(!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(mh,r.interrupt?n:p,e.attempt(SB,d,f))}function p(h){return r.containerState.initialBlankLine=!0,s++,d(h)}function f(h){return gt(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),d):n(h)}function d(h){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function CB(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(mh,i,s);function i(c){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Et(e,t,"listItemIndent",r.containerState.size+1)(c)}function s(c){return r.containerState.furtherBlankLines||!gt(c)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(c)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(NB,t,o)(c))}function o(c){return r.containerState._closeFlow=!0,r.interrupt=void 0,Et(e,e.attempt(or,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function EB(e,t,n){const r=this;return Et(e,i,"listItemIndent",r.containerState.size+1);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(s):n(s)}}function _B(e){e.exit(this.containerState.type)}function PB(e,t,n){const r=this;return Et(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=r.events[r.events.length-1];return!gt(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const kk={name:"setextUnderline",resolveTo:IB,tokenize:AB};function IB(e,t){let n=e.length,r,i,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",o,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function AB(e,t,n){const r=this;let i;return s;function s(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"),i=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),c(u)}function c(u){return u===i?(e.consume(u),c):(e.exit("setextHeadingLineSequence"),gt(u)?Et(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||Ue(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const TB={tokenize:RB};function RB(e){const t=this,n=e.attempt(mh,r,e.attempt(this.parser.constructs.flowInitial,i,Et(e,e.attempt(this.parser.constructs.flow,i,e.attempt(D5,i)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const LB={resolveAll:R_()},OB=T_("string"),MB=T_("text");function T_(e){return{resolveAll:R_(e==="text"?$B:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],s=n.attempt(i,o,c);return o;function o(p){return u(p)?s(p):c(p)}function c(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),l}function l(p){return u(p)?(n.exit("data"),s(p)):(n.consume(p),l)}function u(p){if(p===null)return!0;const f=i[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 R_(e){return t;function t(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return e?e(n,r):n}}function $B(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let s=i.length,o=-1,c=0,l;for(;s--;){const u=i[s];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)c++,o--;if(o)break;o=-1}else if(u===-2)l=!0,c++;else if(u!==-1){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(c=0),c){const u={type:n===e.length||l||c<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:r.start._bufferIndex+o,_index:r.start._index+s,line:r.end.line,column:r.end.column-c,offset:r.end.offset-c},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 DB={42:or,43:or,45:or,48:or,49:or,50:or,51:or,52:or,53:or,54:or,55:or,56:or,57:or,62:j_},FB={91:U5},zB={[-2]:Hm,[-1]:Hm,32:Hm},BB={35:G5,42:Lf,45:[kk,Lf],60:Z5,61:kk,95:Lf,96:vk,126:vk},HB={38:E_,92:C_},UB={[-5]:Um,[-4]:Um,[-3]:Um,33:yB,38:E_,42:$y,60:[w5,oB],91:wB,92:[q5,C_],93:Ew,95:$y,96:T5},VB={null:[$y,LB]},WB={null:[42,95]},KB={null:[]},qB=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:WB,contentInitial:FB,disable:KB,document:DB,flow:BB,flowInitial:zB,insideSpan:VB,string:HB,text:UB},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 i={},s=[];let o=[],c=[];const l={attempt:P(C),check:P(N),consume:v,enter:w,exit:S,interrupt:P(N,{interrupt:!0})},u={code:null,containerState:{},defineSkip:b,events:[],now:y,parser:e,previous:null,sliceSerialize:d,sliceStream:h,write:f};let p=t.tokenize.call(u,l);return t.resolveAll&&s.push(t),u;function f(L){return o=Br(o,L),k(),o[o.length-1]!==null?[]:(R(t,0),u.events=Cw(s,u.events,u),u.events)}function d(L,A){return XB(h(L),A)}function h(L){return GB(o,L)}function y(){const{_bufferIndex:L,_index:A,line:V,column:T,offset:$}=r;return{_bufferIndex:L,_index:A,line:V,column:T,offset:$}}function b(L){i[L.line]=L.column,U()}function k(){let L;for(;r._index<o.length;){const A=o[r._index];if(typeof A=="string")for(L=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===L&&r._bufferIndex<A.length;)g(A.charCodeAt(r._bufferIndex));else g(A)}}function g(L){p=p(L)}function v(L){Ue(L)?(r.line++,r.column=1,r.offset+=L===-3?2:1,U()):L!==-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=L}function w(L,A){const V=A||{};return V.type=L,V.start=y(),u.events.push(["enter",V,u]),c.push(V),V}function S(L){const A=c.pop();return A.end=y(),u.events.push(["exit",A,u]),A}function C(L,A){R(L,A.from)}function N(L,A){A.restore()}function P(L,A){return V;function V(T,$,D){let K,_,I,E;return Array.isArray(T)?G(T):"tokenize"in T?G([T]):Y(T);function Y(ue){return ce;function ce(le){const ve=le!==null&&ue[le],ie=le!==null&&ue.null,de=[...Array.isArray(ve)?ve:ve?[ve]:[],...Array.isArray(ie)?ie:ie?[ie]:[]];return G(de)(le)}}function G(ue){return K=ue,_=0,ue.length===0?D:F(ue[_])}function F(ue){return ce;function ce(le){return E=M(),I=ue,ue.partial||(u.currentConstruct=ue),ue.name&&u.parser.constructs.disable.null.includes(ue.name)?oe():ue.tokenize.call(A?Object.assign(Object.create(u),A):u,l,Z,oe)(le)}}function Z(ue){return L(I,E),$}function oe(ue){return E.restore(),++_<K.length?F(K[_]):D}}}function R(L,A){L.resolveAll&&!s.includes(L)&&s.push(L),L.resolve&&Ui(u.events,A,u.events.length-A,L.resolve(u.events.slice(A),u)),L.resolveTo&&(u.events=L.resolveTo(u.events,u))}function M(){const L=y(),A=u.previous,V=u.currentConstruct,T=u.events.length,$=Array.from(c);return{from:T,restore:D};function D(){r=L,u.previous=A,u.currentConstruct=V,u.events.length=T,c=$,U()}}function U(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function GB(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,s=t.end._bufferIndex;let o;if(n===i)o=[e[n].slice(r,s)];else{if(o=e.slice(n,i),r>-1){const c=o[0];typeof c=="string"?o[0]=c.slice(r):o.shift()}s>0&&o.push(e[i].slice(0,s))}return o}function XB(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const s=e[n];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
|
|
68
|
+
`;break}case-3:{o=`\r
|
|
69
|
+
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,r.push(o)}return r.join("")}function JB(e){const r={constructs:i5([qB,...(e||{}).extensions||[]]),content:i(f5),defined:[],document:i(h5),flow:i(TB),lazy:{},string:i(OB),text:i(MB)};return r;function i(s){return o;function o(c){return YB(r,s,c)}}}function QB(e){for(;!__(e););return e}const Sk=/[\0\t\n\r]/g;function ZB(){let e=1,t="",n=!0,r;return i;function i(s,o,c){const l=[];let u,p,f,d,h;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),f=0,t="",n&&(s.charCodeAt(0)===65279&&f++,n=void 0);f<s.length;){if(Sk.lastIndex=f,u=Sk.exec(s),d=u&&u.index!==void 0?u.index:s.length,h=s.charCodeAt(d),!u){t=s.slice(f);break}if(h===10&&f===d&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),f<d&&(l.push(s.slice(f,d)),e+=d-f),h){case 0:{l.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,l.push(-2);e++<p;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}f=d+1}return c&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const eH=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function tH(e){return e.replace(eH,nH)}function nH(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return N_(n.slice(s?2:1),s?16:10)}return jw(n)||e}const L_={}.hasOwnProperty;function rH(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),iH(n)(QB(JB(n).document().write(ZB()(e,t,!0))))}function iH(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Yt),autolinkProtocol:M,autolinkEmail:M,atxHeading:s(Fe),blockQuote:s(ie),characterEscape:M,characterReference:M,codeFenced:s(de),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(de,o),codeText:s(me,o),codeTextData:M,data:M,codeFlowValue:M,definition:s(Se),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(Ve),hardBreakEscape:s(ze),hardBreakTrailing:s(ze),htmlFlow:s(ht,o),htmlFlowData:M,htmlText:s(ht,o),htmlTextData:M,image:s(yn),label:o,link:s(Yt),listItem:s(Rt),listItemValue:d,listOrdered:s(at,f),listUnordered:s(at),paragraph:s(Zn),reference:F,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(Fe),strong:s(jn),thematicBreak:s(Gt)},exit:{atxHeading:l(),atxHeadingSequence:C,autolink:l(),autolinkEmail:ve,autolinkProtocol:le,blockQuote:l(),characterEscapeValue:U,characterReferenceMarkerHexadecimal:oe,characterReferenceMarkerNumeric:oe,characterReferenceValue:ue,characterReference:ce,codeFenced:l(k),codeFencedFence:b,codeFencedFenceInfo:h,codeFencedFenceMeta:y,codeFlowValue:U,codeIndented:l(g),codeText:l($),codeTextData:U,data:U,definition:l(),definitionDestinationString:S,definitionLabelString:v,definitionTitleString:w,emphasis:l(),hardBreakEscape:l(A),hardBreakTrailing:l(A),htmlFlow:l(V),htmlFlowData:U,htmlText:l(T),htmlTextData:U,image:l(K),label:I,labelText:_,lineEnding:L,link:l(D),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:Z,resourceDestinationString:E,resourceTitleString:Y,resource:G,setextHeading:l(R),setextHeadingLineSequence:P,setextHeadingText:N,strong:l(),thematicBreak:l()}};O_(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(ne){let fe={type:"root",children:[]};const Le={stack:[fe],tokenStack:[],config:t,enter:c,exit:u,buffer:o,resume:p,data:n},Ye=[];let We=-1;for(;++We<ne.length;)if(ne[We][1].type==="listOrdered"||ne[We][1].type==="listUnordered")if(ne[We][0]==="enter")Ye.push(We);else{const Vt=Ye.pop();We=i(ne,Vt,We)}for(We=-1;++We<ne.length;){const Vt=t[ne[We][0]];L_.call(Vt,ne[We][1].type)&&Vt[ne[We][1].type].call(Object.assign({sliceSerialize:ne[We][2].sliceSerialize},Le),ne[We][1])}if(Le.tokenStack.length>0){const Vt=Le.tokenStack[Le.tokenStack.length-1];(Vt[1]||Nk).call(Le,void 0,Vt[0])}for(fe.position={start:Ds(ne.length>0?ne[0][1].start:{line:1,column:1,offset:0}),end:Ds(ne.length>0?ne[ne.length-2][1].end:{line:1,column:1,offset:0})},We=-1;++We<t.transforms.length;)fe=t.transforms[We](fe)||fe;return fe}function i(ne,fe,Le){let Ye=fe-1,We=-1,Vt=!1,Xt,sn,yt,Cn;for(;++Ye<=Le;){const xe=ne[Ye];switch(xe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{xe[0]==="enter"?We++:We--,Cn=void 0;break}case"lineEndingBlank":{xe[0]==="enter"&&(Xt&&!Cn&&!We&&!yt&&(yt=Ye),Cn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Cn=void 0}if(!We&&xe[0]==="enter"&&xe[1].type==="listItemPrefix"||We===-1&&xe[0]==="exit"&&(xe[1].type==="listUnordered"||xe[1].type==="listOrdered")){if(Xt){let st=Ye;for(sn=void 0;st--;){const Lt=ne[st];if(Lt[1].type==="lineEnding"||Lt[1].type==="lineEndingBlank"){if(Lt[0]==="exit")continue;sn&&(ne[sn][1].type="lineEndingBlank",Vt=!0),Lt[1].type="lineEnding",sn=st}else if(!(Lt[1].type==="linePrefix"||Lt[1].type==="blockQuotePrefix"||Lt[1].type==="blockQuotePrefixWhitespace"||Lt[1].type==="blockQuoteMarker"||Lt[1].type==="listItemIndent"))break}yt&&(!sn||yt<sn)&&(Xt._spread=!0),Xt.end=Object.assign({},sn?ne[sn][1].start:xe[1].end),ne.splice(sn||Ye,0,["exit",Xt,xe[2]]),Ye++,Le++}if(xe[1].type==="listItemPrefix"){const st={type:"listItem",_spread:!1,start:Object.assign({},xe[1].start),end:void 0};Xt=st,ne.splice(Ye,0,["enter",st,xe[2]]),Ye++,Le++,yt=void 0,Cn=!0}}}return ne[fe][1]._spread=Vt,Le}function s(ne,fe){return Le;function Le(Ye){c.call(this,ne(Ye),Ye),fe&&fe.call(this,Ye)}}function o(){this.stack.push({type:"fragment",children:[]})}function c(ne,fe,Le){this.stack[this.stack.length-1].children.push(ne),this.stack.push(ne),this.tokenStack.push([fe,Le||void 0]),ne.position={start:Ds(fe.start),end:void 0}}function l(ne){return fe;function fe(Le){ne&&ne.call(this,Le),u.call(this,Le)}}function u(ne,fe){const Le=this.stack.pop(),Ye=this.tokenStack.pop();if(Ye)Ye[0].type!==ne.type&&(fe?fe.call(this,ne,Ye[0]):(Ye[1]||Nk).call(this,ne,Ye[0]));else throw new Error("Cannot close `"+ne.type+"` ("+Fc({start:ne.start,end:ne.end})+"): it’s not open");Le.position.end=Ds(ne.end)}function p(){return n5(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function d(ne){if(this.data.expectingFirstListItemValue){const fe=this.stack[this.stack.length-2];fe.start=Number.parseInt(this.sliceSerialize(ne),10),this.data.expectingFirstListItemValue=void 0}}function h(){const ne=this.resume(),fe=this.stack[this.stack.length-1];fe.lang=ne}function y(){const ne=this.resume(),fe=this.stack[this.stack.length-1];fe.meta=ne}function b(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function k(){const ne=this.resume(),fe=this.stack[this.stack.length-1];fe.value=ne.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){const ne=this.resume(),fe=this.stack[this.stack.length-1];fe.value=ne.replace(/(\r?\n|\r)$/g,"")}function v(ne){const fe=this.resume(),Le=this.stack[this.stack.length-1];Le.label=fe,Le.identifier=Za(this.sliceSerialize(ne)).toLowerCase()}function w(){const ne=this.resume(),fe=this.stack[this.stack.length-1];fe.title=ne}function S(){const ne=this.resume(),fe=this.stack[this.stack.length-1];fe.url=ne}function C(ne){const fe=this.stack[this.stack.length-1];if(!fe.depth){const Le=this.sliceSerialize(ne).length;fe.depth=Le}}function N(){this.data.setextHeadingSlurpLineEnding=!0}function P(ne){const fe=this.stack[this.stack.length-1];fe.depth=this.sliceSerialize(ne).codePointAt(0)===61?1:2}function R(){this.data.setextHeadingSlurpLineEnding=void 0}function M(ne){const Le=this.stack[this.stack.length-1].children;let Ye=Le[Le.length-1];(!Ye||Ye.type!=="text")&&(Ye=xn(),Ye.position={start:Ds(ne.start),end:void 0},Le.push(Ye)),this.stack.push(Ye)}function U(ne){const fe=this.stack.pop();fe.value+=this.sliceSerialize(ne),fe.position.end=Ds(ne.end)}function L(ne){const fe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Le=fe.children[fe.children.length-1];Le.position.end=Ds(ne.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(fe.type)&&(M.call(this,ne),U.call(this,ne))}function A(){this.data.atHardBreak=!0}function V(){const ne=this.resume(),fe=this.stack[this.stack.length-1];fe.value=ne}function T(){const ne=this.resume(),fe=this.stack[this.stack.length-1];fe.value=ne}function $(){const ne=this.resume(),fe=this.stack[this.stack.length-1];fe.value=ne}function D(){const ne=this.stack[this.stack.length-1];if(this.data.inReference){const fe=this.data.referenceType||"shortcut";ne.type+="Reference",ne.referenceType=fe,delete ne.url,delete ne.title}else delete ne.identifier,delete ne.label;this.data.referenceType=void 0}function K(){const ne=this.stack[this.stack.length-1];if(this.data.inReference){const fe=this.data.referenceType||"shortcut";ne.type+="Reference",ne.referenceType=fe,delete ne.url,delete ne.title}else delete ne.identifier,delete ne.label;this.data.referenceType=void 0}function _(ne){const fe=this.sliceSerialize(ne),Le=this.stack[this.stack.length-2];Le.label=tH(fe),Le.identifier=Za(fe).toLowerCase()}function I(){const ne=this.stack[this.stack.length-1],fe=this.resume(),Le=this.stack[this.stack.length-1];if(this.data.inReference=!0,Le.type==="link"){const Ye=ne.children;Le.children=Ye}else Le.alt=fe}function E(){const ne=this.resume(),fe=this.stack[this.stack.length-1];fe.url=ne}function Y(){const ne=this.resume(),fe=this.stack[this.stack.length-1];fe.title=ne}function G(){this.data.inReference=void 0}function F(){this.data.referenceType="collapsed"}function Z(ne){const fe=this.resume(),Le=this.stack[this.stack.length-1];Le.label=fe,Le.identifier=Za(this.sliceSerialize(ne)).toLowerCase(),this.data.referenceType="full"}function oe(ne){this.data.characterReferenceType=ne.type}function ue(ne){const fe=this.sliceSerialize(ne),Le=this.data.characterReferenceType;let Ye;Le?(Ye=N_(fe,Le==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ye=jw(fe);const We=this.stack[this.stack.length-1];We.value+=Ye}function ce(ne){const fe=this.stack.pop();fe.position.end=Ds(ne.end)}function le(ne){U.call(this,ne);const fe=this.stack[this.stack.length-1];fe.url=this.sliceSerialize(ne)}function ve(ne){U.call(this,ne);const fe=this.stack[this.stack.length-1];fe.url="mailto:"+this.sliceSerialize(ne)}function ie(){return{type:"blockquote",children:[]}}function de(){return{type:"code",lang:null,meta:null,value:""}}function me(){return{type:"inlineCode",value:""}}function Se(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ve(){return{type:"emphasis",children:[]}}function Fe(){return{type:"heading",depth:0,children:[]}}function ze(){return{type:"break"}}function ht(){return{type:"html",value:""}}function yn(){return{type:"image",title:null,url:"",alt:null}}function Yt(){return{type:"link",title:null,url:"",children:[]}}function at(ne){return{type:"list",ordered:ne.type==="listOrdered",start:null,spread:ne._spread,children:[]}}function Rt(ne){return{type:"listItem",spread:ne._spread,checked:null,children:[]}}function Zn(){return{type:"paragraph",children:[]}}function jn(){return{type:"strong",children:[]}}function xn(){return{type:"text",value:""}}function Gt(){return{type:"thematicBreak"}}}function Ds(e){return{line:e.line,column:e.column,offset:e.offset}}function O_(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?O_(e,r):sH(e,r)}}function sH(e,t){let n;for(n in t)if(L_.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 Nk(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Fc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Fc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Fc({start:t.start,end:t.end})+") is still open")}function oH(e){const t=this;t.parser=n;function n(r){return rH(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function aH(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 lH(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
70
|
+
`}]}function cH(e,t){const n=t.value?t.value+`
|
|
71
|
+
`:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function uH(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function dH(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function fH(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=Cl(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let o,c=e.footnoteCounts.get(r);c===void 0?(c=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=s+1,c+=1,e.footnoteCounts.set(r,c);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(c>1?"-"+c:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,l);const u={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,u),e.applyData(t,u)}function pH(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 hH(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function M_(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=r:i.push({type:"text",value:r}),i}function mH(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return M_(e,t);const i={src:Cl(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)}function gH(e,t){const n={src:Cl(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 yH(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 xH(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return M_(e,t);const i={href:Cl(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function wH(e,t){const n={href:Cl(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 vH(e,t,n){const r=e.all(t),i=n?bH(n):$_(t),s={},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:[]}),s.className=["task-list-item"]}let c=-1;for(;++c<r.length;){const p=r[c];(i||c!==0||p.type!=="element"||p.tagName!=="p")&&o.push({type:"text",value:`
|
|
72
|
+
`}),p.type==="element"&&p.tagName==="p"&&!i?o.push(...p.children):o.push(p)}const l=r[r.length-1];l&&(i||l.type!=="element"||l.tagName!=="p")&&o.push({type:"text",value:`
|
|
73
|
+
`});const u={type:"element",tagName:"li",properties:s,children:o};return e.patch(t,u),e.applyData(t,u)}function bH(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=$_(n[r])}return t}function $_(e){const t=e.spread;return t??e.children.length>1}function kH(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const o=r[i];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,s),e.applyData(t,s)}function SH(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function NH(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function jH(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function CH(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],o),i.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},c=bw(t.children[1]),l=y_(t.children[t.children.length-1]);c&&l&&(o.position={start:c,end:l}),i.push(o)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)}function EH(e,t,n){const r=n?n.children:void 0,s=(r?r.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,c=o?o.length:t.children.length;let l=-1;const u=[];for(;++l<c;){const f=t.children[l],d={},h=o?o[l]:void 0;h&&(d.align=h);let y={type:"element",tagName:s,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 _H(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const jk=9,Ck=32;function PH(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const s=[];for(;r;)s.push(Ek(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return s.push(Ek(t.slice(i),i>0,!1)),s.join("")}function Ek(e,t,n){let r=0,i=e.length;if(t){let s=e.codePointAt(r);for(;s===jk||s===Ck;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(i-1);for(;s===jk||s===Ck;)i--,s=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function IH(e,t){const n={type:"text",value:PH(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function AH(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const TH={blockquote:aH,break:lH,code:cH,delete:uH,emphasis:dH,footnoteReference:fH,heading:pH,html:hH,imageReference:mH,image:gH,inlineCode:yH,linkReference:xH,link:wH,listItem:vH,list:kH,paragraph:SH,root:NH,strong:jH,table:CH,tableCell:_H,tableRow:EH,text:IH,thematicBreak:AH,toml:nf,yaml:nf,definition:nf,footnoteDefinition:nf};function nf(){}const D_=-1,gh=0,Bc=1,bp=2,_w=3,Pw=4,Iw=5,Aw=6,F_=7,z_=8,_k=typeof self=="object"?self:globalThis,RH=(e,t)=>{const n=(i,s)=>(e.set(s,i),i),r=i=>{if(e.has(i))return e.get(i);const[s,o]=t[i];switch(s){case gh:case D_:return n(o,i);case Bc:{const c=n([],i);for(const l of o)c.push(r(l));return c}case bp:{const c=n({},i);for(const[l,u]of o)c[r(l)]=r(u);return c}case _w:return n(new Date(o),i);case Pw:{const{source:c,flags:l}=o;return n(new RegExp(c,l),i)}case Iw:{const c=n(new Map,i);for(const[l,u]of o)c.set(r(l),r(u));return c}case Aw:{const c=n(new Set,i);for(const l of o)c.add(r(l));return c}case F_:{const{name:c,message:l}=o;return n(new _k[c](l),i)}case z_:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:c}=new Uint8Array(o);return n(new DataView(c),o)}}return n(new _k[s](o),i)};return r},Pk=e=>RH(new Map,e)(0),xa="",{toString:LH}={},{keys:OH}=Object,uc=e=>{const t=typeof e;if(t!=="object"||!e)return[gh,t];const n=LH.call(e).slice(8,-1);switch(n){case"Array":return[Bc,xa];case"Object":return[bp,xa];case"Date":return[_w,xa];case"RegExp":return[Pw,xa];case"Map":return[Iw,xa];case"Set":return[Aw,xa];case"DataView":return[Bc,n]}return n.includes("Array")?[Bc,n]:n.includes("Error")?[F_,n]:[bp,n]},rf=([e,t])=>e===gh&&(t==="function"||t==="symbol"),MH=(e,t,n,r)=>{const i=(o,c)=>{const l=r.push(o)-1;return n.set(c,l),l},s=o=>{if(n.has(o))return n.get(o);let[c,l]=uc(o);switch(c){case gh:{let p=o;switch(l){case"bigint":c=z_,p=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);p=null;break;case"undefined":return i([D_],o)}return i([c,p],o)}case Bc:{if(l){let d=o;return l==="DataView"?d=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(d=new Uint8Array(o)),i([l,[...d]],o)}const p=[],f=i([c,p],o);for(const d of o)p.push(s(d));return f}case bp:{if(l)switch(l){case"BigInt":return i([l,o.toString()],o);case"Boolean":case"Number":case"String":return i([l,o.valueOf()],o)}if(t&&"toJSON"in o)return s(o.toJSON());const p=[],f=i([c,p],o);for(const d of OH(o))(e||!rf(uc(o[d])))&&p.push([s(d),s(o[d])]);return f}case _w:return i([c,o.toISOString()],o);case Pw:{const{source:p,flags:f}=o;return i([c,{source:p,flags:f}],o)}case Iw:{const p=[],f=i([c,p],o);for(const[d,h]of o)(e||!(rf(uc(d))||rf(uc(h))))&&p.push([s(d),s(h)]);return f}case Aw:{const p=[],f=i([c,p],o);for(const d of o)(e||!rf(uc(d)))&&p.push(s(d));return f}}const{message:u}=o;return i([c,{name:l,message:u}],o)};return s},Ik=(e,{json:t,lossy:n}={})=>{const r=[];return MH(!(t||n),!!t,new Map,r)(e),r},kp=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Pk(Ik(e,t)):structuredClone(e):(e,t)=>Pk(Ik(e,t));function $H(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 DH(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function FH(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||$H,r=e.options.footnoteBackLabel||DH,i=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},c=[];let l=-1;for(;++l<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[l]);if(!u)continue;const p=e.all(u),f=String(u.identifier).toUpperCase(),d=Cl(f.toLowerCase());let h=0;const y=[],b=e.footnoteCounts.get(f);for(;b!==void 0&&++h<=b;){y.length>0&&y.push({type:"text",value:" "});let v=typeof n=="string"?n:n(l,h);typeof v=="string"&&(v={type:"text",value:v}),y.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+d+(h>1?"-"+h:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,h),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const k=p[p.length-1];if(k&&k.type==="element"&&k.tagName==="p"){const v=k.children[k.children.length-1];v&&v.type==="text"?v.value+=" ":k.children.push({type:"text",value:" "}),k.children.push(...y)}else p.push(...y);const g={type:"element",tagName:"li",properties:{id:t+"fn-"+d},children:e.wrap(p,!0)};e.patch(u,g),c.push(g)}if(c.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...kp(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
74
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(c,!0)},{type:"text",value:`
|
|
75
|
+
`}]}}const B_=function(e){if(e==null)return UH;if(typeof e=="function")return yh(e);if(typeof e=="object")return Array.isArray(e)?zH(e):BH(e);if(typeof e=="string")return HH(e);throw new Error("Expected function, string, or object as test")};function zH(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=B_(e[n]);return yh(r);function r(...i){let s=-1;for(;++s<t.length;)if(t[s].apply(this,i))return!0;return!1}}function BH(e){const t=e;return yh(n);function n(r){const i=r;let s;for(s in e)if(i[s]!==t[s])return!1;return!0}}function HH(e){return yh(t);function t(n){return n&&n.type===e}}function yh(e){return t;function t(n,r,i){return!!(VH(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function UH(){return!0}function VH(e){return e!==null&&typeof e=="object"&&"type"in e}const H_=[],WH=!0,Ak=!1,KH="skip";function qH(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const s=B_(i),o=r?-1:1;c(e,void 0,[])();function c(l,u,p){const f=l&&typeof l=="object"?l:{};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 ("+(l.type+(h?"<"+h+">":""))+")"})}return d;function d(){let h=H_,y,b,k;if((!t||s(l,u,p[p.length-1]||void 0))&&(h=YH(n(l,p)),h[0]===Ak))return h;if("children"in l&&l.children){const g=l;if(g.children&&h[0]!==KH)for(b=(r?g.children.length:-1)+o,k=p.concat(g);b>-1&&b<g.children.length;){const v=g.children[b];if(y=c(v,b,k)(),y[0]===Ak)return y;b=typeof y[1]=="number"?y[1]:b+o}}return h}}}function YH(e){return Array.isArray(e)?e:typeof e=="number"?[WH,e]:e==null?H_:[e]}function U_(e,t,n,r){let i,s,o;typeof t=="function"&&typeof n!="function"?(s=void 0,o=t,i=n):(s=t,o=n,i=r),qH(e,s,c,i);function c(l,u){const p=u[u.length-1],f=p?p.children.indexOf(l):void 0;return o(l,f,p)}}const Dy={}.hasOwnProperty,GH={};function XH(e,t){const n=t||GH,r=new Map,i=new Map,s=new Map,o={...TH,...n.handlers},c={all:u,applyData:QH,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:l,options:n,patch:JH,wrap:e8};return U_(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const f=p.type==="definition"?r:i,d=String(p.identifier).toUpperCase();f.has(d)||f.set(d,p)}}),c;function l(p,f){const d=p.type,h=c.handlers[d];if(Dy.call(c.handlers,d)&&h)return h(c,p,f);if(c.options.passThrough&&c.options.passThrough.includes(d)){if("children"in p){const{children:b,...k}=p,g=kp(k);return g.children=c.all(p),g}return kp(p)}return(c.options.unknownHandler||ZH)(c,p,f)}function u(p){const f=[];if("children"in p){const d=p.children;let h=-1;for(;++h<d.length;){const y=c.one(d[h],p);if(y){if(h&&d[h-1].type==="break"&&(!Array.isArray(y)&&y.type==="text"&&(y.value=Tk(y.value)),!Array.isArray(y)&&y.type==="element")){const b=y.children[0];b&&b.type==="text"&&(b.value=Tk(b.value))}Array.isArray(y)?f.push(...y):f.push(y)}}}return f}}function JH(e,t){e.position&&(t.position=L4(e))}function QH(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,s=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const o="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:o}}n.type==="element"&&s&&Object.assign(n.properties,kp(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function ZH(e,t){const n=t.data||{},r="value"in t&&!(Dy.call(n,"hProperties")||Dy.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 e8(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 Tk(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Rk(e,t){const n=XH(e,t),r=n.one(e,void 0),i=FH(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
|
|
79
|
+
`},i),s}function t8(e,t){return e&&"run"in e?async function(n,r){const i=Rk(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Rk(n,{file:r,...e||t})}}function Lk(e){if(e)throw e}var Of=Object.prototype.hasOwnProperty,V_=Object.prototype.toString,Ok=Object.defineProperty,Mk=Object.getOwnPropertyDescriptor,$k=function(t){return typeof Array.isArray=="function"?Array.isArray(t):V_.call(t)==="[object Array]"},Dk=function(t){if(!t||V_.call(t)!=="[object Object]")return!1;var n=Of.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Of.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||Of.call(t,i)},Fk=function(t,n){Ok&&n.name==="__proto__"?Ok(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},zk=function(t,n){if(n==="__proto__")if(Of.call(t,n)){if(Mk)return Mk(t,n).value}else return;return t[n]},n8=function e(){var t,n,r,i,s,o,c=arguments[0],l=1,u=arguments.length,p=!1;for(typeof c=="boolean"&&(p=c,c=arguments[1]||{},l=2),(c==null||typeof c!="object"&&typeof c!="function")&&(c={});l<u;++l)if(t=arguments[l],t!=null)for(n in t)r=zk(c,n),i=zk(t,n),c!==i&&(p&&i&&(Dk(i)||(s=$k(i)))?(s?(s=!1,o=r&&$k(r)?r:[]):o=r&&Dk(r)?r:{},Fk(c,{name:n,newValue:e(p,o,i)})):typeof i<"u"&&Fk(c,{name:n,newValue:i}));return c};const Vm=mo(n8);function Fy(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 r8(){const e=[],t={run:n,use:r};return t;function n(...i){let s=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);c(null,...i);function c(l,...u){const p=e[++s];let f=-1;if(l){o(l);return}for(;++f<i.length;)(u[f]===null||u[f]===void 0)&&(u[f]=i[f]);i=u,p?i8(p,c)(...u):o(null,...u)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function i8(e,t){let n;return r;function r(...o){const c=e.length>o.length;let l;c&&o.push(i);try{l=e.apply(this,o)}catch(u){const p=u;if(c&&n)throw p;return i(p)}c||(l&&l.then&&typeof l.then=="function"?l.then(s,i):l instanceof Error?i(l):s(l))}function i(o,...c){n||(n=!0,t(o,...c))}function s(o){i(null,o)}}const Pi={basename:s8,dirname:o8,extname:a8,join:l8,sep:"/"};function s8(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,i=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,c=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else o<0&&(s=!0,o=i+1),c>-1&&(e.codePointAt(i)===t.codePointAt(c--)?c<0&&(r=i):(c=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function o8(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 a8(e){Hu(e);let t=e.length,n=-1,r=0,i=-1,s=0,o;for(;t--;){const c=e.codePointAt(t);if(c===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),c===46?i<0?i=t:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function l8(...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?".":c8(n)}function c8(e){Hu(e);const t=e.codePointAt(0)===47;let n=u8(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function u8(e,t){let n="",r=0,i=-1,s=0,o=-1,c,l;for(;++o<=e.length;){if(o<e.length)c=e.codePointAt(o);else{if(c===47)break;c=47}if(c===47){if(!(i===o-1||s===1))if(i!==o-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=o,s=0;continue}}else if(n.length>0){n="",r=0,i=o,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,s=0}else c===46&&s>-1?s++:s=-1}return n}function Hu(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const d8={cwd:f8};function f8(){return"/"}function zy(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function p8(e){if(typeof e=="string")e=new URL(e);else if(!zy(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 h8(e)}function h8(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const Wm=["history","path","basename","stem","extname","dirname"];class W_{constructor(t){let n;t?zy(t)?n={path:t}:typeof t=="string"||m8(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":d8.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Wm.length;){const s=Wm[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)Wm.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Pi.basename(this.path):void 0}set basename(t){qm(t,"basename"),Km(t,"basename"),this.path=Pi.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Pi.dirname(this.path):void 0}set dirname(t){Bk(this.basename,"dirname"),this.path=Pi.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Pi.extname(this.path):void 0}set extname(t){if(Km(t,"extname"),Bk(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=Pi.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){zy(t)&&(t=p8(t)),qm(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Pi.basename(this.path,this.extname):void 0}set stem(t){qm(t,"stem"),Km(t,"stem"),this.path=Pi.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new Un(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Km(e,t){if(e&&e.includes(Pi.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Pi.sep+"`")}function qm(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Bk(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function m8(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const g8=function(e){const r=this.constructor.prototype,i=r[e],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s},y8={}.hasOwnProperty;class Tw extends g8{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=r8()}copy(){const t=new Tw;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Vm(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Xm("data",this.frozen),this.namespace[t]=n,this):y8.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Xm("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=sf(t),r=this.parser||this.Parser;return Ym("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Ym("process",this.parser||this.Parser),Gm("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,o){const c=sf(t),l=r.parse(c);r.run(l,c,function(p,f,d){if(p||!f||!d)return u(p);const h=f,y=r.stringify(h,d);v8(y)?d.value=y:d.result=y,u(p,d)});function u(p,f){p||!f?o(p):s?s(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),Ym("processSync",this.parser||this.Parser),Gm("processSync",this.compiler||this.Compiler),this.process(t,i),Uk("processSync","process",n),r;function i(s,o){n=!0,Lk(s),r=o}}run(t,n,r){Hk(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(o,c){const l=sf(n);i.run(t,l,u);function u(p,f,d){const h=f||t;p?c(p):o?o(h):r(void 0,h,d)}}}runSync(t,n){let r=!1,i;return this.run(t,n,s),Uk("runSync","run",r),i;function s(o,c){Lk(o),i=c,r=!0}}stringify(t,n){this.freeze();const r=sf(n),i=this.compiler||this.Compiler;return Gm("stringify",i),Hk(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(Xm("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?c(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function s(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[p,...f]=u;l(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");c(u.plugins),u.settings&&(i.settings=Vm(!0,i.settings,u.settings))}function c(u){let p=-1;if(u!=null)if(Array.isArray(u))for(;++p<u.length;){const f=u[p];s(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,p){let f=-1,d=-1;for(;++f<r.length;)if(r[f][0]===u){d=f;break}if(d===-1)r.push([u,...p]);else if(p.length>0){let[h,...y]=p;const b=r[d][1];Fy(b)&&Fy(h)&&(h=Vm(!0,b,h)),r[d]=[u,h,...y]}}}}const x8=new Tw().freeze();function Ym(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Gm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Xm(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 Hk(e){if(!Fy(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Uk(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function sf(e){return w8(e)?e:new W_(e)}function w8(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function v8(e){return typeof e=="string"||b8(e)}function b8(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const k8="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Vk=[],Wk={allowDangerousHtml:!0},S8=/^(https?|ircs?|mailto|xmpp)$/i,N8=[{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 Uu(e){const t=j8(e),n=C8(e);return E8(t.runSync(t.parse(n),n),e)}function j8(e){const t=e.rehypePlugins||Vk,n=e.remarkPlugins||Vk,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Wk}:Wk;return x8().use(oH).use(n).use(t8,r).use(t)}function C8(e){const t=e.children||"",n=new W_;return typeof t=="string"&&(n.value=t),n}function E8(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,s=t.disallowedElements,o=t.skipHtml,c=t.unwrapDisallowed,l=t.urlTransform||_8;for(const p of N8)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+k8+p.id,void 0);return U_(e,u),F4(e,{Fragment:a.Fragment,components:i,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 Bm)if(Object.hasOwn(Bm,h)&&Object.hasOwn(p.properties,h)){const y=p.properties[h],b=Bm[h];(b===null||b.includes(p.tagName))&&(p.properties[h]=l(String(y||""),h,p))}}if(p.type==="element"){let h=n?!n.includes(p.tagName):s?s.includes(p.tagName):!1;if(!h&&r&&typeof f=="number"&&(h=!r(p,f,d)),h&&d&&typeof f=="number")return c&&p.children?d.children.splice(f,1,...p.children):d.children.splice(f,1),f}}}function _8(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||S8.test(e.slice(0,t))?e:""}function P8(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function Sp(e){if(e==null)return"null";if(typeof e!="object")return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(r=>Sp(r)).join(",")}]`;const t=e;return`{${Object.keys(t).sort().map(r=>`${JSON.stringify(r)}:${Sp(t[r])}`).join(",")}}`}function Kk(e){return Sp({id:e.id,type:e.type,position:e.position,data:e.data,parentId:e.parentId,extent:e.extent,sourcePosition:e.sourcePosition,targetPosition:e.targetPosition,hidden:e.hidden})}function wu(e){const t=e.sourceHandle??"",n=e.targetHandle??"";return`${e.source}|${t}|${e.target}|${n}`}function qk(e){return Sp({source:e.source,target:e.target,sourceHandle:e.sourceHandle??null,targetHandle:e.targetHandle??null,type:e.type,label:e.label,data:e.data,markerStart:e.markerStart,markerEnd:e.markerEnd,animated:e.animated,hidden:e.hidden,style:e.style})}function Yk(e,t){return!P8(t)||!("selected"in t)||t.selected===e.selected?e:{...e,selected:!!t.selected}}function Gk(e,t=!1){const n=new Map;for(const r of e){const i=wu(r);if(t&&n.has(i))throw new Error(`存在重复连线键: ${i}`);n.set(i,r)}return n}function I8(e,t,n,r){const i=new Map(e.map(v=>[v.id,v])),s=new Set(n.map(v=>v.id)),o=new Set,c=[],l=[],u=n.map(v=>{const w=i.get(v.id);return w?Kk(w)===Kk(v)?(o.add(v.id),w):(l.push(v.id),Yk(v,w)):(c.push(v.id),v)}),p=Gk(t),f=Gk(r,!0),d=new Set,h=[],y=[],b=r.map(v=>{const w=wu(v),S=p.get(w);return S?qk(S)===qk(v)?(d.add(w),S):(y.push(w),Yk(v,S)):(h.push(w),v)}),k=e.filter(v=>!s.has(v.id)).map(v=>v.id),g=t.map(v=>wu(v)).filter(v=>!f.has(v));return{nodes:u,edges:b,changes:{addedNodeIds:c,updatedNodeIds:l,removedNodeIds:k,addedEdgeKeys:h,updatedEdgeKeys:y,removedEdgeKeys:g},stats:{nodeAdded:c.length,nodeRemoved:k.length,nodeReused:o.size,edgeAdded:h.length,edgeRemoved:g.length,edgeReused:d.size,nextEdgeCount:f.size}}}/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */function K_(e){return typeof e>"u"||e===null}function A8(e){return typeof e=="object"&&e!==null}function T8(e){return Array.isArray(e)?e:K_(e)?[]:[e]}function R8(e,t){var n,r,i,s;if(t)for(s=Object.keys(t),n=0,r=s.length;n<r;n+=1)i=s[n],e[i]=t[i];return e}function L8(e,t){var n="",r;for(r=0;r<t;r+=1)n+=e;return n}function O8(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var M8=K_,$8=A8,D8=T8,F8=L8,z8=O8,B8=R8,mn={isNothing:M8,isObject:$8,toArray:D8,repeat:F8,isNegativeZero:z8,extend:B8};function q_(e,t){var n="",r=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(n+=`
|
|
80
|
+
|
|
81
|
+
`+e.mark.snippet),r+" "+n):r}function vu(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=q_(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}vu.prototype=Object.create(Error.prototype);vu.prototype.constructor=vu;vu.prototype.toString=function(t){return this.name+": "+q_(this,t)};var Gn=vu;function Jm(e,t,n,r,i){var s="",o="",c=Math.floor(i/2)-1;return r-t>c&&(s=" ... ",t=r-c+s.length),n-r>c&&(o=" ...",n=r+c-o.length),{str:s+e.slice(t,n).replace(/\t/g,"→")+o,pos:r-t+s.length}}function Qm(e,t){return mn.repeat(" ",t-e.length)+e}function H8(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);for(var n=/\r?\n|\r|\0/g,r=[0],i=[],s,o=-1;s=n.exec(e.buffer);)i.push(s.index),r.push(s.index+s[0].length),e.position<=s.index&&o<0&&(o=r.length-2);o<0&&(o=r.length-1);var c="",l,u,p=Math.min(e.line+t.linesAfter,i.length).toString().length,f=t.maxLength-(t.indent+p+3);for(l=1;l<=t.linesBefore&&!(o-l<0);l++)u=Jm(e.buffer,r[o-l],i[o-l],e.position-(r[o]-r[o-l]),f),c=mn.repeat(" ",t.indent)+Qm((e.line-l+1).toString(),p)+" | "+u.str+`
|
|
82
|
+
`+c;for(u=Jm(e.buffer,r[o],i[o],e.position,f),c+=mn.repeat(" ",t.indent)+Qm((e.line+1).toString(),p)+" | "+u.str+`
|
|
83
|
+
`,c+=mn.repeat("-",t.indent+p+3+u.pos)+`^
|
|
84
|
+
`,l=1;l<=t.linesAfter&&!(o+l>=i.length);l++)u=Jm(e.buffer,r[o+l],i[o+l],e.position-(r[o]-r[o+l]),f),c+=mn.repeat(" ",t.indent)+Qm((e.line+l+1).toString(),p)+" | "+u.str+`
|
|
85
|
+
`;return c.replace(/\n$/,"")}var U8=H8,V8=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],W8=["scalar","sequence","mapping"];function K8(e){var t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(r){t[String(r)]=n})}),t}function q8(e,t){if(t=t||{},Object.keys(t).forEach(function(n){if(V8.indexOf(n)===-1)throw new Gn('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=K8(t.styleAliases||null),W8.indexOf(this.kind)===-1)throw new Gn('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var An=q8;function Xk(e,t){var n=[];return e[t].forEach(function(r){var i=n.length;n.forEach(function(s,o){s.tag===r.tag&&s.kind===r.kind&&s.multi===r.multi&&(i=o)}),n[i]=r}),n}function Y8(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},t,n;function r(i){i.multi?(e.multi[i.kind].push(i),e.multi.fallback.push(i)):e[i.kind][i.tag]=e.fallback[i.tag]=i}for(t=0,n=arguments.length;t<n;t+=1)arguments[t].forEach(r);return e}function By(e){return this.extend(e)}By.prototype.extend=function(t){var n=[],r=[];if(t instanceof An)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 Gn("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(s){if(!(s instanceof An))throw new Gn("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(s.loadKind&&s.loadKind!=="scalar")throw new Gn("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(s.multi)throw new Gn("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),r.forEach(function(s){if(!(s instanceof An))throw new Gn("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(By.prototype);return i.implicit=(this.implicit||[]).concat(n),i.explicit=(this.explicit||[]).concat(r),i.compiledImplicit=Xk(i,"implicit"),i.compiledExplicit=Xk(i,"explicit"),i.compiledTypeMap=Y8(i.compiledImplicit,i.compiledExplicit),i};var Y_=By,G_=new An("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),X_=new An("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),J_=new An("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),Q_=new Y_({explicit:[G_,X_,J_]});function G8(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function X8(){return null}function J8(e){return e===null}var Z_=new An("tag:yaml.org,2002:null",{kind:"scalar",resolve:G8,construct:X8,predicate:J8,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function Q8(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 Z8(e){return e==="true"||e==="True"||e==="TRUE"}function e6(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var eP=new An("tag:yaml.org,2002:bool",{kind:"scalar",resolve:Q8,construct:Z8,predicate:e6,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 t6(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function n6(e){return 48<=e&&e<=55}function r6(e){return 48<=e&&e<=57}function i6(e){if(e===null)return!1;var t=e.length,n=0,r=!1,i;if(!t)return!1;if(i=e[n],(i==="-"||i==="+")&&(i=e[++n]),i==="0"){if(n+1===t)return!0;if(i=e[++n],i==="b"){for(n++;n<t;n++)if(i=e[n],i!=="_"){if(i!=="0"&&i!=="1")return!1;r=!0}return r&&i!=="_"}if(i==="x"){for(n++;n<t;n++)if(i=e[n],i!=="_"){if(!t6(e.charCodeAt(n)))return!1;r=!0}return r&&i!=="_"}if(i==="o"){for(n++;n<t;n++)if(i=e[n],i!=="_"){if(!n6(e.charCodeAt(n)))return!1;r=!0}return r&&i!=="_"}}if(i==="_")return!1;for(;n<t;n++)if(i=e[n],i!=="_"){if(!r6(e.charCodeAt(n)))return!1;r=!0}return!(!r||i==="_")}function s6(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 o6(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!mn.isNegativeZero(e)}var tP=new An("tag:yaml.org,2002:int",{kind:"scalar",resolve:i6,construct:s6,predicate:o6,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"]}}),a6=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function l6(e){return!(e===null||!a6.test(e)||e[e.length-1]==="_")}function c6(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 u6=/^[-+]?[0-9]+e/;function d6(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(mn.isNegativeZero(e))return"-0.0";return n=e.toString(10),u6.test(n)?n.replace("e",".e"):n}function f6(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||mn.isNegativeZero(e))}var nP=new An("tag:yaml.org,2002:float",{kind:"scalar",resolve:l6,construct:c6,predicate:f6,represent:d6,defaultStyle:"lowercase"}),rP=Q_.extend({implicit:[Z_,eP,tP,nP]}),iP=rP,sP=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),oP=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 p6(e){return e===null?!1:sP.exec(e)!==null||oP.exec(e)!==null}function h6(e){var t,n,r,i,s,o,c,l=0,u=null,p,f,d;if(t=sP.exec(e),t===null&&(t=oP.exec(e)),t===null)throw new Error("Date resolve error");if(n=+t[1],r=+t[2]-1,i=+t[3],!t[4])return new Date(Date.UTC(n,r,i));if(s=+t[4],o=+t[5],c=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}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,i,s,o,c,l)),u&&d.setTime(d.getTime()-u),d}function m6(e){return e.toISOString()}var aP=new An("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:p6,construct:h6,instanceOf:Date,represent:m6});function g6(e){return e==="<<"||e===null}var lP=new An("tag:yaml.org,2002:merge",{kind:"scalar",resolve:g6}),Rw=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
86
|
+
\r`;function y6(e){if(e===null)return!1;var t,n,r=0,i=e.length,s=Rw;for(n=0;n<i;n++)if(t=s.indexOf(e.charAt(n)),!(t>64)){if(t<0)return!1;r+=6}return r%8===0}function x6(e){var t,n,r=e.replace(/[\r\n=]/g,""),i=r.length,s=Rw,o=0,c=[];for(t=0;t<i;t++)t%4===0&&t&&(c.push(o>>16&255),c.push(o>>8&255),c.push(o&255)),o=o<<6|s.indexOf(r.charAt(t));return n=i%4*6,n===0?(c.push(o>>16&255),c.push(o>>8&255),c.push(o&255)):n===18?(c.push(o>>10&255),c.push(o>>2&255)):n===12&&c.push(o>>4&255),new Uint8Array(c)}function w6(e){var t="",n=0,r,i,s=e.length,o=Rw;for(r=0;r<s;r++)r%3===0&&r&&(t+=o[n>>18&63],t+=o[n>>12&63],t+=o[n>>6&63],t+=o[n&63]),n=(n<<8)+e[r];return i=s%3,i===0?(t+=o[n>>18&63],t+=o[n>>12&63],t+=o[n>>6&63],t+=o[n&63]):i===2?(t+=o[n>>10&63],t+=o[n>>4&63],t+=o[n<<2&63],t+=o[64]):i===1&&(t+=o[n>>2&63],t+=o[n<<4&63],t+=o[64],t+=o[64]),t}function v6(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var cP=new An("tag:yaml.org,2002:binary",{kind:"scalar",resolve:y6,construct:x6,predicate:v6,represent:w6}),b6=Object.prototype.hasOwnProperty,k6=Object.prototype.toString;function S6(e){if(e===null)return!0;var t=[],n,r,i,s,o,c=e;for(n=0,r=c.length;n<r;n+=1){if(i=c[n],o=!1,k6.call(i)!=="[object Object]")return!1;for(s in i)if(b6.call(i,s))if(!o)o=!0;else return!1;if(!o)return!1;if(t.indexOf(s)===-1)t.push(s);else return!1}return!0}function N6(e){return e!==null?e:[]}var uP=new An("tag:yaml.org,2002:omap",{kind:"sequence",resolve:S6,construct:N6}),j6=Object.prototype.toString;function C6(e){if(e===null)return!0;var t,n,r,i,s,o=e;for(s=new Array(o.length),t=0,n=o.length;t<n;t+=1){if(r=o[t],j6.call(r)!=="[object Object]"||(i=Object.keys(r),i.length!==1))return!1;s[t]=[i[0],r[i[0]]]}return!0}function E6(e){if(e===null)return[];var t,n,r,i,s,o=e;for(s=new Array(o.length),t=0,n=o.length;t<n;t+=1)r=o[t],i=Object.keys(r),s[t]=[i[0],r[i[0]]];return s}var dP=new An("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:C6,construct:E6}),_6=Object.prototype.hasOwnProperty;function P6(e){if(e===null)return!0;var t,n=e;for(t in n)if(_6.call(n,t)&&n[t]!==null)return!1;return!0}function I6(e){return e!==null?e:{}}var fP=new An("tag:yaml.org,2002:set",{kind:"mapping",resolve:P6,construct:I6}),Lw=iP.extend({implicit:[aP,lP],explicit:[cP,uP,dP,fP]}),uo=Object.prototype.hasOwnProperty,Np=1,pP=2,hP=3,jp=4,Zm=1,A6=2,Jk=3,T6=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,R6=/[\x85\u2028\u2029]/,L6=/[,\[\]\{\}]/,mP=/^(?:!|!!|![a-z\-]+!)$/i,gP=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function Qk(e){return Object.prototype.toString.call(e)}function Fi(e){return e===10||e===13}function Vo(e){return e===9||e===32}function ur(e){return e===9||e===32||e===10||e===13}function za(e){return e===44||e===91||e===93||e===123||e===125}function O6(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}function M6(e){return e===120?2:e===117?4:e===85?8:0}function $6(e){return 48<=e&&e<=57?e-48:-1}function Zk(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
|
|
87
|
+
`:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"
":e===95?" ":e===76?"\u2028":e===80?"\u2029":""}function D6(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function yP(e,t,n){t==="__proto__"?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:n}):e[t]=n}var xP=new Array(256),wP=new Array(256);for(var wa=0;wa<256;wa++)xP[wa]=Zk(wa)?1:0,wP[wa]=Zk(wa);function F6(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||Lw,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function vP(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=U8(n),new Gn(t,n)}function Me(e,t){throw vP(e,t)}function Cp(e,t){e.onWarning&&e.onWarning.call(null,vP(e,t))}var eS={YAML:function(t,n,r){var i,s,o;t.version!==null&&Me(t,"duplication of %YAML directive"),r.length!==1&&Me(t,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(r[0]),i===null&&Me(t,"ill-formed argument of the YAML directive"),s=parseInt(i[1],10),o=parseInt(i[2],10),s!==1&&Me(t,"unacceptable YAML version of the document"),t.version=r[0],t.checkLineBreaks=o<2,o!==1&&o!==2&&Cp(t,"unsupported YAML version of the document")},TAG:function(t,n,r){var i,s;r.length!==2&&Me(t,"TAG directive accepts exactly two arguments"),i=r[0],s=r[1],mP.test(i)||Me(t,"ill-formed tag handle (first argument) of the TAG directive"),uo.call(t.tagMap,i)&&Me(t,'there is a previously declared suffix for "'+i+'" tag handle'),gP.test(s)||Me(t,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch{Me(t,"tag prefix is malformed: "+s)}t.tagMap[i]=s}};function oo(e,t,n,r){var i,s,o,c;if(t<n){if(c=e.input.slice(t,n),r)for(i=0,s=c.length;i<s;i+=1)o=c.charCodeAt(i),o===9||32<=o&&o<=1114111||Me(e,"expected valid JSON character");else T6.test(c)&&Me(e,"the stream contains non-printable characters");e.result+=c}}function tS(e,t,n,r){var i,s,o,c;for(mn.isObject(n)||Me(e,"cannot merge mappings; the provided source object is unacceptable"),i=Object.keys(n),o=0,c=i.length;o<c;o+=1)s=i[o],uo.call(t,s)||(yP(t,s,n[s]),r[s]=!0)}function Ba(e,t,n,r,i,s,o,c,l){var u,p;if(Array.isArray(i))for(i=Array.prototype.slice.call(i),u=0,p=i.length;u<p;u+=1)Array.isArray(i[u])&&Me(e,"nested arrays are not supported inside keys"),typeof i=="object"&&Qk(i[u])==="[object Object]"&&(i[u]="[object Object]");if(typeof i=="object"&&Qk(i)==="[object Object]"&&(i="[object Object]"),i=String(i),t===null&&(t={}),r==="tag:yaml.org,2002:merge")if(Array.isArray(s))for(u=0,p=s.length;u<p;u+=1)tS(e,t,s[u],n);else tS(e,t,s,n);else!e.json&&!uo.call(n,i)&&uo.call(t,i)&&(e.line=o||e.line,e.lineStart=c||e.lineStart,e.position=l||e.position,Me(e,"duplicated mapping key")),yP(t,i,s),delete n[i];return t}function Ow(e){var t;t=e.input.charCodeAt(e.position),t===10?e.position++:t===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):Me(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function un(e,t,n){for(var r=0,i=e.input.charCodeAt(e.position);i!==0;){for(;Vo(i);)i===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),i=e.input.charCodeAt(++e.position);if(t&&i===35)do i=e.input.charCodeAt(++e.position);while(i!==10&&i!==13&&i!==0);if(Fi(i))for(Ow(e),i=e.input.charCodeAt(e.position),r++,e.lineIndent=0;i===32;)e.lineIndent++,i=e.input.charCodeAt(++e.position);else break}return n!==-1&&r!==0&&e.lineIndent<n&&Cp(e,"deficient indentation"),r}function xh(e){var t=e.position,n;return n=e.input.charCodeAt(t),!!((n===45||n===46)&&n===e.input.charCodeAt(t+1)&&n===e.input.charCodeAt(t+2)&&(t+=3,n=e.input.charCodeAt(t),n===0||ur(n)))}function Mw(e,t){t===1?e.result+=" ":t>1&&(e.result+=mn.repeat(`
|
|
88
|
+
`,t-1))}function z6(e,t,n){var r,i,s,o,c,l,u,p,f=e.kind,d=e.result,h;if(h=e.input.charCodeAt(e.position),ur(h)||za(h)||h===35||h===38||h===42||h===33||h===124||h===62||h===39||h===34||h===37||h===64||h===96||(h===63||h===45)&&(i=e.input.charCodeAt(e.position+1),ur(i)||n&&za(i)))return!1;for(e.kind="scalar",e.result="",s=o=e.position,c=!1;h!==0;){if(h===58){if(i=e.input.charCodeAt(e.position+1),ur(i)||n&&za(i))break}else if(h===35){if(r=e.input.charCodeAt(e.position-1),ur(r))break}else{if(e.position===e.lineStart&&xh(e)||n&&za(h))break;if(Fi(h))if(l=e.line,u=e.lineStart,p=e.lineIndent,un(e,!1,-1),e.lineIndent>=t){c=!0,h=e.input.charCodeAt(e.position);continue}else{e.position=o,e.line=l,e.lineStart=u,e.lineIndent=p;break}}c&&(oo(e,s,o,!1),Mw(e,e.line-l),s=o=e.position,c=!1),Vo(h)||(o=e.position+1),h=e.input.charCodeAt(++e.position)}return oo(e,s,o,!1),e.result?!0:(e.kind=f,e.result=d,!1)}function B6(e,t){var n,r,i;if(n=e.input.charCodeAt(e.position),n!==39)return!1;for(e.kind="scalar",e.result="",e.position++,r=i=e.position;(n=e.input.charCodeAt(e.position))!==0;)if(n===39)if(oo(e,r,e.position,!0),n=e.input.charCodeAt(++e.position),n===39)r=e.position,e.position++,i=e.position;else return!0;else Fi(n)?(oo(e,r,i,!0),Mw(e,un(e,!1,t)),r=i=e.position):e.position===e.lineStart&&xh(e)?Me(e,"unexpected end of the document within a single quoted scalar"):(e.position++,i=e.position);Me(e,"unexpected end of the stream within a single quoted scalar")}function H6(e,t){var n,r,i,s,o,c;if(c=e.input.charCodeAt(e.position),c!==34)return!1;for(e.kind="scalar",e.result="",e.position++,n=r=e.position;(c=e.input.charCodeAt(e.position))!==0;){if(c===34)return oo(e,n,e.position,!0),e.position++,!0;if(c===92){if(oo(e,n,e.position,!0),c=e.input.charCodeAt(++e.position),Fi(c))un(e,!1,t);else if(c<256&&xP[c])e.result+=wP[c],e.position++;else if((o=M6(c))>0){for(i=o,s=0;i>0;i--)c=e.input.charCodeAt(++e.position),(o=O6(c))>=0?s=(s<<4)+o:Me(e,"expected hexadecimal character");e.result+=D6(s),e.position++}else Me(e,"unknown escape sequence");n=r=e.position}else Fi(c)?(oo(e,n,r,!0),Mw(e,un(e,!1,t)),n=r=e.position):e.position===e.lineStart&&xh(e)?Me(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}Me(e,"unexpected end of the stream within a double quoted scalar")}function U6(e,t){var n=!0,r,i,s,o=e.tag,c,l=e.anchor,u,p,f,d,h,y=Object.create(null),b,k,g,v;if(v=e.input.charCodeAt(e.position),v===91)p=93,h=!1,c=[];else if(v===123)p=125,h=!0,c={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=c),v=e.input.charCodeAt(++e.position);v!==0;){if(un(e,!0,t),v=e.input.charCodeAt(e.position),v===p)return e.position++,e.tag=o,e.anchor=l,e.kind=h?"mapping":"sequence",e.result=c,!0;n?v===44&&Me(e,"expected the node content, but found ','"):Me(e,"missed comma between flow collection entries"),k=b=g=null,f=d=!1,v===63&&(u=e.input.charCodeAt(e.position+1),ur(u)&&(f=d=!0,e.position++,un(e,!0,t))),r=e.line,i=e.lineStart,s=e.position,yl(e,t,Np,!1,!0),k=e.tag,b=e.result,un(e,!0,t),v=e.input.charCodeAt(e.position),(d||e.line===r)&&v===58&&(f=!0,v=e.input.charCodeAt(++e.position),un(e,!0,t),yl(e,t,Np,!1,!0),g=e.result),h?Ba(e,c,y,k,b,g,r,i,s):f?c.push(Ba(e,null,y,k,b,g,r,i,s)):c.push(b),un(e,!0,t),v=e.input.charCodeAt(e.position),v===44?(n=!0,v=e.input.charCodeAt(++e.position)):n=!1}Me(e,"unexpected end of the stream within a flow collection")}function V6(e,t){var n,r,i=Zm,s=!1,o=!1,c=t,l=0,u=!1,p,f;if(f=e.input.charCodeAt(e.position),f===124)r=!1;else if(f===62)r=!0;else return!1;for(e.kind="scalar",e.result="";f!==0;)if(f=e.input.charCodeAt(++e.position),f===43||f===45)Zm===i?i=f===43?Jk:A6:Me(e,"repeat of a chomping mode identifier");else if((p=$6(f))>=0)p===0?Me(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?Me(e,"repeat of an indentation width identifier"):(c=t+p-1,o=!0);else break;if(Vo(f)){do f=e.input.charCodeAt(++e.position);while(Vo(f));if(f===35)do f=e.input.charCodeAt(++e.position);while(!Fi(f)&&f!==0)}for(;f!==0;){for(Ow(e),e.lineIndent=0,f=e.input.charCodeAt(e.position);(!o||e.lineIndent<c)&&f===32;)e.lineIndent++,f=e.input.charCodeAt(++e.position);if(!o&&e.lineIndent>c&&(c=e.lineIndent),Fi(f)){l++;continue}if(e.lineIndent<c){i===Jk?e.result+=mn.repeat(`
|
|
89
|
+
`,s?1+l:l):i===Zm&&s&&(e.result+=`
|
|
90
|
+
`);break}for(r?Vo(f)?(u=!0,e.result+=mn.repeat(`
|
|
91
|
+
`,s?1+l:l)):u?(u=!1,e.result+=mn.repeat(`
|
|
92
|
+
`,l+1)):l===0?s&&(e.result+=" "):e.result+=mn.repeat(`
|
|
93
|
+
`,l):e.result+=mn.repeat(`
|
|
94
|
+
`,s?1+l:l),s=!0,o=!0,l=0,n=e.position;!Fi(f)&&f!==0;)f=e.input.charCodeAt(++e.position);oo(e,n,e.position,!1)}return!0}function nS(e,t){var n,r=e.tag,i=e.anchor,s=[],o,c=!1,l;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=s),l=e.input.charCodeAt(e.position);l!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,Me(e,"tab characters must not be used in indentation")),!(l!==45||(o=e.input.charCodeAt(e.position+1),!ur(o))));){if(c=!0,e.position++,un(e,!0,-1)&&e.lineIndent<=t){s.push(null),l=e.input.charCodeAt(e.position);continue}if(n=e.line,yl(e,t,hP,!1,!0),s.push(e.result),un(e,!0,-1),l=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&l!==0)Me(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break}return c?(e.tag=r,e.anchor=i,e.kind="sequence",e.result=s,!0):!1}function W6(e,t,n){var r,i,s,o,c,l,u=e.tag,p=e.anchor,f={},d=Object.create(null),h=null,y=null,b=null,k=!1,g=!1,v;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=f),v=e.input.charCodeAt(e.position);v!==0;){if(!k&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,Me(e,"tab characters must not be used in indentation")),r=e.input.charCodeAt(e.position+1),s=e.line,(v===63||v===58)&&ur(r))v===63?(k&&(Ba(e,f,d,h,y,null,o,c,l),h=y=b=null),g=!0,k=!0,i=!0):k?(k=!1,i=!0):Me(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,v=r;else{if(o=e.line,c=e.lineStart,l=e.position,!yl(e,n,pP,!1,!0))break;if(e.line===s){for(v=e.input.charCodeAt(e.position);Vo(v);)v=e.input.charCodeAt(++e.position);if(v===58)v=e.input.charCodeAt(++e.position),ur(v)||Me(e,"a whitespace character is expected after the key-value separator within a block mapping"),k&&(Ba(e,f,d,h,y,null,o,c,l),h=y=b=null),g=!0,k=!1,i=!1,h=e.tag,y=e.result;else if(g)Me(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=u,e.anchor=p,!0}else if(g)Me(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=u,e.anchor=p,!0}if((e.line===s||e.lineIndent>t)&&(k&&(o=e.line,c=e.lineStart,l=e.position),yl(e,t,jp,!0,i)&&(k?y=e.result:b=e.result),k||(Ba(e,f,d,h,y,b,o,c,l),h=y=b=null),un(e,!0,-1),v=e.input.charCodeAt(e.position)),(e.line===s||e.lineIndent>t)&&v!==0)Me(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return k&&Ba(e,f,d,h,y,null,o,c,l),g&&(e.tag=u,e.anchor=p,e.kind="mapping",e.result=f),g}function K6(e){var t,n=!1,r=!1,i,s,o;if(o=e.input.charCodeAt(e.position),o!==33)return!1;if(e.tag!==null&&Me(e,"duplication of a tag property"),o=e.input.charCodeAt(++e.position),o===60?(n=!0,o=e.input.charCodeAt(++e.position)):o===33?(r=!0,i="!!",o=e.input.charCodeAt(++e.position)):i="!",t=e.position,n){do o=e.input.charCodeAt(++e.position);while(o!==0&&o!==62);e.position<e.length?(s=e.input.slice(t,e.position),o=e.input.charCodeAt(++e.position)):Me(e,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!ur(o);)o===33&&(r?Me(e,"tag suffix cannot contain exclamation marks"):(i=e.input.slice(t-1,e.position+1),mP.test(i)||Me(e,"named tag handle cannot contain such characters"),r=!0,t=e.position+1)),o=e.input.charCodeAt(++e.position);s=e.input.slice(t,e.position),L6.test(s)&&Me(e,"tag suffix cannot contain flow indicator characters")}s&&!gP.test(s)&&Me(e,"tag name cannot contain such characters: "+s);try{s=decodeURIComponent(s)}catch{Me(e,"tag name is malformed: "+s)}return n?e.tag=s:uo.call(e.tagMap,i)?e.tag=e.tagMap[i]+s:i==="!"?e.tag="!"+s:i==="!!"?e.tag="tag:yaml.org,2002:"+s:Me(e,'undeclared tag handle "'+i+'"'),!0}function q6(e){var t,n;if(n=e.input.charCodeAt(e.position),n!==38)return!1;for(e.anchor!==null&&Me(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;n!==0&&!ur(n)&&!za(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&Me(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function Y6(e){var t,n,r;if(r=e.input.charCodeAt(e.position),r!==42)return!1;for(r=e.input.charCodeAt(++e.position),t=e.position;r!==0&&!ur(r)&&!za(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&Me(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),uo.call(e.anchorMap,n)||Me(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],un(e,!0,-1),!0}function yl(e,t,n,r,i){var s,o,c,l=1,u=!1,p=!1,f,d,h,y,b,k;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,s=o=c=jp===n||hP===n,r&&un(e,!0,-1)&&(u=!0,e.lineIndent>t?l=1:e.lineIndent===t?l=0:e.lineIndent<t&&(l=-1)),l===1)for(;K6(e)||q6(e);)un(e,!0,-1)?(u=!0,c=s,e.lineIndent>t?l=1:e.lineIndent===t?l=0:e.lineIndent<t&&(l=-1)):c=!1;if(c&&(c=u||i),(l===1||jp===n)&&(Np===n||pP===n?b=t:b=t+1,k=e.position-e.lineStart,l===1?c&&(nS(e,k)||W6(e,k,b))||U6(e,b)?p=!0:(o&&V6(e,b)||B6(e,b)||H6(e,b)?p=!0:Y6(e)?(p=!0,(e.tag!==null||e.anchor!==null)&&Me(e,"alias node should not have any properties")):z6(e,b,Np===n)&&(p=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):l===0&&(p=c&&nS(e,k))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&Me(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),f=0,d=e.implicitTypes.length;f<d;f+=1)if(y=e.implicitTypes[f],y.resolve(e.result)){e.result=y.construct(e.result),e.tag=y.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(uo.call(e.typeMap[e.kind||"fallback"],e.tag))y=e.typeMap[e.kind||"fallback"][e.tag];else for(y=null,h=e.typeMap.multi[e.kind||"fallback"],f=0,d=h.length;f<d;f+=1)if(e.tag.slice(0,h[f].tag.length)===h[f].tag){y=h[f];break}y||Me(e,"unknown tag !<"+e.tag+">"),e.result!==null&&y.kind!==e.kind&&Me(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+y.kind+'", not "'+e.kind+'"'),y.resolve(e.result,e.tag)?(e.result=y.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):Me(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||p}function G6(e){var t=e.position,n,r,i,s=!1,o;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(o=e.input.charCodeAt(e.position))!==0&&(un(e,!0,-1),o=e.input.charCodeAt(e.position),!(e.lineIndent>0||o!==37));){for(s=!0,o=e.input.charCodeAt(++e.position),n=e.position;o!==0&&!ur(o);)o=e.input.charCodeAt(++e.position);for(r=e.input.slice(n,e.position),i=[],r.length<1&&Me(e,"directive name must not be less than one character in length");o!==0;){for(;Vo(o);)o=e.input.charCodeAt(++e.position);if(o===35){do o=e.input.charCodeAt(++e.position);while(o!==0&&!Fi(o));break}if(Fi(o))break;for(n=e.position;o!==0&&!ur(o);)o=e.input.charCodeAt(++e.position);i.push(e.input.slice(n,e.position))}o!==0&&Ow(e),uo.call(eS,r)?eS[r](e,r,i):Cp(e,'unknown document directive "'+r+'"')}if(un(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,un(e,!0,-1)):s&&Me(e,"directives end mark is expected"),yl(e,e.lineIndent-1,jp,!1,!0),un(e,!0,-1),e.checkLineBreaks&&R6.test(e.input.slice(t,e.position))&&Cp(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&xh(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,un(e,!0,-1));return}if(e.position<e.length-1)Me(e,"end of the stream or a document separator is expected");else return}function bP(e,t){e=String(e),t=t||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
|
|
95
|
+
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var n=new F6(e,t),r=e.indexOf("\0");for(r!==-1&&(n.position=r,Me(n,"null byte is not allowed in input")),n.input+="\0";n.input.charCodeAt(n.position)===32;)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)G6(n);return n.documents}function X6(e,t,n){t!==null&&typeof t=="object"&&typeof n>"u"&&(n=t,t=null);var r=bP(e,n);if(typeof t!="function")return r;for(var i=0,s=r.length;i<s;i+=1)t(r[i])}function J6(e,t){var n=bP(e,t);if(n.length!==0){if(n.length===1)return n[0];throw new Gn("expected a single document in the stream, but found more")}}var Q6=X6,Z6=J6,kP={loadAll:Q6,load:Z6},SP=Object.prototype.toString,NP=Object.prototype.hasOwnProperty,$w=65279,e9=9,bu=10,t9=13,n9=32,r9=33,i9=34,Hy=35,s9=37,o9=38,a9=39,l9=42,jP=44,c9=45,Ep=58,u9=61,d9=62,f9=63,p9=64,CP=91,EP=93,h9=96,_P=123,m9=124,PP=125,Vn={};Vn[0]="\\0";Vn[7]="\\a";Vn[8]="\\b";Vn[9]="\\t";Vn[10]="\\n";Vn[11]="\\v";Vn[12]="\\f";Vn[13]="\\r";Vn[27]="\\e";Vn[34]='\\"';Vn[92]="\\\\";Vn[133]="\\N";Vn[160]="\\_";Vn[8232]="\\L";Vn[8233]="\\P";var g9=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],y9=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function x9(e,t){var n,r,i,s,o,c,l;if(t===null)return{};for(n={},r=Object.keys(t),i=0,s=r.length;i<s;i+=1)o=r[i],c=String(t[o]),o.slice(0,2)==="!!"&&(o="tag:yaml.org,2002:"+o.slice(2)),l=e.compiledTypeMap.fallback[o],l&&NP.call(l.styleAliases,c)&&(c=l.styleAliases[c]),n[o]=c;return n}function w9(e){var t,n,r;if(t=e.toString(16).toUpperCase(),e<=255)n="x",r=2;else if(e<=65535)n="u",r=4;else if(e<=4294967295)n="U",r=8;else throw new Gn("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+n+mn.repeat("0",r-t.length)+t}var v9=1,ku=2;function b9(e){this.schema=e.schema||Lw,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=mn.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=x9(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?ku:v9,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function rS(e,t){for(var n=mn.repeat(" ",t),r=0,i=-1,s="",o,c=e.length;r<c;)i=e.indexOf(`
|
|
96
|
+
`,r),i===-1?(o=e.slice(r),r=c):(o=e.slice(r,i+1),r=i+1),o.length&&o!==`
|
|
97
|
+
`&&(s+=n),s+=o;return s}function Uy(e,t){return`
|
|
98
|
+
`+mn.repeat(" ",e.indent*t)}function k9(e,t){var n,r,i;for(n=0,r=e.implicitTypes.length;n<r;n+=1)if(i=e.implicitTypes[n],i.resolve(t))return!0;return!1}function _p(e){return e===n9||e===e9}function Su(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==$w||65536<=e&&e<=1114111}function iS(e){return Su(e)&&e!==$w&&e!==t9&&e!==bu}function sS(e,t,n){var r=iS(e),i=r&&!_p(e);return(n?r:r&&e!==jP&&e!==CP&&e!==EP&&e!==_P&&e!==PP)&&e!==Hy&&!(t===Ep&&!i)||iS(t)&&!_p(t)&&e===Hy||t===Ep&&i}function S9(e){return Su(e)&&e!==$w&&!_p(e)&&e!==c9&&e!==f9&&e!==Ep&&e!==jP&&e!==CP&&e!==EP&&e!==_P&&e!==PP&&e!==Hy&&e!==o9&&e!==l9&&e!==r9&&e!==m9&&e!==u9&&e!==d9&&e!==a9&&e!==i9&&e!==s9&&e!==p9&&e!==h9}function N9(e){return!_p(e)&&e!==Ep}function Sc(e,t){var n=e.charCodeAt(t),r;return n>=55296&&n<=56319&&t+1<e.length&&(r=e.charCodeAt(t+1),r>=56320&&r<=57343)?(n-55296)*1024+r-56320+65536:n}function IP(e){var t=/^\n* /;return t.test(e)}var AP=1,Vy=2,TP=3,RP=4,Sa=5;function j9(e,t,n,r,i,s,o,c){var l,u=0,p=null,f=!1,d=!1,h=r!==-1,y=-1,b=S9(Sc(e,0))&&N9(Sc(e,e.length-1));if(t||o)for(l=0;l<e.length;u>=65536?l+=2:l++){if(u=Sc(e,l),!Su(u))return Sa;b=b&&sS(u,p,c),p=u}else{for(l=0;l<e.length;u>=65536?l+=2:l++){if(u=Sc(e,l),u===bu)f=!0,h&&(d=d||l-y-1>r&&e[y+1]!==" ",y=l);else if(!Su(u))return Sa;b=b&&sS(u,p,c),p=u}d=d||h&&l-y-1>r&&e[y+1]!==" "}return!f&&!d?b&&!o&&!i(e)?AP:s===ku?Sa:Vy:n>9&&IP(e)?Sa:o?s===ku?Sa:Vy:d?RP:TP}function C9(e,t,n,r,i){e.dump=function(){if(t.length===0)return e.quotingType===ku?'""':"''";if(!e.noCompatMode&&(g9.indexOf(t)!==-1||y9.test(t)))return e.quotingType===ku?'"'+t+'"':"'"+t+"'";var s=e.indent*Math.max(1,n),o=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-s),c=r||e.flowLevel>-1&&n>=e.flowLevel;function l(u){return k9(e,u)}switch(j9(t,c,e.indent,o,l,e.quotingType,e.forceQuotes&&!r,i)){case AP:return t;case Vy:return"'"+t.replace(/'/g,"''")+"'";case TP:return"|"+oS(t,e.indent)+aS(rS(t,s));case RP:return">"+oS(t,e.indent)+aS(rS(E9(t,o),s));case Sa:return'"'+_9(t)+'"';default:throw new Gn("impossible error: invalid scalar style")}}()}function oS(e,t){var n=IP(e)?String(t):"",r=e[e.length-1]===`
|
|
99
|
+
`,i=r&&(e[e.length-2]===`
|
|
100
|
+
`||e===`
|
|
101
|
+
`),s=i?"+":r?"":"-";return n+s+`
|
|
102
|
+
`}function aS(e){return e[e.length-1]===`
|
|
103
|
+
`?e.slice(0,-1):e}function E9(e,t){for(var n=/(\n+)([^\n]*)/g,r=function(){var u=e.indexOf(`
|
|
104
|
+
`);return u=u!==-1?u:e.length,n.lastIndex=u,lS(e.slice(0,u),t)}(),i=e[0]===`
|
|
105
|
+
`||e[0]===" ",s,o;o=n.exec(e);){var c=o[1],l=o[2];s=l[0]===" ",r+=c+(!i&&!s&&l!==""?`
|
|
106
|
+
`:"")+lS(l,t),i=s}return r}function lS(e,t){if(e===""||e[0]===" ")return e;for(var n=/ [^ ]/g,r,i=0,s,o=0,c=0,l="";r=n.exec(e);)c=r.index,c-i>t&&(s=o>i?o:c,l+=`
|
|
107
|
+
`+e.slice(i,s),i=s+1),o=c;return l+=`
|
|
108
|
+
`,e.length-i>t&&o>i?l+=e.slice(i,o)+`
|
|
109
|
+
`+e.slice(o+1):l+=e.slice(i),l.slice(1)}function _9(e){for(var t="",n=0,r,i=0;i<e.length;n>=65536?i+=2:i++)n=Sc(e,i),r=Vn[n],!r&&Su(n)?(t+=e[i],n>=65536&&(t+=e[i+1])):t+=r||w9(n);return t}function P9(e,t,n){var r="",i=e.tag,s,o,c;for(s=0,o=n.length;s<o;s+=1)c=n[s],e.replacer&&(c=e.replacer.call(n,String(s),c)),(ps(e,t,c,!1,!1)||typeof c>"u"&&ps(e,t,null,!1,!1))&&(r!==""&&(r+=","+(e.condenseFlow?"":" ")),r+=e.dump);e.tag=i,e.dump="["+r+"]"}function cS(e,t,n,r){var i="",s=e.tag,o,c,l;for(o=0,c=n.length;o<c;o+=1)l=n[o],e.replacer&&(l=e.replacer.call(n,String(o),l)),(ps(e,t+1,l,!0,!0,!1,!0)||typeof l>"u"&&ps(e,t+1,null,!0,!0,!1,!0))&&((!r||i!=="")&&(i+=Uy(e,t)),e.dump&&bu===e.dump.charCodeAt(0)?i+="-":i+="- ",i+=e.dump);e.tag=s,e.dump=i||"[]"}function I9(e,t,n){var r="",i=e.tag,s=Object.keys(n),o,c,l,u,p;for(o=0,c=s.length;o<c;o+=1)p="",r!==""&&(p+=", "),e.condenseFlow&&(p+='"'),l=s[o],u=n[l],e.replacer&&(u=e.replacer.call(n,l,u)),ps(e,t,l,!1,!1)&&(e.dump.length>1024&&(p+="? "),p+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),ps(e,t,u,!1,!1)&&(p+=e.dump,r+=p));e.tag=i,e.dump="{"+r+"}"}function A9(e,t,n,r){var i="",s=e.tag,o=Object.keys(n),c,l,u,p,f,d;if(e.sortKeys===!0)o.sort();else if(typeof e.sortKeys=="function")o.sort(e.sortKeys);else if(e.sortKeys)throw new Gn("sortKeys must be a boolean or a function");for(c=0,l=o.length;c<l;c+=1)d="",(!r||i!=="")&&(d+=Uy(e,t)),u=o[c],p=n[u],e.replacer&&(p=e.replacer.call(n,u,p)),ps(e,t+1,u,!0,!0,!0)&&(f=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,f&&(e.dump&&bu===e.dump.charCodeAt(0)?d+="?":d+="? "),d+=e.dump,f&&(d+=Uy(e,t)),ps(e,t+1,p,!0,f)&&(e.dump&&bu===e.dump.charCodeAt(0)?d+=":":d+=": ",d+=e.dump,i+=d));e.tag=s,e.dump=i||"{}"}function uS(e,t,n){var r,i,s,o,c,l;for(i=n?e.explicitTypes:e.implicitTypes,s=0,o=i.length;s<o;s+=1)if(c=i[s],(c.instanceOf||c.predicate)&&(!c.instanceOf||typeof t=="object"&&t instanceof c.instanceOf)&&(!c.predicate||c.predicate(t))){if(n?c.multi&&c.representName?e.tag=c.representName(t):e.tag=c.tag:e.tag="?",c.represent){if(l=e.styleMap[c.tag]||c.defaultStyle,SP.call(c.represent)==="[object Function]")r=c.represent(t,l);else if(NP.call(c.represent,l))r=c.represent[l](t,l);else throw new Gn("!<"+c.tag+'> tag resolver accepts not "'+l+'" style');e.dump=r}return!0}return!1}function ps(e,t,n,r,i,s,o){e.tag=null,e.dump=n,uS(e,n,!1)||uS(e,n,!0);var c=SP.call(e.dump),l=r,u;r&&(r=e.flowLevel<0||e.flowLevel>t);var p=c==="[object Object]"||c==="[object Array]",f,d;if(p&&(f=e.duplicates.indexOf(n),d=f!==-1),(e.tag!==null&&e.tag!=="?"||d||e.indent!==2&&t>0)&&(i=!1),d&&e.usedDuplicates[f])e.dump="*ref_"+f;else{if(p&&d&&!e.usedDuplicates[f]&&(e.usedDuplicates[f]=!0),c==="[object Object]")r&&Object.keys(e.dump).length!==0?(A9(e,t,e.dump,i),d&&(e.dump="&ref_"+f+e.dump)):(I9(e,t,e.dump),d&&(e.dump="&ref_"+f+" "+e.dump));else if(c==="[object Array]")r&&e.dump.length!==0?(e.noArrayIndent&&!o&&t>0?cS(e,t-1,e.dump,i):cS(e,t,e.dump,i),d&&(e.dump="&ref_"+f+e.dump)):(P9(e,t,e.dump),d&&(e.dump="&ref_"+f+" "+e.dump));else if(c==="[object String]")e.tag!=="?"&&C9(e,e.dump,t,s,l);else{if(c==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new Gn("unacceptable kind of an object to dump "+c)}e.tag!==null&&e.tag!=="?"&&(u=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?u="!"+u:u.slice(0,18)==="tag:yaml.org,2002:"?u="!!"+u.slice(18):u="!<"+u+">",e.dump=u+" "+e.dump)}return!0}function T9(e,t){var n=[],r=[],i,s;for(Wy(e,n,r),i=0,s=r.length;i<s;i+=1)t.duplicates.push(n[r[i]]);t.usedDuplicates=new Array(s)}function Wy(e,t,n){var r,i,s;if(e!==null&&typeof e=="object")if(i=t.indexOf(e),i!==-1)n.indexOf(i)===-1&&n.push(i);else if(t.push(e),Array.isArray(e))for(i=0,s=e.length;i<s;i+=1)Wy(e[i],t,n);else for(r=Object.keys(e),i=0,s=r.length;i<s;i+=1)Wy(e[r[i]],t,n)}function R9(e,t){t=t||{};var n=new b9(t);n.noRefs||T9(e,n);var r=e;return n.replacer&&(r=n.replacer.call({"":r},"",r)),ps(n,0,r,!0,!0)?n.dump+`
|
|
110
|
+
`:""}var L9=R9,O9={dump:L9};function Dw(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var M9=An,$9=Y_,D9=Q_,F9=rP,z9=iP,B9=Lw,H9=kP.load,U9=kP.loadAll,V9=O9.dump,W9=Gn,K9={binary:cP,float:nP,map:J_,null:Z_,pairs:dP,set:fP,timestamp:aP,bool:eP,int:tP,merge:lP,omap:uP,seq:X_,str:G_},q9=Dw("safeLoad","load"),Y9=Dw("safeLoadAll","loadAll"),G9=Dw("safeDump","dump"),LP={Type:M9,Schema:$9,FAILSAFE_SCHEMA:D9,JSON_SCHEMA:F9,CORE_SCHEMA:z9,DEFAULT_SCHEMA:B9,load:H9,loadAll:U9,dump:V9,YAMLException:W9,types:K9,safeLoad:q9,safeLoadAll:Y9,safeDump:G9};const fo=["requirement","planning","code","test","normal"],Ky={普通:"normal",技术规划:"planning",代码执行:"code",测试回归:"test",需求拆解:"requirement"},X9=["agent","control","provide","condition","jump","condition_jump","start","end"];function J9(e){return X9.includes(e)?e:"agent"}function Q9(e){const t=(e||"").toLowerCase();return t.startsWith("control_")?"control":t.startsWith("agent_")?"agent":t.startsWith("provide_")?"provide":(t.startsWith("tool_"),"agent")}function Z9(e){var t;if(!(e!=null&&e.trim()))return{nodes:[],edges:[],instances:{}};try{const n=LP.load(e);if(!n||typeof n!="object")return{error:"flow.yaml 格式无效:根内容不是对象"};const r=n,i=r.instances&&typeof r.instances=="object"?r.instances:{},s=Array.isArray(r.edges)?r.edges:Array.isArray((t=r.flow)==null?void 0:t.edges)?r.flow.edges:[],o=r.ui&&typeof r.ui=="object"?r.ui:{},c=o.nodePositions&&typeof o.nodePositions=="object"?o.nodePositions:{},l=typeof o.description=="string"&&o.description.trim()?o.description.trim():void 0,u=new Set(Object.keys(i));for(const d of s)d!=null&&d.source&&u.add(String(d.source)),d!=null&&d.target&&u.add(String(d.target));const p=Array.from(u).map(d=>{const h=i[d],y=c[d]&&typeof c[d].x=="number"&&typeof c[d].y=="number"?{x:c[d].x,y:c[d].y}:{x:0,y:0},b=(h==null?void 0:h.definitionId)??d,k=Q9(b),g=(h==null?void 0:h.label)!=null?String(h.label):d,v=(h==null?void 0:h.role)!=null?String(h.role).trim():"",w=Ky[v]||v,S=fo.includes(w)?w:"normal",C=(h==null?void 0:h.model)!=null?String(h.model).trim():void 0,N=(h==null?void 0:h.body)!=null?String(h.body):"",P=(h==null?void 0:h.script)!=null?String(h.script):"";return{id:d,type:J9(k),position:y,data:{label:g,definitionId:b,schemaType:k,role:S,model:C||void 0,body:N,...P.trim()!==""?{script:P}:{}}}}),f=s.filter(d=>(d==null?void 0:d.source)&&(d==null?void 0:d.target)).map((d,h)=>({id:`e-${d.source}-${d.target}-${h}`,source:String(d.source),target:String(d.target),sourceHandle:d.sourceHandle??void 0,targetHandle:d.targetHandle??void 0,markerEnd:{type:_r.ArrowClosed}}));return{nodes:p,edges:f,instances:i,description:l}}catch(n){const r=n instanceof Error?n.message:String(n);let i="";if(/bad indentation of a mapping entry|expected.*scalar|mapping values are not allowed/i.test(r)){const s=r.match(/\((\d+):/);i=`
|
|
111
|
+
|
|
112
|
+
💡 提示:通常由 ${s?`第 ${s[1]} 行附近`:""}的 \`script\` / \`body\` / \`value\` 字段裸写命令字符串引起。
|
|
113
|
+
YAML 中含 \`: \`、\`"\`、\`'\` 等特殊字符的多行字符串必须使用 \`|\` 块标量。
|
|
114
|
+
|
|
115
|
+
✅ 正确写法:
|
|
116
|
+
\`\`\`yaml
|
|
117
|
+
script: |
|
|
118
|
+
node -e "console.log('TODO: scripts/x.mjs')"
|
|
119
|
+
\`\`\`
|
|
120
|
+
❌ 错误写法(当前文件):
|
|
121
|
+
\`\`\`yaml
|
|
122
|
+
script: node -e "console.log('TODO: scripts/x.mjs')"
|
|
123
|
+
\`\`\``}return{error:`flow.yaml 解析失败:${r}${i}`}}}function OP(e,t){var i,s,o,c,l,u,p,f;const n=d=>{const h={type:(d==null?void 0:d.type)??"node",name:(d==null?void 0:d.name)??"",value:(d==null?void 0:d.value)??(d==null?void 0:d.default)??""};return(d==null?void 0:d.required)===!0&&(h.required=!0),(d==null?void 0:d.showOnNode)===!1&&(h.showOnNode=!1),h},r={};for(const d of e){const h=t[d.id]&&typeof t[d.id]=="object"?{...t[d.id]}:{},y=((i=d.data)==null?void 0:i.definitionId)||d.id,b=((s=d.data)==null?void 0:s.inputs)??[],k=((o=d.data)==null?void 0:o.outputs)??[],g=((c=d.data)==null?void 0:c.role)!=null?String(d.data.role).trim():"",v=h.role!=null?String(h.role).trim():"",w=Ky[g]||g,S=Ky[v]||v,C=fo.includes(w)?w:fo.includes(S)?S:"normal",N=Array.isArray(b)?b.map(n):Array.isArray(h.input)?h.input.map($=>n($)):[],P=Array.isArray(k)?k.map(n):Array.isArray(h.output)?h.output.map($=>n($)):[],R=((l=d.data)==null?void 0:l.label)!=null?String(d.data.label):h.label!=null?String(h.label):d.id,M=(u=d.data)==null?void 0:u.body,U=M!=null?String(M):h.body!=null?String(h.body):"";let L=((p=d.data)==null?void 0:p.model)!=null&&String(d.data.model).trim()!==""?String(d.data.model).trim():h.model!=null&&String(h.model).trim()!==""?String(h.model).trim():void 0;(L===""||L==="default")&&(L=void 0);const A={...h,definitionId:y,label:R,role:C,model:L,input:N,output:P};U.trim()===""?delete A.body:A.body=U;const V=(f=d.data)==null?void 0:f.script,T=V!=null?String(V):h.script!=null?String(h.script):"";T.trim()===""?delete A.script:A.script=T,delete A.temperature,delete A.maxTokens,delete A.description,r[d.id]=A}return r}function dS(e,t,n,r){const i=OP(e,n),s=t.map(u=>({source:u.source,target:u.target,sourceHandle:u.sourceHandle??null,targetHandle:u.targetHandle??null})),o={};for(const u of e){const p=u.position??{x:0,y:0};o[u.id]={x:p.x,y:p.y}}const c={nodePositions:o};(r==null?void 0:r.description)!=null&&String(r.description).trim()!==""&&(c.description=String(r.description).trim());const l={instances:i,edges:s,ui:c};return LP.dump(l,{lineWidth:-1})}function eU(e){var i,s;const t={inputNames:[],outputNames:[]},n=Array.isArray((i=e.data)==null?void 0:i.inputs)?e.data.inputs:[],r=Array.isArray((s=e.data)==null?void 0:s.outputs)?e.data.outputs:[];for(let o=0;o<n.length;o++){const c=n[o],l=(c&&c.name!=null?String(c.name).trim():"")||`input-${o}`;t.inputNames.push(l)}for(let o=0;o<r.length;o++){const c=r[o],l=(c&&c.name!=null?String(c.name).trim():"")||`output-${o}`;t.outputNames.push(l)}return t}function tU(e,t,n){var l,u,p;const r=new Set(e.map(f=>f.id)),i={};for(const f of e)i[f.id]=eU(f);const s=new Map,o=new Map;for(const f of t)f.target&&r.has(f.target)&&(s.has(f.target)||s.set(f.target,new Set),f.targetHandle&&s.get(f.target).add(f.targetHandle)),f.source&&r.has(f.source)&&(o.has(f.source)||o.set(f.source,new Set),f.sourceHandle&&o.get(f.source).add(f.sourceHandle));const c=[];for(const f of e){const d=((l=f.data)==null?void 0:l.definitionId)!=null?String(f.data.definitionId):"",h=i[f.id]||{inputNames:[],outputNames:[]},y=h.inputNames.length,b=h.outputNames.length;if(!(d==="control_start"||d.startsWith("provide_"))&&y>0)for(let v=0;v<y;v++){const w=`input-${v}`;if(!((u=s.get(f.id))==null?void 0:u.has(w))){const C=h.inputNames[v]||w;c.push({nodeId:f.id,suffix:n("flow:validation.inputSlotNoEdge",{slotName:C,handle:w}),key:`${f.id}-${w}-in`})}}if(!(d==="control_end")&&b>0)for(let v=0;v<b;v++){const w=`output-${v}`;if(!((p=o.get(f.id))==null?void 0:p.has(w))){const C=h.outputNames[v]||w;c.push({nodeId:f.id,suffix:n("flow:validation.outputSlotNoEdge",{slotName:C,handle:w}),key:`${f.id}-${w}-out`})}}}return c}function qy(e){const t={type:e.type||"node",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&&(t.required=!!e.required),e.showOnNode!=null&&(t.showOnNode=!!e.showOnNode),t}const nU={agent_subAgent:["SubAgent"],control_start:["Start"],control_end:["End"],control_agent_toBool:["Agent ToBool"],control_anyOne:["Any One"],control_cancelled:["Cancelled"],control_cd_workspace:["CD Workspace"],control_deadline:["Deadline"],control_delay:["Delay"],control_if:["If Branch"],control_interval_loop:["Interval Loop"],control_load_skills:["Load Skills"],control_user_workspace:["User Workspace"],control_toBool:["To Bool"],control_wait_until:["Wait Until"],tool_git_checkout:["Git Checkout"],tool_get_env:["Get Env"],tool_load_key:["Load Key"],tool_nodejs:["Node.js Script"],tool_print:["Print"],tool_save_key:["Save Key"],tool_user_ask:["UserAsk"],tool_user_check:["User Confirm"],provide_file:["File"],provide_text:["Text"],display_markdown:["Markdown Display"],display_mermaid:["Mermaid Display"],display_ascii:["ASCII Display"]};function rU(e,t,n){const r=String((n==null?void 0:n.displayName)||"").trim(),i=String(t||"").trim();return!r||!i||r===i?i:(nU[e]||[]).includes(i)?r:i}const iU={tool_git_checkout:new Set(["targetDir","pullIfExists","includeSubmodules","workspaceContext","commit","changed"]),control_load_skills:new Set(["mergeMode","workspaceContext","skillsContext","loadedCount","summary"]),agent_subAgent:new Set(["workspaceContext","skillsContext"])},sU={control_cd_workspace:new Set(["mode","label","cwd","previous"]),control_user_workspace:new Set(["cwd"]),tool_git_checkout:new Set(["branch","targetDir","pullIfExists","includeSubmodules","repoPath","commit","changed"])};function fS(e,t,n){return!Array.isArray(t)||!Array.isArray(n)||n.length===0?t:t.map((r,i)=>{var u,p;const s=n[i],c=n.find(f=>(f==null?void 0:f.name)&&f.name===r.name)||s;if(!c)return r;const l=r.showOnNode===!1&&c.showOnNode==null&&((u=iU[e])==null?void 0:u.has(r.name));return{...r,...r.required==null&&c.required!=null?{required:!!c.required}:{},...l?{showOnNode:!0}:{},...r.showOnNode==null&&c.showOnNode!=null?{showOnNode:!!c.showOnNode}:{},...(p=sU[e])!=null&&p.has(r.name)?{showOnNode:!1}:{}}})}function MP(e){var i,s;const t=Array.isArray((i=e==null?void 0:e.data)==null?void 0:i.inputs)?e.data.inputs:[],n=Array.isArray((s=e==null?void 0:e.data)==null?void 0:s.outputs)?e.data.outputs:[],r=o=>o.map(c=>{const l=qy(c);return{type:String(l.type||"node"),name:String(l.name??""),default:String(l.default??""),required:!!l.required,showOnNode:l.showOnNode!==!1}});return{inputs:r(t),outputs:r(n)}}function wh(e,t,n,r,i){var T,$,D,K,_,I,E,Y,G,F,Z,oe,ue;const s=((T=e.data)==null?void 0:T.definitionId)||String(e.id).replace(/-\d+$/,""),o=n.find(ce=>ce.id===s),c=t[e.id];let l=[],u=[],p=(($=e.data)==null?void 0:$.label)??e.id,f,d,h,y;const b=!!c;c&&(Array.isArray(c.input)&&(l=c.input.map(qy)),Array.isArray(c.output)&&(u=c.output.map(qy)),c.label&&(p=String(c.label)),c.role&&typeof c.role=="string"&&(f=c.role),c.model!=null&&(d=String(c.model).trim()),c.body!=null&&(h=String(c.body)),c.script!=null&&(y=String(c.script)));const k=f??(typeof((D=e.data)==null?void 0:D.role)=="string"?e.data.role:"普通"),g=d??((K=e.data)==null?void 0:K.model)??void 0,v=(o==null?void 0:o.description)!=null?String(o.description).trim():"",w=v!==""?v:void 0,S=h??((_=e.data)==null?void 0:_.body)??"",C=y!==void 0?y:((I=e.data)==null?void 0:I.script)!=null?String(e.data.script):"",N=String(e.id),P=(E=r==null?void 0:r[i])==null?void 0:E[N],R=(Y=P==null?void 0:P.label)==null?void 0:Y.label,M=P==null?void 0:P.body,U=P==null?void 0:P.description;b||(l.length===0&&((G=o==null?void 0:o.inputs)!=null&&G.length)&&(l=o.inputs.map(ce=>({...ce}))),u.length===0&&((F=o==null?void 0:o.outputs)!=null&&F.length)&&(u=o.outputs.map(ce=>({...ce}))));const L=(o==null?void 0:o.id)??s;if(L==="agent_subAgent"&&!u.some(ce=>(ce==null?void 0:ce.name)==="result")){const ce=(Z=o==null?void 0:o.outputs)==null?void 0:Z.find(le=>(le==null?void 0:le.name)==="result");u=[...u,ce?{...ce}:{type:"text",name:"result",default:""}]}if((L==="display_markdown"||L==="display_mermaid"||L==="display_ascii")&&!u.some(ce=>(ce==null?void 0:ce.name)==="next")){const ce=(oe=o==null?void 0:o.outputs)==null?void 0:oe.find(le=>(le==null?void 0:le.name)==="next");u=[...u,ce?{...ce}:{type:"node",name:"next",default:""}]}l=fS(L,l,o==null?void 0:o.inputs),u=fS(L,u,o==null?void 0:o.outputs);const A=rU(L,R||p,o),V=L==="tool_nodejs"||String(C).trim()!=="";return{...e,type:"flowNode",data:{...e.data,label:R||p,displayLabel:A,definitionDisplayName:o==null?void 0:o.displayName,definitionId:L,schemaType:((ue=e.data)==null?void 0:ue.schemaType)??e.type??"agent",role:k,model:g,body:M||S,script:C,inputs:l,outputs:u,description:U||w,originalLabel:p,originalBody:S,...V?{script:C}:{}}}}function $P(e,t){const n=new Map(t.map(r=>[r.id,r]));return e.filter(r=>{var p,f,d,h;const i=n.get(r.source),s=n.get(r.target),o=((f=(p=i==null?void 0:i.data)==null?void 0:p.outputs)==null?void 0:f.length)??0,c=((h=(d=s==null?void 0:s.data)==null?void 0:d.inputs)==null?void 0:h.length)??0,l=r.sourceHandle?parseInt(String(r.sourceHandle).replace("output-",""),10):0,u=r.targetHandle?parseInt(String(r.targetHandle).replace("input-",""),10):0;return i&&s&&l>=0&&l<o&&u>=0&&u<c})}function hn(e){switch(Pp(e)){case"text":return"#2196f3";case"file":return"#4caf50";case"node":return"#ff9800";case"bool":return"#9c27b0";default:return"#9e9e9e"}}function Pp(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 oU(e,t){const n=Pp(e),r=Pp(t);return!n||!r?!1:n==="any"||r==="any"?!0:n===r}const aU=new Set(["workspaceContext","skillsContext"]);function Yy(e){const t=Pp(e==null?void 0:e.type),n=String((e==null?void 0:e.name)||(e==null?void 0:e.id)||"").trim();return t==="text"&&aU.has(n)?`${t}+${n}`:t}function DP(e){return Yy(e)}function xl(e,t){if(!e||!t||!oU(e.type,t.type))return!1;const n=Yy(e),r=Yy(t),i=n.includes("+"),s=r.includes("+");return i||s?n===r:!0}function lU(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 wl(e,t,n){var c;const r=n==="source"?"outputs":"inputs",s=lU(t,n==="source"?"output":"input");return s<0?null:(Array.isArray((c=e==null?void 0:e.data)==null?void 0:c[r])?e.data[r]:[])[s]||null}function Qi(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function cU(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 FP({data:e,selected:t,id:n,deleteNode:r,onProvideExpand:i,modelLists:s,onModelChange:o}){const{t:c}=_t(),l=(e==null?void 0:e.inputs)??[],u=(e==null?void 0:e.outputs)??[],p=((e==null?void 0:e.schemaType)??"agent").toLowerCase(),f=cU(e),d=(e==null?void 0:e.isRunMode)??!1,h=(e==null?void 0:e.isExecuting)??!1,y=(e==null?void 0:e.isDim)??!1,b=(e==null?void 0:e.nodeStatus)??null,k=(e==null?void 0:e.nodeElapsed)??null,g=(e==null?void 0:e.definitionId)||"",v=g.startsWith("provide_"),w=(e==null?void 0:e.displayLabel)||(e==null?void 0:e.label)||c("flow:node.fallbackLabel"),S=e!=null&&e.showBodyPreview?String((e==null?void 0:e.body)||"").trim():"",C=Array.isArray(s==null?void 0:s.cursor)?s.cursor:[],N=Array.isArray(s==null?void 0:s.opencode)?s.opencode:[],P=Array.isArray(s==null?void 0:s.claudeCode)?s.claudeCode:[],R=((e==null?void 0:e.model)??"").trim(),M=p==="agent"&&!g.startsWith("tool_nodejs"),U=new Set(C.map(Qi)),L=new Set(N.map(Qi)),A=new Set(P.map(Qi)),V=R?R.startsWith("cursor:")||R.startsWith("opencode:")||R.startsWith("claude-code:")?R:A.has(R)?`claude-code:${R}`:L.has(R)?`opencode:${R}`:U.has(R)?`cursor:${R}`:R:"",T=R&&!V.startsWith("cursor:")&&!V.startsWith("opencode:")&&!V.startsWith("claude-code:")&&!U.has(R)&&!L.has(R)&&!A.has(R),$=R.startsWith("cursor:")?R.slice(7):R.startsWith("opencode:")?R.slice(9):R.startsWith("claude-code:")?R.slice(12):R,D=I=>{const E=I.target.value;o&&o(n,E)},K=I=>{I.stopPropagation(),r&&r(n)},_=I=>{I.stopPropagation(),i&&i()};return a.jsxs("div",{className:"af-flow-node"+(t?" af-flow-node--selected":"")+(h?" af-flow-node--executing":"")+(b==="success"?" af-flow-node--done":"")+(b==="failed"?" af-flow-node--failed":"")+(b==="running"&&!h?" af-flow-node--running-disk":"")+(y?" af-flow-node--dim":"")+" af-flow-node--"+p.replace(/[^a-z0-9_-]/g,""),"data-schema":p,children:[a.jsxs("div",{className:"af-flow-node__chrome",children:[a.jsx("span",{className:"af-flow-node__type",title:f,children:f}),n&&a.jsx("span",{className:"af-flow-node__id",title:n,children:n}),!d&&M&&a.jsxs("div",{className:"af-flow-node__model-wrap",children:[a.jsxs("select",{className:"af-flow-node__model",value:V,onChange:D,"aria-label":c("flow:node.model"),title:$||c("flow:node.defaultModel"),children:[a.jsx("option",{value:"",children:c("flow:node.defaultModel")}),T&&a.jsx("option",{value:R,children:R}),C.length>0&&a.jsx("optgroup",{label:"Cursor",children:C.map(I=>a.jsx("option",{value:`cursor:${Qi(I)}`,children:Qi(I)},`c-${I}`))}),N.length>0&&a.jsx("optgroup",{label:"OpenCode",children:N.map(I=>a.jsx("option",{value:`opencode:${Qi(I)}`,children:Qi(I)},`o-${I}`))}),P.length>0&&a.jsx("optgroup",{label:"Claude Code",children:P.map(I=>a.jsx("option",{value:`claude-code:${Qi(I)}`,children:Qi(I)},`cc-${I}`))})]}),a.jsx("span",{className:"af-flow-node__model-arrow material-symbols-outlined",children:"expand_more"})]}),h&&a.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--executing",children:"EXECUTING"}),b==="running"&&!h&&a.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--running-disk",title:c("flow:node.diskRunning"),children:"RUNNING"}),b==="success"&&a.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--done",children:k!=null&&String(k).trim()!==""?k:"--"}),b==="failed"&&a.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--failed",children:"FAILED"}),!d&&v&&a.jsx("button",{type:"button",className:"af-flow-node__expand",onClick:_,"aria-label":c("flow:node.expandProvide"),title:c("flow:node.expandProvide"),children:a.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})}),!d&&a.jsx("button",{type:"button",className:"af-flow-node__delete",onClick:K,"aria-label":c("flow:node.deleteNode"),title:c("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:l.map((I,E)=>{if(I.showOnNode===!1)return null;const Y=c("flow:node.inputTooltip",{name:I.name||`#${E}`,type:I.type})+(I.default!=null&&I.default!==""?c("flow:node.defaultSuffix",{value:I.default}):""),G=I.name||`#${E+1}`;return a.jsxs("div",{className:"af-flow-node__port-row",title:Y,children:[a.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--in",children:[G,I.required?a.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),a.jsx(pi,{type:"target",position:Re.Left,id:`input-${E}`,className:"af-flow-node__handle",style:{background:hn(I.type)},title:Y})]},`in-${E}`)})}),a.jsxs("div",{className:"af-flow-node__title-wrap",children:[a.jsx("span",{className:"af-flow-node__title",children:w}),S?a.jsx("span",{className:"af-flow-node__prompt-preview",title:S,children:S}):null]}),a.jsx("div",{className:"af-flow-node__ports af-flow-node__ports--out",children:u.map((I,E)=>{if(I.showOnNode===!1)return null;const Y=c("flow:node.outputTooltip",{name:I.name||`#${E}`,type:I.type})+(I.default!=null&&I.default!==""?c("flow:node.defaultSuffix",{value:I.default}):""),G=I.name||`#${E+1}`;return a.jsxs("div",{className:"af-flow-node__port-row",title:Y,children:[a.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--out",children:[G,I.required?a.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),a.jsx(pi,{type:"source",position:Re.Right,id:`output-${E}`,className:"af-flow-node__handle",style:{background:hn(I.type)},title:Y})]},`out-${E}`)})})]})]})}const Vu="flowNode";function uU(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 pS(e){return e.key==="?"||e.key==="/"&&e.shiftKey}function dU(){return typeof navigator>"u"?!1:/Mac|iPhone|iPod|iPad/i.test(navigator.platform||navigator.userAgent||"")}function fU({open:e,onClose:t,flowId:n,flowSource:r,onArchived:i}){const{t:s}=_t(),o=m.useId(),c=m.useRef(null),[l,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 v;return(v=c.current)==null?void 0:v.focus()});return()=>cancelAnimationFrame(g)},[e,n]),!e)return null;const y=l.trim(),b=y===n;async function k(g){if(g.preventDefault(),!(!b||p)){f(!0),h("");try{const v=await fetch("/api/flow/archive",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:n,flowSource:r,confirmFlowId:y})}),w=await v.json().catch(()=>({}));if(!v.ok){h(typeof w.error=="string"?w.error:s("project:archiveModal.archiveFailed"));return}i()}catch(v){h(String((v==null?void 0:v.message)||v))}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:c,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:s("project:archiveModal.title")}),a.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":s("project:archiveModal.close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:k,children:[a.jsx("p",{className:"af-new-pipeline-lead",children:s("project:archiveModal.lead",{flowId:n})}),a.jsxs("label",{className:"af-new-pipeline-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:s("project:archiveModal.confirmLabel")}),a.jsx("input",{type:"text",className:"af-new-pipeline-input",value:l,onChange:g=>u(g.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":y.length>0&&!b})]}),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:s("project:archiveModal.cancel")}),a.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!b||p,children:s(p?"project:archiveModal.archiving":"project:archiveModal.confirmArchive")})]})]})]})})}function hS({open:e,title:t,message:n,confirmLabel:r,cancelLabel:i,destructive:s=!1,secondaryLabel:o,secondaryDestructive:c=!1,onSecondary:l,onConfirm:u,onCancel:p}){const{t:f}=_t(),d=m.useId(),h=m.useRef(null);if(m.useEffect(()=>{if(!e)return;const g=requestAnimationFrame(()=>{var w;return(w=h.current)==null?void 0:w.focus()});function v(w){w.key==="Escape"&&p(),w.key==="Enter"&&u()}return window.addEventListener("keydown",v),()=>{cancelAnimationFrame(g),window.removeEventListener("keydown",v)}},[e,p,u]),!e)return null;const y=r??f("common:common.confirm","确定"),b=i??f("common:common.cancel","取消"),k=t??f("common:common.confirmTitle","请确认");return a.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:g=>{g.target===g.currentTarget&&p()},children:a.jsxs("div",{ref:h,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":d,tabIndex:-1,onMouseDown:g=>g.stopPropagation(),children:[a.jsxs("div",{className:"af-shortcuts-panel__head",children:[a.jsx("h2",{id:d,className:"af-shortcuts-panel__title",children:k}),a.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:p,"aria-label":b,children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsxs("div",{className:"af-shortcuts-panel__body af-new-pipeline-form",children:[a.jsx("p",{className:"af-new-pipeline-lead",children:n}),a.jsxs("div",{className:"af-new-pipeline-actions",children:[a.jsx("button",{type:"button",className:"af-btn-secondary",onClick:p,children:b}),o&&l?a.jsx("button",{type:"button",className:c?"af-btn-secondary af-btn-destructive":"af-btn-secondary",onClick:l,children:o}):null,a.jsx("button",{type:"button",className:s?"af-btn-primary af-btn-destructive":"af-btn-primary",onClick:u,autoFocus:!0,children:y})]})]})]})})}function pU({open:e,onClose:t,flowId:n,flowSource:r,flowArchived:i=!1,onDeleted:s}){const{t:o}=_t(),c=m.useId(),l=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 v=requestAnimationFrame(()=>{var w;return(w=l.current)==null?void 0:w.focus()});return()=>cancelAnimationFrame(v)},[e,n]),!e)return null;const b=u.trim(),k=b===n;async function g(v){if(v.preventDefault(),!k||f)return;d(!0),y("");let w=null;try{const S=new AbortController;w=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:b,flowArchived:i}),signal:S.signal}),N=await C.json().catch(()=>({}));if(!C.ok){y(typeof N.error=="string"?N.error:o("project:deleteModal.deleteFailed"));return}try{for(let P=localStorage.length-1;P>=0;P--){const R=localStorage.key(P);R&&(R.startsWith(`af:composer-sessions:${n}:${r}`)||R.startsWith(`af:composer-active-session:${n}:${r}`)||R.startsWith(`af:workspace-composer:${n}:${r}`))&&localStorage.removeItem(R)}}catch{}await s()}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{w&&clearTimeout(w),d(!1)}}return a.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:v=>{v.target===v.currentTarget&&t()},children:a.jsxs("div",{ref:l,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":c,tabIndex:-1,onMouseDown:v=>v.stopPropagation(),children:[a.jsxs("div",{className:"af-shortcuts-panel__head",children:[a.jsx("h2",{id:c,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:v=>p(v.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":b.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")})]})]})]})})}function hU({children:e}){return a.jsx("kbd",{className:"af-kbd",children:e})}function Fs({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(hU,{children:t})]},n))})}function mU({open:e,onClose:t}){const{t:n}=_t(),r=m.useRef(null);if(m.useEffect(()=>{if(!e)return;const o=requestAnimationFrame(()=>{var c;return(c=r.current)==null?void 0:c.focus()});return()=>cancelAnimationFrame(o)},[e]),!e)return null;const s=dU()?"⌘":"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(Fs,{keys:[s,"S"]})]}),a.jsxs("li",{className:"af-shortcuts-row",children:[a.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.shortcutsLabel")}),a.jsx(Fs,{keys:["?"]})]}),a.jsxs("li",{className:"af-shortcuts-row",children:[a.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.jumpToNode")}),a.jsx(Fs,{keys:[s,"K"]})]}),a.jsxs("li",{className:"af-shortcuts-row",children:[a.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.openNodePalette")}),a.jsx(Fs,{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(Fs,{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(Fs,{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(Fs,{keys:["Space"]})]}),a.jsxs("li",{className:"af-shortcuts-row",children:[a.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.selectAll")}),a.jsx(Fs,{keys:[s,"A"]})]})]})]})]})]})})}function gU(e,t){if(!t)return 1;const n=t.toLowerCase(),r=(e.id||"").toLowerCase(),i=(e.label||"").toLowerCase(),s=(e.definitionId||"").toLowerCase();return r===n?100:r.startsWith(n)?80:r.includes(n)?60:i.startsWith(n)?40:i.includes(n)?30:s.includes(n)?15:0}function yU({open:e,onClose:t,onJump:n,nodes:r}){const{t:i}=_t(),[s,o]=m.useState(""),[c,l]=m.useState(0),u=m.useRef(null),p=m.useRef(null);m.useEffect(()=>{if(!e)return;o(""),l(0);const y=requestAnimationFrame(()=>{var b;return(b=u.current)==null?void 0:b.focus()});return()=>cancelAnimationFrame(y)},[e]);const f=m.useMemo(()=>{const y=(r||[]).map(g=>{var v,w,S;return{id:g.id,label:((v=g.data)==null?void 0:v.label)||"",definitionId:((w=g.data)==null?void 0:w.definitionId)||"",schemaType:((S=g.data)==null?void 0:S.schemaType)||""}}),b=s.trim(),k=y.map(g=>({e:g,s:gU(g,b)})).filter(g=>g.s>0);return k.sort((g,v)=>v.s-g.s||g.e.id.localeCompare(v.e.id)),k.slice(0,50).map(g=>g.e)},[r,s]);if(m.useEffect(()=>{c>=f.length&&l(0)},[f.length,c]),m.useEffect(()=>{var b;const y=(b=p.current)==null?void 0:b.querySelector(`[data-idx="${c}"]`);y&&y.scrollIntoView({block:"nearest"})},[c]),!e)return null;const d=y=>{const b=f[y];b&&(n(b.id),t())},h=y=>{if(y.key==="Escape"){y.preventDefault(),t();return}if(y.key==="ArrowDown"){y.preventDefault(),l(b=>Math.min(f.length-1,b+1));return}if(y.key==="ArrowUp"){y.preventDefault(),l(b=>Math.max(0,b-1));return}y.key==="Enter"&&(y.preventDefault(),d(c))};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":i("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:i("flow:jumpPalette.placeholder"),value:s,onChange:y=>{o(y.target.value),l(0)},onKeyDown:h,spellCheck:!1,autoComplete:"off"}),a.jsx("span",{className:"af-jump-panel__count",children:f.length})]}),f.length===0?a.jsx("div",{className:"af-jump-panel__empty",children:i("flow:jumpPalette.empty")}):a.jsx("ul",{ref:p,className:"af-jump-panel__list",role:"listbox",children:f.map((y,b)=>a.jsxs("li",{"data-idx":b,role:"option","aria-selected":b===c,className:"af-jump-panel__item"+(b===c?" af-jump-panel__item--active":""),onMouseEnter:()=>l(b),onMouseDown:k=>{k.preventDefault(),d(b)},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:"↓"})," ",i("flow:jumpPalette.hintNavigate")]}),a.jsxs("span",{children:[a.jsx("kbd",{className:"af-kbd",children:"Enter"})," ",i("flow:jumpPalette.hintJump")]}),a.jsxs("span",{children:[a.jsx("kbd",{className:"af-kbd",children:"Esc"})," ",i("flow:jumpPalette.hintClose")]})]})]})})}function xU({open:e,onClose:t,flowId:n,flowSource:r,flowArchived:i=!1,filePath:s,fileName:o,onSaved:c,onAiEdit:l}){const{t:u}=_t(),p=m.useId(),f=m.useRef(null),d=m.useRef(null),[h,y]=m.useState(""),[b,k]=m.useState(""),[g,v]=m.useState(!1),[w,S]=m.useState(!1),[C,N]=m.useState(!1),[P,R]=m.useState(""),[M,U]=m.useState("");if(m.useEffect(()=>{if(!e||!s)return;y(""),k(""),R(""),U(""),v(!0),S(!1),N(!1);const D=new URLSearchParams({flowId:n,flowSource:r,archived:i?"1":"0",path:s});(async()=>{try{const _=await fetch(`/api/pipeline-file-content?${D}`),I=await _.json();if(!_.ok)throw new Error(I.error||"HTTP "+_.status);y(I.content||""),k(I.content||"")}catch(_){R(_.message||String(_))}finally{v(!1)}})();const K=requestAnimationFrame(()=>{var _;return(_=f.current)==null?void 0:_.focus()});return()=>cancelAnimationFrame(K)},[e,s,n,r,i]),!e)return null;const L=h!==b;async function A(D){if(D.preventDefault(),!w){S(!0),R(""),U("");try{const K=new URLSearchParams({flowId:n,flowSource:r,archived:i?"1":"0",path:s}),_=await fetch(`/api/pipeline-file-save?${K}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:h})}),I=await _.json();if(!_.ok)throw new Error(I.error||"HTTP "+_.status);k(h),U(u("flow:fileEdit.saved")),c&&c()}catch(K){R(K.message||String(K))}finally{S(!1)}}}async function V(){if(!(!l||C||!h)){N(!0),R("");try{const D=await l(h);typeof D=="string"&&D&&y(D)}catch(D){R(D.message||String(D))}finally{N(!1)}}}function T(){y(b),R(""),U("")}const $=h.length>1e5;return a.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:D=>{D.target===D.currentTarget&&t()},children:a.jsxs("div",{ref:f,className:"af-shortcuts-panel af-file-edit-panel",role:"dialog","aria-modal":"true","aria-labelledby":p,tabIndex:-1,onMouseDown:D=>D.stopPropagation(),children:[a.jsxs("div",{className:"af-shortcuts-panel__head",children:[a.jsx("h2",{id:p,className:"af-shortcuts-panel__title",children:o||s}),a.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":u("flow:fileEdit.close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsx("div",{className:"af-file-edit-body",children:g?a.jsx("div",{className:"af-file-edit-loading",children:u("flow:fileEdit.loading")}):P&&!h?a.jsx("div",{className:"af-file-edit-error",children:P}):a.jsxs(a.Fragment,{children:[$&&a.jsx("div",{className:"af-file-edit-warning",children:u("flow:fileEdit.largeFileWarning")}),a.jsx("textarea",{ref:d,className:"af-file-edit-textarea",value:h,onChange:D=>y(D.target.value),spellCheck:!1,placeholder:u("flow:fileEdit.placeholder")})]})}),(P||M)&&!g&&a.jsx("div",{className:`af-file-edit-status${M?" af-file-edit-status--success":""}`,children:M||P}),a.jsxs("div",{className:"af-file-edit-actions",children:[a.jsx("button",{type:"button",className:"af-btn-secondary",onClick:T,disabled:!L||w||C,children:u("flow:fileEdit.reset")}),l&&a.jsx("button",{type:"button",className:"af-btn-secondary af-btn-ai",onClick:V,disabled:C||w||!h,children:u(C?"flow:fileEdit.aiRunning":"flow:fileEdit.aiEdit")}),a.jsx("button",{type:"button",className:"af-btn-primary",onClick:A,disabled:!L||w||C,children:u(w?"flow:fileEdit.saving":"flow:fileEdit.save")})]})]})})}const zP=new Set(["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"]),wU=["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"];function vU(e,t){const n=e.slice(0,t),r=n.lastIndexOf("${");if(r<0)return null;const i=n.slice(r+2);return i.includes("}")?null:{atIndex:r,query:i}}function bU(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 mS(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 i=r.slice(6).trim();return i!==""&&t.has(i)}if(r.startsWith("output.")){const i=r.slice(7).trim();return i!==""&&n.has(i)}if(zP.has(r)||t.has(r)||n.has(r))return!0;if(!r.includes(".")){const i=`${r}.md`;if(t.has(i)||n.has(i))return!0}return!1}function HP(e){return{inputNames:mS(e==null?void 0:e.inputs),outputNames:mS(e==null?void 0:e.outputs)}}function kU(e,t,n){const r=HP(t),i=bU(e),s=[];for(const o of i)if(!BP(o.key,r)){const c=o.key.trim()===""?n("flow:placeholder.empty"):o.key.trim();s.push({start:o.start,end:o.end,message:n("flow:placeholder.invalidPlaceholder",{hint:c})})}return s}function SU(e,t){const n=HP(t),r=/\$\{([^}]*)\}/g,i=[];let s=0,o;for(;(o=r.exec(e))!==null;){o.index>s&&i.push({kind:"plain",text:e.slice(s,o.index)});const c=o[0],l=BP(o[1],n);i.push({kind:l?"ph-valid":"ph-invalid",text:c}),s=o.index+c.length}return s<e.length&&i.push({kind:"plain",text:e.slice(s)}),i}function NU(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function jU(e){return e.map(t=>{const n=NU(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 CU(e,t){const n=[];for(const r of(e==null?void 0:e.inputs)??[]){const i=(r==null?void 0:r.name)!=null?String(r.name).trim():"";if(!i)continue;const s=(r==null?void 0:r.type)!=null?String(r.type):"";n.push({section:"input",insert:`input.${i}`,label:i,subtitle:s?t("flow:placeholder.inputSubtitle",{type:s}):t("flow:placeholder.inputSubtitleNoType")})}for(const r of(e==null?void 0:e.outputs)??[]){const i=(r==null?void 0:r.name)!=null?String(r.name).trim():"";if(!i)continue;const s=(r==null?void 0:r.type)!=null?String(r.type):"";n.push({section:"output",insert:`output.${i}`,label:i,subtitle:s?t("flow:placeholder.outputSubtitle",{type:s}):t("flow:placeholder.outputSubtitleNoType")})}for(const r of wU)zP.has(r)&&n.push({section:"runtime",insert:r,label:r,subtitle:t("flow:placeholder.runtimeConst")});return n}function EU(e,t){const n=t.toLowerCase();return n?e.filter(r=>[r.insert,r.label,r.subtitle??""].map(s=>String(s).toLowerCase()).some(s=>s.includes(n))):e}function _U(e,t){if(!e||t<0)return null;const n=Math.min(t,e.value.length),r=getComputedStyle(e),i=document.createElement("div");i.setAttribute("aria-hidden","true"),i.style.visibility="hidden",i.style.position="fixed",i.style.top="0",i.style.left="-99999px",i.style.whiteSpace="pre-wrap",i.style.wordWrap="break-word",i.style.overflow="hidden";const s=e.clientWidth;if(s<=0)return null;i.style.width=`${s}px`,i.style.font=r.font,i.style.lineHeight=r.lineHeight,i.style.padding=r.padding,i.style.border=r.border,i.style.boxSizing=r.boxSizing,i.style.letterSpacing=r.letterSpacing,i.style.textIndent=r.textIndent,i.style.tabSize=r.tabSize||"8",i.textContent=e.value.slice(0,n);const o=document.createElement("span");o.textContent="",i.appendChild(o),document.body.appendChild(i);const c=o.getBoundingClientRect(),l=parseFloat(r.lineHeight),u=Number.isFinite(l)&&l>0?l:c.height||16;return document.body.removeChild(i),{top:c.top,left:c.left,bottom:c.bottom,height:u}}function of({value:e,onChange:t,disabled:n,placeholder:r,rows:i=8,textareaClassName:s,ioSlots:o,variant:c="drawer"}){const{t:l}=_t(),u=m.useId(),p=m.useRef(null),f=m.useRef(null),[d,h]=m.useState(0),[y,b]=m.useState(0),[k,g]=m.useState(null),v=m.useMemo(()=>kU(e,o,l),[e,o,l]),w=v.length>0,S=m.useMemo(()=>SU(e,o),[e,o]),C=m.useMemo(()=>jU(S),[S]),N=m.useMemo(()=>n?null:vU(e,d),[e,d,n]),P=m.useMemo(()=>{if(!N)return[];const A=CU(o,l);return EU(A,N.query)},[N,o,l]);m.useEffect(()=>{b(A=>{const V=Math.max(0,P.length-1);return Math.min(Math.max(0,A),V)})},[P.length]);const R=m.useCallback(()=>{const A=p.current;if(!A||!N||P.length===0){g(null);return}const V=_U(A,d);if(!V){g(null);return}const T=4,$=44,D=13.5*16,K=Math.min(P.length*$+8,D);let _=V.bottom+T;_+K>window.innerHeight-8&&(_=Math.max(8,V.top-K-T));const I=288;let E=V.left;E=Math.max(8,Math.min(E,window.innerWidth-I-8)),g({top:_,left:E})},[N,P.length,d]);m.useLayoutEffect(()=>{if(!N||P.length===0){g(null);return}const A=requestAnimationFrame(()=>R());return()=>cancelAnimationFrame(A)},[N,P.length,d,e,R]),m.useEffect(()=>{if(!N||P.length===0)return;const A=()=>R();return window.addEventListener("scroll",A,!0),window.addEventListener("resize",A),()=>{window.removeEventListener("scroll",A,!0),window.removeEventListener("resize",A)}},[N,P.length,R]);const M=m.useCallback(A=>{if(!N)return;const{atIndex:V}=N,T=e.slice(0,V)+"${"+A+"}"+e.slice(d);t(T);const $=V+A.length+3;queueMicrotask(()=>{const D=p.current;D&&(D.focus(),D.setSelectionRange($,$)),h($)})},[N,e,d,t]),U=m.useCallback(()=>{const A=p.current,V=f.current;!A||!V||(V.scrollTop=A.scrollTop,V.scrollLeft=A.scrollLeft,N&&P.length>0&&queueMicrotask(()=>R()))},[N,P.length,R]),L=m.useCallback(A=>{if(!n&&N&&P.length>0&&(A.key==="ArrowDown"||A.key==="ArrowUp"||A.key==="Enter")){if(A.key==="ArrowDown")A.preventDefault(),b(V=>(V+1)%P.length);else if(A.key==="ArrowUp")A.preventDefault(),b(V=>(V-1+P.length)%P.length);else if(A.key==="Enter"&&!A.shiftKey){A.preventDefault();const V=P[y];V&&M(V.insert)}}},[n,N,P,y,M]);return a.jsxs("div",{className:"af-body-prompt-editor"+(c==="expand"?" af-body-prompt-editor--expand":""),children:[a.jsxs("div",{className:"af-body-prompt-stack",children:[a.jsx("pre",{ref:f,className:"af-body-prompt-backdrop "+s,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:C+`
|
|
124
|
+
`}}),a.jsx("textarea",{ref:p,className:"af-body-prompt-textarea "+s,rows:i,value:e,disabled:n,placeholder:r,spellCheck:!1,"aria-invalid":w,"aria-describedby":w?u:void 0,onChange:A=>{t(A.target.value),h(A.target.selectionStart??A.target.value.length)},onSelect:A=>{const V=A.target;V instanceof HTMLTextAreaElement&&h(V.selectionStart??0)},onClick:A=>{const V=A.target;V instanceof HTMLTextAreaElement&&h(V.selectionStart??0)},onKeyUp:A=>{const V=A.target;V instanceof HTMLTextAreaElement&&h(V.selectionStart??V.value.length)},onKeyDown:L,onScroll:U})]}),N&&P.length>0&&k?Hr.createPortal(a.jsx("ul",{className:"af-body-ph-menu af-body-ph-menu--pop af-composer-mention-menu",role:"listbox","aria-label":l("flow:nodeProps.placeholderSlots"),style:{position:"fixed",top:k.top,left:k.left,right:"auto",bottom:"auto",margin:0,zIndex:2e4},children:P.map((A,V)=>a.jsx("li",{role:"option","aria-selected":V===y,children:a.jsxs("button",{type:"button",className:"af-composer-mention-item"+(V===y?" af-composer-mention-item--active":""),onMouseDown:T=>T.preventDefault(),onMouseEnter:()=>b(V),onClick:()=>M(A.insert),children:[a.jsx("span",{className:"af-composer-mention-id",children:`\${${A.insert}}`}),A.subtitle?a.jsx("span",{className:"af-composer-mention-sub",children:A.subtitle}):null]})},`${A.section}-${A.insert}`))}),document.body):null,w?a.jsx("p",{id:u,className:"af-body-ph-issues",role:"status",children:v.map(A=>A.message).join(" · ")}):null]})}const UP=/^[a-zA-Z_][a-zA-Z0-9_-]*$/;function af(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function gS({kind:e,label:t,slots:n,onSlotsChange:r,disabled:i,requiredReadonly:s=!0}){const{t:o}=_t(),c=()=>r([...n,{type:"node",name:"",default:"",required:!1,showOnNode:!0}]),l=f=>r(n.filter((d,h)=>h!==f)),u=(f,d,h)=>{const y=n.map((b,k)=>k===f?{...b,[d]:h}:b);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:c,disabled:i,"aria-label":o("flow:nodeProps.addPinAriaLabel",{label:t}),children:o("flow:nodeProps.addPin")})]}),a.jsx("p",{className:"af-node-props-io-hint",children:o("flow:nodeProps.handleHint",{prefix: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.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:i,"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:i,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:i,spellCheck:!1,autoComplete:"off","aria-label":o("flow:nodeProps.pinDefaultAriaLabel",{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=>{s||u(d,"required",h.target.checked)},disabled:i||s,"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:i,"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:()=>l(d),disabled:i,"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 VP({draft:e,setDraft:t,definitionId:n,systemPromptReadonly:r,modelLists:i,disabled:s,onIdBlur:o,onClose:c,onPublishToMarketplace:l,allowEditRequiredPins:u=!1,error:p,ioSlots:f}){const{t:d}=_t(),[h,y]=m.useState(!1),[b,k]=m.useState(!1),[g,v]=m.useState({status:"idle",message:""}),w=m.useCallback(A=>{t(V=>V&&{...V,...A})},[t]),{cursorList:S,opencodeList:C,claudeCodeList:N,currentNotInLists:P}=m.useMemo(()=>{const A=Array.isArray(i==null?void 0:i.cursor)?i.cursor:[],V=Array.isArray(i==null?void 0:i.opencode)?i.opencode:[],T=Array.isArray(i==null?void 0:i.claudeCode)?i.claudeCode:[],$=new Set([...A,...V,...T].map(af)),D=((e==null?void 0:e.model)??"").trim(),K=D.startsWith("cursor:")?D.slice(7):D.startsWith("opencode:")?D.slice(9):D.startsWith("claude-code:")?D.slice(12):D,_=D&&!$.has(K)?D:"";return{cursorList:A,opencodeList:V,claudeCodeList:T,currentNotInLists:_}},[i,e==null?void 0:e.model]);if(!e)return null;const R=String(e.script??""),M=n==="tool_nodejs"||R.trim()!=="",U=typeof l=="function"&&!s&&(e==null?void 0:e.newId),L=async()=>{if(U){v({status:"running",message:d("flow:nodeProps.publishRunning")});try{const A=await l(e,n);v({status:"success",message:A!=null&&A.definitionId?d("flow:nodeProps.publishSuccessWithId",{id:A.definitionId}):d("flow:nodeProps.publishSuccess")})}catch(A){v({status:"error",message:String((A==null?void 0:A.message)||A)})}}};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:L,disabled:!U||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:c,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:A=>w({newId:A.target.value}),onBlur:o,disabled:s,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:A=>w({label:A.target.value}),disabled:s,spellCheck:!1})]}),a.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[a.jsxs("span",{className:"af-node-props-label",children:[d("flow:node.role"),"(ROLE)"]}),a.jsx("select",{className:"af-node-props-select",value:fo.includes(e.role)?e.role:d("flow:roles.normal"),onChange:A=>w({role:A.target.value}),disabled:s,children:fo.map(A=>a.jsx("option",{value:A,children:A},A))})]}),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 A=(e.model||"").trim();return A?P||A:""})(),onChange:A=>w({model:A.target.value}),disabled:s,"aria-label":d("flow:nodeProps.modelAriaLabel"),children:[a.jsx("option",{value:"",children:d("flow:node.defaultModel")}),P?a.jsxs("option",{value:P,children:[P,d("flow:nodeProps.yamlValueNotInList")]}):null,S.length>0?a.jsx("optgroup",{label:"Cursor",children:S.map(A=>a.jsx("option",{value:af(A),children:A},`c-${A}`))}):null,C.length>0?a.jsx("optgroup",{label:"OpenCode",children:C.map(A=>a.jsx("option",{value:af(A),children:A},`o-${A}`))}):null,N.length>0?a.jsx("optgroup",{label:"Claude Code",children:N.map(A=>a.jsx("option",{value:`claude-code:${af(A)}`,children:A},`cc-${A}`))}):null]})]}),a.jsx(gS,{kind:"input",label:d("flow:nodeProps.inputPins"),slots:Array.isArray(e.inputs)?e.inputs:[],onSlotsChange:A=>w({inputs:A}),disabled:s,requiredReadonly:!u}),a.jsx(gS,{kind:"output",label:d("flow:nodeProps.outputPins"),slots:Array.isArray(e.outputs)?e.outputs:[],onSlotsChange:A=>w({outputs:A}),disabled:s,requiredReadonly:!u}),M?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:s,children:a.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),a.jsx(of,{value:R,onChange:A=>w({script:A}),disabled:s,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("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:s,children:a.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),a.jsx(of,{value:e.body,onChange:A=>w({body:A}),disabled:s,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})]})]}),b?a.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":d("flow:nodeProps.editScript"),onMouseDown:A=>{A.target===A.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(of,{value:R,onChange:A=>w({script:A}),disabled:s,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:A=>{A.target===A.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(of,{value:e.body,onChange:A=>w({body:A}),disabled:s,placeholder:d("flow:nodeProps.bodyPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:f,variant:"expand"})]})}):null]})}function Fw(e){var n;if(e.displayKind==="image"||e.encoding==="base64"&&((n=e.mimeType)!=null&&n.startsWith("image/")))return"image";if(e.displayKind==="json"||e.mimeType==="application/json")return"json";if(e.displayKind==="markdown"||e.mimeType==="text/markdown")return"markdown";if(e.displayKind==="text")return"text";const t=(e.content||"").trim();if(t&&(t.startsWith("{")||t.startsWith("[")))try{return JSON.parse(t),"json"}catch{}return"text"}function PU(e){const t=Fw(e);if(t==="image"){const n=(e.mimeType||"image/png").split("/")[1];return n?n.toUpperCase():"IMAGE"}return t==="json"?"JSON":t==="markdown"?"MD":null}function WP(e){try{return JSON.stringify(JSON.parse(e.trim()),null,2)}catch{return e}}function yS({text:e}){const{t}=_t(),n=e||"";return n.trim()?a.jsx("div",{className:"af-run-ctx-md",children:a.jsx(Uu,{children:n})}):a.jsx("div",{className:"af-run-ctx-hint",children:t("flow:runContext.empty")})}function xS({o:e}){var r;const{t}=_t(),n=Fw(e);if(n==="image"||e.encoding==="base64"&&((r=e.mimeType)!=null&&r.startsWith("image/"))){const s=`data:${e.mimeType||"image/png"};base64,${e.content||""}`;return a.jsxs("div",{className:"af-run-ctx-media",children:[a.jsx("img",{className:"af-run-ctx-img",src:s,alt:e.slot||"output",loading:"lazy"}),e.truncated?a.jsx("div",{className:"af-run-ctx-hint",children:t("flow:runContext.imageTruncated")}):null]})}if(n==="json")return a.jsx("pre",{className:"af-run-ctx-pre",children:WP(e.content||"")});if(n==="markdown"){const i=e.content||"";return i.trim()?a.jsx("div",{className:"af-run-ctx-md",children:a.jsx(Uu,{children:i})}):a.jsx("div",{className:"af-run-ctx-hint",children:t("flow:runContext.empty")})}return a.jsx("pre",{className:"af-run-ctx-pre",children:e.content!=null&&e.content!==""?e.content:t("flow:runContext.empty")})}function wS(e){return PU(e)}function vS(e){var r;if(!e)return null;const t=Fw(e);if(t==="image"||e.encoding==="base64"&&((r=e.mimeType)!=null&&r.startsWith("image/")))return null;const n=e.content;return n==null||n===""?null:t==="json"?WP(String(n)):String(n)}function bS({text:e,title:t,copiedLabel:n}){const[r,i]=m.useState(!1);if(!e)return null;const s=async()=>{try{await navigator.clipboard.writeText(e),i(!0),window.setTimeout(()=>i(!1),1400)}catch{}};return a.jsx("button",{type:"button",className:"af-icon-btn af-run-ctx-copy-btn",onClick:s,title:r?n:t,"aria-label":r?n:t,children:a.jsx("span",{className:"material-symbols-outlined",children:r?"check":"content_copy"})})}const kS=2e4,KP="af:run-node-ctx-width";function Mf(){return typeof window>"u"?416:Math.min(26*16,window.innerWidth-32)}function Ys(e){const n=Math.max(280,Math.min(Math.floor(window.innerWidth*.92),1200));return Number.isFinite(e)?Math.min(Math.max(Math.round(e),200),n):Ys(Mf())}function IU(){try{const e=localStorage.getItem(KP);if(e==null)return Ys(Mf());const t=parseInt(e,10);return Number.isFinite(t)?Ys(t):Ys(Mf())}catch{return Ys(Mf())}}async function SS(e,t,n,r){const i=new URLSearchParams({flowId:e,instanceId:t});n&&String(n).trim()&&i.set("runId",String(n).trim());const s=await fetch(`/api/node-exec-context?${i.toString()}`,{signal:r}),o=await s.text();let c;try{c=JSON.parse(o)}catch{throw new Error(o.startsWith("<!")||o.startsWith("<html")?"apiConnectError":"invalidJson")}if(!s.ok)throw new Error(c.error||"HTTP "+s.status);return c}function AU(e,t){const n=`flow:runContext.${t}`,r=e(n);return r!==n?r:t}function TU({instanceId:e,flowId:t,runId:n,nodeStatus:r,onClose:i}){const{t:s}=_t(),[o,c]=m.useState(()=>typeof window<"u"&&window.matchMedia("(max-width: 960px)").matches),[l,u]=m.useState(IU),p=m.useRef({active:!1,pointerId:-1,startX:0,startW:416}),[f,d]=m.useState(!0),[h,y]=m.useState(""),[b,k]=m.useState([]),[g,v]=m.useState(null),[w,S]=m.useState(null),C=m.useRef(null),N=m.useRef(null),P=m.useRef(0),R=m.useRef(0);m.useLayoutEffect(()=>{const _=window.matchMedia("(max-width: 960px)"),I=()=>c(_.matches);return _.addEventListener("change",I),()=>_.removeEventListener("change",I)},[]),m.useEffect(()=>{function _(){u(I=>Ys(I))}return window.addEventListener("resize",_),()=>window.removeEventListener("resize",_)},[]);const M=m.useCallback(()=>{u(_=>{const I=Ys(_);try{localStorage.setItem(KP,String(I))}catch{}return I})},[]),U=m.useCallback(_=>{if(o||_.button!==0)return;_.preventDefault();const I=_.currentTarget;p.current={active:!0,pointerId:_.pointerId,startX:_.clientX,startW:l},I.setPointerCapture(_.pointerId)},[o,l]),L=m.useCallback(_=>{const I=p.current;if(!I.active||_.pointerId!==I.pointerId)return;const E=I.startX-_.clientX;u(Ys(I.startW+E))},[]),A=m.useCallback(_=>{const I=p.current;if(!(!I.active||_.pointerId!==I.pointerId)){I.active=!1;try{_.currentTarget.releasePointerCapture(_.pointerId)}catch{}M()}},[M]),V=m.useCallback(()=>{const _=p.current;_.active&&(_.active=!1,M())},[M]),T=m.useCallback(_=>{const I=Array.isArray(_)?_:[];k(I),v(E=>E&&I.some(Y=>Y.execId===E)?E:I.length>0?I[I.length-1].execId:null)},[]),$=m.useCallback(()=>{if(!e||!t)return;const _=++P.current,I=new AbortController,E=window.setTimeout(()=>I.abort(),kS);(async()=>{try{const Y=await SS(t,e,n,I.signal);if(_!==P.current)return;T(Array.isArray(Y.rounds)?Y.rounds:[])}catch{}finally{window.clearTimeout(E)}})()},[e,t,n,T]);m.useEffect(()=>{if(!e||!t){d(!1),y(""),k([]);return}const _=++R.current;d(!0),y(""),k([]),v(null);const I=new AbortController,E=window.setTimeout(()=>I.abort(),kS);return(async()=>{try{const Y=await SS(t,e,n,I.signal);if(_!==R.current)return;T(Array.isArray(Y.rounds)?Y.rounds:[])}catch(Y){if(_!==R.current)return;const G=(Y==null?void 0:Y.name)==="AbortError"?"requestTimeout":Y.message||String(Y);y(G)}finally{window.clearTimeout(E),_===R.current&&d(!1)}})(),()=>{I.abort(),R.current++,P.current++}},[e,t,n,T]),m.useEffect(()=>{r&&$()},[r,$]),m.useEffect(()=>{clearInterval(N.current);const _=b.length>0?b[b.length-1]:null;return(r==="running"&&b.length===0||!!(_&&_.status==="running"))&&e&&t&&(N.current=setInterval(()=>$(),2e3)),()=>clearInterval(N.current)},[b,e,t,n,r,$]),m.useEffect(()=>{C.current&&(C.current.scrollTop=0)},[g]);const D=b.find(_=>_.execId===g),K=o?void 0:{width:`${l}px`};return a.jsxs("aside",{className:"af-run-ctx-panel",style:K,"aria-label":s("flow:runContext.title"),children:[o?null:a.jsx("div",{className:"af-run-ctx-resize",role:"separator","aria-orientation":"vertical","aria-label":s("flow:runContext.resizeHandle"),onPointerDown:U,onPointerMove:L,onPointerUp:A,onPointerCancel:A,onLostPointerCapture:V}),a.jsxs("div",{className:"af-run-ctx-panel__main",children:[a.jsxs("div",{className:"af-run-ctx-head",children:[a.jsx("h2",{className:"af-run-ctx-title",title:e,children:e}),a.jsx("button",{type:"button",className:"af-icon-btn",onClick:i,"aria-label":s("common:common.close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),f&&a.jsx("div",{className:"af-run-ctx-placeholder",children:s("common:common.loading")}),h&&a.jsx("div",{className:"af-run-ctx-error",children:AU(s,h)}),!f&&!h&&b.length===0&&a.jsx("div",{className:"af-run-ctx-placeholder",children:s(r==="running"?"flow:runContext.executingNoArtifacts":"flow:runContext.noData")}),b.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"af-run-ctx-rounds af-run-ctx-rounds--select af-run-ctx-round--"+LU((D==null?void 0:D.status)||""),children:[a.jsx("span",{className:"af-run-ctx-round-dot","aria-hidden":!0}),a.jsx("select",{className:"af-run-ctx-round-select",value:String(g??""),onChange:_=>{const I=_.target.value;v(I==="latest"?"latest":Number(I))},children:[...b].reverse().map(_=>{const I=_.execId==="latest"?s("flow:runContext.latest"):`#${_.execId}`,E=OU(s,_.status),Y=_.finishedAt?` · ${RU(_.finishedAt)}`:"";return a.jsx("option",{value:String(_.execId),children:`${I} · ${E}${Y}`},_.execId)})})]}),D&&a.jsxs("div",{className:"af-run-ctx-body",ref:C,children:[D.inputs&&D.inputs.length>0&&a.jsxs("section",{className:"af-run-ctx-section",children:[a.jsxs("h3",{className:"af-run-ctx-section-title",children:[a.jsx("span",{className:"material-symbols-outlined af-run-ctx-section-icon","aria-hidden":!0,children:"input"}),"Inputs"]}),D.inputs.map((_,I)=>a.jsxs("div",{className:"af-run-ctx-output-slot",children:[a.jsx("div",{className:"af-run-ctx-slot-head",children:a.jsx("div",{className:"af-run-ctx-slot-name",children:_.slot})}),a.jsx("pre",{className:"af-run-ctx-slot-text",children:_.value})]},`${_.slot}-${I}`))]}),D.prompt!=null&&a.jsxs("section",{className:"af-run-ctx-section",children:[a.jsxs("h3",{className:"af-run-ctx-section-title",children:[a.jsx("span",{className:"material-symbols-outlined af-run-ctx-section-icon","aria-hidden":!0,children:"description"}),"Prompt",a.jsx("button",{type:"button",className:"af-icon-btn af-run-ctx-section-expand",onClick:()=>S("prompt"),title:s("flow:nodeProps.expand"),children:a.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),a.jsx(yS,{text:D.prompt})]}),D.outputs&&D.outputs.length>0&&a.jsxs("section",{className:"af-run-ctx-section",children:[a.jsxs("h3",{className:"af-run-ctx-section-title",children:[a.jsx("span",{className:"material-symbols-outlined af-run-ctx-section-icon","aria-hidden":!0,children:"output"}),"Outputs",a.jsx("button",{type:"button",className:"af-icon-btn af-run-ctx-section-expand",onClick:()=>S("output"),title:s("flow:nodeProps.expand"),children:a.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),D.outputs.map((_,I)=>{const E=wS(_),Y=vS(_);return a.jsxs("div",{className:"af-run-ctx-output-slot",children:[a.jsxs("div",{className:"af-run-ctx-slot-head",children:[a.jsx("div",{className:"af-run-ctx-slot-name",children:_.slot}),E?a.jsx("span",{className:"af-run-ctx-format-badge",title:s("flow:runContext.detectedContentType"),children:E}):null,a.jsx(bS,{text:Y,title:s("common:common.copy"),copiedLabel:s("common:common.copied")})]}),a.jsx(xS,{o:_})]},`${_.slot}-${I}`)})]}),!D.prompt&&(!D.outputs||D.outputs.length===0)&&a.jsx("div",{className:"af-run-ctx-placeholder",children:s("flow:runContext.roundNoContent")})]})]})]}),w&&D&&a.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true",onClick:_=>{_.target===_.currentTarget&&S(null)},children:a.jsxs("div",{className:"af-node-props-expand-panel",children:[a.jsxs("div",{className:"af-node-props-expand-head",children:[a.jsx("span",{className:"af-node-props-expand-title",children:w==="prompt"?"Prompt":"Outputs"}),a.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>S(null),"aria-label":s("common:common.close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsxs("div",{className:"af-node-props-expand-body af-run-ctx-expand-body",children:[w==="prompt"&&D.prompt!=null&&a.jsx(yS,{text:D.prompt}),w==="output"&&D.outputs&&D.outputs.map((_,I)=>{const E=wS(_),Y=vS(_);return a.jsxs("div",{className:"af-run-ctx-output-slot",style:{marginBottom:"1rem"},children:[a.jsxs("div",{className:"af-run-ctx-slot-head",children:[a.jsx("div",{className:"af-run-ctx-slot-name",children:_.slot}),E?a.jsx("span",{className:"af-run-ctx-format-badge",children:E}):null,a.jsx(bS,{text:Y,title:s("common:common.copy"),copiedLabel:s("common:common.copied")})]}),a.jsx(xS,{o:_})]},`${_.slot}-${I}`)})]})]})})]})}function RU(e){try{const t=new Date(e);if(isNaN(t.getTime()))return e;const n=r=>String(r).padStart(2,"0");return`${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}catch{return e}}function LU(e){const t=String(e||"").toLowerCase();return t==="success"||t==="completed"||t==="done"?"success":t==="failed"||t==="error"?"failed":t==="running"||t==="executing"?"running":t==="cache_not_met"?"cache":t?"unknown":"pending"}function OU(e,t){const n=String(t||"").toLowerCase();return n?n==="success"||n==="completed"||n==="done"?e("flow:runContext.statusSuccess",{defaultValue:"成功"}):n==="failed"||n==="error"?e("flow:runContext.statusFailed",{defaultValue:"失败"}):n==="running"||n==="executing"?e("flow:runContext.statusRunning",{defaultValue:"运行中"}):n==="cache_not_met"?e("flow:runContext.statusCacheMiss",{defaultValue:"缓存失效"}):t:e("flow:runContext.statusPending",{defaultValue:"等待"})}function MU({flowId:e,flowSource:t,flowArchived:n,provideNodes:r,edges:i,nodes:s,onCliInputsChange:o,onBackToEdit:c}){const{t:l}=_t(),[u,p]=m.useState({}),[f,d]=m.useState(null),[h,y]=m.useState({}),[b,k]=m.useState(!0),[g,v]=m.useState(!1),[w,S]=m.useState(""),[C,N]=m.useState(!1),[P,R]=m.useState(null),M=m.useRef(null),U=m.useRef(!0),L=m.useRef({});m.useMemo(()=>{var E,Y,G;const I={};for(const F of r){const Z=(G=(Y=(E=F.data)==null?void 0:E.outputs)==null?void 0:Y[0])==null?void 0:G.default;Z!=null&&Z!==""&&(I[F.id]=String(Z))}return L.current=I,I},[r]);const A=m.useMemo(()=>{var E;const I={};for(const Y of s){if(!((E=Y.data)!=null&&E.inputs))continue;const G=Y.data.inputs;for(let F=0;F<G.length;F++){const Z=G[F];if(!(Z!=null&&Z.name))continue;const oe=i.find(ce=>ce.target===Y.id&&ce.targetHandle===`input-${F}`);if(!(oe!=null&&oe.source))continue;r.find(ce=>ce.id===oe.source)&&(I[oe.source]=Z.name)}}return I},[s,i,r]);m.useEffect(()=>(U.current=!0,()=>{U.current=!1}),[]),m.useEffect(()=>{if(!e){k(!1);return}k(!0);const I=new URLSearchParams({flowId:e,flowSource:t||"user"});n&&I.set("archived","1"),fetch(`/api/flow/run-config?${I.toString()}`).then(E=>{if(!E.ok)throw new Error(`HTTP ${E.status}`);return E.json()}).then(E=>{var G;if(!U.current)return;p(E.presets||{}),d(E.activePreset||null);const Y=E.activePreset&&((G=E.presets)!=null&&G[E.activePreset])?E.presets[E.activePreset]:{};y({...L.current,...Y}),k(!1)}).catch(()=>{U.current&&(y(L.current),k(!1))})},[e,t,n]),m.useEffect(()=>{var E;if(!o)return;const I={};for(const[Y,G]of Object.entries(h)){const F=A[Y];if(!F)continue;const Z=r.find(ue=>ue.id===Y);if(!Z)continue;(((E=Z.data)==null?void 0:E.definitionId)||"").startsWith("provide_file")?I[F]={type:"file",path:G}:I[F]={type:"str",value:G}}o(I)},[h,A,r,o]);const V=m.useCallback((I,E)=>{y(Y=>({...Y,[I]:E}))},[]),T=m.useCallback(I=>{I!==f&&(d(I),I&&u[I]?y({...L.current,...u[I]}):y(L.current))},[f,u]),$=m.useCallback(async()=>{if(w.trim()){v(!0);try{const I={...u,[w.trim()]:h},E={flowId:e,flowSource:t,archived:n,presets:I,activePreset:w.trim()};(await fetch("/api/flow/run-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(E)})).ok&&(p(I),d(w.trim()),S(""),N(!1))}finally{v(!1)}}},[e,t,n,u,h,w]),D=m.useCallback(async()=>{if(f){v(!0);try{const I={...u};delete I[f];const E=Object.keys(I)[0]||null;(await fetch("/api/flow/run-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:e,flowSource:t,archived:n,presets:I,activePreset:E})})).ok&&(p(I),d(E),E&&I[E]?y({...L.current,...I[E]}):y(L.current))}finally{v(!1)}}},[e,t,n,u,f]),K=m.useCallback(async()=>{if(f){v(!0);try{const I={...u,[f]:h};(await fetch("/api/flow/run-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:e,flowSource:t,archived:n,presets:I,activePreset:f})})).ok&&p(I)}finally{v(!1)}}},[e,t,n,u,f,h]),_=Object.keys(u);return _.length>0,b?a.jsx("aside",{className:"af-run-config-panel",children:a.jsx("div",{className:"af-run-config-loading",children:l("common.loading")})}):a.jsxs("aside",{className:"af-run-config-panel",children:[a.jsxs("div",{className:"af-run-config-preset",children:[a.jsx("label",{className:"af-run-config-preset-label",children:l("flow:runConfig.preset")}),a.jsxs("div",{className:"af-run-config-preset-row",children:[a.jsxs("select",{className:"af-run-config-preset-select",value:f||"",onChange:I=>T(I.target.value||null),disabled:g,children:[a.jsx("option",{value:"",children:l("flow:runConfig.default")}),_.map(I=>a.jsx("option",{value:I,children:I},I))]}),a.jsx("button",{type:"button",className:"af-run-config-preset-btn af-run-config-preset-btn--new",onClick:()=>N(!0),disabled:g,title:l("flow:runConfig.newPreset"),children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add"})}),f&&a.jsx("button",{type:"button",className:"af-run-config-preset-btn af-run-config-preset-btn--save",onClick:K,disabled:g,title:l("flow:runConfig.savePreset"),children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"save"})}),f&&a.jsx("button",{type:"button",className:"af-run-config-preset-btn af-run-config-preset-btn--delete",onClick:D,disabled:g,title:l("flow:runConfig.deletePreset"),children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"delete"})})]})]}),C&&a.jsxs("div",{className:"af-run-config-save-dialog",children:[a.jsx("input",{type:"text",className:"af-run-config-save-input",placeholder:l("flow:runConfig.presetNamePlaceholder"),value:w,onChange:I=>S(I.target.value),disabled:g}),a.jsxs("div",{className:"af-run-config-save-actions",children:[a.jsx("button",{type:"button",className:"af-btn-primary",onClick:$,disabled:g||!w.trim(),children:l(g?"common.saving":"common.save")}),a.jsx("button",{type:"button",className:"af-btn-outline",onClick:()=>{N(!1),S("")},disabled:g,children:l("common.cancel")})]})]}),a.jsxs("div",{className:"af-run-config-inputs",children:[a.jsx("div",{className:"af-run-config-inputs-header",children:l("flow:runConfig.inputParams")}),r.length===0?a.jsx("div",{className:"af-run-config-empty",children:l("flow:runConfig.noProvideNodes")}):a.jsx("div",{className:"af-run-config-input-list",children:r.map(I=>{var oe,ue;const Y=(((oe=I.data)==null?void 0:oe.definitionId)||"").startsWith("provide_file"),G=((ue=I.data)==null?void 0:ue.label)||I.id,F=I.id,Z=h[F]||"";return a.jsxs("div",{className:"af-run-config-input-item",children:[a.jsxs("div",{className:"af-run-config-input-head",children:[a.jsx("span",{className:"af-run-config-input-icon material-symbols-outlined"+(Y?" af-run-config-input-icon--file":""),"aria-hidden":!0,children:Y?"description":"text_fields"}),a.jsx("span",{className:"af-run-config-input-label",children:G}),a.jsx("button",{type:"button",className:"af-run-config-input-expand",onClick:()=>R({instanceId:F,label:G,content:Z}),"aria-label":l("flow:runConfig.expandInput"),title:l("flow:runConfig.expandInput"),children:a.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),a.jsx("div",{className:"af-run-config-input-id",children:F}),a.jsx("input",{type:"text",className:"af-run-config-input-field",value:Z,onChange:ce=>V(F,ce.target.value),placeholder:l(Y?"flow:runConfig.filePathPlaceholder":"flow:runConfig.stringValuePlaceholder")})]},F)})})]}),P&&Hr.createPortal(a.jsx("div",{className:"af-provide-edit-overlay",children:a.jsxs("div",{className:"af-provide-edit-modal",role:"dialog","aria-modal":"true",children:[a.jsxs("div",{className:"af-provide-edit-modal__head",children:[a.jsx("span",{className:"material-symbols-outlined",children:"edit_document"}),a.jsx("span",{className:"af-provide-edit-modal__title",children:P.label}),a.jsx("button",{type:"button",className:"af-provide-edit-modal__close",onClick:()=>R(null),"aria-label":l("common:close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsx("div",{className:"af-provide-edit-modal__body",children:a.jsx("textarea",{ref:M,className:"af-provide-edit-modal__textarea",defaultValue:P.content,autoFocus:!0})}),a.jsxs("div",{className:"af-provide-edit-modal__foot",children:[a.jsxs("button",{type:"button",className:"af-provide-edit-modal__btn af-provide-edit-modal__btn--save",onClick:()=>{!P||!M.current||(V(P.instanceId,M.current.value),R(null))},children:[a.jsx("span",{className:"material-symbols-outlined",children:"save"}),l("flow:provideEdit.save")]}),a.jsxs("button",{type:"button",className:"af-provide-edit-modal__btn",onClick:()=>R(null),children:[a.jsx("span",{className:"material-symbols-outlined",children:"close"}),l("flow:provideEdit.cancel")]})]})]})}),document.body)]})}const qP={ai:["planner-system","planner-user","planner-response","agent-step-prompt","repair-prompt","ai-thinking","ai-assistant","ai-result","ai-tool"],flow:["composer-start","classify","plan","phase-plan","phase-complete","phase-auto-continue","composer-done"],step:["step-start","step-progress","step-done","validation"],output:["natural","status"],error:["error"]},$U={"planner-system":"#9ecaff","planner-user":"#9ecaff","planner-response":"#7c4dff","agent-step-prompt":"#7c4dff","repair-prompt":"#ff6b6b","ai-thinking":"#a8b9d4","ai-assistant":"#e8deff","ai-result":"#00e475","ai-tool":"#9ecaff","composer-start":"#00e475","composer-done":"#00e475","step-start":"#e8deff","step-done":"#e8deff","step-progress":"#e8deff",natural:"#a8a8a8",status:"#a8a8a8",error:"#ff6b6b","phase-plan":"#00e475","phase-complete":"#00e475"};function DU(e){return!e||e<1024?`${e||0} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}function FU(e){if(!e)return"";const t=new Date(e);return isNaN(t.getTime())?e:`${t.getHours().toString().padStart(2,"0")}:${t.getMinutes().toString().padStart(2,"0")}:${t.getSeconds().toString().padStart(2,"0")}.${t.getMilliseconds().toString().padStart(3,"0")}`}function zU(e){if(!e)return"";const t=new Date(e);return isNaN(t.getTime())?e:`${t.getMonth()+1}/${t.getDate()} ${t.getHours().toString().padStart(2,"0")}:${t.getMinutes().toString().padStart(2,"0")}`}function NS(e,t){if(e==="natural"&&t&&typeof t=="object"){const n=t.kind;if(n==="thinking"||n==="assistant"||n==="result"||n==="tool")return"ai";if(n==="error")return"error"}for(const[n,r]of Object.entries(qP))if(r.includes(e))return n;return"other"}function BU({event:e,defaultExpanded:t}){const[n,r]=m.useState(!!t),i=$U[e.tag]||"#a8a8a8",s=e.payload,o=s&&typeof s=="object",c=o?typeof s.text=="string"?s.text:"":String(s||""),l=o?s.meta:null,u=m.useMemo(()=>c?c.slice(0,140).replace(/\s+/g," "):o?Object.keys(s).filter(h=>h!=="text"&&h!=="meta").slice(0,3).map(h=>{const y=s[h];return y==null?`${h}:null`:typeof y=="object"?`${h}:{…}`:`${h}:${String(y).slice(0,30)}`}).join(" "):"",[s,c,o]),p=m.useCallback(f=>{f.stopPropagation();const d=o?JSON.stringify(s,null,2):String(s);try{navigator.clipboard.writeText(d)}catch{}},[s,o]);return a.jsxs("div",{style:{borderLeft:`3px solid ${i}`,background:n?"#1c1b1b":"#131313",marginBottom:4,borderRadius:4,cursor:"pointer",transition:"background 120ms"},onClick:()=>r(f=>!f),children:[a.jsxs("div",{style:{padding:"6px 10px",display:"flex",alignItems:"center",gap:10,fontSize:12},children:[a.jsx("span",{style:{color:"#9a9a9a",fontFamily:"monospace",flexShrink:0},children:FU(e.ts)}),a.jsx("span",{style:{color:i,fontWeight:600,fontFamily:"monospace",flexShrink:0,padding:"1px 6px",background:"rgba(255,255,255,0.04)",borderRadius:3},children:e.tag}),a.jsx("span",{style:{color:"#c5c2c1",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:"monospace"},children:u}),n&&a.jsx("button",{type:"button",onClick:p,style:{background:"rgba(124,77,255,0.15)",color:"#e8deff",border:"none",borderRadius:3,padding:"2px 8px",fontSize:11,cursor:"pointer"},children:"Copy"})]}),n&&a.jsxs("div",{style:{padding:"0 10px 10px 10px",borderTop:"1px solid rgba(255,255,255,0.04)"},children:[l&&Object.keys(l).length>0&&a.jsx("div",{style:{marginTop:8,padding:8,background:"#0e0e0e",borderRadius:4,fontSize:11,fontFamily:"monospace",color:"#9ecaff",whiteSpace:"pre-wrap",wordBreak:"break-all"},children:JSON.stringify(l,null,2)}),c?a.jsx("pre",{style:{marginTop:8,padding:10,background:"#0e0e0e",borderRadius:4,fontSize:12,color:"#e5e2e1",whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:600,overflowY:"auto",margin:"8px 0 0 0",fontFamily:"ui-monospace, SF Mono, Menlo, monospace"},children:c}):o?a.jsx("pre",{style:{marginTop:8,padding:10,background:"#0e0e0e",borderRadius:4,fontSize:12,color:"#e5e2e1",whiteSpace:"pre-wrap",wordBreak:"break-all",maxHeight:400,overflowY:"auto",margin:"8px 0 0 0",fontFamily:"ui-monospace, SF Mono, Menlo, monospace"},children:JSON.stringify(s,null,2)}):null]})]})}function HU({open:e,onClose:t,flowId:n}){var R;const[r,i]=m.useState([]),[s,o]=m.useState(!1),[c,l]=m.useState(null),[u,p]=m.useState(null),[f,d]=m.useState(!1),[h,y]=m.useState(!0),[b,k]=m.useState({ai:!0,flow:!0,step:!0,output:!0,error:!0}),[g,v]=m.useState(""),w=m.useRef(null),S=m.useCallback(async()=>{o(!0);try{const M=h&&n?`?flowId=${encodeURIComponent(n)}`:"",L=await(await fetch(`/api/composer-logs${M}`)).json();i(Array.isArray(L.sessions)?L.sessions:[])}catch{i([])}finally{o(!1)}},[n,h]),C=m.useCallback(async M=>{if(!M){p(null);return}d(!0);try{const L=await(await fetch(`/api/composer-logs/${encodeURIComponent(M)}`)).json();p(L)}catch{p(null)}finally{d(!1)}},[]);m.useEffect(()=>{e&&S()},[e,S]),m.useEffect(()=>{if(!(!e||!c))return C(c),w.current=setInterval(()=>C(c),2e3),()=>{w.current&&clearInterval(w.current),w.current=null}},[e,c,C]);const N=m.useMemo(()=>{const M=(u==null?void 0:u.events)||[],U=g.trim().toLowerCase();return M.filter(L=>{const A=NS(L.tag,L.payload);return!b[A]&&A!=="other"?!1:U?[L.tag,JSON.stringify(L.payload||"")].join(" ").toLowerCase().includes(U):!0})},[u,b,g]),P=m.useMemo(()=>{const M=(u==null?void 0:u.events)||[],U={};for(const L of M){const A=NS(L.tag,L.payload);U[A]=(U[A]||0)+1}return U},[u]);return e?a.jsxs("div",{style:{position:"fixed",top:0,right:0,bottom:0,width:"min(1100px, 80vw)",background:"#131313",borderLeft:"1px solid rgba(255,255,255,0.08)",display:"flex",flexDirection:"column",zIndex:9999,boxShadow:"-8px 0 32px rgba(0,0,0,0.5)",color:"#e5e2e1",fontFamily:"Inter, system-ui, sans-serif"},children:[a.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid rgba(255,255,255,0.06)",display:"flex",alignItems:"center",gap:12,flexShrink:0,background:"#1c1b1b"},children:[a.jsx("span",{style:{fontWeight:600,fontSize:14},children:"Composer Logs"}),a.jsx("span",{style:{fontSize:11,color:"#9a9a9a"},children:n?`flowId: ${n}`:"no flow selected"}),a.jsxs("label",{style:{fontSize:11,color:"#9a9a9a",display:"flex",alignItems:"center",gap:4,cursor:"pointer"},children:[a.jsx("input",{type:"checkbox",checked:h,onChange:M=>y(M.target.checked),disabled:!n}),"仅显示当前 flow"]}),a.jsx("button",{type:"button",onClick:S,style:{background:"rgba(124,77,255,0.15)",color:"#e8deff",border:"none",borderRadius:4,padding:"4px 10px",fontSize:12,cursor:"pointer"},children:"Refresh"}),a.jsx("span",{style:{flex:1}}),a.jsx("button",{type:"button",onClick:t,style:{background:"transparent",color:"#e5e2e1",border:"1px solid rgba(255,255,255,0.12)",borderRadius:4,padding:"4px 12px",fontSize:12,cursor:"pointer"},children:"Close"})]}),a.jsxs("div",{style:{flex:1,display:"flex",overflow:"hidden",minHeight:0},children:[a.jsxs("div",{style:{width:280,borderRight:"1px solid rgba(255,255,255,0.06)",overflowY:"auto",background:"#0e0e0e",flexShrink:0},children:[s&&a.jsx("div",{style:{padding:12,fontSize:12,color:"#9a9a9a"},children:"Loading…"}),!s&&r.length===0&&a.jsx("div",{style:{padding:12,fontSize:12,color:"#9a9a9a"},children:h&&n?"no sessions for this flow":"no sessions"}),r.map(M=>{const U=c===M.sessionId;return a.jsxs("div",{onClick:()=>l(M.sessionId),style:{padding:"10px 12px",borderBottom:"1px solid rgba(255,255,255,0.04)",cursor:"pointer",background:U?"rgba(124,77,255,0.18)":"transparent",borderLeft:U?"3px solid #7c4dff":"3px solid transparent"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:600,color:"#e5e2e1"},children:zU(M.mtime)}),a.jsx("div",{style:{fontSize:11,color:"#9ecaff",marginTop:2,fontFamily:"monospace"},children:M.flowId||"(no flow)"}),M.promptPreview&&a.jsx("div",{style:{fontSize:11,color:"#9a9a9a",marginTop:4,overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:M.promptPreview}),a.jsxs("div",{style:{fontSize:10,color:"#6a6a6a",marginTop:4},children:[DU(M.size)," · ",M.model||"default"]})]},M.sessionId)})]}),a.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",minHeight:0},children:[a.jsxs("div",{style:{padding:"10px 16px",borderBottom:"1px solid rgba(255,255,255,0.06)",display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",flexShrink:0,background:"#1c1b1b"},children:[Object.keys(qP).map(M=>a.jsxs("button",{type:"button",onClick:()=>k(U=>({...U,[M]:!U[M]})),style:{background:b[M]?"rgba(124,77,255,0.25)":"transparent",color:b[M]?"#e8deff":"#6a6a6a",border:`1px solid ${b[M]?"rgba(124,77,255,0.4)":"rgba(255,255,255,0.08)"}`,borderRadius:999,padding:"3px 12px",fontSize:11,cursor:"pointer",fontFamily:"monospace",textTransform:"uppercase"},children:[M," ",P[M]!=null?`(${P[M]})`:""]},M)),a.jsx("input",{type:"text",placeholder:"search…",value:g,onChange:M=>v(M.target.value),style:{marginLeft:8,flex:1,minWidth:120,background:"#0e0e0e",border:"1px solid rgba(255,255,255,0.08)",borderRadius:4,color:"#e5e2e1",padding:"4px 8px",fontSize:12}})]}),a.jsxs("div",{style:{flex:1,overflowY:"auto",padding:12,minHeight:0},children:[!c&&a.jsx("div",{style:{color:"#9a9a9a",fontSize:12,padding:20,textAlign:"center"},children:"Select a session on the left to view events"}),f&&!u&&a.jsx("div",{style:{color:"#9a9a9a",fontSize:12,padding:20},children:"Loading…"}),u&&N.length===0&&a.jsxs("div",{style:{color:"#9a9a9a",fontSize:12,padding:20},children:["No events match current filter (",((R=u.events)==null?void 0:R.length)||0," total)"]}),N.map((M,U)=>a.jsx(BU,{event:M,defaultExpanded:M.tag==="error"},`${M.ts}_${U}`))]})]})]})]}):null}const UU="0.1.31";function jS(e){const t=Math.max(0,Number(e)||0),n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4),i=Math.floor(t%6e4/1e3);return`${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}:${String(i).padStart(2,"0")}`}function eg(e,t){return t==="running"?jS(e):e==null||!Number.isFinite(e)||e<=0?"--":jS(e)}const YP=m.createContext({modelLists:{cursor:[],opencode:[]},onModelChange:()=>{}});function VU(e){const{setNodes:t}=sa(),{modelLists:n,onModelChange:r}=m.useContext(YP),i=m.useCallback(o=>{t(c=>c.filter(l=>l.id!==o))},[t]),s=m.useCallback(()=>{var u,p,f,d,h,y,b,k;const o=((u=e.data)==null?void 0:u.definitionId)||"",c=((p=e.data)==null?void 0:p.label)||e.id,l=((h=(d=(f=e.data)==null?void 0:f.outputs)==null?void 0:d[0])==null?void 0:h.value)||((k=(b=(y=e.data)==null?void 0:y.outputs)==null?void 0:b[0])==null?void 0:k.default)||"";window.__provideEditContent={instanceId:e.id,label:c,definitionId:o,content:l},window.dispatchEvent(new CustomEvent("provide-expand"))},[e.id,e.data]);return a.jsx(FP,{...e,deleteNode:i,onProvideExpand:s,modelLists:n,onModelChange:r})}const WU={[Vu]:VU},Nc=["CONTROL","TOOL","PROVIDE","AGENT"],KU=1200,CS="af-flow-node--sync-flash",ES="af-flow-edge--sync-flash";function _S(e,t){const n=String(e||"").trim();return n?n.split(/\s+/).includes(t)?n:`${n} ${t}`:t}function PS(e,t){const n=String(e||"").trim();return n?n.split(/\s+/).filter(r=>r&&r!==t).join(" "):""}function zw(e){const t=((e==null?void 0:e.id)??"").trim();return/^control/i.test(t)?"CONTROL":/^tool/i.test(t)?"TOOL":/^provide/i.test(t)?"PROVIDE":"AGENT"}function qU(e){const t=zw(e);return t==="CONTROL"?"control":t==="PROVIDE"?"provide":t==="TOOL"?"tool":"agent"}function lf(e){return(Array.isArray(e)?e:[]).map(n=>{const r=String((n==null?void 0:n.name)||(n==null?void 0:n.id)||"").trim(),i=String((n==null?void 0:n.type)||"").trim();return!r&&!i?"":i?`${r||"-"}: ${i}`:r}).filter(Boolean)}function GP(e){return String((e==null?void 0:e.label)||"").trim()||String((e==null?void 0:e.id)||"").trim()}function XP(e){return String((e==null?void 0:e.description)||(e==null?void 0:e.body)||"").replace(/\s+/g," ").trim()}function tg(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 IS(e,t,n){const r=String((t==null?void 0:t.name)||(t==null?void 0:t.id)||`#${n+1}`).trim(),i=String((t==null?void 0:t.type)||"").trim(),s=String((t==null?void 0:t.default)??(t==null?void 0:t.value)??"").trim();return[e,r,i?`type: ${i}`:"",s?`default: ${s}`:""].filter(Boolean).join(" · ")}function AS(e,t){const n=Array.isArray(e)?e:[],r=n.slice(0,4),i=Math.max(0,n.length-r.length);return{list:n,shown:r,hidden:i,kind:t}}function YU(e){return e==="CONTROL"?"account_tree":e==="TOOL"?"build":e==="PROVIDE"?"database":"smart_toy"}function GU(e,t){return t?[e==null?void 0:e.id,e==null?void 0:e.label,e==null?void 0:e.description].filter(Boolean).some(r=>String(r).toLowerCase().includes(t)):!0}function JP(e,t,n,r,i){const s=qU(e),o={id:t,type:Vu,position:n,data:{label:e.label??e.id,definitionId:e.id,schemaType:s,inputs:Array.isArray(e.inputs)?e.inputs.map(c=>({...c})):[],outputs:Array.isArray(e.outputs)?e.outputs.map(c=>({...c})):[]}};return wh(o,r,i)}function TS(e,t){const n=String((e==null?void 0:e.source)||""),r=String((e==null?void 0:e.target)||"");if(!n||!r)return!1;const i=new Map(t.map(u=>[u.id,u])),s=i.get(n),o=i.get(r),c=wl(s,e.sourceHandle||"output-0","source"),l=wl(o,e.targetHandle||"input-0","target");return!c||!l?!1:xl(c,l)}function XU(e,t){const n=String((e==null?void 0:e.nodeId)||""),r=String((e==null?void 0:e.handleId)||""),i=(e==null?void 0:e.handleType)==="target"?"target":(e==null?void 0:e.handleType)==="source"?"source":"";if(!n||!r||!i)return null;const s=t.find(c=>c.id===n),o=wl(s,r,i);return o?{nodeId:n,handleId:r,handleType:i,slot:o,slotType:DP(o)}:null}function JU(e,t,n){var o;const r=JP(e,`__candidate_${e.id}`,{x:0,y:0},{},t),i=n.handleType==="source"?"inputs":"outputs",s=Array.isArray((o=r.data)==null?void 0:o[i])?r.data[i]:[];for(let c=0;c<s.length;c+=1){const l=s[c];if(n.handleType==="source"?xl(n.slot,l):xl(l,n.slot))return{slot:l,slotIndex:c,hydrated:r}}return null}function QU(e,t){return t?e.map((n,r)=>{const i=JU(n,e,t);if(!i)return null;const s=zw(n);return{def:n,order:r,category:s,categoryRank:Nc.indexOf(s),slot:i.slot,slotIndex:i.slotIndex,displayLabel:GP(i.hydrated.data||n),description:XP(n)}}).filter(Boolean).sort((n,r)=>{var o,c;const i=(o=n.slot)!=null&&o.required?0:1,s=(c=r.slot)!=null&&c.required?0:1;return i-s||n.slotIndex-r.slotIndex||n.categoryRank-r.categoryRank||n.order-r.order}):[]}const ZU=/@([a-zA-Z_][a-zA-Z0-9_]*)/g;function eV(e){const t=new Set,n=[];let r;const i=new RegExp(ZU.source,"g");for(;(r=i.exec(e))!==null;){const s=r[1];t.has(s)||(t.add(s),n.push(s))}return n}function RS(e,t){const n=e.slice(0,t),r=n.lastIndexOf("@");if(r<0)return null;const i=n.slice(r+1);return/[\s\n]/.test(i)?null:{atIndex:r,query:i}}function ts(e){const t=String(e||"").indexOf(" - ");return t>=0?e.slice(0,t).trim():String(e||"").trim()}function cf(e,t,n,r){const i=(e||"").trim();if(!i)return"";if(i.startsWith("opencode:")||i.startsWith("claude-code:"))return i;const s=Array.isArray(t)?t:[],o=Array.isArray(n)?n:[],c=Array.isArray(r)?r:[],l=s.map(ts),u=o.map(ts);return c.map(ts).includes(i)&&!l.includes(i)&&!u.includes(i)?`claude-code:${i}`:u.includes(i)&&!l.includes(i)?`opencode:${i}`:i}function tV(e){if(e==null)return"";const t=String(e).trim();return t?t.length<=26?t:`${t.slice(0,12)}…${t.slice(-10)}`:""}function ng(e){if(!Array.isArray(e)||e.length===0)return 0;let t=0;for(const n of e){const r=/^(?:对话|Conversation|Chat)\s*(\d+)\s*$/.exec(String((n==null?void 0:n.label)??"").trim());r&&(t=Math.max(t,parseInt(r[1],10)))}return t}function nV({steps:e}){const{t}=_t();return!e||e.length===0?null:a.jsx("div",{className:"af-composer-steps-track",role:"list","aria-label":t("flow:composer.stepsAriaLabel"),children:e.map(n=>{const r=String(n.description||n.type||"").trim(),i=n.model||n.executorModel,s=[`${n.index+1}. ${r||"—"}`,n.nodeRole?t("flow:composer.stepRoleLabel",{role:n.nodeRole}):"",n.instanceId?t("flow:composer.stepInstanceLabel",{instanceId:n.instanceId}):"",i?`${t("flow:palette.model")}:${i}`:""].filter(Boolean).join(`
|
|
125
|
+
`),o=n.status||"pending";return a.jsxs("div",{className:"af-composer-step-chip"+(o==="done"?" af-composer-step-chip--done":"")+(o==="running"?" af-composer-step-chip--running":"")+(o==="error"?" af-composer-step-chip--error":"")+(o==="pending"?" af-composer-step-chip--pending":""),role:"listitem",title:s,children:[a.jsx("span",{className:"af-composer-step-chip-idx",children:n.index+1}),a.jsx("span",{className:"af-composer-step-chip-main",children:n.nodeRole||i?a.jsxs("span",{className:"af-composer-step-chip-meta",children:[n.nodeRole?a.jsx("span",{className:"af-composer-step-chip-role",children:n.nodeRole}):null,i?a.jsx("span",{className:"af-composer-step-chip-model",children:tV(i)}):null]}):null})]},n.index)})})}function rV(e,t){const n=e.trim(),r=t.trim();return r?n?!!(n===r||n.endsWith(r)||r.length>=8&&n.includes(r)):!1:!0}function iV(e){const t=[];for(const n of e){if(!n||typeof n.text!="string"||!n.text.trim())continue;const i=typeof n.kind=="string"&&n.kind?n.kind:"assistant",s=t[t.length-1];s&&s.kind===i?s.text+=i==="error"||i==="result"?`
|
|
126
|
+
${n.text}`:n.text:t.push({kind:i,text:n.text})}return t}function sV(e,t){return e==="thinking"?t("flow:composer.thinking"):e==="result"?t("flow:composer.result"):e==="assistant"?t("flow:composer.reply"):e==="error"?t("flow:composer.error"):String(e)}function oV(e){return e==="thinking"?"af-composer-ai-block af-composer-ai-block--thinking":e==="result"?"af-composer-ai-block af-composer-ai-block--result":e==="assistant"?"af-composer-ai-block af-composer-ai-block--reply":e==="error"?"af-composer-ai-block af-composer-ai-block--error":"af-composer-ai-block af-composer-ai-block--reply"}function LS({thread:e,liveSegments:t,running:n,className:r="",autoScroll:i=!0}){const{t:s}=_t(),o=m.useRef(null),c=["af-composer-ai-stack","af-composer-ai-stack--in-panel","af-composer-thread-stack",r].filter(Boolean).join(" ");return m.useEffect(()=>{if(!i||!o.current)return;const l=o.current;requestAnimationFrame(()=>{l.scrollTop=l.scrollHeight})},[e,t,i]),a.jsxs("div",{ref:o,className:c,children:[e.map((l,u)=>l.type==="user"?a.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--user-msg",children:[a.jsx("div",{className:"af-composer-ai-block-label",children:s("flow:composer.yourQuestion")}),a.jsx("div",{className:"af-composer-ai-block-body",children:l.text})]},`composer-u-${u}-${l.text.slice(0,48)}`):a.jsx("div",{className:"af-composer-thread-assistant",children:a.jsx(OS,{segments:l.segments,running:!1})},`composer-a-${u}`)),a.jsx("div",{className:"af-composer-thread-assistant",children:a.jsx(OS,{segments:t,running:n})})]})}function OS({segments:e,running:t=!1}){const{t:n}=_t(),r=e.filter(f=>f.kind==="assistant").map(f=>f.text).join(""),i=e.filter(f=>f.kind==="result").map(f=>f.text).join(""),s=rV(r,i),o=e.filter(f=>f.kind==="error").map(f=>f.text).join(`
|
|
127
|
+
`),c=e.filter(f=>f.kind!=="error"),l=s?c.filter(f=>f.kind!=="result"):c,u=iV(l),p=!!(u.length>0||o);return a.jsxs(a.Fragment,{children:[u.map((f,d)=>a.jsxs("section",{className:oV(f.kind),children:[a.jsx("div",{className:"af-composer-ai-block-label",children:sV(f.kind,n)}),a.jsx("div",{className:"af-composer-ai-block-body",children:f.text})]},`${f.kind}-${d}`)),t&&!p?a.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--reply af-composer-ai-block--pending",children:[a.jsx("div",{className:"af-composer-ai-block-label",children:n("flow:composer.reply")}),a.jsx("div",{className:"af-composer-ai-block-body",children:n("flow:composer.waiting")})]}):null,o?a.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--error",children:[a.jsx("div",{className:"af-composer-ai-block-label",children:n("flow:composer.error")}),a.jsx("div",{className:"af-composer-ai-block-body",children:o})]}):null]})}function aV({fitViewEpoch:e}){const{fitView:t}=sa(),n=m.useRef(t);return n.current=t,m.useEffect(()=>{if(e>0){const r=requestAnimationFrame(()=>n.current({padding:.2,duration:200,maxZoom:1}));return()=>cancelAnimationFrame(r)}},[e]),null}function MS(e){const t=Number.isFinite(e)?e:1;return Math.min(Math.max(t,.75),1)}const $f=1500,$S=500,lV=262144,cV=2e3;function rg(e){return typeof e!="string"?"":e.length<=cV?e:`[log line truncated, ${e.length} chars]`}const uV=$f;function dV(e){const t=e.match(/^\[([^\]]+)\]\s+\[([^\]]+)\]\s+([\s\S]*)$/);if(!t)return null;const[,n,r,i]=t;if(r==="cli")try{const s=JSON.parse(i);return s&&s.event==="node-start"?{ts:n,type:"node-start",text:`节点 ${s.instanceId||""}${s.label?` · ${s.label}`:""} 开始`}:s&&s.event==="node-done"?{ts:n,type:"node-done",text:`节点 ${s.instanceId||""} 完成${s.elapsed?` (${s.elapsed})`:""}`}:s&&s.event==="node-failed"?{ts:n,type:"node-failed",text:`节点 ${s.instanceId||""} 失败${s.error?`: ${s.error}`:""}`}:s&&s.event==="apply-start"?{ts:n,type:"info",text:`[apply-start] uuid=${s.uuid||""}`}:{ts:n,type:"info",text:rg(i)}}catch{return{ts:n,type:"info",text:rg(i)}}return{ts:n,type:"log",text:rg(`[${r}] ${i}`)}}function DS(e){if(!e)return[];const t=[],n=e.split(`
|
|
128
|
+
`);for(let r=n.length-1;r>=0&&t.length<uV;r--){const i=n[r];if(!i)continue;const s=dV(i);s&&t.push(s)}return t.reverse(),t}function fV(e,t){if(e===t)return!0;if(!e||!t)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const i of n){const s=e[i],o=t[i];if(!o)return!1;if(s!==o&&(s.status!==o.status||(s.elapsed??null)!==(o.elapsed??null)))return!1}return!0}function pV(e,t){if(e===t)return!0;if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function hV({fitViewEpoch:e,canvasTool:t,nodes:n,edges:r,onNodesChange:i,onEdgesChange:s,onConnect:o,onConnectStart:c,onConnectEnd:l,isValidConnection:u,onNodesDelete:p,onNodeClick:f,onEdgeClick:d,onFlowInit:h,onDrop:y,onDragOver:b,hideMinimapAndControls:k,bottomSlot:g}){const{t:v}=_t(),w=!i,S=w||t==="pan"?!0:[1,2],C=w?!1:t==="select",N="af-flow-canvas"+(w?" af-flow-canvas--run-mode":"")+(t==="pan"?" af-flow-canvas--tool-pan":" af-flow-canvas--tool-select"),P=m.useCallback(()=>{},[]),R=m.useMemo(()=>{const M=new Map(n.map(T=>[T.id,T])),U=new Set(n.filter(T=>T.selected).map(T=>T.id)),L=U.size>0,A=(T,$)=>{const D=/^#([0-9a-f]{6})$/i.exec(T);if(!D)return T;const K=parseInt(D[1],16);return`rgba(${K>>16&255}, ${K>>8&255}, ${K&255}, ${$})`},V="#ff5169";return r.map(T=>{var ie,de,me,Se;const $=M.get(T.source),D=M.get(T.target),K=/^output-(\d+)$/.exec(T.sourceHandle||""),_=/^input-(\d+)$/.exec(T.targetHandle||""),I=$&&K?(de=(ie=$.data)==null?void 0:ie.outputs)==null?void 0:de[parseInt(K[1],10)]:null,E=D&&_?(Se=(me=D.data)==null?void 0:me.inputs)==null?void 0:Se[parseInt(_[1],10)]:null,Y=I!=null&&I.type?hn(I.type):null,G=E!=null&&E.type?hn(E.type):null,F=Y&&G&&Y!==G,Z=L&&(U.has(T.source)||U.has(T.target)),oe=T.style||{};if(F){const Ve=T.selected?.95:Z?.85:.78,Fe=A(V,Ve);return{...T,className:((T.className||"")+" af-flow-edge--type-mismatch"+(Z?" af-flow-edge--adjacent":"")).trim(),style:{...oe,stroke:Fe,strokeWidth:Z?2.75:2.5,strokeDasharray:"6 4"},markerEnd:T.markerEnd&&typeof T.markerEnd=="object"?{...T.markerEnd,color:Fe}:{type:_r.ArrowClosed,color:Fe}}}const ue=Y||G;if(!ue)return Z?{...T,className:((T.className||"")+" af-flow-edge--adjacent").trim(),style:{...oe,strokeWidth:2.5}}:T;const ce=Z||T.selected?.7:.38,le=A(ue,ce),ve=Z?2.5:oe.strokeWidth??2;return{...T,className:((T.className||"")+(Z?" af-flow-edge--adjacent":"")).trim(),style:{...oe,stroke:le,strokeWidth:ve},markerEnd:T.markerEnd&&typeof T.markerEnd=="object"?{...T.markerEnd,color:le}:{type:_r.ArrowClosed,color:le}}})},[n,r]);return a.jsxs(r_,{className:N,nodes:n,edges:R,onNodesChange:i||P,onEdgesChange:s||P,onConnect:w?void 0:o,onConnectStart:w?void 0:c,onConnectEnd:w?void 0:l,isValidConnection:w?void 0:u,onNodesDelete:w?void 0:p,onNodeClick:f,onEdgeClick:w?void 0:d,onInit:h,onDrop:w?void 0:y,onDragOver:w?void 0:b,nodeTypes:WU,selectionOnDrag:C,panOnDrag:S,nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w,edgesFocusable:!w,panActivationKeyCode:"Space",proOptions:{hideAttribution:!0},fitView:!1,minZoom:.1,maxZoom:4,defaultEdgeOptions:{style:{stroke:"rgba(205, 189, 255, 0.45)",strokeWidth:2}},connectionLineStyle:{stroke:"rgba(205, 189, 255, 0.65)",strokeWidth:2},children:[a.jsx(a_,{gap:20,size:1,color:"rgba(28, 27, 27, 0.9)"}),a.jsx(gl,{position:"bottom-center",className:"af-flow-bottom-unified-panel"+(k?" af-flow-bottom-unified-panel--solo":""),children:a.jsxs("div",{className:"af-flow-bottom-unified-row"+(k?" af-flow-bottom-unified-row--solo":""),children:[k?null:a.jsx("div",{className:"af-flow-bottom-unified__side af-flow-bottom-unified__side--minimap",children:a.jsx(Dz,{zoomable:!0,pannable:!0,position:"bottom-left",className:"af-flow-bottom-minimap",style:{width:152,height:104},maskColor:"rgba(14, 14, 14, 0.85)",nodeColor:M=>{var L;const U=(((L=M.data)==null?void 0:L.schemaType)??"agent").toLowerCase();return U==="control"?"rgba(237, 108, 2, 0.85)":U==="provide"?"rgba(0, 228, 117, 0.35)":U==="tool"?"rgba(124, 77, 255, 0.75)":"rgba(158, 202, 255, 0.5)"}})}),a.jsx("div",{className:"af-flow-bottom-unified__center",children:g}),k?null:a.jsx("div",{className:"af-flow-bottom-unified__side af-flow-bottom-unified__side--zoom",children:a.jsx(jz,{position:"bottom-right",showInteractive:!1,className:"af-flow-bottom-controls"})})]})}),!k&&a.jsx(gl,{position:"bottom-left",className:"af-pin-legend",children:[{type:"node",color:"#ff9800"},{type:"text",color:"#2196f3"},{type:"file",color:"#4caf50"},{type:"bool",color:"#9c27b0"}].map(({type:M,color:U})=>a.jsxs("span",{className:"af-pin-legend__item",children:[a.jsx("span",{className:"af-pin-legend__dot",style:{background:U}}),a.jsx("span",{className:"af-pin-legend__label",children:M})]},M))}),a.jsx(aV,{fitViewEpoch:e}),!w&&n.length===0?a.jsxs("div",{className:"af-flow-empty-hint",children:[a.jsx("span",{className:"af-flow-empty-hint-icon material-symbols-outlined",children:"account_tree"}),a.jsx("p",{className:"af-flow-empty-hint-text",children:v("flow:emptyCanvas.composerHint")}),a.jsx("p",{className:"af-flow-empty-hint-sub",dangerouslySetInnerHTML:{__html:v("flow:emptyCanvas.composerSub")}})]}):null]})}function FS(e){if(!window.location.pathname.startsWith("/flow"))return;if(!e){window.history.replaceState({},"","/flow");return}const t=new URLSearchParams({flowId:e.id,flowSource:e.source??"user"});e.archived&&t.set("flowArchived","1"),window.history.replaceState({},"","/flow?"+t.toString())}function mV(e){return e==="builtin"?"workspace":e??"user"}function va(e,t){return t(e==="builtin"?"flow:settings.builtin":e==="workspace"?"flow:palette.workspace":"flow:palette.userDir")}const QP="af:run-console-height",Hc=230,dc={enabled:!1,cron:"",timezone:"Asia/Shanghai",preset:"",overlapPolicy:"skip",misfirePolicy:"skip",nextRunAt:null},uf={};function Df(e){if(!Number.isFinite(e))return Hc;const t=Math.max(240,Math.floor(window.innerHeight*.88));return Math.min(Math.max(Math.round(e),96),t)}function gV(){try{const e=localStorage.getItem(QP);if(e==null)return Hc;const t=parseInt(e,10);return Number.isFinite(t)?Df(t):Hc}catch{return Hc}}function yV(){var Ov,Mv;const{t:e,i18n:t}=_t(),{navigate:n,path:r}=ia(),[i,s]=m.useState([]),[o,c]=m.useState(""),[l,u]=m.useState(null),[p,f]=m.useState(0),[d,h]=m.useState(""),[y,b]=m.useState(""),[k,g]=m.useState(""),[v,w]=m.useState(""),[S,C]=m.useState(!1),[N,P]=m.useState(""),[R,M]=m.useState(!1),[U,L]=m.useState(""),[A,V]=m.useState(!1),[T,$]=m.useState(!1),[D,K]=m.useState(!1),[_,I]=m.useState(null),[E,Y]=m.useState(!1),[G,F]=m.useState(!1),Z=m.useRef(!1),[oe,ue]=m.useState([]),[ce,le]=m.useState(""),ve=m.useRef(null),[ie,de]=m.useState([]),[me,Se]=m.useState(!1),[Ve,Fe]=m.useState(""),[ze,ht]=m.useState(""),[yn,Yt]=m.useState(null),[at,Rt]=m.useState(null),[Zn,jn]=m.useState([]),[xn,Gt]=m.useState(""),[ne,fe]=m.useState(!1),[Le,Ye]=m.useState(!1),[We,Vt]=m.useState({files:[]}),[Xt,sn]=m.useState(!1),[yt,Cn]=m.useState(!0);m.useEffect(()=>{let x=!1;const j=()=>{fetch("/api/flows",{method:"HEAD"}).then(z=>{x||Cn(z.ok)}).catch(()=>{x||Cn(!1)})};j();const O=window.setInterval(j,5e3);return()=>{x=!0,window.clearInterval(O)}},[]),m.useEffect(()=>{let x=!1;return fetch("/api/dev-info").then(j=>j.json()).then(j=>{x||xs(!!(j!=null&&j.isDev))}).catch(()=>{}),()=>{x=!0}},[]),m.useEffect(()=>{l!=null&&l.id&&cC(l.id,l.source??"user","pipeline",!!l.archived)},[l==null?void 0:l.id,l==null?void 0:l.source,l==null?void 0:l.archived]);const[xe,st]=m.useState("edit"),[Lt,Ke]=m.useState([]),wn=m.useRef(0),[on,Be]=m.useState(new Set),[He,Pt]=m.useState({}),[Ce,Ot]=m.useState(null),[Yr,er]=m.useState(0),[Jt,En]=m.useState(!1),[xi,xs]=m.useState(!1),[Ki,Gr]=m.useState(!1),[Je,Lr]=m.useState(gV),Xr=m.useRef({active:!1,pointerId:-1,startY:0,startH:Hc}),[wt,Ln]=m.useState(null),[q,ye]=m.useState(null),[Ne,$e]=m.useState({}),xt=m.useRef(Ne);m.useEffect(()=>{xt.current=Ne},[Ne]);const[Wn,_n]=m.useState(!1),[tr,ws]=m.useState(!1),[qi,vs]=m.useState({}),[Qt,vo]=m.useState({}),[bs,bo]=m.useState(null),[Zt,Yi]=m.useState(dc),[ko,So]=m.useState(!1),[yr,aa]=m.useState(!1),[ks,wi]=m.useState(""),[Ss,Ns]=m.useState(""),[ft,js]=m.useState(uf),[bt,Cs]=m.useState(null),vi=m.useRef(0),xr=m.useRef(null),B=m.useRef(null),X=m.useRef(!0),Q=m.useRef(!1),[te,re]=m.useState(null),[ae,je]=m.useState(null),[Ee,Te]=m.useState(!1),[mt,wr]=m.useState(""),[fn,Mt]=m.useState(!1),la=m.useRef(null),[Kn,Gi]=m.useState(null),[vn,zt]=m.useState(!1),[vr,Xu]=m.useState(null),[Ju,ev]=m.useState(!1),[ca,Qu]=m.useState(null),Ch=m.useRef(null),[Or,Rl]=m.useState(""),[Zu,Ll]=m.useState(0),[Ol,Ml]=m.useState(0),[DI,Eh]=m.useState("pan"),[ed,$l]=m.useState(!1),[_h,tv]=m.useState(!1),Ph=m.useRef(null),Ih=m.useRef(null),Dl=m.useRef(null),[FI,zI]=m.useState(0),[rt,Ah]=m.useState(null),[BI,td]=m.useState(""),[Xe,HI]=m.useState({cursor:[],opencode:[],claudeCode:[]}),[No,nv]=m.useState(""),[Th,iee]=m.useState(""),[Xi,UI]=m.useState([]),[jo,Fl]=m.useState([]),[rv,VI]=m.useState(!1),[nd,WI]=m.useState([]),[iv,KI]=m.useState(!1),[qI,YI]=m.useState(()=>new Set),[rd,Rh]=m.useState(!1),Lh=m.useRef(null),sv=m.useRef(null),[GI,XI]=m.useState({}),id=m.useCallback(x=>{if(!x)return null;const j=x.id,O=x.source??"user",z=x.archived?"archived":"";return{sessionsKey:`af:composer-sessions:${j}:${O}${z?":"+z:""}`,activeKey:`af:composer-active-session:${j}:${O}${z?":"+z:""}`}},[]),ov=m.useCallback(x=>{if(!x)return"";const j=x.id,O=x.source??"user",z=x.archived?"archived":"";return`af:composer-skills:pipeline:${j}:${O}${z?":"+z:""}`},[]),av=m.useCallback(x=>{const j=id(x);if(!j)return{sessions:[],activeSessionId:null};try{const O=localStorage.getItem(j.sessionsKey);if(!O)return{sessions:[],activeSessionId:null};const z=JSON.parse(O);if(!Array.isArray(z))return{sessions:[],activeSessionId:null};const H=z.filter(J=>J&&typeof J.id=="string").map(J=>({...J,running:!1,statusLine:J.running?e("flow:composer.pageRefreshReset"):J.statusLine,steps:[]}));let W=null;try{W=localStorage.getItem(j.activeKey),W&&!H.some(J=>J.id===W)&&(W=null)}catch{W=null}return{sessions:H,activeSessionId:W}}catch{return{sessions:[],activeSessionId:null}}},[id]),sd=m.useCallback((x,j,O)=>{const z=id(x);if(z)try{localStorage.setItem(z.sessionsKey,JSON.stringify(j)),O?localStorage.setItem(z.activeKey,O):localStorage.removeItem(z.activeKey)}catch{}},[id]),Co=m.useRef(0),od=m.useRef({sessions:[],activeSessionId:null,flowKey:null}),[Jr,bi]=m.useState([]),[On,Es]=m.useState(null),_s=m.useMemo(()=>ov(l),[ov,l]),[lv,cv]=m.useState(""),ad=m.useMemo(()=>{if(!l)return null;const x=l.id,j=l.source??"user",O=l.archived?"archived":"";return`${x}:${j}${O?":"+O:""}`},[l]),Oh=m.useRef(!1);m.useEffect(()=>{if(!ad){bi([]),Es(null),od.current={sessions:[],activeSessionId:null,flowKey:null};return}const x=od.current;if(x.flowKey===ad)return;x.flowKey=ad,Oh.current&&x.sessions.length>0&&sd(l,x.sessions,x.activeSessionId);const{sessions:j,activeSessionId:O}=av(l);if(j.length===0){const z=`session-1-${Date.now()}`,H={id:z,label:e("flow:composer.conversationLabel",{n:1}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null};x.sessions=[H],x.activeSessionId=z,bi([H]),Es(z)}else{const z=j[j.length-1];if(z&&(!z.thread||z.thread.length===0))Co.current=ng(j),x.sessions=j,x.activeSessionId=z.id,bi(j),Es(z.id);else{const W=ng(j)+1;Co.current=W;const J=`session-${W}-${Date.now()}`,ee={id:J,label:e("flow:composer.conversationLabel",{n:W}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null},pe=[...j,ee];x.sessions=pe,x.activeSessionId=J,bi(pe),Es(J)}}Oh.current=!0},[ad,l,av,sd]);const en=m.useMemo(()=>Jr.find(x=>x.id===On)||null,[Jr,On]),Wt=(en==null?void 0:en.running)??!1,zl=(en==null?void 0:en.statusLine)??"",Bl=(en==null?void 0:en.segments)??[],Hl=(en==null?void 0:en.thread)??[],uv=(en==null?void 0:en.steps)??[];en==null||en.outputDismissed;const Qe=(en==null?void 0:en.phaseContext)??null,dv=m.useRef([]),[Mh,ld]=m.useState(!1),cd=m.useRef(null),fv=m.useRef(null);m.useEffect(()=>{const x=fv.current;x&&requestAnimationFrame(()=>{x.scrollTop=x.scrollHeight})},[Hl,Bl]);const $h=m.useRef(null),Dh=m.useRef(!1),JI=m.useRef(null),pv=m.useCallback(x=>{const j=++Co.current,O=`session-${j}-${Date.now()}`,z={id:O,label:x||e("flow:composer.conversationLabel",{n:j}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null};return bi(H=>[...H,z]),Es(O),O},[]);m.useEffect(()=>{!l||!Oh.current||(od.current.sessions=Jr,od.current.activeSessionId=On,sd(l,Jr,On))},[Jr,On,l,sd]),m.useEffect(()=>{Co.current=Math.max(Co.current,ng(Jr))},[Jr]);const hv=m.useCallback(x=>{var j;$h.current===x&&((j=cd.current)==null||j.abort()),bi(O=>{const z=O.filter(W=>W.id!==x);if(O.some((W,J)=>W.id===x&&O.findIndex(ee=>ee.id===On)===J)||On===x){const W=z;W.length>0?Es(W[W.length-1].id):setTimeout(()=>{Co.current=0;const J=++Co.current,ee=`session-${J}-${Date.now()}`,pe={id:ee,label:e("flow:composer.conversationLabel",{n:J}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null};bi(we=>[...we,pe]),Es(ee)},0)}return z})},[On]),nr=m.useCallback(x=>{bi(j=>{const O=j.findIndex(W=>W.id===On);if(O<0)return j;const z={...j[O]};x(z);const H=[...j];return H[O]=z,H})},[On]),mv=m.useCallback(x=>{nr(j=>{j.running=x})},[nr]),ki=m.useCallback(x=>{nr(j=>{j.statusLine=x})},[nr]),Si=m.useCallback(x=>{nr(j=>{typeof x=="function"?j.segments=x(j.segments):j.segments=x})},[nr]),gv=m.useCallback(x=>{nr(j=>{typeof x=="function"?j.thread=x(j.thread):j.thread=x})},[nr]),Ul=m.useCallback(x=>{nr(j=>{typeof x=="function"?j.steps=x(j.steps):j.steps=x})},[nr]),yv=m.useCallback(x=>{nr(j=>{j.outputDismissed=x})},[nr]),Vl=m.useCallback(x=>{nr(j=>{j.phaseContext=typeof x=="function"?x(j.phaseContext):x})},[nr]),xv=m.useCallback(x=>{Es(x),bi(j=>{const O=j.findIndex(H=>H.id===x);if(O<0||!j[O].outputDismissed)return j;const z=[...j];return z[O]={...j[O],outputDismissed:!1},z})},[]);m.useEffect(()=>{dv.current=Bl},[Bl]);const Ps=m.useRef({}),wv=m.useRef(!1),ua=m.useRef(null),Is=m.useRef(null),Wl=m.useRef(!1),Fh=m.useRef(0),ud=m.useRef(""),[ct,ut,QI]=i_([]),[tn,an,ZI]=s_([]),Eo=m.useRef(ct),dd=m.useRef(tn),zh=m.useRef(null),vv=m.useRef(null),[rr,As]=m.useState(null),Qr=m.useMemo(()=>ct.filter(x=>{var j;return(((j=x.data)==null?void 0:j.definitionId)||"").startsWith("provide_")}),[ct]),da=m.useMemo(()=>{var j;const x={};for(const O of ct){if(!((j=O.data)!=null&&j.inputs))continue;const z=O.data.inputs;for(let H=0;H<z.length;H++){const W=z[H];if(!(W!=null&&W.name))continue;const J=tn.find(pe=>pe.target===O.id&&pe.targetHandle===`input-${H}`);if(!(J!=null&&J.source))continue;Qr.find(pe=>pe.id===J.source)&&(x[J.source]=W.name)}}return x},[ct,tn,Qr]),Kl=m.useMemo(()=>{if(xe==="edit"||on.size===0)return null;const x=new Set(on);for(const j of tn)on.has(j.source)&&x.add(j.target),on.has(j.target)&&x.add(j.source);return x},[xe,on,tn]),eA=m.useMemo(()=>xe==="edit"?ct:ct.map(x=>{var j,O;return{...x,draggable:!1,connectable:!1,data:{...x.data,isRunMode:!0,isExecuting:on.has(x.id),nodeStatus:((j=He[x.id])==null?void 0:j.status)??null,nodeElapsed:((O=He[x.id])==null?void 0:O.elapsed)??null,isDim:Kl?!Kl.has(x.id):!1}}}),[xe,ct,on,He,Kl]),tA=m.useMemo(()=>Kl?tn.map(x=>{const j=on.has(x.source)||on.has(x.target),O=x.className?x.className.replace(/\s?af-flow-edge--(dim|focus)\b/g,""):"",z=j?"af-flow-edge--focus":"af-flow-edge--dim";return{...x,className:(O?O+" ":"")+z}}):tn,[tn,on,Kl]);m.useEffect(()=>{if(!l){vo({}),bo(null),Yi(dc),js(uf),Cs(null),wi(""),Ns("");return}const x=new URLSearchParams({flowId:l.id,flowSource:l.source||"user"});l.archived&&x.set("archived","1"),fetch(`/api/flow/run-config?${x.toString()}`).then(j=>j.json()).then(j=>{vo(j.presets||{}),bo(j.activePreset||null)}).catch(()=>{vo({}),bo(null)})},[l==null?void 0:l.id,l==null?void 0:l.source,l==null?void 0:l.archived]);const Ts=m.useCallback(x=>{vi.current+=1,Yi(x)},[]),Rs=m.useCallback(async(x,j={})=>{if(!x)return;const O=!!j.quiet,z=!!j.force,H=vi.current;O||(So(!0),wi(""),Ns(""));const W=new URLSearchParams({flowId:x.id,flowSource:x.source||"user"});x.archived&&W.set("archived","1");try{const J=await fetch(`/api/flow/schedule?${W.toString()}`),ee=await J.json().catch(()=>({}));if(!J.ok)throw new Error(ee.error||`HTTP ${J.status}`);if(!z&&vi.current!==H)return;Yi({...dc,...ee.schedule||{}}),js(ee.state&&typeof ee.state=="object"?ee.state:uf),Cs(ee.status||null)}catch(J){if(!z&&vi.current!==H)return;Yi(dc),js(uf),Cs(null),wi(String(J.message||J))}finally{So(!1)}},[]);m.useEffect(()=>{if(!l)return;let x=!1;return(async()=>{await Rs(l)})(),()=>{x=!0}},[l==null?void 0:l.id,l==null?void 0:l.source,l==null?void 0:l.archived,Rs]),m.useEffect(()=>{var O,z,H,W;if(!bs||!Qt[bs]||Qr.length===0)return;const x=Qt[bs],j={};for(const J of Qr){const ee=da[J.id];if(!ee)continue;const pe=((O=J.data)==null?void 0:O.definitionId)||"",we=x[J.id]??((W=(H=(z=J.data)==null?void 0:z.outputs)==null?void 0:H[0])==null?void 0:W.default)??"";pe.startsWith("provide_file")?j[ee]={type:"file",path:we}:j[ee]={type:"str",value:we}}Object.keys(j).length>0&&$e(j)},[bs,Qt,Qr,da]);const nA=m.useCallback(()=>{if(!ca||!Ch.current)return;const x=Ch.current.value;ut(j=>j.map(O=>{var z,H;return O.id!==ca.instanceId?O:{...O,data:{...O.data,outputs:((H=(z=O.data)==null?void 0:z.outputs)==null?void 0:H.map((W,J)=>J===0?{...W,default:x}:W))||[{type:"text",name:"value",default:x}]}}})),Qu(null)},[ca,ut]),Ge=m.useMemo(()=>{const x=ct.filter(j=>j.selected);return x.length===1?x[0]:null},[ct]),Ni=m.useMemo(()=>l?tU(ct,tn,e):[],[l,ct,tn,e]),rA=m.useMemo(()=>Ni.map(x=>x.key).join("|"),[Ni]),bv=m.useMemo(()=>Ni.some(x=>String((x==null?void 0:x.level)||"warning").toLowerCase()==="error"),[Ni]);m.useLayoutEffect(()=>{Y(Ni.length>0&&!bv)},[rA,l==null?void 0:l.id,l==null?void 0:l.source,Ni.length,bv]),Dl.current=Ge,m.useEffect(()=>{Eo.current=ct},[ct]),m.useEffect(()=>{dd.current=tn},[tn]),m.useEffect(()=>{vv.current=rr},[rr]),m.useEffect(()=>{if(!rr)return;const x=O=>{O.key==="Escape"&&As(null)},j=O=>{var z,H;(H=(z=O.target)==null?void 0:z.closest)!=null&&H.call(z,".af-connect-node-menu")||As(null)};return document.addEventListener("keydown",x),document.addEventListener("pointerdown",j),()=>{document.removeEventListener("keydown",x),document.removeEventListener("pointerdown",j)}},[rr]),m.useEffect(()=>()=>{Is.current!=null&&(clearTimeout(Is.current),Is.current=null)},[]);const Bh=m.useMemo(()=>{var j;if(!Ge)return null;const x=(j=Ge.data)==null?void 0:j.definitionId;return oe.find(O=>O.id===x)??null},[Ge,oe]),Hh=m.useMemo(()=>{const x={CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const j of oe){const O=zw(j);x[O].push(j)}for(const j of Nc)x[j].sort((O,z)=>O.id.localeCompare(z.id));return x},[oe]),fd=m.useMemo(()=>{const x=ce.trim().toLowerCase();if(!x)return Hh;const j={CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const O of Nc)j[O]=Hh[O].filter(z=>GU(z,x));return j},[Hh,ce]),iA=m.useMemo(()=>Nc.reduce((x,j)=>x+fd[j].length,0),[fd]),pd=m.useMemo(()=>oe.filter(x=>{const j=String(x.id??""),O=String(x.source??"");return j.startsWith("marketplace:")||O==="marketplace"||O==="collection"}),[oe]),kv=m.useMemo(()=>{const x=new Set;for(const j of pd){const O=String(j.id??"");if(O&&(x.add(O),O.startsWith("marketplace:"))){const z=O.slice(12),[H]=z.split("@");H&&x.add(`marketplace:${H}`)}}return x},[pd]),hd=m.useCallback(async()=>{c("");try{const x=await fetch("/api/flows");if(!x.ok)throw new Error("HTTP "+x.status);s(await x.json())}catch(x){c(String(x.message||x))}},[]);m.useEffect(()=>{hd()},[hd]),m.useEffect(()=>{if(r!=="/flow")return;const x=new URLSearchParams(window.location.search);x.get("new")==="1"&&!x.get("flowId")&&n("/projects?new=1")},[r,n]),m.useEffect(()=>{let x=!1;const j=()=>{fetch("/api/model-lists").then(z=>z.json()).then(z=>{x||HI({cursor:Array.isArray(z.cursor)?z.cursor.map(String):[],opencode:Array.isArray(z.opencode)?z.opencode.map(String):[],claudeCode:Array.isArray(z.claudeCode)?z.claudeCode.map(String):[]})}).catch(()=>{})};j();const O=setTimeout(j,4e3);return()=>{x=!0,clearTimeout(O)}},[]),m.useEffect(()=>{let x=!1;return fetch("/api/skills").then(j=>j.json()).then(j=>{if(x)return;const O=Array.isArray(j.skills)?j.skills.filter(z=>z&&typeof z.key=="string"&&z.key.trim()).map(z=>({key:String(z.key),name:String(z.name||z.id||z.key),description:z.description?String(z.description):"",sourceLabel:z.sourceLabel?String(z.sourceLabel):""})):[];UI(O),VI(!0)}).catch(()=>{}),()=>{x=!0}},[]),m.useEffect(()=>{let x=!1;return fetch("/api/skill-collections").then(j=>j.json()).then(j=>{x||(WI(io(j)),KI(!0))}).catch(()=>{}),()=>{x=!0}},[]),m.useEffect(()=>{if(cv(""),!(!rv||!iv)){if(!_s){Fl([]);return}Fl(pC(_s,"pipeline",Xi,nd)),cv(_s)}},[nd,iv,Xi,rv,_s]),m.useEffect(()=>{if(!(lv!==_s||!_s))try{localStorage.setItem(_s,JSON.stringify(jo))}catch{}},[jo,_s,lv]);const Sv=m.useCallback(async x=>{const j=x.source??"user",O=!!x.archived,z=new URLSearchParams({flowId:x.id,flowSource:j});O&&z.set("archived","1");const H=new URLSearchParams({flowId:x.id,flowSource:j});O&&H.set("archived","1"),H.set("lang",String(t.language||"zh").startsWith("zh")?"zh":"en");const[W,J]=await Promise.all([fetch("/api/flow?"+z.toString()),fetch("/api/nodes?"+H.toString())]),ee=await W.json();if(!W.ok||ee.error)throw new Error(ee.error||e("flow:nodePropsError.loadFlowFailed"));const pe=await J.json();if(!J.ok)throw new Error(e("flow:nodePropsError.loadNodesFailed"));const we=Array.isArray(pe)?pe:Array.isArray(pe==null?void 0:pe.nodes)?pe.nodes:[],_e=!Array.isArray(pe)&&(pe==null?void 0:pe.pipelineTranslations)||{},se=Z9(ee.flowYaml||"");if(se.error)throw new Error(se.error);const ke={...se.instances||{}},be=se.nodes.map(Ze=>wh(Ze,ke,we,_e,x.id)),Oe=$P(se.edges,be);return{flowSource:j,paletteList:we,instances:ke,flowDescriptionText:se.description??"",nodes:be,edges:Oe}},[t.language,e]),Mr=m.useCallback(async(x,j={})=>{const O=!!j.preserveComposer,z=O&&!!j.incrementalSync;Wl.current=!1,Fh.current+=1,u(x),b(""),O||(g(""),le(""),Rt(null),h(""),P(""),L(""),Rl(""),gv([]),Si([]),Ul([]),yv(!1),Vl(null),Eh("pan")),z||(Ps.current={},ut([]),an([])),FS(x);try{const H=await Sv(x);if(ue(H.paletteList),Ps.current=H.instances,h(H.flowDescriptionText),P(x.id||""),z){const W=Eo.current,J=dd.current;try{const ee=I8(W,J,H.nodes,H.edges),pe=new Set([...ee.changes.addedNodeIds,...ee.changes.updatedNodeIds]),we=new Set([...ee.changes.addedEdgeKeys,...ee.changes.updatedEdgeKeys]),_e=pe.size>0?ee.nodes.map(ke=>pe.has(ke.id)?{...ke,className:_S(ke.className,CS)}:ke):ee.nodes,se=we.size>0?ee.edges.map(ke=>we.has(wu(ke))?{...ke,className:_S(ke.className,ES)}:ke):ee.edges;ut(_e),an(se),Is.current!=null&&(clearTimeout(Is.current),Is.current=null),(pe.size>0||we.size>0)&&(Is.current=window.setTimeout(()=>{Is.current=null,pe.size>0&&ut(ke=>ke.map(be=>{if(!pe.has(be.id))return be;const Oe=PS(be.className,CS);return Oe===String(be.className||"")?be:{...be,className:Oe}})),we.size>0&&an(ke=>ke.map(be=>{if(!we.has(wu(be)))return be;const Oe=PS(be.className,ES);return Oe===String(be.className||"")?be:{...be,className:Oe}}))},KU))}catch{ut(H.nodes),an(H.edges)}}else ut(H.nodes),an(H.edges),f(W=>W+1);Hd(x.id,H.flowSource),zI(W=>W+1);try{ud.current=dS(H.nodes,H.edges,H.instances,{description:H.flowDescriptionText})}catch{ud.current=""}Wl.current=!0}catch(H){b(String(H.message||H))}},[Sv,ut,an]),md=m.useCallback(async()=>{if(!(l!=null&&l.id))return;const x=l.source??"user",j=new URLSearchParams({flowId:l.id,flowSource:x});l.archived&&j.set("archived","1"),j.set("lang",String(t.language||"zh").startsWith("zh")?"zh":"en");const O=await fetch("/api/nodes?"+j.toString()),z=await O.json();if(!O.ok)throw new Error((z==null?void 0:z.error)||e("flow:nodePropsError.loadNodesFailed"));const H=Array.isArray(z)?z:Array.isArray(z==null?void 0:z.nodes)?z.nodes:[];ue(H)},[l,e,t.language]),Uh=m.useCallback(async()=>{Se(!0),Fe("");try{const x=await fetch("/api/marketplace/nodes"),j=await x.json().catch(()=>({}));if(!x.ok)throw new Error((j==null?void 0:j.error)||"Failed to load marketplace nodes");de(Array.isArray(j==null?void 0:j.nodes)?j.nodes:[])}catch(x){Fe(String(x.message||x)),de([])}finally{Se(!1)}},[]);m.useEffect(()=>{l&&Uh()},[l==null?void 0:l.id,l==null?void 0:l.source,l==null?void 0:l.archived,Uh]);const sA=m.useCallback(async x=>{if(!l||!x)return;const j=x.definitionId||`marketplace:${x.id}${x.version?`@${x.version}`:""}`;if(j){ht(j),Fe("");try{const O=await fetch("/api/marketplace/install-node",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:l.id,flowSource:l.source||"user",archived:!!l.archived,nodeSpec:j})}),z=await O.json().catch(()=>({}));if(!O.ok||(z==null?void 0:z.ok)===!1)throw new Error((z==null?void 0:z.error)||"Failed to install marketplace node");await md()}catch(O){Fe(String(O.message||O))}finally{ht("")}}},[l,md]),oA=m.useCallback(async(x,j)=>{const O={packageId:(x==null?void 0:x.newId)||(x==null?void 0:x.id)||(x==null?void 0:x.label),label:(x==null?void 0:x.label)||(x==null?void 0:x.newId)||(x==null?void 0:x.id),version:"1.0.0",definitionId:j,body:(x==null?void 0:x.body)||"",script:(x==null?void 0:x.script)||"",inputs:Array.isArray(x==null?void 0:x.inputs)?x.inputs:[],outputs:Array.isArray(x==null?void 0:x.outputs)?x.outputs:[],flowId:l==null?void 0:l.id,flowSource:(l==null?void 0:l.source)||"user"},z=await fetch("/api/marketplace/publish-node-from-instance",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(O)}),H=await z.json();if(!z.ok||(H==null?void 0:H.ok)===!1)throw new Error((H==null?void 0:H.error)||"Publish failed");return await md(),H},[md,l]),Nv=m.useCallback(async()=>{var z;if(!l||Z.current)return;const x=l.id,j=l.source??"user",O=((z=Dl.current)==null?void 0:z.id)??null;Z.current=!0,F(!0);try{await Mr({id:x,source:j,archived:l.archived},{preserveComposer:!0,incrementalSync:!0}),O&&ut(H=>H.map(W=>({...W,selected:W.id===O})))}finally{Z.current=!1,F(!1)}},[l,l==null?void 0:l.archived,Mr,ut]);m.useEffect(()=>{if(wv.current||i.length===0)return;const x=new URLSearchParams(window.location.search),j=x.get("flowId");if(!j)return;const O=x.get("flowSource")??"user",z=x.get("flowArchived")==="1",H=i.find(W=>W.id===j&&(W.source??"user")===O&&!!W.archived===z);H&&(wv.current=!0,Mr(H))},[i,Mr]);const gd=m.useRef(0);m.useEffect(()=>{if(!l)return;const x=l.id,j=l.source??"user",O=!!l.archived;gd.current=0;let z=!1;const H=async()=>{var ee;if(z)return;const J=new URLSearchParams({flowId:x,flowSource:j,v:String(gd.current)});O&&J.set("archived","1");try{const pe=await fetch("/api/flow-editor-sync-poll?"+J.toString());if(!pe.ok||z)return;const we=await pe.json();if(z)return;if(we.changed){gd.current=we.version;const _e=((ee=Dl.current)==null?void 0:ee.id)??null;await Mr({id:x,source:j,archived:O},{preserveComposer:!0,incrementalSync:!0}),await Rs({id:x,source:j,archived:O},{quiet:!0,force:!0}),_e&&ut(se=>se.map(ke=>({...ke,selected:ke.id===_e})))}else gd.current=we.version}catch{}},W=window.setInterval(H,2e3);return H(),()=>{z=!0,window.clearInterval(W)}},[l==null?void 0:l.id,l==null?void 0:l.source,l==null?void 0:l.archived,Mr,Rs,ut]);const aA=m.useMemo(()=>k?k.startsWith(e("flow:status.saveFailed"))?" af-palette-tip--error":k===e("flow:status.saved")?" af-palette-tip--success":" af-palette-tip--info":"",[k]);m.useEffect(()=>{if(!k)return;k===e("flow:status.saved")||k.startsWith(e("flow:status.runInTerminal"));const x=k.startsWith(e("flow:status.runInTerminal"))?5200:2800,j=window.setTimeout(()=>g(""),x);return()=>clearTimeout(j)},[k,e]),m.useEffect(()=>{w("")},[l==null?void 0:l.id,l==null?void 0:l.source]),m.useEffect(()=>{const x=()=>{window.__provideEditContent&&(Qu(window.__provideEditContent),window.__provideEditContent=null)};return window.addEventListener("provide-expand",x),()=>window.removeEventListener("provide-expand",x)},[]),m.useEffect(()=>{var ee,pe,we,_e,se,ke;if(!Ge){Ah(null);return}const x=Ps.current[Ge.id]||{},{inputs:j,outputs:O}=MP(Ge),z=String(((ee=Ge.data)==null?void 0:ee.definitionId)??Ge.id??""),H=((pe=Ge.data)==null?void 0:pe.script)!=null?String(Ge.data.script):void 0,W=x.script!=null?String(x.script):void 0,J=z==="tool_nodejs"||H&&H.trim()!==""||W&&W.trim()!==""?String(H??W??""):"";Ah({id:Ge.id,newId:Ge.id,label:String(((we=Ge.data)==null?void 0:we.label)??Ge.id),role:((_e=Ge.data)==null?void 0:_e.role)??"普通",model:String(((se=Ge.data)==null?void 0:se.model)??x.model??""),body:String(((ke=Ge.data)==null?void 0:ke.body)??x.body??""),script:J,inputs:j,outputs:O})},[Ge==null?void 0:Ge.id,FI]),m.useEffect(()=>{l&&(Ge||(Ih.current=null,Rt(x=>x==="node"?null:x)))},[l,Ge==null?void 0:Ge.id]);const yd=m.useCallback(()=>{Ih.current=null,Rt(x=>x==="settings"||x==="history"?x:"node")},[]),lA=m.useCallback((x,j)=>{if(!(x.metaKey||x.ctrlKey||x.shiftKey)){if(xe!=="edit"){ye((j==null?void 0:j.id)??null);return}yd()}},[yd,xe]),cA=m.useCallback((x,j)=>{if(xe!=="edit")return;const O=x.metaKey||x.ctrlKey||x.shiftKey;an(z=>z.map(H=>H.id===j.id?{...H,selected:!H.selected||!O}:O?H:{...H,selected:!1})),O||ut(z=>z.map(H=>({...H,selected:!1})))},[xe,an,ut]),uA=m.useCallback(x=>TS(x,Eo.current),[]),dA=m.useCallback(x=>{if(!TS(x,Eo.current)){g("端口类型不匹配,已取消连线");return}As(null),an(j=>{const O=j.filter(z=>!(z.target===x.target&&z.targetHandle===x.targetHandle));return gu({...x,markerEnd:{type:_r.ArrowClosed}},O)})},[an]),fA=m.useCallback((x,j)=>{zh.current=XU(j,Eo.current),As(null)},[]),pA=m.useCallback((x,j)=>{var be,Oe,Ze,et;const O=zh.current;if(zh.current=null,!l||!O||j!=null&&j.toNode)return;const z=QU(oe,O);if(z.length===0){g(`没有匹配 ${O.slotType} 端口的节点`);return}const H=((Oe=(be=x==null?void 0:x.changedTouches)==null?void 0:be[0])==null?void 0:Oe.clientX)??(x==null?void 0:x.clientX),W=((et=(Ze=x==null?void 0:x.changedTouches)==null?void 0:Ze[0])==null?void 0:et.clientY)??(x==null?void 0:x.clientY);if(!Number.isFinite(H)||!Number.isFinite(W))return;const J=ua.current,ee=document.querySelector(".af-pipeline-flow .react-flow");if(!J||!ee)return;const pe=ee.getBoundingClientRect(),we=320,_e=Math.min(440,104+z.length*58),se=Math.max(12,Math.min(H-pe.left,pe.width-we-12)),ke=Math.max(12,Math.min(W-pe.top,pe.height-_e-12));As({left:se,top:ke,flowPosition:J.screenToFlowPosition({x:H,y:W}),draft:O,candidates:z,query:""})},[oe,l]),hA=m.useCallback(x=>{for(const j of x)delete Ps.current[j.id]},[]),mA=m.useCallback(x=>{ua.current=x},[]),gA=m.useCallback(x=>{ut(O=>O.map(z=>({...z,selected:z.id===x}))),an(O=>O.map(z=>({...z,selected:!1}))),yd();const j=()=>{var pe,we,_e;const O=ua.current;if(!(O!=null&&O.getNode))return;const z=O.getNode(x);if(!z)return;const H=(pe=O.getInternalNode)==null?void 0:pe.call(O,x),W=((we=H==null?void 0:H.measured)==null?void 0:we.width)??(H==null?void 0:H.width)??z.width??200,J=((_e=H==null?void 0:H.measured)==null?void 0:_e.height)??(H==null?void 0:H.height)??z.height??88,{zoom:ee}=O.getViewport();O.setCenter(z.position.x+W/2,z.position.y+J/2,{zoom:MS(ee),duration:220})};requestAnimationFrame(()=>requestAnimationFrame(j))},[ut,an,yd]),yA=m.useCallback(x=>{ut(O=>O.map(z=>({...z,selected:z.id===x}))),an(O=>O.map(z=>({...z,selected:!1})));const j=()=>{var we,_e,se;const O=ua.current;if(!(O!=null&&O.getNode))return;const z=O.getNode(x);if(!z)return;const H=(we=O.getInternalNode)==null?void 0:we.call(O,x),W=((_e=H==null?void 0:H.measured)==null?void 0:_e.width)??(H==null?void 0:H.width)??z.width??200,J=((se=H==null?void 0:H.measured)==null?void 0:se.height)??(H==null?void 0:H.height)??z.height??88,{zoom:ee}=O.getViewport(),pe=MS(ee);O.setCenter(z.position.x+W/2,z.position.y+J/2,{zoom:pe,duration:260})};requestAnimationFrame(()=>requestAnimationFrame(j))},[ut,an]),fa=m.useCallback((x,j)=>{const O=`node-${Date.now()}`;return JP(x,O,j,Ps.current,oe)},[oe]),jv=m.useCallback(x=>{if(!l||!x)return;let j={x:180,y:160};const O=ua.current,z=document.querySelector(".af-pipeline-flow .react-flow");if(O&&z){const H=z.getBoundingClientRect();j=O.screenToFlowPosition({x:H.left+H.width*.45,y:H.top+H.height*.38})}ut(H=>[...H,fa(x,j)])},[l,ut,fa]),xA=m.useCallback(x=>{const j=vv.current;if(!l||!j||!(x!=null&&x.def))return;const O=fa(x.def,j.flowPosition),z=j.draft.handleType==="source"?{source:j.draft.nodeId,sourceHandle:j.draft.handleId,target:O.id,targetHandle:`input-${x.slotIndex}`}:{source:O.id,sourceHandle:`output-${x.slotIndex}`,target:j.draft.nodeId,targetHandle:j.draft.handleId};ut(H=>[...H,O]),an(H=>{const W=H.filter(J=>!(J.target===z.target&&J.targetHandle===z.targetHandle));return gu({...z,markerEnd:{type:_r.ArrowClosed}},W)}),As(null)},[l,fa,ut,an]),wA=m.useCallback(x=>{x.preventDefault(),x.dataTransfer.dropEffect="move"},[]),vA=m.useCallback(x=>{if(x.preventDefault(),!l)return;const j=x.dataTransfer.getData("application/agentflow-node");if(!j)return;const O=oe.find(W=>W.id===j);if(!O)return;const z=ua.current;if(!z)return;const H=z.screenToFlowPosition({x:x.clientX,y:x.clientY});ut(W=>[...W,fa(O,H)])},[l,oe,ut,fa]),ji=m.useCallback(async(x,j)=>{if(!l)return;const O=dS(x,j,Ps.current,{description:d});if(O!==ud.current){g(e("flow:status.saving"));try{const z=mV(l.source),H=await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:l.id,flowSource:z,flowYaml:O,...l.archived?{flowArchived:!0}:{}})}),W=await H.json();if(!H.ok||!W.success)throw new Error(W.error||e("flow:status.saveFailed"));if(ud.current=O,g(e("flow:status.saved")),l.source==="builtin"&&z==="workspace"){const J={id:l.id,source:"workspace",path:void 0};u(J),FS(J),Hd(l.id,"workspace")}}catch(z){g(e("flow:status.saveFailed")+": "+(z.message||z))}}},[l,d]);m.useEffect(()=>{if(!l||!Wl.current||xe!=="edit"||l.archived)return;const x=Fh.current,j=setTimeout(()=>{x===Fh.current&&Wl.current&&ji(Eo.current,dd.current)},400);return()=>clearTimeout(j)},[ct,tn,d,xe,l,ji]);const xd=m.useCallback(async x=>{if(!l||l.archived)return;const j=l.source??"user";if(!(j!=="user"&&j!=="workspace")&&j!==x){C(!0),w("");try{const O=await fetch("/api/flow/move",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:l.id,fromSource:j,toSource:x})}),z=await O.json().catch(()=>({}));if(!O.ok)throw new Error(typeof z.error=="string"?z.error:e("flow:composer.requestFailed"));const H=z.flowSource==="workspace"||z.flowSource==="user"?z.flowSource:x;let W={id:l.id,source:H,archived:l.archived};try{const J=await fetch("/api/flows");if(J.ok){const ee=await J.json(),pe=Array.isArray(ee)?ee.find(we=>we.id===l.id&&(we.source??"user")===H&&!!we.archived==!!l.archived):null;pe&&(W=pe)}}catch{}await Mr(W,{preserveComposer:!0}),Hd(l.id,H)}catch(O){w(String(O.message||O))}finally{C(!1)}}},[l,Mr]),Vh=m.useCallback(async()=>{if(l){aa(!0),wi(""),Ns("");try{const x=await fetch("/api/flow/schedule",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:l.id,flowSource:l.source||"user",archived:!!l.archived,schedule:Zt})}),j=await x.json().catch(()=>({}));if(!x.ok||!j.success)throw new Error(j.error||"Failed to save schedule");Yi({...dc,...j.schedule||{}}),Ns(e("flow:schedule.saved")),await Rs(l,{quiet:!0,force:!0})}catch(x){wi(String(x.message||x))}finally{aa(!1)}}},[l,Zt,Rs,e]),bA=m.useCallback(async()=>{l&&(await ji(Eo.current,dd.current),!l.archived&&l.source!=="builtin"&&await Vh())},[l,ji,Vh]),wd=m.useCallback(async()=>{if(!l||!N.trim())return;const x=N.trim();if(x===l.id){L("");return}M(!0),L("");try{const j=await fetch("/api/flow/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:l.id,flowSource:l.source??"user",newFlowId:x})}),O=await j.json().catch(()=>({}));if(!j.ok)throw new Error(typeof O.error=="string"?O.error:e("flow:composer.requestFailed"));let z={id:O.flowId,source:O.flowSource??l.source,archived:l.archived};try{const H=await fetch("/api/flows");if(H.ok){const W=await H.json(),J=Array.isArray(W)?W.find(ee=>ee.id===O.flowId&&(ee.source??"user")===(O.flowSource??l.source)):null;J&&(z=J)}}catch{}await Mr(z,{preserveComposer:!0}),Hd(O.flowId,O.flowSource??l.source)}catch(j){L(String(j.message||j))}finally{M(!1)}},[l,N,Mr]),Cv=m.useCallback(x=>{navigator.clipboard.writeText(x).then(()=>{V(!0),setTimeout(()=>V(!1),2e3)}).catch(()=>{})},[]),Wh=m.useCallback(()=>{ji(ct,tn)},[ji,ct,tn]),kA=m.useCallback((x,j)=>{const O=j.trim()===""||j==="default"?void 0:j.trim(),z=ct.map(H=>H.id===x?{...H,data:{...H.data,model:O}}:H);ut(z),ji(z,tn)},[ct,tn,ut,ji]),vd=m.useCallback(()=>{var be;if(!rt||!l||!Ge)return!1;const x=Ge.id,j=rt.newId.trim();if(td(""),!UP.test(j))return td(e("flow:nodePropsError.invalidInstanceId")),!1;if(ct.some(Oe=>Oe.id===j&&Oe.id!==x))return td(e("flow:nodePropsError.duplicateInstanceId")),!1;const O=rt.role.trim(),z=fo.includes(O)?O:"普通",H=rt.model.trim(),W=Oe=>(Array.isArray(Oe)?Oe:[]).map(Ze=>({type:String((Ze==null?void 0:Ze.type)??"节点").trim()||"节点",name:String((Ze==null?void 0:Ze.name)??""),default:String((Ze==null?void 0:Ze.default)??""),required:!!(Ze!=null&&Ze.required),showOnNode:(Ze==null?void 0:Ze.showOnNode)!==!1})),J=W(rt.inputs),ee=W(rt.outputs),pe=String(((be=Ge.data)==null?void 0:be.definitionId)??j),we={...Ge.data,label:rt.label.trim()||j,role:z,model:H===""||H==="default"?void 0:H,body:rt.body,inputs:J,outputs:ee},_e=String(rt.script??"").trim();pe==="tool_nodejs"||_e!==""?we.script=String(rt.script??""):delete we.script;let se,ke=tn;if(j!==x){const Oe={...Ps.current},Ze={...Oe[x]||{}};delete Oe[x],Oe[j]=Ze,Ps.current=Oe,se=ct.map(et=>et.id!==x?et:{...et,id:j,selected:!0,data:we}),ke=tn.map((et,Qh)=>({...et,source:et.source===x?j:et.source,target:et.target===x?j:et.target,id:`e-${et.source===x?j:et.source}-${et.target===x?j:et.target}-${Qh}`}))}else se=ct.map(Oe=>Oe.id===x?{...Oe,data:we}:Oe);return ut(se),an(ke),ji(se,ke),!0},[rt,l,Ge,ct,tn,ut,an,ji]),Kh=m.useCallback(()=>{var Oe;if(!rt||!l||!Ge)return!1;const x=Ge.id,j=rt.role.trim(),O=fo.includes(j)?j:"普通",z=rt.model.trim(),H=Ze=>(Array.isArray(Ze)?Ze:[]).map(et=>({type:String((et==null?void 0:et.type)??"节点").trim()||"节点",name:String((et==null?void 0:et.name)??""),default:String((et==null?void 0:et.default)??""),required:!!(et!=null&&et.required),showOnNode:(et==null?void 0:et.showOnNode)!==!1})),W=H(rt.inputs),J=H(rt.outputs),ee=String(((Oe=Ge.data)==null?void 0:Oe.definitionId)??x),pe=rt.label.trim()||x,we=z===""||z==="default"?void 0:z,_e={...Ge.data,label:pe,role:O,model:we,body:rt.body,inputs:W,outputs:J},se=String(rt.script??"").trim();ee==="tool_nodejs"||se!==""?_e.script=String(rt.script??""):delete _e.script;const ke=Ge.data||{};return(ke.label!==_e.label||ke.role!==_e.role||ke.model!==_e.model||ke.body!==_e.body||(ke.script??void 0)!==(_e.script??void 0)||JSON.stringify(ke.inputs||[])!==JSON.stringify(W)||JSON.stringify(ke.outputs||[])!==JSON.stringify(J))&&ut(Ze=>Ze.map(et=>et.id===x?{...et,data:_e}:et)),!0},[rt,l,Ge,ut]),Ev=m.useRef(Kh);m.useEffect(()=>{Ev.current=Kh},[Kh]),m.useEffect(()=>{if(!rt||!l||!Wl.current||xe!=="edit")return;const x=setTimeout(()=>{Ev.current()},400);return()=>clearTimeout(x)},[rt,l,xe]);const SA=m.useCallback(()=>{if(!(!rt||!Ge)){if(rt.newId.trim()===Ge.id){td("");return}vd()}},[rt,Ge,vd]);m.useEffect(()=>{const x=j=>{var z,H,W;if(xe!=="edit")return;const O=uU(j.target);if((j.metaKey||j.ctrlKey)&&j.key.toLowerCase()==="s"){if(at==="node"&&Ge&&rt){j.preventDefault(),j.stopPropagation(),vd()||Wh();return}if(O)return;j.preventDefault(),j.stopPropagation(),Wh();return}if((j.metaKey||j.ctrlKey)&&j.key.toLowerCase()==="k"){j.preventDefault(),j.stopPropagation(),tv(J=>!J);return}if(!_h){if(ed){if(j.key==="Escape"){j.preventDefault(),$l(!1);return}if(pS(j)&&!j.metaKey&&!j.ctrlKey&&!j.altKey){j.preventDefault(),$l(!1);return}(j.key==="v"||j.key==="V"||j.key==="h"||j.key==="H")&&!j.metaKey&&!j.ctrlKey&&!j.altKey&&j.preventDefault();return}if(!O){if((j.key==="a"||j.key==="A")&&!j.metaKey&&!j.ctrlKey&&!j.altKey){j.preventDefault(),j.stopPropagation(),(z=ve.current)==null||z.focus(),(W=(H=ve.current)==null?void 0:H.select)==null||W.call(H);return}if((j.metaKey||j.ctrlKey)&&j.key.toLowerCase()==="a"){j.preventDefault(),j.stopPropagation(),ut(J=>J.map(ee=>({...ee,selected:!0}))),an(J=>J.map(ee=>({...ee,selected:!1})));return}if(pS(j)&&!j.metaKey&&!j.ctrlKey&&!j.altKey){j.preventDefault(),$l(J=>!J);return}if((j.key==="v"||j.key==="V")&&!j.metaKey&&!j.ctrlKey&&!j.altKey){j.preventDefault(),Eh("select");return}if((j.key==="h"||j.key==="H")&&!j.metaKey&&!j.ctrlKey&&!j.altKey){j.preventDefault(),Eh("pan");return}}}};return window.addEventListener("keydown",x,!0),()=>window.removeEventListener("keydown",x,!0)},[Wh,ed,_h,at,Ge,rt,vd,xe]),m.useEffect(()=>{if(xe!=="running"||Ce==null)return;let x=Math.floor((Date.now()-Ce)/1e3);const j=setInterval(()=>{const O=Date.now()-Ce,z=Math.floor(O/1e3);z!==x&&(x=z,er(O))},500);return()=>clearInterval(j)},[xe,Ce]),m.useEffect(()=>{const x=B.current;!x||!x.parentElement||X.current&&(Q.current=!0,x.scrollIntoView({behavior:"auto",block:"end"}),requestAnimationFrame(()=>{Q.current=!1}))},[Lt]),m.useEffect(()=>{const x=B.current;if(!x)return;const j=x.parentElement;if(!j)return;const O=()=>{if(Q.current)return;const z=j.scrollHeight-j.scrollTop-j.clientHeight;X.current=z<40};return j.addEventListener("scroll",O,{passive:!0}),()=>j.removeEventListener("scroll",O)},[Jt,xe]),m.useEffect(()=>{if(xe==="edit"||!Jt)return;X.current=!0;const x=B.current;x&&(Q.current=!0,x.scrollIntoView({behavior:"auto",block:"end"}),requestAnimationFrame(()=>{Q.current=!1}))},[xe,Jt]),m.useEffect(()=>{Lt.length>$f+$S&&Ke(x=>x.length>$f+$S?x.slice(-$f):x)},[Lt]);const NA=m.useCallback(x=>{if(x.button!==0)return;x.preventDefault();const j=x.currentTarget;Xr.current={active:!0,pointerId:x.pointerId,startY:x.clientY,startH:Je},j.setPointerCapture(x.pointerId)},[Je]),jA=m.useCallback(x=>{const j=Xr.current;if(!j.active||x.pointerId!==j.pointerId)return;const O=j.startY-x.clientY;Lr(Df(j.startH+O))},[]),bd=m.useCallback(()=>{Lr(x=>{const j=Df(x);try{localStorage.setItem(QP,String(j))}catch{}return j})},[]),_v=m.useCallback(x=>{const j=Xr.current;if(!(!j.active||x.pointerId!==j.pointerId)){j.active=!1;try{x.currentTarget.releasePointerCapture(x.pointerId)}catch{}bd()}},[bd]),CA=m.useCallback(()=>{const x=Xr.current;x.active&&(x.active=!1,bd())},[bd]);m.useEffect(()=>{function x(){Lr(j=>Df(j))}return window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[]);const Ci=m.useCallback(async(x={})=>{if(!l)return;const j=x.runUuid!=null&&String(x.runUuid).trim()?String(x.runUuid).trim():null,O=x.cliInputsOverride??xt.current,z=!!x.prepareOnly;if(st(z?"ready":"running"),Ke(z?[]:[{ts:new Date().toISOString(),type:"info",text:j?e("flow:run.connectingApiResume",{uuid:j}):e("flow:run.connectingApi")}]),Be(new Set),Pt({}),En(!z),Rt(null),j||Ln(null),z)return;if(!j){const W=Date.now();Ot(W),er(0)}const H=new AbortController;xr.current=H;try{const W=await fetch("/api/flow/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:l.id,flowSource:l.source||"user",...j?{uuid:j}:{},cliInputs:O}),signal:H.signal});if(!W.ok){const se=await W.json().catch(()=>({error:e("flow:composer.requestFailed")}));Ke(ke=>[...ke,{ts:new Date().toISOString(),type:"error",text:se.error||e("flow:composer.requestFailed")}]),st("error");return}if(Ke(se=>[...se,{ts:new Date().toISOString(),type:"info",text:e("flow:run.connectedReceiving")}]),!W.body){Ke(se=>[...se,{ts:new Date().toISOString(),type:"error",text:e("flow:run.noBody")}]),st("error");return}const J=W.body.getReader(),ee=new TextDecoder;let pe="";const we=se=>{const ke=se.ts||new Date().toISOString();if(se.type==="event")if(se.event==="node-start")Be(be=>new Set(be).add(se.instanceId)),Pt(be=>({...be,[se.instanceId]:{status:"running",startMs:Date.now()}})),Ke(be=>[...be,{ts:ke,type:"node-start",text:se.label?e("flow:run.nodeStartWithLabel",{instanceId:se.instanceId,label:se.label}):e("flow:run.nodeStart",{instanceId:se.instanceId})}]);else if(se.event==="node-done"){Be(Oe=>{const Ze=new Set(Oe);return Ze.delete(se.instanceId),Ze});const be=se.elapsed??null;Pt(Oe=>({...Oe,[se.instanceId]:{status:"success",elapsed:be}})),Ke(Oe=>[...Oe,{ts:ke,type:"node-done",text:be?e("flow:run.nodeDoneWithElapsed",{instanceId:se.instanceId,elapsed:be}):e("flow:run.nodeDone",{instanceId:se.instanceId})}])}else if(se.event==="node-failed")Be(be=>{const Oe=new Set(be);return Oe.delete(se.instanceId),Oe}),Pt(be=>({...be,[se.instanceId]:{status:"failed",elapsed:se.elapsed??null}})),Ke(be=>[...be,{ts:ke,type:"node-failed",text:e("flow:run.nodeFailed",{instanceId:se.instanceId})}]);else if(se.event==="apply-start"){if(se.uuid&&Ln(String(se.uuid)),typeof se.runStartTime=="number"&&se.runStartTime>0)Ot(se.runStartTime),er(Math.max(0,Date.now()-se.runStartTime));else if(typeof se.totalExecutedMs=="number"&&se.totalExecutedMs>0){const be=Date.now()-se.totalExecutedMs;Ot(be),er(se.totalExecutedMs)}Ke(be=>[...be,{ts:ke,type:"info",text:e("flow:run.pipelineStart",{uuid:se.uuid||"?"})}])}else se.event==="apply-done"?Ke(be=>[...be,{ts:ke,type:"info",text:se.totalElapsed?e("flow:run.pipelineDoneWithElapsed",{elapsed:se.totalElapsed}):e("flow:run.pipelineDone")}]):se.event==="apply-paused"?Ke(be=>[...be,{ts:ke,type:"warn",text:e("flow:run.pipelinePaused",{nodes:(se.pendingNodes||[]).join(", ")})}]):Ke(be=>[...be,{ts:ke,type:"event",text:`[${se.event}] ${JSON.stringify(se)}`}]);else se.type==="user-check-content"?(re({instanceId:se.instanceId,execId:se.execId??1,inputPath:se.inputPath,outputPath:se.outputPath,content:se.content||""}),je(se.content||""),Te(!1),wr(""),Mt(!1),Ke(be=>[...be,{ts:ke,type:"user-check",text:e("flow:run.userCheckContent",{instanceId:se.instanceId})}])):se.type==="user-ask-prompt"?(Gi({instanceId:se.instanceId,execId:se.execId??1,question:se.question||"",options:Array.isArray(se.options)?se.options:[]}),zt(!1),Ke(be=>[...be,{ts:ke,type:"user-ask",text:e("flow:run.userAskPrompt",{instanceId:se.instanceId,defaultValue:`等待用户选择 (${se.instanceId})`})}])):se.type==="tool-print-content"?(Xu({instanceId:se.instanceId,execId:se.execId??1,content:se.content||"",createdAt:Date.now()}),ev(!1)):se.type==="log"?Ke(be=>[...be,{ts:ke,type:"log",text:se.text!=null?String(se.text):""}]):se.type==="error"?Ke(be=>[...be,{ts:ke,type:"error",text:se.message||e("flow:run.unknownError")}]):se.type==="done"?Ke(be=>[...be,{ts:ke,type:"done",text:e("flow:run.executionEnd",{exitCode:se.exitCode??"?"})}]):Ke(be=>[...be,{ts:ke,type:"log",text:JSON.stringify(se)}])},_e=se=>{if(se.trim())try{we(JSON.parse(se))}catch{Ke(ke=>[...ke,{ts:new Date().toISOString(),type:"log",text:se}])}};for(;;){const{done:se,value:ke}=await J.read();pe+=ee.decode(ke??new Uint8Array,{stream:!se});const be=pe.split(`
|
|
129
|
+
`);pe=be.pop()??"";for(const Oe of be)_e(Oe);if(se)break}pe.trim()&&_e(pe),st("done")}catch(W){W.name==="AbortError"?(Ke(J=>[...J,{ts:new Date().toISOString(),type:"warn",text:e("flow:run.executionStopped")}]),st("stopped")):(Ke(J=>[...J,{ts:new Date().toISOString(),type:"error",text:W.message||e("flow:run.unknownError")}]),st("error"))}finally{xr.current=null,Be(new Set)}},[l]),[EA,qh]=m.useState(!1),_A=m.useCallback(()=>{qh(!0)},[]),PA=m.useCallback(async()=>{if(qh(!1),xr.current&&(xr.current.abort(),xr.current=null),l)try{await fetch("/api/flow/run/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:l.id,flowSource:l.source||"user"})})}catch{}st("stopped"),Be(new Set)},[l]),_o=m.useCallback(()=>{st("edit"),Be(new Set),Pt({}),ye(null),Ln(null)},[]),[IA,kd]=m.useState(!1),AA=m.useCallback(async()=>{if(kd(!1),xr.current&&(xr.current.abort(),xr.current=null),l)try{await fetch("/api/flow/run/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:l.id,flowSource:l.source||"user"})})}catch{}_o()},[l,_o]),TA=m.useCallback(()=>{kd(!1),n("/projects")},[n]),RA=m.useCallback(x=>{const j=x.runId!=null&&String(x.runId).trim()?String(x.runId).trim():null,O=x.flowId!=null&&String(x.flowId).trim()?String(x.flowId).trim():(l==null?void 0:l.id)!=null?String(l.id):null;Ln(j);const z=x.status||"unknown";let H="stopped";z==="success"?H="done":z==="failed"?H="error":z==="running"?H="running":H="stopped",st(H);const W=typeof x.at=="number"?x.at:null;if(H==="running"&&W!=null?(Ot(W),er(Math.max(0,Date.now()-W))):W!=null&&typeof x.endedAt=="number"&&x.endedAt>W?(Ot(null),er(x.endedAt-W)):(Ot(null),er(Math.max(0,x.durationMs??0))),Ke([]),Be(new Set),Pt({}),ye(null),Rt(null),En(!1),j&&O){const J=new URLSearchParams({flowId:O,runId:j});fetch(`/api/run-node-statuses?${J}`).then(ee=>ee.json()).then(ee=>{const pe=ee.statuses&&typeof ee.statuses=="object"?ee.statuses:{},we={};for(const[_e,se]of Object.entries(pe))se&&typeof se=="object"&&typeof se.status=="string"&&(we[_e]={status:se.status,...se.elapsed!=null&&String(se.elapsed).trim()!==""?{elapsed:String(se.elapsed)}:{}});Pt(we)}).catch(()=>{})}},[l==null?void 0:l.id]);m.useEffect(()=>{if(!(l!=null&&l.id)||xe!=="edit")return;let x=!1;return(async()=>{try{const j=await fetch("/api/pipeline-recent-runs"),O=await j.json();if(x||!j.ok)return;const H=(Array.isArray(O.runs)?O.runs:[]).find(ee=>ee.flowId===l.id&&ee.status==="running");if(!H||x)return;const W=H.runId||null;Ln(W),st("running"),En(!0),Ot(H.at||Date.now()),wn.current=0;const J=[{ts:new Date().toISOString(),type:"info",text:`[resume] 检测到活跃 run ${W},已恢复运行视图`}];if(W){const ee=new URLSearchParams({flowId:l.id,runId:W}),we=await(await fetch(`/api/run-node-statuses?${ee}`)).json();if(x)return;const _e=we.statuses&&typeof we.statuses=="object"?we.statuses:{},se={},ke=new Set;for(const[be,Oe]of Object.entries(_e))Oe&&typeof Oe=="object"&&typeof Oe.status=="string"&&(se[be]={status:Oe.status,...Oe.elapsed!=null&&String(Oe.elapsed).trim()!==""?{elapsed:String(Oe.elapsed)}:{}},Oe.status==="running"&&ke.add(be));Pt(se),Be(ke);try{const be=new URLSearchParams({flowId:l.id,runId:W,sinceBytes:"0",tailBytes:"262144"}),Oe=await fetch(`/api/run-log?${be}`);if(Oe.ok){const Ze=await Oe.json();if(!x){wn.current=Number(Ze.bytes||0);const et=DS(typeof Ze.text=="string"?Ze.text:"");Ke([...et,...J]);return}}}catch{}}Ke(J)}catch{}})(),()=>{x=!0}},[l==null?void 0:l.id]),m.useEffect(()=>{if(xe==="edit"||!(l!=null&&l.id)||!wt)return;let x=!1,j=null;const O=async()=>{try{const z=new URLSearchParams({flowId:l.id,runId:wt}),H=await fetch(`/api/run-node-statuses?${z}`);if(!H.ok)return;const W=await H.json();if(x)return;const J=W.statuses&&typeof W.statuses=="object"?W.statuses:{},ee={},pe=new Set;for(const[we,_e]of Object.entries(J))_e&&typeof _e=="object"&&typeof _e.status=="string"&&(ee[we]={status:_e.status,..._e.elapsed!=null&&String(_e.elapsed).trim()!==""?{elapsed:String(_e.elapsed)}:{}},_e.status==="running"&&pe.add(we));Pt(we=>fV(we,ee)?we:ee),Be(we=>pV(we,pe)?we:pe);try{const we=new URLSearchParams({flowId:l.id,runId:wt,sinceBytes:String(wn.current||0),tailBytes:String(lV)}),_e=await fetch(`/api/run-log?${we}`);if(_e.ok){const se=await _e.json();if(x)return;const ke=Number(se.bytes||0),be=typeof se.text=="string"?se.text:"";if(be){const Oe=DS(be);Oe.length>0&&Ke(Ze=>[...Ze,...Oe])}wn.current=ke}}catch{}try{const we=await fetch("/api/pipeline-recent-runs");if(!we.ok)return;const _e=await we.json();if(x)return;const ke=(Array.isArray(_e.runs)?_e.runs:[]).find(be=>be.flowId===l.id&&be.runId===wt);if(ke&&ke.status){const be=ke.status;be==="running"?st(Oe=>Oe==="running"?Oe:"running"):be==="success"?st("done"):be==="failed"?st("error"):(be==="stopped"||be==="interrupted")&&st("stopped")}}catch{}}catch{}};return O(),j=window.setInterval(O,2500),()=>{x=!0,j&&window.clearInterval(j)}},[xe,l==null?void 0:l.id,wt]),m.useEffect(()=>{if(at!=="history"||!l)return;let x=!1;return(async()=>{fe(!0),Gt("");try{const j=await fetch("/api/pipeline-recent-runs"),O=await j.json();if(!j.ok)throw new Error(O.error||"HTTP "+j.status);x||jn(Array.isArray(O.runs)?O.runs:[])}catch(j){x||(Gt(String(j.message||j)),jn([]))}finally{x||fe(!1)}})(),()=>{x=!0}},[at,l]),m.useEffect(()=>{if(!l){Vt({files:[]});return}let x=!1;return(async()=>{sn(!0);try{const j=new URLSearchParams({flowId:l.id,flowSource:l.source||"user",archived:l.archived?"1":"0"}),O=await fetch(`/api/pipeline-files?${j}`),z=await O.json();if(!O.ok)throw new Error(z.error||"HTTP "+O.status);x||Vt({files:Array.isArray(z.files)?z.files:[],path:z.path,error:z.error})}catch(j){x||Vt({files:[],error:j.message||String(j)})}finally{x||sn(!1)}})(),()=>{x=!0}},[l]);const ql=m.useMemo(()=>l?Zn.filter(x=>x&&x.flowId===l.id).sort((x,j)=>j.at-x.at):[],[Zn,l]),qn=m.useMemo(()=>{let x=0,j=0,O=0,z=0,H=0;for(const W of ql){const J=W.status||"unknown";J==="success"?x+=1:J==="failed"?j+=1:J==="running"?O+=1:J==="stopped"?z+=1:J==="interrupted"&&(H+=1)}return{success:x,failed:j,running:O,stopped:z,interrupted:H}},[ql]),Yl=m.useMemo(()=>l?RS(Or,Zu):null,[l,Or,Zu]),Zr=m.useMemo(()=>{if(!Yl||!l)return[];const x=Yl.query.toLowerCase(),j=H=>x?H.some(W=>W&&String(W).toLowerCase().includes(x)):!0,O=ct.map(H=>{var we,_e;const W=H.id,J=String(((we=H.data)==null?void 0:we.label)??W),ee=(_e=H.data)!=null&&_e.definitionId?String(H.data.definitionId):"",pe=[J!==W?J:"",ee&&ee!==W?ee:""].filter(Boolean);return{id:W,label:J,defId:ee,subs:pe}}).filter(({id:H,label:W,defId:J})=>j([H,W,J])).sort((H,W)=>H.id.localeCompare(W.id)).slice(0,18).map(({id:H,label:W,defId:J})=>{const ee=[W!==H?W:null,J||null].filter(Boolean).join(" · ")||void 0;return{kind:"instance",id:H,title:H,subtitle:ee}}),z=oe.filter(H=>H&&H.id&&j([H.id,H.label,H.description])).sort((H,W)=>H.id.localeCompare(W.id)).slice(0,22).map(H=>({kind:"definition",id:H.id,title:H.id,subtitle:H.label&&H.label!==H.id?String(H.label):String(H.type||"")}));return[...O,...z]},[Yl,ct,oe,l]),Gl=m.useMemo(()=>{const x=Zr.filter(O=>O.kind==="instance"),j=Zr.filter(O=>O.kind==="definition");return{instances:x,definitions:j}},[Zr]);m.useEffect(()=>{Ml(x=>{const j=Math.max(0,Zr.length-1);return Math.min(Math.max(0,x),j)})},[Zr]);const Pv=m.useMemo(()=>eV(Or),[Or]),Iv=m.useMemo(()=>ct.filter(x=>x.selected),[ct]),Sd=m.useMemo(()=>{const x=[],j=new Set;for(const H of Iv)j.add(H.id),x.push({node:H,kind:"canvas"});const O=new Map(ct.map(H=>[H.id,H])),z=new Map(oe.map(H=>[H.id,H]));for(const H of Pv){if(j.has(H))continue;const W=O.get(H);if(W){j.add(H),x.push({node:W,kind:"mention"});continue}const J=z.get(H);J&&(j.add(H),x.push({definition:J,kind:"definition"}))}return x},[Iv,Pv,ct,oe]),ir=m.useMemo(()=>{const x=Array.isArray(Xe==null?void 0:Xe.cursor)?Xe.cursor:[],j=Array.isArray(Xe==null?void 0:Xe.opencode)?Xe.opencode:[],O=Array.isArray(Xe==null?void 0:Xe.claudeCode)?Xe.claudeCode:[],z=j.map(we=>`opencode:${ts(we)}`),H=O.map(we=>`claude-code:${ts(we)}`),W=new Set([...x,...j,...O].map(ts).concat(z).concat(H)),J=(No||"").trim(),ee=cf(No,x,j,O),pe=ee&&!W.has(ee)&&!W.has(J)?J:"";return{cursorList:x,opencodeList:j,claudeCodeList:O,currentNotInLists:pe}},[Xe,No]),Yh=m.useMemo(()=>new Set(jo),[jo]),Gh=jo.length,Nd=m.useMemo(()=>{const x=new Map(Xi.map(W=>[W.key,W])),j=new Set,O=new Set,z=nd.map(W=>{const J=co(W,Xi).map(ee=>x.get(ee)).filter(Boolean);for(const ee of J)j.add(ee.key),O.add(String(ee.name||ee.id||ee.key||"").trim());return{...W,skills:J}}).filter(W=>W.skills.length>0),H=Xi.filter(W=>{const J=String(W.name||W.id||W.key||"").trim();return!j.has(W.key)&&!O.has(J)});return{groups:z,ungrouped:H}},[nd,Xi]),pa=m.useCallback(()=>{const x=Lh.current;if(!x)return;const j=x.getBoundingClientRect(),O=Math.min(400,Math.max(300,window.innerWidth-24)),z=Math.min(Math.max(12,j.right-O),window.innerWidth-O-12),H=Math.max(140,j.top-22),W=Math.min(360,H);XI({position:"fixed",left:`${z}px`,top:`${Math.max(12,j.top-W-10)}px`,width:`${O}px`,maxHeight:`${W}px`})},[]);m.useEffect(()=>{const x=Array.isArray(Xe==null?void 0:Xe.cursor)?Xe.cursor:[],j=Array.isArray(Xe==null?void 0:Xe.opencode)?Xe.opencode:[],O=Array.isArray(Xe==null?void 0:Xe.claudeCode)?Xe.claudeCode:[];nv(z=>{const H=cf(z,x,j,O);return H===z?z:H})},[Xe.cursor,Xe.opencode,Xe.claudeCode]),m.useEffect(()=>{if(!rd)return;pa();const x=O=>{var H,W;const z=O.target;(H=Lh.current)!=null&&H.contains(z)||(W=sv.current)!=null&&W.contains(z)||Rh(!1)},j=O=>{O.key==="Escape"&&Rh(!1)};return window.addEventListener("resize",pa),window.addEventListener("scroll",pa,!0),document.addEventListener("pointerdown",x),document.addEventListener("keydown",j),()=>{window.removeEventListener("resize",pa),window.removeEventListener("scroll",pa,!0),document.removeEventListener("pointerdown",x),document.removeEventListener("keydown",j)}},[rd,pa]);const Po=m.useCallback(async(x,j={})=>{var $v;if(!l||Dh.current)return;const O=j.phaseContextSnapshot,z=(typeof x=="string"?x:Or).trim();if(!z)return;const H=dv.current;Dh.current=!0,mv(!0),ki(e("flow:composer.connecting")),Rt(kt=>kt!=="composer"?"composer":kt);const W=[...Hl];if(H.length>0&&W.push({type:"assistant",segments:[...H]}),gv([...W,{type:"user",text:z}]),W.filter(kt=>kt.type==="user").length===0){const kt=z.replace(/\s+/g," ").slice(0,30)+(z.length>30?"…":"");bi($r=>$r.map(Mn=>Mn.id===On?{...Mn,label:kt}:Mn))}const J=W.map(kt=>kt.type==="user"?{role:"user",text:kt.text}:{role:"assistant",text:(kt.segments||[]).filter(Mn=>Mn.kind==="assistant"||Mn.kind==="result").map(Mn=>Mn.text).join(`
|
|
130
|
+
`)}).filter(kt=>kt.text),ee=O??Qe;Rl(""),Si([]),Ul([]),yv(!1);const pe=new AbortController;cd.current=pe,$h.current=On;let we=null;const _e=Array.isArray(Xe==null?void 0:Xe.cursor)?Xe.cursor:[],se=Array.isArray(Xe==null?void 0:Xe.opencode)?Xe.opencode:[],ke=Array.isArray(Xe==null?void 0:Xe.claudeCode)?Xe.claudeCode:[],be=cf(No,_e,se,ke),Oe=Sd.filter(kt=>kt.kind!=="definition"&&kt.node).map(kt=>kt.node.id),Ze=l;let et=!1,Qh=!1;try{we=setTimeout(()=>pe.abort(),12e4);const kt={prompt:z,model:be,flowId:l.id,flowSource:l.source??"user",...l.archived?{flowArchived:!0}:{},contextInstanceIds:Oe,thread:J,selectedSkills:jo};ee&&ee.nextPhase&&!ee.isLastPhase&&(kt.phaseContext={phaseIndex:ee.nextPhase.index,phases:ee.phases,userPromptOriginal:ee.userPromptOriginal||z}),Th&&(kt.phaseRole=Th);const $r=await fetch("/api/composer-agent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(kt),signal:pe.signal});if(we&&(clearTimeout(we),we=null),!$r.ok){let Jl=$r.statusText||e("flow:composer.requestFailed");try{const Ql=await $r.json();Ql&&Ql.error&&(Jl=String(Ql.error))}catch{}ki(Jl),Si([{kind:"error",text:Jl}]);return}const Mn=($v=$r.body)==null?void 0:$v.getReader();if(!Mn){ki(e("flow:composer.cannotReadStream"));return}const ha=new TextDecoder;let Io="";for(;;){const{done:Jl,value:Ql}=await Mn.read();if(Jl)break;for(Io+=ha.decode(Ql,{stream:!0});;){const Zh=Io.indexOf(`
|
|
131
|
+
`);if(Zh<0)break;const Dv=Io.slice(0,Zh).trim();if(Io=Io.slice(Zh+1),!Dv)continue;let Ae;try{Ae=JSON.parse(Dv)}catch{continue}if(Ae.type==="status"&&typeof Ae.line=="string"&&ki(Ae.line),Ae.type==="natural"&&typeof Ae.text=="string"&&Ae.text){const Nt=typeof Ae.kind=="string"&&Ae.kind?Ae.kind:"assistant";Si(St=>[...St,{kind:Nt,text:Ae.text}])}if(Ae.type==="error"&&Ae.message){Qh=!0;const Nt=Ae.code?` [${Ae.code}]`:"",St=String(Ae.message)+Nt;ki(St),Si(sr=>[...sr,{kind:"error",text:St}])}if(Ae.type==="plan"&&Array.isArray(Ae.steps)){Ul(Ae.steps.map(St=>({...St,status:"pending"})));const Nt=Ae.steps.map((St,sr)=>`${sr+1}. ${St.description||St.type}`).join(`
|
|
132
|
+
`);Si(St=>[...St,{kind:"assistant",text:e("flow:composer.taskPlan",{count:Ae.steps.length,summary:Nt})}])}if(Ae.type==="step-start"){const Nt=Ae.index??0,St=Ae.total??0,sr=Ae.tier?` [${Ae.tier}]`:"",FA=Ae.model?` (${Ae.model})`:"";ki(e("flow:composer.step",{current:Nt+1,total:St,description:(Ae.description||"")+sr+FA})),Ul(zA=>zA.map(ma=>ma.index===Nt?{...ma,status:"running",model:Ae.model,tier:Ae.tier,nodeRole:Ae.nodeRole??ma.nodeRole,instanceId:Ae.instanceId??ma.instanceId,instanceLabel:Ae.instanceLabel??ma.instanceLabel}:ma))}if(Ae.type==="step-progress"){const Nt=Ae.index??0,St=Ae.total??0;ki(e("flow:composer.step",{current:Nt+1,total:St,description:Ae.description||""}))}if(Ae.type==="step-done"){const Nt=Ae.index??0;Ul(St=>St.map(sr=>sr.index===Nt?{...sr,status:Ae.success?"done":"error"}:sr))}if(Ae.type==="phase-plan"&&Array.isArray(Ae.phases)){Vl(St=>({...St||{},phases:Ae.phases,currentPhase:Ae.currentPhase??0,phaseTotal:Ae.phaseTotal??Ae.phases.length,phaseName:Ae.phaseName||"",isLastPhase:!1,nextPhase:null,userPromptOriginal:(St==null?void 0:St.userPromptOriginal)||z}));const Nt=Ae.phases.map((St,sr)=>`${sr+1}. ${St.label}`).join(" → ");Si(St=>[...St,{kind:"assistant",text:e("flow:composer.phaseGeneration",{count:Ae.phases.length,labels:Nt,current:Ae.phaseName||""})}])}Ae.type==="phase-complete"&&(Vl(Nt=>{var sr;return{...Nt||{},phases:Ae.phases||(Nt==null?void 0:Nt.phases)||[],currentPhase:Ae.phaseIndex??0,phaseTotal:Ae.phaseTotal??((sr=Ae.phases)==null?void 0:sr.length)??0,phaseName:Ae.phaseName||"",isLastPhase:!!Ae.isLastPhase,nextPhase:Ae.nextPhase||null,userPromptOriginal:Ae.userPromptOriginal||(Nt==null?void 0:Nt.userPromptOriginal)||z}}),!Ae.isLastPhase&&Ae.nextPhase&&Si(Nt=>[...Nt,{kind:"assistant",text:e("flow:composer.phaseComplete",{phaseName:Ae.phaseName||e("flow:composer.nextPhase"),nextPhase:Ae.nextPhase.label})}])),Ae.type==="done"&&(et=!0,ki(Nt=>Nt||e("flow:composer.done")))}}}catch(kt){const $r=kt;if($r.name==="AbortError"){const Mn=e(we?"flow:composer.connectTimeout":"flow:composer.aborted");ki(Mn),Si(ha=>[...ha,{kind:"error",text:Mn}])}else{const Mn=$r.code||$r.name||"UNKNOWN",ha=`${$r.message||String(kt)} [${Mn}]`;ki(ha),Si(Io=>[...Io,{kind:"error",text:ha}])}}finally{if(Dh.current=!1,mv(!1),cd.current=null,$h.current=null,we&&clearTimeout(we),et&&Ze){const kt={id:Ze.id,source:Ze.source??"user",archived:Ze.archived};(async()=>(await Mr(kt,{preserveComposer:!0,incrementalSync:!0}),await Rs(kt,{quiet:!0,force:!0})))()}}},[l,Or,No,Xe,Sd,Mr,Rs,Hl,On,Qe,Th,jo]);JI.current=Po;const Av=m.useCallback(()=>{!Qe||Qe.isLastPhase||(Vl(null),Po(e("flow:composer.skipRemainingPhases")))},[Qe,Po]),Tv=m.useCallback(()=>{if(!Qe||Qe.isLastPhase||!Qe.nextPhase)return;const x=String(Qe.nextPhase.label||"").trim()||e("flow:composer.nextPhase");Po(e("flow:composer.continuePhase",{label:x}),{phaseContextSnapshot:Qe})},[Qe,Po]);m.useEffect(()=>{if(!Mh)return;const x=j=>{j.key==="Escape"&&ld(!1)};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[Mh]),m.useEffect(()=>{xe!=="edit"&&ld(!1)},[xe]),m.useLayoutEffect(()=>{const x=Ph.current;if(!x)return;if(!l){x.style.height="";return}x.style.height="0px";const j=getComputedStyle(x),O=parseFloat(j.lineHeight),z=(parseFloat(j.paddingTop)||0)+(parseFloat(j.paddingBottom)||0),H=Number.isFinite(O)&&O>0?O:13*1.45,W=z+H*2,J=z+H*10,ee=Math.min(Math.max(x.scrollHeight,W),J);x.style.height=`${ee}px`},[Or,l]);const Xh=m.useCallback(x=>{const j=Or,O=Zu,z=RS(j,O);if(!z)return;const H=j.slice(0,z.atIndex)+`@${x} `+j.slice(O);Rl(H);const W=z.atIndex+x.length+2;queueMicrotask(()=>{const J=Ph.current;J&&(J.focus(),J.setSelectionRange(W,W)),Ll(W)})},[Or,Zu]),Jh=m.useCallback(x=>{Rl(j=>{const O=`@${x}`,z=j.indexOf(O);return z<0?j:j.slice(0,z)+j.slice(z+O.length)})},[]),Rv=m.useCallback(x=>{x.kind==="canvas"?ut(j=>j.map(O=>O.id===x.node.id?{...O,selected:!1}:O)):x.kind==="mention"?Jh(x.node.id):Jh(x.definition.id)},[ut,Jh]),LA=m.useCallback(()=>{Rt(x=>x==="history"?null:"history")},[]),OA=m.useCallback(()=>{Rt(x=>x==="settings"?null:"settings")},[]),MA=m.useCallback(()=>{Rt(x=>x==="composer"?null:"composer")},[]),Xl=m.useCallback(()=>{Rt(x=>(x==="node"&&Dl.current&&(Ih.current=Dl.current.id),null))},[]),Lv=m.useCallback(()=>{$l(x=>!x)},[]),$A=()=>{if(!l)return null;const x=yr||l.archived||l.source==="builtin",j=bt!=null&&bt.running?e("flow:schedule.running"):Zt.enabled?e("flow:schedule.waiting"):e("flow:schedule.disabled"),O=bt!=null&&bt.running?"running":Zt.enabled?"waiting":"disabled",z=ie.slice(0,12),H=l.archived||l.source==="builtin";return a.jsxs("section",{className:"af-pipeline-settings-page","aria-label":e("flow:settings.title"),children:[a.jsxs("aside",{className:"af-pipeline-settings-nav","aria-label":e("flow:settings.sectionNav"),children:[a.jsx("div",{className:"af-pipeline-settings-nav-title",children:e("flow:settings.title")}),a.jsxs("a",{href:"#pipeline-basic",className:"af-pipeline-settings-nav-item af-pipeline-settings-nav-item--active",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"badge"}),e("flow:settings.basicInfo")]}),a.jsxs("a",{href:"#pipeline-storage",className:"af-pipeline-settings-nav-item",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"folder_open"}),e("flow:settings.storageAndPath")]}),a.jsxs("a",{href:"#pipeline-marketplace",className:"af-pipeline-settings-nav-item",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"deployed_code"}),e("flow:settings.nodeMarketplace")]}),a.jsxs("a",{href:"#pipeline-schedule",className:"af-pipeline-settings-nav-item",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"schedule"}),e("flow:schedule.title")]}),a.jsxs("a",{href:"#pipeline-metadata",className:"af-pipeline-settings-nav-item",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"dataset"}),e("flow:pipeline.metadata")]}),a.jsxs("button",{type:"button",className:"af-pipeline-settings-nav-link",onClick:()=>n("/settings"),children:[e("flow:settings.globalSettings"),a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_new"})]})]}),a.jsxs("main",{className:"af-pipeline-settings-main",children:[a.jsxs("div",{className:"af-pipeline-settings-main-head",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"af-pipeline-settings-title",children:e("flow:settings.title")}),a.jsx("p",{className:"af-pipeline-settings-subtitle",children:e("flow:settings.subtitle")})]}),a.jsxs("button",{type:"button",className:"af-btn-secondary",onClick:Xl,children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_back"}),e("flow:settings.backToCanvas")]})]}),a.jsxs("section",{id:"pipeline-basic",className:"af-pipeline-settings-section",children:[a.jsxs("div",{className:"af-pipeline-settings-section-head",children:[a.jsx("span",{className:"af-pipeline-settings-section-index",children:"1."}),a.jsx("h2",{children:e("flow:settings.basicInfo")})]}),a.jsxs("div",{className:"af-pipeline-settings-grid af-pipeline-settings-grid--two",children:[a.jsxs("div",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.pipelineId")}),(l.source==="user"||l.source==="workspace")&&!l.archived?a.jsxs("div",{className:"af-pipeline-rename-row",children:[a.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:N,onChange:W=>{P(W.target.value),L("")},onKeyDown:W=>{W.key==="Enter"&&(W.preventDefault(),wd())},onBlur:()=>{N.trim()&&N.trim()!==l.id&&wd()},placeholder:l.id,disabled:R,spellCheck:!1}),a.jsx("span",{className:"af-pipeline-drawer-badge",children:va(l.source??"user",e)})]}):a.jsxs("div",{className:"af-pipeline-drawer-readonly",children:[l.id,a.jsx("span",{className:"af-pipeline-drawer-badge",children:va(l.source??"user",e)}),l.archived?a.jsx("span",{className:"af-pipeline-drawer-badge af-pipeline-drawer-badge--muted",children:e("flow:settings.archived")}):null]}),U?a.jsx("p",{className:"af-err af-pipeline-drawer-err",children:U}):null]}),a.jsxs("div",{className:"af-pipeline-settings-kv-block",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:settings.owner")}),a.jsxs("div",{className:"af-pipeline-drawer-readonly",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"person"}),l.owner||"bigo"]})]})]}),a.jsxs("label",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.introduction")}),a.jsx("textarea",{className:"af-pipeline-drawer-textarea af-pipeline-settings-textarea",value:d,onChange:W=>h(W.target.value),placeholder:e("flow:pipeline.introductionPlaceholder"),rows:4,spellCheck:!1})]})]}),a.jsxs("section",{id:"pipeline-storage",className:"af-pipeline-settings-section",children:[a.jsxs("div",{className:"af-pipeline-settings-section-head",children:[a.jsx("span",{className:"af-pipeline-settings-section-index",children:"2."}),a.jsx("h2",{children:e("flow:settings.storageAndPath")})]}),typeof l.path=="string"&&l.path?a.jsxs("div",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.diskPath")}),a.jsxs("div",{className:"af-pipeline-drawer-readonly af-pipeline-drawer-readonly--mono af-pipeline-path-row",children:[a.jsx("span",{className:"af-pipeline-path-text",children:l.path}),a.jsx("button",{type:"button",className:"af-icon-btn af-pipeline-copy-btn",onClick:()=>Cv(l.path),title:e("flow:settings.copyPath"),children:a.jsx("span",{className:"material-symbols-outlined",children:A?"check":"content_copy"})})]})]}):null,l.source==="user"||l.source==="workspace"?l.archived?a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.archivedNote")}):a.jsxs("div",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.storageLocation")}),a.jsx("div",{className:"af-pipeline-move-actions",children:l.source==="user"?a.jsx("button",{type:"button",className:"af-btn-secondary",disabled:S,onClick:()=>xd("workspace"),children:e(S?"flow:settings.moveBusy":"flow:settings.moveToWorkspace")}):a.jsx("button",{type:"button",className:"af-btn-secondary",disabled:S,onClick:()=>xd("user"),children:e(S?"flow:settings.moveBusy":"flow:settings.moveToUserDir")})}),v?a.jsx("p",{className:"af-err af-pipeline-drawer-err",children:v}):null]}):a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.builtinNote")})]}),a.jsxs("section",{id:"pipeline-marketplace",className:"af-pipeline-settings-section",children:[a.jsxs("div",{className:"af-pipeline-settings-section-head",children:[a.jsx("span",{className:"af-pipeline-settings-section-index",children:"3."}),a.jsx("h2",{children:e("flow:settings.nodeMarketplace")})]}),a.jsxs("div",{className:"af-pipeline-market-row",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"af-pipeline-market-count",children:[ie.length," ",e("flow:settings.marketNodesUnit")]}),a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.marketplaceHint")})]}),a.jsxs("button",{type:"button",className:"af-btn-secondary",onClick:Uh,disabled:me,children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"refresh"}),e(me?"common:common.loading":"common:common.refresh")]})]}),Ve?a.jsx("p",{className:"af-err af-pipeline-drawer-err",children:Ve}):null,me?a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("common:common.loading")}):z.length>0?a.jsx("div",{className:"af-pipeline-market-list",children:z.map(W=>{const J=W.definitionId||`marketplace:${W.id}${W.version?`@${W.version}`:""}`,ee=kv.has(J)||kv.has(`marketplace:${W.id}`),pe=pd.find(ke=>String(ke.id)===J||String(ke.id)===`marketplace:${W.id}`),we=ze===J,_e=lf(W.inputs||W.input),se=lf(W.outputs||W.output);return a.jsxs("div",{className:"af-pipeline-market-item",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:ee?"check_circle":"extension"}),a.jsxs("div",{className:"af-pipeline-market-main",children:[a.jsxs("div",{className:"af-pipeline-market-title-row",children:[a.jsx("strong",{children:W.displayName||W.label||W.id}),a.jsx("span",{children:W.version?`v${W.version}`:J})]}),a.jsx("p",{className:"af-pipeline-market-purpose",children:W.description||e("flow:settings.marketplaceNoDescription")}),a.jsxs("div",{className:"af-pipeline-market-io",children:[a.jsxs("div",{children:[a.jsx("span",{className:"af-pipeline-market-io-label",children:"Inputs"}),a.jsx("div",{className:"af-pipeline-market-chips",children:_e.length>0?_e.map(ke=>a.jsx("span",{className:"af-pipeline-market-chip",children:ke},`in-${J}-${ke}`)):a.jsx("span",{className:"af-pipeline-market-chip af-pipeline-market-chip--muted",children:e("flow:settings.noInputs")})})]}),a.jsxs("div",{children:[a.jsx("span",{className:"af-pipeline-market-io-label",children:"Outputs"}),a.jsx("div",{className:"af-pipeline-market-chips",children:se.length>0?se.map(ke=>a.jsx("span",{className:"af-pipeline-market-chip",children:ke},`out-${J}-${ke}`)):a.jsx("span",{className:"af-pipeline-market-chip af-pipeline-market-chip--muted",children:e("flow:settings.noOutputs")})})]})]})]}),a.jsxs("div",{className:"af-pipeline-market-actions",children:[a.jsx("button",{type:"button",className:"af-btn-secondary af-pipeline-market-action",onClick:()=>Yt(W),children:e("flow:settings.previewNode")}),a.jsx("button",{type:"button",className:ee?"af-btn-secondary af-pipeline-market-action":"af-btn-primary af-pipeline-market-action",disabled:H||we,onClick:()=>{ee&&pe?(jv(pe),Rt(null)):sA(W)},children:e(we?"flow:settings.installingNode":ee?"flow:settings.addInstalledNode":"flow:settings.installNode")})]})]},J)})}):a.jsx("div",{className:"af-pipeline-settings-empty",children:e("flow:settings.marketplaceEmpty")})]}),a.jsxs("section",{id:"pipeline-schedule",className:"af-pipeline-settings-section",children:[a.jsxs("div",{className:"af-pipeline-settings-section-head",children:[a.jsx("span",{className:"af-pipeline-settings-section-index",children:"4."}),a.jsx("h2",{children:e("flow:schedule.title")})]}),ko?a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("common:common.loading")}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"af-pipeline-settings-schedule-grid",children:[a.jsxs("label",{className:"af-new-pipeline-radio af-pipeline-settings-checkbox",children:[a.jsx("input",{type:"checkbox",checked:!!Zt.enabled,disabled:x,onChange:W=>Ts(J=>({...J,enabled:W.target.checked}))}),a.jsx("span",{children:e("flow:schedule.enabled")})]}),a.jsxs("label",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.cron")}),a.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:Zt.cron||"",disabled:x,onChange:W=>Ts(J=>({...J,cron:W.target.value})),placeholder:"0 9 * * *",spellCheck:!1})]}),a.jsxs("label",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.timezone")}),a.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:Zt.timezone||"",disabled:x,onChange:W=>Ts(J=>({...J,timezone:W.target.value})),placeholder:"Asia/Shanghai",spellCheck:!1})]}),a.jsxs("label",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.preset")}),a.jsxs("select",{className:"af-pipeline-flow-select",value:Zt.preset||"",disabled:x,onChange:W=>Ts(J=>({...J,preset:W.target.value})),children:[a.jsx("option",{value:"",children:e("flow:schedule.defaultPreset")}),Object.keys(Qt).map(W=>a.jsx("option",{value:W,children:W},W))]})]})]}),a.jsxs("div",{className:"af-pipeline-settings-schedule-status",children:[a.jsx("span",{className:`af-pipeline-settings-status-dot af-pipeline-settings-status-dot--${O}`}),a.jsx("span",{children:Zt.nextRunAt?e("flow:schedule.nextRun",{time:new Date(Zt.nextRunAt).toLocaleString()}):e("flow:schedule.noNextRun")}),a.jsxs("span",{children:[e("flow:schedule.runtime"),":",j]})]}),a.jsxs("dl",{className:"af-pipeline-meta-dl af-pipeline-settings-dl",children:[ft.lastTriggeredAt?a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:schedule.lastTriggeredAt")}),a.jsx("dd",{children:new Date(ft.lastTriggeredAt).toLocaleString()})]}):null,ft.lastSkippedAt?a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:schedule.lastSkippedAt")}),a.jsxs("dd",{children:[new Date(ft.lastSkippedAt).toLocaleString(),ft.lastSkipReason?` · ${ft.lastSkipReason}`:""]})]}):null,ft.lastRunUuid?a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:schedule.lastRun")}),a.jsx("dd",{children:ft.lastRunUuid})]}):null,ft.lastExitCode!=null?a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:schedule.lastExit")}),a.jsx("dd",{children:String(ft.lastExitCode)})]}):null,ft.lastFinishedAt?a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:schedule.lastFinishedAt")}),a.jsx("dd",{children:new Date(ft.lastFinishedAt).toLocaleString()})]}):null]}),bt!=null&&bt.lastError||ft.lastError?a.jsx("p",{className:"af-err af-pipeline-drawer-err",children:(bt==null?void 0:bt.lastError)||ft.lastError}):null,l.archived||l.source==="builtin"?a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.readonlyNote")}):null,ks?a.jsx("p",{className:"af-err af-pipeline-drawer-err",children:ks}):null,Ss?a.jsx("p",{className:"af-pipeline-drawer-muted",children:Ss}):null]})]}),a.jsxs("section",{id:"pipeline-metadata",className:"af-pipeline-settings-section",children:[a.jsxs("div",{className:"af-pipeline-settings-section-head",children:[a.jsx("span",{className:"af-pipeline-settings-section-index",children:"5."}),a.jsx("h2",{children:e("flow:pipeline.metadata")})]}),a.jsxs("dl",{className:"af-pipeline-meta-dl af-pipeline-settings-dl",children:[a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:pipeline.nodeCount")}),a.jsxs("dd",{children:[ct.length," ",e("flow:pipeline.nodesUnit")]})]}),a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:settings.marketplaceNodes")}),a.jsx("dd",{children:pd.length})]}),a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:settings.source")}),a.jsx("dd",{children:va(l.source??"user",e)})]})]})]})]}),a.jsxs("aside",{className:"af-pipeline-settings-side","aria-label":e("flow:settings.overview"),children:[a.jsxs("section",{className:"af-pipeline-settings-side-card",children:[a.jsxs("div",{className:"af-pipeline-settings-overview-head",children:[a.jsx("span",{className:"af-pipeline-settings-overview-icon material-symbols-outlined","aria-hidden":!0,children:"account_tree"}),a.jsxs("div",{children:[a.jsx("h2",{children:l.id}),a.jsx("span",{className:`af-pipeline-settings-status af-pipeline-settings-status--${O}`,children:j})]})]}),a.jsxs("dl",{className:"af-pipeline-settings-side-dl",children:[a.jsxs("div",{children:[a.jsx("dt",{children:e("flow:pipeline.nodeCount")}),a.jsx("dd",{children:ct.length})]}),a.jsxs("div",{children:[a.jsx("dt",{children:e("flow:settings.owner")}),a.jsx("dd",{children:l.owner||"bigo"})]}),a.jsxs("div",{children:[a.jsx("dt",{children:e("flow:settings.source")}),a.jsx("dd",{children:va(l.source??"user",e)})]})]})]}),a.jsxs("section",{className:"af-pipeline-settings-side-card",children:[a.jsx("h2",{children:e("flow:settings.quickActions")}),a.jsxs("button",{type:"button",className:"af-btn-primary af-pipeline-settings-side-action",onClick:()=>void bA(),disabled:yr,children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"save"}),e(yr?"flow:settings.savingChanges":"flow:settings.saveChanges")]}),a.jsxs("button",{type:"button",className:"af-btn-secondary af-pipeline-settings-side-action",onClick:Xl,children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_back"}),e("flow:settings.backToCanvas")]})]}),a.jsxs("section",{className:"af-pipeline-settings-side-card",children:[a.jsx("h2",{children:e("flow:settings.help")}),a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.helpText")}),a.jsx("button",{type:"button",className:"af-pipeline-drawer-link",onClick:()=>n("/settings"),children:e("flow:settings.globalSettings")})]})]})]})},DA=()=>{const x=yn;if(!x)return null;const j=x.definitionId||`marketplace:${x.id}${x.version?`@${x.version}`:""}`,O=x.displayName||x.label||x.id,z=lf(x.inputs||x.input),H=lf(x.outputs||x.output);return Hr.createPortal(a.jsx("div",{className:"af-market-preview-overlay",role:"dialog","aria-modal":"true","aria-label":e("flow:settings.nodePreviewTitle"),onMouseDown:W=>{W.target===W.currentTarget&&Yt(null)},children:a.jsxs("div",{className:"af-market-preview-dialog",children:[a.jsxs("div",{className:"af-market-preview-head",children:[a.jsxs("div",{children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:settings.nodePreviewTitle")}),a.jsx("h2",{children:O})]}),a.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>Yt(null),"aria-label":e("flow:settings.closePreview"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsxs("div",{className:"af-market-preview-body",children:[a.jsx("section",{className:"af-market-preview-visual","aria-label":e("flow:settings.nodeStylePreview"),children:a.jsxs("div",{className:"af-market-preview-node",children:[a.jsx("div",{className:"af-market-preview-node-ports af-market-preview-node-ports--left",children:(z.length>0?z:[""]).slice(0,4).map((W,J)=>a.jsx("span",{title:W},`preview-in-${J}`))}),a.jsxs("div",{className:"af-market-preview-node-main",children:[a.jsx("span",{className:"af-market-preview-node-icon material-symbols-outlined","aria-hidden":!0,children:"extension"}),a.jsx("strong",{children:O}),a.jsx("span",{children:j})]}),a.jsx("div",{className:"af-market-preview-node-ports af-market-preview-node-ports--right",children:(H.length>0?H:[""]).slice(0,4).map((W,J)=>a.jsx("span",{title:W},`preview-out-${J}`))})]})}),a.jsxs("section",{className:"af-market-preview-section",children:[a.jsx("h3",{children:e("flow:settings.nodeFunction")}),a.jsx("p",{children:x.description||e("flow:settings.marketplaceNoDescription")})]}),a.jsxs("div",{className:"af-market-preview-io-grid",children:[a.jsxs("section",{className:"af-market-preview-section",children:[a.jsx("h3",{children:"Inputs"}),a.jsx("div",{className:"af-pipeline-market-chips af-market-preview-chips",children:z.length>0?z.map(W=>a.jsx("span",{className:"af-pipeline-market-chip",children:W},`preview-input-${W}`)):a.jsx("span",{className:"af-pipeline-market-chip af-pipeline-market-chip--muted",children:e("flow:settings.noInputs")})})]}),a.jsxs("section",{className:"af-market-preview-section",children:[a.jsx("h3",{children:"Outputs"}),a.jsx("div",{className:"af-pipeline-market-chips af-market-preview-chips",children:H.length>0?H.map(W=>a.jsx("span",{className:"af-pipeline-market-chip",children:W},`preview-output-${W}`)):a.jsx("span",{className:"af-pipeline-market-chip af-pipeline-market-chip--muted",children:e("flow:settings.noOutputs")})})]})]}),a.jsxs("section",{className:"af-market-preview-section",children:[a.jsx("h3",{children:e("flow:settings.nodePackageInfo")}),a.jsxs("dl",{className:"af-market-preview-dl",children:[a.jsxs("div",{children:[a.jsx("dt",{children:e("flow:settings.definitionId")}),a.jsx("dd",{children:j})]}),a.jsxs("div",{children:[a.jsx("dt",{children:e("flow:settings.version")}),a.jsx("dd",{children:x.version||"-"})]}),a.jsxs("div",{children:[a.jsx("dt",{children:e("flow:settings.packagePath")}),a.jsx("dd",{children:x.packageDir||"-"})]}),a.jsxs("div",{children:[a.jsx("dt",{children:e("flow:settings.packagedFiles")}),a.jsx("dd",{children:Array.isArray(x.packagedFiles)&&x.packagedFiles.length>0?x.packagedFiles.map(W=>W.to||W).join(", "):"-"})]})]})]})]})]})}),document.body)};return a.jsx(yw,{children:a.jsxs(YP.Provider,{value:{modelLists:Xe,onModelChange:kA},children:[a.jsxs("div",{className:"af-pipeline-page"+(xe!=="edit"?" af-pipeline-page--run-mode":""),children:[a.jsxs("header",{className:"af-pipeline-top",children:[a.jsxs("div",{className:"af-pipeline-top-left",children:[a.jsx("button",{type:"button",className:"af-icon-btn af-pipeline-back",onClick:()=>{xe==="running"?kd(!0):xe!=="edit"?_o():n("/projects")},"aria-label":e(xe!=="edit"?"flow:topbar.backToEdit":"flow:topbar.backToProjects"),title:e(xe!=="edit"?"flow:topbar.backToEdit":"flow:topbar.backToProjects"),children:a.jsx("span",{className:"material-symbols-outlined",children:"arrow_back"})}),a.jsxs("div",{className:"af-pipeline-brand",children:[a.jsx("span",{className:"af-pipeline-brand-name",children:"PIPELINE"}),a.jsxs("span",{className:"af-pipeline-brand-ver",children:["V",UU,"-STABLE"]})]}),a.jsxs("div",{className:"af-view-switch","aria-label":"视图切换",children:[a.jsx("button",{type:"button",className:"af-view-switch__active",children:"Pipeline"}),a.jsx("button",{type:"button",onClick:()=>n(Qx(l,"workspace")),children:"Workspace"})]})]}),a.jsxs("div",{className:"af-pipeline-top-right af-flow-toolbar-actions",children:[xi&&a.jsx("button",{type:"button",className:"af-icon-btn"+(Ki?" af-icon-btn--active":""),"aria-label":"Composer Logs (dev)",title:"Composer Logs (dev)",onClick:()=>Gr(x=>!x),children:a.jsx("span",{className:"material-symbols-outlined",children:"description"})}),xe==="running"&&a.jsxs("div",{className:"af-run-timer",children:[a.jsx("span",{className:"af-run-timer__dot"}),a.jsx("span",{className:"af-run-timer__label",children:"RUNTIME"}),a.jsx("span",{className:"af-run-timer__value",children:eg(Yr,"running")})]}),xe==="stopped"&&a.jsxs("div",{className:"af-run-timer af-run-timer--stopped",children:[a.jsx("span",{className:"af-run-timer__label",children:"PAUSED"}),a.jsx("span",{className:"af-run-timer__value",children:eg(Yr,"stopped")})]}),(xe==="done"||xe==="error")&&a.jsxs("div",{className:"af-run-timer"+(xe==="error"?" af-run-timer--error":" af-run-timer--done"),children:[a.jsx("span",{className:"af-run-timer__label",children:xe==="error"?"FAILED":"COMPLETED"}),a.jsx("span",{className:"af-run-timer__value",children:eg(Yr,xe)})]}),xe!=="edit"&&a.jsx("button",{type:"button",className:"af-icon-btn"+(Jt?" af-icon-btn--active":""),"aria-label":e("flow:topbar.executionLog"),title:e("flow:topbar.executionLog"),onClick:()=>En(x=>!x),children:a.jsx("span",{className:"material-symbols-outlined",children:"terminal"})}),xe==="edit"&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"af-icon-btn"+(at==="history"?" af-icon-btn--active":""),"aria-label":e("flow:topbar.history"),title:e("flow:topbar.history"),disabled:!l,onClick:LA,children:a.jsx("span",{className:"material-symbols-outlined",children:"history"})}),a.jsx("button",{type:"button",className:"af-icon-btn"+(at==="settings"?" af-icon-btn--active":""),onClick:OA,"aria-label":e("flow:topbar.pipelineSettings"),title:e("flow:topbar.pipelineSettings"),disabled:!l,children:a.jsx("span",{className:"material-symbols-outlined",children:"settings"})}),a.jsx("button",{type:"button",className:"af-composer-topbar-btn"+(at==="composer"?" af-composer-topbar-btn--active":"")+(Wt?" af-composer-topbar-btn--running":""),onClick:MA,"aria-label":"AI Composer",title:"AI Composer",disabled:!l,children:"AI"}),a.jsx("button",{type:"button",className:"af-icon-btn af-shortcuts-trigger"+(ed?" af-icon-btn--active":""),onClick:Lv,"aria-label":e("flow:topbar.shortcutsLabel"),title:e("flow:topbar.shortcutsTitle"),disabled:!l,children:a.jsx("span",{className:"af-shortcuts-trigger__mark","aria-hidden":!0,children:"?"})}),a.jsx("button",{type:"button",className:"af-icon-btn af-icon-btn--danger","aria-label":e("flow:topbar.deletePipeline"),title:e("flow:topbar.deletePipeline"),disabled:!l||l.source==="builtin"||l.source!=="user"&&l.source!=="workspace",onClick:()=>K(!0),children:a.jsx("span",{className:"material-symbols-outlined",children:"delete_forever"})}),a.jsx("button",{type:"button",className:"af-btn-pipeline-archive",disabled:!l||l.source==="builtin"||l.archived||l.source!=="user"&&l.source!=="workspace",onClick:()=>$(!0),children:"Archive"})]}),xe==="running"?a.jsxs("button",{type:"button",className:"af-btn-run-stop",onClick:_A,title:e("flow:run.pauseRun"),children:[a.jsx("span",{className:"material-symbols-outlined",children:"pause"}),"Pause"]}):xe==="ready"?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!l,onClick:()=>void Ci(),title:e("flow:topbar.startRun"),children:e("flow:topbar.startRun")}),a.jsxs("button",{type:"button",className:"af-btn-pipeline-save",onClick:_o,children:[a.jsx("span",{className:"material-symbols-outlined",children:"edit"}),"Edit"]})]}):xe==="stopped"?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!l,onClick:()=>void Ci({runUuid:wt}),title:wt?e("flow:topbar.resumeTitle",{uuid:wt}):e("flow:topbar.resumeTitleNoUuid"),children:"Resume"}),a.jsxs("button",{type:"button",className:"af-btn-pipeline-save",onClick:_o,children:[a.jsx("span",{className:"material-symbols-outlined",children:"edit"}),"Edit"]})]}):xe==="done"||xe==="error"?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!l,onClick:()=>void Ci(),title:e("flow:topbar.rerunTitle"),children:"Run"}),a.jsxs("button",{type:"button",className:"af-btn-pipeline-save",onClick:_o,children:[a.jsx("span",{className:"material-symbols-outlined",children:"edit"}),"Edit"]})]}):a.jsxs("div",{className:"af-run-btn-group",children:[a.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg af-run-btn-main",disabled:!l,onClick:()=>void Ci(),children:"Run"}),a.jsx("button",{type:"button",className:"af-run-btn-dropdown",disabled:!l,onClick:()=>_n(x=>!x),"aria-label":e("flow:topbar.runOptions"),"aria-expanded":Wn,children:a.jsx("span",{className:"material-symbols-outlined",children:"arrow_drop_down"})}),Wn&&l&&a.jsxs("div",{className:"af-run-dropdown-menu",children:[a.jsxs("button",{type:"button",className:"af-run-dropdown-item",onClick:()=>{var j,O,z,H,W;_n(!1);const x={};for(const J of Qr){const ee=da[J.id];ee&&(x[ee]=((j=Ne[ee])==null?void 0:j.value)??((O=Ne[ee])==null?void 0:O.path)??((W=(H=(z=J.data)==null?void 0:z.outputs)==null?void 0:H[0])==null?void 0:W.default)??"")}vs(x),ws(!0)},children:[a.jsx("span",{className:"material-symbols-outlined",children:"edit_note"}),e("flow:topbar.runWithParams")]}),a.jsxs("button",{type:"button",className:"af-run-dropdown-item",onClick:()=>{_n(!1),Ci({prepareOnly:!0})},children:[a.jsx("span",{className:"material-symbols-outlined",children:"tune"}),e("flow:topbar.editRun")]}),a.jsx("div",{className:"af-run-dropdown-divider"}),a.jsxs("div",{className:"af-run-dropdown-section",children:[a.jsx("span",{className:"af-run-dropdown-section-label",children:e("flow:topbar.runWithPreset")}),a.jsxs("button",{type:"button",className:"af-run-dropdown-item",onClick:()=>{_n(!1),Ci()},children:[a.jsx("span",{className:"material-symbols-outlined",children:"play_arrow"}),e("flow:runPreset.default")]}),Object.keys(Qt).map(x=>a.jsxs("button",{type:"button",className:"af-run-dropdown-item",onClick:()=>{var z;_n(!1);const j=Qt[x]||{},O={};for(const H of Qr){const W=da[H.id];if(!W)continue;const J=((z=H.data)==null?void 0:z.definitionId)||"",ee=j[H.id]??"";J.startsWith("provide_file")?O[W]={type:"file",path:ee}:O[W]={type:"str",value:ee}}Ci({cliInputsOverride:O})},children:[a.jsx("span",{className:"material-symbols-outlined",children:"bookmark"}),x]},x))]})]})]})]})]}),a.jsxs("div",{className:"af-pipeline-body"+(xe!=="edit"?" af-pipeline-body--run-mode":""),children:[xe==="edit"&&at!=="settings"?a.jsxs("aside",{className:"af-node-palette af-flow-left-panel",id:"af-node-palette","aria-label":e("flow:palette2.nodePalette"),children:[a.jsxs("div",{className:`af-palette-workspace${Le?" af-palette-workspace--expanded":""}`,children:[a.jsxs("button",{type:"button",className:"af-palette-workspace-head",onClick:()=>Ye(x=>!x),"aria-expanded":Le,children:[a.jsx("span",{className:"af-palette-workspace-icon material-symbols-outlined","aria-hidden":!0,children:"folder_open"}),a.jsx("span",{className:"af-palette-workspace-label",children:e("flow:palette.workspace")}),a.jsx("span",{className:"af-palette-workspace-chevron material-symbols-outlined","aria-hidden":!0,children:Le?"expand_less":"expand_more"})]}),a.jsx("div",{className:"af-palette-workspace-path",title:l&&(l.path||We.path)||"",children:l?l.id:e("flow:palette2.noPipelineSelected")}),Le&&a.jsx("div",{className:"af-palette-workspace-tree",children:Xt?a.jsx("div",{className:"af-palette-workspace-loading",children:e("flow:palette.loading")}):We.error?a.jsx("div",{className:"af-palette-workspace-empty",children:We.error}):l?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"af-palette-workspace-group",children:[a.jsxs("div",{className:"af-palette-workspace-group-head",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"folder"}),a.jsx("span",{children:l.id}),a.jsxs("span",{className:"af-palette-workspace-count",children:["(",We.files.length,")"]})]}),We.files.length>0?a.jsx("ul",{className:"af-palette-workspace-list",children:We.files.filter(x=>x.type==="file").map(x=>a.jsxs("li",{className:"af-palette-workspace-item af-palette-workspace-item--clickable",title:x.path,onClick:()=>I({filePath:x.path,fileName:x.name}),children:[a.jsx("span",{className:"material-symbols-outlined af-palette-workspace-item-icon","aria-hidden":!0,children:x.icon}),a.jsx("span",{className:"af-palette-workspace-item-label",children:x.name}),x.size!=null&&a.jsx("span",{className:"af-palette-workspace-item-size",children:x.size<1024?`${x.size}B`:x.size<1024*1024?`${(x.size/1024).toFixed(1)}KB`:`${(x.size/1024/1024).toFixed(1)}MB`})]},x.path))}):We.files.filter(x=>x.type==="directory").length===0?a.jsx("div",{className:"af-palette-workspace-empty",children:"暂无文件"}):null]}),We.files.filter(x=>{var j;return x.type==="directory"&&((j=x.children)==null?void 0:j.length)>0}).map(x=>a.jsxs("div",{className:"af-palette-workspace-group af-palette-workspace-group--sub",children:[a.jsxs("div",{className:"af-palette-workspace-group-head",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:x.icon}),a.jsxs("span",{children:[x.name,"/"]}),a.jsxs("span",{className:"af-palette-workspace-count",children:["(",x.children.length,")"]})]}),a.jsx("ul",{className:"af-palette-workspace-list",children:x.children.map(j=>a.jsxs("li",{className:`af-palette-workspace-item${j.type==="file"?" af-palette-workspace-item--clickable":""}`,title:j.path,onClick:j.type==="file"?()=>I({filePath:j.path,fileName:j.name}):void 0,children:[a.jsx("span",{className:"material-symbols-outlined af-palette-workspace-item-icon","aria-hidden":!0,children:j.icon}),a.jsx("span",{className:"af-palette-workspace-item-label",children:j.name}),j.type==="file"&&j.size!=null&&a.jsx("span",{className:"af-palette-workspace-item-size",children:j.size<1024?`${j.size}B`:j.size<1024*1024?`${(j.size/1024).toFixed(1)}KB`:`${(j.size/1024/1024).toFixed(1)}MB`})]},j.path))})]},x.path))]}):a.jsx("div",{className:"af-palette-workspace-empty",children:e("flow:palette2.noPipelineSelected")})})]}),a.jsxs("div",{className:"af-node-palette-head",children:[a.jsxs("h2",{className:"af-node-palette-title",children:[a.jsx("span",{children:"Node 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:e("flow:palette.searchNodes")}),a.jsx("span",{className:"af-palette-search-icon material-symbols-outlined","aria-hidden":!0,children:"search"}),a.jsx("input",{ref:ve,type:"search",className:"af-palette-search-input",value:ce,onChange:x=>le(x.target.value),placeholder:e("flow:palette.searchNodes")+"…","aria-label":e("flow:palette.searchNodes")})]})]}),o?a.jsx("p",{className:"af-err af-palette-list-err",children:o}):null,a.jsxs("div",{className:"af-node-palette-scroll",children:[Nc.filter(x=>fd[x].length>0).map(x=>a.jsxs("section",{className:`af-palette-section af-flow-palette-section--${x}`,children:[a.jsx("h3",{className:"af-palette-cat",children:x}),a.jsx("div",{className:"af-palette-cards",children:fd[x].map(j=>{const O=AS(j.inputs,"input"),z=AS(j.outputs,"output"),W=j.id==="control_load_skills"?"从当前 Skills collection 或上游上下文自动注入 Skills,通常无需手填参数。":XP(j),J=GP(j);return a.jsxs("button",{type:"button",className:"af-palette-card",onClick:()=>jv(j),draggable:!!l,onDragStart:ee=>{ee.dataTransfer.setData("application/agentflow-node",j.id),ee.dataTransfer.effectAllowed="move"},disabled:!l,title:W||j.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:YU(x)})}),a.jsxs("span",{className:"af-palette-card-main",children:[a.jsx("span",{className:"af-palette-card-label",children:J}),J!==j.id?a.jsx("span",{className:"af-palette-card-id",children:j.id}):null]})]}),W?a.jsx("span",{className:"af-palette-card-desc",children:W}):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:[O.list.length," IN"]}),a.jsxs("span",{className:"af-palette-card-port-list",children:[O.shown.map((ee,pe)=>a.jsxs("span",{className:"af-palette-card-port",title:IS("input",ee,pe),children:[a.jsx("span",{className:"af-palette-card-port-dot",style:{background:hn(ee==null?void 0:ee.type)}}),a.jsx("span",{className:"af-palette-card-port-name",children:tg(ee,pe)})]},`in-${pe}`)),O.hidden>0?a.jsxs("span",{className:"af-palette-card-port-more",children:["+",O.hidden]}):null]})]}),a.jsxs("span",{className:"af-palette-card-port-side af-palette-card-port-side--out",children:[a.jsxs("span",{className:"af-palette-card-port-count",children:[z.list.length," OUT"]}),a.jsxs("span",{className:"af-palette-card-port-list",children:[z.shown.map((ee,pe)=>a.jsxs("span",{className:"af-palette-card-port",title:IS("output",ee,pe),children:[a.jsx("span",{className:"af-palette-card-port-name",children:tg(ee,pe)}),a.jsx("span",{className:"af-palette-card-port-dot",style:{background:hn(ee==null?void 0:ee.type)}})]},`out-${pe}`)),z.hidden>0?a.jsxs("span",{className:"af-palette-card-port-more",children:["+",z.hidden]}):null]})]})]})]},j.id)})})]},x)),l&&oe.length===0?a.jsx("p",{className:"af-palette-empty",children:e("flow:palette.noComponents")}):null,l&&oe.length>0&&ce.trim()&&iA===0?a.jsx("p",{className:"af-palette-empty",children:e("flow:palette.noMatch")}):null,l?null:a.jsx("p",{className:"af-palette-empty",children:e("flow:palette.selectPipeline")})]}),a.jsxs("footer",{className:"af-palette-engine",children:[a.jsxs("div",{className:"af-palette-engine-head",children:[a.jsx("span",{className:"af-palette-engine-dot"+(yt?"":" af-palette-engine-dot--offline"),"aria-hidden":!0}),a.jsx("span",{className:"af-palette-engine-label",children:e(yt?"common:engine.online":"common:engine.offline")})]}),k?a.jsx("div",{className:"af-palette-tip"+aA,role:"status","aria-live":"polite",children:k}):null]})]}):xe!=="edit"&&l?a.jsx(MU,{flowId:l.id,flowSource:l.source||"user",flowArchived:l.archived,provideNodes:Qr,edges:tn,nodes:ct,onCliInputsChange:$e,onBackToEdit:_o}):null,a.jsxs("div",{className:"af-pipeline-main-stack",children:[a.jsxs("div",{className:"af-pipeline-canvas-col",children:[y?a.jsx("div",{className:"af-banner af-banner--err af-pipeline-banner",children:y}):null,l&&Ni.length>0&&!E?a.jsxs("div",{className:"af-banner af-banner--warn af-flow-slot-warnings",role:"region","aria-label":e("flow:validation.flowWarningAriaLabel"),children:[a.jsxs("div",{className:"af-flow-slot-warnings-head",children:[a.jsx("div",{className:"af-flow-slot-warnings-title",children:e("flow:palette.validationWarnings")}),a.jsxs("div",{className:"af-flow-slot-warnings-head-actions",children:[a.jsx("button",{type:"button",className:"af-icon-btn",disabled:G,"aria-label":e("flow:validation.reloadFromServer"),title:e("flow:validation.reloadFromServerShort"),onClick:()=>void Nv(),children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"refresh"})}),a.jsx("button",{type:"button",className:"af-icon-btn","aria-label":e("flow:validation.closeBanner"),title:e("common:common.close"),onClick:()=>Y(!0),children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]})]}),a.jsx("ul",{className:"af-flow-slot-warnings-list",children:Ni.map(x=>a.jsxs("li",{children:[e("flow:validation.nodePrefix"),' "',a.jsx("a",{href:"#",className:"af-flow-slot-warning-node-link","aria-label":e("flow:validation.focusNodeAriaLabel",{nodeId:x.nodeId}),onClick:j=>{j.preventDefault(),gA(x.nodeId)},children:x.nodeId}),'"',x.suffix]},x.key))})]}):null,l&&Ni.length>0&&E?a.jsxs("div",{className:"af-banner af-banner--warn af-flow-slot-warnings af-flow-slot-warnings--collapsed",role:"status","aria-live":"polite",children:[a.jsx("span",{className:"af-flow-slot-warnings-collapsed-text",children:e("flow:validation.slotWarningCount",{count:Ni.length})}),a.jsxs("button",{type:"button",className:"af-flow-slot-warnings-kbd-hint",onClick:Lv,title:e("flow:validation.shortcutHint"),children:[a.jsx("kbd",{children:"?"})," ",e("flow:validation.shortcutHintLabel")]}),a.jsxs("div",{className:"af-flow-slot-warnings-collapsed-actions",children:[a.jsx("button",{type:"button",className:"af-flow-slot-warnings-collapsed-btn",onClick:()=>Y(!1),children:e("flow:validation.show")}),a.jsx("button",{type:"button",className:"af-flow-slot-warnings-collapsed-btn",disabled:G,onClick:()=>void Nv(),children:e("common:common.refresh")})]})]}):null,at==="settings"&&l&&xe==="edit"?$A():a.jsx("div",{className:"af-react-flow-wrap af-pipeline-flow",children:l?a.jsxs(a.Fragment,{children:[a.jsx(hV,{fitViewEpoch:p,canvasTool:DI,nodes:eA,edges:tA,onNodesChange:xe!=="edit"?void 0:QI,onEdgesChange:xe!=="edit"?void 0:ZI,onConnect:xe!=="edit"?void 0:dA,onConnectStart:xe!=="edit"?void 0:fA,onConnectEnd:xe!=="edit"?void 0:pA,isValidConnection:xe!=="edit"?void 0:uA,onNodesDelete:xe!=="edit"?void 0:hA,onNodeClick:lA,onEdgeClick:cA,onFlowInit:mA,onDrop:vA,onDragOver:wA,hideMinimapAndControls:!!(l&&at),bottomSlot:xe==="edit"?a.jsx("div",{className:"af-bottom-composer-stack af-flow-bottom-composer",children:a.jsxs("div",{className:"af-pipeline-composer-inner",children:[a.jsx("div",{className:"af-composer-selected","aria-label":e("flow:composer.selectedNodesAriaLabel"),children:Sd.length===0?a.jsx("span",{className:"af-composer-selected-empty",children:e("flow:composer.selectedNodesEmpty")}):Sd.map((x,j)=>{var pe,we;if(x.kind==="definition"){const _e=x.definition,se=String(_e.label??_e.id),ke=[_e.id,_e.description?String(_e.description).slice(0,120):""].filter(Boolean).join(" — ");return a.jsxs("div",{className:"af-composer-node-chip af-composer-node-chip--definition",title:ke,children:[a.jsx("span",{className:"af-composer-node-chip-label",children:se}),a.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>Rv(x),"aria-label":e("flow:composer.removeFromInput",{id:_e.id}),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},`def-${_e.id}`)}const O=x.node,z=x.kind,H=String(((pe=O.data)==null?void 0:pe.label)??O.id),W=(we=O.data)!=null&&we.definitionId?String(O.data.definitionId):"",J=W&&W!==H?`${H} · ${O.id} · ${W}`:`${H} · ${O.id}`,ee=z==="canvas"?e("flow:composer.deselectNode",{id:O.id}):e("flow:composer.removeFromInput",{id:O.id});return a.jsxs("div",{className:"af-composer-node-chip"+(z==="mention"?" af-composer-node-chip--mention":""),title:J,children:[a.jsx("span",{className:"af-composer-node-chip-label",children:H}),a.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>Rv(x),"aria-label":ee,children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},O.id)})}),a.jsxs("div",{className:"af-composer-card af-composer-card--input-only",children:[a.jsxs("div",{className:"af-composer-input-wrap",children:[a.jsx("textarea",{ref:Ph,className:"af-composer-textarea",placeholder:e("flow:composer.inputPlaceholder"),disabled:!l,value:Or,rows:2,onChange:x=>{Rl(x.target.value),Ll(x.target.selectionStart??x.target.value.length)},onSelect:x=>{const j=x.target;j instanceof HTMLTextAreaElement&&Ll(j.selectionStart??0)},onKeyDown:x=>{if((x.metaKey||x.ctrlKey)&&x.key==="Enter"){x.preventDefault(),Po();return}if(Yl&&Zr.length>0&&(x.key==="ArrowDown"||x.key==="ArrowUp"||x.key==="Enter")){if(x.key==="ArrowDown")x.preventDefault(),Ml(j=>(j+1)%Zr.length);else if(x.key==="ArrowUp")x.preventDefault(),Ml(j=>(j-1+Zr.length)%Zr.length);else if(x.key==="Enter"){x.preventDefault();const j=Zr[Ol];j&&Xh(j.id)}}},onKeyUp:x=>{const j=x.target;j instanceof HTMLTextAreaElement&&Ll(j.selectionStart??j.value.length)},onClick:x=>{const j=x.target;j instanceof HTMLTextAreaElement&&Ll(j.selectionStart??0)},"aria-label":e("flow:composer.inputAriaLabel"),autoComplete:"off",spellCheck:!1}),Yl&&l&&Zr.length>0?a.jsxs("ul",{className:"af-composer-mention-menu",role:"listbox","aria-label":e("flow:composer.mentionAriaLabel"),children:[Gl.instances.length>0?a.jsx("li",{className:"af-composer-mention-section",role:"presentation",children:a.jsx("div",{className:"af-composer-mention-section-title",children:"Instances"})}):null,Gl.instances.map((x,j)=>{const O=j;return a.jsx("li",{role:"option","aria-selected":O===Ol,children:a.jsxs("button",{type:"button",className:"af-composer-mention-item"+(O===Ol?" af-composer-mention-item--active":""),onMouseDown:z=>z.preventDefault(),onMouseEnter:()=>Ml(O),onClick:()=>Xh(x.id),children:[a.jsx("span",{className:"af-composer-mention-id",children:x.title}),x.subtitle?a.jsx("span",{className:"af-composer-mention-sub",children:x.subtitle}):null]})},`i-${x.id}`)}),Gl.definitions.length>0?a.jsx("li",{className:"af-composer-mention-section",role:"presentation",children:a.jsx("div",{className:"af-composer-mention-section-title",children:"Node"})}):null,Gl.definitions.map((x,j)=>{const O=Gl.instances.length+j;return a.jsx("li",{role:"option","aria-selected":O===Ol,children:a.jsxs("button",{type:"button",className:"af-composer-mention-item"+(O===Ol?" af-composer-mention-item--active":""),onMouseDown:z=>z.preventDefault(),onMouseEnter:()=>Ml(O),onClick:()=>Xh(x.id),children:[a.jsx("span",{className:"af-composer-mention-id",children:x.title}),x.subtitle?a.jsx("span",{className:"af-composer-mention-sub",children:x.subtitle}):null]})},`d-${x.id}`)})]}):null]}),a.jsxs("div",{className:"af-composer-toolbar",children:[Jr.length>0&&a.jsx("label",{className:"af-composer-session-field",children:a.jsxs("select",{className:"af-composer-session-select",value:On||"",onChange:x=>{x.target.value==="__new__"?pv():xv(x.target.value)},disabled:Wt,"aria-label":e("flow:composer.switchConversation"),children:[Jr.map(x=>a.jsxs("option",{value:x.id,children:[x.label,x.running?" ⏳":""]},x.id)),a.jsxs("option",{value:"__new__",children:["+ ",e("flow:composer.newConversation")]})]})}),a.jsxs("div",{className:"af-composer-skills-field",children:[a.jsxs("button",{ref:Lh,type:"button",className:"af-composer-skills-button"+(Gh>0?" af-composer-skills-button--active":""),disabled:!l||Wt,"aria-haspopup":"listbox","aria-expanded":rd,onClick:()=>Rh(x=>!x),children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"extension"}),a.jsx("span",{children:Gh>0?`Skills ${Gh}`:"Skills"})]}),rd&&!Wt?Hr.createPortal(a.jsx("div",{ref:sv,className:"af-composer-skills-menu",role:"listbox","aria-label":"Composer skills",style:GI,children:Xi.length===0?a.jsx("div",{className:"af-composer-skills-empty",children:"No skills found"}):a.jsxs(a.Fragment,{children:[Nd.groups.map(x=>{const j=co(x,Xi),O=fC(x,Yh,Xi),z=qI.has(x.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:O==="all",disabled:j.length===0,onChange:H=>{const W=H.target.checked;Fl(J=>W?uC(J,j):dC(J,j))}}),a.jsxs("span",{className:"af-composer-skill-group-title-main",children:[a.jsx("span",{children:x.name}),x.builtin?a.jsx("em",{children:"built-in"}):null,O==="partial"?a.jsx("em",{children:"partial"}):null]})]}),a.jsxs("button",{type:"button",className:"af-composer-skill-group-toggle","aria-label":z?`展开 ${x.name}`:`收起 ${x.name}`,onClick:()=>{YI(H=>{const W=new Set(H);return W.has(x.id)?W.delete(x.id):W.add(x.id),W})},children:[a.jsx("span",{children:x.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:x.skills.map(H=>a.jsxs("label",{className:"af-composer-skill-option",children:[a.jsx("input",{type:"checkbox",checked:Yh.has(H.key),onChange:W=>{const J=W.target.checked;Fl(ee=>J?ee.includes(H.key)?ee:[...ee,H.key]:ee.filter(pe=>pe!==H.key))}}),a.jsxs("span",{className:"af-composer-skill-option-main",children:[a.jsx("span",{className:"af-composer-skill-option-title",children:H.name}),H.description?a.jsx("span",{className:"af-composer-skill-option-desc",children:H.description}):null]})]},`${x.id}:${H.key}`))})]},x.id)}),Nd.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:Nd.ungrouped.length})]}),Nd.ungrouped.map(x=>a.jsxs("label",{className:"af-composer-skill-option",children:[a.jsx("input",{type:"checkbox",checked:Yh.has(x.key),onChange:j=>{const O=j.target.checked;Fl(z=>O?z.includes(x.key)?z:[...z,x.key]:z.filter(H=>H!==x.key))}}),a.jsxs("span",{className:"af-composer-skill-option-main",children:[a.jsx("span",{className:"af-composer-skill-option-title",children:x.name}),x.description?a.jsx("span",{className:"af-composer-skill-option-desc",children:x.description}):null]})]},`ungrouped:${x.key}`))]}):null]})}),document.body):null]}),a.jsxs("label",{className:"af-composer-model-field",children:[a.jsx("span",{className:"af-visually-hidden",children:e("flow:composer.modelLabel")}),a.jsxs("select",{className:"af-composer-model-select",value:(No||"").trim()?ir.currentNotInLists?ir.currentNotInLists:cf(No,ir.cursorList,ir.opencodeList,ir.claudeCodeList):"",onChange:x=>nv(x.target.value),disabled:!l||Wt,"aria-label":e("flow:composer.modelAriaLabel"),children:[a.jsx("option",{value:"",children:e("flow:composer.modelDefault")}),ir.currentNotInLists?a.jsxs("option",{value:ir.currentNotInLists,children:[ir.currentNotInLists,e("flow:composer.modelNotInList")]}):null,ir.cursorList.length>0?a.jsx("optgroup",{label:"Cursor",children:ir.cursorList.map(x=>a.jsx("option",{value:ts(x),children:x},`composer-c-${x}`))}):null,ir.opencodeList.length>0?a.jsx("optgroup",{label:"OpenCode",children:ir.opencodeList.map(x=>a.jsx("option",{value:`opencode:${ts(x)}`,children:x},`composer-o-${x}`))}):null,ir.claudeCodeList.length>0?a.jsx("optgroup",{label:"Claude Code",children:ir.claudeCodeList.map(x=>a.jsx("option",{value:`claude-code:${ts(x)}`,children:x},`composer-cc-${x}`))}):null]})]}),a.jsx("button",{type:"button",className:"af-composer-send"+(l&&Or.trim()&&!Wt?" af-composer-send--active":"")+(Wt?" af-composer-send--stop":""),disabled:!l||!Wt&&!Or.trim(),"aria-label":e(Wt?"flow:composer.stopGeneration":"flow:composer.send"),title:Wt?e("flow:composer.stopGeneration"):void 0,onClick:()=>{var x;if(Wt){(x=cd.current)==null||x.abort();return}Po()},children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:Wt?"stop":"arrow_upward"})})]})]}),Mh?Hr.createPortal(a.jsx("div",{className:"af-node-props-expand-overlay af-composer-thread-dialog-overlay",role:"dialog","aria-modal":"true","aria-label":e("flow:composer.conversationOutput"),onMouseDown:x=>{x.target===x.currentTarget&&ld(!1)},children:a.jsxs("div",{className:"af-node-props-expand-panel af-composer-thread-dialog-panel",children:[a.jsxs("div",{className:"af-node-props-expand-head af-composer-thread-dialog-head",children:[a.jsxs("div",{className:"af-composer-thread-dialog-head-main",children:[a.jsx("span",{className:"af-node-props-expand-title",children:e("flow:nodeProps.conversationOutput")}),a.jsx("div",{className:"af-composer-thread-dialog-status"+(Wt?" af-composer-thread-dialog-status--running":""),role:"status","aria-live":"polite",title:zl||void 0,children:Wt&&!zl?e("flow:composer.executing"):zl||e("flow:composer.ready")})]}),a.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>ld(!1),"aria-label":e("flow:composer.collapseAriaLabel"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),uv.length>1&&!(Qe&&Array.isArray(Qe.phases)&&Qe.phases.length>1)?a.jsx("div",{className:"af-composer-steps-track-wrap",children:a.jsx(nV,{steps:uv})}):null,Qe&&Array.isArray(Qe.phases)&&Qe.phases.length>1?a.jsx("div",{className:"af-composer-phase-bar","aria-label":e("flow:composer.phaseProgress"),children:Qe.phases.map((x,j)=>{const O=x.status||(j<(Qe.currentPhase??0)?"done":j===(Qe.currentPhase??0)?Wt?"running":Qe.nextPhase||Qe.isLastPhase?"done":"running":"pending");return a.jsxs("div",{className:"af-composer-phase-item"+(O==="done"?" af-composer-phase-item--done":"")+(O==="running"?" af-composer-phase-item--running":"")+(O==="pending"?" af-composer-phase-item--pending":""),title:`${x.label}${x.description?":"+x.description:""}`,children:[a.jsx("span",{className:"af-composer-phase-dot","aria-hidden":!0,children:O==="done"?a.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"0.85rem"},children:"check"}):a.jsx("span",{children:j+1})}),a.jsx("span",{className:"af-composer-phase-label",children:x.label})]},x.name||j)})}):null,a.jsx("div",{className:"af-composer-thread-dialog-scroll",children:a.jsx(LS,{thread:Hl,liveSegments:Bl,running:Wt})}),Qe&&!Qe.isLastPhase&&Qe.nextPhase&&!Wt?a.jsxs("div",{className:"af-composer-phase-review af-composer-phase-review--minimal","aria-label":e("flow:composer.phaseReviewLabel"),children:[a.jsx("span",{className:"af-composer-phase-auto-hint",children:e("flow:composer.phaseReviewHint",{nextPhase:Qe.nextPhase.label})}),a.jsxs("div",{className:"af-composer-phase-review-buttons",children:[a.jsx("button",{type:"button",className:"af-composer-phase-btn af-composer-phase-btn--continue",onClick:Tv,children:e("flow:composer.phaseReviewContinue",{label:Qe.nextPhase.label})}),a.jsx("button",{type:"button",className:"af-composer-phase-btn af-composer-phase-btn--skip",onClick:Av,children:e("flow:composer.phaseReviewSkip")})]})]}):null]})}),document.body):null]})}):null}),rr&&xe==="edit"?(()=>{var z;const x=String(rr.query||"").trim().toLowerCase(),j=x?rr.candidates.filter(H=>{var W,J,ee;return[(W=H.def)==null?void 0:W.id,H.displayLabel,H.description,(J=H.slot)==null?void 0:J.name,(ee=H.slot)==null?void 0:ee.type].filter(Boolean).some(pe=>String(pe).toLowerCase().includes(x))}):rr.candidates,O=rr.draft.handleType==="source"?"IN":"OUT";return a.jsxs("div",{className:"af-connect-node-menu",style:{left:rr.left,top:rr.top},role:"dialog","aria-label":"选择匹配节点",children:[a.jsxs("div",{className:"af-connect-node-menu__head",children:[a.jsxs("div",{className:"af-connect-node-menu__title",children:[a.jsx("span",{className:"af-connect-node-menu__dot",style:{background:hn((z=rr.draft.slot)==null?void 0:z.type)},"aria-hidden":!0}),a.jsxs("span",{children:["匹配 ",rr.draft.slotType," 节点"]})]}),a.jsx("button",{type:"button",className:"af-connect-node-menu__close","aria-label":"关闭",onClick:()=>As(null),children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),a.jsxs("label",{className:"af-connect-node-menu__search",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),a.jsx("input",{type:"search",value:rr.query,onChange:H=>As(W=>W&&{...W,query:H.target.value}),placeholder:"搜索节点",autoFocus:!0})]}),a.jsxs("div",{className:"af-connect-node-menu__list",children:[j.map(H=>{var ee,pe;const W=H.displayLabel||((ee=H.def)==null?void 0:ee.id),J=tg(H.slot,H.slotIndex);return a.jsxs("button",{type:"button",className:"af-connect-node-menu__item",onClick:()=>xA(H),title:H.description||H.def.id,children:[a.jsxs("span",{className:"af-connect-node-menu__item-main",children:[a.jsx("span",{className:"af-connect-node-menu__item-label",children:W}),W!==H.def.id?a.jsx("span",{className:"af-connect-node-menu__item-id",children:H.def.id}):null]}),a.jsxs("span",{className:"af-connect-node-menu__port",children:[a.jsx("span",{children:O}),a.jsx("span",{className:"af-connect-node-menu__port-dot",style:{background:hn((pe=H.slot)==null?void 0:pe.type)},"aria-hidden":!0}),a.jsx("span",{className:"af-connect-node-menu__port-name",children:J})]})]},`${H.def.id}-${H.slotIndex}`)}),j.length===0?a.jsx("div",{className:"af-connect-node-menu__empty",children:"没有匹配结果"}):null]})]})})():null]}):a.jsx("div",{className:"af-placeholder af-pipeline-placeholder",children:e("flow:pipeline.selectPipeline")})})]}),xe!=="edit"&&Jt&&a.jsxs("div",{className:"af-run-console",style:{height:Je},children:[a.jsx("div",{className:"af-run-console__resize",role:"separator","aria-orientation":"horizontal","aria-label":e("flow:run.resizeConsole"),onPointerDown:NA,onPointerMove:jA,onPointerUp:_v,onPointerCancel:_v,onLostPointerCapture:CA}),a.jsxs("div",{className:"af-run-console__head",children:[a.jsxs("span",{className:"af-run-console__title",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"terminal"}),"EXECUTION CONSOLE"]}),a.jsxs("div",{className:"af-run-console__head-right",children:[xe==="running"&&a.jsx("span",{className:"af-run-console__live-badge",children:"LIVE"}),a.jsx("button",{type:"button",className:"af-icon-btn af-run-console__close",onClick:()=>En(!1),"aria-label":e("flow:run.closeLog"),children:a.jsx("span",{className:"material-symbols-outlined",children:"expand_more"})})]})]}),a.jsxs("div",{className:"af-run-console__body",children:[Lt.map((x,j)=>a.jsxs("div",{className:"af-run-console__line"+(x.type==="error"?" af-run-console__line--error":"")+(x.type==="warn"?" af-run-console__line--warn":"")+(x.type==="node-start"?" af-run-console__line--start":"")+(x.type==="node-done"?" af-run-console__line--done":"")+(x.type==="node-failed"?" af-run-console__line--error":"")+(x.type==="done"?" af-run-console__line--done":""),children:[a.jsxs("span",{className:"af-run-console__ts",children:["[",x.ts?new Date(x.ts).toLocaleTimeString():"--:--:--","]"]}),a.jsx("span",{className:"af-run-console__text",children:x.text!=null?String(x.text):""})]},j)),a.jsx("div",{ref:B})]})]})]}),xe!=="edit"&&q&&l?a.jsx(TU,{instanceId:q,flowId:l.id,runId:wt,nodeStatus:((Ov=He[q])==null?void 0:Ov.status)??null,onClose:()=>ye(null)}):null,at&&at!=="settings"&&l&&xe==="edit"?a.jsx("aside",{className:"af-pipeline-drawer"+(at==="node"?" af-pipeline-drawer--wide":"")+(at==="composer"?" af-pipeline-drawer--wide":""),"aria-label":at==="settings"?e("flow:settings.title"):at==="history"?e("flow:history.title"):at==="composer"?"AI Composer":e("flow:nodeProps.title"),children:at==="composer"?a.jsxs("div",{className:"af-composer-sidebar",children:[a.jsxs("div",{className:"af-pipeline-drawer-head",children:[a.jsx("h2",{className:"af-pipeline-drawer-title",children:"AI Composer"}),a.jsx("button",{type:"button",className:"af-pipeline-drawer-close af-icon-btn",onClick:Xl,"aria-label":e("flow:composer.closeSidebar"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),Jr.length>0&&a.jsxs("div",{className:"af-composer-session-tabs",children:[Jr.map(x=>a.jsxs("button",{type:"button",ref:j=>{j&&x.id===On&&j.scrollIntoView({block:"nearest",inline:"nearest"})},className:["af-composer-session-tab",x.id===On?"af-composer-session-tab--active":"",x.running?"af-composer-session-tab--running":""].filter(Boolean).join(" "),onClick:()=>xv(x.id),title:x.label,children:[a.jsx("span",{className:"af-composer-session-label",children:x.label}),a.jsx("span",{className:"af-composer-session-close",role:"button",tabIndex:0,onClick:j=>{j.stopPropagation(),hv(x.id)},onKeyDown:j=>{j.key!=="Enter"&&j.key!==" "||(j.preventDefault(),j.stopPropagation(),hv(x.id))},title:x.running?e("flow:composer.endConversation"):e("flow:composer.closeConversation"),children:a.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"0.75rem"},children:"close"})})]},x.id)),a.jsx("button",{type:"button",className:"af-composer-session-add",onClick:()=>pv(),title:e("flow:composer.newConversation"),children:a.jsx("span",{className:"material-symbols-outlined",children:"add"})})]}),a.jsx("div",{className:"af-composer-sidebar-status"+(Wt?" af-composer-sidebar-status--running":""),role:"status","aria-live":"polite",children:Wt&&!zl?e("flow:composer.executing"):zl||e("flow:composer.ready")}),Qe&&Array.isArray(Qe.phases)&&Qe.phases.length>1?a.jsx("div",{className:"af-composer-phase-bar","aria-label":e("flow:composer.phaseProgress"),children:Qe.phases.map((x,j)=>{const O=x.status||(j<(Qe.currentPhase??0)?"done":j===(Qe.currentPhase??0)?Wt?"running":Qe.isLastPhase&&j===Qe.phases.length-1||Qe.nextPhase?"done":"running":"pending");return a.jsxs("div",{className:"af-composer-phase-item"+(O==="done"?" af-composer-phase-item--done":"")+(O==="running"?" af-composer-phase-item--running":"")+(O==="pending"?" af-composer-phase-item--pending":""),title:`${x.label}${x.description?":"+x.description:""}`,children:[a.jsx("span",{className:"af-composer-phase-dot","aria-hidden":!0,children:O==="done"?a.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"0.85rem"},children:"check"}):a.jsx("span",{children:j+1})}),a.jsx("span",{className:"af-composer-phase-label",children:x.label})]},x.name||j)})}):null,a.jsx("div",{className:"af-composer-sidebar-thread",ref:fv,children:a.jsx(LS,{thread:Hl,liveSegments:Bl,running:Wt})}),Qe&&!Qe.isLastPhase&&Qe.nextPhase&&!Wt?a.jsxs("div",{className:"af-composer-phase-review af-composer-phase-review--minimal","aria-label":e("flow:composer.phaseReviewLabel"),children:[a.jsx("span",{className:"af-composer-phase-auto-hint",children:e("flow:composer.phaseReviewHint",{nextPhase:Qe.nextPhase.label})}),a.jsxs("div",{className:"af-composer-phase-review-buttons",children:[a.jsx("button",{type:"button",className:"af-composer-phase-btn af-composer-phase-btn--continue",onClick:Tv,children:e("flow:composer.phaseReviewContinue",{label:Qe.nextPhase.label})}),a.jsx("button",{type:"button",className:"af-composer-phase-btn af-composer-phase-btn--skip",onClick:Av,children:e("flow:composer.phaseReviewSkip")})]})]}):null]}):at==="node"&&Ge?rt?a.jsx(VP,{draft:rt,setDraft:Ah,definitionId:String(((Mv=Ge.data)==null?void 0:Mv.definitionId)??Ge.id),systemPromptReadonly:String((Bh==null?void 0:Bh.description)??""),modelLists:Xe,disabled:!l,onIdBlur:SA,onClose:Xl,onPublishToMarketplace:oA,error:BI,ioSlots:{inputs:Array.isArray(rt==null?void 0:rt.inputs)?rt.inputs:[],outputs:Array.isArray(rt==null?void 0:rt.outputs)?rt.outputs:[]}}):a.jsx("div",{className:"af-pipeline-drawer-body",children:a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:pipeline.loadingProps")})}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"af-pipeline-drawer-head",children:[a.jsx("h2",{className:"af-pipeline-drawer-title",children:e(at==="settings"?"flow:settings.title":"flow:history.title")}),a.jsx("button",{type:"button",className:"af-pipeline-drawer-close af-icon-btn",onClick:Xl,"aria-label":e("flow:composer.closeSidebar"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsx("div",{className:"af-pipeline-drawer-body",children:at==="settings"?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.pipelineId")}),(l.source==="user"||l.source==="workspace")&&!l.archived?a.jsxs("div",{className:"af-pipeline-rename-row",children:[a.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:N,onChange:x=>{P(x.target.value),L("")},onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),wd())},onBlur:()=>{N.trim()&&N.trim()!==l.id&&wd()},placeholder:l.id,disabled:R,spellCheck:!1}),a.jsx("span",{className:"af-pipeline-drawer-badge",children:va(l.source??"user",e)})]}):a.jsxs("div",{className:"af-pipeline-drawer-readonly",children:[l.id,a.jsx("span",{className:"af-pipeline-drawer-badge",children:va(l.source??"user",e)}),l.archived?a.jsx("span",{className:"af-pipeline-drawer-badge af-pipeline-drawer-badge--muted",children:e("flow:settings.archived")}):null]}),U?a.jsx("p",{className:"af-err af-pipeline-drawer-err",children:U}):null]}),typeof l.path=="string"&&l.path?a.jsxs("div",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.diskPath")}),a.jsxs("div",{className:"af-pipeline-drawer-readonly af-pipeline-drawer-readonly--mono af-pipeline-path-row",children:[a.jsx("span",{className:"af-pipeline-path-text",children:l.path}),a.jsx("button",{type:"button",className:"af-icon-btn af-pipeline-copy-btn",onClick:()=>Cv(l.path),title:e("flow:settings.copyPath"),children:a.jsx("span",{className:"material-symbols-outlined",children:A?"check":"content_copy"})})]})]}):null,l.source==="user"||l.source==="workspace"?l.archived?a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.archivedNote")}):a.jsxs("div",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.storageLocation")}),a.jsx("div",{className:"af-pipeline-move-actions",children:l.source==="user"?a.jsx("button",{type:"button",className:"af-btn-secondary",disabled:S,onClick:()=>xd("workspace"),children:e(S?"flow:settings.moveBusy":"flow:settings.moveToWorkspace")}):a.jsx("button",{type:"button",className:"af-btn-secondary",disabled:S,onClick:()=>xd("user"),children:e(S?"flow:settings.moveBusy":"flow:settings.moveToUserDir")})}),v?a.jsx("p",{className:"af-err af-pipeline-drawer-err",children:v}):null]}):a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.builtinNote")}),a.jsxs("label",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.introduction")}),a.jsx("textarea",{className:"af-pipeline-drawer-textarea",value:d,onChange:x=>h(x.target.value),placeholder:e("flow:pipeline.introductionPlaceholder"),rows:5,spellCheck:!1})]}),a.jsxs("div",{className:"af-pipeline-meta-card",children:[a.jsx("h3",{className:"af-pipeline-meta-title",children:e("flow:schedule.title")}),ko?a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("common:common.loading")}):a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"af-new-pipeline-radio",children:[a.jsx("input",{type:"checkbox",checked:!!Zt.enabled,disabled:yr||l.archived||l.source==="builtin",onChange:x=>Ts(j=>({...j,enabled:x.target.checked}))}),a.jsx("span",{children:e("flow:schedule.enabled")})]}),a.jsxs("label",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.cron")}),a.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:Zt.cron||"",disabled:yr||l.archived||l.source==="builtin",onChange:x=>Ts(j=>({...j,cron:x.target.value})),placeholder:"0 9 * * *",spellCheck:!1})]}),a.jsxs("label",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.timezone")}),a.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:Zt.timezone||"",disabled:yr||l.archived||l.source==="builtin",onChange:x=>Ts(j=>({...j,timezone:x.target.value})),placeholder:"Asia/Shanghai",spellCheck:!1})]}),a.jsxs("label",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.preset")}),a.jsxs("select",{className:"af-pipeline-flow-select",value:Zt.preset||"",disabled:yr||l.archived||l.source==="builtin",onChange:x=>Ts(j=>({...j,preset:x.target.value})),children:[a.jsx("option",{value:"",children:e("flow:schedule.defaultPreset")}),Object.keys(Qt).map(x=>a.jsx("option",{value:x,children:x},x))]})]}),a.jsx("div",{className:"af-pipeline-drawer-readonly",children:a.jsx("span",{children:e("flow:schedule.overlapSkip")})}),Zt.nextRunAt?a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.nextRun",{time:new Date(Zt.nextRunAt).toLocaleString()})}):a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.noNextRun")}),a.jsxs("dl",{className:"af-pipeline-meta-dl",children:[a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:schedule.runtime")}),a.jsx("dd",{children:bt!=null&&bt.running?e("flow:schedule.running"):Zt.enabled?e("flow:schedule.waiting"):e("flow:schedule.disabled")})]}),ft.lastTriggeredAt?a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:schedule.lastTriggeredAt")}),a.jsx("dd",{children:new Date(ft.lastTriggeredAt).toLocaleString()})]}):null,ft.lastSkippedAt?a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:schedule.lastSkippedAt")}),a.jsxs("dd",{children:[new Date(ft.lastSkippedAt).toLocaleString(),ft.lastSkipReason?` · ${ft.lastSkipReason}`:""]})]}):null,ft.lastRunUuid?a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:schedule.lastRun")}),a.jsx("dd",{children:ft.lastRunUuid})]}):null,ft.lastExitCode!=null?a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:schedule.lastExit")}),a.jsx("dd",{children:String(ft.lastExitCode)})]}):null,ft.lastFinishedAt?a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:schedule.lastFinishedAt")}),a.jsx("dd",{children:new Date(ft.lastFinishedAt).toLocaleString()})]}):null]}),bt!=null&&bt.lastError||ft.lastError?a.jsx("p",{className:"af-err af-pipeline-drawer-err",children:(bt==null?void 0:bt.lastError)||ft.lastError}):null,l.archived||l.source==="builtin"?a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.readonlyNote")}):null,ks?a.jsx("p",{className:"af-err af-pipeline-drawer-err",children:ks}):null,Ss?a.jsx("p",{className:"af-pipeline-drawer-muted",children:Ss}):null,a.jsx("button",{type:"button",className:"af-btn-secondary",disabled:yr||l.archived||l.source==="builtin",onClick:Vh,children:e(yr?"flow:schedule.saving":"flow:schedule.save")})]})]}),a.jsxs("div",{className:"af-pipeline-meta-card",children:[a.jsx("h3",{className:"af-pipeline-meta-title",children:e("flow:pipeline.metadata")}),a.jsx("dl",{className:"af-pipeline-meta-dl",children:a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:pipeline.nodeCount")}),a.jsxs("dd",{children:[ct.length," ",e("flow:pipeline.nodesUnit")]})]})})]}),a.jsx("button",{type:"button",className:"af-pipeline-drawer-link",onClick:()=>n("/settings"),children:e("flow:settings.globalSettings")})]}):a.jsxs(a.Fragment,{children:[a.jsxs("p",{className:"af-pipeline-drawer-lead",children:[e("flow:settings.currentPipeline"),a.jsx("strong",{children:l.id})]}),ne?a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("common:common.loading")}):xn?a.jsx("p",{className:"af-err af-pipeline-drawer-err",children:xn}):ql.length===0?a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:pipeline.noRuns")}):a.jsxs(a.Fragment,{children:[qn.success+qn.failed+qn.running+qn.stopped+qn.interrupted>0?a.jsxs("div",{className:"af-exec-history-summary","aria-label":e("flow:history.summary"),children:[qn.success>0?a.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--success",children:e("flow:history.successCount",{count:qn.success})}):null,qn.failed>0?a.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--failed",children:e("flow:history.failedCount",{count:qn.failed})}):null,qn.stopped>0?a.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--stopped",children:e("flow:history.stoppedCount",{count:qn.stopped})}):null,qn.interrupted>0?a.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--interrupted",children:e("flow:history.interruptedCount",{count:qn.interrupted})}):null,qn.running>0?a.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--running",children:e("flow:history.runningCount",{count:qn.running})}):null]}):null,a.jsx("ul",{className:"af-exec-history-list",children:ql.map((x,j)=>{const O=x.status||"unknown",z=O==="success"?"af-exec-history-card--success":O==="failed"?"af-exec-history-card--failed":O==="stopped"?"af-exec-history-card--stopped":O==="interrupted"?"af-exec-history-card--interrupted":O==="running"?"af-exec-history-card--running":"af-exec-history-card--unknown",H=e(O==="success"?"flow:history.success":O==="failed"?"flow:history.failed":O==="stopped"?"flow:history.stopped":O==="interrupted"?"flow:history.interrupted":O==="running"?"flow:history.running":"flow:history.unknown"),W=O==="success"?"check_circle":O==="failed"?"error":O==="stopped"?"stop_circle":O==="interrupted"?"sync_disabled":O==="running"?"progress_activity":"help",J=x.runId||`${x.at}-${j}`,ee=x.runId!=null&&x.runId.length>=6?e("flow:history.runLabel",{id:x.runId.length>8?x.runId.slice(-8):x.runId}):e("flow:history.runLabel",{id:ql.length-j});return a.jsx("li",{className:"af-exec-history-list-item",children:a.jsxs("button",{type:"button",className:`af-exec-history-card ${z}`,onClick:()=>RA(x),title:e("flow:history.enterRunView"),children:[a.jsxs("div",{className:"af-exec-history-card-top",children:[a.jsx("span",{className:"af-exec-history-card-title",children:ee}),a.jsx("span",{className:"af-exec-history-card-time",children:dy(x.at,e)})]}),a.jsxs("div",{className:"af-exec-history-card-bottom",children:[a.jsxs("span",{className:"af-exec-history-card-status",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:W}),H]}),a.jsxs("span",{className:"af-exec-history-card-duration",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"timer"}),FR(x.durationMs,e)]})]})]})},`${l.id}-${J}`)})})]})]})})]})}):null]}),a.jsx(hS,{open:EA,title:e("flow:run.pauseTitle",{defaultValue:"暂停运行"}),message:e("flow:run.pauseConfirm"),confirmLabel:e("flow:run.pauseConfirmOk",{defaultValue:"暂停"}),onConfirm:PA,onCancel:()=>qh(!1)}),a.jsx(hS,{open:IA,title:e("flow:run.backPromptTitle",{defaultValue:"返回项目列表"}),message:e("flow:run.backPromptMessage",{defaultValue:"流水线仍在运行,请选择处理方式:后台继续运行并退出,或停止后返回编辑。"}),confirmLabel:e("flow:run.backBackground",{defaultValue:"后台运行并退出"}),secondaryLabel:e("flow:run.backStopEdit",{defaultValue:"停止并进入编辑"}),secondaryDestructive:!0,onConfirm:TA,onSecondary:AA,onCancel:()=>kd(!1)}),a.jsx(mU,{open:ed,onClose:()=>$l(!1)}),DA(),a.jsx(yU,{open:_h,onClose:()=>tv(!1),onJump:yA,nodes:ct}),a.jsx(HU,{open:Ki,onClose:()=>Gr(!1),flowId:(l==null?void 0:l.id)??""}),a.jsx(fU,{open:T,onClose:()=>$(!1),flowId:(l==null?void 0:l.id)??"",flowSource:(l==null?void 0:l.source)??"user",onArchived:async()=>{$(!1),await hd(),n("/projects?tab=archived")}}),a.jsx(pU,{open:D&&!!(l!=null&&l.id),onClose:()=>K(!1),flowId:(l==null?void 0:l.id)??"",flowSource:(l==null?void 0:l.source)??"user",flowArchived:!!(l!=null&&l.archived),onDeleted:async()=>{K(!1),u(null),ut([]),an([]),Vl(null),await hd(),n("/projects")}}),a.jsx(xU,{open:!!_,onClose:()=>I(null),flowId:(l==null?void 0:l.id)??"",flowSource:(l==null?void 0:l.source)??"user",flowArchived:!!(l!=null&&l.archived),filePath:(_==null?void 0:_.filePath)??"",fileName:(_==null?void 0:_.fileName)??"",onSaved:()=>{Vt(x=>({...x}))}})]}),te&&xe!=="edit"&&Hr.createPortal(a.jsx("div",{className:"af-user-check-modal-overlay",children:a.jsxs("div",{className:"af-user-check-modal",role:"dialog","aria-modal":"true",children:[a.jsxs("div",{className:"af-user-check-modal__head",children:[a.jsxs("span",{className:"af-user-check-modal__title",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"fact_check"}),e("flow:userCheck.title",{instanceId:te.instanceId})]}),a.jsx("div",{className:"af-user-check-modal__actions",children:Ee?a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:"af-user-check-modal__btn af-user-check-modal__btn--save",onClick:async()=>{if(!te||!l||!wt)return;const x=ae||te.content;try{(await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:l.id,flowSource:l.source??"user",action:"save-user-check-content",runUuid:wt,instanceId:te.instanceId,content:x})})).ok?(re(O=>O&&{...O,content:x}),Te(!1),Ke(O=>[...O,{ts:new Date().toISOString(),type:"info",text:e("flow:userCheck.contentSaved")}])):Ke(O=>[...O,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}catch{Ke(j=>[...j,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}},children:[a.jsx("span",{className:"material-symbols-outlined",children:"save"}),e("flow:userCheck.save")]}),a.jsxs("button",{type:"button",className:"af-user-check-modal__btn",onClick:()=>{je(te.content),Te(!1)},children:[a.jsx("span",{className:"material-symbols-outlined",children:"close"}),e("flow:userCheck.cancel")]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:"af-user-check-modal__btn",onClick:()=>Te(!0),children:[a.jsx("span",{className:"material-symbols-outlined",children:"edit"}),e("flow:userCheck.edit")]}),a.jsx("button",{type:"button",className:"af-user-check-modal__btn",onClick:()=>re(null),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]})})]}),a.jsx("div",{className:"af-user-check-modal__body",children:Ee?a.jsx("textarea",{ref:la,className:"af-user-check-modal__textarea",value:ae||te.content,onChange:x=>je(x.target.value)}):a.jsx("div",{className:"af-user-check-modal__preview",children:a.jsx("pre",{children:ae||te.content})})}),a.jsxs("div",{className:"af-user-check-modal__ai-bar",children:[a.jsx("input",{type:"text",className:"af-user-check-modal__ai-input",placeholder:e("flow:userCheck.aiEditPlaceholder"),value:mt,onChange:x=>wr(x.target.value),disabled:fn}),a.jsxs("button",{type:"button",className:"af-user-check-modal__btn af-user-check-modal__btn--ai",disabled:fn||!mt.trim(),onClick:()=>{!te||!l||!wt||!mt.trim()||(Mt(!0),Ke(x=>[...x,{ts:new Date().toISOString(),type:"info",text:e("flow:userCheck.aiEditStarted")}]),fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:l.id,flowSource:l.source??"user",action:"ai-edit-user-check-content",runUuid:wt,instanceId:te.instanceId,content:ae||te.content,prompt:mt})}).then(x=>x.json()).then(x=>{Mt(!1),x.ok&&x.content?(je(x.content),Te(!0),wr(""),Ke(j=>[...j,{ts:new Date().toISOString(),type:"info",text:e("flow:userCheck.aiEditDone")}])):Ke(j=>[...j,{ts:new Date().toISOString(),type:"error",text:x.error||e("flow:userCheck.aiEditFailed")}])}).catch(()=>{Mt(!1),Ke(x=>[...x,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.aiEditFailed")}])}))},children:[fn?a.jsx("span",{className:"material-symbols-outlined af-spin",children:"sync"}):a.jsx("span",{className:"material-symbols-outlined",children:"auto_fix_high"}),e("flow:userCheck.aiEditBtn")]})]}),a.jsxs("div",{className:"af-user-check-modal__foot",children:[a.jsx("span",{className:"af-user-check-modal__hint",children:e("flow:userCheck.hint")}),a.jsxs("button",{type:"button",className:"af-user-check-modal__btn af-user-check-modal__btn--continue",onClick:async()=>{if(!te||!l||!wt)return;const x=ae||te.content;try{(await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:l.id,flowSource:l.source??"user",action:"save-user-check-content",runUuid:wt,instanceId:te.instanceId,content:x})})).ok?(await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:l.id,flowSource:l.source??"user",action:"confirm-user-check",runUuid:wt,instanceId:te.instanceId,execId:te.execId})}),re(null),wr(""),Ci({runUuid:wt})):Ke(O=>[...O,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}catch{Ke(j=>[...j,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}},children:[a.jsx("span",{className:"material-symbols-outlined",children:"play_arrow"}),e("flow:userCheck.continue")]})]})]})}),document.body),Kn&&xe!=="edit"&&Hr.createPortal(a.jsx("div",{className:"af-user-ask-modal-overlay",children:a.jsxs("div",{className:"af-user-ask-modal",role:"dialog","aria-modal":"true",children:[a.jsxs("div",{className:"af-user-ask-modal__head",children:[a.jsxs("span",{className:"af-user-ask-modal__title",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"help"}),e("flow:userAsk.title",{instanceId:Kn.instanceId})]}),a.jsx("div",{className:"af-user-ask-modal__actions",children:a.jsx("button",{type:"button",className:"af-user-ask-modal__btn",onClick:()=>Gi(null),"aria-label":e("flow:userAsk.close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})})]}),a.jsxs("div",{className:"af-user-ask-modal__body",children:[Kn.question.trim()?a.jsx("div",{className:"af-user-ask-modal__question",children:a.jsx("pre",{children:Kn.question})}):null,Kn.options.length===0?a.jsx("div",{className:"af-user-ask-modal__empty",children:e("flow:userAsk.noOptions")}):a.jsx("div",{className:"af-user-ask-modal__options",children:Kn.options.map(x=>a.jsxs("button",{type:"button",className:"af-user-ask-option",disabled:vn,onClick:async()=>{if(!(!Kn||!l||!wt)){zt(!0);try{(await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:l.id,flowSource:l.source??"user",action:"confirm-user-ask",runUuid:wt,instanceId:Kn.instanceId,execId:Kn.execId,branch:x.name,selectedIndex:x.index,selectedLabel:x.label})})).ok?(Gi(null),zt(!1),Ci({runUuid:wt})):(zt(!1),Ke(O=>[...O,{ts:new Date().toISOString(),type:"error",text:e("flow:userAsk.submitFailed")}]))}catch{zt(!1),Ke(j=>[...j,{ts:new Date().toISOString(),type:"error",text:e("flow:userAsk.submitFailed")}])}}},children:[a.jsxs("span",{className:"af-user-ask-option__index",children:["[",x.index,"]"]}),a.jsx("span",{className:"af-user-ask-option__label",children:x.label})]},x.name))})]}),a.jsx("div",{className:"af-user-ask-modal__foot",children:a.jsx("span",{className:"af-user-ask-modal__hint",children:e(vn?"flow:userAsk.submitting":"flow:userAsk.hint")})})]})}),document.body),vr&&xe!=="edit"&&a.jsxs("div",{className:"af-tool-print-toast"+(Ju?" af-tool-print-toast--expanded":""),role:"status","aria-live":"polite",children:[a.jsxs("div",{className:"af-tool-print-toast__head",children:[a.jsx("span",{className:"material-symbols-outlined",children:"print"}),a.jsx("span",{className:"af-tool-print-toast__title",children:e("flow:toolPrint.title",{instanceId:vr.instanceId})}),a.jsx("button",{type:"button",className:"af-tool-print-toast__close",onClick:()=>ev(x=>!x),"aria-label":e(Ju?"flow:toolPrint.restore":"flow:toolPrint.expand"),title:e(Ju?"flow:toolPrint.restore":"flow:toolPrint.expand"),children:a.jsx("span",{className:"material-symbols-outlined",children:Ju?"close_fullscreen":"open_in_full"})}),a.jsx("button",{type:"button",className:"af-tool-print-toast__close",onClick:()=>Xu(null),"aria-label":e("common:close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsx("div",{className:"af-tool-print-toast__body",children:a.jsx("div",{className:"af-tool-print-toast__markdown",children:a.jsx(Uu,{children:vr.content})})})]}),ca&&a.jsx("div",{className:"af-provide-edit-overlay",children:a.jsxs("div",{className:"af-provide-edit-modal",role:"dialog","aria-modal":"true",children:[a.jsxs("div",{className:"af-provide-edit-modal__head",children:[a.jsx("span",{className:"material-symbols-outlined",children:"edit_document"}),a.jsx("span",{className:"af-provide-edit-modal__title",children:ca.label}),a.jsx("button",{type:"button",className:"af-provide-edit-modal__close",onClick:()=>Qu(null),"aria-label":e("common:close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsx("div",{className:"af-provide-edit-modal__body",children:a.jsx("textarea",{ref:Ch,className:"af-provide-edit-modal__textarea",defaultValue:ca.content,autoFocus:!0})}),a.jsxs("div",{className:"af-provide-edit-modal__foot",children:[a.jsxs("button",{type:"button",className:"af-provide-edit-modal__btn af-provide-edit-modal__btn--save",onClick:nA,children:[a.jsx("span",{className:"material-symbols-outlined",children:"save"}),e("flow:provideEdit.save")]}),a.jsxs("button",{type:"button",className:"af-provide-edit-modal__btn",onClick:()=>Qu(null),children:[a.jsx("span",{className:"material-symbols-outlined",children:"close"}),e("flow:provideEdit.cancel")]})]})]})}),tr&&a.jsx("div",{className:"af-run-params-overlay",children:a.jsxs("div",{className:"af-run-params-modal",role:"dialog","aria-modal":"true",children:[a.jsxs("div",{className:"af-run-params-modal__head",children:[a.jsx("span",{className:"material-symbols-outlined",children:"edit_note"}),a.jsx("span",{className:"af-run-params-modal__title",children:e("flow:runParams.title")}),a.jsx("button",{type:"button",className:"af-run-params-modal__close",onClick:()=>ws(!1),"aria-label":e("common:close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsx("div",{className:"af-run-params-modal__body",children:Qr.length===0?a.jsx("div",{className:"af-run-params-empty",children:e("flow:runParams.noParams")}):a.jsx("div",{className:"af-run-params-list",children:Qr.map(x=>{var J,ee;const j=da[x.id];if(!j)return null;const z=(((J=x.data)==null?void 0:J.definitionId)||"").startsWith("provide_file"),H=((ee=x.data)==null?void 0:ee.label)||x.id,W=qi[j]??"";return a.jsxs("div",{className:"af-run-params-item",children:[a.jsxs("div",{className:"af-run-params-item__head",children:[a.jsx("span",{className:"af-run-params-item__icon material-symbols-outlined"+(z?" af-run-params-item__icon--file":""),children:z?"description":"text_fields"}),a.jsx("span",{className:"af-run-params-item__label",children:H}),a.jsx("span",{className:"af-run-params-item__slot",children:j})]}),a.jsx("input",{type:"text",className:"af-run-params-item__input",value:W,onChange:pe=>vs(we=>({...we,[j]:pe.target.value})),placeholder:e(z?"flow:runConfig.filePathPlaceholder":"flow:runConfig.stringValuePlaceholder")})]},x.id)})})}),a.jsxs("div",{className:"af-run-params-modal__foot",children:[a.jsxs("button",{type:"button",className:"af-run-params-modal__btn af-run-params-modal__btn--run",onClick:()=>{var j;const x={};for(const O of Qr){const z=da[O.id];if(!z)continue;const H=((j=O.data)==null?void 0:j.definitionId)||"",W=qi[z]??"";H.startsWith("provide_file")?x[z]={type:"file",path:W}:x[z]={type:"str",value:W}}ws(!1),_n(!1),Ci({cliInputsOverride:x})},children:[a.jsx("span",{className:"material-symbols-outlined",children:"play_arrow"}),e("flow:runParams.run")]}),a.jsxs("button",{type:"button",className:"af-run-params-modal__btn",onClick:()=>ws(!1),children:[a.jsx("span",{className:"material-symbols-outlined",children:"close"}),e("flow:runParams.cancel")]})]})]})})]})})}const xV="af:workspace-graph:v2",Na=["DISPLAY","CONTROL","TOOL","PROVIDE","AGENT"],wV=new Set(["control_start","control_end","control_load_skills"]),vV={id:"workspace_run",displayName:"Run",label:"Run",description:"Run the downstream workspace subgraph connected from this node.",type:"control",inputs:[],outputs:[{type:"node",name:"next",default:""}]},bV={id:"control_load_skills",displayName:"Load Skills",label:"Load Skills",description:"Load the currently selected Workspace skill collection for downstream agent nodes.",type:"control",inputs:[{type:"node",name:"prev",default:""}],outputs:[{type:"node",name:"next",default:""},{type:"text",name:"skillsContext",default:""}]},kV="0.1.31";function SV(){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 df(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 NV(e){const t=String((e==null?void 0:e.flowId)||"").trim();if(!t)return"";const n=String((e==null?void 0:e.flowSource)||"user").trim()||"user";return`af:workspace-composer:${t}:${n}${e!=null&&e.archived?":archived":""}`}function jV(e){const t=String((e==null?void 0:e.flowId)||"").trim();if(!t)return"";const n=String((e==null?void 0:e.flowSource)||"user").trim()||"user";return`af:composer-skills:workspace:${t}:${n}${e!=null&&e.archived?":archived":""}`}function CV(e){return!e||typeof e.closest!="function"?!1:!!e.closest("input, textarea, select, [contenteditable='true']")}function zS(e){return(Array.isArray(e)?e:[]).filter(t=>t&&(t.role==="user"||t.role==="assistant")&&typeof t.text=="string").map(t=>({role:t.role,text:t.text,...t.error?{error:!0}:{},...typeof t.at=="number"?{at:t.at}:{}})).slice(-80)}function ZP(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 jc(e){const t=String((e==null?void 0:e.id)||"");return t==="workspace_run"?"CONTROL":t.startsWith("display_")?"DISPLAY":/^control/i.test(t)?"CONTROL":/^tool/i.test(t)?"TOOL":/^provide/i.test(t)?"PROVIDE":"AGENT"}function BS(e){return e==="DISPLAY"?"preview":e==="CONTROL"?"account_tree":e==="TOOL"?"build":e==="PROVIDE"?"database":"smart_toy"}function Bw(e){return String((e==null?void 0:e.displayName)||(e==null?void 0:e.label)||(e==null?void 0:e.id)||"Node")}function Cc(e){return Bw(e)}function Gy(e){return String((e==null?void 0:e.description)||(e==null?void 0:e.body)||"").replace(/\s+/g," ").trim()}function ig(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 HS(e,t,n){const r=String((t==null?void 0:t.name)||(t==null?void 0:t.id)||`#${n+1}`).trim(),i=String((t==null?void 0:t.type)||"").trim(),s=String((t==null?void 0:t.default)??(t==null?void 0:t.value)??"").trim();return[e,r,i?`type: ${i}`:"",s?`default: ${s}`:""].filter(Boolean).join(" · ")}function US(e,t){const n=Array.isArray(e)?e:[],r=n.slice(0,4),i=Math.max(0,n.length-r.length);return{list:n,shown:r,hidden:i,kind:t}}function VS(e,t){const n=String((e==null?void 0:e.source)||""),r=String((e==null?void 0:e.target)||"");if(!n||!r)return!1;const i=new Map(t.map(c=>[c.id,c])),s=wl(i.get(n),e.sourceHandle||"output-0","source"),o=wl(i.get(r),e.targetHandle||"input-0","target");return!!(s&&o&&xl(s,o))}function EV(e,t){const n=String((e==null?void 0:e.nodeId)||""),r=String((e==null?void 0:e.handleId)||""),i=(e==null?void 0:e.handleType)==="target"?"target":(e==null?void 0:e.handleType)==="source"?"source":"";if(!n||!r||!i)return null;const s=t.find(c=>c.id===n),o=wl(s,r,i);return o?{nodeId:n,handleId:r,handleType:i,slot:o,slotType:DP(o)}:null}function _V(e,t){return t?e.map((n,r)=>{const i=Array.isArray(t.handleType==="source"?n.inputs:n.outputs)?t.handleType==="source"?n.inputs:n.outputs:[];for(let s=0;s<i.length;s+=1){const o=i[s];if(!(t.handleType==="source"?xl(t.slot,o):xl(o,t.slot)))continue;const l=jc(n);return{def:n,order:r,category:l,categoryRank:Na.indexOf(l),slot:o,slotIndex:s,displayLabel:Cc(n),description:Gy(n)}}return null}).filter(Boolean).sort((n,r)=>{var o,c;const i=(o=n.slot)!=null&&o.required?0:1,s=(c=r.slot)!=null&&c.required?0:1;return i-s||n.slotIndex-r.slotIndex||n.categoryRank-r.categoryRank||n.order-r.order}):[]}function PV(e,t=!1){if(t)return"folder";const n=String(e||"").toLowerCase().split(".").pop();return n==="md"||n==="markdown"?"article":["js","jsx","ts","tsx","mjs","cjs"].includes(n)?"code":["yaml","yml","json"].includes(n)?"data_object":"draft"}function IV(e,t){const n=String(e||"node").replace(/^(agent|control|provide|tool|display)_/i,"").replace(/[^a-zA-Z0-9_]+/g,"_").replace(/^_+|_+$/g,"")||"node",r=new Set(t.map(i=>i.id));for(let i=1;i<1e4;i++){const s=`${n}_${i}`;if(!r.has(s))return s}return`${n}_${Date.now().toString(36)}`}function AV(e){return(e==null?void 0:e.default)!=null?String(e.default):(e==null?void 0:e.value)!=null?String(e.value):""}function fc(e){return(Array.isArray(e)?e:[]).map(t=>({type:(t==null?void 0:t.type)||"node",name:(t==null?void 0:t.name)||"",default:AV(t),required:!!(t!=null&&t.required),showOnNode:(t==null?void 0:t.showOnNode)!==!1}))}function WS(e,t){var p,f;const n=e!=null&&e.instances&&typeof e.instances=="object"?e.instances:{},r=Array.isArray(e==null?void 0:e.edges)?e.edges:[],i=(p=e==null?void 0:e.ui)!=null&&p.nodePositions&&typeof e.ui.nodePositions=="object"?e.ui.nodePositions:{},s=(f=e==null?void 0:e.ui)!=null&&f.nodeSizes&&typeof e.ui.nodeSizes=="object"?e.ui.nodeSizes:{},o=new Set(Object.keys(n));for(const d of r)d!=null&&d.source&&o.add(String(d.source)),d!=null&&d.target&&o.add(String(d.target));const l=Array.from(o).map(d=>{const h=n[d]||{},y=h.definitionId||d,b=t.find(w=>w.id===y),k=i[d]&&typeof i[d].x=="number"&&typeof i[d].y=="number"?i[d]:{x:320+o.size*20,y:180+o.size*12},g=s[d]&&typeof s[d].width=="number"&&typeof s[d].height=="number"?{width:s[d].width,height:s[d].height}:null,v=!!El(y);return{id:d,type:Vu,position:k,...v&&g?{width:g.width,height:g.height}:{},data:{label:h.label||Bw(b)||d,definitionId:y,schemaType:ZP(y,b),role:h.role||"normal",model:h.model||void 0,body:h.body||"",script:h.script||"",...v&&g?{displaySize:g}:{}}}}).map(d=>wh(d,n,t)),u=r.filter(d=>(d==null?void 0:d.source)&&(d==null?void 0:d.target)).map((d,h)=>({id:d.id||`we-${d.source}-${d.target}-${h}`,source:String(d.source),target:String(d.target),sourceHandle:d.sourceHandle??void 0,targetHandle:d.targetHandle??void 0,markerEnd:{type:_r.ArrowClosed}}));return{nodes:l,edges:$P(u,l),instances:n}}function sg(e,t,n){var c,l,u,p,f,d,h,y,b;const r=OP(e,n||{}),i=t.map(k=>({source:k.source,target:k.target,sourceHandle:k.sourceHandle??null,targetHandle:k.targetHandle??null})),s={},o={};for(const k of e)if(s[k.id]={x:((c=k.position)==null?void 0:c.x)||0,y:((l=k.position)==null?void 0:l.y)||0},El((u=k.data)==null?void 0:u.definitionId)){const g=Number(((f=(p=k.data)==null?void 0:p.displaySize)==null?void 0:f.width)||k.width||((d=k.measured)==null?void 0:d.width)||0),v=Number(((y=(h=k.data)==null?void 0:h.displaySize)==null?void 0:y.height)||k.height||((b=k.measured)==null?void 0:b.height)||0);g>0&&v>0&&(o[k.id]={width:g,height:v})}return{version:1,instances:r,edges:i,ui:{nodePositions:s,nodeSizes:o}}}function El(e){const t=String(e||"");return t==="display_markdown"?"markdown":t==="display_mermaid"?"mermaid":t==="display_ascii"?"ascii":""}function TV(e){const t=[...(e==null?void 0:e.inputs)||[],...(e==null?void 0:e.outputs)||[]],n=t.find(r=>(r==null?void 0:r.name)==="content")||t.find(r=>(r==null?void 0:r.type)==="text");return String((e==null?void 0:e.body)||(n==null?void 0:n.default)||"")}function Ha(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 RV(e){const t=Ha(e);return t.length>1&&t.every(n=>/^:?-{3,}:?$/.test(n))}function LV(e){return Ha(e).map(t=>t.startsWith(":")&&t.endsWith(":")?"center":t.endsWith(":")?"right":"left")}function OV(e){const t=String(e||"").replace(/\r\n/g,`
|
|
133
|
+
`).split(`
|
|
134
|
+
`),n=[];let r=[],i=!1;const s=()=>{r.length&&(n.push({type:"markdown",text:r.join(`
|
|
135
|
+
`)}),r=[])};for(let o=0;o<t.length;){const c=t[o]||"";if(/^\s*```/.test(c)){i=!i,r.push(c),o++;continue}if(!i&&o+1<t.length&&Ha(c).length>1&&RV(t[o+1])){s();const l=Ha(c),u=LV(t[o+1]),p=[];for(o+=2;o<t.length&&t[o].trim()&&Ha(t[o]).length>1;)p.push(Ha(t[o])),o++;n.push({type:"table",headers:l,align:u,rows:p});continue}r.push(c),o++}return s(),n}function KS({children:e}){return a.jsx(Uu,{components:{p:({children:t})=>a.jsx(a.Fragment,{children:t})},children:String(e||"")})}function MV({content:e}){const t=m.useMemo(()=>OV(e),[e]);return a.jsx(a.Fragment,{children:t.map((n,r)=>n.type!=="table"?a.jsx(Uu,{children:n.text},`md-${r}`):a.jsx("div",{className:"af-work-display-table-wrap",children:a.jsxs("table",{className:"af-work-display-table",children:[a.jsx("thead",{children:a.jsx("tr",{children:n.headers.map((i,s)=>a.jsx("th",{style:{textAlign:n.align[s]||"left"},children:a.jsx(KS,{children:i})},s))})}),a.jsx("tbody",{children:n.rows.map((i,s)=>a.jsx("tr",{children:n.headers.map((o,c)=>a.jsx("td",{style:{textAlign:n.align[c]||"left"},children:a.jsx(KS,{children:i[c]||""})},c))},s))})]})},`table-${r}`))})}function $V(e){const t=String(e||"").split(/\r?\n/).map(c=>c.replace(/%%.*$/,"").trim()).filter(Boolean),n=new Map,r=[];let i="TD";const s=(c,l="")=>{const u=String(c||"").replace(/[^A-Za-z0-9_]/g,"_")||`N${n.size+1}`;return n.has(u)?l&&(n.get(u).label=l):n.set(u,{id:u,label:l||u}),u},o=c=>{const l=String(c||"").trim().replace(/[;,]+$/,""),u=l.match(/^([A-Za-z][A-Za-z0-9_]*)(?:\[(.+?)\]|\((.+?)\)|\{(.+?)\})?$/);return u?s(u[1],u[2]||u[3]||u[4]||u[1]):s(l.replace(/[^A-Za-z0-9_]/g,"_"),l)};for(const c of t){const l=c.match(/^(graph|flowchart)\s+(TD|TB|BT|LR|RL)\b/i);if(l){i=l[2].toUpperCase();continue}const u=c.match(/^(.+?)\s*-{1,2}>+\s*(.+)$/);if(u){r.push({from:o(u[1]),to:o(u[2])});continue}o(c)}return{nodes:Array.from(n.values()),edges:r,direction:i}}function DV({code:e}){const t=m.useMemo(()=>$V(e),[e]);if(!String(e||"").trim())return null;const n=t.direction==="LR"||t.direction==="RL",r=142,i=44,s=n?96:32,o=n?30:68,c=new Map;t.nodes.forEach((p,f)=>{c.set(p.id,{x:24+(n?f*(r+s):f%3*(r+s)),y:24+(n?f%3*(i+o):f*(i+o))})});const l=Math.max(360,...Array.from(c.values()).map(p=>p.x+r+24)),u=Math.max(180,...Array.from(c.values()).map(p=>p.y+i+24));return a.jsx("div",{className:"af-work-node__mermaid-preview",children:a.jsxs("svg",{viewBox:`0 0 ${l} ${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=c.get(p.from),h=c.get(p.to);if(!d||!h)return null;const y=n?`M ${d.x+r} ${d.y+i/2} C ${(d.x+h.x+r)/2} ${d.y+i/2}, ${(d.x+h.x+r)/2} ${h.y+i/2}, ${h.x} ${h.y+i/2}`:`M ${d.x+r/2} ${d.y+i} C ${d.x+r/2} ${d.y+i+28}, ${h.x+r/2} ${h.y-28}, ${h.x+r/2} ${h.y}`;return a.jsx("path",{className:"af-work-node__mermaid-edge",d:y,markerEnd:"url(#af-work-arrow)"},`${p.from}-${p.to}-${f}`)}),t.nodes.map(p=>{const f=c.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:i,rx:"8"}),a.jsx("text",{className:"af-work-node__mermaid-text",x:f.x+r/2,y:f.y+i/2+5,textAnchor:"middle",children:p.label.slice(0,22)})]},p.id)})]})})}function FV({data:e}){const t=El(e==null?void 0:e.definitionId);if(!t)return null;const n=TV(e);return n.trim()?t==="markdown"?a.jsx("div",{className:"af-work-display-body af-work-display-body--markdown",children:a.jsx(MV,{content:n})}):t==="mermaid"?a.jsxs("div",{className:"af-work-display-body",children:[a.jsx(DV,{code:n}),a.jsx("pre",{className:"af-work-node__diagram af-work-node__diagram--mermaid",children:n})]}):a.jsx("pre",{className:"af-work-display-body af-work-node__diagram af-work-node__diagram--ascii",children:n}):a.jsx("div",{className:"af-work-display-empty",children:"No display content"})}function zV({id:e,data:t,selected:n,deleteNode:r}){const i=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],o=(Array.isArray(t==null?void 0:t.outputs)?t.outputs:[]).map((p,f)=>({slot:p,idx:f})).sort((p,f)=>{var k,g,v,w;const d=String(((k=p.slot)==null?void 0:k.name)||"").trim(),h=String(((g=f.slot)==null?void 0:g.name)||"").trim();if(d==="next"&&h!=="next")return-1;if(h==="next"&&d!=="next")return 1;const y=String(((v=p.slot)==null?void 0:v.type)||"").trim(),b=String(((w=f.slot)==null?void 0:w.type)||"").trim();return y==="node"&&b!=="node"?-1:b==="node"&&y!=="node"?1:p.idx-f.idx}),c=El(t==null?void 0:t.definitionId),l=(t==null?void 0:t.label)||(c==="mermaid"?"Mermaid":c==="ascii"?"ASCII":"Markdown"),u=t!=null&&t.displaySize&&Number(t.displaySize.width)>0&&Number(t.displaySize.height)>0?{width:Number(t.displaySize.width),height:Number(t.displaySize.height)}:null;return a.jsxs("div",{className:"af-work-display-card"+(u?" af-work-display-card--sized":"")+(n?" af-work-display-card--selected":""),style:u?{width:u.width,height:u.height}:void 0,children:[a.jsx(Hz,{className:"af-work-display-resize nodrag",position:"bottom-right",minWidth:320,minHeight:180,maxWidth:1200,maxHeight:1e3,children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_full"})}),i.map((p,f)=>{if(p.showOnNode===!1)return null;const d=`${4.15+f*1.75}rem`,h=p.name||`#${f+1}`;return a.jsxs(m.Fragment,{children:[a.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:d},children:h}),a.jsx(pi,{type:"target",position:Re.Left,id:`input-${f}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:d,background:hn(p.type)},title:`${h} · ${p.type}`})]},`in-${f}`)}),o.map(({slot:p,idx:f},d)=>{if(p.showOnNode===!1)return null;const h=`${4.15+d*1.75}rem`,y=p.name||`#${f+1}`;return a.jsxs(m.Fragment,{children:[a.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:h},children:y}),a.jsx(pi,{type:"source",position:Re.Right,id:`output-${f}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:h,background:hn(p.type)},title:`${y} · ${p.type}`})]},`out-${f}`)}),a.jsxs("div",{className:"af-work-display-card__head",children:[a.jsxs("div",{className:"af-work-display-card__title",children:[a.jsx("span",{className:"material-symbols-outlined",children:c==="mermaid"?"account_tree":c==="ascii"?"notes":"article"}),a.jsx("strong",{children:l}),a.jsx("span",{children:(t==null?void 0:t.definitionId)||"display"})]}),a.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsx(FV,{data:t})]})}function BV({id:e,data:t,selected:n,deleteNode:r}){const i=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],s=(t==null?void 0:t.runningRunNodeId)===e;return a.jsxs("div",{className:"af-work-run-card"+(n?" af-work-run-card--selected":"")+(s?" af-work-run-card--running":""),children:[i.map((o,c)=>{if(o.showOnNode===!1)return null;const l=`${2.25+c*1.75}rem`,u=o.name||`#${c+1}`;return a.jsxs(m.Fragment,{children:[a.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:l},children:u}),a.jsx(pi,{type:"source",position:Re.Right,id:`output-${c}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:l,background:hn(o.type)},title:`${u} · ${o.type}`})]},`out-${c}`)}),a.jsxs("div",{className:"af-work-run-card__head",children:[a.jsx("span",{className:"material-symbols-outlined",children:"play_circle"}),a.jsx("strong",{children:(t==null?void 0:t.label)||"Run"}),a.jsx("span",{children:(t==null?void 0:t.definitionId)||"workspace_run"}),a.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsxs("button",{type:"button",className:"af-work-run-card__button nodrag",disabled:s,onClick:o=>{var c;o.stopPropagation(),(c=t==null?void 0:t.onRunWorkspaceNode)==null||c.call(t,e)},children:[a.jsx("span",{className:"material-symbols-outlined"+(s?" af-spin":""),children:s?"sync":"play_arrow"}),a.jsx("span",{children:s?"Running":"Run line"})]})]})}function HV(e){var s,o,c,l,u,p,f;const{setEdges:t,setNodes:n}=sa(),r=m.useCallback(d=>{n(h=>h.filter(y=>y.id!==d)),t(h=>h.filter(y=>y.source!==d&&y.target!==d))},[t,n]),i=m.useCallback((d,h)=>{n(y=>y.map(b=>b.id===d?{...b,data:{...b.data,model:h}}:b))},[n]);return El((s=e.data)==null?void 0:s.definitionId)?a.jsx(zV,{...e,deleteNode:r}):((o=e.data)==null?void 0:o.definitionId)==="workspace_run"?a.jsx(BV,{...e,deleteNode:r}):((c=e.data)==null?void 0:c.definitionId)==="control_load_skills"?a.jsx(qV,{...e,deleteNode:r,skills:(l=e.data)==null?void 0:l.skills,skillCollections:(u=e.data)==null?void 0:u.skillCollections,onChangeSkillKeys:(p=e.data)==null?void 0:p.onChangeLoadSkillKeys}):a.jsx("div",{className:"af-work-flow-node",children:a.jsx(FP,{...e,deleteNode:r,modelLists:(f=e.data)==null?void 0:f.modelLists,onModelChange:i})})}const UV={[Vu]:HV};function eI(e,t=[]){for(const n of e||[])n.type==="file"&&t.push(n),Array.isArray(n.children)&&eI(n.children,t);return t}function tI({items:e,onOpen:t,collapsedDirs:n,onToggleDir:r,onCreateFile:i,onCreateFolder:s,onDelete:o,onFileDragStart:c}){return a.jsx("ul",{className:"af-work-files",children:(e||[]).map(l=>{var f;const u=l.type==="directory",p=u&&(n==null?void 0:n.has(l.path));return a.jsxs("li",{children:[a.jsxs("div",{className:"af-work-file-row",children:[a.jsxs("button",{type:"button",className:"af-work-file af-work-file--"+l.type,draggable:!u,onDragStart:d=>{u||c==null||c(d,l)},onClick:()=>u?r==null?void 0:r(l.path):t(l),title:l.path,children:[u?a.jsx("span",{className:"material-symbols-outlined af-work-file__chevron",children:p?"chevron_right":"expand_more"}):null,a.jsx("span",{className:"material-symbols-outlined",children:l.icon||PV(l.name,u)}),a.jsx("span",{children:l.name})]}),u?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"af-work-file-action",onClick:()=>i==null?void 0:i(l.path),title:"新增文件","aria-label":`在 ${l.name} 新增文件`,children:a.jsx("span",{className:"material-symbols-outlined",children:"note_add"})}),a.jsx("button",{type:"button",className:"af-work-file-action",onClick:()=>s==null?void 0:s(l.path),title:"新增文件夹","aria-label":`在 ${l.name} 新增文件夹`,children:a.jsx("span",{className:"material-symbols-outlined",children:"create_new_folder"})})]}):null,a.jsx("button",{type:"button",className:"af-work-file-action af-work-file-action--danger",onClick:()=>o==null?void 0:o(l),title:"删除","aria-label":`删除 ${l.name}`,children:a.jsx("span",{className:"material-symbols-outlined",children:"delete"})})]}),u&&!p&&((f=l.children)!=null&&f.length)?a.jsx(tI,{items:l.children,onOpen:t,collapsedDirs:n,onToggleDir:r,onCreateFile:i,onCreateFolder:s,onDelete:o,onFileDragStart:c}):null]},l.path)})})}function VV({messages:e,running:t}){const n=e.length>0;return a.jsxs("div",{className:"af-composer-ai-stack af-composer-ai-stack--in-panel af-composer-thread-stack",children:[e.map((r,i)=>{const s=r.role==="user"?"user-msg":r.error?"error":"reply",o=r.role==="user"?"You":r.error?"Error":"Reply";return a.jsxs("section",{className:`af-composer-ai-block af-composer-ai-block--${s}`,children:[a.jsx("div",{className:"af-composer-ai-block-label",children:o}),a.jsx("div",{className:"af-composer-ai-block-body",children:r.text})]},`${i}-${r.role}-${String(r.text||"").slice(0,24)}`)}),t&&!n?a.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--reply af-composer-ai-block--pending",children:[a.jsx("div",{className:"af-composer-ai-block-label",children:"Reply"}),a.jsx("div",{className:"af-composer-ai-block-body",children:"Waiting..."})]}):null,t&&n?a.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--thinking",children:[a.jsx("div",{className:"af-composer-ai-block-label",children:"Thinking"}),a.jsx("div",{className:"af-composer-ai-block-body",children:"Workspace agent is running..."})]}):null]})}function qS(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 WV(e){const t=qS((e==null?void 0:e.body)||"");if(t.length>0)return t;const n=Array.isArray(e==null?void 0:e.outputs)?e.outputs:[],r=Array.isArray(e==null?void 0:e.inputs)?e.inputs:[],i=[...n,...r].find(s=>(s==null?void 0:s.name)==="skillsContext"||(s==null?void 0:s.type)==="text");return qS((i==null?void 0:i.default)||(i==null?void 0:i.value)||"")}function KV(e){return JSON.stringify(Array.from(new Set((e||[]).map(String).filter(Boolean))))}function qV({id:e,data:t,selected:n,deleteNode:r,skills:i,skillCollections:s,onChangeSkillKeys:o}){const c=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],l=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],u=Array.isArray(i)?i:[],p=Array.isArray(s)?s:[],[f,d]=m.useState(!1),h=m.useMemo(()=>new Set(WV(t)),[t]),y=m.useMemo(()=>new Map(u.map(g=>[g.key,g])),[u]),b=m.useMemo(()=>{const g=new Set,v=p.map(S=>{const C=co(S,u).map(N=>y.get(N)).filter(Boolean);for(const N of C)g.add(N.key);return{...S,skills:C}}).filter(S=>S.skills.length>0),w=u.filter(S=>!g.has(S.key));return{collectionGroups:v,ungrouped:w}},[y,p,u]),k=m.useCallback((g,v)=>{const w=new Set(h);for(const S of g)v?w.add(S):w.delete(S);o==null||o(e,Array.from(w))},[e,h,o]);return a.jsxs("div",{className:"af-work-load-skills-card"+(n?" af-work-load-skills-card--selected":""),children:[c.map((g,v)=>{if(g.showOnNode===!1)return null;const w=`${2.6+v*1.7}rem`,S=g.name||`#${v+1}`;return a.jsxs(m.Fragment,{children:[a.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:w},children:S}),a.jsx(pi,{type:"target",position:Re.Left,id:`input-${v}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:w,background:hn(g.type)},title:`${S} · ${g.type}`})]},`in-${v}`)}),l.map((g,v)=>{if(g.showOnNode===!1)return null;const w=`${2.6+v*1.7}rem`,S=g.name||`#${v+1}`;return a.jsxs(m.Fragment,{children:[a.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:w},children:S}),a.jsx(pi,{type:"source",position:Re.Right,id:`output-${v}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:w,background:hn(g.type)},title:`${S} · ${g.type}`})]},`out-${v}`)}),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:g=>{g.stopPropagation(),d(v=>!v)},children:[a.jsx("span",{children:h.size>0?`${h.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",onClick:g=>g.stopPropagation(),children:[b.collectionGroups.map(g=>{const v=g.skills.map(C=>C.key),w=v.filter(C=>h.has(C)).length,S=v.length>0&&w===v.length;return a.jsxs("section",{className:"af-work-load-skills-menu__group",children:[a.jsxs("label",{className:"af-work-load-skills-menu__group-head",children:[a.jsx("input",{type:"checkbox",checked:S,onChange:C=>k(v,C.target.checked)}),a.jsx("span",{children:g.name}),a.jsxs("small",{children:[w,"/",v.length]})]}),a.jsx("div",{className:"af-work-load-skills-menu__options",children:g.skills.map(C=>a.jsxs("label",{className:"af-work-load-skills-menu__option",children:[a.jsx("input",{type:"checkbox",checked:h.has(C.key),onChange:N=>k([C.key],N.target.checked)}),a.jsx("span",{children:C.name})]},`${g.id}:${C.key}`))})]},g.id)}),b.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:b.ungrouped.length})]}),a.jsx("div",{className:"af-work-load-skills-menu__options",children:b.ungrouped.map(g=>a.jsxs("label",{className:"af-work-load-skills-menu__option",children:[a.jsx("input",{type:"checkbox",checked:h.has(g.key),onChange:v=>k([g.key],v.target.checked)}),a.jsx("span",{children:g.name})]},`ungrouped:${g.key}`))})]}):null,a.jsx("button",{type:"button",className:"af-work-load-skills-menu__clear",onClick:()=>o==null?void 0:o(e,[]),children:"清空"})]}):null]})]})}function YV(){var vi,xr;const{i18n:e}=_t(),{navigate:t}=ia(),n=sa(),r=m.useMemo(SV,[]),[i,s]=i_([]),[o,c,l]=s_([]),u=m.useRef([]),p=m.useRef(null),f=m.useRef(null),[d,h]=m.useState(null),[y,b]=m.useState({}),k=m.useRef({}),g=m.useRef(!1),v=m.useRef(null),[w,S]=m.useState([]),[C,N]=m.useState(""),[P,R]=m.useState(!1),[M,U]=m.useState(""),[L,A]=m.useState(0),[V,T]=m.useState(""),[$,D]=m.useState(null),[K,_]=m.useState(""),[I,E]=m.useState([]),[Y,G]=m.useState(""),[F,Z]=m.useState(""),[oe,ue]=m.useState(()=>new Set),[ce,le]=m.useState({cursor:[],opencode:[],claudeCode:[]}),[ve,ie]=m.useState(""),[de,me]=m.useState([]),[Se,Ve]=m.useState(!1),[Fe,ze]=m.useState([]),[ht,yn]=m.useState([]),[Yt,at]=m.useState(!1),[Rt,Zn]=m.useState(()=>new Set),[jn,xn]=m.useState(!1),Gt=m.useRef(null),ne=m.useRef(null),fe=m.useRef(null),[Le,Ye]=m.useState({}),[We,Vt]=m.useState(!1),[Xt,sn]=m.useState(""),[yt,Cn]=m.useState(!1),[xe,st]=m.useState([]),[Lt,Ke]=m.useState(!1),[wn,on]=m.useState(""),[Be,He]=m.useState(""),Pt=m.useMemo(()=>NV(r),[r]),Ce=m.useMemo(()=>jV(r),[r]),Ot=m.useRef(!1),[Yr,er]=m.useState("");m.useEffect(()=>{r.flowId&&cC(r.flowId,r.flowSource||"user","workspace",!!r.archived)},[r]),m.useEffect(()=>{if(Ot.current=!1,!Pt){st([]),Ot.current=!0;return}try{const B=localStorage.getItem(Pt);st(B?zS(JSON.parse(B)):[])}catch{st([])}finally{Ot.current=!0}},[Pt]),m.useEffect(()=>{if(!(!Ot.current||!Pt))try{localStorage.setItem(Pt,JSON.stringify(zS(xe)))}catch{}},[xe,Pt]);const Jt=m.useCallback(async()=>{const B=df(r),X=await fetch(`/api/workspace/files?${B.toString()}`),Q=await X.json();if(!X.ok)throw new Error(Q.error||"读取 workspace 失败");E(Q.files||[]),G(Q.root||"")},[r]),En=m.useCallback(async(B=i,X=o)=>{var ae;if(!g.current)return;const Q=sg(B,X,k.current),te=await fetch("/api/workspace/graph",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,graph:Q})}),re=await te.json();if(!te.ok)throw new Error(re.error||"保存 workspace graph 失败");k.current=((ae=re.graph)==null?void 0:ae.instances)||Q.instances,b(k.current),He("Workspace graph saved")},[o,r,i]),xi=m.useCallback(async()=>{g.current=!1;const B=df(r),X=df(r);X.set("lang",String(e.language||"zh").startsWith("zh")?"zh":"en");const[Q,te]=await Promise.all([fetch(`/api/nodes?${X.toString()}`),fetch(`/api/workspace/graph?${B.toString()}`),Jt()]),re=await Q.json(),ae=await te.json();if(!Q.ok)throw new Error(re.error||"读取节点定义失败");if(!te.ok)throw new Error(ae.error||"读取 workspace graph 失败");const je=[...(Array.isArray(re)?re:re.nodes||[]).filter(mt=>!wV.has(mt.id)),bV,vV];S(je);const Ee=ae.graph||JSON.parse(localStorage.getItem(xV)||"null")||{},Te=WS(Ee,je);k.current=Te.instances,b(Te.instances),s(Te.nodes),c(Te.edges),He(ae.writable?"Workspace ready":"Readonly workspace"),g.current=!0},[r,e.language,Jt,c,s]),xs=m.useCallback(async B=>{if(!B||wn)return;const X=sg(i,o,k.current);on(B),He(`Running ${B}...`);try{await En(i,o);const Q=await fetch("/api/workspace/run",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/x-ndjson"},body:JSON.stringify({...r,graph:X,runNodeId:B,model:ve,selectedSkills:Fe,stream:!0})});if(!Q.ok){const Te=await Q.json().catch(()=>({}));throw new Error(Te.error||"Workspace run failed")}if(!Q.body)throw new Error("Workspace run stream unavailable");const te=Q.body.getReader(),re=new TextDecoder;let ae="",je=[];const Ee=Te=>{const mt=WS(Te||X,w);k.current=mt.instances,b(mt.instances),s(mt.nodes),c(mt.edges)};for(;;){const{value:Te,done:mt}=await te.read();if(mt)break;ae+=re.decode(Te,{stream:!0});const wr=ae.split(`
|
|
136
|
+
`);ae=wr.pop()||"";for(const fn of wr){if(!fn.trim())continue;const Mt=JSON.parse(fn);if(Mt.type==="error")throw new Error(Mt.error||"Workspace run failed");Mt.type==="node-start"&&He(`Running ${Mt.nodeId}...`),Mt.type==="graph"&&Mt.graph&&Ee(Mt.graph),Mt.type==="done"&&(Mt.graph&&Ee(Mt.graph),je=Array.isArray(Mt.order)?Mt.order:[])}}if(ae.trim()){const Te=JSON.parse(ae);if(Te.type==="error")throw new Error(Te.error||"Workspace run failed");Te.type==="graph"&&Te.graph&&Ee(Te.graph),Te.type==="done"&&(Te.graph&&Ee(Te.graph),je=Array.isArray(Te.order)?Te.order:[])}He(`Workspace run done: ${je.length?je.join(" -> "):B}`),await Jt()}catch(Q){He(String(Q.message||Q))}finally{on("")}},[ve,o,r,Jt,i,w,wn,En,Fe,c,s]);m.useEffect(()=>{xi().catch(B=>He(String(B.message||B))),fetch("/api/model-lists").then(B=>B.json()).then(B=>le({cursor:Array.isArray(B.cursor)?B.cursor.map(String):[],opencode:Array.isArray(B.opencode)?B.opencode.map(String):[],claudeCode:Array.isArray(B.claudeCode)?B.claudeCode.map(String):[]})).catch(()=>{}),fetch("/api/skills").then(B=>B.json()).then(B=>{const X=Array.isArray(B.skills)?B.skills.map(Q=>({key:String(Q.key),name:String(Q.name||Q.id||Q.key),description:Q.description?String(Q.description):"",sourceLabel:Q.sourceLabel?String(Q.sourceLabel):""})):[];me(X),Ve(!0)}).catch(()=>{}),fetch("/api/skill-collections").then(B=>B.json()).then(B=>{yn(io(B)),at(!0)}).catch(()=>{})},[xi,Ce]),m.useEffect(()=>{if(er(""),!(!Se||!Yt)){if(!Ce){ze([]);return}ze(pC(Ce,"workspace",de,ht)),er(Ce)}},[ht,Yt,de,Se,Ce]),m.useEffect(()=>{if(!(Yr!==Ce||!Ce))try{localStorage.setItem(Ce,JSON.stringify(Fe))}catch{}},[Fe,Ce,Yr]),m.useEffect(()=>{k.current=y},[y]),m.useEffect(()=>{u.current=i},[i]),m.useEffect(()=>{f.current=d},[d]),m.useEffect(()=>{if(!d)return;const B=Q=>{Q.key==="Escape"&&h(null)},X=Q=>{var te,re;(re=(te=Q.target)==null?void 0:te.closest)!=null&&re.call(te,".af-connect-node-menu")||h(null)};return document.addEventListener("keydown",B),document.addEventListener("pointerdown",X),()=>{document.removeEventListener("keydown",B),document.removeEventListener("pointerdown",X)}},[d]),m.useEffect(()=>{if(g.current)return v.current&&window.clearTimeout(v.current),v.current=window.setTimeout(()=>{En().catch(B=>He(String(B.message||B)))},650),()=>{v.current&&window.clearTimeout(v.current)}},[i,o,En]);const Ki=m.useCallback((B,X)=>{const Q=KV(X),te=re=>Array.isArray(re)?re.map(ae=>(ae==null?void 0:ae.name)!=="skillsContext"&&(ae==null?void 0:ae.type)!=="text"?ae:{...ae,default:Q,value:Q}):[];s(re=>re.map(ae=>{var je,Ee;return ae.id!==B?ae:{...ae,data:{...ae.data,body:Q,inputs:te((je=ae.data)==null?void 0:je.inputs),outputs:te((Ee=ae.data)==null?void 0:Ee.outputs)}}})),b(re=>{const ae=re[B]&&typeof re[B]=="object"?re[B]:{},je={...re,[B]:{...ae,body:Q,input:te(ae.input),output:te(ae.output)}};return k.current=je,je})},[s]),Gr=m.useMemo(()=>i.map(B=>({...B,data:{...B.data,modelLists:ce,showBodyPreview:!0,onRunWorkspaceNode:xs,runningRunNodeId:wn,skills:de,skillCollections:ht,onChangeLoadSkillKeys:Ki}})),[Ki,ce,i,xs,wn,ht,de]),Je=m.useMemo(()=>i.find(B=>B.id===V)||null,[i,V]);m.useEffect(()=>{var Q,te,re,ae,je;if(!Je){D(null),_("");return}const{inputs:B,outputs:X}=MP(Je);D({id:Je.id,newId:Je.id,label:String(((Q=Je.data)==null?void 0:Q.label)??Je.id),role:String(((te=Je.data)==null?void 0:te.role)??"normal"),model:String(((re=Je.data)==null?void 0:re.model)??""),body:String(((ae=Je.data)==null?void 0:ae.body)??""),script:String(((je=Je.data)==null?void 0:je.script)??""),inputs:B,outputs:X}),_("")},[Je==null?void 0:Je.id]);const Lr=m.useCallback((B=!1)=>{var Gi;if(!$||!Je)return!1;const X=Je.id,Q=String($.newId||"").trim(),te=B?Q:X;if(_(""),B){if(!UP.test(te))return _("Invalid instance id"),!1;if(i.some(vn=>vn.id===te&&vn.id!==X))return _("Duplicate instance id"),!1}const re=String($.role||"").trim(),ae=fo.includes(re)?re:"normal",je=String($.model||"").trim(),Ee=vn=>(Array.isArray(vn)?vn:[]).map(zt=>({type:String((zt==null?void 0:zt.type)??"node").trim()||"node",name:String((zt==null?void 0:zt.name)??""),default:String((zt==null?void 0:zt.default)??""),required:!!(zt!=null&&zt.required),showOnNode:(zt==null?void 0:zt.showOnNode)!==!1})),Te={...Je.data,label:String($.label||"").trim()||te,role:ae,model:je===""||je==="default"?void 0:je,body:String($.body??""),inputs:Ee($.inputs),outputs:Ee($.outputs)},mt=String($.script??"").trim();String(((Gi=Je.data)==null?void 0:Gi.definitionId)??te)==="tool_nodejs"||mt!==""?Te.script=String($.script??""):delete Te.script;const fn=Je.data||{};if(!(te!==X||fn.label!==Te.label||fn.role!==Te.role||fn.model!==Te.model||fn.body!==Te.body||(fn.script??void 0)!==(Te.script??void 0)||JSON.stringify(fn.inputs||[])!==JSON.stringify(Te.inputs||[])||JSON.stringify(fn.outputs||[])!==JSON.stringify(Te.outputs||[])))return!0;let la=i.map(vn=>vn.id===X?{...vn,id:te,selected:!0,data:Te}:vn),Kn=o;if(te!==X){const vn={...k.current},zt={...vn[X]||{}};delete vn[X],vn[te]=zt,k.current=vn,b(vn),Kn=o.map((vr,Xu)=>({...vr,source:vr.source===X?te:vr.source,target:vr.target===X?te:vr.target,id:`we-${vr.source===X?te:vr.source}-${vr.target===X?te:vr.target}-${Xu}`})),T(te)}return s(la),c(Kn),!0},[o,$,i,Je,c,s]);m.useEffect(()=>{if(!$||!Je)return;const B=window.setTimeout(()=>{Lr(!1)},350);return()=>window.clearTimeout(B)},[$==null?void 0:$.label,$==null?void 0:$.role,$==null?void 0:$.model,$==null?void 0:$.body,$==null?void 0:$.script,JSON.stringify(($==null?void 0:$.inputs)||[]),JSON.stringify(($==null?void 0:$.outputs)||[]),Lr,Je==null?void 0:Je.id]);const Xr=m.useMemo(()=>{const B=new Map(Gr.map(X=>[X.id,X]));return o.map(X=>{var mt,wr,fn,Mt;const Q=B.get(X.source),te=B.get(X.target),re=/^output-(\d+)$/.exec(X.sourceHandle||""),ae=/^input-(\d+)$/.exec(X.targetHandle||""),je=Q&&re?(wr=(mt=Q.data)==null?void 0:mt.outputs)==null?void 0:wr[parseInt(re[1],10)]:null,Ee=te&&ae?(Mt=(fn=te.data)==null?void 0:fn.inputs)==null?void 0:Mt[parseInt(ae[1],10)]:null,Te=je!=null&&je.type?hn(je.type):Ee!=null&&Ee.type?hn(Ee.type):"";return Te?{...X,style:{...X.style||{},stroke:Te,strokeWidth:2},markerEnd:{type:_r.ArrowClosed,color:Te}}:X})},[o,Gr]),wt=m.useMemo(()=>{const B=C.trim().toLowerCase(),X={DISPLAY:[],CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const Q of w)B&&![Q.id,Q.label,Q.displayName,Q.description].some(te=>String(te||"").toLowerCase().includes(B))||X[jc(Q)].push(Q);for(const Q of Na)X[Q].sort((te,re)=>te.id.localeCompare(re.id));return X},[w,C]),Ln=m.useMemo(()=>{const B=M.trim().toLowerCase();return w.filter(X=>!B||[X.id,X.label,X.displayName,X.description].some(Q=>String(Q||"").toLowerCase().includes(B))).sort((X,Q)=>{const te=Na.indexOf(jc(X)),re=Na.indexOf(jc(Q));return te!==re?te-re:Cc(X).localeCompare(Cc(Q))}).slice(0,30)},[w,M]);m.useEffect(()=>{A(0)},[M,P]),m.useEffect(()=>{if(!P)return;const B=window.setTimeout(()=>{var X;return(X=fe.current)==null?void 0:X.focus()},0);return()=>window.clearTimeout(B)},[P]);const q=m.useMemo(()=>{const B=F.trim().toLowerCase();return B?eI(I).filter(X=>X.path.toLowerCase().includes(B)):I},[F,I]),ye=[...(ce.cursor||[]).map(B=>({label:`Cursor · ${B.split(" - ")[0]}`,value:`cursor:${B.split(" - ")[0]}`})),...(ce.opencode||[]).map(B=>({label:`OpenCode · ${B.split(" - ")[0]}`,value:`opencode:${B.split(" - ")[0]}`})),...(ce.claudeCode||[]).map(B=>({label:`Claude · ${B.split(" - ")[0]}`,value:`claude-code:${B.split(" - ")[0]}`}))],Ne=m.useMemo(()=>new Set(Fe),[Fe]),$e=m.useMemo(()=>{const B=new Map(de.map(ae=>[ae.key,ae])),X=new Set,Q=new Set,te=ht.map(ae=>{const je=co(ae,de).map(Ee=>B.get(Ee)).filter(Boolean);for(const Ee of je)X.add(Ee.key),Q.add(String(Ee.name||Ee.id||Ee.key||"").trim());return{...ae,skills:je}}).filter(ae=>ae.skills.length>0),re=de.filter(ae=>{const je=String(ae.name||ae.id||ae.key||"").trim();return!X.has(ae.key)&&!Q.has(je)});return{groups:te,ungrouped:re}},[ht,de]),xt=m.useMemo(()=>{const B=i.filter(X=>X.selected);return B.length>0?B:V?i.filter(X=>X.id===V):[]},[i,V]),Wn=m.useMemo(()=>xt.map(B=>B.id),[xt]),_n=m.useCallback(B=>{s(X=>X.map(Q=>Q.id===B?{...Q,selected:!1}:Q)),T(X=>X===B?"":X)},[s]),tr=m.useCallback(()=>{const B=Gt.current;if(!B)return;const X=B.getBoundingClientRect(),Q=Math.min(420,Math.max(320,X.width+160)),te=12,re=Math.max(180,X.top-te*2),ae=Math.min(560,re);Ye({position:"fixed",left:Math.max(12,Math.min(window.innerWidth-Q-12,X.left)),top:Math.max(te,X.top-ae-te),width:Q,maxHeight:ae,zIndex:1e4})},[]);m.useEffect(()=>{if(!jn)return;tr();const B=Q=>{var re,ae;const te=Q.target;(re=Gt.current)!=null&&re.contains(te)||(ae=ne.current)!=null&&ae.contains(te)||xn(!1)},X=Q=>{Q.key==="Escape"&&xn(!1)};return window.addEventListener("pointerdown",B),window.addEventListener("keydown",X),window.addEventListener("resize",tr),window.addEventListener("scroll",tr,!0),()=>{window.removeEventListener("pointerdown",B),window.removeEventListener("keydown",X),window.removeEventListener("resize",tr),window.removeEventListener("scroll",tr,!0)}},[jn,tr]);const ws=m.useCallback(B=>{var Q,te;const X=new Map;for(const re of B||[])(re==null?void 0:re.type)==="dimensions"&&((Q=re.dimensions)!=null&&Q.width)&&((te=re.dimensions)!=null&&te.height)&&X.set(re.id,{width:Math.round(Number(re.dimensions.width)),height:Math.round(Number(re.dimensions.height))});s(re=>mw(B,re).map(ae=>{var Ee;const je=X.get(ae.id);return!je||!El((Ee=ae.data)==null?void 0:Ee.definitionId)?ae:{...ae,data:{...ae.data,displaySize:je}}}))},[s]),qi=m.useCallback(()=>{const B=document.querySelector(".af-workspace-canvas .react-flow");if(B){const X=B.getBoundingClientRect();return n.screenToFlowPosition({x:X.left+X.width*.48,y:X.top+X.height*.32})}return{x:360+i.length*36,y:180+i.length*28}},[i.length,n]),vs=m.useCallback(()=>{var B,X,Q;if(Je){const te=Number(((B=Je.measured)==null?void 0:B.width)||Je.width||260);return{x:Number(((X=Je.position)==null?void 0:X.x)||0)+te+140,y:Number(((Q=Je.position)==null?void 0:Q.y)||0)}}return qi()},[qi,Je]),Qt=m.useCallback((B,X={})=>{if(!B)return null;const Q=X.id||IV(B.id,i),te=fc(B.inputs),re=fc(B.outputs),ae={definitionId:B.id,label:X.label||Bw(B),role:"normal",body:X.body||"",input:X.inputs||te,output:X.outputs||re},je={id:Q,type:Vu,position:X.position||qi(),data:{label:ae.label,definitionId:B.id,schemaType:ZP(B.id,B),role:"normal",body:ae.body,inputs:ae.input,outputs:ae.output}},Ee={...wh(je,{...k.current,[Q]:ae},w),selected:!0};return s(Te=>[...Te.map(mt=>({...mt,selected:!1})),Ee]),T(Q),Q},[qi,i,w,s]),vo=m.useCallback(B=>VS(B,u.current),[]),bs=m.useCallback(B=>{if(!VS(B,u.current)){He("端口类型不匹配,已取消连线");return}h(null),c(X=>{const Q=X.filter(te=>!(te.target===B.target&&te.targetHandle===B.targetHandle));return gu({...B,markerEnd:{type:_r.ArrowClosed}},Q)})},[c]),bo=m.useCallback((B,X)=>{p.current=EV(X,u.current),h(null)},[]),Zt=m.useCallback((B,X)=>{var Mt,la,Kn,Gi;const Q=p.current;if(p.current=null,!Q||X!=null&&X.toNode)return;const te=_V(w,Q);if(te.length===0){He(`没有匹配 ${Q.slotType} 端口的节点`);return}const re=((la=(Mt=B==null?void 0:B.changedTouches)==null?void 0:Mt[0])==null?void 0:la.clientX)??(B==null?void 0:B.clientX),ae=((Gi=(Kn=B==null?void 0:B.changedTouches)==null?void 0:Kn[0])==null?void 0:Gi.clientY)??(B==null?void 0:B.clientY);if(!Number.isFinite(re)||!Number.isFinite(ae))return;const je=document.querySelector(".af-workspace-canvas .react-flow");if(!je)return;const Ee=je.getBoundingClientRect(),Te=320,mt=Math.min(440,104+te.length*58),wr=Math.max(12,Math.min(re-Ee.left,Ee.width-Te-12)),fn=Math.max(12,Math.min(ae-Ee.top,Ee.height-mt-12));h({left:wr,top:fn,flowPosition:n.screenToFlowPosition({x:re,y:ae}),draft:Q,candidates:te,query:""})},[w,n]),Yi=m.useCallback(B=>{const X=f.current;if(!X||!(B!=null&&B.def))return;const Q=Qt(B.def,{position:X.flowPosition});if(!Q)return;const te=X.draft.handleType==="source"?{source:X.draft.nodeId,sourceHandle:X.draft.handleId,target:Q,targetHandle:`input-${B.slotIndex}`}:{source:Q,sourceHandle:`output-${B.slotIndex}`,target:X.draft.nodeId,targetHandle:X.draft.handleId};c(re=>{const ae=re.filter(je=>!(je.target===te.target&&je.targetHandle===te.targetHandle));return gu({...te,markerEnd:{type:_r.ArrowClosed}},ae)}),h(null)},[Qt,c]),ko=m.useCallback(B=>{B&&(Qt(B,{position:vs()}),R(!1),U(""))},[Qt,vs]);m.useEffect(()=>{const B=X=>{X.defaultPrevented||X.metaKey||X.ctrlKey||X.altKey||CV(X.target)||(X.key==="a"||X.key==="A")&&(X.preventDefault(),R(!0))};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[]);const So=m.useCallback(B=>{ue(X=>{const Q=new Set(X);return Q.has(B)?Q.delete(B):Q.add(B),Q})},[]),yr=m.useCallback(B=>{const X=w.find(te=>te.id==="provide_file");if(!X)return;const Q=fc(X.outputs);Q[0]&&(Q[0]={...Q[0],default:B.path}),Qt(X,{label:B.name,outputs:Q})},[Qt,w]),aa=m.useCallback((B,X)=>{B.dataTransfer.effectAllowed="copy",B.dataTransfer.setData("application/x-agentflow-workspace-file",JSON.stringify({path:X.path,name:X.name,type:X.type})),B.dataTransfer.setData("text/plain",X.path)},[]),ks=m.useCallback((B,X)=>{B.dataTransfer.effectAllowed="move",B.dataTransfer.setData("application/agentflow-node",X.id),B.dataTransfer.setData("text/plain",X.id)},[]),wi=m.useCallback(async(B,X)=>{const Q=w.find(mt=>mt.id==="display_markdown");if(!Q){He("Markdown Display 节点不可用");return}const te=df(r);te.set("path",B.path);const re=await fetch(`/api/workspace/file?${te.toString()}`),ae=await re.json();if(!re.ok)throw new Error(ae.error||"读取文件失败");const je=String(ae.content||""),Ee=fc(Q.inputs).map(mt=>mt.name==="content"?{...mt,default:je}:mt),Te=fc(Q.outputs).map(mt=>mt.name==="content"?{...mt,default:je}:mt);Qt(Q,{label:B.name||"Markdown",body:je,inputs:Ee,outputs:Te,position:X}),He(`已创建 Markdown 展示:${B.path}`)},[Qt,r,w]),Ss=m.useCallback(B=>{const X=B.dataTransfer.getData("application/x-agentflow-workspace-file");if(X){B.preventDefault();let ae;try{ae=JSON.parse(X)}catch{return}if(!(ae!=null&&ae.path))return;const je=n.screenToFlowPosition({x:B.clientX,y:B.clientY});wi(ae,je).catch(Ee=>He(String(Ee.message||Ee)));return}const Q=B.dataTransfer.getData("application/agentflow-node");if(!Q)return;const te=w.find(ae=>ae.id===Q);if(!te)return;B.preventDefault();const re=n.screenToFlowPosition({x:B.clientX,y:B.clientY});Qt(te,{position:re})},[wi,Qt,w,n]),Ns=m.useCallback(B=>{const X=Array.from(B.dataTransfer.types||[]);!X.includes("application/x-agentflow-workspace-file")&&!X.includes("application/agentflow-node")||(B.preventDefault(),B.dataTransfer.dropEffect=X.includes("application/agentflow-node")?"move":"copy")},[]),ft=m.useCallback(async(B="")=>{const X=window.prompt("新文件名",B?`${B}/notes.md`:"notes.md");if(!X)return;const Q=B&&!X.includes("/")?`${B}/${X}`:X;try{const te=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,path:Q,content:""})}),re=await te.json();if(!te.ok)throw new Error(re.error||"创建文件失败");He(`已创建 ${re.path}`),await Jt()}catch(te){He(String(te.message||te))}},[r,Jt]),js=m.useCallback(async(B="")=>{const X=window.prompt("新文件夹名",B?`${B}/docs`:"docs");if(!X)return;const Q=B&&!X.includes("/")?`${B}/${X}`:X;try{const te=await fetch("/api/workspace/folder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,path:Q})}),re=await te.json();if(!te.ok)throw new Error(re.error||"创建文件夹失败");ue(ae=>{const je=new Set(ae);return B&&je.delete(B),je}),He(`已创建 ${re.path}`),await Jt()}catch(te){He(String(te.message||te))}},[r,Jt]),bt=m.useCallback(async B=>{if(!(!(B!=null&&B.path)||!window.confirm(`删除 ${B.path}?`)))try{const X=await fetch("/api/workspace/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,path:B.path})}),Q=await X.json();if(!X.ok)throw new Error(Q.error||"删除失败");He(`已删除 ${Q.path}`),await Jt()}catch(X){He(String(X.message||X))}},[r,Jt]),Cs=m.useCallback(async()=>{const B=Xt.trim();if(!B||yt)return;const X=sg(i,o,k.current);sn(""),Cn(!0),Ke(!0),st(Q=>[...Q,{role:"user",text:B,at:Date.now()}]);try{await En(i,o);const Q=await fetch("/api/workspace/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,prompt:B,outputKind:"markdown",workspaceGraph:X,allowFlowYaml:We,model:ve,selectedSkills:Fe,selectedNodeIds:Wn})}),te=await Q.json();if(!Q.ok)throw new Error(te.error||"生成失败");const re=String(te.content||"").trim();st(ae=>[...ae,{role:"assistant",text:re,at:Date.now()}]),await xi(),He("AI 生成完成")}catch(Q){const te=String(Q.message||Q);st(re=>[...re,{role:"assistant",text:te,error:!0,at:Date.now()}]),He(te)}finally{Cn(!1)}},[We,ve,yt,Xt,o,r,xi,i,En,Wn,Fe]);return a.jsxs("div",{className:"af-workspace-page",children:[a.jsxs("header",{className:"af-pipeline-top af-workspace-top",children:[a.jsxs("div",{className:"af-pipeline-top-left",children:[a.jsx("button",{type:"button",className:"af-icon-btn af-pipeline-back",onClick:()=>t("/projects"),"aria-label":"返回",children:a.jsx("span",{className:"material-symbols-outlined",children:"arrow_back"})}),a.jsxs("div",{className:"af-pipeline-brand",title:r.flowId?`${r.flowId} · ${Y}`:Y||"PROJECT",children:[a.jsx("span",{className:"af-pipeline-brand-name",children:"WORKSPACE"}),a.jsxs("span",{className:"af-pipeline-brand-ver",children:["V",kV,"-STABLE"]})]}),a.jsxs("div",{className:"af-view-switch","aria-label":"视图切换",children:[a.jsx("button",{type:"button",onClick:()=>{t(Qx({id:r.flowId,source:r.flowSource||"user",archived:!!r.archived},"pipeline"))},children:"Pipeline"}),a.jsx("button",{type:"button",className:"af-view-switch__active",children:"Workspace"})]})]}),a.jsxs("div",{className:"af-pipeline-top-right af-workspace-actions",children:[a.jsx("span",{className:"af-workspace-save-status",children:Be}),a.jsx("button",{type:"button",className:"af-composer-topbar-btn"+(Lt?" af-composer-topbar-btn--active":"")+(yt?" af-composer-topbar-btn--running":""),onClick:()=>Ke(B=>!B),children:"AI"}),a.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",onClick:()=>En().catch(B=>He(String(B.message||B))),children:"Save"})]})]}),a.jsxs("div",{className:"af-workspace-body"+(Lt||$?" af-workspace-body--drawer":""),children:[a.jsxs("aside",{className:"af-workspace-sidebar",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:()=>ft(""),"aria-label":"新增文件",title:"新增文件",children:a.jsx("span",{className:"material-symbols-outlined",children:"note_add"})}),a.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>js(""),"aria-label":"新增文件夹",title:"新增文件夹",children:a.jsx("span",{className:"material-symbols-outlined",children:"create_new_folder"})}),a.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>void Jt(),"aria-label":"刷新文件",title:"刷新文件",children:a.jsx("span",{className:"material-symbols-outlined",children:"refresh"})})]})]}),a.jsx("input",{className:"af-workspace-search",value:F,onChange:B=>Z(B.target.value),placeholder:"搜索文件..."}),a.jsx("div",{className:"af-workspace-files-scroll",children:a.jsx(tI,{items:q,onOpen:yr,collapsedDirs:oe,onToggleDir:So,onCreateFile:ft,onCreateFolder:js,onDelete:bt,onFileDragStart:aa})})]}),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:"Node 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:"搜索节点"}),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:C,onChange:B=>N(B.target.value),placeholder:"搜索节点...","aria-label":"搜索节点"})]})]}),a.jsxs("div",{className:"af-node-palette-scroll af-workspace-node-palette-scroll",children:[Na.map(B=>{var X;return(X=wt[B])!=null&&X.length?a.jsxs("section",{className:`af-palette-section af-flow-palette-section--${B}`,children:[a.jsx("h3",{className:"af-palette-cat",children:B}),a.jsx("div",{className:"af-palette-cards",children:wt[B].map(Q=>{const te=US(Q.inputs,"input"),re=US(Q.outputs,"output"),ae=Gy(Q),je=Cc(Q);return a.jsxs("button",{type:"button",className:"af-palette-card",draggable:!0,onDragStart:Ee=>ks(Ee,Q),onClick:()=>Qt(Q),title:ae||Q.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:BS(B)})}),a.jsxs("span",{className:"af-palette-card-main",children:[a.jsx("span",{className:"af-palette-card-label",children:je}),je!==Q.id?a.jsx("span",{className:"af-palette-card-id",children:Q.id}):null]})]}),ae?a.jsx("span",{className:"af-palette-card-desc",children:ae}):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:[te.list.length," IN"]}),a.jsxs("span",{className:"af-palette-card-port-list",children:[te.shown.map((Ee,Te)=>a.jsxs("span",{className:"af-palette-card-port",title:HS("input",Ee,Te),children:[a.jsx("span",{className:"af-palette-card-port-dot",style:{background:hn(Ee==null?void 0:Ee.type)}}),a.jsx("span",{className:"af-palette-card-port-name",children:ig(Ee,Te)})]},`in-${Te}`)),te.hidden>0?a.jsxs("span",{className:"af-palette-card-port-more",children:["+",te.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:[re.list.length," OUT"]}),a.jsxs("span",{className:"af-palette-card-port-list",children:[re.shown.map((Ee,Te)=>a.jsxs("span",{className:"af-palette-card-port",title:HS("output",Ee,Te),children:[a.jsx("span",{className:"af-palette-card-port-name",children:ig(Ee,Te)}),a.jsx("span",{className:"af-palette-card-port-dot",style:{background:hn(Ee==null?void 0:Ee.type)}})]},`out-${Te}`)),re.hidden>0?a.jsxs("span",{className:"af-palette-card-port-more",children:["+",re.hidden]}):null]})]})]})]},Q.id)})})]},B):null}),w.length>0&&C.trim()&&Na.every(B=>{var X;return!((X=wt[B])!=null&&X.length)})?a.jsx("p",{className:"af-palette-empty",children:"没有匹配的节点"}):null]})]})]}),a.jsxs("main",{className:"af-workspace-canvas",children:[a.jsx(r_,{className:"af-flow-canvas af-workspace-flow",nodes:Gr,edges:Xr,nodeTypes:UV,onNodesChange:ws,onEdgesChange:l,onConnect:bs,onConnectStart:bo,onConnectEnd:Zt,isValidConnection:vo,onNodeClick:(B,X)=>{Ke(!1),T(X.id)},onPaneClick:()=>T(""),onDrop:Ss,onDragOver:Ns,proOptions:{hideAttribution:!0},fitView:!1,minZoom:.1,maxZoom:4,children:a.jsx(a_,{color:"rgba(255,255,255,0.12)",gap:22,size:1})}),d?(()=>{var te;const B=String(d.query||"").trim().toLowerCase(),X=B?d.candidates.filter(re=>{var ae,je,Ee;return[(ae=re.def)==null?void 0:ae.id,re.displayLabel,re.description,(je=re.slot)==null?void 0:je.name,(Ee=re.slot)==null?void 0:Ee.type].filter(Boolean).some(Te=>String(Te).toLowerCase().includes(B))}):d.candidates,Q=d.draft.handleType==="source"?"IN":"OUT";return a.jsxs("div",{className:"af-connect-node-menu",style:{left:d.left,top:d.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:hn((te=d.draft.slot)==null?void 0:te.type)},"aria-hidden":!0}),a.jsxs("span",{children:["匹配 ",d.draft.slotType," 节点"]})]}),a.jsx("button",{type:"button",className:"af-connect-node-menu__close","aria-label":"关闭",onClick:()=>h(null),children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),a.jsxs("label",{className:"af-connect-node-menu__search",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),a.jsx("input",{type:"search",value:d.query,onChange:re=>h(ae=>ae&&{...ae,query:re.target.value}),placeholder:"搜索节点",autoFocus:!0})]}),a.jsxs("div",{className:"af-connect-node-menu__list",children:[X.map(re=>{var Ee,Te;const ae=re.displayLabel||((Ee=re.def)==null?void 0:Ee.id),je=ig(re.slot,re.slotIndex);return a.jsxs("button",{type:"button",className:"af-connect-node-menu__item",onClick:()=>Yi(re),title:re.description||re.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:ae}),ae!==re.def.id?a.jsx("span",{className:"af-connect-node-menu__item-id",children:re.def.id}):null]}),a.jsxs("span",{className:"af-connect-node-menu__port",children:[a.jsx("span",{children:Q}),a.jsx("span",{className:"af-connect-node-menu__port-dot",style:{background:hn((Te=re.slot)==null?void 0:Te.type)},"aria-hidden":!0}),a.jsx("span",{className:"af-connect-node-menu__port-name",children:je})]})]},`${re.def.id}-${re.slotIndex}`)}),X.length===0?a.jsx("div",{className:"af-connect-node-menu__empty",children:"没有匹配结果"}):null]})]})})():null,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("div",{className:"af-composer-selected","aria-label":"Selected workspace nodes",children:xt.length===0?a.jsx("span",{className:"af-composer-selected-empty",children:"选择画布节点后,可作为本次 Workspace AI 的上下文。"}):xt.map(B=>{var re,ae;const X=String(((re=B.data)==null?void 0:re.label)??B.id),Q=(ae=B.data)!=null&&ae.definitionId?String(B.data.definitionId):"",te=Q&&Q!==X?`${X} · ${B.id} · ${Q}`:`${X} · ${B.id}`;return a.jsxs("div",{className:"af-composer-node-chip",title:te,children:[a.jsx("span",{className:"af-composer-node-chip-kind",children:Q||"node"}),a.jsx("span",{className:"af-composer-node-chip-label",children:X}),a.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>_n(B.id),"aria-label":`取消选择 ${B.id}`,children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},B.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:Xt,rows:2,onChange:B=>sn(B.target.value),onKeyDown:B=>{(B.metaKey||B.ctrlKey)&&B.key==="Enter"&&(B.preventDefault(),Cs())},placeholder:"描述你想在 workspace 中生成、分析或展示的内容",autoComplete:"off",spellCheck:!1})}),a.jsxs("div",{className:"af-composer-toolbar",children:[a.jsx("label",{className:"af-composer-session-field",children:a.jsx("select",{className:"af-composer-session-select",value:"workspace",disabled:!0,"aria-label":"Workspace conversation",children:a.jsx("option",{value:"workspace",children:"Workspace"})})}),a.jsxs("div",{className:"af-composer-skills-field",children:[a.jsxs("button",{ref:Gt,type:"button",className:"af-composer-skills-button"+(Fe.length>0?" af-composer-skills-button--active":""),disabled:yt,"aria-haspopup":"listbox","aria-expanded":jn,onClick:()=>xn(B=>!B),children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"extension"}),a.jsx("span",{children:Fe.length>0?`Skills ${Fe.length}`:"Skills"})]}),jn&&!yt?Hr.createPortal(a.jsx("div",{ref:ne,className:"af-composer-skills-menu",role:"listbox","aria-label":"Skills",style:Le,children:de.length===0?a.jsx("div",{className:"af-composer-skills-empty",children:"No skills found"}):a.jsxs(a.Fragment,{children:[$e.groups.map(B=>{const X=co(B,de),Q=fC(B,Ne,de),te=Rt.has(B.id);return a.jsxs("div",{className:"af-composer-skill-group af-composer-skill-group--framed"+(te?" 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:Q==="all",disabled:X.length===0,onChange:re=>{const ae=re.target.checked;ze(je=>ae?uC(je,X):dC(je,X))}}),a.jsxs("span",{className:"af-composer-skill-group-title-main",children:[a.jsx("span",{children:B.name}),B.builtin?a.jsx("em",{children:"built-in"}):null,Q==="partial"?a.jsx("em",{children:"partial"}):null]})]}),a.jsxs("button",{type:"button",className:"af-composer-skill-group-toggle","aria-label":te?`展开 ${B.name}`:`收起 ${B.name}`,onClick:()=>{Zn(re=>{const ae=new Set(re);return ae.has(B.id)?ae.delete(B.id):ae.add(B.id),ae})},children:[a.jsx("span",{children:B.skills.length}),a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:te?"expand_more":"expand_less"})]})]}),te?null:a.jsx("div",{className:"af-composer-skill-group-items",children:B.skills.map(re=>a.jsxs("label",{className:"af-composer-skill-option",children:[a.jsx("input",{type:"checkbox",checked:Ne.has(re.key),onChange:ae=>{const je=ae.target.checked;ze(Ee=>je?Ee.includes(re.key)?Ee:[...Ee,re.key]:Ee.filter(Te=>Te!==re.key))}}),a.jsxs("span",{className:"af-composer-skill-option-main",children:[a.jsx("span",{className:"af-composer-skill-option-title",children:re.name}),re.description?a.jsx("span",{className:"af-composer-skill-option-desc",children:re.description}):null]})]},`${B.id}:${re.key}`))})]},B.id)}),$e.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:$e.ungrouped.length})]}),$e.ungrouped.map(B=>a.jsxs("label",{className:"af-composer-skill-option",children:[a.jsx("input",{type:"checkbox",checked:Ne.has(B.key),onChange:X=>{const Q=X.target.checked;ze(te=>Q?te.includes(B.key)?te:[...te,B.key]:te.filter(re=>re!==B.key))}}),a.jsxs("span",{className:"af-composer-skill-option-main",children:[a.jsx("span",{className:"af-composer-skill-option-title",children:B.name}),B.description?a.jsx("span",{className:"af-composer-skill-option-desc",children:B.description}):null]})]},`ungrouped:${B.key}`))]}):null]})}),document.body):null]}),a.jsxs("label",{className:"af-workspace-flowyaml-toggle",title:"Workspace 默认不修改正式 flow.yaml",children:[a.jsx("input",{type:"checkbox",checked:We,onChange:B=>Vt(B.target.checked)}),a.jsx("span",{children:"flow.yaml"})]}),a.jsx("label",{className:"af-composer-model-field",children:a.jsxs("select",{className:"af-composer-model-select",value:ve,onChange:B=>ie(B.target.value),"aria-label":"模型",children:[a.jsx("option",{value:"",children:"默认模型"}),ye.map(B=>a.jsx("option",{value:B.value,children:B.label},B.value))]})}),a.jsx("button",{type:"button",className:"af-composer-send"+(Xt.trim()&&!yt?" af-composer-send--active":"")+(yt?" af-composer-send--stop":""),disabled:yt||!Xt.trim(),"aria-label":yt?"Running":"Send",onClick:()=>void Cs(),children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:yt?"sync":"arrow_upward"})})]})]})]})})]}),Lt?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:()=>Ke(!1),"aria-label":"关闭 AI 对话侧栏",children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsx("div",{className:"af-composer-session-tabs",children:a.jsx("button",{type:"button",className:"af-composer-session-tab af-composer-session-tab--active",children:a.jsx("span",{className:"af-composer-session-label",children:"Workspace"})})}),a.jsx("div",{className:"af-composer-sidebar-status"+(yt?" af-composer-sidebar-status--running":""),role:"status","aria-live":"polite",children:yt?"Workspace agent running":xe.length>0?"Workspace conversation":"Ready"}),a.jsx("div",{className:"af-composer-sidebar-thread",children:a.jsx(VV,{messages:xe,running:yt})})]})}):$&&Je?a.jsx("aside",{className:"af-pipeline-drawer af-workspace-node-drawer","aria-label":"Workspace Node Properties",children:a.jsx(VP,{draft:$,setDraft:D,definitionId:String(((vi=Je.data)==null?void 0:vi.definitionId)||Je.id),systemPromptReadonly:String(((xr=Je.data)==null?void 0:xr.description)||""),modelLists:ce,disabled:!1,onIdBlur:()=>Lr(!0),onClose:()=>T(""),error:K,ioSlots:{inputs:Array.isArray($==null?void 0:$.inputs)?$.inputs:[],outputs:Array.isArray($==null?void 0:$.outputs)?$.outputs:[]}})}):null,P?Hr.createPortal(a.jsx("div",{className:"af-workspace-quick-add-backdrop",onMouseDown:()=>R(!1),children:a.jsxs("div",{className:"af-workspace-quick-add",role:"dialog","aria-modal":"true","aria-label":"Add workspace node",onMouseDown:B=>B.stopPropagation(),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:fe,value:M,onChange:B=>U(B.target.value),onKeyDown:B=>{B.key==="Escape"?(B.preventDefault(),R(!1)):B.key==="ArrowDown"?(B.preventDefault(),A(X=>Math.min(Ln.length-1,X+1))):B.key==="ArrowUp"?(B.preventDefault(),A(X=>Math.max(0,X-1))):B.key==="Enter"&&(B.preventDefault(),ko(Ln[L]||Ln[0]))},placeholder:"搜索节点...","aria-label":"搜索节点"})]}),a.jsx("div",{className:"af-workspace-quick-add__list",children:Ln.length===0?a.jsx("div",{className:"af-workspace-quick-add__empty",children:"没有匹配的节点"}):Ln.map((B,X)=>{const Q=jc(B),te=Cc(B),re=Gy(B);return a.jsxs("button",{type:"button",className:"af-workspace-quick-add__item"+(X===L?" af-workspace-quick-add__item--active":""),onMouseEnter:()=>A(X),onClick:()=>ko(B),children:[a.jsx("span",{className:"af-workspace-quick-add__icon material-symbols-outlined","aria-hidden":!0,children:BS(Q)}),a.jsxs("span",{className:"af-workspace-quick-add__main",children:[a.jsx("span",{className:"af-workspace-quick-add__label",children:te}),a.jsx("span",{className:"af-workspace-quick-add__meta",children:B.id}),re?a.jsx("span",{className:"af-workspace-quick-add__desc",children:re}):null]}),a.jsx("span",{className:"af-workspace-quick-add__cat",children:Q})]},B.id)})})]})}),document.body):null]})]})}function GV(){return a.jsx(yw,{children:a.jsx(YV,{})})}const qe=e=>typeof e=="string",pc=()=>{let e,t;const n=new Promise((r,i)=>{e=r,t=i});return n.resolve=e,n.reject=t,n},YS=e=>e==null?"":""+e,XV=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},JV=/###/g,GS=e=>e&&e.indexOf("###")>-1?e.replace(JV,"."):e,XS=e=>!e||qe(e),Uc=(e,t,n)=>{const r=qe(t)?t.split("."):t;let i=0;for(;i<r.length-1;){if(XS(e))return{};const s=GS(r[i]);!e[s]&&n&&(e[s]=new n),Object.prototype.hasOwnProperty.call(e,s)?e=e[s]:e={},++i}return XS(e)?{}:{obj:e,k:GS(r[i])}},JS=(e,t,n)=>{const{obj:r,k:i}=Uc(e,t,Object);if(r!==void 0||t.length===1){r[i]=n;return}let s=t[t.length-1],o=t.slice(0,t.length-1),c=Uc(e,o,Object);for(;c.obj===void 0&&o.length;)s=`${o[o.length-1]}.${s}`,o=o.slice(0,o.length-1),c=Uc(e,o,Object),c&&c.obj&&typeof c.obj[`${c.k}.${s}`]<"u"&&(c.obj=void 0);c.obj[`${c.k}.${s}`]=n},QV=(e,t,n,r)=>{const{obj:i,k:s}=Uc(e,t,Object);i[s]=i[s]||[],i[s].push(n)},Ip=(e,t)=>{const{obj:n,k:r}=Uc(e,t);if(n)return n[r]},ZV=(e,t,n)=>{const r=Ip(e,n);return r!==void 0?r:Ip(t,n)},nI=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?qe(e[r])||e[r]instanceof String||qe(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):nI(e[r],t[r],n):e[r]=t[r]);return e},ba=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var eW={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const tW=e=>qe(e)?e.replace(/[&<>"'\/]/g,t=>eW[t]):e;class nW{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 rW=[" ",",","?","!",";"],iW=new nW(20),sW=(e,t,n)=>{t=t||"",n=n||"";const r=rW.filter(o=>t.indexOf(o)<0&&n.indexOf(o)<0);if(r.length===0)return!0;const i=iW.getRegExp(`(${r.map(o=>o==="?"?"\\?":o).join("|")})`);let s=!i.test(e);if(!s){const o=e.indexOf(n);o>0&&!i.test(e.substring(0,o))&&(s=!0)}return s},Xy=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return e[t];const r=t.split(n);let i=e;for(let s=0;s<r.length;){if(!i||typeof i!="object")return;let o,c="";for(let l=s;l<r.length;++l)if(l!==s&&(c+=n),c+=r[l],o=i[c],o!==void 0){if(["string","number","boolean"].indexOf(typeof o)>-1&&l<r.length-1)continue;s+=l-s+1;break}i=o}return i},Ap=e=>e&&e.replace("_","-"),oW={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 Tp{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||oW,this.options=n,this.debug=n.debug}log(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"log","",!0)}warn(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"warn","",!0)}error(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"error","")}deprecate(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"warn","WARNING DEPRECATED: ",!0)}forward(t,n,r,i){return i&&!this.debug?null:(qe(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new Tp(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new Tp(this.logger,t)}}var Oi=new Tp;class vh{constructor(){this.observers={}}on(t,n){return t.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const i=this.observers[r].get(n)||0;this.observers[r].set(n,i+1)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t].delete(n)}}emit(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];this.observers[t]&&Array.from(this.observers[t].entries()).forEach(o=>{let[c,l]=o;for(let u=0;u<l;u++)c(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(o=>{let[c,l]=o;for(let u=0;u<l;u++)c.apply(c,[t,...r])})}}class QS extends vh{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,o=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let c;t.indexOf(".")>-1?c=t.split("."):(c=[t,n],r&&(Array.isArray(r)?c.push(...r):qe(r)&&s?c.push(...r.split(s)):c.push(r)));const l=Ip(this.data,c);return!l&&!n&&!r&&t.indexOf(".")>-1&&(t=c[0],n=c[1],r=c.slice(2).join(".")),l||!o||!qe(r)?l:Xy(this.data&&this.data[t]&&this.data[t][n],r,s)}addResource(t,n,r,i){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const o=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let c=[t,n];r&&(c=c.concat(o?r.split(o):r)),t.indexOf(".")>-1&&(c=t.split("."),i=n,n=c[1]),this.addNamespaces(n),JS(this.data,c,i),s.silent||this.emit("added",t,n,r,i)}addResources(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const s in r)(qe(r[s])||Array.isArray(r[s]))&&this.addResource(t,n,s,r[s],{silent:!0});i.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,i,s){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},c=[t,n];t.indexOf(".")>-1&&(c=t.split("."),i=r,r=n,n=c[1]),this.addNamespaces(n);let l=Ip(this.data,c)||{};o.skipCopy||(r=JSON.parse(JSON.stringify(r))),i?nI(l,r,s):l={...l,...r},JS(this.data,c,l),o.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(t,n)}:this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(i=>n[i]&&Object.keys(n[i]).length>0)}toJSON(){return this.data}}var rI={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(s=>{this.processors[s]&&(t=this.processors[s].process(t,n,r,i))}),t}};const ZS={};class Rp extends vh{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),XV(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Oi.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(t==null)return!1;const r=this.resolve(t,n);return r&&r.res!==void 0}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let s=n.ns||this.options.defaultNS||[];const o=r&&t.indexOf(r)>-1,c=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!sW(t,r,i);if(o&&!c){const l=t.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:t,namespaces:qe(s)?[s]:s};const u=t.split(r);(r!==i||r===i&&this.options.ns.indexOf(u[0])>-1)&&(s=u.shift()),t=u.join(i)}return{key:t,namespaces:qe(s)?[s]:s}}translate(t,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const i=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,s=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:o,namespaces:c}=this.extractFromKey(t[t.length-1],n),l=c[c.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 i?{res:`${l}${S}${o}`,usedKey:o,exactUsedKey:o,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:`${l}${S}${o}`}return i?{res:o,usedKey:o,exactUsedKey:o,usedLng:u,usedNS:l,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,b=Object.prototype.toString.apply(d),k=["[object Number]","[object Function]","[object RegExp]"],g=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject,w=!qe(d)&&typeof d!="boolean"&&typeof d!="number";if(v&&d&&w&&k.indexOf(b)<0&&!(qe(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:c}):`key '${o} (${this.language})' returned an object instead of string.`;return i?(f.res=S,f.usedParams=this.getUsedParamsDetails(n),f):S}if(s){const S=Array.isArray(d),C=S?[]:{},N=S?y:h;for(const P in d)if(Object.prototype.hasOwnProperty.call(d,P)){const R=`${N}${s}${P}`;C[P]=this.translate(R,{...n,joinArrays:!1,ns:c}),C[P]===R&&(C[P]=d[P])}d=C}}else if(v&&qe(g)&&Array.isArray(d))d=d.join(g),d&&(d=this.extendTranslation(d,t,n,r));else{let S=!1,C=!1;const N=n.count!==void 0&&!qe(n.count),P=Rp.hasDefaultValue(n),R=N?this.pluralResolver.getSuffix(u,n.count,n):"",M=n.ordinal&&N?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",U=N&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),L=U&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${R}`]||n[`defaultValue${M}`]||n.defaultValue;!this.isValidLookup(d)&&P&&(S=!0,d=L),this.isValidLookup(d)||(C=!0,d=o);const V=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&C?void 0:d,T=P&&L!==d&&this.options.updateMissing;if(C||S||T){if(this.logger.log(T?"updateKey":"missingKey",u,l,o,T?L:d),s){const _=this.resolve(o,{...n,keySeparator:!1});_&&_.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let $=[];const D=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&D&&D[0])for(let _=0;_<D.length;_++)$.push(D[_]);else this.options.saveMissingTo==="all"?$=this.languageUtils.toResolveHierarchy(n.lng||this.language):$.push(n.lng||this.language);const K=(_,I,E)=>{const Y=P&&E!==d?E:V;this.options.missingKeyHandler?this.options.missingKeyHandler(_,l,I,Y,T,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(_,l,I,Y,T,n),this.emit("missingKey",_,l,I,d)};this.options.saveMissing&&(this.options.saveMissingPlurals&&N?$.forEach(_=>{const I=this.pluralResolver.getSuffixes(_,n);U&&n[`defaultValue${this.options.pluralSeparator}zero`]&&I.indexOf(`${this.options.pluralSeparator}zero`)<0&&I.push(`${this.options.pluralSeparator}zero`),I.forEach(E=>{K([_],o+E,n[`defaultValue${E}`]||L)})}):K($,o,L))}d=this.extendTranslation(d,t,n,f,r),C&&d===o&&this.options.appendNamespaceToMissingKey&&(d=`${l}:${o}`),(C||S)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?d=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${o}`:o,S?d:void 0):d=this.options.parseMissingKeyHandler(d))}return i?(f.res=d,f.usedParams=this.getUsedParamsDetails(n),f):d}extendTranslation(t,n,r,i,s){var o=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const u=qe(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&&!qe(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(f={...this.options.interpolation.defaultVariables,...f}),t=this.interpolator.interpolate(t,f,r.lng||this.language||i.usedLng,r),u){const d=t.match(this.interpolator.nestingRegexp),h=d&&d.length;p<h&&(r.nest=!1)}!r.lng&&this.options.compatibilityAPI!=="v1"&&i&&i.res&&(r.lng=this.language||i.usedLng),r.nest!==!1&&(t=this.interpolator.nest(t,function(){for(var d=arguments.length,h=new Array(d),y=0;y<d;y++)h[y]=arguments[y];return s&&s[0]===h[0]&&!r.context?(o.logger.warn(`It seems you are nesting recursively key: ${h[0]} in key: ${n[0]}`),null):o.translate(...h,n)},r)),r.interpolation&&this.interpolator.reset()}const c=r.postProcess||this.options.postProcess,l=qe(c)?[c]:c;return t!=null&&l&&l.length&&r.applyPostProcessor!==!1&&(t=rI.handle(l,t,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r,i,s,o,c;return qe(t)&&(t=[t]),t.forEach(l=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(l,n),p=u.key;i=p;let f=u.namespaces;this.options.fallbackNS&&(f=f.concat(this.options.fallbackNS));const d=n.count!==void 0&&!qe(n.count),h=d&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),y=n.context!==void 0&&(qe(n.context)||typeof n.context=="number")&&n.context!=="",b=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);f.forEach(k=>{this.isValidLookup(r)||(c=k,!ZS[`${b[0]}-${k}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(c)&&(ZS[`${b[0]}-${k}`]=!0,this.logger.warn(`key "${i}" for languages "${b.join(", ")}" won't get resolved as namespace "${c}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),b.forEach(g=>{if(this.isValidLookup(r))return;o=g;const v=[p];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(v,p,g,k,n);else{let S;d&&(S=this.pluralResolver.getSuffix(g,n.count,n));const C=`${this.options.pluralSeparator}zero`,N=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(d&&(v.push(p+S),n.ordinal&&S.indexOf(N)===0&&v.push(p+S.replace(N,this.options.pluralSeparator)),h&&v.push(p+C)),y){const P=`${p}${this.options.contextSeparator}${n.context}`;v.push(P),d&&(v.push(P+S),n.ordinal&&S.indexOf(N)===0&&v.push(P+S.replace(N,this.options.pluralSeparator)),h&&v.push(P+C))}}let w;for(;w=v.pop();)this.isValidLookup(r)||(s=w,r=this.getResource(g,k,w,n))}))})}),{res:r,usedKey:i,exactUsedKey:s,usedLng:o,usedNS:c}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,r,i):this.resourceStore.getResource(t,n,r,i)}getUsedParamsDetails(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&!qe(t.replace);let i=r?t.replace:t;if(r&&typeof t.count<"u"&&(i.count=t.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!r){i={...i};for(const s of n)delete i[s]}return i}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,n.length)&&t[r]!==void 0)return!0;return!1}}const og=e=>e.charAt(0).toUpperCase()+e.slice(1);class eN{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Oi.create("languageUtils")}getScriptPartFromCode(t){if(t=Ap(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=Ap(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(qe(t)&&t.indexOf("-")>-1){if(typeof Intl<"u"&&typeof Intl.getCanonicalLocales<"u")try{let i=Intl.getCanonicalLocales(t)[0];if(i&&this.options.lowerCaseLng&&(i=i.toLowerCase()),i)return i}catch{}const n=["hans","hant","latn","cyrl","cans","mong","arab"];let r=t.split("-");return this.options.lowerCaseLng?r=r.map(i=>i.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=og(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]=og(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=og(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const i=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(i))&&(n=i)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const i=this.getLanguagePartFromCode(r);if(this.isSupportedCode(i))return n=i;n=this.options.supportedLngs.find(s=>{if(s===i)return s;if(!(s.indexOf("-")<0&&i.indexOf("-")<0)&&(s.indexOf("-")>0&&i.indexOf("-")<0&&s.substring(0,s.indexOf("-"))===i||s.indexOf(i)===0&&i.length>1))return s})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),qe(t)&&(t=[t]),Array.isArray(t))return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],t),i=[],s=o=>{o&&(this.isSupportedCode(o)?i.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return qe(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(t))):qe(t)&&s(this.formatLanguageCode(t)),r.forEach(o=>{i.indexOf(o)<0&&s(this.formatLanguageCode(o))}),i}}let aW=[{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}],lW={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 cW=["v1","v2","v3"],uW=["v4"],tN={zero:0,one:1,two:2,few:3,many:4,other:5},dW=()=>{const e={};return aW.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:lW[t.fc]}})}),e};class fW{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=Oi.create("pluralResolver"),(!this.options.compatibilityJSON||uW.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=dW(),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=Ap(t==="dev"?"en":t),i=n.ordinal?"ordinal":"cardinal",s=JSON.stringify({cleanedCode:r,type:i});if(s in this.pluralRulesCache)return this.pluralRulesCache[s];let o;try{o=new Intl.PluralRules(r,{type:i})}catch{if(!t.match(/-|_/))return;const l=this.languageUtils.getLanguagePartFromCode(t);o=this.getRule(l,n)}return this.pluralRulesCache[s]=o,o}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}needsPlural(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}getPluralFormsOfKey(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,r).map(i=>`${n}${i}`)}getSuffixes(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((i,s)=>tN[i]-tN[s]).map(i=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i}`):r.numbers.map(i=>this.getSuffix(t,i,n)):[]}getSuffix(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=this.getRule(t,r);return i?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i.select(n)}`:this.getSuffixRetroCompatible(i,n):(this.logger.warn(`no plural rule found for: ${t}`),"")}getSuffixRetroCompatible(t,n){const r=t.noAbs?t.plurals(n):t.plurals(Math.abs(n));let i=t.numbers[r];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(i===2?i="plural":i===1&&(i=""));const s=()=>this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString();return this.options.compatibilityJSON==="v1"?i===1?"":typeof i=="number"?`_plural_${i.toString()}`:s():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?s():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!cW.includes(this.options.compatibilityJSON)}}const nN=function(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=ZV(e,t,n);return!s&&i&&qe(n)&&(s=Xy(e,n,r),s===void 0&&(s=Xy(t,n,r))),s},ag=e=>e.replace(/\$/g,"$$$$");class pW{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Oi.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||(n=>n),this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const{escape:n,escapeValue:r,useRawValueToEscape:i,prefix:s,prefixEscaped:o,suffix:c,suffixEscaped:l,formatSeparator:u,unescapeSuffix:p,unescapePrefix:f,nestingPrefix:d,nestingPrefixEscaped:h,nestingSuffix:y,nestingSuffixEscaped:b,nestingOptionsSeparator:k,maxReplaces:g,alwaysFormat:v}=t.interpolation;this.escape=n!==void 0?n:tW,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=s?ba(s):o||"{{",this.suffix=c?ba(c):l||"}}",this.formatSeparator=u||",",this.unescapePrefix=p?"":f||"-",this.unescapeSuffix=this.unescapePrefix?"":p||"",this.nestingPrefix=d?ba(d):h||ba("$t("),this.nestingSuffix=y?ba(y):b||ba(")"),this.nestingOptionsSeparator=k||",",this.maxReplaces=g||1e3,this.alwaysFormat=v!==void 0?v:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,r)=>n&&n.source===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(t,n,r,i){let s,o,c;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=h=>{if(h.indexOf(this.formatSeparator)<0){const g=nN(n,l,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(g,void 0,r,{...i,...n,interpolationkey:h}):g}const y=h.split(this.formatSeparator),b=y.shift().trim(),k=y.join(this.formatSeparator).trim();return this.format(nN(n,l,b,this.options.keySeparator,this.options.ignoreJSONStructure),k,r,{...i,...n,interpolationkey:b})};this.resetRegExp();const p=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,f=i&&i.interpolation&&i.interpolation.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>ag(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?ag(this.escape(h)):ag(h)}].forEach(h=>{for(c=0;s=h.regex.exec(t);){const y=s[1].trim();if(o=u(y),o===void 0)if(typeof p=="function"){const k=p(t,s,i);o=qe(k)?k:""}else if(i&&Object.prototype.hasOwnProperty.call(i,y))o="";else if(f){o=s[0];continue}else this.logger.warn(`missed to pass in variable ${y} for interpolating ${t}`),o="";else!qe(o)&&!this.useRawValueToEscape&&(o=YS(o));const b=h.safeValue(o);if(t=t.replace(s[0],b),f?(h.regex.lastIndex+=o.length,h.regex.lastIndex-=s[0].length):h.regex.lastIndex=0,c++,c>=this.maxReplaces)break}}),t}nest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,s,o;const c=(l,u)=>{const p=this.nestingOptionsSeparator;if(l.indexOf(p)<0)return l;const f=l.split(new RegExp(`${p}[ ]*{`));let d=`{${f[1]}`;l=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(b){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,b),`${l}${p}${d}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,l};for(;i=this.nestingRegexp.exec(t);){let l=[];o={...r},o=o.replace&&!qe(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let u=!1;if(i[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(i[1])){const p=i[1].split(this.formatSeparator).map(f=>f.trim());i[1]=p.shift(),l=p,u=!0}if(s=n(c.call(this,i[1].trim(),o),o),s&&i[0]===t&&!qe(s))return s;qe(s)||(s=YS(s)),s||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${t}`),s=""),u&&(s=l.reduce((p,f)=>this.format(p,f,r.lng,{...r,interpolationkey:i[1].trim()}),s.trim())),t=t.replace(i[0],s),this.regexp.lastIndex=0}return t}}const hW=e=>{let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const i=r[1].substring(0,r[1].length-1);t==="currency"&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):t==="relativetime"&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach(o=>{if(o){const[c,...l]=o.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,""),p=c.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}},ka=e=>{const t={};return(n,r,i)=>{let s=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(s={...s,[i.interpolationkey]:void 0});const o=r+JSON.stringify(s);let c=t[o];return c||(c=e(Ap(r),i),t[o]=c),c(n)}};class mW{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Oi.create("formatter"),this.options=t,this.formats={number:ka((n,r)=>{const i=new Intl.NumberFormat(n,{...r});return s=>i.format(s)}),currency:ka((n,r)=>{const i=new Intl.NumberFormat(n,{...r,style:"currency"});return s=>i.format(s)}),datetime:ka((n,r)=>{const i=new Intl.DateTimeFormat(n,{...r});return s=>i.format(s)}),relativetime:ka((n,r)=>{const i=new Intl.RelativeTimeFormat(n,{...r});return s=>i.format(s,r.range||"day")}),list:ka((n,r)=>{const i=new Intl.ListFormat(n,{...r});return s=>i.format(s)})},this.init(t)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};this.formatSeparator=n.interpolation.formatSeparator||","}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=ka(n)}format(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=n.split(this.formatSeparator);if(s.length>1&&s[0].indexOf("(")>1&&s[0].indexOf(")")<0&&s.find(c=>c.indexOf(")")>-1)){const c=s.findIndex(l=>l.indexOf(")")>-1);s[0]=[s[0],...s.splice(1,c)].join(this.formatSeparator)}return s.reduce((c,l)=>{const{formatName:u,formatOptions:p}=hW(l);if(this.formats[u]){let f=c;try{const d=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},h=d.locale||d.lng||i.locale||i.lng||r;f=this.formats[u](c,h,{...p,...i,...d})}catch(d){this.logger.warn(d)}return f}else this.logger.warn(`there was no format function for ${u}`);return c},t)}}const gW=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class yW extends vh{constructor(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=t,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=i,this.logger=Oi.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,i.backend,i)}queueLoad(t,n,r,i){const s={},o={},c={},l={};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),s[d]===void 0&&(s[d]=!0),l[f]===void 0&&(l[f]=!0)))}),p||(c[u]=!0)}),(Object.keys(s).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(s),pending:Object.keys(o),toLoadLanguages:Object.keys(c),toLoadNamespaces:Object.keys(l)}}loaded(t,n,r){const i=t.split("|"),s=i[0],o=i[1];n&&this.emit("failedLoading",s,o,n),!n&&r&&this.store.addResourceBundle(s,o,r,void 0,void 0,{skipCopy:!0}),this.state[t]=n?-1:2,n&&r&&(this.state[t]=0);const c={};this.queue.forEach(l=>{QV(l.loaded,[s],o),gW(l,t),n&&l.errors.push(n),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{c[u]||(c[u]={});const p=l.loaded[u];p.length&&p.forEach(f=>{c[u][f]===void 0&&(c[u][f]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",c),this.queue=this.queue.filter(l=>!l.done)}read(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,o=arguments.length>5?arguments[5]:void 0;if(!t.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:i,wait:s,callback:o});return}this.readingCalls++;const c=(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&&i<this.maxRetries){setTimeout(()=>{this.read.call(this,t,n,r,i+1,s*2,o)},s);return}o(u,p)},l=this.backend[r].bind(this.backend);if(l.length===2){try{const u=l(t,n);u&&typeof u.then=="function"?u.then(p=>c(null,p)).catch(c):c(null,u)}catch(u){c(u)}return}return l(t,n,c)}prepareLoading(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();qe(t)&&(t=this.languageUtils.toResolveHierarchy(t)),qe(n)&&(n=[n]);const s=this.queueLoad(t,n,r,i);if(!s.toLoad.length)return s.pending.length||i(),null;s.toLoad.forEach(o=>{this.loadOne(o)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=t.split("|"),i=r[0],s=r[1];this.read(i,s,"read",void 0,void 0,(o,c)=>{o&&this.logger.warn(`${n}loading namespace ${s} for language ${i} failed`,o),!o&&c&&this.logger.log(`${n}loaded namespace ${s} for language ${i}`,c),this.loaded(t,o,c)})}saveMissing(t,n,r,i,s){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},c=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 l={...o,isUpdate:s},u=this.backend.create.bind(this.backend);if(u.length<6)try{let p;u.length===5?p=u(t,n,r,i,l):p=u(t,n,r,i),p&&typeof p.then=="function"?p.then(f=>c(null,f)).catch(c):c(null,p)}catch(p){c(p)}else u(t,n,r,i,c,l)}!t||!t[0]||this.store.addResource(t[0],n,r,i)}}}const rN=()=>({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]),qe(e[1])&&(t.defaultValue=e[1]),qe(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}}),iN=e=>(qe(e.ns)&&(e.ns=[e.ns]),qe(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),qe(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),ff=()=>{},xW=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class Nu extends vh{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=iN(t),this.services={},this.logger=Oi,this.modules={external:[]},xW(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&&(qe(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const i=rN();this.options={...i,...this.options,...iN(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...i.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);const s=p=>p?typeof p=="function"?new p:p:null;if(!this.options.isClone){this.modules.logger?Oi.init(s(this.modules.logger),this.options):Oi.init(null,this.options);let p;this.modules.formatter?p=this.modules.formatter:typeof Intl<"u"&&(p=mW);const f=new eN(this.options);this.store=new QS(this.options.resources,this.options);const d=this.services;d.logger=Oi,d.resourceStore=this.store,d.languageUtils=f,d.pluralResolver=new fW(f,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),p&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(d.formatter=s(p),d.formatter.init(d,this.options),this.options.interpolation.format=d.formatter.format.bind(d.formatter)),d.interpolator=new pW(this.options),d.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},d.backendConnector=new yW(s(this.modules.backend),d.resourceStore,d,this.options),d.backendConnector.on("*",function(h){for(var y=arguments.length,b=new Array(y>1?y-1:0),k=1;k<y;k++)b[k-1]=arguments[k];t.emit(h,...b)}),this.modules.languageDetector&&(d.languageDetector=s(this.modules.languageDetector),d.languageDetector.init&&d.languageDetector.init(d,this.options.detection,this.options)),this.modules.i18nFormat&&(d.i18nFormat=s(this.modules.i18nFormat),d.i18nFormat.init&&d.i18nFormat.init(this)),this.translator=new Rp(this.services,this.options),this.translator.on("*",function(h){for(var y=arguments.length,b=new Array(y>1?y-1:0),k=1;k<y;k++)b[k-1]=arguments[k];t.emit(h,...b)}),this.modules.external.forEach(h=>{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,r||(r=ff),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 l=pc(),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),l.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),l}loadResources(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ff;const i=qe(t)?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(i&&i.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const s=[],o=c=>{if(!c||c==="cimode")return;this.services.languageUtils.toResolveHierarchy(c).forEach(u=>{u!=="cimode"&&s.indexOf(u)<0&&s.push(u)})};i?o(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>o(l)),this.options.preload&&this.options.preload.forEach(c=>o(c)),this.services.backendConnector.load(s,this.options.ns,c=>{!c&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(c)})}else r(null)}reloadResources(t,n,r){const i=pc();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=ff),this.services.backendConnector.reload(t,n,s=>{i.resolve(),r(s)}),i}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&rI.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1))for(let n=0;n<this.languages.length;n++){const r=this.languages[n];if(!(["cimode","dev"].indexOf(r)>-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(t,n){var r=this;this.isLanguageChangingTo=t;const i=pc();this.emit("languageChanging",t);const s=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},o=(l,u)=>{u?(s(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,i.resolve(function(){return r.t(...arguments)}),n&&n(l,function(){return r.t(...arguments)})},c=l=>{!t&&!l&&this.services.languageDetector&&(l=[]);const u=qe(l)?l:this.services.languageUtils.getBestMatchFromCodes(l);u&&(this.language||s(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?c(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(c):this.services.languageDetector.detect(c):c(t),i}getFixedT(t,n,r){var i=this;const s=function(o,c){let l;if(typeof c!="object"){for(var u=arguments.length,p=new Array(u>2?u-2:0),f=2;f<u;f++)p[f-2]=arguments[f];l=i.options.overloadTranslationOptionHandler([o,c].concat(p))}else l={...c};l.lng=l.lng||s.lng,l.lngs=l.lngs||s.lngs,l.ns=l.ns||s.ns,l.keyPrefix!==""&&(l.keyPrefix=l.keyPrefix||r||s.keyPrefix);const d=i.options.keySeparator||".";let h;return l.keyPrefix&&Array.isArray(o)?h=o.map(y=>`${l.keyPrefix}${d}${y}`):h=l.keyPrefix?`${l.keyPrefix}${d}${o}`:o,i.t(h,l)};return qe(t)?s.lng=t:s.lngs=t,s.ns=n,s.keyPrefix=r,s}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,s=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const o=(c,l)=>{const u=this.services.backendConnector.state[`${c}|${l}`];return u===-1||u===0||u===2};if(n.precheck){const c=n.precheck(this,o);if(c!==void 0)return c}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(r,t)&&(!i||o(s,t)))}loadNamespaces(t,n){const r=pc();return this.options.ns?(qe(t)&&(t=[t]),t.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{r.resolve(),n&&n(i)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=pc();qe(t)&&(t=[t]);const i=this.options.preload||[],s=t.filter(o=>i.indexOf(o)<0&&this.services.languageUtils.isSupportedCode(o));return s.length?(this.options.preload=i.concat(s),this.loadResources(o=>{r.resolve(),n&&n(o)}),r):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!t)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services&&this.services.languageUtils||new eN(rN());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 Nu(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ff;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const i={...this.options,...t,isClone:!0},s=new Nu(i);return(t.debug!==void 0||t.prefix!==void 0)&&(s.logger=s.logger.clone(t)),["store","services","language"].forEach(c=>{s[c]=this[c]}),s.services={...this.services},s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},r&&(s.store=new QS(this.store.data,i),s.services.resourceStore=s.store),s.translator=new Rp(s.services,i),s.translator.on("*",function(c){for(var l=arguments.length,u=new Array(l>1?l-1:0),p=1;p<l;p++)u[p-1]=arguments[p];s.emit(c,...u)}),s.init(i,n),s.translator.options=i,s.translator.backendConnector.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},s}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Rn=Nu.createInstance();Rn.createInstance=Nu.createInstance;Rn.createInstance;Rn.dir;Rn.init;Rn.loadResources;Rn.reloadResources;Rn.use;Rn.changeLanguage;Rn.getFixedT;Rn.t;Rn.exists;Rn.setDefaultNamespace;Rn.hasLoadedNamespace;Rn.loadNamespaces;Rn.loadLanguages;function wW(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ju(e){"@babel/helpers - typeof";return ju=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},ju(e)}function vW(e,t){if(ju(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ju(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function bW(e){var t=vW(e,"string");return ju(t)=="symbol"?t:t+""}function kW(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,bW(r.key),r)}}function SW(e,t,n){return t&&kW(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var iI=[],NW=iI.forEach,jW=iI.slice;function CW(e){return NW.call(jW.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}var sN=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,EW=function(t,n,r){var i=r||{};i.path=i.path||"/";var s=encodeURIComponent(n),o="".concat(t,"=").concat(s);if(i.maxAge>0){var c=i.maxAge-0;if(Number.isNaN(c))throw new Error("maxAge should be a Number");o+="; Max-Age=".concat(Math.floor(c))}if(i.domain){if(!sN.test(i.domain))throw new TypeError("option domain is invalid");o+="; Domain=".concat(i.domain)}if(i.path){if(!sN.test(i.path))throw new TypeError("option path is invalid");o+="; Path=".concat(i.path)}if(i.expires){if(typeof i.expires.toUTCString!="function")throw new TypeError("option expires is invalid");o+="; Expires=".concat(i.expires.toUTCString())}if(i.httpOnly&&(o+="; HttpOnly"),i.secure&&(o+="; Secure"),i.sameSite){var l=typeof i.sameSite=="string"?i.sameSite.toLowerCase():i.sameSite;switch(l){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},oN={create:function(t,n,r,i){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(s.expires=new Date,s.expires.setTime(s.expires.getTime()+r*60*1e3)),i&&(s.domain=i),document.cookie=EW(t,encodeURIComponent(n),s)},read:function(t){for(var n="".concat(t,"="),r=document.cookie.split(";"),i=0;i<r.length;i++){for(var s=r[i];s.charAt(0)===" ";)s=s.substring(1,s.length);if(s.indexOf(n)===0)return s.substring(n.length,s.length)}return null},remove:function(t){this.create(t,"",-1)}},_W={name:"cookie",lookup:function(t){var n;if(t.lookupCookie&&typeof document<"u"){var r=oN.read(t.lookupCookie);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupCookie&&typeof document<"u"&&oN.create(n.lookupCookie,t,n.cookieMinutes,n.cookieDomain,n.cookieOptions)}},PW={name:"querystring",lookup:function(t){var n;if(typeof window<"u"){var r=window.location.search;!window.location.search&&window.location.hash&&window.location.hash.indexOf("?")>-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));for(var i=r.substring(1),s=i.split("&"),o=0;o<s.length;o++){var c=s[o].indexOf("=");if(c>0){var l=s[o].substring(0,c);l===t.lookupQuerystring&&(n=s[o].substring(c+1))}}}return n}},hc=null,aN=function(){if(hc!==null)return hc;try{hc=window!=="undefined"&&window.localStorage!==null;var t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{hc=!1}return hc},IW={name:"localStorage",lookup:function(t){var n;if(t.lookupLocalStorage&&aN()){var r=window.localStorage.getItem(t.lookupLocalStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupLocalStorage&&aN()&&window.localStorage.setItem(n.lookupLocalStorage,t)}},mc=null,lN=function(){if(mc!==null)return mc;try{mc=window!=="undefined"&&window.sessionStorage!==null;var t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{mc=!1}return mc},AW={name:"sessionStorage",lookup:function(t){var n;if(t.lookupSessionStorage&&lN()){var r=window.sessionStorage.getItem(t.lookupSessionStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupSessionStorage&&lN()&&window.sessionStorage.setItem(n.lookupSessionStorage,t)}},TW={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}},RW={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}},LW={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}},OW={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]}},sI=!1;try{document.cookie,sI=!0}catch{}var oI=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];sI||oI.splice(1,1);function MW(){return{order:oI,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(t){return t}}}var aI=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};wW(this,e),this.type="languageDetector",this.detectors={},this.init(t,n)}return SW(e,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n||{languageUtils:{}},this.options=CW(r,this.options||{},MW()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=function(s){return s.replace("-","_")}),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(_W),this.addDetector(PW),this.addDetector(IW),this.addDetector(AW),this.addDetector(TW),this.addDetector(RW),this.addDetector(LW),this.addDetector(OW)}},{key:"addDetector",value:function(n){return this.detectors[n.name]=n,this}},{key:"detect",value:function(n){var r=this;n||(n=this.options.order);var i=[];return n.forEach(function(s){if(r.detectors[s]){var o=r.detectors[s].lookup(r.options);o&&typeof o=="string"&&(o=[o]),o&&(i=i.concat(o))}}),i=i.map(function(s){return r.options.convertDetectedLanguage(s)}),this.services.languageUtils.getBestMatchFromCodes?i:i.length>0?i[0]:null}},{key:"cacheUserLanguage",value:function(n,r){var i=this;r||(r=this.options.caches),r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(n)>-1||r.forEach(function(s){i.detectors[s]&&i.detectors[s].cacheUserLanguage(n,i.options)}))}}])}();aI.type="languageDetector";const $W={name:"AgentFlow",tagline:"AI Workflow Orchestration"},DW={projects:"Projects",nodes:"Nodes",skills:"Skills",flowEditor:"Flow Editor",settings:"Settings",back:"Back"},FW={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"},zW={success:"Success",failed:"Failed",pending:"Pending",running:"Running",skipped:"Skipped"},BW={agent:"Agent",control:"Control",tool:"Tool",start:"Start",end:"End"},HW={online:"Engine Online",offline:"Engine Offline",connecting:"Connecting…"},UW={hub:"AgentFlow Hub",docs:"Documentation",github:"GitHub Repository"},VW={app:$W,nav:DW,common:FW,status:zW,nodeTypes:BW,engine:HW,links:UW},WW="Flow Editor",KW="Nodes",qW="Edges",YW="Properties",GW={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"},XW={title:"Node Properties",noInputPins:"No input pins",noOutputPins:"No output pins",type:"Type",name:"Name",defaultValue:"Default / value",required:"Req",showOnNode:"Card",requiredHint:"Mark this pin as required so users know it must be connected or given a value",showOnNodeHint:"Show this pin name on the canvas node card; hidden pins can still be connected",pinRequiredAriaLabel:"{{label}} {{index}} required",pinShowOnNodeAriaLabel:"{{label}} {{index}} show on node card",conversationOutput:"Conversation & Output",addPin:"Add Pin",addPinAriaLabel:"Add {{label}}",handleHint:"Matches Handle index on canvas ({{prefix}}-0, {{prefix}}-1…). After adding/removing/reordering, existing connections may break — check validation after saving.",handle:"Handle",pinTypeAriaLabel:"{{label}} {{index}} type",pinNameAriaLabel:"{{label}} {{index}} name",pinDefaultAriaLabel:"{{label}} {{index}} default",deletePinAriaLabel:"Delete {{label}} {{index}}",deletePin:"Delete this pin",instanceId:"Node ID",yamlValueNotInList:"(YAML value, not in current list)",inputPins:"Input Pins (INPUT)",outputPins:"Output Pins (OUTPUT)",expand:"Expand",collapse:"Collapse",expandEditScript:"Expand edit script",expandEdit:"Expand edit",editScript:"Edit script",editUserPrompt:"Edit user prompt",scriptPlaceholder:"instances.*.script — full shell command; supports ${workspaceRoot}, ${pipelineWorkspace}, ${flowDir}, ${runDir} and slot names (don't quote placeholders)",scriptPlaceholderExpand:"instances.*.script — full shell command; don't quote ${workspaceRoot}, ${pipelineWorkspace}, ${flowDir} placeholders",bodyPlaceholder:"instances.*.body — supports multiline and ${variables}; type ${ to pick a slot",bodyPlaceholderExpand:"instances.*.body — supports multiline and ${variables}",noDescription:"(No description in current node definition)",modelAriaLabel:"Model",placeholderSlots:"Placeholders: input/output slots",publishToMarketplace:"Publish Node",publishToMarketplaceHint:"Publish the current node to the workspace local marketplace",publishing:"Publishing…",publishRunning:"Publishing to local marketplace…",publishSuccess:"Node published to local marketplace",publishSuccessWithId:"Node published: {{id}}"},JW={run:"Run Flow",stop:"Stop",resume:"Resume",validate:"Validate",export:"Export",import:"Import"},QW={nodeList:"Node List",runHistory:"Run History",validation:"Validation Results"},ZW={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"},e7={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)"},t7={saving:"Saving...",saved:"Saved",saveFailed:"Save failed",runInTerminal:"Please use terminal to run"},n7={requirement:"Requirement Analysis",planning:"Technical Planning",code:"Code Execution",test:"Test Regression",normal:"Normal"},r7={phase:"Phase",allPhasesComplete:"All phases completed",currentPhaseComplete:"Current phase completed, waiting for confirmation..."},i7={node:"Node",text:"Text",file:"File",bool:"Boolean"},s7={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"},o7={title:"Keyboard Shortcuts",general:"General",saveDesc:"Save; when node properties sidebar is open, submit node first then save flow",shortcutsLabel:"Keyboard Shortcuts",jumpToNode:"Jump to node by ID",openNodePalette:"Open node palette",canvas:"Canvas",selectTool:"Select Tool",panTool:"Pan Tool",holdSpacePan:"Hold Space to temporarily pan",selectAll:"Select all nodes"},a7={title:"Jump to node",placeholder:"Type node ID or label…",empty:"No matching nodes",hintNavigate:"navigate",hintJump:"jump",hintClose:"close"},l7={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."},c7={mainNav:"Main Navigation"},u7={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'},d7={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):
|
|
137
|
+
{{summary}}`,step:"Step {{current}}/{{total}}: {{description}}",phaseGeneration:`Phased generation ({{count}} phases): {{labels}}
|
|
138
|
+
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}}"},f7={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"},p7={nodePalette:"Node Palette",noPipelineSelected:"No pipeline selected",moreRuns:"+{{count}} more",moreFlows:"+{{count}} more flows",runId:"Run ID: {{id}}"},h7={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}}"},m7={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"},g7={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"},y7={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"},x7={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"},w7={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"},v7={invalidPlaceholder:"Invalid placeholder: {{hint}}",empty:"(empty)",inputSubtitle:"Input · {{type}}",inputSubtitleNoType:"Input",outputSubtitle:"Output · {{type}}",outputSubtitleNoType:"Output",runtimeConst:"Runtime constant"},b7={justNow:"Just now",minutesAgo:"{{n}} min ago",hoursAgo:"{{n}} hr ago",yesterday:"Yesterday",daysAgo:"{{n}} days ago",milliseconds:"{{n}} ms",seconds:"{{n}} s"},k7={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"},S7={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."},N7={title:"Print Output: {{instanceId}}",expand:"Expand",restore:"Restore"},j7={save:"Save",cancel:"Cancel"},C7={title:"Run with Params",noParams:"No input params in this flow",run:"Run",cancel:"Cancel"},E7={title:"Run with Preset",noPresets:"No presets available",default:"Default run",run:"Run",cancel:"Cancel"},_7={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"},P7={title:WW,nodes:KW,edges:qW,properties:YW,node:GW,nodeProps:XW,actions:JW,panel:QW,palette:ZW,pipeline:e7,status:t7,roles:n7,phases:r7,types:i7,runContext:s7,shortcuts:o7,jumpPalette:a7,emptyCanvas:l7,sidebar:c7,validation:u7,composer:d7,topbar:f7,palette2:p7,run:h7,fileEdit:m7,settings:g7,schedule:y7,history:x7,nodePropsError:w7,placeholder:v7,time:b7,userCheck:k7,userAsk:S7,toolPrint:N7,provideEdit:j7,runParams:C7,runPreset:E7,runConfig:_7},I7="Settings",A7={engine:"Engine Settings",preferences:"Global Preferences"},T7={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)."},R7={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..."}},L7={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."},O7={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."},M7={title:"Environment Variables",note:"Private to the current signed-in user; overrides service-level env at runtime",saving:"Saving...",key:"Key",value:"Value",add:"Add",delete:"Delete {{key}}",invalidKey:"Env key must start with a letter or underscore, and only contain letters, numbers, and underscores.",newKey:"New env key",newValue:"Value (be careful with secrets)"},$7={title:"System Status",normal:"Service normal",abnormal:"Some interfaces abnormal",cursorModels:"Cursor Models",opencodeModels:"OpenCode Models",claudeCodeModels:"Claude Code Models"},D7={title:"Shortcuts",projects:"Projects & Pipelines",flowEditor:"Node Canvas"},F7={title:"Language",description:"Select your preferred language for the interface",options:{zh:"中文",en:"English",ja:"日本語"}},z7={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."},B7={title:I7,crumb:A7,workspace:T7,cursor:R7,opencode:L7,claudeCode:O7,env:M7,system:$7,shortcuts:D7,language:F7,onboarding:z7},H7={thinking:"Thinking",result:"Result",reply:"Reply",error:"Error"},U7={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)"},V7={send:"Send",stop:"Stop",expand:"Expand",collapse:"Collapse",clear:"Clear"},W7={conversation:"Chat",conversationWithNumber:"Chat {{num}}",default:"Default"},K7={endSession:"End chat (will stop generation)",closeSession:"Close chat",newSession:"New chat",expandComposer:"Expand chat and output"},q7={hint:"Use the bottom input box for AI chat, with @node mentions, model selection, and more"},Y7={aiLabels:H7,placeholders:U7,actions:V7,labels:W7,tooltips:K7,rightPanel:q7},G7="Projects",X7="All",J7="Archived",Q7="Nodes",Z7="Skills",eK="Active Projects",tK="Archived Pipelines",nK="Global Nodes",rK="Global Skills",iK="Create New Project",sK="New Pipeline",oK="SEARCH PIPELINES...",aK="SEARCH NODES...",lK="SEARCH SKILLS...",cK="Refresh Resources",uK="Loading pipelines...",dK="Loading global resources...",fK="Filter result: {{count}} items (matching title, description, path and tags)",pK="Archived pipelines can still be opened and edited; files are located in the _archived subdirectory of each pipelines directory.",hK="Manage your distributed node architectures and monitoring pipelines. Drag flow.yaml or .zip into this page to import shared flows.",mK="Review all globally available node definitions, {{count}} total, including built-in, workspace, and marketplace nodes.",gK="Review Composer-selectable skills, {{count}} total, including AgentFlow built-ins and workspace skills.",yK="Executable building blocks for pipeline runtime",xK="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.",wK="Operating guides for Composer and agents",vK="Skills tell AI which rules to follow for a task, how to change flows, and how to reuse project conventions.",bK="No archived projects.",kK="No active pipelines; archived items are in the Archived tab.",SK="No global nodes available.",NK="No skills available.",jK="No description.",CK='No node matches "{{query}}".',EK='No skill matches "{{query}}".',_K="{{inputs}} in / {{outputs}} out",PK="Skill",IK="Node detail",AK="Skill detail",TK="Type",RK="Source",LK="Package",OK="Version",MK="Path",$K="Editable",DK="Read only",FK="Editable",zK="Schema",BK="Inputs",HK="Outputs",UK="Runtime",VK="Node Body",WK="Files",KK="Usage",qK="No runtime manifest.",YK="No node body or README.",GK="No previewable files.",XK="Select a file to preview.",JK="Binary file preview is not supported.",QK="Large file; showing the first 256KB only.",ZK="No pipelines using this node were found.",eq="No slots",tq="Purpose",nq="This node is an execution unit in a pipeline. Its schema affects canvas wiring, parameter input, and runtime scheduling.",rq="This skill is injected into Composer as context for AI, constraining its decisions, edit strategy, and output format.",iq="SKILL.md Preview",sq="No preview content available.",oq="Select a resource to inspect details.",aq="Failed to load pipeline list.",lq="No pipelines in current workspace.",cq="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.",uq='No pipelines found matching "{{query}}". Try different keywords or clear the search.',dq="Recent Activity",fq="No recent activity",pq="No recent activity matching the keyword",hq="Recent Run",mq="Recent Open",gq={builtin:"Built-in",workspace:"Workspace",user:"User"},yq={flow:"Flow",global:"Global",marketplace:"Marketplace"},xq={all:"All",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},wq={overview:"Overview",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},vq="Open to edit this pipeline in the node canvas.",bq={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>"},kq={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"},Sq={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"},Nq={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"},jq={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"},Cq={title:G7,all:X7,archived:J7,nodes:Q7,skills:Z7,activeProjects:eK,archivedPipelines:tK,globalNodes:nK,globalSkills:rK,createNew:iK,newPipeline:sK,searchPipelines:oK,searchNodes:aK,searchSkills:lK,refreshResources:cK,loadingPipelines:uK,loadingResources:dK,filterResult:fK,archivedHint:pK,activeHint:hK,nodesHint:mK,skillsHint:gK,nodesPurposeTitle:yK,nodesPurposeDesc:xK,skillsPurposeTitle:wK,skillsPurposeDesc:vK,noArchived:bK,noActive:kK,noNodes:SK,noSkills:NK,noDescription:jK,noNodeMatch:CK,noSkillMatch:EK,nodeSlots:_K,skill:PK,nodeDetail:IK,skillDetail:AK,detailType:TK,detailSource:RK,detailPackage:LK,detailVersion:OK,detailPath:MK,detailEditable:$K,readOnly:DK,editable:FK,nodeSchema:zK,nodeInputs:BK,nodeOutputs:HK,nodeRuntime:UK,nodeBody:VK,nodeFiles:WK,nodeUsage:KK,noRuntimeManifest:qK,noNodeBody:YK,noNodeFiles:GK,selectNodeFile:XK,binaryFile:JK,fileTruncated:QK,noNodeUsage:ZK,noSlots:eq,resourceMeaning:tq,nodesMeaning:nq,skillsMeaning:rq,skillPreview:iq,skillPreviewEmpty:sq,selectResource:oq,loadFailed:aq,noPipelines:lq,emptyHint:cq,noMatch:uq,recentActivity:dq,noRecentActivity:fq,noMatchRecent:pq,recentRun:hq,recentOpen:mq,sourceBadge:gq,resourceSource:yq,resourceFilter:xq,nodeDetailTabs:wq,defaultCardDesc:vq,hubCard:bq,newPipelineModal:kq,importModal:Sq,deleteModal:Nq,archiveModal:jq},Eq="Back",_q="Next",Pq="Skip",Iq="Done",Aq="Start Creating",Tq={intro:`Welcome to AgentFlow! This is a visual workflow orchestration tool.
|
|
139
|
+
|
|
140
|
+
Click the button below to create your first pipeline.`,hubIntro:`Don't want to start from scratch?
|
|
141
|
+
|
|
142
|
+
Browse ready-made pipelines on AgentFlow Hub — community-shared flows you can install and run in one click.`},Rq={intro:`Now you're in the flow editor.
|
|
143
|
+
|
|
144
|
+
Describe your requirements in natural language in the input box below, and AI will generate the flow graph.
|
|
145
|
+
|
|
146
|
+
The left node panel allows you to freely drag, delete, and adjust connections.`,introEmpty:`The canvas is empty. Start creating your flow!
|
|
147
|
+
|
|
148
|
+
Describe your requirements in natural language in the input box below, and AI will generate the flow graph.
|
|
149
|
+
|
|
150
|
+
The left node panel allows you to freely drag, delete, and adjust connections.`},Lq={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"},Oq={back:Eq,next:_q,skip:Pq,done:Iq,startCreate:Aq,projects:Tq,flow:Rq,newPipeline:Lq},Mq={name:"AgentFlow",tagline:"AI 工作流编排"},$q={projects:"项目",nodes:"Nodes",skills:"Skills",flowEditor:"流程编辑器",settings:"设置",back:"返回"},Dq={loading:"加载中…",saving:"保存中…",save:"保存",cancel:"取消",delete:"删除",edit:"编辑",create:"创建",close:"关闭",confirm:"确认",copy:"复制",copied:"已复制!",refresh:"刷新",search:"搜索",filter:"筛选",success:"成功",error:"错误",warning:"警告",info:"信息",done:"完成",pending:"待处理",running:"运行中",notFound:"未找到",required:"必填",optional:"可选"},Fq={success:"成功",failed:"失败",pending:"等待",running:"运行中",skipped:"跳过"},zq={agent:"Agent 节点",control:"控制节点",tool:"工具节点",start:"开始",end:"结束"},Bq={online:"引擎在线",offline:"引擎离线",connecting:"连接中…"},Hq={hub:"AgentFlow Hub",docs:"文档",github:"GitHub 仓库"},Uq={app:Mq,nav:$q,common:Dq,status:Fq,nodeTypes:zq,engine:Bq,links:Hq},Vq="流程编辑器",Wq="节点",Kq="连线",qq="属性",Yq={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:"编辑内容"},Gq={title:"节点属性",noInputPins:"当前无输入引脚",noOutputPins:"当前无输出引脚",type:"类型",name:"名称",defaultValue:"默认值 / value",required:"必填",showOnNode:"卡片",requiredHint:"标记为必填,用于提示用户该槽位必须提供值或连线",showOnNodeHint:"是否在画布节点卡片旁展示这个引脚名称;关闭后仍可连线",pinRequiredAriaLabel:"{{label}} {{index}} 是否必填",pinShowOnNodeAriaLabel:"{{label}} {{index}} 是否在节点卡片展示",conversationOutput:"对话与输出",addPin:"添加引脚",addPinAriaLabel:"添加{{label}}",handleHint:"与画布上 Handle 序号一致({{prefix}}-0、{{prefix}}-1…)。增删或调整顺序后,原有连线可能失效,保存后请留意校验提示。",handle:"Handle",pinTypeAriaLabel:"{{label}} {{index}} 类型",pinNameAriaLabel:"{{label}} {{index}} 名称",pinDefaultAriaLabel:"{{label}} {{index}} 默认值",deletePinAriaLabel:"删除 {{label}} {{index}}",deletePin:"删除此引脚",instanceId:"节点 ID",yamlValueNotInList:"(YAML 中的值,不在当前列表)",inputPins:"输入引脚(INPUT)",outputPins:"输出引脚(OUTPUT)",expand:"展开",collapse:"收起",expandEditScript:"展开编辑 script",expandEdit:"展开编辑",editScript:"编辑 script",editUserPrompt:"编辑用户提示",scriptPlaceholder:"instances.*.script,完整 shell 命令;支持 ${workspaceRoot}、${pipelineWorkspace}、${flowDir}、${runDir} 与各槽位名(勿对占位符再包双引号)",scriptPlaceholderExpand:"instances.*.script,完整 shell 命令;勿对 ${workspaceRoot}、${pipelineWorkspace}、${flowDir} 等占位符再包双引号",bodyPlaceholder:"instances.*.body,支持多行与 ${变量};输入 ${ 选择槽位",bodyPlaceholderExpand:"instances.*.body,支持多行与 ${变量}",noDescription:"(当前节点定义无 description)",modelAriaLabel:"模型",placeholderSlots:"占位符:输入输出槽位",publishToMarketplace:"发布节点",publishToMarketplaceHint:"将当前节点发布到 Workspace 本地节点市场",publishing:"发布中…",publishRunning:"正在发布到本地节点市场…",publishSuccess:"节点已发布到本地节点市场",publishSuccessWithId:"节点已发布:{{id}}"},Xq={run:"运行流程",stop:"停止",resume:"继续",validate:"校验",export:"导出",import:"导入"},Jq={nodeList:"节点列表",runHistory:"运行历史",validation:"校验结果"},Qq={workspace:"工作区",loading:"加载中…",archived:"已归档",noPipelines:"暂无流水线",more:"更多",moreFlows:"更多流程",noRuns:"暂无运行记录",searchNodes:"搜索节点",noComponents:"暂无可用组件(检查节点库目录)",noMatch:"无匹配节点,请调整搜索词",selectPipeline:"从上方选择一条流水线以加载组件与画布",validationWarnings:"校验警告(与 agentflow validate 槽位检查一致)",output:"输出",model:"模型",userDir:"用户目录",toggleRecentActivity:"展开或收起最近打开或最近运行"},Zq={selectPipeline:"请从顶部下拉选择一条流水线",loadingProps:"加载节点属性…",pipelineId:"流水线 ID",diskPath:"磁盘路径",storageLocation:"存储位置",introduction:"介绍",introductionPlaceholder:"简要描述这条流水线的用途(写入 flow.yaml 的 ui.description)",metadata:"元数据",nodeCount:"节点数",nodesUnit:"个节点",loading:"加载中…",noRuns:"暂无运行记录(终端执行后会在工作区生成运行目录)"},eY={saving:"保存中…",saved:"已保存",saveFailed:"保存失败",runInTerminal:"运行请使用终端"},tY={requirement:"需求拆解",planning:"技术规划",code:"代码执行",test:"测试回归",normal:"普通"},nY={phase:"阶段",allPhasesComplete:"所有阶段完成",currentPhaseComplete:"当前阶段完成,等待确认继续…"},rY={node:"节点",text:"文本",file:"文件",bool:"布尔"},iY={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:"等待"},sY={title:"快捷键",general:"常规",saveDesc:"保存;节点属性侧栏打开时先提交节点再保存 flow",shortcutsLabel:"快捷键",jumpToNode:"按 ID 跳转到节点",openNodePalette:"打开节点面板",canvas:"画布",selectTool:"选择工具",panTool:"平移工具",holdSpacePan:"按住空格临时平移",selectAll:"全选所有节点"},oY={title:"跳转到节点",placeholder:"输入节点 ID 或名称…",empty:"未匹配到节点",hintNavigate:"切换",hintJump:"跳转",hintClose:"关闭"},aY={title:"开始构建你的流程",text:"在下方 AI 输入框中描述你的流程,或从左侧面板拖拽节点到画布",composerHint:"使用 AI Composer 构建 AgentFlow",composerSub:"从左侧拖入节点,或在<strong>下方输入框</strong>中用自然语言描述工作流。<br/>按 <kbd>?</kbd> 查看快捷键。"},lY={mainNav:"主导航"},cY={flowWarningAriaLabel:"流程校验警告",reloadFromServer:"从服务器重新加载流程并刷新校验",reloadFromServerShort:"从服务器重新加载",closeBanner:"关闭校验警告横幅",nodePrefix:"节点",focusNodeAriaLabel:"在画布中选中并定位节点 {{nodeId}}",slotWarningCount:"槽位校验 {{count}} 条(已隐藏)",show:"显示",shortcutHint:"按 ? 查看快捷键",shortcutHintLabel:"快捷键",inputSlotNoEdge:' 的 input 槽位 "{{slotName}}"({{handle}})无对应 edge 连接',outputSlotNoEdge:' 的 output 槽位 "{{slotName}}"({{handle}})无对应 edge 连接'},uY={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}} 步):
|
|
151
|
+
{{summary}}`,step:"步骤 {{current}}/{{total}}: {{description}}",phaseGeneration:`分阶段生成({{count}} 阶段):{{labels}}
|
|
152
|
+
当前:{{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}}"},dY={currentPipeline:"当前流水线",backToEdit:"返回编辑",backToProjects:"返回项目",executionLog:"执行日志",history:"历史",pipelineSettings:"流水线设置",shortcutsLabel:"快捷键",shortcutsTitle:"快捷键 (?)",deletePipeline:"删除流水线",resumeTitle:"在同一 run 目录继续执行(uuid={{uuid}})",resumeTitleNoUuid:"尚未收到 apply-start,将发起新的 run",rerunTitle:"从头开始新的运行",runOptions:"运行选项",runWithParams:"带参数运行",runWithPreset:"指定预设运行",editRun:"编辑运行参数",startRun:"开始执行",stopRun:"停止后台运行"},fY={nodePalette:"节点调色板",noPipelineSelected:"未选择流水线",moreRuns:"+{{count}} 更多",moreFlows:"+{{count}} 更多流程",runId:"运行 ID: {{id}}"},pY={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}} 的分支"},hY={close:"关闭",loading:"加载中…",placeholder:"文件内容",largeFileWarning:"文件较大,编辑器性能可能受影响",reset:"重置",aiEdit:"AI 修改",aiRunning:"AI 处理中…",save:"保存",saving:"保存中…",saved:"已保存"},mY={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:"已复制"},gY={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:"定时配置已保存"},yY={title:"执行历史",summary:"执行结果汇总",successCount:"{{count}} 成功",failedCount:"{{count}} 失败",stoppedCount:"{{count}} 已停止",interruptedCount:"{{count}} 已中断",runningCount:"{{count}} 进行中",success:"成功",failed:"失败",stopped:"已停止",interrupted:"已中断",running:"进行中",unknown:"未知",runLabel:"运行 #{{id}}",enterRunView:"进入该次运行的画布与日志态"},xY={invalidInstanceId:"实例 ID 格式无效:仅允许英文字母、数字、下划线、短横线,且不能以数字开头。",duplicateInstanceId:"该实例 ID 已存在,请换一个。",loadFlowFailed:"读取 flow 失败",loadNodesFailed:"读取节点库失败"},wY={invalidPlaceholder:"无效占位符: {{hint}}",empty:"(空)",inputSubtitle:"输入 · {{type}}",inputSubtitleNoType:"输入",outputSubtitle:"输出 · {{type}}",outputSubtitleNoType:"输出",runtimeConst:"运行时常量"},vY={justNow:"刚刚",minutesAgo:"{{n}} 分钟前",hoursAgo:"{{n}} 小时前",yesterday:"昨天",daysAgo:"{{n}} 天前",milliseconds:"{{n}} 毫秒",seconds:"{{n}} 秒"},bY={title:"用户确认 ({{instanceId}})",edit:"编辑",save:"保存",cancel:"取消",aiEditPlaceholder:"输入 AI 修改指令,如:删除第二项、合并前两项…",aiEditBtn:"AI 修改",aiEditStarted:"AI 正在修改内容…",aiEditDone:"AI 修改完成",aiEditFailed:"AI 修改失败",contentSaved:"内容已保存",saveFailed:"保存失败",close:"关闭",continue:"继续执行",hint:"编辑或使用 AI 修改后点击保存,然后点击「继续执行」恢复流程"},kY={title:"用户选择 ({{instanceId}})",hint:"请从下方选项中选择一项以继续流程",submitting:"提交中…",submitFailed:"提交失败",close:"关闭",noOptions:"该节点未配置选项,请先在编辑器中为 output 槽位添加条目。"},SY={title:"Print 输出: {{instanceId}}",expand:"放大",restore:"还原"},NY={save:"保存",cancel:"取消"},jY={title:"带参数运行",noParams:"此流程无输入参数",run:"运行",cancel:"取消"},CY={title:"指定预设运行",noPresets:"无可用预设",default:"默认运行",run:"运行",cancel:"取消"},EY={preset:"预设",default:"默认",newPreset:"新建预设",deletePreset:"删除预设",presetNamePlaceholder:"预设名称",inputParams:"输入参数",noProvideNodes:"此流程无 provide 节点",filePathPlaceholder:"文件路径…",stringValuePlaceholder:"值…",presetSaved:"预设已保存",presetDeleted:"预设已删除",savePreset:"保存当前预设",expandInput:"编辑内容"},_Y={title:Vq,nodes:Wq,edges:Kq,properties:qq,node:Yq,nodeProps:Gq,actions:Xq,panel:Jq,palette:Qq,pipeline:Zq,status:eY,roles:tY,phases:nY,types:rY,runContext:iY,shortcuts:sY,jumpPalette:oY,emptyCanvas:aY,sidebar:lY,validation:cY,composer:uY,topbar:dY,palette2:fY,run:pY,fileEdit:hY,settings:mY,schedule:gY,history:yY,nodePropsError:xY,placeholder:wY,time:vY,userCheck:bY,userAsk:kY,toolPrint:SY,provideEdit:NY,runParams:jY,runPreset:CY,runConfig:EY},PY="设置",IY={engine:"引擎设置",preferences:"全局首选项"},AY={title:"工作区",currentPath:"当前工作区根目录",placeholder:"加载中…",copyPath:"复制路径",description:"流水线与节点清单将相对于此目录解析(由启动 UI 时传入)。"},TY={title:"Cursor CLI",status:{cached:"已缓存",notCached:"未缓存"},modelPreviewLabel:"Cursor 模型名称列表",modelList:{cached:"模型清单已缓存",empty:"暂无模型列表",count:"{{count}} 条",fetchedAt:"更新 {{time}}",never:"尚未拉取",refresh:"刷新清单",fetching:"拉取中…"}},RY={modelPreviewLabel:"OpenCode 模型名称列表",title:"OpenCode CLI",status:{ready:"就绪",notFound:"未找到"},provider:"方案 / Provider 标识",providerPlaceholder:"例如 bailian-coding-plan",saving:"正在保存并更新清单…",description:"对应 CLI opencode models <provider> 的参数;停止输入后会写入用户目录 config 并刷新 model-lists.json。"},LY={title:"Claude Code CLI",status:{ready:"就绪",notFound:"未找到"},modelPreviewLabel:"Claude Code 模型名称列表",description:"内置模型列表(Claude Code CLI 无 models 子命令);刷新将探测 claude 二进制是否在 PATH 中。首次使用请先执行 claude /login。"},OY={title:"环境变量",note:"当前登录用户私有,运行时优先于服务全局环境变量",saving:"正在保存...",key:"键",value:"值",add:"添加",delete:"删除 {{key}}",invalidKey:"环境变量名必须以字母或下划线开头,且只能包含字母、数字和下划线。",newKey:"新环境变量键",newValue:"值(密钥请谨慎)"},MY={title:"系统状态",normal:"服务正常",abnormal:"部分接口异常",cursorModels:"Cursor 模型",opencodeModels:"OpenCode 模型",claudeCodeModels:"Claude Code 模型"},$Y={title:"快捷入口",projects:"项目与流水线",flowEditor:"节点画布"},DY={title:"语言",description:"选择界面显示语言",options:{zh:"中文",en:"English",ja:"日本語"}},FY={title:"新手引导",description:"重新启动产品引导流程,了解 AgentFlow 的核心功能。",reset:"重置引导",resetSuccess:"已重置,下次访问将自动启动引导"},zY={title:PY,crumb:IY,workspace:AY,cursor:TY,opencode:RY,claudeCode:LY,env:OY,system:MY,shortcuts:$Y,language:DY,onboarding:FY},BY={thinking:"思考",result:"结果",reply:"回复",error:"错误"},HY={input:"让 AI 协助编辑此节点…",waiting:"等待响应…",selectedEmpty:"在画布上选择节点,或在输入框用 @ 选择实例(Instances)或节点类型(Node)",textarea:"描述你的流程或让 AI 协助编辑(⌘/Ctrl+Enter 发送)"},UY={send:"发送",stop:"停止",expand:"展开",collapse:"收起",clear:"清空"},VY={conversation:"对话",conversationWithNumber:"对话 {{num}}",default:"默认"},WY={endSession:"结束对话(将停止生成)",closeSession:"关闭对话",newSession:"新建对话",expandComposer:"展开对话与输出"},KY={hint:"使用底部输入框进行 AI 对话,支持 @节点、选择模型等功能"},qY={aiLabels:BY,placeholders:HY,actions:UY,labels:VY,tooltips:WY,rightPanel:KY},YY="项目",GY="全部",XY="已归档",JY="Nodes",QY="Skills",ZY="活跃项目",eG="已归档流水线",tG="全局 Nodes",nG="全局 Skills",rG="创建新项目",iG="新建流水线",sG="搜索流水线…",oG="搜索 nodes…",aG="搜索 skills…",lG="刷新资源",cG="加载流水线列表…",uG="加载全局资源…",dG="筛选结果:{{count}} 条(匹配标题、描述、路径与标签)",fG="已归档的流水线仍可打开与编辑;文件位于各 pipelines 目录下的 _archived。",pG="管理分布式节点架构与监控流水线。可将 flow.yaml 或 .zip 拖入本页导入分享流程。",hG="查看当前可用的全局节点定义,共 {{count}} 个;包含内置、工作区与 marketplace 节点。",mG="查看当前 Composer 可选择的 skills,共 {{count}} 个;包含 AgentFlow 内置与工作区 skills。",gG="流程运行时的可执行积木",yG="Nodes 决定画布上能拖什么、节点有哪些输入输出,以及运行时走 agent、control、provide 或 marketplace 哪类逻辑。",xG="Composer/Agent 的操作指南",wG="Skills 告诉 AI 在特定任务里应遵守什么规则、如何修改 flow、如何复用项目约定。",vG="暂无归档项目。",bG="暂无未归档流水线;已归档项在 Archived 标签中查看。",kG="暂无可用全局 nodes。",SG="暂无可用 skills。",NG="暂无描述。",jG="未找到与「{{query}}」匹配的 node。",CG="未找到与「{{query}}」匹配的 skill。",EG="{{inputs}} in / {{outputs}} out",_G="Skill",PG="Node 详情",IG="Skill 详情",AG="类型",TG="来源",RG="包",LG="版本",OG="路径",MG="可编辑",$G="只读",DG="可编辑",FG="Schema",zG="输入",BG="输出",HG="Runtime",UG="节点内容",VG="Files",WG="Usage",KG="暂无 runtime manifest。",qG="暂无节点正文或 README。",YG="暂无可预览文件。",GG="请选择文件查看内容。",XG="二进制文件暂不支持预览。",JG="文件较大,仅显示前 256KB。",QG="暂未发现使用此 node 的流水线。",ZG="无槽位",eX="作用",tX="这个 node 是 pipeline 的执行单元。它的 schema 会影响画布连线、参数输入和运行时调度。",nX="这个 skill 会作为 Composer 的上下文注入给 AI,用于约束 AI 的判断、修改方式和输出口径。",rX="SKILL.md 预览",iX="暂无可预览内容。",sX="请选择一个资源查看详情。",oX="未能加载流水线列表。",aX="当前工作区暂无流水线。",lX="在仓库根目录执行 {{code1}} 并确认工作区包含 {{code2}} 或用户目录下的流水线;亦可点击 New Pipeline 新建。",cX="未找到与「{{query}}」匹配的流水线。可尝试其他关键词,或点击清除搜索。",uX="最近打开或最近运行",dX="暂无打开或运行记录",fX="暂无与关键词匹配的最近记录",pX="最近运行",hX="最近打开",mX={builtin:"内置",workspace:"工作区",user:"用户"},gX={flow:"Flow",global:"Global",marketplace:"Marketplace"},yX={all:"全部",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},xX={overview:"概览",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},wX="打开以在节点画布中编辑此流水线。",vX={eyebrow:"AgentFlow Hub",title:"浏览社区流程",desc:"发现并一键安装社区分享的现成流水线。",cta:"前往 Hub",cliHint:"或通过 CLI 安装:agentflow download <slug>"},bX={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:"关闭"},kX={title:"导入流水线",lead:"已选择文件「{{filename}}」。请确认流水线名称与保存位置;ZIP 将保留目录内脚本等文件。",nameLabel:"名称(必填)",namePlaceholder:"例如 my_shared_flow",nameHint:"须以英文字母开头,仅可使用字母、数字、下划线 _ 与连字符 -",locationLabel:"保存位置",userDir:"用户目录(~/agentflow/pipelines)",workspaceDir:"当前工作区(.workspace/agentflow/pipelines)",changeFile:"更换文件…",importFailed:"导入失败",importing:"导入中…",importAndOpen:"导入并打开",cancel:"取消",close:"关闭"},SX={title:"删除流水线",lead:"将永久删除磁盘上的流水线目录(含 flow.yaml、脚本等),无法撤销。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",deleteFailed:"删除失败",deleteTimeout:"删除请求超时,请重试(可先检查终端中的 UI 服务日志)",delete:"删除",deleting:"删除中…",confirmDelete:"确认删除",cancel:"取消",close:"关闭"},NX={title:"归档流水线",lead:"归档后流水线将移入「Archived」列表,仍可从该列表打开与编辑。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",archiveFailed:"归档失败",archive:"归档",archiving:"归档中…",confirmArchive:"确认归档",cancel:"取消",close:"关闭"},jX={title:YY,all:GY,archived:XY,nodes:JY,skills:QY,activeProjects:ZY,archivedPipelines:eG,globalNodes:tG,globalSkills:nG,createNew:rG,newPipeline:iG,searchPipelines:sG,searchNodes:oG,searchSkills:aG,refreshResources:lG,loadingPipelines:cG,loadingResources:uG,filterResult:dG,archivedHint:fG,activeHint:pG,nodesHint:hG,skillsHint:mG,nodesPurposeTitle:gG,nodesPurposeDesc:yG,skillsPurposeTitle:xG,skillsPurposeDesc:wG,noArchived:vG,noActive:bG,noNodes:kG,noSkills:SG,noDescription:NG,noNodeMatch:jG,noSkillMatch:CG,nodeSlots:EG,skill:_G,nodeDetail:PG,skillDetail:IG,detailType:AG,detailSource:TG,detailPackage:RG,detailVersion:LG,detailPath:OG,detailEditable:MG,readOnly:$G,editable:DG,nodeSchema:FG,nodeInputs:zG,nodeOutputs:BG,nodeRuntime:HG,nodeBody:UG,nodeFiles:VG,nodeUsage:WG,noRuntimeManifest:KG,noNodeBody:qG,noNodeFiles:YG,selectNodeFile:GG,binaryFile:XG,fileTruncated:JG,noNodeUsage:QG,noSlots:ZG,resourceMeaning:eX,nodesMeaning:tX,skillsMeaning:nX,skillPreview:rX,skillPreviewEmpty:iX,selectResource:sX,loadFailed:oX,noPipelines:aX,emptyHint:lX,noMatch:cX,recentActivity:uX,noRecentActivity:dX,noMatchRecent:fX,recentRun:pX,recentOpen:hX,sourceBadge:mX,resourceSource:gX,resourceFilter:yX,nodeDetailTabs:xX,defaultCardDesc:wX,hubCard:vX,newPipelineModal:bX,importModal:kX,deleteModal:SX,archiveModal:NX},CX="返回",EX="下一步",_X="跳过",PX="完成",IX="开始创建",AX={intro:`欢迎使用 AgentFlow!这是一个可视化流程编排工具。
|
|
153
|
+
|
|
154
|
+
点击下方按钮开始创建你的第一个流水线。`,hubIntro:`不想从零开始?
|
|
155
|
+
|
|
156
|
+
在 AgentFlow Hub 浏览社区分享的现成流水线,一键安装即可运行。`},TX={intro:`现在进入流程编辑器。
|
|
157
|
+
|
|
158
|
+
在下方输入框用自然语言描述你的需求,AI 会自动生成流程图。
|
|
159
|
+
|
|
160
|
+
左侧节点面板可以自由拖拽、删除和调整连接。`,introEmpty:`画布为空,开始创建你的流程吧!
|
|
161
|
+
|
|
162
|
+
在下方输入框用自然语言描述需求,AI 会自动生成流程图。
|
|
163
|
+
|
|
164
|
+
左侧节点面板可以自由拖拽、删除和调整连接。`},RX={guideTitle:"首次创建提示",guideDesc:"输入名称和描述后,AI 会自动生成流程图。你可以在编辑器中自由调整节点和连接。",nameHintGuide:"例如:MyFirstFlow(字母开头,支持数字和下划线)",descPlaceholderGuide:"例如:实现用户登录功能,包含注册、验证、授权",descHintGuide:"描述越详细,AI 生成的流程越准确",createGuide:"创建并开始编辑",typeNode:"节点引用类型",typeStr:"字符串类型",typeFile:"文件路径类型",typeBool:"布尔值类型"},LX={back:CX,next:EX,skip:_X,done:PX,startCreate:IX,projects:AX,flow:TX,newPipeline:RX},OX={en:{common:VW,flow:P7,settings:B7,composer:Y7,project:Cq,onboarding:Oq},zh:{common:Uq,flow:_Y,settings:zY,composer:qY,project:jX,onboarding:LX}};Rn.use(aI).use(ER).init({resources:OX,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 MX=[{code:"zh",name:"中文",flag:"🇨🇳"},{code:"en",name:"English",flag:"🇬🇧"}];function $X(e){return Rn.changeLanguage(e)}const Jy="agentflow-settings-opencode-plan-v1";function lg(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 lI(){return`e_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function DX(e){return/^[A-Za-z_][A-Za-z0-9_]*$/.test(String(e||"").trim())}function pf(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(!n||typeof n!="object")continue;const r=String(n.key??"").trim(),i=String(n.value??""),s=String(n.id??"").trim()||lI();!r&&!i||t.push({id:s,key:r,value:i})}return t}function cN(){try{return localStorage.getItem(Jy)??""}catch{return""}}function FX(e){return e?e.length<=6?"•".repeat(e.length):`${"•".repeat(Math.min(20,e.length-4))}${e.slice(-4)}`:""}function zX(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 BX(){const{t:e,i18n:t}=_t(["common","settings"]),n=t.language||"zh",[r,i]=m.useState(""),[s,o]=m.useState(""),[c,l]=m.useState({cursor:[],opencode:[],claudeCode:[],cursorFetchedAt:null,opencodeFetchedAt:null,claudeCodeFetchedAt:null}),[u,p]=m.useState(""),[f,d]=m.useState(!1),[h,y]=m.useState(!1),[b,k]=m.useState(""),[g,v]=m.useState([]),[w,S]=m.useState(""),[C,N]=m.useState(!1),[P,R]=m.useState(""),[M,U]=m.useState(""),[L,A]=m.useState(""),V=m.useRef(null),T=m.useRef(!1),$=m.useRef(!1),D=m.useRef(""),K=m.useCallback(async()=>{o("");try{const ie=await fetch("/api/ui-context");if(!ie.ok)throw new Error("HTTP "+ie.status);const de=await ie.json();i(typeof de.workspaceRoot=="string"?de.workspaceRoot:"")}catch(ie){o(String(ie.message||ie)),i("")}},[]),_=m.useCallback(async()=>{p(""),d(!0);try{const ie=await fetch("/api/model-lists");if(!ie.ok)throw new Error("HTTP "+ie.status);const de=await ie.json();l(lg(de))}catch(ie){p(String(ie.message||ie))}finally{d(!1)}},[]),I=m.useCallback(async()=>{S("");try{const ie=await fetch("/api/user-env"),de=await ie.json().catch(()=>({}));if(!ie.ok)throw new Error(typeof de.error=="string"?de.error:"HTTP "+ie.status);const me=pf(Array.isArray(de.env)?de.env:[]);D.current=JSON.stringify(me),v(me)}catch(ie){v([]),S(String(ie.message||ie))}finally{$.current=!0}},[]),E=m.useCallback(async ie=>{const de=pf(ie);N(!0),S("");try{const me=await fetch("/api/user-env",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:de})}),Se=await me.json().catch(()=>({}));if(!me.ok)throw new Error(typeof Se.error=="string"?Se.error:"HTTP "+me.status);const Ve=pf(Array.isArray(Se.env)?Se.env:[]);D.current=JSON.stringify(Ve),v(Ve)}catch(me){S(String(me.message||me))}finally{N(!1)}},[]),Y=m.useCallback(async()=>{p(""),d(!0);try{const ie=await fetch("/api/update-model-lists",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:L.trim()})}),de=await ie.json().catch(()=>({}));if(!ie.ok)throw new Error(typeof de.error=="string"?de.error:"HTTP "+ie.status);l(lg(de.modelLists))}catch(ie){p(String(ie.message||ie))}finally{d(!1)}},[L]);m.useEffect(()=>{K(),_(),I(),(async()=>{try{const ie=await fetch("/api/agentflow-config");if(ie.ok){const de=await ie.json(),me=typeof de.opencodeProvider=="string"?de.opencodeProvider:"";A(me),V.current=me;try{localStorage.setItem(Jy,me)}catch{}}else{const de=cN();A(de),V.current=de}}catch{const ie=cN();A(ie),V.current=ie}finally{T.current=!0}})()},[K,_,I]),m.useEffect(()=>{if(!$.current||JSON.stringify(pf(g))===D.current)return;const de=setTimeout(()=>{E(g)},350);return()=>clearTimeout(de)},[g,E]),m.useEffect(()=>{if(!T.current)return;const ie=L.trim();if(ie===V.current)return;const de=setTimeout(()=>{(async()=>{y(!0),k("");try{const me=await fetch("/api/agentflow-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:ie})}),Se=await me.json().catch(()=>({}));if(!me.ok)throw new Error(typeof Se.error=="string"?Se.error:"HTTP "+me.status);V.current=ie;try{localStorage.setItem(Jy,ie)}catch{}Se.modelLists&&l(lg(Se.modelLists))}catch(me){k(String(me.message||me))}finally{y(!1)}})()},450);return()=>clearTimeout(de)},[L]);const G=c.cursor.length>0,F=c.opencode.length>0,Z=c.claudeCode.length>0,oe=m.useCallback(()=>{var ie;r&&((ie=navigator.clipboard)==null||ie.writeText(r))},[r]),ue=m.useCallback(()=>{const ie=P.trim(),de=M;if(ie){if(!DX(ie)){S(e("settings:env.invalidKey"));return}v(me=>[...me,{id:lI(),key:ie,value:de}]),R(""),U("")}},[P,M,e]),ce=m.useCallback(ie=>{v(de=>de.filter(me=>me.id!==ie))},[]),le=m.useCallback(ie=>{const de=ie.target.value;$X(de)},[]),ve=ie=>{const de=zX(ie,n);return de?e("settings:cursor.modelList.fetchedAt",{time:de}):e("settings:cursor.modelList.never")};return a.jsxs("div",{className:"af-settings-page",children:[a.jsx("header",{className:"af-settings-top",children:a.jsxs("div",{className:"af-settings-crumb","aria-label":e("settings:title"),children:[a.jsx("span",{className:"af-settings-crumb-muted",children:e("settings:crumb.engine")}),a.jsx("span",{className:"af-settings-crumb-sep","aria-hidden":!0,children:"/"}),a.jsx("span",{className:"af-settings-crumb-active",children:e("settings:crumb.preferences")})]})}),a.jsx("div",{className:"af-settings-body",children:a.jsxs("div",{className:"af-settings-inner",children:[a.jsxs("header",{className:"af-settings-hero",children:[a.jsxs("h1",{className:"af-settings-h1",children:[e("common:app.name")," ",e("settings:title")]}),a.jsx("p",{className:"af-settings-lead",children:e("settings:workspace.description")}),s?a.jsx("p",{className:"af-err af-settings-api-hint",children:s}):null,u?a.jsx("p",{className:"af-err af-settings-api-hint",children:u}):null,w?a.jsx("p",{className:"af-err af-settings-api-hint",children:w}):null]}),a.jsxs("div",{className:"af-settings-layout",children:[a.jsxs("div",{className:"af-settings-bento",children:[a.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--low af-set-workspace",children:[a.jsxs("div",{className:"af-set-card-inner",children:[a.jsxs("div",{className:"af-set-card-head",children:[a.jsx("span",{className:"material-symbols-outlined af-set-icon af-set-icon--secondary",children:"folder_managed"}),a.jsx("h2",{className:"af-set-h2",children:e("settings:workspace.title")})]}),a.jsx("label",{className:"af-set-label",htmlFor:"af-workspace-path",children:e("settings:workspace.currentPath")}),a.jsxs("div",{className:"af-set-input-wrap",children:[a.jsx("input",{id:"af-workspace-path",className:"af-set-input af-set-input--mono",type:"text",readOnly:!0,value:r,placeholder:e("common:loading")}),a.jsx("button",{type:"button",className:"af-set-input-suffix",onClick:oe,"aria-label":e("settings:workspace.copyPath"),disabled:!r,children:a.jsx("span",{className:"material-symbols-outlined",children:"content_copy"})})]}),a.jsx("p",{className:"af-set-hint",children:e("settings:workspace.description")})]}),a.jsx("div",{className:"af-set-watermark","aria-hidden":!0,children:a.jsx("span",{className:"material-symbols-outlined",children:"account_tree"})})]}),a.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--high",children:[a.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[a.jsx("h2",{className:"af-set-h2 af-set-h2--caps",children:"Cursor CLI"}),a.jsx("span",{className:"af-set-badge"+(G?" af-set-badge--ok":" af-set-badge--muted"),children:e(G?"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:G?"check_circle":"hourglass_empty"})}),a.jsxs("div",{children:[a.jsx("p",{className:"af-set-cli-title",children:e(G?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),a.jsx("p",{className:"af-set-cli-mono",children:G?e("settings:cursor.modelList.count",{count:c.cursor.length})+" · "+ve(c.cursorFetchedAt):e("settings:cursor.modelList.refresh")})]})]}),G?a.jsx("pre",{className:"af-set-model-preview","aria-label":e("settings:cursor.modelPreviewLabel"),children:c.cursor.join(`
|
|
165
|
+
`)}):null,a.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>Y(),disabled:f,children:e(f?"settings:cursor.modelList.fetching":"settings:cursor.modelList.refresh")})]}),a.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--high",children:[a.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[a.jsx("h2",{className:"af-set-h2 af-set-h2--caps",children:"OpenCode"}),a.jsx("span",{className:"af-set-badge"+(F?" af-set-badge--ok":" af-set-badge--err"),children:e(F?"settings:opencode.status.ready":"settings:opencode.status.notFound")})]}),a.jsx("p",{className:"af-set-p",children:e("settings:opencode.description")}),a.jsxs("div",{children:[a.jsx("label",{className:"af-set-label-sm",htmlFor:"af-opencode-plan",children:e("settings:opencode.provider")}),a.jsx("input",{id:"af-opencode-plan",className:"af-set-input af-set-input--sm af-set-input--mono",type:"text",value:L,onChange:ie=>A(ie.target.value),placeholder:e("settings:opencode.providerPlaceholder"),autoComplete:"off"}),h?a.jsx("p",{className:"af-set-hint af-set-hint--inline","aria-live":"polite",children:e("settings:opencode.saving")}):null,b?a.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",role:"alert",children:b}):null]}),F?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"af-set-cli-mono af-set-cli-mono--block",children:e("settings:cursor.modelList.count",{count:c.opencode.length})+" · "+ve(c.opencodeFetchedAt)}),a.jsx("pre",{className:"af-set-model-preview","aria-label":e("settings:opencode.modelPreviewLabel"),children:c.opencode.join(`
|
|
166
|
+
`)})]}):null,a.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>Y(),disabled:f,children:e(f?"settings:cursor.modelList.fetching":"settings:cursor.modelList.refresh")})]}),a.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--high",children:[a.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[a.jsx("h2",{className:"af-set-h2 af-set-h2--caps",children:e("settings:claudeCode.title")}),a.jsx("span",{className:"af-set-badge"+(Z?" af-set-badge--ok":" af-set-badge--err"),children:e(Z?"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:Z?"check_circle":"hourglass_empty"})}),a.jsxs("div",{children:[a.jsx("p",{className:"af-set-cli-title",children:e(Z?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),a.jsx("p",{className:"af-set-cli-mono",children:Z?e("settings:cursor.modelList.count",{count:c.claudeCode.length})+" · "+ve(c.claudeCodeFetchedAt):e("settings:cursor.modelList.refresh")})]})]}),a.jsx("p",{className:"af-set-p",children:e("settings:claudeCode.description")}),Z?a.jsx("pre",{className:"af-set-model-preview","aria-label":e("settings:claudeCode.modelPreviewLabel"),children:c.claudeCode.join(`
|
|
167
|
+
`)}):null,a.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>Y(),disabled:f,children:e(f?"settings:cursor.modelList.fetching":"settings:cursor.modelList.refresh")})]}),a.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--low af-set-env",children:[a.jsxs("div",{className:"af-set-env-head",children:[a.jsxs("div",{className:"af-set-card-head",children:[a.jsx("div",{className:"af-set-env-icon-wrap",children:a.jsx("span",{className:"material-symbols-outlined af-set-icon--primary",children:"variables"})}),a.jsx("h2",{className:"af-set-h2",children:e("settings:env.title")})]}),a.jsx("span",{className:"af-set-env-note",children:e(C?"settings:env.saving":"settings:env.note")})]}),a.jsxs("div",{className:"af-set-env-rows",children:[g.map(ie=>a.jsxs("div",{className:"af-set-env-row",children:[a.jsxs("div",{className:"af-set-env-cell",children:[a.jsx("span",{className:"af-set-env-k",children:e("settings:env.key")}),a.jsx("code",{className:"af-set-code-key",children:ie.key||"—"})]}),a.jsxs("div",{className:"af-set-env-cell af-set-env-cell--grow",children:[a.jsx("span",{className:"af-set-env-k",children:e("settings:env.value")}),a.jsx("code",{className:"af-set-code-val",children:FX(ie.value)})]}),a.jsx("div",{className:"af-set-env-actions",children:a.jsx("button",{type:"button",className:"af-set-env-del","aria-label":e("settings:env.delete",{key:ie.key}),onClick:()=>ce(ie.id),children:a.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})})]},ie.id)),a.jsxs("div",{className:"af-set-env-row af-set-env-row--draft",children:[a.jsx("div",{className:"af-set-env-cell",children:a.jsx("input",{className:"af-set-input af-set-input--dashed af-set-input--mono",placeholder:"KEY_NAME",value:P,onChange:ie=>R(ie.target.value),"aria-label":e("settings:env.newKey")})}),a.jsx("div",{className:"af-set-env-cell af-set-env-cell--grow",children:a.jsx("input",{className:"af-set-input af-set-input--dashed af-set-input--mono",type:"password",placeholder:e("settings:env.newValue"),value:M,onChange:ie=>U(ie.target.value),"aria-label":e("settings:env.newValue")})}),a.jsx("div",{className:"af-set-env-actions",children:a.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:ue,disabled:!P.trim(),children:[a.jsx("span",{className:"material-symbols-outlined",children:"add"}),e("settings:env.add")]})})]})]})]})]}),a.jsxs("aside",{className:"af-settings-rail","aria-label":e("settings:title"),children:[a.jsxs("div",{className:"af-set-rail-card af-set-rail-card--accent",children:[a.jsxs("div",{className:"af-set-rail-inner",children:[a.jsx("h3",{className:"af-set-rail-h3",children:e("settings:system.title")}),a.jsxs("div",{className:"af-set-health-line",children:[a.jsx("span",{className:"af-set-pulse-dot","aria-hidden":!0}),a.jsx("span",{className:"af-set-health-label",children:e(!s&&!u?"settings:system.normal":"settings:system.abnormal")})]}),a.jsxs("div",{className:"af-set-meter",children:[a.jsxs("div",{className:"af-set-meter-row",children:[a.jsx("span",{children:e("settings:system.cursorModels")}),a.jsx("span",{children: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:e("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:e("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:e("settings:language.title")}),a.jsxs("div",{className:"af-set-language-selector",children:[a.jsx("select",{className:"af-set-input af-set-input--sm",value:n,onChange:le,"aria-label":e("settings:language.description"),children:MX.map(ie=>a.jsxs("option",{value:ie.code,children:[ie.flag," ",ie.name]},ie.code))}),a.jsx("p",{className:"af-set-hint",children:e("settings:language.description")})]})]})]})]})]})})]})}function cI(e){return t=>typeof t===e}var HX=cI("function"),UX=e=>e===null,uN=e=>Object.prototype.toString.call(e).slice(8,-1)==="RegExp",dN=e=>!VX(e)&&!UX(e)&&(HX(e)||typeof e=="object"),VX=cI("undefined");function WX(e,t,n){return QX(n,e,t)?!0:(ZX(n,e,t),e.constructor!==t.constructor?!1:Array.isArray(e)&&Array.isArray(t)?KX(e,t,n):e instanceof Map&&t instanceof Map?GX(e,t,n):e instanceof Set&&t instanceof Set?JX(e,t):e instanceof WeakMap||e instanceof WeakSet?!1:ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)?qX(e,t):uN(e)&&uN(t)?e.source===t.source&&e.flags===t.flags:e instanceof Error&&t instanceof Error?YX(e,t,n):e.valueOf!==Object.prototype.valueOf?e.valueOf()===t.valueOf():e.toString!==Object.prototype.toString?e.toString()===t.toString():XX(e,t,n))}function Wu(e,t,n){return e===t||Number.isNaN(e)&&Number.isNaN(t)?!0:!e||!dN(e)||!t||!dN(t)?!1:WX(e,t,n)}function KX(e,t,n){const{length:r}=e;if(r!==t.length)return!1;for(let i=r;i--!==0;)if(!Wu(e[i],t[i],n))return!1;return!0}function qX(e,t){if(e.byteLength!==t.byteLength)return!1;const n=new DataView(e.buffer),r=new DataView(t.buffer);let i=e.byteLength;for(;i--;)if(n.getUint8(i)!==r.getUint8(i))return!1;return!0}function YX(e,t,n){return e.message===t.message&&e.name===t.name&&Wu(e.cause,t.cause,n)}function GX(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(!Wu(r[1],t.get(r[0]),n))return!1;return!0}function XX(e,t,n){const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(let i=r.length;i--!==0;)if(!Object.prototype.hasOwnProperty.call(t,r[i]))return!1;for(let i=r.length;i--!==0;){const s=r[i];if(!(s==="_owner"&&e.$$typeof)&&!Wu(e[s],t[s],n))return!1}return!0}function JX(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 QX(e,t,n){var r;return((r=e.get(t))==null?void 0:r.has(n))??!1}function ZX(e,t,n){let r=e.get(t);r||(r=new WeakSet,e.set(t,r)),r.add(n)}function Hw(e,t){return Wu(e,t,new WeakMap)}function cg(){var e;return!!(typeof window<"u"&&((e=window==null?void 0:window.document)!=null&&e.createElement))}function eJ(e,...t){e&&e.removeEventListener&&e.removeEventListener(...t)}function tJ(e,...t){e&&e.addEventListener&&e.addEventListener(...t)}function nJ(){const e=m.useRef(!0);return e.current?(e.current=!1,!0):e.current}function rJ(e,t){const n=nJ();m.useEffect(()=>{if(!n)return e()},t)}function uI(e){const t=m.useRef(void 0);return m.useEffect(()=>{t.current=e}),t.current}function iJ(e,t){const n=m.useRef(t);return Hw(t,n.current)||(n.current=t),m.useMemo(e,n.current)}function sJ(e){m.useEffect(()=>{e()},[])}function oJ(e=0){const[t,n]=m.useState({height:cg()?window.innerHeight:0,width:cg()?window.innerWidth:0}),r=m.useRef(0),i=m.useRef(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(()=>{n({width:window.innerWidth,height:window.innerHeight})},e)});return m.useEffect(()=>{if(!cg())return()=>{};const s=i.current;return n({height:window.innerHeight,width:window.innerWidth}),tJ(window,"resize",s),()=>{eJ(window,"resize",s)}},[]),t}var aJ=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","URL","WeakMap","WeakSet"],lJ=["bigint","boolean","null","number","string","symbol","undefined"];function Ku(e){const t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(cJ(t))return t}function yi(e){return t=>Ku(t)===e}function cJ(e){return aJ.includes(e)}function _l(e){return t=>typeof t===e}function uJ(e){return lJ.includes(e)}var dJ=["innerHTML","ownerDocument","style","attributes","nodeValue"],qu=e=>Array.isArray(e),fJ=e=>Ku(e)==="AsyncGeneratorFunction",pJ=yi("AsyncFunction"),hJ=_l("bigint"),mJ=e=>e===!0||e===!1,gJ=yi("Date"),yJ=yi("Error"),po=_l("function"),xJ=yi("GeneratorFunction"),wJ=e=>typeof e=="number"&&Number.isInteger(e),Qy=yi("Map"),dI=e=>Number.isNaN(e),Uw=e=>e===null,fI=yi("Function"),vJ=yi("Promise"),bJ=yi("RegExp"),Zy=yi("Set"),Yu=_l("string"),kJ=_l("symbol"),Vw=_l("undefined"),SJ=yi("WeakMap"),NJ=yi("WeakSet"),Ww=e=>Uw(e)||Vw(e),pI=e=>!Vw(e),jJ=e=>_l("number")(e)&&!dI(e),CJ=e=>Yu(e)&&e.trim().length>0,EJ=e=>{if(!Yu(e)||e.length===0)return!1;const t=e.trim();return t.length>0&&Number.isFinite(Number(t))},bh=e=>!Ww(e)&&(po(e)||typeof e=="object"),hI=e=>{if(Ku(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})},_J=e=>Uw(e)||uJ(typeof e),PJ=e=>Ku(e)==="URL",mI=e=>!Ww(e)&&po(e[Symbol.iterator]),IJ=e=>mI(e)&&po(e.next)&&po(e.throw),AJ=e=>po(e)&&/^class\s/.test(e.toString()),TJ=(e,t)=>!qu(e)||!po(t)?!1:e.every(n=>t(n)),RJ=e=>bh(e)&&!hI(e)&&e.nodeType===1&&Yu(e.nodeName)&&dJ.every(t=>t in e),LJ=e=>Yu(e)&&e.length===0||qu(e)&&e.length===0||bh(e)&&!Qy(e)&&!Zy(e)&&Object.keys(e).length===0||Zy(e)&&e.size===0||Qy(e)&&e.size===0,OJ=(e,t)=>!e||!t?!1:Object.getPrototypeOf(e)===t.prototype,MJ=(e,t)=>qu(e)?e.indexOf(t)>-1:!1,$J=(e,t,n)=>{if(!bh(e)||!t)return!1;const r=e[t];return po(n)?n(r):pI(r)};function nt(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(qu(e))return"Array";if(fI(e))return"Function";const t=Ku(e);return t||"Object"}nt.array=qu;nt.arrayOf=TJ;nt.asyncGeneratorFunction=fJ;nt.asyncFunction=pJ;nt.bigint=hJ;nt.boolean=mJ;nt.class=AJ;nt.date=gJ;nt.defined=pI;nt.domElement=RJ;nt.empty=LJ;nt.error=yJ;nt.function=po;nt.generator=IJ;nt.generatorFunction=xJ;nt.instanceOf=OJ;nt.integer=wJ;nt.iterable=mI;nt.map=Qy;nt.nan=dI;nt.null=Uw;nt.nullOrUndefined=Ww;nt.nonEmptyString=CJ;nt.number=jJ;nt.numericString=EJ;nt.object=bh;nt.oneOf=MJ;nt.plainFunction=fI;nt.plainObject=hI;nt.primitive=_J;nt.promise=vJ;nt.propertyOf=$J;nt.regexp=bJ;nt.set=Zy;nt.string=Yu;nt.symbol=kJ;nt.undefined=Vw;nt.url=PJ;nt.weakMap=SJ;nt.weakSet=NJ;var Bn=nt;/* v8 ignore next -- @preserve */var DJ=function(e){return Object.prototype.hasOwnProperty.call(e,"props")},FJ=function(e,t){return e+Cu(t)},Cu=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(FJ,""):DJ(e)&&Object.prototype.hasOwnProperty.call(e.props,"children")?Cu(e.props.children):""};Cu.default=Cu;var zJ=Cu;const ug=mo(zJ);var gI={exports:{}};(function(e){const t=Object.getPrototypeOf({});function n(){return function(s){return typeof s=="object"&&s!==null&&!(s instanceof RegExp)&&!(s instanceof Date)}}function r(i){function s(C){return C!=="constructor"&&C!=="prototype"&&C!=="__proto__"}function o(C){let N=0;const P=C.length,R=new Array(P);for(N;N<P;++N)R[N]=g(C[N]);return R}function c(C){const N={};if(d&&Object.getPrototypeOf(C)!==t)return d(C);const P=f(C);let R,M,U;for(R=0,M=P.length;R<M;++R)s(U=P[R])&&(N[U]=g(C[U]));return N}function l(C,N){const P=C.length,R=N.length;let M=0;const U=new Array(P+R);for(M;M<P;++M)U[M]=g(C[M]);for(M=0;M<R;++M)U[M+P]=g(N[M]);return U}const u=Object.prototype.propertyIsEnumerable;function p(C){const N=Object.keys(C),P=Object.getOwnPropertySymbols(C);for(let R=0,M=P.length;R<M;++R)u.call(C,P[R])&&N.push(P[R]);return N}const f=i!=null&&i.symbols?p:Object.keys,d=typeof(i==null?void 0:i.cloneProtoObject)=="function"?i.cloneProtoObject:void 0,h=typeof(i==null?void 0:i.isMergeableObject)=="function"?i.isMergeableObject:n(),y=(i==null?void 0:i.onlyDefinedProperties)===!0;function b(C){return typeof C!="object"||C===null}const k=i&&typeof i.mergeArray=="function"?i.mergeArray({clone:g,deepmerge:w,getKeys:f,isMergeableObject:h}):l;function g(C){return h(C)?Array.isArray(C)?o(C):c(C):C}function v(C,N){const P={},R=f(C),M=f(N);let U,L,A;for(U=0,L=R.length;U<L;++U)s(A=R[U])&&M.indexOf(A)===-1&&(P[A]=g(C[A]));for(U=0,L=M.length;U<L;++U)if(s(A=M[U]))if(A in C)R.indexOf(A)!==-1&&(d&&h(N[A])&&Object.getPrototypeOf(N[A])!==t?P[A]=d(N[A]):P[A]=w(C[A],N[A]));else{if(y&&typeof N[A]>"u")continue;P[A]=g(N[A])}return P}function w(C,N){if(y&&typeof N>"u")return g(C);const P=Array.isArray(N),R=Array.isArray(C);return b(N)?N:h(C)?P&&R?k(C,N):P!==R?g(N):v(C,N):g(N)}function S(){switch(arguments.length){case 0:return{};case 1:return g(arguments[0]);case 2:return w(arguments[0],arguments[1])}let C;for(let N=0,P=arguments.length;N<P;++N)C=w(C,arguments[N]);return C}return i!=null&&i.all?S:w}e.exports=r,e.exports.default=r,e.exports.deepmerge=r,Object.defineProperty(e.exports,"isMergeableObject",{get:n})})(gI);var BJ=gI.exports;const HJ=mo(BJ);var UJ=new Error("Element already at target scroll position"),VJ=new Error("Scroll cancelled"),WJ=Math.min,fN=Date.now,KJ={left:pN("scrollLeft"),top:pN("scrollTop")};function pN(e){return function(n,r,i,s){i=i||{},typeof i=="function"&&(s=i,i={}),typeof s!="function"&&(s=YJ);var o=fN(),c=n[e],l=i.ease||qJ,u=isNaN(i.duration)?350:+i.duration,p=!1;return c===r?s(UJ,n[e]):requestAnimationFrame(d),f;function f(){p=!0}function d(h){if(p)return s(VJ,n[e]);var y=fN(),b=WJ(1,(y-o)/u),k=l(b);n[e]=k*(r-c)+c,b<1?requestAnimationFrame(d):requestAnimationFrame(function(){s(null,n[e])})}}}function qJ(e){return .5*(1-Math.cos(Math.PI*e))}function YJ(){}const GJ=mo(KJ);var yI={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.Scrollparent=n()})(Vc,function(){function t(r){var i=getComputedStyle(r,null).getPropertyValue("overflow");return i.indexOf("scroll")>-1||i.indexOf("auto")>-1}function n(r){if(r instanceof HTMLElement||r instanceof SVGElement){for(var i=r.parentNode;i.parentNode;){if(t(i))return i;i=i.parentNode}return document.scrollingElement||document.documentElement}}return n})})(yI);var XJ=yI.exports;const xI=mo(XJ),JJ=["top","right","bottom","left"],hN=["start","end"],mN=JJ.reduce((e,t)=>e.concat(t,t+"-"+hN[0],t+"-"+hN[1]),[]),vl=Math.min,Wo=Math.max,Lp=Math.round,hf=Math.floor,zi=e=>({x:e,y:e}),QJ={left:"right",right:"left",bottom:"top",top:"bottom"};function ex(e,t,n){return Wo(e,vl(t,n))}function Pl(e,t){return typeof e=="function"?e(t):e}function hs(e){return e.split("-")[0]}function Bi(e){return e.split("-")[1]}function wI(e){return e==="x"?"y":"x"}function Kw(e){return e==="y"?"height":"width"}function Gs(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function qw(e){return wI(Gs(e))}function vI(e,t,n){n===void 0&&(n=!1);const r=Bi(e),i=qw(e),s=Kw(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=Mp(o)),[o,Mp(o)]}function ZJ(e){const t=Mp(e);return[Op(e),t,Op(t)]}function Op(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const gN=["left","right"],yN=["right","left"],eQ=["top","bottom"],tQ=["bottom","top"];function nQ(e,t,n){switch(e){case"top":case"bottom":return n?t?yN:gN:t?gN:yN;case"left":case"right":return t?eQ:tQ;default:return[]}}function rQ(e,t,n,r){const i=Bi(e);let s=nQ(hs(e),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(Op)))),s}function Mp(e){const t=hs(e);return QJ[t]+e.slice(t.length)}function iQ(e){return{top:0,right:0,bottom:0,left:0,...e}}function bI(e){return typeof e!="number"?iQ(e):{top:e,right:e,bottom:e,left:e}}function $p(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function xN(e,t,n){let{reference:r,floating:i}=e;const s=Gs(t),o=qw(t),c=Kw(o),l=hs(t),u=s==="y",p=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,d=r[c]/2-i[c]/2;let h;switch(l){case"top":h={x:p,y:r.y-i.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-i.width,y:f};break;default:h={x:r.x,y:r.y}}switch(Bi(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 sQ(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:s,rects:o,elements:c,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:p="viewport",elementContext:f="floating",altBoundary:d=!1,padding:h=0}=Pl(t,e),y=bI(h),k=c[d?f==="floating"?"reference":"floating":f],g=$p(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(k)))==null||n?k:k.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:u,rootBoundary:p,strategy:l})),v=f==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),S=await(s.isElement==null?void 0:s.isElement(w))?await(s.getScale==null?void 0:s.getScale(w))||{x:1,y:1}:{x:1,y:1},C=$p(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:v,offsetParent:w,strategy:l}):v);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 oQ=50,aQ=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,c=o.detectOverflow?o:{...o,detectOverflow:sQ},l=await(o.isRTL==null?void 0:o.isRTL(t));let u=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:p,y:f}=xN(u,r,l),d=r,h=0;const y={};for(let b=0;b<s.length;b++){const k=s[b];if(!k)continue;const{name:g,fn:v}=k,{x:w,y:S,data:C,reset:N}=await v({x:p,y:f,initialPlacement:r,placement:d,strategy:i,middlewareData:y,rects:u,platform:c,elements:{reference:e,floating:t}});p=w??p,f=S??f,y[g]={...y[g],...C},N&&h<oQ&&(h++,typeof N=="object"&&(N.placement&&(d=N.placement),N.rects&&(u=N.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):N.rects),{x:p,y:f}=xN(u,d,l)),b=-1)}return{x:p,y:f,placement:d,strategy:i,middlewareData:y}},lQ=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:o,elements:c,middlewareData:l}=t,{element:u,padding:p=0}=Pl(e,t)||{};if(u==null)return{};const f=bI(p),d={x:n,y:r},h=qw(i),y=Kw(h),b=await o.getDimensions(u),k=h==="y",g=k?"top":"left",v=k?"bottom":"right",w=k?"clientHeight":"clientWidth",S=s.reference[y]+s.reference[h]-d[h]-s.floating[y],C=d[h]-s.reference[h],N=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let P=N?N[w]:0;(!P||!await(o.isElement==null?void 0:o.isElement(N)))&&(P=c.floating[w]||s.floating[y]);const R=S/2-C/2,M=P/2-b[y]/2-1,U=vl(f[g],M),L=vl(f[v],M),A=U,V=P-b[y]-L,T=P/2-b[y]/2+R,$=ex(A,T,V),D=!l.arrow&&Bi(i)!=null&&T!==$&&s.reference[y]/2-(T<A?U:L)-b[y]/2<0,K=D?T<A?T-A:T-V:0;return{[h]:d[h]+K,data:{[h]:$,centerOffset:T-$-K,...D&&{alignmentOffset:K}},reset:D}}});function cQ(e,t,n){return(e?[...n.filter(i=>Bi(i)===e),...n.filter(i=>Bi(i)!==e)]:n.filter(i=>hs(i)===i)).filter(i=>e?Bi(i)===e||(t?Op(i)!==i:!1):!0)}const uQ=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,r,i;const{rects:s,middlewareData:o,placement:c,platform:l,elements:u}=t,{crossAxis:p=!1,alignment:f,allowedPlacements:d=mN,autoAlignment:h=!0,...y}=Pl(e,t),b=f!==void 0||d===mN?cQ(f||null,h,d):d,k=await l.detectOverflow(t,y),g=((n=o.autoPlacement)==null?void 0:n.index)||0,v=b[g];if(v==null)return{};const w=vI(v,s,await(l.isRTL==null?void 0:l.isRTL(u.floating)));if(c!==v)return{reset:{placement:b[0]}};const S=[k[hs(v)],k[w[0]],k[w[1]]],C=[...((r=o.autoPlacement)==null?void 0:r.overflows)||[],{placement:v,overflows:S}],N=b[g+1];if(N)return{data:{index:g+1,overflows:C},reset:{placement:N}};const P=C.map(U=>{const L=Bi(U.placement);return[U.placement,L&&p?U.overflows.slice(0,2).reduce((A,V)=>A+V,0):U.overflows[0],U.overflows]}).sort((U,L)=>U[1]-L[1]),M=((i=P.filter(U=>U[2].slice(0,Bi(U[0])?2:3).every(L=>L<=0))[0])==null?void 0:i[0])||P[0][0];return M!==c?{data:{index:g+1,overflows:C},reset:{placement:M}}:{}}}},dQ=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:c,platform:l,elements:u}=t,{mainAxis:p=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:b=!0,...k}=Pl(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const g=hs(i),v=Gs(c),w=hs(c)===c,S=await(l.isRTL==null?void 0:l.isRTL(u.floating)),C=d||(w||!b?[Mp(c)]:ZJ(c)),N=y!=="none";!d&&N&&C.push(...rQ(c,b,y,S));const P=[c,...C],R=await l.detectOverflow(t,k),M=[];let U=((r=s.flip)==null?void 0:r.overflows)||[];if(p&&M.push(R[g]),f){const T=vI(i,o,S);M.push(R[T[0]],R[T[1]])}if(U=[...U,{placement:i,overflows:M}],!M.every(T=>T<=0)){var L,A;const T=(((L=s.flip)==null?void 0:L.index)||0)+1,$=P[T];if($&&(!(f==="alignment"?v!==Gs($):!1)||U.every(_=>Gs(_.placement)===v?_.overflows[0]>0:!0)))return{data:{index:T,overflows:U},reset:{placement:$}};let D=(A=U.filter(K=>K.overflows[0]<=0).sort((K,_)=>K.overflows[1]-_.overflows[1])[0])==null?void 0:A.placement;if(!D)switch(h){case"bestFit":{var V;const K=(V=U.filter(_=>{if(N){const I=Gs(_.placement);return I===v||I==="y"}return!0}).map(_=>[_.placement,_.overflows.filter(I=>I>0).reduce((I,E)=>I+E,0)]).sort((_,I)=>_[1]-I[1])[0])==null?void 0:V[0];K&&(D=K);break}case"initialPlacement":D=c;break}if(i!==D)return{reset:{placement:D}}}return{}}}},fQ=new Set(["left","top"]);async function pQ(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=hs(n),c=Bi(n),l=Gs(n)==="y",u=fQ.has(o)?-1:1,p=s&&l?-1:1,f=Pl(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 c&&typeof y=="number"&&(h=c==="end"?y*-1:y),l?{x:h*p,y:d*u}:{x:d*u,y:h*p}}const hQ=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:o,middlewareData:c}=t,l=await pQ(t,e);return o===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},mQ=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:s}=t,{mainAxis:o=!0,crossAxis:c=!1,limiter:l={fn:g=>{let{x:v,y:w}=g;return{x:v,y:w}}},...u}=Pl(e,t),p={x:n,y:r},f=await s.detectOverflow(t,u),d=Gs(hs(i)),h=wI(d);let y=p[h],b=p[d];if(o){const g=h==="y"?"top":"left",v=h==="y"?"bottom":"right",w=y+f[g],S=y-f[v];y=ex(w,y,S)}if(c){const g=d==="y"?"top":"left",v=d==="y"?"bottom":"right",w=b+f[g],S=b-f[v];b=ex(w,b,S)}const k=l.fn({...t,[h]:y,[d]:b});return{...k,data:{x:k.x-n,y:k.y-r,enabled:{[h]:o,[d]:c}}}}}};function kh(){return typeof window<"u"}function Il(e){return kI(e)?(e.nodeName||"").toLowerCase():"#document"}function Pr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Wi(e){var t;return(t=(kI(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function kI(e){return kh()?e instanceof Node||e instanceof Pr(e).Node:!1}function hi(e){return kh()?e instanceof Element||e instanceof Pr(e).Element:!1}function ys(e){return kh()?e instanceof HTMLElement||e instanceof Pr(e).HTMLElement:!1}function wN(e){return!kh()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Pr(e).ShadowRoot}function Gu(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=mi(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function gQ(e){return/^(table|td|th)$/.test(Il(e))}function Sh(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const yQ=/transform|translate|scale|rotate|perspective|filter/,xQ=/paint|layout|strict|content/,Ao=e=>!!e&&e!=="none";let dg;function Yw(e){const t=hi(e)?mi(e):e;return Ao(t.transform)||Ao(t.translate)||Ao(t.scale)||Ao(t.rotate)||Ao(t.perspective)||!Gw()&&(Ao(t.backdropFilter)||Ao(t.filter))||yQ.test(t.willChange||"")||xQ.test(t.contain||"")}function wQ(e){let t=ho(e);for(;ys(t)&&!bl(t);){if(Yw(t))return t;if(Sh(t))return null;t=ho(t)}return null}function Gw(){return dg==null&&(dg=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),dg}function bl(e){return/^(html|body|#document)$/.test(Il(e))}function mi(e){return Pr(e).getComputedStyle(e)}function Nh(e){return hi(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ho(e){if(Il(e)==="html")return e;const t=e.assignedSlot||e.parentNode||wN(e)&&e.host||Wi(e);return wN(t)?t.host:t}function SI(e){const t=ho(e);return bl(t)?e.ownerDocument?e.ownerDocument.body:e.body:ys(t)&&Gu(t)?t:SI(t)}function Eu(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=SI(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),o=Pr(i);if(s){const c=tx(o);return t.concat(o,o.visualViewport||[],Gu(i)?i:[],c&&n?Eu(c):[])}else return t.concat(i,Eu(i,[],n))}function tx(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function NI(e){const t=mi(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=ys(e),s=i?e.offsetWidth:n,o=i?e.offsetHeight:r,c=Lp(n)!==s||Lp(r)!==o;return c&&(n=s,r=o),{width:n,height:r,$:c}}function Xw(e){return hi(e)?e:e.contextElement}function el(e){const t=Xw(e);if(!ys(t))return zi(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=NI(t);let o=(s?Lp(n.width):n.width)/r,c=(s?Lp(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!c||!Number.isFinite(c))&&(c=1),{x:o,y:c}}const vQ=zi(0);function jI(e){const t=Pr(e);return!Gw()||!t.visualViewport?vQ:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function bQ(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Pr(e)?!1:t}function ta(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=Xw(e);let o=zi(1);t&&(r?hi(r)&&(o=el(r)):o=el(e));const c=bQ(s,n,r)?jI(s):zi(0);let l=(i.left+c.x)/o.x,u=(i.top+c.y)/o.y,p=i.width/o.x,f=i.height/o.y;if(s){const d=Pr(s),h=r&&hi(r)?Pr(r):r;let y=d,b=tx(y);for(;b&&r&&h!==y;){const k=el(b),g=b.getBoundingClientRect(),v=mi(b),w=g.left+(b.clientLeft+parseFloat(v.paddingLeft))*k.x,S=g.top+(b.clientTop+parseFloat(v.paddingTop))*k.y;l*=k.x,u*=k.y,p*=k.x,f*=k.y,l+=w,u+=S,y=Pr(b),b=tx(y)}}return $p({width:p,height:f,x:l,y:u})}function jh(e,t){const n=Nh(e).scrollLeft;return t?t.left+n:ta(Wi(e)).left+n}function CI(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-jh(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function kQ(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",o=Wi(r),c=t?Sh(t.floating):!1;if(r===o||c&&s)return n;let l={scrollLeft:0,scrollTop:0},u=zi(1);const p=zi(0),f=ys(r);if((f||!f&&!s)&&((Il(r)!=="body"||Gu(o))&&(l=Nh(r)),f)){const h=ta(r);u=el(r),p.x=h.x+r.clientLeft,p.y=h.y+r.clientTop}const d=o&&!f&&!s?CI(o,l):zi(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+p.x+d.x,y:n.y*u.y-l.scrollTop*u.y+p.y+d.y}}function SQ(e){return Array.from(e.getClientRects())}function NQ(e){const t=Wi(e),n=Nh(e),r=e.ownerDocument.body,i=Wo(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Wo(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+jh(e);const c=-n.scrollTop;return mi(r).direction==="rtl"&&(o+=Wo(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:c}}const vN=25;function jQ(e,t){const n=Pr(e),r=Wi(e),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,c=0,l=0;if(i){s=i.width,o=i.height;const p=Gw();(!p||p&&t==="fixed")&&(c=i.offsetLeft,l=i.offsetTop)}const u=jh(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<=vN&&(s-=y)}else u<=vN&&(s+=u);return{width:s,height:o,x:c,y:l}}function CQ(e,t){const n=ta(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=ys(e)?el(e):zi(1),o=e.clientWidth*s.x,c=e.clientHeight*s.y,l=i*s.x,u=r*s.y;return{width:o,height:c,x:l,y:u}}function bN(e,t,n){let r;if(t==="viewport")r=jQ(e,n);else if(t==="document")r=NQ(Wi(e));else if(hi(t))r=CQ(t,n);else{const i=jI(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return $p(r)}function EI(e,t){const n=ho(e);return n===t||!hi(n)||bl(n)?!1:mi(n).position==="fixed"||EI(n,t)}function EQ(e,t){const n=t.get(e);if(n)return n;let r=Eu(e,[],!1).filter(c=>hi(c)&&Il(c)!=="body"),i=null;const s=mi(e).position==="fixed";let o=s?ho(e):e;for(;hi(o)&&!bl(o);){const c=mi(o),l=Yw(o);!l&&c.position==="fixed"&&(i=null),(s?!l&&!i:!l&&c.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||Gu(o)&&!l&&EI(e,o))?r=r.filter(p=>p!==o):i=c,o=ho(o)}return t.set(e,r),r}function _Q(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?Sh(t)?[]:EQ(t,this._c):[].concat(n),r],c=bN(t,o[0],i);let l=c.top,u=c.right,p=c.bottom,f=c.left;for(let d=1;d<o.length;d++){const h=bN(t,o[d],i);l=Wo(h.top,l),u=vl(h.right,u),p=vl(h.bottom,p),f=Wo(h.left,f)}return{width:u-f,height:p-l,x:f,y:l}}function PQ(e){const{width:t,height:n}=NI(e);return{width:t,height:n}}function IQ(e,t,n){const r=ys(t),i=Wi(t),s=n==="fixed",o=ta(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const l=zi(0);function u(){l.x=jh(i)}if(r||!r&&!s)if((Il(t)!=="body"||Gu(i))&&(c=Nh(t)),r){const h=ta(t,!0,s,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else i&&u();s&&!r&&i&&u();const p=i&&!r&&!s?CI(i,c):zi(0),f=o.left+c.scrollLeft-l.x-p.x,d=o.top+c.scrollTop-l.y-p.y;return{x:f,y:d,width:o.width,height:o.height}}function fg(e){return mi(e).position==="static"}function kN(e,t){if(!ys(e)||mi(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Wi(e)===n&&(n=n.ownerDocument.body),n}function _I(e,t){const n=Pr(e);if(Sh(e))return n;if(!ys(e)){let i=ho(e);for(;i&&!bl(i);){if(hi(i)&&!fg(i))return i;i=ho(i)}return n}let r=kN(e,t);for(;r&&gQ(r)&&fg(r);)r=kN(r,t);return r&&bl(r)&&fg(r)&&!Yw(r)?n:r||wQ(e)||n}const AQ=async function(e){const t=this.getOffsetParent||_I,n=this.getDimensions,r=await n(e.floating);return{reference:IQ(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function TQ(e){return mi(e).direction==="rtl"}const RQ={convertOffsetParentRelativeRectToViewportRelativeRect:kQ,getDocumentElement:Wi,getClippingRect:_Q,getOffsetParent:_I,getElementRects:AQ,getClientRects:SQ,getDimensions:PQ,getScale:el,isElement:hi,isRTL:TQ};function PI(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function LQ(e,t){let n=null,r;const i=Wi(e);function s(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function o(c,l){c===void 0&&(c=!1),l===void 0&&(l=1),s();const u=e.getBoundingClientRect(),{left:p,top:f,width:d,height:h}=u;if(c||t(),!d||!h)return;const y=hf(f),b=hf(i.clientWidth-(p+d)),k=hf(i.clientHeight-(f+h)),g=hf(p),w={rootMargin:-y+"px "+-b+"px "+-k+"px "+-g+"px",threshold:Wo(0,vl(1,l))||1};let S=!0;function C(N){const P=N[0].intersectionRatio;if(P!==l){if(!S)return o();P?o(!1,P):r=setTimeout(()=>{o(!1,1e-7)},1e3)}P===1&&!PI(u,e.getBoundingClientRect())&&o(),S=!1}try{n=new IntersectionObserver(C,{...w,root:i.ownerDocument})}catch{n=new IntersectionObserver(C,w)}n.observe(e)}return o(!0),s}function SN(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=Xw(e),p=i||s?[...u?Eu(u):[],...t?Eu(t):[]]:[];p.forEach(g=>{i&&g.addEventListener("scroll",n,{passive:!0}),s&&g.addEventListener("resize",n)});const f=u&&c?LQ(u,n):null;let d=-1,h=null;o&&(h=new ResizeObserver(g=>{let[v]=g;v&&v.target===u&&h&&t&&(h.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var w;(w=h)==null||w.observe(t)})),n()}),u&&!l&&h.observe(u),t&&h.observe(t));let y,b=l?ta(e):null;l&&k();function k(){const g=ta(e);b&&!PI(b,g)&&n(),b=g,y=requestAnimationFrame(k)}return n(),()=>{var g;p.forEach(v=>{i&&v.removeEventListener("scroll",n),s&&v.removeEventListener("resize",n)}),f==null||f(),(g=h)==null||g.disconnect(),h=null,l&&cancelAnimationFrame(y)}}const OQ=hQ,MQ=uQ,$Q=mQ,DQ=dQ,NN=lQ,FQ=(e,t,n)=>{const r=new Map,i={platform:RQ,...n},s={...i.platform,_c:r};return aQ(e,t,{...i,platform:s})};var zQ=typeof document<"u",BQ=function(){},Ff=zQ?m.useLayoutEffect:BQ;function Dp(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Dp(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&e.$$typeof)&&!Dp(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function II(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function jN(e,t){const n=II(e);return Math.round(t*n)/n}function pg(e){const t=m.useRef(e);return Ff(()=>{t.current=e}),t}function CN(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:c=!0,whileElementsMounted:l,open:u}=e,[p,f]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[d,h]=m.useState(r);Dp(d,r)||h(r);const[y,b]=m.useState(null),[k,g]=m.useState(null),v=m.useCallback(_=>{_!==N.current&&(N.current=_,b(_))},[]),w=m.useCallback(_=>{_!==P.current&&(P.current=_,g(_))},[]),S=s||y,C=o||k,N=m.useRef(null),P=m.useRef(null),R=m.useRef(p),M=l!=null,U=pg(l),L=pg(i),A=pg(u),V=m.useCallback(()=>{if(!N.current||!P.current)return;const _={placement:t,strategy:n,middleware:d};L.current&&(_.platform=L.current),FQ(N.current,P.current,_).then(I=>{const E={...I,isPositioned:A.current!==!1};T.current&&!Dp(R.current,E)&&(R.current=E,Hr.flushSync(()=>{f(E)}))})},[d,t,n,L,A]);Ff(()=>{u===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,f(_=>({..._,isPositioned:!1})))},[u]);const T=m.useRef(!1);Ff(()=>(T.current=!0,()=>{T.current=!1}),[]),Ff(()=>{if(S&&(N.current=S),C&&(P.current=C),S&&C){if(U.current)return U.current(S,C,V);V()}},[S,C,V,U,M]);const $=m.useMemo(()=>({reference:N,floating:P,setReference:v,setFloating:w}),[v,w]),D=m.useMemo(()=>({reference:S,floating:C}),[S,C]),K=m.useMemo(()=>{const _={position:n,left:0,top:0};if(!D.floating)return _;const I=jN(D.floating,p.x),E=jN(D.floating,p.y);return c?{..._,transform:"translate("+I+"px, "+E+"px)",...II(D.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:I,top:E}},[n,c,D.floating,p.x,p.y]);return m.useMemo(()=>({...p,update:V,refs:$,elements:D,floatingStyles:K}),[p,V,$,D,K])}const HQ=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?NN({element:r.current,padding:i}).fn(n):{}:r?NN({element:r,padding:i}).fn(n):{}}}},EN=(e,t)=>{const n=OQ(e);return{name:n.name,fn:n.fn,options:[e,t]}},UQ=(e,t)=>{const n=$Q(e);return{name:n.name,fn:n.fn,options:[e,t]}},VQ=(e,t)=>{const n=DQ(e);return{name:n.name,fn:n.fn,options:[e,t]}},WQ=(e,t)=>{const n=MQ(e);return{name:n.name,fn:n.fn,options:[e,t]}},KQ=(e,t)=>{const n=HQ(e);return{name:n.name,fn:n.fn,options:[e,t]}},qQ={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},YQ={beaconOptions:{offset:-18}},AI={back:"Back",close:"Close",last:"Last",next:"Next",nextWithProgress:"Next ({current} of {total})",open:"Open the dialog",skip:"Skip"},GQ={isFixed:!1,locale:AI,placement:"bottom"},XQ={continuous:!1,debug:!1,run:!1,scrollToFirstStep:!1,steps:[]},lt={INIT:"init",START:"start",STOP:"stop",RESET:"reset",PREV:"prev",NEXT:"next",GO:"go",CLOSE:"close",SKIP:"skip",UPDATE:"update",COMPLETE:"complete"},bn={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"},Pe={INIT:"init",READY:"ready",BEACON_BEFORE:"beacon_before",BEACON:"beacon",TOOLTIP_BEFORE:"tooltip_before",TOOLTIP:"tooltip",COMPLETE:"complete"},Ai={BUTTON_BACK:"button_back",BUTTON_CLOSE:"button_close",BUTTON_PRIMARY:"button_primary",BUTTON_SKIP:"button_skip",KEYBOARD:"keyboard",OVERLAY:"overlay"},it={IDLE:"idle",READY:"ready",WAITING:"waiting",RUNNING:"running",PAUSED:"paused",SKIPPED:"skipped",FINISHED:"finished"},JQ="react-joyride-portal";function QQ(e){const t={};for(const n in e)e[n]!==void 0&&(t[n]=e[n]);return t}function Ua(...e){return HJ({all:!0,isMergeableObject:t=>!(!Bn.plainObject(t)||m.isValidElement(t))})(...e)}function TI(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function ns(e,t={}){const{defaultValue:n,step:r,steps:i}=t;let s=ug(e);if(s)(s.includes("{current}")||s.includes("{total}"))&&r&&i&&(s=s.replace("{current}",r.toString()).replace("{total}",i.toString()));else if(m.isValidElement(e)&&!Object.values(e.props).length&&TI(e.type)==="function")try{s=ns(e.type({}),t)}catch{s=ug(n)}else s=ug(n);return s}function Sn(e,t,n,...r){if(!e)return;const i=new Date,s=`${String(i.getHours()).padStart(2,"0")}:${String(i.getMinutes()).padStart(2,"0")}:${String(i.getSeconds()).padStart(2,"0")}.${String(i.getMilliseconds()).padStart(3,"0")}`;console.log(`${t} %c${n}%c ${s}`,"font-weight: bold","color: gray; font-weight: normal",...r)}function ZQ(e,t){const n=QQ(t);return{...e,...n}}function _u(){}function eZ(e){return Object.keys(e)}function Fp(e,...t){if(!Bn.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 _N(e,...t){if(!Bn.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 nx(e,t,n){const r=s=>s.replace("{current}",String(t)).replace("{total}",String(n));if(TI(e)==="string")return r(e);if(!m.isValidElement(e))return e;const{children:i}=e.props;if(Bn.string(i)&&i.includes("{current}"))return m.cloneElement(e,{children:r(i)});if(Array.isArray(i))return m.cloneElement(e,{children:i.map(s=>typeof s=="string"?r(s):nx(s,t,n))});if(Bn.function(e.type)&&!Object.values(e.props).length)try{return nx(e.type({}),t,n)}catch{return e}return e}function PN(e){return eZ(e).sort().reduce((t,n)=>(t[n]=e[n],t),{})}function Jw(){var e;return!!(typeof window<"u"&&((e=window.document)!=null&&e.createElement))}function IN(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 Qw(e){return e?e.getBoundingClientRect():null}function tZ(e=!1){const{body:t,documentElement:n}=document;if(!t||!n)return 0;if(e){const r=[t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight].sort((s,o)=>s-o),i=Math.floor(r.length/2);return r.length%2===0?(r[i-1]+r[i])/2:r[i]}return Math.max(t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight)}function Ur(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 nZ(e,t,n){const r=Qw(e),i=Al(e),s=i?!i.isSameNode(dr()):!1,o=n??Tl(e);let c=0,l=(r==null?void 0:r.top)??0;return s&&o?l=(r==null?void 0:r.top)??0:i instanceof HTMLElement&&(c=i.scrollTop,!s&&!o&&(l+=c),i.isSameNode(dr())||(l+=dr().scrollTop)),Math.floor(l-t)}function Al(e,t){if(!e)return dr();const n=xI(e);if(n){if(n.isSameNode(dr()))return t?document:dr();if(!(n.scrollHeight>n.offsetHeight))return dr()}return n}function rZ(e){const t=e.getBoundingClientRect(),n=dr(),r=t.top+t.height/2,i=window.innerHeight/2;return Math.max(0,n.scrollTop+r-i)}function iZ(e,t){if(!e)return 0;const n=xI(e)??dr(),r=parseFloat(getComputedStyle(e).scrollMarginTop)||0,i=Qw(n),s=n.scrollTop??0,{offsetTop:o=0,scrollTop:c=0}=n;let l=e.getBoundingClientRect().top+c;if(o&&(RI(e)||sZ(e))){const p=e.getBoundingClientRect(),f=p.top-((i==null?void 0:i.top)??0),d=f+p.height,h=n.clientHeight,y=h*.2;f>=y&&d<=h-y?l=s:l=f+s}const u=Math.floor(l-t-r);return u<0?0:u}function sZ(e){return e.offsetParent!==document.body}function RI(e){if(!e)return!1;const t=Al(e);return t?!t.isSameNode(dr()):!1}function Tl(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?Tl(e.parentNode,t):!1}function mf(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 AN(e){const{isFirstStep:t,scrollToFirstStep:n,step:r,target:i,targetLifecycle:s}=e;if(r.skipScroll||t&&!n&&s!==Pe.TOOLTIP||r.placement==="center")return!1;const o=i!=null&&i.isConnected?Al(i):dr(),c=o?!o.isSameNode(dr()):!1;return(r.isFixed||Tl(i))&&!c?!1:o.scrollHeight>o.clientHeight}function dr(){return document.scrollingElement??document.documentElement}function TN(e,t){const{duration:n,element:r}=t;let i=()=>{};const s=new Promise(o=>{const{scrollTop:c}=r,l=e>c?e-c:c-e;i=GJ.top(r,e,{duration:l<100?50:n},()=>{o()})});return{cancel:i,promise:s}}function oZ(e){const t=e.replace(/^#?([\da-f])([\da-f])([\da-f])$/i,(r,i,s,o)=>i+i+s+s+o+o),n=/^#?([\da-f]{2})([\da-f]{2})([\da-f]{2})/i.exec(t);return n?[parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)]:[]}const LI={backgroundColor:"transparent",border:0,borderRadius:0,color:"#555555",cursor:"pointer",fontSize:16,lineHeight:1,padding:0,WebkitAppearance:"none"},gf={...LI,borderRadius:4,padding:8};function aZ(e,t){const{styles:n}=e,r=Ua(n??{},t.styles??{});let{width:i}=t;Jw()&&(i=typeof i=="number"&&window.innerWidth<i?window.innerWidth-30:i);const s={bottom:0,left:0,overflow:"hidden",position:"absolute",right:0,top:0,zIndex:t.zIndex};return Ua({arrow:{alignItems:"center",color:t.arrowColor,display:"inline-flex",justifyContent:"center",position:"absolute"},beaconWrapper:{...LI,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(${oZ(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:{...gf,color:t.primaryColor,marginLeft:"auto",marginRight:5},buttonClose:{...gf,color:t.textColor,height:12,padding:8,position:"absolute",right:0,top:0,width:12},buttonPrimary:{...gf,backgroundColor:t.primaryColor,color:t.backgroundColor},buttonSkip:{...gf,color:t.textColor,fontSize:14},floater:{display:"inline-block",filter:"drop-shadow(0 0 3px rgba(0, 0, 0, 0.3))",maxWidth:"100%",transition:"opacity 0.3s"},loader:{alignItems:"center",display:"flex",height:48,inset:0,justifyContent:"center",pointerEvents:"none",position:"fixed",width:48,zIndex:t.zIndex+1},overlay:{...s,backgroundColor:t.overlayColor},spotlight:{},tooltip:{backgroundColor:t.backgroundColor,borderRadius:5,boxSizing:"border-box",color:t.textColor,fontSize:16,maxWidth:"100%",padding:12,position:"relative",width:i},tooltipContainer:{lineHeight:1.4,textAlign:"center"},tooltipTitle:{fontSize:18,margin:0},tooltipContent:{paddingBottom:12,paddingTop:12},tooltipFooter:{alignItems:"center",display:"flex",justifyContent:"flex-end"},tooltipFooterSpacer:{flex:1}},r)}const lZ=["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 Zw(e,t){if(!t)return null;const n=Ua(GQ,_N(e,"arrowComponent","beaconComponent","floatingOptions","loaderComponent","locale","styles","tooltipComponent"),t),r=Ua(qQ,e.options??{},_N(t,...lZ)),i=aZ(e,{...n,...r}),s=Ua(YQ,e.floatingOptions??{},n.floatingOptions??{});return{...n,...r,locale:Ua(AI,e.locale??{},n.locale||{}),floatingOptions:s,spotlightPadding:cZ(r.spotlightPadding),styles:i}}function cZ(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 uZ(e,t,n){const{action:r}=t,i=n&&[lt.PREV,lt.NEXT].includes(r);return e.skipBeacon||e.placement==="center"||i}function OI(e,t=!1){return Bn.plainObject(e)?e.target?!0:(Sn(t,"tour","target is missing from the step"),!1):(Sn(t,"tour","step must be an object"),!1)}function MI(e,t=!1){return Bn.array(e)?e.every(n=>OI(n,t)):(Sn(t,"tour","steps must be an array"),!1)}var dZ=class{constructor(e){Kt(this,"beaconPosition",null);Kt(this,"debug");Kt(this,"eventListeners",new Map);Kt(this,"listeners",new Set);Kt(this,"props");Kt(this,"snapshot");Kt(this,"state");Kt(this,"steps");Kt(this,"tooltipPosition",null);Kt(this,"cleanupPositionData",()=>{this.beaconPosition=null,this.tooltipPosition=null});Kt(this,"getPositionData",e=>e==="beacon"?this.beaconPosition:this.tooltipPosition);Kt(this,"getServerSnapshot",()=>this.snapshot);Kt(this,"getSnapshot",()=>this.snapshot);Kt(this,"getEventState",()=>Fp(this.snapshot,"positioned"));Kt(this,"getState",()=>Fp(this.snapshot,"positioned"));Kt(this,"setPositionData",(e,t)=>{var r,i,s;((r=e==="beacon"?this.beaconPosition:this.tooltipPosition)==null?void 0:r.placement)!==t.placement&&Sn(this.debug,`step:${this.state.index}`,"positioned",`${e} ${t.placement}`),e==="beacon"?this.beaconPosition=t:this.tooltipPosition=t,(this.state.lifecycle===Pe.BEACON_BEFORE||this.state.lifecycle===Pe.TOOLTIP_BEFORE)&&!this.state.positioned&&this.updateState({positioned:!0});const n=(s=(i=this.getStep())==null?void 0:i.floatingOptions)==null?void 0:s.onPosition;n&&n(t)});Kt(this,"setSteps",e=>{this.steps=e,this.updateState({size:e.length})});Kt(this,"dispatch",(e,t)=>{const n=this.eventListeners.get(e.type);if(n)for(const r of n)try{r(e,t)}catch{}});Kt(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)}});Kt(this,"subscribe",e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}));Kt(this,"updateState",(e,t=!1)=>{const{controlled:n,index:r}=this.state,i=this.snapshot,s=n&&!t&&e.index!==void 0?r:e.index??r,o={action:e.action??this.state.action,controlled:n,index:s,lifecycle:e.lifecycle??this.state.lifecycle,origin:e.origin??null,positioned:e.positioned??this.state.positioned,scrolling:e.scrolling??this.state.scrolling,size:e.size??this.state.size,status:e.status??this.state.status,waiting:e.waiting??this.state.waiting},c=this.applyTransitions(o);if(this.state=c,!Hw(i,c)){this.snapshot=Object.freeze({...c});for(const l of this.listeners)l(this.snapshot)}});const{initialStepIndex:t,stepIndex:n,steps:r=[]}=e??{},i=Bn.number(n);let s=0;this.debug=(e==null?void 0:e.debug)??!1,i?(s=n,Bn.number(t)&&Sn(this.debug,"tour","initialStepIndex is ignored in controlled mode")):Bn.number(t)&&(t>=0&&t<r.length?s=t:r.length>0&&Sn(this.debug,"tour","initialStepIndex is out of bounds")),this.props=e??{steps:[]},this.steps=r,this.state={action:lt.INIT,controlled:i,index:s,lifecycle:Pe.INIT,origin:null,positioned:!1,scrolling:!1,size:r.length,status:r.length?it.READY:it.IDLE,waiting:!1},this.snapshot=Object.freeze({...this.state})}applyTransitions(e){return e.status===it.WAITING&&e.size>0?{...e,status:it.RUNNING}:e}getStep(e){return Zw(this.props,this.steps[e??this.state.index])}};function fZ(e){return new dZ(e)}function RN(e,t){return Math.min(Math.max(e,0),t)}function pZ(e,t,n){const r=m.useRef(t),i=m.useRef(n);return r.current=t,i.current=n,m.useMemo(()=>{const s=()=>e.current.getSnapshot();return{close:(k=null)=>{const{index:g,status:v}=s();v===it.RUNNING&&e.current.updateState({action:lt.CLOSE,index:g+1,origin:k,lifecycle:Pe.COMPLETE,positioned:!1,scrolling:!1,waiting:!1})},go:k=>{const{controlled:g,size:v,status:w}=s();if(g){Sn(r.current,"tour","go() is not supported in controlled mode");return}w===it.RUNNING&&e.current.updateState({action:lt.GO,index:k,lifecycle:Pe.COMPLETE,positioned:!1,scrolling:!1,status:k<v?w:it.FINISHED,waiting:!1})},info:()=>Fp(e.current.getSnapshot(),"positioned"),next:k=>{const{index:g,size:v,status:w}=s();w===it.RUNNING&&e.current.updateState({action:lt.NEXT,index:RN(g+1,v),lifecycle:Pe.COMPLETE,origin:k,positioned:!1,scrolling:!1,waiting:!1})},open:()=>{const{status:k}=s();k===it.RUNNING&&e.current.updateState({action:lt.UPDATE,lifecycle:Pe.TOOLTIP_BEFORE,positioned:!1,scrolling:!1,waiting:!1})},prev:k=>{const{index:g,size:v,status:w}=s();w===it.RUNNING&&e.current.updateState({action:lt.PREV,index:RN(g-1,v),lifecycle:Pe.COMPLETE,origin:k,positioned:!1,scrolling:!1,waiting:!1})},reset:(k=!1)=>{const{controlled:g}=s();if(g){Sn(r.current,"tour","reset() is not supported in controlled mode");return}i.current(),e.current.updateState({action:lt.RESET,index:0,lifecycle:Pe.INIT,positioned:!1,scrolling:!1,status:k?it.RUNNING:it.READY,waiting:!1})},skip:k=>{const{status:g}=s();g===it.RUNNING&&e.current.updateState({action:lt.SKIP,lifecycle:Pe.COMPLETE,origin:k,positioned:!1,scrolling:!1,status:it.SKIPPED,waiting:!1})},start:k=>{const{index:g,size:v}=s();i.current(),e.current.updateState({action:lt.START,index:Bn.number(k)?k:g,lifecycle:Pe.INIT,positioned:!1,scrolling:!1,status:v?it.RUNNING:it.WAITING,waiting:!1},!0)},stop:(k=!1)=>{const{index:g,status:v}=s();[it.FINISHED,it.SKIPPED].includes(v)||e.current.updateState({action:lt.STOP,index:g+(k?1:0),lifecycle:Pe.COMPLETE,positioned:!1,scrolling:!1,status:it.PAUSED,waiting:!1})}}},[e])}const hZ=new Set(["origin","positioned"]);function mZ(e,t){const n=m.useRef(null);m.useEffect(()=>{if(!t)return;const r=e.current.getSnapshot();return Sn(!0,"tour","init",r),n.current=r,e.current.subscribe(i=>{const s=n.current;if(n.current=i,!s)return;const o={};let c=!1;for(const l of Object.keys(i))i[l]!==s[l]&&!hZ.has(l)&&(o[l]={from:s[l],to:i[l]},(l==="status"||l==="size")&&(c=!0));Object.keys(o).length&&(!c&&i.index>=i.size||Sn(!0,c?"tour":`step:${i.index}`,"state",o))})},[t,e])}function gZ(e,t,n){const r=m.useRef(e),i=m.useRef(t);return r.current=e,i.current=t,m.useCallback((s,o,c)=>{var u;const l={...n.current.getEventState(),error:null,scroll:null,step:o,type:s,...c};(u=r.current)==null||u.call(r,l,i.current),n.current.dispatch(l,i.current)},[n])}function Hs(e,t){return{hasChanged(n){return e[n]!==t[n]},hasChangedTo(n,r){const i=e[n],s=t[n];return Array.isArray(r)?r.includes(i)&&!r.includes(s):i===r&&s!==r},previous:t}}function yZ(e){const{addFailure:t,controls:n,emitEvent:r,previousState:i,props:s,state:o,step:c,store:l}=e,{action:u,index:p,lifecycle:f,positioned:d,scrolling:h,size:y,status:b}=o,k=uI(c)??null,g=m.useRef(null),v=m.useRef(s),w=m.useRef(o),S=m.useRef(i),C=m.useRef(c),N=m.useRef(k),P=m.useRef(n),R=m.useRef(null),M=m.useRef(null),U=m.useRef(null);v.current=s,w.current=o,S.current=i,C.current=c,N.current=k,P.current=n;const L=()=>{R.current&&(clearInterval(R.current),R.current=null),M.current=null,U.current&&(U.current.cancel(),U.current=null)};m.useEffect(()=>{if(!S.current)return;const{hasChangedTo:A}=Hs(w.current,S.current);(A("action",[lt.NEXT,lt.PREV,lt.SKIP,lt.CLOSE])||g.current===lt.CLOSE&&u===lt.START)&&(g.current=u)},[u]),m.useEffect(()=>{if(!S.current)return()=>{L()};const{hasChanged:A}=Hs(w.current,S.current),V=C.current;if(A("index")&&L(),b!==it.RUNNING||!V||f!==Pe.INIT)return()=>{L()};const{hasChangedTo:T}=Hs(w.current,S.current);T("status",it.RUNNING)&&[it.IDLE,it.READY,it.PAUSED].includes(S.current.status)&&r(bn.TOUR_START,V),l.current.cleanupPositionData();const{debug:$}=v.current;if(V.before&&!U.current){Sn($,`step:${p}`,"before()",V),U.current={cancel:()=>{}},l.current.updateState({waiting:!0}),r(bn.STEP_BEFORE_HOOK,V,{action:g.current??w.current.action});const D=()=>{U.current=null,l.current.updateState({action:g.current??w.current.action,waiting:!1,lifecycle:Pe.READY})},K=new AbortController,_=V.beforeTimeout;U.current={cancel:()=>K.abort()};const I=_?setTimeout(()=>{K.signal.aborted||(Sn($,`step:${p}`,"before()","timed out",`${_}ms`),K.abort(),t(V,"before_hook"),r(bn.ERROR,V,{error:new Error("Step before hook timed out")}),D())},_):null;V.before({...l.current.getState(),action:g.current??l.current.getState().action,step:V}).then(()=>{K.signal.aborted||(I&&clearTimeout(I),D())}).catch(E=>{K.signal.aborted||(I&&clearTimeout(I),t(V,"before_hook"),r(bn.ERROR,V,{error:E instanceof Error?E:new Error(String(E))}),D())})}else if(!U.current){R.current&&M.current!==V.target&&L();const D=Ur(V.target);if(D&&mf(D))L(),l.current.updateState({action:g.current??lt.UPDATE,lifecycle:Pe.READY,waiting:!1});else if(V.targetWaitTimeout===0)l.current.updateState({action:g.current??lt.UPDATE,lifecycle:Pe.READY,waiting:!1});else if(!R.current){const{targetWaitTimeout:K}=V,_=Date.now();M.current=V.target,Sn($,`step:${p}`,"polling","started",`${K}ms`),l.current.updateState({waiting:!0}),R.current=setInterval(()=>{const I=Ur(V.target),E=Date.now()-_,Y=E>=K;(I&&mf(I)||Y)&&(Sn($,`step:${p}`,"polling",I&&mf(I)?"found":"timed out",`${E}ms`),L(),l.current.updateState({action:g.current??lt.UPDATE,lifecycle:Pe.READY,waiting:!1}))},100)}}return()=>{L()}},[t,r,p,f,b,l]),m.useEffect(()=>{if(!S.current)return;const{hasChanged:A,hasChangedTo:V,previous:T}=Hs(w.current,S.current),$=C.current;if(!$)return;const D=Ur($.target),K=!!D;if(K&&mf(D)){if(V("lifecycle",Pe.READY)&&T.lifecycle===Pe.INIT&&r(bn.STEP_BEFORE,$,{action:g.current??w.current.action}),V("lifecycle",Pe.READY)){const _=w.current,I=uZ($,_,v.current.continuous)?Pe.TOOLTIP:Pe.BEACON,E=Ur($.scrollTarget??$.spotlightTarget??$.target),Y=AN({isFirstStep:_.index===0,scrollToFirstStep:v.current.scrollToFirstStep,step:$,target:E,targetLifecycle:I}),G=I===Pe.TOOLTIP?Pe.TOOLTIP_BEFORE:Pe.BEACON_BEFORE;Sn(v.current.debug,`step:${p}`,"scroll",Y?"needed":"skipped"),l.current.updateState({action:lt.UPDATE,lifecycle:G,scrolling:Y})}}else if(w.current.status===it.RUNNING&&f!==Pe.INIT&&f!==Pe.COMPLETE&&A("lifecycle")){Sn(v.current.debug,`step:${p}`,K?"Target not visible":"Target not mounted",$),t($,"target_not_found"),r(bn.TARGET_NOT_FOUND,$);const _=w.current;_.controlled||l.current.updateState({action:lt.UPDATE,index:_.index+(_.action===lt.PREV?-1:1),lifecycle:Pe.INIT})}},[t,r,p,f,l]),m.useEffect(()=>{if(!S.current)return;const{hasChangedTo:A,previous:V}=Hs(w.current,S.current),T=C.current,$=N.current;if(T&&A("lifecycle",Pe.TOOLTIP_BEFORE)&&V.lifecycle===Pe.BEACON){const _=Ur(T.scrollTarget??T.spotlightTarget??T.target);if(AN({isFirstStep:w.current.index===0,scrollToFirstStep:v.current.scrollToFirstStep,step:T,target:_,targetLifecycle:Pe.TOOLTIP})){l.current.updateState({scrolling:!0,positioned:!1});return}}const D=f===Pe.BEACON_BEFORE||f===Pe.TOOLTIP_BEFORE;if(T&&D&&!h){const _=f===Pe.TOOLTIP_BEFORE?Pe.TOOLTIP:Pe.BEACON;l.current.updateState({action:lt.UPDATE,lifecycle:_})}T&&A("lifecycle",Pe.BEACON)&&r(bn.BEACON,T),T&&A("lifecycle",Pe.TOOLTIP)&&r(bn.TOOLTIP,T);const K=w.current;if((K.status===it.RUNNING||K.controlled&&K.status===it.PAUSED&&T)&&$&&A("lifecycle",Pe.COMPLETE)&&V.lifecycle===Pe.TOOLTIP&&(r(bn.STEP_AFTER,$,{action:g.current??lt.UPDATE,index:V.index??K.index,lifecycle:K.lifecycle}),$.after)){r(bn.STEP_AFTER_HOOK,$,{action:g.current??lt.UPDATE,index:V.index??K.index,lifecycle:K.lifecycle});try{$.after({...l.current.getState(),action:g.current??lt.UPDATE,index:V.index??K.index,lifecycle:K.lifecycle,step:$})}catch{}}},[r,f,d,h,l]),m.useEffect(()=>{if(!S.current)return;const{hasChangedTo:A,previous:V}=Hs(w.current,S.current),T=C.current,$=N.current;y&&!T&&f===Pe.INIT&&l.current.updateState({action:lt.UPDATE,lifecycle:Pe.COMPLETE,status:it.FINISHED}),!w.current.controlled&&b===it.RUNNING&&A("lifecycle",Pe.COMPLETE)&&p<y&&l.current.updateState({action:lt.UPDATE,lifecycle:Pe.INIT}),A("lifecycle",Pe.COMPLETE)&&p>=y&&l.current.updateState({action:lt.UPDATE,lifecycle:Pe.COMPLETE,status:it.FINISHED});const D=T??$??Zw(v.current,v.current.steps[p-1]);if(D&&A("status",[it.FINISHED,it.SKIPPED])){let K;T?K=p:$?K=V.index??p:K=p-1,r(bn.TOUR_END,D,{index:K}),w.current.controlled||P.current.reset(),g.current=null}T&&A("action",lt.STOP)&&(g.current=null,r(bn.TOUR_STATUS,T)),T&&A("action",lt.RESET)&&(r(bn.TOUR_STATUS,T),g.current=null)},[u,r,p,f,y,b,l])}function xZ({controls:e,emitEvent:t,props:n,state:r,store:i}){const{debug:s,initialStepIndex:o,run:c,stepIndex:l,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}=Hs(n,h);if(Hw(h.steps,u)||(MI(u,s)?i.current.setSteps(u):(Sn(s,"tour","Steps are not valid",u),t(bn.ERROR,u[0]??{target:"",content:""},{error:new Error("Steps are not valid")}))),y("run"))c?i.current.getState().size&&d.current.start(l??o):d.current.stop();else if(Bn.number(l)&&y("stepIndex")){const b=Bn.number(h.stepIndex)&&h.stepIndex<l?lt.NEXT:lt.PREV;[it.FINISHED,it.SKIPPED].includes(f.current.status)||i.current.updateState({action:b,index:l,lifecycle:Pe.INIT,positioned:!1},!0)}},[s,t,o,n,c,l,u,i])}function wZ(e,t){var c,l,u,p;const{beaconPosition:n,lifecycle:r,scrollOffset:i,step:s}=t;if(s.scrollTarget||s.spotlightTarget)return Math.max(0,e);let o=e-s.spotlightPadding.top;if(r===Pe.BEACON_BEFORE&&(n!=null&&n.placement)){const f=vZ(n);["bottom"].includes(n.placement)||(o+=Math.floor(f-i))}else if(r===Pe.TOOLTIP_BEFORE){const{placement:f}=s;if(f==="top"){const d=((c=document.querySelector(".react-joyride__floater"))==null?void 0:c.getBoundingClientRect().height)??0,h=(l=s.floatingOptions)!=null&&l.hideArrow?0:s.arrowSize,y=s.offset+s.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=Ur(s.target))==null?void 0:p.getBoundingClientRect().height)??0,y=i+s.spotlightPadding.top+h/2-d/2;y<i&&(o-=i-y)}}return Math.max(0,o)}function vZ(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 bZ({emitEvent:e,previousState:t,props:n,state:r,step:i,store:s}){const{index:o,lifecycle:c,positioned:l,scrolling:u,status:p}=r,f=m.useRef(null),d=m.useRef(r),h=m.useRef(t),y=m.useRef(n),b=m.useRef(i);d.current=r,h.current=t,y.current=n,b.current=i,m.useEffect(()=>()=>{var k;(k=f.current)==null||k.call(f)},[]),m.useEffect(()=>{var C;if(!h.current||!b.current)return;const{hasChangedTo:k}=Hs(d.current,h.current),g=b.current,{debug:v}=y.current,{scrollDuration:w}=g,S=c===Pe.BEACON_BEFORE||c===Pe.TOOLTIP_BEFORE;if(p===it.RUNNING&&S&&u&&k("positioned",!0)){const N=Ur(g.scrollTarget??g.spotlightTarget??g.target),P=s.current.getPositionData("beacon"),R=Al(N),M=R?!R.isSameNode(dr()):!1;(C=f.current)==null||C.call(f),(async()=>{if(M&&!Tl(R)){const K=dr(),_=rZ(R),I={initial:K.scrollTop,target:_,element:K,duration:w};e(bn.SCROLL_START,g,{scroll:I});const{cancel:E,promise:Y}=TN(_,{element:K,duration:w});f.current=E,await Y,e(bn.SCROLL_END,g,{scroll:I})}const L=Math.floor(iZ(N,g.scrollOffset))||0,A=M?L:wZ(L,{beaconPosition:P,lifecycle:c,scrollOffset:g.scrollOffset,step:g});Sn(v,`step:${o}`,"scroll",M?"custom":"document",`${L} → ${A}`);const V=R,T={initial:V.scrollTop,target:A,element:V,duration:w};e(bn.SCROLL_START,g,{scroll:T});const{cancel:$,promise:D}=TN(A,{element:V,duration:w});f.current=$,await D,e(bn.SCROLL_END,g,{scroll:T}),s.current.updateState({scrolling:!1})})().catch(()=>{s.current.updateState({scrolling:!1})})}},[e,o,c,l,u,p,s])}function kZ(e){const t=iJ(()=>ZQ(XQ,e),[e]),{debug:n,initialStepIndex:r,onEvent:i,run:s,stepIndex:o,steps:c}=t,l=m.useRef(fZ(t)),u=jE.useSyncExternalStore(l.current.subscribe,l.current.getSnapshot,l.current.getServerSnapshot),[p,f]=m.useState([]),d=m.useCallback((C,N)=>{f(P=>[...P,{reason:N,step:C}])},[]),h=m.useCallback(()=>{f([])},[]);mZ(l,n);const y=pZ(l,n,h),b=gZ(i,y,l),{index:k,size:g,status:v}=u,w=uI(u),S=m.useMemo(()=>Zw(t,c[k]),[k,t,c]);return sJ(()=>{s&&g&&MI(c,n)&&y.start(o??r)}),rJ(()=>{s&&g&&v===it.IDLE&&l.current.updateState({status:it.READY})},[s,g,v]),xZ({controls:y,emitEvent:b,props:t,state:u,store:l}),yZ({addFailure:d,controls:y,emitEvent:b,previousState:w,props:t,state:u,step:S,store:l}),bZ({emitEvent:b,previousState:w,props:t,state:u,step:S,store:l}),{controls:y,failures:p,mergedProps:t,state:u,step:S,store:l}}function SZ(e){const[t,n]=m.useState(null);return m.useEffect(()=>{let r=null,i=!1;if(e)if(Bn.domElement(e))r=e,i=!0;else{const s=document.querySelector(e);s&&(r=s)}else{const s=document.createElement("div");s.id=JQ,document.body.appendChild(s),r=s}return n(r),()=>{!r||i||r.parentNode===document.body&&document.body.removeChild(r)}},[e]),t}const NZ={animation:"joyride-loader-spin 1s linear infinite",border:"5px solid rgba(0, 0, 0, 0.1)",borderRadius:"50%",borderTopColor:"#555"};function jZ({nonce:e,step:t}){const{loaderComponent:n}=t,r=!!n;if(m.useEffect(()=>{if(r||document.getElementById("joyride-loader-animation"))return _u;const l=document.createElement("style");return l.id="joyride-loader-animation",e&&l.setAttribute("nonce",e),l.appendChild(document.createTextNode(`
|
|
168
|
+
@keyframes joyride-loader-spin {
|
|
169
|
+
to { transform: rotate(360deg); }
|
|
170
|
+
}
|
|
171
|
+
`)),document.head.appendChild(l),()=>{const u=document.getElementById("joyride-loader-animation");u!=null&&u.parentNode&&u.parentNode.removeChild(u)}},[r,e]),n===null)return null;const{height:i,width:s,...o}=t.styles.loader;let c;if(n){const l=n;c=De.createElement(l,{step:t})}else c=De.createElement("div",{style:{...NZ,height:i,width:s,borderTopColor:t.primaryColor}});return De.createElement("div",{className:"react-joyride__loader","data-testid":"loader",style:o},c)}const CZ={height:0,isFixed:!1,left:0,top:0,width:0};function gc(e,t){const n=Ur(e);if(!n)return CZ;const r=Qw(n),i=Tl(n),s=nZ(n,t.top,i);return{height:Math.round(((r==null?void 0:r.height)??0)+t.top+t.bottom),isFixed:i,left:Math.round(((r==null?void 0:r.left)??0)-t.left),top:s,width:Math.round(((r==null?void 0:r.width)??0)+t.left+t.right)}}function EZ(e,t,n){const[r,i]=m.useState(()=>gc(e,t)),s=m.useRef(void 0),o=m.useRef(null),c=m.useRef(n),l=m.useRef(null),u=m.useCallback(()=>{clearTimeout(s.current),s.current=window.setTimeout(()=>{i(f=>{const d=gc(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=Al(y,!0),o.current&&o.current.addEventListener("scroll",u,{passive:!0}),window.addEventListener("scroll",u,{passive:!0}),window.addEventListener("resize",u),typeof ResizeObserver<"u"&&(l.current=new ResizeObserver(u),l.current.observe(y)),i(gc(e,t))},h=Ur(e);return h?d(h):(f=new MutationObserver(()=>{const y=Ur(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=l.current)==null||y.disconnect(),clearTimeout(s.current)}},[e,t,u]),m.useEffect(()=>{c.current&&!n&&i(gc(e,t)),c.current=n},[n,e,t]);let p=r;return c.current&&!n&&(p=gc(e,t)),p}function _Z(e,t,n){let r=`M0 0H${e}V${t}H0Z`;return n&&(r+=` ${n}`),r}function LN(e,t,n,r,i){if(n<=0||r<=0)return"";const s=Math.max(0,Math.min(i,n/2,r/2));let o=`M${e+s} ${t}`;return o+=`H${e+n-s}`,o+=`A${s} ${s} 0 0 1 ${e+n} ${t+s}`,o+=`V${t+r-s}`,o+=`A${s} ${s} 0 0 1 ${e+n-s} ${t+r}`,o+=`H${e+s}`,o+=`A${s} ${s} 0 0 1 ${e} ${t+r-s}`,o+=`V${t+s}`,o+=`A${s} ${s} 0 0 1 ${e+s} ${t}Z`,o}const PZ=[Pe.BEACON_BEFORE,Pe.BEACON];function IZ(e){var D,K;const{blockTargetInteraction:t,continuous:n,hideOverlay:r,lifecycle:i,onClickOverlay:s,overlayClickAction:o,placement:c,portalElement:l,scrolling:u,spotlightPadding:p,spotlightRadius:f,spotlightTarget:d,styles:h,target:y,waiting:b}=e,k=oJ(),g=EZ(d??y,p,u||b),v=m.useRef(null),w=(i===Pe.TOOLTIP||i===Pe.TOOLTIP_BEFORE)&&c!=="center",[S,C]=m.useState(!1),N=l?(D=v.current)==null?void 0:D.offsetParent:null,P=(N==null?void 0:N.clientWidth)??k.width,R=(N==null?void 0:N.clientHeight)??tZ()??k.height,M=((K=h.overlay)==null?void 0:K.backgroundColor)??"rgba(0, 0, 0, 0.5)",U=m.useMemo(()=>{const{backgroundColor:_,mixBlendMode:I,...E}=h.overlay;return{height:R,pointerEvents:"none",...E}},[R,h.overlay]),L=w&&!u&&!b;m.useEffect(()=>{L?requestAnimationFrame(()=>C(!0)):C(!1)},[L]);const A=n&&PZ.includes(i),V=!n&&i!==Pe.TOOLTIP;if(r||!b&&(A||V))return null;let T="";if(L)if(l&&N){const _=Ur(d??y);if(_){const I=IN(_),E=IN(N);T=LN(I.left-E.left-p.left,I.top-E.top-p.top,_.offsetWidth+p.left+p.right,_.offsetHeight+p.top+p.bottom,f)}}else T=LN(g.left,g.top,g.width,g.height,f);const $=_Z(P,R,T);return De.createElement("div",{ref:v,"aria-hidden":"true",className:"react-joyride__overlay","data-testid":"overlay",style:U},De.createElement("svg",{className:"react-joyride__spotlight","data-testid":"spotlight",style:{height:R,left:0,position:g.isFixed?"fixed":"absolute",top:0,width:P}},De.createElement("path",{d:$,fill:M,fillRule:"evenodd",onClick:s,style:{cursor:o?"pointer":"default",pointerEvents:"auto"}}),T&&De.createElement("path",{d:T,fill:M,style:{opacity:S?0:1,pointerEvents:t?"auto":"none",transition:"opacity 0.2s"}}),T&&Object.keys(h.spotlight).length>0&&De.createElement("path",{d:T,fill:"none",style:{pointerEvents:"none"},...h.spotlight})))}function $I(e){const{children:t,element:n}=e;return n?Hr.createPortal(t,n):null}const AZ='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), area[href], [tabindex]:not([tabindex="-1"]), [contenteditable]';function TZ(e,t){const n=m.useRef(null);m.useEffect(()=>{if(!e)return _u;n.current=document.activeElement;const r=s=>{if(s.key!=="Tab")return;const o=[...e.querySelectorAll(AZ)],{shiftKey:c}=s;if(!o.length)return;s.preventDefault();let l=document.activeElement?o.indexOf(document.activeElement):0;l===-1||!c&&l+1===o.length?l=0:c&&l===0?l=o.length-1:l+=c?-1:1,o[l].focus()};e.addEventListener("keydown",r,!1);let i;{const s=e.querySelector(t);s&&(i=setTimeout(()=>{s.focus({preventScroll:!0})},100))}return()=>{var s;e.removeEventListener("keydown",r),i!==void 0&&clearTimeout(i),(s=n.current)==null||s.focus({preventScroll:!0})}},[e,t])}function os(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 RZ(e,t,n){const[r]=e.split("-");switch(r){case"top":return{points:`0,0 ${t/2},${n} ${t},0`,...os(e,t,n)};case"bottom":return{points:`${t},${n} ${t/2},0 0,${n}`,...os(e,t,n)};case"left":return{points:`0,0 ${n},${t/2} 0,${t}`,...os(e,t,n)};case"right":return{points:`${n},${t} ${n},0 0,${t/2}`,...os(e,t,n)};default:return null}}function LZ(e,t,n,r){if(!t)return{};const[i]=e.split("-");switch(i){case"top":return{bottom:-n,left:t.x??0,...os(e,r,n)};case"bottom":return{top:-n,left:t.x??0,...os(e,r,n)};case"left":return{right:-n,top:t.y??0,...os(e,r,n)};case"right":return{left:-n,top:t.y??0,...os(e,r,n)};default:return{}}}function OZ({arrowComponent:e,arrowRef:t,base:n,placement:r,position:i,size:s,styles:o}){const c=e;let l=null;if(c){if(!os(r,n,s))return null;l=De.createElement("span",{style:{flexShrink:0}},De.createElement(c,{base:n,placement:r,size:s}))}else{const u=RZ(r,n,s);if(!u)return null;l=De.createElement("svg",{height:u.height,width:u.width,xmlns:"http://www.w3.org/2000/svg"},De.createElement("polygon",{fill:"currentColor",points:u.points}))}return De.createElement("span",{ref:t,className:"react-joyride__arrow","data-testid":"arrow",style:{...o,...LZ(r,i,s,n),...i?{}:{visibility:"hidden"}}},l)}function MZ(e){const{beaconComponent:t,continuous:n,index:r,isLastStep:i,locale:s,nonce:o,onInteract:c,shouldFocus:l,size:u,step:p,styles:f}=e,d=m.useRef(null),h=!!t;m.useEffect(()=>{if(h||document.getElementById("joyride-beacon-animation"))return _u;const k=document.createElement("style");k.id="joyride-beacon-animation",o&&k.setAttribute("nonce",o),k.appendChild(document.createTextNode(`
|
|
172
|
+
@keyframes joyride-beacon-inner {
|
|
173
|
+
20% {
|
|
174
|
+
opacity: 0.9;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
90% {
|
|
178
|
+
opacity: 0.7;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
@keyframes joyride-beacon-outer {
|
|
183
|
+
0% {
|
|
184
|
+
transform: scale(1);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
45% {
|
|
188
|
+
opacity: 0.7;
|
|
189
|
+
transform: scale(0.75);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
100% {
|
|
193
|
+
opacity: 0.9;
|
|
194
|
+
transform: scale(1);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
`)),document.head.appendChild(k);const g=setTimeout(()=>{Bn.domElement(d.current)&&l&&d.current.focus()},0);return()=>{clearTimeout(g);const v=document.getElementById("joyride-beacon-animation");v!=null&&v.parentNode&&v.parentNode.removeChild(v)}},[h,o,l]);const y=ns(s.open);let b;if(t){const k=t;b=De.createElement(k,{continuous:n,index:r,isLastStep:i,size:u,step:p})}else b=De.createElement("span",{style:f.beacon},De.createElement("span",{style:f.beaconOuter}),De.createElement("span",{style:f.beaconInner}));return De.createElement("button",{ref:d,"aria-label":y,className:"react-joyride__beacon","data-testid":"button-beacon",onClick:c,onMouseEnter:c,style:f.beaconWrapper,title:y,type:"button"},b)}function $Z({styles:e,...t}){const{color:n,height:r,width:i,...s}=e;return De.createElement("button",{style:s,type:"button",...t},De.createElement("svg",{height:typeof r=="number"?`${r}px`:r,preserveAspectRatio:"xMidYMid",version:"1.1",viewBox:"0 0 18 18",width:typeof i=="number"?`${i}px`:i,xmlns:"http://www.w3.org/2000/svg"},De.createElement("g",null,De.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 DZ(e){const{backProps:t,closeProps:n,index:r,isLastStep:i,primaryProps:s,skipProps:o,step:c,tooltipProps:l}=e,{buttons:u,content:p,styles:f,title:d}=c,h={};u.includes("primary")&&(h.primary=De.createElement("button",{"data-testid":"button-primary",style:f.buttonPrimary,type:"button",...s})),u.includes("skip")&&!i&&(h.skip=De.createElement("button",{"aria-live":"off","data-testid":"button-skip",style:f.buttonSkip,type:"button",...o})),u.includes("back")&&r>0&&(h.back=De.createElement("button",{"data-testid":"button-back",style:f.buttonBack,type:"button",...t})),h.close=u.includes("close")&&De.createElement($Z,{"data-testid":"button-close",styles:f.buttonClose,...n});const y=d?{"aria-labelledby":"joyride-tooltip-title","aria-describedby":"joyride-tooltip-content"}:{"aria-label":ns(p),"aria-describedby":"joyride-tooltip-content"};return De.createElement("div",{key:"JoyrideTooltip",className:"react-joyride__tooltip","data-joyride-step":r,...c.id&&{"data-joyride-id":c.id},style:f.tooltip,...l,...y},De.createElement("div",{style:f.tooltipContainer},d&&De.createElement("h4",{id:"joyride-tooltip-title",style:f.tooltipTitle},d),De.createElement("div",{id:"joyride-tooltip-content",style:f.tooltipContent},p)),u.some(b=>b==="back"||b==="primary"||b==="skip")&&De.createElement("div",{style:f.tooltipFooter},De.createElement("div",{style:f.tooltipFooterSpacer},h.skip),h.back,h.primary),h.close)}function FZ(e){const{continuous:t,controls:n,index:r,isLastStep:i,size:s,step:o}=e,c=g=>{g.preventDefault(),n.prev(Ai.BUTTON_BACK)},l=g=>{g.preventDefault(),o.closeButtonAction==="skip"?n.skip(Ai.BUTTON_CLOSE):n.close(Ai.BUTTON_CLOSE)},u=g=>{if(g.preventDefault(),!t){n.close(Ai.BUTTON_PRIMARY);return}n.next(Ai.BUTTON_PRIMARY)},p=g=>{g.preventDefault(),n.skip(Ai.BUTTON_SKIP)},f=()=>{const{back:g,close:v,last:w,next:S,nextWithProgress:C,skip:N}=o.locale,P=ns(g),R=ns(v),M=ns(w),U=ns(S),L=ns(N);let A=v,V=R;if(t){if(A=S,V=U,o.showProgress&&!i){const T=ns(C,{step:r+1,steps:s});A=nx(C,r+1,s),V=T}i&&(A=w,V=M)}return{backProps:{"aria-label":P,children:g,"data-action":"back",onClick:c,role:"button",title:P},closeProps:{"aria-label":R,children:v,"data-action":"close",onClick:l,role:"button",title:R},primaryProps:{"aria-label":V,children:A,"data-action":"primary",onClick:u,role:"button",title:V},skipProps:{"aria-label":L,children:N,"data-action":"skip",onClick:p,role:"button",title:L},tooltipProps:{"aria-modal":!0,role:"alertdialog"}}},{arrowComponent:d,beaconComponent:h,tooltipComponent:y,...b}=o;let k;if(y){const g=y;k=De.createElement(g,{...f(),continuous:t,controls:n,index:r,isLastStep:i,size:s,step:b})}else k=De.createElement(DZ,{...f(),continuous:t,controls:n,index:r,isLastStep:i,size:s,step:b});return k}function zZ(e){if(e.startsWith("left"))return["top","bottom"];if(e.startsWith("right"))return["bottom","top"]}function BZ(e,t,n){var r,i;return e?[WQ()]:((r=t.floatingOptions)==null?void 0:r.flipOptions)===!1?[]:[VQ({crossAxis:!1,fallbackPlacements:zZ(n),padding:20,...(i=t.floatingOptions)==null?void 0:i.flipOptions})]}function HZ(e){var I,E,Y,G,F;const{continuous:t,controls:n,index:r,lifecycle:i,nonce:s,open:o,portalElement:c,setPositionData:l,setTooltipRef:u,shouldScroll:p,size:f,step:d,target:h,updateState:y}=e,b=m.useRef(null),k=m.useRef({}),g=m.useRef({}),v=d.placement==="center",w=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(()=>RI(h)?Al(h):void 0,[h]),N=m.useMemo(()=>Tl(h),[h]),P=m.useMemo(()=>C?{boundary:C,rootBoundary:"viewport"}:{},[C]),R=v||w?"bottom":d.placement,M=v?"fixed":((I=d.floatingOptions)==null?void 0:I.strategy)??(d.isFixed||N?"fixed":"absolute"),U=m.useMemo(()=>{var Z,oe,ue,ce;return v?[{name:"center",fn:({rects:le})=>({x:(window.innerWidth-le.floating.width)/2,y:(window.innerHeight-le.floating.height)/2})}]:[EN(({placement:le})=>{var de;let ve="right";le.startsWith("top")?ve="top":le.startsWith("bottom")?ve="bottom":le.startsWith("left")&&(ve="left");const ie=d.spotlightTarget?0:d.spotlightPadding[ve];return d.offset+ie+((de=d.floatingOptions)!=null&&de.hideArrow?0:d.arrowSize)},[d.offset,d.spotlightPadding,d.spotlightTarget,d.arrowSize,(Z=d.floatingOptions)==null?void 0:Z.hideArrow]),...BZ(w,d,R),UQ({padding:10,...P,...(oe=d.floatingOptions)==null?void 0:oe.shiftOptions}),...(ue=d.floatingOptions)!=null&&ue.hideArrow?[]:[KQ({element:b,padding:d.arrowSpacing},[d.arrowSpacing,d.arrowBase])],...((ce=d.floatingOptions)==null?void 0:ce.middleware)??[]]},[v,d,w,R,P]),L=CN({...v?{elements:{reference:S}}:{},placement:R,strategy:M,middleware:U}),A=CN({strategy:M,placement:d.beaconPlacement??(w||v?"bottom":d.placement),middleware:m.useMemo(()=>{var Z,oe;return[EN(((oe=(Z=d.floatingOptions)==null?void 0:Z.beaconOptions)==null?void 0:oe.offset)??-18)]},[(Y=(E=d.floatingOptions)==null?void 0:E.beaconOptions)==null?void 0:Y.offset]),whileElementsMounted:SN});g.current=L.middlewareData,k.current=A.middlewareData,m.useEffect(()=>{var ue;const{floating:Z,reference:oe}=L.elements;if(!(!oe||!Z||i!==Pe.TOOLTIP))return SN(oe,Z,L.update,(ue=d.floatingOptions)==null?void 0:ue.autoUpdate)},[i,L.update,(G=d.floatingOptions)==null?void 0:G.autoUpdate,d.target,L.elements]),m.useEffect(()=>{!v&&h&&L.refs.setReference(h),h&&A.refs.setReference(h)},[A.refs,v,h,L.refs]),m.useEffect(()=>{L.isPositioned&&l("tooltip",{placement:L.placement,x:L.x??0,y:L.y??0,middlewareData:g.current})},[l,L.isPositioned,L.placement,L.x,L.y]),m.useEffect(()=>{A.isPositioned&&l("beacon",{placement:A.placement,x:A.x??0,y:A.y??0,middlewareData:k.current})},[l,A.isPositioned,A.placement,A.x,A.y]);const V=d.zIndex+100,T=m.useCallback(Z=>{Z.type==="mouseenter"&&d.beaconTrigger!=="hover"||y({lifecycle:Pe.TOOLTIP_BEFORE,positioned:!1})},[d.beaconTrigger,y]),$=m.useCallback(Z=>{Z&&(L.refs.setFloating(Z),u(Z))},[L.refs,u]),{arrow:D,floater:K}=d.styles;let _=null;if(i===Pe.TOOLTIP||i===Pe.TOOLTIP_BEFORE){const Z=PN({...K,...L.floatingStyles,zIndex:V,opacity:o&&L.isPositioned?1:0,...!o&&{transition:"none"}});_=De.createElement("div",{ref:$,className:"react-joyride__floater","data-testid":"floater",id:`react-joyride-step-${r}`,style:Z},De.createElement(FZ,{continuous:t,controls:n,index:r,isLastStep:r+1===f,size:f,step:d}),!v&&!((F=d.floatingOptions)!=null&&F.hideArrow)&&De.createElement(OZ,{arrowComponent:d.arrowComponent,arrowRef:b,base:d.arrowBase,placement:L.placement,position:L.middlewareData.arrow,size:d.arrowSize,styles:D}))}else(i===Pe.BEACON||i===Pe.BEACON_BEFORE)&&(_=De.createElement("div",{ref:A.refs.setFloating,className:"react-joyride__floater","data-testid":"floater-beacon",id:`react-joyride-step-${r}-beacon`,style:PN({...A.floatingStyles,zIndex:V})},De.createElement(MZ,{beaconComponent:d.beaconComponent,continuous:t,index:r,isLastStep:r+1===f,locale:d.locale,nonce:s,onInteract:T,shouldFocus:p,size:f,step:d,styles:d.styles})));return De.createElement($I,{element:c},_)}function UZ(e){const{continuous:t,controls:n,index:r,lifecycle:i,nonce:s,portalElement:o,setPositionData:c,shouldScroll:l,size:u,step:p,updateState:f}=e,[d,h]=m.useState(null);TZ(p.disableFocusTrap?null:d,"[data-action=primary]");const y=Ur(p.target),b=i===Pe.TOOLTIP;return!OI(p)||!Bn.domElement(y)?null:De.createElement(HZ,{key:`JoyrideStep-${r}`,continuous:t,controls:n,index:r,lifecycle:i,nonce:s,open:b,portalElement:o,setPositionData:c,setTooltipRef:h,shouldScroll:l,size:u,step:p,target:y,updateState:f})}function VZ({controls:e,mergedProps:t,state:n,step:r,store:i}){const{continuous:s,debug:o,nonce:c,portalElement:l,scrollToFirstStep:u}=t,p=SZ(l),{index:f,lifecycle:d,status:h}=n,y=h===it.RUNNING,[b,k]=m.useState(!1),g=m.useRef(null),v=(r==null?void 0:r.loaderDelay)??0;m.useEffect(()=>(n.waiting?v===0?k(!0):g.current=setTimeout(()=>{k(!0)},v):k(!1),()=>{g.current&&(clearTimeout(g.current),g.current=null)}),[v,n.waiting]),m.useEffect(()=>{if(!y)return;const C=N=>{!r||d!==Pe.TOOLTIP||N.key==="Escape"&&r.dismissKeyAction&&(r.dismissKeyAction==="next"?e.next(Ai.KEYBOARD):e.close(Ai.KEYBOARD))};return document.body.addEventListener("keydown",C,{passive:!0}),()=>{document.body.removeEventListener("keydown",C)}},[e,y,d,r]);const w=m.useCallback(()=>{(r==null?void 0:r.overlayClickAction)==="close"?e.close(Ai.OVERLAY):(r==null?void 0:r.overlayClickAction)==="next"&&e.next(Ai.OVERLAY)},[e,r==null?void 0:r.overlayClickAction]);if(!r||!y)return null;const S=n.action===lt.START&&!r.skipBeacon&&r.placement!=="center";return De.createElement(De.Fragment,null,d!==Pe.INIT&&De.createElement(UZ,{...n,continuous:s,controls:e,debug:o,nonce:c,portalElement:p,setPositionData:i.current.setPositionData,shouldScroll:!r.skipScroll&&(f!==0||u),step:r,updateState:i.current.updateState}),De.createElement($I,{element:p},De.createElement(De.Fragment,null,b&&De.createElement(jZ,{nonce:c,step:r}),!S&&De.createElement(IZ,{...r,continuous:s,lifecycle:d,onClickOverlay:w,portalElement:l?p:null,scrolling:n.scrolling,waiting:n.waiting}))))}function WZ(e){const{controls:t,failures:n,mergedProps:r,state:i,step:s,store:o}=kZ(e);return{controls:t,failures:n,on:m.useCallback((c,l)=>o.current.on(c,l),[o]),state:m.useMemo(()=>Fp(i,"positioned"),[i]),step:s,Tour:Jw()?De.createElement(VZ,{controls:t,mergedProps:r,state:i,step:s,store:o}):null}}function KZ(e){const{Tour:t}=WZ(e);return t}function qZ(e){return Jw()?De.createElement(KZ,e):null}function YZ(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 GZ(e){return[{target:"body",content:e("onboarding:flow.intro"),disableBeacon:!0,placement:"center"}]}function XZ(e){return[{target:"body",content:e("onboarding:flow.introEmpty"),disableBeacon:!0,placement:"center"}]}const hg="af:onboarding";function JZ({page:e,hasNodes:t=!1}){const{t:n}=_t(),[r,i]=m.useState(!1),[s,o]=m.useState([]),c=m.useRef(null),l=m.useMemo(()=>e==="projects"?YZ(n):t?GZ(n):XZ(n),[e,t,n]);return m.useEffect(()=>{const u=localStorage.getItem(hg);console.log("[Onboarding] localStorage:",u);const p=u?JSON.parse(u):{};if(console.log("[Onboarding] progress:",p,"page:",e),p.completed||p[e]){console.log("[Onboarding] skipped - already done"),i(!1),o([]);return}console.log("[Onboarding] starting with steps:",l),o(l),i(!0)},[e,t,l]),m.useEffect(()=>{if(!r)return;const u=p=>{var y;const f=p.target.closest("button");if(!f||!f.closest(".react-joyride__tooltip"))return;const h=(y=f.textContent)==null?void 0:y.trim();if(h===n("onboarding:done")||h===n("onboarding:startCreate")||h===n("onboarding:skip")){const b=localStorage.getItem(hg)||"{}",k=JSON.parse(b);h===n("onboarding:skip")?(k.projects=!0,k.flow=!0,k.completed=!0):k[e]=!0,localStorage.setItem(hg,JSON.stringify(k)),o([]),i(!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||s.length===0?null:a.jsx(qZ,{ref:c,steps:s,run:r,continuous:!0,showSkipButton:!0,showProgress:s.length>1,styles:{options:{primaryColor:"#7c4dff",textColor:"#ffffff",backgroundColor:"#1a1a1a",arrowColor:"#1a1a1a",overlayColor:"rgba(0, 0, 0, 0.4)",zIndex:1e4},tooltip:{borderRadius:"1.5rem",padding:"1.5rem"},buttonNext:{borderRadius:"9999px",padding:"0.625rem 1.5rem"},buttonSkip:{borderRadius:"9999px",color:"#9ecaff"},buttonClose:{display:"none"}},locale:{back:n("onboarding:back"),next:n("onboarding:next"),skip:n("onboarding:skip"),last:n(e==="projects"?"onboarding:startCreate":"onboarding:done")},floaterProps:{disableAnimation:!0},scrollToFirstStep:!0})}function QZ(){const{navigate:e,path:t}=ia(),[n,r]=m.useState([]),[i,s]=m.useState(!1);if(m.useEffect(()=>{let p=!1;const f=async()=>{try{const h=await fetch("/api/pipeline-recent-runs");if(!h.ok)return;const y=await h.json();if(p)return;const b=Array.isArray(y.runs)?y.runs:[];r(b.filter(k=>k&&k.status==="running"))}catch{}};f();const d=window.setInterval(f,3e3);return()=>{p=!0,window.clearInterval(d)}},[]),n.length===0)return null;const o=p=>{const f=new URLSearchParams({flowId:p.flowId,flowSource:p.flowSource||"workspace"});e(`/flow?${f.toString()}`),s(!1)},c=t==="/flow"?new URLSearchParams(window.location.search):null,l=(c==null?void 0:c.get("flowId"))||"",u=n.length===1;return a.jsxs("div",{className:"af-run-indicator",role:"status","aria-live":"polite",children:[i&&!u&&a.jsx("div",{className:"af-run-indicator__menu",onMouseLeave:()=>s(!1),children:n.map(p=>a.jsxs("button",{type:"button",className:"af-run-indicator__item"+(p.flowId===l?" 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]):s(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`})]})]})}class ZZ extends m.Component{constructor(t){super(t),this.state={error:null,info:null}}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,n){console.error("[AgentFlow UI render error]",t,n),this.setState({error:t,info:n})}render(){var r,i,s;if(!this.state.error)return this.props.children;const t=String(((r=this.state.error)==null?void 0:r.stack)||((i=this.state.error)==null?void 0:i.message)||this.state.error),n=String(((s=this.state.info)==null?void 0:s.componentStack)||"");return a.jsx("div",{className:"af-auth-screen",children:a.jsxs("div",{className:"af-auth-panel af-ui-error-panel",children:[a.jsxs("div",{className:"af-auth-brand",children:[a.jsx("span",{className:"material-symbols-outlined",children:"error"}),a.jsxs("div",{children:[a.jsx("h1",{children:"AgentFlow UI Error"}),a.jsx("p",{children:"页面渲染失败,下面是调试堆栈。"})]})]}),a.jsx("pre",{children:t}),n?a.jsx("pre",{children:n}):null]})})}}function eee(){const{path:e}=ia();return e==="/projects"||e==="/"?a.jsx(Kd,{}):e==="/nodes"?a.jsx(Kd,{resourceKind:"nodes"}):e==="/skills"?a.jsx(Kd,{resourceKind:"skills"}):e==="/flow"?a.jsx(yV,{}):e==="/workspace"?a.jsx(GV,{}):e==="/settings"?a.jsx(BX,{}):a.jsx(Kd,{})}function tee({children:e}){const[t,n]=m.useState({loading:!0,authenticated:!1,user:null,setupRequired:!1}),[r,i]=m.useState(""),[s,o]=m.useState(""),[c,l]=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})}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(),l(!0),p("");try{const y=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:r,password:s})}),b=await y.json().catch(()=>({}));if(!y.ok)throw new Error(b.error||"登录失败");n({loading:!1,authenticated:!0,user:b.user||null,setupRequired:!1})}catch(y){p(String(y.message||y))}finally{l(!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=>i(h.target.value),autoComplete:"username",autoFocus:!0})]}),a.jsxs("label",{className:"af-auth-field",children:[a.jsx("span",{children:"密码"}),a.jsx("input",{type:"password",value:s,onChange:h=>o(h.target.value),autoComplete:t.setupRequired?"new-password":"current-password"})]}),u?a.jsx("p",{className:"af-auth-error",children:u}):null,a.jsx("button",{className:"af-auth-submit",type:"submit",disabled:c||!r.trim()||s.length<4,children:c?"处理中...":t.setupRequired?"创建并登录":"登录"})]})})}function nee({authUser:e,onLogout:t}){const{path:n}=ia(),r=n==="/flow"||n==="/workspace";return a.jsxs("div",{className:"af-app",children:[n!=="/settings"?a.jsx(JZ,{page:r?"flow":"projects"}):null,r?null:a.jsx(LR,{authUser:e,onLogout:t}),a.jsx("div",{className:r?"af-main af-main--pipeline":"af-main",children:a.jsx(eee,{})}),a.jsx(QZ,{})]})}function ree(){return a.jsx(ZZ,{children:a.jsx(mR,{children:a.jsx(tee,{children:({user:e,onLogout:t})=>a.jsx(nee,{authUser:e,onLogout:t})})})})}window.addEventListener("error",e=>{console.error("[AgentFlow UI global error]",e.error||e.message,{filename:e.filename,lineno:e.lineno,colno:e.colno})});window.addEventListener("unhandledrejection",e=>{console.error("[AgentFlow UI unhandled rejection]",e.reason)});const ON=document.querySelector('link[rel="icon"]');ON&&(ON.href=Jj);mg.createRoot(document.getElementById("root")).render(a.jsx(De.StrictMode,{children:a.jsx(ree,{})}));
|