@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
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
var WI=Object.defineProperty;var KI=(e,t,n)=>t in e?WI(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var $t=(e,t,n)=>KI(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 mc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function _s(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t1={exports:{}},pp={},n1={exports:{}},Ze={};/**
|
|
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 Zc=Symbol.for("react.element"),YI=Symbol.for("react.portal"),qI=Symbol.for("react.fragment"),GI=Symbol.for("react.strict_mode"),XI=Symbol.for("react.profiler"),JI=Symbol.for("react.provider"),QI=Symbol.for("react.context"),ZI=Symbol.for("react.forward_ref"),eA=Symbol.for("react.suspense"),tA=Symbol.for("react.memo"),nA=Symbol.for("react.lazy"),av=Symbol.iterator;function rA(e){return e===null||typeof e!="object"?null:(e=av&&e[av]||e["@@iterator"],typeof e=="function"?e:null)}var r1={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},i1=Object.assign,s1={};function Ba(e,t,n){this.props=e,this.context=t,this.refs=s1,this.updater=n||r1}Ba.prototype.isReactComponent={};Ba.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")};Ba.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function o1(){}o1.prototype=Ba.prototype;function Py(e,t,n){this.props=e,this.context=t,this.refs=s1,this.updater=n||r1}var _y=Py.prototype=new o1;_y.constructor=Py;i1(_y,Ba.prototype);_y.isPureReactComponent=!0;var lv=Array.isArray,a1=Object.prototype.hasOwnProperty,Iy={current:null},l1={key:!0,ref:!0,__self:!0,__source:!0};function c1(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)a1.call(t,r)&&!l1.hasOwnProperty(r)&&(i[r]=t[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1<a){for(var c=Array(a),u=0;u<a;u++)c[u]=arguments[u+2];i.children=c}if(e&&e.defaultProps)for(r in a=e.defaultProps,a)i[r]===void 0&&(i[r]=a[r]);return{$$typeof:Zc,type:e,key:s,ref:o,props:i,_owner:Iy.current}}function iA(e,t){return{$$typeof:Zc,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Ay(e){return typeof e=="object"&&e!==null&&e.$$typeof===Zc}function sA(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var cv=/\/+/g;function _h(e,t){return typeof e=="object"&&e!==null&&e.key!=null?sA(""+e.key):t.toString(36)}function Vd(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 Zc:case YI:o=!0}}if(o)return o=e,i=i(o),e=r===""?"."+_h(o,0):r,lv(i)?(n="",e!=null&&(n=e.replace(cv,"$&/")+"/"),Vd(i,t,n,"",function(u){return u})):i!=null&&(Ay(i)&&(i=iA(i,n+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(cv,"$&/")+"/")+e)),t.push(i)),1;if(o=0,r=r===""?".":r+":",lv(e))for(var a=0;a<e.length;a++){s=e[a];var c=r+_h(s,a);o+=Vd(s,t,n,c,i)}else if(c=rA(e),typeof c=="function")for(e=c.call(e),a=0;!(s=e.next()).done;)s=s.value,c=r+_h(s,a++),o+=Vd(s,t,n,c,i);else if(s==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function Zu(e,t,n){if(e==null)return e;var r=[],i=0;return Vd(e,r,"","",function(s){return t.call(n,s,i++)}),r}function oA(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 Tn={current:null},Wd={transition:null},aA={ReactCurrentDispatcher:Tn,ReactCurrentBatchConfig:Wd,ReactCurrentOwner:Iy};function u1(){throw Error("act(...) is not supported in production builds of React.")}Ze.Children={map:Zu,forEach:function(e,t,n){Zu(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Zu(e,function(){t++}),t},toArray:function(e){return Zu(e,function(t){return t})||[]},only:function(e){if(!Ay(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ze.Component=Ba;Ze.Fragment=qI;Ze.Profiler=XI;Ze.PureComponent=Py;Ze.StrictMode=GI;Ze.Suspense=eA;Ze.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=aA;Ze.act=u1;Ze.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=i1({},e.props),i=e.key,s=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,o=Iy.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(c in t)a1.call(t,c)&&!l1.hasOwnProperty(c)&&(r[c]=t[c]===void 0&&a!==void 0?a[c]:t[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){a=Array(c);for(var u=0;u<c;u++)a[u]=arguments[u+2];r.children=a}return{$$typeof:Zc,type:e.type,key:i,ref:s,props:r,_owner:o}};Ze.createContext=function(e){return e={$$typeof:QI,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:JI,_context:e},e.Consumer=e};Ze.createElement=c1;Ze.createFactory=function(e){var t=c1.bind(null,e);return t.type=e,t};Ze.createRef=function(){return{current:null}};Ze.forwardRef=function(e){return{$$typeof:ZI,render:e}};Ze.isValidElement=Ay;Ze.lazy=function(e){return{$$typeof:nA,_payload:{_status:-1,_result:e},_init:oA}};Ze.memo=function(e,t){return{$$typeof:tA,type:e,compare:t===void 0?null:t}};Ze.startTransition=function(e){var t=Wd.transition;Wd.transition={};try{e()}finally{Wd.transition=t}};Ze.unstable_act=u1;Ze.useCallback=function(e,t){return Tn.current.useCallback(e,t)};Ze.useContext=function(e){return Tn.current.useContext(e)};Ze.useDebugValue=function(){};Ze.useDeferredValue=function(e){return Tn.current.useDeferredValue(e)};Ze.useEffect=function(e,t){return Tn.current.useEffect(e,t)};Ze.useId=function(){return Tn.current.useId()};Ze.useImperativeHandle=function(e,t,n){return Tn.current.useImperativeHandle(e,t,n)};Ze.useInsertionEffect=function(e,t){return Tn.current.useInsertionEffect(e,t)};Ze.useLayoutEffect=function(e,t){return Tn.current.useLayoutEffect(e,t)};Ze.useMemo=function(e,t){return Tn.current.useMemo(e,t)};Ze.useReducer=function(e,t,n){return Tn.current.useReducer(e,t,n)};Ze.useRef=function(e){return Tn.current.useRef(e)};Ze.useState=function(e){return Tn.current.useState(e)};Ze.useSyncExternalStore=function(e,t,n){return Tn.current.useSyncExternalStore(e,t,n)};Ze.useTransition=function(){return Tn.current.useTransition()};Ze.version="18.3.1";n1.exports=Ze;var m=n1.exports;const Le=_s(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 lA=m,cA=Symbol.for("react.element"),uA=Symbol.for("react.fragment"),dA=Object.prototype.hasOwnProperty,fA=lA.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,pA={key:!0,ref:!0,__self:!0,__source:!0};function d1(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)dA.call(t,r)&&!pA.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:cA,type:e,key:s,ref:o,props:i,_owner:fA.current}}pp.Fragment=uA;pp.jsx=d1;pp.jsxs=d1;t1.exports=pp;var l=t1.exports,Bm={},f1={exports:{}},or={},p1={exports:{}},h1={};/**
|
|
18
|
-
* @license React
|
|
19
|
-
* scheduler.production.min.js
|
|
20
|
-
*
|
|
21
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
-
*
|
|
23
|
-
* This source code is licensed under the MIT license found in the
|
|
24
|
-
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/(function(e){function t(I,T){var E=I.length;I.push(T);e:for(;0<E;){var q=E-1>>>1,W=I[q];if(0<i(W,T))I[q]=T,I[E]=W,E=q;else break e}}function n(I){return I.length===0?null:I[0]}function r(I){if(I.length===0)return null;var T=I[0],E=I.pop();if(E!==T){I[0]=E;e:for(var q=0,W=I.length,O=W>>>1;q<O;){var X=2*(q+1)-1,se=I[X],re=X+1,de=I[re];if(0>i(se,E))re<W&&0>i(de,se)?(I[q]=de,I[re]=E,q=re):(I[q]=se,I[X]=E,q=X);else if(re<W&&0>i(de,E))I[q]=de,I[re]=E,q=re;else break e}}return T}function i(I,T){var E=I.sortIndex-T.sortIndex;return E!==0?E:I.id-T.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var c=[],u=[],p=1,d=null,f=3,h=!1,g=!1,b=!1,k=typeof setTimeout=="function"?setTimeout:null,y=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(I){for(var T=n(u);T!==null;){if(T.callback===null)r(u);else if(T.startTime<=I)r(u),T.sortIndex=T.expirationTime,t(c,T);else break;T=n(u)}}function N(I){if(b=!1,w(I),!g)if(n(c)!==null)g=!0,$(C);else{var T=n(u);T!==null&&F(N,T.startTime-I)}}function C(I,T){g=!1,b&&(b=!1,y(R),R=-1),h=!0;var E=f;try{for(w(T),d=n(c);d!==null&&(!(d.expirationTime>T)||I&&!_());){var q=d.callback;if(typeof q=="function"){d.callback=null,f=d.priorityLevel;var W=q(d.expirationTime<=T);T=e.unstable_now(),typeof W=="function"?d.callback=W:d===n(c)&&r(c),w(T)}else r(c);d=n(c)}if(d!==null)var O=!0;else{var X=n(u);X!==null&&F(N,X.startTime-T),O=!1}return O}finally{d=null,f=E,h=!1}}var S=!1,P=null,R=-1,M=5,H=-1;function _(){return!(e.unstable_now()-H<M)}function A(){if(P!==null){var I=e.unstable_now();H=I;var T=!0;try{T=P(!0,I)}finally{T?U():(S=!1,P=null)}}else S=!1}var U;if(typeof v=="function")U=function(){v(A)};else if(typeof MessageChannel<"u"){var L=new MessageChannel,B=L.port2;L.port1.onmessage=A,U=function(){B.postMessage(null)}}else U=function(){k(A,0)};function $(I){P=I,S||(S=!0,U())}function F(I,T){R=k(function(){I(e.unstable_now())},T)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(I){I.callback=null},e.unstable_continueExecution=function(){g||h||(g=!0,$(C))},e.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<I?Math.floor(1e3/I):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(I){switch(f){case 1:case 2:case 3:var T=3;break;default:T=f}var E=f;f=T;try{return I()}finally{f=E}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(I,T){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var E=f;f=I;try{return T()}finally{f=E}},e.unstable_scheduleCallback=function(I,T,E){var q=e.unstable_now();switch(typeof E=="object"&&E!==null?(E=E.delay,E=typeof E=="number"&&0<E?q+E:q):E=q,I){case 1:var W=-1;break;case 2:W=250;break;case 5:W=1073741823;break;case 4:W=1e4;break;default:W=5e3}return W=E+W,I={id:p++,callback:T,priorityLevel:I,startTime:E,expirationTime:W,sortIndex:-1},E>q?(I.sortIndex=E,t(u,I),n(c)===null&&I===n(u)&&(b?(y(R),R=-1):b=!0,F(N,E-q))):(I.sortIndex=W,t(c,I),g||h||(g=!0,$(C))),I},e.unstable_shouldYield=_,e.unstable_wrapCallback=function(I){var T=f;return function(){var E=f;f=T;try{return I.apply(this,arguments)}finally{f=E}}}})(h1);p1.exports=h1;var hA=p1.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 mA=m,ir=hA;function ae(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 m1=new Set,gc={};function vo(e,t){ba(e,t),ba(e+"Capture",t)}function ba(e,t){for(gc[e]=t,e=0;e<t.length;e++)m1.add(t[e])}var Oi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Hm=Object.prototype.hasOwnProperty,gA=/^[: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]*$/,uv={},dv={};function yA(e){return Hm.call(dv,e)?!0:Hm.call(uv,e)?!1:gA.test(e)?dv[e]=!0:(uv[e]=!0,!1)}function xA(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 wA(e,t,n,r){if(t===null||typeof t>"u"||xA(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 Rn(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 dn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){dn[e]=new Rn(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];dn[t]=new Rn(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){dn[e]=new Rn(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){dn[e]=new Rn(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){dn[e]=new Rn(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){dn[e]=new Rn(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){dn[e]=new Rn(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){dn[e]=new Rn(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){dn[e]=new Rn(e,5,!1,e.toLowerCase(),null,!1,!1)});var Ty=/[\-:]([a-z])/g;function Ry(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(Ty,Ry);dn[t]=new Rn(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(Ty,Ry);dn[t]=new Rn(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(Ty,Ry);dn[t]=new Rn(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){dn[e]=new Rn(e,1,!1,e.toLowerCase(),null,!1,!1)});dn.xlinkHref=new Rn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){dn[e]=new Rn(e,1,!1,e.toLowerCase(),null,!0,!0)});function Ly(e,t,n,r){var i=dn.hasOwnProperty(t)?dn[t]:null;(i!==null?i.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(wA(t,n,i,r)&&(n=null),r||i===null?yA(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 Hi=mA.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,ed=Symbol.for("react.element"),Wo=Symbol.for("react.portal"),Ko=Symbol.for("react.fragment"),Oy=Symbol.for("react.strict_mode"),Um=Symbol.for("react.profiler"),g1=Symbol.for("react.provider"),y1=Symbol.for("react.context"),My=Symbol.for("react.forward_ref"),Vm=Symbol.for("react.suspense"),Wm=Symbol.for("react.suspense_list"),Dy=Symbol.for("react.memo"),rs=Symbol.for("react.lazy"),x1=Symbol.for("react.offscreen"),fv=Symbol.iterator;function El(e){return e===null||typeof e!="object"?null:(e=fv&&e[fv]||e["@@iterator"],typeof e=="function"?e:null)}var Mt=Object.assign,Ih;function Vl(e){if(Ih===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Ih=t&&t[1]||""}return`
|
|
34
|
-
`+Ih+e}var Ah=!1;function Th(e,t){if(!e||Ah)return"";Ah=!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,a=s.length-1;1<=o&&0<=a&&i[o]!==s[a];)a--;for(;1<=o&&0<=a;o--,a--)if(i[o]!==s[a]){if(o!==1||a!==1)do if(o--,a--,0>a||i[o]!==s[a]){var c=`
|
|
37
|
-
`+i[o].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=o&&0<=a);break}}}finally{Ah=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Vl(e):""}function vA(e){switch(e.tag){case 5:return Vl(e.type);case 16:return Vl("Lazy");case 13:return Vl("Suspense");case 19:return Vl("SuspenseList");case 0:case 2:case 15:return e=Th(e.type,!1),e;case 11:return e=Th(e.type.render,!1),e;case 1:return e=Th(e.type,!0),e;default:return""}}function Km(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 Ko:return"Fragment";case Wo:return"Portal";case Um:return"Profiler";case Oy:return"StrictMode";case Vm:return"Suspense";case Wm:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case y1:return(e.displayName||"Context")+".Consumer";case g1:return(e._context.displayName||"Context")+".Provider";case My:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Dy:return t=e.displayName||null,t!==null?t:Km(e.type)||"Memo";case rs:t=e._payload,e=e._init;try{return Km(e(t))}catch{}}return null}function bA(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 Km(t);case 8:return t===Oy?"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 Ss(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function w1(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function kA(e){var t=w1(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 td(e){e._valueTracker||(e._valueTracker=kA(e))}function v1(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=w1(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function hf(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 Ym(e,t){var n=t.checked;return Mt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function pv(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Ss(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 b1(e,t){t=t.checked,t!=null&&Ly(e,"checked",t,!1)}function qm(e,t){b1(e,t);var n=Ss(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")?Gm(e,t.type,n):t.hasOwnProperty("defaultValue")&&Gm(e,t.type,Ss(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function hv(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 Gm(e,t,n){(t!=="number"||hf(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Wl=Array.isArray;function ua(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=""+Ss(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 Xm(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(ae(91));return Mt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function mv(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(ae(92));if(Wl(n)){if(1<n.length)throw Error(ae(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Ss(n)}}function k1(e,t){var n=Ss(t.value),r=Ss(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 gv(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function S1(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 Jm(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?S1(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var nd,N1=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(nd=nd||document.createElement("div"),nd.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=nd.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function yc(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Jl={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},SA=["Webkit","ms","Moz","O"];Object.keys(Jl).forEach(function(e){SA.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Jl[t]=Jl[e]})});function j1(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Jl.hasOwnProperty(e)&&Jl[e]?(""+t).trim():t+"px"}function C1(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=j1(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var NA=Mt({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 Qm(e,t){if(t){if(NA[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(ae(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(ae(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(ae(61))}if(t.style!=null&&typeof t.style!="object")throw Error(ae(62))}}function Zm(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 eg=null;function $y(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var tg=null,da=null,fa=null;function yv(e){if(e=nu(e)){if(typeof tg!="function")throw Error(ae(280));var t=e.stateNode;t&&(t=xp(t),tg(e.stateNode,e.type,t))}}function E1(e){da?fa?fa.push(e):fa=[e]:da=e}function P1(){if(da){var e=da,t=fa;if(fa=da=null,yv(e),t)for(e=0;e<t.length;e++)yv(t[e])}}function _1(e,t){return e(t)}function I1(){}var Rh=!1;function A1(e,t,n){if(Rh)return e(t,n);Rh=!0;try{return _1(e,t,n)}finally{Rh=!1,(da!==null||fa!==null)&&(I1(),P1())}}function xc(e,t){var n=e.stateNode;if(n===null)return null;var r=xp(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(ae(231,t,typeof n));return n}var ng=!1;if(Oi)try{var Pl={};Object.defineProperty(Pl,"passive",{get:function(){ng=!0}}),window.addEventListener("test",Pl,Pl),window.removeEventListener("test",Pl,Pl)}catch{ng=!1}function jA(e,t,n,r,i,s,o,a,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(p){this.onError(p)}}var Ql=!1,mf=null,gf=!1,rg=null,CA={onError:function(e){Ql=!0,mf=e}};function EA(e,t,n,r,i,s,o,a,c){Ql=!1,mf=null,jA.apply(CA,arguments)}function PA(e,t,n,r,i,s,o,a,c){if(EA.apply(this,arguments),Ql){if(Ql){var u=mf;Ql=!1,mf=null}else throw Error(ae(198));gf||(gf=!0,rg=u)}}function bo(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 T1(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(bo(e)!==e)throw Error(ae(188))}function _A(e){var t=e.alternate;if(!t){if(t=bo(e),t===null)throw Error(ae(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(ae(188))}if(n.return!==r.return)n=i,r=s;else{for(var o=!1,a=i.child;a;){if(a===n){o=!0,n=i,r=s;break}if(a===r){o=!0,r=i,n=s;break}a=a.sibling}if(!o){for(a=s.child;a;){if(a===n){o=!0,n=s,r=i;break}if(a===r){o=!0,r=s,n=i;break}a=a.sibling}if(!o)throw Error(ae(189))}}if(n.alternate!==r)throw Error(ae(190))}if(n.tag!==3)throw Error(ae(188));return n.stateNode.current===n?e:t}function R1(e){return e=_A(e),e!==null?L1(e):null}function L1(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=L1(e);if(t!==null)return t;e=e.sibling}return null}var O1=ir.unstable_scheduleCallback,wv=ir.unstable_cancelCallback,IA=ir.unstable_shouldYield,AA=ir.unstable_requestPaint,Ht=ir.unstable_now,TA=ir.unstable_getCurrentPriorityLevel,Fy=ir.unstable_ImmediatePriority,M1=ir.unstable_UserBlockingPriority,yf=ir.unstable_NormalPriority,RA=ir.unstable_LowPriority,D1=ir.unstable_IdlePriority,hp=null,ci=null;function LA(e){if(ci&&typeof ci.onCommitFiberRoot=="function")try{ci.onCommitFiberRoot(hp,e,void 0,(e.current.flags&128)===128)}catch{}}var Mr=Math.clz32?Math.clz32:DA,OA=Math.log,MA=Math.LN2;function DA(e){return e>>>=0,e===0?32:31-(OA(e)/MA|0)|0}var rd=64,id=4194304;function Kl(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 xf(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 a=o&~i;a!==0?r=Kl(a):(s&=o,s!==0&&(r=Kl(s)))}else o=n&~i,o!==0?r=Kl(o):s!==0&&(r=Kl(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-Mr(t),i=1<<n,r|=e[n],t&=~i;return r}function $A(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 FA(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,s=e.pendingLanes;0<s;){var o=31-Mr(s),a=1<<o,c=i[o];c===-1?(!(a&n)||a&r)&&(i[o]=$A(a,t)):c<=t&&(e.expiredLanes|=a),s&=~a}}function ig(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function $1(){var e=rd;return rd<<=1,!(rd&4194240)&&(rd=64),e}function Lh(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function eu(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Mr(t),e[t]=n}function zA(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-Mr(n),s=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~s}}function zy(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Mr(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var dt=0;function F1(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var z1,By,B1,H1,U1,sg=!1,sd=[],ps=null,hs=null,ms=null,wc=new Map,vc=new Map,os=[],BA="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 vv(e,t){switch(e){case"focusin":case"focusout":ps=null;break;case"dragenter":case"dragleave":hs=null;break;case"mouseover":case"mouseout":ms=null;break;case"pointerover":case"pointerout":wc.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":vc.delete(t.pointerId)}}function _l(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=nu(t),t!==null&&By(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function HA(e,t,n,r,i){switch(t){case"focusin":return ps=_l(ps,e,t,n,r,i),!0;case"dragenter":return hs=_l(hs,e,t,n,r,i),!0;case"mouseover":return ms=_l(ms,e,t,n,r,i),!0;case"pointerover":var s=i.pointerId;return wc.set(s,_l(wc.get(s)||null,e,t,n,r,i)),!0;case"gotpointercapture":return s=i.pointerId,vc.set(s,_l(vc.get(s)||null,e,t,n,r,i)),!0}return!1}function V1(e){var t=Qs(e.target);if(t!==null){var n=bo(t);if(n!==null){if(t=n.tag,t===13){if(t=T1(n),t!==null){e.blockedOn=t,U1(e.priority,function(){B1(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 Kd(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=og(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);eg=r,n.target.dispatchEvent(r),eg=null}else return t=nu(n),t!==null&&By(t),e.blockedOn=n,!1;t.shift()}return!0}function bv(e,t,n){Kd(e)&&n.delete(t)}function UA(){sg=!1,ps!==null&&Kd(ps)&&(ps=null),hs!==null&&Kd(hs)&&(hs=null),ms!==null&&Kd(ms)&&(ms=null),wc.forEach(bv),vc.forEach(bv)}function Il(e,t){e.blockedOn===t&&(e.blockedOn=null,sg||(sg=!0,ir.unstable_scheduleCallback(ir.unstable_NormalPriority,UA)))}function bc(e){function t(i){return Il(i,e)}if(0<sd.length){Il(sd[0],e);for(var n=1;n<sd.length;n++){var r=sd[n];r.blockedOn===e&&(r.blockedOn=null)}}for(ps!==null&&Il(ps,e),hs!==null&&Il(hs,e),ms!==null&&Il(ms,e),wc.forEach(t),vc.forEach(t),n=0;n<os.length;n++)r=os[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<os.length&&(n=os[0],n.blockedOn===null);)V1(n),n.blockedOn===null&&os.shift()}var pa=Hi.ReactCurrentBatchConfig,wf=!0;function VA(e,t,n,r){var i=dt,s=pa.transition;pa.transition=null;try{dt=1,Hy(e,t,n,r)}finally{dt=i,pa.transition=s}}function WA(e,t,n,r){var i=dt,s=pa.transition;pa.transition=null;try{dt=4,Hy(e,t,n,r)}finally{dt=i,pa.transition=s}}function Hy(e,t,n,r){if(wf){var i=og(e,t,n,r);if(i===null)Vh(e,t,r,vf,n),vv(e,r);else if(HA(i,e,t,n,r))r.stopPropagation();else if(vv(e,r),t&4&&-1<BA.indexOf(e)){for(;i!==null;){var s=nu(i);if(s!==null&&z1(s),s=og(e,t,n,r),s===null&&Vh(e,t,r,vf,n),s===i)break;i=s}i!==null&&r.stopPropagation()}else Vh(e,t,r,null,n)}}var vf=null;function og(e,t,n,r){if(vf=null,e=$y(r),e=Qs(e),e!==null)if(t=bo(e),t===null)e=null;else if(n=t.tag,n===13){if(e=T1(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 vf=e,null}function W1(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(TA()){case Fy:return 1;case M1:return 4;case yf:case RA:return 16;case D1:return 536870912;default:return 16}default:return 16}}var cs=null,Uy=null,Yd=null;function K1(){if(Yd)return Yd;var e,t=Uy,n=t.length,r,i="value"in cs?cs.value:cs.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 Yd=i.slice(e,1<r?1-r:void 0)}function qd(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 od(){return!0}function kv(){return!1}function ar(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 a in e)e.hasOwnProperty(a)&&(n=e[a],this[a]=n?n(s):s[a]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?od:kv,this.isPropagationStopped=kv,this}return Mt(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=od)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=od)},persist:function(){},isPersistent:od}),t}var Ha={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Vy=ar(Ha),tu=Mt({},Ha,{view:0,detail:0}),KA=ar(tu),Oh,Mh,Al,mp=Mt({},tu,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Wy,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!==Al&&(Al&&e.type==="mousemove"?(Oh=e.screenX-Al.screenX,Mh=e.screenY-Al.screenY):Mh=Oh=0,Al=e),Oh)},movementY:function(e){return"movementY"in e?e.movementY:Mh}}),Sv=ar(mp),YA=Mt({},mp,{dataTransfer:0}),qA=ar(YA),GA=Mt({},tu,{relatedTarget:0}),Dh=ar(GA),XA=Mt({},Ha,{animationName:0,elapsedTime:0,pseudoElement:0}),JA=ar(XA),QA=Mt({},Ha,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),ZA=ar(QA),e2=Mt({},Ha,{data:0}),Nv=ar(e2),t2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},n2={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"},r2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function i2(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=r2[e])?!!t[e]:!1}function Wy(){return i2}var s2=Mt({},tu,{key:function(e){if(e.key){var t=t2[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=qd(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?n2[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Wy,charCode:function(e){return e.type==="keypress"?qd(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?qd(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),o2=ar(s2),a2=Mt({},mp,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),jv=ar(a2),l2=Mt({},tu,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Wy}),c2=ar(l2),u2=Mt({},Ha,{propertyName:0,elapsedTime:0,pseudoElement:0}),d2=ar(u2),f2=Mt({},mp,{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}),p2=ar(f2),h2=[9,13,27,32],Ky=Oi&&"CompositionEvent"in window,Zl=null;Oi&&"documentMode"in document&&(Zl=document.documentMode);var m2=Oi&&"TextEvent"in window&&!Zl,Y1=Oi&&(!Ky||Zl&&8<Zl&&11>=Zl),Cv=" ",Ev=!1;function q1(e,t){switch(e){case"keyup":return h2.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function G1(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Yo=!1;function g2(e,t){switch(e){case"compositionend":return G1(t);case"keypress":return t.which!==32?null:(Ev=!0,Cv);case"textInput":return e=t.data,e===Cv&&Ev?null:e;default:return null}}function y2(e,t){if(Yo)return e==="compositionend"||!Ky&&q1(e,t)?(e=K1(),Yd=Uy=cs=null,Yo=!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 Y1&&t.locale!=="ko"?null:t.data;default:return null}}var x2={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 Pv(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!x2[e.type]:t==="textarea"}function X1(e,t,n,r){E1(r),t=bf(t,"onChange"),0<t.length&&(n=new Vy("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var ec=null,kc=null;function w2(e){aN(e,0)}function gp(e){var t=Xo(e);if(v1(t))return e}function v2(e,t){if(e==="change")return t}var J1=!1;if(Oi){var $h;if(Oi){var Fh="oninput"in document;if(!Fh){var _v=document.createElement("div");_v.setAttribute("oninput","return;"),Fh=typeof _v.oninput=="function"}$h=Fh}else $h=!1;J1=$h&&(!document.documentMode||9<document.documentMode)}function Iv(){ec&&(ec.detachEvent("onpropertychange",Q1),kc=ec=null)}function Q1(e){if(e.propertyName==="value"&&gp(kc)){var t=[];X1(t,kc,e,$y(e)),A1(w2,t)}}function b2(e,t,n){e==="focusin"?(Iv(),ec=t,kc=n,ec.attachEvent("onpropertychange",Q1)):e==="focusout"&&Iv()}function k2(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return gp(kc)}function S2(e,t){if(e==="click")return gp(t)}function N2(e,t){if(e==="input"||e==="change")return gp(t)}function j2(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var $r=typeof Object.is=="function"?Object.is:j2;function Sc(e,t){if($r(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(!Hm.call(t,i)||!$r(e[i],t[i]))return!1}return!0}function Av(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Tv(e,t){var n=Av(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=Av(n)}}function Z1(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Z1(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function eN(){for(var e=window,t=hf();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=hf(e.document)}return t}function Yy(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 C2(e){var t=eN(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Z1(n.ownerDocument.documentElement,n)){if(r!==null&&Yy(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=Tv(n,s);var o=Tv(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 E2=Oi&&"documentMode"in document&&11>=document.documentMode,qo=null,ag=null,tc=null,lg=!1;function Rv(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;lg||qo==null||qo!==hf(r)||(r=qo,"selectionStart"in r&&Yy(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}),tc&&Sc(tc,r)||(tc=r,r=bf(ag,"onSelect"),0<r.length&&(t=new Vy("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=qo)))}function ad(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Go={animationend:ad("Animation","AnimationEnd"),animationiteration:ad("Animation","AnimationIteration"),animationstart:ad("Animation","AnimationStart"),transitionend:ad("Transition","TransitionEnd")},zh={},tN={};Oi&&(tN=document.createElement("div").style,"AnimationEvent"in window||(delete Go.animationend.animation,delete Go.animationiteration.animation,delete Go.animationstart.animation),"TransitionEvent"in window||delete Go.transitionend.transition);function yp(e){if(zh[e])return zh[e];if(!Go[e])return e;var t=Go[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in tN)return zh[e]=t[n];return e}var nN=yp("animationend"),rN=yp("animationiteration"),iN=yp("animationstart"),sN=yp("transitionend"),oN=new Map,Lv="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 Is(e,t){oN.set(e,t),vo(t,[e])}for(var Bh=0;Bh<Lv.length;Bh++){var Hh=Lv[Bh],P2=Hh.toLowerCase(),_2=Hh[0].toUpperCase()+Hh.slice(1);Is(P2,"on"+_2)}Is(nN,"onAnimationEnd");Is(rN,"onAnimationIteration");Is(iN,"onAnimationStart");Is("dblclick","onDoubleClick");Is("focusin","onFocus");Is("focusout","onBlur");Is(sN,"onTransitionEnd");ba("onMouseEnter",["mouseout","mouseover"]);ba("onMouseLeave",["mouseout","mouseover"]);ba("onPointerEnter",["pointerout","pointerover"]);ba("onPointerLeave",["pointerout","pointerover"]);vo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));vo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));vo("onBeforeInput",["compositionend","keypress","textInput","paste"]);vo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));vo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));vo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Yl="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(" "),I2=new Set("cancel close invalid load scroll toggle".split(" ").concat(Yl));function Ov(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,PA(r,t,void 0,e),e.currentTarget=null}function aN(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 a=r[o],c=a.instance,u=a.currentTarget;if(a=a.listener,c!==s&&i.isPropagationStopped())break e;Ov(i,a,u),s=c}else for(o=0;o<r.length;o++){if(a=r[o],c=a.instance,u=a.currentTarget,a=a.listener,c!==s&&i.isPropagationStopped())break e;Ov(i,a,u),s=c}}}if(gf)throw e=rg,gf=!1,rg=null,e}function St(e,t){var n=t[pg];n===void 0&&(n=t[pg]=new Set);var r=e+"__bubble";n.has(r)||(lN(t,e,2,!1),n.add(r))}function Uh(e,t,n){var r=0;t&&(r|=4),lN(n,e,r,t)}var ld="_reactListening"+Math.random().toString(36).slice(2);function Nc(e){if(!e[ld]){e[ld]=!0,m1.forEach(function(n){n!=="selectionchange"&&(I2.has(n)||Uh(n,!1,e),Uh(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ld]||(t[ld]=!0,Uh("selectionchange",!1,t))}}function lN(e,t,n,r){switch(W1(t)){case 1:var i=VA;break;case 4:i=WA;break;default:i=Hy}n=i.bind(null,t,n,e),i=void 0,!ng||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 Vh(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 a=r.stateNode.containerInfo;if(a===i||a.nodeType===8&&a.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===i||c.nodeType===8&&c.parentNode===i))return;o=o.return}for(;a!==null;){if(o=Qs(a),o===null)return;if(c=o.tag,c===5||c===6){r=s=o;continue e}a=a.parentNode}}r=r.return}A1(function(){var u=s,p=$y(n),d=[];e:{var f=oN.get(e);if(f!==void 0){var h=Vy,g=e;switch(e){case"keypress":if(qd(n)===0)break e;case"keydown":case"keyup":h=o2;break;case"focusin":g="focus",h=Dh;break;case"focusout":g="blur",h=Dh;break;case"beforeblur":case"afterblur":h=Dh;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=Sv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=qA;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=c2;break;case nN:case rN:case iN:h=JA;break;case sN:h=d2;break;case"scroll":h=KA;break;case"wheel":h=p2;break;case"copy":case"cut":case"paste":h=ZA;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=jv}var b=(t&4)!==0,k=!b&&e==="scroll",y=b?f!==null?f+"Capture":null:f;b=[];for(var v=u,w;v!==null;){w=v;var N=w.stateNode;if(w.tag===5&&N!==null&&(w=N,y!==null&&(N=xc(v,y),N!=null&&b.push(jc(v,N,w)))),k)break;v=v.return}0<b.length&&(f=new h(f,g,null,n,p),d.push({event:f,listeners:b}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",h=e==="mouseout"||e==="pointerout",f&&n!==eg&&(g=n.relatedTarget||n.fromElement)&&(Qs(g)||g[Mi]))break e;if((h||f)&&(f=p.window===p?p:(f=p.ownerDocument)?f.defaultView||f.parentWindow:window,h?(g=n.relatedTarget||n.toElement,h=u,g=g?Qs(g):null,g!==null&&(k=bo(g),g!==k||g.tag!==5&&g.tag!==6)&&(g=null)):(h=null,g=u),h!==g)){if(b=Sv,N="onMouseLeave",y="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(b=jv,N="onPointerLeave",y="onPointerEnter",v="pointer"),k=h==null?f:Xo(h),w=g==null?f:Xo(g),f=new b(N,v+"leave",h,n,p),f.target=k,f.relatedTarget=w,N=null,Qs(p)===u&&(b=new b(y,v+"enter",g,n,p),b.target=w,b.relatedTarget=k,N=b),k=N,h&&g)t:{for(b=h,y=g,v=0,w=b;w;w=Do(w))v++;for(w=0,N=y;N;N=Do(N))w++;for(;0<v-w;)b=Do(b),v--;for(;0<w-v;)y=Do(y),w--;for(;v--;){if(b===y||y!==null&&b===y.alternate)break t;b=Do(b),y=Do(y)}b=null}else b=null;h!==null&&Mv(d,f,h,b,!1),g!==null&&k!==null&&Mv(d,k,g,b,!0)}}e:{if(f=u?Xo(u):window,h=f.nodeName&&f.nodeName.toLowerCase(),h==="select"||h==="input"&&f.type==="file")var C=v2;else if(Pv(f))if(J1)C=N2;else{C=k2;var S=b2}else(h=f.nodeName)&&h.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(C=S2);if(C&&(C=C(e,u))){X1(d,C,n,p);break e}S&&S(e,f,u),e==="focusout"&&(S=f._wrapperState)&&S.controlled&&f.type==="number"&&Gm(f,"number",f.value)}switch(S=u?Xo(u):window,e){case"focusin":(Pv(S)||S.contentEditable==="true")&&(qo=S,ag=u,tc=null);break;case"focusout":tc=ag=qo=null;break;case"mousedown":lg=!0;break;case"contextmenu":case"mouseup":case"dragend":lg=!1,Rv(d,n,p);break;case"selectionchange":if(E2)break;case"keydown":case"keyup":Rv(d,n,p)}var P;if(Ky)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 Yo?q1(e,n)&&(R="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(R="onCompositionStart");R&&(Y1&&n.locale!=="ko"&&(Yo||R!=="onCompositionStart"?R==="onCompositionEnd"&&Yo&&(P=K1()):(cs=p,Uy="value"in cs?cs.value:cs.textContent,Yo=!0)),S=bf(u,R),0<S.length&&(R=new Nv(R,e,null,n,p),d.push({event:R,listeners:S}),P?R.data=P:(P=G1(n),P!==null&&(R.data=P)))),(P=m2?g2(e,n):y2(e,n))&&(u=bf(u,"onBeforeInput"),0<u.length&&(p=new Nv("onBeforeInput","beforeinput",null,n,p),d.push({event:p,listeners:u}),p.data=P))}aN(d,t)})}function jc(e,t,n){return{instance:e,listener:t,currentTarget:n}}function bf(e,t){for(var n=t+"Capture",r=[];e!==null;){var i=e,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=xc(e,n),s!=null&&r.unshift(jc(e,s,i)),s=xc(e,t),s!=null&&r.push(jc(e,s,i))),e=e.return}return r}function Do(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Mv(e,t,n,r,i){for(var s=t._reactName,o=[];n!==null&&n!==r;){var a=n,c=a.alternate,u=a.stateNode;if(c!==null&&c===r)break;a.tag===5&&u!==null&&(a=u,i?(c=xc(n,s),c!=null&&o.unshift(jc(n,c,a))):i||(c=xc(n,s),c!=null&&o.push(jc(n,c,a)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var A2=/\r\n?/g,T2=/\u0000|\uFFFD/g;function Dv(e){return(typeof e=="string"?e:""+e).replace(A2,`
|
|
38
|
-
`).replace(T2,"")}function cd(e,t,n){if(t=Dv(t),Dv(e)!==t&&n)throw Error(ae(425))}function kf(){}var cg=null,ug=null;function dg(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 fg=typeof setTimeout=="function"?setTimeout:void 0,R2=typeof clearTimeout=="function"?clearTimeout:void 0,$v=typeof Promise=="function"?Promise:void 0,L2=typeof queueMicrotask=="function"?queueMicrotask:typeof $v<"u"?function(e){return $v.resolve(null).then(e).catch(O2)}:fg;function O2(e){setTimeout(function(){throw e})}function Wh(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),bc(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);bc(t)}function gs(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 Fv(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 Ua=Math.random().toString(36).slice(2),si="__reactFiber$"+Ua,Cc="__reactProps$"+Ua,Mi="__reactContainer$"+Ua,pg="__reactEvents$"+Ua,M2="__reactListeners$"+Ua,D2="__reactHandles$"+Ua;function Qs(e){var t=e[si];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Mi]||n[si]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Fv(e);e!==null;){if(n=e[si])return n;e=Fv(e)}return t}e=n,n=e.parentNode}return null}function nu(e){return e=e[si]||e[Mi],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Xo(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(ae(33))}function xp(e){return e[Cc]||null}var hg=[],Jo=-1;function As(e){return{current:e}}function jt(e){0>Jo||(e.current=hg[Jo],hg[Jo]=null,Jo--)}function wt(e,t){Jo++,hg[Jo]=e.current,e.current=t}var Ns={},Nn=As(Ns),Vn=As(!1),lo=Ns;function ka(e,t){var n=e.type.contextTypes;if(!n)return Ns;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 Wn(e){return e=e.childContextTypes,e!=null}function Sf(){jt(Vn),jt(Nn)}function zv(e,t,n){if(Nn.current!==Ns)throw Error(ae(168));wt(Nn,t),wt(Vn,n)}function cN(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(ae(108,bA(e)||"Unknown",i));return Mt({},n,r)}function Nf(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ns,lo=Nn.current,wt(Nn,e),wt(Vn,Vn.current),!0}function Bv(e,t,n){var r=e.stateNode;if(!r)throw Error(ae(169));n?(e=cN(e,t,lo),r.__reactInternalMemoizedMergedChildContext=e,jt(Vn),jt(Nn),wt(Nn,e)):jt(Vn),wt(Vn,n)}var Ei=null,wp=!1,Kh=!1;function uN(e){Ei===null?Ei=[e]:Ei.push(e)}function $2(e){wp=!0,uN(e)}function Ts(){if(!Kh&&Ei!==null){Kh=!0;var e=0,t=dt;try{var n=Ei;for(dt=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Ei=null,wp=!1}catch(i){throw Ei!==null&&(Ei=Ei.slice(e+1)),O1(Fy,Ts),i}finally{dt=t,Kh=!1}}return null}var Qo=[],Zo=0,jf=null,Cf=0,pr=[],hr=0,co=null,Ii=1,Ai="";function qs(e,t){Qo[Zo++]=Cf,Qo[Zo++]=jf,jf=e,Cf=t}function dN(e,t,n){pr[hr++]=Ii,pr[hr++]=Ai,pr[hr++]=co,co=e;var r=Ii;e=Ai;var i=32-Mr(r)-1;r&=~(1<<i),n+=1;var s=32-Mr(t)+i;if(30<s){var o=i-i%5;s=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Ii=1<<32-Mr(t)+i|n<<i|r,Ai=s+e}else Ii=1<<s|n<<i|r,Ai=e}function qy(e){e.return!==null&&(qs(e,1),dN(e,1,0))}function Gy(e){for(;e===jf;)jf=Qo[--Zo],Qo[Zo]=null,Cf=Qo[--Zo],Qo[Zo]=null;for(;e===co;)co=pr[--hr],pr[hr]=null,Ai=pr[--hr],pr[hr]=null,Ii=pr[--hr],pr[hr]=null}var nr=null,er=null,_t=!1,Ir=null;function fN(e,t){var n=yr(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 Hv(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,nr=e,er=gs(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,nr=e,er=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=co!==null?{id:Ii,overflow:Ai}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=yr(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,nr=e,er=null,!0):!1;default:return!1}}function mg(e){return(e.mode&1)!==0&&(e.flags&128)===0}function gg(e){if(_t){var t=er;if(t){var n=t;if(!Hv(e,t)){if(mg(e))throw Error(ae(418));t=gs(n.nextSibling);var r=nr;t&&Hv(e,t)?fN(r,n):(e.flags=e.flags&-4097|2,_t=!1,nr=e)}}else{if(mg(e))throw Error(ae(418));e.flags=e.flags&-4097|2,_t=!1,nr=e}}}function Uv(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;nr=e}function ud(e){if(e!==nr)return!1;if(!_t)return Uv(e),_t=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!dg(e.type,e.memoizedProps)),t&&(t=er)){if(mg(e))throw pN(),Error(ae(418));for(;t;)fN(e,t),t=gs(t.nextSibling)}if(Uv(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ae(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){er=gs(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}er=null}}else er=nr?gs(e.stateNode.nextSibling):null;return!0}function pN(){for(var e=er;e;)e=gs(e.nextSibling)}function Sa(){er=nr=null,_t=!1}function Xy(e){Ir===null?Ir=[e]:Ir.push(e)}var F2=Hi.ReactCurrentBatchConfig;function Tl(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(ae(309));var r=n.stateNode}if(!r)throw Error(ae(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 a=i.refs;o===null?delete a[s]:a[s]=o},t._stringRef=s,t)}if(typeof e!="string")throw Error(ae(284));if(!n._owner)throw Error(ae(290,e))}return e}function dd(e,t){throw e=Object.prototype.toString.call(t),Error(ae(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Vv(e){var t=e._init;return t(e._payload)}function hN(e){function t(y,v){if(e){var w=y.deletions;w===null?(y.deletions=[v],y.flags|=16):w.push(v)}}function n(y,v){if(!e)return null;for(;v!==null;)t(y,v),v=v.sibling;return null}function r(y,v){for(y=new Map;v!==null;)v.key!==null?y.set(v.key,v):y.set(v.index,v),v=v.sibling;return y}function i(y,v){return y=vs(y,v),y.index=0,y.sibling=null,y}function s(y,v,w){return y.index=w,e?(w=y.alternate,w!==null?(w=w.index,w<v?(y.flags|=2,v):w):(y.flags|=2,v)):(y.flags|=1048576,v)}function o(y){return e&&y.alternate===null&&(y.flags|=2),y}function a(y,v,w,N){return v===null||v.tag!==6?(v=Zh(w,y.mode,N),v.return=y,v):(v=i(v,w),v.return=y,v)}function c(y,v,w,N){var C=w.type;return C===Ko?p(y,v,w.props.children,N,w.key):v!==null&&(v.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===rs&&Vv(C)===v.type)?(N=i(v,w.props),N.ref=Tl(y,v,w),N.return=y,N):(N=tf(w.type,w.key,w.props,null,y.mode,N),N.ref=Tl(y,v,w),N.return=y,N)}function u(y,v,w,N){return v===null||v.tag!==4||v.stateNode.containerInfo!==w.containerInfo||v.stateNode.implementation!==w.implementation?(v=em(w,y.mode,N),v.return=y,v):(v=i(v,w.children||[]),v.return=y,v)}function p(y,v,w,N,C){return v===null||v.tag!==7?(v=ro(w,y.mode,N,C),v.return=y,v):(v=i(v,w),v.return=y,v)}function d(y,v,w){if(typeof v=="string"&&v!==""||typeof v=="number")return v=Zh(""+v,y.mode,w),v.return=y,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case ed:return w=tf(v.type,v.key,v.props,null,y.mode,w),w.ref=Tl(y,null,v),w.return=y,w;case Wo:return v=em(v,y.mode,w),v.return=y,v;case rs:var N=v._init;return d(y,N(v._payload),w)}if(Wl(v)||El(v))return v=ro(v,y.mode,w,null),v.return=y,v;dd(y,v)}return null}function f(y,v,w,N){var C=v!==null?v.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return C!==null?null:a(y,v,""+w,N);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case ed:return w.key===C?c(y,v,w,N):null;case Wo:return w.key===C?u(y,v,w,N):null;case rs:return C=w._init,f(y,v,C(w._payload),N)}if(Wl(w)||El(w))return C!==null?null:p(y,v,w,N,null);dd(y,w)}return null}function h(y,v,w,N,C){if(typeof N=="string"&&N!==""||typeof N=="number")return y=y.get(w)||null,a(v,y,""+N,C);if(typeof N=="object"&&N!==null){switch(N.$$typeof){case ed:return y=y.get(N.key===null?w:N.key)||null,c(v,y,N,C);case Wo:return y=y.get(N.key===null?w:N.key)||null,u(v,y,N,C);case rs:var S=N._init;return h(y,v,w,S(N._payload),C)}if(Wl(N)||El(N))return y=y.get(w)||null,p(v,y,N,C,null);dd(v,N)}return null}function g(y,v,w,N){for(var C=null,S=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 H=f(y,P,w[R],N);if(H===null){P===null&&(P=M);break}e&&P&&H.alternate===null&&t(y,P),v=s(H,v,R),S===null?C=H:S.sibling=H,S=H,P=M}if(R===w.length)return n(y,P),_t&&qs(y,R),C;if(P===null){for(;R<w.length;R++)P=d(y,w[R],N),P!==null&&(v=s(P,v,R),S===null?C=P:S.sibling=P,S=P);return _t&&qs(y,R),C}for(P=r(y,P);R<w.length;R++)M=h(P,y,R,w[R],N),M!==null&&(e&&M.alternate!==null&&P.delete(M.key===null?R:M.key),v=s(M,v,R),S===null?C=M:S.sibling=M,S=M);return e&&P.forEach(function(_){return t(y,_)}),_t&&qs(y,R),C}function b(y,v,w,N){var C=El(w);if(typeof C!="function")throw Error(ae(150));if(w=C.call(w),w==null)throw Error(ae(151));for(var S=C=null,P=v,R=v=0,M=null,H=w.next();P!==null&&!H.done;R++,H=w.next()){P.index>R?(M=P,P=null):M=P.sibling;var _=f(y,P,H.value,N);if(_===null){P===null&&(P=M);break}e&&P&&_.alternate===null&&t(y,P),v=s(_,v,R),S===null?C=_:S.sibling=_,S=_,P=M}if(H.done)return n(y,P),_t&&qs(y,R),C;if(P===null){for(;!H.done;R++,H=w.next())H=d(y,H.value,N),H!==null&&(v=s(H,v,R),S===null?C=H:S.sibling=H,S=H);return _t&&qs(y,R),C}for(P=r(y,P);!H.done;R++,H=w.next())H=h(P,y,R,H.value,N),H!==null&&(e&&H.alternate!==null&&P.delete(H.key===null?R:H.key),v=s(H,v,R),S===null?C=H:S.sibling=H,S=H);return e&&P.forEach(function(A){return t(y,A)}),_t&&qs(y,R),C}function k(y,v,w,N){if(typeof w=="object"&&w!==null&&w.type===Ko&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case ed:e:{for(var C=w.key,S=v;S!==null;){if(S.key===C){if(C=w.type,C===Ko){if(S.tag===7){n(y,S.sibling),v=i(S,w.props.children),v.return=y,y=v;break e}}else if(S.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===rs&&Vv(C)===S.type){n(y,S.sibling),v=i(S,w.props),v.ref=Tl(y,S,w),v.return=y,y=v;break e}n(y,S);break}else t(y,S);S=S.sibling}w.type===Ko?(v=ro(w.props.children,y.mode,N,w.key),v.return=y,y=v):(N=tf(w.type,w.key,w.props,null,y.mode,N),N.ref=Tl(y,v,w),N.return=y,y=N)}return o(y);case Wo:e:{for(S=w.key;v!==null;){if(v.key===S)if(v.tag===4&&v.stateNode.containerInfo===w.containerInfo&&v.stateNode.implementation===w.implementation){n(y,v.sibling),v=i(v,w.children||[]),v.return=y,y=v;break e}else{n(y,v);break}else t(y,v);v=v.sibling}v=em(w,y.mode,N),v.return=y,y=v}return o(y);case rs:return S=w._init,k(y,v,S(w._payload),N)}if(Wl(w))return g(y,v,w,N);if(El(w))return b(y,v,w,N);dd(y,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,v!==null&&v.tag===6?(n(y,v.sibling),v=i(v,w),v.return=y,y=v):(n(y,v),v=Zh(w,y.mode,N),v.return=y,y=v),o(y)):n(y,v)}return k}var Na=hN(!0),mN=hN(!1),Ef=As(null),Pf=null,ea=null,Jy=null;function Qy(){Jy=ea=Pf=null}function Zy(e){var t=Ef.current;jt(Ef),e._currentValue=t}function yg(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 ha(e,t){Pf=e,Jy=ea=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(zn=!0),e.firstContext=null)}function wr(e){var t=e._currentValue;if(Jy!==e)if(e={context:e,memoizedValue:t,next:null},ea===null){if(Pf===null)throw Error(ae(308));ea=e,Pf.dependencies={lanes:0,firstContext:e}}else ea=ea.next=e;return t}var Zs=null;function ex(e){Zs===null?Zs=[e]:Zs.push(e)}function gN(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,ex(t)):(n.next=i.next,i.next=n),t.interleaved=n,Di(e,r)}function Di(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 is=!1;function tx(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function yN(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 Li(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ys(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,rt&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Di(e,n)}return i=r.interleaved,i===null?(t.next=t,ex(r)):(t.next=i.next,i.next=t),r.interleaved=t,Di(e,n)}function Gd(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,zy(e,n)}}function Wv(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 _f(e,t,n,r){var i=e.updateQueue;is=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var c=a,u=c.next;c.next=null,o===null?s=u:o.next=u,o=c;var p=e.alternate;p!==null&&(p=p.updateQueue,a=p.lastBaseUpdate,a!==o&&(a===null?p.firstBaseUpdate=u:a.next=u,p.lastBaseUpdate=c))}if(s!==null){var d=i.baseState;o=0,p=u=c=null,a=s;do{var f=a.lane,h=a.eventTime;if((r&f)===f){p!==null&&(p=p.next={eventTime:h,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var g=e,b=a;switch(f=t,h=n,b.tag){case 1:if(g=b.payload,typeof g=="function"){d=g.call(h,d,f);break e}d=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=b.payload,f=typeof g=="function"?g.call(h,d,f):g,f==null)break e;d=Mt({},d,f);break e;case 2:is=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[a]:f.push(a))}else h={eventTime:h,lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},p===null?(u=p=h,c=d):p=p.next=h,o|=f;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;f=a,a=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(!0);if(p===null&&(c=d),i.baseState=c,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);fo|=o,e.lanes=o,e.memoizedState=d}}function Kv(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(ae(191,i));i.call(r)}}}var ru={},ui=As(ru),Ec=As(ru),Pc=As(ru);function eo(e){if(e===ru)throw Error(ae(174));return e}function nx(e,t){switch(wt(Pc,t),wt(Ec,e),wt(ui,ru),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Jm(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Jm(t,e)}jt(ui),wt(ui,t)}function ja(){jt(ui),jt(Ec),jt(Pc)}function xN(e){eo(Pc.current);var t=eo(ui.current),n=Jm(t,e.type);t!==n&&(wt(Ec,e),wt(ui,n))}function rx(e){Ec.current===e&&(jt(ui),jt(Ec))}var Lt=As(0);function If(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 Yh=[];function ix(){for(var e=0;e<Yh.length;e++)Yh[e]._workInProgressVersionPrimary=null;Yh.length=0}var Xd=Hi.ReactCurrentDispatcher,qh=Hi.ReactCurrentBatchConfig,uo=0,Ot=null,Xt=null,tn=null,Af=!1,nc=!1,_c=0,z2=0;function wn(){throw Error(ae(321))}function sx(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!$r(e[n],t[n]))return!1;return!0}function ox(e,t,n,r,i,s){if(uo=s,Ot=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Xd.current=e===null||e.memoizedState===null?V2:W2,e=n(r,i),nc){s=0;do{if(nc=!1,_c=0,25<=s)throw Error(ae(301));s+=1,tn=Xt=null,t.updateQueue=null,Xd.current=K2,e=n(r,i)}while(nc)}if(Xd.current=Tf,t=Xt!==null&&Xt.next!==null,uo=0,tn=Xt=Ot=null,Af=!1,t)throw Error(ae(300));return e}function ax(){var e=_c!==0;return _c=0,e}function ti(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return tn===null?Ot.memoizedState=tn=e:tn=tn.next=e,tn}function vr(){if(Xt===null){var e=Ot.alternate;e=e!==null?e.memoizedState:null}else e=Xt.next;var t=tn===null?Ot.memoizedState:tn.next;if(t!==null)tn=t,Xt=e;else{if(e===null)throw Error(ae(310));Xt=e,e={memoizedState:Xt.memoizedState,baseState:Xt.baseState,baseQueue:Xt.baseQueue,queue:Xt.queue,next:null},tn===null?Ot.memoizedState=tn=e:tn=tn.next=e}return tn}function Ic(e,t){return typeof t=="function"?t(e):t}function Gh(e){var t=vr(),n=t.queue;if(n===null)throw Error(ae(311));n.lastRenderedReducer=e;var r=Xt,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 a=o=null,c=null,u=s;do{var p=u.lane;if((uo&p)===p)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var d={lane:p,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(a=c=d,o=r):c=c.next=d,Ot.lanes|=p,fo|=p}u=u.next}while(u!==null&&u!==s);c===null?o=r:c.next=a,$r(r,t.memoizedState)||(zn=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){i=e;do s=i.lane,Ot.lanes|=s,fo|=s,i=i.next;while(i!==e)}else i===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Xh(e){var t=vr(),n=t.queue;if(n===null)throw Error(ae(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);$r(s,t.memoizedState)||(zn=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),n.lastRenderedState=s}return[s,r]}function wN(){}function vN(e,t){var n=Ot,r=vr(),i=t(),s=!$r(r.memoizedState,i);if(s&&(r.memoizedState=i,zn=!0),r=r.queue,lx(SN.bind(null,n,r,e),[e]),r.getSnapshot!==t||s||tn!==null&&tn.memoizedState.tag&1){if(n.flags|=2048,Ac(9,kN.bind(null,n,r,i,t),void 0,null),rn===null)throw Error(ae(349));uo&30||bN(n,t,i)}return i}function bN(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ot.updateQueue,t===null?(t={lastEffect:null,stores:null},Ot.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function kN(e,t,n,r){t.value=n,t.getSnapshot=r,NN(t)&&jN(e)}function SN(e,t,n){return n(function(){NN(t)&&jN(e)})}function NN(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!$r(e,n)}catch{return!0}}function jN(e){var t=Di(e,1);t!==null&&Dr(t,e,1,-1)}function Yv(e){var t=ti();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ic,lastRenderedState:e},t.queue=e,e=e.dispatch=U2.bind(null,Ot,e),[t.memoizedState,e]}function Ac(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Ot.updateQueue,t===null?(t={lastEffect:null,stores:null},Ot.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 CN(){return vr().memoizedState}function Jd(e,t,n,r){var i=ti();Ot.flags|=e,i.memoizedState=Ac(1|t,n,void 0,r===void 0?null:r)}function vp(e,t,n,r){var i=vr();r=r===void 0?null:r;var s=void 0;if(Xt!==null){var o=Xt.memoizedState;if(s=o.destroy,r!==null&&sx(r,o.deps)){i.memoizedState=Ac(t,n,s,r);return}}Ot.flags|=e,i.memoizedState=Ac(1|t,n,s,r)}function qv(e,t){return Jd(8390656,8,e,t)}function lx(e,t){return vp(2048,8,e,t)}function EN(e,t){return vp(4,2,e,t)}function PN(e,t){return vp(4,4,e,t)}function _N(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 IN(e,t,n){return n=n!=null?n.concat([e]):null,vp(4,4,_N.bind(null,t,e),n)}function cx(){}function AN(e,t){var n=vr();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&sx(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function TN(e,t){var n=vr();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&sx(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function RN(e,t,n){return uo&21?($r(n,t)||(n=$1(),Ot.lanes|=n,fo|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,zn=!0),e.memoizedState=n)}function B2(e,t){var n=dt;dt=n!==0&&4>n?n:4,e(!0);var r=qh.transition;qh.transition={};try{e(!1),t()}finally{dt=n,qh.transition=r}}function LN(){return vr().memoizedState}function H2(e,t,n){var r=ws(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ON(e))MN(t,n);else if(n=gN(e,t,n,r),n!==null){var i=An();Dr(n,e,r,i),DN(n,t,r)}}function U2(e,t,n){var r=ws(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ON(e))MN(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,a=s(o,n);if(i.hasEagerState=!0,i.eagerState=a,$r(a,o)){var c=t.interleaved;c===null?(i.next=i,ex(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}finally{}n=gN(e,t,i,r),n!==null&&(i=An(),Dr(n,e,r,i),DN(n,t,r))}}function ON(e){var t=e.alternate;return e===Ot||t!==null&&t===Ot}function MN(e,t){nc=Af=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function DN(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,zy(e,n)}}var Tf={readContext:wr,useCallback:wn,useContext:wn,useEffect:wn,useImperativeHandle:wn,useInsertionEffect:wn,useLayoutEffect:wn,useMemo:wn,useReducer:wn,useRef:wn,useState:wn,useDebugValue:wn,useDeferredValue:wn,useTransition:wn,useMutableSource:wn,useSyncExternalStore:wn,useId:wn,unstable_isNewReconciler:!1},V2={readContext:wr,useCallback:function(e,t){return ti().memoizedState=[e,t===void 0?null:t],e},useContext:wr,useEffect:qv,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Jd(4194308,4,_N.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Jd(4194308,4,e,t)},useInsertionEffect:function(e,t){return Jd(4,2,e,t)},useMemo:function(e,t){var n=ti();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ti();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=H2.bind(null,Ot,e),[r.memoizedState,e]},useRef:function(e){var t=ti();return e={current:e},t.memoizedState=e},useState:Yv,useDebugValue:cx,useDeferredValue:function(e){return ti().memoizedState=e},useTransition:function(){var e=Yv(!1),t=e[0];return e=B2.bind(null,e[1]),ti().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Ot,i=ti();if(_t){if(n===void 0)throw Error(ae(407));n=n()}else{if(n=t(),rn===null)throw Error(ae(349));uo&30||bN(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,qv(SN.bind(null,r,s,e),[e]),r.flags|=2048,Ac(9,kN.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=ti(),t=rn.identifierPrefix;if(_t){var n=Ai,r=Ii;n=(r&~(1<<32-Mr(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=_c++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=z2++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},W2={readContext:wr,useCallback:AN,useContext:wr,useEffect:lx,useImperativeHandle:IN,useInsertionEffect:EN,useLayoutEffect:PN,useMemo:TN,useReducer:Gh,useRef:CN,useState:function(){return Gh(Ic)},useDebugValue:cx,useDeferredValue:function(e){var t=vr();return RN(t,Xt.memoizedState,e)},useTransition:function(){var e=Gh(Ic)[0],t=vr().memoizedState;return[e,t]},useMutableSource:wN,useSyncExternalStore:vN,useId:LN,unstable_isNewReconciler:!1},K2={readContext:wr,useCallback:AN,useContext:wr,useEffect:lx,useImperativeHandle:IN,useInsertionEffect:EN,useLayoutEffect:PN,useMemo:TN,useReducer:Xh,useRef:CN,useState:function(){return Xh(Ic)},useDebugValue:cx,useDeferredValue:function(e){var t=vr();return Xt===null?t.memoizedState=e:RN(t,Xt.memoizedState,e)},useTransition:function(){var e=Xh(Ic)[0],t=vr().memoizedState;return[e,t]},useMutableSource:wN,useSyncExternalStore:vN,useId:LN,unstable_isNewReconciler:!1};function Er(e,t){if(e&&e.defaultProps){t=Mt({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function xg(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Mt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var bp={isMounted:function(e){return(e=e._reactInternals)?bo(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=An(),i=ws(e),s=Li(r,i);s.payload=t,n!=null&&(s.callback=n),t=ys(e,s,i),t!==null&&(Dr(t,e,i,r),Gd(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=An(),i=ws(e),s=Li(r,i);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=ys(e,s,i),t!==null&&(Dr(t,e,i,r),Gd(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=An(),r=ws(e),i=Li(n,r);i.tag=2,t!=null&&(i.callback=t),t=ys(e,i,r),t!==null&&(Dr(t,e,r,n),Gd(t,e,r))}};function Gv(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?!Sc(n,r)||!Sc(i,s):!0}function $N(e,t,n){var r=!1,i=Ns,s=t.contextType;return typeof s=="object"&&s!==null?s=wr(s):(i=Wn(t)?lo:Nn.current,r=t.contextTypes,s=(r=r!=null)?ka(e,i):Ns),t=new t(n,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=bp,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=s),t}function Xv(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&bp.enqueueReplaceState(t,t.state,null)}function wg(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},tx(e);var s=t.contextType;typeof s=="object"&&s!==null?i.context=wr(s):(s=Wn(t)?lo:Nn.current,i.context=ka(e,s)),i.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(xg(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&&bp.enqueueReplaceState(i,i.state,null),_f(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function Ca(e,t){try{var n="",r=t;do n+=vA(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 Jh(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function vg(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Y2=typeof WeakMap=="function"?WeakMap:Map;function FN(e,t,n){n=Li(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Lf||(Lf=!0,Ig=r),vg(e,t)},n}function zN(e,t,n){n=Li(-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(){vg(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){vg(e,t),typeof r!="function"&&(xs===null?xs=new Set([this]):xs.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function Jv(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Y2;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=aT.bind(null,e,t,n),t.then(e,e))}function Qv(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 Zv(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=Li(-1,1),t.tag=2,ys(n,t,1))),n.lanes|=1),e)}var q2=Hi.ReactCurrentOwner,zn=!1;function _n(e,t,n,r){t.child=e===null?mN(t,null,n,r):Na(t,e.child,n,r)}function e0(e,t,n,r,i){n=n.render;var s=t.ref;return ha(t,i),r=ox(e,t,n,r,s,i),n=ax(),e!==null&&!zn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,$i(e,t,i)):(_t&&n&&qy(t),t.flags|=1,_n(e,t,r,i),t.child)}function t0(e,t,n,r,i){if(e===null){var s=n.type;return typeof s=="function"&&!yx(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=s,BN(e,t,s,r,i)):(e=tf(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:Sc,n(o,r)&&e.ref===t.ref)return $i(e,t,i)}return t.flags|=1,e=vs(s,r),e.ref=t.ref,e.return=t,t.child=e}function BN(e,t,n,r,i){if(e!==null){var s=e.memoizedProps;if(Sc(s,r)&&e.ref===t.ref)if(zn=!1,t.pendingProps=r=s,(e.lanes&i)!==0)e.flags&131072&&(zn=!0);else return t.lanes=e.lanes,$i(e,t,i)}return bg(e,t,n,r,i)}function HN(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},wt(na,Jn),Jn|=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,wt(na,Jn),Jn|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,wt(na,Jn),Jn|=r}else s!==null?(r=s.baseLanes|n,t.memoizedState=null):r=n,wt(na,Jn),Jn|=r;return _n(e,t,i,n),t.child}function UN(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function bg(e,t,n,r,i){var s=Wn(n)?lo:Nn.current;return s=ka(t,s),ha(t,i),n=ox(e,t,n,r,s,i),r=ax(),e!==null&&!zn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,$i(e,t,i)):(_t&&r&&qy(t),t.flags|=1,_n(e,t,n,i),t.child)}function n0(e,t,n,r,i){if(Wn(n)){var s=!0;Nf(t)}else s=!1;if(ha(t,i),t.stateNode===null)Qd(e,t),$N(t,n,r),wg(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,a=t.memoizedProps;o.props=a;var c=o.context,u=n.contextType;typeof u=="object"&&u!==null?u=wr(u):(u=Wn(n)?lo:Nn.current,u=ka(t,u));var p=n.getDerivedStateFromProps,d=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function";d||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==r||c!==u)&&Xv(t,o,r,u),is=!1;var f=t.memoizedState;o.state=f,_f(t,r,o,i),c=t.memoizedState,a!==r||f!==c||Vn.current||is?(typeof p=="function"&&(xg(t,n,p,r),c=t.memoizedState),(a=is||Gv(t,n,a,r,f,c,u))?(d||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=u,r=a):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,yN(e,t),a=t.memoizedProps,u=t.type===t.elementType?a:Er(t.type,a),o.props=u,d=t.pendingProps,f=o.context,c=n.contextType,typeof c=="object"&&c!==null?c=wr(c):(c=Wn(n)?lo:Nn.current,c=ka(t,c));var h=n.getDerivedStateFromProps;(p=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==d||f!==c)&&Xv(t,o,r,c),is=!1,f=t.memoizedState,o.state=f,_f(t,r,o,i);var g=t.memoizedState;a!==d||f!==g||Vn.current||is?(typeof h=="function"&&(xg(t,n,h,r),g=t.memoizedState),(u=is||Gv(t,n,u,r,f,g,c)||!1)?(p||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,g,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,g,c)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=g),o.props=r,o.state=g,o.context=c,r=u):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return kg(e,t,n,r,s,i)}function kg(e,t,n,r,i,s){UN(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return i&&Bv(t,n,!1),$i(e,t,s);r=t.stateNode,q2.current=t;var a=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Na(t,e.child,null,s),t.child=Na(t,null,a,s)):_n(e,t,a,s),t.memoizedState=r.state,i&&Bv(t,n,!0),t.child}function VN(e){var t=e.stateNode;t.pendingContext?zv(e,t.pendingContext,t.pendingContext!==t.context):t.context&&zv(e,t.context,!1),nx(e,t.containerInfo)}function r0(e,t,n,r,i){return Sa(),Xy(i),t.flags|=256,_n(e,t,n,r),t.child}var Sg={dehydrated:null,treeContext:null,retryLane:0};function Ng(e){return{baseLanes:e,cachePool:null,transitions:null}}function WN(e,t,n){var r=t.pendingProps,i=Lt.current,s=!1,o=(t.flags&128)!==0,a;if((a=o)||(a=e!==null&&e.memoizedState===null?!1:(i&2)!==0),a?(s=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),wt(Lt,i&1),e===null)return gg(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=Np(o,r,0,null),e=ro(e,r,n,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=Ng(n),t.memoizedState=Sg,e):ux(t,o));if(i=e.memoizedState,i!==null&&(a=i.dehydrated,a!==null))return G2(e,t,o,r,a,i,n);if(s){s=r.fallback,o=t.mode,i=e.child,a=i.sibling;var c={mode:"hidden",children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=vs(i,c),r.subtreeFlags=i.subtreeFlags&14680064),a!==null?s=vs(a,s):(s=ro(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?Ng(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=e.childLanes&~n,t.memoizedState=Sg,r}return s=e.child,e=s.sibling,r=vs(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 ux(e,t){return t=Np({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function fd(e,t,n,r){return r!==null&&Xy(r),Na(t,e.child,null,n),e=ux(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function G2(e,t,n,r,i,s,o){if(n)return t.flags&256?(t.flags&=-257,r=Jh(Error(ae(422))),fd(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=r.fallback,i=t.mode,r=Np({mode:"visible",children:r.children},i,0,null),s=ro(s,i,o,null),s.flags|=2,r.return=t,s.return=t,r.sibling=s,t.child=r,t.mode&1&&Na(t,e.child,null,o),t.child.memoizedState=Ng(o),t.memoizedState=Sg,s);if(!(t.mode&1))return fd(e,t,o,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var a=r.dgst;return r=a,s=Error(ae(419)),r=Jh(s,r,void 0),fd(e,t,o,r)}if(a=(o&e.childLanes)!==0,zn||a){if(r=rn,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,Di(e,i),Dr(r,e,i,-1))}return gx(),r=Jh(Error(ae(421))),fd(e,t,o,r)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=lT.bind(null,e),i._reactRetry=t,null):(e=s.treeContext,er=gs(i.nextSibling),nr=t,_t=!0,Ir=null,e!==null&&(pr[hr++]=Ii,pr[hr++]=Ai,pr[hr++]=co,Ii=e.id,Ai=e.overflow,co=t),t=ux(t,r.children),t.flags|=4096,t)}function i0(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),yg(e.return,t,n)}function Qh(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 KN(e,t,n){var r=t.pendingProps,i=r.revealOrder,s=r.tail;if(_n(e,t,r.children,n),r=Lt.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&&i0(e,n,t);else if(e.tag===19)i0(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(wt(Lt,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&&If(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Qh(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&&If(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Qh(t,!0,n,null,s);break;case"together":Qh(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Qd(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function $i(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),fo|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(ae(153));if(t.child!==null){for(e=t.child,n=vs(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=vs(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function X2(e,t,n){switch(t.tag){case 3:VN(t),Sa();break;case 5:xN(t);break;case 1:Wn(t.type)&&Nf(t);break;case 4:nx(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;wt(Ef,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(wt(Lt,Lt.current&1),t.flags|=128,null):n&t.child.childLanes?WN(e,t,n):(wt(Lt,Lt.current&1),e=$i(e,t,n),e!==null?e.sibling:null);wt(Lt,Lt.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return KN(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),wt(Lt,Lt.current),r)break;return null;case 22:case 23:return t.lanes=0,HN(e,t,n)}return $i(e,t,n)}var YN,jg,qN,GN;YN=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}};jg=function(){};qN=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,eo(ui.current);var s=null;switch(n){case"input":i=Ym(e,i),r=Ym(e,r),s=[];break;case"select":i=Mt({},i,{value:void 0}),r=Mt({},r,{value:void 0}),s=[];break;case"textarea":i=Xm(e,i),r=Xm(e,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=kf)}Qm(n,r);var o;n=null;for(u in i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u==="style"){var a=i[u];for(o in a)a.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(gc.hasOwnProperty(u)?s||(s=[]):(s=s||[]).push(u,null));for(u in r){var c=r[u];if(a=i!=null?i[u]:void 0,r.hasOwnProperty(u)&&c!==a&&(c!=null||a!=null))if(u==="style")if(a){for(o in a)!a.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in c)c.hasOwnProperty(o)&&a[o]!==c[o]&&(n||(n={}),n[o]=c[o])}else n||(s||(s=[]),s.push(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,a=a?a.__html:void 0,c!=null&&a!==c&&(s=s||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(s=s||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(gc.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&St("scroll",e),s||a===c||(s=[])):(s=s||[]).push(u,c))}n&&(s=s||[]).push("style",n);var u=s;(t.updateQueue=u)&&(t.flags|=4)}};GN=function(e,t,n,r){n!==r&&(t.flags|=4)};function Rl(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 vn(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 J2(e,t,n){var r=t.pendingProps;switch(Gy(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return vn(t),null;case 1:return Wn(t.type)&&Sf(),vn(t),null;case 3:return r=t.stateNode,ja(),jt(Vn),jt(Nn),ix(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(ud(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ir!==null&&(Rg(Ir),Ir=null))),jg(e,t),vn(t),null;case 5:rx(t);var i=eo(Pc.current);if(n=t.type,e!==null&&t.stateNode!=null)qN(e,t,n,r,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(ae(166));return vn(t),null}if(e=eo(ui.current),ud(t)){r=t.stateNode,n=t.type;var s=t.memoizedProps;switch(r[si]=t,r[Cc]=s,e=(t.mode&1)!==0,n){case"dialog":St("cancel",r),St("close",r);break;case"iframe":case"object":case"embed":St("load",r);break;case"video":case"audio":for(i=0;i<Yl.length;i++)St(Yl[i],r);break;case"source":St("error",r);break;case"img":case"image":case"link":St("error",r),St("load",r);break;case"details":St("toggle",r);break;case"input":pv(r,s),St("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},St("invalid",r);break;case"textarea":mv(r,s),St("invalid",r)}Qm(n,s),i=null;for(var o in s)if(s.hasOwnProperty(o)){var a=s[o];o==="children"?typeof a=="string"?r.textContent!==a&&(s.suppressHydrationWarning!==!0&&cd(r.textContent,a,e),i=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(s.suppressHydrationWarning!==!0&&cd(r.textContent,a,e),i=["children",""+a]):gc.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&St("scroll",r)}switch(n){case"input":td(r),hv(r,s,!0);break;case"textarea":td(r),gv(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=kf)}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=S1(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[si]=t,e[Cc]=r,YN(e,t,!1,!1),t.stateNode=e;e:{switch(o=Zm(n,r),n){case"dialog":St("cancel",e),St("close",e),i=r;break;case"iframe":case"object":case"embed":St("load",e),i=r;break;case"video":case"audio":for(i=0;i<Yl.length;i++)St(Yl[i],e);i=r;break;case"source":St("error",e),i=r;break;case"img":case"image":case"link":St("error",e),St("load",e),i=r;break;case"details":St("toggle",e),i=r;break;case"input":pv(e,r),i=Ym(e,r),St("invalid",e);break;case"option":i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=Mt({},r,{value:void 0}),St("invalid",e);break;case"textarea":mv(e,r),i=Xm(e,r),St("invalid",e);break;default:i=r}Qm(n,i),a=i;for(s in a)if(a.hasOwnProperty(s)){var c=a[s];s==="style"?C1(e,c):s==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&N1(e,c)):s==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&yc(e,c):typeof c=="number"&&yc(e,""+c):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(gc.hasOwnProperty(s)?c!=null&&s==="onScroll"&&St("scroll",e):c!=null&&Ly(e,s,c,o))}switch(n){case"input":td(e),hv(e,r,!1);break;case"textarea":td(e),gv(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Ss(r.value));break;case"select":e.multiple=!!r.multiple,s=r.value,s!=null?ua(e,!!r.multiple,s,!1):r.defaultValue!=null&&ua(e,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=kf)}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 vn(t),null;case 6:if(e&&t.stateNode!=null)GN(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(ae(166));if(n=eo(Pc.current),eo(ui.current),ud(t)){if(r=t.stateNode,n=t.memoizedProps,r[si]=t,(s=r.nodeValue!==n)&&(e=nr,e!==null))switch(e.tag){case 3:cd(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&cd(r.nodeValue,n,(e.mode&1)!==0)}s&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[si]=t,t.stateNode=r}return vn(t),null;case 13:if(jt(Lt),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(_t&&er!==null&&t.mode&1&&!(t.flags&128))pN(),Sa(),t.flags|=98560,s=!1;else if(s=ud(t),r!==null&&r.dehydrated!==null){if(e===null){if(!s)throw Error(ae(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(ae(317));s[si]=t}else Sa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;vn(t),s=!1}else Ir!==null&&(Rg(Ir),Ir=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||Lt.current&1?Qt===0&&(Qt=3):gx())),t.updateQueue!==null&&(t.flags|=4),vn(t),null);case 4:return ja(),jg(e,t),e===null&&Nc(t.stateNode.containerInfo),vn(t),null;case 10:return Zy(t.type._context),vn(t),null;case 17:return Wn(t.type)&&Sf(),vn(t),null;case 19:if(jt(Lt),s=t.memoizedState,s===null)return vn(t),null;if(r=(t.flags&128)!==0,o=s.rendering,o===null)if(r)Rl(s,!1);else{if(Qt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=If(e),o!==null){for(t.flags|=128,Rl(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 wt(Lt,Lt.current&1|2),t.child}e=e.sibling}s.tail!==null&&Ht()>Ea&&(t.flags|=128,r=!0,Rl(s,!1),t.lanes=4194304)}else{if(!r)if(e=If(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Rl(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!_t)return vn(t),null}else 2*Ht()-s.renderingStartTime>Ea&&n!==1073741824&&(t.flags|=128,r=!0,Rl(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=Ht(),t.sibling=null,n=Lt.current,wt(Lt,r?n&1|2:n&1),t):(vn(t),null);case 22:case 23:return mx(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Jn&1073741824&&(vn(t),t.subtreeFlags&6&&(t.flags|=8192)):vn(t),null;case 24:return null;case 25:return null}throw Error(ae(156,t.tag))}function Q2(e,t){switch(Gy(t),t.tag){case 1:return Wn(t.type)&&Sf(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ja(),jt(Vn),jt(Nn),ix(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return rx(t),null;case 13:if(jt(Lt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ae(340));Sa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return jt(Lt),null;case 4:return ja(),null;case 10:return Zy(t.type._context),null;case 22:case 23:return mx(),null;case 24:return null;default:return null}}var pd=!1,kn=!1,Z2=typeof WeakSet=="function"?WeakSet:Set,be=null;function ta(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Ft(e,t,r)}else n.current=null}function Cg(e,t,n){try{n()}catch(r){Ft(e,t,r)}}var s0=!1;function eT(e,t){if(cg=wf,e=eN(),Yy(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,a=-1,c=-1,u=0,p=0,d=e,f=null;t:for(;;){for(var h;d!==n||i!==0&&d.nodeType!==3||(a=o+i),d!==s||r!==0&&d.nodeType!==3||(c=o+r),d.nodeType===3&&(o+=d.nodeValue.length),(h=d.firstChild)!==null;)f=d,d=h;for(;;){if(d===e)break t;if(f===n&&++u===i&&(a=o),f===s&&++p===r&&(c=o),(h=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=h}n=a===-1||c===-1?null:{start:a,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(ug={focusedElem:e,selectionRange:n},wf=!1,be=t;be!==null;)if(t=be,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,be=e;else for(;be!==null;){t=be;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var b=g.memoizedProps,k=g.memoizedState,y=t.stateNode,v=y.getSnapshotBeforeUpdate(t.elementType===t.type?b:Er(t.type,b),k);y.__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(ae(163))}}catch(N){Ft(t,t.return,N)}if(e=t.sibling,e!==null){e.return=t.return,be=e;break}be=t.return}return g=s0,s0=!1,g}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&&Cg(t,n,s)}i=i.next}while(i!==r)}}function kp(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 Eg(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 XN(e){var t=e.alternate;t!==null&&(e.alternate=null,XN(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[si],delete t[Cc],delete t[pg],delete t[M2],delete t[D2])),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 JN(e){return e.tag===5||e.tag===3||e.tag===4}function o0(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||JN(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 Pg(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=kf));else if(r!==4&&(e=e.child,e!==null))for(Pg(e,t,n),e=e.sibling;e!==null;)Pg(e,t,n),e=e.sibling}function _g(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(_g(e,t,n),e=e.sibling;e!==null;)_g(e,t,n),e=e.sibling}var ln=null,Pr=!1;function Qi(e,t,n){for(n=n.child;n!==null;)QN(e,t,n),n=n.sibling}function QN(e,t,n){if(ci&&typeof ci.onCommitFiberUnmount=="function")try{ci.onCommitFiberUnmount(hp,n)}catch{}switch(n.tag){case 5:kn||ta(n,t);case 6:var r=ln,i=Pr;ln=null,Qi(e,t,n),ln=r,Pr=i,ln!==null&&(Pr?(e=ln,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):ln.removeChild(n.stateNode));break;case 18:ln!==null&&(Pr?(e=ln,n=n.stateNode,e.nodeType===8?Wh(e.parentNode,n):e.nodeType===1&&Wh(e,n),bc(e)):Wh(ln,n.stateNode));break;case 4:r=ln,i=Pr,ln=n.stateNode.containerInfo,Pr=!0,Qi(e,t,n),ln=r,Pr=i;break;case 0:case 11:case 14:case 15:if(!kn&&(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)&&Cg(n,t,o),i=i.next}while(i!==r)}Qi(e,t,n);break;case 1:if(!kn&&(ta(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Ft(n,t,a)}Qi(e,t,n);break;case 21:Qi(e,t,n);break;case 22:n.mode&1?(kn=(r=kn)||n.memoizedState!==null,Qi(e,t,n),kn=r):Qi(e,t,n);break;default:Qi(e,t,n)}}function a0(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Z2),t.forEach(function(r){var i=cT.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function jr(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,a=o;e:for(;a!==null;){switch(a.tag){case 5:ln=a.stateNode,Pr=!1;break e;case 3:ln=a.stateNode.containerInfo,Pr=!0;break e;case 4:ln=a.stateNode.containerInfo,Pr=!0;break e}a=a.return}if(ln===null)throw Error(ae(160));QN(s,o,i),ln=null,Pr=!1;var c=i.alternate;c!==null&&(c.return=null),i.return=null}catch(u){Ft(i,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)ZN(t,e),t=t.sibling}function ZN(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(jr(t,e),ei(e),r&4){try{rc(3,e,e.return),kp(3,e)}catch(b){Ft(e,e.return,b)}try{rc(5,e,e.return)}catch(b){Ft(e,e.return,b)}}break;case 1:jr(t,e),ei(e),r&512&&n!==null&&ta(n,n.return);break;case 5:if(jr(t,e),ei(e),r&512&&n!==null&&ta(n,n.return),e.flags&32){var i=e.stateNode;try{yc(i,"")}catch(b){Ft(e,e.return,b)}}if(r&4&&(i=e.stateNode,i!=null)){var s=e.memoizedProps,o=n!==null?n.memoizedProps:s,a=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{a==="input"&&s.type==="radio"&&s.name!=null&&b1(i,s),Zm(a,o);var u=Zm(a,s);for(o=0;o<c.length;o+=2){var p=c[o],d=c[o+1];p==="style"?C1(i,d):p==="dangerouslySetInnerHTML"?N1(i,d):p==="children"?yc(i,d):Ly(i,p,d,u)}switch(a){case"input":qm(i,s);break;case"textarea":k1(i,s);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var h=s.value;h!=null?ua(i,!!s.multiple,h,!1):f!==!!s.multiple&&(s.defaultValue!=null?ua(i,!!s.multiple,s.defaultValue,!0):ua(i,!!s.multiple,s.multiple?[]:"",!1))}i[Cc]=s}catch(b){Ft(e,e.return,b)}}break;case 6:if(jr(t,e),ei(e),r&4){if(e.stateNode===null)throw Error(ae(162));i=e.stateNode,s=e.memoizedProps;try{i.nodeValue=s}catch(b){Ft(e,e.return,b)}}break;case 3:if(jr(t,e),ei(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{bc(t.containerInfo)}catch(b){Ft(e,e.return,b)}break;case 4:jr(t,e),ei(e);break;case 13:jr(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||(px=Ht())),r&4&&a0(e);break;case 22:if(p=n!==null&&n.memoizedState!==null,e.mode&1?(kn=(u=kn)||p,jr(t,e),kn=u):jr(t,e),ei(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!p&&e.mode&1)for(be=e,p=e.child;p!==null;){for(d=be=p;be!==null;){switch(f=be,h=f.child,f.tag){case 0:case 11:case 14:case 15:rc(4,f,f.return);break;case 1:ta(f,f.return);var g=f.stateNode;if(typeof g.componentWillUnmount=="function"){r=f,n=f.return;try{t=r,g.props=t.memoizedProps,g.state=t.memoizedState,g.componentWillUnmount()}catch(b){Ft(r,n,b)}}break;case 5:ta(f,f.return);break;case 22:if(f.memoizedState!==null){c0(d);continue}}h!==null?(h.return=f,be=h):c0(d)}p=p.sibling}e:for(p=null,d=e;;){if(d.tag===5){if(p===null){p=d;try{i=d.stateNode,u?(s=i.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(a=d.stateNode,c=d.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,a.style.display=j1("display",o))}catch(b){Ft(e,e.return,b)}}}else if(d.tag===6){if(p===null)try{d.stateNode.nodeValue=u?"":d.memoizedProps}catch(b){Ft(e,e.return,b)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===e)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===e)break e;for(;d.sibling===null;){if(d.return===null||d.return===e)break e;p===d&&(p=null),d=d.return}p===d&&(p=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:jr(t,e),ei(e),r&4&&a0(e);break;case 21:break;default:jr(t,e),ei(e)}}function ei(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(JN(n)){var r=n;break e}n=n.return}throw Error(ae(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(yc(i,""),r.flags&=-33);var s=o0(e);_g(e,s,i);break;case 3:case 4:var o=r.stateNode.containerInfo,a=o0(e);Pg(e,a,o);break;default:throw Error(ae(161))}}catch(c){Ft(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function tT(e,t,n){be=e,ej(e)}function ej(e,t,n){for(var r=(e.mode&1)!==0;be!==null;){var i=be,s=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||pd;if(!o){var a=i.alternate,c=a!==null&&a.memoizedState!==null||kn;a=pd;var u=kn;if(pd=o,(kn=c)&&!u)for(be=i;be!==null;)o=be,c=o.child,o.tag===22&&o.memoizedState!==null?u0(i):c!==null?(c.return=o,be=c):u0(i);for(;s!==null;)be=s,ej(s),s=s.sibling;be=i,pd=a,kn=u}l0(e)}else i.subtreeFlags&8772&&s!==null?(s.return=i,be=s):l0(e)}}function l0(e){for(;be!==null;){var t=be;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:kn||kp(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!kn)if(n===null)r.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:Er(t.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;s!==null&&Kv(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}Kv(t,o,n)}break;case 5:var a=t.stateNode;if(n===null&&t.flags&4){n=a;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var p=u.memoizedState;if(p!==null){var d=p.dehydrated;d!==null&&bc(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(ae(163))}kn||t.flags&512&&Eg(t)}catch(f){Ft(t,t.return,f)}}if(t===e){be=null;break}if(n=t.sibling,n!==null){n.return=t.return,be=n;break}be=t.return}}function c0(e){for(;be!==null;){var t=be;if(t===e){be=null;break}var n=t.sibling;if(n!==null){n.return=t.return,be=n;break}be=t.return}}function u0(e){for(;be!==null;){var t=be;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{kp(4,t)}catch(c){Ft(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var i=t.return;try{r.componentDidMount()}catch(c){Ft(t,i,c)}}var s=t.return;try{Eg(t)}catch(c){Ft(t,s,c)}break;case 5:var o=t.return;try{Eg(t)}catch(c){Ft(t,o,c)}}}catch(c){Ft(t,t.return,c)}if(t===e){be=null;break}var a=t.sibling;if(a!==null){a.return=t.return,be=a;break}be=t.return}}var nT=Math.ceil,Rf=Hi.ReactCurrentDispatcher,dx=Hi.ReactCurrentOwner,xr=Hi.ReactCurrentBatchConfig,rt=0,rn=null,Kt=null,cn=0,Jn=0,na=As(0),Qt=0,Tc=null,fo=0,Sp=0,fx=0,ic=null,Fn=null,px=0,Ea=1/0,Ci=null,Lf=!1,Ig=null,xs=null,hd=!1,us=null,Of=0,sc=0,Ag=null,Zd=-1,ef=0;function An(){return rt&6?Ht():Zd!==-1?Zd:Zd=Ht()}function ws(e){return e.mode&1?rt&2&&cn!==0?cn&-cn:F2.transition!==null?(ef===0&&(ef=$1()),ef):(e=dt,e!==0||(e=window.event,e=e===void 0?16:W1(e.type)),e):1}function Dr(e,t,n,r){if(50<sc)throw sc=0,Ag=null,Error(ae(185));eu(e,n,r),(!(rt&2)||e!==rn)&&(e===rn&&(!(rt&2)&&(Sp|=n),Qt===4&&as(e,cn)),Kn(e,r),n===1&&rt===0&&!(t.mode&1)&&(Ea=Ht()+500,wp&&Ts()))}function Kn(e,t){var n=e.callbackNode;FA(e,t);var r=xf(e,e===rn?cn:0);if(r===0)n!==null&&wv(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&wv(n),t===1)e.tag===0?$2(d0.bind(null,e)):uN(d0.bind(null,e)),L2(function(){!(rt&6)&&Ts()}),n=null;else{switch(F1(r)){case 1:n=Fy;break;case 4:n=M1;break;case 16:n=yf;break;case 536870912:n=D1;break;default:n=yf}n=lj(n,tj.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function tj(e,t){if(Zd=-1,ef=0,rt&6)throw Error(ae(327));var n=e.callbackNode;if(ma()&&e.callbackNode!==n)return null;var r=xf(e,e===rn?cn:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Mf(e,r);else{t=r;var i=rt;rt|=2;var s=rj();(rn!==e||cn!==t)&&(Ci=null,Ea=Ht()+500,no(e,t));do try{sT();break}catch(a){nj(e,a)}while(!0);Qy(),Rf.current=s,rt=i,Kt!==null?t=0:(rn=null,cn=0,t=Qt)}if(t!==0){if(t===2&&(i=ig(e),i!==0&&(r=i,t=Tg(e,i))),t===1)throw n=Tc,no(e,0),as(e,r),Kn(e,Ht()),n;if(t===6)as(e,r);else{if(i=e.current.alternate,!(r&30)&&!rT(i)&&(t=Mf(e,r),t===2&&(s=ig(e),s!==0&&(r=s,t=Tg(e,s))),t===1))throw n=Tc,no(e,0),as(e,r),Kn(e,Ht()),n;switch(e.finishedWork=i,e.finishedLanes=r,t){case 0:case 1:throw Error(ae(345));case 2:Gs(e,Fn,Ci);break;case 3:if(as(e,r),(r&130023424)===r&&(t=px+500-Ht(),10<t)){if(xf(e,0)!==0)break;if(i=e.suspendedLanes,(i&r)!==r){An(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=fg(Gs.bind(null,e,Fn,Ci),t);break}Gs(e,Fn,Ci);break;case 4:if(as(e,r),(r&4194240)===r)break;for(t=e.eventTimes,i=-1;0<r;){var o=31-Mr(r);s=1<<o,o=t[o],o>i&&(i=o),r&=~s}if(r=i,r=Ht()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*nT(r/1960))-r,10<r){e.timeoutHandle=fg(Gs.bind(null,e,Fn,Ci),r);break}Gs(e,Fn,Ci);break;case 5:Gs(e,Fn,Ci);break;default:throw Error(ae(329))}}}return Kn(e,Ht()),e.callbackNode===n?tj.bind(null,e):null}function Tg(e,t){var n=ic;return e.current.memoizedState.isDehydrated&&(no(e,t).flags|=256),e=Mf(e,t),e!==2&&(t=Fn,Fn=n,t!==null&&Rg(t)),e}function Rg(e){Fn===null?Fn=e:Fn.push.apply(Fn,e)}function rT(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(!$r(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 as(e,t){for(t&=~fx,t&=~Sp,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Mr(t),r=1<<n;e[n]=-1,t&=~r}}function d0(e){if(rt&6)throw Error(ae(327));ma();var t=xf(e,0);if(!(t&1))return Kn(e,Ht()),null;var n=Mf(e,t);if(e.tag!==0&&n===2){var r=ig(e);r!==0&&(t=r,n=Tg(e,r))}if(n===1)throw n=Tc,no(e,0),as(e,t),Kn(e,Ht()),n;if(n===6)throw Error(ae(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Gs(e,Fn,Ci),Kn(e,Ht()),null}function hx(e,t){var n=rt;rt|=1;try{return e(t)}finally{rt=n,rt===0&&(Ea=Ht()+500,wp&&Ts())}}function po(e){us!==null&&us.tag===0&&!(rt&6)&&ma();var t=rt;rt|=1;var n=xr.transition,r=dt;try{if(xr.transition=null,dt=1,e)return e()}finally{dt=r,xr.transition=n,rt=t,!(rt&6)&&Ts()}}function mx(){Jn=na.current,jt(na)}function no(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,R2(n)),Kt!==null)for(n=Kt.return;n!==null;){var r=n;switch(Gy(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Sf();break;case 3:ja(),jt(Vn),jt(Nn),ix();break;case 5:rx(r);break;case 4:ja();break;case 13:jt(Lt);break;case 19:jt(Lt);break;case 10:Zy(r.type._context);break;case 22:case 23:mx()}n=n.return}if(rn=e,Kt=e=vs(e.current,null),cn=Jn=t,Qt=0,Tc=null,fx=Sp=fo=0,Fn=ic=null,Zs!==null){for(t=0;t<Zs.length;t++)if(n=Zs[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}Zs=null}return e}function nj(e,t){do{var n=Kt;try{if(Qy(),Xd.current=Tf,Af){for(var r=Ot.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}Af=!1}if(uo=0,tn=Xt=Ot=null,nc=!1,_c=0,dx.current=null,n===null||n.return===null){Qt=1,Tc=t,Kt=null;break}e:{var s=e,o=n.return,a=n,c=t;if(t=cn,a.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,p=a,d=p.tag;if(!(p.mode&1)&&(d===0||d===11||d===15)){var f=p.alternate;f?(p.updateQueue=f.updateQueue,p.memoizedState=f.memoizedState,p.lanes=f.lanes):(p.updateQueue=null,p.memoizedState=null)}var h=Qv(o);if(h!==null){h.flags&=-257,Zv(h,o,a,s,t),h.mode&1&&Jv(s,u,t),t=h,c=u;var g=t.updateQueue;if(g===null){var b=new Set;b.add(c),t.updateQueue=b}else g.add(c);break e}else{if(!(t&1)){Jv(s,u,t),gx();break e}c=Error(ae(426))}}else if(_t&&a.mode&1){var k=Qv(o);if(k!==null){!(k.flags&65536)&&(k.flags|=256),Zv(k,o,a,s,t),Xy(Ca(c,a));break e}}s=c=Ca(c,a),Qt!==4&&(Qt=2),ic===null?ic=[s]:ic.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t;var y=FN(s,c,t);Wv(s,y);break e;case 1:a=c;var v=s.type,w=s.stateNode;if(!(s.flags&128)&&(typeof v.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(xs===null||!xs.has(w)))){s.flags|=65536,t&=-t,s.lanes|=t;var N=zN(s,a,t);Wv(s,N);break e}}s=s.return}while(s!==null)}sj(n)}catch(C){t=C,Kt===n&&n!==null&&(Kt=n=n.return);continue}break}while(!0)}function rj(){var e=Rf.current;return Rf.current=Tf,e===null?Tf:e}function gx(){(Qt===0||Qt===3||Qt===2)&&(Qt=4),rn===null||!(fo&268435455)&&!(Sp&268435455)||as(rn,cn)}function Mf(e,t){var n=rt;rt|=2;var r=rj();(rn!==e||cn!==t)&&(Ci=null,no(e,t));do try{iT();break}catch(i){nj(e,i)}while(!0);if(Qy(),rt=n,Rf.current=r,Kt!==null)throw Error(ae(261));return rn=null,cn=0,Qt}function iT(){for(;Kt!==null;)ij(Kt)}function sT(){for(;Kt!==null&&!IA();)ij(Kt)}function ij(e){var t=aj(e.alternate,e,Jn);e.memoizedProps=e.pendingProps,t===null?sj(e):Kt=t,dx.current=null}function sj(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=Q2(n,t),n!==null){n.flags&=32767,Kt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Qt=6,Kt=null;return}}else if(n=J2(n,t,Jn),n!==null){Kt=n;return}if(t=t.sibling,t!==null){Kt=t;return}Kt=t=e}while(t!==null);Qt===0&&(Qt=5)}function Gs(e,t,n){var r=dt,i=xr.transition;try{xr.transition=null,dt=1,oT(e,t,n,r)}finally{xr.transition=i,dt=r}return null}function oT(e,t,n,r){do ma();while(us!==null);if(rt&6)throw Error(ae(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(ae(177));e.callbackNode=null,e.callbackPriority=0;var s=n.lanes|n.childLanes;if(zA(e,s),e===rn&&(Kt=rn=null,cn=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||hd||(hd=!0,lj(yf,function(){return ma(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=xr.transition,xr.transition=null;var o=dt;dt=1;var a=rt;rt|=4,dx.current=null,eT(e,n),ZN(n,e),C2(ug),wf=!!cg,ug=cg=null,e.current=n,tT(n),AA(),rt=a,dt=o,xr.transition=s}else e.current=n;if(hd&&(hd=!1,us=e,Of=i),s=e.pendingLanes,s===0&&(xs=null),LA(n.stateNode),Kn(e,Ht()),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(Lf)throw Lf=!1,e=Ig,Ig=null,e;return Of&1&&e.tag!==0&&ma(),s=e.pendingLanes,s&1?e===Ag?sc++:(sc=0,Ag=e):sc=0,Ts(),null}function ma(){if(us!==null){var e=F1(Of),t=xr.transition,n=dt;try{if(xr.transition=null,dt=16>e?16:e,us===null)var r=!1;else{if(e=us,us=null,Of=0,rt&6)throw Error(ae(331));var i=rt;for(rt|=4,be=e.current;be!==null;){var s=be,o=s.child;if(be.flags&16){var a=s.deletions;if(a!==null){for(var c=0;c<a.length;c++){var u=a[c];for(be=u;be!==null;){var p=be;switch(p.tag){case 0:case 11:case 15:rc(8,p,s)}var d=p.child;if(d!==null)d.return=p,be=d;else for(;be!==null;){p=be;var f=p.sibling,h=p.return;if(XN(p),p===u){be=null;break}if(f!==null){f.return=h,be=f;break}be=h}}}var g=s.alternate;if(g!==null){var b=g.child;if(b!==null){g.child=null;do{var k=b.sibling;b.sibling=null,b=k}while(b!==null)}}be=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,be=o;else e:for(;be!==null;){if(s=be,s.flags&2048)switch(s.tag){case 0:case 11:case 15:rc(9,s,s.return)}var y=s.sibling;if(y!==null){y.return=s.return,be=y;break e}be=s.return}}var v=e.current;for(be=v;be!==null;){o=be;var w=o.child;if(o.subtreeFlags&2064&&w!==null)w.return=o,be=w;else e:for(o=v;be!==null;){if(a=be,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:kp(9,a)}}catch(C){Ft(a,a.return,C)}if(a===o){be=null;break e}var N=a.sibling;if(N!==null){N.return=a.return,be=N;break e}be=a.return}}if(rt=i,Ts(),ci&&typeof ci.onPostCommitFiberRoot=="function")try{ci.onPostCommitFiberRoot(hp,e)}catch{}r=!0}return r}finally{dt=n,xr.transition=t}}return!1}function f0(e,t,n){t=Ca(n,t),t=FN(e,t,1),e=ys(e,t,1),t=An(),e!==null&&(eu(e,1,t),Kn(e,t))}function Ft(e,t,n){if(e.tag===3)f0(e,e,n);else for(;t!==null;){if(t.tag===3){f0(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(xs===null||!xs.has(r))){e=Ca(n,e),e=zN(t,e,1),t=ys(t,e,1),e=An(),t!==null&&(eu(t,1,e),Kn(t,e));break}}t=t.return}}function aT(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=An(),e.pingedLanes|=e.suspendedLanes&n,rn===e&&(cn&n)===n&&(Qt===4||Qt===3&&(cn&130023424)===cn&&500>Ht()-px?no(e,0):fx|=n),Kn(e,t)}function oj(e,t){t===0&&(e.mode&1?(t=id,id<<=1,!(id&130023424)&&(id=4194304)):t=1);var n=An();e=Di(e,t),e!==null&&(eu(e,t,n),Kn(e,n))}function lT(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),oj(e,n)}function cT(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(ae(314))}r!==null&&r.delete(t),oj(e,n)}var aj;aj=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Vn.current)zn=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return zn=!1,X2(e,t,n);zn=!!(e.flags&131072)}else zn=!1,_t&&t.flags&1048576&&dN(t,Cf,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Qd(e,t),e=t.pendingProps;var i=ka(t,Nn.current);ha(t,n),i=ox(null,t,r,e,i,n);var s=ax();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,Wn(r)?(s=!0,Nf(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,tx(t),i.updater=bp,t.stateNode=i,i._reactInternals=t,wg(t,r,e,n),t=kg(null,t,r,!0,s,n)):(t.tag=0,_t&&s&&qy(t),_n(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Qd(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=dT(r),e=Er(r,e),i){case 0:t=bg(null,t,r,e,n);break e;case 1:t=n0(null,t,r,e,n);break e;case 11:t=e0(null,t,r,e,n);break e;case 14:t=t0(null,t,r,Er(r.type,e),n);break e}throw Error(ae(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Er(r,i),bg(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Er(r,i),n0(e,t,r,i,n);case 3:e:{if(VN(t),e===null)throw Error(ae(387));r=t.pendingProps,s=t.memoizedState,i=s.element,yN(e,t),_f(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=Ca(Error(ae(423)),t),t=r0(e,t,r,n,i);break e}else if(r!==i){i=Ca(Error(ae(424)),t),t=r0(e,t,r,n,i);break e}else for(er=gs(t.stateNode.containerInfo.firstChild),nr=t,_t=!0,Ir=null,n=mN(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Sa(),r===i){t=$i(e,t,n);break e}_n(e,t,r,n)}t=t.child}return t;case 5:return xN(t),e===null&&gg(t),r=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,dg(r,i)?o=null:s!==null&&dg(r,s)&&(t.flags|=32),UN(e,t),_n(e,t,o,n),t.child;case 6:return e===null&&gg(t),null;case 13:return WN(e,t,n);case 4:return nx(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Na(t,null,r,n):_n(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Er(r,i),e0(e,t,r,i,n);case 7:return _n(e,t,t.pendingProps,n),t.child;case 8:return _n(e,t,t.pendingProps.children,n),t.child;case 12:return _n(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,wt(Ef,r._currentValue),r._currentValue=o,s!==null)if($r(s.value,o)){if(s.children===i.children&&!Vn.current){t=$i(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var c=a.firstContext;c!==null;){if(c.context===r){if(s.tag===1){c=Li(-1,n&-n),c.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var p=u.pending;p===null?c.next=c:(c.next=p.next,p.next=c),u.pending=c}}s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),yg(s.return,n,t),a.lanes|=n;break}c=c.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(ae(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),yg(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}_n(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,ha(t,n),i=wr(i),r=r(i),t.flags|=1,_n(e,t,r,n),t.child;case 14:return r=t.type,i=Er(r,t.pendingProps),i=Er(r.type,i),t0(e,t,r,i,n);case 15:return BN(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Er(r,i),Qd(e,t),t.tag=1,Wn(r)?(e=!0,Nf(t)):e=!1,ha(t,n),$N(t,r,i),wg(t,r,i,n),kg(null,t,r,!0,e,n);case 19:return KN(e,t,n);case 22:return HN(e,t,n)}throw Error(ae(156,t.tag))};function lj(e,t){return O1(e,t)}function uT(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 yr(e,t,n,r){return new uT(e,t,n,r)}function yx(e){return e=e.prototype,!(!e||!e.isReactComponent)}function dT(e){if(typeof e=="function")return yx(e)?1:0;if(e!=null){if(e=e.$$typeof,e===My)return 11;if(e===Dy)return 14}return 2}function vs(e,t){var n=e.alternate;return n===null?(n=yr(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 tf(e,t,n,r,i,s){var o=2;if(r=e,typeof e=="function")yx(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Ko:return ro(n.children,i,s,t);case Oy:o=8,i|=8;break;case Um:return e=yr(12,n,t,i|2),e.elementType=Um,e.lanes=s,e;case Vm:return e=yr(13,n,t,i),e.elementType=Vm,e.lanes=s,e;case Wm:return e=yr(19,n,t,i),e.elementType=Wm,e.lanes=s,e;case x1:return Np(n,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case g1:o=10;break e;case y1:o=9;break e;case My:o=11;break e;case Dy:o=14;break e;case rs:o=16,r=null;break e}throw Error(ae(130,e==null?e:typeof e,""))}return t=yr(o,n,t,i),t.elementType=e,t.type=r,t.lanes=s,t}function ro(e,t,n,r){return e=yr(7,e,r,t),e.lanes=n,e}function Np(e,t,n,r){return e=yr(22,e,r,t),e.elementType=x1,e.lanes=n,e.stateNode={isHidden:!1},e}function Zh(e,t,n){return e=yr(6,e,null,t),e.lanes=n,e}function em(e,t,n){return t=yr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function fT(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=Lh(0),this.expirationTimes=Lh(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Lh(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function xx(e,t,n,r,i,s,o,a,c){return e=new fT(e,t,n,a,c),t===1?(t=1,s===!0&&(t|=8)):t=0,s=yr(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},tx(s),e}function pT(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Wo,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function cj(e){if(!e)return Ns;e=e._reactInternals;e:{if(bo(e)!==e||e.tag!==1)throw Error(ae(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Wn(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(ae(171))}if(e.tag===1){var n=e.type;if(Wn(n))return cN(e,n,t)}return t}function uj(e,t,n,r,i,s,o,a,c){return e=xx(n,r,!0,e,i,s,o,a,c),e.context=cj(null),n=e.current,r=An(),i=ws(n),s=Li(r,i),s.callback=t??null,ys(n,s,i),e.current.lanes=i,eu(e,i,r),Kn(e,r),e}function jp(e,t,n,r){var i=t.current,s=An(),o=ws(i);return n=cj(n),t.context===null?t.context=n:t.pendingContext=n,t=Li(s,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=ys(i,t,o),e!==null&&(Dr(e,i,o,s),Gd(e,i,o)),o}function Df(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 p0(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function wx(e,t){p0(e,t),(e=e.alternate)&&p0(e,t)}function hT(){return null}var dj=typeof reportError=="function"?reportError:function(e){console.error(e)};function vx(e){this._internalRoot=e}Cp.prototype.render=vx.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(ae(409));jp(e,t,null,null)};Cp.prototype.unmount=vx.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;po(function(){jp(null,e,null,null)}),t[Mi]=null}};function Cp(e){this._internalRoot=e}Cp.prototype.unstable_scheduleHydration=function(e){if(e){var t=H1();e={blockedOn:null,target:e,priority:t};for(var n=0;n<os.length&&t!==0&&t<os[n].priority;n++);os.splice(n,0,e),n===0&&V1(e)}};function bx(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Ep(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function h0(){}function mT(e,t,n,r,i){if(i){if(typeof r=="function"){var s=r;r=function(){var u=Df(o);s.call(u)}}var o=uj(t,r,e,0,null,!1,!1,"",h0);return e._reactRootContainer=o,e[Mi]=o.current,Nc(e.nodeType===8?e.parentNode:e),po(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r=="function"){var a=r;r=function(){var u=Df(c);a.call(u)}}var c=xx(e,0,!1,null,null,!1,!1,"",h0);return e._reactRootContainer=c,e[Mi]=c.current,Nc(e.nodeType===8?e.parentNode:e),po(function(){jp(t,c,n,r)}),c}function Pp(e,t,n,r,i){var s=n._reactRootContainer;if(s){var o=s;if(typeof i=="function"){var a=i;i=function(){var c=Df(o);a.call(c)}}jp(t,o,e,i)}else o=mT(n,t,e,i,r);return Df(o)}z1=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Kl(t.pendingLanes);n!==0&&(zy(t,n|1),Kn(t,Ht()),!(rt&6)&&(Ea=Ht()+500,Ts()))}break;case 13:po(function(){var r=Di(e,1);if(r!==null){var i=An();Dr(r,e,1,i)}}),wx(e,1)}};By=function(e){if(e.tag===13){var t=Di(e,134217728);if(t!==null){var n=An();Dr(t,e,134217728,n)}wx(e,134217728)}};B1=function(e){if(e.tag===13){var t=ws(e),n=Di(e,t);if(n!==null){var r=An();Dr(n,e,t,r)}wx(e,t)}};H1=function(){return dt};U1=function(e,t){var n=dt;try{return dt=e,t()}finally{dt=n}};tg=function(e,t,n){switch(t){case"input":if(qm(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=xp(r);if(!i)throw Error(ae(90));v1(r),qm(r,i)}}}break;case"textarea":k1(e,n);break;case"select":t=n.value,t!=null&&ua(e,!!n.multiple,t,!1)}};_1=hx;I1=po;var gT={usingClientEntryPoint:!1,Events:[nu,Xo,xp,E1,P1,hx]},Ll={findFiberByHostInstance:Qs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},yT={bundleType:Ll.bundleType,version:Ll.version,rendererPackageName:Ll.rendererPackageName,rendererConfig:Ll.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Hi.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=R1(e),e===null?null:e.stateNode},findFiberByHostInstance:Ll.findFiberByHostInstance||hT,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 md=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!md.isDisabled&&md.supportsFiber)try{hp=md.inject(yT),ci=md}catch{}}or.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=gT;or.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!bx(t))throw Error(ae(200));return pT(e,t,null,n)};or.createRoot=function(e,t){if(!bx(e))throw Error(ae(299));var n=!1,r="",i=dj;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=xx(e,1,!1,null,null,n,!1,r,i),e[Mi]=t.current,Nc(e.nodeType===8?e.parentNode:e),new vx(t)};or.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(ae(188)):(e=Object.keys(e).join(","),Error(ae(268,e)));return e=R1(t),e=e===null?null:e.stateNode,e};or.flushSync=function(e){return po(e)};or.hydrate=function(e,t,n){if(!Ep(t))throw Error(ae(200));return Pp(null,e,t,!0,n)};or.hydrateRoot=function(e,t,n){if(!bx(e))throw Error(ae(405));var r=n!=null&&n.hydratedSources||null,i=!1,s="",o=dj;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=uj(t,null,e,1,n??null,i,!1,s,o),e[Mi]=t.current,Nc(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 Cp(t)};or.render=function(e,t,n){if(!Ep(t))throw Error(ae(200));return Pp(null,e,t,!1,n)};or.unmountComponentAtNode=function(e){if(!Ep(e))throw Error(ae(40));return e._reactRootContainer?(po(function(){Pp(null,null,e,!1,function(){e._reactRootContainer=null,e[Mi]=null})}),!0):!1};or.unstable_batchedUpdates=hx;or.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Ep(n))throw Error(ae(200));if(e==null||e._reactInternals===void 0)throw Error(ae(38));return Pp(e,t,n,!1,r)};or.version="18.3.1-next-f1338f8080-20240426";function fj(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(fj)}catch(e){console.error(e)}}fj(),f1.exports=or;var Tr=f1.exports,m0=Tr;Bm.createRoot=m0.createRoot,Bm.hydrateRoot=m0.hydrateRoot;const pj=m.createContext(null);function Lg(e){let t=e||"/";return t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t||"/"}function xT(){const e=Lg(window.location.pathname);return e==="/"?(window.history.replaceState({},"","/projects"),"/projects"):e}function wT({children:e}){const[t,n]=m.useState(xT);m.useEffect(()=>{const s=()=>n(Lg(window.location.pathname));return window.addEventListener("popstate",s),()=>window.removeEventListener("popstate",s)},[]);const r=m.useCallback(s=>{const o=s.startsWith("/")?s:`/${s}`;let a;try{a=new URL(o,window.location.origin)}catch{a=new URL("/",window.location.origin)}const c=Lg(a.pathname),u=a.search||"";window.history.pushState({},"",c+u),n(c)},[]),i=m.useMemo(()=>({path:t,navigate:r}),[t,r]);return l.jsx(pj.Provider,{value:i,children:e})}function ko(){const e=m.useContext(pj);if(!e)throw new Error("useRoute must be used within RouteProvider");return e}function vT(){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 g0={};function Og(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];typeof t[0]=="string"&&g0[t[0]]||(typeof t[0]=="string"&&(g0[t[0]]=new Date),vT(...t))}const hj=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}};function y0(e,t,n){e.loadNamespaces(t,hj(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,hj(e,r))}function bT(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=(a,c)=>{const u=t.services.backendConnector.state[`${a}|${c}`];return u===-1||u===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!o(t.isLanguageChangingTo,e)?!1:!!(t.hasResourceBundle(r,e)||!t.services.backendConnector.backend||t.options.resources&&!t.options.partialBundledLanguages||o(r,e)&&(!i||o(s,e)))}function kT(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(Og("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}}):bT(e,t,n)}const ST=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,NT={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},jT=e=>NT[e],CT=e=>e.replace(ST,jT);let Mg={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:CT};function ET(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Mg={...Mg,...e}}function PT(){return Mg}let mj;function _T(e){mj=e}function IT(){return mj}const AT={type:"3rdParty",init(e){ET(e.options.react),_T(e)}},TT=m.createContext();class RT{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const LT=(e,t)=>{const n=m.useRef();return m.useEffect(()=>{n.current=e},[e,t]),n.current};function bt(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=t,{i18n:r,defaultNS:i}=m.useContext(TT)||{},s=n||r||IT();if(s&&!s.reportNamespaces&&(s.reportNamespaces=new RT),!s){Og("You will need to pass in an i18next instance by using initReactI18next");const w=(C,S)=>typeof S=="string"?S:S&&typeof S=="object"&&typeof S.defaultValue=="string"?S.defaultValue:Array.isArray(C)?C[C.length-1]:C,N=[w,{},!1];return N.t=w,N.i18n={},N.ready=!1,N}s.options.react&&s.options.react.wait!==void 0&&Og("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const o={...PT(),...s.options.react,...t},{useSuspense:a,keyPrefix:c}=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=>kT(w,s,o));function d(){return s.getFixedT(t.lng||null,o.nsMode==="fallback"?u:u[0],c)}const[f,h]=m.useState(d);let g=u.join();t.lng&&(g=`${t.lng}${g}`);const b=LT(g),k=m.useRef(!0);m.useEffect(()=>{const{bindI18n:w,bindI18nStore:N}=o;k.current=!0,!p&&!a&&(t.lng?x0(s,t.lng,u,()=>{k.current&&h(d)}):y0(s,u,()=>{k.current&&h(d)})),p&&b&&b!==g&&k.current&&h(d);function C(){k.current&&h(d)}return w&&s&&s.on(w,C),N&&s&&s.store.on(N,C),()=>{k.current=!1,w&&s&&w.split(" ").forEach(S=>s.off(S,C)),N&&s&&N.split(" ").forEach(S=>s.store.off(S,C))}},[s,g]);const y=m.useRef(!0);m.useEffect(()=>{k.current&&!y.current&&h(d),y.current=!1},[s,c]);const v=[f,s,p];if(v.t=f,v.i18n=s,v.ready=p,p||!p&&!a)return v;throw new Promise(w=>{t.lng?x0(s,t.lng,u,()=>w()):y0(s,u,()=>w())})}const gj="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",OT=[{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"}],MT=[{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 DT(e,t){return t==="/projects"?e==="/projects"||e==="/":e===t||e.startsWith(t+"/")}function $T({authUser:e,onLogout:t}){const{path:n,navigate:r}=ko(),{t:i}=bt(),[s,o]=m.useState(!1);return m.useEffect(()=>{let a=!1;return fetch("/api/ui-context").then(c=>c.json()).then(c=>{a||o(!!c.hideCommunityLinks)}).catch(()=>{}),()=>{a=!0}},[]),l.jsxs("aside",{className:"af-sidebar","aria-label":i("flow:sidebar.mainNav"),children:[l.jsxs("div",{className:"af-brand",children:[l.jsx("div",{className:"af-brand-mark","aria-hidden":!0,children:l.jsx("img",{src:gj,alt:"",width:"36",height:"36",decoding:"async"})}),l.jsxs("div",{children:[l.jsx("h1",{className:"af-brand-title",children:"Agentflow"}),l.jsx("p",{className:"af-brand-tag",children:"Orchestration Engine"})]})]}),l.jsx("nav",{className:"af-nav",children:OT.map(a=>l.jsxs("button",{type:"button",className:"af-nav-link"+(DT(n,a.to)?" af-nav-link--active":""),onClick:()=>r(a.to),children:[l.jsx("span",{className:"material-symbols-outlined",children:a.icon}),l.jsx("span",{children:i(a.labelKey)})]},a.to))}),l.jsxs("div",{className:"af-sidebar-footer",children:[l.jsxs("div",{className:"af-sidebar-user",title:(e==null?void 0:e.username)||(e==null?void 0:e.userId)||"",children:[l.jsx("span",{className:"material-symbols-outlined",children:"person"}),l.jsx("span",{children:(e==null?void 0:e.username)||(e==null?void 0:e.userId)||""}),l.jsx("button",{type:"button",className:"af-sidebar-logout",onClick:t,"aria-label":"Logout",title:"Logout",children:l.jsx("span",{className:"material-symbols-outlined",children:"logout"})})]}),!s&&MT.map(a=>{const c=i(a.labelKey);return l.jsx("a",{className:"af-sidebar-ext",href:a.href,target:"_blank",rel:"noopener noreferrer","aria-label":c,title:c,children:l.jsx("span",{className:"material-symbols-outlined",children:a.icon})},a.href)})]})]})}const yj="agentflow.pipelineRecent",FT=50,zT=15;function BT(e){try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function xj(){if(typeof localStorage>"u")return[];const e=localStorage.getItem(yj);return e?BT(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 gd(e,t){if(typeof localStorage>"u")return;const n=Date.now(),r=xj(),s=[{flowId:e,flowSource:t,kind:"opened",at:n},...r.filter(o=>!(o.flowId===e&&o.flowSource===t))].slice(0,FT);try{localStorage.setItem(yj,JSON.stringify(s))}catch{}}function HT(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 Dg(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 a=new Date(e),c=new Date,u=new Date(c);if(u.setDate(u.getDate()-1),a.toDateString()===u.toDateString())return t("flow:time.yesterday");const p=Math.floor(o/24);return p<7?t("flow:time.daysAgo",{n:p}):`${a.getMonth()+1}/${a.getDate()}`}function UT(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 VT(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:HT(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,zT)}var Qn=Uint8Array,ra=Uint16Array,WT=Int32Array,wj=new Qn([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]),vj=new Qn([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]),KT=new Qn([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),bj=function(e,t){for(var n=new ra(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new WT(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}},kj=bj(wj,2),Sj=kj.b,YT=kj.r;Sj[28]=258,YT[258]=28;var qT=bj(vj,0),GT=qT.b,$g=new ra(32768);for(var Nt=0;Nt<32768;++Nt){var Zi=(Nt&43690)>>1|(Nt&21845)<<1;Zi=(Zi&52428)>>2|(Zi&13107)<<2,Zi=(Zi&61680)>>4|(Zi&3855)<<4,$g[Nt]=((Zi&65280)>>8|(Zi&255)<<8)>>1}var oc=function(e,t,n){for(var r=e.length,i=0,s=new ra(t);i<r;++i)e[i]&&++s[e[i]-1];var o=new ra(t);for(i=1;i<t;++i)o[i]=o[i-1]+s[i-1]<<1;var a;if(n){a=new ra(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var u=i<<4|e[i],p=t-e[i],d=o[e[i]-1]++<<p,f=d|(1<<p)-1;d<=f;++d)a[$g[d]>>c]=u}else for(a=new ra(r),i=0;i<r;++i)e[i]&&(a[i]=$g[o[e[i]-1]++]>>15-e[i]);return a},iu=new Qn(288);for(var Nt=0;Nt<144;++Nt)iu[Nt]=8;for(var Nt=144;Nt<256;++Nt)iu[Nt]=9;for(var Nt=256;Nt<280;++Nt)iu[Nt]=7;for(var Nt=280;Nt<288;++Nt)iu[Nt]=8;var Nj=new Qn(32);for(var Nt=0;Nt<32;++Nt)Nj[Nt]=5;var XT=oc(iu,9,1),JT=oc(Nj,5,1),tm=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Cr=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},nm=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},QT=function(e){return(e+7)/8|0},kx=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new Qn(e.subarray(t,n))},ZT=["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"],fr=function(e,t,n){var r=new Error(t||ZT[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,fr),!n)throw r;return r},eR=function(e,t,n,r){var i=e.length,s=r?r.length:0;if(!i||t.f&&!t.l)return n||new Qn(0);var o=!n,a=o||t.i!=2,c=t.i;o&&(n=new Qn(i*3));var u=function(ke){var he=n.length;if(ke>he){var Se=new Qn(Math.max(he*2,ke));Se.set(n),n=Se}},p=t.f||0,d=t.p||0,f=t.b||0,h=t.l,g=t.d,b=t.m,k=t.n,y=i*8;do{if(!h){p=Cr(e,d,1);var v=Cr(e,d+1,3);if(d+=3,v)if(v==1)h=XT,g=JT,b=9,k=5;else if(v==2){var S=Cr(e,d,31)+257,P=Cr(e,d+10,15)+4,R=S+Cr(e,d+5,31)+1;d+=14;for(var M=new Qn(R),H=new Qn(19),_=0;_<P;++_)H[KT[_]]=Cr(e,d+_*3,7);d+=P*3;for(var A=tm(H),U=(1<<A)-1,L=oc(H,A,1),_=0;_<R;){var B=L[Cr(e,d,U)];d+=B&15;var w=B>>4;if(w<16)M[_++]=w;else{var $=0,F=0;for(w==16?(F=3+Cr(e,d,3),d+=2,$=M[_-1]):w==17?(F=3+Cr(e,d,7),d+=3):w==18&&(F=11+Cr(e,d,127),d+=7);F--;)M[_++]=$}}var I=M.subarray(0,S),T=M.subarray(S);b=tm(I),k=tm(T),h=oc(I,b,1),g=oc(T,k,1)}else fr(1);else{var w=QT(d)+4,N=e[w-4]|e[w-3]<<8,C=w+N;if(C>i){c&&fr(0);break}a&&u(f+N),n.set(e.subarray(w,C),f),t.b=f+=N,t.p=d=C*8,t.f=p;continue}if(d>y){c&&fr(0);break}}a&&u(f+131072);for(var E=(1<<b)-1,q=(1<<k)-1,W=d;;W=d){var $=h[nm(e,d)&E],O=$>>4;if(d+=$&15,d>y){c&&fr(0);break}if($||fr(2),O<256)n[f++]=O;else if(O==256){W=d,h=null;break}else{var X=O-254;if(O>264){var _=O-257,se=wj[_];X=Cr(e,d,(1<<se)-1)+Sj[_],d+=se}var re=g[nm(e,d)&q],de=re>>4;re||fr(3),d+=re&15;var T=GT[de];if(de>3){var se=vj[de];T+=nm(e,d)&(1<<se)-1,d+=se}if(d>y){c&&fr(0);break}a&&u(f+131072);var ie=f+X;if(f<T){var me=s-T,ye=Math.min(T,ie);for(me+f<0&&fr(3);f<ye;++f)n[f]=r[me+f]}for(;f<ie;++f)n[f]=n[f-T]}}t.l=h,t.p=W,t.b=f,t.f=p,h&&(p=1,t.m=b,t.d=g,t.n=k)}while(!p);return f!=n.length&&o?kx(n,0,f):n.subarray(0,f)},tR=new Qn(0),oi=function(e,t){return e[t]|e[t+1]<<8},Ar=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},rm=function(e,t){return Ar(e,t)+Ar(e,t+4)*4294967296};function nR(e,t){return eR(e,{i:2},t&&t.out,t&&t.dictionary)}var Fg=typeof TextDecoder<"u"&&new TextDecoder,rR=0;try{Fg.decode(tR,{stream:!0}),rR=1}catch{}var iR=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:kx(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 sR(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(Fg)return Fg.decode(e);var i=iR(e),s=i.s,n=i.r;return n.length&&fr(8),s}}var oR=function(e,t){return t+30+oi(e,t+26)+oi(e,t+28)},aR=function(e,t,n){var r=oi(e,t+28),i=sR(e.subarray(t+46,t+46+r),!(oi(e,t+8)&2048)),s=t+46+r,o=Ar(e,t+20),a=n&&o==4294967295?lR(e,s):[o,Ar(e,t+24),Ar(e,t+42)],c=a[0],u=a[1],p=a[2];return[oi(e,t+10),c,u,i,s+oi(e,t+30)+oi(e,t+32),p]},lR=function(e,t){for(;oi(e,t)!=1;t+=4+oi(e,t+2));return[rm(e,t+12),rm(e,t+4),rm(e,t+20)]};function cR(e,t){for(var n={},r=e.length-22;Ar(e,r)!=101010256;--r)(!r||e.length-r>65558)&&fr(13);var i=oi(e,r+8);if(!i)return{};var s=Ar(e,r+16),o=s==4294967295||i==65535;if(o){var a=Ar(e,r-12);o=Ar(e,a)==101075792,o&&(i=Ar(e,a+32),s=Ar(e,a+48))}for(var c=0;c<i;++c){var u=aR(e,s,o),p=u[0],d=u[1],f=u[2],h=u[3],g=u[4],b=u[5],k=oR(e,b);s=g,p?p==8?n[h]=nR(e.subarray(k,k+d),{out:new Qn(f)}):fr(14,"unknown compression type "+p):n[h]=kx(e,k,k+d)}return n}const uR=8*1024*1024,dR=500;function fR(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 pR(e){return e?e.split("/").some(n=>n==="__MACOSX"||n.startsWith("._")):!0}function hR(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 mR=/^[a-zA-Z][a-zA-Z0-9_-]*$/;async function gR(e){try{const t=new Uint8Array(await e.arrayBuffer()),n=cR(t),r=new Map;let i=0,s=0;for(const[c,u]of Object.entries(n)){if(c.endsWith("/"))continue;const p=fR(c);if(!p||pR(p))continue;const d=(u==null?void 0:u.length)??0;if(i+=d,i>uR||(s+=1,s>dR))return null;r.set(p,d)}if(r.size===0)return null;const o=new Set;for(const c of r.keys()){const u=hR(c);u!==null&&o.add(u)}if(o.size!==1)return null;const[a]=[...o];if(a==="")return null;for(const c of r.keys())if(!(c===a||c.startsWith(`${a}/`)))return null;return mR.test(a)?a:null}catch{return null}}const im=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function yR({file:e,onClose:t,onImported:n}){const{t:r}=bt(),i=m.useId(),s=m.useRef(null),o=m.useRef(null),[a,c]=m.useState(""),[u,p]=m.useState("user"),[d,f]=m.useState(!1),[h,g]=m.useState(""),[b,k]=m.useState(null),y=b??e;m.useEffect(()=>{const C=requestAnimationFrame(()=>{var S;return(S=s.current)==null?void 0:S.focus()});return()=>cancelAnimationFrame(C)},[]),m.useEffect(()=>{let C=!1;return(async()=>{const S=y.name||"",P=S.toLowerCase();let R="";if(P.endsWith(".zip")){if(R=await gR(y)||"",!R){const M=S.replace(/\.zip$/i,"");im.test(M)&&(R=M)}}else if(P.endsWith(".yaml")||P.endsWith(".yml")){const M=S.replace(/\.ya?ml$/i,"");im.test(M)&&(R=M)}C||c(R)})(),()=>{C=!0}},[y]);const v=a.trim(),w=v.length>0&&im.test(v);async function N(C){if(C.preventDefault(),!(!w||d)){f(!0),g("");try{const S=new FormData;S.set("flowId",v),S.set("targetSpace",u),S.set("file",y,y.name);const P=await fetch("/api/flows/import",{method:"POST",body:S}),R=await P.json().catch(()=>({}));if(!P.ok){g(typeof R.error=="string"?R.error:r("project:importModal.importFailed"));return}n({id:R.flowId,source:R.flowSource??"user"})}catch(S){g(String((S==null?void 0:S.message)||S))}finally{f(!1)}}}return l.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:C=>{C.target===C.currentTarget&&t()},children:l.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:[l.jsxs("div",{className:"af-shortcuts-panel__head",children:[l.jsx("h2",{id:i,className:"af-shortcuts-panel__title",children:r("project:importModal.title")}),l.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":r("project:importModal.close"),children:l.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),l.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:N,children:[l.jsx("p",{className:"af-new-pipeline-lead",children:r("project:importModal.lead",{filename:y.name})}),l.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 S=(P=C.target.files)==null?void 0:P[0];S&&k(S),C.target.value=""}}),l.jsxs("label",{className:"af-pipeline-drawer-field",children:[l.jsx("span",{className:"af-pipeline-drawer-label",children:r("project:importModal.nameLabel")}),l.jsx("input",{className:"af-new-pipeline-input",type:"text",name:"importFlowId",autoComplete:"off",spellCheck:!1,placeholder:r("project:importModal.namePlaceholder"),value:a,onChange:C=>c(C.target.value),"aria-invalid":v.length>0&&!w}),l.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-hint",children:r("project:importModal.nameHint")})]}),l.jsx("div",{className:"af-import-repick",children:l.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?l.jsx("p",{className:"af-err af-new-pipeline-err",children:h}):null,l.jsxs("div",{className:"af-new-pipeline-actions",children:[l.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:d,children:r("project:importModal.cancel")}),l.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!w||d,children:r(d?"project:importModal.importing":"project:importModal.importAndOpen")})]})]})]})})}const xR=/^[a-zA-Z][a-zA-Z0-9_-]*$/,w0="af:newPipelineGuide";function wR({open:e,onClose:t,onCreated:n}){const{t:r}=bt(),i=m.useId(),s=m.useRef(null),[o,a]=m.useState(""),[c,u]=m.useState(""),[p,d]=m.useState("user"),[f,h]=m.useState(!1),[g,b]=m.useState(""),[k,y]=m.useState(!1);m.useEffect(()=>{if(!e)return;a(""),u(""),d("user"),b(""),h(!1),localStorage.getItem(w0)==="true"&&y(!0);const P=requestAnimationFrame(()=>{var R;return(R=s.current)==null?void 0:R.focus()});return()=>cancelAnimationFrame(P)},[e]);const v=()=>{localStorage.removeItem(w0),y(!1)};if(!e)return null;const w=o.trim(),N=w.length>0&&xR.test(w);async function C(S){if(S.preventDefault(),!(!N||f)){h(!0),b(""),v();try{const P=await fetch("/api/flows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:w,description:c.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 l.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:S=>{S.target===S.currentTarget&&(v(),t())},children:l.jsxs("div",{ref:s,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":i,tabIndex:-1,onMouseDown:S=>S.stopPropagation(),children:[l.jsxs("div",{className:"af-shortcuts-panel__head",children:[l.jsx("h2",{id:i,className:"af-shortcuts-panel__title",children:r("project:newPipelineModal.title")}),l.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:()=>{v(),t()},"aria-label":r("project:newPipelineModal.close"),children:l.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),k?l.jsx("div",{className:"af-new-pipeline-guide",children:l.jsxs("div",{className:"af-new-pipeline-guide-content",children:[l.jsx("span",{className:"material-symbols-outlined af-new-pipeline-guide-icon",children:"lightbulb"}),l.jsxs("div",{className:"af-new-pipeline-guide-text",children:[l.jsx("p",{children:l.jsx("strong",{children:r("onboarding:newPipeline.guideTitle")})}),l.jsx("p",{children:r("onboarding:newPipeline.guideDesc")})]}),l.jsx("button",{type:"button",className:"af-new-pipeline-guide-close",onClick:v,children:l.jsx("span",{className:"material-symbols-outlined",children:"close"})})]})}):null,l.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:C,children:[l.jsx("p",{className:"af-new-pipeline-lead",children:r("project:newPipelineModal.lead")}),l.jsxs("label",{className:"af-pipeline-drawer-field",children:[l.jsx("span",{className:"af-pipeline-drawer-label",children:r("project:newPipelineModal.nameLabel")}),l.jsx("input",{className:"af-new-pipeline-input",type:"text",name:"pipelineName",autoComplete:"off",spellCheck:!1,placeholder:r("project:newPipelineModal.namePlaceholder"),value:o,onChange:S=>a(S.target.value),"aria-invalid":w.length>0&&!N}),l.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-hint",children:r(k?"onboarding:newPipeline.nameHintGuide":"project:newPipelineModal.nameHint")})]}),l.jsxs("label",{className:"af-pipeline-drawer-field",children:[l.jsx("span",{className:"af-pipeline-drawer-label",children:r("project:newPipelineModal.descLabel")}),l.jsx("textarea",{className:"af-pipeline-drawer-textarea af-new-pipeline-textarea",name:"pipelineDescription",rows:3,placeholder:r(k?"onboarding:newPipeline.descPlaceholderGuide":"project:newPipelineModal.descPlaceholder"),value:c,onChange:S=>u(S.target.value)}),k?l.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-guide-hint",children:r("onboarding:newPipeline.descHintGuide")}):null]}),g?l.jsx("p",{className:"af-err af-new-pipeline-err",children:g}):null,l.jsxs("div",{className:"af-new-pipeline-actions",children:[l.jsx("button",{type:"button",className:"af-btn-secondary",onClick:()=>{v(),t()},disabled:f,children:r("project:newPipelineModal.cancel")}),l.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!N||f,children:r(f?"project:newPipelineModal.creating":k?"onboarding:newPipeline.createGuide":"project:newPipelineModal.createAndOpen")})]})]})]})})}const jj="agentflow.pipelineViewPreference";function Cj(e,t="user",n=!1){return`${String(t||"user")}:${String(e||"")}:${n?"archived":"active"}`}function Ej(){if(typeof localStorage>"u")return{};try{const e=JSON.parse(localStorage.getItem(jj)||"{}");return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}catch{return{}}}function vR(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(jj,JSON.stringify(e))}catch{}}function $f(e){return e==="pipeline"?"pipeline":"workspace"}function bR(e){return(e==null?void 0:e.hasPipeline)!==!1&&(e==null?void 0:e.hasFlow)!==!1&&(e==null?void 0:e.flowYaml)!==!1}function Pj(e,t,n,r=!1){if(!e)return;const i=Ej();i[Cj(e,t,r)]={view:$f(n),at:Date.now()},vR(i)}function kR(e,t="workspace"){if(!(e!=null&&e.id))return $f(t);const r=Ej()[Cj(e.id,e.source??"user",!!e.archived)],i=$f((r==null?void 0:r.view)||t);return i==="pipeline"&&!bR(e)?"workspace":i}function Sx(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"),`/${$f(t)==="pipeline"?"flow":"workspace"}?${n.toString()}`}function yd(e,t="workspace"){return Sx(e,kR(e,t))}function SR({onChanged:e}){const[t,n]=m.useState({available:!1,version:"",loggedIn:!1,user:"",error:""}),[r,i]=m.useState([]),[s,o]=m.useState(""),[a,c]=m.useState([]),[u,p]=m.useState(""),[d,f]=m.useState(""),[h,g]=m.useState(""),b=m.useCallback(async()=>{f("");try{const[N,C]=await Promise.all([fetch("/api/skillhub/status"),fetch("/api/skillhub/list?target=global&agent=codex")]),S=await N.json().catch(()=>({}));N.ok&&n({available:!!S.available,version:typeof S.version=="string"?S.version:"",loggedIn:!!S.loggedIn,user:typeof S.user=="string"?S.user:"",error:typeof S.error=="string"?S.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(N){f(String(N.message||N))}},[]);m.useEffect(()=>{b()},[b]);const k=m.useCallback(async()=>{const N=s.trim();if(N){p("search"),f(""),g("");try{const C=await fetch(`/api/skillhub/search?q=${encodeURIComponent(N)}`),S=await C.json().catch(()=>({}));if(!C.ok)throw new Error(typeof S.error=="string"?S.error:"HTTP "+C.status);c(Array.isArray(S.items)?S.items:[])}catch(C){f(String(C.message||C))}finally{p("")}}},[s]),y=m.useCallback(async(N,C=!1)=>{const S=String(N||"").trim();if(S){p(`install:${S}`),f(""),g("");try{const P=await fetch("/api/skillhub/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:S,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);g(C?`已更新 ${S}`:`已安装 ${S}`),await b(),typeof e=="function"&&await e()}catch(P){f(String(P.message||P))}finally{p("")}}},[b,e]),v=m.useCallback(async N=>{const C=String(N||"").trim();if(C){p(`uninstall:${C}`),f(""),g("");try{const S=await fetch("/api/skillhub/uninstall",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:C,target:"global",agent:"codex"})}),P=await S.json().catch(()=>({}));if(!S.ok)throw new Error(typeof P.error=="string"?P.error:"HTTP "+S.status);g(`已卸载 ${C}`),await b(),typeof e=="function"&&await e()}catch(S){f(String(S.message||S))}finally{p("")}}},[b,e]),w=m.useCallback(async()=>{p("update-cli"),f(""),g("");try{const N=await fetch("/api/skillhub/update",{method:"POST"}),C=await N.json().catch(()=>({}));if(!N.ok)throw new Error(typeof C.error=="string"?C.error:"HTTP "+N.status);g("SkillHub CLI 已更新"),await b()}catch(N){f(String(N.message||N))}finally{p("")}},[b]);return l.jsxs("section",{className:"af-set-card af-set-card--span-all af-set-skillhub",children:[l.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[l.jsxs("div",{children:[l.jsx("h2",{className:"af-set-h2",children:"SkillHub"}),l.jsx("p",{className:"af-set-p af-set-p--tight",children:"搜索、安装、更新和卸载 Codex 全局 skills。"})]}),l.jsxs("div",{className:"af-set-skillhub-head-actions",children:[l.jsxs("div",{className:"af-set-skillhub-status",children:[l.jsx("span",{className:"material-symbols-outlined af-set-icon--tertiary",children:"extension"}),l.jsx("span",{children:t.loggedIn?`已登录 ${t.user}`:"未登录 SkillHub"}),l.jsx("span",{className:"af-set-badge"+(t.available?" af-set-badge--ok":" af-set-badge--err"),children:t.available?`v${t.version}`:"not found"})]}),l.jsxs("div",{className:"af-set-skillhub-toolbar",children:[l.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:b,disabled:!!u,children:"刷新"}),l.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:w,disabled:!!u,children:u==="update-cli"?"更新中…":"更新 CLI"})]})]})]}),l.jsxs("div",{className:"af-set-skillhub-search",children:[l.jsx("input",{className:"af-set-input af-set-input--sm",value:s,onChange:N=>o(N.target.value),onKeyDown:N=>{N.key==="Enter"&&k()},placeholder:"搜索 skill slug / 关键词,例如 android、issue-tracker"}),l.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:()=>k(),disabled:!s.trim()||u==="search",children:[l.jsx("span",{className:"material-symbols-outlined",children:"search"}),u==="search"?"搜索中…":"搜索"]})]}),d?l.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:d}):null,h?l.jsx("p",{className:"af-set-hint af-set-hint--inline",children:h}):null,l.jsxs("div",{className:"af-set-skillhub-grid",children:[l.jsxs("div",{className:"af-set-skillhub-pane",children:[l.jsxs("div",{className:"af-set-skillhub-pane-head",children:[l.jsx("h3",{children:"已安装"}),l.jsx("span",{children:r.length})]}),l.jsx("div",{className:"af-set-skillhub-list",children:r.length===0?l.jsx("div",{className:"af-set-skillhub-empty",children:"暂无 Codex 全局 skills"}):r.map(N=>l.jsxs("div",{className:"af-set-skillhub-item",children:[l.jsxs("div",{children:[l.jsx("div",{className:"af-set-skillhub-title",children:N.name}),l.jsxs("div",{className:"af-set-skillhub-meta",children:[N.agent||"codex"," · ",N.kind||"skill"]})]}),l.jsxs("div",{className:"af-set-skillhub-actions",children:[l.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>y(N.name,!0),disabled:!!u,children:"更新"}),l.jsx("button",{type:"button",className:"af-set-btn-mini af-set-btn-mini--danger",onClick:()=>v(N.name),disabled:!!u,children:"卸载"})]})]},`${N.agent}:${N.path}:${N.name}`))})]}),l.jsxs("div",{className:"af-set-skillhub-pane",children:[l.jsxs("div",{className:"af-set-skillhub-pane-head",children:[l.jsx("h3",{children:"搜索结果"}),l.jsx("span",{children:a.length})]}),l.jsx("div",{className:"af-set-skillhub-list",children:a.length===0?l.jsx("div",{className:"af-set-skillhub-empty",children:"输入关键词后搜索 SkillHub"}):a.map(N=>{const C=N.slug||N.name,S=r.some(P=>P.name===C||P.name===N.name);return l.jsxs("div",{className:"af-set-skillhub-item",children:[l.jsxs("div",{children:[l.jsx("div",{className:"af-set-skillhub-title",children:N.name||C}),l.jsxs("div",{className:"af-set-skillhub-meta",children:[C,N.version?` · ${N.version}`:""]}),N.summary?l.jsx("p",{className:"af-set-skillhub-summary",children:N.summary}):null]}),l.jsx("button",{type:"button",className:S?"af-set-btn-mini":"af-set-btn-add af-set-btn-add--compact",onClick:()=>y(C,S),disabled:!!u,children:S?"更新":"安装"})]},N.id||C)})})]})]})]})}function xd(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 NR(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 zg(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 _j(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 jR="project:defaultCardDesc";function Ij(e,t){const n=e.description!=null?String(e.description).trim():"";return n!==""?n:t(jR)}function CR(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function bn({children:e,className:t="",query:n}){const r=n.trim(),i=String(e);if(!r)return l.jsx("span",{className:t,children:i});const s=new RegExp(`(${CR(r)})`,"gi"),o=i.split(s);return l.jsx("span",{className:t,children:o.map((a,c)=>c%2===1?l.jsx("mark",{className:"af-search-hit",children:a},c):l.jsx("span",{children:a},c))})}function ER(e,t,n){const r=[String(e.id),Ij(e,n),_j(e),zg(e.source,n).label];return e.archived&&r.push(n("project:archived")),r.join(`
|
|
41
|
-
`).toLowerCase()}function PR(e,t,n){return t?ER(e,t,n).includes(t):!0}function _R(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 v0(e,t){const n=e.trim().toLowerCase();return n?t.filter(Boolean).join(`
|
|
42
|
-
`).toLowerCase().includes(n):!0}function b0(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 IR=["all","agent","control","provide","marketplace"],AR=["all","builtin","workspace-agents","workspace-cursor"];function wd(e){return!e||typeof e!="object"?[]:Object.entries(e).map(([t,n])=>({key:t,...n&&typeof n=="object"?n:{}}))}function an(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 vd({resourceKind:e=""}){var gn,lr,Ln,Wr,En,Gn;const{t}=bt(),{navigate:n,path:r}=ko(),[i,s]=m.useState(e||"all"),[o,a]=m.useState([]),[c,u]=m.useState([]),[p,d]=m.useState([]),[f,h]=m.useState([]),[g,b]=m.useState(""),[k,y]=m.useState(""),[v,w]=m.useState(!1),[N,C]=m.useState(!1),[S,P]=m.useState(!1),[R,M]=m.useState(null),[H,_]=m.useState(!1),[A,U]=m.useState(""),[L,B]=m.useState(!0),[$,F]=m.useState("all"),[I,T]=m.useState(""),[E,q]=m.useState("overview"),[W,O]=m.useState({}),[X,se]=m.useState(""),[re,de]=m.useState({}),[ie,me]=m.useState(""),[ye,ke]=m.useState(""),[he,Se]=m.useState({}),[Ve,We]=m.useState(""),[He,ut]=m.useState(!1),Ge=m.useRef(0),De=m.useRef(0),kt=m.useCallback(async()=>{const G=++De.current;b("");try{const _e=await fetch("/api/flows");if(G!==De.current)return;if(!_e.ok)throw new Error("HTTP "+_e.status);const K=await _e.json();if(G!==De.current)return;a(Array.isArray(K)?K:[])}catch(_e){if(G!==De.current)return;a([]),b(String(_e.message||_e))}try{const _e=await fetch("/api/pipeline-recent-runs");if(G!==De.current)return;if(_e.ok){const K=await _e.json();if(G!==De.current)return;h(Array.isArray(K.runs)?K.runs:[])}else h([])}catch{if(G!==De.current)return;h([])}w(!0)},[]),Ut=m.useCallback(async()=>{y(""),C(!1);try{const[G,_e]=await Promise.all([fetch("/api/nodes"),fetch("/api/skills")]),K=await G.json().catch(()=>({})),Q=await _e.json().catch(()=>({}));if(!G.ok)throw new Error(K.error||"Nodes HTTP "+G.status);if(!_e.ok)throw new Error(Q.error||"Skills HTTP "+_e.status);u(Array.isArray(K.nodes)?K.nodes:Array.isArray(K)?K:[]),d(Array.isArray(Q.skills)?Q.skills:[])}catch(G){u([]),d([]),y(String(G.message||G))}finally{C(!0)}},[]);m.useEffect(()=>{w(!1),kt(),Ut()},[kt,Ut]),m.useEffect(()=>{let G=!1;return fetch("/api/ui-context").then(_e=>_e.json()).then(_e=>{G||ut(!!_e.hideCommunityLinks)}).catch(()=>{}),()=>{G=!0}},[]),m.useEffect(()=>{if(e==="nodes"||e==="skills"){s(e),F("all"),T(""),q("overview");return}s(G=>G==="archived"?"archived":"all")},[e]),m.useEffect(()=>{if(r!=="/projects"&&r!=="/")return;const G=new URLSearchParams(window.location.search);let _e=!1;if(G.get("tab")==="nodes"){n("/nodes");return}if(G.get("tab")==="skills"){n("/skills");return}if(G.get("tab")==="archived"&&(s("archived"),G.delete("tab"),_e=!0),G.get("new")==="1"&&(P(!0),G.delete("new"),_e=!0),_e){const K=G.toString();window.history.replaceState({},"",K?`/projects?${K}`:"/projects")}},[r,n]);const Ct=m.useMemo(()=>VT(f,xj(),o),[f,o,r]),sn=m.useMemo(()=>Ct.filter(G=>_R(A,G)),[Ct,A]),pn=A.trim().toLowerCase(),on=m.useMemo(()=>i==="archived"?o.filter(G=>G.archived):o.filter(G=>!G.archived),[o,i]),Z=m.useMemo(()=>on.filter(G=>PR(G,pn,t)),[on,pn,t]),oe=m.useMemo(()=>c.filter(G=>($==="all"||($==="marketplace"?G.source==="marketplace":G.type===$))&&v0(A,[G.id,G.label,G.displayName,G.description,G.type,G.source,G.packageId,G.version])),[c,A,$]),je=m.useMemo(()=>p.filter(G=>($==="all"||G.source===$)&&v0(A,[G.name,G.id,G.description,G.sourceLabel,G.source,G.path])),[p,A,$]),$e=i==="nodes"||i==="skills",xe=m.useMemo(()=>oe.find(G=>an(G)===I)||oe[0]||null,[oe,I]),Qe=m.useMemo(()=>je.find(G=>an(G)===I)||je[0]||null,[je,I]),Et=Qe?W[an(Qe)]:null,we=xe?re[an(xe)]:null,pe=xe&&ye?he[`${an(xe)}:${ye}`]:null,it=t(i==="nodes"?"project:searchNodes":i==="skills"?"project:searchSkills":"project:searchPipelines");m.useEffect(()=>{if(i!=="skills"||!Qe)return;const G=an(Qe);if(W[G])return;let _e=!1;return se(G),fetch(`/api/skills/detail?key=${encodeURIComponent(G)}`).then(K=>K.json().then(Q=>({ok:K.ok,json:Q}))).then(({ok:K,json:Q})=>{_e||K&&Q.skill&&O(te=>({...te,[G]:Q.skill}))}).catch(()=>{}).finally(()=>{_e||se("")}),()=>{_e=!0}},[i,Qe,W]),m.useEffect(()=>{if(i!=="nodes"||!xe)return;const G=an(xe);if(re[G])return;let _e=!1;return me(G),fetch(`/api/nodes/detail?id=${encodeURIComponent(xe.id)}`).then(K=>K.json().then(Q=>({ok:K.ok,json:Q}))).then(({ok:K,json:Q})=>{_e||K&&de(te=>({...te,[G]:Q}))}).catch(()=>{}).finally(()=>{_e||me("")}),()=>{_e=!0}},[i,xe,re]),m.useEffect(()=>{if(i!=="nodes")return;const G=Array.isArray(we==null?void 0:we.files)?we.files:[];ke(_e=>{var K;return _e&&G.some(Q=>Q.path===_e)?_e:((K=G[0])==null?void 0:K.path)||""})},[i,we]),m.useEffect(()=>{if(i!=="nodes"||!xe||!ye)return;const G=`${an(xe)}:${ye}`;if(he[G])return;let _e=!1;return We(G),fetch(`/api/nodes/file?id=${encodeURIComponent(xe.id)}&path=${encodeURIComponent(ye)}`).then(K=>K.json().then(Q=>({ok:K.ok,json:Q}))).then(({ok:K,json:Q})=>{_e||K&&Se(te=>({...te,[G]:Q}))}).catch(()=>{}).finally(()=>{_e||We("")}),()=>{_e=!0}},[i,xe,ye,he]);const Pt=G=>{n(yd(G,"workspace"))},Oe=G=>{n(yd({id:G.flowId,source:G.flowSource,archived:!!G.archived},"workspace"))},ft=m.useCallback(G=>{var _e,K;G.preventDefault(),G.stopPropagation(),(K=(_e=G.dataTransfer)==null?void 0:_e.types)!=null&&K.includes("Files")&&(Ge.current+=1,_(!0))},[]),hn=m.useCallback(G=>{G.preventDefault(),G.stopPropagation(),Ge.current-=1,Ge.current<=0&&(Ge.current=0,_(!1))},[]),mn=m.useCallback(G=>{G.preventDefault(),G.stopPropagation()},[]),Vr=m.useCallback(G=>{var Q,te;G.preventDefault(),G.stopPropagation(),Ge.current=0,_(!1);const _e=(te=(Q=G.dataTransfer)==null?void 0:Q.files)==null?void 0:te[0];if(!_e)return;const K=_e.name.toLowerCase();!K.endsWith(".yaml")&&!K.endsWith(".yml")&&!K.endsWith(".zip")||M(_e)},[]);return l.jsxs("div",{className:"af-projects"+(H?" af-projects--drop-target":""),onDragEnter:ft,onDragLeave:hn,onDragOver:mn,onDrop:Vr,children:[l.jsxs("header",{className:"af-projects-top",children:[e?l.jsx("div",{className:"af-projects-tabs af-projects-tabs--empty","aria-hidden":!0}):l.jsxs("div",{className:"af-projects-tabs",children:[l.jsx("button",{type:"button",className:i==="all"?"af-tab af-tab--active":"af-tab",onClick:()=>s("all"),children:t("project:all")}),l.jsx("button",{type:"button",className:i==="archived"?"af-tab af-tab--active":"af-tab",onClick:()=>s("archived"),children:t("project:archived")})]}),l.jsxs("div",{className:"af-projects-top-right",children:[l.jsxs("div",{className:"af-search-wrap",children:[l.jsx("span",{className:"material-symbols-outlined af-search-icon",children:"search"}),l.jsx("input",{className:"af-search"+(A.trim()?" af-search--has-clear":""),type:"search",placeholder:it,"aria-label":it,autoComplete:"off",value:A,onChange:G=>U(G.target.value),onKeyDown:G=>{G.key==="Escape"&&(U(""),G.currentTarget.blur())}}),A.trim()?l.jsx("button",{type:"button",className:"af-search-clear","aria-label":"Clear search",onClick:()=>U(""),children:l.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),$e?l.jsx("button",{type:"button",className:"af-btn-primary af-create-btn",onClick:()=>Ut(),children:t("project:refreshResources")}):l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"af-icon-btn"+(L?" af-icon-btn--active":""),"aria-label":t("flow:palette.toggleRecentActivity"),"aria-expanded":L,"aria-controls":"af-recent-activity-panel",onClick:()=>B(G=>!G),children:l.jsx("span",{className:"material-symbols-outlined",children:"notifications"})}),l.jsx("button",{type:"button",className:"af-btn-primary af-create-btn",onClick:()=>P(!0),children:t("project:createNew")})]})]})]}),l.jsxs("div",{className:"af-projects-body",children:[l.jsxs("section",{className:"af-projects-main",children:[l.jsxs("header",{className:"af-projects-section-head",children:[l.jsx("h2",{className:"af-projects-h2",children:t(i==="nodes"?"project:globalNodes":i==="skills"?"project:globalSkills":i==="archived"?"project:archivedPipelines":"project:activeProjects")}),l.jsx("p",{className:"af-projects-sub",children:pn?t("project:filterResult",{count:i==="nodes"?oe.length:i==="skills"?je.length:Z.length}):i==="nodes"?t("project:nodesHint",{count:c.length}):i==="skills"?t("project:skillsHint",{count:p.length}):t(i==="archived"?"project:archivedHint":"project:activeHint")}),g?l.jsx("p",{className:"af-err af-projects-api-hint",children:g}):null,k&&$e?l.jsx("p",{className:"af-err af-projects-api-hint",children:k}):null]}),$e?l.jsxs("div",{className:"af-resource-toolbar",children:[i==="skills"?l.jsx(SR,{onChanged:Ut}):null,l.jsxs("div",{className:"af-resource-purpose",children:[l.jsx("span",{className:"material-symbols-outlined",children:i==="nodes"?"account_tree":"extension"}),l.jsxs("div",{children:[l.jsx("h3",{children:t(i==="nodes"?"project:nodesPurposeTitle":"project:skillsPurposeTitle")}),l.jsx("p",{children:t(i==="nodes"?"project:nodesPurposeDesc":"project:skillsPurposeDesc")})]})]}),l.jsx("div",{className:"af-resource-filter-row",children:(i==="nodes"?IR:AR).map(G=>l.jsx("button",{type:"button",className:"af-resource-filter"+($===G?" af-resource-filter--active":""),onClick:()=>{F(G),T("")},children:t(`project:resourceFilter.${G}`)},G))})]}):null,i==="nodes"?l.jsx("div",{className:"af-resource-grid",children:oe.length>0?oe.map(G=>l.jsxs("button",{type:"button",className:"af-resource-card"+(xe&&an(G)===an(xe)?" af-resource-card--active":""),onClick:()=>T(an(G)),children:[l.jsxs("div",{className:"af-resource-card-head",children:[l.jsx("span",{className:xd(G.type==="control"?"secondary":G.type==="provide"?"primary":"muted"),children:l.jsx(bn,{query:A,children:G.type||"node"})}),l.jsx("span",{className:"af-resource-source",children:l.jsx(bn,{query:A,children:b0(G.source,t)})})]}),l.jsx("h3",{className:"af-project-title",children:l.jsx(bn,{query:A,children:G.label||G.displayName||G.id})}),l.jsx("p",{className:"af-project-desc",children:l.jsx(bn,{query:A,children:G.description||t("project:noDescription")})}),l.jsxs("div",{className:"af-resource-meta-row",children:[l.jsx("span",{children:l.jsx(bn,{query:A,children:G.id})}),l.jsx("span",{children:t("project:nodeSlots",{inputs:Object.keys(G.inputs||{}).length,outputs:Object.keys(G.outputs||{}).length})})]}),G.packageId?l.jsxs("div",{className:"af-project-path",children:[l.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"deployed_code"}),l.jsx("span",{className:"af-path-text",children:l.jsx(bn,{query:A,children:`${G.packageId}${G.version?` / ${G.version}`:""}`})})]}):null]},`${G.id}:${G.source||""}:${G.packageId||""}`)):N?l.jsx("div",{className:"af-projects-empty-block",children:l.jsx("p",{className:"af-projects-empty",children:pn?t("project:noNodeMatch",{query:A.trim()}):t("project:noNodes")})}):l.jsx("div",{className:"af-projects-empty-block",children:l.jsx("p",{className:"af-projects-empty",children:t("project:loadingResources")})})}):i==="skills"?l.jsx("div",{className:"af-resource-grid",children:je.length>0?je.map(G=>l.jsxs("button",{type:"button",className:"af-resource-card"+(Qe&&an(G)===an(Qe)?" af-resource-card--active":""),onClick:()=>T(an(G)),children:[l.jsxs("div",{className:"af-resource-card-head",children:[l.jsx("span",{className:xd(G.source==="builtin"?"muted":"primary"),children:l.jsx(bn,{query:A,children:G.sourceLabel||G.source||"skill"})}),l.jsx("span",{className:"af-resource-source",children:t("project:skill")})]}),l.jsx("h3",{className:"af-project-title",children:l.jsx(bn,{query:A,children:G.name||G.id})}),l.jsx("p",{className:"af-project-desc",children:l.jsx(bn,{query:A,children:G.description||t("project:noDescription")})}),l.jsxs("div",{className:"af-project-path",children:[l.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"extension"}),l.jsx("span",{className:"af-path-text",children:l.jsx(bn,{query:A,children:G.path||G.key||""})})]})]},G.key||`${G.source}:${G.name}`)):N?l.jsx("div",{className:"af-projects-empty-block",children:l.jsx("p",{className:"af-projects-empty",children:pn?t("project:noSkillMatch",{query:A.trim()}):t("project:noSkills")})}):l.jsx("div",{className:"af-projects-empty-block",children:l.jsx("p",{className:"af-projects-empty",children:t("project:loadingResources")})})}):l.jsxs("div",{className:"af-project-grid",children:[Z.length>0?Z.map(G=>l.jsx("button",{type:"button",className:"af-project-card",onClick:()=>Pt(G),children:l.jsxs("div",{className:"af-project-card-body",children:[l.jsx("span",{className:xd(zg(G.source,t).tone),children:l.jsx(bn,{query:A,children:zg(G.source,t).label})}),G.archived?l.jsx("span",{className:xd("muted"),children:l.jsx(bn,{query:A,children:t("project:archived")})}):null,l.jsx("h3",{className:"af-project-title",children:l.jsx(bn,{query:A,children:G.id})}),l.jsx("p",{className:"af-project-desc",children:l.jsx(bn,{query:A,children:Ij(G,t)})}),l.jsxs("div",{className:"af-project-path",children:[l.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"database"}),l.jsx("span",{className:"af-path-text",children:l.jsx(bn,{query:A,children:_j(G)})})]})]})},`${G.id}:${G.source??"user"}:${G.archived?"a":""}`)):v?on.length===0?l.jsxs("div",{className:"af-projects-empty-block",children:[l.jsx("p",{className:"af-projects-empty",children:i==="archived"?t("project:noArchived"):o.length>0?t("project:noActive"):t(g?"project:loadFailed":"project:noPipelines")}),!g&&o.length===0&&i==="all"?l.jsx("p",{className:"af-projects-empty-hint",children:t("project:emptyHint",{code1:"agentflow ui",code2:".agentflow/pipelines"})}):null]}):l.jsx("div",{className:"af-projects-empty-block",children:l.jsx("p",{className:"af-projects-empty",children:t("project:noMatch",{query:A.trim()})})}):l.jsx("div",{className:"af-projects-empty-block",children:l.jsx("p",{className:"af-projects-empty",children:t("project:loadingPipelines")})}),l.jsxs("button",{type:"button",className:"af-project-add",onClick:()=>P(!0),children:[l.jsx("span",{className:"material-symbols-outlined af-project-add-icon",children:"add_circle"}),l.jsx("span",{className:"af-project-add-label",children:t("project:newPipeline")})]}),He?null:l.jsxs("a",{className:"af-hub-card",href:"https://agentflow-hub.com",target:"_blank",rel:"noopener noreferrer",children:[l.jsx("div",{className:"af-hub-card__glow","aria-hidden":!0}),l.jsxs("span",{className:"af-hub-card__eyebrow",children:[l.jsx("span",{className:"material-symbols-outlined af-hub-card__eyebrow-icon",children:"hub"}),t("project:hubCard.eyebrow")]}),l.jsx("h3",{className:"af-hub-card__title",children:t("project:hubCard.title")}),l.jsx("p",{className:"af-hub-card__desc",children:t("project:hubCard.desc")}),l.jsxs("span",{className:"af-hub-card__cta",children:[t("project:hubCard.cta"),l.jsx("span",{className:"material-symbols-outlined af-hub-card__cta-icon",children:"arrow_outward"})]}),l.jsx("code",{className:"af-hub-card__cli",children:t("project:hubCard.cliHint")})]})]})]}),$e?l.jsx("aside",{className:"af-resource-detail","aria-label":t(i==="nodes"?"project:nodeDetail":"project:skillDetail"),children:i==="nodes"&&xe?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"af-resource-detail-head",children:[l.jsx("span",{className:"material-symbols-outlined",children:"account_tree"}),l.jsxs("div",{children:[l.jsx("h3",{children:xe.label||xe.displayName||xe.id}),l.jsx("p",{children:xe.id})]})]}),l.jsx("div",{className:"af-resource-detail-tabs",children:["overview","schema","runtime","files","usage"].map(G=>l.jsx("button",{type:"button",className:"af-resource-detail-tab"+(E===G?" af-resource-detail-tab--active":""),onClick:()=>q(G),children:t(`project:nodeDetailTabs.${G}`)},G))}),ie===an(xe)?l.jsx("p",{className:"af-resource-detail-desc",children:t("project:loadingResources")}):E==="overview"?l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"af-resource-detail-desc",children:xe.description||((gn=we==null?void 0:we.node)==null?void 0:gn.description)||t("project:noDescription")}),l.jsxs("dl",{className:"af-resource-detail-kv",children:[l.jsxs("div",{children:[l.jsx("dt",{children:t("project:detailType")}),l.jsx("dd",{children:xe.type||((lr=we==null?void 0:we.node)==null?void 0:lr.type)||"node"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:t("project:detailSource")}),l.jsx("dd",{children:b0(xe.source,t)})]}),xe.packageId?l.jsxs("div",{children:[l.jsx("dt",{children:t("project:detailPackage")}),l.jsx("dd",{children:xe.packageId})]}):null,xe.version?l.jsxs("div",{children:[l.jsx("dt",{children:t("project:detailVersion")}),l.jsx("dd",{children:xe.version})]}):null,xe.packageDir||we!=null&&we.baseDir?l.jsxs("div",{children:[l.jsx("dt",{children:t("project:detailPath")}),l.jsx("dd",{children:xe.packageDir||(we==null?void 0:we.baseDir)})]}):null,l.jsxs("div",{children:[l.jsx("dt",{children:t("project:detailEditable")}),l.jsx("dd",{children:(we==null?void 0:we.readOnly)===!1?t("project:editable"):t("project:readOnly")})]})]}),l.jsxs("div",{className:"af-resource-detail-section",children:[l.jsx("h4",{children:t("project:resourceMeaning")}),l.jsx("p",{children:t("project:nodesMeaning")})]})]}):E==="schema"?l.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[l.jsx("h4",{children:t("project:nodeSchema")}),l.jsxs("div",{className:"af-resource-slot-group",children:[l.jsx("span",{children:t("project:nodeInputs")}),wd(((Ln=we==null?void 0:we.node)==null?void 0:Ln.inputs)||xe.inputs).length>0?wd(((Wr=we==null?void 0:we.node)==null?void 0:Wr.inputs)||xe.inputs).map(G=>l.jsxs("code",{children:[G.name||G.key,G.type?`: ${G.type}`:""]},G.key)):l.jsx("em",{children:t("project:noSlots")})]}),l.jsxs("div",{className:"af-resource-slot-group",children:[l.jsx("span",{children:t("project:nodeOutputs")}),wd(((En=we==null?void 0:we.node)==null?void 0:En.outputs)||xe.outputs).length>0?wd(((Gn=we==null?void 0:we.node)==null?void 0:Gn.outputs)||xe.outputs).map(G=>l.jsxs("code",{children:[G.name||G.key,G.type?`: ${G.type}`:""]},G.key)):l.jsx("em",{children:t("project:noSlots")})]})]}):E==="runtime"?l.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[l.jsx("h4",{children:t("project:nodeRuntime")}),we!=null&&we.runtime?l.jsx("pre",{className:"af-resource-skill-preview",children:JSON.stringify(we.runtime,null,2)}):l.jsx("p",{children:t("project:noRuntimeManifest")}),we!=null&&we.body?l.jsxs(l.Fragment,{children:[l.jsx("h4",{className:"af-resource-detail-subtitle",children:t("project:nodeBody")}),l.jsx("pre",{className:"af-resource-skill-preview",children:we.body})]}):l.jsx("p",{children:t("project:noNodeBody")})]}):E==="files"?l.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[l.jsx("h4",{children:t("project:nodeFiles")}),Array.isArray(we==null?void 0:we.files)&&we.files.length>0?l.jsxs("div",{className:"af-node-file-browser",children:[l.jsx("div",{className:"af-node-file-list",children:we.files.map(G=>l.jsxs("button",{type:"button",className:"af-node-file-item"+(ye===G.path?" af-node-file-item--active":""),onClick:()=>ke(G.path),children:[l.jsx("span",{className:"material-symbols-outlined",children:"description"}),l.jsx("span",{children:G.path})]},G.path))}),l.jsxs("pre",{className:"af-resource-skill-preview",children:[Ve===`${an(xe)}:${ye}`?t("project:loadingResources"):pe!=null&&pe.binary?t("project:binaryFile"):(pe==null?void 0:pe.content)||t("project:selectNodeFile"),pe!=null&&pe.truncated?`
|
|
43
|
-
|
|
44
|
-
${t("project:fileTruncated")}`:""]})]}):l.jsx("p",{children:t("project:noNodeFiles")})]}):l.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[l.jsx("h4",{children:t("project:nodeUsage")}),Array.isArray(we==null?void 0:we.usage)&&we.usage.length>0?l.jsx("div",{className:"af-node-usage-list",children:we.usage.map(G=>l.jsxs("div",{className:"af-node-usage-item",children:[l.jsx("strong",{children:G.flowId}),l.jsxs("span",{children:[G.flowSource,G.archived?` · ${t("project:archived")}`:""]}),l.jsx("em",{children:G.instances.map(_e=>_e.label||_e.instanceId).join(", ")})]},`${G.flowSource}:${G.flowId}:${G.archived?"a":""}`))}):l.jsx("p",{children:t("project:noNodeUsage")})]})]}):i==="skills"&&Qe?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"af-resource-detail-head",children:[l.jsx("span",{className:"material-symbols-outlined",children:"extension"}),l.jsxs("div",{children:[l.jsx("h3",{children:Qe.name||Qe.id}),l.jsx("p",{children:Qe.sourceLabel||Qe.source})]})]}),l.jsx("p",{className:"af-resource-detail-desc",children:Qe.description||t("project:noDescription")}),l.jsxs("dl",{className:"af-resource-detail-kv",children:[l.jsxs("div",{children:[l.jsx("dt",{children:t("project:detailSource")}),l.jsx("dd",{children:Qe.sourceLabel||Qe.source})]}),l.jsxs("div",{children:[l.jsx("dt",{children:t("project:detailPath")}),l.jsx("dd",{children:Qe.path||Qe.key})]})]}),l.jsxs("div",{className:"af-resource-detail-section",children:[l.jsx("h4",{children:t("project:resourceMeaning")}),l.jsx("p",{children:t("project:skillsMeaning")})]}),l.jsxs("div",{className:"af-resource-detail-section",children:[l.jsx("h4",{children:t("project:skillPreview")}),l.jsx("pre",{className:"af-resource-skill-preview",children:X===an(Qe)?t("project:loadingResources"):(Et==null?void 0:Et.body)||(Et==null?void 0:Et.content)||t("project:skillPreviewEmpty")})]})]}):l.jsx("p",{className:"af-activity-empty",children:t("project:selectResource")})}):l.jsxs("aside",{id:"af-recent-activity-panel",className:"af-activity"+(L?"":" af-activity--hidden"),"aria-hidden":!L,"aria-label":t("project:recentActivity"),children:[l.jsxs("h2",{className:"af-activity-title",children:[l.jsx("span",{className:"af-activity-bullet"}),t("project:recentActivity")]}),l.jsx("div",{className:"af-activity-list",children:sn.length===0?l.jsx("p",{className:"af-activity-empty",children:Ct.length===0?t("project:noRecentActivity"):t("project:noMatchRecent")}):sn.map(G=>l.jsxs("button",{type:"button",className:"af-activity-row af-activity-row--action",onClick:()=>Oe(G),children:[l.jsxs("div",{className:"af-activity-row-top",children:[l.jsx("h4",{className:"af-activity-name",children:l.jsx(bn,{query:A,children:G.flowId})}),l.jsx("span",{className:"af-activity-time",children:Dg(G.at,t)})]}),l.jsxs("div",{className:"af-activity-meta",children:[l.jsx("span",{className:NR(G.kind),children:G.kind==="executed"?"play_arrow":"visibility"}),l.jsxs("p",{className:"af-activity-text",children:[G.kind==="executed"?t("project:recentRun"):t("project:recentOpen")," · ",Dg(G.at,t)]})]})]},`${G.kind}-${G.flowId}-${G.flowSource}-${G.at}`))})]})]}),l.jsx(wR,{open:S,onClose:()=>P(!1),onCreated:async G=>{P(!1),await kt();const _e=G.source??"user";n(yd({id:G.id,source:_e},"workspace"))}}),R?l.jsx(yR,{file:R,onClose:()=>M(null),onImported:async G=>{M(null),await kt();const _e=G.source??"user";n(yd({id:G.id,source:_e},"workspace"))}},`${R.name}-${R.size}-${R.lastModified}`):null]})}function qt(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=qt(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var TR={value:()=>{}};function _p(){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 nf(n)}function nf(e){this._=e}function RR(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}})}nf.prototype=_p.prototype={constructor:nf,on:function(e,t){var n=this._,r=RR(e+"",n),i,s=-1,o=r.length;if(arguments.length<2){for(;++s<o;)if((i=(e=r[s]).type)&&(i=LR(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]=k0(n[i],e.name,t);else if(t==null)for(i in n)n[i]=k0(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 nf(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 LR(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function k0(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=TR,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Bg="http://www.w3.org/1999/xhtml";const S0={svg:"http://www.w3.org/2000/svg",xhtml:Bg,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ip(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),S0.hasOwnProperty(t)?{space:S0[t],local:e}:e}function OR(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Bg&&t.documentElement.namespaceURI===Bg?t.createElement(e):t.createElementNS(n,e)}}function MR(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Aj(e){var t=Ip(e);return(t.local?MR:OR)(t)}function DR(){}function Nx(e){return e==null?DR:function(){return this.querySelector(e)}}function $R(e){typeof e!="function"&&(e=Nx(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,a=r[i]=new Array(o),c,u,p=0;p<o;++p)(c=s[p])&&(u=e.call(c,c.__data__,p,s))&&("__data__"in c&&(u.__data__=c.__data__),a[p]=u);return new sr(r,this._parents)}function FR(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function zR(){return[]}function Tj(e){return e==null?zR:function(){return this.querySelectorAll(e)}}function BR(e){return function(){return FR(e.apply(this,arguments))}}function HR(e){typeof e=="function"?e=BR(e):e=Tj(e);for(var t=this._groups,n=t.length,r=[],i=[],s=0;s<n;++s)for(var o=t[s],a=o.length,c,u=0;u<a;++u)(c=o[u])&&(r.push(e.call(c,c.__data__,u,o)),i.push(c));return new sr(r,i)}function Rj(e){return function(){return this.matches(e)}}function Lj(e){return function(t){return t.matches(e)}}var UR=Array.prototype.find;function VR(e){return function(){return UR.call(this.children,e)}}function WR(){return this.firstElementChild}function KR(e){return this.select(e==null?WR:VR(typeof e=="function"?e:Lj(e)))}var YR=Array.prototype.filter;function qR(){return Array.from(this.children)}function GR(e){return function(){return YR.call(this.children,e)}}function XR(e){return this.selectAll(e==null?qR:GR(typeof e=="function"?e:Lj(e)))}function JR(e){typeof e!="function"&&(e=Rj(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,a=r[i]=[],c,u=0;u<o;++u)(c=s[u])&&e.call(c,c.__data__,u,s)&&a.push(c);return new sr(r,this._parents)}function Oj(e){return new Array(e.length)}function QR(){return new sr(this._enter||this._groups.map(Oj),this._parents)}function Ff(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Ff.prototype={constructor:Ff,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 ZR(e){return function(){return e}}function eL(e,t,n,r,i,s){for(var o=0,a,c=t.length,u=s.length;o<u;++o)(a=t[o])?(a.__data__=s[o],r[o]=a):n[o]=new Ff(e,s[o]);for(;o<c;++o)(a=t[o])&&(i[o]=a)}function tL(e,t,n,r,i,s,o){var a,c,u=new Map,p=t.length,d=s.length,f=new Array(p),h;for(a=0;a<p;++a)(c=t[a])&&(f[a]=h=o.call(c,c.__data__,a,t)+"",u.has(h)?i[a]=c:u.set(h,c));for(a=0;a<d;++a)h=o.call(e,s[a],a,s)+"",(c=u.get(h))?(r[a]=c,c.__data__=s[a],u.delete(h)):n[a]=new Ff(e,s[a]);for(a=0;a<p;++a)(c=t[a])&&u.get(f[a])===c&&(i[a]=c)}function nL(e){return e.__data__}function rL(e,t){if(!arguments.length)return Array.from(this,nL);var n=t?tL:eL,r=this._parents,i=this._groups;typeof e!="function"&&(e=ZR(e));for(var s=i.length,o=new Array(s),a=new Array(s),c=new Array(s),u=0;u<s;++u){var p=r[u],d=i[u],f=d.length,h=iL(e.call(p,p&&p.__data__,u,r)),g=h.length,b=a[u]=new Array(g),k=o[u]=new Array(g),y=c[u]=new Array(f);n(p,d,b,k,y,h,t);for(var v=0,w=0,N,C;v<g;++v)if(N=b[v]){for(v>=w&&(w=v+1);!(C=k[w])&&++w<g;);N._next=C||null}}return o=new sr(o,r),o._enter=a,o._exit=c,o}function iL(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function sL(){return new sr(this._exit||this._groups.map(Oj),this._parents)}function oL(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 aL(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),a=new Array(i),c=0;c<o;++c)for(var u=n[c],p=r[c],d=u.length,f=a[c]=new Array(d),h,g=0;g<d;++g)(h=u[g]||p[g])&&(f[g]=h);for(;c<i;++c)a[c]=n[c];return new sr(a,this._parents)}function lL(){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 cL(e){e||(e=uL);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,r=n.length,i=new Array(r),s=0;s<r;++s){for(var o=n[s],a=o.length,c=i[s]=new Array(a),u,p=0;p<a;++p)(u=o[p])&&(c[p]=u);c.sort(t)}return new sr(i,this._parents).order()}function uL(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function dL(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function fL(){return Array.from(this)}function pL(){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 hL(){let e=0;for(const t of this)++e;return e}function mL(){return!this.node()}function gL(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],s=0,o=i.length,a;s<o;++s)(a=i[s])&&e.call(a,a.__data__,s,i);return this}function yL(e){return function(){this.removeAttribute(e)}}function xL(e){return function(){this.removeAttributeNS(e.space,e.local)}}function wL(e,t){return function(){this.setAttribute(e,t)}}function vL(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function bL(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function kL(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 SL(e,t){var n=Ip(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?xL:yL:typeof t=="function"?n.local?kL:bL:n.local?vL:wL)(n,t))}function Mj(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function NL(e){return function(){this.style.removeProperty(e)}}function jL(e,t,n){return function(){this.style.setProperty(e,t,n)}}function CL(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function EL(e,t,n){return arguments.length>1?this.each((t==null?NL:typeof t=="function"?CL:jL)(e,t,n??"")):Pa(this.node(),e)}function Pa(e,t){return e.style.getPropertyValue(t)||Mj(e).getComputedStyle(e,null).getPropertyValue(t)}function PL(e){return function(){delete this[e]}}function _L(e,t){return function(){this[e]=t}}function IL(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function AL(e,t){return arguments.length>1?this.each((t==null?PL:typeof t=="function"?IL:_L)(e,t)):this.node()[e]}function Dj(e){return e.trim().split(/^|\s+/)}function jx(e){return e.classList||new $j(e)}function $j(e){this._node=e,this._names=Dj(e.getAttribute("class")||"")}$j.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 Fj(e,t){for(var n=jx(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function zj(e,t){for(var n=jx(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function TL(e){return function(){Fj(this,e)}}function RL(e){return function(){zj(this,e)}}function LL(e,t){return function(){(t.apply(this,arguments)?Fj:zj)(this,e)}}function OL(e,t){var n=Dj(e+"");if(arguments.length<2){for(var r=jx(this.node()),i=-1,s=n.length;++i<s;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?LL:t?TL:RL)(n,t))}function ML(){this.textContent=""}function DL(e){return function(){this.textContent=e}}function $L(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function FL(e){return arguments.length?this.each(e==null?ML:(typeof e=="function"?$L:DL)(e)):this.node().textContent}function zL(){this.innerHTML=""}function BL(e){return function(){this.innerHTML=e}}function HL(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function UL(e){return arguments.length?this.each(e==null?zL:(typeof e=="function"?HL:BL)(e)):this.node().innerHTML}function VL(){this.nextSibling&&this.parentNode.appendChild(this)}function WL(){return this.each(VL)}function KL(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function YL(){return this.each(KL)}function qL(e){var t=typeof e=="function"?e:Aj(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function GL(){return null}function XL(e,t){var n=typeof e=="function"?e:Aj(e),r=t==null?GL:typeof t=="function"?t:Nx(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function JL(){var e=this.parentNode;e&&e.removeChild(this)}function QL(){return this.each(JL)}function ZL(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function eO(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function tO(e){return this.select(e?eO:ZL)}function nO(e){return arguments.length?this.property("__data__",e):this.node().__data__}function rO(e){return function(t){e.call(this,t,this.__data__)}}function iO(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 sO(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 oO(e,t,n){return function(){var r=this.__on,i,s=rO(t);if(r){for(var o=0,a=r.length;o<a;++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 aO(e,t,n){var r=iO(e+""),i,s=r.length,o;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,u=a.length,p;c<u;++c)for(i=0,p=a[c];i<s;++i)if((o=r[i]).type===p.type&&o.name===p.name)return p.value}return}for(a=t?oO:sO,i=0;i<s;++i)this.each(a(r[i],t,n));return this}function Bj(e,t,n){var r=Mj(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 lO(e,t){return function(){return Bj(this,e,t)}}function cO(e,t){return function(){return Bj(this,e,t.apply(this,arguments))}}function uO(e,t){return this.each((typeof t=="function"?cO:lO)(e,t))}function*dO(){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 Hj=[null];function sr(e,t){this._groups=e,this._parents=t}function su(){return new sr([[document.documentElement]],Hj)}function fO(){return this}sr.prototype=su.prototype={constructor:sr,select:$R,selectAll:HR,selectChild:KR,selectChildren:XR,filter:JR,data:rL,enter:QR,exit:sL,join:oL,merge:aL,selection:fO,order:lL,sort:cL,call:dL,nodes:fL,node:pL,size:hL,empty:mL,each:gL,attr:SL,style:EL,property:AL,classed:OL,text:FL,html:UL,raise:WL,lower:YL,append:qL,insert:XL,remove:QL,clone:tO,datum:nO,on:aO,dispatch:uO,[Symbol.iterator]:dO};function Zn(e){return typeof e=="string"?new sr([[document.querySelector(e)]],[document.documentElement]):new sr([[e]],Hj)}function pO(e){let t;for(;t=e.sourceEvent;)e=t;return e}function _r(e,t){if(e=pO(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 hO={passive:!1},Rc={capture:!0,passive:!1};function sm(e){e.stopImmediatePropagation()}function ga(e){e.preventDefault(),e.stopImmediatePropagation()}function Uj(e){var t=e.document.documentElement,n=Zn(e).on("dragstart.drag",ga,Rc);"onselectstart"in t?n.on("selectstart.drag",ga,Rc):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Vj(e,t){var n=e.document.documentElement,r=Zn(e).on("dragstart.drag",null);t&&(r.on("click.drag",ga,Rc),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 bd=e=>()=>e;function Hg(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:s,x:o,y:a,dx:c,dy:u,dispatch:p}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:p}})}Hg.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function mO(e){return!e.ctrlKey&&!e.button}function gO(){return this.parentNode}function yO(e,t){return t??{x:e.x,y:e.y}}function xO(){return navigator.maxTouchPoints||"ontouchstart"in this}function Wj(){var e=mO,t=gO,n=yO,r=xO,i={},s=_p("start","drag","end"),o=0,a,c,u,p,d=0;function f(N){N.on("mousedown.drag",h).filter(r).on("touchstart.drag",k).on("touchmove.drag",y,hO).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(N,C){if(!(p||!e.call(this,N,C))){var S=w(this,t.call(this,N,C),N,C,"mouse");S&&(Zn(N.view).on("mousemove.drag",g,Rc).on("mouseup.drag",b,Rc),Uj(N.view),sm(N),u=!1,a=N.clientX,c=N.clientY,S("start",N))}}function g(N){if(ga(N),!u){var C=N.clientX-a,S=N.clientY-c;u=C*C+S*S>d}i.mouse("drag",N)}function b(N){Zn(N.view).on("mousemove.drag mouseup.drag",null),Vj(N.view,u),ga(N),i.mouse("end",N)}function k(N,C){if(e.call(this,N,C)){var S=N.changedTouches,P=t.call(this,N,C),R=S.length,M,H;for(M=0;M<R;++M)(H=w(this,P,N,C,S[M].identifier,S[M]))&&(sm(N),H("start",N,S[M]))}}function y(N){var C=N.changedTouches,S=C.length,P,R;for(P=0;P<S;++P)(R=i[C[P].identifier])&&(ga(N),R("drag",N,C[P]))}function v(N){var C=N.changedTouches,S=C.length,P,R;for(p&&clearTimeout(p),p=setTimeout(function(){p=null},500),P=0;P<S;++P)(R=i[C[P].identifier])&&(sm(N),R("end",N,C[P]))}function w(N,C,S,P,R,M){var H=s.copy(),_=_r(M||S,C),A,U,L;if((L=n.call(N,new Hg("beforestart",{sourceEvent:S,target:f,identifier:R,active:o,x:_[0],y:_[1],dx:0,dy:0,dispatch:H}),P))!=null)return A=L.x-_[0]||0,U=L.y-_[1]||0,function B($,F,I){var T=_,E;switch($){case"start":i[R]=B,E=o++;break;case"end":delete i[R],--o;case"drag":_=_r(I||F,C),E=o;break}H.call($,N,new Hg($,{sourceEvent:F,subject:L,target:f,identifier:R,active:E,x:_[0]+A,y:_[1]+U,dx:_[0]-T[0],dy:_[1]-T[1],dispatch:H}),P)}}return f.filter=function(N){return arguments.length?(e=typeof N=="function"?N:bd(!!N),f):e},f.container=function(N){return arguments.length?(t=typeof N=="function"?N:bd(N),f):t},f.subject=function(N){return arguments.length?(n=typeof N=="function"?N:bd(N),f):n},f.touchable=function(N){return arguments.length?(r=typeof N=="function"?N:bd(!!N),f):r},f.on=function(){var N=s.on.apply(s,arguments);return N===s?f:N},f.clickDistance=function(N){return arguments.length?(d=(N=+N)*N,f):Math.sqrt(d)},f}function Cx(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Kj(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function ou(){}var Lc=.7,zf=1/Lc,ya="\\s*([+-]?\\d+)\\s*",Oc="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",di="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",wO=/^#([0-9a-f]{3,8})$/,vO=new RegExp(`^rgb\\(${ya},${ya},${ya}\\)$`),bO=new RegExp(`^rgb\\(${di},${di},${di}\\)$`),kO=new RegExp(`^rgba\\(${ya},${ya},${ya},${Oc}\\)$`),SO=new RegExp(`^rgba\\(${di},${di},${di},${Oc}\\)$`),NO=new RegExp(`^hsl\\(${Oc},${di},${di}\\)$`),jO=new RegExp(`^hsla\\(${Oc},${di},${di},${Oc}\\)$`),N0={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};Cx(ou,ho,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:j0,formatHex:j0,formatHex8:CO,formatHsl:EO,formatRgb:C0,toString:C0});function j0(){return this.rgb().formatHex()}function CO(){return this.rgb().formatHex8()}function EO(){return Yj(this).formatHsl()}function C0(){return this.rgb().formatRgb()}function ho(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=wO.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?E0(t):n===3?new Bn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?kd(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?kd(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=vO.exec(e))?new Bn(t[1],t[2],t[3],1):(t=bO.exec(e))?new Bn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=kO.exec(e))?kd(t[1],t[2],t[3],t[4]):(t=SO.exec(e))?kd(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=NO.exec(e))?I0(t[1],t[2]/100,t[3]/100,1):(t=jO.exec(e))?I0(t[1],t[2]/100,t[3]/100,t[4]):N0.hasOwnProperty(e)?E0(N0[e]):e==="transparent"?new Bn(NaN,NaN,NaN,0):null}function E0(e){return new Bn(e>>16&255,e>>8&255,e&255,1)}function kd(e,t,n,r){return r<=0&&(e=t=n=NaN),new Bn(e,t,n,r)}function PO(e){return e instanceof ou||(e=ho(e)),e?(e=e.rgb(),new Bn(e.r,e.g,e.b,e.opacity)):new Bn}function Ug(e,t,n,r){return arguments.length===1?PO(e):new Bn(e,t,n,r??1)}function Bn(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Cx(Bn,Ug,Kj(ou,{brighter(e){return e=e==null?zf:Math.pow(zf,e),new Bn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Lc:Math.pow(Lc,e),new Bn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Bn(io(this.r),io(this.g),io(this.b),Bf(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:P0,formatHex:P0,formatHex8:_O,formatRgb:_0,toString:_0}));function P0(){return`#${to(this.r)}${to(this.g)}${to(this.b)}`}function _O(){return`#${to(this.r)}${to(this.g)}${to(this.b)}${to((isNaN(this.opacity)?1:this.opacity)*255)}`}function _0(){const e=Bf(this.opacity);return`${e===1?"rgb(":"rgba("}${io(this.r)}, ${io(this.g)}, ${io(this.b)}${e===1?")":`, ${e})`}`}function Bf(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function io(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function to(e){return e=io(e),(e<16?"0":"")+e.toString(16)}function I0(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Rr(e,t,n,r)}function Yj(e){if(e instanceof Rr)return new Rr(e.h,e.s,e.l,e.opacity);if(e instanceof ou||(e=ho(e)),!e)return new Rr;if(e instanceof Rr)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,a=s-i,c=(s+i)/2;return a?(t===s?o=(n-r)/a+(n<r)*6:n===s?o=(r-t)/a+2:o=(t-n)/a+4,a/=c<.5?s+i:2-s-i,o*=60):a=c>0&&c<1?0:o,new Rr(o,a,c,e.opacity)}function IO(e,t,n,r){return arguments.length===1?Yj(e):new Rr(e,t,n,r??1)}function Rr(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Cx(Rr,IO,Kj(ou,{brighter(e){return e=e==null?zf:Math.pow(zf,e),new Rr(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Lc:Math.pow(Lc,e),new Rr(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 Bn(om(e>=240?e-240:e+120,i,r),om(e,i,r),om(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Rr(A0(this.h),Sd(this.s),Sd(this.l),Bf(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=Bf(this.opacity);return`${e===1?"hsl(":"hsla("}${A0(this.h)}, ${Sd(this.s)*100}%, ${Sd(this.l)*100}%${e===1?")":`, ${e})`}`}}));function A0(e){return e=(e||0)%360,e<0?e+360:e}function Sd(e){return Math.max(0,Math.min(1,e||0))}function om(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 Ex=e=>()=>e;function AO(e,t){return function(n){return e+n*t}}function TO(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 RO(e){return(e=+e)==1?qj:function(t,n){return n-t?TO(t,n,e):Ex(isNaN(t)?n:t)}}function qj(e,t){var n=t-e;return n?AO(e,n):Ex(isNaN(e)?t:e)}const Hf=function e(t){var n=RO(t);function r(i,s){var o=n((i=Ug(i)).r,(s=Ug(s)).r),a=n(i.g,s.g),c=n(i.b,s.b),u=qj(i.opacity,s.opacity);return function(p){return i.r=o(p),i.g=a(p),i.b=c(p),i.opacity=u(p),i+""}}return r.gamma=e,r}(1);function LO(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 OO(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function MO(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]=ac(e[o],t[o]);for(;o<n;++o)s[o]=t[o];return function(a){for(o=0;o<r;++o)s[o]=i[o](a);return s}}function DO(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function ri(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function $O(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]=ac(e[i],t[i]):r[i]=t[i];return function(s){for(i in n)r[i]=n[i](s);return r}}var Vg=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,am=new RegExp(Vg.source,"g");function FO(e){return function(){return e}}function zO(e){return function(t){return e(t)+""}}function Gj(e,t){var n=Vg.lastIndex=am.lastIndex=0,r,i,s,o=-1,a=[],c=[];for(e=e+"",t=t+"";(r=Vg.exec(e))&&(i=am.exec(t));)(s=i.index)>n&&(s=t.slice(n,s),a[o]?a[o]+=s:a[++o]=s),(r=r[0])===(i=i[0])?a[o]?a[o]+=i:a[++o]=i:(a[++o]=null,c.push({i:o,x:ri(r,i)})),n=am.lastIndex;return n<t.length&&(s=t.slice(n),a[o]?a[o]+=s:a[++o]=s),a.length<2?c[0]?zO(c[0].x):FO(t):(t=c.length,function(u){for(var p=0,d;p<t;++p)a[(d=c[p]).i]=d.x(u);return a.join("")})}function ac(e,t){var n=typeof t,r;return t==null||n==="boolean"?Ex(t):(n==="number"?ri:n==="string"?(r=ho(t))?(t=r,Hf):Gj:t instanceof ho?Hf:t instanceof Date?DO:OO(t)?LO:Array.isArray(t)?MO:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?$O:ri)(e,t)}var T0=180/Math.PI,Wg={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Xj(e,t,n,r,i,s){var o,a,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:s,rotate:Math.atan2(t,e)*T0,skewX:Math.atan(c)*T0,scaleX:o,scaleY:a}}var Nd;function BO(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Wg:Xj(t.a,t.b,t.c,t.d,t.e,t.f)}function HO(e){return e==null||(Nd||(Nd=document.createElementNS("http://www.w3.org/2000/svg","g")),Nd.setAttribute("transform",e),!(e=Nd.transform.baseVal.consolidate()))?Wg:(e=e.matrix,Xj(e.a,e.b,e.c,e.d,e.e,e.f))}function Jj(e,t,n,r){function i(u){return u.length?u.pop()+" ":""}function s(u,p,d,f,h,g){if(u!==d||p!==f){var b=h.push("translate(",null,t,null,n);g.push({i:b-4,x:ri(u,d)},{i:b-2,x:ri(p,f)})}else(d||f)&&h.push("translate("+d+t+f+n)}function o(u,p,d,f){u!==p?(u-p>180?p+=360:p-u>180&&(u+=360),f.push({i:d.push(i(d)+"rotate(",null,r)-2,x:ri(u,p)})):p&&d.push(i(d)+"rotate("+p+r)}function a(u,p,d,f){u!==p?f.push({i:d.push(i(d)+"skewX(",null,r)-2,x:ri(u,p)}):p&&d.push(i(d)+"skewX("+p+r)}function c(u,p,d,f,h,g){if(u!==d||p!==f){var b=h.push(i(h)+"scale(",null,",",null,")");g.push({i:b-4,x:ri(u,d)},{i:b-2,x:ri(p,f)})}else(d!==1||f!==1)&&h.push(i(h)+"scale("+d+","+f+")")}return function(u,p){var d=[],f=[];return u=e(u),p=e(p),s(u.translateX,u.translateY,p.translateX,p.translateY,d,f),o(u.rotate,p.rotate,d,f),a(u.skewX,p.skewX,d,f),c(u.scaleX,u.scaleY,p.scaleX,p.scaleY,d,f),u=p=null,function(h){for(var g=-1,b=f.length,k;++g<b;)d[(k=f[g]).i]=k.x(h);return d.join("")}}}var UO=Jj(BO,"px, ","px)","deg)"),VO=Jj(HO,", ",")",")"),WO=1e-12;function R0(e){return((e=Math.exp(e))+1/e)/2}function KO(e){return((e=Math.exp(e))-1/e)/2}function YO(e){return((e=Math.exp(2*e))-1)/(e+1)}const rf=function e(t,n,r){function i(s,o){var a=s[0],c=s[1],u=s[2],p=o[0],d=o[1],f=o[2],h=p-a,g=d-c,b=h*h+g*g,k,y;if(b<WO)y=Math.log(f/u)/t,k=function(P){return[a+P*h,c+P*g,u*Math.exp(t*P*y)]};else{var v=Math.sqrt(b),w=(f*f-u*u+r*b)/(2*u*n*v),N=(f*f-u*u-r*b)/(2*f*n*v),C=Math.log(Math.sqrt(w*w+1)-w),S=Math.log(Math.sqrt(N*N+1)-N);y=(S-C)/t,k=function(P){var R=P*y,M=R0(C),H=u/(n*v)*(M*YO(t*R+C)-KO(C));return[a+H*h,c+H*g,u*M/R0(t*R+C)]}}return k.duration=y*1e3*t/Math.SQRT2,k}return i.rho=function(s){var o=Math.max(.001,+s),a=o*o,c=a*a;return e(o,a,c)},i}(Math.SQRT2,2,4);var _a=0,ql=0,Ol=0,Qj=1e3,Uf,Gl,Vf=0,mo=0,Ap=0,Mc=typeof performance=="object"&&performance.now?performance:Date,Zj=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Px(){return mo||(Zj(qO),mo=Mc.now()+Ap)}function qO(){mo=0}function Wf(){this._call=this._time=this._next=null}Wf.prototype=eC.prototype={constructor:Wf,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Px():+n)+(t==null?0:+t),!this._next&&Gl!==this&&(Gl?Gl._next=this:Uf=this,Gl=this),this._call=e,this._time=n,Kg()},stop:function(){this._call&&(this._call=null,this._time=1/0,Kg())}};function eC(e,t,n){var r=new Wf;return r.restart(e,t,n),r}function GO(){Px(),++_a;for(var e=Uf,t;e;)(t=mo-e._time)>=0&&e._call.call(void 0,t),e=e._next;--_a}function L0(){mo=(Vf=Mc.now())+Ap,_a=ql=0;try{GO()}finally{_a=0,JO(),mo=0}}function XO(){var e=Mc.now(),t=e-Vf;t>Qj&&(Ap-=t,Vf=e)}function JO(){for(var e,t=Uf,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:Uf=n);Gl=e,Kg(r)}function Kg(e){if(!_a){ql&&(ql=clearTimeout(ql));var t=e-mo;t>24?(e<1/0&&(ql=setTimeout(L0,e-Mc.now()-Ap)),Ol&&(Ol=clearInterval(Ol))):(Ol||(Vf=Mc.now(),Ol=setInterval(XO,Qj)),_a=1,Zj(L0))}}function O0(e,t,n){var r=new Wf;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var QO=_p("start","end","cancel","interrupt"),ZO=[],tC=0,M0=1,Yg=2,sf=3,D0=4,qg=5,of=6;function Tp(e,t,n,r,i,s){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;eM(e,n,{name:t,index:r,group:i,on:QO,tween:ZO,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:tC})}function _x(e,t){var n=Hr(e,t);if(n.state>tC)throw new Error("too late; already scheduled");return n}function xi(e,t){var n=Hr(e,t);if(n.state>sf)throw new Error("too late; already running");return n}function Hr(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function eM(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=eC(s,0,n.time);function s(u){n.state=M0,n.timer.restart(o,n.delay,n.time),n.delay<=u&&o(u-n.delay)}function o(u){var p,d,f,h;if(n.state!==M0)return c();for(p in r)if(h=r[p],h.name===n.name){if(h.state===sf)return O0(o);h.state===D0?(h.state=of,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[p]):+p<t&&(h.state=of,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[p])}if(O0(function(){n.state===sf&&(n.state=D0,n.timer.restart(a,n.delay,n.time),a(u))}),n.state=Yg,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Yg){for(n.state=sf,i=new Array(f=n.tween.length),p=0,d=-1;p<f;++p)(h=n.tween[p].value.call(e,e.__data__,n.index,n.group))&&(i[++d]=h);i.length=d+1}}function a(u){for(var p=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=qg,1),d=-1,f=i.length;++d<f;)i[d].call(e,p);n.state===qg&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=of,n.timer.stop(),delete r[t];for(var u in r)return;delete e.__transition}}function af(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>Yg&&r.state<qg,r.state=of,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[o]}s&&delete e.__transition}}function tM(e){return this.each(function(){af(this,e)})}function nM(e,t){var n,r;return function(){var i=xi(this,e),s=i.tween;if(s!==n){r=n=s;for(var o=0,a=r.length;o<a;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function rM(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var s=xi(this,e),o=s.tween;if(o!==r){i=(r=o).slice();for(var a={name:t,value:n},c=0,u=i.length;c<u;++c)if(i[c].name===t){i[c]=a;break}c===u&&i.push(a)}s.tween=i}}function iM(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Hr(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?nM:rM)(n,e,t))}function Ix(e,t,n){var r=e._id;return e.each(function(){var i=xi(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return Hr(i,r).value[t]}}function nC(e,t){var n;return(typeof t=="number"?ri:t instanceof ho?Hf:(n=ho(t))?(t=n,Hf):Gj)(e,t)}function sM(e){return function(){this.removeAttribute(e)}}function oM(e){return function(){this.removeAttributeNS(e.space,e.local)}}function aM(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 lM(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 cM(e,t,n){var r,i,s;return function(){var o,a=n(this),c;return a==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=a+"",o===c?null:o===r&&c===i?s:(i=c,s=t(r=o,a)))}}function uM(e,t,n){var r,i,s;return function(){var o,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=a+"",o===c?null:o===r&&c===i?s:(i=c,s=t(r=o,a)))}}function dM(e,t){var n=Ip(e),r=n==="transform"?VO:nC;return this.attrTween(e,typeof t=="function"?(n.local?uM:cM)(n,r,Ix(this,"attr."+e,t)):t==null?(n.local?oM:sM)(n):(n.local?lM:aM)(n,r,t))}function fM(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function pM(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function hM(e,t){var n,r;function i(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&pM(e,s)),n}return i._value=t,i}function mM(e,t){var n,r;function i(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&fM(e,s)),n}return i._value=t,i}function gM(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=Ip(e);return this.tween(n,(r.local?hM:mM)(r,t))}function yM(e,t){return function(){_x(this,e).delay=+t.apply(this,arguments)}}function xM(e,t){return t=+t,function(){_x(this,e).delay=t}}function wM(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?yM:xM)(t,e)):Hr(this.node(),t).delay}function vM(e,t){return function(){xi(this,e).duration=+t.apply(this,arguments)}}function bM(e,t){return t=+t,function(){xi(this,e).duration=t}}function kM(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?vM:bM)(t,e)):Hr(this.node(),t).duration}function SM(e,t){if(typeof t!="function")throw new Error;return function(){xi(this,e).ease=t}}function NM(e){var t=this._id;return arguments.length?this.each(SM(t,e)):Hr(this.node(),t).ease}function jM(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;xi(this,e).ease=n}}function CM(e){if(typeof e!="function")throw new Error;return this.each(jM(this._id,e))}function EM(e){typeof e!="function"&&(e=Rj(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,a=r[i]=[],c,u=0;u<o;++u)(c=s[u])&&e.call(c,c.__data__,u,s)&&a.push(c);return new Fi(r,this._parents,this._name,this._id)}function PM(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),a=0;a<s;++a)for(var c=t[a],u=n[a],p=c.length,d=o[a]=new Array(p),f,h=0;h<p;++h)(f=c[h]||u[h])&&(d[h]=f);for(;a<r;++a)o[a]=t[a];return new Fi(o,this._parents,this._name,this._id)}function _M(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 IM(e,t,n){var r,i,s=_M(t)?_x:xi;return function(){var o=s(this,e),a=o.on;a!==r&&(i=(r=a).copy()).on(t,n),o.on=i}}function AM(e,t){var n=this._id;return arguments.length<2?Hr(this.node(),n).on.on(e):this.each(IM(n,e,t))}function TM(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function RM(){return this.on("end.remove",TM(this._id))}function LM(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Nx(e));for(var r=this._groups,i=r.length,s=new Array(i),o=0;o<i;++o)for(var a=r[o],c=a.length,u=s[o]=new Array(c),p,d,f=0;f<c;++f)(p=a[f])&&(d=e.call(p,p.__data__,f,a))&&("__data__"in p&&(d.__data__=p.__data__),u[f]=d,Tp(u[f],t,n,f,u,Hr(p,n)));return new Fi(s,this._parents,t,n)}function OM(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Tj(e));for(var r=this._groups,i=r.length,s=[],o=[],a=0;a<i;++a)for(var c=r[a],u=c.length,p,d=0;d<u;++d)if(p=c[d]){for(var f=e.call(p,p.__data__,d,c),h,g=Hr(p,n),b=0,k=f.length;b<k;++b)(h=f[b])&&Tp(h,t,n,b,f,g);s.push(f),o.push(p)}return new Fi(s,o,t,n)}var MM=su.prototype.constructor;function DM(){return new MM(this._groups,this._parents)}function $M(e,t){var n,r,i;return function(){var s=Pa(this,e),o=(this.style.removeProperty(e),Pa(this,e));return s===o?null:s===n&&o===r?i:i=t(n=s,r=o)}}function rC(e){return function(){this.style.removeProperty(e)}}function FM(e,t,n){var r,i=n+"",s;return function(){var o=Pa(this,e);return o===i?null:o===r?s:s=t(r=o,n)}}function zM(e,t,n){var r,i,s;return function(){var o=Pa(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Pa(this,e))),o===c?null:o===r&&c===i?s:(i=c,s=t(r=o,a))}}function BM(e,t){var n,r,i,s="style."+t,o="end."+s,a;return function(){var c=xi(this,e),u=c.on,p=c.value[s]==null?a||(a=rC(t)):void 0;(u!==n||i!==p)&&(r=(n=u).copy()).on(o,i=p),c.on=r}}function HM(e,t,n){var r=(e+="")=="transform"?UO:nC;return t==null?this.styleTween(e,$M(e,r)).on("end.style."+e,rC(e)):typeof t=="function"?this.styleTween(e,zM(e,r,Ix(this,"style."+e,t))).each(BM(this._id,e)):this.styleTween(e,FM(e,r,t),n).on("end.style."+e,null)}function UM(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function VM(e,t,n){var r,i;function s(){var o=t.apply(this,arguments);return o!==i&&(r=(i=o)&&UM(e,o,n)),r}return s._value=t,s}function WM(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,VM(e,t,n??""))}function KM(e){return function(){this.textContent=e}}function YM(e){return function(){var t=e(this);this.textContent=t??""}}function qM(e){return this.tween("text",typeof e=="function"?YM(Ix(this,"text",e)):KM(e==null?"":e+""))}function GM(e){return function(t){this.textContent=e.call(this,t)}}function XM(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&GM(i)),t}return r._value=e,r}function JM(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,XM(e))}function QM(){for(var e=this._name,t=this._id,n=iC(),r=this._groups,i=r.length,s=0;s<i;++s)for(var o=r[s],a=o.length,c,u=0;u<a;++u)if(c=o[u]){var p=Hr(c,t);Tp(c,e,n,u,o,{time:p.time+p.delay+p.duration,delay:0,duration:p.duration,ease:p.ease})}return new Fi(r,this._parents,e,n)}function ZM(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(s,o){var a={value:o},c={value:function(){--i===0&&s()}};n.each(function(){var u=xi(this,r),p=u.on;p!==e&&(t=(e=p).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),u.on=t}),i===0&&s()})}var eD=0;function Fi(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function iC(){return++eD}var Ni=su.prototype;Fi.prototype={constructor:Fi,select:LM,selectAll:OM,selectChild:Ni.selectChild,selectChildren:Ni.selectChildren,filter:EM,merge:PM,selection:DM,transition:QM,call:Ni.call,nodes:Ni.nodes,node:Ni.node,size:Ni.size,empty:Ni.empty,each:Ni.each,on:AM,attr:dM,attrTween:gM,style:HM,styleTween:WM,text:qM,textTween:JM,remove:RM,tween:iM,delay:wM,duration:kM,ease:NM,easeVarying:CM,end:ZM,[Symbol.iterator]:Ni[Symbol.iterator]};function tD(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var nD={time:null,delay:0,duration:250,ease:tD};function rD(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 iD(e){var t,n;e instanceof Fi?(t=e._id,e=e._name):(t=iC(),(n=nD).time=Px(),e=e==null?null:e+"");for(var r=this._groups,i=r.length,s=0;s<i;++s)for(var o=r[s],a=o.length,c,u=0;u<a;++u)(c=o[u])&&Tp(c,e,t,u,o,n||rD(c,t));return new Fi(r,this._parents,e,t)}su.prototype.interrupt=tM;su.prototype.transition=iD;const jd=e=>()=>e;function sD(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 Ti(e,t,n){this.k=e,this.x=t,this.y=n}Ti.prototype={constructor:Ti,scale:function(e){return e===1?this:new Ti(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ti(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 Rp=new Ti(1,0,0);sC.prototype=Ti.prototype;function sC(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Rp;return e.__zoom}function lm(e){e.stopImmediatePropagation()}function Ml(e){e.preventDefault(),e.stopImmediatePropagation()}function oD(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function aD(){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 $0(){return this.__zoom||Rp}function lD(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function cD(){return navigator.maxTouchPoints||"ontouchstart"in this}function uD(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 oC(){var e=oD,t=aD,n=uD,r=lD,i=cD,s=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],a=250,c=rf,u=_p("start","zoom","end"),p,d,f,h=500,g=150,b=0,k=10;function y(L){L.property("__zoom",$0).on("wheel.zoom",R,{passive:!1}).on("mousedown.zoom",M).on("dblclick.zoom",H).filter(i).on("touchstart.zoom",_).on("touchmove.zoom",A).on("touchend.zoom touchcancel.zoom",U).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(L,B,$,F){var I=L.selection?L.selection():L;I.property("__zoom",$0),L!==I?C(L,B,$,F):I.interrupt().each(function(){S(this,arguments).event(F).start().zoom(null,typeof B=="function"?B.apply(this,arguments):B).end()})},y.scaleBy=function(L,B,$,F){y.scaleTo(L,function(){var I=this.__zoom.k,T=typeof B=="function"?B.apply(this,arguments):B;return I*T},$,F)},y.scaleTo=function(L,B,$,F){y.transform(L,function(){var I=t.apply(this,arguments),T=this.__zoom,E=$==null?N(I):typeof $=="function"?$.apply(this,arguments):$,q=T.invert(E),W=typeof B=="function"?B.apply(this,arguments):B;return n(w(v(T,W),E,q),I,o)},$,F)},y.translateBy=function(L,B,$,F){y.transform(L,function(){return n(this.__zoom.translate(typeof B=="function"?B.apply(this,arguments):B,typeof $=="function"?$.apply(this,arguments):$),t.apply(this,arguments),o)},null,F)},y.translateTo=function(L,B,$,F,I){y.transform(L,function(){var T=t.apply(this,arguments),E=this.__zoom,q=F==null?N(T):typeof F=="function"?F.apply(this,arguments):F;return n(Rp.translate(q[0],q[1]).scale(E.k).translate(typeof B=="function"?-B.apply(this,arguments):-B,typeof $=="function"?-$.apply(this,arguments):-$),T,o)},F,I)};function v(L,B){return B=Math.max(s[0],Math.min(s[1],B)),B===L.k?L:new Ti(B,L.x,L.y)}function w(L,B,$){var F=B[0]-$[0]*L.k,I=B[1]-$[1]*L.k;return F===L.x&&I===L.y?L:new Ti(L.k,F,I)}function N(L){return[(+L[0][0]+ +L[1][0])/2,(+L[0][1]+ +L[1][1])/2]}function C(L,B,$,F){L.on("start.zoom",function(){S(this,arguments).event(F).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(F).end()}).tween("zoom",function(){var I=this,T=arguments,E=S(I,T).event(F),q=t.apply(I,T),W=$==null?N(q):typeof $=="function"?$.apply(I,T):$,O=Math.max(q[1][0]-q[0][0],q[1][1]-q[0][1]),X=I.__zoom,se=typeof B=="function"?B.apply(I,T):B,re=c(X.invert(W).concat(O/X.k),se.invert(W).concat(O/se.k));return function(de){if(de===1)de=se;else{var ie=re(de),me=O/ie[2];de=new Ti(me,W[0]-ie[0]*me,W[1]-ie[1]*me)}E.zoom(null,de)}})}function S(L,B,$){return!$&&L.__zooming||new P(L,B)}function P(L,B){this.that=L,this.args=B,this.active=0,this.sourceEvent=null,this.extent=t.apply(L,B),this.taps=0}P.prototype={event:function(L){return L&&(this.sourceEvent=L),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(L,B){return this.mouse&&L!=="mouse"&&(this.mouse[1]=B.invert(this.mouse[0])),this.touch0&&L!=="touch"&&(this.touch0[1]=B.invert(this.touch0[0])),this.touch1&&L!=="touch"&&(this.touch1[1]=B.invert(this.touch1[0])),this.that.__zoom=B,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(L){var B=Zn(this.that).datum();u.call(L,this.that,new sD(L,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:u}),B)}};function R(L,...B){if(!e.apply(this,arguments))return;var $=S(this,B).event(L),F=this.__zoom,I=Math.max(s[0],Math.min(s[1],F.k*Math.pow(2,r.apply(this,arguments)))),T=_r(L);if($.wheel)($.mouse[0][0]!==T[0]||$.mouse[0][1]!==T[1])&&($.mouse[1]=F.invert($.mouse[0]=T)),clearTimeout($.wheel);else{if(F.k===I)return;$.mouse=[T,F.invert(T)],af(this),$.start()}Ml(L),$.wheel=setTimeout(E,g),$.zoom("mouse",n(w(v(F,I),$.mouse[0],$.mouse[1]),$.extent,o));function E(){$.wheel=null,$.end()}}function M(L,...B){if(f||!e.apply(this,arguments))return;var $=L.currentTarget,F=S(this,B,!0).event(L),I=Zn(L.view).on("mousemove.zoom",W,!0).on("mouseup.zoom",O,!0),T=_r(L,$),E=L.clientX,q=L.clientY;Uj(L.view),lm(L),F.mouse=[T,this.__zoom.invert(T)],af(this),F.start();function W(X){if(Ml(X),!F.moved){var se=X.clientX-E,re=X.clientY-q;F.moved=se*se+re*re>b}F.event(X).zoom("mouse",n(w(F.that.__zoom,F.mouse[0]=_r(X,$),F.mouse[1]),F.extent,o))}function O(X){I.on("mousemove.zoom mouseup.zoom",null),Vj(X.view,F.moved),Ml(X),F.event(X).end()}}function H(L,...B){if(e.apply(this,arguments)){var $=this.__zoom,F=_r(L.changedTouches?L.changedTouches[0]:L,this),I=$.invert(F),T=$.k*(L.shiftKey?.5:2),E=n(w(v($,T),F,I),t.apply(this,B),o);Ml(L),a>0?Zn(this).transition().duration(a).call(C,E,F,L):Zn(this).call(y.transform,E,F,L)}}function _(L,...B){if(e.apply(this,arguments)){var $=L.touches,F=$.length,I=S(this,B,L.changedTouches.length===F).event(L),T,E,q,W;for(lm(L),E=0;E<F;++E)q=$[E],W=_r(q,this),W=[W,this.__zoom.invert(W),q.identifier],I.touch0?!I.touch1&&I.touch0[2]!==W[2]&&(I.touch1=W,I.taps=0):(I.touch0=W,T=!0,I.taps=1+!!p);p&&(p=clearTimeout(p)),T&&(I.taps<2&&(d=W[0],p=setTimeout(function(){p=null},h)),af(this),I.start())}}function A(L,...B){if(this.__zooming){var $=S(this,B).event(L),F=L.changedTouches,I=F.length,T,E,q,W;for(Ml(L),T=0;T<I;++T)E=F[T],q=_r(E,this),$.touch0&&$.touch0[2]===E.identifier?$.touch0[0]=q:$.touch1&&$.touch1[2]===E.identifier&&($.touch1[0]=q);if(E=$.that.__zoom,$.touch1){var O=$.touch0[0],X=$.touch0[1],se=$.touch1[0],re=$.touch1[1],de=(de=se[0]-O[0])*de+(de=se[1]-O[1])*de,ie=(ie=re[0]-X[0])*ie+(ie=re[1]-X[1])*ie;E=v(E,Math.sqrt(de/ie)),q=[(O[0]+se[0])/2,(O[1]+se[1])/2],W=[(X[0]+re[0])/2,(X[1]+re[1])/2]}else if($.touch0)q=$.touch0[0],W=$.touch0[1];else return;$.zoom("touch",n(w(E,q,W),$.extent,o))}}function U(L,...B){if(this.__zooming){var $=S(this,B).event(L),F=L.changedTouches,I=F.length,T,E;for(lm(L),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),T=0;T<I;++T)E=F[T],$.touch0&&$.touch0[2]===E.identifier?delete $.touch0:$.touch1&&$.touch1[2]===E.identifier&&delete $.touch1;if($.touch1&&!$.touch0&&($.touch0=$.touch1,delete $.touch1),$.touch0)$.touch0[1]=this.__zoom.invert($.touch0[0]);else if($.end(),$.taps===2&&(E=_r(E,this),Math.hypot(d[0]-E[0],d[1]-E[1])<k)){var q=Zn(this).on("dblclick.zoom");q&&q.apply(this,arguments)}}}return y.wheelDelta=function(L){return arguments.length?(r=typeof L=="function"?L:jd(+L),y):r},y.filter=function(L){return arguments.length?(e=typeof L=="function"?L:jd(!!L),y):e},y.touchable=function(L){return arguments.length?(i=typeof L=="function"?L:jd(!!L),y):i},y.extent=function(L){return arguments.length?(t=typeof L=="function"?L:jd([[+L[0][0],+L[0][1]],[+L[1][0],+L[1][1]]]),y):t},y.scaleExtent=function(L){return arguments.length?(s[0]=+L[0],s[1]=+L[1],y):[s[0],s[1]]},y.translateExtent=function(L){return arguments.length?(o[0][0]=+L[0][0],o[1][0]=+L[1][0],o[0][1]=+L[0][1],o[1][1]=+L[1][1],y):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},y.constrain=function(L){return arguments.length?(n=L,y):n},y.duration=function(L){return arguments.length?(a=+L,y):a},y.interpolate=function(L){return arguments.length?(c=L,y):c},y.on=function(){var L=u.on.apply(u,arguments);return L===u?y:L},y.clickDistance=function(L){return arguments.length?(b=(L=+L)*L,y):Math.sqrt(b)},y.tapDistance=function(L){return arguments.length?(k=+L,y):k},y}const mi={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."},Dc=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],aC=["Enter"," ","Escape"],lC={"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 Ia;(function(e){e.Strict="strict",e.Loose="loose"})(Ia||(Ia={}));var so;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(so||(so={}));var $c;(function(e){e.Partial="partial",e.Full="full"})($c||($c={}));const cC={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var ls;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(ls||(ls={}));var Fr;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Fr||(Fr={}));var Ie;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ie||(Ie={}));const F0={[Ie.Left]:Ie.Right,[Ie.Right]:Ie.Left,[Ie.Top]:Ie.Bottom,[Ie.Bottom]:Ie.Top};function uC(e){return e===null?null:e?"valid":"invalid"}const dC=e=>"id"in e&&"source"in e&&"target"in e,dD=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Ax=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),au=(e,t=[0,0])=>{const{width:n,height:r}=Ui(e),i=e.origin??t,s=n*i[0],o=r*i[1];return{x:e.position.x-s,y:e.position.y-o}},fD=(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):Ax(i)?i:t.nodeLookup.get(i.id));const a=o?Kf(o,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Lp(r,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Op(n)},lu=(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=Lp(n,Kf(i)),r=!0)}),r?Op(n):{x:0,y:0,width:0,height:0}},Tx=(e,t,[n,r,i]=[0,0,1],s=!1,o=!1)=>{const a={...uu(t,[n,r,i]),width:t.width/i,height:t.height/i},c=[];for(const u of e.values()){const{measured:p,selectable:d=!0,hidden:f=!1}=u;if(o&&!d||f)continue;const h=p.width??u.width??u.initialWidth??null,g=p.height??u.height??u.initialHeight??null,b=Fc(a,Ta(u)),k=(h??0)*(g??0),y=s&&b>0;(!u.internals.handleBounds||y||b>=k||u.dragging)&&c.push(u)}return c},pD=(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 hD(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 mD({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:s},o){if(e.size===0)return Promise.resolve(!0);const a=hD(e,o),c=lu(a),u=Rx(c,t,n,(o==null?void 0:o.minZoom)??i,(o==null?void 0:o.maxZoom)??s,(o==null?void 0:o.padding)??.1);return await r.setViewport(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 fC({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:s}){const o=n.get(e),a=o.parentId?n.get(o.parentId):void 0,{x:c,y:u}=a?a.internals.positionAbsolute:{x:0,y:0},p=o.origin??r;let d=o.extent||i;if(o.extent==="parent"&&!o.expandParent)if(!a)s==null||s("005",mi.error005());else{const h=a.measured.width,g=a.measured.height;h&&g&&(d=[[c,u],[c+h,u+g]])}else a&&Ra(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+u],[o.extent[1][0]+c,o.extent[1][1]+u]]);const f=Ra(d)?go(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&(s==null||s("015",mi.error015())),{position:{x:f.x-c+(o.measured.width??0)*p[0],y:f.y-u+(o.measured.height??0)*p[1]},positionAbsolute:f}}async function gD({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){const s=new Set(e.map(f=>f.id)),o=[];for(const f of n){if(f.deletable===!1)continue;const h=s.has(f.id),g=!h&&f.parentId&&o.find(b=>b.id===f.parentId);(h||g)&&o.push(f)}const a=new Set(t.map(f=>f.id)),c=r.filter(f=>f.deletable!==!1),p=pD(o,c);for(const f of c)a.has(f.id)&&!p.find(g=>g.id===f.id)&&p.push(f);if(!i)return{edges:p,nodes:o};const d=await i({nodes:o,edges:p});return typeof d=="boolean"?d?{edges:p,nodes:o}:{edges:[],nodes:[]}:d}const Aa=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),go=(e={x:0,y:0},t,n)=>({x:Aa(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Aa(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function pC(e,t,n){const{width:r,height:i}=Ui(n),{x:s,y:o}=n.internals.positionAbsolute;return go(e,[[s,o],[s+r,o+i]],t)}const z0=(e,t,n)=>e<t?Aa(Math.abs(e-t),1,t)/t:e>n?-Aa(Math.abs(e-n),1,t)/t:0,hC=(e,t,n=15,r=40)=>{const i=z0(e.x,r,t.width-r)*n,s=z0(e.y,r,t.height-r)*n;return[i,s]},Lp=(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)}),Gg=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Op=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Ta=(e,t=[0,0])=>{var i,s;const{x:n,y:r}=Ax(e)?e.internals.positionAbsolute:au(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}},Kf=(e,t=[0,0])=>{var i,s;const{x:n,y:r}=Ax(e)?e.internals.positionAbsolute:au(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)}},mC=(e,t)=>Op(Lp(Gg(e),Gg(t))),Fc=(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)},B0=e=>Lr(e.width)&&Lr(e.height)&&Lr(e.x)&&Lr(e.y),Lr=e=>!isNaN(e)&&isFinite(e),yD=(e,t)=>{},cu=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),uu=({x:e,y:t},[n,r,i],s=!1,o=[1,1])=>{const a={x:(e-n)/i,y:(t-r)/i};return s?cu(a,o):a},Yf=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function $o(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 xD(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=$o(e,n),i=$o(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e=="object"){const r=$o(e.top??e.y??0,n),i=$o(e.bottom??e.y??0,n),s=$o(e.left??e.x??0,t),o=$o(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 wD(e,t,n,r,i,s){const{x:o,y:a}=Yf(e,[t,n,r]),{x:c,y:u}=Yf({x:e.x+e.width,y:e.y+e.height},[t,n,r]),p=i-c,d=s-u;return{left:Math.floor(o),top:Math.floor(a),right:Math.floor(p),bottom:Math.floor(d)}}const Rx=(e,t,n,r,i,s)=>{const o=xD(s,t,n),a=(t-o.x)/e.width,c=(n-o.y)/e.height,u=Math.min(a,c),p=Aa(u,r,i),d=e.x+e.width/2,f=e.y+e.height/2,h=t/2-d*p,g=n/2-f*p,b=wD(e,h,g,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:g-k.top+k.bottom,zoom:p}},zc=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Ra(e){return e!=null&&e!=="parent"}function Ui(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 gC(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 yC(e,t={width:0,height:0},n,r,i){const s={...e},o=r.get(n);if(o){const a=o.origin||i;s.x+=o.internals.positionAbsolute.x-(t.width??0)*a[0],s.y+=o.internals.positionAbsolute.y-(t.height??0)*a[1]}return s}function H0(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function vD(){let e,t;return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}}function bD(e){return{...lC,...e||{}}}function lc(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){const{x:s,y:o}=Or(e),a=uu({x:s-((i==null?void 0:i.left)??0),y:o-((i==null?void 0:i.top)??0)},r),{x:c,y:u}=n?cu(a,t):a;return{xSnapped:c,ySnapped:u,...a}}const Lx=e=>({width:e.offsetWidth,height:e.offsetHeight}),xC=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},kD=["INPUT","SELECT","TEXTAREA"];function wC(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:kD.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const vC=e=>"clientX"in e,Or=(e,t)=>{var s,o;const n=vC(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)}},U0=(e,t,n,r,i)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(o=>{const a=o.getBoundingClientRect();return{id:o.getAttribute("data-handleid"),type:e,nodeId:i,position:o.getAttribute("data-handlepos"),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...Lx(o)}})};function bC({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:s,targetControlX:o,targetControlY:a}){const c=e*.125+i*.375+o*.375+n*.125,u=t*.125+s*.375+a*.375+r*.125,p=Math.abs(c-e),d=Math.abs(u-t);return[c,u,p,d]}function Cd(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function V0({pos:e,x1:t,y1:n,x2:r,y2:i,c:s}){switch(e){case Ie.Left:return[t-Cd(t-r,s),n];case Ie.Right:return[t+Cd(r-t,s),n];case Ie.Top:return[t,n-Cd(n-i,s)];case Ie.Bottom:return[t,n+Cd(i-n,s)]}}function kC({sourceX:e,sourceY:t,sourcePosition:n=Ie.Bottom,targetX:r,targetY:i,targetPosition:s=Ie.Top,curvature:o=.25}){const[a,c]=V0({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[u,p]=V0({pos:s,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,h,g]=bC({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:a,sourceControlY:c,targetControlX:u,targetControlY:p});return[`M${e},${t} C${a},${c} ${u},${p} ${r},${i}`,d,f,h,g]}function SC({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,a=r<t?r+o:r-o;return[s,a,i,o]}function SD({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,a=Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0);return o+a}function ND({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){const s=Lp(Kf(e),Kf(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 Fc(o,Op(s))>0}const jD=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,CD=(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)),Ox=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||jD;let i;return dC(e)?i={...e}:i={...e,id:r(e)},CD(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function NC({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[i,s,o,a]=SC({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,s,o,a]}const W0={[Ie.Left]:{x:-1,y:0},[Ie.Right]:{x:1,y:0},[Ie.Top]:{x:0,y:-1},[Ie.Bottom]:{x:0,y:1}},ED=({source:e,sourcePosition:t=Ie.Bottom,target:n})=>t===Ie.Left||t===Ie.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},K0=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function PD({source:e,sourcePosition:t=Ie.Bottom,target:n,targetPosition:r=Ie.Top,center:i,offset:s,stepPosition:o}){const a=W0[t],c=W0[r],u={x:e.x+a.x*s,y:e.y+a.y*s},p={x:n.x+c.x*s,y:n.y+c.y*s},d=ED({source:u,sourcePosition:t,target:p}),f=d.x!==0?"x":"y",h=d[f];let g=[],b,k;const y={x:0,y:0},v={x:0,y:0},[,,w,N]=SC({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*c[f]===-1){f==="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}];a[f]===h?g=f==="x"?R:M:g=f==="x"?M:R}else{const R=[{x:u.x,y:p.y}],M=[{x:p.x,y:u.y}];if(f==="x"?g=a.x===h?M:R:g=a.y===h?R:M,t===r){const L=Math.abs(e[f]-n[f]);if(L<=s){const B=Math.min(s-1,s-L);a[f]===h?y[f]=(u[f]>e[f]?-1:1)*B:v[f]=(p[f]>n[f]?-1:1)*B}}if(t!==r){const L=f==="x"?"y":"x",B=a[f]===c[L],$=u[L]>p[L],F=u[L]<p[L];(a[f]===1&&(!B&&$||B&&F)||a[f]!==1&&(!B&&F||B&&$))&&(g=f==="x"?R:M)}const H={x:u.x+y.x,y:u.y+y.y},_={x:p.x+v.x,y:p.y+v.y},A=Math.max(Math.abs(H.x-g[0].x),Math.abs(_.x-g[0].x)),U=Math.max(Math.abs(H.y-g[0].y),Math.abs(_.y-g[0].y));A>=U?(b=(H.x+_.x)/2,k=g[0].y):(b=g[0].x,k=(H.y+_.y)/2)}const C={x:u.x+y.x,y:u.y+y.y},S={x:p.x+v.x,y:p.y+v.y};return[[e,...C.x!==g[0].x||C.y!==g[0].y?[C]:[],...g,...S.x!==g[g.length-1].x||S.y!==g[g.length-1].y?[S]:[],n],b,k,w,N]}function _D(e,t,n,r){const i=Math.min(K0(e,t)/2,K0(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 a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${s},${o+i*c}Q ${s},${o} ${s+i*a},${o}`}function Xg({sourceX:e,sourceY:t,sourcePosition:n=Ie.Bottom,targetX:r,targetY:i,targetPosition:s=Ie.Top,borderRadius:o=5,centerX:a,centerY:c,offset:u=20,stepPosition:p=.5}){const[d,f,h,g,b]=PD({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:s,center:{x:a,y:c},offset:u,stepPosition:p});let k=`M${d[0].x} ${d[0].y}`;for(let y=1;y<d.length-1;y++)k+=_D(d[y-1],d[y],d[y+1],o);return k+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[k,f,h,g,b]}function Y0(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function ID(e){var d;const{sourceNode:t,targetNode:n}=e;if(!Y0(t)||!Y0(n))return null;const r=t.internals.handleBounds||q0(t.handles),i=n.internals.handleBounds||q0(n.handles),s=G0((r==null?void 0:r.source)??[],e.sourceHandle),o=G0(e.connectionMode===Ia.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(d=e.onError)==null||d.call(e,"008",mi.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=(s==null?void 0:s.position)||Ie.Bottom,c=(o==null?void 0:o.position)||Ie.Top,u=yo(t,s,a),p=yo(n,o,c);return{sourceX:u.x,sourceY:u.y,targetX:p.x,targetY:p.y,sourcePosition:a,targetPosition:c}}function q0(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 yo(e,t,n=Ie.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:a}=t??Ui(e);if(r)return{x:i+o/2,y:s+a/2};switch((t==null?void 0:t.position)??n){case Ie.Top:return{x:i+o/2,y:s};case Ie.Right:return{x:i+o,y:s+a/2};case Ie.Bottom:return{x:i+o/2,y:s+a};case Ie.Left:return{x:i,y:s+a/2}}}function G0(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Jg(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function AD(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){const s=new Set;return e.reduce((o,a)=>([a.markerStart||r,a.markerEnd||i].forEach(c=>{if(c&&typeof c=="object"){const u=Jg(c,t);s.has(u)||(o.push({id:u,color:c.color||n,...c}),s.add(u))}}),o),[]).sort((o,a)=>o.id.localeCompare(a.id))}const jC=1e3,TD=10,Mx={nodeOrigin:[0,0],nodeExtent:Dc,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},RD={...Mx,checkEquality:!0};function Dx(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function LD(e,t,n){const r=Dx(Mx,n);for(const i of e.values())if(i.parentId)Fx(i,e,t,r);else{const s=au(i,r.nodeOrigin),o=Ra(i.extent)?i.extent:r.nodeExtent,a=go(s,o,Ui(i));i.internals.positionAbsolute=a}}function OD(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 $x(e){return e==="manual"}function Qg(e,t,n,r={}){var p,d;const i=Dx(RD,r),s={i:0},o=new Map(t),a=i!=null&&i.elevateNodesOnSelect&&!$x(i.zIndexMode)?jC:0;let c=e.length>0,u=!1;t.clear(),n.clear();for(const f of e){let h=o.get(f.id);if(i.checkEquality&&f===(h==null?void 0:h.internals.userNode))t.set(f.id,h);else{const g=au(f,i.nodeOrigin),b=Ra(f.extent)?f.extent:i.nodeExtent,k=go(g,b,Ui(f));h={...i.defaults,...f,measured:{width:(p=f.measured)==null?void 0:p.width,height:(d=f.measured)==null?void 0:d.height},internals:{positionAbsolute:k,handleBounds:OD(f,h),z:CC(f,a,i.zIndexMode),userNode:f}},t.set(f.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),f.parentId&&Fx(h,t,n,r,s),u||(u=f.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function MD(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 Fx(e,t,n,r,i){const{elevateNodesOnSelect:s,nodeOrigin:o,nodeExtent:a,zIndexMode:c}=Dx(Mx,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}MD(e,n),i&&!p.parentId&&p.internals.rootParentIndex===void 0&&c==="auto"&&(p.internals.rootParentIndex=++i.i,p.internals.z=p.internals.z+i.i*TD),i&&p.internals.rootParentIndex!==void 0&&(i.i=p.internals.rootParentIndex);const d=s&&!$x(c)?jC:0,{x:f,y:h,z:g}=DD(e,p,o,a,d,c),{positionAbsolute:b}=e.internals,k=f!==b.x||h!==b.y;(k||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:k?{x:f,y:h}:b,z:g}})}function CC(e,t,n){const r=Lr(e.zIndex)?e.zIndex:0;return $x(n)?r:r+(e.selected?t:0)}function DD(e,t,n,r,i,s){const{x:o,y:a}=t.internals.positionAbsolute,c=Ui(e),u=au(e,n),p=Ra(e.extent)?go(u,e.extent,c):u;let d=go({x:o+p.x,y:a+p.y},r,c);e.extent==="parent"&&(d=pC(d,c,t));const f=CC(e,i,s),h=t.internals.z??0;return{x:d.x,y:d.y,z:h>=f?h+1:f}}function zx(e,t,n,r=[0,0]){var o;const i=[],s=new Map;for(const a of e){const c=t.get(a.parentId);if(!c)continue;const u=((o=s.get(a.parentId))==null?void 0:o.expandedRect)??Ta(c),p=mC(u,a.rect);s.set(a.parentId,{expandedRect:p,parent:c})}return s.size>0&&s.forEach(({expandedRect:a,parent:c},u)=>{var w;const p=c.internals.positionAbsolute,d=Ui(c),f=c.origin??r,h=a.x<p.x?Math.round(Math.abs(p.x-a.x)):0,g=a.y<p.y?Math.round(Math.abs(p.y-a.y)):0,b=Math.max(d.width,Math.round(a.width)),k=Math.max(d.height,Math.round(a.height)),y=(b-d.width)*f[0],v=(k-d.height)*f[1];(h>0||g>0||y||v)&&(i.push({id:u,type:"position",position:{x:c.position.x-h+y,y:c.position.y-g+v}}),(w=n.get(u))==null||w.forEach(N=>{e.some(C=>C.id===N.id)||i.push({id:N.id,type:"position",position:{x:N.position.x+h,y:N.position.y+g}})})),(d.width<a.width||d.height<a.height||h||g)&&i.push({id:u,type:"dimensions",setAttributes:!0,dimensions:{width:b+(h?f[0]*h-y:0),height:k+(g?f[1]*g-v:0)}})}),i}function $D(e,t,n,r,i,s,o){const a=r==null?void 0:r.querySelector(".xyflow__viewport");let c=!1;if(!a)return{changes:[],updatedInternals:c};const u=[],p=window.getComputedStyle(a),{m22:d}=new window.DOMMatrixReadOnly(p.transform),f=[];for(const h of e.values()){const g=t.get(h.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const b=Lx(h.nodeElement),k=g.measured.width!==b.width||g.measured.height!==b.height;if(!!(b.width&&b.height&&(k||!g.internals.handleBounds||h.force))){const v=h.nodeElement.getBoundingClientRect(),w=Ra(g.extent)?g.extent:s;let{positionAbsolute:N}=g.internals;g.parentId&&g.extent==="parent"?N=pC(N,b,t.get(g.parentId)):w&&(N=go(N,w,b));const C={...g,measured:b,internals:{...g.internals,positionAbsolute:N,handleBounds:{source:U0("source",h.nodeElement,v,d,g.id),target:U0("target",h.nodeElement,v,d,g.id)}}};t.set(g.id,C),g.parentId&&Fx(C,t,n,{nodeOrigin:i,zIndexMode:o}),c=!0,k&&(u.push({id:g.id,type:"dimensions",dimensions:b}),g.expandParent&&g.parentId&&f.push({id:g.id,parentId:g.parentId,rect:Ta(C,i)}))}}if(f.length>0){const h=zx(f,t,n,i);u.push(...h)}return{changes:u,updatedInternals:c}}async function FD({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),a=!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2]);return Promise.resolve(a)}function X0(e,t,n,r,i,s){let o=i;const a=r.get(o)||new Map;r.set(o,a.set(n,t)),o=`${i}-${e}`;const c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),s){o=`${i}-${e}-${s}`;const u=r.get(o)||new Map;r.set(o,u.set(n,t))}}function EC(e,t,n){e.clear(),t.clear();for(const r of n){const{source:i,target:s,sourceHandle:o=null,targetHandle:a=null}=r,c={edgeId:r.id,source:i,target:s,sourceHandle:o,targetHandle:a},u=`${i}-${o}--${s}-${a}`,p=`${s}-${a}--${i}-${o}`;X0("source",c,p,e,i,o),X0("target",c,u,e,s,a),t.set(r.id,r)}}function PC(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:PC(n,t):!1}function J0(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 zD(e,t,n,r){const i=new Map;for(const[s,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!PC(o,e))&&(o.draggable||t&&typeof o.draggable>"u")){const a=e.get(s);a&&i.set(s,{id:s,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return i}function cm({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var o,a,c;const i=[];for(const[u,p]of t){const d=(o=n.get(u))==null?void 0:o.internals.userNode;d&&i.push({...d,position:p.position,dragging:r})}if(!e)return[i[0],i];const s=(a=n.get(e))==null?void 0:a.internals.userNode;return[s?{...s,position:((c=t.get(e))==null?void 0:c.position)||s.position,dragging:r}:i[0],i]}function BD({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=cu(s,t);return{x:o.x-s.x,y:o.y-s.y}}function HD({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let s={x:null,y:null},o=0,a=new Map,c=!1,u={x:0,y:0},p=null,d=!1,f=null,h=!1,g=!1,b=null;function k({noDragClassName:v,handleSelector:w,domNode:N,isSelectable:C,nodeId:S,nodeClickDistance:P=0}){f=Zn(N);function R({x:A,y:U}){const{nodeLookup:L,nodeExtent:B,snapGrid:$,snapToGrid:F,nodeOrigin:I,onNodeDrag:T,onSelectionDrag:E,onError:q,updateNodePositions:W}=t();s={x:A,y:U};let O=!1;const X=a.size>1,se=X&&B?Gg(lu(a)):null,re=X&&F?BD({dragItems:a,snapGrid:$,x:A,y:U}):null;for(const[de,ie]of a){if(!L.has(de))continue;let me={x:A-ie.distance.x,y:U-ie.distance.y};F&&(me=re?{x:Math.round(me.x+re.x),y:Math.round(me.y+re.y)}:cu(me,$));let ye=null;if(X&&B&&!ie.extent&&se){const{positionAbsolute:Se}=ie.internals,Ve=Se.x-se.x+B[0][0],We=Se.x+ie.measured.width-se.x2+B[1][0],He=Se.y-se.y+B[0][1],ut=Se.y+ie.measured.height-se.y2+B[1][1];ye=[[Ve,He],[We,ut]]}const{position:ke,positionAbsolute:he}=fC({nodeId:de,nextPosition:me,nodeLookup:L,nodeExtent:ye||B,nodeOrigin:I,onError:q});O=O||ie.position.x!==ke.x||ie.position.y!==ke.y,ie.position=ke,ie.internals.positionAbsolute=he}if(g=g||O,!!O&&(W(a,!0),b&&(r||T||!S&&E))){const[de,ie]=cm({nodeId:S,dragItems:a,nodeLookup:L});r==null||r(b,a,de,ie),T==null||T(b,de,ie),S||E==null||E(b,ie)}}async function M(){if(!p)return;const{transform:A,panBy:U,autoPanSpeed:L,autoPanOnNodeDrag:B}=t();if(!B){c=!1,cancelAnimationFrame(o);return}const[$,F]=hC(u,p,L);($!==0||F!==0)&&(s.x=(s.x??0)-$/A[2],s.y=(s.y??0)-F/A[2],await U({x:$,y:F})&&R(s)),o=requestAnimationFrame(M)}function H(A){var X;const{nodeLookup:U,multiSelectionActive:L,nodesDraggable:B,transform:$,snapGrid:F,snapToGrid:I,selectNodesOnDrag:T,onNodeDragStart:E,onSelectionDragStart:q,unselectNodesAndEdges:W}=t();d=!0,(!T||!C)&&!L&&S&&((X=U.get(S))!=null&&X.selected||W()),C&&T&&S&&(e==null||e(S));const O=lc(A.sourceEvent,{transform:$,snapGrid:F,snapToGrid:I,containerBounds:p});if(s=O,a=zD(U,B,O,S),a.size>0&&(n||E||!S&&q)){const[se,re]=cm({nodeId:S,dragItems:a,nodeLookup:U});n==null||n(A.sourceEvent,a,se,re),E==null||E(A.sourceEvent,se,re),S||q==null||q(A.sourceEvent,re)}}const _=Wj().clickDistance(P).on("start",A=>{const{domNode:U,nodeDragThreshold:L,transform:B,snapGrid:$,snapToGrid:F}=t();p=(U==null?void 0:U.getBoundingClientRect())||null,h=!1,g=!1,b=A.sourceEvent,L===0&&H(A),s=lc(A.sourceEvent,{transform:B,snapGrid:$,snapToGrid:F,containerBounds:p}),u=Or(A.sourceEvent,p)}).on("drag",A=>{const{autoPanOnNodeDrag:U,transform:L,snapGrid:B,snapToGrid:$,nodeDragThreshold:F,nodeLookup:I}=t(),T=lc(A.sourceEvent,{transform:L,snapGrid:B,snapToGrid:$,containerBounds:p});if(b=A.sourceEvent,(A.sourceEvent.type==="touchmove"&&A.sourceEvent.touches.length>1||S&&!I.has(S))&&(h=!0),!h){if(!c&&U&&d&&(c=!0,M()),!d){const E=Or(A.sourceEvent,p),q=E.x-u.x,W=E.y-u.y;Math.sqrt(q*q+W*W)>F&&H(A)}(s.x!==T.xSnapped||s.y!==T.ySnapped)&&a&&d&&(u=Or(A.sourceEvent,p),R(T))}}).on("end",A=>{if(!(!d||h)&&(c=!1,d=!1,cancelAnimationFrame(o),a.size>0)){const{nodeLookup:U,updateNodePositions:L,onNodeDragStop:B,onSelectionDragStop:$}=t();if(g&&(L(a,!1),g=!1),i||B||!S&&$){const[F,I]=cm({nodeId:S,dragItems:a,nodeLookup:U,dragging:!1});i==null||i(A.sourceEvent,a,F,I),B==null||B(A.sourceEvent,F,I),S||$==null||$(A.sourceEvent,I)}}}).filter(A=>{const U=A.target;return!A.button&&(!v||!J0(U,`.${v}`,N))&&(!w||J0(U,w,N))});f.call(_)}function y(){f==null||f.on(".drag",null)}return{update:k,destroy:y}}function UD(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())Fc(i,Ta(s))>0&&r.push(s);return r}const VD=250;function WD(e,t,n,r){var a,c;let i=[],s=1/0;const o=UD(e,n,t+VD);for(const u of o){const p=[...((a=u.internals.handleBounds)==null?void 0:a.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const d of p){if(r.nodeId===d.nodeId&&r.type===d.type&&r.id===d.id)continue;const{x:f,y:h}=yo(u,d,d.position,!0),g=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(h-e.y,2));g>t||(g<s?(i=[{...d,x:f,y:h}],s=g):g===s&&i.push({...d,x:f,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 _C(e,t,n,r,i,s=!1){var u,p,d;const o=r.get(e);if(!o)return null;const a=i==="strict"?(u=o.internals.handleBounds)==null?void 0:u[t]:[...((p=o.internals.handleBounds)==null?void 0:p.source)??[],...((d=o.internals.handleBounds)==null?void 0:d.target)??[]],c=(n?a==null?void 0:a.find(f=>f.id===n):a==null?void 0:a[0])??null;return c&&s?{...c,...yo(o,c,c.position,!0)}:c}function IC(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function KD(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const AC=()=>!0;function YD(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:s,isTarget:o,domNode:a,nodeLookup:c,lib:u,autoPanOnConnect:p,flowId:d,panBy:f,cancelConnection:h,onConnectStart:g,onConnect:b,onConnectEnd:k,isValidConnection:y=AC,onReconnectEnd:v,updateConnection:w,getTransform:N,getFromHandle:C,autoPanSpeed:S,dragThreshold:P=1,handleDomNode:R}){const M=xC(e.target);let H=0,_;const{x:A,y:U}=Or(e),L=IC(s,R),B=a==null?void 0:a.getBoundingClientRect();let $=!1;if(!B||!L)return;const F=_C(i,L,r,c,t);if(!F)return;let I=Or(e,B),T=!1,E=null,q=!1,W=null;function O(){if(!p||!B)return;const[ke,he]=hC(I,B,S);f({x:ke,y:he}),H=requestAnimationFrame(O)}const X={...F,nodeId:i,type:L,position:F.position},se=c.get(i);let de={inProgress:!0,isValid:null,from:yo(se,X,Ie.Left,!0),fromHandle:X,fromPosition:X.position,fromNode:se,to:I,toHandle:null,toPosition:F0[X.position],toNode:null,pointer:I};function ie(){$=!0,w(de),g==null||g(e,{nodeId:i,handleId:r,handleType:L})}P===0&&ie();function me(ke){if(!$){const{x:ut,y:Ge}=Or(ke),De=ut-A,kt=Ge-U;if(!(De*De+kt*kt>P*P))return;ie()}if(!C()||!X){ye(ke);return}const he=N();I=Or(ke,B),_=WD(uu(I,he,!1,[1,1]),n,c,X),T||(O(),T=!0);const Se=TC(ke,{handle:_,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?"target":"source",isValidConnection:y,doc:M,lib:u,flowId:d,nodeLookup:c});W=Se.handleDomNode,E=Se.connection,q=KD(!!_,Se.isValid);const Ve=c.get(i),We=Ve?yo(Ve,X,Ie.Left,!0):de.from,He={...de,from:We,isValid:q,to:Se.toHandle&&q?Yf({x:Se.toHandle.x,y:Se.toHandle.y},he):I,toHandle:Se.toHandle,toPosition:q&&Se.toHandle?Se.toHandle.position:F0[X.position],toNode:Se.toHandle?c.get(Se.toHandle.nodeId):null,pointer:I};w(He),de=He}function ye(ke){if(!("touches"in ke&&ke.touches.length>0)){if($){(_||W)&&E&&q&&(b==null||b(E));const{inProgress:he,...Se}=de,Ve={...Se,toPosition:de.toHandle?de.toPosition:null};k==null||k(ke,Ve),s&&(v==null||v(ke,Ve))}h(),cancelAnimationFrame(H),T=!1,q=!1,E=null,W=null,M.removeEventListener("mousemove",me),M.removeEventListener("mouseup",ye),M.removeEventListener("touchmove",me),M.removeEventListener("touchend",ye)}}M.addEventListener("mousemove",me),M.addEventListener("mouseup",ye),M.addEventListener("touchmove",me),M.addEventListener("touchend",ye)}function TC(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:s,doc:o,lib:a,flowId:c,isValidConnection:u=AC,nodeLookup:p}){const d=s==="target",f=t?o.querySelector(`.${a}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:h,y:g}=Or(e),b=o.elementFromPoint(h,g),k=b!=null&&b.classList.contains(`${a}-flow__handle`)?b:f,y={handleDomNode:k,isValid:!1,connection:null,toHandle:null};if(k){const v=IC(void 0,k),w=k.getAttribute("data-nodeid"),N=k.getAttribute("data-handleid"),C=k.classList.contains("connectable"),S=k.classList.contains("connectableend");if(!w||!v)return y;const P={source:d?w:r,sourceHandle:d?N:i,target:d?r:w,targetHandle:d?i:N};y.connection=P;const M=C&&S&&(n===Ia.Strict?d&&v==="source"||!d&&v==="target":w!==r||N!==i);y.isValid=M&&u(P),y.toHandle=_C(w,v,N,p,n,!0)}return y}const Zg={onPointerDown:YD,isValid:TC};function qD({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const i=Zn(e);function s({translateExtent:a,width:c,height:u,zoomStep:p=1,pannable:d=!0,zoomable:f=!0,inversePan:h=!1}){const g=w=>{if(w.sourceEvent.type!=="wheel"||!t)return;const N=n(),C=w.sourceEvent.ctrlKey&&zc()?10:1,S=-w.sourceEvent.deltaY*(w.sourceEvent.deltaMode===1?.05:w.sourceEvent.deltaMode?1:.002)*p,P=N[2]*Math.pow(2,S*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])},y=w=>{const N=n();if(w.sourceEvent.type!=="mousemove"&&w.sourceEvent.type!=="touchmove"||!t)return;const C=[w.sourceEvent.clientX??w.sourceEvent.touches[0].clientX,w.sourceEvent.clientY??w.sourceEvent.touches[0].clientY],S=[C[0]-b[0],C[1]-b[1]];b=C;const P=r()*Math.max(N[2],Math.log(N[2]))*(h?-1:1),R={x:N[0]-S[0]*P,y:N[1]-S[1]*P},M=[[0,0],[c,u]];t.setViewportConstrained({x:R.x,y:R.y,zoom:N[2]},M,a)},v=oC().on("start",k).on("zoom",d?y:null).on("zoom.wheel",f?g:null);i.call(v,{})}function o(){i.on("zoom",null)}return{update:s,destroy:o,pointer:_r}}const Mp=e=>({x:e.x,y:e.y,zoom:e.k}),um=({x:e,y:t,zoom:n})=>Rp.translate(e,t).scale(n),ia=(e,t)=>e.target.closest(`.${t}`),RC=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),GD=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,dm=(e,t=0,n=GD,r=()=>{})=>{const i=typeof t=="number"&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on("end",r):e},LC=e=>{const t=e.ctrlKey&&zc()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function XD({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:s,zoomOnPinch:o,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:u}){return p=>{if(ia(p,t))return p.ctrlKey&&p.preventDefault(),!1;p.preventDefault(),p.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(p.ctrlKey&&o){const k=_r(p),y=LC(p),v=d*Math.pow(2,y);r.scaleTo(n,v,k,p);return}const f=p.deltaMode===1?20:1;let h=i===so.Vertical?0:p.deltaX*f,g=i===so.Horizontal?0:p.deltaY*f;!zc()&&p.shiftKey&&i!==so.Vertical&&(h=p.deltaY*f,g=0),r.translateBy(n,-(h/d)*s,-(g/d)*s,{internal:!0});const b=Mp(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(p,b),e.panScrollTimeout=setTimeout(()=>{u==null||u(p,b),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a==null||a(p,b))}}function JD({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){const s=r.type==="wheel",o=!t&&s&&!r.ctrlKey,a=ia(r,e);if(r.ctrlKey&&s&&a&&r.preventDefault(),o||a)return null;r.preventDefault(),n.call(this,r,i)}}function QD({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var s,o,a;if((s=r.sourceEvent)!=null&&s.internal)return;const i=Mp(r.transform);e.mouseButton=((o=r.sourceEvent)==null?void 0:o.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=i,((a=r.sourceEvent)==null?void 0:a.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,i))}}function ZD({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return s=>{var o,a;e.usedRightMouseButton=!!(n&&RC(t,e.mouseButton??0)),(o=s.sourceEvent)!=null&&o.sync||r([s.transform.x,s.transform.y,s.transform.k]),i&&!((a=s.sourceEvent)!=null&&a.internal)&&(i==null||i(s.sourceEvent,Mp(s.transform)))}}function e$({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:s}){return o=>{var a;if(!((a=o.sourceEvent)!=null&&a.internal)&&(e.isZoomingOrPanning=!1,s&&RC(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&s(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){const c=Mp(o.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i==null||i(o.sourceEvent,c)},n?150:0)}}}function t$({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:o,noWheelClassName:a,noPanClassName:c,lib:u,connectionInProgress:p}){return d=>{var k;const f=e||t,h=n&&d.ctrlKey,g=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(ia(d,`${u}-flow__node`)||ia(d,`${u}-flow__edge`)))return!0;if(!r&&!f&&!i&&!s&&!n||o||p&&!g||ia(d,a)&&g||ia(d,c)&&(!g||i&&g&&!e)||!n&&d.ctrlKey&&g)return!1;if(!n&&d.type==="touchstart"&&((k=d.touches)==null?void 0:k.length)>1)return d.preventDefault(),!1;if(!f&&!i&&!h&&g||!r&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(r)&&!r.includes(d.button)&&d.type==="mousedown")return!1;const b=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||g)&&b}}function n$({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:s,onPanZoomStart:o,onPanZoomEnd:a,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},p=e.getBoundingClientRect(),d=oC().scaleExtent([t,n]).translateExtent(r),f=Zn(e).call(d);v({x:i.x,y:i.y,zoom:Aa(i.zoom,t,n)},[[0,0],[p.width,p.height]],r);const h=f.on("wheel.zoom"),g=f.on("dblclick.zoom");d.wheelDelta(LC);function b(_,A){return f?new Promise(U=>{d==null||d.interpolate((A==null?void 0:A.interpolate)==="linear"?ac:rf).transform(dm(f,A==null?void 0:A.duration,A==null?void 0:A.ease,()=>U(!0)),_)}):Promise.resolve(!1)}function k({noWheelClassName:_,noPanClassName:A,onPaneContextMenu:U,userSelectionActive:L,panOnScroll:B,panOnDrag:$,panOnScrollMode:F,panOnScrollSpeed:I,preventScrolling:T,zoomOnPinch:E,zoomOnScroll:q,zoomOnDoubleClick:W,zoomActivationKeyPressed:O,lib:X,onTransformChange:se,connectionInProgress:re,paneClickDistance:de,selectionOnDrag:ie}){L&&!u.isZoomingOrPanning&&y();const me=B&&!O&&!L;d.clickDistance(ie?1/0:!Lr(de)||de<0?0:de);const ye=me?XD({zoomPanValues:u,noWheelClassName:_,d3Selection:f,d3Zoom:d,panOnScrollMode:F,panOnScrollSpeed:I,zoomOnPinch:E,onPanZoomStart:o,onPanZoom:s,onPanZoomEnd:a}):JD({noWheelClassName:_,preventScrolling:T,d3ZoomHandler:h});if(f.on("wheel.zoom",ye,{passive:!1}),!L){const he=QD({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:o});d.on("start",he);const Se=ZD({zoomPanValues:u,panOnDrag:$,onPaneContextMenu:!!U,onPanZoom:s,onTransformChange:se});d.on("zoom",Se);const Ve=e$({zoomPanValues:u,panOnDrag:$,panOnScroll:B,onPaneContextMenu:U,onPanZoomEnd:a,onDraggingChange:c});d.on("end",Ve)}const ke=t$({zoomActivationKeyPressed:O,panOnDrag:$,zoomOnScroll:q,panOnScroll:B,zoomOnDoubleClick:W,zoomOnPinch:E,userSelectionActive:L,noPanClassName:A,noWheelClassName:_,lib:X,connectionInProgress:re});d.filter(ke),W?f.on("dblclick.zoom",g):f.on("dblclick.zoom",null)}function y(){d.on("zoom",null)}async function v(_,A,U){const L=um(_),B=d==null?void 0:d.constrain()(L,A,U);return B&&await b(B),new Promise($=>$(B))}async function w(_,A){const U=um(_);return await b(U,A),new Promise(L=>L(U))}function N(_){if(f){const A=um(_),U=f.property("__zoom");(U.k!==_.zoom||U.x!==_.x||U.y!==_.y)&&(d==null||d.transform(f,A,null,{sync:!0}))}}function C(){const _=f?sC(f.node()):{x:0,y:0,k:1};return{x:_.x,y:_.y,zoom:_.k}}function S(_,A){return f?new Promise(U=>{d==null||d.interpolate((A==null?void 0:A.interpolate)==="linear"?ac:rf).scaleTo(dm(f,A==null?void 0:A.duration,A==null?void 0:A.ease,()=>U(!0)),_)}):Promise.resolve(!1)}function P(_,A){return f?new Promise(U=>{d==null||d.interpolate((A==null?void 0:A.interpolate)==="linear"?ac:rf).scaleBy(dm(f,A==null?void 0:A.duration,A==null?void 0:A.ease,()=>U(!0)),_)}):Promise.resolve(!1)}function R(_){d==null||d.scaleExtent(_)}function M(_){d==null||d.translateExtent(_)}function H(_){const A=!Lr(_)||_<0?0:_;d==null||d.clickDistance(A)}return{update:k,destroy:y,setViewport:w,setViewportConstrained:v,getViewport:C,scaleTo:S,scaleBy:P,setScaleExtent:R,setTranslateExtent:M,syncViewport:N,setClickDistance:H}}var La;(function(e){e.Line="line",e.Handle="handle"})(La||(La={}));function r$({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:s}){const o=e-t,a=n-r,c=[o>0?1:o<0?-1:0,a>0?1:a<0?-1:0];return o&&i&&(c[0]=c[0]*-1),a&&s&&(c[1]=c[1]*-1),c}function Q0(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 es(e,t){return Math.max(0,t-e)}function ts(e,t){return Math.max(0,e-t)}function Ed(e,t,n){return Math.max(0,t-e,e-n)}function Z0(e,t){return e?!t:t}function i$(e,t,n,r,i,s,o,a){let{affectsX:c,affectsY:u}=t;const{isHorizontal:p,isVertical:d}=t,f=p&&d,{xSnapped:h,ySnapped:g}=n,{minWidth:b,maxWidth:k,minHeight:y,maxHeight:v}=r,{x:w,y:N,width:C,height:S,aspectRatio:P}=e;let R=Math.floor(p?h-e.pointerX:0),M=Math.floor(d?g-e.pointerY:0);const H=C+(c?-R:R),_=S+(u?-M:M),A=-s[0]*C,U=-s[1]*S;let L=Ed(H,b,k),B=Ed(_,y,v);if(o){let I=0,T=0;c&&R<0?I=es(w+R+A,o[0][0]):!c&&R>0&&(I=ts(w+H+A,o[1][0])),u&&M<0?T=es(N+M+U,o[0][1]):!u&&M>0&&(T=ts(N+_+U,o[1][1])),L=Math.max(L,I),B=Math.max(B,T)}if(a){let I=0,T=0;c&&R>0?I=ts(w+R,a[0][0]):!c&&R<0&&(I=es(w+H,a[1][0])),u&&M>0?T=ts(N+M,a[0][1]):!u&&M<0&&(T=es(N+_,a[1][1])),L=Math.max(L,I),B=Math.max(B,T)}if(i){if(p){const I=Ed(H/P,y,v)*P;if(L=Math.max(L,I),o){let T=0;!c&&!u||c&&!u&&f?T=ts(N+U+H/P,o[1][1])*P:T=es(N+U+(c?R:-R)/P,o[0][1])*P,L=Math.max(L,T)}if(a){let T=0;!c&&!u||c&&!u&&f?T=es(N+H/P,a[1][1])*P:T=ts(N+(c?R:-R)/P,a[0][1])*P,L=Math.max(L,T)}}if(d){const I=Ed(_*P,b,k)/P;if(B=Math.max(B,I),o){let T=0;!c&&!u||u&&!c&&f?T=ts(w+_*P+A,o[1][0])/P:T=es(w+(u?M:-M)*P+A,o[0][0])/P,B=Math.max(B,T)}if(a){let T=0;!c&&!u||u&&!c&&f?T=es(w+_*P,a[1][0])/P:T=ts(w+(u?M:-M)*P,a[0][0])/P,B=Math.max(B,T)}}}M=M+(M<0?B:-B),R=R+(R<0?L:-L),i&&(f?H>_*P?M=(Z0(c,u)?-R:R)/P:R=(Z0(c,u)?-M:M)*P:p?(M=R/P,u=c):(R=M*P,c=u));const $=c?w+R:w,F=u?N+M:N;return{width:C+(c?-R:R),height:S+(u?-M:M),x:s[0]*R*(c?-1:1)+$,y:s[1]*M*(u?-1:1)+F}}const OC={width:0,height:0,x:0,y:0},s$={...OC,pointerX:0,pointerY:0,aspectRatio:1};function o$(e){return[[0,0],[e.measured.width,e.measured.height]]}function a$(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,a=n[0]*s,c=n[1]*o;return[[r-a,i-c],[r+s-a,i+o-c]]}function l$({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){const s=Zn(e);let o={controlDirection:Q0("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:u,boundaries:p,keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:b,shouldResize:k}){let y={...OC},v={...s$};o={boundaries:p,resizeDirection:f,keepAspectRatio:d,controlDirection:Q0(u)};let w,N=null,C=[],S,P,R,M=!1;const H=Wj().on("start",_=>{const{nodeLookup:A,transform:U,snapGrid:L,snapToGrid:B,nodeOrigin:$,paneDomNode:F}=n();if(w=A.get(t),!w)return;N=(F==null?void 0:F.getBoundingClientRect())??null;const{xSnapped:I,ySnapped:T}=lc(_.sourceEvent,{transform:U,snapGrid:L,snapToGrid:B,containerBounds:N});y={width:w.measured.width??0,height:w.measured.height??0,x:w.position.x??0,y:w.position.y??0},v={...y,pointerX:I,pointerY:T,aspectRatio:y.width/y.height},S=void 0,w.parentId&&(w.extent==="parent"||w.expandParent)&&(S=A.get(w.parentId),P=S&&w.extent==="parent"?o$(S):void 0),C=[],R=void 0;for(const[E,q]of A)if(q.parentId===t&&(C.push({id:E,position:{...q.position},extent:q.extent}),q.extent==="parent"||q.expandParent)){const W=a$(q,w,q.origin??$);R?R=[[Math.min(W[0][0],R[0][0]),Math.min(W[0][1],R[0][1])],[Math.max(W[1][0],R[1][0]),Math.max(W[1][1],R[1][1])]]:R=W}h==null||h(_,{...y})}).on("drag",_=>{const{transform:A,snapGrid:U,snapToGrid:L,nodeOrigin:B}=n(),$=lc(_.sourceEvent,{transform:A,snapGrid:U,snapToGrid:L,containerBounds:N}),F=[];if(!w)return;const{x:I,y:T,width:E,height:q}=y,W={},O=w.origin??B,{width:X,height:se,x:re,y:de}=i$(v,o.controlDirection,$,o.boundaries,o.keepAspectRatio,O,P,R),ie=X!==E,me=se!==q,ye=re!==I&&ie,ke=de!==T&&me;if(!ye&&!ke&&!ie&&!me)return;if((ye||ke||O[0]===1||O[1]===1)&&(W.x=ye?re:y.x,W.y=ke?de:y.y,y.x=W.x,y.y=W.y,C.length>0)){const We=re-I,He=de-T;for(const ut of C)ut.position={x:ut.position.x-We+O[0]*(X-E),y:ut.position.y-He+O[1]*(se-q)},F.push(ut)}if((ie||me)&&(W.width=ie&&(!o.resizeDirection||o.resizeDirection==="horizontal")?X:y.width,W.height=me&&(!o.resizeDirection||o.resizeDirection==="vertical")?se:y.height,y.width=W.width,y.height=W.height),S&&w.expandParent){const We=O[0]*(W.width??0);W.x&&W.x<We&&(y.x=We,v.x=v.x-(W.x-We));const He=O[1]*(W.height??0);W.y&&W.y<He&&(y.y=He,v.y=v.y-(W.y-He))}const he=r$({width:y.width,prevWidth:E,height:y.height,prevHeight:q,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),Se={...y,direction:he};(k==null?void 0:k(_,Se))!==!1&&(M=!0,g==null||g(_,Se),r(W,F))}).on("end",_=>{M&&(b==null||b(_,{...y}),i==null||i({...y}),M=!1)});s.call(H)}function c(){s.on(".drag",null)}return{update:a,destroy:c}}var MC={exports:{}},DC={},$C={exports:{}},FC={};/**
|
|
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 Oa=m;function c$(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var u$=typeof Object.is=="function"?Object.is:c$,d$=Oa.useState,f$=Oa.useEffect,p$=Oa.useLayoutEffect,h$=Oa.useDebugValue;function m$(e,t){var n=t(),r=d$({inst:{value:n,getSnapshot:t}}),i=r[0].inst,s=r[1];return p$(function(){i.value=n,i.getSnapshot=t,fm(i)&&s({inst:i})},[e,n,t]),f$(function(){return fm(i)&&s({inst:i}),e(function(){fm(i)&&s({inst:i})})},[e]),h$(n),n}function fm(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!u$(e,n)}catch{return!0}}function g$(e,t){return t()}var y$=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?g$:m$;FC.useSyncExternalStore=Oa.useSyncExternalStore!==void 0?Oa.useSyncExternalStore:y$;$C.exports=FC;var zC=$C.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 Dp=m,x$=zC;function w$(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var v$=typeof Object.is=="function"?Object.is:w$,b$=x$.useSyncExternalStore,k$=Dp.useRef,S$=Dp.useEffect,N$=Dp.useMemo,j$=Dp.useDebugValue;DC.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var s=k$(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=N$(function(){function c(h){if(!u){if(u=!0,p=h,h=r(h),i!==void 0&&o.hasValue){var g=o.value;if(i(g,h))return d=g}return d=h}if(g=d,v$(p,h))return g;var b=r(h);return i!==void 0&&i(g,b)?(p=h,g):(p=h,d=b)}var u=!1,p,d,f=n===void 0?null:n;return[function(){return c(t())},f===null?void 0:function(){return c(f())}]},[t,n,r,i]);var a=b$(e,s[0],s[1]);return S$(function(){o.hasValue=!0,o.value=a},[a]),j$(a),a};MC.exports=DC;var C$=MC.exports;const E$=_s(C$),P$={},eb=e=>{let t;const n=new Set,r=(p,d)=>{const f=typeof p=="function"?p(t):p;if(!Object.is(f,t)){const h=t;t=d??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(g=>g(t,h))}},i=()=>t,c={setState:r,getState:i,getInitialState:()=>u,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(P$?"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,c);return c},_$=e=>e?eb(e):eb,{useDebugValue:I$}=Le,{useSyncExternalStoreWithSelector:A$}=E$,T$=e=>e;function BC(e,t=T$,n){const r=A$(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return I$(r),r}const tb=(e,t)=>{const n=_$(e),r=(i,s=t)=>BC(n,i,s);return Object.assign(r,n),r},R$=(e,t)=>e?tb(e,t):tb;function It(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 $p=m.createContext(null),L$=$p.Provider,HC=mi.error001();function nt(e,t){const n=m.useContext($p);if(n===null)throw new Error(HC);return BC(n,e,t)}function At(){const e=m.useContext($p);if(e===null)throw new Error(HC);return m.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const nb={display:"none"},O$={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},UC="react-flow__node-desc",VC="react-flow__edge-desc",M$="react-flow__aria-live",D$=e=>e.ariaLiveMessage,$$=e=>e.ariaLabelConfig;function F$({rfId:e}){const t=nt(D$);return l.jsx("div",{id:`${M$}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:O$,children:t})}function z$({rfId:e,disableKeyboardA11y:t}){const n=nt($$);return l.jsxs(l.Fragment,{children:[l.jsx("div",{id:`${UC}-${e}`,style:nb,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),l.jsx("div",{id:`${VC}-${e}`,style:nb,children:n["edge.a11yDescription.default"]}),!t&&l.jsx(F$,{rfId:e})]})}const Ma=m.forwardRef(({position:e="top-left",children:t,className:n,style:r,...i},s)=>{const o=`${e}`.split("-");return l.jsx("div",{className:qt(["react-flow__panel",n,...o]),style:r,ref:s,...i,children:t})});Ma.displayName="Panel";function B$({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:l.jsx(Ma,{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:l.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const H$=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}},Pd=e=>e.id;function U$(e,t){return It(e.selectedNodes.map(Pd),t.selectedNodes.map(Pd))&&It(e.selectedEdges.map(Pd),t.selectedEdges.map(Pd))}function V$({onSelectionChange:e}){const t=At(),{selectedNodes:n,selectedEdges:r}=nt(H$,U$);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 W$=e=>!!e.onSelectionChangeHandlers;function K$({onSelectionChange:e}){const t=nt(W$);return e||t?l.jsx(V$,{onSelectionChange:e}):null}const ey=typeof window<"u"?m.useLayoutEffect:m.useEffect,WC=[0,0],Y$={x:0,y:0,zoom:1},q$=["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"],rb=[...q$,"rfId"],G$=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}),ib={translateExtent:Dc,nodeOrigin:WC,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function X$(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:s,setNodeExtent:o,reset:a,setDefaultNodesAndEdges:c}=nt(G$,It),u=At();ey(()=>(c(e.defaultNodes,e.defaultEdges),()=>{p.current=ib,a()}),[]);const p=m.useRef(ib);return ey(()=>{for(const d of rb){const f=e[d],h=p.current[d];f!==h&&(typeof e[d]>"u"||(d==="nodes"?t(f):d==="edges"?n(f):d==="minZoom"?r(f):d==="maxZoom"?i(f):d==="translateExtent"?s(f):d==="nodeExtent"?o(f):d==="ariaLabelConfig"?u.setState({ariaLabelConfig:bD(f)}):d==="fitView"?u.setState({fitViewQueued:f}):d==="fitViewOptions"?u.setState({fitViewOptions:f}):u.setState({[d]:f})))}p.current=e},rb.map(d=>e[d])),null}function sb(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function J$(e){var r;const[t,n]=m.useState(e==="system"?null:e);return m.useEffect(()=>{if(e!=="system"){n(e);return}const i=sb(),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=sb())!=null&&r.matches?"dark":"light"}const ob=typeof document<"u"?document:null;function Bc(e=null,t={target:ob,actInsideInputWithModifier:!0}){const[n,r]=m.useState(!1),i=m.useRef(!1),s=m.useRef(new Set([])),[o,a]=m.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",`
|
|
61
|
-
`).replace(`
|
|
62
|
-
|
|
63
|
-
`,`
|
|
64
|
-
+`).split(`
|
|
65
|
-
`)),p=u.reduce((d,f)=>d.concat(...f),[]);return[u,p]}return[[],[]]},[e]);return m.useEffect(()=>{const c=(t==null?void 0:t.target)??ob,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const p=h=>{var k,y;if(i.current=h.ctrlKey||h.metaKey||h.shiftKey||h.altKey,(!i.current||i.current&&!u)&&wC(h))return!1;const b=lb(h.code,a);if(s.current.add(h[b]),ab(o,s.current,!1)){const v=((y=(k=h.composedPath)==null?void 0:k.call(h))==null?void 0:y[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)}},d=h=>{const g=lb(h.code,a);ab(o,s.current,!0)?(r(!1),s.current.clear()):s.current.delete(h[g]),h.key==="Meta"&&s.current.clear(),i.current=!1},f=()=>{s.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",p),c==null||c.addEventListener("keyup",d),window.addEventListener("blur",f),window.addEventListener("contextmenu",f),()=>{c==null||c.removeEventListener("keydown",p),c==null||c.removeEventListener("keyup",d),window.removeEventListener("blur",f),window.removeEventListener("contextmenu",f)}}},[e,r]),n}function ab(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(i=>t.has(i)))}function lb(e,t){return t.includes(e)?"code":"key"}const Q$=()=>{const e=At();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:a}=e.getState(),c=Rx(t,r,i,s,o,(n==null?void 0:n.padding)??.1);return a?(await a.setViewport(c,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:i,snapToGrid:s,domNode:o}=e.getState();if(!o)return t;const{x:a,y:c}=o.getBoundingClientRect(),u={x:t.x-a,y:t.y-c},p=n.snapGrid??i,d=n.snapToGrid??s;return uu(u,r,d,p)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:i,y:s}=r.getBoundingClientRect(),o=Yf(t,n);return{x:o.x+i,y:o.y+s}}}),[])};function KC(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 a={...s};for(const c of o)Z$(c,a);n.push(a)}return i.length&&i.forEach(s=>{s.index!==void 0?n.splice(s.index,0,{...s.item}):n.push({...s.item})}),n}function Z$(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 Bx(e,t){return KC(e,t)}function YC(e,t){return KC(e,t)}function Xs(e,t){return{id:e,type:"select",selected:t}}function sa(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(Xs(s.id,o)))}return r}function cb({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 a=t.get(o.id),c=((i=a==null?void 0:a.internals)==null?void 0:i.userNode)??a;c!==void 0&&c!==o&&n.push({id:o.id,item:o,type:"replace"}),c===void 0&&n.push({item:o,type:"add",index:s})}for(const[s]of t)r.get(s)===void 0&&n.push({id:s,type:"remove"});return n}function ub(e){return{id:e.id,type:"remove"}}const db=e=>dD(e),eF=e=>dC(e);function qC(e){return m.forwardRef(e)}function fb(e){const[t,n]=m.useState(BigInt(0)),[r]=m.useState(()=>tF(()=>n(i=>i+BigInt(1))));return ey(()=>{const i=r.get();i.length&&(e(i),r.reset())},[t]),r}function tF(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const GC=m.createContext(null);function nF({children:e}){const t=At(),n=m.useCallback(a=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:p,onNodesChange:d,nodeLookup:f,fitViewQueued:h,onNodesChangeMiddlewareMap:g}=t.getState();let b=c;for(const y of a)b=typeof y=="function"?y(b):y;let k=cb({items:b,lookup:f});for(const y of g.values())k=y(k);p&&u(b),k.length>0?d==null||d(k):h&&window.requestAnimationFrame(()=>{const{fitViewQueued:y,nodes:v,setNodes:w}=t.getState();y&&w(v)})},[]),r=fb(n),i=m.useCallback(a=>{const{edges:c=[],setEdges:u,hasDefaultEdges:p,onEdgesChange:d,edgeLookup:f}=t.getState();let h=c;for(const g of a)h=typeof g=="function"?g(h):g;p?u(h):d&&d(cb({items:h,lookup:f}))},[]),s=fb(i),o=m.useMemo(()=>({nodeQueue:r,edgeQueue:s}),[]);return l.jsx(GC.Provider,{value:o,children:e})}function rF(){const e=m.useContext(GC);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const iF=e=>!!e.panZoom;function So(){const e=Q$(),t=At(),n=rF(),r=nt(iF),i=m.useMemo(()=>{const s=d=>t.getState().nodeLookup.get(d),o=d=>{n.nodeQueue.push(d)},a=d=>{n.edgeQueue.push(d)},c=d=>{var y,v;const{nodeLookup:f,nodeOrigin:h}=t.getState(),g=db(d)?d:f.get(d.id),b=g.parentId?yC(g.position,g.measured,g.parentId,f,h):g.position,k={...g,position:b,width:((y=g.measured)==null?void 0:y.width)??g.width,height:((v=g.measured)==null?void 0:v.height)??g.height};return Ta(k)},u=(d,f,h={replace:!1})=>{o(g=>g.map(b=>{if(b.id===d){const k=typeof f=="function"?f(b):f;return h.replace&&db(k)?k:{...b,...k}}return b}))},p=(d,f,h={replace:!1})=>{a(g=>g.map(b=>{if(b.id===d){const k=typeof f=="function"?f(b):f;return h.replace&&eF(k)?k:{...b,...k}}return b}))};return{getNodes:()=>t.getState().nodes.map(d=>({...d})),getNode:d=>{var f;return(f=s(d))==null?void 0:f.internals.userNode},getInternalNode:s,getEdges:()=>{const{edges:d=[]}=t.getState();return d.map(f=>({...f}))},getEdge:d=>t.getState().edgeLookup.get(d),setNodes:o,setEdges:a,addNodes:d=>{const f=Array.isArray(d)?d:[d];n.nodeQueue.push(h=>[...h,...f])},addEdges:d=>{const f=Array.isArray(d)?d:[d];n.edgeQueue.push(h=>[...h,...f])},toObject:()=>{const{nodes:d=[],edges:f=[],transform:h}=t.getState(),[g,b,k]=h;return{nodes:d.map(y=>({...y})),edges:f.map(y=>({...y})),viewport:{x:g,y:b,zoom:k}}},deleteElements:async({nodes:d=[],edges:f=[]})=>{const{nodes:h,edges:g,onNodesDelete:b,onEdgesDelete:k,triggerNodeChanges:y,triggerEdgeChanges:v,onDelete:w,onBeforeDelete:N}=t.getState(),{nodes:C,edges:S}=await gD({nodesToRemove:d,edgesToRemove:f,nodes:h,edges:g,onBeforeDelete:N}),P=S.length>0,R=C.length>0;if(P){const M=S.map(ub);k==null||k(S),v(M)}if(R){const M=C.map(ub);b==null||b(C),y(M)}return(R||P)&&(w==null||w({nodes:C,edges:S})),{deletedNodes:C,deletedEdges:S}},getIntersectingNodes:(d,f=!0,h)=>{const g=B0(d),b=g?d:c(d),k=h!==void 0;return b?(h||t.getState().nodes).filter(y=>{const v=t.getState().nodeLookup.get(y.id);if(v&&!g&&(y.id===d.id||!v.internals.positionAbsolute))return!1;const w=Ta(k?y:v),N=Fc(w,b);return f&&N>0||N>=w.width*w.height||N>=b.width*b.height}):[]},isNodeIntersecting:(d,f,h=!0)=>{const b=B0(d)?d:c(d);if(!b)return!1;const k=Fc(b,f);return h&&k>0||k>=f.width*f.height||k>=b.width*b.height},updateNode:u,updateNodeData:(d,f,h={replace:!1})=>{u(d,g=>{const b=typeof f=="function"?f(g):f;return h.replace?{...g,data:b}:{...g,data:{...g.data,...b}}},h)},updateEdge:p,updateEdgeData:(d,f,h={replace:!1})=>{p(d,g=>{const b=typeof f=="function"?f(g):f;return h.replace?{...g,data:b}:{...g,data:{...g.data,...b}}},h)},getNodesBounds:d=>{const{nodeLookup:f,nodeOrigin:h}=t.getState();return fD(d,{nodeLookup:f,nodeOrigin:h})},getHandleConnections:({type:d,id:f,nodeId:h})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${h}-${d}${f?`-${f}`:""}`))==null?void 0:g.values())??[])},getNodeConnections:({type:d,handleId:f,nodeId:h})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${h}${d?f?`-${d}-${f}`:`-${d}`:""}`))==null?void 0:g.values())??[])},fitView:async d=>{const f=t.getState().fitViewResolver??vD();return t.setState({fitViewQueued:!0,fitViewOptions:d,fitViewResolver:f}),n.nodeQueue.push(h=>[...h]),f.promise}}},[]);return m.useMemo(()=>({...i,...e,viewportInitialized:r}),[r])}const pb=e=>e.selected,sF=typeof window<"u"?window:void 0;function oF({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=At(),{deleteElements:r}=So(),i=Bc(e,{actInsideInputWithModifier:!1}),s=Bc(t,{target:sF});m.useEffect(()=>{if(i){const{edges:o,nodes:a}=n.getState();r({nodes:a.filter(pb),edges:o.filter(pb)}),n.setState({nodesSelectionActive:!1})}},[i]),m.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])}function aF(e){const t=At();m.useEffect(()=>{const n=()=>{var i,s,o,a;if(!e.current||!(((s=(i=e.current).checkVisibility)==null?void 0:s.call(i))??!0))return!1;const r=Lx(e.current);(r.height===0||r.width===0)&&((a=(o=t.getState()).onError)==null||a.call(o,"004",mi.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 Fp={position:"absolute",width:"100%",height:"100%",top:0,left:0},lF=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function cF({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:s=so.Free,zoomOnDoubleClick:o=!0,panOnDrag:a=!0,defaultViewport:c,translateExtent:u,minZoom:p,maxZoom:d,zoomActivationKeyCode:f,preventScrolling:h=!0,children:g,noWheelClassName:b,noPanClassName:k,onViewportChange:y,isControlledViewport:v,paneClickDistance:w,selectionOnDrag:N}){const C=At(),S=m.useRef(null),{userSelectionActive:P,lib:R,connectionInProgress:M}=nt(lF,It),H=Bc(f),_=m.useRef();aF(S);const A=m.useCallback(U=>{y==null||y({x:U[0],y:U[1],zoom:U[2]}),v||C.setState({transform:U})},[y,v]);return m.useEffect(()=>{if(S.current){_.current=n$({domNode:S.current,minZoom:p,maxZoom:d,translateExtent:u,viewport:c,onDraggingChange:$=>C.setState(F=>F.paneDragging===$?F:{paneDragging:$}),onPanZoomStart:($,F)=>{const{onViewportChangeStart:I,onMoveStart:T}=C.getState();T==null||T($,F),I==null||I(F)},onPanZoom:($,F)=>{const{onViewportChange:I,onMove:T}=C.getState();T==null||T($,F),I==null||I(F)},onPanZoomEnd:($,F)=>{const{onViewportChangeEnd:I,onMoveEnd:T}=C.getState();T==null||T($,F),I==null||I(F)}});const{x:U,y:L,zoom:B}=_.current.getViewport();return C.setState({panZoom:_.current,transform:[U,L,B],domNode:S.current.closest(".react-flow")}),()=>{var $;($=_.current)==null||$.destroy()}}},[]),m.useEffect(()=>{var U;(U=_.current)==null||U.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:s,zoomOnDoubleClick:o,panOnDrag:a,zoomActivationKeyPressed:H,preventScrolling:h,noPanClassName:k,userSelectionActive:P,noWheelClassName:b,lib:R,onTransformChange:A,connectionInProgress:M,selectionOnDrag:N,paneClickDistance:w})},[e,t,n,r,i,s,o,a,H,h,k,P,b,R,A,M,N,w]),l.jsx("div",{className:"react-flow__renderer",ref:S,style:Fp,children:g})}const uF=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function dF(){const{userSelectionActive:e,userSelectionRect:t}=nt(uF,It);return e&&t?l.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 pm=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},fF=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function pF({isSelecting:e,selectionKeyPressed:t,selectionMode:n=$c.Full,panOnDrag:r,paneClickDistance:i,selectionOnDrag:s,onSelectionStart:o,onSelectionEnd:a,onPaneClick:c,onPaneContextMenu:u,onPaneScroll:p,onPaneMouseEnter:d,onPaneMouseMove:f,onPaneMouseLeave:h,children:g}){const b=At(),{userSelectionActive:k,elementsSelectable:y,dragging:v,connectionInProgress:w}=nt(fF,It),N=y&&(e||k),C=m.useRef(null),S=m.useRef(),P=m.useRef(new Set),R=m.useRef(new Set),M=m.useRef(!1),H=I=>{if(M.current||w){M.current=!1;return}c==null||c(I),b.getState().resetSelectedElements(),b.setState({nodesSelectionActive:!1})},_=I=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){I.preventDefault();return}u==null||u(I)},A=p?I=>p(I):void 0,U=I=>{M.current&&(I.stopPropagation(),M.current=!1)},L=I=>{var se,re;const{domNode:T}=b.getState();if(S.current=T==null?void 0:T.getBoundingClientRect(),!S.current)return;const E=I.target===C.current;if(!E&&!!I.target.closest(".nokey")||!e||!(s&&E||t)||I.button!==0||!I.isPrimary)return;(re=(se=I.target)==null?void 0:se.setPointerCapture)==null||re.call(se,I.pointerId),M.current=!1;const{x:O,y:X}=Or(I.nativeEvent,S.current);b.setState({userSelectionRect:{width:0,height:0,startX:O,startY:X,x:O,y:X}}),E||(I.stopPropagation(),I.preventDefault())},B=I=>{const{userSelectionRect:T,transform:E,nodeLookup:q,edgeLookup:W,connectionLookup:O,triggerNodeChanges:X,triggerEdgeChanges:se,defaultEdgeOptions:re,resetSelectedElements:de}=b.getState();if(!S.current||!T)return;const{x:ie,y:me}=Or(I.nativeEvent,S.current),{startX:ye,startY:ke}=T;if(!M.current){const He=t?0:i;if(Math.hypot(ie-ye,me-ke)<=He)return;de(),o==null||o(I)}M.current=!0;const he={startX:ye,startY:ke,x:ie<ye?ie:ye,y:me<ke?me:ke,width:Math.abs(ie-ye),height:Math.abs(me-ke)},Se=P.current,Ve=R.current;P.current=new Set(Tx(q,he,E,n===$c.Partial,!0).map(He=>He.id)),R.current=new Set;const We=(re==null?void 0:re.selectable)??!0;for(const He of P.current){const ut=O.get(He);if(ut)for(const{edgeId:Ge}of ut.values()){const De=W.get(Ge);De&&(De.selectable??We)&&R.current.add(Ge)}}if(!H0(Se,P.current)){const He=sa(q,P.current,!0);X(He)}if(!H0(Ve,R.current)){const He=sa(W,R.current);se(He)}b.setState({userSelectionRect:he,userSelectionActive:!0,nodesSelectionActive:!1})},$=I=>{var T,E;I.button===0&&((E=(T=I.target)==null?void 0:T.releasePointerCapture)==null||E.call(T,I.pointerId),!k&&I.target===C.current&&b.getState().userSelectionRect&&(H==null||H(I)),b.setState({userSelectionActive:!1,userSelectionRect:null}),M.current&&(a==null||a(I),b.setState({nodesSelectionActive:P.current.size>0})))},F=r===!0||Array.isArray(r)&&r.includes(0);return l.jsxs("div",{className:qt(["react-flow__pane",{draggable:F,dragging:v,selection:e}]),onClick:N?void 0:pm(H,C),onContextMenu:pm(_,C),onWheel:pm(A,C),onPointerEnter:N?void 0:d,onPointerMove:N?B:f,onPointerUp:N?$:void 0,onPointerDownCapture:N?L:void 0,onClickCapture:N?U:void 0,onPointerLeave:h,ref:C,style:Fp,children:[g,l.jsx(dF,{})]})}function ty({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:i,unselectNodesAndEdges:s,multiSelectionActive:o,nodeLookup:a,onError:c}=t.getState(),u=a.get(e);if(!u){c==null||c("012",mi.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 XC({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:s,nodeClickDistance:o}){const a=At(),[c,u]=m.useState(!1),p=m.useRef();return m.useEffect(()=>{p.current=HD({getStoreItems:()=>a.getState(),onNodeMouseDown:d=>{ty({id:d,store:a,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 d;(d=p.current)==null||d.destroy()}},[n,r,t,s,e,i,o]),c}const hF=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function JC(){const e=At();return m.useCallback(n=>{const{nodeExtent:r,snapToGrid:i,snapGrid:s,nodesDraggable:o,onError:a,updateNodePositions:c,nodeLookup:u,nodeOrigin:p}=e.getState(),d=new Map,f=hF(o),h=i?s[0]:5,g=i?s[1]:5,b=n.direction.x*h*n.factor,k=n.direction.y*g*n.factor;for(const[,y]of u){if(!f(y))continue;let v={x:y.internals.positionAbsolute.x+b,y:y.internals.positionAbsolute.y+k};i&&(v=cu(v,s));const{position:w,positionAbsolute:N}=fC({nodeId:y.id,nextPosition:v,nodeLookup:u,nodeExtent:r,nodeOrigin:p,onError:a});y.position=w,y.internals.positionAbsolute=N,d.set(y.id,y)}c(d)},[])}const Hx=m.createContext(null),mF=Hx.Provider;Hx.Consumer;const QC=()=>m.useContext(Hx),gF=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),yF=(e,t,n)=>r=>{const{connectionClickStartHandle:i,connectionMode:s,connection:o}=r,{fromHandle:a,toHandle:c,isValid:u}=o,p=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.id)===t&&(a==null?void 0:a.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===Ia.Strict?(a==null?void 0:a.type)!==n:e!==(a==null?void 0:a.nodeId)||t!==(a==null?void 0:a.id),connectionInProcess:!!a,clickConnectionInProcess:!!i,valid:p&&u}};function xF({type:e="source",position:t=Ie.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:s=!0,id:o,onConnect:a,children:c,className:u,onMouseDown:p,onTouchStart:d,...f},h){var B,$;const g=o||null,b=e==="target",k=At(),y=QC(),{connectOnClick:v,noPanClassName:w,rfId:N}=nt(gF,It),{connectingFrom:C,connectingTo:S,clickConnecting:P,isPossibleEndHandle:R,connectionInProcess:M,clickConnectionInProcess:H,valid:_}=nt(yF(y,g,e),It);y||($=(B=k.getState()).onError)==null||$.call(B,"010",mi.error010());const A=F=>{const{defaultEdgeOptions:I,onConnect:T,hasDefaultEdges:E}=k.getState(),q={...I,...F};if(E){const{edges:W,setEdges:O}=k.getState();O(Ox(q,W))}T==null||T(q),a==null||a(q)},U=F=>{if(!y)return;const I=vC(F.nativeEvent);if(i&&(I&&F.button===0||!I)){const T=k.getState();Zg.onPointerDown(F.nativeEvent,{handleDomNode:F.currentTarget,autoPanOnConnect:T.autoPanOnConnect,connectionMode:T.connectionMode,connectionRadius:T.connectionRadius,domNode:T.domNode,nodeLookup:T.nodeLookup,lib:T.lib,isTarget:b,handleId:g,nodeId:y,flowId:T.rfId,panBy:T.panBy,cancelConnection:T.cancelConnection,onConnectStart:T.onConnectStart,onConnectEnd:(...E)=>{var q,W;return(W=(q=k.getState()).onConnectEnd)==null?void 0:W.call(q,...E)},updateConnection:T.updateConnection,onConnect:A,isValidConnection:n||((...E)=>{var q,W;return((W=(q=k.getState()).isValidConnection)==null?void 0:W.call(q,...E))??!0}),getTransform:()=>k.getState().transform,getFromHandle:()=>k.getState().connection.fromHandle,autoPanSpeed:T.autoPanSpeed,dragThreshold:T.connectionDragThreshold})}I?p==null||p(F):d==null||d(F)},L=F=>{const{onClickConnectStart:I,onClickConnectEnd:T,connectionClickStartHandle:E,connectionMode:q,isValidConnection:W,lib:O,rfId:X,nodeLookup:se,connection:re}=k.getState();if(!y||!E&&!i)return;if(!E){I==null||I(F.nativeEvent,{nodeId:y,handleId:g,handleType:e}),k.setState({connectionClickStartHandle:{nodeId:y,type:e,id:g}});return}const de=xC(F.target),ie=n||W,{connection:me,isValid:ye}=Zg.isValid(F.nativeEvent,{handle:{nodeId:y,id:g,type:e},connectionMode:q,fromNodeId:E.nodeId,fromHandleId:E.id||null,fromType:E.type,isValidConnection:ie,flowId:X,doc:de,lib:O,nodeLookup:se});ye&&me&&A(me);const ke=structuredClone(re);delete ke.inProgress,ke.toPosition=ke.toHandle?ke.toHandle.position:null,T==null||T(F,ke),k.setState({connectionClickStartHandle:null})};return l.jsx("div",{"data-handleid":g,"data-nodeid":y,"data-handlepos":t,"data-id":`${N}-${y}-${g}-${e}`,className:qt(["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:S,valid:_,connectionindicator:r&&(!M||R)&&(M||H?s:i)}]),onMouseDown:U,onTouchStart:U,onClick:v?L:void 0,ref:h,...f,children:c})}const js=m.memo(qC(xF));function wF({data:e,isConnectable:t,sourcePosition:n=Ie.Bottom}){return l.jsxs(l.Fragment,{children:[e==null?void 0:e.label,l.jsx(js,{type:"source",position:n,isConnectable:t})]})}function vF({data:e,isConnectable:t,targetPosition:n=Ie.Top,sourcePosition:r=Ie.Bottom}){return l.jsxs(l.Fragment,{children:[l.jsx(js,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,l.jsx(js,{type:"source",position:r,isConnectable:t})]})}function bF(){return null}function kF({data:e,isConnectable:t,targetPosition:n=Ie.Top}){return l.jsxs(l.Fragment,{children:[l.jsx(js,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const qf={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},hb={input:wF,default:vF,output:kF,group:bF};function SF(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 NF=e=>{const{width:t,height:n,x:r,y:i}=lu(e.nodeLookup,{filter:s=>!!s.selected});return{width:Lr(t)?t:null,height:Lr(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 jF({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=At(),{width:i,height:s,transformString:o,userSelectionActive:a}=nt(NF,It),c=JC(),u=m.useRef(null);m.useEffect(()=>{var h;n||(h=u.current)==null||h.focus({preventScroll:!0})},[n]);const p=!a&&i!==null&&s!==null;if(XC({nodeRef:u,disabled:!p}),!p)return null;const d=e?h=>{const g=r.getState().nodes.filter(b=>b.selected);e(h,g)}:void 0,f=h=>{Object.prototype.hasOwnProperty.call(qf,h.key)&&(h.preventDefault(),c({direction:qf[h.key],factor:h.shiftKey?4:1}))};return l.jsx("div",{className:qt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:o},children:l.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:f,style:{width:i,height:s}})})}const mb=typeof window<"u"?window:void 0,CF=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function ZC({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:s,onPaneScroll:o,paneClickDistance:a,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:p,selectionMode:d,onSelectionStart:f,onSelectionEnd:h,multiSelectionKeyCode:g,panActivationKeyCode:b,zoomActivationKeyCode:k,elementsSelectable:y,zoomOnScroll:v,zoomOnPinch:w,panOnScroll:N,panOnScrollSpeed:C,panOnScrollMode:S,zoomOnDoubleClick:P,panOnDrag:R,defaultViewport:M,translateExtent:H,minZoom:_,maxZoom:A,preventScrolling:U,onSelectionContextMenu:L,noWheelClassName:B,noPanClassName:$,disableKeyboardA11y:F,onViewportChange:I,isControlledViewport:T}){const{nodesSelectionActive:E,userSelectionActive:q}=nt(CF,It),W=Bc(u,{target:mb}),O=Bc(b,{target:mb}),X=O||R,se=O||N,re=p&&X!==!0,de=W||q||re;return oF({deleteKeyCode:c,multiSelectionKeyCode:g}),l.jsx(cF,{onPaneContextMenu:s,elementsSelectable:y,zoomOnScroll:v,zoomOnPinch:w,panOnScroll:se,panOnScrollSpeed:C,panOnScrollMode:S,zoomOnDoubleClick:P,panOnDrag:!W&&X,defaultViewport:M,translateExtent:H,minZoom:_,maxZoom:A,zoomActivationKeyCode:k,preventScrolling:U,noWheelClassName:B,noPanClassName:$,onViewportChange:I,isControlledViewport:T,paneClickDistance:a,selectionOnDrag:re,children:l.jsxs(pF,{onSelectionStart:f,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:s,onPaneScroll:o,panOnDrag:X,isSelecting:!!de,selectionMode:d,selectionKeyPressed:W,paneClickDistance:a,selectionOnDrag:re,children:[e,E&&l.jsx(jF,{onSelectionContextMenu:L,noPanClassName:$,disableKeyboardA11y:F})]})})}ZC.displayName="FlowRenderer";const EF=m.memo(ZC),PF=e=>t=>e?Tx(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 _F(e){return nt(m.useCallback(PF(e),[e]),It)}const IF=e=>e.updateNodeInternals;function AF(){const e=nt(IF),[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 TF({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const i=At(),s=m.useRef(null),o=m.useRef(null),a=m.useRef(e.sourcePosition),c=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 d=u.current!==t,f=a.current!==e.sourcePosition,h=c.current!==e.targetPosition;(d||f||h)&&(u.current=t,a.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:s.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),s}function RF({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:s,onDoubleClick:o,nodesDraggable:a,elementsSelectable:c,nodesConnectable:u,nodesFocusable:p,resizeObserver:d,noDragClassName:f,noPanClassName:h,disableKeyboardA11y:g,rfId:b,nodeTypes:k,nodeClickDistance:y,onError:v}){const{node:w,internals:N,isParent:C}=nt(ie=>{const me=ie.nodeLookup.get(e),ye=ie.parentLookup.has(e);return{node:me,internals:me.internals,isParent:ye}},It);let S=w.type||"default",P=(k==null?void 0:k[S])||hb[S];P===void 0&&(v==null||v("003",mi.error003(S)),S="default",P=(k==null?void 0:k.default)||hb.default);const R=!!(w.draggable||a&&typeof w.draggable>"u"),M=!!(w.selectable||c&&typeof w.selectable>"u"),H=!!(w.connectable||u&&typeof w.connectable>"u"),_=!!(w.focusable||p&&typeof w.focusable>"u"),A=At(),U=gC(w),L=TF({node:w,nodeType:S,hasDimensions:U,resizeObserver:d}),B=XC({nodeRef:L,disabled:w.hidden||!R,noDragClassName:f,handleSelector:w.dragHandle,nodeId:e,isSelectable:M,nodeClickDistance:y}),$=JC();if(w.hidden)return null;const F=Ui(w),I=SF(w),T=M||R||t||n||r||i,E=n?ie=>n(ie,{...N.userNode}):void 0,q=r?ie=>r(ie,{...N.userNode}):void 0,W=i?ie=>i(ie,{...N.userNode}):void 0,O=s?ie=>s(ie,{...N.userNode}):void 0,X=o?ie=>o(ie,{...N.userNode}):void 0,se=ie=>{const{selectNodesOnDrag:me,nodeDragThreshold:ye}=A.getState();M&&(!me||!R||ye>0)&&ty({id:e,store:A,nodeRef:L}),t&&t(ie,{...N.userNode})},re=ie=>{if(!(wC(ie.nativeEvent)||g)){if(aC.includes(ie.key)&&M){const me=ie.key==="Escape";ty({id:e,store:A,unselect:me,nodeRef:L})}else if(R&&w.selected&&Object.prototype.hasOwnProperty.call(qf,ie.key)){ie.preventDefault();const{ariaLabelConfig:me}=A.getState();A.setState({ariaLiveMessage:me["node.a11yDescription.ariaLiveMessage"]({direction:ie.key.replace("Arrow","").toLowerCase(),x:~~N.positionAbsolute.x,y:~~N.positionAbsolute.y})}),$({direction:qf[ie.key],factor:ie.shiftKey?4:1})}}},de=()=>{var Ve;if(g||!((Ve=L.current)!=null&&Ve.matches(":focus-visible")))return;const{transform:ie,width:me,height:ye,autoPanOnNodeFocus:ke,setCenter:he}=A.getState();if(!ke)return;Tx(new Map([[e,w]]),{x:0,y:0,width:me,height:ye},ie,!0).length>0||he(w.position.x+F.width/2,w.position.y+F.height/2,{zoom:ie[2]})};return l.jsx("div",{className:qt(["react-flow__node",`react-flow__node-${S}`,{[h]:R},w.className,{selected:w.selected,selectable:M,parent:C,draggable:R,dragging:B}]),ref:L,style:{zIndex:N.z,transform:`translate(${N.positionAbsolute.x}px,${N.positionAbsolute.y}px)`,pointerEvents:T?"all":"none",visibility:U?"visible":"hidden",...w.style,...I},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:E,onMouseMove:q,onMouseLeave:W,onContextMenu:O,onClick:se,onDoubleClick:X,onKeyDown:_?re:void 0,tabIndex:_?0:void 0,onFocus:_?de:void 0,role:w.ariaRole??(_?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${UC}-${b}`,"aria-label":w.ariaLabel,...w.domAttributes,children:l.jsx(mF,{value:e,children:l.jsx(P,{id:e,data:w.data,type:S,positionAbsoluteX:N.positionAbsolute.x,positionAbsoluteY:N.positionAbsolute.y,selected:w.selected??!1,selectable:M,draggable:R,deletable:w.deletable??!0,isConnectable:H,sourcePosition:w.sourcePosition,targetPosition:w.targetPosition,dragging:B,dragHandle:w.dragHandle,zIndex:N.z,parentId:w.parentId,...F})})})}var LF=m.memo(RF);const OF=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function eE(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,onError:s}=nt(OF,It),o=_F(e.onlyRenderVisibleElements),a=AF();return l.jsx("div",{className:"react-flow__nodes",style:Fp,children:o.map(c=>l.jsx(LF,{id:c,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:a,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,nodeClickDistance:e.nodeClickDistance,onError:s},c))})}eE.displayName="NodeRenderer";const MF=m.memo(eE);function DF(e){return nt(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&&ND({sourceNode:s,targetNode:o,width:n.width,height:n.height,transform:n.transform})&&r.push(i.id)}return r},[e]),It)}const $F=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return l.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},FF=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return l.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},gb={[Fr.Arrow]:$F,[Fr.ArrowClosed]:FF};function zF(e){const t=At();return m.useMemo(()=>{var i,s;return Object.prototype.hasOwnProperty.call(gb,e)?gb[e]:((s=(i=t.getState()).onError)==null||s.call(i,"009",mi.error009(e)),null)},[e])}const BF=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:s="strokeWidth",strokeWidth:o,orient:a="auto-start-reverse"})=>{const c=zF(t);return c?l.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:a,refX:"0",refY:"0",children:l.jsx(c,{color:n,strokeWidth:o})}):null},tE=({defaultColor:e,rfId:t})=>{const n=nt(s=>s.edges),r=nt(s=>s.defaultEdgeOptions),i=m.useMemo(()=>AD(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?l.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:l.jsx("defs",{children:i.map(s=>l.jsx(BF,{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};tE.displayName="MarkerDefinitions";var HF=m.memo(tE);function nE({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:s,labelBgPadding:o=[2,4],labelBgBorderRadius:a=2,children:c,className:u,...p}){const[d,f]=m.useState({x:1,y:0,width:0,height:0}),h=qt(["react-flow__edge-textwrapper",u]),g=m.useRef(null);return m.useEffect(()=>{if(g.current){const b=g.current.getBBox();f({x:b.x,y:b.y,width:b.width,height:b.height})}},[n]),n?l.jsxs("g",{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:h,visibility:d.width?"visible":"hidden",...p,children:[i&&l.jsx("rect",{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:"react-flow__edge-textbg",style:s,rx:a,ry:a}),l.jsx("text",{className:"react-flow__edge-text",y:d.height/2,dy:"0.3em",ref:g,style:r,children:n}),c]}):null}nE.displayName="EdgeText";const UF=m.memo(nE);function zp({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:s,labelBgStyle:o,labelBgPadding:a,labelBgBorderRadius:c,interactionWidth:u=20,...p}){return l.jsxs(l.Fragment,{children:[l.jsx("path",{...p,d:e,fill:"none",className:qt(["react-flow__edge-path",p.className])}),u?l.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,r&&Lr(t)&&Lr(n)?l.jsx(UF,{x:t,y:n,label:r,labelStyle:i,labelShowBg:s,labelBgStyle:o,labelBgPadding:a,labelBgBorderRadius:c}):null]})}function yb({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===Ie.Left||e===Ie.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function rE({sourceX:e,sourceY:t,sourcePosition:n=Ie.Bottom,targetX:r,targetY:i,targetPosition:s=Ie.Top}){const[o,a]=yb({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,u]=yb({pos:s,x1:r,y1:i,x2:e,y2:t}),[p,d,f,h]=bC({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:a,targetControlX:c,targetControlY:u});return[`M${e},${t} C${o},${a} ${c},${u} ${r},${i}`,p,d,f,h]}function iE(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,sourcePosition:o,targetPosition:a,label:c,labelStyle:u,labelShowBg:p,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:h,style:g,markerEnd:b,markerStart:k,interactionWidth:y})=>{const[v,w,N]=rE({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:s,targetPosition:a}),C=e.isInternal?void 0:t;return l.jsx(zp,{id:C,path:v,labelX:w,labelY:N,label:c,labelStyle:u,labelShowBg:p,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:h,style:g,markerEnd:b,markerStart:k,interactionWidth:y})})}const VF=iE({isInternal:!1}),sE=iE({isInternal:!0});VF.displayName="SimpleBezierEdge";sE.displayName="SimpleBezierEdgeInternal";function oE(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,label:o,labelStyle:a,labelShowBg:c,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:d,style:f,sourcePosition:h=Ie.Bottom,targetPosition:g=Ie.Top,markerEnd:b,markerStart:k,pathOptions:y,interactionWidth:v})=>{const[w,N,C]=Xg({sourceX:n,sourceY:r,sourcePosition:h,targetX:i,targetY:s,targetPosition:g,borderRadius:y==null?void 0:y.borderRadius,offset:y==null?void 0:y.offset,stepPosition:y==null?void 0:y.stepPosition}),S=e.isInternal?void 0:t;return l.jsx(zp,{id:S,path:w,labelX:N,labelY:C,label:o,labelStyle:a,labelShowBg:c,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:d,style:f,markerEnd:b,markerStart:k,interactionWidth:v})})}const aE=oE({isInternal:!1}),lE=oE({isInternal:!0});aE.displayName="SmoothStepEdge";lE.displayName="SmoothStepEdgeInternal";function cE(e){return m.memo(({id:t,...n})=>{var i;const r=e.isInternal?void 0:t;return l.jsx(aE,{...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 WF=cE({isInternal:!1}),uE=cE({isInternal:!0});WF.displayName="StepEdge";uE.displayName="StepEdgeInternal";function dE(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,label:o,labelStyle:a,labelShowBg:c,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:b})=>{const[k,y,v]=NC({sourceX:n,sourceY:r,targetX:i,targetY:s}),w=e.isInternal?void 0:t;return l.jsx(zp,{id:w,path:k,labelX:y,labelY:v,label:o,labelStyle:a,labelShowBg:c,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:b})})}const KF=dE({isInternal:!1}),fE=dE({isInternal:!0});KF.displayName="StraightEdge";fE.displayName="StraightEdgeInternal";function pE(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,sourcePosition:o=Ie.Bottom,targetPosition:a=Ie.Top,label:c,labelStyle:u,labelShowBg:p,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:h,style:g,markerEnd:b,markerStart:k,pathOptions:y,interactionWidth:v})=>{const[w,N,C]=kC({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:s,targetPosition:a,curvature:y==null?void 0:y.curvature}),S=e.isInternal?void 0:t;return l.jsx(zp,{id:S,path:w,labelX:N,labelY:C,label:c,labelStyle:u,labelShowBg:p,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:h,style:g,markerEnd:b,markerStart:k,interactionWidth:v})})}const YF=pE({isInternal:!1}),hE=pE({isInternal:!0});YF.displayName="BezierEdge";hE.displayName="BezierEdgeInternal";const xb={default:hE,straight:fE,step:uE,smoothstep:lE,simplebezier:sE},wb={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},qF=(e,t,n)=>n===Ie.Left?e-t:n===Ie.Right?e+t:e,GF=(e,t,n)=>n===Ie.Top?e-t:n===Ie.Bottom?e+t:e,vb="react-flow__edgeupdater";function bb({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:s,onMouseOut:o,type:a}){return l.jsx("circle",{onMouseDown:i,onMouseEnter:s,onMouseOut:o,className:qt([vb,`${vb}-${a}`]),cx:qF(t,r,e),cy:GF(n,r,e),r,stroke:"transparent",fill:"transparent"})}function XF({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:s,targetY:o,sourcePosition:a,targetPosition:c,onReconnect:u,onReconnectStart:p,onReconnectEnd:d,setReconnecting:f,setUpdateHover:h}){const g=At(),b=(N,C)=>{if(N.button!==0)return;const{autoPanOnConnect:S,domNode:P,connectionMode:R,connectionRadius:M,lib:H,onConnectStart:_,cancelConnection:A,nodeLookup:U,rfId:L,panBy:B,updateConnection:$}=g.getState(),F=C.type==="target",I=(q,W)=>{f(!1),d==null||d(q,n,C.type,W)},T=q=>u==null?void 0:u(n,q),E=(q,W)=>{f(!0),p==null||p(N,n,C.type),_==null||_(q,W)};Zg.onPointerDown(N.nativeEvent,{autoPanOnConnect:S,connectionMode:R,connectionRadius:M,domNode:P,handleId:C.id,nodeId:C.nodeId,nodeLookup:U,isTarget:F,edgeUpdaterType:C.type,lib:H,flowId:L,cancelConnection:A,panBy:B,isValidConnection:(...q)=>{var W,O;return((O=(W=g.getState()).isValidConnection)==null?void 0:O.call(W,...q))??!0},onConnect:T,onConnectStart:E,onConnectEnd:(...q)=>{var W,O;return(O=(W=g.getState()).onConnectEnd)==null?void 0:O.call(W,...q)},onReconnectEnd:I,updateConnection:$,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:N.currentTarget})},k=N=>b(N,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),y=N=>b(N,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),v=()=>h(!0),w=()=>h(!1);return l.jsxs(l.Fragment,{children:[(e===!0||e==="source")&&l.jsx(bb,{position:a,centerX:r,centerY:i,radius:t,onMouseDown:k,onMouseEnter:v,onMouseOut:w,type:"source"}),(e===!0||e==="target")&&l.jsx(bb,{position:c,centerX:s,centerY:o,radius:t,onMouseDown:y,onMouseEnter:v,onMouseOut:w,type:"target"})]})}function JF({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:s,onContextMenu:o,onMouseEnter:a,onMouseMove:c,onMouseLeave:u,reconnectRadius:p,onReconnect:d,onReconnectStart:f,onReconnectEnd:h,rfId:g,edgeTypes:b,noPanClassName:k,onError:y,disableKeyboardA11y:v}){let w=nt(he=>he.edgeLookup.get(e));const N=nt(he=>he.defaultEdgeOptions);w=N?{...N,...w}:w;let C=w.type||"default",S=(b==null?void 0:b[C])||xb[C];S===void 0&&(y==null||y("011",mi.error011(C)),C="default",S=(b==null?void 0:b.default)||xb.default);const P=!!(w.focusable||t&&typeof w.focusable>"u"),R=typeof d<"u"&&(w.reconnectable||n&&typeof w.reconnectable>"u"),M=!!(w.selectable||r&&typeof w.selectable>"u"),H=m.useRef(null),[_,A]=m.useState(!1),[U,L]=m.useState(!1),B=At(),{zIndex:$,sourceX:F,sourceY:I,targetX:T,targetY:E,sourcePosition:q,targetPosition:W}=nt(m.useCallback(he=>{const Se=he.nodeLookup.get(w.source),Ve=he.nodeLookup.get(w.target);if(!Se||!Ve)return{zIndex:w.zIndex,...wb};const We=ID({id:e,sourceNode:Se,targetNode:Ve,sourceHandle:w.sourceHandle||null,targetHandle:w.targetHandle||null,connectionMode:he.connectionMode,onError:y});return{zIndex:SD({selected:w.selected,zIndex:w.zIndex,sourceNode:Se,targetNode:Ve,elevateOnSelect:he.elevateEdgesOnSelect,zIndexMode:he.zIndexMode}),...We||wb}},[w.source,w.target,w.sourceHandle,w.targetHandle,w.selected,w.zIndex]),It),O=m.useMemo(()=>w.markerStart?`url('#${Jg(w.markerStart,g)}')`:void 0,[w.markerStart,g]),X=m.useMemo(()=>w.markerEnd?`url('#${Jg(w.markerEnd,g)}')`:void 0,[w.markerEnd,g]);if(w.hidden||F===null||I===null||T===null||E===null)return null;const se=he=>{var He;const{addSelectedEdges:Se,unselectNodesAndEdges:Ve,multiSelectionActive:We}=B.getState();M&&(B.setState({nodesSelectionActive:!1}),w.selected&&We?(Ve({nodes:[],edges:[w]}),(He=H.current)==null||He.blur()):Se([e])),i&&i(he,w)},re=s?he=>{s(he,{...w})}:void 0,de=o?he=>{o(he,{...w})}:void 0,ie=a?he=>{a(he,{...w})}:void 0,me=c?he=>{c(he,{...w})}:void 0,ye=u?he=>{u(he,{...w})}:void 0,ke=he=>{var Se;if(!v&&aC.includes(he.key)&&M){const{unselectNodesAndEdges:Ve,addSelectedEdges:We}=B.getState();he.key==="Escape"?((Se=H.current)==null||Se.blur(),Ve({edges:[w]})):We([e])}};return l.jsx("svg",{style:{zIndex:$},children:l.jsxs("g",{className:qt(["react-flow__edge",`react-flow__edge-${C}`,w.className,k,{selected:w.selected,animated:w.animated,inactive:!M&&!i,updating:_,selectable:M}]),onClick:se,onDoubleClick:re,onContextMenu:de,onMouseEnter:ie,onMouseMove:me,onMouseLeave:ye,onKeyDown:P?ke: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?`${VC}-${g}`:void 0,ref:H,...w.domAttributes,children:[!U&&l.jsx(S,{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:F,sourceY:I,targetX:T,targetY:E,sourcePosition:q,targetPosition:W,data:w.data,style:w.style,sourceHandleId:w.sourceHandle,targetHandleId:w.targetHandle,markerStart:O,markerEnd:X,pathOptions:"pathOptions"in w?w.pathOptions:void 0,interactionWidth:w.interactionWidth}),R&&l.jsx(XF,{edge:w,isReconnectable:R,reconnectRadius:p,onReconnect:d,onReconnectStart:f,onReconnectEnd:h,sourceX:F,sourceY:I,targetX:T,targetY:E,sourcePosition:q,targetPosition:W,setUpdateHover:A,setReconnecting:L})]})})}var QF=m.memo(JF);const ZF=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function mE({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:s,onEdgeContextMenu:o,onEdgeMouseEnter:a,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:p,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:h,onReconnectEnd:g,disableKeyboardA11y:b}){const{edgesFocusable:k,edgesReconnectable:y,elementsSelectable:v,onError:w}=nt(ZF,It),N=DF(t);return l.jsxs("div",{className:"react-flow__edges",children:[l.jsx(HF,{defaultColor:e,rfId:n}),N.map(C=>l.jsx(QF,{id:C,edgesFocusable:k,edgesReconnectable:y,elementsSelectable:v,noPanClassName:i,onReconnect:s,onContextMenu:o,onMouseEnter:a,onMouseMove:c,onMouseLeave:u,onClick:p,reconnectRadius:d,onDoubleClick:f,onReconnectStart:h,onReconnectEnd:g,rfId:n,onError:w,edgeTypes:r,disableKeyboardA11y:b},C))]})}mE.displayName="EdgeRenderer";const e3=m.memo(mE),t3=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function n3({children:e}){const t=nt(t3);return l.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function r3(e){const t=So(),n=m.useRef(!1);m.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const i3=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function s3(e){const t=nt(i3),n=At();return m.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function o3(e){return e.connection.inProgress?{...e.connection,to:uu(e.connection.to,e.transform)}:{...e.connection}}function a3(e){return o3}function l3(e){const t=a3();return nt(t,It)}const c3=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function u3({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:i,width:s,height:o,isValid:a,inProgress:c}=nt(c3,It);return!(s&&i&&c)?null:l.jsx("svg",{style:e,width:s,height:o,className:"react-flow__connectionline react-flow__container",children:l.jsx("g",{className:qt(["react-flow__connection",uC(a)]),children:l.jsx(gE,{style:t,type:n,CustomComponent:r,isValid:a})})})}const gE=({style:e,type:t=ls.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:i,from:s,fromNode:o,fromHandle:a,fromPosition:c,to:u,toNode:p,toHandle:d,toPosition:f,pointer:h}=l3();if(!i)return;if(n)return l.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:a,fromX:s.x,fromY:s.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:f,connectionStatus:uC(r),toNode:p,toHandle:d,pointer:h});let g="";const b={sourceX:s.x,sourceY:s.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:f};switch(t){case ls.Bezier:[g]=kC(b);break;case ls.SimpleBezier:[g]=rE(b);break;case ls.Step:[g]=Xg({...b,borderRadius:0});break;case ls.SmoothStep:[g]=Xg(b);break;default:[g]=NC(b)}return l.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};gE.displayName="ConnectionLine";const d3={};function kb(e=d3){m.useRef(e),At(),m.useEffect(()=>{},[e])}function f3(){At(),m.useRef(!1),m.useEffect(()=>{},[])}function yE({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:s,onEdgeDoubleClick:o,onNodeMouseEnter:a,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:p,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:h,connectionLineType:g,connectionLineStyle:b,connectionLineComponent:k,connectionLineContainerStyle:y,selectionKeyCode:v,selectionOnDrag:w,selectionMode:N,multiSelectionKeyCode:C,panActivationKeyCode:S,zoomActivationKeyCode:P,deleteKeyCode:R,onlyRenderVisibleElements:M,elementsSelectable:H,defaultViewport:_,translateExtent:A,minZoom:U,maxZoom:L,preventScrolling:B,defaultMarkerColor:$,zoomOnScroll:F,zoomOnPinch:I,panOnScroll:T,panOnScrollSpeed:E,panOnScrollMode:q,zoomOnDoubleClick:W,panOnDrag:O,onPaneClick:X,onPaneMouseEnter:se,onPaneMouseMove:re,onPaneMouseLeave:de,onPaneScroll:ie,onPaneContextMenu:me,paneClickDistance:ye,nodeClickDistance:ke,onEdgeContextMenu:he,onEdgeMouseEnter:Se,onEdgeMouseMove:Ve,onEdgeMouseLeave:We,reconnectRadius:He,onReconnect:ut,onReconnectStart:Ge,onReconnectEnd:De,noDragClassName:kt,noWheelClassName:Ut,noPanClassName:Ct,disableKeyboardA11y:sn,nodeExtent:pn,rfId:on,viewport:Z,onViewportChange:oe}){return kb(e),kb(t),f3(),r3(n),s3(Z),l.jsx(EF,{onPaneClick:X,onPaneMouseEnter:se,onPaneMouseMove:re,onPaneMouseLeave:de,onPaneContextMenu:me,onPaneScroll:ie,paneClickDistance:ye,deleteKeyCode:R,selectionKeyCode:v,selectionOnDrag:w,selectionMode:N,onSelectionStart:f,onSelectionEnd:h,multiSelectionKeyCode:C,panActivationKeyCode:S,zoomActivationKeyCode:P,elementsSelectable:H,zoomOnScroll:F,zoomOnPinch:I,zoomOnDoubleClick:W,panOnScroll:T,panOnScrollSpeed:E,panOnScrollMode:q,panOnDrag:O,defaultViewport:_,translateExtent:A,minZoom:U,maxZoom:L,onSelectionContextMenu:d,preventScrolling:B,noDragClassName:kt,noWheelClassName:Ut,noPanClassName:Ct,disableKeyboardA11y:sn,onViewportChange:oe,isControlledViewport:!!Z,children:l.jsxs(n3,{children:[l.jsx(e3,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:ut,onReconnectStart:Ge,onReconnectEnd:De,onlyRenderVisibleElements:M,onEdgeContextMenu:he,onEdgeMouseEnter:Se,onEdgeMouseMove:Ve,onEdgeMouseLeave:We,reconnectRadius:He,defaultMarkerColor:$,noPanClassName:Ct,disableKeyboardA11y:sn,rfId:on}),l.jsx(u3,{style:b,type:g,component:k,containerStyle:y}),l.jsx("div",{className:"react-flow__edgelabel-renderer"}),l.jsx(MF,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:s,onNodeMouseEnter:a,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:p,nodeClickDistance:ke,onlyRenderVisibleElements:M,noPanClassName:Ct,noDragClassName:kt,disableKeyboardA11y:sn,nodeExtent:pn,rfId:on}),l.jsx("div",{className:"react-flow__viewport-portal"})]})})}yE.displayName="GraphView";const p3=m.memo(yE),Sb=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:o,fitViewOptions:a,minZoom:c=.5,maxZoom:u=2,nodeOrigin:p,nodeExtent:d,zIndexMode:f="basic"}={})=>{const h=new Map,g=new Map,b=new Map,k=new Map,y=r??t??[],v=n??e??[],w=p??[0,0],N=d??Dc;EC(b,k,y);const{nodesInitialized:C}=Qg(v,h,g,{nodeOrigin:w,nodeExtent:N,zIndexMode:f});let S=[0,0,1];if(o&&i&&s){const P=lu(h,{filter:_=>!!((_.width||_.initialWidth)&&(_.height||_.initialHeight))}),{x:R,y:M,zoom:H}=Rx(P,i,s,c,u,(a==null?void 0:a.padding)??.1);S=[R,M,H]}return{rfId:"1",width:i??0,height:s??0,transform:S,nodes:v,nodesInitialized:C,nodeLookup:h,parentLookup:g,edges:y,edgeLookup:k,connectionLookup:b,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:Dc,nodeExtent:N,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Ia.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:a,fitViewResolver:null,connection:{...cC},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:yD,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:lC,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},h3=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:o,fitViewOptions:a,minZoom:c,maxZoom:u,nodeOrigin:p,nodeExtent:d,zIndexMode:f})=>R$((h,g)=>{async function b(){const{nodeLookup:k,panZoom:y,fitViewOptions:v,fitViewResolver:w,width:N,height:C,minZoom:S,maxZoom:P}=g();y&&(await mD({nodes:k,width:N,height:C,panZoom:y,minZoom:S,maxZoom:P},v),w==null||w.resolve(!0),h({fitViewResolver:null}))}return{...Sb({nodes:e,edges:t,width:i,height:s,fitView:o,fitViewOptions:a,minZoom:c,maxZoom:u,nodeOrigin:p,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:k=>{const{nodeLookup:y,parentLookup:v,nodeOrigin:w,elevateNodesOnSelect:N,fitViewQueued:C,zIndexMode:S,nodesSelectionActive:P}=g(),{nodesInitialized:R,hasSelectedNodes:M}=Qg(k,y,v,{nodeOrigin:w,nodeExtent:d,elevateNodesOnSelect:N,checkEquality:!0,zIndexMode:S}),H=P&&M;C&&R?(b(),h({nodes:k,nodesInitialized:R,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:H})):h({nodes:k,nodesInitialized:R,nodesSelectionActive:H})},setEdges:k=>{const{connectionLookup:y,edgeLookup:v}=g();EC(y,v,k),h({edges:k})},setDefaultNodesAndEdges:(k,y)=>{if(k){const{setNodes:v}=g();v(k),h({hasDefaultNodes:!0})}if(y){const{setEdges:v}=g();v(y),h({hasDefaultEdges:!0})}},updateNodeInternals:k=>{const{triggerNodeChanges:y,nodeLookup:v,parentLookup:w,domNode:N,nodeOrigin:C,nodeExtent:S,debug:P,fitViewQueued:R,zIndexMode:M}=g(),{changes:H,updatedInternals:_}=$D(k,v,w,N,C,S,M);_&&(LD(v,w,{nodeOrigin:C,nodeExtent:S,zIndexMode:M}),R?(b(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),(H==null?void 0:H.length)>0&&(P&&console.log("React Flow: trigger node changes",H),y==null||y(H)))},updateNodePositions:(k,y=!1)=>{const v=[];let w=[];const{nodeLookup:N,triggerNodeChanges:C,connection:S,updateConnection:P,onNodesChangeMiddlewareMap:R}=g();for(const[M,H]of k){const _=N.get(M),A=!!(_!=null&&_.expandParent&&(_!=null&&_.parentId)&&(H!=null&&H.position)),U={id:M,type:"position",position:A?{x:Math.max(0,H.position.x),y:Math.max(0,H.position.y)}:H.position,dragging:y};if(_&&S.inProgress&&S.fromNode.id===_.id){const L=yo(_,S.fromHandle,Ie.Left,!0);P({...S,from:L})}A&&_.parentId&&v.push({id:M,parentId:_.parentId,rect:{...H.internals.positionAbsolute,width:H.measured.width??0,height:H.measured.height??0}}),w.push(U)}if(v.length>0){const{parentLookup:M,nodeOrigin:H}=g(),_=zx(v,N,M,H);w.push(..._)}for(const M of R.values())w=M(w);C(w)},triggerNodeChanges:k=>{const{onNodesChange:y,setNodes:v,nodes:w,hasDefaultNodes:N,debug:C}=g();if(k!=null&&k.length){if(N){const S=Bx(k,w);v(S)}C&&console.log("React Flow: trigger node changes",k),y==null||y(k)}},triggerEdgeChanges:k=>{const{onEdgesChange:y,setEdges:v,edges:w,hasDefaultEdges:N,debug:C}=g();if(k!=null&&k.length){if(N){const S=YC(k,w);v(S)}C&&console.log("React Flow: trigger edge changes",k),y==null||y(k)}},addSelectedNodes:k=>{const{multiSelectionActive:y,edgeLookup:v,nodeLookup:w,triggerNodeChanges:N,triggerEdgeChanges:C}=g();if(y){const S=k.map(P=>Xs(P,!0));N(S);return}N(sa(w,new Set([...k]),!0)),C(sa(v))},addSelectedEdges:k=>{const{multiSelectionActive:y,edgeLookup:v,nodeLookup:w,triggerNodeChanges:N,triggerEdgeChanges:C}=g();if(y){const S=k.map(P=>Xs(P,!0));C(S);return}C(sa(v,new Set([...k]))),N(sa(w,new Set,!0))},unselectNodesAndEdges:({nodes:k,edges:y}={})=>{const{edges:v,nodes:w,nodeLookup:N,triggerNodeChanges:C,triggerEdgeChanges:S}=g(),P=k||w,R=y||v,M=[];for(const _ of P){if(!_.selected)continue;const A=N.get(_.id);A&&(A.selected=!1),M.push(Xs(_.id,!1))}const H=[];for(const _ of R)_.selected&&H.push(Xs(_.id,!1));C(M),S(H)},setMinZoom:k=>{const{panZoom:y,maxZoom:v}=g();y==null||y.setScaleExtent([k,v]),h({minZoom:k})},setMaxZoom:k=>{const{panZoom:y,minZoom:v}=g();y==null||y.setScaleExtent([v,k]),h({maxZoom:k})},setTranslateExtent:k=>{var y;(y=g().panZoom)==null||y.setTranslateExtent(k),h({translateExtent:k})},resetSelectedElements:()=>{const{edges:k,nodes:y,triggerNodeChanges:v,triggerEdgeChanges:w,elementsSelectable:N}=g();if(!N)return;const C=y.reduce((P,R)=>R.selected?[...P,Xs(R.id,!1)]:P,[]),S=k.reduce((P,R)=>R.selected?[...P,Xs(R.id,!1)]:P,[]);v(C),w(S)},setNodeExtent:k=>{const{nodes:y,nodeLookup:v,parentLookup:w,nodeOrigin:N,elevateNodesOnSelect:C,nodeExtent:S,zIndexMode:P}=g();k[0][0]===S[0][0]&&k[0][1]===S[0][1]&&k[1][0]===S[1][0]&&k[1][1]===S[1][1]||(Qg(y,v,w,{nodeOrigin:N,nodeExtent:k,elevateNodesOnSelect:C,checkEquality:!1,zIndexMode:P}),h({nodeExtent:k}))},panBy:k=>{const{transform:y,width:v,height:w,panZoom:N,translateExtent:C}=g();return FD({delta:k,panZoom:N,transform:y,translateExtent:C,width:v,height:w})},setCenter:async(k,y,v)=>{const{width:w,height:N,maxZoom:C,panZoom:S}=g();if(!S)return Promise.resolve(!1);const P=typeof(v==null?void 0:v.zoom)<"u"?v.zoom:C;return await S.setViewport({x:w/2-k*P,y:N/2-y*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:{...cC}})},updateConnection:k=>{h({connection:k})},reset:()=>h({...Sb()})}},Object.is);function Ux({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:s,initialMinZoom:o,initialMaxZoom:a,initialFitViewOptions:c,fitView:u,nodeOrigin:p,nodeExtent:d,zIndexMode:f,children:h}){const[g]=m.useState(()=>h3({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:u,minZoom:o,maxZoom:a,fitViewOptions:c,nodeOrigin:p,nodeExtent:d,zIndexMode:f}));return l.jsx(L$,{value:g,children:l.jsx(nF,{children:h})})}function m3({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:s,height:o,fitView:a,fitViewOptions:c,minZoom:u,maxZoom:p,nodeOrigin:d,nodeExtent:f,zIndexMode:h}){return m.useContext($p)?l.jsx(l.Fragment,{children:e}):l.jsx(Ux,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:s,initialHeight:o,fitView:a,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:p,nodeOrigin:d,nodeExtent:f,zIndexMode:h,children:e})}const g3={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function y3({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:s,edgeTypes:o,onNodeClick:a,onEdgeClick:c,onInit:u,onMove:p,onMoveStart:d,onMoveEnd:f,onConnect:h,onConnectStart:g,onConnectEnd:b,onClickConnectStart:k,onClickConnectEnd:y,onNodeMouseEnter:v,onNodeMouseMove:w,onNodeMouseLeave:N,onNodeContextMenu:C,onNodeDoubleClick:S,onNodeDragStart:P,onNodeDrag:R,onNodeDragStop:M,onNodesDelete:H,onEdgesDelete:_,onDelete:A,onSelectionChange:U,onSelectionDragStart:L,onSelectionDrag:B,onSelectionDragStop:$,onSelectionContextMenu:F,onSelectionStart:I,onSelectionEnd:T,onBeforeDelete:E,connectionMode:q,connectionLineType:W=ls.Bezier,connectionLineStyle:O,connectionLineComponent:X,connectionLineContainerStyle:se,deleteKeyCode:re="Backspace",selectionKeyCode:de="Shift",selectionOnDrag:ie=!1,selectionMode:me=$c.Full,panActivationKeyCode:ye="Space",multiSelectionKeyCode:ke=zc()?"Meta":"Control",zoomActivationKeyCode:he=zc()?"Meta":"Control",snapToGrid:Se,snapGrid:Ve,onlyRenderVisibleElements:We=!1,selectNodesOnDrag:He,nodesDraggable:ut,autoPanOnNodeFocus:Ge,nodesConnectable:De,nodesFocusable:kt,nodeOrigin:Ut=WC,edgesFocusable:Ct,edgesReconnectable:sn,elementsSelectable:pn=!0,defaultViewport:on=Y$,minZoom:Z=.5,maxZoom:oe=2,translateExtent:je=Dc,preventScrolling:$e=!0,nodeExtent:xe,defaultMarkerColor:Qe="#b1b1b7",zoomOnScroll:Et=!0,zoomOnPinch:we=!0,panOnScroll:pe=!1,panOnScrollSpeed:it=.5,panOnScrollMode:Pt=so.Free,zoomOnDoubleClick:Oe=!0,panOnDrag:ft=!0,onPaneClick:hn,onPaneMouseEnter:mn,onPaneMouseMove:Vr,onPaneMouseLeave:gn,onPaneScroll:lr,onPaneContextMenu:Ln,paneClickDistance:Wr=1,nodeClickDistance:En=0,children:Gn,onReconnect:G,onReconnectStart:_e,onReconnectEnd:K,onEdgeContextMenu:Q,onEdgeDoubleClick:te,onEdgeMouseEnter:Pe,onEdgeMouseMove:Ee,onEdgeMouseLeave:Ae,reconnectRadius:Me=10,onNodesChange:mt,onEdgesChange:gt,noDragClassName:Tt="nodrag",noWheelClassName:Kr="nowheel",noPanClassName:Wi="nopan",fitView:Ki,fitViewOptions:Qa,connectOnClick:Yi,attributionPosition:Qp,proOptions:jo,defaultEdgeOptions:wu,elevateNodesOnSelect:vu=!0,elevateEdgesOnSelect:vi=!1,disableKeyboardA11y:Co=!1,autoPanOnConnect:Eo,autoPanOnNodeDrag:Za,autoPanSpeed:Gt,connectionRadius:Ls,isValidConnection:bu,onError:ku,style:br,id:el,nodeDragThreshold:Po,connectionDragThreshold:Os,viewport:_o,onViewportChange:Io,width:ct,height:tl,colorMode:Rt="light",debug:nl,onScroll:bi,ariaLabelConfig:Yr,zIndexMode:Ms="basic",...rl},Ds){const Vt=el||"1",Ao=J$(Rt),$s=m.useCallback(Fs=>{Fs.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),bi==null||bi(Fs)},[bi]);return l.jsx("div",{"data-testid":"rf__wrapper",...rl,onScroll:$s,style:{...br,...g3},ref:Ds,className:qt(["react-flow",i,Ao]),id:el,role:"application",children:l.jsxs(m3,{nodes:e,edges:t,width:ct,height:tl,fitView:Ki,fitViewOptions:Qa,minZoom:Z,maxZoom:oe,nodeOrigin:Ut,nodeExtent:xe,zIndexMode:Ms,children:[l.jsx(X$,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:g,onConnectEnd:b,onClickConnectStart:k,onClickConnectEnd:y,nodesDraggable:ut,autoPanOnNodeFocus:Ge,nodesConnectable:De,nodesFocusable:kt,edgesFocusable:Ct,edgesReconnectable:sn,elementsSelectable:pn,elevateNodesOnSelect:vu,elevateEdgesOnSelect:vi,minZoom:Z,maxZoom:oe,nodeExtent:xe,onNodesChange:mt,onEdgesChange:gt,snapToGrid:Se,snapGrid:Ve,connectionMode:q,translateExtent:je,connectOnClick:Yi,defaultEdgeOptions:wu,fitView:Ki,fitViewOptions:Qa,onNodesDelete:H,onEdgesDelete:_,onDelete:A,onNodeDragStart:P,onNodeDrag:R,onNodeDragStop:M,onSelectionDrag:B,onSelectionDragStart:L,onSelectionDragStop:$,onMove:p,onMoveStart:d,onMoveEnd:f,noPanClassName:Wi,nodeOrigin:Ut,rfId:Vt,autoPanOnConnect:Eo,autoPanOnNodeDrag:Za,autoPanSpeed:Gt,onError:ku,connectionRadius:Ls,isValidConnection:bu,selectNodesOnDrag:He,nodeDragThreshold:Po,connectionDragThreshold:Os,onBeforeDelete:E,debug:nl,ariaLabelConfig:Yr,zIndexMode:Ms}),l.jsx(p3,{onInit:u,onNodeClick:a,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:w,onNodeMouseLeave:N,onNodeContextMenu:C,onNodeDoubleClick:S,nodeTypes:s,edgeTypes:o,connectionLineType:W,connectionLineStyle:O,connectionLineComponent:X,connectionLineContainerStyle:se,selectionKeyCode:de,selectionOnDrag:ie,selectionMode:me,deleteKeyCode:re,multiSelectionKeyCode:ke,panActivationKeyCode:ye,zoomActivationKeyCode:he,onlyRenderVisibleElements:We,defaultViewport:on,translateExtent:je,minZoom:Z,maxZoom:oe,preventScrolling:$e,zoomOnScroll:Et,zoomOnPinch:we,zoomOnDoubleClick:Oe,panOnScroll:pe,panOnScrollSpeed:it,panOnScrollMode:Pt,panOnDrag:ft,onPaneClick:hn,onPaneMouseEnter:mn,onPaneMouseMove:Vr,onPaneMouseLeave:gn,onPaneScroll:lr,onPaneContextMenu:Ln,paneClickDistance:Wr,nodeClickDistance:En,onSelectionContextMenu:F,onSelectionStart:I,onSelectionEnd:T,onReconnect:G,onReconnectStart:_e,onReconnectEnd:K,onEdgeContextMenu:Q,onEdgeDoubleClick:te,onEdgeMouseEnter:Pe,onEdgeMouseMove:Ee,onEdgeMouseLeave:Ae,reconnectRadius:Me,defaultMarkerColor:Qe,noDragClassName:Tt,noWheelClassName:Kr,noPanClassName:Wi,rfId:Vt,disableKeyboardA11y:Co,nodeExtent:xe,viewport:_o,onViewportChange:Io}),l.jsx(K$,{onSelectionChange:U}),Gn,l.jsx(B$,{proOptions:jo,position:Qp}),l.jsx(z$,{rfId:Vt,disableKeyboardA11y:Co})]})})}var xE=qC(y3);function wE(e){const[t,n]=m.useState(e),r=m.useCallback(i=>n(s=>Bx(i,s)),[]);return[t,n,r]}function vE(e){const[t,n]=m.useState(e),r=m.useCallback(i=>n(s=>YC(i,s)),[]);return[t,n,r]}function x3({dimensions:e,lineWidth:t,variant:n,className:r}){return l.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:qt(["react-flow__background-pattern",n,r])})}function w3({radius:e,className:t}){return l.jsx("circle",{cx:e,cy:e,r:e,className:qt(["react-flow__background-pattern","dots",t])})}var bs;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(bs||(bs={}));const v3={[bs.Dots]:1,[bs.Lines]:1,[bs.Cross]:6},b3=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function bE({id:e,variant:t=bs.Dots,gap:n=20,size:r,lineWidth:i=1,offset:s=0,color:o,bgColor:a,style:c,className:u,patternClassName:p}){const d=m.useRef(null),{transform:f,patternId:h}=nt(b3,It),g=r||v3[t],b=t===bs.Dots,k=t===bs.Cross,y=Array.isArray(n)?n:[n,n],v=[y[0]*f[2]||1,y[1]*f[2]||1],w=g*f[2],N=Array.isArray(s)?s:[s,s],C=k?[w,w]:v,S=[N[0]*f[2]||1+C[0]/2,N[1]*f[2]||1+C[1]/2],P=`${h}${e||""}`;return l.jsxs("svg",{className:qt(["react-flow__background",u]),style:{...c,...Fp,"--xy-background-color-props":a,"--xy-background-pattern-color-props":o},ref:d,"data-testid":"rf__background",children:[l.jsx("pattern",{id:P,x:f[0]%v[0],y:f[1]%v[1],width:v[0],height:v[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${S[0]},-${S[1]})`,children:b?l.jsx(w3,{radius:w/2,className:p}):l.jsx(x3,{dimensions:C,lineWidth:i,variant:t,className:p})}),l.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${P})`})]})}bE.displayName="Background";const kE=m.memo(bE);function k3(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:l.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function S3(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:l.jsx("path",{d:"M0 0h32v4.2H0z"})})}function N3(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:l.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 j3(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:l.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 C3(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:l.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 _d({children:e,className:t,...n}){return l.jsx("button",{type:"button",className:qt(["react-flow__controls-button",t]),...n,children:e})}const E3=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function SE({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:s,onZoomOut:o,onFitView:a,onInteractiveChange:c,className:u,children:p,position:d="bottom-left",orientation:f="vertical","aria-label":h}){const g=At(),{isInteractive:b,minZoomReached:k,maxZoomReached:y,ariaLabelConfig:v}=nt(E3,It),{zoomIn:w,zoomOut:N,fitView:C}=So(),S=()=>{w(),s==null||s()},P=()=>{N(),o==null||o()},R=()=>{C(i),a==null||a()},M=()=>{g.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),c==null||c(!b)},H=f==="horizontal"?"horizontal":"vertical";return l.jsxs(Ma,{className:qt(["react-flow__controls",H,u]),position:d,style:e,"data-testid":"rf__controls","aria-label":h??v["controls.ariaLabel"],children:[t&&l.jsxs(l.Fragment,{children:[l.jsx(_d,{onClick:S,className:"react-flow__controls-zoomin",title:v["controls.zoomIn.ariaLabel"],"aria-label":v["controls.zoomIn.ariaLabel"],disabled:y,children:l.jsx(k3,{})}),l.jsx(_d,{onClick:P,className:"react-flow__controls-zoomout",title:v["controls.zoomOut.ariaLabel"],"aria-label":v["controls.zoomOut.ariaLabel"],disabled:k,children:l.jsx(S3,{})})]}),n&&l.jsx(_d,{className:"react-flow__controls-fitview",onClick:R,title:v["controls.fitView.ariaLabel"],"aria-label":v["controls.fitView.ariaLabel"],children:l.jsx(N3,{})}),r&&l.jsx(_d,{className:"react-flow__controls-interactive",onClick:M,title:v["controls.interactive.ariaLabel"],"aria-label":v["controls.interactive.ariaLabel"],children:b?l.jsx(C3,{}):l.jsx(j3,{})}),p]})}SE.displayName="Controls";const P3=m.memo(SE);function _3({id:e,x:t,y:n,width:r,height:i,style:s,color:o,strokeColor:a,strokeWidth:c,className:u,borderRadius:p,shapeRendering:d,selected:f,onClick:h}){const{background:g,backgroundColor:b}=s||{},k=o||g||b;return l.jsx("rect",{className:qt(["react-flow__minimap-node",{selected:f},u]),x:t,y:n,rx:p,ry:p,width:r,height:i,style:{fill:k,stroke:a,strokeWidth:c},shapeRendering:d,onClick:h?y=>h(y,e):void 0})}const I3=m.memo(_3),A3=e=>e.nodes.map(t=>t.id),hm=e=>e instanceof Function?e:()=>e;function T3({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:s=I3,onClick:o}){const a=nt(A3,It),c=hm(t),u=hm(e),p=hm(n),d=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return l.jsx(l.Fragment,{children:a.map(f=>l.jsx(L3,{id:f,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:p,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:s,onClick:o,shapeRendering:d},f))})}function R3({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:s,shapeRendering:o,NodeComponent:a,onClick:c}){const{node:u,x:p,y:d,width:f,height:h}=nt(g=>{const b=g.nodeLookup.get(e);if(!b)return{node:void 0,x:0,y:0,width:0,height:0};const k=b.internals.userNode,{x:y,y:v}=b.internals.positionAbsolute,{width:w,height:N}=Ui(k);return{node:k,x:y,y:v,width:w,height:N}},It);return!u||u.hidden||!gC(u)?null:l.jsx(a,{x:p,y:d,width:f,height:h,style:u.style,selected:!!u.selected,className:r(u),color:t(u),borderRadius:i,strokeColor:n(u),strokeWidth:s,shapeRendering:o,onClick:c,id:u.id})}const L3=m.memo(R3);var O3=m.memo(T3);const M3=200,D3=150,$3=e=>!e.hidden,F3=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?mC(lu(e.nodeLookup,{filter:$3}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},z3="react-flow__minimap-desc";function NE({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i="",nodeBorderRadius:s=5,nodeStrokeWidth:o,nodeComponent:a,bgColor:c,maskColor:u,maskStrokeColor:p,maskStrokeWidth:d,position:f="bottom-right",onClick:h,onNodeClick:g,pannable:b=!1,zoomable:k=!1,ariaLabel:y,inversePan:v,zoomStep:w=1,offsetScale:N=5}){const C=At(),S=m.useRef(null),{boundingRect:P,viewBB:R,rfId:M,panZoom:H,translateExtent:_,flowWidth:A,flowHeight:U,ariaLabelConfig:L}=nt(F3,It),B=(e==null?void 0:e.width)??M3,$=(e==null?void 0:e.height)??D3,F=P.width/B,I=P.height/$,T=Math.max(F,I),E=T*B,q=T*$,W=N*T,O=P.x-(E-P.width)/2-W,X=P.y-(q-P.height)/2-W,se=E+W*2,re=q+W*2,de=`${z3}-${M}`,ie=m.useRef(0),me=m.useRef();ie.current=T,m.useEffect(()=>{if(S.current&&H)return me.current=qD({domNode:S.current,panZoom:H,getTransform:()=>C.getState().transform,getViewScale:()=>ie.current}),()=>{var Se;(Se=me.current)==null||Se.destroy()}},[H]),m.useEffect(()=>{var Se;(Se=me.current)==null||Se.update({translateExtent:_,width:A,height:U,inversePan:v,pannable:b,zoomStep:w,zoomable:k})},[b,k,v,w,_,A,U]);const ye=h?Se=>{var He;const[Ve,We]=((He=me.current)==null?void 0:He.pointer(Se))||[0,0];h(Se,{x:Ve,y:We})}:void 0,ke=g?m.useCallback((Se,Ve)=>{const We=C.getState().nodeLookup.get(Ve).internals.userNode;g(Se,We)},[]):void 0,he=y??L["minimap.ariaLabel"];return l.jsx(Ma,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-stroke-width-props":typeof d=="number"?d*T: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:qt(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:l.jsxs("svg",{width:B,height:$,viewBox:`${O} ${X} ${se} ${re}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":de,ref:S,onClick:ye,children:[he&&l.jsx("title",{id:de,children:he}),l.jsx(O3,{onClick:ke,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:a}),l.jsx("path",{className:"react-flow__minimap-mask",d:`M${O-W},${X-W}h${se+W*2}v${re+W*2}h${-se-W*2}z
|
|
66
|
-
M${R.x},${R.y}h${R.width}v${R.height}h${-R.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}NE.displayName="MiniMap";const B3=m.memo(NE),H3=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,U3={[La.Line]:"right",[La.Handle]:"bottom-right"};function V3({nodeId:e,position:t,variant:n=La.Handle,className:r,style:i=void 0,children:s,color:o,minWidth:a=10,minHeight:c=10,maxWidth:u=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:h=!0,shouldResize:g,onResizeStart:b,onResize:k,onResizeEnd:y}){const v=QC(),w=typeof e=="string"?e:v,N=At(),C=m.useRef(null),S=n===La.Handle,P=nt(m.useCallback(H3(S&&h),[S,h]),It),R=m.useRef(null),M=t??U3[n];m.useEffect(()=>{if(!(!C.current||!w))return R.current||(R.current=l$({domNode:C.current,nodeId:w,getStoreItems:()=>{const{nodeLookup:_,transform:A,snapGrid:U,snapToGrid:L,nodeOrigin:B,domNode:$}=N.getState();return{nodeLookup:_,transform:A,snapGrid:U,snapToGrid:L,nodeOrigin:B,paneDomNode:$}},onChange:(_,A)=>{const{triggerNodeChanges:U,nodeLookup:L,parentLookup:B,nodeOrigin:$}=N.getState(),F=[],I={x:_.x,y:_.y},T=L.get(w);if(T&&T.expandParent&&T.parentId){const E=T.origin??$,q=_.width??T.measured.width??0,W=_.height??T.measured.height??0,O={id:T.id,parentId:T.parentId,rect:{width:q,height:W,...yC({x:_.x??T.position.x,y:_.y??T.position.y},{width:q,height:W},T.parentId,L,E)}},X=zx([O],L,B,$);F.push(...X),I.x=_.x?Math.max(E[0]*q,_.x):void 0,I.y=_.y?Math.max(E[1]*W,_.y):void 0}if(I.x!==void 0&&I.y!==void 0){const E={id:w,type:"position",position:{...I}};F.push(E)}if(_.width!==void 0&&_.height!==void 0){const q={id:w,type:"dimensions",resizing:!0,setAttributes:f?f==="horizontal"?"width":"height":!0,dimensions:{width:_.width,height:_.height}};F.push(q)}for(const E of A){const q={...E,type:"position"};F.push(q)}U(F)},onEnd:({width:_,height:A})=>{const U={id:w,type:"dimensions",resizing:!1,dimensions:{width:_,height:A}};N.getState().triggerNodeChanges([U])}})),R.current.update({controlPosition:M,boundaries:{minWidth:a,minHeight:c,maxWidth:u,maxHeight:p},keepAspectRatio:d,resizeDirection:f,onResizeStart:b,onResize:k,onResizeEnd:y,shouldResize:g}),()=>{var _;(_=R.current)==null||_.destroy()}},[M,a,c,u,p,d,b,k,y,g]);const H=M.split("-");return l.jsx("div",{className:qt(["react-flow__resize-control","nodrag",...H,n,r]),ref:C,style:{...i,scale:P,...o&&{[S?"backgroundColor":"borderColor"]:o}},children:s})}const W3=m.memo(V3);function K3(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Y3=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,q3=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,G3={};function Nb(e,t){return(G3.jsx?q3:Y3).test(e)}const X3=/[ \t\n\f\r]/g;function J3(e){return typeof e=="object"?e.type==="text"?jb(e.value):!1:jb(e)}function jb(e){return e.replace(X3,"")===""}let du=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};du.prototype.normal={};du.prototype.property={};du.prototype.space=void 0;function jE(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new du(n,r,t)}function ny(e){return e.toLowerCase()}class qn{constructor(t,n){this.attribute=n,this.property=t}}qn.prototype.attribute="";qn.prototype.booleanish=!1;qn.prototype.boolean=!1;qn.prototype.commaOrSpaceSeparated=!1;qn.prototype.commaSeparated=!1;qn.prototype.defined=!1;qn.prototype.mustUseProperty=!1;qn.prototype.number=!1;qn.prototype.overloadedBoolean=!1;qn.prototype.property="";qn.prototype.spaceSeparated=!1;qn.prototype.space=void 0;let Q3=0;const Ye=No(),Wt=No(),ry=No(),ce=No(),xt=No(),xa=No(),Xn=No();function No(){return 2**++Q3}const iy=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ye,booleanish:Wt,commaOrSpaceSeparated:Xn,commaSeparated:xa,number:ce,overloadedBoolean:ry,spaceSeparated:xt},Symbol.toStringTag,{value:"Module"})),mm=Object.keys(iy);class Vx extends qn{constructor(t,n,r,i){let s=-1;if(super(t,n),Cb(this,"space",i),typeof r=="number")for(;++s<mm.length;){const o=mm[s];Cb(this,mm[s],(r&iy[o])===iy[o])}}}Vx.prototype.defined=!0;function Cb(e,t,n){n&&(e[t]=n)}function Va(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new Vx(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[ny(r)]=r,n[ny(s.attribute)]=r}return new du(t,n,e.space)}const CE=Va({properties:{ariaActiveDescendant:null,ariaAtomic:Wt,ariaAutoComplete:null,ariaBusy:Wt,ariaChecked:Wt,ariaColCount:ce,ariaColIndex:ce,ariaColSpan:ce,ariaControls:xt,ariaCurrent:null,ariaDescribedBy:xt,ariaDetails:null,ariaDisabled:Wt,ariaDropEffect:xt,ariaErrorMessage:null,ariaExpanded:Wt,ariaFlowTo:xt,ariaGrabbed:Wt,ariaHasPopup:null,ariaHidden:Wt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:xt,ariaLevel:ce,ariaLive:null,ariaModal:Wt,ariaMultiLine:Wt,ariaMultiSelectable:Wt,ariaOrientation:null,ariaOwns:xt,ariaPlaceholder:null,ariaPosInSet:ce,ariaPressed:Wt,ariaReadOnly:Wt,ariaRelevant:null,ariaRequired:Wt,ariaRoleDescription:xt,ariaRowCount:ce,ariaRowIndex:ce,ariaRowSpan:ce,ariaSelected:Wt,ariaSetSize:ce,ariaSort:null,ariaValueMax:ce,ariaValueMin:ce,ariaValueNow:ce,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function EE(e,t){return t in e?e[t]:t}function PE(e,t){return EE(e,t.toLowerCase())}const Z3=Va({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:xa,acceptCharset:xt,accessKey:xt,action:null,allow:null,allowFullScreen:Ye,allowPaymentRequest:Ye,allowUserMedia:Ye,alt:null,as:null,async:Ye,autoCapitalize:null,autoComplete:xt,autoFocus:Ye,autoPlay:Ye,blocking:xt,capture:null,charSet:null,checked:Ye,cite:null,className:xt,cols:ce,colSpan:null,content:null,contentEditable:Wt,controls:Ye,controlsList:xt,coords:ce|xa,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ye,defer:Ye,dir:null,dirName:null,disabled:Ye,download:ry,draggable:Wt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ye,formTarget:null,headers:xt,height:ce,hidden:ry,high:ce,href:null,hrefLang:null,htmlFor:xt,httpEquiv:xt,id:null,imageSizes:null,imageSrcSet:null,inert:Ye,inputMode:null,integrity:null,is:null,isMap:Ye,itemId:null,itemProp:xt,itemRef:xt,itemScope:Ye,itemType:xt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ye,low:ce,manifest:null,max:null,maxLength:ce,media:null,method:null,min:null,minLength:ce,multiple:Ye,muted:Ye,name:null,nonce:null,noModule:Ye,noValidate:Ye,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:Ye,optimum:ce,pattern:null,ping:xt,placeholder:null,playsInline:Ye,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ye,referrerPolicy:null,rel:xt,required:Ye,reversed:Ye,rows:ce,rowSpan:ce,sandbox:xt,scope:null,scoped:Ye,seamless:Ye,selected:Ye,shadowRootClonable:Ye,shadowRootDelegatesFocus:Ye,shadowRootMode:null,shape:null,size:ce,sizes:null,slot:null,span:ce,spellCheck:Wt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ce,step:null,style:null,tabIndex:ce,target:null,title:null,translate:null,type:null,typeMustMatch:Ye,useMap:null,value:Wt,width:ce,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:xt,axis:null,background:null,bgColor:null,border:ce,borderColor:null,bottomMargin:ce,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ye,declare:Ye,event:null,face:null,frame:null,frameBorder:null,hSpace:ce,leftMargin:ce,link:null,longDesc:null,lowSrc:null,marginHeight:ce,marginWidth:ce,noResize:Ye,noHref:Ye,noShade:Ye,noWrap:Ye,object:null,profile:null,prompt:null,rev:null,rightMargin:ce,rules:null,scheme:null,scrolling:Wt,standby:null,summary:null,text:null,topMargin:ce,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ce,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ye,disableRemotePlayback:Ye,prefix:null,property:null,results:ce,security:null,unselectable:null},space:"html",transform:PE}),ez=Va({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:Xn,accentHeight:ce,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ce,amplitude:ce,arabicForm:null,ascent:ce,attributeName:null,attributeType:null,azimuth:ce,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ce,by:null,calcMode:null,capHeight:ce,className:xt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ce,diffuseConstant:ce,direction:null,display:null,dur:null,divisor:ce,dominantBaseline:null,download:Ye,dx:null,dy:null,edgeMode:null,editable:null,elevation:ce,enableBackground:null,end:null,event:null,exponent:ce,externalResourcesRequired:null,fill:null,fillOpacity:ce,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:xa,g2:xa,glyphName:xa,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ce,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ce,horizOriginX:ce,horizOriginY:ce,id:null,ideographic:ce,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ce,k:ce,k1:ce,k2:ce,k3:ce,k4:ce,kernelMatrix:Xn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ce,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ce,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ce,overlineThickness:ce,paintOrder:null,panose1:null,path:null,pathLength:ce,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:xt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ce,pointsAtY:ce,pointsAtZ:ce,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Xn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Xn,rev:Xn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Xn,requiredFeatures:Xn,requiredFonts:Xn,requiredFormats:Xn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ce,specularExponent:ce,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ce,strikethroughThickness:ce,string:null,stroke:null,strokeDashArray:Xn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ce,strokeOpacity:ce,strokeWidth:null,style:null,surfaceScale:ce,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Xn,tabIndex:ce,tableValues:null,target:null,targetX:ce,targetY:ce,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Xn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ce,underlineThickness:ce,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ce,values:null,vAlphabetic:ce,vMathematical:ce,vectorEffect:null,vHanging:ce,vIdeographic:ce,version:null,vertAdvY:ce,vertOriginX:ce,vertOriginY:ce,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ce,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:EE}),_E=Va({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()}}),IE=Va({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:PE}),AE=Va({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),tz={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"},nz=/[A-Z]/g,Eb=/-[a-z]/g,rz=/^data[-\w.:]+$/i;function iz(e,t){const n=ny(t);let r=t,i=qn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&rz.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(Eb,oz);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!Eb.test(s)){let o=s.replace(nz,sz);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=Vx}return new i(r,t)}function sz(e){return"-"+e.toLowerCase()}function oz(e){return e.charAt(1).toUpperCase()}const az=jE([CE,Z3,_E,IE,AE],"html"),Wx=jE([CE,ez,_E,IE,AE],"svg");function lz(e){return e.join(" ").trim()}var Kx={},Pb=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,cz=/\n/g,uz=/^\s*/,dz=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,fz=/^:\s*/,pz=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,hz=/^[;\s]*/,mz=/^\s+|\s+$/g,gz=`
|
|
67
|
-
`,_b="/",Ib="*",Js="",yz="comment",xz="declaration";function wz(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(g){var b=g.match(cz);b&&(n+=b.length);var k=g.lastIndexOf(gz);r=~k?g.length-k:r+g.length}function s(){var g={line:n,column:r};return function(b){return b.position=new o(g),u(),b}}function o(g){this.start=g,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function a(g){var b=new Error(t.source+":"+n+":"+r+": "+g);if(b.reason=g,b.filename=t.source,b.line=n,b.column=r,b.source=e,!t.silent)throw b}function c(g){var b=g.exec(e);if(b){var k=b[0];return i(k),e=e.slice(k.length),b}}function u(){c(uz)}function p(g){var b;for(g=g||[];b=d();)b!==!1&&g.push(b);return g}function d(){var g=s();if(!(_b!=e.charAt(0)||Ib!=e.charAt(1))){for(var b=2;Js!=e.charAt(b)&&(Ib!=e.charAt(b)||_b!=e.charAt(b+1));)++b;if(b+=2,Js===e.charAt(b-1))return a("End of comment missing");var k=e.slice(2,b-2);return r+=2,i(k),e=e.slice(b),r+=2,g({type:yz,comment:k})}}function f(){var g=s(),b=c(dz);if(b){if(d(),!c(fz))return a("property missing ':'");var k=c(pz),y=g({type:xz,property:Ab(b[0].replace(Pb,Js)),value:k?Ab(k[0].replace(Pb,Js)):Js});return c(hz),y}}function h(){var g=[];p(g);for(var b;b=f();)b!==!1&&(g.push(b),p(g));return g}return u(),h()}function Ab(e){return e?e.replace(mz,Js):Js}var vz=wz,bz=mc&&mc.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Kx,"__esModule",{value:!0});Kx.default=Sz;const kz=bz(vz);function Sz(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,kz.default)(e),i=typeof t=="function";return r.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:a}=s;i?t(o,a,s):a&&(n=n||{},n[o]=a)}),n}var Bp={};Object.defineProperty(Bp,"__esModule",{value:!0});Bp.camelCase=void 0;var Nz=/^--[a-zA-Z0-9_-]+$/,jz=/-([a-z])/g,Cz=/^[^-]+$/,Ez=/^-(webkit|moz|ms|o|khtml)-/,Pz=/^-(ms)-/,_z=function(e){return!e||Cz.test(e)||Nz.test(e)},Iz=function(e,t){return t.toUpperCase()},Tb=function(e,t){return"".concat(t,"-")},Az=function(e,t){return t===void 0&&(t={}),_z(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(Pz,Tb):e=e.replace(Ez,Tb),e.replace(jz,Iz))};Bp.camelCase=Az;var Tz=mc&&mc.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Rz=Tz(Kx),Lz=Bp;function sy(e,t){var n={};return!e||typeof e!="string"||(0,Rz.default)(e,function(r,i){r&&i&&(n[(0,Lz.camelCase)(r,t)]=i)}),n}sy.default=sy;var Oz=sy;const Mz=_s(Oz),TE=RE("end"),Yx=RE("start");function RE(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 Dz(e){const t=Yx(e),n=TE(e);if(t&&n)return{start:t,end:n}}function cc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Rb(e.position):"start"in e||"end"in e?Rb(e):"line"in e||"column"in e?oy(e):""}function oy(e){return Lb(e&&e.line)+":"+Lb(e&&e.column)}function Rb(e){return oy(e&&e.start)+"-"+oy(e&&e.end)}function Lb(e){return e&&typeof e=="number"?e:1}class jn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(o=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?s.ruleId=r:(s.source=r.slice(0,c),s.ruleId=r.slice(c+1))}if(!s.place&&s.ancestors&&s.ancestors){const c=s.ancestors[s.ancestors.length-1];c&&(s.place=c.position)}const a=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=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=cc(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}}jn.prototype.file="";jn.prototype.name="";jn.prototype.reason="";jn.prototype.message="";jn.prototype.stack="";jn.prototype.column=void 0;jn.prototype.line=void 0;jn.prototype.ancestors=void 0;jn.prototype.cause=void 0;jn.prototype.fatal=void 0;jn.prototype.place=void 0;jn.prototype.ruleId=void 0;jn.prototype.source=void 0;const qx={}.hasOwnProperty,$z=new Map,Fz=/[A-Z]/g,zz=new Set(["table","tbody","thead","tfoot","tr"]),Bz=new Set(["td","th"]),LE="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Hz(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=Xz(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=Gz(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"?Wx:az,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=OE(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function OE(e,t,n){if(t.type==="element")return Uz(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Vz(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Kz(e,t,n);if(t.type==="mdxjsEsm")return Wz(e,t);if(t.type==="root")return Yz(e,t,n);if(t.type==="text")return qz(e,t)}function Uz(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Wx,e.schema=i),e.ancestors.push(t);const s=DE(e,t.tagName,!1),o=Jz(e,t);let a=Xx(e,t);return zz.has(t.tagName)&&(a=a.filter(function(c){return typeof c=="string"?!J3(c):!0})),ME(e,o,s,t),Gx(o,a),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function Vz(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)}Hc(e,t.position)}function Wz(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Hc(e,t.position)}function Kz(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Wx,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:DE(e,t.name,!0),o=Qz(e,t),a=Xx(e,t);return ME(e,o,s,t),Gx(o,a),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function Yz(e,t,n){const r={};return Gx(r,Xx(e,t)),e.create(t,e.Fragment,r,n)}function qz(e,t){return t.value}function ME(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Gx(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Gz(e,t,n){return r;function r(i,s,o,a){const u=Array.isArray(o.children)?n:t;return a?u(s,o,a):u(s,o)}}function Xz(e,t){return n;function n(r,i,s,o){const a=Array.isArray(s.children),c=Yx(r);return t(i,s,o,a,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function Jz(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&qx.call(t.properties,i)){const s=Zz(e,i,t.properties[i]);if(s){const[o,a]=s;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&Bz.has(t.tagName)?r=a:n[o]=a}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Qz(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 a=o.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Hc(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 a=r.value.data.estree.body[0];a.type,s=e.evaluater.evaluateExpression(a.expression)}else Hc(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function Xx(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:$z;for(;++r<t.children.length;){const s=t.children[r];let o;if(e.passKeys){const c=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(c){const u=i.get(c)||0;o=c+"-"+u,i.set(c,u+1)}}const a=OE(e,s,o);a!==void 0&&n.push(a)}return n}function Zz(e,t,n){const r=iz(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?K3(n):lz(n)),r.property==="style"){let i=typeof n=="object"?n:e4(e,String(n));return e.stylePropertyNameCase==="css"&&(i=t4(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?tz[r.property]||r.property:r.attribute,n]}}function e4(e,t){try{return Mz(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new jn("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=LE+"#cannot-parse-style-attribute",i}}function DE(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 a=Nb(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(s&&a.type==="Literal"),optional:!1}:a}r=o}else r=Nb(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return qx.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);Hc(e)}function Hc(e,t){const n=new jn("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=LE+"#cannot-handle-mdx-estrees-without-createevaluater",n}function t4(e){const t={};let n;for(n in e)qx.call(e,n)&&(t[n4(n)]=e[n]);return t}function n4(e){let t=e.replace(Fz,r4);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function r4(e){return"-"+e.toLowerCase()}const gm={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"]},i4={};function s4(e,t){const n=i4,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return $E(e,r,i)}function $E(e,t,n){if(o4(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 Ob(e.children,t,n)}return Array.isArray(e)?Ob(e,t,n):""}function Ob(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=$E(e[i],t,n);return r.join("")}function o4(e){return!!(e&&typeof e=="object")}const Mb=document.createElement("i");function Jx(e){const t="&"+e+";";Mb.innerHTML=t;const n=Mb.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function gi(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 mr(e,t){return e.length>0?(gi(e,e.length,0,t),e):t}const Db={}.hasOwnProperty;function a4(e){const t={};let n=-1;for(;++n<e.length;)l4(t,e[n]);return t}function l4(e,t){let n;for(n in t){const i=(Db.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let o;if(s)for(o in s){Db.call(i,o)||(i[o]=[]);const a=s[o];c4(i[o],Array.isArray(a)?a:a?[a]:[])}}}function c4(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);gi(e,0,0,r)}function FE(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 wa(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ai=Rs(/[A-Za-z]/),tr=Rs(/[\dA-Za-z]/),u4=Rs(/[#-'*+\--9=?A-Z^-~]/);function ay(e){return e!==null&&(e<32||e===127)}const ly=Rs(/\d/),d4=Rs(/[\dA-Fa-f]/),f4=Rs(/[!-/:-@[-`{-~]/);function Fe(e){return e!==null&&e<-2}function Yn(e){return e!==null&&(e<0||e===32)}function lt(e){return e===-2||e===-1||e===32}const p4=Rs(new RegExp("\\p{P}|\\p{S}","u")),h4=Rs(/\s/);function Rs(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Wa(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const s=e.charCodeAt(n);let o="";if(s===37&&tr(e.charCodeAt(n+1))&&tr(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 a=e.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(o=String.fromCharCode(s,a),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 vt(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(c){return lt(c)?(e.enter(n),a(c)):t(c)}function a(c){return lt(c)&&s++<i?(e.consume(c),a):(e.exit(n),t(c))}}const m4={tokenize:g4};function g4(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),vt(e,t,"linePrefix")}function i(a){return e.enter("paragraph"),s(a)}function s(a){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,o(a)}function o(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return Fe(a)?(e.consume(a),e.exit("chunkText"),s):(e.consume(a),o)}}const y4={tokenize:x4},$b={tokenize:w4};function x4(e){const t=this,n=[];let r=0,i,s,o;return a;function a(w){if(r<n.length){const N=n[r];return t.containerState=N[1],e.attempt(N[0].continuation,c,u)(w)}return u(w)}function c(w){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();const N=t.events.length;let C=N,S;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){S=t.events[C][1].end;break}y(r);let P=N;for(;P<t.events.length;)t.events[P][1].end={...S},P++;return gi(t.events,C+1,0,t.events.slice(N)),t.events.length=P,u(w)}return a(w)}function u(w){if(r===n.length){if(!i)return f(w);if(i.currentConstruct&&i.currentConstruct.concrete)return g(w);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check($b,p,d)(w)}function p(w){return i&&v(),y(r),f(w)}function d(w){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,g(w)}function f(w){return t.containerState={},e.attempt($b,h,g)(w)}function h(w){return r++,n.push([t.currentConstruct,t.containerState]),f(w)}function g(w){if(w===null){i&&v(),y(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),y(0),e.consume(w);return}return Fe(w)?(e.consume(w),k(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(w),b)}function k(w,N){const C=t.sliceStream(w);if(N&&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 S=i.events.length;for(;S--;)if(i.events[S][1].start.offset<o&&(!i.events[S][1].end||i.events[S][1].end.offset>o))return;const P=t.events.length;let R=P,M,H;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){if(M){H=t.events[R][1].end;break}M=!0}for(y(r),S=P;S<t.events.length;)t.events[S][1].end={...H},S++;gi(t.events,R+1,0,t.events.slice(P)),t.events.length=S}}function y(w){let N=n.length;for(;N-- >w;){const C=n[N];t.containerState=C[1],C[0].exit.call(t,e)}n.length=w}function v(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function w4(e,t,n){return vt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Fb(e){if(e===null||Yn(e)||h4(e))return 1;if(p4(e))return 2}function Qx(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 cy={name:"attention",resolveAll:v4,tokenize:b4};function v4(e,t){let n=-1,r,i,s,o,a,c,u,p;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},f={...e[n][1].start};zb(d,-c),zb(f,c),o={type:c>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},a={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},s={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[r][1].end={...o.start},e[n][1].start={...a.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=mr(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=mr(u,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),u=mr(u,Qx(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=mr(u,[["exit",s,t],["enter",a,t],["exit",a,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,u=mr(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,gi(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 b4(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Fb(r);let s;return o;function o(c){return s=c,e.enter("attentionSequence"),a(c)}function a(c){if(c===s)return e.consume(c),a;const u=e.exit("attentionSequence"),p=Fb(c),d=!p||p===2&&i||n.includes(c),f=!i||i===2&&p||n.includes(r);return u._open=!!(s===42?d:d&&(i||!f)),u._close=!!(s===42?f:f&&(p||!d)),t(c)}}function zb(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const k4={name:"autolink",tokenize:S4};function S4(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 ai(h)?(e.consume(h),o):h===64?n(h):u(h)}function o(h){return h===43||h===45||h===46||tr(h)?(r=1,a(h)):u(h)}function a(h){return h===58?(e.consume(h),r=0,c):(h===43||h===45||h===46||tr(h))&&r++<32?(e.consume(h),a):(r=0,u(h))}function c(h){return h===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):h===null||h===32||h===60||ay(h)?n(h):(e.consume(h),c)}function u(h){return h===64?(e.consume(h),p):u4(h)?(e.consume(h),u):n(h)}function p(h){return tr(h)?d(h):n(h)}function d(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):f(h)}function f(h){if((h===45||tr(h))&&r++<63){const g=h===45?f:d;return e.consume(h),g}return n(h)}}const Hp={partial:!0,tokenize:N4};function N4(e,t,n){return r;function r(s){return lt(s)?vt(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||Fe(s)?t(s):n(s)}}const zE={continuation:{tokenize:C4},exit:E4,name:"blockQuote",tokenize:j4};function j4(e,t,n){const r=this;return i;function i(o){if(o===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),s}return n(o)}function s(o){return lt(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function C4(e,t,n){const r=this;return i;function i(o){return lt(o)?vt(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return e.attempt(zE,t,n)(o)}}function E4(e){e.exit("blockQuote")}const BE={name:"characterEscape",tokenize:P4};function P4(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 f4(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const HE={name:"characterReference",tokenize:_4};function _4(e,t,n){const r=this;let i=0,s,o;return a;function a(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),c}function c(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),s=31,o=tr,p(d))}function u(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,o=d4,p):(e.enter("characterReferenceValue"),s=7,o=ly,p(d))}function p(d){if(d===59&&i){const f=e.exit("characterReferenceValue");return o===tr&&!Jx(r.sliceSerialize(f))?n(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(d)&&i++<s?(e.consume(d),p):n(d)}}const Bb={partial:!0,tokenize:A4},Hb={concrete:!0,name:"codeFenced",tokenize:I4};function I4(e,t,n){const r=this,i={partial:!0,tokenize:C};let s=0,o=0,a;return c;function c(S){return u(S)}function u(S){const P=r.events[r.events.length-1];return s=P&&P[1].type==="linePrefix"?P[2].sliceSerialize(P[1],!0).length:0,a=S,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(S)}function p(S){return S===a?(o++,e.consume(S),p):o<3?n(S):(e.exit("codeFencedFenceSequence"),lt(S)?vt(e,d,"whitespace")(S):d(S))}function d(S){return S===null||Fe(S)?(e.exit("codeFencedFence"),r.interrupt?t(S):e.check(Bb,b,N)(S)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(S))}function f(S){return S===null||Fe(S)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(S)):lt(S)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),vt(e,h,"whitespace")(S)):S===96&&S===a?n(S):(e.consume(S),f)}function h(S){return S===null||Fe(S)?d(S):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(S))}function g(S){return S===null||Fe(S)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(S)):S===96&&S===a?n(S):(e.consume(S),g)}function b(S){return e.attempt(i,N,k)(S)}function k(S){return e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),y}function y(S){return s>0&<(S)?vt(e,v,"linePrefix",s+1)(S):v(S)}function v(S){return S===null||Fe(S)?e.check(Bb,b,N)(S):(e.enter("codeFlowValue"),w(S))}function w(S){return S===null||Fe(S)?(e.exit("codeFlowValue"),v(S)):(e.consume(S),w)}function N(S){return e.exit("codeFenced"),t(S)}function C(S,P,R){let M=0;return H;function H(B){return S.enter("lineEnding"),S.consume(B),S.exit("lineEnding"),_}function _(B){return S.enter("codeFencedFence"),lt(B)?vt(S,A,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):A(B)}function A(B){return B===a?(S.enter("codeFencedFenceSequence"),U(B)):R(B)}function U(B){return B===a?(M++,S.consume(B),U):M>=o?(S.exit("codeFencedFenceSequence"),lt(B)?vt(S,L,"whitespace")(B):L(B)):R(B)}function L(B){return B===null||Fe(B)?(S.exit("codeFencedFence"),P(B)):R(B)}}}function A4(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 ym={name:"codeIndented",tokenize:R4},T4={partial:!0,tokenize:L4};function R4(e,t,n){const r=this;return i;function i(u){return e.enter("codeIndented"),vt(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?c(u):Fe(u)?e.attempt(T4,o,c)(u):(e.enter("codeFlowValue"),a(u))}function a(u){return u===null||Fe(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),a)}function c(u){return e.exit("codeIndented"),t(u)}}function L4(e,t,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):Fe(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):vt(e,s,"linePrefix",5)(o)}function s(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):Fe(o)?i(o):n(o)}}const O4={name:"codeText",previous:D4,resolve:M4,tokenize:$4};function M4(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 D4(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function $4(e,t,n){let r=0,i,s;return o;function o(d){return e.enter("codeText"),e.enter("codeTextSequence"),a(d)}function a(d){return d===96?(e.consume(d),r++,a):(e.exit("codeTextSequence"),c(d))}function c(d){return d===null?n(d):d===32?(e.enter("space"),e.consume(d),e.exit("space"),c):d===96?(s=e.enter("codeTextSequence"),i=0,p(d)):Fe(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(d))}function u(d){return d===null||d===32||d===96||Fe(d)?(e.exit("codeTextData"),c(d)):(e.consume(d),u)}function p(d){return d===96?(e.consume(d),i++,p):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(d)):(s.type="codeTextData",u(d))}}class F4{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&&Dl(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),Dl(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Dl(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);Dl(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Dl(this.left,n.reverse())}}}function Dl(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 UE(e){const t={};let n=-1,r,i,s,o,a,c,u;const p=new F4(e);for(;++n<p.length;){for(;n in t;)n=t[n];if(r=p.get(n),n&&r[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,s=0,s<c.length&&c[s][1].type==="lineEndingBlank"&&(s+=2),s<c.length&&c[s][1].type==="content"))for(;++s<c.length&&c[s][1].type!=="content";)c[s][1].type==="chunkText"&&(c[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,z4(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},a=p.slice(i,n),a.unshift(r),p.splice(i,n-i+1,a))}}return gi(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!u}function z4(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 a=o.events,c=[],u={};let p,d,f=-1,h=n,g=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),d&&o.defineSkip(h.start),h._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(p),h._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=h,h=h.next}for(h=n;++f<a.length;)a[f][0]==="exit"&&a[f-1][0]==="enter"&&a[f][1].type===a[f-1][1].type&&a[f][1].start.line!==a[f][1].end.line&&(b=f+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(),f=k.length;f--;){const y=a.slice(k[f],k[f+1]),v=s.pop();c.push([v,v+y.length-1]),e.splice(v,2,y)}for(c.reverse(),f=-1;++f<c.length;)u[g+c[f][0]]=g+c[f][1],g+=c[f][1]-c[f][0]-1;return u}const B4={resolve:U4,tokenize:V4},H4={partial:!0,tokenize:W4};function U4(e){return UE(e),e}function V4(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?s(a):Fe(a)?e.check(H4,o,s)(a):(e.consume(a),i)}function s(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function o(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function W4(e,t,n){const r=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),vt(e,s,"linePrefix")}function s(o){if(o===null||Fe(o))return n(o);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function VE(e,t,n,r,i,s,o,a,c){const u=c||Number.POSITIVE_INFINITY;let p=0;return d;function d(y){return y===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(y),e.exit(s),f):y===null||y===32||y===41||ay(y)?n(y):(e.enter(r),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),b(y))}function f(y){return y===62?(e.enter(s),e.consume(y),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),h(y))}function h(y){return y===62?(e.exit("chunkString"),e.exit(a),f(y)):y===null||y===60||Fe(y)?n(y):(e.consume(y),y===92?g:h)}function g(y){return y===60||y===62||y===92?(e.consume(y),h):h(y)}function b(y){return!p&&(y===null||y===41||Yn(y))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),t(y)):p<u&&y===40?(e.consume(y),p++,b):y===41?(e.consume(y),p--,b):y===null||y===32||y===40||ay(y)?n(y):(e.consume(y),y===92?k:b)}function k(y){return y===40||y===41||y===92?(e.consume(y),b):b(y)}}function WE(e,t,n,r,i,s){const o=this;let a=0,c;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 a>999||h===null||h===91||h===93&&!c||h===94&&!a&&"_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):Fe(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===null||h===91||h===93||Fe(h)||a++>999?(e.exit("chunkString"),p(h)):(e.consume(h),c||(c=!lt(h)),h===92?f:d)}function f(h){return h===91||h===92||h===93?(e.consume(h),a++,d):d(h)}}function KE(e,t,n,r,i,s){let o;return a;function a(f){return f===34||f===39||f===40?(e.enter(r),e.enter(i),e.consume(f),e.exit(i),o=f===40?41:f,c):n(f)}function c(f){return f===o?(e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):(e.enter(s),u(f))}function u(f){return f===o?(e.exit(s),c(o)):f===null?n(f):Fe(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),vt(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(f))}function p(f){return f===o||f===null||Fe(f)?(e.exit("chunkString"),u(f)):(e.consume(f),f===92?d:p)}function d(f){return f===o||f===92?(e.consume(f),p):p(f)}}function uc(e,t){let n;return r;function r(i){return Fe(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):lt(i)?vt(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const K4={name:"definition",tokenize:q4},Y4={partial:!0,tokenize:G4};function q4(e,t,n){const r=this;let i;return s;function s(h){return e.enter("definition"),o(h)}function o(h){return WE.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function a(h){return i=wa(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),c):n(h)}function c(h){return Yn(h)?uc(e,u)(h):u(h)}function u(h){return VE(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function p(h){return e.attempt(Y4,d,d)(h)}function d(h){return lt(h)?vt(e,f,"whitespace")(h):f(h)}function f(h){return h===null||Fe(h)?(e.exit("definition"),r.parser.defined.push(i),t(h)):n(h)}}function G4(e,t,n){return r;function r(a){return Yn(a)?uc(e,i)(a):n(a)}function i(a){return KE(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return lt(a)?vt(e,o,"whitespace")(a):o(a)}function o(a){return a===null||Fe(a)?t(a):n(a)}}const X4={name:"hardBreakEscape",tokenize:J4};function J4(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return Fe(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const Q4={name:"headingAtx",resolve:Z4,tokenize:e5};function Z4(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"},gi(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function e5(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||Yn(p)?(e.exit("atxHeadingSequence"),a(p)):n(p)}function a(p){return p===35?(e.enter("atxHeadingSequence"),c(p)):p===null||Fe(p)?(e.exit("atxHeading"),t(p)):lt(p)?vt(e,a,"whitespace")(p):(e.enter("atxHeadingText"),u(p))}function c(p){return p===35?(e.consume(p),c):(e.exit("atxHeadingSequence"),a(p))}function u(p){return p===null||p===35||Yn(p)?(e.exit("atxHeadingText"),a(p)):(e.consume(p),u)}}const t5=["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"],Ub=["pre","script","style","textarea"],n5={concrete:!0,name:"htmlFlow",resolveTo:s5,tokenize:o5},r5={partial:!0,tokenize:l5},i5={partial:!0,tokenize:a5};function s5(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 o5(e,t,n){const r=this;let i,s,o,a,c;return u;function u(O){return p(O)}function p(O){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(O),d}function d(O){return O===33?(e.consume(O),f):O===47?(e.consume(O),s=!0,b):O===63?(e.consume(O),i=3,r.interrupt?t:E):ai(O)?(e.consume(O),o=String.fromCharCode(O),k):n(O)}function f(O){return O===45?(e.consume(O),i=2,h):O===91?(e.consume(O),i=5,a=0,g):ai(O)?(e.consume(O),i=4,r.interrupt?t:E):n(O)}function h(O){return O===45?(e.consume(O),r.interrupt?t:E):n(O)}function g(O){const X="CDATA[";return O===X.charCodeAt(a++)?(e.consume(O),a===X.length?r.interrupt?t:A:g):n(O)}function b(O){return ai(O)?(e.consume(O),o=String.fromCharCode(O),k):n(O)}function k(O){if(O===null||O===47||O===62||Yn(O)){const X=O===47,se=o.toLowerCase();return!X&&!s&&Ub.includes(se)?(i=1,r.interrupt?t(O):A(O)):t5.includes(o.toLowerCase())?(i=6,X?(e.consume(O),y):r.interrupt?t(O):A(O)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(O):s?v(O):w(O))}return O===45||tr(O)?(e.consume(O),o+=String.fromCharCode(O),k):n(O)}function y(O){return O===62?(e.consume(O),r.interrupt?t:A):n(O)}function v(O){return lt(O)?(e.consume(O),v):H(O)}function w(O){return O===47?(e.consume(O),H):O===58||O===95||ai(O)?(e.consume(O),N):lt(O)?(e.consume(O),w):H(O)}function N(O){return O===45||O===46||O===58||O===95||tr(O)?(e.consume(O),N):C(O)}function C(O){return O===61?(e.consume(O),S):lt(O)?(e.consume(O),C):w(O)}function S(O){return O===null||O===60||O===61||O===62||O===96?n(O):O===34||O===39?(e.consume(O),c=O,P):lt(O)?(e.consume(O),S):R(O)}function P(O){return O===c?(e.consume(O),c=null,M):O===null||Fe(O)?n(O):(e.consume(O),P)}function R(O){return O===null||O===34||O===39||O===47||O===60||O===61||O===62||O===96||Yn(O)?C(O):(e.consume(O),R)}function M(O){return O===47||O===62||lt(O)?w(O):n(O)}function H(O){return O===62?(e.consume(O),_):n(O)}function _(O){return O===null||Fe(O)?A(O):lt(O)?(e.consume(O),_):n(O)}function A(O){return O===45&&i===2?(e.consume(O),$):O===60&&i===1?(e.consume(O),F):O===62&&i===4?(e.consume(O),q):O===63&&i===3?(e.consume(O),E):O===93&&i===5?(e.consume(O),T):Fe(O)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(r5,W,U)(O)):O===null||Fe(O)?(e.exit("htmlFlowData"),U(O)):(e.consume(O),A)}function U(O){return e.check(i5,L,W)(O)}function L(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),B}function B(O){return O===null||Fe(O)?U(O):(e.enter("htmlFlowData"),A(O))}function $(O){return O===45?(e.consume(O),E):A(O)}function F(O){return O===47?(e.consume(O),o="",I):A(O)}function I(O){if(O===62){const X=o.toLowerCase();return Ub.includes(X)?(e.consume(O),q):A(O)}return ai(O)&&o.length<8?(e.consume(O),o+=String.fromCharCode(O),I):A(O)}function T(O){return O===93?(e.consume(O),E):A(O)}function E(O){return O===62?(e.consume(O),q):O===45&&i===2?(e.consume(O),E):A(O)}function q(O){return O===null||Fe(O)?(e.exit("htmlFlowData"),W(O)):(e.consume(O),q)}function W(O){return e.exit("htmlFlow"),t(O)}}function a5(e,t,n){const r=this;return i;function i(o){return Fe(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 l5(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Hp,t,n)}}const c5={name:"htmlText",tokenize:u5};function u5(e,t,n){const r=this;let i,s,o;return a;function a(E){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(E),c}function c(E){return E===33?(e.consume(E),u):E===47?(e.consume(E),C):E===63?(e.consume(E),w):ai(E)?(e.consume(E),R):n(E)}function u(E){return E===45?(e.consume(E),p):E===91?(e.consume(E),s=0,g):ai(E)?(e.consume(E),v):n(E)}function p(E){return E===45?(e.consume(E),h):n(E)}function d(E){return E===null?n(E):E===45?(e.consume(E),f):Fe(E)?(o=d,F(E)):(e.consume(E),d)}function f(E){return E===45?(e.consume(E),h):d(E)}function h(E){return E===62?$(E):E===45?f(E):d(E)}function g(E){const q="CDATA[";return E===q.charCodeAt(s++)?(e.consume(E),s===q.length?b:g):n(E)}function b(E){return E===null?n(E):E===93?(e.consume(E),k):Fe(E)?(o=b,F(E)):(e.consume(E),b)}function k(E){return E===93?(e.consume(E),y):b(E)}function y(E){return E===62?$(E):E===93?(e.consume(E),y):b(E)}function v(E){return E===null||E===62?$(E):Fe(E)?(o=v,F(E)):(e.consume(E),v)}function w(E){return E===null?n(E):E===63?(e.consume(E),N):Fe(E)?(o=w,F(E)):(e.consume(E),w)}function N(E){return E===62?$(E):w(E)}function C(E){return ai(E)?(e.consume(E),S):n(E)}function S(E){return E===45||tr(E)?(e.consume(E),S):P(E)}function P(E){return Fe(E)?(o=P,F(E)):lt(E)?(e.consume(E),P):$(E)}function R(E){return E===45||tr(E)?(e.consume(E),R):E===47||E===62||Yn(E)?M(E):n(E)}function M(E){return E===47?(e.consume(E),$):E===58||E===95||ai(E)?(e.consume(E),H):Fe(E)?(o=M,F(E)):lt(E)?(e.consume(E),M):$(E)}function H(E){return E===45||E===46||E===58||E===95||tr(E)?(e.consume(E),H):_(E)}function _(E){return E===61?(e.consume(E),A):Fe(E)?(o=_,F(E)):lt(E)?(e.consume(E),_):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,U):Fe(E)?(o=A,F(E)):lt(E)?(e.consume(E),A):(e.consume(E),L)}function U(E){return E===i?(e.consume(E),i=void 0,B):E===null?n(E):Fe(E)?(o=U,F(E)):(e.consume(E),U)}function L(E){return E===null||E===34||E===39||E===60||E===61||E===96?n(E):E===47||E===62||Yn(E)?M(E):(e.consume(E),L)}function B(E){return E===47||E===62||Yn(E)?M(E):n(E)}function $(E){return E===62?(e.consume(E),e.exit("htmlTextData"),e.exit("htmlText"),t):n(E)}function F(E){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),I}function I(E){return lt(E)?vt(e,T,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):T(E)}function T(E){return e.enter("htmlTextData"),o(E)}}const Zx={name:"labelEnd",resolveAll:h5,resolveTo:m5,tokenize:g5},d5={tokenize:y5},f5={tokenize:x5},p5={tokenize:w5};function h5(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&&gi(e,0,e.length,n),e}function m5(e,t){let n=e.length,r=0,i,s,o,a;for(;n--;)if(i=e[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=n);const c={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},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 a=[["enter",c,t],["enter",u,t]],a=mr(a,e.slice(s+1,s+r+3)),a=mr(a,[["enter",p,t]]),a=mr(a,Qx(t.parser.constructs.insideSpan.null,e.slice(s+r+4,o-3),t)),a=mr(a,[["exit",p,t],e[o-2],e[o-1],["exit",u,t]]),a=mr(a,e.slice(o+1)),a=mr(a,[["exit",c,t]]),gi(e,s,e.length,a),e}function g5(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 a;function a(f){return s?s._inactive?d(f):(o=r.parser.defined.includes(wa(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),c):n(f)}function c(f){return f===40?e.attempt(d5,p,o?p:d)(f):f===91?e.attempt(f5,p,o?u:d)(f):o?p(f):d(f)}function u(f){return e.attempt(p5,p,d)(f)}function p(f){return t(f)}function d(f){return s._balanced=!0,n(f)}}function y5(e,t,n){return r;function r(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),i}function i(d){return Yn(d)?uc(e,s)(d):s(d)}function s(d){return d===41?p(d):VE(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return Yn(d)?uc(e,c)(d):p(d)}function a(d){return n(d)}function c(d){return d===34||d===39||d===40?KE(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):p(d)}function u(d){return Yn(d)?uc(e,p)(d):p(d)}function p(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):n(d)}}function x5(e,t,n){const r=this;return i;function i(a){return WE.call(r,e,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return r.parser.defined.includes(wa(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function w5(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 v5={name:"labelStartImage",resolveAll:Zx.resolveAll,tokenize:b5};function b5(e,t,n){const r=this;return i;function i(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),s}function s(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),o):n(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const k5={name:"labelStartLink",resolveAll:Zx.resolveAll,tokenize:S5};function S5(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 xm={name:"lineEnding",tokenize:N5};function N5(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),vt(e,t,"linePrefix")}}const lf={name:"thematicBreak",tokenize:j5};function j5(e,t,n){let r=0,i;return s;function s(u){return e.enter("thematicBreak"),o(u)}function o(u){return i=u,a(u)}function a(u){return u===i?(e.enter("thematicBreakSequence"),c(u)):r>=3&&(u===null||Fe(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===i?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),lt(u)?vt(e,a,"whitespace")(u):a(u))}}const $n={continuation:{tokenize:_5},exit:A5,name:"list",tokenize:P5},C5={partial:!0,tokenize:T5},E5={partial:!0,tokenize:I5};function P5(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 a;function a(h){const g=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:ly(h)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(lf,n,u)(h):u(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(h)}return n(h)}function c(h){return ly(h)&&++o<10?(e.consume(h),c):(!r.interrupt||o<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),u(h)):n(h)}function u(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check(Hp,r.interrupt?n:p,e.attempt(C5,f,d))}function p(h){return r.containerState.initialBlankLine=!0,s++,f(h)}function d(h){return lt(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),f):n(h)}function f(h){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function _5(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Hp,i,s);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,vt(e,t,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!lt(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(E5,t,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,vt(e,e.attempt($n,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function I5(e,t,n){const r=this;return vt(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 A5(e){e.exit(this.containerState.type)}function T5(e,t,n){const r=this;return vt(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!lt(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const Vb={name:"setextUnderline",resolveTo:R5,tokenize:L5};function R5(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 L5(e,t,n){const r=this;let i;return s;function s(u){let p=r.events.length,d;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){d=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),i=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),a(u)}function a(u){return u===i?(e.consume(u),a):(e.exit("setextHeadingLineSequence"),lt(u)?vt(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||Fe(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const O5={tokenize:M5};function M5(e){const t=this,n=e.attempt(Hp,r,e.attempt(this.parser.constructs.flowInitial,i,vt(e,e.attempt(this.parser.constructs.flow,i,e.attempt(B4,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 D5={resolveAll:qE()},$5=YE("string"),F5=YE("text");function YE(e){return{resolveAll:qE(e==="text"?z5:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],s=n.attempt(i,o,a);return o;function o(p){return u(p)?s(p):a(p)}function a(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),c}function c(p){return u(p)?(n.exit("data"),s(p)):(n.consume(p),c)}function u(p){if(p===null)return!0;const d=i[p];let f=-1;if(d)for(;++f<d.length;){const h=d[f];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function qE(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 z5(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,a=0,c;for(;s--;){const u=i[s];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(u===-2)c=!0,a++;else if(u!==-1){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const u={type:n===e.length||c||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:r.start._bufferIndex+o,_index:r.start._index+s,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},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 B5={42:$n,43:$n,45:$n,48:$n,49:$n,50:$n,51:$n,52:$n,53:$n,54:$n,55:$n,56:$n,57:$n,62:zE},H5={91:K4},U5={[-2]:ym,[-1]:ym,32:ym},V5={35:Q4,42:lf,45:[Vb,lf],60:n5,61:Vb,95:lf,96:Hb,126:Hb},W5={38:HE,92:BE},K5={[-5]:xm,[-4]:xm,[-3]:xm,33:v5,38:HE,42:cy,60:[k4,c5],91:k5,92:[X4,BE],93:Zx,95:cy,96:O4},Y5={null:[cy,D5]},q5={null:[42,95]},G5={null:[]},X5=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:q5,contentInitial:H5,disable:G5,document:B5,flow:V5,flowInitial:U5,insideSpan:Y5,string:W5,text:K5},Symbol.toStringTag,{value:"Module"}));function J5(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=[],a=[];const c={attempt:P(C),check:P(S),consume:v,enter:w,exit:N,interrupt:P(S,{interrupt:!0})},u={code:null,containerState:{},defineSkip:b,events:[],now:g,parser:e,previous:null,sliceSerialize:f,sliceStream:h,write:d};let p=t.tokenize.call(u,c);return t.resolveAll&&s.push(t),u;function d(_){return o=mr(o,_),k(),o[o.length-1]!==null?[]:(R(t,0),u.events=Qx(s,u.events,u),u.events)}function f(_,A){return Z5(h(_),A)}function h(_){return Q5(o,_)}function g(){const{_bufferIndex:_,_index:A,line:U,column:L,offset:B}=r;return{_bufferIndex:_,_index:A,line:U,column:L,offset:B}}function b(_){i[_.line]=_.column,H()}function k(){let _;for(;r._index<o.length;){const A=o[r._index];if(typeof A=="string")for(_=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===_&&r._bufferIndex<A.length;)y(A.charCodeAt(r._bufferIndex));else y(A)}}function y(_){p=p(_)}function v(_){Fe(_)?(r.line++,r.column=1,r.offset+=_===-3?2:1,H()):_!==-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=_}function w(_,A){const U=A||{};return U.type=_,U.start=g(),u.events.push(["enter",U,u]),a.push(U),U}function N(_){const A=a.pop();return A.end=g(),u.events.push(["exit",A,u]),A}function C(_,A){R(_,A.from)}function S(_,A){A.restore()}function P(_,A){return U;function U(L,B,$){let F,I,T,E;return Array.isArray(L)?W(L):"tokenize"in L?W([L]):q(L);function q(re){return de;function de(ie){const me=ie!==null&&re[ie],ye=ie!==null&&re.null,ke=[...Array.isArray(me)?me:me?[me]:[],...Array.isArray(ye)?ye:ye?[ye]:[]];return W(ke)(ie)}}function W(re){return F=re,I=0,re.length===0?$:O(re[I])}function O(re){return de;function de(ie){return E=M(),T=re,re.partial||(u.currentConstruct=re),re.name&&u.parser.constructs.disable.null.includes(re.name)?se():re.tokenize.call(A?Object.assign(Object.create(u),A):u,c,X,se)(ie)}}function X(re){return _(T,E),B}function se(re){return E.restore(),++I<F.length?O(F[I]):$}}}function R(_,A){_.resolveAll&&!s.includes(_)&&s.push(_),_.resolve&&gi(u.events,A,u.events.length-A,_.resolve(u.events.slice(A),u)),_.resolveTo&&(u.events=_.resolveTo(u.events,u))}function M(){const _=g(),A=u.previous,U=u.currentConstruct,L=u.events.length,B=Array.from(a);return{from:L,restore:$};function $(){r=_,u.previous=A,u.currentConstruct=U,u.events.length=L,a=B,H()}}function H(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Q5(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 a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}s>0&&o.push(e[i].slice(0,s))}return o}function Z5(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 eB(e){const r={constructs:a4([X5,...(e||{}).extensions||[]]),content:i(m4),defined:[],document:i(y4),flow:i(O5),lazy:{},string:i($5),text:i(F5)};return r;function i(s){return o;function o(a){return J5(r,s,a)}}}function tB(e){for(;!UE(e););return e}const Wb=/[\0\t\n\r]/g;function nB(){let e=1,t="",n=!0,r;return i;function i(s,o,a){const c=[];let u,p,d,f,h;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),d=0,t="",n&&(s.charCodeAt(0)===65279&&d++,n=void 0);d<s.length;){if(Wb.lastIndex=d,u=Wb.exec(s),f=u&&u.index!==void 0?u.index:s.length,h=s.charCodeAt(f),!u){t=s.slice(d);break}if(h===10&&d===f&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),d<f&&(c.push(s.slice(d,f)),e+=f-d),h){case 0:{c.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,c.push(-2);e++<p;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}d=f+1}return a&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const rB=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function iB(e){return e.replace(rB,sB)}function sB(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return FE(n.slice(s?2:1),s?16:10)}return Jx(n)||e}const GE={}.hasOwnProperty;function oB(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),aB(n)(tB(eB(n).document().write(nB()(e,t,!0))))}function aB(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(De),autolinkProtocol:M,autolinkEmail:M,atxHeading:s(We),blockQuote:s(ye),characterEscape:M,characterReference:M,codeFenced:s(ke),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(ke,o),codeText:s(he,o),codeTextData:M,data:M,codeFlowValue:M,definition:s(Se),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(Ve),hardBreakEscape:s(He),hardBreakTrailing:s(He),htmlFlow:s(ut,o),htmlFlowData:M,htmlText:s(ut,o),htmlTextData:M,image:s(Ge),label:o,link:s(De),listItem:s(Ut),listItemValue:f,listOrdered:s(kt,d),listUnordered:s(kt),paragraph:s(Ct),reference:O,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(We),strong:s(sn),thematicBreak:s(on)},exit:{atxHeading:c(),atxHeadingSequence:C,autolink:c(),autolinkEmail:me,autolinkProtocol:ie,blockQuote:c(),characterEscapeValue:H,characterReferenceMarkerHexadecimal:se,characterReferenceMarkerNumeric:se,characterReferenceValue:re,characterReference:de,codeFenced:c(k),codeFencedFence:b,codeFencedFenceInfo:h,codeFencedFenceMeta:g,codeFlowValue:H,codeIndented:c(y),codeText:c(B),codeTextData:H,data:H,definition:c(),definitionDestinationString:N,definitionLabelString:v,definitionTitleString:w,emphasis:c(),hardBreakEscape:c(A),hardBreakTrailing:c(A),htmlFlow:c(U),htmlFlowData:H,htmlText:c(L),htmlTextData:H,image:c(F),label:T,labelText:I,lineEnding:_,link:c($),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:X,resourceDestinationString:E,resourceTitleString:q,resource:W,setextHeading:c(R),setextHeadingLineSequence:P,setextHeadingText:S,strong:c(),thematicBreak:c()}};XE(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(Z){let oe={type:"root",children:[]};const je={stack:[oe],tokenStack:[],config:t,enter:a,exit:u,buffer:o,resume:p,data:n},$e=[];let xe=-1;for(;++xe<Z.length;)if(Z[xe][1].type==="listOrdered"||Z[xe][1].type==="listUnordered")if(Z[xe][0]==="enter")$e.push(xe);else{const Qe=$e.pop();xe=i(Z,Qe,xe)}for(xe=-1;++xe<Z.length;){const Qe=t[Z[xe][0]];GE.call(Qe,Z[xe][1].type)&&Qe[Z[xe][1].type].call(Object.assign({sliceSerialize:Z[xe][2].sliceSerialize},je),Z[xe][1])}if(je.tokenStack.length>0){const Qe=je.tokenStack[je.tokenStack.length-1];(Qe[1]||Kb).call(je,void 0,Qe[0])}for(oe.position={start:ns(Z.length>0?Z[0][1].start:{line:1,column:1,offset:0}),end:ns(Z.length>0?Z[Z.length-2][1].end:{line:1,column:1,offset:0})},xe=-1;++xe<t.transforms.length;)oe=t.transforms[xe](oe)||oe;return oe}function i(Z,oe,je){let $e=oe-1,xe=-1,Qe=!1,Et,we,pe,it;for(;++$e<=je;){const Pt=Z[$e];switch(Pt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Pt[0]==="enter"?xe++:xe--,it=void 0;break}case"lineEndingBlank":{Pt[0]==="enter"&&(Et&&!it&&!xe&&!pe&&(pe=$e),it=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:it=void 0}if(!xe&&Pt[0]==="enter"&&Pt[1].type==="listItemPrefix"||xe===-1&&Pt[0]==="exit"&&(Pt[1].type==="listUnordered"||Pt[1].type==="listOrdered")){if(Et){let Oe=$e;for(we=void 0;Oe--;){const ft=Z[Oe];if(ft[1].type==="lineEnding"||ft[1].type==="lineEndingBlank"){if(ft[0]==="exit")continue;we&&(Z[we][1].type="lineEndingBlank",Qe=!0),ft[1].type="lineEnding",we=Oe}else if(!(ft[1].type==="linePrefix"||ft[1].type==="blockQuotePrefix"||ft[1].type==="blockQuotePrefixWhitespace"||ft[1].type==="blockQuoteMarker"||ft[1].type==="listItemIndent"))break}pe&&(!we||pe<we)&&(Et._spread=!0),Et.end=Object.assign({},we?Z[we][1].start:Pt[1].end),Z.splice(we||$e,0,["exit",Et,Pt[2]]),$e++,je++}if(Pt[1].type==="listItemPrefix"){const Oe={type:"listItem",_spread:!1,start:Object.assign({},Pt[1].start),end:void 0};Et=Oe,Z.splice($e,0,["enter",Oe,Pt[2]]),$e++,je++,pe=void 0,it=!0}}}return Z[oe][1]._spread=Qe,je}function s(Z,oe){return je;function je($e){a.call(this,Z($e),$e),oe&&oe.call(this,$e)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(Z,oe,je){this.stack[this.stack.length-1].children.push(Z),this.stack.push(Z),this.tokenStack.push([oe,je||void 0]),Z.position={start:ns(oe.start),end:void 0}}function c(Z){return oe;function oe(je){Z&&Z.call(this,je),u.call(this,je)}}function u(Z,oe){const je=this.stack.pop(),$e=this.tokenStack.pop();if($e)$e[0].type!==Z.type&&(oe?oe.call(this,Z,$e[0]):($e[1]||Kb).call(this,Z,$e[0]));else throw new Error("Cannot close `"+Z.type+"` ("+cc({start:Z.start,end:Z.end})+"): it’s not open");je.position.end=ns(Z.end)}function p(){return s4(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(Z){if(this.data.expectingFirstListItemValue){const oe=this.stack[this.stack.length-2];oe.start=Number.parseInt(this.sliceSerialize(Z),10),this.data.expectingFirstListItemValue=void 0}}function h(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.lang=Z}function g(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.meta=Z}function b(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function k(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z.replace(/(\r?\n|\r)$/g,"")}function v(Z){const oe=this.resume(),je=this.stack[this.stack.length-1];je.label=oe,je.identifier=wa(this.sliceSerialize(Z)).toLowerCase()}function w(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.title=Z}function N(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.url=Z}function C(Z){const oe=this.stack[this.stack.length-1];if(!oe.depth){const je=this.sliceSerialize(Z).length;oe.depth=je}}function S(){this.data.setextHeadingSlurpLineEnding=!0}function P(Z){const oe=this.stack[this.stack.length-1];oe.depth=this.sliceSerialize(Z).codePointAt(0)===61?1:2}function R(){this.data.setextHeadingSlurpLineEnding=void 0}function M(Z){const je=this.stack[this.stack.length-1].children;let $e=je[je.length-1];(!$e||$e.type!=="text")&&($e=pn(),$e.position={start:ns(Z.start),end:void 0},je.push($e)),this.stack.push($e)}function H(Z){const oe=this.stack.pop();oe.value+=this.sliceSerialize(Z),oe.position.end=ns(Z.end)}function _(Z){const oe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const je=oe.children[oe.children.length-1];je.position.end=ns(Z.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(oe.type)&&(M.call(this,Z),H.call(this,Z))}function A(){this.data.atHardBreak=!0}function U(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z}function L(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z}function B(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z}function $(){const Z=this.stack[this.stack.length-1];if(this.data.inReference){const oe=this.data.referenceType||"shortcut";Z.type+="Reference",Z.referenceType=oe,delete Z.url,delete Z.title}else delete Z.identifier,delete Z.label;this.data.referenceType=void 0}function F(){const Z=this.stack[this.stack.length-1];if(this.data.inReference){const oe=this.data.referenceType||"shortcut";Z.type+="Reference",Z.referenceType=oe,delete Z.url,delete Z.title}else delete Z.identifier,delete Z.label;this.data.referenceType=void 0}function I(Z){const oe=this.sliceSerialize(Z),je=this.stack[this.stack.length-2];je.label=iB(oe),je.identifier=wa(oe).toLowerCase()}function T(){const Z=this.stack[this.stack.length-1],oe=this.resume(),je=this.stack[this.stack.length-1];if(this.data.inReference=!0,je.type==="link"){const $e=Z.children;je.children=$e}else je.alt=oe}function E(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.url=Z}function q(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.title=Z}function W(){this.data.inReference=void 0}function O(){this.data.referenceType="collapsed"}function X(Z){const oe=this.resume(),je=this.stack[this.stack.length-1];je.label=oe,je.identifier=wa(this.sliceSerialize(Z)).toLowerCase(),this.data.referenceType="full"}function se(Z){this.data.characterReferenceType=Z.type}function re(Z){const oe=this.sliceSerialize(Z),je=this.data.characterReferenceType;let $e;je?($e=FE(oe,je==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):$e=Jx(oe);const xe=this.stack[this.stack.length-1];xe.value+=$e}function de(Z){const oe=this.stack.pop();oe.position.end=ns(Z.end)}function ie(Z){H.call(this,Z);const oe=this.stack[this.stack.length-1];oe.url=this.sliceSerialize(Z)}function me(Z){H.call(this,Z);const oe=this.stack[this.stack.length-1];oe.url="mailto:"+this.sliceSerialize(Z)}function ye(){return{type:"blockquote",children:[]}}function ke(){return{type:"code",lang:null,meta:null,value:""}}function he(){return{type:"inlineCode",value:""}}function Se(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ve(){return{type:"emphasis",children:[]}}function We(){return{type:"heading",depth:0,children:[]}}function He(){return{type:"break"}}function ut(){return{type:"html",value:""}}function Ge(){return{type:"image",title:null,url:"",alt:null}}function De(){return{type:"link",title:null,url:"",children:[]}}function kt(Z){return{type:"list",ordered:Z.type==="listOrdered",start:null,spread:Z._spread,children:[]}}function Ut(Z){return{type:"listItem",spread:Z._spread,checked:null,children:[]}}function Ct(){return{type:"paragraph",children:[]}}function sn(){return{type:"strong",children:[]}}function pn(){return{type:"text",value:""}}function on(){return{type:"thematicBreak"}}}function ns(e){return{line:e.line,column:e.column,offset:e.offset}}function XE(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?XE(e,r):lB(e,r)}}function lB(e,t){let n;for(n in t)if(GE.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 Kb(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+cc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+cc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+cc({start:t.start,end:t.end})+") is still open")}function cB(e){const t=this;t.parser=n;function n(r){return oB(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function uB(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 dB(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
70
|
-
`}]}function fB(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 pB(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function hB(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function mB(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=Wa(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let o,a=e.footnoteCounts.get(r);a===void 0?(a=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=s+1,a+=1,e.footnoteCounts.set(r,a);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function gB(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 yB(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function JE(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 xB(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return JE(e,t);const i={src:Wa(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 wB(e,t){const n={src:Wa(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 vB(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 bB(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return JE(e,t);const i={href:Wa(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 kB(e,t){const n={href:Wa(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 SB(e,t,n){const r=e.all(t),i=n?NB(n):QE(t),s={},o=[];if(typeof t.checked=="boolean"){const p=r[0];let d;p&&p.type==="element"&&p.tagName==="p"?d=p:(d={type:"element",tagName:"p",properties:{},children:[]},r.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const p=r[a];(i||a!==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 c=r[r.length-1];c&&(i||c.type!=="element"||c.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 NB(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=QE(n[r])}return t}function QE(e){const t=e.spread;return t??e.children.length>1}function jB(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 CB(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function EB(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function PB(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function _B(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)},a=Yx(t.children[1]),c=TE(t.children[t.children.length-1]);a&&c&&(o.position={start:a,end:c}),i.push(o)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)}function IB(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,a=o?o.length:t.children.length;let c=-1;const u=[];for(;++c<a;){const d=t.children[c],f={},h=o?o[c]:void 0;h&&(f.align=h);let g={type:"element",tagName:s,properties:f,children:[]};d&&(g.children=e.all(d),e.patch(d,g),g=e.applyData(d,g)),u.push(g)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,p),e.applyData(t,p)}function AB(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Yb=9,qb=32;function TB(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const s=[];for(;r;)s.push(Gb(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return s.push(Gb(t.slice(i),i>0,!1)),s.join("")}function Gb(e,t,n){let r=0,i=e.length;if(t){let s=e.codePointAt(r);for(;s===Yb||s===qb;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(i-1);for(;s===Yb||s===qb;)i--,s=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function RB(e,t){const n={type:"text",value:TB(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function LB(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const OB={blockquote:uB,break:dB,code:fB,delete:pB,emphasis:hB,footnoteReference:mB,heading:gB,html:yB,imageReference:xB,image:wB,inlineCode:vB,linkReference:bB,link:kB,listItem:SB,list:jB,paragraph:CB,root:EB,strong:PB,table:_B,tableCell:AB,tableRow:IB,text:RB,thematicBreak:LB,toml:Id,yaml:Id,definition:Id,footnoteDefinition:Id};function Id(){}const ZE=-1,Up=0,dc=1,Gf=2,ew=3,tw=4,nw=5,rw=6,eP=7,tP=8,Xb=typeof self=="object"?self:globalThis,MB=(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 Up:case ZE:return n(o,i);case dc:{const a=n([],i);for(const c of o)a.push(r(c));return a}case Gf:{const a=n({},i);for(const[c,u]of o)a[r(c)]=r(u);return a}case ew:return n(new Date(o),i);case tw:{const{source:a,flags:c}=o;return n(new RegExp(a,c),i)}case nw:{const a=n(new Map,i);for(const[c,u]of o)a.set(r(c),r(u));return a}case rw:{const a=n(new Set,i);for(const c of o)a.add(r(c));return a}case eP:{const{name:a,message:c}=o;return n(new Xb[a](c),i)}case tP: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:a}=new Uint8Array(o);return n(new DataView(a),o)}}return n(new Xb[s](o),i)};return r},Jb=e=>MB(new Map,e)(0),Fo="",{toString:DB}={},{keys:$B}=Object,$l=e=>{const t=typeof e;if(t!=="object"||!e)return[Up,t];const n=DB.call(e).slice(8,-1);switch(n){case"Array":return[dc,Fo];case"Object":return[Gf,Fo];case"Date":return[ew,Fo];case"RegExp":return[tw,Fo];case"Map":return[nw,Fo];case"Set":return[rw,Fo];case"DataView":return[dc,n]}return n.includes("Array")?[dc,n]:n.includes("Error")?[eP,n]:[Gf,n]},Ad=([e,t])=>e===Up&&(t==="function"||t==="symbol"),FB=(e,t,n,r)=>{const i=(o,a)=>{const c=r.push(o)-1;return n.set(a,c),c},s=o=>{if(n.has(o))return n.get(o);let[a,c]=$l(o);switch(a){case Up:{let p=o;switch(c){case"bigint":a=tP,p=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);p=null;break;case"undefined":return i([ZE],o)}return i([a,p],o)}case dc:{if(c){let f=o;return c==="DataView"?f=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(f=new Uint8Array(o)),i([c,[...f]],o)}const p=[],d=i([a,p],o);for(const f of o)p.push(s(f));return d}case Gf:{if(c)switch(c){case"BigInt":return i([c,o.toString()],o);case"Boolean":case"Number":case"String":return i([c,o.valueOf()],o)}if(t&&"toJSON"in o)return s(o.toJSON());const p=[],d=i([a,p],o);for(const f of $B(o))(e||!Ad($l(o[f])))&&p.push([s(f),s(o[f])]);return d}case ew:return i([a,o.toISOString()],o);case tw:{const{source:p,flags:d}=o;return i([a,{source:p,flags:d}],o)}case nw:{const p=[],d=i([a,p],o);for(const[f,h]of o)(e||!(Ad($l(f))||Ad($l(h))))&&p.push([s(f),s(h)]);return d}case rw:{const p=[],d=i([a,p],o);for(const f of o)(e||!Ad($l(f)))&&p.push(s(f));return d}}const{message:u}=o;return i([a,{name:c,message:u}],o)};return s},Qb=(e,{json:t,lossy:n}={})=>{const r=[];return FB(!(t||n),!!t,new Map,r)(e),r},Xf=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Jb(Qb(e,t)):structuredClone(e):(e,t)=>Jb(Qb(e,t));function zB(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 BB(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function HB(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||zB,r=e.options.footnoteBackLabel||BB,i=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let c=-1;for(;++c<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[c]);if(!u)continue;const p=e.all(u),d=String(u.identifier).toUpperCase(),f=Wa(d.toLowerCase());let h=0;const g=[],b=e.footnoteCounts.get(d);for(;b!==void 0&&++h<=b;){g.length>0&&g.push({type:"text",value:" "});let v=typeof n=="string"?n:n(c,h);typeof v=="string"&&(v={type:"text",value:v}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+f+(h>1?"-"+h:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,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(...g)}else p.push(...g);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+f},children:e.wrap(p,!0)};e.patch(u,y),a.push(y)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...Xf(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
74
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
|
|
75
|
-
`}]}}const nP=function(e){if(e==null)return KB;if(typeof e=="function")return Vp(e);if(typeof e=="object")return Array.isArray(e)?UB(e):VB(e);if(typeof e=="string")return WB(e);throw new Error("Expected function, string, or object as test")};function UB(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=nP(e[n]);return Vp(r);function r(...i){let s=-1;for(;++s<t.length;)if(t[s].apply(this,i))return!0;return!1}}function VB(e){const t=e;return Vp(n);function n(r){const i=r;let s;for(s in e)if(i[s]!==t[s])return!1;return!0}}function WB(e){return Vp(t);function t(n){return n&&n.type===e}}function Vp(e){return t;function t(n,r,i){return!!(YB(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function KB(){return!0}function YB(e){return e!==null&&typeof e=="object"&&"type"in e}const rP=[],qB=!0,Zb=!1,GB="skip";function XB(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const s=nP(i),o=r?-1:1;a(e,void 0,[])();function a(c,u,p){const d=c&&typeof c=="object"?c:{};if(typeof d.type=="string"){const h=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(c.type+(h?"<"+h+">":""))+")"})}return f;function f(){let h=rP,g,b,k;if((!t||s(c,u,p[p.length-1]||void 0))&&(h=JB(n(c,p)),h[0]===Zb))return h;if("children"in c&&c.children){const y=c;if(y.children&&h[0]!==GB)for(b=(r?y.children.length:-1)+o,k=p.concat(y);b>-1&&b<y.children.length;){const v=y.children[b];if(g=a(v,b,k)(),g[0]===Zb)return g;b=typeof g[1]=="number"?g[1]:b+o}}return h}}}function JB(e){return Array.isArray(e)?e:typeof e=="number"?[qB,e]:e==null?rP:[e]}function iP(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),XB(e,s,a,i);function a(c,u){const p=u[u.length-1],d=p?p.children.indexOf(c):void 0;return o(c,d,p)}}const uy={}.hasOwnProperty,QB={};function ZB(e,t){const n=t||QB,r=new Map,i=new Map,s=new Map,o={...OB,...n.handlers},a={all:u,applyData:tH,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:c,options:n,patch:eH,wrap:rH};return iP(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const d=p.type==="definition"?r:i,f=String(p.identifier).toUpperCase();d.has(f)||d.set(f,p)}}),a;function c(p,d){const f=p.type,h=a.handlers[f];if(uy.call(a.handlers,f)&&h)return h(a,p,d);if(a.options.passThrough&&a.options.passThrough.includes(f)){if("children"in p){const{children:b,...k}=p,y=Xf(k);return y.children=a.all(p),y}return Xf(p)}return(a.options.unknownHandler||nH)(a,p,d)}function u(p){const d=[];if("children"in p){const f=p.children;let h=-1;for(;++h<f.length;){const g=a.one(f[h],p);if(g){if(h&&f[h-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=ek(g.value)),!Array.isArray(g)&&g.type==="element")){const b=g.children[0];b&&b.type==="text"&&(b.value=ek(b.value))}Array.isArray(g)?d.push(...g):d.push(g)}}}return d}}function eH(e,t){e.position&&(t.position=Dz(e))}function tH(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,Xf(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function nH(e,t){const n=t.data||{},r="value"in t&&!(uy.call(n,"hProperties")||uy.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 rH(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 ek(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function tk(e,t){const n=ZB(e,t),r=n.one(e,void 0),i=HB(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 iH(e,t){return e&&"run"in e?async function(n,r){const i=tk(n,{file:r,...t});await e.run(i,r)}:function(n,r){return tk(n,{file:r,...e||t})}}function nk(e){if(e)throw e}var cf=Object.prototype.hasOwnProperty,sP=Object.prototype.toString,rk=Object.defineProperty,ik=Object.getOwnPropertyDescriptor,sk=function(t){return typeof Array.isArray=="function"?Array.isArray(t):sP.call(t)==="[object Array]"},ok=function(t){if(!t||sP.call(t)!=="[object Object]")return!1;var n=cf.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&cf.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||cf.call(t,i)},ak=function(t,n){rk&&n.name==="__proto__"?rk(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},lk=function(t,n){if(n==="__proto__")if(cf.call(t,n)){if(ik)return ik(t,n).value}else return;return t[n]},sH=function e(){var t,n,r,i,s,o,a=arguments[0],c=1,u=arguments.length,p=!1;for(typeof a=="boolean"&&(p=a,a=arguments[1]||{},c=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});c<u;++c)if(t=arguments[c],t!=null)for(n in t)r=lk(a,n),i=lk(t,n),a!==i&&(p&&i&&(ok(i)||(s=sk(i)))?(s?(s=!1,o=r&&sk(r)?r:[]):o=r&&ok(r)?r:{},ak(a,{name:n,newValue:e(p,o,i)})):typeof i<"u"&&ak(a,{name:n,newValue:i}));return a};const wm=_s(sH);function dy(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 oH(){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);a(null,...i);function a(c,...u){const p=e[++s];let d=-1;if(c){o(c);return}for(;++d<i.length;)(u[d]===null||u[d]===void 0)&&(u[d]=i[d]);i=u,p?aH(p,a)(...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 aH(e,t){let n;return r;function r(...o){const a=e.length>o.length;let c;a&&o.push(i);try{c=e.apply(this,o)}catch(u){const p=u;if(a&&n)throw p;return i(p)}a||(c&&c.then&&typeof c.then=="function"?c.then(s,i):c instanceof Error?i(c):s(c))}function i(o,...a){n||(n=!0,t(o,...a))}function s(o){i(null,o)}}const ni={basename:lH,dirname:cH,extname:uH,join:dH,sep:"/"};function lH(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');fu(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,a=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else o<0&&(s=!0,o=i+1),a>-1&&(e.codePointAt(i)===t.codePointAt(a--)?a<0&&(r=i):(a=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function cH(e){if(fu(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 uH(e){fu(e);let t=e.length,n=-1,r=0,i=-1,s=0,o;for(;t--;){const a=e.codePointAt(t);if(a===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),a===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 dH(...e){let t=-1,n;for(;++t<e.length;)fu(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":fH(n)}function fH(e){fu(e);const t=e.codePointAt(0)===47;let n=pH(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function pH(e,t){let n="",r=0,i=-1,s=0,o=-1,a,c;for(;++o<=e.length;){if(o<e.length)a=e.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(i===o-1||s===1))if(i!==o-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),i=o,s=0;continue}}else if(n.length>0){n="",r=0,i=o,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,s=0}else a===46&&s>-1?s++:s=-1}return n}function fu(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const hH={cwd:mH};function mH(){return"/"}function fy(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function gH(e){if(typeof e=="string")e=new URL(e);else if(!fy(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 yH(e)}function yH(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 vm=["history","path","basename","stem","extname","dirname"];class oP{constructor(t){let n;t?fy(t)?n={path:t}:typeof t=="string"||xH(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":hH.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<vm.length;){const s=vm[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)vm.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?ni.basename(this.path):void 0}set basename(t){km(t,"basename"),bm(t,"basename"),this.path=ni.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?ni.dirname(this.path):void 0}set dirname(t){ck(this.basename,"dirname"),this.path=ni.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?ni.extname(this.path):void 0}set extname(t){if(bm(t,"extname"),ck(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=ni.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){fy(t)&&(t=gH(t)),km(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?ni.basename(this.path,this.extname):void 0}set stem(t){km(t,"stem"),bm(t,"stem"),this.path=ni.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 jn(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 bm(e,t){if(e&&e.includes(ni.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ni.sep+"`")}function km(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function ck(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function xH(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const wH=function(e){const r=this.constructor.prototype,i=r[e],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s},vH={}.hasOwnProperty;class iw extends wH{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=oH()}copy(){const t=new iw;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(wm(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(jm("data",this.frozen),this.namespace[t]=n,this):vH.call(this.namespace,t)&&this.namespace[t]||void 0:t?(jm("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=Td(t),r=this.parser||this.Parser;return Sm("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Sm("process",this.parser||this.Parser),Nm("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,o){const a=Td(t),c=r.parse(a);r.run(c,a,function(p,d,f){if(p||!d||!f)return u(p);const h=d,g=r.stringify(h,f);SH(g)?f.value=g:f.result=g,u(p,f)});function u(p,d){p||!d?o(p):s?s(d):n(void 0,d)}}}processSync(t){let n=!1,r;return this.freeze(),Sm("processSync",this.parser||this.Parser),Nm("processSync",this.compiler||this.Compiler),this.process(t,i),dk("processSync","process",n),r;function i(s,o){n=!0,nk(s),r=o}}run(t,n,r){uk(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,a){const c=Td(n);i.run(t,c,u);function u(p,d,f){const h=d||t;p?a(p):o?o(h):r(void 0,h,f)}}}runSync(t,n){let r=!1,i;return this.run(t,n,s),dk("runSync","run",r),i;function s(o,a){nk(o),i=a,r=!0}}stringify(t,n){this.freeze();const r=Td(n),i=this.compiler||this.Compiler;return Nm("stringify",i),uk(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(jm("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?a(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function s(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[p,...d]=u;c(p,d)}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");a(u.plugins),u.settings&&(i.settings=wm(!0,i.settings,u.settings))}function a(u){let p=-1;if(u!=null)if(Array.isArray(u))for(;++p<u.length;){const d=u[p];s(d)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,p){let d=-1,f=-1;for(;++d<r.length;)if(r[d][0]===u){f=d;break}if(f===-1)r.push([u,...p]);else if(p.length>0){let[h,...g]=p;const b=r[f][1];dy(b)&&dy(h)&&(h=wm(!0,b,h)),r[f]=[u,h,...g]}}}}const bH=new iw().freeze();function Sm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Nm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function jm(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 uk(e){if(!dy(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function dk(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Td(e){return kH(e)?e:new oP(e)}function kH(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function SH(e){return typeof e=="string"||NH(e)}function NH(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const jH="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",fk=[],pk={allowDangerousHtml:!0},CH=/^(https?|ircs?|mailto|xmpp)$/i,EH=[{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 pu(e){const t=PH(e),n=_H(e);return IH(t.runSync(t.parse(n),n),e)}function PH(e){const t=e.rehypePlugins||fk,n=e.remarkPlugins||fk,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...pk}:pk;return bH().use(cB).use(n).use(iH,r).use(t)}function _H(e){const t=e.children||"",n=new oP;return typeof t=="string"&&(n.value=t),n}function IH(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,s=t.disallowedElements,o=t.skipHtml,a=t.unwrapDisallowed,c=t.urlTransform||AH;for(const p of EH)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+jH+p.id,void 0);return iP(e,u),Hz(e,{Fragment:l.Fragment,components:i,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function u(p,d,f){if(p.type==="raw"&&f&&typeof d=="number")return o?f.children.splice(d,1):f.children[d]={type:"text",value:p.value},d;if(p.type==="element"){let h;for(h in gm)if(Object.hasOwn(gm,h)&&Object.hasOwn(p.properties,h)){const g=p.properties[h],b=gm[h];(b===null||b.includes(p.tagName))&&(p.properties[h]=c(String(g||""),h,p))}}if(p.type==="element"){let h=n?!n.includes(p.tagName):s?s.includes(p.tagName):!1;if(!h&&r&&typeof d=="number"&&(h=!r(p,d,f)),h&&f&&typeof d=="number")return a&&p.children?f.children.splice(d,1,...p.children):f.children.splice(d,1),d}}}function AH(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||CH.test(e.slice(0,t))?e:""}function TH(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function Jf(e){if(e==null)return"null";if(typeof e!="object")return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(r=>Jf(r)).join(",")}]`;const t=e;return`{${Object.keys(t).sort().map(r=>`${JSON.stringify(r)}:${Jf(t[r])}`).join(",")}}`}function hk(e){return Jf({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 Uc(e){const t=e.sourceHandle??"",n=e.targetHandle??"";return`${e.source}|${t}|${e.target}|${n}`}function mk(e){return Jf({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 gk(e,t){return!TH(t)||!("selected"in t)||t.selected===e.selected?e:{...e,selected:!!t.selected}}function yk(e,t=!1){const n=new Map;for(const r of e){const i=Uc(r);if(t&&n.has(i))throw new Error(`存在重复连线键: ${i}`);n.set(i,r)}return n}function RH(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,a=[],c=[],u=n.map(v=>{const w=i.get(v.id);return w?hk(w)===hk(v)?(o.add(v.id),w):(c.push(v.id),gk(v,w)):(a.push(v.id),v)}),p=yk(t),d=yk(r,!0),f=new Set,h=[],g=[],b=r.map(v=>{const w=Uc(v),N=p.get(w);return N?mk(N)===mk(v)?(f.add(w),N):(g.push(w),gk(v,N)):(h.push(w),v)}),k=e.filter(v=>!s.has(v.id)).map(v=>v.id),y=t.map(v=>Uc(v)).filter(v=>!d.has(v));return{nodes:u,edges:b,changes:{addedNodeIds:a,updatedNodeIds:c,removedNodeIds:k,addedEdgeKeys:h,updatedEdgeKeys:g,removedEdgeKeys:y},stats:{nodeAdded:a.length,nodeRemoved:k.length,nodeReused:o.size,edgeAdded:h.length,edgeRemoved:y.length,edgeReused:f.size,nextEdgeCount:d.size}}}/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */function aP(e){return typeof e>"u"||e===null}function LH(e){return typeof e=="object"&&e!==null}function OH(e){return Array.isArray(e)?e:aP(e)?[]:[e]}function MH(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 DH(e,t){var n="",r;for(r=0;r<t;r+=1)n+=e;return n}function $H(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var FH=aP,zH=LH,BH=OH,HH=DH,UH=$H,VH=MH,Jt={isNothing:FH,isObject:zH,toArray:BH,repeat:HH,isNegativeZero:UH,extend:VH};function lP(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 Vc(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=lP(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}Vc.prototype=Object.create(Error.prototype);Vc.prototype.constructor=Vc;Vc.prototype.toString=function(t){return this.name+": "+lP(this,t)};var In=Vc;function Cm(e,t,n,r,i){var s="",o="",a=Math.floor(i/2)-1;return r-t>a&&(s=" ... ",t=r-a+s.length),n-r>a&&(o=" ...",n=r+a-o.length),{str:s+e.slice(t,n).replace(/\t/g,"→")+o,pos:r-t+s.length}}function Em(e,t){return Jt.repeat(" ",t-e.length)+e}function WH(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 a="",c,u,p=Math.min(e.line+t.linesAfter,i.length).toString().length,d=t.maxLength-(t.indent+p+3);for(c=1;c<=t.linesBefore&&!(o-c<0);c++)u=Cm(e.buffer,r[o-c],i[o-c],e.position-(r[o]-r[o-c]),d),a=Jt.repeat(" ",t.indent)+Em((e.line-c+1).toString(),p)+" | "+u.str+`
|
|
82
|
-
`+a;for(u=Cm(e.buffer,r[o],i[o],e.position,d),a+=Jt.repeat(" ",t.indent)+Em((e.line+1).toString(),p)+" | "+u.str+`
|
|
83
|
-
`,a+=Jt.repeat("-",t.indent+p+3+u.pos)+`^
|
|
84
|
-
`,c=1;c<=t.linesAfter&&!(o+c>=i.length);c++)u=Cm(e.buffer,r[o+c],i[o+c],e.position-(r[o]-r[o+c]),d),a+=Jt.repeat(" ",t.indent)+Em((e.line+c+1).toString(),p)+" | "+u.str+`
|
|
85
|
-
`;return a.replace(/\n$/,"")}var KH=WH,YH=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],qH=["scalar","sequence","mapping"];function GH(e){var t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(r){t[String(r)]=n})}),t}function XH(e,t){if(t=t||{},Object.keys(t).forEach(function(n){if(YH.indexOf(n)===-1)throw new In('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=GH(t.styleAliases||null),qH.indexOf(this.kind)===-1)throw new In('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var un=XH;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 JH(){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 py(e){return this.extend(e)}py.prototype.extend=function(t){var n=[],r=[];if(t instanceof un)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 In("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(s){if(!(s instanceof un))throw new In("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(s.loadKind&&s.loadKind!=="scalar")throw new In("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 In("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 un))throw new In("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(py.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=JH(i.compiledImplicit,i.compiledExplicit),i};var cP=py,uP=new un("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),dP=new un("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),fP=new un("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),pP=new cP({explicit:[uP,dP,fP]});function QH(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function ZH(){return null}function e6(e){return e===null}var hP=new un("tag:yaml.org,2002:null",{kind:"scalar",resolve:QH,construct:ZH,predicate:e6,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function t6(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 n6(e){return e==="true"||e==="True"||e==="TRUE"}function r6(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var mP=new un("tag:yaml.org,2002:bool",{kind:"scalar",resolve:t6,construct:n6,predicate:r6,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 i6(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function s6(e){return 48<=e&&e<=55}function o6(e){return 48<=e&&e<=57}function a6(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(!i6(e.charCodeAt(n)))return!1;r=!0}return r&&i!=="_"}if(i==="o"){for(n++;n<t;n++)if(i=e[n],i!=="_"){if(!s6(e.charCodeAt(n)))return!1;r=!0}return r&&i!=="_"}}if(i==="_")return!1;for(;n<t;n++)if(i=e[n],i!=="_"){if(!o6(e.charCodeAt(n)))return!1;r=!0}return!(!r||i==="_")}function l6(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 c6(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!Jt.isNegativeZero(e)}var gP=new un("tag:yaml.org,2002:int",{kind:"scalar",resolve:a6,construct:l6,predicate:c6,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"]}}),u6=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function d6(e){return!(e===null||!u6.test(e)||e[e.length-1]==="_")}function f6(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 p6=/^[-+]?[0-9]+e/;function h6(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(Jt.isNegativeZero(e))return"-0.0";return n=e.toString(10),p6.test(n)?n.replace("e",".e"):n}function m6(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||Jt.isNegativeZero(e))}var yP=new un("tag:yaml.org,2002:float",{kind:"scalar",resolve:d6,construct:f6,predicate:m6,represent:h6,defaultStyle:"lowercase"}),xP=pP.extend({implicit:[hP,mP,gP,yP]}),wP=xP,vP=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),bP=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 g6(e){return e===null?!1:vP.exec(e)!==null||bP.exec(e)!==null}function y6(e){var t,n,r,i,s,o,a,c=0,u=null,p,d,f;if(t=vP.exec(e),t===null&&(t=bP.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],a=+t[6],t[7]){for(c=t[7].slice(0,3);c.length<3;)c+="0";c=+c}return t[9]&&(p=+t[10],d=+(t[11]||0),u=(p*60+d)*6e4,t[9]==="-"&&(u=-u)),f=new Date(Date.UTC(n,r,i,s,o,a,c)),u&&f.setTime(f.getTime()-u),f}function x6(e){return e.toISOString()}var kP=new un("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:g6,construct:y6,instanceOf:Date,represent:x6});function w6(e){return e==="<<"||e===null}var SP=new un("tag:yaml.org,2002:merge",{kind:"scalar",resolve:w6}),sw=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
86
|
-
\r`;function v6(e){if(e===null)return!1;var t,n,r=0,i=e.length,s=sw;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 b6(e){var t,n,r=e.replace(/[\r\n=]/g,""),i=r.length,s=sw,o=0,a=[];for(t=0;t<i;t++)t%4===0&&t&&(a.push(o>>16&255),a.push(o>>8&255),a.push(o&255)),o=o<<6|s.indexOf(r.charAt(t));return n=i%4*6,n===0?(a.push(o>>16&255),a.push(o>>8&255),a.push(o&255)):n===18?(a.push(o>>10&255),a.push(o>>2&255)):n===12&&a.push(o>>4&255),new Uint8Array(a)}function k6(e){var t="",n=0,r,i,s=e.length,o=sw;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 S6(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var NP=new un("tag:yaml.org,2002:binary",{kind:"scalar",resolve:v6,construct:b6,predicate:S6,represent:k6}),N6=Object.prototype.hasOwnProperty,j6=Object.prototype.toString;function C6(e){if(e===null)return!0;var t=[],n,r,i,s,o,a=e;for(n=0,r=a.length;n<r;n+=1){if(i=a[n],o=!1,j6.call(i)!=="[object Object]")return!1;for(s in i)if(N6.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 E6(e){return e!==null?e:[]}var jP=new un("tag:yaml.org,2002:omap",{kind:"sequence",resolve:C6,construct:E6}),P6=Object.prototype.toString;function _6(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],P6.call(r)!=="[object Object]"||(i=Object.keys(r),i.length!==1))return!1;s[t]=[i[0],r[i[0]]]}return!0}function I6(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 CP=new un("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:_6,construct:I6}),A6=Object.prototype.hasOwnProperty;function T6(e){if(e===null)return!0;var t,n=e;for(t in n)if(A6.call(n,t)&&n[t]!==null)return!1;return!0}function R6(e){return e!==null?e:{}}var EP=new un("tag:yaml.org,2002:set",{kind:"mapping",resolve:T6,construct:R6}),ow=wP.extend({implicit:[kP,SP],explicit:[NP,jP,CP,EP]}),Cs=Object.prototype.hasOwnProperty,Qf=1,PP=2,_P=3,Zf=4,Pm=1,L6=2,wk=3,O6=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,M6=/[\x85\u2028\u2029]/,D6=/[,\[\]\{\}]/,IP=/^(?:!|!!|![a-z\-]+!)$/i,AP=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function vk(e){return Object.prototype.toString.call(e)}function fi(e){return e===10||e===13}function oo(e){return e===9||e===32}function Hn(e){return e===9||e===32||e===10||e===13}function oa(e){return e===44||e===91||e===93||e===123||e===125}function $6(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}function F6(e){return e===120?2:e===117?4:e===85?8:0}function z6(e){return 48<=e&&e<=57?e-48:-1}function bk(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 B6(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function TP(e,t,n){t==="__proto__"?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:n}):e[t]=n}var RP=new Array(256),LP=new Array(256);for(var zo=0;zo<256;zo++)RP[zo]=bk(zo)?1:0,LP[zo]=bk(zo);function H6(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||ow,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 OP(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=KH(n),new In(t,n)}function Re(e,t){throw OP(e,t)}function ep(e,t){e.onWarning&&e.onWarning.call(null,OP(e,t))}var kk={YAML:function(t,n,r){var i,s,o;t.version!==null&&Re(t,"duplication of %YAML directive"),r.length!==1&&Re(t,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(r[0]),i===null&&Re(t,"ill-formed argument of the YAML directive"),s=parseInt(i[1],10),o=parseInt(i[2],10),s!==1&&Re(t,"unacceptable YAML version of the document"),t.version=r[0],t.checkLineBreaks=o<2,o!==1&&o!==2&&ep(t,"unsupported YAML version of the document")},TAG:function(t,n,r){var i,s;r.length!==2&&Re(t,"TAG directive accepts exactly two arguments"),i=r[0],s=r[1],IP.test(i)||Re(t,"ill-formed tag handle (first argument) of the TAG directive"),Cs.call(t.tagMap,i)&&Re(t,'there is a previously declared suffix for "'+i+'" tag handle'),AP.test(s)||Re(t,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch{Re(t,"tag prefix is malformed: "+s)}t.tagMap[i]=s}};function ks(e,t,n,r){var i,s,o,a;if(t<n){if(a=e.input.slice(t,n),r)for(i=0,s=a.length;i<s;i+=1)o=a.charCodeAt(i),o===9||32<=o&&o<=1114111||Re(e,"expected valid JSON character");else O6.test(a)&&Re(e,"the stream contains non-printable characters");e.result+=a}}function Sk(e,t,n,r){var i,s,o,a;for(Jt.isObject(n)||Re(e,"cannot merge mappings; the provided source object is unacceptable"),i=Object.keys(n),o=0,a=i.length;o<a;o+=1)s=i[o],Cs.call(t,s)||(TP(t,s,n[s]),r[s]=!0)}function aa(e,t,n,r,i,s,o,a,c){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])&&Re(e,"nested arrays are not supported inside keys"),typeof i=="object"&&vk(i[u])==="[object Object]"&&(i[u]="[object Object]");if(typeof i=="object"&&vk(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)Sk(e,t,s[u],n);else Sk(e,t,s,n);else!e.json&&!Cs.call(n,i)&&Cs.call(t,i)&&(e.line=o||e.line,e.lineStart=a||e.lineStart,e.position=c||e.position,Re(e,"duplicated mapping key")),TP(t,i,s),delete n[i];return t}function aw(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++):Re(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function Yt(e,t,n){for(var r=0,i=e.input.charCodeAt(e.position);i!==0;){for(;oo(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(aw(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&&ep(e,"deficient indentation"),r}function Wp(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||Hn(n)))}function lw(e,t){t===1?e.result+=" ":t>1&&(e.result+=Jt.repeat(`
|
|
88
|
-
`,t-1))}function U6(e,t,n){var r,i,s,o,a,c,u,p,d=e.kind,f=e.result,h;if(h=e.input.charCodeAt(e.position),Hn(h)||oa(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),Hn(i)||n&&oa(i)))return!1;for(e.kind="scalar",e.result="",s=o=e.position,a=!1;h!==0;){if(h===58){if(i=e.input.charCodeAt(e.position+1),Hn(i)||n&&oa(i))break}else if(h===35){if(r=e.input.charCodeAt(e.position-1),Hn(r))break}else{if(e.position===e.lineStart&&Wp(e)||n&&oa(h))break;if(fi(h))if(c=e.line,u=e.lineStart,p=e.lineIndent,Yt(e,!1,-1),e.lineIndent>=t){a=!0,h=e.input.charCodeAt(e.position);continue}else{e.position=o,e.line=c,e.lineStart=u,e.lineIndent=p;break}}a&&(ks(e,s,o,!1),lw(e,e.line-c),s=o=e.position,a=!1),oo(h)||(o=e.position+1),h=e.input.charCodeAt(++e.position)}return ks(e,s,o,!1),e.result?!0:(e.kind=d,e.result=f,!1)}function V6(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(ks(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)?(ks(e,r,i,!0),lw(e,Yt(e,!1,t)),r=i=e.position):e.position===e.lineStart&&Wp(e)?Re(e,"unexpected end of the document within a single quoted scalar"):(e.position++,i=e.position);Re(e,"unexpected end of the stream within a single quoted scalar")}function W6(e,t){var n,r,i,s,o,a;if(a=e.input.charCodeAt(e.position),a!==34)return!1;for(e.kind="scalar",e.result="",e.position++,n=r=e.position;(a=e.input.charCodeAt(e.position))!==0;){if(a===34)return ks(e,n,e.position,!0),e.position++,!0;if(a===92){if(ks(e,n,e.position,!0),a=e.input.charCodeAt(++e.position),fi(a))Yt(e,!1,t);else if(a<256&&RP[a])e.result+=LP[a],e.position++;else if((o=F6(a))>0){for(i=o,s=0;i>0;i--)a=e.input.charCodeAt(++e.position),(o=$6(a))>=0?s=(s<<4)+o:Re(e,"expected hexadecimal character");e.result+=B6(s),e.position++}else Re(e,"unknown escape sequence");n=r=e.position}else fi(a)?(ks(e,n,r,!0),lw(e,Yt(e,!1,t)),n=r=e.position):e.position===e.lineStart&&Wp(e)?Re(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}Re(e,"unexpected end of the stream within a double quoted scalar")}function K6(e,t){var n=!0,r,i,s,o=e.tag,a,c=e.anchor,u,p,d,f,h,g=Object.create(null),b,k,y,v;if(v=e.input.charCodeAt(e.position),v===91)p=93,h=!1,a=[];else if(v===123)p=125,h=!0,a={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=a),v=e.input.charCodeAt(++e.position);v!==0;){if(Yt(e,!0,t),v=e.input.charCodeAt(e.position),v===p)return e.position++,e.tag=o,e.anchor=c,e.kind=h?"mapping":"sequence",e.result=a,!0;n?v===44&&Re(e,"expected the node content, but found ','"):Re(e,"missed comma between flow collection entries"),k=b=y=null,d=f=!1,v===63&&(u=e.input.charCodeAt(e.position+1),Hn(u)&&(d=f=!0,e.position++,Yt(e,!0,t))),r=e.line,i=e.lineStart,s=e.position,Da(e,t,Qf,!1,!0),k=e.tag,b=e.result,Yt(e,!0,t),v=e.input.charCodeAt(e.position),(f||e.line===r)&&v===58&&(d=!0,v=e.input.charCodeAt(++e.position),Yt(e,!0,t),Da(e,t,Qf,!1,!0),y=e.result),h?aa(e,a,g,k,b,y,r,i,s):d?a.push(aa(e,null,g,k,b,y,r,i,s)):a.push(b),Yt(e,!0,t),v=e.input.charCodeAt(e.position),v===44?(n=!0,v=e.input.charCodeAt(++e.position)):n=!1}Re(e,"unexpected end of the stream within a flow collection")}function Y6(e,t){var n,r,i=Pm,s=!1,o=!1,a=t,c=0,u=!1,p,d;if(d=e.input.charCodeAt(e.position),d===124)r=!1;else if(d===62)r=!0;else return!1;for(e.kind="scalar",e.result="";d!==0;)if(d=e.input.charCodeAt(++e.position),d===43||d===45)Pm===i?i=d===43?wk:L6:Re(e,"repeat of a chomping mode identifier");else if((p=z6(d))>=0)p===0?Re(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?Re(e,"repeat of an indentation width identifier"):(a=t+p-1,o=!0);else break;if(oo(d)){do d=e.input.charCodeAt(++e.position);while(oo(d));if(d===35)do d=e.input.charCodeAt(++e.position);while(!fi(d)&&d!==0)}for(;d!==0;){for(aw(e),e.lineIndent=0,d=e.input.charCodeAt(e.position);(!o||e.lineIndent<a)&&d===32;)e.lineIndent++,d=e.input.charCodeAt(++e.position);if(!o&&e.lineIndent>a&&(a=e.lineIndent),fi(d)){c++;continue}if(e.lineIndent<a){i===wk?e.result+=Jt.repeat(`
|
|
89
|
-
`,s?1+c:c):i===Pm&&s&&(e.result+=`
|
|
90
|
-
`);break}for(r?oo(d)?(u=!0,e.result+=Jt.repeat(`
|
|
91
|
-
`,s?1+c:c)):u?(u=!1,e.result+=Jt.repeat(`
|
|
92
|
-
`,c+1)):c===0?s&&(e.result+=" "):e.result+=Jt.repeat(`
|
|
93
|
-
`,c):e.result+=Jt.repeat(`
|
|
94
|
-
`,s?1+c:c),s=!0,o=!0,c=0,n=e.position;!fi(d)&&d!==0;)d=e.input.charCodeAt(++e.position);ks(e,n,e.position,!1)}return!0}function Nk(e,t){var n,r=e.tag,i=e.anchor,s=[],o,a=!1,c;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=s),c=e.input.charCodeAt(e.position);c!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,Re(e,"tab characters must not be used in indentation")),!(c!==45||(o=e.input.charCodeAt(e.position+1),!Hn(o))));){if(a=!0,e.position++,Yt(e,!0,-1)&&e.lineIndent<=t){s.push(null),c=e.input.charCodeAt(e.position);continue}if(n=e.line,Da(e,t,_P,!1,!0),s.push(e.result),Yt(e,!0,-1),c=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&c!==0)Re(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break}return a?(e.tag=r,e.anchor=i,e.kind="sequence",e.result=s,!0):!1}function q6(e,t,n){var r,i,s,o,a,c,u=e.tag,p=e.anchor,d={},f=Object.create(null),h=null,g=null,b=null,k=!1,y=!1,v;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=d),v=e.input.charCodeAt(e.position);v!==0;){if(!k&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,Re(e,"tab characters must not be used in indentation")),r=e.input.charCodeAt(e.position+1),s=e.line,(v===63||v===58)&&Hn(r))v===63?(k&&(aa(e,d,f,h,g,null,o,a,c),h=g=b=null),y=!0,k=!0,i=!0):k?(k=!1,i=!0):Re(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,a=e.lineStart,c=e.position,!Da(e,n,PP,!1,!0))break;if(e.line===s){for(v=e.input.charCodeAt(e.position);oo(v);)v=e.input.charCodeAt(++e.position);if(v===58)v=e.input.charCodeAt(++e.position),Hn(v)||Re(e,"a whitespace character is expected after the key-value separator within a block mapping"),k&&(aa(e,d,f,h,g,null,o,a,c),h=g=b=null),y=!0,k=!1,i=!1,h=e.tag,g=e.result;else if(y)Re(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=u,e.anchor=p,!0}else if(y)Re(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,a=e.lineStart,c=e.position),Da(e,t,Zf,!0,i)&&(k?g=e.result:b=e.result),k||(aa(e,d,f,h,g,b,o,a,c),h=g=b=null),Yt(e,!0,-1),v=e.input.charCodeAt(e.position)),(e.line===s||e.lineIndent>t)&&v!==0)Re(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return k&&aa(e,d,f,h,g,null,o,a,c),y&&(e.tag=u,e.anchor=p,e.kind="mapping",e.result=d),y}function G6(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&&Re(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)):Re(e,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!Hn(o);)o===33&&(r?Re(e,"tag suffix cannot contain exclamation marks"):(i=e.input.slice(t-1,e.position+1),IP.test(i)||Re(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),D6.test(s)&&Re(e,"tag suffix cannot contain flow indicator characters")}s&&!AP.test(s)&&Re(e,"tag name cannot contain such characters: "+s);try{s=decodeURIComponent(s)}catch{Re(e,"tag name is malformed: "+s)}return n?e.tag=s:Cs.call(e.tagMap,i)?e.tag=e.tagMap[i]+s:i==="!"?e.tag="!"+s:i==="!!"?e.tag="tag:yaml.org,2002:"+s:Re(e,'undeclared tag handle "'+i+'"'),!0}function X6(e){var t,n;if(n=e.input.charCodeAt(e.position),n!==38)return!1;for(e.anchor!==null&&Re(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;n!==0&&!Hn(n)&&!oa(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&Re(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function J6(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&&!Hn(r)&&!oa(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&Re(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),Cs.call(e.anchorMap,n)||Re(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],Yt(e,!0,-1),!0}function Da(e,t,n,r,i){var s,o,a,c=1,u=!1,p=!1,d,f,h,g,b,k;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,s=o=a=Zf===n||_P===n,r&&Yt(e,!0,-1)&&(u=!0,e.lineIndent>t?c=1:e.lineIndent===t?c=0:e.lineIndent<t&&(c=-1)),c===1)for(;G6(e)||X6(e);)Yt(e,!0,-1)?(u=!0,a=s,e.lineIndent>t?c=1:e.lineIndent===t?c=0:e.lineIndent<t&&(c=-1)):a=!1;if(a&&(a=u||i),(c===1||Zf===n)&&(Qf===n||PP===n?b=t:b=t+1,k=e.position-e.lineStart,c===1?a&&(Nk(e,k)||q6(e,k,b))||K6(e,b)?p=!0:(o&&Y6(e,b)||V6(e,b)||W6(e,b)?p=!0:J6(e)?(p=!0,(e.tag!==null||e.anchor!==null)&&Re(e,"alias node should not have any properties")):U6(e,b,Qf===n)&&(p=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):c===0&&(p=a&&Nk(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"&&Re(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),d=0,f=e.implicitTypes.length;d<f;d+=1)if(g=e.implicitTypes[d],g.resolve(e.result)){e.result=g.construct(e.result),e.tag=g.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(Cs.call(e.typeMap[e.kind||"fallback"],e.tag))g=e.typeMap[e.kind||"fallback"][e.tag];else for(g=null,h=e.typeMap.multi[e.kind||"fallback"],d=0,f=h.length;d<f;d+=1)if(e.tag.slice(0,h[d].tag.length)===h[d].tag){g=h[d];break}g||Re(e,"unknown tag !<"+e.tag+">"),e.result!==null&&g.kind!==e.kind&&Re(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+g.kind+'", not "'+e.kind+'"'),g.resolve(e.result,e.tag)?(e.result=g.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):Re(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 Q6(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&&(Yt(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&&!Hn(o);)o=e.input.charCodeAt(++e.position);for(r=e.input.slice(n,e.position),i=[],r.length<1&&Re(e,"directive name must not be less than one character in length");o!==0;){for(;oo(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&&!Hn(o);)o=e.input.charCodeAt(++e.position);i.push(e.input.slice(n,e.position))}o!==0&&aw(e),Cs.call(kk,r)?kk[r](e,r,i):ep(e,'unknown document directive "'+r+'"')}if(Yt(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,Yt(e,!0,-1)):s&&Re(e,"directives end mark is expected"),Da(e,e.lineIndent-1,Zf,!1,!0),Yt(e,!0,-1),e.checkLineBreaks&&M6.test(e.input.slice(t,e.position))&&ep(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&Wp(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,Yt(e,!0,-1));return}if(e.position<e.length-1)Re(e,"end of the stream or a document separator is expected");else return}function MP(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 H6(e,t),r=e.indexOf("\0");for(r!==-1&&(n.position=r,Re(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;)Q6(n);return n.documents}function Z6(e,t,n){t!==null&&typeof t=="object"&&typeof n>"u"&&(n=t,t=null);var r=MP(e,n);if(typeof t!="function")return r;for(var i=0,s=r.length;i<s;i+=1)t(r[i])}function e8(e,t){var n=MP(e,t);if(n.length!==0){if(n.length===1)return n[0];throw new In("expected a single document in the stream, but found more")}}var t8=Z6,n8=e8,DP={loadAll:t8,load:n8},$P=Object.prototype.toString,FP=Object.prototype.hasOwnProperty,cw=65279,r8=9,Wc=10,i8=13,s8=32,o8=33,a8=34,hy=35,l8=37,c8=38,u8=39,d8=42,zP=44,f8=45,tp=58,p8=61,h8=62,m8=63,g8=64,BP=91,HP=93,y8=96,UP=123,x8=124,VP=125,Cn={};Cn[0]="\\0";Cn[7]="\\a";Cn[8]="\\b";Cn[9]="\\t";Cn[10]="\\n";Cn[11]="\\v";Cn[12]="\\f";Cn[13]="\\r";Cn[27]="\\e";Cn[34]='\\"';Cn[92]="\\\\";Cn[133]="\\N";Cn[160]="\\_";Cn[8232]="\\L";Cn[8233]="\\P";var w8=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],v8=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function b8(e,t){var n,r,i,s,o,a,c;if(t===null)return{};for(n={},r=Object.keys(t),i=0,s=r.length;i<s;i+=1)o=r[i],a=String(t[o]),o.slice(0,2)==="!!"&&(o="tag:yaml.org,2002:"+o.slice(2)),c=e.compiledTypeMap.fallback[o],c&&FP.call(c.styleAliases,a)&&(a=c.styleAliases[a]),n[o]=a;return n}function k8(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 In("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+n+Jt.repeat("0",r-t.length)+t}var S8=1,Kc=2;function N8(e){this.schema=e.schema||ow,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=Jt.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=b8(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==='"'?Kc:S8,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 jk(e,t){for(var n=Jt.repeat(" ",t),r=0,i=-1,s="",o,a=e.length;r<a;)i=e.indexOf(`
|
|
96
|
-
`,r),i===-1?(o=e.slice(r),r=a):(o=e.slice(r,i+1),r=i+1),o.length&&o!==`
|
|
97
|
-
`&&(s+=n),s+=o;return s}function my(e,t){return`
|
|
98
|
-
`+Jt.repeat(" ",e.indent*t)}function j8(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 np(e){return e===s8||e===r8}function Yc(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==cw||65536<=e&&e<=1114111}function Ck(e){return Yc(e)&&e!==cw&&e!==i8&&e!==Wc}function Ek(e,t,n){var r=Ck(e),i=r&&!np(e);return(n?r:r&&e!==zP&&e!==BP&&e!==HP&&e!==UP&&e!==VP)&&e!==hy&&!(t===tp&&!i)||Ck(t)&&!np(t)&&e===hy||t===tp&&i}function C8(e){return Yc(e)&&e!==cw&&!np(e)&&e!==f8&&e!==m8&&e!==tp&&e!==zP&&e!==BP&&e!==HP&&e!==UP&&e!==VP&&e!==hy&&e!==c8&&e!==d8&&e!==o8&&e!==x8&&e!==p8&&e!==h8&&e!==u8&&e!==a8&&e!==l8&&e!==g8&&e!==y8}function E8(e){return!np(e)&&e!==tp}function Xl(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 WP(e){var t=/^\n* /;return t.test(e)}var KP=1,gy=2,YP=3,qP=4,Vo=5;function P8(e,t,n,r,i,s,o,a){var c,u=0,p=null,d=!1,f=!1,h=r!==-1,g=-1,b=C8(Xl(e,0))&&E8(Xl(e,e.length-1));if(t||o)for(c=0;c<e.length;u>=65536?c+=2:c++){if(u=Xl(e,c),!Yc(u))return Vo;b=b&&Ek(u,p,a),p=u}else{for(c=0;c<e.length;u>=65536?c+=2:c++){if(u=Xl(e,c),u===Wc)d=!0,h&&(f=f||c-g-1>r&&e[g+1]!==" ",g=c);else if(!Yc(u))return Vo;b=b&&Ek(u,p,a),p=u}f=f||h&&c-g-1>r&&e[g+1]!==" "}return!d&&!f?b&&!o&&!i(e)?KP:s===Kc?Vo:gy:n>9&&WP(e)?Vo:o?s===Kc?Vo:gy:f?qP:YP}function _8(e,t,n,r,i){e.dump=function(){if(t.length===0)return e.quotingType===Kc?'""':"''";if(!e.noCompatMode&&(w8.indexOf(t)!==-1||v8.test(t)))return e.quotingType===Kc?'"'+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),a=r||e.flowLevel>-1&&n>=e.flowLevel;function c(u){return j8(e,u)}switch(P8(t,a,e.indent,o,c,e.quotingType,e.forceQuotes&&!r,i)){case KP:return t;case gy:return"'"+t.replace(/'/g,"''")+"'";case YP:return"|"+Pk(t,e.indent)+_k(jk(t,s));case qP:return">"+Pk(t,e.indent)+_k(jk(I8(t,o),s));case Vo:return'"'+A8(t)+'"';default:throw new In("impossible error: invalid scalar style")}}()}function Pk(e,t){var n=WP(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 _k(e){return e[e.length-1]===`
|
|
103
|
-
`?e.slice(0,-1):e}function I8(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,Ik(e.slice(0,u),t)}(),i=e[0]===`
|
|
105
|
-
`||e[0]===" ",s,o;o=n.exec(e);){var a=o[1],c=o[2];s=c[0]===" ",r+=a+(!i&&!s&&c!==""?`
|
|
106
|
-
`:"")+Ik(c,t),i=s}return r}function Ik(e,t){if(e===""||e[0]===" ")return e;for(var n=/ [^ ]/g,r,i=0,s,o=0,a=0,c="";r=n.exec(e);)a=r.index,a-i>t&&(s=o>i?o:a,c+=`
|
|
107
|
-
`+e.slice(i,s),i=s+1),o=a;return c+=`
|
|
108
|
-
`,e.length-i>t&&o>i?c+=e.slice(i,o)+`
|
|
109
|
-
`+e.slice(o+1):c+=e.slice(i),c.slice(1)}function A8(e){for(var t="",n=0,r,i=0;i<e.length;n>=65536?i+=2:i++)n=Xl(e,i),r=Cn[n],!r&&Yc(n)?(t+=e[i],n>=65536&&(t+=e[i+1])):t+=r||k8(n);return t}function T8(e,t,n){var r="",i=e.tag,s,o,a;for(s=0,o=n.length;s<o;s+=1)a=n[s],e.replacer&&(a=e.replacer.call(n,String(s),a)),(zi(e,t,a,!1,!1)||typeof a>"u"&&zi(e,t,null,!1,!1))&&(r!==""&&(r+=","+(e.condenseFlow?"":" ")),r+=e.dump);e.tag=i,e.dump="["+r+"]"}function Ak(e,t,n,r){var i="",s=e.tag,o,a,c;for(o=0,a=n.length;o<a;o+=1)c=n[o],e.replacer&&(c=e.replacer.call(n,String(o),c)),(zi(e,t+1,c,!0,!0,!1,!0)||typeof c>"u"&&zi(e,t+1,null,!0,!0,!1,!0))&&((!r||i!=="")&&(i+=my(e,t)),e.dump&&Wc===e.dump.charCodeAt(0)?i+="-":i+="- ",i+=e.dump);e.tag=s,e.dump=i||"[]"}function R8(e,t,n){var r="",i=e.tag,s=Object.keys(n),o,a,c,u,p;for(o=0,a=s.length;o<a;o+=1)p="",r!==""&&(p+=", "),e.condenseFlow&&(p+='"'),c=s[o],u=n[c],e.replacer&&(u=e.replacer.call(n,c,u)),zi(e,t,c,!1,!1)&&(e.dump.length>1024&&(p+="? "),p+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),zi(e,t,u,!1,!1)&&(p+=e.dump,r+=p));e.tag=i,e.dump="{"+r+"}"}function L8(e,t,n,r){var i="",s=e.tag,o=Object.keys(n),a,c,u,p,d,f;if(e.sortKeys===!0)o.sort();else if(typeof e.sortKeys=="function")o.sort(e.sortKeys);else if(e.sortKeys)throw new In("sortKeys must be a boolean or a function");for(a=0,c=o.length;a<c;a+=1)f="",(!r||i!=="")&&(f+=my(e,t)),u=o[a],p=n[u],e.replacer&&(p=e.replacer.call(n,u,p)),zi(e,t+1,u,!0,!0,!0)&&(d=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,d&&(e.dump&&Wc===e.dump.charCodeAt(0)?f+="?":f+="? "),f+=e.dump,d&&(f+=my(e,t)),zi(e,t+1,p,!0,d)&&(e.dump&&Wc===e.dump.charCodeAt(0)?f+=":":f+=": ",f+=e.dump,i+=f));e.tag=s,e.dump=i||"{}"}function Tk(e,t,n){var r,i,s,o,a,c;for(i=n?e.explicitTypes:e.implicitTypes,s=0,o=i.length;s<o;s+=1)if(a=i[s],(a.instanceOf||a.predicate)&&(!a.instanceOf||typeof t=="object"&&t instanceof a.instanceOf)&&(!a.predicate||a.predicate(t))){if(n?a.multi&&a.representName?e.tag=a.representName(t):e.tag=a.tag:e.tag="?",a.represent){if(c=e.styleMap[a.tag]||a.defaultStyle,$P.call(a.represent)==="[object Function]")r=a.represent(t,c);else if(FP.call(a.represent,c))r=a.represent[c](t,c);else throw new In("!<"+a.tag+'> tag resolver accepts not "'+c+'" style');e.dump=r}return!0}return!1}function zi(e,t,n,r,i,s,o){e.tag=null,e.dump=n,Tk(e,n,!1)||Tk(e,n,!0);var a=$P.call(e.dump),c=r,u;r&&(r=e.flowLevel<0||e.flowLevel>t);var p=a==="[object Object]"||a==="[object Array]",d,f;if(p&&(d=e.duplicates.indexOf(n),f=d!==-1),(e.tag!==null&&e.tag!=="?"||f||e.indent!==2&&t>0)&&(i=!1),f&&e.usedDuplicates[d])e.dump="*ref_"+d;else{if(p&&f&&!e.usedDuplicates[d]&&(e.usedDuplicates[d]=!0),a==="[object Object]")r&&Object.keys(e.dump).length!==0?(L8(e,t,e.dump,i),f&&(e.dump="&ref_"+d+e.dump)):(R8(e,t,e.dump),f&&(e.dump="&ref_"+d+" "+e.dump));else if(a==="[object Array]")r&&e.dump.length!==0?(e.noArrayIndent&&!o&&t>0?Ak(e,t-1,e.dump,i):Ak(e,t,e.dump,i),f&&(e.dump="&ref_"+d+e.dump)):(T8(e,t,e.dump),f&&(e.dump="&ref_"+d+" "+e.dump));else if(a==="[object String]")e.tag!=="?"&&_8(e,e.dump,t,s,c);else{if(a==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new In("unacceptable kind of an object to dump "+a)}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 O8(e,t){var n=[],r=[],i,s;for(yy(e,n,r),i=0,s=r.length;i<s;i+=1)t.duplicates.push(n[r[i]]);t.usedDuplicates=new Array(s)}function yy(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)yy(e[i],t,n);else for(r=Object.keys(e),i=0,s=r.length;i<s;i+=1)yy(e[r[i]],t,n)}function M8(e,t){t=t||{};var n=new N8(t);n.noRefs||O8(e,n);var r=e;return n.replacer&&(r=n.replacer.call({"":r},"",r)),zi(n,0,r,!0,!0)?n.dump+`
|
|
110
|
-
`:""}var D8=M8,$8={dump:D8};function uw(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 F8=un,z8=cP,B8=pP,H8=xP,U8=wP,V8=ow,W8=DP.load,K8=DP.loadAll,Y8=$8.dump,q8=In,G8={binary:NP,float:yP,map:fP,null:hP,pairs:CP,set:EP,timestamp:kP,bool:mP,int:gP,merge:SP,omap:jP,seq:dP,str:uP},X8=uw("safeLoad","load"),J8=uw("safeLoadAll","loadAll"),Q8=uw("safeDump","dump"),GP={Type:F8,Schema:z8,FAILSAFE_SCHEMA:B8,JSON_SCHEMA:H8,CORE_SCHEMA:U8,DEFAULT_SCHEMA:V8,load:W8,loadAll:K8,dump:Y8,YAMLException:q8,types:G8,safeLoad:X8,safeLoadAll:J8,safeDump:Q8};const xo=["requirement","planning","code","test","normal"],xy={普通:"normal",技术规划:"planning",代码执行:"code",测试回归:"test",需求拆解:"requirement"},Z8=["agent","control","provide","condition","jump","condition_jump","start","end"];function e9(e){return Z8.includes(e)?e:"agent"}function t9(e){const t=(e||"").toLowerCase();return t.startsWith("control_")?"control":t.startsWith("agent_")?"agent":t.startsWith("provide_")?"provide":(t.startsWith("tool_"),"agent")}function n9(e){var t;if(!(e!=null&&e.trim()))return{nodes:[],edges:[],instances:{}};try{const n=GP.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:{},a=o.nodePositions&&typeof o.nodePositions=="object"?o.nodePositions:{},c=typeof o.description=="string"&&o.description.trim()?o.description.trim():void 0,u=new Set(Object.keys(i));for(const f of s)f!=null&&f.source&&u.add(String(f.source)),f!=null&&f.target&&u.add(String(f.target));const p=Array.from(u).map(f=>{const h=i[f],g=a[f]&&typeof a[f].x=="number"&&typeof a[f].y=="number"?{x:a[f].x,y:a[f].y}:{x:0,y:0},b=(h==null?void 0:h.definitionId)??f,k=t9(b),y=(h==null?void 0:h.label)!=null?String(h.label):f,v=(h==null?void 0:h.role)!=null?String(h.role).trim():"",w=xy[v]||v,N=xo.includes(w)?w:"normal",C=(h==null?void 0:h.model)!=null?String(h.model).trim():void 0,S=(h==null?void 0:h.body)!=null?String(h.body):"",P=(h==null?void 0:h.script)!=null?String(h.script):"";return{id:f,type:e9(k),position:g,data:{label:y,definitionId:b,schemaType:k,role:N,model:C||void 0,body:S,...P.trim()!==""?{script:P}:{}}}}),d=s.filter(f=>(f==null?void 0:f.source)&&(f==null?void 0:f.target)).map((f,h)=>({id:`e-${f.source}-${f.target}-${h}`,source:String(f.source),target:String(f.target),sourceHandle:f.sourceHandle??void 0,targetHandle:f.targetHandle??void 0,markerEnd:{type:Fr.ArrowClosed}}));return{nodes:p,edges:d,instances:i,description:c}}catch(n){const r=n instanceof Error?n.message:String(n);let i="";if(/bad indentation of a mapping entry|expected.*scalar|mapping values are not allowed/i.test(r)){const s=r.match(/\((\d+):/);i=`
|
|
111
|
-
|
|
112
|
-
💡 提示:通常由 ${s?`第 ${s[1]} 行附近`:""}的 \`script\` / \`body\` / \`value\` 字段裸写命令字符串引起。
|
|
113
|
-
YAML 中含 \`: \`、\`"\`、\`'\` 等特殊字符的多行字符串必须使用 \`|\` 块标量。
|
|
114
|
-
|
|
115
|
-
✅ 正确写法:
|
|
116
|
-
\`\`\`yaml
|
|
117
|
-
script: |
|
|
118
|
-
node -e "console.log('TODO: scripts/x.mjs')"
|
|
119
|
-
\`\`\`
|
|
120
|
-
❌ 错误写法(当前文件):
|
|
121
|
-
\`\`\`yaml
|
|
122
|
-
script: node -e "console.log('TODO: scripts/x.mjs')"
|
|
123
|
-
\`\`\``}return{error:`flow.yaml 解析失败:${r}${i}`}}}function XP(e,t){var i,s,o,a,c,u,p,d;const n=f=>({type:(f==null?void 0:f.type)??"node",name:(f==null?void 0:f.name)??"",value:(f==null?void 0:f.value)??(f==null?void 0:f.default)??""}),r={};for(const f of e){const h=t[f.id]&&typeof t[f.id]=="object"?{...t[f.id]}:{},g=((i=f.data)==null?void 0:i.definitionId)||f.id,b=((s=f.data)==null?void 0:s.inputs)??[],k=((o=f.data)==null?void 0:o.outputs)??[],y=((a=f.data)==null?void 0:a.role)!=null?String(f.data.role).trim():"",v=h.role!=null?String(h.role).trim():"",w=xy[y]||y,N=xy[v]||v,C=xo.includes(w)?w:xo.includes(N)?N:"normal",S=Array.isArray(b)?b.map(n):Array.isArray(h.input)?h.input.map(B=>n(B)):[],P=Array.isArray(k)?k.map(n):Array.isArray(h.output)?h.output.map(B=>n(B)):[],R=((c=f.data)==null?void 0:c.label)!=null?String(f.data.label):h.label!=null?String(h.label):f.id,M=(u=f.data)==null?void 0:u.body,H=M!=null?String(M):h.body!=null?String(h.body):"";let _=((p=f.data)==null?void 0:p.model)!=null&&String(f.data.model).trim()!==""?String(f.data.model).trim():h.model!=null&&String(h.model).trim()!==""?String(h.model).trim():void 0;(_===""||_==="default")&&(_=void 0);const A={...h,definitionId:g,label:R,role:C,model:_,input:S,output:P};H.trim()===""?delete A.body:A.body=H;const U=(d=f.data)==null?void 0:d.script,L=U!=null?String(U):h.script!=null?String(h.script):"";L.trim()===""?delete A.script:A.script=L,delete A.temperature,delete A.maxTokens,delete A.description,r[f.id]=A}return r}function Rk(e,t,n,r){const i=XP(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 a={nodePositions:o};(r==null?void 0:r.description)!=null&&String(r.description).trim()!==""&&(a.description=String(r.description).trim());const c={instances:i,edges:s,ui:a};return GP.dump(c,{lineWidth:-1})}function r9(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 a=n[o],c=(a&&a.name!=null?String(a.name).trim():"")||`input-${o}`;t.inputNames.push(c)}for(let o=0;o<r.length;o++){const a=r[o],c=(a&&a.name!=null?String(a.name).trim():"")||`output-${o}`;t.outputNames.push(c)}return t}function i9(e,t,n){var c,u,p;const r=new Set(e.map(d=>d.id)),i={};for(const d of e)i[d.id]=r9(d);const s=new Map,o=new Map;for(const d of t)d.target&&r.has(d.target)&&(s.has(d.target)||s.set(d.target,new Set),d.targetHandle&&s.get(d.target).add(d.targetHandle)),d.source&&r.has(d.source)&&(o.has(d.source)||o.set(d.source,new Set),d.sourceHandle&&o.get(d.source).add(d.sourceHandle));const a=[];for(const d of e){const f=((c=d.data)==null?void 0:c.definitionId)!=null?String(d.data.definitionId):"",h=i[d.id]||{inputNames:[],outputNames:[]},g=h.inputNames.length,b=h.outputNames.length;if(!(f==="control_start"||f.startsWith("provide_"))&&g>0)for(let v=0;v<g;v++){const w=`input-${v}`;if(!((u=s.get(d.id))==null?void 0:u.has(w))){const C=h.inputNames[v]||w;a.push({nodeId:d.id,suffix:n("flow:validation.inputSlotNoEdge",{slotName:C,handle:w}),key:`${d.id}-${w}-in`})}}if(!(f==="control_end")&&b>0)for(let v=0;v<b;v++){const w=`output-${v}`;if(!((p=o.get(d.id))==null?void 0:p.has(w))){const C=h.outputNames[v]||w;a.push({nodeId:d.id,suffix:n("flow:validation.outputSlotNoEdge",{slotName:C,handle:w}),key:`${d.id}-${w}-out`})}}}return a}function wy(e){return{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):""}}function s9(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(a=>{const c=wy(a);return{type:String(c.type||"node"),name:String(c.name??""),default:String(c.default??"")}});return{inputs:r(t),outputs:r(n)}}function fc(e,t,n,r,i){var U,L,B,$,F,I,T,E,q,W,O;const s=((U=e.data)==null?void 0:U.definitionId)||String(e.id).replace(/-\d+$/,""),o=n.find(X=>X.id===s),a=t[e.id];let c=[],u=[],p=((L=e.data)==null?void 0:L.label)??e.id,d,f,h,g;const b=!!a;a&&(Array.isArray(a.input)&&(c=a.input.map(wy)),Array.isArray(a.output)&&(u=a.output.map(wy)),a.label&&(p=String(a.label)),a.role&&typeof a.role=="string"&&(d=a.role),a.model!=null&&(f=String(a.model).trim()),a.body!=null&&(h=String(a.body)),a.script!=null&&(g=String(a.script)));const k=d??(typeof((B=e.data)==null?void 0:B.role)=="string"?e.data.role:"普通"),y=f??(($=e.data)==null?void 0:$.model)??void 0,v=(o==null?void 0:o.description)!=null?String(o.description).trim():"",w=v!==""?v:void 0,N=h??((F=e.data)==null?void 0:F.body)??"",C=g!==void 0?g:((I=e.data)==null?void 0:I.script)!=null?String(e.data.script):"",S=String(e.id),P=(T=r==null?void 0:r[i])==null?void 0:T[S],R=(E=P==null?void 0:P.label)==null?void 0:E.label,M=P==null?void 0:P.body,H=P==null?void 0:P.description;b||(c.length===0&&((q=o==null?void 0:o.inputs)!=null&&q.length)&&(c=o.inputs.map(X=>({...X}))),u.length===0&&((W=o==null?void 0:o.outputs)!=null&&W.length)&&(u=o.outputs.map(X=>({...X}))));const _=(o==null?void 0:o.id)??s,A=_==="tool_nodejs"||String(C).trim()!=="";return{...e,type:"flowNode",data:{...e.data,label:R||p,definitionId:_,schemaType:((O=e.data)==null?void 0:O.schemaType)??e.type??"agent",role:k,model:y,body:M||N,script:C,inputs:c,outputs:u,description:H||w,originalLabel:p,originalBody:N,body:N,...A?{script:C}:{},inputs:c,outputs:u}}}function JP(e,t){const n=new Map(t.map(r=>[r.id,r]));return e.filter(r=>{var p,d,f,h;const i=n.get(r.source),s=n.get(r.target),o=((d=(p=i==null?void 0:i.data)==null?void 0:p.outputs)==null?void 0:d.length)??0,a=((h=(f=s==null?void 0:s.data)==null?void 0:f.inputs)==null?void 0:h.length)??0,c=r.sourceHandle?parseInt(String(r.sourceHandle).replace("output-",""),10):0,u=r.targetHandle?parseInt(String(r.targetHandle).replace("input-",""),10):0;return i&&s&&c>=0&&c<o&&u>=0&&u<a})}function yi(e){switch(e){case"text":case"文本":return"#2196f3";case"file":case"文件":return"#4caf50";case"node":case"节点":return"#ff9800";case"bool":return"#9c27b0";default:return"#9e9e9e"}}function ji(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function o9(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 QP({data:e,selected:t,id:n,deleteNode:r,onProvideExpand:i,modelLists:s,onModelChange:o}){const{t:a}=bt(),c=(e==null?void 0:e.inputs)??[],u=(e==null?void 0:e.outputs)??[],p=((e==null?void 0:e.schemaType)??"agent").toLowerCase(),d=o9(e),f=(e==null?void 0:e.isRunMode)??!1,h=(e==null?void 0:e.isExecuting)??!1,g=(e==null?void 0:e.isDim)??!1,b=(e==null?void 0:e.nodeStatus)??null,k=(e==null?void 0:e.nodeElapsed)??null,y=(e==null?void 0:e.definitionId)||"",v=y.startsWith("provide_"),w=Array.isArray(s==null?void 0:s.cursor)?s.cursor:[],N=Array.isArray(s==null?void 0:s.opencode)?s.opencode:[],C=Array.isArray(s==null?void 0:s.claudeCode)?s.claudeCode:[],S=((e==null?void 0:e.model)??"").trim(),P=p==="agent"&&!y.startsWith("tool_nodejs"),R=new Set(w.map(ji)),M=new Set(N.map(ji)),H=new Set(C.map(ji)),_=S?S.startsWith("cursor:")||S.startsWith("opencode:")||S.startsWith("claude-code:")?S:H.has(S)?`claude-code:${S}`:M.has(S)?`opencode:${S}`:R.has(S)?`cursor:${S}`:S:"",A=S&&!_.startsWith("cursor:")&&!_.startsWith("opencode:")&&!_.startsWith("claude-code:")&&!R.has(S)&&!M.has(S)&&!H.has(S),U=S.startsWith("cursor:")?S.slice(7):S.startsWith("opencode:")?S.slice(9):S.startsWith("claude-code:")?S.slice(12):S,L=F=>{const I=F.target.value;o&&o(n,I)},B=F=>{F.stopPropagation(),r&&r(n)},$=F=>{F.stopPropagation(),i&&i()};return l.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":"")+(g?" af-flow-node--dim":"")+" af-flow-node--"+p.replace(/[^a-z0-9_-]/g,""),"data-schema":p,children:[l.jsxs("div",{className:"af-flow-node__chrome",children:[l.jsx("span",{className:"af-flow-node__type",title:d,children:d}),n&&l.jsx("span",{className:"af-flow-node__id",title:n,children:n}),!f&&P&&l.jsxs("div",{className:"af-flow-node__model-wrap",children:[l.jsxs("select",{className:"af-flow-node__model",value:_,onChange:L,"aria-label":a("flow:node.model"),title:U||a("flow:node.defaultModel"),children:[l.jsx("option",{value:"",children:a("flow:node.defaultModel")}),A&&l.jsx("option",{value:S,children:S}),w.length>0&&l.jsx("optgroup",{label:"Cursor",children:w.map(F=>l.jsx("option",{value:`cursor:${ji(F)}`,children:ji(F)},`c-${F}`))}),N.length>0&&l.jsx("optgroup",{label:"OpenCode",children:N.map(F=>l.jsx("option",{value:`opencode:${ji(F)}`,children:ji(F)},`o-${F}`))}),C.length>0&&l.jsx("optgroup",{label:"Claude Code",children:C.map(F=>l.jsx("option",{value:`claude-code:${ji(F)}`,children:ji(F)},`cc-${F}`))})]}),l.jsx("span",{className:"af-flow-node__model-arrow material-symbols-outlined",children:"expand_more"})]}),h&&l.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--executing",children:"EXECUTING"}),b==="running"&&!h&&l.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--running-disk",title:a("flow:node.diskRunning"),children:"RUNNING"}),b==="success"&&l.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--done",children:k!=null&&String(k).trim()!==""?k:"--"}),b==="failed"&&l.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--failed",children:"FAILED"}),!f&&v&&l.jsx("button",{type:"button",className:"af-flow-node__expand",onClick:$,"aria-label":a("flow:node.expandProvide"),title:a("flow:node.expandProvide"),children:l.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})}),!f&&l.jsx("button",{type:"button",className:"af-flow-node__delete",onClick:B,"aria-label":a("flow:node.deleteNode"),title:a("flow:node.deleteNode"),children:l.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),l.jsxs("div",{className:"af-flow-node__body",children:[l.jsx("div",{className:"af-flow-node__ports af-flow-node__ports--in",children:c.map((F,I)=>{const T=a("flow:node.inputTooltip",{name:F.name||`#${I}`,type:F.type})+(F.default!=null&&F.default!==""?a("flow:node.defaultSuffix",{value:F.default}):"");return l.jsx("div",{className:"af-flow-node__port-row",title:T,children:l.jsx(js,{type:"target",position:Ie.Left,id:`input-${I}`,className:"af-flow-node__handle",style:{background:yi(F.type)},title:T})},`in-${I}`)})}),l.jsx("div",{className:"af-flow-node__title-wrap",children:l.jsx("span",{className:"af-flow-node__title",children:(e==null?void 0:e.label)??a("flow:node.fallbackLabel")})}),l.jsx("div",{className:"af-flow-node__ports af-flow-node__ports--out",children:u.map((F,I)=>{const T=a("flow:node.outputTooltip",{name:F.name||`#${I}`,type:F.type})+(F.default!=null&&F.default!==""?a("flow:node.defaultSuffix",{value:F.default}):"");return l.jsx("div",{className:"af-flow-node__port-row",title:T,children:l.jsx(js,{type:"source",position:Ie.Right,id:`output-${I}`,className:"af-flow-node__handle",style:{background:yi(F.type)},title:T})},`out-${I}`)})})]})]})}const $a="flowNode";function a9(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 Lk(e){return e.key==="?"||e.key==="/"&&e.shiftKey}function l9(){return typeof navigator>"u"?!1:/Mac|iPhone|iPod|iPad/i.test(navigator.platform||navigator.userAgent||"")}function c9({open:e,onClose:t,flowId:n,flowSource:r,onArchived:i}){const{t:s}=bt(),o=m.useId(),a=m.useRef(null),[c,u]=m.useState(""),[p,d]=m.useState(!1),[f,h]=m.useState("");if(m.useEffect(()=>{if(!e)return;u(""),h(""),d(!1);const y=requestAnimationFrame(()=>{var v;return(v=a.current)==null?void 0:v.focus()});return()=>cancelAnimationFrame(y)},[e,n]),!e)return null;const g=c.trim(),b=g===n;async function k(y){if(y.preventDefault(),!(!b||p)){d(!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:g})}),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{d(!1)}}}return l.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:y=>{y.target===y.currentTarget&&t()},children:l.jsxs("div",{ref:a,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":o,tabIndex:-1,onMouseDown:y=>y.stopPropagation(),children:[l.jsxs("div",{className:"af-shortcuts-panel__head",children:[l.jsx("h2",{id:o,className:"af-shortcuts-panel__title",children:s("project:archiveModal.title")}),l.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":s("project:archiveModal.close"),children:l.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),l.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:k,children:[l.jsx("p",{className:"af-new-pipeline-lead",children:s("project:archiveModal.lead",{flowId:n})}),l.jsxs("label",{className:"af-new-pipeline-field",children:[l.jsx("span",{className:"af-pipeline-drawer-label",children:s("project:archiveModal.confirmLabel")}),l.jsx("input",{type:"text",className:"af-new-pipeline-input",value:c,onChange:y=>u(y.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":g.length>0&&!b})]}),f?l.jsx("p",{className:"af-err af-new-pipeline-err",children:f}):null,l.jsxs("div",{className:"af-new-pipeline-actions",children:[l.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:p,children:s("project:archiveModal.cancel")}),l.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!b||p,children:s(p?"project:archiveModal.archiving":"project:archiveModal.confirmArchive")})]})]})]})})}function Ok({open:e,title:t,message:n,confirmLabel:r,cancelLabel:i,destructive:s=!1,secondaryLabel:o,secondaryDestructive:a=!1,onSecondary:c,onConfirm:u,onCancel:p}){const{t:d}=bt(),f=m.useId(),h=m.useRef(null);if(m.useEffect(()=>{if(!e)return;const y=requestAnimationFrame(()=>{var w;return(w=h.current)==null?void 0:w.focus()});function v(w){w.key==="Escape"&&p(),w.key==="Enter"&&u()}return window.addEventListener("keydown",v),()=>{cancelAnimationFrame(y),window.removeEventListener("keydown",v)}},[e,p,u]),!e)return null;const g=r??d("common:common.confirm","确定"),b=i??d("common:common.cancel","取消"),k=t??d("common:common.confirmTitle","请确认");return l.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:y=>{y.target===y.currentTarget&&p()},children:l.jsxs("div",{ref:h,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":f,tabIndex:-1,onMouseDown:y=>y.stopPropagation(),children:[l.jsxs("div",{className:"af-shortcuts-panel__head",children:[l.jsx("h2",{id:f,className:"af-shortcuts-panel__title",children:k}),l.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:p,"aria-label":b,children:l.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),l.jsxs("div",{className:"af-shortcuts-panel__body af-new-pipeline-form",children:[l.jsx("p",{className:"af-new-pipeline-lead",children:n}),l.jsxs("div",{className:"af-new-pipeline-actions",children:[l.jsx("button",{type:"button",className:"af-btn-secondary",onClick:p,children:b}),o&&c?l.jsx("button",{type:"button",className:a?"af-btn-secondary af-btn-destructive":"af-btn-secondary",onClick:c,children:o}):null,l.jsx("button",{type:"button",className:s?"af-btn-primary af-btn-destructive":"af-btn-primary",onClick:u,autoFocus:!0,children:g})]})]})]})})}function u9({open:e,onClose:t,flowId:n,flowSource:r,flowArchived:i=!1,onDeleted:s}){const{t:o}=bt(),a=m.useId(),c=m.useRef(null),[u,p]=m.useState(""),[d,f]=m.useState(!1),[h,g]=m.useState("");if(m.useEffect(()=>{if(!e)return;p(""),g(""),f(!1);const v=requestAnimationFrame(()=>{var w;return(w=c.current)==null?void 0:w.focus()});return()=>cancelAnimationFrame(v)},[e,n]),!e)return null;const b=u.trim(),k=b===n;async function y(v){if(v.preventDefault(),!k||d)return;f(!0),g("");let w=null;try{const N=new AbortController;w=setTimeout(()=>N.abort(),15e3);const C=await fetch("/api/flow/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:n,flowSource:r,confirmFlowId:b,flowArchived:i}),signal:N.signal}),S=await C.json().catch(()=>({}));if(!C.ok){g(typeof S.error=="string"?S.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(N){if((N==null?void 0:N.name)==="AbortError"){g(o("project:deleteModal.deleteTimeout"));return}g(String((N==null?void 0:N.message)||N))}finally{w&&clearTimeout(w),f(!1)}}return l.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:v=>{v.target===v.currentTarget&&t()},children:l.jsxs("div",{ref:c,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":a,tabIndex:-1,onMouseDown:v=>v.stopPropagation(),children:[l.jsxs("div",{className:"af-shortcuts-panel__head",children:[l.jsx("h2",{id:a,className:"af-shortcuts-panel__title",children:o("project:deleteModal.title")}),l.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":o("project:deleteModal.close"),children:l.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),l.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:y,children:[l.jsx("p",{className:"af-new-pipeline-lead",children:o("project:deleteModal.lead",{flowId:n})}),l.jsxs("label",{className:"af-new-pipeline-field",children:[l.jsx("span",{className:"af-pipeline-drawer-label",children:o("project:deleteModal.confirmLabel")}),l.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?l.jsx("p",{className:"af-err af-new-pipeline-err",children:h}):null,l.jsxs("div",{className:"af-new-pipeline-actions",children:[l.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:d,children:o("project:deleteModal.cancel")}),l.jsx("button",{type:"submit",className:"af-btn-primary af-btn-destructive",disabled:!k||d,children:o(d?"project:deleteModal.deleting":"project:deleteModal.confirmDelete")})]})]})]})})}function d9({children:e}){return l.jsx("kbd",{className:"af-kbd",children:e})}function Ws({keys:e}){return l.jsx("span",{className:"af-shortcuts-keys",children:e.map((t,n)=>l.jsxs("span",{children:[n>0?l.jsx("span",{className:"af-shortcuts-keys__plus",children:"+"}):null,l.jsx(d9,{children:t})]},n))})}function f9({open:e,onClose:t}){const{t:n}=bt(),r=m.useRef(null);if(m.useEffect(()=>{if(!e)return;const o=requestAnimationFrame(()=>{var a;return(a=r.current)==null?void 0:a.focus()});return()=>cancelAnimationFrame(o)},[e]),!e)return null;const s=l9()?"⌘":"Ctrl";return l.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:o=>{o.target===o.currentTarget&&t()},children:l.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:[l.jsxs("div",{className:"af-shortcuts-panel__head",children:[l.jsx("h2",{id:"af-shortcuts-title",className:"af-shortcuts-panel__title",children:n("flow:shortcuts.title")}),l.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":n("common:common.close"),children:l.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),l.jsxs("div",{className:"af-shortcuts-panel__body",children:[l.jsxs("section",{className:"af-shortcuts-section",children:[l.jsx("h3",{className:"af-shortcuts-cat",children:n("flow:shortcuts.general")}),l.jsxs("ul",{className:"af-shortcuts-list",children:[l.jsxs("li",{className:"af-shortcuts-row",children:[l.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.saveDesc")}),l.jsx(Ws,{keys:[s,"S"]})]}),l.jsxs("li",{className:"af-shortcuts-row",children:[l.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.shortcutsLabel")}),l.jsx(Ws,{keys:["?"]})]}),l.jsxs("li",{className:"af-shortcuts-row",children:[l.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.jumpToNode")}),l.jsx(Ws,{keys:[s,"K"]})]})]})]}),l.jsxs("section",{className:"af-shortcuts-section",children:[l.jsx("h3",{className:"af-shortcuts-cat",children:n("flow:shortcuts.canvas")}),l.jsxs("ul",{className:"af-shortcuts-list",children:[l.jsxs("li",{className:"af-shortcuts-row",children:[l.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.selectTool")}),l.jsx(Ws,{keys:["V"]})]}),l.jsxs("li",{className:"af-shortcuts-row",children:[l.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.panTool")}),l.jsx(Ws,{keys:["H"]})]}),l.jsxs("li",{className:"af-shortcuts-row",children:[l.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.holdSpacePan")}),l.jsx(Ws,{keys:["Space"]})]}),l.jsxs("li",{className:"af-shortcuts-row",children:[l.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.selectAll")}),l.jsx(Ws,{keys:[s,"A"]})]})]})]})]})]})})}function p9(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 h9({open:e,onClose:t,onJump:n,nodes:r}){const{t:i}=bt(),[s,o]=m.useState(""),[a,c]=m.useState(0),u=m.useRef(null),p=m.useRef(null);m.useEffect(()=>{if(!e)return;o(""),c(0);const g=requestAnimationFrame(()=>{var b;return(b=u.current)==null?void 0:b.focus()});return()=>cancelAnimationFrame(g)},[e]);const d=m.useMemo(()=>{const g=(r||[]).map(y=>{var v,w,N;return{id:y.id,label:((v=y.data)==null?void 0:v.label)||"",definitionId:((w=y.data)==null?void 0:w.definitionId)||"",schemaType:((N=y.data)==null?void 0:N.schemaType)||""}}),b=s.trim(),k=g.map(y=>({e:y,s:p9(y,b)})).filter(y=>y.s>0);return k.sort((y,v)=>v.s-y.s||y.e.id.localeCompare(v.e.id)),k.slice(0,50).map(y=>y.e)},[r,s]);if(m.useEffect(()=>{a>=d.length&&c(0)},[d.length,a]),m.useEffect(()=>{var b;const g=(b=p.current)==null?void 0:b.querySelector(`[data-idx="${a}"]`);g&&g.scrollIntoView({block:"nearest"})},[a]),!e)return null;const f=g=>{const b=d[g];b&&(n(b.id),t())},h=g=>{if(g.key==="Escape"){g.preventDefault(),t();return}if(g.key==="ArrowDown"){g.preventDefault(),c(b=>Math.min(d.length-1,b+1));return}if(g.key==="ArrowUp"){g.preventDefault(),c(b=>Math.max(0,b-1));return}g.key==="Enter"&&(g.preventDefault(),f(a))};return l.jsx("div",{className:"af-jump-overlay",role:"presentation",onMouseDown:g=>{g.target===g.currentTarget&&t()},children:l.jsxs("div",{className:"af-jump-panel",role:"dialog","aria-modal":"true","aria-label":i("flow:jumpPalette.title"),onMouseDown:g=>g.stopPropagation(),children:[l.jsxs("div",{className:"af-jump-panel__input-wrap",children:[l.jsx("span",{className:"af-jump-panel__icon material-symbols-outlined","aria-hidden":!0,children:"search"}),l.jsx("input",{ref:u,type:"text",className:"af-jump-panel__input",placeholder:i("flow:jumpPalette.placeholder"),value:s,onChange:g=>{o(g.target.value),c(0)},onKeyDown:h,spellCheck:!1,autoComplete:"off"}),l.jsx("span",{className:"af-jump-panel__count",children:d.length})]}),d.length===0?l.jsx("div",{className:"af-jump-panel__empty",children:i("flow:jumpPalette.empty")}):l.jsx("ul",{ref:p,className:"af-jump-panel__list",role:"listbox",children:d.map((g,b)=>l.jsxs("li",{"data-idx":b,role:"option","aria-selected":b===a,className:"af-jump-panel__item"+(b===a?" af-jump-panel__item--active":""),onMouseEnter:()=>c(b),onMouseDown:k=>{k.preventDefault(),f(b)},children:[l.jsx("span",{className:"af-jump-panel__id",children:g.id}),g.label&&g.label!==g.id&&l.jsx("span",{className:"af-jump-panel__label",children:g.label}),g.definitionId&&l.jsx("span",{className:"af-jump-panel__tag",children:g.definitionId})]},g.id))}),l.jsxs("div",{className:"af-jump-panel__hint",children:[l.jsxs("span",{children:[l.jsx("kbd",{className:"af-kbd",children:"↑"}),l.jsx("kbd",{className:"af-kbd",children:"↓"})," ",i("flow:jumpPalette.hintNavigate")]}),l.jsxs("span",{children:[l.jsx("kbd",{className:"af-kbd",children:"Enter"})," ",i("flow:jumpPalette.hintJump")]}),l.jsxs("span",{children:[l.jsx("kbd",{className:"af-kbd",children:"Esc"})," ",i("flow:jumpPalette.hintClose")]})]})]})})}function m9({open:e,onClose:t,flowId:n,flowSource:r,flowArchived:i=!1,filePath:s,fileName:o,onSaved:a,onAiEdit:c}){const{t:u}=bt(),p=m.useId(),d=m.useRef(null),f=m.useRef(null),[h,g]=m.useState(""),[b,k]=m.useState(""),[y,v]=m.useState(!1),[w,N]=m.useState(!1),[C,S]=m.useState(!1),[P,R]=m.useState(""),[M,H]=m.useState("");if(m.useEffect(()=>{if(!e||!s)return;g(""),k(""),R(""),H(""),v(!0),N(!1),S(!1);const $=new URLSearchParams({flowId:n,flowSource:r,archived:i?"1":"0",path:s});(async()=>{try{const I=await fetch(`/api/pipeline-file-content?${$}`),T=await I.json();if(!I.ok)throw new Error(T.error||"HTTP "+I.status);g(T.content||""),k(T.content||"")}catch(I){R(I.message||String(I))}finally{v(!1)}})();const F=requestAnimationFrame(()=>{var I;return(I=d.current)==null?void 0:I.focus()});return()=>cancelAnimationFrame(F)},[e,s,n,r,i]),!e)return null;const _=h!==b;async function A($){if($.preventDefault(),!w){N(!0),R(""),H("");try{const F=new URLSearchParams({flowId:n,flowSource:r,archived:i?"1":"0",path:s}),I=await fetch(`/api/pipeline-file-save?${F}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:h})}),T=await I.json();if(!I.ok)throw new Error(T.error||"HTTP "+I.status);k(h),H(u("flow:fileEdit.saved")),a&&a()}catch(F){R(F.message||String(F))}finally{N(!1)}}}async function U(){if(!(!c||C||!h)){S(!0),R("");try{const $=await c(h);typeof $=="string"&&$&&g($)}catch($){R($.message||String($))}finally{S(!1)}}}function L(){g(b),R(""),H("")}const B=h.length>1e5;return l.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:$=>{$.target===$.currentTarget&&t()},children:l.jsxs("div",{ref:d,className:"af-shortcuts-panel af-file-edit-panel",role:"dialog","aria-modal":"true","aria-labelledby":p,tabIndex:-1,onMouseDown:$=>$.stopPropagation(),children:[l.jsxs("div",{className:"af-shortcuts-panel__head",children:[l.jsx("h2",{id:p,className:"af-shortcuts-panel__title",children:o||s}),l.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":u("flow:fileEdit.close"),children:l.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),l.jsx("div",{className:"af-file-edit-body",children:y?l.jsx("div",{className:"af-file-edit-loading",children:u("flow:fileEdit.loading")}):P&&!h?l.jsx("div",{className:"af-file-edit-error",children:P}):l.jsxs(l.Fragment,{children:[B&&l.jsx("div",{className:"af-file-edit-warning",children:u("flow:fileEdit.largeFileWarning")}),l.jsx("textarea",{ref:f,className:"af-file-edit-textarea",value:h,onChange:$=>g($.target.value),spellCheck:!1,placeholder:u("flow:fileEdit.placeholder")})]})}),(P||M)&&!y&&l.jsx("div",{className:`af-file-edit-status${M?" af-file-edit-status--success":""}`,children:M||P}),l.jsxs("div",{className:"af-file-edit-actions",children:[l.jsx("button",{type:"button",className:"af-btn-secondary",onClick:L,disabled:!_||w||C,children:u("flow:fileEdit.reset")}),c&&l.jsx("button",{type:"button",className:"af-btn-secondary af-btn-ai",onClick:U,disabled:C||w||!h,children:u(C?"flow:fileEdit.aiRunning":"flow:fileEdit.aiEdit")}),l.jsx("button",{type:"button",className:"af-btn-primary",onClick:A,disabled:!_||w||C,children:u(w?"flow:fileEdit.saving":"flow:fileEdit.save")})]})]})})}const ZP=new Set(["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"]),g9=["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"];function y9(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 x9(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 Mk(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 e_(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 t_(e){return{inputNames:Mk(e==null?void 0:e.inputs),outputNames:Mk(e==null?void 0:e.outputs)}}function w9(e,t,n){const r=t_(t),i=x9(e),s=[];for(const o of i)if(!e_(o.key,r)){const a=o.key.trim()===""?n("flow:placeholder.empty"):o.key.trim();s.push({start:o.start,end:o.end,message:n("flow:placeholder.invalidPlaceholder",{hint:a})})}return s}function v9(e,t){const n=t_(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 a=o[0],c=e_(o[1],n);i.push({kind:c?"ph-valid":"ph-invalid",text:a}),s=o.index+a.length}return s<e.length&&i.push({kind:"plain",text:e.slice(s)}),i}function b9(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function k9(e){return e.map(t=>{const n=b9(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 S9(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 g9)ZP.has(r)&&n.push({section:"runtime",insert:r,label:r,subtitle:t("flow:placeholder.runtimeConst")});return n}function N9(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 j9(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 a=o.getBoundingClientRect(),c=parseFloat(r.lineHeight),u=Number.isFinite(c)&&c>0?c:a.height||16;return document.body.removeChild(i),{top:a.top,left:a.left,bottom:a.bottom,height:u}}function Rd({value:e,onChange:t,disabled:n,placeholder:r,rows:i=8,textareaClassName:s,ioSlots:o,variant:a="drawer"}){const{t:c}=bt(),u=m.useId(),p=m.useRef(null),d=m.useRef(null),[f,h]=m.useState(0),[g,b]=m.useState(0),[k,y]=m.useState(null),v=m.useMemo(()=>w9(e,o,c),[e,o,c]),w=v.length>0,N=m.useMemo(()=>v9(e,o),[e,o]),C=m.useMemo(()=>k9(N),[N]),S=m.useMemo(()=>n?null:y9(e,f),[e,f,n]),P=m.useMemo(()=>{if(!S)return[];const A=S9(o,c);return N9(A,S.query)},[S,o,c]);m.useEffect(()=>{b(A=>{const U=Math.max(0,P.length-1);return Math.min(Math.max(0,A),U)})},[P.length]);const R=m.useCallback(()=>{const A=p.current;if(!A||!S||P.length===0){y(null);return}const U=j9(A,f);if(!U){y(null);return}const L=4,B=44,$=13.5*16,F=Math.min(P.length*B+8,$);let I=U.bottom+L;I+F>window.innerHeight-8&&(I=Math.max(8,U.top-F-L));const T=288;let E=U.left;E=Math.max(8,Math.min(E,window.innerWidth-T-8)),y({top:I,left:E})},[S,P.length,f]);m.useLayoutEffect(()=>{if(!S||P.length===0){y(null);return}const A=requestAnimationFrame(()=>R());return()=>cancelAnimationFrame(A)},[S,P.length,f,e,R]),m.useEffect(()=>{if(!S||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)}},[S,P.length,R]);const M=m.useCallback(A=>{if(!S)return;const{atIndex:U}=S,L=e.slice(0,U)+"${"+A+"}"+e.slice(f);t(L);const B=U+A.length+3;queueMicrotask(()=>{const $=p.current;$&&($.focus(),$.setSelectionRange(B,B)),h(B)})},[S,e,f,t]),H=m.useCallback(()=>{const A=p.current,U=d.current;!A||!U||(U.scrollTop=A.scrollTop,U.scrollLeft=A.scrollLeft,S&&P.length>0&&queueMicrotask(()=>R()))},[S,P.length,R]),_=m.useCallback(A=>{if(!n&&S&&P.length>0&&(A.key==="ArrowDown"||A.key==="ArrowUp"||A.key==="Enter")){if(A.key==="ArrowDown")A.preventDefault(),b(U=>(U+1)%P.length);else if(A.key==="ArrowUp")A.preventDefault(),b(U=>(U-1+P.length)%P.length);else if(A.key==="Enter"&&!A.shiftKey){A.preventDefault();const U=P[g];U&&M(U.insert)}}},[n,S,P,g,M]);return l.jsxs("div",{className:"af-body-prompt-editor"+(a==="expand"?" af-body-prompt-editor--expand":""),children:[l.jsxs("div",{className:"af-body-prompt-stack",children:[l.jsx("pre",{ref:d,className:"af-body-prompt-backdrop "+s,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:C+`
|
|
124
|
-
`}}),l.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 U=A.target;U instanceof HTMLTextAreaElement&&h(U.selectionStart??0)},onClick:A=>{const U=A.target;U instanceof HTMLTextAreaElement&&h(U.selectionStart??0)},onKeyUp:A=>{const U=A.target;U instanceof HTMLTextAreaElement&&h(U.selectionStart??U.value.length)},onKeyDown:_,onScroll:H})]}),S&&P.length>0&&k?Tr.createPortal(l.jsx("ul",{className:"af-body-ph-menu af-body-ph-menu--pop af-composer-mention-menu",role:"listbox","aria-label":c("flow:nodeProps.placeholderSlots"),style:{position:"fixed",top:k.top,left:k.left,right:"auto",bottom:"auto",margin:0,zIndex:2e4},children:P.map((A,U)=>l.jsx("li",{role:"option","aria-selected":U===g,children:l.jsxs("button",{type:"button",className:"af-composer-mention-item"+(U===g?" af-composer-mention-item--active":""),onMouseDown:L=>L.preventDefault(),onMouseEnter:()=>b(U),onClick:()=>M(A.insert),children:[l.jsx("span",{className:"af-composer-mention-id",children:`\${${A.insert}}`}),A.subtitle?l.jsx("span",{className:"af-composer-mention-sub",children:A.subtitle}):null]})},`${A.section}-${A.insert}`))}),document.body):null,w?l.jsx("p",{id:u,className:"af-body-ph-issues",role:"status",children:v.map(A=>A.message).join(" · ")}):null]})}const C9=/^[a-zA-Z_][a-zA-Z0-9_-]*$/;function Ld(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function Dk({kind:e,label:t,slots:n,onSlotsChange:r,disabled:i}){const{t:s}=bt(),o=()=>r([...n,{type:"node",name:"",default:""}]),a=p=>r(n.filter((d,f)=>f!==p)),c=(p,d,f)=>{const h=n.map((g,b)=>b===p?{...g,[d]:f}:g);r(h)},u=e==="input"?"input":"output";return l.jsxs("div",{className:"af-node-props-field af-node-props-field--io",children:[l.jsxs("div",{className:"af-node-props-io-head",children:[l.jsx("span",{className:"af-node-props-label",children:t}),l.jsx("button",{type:"button",className:"af-btn-ghost af-node-props-io-add",onClick:o,disabled:i,"aria-label":s("flow:nodeProps.addPinAriaLabel",{label:t}),children:s("flow:nodeProps.addPin")})]}),l.jsx("p",{className:"af-node-props-io-hint",children:s("flow:nodeProps.handleHint",{prefix:u})}),n.length===0?l.jsx("p",{className:"af-node-props-io-empty",children:s(e==="input"?"flow:nodeProps.noInputPins":"flow:nodeProps.noOutputPins")}):null,n.length>0?l.jsxs("div",{className:"af-node-props-io-table",role:"group","aria-label":t,children:[l.jsxs("div",{className:"af-node-props-io-table-head","aria-hidden":!0,children:[l.jsx("span",{children:s("flow:nodeProps.handle")}),l.jsx("span",{children:s("flow:nodeProps.type")}),l.jsx("span",{children:s("flow:nodeProps.name")}),l.jsx("span",{children:s("flow:nodeProps.defaultValue")}),l.jsx("span",{})]}),n.map((p,d)=>l.jsxs("div",{className:"af-node-props-io-row",children:[l.jsxs("span",{className:"af-node-props-io-handle",title:`${u}-${d}`,children:[u,"-",d]}),l.jsx("select",{className:"af-node-props-input af-node-props-io-cell",value:p.type,onChange:f=>c(d,"type",f.target.value),disabled:i,"aria-label":s("flow:nodeProps.pinTypeAriaLabel",{label:t,index:d}),children:["node","text","file","bool"].map(f=>l.jsx("option",{value:f,children:f},f))}),l.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:p.name,onChange:f=>c(d,"name",f.target.value),disabled:i,spellCheck:!1,autoComplete:"off","aria-label":s("flow:nodeProps.pinNameAriaLabel",{label:t,index:d})}),l.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:p.default,onChange:f=>c(d,"default",f.target.value),disabled:i,spellCheck:!1,autoComplete:"off","aria-label":s("flow:nodeProps.pinDefaultAriaLabel",{label:t,index:d})}),l.jsx("button",{type:"button",className:"af-icon-btn af-node-props-io-remove",onClick:()=>a(d),disabled:i,"aria-label":s("flow:nodeProps.deletePinAriaLabel",{label:t,index:d}),title:s("flow:nodeProps.deletePin"),children:l.jsx("span",{className:"material-symbols-outlined",children:"delete"})})]},`${u}-${d}`))]}):null]})}function E9({draft:e,setDraft:t,definitionId:n,systemPromptReadonly:r,modelLists:i,disabled:s,onIdBlur:o,onClose:a,onPublishToMarketplace:c,error:u,ioSlots:p}){const{t:d}=bt(),[f,h]=m.useState(!1),[g,b]=m.useState(!1),[k,y]=m.useState({status:"idle",message:""}),v=m.useCallback(_=>{t(A=>A&&{...A,..._})},[t]),{cursorList:w,opencodeList:N,claudeCodeList:C,currentNotInLists:S}=m.useMemo(()=>{const _=Array.isArray(i==null?void 0:i.cursor)?i.cursor:[],A=Array.isArray(i==null?void 0:i.opencode)?i.opencode:[],U=Array.isArray(i==null?void 0:i.claudeCode)?i.claudeCode:[],L=new Set([..._,...A,...U].map(Ld)),B=((e==null?void 0:e.model)??"").trim(),$=B.startsWith("cursor:")?B.slice(7):B.startsWith("opencode:")?B.slice(9):B.startsWith("claude-code:")?B.slice(12):B,F=B&&!L.has($)?B:"";return{cursorList:_,opencodeList:A,claudeCodeList:U,currentNotInLists:F}},[i,e==null?void 0:e.model]);if(!e)return null;const P=String(e.script??""),R=n==="tool_nodejs"||P.trim()!=="",M=typeof c=="function"&&!s&&(e==null?void 0:e.newId),H=async()=>{if(M){y({status:"running",message:d("flow:nodeProps.publishRunning")});try{const _=await c(e,n);y({status:"success",message:_!=null&&_.definitionId?d("flow:nodeProps.publishSuccessWithId",{id:_.definitionId}):d("flow:nodeProps.publishSuccess")})}catch(_){y({status:"error",message:String((_==null?void 0:_.message)||_)})}}};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"af-pipeline-drawer-head af-node-props-head",children:[l.jsx("h2",{className:"af-pipeline-drawer-title",children:d("flow:nodeProps.title")}),l.jsxs("div",{className:"af-node-props-head-actions",children:[l.jsxs("button",{type:"button",className:"af-btn-ghost af-node-props-market-btn",onClick:H,disabled:!M||k.status==="running",title:d("flow:nodeProps.publishToMarketplaceHint"),children:[l.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"inventory_2"}),k.status==="running"?d("flow:nodeProps.publishing"):d("flow:nodeProps.publishToMarketplace")]}),l.jsx("button",{type:"button",className:"af-btn-ghost af-node-props-close-secondary",onClick:a,children:d("common:common.close")})]})]}),l.jsxs("div",{className:"af-pipeline-drawer-body af-node-props-body",children:[u?l.jsx("p",{className:"af-err af-node-props-err",children:u}):null,k.message?l.jsx("p",{className:`af-node-props-market-status af-node-props-market-status--${k.status}`,children:k.message}):null,l.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[l.jsx("span",{className:"af-node-props-label",children:d("flow:node.nodeType")}),l.jsx("div",{className:"af-pipeline-drawer-readonly af-node-props-readonly-mono",children:n})]}),l.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[l.jsxs("span",{className:"af-node-props-label",children:[d("flow:node.displayName"),l.jsx("span",{className:"af-node-props-hint",children:d("flow:node.displayNameHint")})]}),l.jsx("input",{type:"text",className:"af-node-props-input",value:e.newId,onChange:_=>v({newId:_.target.value}),onBlur:o,disabled:s,spellCheck:!1,autoComplete:"off","aria-label":d("flow:nodeProps.instanceId")})]}),l.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[l.jsxs("span",{className:"af-node-props-label",children:[d("flow:node.displayName"),"(LABEL)"]}),l.jsx("input",{type:"text",className:"af-node-props-input",value:e.label,onChange:_=>v({label:_.target.value}),disabled:s,spellCheck:!1})]}),l.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[l.jsxs("span",{className:"af-node-props-label",children:[d("flow:node.role"),"(ROLE)"]}),l.jsx("select",{className:"af-node-props-select",value:xo.includes(e.role)?e.role:d("flow:roles.normal"),onChange:_=>v({role:_.target.value}),disabled:s,children:xo.map(_=>l.jsx("option",{value:_,children:_},_))})]}),l.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[l.jsxs("span",{className:"af-node-props-label",children:[d("flow:node.model"),"(MODEL)"]}),l.jsx("span",{className:"af-node-props-sublabel",children:d("flow:node.modelHint")}),l.jsxs("select",{className:"af-node-props-select",value:(()=>{const _=(e.model||"").trim();return _?S||_:""})(),onChange:_=>v({model:_.target.value}),disabled:s,"aria-label":d("flow:nodeProps.modelAriaLabel"),children:[l.jsx("option",{value:"",children:d("flow:node.defaultModel")}),S?l.jsxs("option",{value:S,children:[S,d("flow:nodeProps.yamlValueNotInList")]}):null,w.length>0?l.jsx("optgroup",{label:"Cursor",children:w.map(_=>l.jsx("option",{value:Ld(_),children:_},`c-${_}`))}):null,N.length>0?l.jsx("optgroup",{label:"OpenCode",children:N.map(_=>l.jsx("option",{value:Ld(_),children:_},`o-${_}`))}):null,C.length>0?l.jsx("optgroup",{label:"Claude Code",children:C.map(_=>l.jsx("option",{value:`claude-code:${Ld(_)}`,children:_},`cc-${_}`))}):null]})]}),l.jsx(Dk,{kind:"input",label:d("flow:nodeProps.inputPins"),slots:Array.isArray(e.inputs)?e.inputs:[],onSlotsChange:_=>v({inputs:_}),disabled:s}),l.jsx(Dk,{kind:"output",label:d("flow:nodeProps.outputPins"),slots:Array.isArray(e.outputs)?e.outputs:[],onSlotsChange:_=>v({outputs:_}),disabled:s}),R?l.jsxs("div",{className:"af-pipeline-drawer-field af-node-props-field af-node-props-field--prompt",children:[l.jsxs("div",{className:"af-node-props-prompt-head",children:[l.jsxs("span",{className:"af-node-props-label",children:[d("flow:node.directCommand"),"(script)",l.jsx("span",{className:"af-node-props-hint",children:d("flow:node.scriptHint")})]}),l.jsx("button",{type:"button",className:"af-icon-btn af-node-props-expand",onClick:()=>b(!0),"aria-label":d("flow:nodeProps.expandEditScript"),title:d("flow:nodeProps.expand"),disabled:s,children:l.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),l.jsx(Rd,{value:P,onChange:_=>v({script:_}),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:p,variant:"drawer"})]}):null,l.jsxs("div",{className:"af-pipeline-drawer-field af-node-props-field af-node-props-field--prompt",children:[l.jsxs("div",{className:"af-node-props-prompt-head",children:[l.jsx("span",{className:"af-node-props-label",children:d("flow:node.userPrompt")}),l.jsx("button",{type:"button",className:"af-icon-btn af-node-props-expand",onClick:()=>h(!0),"aria-label":d("flow:nodeProps.expandEdit"),title:d("flow:nodeProps.expand"),disabled:s,children:l.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),l.jsx(Rd,{value:e.body,onChange:_=>v({body:_}),disabled:s,placeholder:d("flow:nodeProps.bodyPlaceholder"),rows:8,textareaClassName:"af-pipeline-drawer-textarea af-node-props-body-textarea",ioSlots:p,variant:"drawer"})]}),l.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[l.jsx("span",{className:"af-node-props-label",children:d("flow:node.systemDescription")}),l.jsx("textarea",{className:"af-pipeline-drawer-textarea af-node-props-system-readonly",rows:4,readOnly:!0,value:r||d("flow:nodeProps.noDescription"),spellCheck:!1})]})]}),g?l.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":d("flow:nodeProps.editScript"),onMouseDown:_=>{_.target===_.currentTarget&&b(!1)},children:l.jsxs("div",{className:"af-node-props-expand-panel",children:[l.jsxs("div",{className:"af-node-props-expand-head",children:[l.jsx("span",{className:"af-node-props-expand-title",children:d("flow:node.directCommand")}),l.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>b(!1),"aria-label":d("flow:nodeProps.collapse"),children:l.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),l.jsx(Rd,{value:P,onChange:_=>v({script:_}),disabled:s,placeholder:d("flow:nodeProps.scriptPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:p,variant:"expand"})]})}):null,f?l.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":d("flow:nodeProps.editUserPrompt"),onMouseDown:_=>{_.target===_.currentTarget&&h(!1)},children:l.jsxs("div",{className:"af-node-props-expand-panel",children:[l.jsxs("div",{className:"af-node-props-expand-head",children:[l.jsx("span",{className:"af-node-props-expand-title",children:d("flow:node.body")}),l.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>h(!1),"aria-label":d("flow:nodeProps.collapse"),children:l.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),l.jsx(Rd,{value:e.body,onChange:_=>v({body:_}),disabled:s,placeholder:d("flow:nodeProps.bodyPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:p,variant:"expand"})]})}):null]})}function dw(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 P9(e){const t=dw(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 n_(e){try{return JSON.stringify(JSON.parse(e.trim()),null,2)}catch{return e}}function $k({text:e}){const{t}=bt(),n=e||"";return n.trim()?l.jsx("div",{className:"af-run-ctx-md",children:l.jsx(pu,{children:n})}):l.jsx("div",{className:"af-run-ctx-hint",children:t("flow:runContext.empty")})}function Fk({o:e}){var r;const{t}=bt(),n=dw(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 l.jsxs("div",{className:"af-run-ctx-media",children:[l.jsx("img",{className:"af-run-ctx-img",src:s,alt:e.slot||"output",loading:"lazy"}),e.truncated?l.jsx("div",{className:"af-run-ctx-hint",children:t("flow:runContext.imageTruncated")}):null]})}if(n==="json")return l.jsx("pre",{className:"af-run-ctx-pre",children:n_(e.content||"")});if(n==="markdown"){const i=e.content||"";return i.trim()?l.jsx("div",{className:"af-run-ctx-md",children:l.jsx(pu,{children:i})}):l.jsx("div",{className:"af-run-ctx-hint",children:t("flow:runContext.empty")})}return l.jsx("pre",{className:"af-run-ctx-pre",children:e.content!=null&&e.content!==""?e.content:t("flow:runContext.empty")})}function zk(e){return P9(e)}function Bk(e){var r;if(!e)return null;const t=dw(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"?n_(String(n)):String(n)}function Hk({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 l.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:l.jsx("span",{className:"material-symbols-outlined",children:r?"check":"content_copy"})})}const Uk=2e4,r_="af:run-node-ctx-width";function uf(){return typeof window>"u"?416:Math.min(26*16,window.innerWidth-32)}function ds(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):ds(uf())}function _9(){try{const e=localStorage.getItem(r_);if(e==null)return ds(uf());const t=parseInt(e,10);return Number.isFinite(t)?ds(t):ds(uf())}catch{return ds(uf())}}async function Vk(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 a;try{a=JSON.parse(o)}catch{throw new Error(o.startsWith("<!")||o.startsWith("<html")?"apiConnectError":"invalidJson")}if(!s.ok)throw new Error(a.error||"HTTP "+s.status);return a}function I9(e,t){const n=`flow:runContext.${t}`,r=e(n);return r!==n?r:t}function A9({instanceId:e,flowId:t,runId:n,nodeStatus:r,onClose:i}){const{t:s}=bt(),[o,a]=m.useState(()=>typeof window<"u"&&window.matchMedia("(max-width: 960px)").matches),[c,u]=m.useState(_9),p=m.useRef({active:!1,pointerId:-1,startX:0,startW:416}),[d,f]=m.useState(!0),[h,g]=m.useState(""),[b,k]=m.useState([]),[y,v]=m.useState(null),[w,N]=m.useState(null),C=m.useRef(null),S=m.useRef(null),P=m.useRef(0),R=m.useRef(0);m.useLayoutEffect(()=>{const I=window.matchMedia("(max-width: 960px)"),T=()=>a(I.matches);return I.addEventListener("change",T),()=>I.removeEventListener("change",T)},[]),m.useEffect(()=>{function I(){u(T=>ds(T))}return window.addEventListener("resize",I),()=>window.removeEventListener("resize",I)},[]);const M=m.useCallback(()=>{u(I=>{const T=ds(I);try{localStorage.setItem(r_,String(T))}catch{}return T})},[]),H=m.useCallback(I=>{if(o||I.button!==0)return;I.preventDefault();const T=I.currentTarget;p.current={active:!0,pointerId:I.pointerId,startX:I.clientX,startW:c},T.setPointerCapture(I.pointerId)},[o,c]),_=m.useCallback(I=>{const T=p.current;if(!T.active||I.pointerId!==T.pointerId)return;const E=T.startX-I.clientX;u(ds(T.startW+E))},[]),A=m.useCallback(I=>{const T=p.current;if(!(!T.active||I.pointerId!==T.pointerId)){T.active=!1;try{I.currentTarget.releasePointerCapture(I.pointerId)}catch{}M()}},[M]),U=m.useCallback(()=>{const I=p.current;I.active&&(I.active=!1,M())},[M]),L=m.useCallback(I=>{const T=Array.isArray(I)?I:[];k(T),v(E=>E&&T.some(q=>q.execId===E)?E:T.length>0?T[T.length-1].execId:null)},[]),B=m.useCallback(()=>{if(!e||!t)return;const I=++P.current,T=new AbortController,E=window.setTimeout(()=>T.abort(),Uk);(async()=>{try{const q=await Vk(t,e,n,T.signal);if(I!==P.current)return;L(Array.isArray(q.rounds)?q.rounds:[])}catch{}finally{window.clearTimeout(E)}})()},[e,t,n,L]);m.useEffect(()=>{if(!e||!t){f(!1),g(""),k([]);return}const I=++R.current;f(!0),g(""),k([]),v(null);const T=new AbortController,E=window.setTimeout(()=>T.abort(),Uk);return(async()=>{try{const q=await Vk(t,e,n,T.signal);if(I!==R.current)return;L(Array.isArray(q.rounds)?q.rounds:[])}catch(q){if(I!==R.current)return;const W=(q==null?void 0:q.name)==="AbortError"?"requestTimeout":q.message||String(q);g(W)}finally{window.clearTimeout(E),I===R.current&&f(!1)}})(),()=>{T.abort(),R.current++,P.current++}},[e,t,n,L]),m.useEffect(()=>{r&&B()},[r,B]),m.useEffect(()=>{clearInterval(S.current);const I=b.length>0?b[b.length-1]:null;return(r==="running"&&b.length===0||!!(I&&I.status==="running"))&&e&&t&&(S.current=setInterval(()=>B(),2e3)),()=>clearInterval(S.current)},[b,e,t,n,r,B]),m.useEffect(()=>{C.current&&(C.current.scrollTop=0)},[y]);const $=b.find(I=>I.execId===y),F=o?void 0:{width:`${c}px`};return l.jsxs("aside",{className:"af-run-ctx-panel",style:F,"aria-label":s("flow:runContext.title"),children:[o?null:l.jsx("div",{className:"af-run-ctx-resize",role:"separator","aria-orientation":"vertical","aria-label":s("flow:runContext.resizeHandle"),onPointerDown:H,onPointerMove:_,onPointerUp:A,onPointerCancel:A,onLostPointerCapture:U}),l.jsxs("div",{className:"af-run-ctx-panel__main",children:[l.jsxs("div",{className:"af-run-ctx-head",children:[l.jsx("h2",{className:"af-run-ctx-title",title:e,children:e}),l.jsx("button",{type:"button",className:"af-icon-btn",onClick:i,"aria-label":s("common:common.close"),children:l.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),d&&l.jsx("div",{className:"af-run-ctx-placeholder",children:s("common:common.loading")}),h&&l.jsx("div",{className:"af-run-ctx-error",children:I9(s,h)}),!d&&!h&&b.length===0&&l.jsx("div",{className:"af-run-ctx-placeholder",children:s(r==="running"?"flow:runContext.executingNoArtifacts":"flow:runContext.noData")}),b.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"af-run-ctx-rounds af-run-ctx-rounds--select af-run-ctx-round--"+R9(($==null?void 0:$.status)||""),children:[l.jsx("span",{className:"af-run-ctx-round-dot","aria-hidden":!0}),l.jsx("select",{className:"af-run-ctx-round-select",value:String(y??""),onChange:I=>{const T=I.target.value;v(T==="latest"?"latest":Number(T))},children:[...b].reverse().map(I=>{const T=I.execId==="latest"?s("flow:runContext.latest"):`#${I.execId}`,E=L9(s,I.status),q=I.finishedAt?` · ${T9(I.finishedAt)}`:"";return l.jsx("option",{value:String(I.execId),children:`${T} · ${E}${q}`},I.execId)})})]}),$&&l.jsxs("div",{className:"af-run-ctx-body",ref:C,children:[$.inputs&&$.inputs.length>0&&l.jsxs("section",{className:"af-run-ctx-section",children:[l.jsxs("h3",{className:"af-run-ctx-section-title",children:[l.jsx("span",{className:"material-symbols-outlined af-run-ctx-section-icon","aria-hidden":!0,children:"input"}),"Inputs"]}),$.inputs.map((I,T)=>l.jsxs("div",{className:"af-run-ctx-output-slot",children:[l.jsx("div",{className:"af-run-ctx-slot-head",children:l.jsx("div",{className:"af-run-ctx-slot-name",children:I.slot})}),l.jsx("pre",{className:"af-run-ctx-slot-text",children:I.value})]},`${I.slot}-${T}`))]}),$.prompt!=null&&l.jsxs("section",{className:"af-run-ctx-section",children:[l.jsxs("h3",{className:"af-run-ctx-section-title",children:[l.jsx("span",{className:"material-symbols-outlined af-run-ctx-section-icon","aria-hidden":!0,children:"description"}),"Prompt",l.jsx("button",{type:"button",className:"af-icon-btn af-run-ctx-section-expand",onClick:()=>N("prompt"),title:s("flow:nodeProps.expand"),children:l.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),l.jsx($k,{text:$.prompt})]}),$.outputs&&$.outputs.length>0&&l.jsxs("section",{className:"af-run-ctx-section",children:[l.jsxs("h3",{className:"af-run-ctx-section-title",children:[l.jsx("span",{className:"material-symbols-outlined af-run-ctx-section-icon","aria-hidden":!0,children:"output"}),"Outputs",l.jsx("button",{type:"button",className:"af-icon-btn af-run-ctx-section-expand",onClick:()=>N("output"),title:s("flow:nodeProps.expand"),children:l.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),$.outputs.map((I,T)=>{const E=zk(I),q=Bk(I);return l.jsxs("div",{className:"af-run-ctx-output-slot",children:[l.jsxs("div",{className:"af-run-ctx-slot-head",children:[l.jsx("div",{className:"af-run-ctx-slot-name",children:I.slot}),E?l.jsx("span",{className:"af-run-ctx-format-badge",title:s("flow:runContext.detectedContentType"),children:E}):null,l.jsx(Hk,{text:q,title:s("common:common.copy"),copiedLabel:s("common:common.copied")})]}),l.jsx(Fk,{o:I})]},`${I.slot}-${T}`)})]}),!$.prompt&&(!$.outputs||$.outputs.length===0)&&l.jsx("div",{className:"af-run-ctx-placeholder",children:s("flow:runContext.roundNoContent")})]})]})]}),w&&$&&l.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true",onClick:I=>{I.target===I.currentTarget&&N(null)},children:l.jsxs("div",{className:"af-node-props-expand-panel",children:[l.jsxs("div",{className:"af-node-props-expand-head",children:[l.jsx("span",{className:"af-node-props-expand-title",children:w==="prompt"?"Prompt":"Outputs"}),l.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>N(null),"aria-label":s("common:common.close"),children:l.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),l.jsxs("div",{className:"af-node-props-expand-body af-run-ctx-expand-body",children:[w==="prompt"&&$.prompt!=null&&l.jsx($k,{text:$.prompt}),w==="output"&&$.outputs&&$.outputs.map((I,T)=>{const E=zk(I),q=Bk(I);return l.jsxs("div",{className:"af-run-ctx-output-slot",style:{marginBottom:"1rem"},children:[l.jsxs("div",{className:"af-run-ctx-slot-head",children:[l.jsx("div",{className:"af-run-ctx-slot-name",children:I.slot}),E?l.jsx("span",{className:"af-run-ctx-format-badge",children:E}):null,l.jsx(Hk,{text:q,title:s("common:common.copy"),copiedLabel:s("common:common.copied")})]}),l.jsx(Fk,{o:I})]},`${I.slot}-${T}`)})]})]})})]})}function T9(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 R9(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 L9(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 O9({flowId:e,flowSource:t,flowArchived:n,provideNodes:r,edges:i,nodes:s,onCliInputsChange:o,onBackToEdit:a}){const{t:c}=bt(),[u,p]=m.useState({}),[d,f]=m.useState(null),[h,g]=m.useState({}),[b,k]=m.useState(!0),[y,v]=m.useState(!1),[w,N]=m.useState(""),[C,S]=m.useState(!1),[P,R]=m.useState(null),M=m.useRef(null),H=m.useRef(!0),_=m.useRef({});m.useMemo(()=>{var E,q,W;const T={};for(const O of r){const X=(W=(q=(E=O.data)==null?void 0:E.outputs)==null?void 0:q[0])==null?void 0:W.default;X!=null&&X!==""&&(T[O.id]=String(X))}return _.current=T,T},[r]);const A=m.useMemo(()=>{var E;const T={};for(const q of s){if(!((E=q.data)!=null&&E.inputs))continue;const W=q.data.inputs;for(let O=0;O<W.length;O++){const X=W[O];if(!(X!=null&&X.name))continue;const se=i.find(de=>de.target===q.id&&de.targetHandle===`input-${O}`);if(!(se!=null&&se.source))continue;r.find(de=>de.id===se.source)&&(T[se.source]=X.name)}}return T},[s,i,r]);m.useEffect(()=>(H.current=!0,()=>{H.current=!1}),[]),m.useEffect(()=>{if(!e){k(!1);return}k(!0);const T=new URLSearchParams({flowId:e,flowSource:t||"user"});n&&T.set("archived","1"),fetch(`/api/flow/run-config?${T.toString()}`).then(E=>{if(!E.ok)throw new Error(`HTTP ${E.status}`);return E.json()}).then(E=>{var W;if(!H.current)return;p(E.presets||{}),f(E.activePreset||null);const q=E.activePreset&&((W=E.presets)!=null&&W[E.activePreset])?E.presets[E.activePreset]:{};g({..._.current,...q}),k(!1)}).catch(()=>{H.current&&(g(_.current),k(!1))})},[e,t,n]),m.useEffect(()=>{var E;if(!o)return;const T={};for(const[q,W]of Object.entries(h)){const O=A[q];if(!O)continue;const X=r.find(re=>re.id===q);if(!X)continue;(((E=X.data)==null?void 0:E.definitionId)||"").startsWith("provide_file")?T[O]={type:"file",path:W}:T[O]={type:"str",value:W}}o(T)},[h,A,r,o]);const U=m.useCallback((T,E)=>{g(q=>({...q,[T]:E}))},[]),L=m.useCallback(T=>{T!==d&&(f(T),T&&u[T]?g({..._.current,...u[T]}):g(_.current))},[d,u]),B=m.useCallback(async()=>{if(w.trim()){v(!0);try{const T={...u,[w.trim()]:h},E={flowId:e,flowSource:t,archived:n,presets:T,activePreset:w.trim()};(await fetch("/api/flow/run-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(E)})).ok&&(p(T),f(w.trim()),N(""),S(!1))}finally{v(!1)}}},[e,t,n,u,h,w]),$=m.useCallback(async()=>{if(d){v(!0);try{const T={...u};delete T[d];const E=Object.keys(T)[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:T,activePreset:E})})).ok&&(p(T),f(E),E&&T[E]?g({..._.current,...T[E]}):g(_.current))}finally{v(!1)}}},[e,t,n,u,d]),F=m.useCallback(async()=>{if(d){v(!0);try{const T={...u,[d]:h};(await fetch("/api/flow/run-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:e,flowSource:t,archived:n,presets:T,activePreset:d})})).ok&&p(T)}finally{v(!1)}}},[e,t,n,u,d,h]),I=Object.keys(u);return I.length>0,b?l.jsx("aside",{className:"af-run-config-panel",children:l.jsx("div",{className:"af-run-config-loading",children:c("common.loading")})}):l.jsxs("aside",{className:"af-run-config-panel",children:[l.jsxs("div",{className:"af-run-config-preset",children:[l.jsx("label",{className:"af-run-config-preset-label",children:c("flow:runConfig.preset")}),l.jsxs("div",{className:"af-run-config-preset-row",children:[l.jsxs("select",{className:"af-run-config-preset-select",value:d||"",onChange:T=>L(T.target.value||null),disabled:y,children:[l.jsx("option",{value:"",children:c("flow:runConfig.default")}),I.map(T=>l.jsx("option",{value:T,children:T},T))]}),l.jsx("button",{type:"button",className:"af-run-config-preset-btn af-run-config-preset-btn--new",onClick:()=>S(!0),disabled:y,title:c("flow:runConfig.newPreset"),children:l.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add"})}),d&&l.jsx("button",{type:"button",className:"af-run-config-preset-btn af-run-config-preset-btn--save",onClick:F,disabled:y,title:c("flow:runConfig.savePreset"),children:l.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"save"})}),d&&l.jsx("button",{type:"button",className:"af-run-config-preset-btn af-run-config-preset-btn--delete",onClick:$,disabled:y,title:c("flow:runConfig.deletePreset"),children:l.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"delete"})})]})]}),C&&l.jsxs("div",{className:"af-run-config-save-dialog",children:[l.jsx("input",{type:"text",className:"af-run-config-save-input",placeholder:c("flow:runConfig.presetNamePlaceholder"),value:w,onChange:T=>N(T.target.value),disabled:y}),l.jsxs("div",{className:"af-run-config-save-actions",children:[l.jsx("button",{type:"button",className:"af-btn-primary",onClick:B,disabled:y||!w.trim(),children:c(y?"common.saving":"common.save")}),l.jsx("button",{type:"button",className:"af-btn-outline",onClick:()=>{S(!1),N("")},disabled:y,children:c("common.cancel")})]})]}),l.jsxs("div",{className:"af-run-config-inputs",children:[l.jsx("div",{className:"af-run-config-inputs-header",children:c("flow:runConfig.inputParams")}),r.length===0?l.jsx("div",{className:"af-run-config-empty",children:c("flow:runConfig.noProvideNodes")}):l.jsx("div",{className:"af-run-config-input-list",children:r.map(T=>{var se,re;const q=(((se=T.data)==null?void 0:se.definitionId)||"").startsWith("provide_file"),W=((re=T.data)==null?void 0:re.label)||T.id,O=T.id,X=h[O]||"";return l.jsxs("div",{className:"af-run-config-input-item",children:[l.jsxs("div",{className:"af-run-config-input-head",children:[l.jsx("span",{className:"af-run-config-input-icon material-symbols-outlined"+(q?" af-run-config-input-icon--file":""),"aria-hidden":!0,children:q?"description":"text_fields"}),l.jsx("span",{className:"af-run-config-input-label",children:W}),l.jsx("button",{type:"button",className:"af-run-config-input-expand",onClick:()=>R({instanceId:O,label:W,content:X}),"aria-label":c("flow:runConfig.expandInput"),title:c("flow:runConfig.expandInput"),children:l.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),l.jsx("div",{className:"af-run-config-input-id",children:O}),l.jsx("input",{type:"text",className:"af-run-config-input-field",value:X,onChange:de=>U(O,de.target.value),placeholder:c(q?"flow:runConfig.filePathPlaceholder":"flow:runConfig.stringValuePlaceholder")})]},O)})})]}),P&&Tr.createPortal(l.jsx("div",{className:"af-provide-edit-overlay",children:l.jsxs("div",{className:"af-provide-edit-modal",role:"dialog","aria-modal":"true",children:[l.jsxs("div",{className:"af-provide-edit-modal__head",children:[l.jsx("span",{className:"material-symbols-outlined",children:"edit_document"}),l.jsx("span",{className:"af-provide-edit-modal__title",children:P.label}),l.jsx("button",{type:"button",className:"af-provide-edit-modal__close",onClick:()=>R(null),"aria-label":c("common:close"),children:l.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),l.jsx("div",{className:"af-provide-edit-modal__body",children:l.jsx("textarea",{ref:M,className:"af-provide-edit-modal__textarea",defaultValue:P.content,autoFocus:!0})}),l.jsxs("div",{className:"af-provide-edit-modal__foot",children:[l.jsxs("button",{type:"button",className:"af-provide-edit-modal__btn af-provide-edit-modal__btn--save",onClick:()=>{!P||!M.current||(U(P.instanceId,M.current.value),R(null))},children:[l.jsx("span",{className:"material-symbols-outlined",children:"save"}),c("flow:provideEdit.save")]}),l.jsxs("button",{type:"button",className:"af-provide-edit-modal__btn",onClick:()=>R(null),children:[l.jsx("span",{className:"material-symbols-outlined",children:"close"}),c("flow:provideEdit.cancel")]})]})]})}),document.body)]})}const i_={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"]},M9={"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 D9(e){return!e||e<1024?`${e||0} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}function $9(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 F9(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 Wk(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(i_))if(r.includes(e))return n;return"other"}function z9({event:e,defaultExpanded:t}){const[n,r]=m.useState(!!t),i=M9[e.tag]||"#a8a8a8",s=e.payload,o=s&&typeof s=="object",a=o?typeof s.text=="string"?s.text:"":String(s||""),c=o?s.meta:null,u=m.useMemo(()=>a?a.slice(0,140).replace(/\s+/g," "):o?Object.keys(s).filter(h=>h!=="text"&&h!=="meta").slice(0,3).map(h=>{const g=s[h];return g==null?`${h}:null`:typeof g=="object"?`${h}:{…}`:`${h}:${String(g).slice(0,30)}`}).join(" "):"",[s,a,o]),p=m.useCallback(d=>{d.stopPropagation();const f=o?JSON.stringify(s,null,2):String(s);try{navigator.clipboard.writeText(f)}catch{}},[s,o]);return l.jsxs("div",{style:{borderLeft:`3px solid ${i}`,background:n?"#1c1b1b":"#131313",marginBottom:4,borderRadius:4,cursor:"pointer",transition:"background 120ms"},onClick:()=>r(d=>!d),children:[l.jsxs("div",{style:{padding:"6px 10px",display:"flex",alignItems:"center",gap:10,fontSize:12},children:[l.jsx("span",{style:{color:"#9a9a9a",fontFamily:"monospace",flexShrink:0},children:$9(e.ts)}),l.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}),l.jsx("span",{style:{color:"#c5c2c1",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:"monospace"},children:u}),n&&l.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&&l.jsxs("div",{style:{padding:"0 10px 10px 10px",borderTop:"1px solid rgba(255,255,255,0.04)"},children:[c&&Object.keys(c).length>0&&l.jsx("div",{style:{marginTop:8,padding:8,background:"#0e0e0e",borderRadius:4,fontSize:11,fontFamily:"monospace",color:"#9ecaff",whiteSpace:"pre-wrap",wordBreak:"break-all"},children:JSON.stringify(c,null,2)}),a?l.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:a}):o?l.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 B9({open:e,onClose:t,flowId:n}){var R;const[r,i]=m.useState([]),[s,o]=m.useState(!1),[a,c]=m.useState(null),[u,p]=m.useState(null),[d,f]=m.useState(!1),[h,g]=m.useState(!0),[b,k]=m.useState({ai:!0,flow:!0,step:!0,output:!0,error:!0}),[y,v]=m.useState(""),w=m.useRef(null),N=m.useCallback(async()=>{o(!0);try{const M=h&&n?`?flowId=${encodeURIComponent(n)}`:"",_=await(await fetch(`/api/composer-logs${M}`)).json();i(Array.isArray(_.sessions)?_.sessions:[])}catch{i([])}finally{o(!1)}},[n,h]),C=m.useCallback(async M=>{if(!M){p(null);return}f(!0);try{const _=await(await fetch(`/api/composer-logs/${encodeURIComponent(M)}`)).json();p(_)}catch{p(null)}finally{f(!1)}},[]);m.useEffect(()=>{e&&N()},[e,N]),m.useEffect(()=>{if(!(!e||!a))return C(a),w.current=setInterval(()=>C(a),2e3),()=>{w.current&&clearInterval(w.current),w.current=null}},[e,a,C]);const S=m.useMemo(()=>{const M=(u==null?void 0:u.events)||[],H=y.trim().toLowerCase();return M.filter(_=>{const A=Wk(_.tag,_.payload);return!b[A]&&A!=="other"?!1:H?[_.tag,JSON.stringify(_.payload||"")].join(" ").toLowerCase().includes(H):!0})},[u,b,y]),P=m.useMemo(()=>{const M=(u==null?void 0:u.events)||[],H={};for(const _ of M){const A=Wk(_.tag,_.payload);H[A]=(H[A]||0)+1}return H},[u]);return e?l.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:[l.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:[l.jsx("span",{style:{fontWeight:600,fontSize:14},children:"Composer Logs"}),l.jsx("span",{style:{fontSize:11,color:"#9a9a9a"},children:n?`flowId: ${n}`:"no flow selected"}),l.jsxs("label",{style:{fontSize:11,color:"#9a9a9a",display:"flex",alignItems:"center",gap:4,cursor:"pointer"},children:[l.jsx("input",{type:"checkbox",checked:h,onChange:M=>g(M.target.checked),disabled:!n}),"仅显示当前 flow"]}),l.jsx("button",{type:"button",onClick:N,style:{background:"rgba(124,77,255,0.15)",color:"#e8deff",border:"none",borderRadius:4,padding:"4px 10px",fontSize:12,cursor:"pointer"},children:"Refresh"}),l.jsx("span",{style:{flex:1}}),l.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"})]}),l.jsxs("div",{style:{flex:1,display:"flex",overflow:"hidden",minHeight:0},children:[l.jsxs("div",{style:{width:280,borderRight:"1px solid rgba(255,255,255,0.06)",overflowY:"auto",background:"#0e0e0e",flexShrink:0},children:[s&&l.jsx("div",{style:{padding:12,fontSize:12,color:"#9a9a9a"},children:"Loading…"}),!s&&r.length===0&&l.jsx("div",{style:{padding:12,fontSize:12,color:"#9a9a9a"},children:h&&n?"no sessions for this flow":"no sessions"}),r.map(M=>{const H=a===M.sessionId;return l.jsxs("div",{onClick:()=>c(M.sessionId),style:{padding:"10px 12px",borderBottom:"1px solid rgba(255,255,255,0.04)",cursor:"pointer",background:H?"rgba(124,77,255,0.18)":"transparent",borderLeft:H?"3px solid #7c4dff":"3px solid transparent"},children:[l.jsx("div",{style:{fontSize:12,fontWeight:600,color:"#e5e2e1"},children:F9(M.mtime)}),l.jsx("div",{style:{fontSize:11,color:"#9ecaff",marginTop:2,fontFamily:"monospace"},children:M.flowId||"(no flow)"}),M.promptPreview&&l.jsx("div",{style:{fontSize:11,color:"#9a9a9a",marginTop:4,overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:M.promptPreview}),l.jsxs("div",{style:{fontSize:10,color:"#6a6a6a",marginTop:4},children:[D9(M.size)," · ",M.model||"default"]})]},M.sessionId)})]}),l.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",minHeight:0},children:[l.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(i_).map(M=>l.jsxs("button",{type:"button",onClick:()=>k(H=>({...H,[M]:!H[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)),l.jsx("input",{type:"text",placeholder:"search…",value:y,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}})]}),l.jsxs("div",{style:{flex:1,overflowY:"auto",padding:12,minHeight:0},children:[!a&&l.jsx("div",{style:{color:"#9a9a9a",fontSize:12,padding:20,textAlign:"center"},children:"Select a session on the left to view events"}),d&&!u&&l.jsx("div",{style:{color:"#9a9a9a",fontSize:12,padding:20},children:"Loading…"}),u&&S.length===0&&l.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)"]}),S.map((M,H)=>l.jsx(z9,{event:M,defaultExpanded:M.tag==="error"},`${M.ts}_${H}`))]})]})]})]}):null}const H9="0.1.30";function Kk(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 _m(e,t){return t==="running"?Kk(e):e==null||!Number.isFinite(e)||e<=0?"--":Kk(e)}const s_=m.createContext({modelLists:{cursor:[],opencode:[]},onModelChange:()=>{}});function U9(e){const{setNodes:t}=So(),{modelLists:n,onModelChange:r}=m.useContext(s_),i=m.useCallback(o=>{t(a=>a.filter(c=>c.id!==o))},[t]),s=m.useCallback(()=>{var u,p,d,f,h,g,b,k;const o=((u=e.data)==null?void 0:u.definitionId)||"",a=((p=e.data)==null?void 0:p.label)||e.id,c=((h=(f=(d=e.data)==null?void 0:d.outputs)==null?void 0:f[0])==null?void 0:h.value)||((k=(b=(g=e.data)==null?void 0:g.outputs)==null?void 0:b[0])==null?void 0:k.default)||"";window.__provideEditContent={instanceId:e.id,label:a,definitionId:o,content:c},window.dispatchEvent(new CustomEvent("provide-expand"))},[e.id,e.data]);return l.jsx(QP,{...e,deleteNode:i,onProvideExpand:s,modelLists:n,onModelChange:r})}const V9={[$a]:U9},Od=["CONTROL","TOOL","PROVIDE","AGENT"],W9=1200,Yk="af-flow-node--sync-flash",qk="af-flow-edge--sync-flash";function Gk(e,t){const n=String(e||"").trim();return n?n.split(/\s+/).includes(t)?n:`${n} ${t}`:t}function Xk(e,t){const n=String(e||"").trim();return n?n.split(/\s+/).filter(r=>r&&r!==t).join(" "):""}function o_(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 Jk(e){const t=o_(e);return t==="CONTROL"?"control":t==="PROVIDE"?"provide":t==="TOOL"?"tool":"agent"}function Md(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 K9(e){return String((e==null?void 0:e.label)||"").trim()||String((e==null?void 0:e.id)||"").trim()}function Y9(e){return String((e==null?void 0:e.description)||(e==null?void 0:e.body)||"").replace(/\s+/g," ").trim()}function Qk(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 Zk(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 eS(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 q9(e){return e==="CONTROL"?"account_tree":e==="TOOL"?"build":e==="PROVIDE"?"database":"smart_toy"}function G9(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}const X9=/@([a-zA-Z_][a-zA-Z0-9_]*)/g;function J9(e){const t=new Set,n=[];let r;const i=new RegExp(X9.source,"g");for(;(r=i.exec(e))!==null;){const s=r[1];t.has(s)||(t.add(s),n.push(s))}return n}function tS(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 Pi(e){const t=String(e||"").indexOf(" - ");return t>=0?e.slice(0,t).trim():String(e||"").trim()}function Dd(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:[],a=Array.isArray(r)?r:[],c=s.map(Pi),u=o.map(Pi);return a.map(Pi).includes(i)&&!c.includes(i)&&!u.includes(i)?`claude-code:${i}`:u.includes(i)&&!c.includes(i)?`opencode:${i}`:i}function Q9(e){if(e==null)return"";const t=String(e).trim();return t?t.length<=26?t:`${t.slice(0,12)}…${t.slice(-10)}`:""}function Im(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 Z9({steps:e}){const{t}=bt();return!e||e.length===0?null:l.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 l.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:[l.jsx("span",{className:"af-composer-step-chip-idx",children:n.index+1}),l.jsx("span",{className:"af-composer-step-chip-main",children:n.nodeRole||i?l.jsxs("span",{className:"af-composer-step-chip-meta",children:[n.nodeRole?l.jsx("span",{className:"af-composer-step-chip-role",children:n.nodeRole}):null,i?l.jsx("span",{className:"af-composer-step-chip-model",children:Q9(i)}):null]}):null})]},n.index)})})}function eU(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 tU(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 nU(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 rU(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 nS({thread:e,liveSegments:t,running:n,className:r="",autoScroll:i=!0}){const{t:s}=bt(),o=m.useRef(null),a=["af-composer-ai-stack","af-composer-ai-stack--in-panel","af-composer-thread-stack",r].filter(Boolean).join(" ");return m.useEffect(()=>{if(!i||!o.current)return;const c=o.current;requestAnimationFrame(()=>{c.scrollTop=c.scrollHeight})},[e,t,i]),l.jsxs("div",{ref:o,className:a,children:[e.map((c,u)=>c.type==="user"?l.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--user-msg",children:[l.jsx("div",{className:"af-composer-ai-block-label",children:s("flow:composer.yourQuestion")}),l.jsx("div",{className:"af-composer-ai-block-body",children:c.text})]},`composer-u-${u}-${c.text.slice(0,48)}`):l.jsx("div",{className:"af-composer-thread-assistant",children:l.jsx(rS,{segments:c.segments,running:!1})},`composer-a-${u}`)),l.jsx("div",{className:"af-composer-thread-assistant",children:l.jsx(rS,{segments:t,running:n})})]})}function rS({segments:e,running:t=!1}){const{t:n}=bt(),r=e.filter(d=>d.kind==="assistant").map(d=>d.text).join(""),i=e.filter(d=>d.kind==="result").map(d=>d.text).join(""),s=eU(r,i),o=e.filter(d=>d.kind==="error").map(d=>d.text).join(`
|
|
127
|
-
`),a=e.filter(d=>d.kind!=="error"),c=s?a.filter(d=>d.kind!=="result"):a,u=tU(c),p=!!(u.length>0||o);return l.jsxs(l.Fragment,{children:[u.map((d,f)=>l.jsxs("section",{className:rU(d.kind),children:[l.jsx("div",{className:"af-composer-ai-block-label",children:nU(d.kind,n)}),l.jsx("div",{className:"af-composer-ai-block-body",children:d.text})]},`${d.kind}-${f}`)),t&&!p?l.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--reply af-composer-ai-block--pending",children:[l.jsx("div",{className:"af-composer-ai-block-label",children:n("flow:composer.reply")}),l.jsx("div",{className:"af-composer-ai-block-body",children:n("flow:composer.waiting")})]}):null,o?l.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--error",children:[l.jsx("div",{className:"af-composer-ai-block-label",children:n("flow:composer.error")}),l.jsx("div",{className:"af-composer-ai-block-body",children:o})]}):null]})}function iU({fitViewEpoch:e}){const{fitView:t}=So(),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 iS(e){const t=Number.isFinite(e)?e:1;return Math.min(Math.max(t,.75),1)}const df=1500,sS=500,sU=262144,oU=2e3;function Am(e){return typeof e!="string"?"":e.length<=oU?e:`[log line truncated, ${e.length} chars]`}const aU=df;function lU(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:Am(i)}}catch{return{ts:n,type:"info",text:Am(i)}}return{ts:n,type:"log",text:Am(`[${r}] ${i}`)}}function oS(e){if(!e)return[];const t=[],n=e.split(`
|
|
128
|
-
`);for(let r=n.length-1;r>=0&&t.length<aU;r--){const i=n[r];if(!i)continue;const s=lU(i);s&&t.push(s)}return t.reverse(),t}function cU(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 uU(e,t){if(e===t)return!0;if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function dU({fitViewEpoch:e,canvasTool:t,nodes:n,edges:r,onNodesChange:i,onEdgesChange:s,onConnect:o,onNodesDelete:a,onNodeClick:c,onEdgeClick:u,onFlowInit:p,onDrop:d,onDragOver:f,hideMinimapAndControls:h,bottomSlot:g}){const{t:b}=bt(),k=!i,y=k||t==="pan"?!0:[1,2],v=k?!1:t==="select",w="af-flow-canvas"+(k?" af-flow-canvas--run-mode":"")+(t==="pan"?" af-flow-canvas--tool-pan":" af-flow-canvas--tool-select"),N=m.useCallback(()=>{},[]),C=m.useMemo(()=>{const S=new Map(n.map(_=>[_.id,_])),P=new Set(n.filter(_=>_.selected).map(_=>_.id)),R=P.size>0,M=(_,A)=>{const U=/^#([0-9a-f]{6})$/i.exec(_);if(!U)return _;const L=parseInt(U[1],16);return`rgba(${L>>16&255}, ${L>>8&255}, ${L&255}, ${A})`},H="#ff5169";return r.map(_=>{var de,ie,me,ye;const A=S.get(_.source),U=S.get(_.target),L=/^output-(\d+)$/.exec(_.sourceHandle||""),B=/^input-(\d+)$/.exec(_.targetHandle||""),$=A&&L?(ie=(de=A.data)==null?void 0:de.outputs)==null?void 0:ie[parseInt(L[1],10)]:null,F=U&&B?(ye=(me=U.data)==null?void 0:me.inputs)==null?void 0:ye[parseInt(B[1],10)]:null,I=$!=null&&$.type?yi($.type):null,T=F!=null&&F.type?yi(F.type):null,E=I&&T&&I!==T,q=R&&(P.has(_.source)||P.has(_.target)),W=_.style||{};if(E){const ke=_.selected?.95:q?.85:.78,he=M(H,ke);return{..._,className:((_.className||"")+" af-flow-edge--type-mismatch"+(q?" af-flow-edge--adjacent":"")).trim(),style:{...W,stroke:he,strokeWidth:q?2.75:2.5,strokeDasharray:"6 4"},markerEnd:_.markerEnd&&typeof _.markerEnd=="object"?{..._.markerEnd,color:he}:{type:Fr.ArrowClosed,color:he}}}const O=I||T;if(!O)return q?{..._,className:((_.className||"")+" af-flow-edge--adjacent").trim(),style:{...W,strokeWidth:2.5}}:_;const X=q||_.selected?.7:.38,se=M(O,X),re=q?2.5:W.strokeWidth??2;return{..._,className:((_.className||"")+(q?" af-flow-edge--adjacent":"")).trim(),style:{...W,stroke:se,strokeWidth:re},markerEnd:_.markerEnd&&typeof _.markerEnd=="object"?{..._.markerEnd,color:se}:{type:Fr.ArrowClosed,color:se}}})},[n,r]);return l.jsxs(xE,{className:w,nodes:n,edges:C,onNodesChange:i||N,onEdgesChange:s||N,onConnect:k?void 0:o,onNodesDelete:k?void 0:a,onNodeClick:c,onEdgeClick:k?void 0:u,onInit:p,onDrop:k?void 0:d,onDragOver:k?void 0:f,nodeTypes:V9,selectionOnDrag:v,panOnDrag:y,nodesDraggable:!k,nodesConnectable:!k,elementsSelectable:!k,edgesFocusable:!k,panActivationKeyCode:"Space",proOptions:{hideAttribution:!0},fitView:!1,minZoom:.1,maxZoom:4,defaultEdgeOptions:{style:{stroke:"rgba(205, 189, 255, 0.45)",strokeWidth:2}},connectionLineStyle:{stroke:"rgba(205, 189, 255, 0.65)",strokeWidth:2},children:[l.jsx(kE,{gap:20,size:1,color:"rgba(28, 27, 27, 0.9)"}),l.jsx(Ma,{position:"bottom-center",className:"af-flow-bottom-unified-panel"+(h?" af-flow-bottom-unified-panel--solo":""),children:l.jsxs("div",{className:"af-flow-bottom-unified-row"+(h?" af-flow-bottom-unified-row--solo":""),children:[h?null:l.jsx("div",{className:"af-flow-bottom-unified__side af-flow-bottom-unified__side--minimap",children:l.jsx(B3,{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:S=>{var R;const P=(((R=S.data)==null?void 0:R.schemaType)??"agent").toLowerCase();return P==="control"?"rgba(237, 108, 2, 0.85)":P==="provide"?"rgba(0, 228, 117, 0.35)":P==="tool"?"rgba(124, 77, 255, 0.75)":"rgba(158, 202, 255, 0.5)"}})}),l.jsx("div",{className:"af-flow-bottom-unified__center",children:g}),h?null:l.jsx("div",{className:"af-flow-bottom-unified__side af-flow-bottom-unified__side--zoom",children:l.jsx(P3,{position:"bottom-right",showInteractive:!1,className:"af-flow-bottom-controls"})})]})}),!h&&l.jsx(Ma,{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:S,color:P})=>l.jsxs("span",{className:"af-pin-legend__item",children:[l.jsx("span",{className:"af-pin-legend__dot",style:{background:P}}),l.jsx("span",{className:"af-pin-legend__label",children:S})]},S))}),l.jsx(iU,{fitViewEpoch:e}),!k&&n.length===0?l.jsxs("div",{className:"af-flow-empty-hint",children:[l.jsx("span",{className:"af-flow-empty-hint-icon material-symbols-outlined",children:"account_tree"}),l.jsx("p",{className:"af-flow-empty-hint-text",children:b("flow:emptyCanvas.composerHint")}),l.jsx("p",{className:"af-flow-empty-hint-sub",dangerouslySetInnerHTML:{__html:b("flow:emptyCanvas.composerSub")}})]}):null]})}function aS(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 fU(e){return e==="builtin"?"workspace":e??"user"}function Bo(e,t){return t(e==="builtin"?"flow:settings.builtin":e==="workspace"?"flow:palette.workspace":"flow:palette.userDir")}const a_="af:run-console-height",pc=230,Fl={enabled:!1,cron:"",timezone:"Asia/Shanghai",preset:"",overlapPolicy:"skip",misfirePolicy:"skip",nextRunAt:null},$d={};function ff(e){if(!Number.isFinite(e))return pc;const t=Math.max(240,Math.floor(window.innerHeight*.88));return Math.min(Math.max(Math.round(e),96),t)}function pU(){try{const e=localStorage.getItem(a_);if(e==null)return pc;const t=parseInt(e,10);return Number.isFinite(t)?ff(t):pc}catch{return pc}}function hU(){var rv,iv;const{t:e}=bt(),{navigate:t,path:n}=ko(),[r,i]=m.useState([]),[s,o]=m.useState(""),[a,c]=m.useState(null),[u,p]=m.useState(0),[d,f]=m.useState(""),[h,g]=m.useState(""),[b,k]=m.useState(""),[y,v]=m.useState(""),[w,N]=m.useState(!1),[C,S]=m.useState(""),[P,R]=m.useState(!1),[M,H]=m.useState(""),[_,A]=m.useState(!1),[U,L]=m.useState(!1),[B,$]=m.useState(!1),[F,I]=m.useState(null),[T,E]=m.useState(!1),[q,W]=m.useState(!1),O=m.useRef(!1),[X,se]=m.useState([]),[re,de]=m.useState(""),[ie,me]=m.useState([]),[ye,ke]=m.useState(!1),[he,Se]=m.useState(""),[Ve,We]=m.useState(""),[He,ut]=m.useState(null),[Ge,De]=m.useState(null),[kt,Ut]=m.useState([]),[Ct,sn]=m.useState(""),[pn,on]=m.useState(!1),[Z,oe]=m.useState(!1),[je,$e]=m.useState({files:[]}),[xe,Qe]=m.useState(!1),[Et,we]=m.useState(!0);m.useEffect(()=>{let x=!1;const j=()=>{fetch("/api/flows",{method:"HEAD"}).then(z=>{x||we(z.ok)}).catch(()=>{x||we(!1)})};j();const D=window.setInterval(j,5e3);return()=>{x=!0,window.clearInterval(D)}},[]),m.useEffect(()=>{let x=!1;return fetch("/api/dev-info").then(j=>j.json()).then(j=>{x||K(!!(j!=null&&j.isDev))}).catch(()=>{}),()=>{x=!0}},[]),m.useEffect(()=>{a!=null&&a.id&&Pj(a.id,a.source??"user","pipeline",!!a.archived)},[a==null?void 0:a.id,a==null?void 0:a.source,a==null?void 0:a.archived]);const[pe,it]=m.useState("edit"),[Pt,Oe]=m.useState([]),ft=m.useRef(0),[hn,mn]=m.useState(new Set),[Vr,gn]=m.useState({}),[lr,Ln]=m.useState(null),[Wr,En]=m.useState(0),[Gn,G]=m.useState(!1),[_e,K]=m.useState(!1),[Q,te]=m.useState(!1),[Pe,Ee]=m.useState(pU),Ae=m.useRef({active:!1,pointerId:-1,startY:0,startH:pc}),[Me,mt]=m.useState(null),[gt,Tt]=m.useState(null),[Kr,Wi]=m.useState({}),Ki=m.useRef(Kr);m.useEffect(()=>{Ki.current=Kr},[Kr]);const[Qa,Yi]=m.useState(!1),[Qp,jo]=m.useState(!1),[wu,vu]=m.useState({}),[vi,Co]=m.useState({}),[Eo,Za]=m.useState(null),[Gt,Ls]=m.useState(Fl),[bu,ku]=m.useState(!1),[br,el]=m.useState(!1),[Po,Os]=m.useState(""),[_o,Io]=m.useState(""),[ct,tl]=m.useState($d),[Rt,nl]=m.useState(null),bi=m.useRef(0),Yr=m.useRef(null),Ms=m.useRef(null),rl=m.useRef(!0),Ds=m.useRef(!1),[Vt,Ao]=m.useState(null),[$s,Fs]=m.useState(null),[Nw,il]=m.useState(!1),[Su,Nu]=m.useState(""),[Zp,ju]=m.useState(!1),q_=m.useRef(null),[ki,eh]=m.useState(null),[jw,sl]=m.useState(!1),[th,Cw]=m.useState(null),[Cu,Ew]=m.useState(!1),[To,Eu]=m.useState(null),nh=m.useRef(null),[cr,ol]=m.useState(""),[Pu,al]=m.useState(0),[ll,cl]=m.useState(0),[G_,rh]=m.useState("pan"),[_u,ul]=m.useState(!1),[ih,Pw]=m.useState(!1),sh=m.useRef(null),oh=m.useRef(null),dl=m.useRef(null),[X_,J_]=m.useState(0),[Xe,ah]=m.useState(null),[Q_,Iu]=m.useState(""),[Ue,Z_]=m.useState({cursor:[],opencode:[],claudeCode:[]}),[zs,_w]=m.useState(""),[lh,YQ]=m.useState(""),[ch,eI]=m.useState([]),[fl,Iw]=m.useState([]),[Au,uh]=m.useState(!1),dh=m.useRef(null),Aw=m.useRef(null),[tI,nI]=m.useState({}),Tu=m.useCallback(x=>{if(!x)return null;const j=x.id,D=x.source??"user",z=x.archived?"archived":"";return{sessionsKey:`af:composer-sessions:${j}:${D}${z?":"+z:""}`,activeKey:`af:composer-active-session:${j}:${D}${z?":"+z:""}`}},[]),Tw=m.useCallback(x=>{const j=Tu(x);if(!j)return{sessions:[],activeSessionId:null};try{const D=localStorage.getItem(j.sessionsKey);if(!D)return{sessions:[],activeSessionId:null};const z=JSON.parse(D);if(!Array.isArray(z))return{sessions:[],activeSessionId:null};const V=z.filter(J=>J&&typeof J.id=="string").map(J=>({...J,running:!1,statusLine:J.running?e("flow:composer.pageRefreshReset"):J.statusLine,steps:[]}));let Y=null;try{Y=localStorage.getItem(j.activeKey),Y&&!V.some(J=>J.id===Y)&&(Y=null)}catch{Y=null}return{sessions:V,activeSessionId:Y}}catch{return{sessions:[],activeSessionId:null}}},[Tu]),Ru=m.useCallback((x,j,D)=>{const z=Tu(x);if(z)try{localStorage.setItem(z.sessionsKey,JSON.stringify(j)),D?localStorage.setItem(z.activeKey,D):localStorage.removeItem(z.activeKey)}catch{}},[Tu]),Bs=m.useRef(0),Lu=m.useRef({sessions:[],activeSessionId:null,flowKey:null}),[kr,qr]=m.useState([]),[yn,qi]=m.useState(null),Ou=m.useMemo(()=>{if(!a)return null;const x=a.id,j=a.source??"user",D=a.archived?"archived":"";return`${x}:${j}${D?":"+D:""}`},[a]),fh=m.useRef(!1);m.useEffect(()=>{if(!Ou){qr([]),qi(null),Lu.current={sessions:[],activeSessionId:null,flowKey:null};return}const x=Lu.current;if(x.flowKey===Ou)return;x.flowKey=Ou,fh.current&&x.sessions.length>0&&Ru(a,x.sessions,x.activeSessionId);const{sessions:j,activeSessionId:D}=Tw(a);if(j.length===0){const z=`session-1-${Date.now()}`,V={id:z,label:e("flow:composer.conversationLabel",{n:1}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null};x.sessions=[V],x.activeSessionId=z,qr([V]),qi(z)}else{const z=j[j.length-1];if(z&&(!z.thread||z.thread.length===0))Bs.current=Im(j),x.sessions=j,x.activeSessionId=z.id,qr(j),qi(z.id);else{const Y=Im(j)+1;Bs.current=Y;const J=`session-${Y}-${Date.now()}`,ne={id:J,label:e("flow:composer.conversationLabel",{n:Y}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null},ue=[...j,ne];x.sessions=ue,x.activeSessionId=J,qr(ue),qi(J)}}fh.current=!0},[Ou,a,Tw,Ru]);const zt=m.useMemo(()=>kr.find(x=>x.id===yn)||null,[kr,yn]),Dt=(zt==null?void 0:zt.running)??!1,pl=(zt==null?void 0:zt.statusLine)??"",hl=(zt==null?void 0:zt.segments)??[],ml=(zt==null?void 0:zt.thread)??[],Rw=(zt==null?void 0:zt.steps)??[];zt==null||zt.outputDismissed;const Ke=(zt==null?void 0:zt.phaseContext)??null,Lw=m.useRef([]),[ph,Mu]=m.useState(!1),Du=m.useRef(null),Ow=m.useRef(null);m.useEffect(()=>{const x=Ow.current;x&&requestAnimationFrame(()=>{x.scrollTop=x.scrollHeight})},[ml,hl]);const hh=m.useRef(null),mh=m.useRef(!1),rI=m.useRef(null),Mw=m.useCallback(x=>{const j=++Bs.current,D=`session-${j}-${Date.now()}`,z={id:D,label:x||e("flow:composer.conversationLabel",{n:j}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null};return qr(V=>[...V,z]),qi(D),D},[]);m.useEffect(()=>{!a||!fh.current||(Lu.current.sessions=kr,Lu.current.activeSessionId=yn,Ru(a,kr,yn))},[kr,yn,a,Ru]),m.useEffect(()=>{Bs.current=Math.max(Bs.current,Im(kr))},[kr]);const Dw=m.useCallback(x=>{var j;hh.current===x&&((j=Du.current)==null||j.abort()),qr(D=>{const z=D.filter(Y=>Y.id!==x);if(D.some((Y,J)=>Y.id===x&&D.findIndex(ne=>ne.id===yn)===J)||yn===x){const Y=z;Y.length>0?qi(Y[Y.length-1].id):setTimeout(()=>{Bs.current=0;const J=++Bs.current,ne=`session-${J}-${Date.now()}`,ue={id:ne,label:e("flow:composer.conversationLabel",{n:J}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null};qr(le=>[...le,ue]),qi(ne)},0)}return z})},[yn]),On=m.useCallback(x=>{qr(j=>{const D=j.findIndex(Y=>Y.id===yn);if(D<0)return j;const z={...j[D]};x(z);const V=[...j];return V[D]=z,V})},[yn]),$w=m.useCallback(x=>{On(j=>{j.running=x})},[On]),Gr=m.useCallback(x=>{On(j=>{j.statusLine=x})},[On]),Xr=m.useCallback(x=>{On(j=>{typeof x=="function"?j.segments=x(j.segments):j.segments=x})},[On]),Fw=m.useCallback(x=>{On(j=>{typeof x=="function"?j.thread=x(j.thread):j.thread=x})},[On]),gl=m.useCallback(x=>{On(j=>{typeof x=="function"?j.steps=x(j.steps):j.steps=x})},[On]),zw=m.useCallback(x=>{On(j=>{j.outputDismissed=x})},[On]),yl=m.useCallback(x=>{On(j=>{j.phaseContext=typeof x=="function"?x(j.phaseContext):x})},[On]),Bw=m.useCallback(x=>{qi(x),qr(j=>{const D=j.findIndex(V=>V.id===x);if(D<0||!j[D].outputDismissed)return j;const z=[...j];return z[D]={...j[D],outputDismissed:!1},z})},[]);m.useEffect(()=>{Lw.current=hl},[hl]);const Si=m.useRef({}),Hw=m.useRef(!1),xl=m.useRef(null),Gi=m.useRef(null),wl=m.useRef(!1),gh=m.useRef(0),$u=m.useRef(""),[tt,st,iI]=wE([]),[Bt,Zt,sI]=vE([]),Fu=m.useRef(tt),zu=m.useRef(Bt),Sr=m.useMemo(()=>tt.filter(x=>{var j;return(((j=x.data)==null?void 0:j.definitionId)||"").startsWith("provide_")}),[tt]),Ro=m.useMemo(()=>{var j;const x={};for(const D of tt){if(!((j=D.data)!=null&&j.inputs))continue;const z=D.data.inputs;for(let V=0;V<z.length;V++){const Y=z[V];if(!(Y!=null&&Y.name))continue;const J=Bt.find(ue=>ue.target===D.id&&ue.targetHandle===`input-${V}`);if(!(J!=null&&J.source))continue;Sr.find(ue=>ue.id===J.source)&&(x[J.source]=Y.name)}}return x},[tt,Bt,Sr]),vl=m.useMemo(()=>{if(pe==="edit"||hn.size===0)return null;const x=new Set(hn);for(const j of Bt)hn.has(j.source)&&x.add(j.target),hn.has(j.target)&&x.add(j.source);return x},[pe,hn,Bt]),oI=m.useMemo(()=>pe==="edit"?tt:tt.map(x=>{var j,D;return{...x,draggable:!1,connectable:!1,data:{...x.data,isRunMode:!0,isExecuting:hn.has(x.id),nodeStatus:((j=Vr[x.id])==null?void 0:j.status)??null,nodeElapsed:((D=Vr[x.id])==null?void 0:D.elapsed)??null,isDim:vl?!vl.has(x.id):!1}}}),[pe,tt,hn,Vr,vl]),aI=m.useMemo(()=>vl?Bt.map(x=>{const j=hn.has(x.source)||hn.has(x.target),D=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:(D?D+" ":"")+z}}):Bt,[Bt,hn,vl]);m.useEffect(()=>{if(!a){Co({}),Za(null),Ls(Fl),tl($d),nl(null),Os(""),Io("");return}const x=new URLSearchParams({flowId:a.id,flowSource:a.source||"user"});a.archived&&x.set("archived","1"),fetch(`/api/flow/run-config?${x.toString()}`).then(j=>j.json()).then(j=>{Co(j.presets||{}),Za(j.activePreset||null)}).catch(()=>{Co({}),Za(null)})},[a==null?void 0:a.id,a==null?void 0:a.source,a==null?void 0:a.archived]);const Xi=m.useCallback(x=>{bi.current+=1,Ls(x)},[]),Ji=m.useCallback(async(x,j={})=>{if(!x)return;const D=!!j.quiet,z=!!j.force,V=bi.current;D||(ku(!0),Os(""),Io(""));const Y=new URLSearchParams({flowId:x.id,flowSource:x.source||"user"});x.archived&&Y.set("archived","1");try{const J=await fetch(`/api/flow/schedule?${Y.toString()}`),ne=await J.json().catch(()=>({}));if(!J.ok)throw new Error(ne.error||`HTTP ${J.status}`);if(!z&&bi.current!==V)return;Ls({...Fl,...ne.schedule||{}}),tl(ne.state&&typeof ne.state=="object"?ne.state:$d),nl(ne.status||null)}catch(J){if(!z&&bi.current!==V)return;Ls(Fl),tl($d),nl(null),Os(String(J.message||J))}finally{ku(!1)}},[]);m.useEffect(()=>{if(!a)return;let x=!1;return(async()=>{await Ji(a)})(),()=>{x=!0}},[a==null?void 0:a.id,a==null?void 0:a.source,a==null?void 0:a.archived,Ji]),m.useEffect(()=>{var D,z,V,Y;if(!Eo||!vi[Eo]||Sr.length===0)return;const x=vi[Eo],j={};for(const J of Sr){const ne=Ro[J.id];if(!ne)continue;const ue=((D=J.data)==null?void 0:D.definitionId)||"",le=x[J.id]??((Y=(V=(z=J.data)==null?void 0:z.outputs)==null?void 0:V[0])==null?void 0:Y.default)??"";ue.startsWith("provide_file")?j[ne]={type:"file",path:le}:j[ne]={type:"str",value:le}}Object.keys(j).length>0&&Wi(j)},[Eo,vi,Sr,Ro]);const lI=m.useCallback(()=>{if(!To||!nh.current)return;const x=nh.current.value;st(j=>j.map(D=>{var z,V;return D.id!==To.instanceId?D:{...D,data:{...D.data,outputs:((V=(z=D.data)==null?void 0:z.outputs)==null?void 0:V.map((Y,J)=>J===0?{...Y,default:x}:Y))||[{type:"text",name:"value",default:x}]}}})),Eu(null)},[To,st]),Be=m.useMemo(()=>{const x=tt.filter(j=>j.selected);return x.length===1?x[0]:null},[tt]),Jr=m.useMemo(()=>a?i9(tt,Bt,e):[],[a,tt,Bt,e]),cI=m.useMemo(()=>Jr.map(x=>x.key).join("|"),[Jr]),Uw=m.useMemo(()=>Jr.some(x=>String((x==null?void 0:x.level)||"warning").toLowerCase()==="error"),[Jr]);m.useLayoutEffect(()=>{E(Jr.length>0&&!Uw)},[cI,a==null?void 0:a.id,a==null?void 0:a.source,Jr.length,Uw]),dl.current=Be,m.useEffect(()=>{Fu.current=tt},[tt]),m.useEffect(()=>{zu.current=Bt},[Bt]),m.useEffect(()=>()=>{Gi.current!=null&&(clearTimeout(Gi.current),Gi.current=null)},[]);const yh=m.useMemo(()=>{var j;if(!Be)return null;const x=(j=Be.data)==null?void 0:j.definitionId;return X.find(D=>D.id===x)??null},[Be,X]),xh=m.useMemo(()=>{const x={CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const j of X){const D=o_(j);x[D].push(j)}for(const j of Od)x[j].sort((D,z)=>D.id.localeCompare(z.id));return x},[X]),Bu=m.useMemo(()=>{const x=re.trim().toLowerCase();if(!x)return xh;const j={CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const D of Od)j[D]=xh[D].filter(z=>G9(z,x));return j},[xh,re]),uI=m.useMemo(()=>Od.reduce((x,j)=>x+Bu[j].length,0),[Bu]),Hu=m.useMemo(()=>X.filter(x=>{const j=String(x.id??""),D=String(x.source??"");return j.startsWith("marketplace:")||D==="marketplace"||D==="collection"}),[X]),Vw=m.useMemo(()=>{const x=new Set;for(const j of Hu){const D=String(j.id??"");if(D&&(x.add(D),D.startsWith("marketplace:"))){const z=D.slice(12),[V]=z.split("@");V&&x.add(`marketplace:${V}`)}}return x},[Hu]),Uu=m.useCallback(async()=>{o("");try{const x=await fetch("/api/flows");if(!x.ok)throw new Error("HTTP "+x.status);i(await x.json())}catch(x){o(String(x.message||x))}},[]);m.useEffect(()=>{Uu()},[Uu]),m.useEffect(()=>{if(n!=="/flow")return;const x=new URLSearchParams(window.location.search);x.get("new")==="1"&&!x.get("flowId")&&t("/projects?new=1")},[n,t]),m.useEffect(()=>{let x=!1;const j=()=>{fetch("/api/model-lists").then(z=>z.json()).then(z=>{x||Z_({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 D=setTimeout(j,4e3);return()=>{x=!0,clearTimeout(D)}},[]),m.useEffect(()=>{let x=!1;return fetch("/api/skills").then(j=>j.json()).then(j=>{if(x)return;const D=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):""})):[];eI(D),Iw(z=>{const V=new Set(D.map(J=>J.key)),Y=z.filter(J=>V.has(J));return Y.length>0?Y:D.map(J=>J.key)})}).catch(()=>{}),()=>{x=!0}},[]);const Ww=m.useCallback(async x=>{const j=x.source??"user",D=!!x.archived,z=new URLSearchParams({flowId:x.id,flowSource:j});D&&z.set("archived","1");const V=new URLSearchParams({flowId:x.id,flowSource:j});D&&V.set("archived","1");const[Y,J]=await Promise.all([fetch("/api/flow?"+z.toString()),fetch("/api/nodes?"+V.toString())]),ne=await Y.json();if(!Y.ok||ne.error)throw new Error(ne.error||e("flow:nodePropsError.loadFlowFailed"));const ue=await J.json();if(!J.ok)throw new Error(e("flow:nodePropsError.loadNodesFailed"));const le=Array.isArray(ue)?ue:Array.isArray(ue==null?void 0:ue.nodes)?ue.nodes:[],Ce=!Array.isArray(ue)&&(ue==null?void 0:ue.pipelineTranslations)||{},ee=n9(ne.flowYaml||"");if(ee.error)throw new Error(ee.error);const ge={...ee.instances||{}},fe=ee.nodes.map(ot=>fc(ot,ge,le,Ce,x.id)),Te=JP(ee.edges,fe);return{flowSource:j,paletteList:le,instances:ge,flowDescriptionText:ee.description??"",nodes:fe,edges:Te}},[]),ur=m.useCallback(async(x,j={})=>{const D=!!j.preserveComposer,z=D&&!!j.incrementalSync;wl.current=!1,gh.current+=1,c(x),g(""),D||(k(""),de(""),De(null),f(""),S(""),H(""),ol(""),Fw([]),Xr([]),gl([]),zw(!1),yl(null),rh("pan")),z||(Si.current={},st([]),Zt([])),aS(x);try{const V=await Ww(x);if(se(V.paletteList),Si.current=V.instances,f(V.flowDescriptionText),S(x.id||""),z){const Y=Fu.current,J=zu.current;try{const ne=RH(Y,J,V.nodes,V.edges),ue=new Set([...ne.changes.addedNodeIds,...ne.changes.updatedNodeIds]),le=new Set([...ne.changes.addedEdgeKeys,...ne.changes.updatedEdgeKeys]),Ce=ue.size>0?ne.nodes.map(ge=>ue.has(ge.id)?{...ge,className:Gk(ge.className,Yk)}:ge):ne.nodes,ee=le.size>0?ne.edges.map(ge=>le.has(Uc(ge))?{...ge,className:Gk(ge.className,qk)}:ge):ne.edges;st(Ce),Zt(ee),Gi.current!=null&&(clearTimeout(Gi.current),Gi.current=null),(ue.size>0||le.size>0)&&(Gi.current=window.setTimeout(()=>{Gi.current=null,ue.size>0&&st(ge=>ge.map(fe=>{if(!ue.has(fe.id))return fe;const Te=Xk(fe.className,Yk);return Te===String(fe.className||"")?fe:{...fe,className:Te}})),le.size>0&&Zt(ge=>ge.map(fe=>{if(!le.has(Uc(fe)))return fe;const Te=Xk(fe.className,qk);return Te===String(fe.className||"")?fe:{...fe,className:Te}}))},W9))}catch{st(V.nodes),Zt(V.edges)}}else st(V.nodes),Zt(V.edges),p(Y=>Y+1);gd(x.id,V.flowSource),J_(Y=>Y+1);try{$u.current=Rk(V.nodes,V.edges,V.instances,{description:V.flowDescriptionText})}catch{$u.current=""}wl.current=!0}catch(V){g(String(V.message||V))}},[Ww,st,Zt]),Vu=m.useCallback(async()=>{if(!(a!=null&&a.id))return;const x=a.source??"user",j=new URLSearchParams({flowId:a.id,flowSource:x});a.archived&&j.set("archived","1");const D=await fetch("/api/nodes?"+j.toString()),z=await D.json();if(!D.ok)throw new Error((z==null?void 0:z.error)||e("flow:nodePropsError.loadNodesFailed"));const V=Array.isArray(z)?z:Array.isArray(z==null?void 0:z.nodes)?z.nodes:[];se(V)},[a,e]),wh=m.useCallback(async()=>{ke(!0),Se("");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");me(Array.isArray(j==null?void 0:j.nodes)?j.nodes:[])}catch(x){Se(String(x.message||x)),me([])}finally{ke(!1)}},[]);m.useEffect(()=>{a&&wh()},[a==null?void 0:a.id,a==null?void 0:a.source,a==null?void 0:a.archived,wh]);const dI=m.useCallback(async x=>{if(!a||!x)return;const j=x.definitionId||`marketplace:${x.id}${x.version?`@${x.version}`:""}`;if(j){We(j),Se("");try{const D=await fetch("/api/marketplace/install-node",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:a.id,flowSource:a.source||"user",archived:!!a.archived,nodeSpec:j})}),z=await D.json().catch(()=>({}));if(!D.ok||(z==null?void 0:z.ok)===!1)throw new Error((z==null?void 0:z.error)||"Failed to install marketplace node");await Vu()}catch(D){Se(String(D.message||D))}finally{We("")}}},[a,Vu]),fI=m.useCallback(async(x,j)=>{const D={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:a==null?void 0:a.id,flowSource:(a==null?void 0:a.source)||"user"},z=await fetch("/api/marketplace/publish-node-from-instance",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(D)}),V=await z.json();if(!z.ok||(V==null?void 0:V.ok)===!1)throw new Error((V==null?void 0:V.error)||"Publish failed");return await Vu(),V},[Vu,a]),Kw=m.useCallback(async()=>{var z;if(!a||O.current)return;const x=a.id,j=a.source??"user",D=((z=dl.current)==null?void 0:z.id)??null;O.current=!0,W(!0);try{await ur({id:x,source:j,archived:a.archived},{preserveComposer:!0,incrementalSync:!0}),D&&st(V=>V.map(Y=>({...Y,selected:Y.id===D})))}finally{O.current=!1,W(!1)}},[a,a==null?void 0:a.archived,ur,st]);m.useEffect(()=>{if(Hw.current||r.length===0)return;const x=new URLSearchParams(window.location.search),j=x.get("flowId");if(!j)return;const D=x.get("flowSource")??"user",z=x.get("flowArchived")==="1",V=r.find(Y=>Y.id===j&&(Y.source??"user")===D&&!!Y.archived===z);V&&(Hw.current=!0,ur(V))},[r,ur]);const Wu=m.useRef(0);m.useEffect(()=>{if(!a)return;const x=a.id,j=a.source??"user",D=!!a.archived;Wu.current=0;let z=!1;const V=async()=>{var ne;if(z)return;const J=new URLSearchParams({flowId:x,flowSource:j,v:String(Wu.current)});D&&J.set("archived","1");try{const ue=await fetch("/api/flow-editor-sync-poll?"+J.toString());if(!ue.ok||z)return;const le=await ue.json();if(z)return;if(le.changed){Wu.current=le.version;const Ce=((ne=dl.current)==null?void 0:ne.id)??null;await ur({id:x,source:j,archived:D},{preserveComposer:!0,incrementalSync:!0}),await Ji({id:x,source:j,archived:D},{quiet:!0,force:!0}),Ce&&st(ee=>ee.map(ge=>({...ge,selected:ge.id===Ce})))}else Wu.current=le.version}catch{}},Y=window.setInterval(V,2e3);return V(),()=>{z=!0,window.clearInterval(Y)}},[a==null?void 0:a.id,a==null?void 0:a.source,a==null?void 0:a.archived,ur,Ji,st]);const pI=m.useMemo(()=>b?b.startsWith(e("flow:status.saveFailed"))?" af-palette-tip--error":b===e("flow:status.saved")?" af-palette-tip--success":" af-palette-tip--info":"",[b]);m.useEffect(()=>{if(!b)return;b===e("flow:status.saved")||b.startsWith(e("flow:status.runInTerminal"));const x=b.startsWith(e("flow:status.runInTerminal"))?5200:2800,j=window.setTimeout(()=>k(""),x);return()=>clearTimeout(j)},[b,e]),m.useEffect(()=>{v("")},[a==null?void 0:a.id,a==null?void 0:a.source]),m.useEffect(()=>{const x=()=>{window.__provideEditContent&&(Eu(window.__provideEditContent),window.__provideEditContent=null)};return window.addEventListener("provide-expand",x),()=>window.removeEventListener("provide-expand",x)},[]),m.useEffect(()=>{var ne,ue,le,Ce,ee,ge;if(!Be){ah(null);return}const x=Si.current[Be.id]||{},{inputs:j,outputs:D}=s9(Be),z=String(((ne=Be.data)==null?void 0:ne.definitionId)??Be.id??""),V=((ue=Be.data)==null?void 0:ue.script)!=null?String(Be.data.script):void 0,Y=x.script!=null?String(x.script):void 0,J=z==="tool_nodejs"||V&&V.trim()!==""||Y&&Y.trim()!==""?String(V??Y??""):"";ah({id:Be.id,newId:Be.id,label:String(((le=Be.data)==null?void 0:le.label)??Be.id),role:((Ce=Be.data)==null?void 0:Ce.role)??"普通",model:String(((ee=Be.data)==null?void 0:ee.model)??x.model??""),body:String(((ge=Be.data)==null?void 0:ge.body)??x.body??""),script:J,inputs:j,outputs:D})},[Be==null?void 0:Be.id,X_]),m.useEffect(()=>{a&&(Be||(oh.current=null,De(x=>x==="node"?null:x)))},[a,Be==null?void 0:Be.id]);const Ku=m.useCallback(()=>{oh.current=null,De(x=>x==="settings"||x==="history"?x:"node")},[]),hI=m.useCallback((x,j)=>{if(!(x.metaKey||x.ctrlKey||x.shiftKey)){if(pe!=="edit"){Tt((j==null?void 0:j.id)??null);return}Ku()}},[Ku,pe]),mI=m.useCallback((x,j)=>{if(pe!=="edit")return;const D=x.metaKey||x.ctrlKey||x.shiftKey;Zt(z=>z.map(V=>V.id===j.id?{...V,selected:!V.selected||!D}:D?V:{...V,selected:!1})),D||st(z=>z.map(V=>({...V,selected:!1})))},[pe,Zt,st]),gI=m.useCallback(x=>Zt(j=>{const D=j.filter(z=>!(z.target===x.target&&z.targetHandle===x.targetHandle));return Ox({...x,markerEnd:{type:Fr.ArrowClosed}},D)}),[Zt]),yI=m.useCallback(x=>{for(const j of x)delete Si.current[j.id]},[]),xI=m.useCallback(x=>{xl.current=x},[]),wI=m.useCallback(x=>{st(D=>D.map(z=>({...z,selected:z.id===x}))),Zt(D=>D.map(z=>({...z,selected:!1}))),Ku();const j=()=>{var ue,le,Ce;const D=xl.current;if(!(D!=null&&D.getNode))return;const z=D.getNode(x);if(!z)return;const V=(ue=D.getInternalNode)==null?void 0:ue.call(D,x),Y=((le=V==null?void 0:V.measured)==null?void 0:le.width)??(V==null?void 0:V.width)??z.width??200,J=((Ce=V==null?void 0:V.measured)==null?void 0:Ce.height)??(V==null?void 0:V.height)??z.height??88,{zoom:ne}=D.getViewport();D.setCenter(z.position.x+Y/2,z.position.y+J/2,{zoom:iS(ne),duration:220})};requestAnimationFrame(()=>requestAnimationFrame(j))},[st,Zt,Ku]),vI=m.useCallback(x=>{st(D=>D.map(z=>({...z,selected:z.id===x}))),Zt(D=>D.map(z=>({...z,selected:!1})));const j=()=>{var le,Ce,ee;const D=xl.current;if(!(D!=null&&D.getNode))return;const z=D.getNode(x);if(!z)return;const V=(le=D.getInternalNode)==null?void 0:le.call(D,x),Y=((Ce=V==null?void 0:V.measured)==null?void 0:Ce.width)??(V==null?void 0:V.width)??z.width??200,J=((ee=V==null?void 0:V.measured)==null?void 0:ee.height)??(V==null?void 0:V.height)??z.height??88,{zoom:ne}=D.getViewport(),ue=iS(ne);D.setCenter(z.position.x+Y/2,z.position.y+J/2,{zoom:ue,duration:260})};requestAnimationFrame(()=>requestAnimationFrame(j))},[st,Zt]),Yw=m.useCallback(x=>{if(!a||!x)return;let j={x:180,y:160};const D=xl.current,z=document.querySelector(".af-pipeline-flow .react-flow");if(D&&z){const ue=z.getBoundingClientRect();j=D.screenToFlowPosition({x:ue.left+ue.width*.45,y:ue.top+ue.height*.38})}const V=`node-${Date.now()}`,Y=Jk(x),J={id:V,type:$a,position:j,data:{label:x.label??x.id,definitionId:x.id,schemaType:Y,inputs:Array.isArray(x.inputs)?x.inputs.map(ue=>({...ue})):[],outputs:Array.isArray(x.outputs)?x.outputs.map(ue=>({...ue})):[]}},ne=fc(J,Si.current,X);st(ue=>[...ue,ne])},[a,X,st]),bI=m.useCallback(x=>{x.preventDefault(),x.dataTransfer.dropEffect="move"},[]),kI=m.useCallback(x=>{if(x.preventDefault(),!a)return;const j=x.dataTransfer.getData("application/agentflow-node");if(!j)return;const D=X.find(le=>le.id===j);if(!D)return;const z=xl.current;if(!z)return;const V=z.screenToFlowPosition({x:x.clientX,y:x.clientY}),Y=`node-${Date.now()}`,J=Jk(D),ne={id:Y,type:$a,position:V,data:{label:D.label??D.id,definitionId:D.id,schemaType:J,inputs:Array.isArray(D.inputs)?D.inputs.map(le=>({...le})):[],outputs:Array.isArray(D.outputs)?D.outputs.map(le=>({...le})):[]}},ue=fc(ne,Si.current,X);st(le=>[...le,ue])},[a,X,st]),Qr=m.useCallback(async(x,j)=>{if(!a)return;const D=Rk(x,j,Si.current,{description:d});if(D!==$u.current){k(e("flow:status.saving"));try{const z=fU(a.source),V=await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:a.id,flowSource:z,flowYaml:D,...a.archived?{flowArchived:!0}:{}})}),Y=await V.json();if(!V.ok||!Y.success)throw new Error(Y.error||e("flow:status.saveFailed"));if($u.current=D,k(e("flow:status.saved")),a.source==="builtin"&&z==="workspace"){const J={id:a.id,source:"workspace",path:void 0};c(J),aS(J),gd(a.id,"workspace")}}catch(z){k(e("flow:status.saveFailed")+": "+(z.message||z))}}},[a,d]);m.useEffect(()=>{if(!a||!wl.current||pe!=="edit"||a.archived)return;const x=gh.current,j=setTimeout(()=>{x===gh.current&&wl.current&&Qr(Fu.current,zu.current)},400);return()=>clearTimeout(j)},[tt,Bt,d,pe,a,Qr]);const Yu=m.useCallback(async x=>{if(!a||a.archived)return;const j=a.source??"user";if(!(j!=="user"&&j!=="workspace")&&j!==x){N(!0),v("");try{const D=await fetch("/api/flow/move",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:a.id,fromSource:j,toSource:x})}),z=await D.json().catch(()=>({}));if(!D.ok)throw new Error(typeof z.error=="string"?z.error:e("flow:composer.requestFailed"));const V=z.flowSource==="workspace"||z.flowSource==="user"?z.flowSource:x;let Y={id:a.id,source:V,archived:a.archived};try{const J=await fetch("/api/flows");if(J.ok){const ne=await J.json(),ue=Array.isArray(ne)?ne.find(le=>le.id===a.id&&(le.source??"user")===V&&!!le.archived==!!a.archived):null;ue&&(Y=ue)}}catch{}await ur(Y,{preserveComposer:!0}),gd(a.id,V)}catch(D){v(String(D.message||D))}finally{N(!1)}}},[a,ur]),vh=m.useCallback(async()=>{if(a){el(!0),Os(""),Io("");try{const x=await fetch("/api/flow/schedule",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:a.id,flowSource:a.source||"user",archived:!!a.archived,schedule:Gt})}),j=await x.json().catch(()=>({}));if(!x.ok||!j.success)throw new Error(j.error||"Failed to save schedule");Ls({...Fl,...j.schedule||{}}),Io(e("flow:schedule.saved")),await Ji(a,{quiet:!0,force:!0})}catch(x){Os(String(x.message||x))}finally{el(!1)}}},[a,Gt,Ji,e]),SI=m.useCallback(async()=>{a&&(await Qr(Fu.current,zu.current),!a.archived&&a.source!=="builtin"&&await vh())},[a,Qr,vh]),qu=m.useCallback(async()=>{if(!a||!C.trim())return;const x=C.trim();if(x===a.id){H("");return}R(!0),H("");try{const j=await fetch("/api/flow/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:a.id,flowSource:a.source??"user",newFlowId:x})}),D=await j.json().catch(()=>({}));if(!j.ok)throw new Error(typeof D.error=="string"?D.error:e("flow:composer.requestFailed"));let z={id:D.flowId,source:D.flowSource??a.source,archived:a.archived};try{const V=await fetch("/api/flows");if(V.ok){const Y=await V.json(),J=Array.isArray(Y)?Y.find(ne=>ne.id===D.flowId&&(ne.source??"user")===(D.flowSource??a.source)):null;J&&(z=J)}}catch{}await ur(z,{preserveComposer:!0}),gd(D.flowId,D.flowSource??a.source)}catch(j){H(String(j.message||j))}finally{R(!1)}},[a,C,ur]),qw=m.useCallback(x=>{navigator.clipboard.writeText(x).then(()=>{A(!0),setTimeout(()=>A(!1),2e3)}).catch(()=>{})},[]),bh=m.useCallback(()=>{Qr(tt,Bt)},[Qr,tt,Bt]),NI=m.useCallback((x,j)=>{const D=j.trim()===""||j==="default"?void 0:j.trim(),z=tt.map(V=>V.id===x?{...V,data:{...V.data,model:D}}:V);st(z),Qr(z,Bt)},[tt,Bt,st,Qr]),Gu=m.useCallback(()=>{var fe;if(!Xe||!a||!Be)return!1;const x=Be.id,j=Xe.newId.trim();if(Iu(""),!C9.test(j))return Iu(e("flow:nodePropsError.invalidInstanceId")),!1;if(tt.some(Te=>Te.id===j&&Te.id!==x))return Iu(e("flow:nodePropsError.duplicateInstanceId")),!1;const D=Xe.role.trim(),z=xo.includes(D)?D:"普通",V=Xe.model.trim(),Y=Te=>(Array.isArray(Te)?Te:[]).map(ot=>({type:String((ot==null?void 0:ot.type)??"节点").trim()||"节点",name:String((ot==null?void 0:ot.name)??""),default:String((ot==null?void 0:ot.default)??"")})),J=Y(Xe.inputs),ne=Y(Xe.outputs),ue=String(((fe=Be.data)==null?void 0:fe.definitionId)??j),le={...Be.data,label:Xe.label.trim()||j,role:z,model:V===""||V==="default"?void 0:V,body:Xe.body,inputs:J,outputs:ne},Ce=String(Xe.script??"").trim();ue==="tool_nodejs"||Ce!==""?le.script=String(Xe.script??""):delete le.script;let ee,ge=Bt;if(j!==x){const Te={...Si.current},ot={...Te[x]||{}};delete Te[x],Te[j]=ot,Si.current=Te,ee=tt.map(at=>at.id!==x?at:{...at,id:j,selected:!0,data:le}),ge=Bt.map((at,Eh)=>({...at,source:at.source===x?j:at.source,target:at.target===x?j:at.target,id:`e-${at.source===x?j:at.source}-${at.target===x?j:at.target}-${Eh}`}))}else ee=tt.map(Te=>Te.id===x?{...Te,data:le}:Te);return st(ee),Zt(ge),Qr(ee,ge),!0},[Xe,a,Be,tt,Bt,st,Zt,Qr]),kh=m.useCallback(()=>{var Te;if(!Xe||!a||!Be)return!1;const x=Be.id,j=Xe.role.trim(),D=xo.includes(j)?j:"普通",z=Xe.model.trim(),V=ot=>(Array.isArray(ot)?ot:[]).map(at=>({type:String((at==null?void 0:at.type)??"节点").trim()||"节点",name:String((at==null?void 0:at.name)??""),default:String((at==null?void 0:at.default)??"")})),Y=V(Xe.inputs),J=V(Xe.outputs),ne=String(((Te=Be.data)==null?void 0:Te.definitionId)??x),ue=Xe.label.trim()||x,le=z===""||z==="default"?void 0:z,Ce={...Be.data,label:ue,role:D,model:le,body:Xe.body,inputs:Y,outputs:J},ee=String(Xe.script??"").trim();ne==="tool_nodejs"||ee!==""?Ce.script=String(Xe.script??""):delete Ce.script;const ge=Be.data||{};return(ge.label!==Ce.label||ge.role!==Ce.role||ge.model!==Ce.model||ge.body!==Ce.body||(ge.script??void 0)!==(Ce.script??void 0)||JSON.stringify(ge.inputs||[])!==JSON.stringify(Y)||JSON.stringify(ge.outputs||[])!==JSON.stringify(J))&&st(ot=>ot.map(at=>at.id===x?{...at,data:Ce}:at)),!0},[Xe,a,Be,st]),Gw=m.useRef(kh);m.useEffect(()=>{Gw.current=kh},[kh]),m.useEffect(()=>{if(!Xe||!a||!wl.current||pe!=="edit")return;const x=setTimeout(()=>{Gw.current()},400);return()=>clearTimeout(x)},[Xe,a,pe]);const jI=m.useCallback(()=>{if(!(!Xe||!Be)){if(Xe.newId.trim()===Be.id){Iu("");return}Gu()}},[Xe,Be,Gu]);m.useEffect(()=>{const x=j=>{if(pe!=="edit")return;const D=a9(j.target);if((j.metaKey||j.ctrlKey)&&j.key.toLowerCase()==="s"){if(Ge==="node"&&Be&&Xe){j.preventDefault(),j.stopPropagation(),Gu()||bh();return}if(D)return;j.preventDefault(),j.stopPropagation(),bh();return}if((j.metaKey||j.ctrlKey)&&j.key.toLowerCase()==="k"){j.preventDefault(),j.stopPropagation(),Pw(z=>!z);return}if(!ih){if(_u){if(j.key==="Escape"){j.preventDefault(),ul(!1);return}if(Lk(j)&&!j.metaKey&&!j.ctrlKey&&!j.altKey){j.preventDefault(),ul(!1);return}(j.key==="v"||j.key==="V"||j.key==="h"||j.key==="H")&&!j.metaKey&&!j.ctrlKey&&!j.altKey&&j.preventDefault();return}if(!D){if((j.metaKey||j.ctrlKey)&&j.key.toLowerCase()==="a"){j.preventDefault(),j.stopPropagation(),st(z=>z.map(V=>({...V,selected:!0}))),Zt(z=>z.map(V=>({...V,selected:!1})));return}if(Lk(j)&&!j.metaKey&&!j.ctrlKey&&!j.altKey){j.preventDefault(),ul(z=>!z);return}if((j.key==="v"||j.key==="V")&&!j.metaKey&&!j.ctrlKey&&!j.altKey){j.preventDefault(),rh("select");return}if((j.key==="h"||j.key==="H")&&!j.metaKey&&!j.ctrlKey&&!j.altKey){j.preventDefault(),rh("pan");return}}}};return window.addEventListener("keydown",x,!0),()=>window.removeEventListener("keydown",x,!0)},[bh,_u,ih,Ge,Be,Xe,Gu,pe]),m.useEffect(()=>{if(pe!=="running"||lr==null)return;let x=Math.floor((Date.now()-lr)/1e3);const j=setInterval(()=>{const D=Date.now()-lr,z=Math.floor(D/1e3);z!==x&&(x=z,En(D))},500);return()=>clearInterval(j)},[pe,lr]),m.useEffect(()=>{const x=Ms.current;!x||!x.parentElement||rl.current&&(Ds.current=!0,x.scrollIntoView({behavior:"auto",block:"end"}),requestAnimationFrame(()=>{Ds.current=!1}))},[Pt]),m.useEffect(()=>{const x=Ms.current;if(!x)return;const j=x.parentElement;if(!j)return;const D=()=>{if(Ds.current)return;const z=j.scrollHeight-j.scrollTop-j.clientHeight;rl.current=z<40};return j.addEventListener("scroll",D,{passive:!0}),()=>j.removeEventListener("scroll",D)},[Gn,pe]),m.useEffect(()=>{if(pe==="edit"||!Gn)return;rl.current=!0;const x=Ms.current;x&&(Ds.current=!0,x.scrollIntoView({behavior:"auto",block:"end"}),requestAnimationFrame(()=>{Ds.current=!1}))},[pe,Gn]),m.useEffect(()=>{Pt.length>df+sS&&Oe(x=>x.length>df+sS?x.slice(-df):x)},[Pt]);const CI=m.useCallback(x=>{if(x.button!==0)return;x.preventDefault();const j=x.currentTarget;Ae.current={active:!0,pointerId:x.pointerId,startY:x.clientY,startH:Pe},j.setPointerCapture(x.pointerId)},[Pe]),EI=m.useCallback(x=>{const j=Ae.current;if(!j.active||x.pointerId!==j.pointerId)return;const D=j.startY-x.clientY;Ee(ff(j.startH+D))},[]),Xu=m.useCallback(()=>{Ee(x=>{const j=ff(x);try{localStorage.setItem(a_,String(j))}catch{}return j})},[]),Xw=m.useCallback(x=>{const j=Ae.current;if(!(!j.active||x.pointerId!==j.pointerId)){j.active=!1;try{x.currentTarget.releasePointerCapture(x.pointerId)}catch{}Xu()}},[Xu]),PI=m.useCallback(()=>{const x=Ae.current;x.active&&(x.active=!1,Xu())},[Xu]);m.useEffect(()=>{function x(){Ee(j=>ff(j))}return window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[]);const Zr=m.useCallback(async(x={})=>{if(!a)return;const j=x.runUuid!=null&&String(x.runUuid).trim()?String(x.runUuid).trim():null,D=x.cliInputsOverride??Ki.current,z=!!x.prepareOnly;if(it(z?"ready":"running"),Oe(z?[]:[{ts:new Date().toISOString(),type:"info",text:j?e("flow:run.connectingApiResume",{uuid:j}):e("flow:run.connectingApi")}]),mn(new Set),gn({}),G(!z),De(null),j||mt(null),z)return;if(!j){const Y=Date.now();Ln(Y),En(0)}const V=new AbortController;Yr.current=V;try{const Y=await fetch("/api/flow/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:a.id,flowSource:a.source||"user",...j?{uuid:j}:{},cliInputs:D}),signal:V.signal});if(!Y.ok){const ee=await Y.json().catch(()=>({error:e("flow:composer.requestFailed")}));Oe(ge=>[...ge,{ts:new Date().toISOString(),type:"error",text:ee.error||e("flow:composer.requestFailed")}]),it("error");return}if(Oe(ee=>[...ee,{ts:new Date().toISOString(),type:"info",text:e("flow:run.connectedReceiving")}]),!Y.body){Oe(ee=>[...ee,{ts:new Date().toISOString(),type:"error",text:e("flow:run.noBody")}]),it("error");return}const J=Y.body.getReader(),ne=new TextDecoder;let ue="";const le=ee=>{const ge=ee.ts||new Date().toISOString();if(ee.type==="event")if(ee.event==="node-start")mn(fe=>new Set(fe).add(ee.instanceId)),gn(fe=>({...fe,[ee.instanceId]:{status:"running",startMs:Date.now()}})),Oe(fe=>[...fe,{ts:ge,type:"node-start",text:ee.label?e("flow:run.nodeStartWithLabel",{instanceId:ee.instanceId,label:ee.label}):e("flow:run.nodeStart",{instanceId:ee.instanceId})}]);else if(ee.event==="node-done"){mn(Te=>{const ot=new Set(Te);return ot.delete(ee.instanceId),ot});const fe=ee.elapsed??null;gn(Te=>({...Te,[ee.instanceId]:{status:"success",elapsed:fe}})),Oe(Te=>[...Te,{ts:ge,type:"node-done",text:fe?e("flow:run.nodeDoneWithElapsed",{instanceId:ee.instanceId,elapsed:fe}):e("flow:run.nodeDone",{instanceId:ee.instanceId})}])}else if(ee.event==="node-failed")mn(fe=>{const Te=new Set(fe);return Te.delete(ee.instanceId),Te}),gn(fe=>({...fe,[ee.instanceId]:{status:"failed",elapsed:ee.elapsed??null}})),Oe(fe=>[...fe,{ts:ge,type:"node-failed",text:e("flow:run.nodeFailed",{instanceId:ee.instanceId})}]);else if(ee.event==="apply-start"){if(ee.uuid&&mt(String(ee.uuid)),typeof ee.runStartTime=="number"&&ee.runStartTime>0)Ln(ee.runStartTime),En(Math.max(0,Date.now()-ee.runStartTime));else if(typeof ee.totalExecutedMs=="number"&&ee.totalExecutedMs>0){const fe=Date.now()-ee.totalExecutedMs;Ln(fe),En(ee.totalExecutedMs)}Oe(fe=>[...fe,{ts:ge,type:"info",text:e("flow:run.pipelineStart",{uuid:ee.uuid||"?"})}])}else ee.event==="apply-done"?Oe(fe=>[...fe,{ts:ge,type:"info",text:ee.totalElapsed?e("flow:run.pipelineDoneWithElapsed",{elapsed:ee.totalElapsed}):e("flow:run.pipelineDone")}]):ee.event==="apply-paused"?Oe(fe=>[...fe,{ts:ge,type:"warn",text:e("flow:run.pipelinePaused",{nodes:(ee.pendingNodes||[]).join(", ")})}]):Oe(fe=>[...fe,{ts:ge,type:"event",text:`[${ee.event}] ${JSON.stringify(ee)}`}]);else ee.type==="user-check-content"?(Ao({instanceId:ee.instanceId,execId:ee.execId??1,inputPath:ee.inputPath,outputPath:ee.outputPath,content:ee.content||""}),Fs(ee.content||""),il(!1),Nu(""),ju(!1),Oe(fe=>[...fe,{ts:ge,type:"user-check",text:e("flow:run.userCheckContent",{instanceId:ee.instanceId})}])):ee.type==="user-ask-prompt"?(eh({instanceId:ee.instanceId,execId:ee.execId??1,question:ee.question||"",options:Array.isArray(ee.options)?ee.options:[]}),sl(!1),Oe(fe=>[...fe,{ts:ge,type:"user-ask",text:e("flow:run.userAskPrompt",{instanceId:ee.instanceId,defaultValue:`等待用户选择 (${ee.instanceId})`})}])):ee.type==="tool-print-content"?(Cw({instanceId:ee.instanceId,execId:ee.execId??1,content:ee.content||"",createdAt:Date.now()}),Ew(!1)):ee.type==="log"?Oe(fe=>[...fe,{ts:ge,type:"log",text:ee.text!=null?String(ee.text):""}]):ee.type==="error"?Oe(fe=>[...fe,{ts:ge,type:"error",text:ee.message||e("flow:run.unknownError")}]):ee.type==="done"?Oe(fe=>[...fe,{ts:ge,type:"done",text:e("flow:run.executionEnd",{exitCode:ee.exitCode??"?"})}]):Oe(fe=>[...fe,{ts:ge,type:"log",text:JSON.stringify(ee)}])},Ce=ee=>{if(ee.trim())try{le(JSON.parse(ee))}catch{Oe(ge=>[...ge,{ts:new Date().toISOString(),type:"log",text:ee}])}};for(;;){const{done:ee,value:ge}=await J.read();ue+=ne.decode(ge??new Uint8Array,{stream:!ee});const fe=ue.split(`
|
|
129
|
-
`);ue=fe.pop()??"";for(const Te of fe)Ce(Te);if(ee)break}ue.trim()&&Ce(ue),it("done")}catch(Y){Y.name==="AbortError"?(Oe(J=>[...J,{ts:new Date().toISOString(),type:"warn",text:e("flow:run.executionStopped")}]),it("stopped")):(Oe(J=>[...J,{ts:new Date().toISOString(),type:"error",text:Y.message||e("flow:run.unknownError")}]),it("error"))}finally{Yr.current=null,mn(new Set)}},[a]),[_I,Sh]=m.useState(!1),II=m.useCallback(()=>{Sh(!0)},[]),AI=m.useCallback(async()=>{if(Sh(!1),Yr.current&&(Yr.current.abort(),Yr.current=null),a)try{await fetch("/api/flow/run/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:a.id,flowSource:a.source||"user"})})}catch{}it("stopped"),mn(new Set)},[a]),Hs=m.useCallback(()=>{it("edit"),mn(new Set),gn({}),Tt(null),mt(null)},[]),[TI,Ju]=m.useState(!1),RI=m.useCallback(async()=>{if(Ju(!1),Yr.current&&(Yr.current.abort(),Yr.current=null),a)try{await fetch("/api/flow/run/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:a.id,flowSource:a.source||"user"})})}catch{}Hs()},[a,Hs]),LI=m.useCallback(()=>{Ju(!1),t("/projects")},[t]),OI=m.useCallback(x=>{const j=x.runId!=null&&String(x.runId).trim()?String(x.runId).trim():null,D=x.flowId!=null&&String(x.flowId).trim()?String(x.flowId).trim():(a==null?void 0:a.id)!=null?String(a.id):null;mt(j);const z=x.status||"unknown";let V="stopped";z==="success"?V="done":z==="failed"?V="error":z==="running"?V="running":V="stopped",it(V);const Y=typeof x.at=="number"?x.at:null;if(V==="running"&&Y!=null?(Ln(Y),En(Math.max(0,Date.now()-Y))):Y!=null&&typeof x.endedAt=="number"&&x.endedAt>Y?(Ln(null),En(x.endedAt-Y)):(Ln(null),En(Math.max(0,x.durationMs??0))),Oe([]),mn(new Set),gn({}),Tt(null),De(null),G(!1),j&&D){const J=new URLSearchParams({flowId:D,runId:j});fetch(`/api/run-node-statuses?${J}`).then(ne=>ne.json()).then(ne=>{const ue=ne.statuses&&typeof ne.statuses=="object"?ne.statuses:{},le={};for(const[Ce,ee]of Object.entries(ue))ee&&typeof ee=="object"&&typeof ee.status=="string"&&(le[Ce]={status:ee.status,...ee.elapsed!=null&&String(ee.elapsed).trim()!==""?{elapsed:String(ee.elapsed)}:{}});gn(le)}).catch(()=>{})}},[a==null?void 0:a.id]);m.useEffect(()=>{if(!(a!=null&&a.id)||pe!=="edit")return;let x=!1;return(async()=>{try{const j=await fetch("/api/pipeline-recent-runs"),D=await j.json();if(x||!j.ok)return;const V=(Array.isArray(D.runs)?D.runs:[]).find(ne=>ne.flowId===a.id&&ne.status==="running");if(!V||x)return;const Y=V.runId||null;mt(Y),it("running"),G(!0),Ln(V.at||Date.now()),ft.current=0;const J=[{ts:new Date().toISOString(),type:"info",text:`[resume] 检测到活跃 run ${Y},已恢复运行视图`}];if(Y){const ne=new URLSearchParams({flowId:a.id,runId:Y}),le=await(await fetch(`/api/run-node-statuses?${ne}`)).json();if(x)return;const Ce=le.statuses&&typeof le.statuses=="object"?le.statuses:{},ee={},ge=new Set;for(const[fe,Te]of Object.entries(Ce))Te&&typeof Te=="object"&&typeof Te.status=="string"&&(ee[fe]={status:Te.status,...Te.elapsed!=null&&String(Te.elapsed).trim()!==""?{elapsed:String(Te.elapsed)}:{}},Te.status==="running"&&ge.add(fe));gn(ee),mn(ge);try{const fe=new URLSearchParams({flowId:a.id,runId:Y,sinceBytes:"0",tailBytes:"262144"}),Te=await fetch(`/api/run-log?${fe}`);if(Te.ok){const ot=await Te.json();if(!x){ft.current=Number(ot.bytes||0);const at=oS(typeof ot.text=="string"?ot.text:"");Oe([...at,...J]);return}}}catch{}}Oe(J)}catch{}})(),()=>{x=!0}},[a==null?void 0:a.id]),m.useEffect(()=>{if(pe==="edit"||!(a!=null&&a.id)||!Me)return;let x=!1,j=null;const D=async()=>{try{const z=new URLSearchParams({flowId:a.id,runId:Me}),V=await fetch(`/api/run-node-statuses?${z}`);if(!V.ok)return;const Y=await V.json();if(x)return;const J=Y.statuses&&typeof Y.statuses=="object"?Y.statuses:{},ne={},ue=new Set;for(const[le,Ce]of Object.entries(J))Ce&&typeof Ce=="object"&&typeof Ce.status=="string"&&(ne[le]={status:Ce.status,...Ce.elapsed!=null&&String(Ce.elapsed).trim()!==""?{elapsed:String(Ce.elapsed)}:{}},Ce.status==="running"&&ue.add(le));gn(le=>cU(le,ne)?le:ne),mn(le=>uU(le,ue)?le:ue);try{const le=new URLSearchParams({flowId:a.id,runId:Me,sinceBytes:String(ft.current||0),tailBytes:String(sU)}),Ce=await fetch(`/api/run-log?${le}`);if(Ce.ok){const ee=await Ce.json();if(x)return;const ge=Number(ee.bytes||0),fe=typeof ee.text=="string"?ee.text:"";if(fe){const Te=oS(fe);Te.length>0&&Oe(ot=>[...ot,...Te])}ft.current=ge}}catch{}try{const le=await fetch("/api/pipeline-recent-runs");if(!le.ok)return;const Ce=await le.json();if(x)return;const ge=(Array.isArray(Ce.runs)?Ce.runs:[]).find(fe=>fe.flowId===a.id&&fe.runId===Me);if(ge&&ge.status){const fe=ge.status;fe==="running"?it(Te=>Te==="running"?Te:"running"):fe==="success"?it("done"):fe==="failed"?it("error"):(fe==="stopped"||fe==="interrupted")&&it("stopped")}}catch{}}catch{}};return D(),j=window.setInterval(D,2500),()=>{x=!0,j&&window.clearInterval(j)}},[pe,a==null?void 0:a.id,Me]),m.useEffect(()=>{if(Ge!=="history"||!a)return;let x=!1;return(async()=>{on(!0),sn("");try{const j=await fetch("/api/pipeline-recent-runs"),D=await j.json();if(!j.ok)throw new Error(D.error||"HTTP "+j.status);x||Ut(Array.isArray(D.runs)?D.runs:[])}catch(j){x||(sn(String(j.message||j)),Ut([]))}finally{x||on(!1)}})(),()=>{x=!0}},[Ge,a]),m.useEffect(()=>{if(!a){$e({files:[]});return}let x=!1;return(async()=>{Qe(!0);try{const j=new URLSearchParams({flowId:a.id,flowSource:a.source||"user",archived:a.archived?"1":"0"}),D=await fetch(`/api/pipeline-files?${j}`),z=await D.json();if(!D.ok)throw new Error(z.error||"HTTP "+D.status);x||$e({files:Array.isArray(z.files)?z.files:[],path:z.path,error:z.error})}catch(j){x||$e({files:[],error:j.message||String(j)})}finally{x||Qe(!1)}})(),()=>{x=!0}},[a]);const bl=m.useMemo(()=>a?kt.filter(x=>x&&x.flowId===a.id).sort((x,j)=>j.at-x.at):[],[kt,a]),Pn=m.useMemo(()=>{let x=0,j=0,D=0,z=0,V=0;for(const Y of bl){const J=Y.status||"unknown";J==="success"?x+=1:J==="failed"?j+=1:J==="running"?D+=1:J==="stopped"?z+=1:J==="interrupted"&&(V+=1)}return{success:x,failed:j,running:D,stopped:z,interrupted:V}},[bl]),kl=m.useMemo(()=>a?tS(cr,Pu):null,[a,cr,Pu]),Nr=m.useMemo(()=>{if(!kl||!a)return[];const x=kl.query.toLowerCase(),j=V=>x?V.some(Y=>Y&&String(Y).toLowerCase().includes(x)):!0,D=tt.map(V=>{var le,Ce;const Y=V.id,J=String(((le=V.data)==null?void 0:le.label)??Y),ne=(Ce=V.data)!=null&&Ce.definitionId?String(V.data.definitionId):"",ue=[J!==Y?J:"",ne&&ne!==Y?ne:""].filter(Boolean);return{id:Y,label:J,defId:ne,subs:ue}}).filter(({id:V,label:Y,defId:J})=>j([V,Y,J])).sort((V,Y)=>V.id.localeCompare(Y.id)).slice(0,18).map(({id:V,label:Y,defId:J})=>{const ne=[Y!==V?Y:null,J||null].filter(Boolean).join(" · ")||void 0;return{kind:"instance",id:V,title:V,subtitle:ne}}),z=X.filter(V=>V&&V.id&&j([V.id,V.label,V.description])).sort((V,Y)=>V.id.localeCompare(Y.id)).slice(0,22).map(V=>({kind:"definition",id:V.id,title:V.id,subtitle:V.label&&V.label!==V.id?String(V.label):String(V.type||"")}));return[...D,...z]},[kl,tt,X,a]),Sl=m.useMemo(()=>{const x=Nr.filter(D=>D.kind==="instance"),j=Nr.filter(D=>D.kind==="definition");return{instances:x,definitions:j}},[Nr]);m.useEffect(()=>{cl(x=>{const j=Math.max(0,Nr.length-1);return Math.min(Math.max(0,x),j)})},[Nr]);const Jw=m.useMemo(()=>J9(cr),[cr]),Qw=m.useMemo(()=>tt.filter(x=>x.selected),[tt]),Qu=m.useMemo(()=>{const x=[],j=new Set;for(const V of Qw)j.add(V.id),x.push({node:V,kind:"canvas"});const D=new Map(tt.map(V=>[V.id,V])),z=new Map(X.map(V=>[V.id,V]));for(const V of Jw){if(j.has(V))continue;const Y=D.get(V);if(Y){j.add(V),x.push({node:Y,kind:"mention"});continue}const J=z.get(V);J&&(j.add(V),x.push({definition:J,kind:"definition"}))}return x},[Qw,Jw,tt,X]),Mn=m.useMemo(()=>{const x=Array.isArray(Ue==null?void 0:Ue.cursor)?Ue.cursor:[],j=Array.isArray(Ue==null?void 0:Ue.opencode)?Ue.opencode:[],D=Array.isArray(Ue==null?void 0:Ue.claudeCode)?Ue.claudeCode:[],z=j.map(le=>`opencode:${Pi(le)}`),V=D.map(le=>`claude-code:${Pi(le)}`),Y=new Set([...x,...j,...D].map(Pi).concat(z).concat(V)),J=(zs||"").trim(),ne=Dd(zs,x,j,D),ue=ne&&!Y.has(ne)&&!Y.has(J)?J:"";return{cursorList:x,opencodeList:j,claudeCodeList:D,currentNotInLists:ue}},[Ue,zs]),MI=m.useMemo(()=>new Set(fl),[fl]),Nh=fl.length,DI=m.useMemo(()=>{const x=[],j=new Map;for(const D of ch){const z=D.sourceLabel||D.source||"Skills";if(!j.has(z)){const V={label:z,skills:[]};j.set(z,V),x.push(V)}j.get(z).skills.push(D)}return x},[ch]),Lo=m.useCallback(()=>{const x=dh.current;if(!x)return;const j=x.getBoundingClientRect(),D=Math.min(400,Math.max(300,window.innerWidth-24)),z=Math.min(Math.max(12,j.right-D),window.innerWidth-D-12),V=Math.max(140,j.top-22),Y=Math.min(360,V);nI({position:"fixed",left:`${z}px`,top:`${Math.max(12,j.top-Y-10)}px`,width:`${D}px`,maxHeight:`${Y}px`})},[]);m.useEffect(()=>{const x=Array.isArray(Ue==null?void 0:Ue.cursor)?Ue.cursor:[],j=Array.isArray(Ue==null?void 0:Ue.opencode)?Ue.opencode:[],D=Array.isArray(Ue==null?void 0:Ue.claudeCode)?Ue.claudeCode:[];_w(z=>{const V=Dd(z,x,j,D);return V===z?z:V})},[Ue.cursor,Ue.opencode,Ue.claudeCode]),m.useEffect(()=>{if(!Au)return;Lo();const x=D=>{var V,Y;const z=D.target;(V=dh.current)!=null&&V.contains(z)||(Y=Aw.current)!=null&&Y.contains(z)||uh(!1)},j=D=>{D.key==="Escape"&&uh(!1)};return window.addEventListener("resize",Lo),window.addEventListener("scroll",Lo,!0),document.addEventListener("pointerdown",x),document.addEventListener("keydown",j),()=>{window.removeEventListener("resize",Lo),window.removeEventListener("scroll",Lo,!0),document.removeEventListener("pointerdown",x),document.removeEventListener("keydown",j)}},[Au,Lo]);const Us=m.useCallback(async(x,j={})=>{var sv;if(!a||mh.current)return;const D=j.phaseContextSnapshot,z=(typeof x=="string"?x:cr).trim();if(!z)return;const V=Lw.current;mh.current=!0,$w(!0),Gr(e("flow:composer.connecting")),De(pt=>pt!=="composer"?"composer":pt);const Y=[...ml];if(V.length>0&&Y.push({type:"assistant",segments:[...V]}),Fw([...Y,{type:"user",text:z}]),Y.filter(pt=>pt.type==="user").length===0){const pt=z.replace(/\s+/g," ").slice(0,30)+(z.length>30?"…":"");qr(dr=>dr.map(xn=>xn.id===yn?{...xn,label:pt}:xn))}const J=Y.map(pt=>pt.type==="user"?{role:"user",text:pt.text}:{role:"assistant",text:(pt.segments||[]).filter(xn=>xn.kind==="assistant"||xn.kind==="result").map(xn=>xn.text).join(`
|
|
130
|
-
`)}).filter(pt=>pt.text),ne=D??Ke;ol(""),Xr([]),gl([]),zw(!1);const ue=new AbortController;Du.current=ue,hh.current=yn;let le=null;const Ce=Array.isArray(Ue==null?void 0:Ue.cursor)?Ue.cursor:[],ee=Array.isArray(Ue==null?void 0:Ue.opencode)?Ue.opencode:[],ge=Array.isArray(Ue==null?void 0:Ue.claudeCode)?Ue.claudeCode:[],fe=Dd(zs,Ce,ee,ge),Te=Qu.filter(pt=>pt.kind!=="definition"&&pt.node).map(pt=>pt.node.id),ot=a;let at=!1,Eh=!1;try{le=setTimeout(()=>ue.abort(),12e4);const pt={prompt:z,model:fe,flowId:a.id,flowSource:a.source??"user",...a.archived?{flowArchived:!0}:{},contextInstanceIds:Te,thread:J,selectedSkills:fl};ne&&ne.nextPhase&&!ne.isLastPhase&&(pt.phaseContext={phaseIndex:ne.nextPhase.index,phases:ne.phases,userPromptOriginal:ne.userPromptOriginal||z}),lh&&(pt.phaseRole=lh);const dr=await fetch("/api/composer-agent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(pt),signal:ue.signal});if(le&&(clearTimeout(le),le=null),!dr.ok){let jl=dr.statusText||e("flow:composer.requestFailed");try{const Cl=await dr.json();Cl&&Cl.error&&(jl=String(Cl.error))}catch{}Gr(jl),Xr([{kind:"error",text:jl}]);return}const xn=(sv=dr.body)==null?void 0:sv.getReader();if(!xn){Gr(e("flow:composer.cannotReadStream"));return}const Oo=new TextDecoder;let Vs="";for(;;){const{done:jl,value:Cl}=await xn.read();if(jl)break;for(Vs+=Oo.decode(Cl,{stream:!0});;){const Ph=Vs.indexOf(`
|
|
131
|
-
`);if(Ph<0)break;const ov=Vs.slice(0,Ph).trim();if(Vs=Vs.slice(Ph+1),!ov)continue;let Ne;try{Ne=JSON.parse(ov)}catch{continue}if(Ne.type==="status"&&typeof Ne.line=="string"&&Gr(Ne.line),Ne.type==="natural"&&typeof Ne.text=="string"&&Ne.text){const yt=typeof Ne.kind=="string"&&Ne.kind?Ne.kind:"assistant";Xr(ht=>[...ht,{kind:yt,text:Ne.text}])}if(Ne.type==="error"&&Ne.message){Eh=!0;const yt=Ne.code?` [${Ne.code}]`:"",ht=String(Ne.message)+yt;Gr(ht),Xr(Dn=>[...Dn,{kind:"error",text:ht}])}if(Ne.type==="plan"&&Array.isArray(Ne.steps)){gl(Ne.steps.map(ht=>({...ht,status:"pending"})));const yt=Ne.steps.map((ht,Dn)=>`${Dn+1}. ${ht.description||ht.type}`).join(`
|
|
132
|
-
`);Xr(ht=>[...ht,{kind:"assistant",text:e("flow:composer.taskPlan",{count:Ne.steps.length,summary:yt})}])}if(Ne.type==="step-start"){const yt=Ne.index??0,ht=Ne.total??0,Dn=Ne.tier?` [${Ne.tier}]`:"",UI=Ne.model?` (${Ne.model})`:"";Gr(e("flow:composer.step",{current:yt+1,total:ht,description:(Ne.description||"")+Dn+UI})),gl(VI=>VI.map(Mo=>Mo.index===yt?{...Mo,status:"running",model:Ne.model,tier:Ne.tier,nodeRole:Ne.nodeRole??Mo.nodeRole,instanceId:Ne.instanceId??Mo.instanceId,instanceLabel:Ne.instanceLabel??Mo.instanceLabel}:Mo))}if(Ne.type==="step-progress"){const yt=Ne.index??0,ht=Ne.total??0;Gr(e("flow:composer.step",{current:yt+1,total:ht,description:Ne.description||""}))}if(Ne.type==="step-done"){const yt=Ne.index??0;gl(ht=>ht.map(Dn=>Dn.index===yt?{...Dn,status:Ne.success?"done":"error"}:Dn))}if(Ne.type==="phase-plan"&&Array.isArray(Ne.phases)){yl(ht=>({...ht||{},phases:Ne.phases,currentPhase:Ne.currentPhase??0,phaseTotal:Ne.phaseTotal??Ne.phases.length,phaseName:Ne.phaseName||"",isLastPhase:!1,nextPhase:null,userPromptOriginal:(ht==null?void 0:ht.userPromptOriginal)||z}));const yt=Ne.phases.map((ht,Dn)=>`${Dn+1}. ${ht.label}`).join(" → ");Xr(ht=>[...ht,{kind:"assistant",text:e("flow:composer.phaseGeneration",{count:Ne.phases.length,labels:yt,current:Ne.phaseName||""})}])}Ne.type==="phase-complete"&&(yl(yt=>{var Dn;return{...yt||{},phases:Ne.phases||(yt==null?void 0:yt.phases)||[],currentPhase:Ne.phaseIndex??0,phaseTotal:Ne.phaseTotal??((Dn=Ne.phases)==null?void 0:Dn.length)??0,phaseName:Ne.phaseName||"",isLastPhase:!!Ne.isLastPhase,nextPhase:Ne.nextPhase||null,userPromptOriginal:Ne.userPromptOriginal||(yt==null?void 0:yt.userPromptOriginal)||z}}),!Ne.isLastPhase&&Ne.nextPhase&&Xr(yt=>[...yt,{kind:"assistant",text:e("flow:composer.phaseComplete",{phaseName:Ne.phaseName||e("flow:composer.nextPhase"),nextPhase:Ne.nextPhase.label})}])),Ne.type==="done"&&(at=!0,Gr(yt=>yt||e("flow:composer.done")))}}}catch(pt){const dr=pt;if(dr.name==="AbortError"){const xn=e(le?"flow:composer.connectTimeout":"flow:composer.aborted");Gr(xn),Xr(Oo=>[...Oo,{kind:"error",text:xn}])}else{const xn=dr.code||dr.name||"UNKNOWN",Oo=`${dr.message||String(pt)} [${xn}]`;Gr(Oo),Xr(Vs=>[...Vs,{kind:"error",text:Oo}])}}finally{if(mh.current=!1,$w(!1),Du.current=null,hh.current=null,le&&clearTimeout(le),at&&ot){const pt={id:ot.id,source:ot.source??"user",archived:ot.archived};(async()=>(await ur(pt,{preserveComposer:!0,incrementalSync:!0}),await Ji(pt,{quiet:!0,force:!0})))()}}},[a,cr,zs,Ue,Qu,ur,Ji,ml,yn,Ke,lh,fl]);rI.current=Us;const Zw=m.useCallback(()=>{!Ke||Ke.isLastPhase||(yl(null),Us(e("flow:composer.skipRemainingPhases")))},[Ke,Us]),ev=m.useCallback(()=>{if(!Ke||Ke.isLastPhase||!Ke.nextPhase)return;const x=String(Ke.nextPhase.label||"").trim()||e("flow:composer.nextPhase");Us(e("flow:composer.continuePhase",{label:x}),{phaseContextSnapshot:Ke})},[Ke,Us]);m.useEffect(()=>{if(!ph)return;const x=j=>{j.key==="Escape"&&Mu(!1)};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[ph]),m.useEffect(()=>{pe!=="edit"&&Mu(!1)},[pe]),m.useLayoutEffect(()=>{const x=sh.current;if(!x)return;if(!a){x.style.height="";return}x.style.height="0px";const j=getComputedStyle(x),D=parseFloat(j.lineHeight),z=(parseFloat(j.paddingTop)||0)+(parseFloat(j.paddingBottom)||0),V=Number.isFinite(D)&&D>0?D:13*1.45,Y=z+V*2,J=z+V*10,ne=Math.min(Math.max(x.scrollHeight,Y),J);x.style.height=`${ne}px`},[cr,a]);const jh=m.useCallback(x=>{const j=cr,D=Pu,z=tS(j,D);if(!z)return;const V=j.slice(0,z.atIndex)+`@${x} `+j.slice(D);ol(V);const Y=z.atIndex+x.length+2;queueMicrotask(()=>{const J=sh.current;J&&(J.focus(),J.setSelectionRange(Y,Y)),al(Y)})},[cr,Pu]),Ch=m.useCallback(x=>{ol(j=>{const D=`@${x}`,z=j.indexOf(D);return z<0?j:j.slice(0,z)+j.slice(z+D.length)})},[]),tv=m.useCallback(x=>{x.kind==="canvas"?st(j=>j.map(D=>D.id===x.node.id?{...D,selected:!1}:D)):x.kind==="mention"?Ch(x.node.id):Ch(x.definition.id)},[st,Ch]),$I=m.useCallback(()=>{De(x=>x==="history"?null:"history")},[]),FI=m.useCallback(()=>{De(x=>x==="settings"?null:"settings")},[]),zI=m.useCallback(()=>{De(x=>x==="composer"?null:"composer")},[]),Nl=m.useCallback(()=>{De(x=>(x==="node"&&dl.current&&(oh.current=dl.current.id),null))},[]),nv=m.useCallback(()=>{ul(x=>!x)},[]),BI=()=>{if(!a)return null;const x=br||a.archived||a.source==="builtin",j=Rt!=null&&Rt.running?e("flow:schedule.running"):Gt.enabled?e("flow:schedule.waiting"):e("flow:schedule.disabled"),D=Rt!=null&&Rt.running?"running":Gt.enabled?"waiting":"disabled",z=ie.slice(0,12),V=a.archived||a.source==="builtin";return l.jsxs("section",{className:"af-pipeline-settings-page","aria-label":e("flow:settings.title"),children:[l.jsxs("aside",{className:"af-pipeline-settings-nav","aria-label":e("flow:settings.sectionNav"),children:[l.jsx("div",{className:"af-pipeline-settings-nav-title",children:e("flow:settings.title")}),l.jsxs("a",{href:"#pipeline-basic",className:"af-pipeline-settings-nav-item af-pipeline-settings-nav-item--active",children:[l.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"badge"}),e("flow:settings.basicInfo")]}),l.jsxs("a",{href:"#pipeline-storage",className:"af-pipeline-settings-nav-item",children:[l.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"folder_open"}),e("flow:settings.storageAndPath")]}),l.jsxs("a",{href:"#pipeline-marketplace",className:"af-pipeline-settings-nav-item",children:[l.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"deployed_code"}),e("flow:settings.nodeMarketplace")]}),l.jsxs("a",{href:"#pipeline-schedule",className:"af-pipeline-settings-nav-item",children:[l.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"schedule"}),e("flow:schedule.title")]}),l.jsxs("a",{href:"#pipeline-metadata",className:"af-pipeline-settings-nav-item",children:[l.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"dataset"}),e("flow:pipeline.metadata")]}),l.jsxs("button",{type:"button",className:"af-pipeline-settings-nav-link",onClick:()=>t("/settings"),children:[e("flow:settings.globalSettings"),l.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_new"})]})]}),l.jsxs("main",{className:"af-pipeline-settings-main",children:[l.jsxs("div",{className:"af-pipeline-settings-main-head",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"af-pipeline-settings-title",children:e("flow:settings.title")}),l.jsx("p",{className:"af-pipeline-settings-subtitle",children:e("flow:settings.subtitle")})]}),l.jsxs("button",{type:"button",className:"af-btn-secondary",onClick:Nl,children:[l.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_back"}),e("flow:settings.backToCanvas")]})]}),l.jsxs("section",{id:"pipeline-basic",className:"af-pipeline-settings-section",children:[l.jsxs("div",{className:"af-pipeline-settings-section-head",children:[l.jsx("span",{className:"af-pipeline-settings-section-index",children:"1."}),l.jsx("h2",{children:e("flow:settings.basicInfo")})]}),l.jsxs("div",{className:"af-pipeline-settings-grid af-pipeline-settings-grid--two",children:[l.jsxs("div",{className:"af-pipeline-drawer-field",children:[l.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.pipelineId")}),(a.source==="user"||a.source==="workspace")&&!a.archived?l.jsxs("div",{className:"af-pipeline-rename-row",children:[l.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:C,onChange:Y=>{S(Y.target.value),H("")},onKeyDown:Y=>{Y.key==="Enter"&&(Y.preventDefault(),qu())},onBlur:()=>{C.trim()&&C.trim()!==a.id&&qu()},placeholder:a.id,disabled:P,spellCheck:!1}),l.jsx("span",{className:"af-pipeline-drawer-badge",children:Bo(a.source??"user",e)})]}):l.jsxs("div",{className:"af-pipeline-drawer-readonly",children:[a.id,l.jsx("span",{className:"af-pipeline-drawer-badge",children:Bo(a.source??"user",e)}),a.archived?l.jsx("span",{className:"af-pipeline-drawer-badge af-pipeline-drawer-badge--muted",children:e("flow:settings.archived")}):null]}),M?l.jsx("p",{className:"af-err af-pipeline-drawer-err",children:M}):null]}),l.jsxs("div",{className:"af-pipeline-settings-kv-block",children:[l.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:settings.owner")}),l.jsxs("div",{className:"af-pipeline-drawer-readonly",children:[l.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"person"}),a.owner||"bigo"]})]})]}),l.jsxs("label",{className:"af-pipeline-drawer-field",children:[l.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.introduction")}),l.jsx("textarea",{className:"af-pipeline-drawer-textarea af-pipeline-settings-textarea",value:d,onChange:Y=>f(Y.target.value),placeholder:e("flow:pipeline.introductionPlaceholder"),rows:4,spellCheck:!1})]})]}),l.jsxs("section",{id:"pipeline-storage",className:"af-pipeline-settings-section",children:[l.jsxs("div",{className:"af-pipeline-settings-section-head",children:[l.jsx("span",{className:"af-pipeline-settings-section-index",children:"2."}),l.jsx("h2",{children:e("flow:settings.storageAndPath")})]}),typeof a.path=="string"&&a.path?l.jsxs("div",{className:"af-pipeline-drawer-field",children:[l.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.diskPath")}),l.jsxs("div",{className:"af-pipeline-drawer-readonly af-pipeline-drawer-readonly--mono af-pipeline-path-row",children:[l.jsx("span",{className:"af-pipeline-path-text",children:a.path}),l.jsx("button",{type:"button",className:"af-icon-btn af-pipeline-copy-btn",onClick:()=>qw(a.path),title:e("flow:settings.copyPath"),children:l.jsx("span",{className:"material-symbols-outlined",children:_?"check":"content_copy"})})]})]}):null,a.source==="user"||a.source==="workspace"?a.archived?l.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.archivedNote")}):l.jsxs("div",{className:"af-pipeline-drawer-field",children:[l.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.storageLocation")}),l.jsx("div",{className:"af-pipeline-move-actions",children:a.source==="user"?l.jsx("button",{type:"button",className:"af-btn-secondary",disabled:w,onClick:()=>Yu("workspace"),children:e(w?"flow:settings.moveBusy":"flow:settings.moveToWorkspace")}):l.jsx("button",{type:"button",className:"af-btn-secondary",disabled:w,onClick:()=>Yu("user"),children:e(w?"flow:settings.moveBusy":"flow:settings.moveToUserDir")})}),y?l.jsx("p",{className:"af-err af-pipeline-drawer-err",children:y}):null]}):l.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.builtinNote")})]}),l.jsxs("section",{id:"pipeline-marketplace",className:"af-pipeline-settings-section",children:[l.jsxs("div",{className:"af-pipeline-settings-section-head",children:[l.jsx("span",{className:"af-pipeline-settings-section-index",children:"3."}),l.jsx("h2",{children:e("flow:settings.nodeMarketplace")})]}),l.jsxs("div",{className:"af-pipeline-market-row",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"af-pipeline-market-count",children:[ie.length," ",e("flow:settings.marketNodesUnit")]}),l.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.marketplaceHint")})]}),l.jsxs("button",{type:"button",className:"af-btn-secondary",onClick:wh,disabled:ye,children:[l.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"refresh"}),e(ye?"common:common.loading":"common:common.refresh")]})]}),he?l.jsx("p",{className:"af-err af-pipeline-drawer-err",children:he}):null,ye?l.jsx("p",{className:"af-pipeline-drawer-muted",children:e("common:common.loading")}):z.length>0?l.jsx("div",{className:"af-pipeline-market-list",children:z.map(Y=>{const J=Y.definitionId||`marketplace:${Y.id}${Y.version?`@${Y.version}`:""}`,ne=Vw.has(J)||Vw.has(`marketplace:${Y.id}`),ue=Hu.find(ge=>String(ge.id)===J||String(ge.id)===`marketplace:${Y.id}`),le=Ve===J,Ce=Md(Y.inputs||Y.input),ee=Md(Y.outputs||Y.output);return l.jsxs("div",{className:"af-pipeline-market-item",children:[l.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:ne?"check_circle":"extension"}),l.jsxs("div",{className:"af-pipeline-market-main",children:[l.jsxs("div",{className:"af-pipeline-market-title-row",children:[l.jsx("strong",{children:Y.displayName||Y.label||Y.id}),l.jsx("span",{children:Y.version?`v${Y.version}`:J})]}),l.jsx("p",{className:"af-pipeline-market-purpose",children:Y.description||e("flow:settings.marketplaceNoDescription")}),l.jsxs("div",{className:"af-pipeline-market-io",children:[l.jsxs("div",{children:[l.jsx("span",{className:"af-pipeline-market-io-label",children:"Inputs"}),l.jsx("div",{className:"af-pipeline-market-chips",children:Ce.length>0?Ce.map(ge=>l.jsx("span",{className:"af-pipeline-market-chip",children:ge},`in-${J}-${ge}`)):l.jsx("span",{className:"af-pipeline-market-chip af-pipeline-market-chip--muted",children:e("flow:settings.noInputs")})})]}),l.jsxs("div",{children:[l.jsx("span",{className:"af-pipeline-market-io-label",children:"Outputs"}),l.jsx("div",{className:"af-pipeline-market-chips",children:ee.length>0?ee.map(ge=>l.jsx("span",{className:"af-pipeline-market-chip",children:ge},`out-${J}-${ge}`)):l.jsx("span",{className:"af-pipeline-market-chip af-pipeline-market-chip--muted",children:e("flow:settings.noOutputs")})})]})]})]}),l.jsxs("div",{className:"af-pipeline-market-actions",children:[l.jsx("button",{type:"button",className:"af-btn-secondary af-pipeline-market-action",onClick:()=>ut(Y),children:e("flow:settings.previewNode")}),l.jsx("button",{type:"button",className:ne?"af-btn-secondary af-pipeline-market-action":"af-btn-primary af-pipeline-market-action",disabled:V||le,onClick:()=>{ne&&ue?(Yw(ue),De(null)):dI(Y)},children:e(le?"flow:settings.installingNode":ne?"flow:settings.addInstalledNode":"flow:settings.installNode")})]})]},J)})}):l.jsx("div",{className:"af-pipeline-settings-empty",children:e("flow:settings.marketplaceEmpty")})]}),l.jsxs("section",{id:"pipeline-schedule",className:"af-pipeline-settings-section",children:[l.jsxs("div",{className:"af-pipeline-settings-section-head",children:[l.jsx("span",{className:"af-pipeline-settings-section-index",children:"4."}),l.jsx("h2",{children:e("flow:schedule.title")})]}),bu?l.jsx("p",{className:"af-pipeline-drawer-muted",children:e("common:common.loading")}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"af-pipeline-settings-schedule-grid",children:[l.jsxs("label",{className:"af-new-pipeline-radio af-pipeline-settings-checkbox",children:[l.jsx("input",{type:"checkbox",checked:!!Gt.enabled,disabled:x,onChange:Y=>Xi(J=>({...J,enabled:Y.target.checked}))}),l.jsx("span",{children:e("flow:schedule.enabled")})]}),l.jsxs("label",{className:"af-pipeline-drawer-field",children:[l.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.cron")}),l.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:Gt.cron||"",disabled:x,onChange:Y=>Xi(J=>({...J,cron:Y.target.value})),placeholder:"0 9 * * *",spellCheck:!1})]}),l.jsxs("label",{className:"af-pipeline-drawer-field",children:[l.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.timezone")}),l.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:Gt.timezone||"",disabled:x,onChange:Y=>Xi(J=>({...J,timezone:Y.target.value})),placeholder:"Asia/Shanghai",spellCheck:!1})]}),l.jsxs("label",{className:"af-pipeline-drawer-field",children:[l.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.preset")}),l.jsxs("select",{className:"af-pipeline-flow-select",value:Gt.preset||"",disabled:x,onChange:Y=>Xi(J=>({...J,preset:Y.target.value})),children:[l.jsx("option",{value:"",children:e("flow:schedule.defaultPreset")}),Object.keys(vi).map(Y=>l.jsx("option",{value:Y,children:Y},Y))]})]})]}),l.jsxs("div",{className:"af-pipeline-settings-schedule-status",children:[l.jsx("span",{className:`af-pipeline-settings-status-dot af-pipeline-settings-status-dot--${D}`}),l.jsx("span",{children:Gt.nextRunAt?e("flow:schedule.nextRun",{time:new Date(Gt.nextRunAt).toLocaleString()}):e("flow:schedule.noNextRun")}),l.jsxs("span",{children:[e("flow:schedule.runtime"),":",j]})]}),l.jsxs("dl",{className:"af-pipeline-meta-dl af-pipeline-settings-dl",children:[ct.lastTriggeredAt?l.jsxs("div",{className:"af-pipeline-meta-row",children:[l.jsx("dt",{children:e("flow:schedule.lastTriggeredAt")}),l.jsx("dd",{children:new Date(ct.lastTriggeredAt).toLocaleString()})]}):null,ct.lastSkippedAt?l.jsxs("div",{className:"af-pipeline-meta-row",children:[l.jsx("dt",{children:e("flow:schedule.lastSkippedAt")}),l.jsxs("dd",{children:[new Date(ct.lastSkippedAt).toLocaleString(),ct.lastSkipReason?` · ${ct.lastSkipReason}`:""]})]}):null,ct.lastRunUuid?l.jsxs("div",{className:"af-pipeline-meta-row",children:[l.jsx("dt",{children:e("flow:schedule.lastRun")}),l.jsx("dd",{children:ct.lastRunUuid})]}):null,ct.lastExitCode!=null?l.jsxs("div",{className:"af-pipeline-meta-row",children:[l.jsx("dt",{children:e("flow:schedule.lastExit")}),l.jsx("dd",{children:String(ct.lastExitCode)})]}):null,ct.lastFinishedAt?l.jsxs("div",{className:"af-pipeline-meta-row",children:[l.jsx("dt",{children:e("flow:schedule.lastFinishedAt")}),l.jsx("dd",{children:new Date(ct.lastFinishedAt).toLocaleString()})]}):null]}),Rt!=null&&Rt.lastError||ct.lastError?l.jsx("p",{className:"af-err af-pipeline-drawer-err",children:(Rt==null?void 0:Rt.lastError)||ct.lastError}):null,a.archived||a.source==="builtin"?l.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.readonlyNote")}):null,Po?l.jsx("p",{className:"af-err af-pipeline-drawer-err",children:Po}):null,_o?l.jsx("p",{className:"af-pipeline-drawer-muted",children:_o}):null]})]}),l.jsxs("section",{id:"pipeline-metadata",className:"af-pipeline-settings-section",children:[l.jsxs("div",{className:"af-pipeline-settings-section-head",children:[l.jsx("span",{className:"af-pipeline-settings-section-index",children:"5."}),l.jsx("h2",{children:e("flow:pipeline.metadata")})]}),l.jsxs("dl",{className:"af-pipeline-meta-dl af-pipeline-settings-dl",children:[l.jsxs("div",{className:"af-pipeline-meta-row",children:[l.jsx("dt",{children:e("flow:pipeline.nodeCount")}),l.jsxs("dd",{children:[tt.length," ",e("flow:pipeline.nodesUnit")]})]}),l.jsxs("div",{className:"af-pipeline-meta-row",children:[l.jsx("dt",{children:e("flow:settings.marketplaceNodes")}),l.jsx("dd",{children:Hu.length})]}),l.jsxs("div",{className:"af-pipeline-meta-row",children:[l.jsx("dt",{children:e("flow:settings.source")}),l.jsx("dd",{children:Bo(a.source??"user",e)})]})]})]})]}),l.jsxs("aside",{className:"af-pipeline-settings-side","aria-label":e("flow:settings.overview"),children:[l.jsxs("section",{className:"af-pipeline-settings-side-card",children:[l.jsxs("div",{className:"af-pipeline-settings-overview-head",children:[l.jsx("span",{className:"af-pipeline-settings-overview-icon material-symbols-outlined","aria-hidden":!0,children:"account_tree"}),l.jsxs("div",{children:[l.jsx("h2",{children:a.id}),l.jsx("span",{className:`af-pipeline-settings-status af-pipeline-settings-status--${D}`,children:j})]})]}),l.jsxs("dl",{className:"af-pipeline-settings-side-dl",children:[l.jsxs("div",{children:[l.jsx("dt",{children:e("flow:pipeline.nodeCount")}),l.jsx("dd",{children:tt.length})]}),l.jsxs("div",{children:[l.jsx("dt",{children:e("flow:settings.owner")}),l.jsx("dd",{children:a.owner||"bigo"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:e("flow:settings.source")}),l.jsx("dd",{children:Bo(a.source??"user",e)})]})]})]}),l.jsxs("section",{className:"af-pipeline-settings-side-card",children:[l.jsx("h2",{children:e("flow:settings.quickActions")}),l.jsxs("button",{type:"button",className:"af-btn-primary af-pipeline-settings-side-action",onClick:()=>void SI(),disabled:br,children:[l.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"save"}),e(br?"flow:settings.savingChanges":"flow:settings.saveChanges")]}),l.jsxs("button",{type:"button",className:"af-btn-secondary af-pipeline-settings-side-action",onClick:Nl,children:[l.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_back"}),e("flow:settings.backToCanvas")]})]}),l.jsxs("section",{className:"af-pipeline-settings-side-card",children:[l.jsx("h2",{children:e("flow:settings.help")}),l.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.helpText")}),l.jsx("button",{type:"button",className:"af-pipeline-drawer-link",onClick:()=>t("/settings"),children:e("flow:settings.globalSettings")})]})]})]})},HI=()=>{const x=He;if(!x)return null;const j=x.definitionId||`marketplace:${x.id}${x.version?`@${x.version}`:""}`,D=x.displayName||x.label||x.id,z=Md(x.inputs||x.input),V=Md(x.outputs||x.output);return Tr.createPortal(l.jsx("div",{className:"af-market-preview-overlay",role:"dialog","aria-modal":"true","aria-label":e("flow:settings.nodePreviewTitle"),onMouseDown:Y=>{Y.target===Y.currentTarget&&ut(null)},children:l.jsxs("div",{className:"af-market-preview-dialog",children:[l.jsxs("div",{className:"af-market-preview-head",children:[l.jsxs("div",{children:[l.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:settings.nodePreviewTitle")}),l.jsx("h2",{children:D})]}),l.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>ut(null),"aria-label":e("flow:settings.closePreview"),children:l.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),l.jsxs("div",{className:"af-market-preview-body",children:[l.jsx("section",{className:"af-market-preview-visual","aria-label":e("flow:settings.nodeStylePreview"),children:l.jsxs("div",{className:"af-market-preview-node",children:[l.jsx("div",{className:"af-market-preview-node-ports af-market-preview-node-ports--left",children:(z.length>0?z:[""]).slice(0,4).map((Y,J)=>l.jsx("span",{title:Y},`preview-in-${J}`))}),l.jsxs("div",{className:"af-market-preview-node-main",children:[l.jsx("span",{className:"af-market-preview-node-icon material-symbols-outlined","aria-hidden":!0,children:"extension"}),l.jsx("strong",{children:D}),l.jsx("span",{children:j})]}),l.jsx("div",{className:"af-market-preview-node-ports af-market-preview-node-ports--right",children:(V.length>0?V:[""]).slice(0,4).map((Y,J)=>l.jsx("span",{title:Y},`preview-out-${J}`))})]})}),l.jsxs("section",{className:"af-market-preview-section",children:[l.jsx("h3",{children:e("flow:settings.nodeFunction")}),l.jsx("p",{children:x.description||e("flow:settings.marketplaceNoDescription")})]}),l.jsxs("div",{className:"af-market-preview-io-grid",children:[l.jsxs("section",{className:"af-market-preview-section",children:[l.jsx("h3",{children:"Inputs"}),l.jsx("div",{className:"af-pipeline-market-chips af-market-preview-chips",children:z.length>0?z.map(Y=>l.jsx("span",{className:"af-pipeline-market-chip",children:Y},`preview-input-${Y}`)):l.jsx("span",{className:"af-pipeline-market-chip af-pipeline-market-chip--muted",children:e("flow:settings.noInputs")})})]}),l.jsxs("section",{className:"af-market-preview-section",children:[l.jsx("h3",{children:"Outputs"}),l.jsx("div",{className:"af-pipeline-market-chips af-market-preview-chips",children:V.length>0?V.map(Y=>l.jsx("span",{className:"af-pipeline-market-chip",children:Y},`preview-output-${Y}`)):l.jsx("span",{className:"af-pipeline-market-chip af-pipeline-market-chip--muted",children:e("flow:settings.noOutputs")})})]})]}),l.jsxs("section",{className:"af-market-preview-section",children:[l.jsx("h3",{children:e("flow:settings.nodePackageInfo")}),l.jsxs("dl",{className:"af-market-preview-dl",children:[l.jsxs("div",{children:[l.jsx("dt",{children:e("flow:settings.definitionId")}),l.jsx("dd",{children:j})]}),l.jsxs("div",{children:[l.jsx("dt",{children:e("flow:settings.version")}),l.jsx("dd",{children:x.version||"-"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:e("flow:settings.packagePath")}),l.jsx("dd",{children:x.packageDir||"-"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:e("flow:settings.packagedFiles")}),l.jsx("dd",{children:Array.isArray(x.packagedFiles)&&x.packagedFiles.length>0?x.packagedFiles.map(Y=>Y.to||Y).join(", "):"-"})]})]})]})]})]})}),document.body)};return l.jsx(Ux,{children:l.jsxs(s_.Provider,{value:{modelLists:Ue,onModelChange:NI},children:[l.jsxs("div",{className:"af-pipeline-page"+(pe!=="edit"?" af-pipeline-page--run-mode":""),children:[l.jsxs("header",{className:"af-pipeline-top",children:[l.jsxs("div",{className:"af-pipeline-top-left",children:[l.jsx("button",{type:"button",className:"af-icon-btn af-pipeline-back",onClick:()=>{pe==="running"?Ju(!0):pe!=="edit"?Hs():t("/projects")},"aria-label":e(pe!=="edit"?"flow:topbar.backToEdit":"flow:topbar.backToProjects"),title:e(pe!=="edit"?"flow:topbar.backToEdit":"flow:topbar.backToProjects"),children:l.jsx("span",{className:"material-symbols-outlined",children:"arrow_back"})}),l.jsxs("div",{className:"af-pipeline-brand",children:[l.jsx("span",{className:"af-pipeline-brand-name",children:"PIPELINE"}),l.jsxs("span",{className:"af-pipeline-brand-ver",children:["V",H9,"-STABLE"]})]}),l.jsxs("div",{className:"af-view-switch","aria-label":"视图切换",children:[l.jsx("button",{type:"button",className:"af-view-switch__active",children:"Pipeline"}),l.jsx("button",{type:"button",onClick:()=>t(Sx(a,"workspace")),children:"Workspace"})]})]}),l.jsxs("div",{className:"af-pipeline-top-right af-flow-toolbar-actions",children:[_e&&l.jsx("button",{type:"button",className:"af-icon-btn"+(Q?" af-icon-btn--active":""),"aria-label":"Composer Logs (dev)",title:"Composer Logs (dev)",onClick:()=>te(x=>!x),children:l.jsx("span",{className:"material-symbols-outlined",children:"description"})}),pe==="running"&&l.jsxs("div",{className:"af-run-timer",children:[l.jsx("span",{className:"af-run-timer__dot"}),l.jsx("span",{className:"af-run-timer__label",children:"RUNTIME"}),l.jsx("span",{className:"af-run-timer__value",children:_m(Wr,"running")})]}),pe==="stopped"&&l.jsxs("div",{className:"af-run-timer af-run-timer--stopped",children:[l.jsx("span",{className:"af-run-timer__label",children:"PAUSED"}),l.jsx("span",{className:"af-run-timer__value",children:_m(Wr,"stopped")})]}),(pe==="done"||pe==="error")&&l.jsxs("div",{className:"af-run-timer"+(pe==="error"?" af-run-timer--error":" af-run-timer--done"),children:[l.jsx("span",{className:"af-run-timer__label",children:pe==="error"?"FAILED":"COMPLETED"}),l.jsx("span",{className:"af-run-timer__value",children:_m(Wr,pe)})]}),pe!=="edit"&&l.jsx("button",{type:"button",className:"af-icon-btn"+(Gn?" af-icon-btn--active":""),"aria-label":e("flow:topbar.executionLog"),title:e("flow:topbar.executionLog"),onClick:()=>G(x=>!x),children:l.jsx("span",{className:"material-symbols-outlined",children:"terminal"})}),pe==="edit"&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"af-icon-btn"+(Ge==="history"?" af-icon-btn--active":""),"aria-label":e("flow:topbar.history"),title:e("flow:topbar.history"),disabled:!a,onClick:$I,children:l.jsx("span",{className:"material-symbols-outlined",children:"history"})}),l.jsx("button",{type:"button",className:"af-icon-btn"+(Ge==="settings"?" af-icon-btn--active":""),onClick:FI,"aria-label":e("flow:topbar.pipelineSettings"),title:e("flow:topbar.pipelineSettings"),disabled:!a,children:l.jsx("span",{className:"material-symbols-outlined",children:"settings"})}),l.jsx("button",{type:"button",className:"af-composer-topbar-btn"+(Ge==="composer"?" af-composer-topbar-btn--active":"")+(Dt?" af-composer-topbar-btn--running":""),onClick:zI,"aria-label":"AI Composer",title:"AI Composer",disabled:!a,children:"AI"}),l.jsx("button",{type:"button",className:"af-icon-btn af-shortcuts-trigger"+(_u?" af-icon-btn--active":""),onClick:nv,"aria-label":e("flow:topbar.shortcutsLabel"),title:e("flow:topbar.shortcutsTitle"),disabled:!a,children:l.jsx("span",{className:"af-shortcuts-trigger__mark","aria-hidden":!0,children:"?"})}),l.jsx("button",{type:"button",className:"af-icon-btn af-icon-btn--danger","aria-label":e("flow:topbar.deletePipeline"),title:e("flow:topbar.deletePipeline"),disabled:!a||a.source==="builtin"||a.source!=="user"&&a.source!=="workspace",onClick:()=>$(!0),children:l.jsx("span",{className:"material-symbols-outlined",children:"delete_forever"})}),l.jsx("button",{type:"button",className:"af-btn-pipeline-archive",disabled:!a||a.source==="builtin"||a.archived||a.source!=="user"&&a.source!=="workspace",onClick:()=>L(!0),children:"Archive"})]}),pe==="running"?l.jsxs("button",{type:"button",className:"af-btn-run-stop",onClick:II,title:e("flow:run.pauseRun"),children:[l.jsx("span",{className:"material-symbols-outlined",children:"pause"}),"Pause"]}):pe==="ready"?l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!a,onClick:()=>void Zr(),title:e("flow:topbar.startRun"),children:e("flow:topbar.startRun")}),l.jsxs("button",{type:"button",className:"af-btn-pipeline-save",onClick:Hs,children:[l.jsx("span",{className:"material-symbols-outlined",children:"edit"}),"Edit"]})]}):pe==="stopped"?l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!a,onClick:()=>void Zr({runUuid:Me}),title:Me?e("flow:topbar.resumeTitle",{uuid:Me}):e("flow:topbar.resumeTitleNoUuid"),children:"Resume"}),l.jsxs("button",{type:"button",className:"af-btn-pipeline-save",onClick:Hs,children:[l.jsx("span",{className:"material-symbols-outlined",children:"edit"}),"Edit"]})]}):pe==="done"||pe==="error"?l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!a,onClick:()=>void Zr(),title:e("flow:topbar.rerunTitle"),children:"Run"}),l.jsxs("button",{type:"button",className:"af-btn-pipeline-save",onClick:Hs,children:[l.jsx("span",{className:"material-symbols-outlined",children:"edit"}),"Edit"]})]}):l.jsxs("div",{className:"af-run-btn-group",children:[l.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg af-run-btn-main",disabled:!a,onClick:()=>void Zr(),children:"Run"}),l.jsx("button",{type:"button",className:"af-run-btn-dropdown",disabled:!a,onClick:()=>Yi(x=>!x),"aria-label":e("flow:topbar.runOptions"),"aria-expanded":Qa,children:l.jsx("span",{className:"material-symbols-outlined",children:"arrow_drop_down"})}),Qa&&a&&l.jsxs("div",{className:"af-run-dropdown-menu",children:[l.jsxs("button",{type:"button",className:"af-run-dropdown-item",onClick:()=>{var j,D,z,V,Y;Yi(!1);const x={};for(const J of Sr){const ne=Ro[J.id];ne&&(x[ne]=((j=Kr[ne])==null?void 0:j.value)??((D=Kr[ne])==null?void 0:D.path)??((Y=(V=(z=J.data)==null?void 0:z.outputs)==null?void 0:V[0])==null?void 0:Y.default)??"")}vu(x),jo(!0)},children:[l.jsx("span",{className:"material-symbols-outlined",children:"edit_note"}),e("flow:topbar.runWithParams")]}),l.jsxs("button",{type:"button",className:"af-run-dropdown-item",onClick:()=>{Yi(!1),Zr({prepareOnly:!0})},children:[l.jsx("span",{className:"material-symbols-outlined",children:"tune"}),e("flow:topbar.editRun")]}),l.jsx("div",{className:"af-run-dropdown-divider"}),l.jsxs("div",{className:"af-run-dropdown-section",children:[l.jsx("span",{className:"af-run-dropdown-section-label",children:e("flow:topbar.runWithPreset")}),l.jsxs("button",{type:"button",className:"af-run-dropdown-item",onClick:()=>{Yi(!1),Zr()},children:[l.jsx("span",{className:"material-symbols-outlined",children:"play_arrow"}),e("flow:runPreset.default")]}),Object.keys(vi).map(x=>l.jsxs("button",{type:"button",className:"af-run-dropdown-item",onClick:()=>{var z;Yi(!1);const j=vi[x]||{},D={};for(const V of Sr){const Y=Ro[V.id];if(!Y)continue;const J=((z=V.data)==null?void 0:z.definitionId)||"",ne=j[V.id]??"";J.startsWith("provide_file")?D[Y]={type:"file",path:ne}:D[Y]={type:"str",value:ne}}Zr({cliInputsOverride:D})},children:[l.jsx("span",{className:"material-symbols-outlined",children:"bookmark"}),x]},x))]})]})]})]})]}),l.jsxs("div",{className:"af-pipeline-body"+(pe!=="edit"?" af-pipeline-body--run-mode":""),children:[pe==="edit"&&Ge!=="settings"?l.jsxs("aside",{className:"af-node-palette af-flow-left-panel",id:"af-node-palette","aria-label":e("flow:palette2.nodePalette"),children:[l.jsxs("div",{className:`af-palette-workspace${Z?" af-palette-workspace--expanded":""}`,children:[l.jsxs("button",{type:"button",className:"af-palette-workspace-head",onClick:()=>oe(x=>!x),"aria-expanded":Z,children:[l.jsx("span",{className:"af-palette-workspace-icon material-symbols-outlined","aria-hidden":!0,children:"folder_open"}),l.jsx("span",{className:"af-palette-workspace-label",children:e("flow:palette.workspace")}),l.jsx("span",{className:"af-palette-workspace-chevron material-symbols-outlined","aria-hidden":!0,children:Z?"expand_less":"expand_more"})]}),l.jsx("div",{className:"af-palette-workspace-path",title:a&&(a.path||je.path)||"",children:a?a.id:e("flow:palette2.noPipelineSelected")}),Z&&l.jsx("div",{className:"af-palette-workspace-tree",children:xe?l.jsx("div",{className:"af-palette-workspace-loading",children:e("flow:palette.loading")}):je.error?l.jsx("div",{className:"af-palette-workspace-empty",children:je.error}):a?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"af-palette-workspace-group",children:[l.jsxs("div",{className:"af-palette-workspace-group-head",children:[l.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"folder"}),l.jsx("span",{children:a.id}),l.jsxs("span",{className:"af-palette-workspace-count",children:["(",je.files.length,")"]})]}),je.files.length>0?l.jsx("ul",{className:"af-palette-workspace-list",children:je.files.filter(x=>x.type==="file").map(x=>l.jsxs("li",{className:"af-palette-workspace-item af-palette-workspace-item--clickable",title:x.path,onClick:()=>I({filePath:x.path,fileName:x.name}),children:[l.jsx("span",{className:"material-symbols-outlined af-palette-workspace-item-icon","aria-hidden":!0,children:x.icon}),l.jsx("span",{className:"af-palette-workspace-item-label",children:x.name}),x.size!=null&&l.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))}):je.files.filter(x=>x.type==="directory").length===0?l.jsx("div",{className:"af-palette-workspace-empty",children:"暂无文件"}):null]}),je.files.filter(x=>{var j;return x.type==="directory"&&((j=x.children)==null?void 0:j.length)>0}).map(x=>l.jsxs("div",{className:"af-palette-workspace-group af-palette-workspace-group--sub",children:[l.jsxs("div",{className:"af-palette-workspace-group-head",children:[l.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:x.icon}),l.jsxs("span",{children:[x.name,"/"]}),l.jsxs("span",{className:"af-palette-workspace-count",children:["(",x.children.length,")"]})]}),l.jsx("ul",{className:"af-palette-workspace-list",children:x.children.map(j=>l.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:[l.jsx("span",{className:"material-symbols-outlined af-palette-workspace-item-icon","aria-hidden":!0,children:j.icon}),l.jsx("span",{className:"af-palette-workspace-item-label",children:j.name}),j.type==="file"&&j.size!=null&&l.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))]}):l.jsx("div",{className:"af-palette-workspace-empty",children:e("flow:palette2.noPipelineSelected")})})]}),l.jsxs("div",{className:"af-node-palette-head",children:[l.jsx("h2",{className:"af-node-palette-title",children:"Node Palette"}),l.jsxs("label",{className:"af-palette-search-wrap",children:[l.jsx("span",{className:"af-visually-hidden",children:e("flow:palette.searchNodes")}),l.jsx("span",{className:"af-palette-search-icon material-symbols-outlined","aria-hidden":!0,children:"search"}),l.jsx("input",{type:"search",className:"af-palette-search-input",value:re,onChange:x=>de(x.target.value),placeholder:e("flow:palette.searchNodes")+"…","aria-label":e("flow:palette.searchNodes")})]})]}),s?l.jsx("p",{className:"af-err af-palette-list-err",children:s}):null,l.jsxs("div",{className:"af-node-palette-scroll",children:[Od.filter(x=>Bu[x].length>0).map(x=>l.jsxs("section",{className:`af-palette-section af-flow-palette-section--${x}`,children:[l.jsx("h3",{className:"af-palette-cat",children:x}),l.jsx("div",{className:"af-palette-cards",children:Bu[x].map(j=>{const D=eS(j.inputs,"input"),z=eS(j.outputs,"output"),V=Y9(j),Y=K9(j);return l.jsxs("button",{type:"button",className:"af-palette-card",onClick:()=>Yw(j),draggable:!!a,onDragStart:J=>{J.dataTransfer.setData("application/agentflow-node",j.id),J.dataTransfer.effectAllowed="move"},disabled:!a,title:V||j.id,children:[l.jsxs("span",{className:"af-palette-card-head",children:[l.jsx("span",{className:"af-palette-card-icon","aria-hidden":!0,children:l.jsx("span",{className:"material-symbols-outlined",children:q9(x)})}),l.jsxs("span",{className:"af-palette-card-main",children:[l.jsx("span",{className:"af-palette-card-label",children:Y}),Y!==j.id?l.jsx("span",{className:"af-palette-card-id",children:j.id}):null]})]}),V?l.jsx("span",{className:"af-palette-card-desc",children:V}):null,l.jsxs("span",{className:"af-palette-card-ports","aria-hidden":!0,children:[l.jsxs("span",{className:"af-palette-card-port-side af-palette-card-port-side--in",children:[l.jsxs("span",{className:"af-palette-card-port-count",children:[D.list.length," IN"]}),l.jsxs("span",{className:"af-palette-card-port-list",children:[D.shown.map((J,ne)=>l.jsxs("span",{className:"af-palette-card-port",title:Zk("input",J,ne),children:[l.jsx("span",{className:"af-palette-card-port-dot",style:{background:yi(J==null?void 0:J.type)}}),l.jsx("span",{className:"af-palette-card-port-name",children:Qk(J,ne)})]},`in-${ne}`)),D.hidden>0?l.jsxs("span",{className:"af-palette-card-port-more",children:["+",D.hidden]}):null]})]}),l.jsxs("span",{className:"af-palette-card-port-side af-palette-card-port-side--out",children:[l.jsxs("span",{className:"af-palette-card-port-count",children:[z.list.length," OUT"]}),l.jsxs("span",{className:"af-palette-card-port-list",children:[z.shown.map((J,ne)=>l.jsxs("span",{className:"af-palette-card-port",title:Zk("output",J,ne),children:[l.jsx("span",{className:"af-palette-card-port-name",children:Qk(J,ne)}),l.jsx("span",{className:"af-palette-card-port-dot",style:{background:yi(J==null?void 0:J.type)}})]},`out-${ne}`)),z.hidden>0?l.jsxs("span",{className:"af-palette-card-port-more",children:["+",z.hidden]}):null]})]})]})]},j.id)})})]},x)),a&&X.length===0?l.jsx("p",{className:"af-palette-empty",children:e("flow:palette.noComponents")}):null,a&&X.length>0&&re.trim()&&uI===0?l.jsx("p",{className:"af-palette-empty",children:e("flow:palette.noMatch")}):null,a?null:l.jsx("p",{className:"af-palette-empty",children:e("flow:palette.selectPipeline")})]}),l.jsxs("footer",{className:"af-palette-engine",children:[l.jsxs("div",{className:"af-palette-engine-head",children:[l.jsx("span",{className:"af-palette-engine-dot"+(Et?"":" af-palette-engine-dot--offline"),"aria-hidden":!0}),l.jsx("span",{className:"af-palette-engine-label",children:e(Et?"common:engine.online":"common:engine.offline")})]}),b?l.jsx("div",{className:"af-palette-tip"+pI,role:"status","aria-live":"polite",children:b}):null]})]}):pe!=="edit"&&a?l.jsx(O9,{flowId:a.id,flowSource:a.source||"user",flowArchived:a.archived,provideNodes:Sr,edges:Bt,nodes:tt,onCliInputsChange:Wi,onBackToEdit:Hs}):null,l.jsxs("div",{className:"af-pipeline-main-stack",children:[l.jsxs("div",{className:"af-pipeline-canvas-col",children:[h?l.jsx("div",{className:"af-banner af-banner--err af-pipeline-banner",children:h}):null,a&&Jr.length>0&&!T?l.jsxs("div",{className:"af-banner af-banner--warn af-flow-slot-warnings",role:"region","aria-label":e("flow:validation.flowWarningAriaLabel"),children:[l.jsxs("div",{className:"af-flow-slot-warnings-head",children:[l.jsx("div",{className:"af-flow-slot-warnings-title",children:e("flow:palette.validationWarnings")}),l.jsxs("div",{className:"af-flow-slot-warnings-head-actions",children:[l.jsx("button",{type:"button",className:"af-icon-btn",disabled:q,"aria-label":e("flow:validation.reloadFromServer"),title:e("flow:validation.reloadFromServerShort"),onClick:()=>void Kw(),children:l.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"refresh"})}),l.jsx("button",{type:"button",className:"af-icon-btn","aria-label":e("flow:validation.closeBanner"),title:e("common:common.close"),onClick:()=>E(!0),children:l.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]})]}),l.jsx("ul",{className:"af-flow-slot-warnings-list",children:Jr.map(x=>l.jsxs("li",{children:[e("flow:validation.nodePrefix"),' "',l.jsx("a",{href:"#",className:"af-flow-slot-warning-node-link","aria-label":e("flow:validation.focusNodeAriaLabel",{nodeId:x.nodeId}),onClick:j=>{j.preventDefault(),wI(x.nodeId)},children:x.nodeId}),'"',x.suffix]},x.key))})]}):null,a&&Jr.length>0&&T?l.jsxs("div",{className:"af-banner af-banner--warn af-flow-slot-warnings af-flow-slot-warnings--collapsed",role:"status","aria-live":"polite",children:[l.jsx("span",{className:"af-flow-slot-warnings-collapsed-text",children:e("flow:validation.slotWarningCount",{count:Jr.length})}),l.jsxs("button",{type:"button",className:"af-flow-slot-warnings-kbd-hint",onClick:nv,title:e("flow:validation.shortcutHint"),children:[l.jsx("kbd",{children:"?"})," ",e("flow:validation.shortcutHintLabel")]}),l.jsxs("div",{className:"af-flow-slot-warnings-collapsed-actions",children:[l.jsx("button",{type:"button",className:"af-flow-slot-warnings-collapsed-btn",onClick:()=>E(!1),children:e("flow:validation.show")}),l.jsx("button",{type:"button",className:"af-flow-slot-warnings-collapsed-btn",disabled:q,onClick:()=>void Kw(),children:e("common:common.refresh")})]})]}):null,Ge==="settings"&&a&&pe==="edit"?BI():l.jsx("div",{className:"af-react-flow-wrap af-pipeline-flow",children:a?l.jsx(dU,{fitViewEpoch:u,canvasTool:G_,nodes:oI,edges:aI,onNodesChange:pe!=="edit"?void 0:iI,onEdgesChange:pe!=="edit"?void 0:sI,onConnect:pe!=="edit"?void 0:gI,onNodesDelete:pe!=="edit"?void 0:yI,onNodeClick:hI,onEdgeClick:mI,onFlowInit:xI,onDrop:kI,onDragOver:bI,hideMinimapAndControls:!!(a&&Ge),bottomSlot:pe==="edit"?l.jsx("div",{className:"af-bottom-composer-stack af-flow-bottom-composer",children:l.jsxs("div",{className:"af-pipeline-composer-inner",children:[l.jsx("div",{className:"af-composer-selected","aria-label":e("flow:composer.selectedNodesAriaLabel"),children:Qu.length===0?l.jsx("span",{className:"af-composer-selected-empty",children:e("flow:composer.selectedNodesEmpty")}):Qu.map((x,j)=>{var ue,le;if(x.kind==="definition"){const Ce=x.definition,ee=String(Ce.label??Ce.id),ge=[Ce.id,Ce.description?String(Ce.description).slice(0,120):""].filter(Boolean).join(" — ");return l.jsxs("div",{className:"af-composer-node-chip af-composer-node-chip--definition",title:ge,children:[l.jsx("span",{className:"af-composer-node-chip-label",children:ee}),l.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>tv(x),"aria-label":e("flow:composer.removeFromInput",{id:Ce.id}),children:l.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},`def-${Ce.id}`)}const D=x.node,z=x.kind,V=String(((ue=D.data)==null?void 0:ue.label)??D.id),Y=(le=D.data)!=null&&le.definitionId?String(D.data.definitionId):"",J=Y&&Y!==V?`${V} · ${D.id} · ${Y}`:`${V} · ${D.id}`,ne=z==="canvas"?e("flow:composer.deselectNode",{id:D.id}):e("flow:composer.removeFromInput",{id:D.id});return l.jsxs("div",{className:"af-composer-node-chip"+(z==="mention"?" af-composer-node-chip--mention":""),title:J,children:[l.jsx("span",{className:"af-composer-node-chip-label",children:V}),l.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>tv(x),"aria-label":ne,children:l.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},D.id)})}),l.jsxs("div",{className:"af-composer-card af-composer-card--input-only",children:[l.jsxs("div",{className:"af-composer-input-wrap",children:[l.jsx("textarea",{ref:sh,className:"af-composer-textarea",placeholder:e("flow:composer.inputPlaceholder"),disabled:!a,value:cr,rows:2,onChange:x=>{ol(x.target.value),al(x.target.selectionStart??x.target.value.length)},onSelect:x=>{const j=x.target;j instanceof HTMLTextAreaElement&&al(j.selectionStart??0)},onKeyDown:x=>{if((x.metaKey||x.ctrlKey)&&x.key==="Enter"){x.preventDefault(),Us();return}if(kl&&Nr.length>0&&(x.key==="ArrowDown"||x.key==="ArrowUp"||x.key==="Enter")){if(x.key==="ArrowDown")x.preventDefault(),cl(j=>(j+1)%Nr.length);else if(x.key==="ArrowUp")x.preventDefault(),cl(j=>(j-1+Nr.length)%Nr.length);else if(x.key==="Enter"){x.preventDefault();const j=Nr[ll];j&&jh(j.id)}}},onKeyUp:x=>{const j=x.target;j instanceof HTMLTextAreaElement&&al(j.selectionStart??j.value.length)},onClick:x=>{const j=x.target;j instanceof HTMLTextAreaElement&&al(j.selectionStart??0)},"aria-label":e("flow:composer.inputAriaLabel"),autoComplete:"off",spellCheck:!1}),kl&&a&&Nr.length>0?l.jsxs("ul",{className:"af-composer-mention-menu",role:"listbox","aria-label":e("flow:composer.mentionAriaLabel"),children:[Sl.instances.length>0?l.jsx("li",{className:"af-composer-mention-section",role:"presentation",children:l.jsx("div",{className:"af-composer-mention-section-title",children:"Instances"})}):null,Sl.instances.map((x,j)=>{const D=j;return l.jsx("li",{role:"option","aria-selected":D===ll,children:l.jsxs("button",{type:"button",className:"af-composer-mention-item"+(D===ll?" af-composer-mention-item--active":""),onMouseDown:z=>z.preventDefault(),onMouseEnter:()=>cl(D),onClick:()=>jh(x.id),children:[l.jsx("span",{className:"af-composer-mention-id",children:x.title}),x.subtitle?l.jsx("span",{className:"af-composer-mention-sub",children:x.subtitle}):null]})},`i-${x.id}`)}),Sl.definitions.length>0?l.jsx("li",{className:"af-composer-mention-section",role:"presentation",children:l.jsx("div",{className:"af-composer-mention-section-title",children:"Node"})}):null,Sl.definitions.map((x,j)=>{const D=Sl.instances.length+j;return l.jsx("li",{role:"option","aria-selected":D===ll,children:l.jsxs("button",{type:"button",className:"af-composer-mention-item"+(D===ll?" af-composer-mention-item--active":""),onMouseDown:z=>z.preventDefault(),onMouseEnter:()=>cl(D),onClick:()=>jh(x.id),children:[l.jsx("span",{className:"af-composer-mention-id",children:x.title}),x.subtitle?l.jsx("span",{className:"af-composer-mention-sub",children:x.subtitle}):null]})},`d-${x.id}`)})]}):null]}),l.jsxs("div",{className:"af-composer-toolbar",children:[kr.length>0&&l.jsx("label",{className:"af-composer-session-field",children:l.jsxs("select",{className:"af-composer-session-select",value:yn||"",onChange:x=>{x.target.value==="__new__"?Mw():Bw(x.target.value)},disabled:Dt,"aria-label":e("flow:composer.switchConversation"),children:[kr.map(x=>l.jsxs("option",{value:x.id,children:[x.label,x.running?" ⏳":""]},x.id)),l.jsxs("option",{value:"__new__",children:["+ ",e("flow:composer.newConversation")]})]})}),l.jsxs("div",{className:"af-composer-skills-field",children:[l.jsxs("button",{ref:dh,type:"button",className:"af-composer-skills-button"+(Nh>0?" af-composer-skills-button--active":""),disabled:!a||Dt,"aria-haspopup":"listbox","aria-expanded":Au,onClick:()=>uh(x=>!x),children:[l.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"extension"}),l.jsx("span",{children:Nh>0?`Skills ${Nh}`:"Skills"})]}),Au&&!Dt?Tr.createPortal(l.jsx("div",{ref:Aw,className:"af-composer-skills-menu",role:"listbox","aria-label":"Composer skills",style:tI,children:ch.length===0?l.jsx("div",{className:"af-composer-skills-empty",children:"No skills found"}):DI.map(x=>l.jsxs("div",{className:"af-composer-skill-group",children:[l.jsxs("div",{className:"af-composer-skill-group-title",children:[l.jsx("span",{children:x.label}),l.jsx("span",{children:x.skills.length})]}),x.skills.map(j=>l.jsxs("label",{className:"af-composer-skill-option",children:[l.jsx("input",{type:"checkbox",checked:MI.has(j.key),onChange:D=>{const z=D.target.checked;Iw(V=>z?V.includes(j.key)?V:[...V,j.key]:V.filter(Y=>Y!==j.key))}}),l.jsxs("span",{className:"af-composer-skill-option-main",children:[l.jsx("span",{className:"af-composer-skill-option-title",children:j.name}),j.description?l.jsx("span",{className:"af-composer-skill-option-desc",children:j.description}):null]})]},j.key))]},x.label))}),document.body):null]}),l.jsxs("label",{className:"af-composer-model-field",children:[l.jsx("span",{className:"af-visually-hidden",children:e("flow:composer.modelLabel")}),l.jsxs("select",{className:"af-composer-model-select",value:(zs||"").trim()?Mn.currentNotInLists?Mn.currentNotInLists:Dd(zs,Mn.cursorList,Mn.opencodeList,Mn.claudeCodeList):"",onChange:x=>_w(x.target.value),disabled:!a||Dt,"aria-label":e("flow:composer.modelAriaLabel"),children:[l.jsx("option",{value:"",children:e("flow:composer.modelDefault")}),Mn.currentNotInLists?l.jsxs("option",{value:Mn.currentNotInLists,children:[Mn.currentNotInLists,e("flow:composer.modelNotInList")]}):null,Mn.cursorList.length>0?l.jsx("optgroup",{label:"Cursor",children:Mn.cursorList.map(x=>l.jsx("option",{value:Pi(x),children:x},`composer-c-${x}`))}):null,Mn.opencodeList.length>0?l.jsx("optgroup",{label:"OpenCode",children:Mn.opencodeList.map(x=>l.jsx("option",{value:`opencode:${Pi(x)}`,children:x},`composer-o-${x}`))}):null,Mn.claudeCodeList.length>0?l.jsx("optgroup",{label:"Claude Code",children:Mn.claudeCodeList.map(x=>l.jsx("option",{value:`claude-code:${Pi(x)}`,children:x},`composer-cc-${x}`))}):null]})]}),l.jsx("button",{type:"button",className:"af-composer-send"+(a&&cr.trim()&&!Dt?" af-composer-send--active":"")+(Dt?" af-composer-send--stop":""),disabled:!a||!Dt&&!cr.trim(),"aria-label":e(Dt?"flow:composer.stopGeneration":"flow:composer.send"),title:Dt?e("flow:composer.stopGeneration"):void 0,onClick:()=>{var x;if(Dt){(x=Du.current)==null||x.abort();return}Us()},children:l.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:Dt?"stop":"arrow_upward"})})]})]}),ph?Tr.createPortal(l.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&&Mu(!1)},children:l.jsxs("div",{className:"af-node-props-expand-panel af-composer-thread-dialog-panel",children:[l.jsxs("div",{className:"af-node-props-expand-head af-composer-thread-dialog-head",children:[l.jsxs("div",{className:"af-composer-thread-dialog-head-main",children:[l.jsx("span",{className:"af-node-props-expand-title",children:e("flow:nodeProps.conversationOutput")}),l.jsx("div",{className:"af-composer-thread-dialog-status"+(Dt?" af-composer-thread-dialog-status--running":""),role:"status","aria-live":"polite",title:pl||void 0,children:Dt&&!pl?e("flow:composer.executing"):pl||e("flow:composer.ready")})]}),l.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>Mu(!1),"aria-label":e("flow:composer.collapseAriaLabel"),children:l.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),Rw.length>1&&!(Ke&&Array.isArray(Ke.phases)&&Ke.phases.length>1)?l.jsx("div",{className:"af-composer-steps-track-wrap",children:l.jsx(Z9,{steps:Rw})}):null,Ke&&Array.isArray(Ke.phases)&&Ke.phases.length>1?l.jsx("div",{className:"af-composer-phase-bar","aria-label":e("flow:composer.phaseProgress"),children:Ke.phases.map((x,j)=>{const D=x.status||(j<(Ke.currentPhase??0)?"done":j===(Ke.currentPhase??0)?Dt?"running":Ke.nextPhase||Ke.isLastPhase?"done":"running":"pending");return l.jsxs("div",{className:"af-composer-phase-item"+(D==="done"?" af-composer-phase-item--done":"")+(D==="running"?" af-composer-phase-item--running":"")+(D==="pending"?" af-composer-phase-item--pending":""),title:`${x.label}${x.description?":"+x.description:""}`,children:[l.jsx("span",{className:"af-composer-phase-dot","aria-hidden":!0,children:D==="done"?l.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"0.85rem"},children:"check"}):l.jsx("span",{children:j+1})}),l.jsx("span",{className:"af-composer-phase-label",children:x.label})]},x.name||j)})}):null,l.jsx("div",{className:"af-composer-thread-dialog-scroll",children:l.jsx(nS,{thread:ml,liveSegments:hl,running:Dt})}),Ke&&!Ke.isLastPhase&&Ke.nextPhase&&!Dt?l.jsxs("div",{className:"af-composer-phase-review af-composer-phase-review--minimal","aria-label":e("flow:composer.phaseReviewLabel"),children:[l.jsx("span",{className:"af-composer-phase-auto-hint",children:e("flow:composer.phaseReviewHint",{nextPhase:Ke.nextPhase.label})}),l.jsxs("div",{className:"af-composer-phase-review-buttons",children:[l.jsx("button",{type:"button",className:"af-composer-phase-btn af-composer-phase-btn--continue",onClick:ev,children:e("flow:composer.phaseReviewContinue",{label:Ke.nextPhase.label})}),l.jsx("button",{type:"button",className:"af-composer-phase-btn af-composer-phase-btn--skip",onClick:Zw,children:e("flow:composer.phaseReviewSkip")})]})]}):null]})}),document.body):null]})}):null}):l.jsx("div",{className:"af-placeholder af-pipeline-placeholder",children:e("flow:pipeline.selectPipeline")})})]}),pe!=="edit"&&Gn&&l.jsxs("div",{className:"af-run-console",style:{height:Pe},children:[l.jsx("div",{className:"af-run-console__resize",role:"separator","aria-orientation":"horizontal","aria-label":e("flow:run.resizeConsole"),onPointerDown:CI,onPointerMove:EI,onPointerUp:Xw,onPointerCancel:Xw,onLostPointerCapture:PI}),l.jsxs("div",{className:"af-run-console__head",children:[l.jsxs("span",{className:"af-run-console__title",children:[l.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"terminal"}),"EXECUTION CONSOLE"]}),l.jsxs("div",{className:"af-run-console__head-right",children:[pe==="running"&&l.jsx("span",{className:"af-run-console__live-badge",children:"LIVE"}),l.jsx("button",{type:"button",className:"af-icon-btn af-run-console__close",onClick:()=>G(!1),"aria-label":e("flow:run.closeLog"),children:l.jsx("span",{className:"material-symbols-outlined",children:"expand_more"})})]})]}),l.jsxs("div",{className:"af-run-console__body",children:[Pt.map((x,j)=>l.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:[l.jsxs("span",{className:"af-run-console__ts",children:["[",x.ts?new Date(x.ts).toLocaleTimeString():"--:--:--","]"]}),l.jsx("span",{className:"af-run-console__text",children:x.text!=null?String(x.text):""})]},j)),l.jsx("div",{ref:Ms})]})]})]}),pe!=="edit"&>&&a?l.jsx(A9,{instanceId:gt,flowId:a.id,runId:Me,nodeStatus:((rv=Vr[gt])==null?void 0:rv.status)??null,onClose:()=>Tt(null)}):null,Ge&&Ge!=="settings"&&a&&pe==="edit"?l.jsx("aside",{className:"af-pipeline-drawer"+(Ge==="node"?" af-pipeline-drawer--wide":"")+(Ge==="composer"?" af-pipeline-drawer--wide":""),"aria-label":Ge==="settings"?e("flow:settings.title"):Ge==="history"?e("flow:history.title"):Ge==="composer"?"AI Composer":e("flow:nodeProps.title"),children:Ge==="composer"?l.jsxs("div",{className:"af-composer-sidebar",children:[l.jsxs("div",{className:"af-pipeline-drawer-head",children:[l.jsx("h2",{className:"af-pipeline-drawer-title",children:"AI Composer"}),l.jsx("button",{type:"button",className:"af-pipeline-drawer-close af-icon-btn",onClick:Nl,"aria-label":e("flow:composer.closeSidebar"),children:l.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),kr.length>0&&l.jsxs("div",{className:"af-composer-session-tabs",children:[kr.map(x=>l.jsxs("button",{type:"button",ref:j=>{j&&x.id===yn&&j.scrollIntoView({block:"nearest",inline:"nearest"})},className:["af-composer-session-tab",x.id===yn?"af-composer-session-tab--active":"",x.running?"af-composer-session-tab--running":""].filter(Boolean).join(" "),onClick:()=>Bw(x.id),title:x.label,children:[l.jsx("span",{className:"af-composer-session-label",children:x.label}),l.jsx("span",{className:"af-composer-session-close",role:"button",tabIndex:0,onClick:j=>{j.stopPropagation(),Dw(x.id)},onKeyDown:j=>{j.key!=="Enter"&&j.key!==" "||(j.preventDefault(),j.stopPropagation(),Dw(x.id))},title:x.running?e("flow:composer.endConversation"):e("flow:composer.closeConversation"),children:l.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"0.75rem"},children:"close"})})]},x.id)),l.jsx("button",{type:"button",className:"af-composer-session-add",onClick:()=>Mw(),title:e("flow:composer.newConversation"),children:l.jsx("span",{className:"material-symbols-outlined",children:"add"})})]}),l.jsx("div",{className:"af-composer-sidebar-status"+(Dt?" af-composer-sidebar-status--running":""),role:"status","aria-live":"polite",children:Dt&&!pl?e("flow:composer.executing"):pl||e("flow:composer.ready")}),Ke&&Array.isArray(Ke.phases)&&Ke.phases.length>1?l.jsx("div",{className:"af-composer-phase-bar","aria-label":e("flow:composer.phaseProgress"),children:Ke.phases.map((x,j)=>{const D=x.status||(j<(Ke.currentPhase??0)?"done":j===(Ke.currentPhase??0)?Dt?"running":Ke.isLastPhase&&j===Ke.phases.length-1||Ke.nextPhase?"done":"running":"pending");return l.jsxs("div",{className:"af-composer-phase-item"+(D==="done"?" af-composer-phase-item--done":"")+(D==="running"?" af-composer-phase-item--running":"")+(D==="pending"?" af-composer-phase-item--pending":""),title:`${x.label}${x.description?":"+x.description:""}`,children:[l.jsx("span",{className:"af-composer-phase-dot","aria-hidden":!0,children:D==="done"?l.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"0.85rem"},children:"check"}):l.jsx("span",{children:j+1})}),l.jsx("span",{className:"af-composer-phase-label",children:x.label})]},x.name||j)})}):null,l.jsx("div",{className:"af-composer-sidebar-thread",ref:Ow,children:l.jsx(nS,{thread:ml,liveSegments:hl,running:Dt})}),Ke&&!Ke.isLastPhase&&Ke.nextPhase&&!Dt?l.jsxs("div",{className:"af-composer-phase-review af-composer-phase-review--minimal","aria-label":e("flow:composer.phaseReviewLabel"),children:[l.jsx("span",{className:"af-composer-phase-auto-hint",children:e("flow:composer.phaseReviewHint",{nextPhase:Ke.nextPhase.label})}),l.jsxs("div",{className:"af-composer-phase-review-buttons",children:[l.jsx("button",{type:"button",className:"af-composer-phase-btn af-composer-phase-btn--continue",onClick:ev,children:e("flow:composer.phaseReviewContinue",{label:Ke.nextPhase.label})}),l.jsx("button",{type:"button",className:"af-composer-phase-btn af-composer-phase-btn--skip",onClick:Zw,children:e("flow:composer.phaseReviewSkip")})]})]}):null]}):Ge==="node"&&Be?Xe?l.jsx(E9,{draft:Xe,setDraft:ah,definitionId:String(((iv=Be.data)==null?void 0:iv.definitionId)??Be.id),systemPromptReadonly:String((yh==null?void 0:yh.description)??""),modelLists:Ue,disabled:!a,onIdBlur:jI,onClose:Nl,onPublishToMarketplace:fI,error:Q_,ioSlots:{inputs:Array.isArray(Xe==null?void 0:Xe.inputs)?Xe.inputs:[],outputs:Array.isArray(Xe==null?void 0:Xe.outputs)?Xe.outputs:[]}}):l.jsx("div",{className:"af-pipeline-drawer-body",children:l.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:pipeline.loadingProps")})}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"af-pipeline-drawer-head",children:[l.jsx("h2",{className:"af-pipeline-drawer-title",children:e(Ge==="settings"?"flow:settings.title":"flow:history.title")}),l.jsx("button",{type:"button",className:"af-pipeline-drawer-close af-icon-btn",onClick:Nl,"aria-label":e("flow:composer.closeSidebar"),children:l.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),l.jsx("div",{className:"af-pipeline-drawer-body",children:Ge==="settings"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"af-pipeline-drawer-field",children:[l.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.pipelineId")}),(a.source==="user"||a.source==="workspace")&&!a.archived?l.jsxs("div",{className:"af-pipeline-rename-row",children:[l.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:C,onChange:x=>{S(x.target.value),H("")},onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),qu())},onBlur:()=>{C.trim()&&C.trim()!==a.id&&qu()},placeholder:a.id,disabled:P,spellCheck:!1}),l.jsx("span",{className:"af-pipeline-drawer-badge",children:Bo(a.source??"user",e)})]}):l.jsxs("div",{className:"af-pipeline-drawer-readonly",children:[a.id,l.jsx("span",{className:"af-pipeline-drawer-badge",children:Bo(a.source??"user",e)}),a.archived?l.jsx("span",{className:"af-pipeline-drawer-badge af-pipeline-drawer-badge--muted",children:e("flow:settings.archived")}):null]}),M?l.jsx("p",{className:"af-err af-pipeline-drawer-err",children:M}):null]}),typeof a.path=="string"&&a.path?l.jsxs("div",{className:"af-pipeline-drawer-field",children:[l.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.diskPath")}),l.jsxs("div",{className:"af-pipeline-drawer-readonly af-pipeline-drawer-readonly--mono af-pipeline-path-row",children:[l.jsx("span",{className:"af-pipeline-path-text",children:a.path}),l.jsx("button",{type:"button",className:"af-icon-btn af-pipeline-copy-btn",onClick:()=>qw(a.path),title:e("flow:settings.copyPath"),children:l.jsx("span",{className:"material-symbols-outlined",children:_?"check":"content_copy"})})]})]}):null,a.source==="user"||a.source==="workspace"?a.archived?l.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.archivedNote")}):l.jsxs("div",{className:"af-pipeline-drawer-field",children:[l.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.storageLocation")}),l.jsx("div",{className:"af-pipeline-move-actions",children:a.source==="user"?l.jsx("button",{type:"button",className:"af-btn-secondary",disabled:w,onClick:()=>Yu("workspace"),children:e(w?"flow:settings.moveBusy":"flow:settings.moveToWorkspace")}):l.jsx("button",{type:"button",className:"af-btn-secondary",disabled:w,onClick:()=>Yu("user"),children:e(w?"flow:settings.moveBusy":"flow:settings.moveToUserDir")})}),y?l.jsx("p",{className:"af-err af-pipeline-drawer-err",children:y}):null]}):l.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.builtinNote")}),l.jsxs("label",{className:"af-pipeline-drawer-field",children:[l.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.introduction")}),l.jsx("textarea",{className:"af-pipeline-drawer-textarea",value:d,onChange:x=>f(x.target.value),placeholder:e("flow:pipeline.introductionPlaceholder"),rows:5,spellCheck:!1})]}),l.jsxs("div",{className:"af-pipeline-meta-card",children:[l.jsx("h3",{className:"af-pipeline-meta-title",children:e("flow:schedule.title")}),bu?l.jsx("p",{className:"af-pipeline-drawer-muted",children:e("common:common.loading")}):l.jsxs(l.Fragment,{children:[l.jsxs("label",{className:"af-new-pipeline-radio",children:[l.jsx("input",{type:"checkbox",checked:!!Gt.enabled,disabled:br||a.archived||a.source==="builtin",onChange:x=>Xi(j=>({...j,enabled:x.target.checked}))}),l.jsx("span",{children:e("flow:schedule.enabled")})]}),l.jsxs("label",{className:"af-pipeline-drawer-field",children:[l.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.cron")}),l.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:Gt.cron||"",disabled:br||a.archived||a.source==="builtin",onChange:x=>Xi(j=>({...j,cron:x.target.value})),placeholder:"0 9 * * *",spellCheck:!1})]}),l.jsxs("label",{className:"af-pipeline-drawer-field",children:[l.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.timezone")}),l.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:Gt.timezone||"",disabled:br||a.archived||a.source==="builtin",onChange:x=>Xi(j=>({...j,timezone:x.target.value})),placeholder:"Asia/Shanghai",spellCheck:!1})]}),l.jsxs("label",{className:"af-pipeline-drawer-field",children:[l.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.preset")}),l.jsxs("select",{className:"af-pipeline-flow-select",value:Gt.preset||"",disabled:br||a.archived||a.source==="builtin",onChange:x=>Xi(j=>({...j,preset:x.target.value})),children:[l.jsx("option",{value:"",children:e("flow:schedule.defaultPreset")}),Object.keys(vi).map(x=>l.jsx("option",{value:x,children:x},x))]})]}),l.jsx("div",{className:"af-pipeline-drawer-readonly",children:l.jsx("span",{children:e("flow:schedule.overlapSkip")})}),Gt.nextRunAt?l.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.nextRun",{time:new Date(Gt.nextRunAt).toLocaleString()})}):l.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.noNextRun")}),l.jsxs("dl",{className:"af-pipeline-meta-dl",children:[l.jsxs("div",{className:"af-pipeline-meta-row",children:[l.jsx("dt",{children:e("flow:schedule.runtime")}),l.jsx("dd",{children:Rt!=null&&Rt.running?e("flow:schedule.running"):Gt.enabled?e("flow:schedule.waiting"):e("flow:schedule.disabled")})]}),ct.lastTriggeredAt?l.jsxs("div",{className:"af-pipeline-meta-row",children:[l.jsx("dt",{children:e("flow:schedule.lastTriggeredAt")}),l.jsx("dd",{children:new Date(ct.lastTriggeredAt).toLocaleString()})]}):null,ct.lastSkippedAt?l.jsxs("div",{className:"af-pipeline-meta-row",children:[l.jsx("dt",{children:e("flow:schedule.lastSkippedAt")}),l.jsxs("dd",{children:[new Date(ct.lastSkippedAt).toLocaleString(),ct.lastSkipReason?` · ${ct.lastSkipReason}`:""]})]}):null,ct.lastRunUuid?l.jsxs("div",{className:"af-pipeline-meta-row",children:[l.jsx("dt",{children:e("flow:schedule.lastRun")}),l.jsx("dd",{children:ct.lastRunUuid})]}):null,ct.lastExitCode!=null?l.jsxs("div",{className:"af-pipeline-meta-row",children:[l.jsx("dt",{children:e("flow:schedule.lastExit")}),l.jsx("dd",{children:String(ct.lastExitCode)})]}):null,ct.lastFinishedAt?l.jsxs("div",{className:"af-pipeline-meta-row",children:[l.jsx("dt",{children:e("flow:schedule.lastFinishedAt")}),l.jsx("dd",{children:new Date(ct.lastFinishedAt).toLocaleString()})]}):null]}),Rt!=null&&Rt.lastError||ct.lastError?l.jsx("p",{className:"af-err af-pipeline-drawer-err",children:(Rt==null?void 0:Rt.lastError)||ct.lastError}):null,a.archived||a.source==="builtin"?l.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.readonlyNote")}):null,Po?l.jsx("p",{className:"af-err af-pipeline-drawer-err",children:Po}):null,_o?l.jsx("p",{className:"af-pipeline-drawer-muted",children:_o}):null,l.jsx("button",{type:"button",className:"af-btn-secondary",disabled:br||a.archived||a.source==="builtin",onClick:vh,children:e(br?"flow:schedule.saving":"flow:schedule.save")})]})]}),l.jsxs("div",{className:"af-pipeline-meta-card",children:[l.jsx("h3",{className:"af-pipeline-meta-title",children:e("flow:pipeline.metadata")}),l.jsx("dl",{className:"af-pipeline-meta-dl",children:l.jsxs("div",{className:"af-pipeline-meta-row",children:[l.jsx("dt",{children:e("flow:pipeline.nodeCount")}),l.jsxs("dd",{children:[tt.length," ",e("flow:pipeline.nodesUnit")]})]})})]}),l.jsx("button",{type:"button",className:"af-pipeline-drawer-link",onClick:()=>t("/settings"),children:e("flow:settings.globalSettings")})]}):l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:"af-pipeline-drawer-lead",children:[e("flow:settings.currentPipeline"),l.jsx("strong",{children:a.id})]}),pn?l.jsx("p",{className:"af-pipeline-drawer-muted",children:e("common:common.loading")}):Ct?l.jsx("p",{className:"af-err af-pipeline-drawer-err",children:Ct}):bl.length===0?l.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:pipeline.noRuns")}):l.jsxs(l.Fragment,{children:[Pn.success+Pn.failed+Pn.running+Pn.stopped+Pn.interrupted>0?l.jsxs("div",{className:"af-exec-history-summary","aria-label":e("flow:history.summary"),children:[Pn.success>0?l.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--success",children:e("flow:history.successCount",{count:Pn.success})}):null,Pn.failed>0?l.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--failed",children:e("flow:history.failedCount",{count:Pn.failed})}):null,Pn.stopped>0?l.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--stopped",children:e("flow:history.stoppedCount",{count:Pn.stopped})}):null,Pn.interrupted>0?l.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--interrupted",children:e("flow:history.interruptedCount",{count:Pn.interrupted})}):null,Pn.running>0?l.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--running",children:e("flow:history.runningCount",{count:Pn.running})}):null]}):null,l.jsx("ul",{className:"af-exec-history-list",children:bl.map((x,j)=>{const D=x.status||"unknown",z=D==="success"?"af-exec-history-card--success":D==="failed"?"af-exec-history-card--failed":D==="stopped"?"af-exec-history-card--stopped":D==="interrupted"?"af-exec-history-card--interrupted":D==="running"?"af-exec-history-card--running":"af-exec-history-card--unknown",V=e(D==="success"?"flow:history.success":D==="failed"?"flow:history.failed":D==="stopped"?"flow:history.stopped":D==="interrupted"?"flow:history.interrupted":D==="running"?"flow:history.running":"flow:history.unknown"),Y=D==="success"?"check_circle":D==="failed"?"error":D==="stopped"?"stop_circle":D==="interrupted"?"sync_disabled":D==="running"?"progress_activity":"help",J=x.runId||`${x.at}-${j}`,ne=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:bl.length-j});return l.jsx("li",{className:"af-exec-history-list-item",children:l.jsxs("button",{type:"button",className:`af-exec-history-card ${z}`,onClick:()=>OI(x),title:e("flow:history.enterRunView"),children:[l.jsxs("div",{className:"af-exec-history-card-top",children:[l.jsx("span",{className:"af-exec-history-card-title",children:ne}),l.jsx("span",{className:"af-exec-history-card-time",children:Dg(x.at,e)})]}),l.jsxs("div",{className:"af-exec-history-card-bottom",children:[l.jsxs("span",{className:"af-exec-history-card-status",children:[l.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:Y}),V]}),l.jsxs("span",{className:"af-exec-history-card-duration",children:[l.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"timer"}),UT(x.durationMs,e)]})]})]})},`${a.id}-${J}`)})})]})]})})]})}):null]}),l.jsx(Ok,{open:_I,title:e("flow:run.pauseTitle",{defaultValue:"暂停运行"}),message:e("flow:run.pauseConfirm"),confirmLabel:e("flow:run.pauseConfirmOk",{defaultValue:"暂停"}),onConfirm:AI,onCancel:()=>Sh(!1)}),l.jsx(Ok,{open:TI,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:LI,onSecondary:RI,onCancel:()=>Ju(!1)}),l.jsx(f9,{open:_u,onClose:()=>ul(!1)}),HI(),l.jsx(h9,{open:ih,onClose:()=>Pw(!1),onJump:vI,nodes:tt}),l.jsx(B9,{open:Q,onClose:()=>te(!1),flowId:(a==null?void 0:a.id)??""}),l.jsx(c9,{open:U,onClose:()=>L(!1),flowId:(a==null?void 0:a.id)??"",flowSource:(a==null?void 0:a.source)??"user",onArchived:async()=>{L(!1),await Uu(),t("/projects?tab=archived")}}),l.jsx(u9,{open:B&&!!(a!=null&&a.id),onClose:()=>$(!1),flowId:(a==null?void 0:a.id)??"",flowSource:(a==null?void 0:a.source)??"user",flowArchived:!!(a!=null&&a.archived),onDeleted:async()=>{$(!1),c(null),st([]),Zt([]),yl(null),await Uu(),t("/projects")}}),l.jsx(m9,{open:!!F,onClose:()=>I(null),flowId:(a==null?void 0:a.id)??"",flowSource:(a==null?void 0:a.source)??"user",flowArchived:!!(a!=null&&a.archived),filePath:(F==null?void 0:F.filePath)??"",fileName:(F==null?void 0:F.fileName)??"",onSaved:()=>{$e(x=>({...x}))}})]}),Vt&&pe!=="edit"&&Tr.createPortal(l.jsx("div",{className:"af-user-check-modal-overlay",children:l.jsxs("div",{className:"af-user-check-modal",role:"dialog","aria-modal":"true",children:[l.jsxs("div",{className:"af-user-check-modal__head",children:[l.jsxs("span",{className:"af-user-check-modal__title",children:[l.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"fact_check"}),e("flow:userCheck.title",{instanceId:Vt.instanceId})]}),l.jsx("div",{className:"af-user-check-modal__actions",children:Nw?l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",className:"af-user-check-modal__btn af-user-check-modal__btn--save",onClick:async()=>{if(!Vt||!a||!Me)return;const x=$s||Vt.content;try{(await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:a.id,flowSource:a.source??"user",action:"save-user-check-content",runUuid:Me,instanceId:Vt.instanceId,content:x})})).ok?(Ao(D=>D&&{...D,content:x}),il(!1),Oe(D=>[...D,{ts:new Date().toISOString(),type:"info",text:e("flow:userCheck.contentSaved")}])):Oe(D=>[...D,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}catch{Oe(j=>[...j,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}},children:[l.jsx("span",{className:"material-symbols-outlined",children:"save"}),e("flow:userCheck.save")]}),l.jsxs("button",{type:"button",className:"af-user-check-modal__btn",onClick:()=>{Fs(Vt.content),il(!1)},children:[l.jsx("span",{className:"material-symbols-outlined",children:"close"}),e("flow:userCheck.cancel")]})]}):l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",className:"af-user-check-modal__btn",onClick:()=>il(!0),children:[l.jsx("span",{className:"material-symbols-outlined",children:"edit"}),e("flow:userCheck.edit")]}),l.jsx("button",{type:"button",className:"af-user-check-modal__btn",onClick:()=>Ao(null),children:l.jsx("span",{className:"material-symbols-outlined",children:"close"})})]})})]}),l.jsx("div",{className:"af-user-check-modal__body",children:Nw?l.jsx("textarea",{ref:q_,className:"af-user-check-modal__textarea",value:$s||Vt.content,onChange:x=>Fs(x.target.value)}):l.jsx("div",{className:"af-user-check-modal__preview",children:l.jsx("pre",{children:$s||Vt.content})})}),l.jsxs("div",{className:"af-user-check-modal__ai-bar",children:[l.jsx("input",{type:"text",className:"af-user-check-modal__ai-input",placeholder:e("flow:userCheck.aiEditPlaceholder"),value:Su,onChange:x=>Nu(x.target.value),disabled:Zp}),l.jsxs("button",{type:"button",className:"af-user-check-modal__btn af-user-check-modal__btn--ai",disabled:Zp||!Su.trim(),onClick:()=>{!Vt||!a||!Me||!Su.trim()||(ju(!0),Oe(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:a.id,flowSource:a.source??"user",action:"ai-edit-user-check-content",runUuid:Me,instanceId:Vt.instanceId,content:$s||Vt.content,prompt:Su})}).then(x=>x.json()).then(x=>{ju(!1),x.ok&&x.content?(Fs(x.content),il(!0),Nu(""),Oe(j=>[...j,{ts:new Date().toISOString(),type:"info",text:e("flow:userCheck.aiEditDone")}])):Oe(j=>[...j,{ts:new Date().toISOString(),type:"error",text:x.error||e("flow:userCheck.aiEditFailed")}])}).catch(()=>{ju(!1),Oe(x=>[...x,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.aiEditFailed")}])}))},children:[Zp?l.jsx("span",{className:"material-symbols-outlined af-spin",children:"sync"}):l.jsx("span",{className:"material-symbols-outlined",children:"auto_fix_high"}),e("flow:userCheck.aiEditBtn")]})]}),l.jsxs("div",{className:"af-user-check-modal__foot",children:[l.jsx("span",{className:"af-user-check-modal__hint",children:e("flow:userCheck.hint")}),l.jsxs("button",{type:"button",className:"af-user-check-modal__btn af-user-check-modal__btn--continue",onClick:async()=>{if(!Vt||!a||!Me)return;const x=$s||Vt.content;try{(await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:a.id,flowSource:a.source??"user",action:"save-user-check-content",runUuid:Me,instanceId:Vt.instanceId,content:x})})).ok?(await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:a.id,flowSource:a.source??"user",action:"confirm-user-check",runUuid:Me,instanceId:Vt.instanceId,execId:Vt.execId})}),Ao(null),Nu(""),Zr({runUuid:Me})):Oe(D=>[...D,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}catch{Oe(j=>[...j,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}},children:[l.jsx("span",{className:"material-symbols-outlined",children:"play_arrow"}),e("flow:userCheck.continue")]})]})]})}),document.body),ki&&pe!=="edit"&&Tr.createPortal(l.jsx("div",{className:"af-user-ask-modal-overlay",children:l.jsxs("div",{className:"af-user-ask-modal",role:"dialog","aria-modal":"true",children:[l.jsxs("div",{className:"af-user-ask-modal__head",children:[l.jsxs("span",{className:"af-user-ask-modal__title",children:[l.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"help"}),e("flow:userAsk.title",{instanceId:ki.instanceId})]}),l.jsx("div",{className:"af-user-ask-modal__actions",children:l.jsx("button",{type:"button",className:"af-user-ask-modal__btn",onClick:()=>eh(null),"aria-label":e("flow:userAsk.close"),children:l.jsx("span",{className:"material-symbols-outlined",children:"close"})})})]}),l.jsxs("div",{className:"af-user-ask-modal__body",children:[ki.question.trim()?l.jsx("div",{className:"af-user-ask-modal__question",children:l.jsx("pre",{children:ki.question})}):null,ki.options.length===0?l.jsx("div",{className:"af-user-ask-modal__empty",children:e("flow:userAsk.noOptions")}):l.jsx("div",{className:"af-user-ask-modal__options",children:ki.options.map(x=>l.jsxs("button",{type:"button",className:"af-user-ask-option",disabled:jw,onClick:async()=>{if(!(!ki||!a||!Me)){sl(!0);try{(await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:a.id,flowSource:a.source??"user",action:"confirm-user-ask",runUuid:Me,instanceId:ki.instanceId,execId:ki.execId,branch:x.name,selectedIndex:x.index,selectedLabel:x.label})})).ok?(eh(null),sl(!1),Zr({runUuid:Me})):(sl(!1),Oe(D=>[...D,{ts:new Date().toISOString(),type:"error",text:e("flow:userAsk.submitFailed")}]))}catch{sl(!1),Oe(j=>[...j,{ts:new Date().toISOString(),type:"error",text:e("flow:userAsk.submitFailed")}])}}},children:[l.jsxs("span",{className:"af-user-ask-option__index",children:["[",x.index,"]"]}),l.jsx("span",{className:"af-user-ask-option__label",children:x.label})]},x.name))})]}),l.jsx("div",{className:"af-user-ask-modal__foot",children:l.jsx("span",{className:"af-user-ask-modal__hint",children:e(jw?"flow:userAsk.submitting":"flow:userAsk.hint")})})]})}),document.body),th&&pe!=="edit"&&l.jsxs("div",{className:"af-tool-print-toast"+(Cu?" af-tool-print-toast--expanded":""),role:"status","aria-live":"polite",children:[l.jsxs("div",{className:"af-tool-print-toast__head",children:[l.jsx("span",{className:"material-symbols-outlined",children:"print"}),l.jsx("span",{className:"af-tool-print-toast__title",children:e("flow:toolPrint.title",{instanceId:th.instanceId})}),l.jsx("button",{type:"button",className:"af-tool-print-toast__close",onClick:()=>Ew(x=>!x),"aria-label":e(Cu?"flow:toolPrint.restore":"flow:toolPrint.expand"),title:e(Cu?"flow:toolPrint.restore":"flow:toolPrint.expand"),children:l.jsx("span",{className:"material-symbols-outlined",children:Cu?"close_fullscreen":"open_in_full"})}),l.jsx("button",{type:"button",className:"af-tool-print-toast__close",onClick:()=>Cw(null),"aria-label":e("common:close"),children:l.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),l.jsx("div",{className:"af-tool-print-toast__body",children:l.jsx("div",{className:"af-tool-print-toast__markdown",children:l.jsx(pu,{children:th.content})})})]}),To&&l.jsx("div",{className:"af-provide-edit-overlay",children:l.jsxs("div",{className:"af-provide-edit-modal",role:"dialog","aria-modal":"true",children:[l.jsxs("div",{className:"af-provide-edit-modal__head",children:[l.jsx("span",{className:"material-symbols-outlined",children:"edit_document"}),l.jsx("span",{className:"af-provide-edit-modal__title",children:To.label}),l.jsx("button",{type:"button",className:"af-provide-edit-modal__close",onClick:()=>Eu(null),"aria-label":e("common:close"),children:l.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),l.jsx("div",{className:"af-provide-edit-modal__body",children:l.jsx("textarea",{ref:nh,className:"af-provide-edit-modal__textarea",defaultValue:To.content,autoFocus:!0})}),l.jsxs("div",{className:"af-provide-edit-modal__foot",children:[l.jsxs("button",{type:"button",className:"af-provide-edit-modal__btn af-provide-edit-modal__btn--save",onClick:lI,children:[l.jsx("span",{className:"material-symbols-outlined",children:"save"}),e("flow:provideEdit.save")]}),l.jsxs("button",{type:"button",className:"af-provide-edit-modal__btn",onClick:()=>Eu(null),children:[l.jsx("span",{className:"material-symbols-outlined",children:"close"}),e("flow:provideEdit.cancel")]})]})]})}),Qp&&l.jsx("div",{className:"af-run-params-overlay",children:l.jsxs("div",{className:"af-run-params-modal",role:"dialog","aria-modal":"true",children:[l.jsxs("div",{className:"af-run-params-modal__head",children:[l.jsx("span",{className:"material-symbols-outlined",children:"edit_note"}),l.jsx("span",{className:"af-run-params-modal__title",children:e("flow:runParams.title")}),l.jsx("button",{type:"button",className:"af-run-params-modal__close",onClick:()=>jo(!1),"aria-label":e("common:close"),children:l.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),l.jsx("div",{className:"af-run-params-modal__body",children:Sr.length===0?l.jsx("div",{className:"af-run-params-empty",children:e("flow:runParams.noParams")}):l.jsx("div",{className:"af-run-params-list",children:Sr.map(x=>{var J,ne;const j=Ro[x.id];if(!j)return null;const z=(((J=x.data)==null?void 0:J.definitionId)||"").startsWith("provide_file"),V=((ne=x.data)==null?void 0:ne.label)||x.id,Y=wu[j]??"";return l.jsxs("div",{className:"af-run-params-item",children:[l.jsxs("div",{className:"af-run-params-item__head",children:[l.jsx("span",{className:"af-run-params-item__icon material-symbols-outlined"+(z?" af-run-params-item__icon--file":""),children:z?"description":"text_fields"}),l.jsx("span",{className:"af-run-params-item__label",children:V}),l.jsx("span",{className:"af-run-params-item__slot",children:j})]}),l.jsx("input",{type:"text",className:"af-run-params-item__input",value:Y,onChange:ue=>vu(le=>({...le,[j]:ue.target.value})),placeholder:e(z?"flow:runConfig.filePathPlaceholder":"flow:runConfig.stringValuePlaceholder")})]},x.id)})})}),l.jsxs("div",{className:"af-run-params-modal__foot",children:[l.jsxs("button",{type:"button",className:"af-run-params-modal__btn af-run-params-modal__btn--run",onClick:()=>{var j;const x={};for(const D of Sr){const z=Ro[D.id];if(!z)continue;const V=((j=D.data)==null?void 0:j.definitionId)||"",Y=wu[z]??"";V.startsWith("provide_file")?x[z]={type:"file",path:Y}:x[z]={type:"str",value:Y}}jo(!1),Yi(!1),Zr({cliInputsOverride:x})},children:[l.jsx("span",{className:"material-symbols-outlined",children:"play_arrow"}),e("flow:runParams.run")]}),l.jsxs("button",{type:"button",className:"af-run-params-modal__btn",onClick:()=>jo(!1),children:[l.jsx("span",{className:"material-symbols-outlined",children:"close"}),e("flow:runParams.cancel")]})]})]})})]})})}const mU="af:workspace-graph:v2",lS=["DISPLAY","CONTROL","TOOL","PROVIDE","AGENT"],gU=new Set(["control_start","control_end"]),yU="0.1.30";function xU(){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 Fd(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 wU(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 cS(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 l_(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 vU(e){const t=String((e==null?void 0:e.id)||"");return t.startsWith("display_")?"DISPLAY":/^control/i.test(t)?"CONTROL":/^tool/i.test(t)?"TOOL":/^provide/i.test(t)?"PROVIDE":"AGENT"}function uS(e){return e==="DISPLAY"?"preview":e==="CONTROL"?"account_tree":e==="TOOL"?"build":e==="PROVIDE"?"database":"smart_toy"}function vy(e){return String((e==null?void 0:e.displayName)||(e==null?void 0:e.label)||(e==null?void 0:e.id)||"Node")}function bU(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 kU(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 SU(e){return(e==null?void 0:e.default)!=null?String(e.default):(e==null?void 0:e.value)!=null?String(e.value):""}function Ks(e){return(Array.isArray(e)?e:[]).map(t=>({type:(t==null?void 0:t.type)||"node",name:(t==null?void 0:t.name)||"",default:SU(t)}))}function NU(e,t){var p,d;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=(d=e==null?void 0:e.ui)!=null&&d.nodeSizes&&typeof e.ui.nodeSizes=="object"?e.ui.nodeSizes:{},o=new Set(Object.keys(n));for(const f of r)f!=null&&f.source&&o.add(String(f.source)),f!=null&&f.target&&o.add(String(f.target));const c=Array.from(o).map(f=>{const h=n[f]||{},g=h.definitionId||f,b=t.find(w=>w.id===g),k=i[f]&&typeof i[f].x=="number"&&typeof i[f].y=="number"?i[f]:{x:320+o.size*20,y:180+o.size*12},y=s[f]&&typeof s[f].width=="number"&&typeof s[f].height=="number"?{width:s[f].width,height:s[f].height}:null,v=!!Ka(g);return{id:f,type:$a,position:k,...v&&y?{width:y.width,height:y.height}:{},data:{label:h.label||vy(b)||f,definitionId:g,schemaType:l_(g,b),role:h.role||"normal",model:h.model||void 0,body:h.body||"",script:h.script||"",...v&&y?{displaySize:y}:{}}}}).map(f=>fc(f,n,t)),u=r.filter(f=>(f==null?void 0:f.source)&&(f==null?void 0:f.target)).map((f,h)=>({id:f.id||`we-${f.source}-${f.target}-${h}`,source:String(f.source),target:String(f.target),sourceHandle:f.sourceHandle??void 0,targetHandle:f.targetHandle??void 0,markerEnd:{type:Fr.ArrowClosed}}));return{nodes:c,edges:JP(u,c),instances:n}}function dS(e,t,n){var a,c,u,p,d,f,h,g,b;const r=XP(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:((a=k.position)==null?void 0:a.x)||0,y:((c=k.position)==null?void 0:c.y)||0},Ka((u=k.data)==null?void 0:u.definitionId)){const y=Number(((d=(p=k.data)==null?void 0:p.displaySize)==null?void 0:d.width)||k.width||((f=k.measured)==null?void 0:f.width)||0),v=Number(((g=(h=k.data)==null?void 0:h.displaySize)==null?void 0:g.height)||k.height||((b=k.measured)==null?void 0:b.height)||0);y>0&&v>0&&(o[k.id]={width:y,height:v})}return{version:1,instances:r,edges:i,ui:{nodePositions:s,nodeSizes:o}}}function Ka(e){const t=String(e||"");return t==="display_markdown"?"markdown":t==="display_mermaid"?"mermaid":t==="display_ascii"?"ascii":""}function jU(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 la(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 CU(e){const t=la(e);return t.length>1&&t.every(n=>/^:?-{3,}:?$/.test(n))}function EU(e){return la(e).map(t=>t.startsWith(":")&&t.endsWith(":")?"center":t.endsWith(":")?"right":"left")}function PU(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 a=t[o]||"";if(/^\s*```/.test(a)){i=!i,r.push(a),o++;continue}if(!i&&o+1<t.length&&la(a).length>1&&CU(t[o+1])){s();const c=la(a),u=EU(t[o+1]),p=[];for(o+=2;o<t.length&&t[o].trim()&&la(t[o]).length>1;)p.push(la(t[o])),o++;n.push({type:"table",headers:c,align:u,rows:p});continue}r.push(a),o++}return s(),n}function fS({children:e}){return l.jsx(pu,{components:{p:({children:t})=>l.jsx(l.Fragment,{children:t})},children:String(e||"")})}function _U({content:e}){const t=m.useMemo(()=>PU(e),[e]);return l.jsx(l.Fragment,{children:t.map((n,r)=>n.type!=="table"?l.jsx(pu,{children:n.text},`md-${r}`):l.jsx("div",{className:"af-work-display-table-wrap",children:l.jsxs("table",{className:"af-work-display-table",children:[l.jsx("thead",{children:l.jsx("tr",{children:n.headers.map((i,s)=>l.jsx("th",{style:{textAlign:n.align[s]||"left"},children:l.jsx(fS,{children:i})},s))})}),l.jsx("tbody",{children:n.rows.map((i,s)=>l.jsx("tr",{children:n.headers.map((o,a)=>l.jsx("td",{style:{textAlign:n.align[a]||"left"},children:l.jsx(fS,{children:i[a]||""})},a))},s))})]})},`table-${r}`))})}function IU(e){const t=String(e||"").split(/\r?\n/).map(a=>a.replace(/%%.*$/,"").trim()).filter(Boolean),n=new Map,r=[];let i="TD";const s=(a,c="")=>{const u=String(a||"").replace(/[^A-Za-z0-9_]/g,"_")||`N${n.size+1}`;return n.has(u)?c&&(n.get(u).label=c):n.set(u,{id:u,label:c||u}),u},o=a=>{const c=String(a||"").trim().replace(/[;,]+$/,""),u=c.match(/^([A-Za-z][A-Za-z0-9_]*)(?:\[(.+?)\]|\((.+?)\)|\{(.+?)\})?$/);return u?s(u[1],u[2]||u[3]||u[4]||u[1]):s(c.replace(/[^A-Za-z0-9_]/g,"_"),c)};for(const a of t){const c=a.match(/^(graph|flowchart)\s+(TD|TB|BT|LR|RL)\b/i);if(c){i=c[2].toUpperCase();continue}const u=a.match(/^(.+?)\s*-{1,2}>+\s*(.+)$/);if(u){r.push({from:o(u[1]),to:o(u[2])});continue}o(a)}return{nodes:Array.from(n.values()),edges:r,direction:i}}function AU({code:e}){const t=m.useMemo(()=>IU(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,a=new Map;t.nodes.forEach((p,d)=>{a.set(p.id,{x:24+(n?d*(r+s):d%3*(r+s)),y:24+(n?d%3*(i+o):d*(i+o))})});const c=Math.max(360,...Array.from(a.values()).map(p=>p.x+r+24)),u=Math.max(180,...Array.from(a.values()).map(p=>p.y+i+24));return l.jsx("div",{className:"af-work-node__mermaid-preview",children:l.jsxs("svg",{viewBox:`0 0 ${c} ${u}`,role:"img","aria-label":"Mermaid preview",children:[l.jsx("defs",{children:l.jsx("marker",{id:"af-work-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:l.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z"})})}),t.edges.map((p,d)=>{const f=a.get(p.from),h=a.get(p.to);if(!f||!h)return null;const g=n?`M ${f.x+r} ${f.y+i/2} C ${(f.x+h.x+r)/2} ${f.y+i/2}, ${(f.x+h.x+r)/2} ${h.y+i/2}, ${h.x} ${h.y+i/2}`:`M ${f.x+r/2} ${f.y+i} C ${f.x+r/2} ${f.y+i+28}, ${h.x+r/2} ${h.y-28}, ${h.x+r/2} ${h.y}`;return l.jsx("path",{className:"af-work-node__mermaid-edge",d:g,markerEnd:"url(#af-work-arrow)"},`${p.from}-${p.to}-${d}`)}),t.nodes.map(p=>{const d=a.get(p.id);return l.jsxs("g",{children:[l.jsx("rect",{className:"af-work-node__mermaid-box",x:d.x,y:d.y,width:r,height:i,rx:"8"}),l.jsx("text",{className:"af-work-node__mermaid-text",x:d.x+r/2,y:d.y+i/2+5,textAnchor:"middle",children:p.label.slice(0,22)})]},p.id)})]})})}function TU({data:e}){const t=Ka(e==null?void 0:e.definitionId);if(!t)return null;const n=jU(e);return n.trim()?t==="markdown"?l.jsx("div",{className:"af-work-display-body af-work-display-body--markdown",children:l.jsx(_U,{content:n})}):t==="mermaid"?l.jsxs("div",{className:"af-work-display-body",children:[l.jsx(AU,{code:n}),l.jsx("pre",{className:"af-work-node__diagram af-work-node__diagram--mermaid",children:n})]}):l.jsx("pre",{className:"af-work-display-body af-work-node__diagram af-work-node__diagram--ascii",children:n}):l.jsx("div",{className:"af-work-display-empty",children:"No display content"})}function RU({id:e,data:t,selected:n,deleteNode:r}){const i=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],s=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],o=Ka(t==null?void 0:t.definitionId),a=(t==null?void 0:t.label)||(o==="mermaid"?"Mermaid":o==="ascii"?"ASCII":"Markdown"),c=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 l.jsxs("div",{className:"af-work-display-card"+(c?" af-work-display-card--sized":"")+(n?" af-work-display-card--selected":""),style:c?{width:c.width,height:c.height}:void 0,children:[l.jsx(W3,{className:"af-work-display-resize nodrag",position:"bottom-right",minWidth:320,minHeight:180,maxWidth:1200,maxHeight:1e3,children:l.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_full"})}),i.map((u,p)=>l.jsx(js,{type:"target",position:Ie.Left,id:`input-${p}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:`${4.15+p*1.75}rem`,background:yi(u.type)},title:`${u.name||`#${p+1}`} · ${u.type}`},`in-${p}`)),s.map((u,p)=>l.jsx(js,{type:"source",position:Ie.Right,id:`output-${p}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:`${4.15+p*1.75}rem`,background:yi(u.type)},title:`${u.name||`#${p+1}`} · ${u.type}`},`out-${p}`)),l.jsxs("div",{className:"af-work-display-card__head",children:[l.jsxs("div",{className:"af-work-display-card__title",children:[l.jsx("span",{className:"material-symbols-outlined",children:o==="mermaid"?"account_tree":o==="ascii"?"notes":"article"}),l.jsx("strong",{children:a}),l.jsx("span",{children:(t==null?void 0:t.definitionId)||"display"})]}),l.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:l.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),l.jsx(TU,{data:t})]})}function LU(e){var s,o;const{setEdges:t,setNodes:n}=So(),r=m.useCallback(a=>{n(c=>c.filter(u=>u.id!==a)),t(c=>c.filter(u=>u.source!==a&&u.target!==a))},[t,n]),i=m.useCallback((a,c)=>{n(u=>u.map(p=>p.id===a?{...p,data:{...p.data,model:c}}:p))},[n]);return Ka((s=e.data)==null?void 0:s.definitionId)?l.jsx(RU,{...e,deleteNode:r}):l.jsx("div",{className:"af-work-flow-node",children:l.jsx(QP,{...e,deleteNode:r,modelLists:(o=e.data)==null?void 0:o.modelLists,onModelChange:i})})}const OU={[$a]:LU};function c_(e,t=[]){for(const n of e||[])n.type==="file"&&t.push(n),Array.isArray(n.children)&&c_(n.children,t);return t}function u_({items:e,onOpen:t,collapsedDirs:n,onToggleDir:r,onCreateFile:i,onCreateFolder:s,onDelete:o,onFileDragStart:a}){return l.jsx("ul",{className:"af-work-files",children:(e||[]).map(c=>{var d;const u=c.type==="directory",p=u&&(n==null?void 0:n.has(c.path));return l.jsxs("li",{children:[l.jsxs("div",{className:"af-work-file-row",children:[l.jsxs("button",{type:"button",className:"af-work-file af-work-file--"+c.type,draggable:!u,onDragStart:f=>{u||a==null||a(f,c)},onClick:()=>u?r==null?void 0:r(c.path):t(c),title:c.path,children:[u?l.jsx("span",{className:"material-symbols-outlined af-work-file__chevron",children:p?"chevron_right":"expand_more"}):null,l.jsx("span",{className:"material-symbols-outlined",children:c.icon||bU(c.name,u)}),l.jsx("span",{children:c.name})]}),u?l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"af-work-file-action",onClick:()=>i==null?void 0:i(c.path),title:"新增文件","aria-label":`在 ${c.name} 新增文件`,children:l.jsx("span",{className:"material-symbols-outlined",children:"note_add"})}),l.jsx("button",{type:"button",className:"af-work-file-action",onClick:()=>s==null?void 0:s(c.path),title:"新增文件夹","aria-label":`在 ${c.name} 新增文件夹`,children:l.jsx("span",{className:"material-symbols-outlined",children:"create_new_folder"})})]}):null,l.jsx("button",{type:"button",className:"af-work-file-action af-work-file-action--danger",onClick:()=>o==null?void 0:o(c),title:"删除","aria-label":`删除 ${c.name}`,children:l.jsx("span",{className:"material-symbols-outlined",children:"delete"})})]}),u&&!p&&((d=c.children)!=null&&d.length)?l.jsx(u_,{items:c.children,onOpen:t,collapsedDirs:n,onToggleDir:r,onCreateFile:i,onCreateFolder:s,onDelete:o,onFileDragStart:a}):null]},c.path)})})}function MU({messages:e,running:t}){const n=e.length>0;return l.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 l.jsxs("section",{className:`af-composer-ai-block af-composer-ai-block--${s}`,children:[l.jsx("div",{className:"af-composer-ai-block-label",children:o}),l.jsx("div",{className:"af-composer-ai-block-body",children:r.text})]},`${i}-${r.role}-${String(r.text||"").slice(0,24)}`)}),t&&!n?l.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--reply af-composer-ai-block--pending",children:[l.jsx("div",{className:"af-composer-ai-block-label",children:"Reply"}),l.jsx("div",{className:"af-composer-ai-block-body",children:"Waiting..."})]}):null,t&&n?l.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--thinking",children:[l.jsx("div",{className:"af-composer-ai-block-label",children:"Thinking"}),l.jsx("div",{className:"af-composer-ai-block-body",children:"Workspace agent is running..."})]}):null]})}function DU(){const{i18n:e}=bt(),{navigate:t}=ko(),n=So(),r=m.useMemo(xU,[]),[i,s]=wE([]),[o,a,c]=vE([]),[u,p]=m.useState({}),d=m.useRef({}),f=m.useRef(!1),h=m.useRef(null),[g,b]=m.useState([]),[k,y]=m.useState(""),[v,w]=m.useState(""),[N,C]=m.useState([]),[S,P]=m.useState(""),[R,M]=m.useState(""),[H,_]=m.useState(()=>new Set),[A,U]=m.useState({cursor:[],opencode:[],claudeCode:[]}),[L,B]=m.useState(""),[$,F]=m.useState([]),[I,T]=m.useState([]),[E,q]=m.useState(!1),W=m.useRef(null),O=m.useRef(null),[X,se]=m.useState({}),[re,de]=m.useState(!0),[ie,me]=m.useState(!1),[ye,ke]=m.useState(""),[he,Se]=m.useState(!1),[Ve,We]=m.useState([]),[He,ut]=m.useState(!1),[Ge,De]=m.useState(""),kt=m.useMemo(()=>wU(r),[r]),Ut=m.useRef(!1);m.useEffect(()=>{r.flowId&&Pj(r.flowId,r.flowSource||"user","workspace",!!r.archived)},[r]),m.useEffect(()=>{if(Ut.current=!1,!kt){We([]),Ut.current=!0;return}try{const K=localStorage.getItem(kt);We(K?cS(JSON.parse(K)):[])}catch{We([])}finally{Ut.current=!0}},[kt]),m.useEffect(()=>{if(!(!Ut.current||!kt))try{localStorage.setItem(kt,JSON.stringify(cS(Ve)))}catch{}},[Ve,kt]);const Ct=m.useCallback(async()=>{const K=Fd(r),Q=await fetch(`/api/workspace/files?${K.toString()}`),te=await Q.json();if(!Q.ok)throw new Error(te.error||"读取 workspace 失败");C(te.files||[]),P(te.root||"")},[r]),sn=m.useCallback(async(K=i,Q=o)=>{var Ae;if(!f.current)return;const te=dS(K,Q,d.current),Pe=await fetch("/api/workspace/graph",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,graph:te})}),Ee=await Pe.json();if(!Pe.ok)throw new Error(Ee.error||"保存 workspace graph 失败");d.current=((Ae=Ee.graph)==null?void 0:Ae.instances)||te.instances,p(d.current),De("Workspace graph saved")},[o,r,i]),pn=m.useCallback(async()=>{f.current=!1;const K=Fd(r),Q=Fd(r);Q.set("lang",String(e.language||"zh").startsWith("zh")?"zh":"en");const[te,Pe]=await Promise.all([fetch(`/api/nodes?${Q.toString()}`),fetch(`/api/workspace/graph?${K.toString()}`),Ct()]),Ee=await te.json(),Ae=await Pe.json();if(!te.ok)throw new Error(Ee.error||"读取节点定义失败");if(!Pe.ok)throw new Error(Ae.error||"读取 workspace graph 失败");const Me=(Array.isArray(Ee)?Ee:Ee.nodes||[]).filter(Tt=>!gU.has(Tt.id));b(Me);const mt=Ae.graph||JSON.parse(localStorage.getItem(mU)||"null")||{},gt=NU(mt,Me);d.current=gt.instances,p(gt.instances),s(gt.nodes),a(gt.edges),De(Ae.writable?"Workspace ready":"Readonly workspace"),f.current=!0},[r,e.language,Ct,a,s]);m.useEffect(()=>{pn().catch(K=>De(String(K.message||K))),fetch("/api/model-lists").then(K=>K.json()).then(K=>U({cursor:Array.isArray(K.cursor)?K.cursor.map(String):[],opencode:Array.isArray(K.opencode)?K.opencode.map(String):[],claudeCode:Array.isArray(K.claudeCode)?K.claudeCode.map(String):[]})).catch(()=>{}),fetch("/api/skills").then(K=>K.json()).then(K=>{const Q=Array.isArray(K.skills)?K.skills.map(te=>({key:String(te.key),name:String(te.name||te.id||te.key),description:te.description?String(te.description):"",sourceLabel:te.sourceLabel?String(te.sourceLabel):""})):[];F(Q),T(Q.map(te=>te.key))}).catch(()=>{})},[pn]),m.useEffect(()=>{d.current=u},[u]),m.useEffect(()=>{if(f.current)return h.current&&window.clearTimeout(h.current),h.current=window.setTimeout(()=>{sn().catch(K=>De(String(K.message||K)))},650),()=>{h.current&&window.clearTimeout(h.current)}},[i,o,sn]);const on=m.useMemo(()=>i.map(K=>({...K,data:{...K.data,modelLists:A}})),[A,i]),Z=m.useMemo(()=>{const K=new Map(on.map(Q=>[Q.id,Q]));return o.map(Q=>{var Tt,Kr,Wi,Ki;const te=K.get(Q.source),Pe=K.get(Q.target),Ee=/^output-(\d+)$/.exec(Q.sourceHandle||""),Ae=/^input-(\d+)$/.exec(Q.targetHandle||""),Me=te&&Ee?(Kr=(Tt=te.data)==null?void 0:Tt.outputs)==null?void 0:Kr[parseInt(Ee[1],10)]:null,mt=Pe&&Ae?(Ki=(Wi=Pe.data)==null?void 0:Wi.inputs)==null?void 0:Ki[parseInt(Ae[1],10)]:null,gt=Me!=null&&Me.type?yi(Me.type):mt!=null&&mt.type?yi(mt.type):"";return gt?{...Q,style:{...Q.style||{},stroke:gt,strokeWidth:2},markerEnd:{type:Fr.ArrowClosed,color:gt}}:Q})},[o,on]),oe=m.useMemo(()=>{const K=k.trim().toLowerCase(),Q={DISPLAY:[],CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const te of g)K&&![te.id,te.label,te.displayName,te.description].some(Pe=>String(Pe||"").toLowerCase().includes(K))||Q[vU(te)].push(te);for(const te of lS)Q[te].sort((Pe,Ee)=>Pe.id.localeCompare(Ee.id));return Q},[g,k]),je=m.useMemo(()=>{const K=R.trim().toLowerCase();return K?c_(N).filter(Q=>Q.path.toLowerCase().includes(K)):N},[R,N]),$e=[...(A.cursor||[]).map(K=>({label:`Cursor · ${K.split(" - ")[0]}`,value:`cursor:${K.split(" - ")[0]}`})),...(A.opencode||[]).map(K=>({label:`OpenCode · ${K.split(" - ")[0]}`,value:`opencode:${K.split(" - ")[0]}`})),...(A.claudeCode||[]).map(K=>({label:`Claude · ${K.split(" - ")[0]}`,value:`claude-code:${K.split(" - ")[0]}`}))],xe=m.useMemo(()=>new Set(I),[I]),Qe=m.useMemo(()=>{const K=new Map;for(const Q of $){const te=Q.sourceLabel||"Workspace Skills";K.has(te)||K.set(te,[]),K.get(te).push(Q)}return Array.from(K.entries()).map(([Q,te])=>({label:Q,skills:te}))},[$]),Et=m.useMemo(()=>{const K=i.filter(Q=>Q.selected);return K.length>0?K:v?i.filter(Q=>Q.id===v):[]},[i,v]),we=m.useMemo(()=>Et.map(K=>K.id),[Et]),pe=m.useCallback(K=>{s(Q=>Q.map(te=>te.id===K?{...te,selected:!1}:te)),w(Q=>Q===K?"":Q)},[s]),it=m.useCallback(()=>{const K=W.current;if(!K)return;const Q=K.getBoundingClientRect(),te=Math.min(420,Math.max(320,Q.width+160)),Pe=12,Ee=Math.max(180,Q.top-Pe*2),Ae=Math.min(560,Ee);se({position:"fixed",left:Math.max(12,Math.min(window.innerWidth-te-12,Q.left)),top:Math.max(Pe,Q.top-Ae-Pe),width:te,maxHeight:Ae,zIndex:1e4})},[]);m.useEffect(()=>{if(!E)return;it();const K=te=>{var Ee,Ae;const Pe=te.target;(Ee=W.current)!=null&&Ee.contains(Pe)||(Ae=O.current)!=null&&Ae.contains(Pe)||q(!1)},Q=te=>{te.key==="Escape"&&q(!1)};return window.addEventListener("pointerdown",K),window.addEventListener("keydown",Q),window.addEventListener("resize",it),window.addEventListener("scroll",it,!0),()=>{window.removeEventListener("pointerdown",K),window.removeEventListener("keydown",Q),window.removeEventListener("resize",it),window.removeEventListener("scroll",it,!0)}},[E,it]);const Pt=m.useCallback(K=>{var te,Pe;const Q=new Map;for(const Ee of K||[])(Ee==null?void 0:Ee.type)==="dimensions"&&((te=Ee.dimensions)!=null&&te.width)&&((Pe=Ee.dimensions)!=null&&Pe.height)&&Q.set(Ee.id,{width:Math.round(Number(Ee.dimensions.width)),height:Math.round(Number(Ee.dimensions.height))});s(Ee=>Bx(K,Ee).map(Ae=>{var mt;const Me=Q.get(Ae.id);return!Me||!Ka((mt=Ae.data)==null?void 0:mt.definitionId)?Ae:{...Ae,data:{...Ae.data,displaySize:Me}}}))},[s]),Oe=m.useCallback(()=>{const K=document.querySelector(".af-workspace-canvas .react-flow");if(K){const Q=K.getBoundingClientRect();return n.screenToFlowPosition({x:Q.left+Q.width*.48,y:Q.top+Q.height*.32})}return{x:360+i.length*36,y:180+i.length*28}},[i.length,n]),ft=m.useCallback((K,Q={})=>{if(!K)return null;const te=Q.id||kU(K.id,i),Pe=Ks(K.inputs),Ee=Ks(K.outputs),Ae={definitionId:K.id,label:Q.label||vy(K),role:"normal",body:Q.body||"",input:Q.inputs||Pe,output:Q.outputs||Ee},Me={id:te,type:$a,position:Q.position||Oe(),data:{label:Ae.label,definitionId:K.id,schemaType:l_(K.id,K),role:"normal",body:Ae.body,inputs:Ae.input,outputs:Ae.output}},mt={...fc(Me,{...d.current,[te]:Ae},g),selected:!0};return s(gt=>[...gt.map(Tt=>({...Tt,selected:!1})),mt]),w(te),te},[Oe,i,g,s]),hn=m.useCallback(K=>{_(Q=>{const te=new Set(Q);return te.has(K)?te.delete(K):te.add(K),te})},[]),mn=m.useCallback(K=>{const Q=g.find(Pe=>Pe.id==="provide_file");if(!Q)return;const te=Ks(Q.outputs);te[0]&&(te[0]={...te[0],default:K.path}),ft(Q,{label:K.name,outputs:te})},[ft,g]),Vr=m.useCallback((K,Q)=>{K.dataTransfer.effectAllowed="copy",K.dataTransfer.setData("application/x-agentflow-workspace-file",JSON.stringify({path:Q.path,name:Q.name,type:Q.type})),K.dataTransfer.setData("text/plain",Q.path)},[]),gn=m.useCallback((K,Q)=>{K.dataTransfer.effectAllowed="move",K.dataTransfer.setData("application/agentflow-node",Q.id),K.dataTransfer.setData("text/plain",Q.id)},[]),lr=m.useCallback(async(K,Q)=>{const te=g.find(Tt=>Tt.id==="display_markdown");if(!te){De("Markdown Display 节点不可用");return}const Pe=Fd(r);Pe.set("path",K.path);const Ee=await fetch(`/api/workspace/file?${Pe.toString()}`),Ae=await Ee.json();if(!Ee.ok)throw new Error(Ae.error||"读取文件失败");const Me=String(Ae.content||""),mt=Ks(te.inputs).map(Tt=>Tt.name==="content"?{...Tt,default:Me}:Tt),gt=Ks(te.outputs).map(Tt=>Tt.name==="content"?{...Tt,default:Me}:Tt);ft(te,{label:K.name||"Markdown",body:Me,inputs:mt,outputs:gt,position:Q}),De(`已创建 Markdown 展示:${K.path}`)},[ft,r,g]),Ln=m.useCallback(K=>{const Q=K.dataTransfer.getData("application/x-agentflow-workspace-file");if(Q){K.preventDefault();let Ae;try{Ae=JSON.parse(Q)}catch{return}if(!(Ae!=null&&Ae.path))return;const Me=n.screenToFlowPosition({x:K.clientX,y:K.clientY});lr(Ae,Me).catch(mt=>De(String(mt.message||mt)));return}const te=K.dataTransfer.getData("application/agentflow-node");if(!te)return;const Pe=g.find(Ae=>Ae.id===te);if(!Pe)return;K.preventDefault();const Ee=n.screenToFlowPosition({x:K.clientX,y:K.clientY});ft(Pe,{position:Ee})},[lr,ft,g,n]),Wr=m.useCallback(K=>{const Q=Array.from(K.dataTransfer.types||[]);!Q.includes("application/x-agentflow-workspace-file")&&!Q.includes("application/agentflow-node")||(K.preventDefault(),K.dataTransfer.dropEffect=Q.includes("application/agentflow-node")?"move":"copy")},[]),En=m.useCallback(async(K="")=>{const Q=window.prompt("新文件名",K?`${K}/notes.md`:"notes.md");if(!Q)return;const te=K&&!Q.includes("/")?`${K}/${Q}`:Q;try{const Pe=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,path:te,content:""})}),Ee=await Pe.json();if(!Pe.ok)throw new Error(Ee.error||"创建文件失败");De(`已创建 ${Ee.path}`),await Ct()}catch(Pe){De(String(Pe.message||Pe))}},[r,Ct]),Gn=m.useCallback(async(K="")=>{const Q=window.prompt("新文件夹名",K?`${K}/docs`:"docs");if(!Q)return;const te=K&&!Q.includes("/")?`${K}/${Q}`:Q;try{const Pe=await fetch("/api/workspace/folder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,path:te})}),Ee=await Pe.json();if(!Pe.ok)throw new Error(Ee.error||"创建文件夹失败");_(Ae=>{const Me=new Set(Ae);return K&&Me.delete(K),Me}),De(`已创建 ${Ee.path}`),await Ct()}catch(Pe){De(String(Pe.message||Pe))}},[r,Ct]),G=m.useCallback(async K=>{if(!(!(K!=null&&K.path)||!window.confirm(`删除 ${K.path}?`)))try{const Q=await fetch("/api/workspace/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,path:K.path})}),te=await Q.json();if(!Q.ok)throw new Error(te.error||"删除失败");De(`已删除 ${te.path}`),await Ct()}catch(Q){De(String(Q.message||Q))}},[r,Ct]),_e=m.useCallback(async()=>{const K=ye.trim();if(!K||he)return;const Q=dS(i,o,d.current);ke(""),Se(!0),ut(!0),We(te=>[...te,{role:"user",text:K,at:Date.now()}]);try{const te=await fetch("/api/workspace/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,prompt:K,outputKind:"markdown",workspaceGraph:Q,allowFlowYaml:ie,model:L,selectedSkills:re?I:[],selectedNodeIds:we})}),Pe=await te.json();if(!te.ok)throw new Error(Pe.error||"生成失败");const Ee=String(Pe.content||"").trim();We(Me=>[...Me,{role:"assistant",text:Ee,at:Date.now()}]);const Ae=g.find(Me=>Me.id==="display_markdown");if(Ae&&Ee){const Me=Ks(Ae.inputs).map(gt=>gt.name==="content"?{...gt,default:Ee}:gt),mt=Ks(Ae.outputs).map(gt=>gt.name==="content"?{...gt,default:Ee}:gt);ft(Ae,{label:"AI Markdown",body:Ee,inputs:Me,outputs:mt,position:{x:440+i.length*24,y:220+i.length*20}})}De("AI 生成完成")}catch(te){const Pe=String(te.message||te);We(Ee=>[...Ee,{role:"assistant",text:Pe,error:!0,at:Date.now()}]),De(Pe)}finally{Se(!1)}},[ft,ie,L,he,ye,o,r,i,g,we,I,re]);return l.jsxs("div",{className:"af-workspace-page",children:[l.jsxs("header",{className:"af-pipeline-top af-workspace-top",children:[l.jsxs("div",{className:"af-pipeline-top-left",children:[l.jsx("button",{type:"button",className:"af-icon-btn af-pipeline-back",onClick:()=>t("/projects"),"aria-label":"返回",children:l.jsx("span",{className:"material-symbols-outlined",children:"arrow_back"})}),l.jsxs("div",{className:"af-pipeline-brand",title:r.flowId?`${r.flowId} · ${S}`:S||"PROJECT",children:[l.jsx("span",{className:"af-pipeline-brand-name",children:"WORKSPACE"}),l.jsxs("span",{className:"af-pipeline-brand-ver",children:["V",yU,"-STABLE"]})]}),l.jsxs("div",{className:"af-view-switch","aria-label":"视图切换",children:[l.jsx("button",{type:"button",onClick:()=>{t(Sx({id:r.flowId,source:r.flowSource||"user",archived:!!r.archived},"pipeline"))},children:"Pipeline"}),l.jsx("button",{type:"button",className:"af-view-switch__active",children:"Workspace"})]})]}),l.jsxs("div",{className:"af-pipeline-top-right af-workspace-actions",children:[l.jsx("span",{className:"af-workspace-save-status",children:Ge}),l.jsx("button",{type:"button",className:"af-composer-topbar-btn"+(He?" af-composer-topbar-btn--active":"")+(he?" af-composer-topbar-btn--running":""),onClick:()=>ut(K=>!K),children:"AI"}),l.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",onClick:()=>sn().catch(K=>De(String(K.message||K))),children:"Save"})]})]}),l.jsxs("div",{className:"af-workspace-body"+(He?" af-workspace-body--drawer":""),children:[l.jsxs("aside",{className:"af-workspace-sidebar",children:[l.jsxs("section",{className:"af-workspace-files-section",children:[l.jsxs("div",{className:"af-workspace-sidebar-head",children:[l.jsx("h2",{children:"Files"}),l.jsxs("div",{className:"af-workspace-sidebar-actions",children:[l.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>En(""),"aria-label":"新增文件",title:"新增文件",children:l.jsx("span",{className:"material-symbols-outlined",children:"note_add"})}),l.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>Gn(""),"aria-label":"新增文件夹",title:"新增文件夹",children:l.jsx("span",{className:"material-symbols-outlined",children:"create_new_folder"})}),l.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>void Ct(),"aria-label":"刷新文件",title:"刷新文件",children:l.jsx("span",{className:"material-symbols-outlined",children:"refresh"})})]})]}),l.jsx("input",{className:"af-workspace-search",value:R,onChange:K=>M(K.target.value),placeholder:"搜索文件..."}),l.jsx("div",{className:"af-workspace-files-scroll",children:l.jsx(u_,{items:je,onOpen:mn,collapsedDirs:H,onToggleDir:hn,onCreateFile:En,onCreateFolder:Gn,onDelete:G,onFileDragStart:Vr})})]}),l.jsxs("section",{className:"af-workspace-nodes-section",children:[l.jsx("div",{className:"af-workspace-sidebar-head",children:l.jsx("h2",{children:"Nodes"})}),l.jsx("input",{className:"af-workspace-search",value:k,onChange:K=>y(K.target.value),placeholder:"搜索节点..."}),l.jsx("div",{className:"af-workspace-node-palette",children:lS.map(K=>{var Q;return(Q=oe[K])!=null&&Q.length?l.jsxs("div",{className:"af-workspace-node-group",children:[l.jsxs("div",{className:"af-workspace-node-group__title",children:[l.jsx("span",{className:"material-symbols-outlined",children:uS(K)}),l.jsx("span",{children:K})]}),oe[K].map(te=>l.jsxs("button",{type:"button",draggable:!0,onDragStart:Pe=>gn(Pe,te),onClick:()=>ft(te),title:te.description||te.id,children:[l.jsx("span",{className:"material-symbols-outlined",children:uS(K)}),l.jsxs("span",{className:"af-workspace-node-palette__text",children:[l.jsx("span",{className:"af-workspace-node-palette__label",children:vy(te)}),l.jsx("span",{className:"af-workspace-node-palette__id",children:te.id})]})]},te.id))]},K):null})})]})]}),l.jsxs("main",{className:"af-workspace-canvas",children:[l.jsx(xE,{className:"af-flow-canvas af-workspace-flow",nodes:on,edges:Z,nodeTypes:OU,onNodesChange:Pt,onEdgesChange:c,onConnect:K=>a(Q=>Ox({...K,markerEnd:{type:Fr.ArrowClosed}},Q)),onNodeClick:(K,Q)=>w(Q.id),onPaneClick:()=>w(""),onDrop:Ln,onDragOver:Wr,proOptions:{hideAttribution:!0},fitView:!1,minZoom:.1,maxZoom:4,children:l.jsx(kE,{color:"rgba(255,255,255,0.12)",gap:22,size:1})}),l.jsx("div",{className:"af-workspace-composer af-bottom-composer-stack af-flow-bottom-composer",children:l.jsxs("div",{className:"af-pipeline-composer-inner",children:[l.jsx("div",{className:"af-composer-selected","aria-label":"Selected workspace nodes",children:Et.length===0?l.jsx("span",{className:"af-composer-selected-empty",children:"选择画布节点后,可作为本次 Workspace AI 的上下文。"}):Et.map(K=>{var Ee,Ae;const Q=String(((Ee=K.data)==null?void 0:Ee.label)??K.id),te=(Ae=K.data)!=null&&Ae.definitionId?String(K.data.definitionId):"",Pe=te&&te!==Q?`${Q} · ${K.id} · ${te}`:`${Q} · ${K.id}`;return l.jsxs("div",{className:"af-composer-node-chip",title:Pe,children:[l.jsx("span",{className:"af-composer-node-chip-kind",children:te||"node"}),l.jsx("span",{className:"af-composer-node-chip-label",children:Q}),l.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>pe(K.id),"aria-label":`取消选择 ${K.id}`,children:l.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},K.id)})}),l.jsxs("div",{className:"af-composer-card af-composer-card--input-only",children:[l.jsx("div",{className:"af-composer-input-wrap",children:l.jsx("textarea",{className:"af-composer-textarea",value:ye,rows:2,onChange:K=>ke(K.target.value),onKeyDown:K=>{(K.metaKey||K.ctrlKey)&&K.key==="Enter"&&(K.preventDefault(),_e())},placeholder:"描述你想在 workspace 中生成、分析或展示的内容",autoComplete:"off",spellCheck:!1})}),l.jsxs("div",{className:"af-composer-toolbar",children:[l.jsx("label",{className:"af-composer-session-field",children:l.jsx("select",{className:"af-composer-session-select",value:"workspace",disabled:!0,"aria-label":"Workspace conversation",children:l.jsx("option",{value:"workspace",children:"Workspace"})})}),l.jsxs("div",{className:"af-composer-skills-field",children:[l.jsxs("button",{ref:W,type:"button",className:"af-composer-skills-button"+(re&&I.length>0?" af-composer-skills-button--active":""),disabled:he,"aria-haspopup":"listbox","aria-expanded":E,onClick:()=>q(K=>!K),children:[l.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"extension"}),l.jsx("span",{children:re&&I.length>0?`Skills ${I.length}`:"Skills"})]}),E&&!he?Tr.createPortal(l.jsxs("div",{ref:O,className:"af-composer-skills-menu",role:"listbox","aria-label":"Workspace skills",style:X,children:[l.jsxs("label",{className:"af-composer-skill-option af-workspace-skill-master",children:[l.jsx("input",{type:"checkbox",checked:re,onChange:K=>de(K.target.checked)}),l.jsxs("span",{className:"af-composer-skill-option-main",children:[l.jsx("span",{className:"af-composer-skill-option-title",children:"Use workspace skills by default"}),l.jsx("span",{className:"af-composer-skill-option-desc",children:"Workspace 视图默认启用,用于搭临时工作图和生成中间文件。"})]})]}),$.length===0?l.jsx("div",{className:"af-composer-skills-empty",children:"No skills found"}):Qe.map(K=>l.jsxs("div",{className:"af-composer-skill-group",children:[l.jsxs("div",{className:"af-composer-skill-group-title",children:[l.jsx("span",{children:K.label}),l.jsx("span",{children:K.skills.length})]}),K.skills.map(Q=>l.jsxs("label",{className:"af-composer-skill-option",children:[l.jsx("input",{type:"checkbox",checked:xe.has(Q.key),disabled:!re,onChange:te=>{const Pe=te.target.checked;T(Ee=>Pe?Ee.includes(Q.key)?Ee:[...Ee,Q.key]:Ee.filter(Ae=>Ae!==Q.key))}}),l.jsxs("span",{className:"af-composer-skill-option-main",children:[l.jsx("span",{className:"af-composer-skill-option-title",children:Q.name}),Q.description?l.jsx("span",{className:"af-composer-skill-option-desc",children:Q.description}):null]})]},Q.key))]},K.label))]}),document.body):null]}),l.jsxs("label",{className:"af-workspace-flowyaml-toggle",title:"Workspace 默认不修改正式 flow.yaml",children:[l.jsx("input",{type:"checkbox",checked:ie,onChange:K=>me(K.target.checked)}),l.jsx("span",{children:"flow.yaml"})]}),l.jsx("label",{className:"af-composer-model-field",children:l.jsxs("select",{className:"af-composer-model-select",value:L,onChange:K=>B(K.target.value),"aria-label":"模型",children:[l.jsx("option",{value:"",children:"默认模型"}),$e.map(K=>l.jsx("option",{value:K.value,children:K.label},K.value))]})}),l.jsx("button",{type:"button",className:"af-composer-send"+(ye.trim()&&!he?" af-composer-send--active":"")+(he?" af-composer-send--stop":""),disabled:he||!ye.trim(),"aria-label":he?"Running":"Send",onClick:()=>void _e(),children:l.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:he?"sync":"arrow_upward"})})]})]})]})})]}),He?l.jsx("aside",{className:"af-pipeline-drawer af-pipeline-drawer--wide af-workspace-composer-drawer","aria-label":"Workspace AI Composer",children:l.jsxs("div",{className:"af-composer-sidebar",children:[l.jsxs("div",{className:"af-pipeline-drawer-head",children:[l.jsx("h2",{className:"af-pipeline-drawer-title",children:"AI Composer"}),l.jsx("button",{type:"button",className:"af-pipeline-drawer-close af-icon-btn",onClick:()=>ut(!1),"aria-label":"关闭 AI 对话侧栏",children:l.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),l.jsx("div",{className:"af-composer-session-tabs",children:l.jsx("button",{type:"button",className:"af-composer-session-tab af-composer-session-tab--active",children:l.jsx("span",{className:"af-composer-session-label",children:"Workspace"})})}),l.jsx("div",{className:"af-composer-sidebar-status"+(he?" af-composer-sidebar-status--running":""),role:"status","aria-live":"polite",children:he?"Workspace agent running":Ve.length>0?"Workspace conversation":"Ready"}),l.jsx("div",{className:"af-composer-sidebar-thread",children:l.jsx(MU,{messages:Ve,running:he})})]})}):null]})]})}function $U(){return l.jsx(Ux,{children:l.jsx(DU,{})})}const ze=e=>typeof e=="string",zl=()=>{let e,t;const n=new Promise((r,i)=>{e=r,t=i});return n.resolve=e,n.reject=t,n},pS=e=>e==null?"":""+e,FU=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},zU=/###/g,hS=e=>e&&e.indexOf("###")>-1?e.replace(zU,"."):e,mS=e=>!e||ze(e),hc=(e,t,n)=>{const r=ze(t)?t.split("."):t;let i=0;for(;i<r.length-1;){if(mS(e))return{};const s=hS(r[i]);!e[s]&&n&&(e[s]=new n),Object.prototype.hasOwnProperty.call(e,s)?e=e[s]:e={},++i}return mS(e)?{}:{obj:e,k:hS(r[i])}},gS=(e,t,n)=>{const{obj:r,k:i}=hc(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),a=hc(e,o,Object);for(;a.obj===void 0&&o.length;)s=`${o[o.length-1]}.${s}`,o=o.slice(0,o.length-1),a=hc(e,o,Object),a&&a.obj&&typeof a.obj[`${a.k}.${s}`]<"u"&&(a.obj=void 0);a.obj[`${a.k}.${s}`]=n},BU=(e,t,n,r)=>{const{obj:i,k:s}=hc(e,t,Object);i[s]=i[s]||[],i[s].push(n)},rp=(e,t)=>{const{obj:n,k:r}=hc(e,t);if(n)return n[r]},HU=(e,t,n)=>{const r=rp(e,n);return r!==void 0?r:rp(t,n)},d_=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?ze(e[r])||e[r]instanceof String||ze(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):d_(e[r],t[r],n):e[r]=t[r]);return e},Ho=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var UU={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const VU=e=>ze(e)?e.replace(/[&<>"'\/]/g,t=>UU[t]):e;class WU{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 KU=[" ",",","?","!",";"],YU=new WU(20),qU=(e,t,n)=>{t=t||"",n=n||"";const r=KU.filter(o=>t.indexOf(o)<0&&n.indexOf(o)<0);if(r.length===0)return!0;const i=YU.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},by=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,a="";for(let c=s;c<r.length;++c)if(c!==s&&(a+=n),a+=r[c],o=i[a],o!==void 0){if(["string","number","boolean"].indexOf(typeof o)>-1&&c<r.length-1)continue;s+=c-s+1;break}i=o}return i},ip=e=>e&&e.replace("_","-"),GU={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 sp{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||GU,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:(ze(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new sp(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new sp(this.logger,t)}}var li=new sp;class Kp{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[a,c]=o;for(let u=0;u<c;u++)a(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(o=>{let[a,c]=o;for(let u=0;u<c;u++)a.apply(a,[t,...r])})}}class yS extends Kp{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 a;t.indexOf(".")>-1?a=t.split("."):(a=[t,n],r&&(Array.isArray(r)?a.push(...r):ze(r)&&s?a.push(...r.split(s)):a.push(r)));const c=rp(this.data,a);return!c&&!n&&!r&&t.indexOf(".")>-1&&(t=a[0],n=a[1],r=a.slice(2).join(".")),c||!o||!ze(r)?c:by(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 a=[t,n];r&&(a=a.concat(o?r.split(o):r)),t.indexOf(".")>-1&&(a=t.split("."),i=n,n=a[1]),this.addNamespaces(n),gS(this.data,a,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)(ze(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},a=[t,n];t.indexOf(".")>-1&&(a=t.split("."),i=r,r=n,n=a[1]),this.addNamespaces(n);let c=rp(this.data,a)||{};o.skipCopy||(r=JSON.parse(JSON.stringify(r))),i?d_(c,r,s):c={...c,...r},gS(this.data,a,c),o.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(t,n)}:this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(i=>n[i]&&Object.keys(n[i]).length>0)}toJSON(){return this.data}}var f_={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 xS={};class op extends Kp{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),FU(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=li.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,a=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!qU(t,r,i);if(o&&!a){const c=t.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:t,namespaces:ze(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:ze(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:a}=this.extractFromKey(t[t.length-1],n),c=a[a.length-1],u=n.lng||this.language,p=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(p){const N=n.nsSeparator||this.options.nsSeparator;return i?{res:`${c}${N}${o}`,usedKey:o,exactUsedKey:o,usedLng:u,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:`${c}${N}${o}`}return i?{res:o,usedKey:o,exactUsedKey:o,usedLng:u,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:o}const d=this.resolve(t,n);let f=d&&d.res;const h=d&&d.usedKey||o,g=d&&d.exactUsedKey||o,b=Object.prototype.toString.apply(f),k=["[object Number]","[object Function]","[object RegExp]"],y=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject,w=!ze(f)&&typeof f!="boolean"&&typeof f!="number";if(v&&f&&w&&k.indexOf(b)<0&&!(ze(y)&&Array.isArray(f))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const N=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,f,{...n,ns:a}):`key '${o} (${this.language})' returned an object instead of string.`;return i?(d.res=N,d.usedParams=this.getUsedParamsDetails(n),d):N}if(s){const N=Array.isArray(f),C=N?[]:{},S=N?g:h;for(const P in f)if(Object.prototype.hasOwnProperty.call(f,P)){const R=`${S}${s}${P}`;C[P]=this.translate(R,{...n,joinArrays:!1,ns:a}),C[P]===R&&(C[P]=f[P])}f=C}}else if(v&&ze(y)&&Array.isArray(f))f=f.join(y),f&&(f=this.extendTranslation(f,t,n,r));else{let N=!1,C=!1;const S=n.count!==void 0&&!ze(n.count),P=op.hasDefaultValue(n),R=S?this.pluralResolver.getSuffix(u,n.count,n):"",M=n.ordinal&&S?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",H=S&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),_=H&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${R}`]||n[`defaultValue${M}`]||n.defaultValue;!this.isValidLookup(f)&&P&&(N=!0,f=_),this.isValidLookup(f)||(C=!0,f=o);const U=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&C?void 0:f,L=P&&_!==f&&this.options.updateMissing;if(C||N||L){if(this.logger.log(L?"updateKey":"missingKey",u,c,o,L?_:f),s){const I=this.resolve(o,{...n,keySeparator:!1});I&&I.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let B=[];const $=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&$&&$[0])for(let I=0;I<$.length;I++)B.push($[I]);else this.options.saveMissingTo==="all"?B=this.languageUtils.toResolveHierarchy(n.lng||this.language):B.push(n.lng||this.language);const F=(I,T,E)=>{const q=P&&E!==f?E:U;this.options.missingKeyHandler?this.options.missingKeyHandler(I,c,T,q,L,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(I,c,T,q,L,n),this.emit("missingKey",I,c,T,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&S?B.forEach(I=>{const T=this.pluralResolver.getSuffixes(I,n);H&&n[`defaultValue${this.options.pluralSeparator}zero`]&&T.indexOf(`${this.options.pluralSeparator}zero`)<0&&T.push(`${this.options.pluralSeparator}zero`),T.forEach(E=>{F([I],o+E,n[`defaultValue${E}`]||_)})}):F(B,o,_))}f=this.extendTranslation(f,t,n,d,r),C&&f===o&&this.options.appendNamespaceToMissingKey&&(f=`${c}:${o}`),(C||N)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}:${o}`:o,N?f:void 0):f=this.options.parseMissingKeyHandler(f))}return i?(d.res=f,d.usedParams=this.getUsedParamsDetails(n),d):f}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=ze(t)&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let p;if(u){const f=t.match(this.interpolator.nestingRegexp);p=f&&f.length}let d=r.replace&&!ze(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),t=this.interpolator.interpolate(t,d,r.lng||this.language||i.usedLng,r),u){const f=t.match(this.interpolator.nestingRegexp),h=f&&f.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 f=arguments.length,h=new Array(f),g=0;g<f;g++)h[g]=arguments[g];return s&&s[0]===h[0]&&!r.context?(o.logger.warn(`It seems you are nesting recursively key: ${h[0]} in key: ${n[0]}`),null):o.translate(...h,n)},r)),r.interpolation&&this.interpolator.reset()}const a=r.postProcess||this.options.postProcess,c=ze(a)?[a]:a;return t!=null&&c&&c.length&&r.applyPostProcessor!==!1&&(t=f_.handle(c,t,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r,i,s,o,a;return ze(t)&&(t=[t]),t.forEach(c=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(c,n),p=u.key;i=p;let d=u.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const f=n.count!==void 0&&!ze(n.count),h=f&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),g=n.context!==void 0&&(ze(n.context)||typeof n.context=="number")&&n.context!=="",b=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);d.forEach(k=>{this.isValidLookup(r)||(a=k,!xS[`${b[0]}-${k}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(a)&&(xS[`${b[0]}-${k}`]=!0,this.logger.warn(`key "${i}" for languages "${b.join(", ")}" won't get resolved as namespace "${a}" 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(y=>{if(this.isValidLookup(r))return;o=y;const v=[p];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(v,p,y,k,n);else{let N;f&&(N=this.pluralResolver.getSuffix(y,n.count,n));const C=`${this.options.pluralSeparator}zero`,S=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(v.push(p+N),n.ordinal&&N.indexOf(S)===0&&v.push(p+N.replace(S,this.options.pluralSeparator)),h&&v.push(p+C)),g){const P=`${p}${this.options.contextSeparator}${n.context}`;v.push(P),f&&(v.push(P+N),n.ordinal&&N.indexOf(S)===0&&v.push(P+N.replace(S,this.options.pluralSeparator)),h&&v.push(P+C))}}let w;for(;w=v.pop();)this.isValidLookup(r)||(s=w,r=this.getResource(y,k,w,n))}))})}),{res:r,usedKey:i,exactUsedKey:s,usedLng:o,usedNS:a}}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&&!ze(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 Tm=e=>e.charAt(0).toUpperCase()+e.slice(1);class wS{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=li.create("languageUtils")}getScriptPartFromCode(t){if(t=ip(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=ip(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(ze(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]=Tm(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]=Tm(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=Tm(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)),ze(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 ze(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))):ze(t)&&s(this.formatLanguageCode(t)),r.forEach(o=>{i.indexOf(o)<0&&s(this.formatLanguageCode(o))}),i}}let XU=[{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}],JU={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 QU=["v1","v2","v3"],ZU=["v4"],vS={zero:0,one:1,two:2,few:3,many:4,other:5},eV=()=>{const e={};return XU.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:JU[t.fc]}})}),e};class tV{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=li.create("pluralResolver"),(!this.options.compatibilityJSON||ZU.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=eV(),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=ip(t==="dev"?"en":t),i=n.ordinal?"ordinal":"cardinal",s=JSON.stringify({cleanedCode:r,type:i});if(s in this.pluralRulesCache)return this.pluralRulesCache[s];let o;try{o=new Intl.PluralRules(r,{type:i})}catch{if(!t.match(/-|_/))return;const c=this.languageUtils.getLanguagePartFromCode(t);o=this.getRule(c,n)}return this.pluralRulesCache[s]=o,o}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}needsPlural(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}getPluralFormsOfKey(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,r).map(i=>`${n}${i}`)}getSuffixes(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((i,s)=>vS[i]-vS[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!QU.includes(this.options.compatibilityJSON)}}const bS=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=HU(e,t,n);return!s&&i&&ze(n)&&(s=by(e,n,r),s===void 0&&(s=by(t,n,r))),s},Rm=e=>e.replace(/\$/g,"$$$$");class nV{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=li.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:a,suffixEscaped:c,formatSeparator:u,unescapeSuffix:p,unescapePrefix:d,nestingPrefix:f,nestingPrefixEscaped:h,nestingSuffix:g,nestingSuffixEscaped:b,nestingOptionsSeparator:k,maxReplaces:y,alwaysFormat:v}=t.interpolation;this.escape=n!==void 0?n:VU,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=s?Ho(s):o||"{{",this.suffix=a?Ho(a):c||"}}",this.formatSeparator=u||",",this.unescapePrefix=p?"":d||"-",this.unescapeSuffix=this.unescapePrefix?"":p||"",this.nestingPrefix=f?Ho(f):h||Ho("$t("),this.nestingSuffix=g?Ho(g):b||Ho(")"),this.nestingOptionsSeparator=k||",",this.maxReplaces=y||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,a;const c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=h=>{if(h.indexOf(this.formatSeparator)<0){const y=bS(n,c,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(y,void 0,r,{...i,...n,interpolationkey:h}):y}const g=h.split(this.formatSeparator),b=g.shift().trim(),k=g.join(this.formatSeparator).trim();return this.format(bS(n,c,b,this.options.keySeparator,this.options.ignoreJSONStructure),k,r,{...i,...n,interpolationkey:b})};this.resetRegExp();const p=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,d=i&&i.interpolation&&i.interpolation.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>Rm(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?Rm(this.escape(h)):Rm(h)}].forEach(h=>{for(a=0;s=h.regex.exec(t);){const g=s[1].trim();if(o=u(g),o===void 0)if(typeof p=="function"){const k=p(t,s,i);o=ze(k)?k:""}else if(i&&Object.prototype.hasOwnProperty.call(i,g))o="";else if(d){o=s[0];continue}else this.logger.warn(`missed to pass in variable ${g} for interpolating ${t}`),o="";else!ze(o)&&!this.useRawValueToEscape&&(o=pS(o));const b=h.safeValue(o);if(t=t.replace(s[0],b),d?(h.regex.lastIndex+=o.length,h.regex.lastIndex-=s[0].length):h.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),t}nest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,s,o;const a=(c,u)=>{const p=this.nestingOptionsSeparator;if(c.indexOf(p)<0)return c;const d=c.split(new RegExp(`${p}[ ]*{`));let f=`{${d[1]}`;c=d[0],f=this.interpolate(f,o);const h=f.match(/'/g),g=f.match(/"/g);(h&&h.length%2===0&&!g||g.length%2!==0)&&(f=f.replace(/'/g,'"'));try{o=JSON.parse(f),u&&(o={...u,...o})}catch(b){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,b),`${c}${p}${f}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,c};for(;i=this.nestingRegexp.exec(t);){let c=[];o={...r},o=o.replace&&!ze(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(d=>d.trim());i[1]=p.shift(),c=p,u=!0}if(s=n(a.call(this,i[1].trim(),o),o),s&&i[0]===t&&!ze(s))return s;ze(s)||(s=pS(s)),s||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${t}`),s=""),u&&(s=c.reduce((p,d)=>this.format(p,d,r.lng,{...r,interpolationkey:i[1].trim()}),s.trim())),t=t.replace(i[0],s),this.regexp.lastIndex=0}return t}}const rV=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[a,...c]=o.split(":"),u=c.join(":").trim().replace(/^'+|'+$/g,""),p=a.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}},Uo=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 a=t[o];return a||(a=e(ip(r),i),t[o]=a),a(n)}};class iV{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=li.create("formatter"),this.options=t,this.formats={number:Uo((n,r)=>{const i=new Intl.NumberFormat(n,{...r});return s=>i.format(s)}),currency:Uo((n,r)=>{const i=new Intl.NumberFormat(n,{...r,style:"currency"});return s=>i.format(s)}),datetime:Uo((n,r)=>{const i=new Intl.DateTimeFormat(n,{...r});return s=>i.format(s)}),relativetime:Uo((n,r)=>{const i=new Intl.RelativeTimeFormat(n,{...r});return s=>i.format(s,r.range||"day")}),list:Uo((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()]=Uo(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(a=>a.indexOf(")")>-1)){const a=s.findIndex(c=>c.indexOf(")")>-1);s[0]=[s[0],...s.splice(1,a)].join(this.formatSeparator)}return s.reduce((a,c)=>{const{formatName:u,formatOptions:p}=rV(c);if(this.formats[u]){let d=a;try{const f=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},h=f.locale||f.lng||i.locale||i.lng||r;d=this.formats[u](a,h,{...p,...i,...f})}catch(f){this.logger.warn(f)}return d}else this.logger.warn(`there was no format function for ${u}`);return a},t)}}const sV=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class oV extends Kp{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=li.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={},a={},c={};return t.forEach(u=>{let p=!0;n.forEach(d=>{const f=`${u}|${d}`;!r.reload&&this.store.hasResourceBundle(u,d)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?o[f]===void 0&&(o[f]=!0):(this.state[f]=1,p=!1,o[f]===void 0&&(o[f]=!0),s[f]===void 0&&(s[f]=!0),c[d]===void 0&&(c[d]=!0)))}),p||(a[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(a),toLoadNamespaces:Object.keys(c)}}loaded(t,n,r){const i=t.split("|"),s=i[0],o=i[1];n&&this.emit("failedLoading",s,o,n),!n&&r&&this.store.addResourceBundle(s,o,r,void 0,void 0,{skipCopy:!0}),this.state[t]=n?-1:2,n&&r&&(this.state[t]=0);const a={};this.queue.forEach(c=>{BU(c.loaded,[s],o),sV(c,t),n&&c.errors.push(n),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(u=>{a[u]||(a[u]={});const p=c.loaded[u];p.length&&p.forEach(d=>{a[u][d]===void 0&&(a[u][d]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(c=>!c.done)}read(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,o=arguments.length>5?arguments[5]:void 0;if(!t.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:i,wait:s,callback:o});return}this.readingCalls++;const a=(u,p)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.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)},c=this.backend[r].bind(this.backend);if(c.length===2){try{const u=c(t,n);u&&typeof u.then=="function"?u.then(p=>a(null,p)).catch(a):a(null,u)}catch(u){a(u)}return}return c(t,n,a)}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();ze(t)&&(t=this.languageUtils.toResolveHierarchy(t)),ze(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,a)=>{o&&this.logger.warn(`${n}loading namespace ${s} for language ${i} failed`,o),!o&&a&&this.logger.log(`${n}loaded namespace ${s} for language ${i}`,a),this.loaded(t,o,a)})}saveMissing(t,n,r,i,s){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend&&this.backend.create){const c={...o,isUpdate:s},u=this.backend.create.bind(this.backend);if(u.length<6)try{let p;u.length===5?p=u(t,n,r,i,c):p=u(t,n,r,i),p&&typeof p.then=="function"?p.then(d=>a(null,d)).catch(a):a(null,p)}catch(p){a(p)}else u(t,n,r,i,a,c)}!t||!t[0]||this.store.addResource(t[0],n,r,i)}}}const kS=()=>({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]),ze(e[1])&&(t.defaultValue=e[1]),ze(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}}),SS=e=>(ze(e.ns)&&(e.ns=[e.ns]),ze(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),ze(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),zd=()=>{},aV=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class qc extends Kp{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=SS(t),this.services={},this.logger=li,this.modules={external:[]},aV(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&&(ze(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const i=kS();this.options={...i,...this.options,...SS(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?li.init(s(this.modules.logger),this.options):li.init(null,this.options);let p;this.modules.formatter?p=this.modules.formatter:typeof Intl<"u"&&(p=iV);const d=new wS(this.options);this.store=new yS(this.options.resources,this.options);const f=this.services;f.logger=li,f.resourceStore=this.store,f.languageUtils=d,f.pluralResolver=new tV(d,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),p&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(f.formatter=s(p),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new nV(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new oV(s(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(h){for(var g=arguments.length,b=new Array(g>1?g-1:0),k=1;k<g;k++)b[k-1]=arguments[k];t.emit(h,...b)}),this.modules.languageDetector&&(f.languageDetector=s(this.modules.languageDetector),f.languageDetector.init&&f.languageDetector.init(f,this.options.detection,this.options)),this.modules.i18nFormat&&(f.i18nFormat=s(this.modules.i18nFormat),f.i18nFormat.init&&f.i18nFormat.init(this)),this.translator=new op(this.services,this.options),this.translator.on("*",function(h){for(var g=arguments.length,b=new Array(g>1?g-1:0),k=1;k<g;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=zd),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const p=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);p.length>0&&p[0]!=="dev"&&(this.options.lng=p[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(p=>{this[p]=function(){return t.store[p](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(p=>{this[p]=function(){return t.store[p](...arguments),t}});const c=zl(),u=()=>{const p=(d,f)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),c.resolve(f),r(d,f)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return p(null,this.t.bind(this));this.changeLanguage(this.options.lng,p)};return this.options.resources||!this.options.initImmediate?u():setTimeout(u,0),c}loadResources(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:zd;const i=ze(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=a=>{if(!a||a==="cimode")return;this.services.languageUtils.toResolveHierarchy(a).forEach(u=>{u!=="cimode"&&s.indexOf(u)<0&&s.push(u)})};i?o(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(c=>o(c)),this.options.preload&&this.options.preload.forEach(a=>o(a)),this.services.backendConnector.load(s,this.options.ns,a=>{!a&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(a)})}else r(null)}reloadResources(t,n,r){const i=zl();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=zd),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"&&f_.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=zl();this.emit("languageChanging",t);const s=c=>{this.language=c,this.languages=this.services.languageUtils.toResolveHierarchy(c),this.resolvedLanguage=void 0,this.setResolvedLanguage(c)},o=(c,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(c,function(){return r.t(...arguments)})},a=c=>{!t&&!c&&this.services.languageDetector&&(c=[]);const u=ze(c)?c:this.services.languageUtils.getBestMatchFromCodes(c);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?a(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(t),i}getFixedT(t,n,r){var i=this;const s=function(o,a){let c;if(typeof a!="object"){for(var u=arguments.length,p=new Array(u>2?u-2:0),d=2;d<u;d++)p[d-2]=arguments[d];c=i.options.overloadTranslationOptionHandler([o,a].concat(p))}else c={...a};c.lng=c.lng||s.lng,c.lngs=c.lngs||s.lngs,c.ns=c.ns||s.ns,c.keyPrefix!==""&&(c.keyPrefix=c.keyPrefix||r||s.keyPrefix);const f=i.options.keySeparator||".";let h;return c.keyPrefix&&Array.isArray(o)?h=o.map(g=>`${c.keyPrefix}${f}${g}`):h=c.keyPrefix?`${c.keyPrefix}${f}${o}`:o,i.t(h,c)};return ze(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=(a,c)=>{const u=this.services.backendConnector.state[`${a}|${c}`];return u===-1||u===0||u===2};if(n.precheck){const a=n.precheck(this,o);if(a!==void 0)return a}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=zl();return this.options.ns?(ze(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=zl();ze(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 wS(kS());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 qc(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:zd;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const i={...this.options,...t,isClone:!0},s=new qc(i);return(t.debug!==void 0||t.prefix!==void 0)&&(s.logger=s.logger.clone(t)),["store","services","language"].forEach(a=>{s[a]=this[a]}),s.services={...this.services},s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},r&&(s.store=new yS(this.store.data,i),s.services.resourceStore=s.store),s.translator=new op(s.services,i),s.translator.on("*",function(a){for(var c=arguments.length,u=new Array(c>1?c-1:0),p=1;p<c;p++)u[p-1]=arguments[p];s.emit(a,...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 fn=qc.createInstance();fn.createInstance=qc.createInstance;fn.createInstance;fn.dir;fn.init;fn.loadResources;fn.reloadResources;fn.use;fn.changeLanguage;fn.getFixedT;fn.t;fn.exists;fn.setDefaultNamespace;fn.hasLoadedNamespace;fn.loadNamespaces;fn.loadLanguages;function lV(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Gc(e){"@babel/helpers - typeof";return Gc=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},Gc(e)}function cV(e,t){if(Gc(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Gc(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function uV(e){var t=cV(e,"string");return Gc(t)=="symbol"?t:t+""}function dV(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,uV(r.key),r)}}function fV(e,t,n){return t&&dV(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var p_=[],pV=p_.forEach,hV=p_.slice;function mV(e){return pV.call(hV.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}var NS=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,gV=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 a=i.maxAge-0;if(Number.isNaN(a))throw new Error("maxAge should be a Number");o+="; Max-Age=".concat(Math.floor(a))}if(i.domain){if(!NS.test(i.domain))throw new TypeError("option domain is invalid");o+="; Domain=".concat(i.domain)}if(i.path){if(!NS.test(i.path))throw new TypeError("option path is invalid");o+="; Path=".concat(i.path)}if(i.expires){if(typeof i.expires.toUTCString!="function")throw new TypeError("option expires is invalid");o+="; Expires=".concat(i.expires.toUTCString())}if(i.httpOnly&&(o+="; HttpOnly"),i.secure&&(o+="; Secure"),i.sameSite){var c=typeof i.sameSite=="string"?i.sameSite.toLowerCase():i.sameSite;switch(c){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return o},jS={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=gV(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)}},yV={name:"cookie",lookup:function(t){var n;if(t.lookupCookie&&typeof document<"u"){var r=jS.read(t.lookupCookie);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupCookie&&typeof document<"u"&&jS.create(n.lookupCookie,t,n.cookieMinutes,n.cookieDomain,n.cookieOptions)}},xV={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 a=s[o].indexOf("=");if(a>0){var c=s[o].substring(0,a);c===t.lookupQuerystring&&(n=s[o].substring(a+1))}}}return n}},Bl=null,CS=function(){if(Bl!==null)return Bl;try{Bl=window!=="undefined"&&window.localStorage!==null;var t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{Bl=!1}return Bl},wV={name:"localStorage",lookup:function(t){var n;if(t.lookupLocalStorage&&CS()){var r=window.localStorage.getItem(t.lookupLocalStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupLocalStorage&&CS()&&window.localStorage.setItem(n.lookupLocalStorage,t)}},Hl=null,ES=function(){if(Hl!==null)return Hl;try{Hl=window!=="undefined"&&window.sessionStorage!==null;var t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{Hl=!1}return Hl},vV={name:"sessionStorage",lookup:function(t){var n;if(t.lookupSessionStorage&&ES()){var r=window.sessionStorage.getItem(t.lookupSessionStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupSessionStorage&&ES()&&window.sessionStorage.setItem(n.lookupSessionStorage,t)}},bV={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}},kV={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}},SV={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}},NV={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]}},h_=!1;try{document.cookie,h_=!0}catch{}var m_=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];h_||m_.splice(1,1);function jV(){return{order:m_,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(t){return t}}}var g_=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};lV(this,e),this.type="languageDetector",this.detectors={},this.init(t,n)}return fV(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=mV(r,this.options||{},jV()),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(yV),this.addDetector(xV),this.addDetector(wV),this.addDetector(vV),this.addDetector(bV),this.addDetector(kV),this.addDetector(SV),this.addDetector(NV)}},{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)}))}}])}();g_.type="languageDetector";const CV={name:"AgentFlow",tagline:"AI Workflow Orchestration"},EV={projects:"Projects",nodes:"Nodes",skills:"Skills",flowEditor:"Flow Editor",settings:"Settings",back:"Back"},PV={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"},_V={success:"Success",failed:"Failed",pending:"Pending",running:"Running",skipped:"Skipped"},IV={agent:"Agent",control:"Control",tool:"Tool",start:"Start",end:"End"},AV={online:"Engine Online",offline:"Engine Offline",connecting:"Connecting…"},TV={hub:"AgentFlow Hub",docs:"Documentation",github:"GitHub Repository"},RV={app:CV,nav:EV,common:PV,status:_V,nodeTypes:IV,engine:AV,links:TV},LV="Flow Editor",OV="Nodes",MV="Edges",DV="Properties",$V={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"},FV={title:"Node Properties",noInputPins:"No input pins",noOutputPins:"No output pins",type:"Type",name:"Name",defaultValue:"Default / value",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:"Instance 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}}"},zV={run:"Run Flow",stop:"Stop",resume:"Resume",validate:"Validate",export:"Export",import:"Import"},BV={nodeList:"Node List",runHistory:"Run History",validation:"Validation Results"},HV={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"},UV={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)"},VV={saving:"Saving...",saved:"Saved",saveFailed:"Save failed",runInTerminal:"Please use terminal to run"},WV={requirement:"Requirement Analysis",planning:"Technical Planning",code:"Code Execution",test:"Test Regression",normal:"Normal"},KV={phase:"Phase",allPhasesComplete:"All phases completed",currentPhaseComplete:"Current phase completed, waiting for confirmation..."},YV={node:"Node",text:"Text",file:"File",bool:"Boolean"},qV={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"},GV={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",canvas:"Canvas",selectTool:"Select Tool",panTool:"Pan Tool",holdSpacePan:"Hold Space to temporarily pan",selectAll:"Select all nodes"},XV={title:"Jump to node",placeholder:"Type node ID or label…",empty:"No matching nodes",hintNavigate:"navigate",hintJump:"jump",hintClose:"close"},JV={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."},QV={mainNav:"Main Navigation"},ZV={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'},eW={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):
|
|
136
|
-
{{summary}}`,step:"Step {{current}}/{{total}}: {{description}}",phaseGeneration:`Phased generation ({{count}} phases): {{labels}}
|
|
137
|
-
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}}"},tW={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"},nW={nodePalette:"Node Palette",noPipelineSelected:"No pipeline selected",moreRuns:"+{{count}} more",moreFlows:"+{{count}} more flows",runId:"Run ID: {{id}}"},rW={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}}"},iW={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"},sW={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"},oW={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"},aW={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"},lW={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"},cW={invalidPlaceholder:"Invalid placeholder: {{hint}}",empty:"(empty)",inputSubtitle:"Input · {{type}}",inputSubtitleNoType:"Input",outputSubtitle:"Output · {{type}}",outputSubtitleNoType:"Output",runtimeConst:"Runtime constant"},uW={justNow:"Just now",minutesAgo:"{{n}} min ago",hoursAgo:"{{n}} hr ago",yesterday:"Yesterday",daysAgo:"{{n}} days ago",milliseconds:"{{n}} ms",seconds:"{{n}} s"},dW={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"},fW={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."},pW={title:"Print Output: {{instanceId}}",expand:"Expand",restore:"Restore"},hW={save:"Save",cancel:"Cancel"},mW={title:"Run with Params",noParams:"No input params in this flow",run:"Run",cancel:"Cancel"},gW={title:"Run with Preset",noPresets:"No presets available",default:"Default run",run:"Run",cancel:"Cancel"},yW={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"},xW={title:LV,nodes:OV,edges:MV,properties:DV,node:$V,nodeProps:FV,actions:zV,panel:BV,palette:HV,pipeline:UV,status:VV,roles:WV,phases:KV,types:YV,runContext:qV,shortcuts:GV,jumpPalette:XV,emptyCanvas:JV,sidebar:QV,validation:ZV,composer:eW,topbar:tW,palette2:nW,run:rW,fileEdit:iW,settings:sW,schedule:oW,history:aW,nodePropsError:lW,placeholder:cW,time:uW,userCheck:dW,userAsk:fW,toolPrint:pW,provideEdit:hW,runParams:mW,runPreset:gW,runConfig:yW},wW="Settings",vW={engine:"Engine Settings",preferences:"Global Preferences"},bW={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)."},kW={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..."}},SW={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."},NW={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."},jW={title:"Environment Variables",note:"Local machine, this browser only",key:"Key",value:"Value",add:"Add",delete:"Delete {{key}}",newKey:"New env key",newValue:"Value (be careful with secrets)"},CW={title:"System Status",normal:"Service normal",abnormal:"Some interfaces abnormal",cursorModels:"Cursor Models",opencodeModels:"OpenCode Models",claudeCodeModels:"Claude Code Models"},EW={title:"Shortcuts",projects:"Projects & Pipelines",flowEditor:"Node Canvas"},PW={title:"Language",description:"Select your preferred language for the interface",options:{zh:"中文",en:"English",ja:"日本語"}},_W={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."},IW={title:wW,crumb:vW,workspace:bW,cursor:kW,opencode:SW,claudeCode:NW,env:jW,system:CW,shortcuts:EW,language:PW,onboarding:_W},AW={thinking:"Thinking",result:"Result",reply:"Reply",error:"Error"},TW={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)"},RW={send:"Send",stop:"Stop",expand:"Expand",collapse:"Collapse",clear:"Clear"},LW={conversation:"Chat",conversationWithNumber:"Chat {{num}}",default:"Default"},OW={endSession:"End chat (will stop generation)",closeSession:"Close chat",newSession:"New chat",expandComposer:"Expand chat and output"},MW={hint:"Use the bottom input box for AI chat, with @node mentions, model selection, and more"},DW={aiLabels:AW,placeholders:TW,actions:RW,labels:LW,tooltips:OW,rightPanel:MW},$W="Projects",FW="All",zW="Archived",BW="Nodes",HW="Skills",UW="Active Projects",VW="Archived Pipelines",WW="Global Nodes",KW="Global Skills",YW="Create New Project",qW="New Pipeline",GW="SEARCH PIPELINES...",XW="SEARCH NODES...",JW="SEARCH SKILLS...",QW="Refresh Resources",ZW="Loading pipelines...",e7="Loading global resources...",t7="Filter result: {{count}} items (matching title, description, path and tags)",n7="Archived pipelines can still be opened and edited; files are located in the _archived subdirectory of each pipelines directory.",r7="Manage your distributed node architectures and monitoring pipelines. Drag flow.yaml or .zip into this page to import shared flows.",i7="Review all globally available node definitions, {{count}} total, including built-in, workspace, and marketplace nodes.",s7="Review Composer-selectable skills, {{count}} total, including AgentFlow built-ins and workspace skills.",o7="Executable building blocks for pipeline runtime",a7="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.",l7="Operating guides for Composer and agents",c7="Skills tell AI which rules to follow for a task, how to change flows, and how to reuse project conventions.",u7="No archived projects.",d7="No active pipelines; archived items are in the Archived tab.",f7="No global nodes available.",p7="No skills available.",h7="No description.",m7='No node matches "{{query}}".',g7='No skill matches "{{query}}".',y7="{{inputs}} in / {{outputs}} out",x7="Skill",w7="Node detail",v7="Skill detail",b7="Type",k7="Source",S7="Package",N7="Version",j7="Path",C7="Editable",E7="Read only",P7="Editable",_7="Schema",I7="Inputs",A7="Outputs",T7="Runtime",R7="Node Body",L7="Files",O7="Usage",M7="No runtime manifest.",D7="No node body or README.",$7="No previewable files.",F7="Select a file to preview.",z7="Binary file preview is not supported.",B7="Large file; showing the first 256KB only.",H7="No pipelines using this node were found.",U7="No slots",V7="Purpose",W7="This node is an execution unit in a pipeline. Its schema affects canvas wiring, parameter input, and runtime scheduling.",K7="This skill is injected into Composer as context for AI, constraining its decisions, edit strategy, and output format.",Y7="SKILL.md Preview",q7="No preview content available.",G7="Select a resource to inspect details.",X7="Failed to load pipeline list.",J7="No pipelines in current workspace.",Q7="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.",Z7='No pipelines found matching "{{query}}". Try different keywords or clear the search.',eK="Recent Activity",tK="No recent activity",nK="No recent activity matching the keyword",rK="Recent Run",iK="Recent Open",sK={builtin:"Built-in",workspace:"Workspace",user:"User"},oK={flow:"Flow",global:"Global",marketplace:"Marketplace"},aK={all:"All",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},lK={overview:"Overview",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},cK="Open to edit this pipeline in the node canvas.",uK={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>"},dK={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"},fK={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"},pK={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"},hK={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"},mK={title:$W,all:FW,archived:zW,nodes:BW,skills:HW,activeProjects:UW,archivedPipelines:VW,globalNodes:WW,globalSkills:KW,createNew:YW,newPipeline:qW,searchPipelines:GW,searchNodes:XW,searchSkills:JW,refreshResources:QW,loadingPipelines:ZW,loadingResources:e7,filterResult:t7,archivedHint:n7,activeHint:r7,nodesHint:i7,skillsHint:s7,nodesPurposeTitle:o7,nodesPurposeDesc:a7,skillsPurposeTitle:l7,skillsPurposeDesc:c7,noArchived:u7,noActive:d7,noNodes:f7,noSkills:p7,noDescription:h7,noNodeMatch:m7,noSkillMatch:g7,nodeSlots:y7,skill:x7,nodeDetail:w7,skillDetail:v7,detailType:b7,detailSource:k7,detailPackage:S7,detailVersion:N7,detailPath:j7,detailEditable:C7,readOnly:E7,editable:P7,nodeSchema:_7,nodeInputs:I7,nodeOutputs:A7,nodeRuntime:T7,nodeBody:R7,nodeFiles:L7,nodeUsage:O7,noRuntimeManifest:M7,noNodeBody:D7,noNodeFiles:$7,selectNodeFile:F7,binaryFile:z7,fileTruncated:B7,noNodeUsage:H7,noSlots:U7,resourceMeaning:V7,nodesMeaning:W7,skillsMeaning:K7,skillPreview:Y7,skillPreviewEmpty:q7,selectResource:G7,loadFailed:X7,noPipelines:J7,emptyHint:Q7,noMatch:Z7,recentActivity:eK,noRecentActivity:tK,noMatchRecent:nK,recentRun:rK,recentOpen:iK,sourceBadge:sK,resourceSource:oK,resourceFilter:aK,nodeDetailTabs:lK,defaultCardDesc:cK,hubCard:uK,newPipelineModal:dK,importModal:fK,deleteModal:pK,archiveModal:hK},gK="Back",yK="Next",xK="Skip",wK="Done",vK="Start Creating",bK={intro:`Welcome to AgentFlow! This is a visual workflow orchestration tool.
|
|
138
|
-
|
|
139
|
-
Click the button below to create your first pipeline.`,hubIntro:`Don't want to start from scratch?
|
|
140
|
-
|
|
141
|
-
Browse ready-made pipelines on AgentFlow Hub — community-shared flows you can install and run in one click.`},kK={intro:`Now you're in the flow editor.
|
|
142
|
-
|
|
143
|
-
Describe your requirements in natural language in the input box below, and AI will generate the flow graph.
|
|
144
|
-
|
|
145
|
-
The left node panel allows you to freely drag, delete, and adjust connections.`,introEmpty:`The canvas is empty. Start creating your flow!
|
|
146
|
-
|
|
147
|
-
Describe your requirements in natural language in the input box below, and AI will generate the flow graph.
|
|
148
|
-
|
|
149
|
-
The left node panel allows you to freely drag, delete, and adjust connections.`},SK={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"},NK={back:gK,next:yK,skip:xK,done:wK,startCreate:vK,projects:bK,flow:kK,newPipeline:SK},jK={name:"AgentFlow",tagline:"AI 工作流编排"},CK={projects:"项目",nodes:"Nodes",skills:"Skills",flowEditor:"流程编辑器",settings:"设置",back:"返回"},EK={loading:"加载中…",saving:"保存中…",save:"保存",cancel:"取消",delete:"删除",edit:"编辑",create:"创建",close:"关闭",confirm:"确认",copy:"复制",copied:"已复制!",refresh:"刷新",search:"搜索",filter:"筛选",success:"成功",error:"错误",warning:"警告",info:"信息",done:"完成",pending:"待处理",running:"运行中",notFound:"未找到",required:"必填",optional:"可选"},PK={success:"成功",failed:"失败",pending:"等待",running:"运行中",skipped:"跳过"},_K={agent:"Agent 节点",control:"控制节点",tool:"工具节点",start:"开始",end:"结束"},IK={online:"引擎在线",offline:"引擎离线",connecting:"连接中…"},AK={hub:"AgentFlow Hub",docs:"文档",github:"GitHub 仓库"},TK={app:jK,nav:CK,common:EK,status:PK,nodeTypes:_K,engine:IK,links:AK},RK="流程编辑器",LK="节点",OK="连线",MK="属性",DK={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:"编辑内容"},$K={title:"节点属性",noInputPins:"当前无输入引脚",noOutputPins:"当前无输出引脚",type:"类型",name:"名称",defaultValue:"默认值 / value",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}}"},FK={run:"运行流程",stop:"停止",resume:"继续",validate:"校验",export:"导出",import:"导入"},zK={nodeList:"节点列表",runHistory:"运行历史",validation:"校验结果"},BK={workspace:"工作区",loading:"加载中…",archived:"已归档",noPipelines:"暂无流水线",more:"更多",moreFlows:"更多流程",noRuns:"暂无运行记录",searchNodes:"搜索节点",noComponents:"暂无可用组件(检查节点库目录)",noMatch:"无匹配节点,请调整搜索词",selectPipeline:"从上方选择一条流水线以加载组件与画布",validationWarnings:"校验警告(与 agentflow validate 槽位检查一致)",output:"输出",model:"模型",userDir:"用户目录",toggleRecentActivity:"展开或收起最近打开或最近运行"},HK={selectPipeline:"请从顶部下拉选择一条流水线",loadingProps:"加载节点属性…",pipelineId:"流水线 ID",diskPath:"磁盘路径",storageLocation:"存储位置",introduction:"介绍",introductionPlaceholder:"简要描述这条流水线的用途(写入 flow.yaml 的 ui.description)",metadata:"元数据",nodeCount:"节点数",nodesUnit:"个节点",loading:"加载中…",noRuns:"暂无运行记录(终端执行后会在工作区生成运行目录)"},UK={saving:"保存中…",saved:"已保存",saveFailed:"保存失败",runInTerminal:"运行请使用终端"},VK={requirement:"需求拆解",planning:"技术规划",code:"代码执行",test:"测试回归",normal:"普通"},WK={phase:"阶段",allPhasesComplete:"所有阶段完成",currentPhaseComplete:"当前阶段完成,等待确认继续…"},KK={node:"节点",text:"文本",file:"文件",bool:"布尔"},YK={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:"等待"},qK={title:"快捷键",general:"常规",saveDesc:"保存;节点属性侧栏打开时先提交节点再保存 flow",shortcutsLabel:"快捷键",jumpToNode:"按 ID 跳转到节点",canvas:"画布",selectTool:"选择工具",panTool:"平移工具",holdSpacePan:"按住空格临时平移",selectAll:"全选所有节点"},GK={title:"跳转到节点",placeholder:"输入节点 ID 或名称…",empty:"未匹配到节点",hintNavigate:"切换",hintJump:"跳转",hintClose:"关闭"},XK={title:"开始构建你的流程",text:"在下方 AI 输入框中描述你的流程,或从左侧面板拖拽节点到画布",composerHint:"使用 AI Composer 构建 AgentFlow",composerSub:"从左侧拖入节点,或在<strong>下方输入框</strong>中用自然语言描述工作流。<br/>按 <kbd>?</kbd> 查看快捷键。"},JK={mainNav:"主导航"},QK={flowWarningAriaLabel:"流程校验警告",reloadFromServer:"从服务器重新加载流程并刷新校验",reloadFromServerShort:"从服务器重新加载",closeBanner:"关闭校验警告横幅",nodePrefix:"节点",focusNodeAriaLabel:"在画布中选中并定位节点 {{nodeId}}",slotWarningCount:"槽位校验 {{count}} 条(已隐藏)",show:"显示",shortcutHint:"按 ? 查看快捷键",shortcutHintLabel:"快捷键",inputSlotNoEdge:' 的 input 槽位 "{{slotName}}"({{handle}})无对应 edge 连接',outputSlotNoEdge:' 的 output 槽位 "{{slotName}}"({{handle}})无对应 edge 连接'},ZK={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}} 步):
|
|
150
|
-
{{summary}}`,step:"步骤 {{current}}/{{total}}: {{description}}",phaseGeneration:`分阶段生成({{count}} 阶段):{{labels}}
|
|
151
|
-
当前:{{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}}"},eY={currentPipeline:"当前流水线",backToEdit:"返回编辑",backToProjects:"返回项目",executionLog:"执行日志",history:"历史",pipelineSettings:"流水线设置",shortcutsLabel:"快捷键",shortcutsTitle:"快捷键 (?)",deletePipeline:"删除流水线",resumeTitle:"在同一 run 目录继续执行(uuid={{uuid}})",resumeTitleNoUuid:"尚未收到 apply-start,将发起新的 run",rerunTitle:"从头开始新的运行",runOptions:"运行选项",runWithParams:"带参数运行",runWithPreset:"指定预设运行",editRun:"编辑运行参数",startRun:"开始执行",stopRun:"停止后台运行"},tY={nodePalette:"节点调色板",noPipelineSelected:"未选择流水线",moreRuns:"+{{count}} 更多",moreFlows:"+{{count}} 更多流程",runId:"运行 ID: {{id}}"},nY={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}} 的分支"},rY={close:"关闭",loading:"加载中…",placeholder:"文件内容",largeFileWarning:"文件较大,编辑器性能可能受影响",reset:"重置",aiEdit:"AI 修改",aiRunning:"AI 处理中…",save:"保存",saving:"保存中…",saved:"已保存"},iY={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:"已复制"},sY={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:"定时配置已保存"},oY={title:"执行历史",summary:"执行结果汇总",successCount:"{{count}} 成功",failedCount:"{{count}} 失败",stoppedCount:"{{count}} 已停止",interruptedCount:"{{count}} 已中断",runningCount:"{{count}} 进行中",success:"成功",failed:"失败",stopped:"已停止",interrupted:"已中断",running:"进行中",unknown:"未知",runLabel:"运行 #{{id}}",enterRunView:"进入该次运行的画布与日志态"},aY={invalidInstanceId:"实例 ID 格式无效:仅允许英文字母、数字、下划线、短横线,且不能以数字开头。",duplicateInstanceId:"该实例 ID 已存在,请换一个。",loadFlowFailed:"读取 flow 失败",loadNodesFailed:"读取节点库失败"},lY={invalidPlaceholder:"无效占位符: {{hint}}",empty:"(空)",inputSubtitle:"输入 · {{type}}",inputSubtitleNoType:"输入",outputSubtitle:"输出 · {{type}}",outputSubtitleNoType:"输出",runtimeConst:"运行时常量"},cY={justNow:"刚刚",minutesAgo:"{{n}} 分钟前",hoursAgo:"{{n}} 小时前",yesterday:"昨天",daysAgo:"{{n}} 天前",milliseconds:"{{n}} 毫秒",seconds:"{{n}} 秒"},uY={title:"用户确认 ({{instanceId}})",edit:"编辑",save:"保存",cancel:"取消",aiEditPlaceholder:"输入 AI 修改指令,如:删除第二项、合并前两项…",aiEditBtn:"AI 修改",aiEditStarted:"AI 正在修改内容…",aiEditDone:"AI 修改完成",aiEditFailed:"AI 修改失败",contentSaved:"内容已保存",saveFailed:"保存失败",close:"关闭",continue:"继续执行",hint:"编辑或使用 AI 修改后点击保存,然后点击「继续执行」恢复流程"},dY={title:"用户选择 ({{instanceId}})",hint:"请从下方选项中选择一项以继续流程",submitting:"提交中…",submitFailed:"提交失败",close:"关闭",noOptions:"该节点未配置选项,请先在编辑器中为 output 槽位添加条目。"},fY={title:"Print 输出: {{instanceId}}",expand:"放大",restore:"还原"},pY={save:"保存",cancel:"取消"},hY={title:"带参数运行",noParams:"此流程无输入参数",run:"运行",cancel:"取消"},mY={title:"指定预设运行",noPresets:"无可用预设",default:"默认运行",run:"运行",cancel:"取消"},gY={preset:"预设",default:"默认",newPreset:"新建预设",deletePreset:"删除预设",presetNamePlaceholder:"预设名称",inputParams:"输入参数",noProvideNodes:"此流程无 provide 节点",filePathPlaceholder:"文件路径…",stringValuePlaceholder:"值…",presetSaved:"预设已保存",presetDeleted:"预设已删除",savePreset:"保存当前预设",expandInput:"编辑内容"},yY={title:RK,nodes:LK,edges:OK,properties:MK,node:DK,nodeProps:$K,actions:FK,panel:zK,palette:BK,pipeline:HK,status:UK,roles:VK,phases:WK,types:KK,runContext:YK,shortcuts:qK,jumpPalette:GK,emptyCanvas:XK,sidebar:JK,validation:QK,composer:ZK,topbar:eY,palette2:tY,run:nY,fileEdit:rY,settings:iY,schedule:sY,history:oY,nodePropsError:aY,placeholder:lY,time:cY,userCheck:uY,userAsk:dY,toolPrint:fY,provideEdit:pY,runParams:hY,runPreset:mY,runConfig:gY},xY="设置",wY={engine:"引擎设置",preferences:"全局首选项"},vY={title:"工作区",currentPath:"当前工作区根目录",placeholder:"加载中…",copyPath:"复制路径",description:"流水线与节点清单将相对于此目录解析(由启动 UI 时传入)。"},bY={title:"Cursor CLI",status:{cached:"已缓存",notCached:"未缓存"},modelPreviewLabel:"Cursor 模型名称列表",modelList:{cached:"模型清单已缓存",empty:"暂无模型列表",count:"{{count}} 条",fetchedAt:"更新 {{time}}",never:"尚未拉取",refresh:"刷新清单",fetching:"拉取中…"}},kY={modelPreviewLabel:"OpenCode 模型名称列表",title:"OpenCode CLI",status:{ready:"就绪",notFound:"未找到"},provider:"方案 / Provider 标识",providerPlaceholder:"例如 bailian-coding-plan",saving:"正在保存并更新清单…",description:"对应 CLI opencode models <provider> 的参数;停止输入后会写入用户目录 config 并刷新 model-lists.json。"},SY={title:"Claude Code CLI",status:{ready:"就绪",notFound:"未找到"},modelPreviewLabel:"Claude Code 模型名称列表",description:"内置模型列表(Claude Code CLI 无 models 子命令);刷新将探测 claude 二进制是否在 PATH 中。首次使用请先执行 claude /login。"},NY={title:"环境变量",note:"仅本机、本浏览器",key:"键",value:"值",add:"添加",delete:"删除 {{key}}",newKey:"新环境变量键",newValue:"值(密钥请谨慎)"},jY={title:"系统状态",normal:"服务正常",abnormal:"部分接口异常",cursorModels:"Cursor 模型",opencodeModels:"OpenCode 模型",claudeCodeModels:"Claude Code 模型"},CY={title:"快捷入口",projects:"项目与流水线",flowEditor:"节点画布"},EY={title:"语言",description:"选择界面显示语言",options:{zh:"中文",en:"English",ja:"日本語"}},PY={title:"新手引导",description:"重新启动产品引导流程,了解 AgentFlow 的核心功能。",reset:"重置引导",resetSuccess:"已重置,下次访问将自动启动引导"},_Y={title:xY,crumb:wY,workspace:vY,cursor:bY,opencode:kY,claudeCode:SY,env:NY,system:jY,shortcuts:CY,language:EY,onboarding:PY},IY={thinking:"思考",result:"结果",reply:"回复",error:"错误"},AY={input:"让 AI 协助编辑此节点…",waiting:"等待响应…",selectedEmpty:"在画布上选择节点,或在输入框用 @ 选择实例(Instances)或节点类型(Node)",textarea:"描述你的流程或让 AI 协助编辑(⌘/Ctrl+Enter 发送)"},TY={send:"发送",stop:"停止",expand:"展开",collapse:"收起",clear:"清空"},RY={conversation:"对话",conversationWithNumber:"对话 {{num}}",default:"默认"},LY={endSession:"结束对话(将停止生成)",closeSession:"关闭对话",newSession:"新建对话",expandComposer:"展开对话与输出"},OY={hint:"使用底部输入框进行 AI 对话,支持 @节点、选择模型等功能"},MY={aiLabels:IY,placeholders:AY,actions:TY,labels:RY,tooltips:LY,rightPanel:OY},DY="项目",$Y="全部",FY="已归档",zY="Nodes",BY="Skills",HY="活跃项目",UY="已归档流水线",VY="全局 Nodes",WY="全局 Skills",KY="创建新项目",YY="新建流水线",qY="搜索流水线…",GY="搜索 nodes…",XY="搜索 skills…",JY="刷新资源",QY="加载流水线列表…",ZY="加载全局资源…",eq="筛选结果:{{count}} 条(匹配标题、描述、路径与标签)",tq="已归档的流水线仍可打开与编辑;文件位于各 pipelines 目录下的 _archived。",nq="管理分布式节点架构与监控流水线。可将 flow.yaml 或 .zip 拖入本页导入分享流程。",rq="查看当前可用的全局节点定义,共 {{count}} 个;包含内置、工作区与 marketplace 节点。",iq="查看当前 Composer 可选择的 skills,共 {{count}} 个;包含 AgentFlow 内置与工作区 skills。",sq="流程运行时的可执行积木",oq="Nodes 决定画布上能拖什么、节点有哪些输入输出,以及运行时走 agent、control、provide 或 marketplace 哪类逻辑。",aq="Composer/Agent 的操作指南",lq="Skills 告诉 AI 在特定任务里应遵守什么规则、如何修改 flow、如何复用项目约定。",cq="暂无归档项目。",uq="暂无未归档流水线;已归档项在 Archived 标签中查看。",dq="暂无可用全局 nodes。",fq="暂无可用 skills。",pq="暂无描述。",hq="未找到与「{{query}}」匹配的 node。",mq="未找到与「{{query}}」匹配的 skill。",gq="{{inputs}} in / {{outputs}} out",yq="Skill",xq="Node 详情",wq="Skill 详情",vq="类型",bq="来源",kq="包",Sq="版本",Nq="路径",jq="可编辑",Cq="只读",Eq="可编辑",Pq="Schema",_q="输入",Iq="输出",Aq="Runtime",Tq="节点内容",Rq="Files",Lq="Usage",Oq="暂无 runtime manifest。",Mq="暂无节点正文或 README。",Dq="暂无可预览文件。",$q="请选择文件查看内容。",Fq="二进制文件暂不支持预览。",zq="文件较大,仅显示前 256KB。",Bq="暂未发现使用此 node 的流水线。",Hq="无槽位",Uq="作用",Vq="这个 node 是 pipeline 的执行单元。它的 schema 会影响画布连线、参数输入和运行时调度。",Wq="这个 skill 会作为 Composer 的上下文注入给 AI,用于约束 AI 的判断、修改方式和输出口径。",Kq="SKILL.md 预览",Yq="暂无可预览内容。",qq="请选择一个资源查看详情。",Gq="未能加载流水线列表。",Xq="当前工作区暂无流水线。",Jq="在仓库根目录执行 {{code1}} 并确认工作区包含 {{code2}} 或用户目录下的流水线;亦可点击 New Pipeline 新建。",Qq="未找到与「{{query}}」匹配的流水线。可尝试其他关键词,或点击清除搜索。",Zq="最近打开或最近运行",eG="暂无打开或运行记录",tG="暂无与关键词匹配的最近记录",nG="最近运行",rG="最近打开",iG={builtin:"内置",workspace:"工作区",user:"用户"},sG={flow:"Flow",global:"Global",marketplace:"Marketplace"},oG={all:"全部",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},aG={overview:"概览",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},lG="打开以在节点画布中编辑此流水线。",cG={eyebrow:"AgentFlow Hub",title:"浏览社区流程",desc:"发现并一键安装社区分享的现成流水线。",cta:"前往 Hub",cliHint:"或通过 CLI 安装:agentflow download <slug>"},uG={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:"关闭"},dG={title:"导入流水线",lead:"已选择文件「{{filename}}」。请确认流水线名称与保存位置;ZIP 将保留目录内脚本等文件。",nameLabel:"名称(必填)",namePlaceholder:"例如 my_shared_flow",nameHint:"须以英文字母开头,仅可使用字母、数字、下划线 _ 与连字符 -",locationLabel:"保存位置",userDir:"用户目录(~/agentflow/pipelines)",workspaceDir:"当前工作区(.workspace/agentflow/pipelines)",changeFile:"更换文件…",importFailed:"导入失败",importing:"导入中…",importAndOpen:"导入并打开",cancel:"取消",close:"关闭"},fG={title:"删除流水线",lead:"将永久删除磁盘上的流水线目录(含 flow.yaml、脚本等),无法撤销。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",deleteFailed:"删除失败",deleteTimeout:"删除请求超时,请重试(可先检查终端中的 UI 服务日志)",delete:"删除",deleting:"删除中…",confirmDelete:"确认删除",cancel:"取消",close:"关闭"},pG={title:"归档流水线",lead:"归档后流水线将移入「Archived」列表,仍可从该列表打开与编辑。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",archiveFailed:"归档失败",archive:"归档",archiving:"归档中…",confirmArchive:"确认归档",cancel:"取消",close:"关闭"},hG={title:DY,all:$Y,archived:FY,nodes:zY,skills:BY,activeProjects:HY,archivedPipelines:UY,globalNodes:VY,globalSkills:WY,createNew:KY,newPipeline:YY,searchPipelines:qY,searchNodes:GY,searchSkills:XY,refreshResources:JY,loadingPipelines:QY,loadingResources:ZY,filterResult:eq,archivedHint:tq,activeHint:nq,nodesHint:rq,skillsHint:iq,nodesPurposeTitle:sq,nodesPurposeDesc:oq,skillsPurposeTitle:aq,skillsPurposeDesc:lq,noArchived:cq,noActive:uq,noNodes:dq,noSkills:fq,noDescription:pq,noNodeMatch:hq,noSkillMatch:mq,nodeSlots:gq,skill:yq,nodeDetail:xq,skillDetail:wq,detailType:vq,detailSource:bq,detailPackage:kq,detailVersion:Sq,detailPath:Nq,detailEditable:jq,readOnly:Cq,editable:Eq,nodeSchema:Pq,nodeInputs:_q,nodeOutputs:Iq,nodeRuntime:Aq,nodeBody:Tq,nodeFiles:Rq,nodeUsage:Lq,noRuntimeManifest:Oq,noNodeBody:Mq,noNodeFiles:Dq,selectNodeFile:$q,binaryFile:Fq,fileTruncated:zq,noNodeUsage:Bq,noSlots:Hq,resourceMeaning:Uq,nodesMeaning:Vq,skillsMeaning:Wq,skillPreview:Kq,skillPreviewEmpty:Yq,selectResource:qq,loadFailed:Gq,noPipelines:Xq,emptyHint:Jq,noMatch:Qq,recentActivity:Zq,noRecentActivity:eG,noMatchRecent:tG,recentRun:nG,recentOpen:rG,sourceBadge:iG,resourceSource:sG,resourceFilter:oG,nodeDetailTabs:aG,defaultCardDesc:lG,hubCard:cG,newPipelineModal:uG,importModal:dG,deleteModal:fG,archiveModal:pG},mG="返回",gG="下一步",yG="跳过",xG="完成",wG="开始创建",vG={intro:`欢迎使用 AgentFlow!这是一个可视化流程编排工具。
|
|
152
|
-
|
|
153
|
-
点击下方按钮开始创建你的第一个流水线。`,hubIntro:`不想从零开始?
|
|
154
|
-
|
|
155
|
-
在 AgentFlow Hub 浏览社区分享的现成流水线,一键安装即可运行。`},bG={intro:`现在进入流程编辑器。
|
|
156
|
-
|
|
157
|
-
在下方输入框用自然语言描述你的需求,AI 会自动生成流程图。
|
|
158
|
-
|
|
159
|
-
左侧节点面板可以自由拖拽、删除和调整连接。`,introEmpty:`画布为空,开始创建你的流程吧!
|
|
160
|
-
|
|
161
|
-
在下方输入框用自然语言描述需求,AI 会自动生成流程图。
|
|
162
|
-
|
|
163
|
-
左侧节点面板可以自由拖拽、删除和调整连接。`},kG={guideTitle:"首次创建提示",guideDesc:"输入名称和描述后,AI 会自动生成流程图。你可以在编辑器中自由调整节点和连接。",nameHintGuide:"例如:MyFirstFlow(字母开头,支持数字和下划线)",descPlaceholderGuide:"例如:实现用户登录功能,包含注册、验证、授权",descHintGuide:"描述越详细,AI 生成的流程越准确",createGuide:"创建并开始编辑",typeNode:"节点引用类型",typeStr:"字符串类型",typeFile:"文件路径类型",typeBool:"布尔值类型"},SG={back:mG,next:gG,skip:yG,done:xG,startCreate:wG,projects:vG,flow:bG,newPipeline:kG},NG={en:{common:RV,flow:xW,settings:IW,composer:DW,project:mK,onboarding:NK},zh:{common:TK,flow:yY,settings:_Y,composer:MY,project:hG,onboarding:SG}};fn.use(g_).use(AT).init({resources:NG,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 jG=[{code:"zh",name:"中文",flag:"🇨🇳"},{code:"en",name:"English",flag:"🇬🇧"}];function CG(e){return fn.changeLanguage(e)}const y_="agentflow-settings-env-v1",ky="agentflow-settings-opencode-plan-v1";function Lm(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 x_(){return`e_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function EG(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()||x_();!r&&!i||t.push({id:s,key:r,value:i})}return t}function PG(){try{const e=localStorage.getItem(y_);return e?EG(JSON.parse(e)):[]}catch{return[]}}function PS(){try{return localStorage.getItem(ky)??""}catch{return""}}function _G(e){return e?e.length<=6?"•".repeat(e.length):`${"•".repeat(Math.min(20,e.length-4))}${e.slice(-4)}`:""}function IG(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 AG(){const{t:e,i18n:t}=bt(["common","settings"]),n=t.language||"zh",[r,i]=m.useState(""),[s,o]=m.useState(""),[a,c]=m.useState({cursor:[],opencode:[],claudeCode:[],cursorFetchedAt:null,opencodeFetchedAt:null,claudeCodeFetchedAt:null}),[u,p]=m.useState(""),[d,f]=m.useState(!1),[h,g]=m.useState(!1),[b,k]=m.useState(""),[y,v]=m.useState(()=>PG()),[w,N]=m.useState(""),[C,S]=m.useState(""),[P,R]=m.useState(""),M=m.useRef(null),H=m.useRef(!1),_=m.useCallback(async()=>{o("");try{const W=await fetch("/api/ui-context");if(!W.ok)throw new Error("HTTP "+W.status);const O=await W.json();i(typeof O.workspaceRoot=="string"?O.workspaceRoot:"")}catch(W){o(String(W.message||W)),i("")}},[]),A=m.useCallback(async()=>{p(""),f(!0);try{const W=await fetch("/api/model-lists");if(!W.ok)throw new Error("HTTP "+W.status);const O=await W.json();c(Lm(O))}catch(W){p(String(W.message||W))}finally{f(!1)}},[]),U=m.useCallback(async()=>{p(""),f(!0);try{const W=await fetch("/api/update-model-lists",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:P.trim()})}),O=await W.json().catch(()=>({}));if(!W.ok)throw new Error(typeof O.error=="string"?O.error:"HTTP "+W.status);c(Lm(O.modelLists))}catch(W){p(String(W.message||W))}finally{f(!1)}},[P]);m.useEffect(()=>{_(),A(),(async()=>{try{const W=await fetch("/api/agentflow-config");if(W.ok){const O=await W.json(),X=typeof O.opencodeProvider=="string"?O.opencodeProvider:"";R(X),M.current=X;try{localStorage.setItem(ky,X)}catch{}}else{const O=PS();R(O),M.current=O}}catch{const W=PS();R(W),M.current=W}finally{H.current=!0}})()},[_,A]),m.useEffect(()=>{try{localStorage.setItem(y_,JSON.stringify(y))}catch{}},[y]),m.useEffect(()=>{if(!H.current)return;const W=P.trim();if(W===M.current)return;const O=setTimeout(()=>{(async()=>{g(!0),k("");try{const X=await fetch("/api/agentflow-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:W})}),se=await X.json().catch(()=>({}));if(!X.ok)throw new Error(typeof se.error=="string"?se.error:"HTTP "+X.status);M.current=W;try{localStorage.setItem(ky,W)}catch{}se.modelLists&&c(Lm(se.modelLists))}catch(X){k(String(X.message||X))}finally{g(!1)}})()},450);return()=>clearTimeout(O)},[P]);const L=a.cursor.length>0,B=a.opencode.length>0,$=a.claudeCode.length>0,F=m.useCallback(()=>{var W;r&&((W=navigator.clipboard)==null||W.writeText(r))},[r]),I=m.useCallback(()=>{const W=w.trim(),O=C;W&&(v(X=>[...X,{id:x_(),key:W,value:O}]),N(""),S(""))},[w,C]),T=m.useCallback(W=>{v(O=>O.filter(X=>X.id!==W))},[]),E=m.useCallback(W=>{const O=W.target.value;CG(O)},[]),q=W=>{const O=IG(W,n);return O?e("settings:cursor.modelList.fetchedAt",{time:O}):e("settings:cursor.modelList.never")};return l.jsxs("div",{className:"af-settings-page",children:[l.jsx("header",{className:"af-settings-top",children:l.jsxs("div",{className:"af-settings-crumb","aria-label":e("settings:title"),children:[l.jsx("span",{className:"af-settings-crumb-muted",children:e("settings:crumb.engine")}),l.jsx("span",{className:"af-settings-crumb-sep","aria-hidden":!0,children:"/"}),l.jsx("span",{className:"af-settings-crumb-active",children:e("settings:crumb.preferences")})]})}),l.jsx("div",{className:"af-settings-body",children:l.jsxs("div",{className:"af-settings-inner",children:[l.jsxs("header",{className:"af-settings-hero",children:[l.jsxs("h1",{className:"af-settings-h1",children:[e("common:app.name")," ",e("settings:title")]}),l.jsx("p",{className:"af-settings-lead",children:e("settings:workspace.description")}),s?l.jsx("p",{className:"af-err af-settings-api-hint",children:s}):null,u?l.jsx("p",{className:"af-err af-settings-api-hint",children:u}):null]}),l.jsxs("div",{className:"af-settings-layout",children:[l.jsxs("div",{className:"af-settings-bento",children:[l.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--low af-set-workspace",children:[l.jsxs("div",{className:"af-set-card-inner",children:[l.jsxs("div",{className:"af-set-card-head",children:[l.jsx("span",{className:"material-symbols-outlined af-set-icon af-set-icon--secondary",children:"folder_managed"}),l.jsx("h2",{className:"af-set-h2",children:e("settings:workspace.title")})]}),l.jsx("label",{className:"af-set-label",htmlFor:"af-workspace-path",children:e("settings:workspace.currentPath")}),l.jsxs("div",{className:"af-set-input-wrap",children:[l.jsx("input",{id:"af-workspace-path",className:"af-set-input af-set-input--mono",type:"text",readOnly:!0,value:r,placeholder:e("common:loading")}),l.jsx("button",{type:"button",className:"af-set-input-suffix",onClick:F,"aria-label":e("settings:workspace.copyPath"),disabled:!r,children:l.jsx("span",{className:"material-symbols-outlined",children:"content_copy"})})]}),l.jsx("p",{className:"af-set-hint",children:e("settings:workspace.description")})]}),l.jsx("div",{className:"af-set-watermark","aria-hidden":!0,children:l.jsx("span",{className:"material-symbols-outlined",children:"account_tree"})})]}),l.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--high",children:[l.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[l.jsx("h2",{className:"af-set-h2 af-set-h2--caps",children:"Cursor CLI"}),l.jsx("span",{className:"af-set-badge"+(L?" af-set-badge--ok":" af-set-badge--muted"),children:e(L?"settings:cursor.status.cached":"settings:cursor.status.notCached")})]}),l.jsxs("div",{className:"af-set-cli-block",children:[l.jsx("div",{className:"af-set-cli-icon",children:l.jsx("span",{className:"material-symbols-outlined af-set-icon--tertiary",children:L?"check_circle":"hourglass_empty"})}),l.jsxs("div",{children:[l.jsx("p",{className:"af-set-cli-title",children:e(L?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),l.jsx("p",{className:"af-set-cli-mono",children:L?e("settings:cursor.modelList.count",{count:a.cursor.length})+" · "+q(a.cursorFetchedAt):e("settings:cursor.modelList.refresh")})]})]}),L?l.jsx("pre",{className:"af-set-model-preview","aria-label":e("settings:cursor.modelPreviewLabel"),children:a.cursor.join(`
|
|
164
|
-
`)}):null,l.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>U(),disabled:d,children:e(d?"settings:cursor.modelList.fetching":"settings:cursor.modelList.refresh")})]}),l.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--high",children:[l.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[l.jsx("h2",{className:"af-set-h2 af-set-h2--caps",children:"OpenCode"}),l.jsx("span",{className:"af-set-badge"+(B?" af-set-badge--ok":" af-set-badge--err"),children:e(B?"settings:opencode.status.ready":"settings:opencode.status.notFound")})]}),l.jsx("p",{className:"af-set-p",children:e("settings:opencode.description")}),l.jsxs("div",{children:[l.jsx("label",{className:"af-set-label-sm",htmlFor:"af-opencode-plan",children:e("settings:opencode.provider")}),l.jsx("input",{id:"af-opencode-plan",className:"af-set-input af-set-input--sm af-set-input--mono",type:"text",value:P,onChange:W=>R(W.target.value),placeholder:e("settings:opencode.providerPlaceholder"),autoComplete:"off"}),h?l.jsx("p",{className:"af-set-hint af-set-hint--inline","aria-live":"polite",children:e("settings:opencode.saving")}):null,b?l.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",role:"alert",children:b}):null]}),B?l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"af-set-cli-mono af-set-cli-mono--block",children:e("settings:cursor.modelList.count",{count:a.opencode.length})+" · "+q(a.opencodeFetchedAt)}),l.jsx("pre",{className:"af-set-model-preview","aria-label":e("settings:opencode.modelPreviewLabel"),children:a.opencode.join(`
|
|
165
|
-
`)})]}):null,l.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>U(),disabled:d,children:e(d?"settings:cursor.modelList.fetching":"settings:cursor.modelList.refresh")})]}),l.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--high",children:[l.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[l.jsx("h2",{className:"af-set-h2 af-set-h2--caps",children:e("settings:claudeCode.title")}),l.jsx("span",{className:"af-set-badge"+($?" af-set-badge--ok":" af-set-badge--err"),children:e($?"settings:claudeCode.status.ready":"settings:claudeCode.status.notFound")})]}),l.jsxs("div",{className:"af-set-cli-block",children:[l.jsx("div",{className:"af-set-cli-icon",children:l.jsx("span",{className:"material-symbols-outlined af-set-icon--tertiary",children:$?"check_circle":"hourglass_empty"})}),l.jsxs("div",{children:[l.jsx("p",{className:"af-set-cli-title",children:e($?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),l.jsx("p",{className:"af-set-cli-mono",children:$?e("settings:cursor.modelList.count",{count:a.claudeCode.length})+" · "+q(a.claudeCodeFetchedAt):e("settings:cursor.modelList.refresh")})]})]}),l.jsx("p",{className:"af-set-p",children:e("settings:claudeCode.description")}),$?l.jsx("pre",{className:"af-set-model-preview","aria-label":e("settings:claudeCode.modelPreviewLabel"),children:a.claudeCode.join(`
|
|
166
|
-
`)}):null,l.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>U(),disabled:d,children:e(d?"settings:cursor.modelList.fetching":"settings:cursor.modelList.refresh")})]}),l.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--low af-set-env",children:[l.jsxs("div",{className:"af-set-env-head",children:[l.jsxs("div",{className:"af-set-card-head",children:[l.jsx("div",{className:"af-set-env-icon-wrap",children:l.jsx("span",{className:"material-symbols-outlined af-set-icon--primary",children:"variables"})}),l.jsx("h2",{className:"af-set-h2",children:e("settings:env.title")})]}),l.jsx("span",{className:"af-set-env-note",children:e("settings:env.note")})]}),l.jsxs("div",{className:"af-set-env-rows",children:[y.map(W=>l.jsxs("div",{className:"af-set-env-row",children:[l.jsxs("div",{className:"af-set-env-cell",children:[l.jsx("span",{className:"af-set-env-k",children:e("settings:env.key")}),l.jsx("code",{className:"af-set-code-key",children:W.key||"—"})]}),l.jsxs("div",{className:"af-set-env-cell af-set-env-cell--grow",children:[l.jsx("span",{className:"af-set-env-k",children:e("settings:env.value")}),l.jsx("code",{className:"af-set-code-val",children:_G(W.value)})]}),l.jsx("div",{className:"af-set-env-actions",children:l.jsx("button",{type:"button",className:"af-set-env-del","aria-label":e("settings:env.delete",{key:W.key}),onClick:()=>T(W.id),children:l.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})})]},W.id)),l.jsxs("div",{className:"af-set-env-row af-set-env-row--draft",children:[l.jsx("div",{className:"af-set-env-cell",children:l.jsx("input",{className:"af-set-input af-set-input--dashed af-set-input--mono",placeholder:"KEY_NAME",value:w,onChange:W=>N(W.target.value),"aria-label":e("settings:env.newKey")})}),l.jsx("div",{className:"af-set-env-cell af-set-env-cell--grow",children:l.jsx("input",{className:"af-set-input af-set-input--dashed af-set-input--mono",type:"password",placeholder:e("settings:env.newValue"),value:C,onChange:W=>S(W.target.value),"aria-label":e("settings:env.newValue")})}),l.jsx("div",{className:"af-set-env-actions",children:l.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:I,disabled:!w.trim(),children:[l.jsx("span",{className:"material-symbols-outlined",children:"add"}),e("settings:env.add")]})})]})]})]})]}),l.jsxs("aside",{className:"af-settings-rail","aria-label":e("settings:title"),children:[l.jsxs("div",{className:"af-set-rail-card af-set-rail-card--accent",children:[l.jsxs("div",{className:"af-set-rail-inner",children:[l.jsx("h3",{className:"af-set-rail-h3",children:e("settings:system.title")}),l.jsxs("div",{className:"af-set-health-line",children:[l.jsx("span",{className:"af-set-pulse-dot","aria-hidden":!0}),l.jsx("span",{className:"af-set-health-label",children:e(!s&&!u?"settings:system.normal":"settings:system.abnormal")})]}),l.jsxs("div",{className:"af-set-meter",children:[l.jsxs("div",{className:"af-set-meter-row",children:[l.jsx("span",{children:e("settings:system.cursorModels")}),l.jsx("span",{children:a.cursor.length})]}),l.jsx("div",{className:"af-set-meter-bar",children:l.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,a.cursor.length>0?12+a.cursor.length*3:4)}%`}})})]}),l.jsxs("div",{className:"af-set-meter",children:[l.jsxs("div",{className:"af-set-meter-row",children:[l.jsx("span",{children:e("settings:system.opencodeModels")}),l.jsx("span",{children:a.opencode.length})]}),l.jsx("div",{className:"af-set-meter-bar",children:l.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,a.opencode.length>0?12+a.opencode.length*3:4)}%`}})})]}),l.jsxs("div",{className:"af-set-meter",children:[l.jsxs("div",{className:"af-set-meter-row",children:[l.jsx("span",{children:e("settings:system.claudeCodeModels")}),l.jsx("span",{children:a.claudeCode.length})]}),l.jsx("div",{className:"af-set-meter-bar",children:l.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,a.claudeCode.length>0?12+a.claudeCode.length*3:4)}%`}})})]})]}),l.jsx("div",{className:"af-set-rail-watermark","aria-hidden":!0,children:l.jsx("span",{className:"material-symbols-outlined",children:"vital_signs"})})]}),l.jsxs("div",{className:"af-set-rail-card",children:[l.jsx("h3",{className:"af-set-rail-h3 af-set-rail-h3--sm",children:e("settings:language.title")}),l.jsxs("div",{className:"af-set-language-selector",children:[l.jsx("select",{className:"af-set-input af-set-input--sm",value:n,onChange:E,"aria-label":e("settings:language.description"),children:jG.map(W=>l.jsxs("option",{value:W.code,children:[W.flag," ",W.name]},W.code))}),l.jsx("p",{className:"af-set-hint",children:e("settings:language.description")})]})]})]})]})]})})]})}function w_(e){return t=>typeof t===e}var TG=w_("function"),RG=e=>e===null,_S=e=>Object.prototype.toString.call(e).slice(8,-1)==="RegExp",IS=e=>!LG(e)&&!RG(e)&&(TG(e)||typeof e=="object"),LG=w_("undefined");function OG(e,t,n){return HG(n,e,t)?!0:(UG(n,e,t),e.constructor!==t.constructor?!1:Array.isArray(e)&&Array.isArray(t)?MG(e,t,n):e instanceof Map&&t instanceof Map?FG(e,t,n):e instanceof Set&&t instanceof Set?BG(e,t):e instanceof WeakMap||e instanceof WeakSet?!1:ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)?DG(e,t):_S(e)&&_S(t)?e.source===t.source&&e.flags===t.flags:e instanceof Error&&t instanceof Error?$G(e,t,n):e.valueOf!==Object.prototype.valueOf?e.valueOf()===t.valueOf():e.toString!==Object.prototype.toString?e.toString()===t.toString():zG(e,t,n))}function hu(e,t,n){return e===t||Number.isNaN(e)&&Number.isNaN(t)?!0:!e||!IS(e)||!t||!IS(t)?!1:OG(e,t,n)}function MG(e,t,n){const{length:r}=e;if(r!==t.length)return!1;for(let i=r;i--!==0;)if(!hu(e[i],t[i],n))return!1;return!0}function DG(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 $G(e,t,n){return e.message===t.message&&e.name===t.name&&hu(e.cause,t.cause,n)}function FG(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(!hu(r[1],t.get(r[0]),n))return!1;return!0}function zG(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)&&!hu(e[s],t[s],n))return!1}return!0}function BG(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 HG(e,t,n){var r;return((r=e.get(t))==null?void 0:r.has(n))??!1}function UG(e,t,n){let r=e.get(t);r||(r=new WeakSet,e.set(t,r)),r.add(n)}function fw(e,t){return hu(e,t,new WeakMap)}function Om(){var e;return!!(typeof window<"u"&&((e=window==null?void 0:window.document)!=null&&e.createElement))}function VG(e,...t){e&&e.removeEventListener&&e.removeEventListener(...t)}function WG(e,...t){e&&e.addEventListener&&e.addEventListener(...t)}function KG(){const e=m.useRef(!0);return e.current?(e.current=!1,!0):e.current}function YG(e,t){const n=KG();m.useEffect(()=>{if(!n)return e()},t)}function v_(e){const t=m.useRef(void 0);return m.useEffect(()=>{t.current=e}),t.current}function qG(e,t){const n=m.useRef(t);return fw(t,n.current)||(n.current=t),m.useMemo(e,n.current)}function GG(e){m.useEffect(()=>{e()},[])}function XG(e=0){const[t,n]=m.useState({height:Om()?window.innerHeight:0,width:Om()?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(!Om())return()=>{};const s=i.current;return n({height:window.innerHeight,width:window.innerWidth}),WG(window,"resize",s),()=>{VG(window,"resize",s)}},[]),t}var JG=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","URL","WeakMap","WeakSet"],QG=["bigint","boolean","null","number","string","symbol","undefined"];function mu(e){const t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(ZG(t))return t}function Ur(e){return t=>mu(t)===e}function ZG(e){return JG.includes(e)}function Ya(e){return t=>typeof t===e}function eX(e){return QG.includes(e)}var tX=["innerHTML","ownerDocument","style","attributes","nodeValue"],gu=e=>Array.isArray(e),nX=e=>mu(e)==="AsyncGeneratorFunction",rX=Ur("AsyncFunction"),iX=Ya("bigint"),sX=e=>e===!0||e===!1,oX=Ur("Date"),aX=Ur("Error"),Es=Ya("function"),lX=Ur("GeneratorFunction"),cX=e=>typeof e=="number"&&Number.isInteger(e),Sy=Ur("Map"),b_=e=>Number.isNaN(e),pw=e=>e===null,k_=Ur("Function"),uX=Ur("Promise"),dX=Ur("RegExp"),Ny=Ur("Set"),yu=Ya("string"),fX=Ya("symbol"),hw=Ya("undefined"),pX=Ur("WeakMap"),hX=Ur("WeakSet"),mw=e=>pw(e)||hw(e),S_=e=>!hw(e),mX=e=>Ya("number")(e)&&!b_(e),gX=e=>yu(e)&&e.trim().length>0,yX=e=>{if(!yu(e)||e.length===0)return!1;const t=e.trim();return t.length>0&&Number.isFinite(Number(t))},Yp=e=>!mw(e)&&(Es(e)||typeof e=="object"),N_=e=>{if(mu(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})},xX=e=>pw(e)||eX(typeof e),wX=e=>mu(e)==="URL",j_=e=>!mw(e)&&Es(e[Symbol.iterator]),vX=e=>j_(e)&&Es(e.next)&&Es(e.throw),bX=e=>Es(e)&&/^class\s/.test(e.toString()),kX=(e,t)=>!gu(e)||!Es(t)?!1:e.every(n=>t(n)),SX=e=>Yp(e)&&!N_(e)&&e.nodeType===1&&yu(e.nodeName)&&tX.every(t=>t in e),NX=e=>yu(e)&&e.length===0||gu(e)&&e.length===0||Yp(e)&&!Sy(e)&&!Ny(e)&&Object.keys(e).length===0||Ny(e)&&e.size===0||Sy(e)&&e.size===0,jX=(e,t)=>!e||!t?!1:Object.getPrototypeOf(e)===t.prototype,CX=(e,t)=>gu(e)?e.indexOf(t)>-1:!1,EX=(e,t,n)=>{if(!Yp(e)||!t)return!1;const r=e[t];return Es(n)?n(r):S_(r)};function qe(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(gu(e))return"Array";if(k_(e))return"Function";const t=mu(e);return t||"Object"}qe.array=gu;qe.arrayOf=kX;qe.asyncGeneratorFunction=nX;qe.asyncFunction=rX;qe.bigint=iX;qe.boolean=sX;qe.class=bX;qe.date=oX;qe.defined=S_;qe.domElement=SX;qe.empty=NX;qe.error=aX;qe.function=Es;qe.generator=vX;qe.generatorFunction=lX;qe.instanceOf=jX;qe.integer=cX;qe.iterable=j_;qe.map=Sy;qe.nan=b_;qe.null=pw;qe.nullOrUndefined=mw;qe.nonEmptyString=gX;qe.number=mX;qe.numericString=yX;qe.object=Yp;qe.oneOf=CX;qe.plainFunction=k_;qe.plainObject=N_;qe.primitive=xX;qe.promise=uX;qe.propertyOf=EX;qe.regexp=dX;qe.set=Ny;qe.string=yu;qe.symbol=fX;qe.undefined=hw;qe.url=wX;qe.weakMap=pX;qe.weakSet=hX;var Sn=qe;/* v8 ignore next -- @preserve */var PX=function(e){return Object.prototype.hasOwnProperty.call(e,"props")},_X=function(e,t){return e+Xc(t)},Xc=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(_X,""):PX(e)&&Object.prototype.hasOwnProperty.call(e.props,"children")?Xc(e.props.children):""};Xc.default=Xc;var IX=Xc;const Mm=_s(IX);var C_={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 S=0;const P=C.length,R=new Array(P);for(S;S<P;++S)R[S]=y(C[S]);return R}function a(C){const S={};if(f&&Object.getPrototypeOf(C)!==t)return f(C);const P=d(C);let R,M,H;for(R=0,M=P.length;R<M;++R)s(H=P[R])&&(S[H]=y(C[H]));return S}function c(C,S){const P=C.length,R=S.length;let M=0;const H=new Array(P+R);for(M;M<P;++M)H[M]=y(C[M]);for(M=0;M<R;++M)H[M+P]=y(S[M]);return H}const u=Object.prototype.propertyIsEnumerable;function p(C){const S=Object.keys(C),P=Object.getOwnPropertySymbols(C);for(let R=0,M=P.length;R<M;++R)u.call(C,P[R])&&S.push(P[R]);return S}const d=i!=null&&i.symbols?p:Object.keys,f=typeof(i==null?void 0:i.cloneProtoObject)=="function"?i.cloneProtoObject:void 0,h=typeof(i==null?void 0:i.isMergeableObject)=="function"?i.isMergeableObject:n(),g=(i==null?void 0:i.onlyDefinedProperties)===!0;function b(C){return typeof C!="object"||C===null}const k=i&&typeof i.mergeArray=="function"?i.mergeArray({clone:y,deepmerge:w,getKeys:d,isMergeableObject:h}):c;function y(C){return h(C)?Array.isArray(C)?o(C):a(C):C}function v(C,S){const P={},R=d(C),M=d(S);let H,_,A;for(H=0,_=R.length;H<_;++H)s(A=R[H])&&M.indexOf(A)===-1&&(P[A]=y(C[A]));for(H=0,_=M.length;H<_;++H)if(s(A=M[H]))if(A in C)R.indexOf(A)!==-1&&(f&&h(S[A])&&Object.getPrototypeOf(S[A])!==t?P[A]=f(S[A]):P[A]=w(C[A],S[A]));else{if(g&&typeof S[A]>"u")continue;P[A]=y(S[A])}return P}function w(C,S){if(g&&typeof S>"u")return y(C);const P=Array.isArray(S),R=Array.isArray(C);return b(S)?S:h(C)?P&&R?k(C,S):P!==R?y(S):v(C,S):y(S)}function N(){switch(arguments.length){case 0:return{};case 1:return y(arguments[0]);case 2:return w(arguments[0],arguments[1])}let C;for(let S=0,P=arguments.length;S<P;++S)C=w(C,arguments[S]);return C}return i!=null&&i.all?N:w}e.exports=r,e.exports.default=r,e.exports.deepmerge=r,Object.defineProperty(e.exports,"isMergeableObject",{get:n})})(C_);var AX=C_.exports;const TX=_s(AX);var RX=new Error("Element already at target scroll position"),LX=new Error("Scroll cancelled"),OX=Math.min,AS=Date.now,MX={left:TS("scrollLeft"),top:TS("scrollTop")};function TS(e){return function(n,r,i,s){i=i||{},typeof i=="function"&&(s=i,i={}),typeof s!="function"&&(s=$X);var o=AS(),a=n[e],c=i.ease||DX,u=isNaN(i.duration)?350:+i.duration,p=!1;return a===r?s(RX,n[e]):requestAnimationFrame(f),d;function d(){p=!0}function f(h){if(p)return s(LX,n[e]);var g=AS(),b=OX(1,(g-o)/u),k=c(b);n[e]=k*(r-a)+a,b<1?requestAnimationFrame(f):requestAnimationFrame(function(){s(null,n[e])})}}}function DX(e){return .5*(1-Math.cos(Math.PI*e))}function $X(){}const FX=_s(MX);var E_={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.Scrollparent=n()})(mc,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})})(E_);var zX=E_.exports;const P_=_s(zX),BX=["top","right","bottom","left"],RS=["start","end"],LS=BX.reduce((e,t)=>e.concat(t,t+"-"+RS[0],t+"-"+RS[1]),[]),Fa=Math.min,ao=Math.max,ap=Math.round,Bd=Math.floor,pi=e=>({x:e,y:e}),HX={left:"right",right:"left",bottom:"top",top:"bottom"};function jy(e,t,n){return ao(e,Fa(t,n))}function qa(e,t){return typeof e=="function"?e(t):e}function Bi(e){return e.split("-")[0]}function hi(e){return e.split("-")[1]}function __(e){return e==="x"?"y":"x"}function gw(e){return e==="y"?"height":"width"}function fs(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function yw(e){return __(fs(e))}function I_(e,t,n){n===void 0&&(n=!1);const r=hi(e),i=yw(e),s=gw(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=cp(o)),[o,cp(o)]}function UX(e){const t=cp(e);return[lp(e),t,lp(t)]}function lp(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const OS=["left","right"],MS=["right","left"],VX=["top","bottom"],WX=["bottom","top"];function KX(e,t,n){switch(e){case"top":case"bottom":return n?t?MS:OS:t?OS:MS;case"left":case"right":return t?VX:WX;default:return[]}}function YX(e,t,n,r){const i=hi(e);let s=KX(Bi(e),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(lp)))),s}function cp(e){const t=Bi(e);return HX[t]+e.slice(t.length)}function qX(e){return{top:0,right:0,bottom:0,left:0,...e}}function A_(e){return typeof e!="number"?qX(e):{top:e,right:e,bottom:e,left:e}}function up(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 DS(e,t,n){let{reference:r,floating:i}=e;const s=fs(t),o=yw(t),a=gw(o),c=Bi(t),u=s==="y",p=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[a]/2-i[a]/2;let h;switch(c){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:d};break;case"left":h={x:r.x-i.width,y:d};break;default:h={x:r.x,y:r.y}}switch(hi(t)){case"start":h[o]-=f*(n&&u?-1:1);break;case"end":h[o]+=f*(n&&u?-1:1);break}return h}async function GX(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:s,rects:o,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:p="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=qa(t,e),g=A_(h),k=a[f?d==="floating"?"reference":"floating":d],y=up(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(a.floating)),boundary:u,rootBoundary:p,strategy:c})),v=d==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),N=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=up(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:w,strategy:c}):v);return{top:(y.top-C.top+g.top)/N.y,bottom:(C.bottom-y.bottom+g.bottom)/N.y,left:(y.left-C.left+g.left)/N.x,right:(C.right-y.right+g.right)/N.x}}const XX=50,JX=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:GX},c=await(o.isRTL==null?void 0:o.isRTL(t));let u=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:p,y:d}=DS(u,r,c),f=r,h=0;const g={};for(let b=0;b<s.length;b++){const k=s[b];if(!k)continue;const{name:y,fn:v}=k,{x:w,y:N,data:C,reset:S}=await v({x:p,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:g,rects:u,platform:a,elements:{reference:e,floating:t}});p=w??p,d=N??d,g[y]={...g[y],...C},S&&h<XX&&(h++,typeof S=="object"&&(S.placement&&(f=S.placement),S.rects&&(u=S.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):S.rects),{x:p,y:d}=DS(u,f,c)),b=-1)}return{x:p,y:d,placement:f,strategy:i,middlewareData:g}},QX=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:o,elements:a,middlewareData:c}=t,{element:u,padding:p=0}=qa(e,t)||{};if(u==null)return{};const d=A_(p),f={x:n,y:r},h=yw(i),g=gw(h),b=await o.getDimensions(u),k=h==="y",y=k?"top":"left",v=k?"bottom":"right",w=k?"clientHeight":"clientWidth",N=s.reference[g]+s.reference[h]-f[h]-s.floating[g],C=f[h]-s.reference[h],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let P=S?S[w]:0;(!P||!await(o.isElement==null?void 0:o.isElement(S)))&&(P=a.floating[w]||s.floating[g]);const R=N/2-C/2,M=P/2-b[g]/2-1,H=Fa(d[y],M),_=Fa(d[v],M),A=H,U=P-b[g]-_,L=P/2-b[g]/2+R,B=jy(A,L,U),$=!c.arrow&&hi(i)!=null&&L!==B&&s.reference[g]/2-(L<A?H:_)-b[g]/2<0,F=$?L<A?L-A:L-U:0;return{[h]:f[h]+F,data:{[h]:B,centerOffset:L-B-F,...$&&{alignmentOffset:F}},reset:$}}});function ZX(e,t,n){return(e?[...n.filter(i=>hi(i)===e),...n.filter(i=>hi(i)!==e)]:n.filter(i=>Bi(i)===i)).filter(i=>e?hi(i)===e||(t?lp(i)!==i:!1):!0)}const eJ=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,r,i;const{rects:s,middlewareData:o,placement:a,platform:c,elements:u}=t,{crossAxis:p=!1,alignment:d,allowedPlacements:f=LS,autoAlignment:h=!0,...g}=qa(e,t),b=d!==void 0||f===LS?ZX(d||null,h,f):f,k=await c.detectOverflow(t,g),y=((n=o.autoPlacement)==null?void 0:n.index)||0,v=b[y];if(v==null)return{};const w=I_(v,s,await(c.isRTL==null?void 0:c.isRTL(u.floating)));if(a!==v)return{reset:{placement:b[0]}};const N=[k[Bi(v)],k[w[0]],k[w[1]]],C=[...((r=o.autoPlacement)==null?void 0:r.overflows)||[],{placement:v,overflows:N}],S=b[y+1];if(S)return{data:{index:y+1,overflows:C},reset:{placement:S}};const P=C.map(H=>{const _=hi(H.placement);return[H.placement,_&&p?H.overflows.slice(0,2).reduce((A,U)=>A+U,0):H.overflows[0],H.overflows]}).sort((H,_)=>H[1]-_[1]),M=((i=P.filter(H=>H[2].slice(0,hi(H[0])?2:3).every(_=>_<=0))[0])==null?void 0:i[0])||P[0][0];return M!==a?{data:{index:y+1,overflows:C},reset:{placement:M}}:{}}}},tJ=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:a,platform:c,elements:u}=t,{mainAxis:p=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:b=!0,...k}=qa(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=Bi(i),v=fs(a),w=Bi(a)===a,N=await(c.isRTL==null?void 0:c.isRTL(u.floating)),C=f||(w||!b?[cp(a)]:UX(a)),S=g!=="none";!f&&S&&C.push(...YX(a,b,g,N));const P=[a,...C],R=await c.detectOverflow(t,k),M=[];let H=((r=s.flip)==null?void 0:r.overflows)||[];if(p&&M.push(R[y]),d){const L=I_(i,o,N);M.push(R[L[0]],R[L[1]])}if(H=[...H,{placement:i,overflows:M}],!M.every(L=>L<=0)){var _,A;const L=(((_=s.flip)==null?void 0:_.index)||0)+1,B=P[L];if(B&&(!(d==="alignment"?v!==fs(B):!1)||H.every(I=>fs(I.placement)===v?I.overflows[0]>0:!0)))return{data:{index:L,overflows:H},reset:{placement:B}};let $=(A=H.filter(F=>F.overflows[0]<=0).sort((F,I)=>F.overflows[1]-I.overflows[1])[0])==null?void 0:A.placement;if(!$)switch(h){case"bestFit":{var U;const F=(U=H.filter(I=>{if(S){const T=fs(I.placement);return T===v||T==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(T=>T>0).reduce((T,E)=>T+E,0)]).sort((I,T)=>I[1]-T[1])[0])==null?void 0:U[0];F&&($=F);break}case"initialPlacement":$=a;break}if(i!==$)return{reset:{placement:$}}}return{}}}},nJ=new Set(["left","top"]);async function rJ(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Bi(n),a=hi(n),c=fs(n)==="y",u=nJ.has(o)?-1:1,p=s&&c?-1:1,d=qa(t,e);let{mainAxis:f,crossAxis:h,alignmentAxis:g}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof g=="number"&&(h=a==="end"?g*-1:g),c?{x:h*p,y:f*u}:{x:f*u,y:h*p}}const iJ=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:a}=t,c=await rJ(t,e);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:s+c.y,data:{...c,placement:o}}}}},sJ=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:a=!1,limiter:c={fn:y=>{let{x:v,y:w}=y;return{x:v,y:w}}},...u}=qa(e,t),p={x:n,y:r},d=await s.detectOverflow(t,u),f=fs(Bi(i)),h=__(f);let g=p[h],b=p[f];if(o){const y=h==="y"?"top":"left",v=h==="y"?"bottom":"right",w=g+d[y],N=g-d[v];g=jy(w,g,N)}if(a){const y=f==="y"?"top":"left",v=f==="y"?"bottom":"right",w=b+d[y],N=b-d[v];b=jy(w,b,N)}const k=c.fn({...t,[h]:g,[f]:b});return{...k,data:{x:k.x-n,y:k.y-r,enabled:{[h]:o,[f]:a}}}}}};function qp(){return typeof window<"u"}function Ga(e){return T_(e)?(e.nodeName||"").toLowerCase():"#document"}function rr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function wi(e){var t;return(t=(T_(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function T_(e){return qp()?e instanceof Node||e instanceof rr(e).Node:!1}function zr(e){return qp()?e instanceof Element||e instanceof rr(e).Element:!1}function Vi(e){return qp()?e instanceof HTMLElement||e instanceof rr(e).HTMLElement:!1}function $S(e){return!qp()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof rr(e).ShadowRoot}function xu(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Br(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function oJ(e){return/^(table|td|th)$/.test(Ga(e))}function Gp(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const aJ=/transform|translate|scale|rotate|perspective|filter/,lJ=/paint|layout|strict|content/,Ys=e=>!!e&&e!=="none";let Dm;function xw(e){const t=zr(e)?Br(e):e;return Ys(t.transform)||Ys(t.translate)||Ys(t.scale)||Ys(t.rotate)||Ys(t.perspective)||!ww()&&(Ys(t.backdropFilter)||Ys(t.filter))||aJ.test(t.willChange||"")||lJ.test(t.contain||"")}function cJ(e){let t=Ps(e);for(;Vi(t)&&!za(t);){if(xw(t))return t;if(Gp(t))return null;t=Ps(t)}return null}function ww(){return Dm==null&&(Dm=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Dm}function za(e){return/^(html|body|#document)$/.test(Ga(e))}function Br(e){return rr(e).getComputedStyle(e)}function Xp(e){return zr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ps(e){if(Ga(e)==="html")return e;const t=e.assignedSlot||e.parentNode||$S(e)&&e.host||wi(e);return $S(t)?t.host:t}function R_(e){const t=Ps(e);return za(t)?e.ownerDocument?e.ownerDocument.body:e.body:Vi(t)&&xu(t)?t:R_(t)}function Jc(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=R_(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),o=rr(i);if(s){const a=Cy(o);return t.concat(o,o.visualViewport||[],xu(i)?i:[],a&&n?Jc(a):[])}else return t.concat(i,Jc(i,[],n))}function Cy(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function L_(e){const t=Br(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Vi(e),s=i?e.offsetWidth:n,o=i?e.offsetHeight:r,a=ap(n)!==s||ap(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function vw(e){return zr(e)?e:e.contextElement}function va(e){const t=vw(e);if(!Vi(t))return pi(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=L_(t);let o=(s?ap(n.width):n.width)/r,a=(s?ap(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const uJ=pi(0);function O_(e){const t=rr(e);return!ww()||!t.visualViewport?uJ:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function dJ(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==rr(e)?!1:t}function wo(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=vw(e);let o=pi(1);t&&(r?zr(r)&&(o=va(r)):o=va(e));const a=dJ(s,n,r)?O_(s):pi(0);let c=(i.left+a.x)/o.x,u=(i.top+a.y)/o.y,p=i.width/o.x,d=i.height/o.y;if(s){const f=rr(s),h=r&&zr(r)?rr(r):r;let g=f,b=Cy(g);for(;b&&r&&h!==g;){const k=va(b),y=b.getBoundingClientRect(),v=Br(b),w=y.left+(b.clientLeft+parseFloat(v.paddingLeft))*k.x,N=y.top+(b.clientTop+parseFloat(v.paddingTop))*k.y;c*=k.x,u*=k.y,p*=k.x,d*=k.y,c+=w,u+=N,g=rr(b),b=Cy(g)}}return up({width:p,height:d,x:c,y:u})}function Jp(e,t){const n=Xp(e).scrollLeft;return t?t.left+n:wo(wi(e)).left+n}function M_(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Jp(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function fJ(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",o=wi(r),a=t?Gp(t.floating):!1;if(r===o||a&&s)return n;let c={scrollLeft:0,scrollTop:0},u=pi(1);const p=pi(0),d=Vi(r);if((d||!d&&!s)&&((Ga(r)!=="body"||xu(o))&&(c=Xp(r)),d)){const h=wo(r);u=va(r),p.x=h.x+r.clientLeft,p.y=h.y+r.clientTop}const f=o&&!d&&!s?M_(o,c):pi(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+p.x+f.x,y:n.y*u.y-c.scrollTop*u.y+p.y+f.y}}function pJ(e){return Array.from(e.getClientRects())}function hJ(e){const t=wi(e),n=Xp(e),r=e.ownerDocument.body,i=ao(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=ao(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Jp(e);const a=-n.scrollTop;return Br(r).direction==="rtl"&&(o+=ao(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}const FS=25;function mJ(e,t){const n=rr(e),r=wi(e),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,a=0,c=0;if(i){s=i.width,o=i.height;const p=ww();(!p||p&&t==="fixed")&&(a=i.offsetLeft,c=i.offsetTop)}const u=Jp(r);if(u<=0){const p=r.ownerDocument,d=p.body,f=getComputedStyle(d),h=p.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,g=Math.abs(r.clientWidth-d.clientWidth-h);g<=FS&&(s-=g)}else u<=FS&&(s+=u);return{width:s,height:o,x:a,y:c}}function gJ(e,t){const n=wo(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=Vi(e)?va(e):pi(1),o=e.clientWidth*s.x,a=e.clientHeight*s.y,c=i*s.x,u=r*s.y;return{width:o,height:a,x:c,y:u}}function zS(e,t,n){let r;if(t==="viewport")r=mJ(e,n);else if(t==="document")r=hJ(wi(e));else if(zr(t))r=gJ(t,n);else{const i=O_(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return up(r)}function D_(e,t){const n=Ps(e);return n===t||!zr(n)||za(n)?!1:Br(n).position==="fixed"||D_(n,t)}function yJ(e,t){const n=t.get(e);if(n)return n;let r=Jc(e,[],!1).filter(a=>zr(a)&&Ga(a)!=="body"),i=null;const s=Br(e).position==="fixed";let o=s?Ps(e):e;for(;zr(o)&&!za(o);){const a=Br(o),c=xw(o);!c&&a.position==="fixed"&&(i=null),(s?!c&&!i:!c&&a.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||xu(o)&&!c&&D_(e,o))?r=r.filter(p=>p!==o):i=a,o=Ps(o)}return t.set(e,r),r}function xJ(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?Gp(t)?[]:yJ(t,this._c):[].concat(n),r],a=zS(t,o[0],i);let c=a.top,u=a.right,p=a.bottom,d=a.left;for(let f=1;f<o.length;f++){const h=zS(t,o[f],i);c=ao(h.top,c),u=Fa(h.right,u),p=Fa(h.bottom,p),d=ao(h.left,d)}return{width:u-d,height:p-c,x:d,y:c}}function wJ(e){const{width:t,height:n}=L_(e);return{width:t,height:n}}function vJ(e,t,n){const r=Vi(t),i=wi(t),s=n==="fixed",o=wo(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const c=pi(0);function u(){c.x=Jp(i)}if(r||!r&&!s)if((Ga(t)!=="body"||xu(i))&&(a=Xp(t)),r){const h=wo(t,!0,s,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else i&&u();s&&!r&&i&&u();const p=i&&!r&&!s?M_(i,a):pi(0),d=o.left+a.scrollLeft-c.x-p.x,f=o.top+a.scrollTop-c.y-p.y;return{x:d,y:f,width:o.width,height:o.height}}function $m(e){return Br(e).position==="static"}function BS(e,t){if(!Vi(e)||Br(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return wi(e)===n&&(n=n.ownerDocument.body),n}function $_(e,t){const n=rr(e);if(Gp(e))return n;if(!Vi(e)){let i=Ps(e);for(;i&&!za(i);){if(zr(i)&&!$m(i))return i;i=Ps(i)}return n}let r=BS(e,t);for(;r&&oJ(r)&&$m(r);)r=BS(r,t);return r&&za(r)&&$m(r)&&!xw(r)?n:r||cJ(e)||n}const bJ=async function(e){const t=this.getOffsetParent||$_,n=this.getDimensions,r=await n(e.floating);return{reference:vJ(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function kJ(e){return Br(e).direction==="rtl"}const SJ={convertOffsetParentRelativeRectToViewportRelativeRect:fJ,getDocumentElement:wi,getClippingRect:xJ,getOffsetParent:$_,getElementRects:bJ,getClientRects:pJ,getDimensions:wJ,getScale:va,isElement:zr,isRTL:kJ};function F_(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function NJ(e,t){let n=null,r;const i=wi(e);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function o(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),s();const u=e.getBoundingClientRect(),{left:p,top:d,width:f,height:h}=u;if(a||t(),!f||!h)return;const g=Bd(d),b=Bd(i.clientWidth-(p+f)),k=Bd(i.clientHeight-(d+h)),y=Bd(p),w={rootMargin:-g+"px "+-b+"px "+-k+"px "+-y+"px",threshold:ao(0,Fa(1,c))||1};let N=!0;function C(S){const P=S[0].intersectionRatio;if(P!==c){if(!N)return o();P?o(!1,P):r=setTimeout(()=>{o(!1,1e-7)},1e3)}P===1&&!F_(u,e.getBoundingClientRect())&&o(),N=!1}try{n=new IntersectionObserver(C,{...w,root:i.ownerDocument})}catch{n=new IntersectionObserver(C,w)}n.observe(e)}return o(!0),s}function HS(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=vw(e),p=i||s?[...u?Jc(u):[],...t?Jc(t):[]]:[];p.forEach(y=>{i&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const d=u&&a?NJ(u,n):null;let f=-1,h=null;o&&(h=new ResizeObserver(y=>{let[v]=y;v&&v.target===u&&h&&t&&(h.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var w;(w=h)==null||w.observe(t)})),n()}),u&&!c&&h.observe(u),t&&h.observe(t));let g,b=c?wo(e):null;c&&k();function k(){const y=wo(e);b&&!F_(b,y)&&n(),b=y,g=requestAnimationFrame(k)}return n(),()=>{var y;p.forEach(v=>{i&&v.removeEventListener("scroll",n),s&&v.removeEventListener("resize",n)}),d==null||d(),(y=h)==null||y.disconnect(),h=null,c&&cancelAnimationFrame(g)}}const jJ=iJ,CJ=eJ,EJ=sJ,PJ=tJ,US=QX,_J=(e,t,n)=>{const r=new Map,i={platform:SJ,...n},s={...i.platform,_c:r};return JX(e,t,{...i,platform:s})};var IJ=typeof document<"u",AJ=function(){},pf=IJ?m.useLayoutEffect:AJ;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 z_(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function VS(e,t){const n=z_(e);return Math.round(t*n)/n}function Fm(e){const t=m.useRef(e);return pf(()=>{t.current=e}),t}function WS(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:c,open:u}=e,[p,d]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,h]=m.useState(r);dp(f,r)||h(r);const[g,b]=m.useState(null),[k,y]=m.useState(null),v=m.useCallback(I=>{I!==S.current&&(S.current=I,b(I))},[]),w=m.useCallback(I=>{I!==P.current&&(P.current=I,y(I))},[]),N=s||g,C=o||k,S=m.useRef(null),P=m.useRef(null),R=m.useRef(p),M=c!=null,H=Fm(c),_=Fm(i),A=Fm(u),U=m.useCallback(()=>{if(!S.current||!P.current)return;const I={placement:t,strategy:n,middleware:f};_.current&&(I.platform=_.current),_J(S.current,P.current,I).then(T=>{const E={...T,isPositioned:A.current!==!1};L.current&&!dp(R.current,E)&&(R.current=E,Tr.flushSync(()=>{d(E)}))})},[f,t,n,_,A]);pf(()=>{u===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,d(I=>({...I,isPositioned:!1})))},[u]);const L=m.useRef(!1);pf(()=>(L.current=!0,()=>{L.current=!1}),[]),pf(()=>{if(N&&(S.current=N),C&&(P.current=C),N&&C){if(H.current)return H.current(N,C,U);U()}},[N,C,U,H,M]);const B=m.useMemo(()=>({reference:S,floating:P,setReference:v,setFloating:w}),[v,w]),$=m.useMemo(()=>({reference:N,floating:C}),[N,C]),F=m.useMemo(()=>{const I={position:n,left:0,top:0};if(!$.floating)return I;const T=VS($.floating,p.x),E=VS($.floating,p.y);return a?{...I,transform:"translate("+T+"px, "+E+"px)",...z_($.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:T,top:E}},[n,a,$.floating,p.x,p.y]);return m.useMemo(()=>({...p,update:U,refs:B,elements:$,floatingStyles:F}),[p,U,B,$,F])}const TJ=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?US({element:r.current,padding:i}).fn(n):{}:r?US({element:r,padding:i}).fn(n):{}}}},KS=(e,t)=>{const n=jJ(e);return{name:n.name,fn:n.fn,options:[e,t]}},RJ=(e,t)=>{const n=EJ(e);return{name:n.name,fn:n.fn,options:[e,t]}},LJ=(e,t)=>{const n=PJ(e);return{name:n.name,fn:n.fn,options:[e,t]}},OJ=(e,t)=>{const n=CJ(e);return{name:n.name,fn:n.fn,options:[e,t]}},MJ=(e,t)=>{const n=TJ(e);return{name:n.name,fn:n.fn,options:[e,t]}},DJ={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},$J={beaconOptions:{offset:-18}},B_={back:"Back",close:"Close",last:"Last",next:"Next",nextWithProgress:"Next ({current} of {total})",open:"Open the dialog",skip:"Skip"},FJ={isFixed:!1,locale:B_,placement:"bottom"},zJ={continuous:!1,debug:!1,run:!1,scrollToFirstStep:!1,steps:[]},et={INIT:"init",START:"start",STOP:"stop",RESET:"reset",PREV:"prev",NEXT:"next",GO:"go",CLOSE:"close",SKIP:"skip",UPDATE:"update",COMPLETE:"complete"},en={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"},ve={INIT:"init",READY:"ready",BEACON_BEFORE:"beacon_before",BEACON:"beacon",TOOLTIP_BEFORE:"tooltip_before",TOOLTIP:"tooltip",COMPLETE:"complete"},ii={BUTTON_BACK:"button_back",BUTTON_CLOSE:"button_close",BUTTON_PRIMARY:"button_primary",BUTTON_SKIP:"button_skip",KEYBOARD:"keyboard",OVERLAY:"overlay"},Je={IDLE:"idle",READY:"ready",WAITING:"waiting",RUNNING:"running",PAUSED:"paused",SKIPPED:"skipped",FINISHED:"finished"},BJ="react-joyride-portal";function HJ(e){const t={};for(const n in e)e[n]!==void 0&&(t[n]=e[n]);return t}function ca(...e){return TX({all:!0,isMergeableObject:t=>!(!Sn.plainObject(t)||m.isValidElement(t))})(...e)}function H_(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function _i(e,t={}){const{defaultValue:n,step:r,steps:i}=t;let s=Mm(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&&H_(e.type)==="function")try{s=_i(e.type({}),t)}catch{s=Mm(n)}else s=Mm(n);return s}function nn(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 UJ(e,t){const n=HJ(t);return{...e,...n}}function Qc(){}function VJ(e){return Object.keys(e)}function fp(e,...t){if(!Sn.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 YS(e,...t){if(!Sn.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 Ey(e,t,n){const r=s=>s.replace("{current}",String(t)).replace("{total}",String(n));if(H_(e)==="string")return r(e);if(!m.isValidElement(e))return e;const{children:i}=e.props;if(Sn.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):Ey(s,t,n))});if(Sn.function(e.type)&&!Object.values(e.props).length)try{return Ey(e.type({}),t,n)}catch{return e}return e}function qS(e){return VJ(e).sort().reduce((t,n)=>(t[n]=e[n],t),{})}function bw(){var e;return!!(typeof window<"u"&&((e=window.document)!=null&&e.createElement))}function GS(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 kw(e){return e?e.getBoundingClientRect():null}function WJ(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 gr(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 KJ(e,t,n){const r=kw(e),i=Xa(e),s=i?!i.isSameNode(Un()):!1,o=n??Ja(e);let a=0,c=(r==null?void 0:r.top)??0;return s&&o?c=(r==null?void 0:r.top)??0:i instanceof HTMLElement&&(a=i.scrollTop,!s&&!o&&(c+=a),i.isSameNode(Un())||(c+=Un().scrollTop)),Math.floor(c-t)}function Xa(e,t){if(!e)return Un();const n=P_(e);if(n){if(n.isSameNode(Un()))return t?document:Un();if(!(n.scrollHeight>n.offsetHeight))return Un()}return n}function YJ(e){const t=e.getBoundingClientRect(),n=Un(),r=t.top+t.height/2,i=window.innerHeight/2;return Math.max(0,n.scrollTop+r-i)}function qJ(e,t){if(!e)return 0;const n=P_(e)??Un(),r=parseFloat(getComputedStyle(e).scrollMarginTop)||0,i=kw(n),s=n.scrollTop??0,{offsetTop:o=0,scrollTop:a=0}=n;let c=e.getBoundingClientRect().top+a;if(o&&(U_(e)||GJ(e))){const p=e.getBoundingClientRect(),d=p.top-((i==null?void 0:i.top)??0),f=d+p.height,h=n.clientHeight,g=h*.2;d>=g&&f<=h-g?c=s:c=d+s}const u=Math.floor(c-t-r);return u<0?0:u}function GJ(e){return e.offsetParent!==document.body}function U_(e){if(!e)return!1;const t=Xa(e);return t?!t.isSameNode(Un()):!1}function Ja(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?Ja(e.parentNode,t):!1}function Hd(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 XS(e){const{isFirstStep:t,scrollToFirstStep:n,step:r,target:i,targetLifecycle:s}=e;if(r.skipScroll||t&&!n&&s!==ve.TOOLTIP||r.placement==="center")return!1;const o=i!=null&&i.isConnected?Xa(i):Un(),a=o?!o.isSameNode(Un()):!1;return(r.isFixed||Ja(i))&&!a?!1:o.scrollHeight>o.clientHeight}function Un(){return document.scrollingElement??document.documentElement}function JS(e,t){const{duration:n,element:r}=t;let i=()=>{};const s=new Promise(o=>{const{scrollTop:a}=r,c=e>a?e-a:a-e;i=FX.top(r,e,{duration:c<100?50:n},()=>{o()})});return{cancel:i,promise:s}}function XJ(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 V_={backgroundColor:"transparent",border:0,borderRadius:0,color:"#555555",cursor:"pointer",fontSize:16,lineHeight:1,padding:0,WebkitAppearance:"none"},Ud={...V_,borderRadius:4,padding:8};function JJ(e,t){const{styles:n}=e,r=ca(n??{},t.styles??{});let{width:i}=t;bw()&&(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 ca({arrow:{alignItems:"center",color:t.arrowColor,display:"inline-flex",justifyContent:"center",position:"absolute"},beaconWrapper:{...V_,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(${XJ(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:{...Ud,color:t.primaryColor,marginLeft:"auto",marginRight:5},buttonClose:{...Ud,color:t.textColor,height:12,padding:8,position:"absolute",right:0,top:0,width:12},buttonPrimary:{...Ud,backgroundColor:t.primaryColor,color:t.backgroundColor},buttonSkip:{...Ud,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 QJ=["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 Sw(e,t){if(!t)return null;const n=ca(FJ,YS(e,"arrowComponent","beaconComponent","floatingOptions","loaderComponent","locale","styles","tooltipComponent"),t),r=ca(DJ,e.options??{},YS(t,...QJ)),i=JJ(e,{...n,...r}),s=ca($J,e.floatingOptions??{},n.floatingOptions??{});return{...n,...r,locale:ca(B_,e.locale??{},n.locale||{}),floatingOptions:s,spotlightPadding:ZJ(r.spotlightPadding),styles:i}}function ZJ(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 eQ(e,t,n){const{action:r}=t,i=n&&[et.PREV,et.NEXT].includes(r);return e.skipBeacon||e.placement==="center"||i}function W_(e,t=!1){return Sn.plainObject(e)?e.target?!0:(nn(t,"tour","target is missing from the step"),!1):(nn(t,"tour","step must be an object"),!1)}function K_(e,t=!1){return Sn.array(e)?e.every(n=>W_(n,t)):(nn(t,"tour","steps must be an array"),!1)}var tQ=class{constructor(e){$t(this,"beaconPosition",null);$t(this,"debug");$t(this,"eventListeners",new Map);$t(this,"listeners",new Set);$t(this,"props");$t(this,"snapshot");$t(this,"state");$t(this,"steps");$t(this,"tooltipPosition",null);$t(this,"cleanupPositionData",()=>{this.beaconPosition=null,this.tooltipPosition=null});$t(this,"getPositionData",e=>e==="beacon"?this.beaconPosition:this.tooltipPosition);$t(this,"getServerSnapshot",()=>this.snapshot);$t(this,"getSnapshot",()=>this.snapshot);$t(this,"getEventState",()=>fp(this.snapshot,"positioned"));$t(this,"getState",()=>fp(this.snapshot,"positioned"));$t(this,"setPositionData",(e,t)=>{var r,i,s;((r=e==="beacon"?this.beaconPosition:this.tooltipPosition)==null?void 0:r.placement)!==t.placement&&nn(this.debug,`step:${this.state.index}`,"positioned",`${e} ${t.placement}`),e==="beacon"?this.beaconPosition=t:this.tooltipPosition=t,(this.state.lifecycle===ve.BEACON_BEFORE||this.state.lifecycle===ve.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)});$t(this,"setSteps",e=>{this.steps=e,this.updateState({size:e.length})});$t(this,"dispatch",(e,t)=>{const n=this.eventListeners.get(e.type);if(n)for(const r of n)try{r(e,t)}catch{}});$t(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)}});$t(this,"subscribe",e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}));$t(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},a=this.applyTransitions(o);if(this.state=a,!fw(i,a)){this.snapshot=Object.freeze({...a});for(const c of this.listeners)c(this.snapshot)}});const{initialStepIndex:t,stepIndex:n,steps:r=[]}=e??{},i=Sn.number(n);let s=0;this.debug=(e==null?void 0:e.debug)??!1,i?(s=n,Sn.number(t)&&nn(this.debug,"tour","initialStepIndex is ignored in controlled mode")):Sn.number(t)&&(t>=0&&t<r.length?s=t:r.length>0&&nn(this.debug,"tour","initialStepIndex is out of bounds")),this.props=e??{steps:[]},this.steps=r,this.state={action:et.INIT,controlled:i,index:s,lifecycle:ve.INIT,origin:null,positioned:!1,scrolling:!1,size:r.length,status:r.length?Je.READY:Je.IDLE,waiting:!1},this.snapshot=Object.freeze({...this.state})}applyTransitions(e){return e.status===Je.WAITING&&e.size>0?{...e,status:Je.RUNNING}:e}getStep(e){return Sw(this.props,this.steps[e??this.state.index])}};function nQ(e){return new tQ(e)}function QS(e,t){return Math.min(Math.max(e,0),t)}function rQ(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:y,status:v}=s();v===Je.RUNNING&&e.current.updateState({action:et.CLOSE,index:y+1,origin:k,lifecycle:ve.COMPLETE,positioned:!1,scrolling:!1,waiting:!1})},go:k=>{const{controlled:y,size:v,status:w}=s();if(y){nn(r.current,"tour","go() is not supported in controlled mode");return}w===Je.RUNNING&&e.current.updateState({action:et.GO,index:k,lifecycle:ve.COMPLETE,positioned:!1,scrolling:!1,status:k<v?w:Je.FINISHED,waiting:!1})},info:()=>fp(e.current.getSnapshot(),"positioned"),next:k=>{const{index:y,size:v,status:w}=s();w===Je.RUNNING&&e.current.updateState({action:et.NEXT,index:QS(y+1,v),lifecycle:ve.COMPLETE,origin:k,positioned:!1,scrolling:!1,waiting:!1})},open:()=>{const{status:k}=s();k===Je.RUNNING&&e.current.updateState({action:et.UPDATE,lifecycle:ve.TOOLTIP_BEFORE,positioned:!1,scrolling:!1,waiting:!1})},prev:k=>{const{index:y,size:v,status:w}=s();w===Je.RUNNING&&e.current.updateState({action:et.PREV,index:QS(y-1,v),lifecycle:ve.COMPLETE,origin:k,positioned:!1,scrolling:!1,waiting:!1})},reset:(k=!1)=>{const{controlled:y}=s();if(y){nn(r.current,"tour","reset() is not supported in controlled mode");return}i.current(),e.current.updateState({action:et.RESET,index:0,lifecycle:ve.INIT,positioned:!1,scrolling:!1,status:k?Je.RUNNING:Je.READY,waiting:!1})},skip:k=>{const{status:y}=s();y===Je.RUNNING&&e.current.updateState({action:et.SKIP,lifecycle:ve.COMPLETE,origin:k,positioned:!1,scrolling:!1,status:Je.SKIPPED,waiting:!1})},start:k=>{const{index:y,size:v}=s();i.current(),e.current.updateState({action:et.START,index:Sn.number(k)?k:y,lifecycle:ve.INIT,positioned:!1,scrolling:!1,status:v?Je.RUNNING:Je.WAITING,waiting:!1},!0)},stop:(k=!1)=>{const{index:y,status:v}=s();[Je.FINISHED,Je.SKIPPED].includes(v)||e.current.updateState({action:et.STOP,index:y+(k?1:0),lifecycle:ve.COMPLETE,positioned:!1,scrolling:!1,status:Je.PAUSED,waiting:!1})}}},[e])}const iQ=new Set(["origin","positioned"]);function sQ(e,t){const n=m.useRef(null);m.useEffect(()=>{if(!t)return;const r=e.current.getSnapshot();return nn(!0,"tour","init",r),n.current=r,e.current.subscribe(i=>{const s=n.current;if(n.current=i,!s)return;const o={};let a=!1;for(const c of Object.keys(i))i[c]!==s[c]&&!iQ.has(c)&&(o[c]={from:s[c],to:i[c]},(c==="status"||c==="size")&&(a=!0));Object.keys(o).length&&(!a&&i.index>=i.size||nn(!0,a?"tour":`step:${i.index}`,"state",o))})},[t,e])}function oQ(e,t,n){const r=m.useRef(e),i=m.useRef(t);return r.current=e,i.current=t,m.useCallback((s,o,a)=>{var u;const c={...n.current.getEventState(),error:null,scroll:null,step:o,type:s,...a};(u=r.current)==null||u.call(r,c,i.current),n.current.dispatch(c,i.current)},[n])}function ss(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 aQ(e){const{addFailure:t,controls:n,emitEvent:r,previousState:i,props:s,state:o,step:a,store:c}=e,{action:u,index:p,lifecycle:d,positioned:f,scrolling:h,size:g,status:b}=o,k=v_(a)??null,y=m.useRef(null),v=m.useRef(s),w=m.useRef(o),N=m.useRef(i),C=m.useRef(a),S=m.useRef(k),P=m.useRef(n),R=m.useRef(null),M=m.useRef(null),H=m.useRef(null);v.current=s,w.current=o,N.current=i,C.current=a,S.current=k,P.current=n;const _=()=>{R.current&&(clearInterval(R.current),R.current=null),M.current=null,H.current&&(H.current.cancel(),H.current=null)};m.useEffect(()=>{if(!N.current)return;const{hasChangedTo:A}=ss(w.current,N.current);(A("action",[et.NEXT,et.PREV,et.SKIP,et.CLOSE])||y.current===et.CLOSE&&u===et.START)&&(y.current=u)},[u]),m.useEffect(()=>{if(!N.current)return()=>{_()};const{hasChanged:A}=ss(w.current,N.current),U=C.current;if(A("index")&&_(),b!==Je.RUNNING||!U||d!==ve.INIT)return()=>{_()};const{hasChangedTo:L}=ss(w.current,N.current);L("status",Je.RUNNING)&&[Je.IDLE,Je.READY,Je.PAUSED].includes(N.current.status)&&r(en.TOUR_START,U),c.current.cleanupPositionData();const{debug:B}=v.current;if(U.before&&!H.current){nn(B,`step:${p}`,"before()",U),H.current={cancel:()=>{}},c.current.updateState({waiting:!0}),r(en.STEP_BEFORE_HOOK,U,{action:y.current??w.current.action});const $=()=>{H.current=null,c.current.updateState({action:y.current??w.current.action,waiting:!1,lifecycle:ve.READY})},F=new AbortController,I=U.beforeTimeout;H.current={cancel:()=>F.abort()};const T=I?setTimeout(()=>{F.signal.aborted||(nn(B,`step:${p}`,"before()","timed out",`${I}ms`),F.abort(),t(U,"before_hook"),r(en.ERROR,U,{error:new Error("Step before hook timed out")}),$())},I):null;U.before({...c.current.getState(),action:y.current??c.current.getState().action,step:U}).then(()=>{F.signal.aborted||(T&&clearTimeout(T),$())}).catch(E=>{F.signal.aborted||(T&&clearTimeout(T),t(U,"before_hook"),r(en.ERROR,U,{error:E instanceof Error?E:new Error(String(E))}),$())})}else if(!H.current){R.current&&M.current!==U.target&&_();const $=gr(U.target);if($&&Hd($))_(),c.current.updateState({action:y.current??et.UPDATE,lifecycle:ve.READY,waiting:!1});else if(U.targetWaitTimeout===0)c.current.updateState({action:y.current??et.UPDATE,lifecycle:ve.READY,waiting:!1});else if(!R.current){const{targetWaitTimeout:F}=U,I=Date.now();M.current=U.target,nn(B,`step:${p}`,"polling","started",`${F}ms`),c.current.updateState({waiting:!0}),R.current=setInterval(()=>{const T=gr(U.target),E=Date.now()-I,q=E>=F;(T&&Hd(T)||q)&&(nn(B,`step:${p}`,"polling",T&&Hd(T)?"found":"timed out",`${E}ms`),_(),c.current.updateState({action:y.current??et.UPDATE,lifecycle:ve.READY,waiting:!1}))},100)}}return()=>{_()}},[t,r,p,d,b,c]),m.useEffect(()=>{if(!N.current)return;const{hasChanged:A,hasChangedTo:U,previous:L}=ss(w.current,N.current),B=C.current;if(!B)return;const $=gr(B.target),F=!!$;if(F&&Hd($)){if(U("lifecycle",ve.READY)&&L.lifecycle===ve.INIT&&r(en.STEP_BEFORE,B,{action:y.current??w.current.action}),U("lifecycle",ve.READY)){const I=w.current,T=eQ(B,I,v.current.continuous)?ve.TOOLTIP:ve.BEACON,E=gr(B.scrollTarget??B.spotlightTarget??B.target),q=XS({isFirstStep:I.index===0,scrollToFirstStep:v.current.scrollToFirstStep,step:B,target:E,targetLifecycle:T}),W=T===ve.TOOLTIP?ve.TOOLTIP_BEFORE:ve.BEACON_BEFORE;nn(v.current.debug,`step:${p}`,"scroll",q?"needed":"skipped"),c.current.updateState({action:et.UPDATE,lifecycle:W,scrolling:q})}}else if(w.current.status===Je.RUNNING&&d!==ve.INIT&&d!==ve.COMPLETE&&A("lifecycle")){nn(v.current.debug,`step:${p}`,F?"Target not visible":"Target not mounted",B),t(B,"target_not_found"),r(en.TARGET_NOT_FOUND,B);const I=w.current;I.controlled||c.current.updateState({action:et.UPDATE,index:I.index+(I.action===et.PREV?-1:1),lifecycle:ve.INIT})}},[t,r,p,d,c]),m.useEffect(()=>{if(!N.current)return;const{hasChangedTo:A,previous:U}=ss(w.current,N.current),L=C.current,B=S.current;if(L&&A("lifecycle",ve.TOOLTIP_BEFORE)&&U.lifecycle===ve.BEACON){const I=gr(L.scrollTarget??L.spotlightTarget??L.target);if(XS({isFirstStep:w.current.index===0,scrollToFirstStep:v.current.scrollToFirstStep,step:L,target:I,targetLifecycle:ve.TOOLTIP})){c.current.updateState({scrolling:!0,positioned:!1});return}}const $=d===ve.BEACON_BEFORE||d===ve.TOOLTIP_BEFORE;if(L&&$&&!h){const I=d===ve.TOOLTIP_BEFORE?ve.TOOLTIP:ve.BEACON;c.current.updateState({action:et.UPDATE,lifecycle:I})}L&&A("lifecycle",ve.BEACON)&&r(en.BEACON,L),L&&A("lifecycle",ve.TOOLTIP)&&r(en.TOOLTIP,L);const F=w.current;if((F.status===Je.RUNNING||F.controlled&&F.status===Je.PAUSED&&L)&&B&&A("lifecycle",ve.COMPLETE)&&U.lifecycle===ve.TOOLTIP&&(r(en.STEP_AFTER,B,{action:y.current??et.UPDATE,index:U.index??F.index,lifecycle:F.lifecycle}),B.after)){r(en.STEP_AFTER_HOOK,B,{action:y.current??et.UPDATE,index:U.index??F.index,lifecycle:F.lifecycle});try{B.after({...c.current.getState(),action:y.current??et.UPDATE,index:U.index??F.index,lifecycle:F.lifecycle,step:B})}catch{}}},[r,d,f,h,c]),m.useEffect(()=>{if(!N.current)return;const{hasChangedTo:A,previous:U}=ss(w.current,N.current),L=C.current,B=S.current;g&&!L&&d===ve.INIT&&c.current.updateState({action:et.UPDATE,lifecycle:ve.COMPLETE,status:Je.FINISHED}),!w.current.controlled&&b===Je.RUNNING&&A("lifecycle",ve.COMPLETE)&&p<g&&c.current.updateState({action:et.UPDATE,lifecycle:ve.INIT}),A("lifecycle",ve.COMPLETE)&&p>=g&&c.current.updateState({action:et.UPDATE,lifecycle:ve.COMPLETE,status:Je.FINISHED});const $=L??B??Sw(v.current,v.current.steps[p-1]);if($&&A("status",[Je.FINISHED,Je.SKIPPED])){let F;L?F=p:B?F=U.index??p:F=p-1,r(en.TOUR_END,$,{index:F}),w.current.controlled||P.current.reset(),y.current=null}L&&A("action",et.STOP)&&(y.current=null,r(en.TOUR_STATUS,L)),L&&A("action",et.RESET)&&(r(en.TOUR_STATUS,L),y.current=null)},[u,r,p,d,g,b,c])}function lQ({controls:e,emitEvent:t,props:n,state:r,store:i}){const{debug:s,initialStepIndex:o,run:a,stepIndex:c,steps:u}=n,p=m.useRef(void 0),d=m.useRef(r),f=m.useRef(e);d.current=r,f.current=e,m.useEffect(()=>{const h=p.current;if(p.current=n,!h||n===h)return;const{hasChanged:g}=ss(n,h);if(fw(h.steps,u)||(K_(u,s)?i.current.setSteps(u):(nn(s,"tour","Steps are not valid",u),t(en.ERROR,u[0]??{target:"",content:""},{error:new Error("Steps are not valid")}))),g("run"))a?i.current.getState().size&&f.current.start(c??o):f.current.stop();else if(Sn.number(c)&&g("stepIndex")){const b=Sn.number(h.stepIndex)&&h.stepIndex<c?et.NEXT:et.PREV;[Je.FINISHED,Je.SKIPPED].includes(d.current.status)||i.current.updateState({action:b,index:c,lifecycle:ve.INIT,positioned:!1},!0)}},[s,t,o,n,a,c,u,i])}function cQ(e,t){var a,c,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===ve.BEACON_BEFORE&&(n!=null&&n.placement)){const d=uQ(n);["bottom"].includes(n.placement)||(o+=Math.floor(d-i))}else if(r===ve.TOOLTIP_BEFORE){const{placement:d}=s;if(d==="top"){const f=((a=document.querySelector(".react-joyride__floater"))==null?void 0:a.getBoundingClientRect().height)??0,h=(c=s.floatingOptions)!=null&&c.hideArrow?0:s.arrowSize,g=s.offset+s.spotlightPadding.top+h;o-=f+g}else if(d==="left"||d==="right"){const f=((u=document.querySelector(".react-joyride__floater"))==null?void 0:u.getBoundingClientRect().height)??0,h=((p=gr(s.target))==null?void 0:p.getBoundingClientRect().height)??0,g=i+s.spotlightPadding.top+h/2-f/2;g<i&&(o-=i-g)}}return Math.max(0,o)}function uQ(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 dQ({emitEvent:e,previousState:t,props:n,state:r,step:i,store:s}){const{index:o,lifecycle:a,positioned:c,scrolling:u,status:p}=r,d=m.useRef(null),f=m.useRef(r),h=m.useRef(t),g=m.useRef(n),b=m.useRef(i);f.current=r,h.current=t,g.current=n,b.current=i,m.useEffect(()=>()=>{var k;(k=d.current)==null||k.call(d)},[]),m.useEffect(()=>{var C;if(!h.current||!b.current)return;const{hasChangedTo:k}=ss(f.current,h.current),y=b.current,{debug:v}=g.current,{scrollDuration:w}=y,N=a===ve.BEACON_BEFORE||a===ve.TOOLTIP_BEFORE;if(p===Je.RUNNING&&N&&u&&k("positioned",!0)){const S=gr(y.scrollTarget??y.spotlightTarget??y.target),P=s.current.getPositionData("beacon"),R=Xa(S),M=R?!R.isSameNode(Un()):!1;(C=d.current)==null||C.call(d),(async()=>{if(M&&!Ja(R)){const F=Un(),I=YJ(R),T={initial:F.scrollTop,target:I,element:F,duration:w};e(en.SCROLL_START,y,{scroll:T});const{cancel:E,promise:q}=JS(I,{element:F,duration:w});d.current=E,await q,e(en.SCROLL_END,y,{scroll:T})}const _=Math.floor(qJ(S,y.scrollOffset))||0,A=M?_:cQ(_,{beaconPosition:P,lifecycle:a,scrollOffset:y.scrollOffset,step:y});nn(v,`step:${o}`,"scroll",M?"custom":"document",`${_} → ${A}`);const U=R,L={initial:U.scrollTop,target:A,element:U,duration:w};e(en.SCROLL_START,y,{scroll:L});const{cancel:B,promise:$}=JS(A,{element:U,duration:w});d.current=B,await $,e(en.SCROLL_END,y,{scroll:L}),s.current.updateState({scrolling:!1})})().catch(()=>{s.current.updateState({scrolling:!1})})}},[e,o,a,c,u,p,s])}function fQ(e){const t=qG(()=>UJ(zJ,e),[e]),{debug:n,initialStepIndex:r,onEvent:i,run:s,stepIndex:o,steps:a}=t,c=m.useRef(nQ(t)),u=zC.useSyncExternalStore(c.current.subscribe,c.current.getSnapshot,c.current.getServerSnapshot),[p,d]=m.useState([]),f=m.useCallback((C,S)=>{d(P=>[...P,{reason:S,step:C}])},[]),h=m.useCallback(()=>{d([])},[]);sQ(c,n);const g=rQ(c,n,h),b=oQ(i,g,c),{index:k,size:y,status:v}=u,w=v_(u),N=m.useMemo(()=>Sw(t,a[k]),[k,t,a]);return GG(()=>{s&&y&&K_(a,n)&&g.start(o??r)}),YG(()=>{s&&y&&v===Je.IDLE&&c.current.updateState({status:Je.READY})},[s,y,v]),lQ({controls:g,emitEvent:b,props:t,state:u,store:c}),aQ({addFailure:f,controls:g,emitEvent:b,previousState:w,props:t,state:u,step:N,store:c}),dQ({emitEvent:b,previousState:w,props:t,state:u,step:N,store:c}),{controls:g,failures:p,mergedProps:t,state:u,step:N,store:c}}function pQ(e){const[t,n]=m.useState(null);return m.useEffect(()=>{let r=null,i=!1;if(e)if(Sn.domElement(e))r=e,i=!0;else{const s=document.querySelector(e);s&&(r=s)}else{const s=document.createElement("div");s.id=BJ,document.body.appendChild(s),r=s}return n(r),()=>{!r||i||r.parentNode===document.body&&document.body.removeChild(r)}},[e]),t}const hQ={animation:"joyride-loader-spin 1s linear infinite",border:"5px solid rgba(0, 0, 0, 0.1)",borderRadius:"50%",borderTopColor:"#555"};function mQ({nonce:e,step:t}){const{loaderComponent:n}=t,r=!!n;if(m.useEffect(()=>{if(r||document.getElementById("joyride-loader-animation"))return Qc;const c=document.createElement("style");return c.id="joyride-loader-animation",e&&c.setAttribute("nonce",e),c.appendChild(document.createTextNode(`
|
|
167
|
-
@keyframes joyride-loader-spin {
|
|
168
|
-
to { transform: rotate(360deg); }
|
|
169
|
-
}
|
|
170
|
-
`)),document.head.appendChild(c),()=>{const u=document.getElementById("joyride-loader-animation");u!=null&&u.parentNode&&u.parentNode.removeChild(u)}},[r,e]),n===null)return null;const{height:i,width:s,...o}=t.styles.loader;let a;if(n){const c=n;a=Le.createElement(c,{step:t})}else a=Le.createElement("div",{style:{...hQ,height:i,width:s,borderTopColor:t.primaryColor}});return Le.createElement("div",{className:"react-joyride__loader","data-testid":"loader",style:o},a)}const gQ={height:0,isFixed:!1,left:0,top:0,width:0};function Ul(e,t){const n=gr(e);if(!n)return gQ;const r=kw(n),i=Ja(n),s=KJ(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 yQ(e,t,n){const[r,i]=m.useState(()=>Ul(e,t)),s=m.useRef(void 0),o=m.useRef(null),a=m.useRef(n),c=m.useRef(null),u=m.useCallback(()=>{clearTimeout(s.current),s.current=window.setTimeout(()=>{i(d=>{const f=Ul(e,t);return d.top===f.top&&d.left===f.left&&d.width===f.width&&d.height===f.height&&d.isFixed===f.isFixed?d:f})},100)},[e,t]);m.useEffect(()=>{let d=null;const f=g=>{o.current=Xa(g,!0),o.current&&o.current.addEventListener("scroll",u,{passive:!0}),window.addEventListener("scroll",u,{passive:!0}),window.addEventListener("resize",u),typeof ResizeObserver<"u"&&(c.current=new ResizeObserver(u),c.current.observe(g)),i(Ul(e,t))},h=gr(e);return h?f(h):(d=new MutationObserver(()=>{const g=gr(e);g&&(d==null||d.disconnect(),d=null,f(g))}),d.observe(document.body,{childList:!0,subtree:!0})),()=>{var g;d==null||d.disconnect(),o.current&&o.current.removeEventListener("scroll",u),window.removeEventListener("scroll",u),window.removeEventListener("resize",u),(g=c.current)==null||g.disconnect(),clearTimeout(s.current)}},[e,t,u]),m.useEffect(()=>{a.current&&!n&&i(Ul(e,t)),a.current=n},[n,e,t]);let p=r;return a.current&&!n&&(p=Ul(e,t)),p}function xQ(e,t,n){let r=`M0 0H${e}V${t}H0Z`;return n&&(r+=` ${n}`),r}function ZS(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 wQ=[ve.BEACON_BEFORE,ve.BEACON];function vQ(e){var $,F;const{blockTargetInteraction:t,continuous:n,hideOverlay:r,lifecycle:i,onClickOverlay:s,overlayClickAction:o,placement:a,portalElement:c,scrolling:u,spotlightPadding:p,spotlightRadius:d,spotlightTarget:f,styles:h,target:g,waiting:b}=e,k=XG(),y=yQ(f??g,p,u||b),v=m.useRef(null),w=(i===ve.TOOLTIP||i===ve.TOOLTIP_BEFORE)&&a!=="center",[N,C]=m.useState(!1),S=c?($=v.current)==null?void 0:$.offsetParent:null,P=(S==null?void 0:S.clientWidth)??k.width,R=(S==null?void 0:S.clientHeight)??WJ()??k.height,M=((F=h.overlay)==null?void 0:F.backgroundColor)??"rgba(0, 0, 0, 0.5)",H=m.useMemo(()=>{const{backgroundColor:I,mixBlendMode:T,...E}=h.overlay;return{height:R,pointerEvents:"none",...E}},[R,h.overlay]),_=w&&!u&&!b;m.useEffect(()=>{_?requestAnimationFrame(()=>C(!0)):C(!1)},[_]);const A=n&&wQ.includes(i),U=!n&&i!==ve.TOOLTIP;if(r||!b&&(A||U))return null;let L="";if(_)if(c&&S){const I=gr(f??g);if(I){const T=GS(I),E=GS(S);L=ZS(T.left-E.left-p.left,T.top-E.top-p.top,I.offsetWidth+p.left+p.right,I.offsetHeight+p.top+p.bottom,d)}}else L=ZS(y.left,y.top,y.width,y.height,d);const B=xQ(P,R,L);return Le.createElement("div",{ref:v,"aria-hidden":"true",className:"react-joyride__overlay","data-testid":"overlay",style:H},Le.createElement("svg",{className:"react-joyride__spotlight","data-testid":"spotlight",style:{height:R,left:0,position:y.isFixed?"fixed":"absolute",top:0,width:P}},Le.createElement("path",{d:B,fill:M,fillRule:"evenodd",onClick:s,style:{cursor:o?"pointer":"default",pointerEvents:"auto"}}),L&&Le.createElement("path",{d:L,fill:M,style:{opacity:N?0:1,pointerEvents:t?"auto":"none",transition:"opacity 0.2s"}}),L&&Object.keys(h.spotlight).length>0&&Le.createElement("path",{d:L,fill:"none",style:{pointerEvents:"none"},...h.spotlight})))}function Y_(e){const{children:t,element:n}=e;return n?Tr.createPortal(t,n):null}const bQ='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), area[href], [tabindex]:not([tabindex="-1"]), [contenteditable]';function kQ(e,t){const n=m.useRef(null);m.useEffect(()=>{if(!e)return Qc;n.current=document.activeElement;const r=s=>{if(s.key!=="Tab")return;const o=[...e.querySelectorAll(bQ)],{shiftKey:a}=s;if(!o.length)return;s.preventDefault();let c=document.activeElement?o.indexOf(document.activeElement):0;c===-1||!a&&c+1===o.length?c=0:a&&c===0?c=o.length-1:c+=a?-1:1,o[c].focus()};e.addEventListener("keydown",r,!1);let i;{const s=e.querySelector(t);s&&(i=setTimeout(()=>{s.focus({preventScroll:!0})},100))}return()=>{var s;e.removeEventListener("keydown",r),i!==void 0&&clearTimeout(i),(s=n.current)==null||s.focus({preventScroll:!0})}},[e,t])}function Ri(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 SQ(e,t,n){const[r]=e.split("-");switch(r){case"top":return{points:`0,0 ${t/2},${n} ${t},0`,...Ri(e,t,n)};case"bottom":return{points:`${t},${n} ${t/2},0 0,${n}`,...Ri(e,t,n)};case"left":return{points:`0,0 ${n},${t/2} 0,${t}`,...Ri(e,t,n)};case"right":return{points:`${n},${t} ${n},0 0,${t/2}`,...Ri(e,t,n)};default:return null}}function NQ(e,t,n,r){if(!t)return{};const[i]=e.split("-");switch(i){case"top":return{bottom:-n,left:t.x??0,...Ri(e,r,n)};case"bottom":return{top:-n,left:t.x??0,...Ri(e,r,n)};case"left":return{right:-n,top:t.y??0,...Ri(e,r,n)};case"right":return{left:-n,top:t.y??0,...Ri(e,r,n)};default:return{}}}function jQ({arrowComponent:e,arrowRef:t,base:n,placement:r,position:i,size:s,styles:o}){const a=e;let c=null;if(a){if(!Ri(r,n,s))return null;c=Le.createElement("span",{style:{flexShrink:0}},Le.createElement(a,{base:n,placement:r,size:s}))}else{const u=SQ(r,n,s);if(!u)return null;c=Le.createElement("svg",{height:u.height,width:u.width,xmlns:"http://www.w3.org/2000/svg"},Le.createElement("polygon",{fill:"currentColor",points:u.points}))}return Le.createElement("span",{ref:t,className:"react-joyride__arrow","data-testid":"arrow",style:{...o,...NQ(r,i,s,n),...i?{}:{visibility:"hidden"}}},c)}function CQ(e){const{beaconComponent:t,continuous:n,index:r,isLastStep:i,locale:s,nonce:o,onInteract:a,shouldFocus:c,size:u,step:p,styles:d}=e,f=m.useRef(null),h=!!t;m.useEffect(()=>{if(h||document.getElementById("joyride-beacon-animation"))return Qc;const k=document.createElement("style");k.id="joyride-beacon-animation",o&&k.setAttribute("nonce",o),k.appendChild(document.createTextNode(`
|
|
171
|
-
@keyframes joyride-beacon-inner {
|
|
172
|
-
20% {
|
|
173
|
-
opacity: 0.9;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
90% {
|
|
177
|
-
opacity: 0.7;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
@keyframes joyride-beacon-outer {
|
|
182
|
-
0% {
|
|
183
|
-
transform: scale(1);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
45% {
|
|
187
|
-
opacity: 0.7;
|
|
188
|
-
transform: scale(0.75);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
100% {
|
|
192
|
-
opacity: 0.9;
|
|
193
|
-
transform: scale(1);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
`)),document.head.appendChild(k);const y=setTimeout(()=>{Sn.domElement(f.current)&&c&&f.current.focus()},0);return()=>{clearTimeout(y);const v=document.getElementById("joyride-beacon-animation");v!=null&&v.parentNode&&v.parentNode.removeChild(v)}},[h,o,c]);const g=_i(s.open);let b;if(t){const k=t;b=Le.createElement(k,{continuous:n,index:r,isLastStep:i,size:u,step:p})}else b=Le.createElement("span",{style:d.beacon},Le.createElement("span",{style:d.beaconOuter}),Le.createElement("span",{style:d.beaconInner}));return Le.createElement("button",{ref:f,"aria-label":g,className:"react-joyride__beacon","data-testid":"button-beacon",onClick:a,onMouseEnter:a,style:d.beaconWrapper,title:g,type:"button"},b)}function EQ({styles:e,...t}){const{color:n,height:r,width:i,...s}=e;return Le.createElement("button",{style:s,type:"button",...t},Le.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"},Le.createElement("g",null,Le.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 PQ(e){const{backProps:t,closeProps:n,index:r,isLastStep:i,primaryProps:s,skipProps:o,step:a,tooltipProps:c}=e,{buttons:u,content:p,styles:d,title:f}=a,h={};u.includes("primary")&&(h.primary=Le.createElement("button",{"data-testid":"button-primary",style:d.buttonPrimary,type:"button",...s})),u.includes("skip")&&!i&&(h.skip=Le.createElement("button",{"aria-live":"off","data-testid":"button-skip",style:d.buttonSkip,type:"button",...o})),u.includes("back")&&r>0&&(h.back=Le.createElement("button",{"data-testid":"button-back",style:d.buttonBack,type:"button",...t})),h.close=u.includes("close")&&Le.createElement(EQ,{"data-testid":"button-close",styles:d.buttonClose,...n});const g=f?{"aria-labelledby":"joyride-tooltip-title","aria-describedby":"joyride-tooltip-content"}:{"aria-label":_i(p),"aria-describedby":"joyride-tooltip-content"};return Le.createElement("div",{key:"JoyrideTooltip",className:"react-joyride__tooltip","data-joyride-step":r,...a.id&&{"data-joyride-id":a.id},style:d.tooltip,...c,...g},Le.createElement("div",{style:d.tooltipContainer},f&&Le.createElement("h4",{id:"joyride-tooltip-title",style:d.tooltipTitle},f),Le.createElement("div",{id:"joyride-tooltip-content",style:d.tooltipContent},p)),u.some(b=>b==="back"||b==="primary"||b==="skip")&&Le.createElement("div",{style:d.tooltipFooter},Le.createElement("div",{style:d.tooltipFooterSpacer},h.skip),h.back,h.primary),h.close)}function _Q(e){const{continuous:t,controls:n,index:r,isLastStep:i,size:s,step:o}=e,a=y=>{y.preventDefault(),n.prev(ii.BUTTON_BACK)},c=y=>{y.preventDefault(),o.closeButtonAction==="skip"?n.skip(ii.BUTTON_CLOSE):n.close(ii.BUTTON_CLOSE)},u=y=>{if(y.preventDefault(),!t){n.close(ii.BUTTON_PRIMARY);return}n.next(ii.BUTTON_PRIMARY)},p=y=>{y.preventDefault(),n.skip(ii.BUTTON_SKIP)},d=()=>{const{back:y,close:v,last:w,next:N,nextWithProgress:C,skip:S}=o.locale,P=_i(y),R=_i(v),M=_i(w),H=_i(N),_=_i(S);let A=v,U=R;if(t){if(A=N,U=H,o.showProgress&&!i){const L=_i(C,{step:r+1,steps:s});A=Ey(C,r+1,s),U=L}i&&(A=w,U=M)}return{backProps:{"aria-label":P,children:y,"data-action":"back",onClick:a,role:"button",title:P},closeProps:{"aria-label":R,children:v,"data-action":"close",onClick:c,role:"button",title:R},primaryProps:{"aria-label":U,children:A,"data-action":"primary",onClick:u,role:"button",title:U},skipProps:{"aria-label":_,children:S,"data-action":"skip",onClick:p,role:"button",title:_},tooltipProps:{"aria-modal":!0,role:"alertdialog"}}},{arrowComponent:f,beaconComponent:h,tooltipComponent:g,...b}=o;let k;if(g){const y=g;k=Le.createElement(y,{...d(),continuous:t,controls:n,index:r,isLastStep:i,size:s,step:b})}else k=Le.createElement(PQ,{...d(),continuous:t,controls:n,index:r,isLastStep:i,size:s,step:b});return k}function IQ(e){if(e.startsWith("left"))return["top","bottom"];if(e.startsWith("right"))return["bottom","top"]}function AQ(e,t,n){var r,i;return e?[OJ()]:((r=t.floatingOptions)==null?void 0:r.flipOptions)===!1?[]:[LJ({crossAxis:!1,fallbackPlacements:IQ(n),padding:20,...(i=t.floatingOptions)==null?void 0:i.flipOptions})]}function TQ(e){var T,E,q,W,O;const{continuous:t,controls:n,index:r,lifecycle:i,nonce:s,open:o,portalElement:a,setPositionData:c,setTooltipRef:u,shouldScroll:p,size:d,step:f,target:h,updateState:g}=e,b=m.useRef(null),k=m.useRef({}),y=m.useRef({}),v=f.placement==="center",w=f.placement==="auto",N=m.useMemo(()=>({getBoundingClientRect:()=>({x:window.innerWidth/2,y:window.innerHeight/2,top:window.innerHeight/2,left:window.innerWidth/2,bottom:window.innerHeight/2,right:window.innerWidth/2,width:0,height:0})}),[]),C=m.useMemo(()=>U_(h)?Xa(h):void 0,[h]),S=m.useMemo(()=>Ja(h),[h]),P=m.useMemo(()=>C?{boundary:C,rootBoundary:"viewport"}:{},[C]),R=v||w?"bottom":f.placement,M=v?"fixed":((T=f.floatingOptions)==null?void 0:T.strategy)??(f.isFixed||S?"fixed":"absolute"),H=m.useMemo(()=>{var X,se,re,de;return v?[{name:"center",fn:({rects:ie})=>({x:(window.innerWidth-ie.floating.width)/2,y:(window.innerHeight-ie.floating.height)/2})}]:[KS(({placement:ie})=>{var ke;let me="right";ie.startsWith("top")?me="top":ie.startsWith("bottom")?me="bottom":ie.startsWith("left")&&(me="left");const ye=f.spotlightTarget?0:f.spotlightPadding[me];return f.offset+ye+((ke=f.floatingOptions)!=null&&ke.hideArrow?0:f.arrowSize)},[f.offset,f.spotlightPadding,f.spotlightTarget,f.arrowSize,(X=f.floatingOptions)==null?void 0:X.hideArrow]),...AQ(w,f,R),RJ({padding:10,...P,...(se=f.floatingOptions)==null?void 0:se.shiftOptions}),...(re=f.floatingOptions)!=null&&re.hideArrow?[]:[MJ({element:b,padding:f.arrowSpacing},[f.arrowSpacing,f.arrowBase])],...((de=f.floatingOptions)==null?void 0:de.middleware)??[]]},[v,f,w,R,P]),_=WS({...v?{elements:{reference:N}}:{},placement:R,strategy:M,middleware:H}),A=WS({strategy:M,placement:f.beaconPlacement??(w||v?"bottom":f.placement),middleware:m.useMemo(()=>{var X,se;return[KS(((se=(X=f.floatingOptions)==null?void 0:X.beaconOptions)==null?void 0:se.offset)??-18)]},[(q=(E=f.floatingOptions)==null?void 0:E.beaconOptions)==null?void 0:q.offset]),whileElementsMounted:HS});y.current=_.middlewareData,k.current=A.middlewareData,m.useEffect(()=>{var re;const{floating:X,reference:se}=_.elements;if(!(!se||!X||i!==ve.TOOLTIP))return HS(se,X,_.update,(re=f.floatingOptions)==null?void 0:re.autoUpdate)},[i,_.update,(W=f.floatingOptions)==null?void 0:W.autoUpdate,f.target,_.elements]),m.useEffect(()=>{!v&&h&&_.refs.setReference(h),h&&A.refs.setReference(h)},[A.refs,v,h,_.refs]),m.useEffect(()=>{_.isPositioned&&c("tooltip",{placement:_.placement,x:_.x??0,y:_.y??0,middlewareData:y.current})},[c,_.isPositioned,_.placement,_.x,_.y]),m.useEffect(()=>{A.isPositioned&&c("beacon",{placement:A.placement,x:A.x??0,y:A.y??0,middlewareData:k.current})},[c,A.isPositioned,A.placement,A.x,A.y]);const U=f.zIndex+100,L=m.useCallback(X=>{X.type==="mouseenter"&&f.beaconTrigger!=="hover"||g({lifecycle:ve.TOOLTIP_BEFORE,positioned:!1})},[f.beaconTrigger,g]),B=m.useCallback(X=>{X&&(_.refs.setFloating(X),u(X))},[_.refs,u]),{arrow:$,floater:F}=f.styles;let I=null;if(i===ve.TOOLTIP||i===ve.TOOLTIP_BEFORE){const X=qS({...F,..._.floatingStyles,zIndex:U,opacity:o&&_.isPositioned?1:0,...!o&&{transition:"none"}});I=Le.createElement("div",{ref:B,className:"react-joyride__floater","data-testid":"floater",id:`react-joyride-step-${r}`,style:X},Le.createElement(_Q,{continuous:t,controls:n,index:r,isLastStep:r+1===d,size:d,step:f}),!v&&!((O=f.floatingOptions)!=null&&O.hideArrow)&&Le.createElement(jQ,{arrowComponent:f.arrowComponent,arrowRef:b,base:f.arrowBase,placement:_.placement,position:_.middlewareData.arrow,size:f.arrowSize,styles:$}))}else(i===ve.BEACON||i===ve.BEACON_BEFORE)&&(I=Le.createElement("div",{ref:A.refs.setFloating,className:"react-joyride__floater","data-testid":"floater-beacon",id:`react-joyride-step-${r}-beacon`,style:qS({...A.floatingStyles,zIndex:U})},Le.createElement(CQ,{beaconComponent:f.beaconComponent,continuous:t,index:r,isLastStep:r+1===d,locale:f.locale,nonce:s,onInteract:L,shouldFocus:p,size:d,step:f,styles:f.styles})));return Le.createElement(Y_,{element:a},I)}function RQ(e){const{continuous:t,controls:n,index:r,lifecycle:i,nonce:s,portalElement:o,setPositionData:a,shouldScroll:c,size:u,step:p,updateState:d}=e,[f,h]=m.useState(null);kQ(p.disableFocusTrap?null:f,"[data-action=primary]");const g=gr(p.target),b=i===ve.TOOLTIP;return!W_(p)||!Sn.domElement(g)?null:Le.createElement(TQ,{key:`JoyrideStep-${r}`,continuous:t,controls:n,index:r,lifecycle:i,nonce:s,open:b,portalElement:o,setPositionData:a,setTooltipRef:h,shouldScroll:c,size:u,step:p,target:g,updateState:d})}function LQ({controls:e,mergedProps:t,state:n,step:r,store:i}){const{continuous:s,debug:o,nonce:a,portalElement:c,scrollToFirstStep:u}=t,p=pQ(c),{index:d,lifecycle:f,status:h}=n,g=h===Je.RUNNING,[b,k]=m.useState(!1),y=m.useRef(null),v=(r==null?void 0:r.loaderDelay)??0;m.useEffect(()=>(n.waiting?v===0?k(!0):y.current=setTimeout(()=>{k(!0)},v):k(!1),()=>{y.current&&(clearTimeout(y.current),y.current=null)}),[v,n.waiting]),m.useEffect(()=>{if(!g)return;const C=S=>{!r||f!==ve.TOOLTIP||S.key==="Escape"&&r.dismissKeyAction&&(r.dismissKeyAction==="next"?e.next(ii.KEYBOARD):e.close(ii.KEYBOARD))};return document.body.addEventListener("keydown",C,{passive:!0}),()=>{document.body.removeEventListener("keydown",C)}},[e,g,f,r]);const w=m.useCallback(()=>{(r==null?void 0:r.overlayClickAction)==="close"?e.close(ii.OVERLAY):(r==null?void 0:r.overlayClickAction)==="next"&&e.next(ii.OVERLAY)},[e,r==null?void 0:r.overlayClickAction]);if(!r||!g)return null;const N=n.action===et.START&&!r.skipBeacon&&r.placement!=="center";return Le.createElement(Le.Fragment,null,f!==ve.INIT&&Le.createElement(RQ,{...n,continuous:s,controls:e,debug:o,nonce:a,portalElement:p,setPositionData:i.current.setPositionData,shouldScroll:!r.skipScroll&&(d!==0||u),step:r,updateState:i.current.updateState}),Le.createElement(Y_,{element:p},Le.createElement(Le.Fragment,null,b&&Le.createElement(mQ,{nonce:a,step:r}),!N&&Le.createElement(vQ,{...r,continuous:s,lifecycle:f,onClickOverlay:w,portalElement:c?p:null,scrolling:n.scrolling,waiting:n.waiting}))))}function OQ(e){const{controls:t,failures:n,mergedProps:r,state:i,step:s,store:o}=fQ(e);return{controls:t,failures:n,on:m.useCallback((a,c)=>o.current.on(a,c),[o]),state:m.useMemo(()=>fp(i,"positioned"),[i]),step:s,Tour:bw()?Le.createElement(LQ,{controls:t,mergedProps:r,state:i,step:s,store:o}):null}}function MQ(e){const{Tour:t}=OQ(e);return t}function DQ(e){return bw()?Le.createElement(MQ,e):null}function $Q(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 FQ(e){return[{target:"body",content:e("onboarding:flow.intro"),disableBeacon:!0,placement:"center"}]}function zQ(e){return[{target:"body",content:e("onboarding:flow.introEmpty"),disableBeacon:!0,placement:"center"}]}const zm="af:onboarding";function BQ({page:e,hasNodes:t=!1}){const{t:n}=bt(),[r,i]=m.useState(!1),[s,o]=m.useState([]),a=m.useRef(null),c=m.useMemo(()=>e==="projects"?$Q(n):t?FQ(n):zQ(n),[e,t,n]);return m.useEffect(()=>{const u=localStorage.getItem(zm);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:",c),o(c),i(!0)},[e,t,c]),m.useEffect(()=>{if(!r)return;const u=p=>{var g;const d=p.target.closest("button");if(!d||!d.closest(".react-joyride__tooltip"))return;const h=(g=d.textContent)==null?void 0:g.trim();if(h===n("onboarding:done")||h===n("onboarding:startCreate")||h===n("onboarding:skip")){const b=localStorage.getItem(zm)||"{}",k=JSON.parse(b);h===n("onboarding:skip")?(k.projects=!0,k.flow=!0,k.completed=!0):k[e]=!0,localStorage.setItem(zm,JSON.stringify(k)),o([]),i(!1),e==="projects"&&(h===n("onboarding:done")||h===n("onboarding:startCreate"))&&(localStorage.setItem("af:newPipelineGuide","true"),setTimeout(()=>{const y=document.querySelector(".af-create-btn");y&&y.click()},500))}};return document.addEventListener("click",u,!0),()=>document.removeEventListener("click",u,!0)},[r,e,n]),!r||s.length===0?null:l.jsx(DQ,{ref:a,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 HQ(){const{navigate:e,path:t}=ko(),[n,r]=m.useState([]),[i,s]=m.useState(!1);if(m.useEffect(()=>{let p=!1;const d=async()=>{try{const h=await fetch("/api/pipeline-recent-runs");if(!h.ok)return;const g=await h.json();if(p)return;const b=Array.isArray(g.runs)?g.runs:[];r(b.filter(k=>k&&k.status==="running"))}catch{}};d();const f=window.setInterval(d,3e3);return()=>{p=!0,window.clearInterval(f)}},[]),n.length===0)return null;const o=p=>{const d=new URLSearchParams({flowId:p.flowId,flowSource:p.flowSource||"workspace"});e(`/flow?${d.toString()}`),s(!1)},a=t==="/flow"?new URLSearchParams(window.location.search):null,c=(a==null?void 0:a.get("flowId"))||"",u=n.length===1;return l.jsxs("div",{className:"af-run-indicator",role:"status","aria-live":"polite",children:[i&&!u&&l.jsx("div",{className:"af-run-indicator__menu",onMouseLeave:()=>s(!1),children:n.map(p=>l.jsxs("button",{type:"button",className:"af-run-indicator__item"+(p.flowId===c?" af-run-indicator__item--current":""),onClick:()=>o(p),title:`${p.flowId} · ${p.runId}`,children:[l.jsx("span",{className:"af-run-indicator__dot"}),l.jsx("span",{className:"af-run-indicator__flow",children:p.flowId}),l.jsx("span",{className:"af-run-indicator__run",children:p.runId.slice(0,12)})]},`${p.flowId}:${p.runId}`))}),l.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:[l.jsx("span",{className:"af-run-indicator__pulse"}),l.jsx("span",{className:"af-run-indicator__label",children:u?n[0].flowId:`${n.length} running`})]})]})}function UQ(){const{path:e}=ko();return e==="/projects"||e==="/"?l.jsx(vd,{}):e==="/nodes"?l.jsx(vd,{resourceKind:"nodes"}):e==="/skills"?l.jsx(vd,{resourceKind:"skills"}):e==="/flow"?l.jsx(hU,{}):e==="/workspace"?l.jsx($U,{}):e==="/settings"?l.jsx(AG,{}):l.jsx(vd,{})}function VQ({children:e}){const[t,n]=m.useState({loading:!0,authenticated:!1,user:null,setupRequired:!1}),[r,i]=m.useState(""),[s,o]=m.useState(""),[a,c]=m.useState(!1),[u,p]=m.useState(""),d=async()=>{try{const g=await(await fetch("/api/auth/me")).json().catch(()=>({}));n({loading:!1,authenticated:!!g.authenticated,user:g.user||null,setupRequired:!!g.setupRequired})}catch(h){n({loading:!1,authenticated:!1,user:null,setupRequired:!1}),p(String(h.message||h))}};m.useEffect(()=>{d()},[]);const f=async h=>{h.preventDefault(),c(!0),p("");try{const g=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:r,password:s})}),b=await g.json().catch(()=>({}));if(!g.ok)throw new Error(b.error||"登录失败");n({loading:!1,authenticated:!0,user:b.user||null,setupRequired:!1})}catch(g){p(String(g.message||g))}finally{c(!1)}};return t.loading?l.jsx("div",{className:"af-auth-screen",children:l.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})}}):l.jsx("div",{className:"af-auth-screen",children:l.jsxs("form",{className:"af-auth-panel",onSubmit:f,children:[l.jsxs("div",{className:"af-auth-brand",children:[l.jsx("span",{className:"material-symbols-outlined",children:"account_circle"}),l.jsxs("div",{children:[l.jsx("h1",{children:"AgentFlow"}),l.jsx("p",{children:t.setupRequired?"初始化管理员账号":"登录或创建用户"})]})]}),l.jsxs("label",{className:"af-auth-field",children:[l.jsx("span",{children:"用户名"}),l.jsx("input",{value:r,onChange:h=>i(h.target.value),autoComplete:"username",autoFocus:!0})]}),l.jsxs("label",{className:"af-auth-field",children:[l.jsx("span",{children:"密码"}),l.jsx("input",{type:"password",value:s,onChange:h=>o(h.target.value),autoComplete:t.setupRequired?"new-password":"current-password"})]}),u?l.jsx("p",{className:"af-auth-error",children:u}):null,l.jsx("button",{className:"af-auth-submit",type:"submit",disabled:a||!r.trim()||s.length<4,children:a?"处理中...":t.setupRequired?"创建并登录":"登录"})]})})}function WQ({authUser:e,onLogout:t}){const{path:n}=ko(),r=n==="/flow"||n==="/workspace";return l.jsxs("div",{className:"af-app",children:[n!=="/settings"?l.jsx(BQ,{page:r?"flow":"projects"}):null,r?null:l.jsx($T,{authUser:e,onLogout:t}),l.jsx("div",{className:r?"af-main af-main--pipeline":"af-main",children:l.jsx(UQ,{})}),l.jsx(HQ,{})]})}function KQ(){return l.jsx(wT,{children:l.jsx(VQ,{children:({user:e,onLogout:t})=>l.jsx(WQ,{authUser:e,onLogout:t})})})}const e1=document.querySelector('link[rel="icon"]');e1&&(e1.href=gj);Bm.createRoot(document.getElementById("root")).render(l.jsx(Le.StrictMode,{children:l.jsx(KQ,{})}));
|