aitable-workflow-cli 0.1.16 → 0.1.17-beta.1786415522134

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.
@@ -0,0 +1,321 @@
1
+ var sA=Object.defineProperty;var iA=(e,t,n)=>t in e?sA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var le=(e,t,n)=>iA(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();function dw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var fw={exports:{}},Eu={},hw={exports:{}},ce={};/**
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 La=Symbol.for("react.element"),oA=Symbol.for("react.portal"),aA=Symbol.for("react.fragment"),lA=Symbol.for("react.strict_mode"),cA=Symbol.for("react.profiler"),uA=Symbol.for("react.provider"),dA=Symbol.for("react.context"),fA=Symbol.for("react.forward_ref"),hA=Symbol.for("react.suspense"),pA=Symbol.for("react.memo"),mA=Symbol.for("react.lazy"),Sv=Symbol.iterator;function gA(e){return e===null||typeof e!="object"?null:(e=Sv&&e[Sv]||e["@@iterator"],typeof e=="function"?e:null)}var pw={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},mw=Object.assign,gw={};function Yi(e,t,n){this.props=e,this.context=t,this.refs=gw,this.updater=n||pw}Yi.prototype.isReactComponent={};Yi.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")};Yi.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function vw(){}vw.prototype=Yi.prototype;function Yp(e,t,n){this.props=e,this.context=t,this.refs=gw,this.updater=n||pw}var Xp=Yp.prototype=new vw;Xp.constructor=Yp;mw(Xp,Yi.prototype);Xp.isPureReactComponent=!0;var kv=Array.isArray,yw=Object.prototype.hasOwnProperty,Qp={current:null},_w={key:!0,ref:!0,__self:!0,__source:!0};function xw(e,t,n){var r,s={},i=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)yw.call(t,r)&&!_w.hasOwnProperty(r)&&(s[r]=t[r]);var l=arguments.length-2;if(l===1)s.children=n;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];s.children=c}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)s[r]===void 0&&(s[r]=l[r]);return{$$typeof:La,type:e,key:i,ref:o,props:s,_owner:Qp.current}}function vA(e,t){return{$$typeof:La,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Zp(e){return typeof e=="object"&&e!==null&&e.$$typeof===La}function yA(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Nv=/\/+/g;function Nd(e,t){return typeof e=="object"&&e!==null&&e.key!=null?yA(""+e.key):t.toString(36)}function ql(e,t,n,r,s){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case La:case oA:o=!0}}if(o)return o=e,s=s(o),e=r===""?"."+Nd(o,0):r,kv(s)?(n="",e!=null&&(n=e.replace(Nv,"$&/")+"/"),ql(s,t,n,"",function(u){return u})):s!=null&&(Zp(s)&&(s=vA(s,n+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(Nv,"$&/")+"/")+e)),t.push(s)),1;if(o=0,r=r===""?".":r+":",kv(e))for(var l=0;l<e.length;l++){i=e[l];var c=r+Nd(i,l);o+=ql(i,t,n,c,s)}else if(c=gA(e),typeof c=="function")for(e=c.call(e),l=0;!(i=e.next()).done;)i=i.value,c=r+Nd(i,l++),o+=ql(i,t,n,c,s);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function al(e,t,n){if(e==null)return e;var r=[],s=0;return ql(e,r,"","",function(i){return t.call(n,i,s++)}),r}function _A(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 lt={current:null},Yl={transition:null},xA={ReactCurrentDispatcher:lt,ReactCurrentBatchConfig:Yl,ReactCurrentOwner:Qp};function ww(){throw Error("act(...) is not supported in production builds of React.")}ce.Children={map:al,forEach:function(e,t,n){al(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return al(e,function(){t++}),t},toArray:function(e){return al(e,function(t){return t})||[]},only:function(e){if(!Zp(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};ce.Component=Yi;ce.Fragment=aA;ce.Profiler=cA;ce.PureComponent=Yp;ce.StrictMode=lA;ce.Suspense=hA;ce.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=xA;ce.act=ww;ce.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=mw({},e.props),s=e.key,i=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,o=Qp.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)yw.call(t,c)&&!_w.hasOwnProperty(c)&&(r[c]=t[c]===void 0&&l!==void 0?l[c]:t[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];r.children=l}return{$$typeof:La,type:e.type,key:s,ref:i,props:r,_owner:o}};ce.createContext=function(e){return e={$$typeof:dA,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:uA,_context:e},e.Consumer=e};ce.createElement=xw;ce.createFactory=function(e){var t=xw.bind(null,e);return t.type=e,t};ce.createRef=function(){return{current:null}};ce.forwardRef=function(e){return{$$typeof:fA,render:e}};ce.isValidElement=Zp;ce.lazy=function(e){return{$$typeof:mA,_payload:{_status:-1,_result:e},_init:_A}};ce.memo=function(e,t){return{$$typeof:pA,type:e,compare:t===void 0?null:t}};ce.startTransition=function(e){var t=Yl.transition;Yl.transition={};try{e()}finally{Yl.transition=t}};ce.unstable_act=ww;ce.useCallback=function(e,t){return lt.current.useCallback(e,t)};ce.useContext=function(e){return lt.current.useContext(e)};ce.useDebugValue=function(){};ce.useDeferredValue=function(e){return lt.current.useDeferredValue(e)};ce.useEffect=function(e,t){return lt.current.useEffect(e,t)};ce.useId=function(){return lt.current.useId()};ce.useImperativeHandle=function(e,t,n){return lt.current.useImperativeHandle(e,t,n)};ce.useInsertionEffect=function(e,t){return lt.current.useInsertionEffect(e,t)};ce.useLayoutEffect=function(e,t){return lt.current.useLayoutEffect(e,t)};ce.useMemo=function(e,t){return lt.current.useMemo(e,t)};ce.useReducer=function(e,t,n){return lt.current.useReducer(e,t,n)};ce.useRef=function(e){return lt.current.useRef(e)};ce.useState=function(e){return lt.current.useState(e)};ce.useSyncExternalStore=function(e,t,n){return lt.current.useSyncExternalStore(e,t,n)};ce.useTransition=function(){return lt.current.useTransition()};ce.version="18.3.1";hw.exports=ce;var b=hw.exports;const Zn=dw(b);/**
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 wA=b,bA=Symbol.for("react.element"),jA=Symbol.for("react.fragment"),SA=Object.prototype.hasOwnProperty,kA=wA.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,NA={key:!0,ref:!0,__self:!0,__source:!0};function bw(e,t,n){var r,s={},i=null,o=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)SA.call(t,r)&&!NA.hasOwnProperty(r)&&(s[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)s[r]===void 0&&(s[r]=t[r]);return{$$typeof:bA,type:e,key:i,ref:o,props:s,_owner:kA.current}}Eu.Fragment=jA;Eu.jsx=bw;Eu.jsxs=bw;fw.exports=Eu;var a=fw.exports,jw={exports:{}},Pt={},Sw={exports:{}},kw={};/**
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(T,R){var B=T.length;T.push(R);e:for(;0<B;){var L=B-1>>>1,F=T[L];if(0<s(F,R))T[L]=R,T[B]=F,B=L;else break e}}function n(T){return T.length===0?null:T[0]}function r(T){if(T.length===0)return null;var R=T[0],B=T.pop();if(B!==R){T[0]=B;e:for(var L=0,F=T.length,W=F>>>1;L<W;){var U=2*(L+1)-1,K=T[U],Q=U+1,J=T[Q];if(0>s(K,B))Q<F&&0>s(J,K)?(T[L]=J,T[Q]=B,L=Q):(T[L]=K,T[U]=B,L=U);else if(Q<F&&0>s(J,B))T[L]=J,T[Q]=B,L=Q;else break e}}return R}function s(T,R){var B=T.sortIndex-R.sortIndex;return B!==0?B:T.id-R.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],u=[],d=1,f=null,h=3,p=!1,v=!1,x=!1,w=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function m(T){for(var R=n(u);R!==null;){if(R.callback===null)r(u);else if(R.startTime<=T)r(u),R.sortIndex=R.expirationTime,t(c,R);else break;R=n(u)}}function _(T){if(x=!1,m(T),!v)if(n(c)!==null)v=!0,C(j);else{var R=n(u);R!==null&&M(_,R.startTime-T)}}function j(T,R){v=!1,x&&(x=!1,g(S),S=-1),p=!0;var B=h;try{for(m(R),f=n(c);f!==null&&(!(f.expirationTime>R)||T&&!D());){var L=f.callback;if(typeof L=="function"){f.callback=null,h=f.priorityLevel;var F=L(f.expirationTime<=R);R=e.unstable_now(),typeof F=="function"?f.callback=F:f===n(c)&&r(c),m(R)}else r(c);f=n(c)}if(f!==null)var W=!0;else{var U=n(u);U!==null&&M(_,U.startTime-R),W=!1}return W}finally{f=null,h=B,p=!1}}var N=!1,k=null,S=-1,P=5,$=-1;function D(){return!(e.unstable_now()-$<P)}function I(){if(k!==null){var T=e.unstable_now();$=T;var R=!0;try{R=k(!0,T)}finally{R?O():(N=!1,k=null)}}else N=!1}var O;if(typeof y=="function")O=function(){y(I)};else if(typeof MessageChannel<"u"){var E=new MessageChannel,A=E.port2;E.port1.onmessage=I,O=function(){A.postMessage(null)}}else O=function(){w(I,0)};function C(T){k=T,N||(N=!0,O())}function M(T,R){S=w(function(){T(e.unstable_now())},R)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(T){T.callback=null},e.unstable_continueExecution=function(){v||p||(v=!0,C(j))},e.unstable_forceFrameRate=function(T){0>T||125<T?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<T?Math.floor(1e3/T):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(T){switch(h){case 1:case 2:case 3:var R=3;break;default:R=h}var B=h;h=R;try{return T()}finally{h=B}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(T,R){switch(T){case 1:case 2:case 3:case 4:case 5:break;default:T=3}var B=h;h=T;try{return R()}finally{h=B}},e.unstable_scheduleCallback=function(T,R,B){var L=e.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?L+B:L):B=L,T){case 1:var F=-1;break;case 2:F=250;break;case 5:F=1073741823;break;case 4:F=1e4;break;default:F=5e3}return F=B+F,T={id:d++,callback:R,priorityLevel:T,startTime:B,expirationTime:F,sortIndex:-1},B>L?(T.sortIndex=B,t(u,T),n(c)===null&&T===n(u)&&(x?(g(S),S=-1):x=!0,M(_,B-L))):(T.sortIndex=F,t(c,T),v||p||(v=!0,C(j))),T},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(T){var R=h;return function(){var B=h;h=R;try{return T.apply(this,arguments)}finally{h=B}}}})(kw);Sw.exports=kw;var EA=Sw.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 CA=b,Ct=EA;function G(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 Nw=new Set,Qo={};function Os(e,t){Ci(e,t),Ci(e+"Capture",t)}function Ci(e,t){for(Qo[e]=t,e=0;e<t.length;e++)Nw.add(t[e])}var or=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Kf=Object.prototype.hasOwnProperty,AA=/^[: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]*$/,Ev={},Cv={};function TA(e){return Kf.call(Cv,e)?!0:Kf.call(Ev,e)?!1:AA.test(e)?Cv[e]=!0:(Ev[e]=!0,!1)}function PA(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 MA(e,t,n,r){if(t===null||typeof t>"u"||PA(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 ct(e,t,n,r,s,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var Qe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Qe[e]=new ct(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Qe[t]=new ct(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Qe[e]=new ct(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Qe[e]=new ct(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){Qe[e]=new ct(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Qe[e]=new ct(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Qe[e]=new ct(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Qe[e]=new ct(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Qe[e]=new ct(e,5,!1,e.toLowerCase(),null,!1,!1)});var Jp=/[\-:]([a-z])/g;function em(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(Jp,em);Qe[t]=new ct(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(Jp,em);Qe[t]=new ct(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(Jp,em);Qe[t]=new ct(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Qe[e]=new ct(e,1,!1,e.toLowerCase(),null,!1,!1)});Qe.xlinkHref=new ct("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Qe[e]=new ct(e,1,!1,e.toLowerCase(),null,!0,!0)});function tm(e,t,n,r){var s=Qe.hasOwnProperty(t)?Qe[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(MA(t,n,s,r)&&(n=null),r||s===null?TA(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):s.mustUseProperty?e[s.propertyName]=n===null?s.type===3?!1:"":n:(t=s.attributeName,r=s.attributeNamespace,n===null?e.removeAttribute(t):(s=s.type,n=s===3||s===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var pr=CA.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,ll=Symbol.for("react.element"),Qs=Symbol.for("react.portal"),Zs=Symbol.for("react.fragment"),nm=Symbol.for("react.strict_mode"),Gf=Symbol.for("react.profiler"),Ew=Symbol.for("react.provider"),Cw=Symbol.for("react.context"),rm=Symbol.for("react.forward_ref"),qf=Symbol.for("react.suspense"),Yf=Symbol.for("react.suspense_list"),sm=Symbol.for("react.memo"),wr=Symbol.for("react.lazy"),Aw=Symbol.for("react.offscreen"),Av=Symbol.iterator;function ao(e){return e===null||typeof e!="object"?null:(e=Av&&e[Av]||e["@@iterator"],typeof e=="function"?e:null)}var Me=Object.assign,Ed;function wo(e){if(Ed===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Ed=t&&t[1]||""}return`
34
+ `+Ed+e}var Cd=!1;function Ad(e,t){if(!e||Cd)return"";Cd=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var r=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){r=u}e.call(t.prototype)}else{try{throw Error()}catch(u){r=u}e()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var s=u.stack.split(`
35
+ `),i=r.stack.split(`
36
+ `),o=s.length-1,l=i.length-1;1<=o&&0<=l&&s[o]!==i[l];)l--;for(;1<=o&&0<=l;o--,l--)if(s[o]!==i[l]){if(o!==1||l!==1)do if(o--,l--,0>l||s[o]!==i[l]){var c=`
37
+ `+s[o].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{Cd=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?wo(e):""}function IA(e){switch(e.tag){case 5:return wo(e.type);case 16:return wo("Lazy");case 13:return wo("Suspense");case 19:return wo("SuspenseList");case 0:case 2:case 15:return e=Ad(e.type,!1),e;case 11:return e=Ad(e.type.render,!1),e;case 1:return e=Ad(e.type,!0),e;default:return""}}function Xf(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 Zs:return"Fragment";case Qs:return"Portal";case Gf:return"Profiler";case nm:return"StrictMode";case qf:return"Suspense";case Yf:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Cw:return(e.displayName||"Context")+".Consumer";case Ew:return(e._context.displayName||"Context")+".Provider";case rm:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case sm:return t=e.displayName||null,t!==null?t:Xf(e.type)||"Memo";case wr:t=e._payload,e=e._init;try{return Xf(e(t))}catch{}}return null}function RA(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 Xf(t);case 8:return t===nm?"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 zr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Tw(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function OA(e){var t=Tw(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function cl(e){e._valueTracker||(e._valueTracker=OA(e))}function Pw(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Tw(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function jc(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 Qf(e,t){var n=t.checked;return Me({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Tv(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=zr(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 Mw(e,t){t=t.checked,t!=null&&tm(e,"checked",t,!1)}function Zf(e,t){Mw(e,t);var n=zr(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")?Jf(e,t.type,n):t.hasOwnProperty("defaultValue")&&Jf(e,t.type,zr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Pv(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 Jf(e,t,n){(t!=="number"||jc(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var bo=Array.isArray;function _i(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s<n.length;s++)t["$"+n[s]]=!0;for(n=0;n<e.length;n++)s=t.hasOwnProperty("$"+e[n].value),e[n].selected!==s&&(e[n].selected=s),s&&r&&(e[n].defaultSelected=!0)}else{for(n=""+zr(n),t=null,s=0;s<e.length;s++){if(e[s].value===n){e[s].selected=!0,r&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function eh(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(G(91));return Me({},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(G(92));if(bo(n)){if(1<n.length)throw Error(G(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:zr(n)}}function Iw(e,t){var n=zr(t.value),r=zr(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 Iv(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Rw(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 th(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Rw(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var ul,Ow=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,s){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,s)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(ul=ul||document.createElement("div"),ul.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=ul.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Zo(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Mo={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},$A=["Webkit","ms","Moz","O"];Object.keys(Mo).forEach(function(e){$A.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Mo[t]=Mo[e]})});function $w(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Mo.hasOwnProperty(e)&&Mo[e]?(""+t).trim():t+"px"}function Lw(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=$w(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var LA=Me({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 nh(e,t){if(t){if(LA[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(G(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(G(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(G(61))}if(t.style!=null&&typeof t.style!="object")throw Error(G(62))}}function rh(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 sh=null;function im(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ih=null,xi=null,wi=null;function Rv(e){if(e=Va(e)){if(typeof ih!="function")throw Error(G(280));var t=e.stateNode;t&&(t=Mu(t),ih(e.stateNode,e.type,t))}}function Dw(e){xi?wi?wi.push(e):wi=[e]:xi=e}function zw(){if(xi){var e=xi,t=wi;if(wi=xi=null,Rv(e),t)for(e=0;e<t.length;e++)Rv(t[e])}}function Vw(e,t){return e(t)}function Fw(){}var Td=!1;function Bw(e,t,n){if(Td)return e(t,n);Td=!0;try{return Vw(e,t,n)}finally{Td=!1,(xi!==null||wi!==null)&&(Fw(),zw())}}function Jo(e,t){var n=e.stateNode;if(n===null)return null;var r=Mu(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(G(231,t,typeof n));return n}var oh=!1;if(or)try{var lo={};Object.defineProperty(lo,"passive",{get:function(){oh=!0}}),window.addEventListener("test",lo,lo),window.removeEventListener("test",lo,lo)}catch{oh=!1}function DA(e,t,n,r,s,i,o,l,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(d){this.onError(d)}}var Io=!1,Sc=null,kc=!1,ah=null,zA={onError:function(e){Io=!0,Sc=e}};function VA(e,t,n,r,s,i,o,l,c){Io=!1,Sc=null,DA.apply(zA,arguments)}function FA(e,t,n,r,s,i,o,l,c){if(VA.apply(this,arguments),Io){if(Io){var u=Sc;Io=!1,Sc=null}else throw Error(G(198));kc||(kc=!0,ah=u)}}function $s(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 Hw(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 Ov(e){if($s(e)!==e)throw Error(G(188))}function BA(e){var t=e.alternate;if(!t){if(t=$s(e),t===null)throw Error(G(188));return t!==e?null:e}for(var n=e,r=t;;){var s=n.return;if(s===null)break;var i=s.alternate;if(i===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===n)return Ov(s),e;if(i===r)return Ov(s),t;i=i.sibling}throw Error(G(188))}if(n.return!==r.return)n=s,r=i;else{for(var o=!1,l=s.child;l;){if(l===n){o=!0,n=s,r=i;break}if(l===r){o=!0,r=s,n=i;break}l=l.sibling}if(!o){for(l=i.child;l;){if(l===n){o=!0,n=i,r=s;break}if(l===r){o=!0,r=i,n=s;break}l=l.sibling}if(!o)throw Error(G(189))}}if(n.alternate!==r)throw Error(G(190))}if(n.tag!==3)throw Error(G(188));return n.stateNode.current===n?e:t}function Uw(e){return e=BA(e),e!==null?Ww(e):null}function Ww(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Ww(e);if(t!==null)return t;e=e.sibling}return null}var Kw=Ct.unstable_scheduleCallback,$v=Ct.unstable_cancelCallback,HA=Ct.unstable_shouldYield,UA=Ct.unstable_requestPaint,ze=Ct.unstable_now,WA=Ct.unstable_getCurrentPriorityLevel,om=Ct.unstable_ImmediatePriority,Gw=Ct.unstable_UserBlockingPriority,Nc=Ct.unstable_NormalPriority,KA=Ct.unstable_LowPriority,qw=Ct.unstable_IdlePriority,Cu=null,Cn=null;function GA(e){if(Cn&&typeof Cn.onCommitFiberRoot=="function")try{Cn.onCommitFiberRoot(Cu,e,void 0,(e.current.flags&128)===128)}catch{}}var ln=Math.clz32?Math.clz32:XA,qA=Math.log,YA=Math.LN2;function XA(e){return e>>>=0,e===0?32:31-(qA(e)/YA|0)|0}var dl=64,fl=4194304;function jo(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 Ec(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~s;l!==0?r=jo(l):(i&=o,i!==0&&(r=jo(i)))}else o=n&~s,o!==0?r=jo(o):i!==0&&(r=jo(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,i=t&-t,s>=i||s===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-ln(t),s=1<<n,r|=e[n],t&=~s;return r}function QA(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 ZA(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes;0<i;){var o=31-ln(i),l=1<<o,c=s[o];c===-1?(!(l&n)||l&r)&&(s[o]=QA(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}}function lh(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Yw(){var e=dl;return dl<<=1,!(dl&4194240)&&(dl=64),e}function Pd(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Da(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-ln(t),e[t]=n}function JA(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var s=31-ln(n),i=1<<s;t[s]=0,r[s]=-1,e[s]=-1,n&=~i}}function am(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-ln(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}var _e=0;function Xw(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Qw,lm,Zw,Jw,e1,ch=!1,hl=[],Tr=null,Pr=null,Mr=null,ea=new Map,ta=new Map,Sr=[],eT="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 Lv(e,t){switch(e){case"focusin":case"focusout":Tr=null;break;case"dragenter":case"dragleave":Pr=null;break;case"mouseover":case"mouseout":Mr=null;break;case"pointerover":case"pointerout":ea.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ta.delete(t.pointerId)}}function co(e,t,n,r,s,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[s]},t!==null&&(t=Va(t),t!==null&&lm(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function tT(e,t,n,r,s){switch(t){case"focusin":return Tr=co(Tr,e,t,n,r,s),!0;case"dragenter":return Pr=co(Pr,e,t,n,r,s),!0;case"mouseover":return Mr=co(Mr,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return ea.set(i,co(ea.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,ta.set(i,co(ta.get(i)||null,e,t,n,r,s)),!0}return!1}function t1(e){var t=ls(e.target);if(t!==null){var n=$s(t);if(n!==null){if(t=n.tag,t===13){if(t=Hw(n),t!==null){e.blockedOn=t,e1(e.priority,function(){Zw(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 Xl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=uh(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);sh=r,n.target.dispatchEvent(r),sh=null}else return t=Va(n),t!==null&&lm(t),e.blockedOn=n,!1;t.shift()}return!0}function Dv(e,t,n){Xl(e)&&n.delete(t)}function nT(){ch=!1,Tr!==null&&Xl(Tr)&&(Tr=null),Pr!==null&&Xl(Pr)&&(Pr=null),Mr!==null&&Xl(Mr)&&(Mr=null),ea.forEach(Dv),ta.forEach(Dv)}function uo(e,t){e.blockedOn===t&&(e.blockedOn=null,ch||(ch=!0,Ct.unstable_scheduleCallback(Ct.unstable_NormalPriority,nT)))}function na(e){function t(s){return uo(s,e)}if(0<hl.length){uo(hl[0],e);for(var n=1;n<hl.length;n++){var r=hl[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Tr!==null&&uo(Tr,e),Pr!==null&&uo(Pr,e),Mr!==null&&uo(Mr,e),ea.forEach(t),ta.forEach(t),n=0;n<Sr.length;n++)r=Sr[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Sr.length&&(n=Sr[0],n.blockedOn===null);)t1(n),n.blockedOn===null&&Sr.shift()}var bi=pr.ReactCurrentBatchConfig,Cc=!0;function rT(e,t,n,r){var s=_e,i=bi.transition;bi.transition=null;try{_e=1,cm(e,t,n,r)}finally{_e=s,bi.transition=i}}function sT(e,t,n,r){var s=_e,i=bi.transition;bi.transition=null;try{_e=4,cm(e,t,n,r)}finally{_e=s,bi.transition=i}}function cm(e,t,n,r){if(Cc){var s=uh(e,t,n,r);if(s===null)Fd(e,t,r,Ac,n),Lv(e,r);else if(tT(s,e,t,n,r))r.stopPropagation();else if(Lv(e,r),t&4&&-1<eT.indexOf(e)){for(;s!==null;){var i=Va(s);if(i!==null&&Qw(i),i=uh(e,t,n,r),i===null&&Fd(e,t,r,Ac,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else Fd(e,t,r,null,n)}}var Ac=null;function uh(e,t,n,r){if(Ac=null,e=im(r),e=ls(e),e!==null)if(t=$s(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Hw(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 Ac=e,null}function n1(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(WA()){case om:return 1;case Gw:return 4;case Nc:case KA:return 16;case qw:return 536870912;default:return 16}default:return 16}}var Er=null,um=null,Ql=null;function r1(){if(Ql)return Ql;var e,t=um,n=t.length,r,s="value"in Er?Er.value:Er.textContent,i=s.length;for(e=0;e<n&&t[e]===s[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===s[i-r];r++);return Ql=s.slice(e,1<r?1-r:void 0)}function Zl(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 pl(){return!0}function zv(){return!1}function Mt(e){function t(n,r,s,i,o){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?pl:zv,this.isPropagationStopped=zv,this}return Me(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=pl)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=pl)},persist:function(){},isPersistent:pl}),t}var Xi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},dm=Mt(Xi),za=Me({},Xi,{view:0,detail:0}),iT=Mt(za),Md,Id,fo,Au=Me({},za,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:fm,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!==fo&&(fo&&e.type==="mousemove"?(Md=e.screenX-fo.screenX,Id=e.screenY-fo.screenY):Id=Md=0,fo=e),Md)},movementY:function(e){return"movementY"in e?e.movementY:Id}}),Vv=Mt(Au),oT=Me({},Au,{dataTransfer:0}),aT=Mt(oT),lT=Me({},za,{relatedTarget:0}),Rd=Mt(lT),cT=Me({},Xi,{animationName:0,elapsedTime:0,pseudoElement:0}),uT=Mt(cT),dT=Me({},Xi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),fT=Mt(dT),hT=Me({},Xi,{data:0}),Fv=Mt(hT),pT={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},mT={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"},gT={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function vT(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=gT[e])?!!t[e]:!1}function fm(){return vT}var yT=Me({},za,{key:function(e){if(e.key){var t=pT[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Zl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?mT[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:fm,charCode:function(e){return e.type==="keypress"?Zl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Zl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),_T=Mt(yT),xT=Me({},Au,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Bv=Mt(xT),wT=Me({},za,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:fm}),bT=Mt(wT),jT=Me({},Xi,{propertyName:0,elapsedTime:0,pseudoElement:0}),ST=Mt(jT),kT=Me({},Au,{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}),NT=Mt(kT),ET=[9,13,27,32],hm=or&&"CompositionEvent"in window,Ro=null;or&&"documentMode"in document&&(Ro=document.documentMode);var CT=or&&"TextEvent"in window&&!Ro,s1=or&&(!hm||Ro&&8<Ro&&11>=Ro),Hv=" ",Uv=!1;function i1(e,t){switch(e){case"keyup":return ET.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function o1(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Js=!1;function AT(e,t){switch(e){case"compositionend":return o1(t);case"keypress":return t.which!==32?null:(Uv=!0,Hv);case"textInput":return e=t.data,e===Hv&&Uv?null:e;default:return null}}function TT(e,t){if(Js)return e==="compositionend"||!hm&&i1(e,t)?(e=r1(),Ql=um=Er=null,Js=!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 s1&&t.locale!=="ko"?null:t.data;default:return null}}var PT={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 Wv(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!PT[e.type]:t==="textarea"}function a1(e,t,n,r){Dw(r),t=Tc(t,"onChange"),0<t.length&&(n=new dm("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Oo=null,ra=null;function MT(e){y1(e,0)}function Tu(e){var t=ni(e);if(Pw(t))return e}function IT(e,t){if(e==="change")return t}var l1=!1;if(or){var Od;if(or){var $d="oninput"in document;if(!$d){var Kv=document.createElement("div");Kv.setAttribute("oninput","return;"),$d=typeof Kv.oninput=="function"}Od=$d}else Od=!1;l1=Od&&(!document.documentMode||9<document.documentMode)}function Gv(){Oo&&(Oo.detachEvent("onpropertychange",c1),ra=Oo=null)}function c1(e){if(e.propertyName==="value"&&Tu(ra)){var t=[];a1(t,ra,e,im(e)),Bw(MT,t)}}function RT(e,t,n){e==="focusin"?(Gv(),Oo=t,ra=n,Oo.attachEvent("onpropertychange",c1)):e==="focusout"&&Gv()}function OT(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Tu(ra)}function $T(e,t){if(e==="click")return Tu(t)}function LT(e,t){if(e==="input"||e==="change")return Tu(t)}function DT(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var fn=typeof Object.is=="function"?Object.is:DT;function sa(e,t){if(fn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var s=n[r];if(!Kf.call(t,s)||!fn(e[s],t[s]))return!1}return!0}function qv(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Yv(e,t){var n=qv(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=qv(n)}}function u1(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?u1(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function d1(){for(var e=window,t=jc();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=jc(e.document)}return t}function pm(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 zT(e){var t=d1(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&u1(n.ownerDocument.documentElement,n)){if(r!==null&&pm(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!e.extend&&i>r&&(s=r,r=i,i=s),s=Yv(n,i);var o=Yv(n,r);s&&o&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var VT=or&&"documentMode"in document&&11>=document.documentMode,ei=null,dh=null,$o=null,fh=!1;function Xv(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;fh||ei==null||ei!==jc(r)||(r=ei,"selectionStart"in r&&pm(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}),$o&&sa($o,r)||($o=r,r=Tc(dh,"onSelect"),0<r.length&&(t=new dm("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=ei)))}function ml(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var ti={animationend:ml("Animation","AnimationEnd"),animationiteration:ml("Animation","AnimationIteration"),animationstart:ml("Animation","AnimationStart"),transitionend:ml("Transition","TransitionEnd")},Ld={},f1={};or&&(f1=document.createElement("div").style,"AnimationEvent"in window||(delete ti.animationend.animation,delete ti.animationiteration.animation,delete ti.animationstart.animation),"TransitionEvent"in window||delete ti.transitionend.transition);function Pu(e){if(Ld[e])return Ld[e];if(!ti[e])return e;var t=ti[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in f1)return Ld[e]=t[n];return e}var h1=Pu("animationend"),p1=Pu("animationiteration"),m1=Pu("animationstart"),g1=Pu("transitionend"),v1=new Map,Qv="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 Wr(e,t){v1.set(e,t),Os(t,[e])}for(var Dd=0;Dd<Qv.length;Dd++){var zd=Qv[Dd],FT=zd.toLowerCase(),BT=zd[0].toUpperCase()+zd.slice(1);Wr(FT,"on"+BT)}Wr(h1,"onAnimationEnd");Wr(p1,"onAnimationIteration");Wr(m1,"onAnimationStart");Wr("dblclick","onDoubleClick");Wr("focusin","onFocus");Wr("focusout","onBlur");Wr(g1,"onTransitionEnd");Ci("onMouseEnter",["mouseout","mouseover"]);Ci("onMouseLeave",["mouseout","mouseover"]);Ci("onPointerEnter",["pointerout","pointerover"]);Ci("onPointerLeave",["pointerout","pointerover"]);Os("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Os("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Os("onBeforeInput",["compositionend","keypress","textInput","paste"]);Os("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Os("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Os("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var So="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(" "),HT=new Set("cancel close invalid load scroll toggle".split(" ").concat(So));function Zv(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,FA(r,t,void 0,e),e.currentTarget=null}function y1(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],s=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var o=r.length-1;0<=o;o--){var l=r[o],c=l.instance,u=l.currentTarget;if(l=l.listener,c!==i&&s.isPropagationStopped())break e;Zv(s,l,u),i=c}else for(o=0;o<r.length;o++){if(l=r[o],c=l.instance,u=l.currentTarget,l=l.listener,c!==i&&s.isPropagationStopped())break e;Zv(s,l,u),i=c}}}if(kc)throw e=ah,kc=!1,ah=null,e}function be(e,t){var n=t[vh];n===void 0&&(n=t[vh]=new Set);var r=e+"__bubble";n.has(r)||(_1(t,e,2,!1),n.add(r))}function Vd(e,t,n){var r=0;t&&(r|=4),_1(n,e,r,t)}var gl="_reactListening"+Math.random().toString(36).slice(2);function ia(e){if(!e[gl]){e[gl]=!0,Nw.forEach(function(n){n!=="selectionchange"&&(HT.has(n)||Vd(n,!1,e),Vd(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[gl]||(t[gl]=!0,Vd("selectionchange",!1,t))}}function _1(e,t,n,r){switch(n1(t)){case 1:var s=rT;break;case 4:s=sT;break;default:s=cm}n=s.bind(null,t,n,e),s=void 0,!oh||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),r?s!==void 0?e.addEventListener(t,n,{capture:!0,passive:s}):e.addEventListener(t,n,!0):s!==void 0?e.addEventListener(t,n,{passive:s}):e.addEventListener(t,n,!1)}function Fd(e,t,n,r,s){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var l=r.stateNode.containerInfo;if(l===s||l.nodeType===8&&l.parentNode===s)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===s||c.nodeType===8&&c.parentNode===s))return;o=o.return}for(;l!==null;){if(o=ls(l),o===null)return;if(c=o.tag,c===5||c===6){r=i=o;continue e}l=l.parentNode}}r=r.return}Bw(function(){var u=i,d=im(n),f=[];e:{var h=v1.get(e);if(h!==void 0){var p=dm,v=e;switch(e){case"keypress":if(Zl(n)===0)break e;case"keydown":case"keyup":p=_T;break;case"focusin":v="focus",p=Rd;break;case"focusout":v="blur",p=Rd;break;case"beforeblur":case"afterblur":p=Rd;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":p=Vv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=aT;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=bT;break;case h1:case p1:case m1:p=uT;break;case g1:p=ST;break;case"scroll":p=iT;break;case"wheel":p=NT;break;case"copy":case"cut":case"paste":p=fT;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=Bv}var x=(t&4)!==0,w=!x&&e==="scroll",g=x?h!==null?h+"Capture":null:h;x=[];for(var y=u,m;y!==null;){m=y;var _=m.stateNode;if(m.tag===5&&_!==null&&(m=_,g!==null&&(_=Jo(y,g),_!=null&&x.push(oa(y,_,m)))),w)break;y=y.return}0<x.length&&(h=new p(h,v,null,n,d),f.push({event:h,listeners:x}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",h&&n!==sh&&(v=n.relatedTarget||n.fromElement)&&(ls(v)||v[ar]))break e;if((p||h)&&(h=d.window===d?d:(h=d.ownerDocument)?h.defaultView||h.parentWindow:window,p?(v=n.relatedTarget||n.toElement,p=u,v=v?ls(v):null,v!==null&&(w=$s(v),v!==w||v.tag!==5&&v.tag!==6)&&(v=null)):(p=null,v=u),p!==v)){if(x=Vv,_="onMouseLeave",g="onMouseEnter",y="mouse",(e==="pointerout"||e==="pointerover")&&(x=Bv,_="onPointerLeave",g="onPointerEnter",y="pointer"),w=p==null?h:ni(p),m=v==null?h:ni(v),h=new x(_,y+"leave",p,n,d),h.target=w,h.relatedTarget=m,_=null,ls(d)===u&&(x=new x(g,y+"enter",v,n,d),x.target=m,x.relatedTarget=w,_=x),w=_,p&&v)t:{for(x=p,g=v,y=0,m=x;m;m=Us(m))y++;for(m=0,_=g;_;_=Us(_))m++;for(;0<y-m;)x=Us(x),y--;for(;0<m-y;)g=Us(g),m--;for(;y--;){if(x===g||g!==null&&x===g.alternate)break t;x=Us(x),g=Us(g)}x=null}else x=null;p!==null&&Jv(f,h,p,x,!1),v!==null&&w!==null&&Jv(f,w,v,x,!0)}}e:{if(h=u?ni(u):window,p=h.nodeName&&h.nodeName.toLowerCase(),p==="select"||p==="input"&&h.type==="file")var j=IT;else if(Wv(h))if(l1)j=LT;else{j=OT;var N=RT}else(p=h.nodeName)&&p.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(j=$T);if(j&&(j=j(e,u))){a1(f,j,n,d);break e}N&&N(e,h,u),e==="focusout"&&(N=h._wrapperState)&&N.controlled&&h.type==="number"&&Jf(h,"number",h.value)}switch(N=u?ni(u):window,e){case"focusin":(Wv(N)||N.contentEditable==="true")&&(ei=N,dh=u,$o=null);break;case"focusout":$o=dh=ei=null;break;case"mousedown":fh=!0;break;case"contextmenu":case"mouseup":case"dragend":fh=!1,Xv(f,n,d);break;case"selectionchange":if(VT)break;case"keydown":case"keyup":Xv(f,n,d)}var k;if(hm)e:{switch(e){case"compositionstart":var S="onCompositionStart";break e;case"compositionend":S="onCompositionEnd";break e;case"compositionupdate":S="onCompositionUpdate";break e}S=void 0}else Js?i1(e,n)&&(S="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(S="onCompositionStart");S&&(s1&&n.locale!=="ko"&&(Js||S!=="onCompositionStart"?S==="onCompositionEnd"&&Js&&(k=r1()):(Er=d,um="value"in Er?Er.value:Er.textContent,Js=!0)),N=Tc(u,S),0<N.length&&(S=new Fv(S,e,null,n,d),f.push({event:S,listeners:N}),k?S.data=k:(k=o1(n),k!==null&&(S.data=k)))),(k=CT?AT(e,n):TT(e,n))&&(u=Tc(u,"onBeforeInput"),0<u.length&&(d=new Fv("onBeforeInput","beforeinput",null,n,d),f.push({event:d,listeners:u}),d.data=k))}y1(f,t)})}function oa(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Tc(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=Jo(e,n),i!=null&&r.unshift(oa(e,i,s)),i=Jo(e,t),i!=null&&r.push(oa(e,i,s))),e=e.return}return r}function Us(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Jv(e,t,n,r,s){for(var i=t._reactName,o=[];n!==null&&n!==r;){var l=n,c=l.alternate,u=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&u!==null&&(l=u,s?(c=Jo(n,i),c!=null&&o.unshift(oa(n,c,l))):s||(c=Jo(n,i),c!=null&&o.push(oa(n,c,l)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var UT=/\r\n?/g,WT=/\u0000|\uFFFD/g;function ey(e){return(typeof e=="string"?e:""+e).replace(UT,`
38
+ `).replace(WT,"")}function vl(e,t,n){if(t=ey(t),ey(e)!==t&&n)throw Error(G(425))}function Pc(){}var hh=null,ph=null;function mh(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 gh=typeof setTimeout=="function"?setTimeout:void 0,KT=typeof clearTimeout=="function"?clearTimeout:void 0,ty=typeof Promise=="function"?Promise:void 0,GT=typeof queueMicrotask=="function"?queueMicrotask:typeof ty<"u"?function(e){return ty.resolve(null).then(e).catch(qT)}:gh;function qT(e){setTimeout(function(){throw e})}function Bd(e,t){var n=t,r=0;do{var s=n.nextSibling;if(e.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(r===0){e.removeChild(s),na(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);na(t)}function Ir(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 ny(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 Qi=Math.random().toString(36).slice(2),Sn="__reactFiber$"+Qi,aa="__reactProps$"+Qi,ar="__reactContainer$"+Qi,vh="__reactEvents$"+Qi,YT="__reactListeners$"+Qi,XT="__reactHandles$"+Qi;function ls(e){var t=e[Sn];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ar]||n[Sn]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=ny(e);e!==null;){if(n=e[Sn])return n;e=ny(e)}return t}e=n,n=e.parentNode}return null}function Va(e){return e=e[Sn]||e[ar],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function ni(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(G(33))}function Mu(e){return e[aa]||null}var yh=[],ri=-1;function Kr(e){return{current:e}}function Se(e){0>ri||(e.current=yh[ri],yh[ri]=null,ri--)}function xe(e,t){ri++,yh[ri]=e.current,e.current=t}var Vr={},rt=Kr(Vr),pt=Kr(!1),xs=Vr;function Ai(e,t){var n=e.type.contextTypes;if(!n)return Vr;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function mt(e){return e=e.childContextTypes,e!=null}function Mc(){Se(pt),Se(rt)}function ry(e,t,n){if(rt.current!==Vr)throw Error(G(168));xe(rt,t),xe(pt,n)}function x1(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(G(108,RA(e)||"Unknown",s));return Me({},n,r)}function Ic(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Vr,xs=rt.current,xe(rt,e),xe(pt,pt.current),!0}function sy(e,t,n){var r=e.stateNode;if(!r)throw Error(G(169));n?(e=x1(e,t,xs),r.__reactInternalMemoizedMergedChildContext=e,Se(pt),Se(rt),xe(rt,e)):Se(pt),xe(pt,n)}var Hn=null,Iu=!1,Hd=!1;function w1(e){Hn===null?Hn=[e]:Hn.push(e)}function QT(e){Iu=!0,w1(e)}function Gr(){if(!Hd&&Hn!==null){Hd=!0;var e=0,t=_e;try{var n=Hn;for(_e=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Hn=null,Iu=!1}catch(s){throw Hn!==null&&(Hn=Hn.slice(e+1)),Kw(om,Gr),s}finally{_e=t,Hd=!1}}return null}var si=[],ii=0,Rc=null,Oc=0,zt=[],Vt=0,ws=null,qn=1,Yn="";function ts(e,t){si[ii++]=Oc,si[ii++]=Rc,Rc=e,Oc=t}function b1(e,t,n){zt[Vt++]=qn,zt[Vt++]=Yn,zt[Vt++]=ws,ws=e;var r=qn;e=Yn;var s=32-ln(r)-1;r&=~(1<<s),n+=1;var i=32-ln(t)+s;if(30<i){var o=s-s%5;i=(r&(1<<o)-1).toString(32),r>>=o,s-=o,qn=1<<32-ln(t)+s|n<<s|r,Yn=i+e}else qn=1<<i|n<<s|r,Yn=e}function mm(e){e.return!==null&&(ts(e,1),b1(e,1,0))}function gm(e){for(;e===Rc;)Rc=si[--ii],si[ii]=null,Oc=si[--ii],si[ii]=null;for(;e===ws;)ws=zt[--Vt],zt[Vt]=null,Yn=zt[--Vt],zt[Vt]=null,qn=zt[--Vt],zt[Vt]=null}var kt=null,jt=null,Ee=!1,nn=null;function j1(e,t){var n=Ht(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 iy(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,kt=e,jt=Ir(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,kt=e,jt=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=ws!==null?{id:qn,overflow:Yn}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Ht(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,kt=e,jt=null,!0):!1;default:return!1}}function _h(e){return(e.mode&1)!==0&&(e.flags&128)===0}function xh(e){if(Ee){var t=jt;if(t){var n=t;if(!iy(e,t)){if(_h(e))throw Error(G(418));t=Ir(n.nextSibling);var r=kt;t&&iy(e,t)?j1(r,n):(e.flags=e.flags&-4097|2,Ee=!1,kt=e)}}else{if(_h(e))throw Error(G(418));e.flags=e.flags&-4097|2,Ee=!1,kt=e}}}function oy(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;kt=e}function yl(e){if(e!==kt)return!1;if(!Ee)return oy(e),Ee=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!mh(e.type,e.memoizedProps)),t&&(t=jt)){if(_h(e))throw S1(),Error(G(418));for(;t;)j1(e,t),t=Ir(t.nextSibling)}if(oy(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(G(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){jt=Ir(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}jt=null}}else jt=kt?Ir(e.stateNode.nextSibling):null;return!0}function S1(){for(var e=jt;e;)e=Ir(e.nextSibling)}function Ti(){jt=kt=null,Ee=!1}function vm(e){nn===null?nn=[e]:nn.push(e)}var ZT=pr.ReactCurrentBatchConfig;function ho(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(G(309));var r=n.stateNode}if(!r)throw Error(G(147,e));var s=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(o){var l=s.refs;o===null?delete l[i]:l[i]=o},t._stringRef=i,t)}if(typeof e!="string")throw Error(G(284));if(!n._owner)throw Error(G(290,e))}return e}function _l(e,t){throw e=Object.prototype.toString.call(t),Error(G(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function ay(e){var t=e._init;return t(e._payload)}function k1(e){function t(g,y){if(e){var m=g.deletions;m===null?(g.deletions=[y],g.flags|=16):m.push(y)}}function n(g,y){if(!e)return null;for(;y!==null;)t(g,y),y=y.sibling;return null}function r(g,y){for(g=new Map;y!==null;)y.key!==null?g.set(y.key,y):g.set(y.index,y),y=y.sibling;return g}function s(g,y){return g=Lr(g,y),g.index=0,g.sibling=null,g}function i(g,y,m){return g.index=m,e?(m=g.alternate,m!==null?(m=m.index,m<y?(g.flags|=2,y):m):(g.flags|=2,y)):(g.flags|=1048576,y)}function o(g){return e&&g.alternate===null&&(g.flags|=2),g}function l(g,y,m,_){return y===null||y.tag!==6?(y=Xd(m,g.mode,_),y.return=g,y):(y=s(y,m),y.return=g,y)}function c(g,y,m,_){var j=m.type;return j===Zs?d(g,y,m.props.children,_,m.key):y!==null&&(y.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===wr&&ay(j)===y.type)?(_=s(y,m.props),_.ref=ho(g,y,m),_.return=g,_):(_=ic(m.type,m.key,m.props,null,g.mode,_),_.ref=ho(g,y,m),_.return=g,_)}function u(g,y,m,_){return y===null||y.tag!==4||y.stateNode.containerInfo!==m.containerInfo||y.stateNode.implementation!==m.implementation?(y=Qd(m,g.mode,_),y.return=g,y):(y=s(y,m.children||[]),y.return=g,y)}function d(g,y,m,_,j){return y===null||y.tag!==7?(y=ps(m,g.mode,_,j),y.return=g,y):(y=s(y,m),y.return=g,y)}function f(g,y,m){if(typeof y=="string"&&y!==""||typeof y=="number")return y=Xd(""+y,g.mode,m),y.return=g,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case ll:return m=ic(y.type,y.key,y.props,null,g.mode,m),m.ref=ho(g,null,y),m.return=g,m;case Qs:return y=Qd(y,g.mode,m),y.return=g,y;case wr:var _=y._init;return f(g,_(y._payload),m)}if(bo(y)||ao(y))return y=ps(y,g.mode,m,null),y.return=g,y;_l(g,y)}return null}function h(g,y,m,_){var j=y!==null?y.key:null;if(typeof m=="string"&&m!==""||typeof m=="number")return j!==null?null:l(g,y,""+m,_);if(typeof m=="object"&&m!==null){switch(m.$$typeof){case ll:return m.key===j?c(g,y,m,_):null;case Qs:return m.key===j?u(g,y,m,_):null;case wr:return j=m._init,h(g,y,j(m._payload),_)}if(bo(m)||ao(m))return j!==null?null:d(g,y,m,_,null);_l(g,m)}return null}function p(g,y,m,_,j){if(typeof _=="string"&&_!==""||typeof _=="number")return g=g.get(m)||null,l(y,g,""+_,j);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case ll:return g=g.get(_.key===null?m:_.key)||null,c(y,g,_,j);case Qs:return g=g.get(_.key===null?m:_.key)||null,u(y,g,_,j);case wr:var N=_._init;return p(g,y,m,N(_._payload),j)}if(bo(_)||ao(_))return g=g.get(m)||null,d(y,g,_,j,null);_l(y,_)}return null}function v(g,y,m,_){for(var j=null,N=null,k=y,S=y=0,P=null;k!==null&&S<m.length;S++){k.index>S?(P=k,k=null):P=k.sibling;var $=h(g,k,m[S],_);if($===null){k===null&&(k=P);break}e&&k&&$.alternate===null&&t(g,k),y=i($,y,S),N===null?j=$:N.sibling=$,N=$,k=P}if(S===m.length)return n(g,k),Ee&&ts(g,S),j;if(k===null){for(;S<m.length;S++)k=f(g,m[S],_),k!==null&&(y=i(k,y,S),N===null?j=k:N.sibling=k,N=k);return Ee&&ts(g,S),j}for(k=r(g,k);S<m.length;S++)P=p(k,g,S,m[S],_),P!==null&&(e&&P.alternate!==null&&k.delete(P.key===null?S:P.key),y=i(P,y,S),N===null?j=P:N.sibling=P,N=P);return e&&k.forEach(function(D){return t(g,D)}),Ee&&ts(g,S),j}function x(g,y,m,_){var j=ao(m);if(typeof j!="function")throw Error(G(150));if(m=j.call(m),m==null)throw Error(G(151));for(var N=j=null,k=y,S=y=0,P=null,$=m.next();k!==null&&!$.done;S++,$=m.next()){k.index>S?(P=k,k=null):P=k.sibling;var D=h(g,k,$.value,_);if(D===null){k===null&&(k=P);break}e&&k&&D.alternate===null&&t(g,k),y=i(D,y,S),N===null?j=D:N.sibling=D,N=D,k=P}if($.done)return n(g,k),Ee&&ts(g,S),j;if(k===null){for(;!$.done;S++,$=m.next())$=f(g,$.value,_),$!==null&&(y=i($,y,S),N===null?j=$:N.sibling=$,N=$);return Ee&&ts(g,S),j}for(k=r(g,k);!$.done;S++,$=m.next())$=p(k,g,S,$.value,_),$!==null&&(e&&$.alternate!==null&&k.delete($.key===null?S:$.key),y=i($,y,S),N===null?j=$:N.sibling=$,N=$);return e&&k.forEach(function(I){return t(g,I)}),Ee&&ts(g,S),j}function w(g,y,m,_){if(typeof m=="object"&&m!==null&&m.type===Zs&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case ll:e:{for(var j=m.key,N=y;N!==null;){if(N.key===j){if(j=m.type,j===Zs){if(N.tag===7){n(g,N.sibling),y=s(N,m.props.children),y.return=g,g=y;break e}}else if(N.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===wr&&ay(j)===N.type){n(g,N.sibling),y=s(N,m.props),y.ref=ho(g,N,m),y.return=g,g=y;break e}n(g,N);break}else t(g,N);N=N.sibling}m.type===Zs?(y=ps(m.props.children,g.mode,_,m.key),y.return=g,g=y):(_=ic(m.type,m.key,m.props,null,g.mode,_),_.ref=ho(g,y,m),_.return=g,g=_)}return o(g);case Qs:e:{for(N=m.key;y!==null;){if(y.key===N)if(y.tag===4&&y.stateNode.containerInfo===m.containerInfo&&y.stateNode.implementation===m.implementation){n(g,y.sibling),y=s(y,m.children||[]),y.return=g,g=y;break e}else{n(g,y);break}else t(g,y);y=y.sibling}y=Qd(m,g.mode,_),y.return=g,g=y}return o(g);case wr:return N=m._init,w(g,y,N(m._payload),_)}if(bo(m))return v(g,y,m,_);if(ao(m))return x(g,y,m,_);_l(g,m)}return typeof m=="string"&&m!==""||typeof m=="number"?(m=""+m,y!==null&&y.tag===6?(n(g,y.sibling),y=s(y,m),y.return=g,g=y):(n(g,y),y=Xd(m,g.mode,_),y.return=g,g=y),o(g)):n(g,y)}return w}var Pi=k1(!0),N1=k1(!1),$c=Kr(null),Lc=null,oi=null,ym=null;function _m(){ym=oi=Lc=null}function xm(e){var t=$c.current;Se($c),e._currentValue=t}function wh(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 ji(e,t){Lc=e,ym=oi=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ft=!0),e.firstContext=null)}function qt(e){var t=e._currentValue;if(ym!==e)if(e={context:e,memoizedValue:t,next:null},oi===null){if(Lc===null)throw Error(G(308));oi=e,Lc.dependencies={lanes:0,firstContext:e}}else oi=oi.next=e;return t}var cs=null;function wm(e){cs===null?cs=[e]:cs.push(e)}function E1(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,wm(t)):(n.next=s.next,s.next=n),t.interleaved=n,lr(e,r)}function lr(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 br=!1;function bm(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function C1(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 Jn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Rr(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,de&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,lr(e,n)}return s=r.interleaved,s===null?(t.next=t,wm(r)):(t.next=s.next,s.next=t),r.interleaved=t,lr(e,n)}function Jl(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,am(e,n)}}function ly(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Dc(e,t,n,r){var s=e.updateQueue;br=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?i=u:o.next=u,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(i!==null){var f=s.baseState;o=0,d=u=c=null,l=i;do{var h=l.lane,p=l.eventTime;if((r&h)===h){d!==null&&(d=d.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var v=e,x=l;switch(h=t,p=n,x.tag){case 1:if(v=x.payload,typeof v=="function"){f=v.call(p,f,h);break e}f=v;break e;case 3:v.flags=v.flags&-65537|128;case 0:if(v=x.payload,h=typeof v=="function"?v.call(p,f,h):v,h==null)break e;f=Me({},f,h);break e;case 2:br=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,h=s.effects,h===null?s.effects=[l]:h.push(l))}else p={eventTime:p,lane:h,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=p,c=f):d=d.next=p,o|=h;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;h=l,l=h.next,h.next=null,s.lastBaseUpdate=h,s.shared.pending=null}}while(!0);if(d===null&&(c=f),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=d,t=s.shared.interleaved,t!==null){s=t;do o|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);js|=o,e.lanes=o,e.memoizedState=f}}function cy(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],s=r.callback;if(s!==null){if(r.callback=null,r=n,typeof s!="function")throw Error(G(191,s));s.call(r)}}}var Fa={},An=Kr(Fa),la=Kr(Fa),ca=Kr(Fa);function us(e){if(e===Fa)throw Error(G(174));return e}function jm(e,t){switch(xe(ca,t),xe(la,e),xe(An,Fa),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:th(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=th(t,e)}Se(An),xe(An,t)}function Mi(){Se(An),Se(la),Se(ca)}function A1(e){us(ca.current);var t=us(An.current),n=th(t,e.type);t!==n&&(xe(la,e),xe(An,n))}function Sm(e){la.current===e&&(Se(An),Se(la))}var Ae=Kr(0);function zc(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 Ud=[];function km(){for(var e=0;e<Ud.length;e++)Ud[e]._workInProgressVersionPrimary=null;Ud.length=0}var ec=pr.ReactCurrentDispatcher,Wd=pr.ReactCurrentBatchConfig,bs=0,Pe=null,Be=null,Ue=null,Vc=!1,Lo=!1,ua=0,JT=0;function Ze(){throw Error(G(321))}function Nm(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!fn(e[n],t[n]))return!1;return!0}function Em(e,t,n,r,s,i){if(bs=i,Pe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ec.current=e===null||e.memoizedState===null?rP:sP,e=n(r,s),Lo){i=0;do{if(Lo=!1,ua=0,25<=i)throw Error(G(301));i+=1,Ue=Be=null,t.updateQueue=null,ec.current=iP,e=n(r,s)}while(Lo)}if(ec.current=Fc,t=Be!==null&&Be.next!==null,bs=0,Ue=Be=Pe=null,Vc=!1,t)throw Error(G(300));return e}function Cm(){var e=ua!==0;return ua=0,e}function wn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ue===null?Pe.memoizedState=Ue=e:Ue=Ue.next=e,Ue}function Yt(){if(Be===null){var e=Pe.alternate;e=e!==null?e.memoizedState:null}else e=Be.next;var t=Ue===null?Pe.memoizedState:Ue.next;if(t!==null)Ue=t,Be=e;else{if(e===null)throw Error(G(310));Be=e,e={memoizedState:Be.memoizedState,baseState:Be.baseState,baseQueue:Be.baseQueue,queue:Be.queue,next:null},Ue===null?Pe.memoizedState=Ue=e:Ue=Ue.next=e}return Ue}function da(e,t){return typeof t=="function"?t(e):t}function Kd(e){var t=Yt(),n=t.queue;if(n===null)throw Error(G(311));n.lastRenderedReducer=e;var r=Be,s=r.baseQueue,i=n.pending;if(i!==null){if(s!==null){var o=s.next;s.next=i.next,i.next=o}r.baseQueue=s=i,n.pending=null}if(s!==null){i=s.next,r=r.baseState;var l=o=null,c=null,u=i;do{var d=u.lane;if((bs&d)===d)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=f,o=r):c=c.next=f,Pe.lanes|=d,js|=d}u=u.next}while(u!==null&&u!==i);c===null?o=r:c.next=l,fn(r,t.memoizedState)||(ft=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){s=e;do i=s.lane,Pe.lanes|=i,js|=i,s=s.next;while(s!==e)}else s===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Gd(e){var t=Yt(),n=t.queue;if(n===null)throw Error(G(311));n.lastRenderedReducer=e;var r=n.dispatch,s=n.pending,i=t.memoizedState;if(s!==null){n.pending=null;var o=s=s.next;do i=e(i,o.action),o=o.next;while(o!==s);fn(i,t.memoizedState)||(ft=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function T1(){}function P1(e,t){var n=Pe,r=Yt(),s=t(),i=!fn(r.memoizedState,s);if(i&&(r.memoizedState=s,ft=!0),r=r.queue,Am(R1.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||Ue!==null&&Ue.memoizedState.tag&1){if(n.flags|=2048,fa(9,I1.bind(null,n,r,s,t),void 0,null),We===null)throw Error(G(349));bs&30||M1(n,t,s)}return s}function M1(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Pe.updateQueue,t===null?(t={lastEffect:null,stores:null},Pe.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function I1(e,t,n,r){t.value=n,t.getSnapshot=r,O1(t)&&$1(e)}function R1(e,t,n){return n(function(){O1(t)&&$1(e)})}function O1(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!fn(e,n)}catch{return!0}}function $1(e){var t=lr(e,1);t!==null&&cn(t,e,1,-1)}function uy(e){var t=wn();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:da,lastRenderedState:e},t.queue=e,e=e.dispatch=nP.bind(null,Pe,e),[t.memoizedState,e]}function fa(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Pe.updateQueue,t===null?(t={lastEffect:null,stores:null},Pe.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 L1(){return Yt().memoizedState}function tc(e,t,n,r){var s=wn();Pe.flags|=e,s.memoizedState=fa(1|t,n,void 0,r===void 0?null:r)}function Ru(e,t,n,r){var s=Yt();r=r===void 0?null:r;var i=void 0;if(Be!==null){var o=Be.memoizedState;if(i=o.destroy,r!==null&&Nm(r,o.deps)){s.memoizedState=fa(t,n,i,r);return}}Pe.flags|=e,s.memoizedState=fa(1|t,n,i,r)}function dy(e,t){return tc(8390656,8,e,t)}function Am(e,t){return Ru(2048,8,e,t)}function D1(e,t){return Ru(4,2,e,t)}function z1(e,t){return Ru(4,4,e,t)}function V1(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 F1(e,t,n){return n=n!=null?n.concat([e]):null,Ru(4,4,V1.bind(null,t,e),n)}function Tm(){}function B1(e,t){var n=Yt();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Nm(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function H1(e,t){var n=Yt();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Nm(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function U1(e,t,n){return bs&21?(fn(n,t)||(n=Yw(),Pe.lanes|=n,js|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,ft=!0),e.memoizedState=n)}function eP(e,t){var n=_e;_e=n!==0&&4>n?n:4,e(!0);var r=Wd.transition;Wd.transition={};try{e(!1),t()}finally{_e=n,Wd.transition=r}}function W1(){return Yt().memoizedState}function tP(e,t,n){var r=$r(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},K1(e))G1(t,n);else if(n=E1(e,t,n,r),n!==null){var s=at();cn(n,e,r,s),q1(n,t,r)}}function nP(e,t,n){var r=$r(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(K1(e))G1(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,l=i(o,n);if(s.hasEagerState=!0,s.eagerState=l,fn(l,o)){var c=t.interleaved;c===null?(s.next=s,wm(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}n=E1(e,t,s,r),n!==null&&(s=at(),cn(n,e,r,s),q1(n,t,r))}}function K1(e){var t=e.alternate;return e===Pe||t!==null&&t===Pe}function G1(e,t){Lo=Vc=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function q1(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,am(e,n)}}var Fc={readContext:qt,useCallback:Ze,useContext:Ze,useEffect:Ze,useImperativeHandle:Ze,useInsertionEffect:Ze,useLayoutEffect:Ze,useMemo:Ze,useReducer:Ze,useRef:Ze,useState:Ze,useDebugValue:Ze,useDeferredValue:Ze,useTransition:Ze,useMutableSource:Ze,useSyncExternalStore:Ze,useId:Ze,unstable_isNewReconciler:!1},rP={readContext:qt,useCallback:function(e,t){return wn().memoizedState=[e,t===void 0?null:t],e},useContext:qt,useEffect:dy,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,tc(4194308,4,V1.bind(null,t,e),n)},useLayoutEffect:function(e,t){return tc(4194308,4,e,t)},useInsertionEffect:function(e,t){return tc(4,2,e,t)},useMemo:function(e,t){var n=wn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=wn();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=tP.bind(null,Pe,e),[r.memoizedState,e]},useRef:function(e){var t=wn();return e={current:e},t.memoizedState=e},useState:uy,useDebugValue:Tm,useDeferredValue:function(e){return wn().memoizedState=e},useTransition:function(){var e=uy(!1),t=e[0];return e=eP.bind(null,e[1]),wn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Pe,s=wn();if(Ee){if(n===void 0)throw Error(G(407));n=n()}else{if(n=t(),We===null)throw Error(G(349));bs&30||M1(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,dy(R1.bind(null,r,i,e),[e]),r.flags|=2048,fa(9,I1.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=wn(),t=We.identifierPrefix;if(Ee){var n=Yn,r=qn;n=(r&~(1<<32-ln(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=ua++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=JT++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},sP={readContext:qt,useCallback:B1,useContext:qt,useEffect:Am,useImperativeHandle:F1,useInsertionEffect:D1,useLayoutEffect:z1,useMemo:H1,useReducer:Kd,useRef:L1,useState:function(){return Kd(da)},useDebugValue:Tm,useDeferredValue:function(e){var t=Yt();return U1(t,Be.memoizedState,e)},useTransition:function(){var e=Kd(da)[0],t=Yt().memoizedState;return[e,t]},useMutableSource:T1,useSyncExternalStore:P1,useId:W1,unstable_isNewReconciler:!1},iP={readContext:qt,useCallback:B1,useContext:qt,useEffect:Am,useImperativeHandle:F1,useInsertionEffect:D1,useLayoutEffect:z1,useMemo:H1,useReducer:Gd,useRef:L1,useState:function(){return Gd(da)},useDebugValue:Tm,useDeferredValue:function(e){var t=Yt();return Be===null?t.memoizedState=e:U1(t,Be.memoizedState,e)},useTransition:function(){var e=Gd(da)[0],t=Yt().memoizedState;return[e,t]},useMutableSource:T1,useSyncExternalStore:P1,useId:W1,unstable_isNewReconciler:!1};function Jt(e,t){if(e&&e.defaultProps){t=Me({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function bh(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Me({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ou={isMounted:function(e){return(e=e._reactInternals)?$s(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=at(),s=$r(e),i=Jn(r,s);i.payload=t,n!=null&&(i.callback=n),t=Rr(e,i,s),t!==null&&(cn(t,e,s,r),Jl(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=at(),s=$r(e),i=Jn(r,s);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Rr(e,i,s),t!==null&&(cn(t,e,s,r),Jl(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=at(),r=$r(e),s=Jn(n,r);s.tag=2,t!=null&&(s.callback=t),t=Rr(e,s,r),t!==null&&(cn(t,e,r,n),Jl(t,e,r))}};function fy(e,t,n,r,s,i,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,o):t.prototype&&t.prototype.isPureReactComponent?!sa(n,r)||!sa(s,i):!0}function Y1(e,t,n){var r=!1,s=Vr,i=t.contextType;return typeof i=="object"&&i!==null?i=qt(i):(s=mt(t)?xs:rt.current,r=t.contextTypes,i=(r=r!=null)?Ai(e,s):Vr),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Ou,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=i),t}function hy(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&&Ou.enqueueReplaceState(t,t.state,null)}function jh(e,t,n,r){var s=e.stateNode;s.props=n,s.state=e.memoizedState,s.refs={},bm(e);var i=t.contextType;typeof i=="object"&&i!==null?s.context=qt(i):(i=mt(t)?xs:rt.current,s.context=Ai(e,i)),s.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(bh(e,t,i,n),s.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(t=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),t!==s.state&&Ou.enqueueReplaceState(s,s.state,null),Dc(e,n,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function Ii(e,t){try{var n="",r=t;do n+=IA(r),r=r.return;while(r);var s=n}catch(i){s=`
39
+ Error generating stack: `+i.message+`
40
+ `+i.stack}return{value:e,source:t,stack:s,digest:null}}function qd(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Sh(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var oP=typeof WeakMap=="function"?WeakMap:Map;function X1(e,t,n){n=Jn(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Hc||(Hc=!0,Rh=r),Sh(e,t)},n}function Q1(e,t,n){n=Jn(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var s=t.value;n.payload=function(){return r(s)},n.callback=function(){Sh(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Sh(e,t),typeof r!="function"&&(Or===null?Or=new Set([this]):Or.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function py(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new oP;var s=new Set;r.set(t,s)}else s=r.get(t),s===void 0&&(s=new Set,r.set(t,s));s.has(n)||(s.add(n),e=xP.bind(null,e,t,n),t.then(e,e))}function my(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 gy(e,t,n,r,s){return e.mode&1?(e.flags|=65536,e.lanes=s,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Jn(-1,1),t.tag=2,Rr(n,t,1))),n.lanes|=1),e)}var aP=pr.ReactCurrentOwner,ft=!1;function st(e,t,n,r){t.child=e===null?N1(t,null,n,r):Pi(t,e.child,n,r)}function vy(e,t,n,r,s){n=n.render;var i=t.ref;return ji(t,s),r=Em(e,t,n,r,i,s),n=Cm(),e!==null&&!ft?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,cr(e,t,s)):(Ee&&n&&mm(t),t.flags|=1,st(e,t,r,s),t.child)}function yy(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!Dm(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,Z1(e,t,i,r,s)):(e=ic(n.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&s)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:sa,n(o,r)&&e.ref===t.ref)return cr(e,t,s)}return t.flags|=1,e=Lr(i,r),e.ref=t.ref,e.return=t,t.child=e}function Z1(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(sa(i,r)&&e.ref===t.ref)if(ft=!1,t.pendingProps=r=i,(e.lanes&s)!==0)e.flags&131072&&(ft=!0);else return t.lanes=e.lanes,cr(e,t,s)}return kh(e,t,n,r,s)}function J1(e,t,n){var r=t.pendingProps,s=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},xe(li,yt),yt|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,xe(li,yt),yt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,xe(li,yt),yt|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,xe(li,yt),yt|=r;return st(e,t,s,n),t.child}function eb(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function kh(e,t,n,r,s){var i=mt(n)?xs:rt.current;return i=Ai(t,i),ji(t,s),n=Em(e,t,n,r,i,s),r=Cm(),e!==null&&!ft?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,cr(e,t,s)):(Ee&&r&&mm(t),t.flags|=1,st(e,t,n,s),t.child)}function _y(e,t,n,r,s){if(mt(n)){var i=!0;Ic(t)}else i=!1;if(ji(t,s),t.stateNode===null)nc(e,t),Y1(t,n,r),jh(t,n,r,s),r=!0;else if(e===null){var o=t.stateNode,l=t.memoizedProps;o.props=l;var c=o.context,u=n.contextType;typeof u=="object"&&u!==null?u=qt(u):(u=mt(n)?xs:rt.current,u=Ai(t,u));var d=n.getDerivedStateFromProps,f=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function";f||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==r||c!==u)&&hy(t,o,r,u),br=!1;var h=t.memoizedState;o.state=h,Dc(t,r,o,s),c=t.memoizedState,l!==r||h!==c||pt.current||br?(typeof d=="function"&&(bh(t,n,d,r),c=t.memoizedState),(l=br||fy(t,n,l,r,h,c,u))?(f||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=u,r=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,C1(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:Jt(t.type,l),o.props=u,f=t.pendingProps,h=o.context,c=n.contextType,typeof c=="object"&&c!==null?c=qt(c):(c=mt(n)?xs:rt.current,c=Ai(t,c));var p=n.getDerivedStateFromProps;(d=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==f||h!==c)&&hy(t,o,r,c),br=!1,h=t.memoizedState,o.state=h,Dc(t,r,o,s);var v=t.memoizedState;l!==f||h!==v||pt.current||br?(typeof p=="function"&&(bh(t,n,p,r),v=t.memoizedState),(u=br||fy(t,n,u,r,h,v,c)||!1)?(d||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,v,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,v,c)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=v),o.props=r,o.state=v,o.context=c,r=u):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return Nh(e,t,n,r,i,s)}function Nh(e,t,n,r,s,i){eb(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return s&&sy(t,n,!1),cr(e,t,i);r=t.stateNode,aP.current=t;var l=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Pi(t,e.child,null,i),t.child=Pi(t,null,l,i)):st(e,t,l,i),t.memoizedState=r.state,s&&sy(t,n,!0),t.child}function tb(e){var t=e.stateNode;t.pendingContext?ry(e,t.pendingContext,t.pendingContext!==t.context):t.context&&ry(e,t.context,!1),jm(e,t.containerInfo)}function xy(e,t,n,r,s){return Ti(),vm(s),t.flags|=256,st(e,t,n,r),t.child}var Eh={dehydrated:null,treeContext:null,retryLane:0};function Ch(e){return{baseLanes:e,cachePool:null,transitions:null}}function nb(e,t,n){var r=t.pendingProps,s=Ae.current,i=!1,o=(t.flags&128)!==0,l;if((l=o)||(l=e!==null&&e.memoizedState===null?!1:(s&2)!==0),l?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),xe(Ae,s&1),e===null)return xh(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=r.children,e=r.fallback,i?(r=t.mode,i=t.child,o={mode:"hidden",children:o},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=Du(o,r,0,null),e=ps(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Ch(n),t.memoizedState=Eh,e):Pm(t,o));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return lP(e,t,o,r,l,s,n);if(i){i=r.fallback,o=t.mode,s=e.child,l=s.sibling;var c={mode:"hidden",children:r.children};return!(o&1)&&t.child!==s?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Lr(s,c),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?i=Lr(l,i):(i=ps(i,o,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,o=e.child.memoizedState,o=o===null?Ch(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=e.childLanes&~n,t.memoizedState=Eh,r}return i=e.child,e=i.sibling,r=Lr(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Pm(e,t){return t=Du({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function xl(e,t,n,r){return r!==null&&vm(r),Pi(t,e.child,null,n),e=Pm(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function lP(e,t,n,r,s,i,o){if(n)return t.flags&256?(t.flags&=-257,r=qd(Error(G(422))),xl(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,s=t.mode,r=Du({mode:"visible",children:r.children},s,0,null),i=ps(i,s,o,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&Pi(t,e.child,null,o),t.child.memoizedState=Ch(o),t.memoizedState=Eh,i);if(!(t.mode&1))return xl(e,t,o,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(G(419)),r=qd(i,r,void 0),xl(e,t,o,r)}if(l=(o&e.childLanes)!==0,ft||l){if(r=We,r!==null){switch(o&-o){case 4:s=2;break;case 16:s=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|o)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,lr(e,s),cn(r,e,s,-1))}return Lm(),r=qd(Error(G(421))),xl(e,t,o,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=wP.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,jt=Ir(s.nextSibling),kt=t,Ee=!0,nn=null,e!==null&&(zt[Vt++]=qn,zt[Vt++]=Yn,zt[Vt++]=ws,qn=e.id,Yn=e.overflow,ws=t),t=Pm(t,r.children),t.flags|=4096,t)}function wy(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),wh(e.return,t,n)}function Yd(e,t,n,r,s){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=s)}function rb(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;if(st(e,t,r.children,n),r=Ae.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&&wy(e,n,t);else if(e.tag===19)wy(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(xe(Ae,r),!(t.mode&1))t.memoizedState=null;else switch(s){case"forwards":for(n=t.child,s=null;n!==null;)e=n.alternate,e!==null&&zc(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),Yd(t,!1,s,n,i);break;case"backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&zc(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}Yd(t,!0,n,null,i);break;case"together":Yd(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function nc(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function cr(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),js|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(G(153));if(t.child!==null){for(e=t.child,n=Lr(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Lr(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function cP(e,t,n){switch(t.tag){case 3:tb(t),Ti();break;case 5:A1(t);break;case 1:mt(t.type)&&Ic(t);break;case 4:jm(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;xe($c,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(xe(Ae,Ae.current&1),t.flags|=128,null):n&t.child.childLanes?nb(e,t,n):(xe(Ae,Ae.current&1),e=cr(e,t,n),e!==null?e.sibling:null);xe(Ae,Ae.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return rb(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),xe(Ae,Ae.current),r)break;return null;case 22:case 23:return t.lanes=0,J1(e,t,n)}return cr(e,t,n)}var sb,Ah,ib,ob;sb=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}};Ah=function(){};ib=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,us(An.current);var i=null;switch(n){case"input":s=Qf(e,s),r=Qf(e,r),i=[];break;case"select":s=Me({},s,{value:void 0}),r=Me({},r,{value:void 0}),i=[];break;case"textarea":s=eh(e,s),r=eh(e,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Pc)}nh(n,r);var o;n=null;for(u in s)if(!r.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var l=s[u];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Qo.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var c=r[u];if(l=s!=null?s[u]:void 0,r.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(o in l)!l.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in c)c.hasOwnProperty(o)&&l[o]!==c[o]&&(n||(n={}),n[o]=c[o])}else n||(i||(i=[]),i.push(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(i=i||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Qo.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&be("scroll",e),i||l===c||(i=[])):(i=i||[]).push(u,c))}n&&(i=i||[]).push("style",n);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};ob=function(e,t,n,r){n!==r&&(t.flags|=4)};function po(e,t){if(!Ee)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 Je(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function uP(e,t,n){var r=t.pendingProps;switch(gm(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Je(t),null;case 1:return mt(t.type)&&Mc(),Je(t),null;case 3:return r=t.stateNode,Mi(),Se(pt),Se(rt),km(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(yl(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,nn!==null&&(Lh(nn),nn=null))),Ah(e,t),Je(t),null;case 5:Sm(t);var s=us(ca.current);if(n=t.type,e!==null&&t.stateNode!=null)ib(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(G(166));return Je(t),null}if(e=us(An.current),yl(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[Sn]=t,r[aa]=i,e=(t.mode&1)!==0,n){case"dialog":be("cancel",r),be("close",r);break;case"iframe":case"object":case"embed":be("load",r);break;case"video":case"audio":for(s=0;s<So.length;s++)be(So[s],r);break;case"source":be("error",r);break;case"img":case"image":case"link":be("error",r),be("load",r);break;case"details":be("toggle",r);break;case"input":Tv(r,i),be("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},be("invalid",r);break;case"textarea":Mv(r,i),be("invalid",r)}nh(n,i),s=null;for(var o in i)if(i.hasOwnProperty(o)){var l=i[o];o==="children"?typeof l=="string"?r.textContent!==l&&(i.suppressHydrationWarning!==!0&&vl(r.textContent,l,e),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&vl(r.textContent,l,e),s=["children",""+l]):Qo.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&be("scroll",r)}switch(n){case"input":cl(r),Pv(r,i,!0);break;case"textarea":cl(r),Iv(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Pc)}r=s,t.updateQueue=r,r!==null&&(t.flags|=4)}else{o=s.nodeType===9?s:s.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Rw(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[Sn]=t,e[aa]=r,sb(e,t,!1,!1),t.stateNode=e;e:{switch(o=rh(n,r),n){case"dialog":be("cancel",e),be("close",e),s=r;break;case"iframe":case"object":case"embed":be("load",e),s=r;break;case"video":case"audio":for(s=0;s<So.length;s++)be(So[s],e);s=r;break;case"source":be("error",e),s=r;break;case"img":case"image":case"link":be("error",e),be("load",e),s=r;break;case"details":be("toggle",e),s=r;break;case"input":Tv(e,r),s=Qf(e,r),be("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=Me({},r,{value:void 0}),be("invalid",e);break;case"textarea":Mv(e,r),s=eh(e,r),be("invalid",e);break;default:s=r}nh(n,s),l=s;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?Lw(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&Ow(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Zo(e,c):typeof c=="number"&&Zo(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Qo.hasOwnProperty(i)?c!=null&&i==="onScroll"&&be("scroll",e):c!=null&&tm(e,i,c,o))}switch(n){case"input":cl(e),Pv(e,r,!1);break;case"textarea":cl(e),Iv(e);break;case"option":r.value!=null&&e.setAttribute("value",""+zr(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?_i(e,!!r.multiple,i,!1):r.defaultValue!=null&&_i(e,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=Pc)}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 Je(t),null;case 6:if(e&&t.stateNode!=null)ob(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(G(166));if(n=us(ca.current),us(An.current),yl(t)){if(r=t.stateNode,n=t.memoizedProps,r[Sn]=t,(i=r.nodeValue!==n)&&(e=kt,e!==null))switch(e.tag){case 3:vl(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&vl(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Sn]=t,t.stateNode=r}return Je(t),null;case 13:if(Se(Ae),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Ee&&jt!==null&&t.mode&1&&!(t.flags&128))S1(),Ti(),t.flags|=98560,i=!1;else if(i=yl(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(G(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(G(317));i[Sn]=t}else Ti(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Je(t),i=!1}else nn!==null&&(Lh(nn),nn=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||Ae.current&1?He===0&&(He=3):Lm())),t.updateQueue!==null&&(t.flags|=4),Je(t),null);case 4:return Mi(),Ah(e,t),e===null&&ia(t.stateNode.containerInfo),Je(t),null;case 10:return xm(t.type._context),Je(t),null;case 17:return mt(t.type)&&Mc(),Je(t),null;case 19:if(Se(Ae),i=t.memoizedState,i===null)return Je(t),null;if(r=(t.flags&128)!==0,o=i.rendering,o===null)if(r)po(i,!1);else{if(He!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=zc(e),o!==null){for(t.flags|=128,po(i,!1),r=o.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,o=i.alternate,o===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,e=o.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return xe(Ae,Ae.current&1|2),t.child}e=e.sibling}i.tail!==null&&ze()>Ri&&(t.flags|=128,r=!0,po(i,!1),t.lanes=4194304)}else{if(!r)if(e=zc(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),po(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!Ee)return Je(t),null}else 2*ze()-i.renderingStartTime>Ri&&n!==1073741824&&(t.flags|=128,r=!0,po(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=ze(),t.sibling=null,n=Ae.current,xe(Ae,r?n&1|2:n&1),t):(Je(t),null);case 22:case 23:return $m(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?yt&1073741824&&(Je(t),t.subtreeFlags&6&&(t.flags|=8192)):Je(t),null;case 24:return null;case 25:return null}throw Error(G(156,t.tag))}function dP(e,t){switch(gm(t),t.tag){case 1:return mt(t.type)&&Mc(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Mi(),Se(pt),Se(rt),km(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Sm(t),null;case 13:if(Se(Ae),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(G(340));Ti()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Se(Ae),null;case 4:return Mi(),null;case 10:return xm(t.type._context),null;case 22:case 23:return $m(),null;case 24:return null;default:return null}}var wl=!1,tt=!1,fP=typeof WeakSet=="function"?WeakSet:Set,Z=null;function ai(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){$e(e,t,r)}else n.current=null}function Th(e,t,n){try{n()}catch(r){$e(e,t,r)}}var by=!1;function hP(e,t){if(hh=Cc,e=d1(),pm(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,u=0,d=0,f=e,h=null;t:for(;;){for(var p;f!==n||s!==0&&f.nodeType!==3||(l=o+s),f!==i||r!==0&&f.nodeType!==3||(c=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===e)break t;if(h===n&&++u===s&&(l=o),h===i&&++d===r&&(c=o),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(ph={focusedElem:e,selectionRange:n},Cc=!1,Z=t;Z!==null;)if(t=Z,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Z=e;else for(;Z!==null;){t=Z;try{var v=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var x=v.memoizedProps,w=v.memoizedState,g=t.stateNode,y=g.getSnapshotBeforeUpdate(t.elementType===t.type?x:Jt(t.type,x),w);g.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var m=t.stateNode.containerInfo;m.nodeType===1?m.textContent="":m.nodeType===9&&m.documentElement&&m.removeChild(m.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(G(163))}}catch(_){$e(t,t.return,_)}if(e=t.sibling,e!==null){e.return=t.return,Z=e;break}Z=t.return}return v=by,by=!1,v}function Do(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&Th(t,n,i)}s=s.next}while(s!==r)}}function $u(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 Ph(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 ab(e){var t=e.alternate;t!==null&&(e.alternate=null,ab(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Sn],delete t[aa],delete t[vh],delete t[YT],delete t[XT])),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 lb(e){return e.tag===5||e.tag===3||e.tag===4}function jy(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||lb(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 Mh(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=Pc));else if(r!==4&&(e=e.child,e!==null))for(Mh(e,t,n),e=e.sibling;e!==null;)Mh(e,t,n),e=e.sibling}function Ih(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(Ih(e,t,n),e=e.sibling;e!==null;)Ih(e,t,n),e=e.sibling}var Ke=null,en=!1;function mr(e,t,n){for(n=n.child;n!==null;)cb(e,t,n),n=n.sibling}function cb(e,t,n){if(Cn&&typeof Cn.onCommitFiberUnmount=="function")try{Cn.onCommitFiberUnmount(Cu,n)}catch{}switch(n.tag){case 5:tt||ai(n,t);case 6:var r=Ke,s=en;Ke=null,mr(e,t,n),Ke=r,en=s,Ke!==null&&(en?(e=Ke,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ke.removeChild(n.stateNode));break;case 18:Ke!==null&&(en?(e=Ke,n=n.stateNode,e.nodeType===8?Bd(e.parentNode,n):e.nodeType===1&&Bd(e,n),na(e)):Bd(Ke,n.stateNode));break;case 4:r=Ke,s=en,Ke=n.stateNode.containerInfo,en=!0,mr(e,t,n),Ke=r,en=s;break;case 0:case 11:case 14:case 15:if(!tt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&Th(n,t,o),s=s.next}while(s!==r)}mr(e,t,n);break;case 1:if(!tt&&(ai(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){$e(n,t,l)}mr(e,t,n);break;case 21:mr(e,t,n);break;case 22:n.mode&1?(tt=(r=tt)||n.memoizedState!==null,mr(e,t,n),tt=r):mr(e,t,n);break;default:mr(e,t,n)}}function Sy(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new fP),t.forEach(function(r){var s=bP.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Qt(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];try{var i=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 5:Ke=l.stateNode,en=!1;break e;case 3:Ke=l.stateNode.containerInfo,en=!0;break e;case 4:Ke=l.stateNode.containerInfo,en=!0;break e}l=l.return}if(Ke===null)throw Error(G(160));cb(i,o,s),Ke=null,en=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(u){$e(s,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)ub(t,e),t=t.sibling}function ub(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Qt(t,e),_n(e),r&4){try{Do(3,e,e.return),$u(3,e)}catch(x){$e(e,e.return,x)}try{Do(5,e,e.return)}catch(x){$e(e,e.return,x)}}break;case 1:Qt(t,e),_n(e),r&512&&n!==null&&ai(n,n.return);break;case 5:if(Qt(t,e),_n(e),r&512&&n!==null&&ai(n,n.return),e.flags&32){var s=e.stateNode;try{Zo(s,"")}catch(x){$e(e,e.return,x)}}if(r&4&&(s=e.stateNode,s!=null)){var i=e.memoizedProps,o=n!==null?n.memoizedProps:i,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&Mw(s,i),rh(l,o);var u=rh(l,i);for(o=0;o<c.length;o+=2){var d=c[o],f=c[o+1];d==="style"?Lw(s,f):d==="dangerouslySetInnerHTML"?Ow(s,f):d==="children"?Zo(s,f):tm(s,d,f,u)}switch(l){case"input":Zf(s,i);break;case"textarea":Iw(s,i);break;case"select":var h=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?_i(s,!!i.multiple,p,!1):h!==!!i.multiple&&(i.defaultValue!=null?_i(s,!!i.multiple,i.defaultValue,!0):_i(s,!!i.multiple,i.multiple?[]:"",!1))}s[aa]=i}catch(x){$e(e,e.return,x)}}break;case 6:if(Qt(t,e),_n(e),r&4){if(e.stateNode===null)throw Error(G(162));s=e.stateNode,i=e.memoizedProps;try{s.nodeValue=i}catch(x){$e(e,e.return,x)}}break;case 3:if(Qt(t,e),_n(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{na(t.containerInfo)}catch(x){$e(e,e.return,x)}break;case 4:Qt(t,e),_n(e);break;case 13:Qt(t,e),_n(e),s=e.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(Rm=ze())),r&4&&Sy(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(tt=(u=tt)||d,Qt(t,e),tt=u):Qt(t,e),_n(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(Z=e,d=e.child;d!==null;){for(f=Z=d;Z!==null;){switch(h=Z,p=h.child,h.tag){case 0:case 11:case 14:case 15:Do(4,h,h.return);break;case 1:ai(h,h.return);var v=h.stateNode;if(typeof v.componentWillUnmount=="function"){r=h,n=h.return;try{t=r,v.props=t.memoizedProps,v.state=t.memoizedState,v.componentWillUnmount()}catch(x){$e(r,n,x)}}break;case 5:ai(h,h.return);break;case 22:if(h.memoizedState!==null){Ny(f);continue}}p!==null?(p.return=h,Z=p):Ny(f)}d=d.sibling}e:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{s=f.stateNode,u?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=f.stateNode,c=f.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=$w("display",o))}catch(x){$e(e,e.return,x)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(x){$e(e,e.return,x)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Qt(t,e),_n(e),r&4&&Sy(e);break;case 21:break;default:Qt(t,e),_n(e)}}function _n(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(lb(n)){var r=n;break e}n=n.return}throw Error(G(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(Zo(s,""),r.flags&=-33);var i=jy(e);Ih(e,i,s);break;case 3:case 4:var o=r.stateNode.containerInfo,l=jy(e);Mh(e,l,o);break;default:throw Error(G(161))}}catch(c){$e(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function pP(e,t,n){Z=e,db(e)}function db(e,t,n){for(var r=(e.mode&1)!==0;Z!==null;){var s=Z,i=s.child;if(s.tag===22&&r){var o=s.memoizedState!==null||wl;if(!o){var l=s.alternate,c=l!==null&&l.memoizedState!==null||tt;l=wl;var u=tt;if(wl=o,(tt=c)&&!u)for(Z=s;Z!==null;)o=Z,c=o.child,o.tag===22&&o.memoizedState!==null?Ey(s):c!==null?(c.return=o,Z=c):Ey(s);for(;i!==null;)Z=i,db(i),i=i.sibling;Z=s,wl=l,tt=u}ky(e)}else s.subtreeFlags&8772&&i!==null?(i.return=s,Z=i):ky(e)}}function ky(e){for(;Z!==null;){var t=Z;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:tt||$u(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!tt)if(n===null)r.componentDidMount();else{var s=t.elementType===t.type?n.memoizedProps:Jt(t.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&cy(t,i,r);break;case 3:var o=t.updateQueue;if(o!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}cy(t,o,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&na(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(G(163))}tt||t.flags&512&&Ph(t)}catch(h){$e(t,t.return,h)}}if(t===e){Z=null;break}if(n=t.sibling,n!==null){n.return=t.return,Z=n;break}Z=t.return}}function Ny(e){for(;Z!==null;){var t=Z;if(t===e){Z=null;break}var n=t.sibling;if(n!==null){n.return=t.return,Z=n;break}Z=t.return}}function Ey(e){for(;Z!==null;){var t=Z;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{$u(4,t)}catch(c){$e(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(c){$e(t,s,c)}}var i=t.return;try{Ph(t)}catch(c){$e(t,i,c)}break;case 5:var o=t.return;try{Ph(t)}catch(c){$e(t,o,c)}}}catch(c){$e(t,t.return,c)}if(t===e){Z=null;break}var l=t.sibling;if(l!==null){l.return=t.return,Z=l;break}Z=t.return}}var mP=Math.ceil,Bc=pr.ReactCurrentDispatcher,Mm=pr.ReactCurrentOwner,Kt=pr.ReactCurrentBatchConfig,de=0,We=null,Ve=null,Xe=0,yt=0,li=Kr(0),He=0,ha=null,js=0,Lu=0,Im=0,zo=null,dt=null,Rm=0,Ri=1/0,Bn=null,Hc=!1,Rh=null,Or=null,bl=!1,Cr=null,Uc=0,Vo=0,Oh=null,rc=-1,sc=0;function at(){return de&6?ze():rc!==-1?rc:rc=ze()}function $r(e){return e.mode&1?de&2&&Xe!==0?Xe&-Xe:ZT.transition!==null?(sc===0&&(sc=Yw()),sc):(e=_e,e!==0||(e=window.event,e=e===void 0?16:n1(e.type)),e):1}function cn(e,t,n,r){if(50<Vo)throw Vo=0,Oh=null,Error(G(185));Da(e,n,r),(!(de&2)||e!==We)&&(e===We&&(!(de&2)&&(Lu|=n),He===4&&kr(e,Xe)),gt(e,r),n===1&&de===0&&!(t.mode&1)&&(Ri=ze()+500,Iu&&Gr()))}function gt(e,t){var n=e.callbackNode;ZA(e,t);var r=Ec(e,e===We?Xe:0);if(r===0)n!==null&&$v(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&$v(n),t===1)e.tag===0?QT(Cy.bind(null,e)):w1(Cy.bind(null,e)),GT(function(){!(de&6)&&Gr()}),n=null;else{switch(Xw(r)){case 1:n=om;break;case 4:n=Gw;break;case 16:n=Nc;break;case 536870912:n=qw;break;default:n=Nc}n=_b(n,fb.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function fb(e,t){if(rc=-1,sc=0,de&6)throw Error(G(327));var n=e.callbackNode;if(Si()&&e.callbackNode!==n)return null;var r=Ec(e,e===We?Xe:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Wc(e,r);else{t=r;var s=de;de|=2;var i=pb();(We!==e||Xe!==t)&&(Bn=null,Ri=ze()+500,hs(e,t));do try{yP();break}catch(l){hb(e,l)}while(!0);_m(),Bc.current=i,de=s,Ve!==null?t=0:(We=null,Xe=0,t=He)}if(t!==0){if(t===2&&(s=lh(e),s!==0&&(r=s,t=$h(e,s))),t===1)throw n=ha,hs(e,0),kr(e,r),gt(e,ze()),n;if(t===6)kr(e,r);else{if(s=e.current.alternate,!(r&30)&&!gP(s)&&(t=Wc(e,r),t===2&&(i=lh(e),i!==0&&(r=i,t=$h(e,i))),t===1))throw n=ha,hs(e,0),kr(e,r),gt(e,ze()),n;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(G(345));case 2:ns(e,dt,Bn);break;case 3:if(kr(e,r),(r&130023424)===r&&(t=Rm+500-ze(),10<t)){if(Ec(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){at(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=gh(ns.bind(null,e,dt,Bn),t);break}ns(e,dt,Bn);break;case 4:if(kr(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var o=31-ln(r);i=1<<o,o=t[o],o>s&&(s=o),r&=~i}if(r=s,r=ze()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*mP(r/1960))-r,10<r){e.timeoutHandle=gh(ns.bind(null,e,dt,Bn),r);break}ns(e,dt,Bn);break;case 5:ns(e,dt,Bn);break;default:throw Error(G(329))}}}return gt(e,ze()),e.callbackNode===n?fb.bind(null,e):null}function $h(e,t){var n=zo;return e.current.memoizedState.isDehydrated&&(hs(e,t).flags|=256),e=Wc(e,t),e!==2&&(t=dt,dt=n,t!==null&&Lh(t)),e}function Lh(e){dt===null?dt=e:dt.push.apply(dt,e)}function gP(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var s=n[r],i=s.getSnapshot;s=s.value;try{if(!fn(i(),s))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function kr(e,t){for(t&=~Im,t&=~Lu,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-ln(t),r=1<<n;e[n]=-1,t&=~r}}function Cy(e){if(de&6)throw Error(G(327));Si();var t=Ec(e,0);if(!(t&1))return gt(e,ze()),null;var n=Wc(e,t);if(e.tag!==0&&n===2){var r=lh(e);r!==0&&(t=r,n=$h(e,r))}if(n===1)throw n=ha,hs(e,0),kr(e,t),gt(e,ze()),n;if(n===6)throw Error(G(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,ns(e,dt,Bn),gt(e,ze()),null}function Om(e,t){var n=de;de|=1;try{return e(t)}finally{de=n,de===0&&(Ri=ze()+500,Iu&&Gr())}}function Ss(e){Cr!==null&&Cr.tag===0&&!(de&6)&&Si();var t=de;de|=1;var n=Kt.transition,r=_e;try{if(Kt.transition=null,_e=1,e)return e()}finally{_e=r,Kt.transition=n,de=t,!(de&6)&&Gr()}}function $m(){yt=li.current,Se(li)}function hs(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,KT(n)),Ve!==null)for(n=Ve.return;n!==null;){var r=n;switch(gm(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Mc();break;case 3:Mi(),Se(pt),Se(rt),km();break;case 5:Sm(r);break;case 4:Mi();break;case 13:Se(Ae);break;case 19:Se(Ae);break;case 10:xm(r.type._context);break;case 22:case 23:$m()}n=n.return}if(We=e,Ve=e=Lr(e.current,null),Xe=yt=t,He=0,ha=null,Im=Lu=js=0,dt=zo=null,cs!==null){for(t=0;t<cs.length;t++)if(n=cs[t],r=n.interleaved,r!==null){n.interleaved=null;var s=r.next,i=n.pending;if(i!==null){var o=i.next;i.next=s,r.next=o}n.pending=r}cs=null}return e}function hb(e,t){do{var n=Ve;try{if(_m(),ec.current=Fc,Vc){for(var r=Pe.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}Vc=!1}if(bs=0,Ue=Be=Pe=null,Lo=!1,ua=0,Mm.current=null,n===null||n.return===null){He=1,ha=t,Ve=null;break}e:{var i=e,o=n.return,l=n,c=t;if(t=Xe,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,d=l,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var h=d.alternate;h?(d.updateQueue=h.updateQueue,d.memoizedState=h.memoizedState,d.lanes=h.lanes):(d.updateQueue=null,d.memoizedState=null)}var p=my(o);if(p!==null){p.flags&=-257,gy(p,o,l,i,t),p.mode&1&&py(i,u,t),t=p,c=u;var v=t.updateQueue;if(v===null){var x=new Set;x.add(c),t.updateQueue=x}else v.add(c);break e}else{if(!(t&1)){py(i,u,t),Lm();break e}c=Error(G(426))}}else if(Ee&&l.mode&1){var w=my(o);if(w!==null){!(w.flags&65536)&&(w.flags|=256),gy(w,o,l,i,t),vm(Ii(c,l));break e}}i=c=Ii(c,l),He!==4&&(He=2),zo===null?zo=[i]:zo.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var g=X1(i,c,t);ly(i,g);break e;case 1:l=c;var y=i.type,m=i.stateNode;if(!(i.flags&128)&&(typeof y.getDerivedStateFromError=="function"||m!==null&&typeof m.componentDidCatch=="function"&&(Or===null||!Or.has(m)))){i.flags|=65536,t&=-t,i.lanes|=t;var _=Q1(i,l,t);ly(i,_);break e}}i=i.return}while(i!==null)}gb(n)}catch(j){t=j,Ve===n&&n!==null&&(Ve=n=n.return);continue}break}while(!0)}function pb(){var e=Bc.current;return Bc.current=Fc,e===null?Fc:e}function Lm(){(He===0||He===3||He===2)&&(He=4),We===null||!(js&268435455)&&!(Lu&268435455)||kr(We,Xe)}function Wc(e,t){var n=de;de|=2;var r=pb();(We!==e||Xe!==t)&&(Bn=null,hs(e,t));do try{vP();break}catch(s){hb(e,s)}while(!0);if(_m(),de=n,Bc.current=r,Ve!==null)throw Error(G(261));return We=null,Xe=0,He}function vP(){for(;Ve!==null;)mb(Ve)}function yP(){for(;Ve!==null&&!HA();)mb(Ve)}function mb(e){var t=yb(e.alternate,e,yt);e.memoizedProps=e.pendingProps,t===null?gb(e):Ve=t,Mm.current=null}function gb(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=dP(n,t),n!==null){n.flags&=32767,Ve=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{He=6,Ve=null;return}}else if(n=uP(n,t,yt),n!==null){Ve=n;return}if(t=t.sibling,t!==null){Ve=t;return}Ve=t=e}while(t!==null);He===0&&(He=5)}function ns(e,t,n){var r=_e,s=Kt.transition;try{Kt.transition=null,_e=1,_P(e,t,n,r)}finally{Kt.transition=s,_e=r}return null}function _P(e,t,n,r){do Si();while(Cr!==null);if(de&6)throw Error(G(327));n=e.finishedWork;var s=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(G(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(JA(e,i),e===We&&(Ve=We=null,Xe=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||bl||(bl=!0,_b(Nc,function(){return Si(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Kt.transition,Kt.transition=null;var o=_e;_e=1;var l=de;de|=4,Mm.current=null,hP(e,n),ub(n,e),zT(ph),Cc=!!hh,ph=hh=null,e.current=n,pP(n),UA(),de=l,_e=o,Kt.transition=i}else e.current=n;if(bl&&(bl=!1,Cr=e,Uc=s),i=e.pendingLanes,i===0&&(Or=null),GA(n.stateNode),gt(e,ze()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)s=t[n],r(s.value,{componentStack:s.stack,digest:s.digest});if(Hc)throw Hc=!1,e=Rh,Rh=null,e;return Uc&1&&e.tag!==0&&Si(),i=e.pendingLanes,i&1?e===Oh?Vo++:(Vo=0,Oh=e):Vo=0,Gr(),null}function Si(){if(Cr!==null){var e=Xw(Uc),t=Kt.transition,n=_e;try{if(Kt.transition=null,_e=16>e?16:e,Cr===null)var r=!1;else{if(e=Cr,Cr=null,Uc=0,de&6)throw Error(G(331));var s=de;for(de|=4,Z=e.current;Z!==null;){var i=Z,o=i.child;if(Z.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(Z=u;Z!==null;){var d=Z;switch(d.tag){case 0:case 11:case 15:Do(8,d,i)}var f=d.child;if(f!==null)f.return=d,Z=f;else for(;Z!==null;){d=Z;var h=d.sibling,p=d.return;if(ab(d),d===u){Z=null;break}if(h!==null){h.return=p,Z=h;break}Z=p}}}var v=i.alternate;if(v!==null){var x=v.child;if(x!==null){v.child=null;do{var w=x.sibling;x.sibling=null,x=w}while(x!==null)}}Z=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,Z=o;else e:for(;Z!==null;){if(i=Z,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Do(9,i,i.return)}var g=i.sibling;if(g!==null){g.return=i.return,Z=g;break e}Z=i.return}}var y=e.current;for(Z=y;Z!==null;){o=Z;var m=o.child;if(o.subtreeFlags&2064&&m!==null)m.return=o,Z=m;else e:for(o=y;Z!==null;){if(l=Z,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:$u(9,l)}}catch(j){$e(l,l.return,j)}if(l===o){Z=null;break e}var _=l.sibling;if(_!==null){_.return=l.return,Z=_;break e}Z=l.return}}if(de=s,Gr(),Cn&&typeof Cn.onPostCommitFiberRoot=="function")try{Cn.onPostCommitFiberRoot(Cu,e)}catch{}r=!0}return r}finally{_e=n,Kt.transition=t}}return!1}function Ay(e,t,n){t=Ii(n,t),t=X1(e,t,1),e=Rr(e,t,1),t=at(),e!==null&&(Da(e,1,t),gt(e,t))}function $e(e,t,n){if(e.tag===3)Ay(e,e,n);else for(;t!==null;){if(t.tag===3){Ay(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Or===null||!Or.has(r))){e=Ii(n,e),e=Q1(t,e,1),t=Rr(t,e,1),e=at(),t!==null&&(Da(t,1,e),gt(t,e));break}}t=t.return}}function xP(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=at(),e.pingedLanes|=e.suspendedLanes&n,We===e&&(Xe&n)===n&&(He===4||He===3&&(Xe&130023424)===Xe&&500>ze()-Rm?hs(e,0):Im|=n),gt(e,t)}function vb(e,t){t===0&&(e.mode&1?(t=fl,fl<<=1,!(fl&130023424)&&(fl=4194304)):t=1);var n=at();e=lr(e,t),e!==null&&(Da(e,t,n),gt(e,n))}function wP(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),vb(e,n)}function bP(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(G(314))}r!==null&&r.delete(t),vb(e,n)}var yb;yb=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||pt.current)ft=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return ft=!1,cP(e,t,n);ft=!!(e.flags&131072)}else ft=!1,Ee&&t.flags&1048576&&b1(t,Oc,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;nc(e,t),e=t.pendingProps;var s=Ai(t,rt.current);ji(t,n),s=Em(null,t,r,e,s,n);var i=Cm();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,mt(r)?(i=!0,Ic(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,bm(t),s.updater=Ou,t.stateNode=s,s._reactInternals=t,jh(t,r,e,n),t=Nh(null,t,r,!0,i,n)):(t.tag=0,Ee&&i&&mm(t),st(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(nc(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=SP(r),e=Jt(r,e),s){case 0:t=kh(null,t,r,e,n);break e;case 1:t=_y(null,t,r,e,n);break e;case 11:t=vy(null,t,r,e,n);break e;case 14:t=yy(null,t,r,Jt(r.type,e),n);break e}throw Error(G(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Jt(r,s),kh(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Jt(r,s),_y(e,t,r,s,n);case 3:e:{if(tb(t),e===null)throw Error(G(387));r=t.pendingProps,i=t.memoizedState,s=i.element,C1(e,t),Dc(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=Ii(Error(G(423)),t),t=xy(e,t,r,n,s);break e}else if(r!==s){s=Ii(Error(G(424)),t),t=xy(e,t,r,n,s);break e}else for(jt=Ir(t.stateNode.containerInfo.firstChild),kt=t,Ee=!0,nn=null,n=N1(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ti(),r===s){t=cr(e,t,n);break e}st(e,t,r,n)}t=t.child}return t;case 5:return A1(t),e===null&&xh(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,o=s.children,mh(r,s)?o=null:i!==null&&mh(r,i)&&(t.flags|=32),eb(e,t),st(e,t,o,n),t.child;case 6:return e===null&&xh(t),null;case 13:return nb(e,t,n);case 4:return jm(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Pi(t,null,r,n):st(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Jt(r,s),vy(e,t,r,s,n);case 7:return st(e,t,t.pendingProps,n),t.child;case 8:return st(e,t,t.pendingProps.children,n),t.child;case 12:return st(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,i=t.memoizedProps,o=s.value,xe($c,r._currentValue),r._currentValue=o,i!==null)if(fn(i.value,o)){if(i.children===s.children&&!pt.current){t=cr(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){o=i.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=Jn(-1,n&-n),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),wh(i.return,n,t),l.lanes|=n;break}c=c.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(G(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),wh(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}st(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,ji(t,n),s=qt(s),r=r(s),t.flags|=1,st(e,t,r,n),t.child;case 14:return r=t.type,s=Jt(r,t.pendingProps),s=Jt(r.type,s),yy(e,t,r,s,n);case 15:return Z1(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Jt(r,s),nc(e,t),t.tag=1,mt(r)?(e=!0,Ic(t)):e=!1,ji(t,n),Y1(t,r,s),jh(t,r,s,n),Nh(null,t,r,!0,e,n);case 19:return rb(e,t,n);case 22:return J1(e,t,n)}throw Error(G(156,t.tag))};function _b(e,t){return Kw(e,t)}function jP(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 Ht(e,t,n,r){return new jP(e,t,n,r)}function Dm(e){return e=e.prototype,!(!e||!e.isReactComponent)}function SP(e){if(typeof e=="function")return Dm(e)?1:0;if(e!=null){if(e=e.$$typeof,e===rm)return 11;if(e===sm)return 14}return 2}function Lr(e,t){var n=e.alternate;return n===null?(n=Ht(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 ic(e,t,n,r,s,i){var o=2;if(r=e,typeof e=="function")Dm(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Zs:return ps(n.children,s,i,t);case nm:o=8,s|=8;break;case Gf:return e=Ht(12,n,t,s|2),e.elementType=Gf,e.lanes=i,e;case qf:return e=Ht(13,n,t,s),e.elementType=qf,e.lanes=i,e;case Yf:return e=Ht(19,n,t,s),e.elementType=Yf,e.lanes=i,e;case Aw:return Du(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Ew:o=10;break e;case Cw:o=9;break e;case rm:o=11;break e;case sm:o=14;break e;case wr:o=16,r=null;break e}throw Error(G(130,e==null?e:typeof e,""))}return t=Ht(o,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function ps(e,t,n,r){return e=Ht(7,e,r,t),e.lanes=n,e}function Du(e,t,n,r){return e=Ht(22,e,r,t),e.elementType=Aw,e.lanes=n,e.stateNode={isHidden:!1},e}function Xd(e,t,n){return e=Ht(6,e,null,t),e.lanes=n,e}function Qd(e,t,n){return t=Ht(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function kP(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Pd(0),this.expirationTimes=Pd(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Pd(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function zm(e,t,n,r,s,i,o,l,c){return e=new kP(e,t,n,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Ht(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},bm(i),e}function NP(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Qs,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function xb(e){if(!e)return Vr;e=e._reactInternals;e:{if($s(e)!==e||e.tag!==1)throw Error(G(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(mt(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(G(171))}if(e.tag===1){var n=e.type;if(mt(n))return x1(e,n,t)}return t}function wb(e,t,n,r,s,i,o,l,c){return e=zm(n,r,!0,e,s,i,o,l,c),e.context=xb(null),n=e.current,r=at(),s=$r(n),i=Jn(r,s),i.callback=t??null,Rr(n,i,s),e.current.lanes=s,Da(e,s,r),gt(e,r),e}function zu(e,t,n,r){var s=t.current,i=at(),o=$r(s);return n=xb(n),t.context===null?t.context=n:t.pendingContext=n,t=Jn(i,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Rr(s,t,o),e!==null&&(cn(e,s,o,i),Jl(e,s,o)),o}function Kc(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 Ty(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Vm(e,t){Ty(e,t),(e=e.alternate)&&Ty(e,t)}function EP(){return null}var bb=typeof reportError=="function"?reportError:function(e){console.error(e)};function Fm(e){this._internalRoot=e}Vu.prototype.render=Fm.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(G(409));zu(e,t,null,null)};Vu.prototype.unmount=Fm.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ss(function(){zu(null,e,null,null)}),t[ar]=null}};function Vu(e){this._internalRoot=e}Vu.prototype.unstable_scheduleHydration=function(e){if(e){var t=Jw();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Sr.length&&t!==0&&t<Sr[n].priority;n++);Sr.splice(n,0,e),n===0&&t1(e)}};function Bm(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Fu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Py(){}function CP(e,t,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var u=Kc(o);i.call(u)}}var o=wb(t,r,e,0,null,!1,!1,"",Py);return e._reactRootContainer=o,e[ar]=o.current,ia(e.nodeType===8?e.parentNode:e),Ss(),o}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var u=Kc(c);l.call(u)}}var c=zm(e,0,!1,null,null,!1,!1,"",Py);return e._reactRootContainer=c,e[ar]=c.current,ia(e.nodeType===8?e.parentNode:e),Ss(function(){zu(t,c,n,r)}),c}function Bu(e,t,n,r,s){var i=n._reactRootContainer;if(i){var o=i;if(typeof s=="function"){var l=s;s=function(){var c=Kc(o);l.call(c)}}zu(t,o,e,s)}else o=CP(n,t,e,s,r);return Kc(o)}Qw=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=jo(t.pendingLanes);n!==0&&(am(t,n|1),gt(t,ze()),!(de&6)&&(Ri=ze()+500,Gr()))}break;case 13:Ss(function(){var r=lr(e,1);if(r!==null){var s=at();cn(r,e,1,s)}}),Vm(e,1)}};lm=function(e){if(e.tag===13){var t=lr(e,134217728);if(t!==null){var n=at();cn(t,e,134217728,n)}Vm(e,134217728)}};Zw=function(e){if(e.tag===13){var t=$r(e),n=lr(e,t);if(n!==null){var r=at();cn(n,e,t,r)}Vm(e,t)}};Jw=function(){return _e};e1=function(e,t){var n=_e;try{return _e=e,t()}finally{_e=n}};ih=function(e,t,n){switch(t){case"input":if(Zf(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var s=Mu(r);if(!s)throw Error(G(90));Pw(r),Zf(r,s)}}}break;case"textarea":Iw(e,n);break;case"select":t=n.value,t!=null&&_i(e,!!n.multiple,t,!1)}};Vw=Om;Fw=Ss;var AP={usingClientEntryPoint:!1,Events:[Va,ni,Mu,Dw,zw,Om]},mo={findFiberByHostInstance:ls,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},TP={bundleType:mo.bundleType,version:mo.version,rendererPackageName:mo.rendererPackageName,rendererConfig:mo.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:pr.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Uw(e),e===null?null:e.stateNode},findFiberByHostInstance:mo.findFiberByHostInstance||EP,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 jl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!jl.isDisabled&&jl.supportsFiber)try{Cu=jl.inject(TP),Cn=jl}catch{}}Pt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=AP;Pt.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Bm(t))throw Error(G(200));return NP(e,t,null,n)};Pt.createRoot=function(e,t){if(!Bm(e))throw Error(G(299));var n=!1,r="",s=bb;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=zm(e,1,!1,null,null,n,!1,r,s),e[ar]=t.current,ia(e.nodeType===8?e.parentNode:e),new Fm(t)};Pt.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(G(188)):(e=Object.keys(e).join(","),Error(G(268,e)));return e=Uw(t),e=e===null?null:e.stateNode,e};Pt.flushSync=function(e){return Ss(e)};Pt.hydrate=function(e,t,n){if(!Fu(t))throw Error(G(200));return Bu(null,e,t,!0,n)};Pt.hydrateRoot=function(e,t,n){if(!Bm(e))throw Error(G(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",o=bb;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=wb(t,null,e,1,n??null,s,!1,i,o),e[ar]=t.current,ia(e),r)for(e=0;e<r.length;e++)n=r[e],s=n._getVersion,s=s(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,s]:t.mutableSourceEagerHydrationData.push(n,s);return new Vu(t)};Pt.render=function(e,t,n){if(!Fu(t))throw Error(G(200));return Bu(null,e,t,!1,n)};Pt.unmountComponentAtNode=function(e){if(!Fu(e))throw Error(G(40));return e._reactRootContainer?(Ss(function(){Bu(null,null,e,!1,function(){e._reactRootContainer=null,e[ar]=null})}),!0):!1};Pt.unstable_batchedUpdates=Om;Pt.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Fu(n))throw Error(G(200));if(e==null||e._reactInternals===void 0)throw Error(G(38));return Bu(e,t,n,!1,r)};Pt.version="18.3.1-next-f1338f8080-20240426";function jb(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(jb)}catch(e){console.error(e)}}jb(),jw.exports=Pt;var Sb=jw.exports,kb,My=Sb;kb=My.createRoot,My.hydrateRoot;function fe(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw new Error(typeof e=="number"?"[MobX] minified error nr: "+e+(n.length?" "+n.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+e)}var PP={};function Hu(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:PP}var Nb=Object.assign,Gc=Object.getOwnPropertyDescriptor,Tn=Object.defineProperty,Uu=Object.prototype,Dh=[];Object.freeze(Dh);var Eb={};Object.freeze(Eb);var MP=typeof Proxy<"u",IP=Object.toString();function Cb(){MP||fe("Proxy not available")}function Ab(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var ci=function(){};function hn(e){return typeof e=="function"}function ks(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function Wu(e){return e!==null&&typeof e=="object"}function Fr(e){if(!Wu(e))return!1;var t=Object.getPrototypeOf(e);if(t==null)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n.toString()===IP}function Tb(e){var t=e==null?void 0:e.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function Ku(e,t,n){Tn(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function Pb(e,t,n){Tn(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function Ls(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(r){return Wu(r)&&r[n]===!0}}function Zi(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function RP(e){var t=Object.getPrototypeOf(e),n=Object.getPrototypeOf(t),r=Object.getPrototypeOf(n);return r===null}function Wn(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}var Mb=typeof Object.getOwnPropertySymbols<"u";function OP(e){var t=Object.keys(e);if(!Mb)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter(function(r){return Uu.propertyIsEnumerable.call(e,r)})):t}var Gu=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Mb?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function Ib(e){return e===null?null:typeof e=="object"?""+e:e}function er(e,t){return Uu.hasOwnProperty.call(e,t)}var $P=Object.getOwnPropertyDescriptors||function(t){var n={};return Gu(t).forEach(function(r){n[r]=Gc(t,r)}),n};function xt(e,t){return!!(e&t)}function wt(e,t,n){return n?e|=t:e&=~t,e}function Iy(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function LP(e,t,n){if(Rb())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var s=new(e.bind.apply(e,r));return n&&pa(s,n.prototype),s}function DP(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,FP(r.key),r)}}function Ji(e,t,n){return t&&DP(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ui(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=BP(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
41
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ns(){return Ns=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ns.apply(null,arguments)}function zh(e){return zh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},zh(e)}function Hm(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,pa(e,t)}function zP(e){try{return Function.toString.call(e).indexOf("[native code]")!==-1}catch{return typeof e=="function"}}function Rb(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Rb=function(){return!!e})()}function pa(e,t){return pa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},pa(e,t)}function VP(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function FP(e){var t=VP(e,"string");return typeof t=="symbol"?t:t+""}function BP(e,t){if(e){if(typeof e=="string")return Iy(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Iy(e,t):void 0}}function Vh(e){var t=typeof Map=="function"?new Map:void 0;return Vh=function(n){if(n===null||!zP(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(t!==void 0){if(t.has(n))return t.get(n);t.set(n,r)}function r(){return LP(n,arguments,zh(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),pa(r,n)},Vh(e)}var En=Symbol("mobx-stored-annotations");function Pn(e){function t(n,r){if(Ha(r))return e.decorate_20223_(n,r);Ba(n,r,e)}return Object.assign(t,e)}function Ba(e,t,n){er(e,En)||Ku(e,En,Ns({},e[En])),YP(n)||(e[En][t]=n)}function HP(e){return er(e,En)||Ku(e,En,Ns({},e[En])),e[En]}function Ha(e){return typeof e=="object"&&typeof e.kind=="string"}var oe=Symbol("mobx administration"),qr=function(){function e(n){n===void 0&&(n="Atom"),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=me.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=n}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(r){return r()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},t.reportObserved=function(){return Qb(this)},t.reportChanged=function(){Ut(),Zb(this),Wt()},t.toString=function(){return this.name_},Ji(e,[{key:"isBeingObserved",get:function(){return xt(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=wt(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return xt(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=wt(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return xt(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=wt(this.flags_,e.diffValueMask_,r===1)}}])}();qr.isBeingObservedMask_=1;qr.isPendingUnobservationMask_=2;qr.diffValueMask_=4;var Um=Ls("Atom",qr);function Ob(e,t,n){t===void 0&&(t=ci),n===void 0&&(n=ci);var r=new qr(e);return t!==ci&&Q2(r,t),n!==ci&&ij(r,n),r}function UP(e,t){return yj(e,t)}function WP(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var qc={structural:UP,default:WP};function Es(e,t,n){return cj(e)?e:Array.isArray(e)?ve.array(e,{name:n}):Fr(e)?ve.object(e,void 0,{name:n}):Zi(e)?ve.map(e,{name:n}):Wn(e)?ve.set(e,{name:n}):typeof e=="function"&&!Oi(e)&&!ga(e)?Tb(e)?$i(e):ma(n,e):e}function KP(e,t,n){if(e==null||Zu(e)||Qu(e)||zs(e)||kn(e))return e;if(Array.isArray(e))return ve.array(e,{name:n,deep:!1});if(Fr(e))return ve.object(e,void 0,{name:n,deep:!1});if(Zi(e))return ve.map(e,{name:n,deep:!1});if(Wn(e))return ve.set(e,{name:n,deep:!1})}function qu(e){return e}function GP(e,t){return yj(e,t)?t:e}var qP="override";function YP(e){return e.annotationType_===qP}function Ua(e,t){return{annotationType_:e,options_:t,make_:XP,extend_:QP,decorate_20223_:ZP}}function XP(e,t,n,r){var s;if((s=this.options_)!=null&&s.bound)return this.extend_(e,t,n,!1)===null?0:1;if(r===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if(Oi(n.value))return 1;var i=$b(e,this,t,n,!1);return Tn(r,t,i),2}function QP(e,t,n,r){var s=$b(e,this,t,n);return e.defineProperty_(t,s,r)}function ZP(e,t){var n=t.kind,r=t.name,s=t.addInitializer,i=this,o=function(u){var d,f,h,p;return Cs((d=(f=i.options_)==null?void 0:f.name)!=null?d:r.toString(),u,(h=(p=i.options_)==null?void 0:p.autoAction)!=null?h:!1)};if(n=="field")return function(c){var u,d=c;return Oi(d)||(d=o(d)),(u=i.options_)!=null&&u.bound&&(d=d.bind(this),d.isMobxAction=!0),d};if(n=="method"){var l;return Oi(e)||(e=o(e)),(l=this.options_)!=null&&l.bound&&s(function(){var c=this,u=c[r].bind(c);u.isMobxAction=!0,c[r]=u}),e}fe("Cannot apply '"+i.annotationType_+"' to '"+String(r)+"' (kind: "+n+"):"+(`
42
+ '`+i.annotationType_+"' can only be used on properties with a function value."))}function JP(e,t,n,r){t.annotationType_,r.value}function $b(e,t,n,r,s){var i,o,l,c,u,d,f;s===void 0&&(s=Y.safeDescriptors),JP(e,t,n,r);var h=r.value;if((i=t.options_)!=null&&i.bound){var p;h=h.bind((p=e.proxy_)!=null?p:e.target_)}return{value:Cs((o=(l=t.options_)==null?void 0:l.name)!=null?o:n.toString(),h,(c=(u=t.options_)==null?void 0:u.autoAction)!=null?c:!1,(d=t.options_)!=null&&d.bound?(f=e.proxy_)!=null?f:e.target_:void 0),configurable:s?e.isPlainObject_:!0,enumerable:!1,writable:!s}}function Lb(e,t){return{annotationType_:e,options_:t,make_:e2,extend_:t2,decorate_20223_:n2}}function e2(e,t,n,r){var s;if(r===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if((s=this.options_)!=null&&s.bound&&(!er(e.target_,t)||!ga(e.target_[t]))&&this.extend_(e,t,n,!1)===null)return 0;if(ga(n.value))return 1;var i=Db(e,this,t,n,!1,!1);return Tn(r,t,i),2}function t2(e,t,n,r){var s,i=Db(e,this,t,n,(s=this.options_)==null?void 0:s.bound);return e.defineProperty_(t,i,r)}function n2(e,t){var n,r=t.name,s=t.addInitializer;return ga(e)||(e=$i(e)),(n=this.options_)!=null&&n.bound&&s(function(){var i=this,o=i[r].bind(i);o.isMobXFlow=!0,i[r]=o}),e}function r2(e,t,n,r){t.annotationType_,r.value}function Db(e,t,n,r,s,i){i===void 0&&(i=Y.safeDescriptors),r2(e,t,n,r);var o=r.value;if(ga(o)||(o=$i(o)),s){var l;o=o.bind((l=e.proxy_)!=null?l:e.target_),o.isMobXFlow=!0}return{value:o,configurable:i?e.isPlainObject_:!0,enumerable:!1,writable:!i}}function Wm(e,t){return{annotationType_:e,options_:t,make_:s2,extend_:i2,decorate_20223_:o2}}function s2(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function i2(e,t,n,r){return a2(e,this,t,n),e.defineComputedProperty_(t,Ns({},this.options_,{get:n.get,set:n.set}),r)}function o2(e,t){var n=this,r=t.name,s=t.addInitializer,i;function o(l,c){var u=Ns({},n.options_,{get:e,context:l});return u.name||(u.name="ObservableObject."+r.toString()),new Nt(u)}return s(function(){var l,c=eo(this)[oe],u=this,d=c.values_.get(r);d instanceof Nt&&d.derivation!==e&&c.values_.delete(r),((l=c.lazyComputedKeys_)!=null?l:c.lazyComputedKeys_=new Map).set(r,function(){return o(u)})}),function(){var l=this[oe],c=l.values_.get(r);if(c instanceof Nt&&c.derivation!==e){var u,d=(u=i)==null?void 0:u.get(this);if(!d){var f;d=o(this),((f=i)!=null?f:i=new WeakMap).set(this,d)}return d.get()}return l.getObservablePropValue_(r)}}function a2(e,t,n,r){t.annotationType_,r.get}function Yu(e,t){return{annotationType_:e,options_:t,make_:l2,extend_:c2,decorate_20223_:u2}}function l2(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function c2(e,t,n,r){var s,i;return d2(e,this),e.defineObservableProperty_(t,n.value,(s=(i=this.options_)==null?void 0:i.enhancer)!=null?s:Es,r)}function u2(e,t){var n=this,r=t.kind,s=t.name;if(r!=="accessor")return;function i(o,l){var c,u=eo(o)[oe];return((c=u.lazyObservableKeys_)!=null?c:u.lazyObservableKeys_=new Map).set(s,function(){var d,f;return new ms(l,(d=(f=n.options_)==null?void 0:f.enhancer)!=null?d:Es,"ObservableObject."+s.toString(),!1)}),u}return{get:function(){var l,c=(l=this[oe])!=null?l:i(this,e.get.call(this));return c.getObservablePropValue_(s)},set:function(l){var c,u=(c=this[oe])!=null?c:i(this,l);return u.setObservablePropValue_(s,l)},init:function(l){return i(this,l),l}}}function d2(e,t,n,r){t.annotationType_}var f2="true",h2=zb();function zb(e){return{annotationType_:f2,options_:e,make_:p2,extend_:m2,decorate_20223_:g2}}function p2(e,t,n,r){var s,i;if(n.get)return bn.make_(e,t,n,r);if(n.set){var o=Oi(n.set)?n.set:Cs(t.toString(),n.set);return r===e.target_?e.defineProperty_(t,{configurable:Y.safeDescriptors?e.isPlainObject_:!0,set:o})===null?0:2:(Tn(r,t,{configurable:!0,set:o}),2)}if(r!==e.target_&&typeof n.value=="function"){var l;if(Tb(n.value)){var c,u=(c=this.options_)!=null&&c.autoBind?$i.bound:$i;return u.make_(e,t,n,r)}var d=(l=this.options_)!=null&&l.autoBind?ma.bound:ma;return d.make_(e,t,n,r)}var f=((s=this.options_)==null?void 0:s.deep)===!1?ve.ref:ve;if(typeof n.value=="function"&&(i=this.options_)!=null&&i.autoBind){var h;n.value=n.value.bind((h=e.proxy_)!=null?h:e.target_)}return f.make_(e,t,n,r)}function m2(e,t,n,r){var s,i;if(n.get)return bn.extend_(e,t,n,r);if(n.set)return e.defineProperty_(t,{configurable:Y.safeDescriptors?e.isPlainObject_:!0,set:Cs(t.toString(),n.set)},r);if(typeof n.value=="function"&&(s=this.options_)!=null&&s.autoBind){var o;n.value=n.value.bind((o=e.proxy_)!=null?o:e.target_)}var l=((i=this.options_)==null?void 0:i.deep)===!1?ve.ref:ve;return l.extend_(e,t,n,r)}function g2(e,t){fe("'"+this.annotationType_+"' cannot be used as a decorator")}var v2="observable",y2="observable.ref",_2="observable.shallow",x2="observable.struct",Vb={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(Vb);function Sl(e){return e||Vb}var Fh=Yu(v2),w2=Yu(y2,{enhancer:qu}),b2=Yu(_2,{enhancer:KP}),j2=Yu(x2,{enhancer:GP}),Fb=Pn(Fh);function kl(e){return e.deep===!0?Es:e.deep===!1?qu:k2(e.defaultDecorator)}function S2(e){var t;return e?(t=e.defaultDecorator)!=null?t:zb(e):void 0}function k2(e){var t,n;return e&&(t=(n=e.options_)==null?void 0:n.enhancer)!=null?t:Es}function Bb(e,t,n){if(Ha(t))return Fh.decorate_20223_(e,t);if(ks(t)){Ba(e,t,Fh);return}return cj(e)?e:Fr(e)?ve.object(e,t,n):Array.isArray(e)?ve.array(e,t):Zi(e)?ve.map(e,t):Wn(e)?ve.set(e,t):typeof e=="object"&&e!==null?e:ve.box(e,t)}Nb(Bb,Fb);var N2={box:function(t,n){var r=Sl(n);return new ms(t,kl(r),r.name,!0,r.equals)},array:function(t,n){var r=Sl(n);return(Y.useProxies===!1||r.proxy===!1?wM:dM)(t,kl(r),r.name)},map:function(t,n){var r=Sl(n);return new fj(t,kl(r),r.name)},set:function(t,n){var r=Sl(n);return new hj(t,kl(r),r.name)},object:function(t,n,r){return Vs(function(){return eM(Y.useProxies===!1||(r==null?void 0:r.proxy)===!1?eo({},r):lM({},r),t,n)})},ref:Pn(w2),shallow:Pn(b2),deep:Fb,struct:Pn(j2)},ve=Nb(Bb,N2),Hb="computed",E2="computed.struct",Bh=Wm(Hb),C2=Wm(E2,{equals:qc.structural}),bn=function(t,n){if(Ha(n))return Bh.decorate_20223_(t,n);if(ks(n))return Ba(t,n,Bh);if(Fr(t))return Pn(Wm(Hb,t));var r=Fr(n)?n:{};return r.get=t,r.name||(r.name=t.name||""),new Nt(r)};Object.assign(bn,Bh);bn.struct=Pn(C2);var Ry,Oy,Yc=0,A2=1,T2=(Ry=(Oy=Gc(function(){},"name"))==null?void 0:Oy.configurable)!=null?Ry:!1,$y={value:"action",configurable:!0,writable:!1,enumerable:!1};function Cs(e,t,n,r){n===void 0&&(n=!1);function s(){return Ub(e,n,t,r||this,arguments)}return s.isMobxAction=!0,s.toString=function(){return t.toString()},T2&&($y.value=e,Tn(s,"name",$y)),s}function Ub(e,t,n,r,s){var i=P2(e,t);try{return n.apply(r,s)}catch(o){throw i.error_=o,o}finally{M2(i)}}function P2(e,t,n,r){var s=!1,i=0,o=Y.trackingDerivation,l=!t||!o;Ut();var c=Y.allowStateChanges;l&&(Ds(),c=Km(!0));var u=qm(!0),d={runAsAction_:l,prevDerivation_:o,prevAllowStateChanges_:c,prevAllowStateReads_:u,notifySpy_:s,startTime_:i,actionId_:A2++,parentActionId_:Yc};return Yc=d.actionId_,d}function M2(e){Yc!==e.actionId_&&fe(30),Yc=e.parentActionId_,e.error_!==void 0&&(Y.suppressReactionErrors=!0),Gm(e.prevAllowStateChanges_),Fo(e.prevAllowStateReads_),Wt(),e.runAsAction_&&tr(e.prevDerivation_),Y.suppressReactionErrors=!1}function Km(e){var t=Y.allowStateChanges;return Y.allowStateChanges=e,t}function Gm(e){Y.allowStateChanges=e}var ms=function(e){function t(r,s,i,o,l){var c;return i===void 0&&(i="ObservableValue"),l===void 0&&(l=qc.default),c=e.call(this,i)||this,c.enhancer=void 0,c.name_=void 0,c.equals=void 0,c.hasUnreportedChange_=!1,c.interceptors_=void 0,c.changeListeners_=void 0,c.value_=void 0,c.dehancer=void 0,c.enhancer=s,c.name_=i,c.equals=l,c.value_=s(r,void 0,i),c}Hm(t,e);var n=t.prototype;return n.dehanceValue=function(s){return this.dehancer!==void 0?this.dehancer(s):s},n.set=function(s){this.value_,s=this.prepareNewValue_(s),s!==Y.UNCHANGED&&this.setNewValue_(s)},n.prepareNewValue_=function(s){if(Ft(this)){var i=Bt(this,{object:this,type:Mn,newValue:s});if(!i)return Y.UNCHANGED;s=i.newValue}return s=this.enhancer(s,this.value_,this.name_),this.equals(this.value_,s)?Y.UNCHANGED:s},n.setNewValue_=function(s){var i=this.value_;this.value_=s,this.reportChanged(),un(this)&&dn(this,{type:Mn,object:this,newValue:s,oldValue:i})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},n.intercept_=function(s){return Wa(this,s)},n.observe_=function(s,i){return i&&s({observableKind:"value",debugObjectName:this.name_,object:this,type:Mn,newValue:this.value_,oldValue:void 0}),Ka(this,s)},n.raw=function(){return this.value_},n.toJSON=function(){return this.get()},n.toString=function(){return this.name_+"["+this.value_+"]"},n.valueOf=function(){return Ib(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},t}(qr),Nt=function(){function e(n){this.dependenciesState_=me.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=me.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new Qc(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=Xc.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,n.get||fe(31),this.derivation=n.get,this.name_=n.name||"ComputedValue",n.set&&(this.setter_=Cs("ComputedValue-setter",n.set)),this.equals_=n.equals||(n.compareStructural||n.struct?qc.structural:qc.default),this.scope_=n.context,this.requiresReaction_=n.requiresReaction,this.keepAlive_=!!n.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){L2(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(r){return r()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},t.get=function(){if(this.isComputing&&fe(32,this.name_,this.derivation),Y.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)Hh(this)&&(this.warnAboutUntrackedRead_(),Ut(),this.value_=this.computeValue_(!1),Wt());else if(Qb(this),Hh(this)){var r=Y.trackingContext;this.keepAlive_&&!r&&(Y.trackingContext=this),this.trackAndCompute()&&$2(this),Y.trackingContext=r}var s=this.value_;if(oc(s))throw s.cause;return s},t.set=function(r){if(this.setter_){this.isRunningSetter&&fe(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,r)}finally{this.isRunningSetter=!1}}else fe(34,this.name_)},t.trackAndCompute=function(){var r=this.value_,s=this.dependenciesState_===me.NOT_TRACKING_,i=this.computeValue_(!0),o=s||oc(r)||oc(i)||!this.equals_(r,i);return o&&(this.value_=i),o},t.computeValue_=function(r){this.isComputing=!0;var s=Km(!1),i;if(r)i=Wb(this,this.derivation,this.scope_);else if(Y.disableErrorBoundaries===!0)i=this.derivation.call(this.scope_);else try{i=this.derivation.call(this.scope_)}catch(o){i=new Qc(o)}return Gm(s),this.isComputing=!1,i},t.suspend_=function(){this.keepAlive_||(Uh(this),this.value_=void 0)},t.observe_=function(r,s){var i=this,o=!0,l=void 0;return sj(function(){var c=i.get();if(!o||s){var u=Ds();r({observableKind:"computed",debugObjectName:i.name_,type:Mn,object:i,newValue:c,oldValue:l}),tr(u)}o=!1,l=c})},t.warnAboutUntrackedRead_=function(){},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return Ib(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},Ji(e,[{key:"isComputing",get:function(){return xt(this.flags_,e.isComputingMask_)},set:function(r){this.flags_=wt(this.flags_,e.isComputingMask_,r)}},{key:"isRunningSetter",get:function(){return xt(this.flags_,e.isRunningSetterMask_)},set:function(r){this.flags_=wt(this.flags_,e.isRunningSetterMask_,r)}},{key:"isBeingObserved",get:function(){return xt(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=wt(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return xt(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=wt(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return xt(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=wt(this.flags_,e.diffValueMask_,r===1)}}])}();Nt.isComputingMask_=1;Nt.isRunningSetterMask_=2;Nt.isBeingObservedMask_=4;Nt.isPendingUnobservationMask_=8;Nt.diffValueMask_=16;var Xu=Ls("ComputedValue",Nt),me;(function(e){e[e.NOT_TRACKING_=-1]="NOT_TRACKING_",e[e.UP_TO_DATE_=0]="UP_TO_DATE_",e[e.POSSIBLY_STALE_=1]="POSSIBLY_STALE_",e[e.STALE_=2]="STALE_"})(me||(me={}));var Xc;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(Xc||(Xc={}));var Qc=function(t){this.cause=void 0,this.cause=t};function oc(e){return e instanceof Qc}function Hh(e){switch(e.dependenciesState_){case me.UP_TO_DATE_:return!1;case me.NOT_TRACKING_:case me.STALE_:return!0;case me.POSSIBLY_STALE_:{for(var t=qm(!0),n=Ds(),r=e.observing_,s=r.length,i=0;i<s;i++){var o=r[i];if(Xu(o)){if(Y.disableErrorBoundaries)o.get();else try{o.get()}catch{return tr(n),Fo(t),!0}if(e.dependenciesState_===me.STALE_)return tr(n),Fo(t),!0}}return Gb(e),tr(n),Fo(t),!1}}}function Wb(e,t,n){var r=qm(!0);Gb(e),e.newObserving_=new Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++Y.runId;var s=Y.trackingDerivation;Y.trackingDerivation=e,Y.inBatch++;var i;if(Y.disableErrorBoundaries===!0)i=t.call(n);else try{i=t.call(n)}catch(o){i=new Qc(o)}return Y.inBatch--,Y.trackingDerivation=s,I2(e),Fo(r),i}function I2(e){for(var t=e.observing_,n=e.observing_=e.newObserving_,r=me.UP_TO_DATE_,s=0,i=e.unboundDepsCount_,o=0;o<i;o++){var l=n[o];l.diffValue===0&&(l.diffValue=1,s!==o&&(n[s]=l),s++),l.dependenciesState_>r&&(r=l.dependenciesState_)}for(n.length=s,e.newObserving_=null,i=t.length;i--;){var c=t[i];c.diffValue===0&&Yb(c,e),c.diffValue=0}for(;s--;){var u=n[s];u.diffValue===1&&(u.diffValue=0,O2(u,e))}r!==me.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}function Uh(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)Yb(t[n],e);e.dependenciesState_=me.NOT_TRACKING_}function Kb(e){var t=Ds();try{return e()}finally{tr(t)}}function Ds(){var e=Y.trackingDerivation;return Y.trackingDerivation=null,e}function tr(e){Y.trackingDerivation=e}function qm(e){var t=Y.allowStateReads;return Y.allowStateReads=e,t}function Fo(e){Y.allowStateReads=e}function Gb(e){if(e.dependenciesState_!==me.UP_TO_DATE_){e.dependenciesState_=me.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=me.UP_TO_DATE_}}var ac=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},lc=!0,qb=!1,Y=function(){var e=Hu();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(lc=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new ac().version&&(lc=!1),lc?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new ac):(setTimeout(function(){qb||fe(35)},1),new ac)}();function R2(){if((Y.pendingReactions.length||Y.inBatch||Y.isRunningReactions)&&fe(36),qb=!0,lc){var e=Hu();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),Y=new ac}}function O2(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function Yb(e,t){e.observers_.delete(t),e.observers_.size===0&&Xb(e)}function Xb(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,Y.pendingUnobservations.push(e))}function Ut(){Y.inBatch++}function Wt(){if(--Y.inBatch===0){Jb();for(var e=Y.pendingUnobservations,t=0;t<e.length;t++){var n=e[t];n.isPendingUnobservation=!1,n.observers_.size===0&&(n.isBeingObserved&&(n.isBeingObserved=!1,n.onBUO()),n instanceof Nt&&n.suspend_())}Y.pendingUnobservations=[]}}function Qb(e){var t=Y.trackingDerivation;return t!==null?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&Y.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved):(e.observers_.size===0&&Y.inBatch>0&&Xb(e),!1)}function Zb(e){e.lowestObserverState_!==me.STALE_&&(e.lowestObserverState_=me.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===me.UP_TO_DATE_&&t.onBecomeStale_(),t.dependenciesState_=me.STALE_}))}function $2(e){e.lowestObserverState_!==me.STALE_&&(e.lowestObserverState_=me.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===me.POSSIBLY_STALE_?t.dependenciesState_=me.STALE_:t.dependenciesState_===me.UP_TO_DATE_&&(e.lowestObserverState_=me.UP_TO_DATE_)}))}function L2(e){e.lowestObserverState_===me.UP_TO_DATE_&&(e.lowestObserverState_=me.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===me.UP_TO_DATE_&&(t.dependenciesState_=me.POSSIBLY_STALE_,t.onBecomeStale_())}))}var ur=function(){function e(n,r,s,i){n===void 0&&(n="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=me.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=Xc.NONE,this.name_=n,this.onInvalidate_=r,this.errorHandler_=s,this.requiresObservable_=i}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled||(this.isScheduled=!0,Y.pendingReactions.push(this),Jb())},t.runReaction_=function(){if(!this.isDisposed){Ut(),this.isScheduled=!1;var r=Y.trackingContext;if(Y.trackingContext=this,Hh(this)){this.isTrackPending=!0;try{this.onInvalidate_()}catch(s){this.reportExceptionInDerivation_(s)}}Y.trackingContext=r,Wt()}},t.track=function(r){if(!this.isDisposed){Ut(),this.isRunning=!0;var s=Y.trackingContext;Y.trackingContext=this;var i=Wb(this,r,void 0);Y.trackingContext=s,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&Uh(this),oc(i)&&this.reportExceptionInDerivation_(i.cause),Wt()}},t.reportExceptionInDerivation_=function(r){var s=this;if(this.errorHandler_){this.errorHandler_(r,this);return}if(Y.disableErrorBoundaries)throw r;var i="[mobx] uncaught error in '"+this+"'";Y.suppressReactionErrors||console.error(i,r),Y.globalReactionErrorHandlers.forEach(function(o){return o(r,s)})},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Ut(),Uh(this),Wt()))},t.getDisposer_=function(r){var s=this,i=function o(){s.dispose(),r==null||r.removeEventListener==null||r.removeEventListener("abort",o)};return r==null||r.addEventListener==null||r.addEventListener("abort",i),i[oe]=this,"dispose"in Symbol&&typeof Symbol.dispose=="symbol"&&(i[Symbol.dispose]=i),i},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(r){},Ji(e,[{key:"isDisposed",get:function(){return xt(this.flags_,e.isDisposedMask_)},set:function(r){this.flags_=wt(this.flags_,e.isDisposedMask_,r)}},{key:"isScheduled",get:function(){return xt(this.flags_,e.isScheduledMask_)},set:function(r){this.flags_=wt(this.flags_,e.isScheduledMask_,r)}},{key:"isTrackPending",get:function(){return xt(this.flags_,e.isTrackPendingMask_)},set:function(r){this.flags_=wt(this.flags_,e.isTrackPendingMask_,r)}},{key:"isRunning",get:function(){return xt(this.flags_,e.isRunningMask_)},set:function(r){this.flags_=wt(this.flags_,e.isRunningMask_,r)}},{key:"diffValue",get:function(){return xt(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=wt(this.flags_,e.diffValueMask_,r===1)}}])}();ur.isDisposedMask_=1;ur.isScheduledMask_=2;ur.isTrackPendingMask_=4;ur.isRunningMask_=8;ur.diffValueMask_=16;var D2=100,Wh=function(t){return t()};function Jb(){Y.inBatch>0||Y.isRunningReactions||Wh(z2)}function z2(){Y.isRunningReactions=!0;for(var e=Y.pendingReactions,t=0;e.length>0;){++t===D2&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,s=n.length;r<s;r++)n[r].runReaction_()}Y.isRunningReactions=!1}var Zc=Ls("Reaction",ur);function V2(e){var t=Wh;Wh=function(r){return e(function(){return t(r)})}}function Bo(){return!1}function F2(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}}var ej="action",B2="action.bound",tj="autoAction",H2="autoAction.bound",nj="<unnamed action>",Kh=Ua(ej),U2=Ua(B2,{bound:!0}),Gh=Ua(tj,{autoAction:!0}),W2=Ua(H2,{autoAction:!0,bound:!0});function rj(e){var t=function(r,s){if(hn(r))return Cs(r.name||nj,r,e);if(hn(s))return Cs(r,s,e);if(Ha(s))return(e?Gh:Kh).decorate_20223_(r,s);if(ks(s))return Ba(r,s,e?Gh:Kh);if(ks(r))return Pn(Ua(e?tj:ej,{name:r,autoAction:e}))};return t}var ie=rj(!1);Object.assign(ie,Kh);var ma=rj(!0);Object.assign(ma,Gh);ie.bound=Pn(U2);ma.bound=Pn(W2);function K2(e){return Ub(e.name||nj,!1,e,this,void 0)}function Oi(e){return hn(e)&&e.isMobxAction===!0}function sj(e,t){var n,r,s,i;t===void 0&&(t=Eb);var o=(n=(r=t)==null?void 0:r.name)!=null?n:"Autorun",l=!t.scheduler&&!t.delay,c;if(l)c=new ur(o,function(){this.track(f)},t.onError,t.requiresObservable);else{var u=q2(t),d=!1;c=new ur(o,function(){d||(d=!0,u(function(){d=!1,c.isDisposed||c.track(f)}))},t.onError,t.requiresObservable)}function f(){e(c)}return(s=t)!=null&&(s=s.signal)!=null&&s.aborted||c.schedule_(),c.getDisposer_((i=t)==null?void 0:i.signal)}var G2=function(t){return t()};function q2(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:G2}var Y2="onBO",X2="onBUO";function Q2(e,t,n){return oj(Y2,e,t,n)}function ij(e,t,n){return oj(X2,e,t,n)}function oj(e,t,n,r){var s=tu(t),i=hn(r)?r:n,o=e+"L";return s[o]?s[o].add(i):s[o]=new Set([i]),function(){var l=s[o];l&&(l.delete(i),l.size===0&&delete s[o])}}var Z2="never",Nl="always",J2="observed";function aj(e){e.isolateGlobalState===!0&&R2();var t=e.useProxies,n=e.enforceActions;if(t!==void 0&&(Y.useProxies=t===Nl?!0:t===Z2?!1:typeof Proxy<"u"),t==="ifavailable"&&(Y.verifyProxies=!0),n!==void 0){var r=n===Nl?Nl:n===J2;Y.enforceActions=r,Y.allowStateChanges=!(r===!0||r===Nl)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(s){s in e&&(Y[s]=!!e[s])}),Y.allowStateReads=!Y.observableRequiresReaction,e.reactionScheduler&&V2(e.reactionScheduler)}function eM(e,t,n,r){var s=$P(t);return Vs(function(){var i=eo(e,r)[oe];Gu(s).forEach(function(o){i.extend_(o,s[o],n&&o in n?n[o]:!0)})}),e}function tM(e,t){return lj(tu(e,t))}function lj(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=nM(e.observing_).map(lj)),t}function nM(e){return Array.from(new Set(e))}var rM=0,sM=function(e){function t(){var r;return r=e.call(this,"FLOW_CANCELLED")||this,Object.setPrototypeOf(r,(this instanceof t?this.constructor:void 0).prototype),r.name="FlowCancellationError",r}Hm(t,e);var n=t.prototype;return n.toString=function(){return"Error: "+this.message},t}(Vh(Error)),Zd=Lb("flow"),iM=Lb("flow.bound",{bound:!0}),$i=Object.assign(function(t,n){if(Ha(n))return Zd.decorate_20223_(t,n);if(ks(n))return Ba(t,n,Zd);var r=t,s=r.name||"<unnamed flow>",i=function(){var l=this,c=arguments,u=++rM,d=ie(s+" - runid: "+u+" - init",r).apply(l,c),f,h=void 0,p=new Promise(function(v,x){var w=0;f=x;function g(_){h=void 0;var j;try{j=ie(s+" - runid: "+u+" - yield "+w++,d.next).call(d,_)}catch(N){return x(N)}m(j)}function y(_){h=void 0;var j;try{j=ie(s+" - runid: "+u+" - yield "+w++,d.throw).call(d,_)}catch(N){return x(N)}m(j)}function m(_){if(hn(_==null?void 0:_.then)){_.then(m,x);return}return _.done?v(_.value):(h=Promise.resolve(_.value),h.then(g,y))}g(void 0)});return p.cancel=ie(s+" - runid: "+u+" - cancel",function(){try{h&&Ly(h);var v=d.return(void 0),x=Promise.resolve(v.value);x.then(ci,ci),Ly(x),f(new sM)}catch(w){f(w)}}),p};return i.isMobXFlow=!0,i},Zd);$i.bound=Pn(iM);function Ly(e){hn(e.cancel)&&e.cancel()}function ga(e){return(e==null?void 0:e.isMobXFlow)===!0}function oM(e,t){return e?Zu(e)||!!e[oe]||Um(e)||Zc(e)||Xu(e):!1}function cj(e){return oM(e)}function Kn(e,t){t===void 0&&(t=void 0),Ut();try{return e.apply(t)}finally{Wt()}}function Ws(e){return e[oe]}var aM={has:function(t,n){return Ws(t).has_(n)},get:function(t,n){return Ws(t).get_(n)},set:function(t,n,r){var s;return ks(n)?(s=Ws(t).set_(n,r,!0))!=null?s:!0:!1},deleteProperty:function(t,n){var r;return ks(n)?(r=Ws(t).delete_(n,!0))!=null?r:!0:!1},defineProperty:function(t,n,r){var s;return(s=Ws(t).defineProperty_(n,r))!=null?s:!0},ownKeys:function(t){return Ws(t).ownKeys_()},preventExtensions:function(t){fe(13)}};function lM(e,t){var n,r;return Cb(),e=eo(e,t),(r=(n=e[oe]).proxy_)!=null?r:n.proxy_=new Proxy(e,aM)}function Ft(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function Wa(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),Ab(function(){var r=n.indexOf(t);r!==-1&&n.splice(r,1)})}function Bt(e,t){var n=Ds();try{for(var r=[].concat(e.interceptors_||[]),s=0,i=r.length;s<i&&(t=r[s](t),t&&!t.type&&fe(14),!!t);s++);return t}finally{tr(n)}}function un(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function Ka(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),Ab(function(){var r=n.indexOf(t);r!==-1&&n.splice(r,1)})}function dn(e,t){var n=Ds(),r=e.changeListeners_;if(r){r=r.slice();for(var s=0,i=r.length;s<i;s++)r[s](t);tr(n)}}function uj(e,t,n){return Vs(function(){var r,s=eo(e,n)[oe];(r=t)!=null||(t=HP(e)),Gu(t).forEach(function(i){return s.make_(i,t[i])})}),e}var Dy="splice",Mn="update",cM=1e4,uM={get:function(t,n){var r=t[oe];return n===oe?r:n==="length"?r.getArrayLength_():typeof n=="string"&&!isNaN(n)?r.get_(parseInt(n)):er(Jc,n)?Jc[n]:t[n]},set:function(t,n,r){var s=t[oe];return n==="length"&&s.setArrayLength_(r),typeof n=="symbol"||isNaN(n)?t[n]=r:s.set_(parseInt(n),r),!0},preventExtensions:function(){fe(15)}},Ym=function(){function e(n,r,s,i){n===void 0&&(n="ObservableArray"),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=s,this.legacyMode_=i,this.atom_=new qr(n),this.enhancer_=function(o,l){return r(o,l,"ObservableArray[..]")}}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.dehanceValues_=function(r){return this.dehancer!==void 0&&r.length>0?r.map(this.dehancer):r},t.intercept_=function(r){return Wa(this,r)},t.observe_=function(r,s){return s===void 0&&(s=!1),s&&r({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),Ka(this,r)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(r){(typeof r!="number"||isNaN(r)||r<0)&&fe("Out of range: "+r);var s=this.values_.length;if(r!==s)if(r>s){for(var i=new Array(r-s),o=0;o<r-s;o++)i[o]=void 0;this.spliceWithArray_(s,0,i)}else this.spliceWithArray_(r,s-r)},t.updateArrayLength_=function(r,s){r!==this.lastKnownLength_&&fe(16),this.lastKnownLength_+=s,this.legacyMode_&&s>0&&vj(r+s+1)},t.spliceWithArray_=function(r,s,i){var o=this;this.atom_;var l=this.values_.length;if(r===void 0?r=0:r>l?r=l:r<0&&(r=Math.max(0,l+r)),arguments.length===1?s=l-r:s==null?s=0:s=Math.max(0,Math.min(s,l-r)),i===void 0&&(i=Dh),Ft(this)){var c=Bt(this,{object:this.proxy_,type:Dy,index:r,removedCount:s,added:i});if(!c)return Dh;s=c.removedCount,i=c.added}if(i=i.length===0?i:i.map(function(f){return o.enhancer_(f,void 0)}),this.legacyMode_){var u=i.length-s;this.updateArrayLength_(l,u)}var d=this.spliceItemsIntoValues_(r,s,i);return(s!==0||i.length!==0)&&this.notifyArraySplice_(r,i,d),this.dehanceValues_(d)},t.spliceItemsIntoValues_=function(r,s,i){if(i.length<cM){var o;return(o=this.values_).splice.apply(o,[r,s].concat(i))}else{var l=this.values_.slice(r,r+s),c=this.values_.slice(r+s);this.values_.length+=i.length-s;for(var u=0;u<i.length;u++)this.values_[r+u]=i[u];for(var d=0;d<c.length;d++)this.values_[r+i.length+d]=c[d];return l}},t.notifyArrayChildUpdate_=function(r,s,i){var o=!this.owned_&&Bo(),l=un(this),c=l||o?{observableKind:"array",object:this.proxy_,type:Mn,debugObjectName:this.atom_.name_,index:r,newValue:s,oldValue:i}:null;this.atom_.reportChanged(),l&&dn(this,c)},t.notifyArraySplice_=function(r,s,i){var o=!this.owned_&&Bo(),l=un(this),c=l||o?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:Dy,index:r,removed:i,added:s,removedCount:i.length,addedCount:s.length}:null;this.atom_.reportChanged(),l&&dn(this,c)},t.get_=function(r){if(this.legacyMode_&&r>=this.values_.length){console.warn("[mobx] Out of bounds read: "+r);return}return this.atom_.reportObserved(),this.dehanceValue_(this.values_[r])},t.set_=function(r,s){var i=this.values_;if(this.legacyMode_&&r>i.length&&fe(17,r,i.length),r<i.length){this.atom_;var o=i[r];if(Ft(this)){var l=Bt(this,{type:Mn,object:this.proxy_,index:r,newValue:s});if(!l)return;s=l.newValue}s=this.enhancer_(s,o);var c=s!==o;c&&(i[r]=s,this.notifyArrayChildUpdate_(r,s,o))}else{for(var u=new Array(r+1-i.length),d=0;d<u.length-1;d++)u[d]=void 0;u[u.length-1]=s,this.spliceWithArray_(i.length,0,u)}},e}();function dM(e,t,n,r){return n===void 0&&(n="ObservableArray"),r===void 0&&(r=!1),Cb(),Vs(function(){var s=new Ym(n,t,r,!1);Pb(s.values_,oe,s);var i=new Proxy(s.values_,uM);return s.proxy_=i,e&&e.length&&s.spliceWithArray_(0,0,e),i})}var Jc={clear:function(){return this.splice(0)},replace:function(t){var n=this[oe];return n.spliceWithArray_(0,n.values_.length,t)},toJSON:function(){return this.slice()},splice:function(t,n){for(var r=arguments.length,s=new Array(r>2?r-2:0),i=2;i<r;i++)s[i-2]=arguments[i];var o=this[oe];switch(arguments.length){case 0:return[];case 1:return o.spliceWithArray_(t);case 2:return o.spliceWithArray_(t,n)}return o.spliceWithArray_(t,n,s)},spliceWithArray:function(t,n,r){return this[oe].spliceWithArray_(t,n,r)},push:function(){for(var t=this[oe],n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.spliceWithArray_(t.values_.length,0,r),t.values_.length},pop:function(){return this.splice(Math.max(this[oe].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var t=this[oe],n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.spliceWithArray_(0,0,r),t.values_.length},reverse:function(){return Y.trackingDerivation&&fe(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){Y.trackingDerivation&&fe(37,"sort");var t=this.slice();return t.sort.apply(t,arguments),this.replace(t),this},remove:function(t){var n=this[oe],r=n.dehanceValues_(n.values_).indexOf(t);return r>-1?(this.splice(r,1),!0):!1}};we("at",It);we("concat",It);we("flat",It);we("includes",It);we("indexOf",It);we("join",It);we("lastIndexOf",It);we("slice",It);we("toString",It);we("toLocaleString",It);we("toSorted",It);we("toSpliced",It);we("with",It);we("every",mn);we("filter",mn);we("find",mn);we("findIndex",mn);we("findLast",mn);we("findLastIndex",mn);we("flatMap",mn);we("forEach",mn);we("map",mn);we("some",mn);we("toReversed",mn);we("reduce",dj);we("reduceRight",dj);function we(e,t){typeof Array.prototype[e]=="function"&&(Jc[e]=t(e))}function It(e){return function(){var t=this[oe];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,s=this[oe];s.atom_.reportObserved();var i=s.dehanceValues_(s.values_);return i[e](function(o,l){return t.call(n,o,l,r)})}}function dj(e){return function(){var t=this,n=this[oe];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),s=arguments[0];return arguments[0]=function(i,o,l){return s(i,o,l,t)},r[e].apply(r,arguments)}}var fM=Ls("ObservableArrayAdministration",Ym);function Qu(e){return Wu(e)&&fM(e[oe])}var hM={},Ar="add",eu="delete",fj=function(){function e(n,r,s){var i=this;r===void 0&&(r=Es),s===void 0&&(s="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[oe]=hM,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=r,this.name_=s,hn(Map)||fe(18),Vs(function(){i.keysAtom_=Ob("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,n&&i.merge(n)})}var t=e.prototype;return t.has_=function(r){return this.data_.has(r)},t.has=function(r){var s=this;if(!Y.trackingDerivation)return this.has_(r);var i=this.hasMap_.get(r);if(!i){var o=i=new ms(this.has_(r),qu,"ObservableMap.key?",!1);this.hasMap_.set(r,o),ij(o,function(){return s.hasMap_.delete(r)})}return i.get()},t.set=function(r,s){var i=this.has_(r);if(Ft(this)){var o=Bt(this,{type:i?Mn:Ar,object:this,newValue:s,name:r});if(!o)return this;s=o.newValue}return i?this.updateValue_(r,s):this.addValue_(r,s),this},t.delete=function(r){var s=this;if(this.keysAtom_,Ft(this)){var i=Bt(this,{type:eu,object:this,name:r});if(!i)return!1}if(this.has_(r)){var o=Bo(),l=un(this),c=l||o?{observableKind:"map",debugObjectName:this.name_,type:eu,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return Kn(function(){var u;s.keysAtom_.reportChanged(),(u=s.hasMap_.get(r))==null||u.setNewValue_(!1);var d=s.data_.get(r);d.setNewValue_(void 0),s.data_.delete(r)}),l&&dn(this,c),!0}return!1},t.updateValue_=function(r,s){var i=this.data_.get(r);if(s=i.prepareNewValue_(s),s!==Y.UNCHANGED){var o=Bo(),l=un(this),c=l||o?{observableKind:"map",debugObjectName:this.name_,type:Mn,object:this,oldValue:i.value_,name:r,newValue:s}:null;i.setNewValue_(s),l&&dn(this,c)}},t.addValue_=function(r,s){var i=this;this.keysAtom_,Kn(function(){var u,d=new ms(s,i.enhancer_,"ObservableMap.key",!1);i.data_.set(r,d),s=d.value_,(u=i.hasMap_.get(r))==null||u.setNewValue_(!0),i.keysAtom_.reportChanged()});var o=Bo(),l=un(this),c=l||o?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:r,newValue:s}:null;l&&dn(this,c)},t.get=function(r){return this.has(r)?this.dehanceValue_(this.data_.get(r).get()):this.dehanceValue_(void 0)},t.getOrInsert=function(r,s){return this.has(r)||this.set(r,s),this.get(r)},t.getOrInsertComputed=function(r,s){return this.has(r)||this.set(r,s(r)),this.get(r)},t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var r=this,s=this.keys();return zy({next:function(){var o=s.next(),l=o.done,c=o.value;return{done:l,value:l?void 0:r.get(c)}}})},t.entries=function(){var r=this,s=this.keys();return zy({next:function(){var o=s.next(),l=o.done,c=o.value;return{done:l,value:l?void 0:[c,r.get(c)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(r,s){for(var i=ui(this),o;!(o=i()).done;){var l=o.value,c=l[0],u=l[1];r.call(s,u,c,this)}},t.merge=function(r){var s=this;return zs(r)&&(r=new Map(r)),Kn(function(){Fr(r)?OP(r).forEach(function(i){return s.set(i,r[i])}):Array.isArray(r)?r.forEach(function(i){var o=i[0],l=i[1];return s.set(o,l)}):Zi(r)?(RP(r)||fe(19,r),r.forEach(function(i,o){return s.set(o,i)})):r!=null&&fe(20,r)}),this},t.clear=function(){var r=this;Kn(function(){Kb(function(){for(var s=ui(r.keys()),i;!(i=s()).done;){var o=i.value;r.delete(o)}})})},t.replace=function(r){var s=this;return Kn(function(){for(var i=pM(r),o=new Map,l=!1,c=ui(s.data_.keys()),u;!(u=c()).done;){var d=u.value;if(!i.has(d)){var f=s.delete(d);if(f)l=!0;else{var h=s.data_.get(d);o.set(d,h)}}}for(var p=ui(i.entries()),v;!(v=p()).done;){var x=v.value,w=x[0],g=x[1],y=s.data_.has(w);if(s.set(w,g),s.data_.has(w)){var m=s.data_.get(w);o.set(w,m),y||(l=!0)}}if(!l)if(s.data_.size!==o.size)s.keysAtom_.reportChanged();else for(var _=s.data_.keys(),j=o.keys(),N=_.next(),k=j.next();!N.done;){if(N.value!==k.value){s.keysAtom_.reportChanged();break}N=_.next(),k=j.next()}s.data_=o}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(r,s){return Ka(this,r)},t.intercept_=function(r){return Wa(this,r)},Ji(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),zs=Ls("ObservableMap",fj);function zy(e){return e[Symbol.toStringTag]="MapIterator",Qm(e)}function pM(e){if(Zi(e)||zs(e))return e;if(Array.isArray(e))return new Map(e);if(Fr(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}else return fe(21,e)}var mM={},hj=function(){function e(n,r,s){var i=this;r===void 0&&(r=Es),s===void 0&&(s="ObservableSet"),this.name_=void 0,this[oe]=mM,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=s,hn(Set)||fe(22),this.enhancer_=function(o,l){return r(o,l,s)},Vs(function(){i.atom_=Ob(i.name_),n&&i.replace(n)})}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.clear=function(){var r=this;Kn(function(){Kb(function(){for(var s=ui(r.data_.values()),i;!(i=s()).done;){var o=i.value;r.delete(o)}})})},t.forEach=function(r,s){for(var i=ui(this),o;!(o=i()).done;){var l=o.value;r.call(s,l,l,this)}},t.add=function(r){var s=this;if(this.atom_,Ft(this)){var i=Bt(this,{type:Ar,object:this,newValue:r});if(!i)return this;r=i.newValue}if(!this.has(r)){Kn(function(){s.data_.add(s.enhancer_(r,void 0)),s.atom_.reportChanged()});var o=!1,l=un(this),c=l||o?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:r}:null;l&&dn(this,c)}return this},t.delete=function(r){var s=this;if(Ft(this)){var i=Bt(this,{type:eu,object:this,oldValue:r});if(!i)return!1}if(this.has(r)){var o=!1,l=un(this),c=l||o?{observableKind:"set",debugObjectName:this.name_,type:eu,object:this,oldValue:r}:null;return Kn(function(){s.atom_.reportChanged(),s.data_.delete(r)}),l&&dn(this,c),!0}return!1},t.has=function(r){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(r))},t.entries=function(){var r=this.values();return Vy({next:function(){var i=r.next(),o=i.value,l=i.done;return l?{value:void 0,done:l}:{value:[o,o],done:l}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var r=this,s=this.data_.values();return Vy({next:function(){var o=s.next(),l=o.value,c=o.done;return c?{value:void 0,done:c}:{value:r.dehanceValue_(l),done:c}}})},t.intersection=function(r){if(Wn(r)&&!kn(r))return r.intersection(this);var s=new Set(this);return s.intersection(r)},t.union=function(r){if(Wn(r)&&!kn(r))return r.union(this);var s=new Set(this);return s.union(r)},t.difference=function(r){return new Set(this).difference(r)},t.symmetricDifference=function(r){if(Wn(r)&&!kn(r))return r.symmetricDifference(this);var s=new Set(this);return s.symmetricDifference(r)},t.isSubsetOf=function(r){return new Set(this).isSubsetOf(r)},t.isSupersetOf=function(r){return new Set(this).isSupersetOf(r)},t.isDisjointFrom=function(r){if(Wn(r)&&!kn(r))return r.isDisjointFrom(this);var s=new Set(this);return s.isDisjointFrom(r)},t.replace=function(r){var s=this;return kn(r)&&(r=new Set(r)),Kn(function(){Array.isArray(r)?(s.clear(),r.forEach(function(i){return s.add(i)})):Wn(r)?(s.clear(),r.forEach(function(i){return s.add(i)})):r!=null&&fe("Cannot initialize set from "+r)}),this},t.observe_=function(r,s){return Ka(this,r)},t.intercept_=function(r){return Wa(this,r)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},Ji(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),kn=Ls("ObservableSet",hj);function Vy(e){return e[Symbol.toStringTag]="SetIterator",Qm(e)}var Fy=Object.create(null),By="remove",pj=function(){function e(n,r,s,i){r===void 0&&(r=new Map),i===void 0&&(i=h2),this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.lazyComputedKeys_=void 0,this.lazyObservableKeys_=void 0,this.target_=n,this.values_=r,this.name_=s,this.defaultAnnotation_=i,this.keysAtom_=new qr("ObservableObject.keys"),this.isPlainObject_=Fr(this.target_)}var t=e.prototype;return t.getObservablePropValue_=function(r){var s,i,o=(s=(i=this.values_.get(r))!=null?i:this.materializeLazyComputed_(r))!=null?s:this.materializeLazyObservable_(r);return o.get()},t.materializeLazyComputed_=function(r){var s,i=(s=this.lazyComputedKeys_)==null?void 0:s.get(r);if(i){this.lazyComputedKeys_.delete(r),this.lazyComputedKeys_.size===0&&(this.lazyComputedKeys_=void 0);var o=i();return this.values_.set(r,o),o}},t.materializeLazyObservable_=function(r){var s,i=(s=this.lazyObservableKeys_)==null?void 0:s.get(r);if(i){this.lazyObservableKeys_.delete(r),this.lazyObservableKeys_.size===0&&(this.lazyObservableKeys_=void 0);var o=i();return this.values_.set(r,o),o}},t.setObservablePropValue_=function(r,s){var i,o,l=(i=(o=this.values_.get(r))!=null?o:this.materializeLazyComputed_(r))!=null?i:this.materializeLazyObservable_(r);if(l instanceof Nt)return l.set(s),!0;if(Ft(this)){var c=Bt(this,{type:Mn,object:this.proxy_||this.target_,name:r,newValue:s});if(!c)return null;s=c.newValue}if(s=l.prepareNewValue_(s),s!==Y.UNCHANGED){var u=un(this),d=!1,f=u||d?{type:Mn,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:l.value_,name:r,newValue:s}:null;l.setNewValue_(s),u&&dn(this,f)}return!0},t.get_=function(r){return Y.trackingDerivation&&!er(this.target_,r)&&this.has_(r),this.target_[r]},t.set_=function(r,s,i){return i===void 0&&(i=!1),er(this.target_,r)?this.values_.has(r)?this.setObservablePropValue_(r,s):i?Reflect.set(this.target_,r,s):(this.target_[r]=s,!0):this.extend_(r,{value:s,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,i)},t.has_=function(r){if(!Y.trackingDerivation)return r in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var s=this.pendingKeys_.get(r);return s||(s=new ms(r in this.target_,qu,"ObservableObject.key?",!1),this.pendingKeys_.set(r,s)),s.get()},t.make_=function(r,s){if(s===!0&&(s=this.defaultAnnotation_),s!==!1){if(!(r in this.target_)){var i;if((i=this.target_[En])!=null&&i[r])return;fe(1,s.annotationType_,this.name_+"."+r.toString())}for(var o=this.target_;o&&o!==Uu;){var l=Gc(o,r);if(l){var c=s.make_(this,r,l,o);if(c===0)return;if(c===1)break}o=Object.getPrototypeOf(o)}Uy(this,s,r)}},t.extend_=function(r,s,i,o){if(o===void 0&&(o=!1),i===!0&&(i=this.defaultAnnotation_),i===!1)return this.defineProperty_(r,s,o);var l=i.extend_(this,r,s,o);return l&&Uy(this,i,r),l},t.defineProperty_=function(r,s,i){i===void 0&&(i=!1),this.keysAtom_;try{Ut();var o=this.delete_(r);if(!o)return o;if(Ft(this)){var l=Bt(this,{object:this.proxy_||this.target_,name:r,type:Ar,newValue:s.value});if(!l)return null;var c=l.newValue;s.value!==c&&(s=Ns({},s,{value:c}))}if(i){if(!Reflect.defineProperty(this.target_,r,s))return!1}else Tn(this.target_,r,s);this.notifyPropertyAddition_(r,s.value)}finally{Wt()}return!0},t.defineObservableProperty_=function(r,s,i,o){o===void 0&&(o=!1),this.keysAtom_;try{Ut();var l=this.delete_(r);if(!l)return l;if(Ft(this)){var c=Bt(this,{object:this.proxy_||this.target_,name:r,type:Ar,newValue:s});if(!c)return null;s=c.newValue}var u=Hy(r),d={configurable:Y.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:u.get,set:u.set};if(o){if(!Reflect.defineProperty(this.target_,r,d))return!1}else Tn(this.target_,r,d);var f=new ms(s,i,"ObservableObject.key",!1);this.values_.set(r,f),this.notifyPropertyAddition_(r,f.value_)}finally{Wt()}return!0},t.defineComputedProperty_=function(r,s,i){i===void 0&&(i=!1),this.keysAtom_;try{Ut();var o=this.delete_(r);if(!o)return o;if(Ft(this)){var l=Bt(this,{object:this.proxy_||this.target_,name:r,type:Ar,newValue:void 0});if(!l)return null}s.name||(s.name="ObservableObject.key"),s.context=this.proxy_||this.target_;var c=Hy(r),u={configurable:Y.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:c.get,set:c.set};if(i){if(!Reflect.defineProperty(this.target_,r,u))return!1}else Tn(this.target_,r,u);this.values_.set(r,new Nt(s)),this.notifyPropertyAddition_(r,void 0)}finally{Wt()}return!0},t.delete_=function(r,s){if(s===void 0&&(s=!1),this.keysAtom_,!er(this.target_,r))return!0;if(Ft(this)){var i=Bt(this,{object:this.proxy_||this.target_,name:r,type:By});if(!i)return null}try{var o;Ut();var l=un(this),c=!1,u=this.values_.get(r),d=void 0;if(!u&&(l||c)){var f;d=(f=Gc(this.target_,r))==null?void 0:f.value}if(s){if(!Reflect.deleteProperty(this.target_,r))return!1}else delete this.target_[r];if(u&&(this.values_.delete(r),u instanceof ms&&(d=u.value_),Zb(u)),this.keysAtom_.reportChanged(),(o=this.pendingKeys_)==null||(o=o.get(r))==null||o.set(r in this.target_),l||c){var h={type:By,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:d,name:r};l&&dn(this,h)}}finally{Wt()}return!0},t.observe_=function(r,s){return Ka(this,r)},t.intercept_=function(r){return Wa(this,r)},t.notifyPropertyAddition_=function(r,s){var i,o=un(this),l=!1;if(o||l){var c=o||l?{type:Ar,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:r,newValue:s}:null;o&&dn(this,c)}(i=this.pendingKeys_)==null||(i=i.get(r))==null||i.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),Gu(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function eo(e,t){var n;if(er(e,oe))return e;var r=(n=t==null?void 0:t.name)!=null?n:"ObservableObject",s=new pj(e,new Map,String(r),S2(t));return Ku(e,oe,s),e}var gM=Ls("ObservableObjectAdministration",pj);function Hy(e){return Fy[e]||(Fy[e]={get:function(){return this[oe].getObservablePropValue_(e)},set:function(n){return this[oe].setObservablePropValue_(e,n)}})}function Zu(e){return Wu(e)?gM(e[oe]):!1}function Uy(e,t,n){var r;(r=e.target_[En])==null||delete r[n]}var vM=gj(0),yM=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),Jd=0,mj=function(){};function _M(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}_M(mj,Array.prototype);var Xm=function(e){function t(r,s,i,o){var l;return i===void 0&&(i="ObservableArray"),o===void 0&&(o=!1),l=e.call(this)||this,Vs(function(){var c=new Ym(i,s,o,!0);c.proxy_=l,Pb(l,oe,c),r&&r.length&&l.spliceWithArray(0,0,r),yM&&Object.defineProperty(l,"0",vM)}),l}Hm(t,e);var n=t.prototype;return n.concat=function(){this[oe].atom_.reportObserved();for(var s=arguments.length,i=new Array(s),o=0;o<s;o++)i[o]=arguments[o];return Array.prototype.concat.apply(this.slice(),i.map(function(l){return Qu(l)?l.slice():l}))},n[Symbol.iterator]=function(){var r=this,s=0;return Qm({next:function(){return s<r.length?{value:r[s++],done:!1}:{done:!0,value:void 0}}})},Ji(t,[{key:"length",get:function(){return this[oe].getArrayLength_()},set:function(s){this[oe].setArrayLength_(s)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(mj);Object.entries(Jc).forEach(function(e){var t=e[0],n=e[1];t!=="concat"&&Ku(Xm.prototype,t,n)});function gj(e){return{enumerable:!1,configurable:!0,get:function(){return this[oe].get_(e)},set:function(n){this[oe].set_(e,n)}}}function xM(e){Tn(Xm.prototype,""+e,gj(e))}function vj(e){if(e>Jd){for(var t=Jd;t<e+100;t++)xM(t);Jd=e}}vj(1e3);function wM(e,t,n){return new Xm(e,t,n)}function tu(e,t){if(typeof e=="object"&&e!==null){if(Qu(e))return t!==void 0&&fe(23),e[oe].atom_;if(kn(e))return e.atom_;if(zs(e)){if(t===void 0)return e.keysAtom_;var n=e.data_.get(t)||e.hasMap_.get(t);return n||fe(25,t,qh(e)),n}if(Zu(e)){var r,s;if(!t)return fe(26);var i=e[oe],o=(r=(s=i.values_.get(t))!=null?s:i.materializeLazyComputed_(t))!=null?r:i.materializeLazyObservable_(t);return o||fe(27,t,qh(e)),o}if(Um(e)||Xu(e)||Zc(e))return e}else if(hn(e)&&Zc(e[oe]))return e[oe];fe(28)}function bM(e,t){if(e||fe(29),Um(e)||Xu(e)||Zc(e)||zs(e)||kn(e))return e;if(e[oe])return e[oe];fe(24,e)}function qh(e,t){var n;if(t!==void 0)n=tu(e,t);else{if(Oi(e))return e.name;Zu(e)||zs(e)||kn(e)?n=bM(e):n=tu(e)}return n.name_}function Vs(e){var t=Ds(),n=Km(!0);Ut();try{return e()}finally{Wt(),Gm(n),tr(t)}}var Wy=Uu.toString;function yj(e,t,n){return n===void 0&&(n=-1),Yh(e,t,n)}function Yh(e,t,n,r,s){if(e===t)return e!==0||1/e===1/t;if(e==null||t==null)return!1;if(e!==e)return t!==t;var i=typeof e;if(i!=="function"&&i!=="object"&&typeof t!="object")return!1;var o=Wy.call(e);if(o!==Wy.call(t))return!1;switch(o){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:+e==0?1/+e===1/t:+e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object Symbol]":return typeof Symbol<"u"&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t);case"[object Map]":case"[object Set]":n>=0&&n++;break}e=Ky(e),t=Ky(t);var l=o==="[object Array]";if(!l){if(typeof e!="object"||typeof t!="object")return!1;var c=e.constructor,u=t.constructor;if(c!==u&&!(hn(c)&&c instanceof c&&hn(u)&&u instanceof u)&&"constructor"in e&&"constructor"in t)return!1}if(n===0)return!1;n<0&&(n=-1),r=r||[],s=s||[];for(var d=r.length;d--;)if(r[d]===e)return s[d]===t;if(r.push(e),s.push(t),l){if(d=e.length,d!==t.length)return!1;for(;d--;)if(!Yh(e[d],t[d],n-1,r,s))return!1}else{var f=Object.keys(e),h=f.length;if(Object.keys(t).length!==h)return!1;for(var p=0;p<h;p++){var v=f[p];if(!(er(t,v)&&Yh(e[v],t[v],n-1,r,s)))return!1}}return r.pop(),s.pop(),!0}function Ky(e){return Qu(e)?e.slice():Zi(e)||zs(e)||Wn(e)||kn(e)?Array.from(e.entries()):e}var Gy,jM=Hu(),SM=((Gy=jM.Iterator)==null?void 0:Gy.prototype)||{};function Qm(e){return e[Symbol.iterator]=kM,Object.assign(Object.create(SM),e)}function kM(){return this}["Symbol","Map","Set"].forEach(function(e){var t=Hu();typeof t[e]>"u"&&fe("MobX requires global '"+e+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:F2,extras:{getDebugName:qh},$mobx:oe});if(!b.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!uj)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function NM(e){e()}function EM(e){e||(e=NM),aj({reactionScheduler:e})}function CM(e){return tM(e)}var AM=1e4,TM=1e4,PM=function(){function e(t){var n=this;Object.defineProperty(this,"finalize",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"registrations",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"sweepTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sweep",{enumerable:!0,configurable:!0,writable:!0,value:function(r){r===void 0&&(r=AM),clearTimeout(n.sweepTimeout),n.sweepTimeout=void 0;var s=Date.now();n.registrations.forEach(function(i,o){s-i.registeredAt>=r&&(n.finalize(i.value),n.registrations.delete(o))}),n.registrations.size>0&&n.scheduleSweep()}}),Object.defineProperty(this,"finalizeAllImmediately",{enumerable:!0,configurable:!0,writable:!0,value:function(){n.sweep(0)}})}return Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r){this.registrations.set(r,{value:n,registeredAt:Date.now()}),this.scheduleSweep()}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(t){this.registrations.delete(t)}}),Object.defineProperty(e.prototype,"scheduleSweep",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.sweepTimeout===void 0&&(this.sweepTimeout=setTimeout(this.sweep,TM))}}),e}(),MM=typeof FinalizationRegistry<"u"?FinalizationRegistry:PM,Xh=new MM(function(e){var t;(t=e.reaction)===null||t===void 0||t.dispose(),e.reaction=null}),_j={exports:{}},xj={};/**
43
+ * @license React
44
+ * use-sync-external-store-shim.production.js
45
+ *
46
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
47
+ *
48
+ * This source code is licensed under the MIT license found in the
49
+ * LICENSE file in the root directory of this source tree.
50
+ */var Li=b;function IM(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var RM=typeof Object.is=="function"?Object.is:IM,OM=Li.useState,$M=Li.useEffect,LM=Li.useLayoutEffect,DM=Li.useDebugValue;function zM(e,t){var n=t(),r=OM({inst:{value:n,getSnapshot:t}}),s=r[0].inst,i=r[1];return LM(function(){s.value=n,s.getSnapshot=t,ef(s)&&i({inst:s})},[e,n,t]),$M(function(){return ef(s)&&i({inst:s}),e(function(){ef(s)&&i({inst:s})})},[e]),DM(n),n}function ef(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!RM(e,n)}catch{return!0}}function VM(e,t){return t()}var FM=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?VM:zM;xj.useSyncExternalStore=Li.useSyncExternalStore!==void 0?Li.useSyncExternalStore:FM;_j.exports=xj;var wj=_j.exports;function qy(e){e.reaction=new ur("observer".concat(e.name),function(){var t;e.stateVersion=Symbol(),(t=e.onStoreChange)===null||t===void 0||t.call(e)})}function BM(e,t){t===void 0&&(t="observed");var n=Zn.useRef(null);if(!n.current){var r={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(l){return Xh.unregister(r),r.onStoreChange=l,r.reaction||(qy(r),r.stateVersion=Symbol()),function(){var c;r.onStoreChange=null,(c=r.reaction)===null||c===void 0||c.dispose(),r.reaction=null}},getSnapshot:function(){return r.stateVersion}};n.current=r}var s=n.current;s.reaction||(qy(s),Xh.register(n,s,s)),Zn.useDebugValue(s.reaction,CM),wj.useSyncExternalStore(s.subscribe,s.getSnapshot,s.getSnapshot);var i,o;if(s.reaction.track(function(){try{i=e()}catch(l){o=l}}),o)throw o;return i}var tf,nf,bj=typeof Symbol=="function"&&Symbol.for,HM=(nf=(tf=Object.getOwnPropertyDescriptor(function(){},"name"))===null||tf===void 0?void 0:tf.configurable)!==null&&nf!==void 0?nf:!1,Yy=bj?Symbol.for("react.forward_ref"):typeof b.forwardRef=="function"&&b.forwardRef(function(e){return null}).$$typeof,Xy=bj?Symbol.for("react.memo"):typeof b.memo=="function"&&b.memo(function(e){return null}).$$typeof;function ut(e,t){var n;if(Xy&&e.$$typeof===Xy)throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");var r=(n=void 0)!==null&&n!==void 0?n:!1,s=e,i=e.displayName||e.name;if(Yy&&e.$$typeof===Yy&&(r=!0,s=e.render,typeof s!="function"))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var o=function(l,c){return BM(function(){return s(l,c)},i)};return o.displayName=e.displayName,HM&&Object.defineProperty(o,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(o.contextTypes=e.contextTypes),r&&(o=b.forwardRef(o)),o=b.memo(o),WM(e,o),o}var UM={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function WM(e,t){Object.keys(e).forEach(function(n){UM[n]||Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}var rf;EM(Sb.unstable_batchedUpdates);rf=Xh.finalizeAllImmediately;const Zm=b.createContext({});function Jm(e){const t=b.useRef(null);return t.current===null&&(t.current=e()),t.current}const Ju=b.createContext(null),eg=b.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class KM extends b.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function GM({children:e,isPresent:t}){const n=b.useId(),r=b.useRef(null),s=b.useRef({width:0,height:0,top:0,left:0}),{nonce:i}=b.useContext(eg);return b.useInsertionEffect(()=>{const{width:o,height:l,top:c,left:u}=s.current;if(t||!r.current||!o||!l)return;r.current.dataset.motionPopId=n;const d=document.createElement("style");return i&&(d.nonce=i),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(`
51
+ [data-motion-pop-id="${n}"] {
52
+ position: absolute !important;
53
+ width: ${o}px !important;
54
+ height: ${l}px !important;
55
+ top: ${c}px !important;
56
+ left: ${u}px !important;
57
+ }
58
+ `),()=>{document.head.removeChild(d)}},[t]),a.jsx(KM,{isPresent:t,childRef:r,sizeRef:s,children:b.cloneElement(e,{ref:r})})}const qM=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:i,mode:o})=>{const l=Jm(YM),c=b.useId(),u=b.useCallback(f=>{l.set(f,!0);for(const h of l.values())if(!h)return;r&&r()},[l,r]),d=b.useMemo(()=>({id:c,initial:t,isPresent:n,custom:s,onExitComplete:u,register:f=>(l.set(f,!1),()=>l.delete(f))}),i?[Math.random(),u]:[n,u]);return b.useMemo(()=>{l.forEach((f,h)=>l.set(h,!1))},[n]),b.useEffect(()=>{!n&&!l.size&&r&&r()},[n]),o==="popLayout"&&(e=a.jsx(GM,{isPresent:n,children:e})),a.jsx(Ju.Provider,{value:d,children:e})};function YM(){return new Map}function jj(e=!0){const t=b.useContext(Ju);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=t,i=b.useId();b.useEffect(()=>{e&&s(i)},[e]);const o=b.useCallback(()=>e&&r&&r(i),[i,r,e]);return!n&&r?[!1,o]:[!0]}const El=e=>e.key||"";function Qy(e){const t=[];return b.Children.forEach(e,n=>{b.isValidElement(n)&&t.push(n)}),t}const tg=typeof window<"u",Sj=tg?b.useLayoutEffect:b.useEffect,Ho=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:i="sync",propagate:o=!1})=>{const[l,c]=jj(o),u=b.useMemo(()=>Qy(e),[e]),d=o&&!l?[]:u.map(El),f=b.useRef(!0),h=b.useRef(u),p=Jm(()=>new Map),[v,x]=b.useState(u),[w,g]=b.useState(u);Sj(()=>{f.current=!1,h.current=u;for(let _=0;_<w.length;_++){const j=El(w[_]);d.includes(j)?p.delete(j):p.get(j)!==!0&&p.set(j,!1)}},[w,d.length,d.join("-")]);const y=[];if(u!==v){let _=[...u];for(let j=0;j<w.length;j++){const N=w[j],k=El(N);d.includes(k)||(_.splice(j,0,N),y.push(N))}i==="wait"&&y.length&&(_=y),g(Qy(_)),x(u);return}const{forceRender:m}=b.useContext(Zm);return a.jsx(a.Fragment,{children:w.map(_=>{const j=El(_),N=o&&!l?!1:u===w||d.includes(j),k=()=>{if(p.has(j))p.set(j,!0);else return;let S=!0;p.forEach(P=>{P||(S=!1)}),S&&(m==null||m(),g(h.current),o&&(c==null||c()),r&&r())};return a.jsx(qM,{isPresent:N,initial:!f.current||n?void 0:!1,custom:N?void 0:t,presenceAffectsLayout:s,mode:i,onExitComplete:N?void 0:k,children:_},j)})})},Et=e=>e;let kj=Et;const XM={useManualTiming:!1};function QM(e){let t=new Set,n=new Set,r=!1,s=!1;const i=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function l(u){i.has(u)&&(c.schedule(u),e()),u(o)}const c={schedule:(u,d=!1,f=!1)=>{const p=f&&r?t:n;return d&&i.add(u),p.has(u)||p.add(u),u},cancel:u=>{n.delete(u),i.delete(u)},process:u=>{if(o=u,r){s=!0;return}r=!0,[t,n]=[n,t],t.forEach(l),t.clear(),r=!1,s&&(s=!1,c.process(u))}};return c}const Cl=["read","resolveKeyframes","update","preRender","render","postRender"],ZM=40;function Nj(e,t){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,o=Cl.reduce((g,y)=>(g[y]=QM(i),g),{}),{read:l,resolveKeyframes:c,update:u,preRender:d,render:f,postRender:h}=o,p=()=>{const g=performance.now();n=!1,s.delta=r?1e3/60:Math.max(Math.min(g-s.timestamp,ZM),1),s.timestamp=g,s.isProcessing=!0,l.process(s),c.process(s),u.process(s),d.process(s),f.process(s),h.process(s),s.isProcessing=!1,n&&t&&(r=!1,e(p))},v=()=>{n=!0,r=!0,s.isProcessing||e(p)};return{schedule:Cl.reduce((g,y)=>{const m=o[y];return g[y]=(_,j=!1,N=!1)=>(n||v(),m.schedule(_,j,N)),g},{}),cancel:g=>{for(let y=0;y<Cl.length;y++)o[Cl[y]].cancel(g)},state:s,steps:o}}const{schedule:ke,cancel:Br,state:qe,steps:sf}=Nj(typeof requestAnimationFrame<"u"?requestAnimationFrame:Et,!0),Ej=b.createContext({strict:!1}),Zy={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Di={};for(const e in Zy)Di[e]={isEnabled:t=>Zy[e].some(n=>!!t[n])};function JM(e){for(const t in e)Di[t]={...Di[t],...e[t]}}const eI=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function nu(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||eI.has(e)}let Cj=e=>!nu(e);function tI(e){e&&(Cj=t=>t.startsWith("on")?!nu(t):e(t))}try{tI(require("@emotion/is-prop-valid").default)}catch{}function nI(e,t,n){const r={};for(const s in e)s==="values"&&typeof e.values=="object"||(Cj(s)||n===!0&&nu(s)||!t&&!nu(s)||e.draggable&&s.startsWith("onDrag"))&&(r[s]=e[s]);return r}function rI(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...r)=>e(...r);return new Proxy(n,{get:(r,s)=>s==="create"?e:(t.has(s)||t.set(s,e(s)),t.get(s))})}const ed=b.createContext({});function va(e){return typeof e=="string"||Array.isArray(e)}function td(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const ng=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],rg=["initial",...ng];function nd(e){return td(e.animate)||rg.some(t=>va(e[t]))}function Aj(e){return!!(nd(e)||e.variants)}function sI(e,t){if(nd(e)){const{initial:n,animate:r}=e;return{initial:n===!1||va(n)?n:void 0,animate:va(r)?r:void 0}}return e.inherit!==!1?t:{}}function iI(e){const{initial:t,animate:n}=sI(e,b.useContext(ed));return b.useMemo(()=>({initial:t,animate:n}),[Jy(t),Jy(n)])}function Jy(e){return Array.isArray(e)?e.join(" "):e}const oI=Symbol.for("motionComponentSymbol");function di(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function aI(e,t,n){return b.useCallback(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):di(n)&&(n.current=r))},[t])}const sg=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),lI="framerAppearId",Tj="data-"+sg(lI),{schedule:ig}=Nj(queueMicrotask,!1),Pj=b.createContext({});function cI(e,t,n,r,s){var i,o;const{visualElement:l}=b.useContext(ed),c=b.useContext(Ej),u=b.useContext(Ju),d=b.useContext(eg).reducedMotion,f=b.useRef(null);r=r||c.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:l,props:n,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:d}));const h=f.current,p=b.useContext(Pj);h&&!h.projection&&s&&(h.type==="html"||h.type==="svg")&&uI(f.current,n,s,p);const v=b.useRef(!1);b.useInsertionEffect(()=>{h&&v.current&&h.update(n,u)});const x=n[Tj],w=b.useRef(!!x&&!(!((i=window.MotionHandoffIsComplete)===null||i===void 0)&&i.call(window,x))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,x)));return Sj(()=>{h&&(v.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),ig.render(h.render),w.current&&h.animationState&&h.animationState.animateChanges())}),b.useEffect(()=>{h&&(!w.current&&h.animationState&&h.animationState.animateChanges(),w.current&&(queueMicrotask(()=>{var g;(g=window.MotionHandoffMarkAsComplete)===null||g===void 0||g.call(window,x)}),w.current=!1))}),h}function uI(e,t,n,r){const{layoutId:s,layout:i,drag:o,dragConstraints:l,layoutScroll:c,layoutRoot:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:Mj(e.parent)),e.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!o||l&&di(l),visualElement:e,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,layoutScroll:c,layoutRoot:u})}function Mj(e){if(e)return e.options.allowProjection!==!1?e.projection:Mj(e.parent)}function dI({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:s}){var i,o;e&&JM(e);function l(u,d){let f;const h={...b.useContext(eg),...u,layoutId:fI(u)},{isStatic:p}=h,v=iI(u),x=r(u,p);if(!p&&tg){hI();const w=pI(h);f=w.MeasureLayout,v.visualElement=cI(s,x,h,t,w.ProjectionNode)}return a.jsxs(ed.Provider,{value:v,children:[f&&v.visualElement?a.jsx(f,{visualElement:v.visualElement,...h}):null,n(s,u,aI(x,v.visualElement,d),x,p,v.visualElement)]})}l.displayName=`motion.${typeof s=="string"?s:`create(${(o=(i=s.displayName)!==null&&i!==void 0?i:s.name)!==null&&o!==void 0?o:""})`}`;const c=b.forwardRef(l);return c[oI]=s,c}function fI({layoutId:e}){const t=b.useContext(Zm).id;return t&&e!==void 0?t+"-"+e:e}function hI(e,t){b.useContext(Ej).strict}function pI(e){const{drag:t,layout:n}=Di;if(!t&&!n)return{};const r={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const mI=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function og(e){return typeof e!="string"||e.includes("-")?!1:!!(mI.indexOf(e)>-1||/[A-Z]/u.test(e))}function e0(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function ag(e,t,n,r){if(typeof t=="function"){const[s,i]=e0(r);t=t(n!==void 0?n:e.custom,s,i)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[s,i]=e0(r);t=t(n!==void 0?n:e.custom,s,i)}return t}const Qh=e=>Array.isArray(e),gI=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),vI=e=>Qh(e)?e[e.length-1]||0:e,nt=e=>!!(e&&e.getVelocity);function cc(e){const t=nt(e)?e.get():e;return gI(t)?t.toValue():t}function yI({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},r,s,i){const o={latestValues:_I(r,s,i,e),renderState:t()};return n&&(o.onMount=l=>n({props:r,current:l,...o}),o.onUpdate=l=>n(l)),o}const Ij=e=>(t,n)=>{const r=b.useContext(ed),s=b.useContext(Ju),i=()=>yI(e,t,r,s);return n?i():Jm(i)};function _I(e,t,n,r){const s={},i=r(e,{});for(const h in i)s[h]=cc(i[h]);let{initial:o,animate:l}=e;const c=nd(e),u=Aj(e);t&&u&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),l===void 0&&(l=t.animate));let d=n?n.initial===!1:!1;d=d||o===!1;const f=d?l:o;if(f&&typeof f!="boolean"&&!td(f)){const h=Array.isArray(f)?f:[f];for(let p=0;p<h.length;p++){const v=ag(e,h[p]);if(v){const{transitionEnd:x,transition:w,...g}=v;for(const y in g){let m=g[y];if(Array.isArray(m)){const _=d?m.length-1:0;m=m[_]}m!==null&&(s[y]=m)}for(const y in x)s[y]=x[y]}}}return s}const to=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Fs=new Set(to),Rj=e=>t=>typeof t=="string"&&t.startsWith(e),Oj=Rj("--"),xI=Rj("var(--"),lg=e=>xI(e)?wI.test(e.split("/*")[0].trim()):!1,wI=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,$j=(e,t)=>t&&typeof e=="number"?t.transform(e):e,dr=(e,t,n)=>n>t?t:n<e?e:n,no={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},ya={...no,transform:e=>dr(0,1,e)},Al={...no,default:1},Ga=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),_r=Ga("deg"),In=Ga("%"),se=Ga("px"),bI=Ga("vh"),jI=Ga("vw"),t0={...In,parse:e=>In.parse(e)/100,transform:e=>In.transform(e*100)},SI={borderWidth:se,borderTopWidth:se,borderRightWidth:se,borderBottomWidth:se,borderLeftWidth:se,borderRadius:se,radius:se,borderTopLeftRadius:se,borderTopRightRadius:se,borderBottomRightRadius:se,borderBottomLeftRadius:se,width:se,maxWidth:se,height:se,maxHeight:se,top:se,right:se,bottom:se,left:se,padding:se,paddingTop:se,paddingRight:se,paddingBottom:se,paddingLeft:se,margin:se,marginTop:se,marginRight:se,marginBottom:se,marginLeft:se,backgroundPositionX:se,backgroundPositionY:se},kI={rotate:_r,rotateX:_r,rotateY:_r,rotateZ:_r,scale:Al,scaleX:Al,scaleY:Al,scaleZ:Al,skew:_r,skewX:_r,skewY:_r,distance:se,translateX:se,translateY:se,translateZ:se,x:se,y:se,z:se,perspective:se,transformPerspective:se,opacity:ya,originX:t0,originY:t0,originZ:se},n0={...no,transform:Math.round},cg={...SI,...kI,zIndex:n0,size:se,fillOpacity:ya,strokeOpacity:ya,numOctaves:n0},NI={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},EI=to.length;function CI(e,t,n){let r="",s=!0;for(let i=0;i<EI;i++){const o=to[i],l=e[o];if(l===void 0)continue;let c=!0;if(typeof l=="number"?c=l===(o.startsWith("scale")?1:0):c=parseFloat(l)===0,!c||n){const u=$j(l,cg[o]);if(!c){s=!1;const d=NI[o]||o;r+=`${d}(${u}) `}n&&(t[o]=u)}}return r=r.trim(),n?r=n(t,s?"":r):s&&(r="none"),r}function ug(e,t,n){const{style:r,vars:s,transformOrigin:i}=e;let o=!1,l=!1;for(const c in t){const u=t[c];if(Fs.has(c)){o=!0;continue}else if(Oj(c)){s[c]=u;continue}else{const d=$j(u,cg[c]);c.startsWith("origin")?(l=!0,i[c]=d):r[c]=d}}if(t.transform||(o||n?r.transform=CI(t,e.transform,n):r.transform&&(r.transform="none")),l){const{originX:c="50%",originY:u="50%",originZ:d=0}=i;r.transformOrigin=`${c} ${u} ${d}`}}const AI={offset:"stroke-dashoffset",array:"stroke-dasharray"},TI={offset:"strokeDashoffset",array:"strokeDasharray"};function PI(e,t,n=1,r=0,s=!0){e.pathLength=1;const i=s?AI:TI;e[i.offset]=se.transform(-r);const o=se.transform(t),l=se.transform(n);e[i.array]=`${o} ${l}`}function r0(e,t,n){return typeof e=="string"?e:se.transform(t+n*e)}function MI(e,t,n){const r=r0(t,e.x,e.width),s=r0(n,e.y,e.height);return`${r} ${s}`}function dg(e,{attrX:t,attrY:n,attrScale:r,originX:s,originY:i,pathLength:o,pathSpacing:l=1,pathOffset:c=0,...u},d,f){if(ug(e,u,f),d){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:h,style:p,dimensions:v}=e;h.transform&&(v&&(p.transform=h.transform),delete h.transform),v&&(s!==void 0||i!==void 0||p.transform)&&(p.transformOrigin=MI(v,s!==void 0?s:.5,i!==void 0?i:.5)),t!==void 0&&(h.x=t),n!==void 0&&(h.y=n),r!==void 0&&(h.scale=r),o!==void 0&&PI(h,o,l,c,!1)}const fg=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),Lj=()=>({...fg(),attrs:{}}),hg=e=>typeof e=="string"&&e.toLowerCase()==="svg";function Dj(e,{style:t,vars:n},r,s){Object.assign(e.style,t,s&&s.getProjectionStyles(r));for(const i in n)e.style.setProperty(i,n[i])}const zj=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function Vj(e,t,n,r){Dj(e,t,void 0,r);for(const s in t.attrs)e.setAttribute(zj.has(s)?s:sg(s),t.attrs[s])}const ru={};function II(e){Object.assign(ru,e)}function Fj(e,{layout:t,layoutId:n}){return Fs.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!ru[e]||e==="opacity")}function pg(e,t,n){var r;const{style:s}=e,i={};for(const o in s)(nt(s[o])||t.style&&nt(t.style[o])||Fj(o,e)||((r=n==null?void 0:n.getValue(o))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(i[o]=s[o]);return i}function Bj(e,t,n){const r=pg(e,t,n);for(const s in e)if(nt(e[s])||nt(t[s])){const i=to.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=e[s]}return r}function RI(e,t){try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}const s0=["x","y","width","height","cx","cy","r"],OI={useVisualState:Ij({scrapeMotionValuesFromProps:Bj,createRenderState:Lj,onUpdate:({props:e,prevProps:t,current:n,renderState:r,latestValues:s})=>{if(!n)return;let i=!!e.drag;if(!i){for(const l in s)if(Fs.has(l)){i=!0;break}}if(!i)return;let o=!t;if(t)for(let l=0;l<s0.length;l++){const c=s0[l];e[c]!==t[c]&&(o=!0)}o&&ke.read(()=>{RI(n,r),ke.render(()=>{dg(r,s,hg(n.tagName),e.transformTemplate),Vj(n,r)})})}})},$I={useVisualState:Ij({scrapeMotionValuesFromProps:pg,createRenderState:fg})};function Hj(e,t,n){for(const r in t)!nt(t[r])&&!Fj(r,n)&&(e[r]=t[r])}function LI({transformTemplate:e},t){return b.useMemo(()=>{const n=fg();return ug(n,t,e),Object.assign({},n.vars,n.style)},[t])}function DI(e,t){const n=e.style||{},r={};return Hj(r,n,e),Object.assign(r,LI(e,t)),r}function zI(e,t){const n={},r=DI(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}function VI(e,t,n,r){const s=b.useMemo(()=>{const i=Lj();return dg(i,t,hg(r),e.transformTemplate),{...i.attrs,style:{...i.style}}},[t]);if(e.style){const i={};Hj(i,e.style,e),s.style={...i,...s.style}}return s}function FI(e=!1){return(n,r,s,{latestValues:i},o)=>{const c=(og(n)?VI:zI)(r,i,o,n),u=nI(r,typeof n=="string",e),d=n!==b.Fragment?{...u,...c,ref:s}:{},{children:f}=r,h=b.useMemo(()=>nt(f)?f.get():f,[f]);return b.createElement(n,{...d,children:h})}}function BI(e,t){return function(r,{forwardMotionProps:s}={forwardMotionProps:!1}){const o={...og(r)?OI:$I,preloadedFeatures:e,useRender:FI(s),createVisualElement:t,Component:r};return dI(o)}}function Uj(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}function rd(e,t,n){const r=e.getProps();return ag(r,t,n!==void 0?n:r.custom,e)}function mg(e,t){return e?e[t]||e.default||e:void 0}const Wj=new Set(["width","height","top","left","right","bottom",...to]);let uc;function HI(){uc=void 0}const Rn={now:()=>(uc===void 0&&Rn.set(qe.isProcessing||XM.useManualTiming?qe.timestamp:performance.now()),uc),set:e=>{uc=e,queueMicrotask(HI)}};function gg(e,t){e.indexOf(t)===-1&&e.push(t)}function vg(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class yg{constructor(){this.subscriptions=[]}add(t){return gg(this.subscriptions,t),()=>vg(this.subscriptions,t)}notify(t,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](t,n,r);else for(let i=0;i<s;i++){const o=this.subscriptions[i];o&&o(t,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function Kj(e,t){return t?e*(1e3/t):0}const i0=30,UI=e=>!isNaN(parseFloat(e));class WI{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,s=!0)=>{const i=Rn.now();this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),s&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=Rn.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=UI(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new yg);const r=this.events[t].add(n);return t==="change"?()=>{r(),ke.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Rn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>i0)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,i0);return Kj(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function _a(e,t){return new WI(e,t)}function KI(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,_a(n))}function GI(e,t){const n=rd(e,t);let{transitionEnd:r={},transition:s={},...i}=n||{};i={...i,...r};for(const o in i){const l=vI(i[o]);KI(e,o,l)}}function qI(e){return!!(nt(e)&&e.add)}function Zh(e,t){const n=e.getValue("willChange");if(qI(n))return n.add(t)}function Gj(e){return e.props[Tj]}function _g(e){let t;return()=>(t===void 0&&(t=e()),t)}const YI=_g(()=>window.ScrollTimeline!==void 0);class XI{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,n){for(let r=0;r<this.animations.length;r++)this.animations[r][t]=n}attachTimeline(t,n){const r=this.animations.map(s=>{if(YI()&&s.attachTimeline)return s.attachTimeline(t);if(typeof n=="function")return n(s)});return()=>{r.forEach((s,i)=>{s&&s(),this.animations[i].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let n=0;n<this.animations.length;n++)t=Math.max(t,this.animations[n].duration);return t}runAll(t){this.animations.forEach(n=>n[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class QI extends XI{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}const nr=e=>e*1e3,rr=e=>e/1e3;function xg(e){return typeof e=="function"}function o0(e,t){e.timeline=t,e.onfinish=null}const wg=e=>Array.isArray(e)&&typeof e[0]=="number",ZI={linearEasing:void 0};function JI(e,t){const n=_g(e);return()=>{var r;return(r=ZI[t])!==null&&r!==void 0?r:n()}}const su=JI(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),zi=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},qj=(e,t,n=10)=>{let r="";const s=Math.max(Math.round(t/n),2);for(let i=0;i<s;i++)r+=e(zi(0,s-1,i))+", ";return`linear(${r.substring(0,r.length-2)})`};function Yj(e){return!!(typeof e=="function"&&su()||!e||typeof e=="string"&&(e in Jh||su())||wg(e)||Array.isArray(e)&&e.every(Yj))}const ko=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Jh={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ko([0,.65,.55,1]),circOut:ko([.55,0,1,.45]),backIn:ko([.31,.01,.66,-.59]),backOut:ko([.33,1.53,.69,.99])};function Xj(e,t){if(e)return typeof e=="function"&&su()?qj(e,t):wg(e)?ko(e):Array.isArray(e)?e.map(n=>Xj(n,t)||Jh.easeOut):Jh[e]}const Qj=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,eR=1e-7,tR=12;function nR(e,t,n,r,s){let i,o,l=0;do o=t+(n-t)/2,i=Qj(o,r,s)-e,i>0?n=o:t=o;while(Math.abs(i)>eR&&++l<tR);return o}function qa(e,t,n,r){if(e===t&&n===r)return Et;const s=i=>nR(i,0,1,e,n);return i=>i===0||i===1?i:Qj(s(i),t,r)}const Zj=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Jj=e=>t=>1-e(1-t),eS=qa(.33,1.53,.69,.99),bg=Jj(eS),tS=Zj(bg),nS=e=>(e*=2)<1?.5*bg(e):.5*(2-Math.pow(2,-10*(e-1))),jg=e=>1-Math.sin(Math.acos(e)),rS=Jj(jg),sS=Zj(jg),iS=e=>/^0[^.\s]+$/u.test(e);function rR(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||iS(e):!0}const Uo=e=>Math.round(e*1e5)/1e5,Sg=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function sR(e){return e==null}const iR=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,kg=(e,t)=>n=>!!(typeof n=="string"&&iR.test(n)&&n.startsWith(e)||t&&!sR(n)&&Object.prototype.hasOwnProperty.call(n,t)),oS=(e,t,n)=>r=>{if(typeof r!="string")return r;const[s,i,o,l]=r.match(Sg);return{[e]:parseFloat(s),[t]:parseFloat(i),[n]:parseFloat(o),alpha:l!==void 0?parseFloat(l):1}},oR=e=>dr(0,255,e),of={...no,transform:e=>Math.round(oR(e))},ds={test:kg("rgb","red"),parse:oS("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+of.transform(e)+", "+of.transform(t)+", "+of.transform(n)+", "+Uo(ya.transform(r))+")"};function aR(e){let t="",n="",r="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,r+=r,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const ep={test:kg("#"),parse:aR,transform:ds.transform},fi={test:kg("hsl","hue"),parse:oS("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+In.transform(Uo(t))+", "+In.transform(Uo(n))+", "+Uo(ya.transform(r))+")"},et={test:e=>ds.test(e)||ep.test(e)||fi.test(e),parse:e=>ds.test(e)?ds.parse(e):fi.test(e)?fi.parse(e):ep.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?ds.transform(e):fi.transform(e)},lR=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function cR(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(Sg))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(lR))===null||n===void 0?void 0:n.length)||0)>0}const aS="number",lS="color",uR="var",dR="var(",a0="${}",fR=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function xa(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},s=[];let i=0;const l=t.replace(fR,c=>(et.test(c)?(r.color.push(i),s.push(lS),n.push(et.parse(c))):c.startsWith(dR)?(r.var.push(i),s.push(uR),n.push(c)):(r.number.push(i),s.push(aS),n.push(parseFloat(c))),++i,a0)).split(a0);return{values:n,split:l,indexes:r,types:s}}function cS(e){return xa(e).values}function uS(e){const{split:t,types:n}=xa(e),r=t.length;return s=>{let i="";for(let o=0;o<r;o++)if(i+=t[o],s[o]!==void 0){const l=n[o];l===aS?i+=Uo(s[o]):l===lS?i+=et.transform(s[o]):i+=s[o]}return i}}const hR=e=>typeof e=="number"?0:e;function pR(e){const t=cS(e);return uS(e)(t.map(hR))}const Hr={test:cR,parse:cS,createTransformer:uS,getAnimatableNone:pR},mR=new Set(["brightness","contrast","saturate","opacity"]);function gR(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(Sg)||[];if(!r)return e;const s=n.replace(r,"");let i=mR.has(t)?1:0;return r!==n&&(i*=100),t+"("+i+s+")"}const vR=/\b([a-z-]*)\(.*?\)/gu,tp={...Hr,getAnimatableNone:e=>{const t=e.match(vR);return t?t.map(gR).join(" "):e}},yR={...cg,color:et,backgroundColor:et,outlineColor:et,fill:et,stroke:et,borderColor:et,borderTopColor:et,borderRightColor:et,borderBottomColor:et,borderLeftColor:et,filter:tp,WebkitFilter:tp},Ng=e=>yR[e];function dS(e,t){let n=Ng(e);return n!==tp&&(n=Hr),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const _R=new Set(["auto","none","0"]);function xR(e,t,n){let r=0,s;for(;r<e.length&&!s;){const i=e[r];typeof i=="string"&&!_R.has(i)&&xa(i).values.length&&(s=e[r]),r++}if(s&&n)for(const i of t)e[i]=dS(n,s)}const l0=e=>e===no||e===se,c0=(e,t)=>parseFloat(e.split(", ")[t]),u0=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const s=r.match(/^matrix3d\((.+)\)$/u);if(s)return c0(s[1],t);{const i=r.match(/^matrix\((.+)\)$/u);return i?c0(i[1],e):0}},wR=new Set(["x","y","z"]),bR=to.filter(e=>!wR.has(e));function jR(e){const t=[];return bR.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const Vi={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:u0(4,13),y:u0(5,14)};Vi.translateX=Vi.x;Vi.translateY=Vi.y;const gs=new Set;let np=!1,rp=!1;function fS(){if(rp){const e=Array.from(gs).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const s=jR(r);s.length&&(n.set(r,s),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([i,o])=>{var l;(l=r.getValue(i))===null||l===void 0||l.set(o)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}rp=!1,np=!1,gs.forEach(e=>e.complete()),gs.clear()}function hS(){gs.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(rp=!0)})}function SR(){hS(),fS()}class Eg{constructor(t,n,r,s,i,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=s,this.element=i,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(gs.add(this),np||(np=!0,ke.read(hS),ke.resolveKeyframes(fS))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:s}=this;for(let i=0;i<t.length;i++)if(t[i]===null)if(i===0){const o=s==null?void 0:s.get(),l=t[t.length-1];if(o!==void 0)t[0]=o;else if(r&&n){const c=r.readValue(n,l);c!=null&&(t[0]=c)}t[0]===void 0&&(t[0]=l),s&&o===void 0&&s.set(t[0])}else t[i]=t[i-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),gs.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,gs.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const pS=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),kR=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function NR(e){const t=kR.exec(e);if(!t)return[,];const[,n,r,s]=t;return[`--${n??r}`,s]}function mS(e,t,n=1){const[r,s]=NR(e);if(!r)return;const i=window.getComputedStyle(t).getPropertyValue(r);if(i){const o=i.trim();return pS(o)?parseFloat(o):o}return lg(s)?mS(s,t,n+1):s}const gS=e=>t=>t.test(e),ER={test:e=>e==="auto",parse:e=>e},vS=[no,se,In,_r,jI,bI,ER],d0=e=>vS.find(gS(e));class yS extends Eg{constructor(t,n,r,s,i){super(t,n,r,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c<t.length;c++){let u=t[c];if(typeof u=="string"&&(u=u.trim(),lg(u))){const d=mS(u,n.current);d!==void 0&&(t[c]=d),c===t.length-1&&(this.finalKeyframe=u)}}if(this.resolveNoneKeyframes(),!Wj.has(r)||t.length!==2)return;const[s,i]=t,o=d0(s),l=d0(i);if(o!==l)if(l0(o)&&l0(l))for(let c=0;c<t.length;c++){const u=t[c];typeof u=="string"&&(t[c]=parseFloat(u))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,r=[];for(let s=0;s<t.length;s++)rR(t[s])&&r.push(s);r.length&&xR(t,r,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Vi[r](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&t.getValue(r,s).jump(s,!1)}measureEndState(){var t;const{element:n,name:r,unresolvedKeyframes:s}=this;if(!n||!n.current)return;const i=n.getValue(r);i&&i.jump(this.measuredOrigin,!1);const o=s.length-1,l=s[o];s[o]=Vi[r](n.measureViewportBox(),window.getComputedStyle(n.current)),l!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=l),!((t=this.removedTransforms)===null||t===void 0)&&t.length&&this.removedTransforms.forEach(([c,u])=>{n.getValue(c).set(u)}),this.resolveNoneKeyframes()}}const f0=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Hr.test(e)||e==="0")&&!e.startsWith("url("));function CR(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function AR(e,t,n,r){const s=e[0];if(s===null)return!1;if(t==="display"||t==="visibility")return!0;const i=e[e.length-1],o=f0(s,t),l=f0(i,t);return!o||!l?!1:CR(e)||(n==="spring"||xg(n))&&r}const TR=e=>e!==null;function sd(e,{repeat:t,repeatType:n="loop"},r){const s=e.filter(TR),i=t&&n!=="loop"&&t%2===1?0:s.length-1;return!i||r===void 0?s[i]:r}const PR=40;class _S{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:o="loop",...l}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Rn.now(),this.options={autoplay:t,delay:n,type:r,repeat:s,repeatDelay:i,repeatType:o,...l},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>PR?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&SR(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=Rn.now(),this.hasAttemptedResolve=!0;const{name:r,type:s,velocity:i,delay:o,onComplete:l,onUpdate:c,isGenerator:u}=this.options;if(!u&&!AR(t,r,s,i))if(o)this.options.duration=0;else{c&&c(sd(t,this.options,n)),l&&l(),this.resolveFinishedPromise();return}const d=this.initPlayback(t,n);d!==!1&&(this._resolved={keyframes:t,finalKeyframe:n,...d},this.onPostResolved())}onPostResolved(){}then(t,n){return this.currentFinishedPromise.then(t,n)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}}const sp=2e4;function xS(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t<sp;)t+=n,r=e.next(t);return t>=sp?1/0:t}const Te=(e,t,n)=>e+(t-e)*n;function af(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function MR({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let s=0,i=0,o=0;if(!t)s=i=o=n;else{const l=n<.5?n*(1+t):n+t-n*t,c=2*n-l;s=af(c,l,e+1/3),i=af(c,l,e),o=af(c,l,e-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:r}}function iu(e,t){return n=>n>0?t:e}const lf=(e,t,n)=>{const r=e*e,s=n*(t*t-r)+r;return s<0?0:Math.sqrt(s)},IR=[ep,ds,fi],RR=e=>IR.find(t=>t.test(e));function h0(e){const t=RR(e);if(!t)return!1;let n=t.parse(e);return t===fi&&(n=MR(n)),n}const p0=(e,t)=>{const n=h0(e),r=h0(t);if(!n||!r)return iu(e,t);const s={...n};return i=>(s.red=lf(n.red,r.red,i),s.green=lf(n.green,r.green,i),s.blue=lf(n.blue,r.blue,i),s.alpha=Te(n.alpha,r.alpha,i),ds.transform(s))},OR=(e,t)=>n=>t(e(n)),Ya=(...e)=>e.reduce(OR),ip=new Set(["none","hidden"]);function $R(e,t){return ip.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function LR(e,t){return n=>Te(e,t,n)}function Cg(e){return typeof e=="number"?LR:typeof e=="string"?lg(e)?iu:et.test(e)?p0:VR:Array.isArray(e)?wS:typeof e=="object"?et.test(e)?p0:DR:iu}function wS(e,t){const n=[...e],r=n.length,s=e.map((i,o)=>Cg(i)(i,t[o]));return i=>{for(let o=0;o<r;o++)n[o]=s[o](i);return n}}function DR(e,t){const n={...e,...t},r={};for(const s in n)e[s]!==void 0&&t[s]!==void 0&&(r[s]=Cg(e[s])(e[s],t[s]));return s=>{for(const i in r)n[i]=r[i](s);return n}}function zR(e,t){var n;const r=[],s={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){const o=t.types[i],l=e.indexes[o][s[o]],c=(n=e.values[l])!==null&&n!==void 0?n:0;r[i]=c,s[o]++}return r}const VR=(e,t)=>{const n=Hr.createTransformer(t),r=xa(e),s=xa(t);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?ip.has(e)&&!s.values.length||ip.has(t)&&!r.values.length?$R(e,t):Ya(wS(zR(r,s),s.values),n):iu(e,t)};function bS(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Te(e,t,n):Cg(e)(e,t)}const FR=5;function jS(e,t,n){const r=Math.max(t-FR,0);return Kj(n-e(r),t-r)}const Oe={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},cf=.001;function BR({duration:e=Oe.duration,bounce:t=Oe.bounce,velocity:n=Oe.velocity,mass:r=Oe.mass}){let s,i,o=1-t;o=dr(Oe.minDamping,Oe.maxDamping,o),e=dr(Oe.minDuration,Oe.maxDuration,rr(e)),o<1?(s=u=>{const d=u*o,f=d*e,h=d-n,p=op(u,o),v=Math.exp(-f);return cf-h/p*v},i=u=>{const f=u*o*e,h=f*n+n,p=Math.pow(o,2)*Math.pow(u,2)*e,v=Math.exp(-f),x=op(Math.pow(u,2),o);return(-s(u)+cf>0?-1:1)*((h-p)*v)/x}):(s=u=>{const d=Math.exp(-u*e),f=(u-n)*e+1;return-cf+d*f},i=u=>{const d=Math.exp(-u*e),f=(n-u)*(e*e);return d*f});const l=5/e,c=UR(s,i,l);if(e=nr(e),isNaN(c))return{stiffness:Oe.stiffness,damping:Oe.damping,duration:e};{const u=Math.pow(c,2)*r;return{stiffness:u,damping:o*2*Math.sqrt(r*u),duration:e}}}const HR=12;function UR(e,t,n){let r=n;for(let s=1;s<HR;s++)r=r-e(r)/t(r);return r}function op(e,t){return e*Math.sqrt(1-t*t)}const WR=["duration","bounce"],KR=["stiffness","damping","mass"];function m0(e,t){return t.some(n=>e[n]!==void 0)}function GR(e){let t={velocity:Oe.velocity,stiffness:Oe.stiffness,damping:Oe.damping,mass:Oe.mass,isResolvedFromDuration:!1,...e};if(!m0(e,KR)&&m0(e,WR))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,i=2*dr(.05,1,1-(e.bounce||0))*Math.sqrt(s);t={...t,mass:Oe.mass,stiffness:s,damping:i}}else{const n=BR(e);t={...t,...n,mass:Oe.mass},t.isResolvedFromDuration=!0}return t}function SS(e=Oe.visualDuration,t=Oe.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:s}=n;const i=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],l={done:!1,value:i},{stiffness:c,damping:u,mass:d,duration:f,velocity:h,isResolvedFromDuration:p}=GR({...n,velocity:-rr(n.velocity||0)}),v=h||0,x=u/(2*Math.sqrt(c*d)),w=o-i,g=rr(Math.sqrt(c/d)),y=Math.abs(w)<5;r||(r=y?Oe.restSpeed.granular:Oe.restSpeed.default),s||(s=y?Oe.restDelta.granular:Oe.restDelta.default);let m;if(x<1){const j=op(g,x);m=N=>{const k=Math.exp(-x*g*N);return o-k*((v+x*g*w)/j*Math.sin(j*N)+w*Math.cos(j*N))}}else if(x===1)m=j=>o-Math.exp(-g*j)*(w+(v+g*w)*j);else{const j=g*Math.sqrt(x*x-1);m=N=>{const k=Math.exp(-x*g*N),S=Math.min(j*N,300);return o-k*((v+x*g*w)*Math.sinh(S)+j*w*Math.cosh(S))/j}}const _={calculatedDuration:p&&f||null,next:j=>{const N=m(j);if(p)l.done=j>=f;else{let k=0;x<1&&(k=j===0?nr(v):jS(m,j,N));const S=Math.abs(k)<=r,P=Math.abs(o-N)<=s;l.done=S&&P}return l.value=l.done?o:N,l},toString:()=>{const j=Math.min(xS(_),sp),N=qj(k=>_.next(j*k).value,j,30);return j+"ms "+N}};return _}function g0({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:o,min:l,max:c,restDelta:u=.5,restSpeed:d}){const f=e[0],h={done:!1,value:f},p=S=>l!==void 0&&S<l||c!==void 0&&S>c,v=S=>l===void 0?c:c===void 0||Math.abs(l-S)<Math.abs(c-S)?l:c;let x=n*t;const w=f+x,g=o===void 0?w:o(w);g!==w&&(x=g-f);const y=S=>-x*Math.exp(-S/r),m=S=>g+y(S),_=S=>{const P=y(S),$=m(S);h.done=Math.abs(P)<=u,h.value=h.done?g:$};let j,N;const k=S=>{p(h.value)&&(j=S,N=SS({keyframes:[h.value,v(h.value)],velocity:jS(m,S,h.value),damping:s,stiffness:i,restDelta:u,restSpeed:d}))};return k(0),{calculatedDuration:null,next:S=>{let P=!1;return!N&&j===void 0&&(P=!0,_(S),k(S)),j!==void 0&&S>=j?N.next(S-j):(!P&&_(S),h)}}}const qR=qa(.42,0,1,1),YR=qa(0,0,.58,1),kS=qa(.42,0,.58,1),XR=e=>Array.isArray(e)&&typeof e[0]!="number",QR={linear:Et,easeIn:qR,easeInOut:kS,easeOut:YR,circIn:jg,circInOut:sS,circOut:rS,backIn:bg,backInOut:tS,backOut:eS,anticipate:nS},v0=e=>{if(wg(e)){kj(e.length===4);const[t,n,r,s]=e;return qa(t,n,r,s)}else if(typeof e=="string")return QR[e];return e};function ZR(e,t,n){const r=[],s=n||bS,i=e.length-1;for(let o=0;o<i;o++){let l=s(e[o],e[o+1]);if(t){const c=Array.isArray(t)?t[o]||Et:t;l=Ya(c,l)}r.push(l)}return r}function JR(e,t,{clamp:n=!0,ease:r,mixer:s}={}){const i=e.length;if(kj(i===t.length),i===1)return()=>t[0];if(i===2&&t[0]===t[1])return()=>t[1];const o=e[0]===e[1];e[0]>e[i-1]&&(e=[...e].reverse(),t=[...t].reverse());const l=ZR(t,r,s),c=l.length,u=d=>{if(o&&d<e[0])return t[0];let f=0;if(c>1)for(;f<e.length-2&&!(d<e[f+1]);f++);const h=zi(e[f],e[f+1],d);return l[f](h)};return n?d=>u(dr(e[0],e[i-1],d)):u}function eO(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const s=zi(0,t,r);e.push(Te(n,1,s))}}function tO(e){const t=[0];return eO(t,e.length-1),t}function nO(e,t){return e.map(n=>n*t)}function rO(e,t){return e.map(()=>t||kS).splice(0,e.length-1)}function ou({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const s=XR(r)?r.map(v0):v0(r),i={done:!1,value:t[0]},o=nO(n&&n.length===t.length?n:tO(t),e),l=JR(o,t,{ease:Array.isArray(s)?s:rO(t,s)});return{calculatedDuration:e,next:c=>(i.value=l(c),i.done=c>=e,i)}}const sO=e=>{const t=({timestamp:n})=>e(n);return{start:()=>ke.update(t,!0),stop:()=>Br(t),now:()=>qe.isProcessing?qe.timestamp:Rn.now()}},iO={decay:g0,inertia:g0,tween:ou,keyframes:ou,spring:SS},oO=e=>e/100;class Ag extends _S{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:c}=this.options;c&&c()};const{name:n,motionValue:r,element:s,keyframes:i}=this.options,o=(s==null?void 0:s.KeyframeResolver)||Eg,l=(c,u)=>this.onKeyframesResolved(c,u);this.resolver=new o(i,l,n,r,s),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:n="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:o=0}=this.options,l=xg(n)?n:iO[n]||ou;let c,u;l!==ou&&typeof t[0]!="number"&&(c=Ya(oO,bS(t[0],t[1])),t=[0,100]);const d=l({...this.options,keyframes:t});i==="mirror"&&(u=l({...this.options,keyframes:[...t].reverse(),velocity:-o})),d.calculatedDuration===null&&(d.calculatedDuration=xS(d));const{calculatedDuration:f}=d,h=f+s,p=h*(r+1)-s;return{generator:d,mirroredGenerator:u,mapPercentToKeyframes:c,calculatedDuration:f,resolvedDuration:h,totalDuration:p}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!t?this.pause():this.state=this.pendingPlayState}tick(t,n=!1){const{resolved:r}=this;if(!r){const{keyframes:S}=this.options;return{done:!0,value:S[S.length-1]}}const{finalKeyframe:s,generator:i,mirroredGenerator:o,mapPercentToKeyframes:l,keyframes:c,calculatedDuration:u,totalDuration:d,resolvedDuration:f}=r;if(this.startTime===null)return i.next(0);const{delay:h,repeat:p,repeatType:v,repeatDelay:x,onUpdate:w}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-d/this.speed,this.startTime)),n?this.currentTime=t:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const g=this.currentTime-h*(this.speed>=0?1:-1),y=this.speed>=0?g<0:g>d;this.currentTime=Math.max(g,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let m=this.currentTime,_=i;if(p){const S=Math.min(this.currentTime,d)/f;let P=Math.floor(S),$=S%1;!$&&S>=1&&($=1),$===1&&P--,P=Math.min(P,p+1),!!(P%2)&&(v==="reverse"?($=1-$,x&&($-=x/f)):v==="mirror"&&(_=o)),m=dr(0,1,$)*f}const j=y?{done:!1,value:c[0]}:_.next(m);l&&(j.value=l(j.value));let{done:N}=j;!y&&u!==null&&(N=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const k=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&N);return k&&s!==void 0&&(j.value=sd(c,this.options,s)),w&&w(j.value),k&&this.finish(),j}get duration(){const{resolved:t}=this;return t?rr(t.calculatedDuration):0}get time(){return rr(this.currentTime)}set time(t){t=nr(t),this.currentTime=t,this.holdTime!==null||this.speed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=rr(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=sO,onPlay:n,startTime:r}=this.options;this.driver||(this.driver=t(i=>this.tick(i))),n&&n();const s=this.driver.now();this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=s):this.startTime=r??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(t=this.currentTime)!==null&&t!==void 0?t:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const aO=new Set(["opacity","clipPath","filter","transform"]);function lO(e,t,n,{delay:r=0,duration:s=300,repeat:i=0,repeatType:o="loop",ease:l="easeInOut",times:c}={}){const u={[t]:n};c&&(u.offset=c);const d=Xj(l,s);return Array.isArray(d)&&(u.easing=d),e.animate(u,{delay:r,duration:s,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"})}const cO=_g(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),au=10,uO=2e4;function dO(e){return xg(e.type)||e.type==="spring"||!Yj(e.ease)}function fO(e,t){const n=new Ag({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:e[0]};const s=[];let i=0;for(;!r.done&&i<uO;)r=n.sample(i),s.push(r.value),i+=au;return{times:void 0,keyframes:s,duration:i-au,ease:"linear"}}const NS={anticipate:nS,backInOut:tS,circInOut:sS};function hO(e){return e in NS}class y0 extends _S{constructor(t){super(t);const{name:n,motionValue:r,element:s,keyframes:i}=this.options;this.resolver=new yS(i,(o,l)=>this.onKeyframesResolved(o,l),n,r,s),this.resolver.scheduleResolve()}initPlayback(t,n){let{duration:r=300,times:s,ease:i,type:o,motionValue:l,name:c,startTime:u}=this.options;if(!l.owner||!l.owner.current)return!1;if(typeof i=="string"&&su()&&hO(i)&&(i=NS[i]),dO(this.options)){const{onComplete:f,onUpdate:h,motionValue:p,element:v,...x}=this.options,w=fO(t,x);t=w.keyframes,t.length===1&&(t[1]=t[0]),r=w.duration,s=w.times,i=w.ease,o="keyframes"}const d=lO(l.owner.current,c,t,{...this.options,duration:r,times:s,ease:i});return d.startTime=u??this.calcStartTime(),this.pendingTimeline?(o0(d,this.pendingTimeline),this.pendingTimeline=void 0):d.onfinish=()=>{const{onComplete:f}=this.options;l.set(sd(t,this.options,n)),f&&f(),this.cancel(),this.resolveFinishedPromise()},{animation:d,duration:r,times:s,type:o,ease:i,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return rr(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return rr(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=nr(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:n}=t;return n.playbackRate}set speed(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:n}=t;return n.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:n}=t;return n.startTime}attachTimeline(t){if(!this._resolved)this.pendingTimeline=t;else{const{resolved:n}=this;if(!n)return Et;const{animation:r}=n;o0(r,t)}return Et}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:n,keyframes:r,duration:s,type:i,ease:o,times:l}=t;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:u,onUpdate:d,onComplete:f,element:h,...p}=this.options,v=new Ag({...p,keyframes:r,duration:s,type:i,ease:o,times:l,isGenerator:!0}),x=nr(this.time);u.setWithVelocity(v.sample(x-au).value,v.sample(x).value,au)}const{onStop:c}=this.options;c&&c(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:n,name:r,repeatDelay:s,repeatType:i,damping:o,type:l}=t;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=n.owner.getProps();return cO()&&r&&aO.has(r)&&!c&&!u&&!s&&i!=="mirror"&&o!==0&&l!=="inertia"}}const pO={type:"spring",stiffness:500,damping:25,restSpeed:10},mO=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),gO={type:"keyframes",duration:.8},vO={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},yO=(e,{keyframes:t})=>t.length>2?gO:Fs.has(e)?e.startsWith("scale")?mO(t[1]):pO:vO;function _O({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:s,repeat:i,repeatType:o,repeatDelay:l,from:c,elapsed:u,...d}){return!!Object.keys(d).length}const Tg=(e,t,n,r={},s,i)=>o=>{const l=mg(r,e)||{},c=l.delay||r.delay||0;let{elapsed:u=0}=r;u=u-nr(c);let d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-u,onUpdate:h=>{t.set(h),l.onUpdate&&l.onUpdate(h)},onComplete:()=>{o(),l.onComplete&&l.onComplete()},name:e,motionValue:t,element:i?void 0:s};_O(l)||(d={...d,...yO(e,d)}),d.duration&&(d.duration=nr(d.duration)),d.repeatDelay&&(d.repeatDelay=nr(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let f=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(f=!0)),f&&!i&&t.get()!==void 0){const h=sd(d.keyframes,l);if(h!==void 0)return ke.update(()=>{d.onUpdate(h),d.onComplete()}),new QI([])}return!i&&y0.supports(d)?new y0(d):new Ag(d)};function xO({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function ES(e,t,{delay:n=0,transitionOverride:r,type:s}={}){var i;let{transition:o=e.getDefaultTransition(),transitionEnd:l,...c}=t;r&&(o=r);const u=[],d=s&&e.animationState&&e.animationState.getState()[s];for(const f in c){const h=e.getValue(f,(i=e.latestValues[f])!==null&&i!==void 0?i:null),p=c[f];if(p===void 0||d&&xO(d,f))continue;const v={delay:n,...mg(o||{},f)};let x=!1;if(window.MotionHandoffAnimation){const g=Gj(e);if(g){const y=window.MotionHandoffAnimation(g,f,ke);y!==null&&(v.startTime=y,x=!0)}}Zh(e,f),h.start(Tg(f,h,p,e.shouldReduceMotion&&Wj.has(f)?{type:!1}:v,e,x));const w=h.animation;w&&u.push(w)}return l&&Promise.all(u).then(()=>{ke.update(()=>{l&&GI(e,l)})}),u}function ap(e,t,n={}){var r;const s=rd(e,t,n.type==="exit"?(r=e.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:i=e.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const o=s?()=>Promise.all(ES(e,s,n)):()=>Promise.resolve(),l=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:h}=i;return wO(e,t,d+u,f,h,n)}:()=>Promise.resolve(),{when:c}=i;if(c){const[u,d]=c==="beforeChildren"?[o,l]:[l,o];return u().then(()=>d())}else return Promise.all([o(),l(n.delay)])}function wO(e,t,n=0,r=0,s=1,i){const o=[],l=(e.variantChildren.size-1)*r,c=s===1?(u=0)=>u*r:(u=0)=>l-u*r;return Array.from(e.variantChildren).sort(bO).forEach((u,d)=>{u.notify("AnimationStart",t),o.push(ap(u,t,{...i,delay:n+c(d)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(o)}function bO(e,t){return e.sortNodePosition(t)}function jO(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const s=t.map(i=>ap(e,i,n));r=Promise.all(s)}else if(typeof t=="string")r=ap(e,t,n);else{const s=typeof t=="function"?rd(e,t,n.custom):t;r=Promise.all(ES(e,s,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const SO=rg.length;function CS(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?CS(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<SO;n++){const r=rg[n],s=e.props[r];(va(s)||s===!1)&&(t[r]=s)}return t}const kO=[...ng].reverse(),NO=ng.length;function EO(e){return t=>Promise.all(t.map(({animation:n,options:r})=>jO(e,n,r)))}function CO(e){let t=EO(e),n=_0(),r=!0;const s=c=>(u,d)=>{var f;const h=rd(e,d,c==="exit"?(f=e.presenceContext)===null||f===void 0?void 0:f.custom:void 0);if(h){const{transition:p,transitionEnd:v,...x}=h;u={...u,...x,...v}}return u};function i(c){t=c(e)}function o(c){const{props:u}=e,d=CS(e.parent)||{},f=[],h=new Set;let p={},v=1/0;for(let w=0;w<NO;w++){const g=kO[w],y=n[g],m=u[g]!==void 0?u[g]:d[g],_=va(m),j=g===c?y.isActive:null;j===!1&&(v=w);let N=m===d[g]&&m!==u[g]&&_;if(N&&r&&e.manuallyAnimateOnMount&&(N=!1),y.protectedKeys={...p},!y.isActive&&j===null||!m&&!y.prevProp||td(m)||typeof m=="boolean")continue;const k=AO(y.prevProp,m);let S=k||g===c&&y.isActive&&!N&&_||w>v&&_,P=!1;const $=Array.isArray(m)?m:[m];let D=$.reduce(s(g),{});j===!1&&(D={});const{prevResolvedValues:I={}}=y,O={...I,...D},E=M=>{S=!0,h.has(M)&&(P=!0,h.delete(M)),y.needsAnimating[M]=!0;const T=e.getValue(M);T&&(T.liveStyle=!1)};for(const M in O){const T=D[M],R=I[M];if(p.hasOwnProperty(M))continue;let B=!1;Qh(T)&&Qh(R)?B=!Uj(T,R):B=T!==R,B?T!=null?E(M):h.add(M):T!==void 0&&h.has(M)?E(M):y.protectedKeys[M]=!0}y.prevProp=m,y.prevResolvedValues=D,y.isActive&&(p={...p,...D}),r&&e.blockInitialAnimation&&(S=!1),S&&(!(N&&k)||P)&&f.push(...$.map(M=>({animation:M,options:{type:g}})))}if(h.size){const w={};h.forEach(g=>{const y=e.getBaseTarget(g),m=e.getValue(g);m&&(m.liveStyle=!0),w[g]=y??null}),f.push({animation:w})}let x=!!f.length;return r&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(x=!1),r=!1,x?t(f):Promise.resolve()}function l(c,u){var d;if(n[c].isActive===u)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(h=>{var p;return(p=h.animationState)===null||p===void 0?void 0:p.setActive(c,u)}),n[c].isActive=u;const f=o(c);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:o,setActive:l,setAnimateFunction:i,getState:()=>n,reset:()=>{n=_0(),r=!0}}}function AO(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Uj(t,e):!1}function Jr(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function _0(){return{animate:Jr(!0),whileInView:Jr(),whileHover:Jr(),whileTap:Jr(),whileDrag:Jr(),whileFocus:Jr(),exit:Jr()}}class Yr{constructor(t){this.isMounted=!1,this.node=t}update(){}}class TO extends Yr{constructor(t){super(t),t.animationState||(t.animationState=CO(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();td(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)===null||t===void 0||t.call(this)}}let PO=0;class MO extends Yr{constructor(){super(...arguments),this.id=PO++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const s=this.node.animationState.setActive("exit",!t);n&&!t&&s.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const IO={animation:{Feature:TO},exit:{Feature:MO}},Zt={x:!1,y:!1};function AS(){return Zt.x||Zt.y}function RO(e){return e==="x"||e==="y"?Zt[e]?null:(Zt[e]=!0,()=>{Zt[e]=!1}):Zt.x||Zt.y?null:(Zt.x=Zt.y=!0,()=>{Zt.x=Zt.y=!1})}const Pg=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function wa(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function Xa(e){return{point:{x:e.pageX,y:e.pageY}}}const OO=e=>t=>Pg(t)&&e(t,Xa(t));function Wo(e,t,n,r){return wa(e,t,OO(n),r)}const x0=(e,t)=>Math.abs(e-t);function $O(e,t){const n=x0(e.x,t.x),r=x0(e.y,t.y);return Math.sqrt(n**2+r**2)}class TS{constructor(t,n,{transformPagePoint:r,contextWindow:s,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=df(this.lastMoveEventInfo,this.history),h=this.startEvent!==null,p=$O(f.offset,{x:0,y:0})>=3;if(!h&&!p)return;const{point:v}=f,{timestamp:x}=qe;this.history.push({...v,timestamp:x});const{onStart:w,onMove:g}=this.handlers;h||(w&&w(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),g&&g(this.lastMoveEvent,f)},this.handlePointerMove=(f,h)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=uf(h,this.transformPagePoint),ke.update(this.updatePoint,!0)},this.handlePointerUp=(f,h)=>{this.end();const{onEnd:p,onSessionEnd:v,resumeAnimation:x}=this.handlers;if(this.dragSnapToOrigin&&x&&x(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const w=df(f.type==="pointercancel"?this.lastMoveEventInfo:uf(h,this.transformPagePoint),this.history);this.startEvent&&p&&p(f,w),v&&v(f,w)},!Pg(t))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.contextWindow=s||window;const o=Xa(t),l=uf(o,this.transformPagePoint),{point:c}=l,{timestamp:u}=qe;this.history=[{...c,timestamp:u}];const{onSessionStart:d}=n;d&&d(t,df(l,this.history)),this.removeListeners=Ya(Wo(this.contextWindow,"pointermove",this.handlePointerMove),Wo(this.contextWindow,"pointerup",this.handlePointerUp),Wo(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Br(this.updatePoint)}}function uf(e,t){return t?{point:t(e.point)}:e}function w0(e,t){return{x:e.x-t.x,y:e.y-t.y}}function df({point:e},t){return{point:e,delta:w0(e,PS(t)),offset:w0(e,LO(t)),velocity:DO(t,.1)}}function LO(e){return e[0]}function PS(e){return e[e.length-1]}function DO(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const s=PS(e);for(;n>=0&&(r=e[n],!(s.timestamp-r.timestamp>nr(t)));)n--;if(!r)return{x:0,y:0};const i=rr(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const o={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}const MS=1e-4,zO=1-MS,VO=1+MS,IS=.01,FO=0-IS,BO=0+IS;function At(e){return e.max-e.min}function HO(e,t,n){return Math.abs(e-t)<=n}function b0(e,t,n,r=.5){e.origin=r,e.originPoint=Te(t.min,t.max,e.origin),e.scale=At(n)/At(t),e.translate=Te(n.min,n.max,e.origin)-e.originPoint,(e.scale>=zO&&e.scale<=VO||isNaN(e.scale))&&(e.scale=1),(e.translate>=FO&&e.translate<=BO||isNaN(e.translate))&&(e.translate=0)}function Ko(e,t,n,r){b0(e.x,t.x,n.x,r?r.originX:void 0),b0(e.y,t.y,n.y,r?r.originY:void 0)}function j0(e,t,n){e.min=n.min+t.min,e.max=e.min+At(t)}function UO(e,t,n){j0(e.x,t.x,n.x),j0(e.y,t.y,n.y)}function S0(e,t,n){e.min=t.min-n.min,e.max=e.min+At(t)}function Go(e,t,n){S0(e.x,t.x,n.x),S0(e.y,t.y,n.y)}function WO(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?Te(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?Te(n,e,r.max):Math.min(e,n)),e}function k0(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function KO(e,{top:t,left:n,bottom:r,right:s}){return{x:k0(e.x,n,s),y:k0(e.y,t,r)}}function N0(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function GO(e,t){return{x:N0(e.x,t.x),y:N0(e.y,t.y)}}function qO(e,t){let n=.5;const r=At(e),s=At(t);return s>r?n=zi(t.min,t.max-r,e.min):r>s&&(n=zi(e.min,e.max-s,t.min)),dr(0,1,n)}function YO(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const lp=.35;function XO(e=lp){return e===!1?e=0:e===!0&&(e=lp),{x:E0(e,"left","right"),y:E0(e,"top","bottom")}}function E0(e,t,n){return{min:C0(e,t),max:C0(e,n)}}function C0(e,t){return typeof e=="number"?e:e[t]||0}const A0=()=>({translate:0,scale:1,origin:0,originPoint:0}),hi=()=>({x:A0(),y:A0()}),T0=()=>({min:0,max:0}),Le=()=>({x:T0(),y:T0()});function Lt(e){return[e("x"),e("y")]}function RS({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function QO({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function ZO(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function ff(e){return e===void 0||e===1}function cp({scale:e,scaleX:t,scaleY:n}){return!ff(e)||!ff(t)||!ff(n)}function rs(e){return cp(e)||OS(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function OS(e){return P0(e.x)||P0(e.y)}function P0(e){return e&&e!=="0%"}function lu(e,t,n){const r=e-n,s=t*r;return n+s}function M0(e,t,n,r,s){return s!==void 0&&(e=lu(e,s,r)),lu(e,n,r)+t}function up(e,t=0,n=1,r,s){e.min=M0(e.min,t,n,r,s),e.max=M0(e.max,t,n,r,s)}function $S(e,{x:t,y:n}){up(e.x,t.translate,t.scale,t.originPoint),up(e.y,n.translate,n.scale,n.originPoint)}const I0=.999999999999,R0=1.0000000000001;function JO(e,t,n,r=!1){const s=n.length;if(!s)return;t.x=t.y=1;let i,o;for(let l=0;l<s;l++){i=n[l],o=i.projectionDelta;const{visualElement:c}=i.options;c&&c.props.style&&c.props.style.display==="contents"||(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&mi(e,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),o&&(t.x*=o.x.scale,t.y*=o.y.scale,$S(e,o)),r&&rs(i.latestValues)&&mi(e,i.latestValues))}t.x<R0&&t.x>I0&&(t.x=1),t.y<R0&&t.y>I0&&(t.y=1)}function pi(e,t){e.min=e.min+t,e.max=e.max+t}function O0(e,t,n,r,s=.5){const i=Te(e.min,e.max,s);up(e,t,n,i,r)}function mi(e,t){O0(e.x,t.x,t.scaleX,t.scale,t.originX),O0(e.y,t.y,t.scaleY,t.scale,t.originY)}function LS(e,t){return RS(ZO(e.getBoundingClientRect(),t))}function e$(e,t,n){const r=LS(e,n),{scroll:s}=t;return s&&(pi(r.x,s.offset.x),pi(r.y,s.offset.y)),r}const DS=({current:e})=>e?e.ownerDocument.defaultView:null,t$=new WeakMap;class n${constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Le(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=d=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Xa(d).point)},i=(d,f)=>{const{drag:h,dragPropagation:p,onDragStart:v}=this.getProps();if(h&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=RO(h),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Lt(w=>{let g=this.getAxisMotionValue(w).get()||0;if(In.test(g)){const{projection:y}=this.visualElement;if(y&&y.layout){const m=y.layout.layoutBox[w];m&&(g=At(m)*(parseFloat(g)/100))}}this.originPoint[w]=g}),v&&ke.postRender(()=>v(d,f)),Zh(this.visualElement,"transform");const{animationState:x}=this.visualElement;x&&x.setActive("whileDrag",!0)},o=(d,f)=>{const{dragPropagation:h,dragDirectionLock:p,onDirectionLock:v,onDrag:x}=this.getProps();if(!h&&!this.openDragLock)return;const{offset:w}=f;if(p&&this.currentDirection===null){this.currentDirection=r$(w),this.currentDirection!==null&&v&&v(this.currentDirection);return}this.updateAxis("x",f.point,w),this.updateAxis("y",f.point,w),this.visualElement.render(),x&&x(d,f)},l=(d,f)=>this.stop(d,f),c=()=>Lt(d=>{var f;return this.getAnimationState(d)==="paused"&&((f=this.getAxisMotionValue(d).animation)===null||f===void 0?void 0:f.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new TS(t,{onSessionStart:s,onStart:i,onMove:o,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:DS(this.visualElement)})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:s}=n;this.startAnimation(s);const{onDragEnd:i}=this.getProps();i&&ke.postRender(()=>i(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:s}=this.getProps();if(!r||!Tl(t,s,this.currentDirection))return;const i=this.getAxisMotionValue(t);let o=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(o=WO(o,this.constraints[t],this.elastic[t])),i.set(o)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:r}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,i=this.constraints;n&&di(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&s?this.constraints=KO(s.layoutBox,n):this.constraints=!1,this.elastic=XO(r),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&Lt(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=YO(s.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!di(t))return!1;const r=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=e$(r,s.root,this.visualElement.getTransformPagePoint());let o=GO(s.layout.layoutBox,i);if(n){const l=n(QO(o));this.hasMutatedConstraints=!!l,l&&(o=RS(l))}return o}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=Lt(d=>{if(!Tl(d,n,this.currentDirection))return;let f=c&&c[d]||{};o&&(f={min:0,max:0});const h=s?200:1e6,p=s?40:1e7,v={type:"inertia",velocity:r?t[d]:0,bounceStiffness:h,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...i,...f};return this.startAxisValueAnimation(d,v)});return Promise.all(u).then(l)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return Zh(this.visualElement,t),r.start(Tg(t,r,0,n,this.visualElement,!1))}stopAnimation(){Lt(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Lt(t=>{var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Lt(n=>{const{drag:r}=this.getProps();if(!Tl(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(n);if(s&&s.layout){const{min:o,max:l}=s.layout.layoutBox[n];i.set(t[n]-Te(o,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!di(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Lt(o=>{const l=this.getAxisMotionValue(o);if(l&&this.constraints!==!1){const c=l.get();s[o]=qO({min:c,max:c},this.constraints[o])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Lt(o=>{if(!Tl(o,t,null))return;const l=this.getAxisMotionValue(o),{min:c,max:u}=this.constraints[o];l.set(Te(c,u,s[o]))})}addListeners(){if(!this.visualElement.current)return;t$.set(this.visualElement,this);const t=this.visualElement.current,n=Wo(t,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),r=()=>{const{dragConstraints:c}=this.getProps();di(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,i=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),ke.read(r);const o=wa(window,"resize",()=>this.scalePositionWithinConstraints()),l=s.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(Lt(d=>{const f=this.getAxisMotionValue(d);f&&(this.originPoint[d]+=c[d].translate,f.set(f.get()+c[d].translate))}),this.visualElement.render())});return()=>{o(),n(),i(),l&&l()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:o=lp,dragMomentum:l=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:o,dragMomentum:l}}}function Tl(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function r$(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class s$ extends Yr{constructor(t){super(t),this.removeGroupControls=Et,this.removeListeners=Et,this.controls=new n$(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Et}unmount(){this.removeGroupControls(),this.removeListeners()}}const $0=e=>(t,n)=>{e&&ke.postRender(()=>e(t,n))};class i$ extends Yr{constructor(){super(...arguments),this.removePointerDownListener=Et}onPointerDown(t){this.session=new TS(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:DS(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:$0(t),onStart:$0(n),onMove:r,onEnd:(i,o)=>{delete this.session,s&&ke.postRender(()=>s(i,o))}}}mount(){this.removePointerDownListener=Wo(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const dc={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function L0(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const go={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(se.test(e))e=parseFloat(e);else return e;const n=L0(e,t.target.x),r=L0(e,t.target.y);return`${n}% ${r}%`}},o$={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,s=Hr.parse(e);if(s.length>5)return r;const i=Hr.createTransformer(e),o=typeof s[0]!="number"?1:0,l=n.x.scale*t.x,c=n.y.scale*t.y;s[0+o]/=l,s[1+o]/=c;const u=Te(l,c,.5);return typeof s[2+o]=="number"&&(s[2+o]/=u),typeof s[3+o]=="number"&&(s[3+o]/=u),i(s)}};class a$ extends b.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=t;II(l$),i&&(n.group&&n.group.add(i),r&&r.register&&s&&r.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),dc.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:s,isPresent:i}=this.props,o=r.projection;return o&&(o.isPresent=i,s||t.layoutDependency!==n||n===void 0?o.willUpdate():this.safeToRemove(),t.isPresent!==i&&(i?o.promote():o.relegate()||ke.postRender(()=>{const l=o.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),ig.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=t;s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function zS(e){const[t,n]=jj(),r=b.useContext(Zm);return a.jsx(a$,{...e,layoutGroup:r,switchLayoutGroup:b.useContext(Pj),isPresent:t,safeToRemove:n})}const l$={borderRadius:{...go,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:go,borderTopRightRadius:go,borderBottomLeftRadius:go,borderBottomRightRadius:go,boxShadow:o$};function c$(e,t,n){const r=nt(e)?e:_a(e);return r.start(Tg("",r,t,n)),r.animation}function u$(e){return e instanceof SVGElement&&e.tagName!=="svg"}const d$=(e,t)=>e.depth-t.depth;class f${constructor(){this.children=[],this.isDirty=!1}add(t){gg(this.children,t),this.isDirty=!0}remove(t){vg(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(d$),this.isDirty=!1,this.children.forEach(t)}}function h$(e,t){const n=Rn.now(),r=({timestamp:s})=>{const i=s-n;i>=t&&(Br(r),e(i-t))};return ke.read(r,!0),()=>Br(r)}const VS=["TopLeft","TopRight","BottomLeft","BottomRight"],p$=VS.length,D0=e=>typeof e=="string"?parseFloat(e):e,z0=e=>typeof e=="number"||se.test(e);function m$(e,t,n,r,s,i){s?(e.opacity=Te(0,n.opacity!==void 0?n.opacity:1,g$(r)),e.opacityExit=Te(t.opacity!==void 0?t.opacity:1,0,v$(r))):i&&(e.opacity=Te(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let o=0;o<p$;o++){const l=`border${VS[o]}Radius`;let c=V0(t,l),u=V0(n,l);if(c===void 0&&u===void 0)continue;c||(c=0),u||(u=0),c===0||u===0||z0(c)===z0(u)?(e[l]=Math.max(Te(D0(c),D0(u),r),0),(In.test(u)||In.test(c))&&(e[l]+="%")):e[l]=u}(t.rotate||n.rotate)&&(e.rotate=Te(t.rotate||0,n.rotate||0,r))}function V0(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const g$=FS(0,.5,rS),v$=FS(.5,.95,Et);function FS(e,t,n){return r=>r<e?0:r>t?1:n(zi(e,t,r))}function F0(e,t){e.min=t.min,e.max=t.max}function Ot(e,t){F0(e.x,t.x),F0(e.y,t.y)}function B0(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function H0(e,t,n,r,s){return e-=t,e=lu(e,1/n,r),s!==void 0&&(e=lu(e,1/s,r)),e}function y$(e,t=0,n=1,r=.5,s,i=e,o=e){if(In.test(t)&&(t=parseFloat(t),t=Te(o.min,o.max,t/100)-o.min),typeof t!="number")return;let l=Te(i.min,i.max,r);e===i&&(l-=t),e.min=H0(e.min,t,n,l,s),e.max=H0(e.max,t,n,l,s)}function U0(e,t,[n,r,s],i,o){y$(e,t[n],t[r],t[s],t.scale,i,o)}const _$=["x","scaleX","originX"],x$=["y","scaleY","originY"];function W0(e,t,n,r){U0(e.x,t,_$,n?n.x:void 0,r?r.x:void 0),U0(e.y,t,x$,n?n.y:void 0,r?r.y:void 0)}function K0(e){return e.translate===0&&e.scale===1}function BS(e){return K0(e.x)&&K0(e.y)}function G0(e,t){return e.min===t.min&&e.max===t.max}function w$(e,t){return G0(e.x,t.x)&&G0(e.y,t.y)}function q0(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function HS(e,t){return q0(e.x,t.x)&&q0(e.y,t.y)}function Y0(e){return At(e.x)/At(e.y)}function X0(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class b${constructor(){this.members=[]}add(t){gg(this.members,t),t.scheduleRender()}remove(t){if(vg(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(s=>t===s);if(n===0)return!1;let r;for(let s=n;s>=0;s--){const i=this.members[s];if(i.isPresent!==!1){r=i;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:s}=t.options;s===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function j$(e,t,n){let r="";const s=e.x.translate/t.x,i=e.y.translate/t.y,o=(n==null?void 0:n.z)||0;if((s||i||o)&&(r=`translate3d(${s}px, ${i}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:f,rotateY:h,skewX:p,skewY:v}=n;u&&(r=`perspective(${u}px) ${r}`),d&&(r+=`rotate(${d}deg) `),f&&(r+=`rotateX(${f}deg) `),h&&(r+=`rotateY(${h}deg) `),p&&(r+=`skewX(${p}deg) `),v&&(r+=`skewY(${v}deg) `)}const l=e.x.scale*t.x,c=e.y.scale*t.y;return(l!==1||c!==1)&&(r+=`scale(${l}, ${c})`),r||"none"}const ss={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},No=typeof window<"u"&&window.MotionDebug!==void 0,hf=["","X","Y","Z"],S$={visibility:"hidden"},Q0=1e3;let k$=0;function pf(e,t,n,r){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),r&&(r[e]=0))}function US(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=Gj(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:i}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",ke,!(s||i))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&US(r)}function WS({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(o={},l=t==null?void 0:t()){this.id=k$++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,No&&(ss.totalNodes=ss.resolvedTargetDeltas=ss.recalculatedProjection=0),this.nodes.forEach(C$),this.nodes.forEach(I$),this.nodes.forEach(R$),this.nodes.forEach(A$),No&&window.MotionDebug.record(ss)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new f$)}addEventListener(o,l){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new yg),this.eventHandlers.get(o).add(l)}notifyListeners(o,...l){const c=this.eventHandlers.get(o);c&&c.notify(...l)}hasListeners(o){return this.eventHandlers.has(o)}mount(o,l=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=u$(o),this.instance=o;const{layoutId:c,layout:u,visualElement:d}=this.options;if(d&&!d.current&&d.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),l&&(u||c)&&(this.isLayoutDirty=!0),e){let f;const h=()=>this.root.updateBlockedByResize=!1;e(o,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=h$(h,250),dc.hasAnimatedSinceResize&&(dc.hasAnimatedSinceResize=!1,this.nodes.forEach(J0))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&d&&(c||u)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:h,hasRelativeTargetChanged:p,layout:v})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const x=this.options.transition||d.getDefaultTransition()||z$,{onLayoutAnimationStart:w,onLayoutAnimationComplete:g}=d.getProps(),y=!this.targetLayout||!HS(this.targetLayout,v)||p,m=!h&&p;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||m||h&&(y||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,m);const _={...mg(x,"layout"),onPlay:w,onComplete:g};(d.shouldReduceMotion||this.options.layoutRoot)&&(_.delay=0,_.type=!1),this.startAnimation(_)}else h||J0(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=v})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Br(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(O$),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&US(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d<this.path.length;d++){const f=this.path[d];f.shouldResetTransform=!0,f.updateScroll("snapshot"),f.options.layoutRoot&&f.willUpdate(!1)}const{layoutId:l,layout:c}=this.options;if(l===void 0&&!c)return;const u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Z0);return}this.isUpdating||this.nodes.forEach(P$),this.isUpdating=!1,this.nodes.forEach(M$),this.nodes.forEach(N$),this.nodes.forEach(E$),this.clearAllSnapshots();const l=Rn.now();qe.delta=dr(0,1e3/60,l-qe.timestamp),qe.timestamp=l,qe.isProcessing=!0,sf.update.process(qe),sf.preRender.process(qe),sf.render.process(qe),qe.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,ig.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(T$),this.sharedNodes.forEach($$)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,ke.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){ke.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutCorrected=Le(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(l=!1),l){const c=r(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:c,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!s)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!BS(this.projectionDelta),c=this.getTransformTemplate(),u=c?c(this.latestValues,""):void 0,d=u!==this.prevTransformTemplateValue;o&&(l||rs(this.latestValues)||d)&&(s(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const l=this.measurePageBox();let c=this.removeElementScroll(l);return o&&(c=this.removeTransform(c)),V$(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var o;const{visualElement:l}=this.options;if(!l)return Le();const c=l.measureViewportBox();if(!(((o=this.scroll)===null||o===void 0?void 0:o.wasRoot)||this.path.some(F$))){const{scroll:d}=this.root;d&&(pi(c.x,d.offset.x),pi(c.y,d.offset.y))}return c}removeElementScroll(o){var l;const c=Le();if(Ot(c,o),!((l=this.scroll)===null||l===void 0)&&l.wasRoot)return c;for(let u=0;u<this.path.length;u++){const d=this.path[u],{scroll:f,options:h}=d;d!==this.root&&f&&h.layoutScroll&&(f.wasRoot&&Ot(c,o),pi(c.x,f.offset.x),pi(c.y,f.offset.y))}return c}applyTransform(o,l=!1){const c=Le();Ot(c,o);for(let u=0;u<this.path.length;u++){const d=this.path[u];!l&&d.options.layoutScroll&&d.scroll&&d!==d.root&&mi(c,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),rs(d.latestValues)&&mi(c,d.latestValues)}return rs(this.latestValues)&&mi(c,this.latestValues),c}removeTransform(o){const l=Le();Ot(l,o);for(let c=0;c<this.path.length;c++){const u=this.path[c];if(!u.instance||!rs(u.latestValues))continue;cp(u.latestValues)&&u.updateSnapshot();const d=Le(),f=u.measurePageBox();Ot(d,f),W0(l,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,d)}return rs(this.latestValues)&&W0(l,this.latestValues),l}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==qe.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var l;const c=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=c.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=c.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=c.isSharedProjectionDirty);const u=!!this.resumingFrom||this!==c;if(!(o||u&&this.isSharedProjectionDirty||this.isProjectionDirty||!((l=this.parent)===null||l===void 0)&&l.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:f,layoutId:h}=this.options;if(!(!this.layout||!(f||h))){if(this.resolvedRelativeTargetAt=qe.timestamp,!this.targetDelta&&!this.relativeTarget){const p=this.getClosestProjectingParent();p&&p.layout&&this.animationProgress!==1?(this.relativeParent=p,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Le(),this.relativeTargetOrigin=Le(),Go(this.relativeTargetOrigin,this.layout.layoutBox,p.layout.layoutBox),Ot(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Le(),this.targetWithTransforms=Le()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),UO(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Ot(this.target,this.layout.layoutBox),$S(this.target,this.targetDelta)):Ot(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const p=this.getClosestProjectingParent();p&&!!p.resumingFrom==!!this.resumingFrom&&!p.options.layoutScroll&&p.target&&this.animationProgress!==1?(this.relativeParent=p,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Le(),this.relativeTargetOrigin=Le(),Go(this.relativeTargetOrigin,this.target,p.target),Ot(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}No&&ss.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||cp(this.parent.latestValues)||OS(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var o;const l=this.getLead(),c=!!this.resumingFrom||this!==l;let u=!0;if((this.isProjectionDirty||!((o=this.parent)===null||o===void 0)&&o.isProjectionDirty)&&(u=!1),c&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(u=!1),this.resolvedRelativeTargetAt===qe.timestamp&&(u=!1),u)return;const{layout:d,layoutId:f}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||f))return;Ot(this.layoutCorrected,this.layout.layoutBox);const h=this.treeScale.x,p=this.treeScale.y;JO(this.layoutCorrected,this.treeScale,this.path,c),l.layout&&!l.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(l.target=l.layout.layoutBox,l.targetWithTransforms=Le());const{target:v}=l;if(!v){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(B0(this.prevProjectionDelta.x,this.projectionDelta.x),B0(this.prevProjectionDelta.y,this.projectionDelta.y)),Ko(this.projectionDelta,this.layoutCorrected,v,this.latestValues),(this.treeScale.x!==h||this.treeScale.y!==p||!X0(this.projectionDelta.x,this.prevProjectionDelta.x)||!X0(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",v)),No&&ss.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var l;if((l=this.options.visualElement)===null||l===void 0||l.scheduleRender(),o){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=hi(),this.projectionDelta=hi(),this.projectionDeltaWithTransform=hi()}setAnimationOrigin(o,l=!1){const c=this.snapshot,u=c?c.latestValues:{},d={...this.latestValues},f=hi();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const h=Le(),p=c?c.source:void 0,v=this.layout?this.layout.source:void 0,x=p!==v,w=this.getStack(),g=!w||w.members.length<=1,y=!!(x&&!g&&this.options.crossfade===!0&&!this.path.some(D$));this.animationProgress=0;let m;this.mixTargetDelta=_=>{const j=_/1e3;e_(f.x,o.x,j),e_(f.y,o.y,j),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Go(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),L$(this.relativeTarget,this.relativeTargetOrigin,h,j),m&&w$(this.relativeTarget,m)&&(this.isProjectionDirty=!1),m||(m=Le()),Ot(m,this.relativeTarget)),x&&(this.animationValues=d,m$(d,u,this.latestValues,j,y,g)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=j},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Br(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ke.update(()=>{dc.hasAnimatedSinceResize=!0,this.currentAnimation=c$(0,Q0,{...o,onUpdate:l=>{this.mixTargetDelta(l),o.onUpdate&&o.onUpdate(l)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Q0),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:l,target:c,layout:u,latestValues:d}=o;if(!(!l||!c||!u)){if(this!==o&&this.layout&&u&&KS(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||Le();const f=At(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+f;const h=At(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+h}Ot(l,c),mi(l,d),Ko(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(o,l){this.sharedNodes.has(o)||this.sharedNodes.set(o,new b$),this.sharedNodes.get(o).add(l);const u=l.options.initialPromotionConfig;l.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(l):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:l}=this.options;return l?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:l}=this.options;return l?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:l,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),o&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let l=!1;const{latestValues:c}=o;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const u={};c.z&&pf("z",o,u,this.animationValues);for(let d=0;d<hf.length;d++)pf(`rotate${hf[d]}`,o,u,this.animationValues),pf(`skew${hf[d]}`,o,u,this.animationValues);o.render();for(const d in u)o.setStaticValue(d,u[d]),this.animationValues&&(this.animationValues[d]=u[d]);o.scheduleRender()}getProjectionStyles(o){var l,c;if(!this.instance||this.isSVG)return;if(!this.isVisible)return S$;const u={visibility:""},d=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,u.opacity="",u.pointerEvents=cc(o==null?void 0:o.pointerEvents)||"",u.transform=d?d(this.latestValues,""):"none",u;const f=this.getLead();if(!this.projectionDelta||!this.layout||!f.target){const x={};return this.options.layoutId&&(x.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,x.pointerEvents=cc(o==null?void 0:o.pointerEvents)||""),this.hasProjected&&!rs(this.latestValues)&&(x.transform=d?d({},""):"none",this.hasProjected=!1),x}const h=f.animationValues||f.latestValues;this.applyTransformsToTarget(),u.transform=j$(this.projectionDeltaWithTransform,this.treeScale,h),d&&(u.transform=d(h,u.transform));const{x:p,y:v}=this.projectionDelta;u.transformOrigin=`${p.origin*100}% ${v.origin*100}% 0`,f.animationValues?u.opacity=f===this?(c=(l=h.opacity)!==null&&l!==void 0?l:this.latestValues.opacity)!==null&&c!==void 0?c:1:this.preserveOpacity?this.latestValues.opacity:h.opacityExit:u.opacity=f===this?h.opacity!==void 0?h.opacity:"":h.opacityExit!==void 0?h.opacityExit:0;for(const x in ru){if(h[x]===void 0)continue;const{correct:w,applyTo:g}=ru[x],y=u.transform==="none"?h[x]:w(h[x],f);if(g){const m=g.length;for(let _=0;_<m;_++)u[g[_]]=y}else u[x]=y}return this.options.layoutId&&(u.pointerEvents=f===this?cc(o==null?void 0:o.pointerEvents)||"":"none"),u}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var l;return(l=o.currentAnimation)===null||l===void 0?void 0:l.stop()}),this.root.nodes.forEach(Z0),this.root.sharedNodes.clear()}}}function N$(e){e.updateLayout()}function E$(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=e.layout,{animationType:i}=e.options,o=n.source!==e.layout.source;i==="size"?Lt(f=>{const h=o?n.measuredBox[f]:n.layoutBox[f],p=At(h);h.min=r[f].min,h.max=h.min+p}):KS(i,n.layoutBox,r)&&Lt(f=>{const h=o?n.measuredBox[f]:n.layoutBox[f],p=At(r[f]);h.max=h.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+p)});const l=hi();Ko(l,r,n.layoutBox);const c=hi();o?Ko(c,e.applyTransform(s,!0),n.measuredBox):Ko(c,r,n.layoutBox);const u=!BS(l);let d=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:p}=f;if(h&&p){const v=Le();Go(v,n.layoutBox,h.layoutBox);const x=Le();Go(x,r,p.layoutBox),HS(v,x)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=x,e.relativeTargetOrigin=v,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:c,layoutDelta:l,hasLayoutChanged:u,hasRelativeTargetChanged:d})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function C$(e){No&&ss.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function A$(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function T$(e){e.clearSnapshot()}function Z0(e){e.clearMeasurements()}function P$(e){e.isLayoutDirty=!1}function M$(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function J0(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function I$(e){e.resolveTargetDelta()}function R$(e){e.calcProjection()}function O$(e){e.resetSkewAndRotation()}function $$(e){e.removeLeadSnapshot()}function e_(e,t,n){e.translate=Te(t.translate,0,n),e.scale=Te(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function t_(e,t,n,r){e.min=Te(t.min,n.min,r),e.max=Te(t.max,n.max,r)}function L$(e,t,n,r){t_(e.x,t.x,n.x,r),t_(e.y,t.y,n.y,r)}function D$(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const z$={duration:.45,ease:[.4,0,.1,1]},n_=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),r_=n_("applewebkit/")&&!n_("chrome/")?Math.round:Et;function s_(e){e.min=r_(e.min),e.max=r_(e.max)}function V$(e){s_(e.x),s_(e.y)}function KS(e,t,n){return e==="position"||e==="preserve-aspect"&&!HO(Y0(t),Y0(n),.2)}function F$(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const B$=WS({attachResizeListener:(e,t)=>wa(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),mf={current:void 0},GS=WS({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!mf.current){const e=new B$({});e.mount(window),e.setOptions({layoutScroll:!0}),mf.current=e}return mf.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),H$={pan:{Feature:i$},drag:{Feature:s$,ProjectionNode:GS,MeasureLayout:zS}};function U$(e,t,n){var r;if(e instanceof Element)return[e];if(typeof e=="string"){let s=document;const i=(r=void 0)!==null&&r!==void 0?r:s.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}function qS(e,t){const n=U$(e),r=new AbortController,s={passive:!0,...t,signal:r.signal};return[n,s,()=>r.abort()]}function i_(e){return t=>{t.pointerType==="touch"||AS()||e(t)}}function W$(e,t,n={}){const[r,s,i]=qS(e,n),o=i_(l=>{const{target:c}=l,u=t(l);if(typeof u!="function"||!c)return;const d=i_(f=>{u(f),c.removeEventListener("pointerleave",d)});c.addEventListener("pointerleave",d,s)});return r.forEach(l=>{l.addEventListener("pointerenter",o,s)}),i}function o_(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,i=r[s];i&&ke.postRender(()=>i(t,Xa(t)))}class K$ extends Yr{mount(){const{current:t}=this.node;t&&(this.unmount=W$(t,n=>(o_(this.node,n,"Start"),r=>o_(this.node,r,"End"))))}unmount(){}}class G$ extends Yr{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Ya(wa(this.node.current,"focus",()=>this.onFocus()),wa(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const YS=(e,t)=>t?e===t?!0:YS(e,t.parentElement):!1,q$=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Y$(e){return q$.has(e.tagName)||e.tabIndex!==-1}const Eo=new WeakSet;function a_(e){return t=>{t.key==="Enter"&&e(t)}}function gf(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const X$=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=a_(()=>{if(Eo.has(n))return;gf(n,"down");const s=a_(()=>{gf(n,"up")}),i=()=>gf(n,"cancel");n.addEventListener("keyup",s,t),n.addEventListener("blur",i,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function l_(e){return Pg(e)&&!AS()}function Q$(e,t,n={}){const[r,s,i]=qS(e,n),o=l=>{const c=l.currentTarget;if(!l_(l)||Eo.has(c))return;Eo.add(c);const u=t(l),d=(p,v)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",h),!(!l_(p)||!Eo.has(c))&&(Eo.delete(c),typeof u=="function"&&u(p,{success:v}))},f=p=>{d(p,n.useGlobalTarget||YS(c,p.target))},h=p=>{d(p,!1)};window.addEventListener("pointerup",f,s),window.addEventListener("pointercancel",h,s)};return r.forEach(l=>{!Y$(l)&&l.getAttribute("tabindex")===null&&(l.tabIndex=0),(n.useGlobalTarget?window:l).addEventListener("pointerdown",o,s),l.addEventListener("focus",u=>X$(u,s),s)}),i}function c_(e,t,n){const{props:r}=e;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),i=r[s];i&&ke.postRender(()=>i(t,Xa(t)))}class Z$ extends Yr{mount(){const{current:t}=this.node;t&&(this.unmount=Q$(t,n=>(c_(this.node,n,"Start"),(r,{success:s})=>c_(this.node,r,s?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const dp=new WeakMap,vf=new WeakMap,J$=e=>{const t=dp.get(e.target);t&&t(e)},eL=e=>{e.forEach(J$)};function tL({root:e,...t}){const n=e||document;vf.has(n)||vf.set(n,{});const r=vf.get(n),s=JSON.stringify(t);return r[s]||(r[s]=new IntersectionObserver(eL,{root:e,...t})),r[s]}function nL(e,t,n){const r=tL(t);return dp.set(e,n),r.observe(e),()=>{dp.delete(e),r.unobserve(e)}}const rL={some:0,all:1};class sL extends Yr{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:i}=t,o={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:rL[s]},l=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,i&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:f}=this.node.getProps(),h=u?d:f;h&&h(c)};return nL(this.node.current,o,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(iL(t,n))&&this.startObserver()}unmount(){}}function iL({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const oL={inView:{Feature:sL},tap:{Feature:Z$},focus:{Feature:G$},hover:{Feature:K$}},aL={layout:{ProjectionNode:GS,MeasureLayout:zS}},fp={current:null},XS={current:!1};function lL(){if(XS.current=!0,!!tg)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>fp.current=e.matches;e.addListener(t),t()}else fp.current=!1}const cL=[...vS,et,Hr],uL=e=>cL.find(gS(e)),u_=new WeakMap;function dL(e,t,n){for(const r in t){const s=t[r],i=n[r];if(nt(s))e.addValue(r,s);else if(nt(i))e.addValue(r,_a(s,{owner:e}));else if(i!==s)if(e.hasValue(r)){const o=e.getValue(r);o.liveStyle===!0?o.jump(s):o.hasAnimated||o.set(s)}else{const o=e.getStaticValue(r);e.addValue(r,_a(o!==void 0?o:s,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const d_=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class fL{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:s,blockInitialAnimation:i,visualState:o},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Eg,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const p=Rn.now();this.renderScheduledAt<p&&(this.renderScheduledAt=p,ke.render(this.render,!1,!0))};const{latestValues:c,renderState:u,onUpdate:d}=o;this.onUpdate=d,this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=u,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=s,this.options=l,this.blockInitialAnimation=!!i,this.isControllingVariants=nd(n),this.isVariantNode=Aj(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:f,...h}=this.scrapeMotionValuesFromProps(n,{},this);for(const p in h){const v=h[p];c[p]!==void 0&&nt(v)&&v.set(c[p],!1)}}mount(t){this.current=t,u_.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),XS.current||lL(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:fp.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){u_.delete(this.current),this.projection&&this.projection.unmount(),Br(this.notifyUpdate),Br(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const r=Fs.has(t),s=n.on("change",l=>{this.latestValues[t]=l,this.props.onUpdate&&ke.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),i=n.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{s(),i(),o&&o(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Di){const n=Di[t];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[t]&&s&&r(this.props)&&(this.features[t]=new s(this)),this.features[t]){const i=this.features[t];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Le()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<d_.length;r++){const s=d_[r];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const i="on"+s,o=t[i];o&&(this.propEventSubscriptions[s]=this.on(s,o))}this.prevMotionValues=dL(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=_a(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){var r;let s=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(r=this.getBaseTargetFromProps(this.props,t))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,t,this.options);return s!=null&&(typeof s=="string"&&(pS(s)||iS(s))?s=parseFloat(s):!uL(s)&&Hr.test(n)&&(s=dS(t,n)),this.setBaseTarget(t,nt(s)?s.get():s)),nt(s)?s.get():s}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props;let s;if(typeof r=="string"||typeof r=="object"){const o=ag(this.props,r,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);o&&(s=o[t])}if(r&&s!==void 0)return s;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!nt(i)?i:this.initialValues[t]!==void 0&&s===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new yg),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class QS extends fL{constructor(){super(...arguments),this.KeyframeResolver=yS}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;nt(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function hL(e){return window.getComputedStyle(e)}class pL extends QS{constructor(){super(...arguments),this.type="html",this.renderInstance=Dj}readValueFromInstance(t,n){if(Fs.has(n)){const r=Ng(n);return r&&r.default||0}else{const r=hL(t),s=(Oj(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(t,{transformPagePoint:n}){return LS(t,n)}build(t,n,r){ug(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return pg(t,n,r)}}class mL extends QS{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Le}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Fs.has(n)){const r=Ng(n);return r&&r.default||0}return n=zj.has(n)?n:sg(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return Bj(t,n,r)}build(t,n,r){dg(t,n,this.isSVGTag,r.transformTemplate)}renderInstance(t,n,r,s){Vj(t,n,r,s)}mount(t){this.isSVGTag=hg(t.tagName),super.mount(t)}}const gL=(e,t)=>og(e)?new mL(t):new pL(t,{allowProjection:e!==b.Fragment}),vL=BI({...IO,...oL,...H$,...aL},gL),Ye=rI(vL),yL="local-app".toLowerCase();function _L(e,t){return e==="mock"||e==="app"||e==="local"?e:"local"}const ZS=_L(yL),ue=ZS!=="mock",it=ZS==="app",f_={"workflow.yml":"流程编排","aitable-workflow.config.yml":"运行配置","coding-agents.config.json":"执行引擎","views.yml":"视图方案",".gitkeep":"目录占位"};function JS(e){return{label:xL(e.toolName,e.toolInput),detail:wL(e.toolName,e.toolInput,e.projectId)}}function xL(e,t){if(!e)return"处理生成进度";const n=e.toLowerCase();if(n==="bash")return bL(hp(t));if(n.includes("write")||n.includes("edit")){const r=id(hp(t));return r?r.name:"更新生成文件"}return n.includes("read")?"读取上下文":n.includes("mkdir")?"创建目录":n.includes("grep")||n.includes("search")?"检索项目内容":"执行生成动作"}function wL(e,t,n){const r=hp(t);if((e==null?void 0:e.toLowerCase())==="bash"&&r)return jL(r,n);const s=r?id(r):null;return s?s.purpose:t?Mg(t.replace(/\s+/g," "),64):void 0}function id(e){var l;const t=e.indexOf("recipes/");if(t>=0){const c=(l=e.slice(t).match(/^[^\s'\"]+/))==null?void 0:l[0];if(c)return{name:c.split("/").pop()??c,purpose:"步骤脚本"}}const n=e.match(/(?:^|[/\\])([^/\\\s'"]+\.(?:yml|yaml|json|ts|tsx|md))$/);if(n!=null&&n[1]){const c=n[1];return{name:c,purpose:f_[c]??"项目文件"}}const r=e.match(/(?:^|\s)(?:[~./\w-]+\/)?((?:recipes\/)?[^\s'\"]+\.(?:yml|yaml|json|ts|tsx|md))/);if(!(r!=null&&r[1]))return null;const s=r[1].replace(/^.*?(recipes\/)/u,"$1"),i=s.split("/").pop()??s,o=s.startsWith("recipes/")?"步骤脚本":f_[i]??"项目文件";return{name:i,purpose:o}}function Mg(e,t){return e.length>t?`${e.slice(0,t-1)}…`:e}function bL(e){const t=e.trim().toLowerCase();return/^mkdir\b/.test(t)?"创建目录":/^(install|touch)\b/.test(t)?"准备生成文件":/^(ls|find|test|cat|pwd)\b/.test(t)?"检查生成结果":/\b(pnpm|npm|tsx|tsc|node|vitest)\b/.test(t)?"校验生成文件":"执行生成命令"}function jL(e,t){const n=e.replace(/\s+/g," ").trim(),r=t?SL(n,t):null;if(r)return r;const s=id(n);return s?`${s.purpose} · ${s.name}`:`命令 · ${Mg(kL(n),72)}`}function hp(e){if(!e)return"";const t=e.trim();try{const n=JSON.parse(t);for(const r of["file_path","path","command","cmd"]){const s=n[r];if(typeof s=="string"&&s.trim())return s}}catch{}return t}function SL(e,t){var i;const n=NL(t),r=e.match(new RegExp(`(?:^|[\\s'"])(?:[^\\s'"]*/)?${n}(?:/([^\\s'"]+))?`));if(!r)return null;const s=((i=r[1])==null?void 0:i.replace(/^\/+/,""))??"";return s?`${t}/${s}`:t}function kL(e){return e.replace(/\/Users\/[^/\s]+\/Documents\/Work\/code\/[^\s]+\/?/g,"").replace(/\/private\/var\/folders\/[^\s]+\/?/g,"").replace(/\/var\/folders\/[^\s]+\/?/g,"")}function NL(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const EL=300,pp=200,CL=4e3;function h_(e,t=pp){return e.length>t?`${e.slice(0,t)}…`:e}function p_(e,t=CL){return e.length>t?`${e.slice(0,t)}…`:e}function AL(e,t,n=EL){if(!t.length)return e;const r=[...e,...t];return r.length>n?r.slice(r.length-n):r}function TL(e,t){var n,r,s,i,o,l,c,u;switch(e.type){case"text":{const d=(n=e.content)==null?void 0:n.trim();return d?{kind:"text",text:d,round:t}:null}case"thinking":{const d=(r=e.content)==null?void 0:r.trim();return d?{kind:"thinking",text:d,round:t}:null}case"tool_use":{const d=JS({toolName:e.toolName,toolInput:e.toolInput});return{kind:"tool",text:d.detail?`${d.label} — ${d.detail}`:d.label,toolName:e.toolName,round:t}}case"tool_result":{const d=(s=e.content)==null?void 0:s.trim(),f=((i=e.toolName)==null?void 0:i.trim())||void 0,h=d?`↩ ${h_(d)}`:f?`↩ ${f} 返回结果`:"↩ 工具返回结果",p=d&&d.length>pp?p_(d):void 0;return p?{kind:"tool_result",text:h,toolName:f,round:t,fullText:p}:{kind:"tool_result",text:h,toolName:f,round:t}}case"permission_request":{const d=((o=e.toolName)==null?void 0:o.trim())||void 0,f=(l=e.content)==null?void 0:l.trim(),h=d?`${d} 待授权`:"待授权请求",p=f?`${h} — ${h_(f)}`:h,v=f&&f.length>pp?p_(f):void 0;return v?{kind:"permission",text:p,toolName:d,round:t,fullText:v}:{kind:"permission",text:p,toolName:d,round:t}}case"result":{const d=(c=e.content)==null?void 0:c.trim();return d?{kind:"status",text:d,round:t}:null}case"error":return{kind:"status",text:((u=e.content)==null?void 0:u.trim())||"执行出错",round:t};default:return null}}function PL(e){var t,n,r;switch(e.type){case"setup.progress":{const s=(t=e.message)==null?void 0:t.trim();return s?{kind:"status",text:`[setup] ${s}`}:null}case"setup.done":return{kind:"status",text:"[setup] 完成",boundary:!0};case"error":return{kind:"status",text:`[setup] 错误: ${((r=(n=e.error)==null?void 0:n.message)==null?void 0:r.trim())||"未知错误"}`};default:return null}}function ML(e){var t,n,r,s,i,o,l,c,u,d,f;switch(e.type){case"run.step.started":{const h=((t=e.stepName)==null?void 0:t.trim())||e.stepId||"步骤";return{kind:"tool",text:`[run] ▶ ${h}`,toolName:h}}case"run.step.succeeded":return{kind:"status",text:`[run] ✓ ${((n=e.stepName)==null?void 0:n.trim())||e.stepId||"步骤"}`};case"run.step.failed":{const h=((r=e.stepName)==null?void 0:r.trim())||e.stepId||"步骤",p=(s=e.error)==null?void 0:s.trim();return{kind:"status",text:p?`[run] ✗ ${h}:${p}`:`[run] ✗ ${h}`}}case"run.record.blocked":{const h=((i=e.stepName)==null?void 0:i.trim())||e.stepId||"步骤",p=(o=e.reason)==null?void 0:o.trim();return{kind:"status",text:p?`[run] ✗ ${h}:${p}`:`[run] ✗ ${h}`}}case"run.record.detected":return{kind:"status",text:`[run] 记录: ${((c=(l=e.record)==null?void 0:l.title)==null?void 0:c.trim())||((u=e.record)==null?void 0:u.id)||"记录"}`};case"run.stopped":return{kind:"status",text:"[run] 停止",boundary:!0};case"error":return{kind:"status",text:`[run] 错误: ${((f=(d=e.error)==null?void 0:d.message)==null?void 0:f.trim())||"未知错误"}`};default:return null}}function IL(e){const t=[];let n=!1,r,s=!1;for(const i of e){if(i.boundary){n=!0;continue}const o=i.round!==r;(!s||n||o)&&(t.push({round:i.round,items:[]}),n=!1,r=i.round,s=!0);const l=t[t.length-1].items;if(i.kind==="text"||i.kind==="thinking"){const u=l[l.length-1];if(u&&u.kind===i.kind){u.text+=i.text;continue}l.push({kind:i.kind,text:i.text});continue}const c={kind:i.kind,text:i.text,toolName:i.toolName};i.fullText!==void 0&&(c.fullText=i.fullText),l.push(c)}return t}function RL(e){return{projectId:e,activeStage:null,stages:{},updatedAt:new Date().toISOString()}}function vs(e,t,n){const r=e.projectState??RL(e.projectId),s=n.status==="running"||n.status==="blocked";return{...r,activeStage:s?t:r.activeStage===t?null:r.activeStage,stages:{...r.stages,[t]:{task:n}},updatedAt:new Date().toISOString()}}function rn(e,t,n){const r=Ig(e,t),s=new Date().toISOString(),i=r?{...r,...n,updatedAt:s}:{id:`${t}_live`,projectId:e.projectId,stage:t,status:"running",attempt:1,startedAt:s,updatedAt:s,...n};return vs(e,t,i)}function Ig(e,t){var n,r;return(r=(n=e.projectState)==null?void 0:n.stages[t])==null?void 0:r.task}function OL(e,t){var n,r;switch(t.type){case"task.started":case"task.snapshot":case"task.succeeded":return{projectState:vs(e,"design",t.task)};case"task.blocked":return{projectState:vs(e,"design",t.task),live:{designMessage:((n=t.task.block)==null?void 0:n.message)??"等待确认需求澄清"}};case"task.failed":return{projectState:vs(e,"design",t.task),live:{designMessage:((r=t.task.error)==null?void 0:r.message)??"真实设计失败,可重新生成"}};case"error":return{projectState:rn(e,"design",{status:"failed",currentAction:`真实设计中断:${t.error.message}`,error:{code:t.error.code,message:t.error.message,retryable:!0,details:t.error.details}}),live:{designMessage:`真实设计中断:${t.error.message}`}};case"design.started":return{live:{designProgressStep:"discovery",designMessage:"真实设计服务已连接,等待需求摘要"}};case"design.discovery":return{live:{designProgressStep:"design",designMessage:"已形成需求摘要,准备启动 Coding Agent"}};case"design.progress":{const s=Ig(e,"design");return{projectState:rn(e,"design",{status:!s||s.status==="idle"?"running":s.status,checkpoint:t.phase,currentAction:t.message}),live:{designMessage:t.message}}}case"design.round_start":return{live:{designProgressStep:"design",designRound:t.round,designMessage:`第 ${t.round} 轮真实 Agent 执行中`}};case"design.agent_event":{const s=e.live.designAgentEvents+1,i=e.live.designRound??1;return{live:{designAgentEvents:s,designMessage:t.event.type==="tool_use"?`第 ${i} 轮收到工具调用`:`第 ${i} 轮收到 Agent 输出`}}}case"design.validation":return{live:{designProgressStep:"render",designRound:t.round,designMessage:t.validation.valid?"流程方案校验通过":`校验发现 ${t.validation.errors.length} 个问题,等待修复轮`}};case"design.files":return{files:t.files,live:{designMessage:`同步 ${t.files.length} 个生成文件`}};case"design.done":return{live:{designProgressStep:t.success?"done":e.live.designProgressStep,designRounds:t.rounds,designRound:null,designMessage:t.success?`真实设计完成:${t.rounds} 轮,${e.live.designAgentEvents} 个 Agent 事件`:`真实设计未通过:${t.rounds} 轮,${e.live.designAgentEvents} 个 Agent 事件`}};default:return{}}}function $L(e,t){switch(t.type){case"task.started":case"task.snapshot":case"task.blocked":case"task.failed":case"task.succeeded":return{projectState:vs(e,"setup",t.task)};case"task.progress":return{projectState:rn(e,"setup",{status:"running",checkpoint:t.checkpoint,currentAction:t.message})};case"error":return{projectState:rn(e,"setup",{status:"failed",error:{code:t.error.code,message:t.error.message,retryable:!0,details:t.error.details}})};case"setup.done":{const n=Ig(e,"setup");return{projectState:rn(e,"setup",{status:"succeeded",completedAt:new Date().toISOString(),checkpoint:"done",currentAction:`AI 表格已就绪:${t.tableId}`,outputs:{...n==null?void 0:n.outputs,tableUrl:t.tableUrl,baseId:t.baseId,tableId:t.tableId,schema:t.schema}})}}default:return{}}}const LL=300;function DL(e,t,n={}){var s;const r=zL(n);if(t.type==="run.record.detected")return{records:VL(e.records,{id:t.record.id,title:t.record.title||t.record.id,state:t.record.state,status:t.record.currentStep?"running":"todo",currentStepId:t.record.currentStep,doneStepIds:[],createdAt:r.now(),updatedAt:r.now()}),logs:is(e.logs,t.record.id,t.record.currentStep??"run","info",`发现待处理记录:${t.record.title||t.record.id}`,r)};if(t.type==="run.step.started"){const i=((s=n.stepLevel)==null?void 0:s.call(n,t.stepId,t))??"ai";return{records:vo(e.records,t.itemId,o=>({...o,status:o.status==="done"?o.status:"running",currentStepId:o.status==="done"?o.currentStepId:t.stepId,updatedAt:r.now()})),logs:is(e.logs,t.itemId,t.stepId,i,`开始执行步骤:${t.stepName}`,r)}}return t.type==="run.step.succeeded"?{records:vo(e.records,t.itemId,i=>({...i,doneStepIds:m_(i.doneStepIds,t.stepId),updatedAt:r.now()})),logs:yf(is(e.logs,t.itemId,t.stepId,"ok",`步骤完成:${t.stepName}`,r),t.itemId,t.stepId,"info",t.logs,r)}:t.type==="run.step.failed"?{records:vo(e.records,t.itemId,i=>({...i,status:i.status==="done"?i.status:"blocked",currentStepId:i.status==="done"?i.currentStepId:t.stepId,updatedAt:r.now()})),logs:yf(is(e.logs,t.itemId,t.stepId,"error",`步骤失败:${t.stepName} · ${t.error}`,r),t.itemId,t.stepId,"error",t.logs,r)}:t.type==="run.record.blocked"?{records:vo(e.records,t.itemId,i=>({...i,status:i.status==="done"?i.status:t.reason.includes("人工")?"review":"blocked",currentStepId:i.status==="done"?i.currentStepId:t.stepId,doneStepIds:m_(i.doneStepIds,t.stepId),updatedAt:r.now()})),logs:yf(is(e.logs,t.itemId,t.stepId,"warn",`${t.stepName}:${t.reason}`,r),t.itemId,t.stepId,"info",t.logs,r)}:t.type==="run.record.completed"?{records:vo(e.records,t.itemId,i=>({...i,status:"done",currentStepId:null,updatedAt:r.now()})),logs:is(e.logs,t.itemId,"run","ok","流程完成",r)}:e}function zL(e){return{now:e.now??Date.now,id:e.id??FL,maxLogs:e.maxLogs??LL}}function VL(e,t){return e.findIndex(r=>r.id===t.id)<0?[...e,t]:e.map(r=>r.id===t.id?{...r,...t,doneStepIds:r.doneStepIds,status:r.status==="done"?r.status:t.status,currentStepId:r.status==="done"?r.currentStepId:t.currentStepId,createdAt:r.createdAt}:r)}function vo(e,t,n){return e.map(r=>r.id===t?n(r):r)}function m_(e,t){return e.includes(t)?e:[...e,t]}function is(e,t,n,r,s,i){return e.some(l=>l.itemId===t&&l.stepId===n&&l.level===r&&l.text===s)?e:[...e,{id:i.id(),ts:i.now(),itemId:t,stepId:n,level:r,text:s}].slice(-i.maxLogs)}function yf(e,t,n,r,s,i){return s!=null&&s.length?s.reduce((o,l)=>is(o,t,n,r,l,i),e):e}function FL(){return`run_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`}function BL(e,t){var n;switch(t.type){case"task.started":case"task.snapshot":case"task.succeeded":case"task.blocked":return{projectState:vs(e,"run",t.task)};case"task.progress":return{projectState:rn(e,"run",{status:"running",checkpoint:t.checkpoint,currentAction:t.message})};case"task.failed":{const r=((n=t.task.error)==null?void 0:n.message)??t.task.currentAction??"真实运行失败";return{projectState:vs(e,"run",t.task),live:{logs:Gs(e.live.logs,qs("error",r))}}}case"run.started":{const r=`${t.workflowName} 已启动,${t.stepCount} 个步骤,监听间隔 ${Math.round(t.intervalMs/1e3)} 秒`;return{projectState:rn(e,"run",{status:"running",checkpoint:"started",currentAction:r}),live:{logs:Gs(e.live.logs,qs("ok",r))}}}case"run.progress":return{projectState:rn(e,"run",{status:"running",checkpoint:"listening",currentAction:t.message}),live:{logs:Gs(e.live.logs,qs("ai",t.message))}};case"run.stopped":return{projectState:rn(e,"run",{status:"succeeded",checkpoint:"stopped",currentAction:t.message}),live:{logs:Gs(e.live.logs,qs("ok",t.message))}};case"error":return{projectState:rn(e,"run",{status:"failed",checkpoint:"failed",error:{code:t.error.code,message:t.error.message,retryable:!0,details:t.error.details}}),live:{logs:Gs(e.live.logs,qs("error",t.error.message))}};default:{if(!XL(t))return{};const r=DL(QL(e),t,{stepLevel:s=>{var i,o;return(o=(i=e.steps)==null?void 0:i.find(l=>l.id===s))!=null&&o.requiresAgent?"ai":"info"}});return{live:ZL(r)}}}}function HL(e,t){const n=t.desiredState==="stopped",r=n&&!t.machineId,s=n?t.machineId?"已请求停止,等待执行机器优雅退出":"运行已停止":t.stalled?"无可用执行机器认领本工作流,请检查 daemon 是否在线":t.online?`运行中 · 执行机器 ${t.machineId??"未知"}`:"已请求运行,等待执行机器认领";return{projectState:rn(e,"run",{status:r?"succeeded":"running",checkpoint:n?"stopped":t.online?"listening":"waiting_machine",currentAction:s})}}function UL(e,t){return{live:{tickets:t.map(n=>({id:n.itemId,title:n.title??n.itemId,customer:n.itemId,category:"真实记录",priority:n.state??"",status:n.status??WL(n),currentStepId:n.currentStepId,doneStepIds:n.doneStepIds,createdAt:Date.parse(n.updatedAt)||Date.now()}))}}}function WL(e){return e.completedAt?"done":e.currentStepId?"running":"todo"}function KL(e,t){const n=`evt_${t.seq}`;return e.live.logs.some(r=>r.id===n)?{}:{live:{logs:[...e.live.logs,{id:n,ts:Date.parse(t.at)||Date.now(),ticketId:t.itemId??"run",stepId:t.stepId??"run",level:qL(t.type),text:YL(t)}]}}}function GL(e,t){return e.live.logs.some(n=>n.ticketId==="run"&&n.text===t)?{}:{live:{logs:Gs(e.live.logs,qs("error",t))}}}function qL(e){return e.endsWith("failed")?"error":e.endsWith("blocked")?"warn":e.endsWith("succeeded")||e.endsWith("completed")?"ok":"info"}function YL(e){const t=typeof e.payload.stepName=="string"?e.payload.stepName:e.stepId,n=typeof e.payload.error=="string"?e.payload.error:null,r=typeof e.payload.reason=="string"?e.payload.reason:null;switch(e.type){case"record.observed":return`发现工单 ${e.itemId??""}`.trim();case"step.started":return`开始步骤:${t??""}`.trim();case"step.succeeded":return`步骤完成:${t??""}`.trim();case"step.failed":return`步骤失败:${t??""}${n?` — ${n}`:""}`;case"record.blocked":return`工单受阻${r?`:${r}`:""}`;case"record.completed":return"工单已完成";default:return e.type}}function XL(e){return e.type==="run.record.detected"||e.type==="run.step.started"||e.type==="run.step.succeeded"||e.type==="run.step.failed"||e.type==="run.record.blocked"||e.type==="run.record.completed"}function QL(e){return{records:e.live.tickets.map(t=>({id:t.id,title:t.title,state:t.priority,status:t.status,currentStepId:t.currentStepId,doneStepIds:t.doneStepIds,createdAt:t.createdAt,updatedAt:t.createdAt})),logs:e.live.logs.map(t=>({id:t.id,ts:t.ts,itemId:t.ticketId,stepId:t.stepId,level:t.level,text:t.text}))}}function ZL(e){return{tickets:e.records.map(t=>({id:t.id,title:t.title,customer:t.id,category:"真实记录",priority:t.state,status:t.status,currentStepId:t.currentStepId,doneStepIds:t.doneStepIds,createdAt:t.createdAt})),logs:e.logs.map(t=>({id:t.id,ts:t.ts,ticketId:t.itemId,stepId:t.stepId,level:t.level,text:t.text}))}}function Gs(e,t){return e.some(r=>r.ticketId===t.ticketId&&r.stepId===t.stepId&&r.level===t.level&&r.text===t.text)?e:[...e,t]}function qs(e,t,n="run",r="run"){return{id:`run_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`,ts:Date.now(),ticketId:n,stepId:r,level:e,text:t}}function JL(e){if(!Ur(e)||!Ur(e.schema))return null;const t=Array.isArray(e.schema.fields)?e.schema.fields.filter(iD):[],n=Array.isArray(e.schema.views)?e.schema.views.filter(oD):[];return{fields:t,views:n}}function eD(e,t){var s,i;const n=(s=e==null?void 0:e.stages.design)==null?void 0:s.task;if(t.status!=="blocked"||t.checkpoint!=="discovery_waiting_user"||(n==null?void 0:n.status)!=="blocked")return null;const r=(i=n.outputs)==null?void 0:i.discovery;return!Ur(r)||!aD(r.form)||typeof r.summary!="string"||!Ur(r.answers)||typeof r.confirmed!="boolean"?null:{form:r.form,answers:r.answers,summary:r.summary,confirmed:r.confirmed,clarifications:typeof r.clarifications=="string"?r.clarifications:void 0}}function tD(e){var u;const t=(u=e.find(d=>d.path==="aitable-workflow.config.yml"))==null?void 0:u.content;if(!t)return null;const n=Un(t,"name")??"",r=Un(t,"base_id"),s=Un(t,"table_id")??"",i=Un(t,"provider"),o=Un(t,"model"),l=Un(t,"engine"),c=rD(t,"scene")??"";return!r&&!i&&!o?null:{name:n,agentsSelected:l==="qoder"||l==="codex"?[l]:["claude"],selectedMachineId:"",tableConnected:!!r,tableBaseId:r??"",tableId:s,llmProvider:i??"",llmModel:o??"",roles:nD(e),sop:c}}function nD(e){return e.filter(t=>t.path.startsWith("roles/")&&t.path.endsWith(".role.yml")&&t.content).map(t=>{const n=Un(t.content,"id")??"",r=Un(t.content,"name")??"",s=Un(t.content,"persona")??"";return{id:n,name:r,persona:s,skills:[],knowledge:[]}}).filter(t=>t.id&&t.name)}function Un(e,t){const n=new RegExp(`^\\s*${t}:\\s*(?:"([^"]*)"|'([^']*)'|([^#\\n]*))`,"m"),r=e.match(n),s=(r==null?void 0:r[1])??(r==null?void 0:r[2])??(r==null?void 0:r[3]),i=s==null?void 0:s.trim();return i||null}function rD(e,t){const n=new RegExp(`^${t}:\\s*\\|\\n([\\s\\S]*?)(?=\\n\\S|$)`,"m"),r=e.match(n);return r!=null&&r[1]&&r[1].split(`
59
+ `).map(i=>i.replace(/^ /,"")).join(`
60
+ `).trim()||null}function sD(e,t){if(!Ur(e))return null;const n=e[t];return typeof n=="string"&&n.trim()?n:null}function iD(e){return Ur(e)&&typeof e.id=="string"&&typeof e.name=="string"&&typeof e.type=="string"&&(e.group==="business"||e.group==="process")}function oD(e){return Ur(e)&&typeof e.id=="string"&&typeof e.name=="string"&&(e.kind==="grid"||e.kind==="kanban"||e.kind==="calendar"||e.kind==="form"||e.kind==="gantt")&&typeof e.desc=="string"}function Ur(e){return typeof e=="object"&&e!==null}function aD(e){return Ur(e)&&typeof e.id=="string"&&typeof e.title=="string"&&Array.isArray(e.questions)}function lD(e){return e==="home"||e==="init"||e==="design"||e==="setup"||e==="adjust"||e==="test"||e==="run"||e==="account"||e==="engines"}const jr={init:"尚未开始配置",design:"尚未开始设计",setup:"尚未开始搭建",adjust:"尚未开始参数调整",test:"尚未开始试运行",run:"尚未开始运行"},ek={init:{status:"idle",message:jr.init},design:{status:"idle",message:jr.design},setup:{status:"idle",message:jr.setup},adjust:{status:"idle",message:jr.adjust,local:!0},test:{status:"idle",message:jr.test,local:!0},run:{status:"idle",message:jr.run}};function cD(){return{...ek}}const tk=["init","design","setup","run"];function uD(e,t){var s,i,o;if(!e)return{status:"idle",message:jr[t]};const{task:n,recoveryAction:r}=e;return{status:n.status,taskId:n.id,checkpoint:n.checkpoint,message:((s=n.block)==null?void 0:s.message)??((i=n.error)==null?void 0:i.message)??n.currentAction??dD(n.status,t),retryable:((o=n.error)==null?void 0:o.retryable)??(n.status==="blocked"||n.status==="failed"),block:n.block,error:n.error,recoveryAction:r}}function dD(e,t){return e==="running"?"任务运行中":e==="blocked"?"任务等待处理":e==="failed"?"任务失败":e==="succeeded"?"任务完成":e==="cancelled"?"任务已取消":jr[t]}function od(e){var r;const t=(r=e.projectState)==null?void 0:r.stages;if(!t)return cD();const n={...ek};for(const s of tk)n[s]=uD(t[s],s);return n.init.status==="idle"&&fD(e)&&(n.init={status:"succeeded",message:"配置已完成",retryable:!1}),n}function fD(e){var t;return!!((t=e.projectState)!=null&&t.stages.design)||Rg(e)||e.files.some(n=>n.path==="views.yml"||n.path.startsWith("recipes/"))}function Rg(e){return e.files.some(t=>t.path==="workflow.yml"||t.path.endsWith("/workflow.yml"))}function nk(e){return Rg(e)&&(!!e.workflow||e.files.some(t=>t.path.endsWith("/workflow.yml")))}function hD(e){var r,s,i,o;if(e.mode!=="live")return{kind:"unsupported",message:"演示模式不提供设计能力,请切换到真实模式"};const t=e.runtime??od(e.snapshot).design,n=eD(e.snapshot.projectState,t);if(n)return{kind:"discovery_waiting_user",discovery:n,submitLabel:((r=t.recoveryAction)==null?void 0:r.label)??"确认并开始设计"};switch(t.status){case"idle":return{kind:"not_started"};case"running":return t.checkpoint==="discovery_confirmed"||e.live.designRound!==null?{kind:"generating",checkpoint:t.checkpoint,message:e.live.designMessage||t.message,round:e.live.designRound,agentEvents:e.live.designAgentEvents}:{kind:"discovery_preparing",message:e.live.designMessage||t.message};case"blocked":return{kind:"discovery_preparing",message:((s=t.block)==null?void 0:s.message)??t.message};case"succeeded":return{kind:"done",rounds:e.live.designRounds,agentEvents:e.live.designAgentEvents};case"failed":case"cancelled":return{kind:"failed",message:((i=t.error)==null?void 0:i.message)??t.message,retryable:((o=t.error)==null?void 0:o.retryable)??t.retryable??!0}}}function pD(e,t,n){var s;return n!=="live"?{kind:"open"}:t.design.status==="succeeded"||Rg(e)||(((s=e.workflow)==null?void 0:s.steps.length)??0)>0?{kind:"open"}:{kind:"blocked",reason:"搭建阶段必须使用当前流程生成的 workflow 和 recipes,请先完成设计阶段。",backTo:"design"}}function g_(e,t,n){return t!=="live"||e.setup.status==="succeeded"?{kind:"open"}:{kind:"blocked",reason:n,backTo:"setup"}}function mD(e,t){var n;return t!=="live"?null:e.setup.status==="failed"&&((n=e.setup.error)==null?void 0:n.code)==="TABLE_ID_NOT_RETURNED"?"manual_table_id":e.setup.status==="failed"||e.setup.status==="blocked"?"retry":null}function gD(e){var n;const t=(n=e.projectState)==null?void 0:n.runSnapshot;return{tickets:(t==null?void 0:t.records.map(r=>({id:r.id,title:r.title,customer:r.id,category:"真实记录",priority:r.state,status:r.status,currentStepId:r.currentStepId,doneStepIds:r.doneStepIds,createdAt:r.createdAt})))??[],logs:(t==null?void 0:t.logs.map(r=>({id:r.id,ts:r.ts,ticketId:r.itemId,stepId:r.stepId,level:r.level,text:r.text})))??[]}}function rk(e){var t,n;return sD((n=(t=e.projectState)==null?void 0:t.stages.setup)==null?void 0:n.task.outputs,"tableUrl")}function vD(e){var r;const t=e.projectState;if(!t)return null;if(t.activeStage&&t.stages[t.activeStage])return t.activeStage;let n=null;for(const s of tk){const i=(r=t.stages[s])==null?void 0:r.task;i&&(!n||i.updatedAt.localeCompare(n.updatedAt)>=0)&&(n={stage:s,updatedAt:i.updatedAt})}return(n==null?void 0:n.stage)??null}function sk(e,t="init"){const n=od(e);if(n.setup.status==="blocked"||n.setup.status==="failed")return"setup";const r=vD(e);return r==="design"&&n.design.status==="succeeded"&&nk(e)?"setup":r??t}function yD(e){for(const t of["design","setup","run"])if(e[t].status==="running")return{stage:t,taskId:e[t].taskId??null};return null}const _D=["init","design","setup","adjust","test","run"];function xD(e){return _D.includes(e)}function wD(e){var r,s;const{route:t}=e;if(t==="home")return{kind:"home"};if(t==="account")return{kind:"account"};if(t==="engines")return{kind:"engines"};if(e.loading.phase==="loading")return{kind:"loading",projectId:e.loading.projectId};if(e.loading.phase==="error")return{kind:"load_error",projectId:e.loading.projectId,message:e.loading.error??"项目加载失败"};if(t==="adjust")return{kind:"adjust"};if(!e.snapshot.projectId)return{kind:"no_project",intended:xD(t)?t:"init"};const n=od(e.snapshot);switch(t){case"init":return{kind:"init",runtime:n.init,config:e.initDraft,complete:n.init.status==="succeeded"};case"design":return{kind:"design",runtime:n.design,sub:hD({snapshot:e.snapshot,live:e.live,mode:e.mode,runtime:n.design}),hasArtifacts:nk(e.snapshot)};case"setup":return{kind:"setup",runtime:n.setup,gate:pD(e.snapshot,n,e.mode),schema:e.mode==="mock"&&e.mockSetup?{fields:e.mockSetup.fields,views:e.mockSetup.views}:JL((s=(r=e.snapshot.projectState)==null?void 0:r.stages.setup)==null?void 0:s.task.outputs)??{fields:[],views:[]},tableUrl:e.mode==="mock"&&e.mockSetup?e.mockSetup.tableUrl:rk(e.snapshot),recovery:mD(n,e.mode)};case"test":return{kind:"test",runtime:n.test,gate:g_(n,e.mode,"试运行必须基于已搭建完成的 AI 表格,请先完成搭建阶段。")};case"run":return{kind:"run",runtime:n.run,gate:g_(n,e.mode,"正式运行必须基于已搭建完成的 AI 表格,请先完成搭建阶段。"),tickets:e.live.tickets,logs:e.live.logs}}}function as(){return{projectId:null,projects:[],files:[],projectState:null,workflow:null,workflows:[],currentWorkflowId:null,workflowFiles:[],engineBinding:null,init:null}}function Pl(){return{designRound:null,designRounds:null,designAgentEvents:0,designProgressStep:null,designMessage:"",tickets:[],logs:[]}}aj({enforceActions:"always",computedRequiresReaction:!1});const v_="aitable-workflow:shell-state:v2",bD="aitable-workflow:state:v1",_f={name:"",agentsSelected:[],selectedMachineId:"",tableConnected:!1,tableBaseId:"",tableId:"",llmProvider:"",llmModel:"",roles:[],sop:""};class jD{constructor(){le(this,"route","home");le(this,"theme","light");le(this,"layout",{railCollapsed:!1,chatCollapsed:!1,chatWidth:460});le(this,"projectSource","new");le(this,"agentTraceOpen",!1);le(this,"agentTraceLog",[]);le(this,"initDraft",{..._f});le(this,"validation",{});le(this,"stepStatus",{});le(this,"mockSetup",{fields:[],views:[],tableUrl:null});le(this,"mode",ue?"live":"mock");le(this,"snapshot",as());le(this,"loading",{phase:"idle",projectId:null});le(this,"live",Pl());le(this,"persistedProjectId",null);le(this,"persistedWorkflowId",null);uj(this,{route:ve,theme:ve,layout:ve,projectSource:ve,agentTraceOpen:ve,agentTraceLog:ve.ref,initDraft:ve,validation:ve,stepStatus:ve,mockSetup:ve,snapshot:ve,loading:ve,live:ve,view:bn,stageRuntime:bn,stream:bn,recommendedStage:bn,steps:bn,edges:bn,setRoute:ie,toggleTheme:ie,setRailCollapsed:ie,setChatCollapsed:ie,setChatWidth:ie,setProjectSource:ie,setAgentTraceOpen:ie,toggleAgentTrace:ie,appendAgentTrace:ie,clearAgentTrace:ie,patchInitDraft:ie,setValidation:ie,setStepStatus:ie,addMockField:ie,addMockView:ie,setMockTableUrl:ie,addTicket:ie,updateTicket:ie,appendLog:ie,startNewWorkflow:ie,beginNewProject:ie,setEngineBinding:ie,reset:ie,beginLoad:ie,failLoad:ie,applyLoadedProject:ie,applySnapshotPatch:ie,applyServerFiles:ie,applyServerWorkflow:ie,setCurrentWorkflow:ie,setProjects:ie,setWorkflows:ie,clearProject:ie,patchLive:ie,applyDesignEvent:ie,applySetupEvent:ie,applyRunEvent:ie,applyRunRecords:ie,applyRunSchedule:ie,appendRunTimelineEntry:ie,appendRunPollError:ie}),this.hydrateFromStorage(),this.installPersistence()}get view(){return wD({route:this.route,loading:this.loading,snapshot:this.snapshot,live:this.live,mode:this.mode,initDraft:this.initDraft,mockSetup:this.mockSetup})}get stageRuntime(){return od(this.snapshot)}get stream(){return yD(this.stageRuntime)}get recommendedStage(){return sk(this.snapshot)}get steps(){var n;return(((n=this.snapshot.workflow)==null?void 0:n.steps)??[]).map(r=>this.stepStatus[r.id]?{...r,status:this.stepStatus[r.id]}:r)}get edges(){var t;return((t=this.snapshot.workflow)==null?void 0:t.edges)??[]}get validationContext(){return{steps:this.steps,init:this.initDraft,stageRuntime:this.stageRuntime}}get tableUrl(){return this.mode==="mock"?this.mockSetup.tableUrl:rk(this.snapshot)}get projectId(){return this.snapshot.projectId}get projects(){return this.snapshot.projects}get projectFiles(){return this.snapshot.files}get workflows(){return this.snapshot.workflows}get currentWorkflowId(){return this.snapshot.currentWorkflowId}get workflowFiles(){return this.snapshot.workflowFiles}setRoute(t){this.route=t}toggleTheme(){this.theme=this.theme==="light"?"dark":"light",typeof document<"u"&&document.documentElement.setAttribute("data-theme",this.theme)}setRailCollapsed(t){this.layout={...this.layout,railCollapsed:t}}setChatCollapsed(t){this.layout={...this.layout,chatCollapsed:t}}setChatWidth(t){this.layout={...this.layout,chatWidth:t,chatCollapsed:!1}}setProjectSource(t){this.projectSource=t}setAgentTraceOpen(t){this.agentTraceOpen=t}toggleAgentTrace(){this.agentTraceOpen=!this.agentTraceOpen}appendAgentTrace(t){const n=AL(this.agentTraceLog,Array.isArray(t)?t:[t]);n!==this.agentTraceLog&&(this.agentTraceLog=n)}clearAgentTrace(){this.agentTraceLog.length!==0&&(this.agentTraceLog=[])}patchInitDraft(t){this.initDraft={...this.initDraft,...t}}setValidation(t,n){this.validation={...this.validation,[t]:n}}setStepStatus(t,n){const r={...this.stepStatus};n?r[t]=n:delete r[t],this.stepStatus=r}addMockField(t){this.mockSetup={...this.mockSetup,fields:[...this.mockSetup.fields,t]}}addMockView(t){this.mockSetup={...this.mockSetup,views:[...this.mockSetup.views,t]}}setMockTableUrl(t){this.mockSetup={...this.mockSetup,tableUrl:t}}addTicket(t){this.live={...this.live,tickets:[t,...this.live.tickets]}}updateTicket(t,n){this.live={...this.live,tickets:this.live.tickets.map(r=>r.id===t?{...r,...n}:r)}}appendLog(t){this.live={...this.live,logs:[...this.live.logs,t]}}beginNewProject(t,n){this.startNewWorkflow(),this.projectSource="new",this.snapshot={...as(),projects:this.snapshot.projects,projectId:t},this.initDraft={..._f,name:n},this.loading={phase:"ready",projectId:t}}startNewWorkflow(){this.route="init",this.initDraft={..._f},this.live=Pl(),this.stepStatus={},this.mockSetup={fields:[],views:[],tableUrl:null},this.validation={},this.agentTraceLog=[],this.snapshot={...as(),projects:this.snapshot.projects,projectId:this.snapshot.projectId}}reset(){this.route="home",this.projectSource="new",this.startNewWorkflow(),this.route="home",this.snapshot={...as(),projects:this.snapshot.projects},this.loading={phase:"idle",projectId:null}}beginLoad(t){this.loading={phase:"loading",projectId:t}}failLoad(t,n){this.loading={phase:"error",projectId:t,error:n}}applyLoadedProject(t){this.snapshot=t.snapshot,this.live={...Pl(),...t.live},this.stepStatus={},t.snapshot.init&&(this.initDraft=t.snapshot.init),t.route&&(this.route=t.route),this.loading={phase:"ready",projectId:t.snapshot.projectId}}applySnapshotPatch(t,n){return this.snapshot.projectId!==t?!1:(this.snapshot={...this.snapshot,...n},!0)}applyServerFiles(t,n){return this.applySnapshotPatch(t,{files:n})}applyServerWorkflow(t,n){return this.applySnapshotPatch(t,{workflow:n})}setCurrentWorkflow(t,n){this.snapshot={...this.snapshot,currentWorkflowId:t,workflowFiles:n}}setProjects(t){this.snapshot={...this.snapshot,projects:t}}setWorkflows(t){this.snapshot={...this.snapshot,workflows:t}}setEngineBinding(t,n){this.applySnapshotPatch(t,{engineBinding:n})}clearProject(t){this.snapshot={...as(),projects:t},this.live=Pl(),this.stepStatus={},this.loading={phase:"idle",projectId:null},this.route="home",this.projectSource="new"}patchLive(t,n){return this.snapshot.projectId!==t?!1:(this.live={...this.live,...n},!0)}applyDesignEvent(t,n){return this.applyReducerPatch(t,r=>OL(r,n))}applySetupEvent(t,n){return this.applyReducerPatch(t,r=>$L(r,n))}applyRunEvent(t,n){return this.applyReducerPatch(t,r=>BL(r,n))}applyRunSchedule(t,n){return this.applyReducerPatch(t,r=>HL(r,n))}applyRunRecords(t,n){return this.applyReducerPatch(t,r=>UL(r,n))}appendRunTimelineEntry(t,n){return this.applyReducerPatch(t,r=>KL(r,n))}appendRunPollError(t,n){return this.applyReducerPatch(t,r=>GL(r,n))}applyReducerPatch(t,n){if(this.snapshot.projectId!==t)return!1;const r=n({projectId:t,projectState:this.snapshot.projectState,live:this.live,steps:this.steps});return(r.projectState||r.files)&&(this.snapshot={...this.snapshot,...r.projectState?{projectState:r.projectState}:{},...r.files?{files:r.files}:{}}),r.live&&(this.live={...this.live,...r.live}),!0}hydrateFromStorage(){if(!(typeof window>"u"))try{const t=window.localStorage.getItem(v_)??window.localStorage.getItem(bD);if(!t)return;const n=JSON.parse(t);if(typeof n!="object"||n===null)return;const r=n,s=lD(r.stage)?r.stage:"home",i=typeof r.projectId=="string"&&r.projectId.trim()?r.projectId:null,o=s!=="home"&&s!=="account"&&s!=="engines";K2(()=>{this.route=o&&!i?"home":s,(r.theme==="dark"||r.theme==="light")&&(this.theme=r.theme),typeof r.layout=="object"&&r.layout!==null&&(this.layout={...this.layout,...r.layout}),this.persistedProjectId=i,this.persistedWorkflowId=typeof r.currentWorkflowId=="string"&&r.currentWorkflowId.trim()?r.currentWorkflowId:null})}catch{}}installPersistence(){typeof window>"u"||sj(()=>{const t={version:2,stage:this.route,theme:this.theme,layout:this.layout,projectId:this.snapshot.projectId,currentWorkflowId:this.snapshot.currentWorkflowId};try{window.localStorage.setItem(v_,JSON.stringify(t))}catch{}})}}const z=new jD,SD={sparkle:"M12 2l1.9 5.8L20 9.7l-5.1 3.7L16 20l-4-3.6L8 20l1.1-6.6L4 9.7l6.1-1.9z",check:"M4 12l5 5L20 6","chevron-right":"M9 6l6 6-6 6","chevron-down":"M6 9l6 6 6-6","chevron-left":"M15 6l-6 6 6 6","chevron-up":"M6 15l6-6 6 6",plus:"M12 5v14M5 12h14",play:"M7 5v14l12-7z",pause:"M8 5v14M16 5v14",refresh:"M23 4v6h-6 M1 20v-6h6 M3.51 9a9 9 0 0114.85-3.36L23 10 M1 14l4.64 4.36A9 9 0 0020.49 15",moon:"M21 12.8A9 9 0 1111.2 3a7 7 0 009.8 9.8z",sun:"M12 4V2M12 22v-2M4 12H2M22 12h-2M5.6 5.6L4.2 4.2M19.8 19.8l-1.4-1.4M18.4 5.6l1.4-1.4M4.2 19.8l1.4-1.4M12 8a4 4 0 100 8 4 4 0 000-8z",table:"M3 5h18v14H3zM3 10h18M9 10v9M15 10v9",flow:"M5 5h5v5H5zM14 14h5v5h-5zM10 7h4M12 10v4",robot:"M12 3v3M7 6h10a2 2 0 012 2v9a2 2 0 01-2 2H7a2 2 0 01-2-2V8a2 2 0 012-2zM9 12h.01M15 12h.01",lock:"M6 11V8a6 6 0 0112 0v3M5 11h14v9H5z",bolt:"M13 2L4 14h6l-1 8 9-12h-6z",file:"M6 2h8l4 4v16H6zM14 2v4h4",folder:"M3 6h6l2 2h10v12H3z",link:"M10 13a5 5 0 007 0l2-2a5 5 0 00-7-7l-1 1M14 11a5 5 0 00-7 0l-2 2a5 5 0 007 7l1-1",send:"M22 2L11 13M22 2l-7 20-4-9-9-4z",user:"M12 12a4 4 0 100-8 4 4 0 000 8zM4 21a8 8 0 0116 0",warn:"M12 3l10 18H2zM12 10v5M12 18h.01",close:"M6 6l12 12M18 6L6 18",dot:"M12 12h.01"};function V({name:e,size:t=16,color:n="currentColor",style:r}){const s=e==="play"||e==="pause"||e==="sparkle"||e==="bolt";return a.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:s?n:"none",stroke:s?"none":n,strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",style:r,"aria-hidden":!0,children:a.jsx("path",{d:SD[e]})})}const kD="";async function ND(e,t){return await(await ik("/api/auth/register",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({username:e,password:t})})).json()}async function ED(e,t){return await(await ik("/api/auth/login",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({username:e,password:t})})).json()}async function ik(e,t){var r;let n;try{n=await fetch(`${kD}${e}`,t)}catch(s){const i=s instanceof Error?s.message:String(s);throw new Error(`无法连接后端服务(当前站点):${i}`)}if(!n.ok){const s=await n.text();try{const i=JSON.parse(s);if((r=i.error)!=null&&r.message)throw new Error(i.error.message)}catch(i){if(i instanceof Error&&i.message!==s)throw i}throw new Error(s||`HTTP ${n.status}`)}return n}const mp="aitable-auth:v1";function CD(){if(typeof window>"u")return{token:null,user:null};try{const e=window.localStorage.getItem(mp);if(!e)return{token:null,user:null};const t=JSON.parse(e);return{token:typeof t.token=="string"?t.token:null,user:t.user??null}}catch{return{token:null,user:null}}}function AD(e){if(!(typeof window>"u"))try{e.token?window.localStorage.setItem(mp,JSON.stringify(e)):window.localStorage.removeItem(mp)}catch{}}let xr=CD();const gp=new Set;function xf(){AD(xr);for(const e of gp)e()}const As={get(){return xr},isLoggedIn(){return xr.token!==null&&xr.user!==null},async login(e,t){const n=await ED(e,t);xr={token:n.token,user:n.user},xf()},async register(e,t){const n=await ND(e,t);xr={token:n.token,user:n.user},xf()},logout(){xr={token:null,user:null},xf()},getToken(){return xr.token},subscribe(e){return gp.add(e),()=>{gp.delete(e)}}},TD={token:null,user:null};function Og(){return b.useSyncExternalStore(As.subscribe,()=>As.get(),()=>TD)}let cu=null;function PD(e){cu=e}function MD(){return cu!==null}function ID(){const t=new URLSearchParams(window.location.search).get("token");if(t){PD(t);const n=new URL(window.location.href);return n.searchParams.delete("token"),window.history.replaceState({},"",n.toString()),!0}return!1}async function Bs(e,t){if(!cu)throw new Error("Dev token not set");const n=await fetch(e,{...t,headers:{...t==null?void 0:t.headers,Authorization:`Bearer ${cu}`}});if(!n.ok){const r=await n.text();try{const s=JSON.parse(r);if(s.error)throw new Error(s.error)}catch(s){if(s instanceof Error&&s.message!==r)throw s}throw new Error(r||`HTTP ${n.status}`)}return n}async function y_(e){return await(await Bs("/dev/config/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates:e})})).json()}async function RD(){await Bs("/dev/setup/complete",{method:"POST"})}async function OD(e,t){return await(await Bs("/dev/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({roleId:e,files:t})})).json()}async function $D(e,t){return await(await Bs("/dev/kb/ingest",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({roleId:e,source:t})})).json()}async function LD(){return await(await Bs("/dev/config/enriched")).json()}async function DD(e){return await(await Bs(`/dev/file/read?path=${encodeURIComponent(e)}`)).json()}async function zD(e,t){return await(await Bs("/dev/file/write",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,content:t})})).json()}const VD=[{id:"init",label:"配置"},{id:"design",label:"设计"},{id:"setup",label:"搭建"},{id:"test",label:"试运行"},{id:"run",label:"运行"}],FD=[{id:"adjust",label:"参数调整"}],BD=ut(function(){const t=z.route,n=z.stageRuntime,r=z.projectSource,s=MD()?FD:VD;return a.jsx("nav",{className:"stepper","aria-label":"阶段进度",children:s.map((i,o)=>{const l=i.id===t,c=n[i.id].status==="succeeded",u=r==="imported"&&(i.id==="init"||i.id==="design"||i.id==="setup");return a.jsxs(b.Fragment,{children:[o>0&&a.jsx("span",{className:"stepper__sep"}),a.jsxs("button",{type:"button",className:"stepper__item"+(l?" is-active":"")+(c||u?" is-done":""),onClick:()=>z.setRoute(i.id),title:u?"已随包导入":void 0,children:[a.jsx("span",{className:"stepper__num",children:c||u?a.jsx(V,{name:"check",size:12}):o+1}),i.label]})]},i.id)})})}),HD="";async function $g(){return(await(await ye("/api/projects",{method:"POST"})).json()).project}async function UD(e,t){const n={};return e&&e.trim()&&(n.title=e.trim()),t&&t.length>0&&(n.files=t),await(await ye("/api/projects",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)})).json()}async function WD(e){return await(await ye(`/api/projects/${e}`,{method:"DELETE"})).json()}async function KD(e){return await(await ye(`/api/projects/${e}/export`)).json()}async function GD(e){return await(await ye(`/api/projects/${e}/validate`,{method:"POST"})).json()}async function vp(e){return(await(await ye(`/api/projects/${e}/workflows`)).json()).workflows}async function qD(e,t){const n={name:t.name};return t.templatePath&&(n.templatePath=t.templatePath),t.files&&t.files.length>0&&(n.files=t.files),await(await ye(`/api/projects/${e}/workflows`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)})).json()}async function yp(e,t){return await(await ye(`/api/projects/${e}/workflows/${t}`)).json()}async function YD(e,t){return await(await ye(`/api/projects/${e}/workflows/${t}`,{method:"DELETE"})).json()}async function ok(){await ye("/api/health")}async function XD(){return await(await ye("/api/agents")).json()}async function ak(){return(await(await ye("/api/projects")).json()).projects}async function QD(e,t){return(await(await ye(`/api/projects/${e}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({title:t})})).json()).project}async function Lg(e){return await(await ye(`/api/projects/${e}/state`)).json()}async function ZD(e,t){return await(await ye(`/api/projects/${e}/init`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)})).json()}async function JD(e,t){return await(await ye(`/api/projects/${e}/table-id`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({tableId:t})})).json()}async function e3(e){return await(await ye(`/api/projects/${e}/design/discovery`,{method:"POST"})).json()}async function t3(e,t){return await(await ye(`/api/projects/${e}/design/discovery/confirm`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({answers:t})})).json()}async function ad(e,t){const n=t?`?workflowId=${encodeURIComponent(t)}`:"",s=await(await ye(`/api/projects/${e}/workflow${n}`)).json();return p3(s.workflow)}async function Dg(e){return(await(await ye(`/api/projects/${e}/files`)).json()).files}async function n3(e,t){await ck(`/api/projects/${e}/design`,t)}async function r3(e,t){await ck(`/api/projects/${e}/setup`,t)}async function s3(e,t,n){const r=`/api/projects/${e}/run`,s=await ye(r,{method:"POST",signal:n==null?void 0:n.signal});return c3(s)?{mode:"lease",schedule:(await s.json()).schedule}:(await uk(r,s,t,n),{mode:"local"})}async function i3(e){return await(await ye(`/api/projects/${e}/run/stop`,{method:"POST"})).json()}async function o3(e){return await(await ye(`/api/projects/${e}/run/status`)).json()}async function a3(e,t){return await(await ye(`/api/projects/${e}/run/records`)).json()}async function l3(e,t){const n=new URLSearchParams;t!=null&&t.afterSeq&&n.set("afterSeq",String(t.afterSeq)),t!=null&&t.limit&&n.set("limit",String(t.limit));const r=n.size>0?`?${n.toString()}`:"";return await(await ye(`/api/projects/${e}/run/events${r}`)).json()}function c3(e){return(e.headers.get("content-type")??"").includes("application/json")}async function u3(e,t,n){return(await(await ye(`/api/projects/${e}/run/records/${t}/human-action`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:n})})).json()).state}async function fc(e){return await(await ye(`/api/projects/${e}/engine`)).json()}async function lk(e,t){await ye(`/api/projects/${e}/engine`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({machineId:t})})}async function ye(e,t){var s;const n=As.getToken();if(n){const i=new Headers(t==null?void 0:t.headers);i.set("Authorization",`Bearer ${n}`),t={...t,headers:i}}let r;try{r=await fetch(`${HD}${e}`,t)}catch(i){const o=i instanceof Error?i.message:String(i);throw new Error(`无法连接真实后端服务(当前站点):${o}`)}if(!r.ok){const i=await r.text();try{const o=JSON.parse(i);if((s=o.error)!=null&&s.message)throw new Error(o.error.message)}catch(o){if(o instanceof Error&&o.message!==i)throw o}throw new Error(i||`HTTP ${r.status}`)}return r}const d3=5,f3=500,h3=8e3;async function ck(e,t,n){const r=await ye(e,{method:"POST",signal:n==null?void 0:n.signal});await uk(e,r,t,n)}async function uk(e,t,n,r){var l,c;let s=null,i=0,o=t;for(;;){if((l=r==null?void 0:r.signal)!=null&&l.aborted)return;try{if(!o){const h=s?`${e}${e.includes("?")?"&":"?"}cursor=${encodeURIComponent(s)}`:e;o=await ye(h,{method:"POST",signal:r==null?void 0:r.signal})}if(!o.body)return;const u=o.body.getReader(),d=new TextDecoder;let f="";for(;;){const{done:h,value:p}=await u.read();if(h)return;i=0,f+=d.decode(p,{stream:!0});const v=f.split(`
61
+
62
+ `);f=v.pop()??"";for(const x of v){const w=x.split(`
63
+ `),g=w.find(m=>m.startsWith("id: "));g&&(s=g.slice(4).trim());const y=w.find(m=>m.startsWith("data: "));y&&await n(JSON.parse(y.slice(6)))}}}catch(u){if((c=r==null?void 0:r.signal)!=null&&c.aborted)return;if(o=null,i+=1,i>d3)throw u;const d=Math.min(h3,f3*2**(i-1));await new Promise(f=>setTimeout(f,d))}}}function p3(e){return{steps:e.steps.map(t=>({id:t.id,name:t.name,recipe:t.recipe??"",engine:m3(t.engine),auto:t.auto,requiresAgent:!!t.requires_agent,needsHuman:!!t.needs_human,inputs:Object.values(t.input_mapping??{}),outputs:Object.values(t.output_mapping??{}),status:"idle"})),edges:e.edges.filter(t=>t.from!=="__start__"&&t.to!=="__end__")}}function m3(e){return e==="claude"||e==="codex"||e==="qoder"||e==="qwenwork"||e==="llm_only"?e:"llm_only"}async function g3(e,t){const n=await vp(e);if(n.length===0)return{workflows:[],currentWorkflowId:null,workflowFiles:[]};const r=t&&n.some(i=>i.id===t)?t:n[0].id;let s=[];try{s=(await yp(e,r)).files}catch{}return{workflows:n,currentWorkflowId:r,workflowFiles:s}}async function ba(e,t={}){if(!ue)return;const n=e??"@first",r=wf.get(n);if(r)return r;const s=v3(e,t).finally(()=>{wf.delete(n)});return wf.set(n,s),s}const wf=new Map;async function v3(e,t){z.beginLoad(e);try{await ok();const n=await ak();if(e&&!n.some(o=>o.id===e)){z.clearProject(n);return}const r=e?n.find(o=>o.id===e):n[0];if(!r){z.clearProject(n);return}const s=await _3(r.id,n),i=t.applyRecommendedStage===!1?void 0:sk(s,x3(t.fallbackRoute));z.applyLoadedProject({snapshot:s,live:gD(s),route:i})}catch(n){z.failLoad(e,n instanceof Error?n.message:String(n))}}async function __(e){if(!ue)return;const t=await Lg(e).catch(()=>null);t&&z.applySnapshotPatch(e,{projectState:t})}async function y3(e,t={}){const n=t.intervalMs??2e3,r=t.timeoutMs??10*60*1e3,s=Date.now()+r;for(;Date.now()<s;){if(await new Promise(o=>setTimeout(o,n)),z.projectId!==e)return;const i=await Lg(e).catch(()=>null);if(i&&(!z.applySnapshotPatch(e,{projectState:i})||!z.stream))return}}async function _3(e,t){const n=await Dg(e),r=await Lg(e).catch(()=>null),s=await g3(e,z.persistedWorkflowId).catch(()=>({workflows:[],currentWorkflowId:null,workflowFiles:[]})),i=n.some(c=>c.path==="workflow.yml"||c.path.endsWith("/workflow.yml"))?await ad(e,s.currentWorkflowId).catch(()=>null):null,o=it?await fc(e).catch(()=>null):null,l=tD(n);return l&&(o!=null&&o.machineId)&&(l.selectedMachineId=o.machineId),{...as(),projectId:e,projects:t,files:n,projectState:r,workflow:i,workflows:s.workflows,currentWorkflowId:s.currentWorkflowId,workflowFiles:s.workflowFiles,engineBinding:o,init:l}}function x3(e){return e&&e!=="home"&&e!=="account"&&e!=="engines"?e:void 0}function dk({onConfirm:e,onCancel:t}){const[n,r]=b.useState("未命名项目");return a.jsx("div",{className:"modal-overlay",onClick:t,children:a.jsxs("div",{className:"import-panel",style:{maxWidth:400},onClick:s=>s.stopPropagation(),children:[a.jsxs("div",{className:"import-panel__head",children:[a.jsx("span",{className:"import-panel__title",children:"新建项目"}),a.jsx("button",{type:"button",className:"modal-card__close",onClick:t,children:a.jsx(V,{name:"close",size:14})})]}),a.jsx("div",{className:"import-panel__body",children:a.jsxs("div",{className:"role-field",children:[a.jsx("label",{className:"role-field__label",children:"项目名称"}),a.jsx("input",{className:"import-confirm__input",value:n,onChange:s=>r(s.target.value),placeholder:"输入项目名称",autoFocus:!0,onKeyDown:s=>{s.key==="Enter"&&n.trim()&&e(n.trim())}})]})}),a.jsxs("div",{className:"import-panel__foot",children:[a.jsx("button",{type:"button",className:"modal-card__btn",onClick:t,children:"取消"}),a.jsx("button",{type:"button",className:"primary modal-card__btn",disabled:!n.trim(),onClick:()=>e(n.trim()),children:"创建项目"})]})]})})}var x_={},w3=function(e,t,n,r,s){var i=new Worker(x_[t]||(x_[t]=URL.createObjectURL(new Blob([e+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return i.onmessage=function(o){var l=o.data,c=l.$e$;if(c){var u=new Error(c[0]);u.code=c[1],u.stack=c[2],s(u,null)}else s(null,l)},i.postMessage(n,r),i},Ce=Uint8Array,ot=Uint16Array,Qa=Int32Array,ro=new Ce([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]),so=new Ce([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]),ja=new Ce([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),fk=function(e,t){for(var n=new ot(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var s=new Qa(n[30]),r=1;r<30;++r)for(var i=n[r];i<n[r+1];++i)s[i]=i-n[r]<<5|r;return{b:n,r:s}},hk=fk(ro,2),zg=hk.b,uu=hk.r;zg[28]=258,uu[258]=28;var pk=fk(so,0),mk=pk.b,_p=pk.r,Sa=new ot(32768);for(var je=0;je<32768;++je){var gr=(je&43690)>>1|(je&21845)<<1;gr=(gr&52428)>>2|(gr&13107)<<2,gr=(gr&61680)>>4|(gr&3855)<<4,Sa[je]=((gr&65280)>>8|(gr&255)<<8)>>1}var Gt=function(e,t,n){for(var r=e.length,s=0,i=new ot(t);s<r;++s)e[s]&&++i[e[s]-1];var o=new ot(t);for(s=1;s<t;++s)o[s]=o[s-1]+i[s-1]<<1;var l;if(n){l=new ot(1<<t);var c=15-t;for(s=0;s<r;++s)if(e[s])for(var u=s<<4|e[s],d=t-e[s],f=o[e[s]-1]++<<d,h=f|(1<<d)-1;f<=h;++f)l[Sa[f]>>c]=u}else for(l=new ot(r),s=0;s<r;++s)e[s]&&(l[s]=Sa[o[e[s]-1]++]>>15-e[s]);return l},fr=new Ce(288);for(var je=0;je<144;++je)fr[je]=8;for(var je=144;je<256;++je)fr[je]=9;for(var je=256;je<280;++je)fr[je]=7;for(var je=280;je<288;++je)fr[je]=8;var Fi=new Ce(32);for(var je=0;je<32;++je)Fi[je]=5;var gk=Gt(fr,9,0),vk=Gt(fr,9,1),yk=Gt(Fi,5,0),_k=Gt(Fi,5,1),hc=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},$t=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},pc=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},Za=function(e){return(e+7)/8|0},Hs=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new Ce(e.subarray(t,n))},xk=["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"],De=function(e,t,n){var r=new Error(t||xk[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,De),!n)throw r;return r},wk=function(e,t,n,r){var s=e.length,i=r?r.length:0;if(!s||t.f&&!t.l)return n||new Ce(0);var o=!n,l=o||t.i!=2,c=t.i;o&&(n=new Ce(s*3));var u=function(te){var ee=n.length;if(te>ee){var X=new Ce(Math.max(ee*2,te));X.set(n),n=X}},d=t.f||0,f=t.p||0,h=t.b||0,p=t.l,v=t.d,x=t.m,w=t.n,g=s*8;do{if(!p){d=$t(e,f,1);var y=$t(e,f+1,3);if(f+=3,y)if(y==1)p=vk,v=_k,x=9,w=5;else if(y==2){var N=$t(e,f,31)+257,k=$t(e,f+10,15)+4,S=N+$t(e,f+5,31)+1;f+=14;for(var P=new Ce(S),$=new Ce(19),D=0;D<k;++D)$[ja[D]]=$t(e,f+D*3,7);f+=k*3;for(var I=hc($),O=(1<<I)-1,E=Gt($,I,1),D=0;D<S;){var A=E[$t(e,f,O)];f+=A&15;var m=A>>4;if(m<16)P[D++]=m;else{var C=0,M=0;for(m==16?(M=3+$t(e,f,3),f+=2,C=P[D-1]):m==17?(M=3+$t(e,f,7),f+=3):m==18&&(M=11+$t(e,f,127),f+=7);M--;)P[D++]=C}}var T=P.subarray(0,N),R=P.subarray(N);x=hc(T),w=hc(R),p=Gt(T,x,1),v=Gt(R,w,1)}else De(1);else{var m=Za(f)+4,_=e[m-4]|e[m-3]<<8,j=m+_;if(j>s){c&&De(0);break}l&&u(h+_),n.set(e.subarray(m,j),h),t.b=h+=_,t.p=f=j*8,t.f=d;continue}if(f>g){c&&De(0);break}}l&&u(h+131072);for(var B=(1<<x)-1,L=(1<<w)-1,F=f;;F=f){var C=p[pc(e,f)&B],W=C>>4;if(f+=C&15,f>g){c&&De(0);break}if(C||De(2),W<256)n[h++]=W;else if(W==256){F=f,p=null;break}else{var U=W-254;if(W>264){var D=W-257,K=ro[D];U=$t(e,f,(1<<K)-1)+zg[D],f+=K}var Q=v[pc(e,f)&L],J=Q>>4;Q||De(3),f+=Q&15;var R=mk[J];if(J>3){var K=so[J];R+=pc(e,f)&(1<<K)-1,f+=K}if(f>g){c&&De(0);break}l&&u(h+131072);var H=h+U;if(h<R){var q=i-R,ne=Math.min(R,H);for(q+h<0&&De(3);h<ne;++h)n[h]=r[q+h]}for(;h<H;++h)n[h]=n[h-R]}}t.l=p,t.p=F,t.b=h,t.f=d,p&&(d=1,t.m=x,t.d=v,t.n=w)}while(!d);return h!=n.length&&o?Hs(n,0,h):n.subarray(0,h)},xn=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},Ys=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},mc=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var s=n.length,i=n.slice();if(!s)return{t:Fg,l:0};if(s==1){var o=new Ce(n[0].s+1);return o[n[0].s]=1,{t:o,l:1}}n.sort(function(j,N){return j.f-N.f}),n.push({s:-1,f:25001});var l=n[0],c=n[1],u=0,d=1,f=2;for(n[0]={s:-1,f:l.f+c.f,l,r:c};d!=s-1;)l=n[n[u].f<n[f].f?u++:f++],c=n[u!=d&&n[u].f<n[f].f?u++:f++],n[d++]={s:-1,f:l.f+c.f,l,r:c};for(var h=i[0].s,r=1;r<s;++r)i[r].s>h&&(h=i[r].s);var p=new ot(h+1),v=du(n[d-1],p,0);if(v>t){var r=0,x=0,w=v-t,g=1<<w;for(i.sort(function(N,k){return p[k.s]-p[N.s]||N.f-k.f});r<s;++r){var y=i[r].s;if(p[y]>t)x+=g-(1<<v-p[y]),p[y]=t;else break}for(x>>=w;x>0;){var m=i[r].s;p[m]<t?x-=1<<t-p[m]++-1:++r}for(;r>=0&&x;--r){var _=i[r].s;p[_]==t&&(--p[_],++x)}v=t}return{t:new Ce(p),l:v}},du=function(e,t,n){return e.s==-1?Math.max(du(e.l,t,n+1),du(e.r,t,n+1)):t[e.s]=n},xp=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new ot(++t),r=0,s=e[0],i=1,o=function(c){n[r++]=c},l=1;l<=t;++l)if(e[l]==s&&l!=t)++i;else{if(!s&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(o(s),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0)}for(;i--;)o(s);i=1,s=e[l]}return{c:n.subarray(0,r),n:t}},Xs=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},Vg=function(e,t,n){var r=n.length,s=Za(t+2);e[s]=r&255,e[s+1]=r>>8,e[s+2]=e[s]^255,e[s+3]=e[s+1]^255;for(var i=0;i<r;++i)e[s+i+4]=n[i];return(s+4+r)*8},wp=function(e,t,n,r,s,i,o,l,c,u,d){xn(t,d++,n),++s[256];for(var f=mc(s,15),h=f.t,p=f.l,v=mc(i,15),x=v.t,w=v.l,g=xp(h),y=g.c,m=g.n,_=xp(x),j=_.c,N=_.n,k=new ot(19),S=0;S<y.length;++S)++k[y[S]&31];for(var S=0;S<j.length;++S)++k[j[S]&31];for(var P=mc(k,7),$=P.t,D=P.l,I=19;I>4&&!$[ja[I-1]];--I);var O=u+5<<3,E=Xs(s,fr)+Xs(i,Fi)+o,A=Xs(s,h)+Xs(i,x)+o+14+3*I+Xs(k,$)+2*k[16]+3*k[17]+7*k[18];if(c>=0&&O<=E&&O<=A)return Vg(t,d,e.subarray(c,c+u));var C,M,T,R;if(xn(t,d,1+(A<E)),d+=2,A<E){C=Gt(h,p,0),M=h,T=Gt(x,w,0),R=x;var B=Gt($,D,0);xn(t,d,m-257),xn(t,d+5,N-1),xn(t,d+10,I-4),d+=14;for(var S=0;S<I;++S)xn(t,d+3*S,$[ja[S]]);d+=3*I;for(var L=[y,j],F=0;F<2;++F)for(var W=L[F],S=0;S<W.length;++S){var U=W[S]&31;xn(t,d,B[U]),d+=$[U],U>15&&(xn(t,d,W[S]>>5&127),d+=W[S]>>12)}}else C=gk,M=fr,T=yk,R=Fi;for(var S=0;S<l;++S){var K=r[S];if(K>255){var U=K>>18&31;Ys(t,d,C[U+257]),d+=M[U+257],U>7&&(xn(t,d,K>>23&31),d+=ro[U]);var Q=K&31;Ys(t,d,T[Q]),d+=R[Q],Q>3&&(Ys(t,d,K>>5&8191),d+=so[Q])}else Ys(t,d,C[K]),d+=M[K]}return Ys(t,d,C[256]),d+M[256]},bk=new Qa([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Fg=new Ce(0),jk=function(e,t,n,r,s,i){var o=i.z||e.length,l=new Ce(r+o+5*(1+Math.ceil(o/7e3))+s),c=l.subarray(r,l.length-s),u=i.l,d=(i.r||0)&7;if(t){d&&(c[0]=i.r>>3);for(var f=bk[t-1],h=f>>13,p=f&8191,v=(1<<n)-1,x=i.p||new ot(32768),w=i.h||new ot(v+1),g=Math.ceil(n/3),y=2*g,m=function(ae){return(e[ae]^e[ae+1]<<g^e[ae+2]<<y)&v},_=new Qa(25e3),j=new ot(288),N=new ot(32),k=0,S=0,P=i.i||0,$=0,D=i.w||0,I=0;P+2<o;++P){var O=m(P),E=P&32767,A=w[O];if(x[E]=A,w[O]=E,D<=P){var C=o-P;if((k>7e3||$>24576)&&(C>423||!u)){d=wp(e,c,0,_,j,N,S,$,I,P-I,d),$=k=S=0,I=P;for(var M=0;M<286;++M)j[M]=0;for(var M=0;M<30;++M)N[M]=0}var T=2,R=0,B=p,L=E-A&32767;if(C>2&&O==m(P-L))for(var F=Math.min(h,C)-1,W=Math.min(32767,P),U=Math.min(258,C);L<=W&&--B&&E!=A;){if(e[P+T]==e[P+T-L]){for(var K=0;K<U&&e[P+K]==e[P+K-L];++K);if(K>T){if(T=K,R=L,K>F)break;for(var Q=Math.min(L,K-2),J=0,M=0;M<Q;++M){var H=P-L+M&32767,q=x[H],ne=H-q&32767;ne>J&&(J=ne,A=H)}}}E=A,A=x[E],L+=E-A&32767}if(R){_[$++]=268435456|uu[T]<<18|_p[R];var te=uu[T]&31,ee=_p[R]&31;S+=ro[te]+so[ee],++j[257+te],++N[ee],D=P+T,++k}else _[$++]=e[P],++j[e[P]]}}for(P=Math.max(P,D);P<o;++P)_[$++]=e[P],++j[e[P]];d=wp(e,c,u,_,j,N,S,$,I,P-I,d),u||(i.r=d&7|c[d/8|0]<<3,d-=7,i.h=w,i.p=x,i.i=P,i.w=D)}else{for(var P=i.w||0;P<o+u;P+=65535){var X=P+65535;X>=o&&(c[d/8|0]=u,X=o),d=Vg(c,d+1,e.subarray(P,X))}i.i=o}return Hs(l,0,r+Za(d)+s)},b3=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(n&1&&-306674912)^n>>>1;e[t]=n}return e}(),j3=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=b3[n&255^t[r]]^n>>>8;e=n},d:function(){return~e}}},Sk=function(e,t,n,r,s){if(!s&&(s={l:1},t.dictionary)){var i=t.dictionary.subarray(-32768),o=new Ce(i.length+e.length);o.set(i),o.set(e,i.length),e=o,s.w=i.length}return jk(e,t.level==null?6:t.level,t.mem==null?s.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,r,s)},Bg=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},w_=function(e,t,n){for(var r=e(),s=e.toString(),i=s.slice(s.indexOf("[")+1,s.lastIndexOf("]")).replace(/\s+/g,"").split(","),o=0;o<r.length;++o){var l=r[o],c=i[o];if(typeof l=="function"){t+=";"+c+"=";var u=l.toString();if(l.prototype)if(u.indexOf("[native code]")!=-1){var d=u.indexOf(" ",8)+1;t+=u.slice(d,u.indexOf("(",d))}else{t+=u;for(var f in l.prototype)t+=";"+c+".prototype."+f+"="+l.prototype[f].toString()}else t+=u}else n[c]=l}return t},Ml=[],S3=function(e){var t=[];for(var n in e)e[n].buffer&&t.push((e[n]=new e[n].constructor(e[n])).buffer);return t},k3=function(e,t,n,r){if(!Ml[n]){for(var s="",i={},o=e.length-1,l=0;l<o;++l)s=w_(e[l],s,i);Ml[n]={c:w_(e[o],s,i),e:i}}var c=Bg({},Ml[n].e);return w3(Ml[n].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+t.toString()+"}",n,c,S3(c),r)},N3=function(){return[Ce,ot,Qa,ro,so,ja,zg,mk,vk,_k,Sa,xk,Gt,hc,$t,pc,Za,Hs,De,wk,Ug,ld,kk]},E3=function(){return[Ce,ot,Qa,ro,so,ja,uu,_p,gk,fr,yk,Fi,Sa,bk,Fg,Gt,xn,Ys,mc,du,xp,Xs,Vg,wp,Za,Hs,jk,Sk,Hg,ld]},ld=function(e){return postMessage(e,[e.buffer])},kk=function(e){return e&&{out:e.size&&new Ce(e.size),dictionary:e.dictionary}},Nk=function(e,t,n,r,s,i){var o=k3(n,r,s,function(l,c){o.terminate(),i(l,c)});return o.postMessage([e,t],t.consume?[e.buffer]:[]),function(){o.terminate()}},Nn=function(e,t){return e[t]|e[t+1]<<8},Dt=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},bf=function(e,t){return Dt(e,t)+Dt(e,t+4)*4294967296},Ge=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function C3(e,t,n){return n||(n=t,t={}),typeof n!="function"&&De(7),Nk(e,t,[E3],function(r){return ld(Hg(r.data[0],r.data[1]))},0,n)}function Hg(e,t){return Sk(e,t||{},0,0)}function A3(e,t,n){return n||(n=t,t={}),typeof n!="function"&&De(7),Nk(e,t,[N3],function(r){return ld(Ug(r.data[0],kk(r.data[1])))},1,n)}function Ug(e,t){return wk(e,{i:2},t&&t.out,t&&t.dictionary)}var Ek=function(e,t,n,r){for(var s in e){var i=e[s],o=t+s,l=r;Array.isArray(i)&&(l=Bg(r,i[1]),i=i[0]),ArrayBuffer.isView(i)?n[o]=[i,l]:(n[o+="/"]=[new Ce(0),l],Ek(i,o,n,r))}},b_=typeof TextEncoder<"u"&&new TextEncoder,bp=typeof TextDecoder<"u"&&new TextDecoder,T3=0;try{bp.decode(Fg,{stream:!0}),T3=1}catch{}var P3=function(e){for(var t="",n=0;;){var r=e[n++],s=(r>127)+(r>223)+(r>239);if(n+s>e.length)return{s:t,r:Hs(e,n-1)};s?s==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):s&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r)}};function jp(e,t){var n;if(b_)return b_.encode(e);for(var r=e.length,s=new Ce(e.length+(e.length>>1)),i=0,o=function(u){s[i++]=u},n=0;n<r;++n){if(i+5>s.length){var l=new Ce(i+8+(r-n<<1));l.set(s),s=l}var c=e.charCodeAt(n);c<128||t?o(c):c<2048?(o(192|c>>6),o(128|c&63)):c>55295&&c<57344?(c=65536+(c&1047552)|e.charCodeAt(++n)&1023,o(240|c>>18),o(128|c>>12&63),o(128|c>>6&63),o(128|c&63)):(o(224|c>>12),o(128|c>>6&63),o(128|c&63))}return Hs(s,0,i)}function Ck(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(bp)return bp.decode(e);var s=P3(e),i=s.s,n=s.r;return n.length&&De(8),i}}var M3=function(e,t){return t+30+Nn(e,t+26)+Nn(e,t+28)},I3=function(e,t,n){var r=Nn(e,t+28),s=Nn(e,t+30),i=Ck(e.subarray(t+46,t+46+r),!(Nn(e,t+8)&2048)),o=t+46+r,l=R3(e,o,s,n,Dt(e,t+20),Dt(e,t+24),Dt(e,t+42)),c=l[0],u=l[1],d=l[2];return[Nn(e,t+10),c,u,i,o+s+Nn(e,t+32),d]},R3=function(e,t,n,r,s,i,o){var l=s==4294967295,c=i==4294967295,u=o==4294967295,d=t+n,f=l+c+u;if(r&&f){for(;t+4<d;t+=4+Nn(e,t+2))if(Nn(e,t)==1)return[l?bf(e,t+4+8*c):s,c?bf(e,t+4):i,u?bf(e,t+4+8*(c+l)):o,1];r<2&&De(13)}return[s,i,o,0]},Sp=function(e){var t=0;if(e)for(var n in e){var r=e[n].length;r>65535&&De(9),t+=r+4}return t},j_=function(e,t,n,r,s,i,o,l){var c=r.length,u=n.extra,d=l&&l.length,f=Sp(u);Ge(e,t,o!=null?33639248:67324752),t+=4,o!=null&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(i<0&&8),e[t++]=s&&8,e[t++]=n.compression&255,e[t++]=n.compression>>8;var h=new Date(n.mtime==null?Date.now():n.mtime),p=h.getFullYear()-1980;if((p<0||p>119)&&De(10),Ge(e,t,p<<25|h.getMonth()+1<<21|h.getDate()<<16|h.getHours()<<11|h.getMinutes()<<5|h.getSeconds()>>1),t+=4,i!=-1&&(Ge(e,t,n.crc),Ge(e,t+4,i<0?-i-2:i),Ge(e,t+8,n.size)),Ge(e,t+12,c),Ge(e,t+14,f),t+=16,o!=null&&(Ge(e,t,d),Ge(e,t+6,n.attrs),Ge(e,t+10,o),t+=14),e.set(r,t),t+=c,f)for(var v in u){var x=u[v],w=x.length;Ge(e,t,+v),Ge(e,t+2,w),e.set(x,t+4),t+=4+w}return d&&(e.set(l,t),t+=d),t},O3=function(e,t,n,r,s){Ge(e,t,101010256),Ge(e,t+8,n),Ge(e,t+10,n),Ge(e,t+12,r),Ge(e,t+16,s)};function $3(e,t,n){n||(n=t,t={}),typeof n!="function"&&De(7);var r={};Ek(e,"",r,t);var s=Object.keys(r),i=s.length,o=0,l=0,c=i,u=new Array(i),d=[],f=function(){for(var w=0;w<d.length;++w)d[w]()},h=function(w,g){fu(function(){n(w,g)})};fu(function(){h=n});var p=function(){var w=new Ce(l+22),g=o,y=l-o;l=0;for(var m=0;m<c;++m){var _=u[m];try{var j=_.c.length;j_(w,l,_,_.f,_.u,j);var N=30+_.f.length+Sp(_.extra),k=l+N;w.set(_.c,k),j_(w,o,_,_.f,_.u,j,l,_.m),o+=16+N+(_.m?_.m.length:0),l=k+j}catch(S){return h(S,null)}}O3(w,o,u.length,y,g),h(null,w)};i||p();for(var v=function(w){var g=s[w],y=r[g],m=y[0],_=y[1],j=j3(),N=m.length;j.p(m);var k=jp(g),S=k.length,P=_.comment,$=P&&jp(P),D=$&&$.length,I=Sp(_.extra),O=_.level==0?0:8,E=function(A,C){if(A)f(),h(A,null);else{var M=C.length;u[w]=Bg(_,{size:N,crc:j.d(),c:C,f:k,m:$,u:S!=g.length||$&&P.length!=D,compression:O}),o+=30+S+I+M,l+=76+2*(S+I)+(D||0)+M,--i||p()}};if(S>65535&&E(De(11,0,1),null),!O)E(null,m);else if(N<16e4)try{E(null,Hg(m,_))}catch(A){E(A,null)}else d.push(C3(m,_,E))},x=0;x<c;++x)v(x);return f}var fu=typeof queueMicrotask=="function"?queueMicrotask:typeof setTimeout=="function"?setTimeout:function(e){e()};function L3(e,t,n){n||(n=t,t={}),typeof n!="function"&&De(7);var r=[],s=function(){for(var w=0;w<r.length;++w)r[w]()},i={},o=function(w,g){fu(function(){n(w,g)})};fu(function(){o=n});for(var l=e.length-22;Dt(e,l)!=101010256;--l)if(!l||e.length-l>65558)return o(De(13,0,1),null),s;var c=Nn(e,l+8);if(c){var u=c,d=Dt(e,l+16),f=Dt(e,l-20)==117853008;if(f){var h=Dt(e,l-12);f=Dt(e,h)==101075792,f&&(u=c=Dt(e,h+32),d=Dt(e,h+48))}for(var p=t&&t.filter,v=function(w){var g=I3(e,d,f),y=g[0],m=g[1],_=g[2],j=g[3],N=g[4],k=g[5],S=M3(e,k);d=N;var P=function(D,I){D?(s(),o(D,null)):(I&&(i[j]=I),--c||o(null,i))};if(!p||p({name:j,size:m,originalSize:_,compression:y}))if(!y)P(null,Hs(e,S,S+m));else if(y==8){var $=e.subarray(S,S+m);if(_<524288||m>.8*_)try{P(null,Ug($,{out:new Ce(_)}))}catch(D){P(D,null)}else r.push(A3($,{size:_},P))}else P(De(14,"unknown compression type "+y,1),null);else P(null,null)},x=0;x<u;++x)v(x)}else o(null,{});return s}const kp="project-manifest.json",D3=".aitable-workflow.zip",z3=/\.(json|ya?ml|ts|js|md|txt)$/i,V3=new Set(["runtime","traces","node_modules"]),Ak=/(^|\/)\.(_|DS_Store)/;async function F3(e){const{project:t,files:n,checksums:r,exportedAt:s}=e,i={};for(const l of n)Pk(l.path)||Ak.test(l.path)||(i[l.path]=l.content);const o={version:1,title:t.title??"",scene:G3(n),checksums:r,exportedAt:s,projectId:t.id};return i[kp]=JSON.stringify(o,null,2),B3(i)}function B3(e){const t={};for(const[n,r]of Object.entries(e))t[n]=jp(r);return new Promise((n,r)=>{$3(t,{level:6},(s,i)=>{s?r(s):n(new Blob([i.slice()],{type:"application/zip"}))})})}async function Tk(e){let t;e instanceof Uint8Array?t=e:e instanceof ArrayBuffer?t=new Uint8Array(e):t=new Uint8Array(await e.arrayBuffer());const n=await new Promise((s,i)=>{L3(t,(o,l)=>o?i(o):s(l))}),r={};for(const[s,i]of Object.entries(n))s.endsWith("/")||(r[s]=Ck(i));return r}function H3(e,t){const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,r.rel="noopener",document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),0)}async function U3(e){const t=await Tk(e);let n;const r=t[kp];if(r!==void 0)try{n=JSON.parse(r)}catch{n=void 0}const s=[];for(const[o,l]of Object.entries(t)){if(o===kp)continue;const c=o.replace(/^\/+/,"");!c||Ak.test(c)||Pk(c)||!z3.test(c)||s.push({path:c,content:l})}s.sort((o,l)=>o.path.localeCompare(l.path));const i=await K3(n,s);return{title:(n==null?void 0:n.title)??"",files:s,manifest:n,checksumWarnings:i}}async function W3(e){try{const t=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map(r=>r.toString(16).padStart(2,"0")).join("")}catch{return null}}async function K3(e,t){if(!(e!=null&&e.checksums)||e.checksums.length===0)return[];const n=[],r=new Map(t.map(s=>[s.path,s.content]));for(const s of e.checksums){const i=r.get(s.path);if(i===void 0){n.push(`manifest 记录的文件缺失:${s.path}`);continue}const o=await W3(i);o&&o!==s.sha256&&n.push(`checksum 不一致:${s.path}`)}return n}function G3(e){const t=e.find(r=>r.path==="aitable-workflow.config.yml"||r.path.endsWith(".config.yml"));if(!t)return;const n=/^[ \t]*scene[ \t]*:[ \t]*(.+)$/m.exec(t.content);if(n)return n[1].trim().replace(/^['"]/,"").replace(/['"]$/,"").replace(/\s+#.*$/,"")||void 0}function Pk(e){const t=e.split("/")[0]??"";return V3.has(t)}function q3(e){return e.trim().replace(/[^\w一-龥.\- ]+/g,"_").replace(/_{2,}/g,"_")||"project"}function Y3(e){return`${q3(e)}${D3}`}function ka(e,t){const n=e.filter(r=>r.id!==t.id);return[t,...n].sort((r,s)=>s.updatedAt.localeCompare(r.updatedAt))}function S_(e,t){var n;return(n=e.title)!=null&&n.trim()?e.title.trim():`工作流 #${t+1} · ${e.id.slice(-6)}`}const X3=ut(function(){const t=z.workflows,n=z.currentWorkflowId,r=z.workflowFiles,s=z.projectId,[i,o]=b.useState(!1),[l,c]=b.useState(null),[u,d]=b.useState(!1),[f,h]=b.useState(null),p=g=>{if(!g)return null;const y=t.find(m=>m.id===g);return(y==null?void 0:y.fileCount)!=null?y.fileCount:g!==n?null:r.length};async function v(g){if(!(!s||g===n)){d(!0),h(null);try{const[y,m]=await Promise.all([yp(s,g),ad(s,g).catch(()=>null)]);z.setCurrentWorkflow(g,y.files),m&&z.applyServerWorkflow(s,m)}catch(y){h(y instanceof Error?y.message:String(y))}finally{d(!1)}}}async function x(){if(s)try{const g=await vp(s);z.setWorkflows(g)}catch{}}async function w(){if(!(!l||!s)){d(!0),h(null);try{await YD(s,l);const g=await vp(s);if(l===n){const m=g[0];if(m)try{const _=await yp(s,m.id);z.setWorkflows(g),z.setCurrentWorkflow(m.id,_.files)}catch{z.setWorkflows(g),z.setCurrentWorkflow(m.id,[])}else z.setWorkflows(g),z.setCurrentWorkflow(null,[])}else z.setWorkflows(g);c(null)}catch(g){const y=g instanceof Error?g.message:String(g);h(/运行中|project_busy|活跃|无法删除/i.test(y)?"项目运行中,无法删除工作流":y)}finally{d(!1)}}}return t.length===0?a.jsxs("div",{className:"rail__workflow-empty",children:[a.jsxs("button",{type:"button",className:"rail__item rail__item--workflow rail__workflow-new",onClick:()=>o(!0),children:[a.jsx(V,{name:"plus",size:14,style:{flex:"0 0 auto"}}),a.jsx("span",{children:"新建工作流"})]}),f&&a.jsx("div",{className:"rail__workflow-error",children:f}),i&&a.jsx(k_,{onCancel:()=>o(!1),onCreated:async()=>{o(!1),await x()}})]}):a.jsxs("div",{className:"rail__workflow-list",children:[t.map(g=>{const y=g.id===n,m=p(g.id);return a.jsxs("div",{className:"rail__workflow-card-wrap",children:[a.jsxs("button",{type:"button",className:"rail__item rail__item--workflow"+(y?" is-active":""),onClick:()=>void v(g.id),disabled:u,title:`${g.name}${g.domain?" · "+g.domain:""}${g.tableId?" · "+g.tableId:""}`,children:[a.jsx(V,{name:"flow",size:14,style:{flex:"0 0 auto"}}),a.jsxs("span",{className:"rail__item-copy",children:[a.jsx("span",{className:"rail__item-title",children:g.name}),a.jsx("span",{className:"rail__item-sub",children:[g.domain,g.tableId].filter(Boolean).join(" · ")||g.id})]}),m!==null&&a.jsx("span",{className:"rail__badge",children:m})]}),a.jsx("button",{type:"button",className:"rail__item-delete",title:"删除工作流","aria-label":"删除工作流",disabled:u,onClick:()=>{c(g.id),h(null)},children:a.jsx(V,{name:"close",size:12})})]},g.id)}),a.jsxs("button",{type:"button",className:"rail__item rail__workflow-add",onClick:()=>o(!0),children:[a.jsx(V,{name:"plus",size:14,style:{flex:"0 0 auto"}}),a.jsx("span",{children:"新建工作流"})]}),f&&a.jsx("div",{className:"rail__workflow-error",children:f}),i&&a.jsx(k_,{onCancel:()=>o(!1),onCreated:async()=>{o(!1),await x()}}),l&&a.jsx("div",{className:"modal-overlay",onClick:()=>!u&&c(null),children:a.jsxs("div",{className:"modal-card",onClick:g=>g.stopPropagation(),children:[a.jsxs("div",{className:"modal-card__head",children:[a.jsx("span",{className:"modal-card__title",children:"删除工作流?"}),a.jsx("button",{type:"button",className:"modal-card__close",onClick:()=>c(null),disabled:u,children:a.jsx(V,{name:"close",size:14})})]}),a.jsxs("div",{className:"modal-card__body",children:[a.jsx("p",{className:"cfg-muted",children:"删除后该工作流的 workflow.yml / recipes / views 将一并移除,且不可恢复。"}),f&&a.jsxs("div",{className:"import-env-warn",children:[a.jsx(V,{name:"warn",size:13}),f]})]}),a.jsxs("div",{className:"modal-card__foot",children:[a.jsx("button",{type:"button",className:"modal-card__btn",onClick:()=>c(null),disabled:u,children:"取消"}),a.jsx("button",{type:"button",className:"primary modal-card__btn",disabled:u,onClick:()=>void w(),children:u?"删除中...":"确认删除"})]})]})})]})});function k_({onCancel:e,onCreated:t}){const n=z.projectId,[r,s]=b.useState(""),[i,o]=b.useState(""),[l,c]=b.useState(""),[u,d]=b.useState(!1),[f,h]=b.useState(null),p=b.useRef(null);async function v(w){if(!w||w.length===0)return[];const g=Array.from(w),y=[];for(const m of g){const _=m.webkitRelativePath||m.name,j=await m.text();y.push({path:Mk(_),content:j})}return y}function x(){if(!n)return;const w=r.trim();if(!w){h("工作流名称不能为空");return}d(!0),h(null),(async()=>{var g;try{const y=[];if(i.trim()&&y.push({path:"workflow.yml",content:i}),l.trim()){const _=Q3(l);y.push(..._)}if((g=p.current)!=null&&g.files){const _=await v(p.current.files);y.push(..._)}const m=await qD(n,{name:w,files:y.length>0?y:void 0});await t(m.workflow)}catch(y){h(y instanceof Error?y.message:String(y))}finally{d(!1)}})()}return a.jsx("div",{className:"modal-overlay",onClick:()=>!u&&e(),children:a.jsxs("div",{className:"modal-card",onClick:w=>w.stopPropagation(),style:{maxWidth:560},children:[a.jsxs("div",{className:"modal-card__head",children:[a.jsx("span",{className:"modal-card__title",children:"新建工作流"}),a.jsx("button",{type:"button",className:"modal-card__close",onClick:e,disabled:u,children:a.jsx(V,{name:"close",size:14})})]}),a.jsxs("div",{className:"modal-card__body",children:[a.jsxs("label",{className:"cfg-label",children:["工作流名称",a.jsx("input",{className:"cfg-input",value:r,placeholder:"例如:合同审批流程",onChange:w=>s(w.target.value),disabled:u})]}),a.jsxs("label",{className:"cfg-label",style:{marginTop:12},children:["workflow.yml(可选,留空则后端用默认模板)",a.jsx("textarea",{className:"cfg-textarea",rows:8,value:i,placeholder:`workflow:
64
+ name: ...`,onChange:w=>o(w.target.value),disabled:u})]}),a.jsxs("label",{className:"cfg-label",style:{marginTop:12},children:["recipes 脚本(可选,按 --- 文件名 --- 分段)",a.jsx("textarea",{className:"cfg-textarea",rows:5,value:l,placeholder:`--- recipes/fetch.recipe.ts ---
65
+ export default ...`,onChange:w=>c(w.target.value),disabled:u})]}),a.jsxs("label",{className:"cfg-label",style:{marginTop:12},children:["上传工作流文件(可选,支持选目录)",a.jsx("input",{ref:p,type:"file",multiple:!0,webkitdirectory:"",directory:"",disabled:u})]}),f&&a.jsxs("div",{className:"import-env-warn",style:{marginTop:12},children:[a.jsx(V,{name:"warn",size:13}),f]})]}),a.jsxs("div",{className:"modal-card__foot",children:[a.jsx("button",{type:"button",className:"modal-card__btn",onClick:e,disabled:u,children:"取消"}),a.jsx("button",{type:"button",className:"primary modal-card__btn",disabled:u,onClick:()=>x(),children:u?"创建中...":"创建"})]})]})})}function Q3(e){var i,o;const t=e.trim();if(!t)return[];const n=[],r=t.split(/^---\s+(.+?)\s+---\s*$/m);if(r.length<=1)return[{path:"recipes/_inline.recipe.ts",content:t}];let s=0;for(r[0].trim()&&n.push({path:"recipes/_inline.recipe.ts",content:r[0].trim()}),s=1;s<r.length;s+=2){const l=(i=r[s])==null?void 0:i.trim(),c=((o=r[s+1])==null?void 0:o.trim())??"";l&&n.push({path:Mk(l),content:c})}return n}function Mk(e){let t=e.replace(/^\.\//,"");const n=/^workflows\/[^/]+\//;return n.test(t)&&(t=t.replace(n,"")),t}const Z3=ut(function(){const t=z.route,n=z.projectId,r=z.projects,s=z.steps.length,i=z.view,o=i.kind==="setup"?i.schema.fields.length:0,l=i.kind==="setup"?i.schema.views.length:0,c=s>0,[u,d]=b.useState(!1),[f,h]=b.useState(null),[p,v]=b.useState(!1),[x,w]=b.useState(null),[g,y]=b.useState(null),[m,_]=b.useState(null),j=[`${s} 步工作流`,o>0?`${o} 字段`:null,l>0?`${l} 视图`:null].filter(Boolean).join(" · "),N=n?[{id:n,title:z.initDraft.name||(z.projectSource==="imported"?"导入项目":"新建项目"),dir:"",createdAt:"",updatedAt:""}]:[],k=ue?r:N;async function S(O){if(!ue){z.setRoute(c?"design":"init");return}await ba(O)}async function P(O){if(!ue){z.beginNewProject(`mock-${Date.now()}`,O);return}const E=await $g();z.beginNewProject(E.id,O),z.setProjects(ka(r,E))}async function $(){if(!ue||!n)return;const O=r.find(C=>C.id===n),E=window.prompt("项目名称",(O==null?void 0:O.title)??"");if(!(E!=null&&E.trim()))return;const A=await QD(n,E.trim());z.setProjects(ka(r,A))}async function D(){if(f){v(!0),w(null);try{await WD(f);const O=await ak().catch(()=>r.filter(E=>E.id!==f));f===n?z.clearProject(O):z.setProjects(O),h(null)}catch(O){const E=O instanceof Error?O.message:String(O);w(/运行中|project_busy|活跃|无法删除/i.test(E)?"项目运行中,无法删除":E)}finally{v(!1)}}}async function I(O){if(ue){y(O),_(null);try{const E=await KD(O),A=await F3(E),C=Y3(E.project.title??O);H3(A,C)}catch(E){_(E instanceof Error?E.message:String(E))}finally{y(null)}}}return a.jsxs("aside",{className:"rail",children:[a.jsxs("div",{className:"rail__head",children:[a.jsx("div",{className:"rail__title",children:"我的项目"}),a.jsx("button",{type:"button",className:"rail__collapse",onClick:()=>z.setRailCollapsed(!0),title:"收起项目列表","aria-label":"收起项目列表",children:a.jsx(V,{name:"chevron-left",size:14})})]}),a.jsx("div",{className:"rail__list",children:k.map((O,E)=>{const A=ue?O.id===n:t!=="home";return a.jsxs("div",{className:"rail__project",children:[a.jsxs("button",{type:"button",className:"rail__item rail__item--project"+(A?" is-active":""),onClick:()=>void S(O.id),onDoubleClick:()=>void $(),title:ue?`${S_(O,E)} · ${O.id}`:void 0,children:[a.jsx(V,{name:"file",size:15,style:{flex:"0 0 auto"}}),a.jsxs("span",{className:"rail__item-copy",children:[a.jsx("span",{className:"rail__item-title",children:S_(O,E)}),ue&&a.jsx("span",{className:"rail__item-sub",children:O.id})]})]}),ue&&a.jsx("button",{type:"button",className:"rail__item-delete",style:{right:30},title:g===O.id?"导出中...":"导出项目包","aria-label":"导出项目包",disabled:g===O.id,onClick:()=>void I(O.id),children:a.jsx("svg",{width:12,height:12,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"M12 3v12M7 10l5 5 5-5M5 21h14"})})}),ue&&a.jsx("button",{type:"button",className:"rail__item-delete",title:"删除项目","aria-label":"删除项目",onClick:()=>{h(O.id),w(null)},children:a.jsx(V,{name:"close",size:12})}),A&&a.jsx(X3,{})]},O.id)})}),f&&a.jsx("div",{className:"modal-overlay",onClick:()=>!p&&h(null),children:a.jsxs("div",{className:"modal-card",onClick:O=>O.stopPropagation(),children:[a.jsxs("div",{className:"modal-card__head",children:[a.jsx("span",{className:"modal-card__title",children:"删除项目?"}),a.jsx("button",{type:"button",className:"modal-card__close",onClick:()=>h(null),disabled:p,children:a.jsx(V,{name:"close",size:14})})]}),a.jsxs("div",{className:"modal-card__body",children:[a.jsx("p",{className:"cfg-muted",children:"删除后项目配置与工作流文件将一并移除,且不可恢复。"}),x&&a.jsxs("div",{className:"import-env-warn",children:[a.jsx(V,{name:"warn",size:13}),x]})]}),a.jsxs("div",{className:"modal-card__foot",children:[a.jsx("button",{type:"button",className:"modal-card__btn",onClick:()=>h(null),disabled:p,children:"取消"}),a.jsx("button",{type:"button",className:"primary modal-card__btn",disabled:p,onClick:()=>void D(),children:p?"删除中...":"确认删除"})]})]})}),a.jsxs("button",{type:"button",className:"rail__item rail__new",onClick:()=>d(!0),children:[a.jsx(V,{name:"plus",size:17,style:{flex:"0 0 auto"}}),a.jsx("span",{children:"新建项目"})]}),u&&a.jsx(dk,{onConfirm:O=>{P(O),d(!1)},onCancel:()=>d(!1)}),a.jsx("div",{className:"rail__spacer"}),ue&&a.jsxs("button",{type:"button",className:"rail__item rail__machines",onClick:()=>z.toggleAgentTrace(),title:"查看 Agent 执行记录",children:[a.jsx(V,{name:"bolt",size:17,style:{flex:"0 0 auto"}}),a.jsx("span",{children:"执行记录"})]}),a.jsxs("div",{className:"rail__foot",children:[c?j:"尚未创建工作流",a.jsx("br",{}),"aitable-workflow 原型"]}),m&&a.jsx("div",{className:"modal-overlay",onClick:()=>_(null),children:a.jsxs("div",{className:"modal-card",onClick:O=>O.stopPropagation(),children:[a.jsxs("div",{className:"modal-card__head",children:[a.jsx("span",{className:"modal-card__title",children:"导出失败"}),a.jsx("button",{type:"button",className:"modal-card__close",onClick:()=>_(null),children:a.jsx(V,{name:"close",size:14})})]}),a.jsx("div",{className:"modal-card__body",children:a.jsxs("div",{className:"import-env-warn",children:[a.jsx(V,{name:"warn",size:13}),m]})}),a.jsx("div",{className:"modal-card__foot",children:a.jsx("button",{type:"button",className:"primary modal-card__btn",onClick:()=>_(null),children:"知道了"})})]})})]})});function J3(e){return e==="discovery_preparing"||e==="discovery_waiting_user"||e==="generating"}const ez=300,tz=80,nz=48;function rz(e){return e.scrollHeight-e.scrollTop-e.clientHeight<=nz}function sz({groups:e,live:t,onClose:n,bodyRef:r,onScroll:s}){return a.jsx("div",{className:"trace-backdrop",onClick:n,children:a.jsxs("aside",{className:"trace-panel",role:"dialog","aria-label":"Agent 执行记录",onClick:i=>i.stopPropagation(),children:[a.jsxs("div",{className:"trace-panel__head",children:[a.jsx("h2",{className:"trace-panel__title",children:"Agent 执行记录"}),a.jsx("button",{type:"button",className:"trace-panel__close",onClick:n,title:"关闭","aria-label":"关闭",children:a.jsx(V,{name:"close",size:14})})]}),a.jsx("div",{className:"trace-panel__body",ref:r,onScroll:s,children:e.length===0?a.jsx("div",{className:"trace-empty",children:"还没有 Agent 执行记录。运行设计后,这里会实时显示 Agent 的思考、正文与工具调用。"}):e.map((i,o)=>{const l=o===e.length-1;return a.jsxs("div",{className:"trace-grp",children:[a.jsx("span",{className:"trace-av","aria-hidden":!0,children:a.jsx(V,{name:"robot",size:16})}),a.jsxs("div",{className:"trace-body",children:[a.jsx("div",{className:"trace-head",children:i.round!=null?`第 ${i.round} 轮`:"执行过程"}),i.items.map((c,u)=>{const d=u===i.items.length-1;if(c.kind==="tool")return a.jsxs("div",{className:"trace-tool",children:[a.jsx(V,{name:"bolt",size:12}),a.jsx("span",{className:"trace-tool__label",children:c.text})]},u);if(c.kind==="tool_result")return c.fullText?a.jsxs("details",{className:"trace-toolret trace-toolret--expandable",children:[a.jsxs("summary",{className:"trace-toolret__summary",children:[a.jsx(V,{name:"dot",size:12}),a.jsx("span",{className:"trace-toolret__label",children:c.text})]}),a.jsx("pre",{className:"trace-toolret__full",children:c.fullText})]},u):a.jsxs("div",{className:"trace-toolret",children:[a.jsx(V,{name:"dot",size:12}),a.jsx("span",{className:"trace-toolret__label",children:c.text})]},u);if(c.kind==="permission")return c.fullText?a.jsxs("details",{className:"trace-perm trace-perm--expandable",children:[a.jsxs("summary",{className:"trace-perm__summary",children:[a.jsx(V,{name:"lock",size:12}),a.jsx("span",{className:"trace-perm__label",children:c.text})]}),a.jsx("pre",{className:"trace-perm__full",children:c.fullText})]},u):a.jsxs("div",{className:"trace-perm",children:[a.jsx(V,{name:"lock",size:12}),a.jsx("span",{className:"trace-perm__label",children:c.text})]},u);if(c.kind==="status")return a.jsxs("div",{className:"trace-status",children:[a.jsx(V,{name:"dot",size:12}),a.jsx("span",{children:c.text})]},u);if(c.kind==="thinking"&&c.text.length>ez)return a.jsxs("details",{className:"trace-text trace-text--thinking trace-text--foldable",children:[a.jsx("summary",{className:"trace-text__summary",children:`${c.text.slice(0,tz)}…`}),a.jsx("div",{className:"trace-text__full",children:c.text})]},u);const f=t&&l&&d,h=c.kind==="thinking"?"trace-text trace-text--thinking":"trace-text";return a.jsxs("div",{className:h,children:[c.text,f?a.jsx("span",{className:"trace-cursor"}):null]},u)})]})]},o)})})]})})}const iz=ut(function(){const t=z.agentTraceOpen,n=z.agentTraceLog,r=z.view,s=b.useMemo(()=>IL(n),[n]),i=r.kind==="design"&&J3(r.sub.kind),o=b.useRef(null),l=b.useRef(!0);b.useEffect(()=>{const u=o.current;!u||!l.current||(u.scrollTop=u.scrollHeight)},[s,t]);function c(){const u=o.current;u&&(l.current=rz(u))}return b.useEffect(()=>{if(!t)return;function u(d){d.key==="Escape"&&z.setAgentTraceOpen(!1)}return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[t]),t?a.jsx(sz,{groups:s,live:i,onClose:()=>z.setAgentTraceOpen(!1),bodyRef:o,onScroll:c}):null});function oz(){const e=Og(),[t,n]=b.useState(!1),r=b.useRef(null);return b.useEffect(()=>{if(!t)return;function s(i){r.current&&!r.current.contains(i.target)&&n(!1)}return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[t]),!it||!e.user?null:a.jsxs("div",{className:"user-menu",ref:r,children:[a.jsxs("button",{type:"button",className:"user-menu__trigger",onClick:()=>n(s=>!s),title:"用户菜单",children:[a.jsx(V,{name:"user",size:15}),a.jsx("span",{className:"user-menu__name",children:e.user.username}),a.jsx(V,{name:"chevron-down",size:12})]}),t&&a.jsxs("div",{className:"user-menu__dropdown",children:[a.jsxs("button",{type:"button",className:"user-menu__item",onClick:()=>{z.setRoute("account"),n(!1)},children:[a.jsx(V,{name:"user",size:14}),"用户中心"]}),a.jsxs("button",{type:"button",className:"user-menu__item",onClick:()=>{z.setRoute("engines"),n(!1)},children:[a.jsx(V,{name:"bolt",size:14}),"执行引擎"]}),a.jsx("div",{className:"user-menu__divider"}),a.jsxs("button",{type:"button",className:"user-menu__item user-menu__item--danger",onClick:()=>{As.logout(),n(!1)},children:[a.jsx(V,{name:"close",size:14}),"退出登录"]})]})]})}const az=ut(function({children:t}){const n=z.route,r=z.theme,s=n==="home"||n==="account"||n==="engines"||n==="adjust",i=z.layout.railCollapsed;return a.jsxs("div",{className:"app-root",children:[a.jsxs("header",{className:"chrome",children:[a.jsxs("button",{type:"button",className:"chrome__brand",onClick:()=>z.setRoute("home"),title:"返回首页",children:[a.jsx("span",{className:"chrome__brand-mark",children:a.jsx(V,{name:"sparkle",size:15,color:"#fff"})}),"aitable-workflow"]}),n!=="home"&&n!=="account"&&n!=="engines"&&a.jsx(BD,{}),a.jsx("div",{className:"chrome__spacer"}),a.jsx("button",{type:"button",className:"chrome__theme",onClick:()=>z.toggleTheme(),title:r==="light"?"切换到暗色":"切换到亮色","aria-label":"切换主题",children:a.jsx(V,{name:r==="light"?"moon":"sun",size:17})}),a.jsx(oz,{})]}),a.jsxs("div",{className:"body"+(s?" body--norail":"")+(i?" body--rail-collapsed":""),children:[!s&&(i?a.jsx("button",{type:"button",className:"rail-peek",onClick:()=>z.setRailCollapsed(!1),title:"展开工作流列表","aria-label":"展开工作流列表",children:a.jsx(V,{name:"chevron-right",size:14})}):a.jsx(Z3,{})),t]}),a.jsx(iz,{})]})}),lz={init:"一次性配置",design:"工作流设计",setup:"AI 表格搭建",adjust:"参数调整",test:"试运行",run:"运行监控"};function cz({stage:e}){return a.jsx("div",{className:"split split--chatonly",children:a.jsxs("div",{className:"split__work",children:[a.jsx("div",{className:"work-head",children:a.jsxs("div",{children:[a.jsx("div",{className:"work-head__title",children:lz[e]??"加载中"}),a.jsx("div",{className:"work-head__sub",children:"正在读取项目状态…"})]})}),a.jsxs("div",{className:"work-body stage-skeleton",children:[a.jsx("div",{className:"stage-skeleton__bar stage-skeleton__bar--wide"}),a.jsx("div",{className:"stage-skeleton__bar"}),a.jsx("div",{className:"stage-skeleton__bar stage-skeleton__bar--narrow"}),a.jsx("div",{className:"stage-skeleton__card"})]})]})})}function uz({message:e,onRetry:t}){return a.jsx("div",{className:"split split--chatonly",children:a.jsxs("div",{className:"split__work",children:[a.jsx("div",{className:"work-head",children:a.jsxs("div",{children:[a.jsx("div",{className:"work-head__title",children:"项目加载失败"}),a.jsx("div",{className:"work-head__sub",children:"服务端状态未取到"})]})}),a.jsx("div",{className:"work-body",children:a.jsxs("div",{className:"empty-hint",children:[e,a.jsx("div",{style:{marginTop:16},children:a.jsxs("button",{type:"button",className:"primary",onClick:t,children:[a.jsx(V,{name:"play",size:14,color:"#fff"}),"重试"]})})]})})]})})}const Wg={type:"spring",stiffness:500,damping:30,mass:.8};({...Wg});const dz={hidden:{opacity:0,scale:.95},visible:{opacity:1,scale:1,transition:Wg},exit:{opacity:0,scale:.97,transition:{duration:.15}}},St={hidden:{opacity:0,y:8},visible:{opacity:1,y:0},exit:{opacity:0,y:-4,transition:{duration:.1}}},Ik={hidden:{opacity:0},visible:{opacity:1,transition:{staggerChildren:.06,delayChildren:.02}}},fz={hidden:{opacity:0,scale:.9},visible:{opacity:1,scale:1,transition:{...Wg,stiffness:420,damping:26}}};function hz(e,t){return e===void 0?!1:Array.isArray(e)?e.includes(t):typeof e=="boolean"?String(e)===t:e===t}function Rk(e,t){return e.showIf?hz(t[e.showIf.questionId],e.showIf.hasValue):!0}function pz(e,t){return e.questions.filter(n=>Rk(n,t))}function mz(e,t){var r;const n=[];for(const s of pz(e,t)){const i=t[s.id];if(s.required&&N_(i)){n.push({questionId:s.id,code:"required",message:`「${s.label}」为必填项`});continue}if(s.maxSelections!==void 0&&Array.isArray(i)&&i.length>s.maxSelections&&n.push({questionId:s.id,code:"max_selections",message:`「${s.label}」最多选 ${s.maxSelections} 项,实际 ${i.length} 项`}),s.allowCustom===!1&&((r=s.options)!=null&&r.length)&&!N_(i)){const o=new Set(s.options.map(u=>u.value)),c=(Array.isArray(i)?i:[String(i)]).filter(u=>!o.has(u));c.length>0&&n.push({questionId:s.id,code:"not_in_options",message:`「${s.label}」只能从给定选项中选择,收到:${c.join("、")}`})}}return n}function N_(e){return e===void 0?!0:typeof e=="string"?e.trim()==="":Array.isArray(e)?e.length===0:!1}function gz(e,t){return Rk(e,t)}function Np(e,t){return e.questions.filter(n=>gz(n,t))}const jf={required:()=>"此项必填",max_selections:e=>`最多选 ${e.maxSelections} 项`};function vz(e,t){var s;const n=new Map(e.questions.map(i=>[i.id,i])),r={};for(const i of mz(e,t)){const o=n.get(i.questionId);r[i.questionId]=o?((s=jf[i.code])==null?void 0:s.call(jf,o))??i.message:i.message}return r}function yz(e){if(!e)return;const t=e.map(n=>typeof n=="string"?{label:n,value:n}:n);return t.length>0?t:void 0}function Kg(e){return{id:e.id,title:e.title,...e.description?{description:e.description}:{},...e.submitLabel?{submitLabel:e.submitLabel}:{},questions:e.questions.map(t=>({...t,options:yz(t.options)}))}}function _z(e,t){var r;const n=(r=e.options)==null?void 0:r.find(s=>s.value===t||s.label===t);return(n==null?void 0:n.label)??t}function E_(e,t){var r;const n=(r=e.options)==null?void 0:r.find(s=>s.value===t||s.label===t);return(n==null?void 0:n.value)??t}function C_(e,t){return _z(e,t)}function Ep(e,t){const n=[`[表单答复 · ${e.title}]`];for(const r of Np(e,t)){const s=t[r.id];let i;Array.isArray(s)?i=s.length>0?s.map(o=>C_(r,o)).join("、"):"(跳过)":typeof s=="string"&&s.trim().length>0?i=C_(r,s.trim()):typeof s=="boolean"?i=s?"是":"否":i="(跳过)",n.push(`· ${r.label}:${i}`)}return n.join(`
66
+ `)}let xz=0;const vt=e=>`${e}_${(xz++).toString(36)}`,es=e=>new Promise(t=>setTimeout(t,e));class Gg{constructor(){le(this,"state",{messages:[],busy:!1,pendingForm:null,formTransitioning:!1});le(this,"listeners",new Set);le(this,"formResolver",null);le(this,"currentAssistantId",null);le(this,"currentTextId",null);le(this,"agentTextMsgId",null);le(this,"agentTextSegId",null);le(this,"agentThinkingMsgId",null);le(this,"agentThinkingSegId",null);le(this,"animQueue",[]);le(this,"consuming",!1);le(this,"activeTasks",0);le(this,"onFormSubmit",null);le(this,"subscribe",t=>(this.listeners.add(t),()=>this.listeners.delete(t)));le(this,"getState",()=>this.state)}emit(){this.listeners.forEach(t=>t())}set(t){this.state={...this.state,...t},this.emit()}pushMessage(t){this.set({messages:[...this.state.messages,t]})}patchMessage(t,n){this.set({messages:this.state.messages.map(r=>r.id===t?n(r):r)})}ensureAssistant(){if(this.currentAssistantId)return this.currentAssistantId;const t=vt("a");return this.currentAssistantId=t,this.currentTextId=null,this.pushMessage({id:t,role:"assistant",segments:[]}),t}addSegment(t){const n=this.ensureAssistant();this.patchMessage(n,r=>({...r,segments:[...r.segments,t]}))}patchSegment(t,n,r){this.patchMessage(t,s=>({...s,segments:s.segments.map(i=>i.id===n?r(i):i)}))}addUserMessage(t){this.pushMessage({id:vt("u"),role:"user",segments:[{kind:"text",id:vt("t"),text:t}]})}run(t){return new Promise(n=>{this.animQueue.push({script:t,resolve:n}),this.ensureConsumer()})}enqueue(t){this.animQueue.push({script:t}),this.ensureConsumer()}beginTask(t,n){const r=this.ensureAssistant(),s=vt("tool");this.resetAgentStream(),this.addSegment({kind:"tool",id:s,tool:{id:vt("tr"),label:t,detail:n,status:"running"}}),this.activeTasks+=1,this.state.busy||this.set({busy:!0});let i=!1;return(o="done")=>{i||(i=!0,this.patchSegment(r,s,l=>l.kind==="tool"?{...l,tool:{...l.tool,status:o}}:l),this.activeTasks=Math.max(0,this.activeTasks-1),this.currentAssistantId=null,this.currentTextId=null,this.activeTasks===0&&!this.consuming&&this.set({busy:!1}))}}ensureConsumer(){this.consuming||(this.consuming=!0,this.state.busy||this.set({busy:!0}),this.consume())}async consume(){var t;for(;this.animQueue.length>0;){const n=this.animQueue.shift();for(const r of n.script)await this.step(r);this.currentAssistantId=null,this.currentTextId=null,(t=n.resolve)==null||t.call(n)}this.consuming=!1,this.set({busy:this.activeTasks>0,formTransitioning:!1})}pendingBeats(){let t=0;for(const n of this.animQueue)t+=n.script.length;return t}async pace(t){const n=this.pendingBeats();if(!(n>=24)){if(n>=8){await es(Math.min(t,6));return}await es(t)}}async step(t){var n;switch(t.kind){case"wait":await es(t.ms);return;case"do":t.run();return;case"say":this.resetAgentStream(),await this.streamText(t.text);return;case"agent-text":this.appendAgentText(t.content),await this.pace(24);return;case"agent-thinking":this.appendAgentThinking(t.content),await this.pace(24);return;case"todo":{const r=t.items.map((s,i)=>({id:vt("td"),text:s,status:i===0?"active":"pending"}));this.addSegment({kind:"todo",id:vt("todo"),items:r}),await es(240);return}case"todo-advance":this.advanceTodo(),await es(300);return;case"tool":{this.resetAgentStream();const r=this.ensureAssistant(),s=vt("tool"),i={id:vt("tr"),label:t.label,detail:t.detail,status:"running"};this.addSegment({kind:"tool",id:s,tool:i}),await this.pace(t.ms??700),this.patchSegment(r,s,o=>o.kind==="tool"?{...o,tool:{...o.tool,status:"done"}}:o),this.currentTextId=null,await this.pace(160);return}case"form":{if(((n=this.state.pendingForm)==null?void 0:n.form.id)===t.form.id)return;const r=this.ensureAssistant(),s=vt("form");this.addSegment({kind:"form",id:s,form:t.form}),this.set({pendingForm:{messageId:r,segmentId:s,form:t.form},formTransitioning:!1}),await new Promise(i=>{this.formResolver=i}),this.currentAssistantId=null,this.currentTextId=null;return}}}advanceTodo(){const t=this.state.messages.map(n=>{let r=!1;const s=n.segments.map(i=>{if(r||i.kind!=="todo")return i;const o=i.items.findIndex(c=>c.status==="active");if(o===-1)return i;r=!0;const l=i.items.map((c,u)=>u===o?{...c,status:"done"}:u===o+1?{...c,status:"active"}:c);return{...i,items:l}});return r?{...n,segments:s}:n});this.set({messages:t})}resetAgentStream(){this.agentTextMsgId=null,this.agentTextSegId=null,this.agentThinkingMsgId=null,this.agentThinkingSegId=null}appendAgentText(t){if(this.agentTextMsgId&&this.agentTextSegId){this.patchSegment(this.agentTextMsgId,this.agentTextSegId,s=>s.kind==="agent-text"?{...s,text:s.text+t}:s);return}this.currentTextId=null;const n=this.ensureAssistant(),r=vt("atext");this.agentTextMsgId=n,this.agentTextSegId=r,this.addSegment({kind:"agent-text",id:r,text:t})}appendAgentThinking(t){if(this.agentThinkingMsgId&&this.agentThinkingSegId){this.patchSegment(this.agentThinkingMsgId,this.agentThinkingSegId,s=>s.kind==="agent-thinking"?{...s,text:s.text+t}:s);return}this.currentTextId=null;const n=this.ensureAssistant(),r=vt("athink");this.agentThinkingMsgId=n,this.agentThinkingSegId=r,this.addSegment({kind:"agent-thinking",id:r,text:t})}async streamText(t){const n=this.ensureAssistant(),r=vt("t");this.currentTextId=r,this.addSegment({kind:"text",id:r,text:""});const s=2;for(let i=0;i<t.length;i+=s){const o=t.slice(0,i+s);this.patchSegment(n,r,l=>l.kind==="text"?{...l,text:o}:l),await es(12)}this.patchSegment(n,r,i=>i.kind==="text"?{...i,text:t}:i),await es(80)}submitForm(t){var s;const n=this.state.pendingForm;if(!n)return;this.patchSegment(n.messageId,n.segmentId,i=>i.kind==="form"?{...i,answers:t}:i),this.addUserMessage(Ep(n.form,t)),(s=this.onFormSubmit)==null||s.call(this,n.form.id,t),this.set({pendingForm:null,formTransitioning:!0});const r=this.formResolver;this.formResolver=null,r==null||r()}reset(){var t;for(const n of this.animQueue)(t=n.resolve)==null||t.call(n);this.animQueue=[],this.consuming=!1,this.activeTasks=0,this.currentAssistantId=null,this.currentTextId=null,this.resetAgentStream(),this.formResolver=null,this.set({messages:[],busy:!1,pendingForm:null,formTransitioning:!1})}}function Ok(e){return b.useSyncExternalStore(e.subscribe,e.getState,e.getState)}function $k({items:e}){const t=e.filter(n=>n.status==="done").length;return a.jsxs("div",{className:"todo-card",children:[a.jsxs("div",{className:"todo-card__head",children:[a.jsx(V,{name:"check",size:14}),a.jsx("span",{children:"执行清单"}),a.jsxs("span",{className:"todo-card__count",children:[t,"/",e.length]})]}),a.jsx(Ye.ul,{className:"todo-card__list",variants:Ik,initial:"hidden",animate:"visible",children:e.map(n=>a.jsxs(Ye.li,{className:`todo-item is-${n.status}`,variants:St,children:[a.jsx("span",{className:"todo-item__mark",children:n.status==="done"?a.jsx(V,{name:"check",size:12}):n.status==="active"?a.jsx("span",{className:"todo-item__spinner"}):a.jsx("span",{className:"todo-item__dot"})}),a.jsx("span",{className:"todo-item__text",children:n.text})]},n.id))})]})}function wz({tool:e}){return a.jsxs("div",{className:`tool-card is-${e.status}`,children:[a.jsx("span",{className:"tool-card__icon",children:e.status==="running"?a.jsx("span",{className:"tool-card__spinner"}):e.status==="error"?a.jsx(V,{name:"warn",size:14}):a.jsx(V,{name:"check",size:14})}),a.jsx("span",{className:"tool-card__label",children:e.label}),e.detail?a.jsx("span",{className:"tool-card__detail",children:e.detail}):null]})}const Lk=b.forwardRef(function({form:t,interactive:n,submittedAnswers:r,hideInternalSubmit:s=!1,onReadyChange:i,onSubmit:o},l){const c=b.useMemo(()=>Sz(t,r),[t,r]),[u,d]=b.useState(c),[f,h]=b.useState({}),[p,v]=b.useState({}),x=!n||!o||r!==void 0,w=r??u;b.useEffect(()=>{d(I=>{let O=!1;const E={...I};for(const A of t.questions)E[A.id]===void 0&&(O=!0,E[A.id]=A.defaultValue!==void 0?Cp(A,A.defaultValue):Dk(A));return O?E:I})},[t]);function g(I,O){x||(h(E=>E[I]?E:{...E,[I]:!0}),d(E=>({...E,[I]:O})))}function y(I,O,E){x||(h(A=>A[I]?A:{...A,[I]:!0}),d(A=>{const C=Array.isArray(A[I])?A[I]:[],M=C.includes(O);if(!M&&E!==void 0&&C.length>=E)return A;const T=M?C.filter(R=>R!==O):[...C,O];return{...A,[I]:T}}))}function m(I){x||(v(O=>({...O,[I]:!0})),h(O=>O[I]?O:{...O,[I]:!0}),d(O=>({...O,[I]:""})))}function _(I,O){x||(v(E=>E[I]?{...E,[I]:!1}:E),g(I,O))}function j(I,O){if(x)return;h(C=>C[I.id]?C:{...C,[I.id]:!0});const E=new Set((I.options??[]).map(C=>C.value)),A=O.split(/[,,]/).map(C=>C.trim()).filter(Boolean);d(C=>{const M=Array.isArray(C[I.id])?C[I.id]:[];return{...C,[I.id]:[...M.filter(T=>E.has(T)),...A]}})}const N=Np(t,w),k=vz(t,w),S=Object.keys(k).length===0;function P(I){const O={};for(const E of Np(t,I)){const A=I[E.id];A!==void 0&&(O[E.id]=A)}return O}function $(){if(x||!o||!S)return;const I=P(u);o(Ep(t,I),I)}function D(){x||!o||o(Ep(t,{}),{})}return b.useImperativeHandle(l,()=>({submit:$,skipAll:D})),b.useEffect(()=>{i==null||i(!x&&S)},[i,x,S]),a.jsxs("div",{className:`question-form${x?" question-form-locked":""}`,"data-form-id":t.id,children:[a.jsxs("div",{className:"question-form-head",children:[a.jsx("span",{className:"question-form-icon","aria-hidden":!0,children:"?"}),a.jsxs("div",{className:"question-form-titles",children:[a.jsx("div",{className:"question-form-title",children:t.title}),t.description?a.jsx("div",{className:"question-form-desc",children:t.description}):null]}),x?a.jsx("span",{className:"question-form-pill",children:"已回答"}):null]}),a.jsx("div",{className:"question-form-body",children:N.map(I=>{const O=w[I.id],E=f[I.id]?k[I.id]:void 0;return a.jsxs("div",{className:`qf-field${E?" qf-field-error":""}`,children:[a.jsxs("label",{className:"qf-label",children:[a.jsx("span",{children:I.label}),I.required?a.jsx("span",{className:"qf-required",children:"*"}):null]}),I.help?a.jsx("div",{className:"qf-help",children:I.help}):null,E?a.jsx("div",{className:"qf-error",children:E}):null,I.type==="radio"&&I.options?a.jsxs("div",{className:"qf-choices",role:"radiogroup",children:[I.options.map(A=>a.jsxs("label",{className:`qf-choice${O===A.value?" is-on":""}${x?" is-disabled":""}`,title:A.description,children:[a.jsx("input",{type:"radio",name:`${t.id}-${I.id}`,checked:!Il(I,O,p)&&O===A.value,disabled:x,onChange:()=>_(I.id,A.value)}),a.jsx(Sf,{option:A})]},A.value)),gc(I)?a.jsxs("label",{className:`qf-choice${Il(I,O,p)?" is-on":""}${x?" is-disabled":""}`,children:[a.jsx("input",{type:"radio",name:`${t.id}-${I.id}`,checked:Il(I,O,p),disabled:x,onChange:()=>m(I.id)}),a.jsx(Sf,{option:{label:"其他 — 我自己说",value:bz}})]}):null,gc(I)&&Il(I,O,p)?a.jsx("input",{type:"text",className:"qf-input",value:typeof O=="string"?O:"",placeholder:I.placeholder??"按你的想法写,不用挑上面的选项",disabled:x,onChange:A=>g(I.id,A.target.value)}):null]}):null,I.type==="checkbox"&&I.options?a.jsxs("div",{className:"qf-choices",children:[I.options.map(A=>{const C=Array.isArray(O)?O:[],M=C.includes(A.value),T=I.maxSelections!==void 0&&!M&&C.length>=I.maxSelections;return a.jsxs("label",{title:A.description,className:`qf-choice${M?" is-on":""}${T||x?" is-disabled":""}`,children:[a.jsx("input",{type:"checkbox",checked:M,disabled:x||T,onChange:()=>y(I.id,A.value,I.maxSelections)}),a.jsx(Sf,{option:A})]},A.value)}),gc(I)?a.jsx("input",{type:"text",className:"qf-input",value:jz(I,O).join(","),placeholder:"其他(多个用逗号分隔)",disabled:x,onChange:A=>j(I,A.target.value)}):null]}):null,I.type==="select"&&I.options?a.jsxs("select",{className:"qf-select",value:typeof O=="string"?O:"",disabled:x,onChange:A=>g(I.id,A.target.value),children:[a.jsx("option",{value:"",disabled:!0,children:I.placeholder??"请选择…"}),I.options.map(A=>a.jsx("option",{value:A.value,children:A.label},A.value))]}):null,I.type==="text"?a.jsx("input",{type:"text",className:"qf-input",value:typeof O=="string"?O:"",placeholder:I.placeholder,disabled:x,onChange:A=>g(I.id,A.target.value)}):null,I.type==="number"?a.jsx("input",{type:"number",className:"qf-input",value:typeof O=="string"?O:"",placeholder:I.placeholder,min:I.min,max:I.max,step:I.step,disabled:x,onChange:A=>g(I.id,A.target.value)}):null,I.type==="textarea"?a.jsx("textarea",{className:"qf-textarea",value:typeof O=="string"?O:"",placeholder:I.placeholder,rows:3,disabled:x,onChange:A=>g(I.id,A.target.value)}):null,I.type==="range"?a.jsxs("div",{className:"qf-range-wrap",children:[a.jsx("input",{type:"range",className:"qf-range",value:typeof O=="string"&&O.trim()?O:String(I.min??0),min:I.min,max:I.max,step:I.step,disabled:x,onChange:A=>g(I.id,A.target.value)}),a.jsx("output",{className:"qf-range-value",children:typeof O=="string"&&O.trim()?O:String(I.min??0)})]}):null,I.type==="color"?a.jsx("input",{type:"color",className:"qf-color",value:kz(O),disabled:x,onChange:A=>g(I.id,A.target.value)}):null,I.type==="switch"?a.jsxs("label",{className:"qf-switch",children:[a.jsx("input",{type:"checkbox",role:"switch",checked:O===!0||O==="true",disabled:x,onChange:A=>g(I.id,A.target.checked?"true":"false")}),a.jsx("span",{"aria-hidden":!0})]}):null]},I.id)})}),s?null:a.jsxs("div",{className:"question-form-foot",children:[x?a.jsx("span",{className:"qf-locked-note",children:"已提交答复"}):a.jsx("span",{className:"qf-hint",children:"选择或填写后提交,未答项将记为跳过"}),x?null:a.jsx("button",{type:"button",className:"primary",onClick:$,disabled:!S,children:t.submitLabel??"提交"})]})]})}),bz="__custom__";function gc(e){return e.type!=="radio"&&e.type!=="checkbox"?!1:e.allowCustom!==!1}function Il(e,t,n){return!gc(e)||e.type!=="radio"?!1:n[e.id]?!0:typeof t!="string"||t===""?!1:!(e.options??[]).some(r=>r.value===t)}function jz(e,t){if(!Array.isArray(t))return[];const n=new Set((e.options??[]).map(r=>r.value));return t.filter(r=>!n.has(r))}function Sf({option:e}){return a.jsxs("span",{className:"qf-chip-copy",children:[a.jsx("span",{children:e.label}),e.description?a.jsx("span",{className:"qf-chip-desc",children:e.description}):null]})}function Sz(e,t){const n={};for(const r of e.questions)t&&t[r.id]!==void 0?n[r.id]=Cp(r,t[r.id]):r.defaultValue!==void 0?n[r.id]=Cp(r,r.defaultValue):n[r.id]=Dk(r);return n}function Dk(e){return e.type==="checkbox"?[]:e.type==="switch"?!1:e.type==="range"?String(e.min??0):e.type==="color"?"#000000":""}function Cp(e,t){return typeof t=="boolean"?t:Array.isArray(t)?t.map(n=>E_(e,n)):E_(e,t)}function kz(e){return typeof e=="string"&&/^#[0-9a-fA-F]{6}$/.test(e)?e:"#000000"}function Nz({msg:e}){if(e.role==="user"){const t=e.segments.map(n=>n.kind==="text"?n.text:"").join("");return a.jsx(Ye.div,{className:"msg msg--user",variants:St,initial:"hidden",animate:"visible",children:a.jsx("div",{className:"msg__bubble",children:t})})}return a.jsxs(Ye.div,{className:"msg msg--assistant",variants:St,initial:"hidden",animate:"visible",children:[a.jsx("div",{className:"msg__avatar","aria-hidden":!0,children:a.jsx(V,{name:"sparkle",size:13,color:"#fff"})}),a.jsx("div",{className:"msg__content",children:e.segments.map(t=>{switch(t.kind){case"text":return a.jsx("p",{className:"msg__text",children:t.text},t.id);case"agent-text":return a.jsx("p",{className:"msg__text msg__text--agent",children:t.text},t.id);case"agent-thinking":return a.jsx(Ez,{text:t.text},t.id);case"todo":return a.jsx($k,{items:t.items},t.id);case"tool":return a.jsx(wz,{tool:t.tool},t.id);case"form":return t.answers?a.jsx(Lk,{form:t.form,interactive:!1,submittedAnswers:t.answers},t.id):a.jsxs("div",{className:"msg__form-hint",children:[a.jsx(V,{name:"chevron-right",size:14}),"请在右侧「问题」面板作答"]},t.id)}})})]})}function Ez({text:e}){return a.jsxs("details",{className:"think-block",children:[a.jsxs("summary",{className:"think-block__summary",children:[a.jsx(V,{name:"sparkle",size:12}),"思考过程"]}),a.jsx("div",{className:"think-block__body",children:e})]})}function Cz({chat:e,placeholder:t,emptyHint:n,onSend:r,title:s,subtitle:i}){const{messages:o,busy:l}=Ok(e),[c,u]=b.useState(""),d=b.useRef(null);b.useEffect(()=>{const h=d.current;h&&(h.scrollTop=h.scrollHeight)},[o,l]);function f(){const h=c.trim();!h||l||!r||(u(""),r(h))}return a.jsxs("div",{className:"chat",children:[s?a.jsxs("div",{className:"chat__head",children:[a.jsx("div",{className:"chat__head-title",children:s}),i?a.jsx("div",{className:"chat__head-sub",children:i}):null]}):null,a.jsxs("div",{className:"chat__body",ref:d,children:[o.length===0?a.jsx("div",{className:"chat__empty",children:n??"开始对话,agent 将引导你完成配置。"}):a.jsx(Ho,{initial:!1,children:o.map(h=>a.jsx(Nz,{msg:h},h.id))}),l?a.jsxs("div",{className:"chat__typing","aria-hidden":!0,children:[a.jsx("span",{}),a.jsx("span",{}),a.jsx("span",{})]}):null]}),r?a.jsxs("div",{className:"chat__composer",children:[a.jsx("textarea",{className:"chat__input",rows:1,value:c,placeholder:t??"输入消息…",disabled:l,onChange:h=>u(h.target.value),onKeyDown:h=>{h.key==="Enter"&&!h.shiftKey&&(h.preventDefault(),f())}}),a.jsx("button",{type:"button",className:"primary chat__send",disabled:l||!c.trim(),onClick:f,"aria-label":"发送",children:a.jsx(V,{name:"send",size:16,color:"#fff"})})]}):null]})}const Az=280;function Tz({form:e,formKey:t=null,interactive:n,submittedAnswers:r,onSubmit:s}){const i=b.useRef(null),[o,l]=b.useState(!1),c=(e==null?void 0:e.questions.length)??0,u=r!==void 0,[d,f]=b.useState(0);b.useEffect(()=>{f(u?c:0)},[t,u,c]),b.useEffect(()=>{if(u){f(c);return}if(d>=c)return;const y=window.setTimeout(()=>f(m=>Math.min(m+1,c)),Az);return()=>window.clearTimeout(y)},[u,c,d]);const h=d>=c,p=u?c:Math.min(d,c),v=e?{...e,questions:e.questions.slice(0,p)}:null,x=!u&&!h,w=!!e&&n&&!x,g=w&&o;return a.jsxs("div",{className:"questions-panel",children:[a.jsx("div",{className:"questions-panel-body",children:v?a.jsxs(a.Fragment,{children:[a.jsx(Lk,{ref:i,form:v,interactive:n,submittedAnswers:r,hideInternalSubmit:!0,onReadyChange:l,onSubmit:s}),x?a.jsxs("div",{className:"questions-panel-typing","aria-hidden":!0,children:[a.jsx("span",{className:"questions-panel-dot"}),a.jsx("span",{className:"questions-panel-dot"}),a.jsx("span",{className:"questions-panel-dot"})]}):null]}):a.jsx("div",{className:"questions-panel-skeleton",children:"正在生成问题…"})}),u?null:a.jsxs("div",{className:"questions-panel-foot",children:[a.jsx("span",{className:"questions-panel-status",children:x?"正在生成问题…":"选择或填写后继续"}),a.jsx("button",{type:"button",className:"ghost questions-skip",disabled:!w,onClick:()=>{var y;return(y=i.current)==null?void 0:y.skipAll()},children:"全部跳过"}),a.jsx("button",{type:"button",className:"primary questions-continue",disabled:!g,onClick:()=>{var y;return(y=i.current)==null?void 0:y.submit()},children:"继续"})]})]})}const hu=ut(function({chat:t,work:n,workHead:r,hideWork:s=!1,onSend:i,chatTitle:o,chatSubtitle:l,chatPlaceholder:c,chatEmptyHint:u}){const{pendingForm:d,formTransitioning:f}=Ok(t),h=z.layout,p=!s&&h.chatCollapsed;function v(w){w.preventDefault();const g=w.clientX,y=h.chatWidth,m=w.pointerId;w.currentTarget.setPointerCapture(m);function _(N){const k=Math.max(280,Math.min(720,y+N.clientX-g));z.setChatWidth(k)}function j(N){y+N.clientX-g<340&&z.setChatCollapsed(!0),window.removeEventListener("pointermove",_),window.removeEventListener("pointerup",j)}window.addEventListener("pointermove",_),window.addEventListener("pointerup",j,{once:!0})}const x={"--chat-width":`${h.chatWidth}px`};return a.jsxs("div",{className:"split"+(p?" split--chat-collapsed":"")+(s?" split--work-hidden":""),style:x,children:[p?a.jsx("button",{type:"button",className:"split-chat-peek",onClick:()=>z.setChatCollapsed(!1),title:"展开对话","aria-label":"展开对话",children:a.jsx(Pz,{})}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"split__chat",children:a.jsx(Cz,{chat:t,onSend:i,title:o,subtitle:l,placeholder:c,emptyHint:u})}),!s&&a.jsx("button",{type:"button",className:"split-resizer",onPointerDown:v,title:"拖拽调整对话宽度;拖到较窄会自动收起","aria-label":"拖拽调整对话宽度"})]}),!s&&a.jsx("div",{className:"split__work",children:d?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"work-head",children:[a.jsx("div",{className:"work-head__title",children:"问题"}),a.jsx("div",{className:"work-head__sub",children:"回答后继续"})]}),a.jsx(Tz,{form:d.form,formKey:d.segmentId,interactive:!0,onSubmit:(w,g)=>t.submitForm(g)})]}):f?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"work-head",children:[a.jsx("div",{className:"work-head__title",children:"问题"}),a.jsx("div",{className:"work-head__sub",children:"生成下一步"})]}),a.jsx("div",{className:"work-body",children:a.jsx("div",{className:"empty-hint",children:"正在生成下一步配置问题…"})})]}):a.jsxs(a.Fragment,{children:[r,n]})})]})});function Pz(){return a.jsx("span",{"aria-hidden":!0,children:"›"})}const zk="";async function Mz(){return await(await io("/api/account/profile")).json()}async function qg(){return(await(await io("/api/account/machines")).json()).machines}async function Iz(e){await io(`/api/account/machines/${e}`,{method:"DELETE"})}async function Rz(e,t){await io(`/api/account/machines/${e}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)})}async function Oz(e){return(await(await io(`/api/account/machines/${e}/regenerate-key`,{method:"POST"})).json()).key}async function Vk(){return(await(await io("/api/account/owner-token")).json()).token}let Ap;async function $z(){try{const e=await fetch(`${zk}/api/public-config`);if(e.ok){const t=await e.json();t.relayGatewayUrl&&(Ap=t.relayGatewayUrl)}}catch{}}function Fk(){return Ap||(typeof window<"u"?window.location.origin.replace(/^http/,"ws"):"ws://your-server:8787")}const A_="@ali/aitable-workflow@latest",Lz="";function Dz(e){return e?`npm i -g --registry=${e} ${A_}`:`npm i -g ${A_}`}function zz(e=Lz){return Dz(e)}function Vz(e,t=Fk()){return["aitable-workflow connect",` --server-url ${t}`,` --key ${e}`," --name <此机器名>"].join(` \\
67
+ `)}function Fz(e,t="<此机器名>",n=Fk()){return["aitable-workflow connect",` --server-url ${n}`,` --token ${e}`,` --name ${t}`].join(` \\
68
+ `)}async function io(e,t){var i;const n=As.getToken(),r=new Headers(t==null?void 0:t.headers);n&&r.set("Authorization",`Bearer ${n}`);let s;try{s=await fetch(`${zk}${e}`,{...t,headers:r})}catch(o){const l=o instanceof Error?o.message:String(o);throw new Error(`无法连接后端服务(当前站点):${l}`)}if(!s.ok){const o=await s.text();try{const l=JSON.parse(o);if((i=l.error)!=null&&i.message)throw new Error(l.error.message)}catch(l){if(l instanceof Error&&l.message!==o)throw l}throw new Error(o||`HTTP ${s.status}`)}return s}const T_={claudecode:"Claude",codex:"Codex",qoder:"Qoder"};function Bz({projectId:e}){var w,g,y;const[t,n]=b.useState(null),[r,s]=b.useState(!1),[i,o]=b.useState([]),[l,c]=b.useState(!1);if(b.useEffect(()=>{!it||!e||fc(e).then(m=>n(m)).catch(()=>{})},[e]),!t||!t.machineId)return null;const u=t.status==="online",d=((w=t.machine)==null?void 0:w.runtimes)??[],f=((g=t.machine)==null?void 0:g.hasDws)??!1,h=((y=t.machine)==null?void 0:y.hostname)??t.machineId.slice(0,8);async function p(){if(!e)return;c(!0);let m=0;const _=setInterval(async()=>{m++;try{const j=await fc(e);j.status==="online"?(clearInterval(_),n(j),c(!1)):m>=12&&(clearInterval(_),c(!1))}catch{m>=12&&(clearInterval(_),c(!1))}},5e3)}async function v(){try{const m=await qg();o(m.filter(_=>_.status==="online"))}catch{}s(!0)}async function x(m){e&&(await lk(e,m),n(await fc(e)),s(!1))}return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:`engine-bar${u?"":" engine-bar--offline"}`,children:[a.jsx("span",{className:`machine-status ${u?"machine-status--online":"machine-status--offline"}`}),a.jsxs("span",{className:"engine-bar__name",children:["⚡ ",h]}),u?a.jsxs("span",{className:"engine-bar__caps",children:[d.map(m=>T_[m]??m).join(" · "),f?" · dws ✓":""]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"engine-bar__offline-text",children:"离线"}),l?a.jsx("span",{className:"engine-bar__waiting",children:"等待重连中..."}):a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"engine-bar__action",onClick:()=>void p(),children:"等待重连"}),a.jsx("button",{type:"button",className:"engine-bar__action",onClick:()=>void v(),children:"切换引擎"}),a.jsx("button",{type:"button",className:"engine-bar__action",onClick:()=>z.setRoute("engines"),children:"管理引擎"})]})]})]}),r&&a.jsx("div",{className:"engine-switch-overlay",onClick:()=>s(!1),children:a.jsxs("div",{className:"engine-switch-dialog",onClick:m=>m.stopPropagation(),children:[a.jsx("div",{className:"engine-switch-dialog__title",children:"切换执行引擎"}),i.length===0?a.jsx("div",{className:"engine-switch-dialog__empty",children:"没有其他在线引擎"}):i.map(m=>a.jsxs("button",{type:"button",className:"engine-switch-dialog__option",onClick:()=>void x(m.machineId),children:[a.jsx("span",{className:"machine-status machine-status--online"}),a.jsx("span",{children:m.displayName||m.name}),a.jsx("span",{className:"engine-switch-dialog__caps",children:m.runtimes.map(_=>T_[_]??_).join(" · ")})]},m.machineId)),a.jsx("button",{type:"button",className:"engine-switch-dialog__cancel",onClick:()=>s(!1),children:"取消"})]})})]})}function Bk({title:e,missing:t,warnings:n=[],onClose:r,onLocate:s}){return a.jsx("div",{className:"modal-overlay",onClick:r,children:a.jsxs("div",{className:"modal-card",onClick:i=>i.stopPropagation(),children:[a.jsxs("div",{className:"modal-card__head",children:[a.jsx("span",{className:"modal-card__icon",children:a.jsx(V,{name:"warn",size:16})}),a.jsx("span",{className:"modal-card__title",children:e??"无法进入下一步"}),a.jsx("button",{type:"button",className:"modal-card__close",onClick:r,children:a.jsx(V,{name:"close",size:14})})]}),a.jsxs("div",{className:"modal-card__body",children:[t.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"modal-card__section-label",children:"当前阶段还缺少以下必填配置:"}),a.jsx("ul",{className:"modal-card__list",children:t.map((i,o)=>a.jsxs("li",{className:"modal-card__item modal-card__item--error",children:[a.jsxs("span",{className:"modal-card__item-scope",children:["[",P_(i.scope),"]"]}),a.jsx("span",{className:"modal-card__item-target",children:i.target}),a.jsx("span",{className:"modal-card__item-label",children:i.label}),a.jsx("button",{type:"button",className:"modal-card__locate",onClick:()=>s(i),children:"定位 →"})]},`${i.code}-${i.target}-${o}`))})]}),n.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"modal-card__section-label modal-card__section-label--warn",children:"以下为建议项(不阻断):"}),a.jsx("ul",{className:"modal-card__list",children:n.map((i,o)=>a.jsxs("li",{className:"modal-card__item modal-card__item--warn",children:[a.jsxs("span",{className:"modal-card__item-scope",children:["[",P_(i.scope),"]"]}),a.jsx("span",{className:"modal-card__item-label",children:i.label})]},`${i.code}-${i.target}-${o}`))})]})]}),a.jsxs("div",{className:"modal-card__foot",children:[a.jsx("button",{type:"button",className:"modal-card__btn",onClick:r,children:"稍后处理"}),t.length>0&&a.jsx("button",{type:"button",className:"primary modal-card__btn",onClick:()=>s(t[0]),children:"去补齐第一项 →"})]})]})})}function P_(e){switch(e){case"project":return"项目";case"workflow":return"工作流";case"step":return"步骤";case"env":return"环境变量"}}class Hz{constructor(t,n){le(this,"lastFilesSummary","");this.chat=t,this.projectId=n}isCurrent(){return z.projectId===this.projectId}async narrate(t){var n,r;if(this.isCurrent())switch(t.type){case"task.blocked":await this.chat.run([{kind:"say",text:((n=t.task.block)==null?void 0:n.message)??"请先确认需求澄清卡片,再开始生成。"}]);return;case"task.failed":await this.chat.run([{kind:"say",text:`${((r=t.task.error)==null?void 0:r.message)??"真实设计失败"}。已保留当前生成文件,可重新确认后再生成。`}]);return;case"error":await this.chat.run([{kind:"say",text:`真实设计中断:${t.error.message}。已保留当前生成文件,右侧可查看并继续重试。`}]);return;case"design.started":await this.chat.run([{kind:"tool",label:"连接真实设计服务",detail:this.projectId,ms:80}]);return;case"design.discovery":await this.chat.run([{kind:"tool",label:"形成需求摘要",detail:Kz(t.summary),ms:120}]);return;case"design.progress":if(qz(t.phase))return;await this.chat.run([{kind:"tool",label:t.message,detail:`累计 ${M_(t.elapsedMs)} · 本段 ${M_(t.deltaMs)}`,ms:80}]);return;case"design.round_start":t.round===1&&z.clearAgentTrace(),await this.chat.run([{kind:"tool",label:t.isFix?"完善流程方案":"生成流程方案",detail:`第 ${t.round} 轮 · 真实 Agent 执行中`,ms:100}]);return;case"design.agent_event":{const s=TL(t.event,z.live.designRound??void 0);if(s&&z.appendAgentTrace(s),t.event.type==="text"&&t.event.content){this.chat.enqueue([{kind:"agent-text",content:t.event.content}]);return}if(t.event.type==="thinking"&&t.event.content){this.chat.enqueue([{kind:"agent-thinking",content:t.event.content}]);return}if(t.event.type==="tool_use"){const i=JS({toolName:t.event.toolName,toolInput:t.event.toolInput,projectId:this.projectId});this.chat.enqueue([{kind:"tool",label:i.label,detail:i.detail,ms:80}])}return}case"design.validation":await this.chat.run([{kind:"tool",label:"校验流程方案",detail:t.validation.valid?"通过":`${t.validation.errors.length} 个问题`,ms:100}]);return;case"design.files":{const s=Gz(t.files);if(s===this.lastFilesSummary)return;this.lastFilesSummary=s,await this.chat.run([{kind:"tool",label:"同步生成文件",detail:s,ms:80}]);return}case"design.done":{z.appendAgentTrace({kind:"status",text:"",boundary:!0});const s=z.live.designAgentEvents;if(t.success){await this.chat.run([{kind:"say",text:`真实工作流已生成:${z.steps.length} 个步骤;实际执行 ${t.rounds} 轮,收到 ${s} 个 Agent 事件。右侧画布和配置面板已切换为真实产物。`}]);return}await this.chat.run([{kind:"say",text:`真实设计未通过校验:实际执行 ${t.rounds} 轮,收到 ${s} 个 Agent 事件。已保留当前生成文件,右侧可以先查看文件内容,再重试生成。`}]);return}default:return}}}async function Uz(e,t,n){var s,i;if(z.projectId!==t)return;const r=PL(n);switch(r&&z.appendAgentTrace(r),n.type){case"task.blocked":await e.run([{kind:"say",text:((s=n.task.block)==null?void 0:s.message)??"真实 setup 已暂停,完成授权后可以继续搭建。"}]);return;case"task.failed":await e.run([{kind:"say",text:`真实 setup 失败:${((i=n.task.error)==null?void 0:i.message)??"未知错误"}`}]);return;case"error":await e.run([{kind:"say",text:`真实 setup 失败:${n.error.message}`}]);return;case"setup.progress":await e.run([{kind:"say",text:n.message}]);return;case"setup.done":await e.run([{kind:"todo-advance"},{kind:"todo-advance"},{kind:"todo-advance"},{kind:"todo-advance"},{kind:"say",text:`真实 setup 已完成,AI 表格链接已生成,Table Id 已写回:${n.tableId}。`}]);return;default:return}}function Wz(e,t){if(z.projectId!==e)return;const n=ML(t);n&&z.appendAgentTrace(n)}function Kz(e){const n=e.replace(/^用户已确认[::]?\s*/u,"").split(/[\n。;;]/u).map(s=>s.replace(/^[-•\s]+/u,"").trim()).filter(Boolean).filter(s=>!s.toLowerCase().includes("skipped")).slice(0,3).map(s=>s.replace(/\s+/g," ")),r=n.length>0?n.join(" · "):e.replace(/\s+/g," ").trim();return Mg(r,96)}function Gz(e){return e.filter(n=>!n.path.endsWith("project.json")).map(n=>{var r;return((r=id(n.path))==null?void 0:r.name)??n.path.split("/").pop()??n.path}).join(" · ")}function qz(e){return e==="agent_tool"||e==="file_snapshot"||e==="agent_round"}function M_(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}async function Yz(e,t){const n=new Hz(e,t);await e.run([{kind:"say",text:"我会调用真实设计服务,先理解你的 SOP 与角色配置,再生成可落地的工作流方案。主要耗时在真实 Agent 生成阶段。"}]);const r=e.beginTask("真实 Agent 生成工作流",t);try{await n3(t,async s=>{z.applyDesignEvent(t,s)&&(s.type==="design.files"&&await Hk(t,s.files),(s.type==="task.failed"||s.type==="error")&&await kf(t),s.type==="design.done"&&(s.success?await e4(t):await kf(t)),await n.narrate(s))}),r("done")}catch(s){r("error");const i=s instanceof Error?s.message:String(s);if(z.projectId!==t)return;z.patchLive(t,{designMessage:`真实设计请求失败:${i}`}),await kf(t),await e.run([{kind:"say",text:`真实设计请求失败:${i}。已保留当前生成文件,右侧可查看并重新进入设计。`}])}}async function Xz(e,t){await e.run([{kind:"say",text:"开始搭建真实 AI 表格结构。该步骤会通过 dws 对目标 AI 表格产生真实字段/视图变更。"},{kind:"todo",items:["加载配置","读取 workflow","创建字段与视图","生成 AI 表格链接"]}]),await r3(t,async n=>{z.applySetupEvent(t,n)&&(n.type==="setup.done"&&z.patchInitDraft({tableConnected:!0,tableBaseId:n.baseId,tableId:n.tableId}),await Uz(e,t,n))})}async function Qz(e,t){if(z.projectId!==e)return;z.patchLive(e,{tickets:[],logs:[]});const n=await s3(e,async r=>{z.applyRunEvent(e,r)&&Wz(e,r)},t);n.mode==="lease"&&await Jz(e,n.schedule,t)}const Zz=3e3;async function Jz(e,t,n){var s;z.applyRunSchedule(e,t);let r=0;for(;!((s=n==null?void 0:n.signal)!=null&&s.aborted)&&z.projectId===e;){try{const[i,o,l]=await Promise.all([o3(e),a3(e),l3(e,{afterSeq:r}).catch(()=>null)]);if(z.projectId!==e)return;const c=i.schedule??null;if(c&&z.applyRunSchedule(e,c),z.applyRunRecords(e,o.items),l){r=l.lastSeq;for(const u of l.events)z.appendRunTimelineEntry(e,u)}if(c&&c.desiredState==="stopped"&&!c.machineId)return}catch(i){z.appendRunPollError(e,i instanceof Error?i.message:String(i))}await new Promise(i=>setTimeout(i,Zz))}}async function e4(e){const t=z.currentWorkflowId,[n,r]=await Promise.all([ad(e,t).catch(()=>null),Dg(e).catch(()=>null)]);r&&z.applyServerFiles(e,r),n&&z.applyServerWorkflow(e,n)}async function kf(e){try{const t=await Dg(e);if(!z.applyServerFiles(e,t))return;await Hk(e,t)}catch{}}async function Hk(e,t){if(t.some(n=>n.path==="workflow.yml"||n.path.endsWith("/workflow.yml")))try{const n=await ad(e,z.currentWorkflowId);z.applyServerWorkflow(e,n)}catch{}}function Yg(e,t){const n=z.stream,r=z.projectId,s=n==null?void 0:n.stage,i=(n==null?void 0:n.taskId)??null;b.useEffect(()=>{z.mode!=="live"||!r||s!==e||Na(e,r,t)},[t,r,e,s,i])}const Nf=new Map,Tp=new Map;function Na(e,t,n){const r=`${e}:${t}`,s=Nf.get(r);if(s)return s;const i=new AbortController;Tp.set(r,i);const o=(async()=>{var l;try{e==="run"?await Qz(t,{signal:i.signal}):e==="design"?await Yz(n,t):await Xz(n,t)}finally{Nf.delete(r),Tp.delete(r),z.projectId===t&&((l=z.stream)==null?void 0:l.stage)===e&&await y3(t)}})();return Nf.set(r,o),o}function I_(e,t){var n;(n=Tp.get(`${e}:${t}`))==null||n.abort()}function Fe(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=Fe(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var t4={value:()=>{}};function cd(){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 vc(n)}function vc(e){this._=e}function n4(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",s=n.indexOf(".");if(s>=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}vc.prototype=cd.prototype={constructor:vc,on:function(e,t){var n=this._,r=n4(e+"",n),s,i=-1,o=r.length;if(arguments.length<2){for(;++i<o;)if((s=(e=r[i]).type)&&(s=r4(n[s],e.name)))return s;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<o;)if(s=(e=r[i]).type)n[s]=R_(n[s],e.name,t);else if(t==null)for(s in n)n[s]=R_(n[s],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new vc(e)},call:function(e,t){if((s=arguments.length-2)>0)for(var n=new Array(s),r=0,s,i;r<s;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,s=i.length;r<s;++r)i[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],s=0,i=r.length;s<i;++s)r[s].value.apply(t,n)}};function r4(e,t){for(var n=0,r=e.length,s;n<r;++n)if((s=e[n]).name===t)return s.value}function R_(e,t,n){for(var r=0,s=e.length;r<s;++r)if(e[r].name===t){e[r]=t4,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Pp="http://www.w3.org/1999/xhtml";const O_={svg:"http://www.w3.org/2000/svg",xhtml:Pp,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ud(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),O_.hasOwnProperty(t)?{space:O_[t],local:e}:e}function s4(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Pp&&t.documentElement.namespaceURI===Pp?t.createElement(e):t.createElementNS(n,e)}}function i4(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Uk(e){var t=ud(e);return(t.local?i4:s4)(t)}function o4(){}function Xg(e){return e==null?o4:function(){return this.querySelector(e)}}function a4(e){typeof e!="function"&&(e=Xg(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],o=i.length,l=r[s]=new Array(o),c,u,d=0;d<o;++d)(c=i[d])&&(u=e.call(c,c.__data__,d,i))&&("__data__"in c&&(u.__data__=c.__data__),l[d]=u);return new Tt(r,this._parents)}function l4(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function c4(){return[]}function Wk(e){return e==null?c4:function(){return this.querySelectorAll(e)}}function u4(e){return function(){return l4(e.apply(this,arguments))}}function d4(e){typeof e=="function"?e=u4(e):e=Wk(e);for(var t=this._groups,n=t.length,r=[],s=[],i=0;i<n;++i)for(var o=t[i],l=o.length,c,u=0;u<l;++u)(c=o[u])&&(r.push(e.call(c,c.__data__,u,o)),s.push(c));return new Tt(r,s)}function Kk(e){return function(){return this.matches(e)}}function Gk(e){return function(t){return t.matches(e)}}var f4=Array.prototype.find;function h4(e){return function(){return f4.call(this.children,e)}}function p4(){return this.firstElementChild}function m4(e){return this.select(e==null?p4:h4(typeof e=="function"?e:Gk(e)))}var g4=Array.prototype.filter;function v4(){return Array.from(this.children)}function y4(e){return function(){return g4.call(this.children,e)}}function _4(e){return this.selectAll(e==null?v4:y4(typeof e=="function"?e:Gk(e)))}function x4(e){typeof e!="function"&&(e=Kk(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],o=i.length,l=r[s]=[],c,u=0;u<o;++u)(c=i[u])&&e.call(c,c.__data__,u,i)&&l.push(c);return new Tt(r,this._parents)}function qk(e){return new Array(e.length)}function w4(){return new Tt(this._enter||this._groups.map(qk),this._parents)}function pu(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}pu.prototype={constructor:pu,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 b4(e){return function(){return e}}function j4(e,t,n,r,s,i){for(var o=0,l,c=t.length,u=i.length;o<u;++o)(l=t[o])?(l.__data__=i[o],r[o]=l):n[o]=new pu(e,i[o]);for(;o<c;++o)(l=t[o])&&(s[o]=l)}function S4(e,t,n,r,s,i,o){var l,c,u=new Map,d=t.length,f=i.length,h=new Array(d),p;for(l=0;l<d;++l)(c=t[l])&&(h[l]=p=o.call(c,c.__data__,l,t)+"",u.has(p)?s[l]=c:u.set(p,c));for(l=0;l<f;++l)p=o.call(e,i[l],l,i)+"",(c=u.get(p))?(r[l]=c,c.__data__=i[l],u.delete(p)):n[l]=new pu(e,i[l]);for(l=0;l<d;++l)(c=t[l])&&u.get(h[l])===c&&(s[l]=c)}function k4(e){return e.__data__}function N4(e,t){if(!arguments.length)return Array.from(this,k4);var n=t?S4:j4,r=this._parents,s=this._groups;typeof e!="function"&&(e=b4(e));for(var i=s.length,o=new Array(i),l=new Array(i),c=new Array(i),u=0;u<i;++u){var d=r[u],f=s[u],h=f.length,p=E4(e.call(d,d&&d.__data__,u,r)),v=p.length,x=l[u]=new Array(v),w=o[u]=new Array(v),g=c[u]=new Array(h);n(d,f,x,w,g,p,t);for(var y=0,m=0,_,j;y<v;++y)if(_=x[y]){for(y>=m&&(m=y+1);!(j=w[m])&&++m<v;);_._next=j||null}}return o=new Tt(o,r),o._enter=l,o._exit=c,o}function E4(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function C4(){return new Tt(this._exit||this._groups.map(qk),this._parents)}function A4(e,t,n){var r=this.enter(),s=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(s=t(s),s&&(s=s.selection())),n==null?i.remove():n(i),r&&s?r.merge(s).order():s}function T4(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,s=n.length,i=r.length,o=Math.min(s,i),l=new Array(s),c=0;c<o;++c)for(var u=n[c],d=r[c],f=u.length,h=l[c]=new Array(f),p,v=0;v<f;++v)(p=u[v]||d[v])&&(h[v]=p);for(;c<s;++c)l[c]=n[c];return new Tt(l,this._parents)}function P4(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],s=r.length-1,i=r[s],o;--s>=0;)(o=r[s])&&(i&&o.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(o,i),i=o);return this}function M4(e){e||(e=I4);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var n=this._groups,r=n.length,s=new Array(r),i=0;i<r;++i){for(var o=n[i],l=o.length,c=s[i]=new Array(l),u,d=0;d<l;++d)(u=o[d])&&(c[d]=u);c.sort(t)}return new Tt(s,this._parents).order()}function I4(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function R4(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function O4(){return Array.from(this)}function $4(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,i=r.length;s<i;++s){var o=r[s];if(o)return o}return null}function L4(){let e=0;for(const t of this)++e;return e}function D4(){return!this.node()}function z4(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var s=t[n],i=0,o=s.length,l;i<o;++i)(l=s[i])&&e.call(l,l.__data__,i,s);return this}function V4(e){return function(){this.removeAttribute(e)}}function F4(e){return function(){this.removeAttributeNS(e.space,e.local)}}function B4(e,t){return function(){this.setAttribute(e,t)}}function H4(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function U4(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function W4(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 K4(e,t){var n=ud(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?F4:V4:typeof t=="function"?n.local?W4:U4:n.local?H4:B4)(n,t))}function Yk(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function G4(e){return function(){this.style.removeProperty(e)}}function q4(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Y4(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function X4(e,t,n){return arguments.length>1?this.each((t==null?G4:typeof t=="function"?Y4:q4)(e,t,n??"")):Bi(this.node(),e)}function Bi(e,t){return e.style.getPropertyValue(t)||Yk(e).getComputedStyle(e,null).getPropertyValue(t)}function Q4(e){return function(){delete this[e]}}function Z4(e,t){return function(){this[e]=t}}function J4(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function eV(e,t){return arguments.length>1?this.each((t==null?Q4:typeof t=="function"?J4:Z4)(e,t)):this.node()[e]}function Xk(e){return e.trim().split(/^|\s+/)}function Qg(e){return e.classList||new Qk(e)}function Qk(e){this._node=e,this._names=Xk(e.getAttribute("class")||"")}Qk.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 Zk(e,t){for(var n=Qg(e),r=-1,s=t.length;++r<s;)n.add(t[r])}function Jk(e,t){for(var n=Qg(e),r=-1,s=t.length;++r<s;)n.remove(t[r])}function tV(e){return function(){Zk(this,e)}}function nV(e){return function(){Jk(this,e)}}function rV(e,t){return function(){(t.apply(this,arguments)?Zk:Jk)(this,e)}}function sV(e,t){var n=Xk(e+"");if(arguments.length<2){for(var r=Qg(this.node()),s=-1,i=n.length;++s<i;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof t=="function"?rV:t?tV:nV)(n,t))}function iV(){this.textContent=""}function oV(e){return function(){this.textContent=e}}function aV(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function lV(e){return arguments.length?this.each(e==null?iV:(typeof e=="function"?aV:oV)(e)):this.node().textContent}function cV(){this.innerHTML=""}function uV(e){return function(){this.innerHTML=e}}function dV(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function fV(e){return arguments.length?this.each(e==null?cV:(typeof e=="function"?dV:uV)(e)):this.node().innerHTML}function hV(){this.nextSibling&&this.parentNode.appendChild(this)}function pV(){return this.each(hV)}function mV(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function gV(){return this.each(mV)}function vV(e){var t=typeof e=="function"?e:Uk(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function yV(){return null}function _V(e,t){var n=typeof e=="function"?e:Uk(e),r=t==null?yV:typeof t=="function"?t:Xg(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function xV(){var e=this.parentNode;e&&e.removeChild(this)}function wV(){return this.each(xV)}function bV(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function jV(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function SV(e){return this.select(e?jV:bV)}function kV(e){return arguments.length?this.property("__data__",e):this.node().__data__}function NV(e){return function(t){e.call(this,t,this.__data__)}}function EV(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 CV(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,s=t.length,i;n<s;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function AV(e,t,n){return function(){var r=this.__on,s,i=NV(t);if(r){for(var o=0,l=r.length;o<l;++o)if((s=r[o]).type===e.type&&s.name===e.name){this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=i,s.options=n),s.value=t;return}}this.addEventListener(e.type,i,n),s={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(s):this.__on=[s]}}function TV(e,t,n){var r=EV(e+""),s,i=r.length,o;if(arguments.length<2){var l=this.node().__on;if(l){for(var c=0,u=l.length,d;c<u;++c)for(s=0,d=l[c];s<i;++s)if((o=r[s]).type===d.type&&o.name===d.name)return d.value}return}for(l=t?AV:CV,s=0;s<i;++s)this.each(l(r[s],t,n));return this}function eN(e,t,n){var r=Yk(e),s=r.CustomEvent;typeof s=="function"?s=new s(t,n):(s=r.document.createEvent("Event"),n?(s.initEvent(t,n.bubbles,n.cancelable),s.detail=n.detail):s.initEvent(t,!1,!1)),e.dispatchEvent(s)}function PV(e,t){return function(){return eN(this,e,t)}}function MV(e,t){return function(){return eN(this,e,t.apply(this,arguments))}}function IV(e,t){return this.each((typeof t=="function"?MV:PV)(e,t))}function*RV(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,i=r.length,o;s<i;++s)(o=r[s])&&(yield o)}var tN=[null];function Tt(e,t){this._groups=e,this._parents=t}function Ja(){return new Tt([[document.documentElement]],tN)}function OV(){return this}Tt.prototype=Ja.prototype={constructor:Tt,select:a4,selectAll:d4,selectChild:m4,selectChildren:_4,filter:x4,data:N4,enter:w4,exit:C4,join:A4,merge:T4,selection:OV,order:P4,sort:M4,call:R4,nodes:O4,node:$4,size:L4,empty:D4,each:z4,attr:K4,style:X4,property:eV,classed:sV,text:lV,html:fV,raise:pV,lower:gV,append:vV,insert:_V,remove:wV,clone:SV,datum:kV,on:TV,dispatch:IV,[Symbol.iterator]:RV};function bt(e){return typeof e=="string"?new Tt([[document.querySelector(e)]],[document.documentElement]):new Tt([[e]],tN)}function $V(e){let t;for(;t=e.sourceEvent;)e=t;return e}function tn(e,t){if(e=$V(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}}return[e.pageX,e.pageY]}const LV={passive:!1},Ea={capture:!0,passive:!1};function Ef(e){e.stopImmediatePropagation()}function ki(e){e.preventDefault(),e.stopImmediatePropagation()}function nN(e){var t=e.document.documentElement,n=bt(e).on("dragstart.drag",ki,Ea);"onselectstart"in t?n.on("selectstart.drag",ki,Ea):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function rN(e,t){var n=e.document.documentElement,r=bt(e).on("dragstart.drag",null);t&&(r.on("click.drag",ki,Ea),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 Rl=e=>()=>e;function Mp(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:i,x:o,y:l,dx:c,dy:u,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}Mp.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function DV(e){return!e.ctrlKey&&!e.button}function zV(){return this.parentNode}function VV(e,t){return t??{x:e.x,y:e.y}}function FV(){return navigator.maxTouchPoints||"ontouchstart"in this}function sN(){var e=DV,t=zV,n=VV,r=FV,s={},i=cd("start","drag","end"),o=0,l,c,u,d,f=0;function h(_){_.on("mousedown.drag",p).filter(r).on("touchstart.drag",w).on("touchmove.drag",g,LV).on("touchend.drag touchcancel.drag",y).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(_,j){if(!(d||!e.call(this,_,j))){var N=m(this,t.call(this,_,j),_,j,"mouse");N&&(bt(_.view).on("mousemove.drag",v,Ea).on("mouseup.drag",x,Ea),nN(_.view),Ef(_),u=!1,l=_.clientX,c=_.clientY,N("start",_))}}function v(_){if(ki(_),!u){var j=_.clientX-l,N=_.clientY-c;u=j*j+N*N>f}s.mouse("drag",_)}function x(_){bt(_.view).on("mousemove.drag mouseup.drag",null),rN(_.view,u),ki(_),s.mouse("end",_)}function w(_,j){if(e.call(this,_,j)){var N=_.changedTouches,k=t.call(this,_,j),S=N.length,P,$;for(P=0;P<S;++P)($=m(this,k,_,j,N[P].identifier,N[P]))&&(Ef(_),$("start",_,N[P]))}}function g(_){var j=_.changedTouches,N=j.length,k,S;for(k=0;k<N;++k)(S=s[j[k].identifier])&&(ki(_),S("drag",_,j[k]))}function y(_){var j=_.changedTouches,N=j.length,k,S;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),k=0;k<N;++k)(S=s[j[k].identifier])&&(Ef(_),S("end",_,j[k]))}function m(_,j,N,k,S,P){var $=i.copy(),D=tn(P||N,j),I,O,E;if((E=n.call(_,new Mp("beforestart",{sourceEvent:N,target:h,identifier:S,active:o,x:D[0],y:D[1],dx:0,dy:0,dispatch:$}),k))!=null)return I=E.x-D[0]||0,O=E.y-D[1]||0,function A(C,M,T){var R=D,B;switch(C){case"start":s[S]=A,B=o++;break;case"end":delete s[S],--o;case"drag":D=tn(T||M,j),B=o;break}$.call(C,_,new Mp(C,{sourceEvent:M,subject:E,target:h,identifier:S,active:B,x:D[0]+I,y:D[1]+O,dx:D[0]-R[0],dy:D[1]-R[1],dispatch:$}),k)}}return h.filter=function(_){return arguments.length?(e=typeof _=="function"?_:Rl(!!_),h):e},h.container=function(_){return arguments.length?(t=typeof _=="function"?_:Rl(_),h):t},h.subject=function(_){return arguments.length?(n=typeof _=="function"?_:Rl(_),h):n},h.touchable=function(_){return arguments.length?(r=typeof _=="function"?_:Rl(!!_),h):r},h.on=function(){var _=i.on.apply(i,arguments);return _===i?h:_},h.clickDistance=function(_){return arguments.length?(f=(_=+_)*_,h):Math.sqrt(f)},h}function Zg(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function iN(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function el(){}var Ca=.7,mu=1/Ca,Ni="\\s*([+-]?\\d+)\\s*",Aa="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",On="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",BV=/^#([0-9a-f]{3,8})$/,HV=new RegExp(`^rgb\\(${Ni},${Ni},${Ni}\\)$`),UV=new RegExp(`^rgb\\(${On},${On},${On}\\)$`),WV=new RegExp(`^rgba\\(${Ni},${Ni},${Ni},${Aa}\\)$`),KV=new RegExp(`^rgba\\(${On},${On},${On},${Aa}\\)$`),GV=new RegExp(`^hsl\\(${Aa},${On},${On}\\)$`),qV=new RegExp(`^hsla\\(${Aa},${On},${On},${Aa}\\)$`),$_={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};Zg(el,Ts,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:L_,formatHex:L_,formatHex8:YV,formatHsl:XV,formatRgb:D_,toString:D_});function L_(){return this.rgb().formatHex()}function YV(){return this.rgb().formatHex8()}function XV(){return oN(this).formatHsl()}function D_(){return this.rgb().formatRgb()}function Ts(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=BV.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?z_(t):n===3?new ht(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Ol(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Ol(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=HV.exec(e))?new ht(t[1],t[2],t[3],1):(t=UV.exec(e))?new ht(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=WV.exec(e))?Ol(t[1],t[2],t[3],t[4]):(t=KV.exec(e))?Ol(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=GV.exec(e))?B_(t[1],t[2]/100,t[3]/100,1):(t=qV.exec(e))?B_(t[1],t[2]/100,t[3]/100,t[4]):$_.hasOwnProperty(e)?z_($_[e]):e==="transparent"?new ht(NaN,NaN,NaN,0):null}function z_(e){return new ht(e>>16&255,e>>8&255,e&255,1)}function Ol(e,t,n,r){return r<=0&&(e=t=n=NaN),new ht(e,t,n,r)}function QV(e){return e instanceof el||(e=Ts(e)),e?(e=e.rgb(),new ht(e.r,e.g,e.b,e.opacity)):new ht}function Ip(e,t,n,r){return arguments.length===1?QV(e):new ht(e,t,n,r??1)}function ht(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Zg(ht,Ip,iN(el,{brighter(e){return e=e==null?mu:Math.pow(mu,e),new ht(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ca:Math.pow(Ca,e),new ht(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ht(ys(this.r),ys(this.g),ys(this.b),gu(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:V_,formatHex:V_,formatHex8:ZV,formatRgb:F_,toString:F_}));function V_(){return`#${fs(this.r)}${fs(this.g)}${fs(this.b)}`}function ZV(){return`#${fs(this.r)}${fs(this.g)}${fs(this.b)}${fs((isNaN(this.opacity)?1:this.opacity)*255)}`}function F_(){const e=gu(this.opacity);return`${e===1?"rgb(":"rgba("}${ys(this.r)}, ${ys(this.g)}, ${ys(this.b)}${e===1?")":`, ${e})`}`}function gu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ys(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function fs(e){return e=ys(e),(e<16?"0":"")+e.toString(16)}function B_(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new sn(e,t,n,r)}function oN(e){if(e instanceof sn)return new sn(e.h,e.s,e.l,e.opacity);if(e instanceof el||(e=Ts(e)),!e)return new sn;if(e instanceof sn)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),i=Math.max(t,n,r),o=NaN,l=i-s,c=(i+s)/2;return l?(t===i?o=(n-r)/l+(n<r)*6:n===i?o=(r-t)/l+2:o=(t-n)/l+4,l/=c<.5?i+s:2-i-s,o*=60):l=c>0&&c<1?0:o,new sn(o,l,c,e.opacity)}function JV(e,t,n,r){return arguments.length===1?oN(e):new sn(e,t,n,r??1)}function sn(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Zg(sn,JV,iN(el,{brighter(e){return e=e==null?mu:Math.pow(mu,e),new sn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ca:Math.pow(Ca,e),new sn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,s=2*n-r;return new ht(Cf(e>=240?e-240:e+120,s,r),Cf(e,s,r),Cf(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new sn(H_(this.h),$l(this.s),$l(this.l),gu(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=gu(this.opacity);return`${e===1?"hsl(":"hsla("}${H_(this.h)}, ${$l(this.s)*100}%, ${$l(this.l)*100}%${e===1?")":`, ${e})`}`}}));function H_(e){return e=(e||0)%360,e<0?e+360:e}function $l(e){return Math.max(0,Math.min(1,e||0))}function Cf(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 Jg=e=>()=>e;function eF(e,t){return function(n){return e+n*t}}function tF(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 nF(e){return(e=+e)==1?aN:function(t,n){return n-t?tF(t,n,e):Jg(isNaN(t)?n:t)}}function aN(e,t){var n=t-e;return n?eF(e,n):Jg(isNaN(e)?t:e)}const vu=function e(t){var n=nF(t);function r(s,i){var o=n((s=Ip(s)).r,(i=Ip(i)).r),l=n(s.g,i.g),c=n(s.b,i.b),u=aN(s.opacity,i.opacity);return function(d){return s.r=o(d),s.g=l(d),s.b=c(d),s.opacity=u(d),s+""}}return r.gamma=e,r}(1);function rF(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),s;return function(i){for(s=0;s<n;++s)r[s]=e[s]*(1-i)+t[s]*i;return r}}function sF(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function iF(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,s=new Array(r),i=new Array(n),o;for(o=0;o<r;++o)s[o]=qo(e[o],t[o]);for(;o<n;++o)i[o]=t[o];return function(l){for(o=0;o<r;++o)i[o]=s[o](l);return i}}function oF(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function jn(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function aF(e,t){var n={},r={},s;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(s in t)s in e?n[s]=qo(e[s],t[s]):r[s]=t[s];return function(i){for(s in n)r[s]=n[s](i);return r}}var Rp=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Af=new RegExp(Rp.source,"g");function lF(e){return function(){return e}}function cF(e){return function(t){return e(t)+""}}function lN(e,t){var n=Rp.lastIndex=Af.lastIndex=0,r,s,i,o=-1,l=[],c=[];for(e=e+"",t=t+"";(r=Rp.exec(e))&&(s=Af.exec(t));)(i=s.index)>n&&(i=t.slice(n,i),l[o]?l[o]+=i:l[++o]=i),(r=r[0])===(s=s[0])?l[o]?l[o]+=s:l[++o]=s:(l[++o]=null,c.push({i:o,x:jn(r,s)})),n=Af.lastIndex;return n<t.length&&(i=t.slice(n),l[o]?l[o]+=i:l[++o]=i),l.length<2?c[0]?cF(c[0].x):lF(t):(t=c.length,function(u){for(var d=0,f;d<t;++d)l[(f=c[d]).i]=f.x(u);return l.join("")})}function qo(e,t){var n=typeof t,r;return t==null||n==="boolean"?Jg(t):(n==="number"?jn:n==="string"?(r=Ts(t))?(t=r,vu):lN:t instanceof Ts?vu:t instanceof Date?oF:sF(t)?rF:Array.isArray(t)?iF:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?aF:jn)(e,t)}var U_=180/Math.PI,Op={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function cN(e,t,n,r,s,i){var o,l,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(l=Math.sqrt(n*n+r*r))&&(n/=l,r/=l,c/=l),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:s,translateY:i,rotate:Math.atan2(t,e)*U_,skewX:Math.atan(c)*U_,scaleX:o,scaleY:l}}var Ll;function uF(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Op:cN(t.a,t.b,t.c,t.d,t.e,t.f)}function dF(e){return e==null||(Ll||(Ll=document.createElementNS("http://www.w3.org/2000/svg","g")),Ll.setAttribute("transform",e),!(e=Ll.transform.baseVal.consolidate()))?Op:(e=e.matrix,cN(e.a,e.b,e.c,e.d,e.e,e.f))}function uN(e,t,n,r){function s(u){return u.length?u.pop()+" ":""}function i(u,d,f,h,p,v){if(u!==f||d!==h){var x=p.push("translate(",null,t,null,n);v.push({i:x-4,x:jn(u,f)},{i:x-2,x:jn(d,h)})}else(f||h)&&p.push("translate("+f+t+h+n)}function o(u,d,f,h){u!==d?(u-d>180?d+=360:d-u>180&&(u+=360),h.push({i:f.push(s(f)+"rotate(",null,r)-2,x:jn(u,d)})):d&&f.push(s(f)+"rotate("+d+r)}function l(u,d,f,h){u!==d?h.push({i:f.push(s(f)+"skewX(",null,r)-2,x:jn(u,d)}):d&&f.push(s(f)+"skewX("+d+r)}function c(u,d,f,h,p,v){if(u!==f||d!==h){var x=p.push(s(p)+"scale(",null,",",null,")");v.push({i:x-4,x:jn(u,f)},{i:x-2,x:jn(d,h)})}else(f!==1||h!==1)&&p.push(s(p)+"scale("+f+","+h+")")}return function(u,d){var f=[],h=[];return u=e(u),d=e(d),i(u.translateX,u.translateY,d.translateX,d.translateY,f,h),o(u.rotate,d.rotate,f,h),l(u.skewX,d.skewX,f,h),c(u.scaleX,u.scaleY,d.scaleX,d.scaleY,f,h),u=d=null,function(p){for(var v=-1,x=h.length,w;++v<x;)f[(w=h[v]).i]=w.x(p);return f.join("")}}}var fF=uN(uF,"px, ","px)","deg)"),hF=uN(dF,", ",")",")"),pF=1e-12;function W_(e){return((e=Math.exp(e))+1/e)/2}function mF(e){return((e=Math.exp(e))-1/e)/2}function gF(e){return((e=Math.exp(2*e))-1)/(e+1)}const yc=function e(t,n,r){function s(i,o){var l=i[0],c=i[1],u=i[2],d=o[0],f=o[1],h=o[2],p=d-l,v=f-c,x=p*p+v*v,w,g;if(x<pF)g=Math.log(h/u)/t,w=function(k){return[l+k*p,c+k*v,u*Math.exp(t*k*g)]};else{var y=Math.sqrt(x),m=(h*h-u*u+r*x)/(2*u*n*y),_=(h*h-u*u-r*x)/(2*h*n*y),j=Math.log(Math.sqrt(m*m+1)-m),N=Math.log(Math.sqrt(_*_+1)-_);g=(N-j)/t,w=function(k){var S=k*g,P=W_(j),$=u/(n*y)*(P*gF(t*S+j)-mF(j));return[l+$*p,c+$*v,u*P/W_(t*S+j)]}}return w.duration=g*1e3*t/Math.SQRT2,w}return s.rho=function(i){var o=Math.max(.001,+i),l=o*o,c=l*l;return e(o,l,c)},s}(Math.SQRT2,2,4);var Hi=0,Co=0,yo=0,dN=1e3,yu,Ao,_u=0,Ps=0,dd=0,Ta=typeof performance=="object"&&performance.now?performance:Date,fN=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function ev(){return Ps||(fN(vF),Ps=Ta.now()+dd)}function vF(){Ps=0}function xu(){this._call=this._time=this._next=null}xu.prototype=hN.prototype={constructor:xu,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?ev():+n)+(t==null?0:+t),!this._next&&Ao!==this&&(Ao?Ao._next=this:yu=this,Ao=this),this._call=e,this._time=n,$p()},stop:function(){this._call&&(this._call=null,this._time=1/0,$p())}};function hN(e,t,n){var r=new xu;return r.restart(e,t,n),r}function yF(){ev(),++Hi;for(var e=yu,t;e;)(t=Ps-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Hi}function K_(){Ps=(_u=Ta.now())+dd,Hi=Co=0;try{yF()}finally{Hi=0,xF(),Ps=0}}function _F(){var e=Ta.now(),t=e-_u;t>dN&&(dd-=t,_u=e)}function xF(){for(var e,t=yu,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:yu=n);Ao=e,$p(r)}function $p(e){if(!Hi){Co&&(Co=clearTimeout(Co));var t=e-Ps;t>24?(e<1/0&&(Co=setTimeout(K_,e-Ta.now()-dd)),yo&&(yo=clearInterval(yo))):(yo||(_u=Ta.now(),yo=setInterval(_F,dN)),Hi=1,fN(K_))}}function G_(e,t,n){var r=new xu;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var wF=cd("start","end","cancel","interrupt"),bF=[],pN=0,q_=1,Lp=2,_c=3,Y_=4,Dp=5,xc=6;function fd(e,t,n,r,s,i){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;jF(e,n,{name:t,index:r,group:s,on:wF,tween:bF,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:pN})}function tv(e,t){var n=gn(e,t);if(n.state>pN)throw new Error("too late; already scheduled");return n}function $n(e,t){var n=gn(e,t);if(n.state>_c)throw new Error("too late; already running");return n}function gn(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function jF(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=hN(i,0,n.time);function i(u){n.state=q_,n.timer.restart(o,n.delay,n.time),n.delay<=u&&o(u-n.delay)}function o(u){var d,f,h,p;if(n.state!==q_)return c();for(d in r)if(p=r[d],p.name===n.name){if(p.state===_c)return G_(o);p.state===Y_?(p.state=xc,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete r[d]):+d<t&&(p.state=xc,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete r[d])}if(G_(function(){n.state===_c&&(n.state=Y_,n.timer.restart(l,n.delay,n.time),l(u))}),n.state=Lp,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Lp){for(n.state=_c,s=new Array(h=n.tween.length),d=0,f=-1;d<h;++d)(p=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(s[++f]=p);s.length=f+1}}function l(u){for(var d=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=Dp,1),f=-1,h=s.length;++f<h;)s[f].call(e,d);n.state===Dp&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=xc,n.timer.stop(),delete r[t];for(var u in r)return;delete e.__transition}}function wc(e,t){var n=e.__transition,r,s,i=!0,o;if(n){t=t==null?null:t+"";for(o in n){if((r=n[o]).name!==t){i=!1;continue}s=r.state>Lp&&r.state<Dp,r.state=xc,r.timer.stop(),r.on.call(s?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[o]}i&&delete e.__transition}}function SF(e){return this.each(function(){wc(this,e)})}function kF(e,t){var n,r;return function(){var s=$n(this,e),i=s.tween;if(i!==n){r=n=i;for(var o=0,l=r.length;o<l;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}s.tween=r}}function NF(e,t,n){var r,s;if(typeof n!="function")throw new Error;return function(){var i=$n(this,e),o=i.tween;if(o!==r){s=(r=o).slice();for(var l={name:t,value:n},c=0,u=s.length;c<u;++c)if(s[c].name===t){s[c]=l;break}c===u&&s.push(l)}i.tween=s}}function EF(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=gn(this.node(),n).tween,s=0,i=r.length,o;s<i;++s)if((o=r[s]).name===e)return o.value;return null}return this.each((t==null?kF:NF)(n,e,t))}function nv(e,t,n){var r=e._id;return e.each(function(){var s=$n(this,r);(s.value||(s.value={}))[t]=n.apply(this,arguments)}),function(s){return gn(s,r).value[t]}}function mN(e,t){var n;return(typeof t=="number"?jn:t instanceof Ts?vu:(n=Ts(t))?(t=n,vu):lN)(e,t)}function CF(e){return function(){this.removeAttribute(e)}}function AF(e){return function(){this.removeAttributeNS(e.space,e.local)}}function TF(e,t,n){var r,s=n+"",i;return function(){var o=this.getAttribute(e);return o===s?null:o===r?i:i=t(r=o,n)}}function PF(e,t,n){var r,s=n+"",i;return function(){var o=this.getAttributeNS(e.space,e.local);return o===s?null:o===r?i:i=t(r=o,n)}}function MF(e,t,n){var r,s,i;return function(){var o,l=n(this),c;return l==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=l+"",o===c?null:o===r&&c===s?i:(s=c,i=t(r=o,l)))}}function IF(e,t,n){var r,s,i;return function(){var o,l=n(this),c;return l==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=l+"",o===c?null:o===r&&c===s?i:(s=c,i=t(r=o,l)))}}function RF(e,t){var n=ud(e),r=n==="transform"?hF:mN;return this.attrTween(e,typeof t=="function"?(n.local?IF:MF)(n,r,nv(this,"attr."+e,t)):t==null?(n.local?AF:CF)(n):(n.local?PF:TF)(n,r,t))}function OF(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function $F(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function LF(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&$F(e,i)),n}return s._value=t,s}function DF(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&OF(e,i)),n}return s._value=t,s}function zF(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=ud(e);return this.tween(n,(r.local?LF:DF)(r,t))}function VF(e,t){return function(){tv(this,e).delay=+t.apply(this,arguments)}}function FF(e,t){return t=+t,function(){tv(this,e).delay=t}}function BF(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?VF:FF)(t,e)):gn(this.node(),t).delay}function HF(e,t){return function(){$n(this,e).duration=+t.apply(this,arguments)}}function UF(e,t){return t=+t,function(){$n(this,e).duration=t}}function WF(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?HF:UF)(t,e)):gn(this.node(),t).duration}function KF(e,t){if(typeof t!="function")throw new Error;return function(){$n(this,e).ease=t}}function GF(e){var t=this._id;return arguments.length?this.each(KF(t,e)):gn(this.node(),t).ease}function qF(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;$n(this,e).ease=n}}function YF(e){if(typeof e!="function")throw new Error;return this.each(qF(this._id,e))}function XF(e){typeof e!="function"&&(e=Kk(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],o=i.length,l=r[s]=[],c,u=0;u<o;++u)(c=i[u])&&e.call(c,c.__data__,u,i)&&l.push(c);return new hr(r,this._parents,this._name,this._id)}function QF(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,s=n.length,i=Math.min(r,s),o=new Array(r),l=0;l<i;++l)for(var c=t[l],u=n[l],d=c.length,f=o[l]=new Array(d),h,p=0;p<d;++p)(h=c[p]||u[p])&&(f[p]=h);for(;l<r;++l)o[l]=t[l];return new hr(o,this._parents,this._name,this._id)}function ZF(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 JF(e,t,n){var r,s,i=ZF(t)?tv:$n;return function(){var o=i(this,e),l=o.on;l!==r&&(s=(r=l).copy()).on(t,n),o.on=s}}function e5(e,t){var n=this._id;return arguments.length<2?gn(this.node(),n).on.on(e):this.each(JF(n,e,t))}function t5(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function n5(){return this.on("end.remove",t5(this._id))}function r5(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Xg(e));for(var r=this._groups,s=r.length,i=new Array(s),o=0;o<s;++o)for(var l=r[o],c=l.length,u=i[o]=new Array(c),d,f,h=0;h<c;++h)(d=l[h])&&(f=e.call(d,d.__data__,h,l))&&("__data__"in d&&(f.__data__=d.__data__),u[h]=f,fd(u[h],t,n,h,u,gn(d,n)));return new hr(i,this._parents,t,n)}function s5(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Wk(e));for(var r=this._groups,s=r.length,i=[],o=[],l=0;l<s;++l)for(var c=r[l],u=c.length,d,f=0;f<u;++f)if(d=c[f]){for(var h=e.call(d,d.__data__,f,c),p,v=gn(d,n),x=0,w=h.length;x<w;++x)(p=h[x])&&fd(p,t,n,x,h,v);i.push(h),o.push(d)}return new hr(i,o,t,n)}var i5=Ja.prototype.constructor;function o5(){return new i5(this._groups,this._parents)}function a5(e,t){var n,r,s;return function(){var i=Bi(this,e),o=(this.style.removeProperty(e),Bi(this,e));return i===o?null:i===n&&o===r?s:s=t(n=i,r=o)}}function gN(e){return function(){this.style.removeProperty(e)}}function l5(e,t,n){var r,s=n+"",i;return function(){var o=Bi(this,e);return o===s?null:o===r?i:i=t(r=o,n)}}function c5(e,t,n){var r,s,i;return function(){var o=Bi(this,e),l=n(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(e),Bi(this,e))),o===c?null:o===r&&c===s?i:(s=c,i=t(r=o,l))}}function u5(e,t){var n,r,s,i="style."+t,o="end."+i,l;return function(){var c=$n(this,e),u=c.on,d=c.value[i]==null?l||(l=gN(t)):void 0;(u!==n||s!==d)&&(r=(n=u).copy()).on(o,s=d),c.on=r}}function d5(e,t,n){var r=(e+="")=="transform"?fF:mN;return t==null?this.styleTween(e,a5(e,r)).on("end.style."+e,gN(e)):typeof t=="function"?this.styleTween(e,c5(e,r,nv(this,"style."+e,t))).each(u5(this._id,e)):this.styleTween(e,l5(e,r,t),n).on("end.style."+e,null)}function f5(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function h5(e,t,n){var r,s;function i(){var o=t.apply(this,arguments);return o!==s&&(r=(s=o)&&f5(e,o,n)),r}return i._value=t,i}function p5(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,h5(e,t,n??""))}function m5(e){return function(){this.textContent=e}}function g5(e){return function(){var t=e(this);this.textContent=t??""}}function v5(e){return this.tween("text",typeof e=="function"?g5(nv(this,"text",e)):m5(e==null?"":e+""))}function y5(e){return function(t){this.textContent=e.call(this,t)}}function _5(e){var t,n;function r(){var s=e.apply(this,arguments);return s!==n&&(t=(n=s)&&y5(s)),t}return r._value=e,r}function x5(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,_5(e))}function w5(){for(var e=this._name,t=this._id,n=vN(),r=this._groups,s=r.length,i=0;i<s;++i)for(var o=r[i],l=o.length,c,u=0;u<l;++u)if(c=o[u]){var d=gn(c,t);fd(c,e,n,u,o,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new hr(r,this._parents,e,n)}function b5(){var e,t,n=this,r=n._id,s=n.size();return new Promise(function(i,o){var l={value:o},c={value:function(){--s===0&&i()}};n.each(function(){var u=$n(this,r),d=u.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(c)),u.on=t}),s===0&&i()})}var j5=0;function hr(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function vN(){return++j5}var Fn=Ja.prototype;hr.prototype={constructor:hr,select:r5,selectAll:s5,selectChild:Fn.selectChild,selectChildren:Fn.selectChildren,filter:XF,merge:QF,selection:o5,transition:w5,call:Fn.call,nodes:Fn.nodes,node:Fn.node,size:Fn.size,empty:Fn.empty,each:Fn.each,on:e5,attr:RF,attrTween:zF,style:d5,styleTween:p5,text:v5,textTween:x5,remove:n5,tween:EF,delay:BF,duration:WF,ease:GF,easeVarying:YF,end:b5,[Symbol.iterator]:Fn[Symbol.iterator]};function S5(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var k5={time:null,delay:0,duration:250,ease:S5};function N5(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 E5(e){var t,n;e instanceof hr?(t=e._id,e=e._name):(t=vN(),(n=k5).time=ev(),e=e==null?null:e+"");for(var r=this._groups,s=r.length,i=0;i<s;++i)for(var o=r[i],l=o.length,c,u=0;u<l;++u)(c=o[u])&&fd(c,e,t,u,o,n||N5(c,t));return new hr(r,this._parents,e,t)}Ja.prototype.interrupt=SF;Ja.prototype.transition=E5;const Dl=e=>()=>e;function C5(e,{sourceEvent:t,target:n,transform:r,dispatch:s}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:s}})}function Xn(e,t,n){this.k=e,this.x=t,this.y=n}Xn.prototype={constructor:Xn,scale:function(e){return e===1?this:new Xn(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Xn(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 hd=new Xn(1,0,0);yN.prototype=Xn.prototype;function yN(e){for(;!e.__zoom;)if(!(e=e.parentNode))return hd;return e.__zoom}function Tf(e){e.stopImmediatePropagation()}function _o(e){e.preventDefault(),e.stopImmediatePropagation()}function A5(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function T5(){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 X_(){return this.__zoom||hd}function P5(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function M5(){return navigator.maxTouchPoints||"ontouchstart"in this}function I5(e,t,n){var r=e.invertX(t[0][0])-n[0][0],s=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),o>i?(i+o)/2:Math.min(0,i)||Math.max(0,o))}function _N(){var e=A5,t=T5,n=I5,r=P5,s=M5,i=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],l=250,c=yc,u=cd("start","zoom","end"),d,f,h,p=500,v=150,x=0,w=10;function g(E){E.property("__zoom",X_).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",P).on("dblclick.zoom",$).filter(s).on("touchstart.zoom",D).on("touchmove.zoom",I).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(E,A,C,M){var T=E.selection?E.selection():E;T.property("__zoom",X_),E!==T?j(E,A,C,M):T.interrupt().each(function(){N(this,arguments).event(M).start().zoom(null,typeof A=="function"?A.apply(this,arguments):A).end()})},g.scaleBy=function(E,A,C,M){g.scaleTo(E,function(){var T=this.__zoom.k,R=typeof A=="function"?A.apply(this,arguments):A;return T*R},C,M)},g.scaleTo=function(E,A,C,M){g.transform(E,function(){var T=t.apply(this,arguments),R=this.__zoom,B=C==null?_(T):typeof C=="function"?C.apply(this,arguments):C,L=R.invert(B),F=typeof A=="function"?A.apply(this,arguments):A;return n(m(y(R,F),B,L),T,o)},C,M)},g.translateBy=function(E,A,C,M){g.transform(E,function(){return n(this.__zoom.translate(typeof A=="function"?A.apply(this,arguments):A,typeof C=="function"?C.apply(this,arguments):C),t.apply(this,arguments),o)},null,M)},g.translateTo=function(E,A,C,M,T){g.transform(E,function(){var R=t.apply(this,arguments),B=this.__zoom,L=M==null?_(R):typeof M=="function"?M.apply(this,arguments):M;return n(hd.translate(L[0],L[1]).scale(B.k).translate(typeof A=="function"?-A.apply(this,arguments):-A,typeof C=="function"?-C.apply(this,arguments):-C),R,o)},M,T)};function y(E,A){return A=Math.max(i[0],Math.min(i[1],A)),A===E.k?E:new Xn(A,E.x,E.y)}function m(E,A,C){var M=A[0]-C[0]*E.k,T=A[1]-C[1]*E.k;return M===E.x&&T===E.y?E:new Xn(E.k,M,T)}function _(E){return[(+E[0][0]+ +E[1][0])/2,(+E[0][1]+ +E[1][1])/2]}function j(E,A,C,M){E.on("start.zoom",function(){N(this,arguments).event(M).start()}).on("interrupt.zoom end.zoom",function(){N(this,arguments).event(M).end()}).tween("zoom",function(){var T=this,R=arguments,B=N(T,R).event(M),L=t.apply(T,R),F=C==null?_(L):typeof C=="function"?C.apply(T,R):C,W=Math.max(L[1][0]-L[0][0],L[1][1]-L[0][1]),U=T.__zoom,K=typeof A=="function"?A.apply(T,R):A,Q=c(U.invert(F).concat(W/U.k),K.invert(F).concat(W/K.k));return function(J){if(J===1)J=K;else{var H=Q(J),q=W/H[2];J=new Xn(q,F[0]-H[0]*q,F[1]-H[1]*q)}B.zoom(null,J)}})}function N(E,A,C){return!C&&E.__zooming||new k(E,A)}function k(E,A){this.that=E,this.args=A,this.active=0,this.sourceEvent=null,this.extent=t.apply(E,A),this.taps=0}k.prototype={event:function(E){return E&&(this.sourceEvent=E),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(E,A){return this.mouse&&E!=="mouse"&&(this.mouse[1]=A.invert(this.mouse[0])),this.touch0&&E!=="touch"&&(this.touch0[1]=A.invert(this.touch0[0])),this.touch1&&E!=="touch"&&(this.touch1[1]=A.invert(this.touch1[0])),this.that.__zoom=A,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(E){var A=bt(this.that).datum();u.call(E,this.that,new C5(E,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:u}),A)}};function S(E,...A){if(!e.apply(this,arguments))return;var C=N(this,A).event(E),M=this.__zoom,T=Math.max(i[0],Math.min(i[1],M.k*Math.pow(2,r.apply(this,arguments)))),R=tn(E);if(C.wheel)(C.mouse[0][0]!==R[0]||C.mouse[0][1]!==R[1])&&(C.mouse[1]=M.invert(C.mouse[0]=R)),clearTimeout(C.wheel);else{if(M.k===T)return;C.mouse=[R,M.invert(R)],wc(this),C.start()}_o(E),C.wheel=setTimeout(B,v),C.zoom("mouse",n(m(y(M,T),C.mouse[0],C.mouse[1]),C.extent,o));function B(){C.wheel=null,C.end()}}function P(E,...A){if(h||!e.apply(this,arguments))return;var C=E.currentTarget,M=N(this,A,!0).event(E),T=bt(E.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",W,!0),R=tn(E,C),B=E.clientX,L=E.clientY;nN(E.view),Tf(E),M.mouse=[R,this.__zoom.invert(R)],wc(this),M.start();function F(U){if(_o(U),!M.moved){var K=U.clientX-B,Q=U.clientY-L;M.moved=K*K+Q*Q>x}M.event(U).zoom("mouse",n(m(M.that.__zoom,M.mouse[0]=tn(U,C),M.mouse[1]),M.extent,o))}function W(U){T.on("mousemove.zoom mouseup.zoom",null),rN(U.view,M.moved),_o(U),M.event(U).end()}}function $(E,...A){if(e.apply(this,arguments)){var C=this.__zoom,M=tn(E.changedTouches?E.changedTouches[0]:E,this),T=C.invert(M),R=C.k*(E.shiftKey?.5:2),B=n(m(y(C,R),M,T),t.apply(this,A),o);_o(E),l>0?bt(this).transition().duration(l).call(j,B,M,E):bt(this).call(g.transform,B,M,E)}}function D(E,...A){if(e.apply(this,arguments)){var C=E.touches,M=C.length,T=N(this,A,E.changedTouches.length===M).event(E),R,B,L,F;for(Tf(E),B=0;B<M;++B)L=C[B],F=tn(L,this),F=[F,this.__zoom.invert(F),L.identifier],T.touch0?!T.touch1&&T.touch0[2]!==F[2]&&(T.touch1=F,T.taps=0):(T.touch0=F,R=!0,T.taps=1+!!d);d&&(d=clearTimeout(d)),R&&(T.taps<2&&(f=F[0],d=setTimeout(function(){d=null},p)),wc(this),T.start())}}function I(E,...A){if(this.__zooming){var C=N(this,A).event(E),M=E.changedTouches,T=M.length,R,B,L,F;for(_o(E),R=0;R<T;++R)B=M[R],L=tn(B,this),C.touch0&&C.touch0[2]===B.identifier?C.touch0[0]=L:C.touch1&&C.touch1[2]===B.identifier&&(C.touch1[0]=L);if(B=C.that.__zoom,C.touch1){var W=C.touch0[0],U=C.touch0[1],K=C.touch1[0],Q=C.touch1[1],J=(J=K[0]-W[0])*J+(J=K[1]-W[1])*J,H=(H=Q[0]-U[0])*H+(H=Q[1]-U[1])*H;B=y(B,Math.sqrt(J/H)),L=[(W[0]+K[0])/2,(W[1]+K[1])/2],F=[(U[0]+Q[0])/2,(U[1]+Q[1])/2]}else if(C.touch0)L=C.touch0[0],F=C.touch0[1];else return;C.zoom("touch",n(m(B,L,F),C.extent,o))}}function O(E,...A){if(this.__zooming){var C=N(this,A).event(E),M=E.changedTouches,T=M.length,R,B;for(Tf(E),h&&clearTimeout(h),h=setTimeout(function(){h=null},p),R=0;R<T;++R)B=M[R],C.touch0&&C.touch0[2]===B.identifier?delete C.touch0:C.touch1&&C.touch1[2]===B.identifier&&delete C.touch1;if(C.touch1&&!C.touch0&&(C.touch0=C.touch1,delete C.touch1),C.touch0)C.touch0[1]=this.__zoom.invert(C.touch0[0]);else if(C.end(),C.taps===2&&(B=tn(B,this),Math.hypot(f[0]-B[0],f[1]-B[1])<w)){var L=bt(this).on("dblclick.zoom");L&&L.apply(this,arguments)}}}return g.wheelDelta=function(E){return arguments.length?(r=typeof E=="function"?E:Dl(+E),g):r},g.filter=function(E){return arguments.length?(e=typeof E=="function"?E:Dl(!!E),g):e},g.touchable=function(E){return arguments.length?(s=typeof E=="function"?E:Dl(!!E),g):s},g.extent=function(E){return arguments.length?(t=typeof E=="function"?E:Dl([[+E[0][0],+E[0][1]],[+E[1][0],+E[1][1]]]),g):t},g.scaleExtent=function(E){return arguments.length?(i[0]=+E[0],i[1]=+E[1],g):[i[0],i[1]]},g.translateExtent=function(E){return arguments.length?(o[0][0]=+E[0][0],o[1][0]=+E[1][0],o[0][1]=+E[0][1],o[1][1]=+E[1][1],g):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},g.constrain=function(E){return arguments.length?(n=E,g):n},g.duration=function(E){return arguments.length?(l=+E,g):l},g.interpolate=function(E){return arguments.length?(c=E,g):c},g.on=function(){var E=u.on.apply(u,arguments);return E===u?g:E},g.clickDistance=function(E){return arguments.length?(x=(E=+E)*E,g):Math.sqrt(x)},g.tapDistance=function(E){return arguments.length?(w=+E,g):w},g}const pn={error001:(e="react")=>`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.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 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.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},Pa=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],xN=["Enter"," ","Escape"],wN={"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 Ui;(function(e){e.Strict="strict",e.Loose="loose"})(Ui||(Ui={}));var _s;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(_s||(_s={}));var Ma;(function(e){e.Partial="partial",e.Full="full"})(Ma||(Ma={}));const bN={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Nr;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Nr||(Nr={}));var wu;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(wu||(wu={}));var re;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(re||(re={}));const Q_={[re.Left]:re.Right,[re.Right]:re.Left,[re.Top]:re.Bottom,[re.Bottom]:re.Top};function jN(e){return e===null?null:e?"valid":"invalid"}const SN=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,R5=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),rv=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),tl=(e,t=[0,0])=>{const{width:n,height:r}=Ln(e),s=e.origin??t,i=n*s[0],o=r*s[1];return{x:e.position.x-i,y:e.position.y-o}},O5=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,s)=>{const i=typeof s=="string";let o=!t.nodeLookup&&!i?s:void 0;t.nodeLookup&&(o=i?t.nodeLookup.get(s):rv(s)?s:t.nodeLookup.get(s.id));const l=o?bu(o,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return pd(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return md(n)},nl=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(s=>{(t.filter===void 0||t.filter(s))&&(n=pd(n,bu(s)),r=!0)}),r?md(n):{x:0,y:0,width:0,height:0}},sv=(e,t,[n,r,s]=[0,0,1],i=!1,o=!1)=>{const l=(t.x-n)/s,c=(t.y-r)/s,u=t.width/s,d=t.height/s,f=[];for(const h of e.values()){const{measured:p,selectable:v=!0,hidden:x=!1}=h;if(o&&!v||x)continue;const w=p.width??h.width??h.initialWidth??0,g=p.height??h.height??h.initialHeight??0,{x:y,y:m}=h.internals.positionAbsolute,_=CN(l,c,u,d,y,m,w,g),j=w*g,N=i&&_>0;(!h.internals.handleBounds||N||_>=j||h.dragging)&&f.push(h)}return f},$5=(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 L5(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(s=>s.id)):null;return e.forEach(s=>{let i;if(t!=null&&t.includeHiddenNodes){const{width:o,height:l}=Ln(s);i=o>0&&l>0}else i=!!(s.measured.width&&s.measured.height&&!s.hidden);i&&(!r||r.has(s.id))&&n.set(s.id,s)}),n}async function D5({nodes:e,width:t,height:n,panZoom:r,minZoom:s,maxZoom:i},o){if(e.size===0)return!0;const l=L5(e,o),c=nl(l),u=ov(c,t,n,(o==null?void 0:o.minZoom)??s,(o==null?void 0:o.maxZoom)??i,(o==null?void 0:o.padding)??.1);return await r.setViewport(u,{duration:o==null?void 0:o.duration,ease:o==null?void 0:o.ease,interpolate:o==null?void 0:o.interpolate}),!0}function kN({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:s,onError:i}){const o=n.get(e),l=o.parentId?n.get(o.parentId):void 0,{x:c,y:u}=l?l.internals.positionAbsolute:{x:0,y:0},d=o.origin??r;let f=o.extent||s;if(o.extent==="parent"&&!o.expandParent)if(!l)i==null||i("005",pn.error005());else{const p=l.measured.width,v=l.measured.height;p&&v&&(f=[[c,u],[c+p,u+v]])}else l&&Is(o.extent)&&(f=[[o.extent[0][0]+c,o.extent[0][1]+u],[o.extent[1][0]+c,o.extent[1][1]+u]]);const h=Is(f)?Ms(t,f,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&(i==null||i("015",pn.error015())),{position:{x:h.x-c+(o.measured.width??0)*d[0],y:h.y-u+(o.measured.height??0)*d[1]},positionAbsolute:h}}async function z5({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:s}){const i=new Set(e.map(h=>h.id)),o=[];for(const h of n){if(h.deletable===!1)continue;const p=i.has(h.id),v=!p&&h.parentId&&o.find(x=>x.id===h.parentId);(p||v)&&o.push(h)}const l=new Set(t.map(h=>h.id)),c=r.filter(h=>h.deletable!==!1),d=$5(o,c);for(const h of c)l.has(h.id)&&!d.find(v=>v.id===h.id)&&d.push(h);if(!s)return{edges:d,nodes:o};const f=await s({nodes:o,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:o}:{edges:[],nodes:[]}:f}const Wi=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Ms=(e={x:0,y:0},t,n)=>({x:Wi(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Wi(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function NN(e,t,n){const{width:r,height:s}=Ln(n),{x:i,y:o}=n.internals.positionAbsolute;return Ms(e,[[i,o],[i+r,o+s]],t)}const Z_=(e,t,n)=>e<t?Wi(Math.abs(e-t),1,t)/t:e>n?-Wi(Math.abs(e-n),1,t)/t:0,iv=(e,t,n=15,r=40)=>{const s=Z_(e.x,r,t.width-r)*n,i=Z_(e.y,r,t.height-r)*n;return[s,i]},pd=(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)}),zp=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),md=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Ia=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=rv(e)?e.internals.positionAbsolute:tl(e,t);return{x:n,y:r,width:((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},bu=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=rv(e)?e.internals.positionAbsolute:tl(e,t);return{x:n,y:r,x2:n+(((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0),y2:r+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},EN=(e,t)=>md(pd(zp(e),zp(t))),CN=(e,t,n,r,s,i,o,l)=>{const c=Math.max(0,Math.min(e+n,s+o)-Math.max(e,s)),u=Math.max(0,Math.min(t+r,i+l)-Math.max(t,i));return Math.ceil(c*u)},ju=(e,t)=>CN(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),J_=e=>on(e.width)&&on(e.height)&&on(e.x)&&on(e.y),on=e=>!isNaN(e)&&isFinite(e),AN=(e,t)=>(n,r)=>{},rl=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),sl=({x:e,y:t},[n,r,s],i=!1,o=[1,1])=>{const l={x:(e-n)/s,y:(t-r)/s};return i?rl(l,o):l},Ki=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r});function Ks(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(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function V5(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Ks(e,n),s=Ks(e,t);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof e=="object"){const r=Ks(e.top??e.y??0,n),s=Ks(e.bottom??e.y??0,n),i=Ks(e.left??e.x??0,t),o=Ks(e.right??e.x??0,t);return{top:r,right:o,bottom:s,left:i,x:i+o,y:r+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function F5(e,t,n,r,s,i){const{x:o,y:l}=Ki(e,[t,n,r]),{x:c,y:u}=Ki({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=s-c,f=i-u;return{left:Math.floor(o),top:Math.floor(l),right:Math.floor(d),bottom:Math.floor(f)}}const ov=(e,t,n,r,s,i)=>{const o=V5(i,t,n),l=(t-o.x)/e.width,c=(n-o.y)/e.height,u=Math.min(l,c),d=Wi(u,r,s),f=e.x+e.width/2,h=e.y+e.height/2,p=t/2-f*d,v=n/2-h*d,x=F5(e,p,v,d,t,n),w={left:Math.min(x.left-o.left,0),top:Math.min(x.top-o.top,0),right:Math.min(x.right-o.right,0),bottom:Math.min(x.bottom-o.bottom,0)};return{x:p-w.left+w.right,y:v-w.top+w.bottom,zoom:d}},Ra=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Is(e){return e!=null&&e!=="parent"}function Ln(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 TN(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 PN(e,t={width:0,height:0},n,r,s){const i={...e},o=r.get(n);if(o){const l=o.origin||s;i.x+=o.internals.positionAbsolute.x-(t.width??0)*l[0],i.y+=o.internals.positionAbsolute.y-(t.height??0)*l[1]}return i}function ex(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function B5(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}function H5(e){return{...wN,...e||{}}}function Yo(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:i,y:o}=an(e),l=sl({x:i-((s==null?void 0:s.left)??0),y:o-((s==null?void 0:s.top)??0)},r),{x:c,y:u}=n?rl(l,t):l;return{xSnapped:c,ySnapped:u,...l}}const av=e=>({width:e.offsetWidth,height:e.offsetHeight}),MN=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},U5=["INPUT","SELECT","TEXTAREA"];function IN(e){var r,s;const t=((s=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:s[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:U5.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const RN=e=>"clientX"in e,an=(e,t)=>{var i,o;const n=RN(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,s=n?e.clientY:(o=e.touches)==null?void 0:o[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:s-((t==null?void 0:t.top)??0)}},tx=(e,t,n,r,s)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(o=>{const l=o.getBoundingClientRect();return{id:o.getAttribute("data-handleid"),type:e,nodeId:s,position:o.getAttribute("data-handlepos"),x:(l.left-n.left)/r,y:(l.top-n.top)/r,...av(o)}})};function ON({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:s,sourceControlY:i,targetControlX:o,targetControlY:l}){const c=e*.125+s*.375+o*.375+n*.125,u=t*.125+i*.375+l*.375+r*.125,d=Math.abs(c-e),f=Math.abs(u-t);return[c,u,d,f]}function zl(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function nx({pos:e,x1:t,y1:n,x2:r,y2:s,c:i}){switch(e){case re.Left:return[t-zl(t-r,i),n];case re.Right:return[t+zl(r-t,i),n];case re.Top:return[t,n-zl(n-s,i)];case re.Bottom:return[t,n+zl(s-n,i)]}}function $N({sourceX:e,sourceY:t,sourcePosition:n=re.Bottom,targetX:r,targetY:s,targetPosition:i=re.Top,curvature:o=.25}){const[l,c]=nx({pos:n,x1:e,y1:t,x2:r,y2:s,c:o}),[u,d]=nx({pos:i,x1:r,y1:s,x2:e,y2:t,c:o}),[f,h,p,v]=ON({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:d});return[`M${e},${t} C${l},${c} ${u},${d} ${r},${s}`,f,h,p,v]}function LN({sourceX:e,sourceY:t,targetX:n,targetY:r}){const s=Math.abs(n-e)/2,i=n<e?n+s:n-s,o=Math.abs(r-t)/2,l=r<t?r+o:r-o;return[i,l,s,o]}function W5({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:s=!1,zIndexMode:i="basic"}){if(i==="manual")return r;const o=s&&n?r+1e3:r,l=Math.max(e.parentId||s&&e.selected?e.internals.z:0,t.parentId||s&&t.selected?t.internals.z:0);return o+l}function K5({sourceNode:e,targetNode:t,width:n,height:r,transform:s}){const i=pd(bu(e),bu(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const o={x:-s[0]/s[2],y:-s[1]/s[2],width:n/s[2],height:r/s[2]};return ju(o,md(i))>0}const G5=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,q5=(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)),Y5=(e,t,n={})=>{var i;if(!e.source||!e.target)return(i=n.onError)==null||i.call(n,"006",pn.error006()),t;const r=n.getEdgeId||G5;let s;return SN(e)?s={...e}:s={...e,id:r(e)},q5(s,t)?t:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,t.concat(s))};function DN({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,i,o,l]=LN({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,i,o,l]}const rx={[re.Left]:{x:-1,y:0},[re.Right]:{x:1,y:0},[re.Top]:{x:0,y:-1},[re.Bottom]:{x:0,y:1}},X5=({source:e,sourcePosition:t=re.Bottom,target:n})=>t===re.Left||t===re.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},sx=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Q5({source:e,sourcePosition:t=re.Bottom,target:n,targetPosition:r=re.Top,center:s,offset:i,stepPosition:o}){const l=rx[t],c=rx[r],u={x:e.x+l.x*i,y:e.y+l.y*i},d={x:n.x+c.x*i,y:n.y+c.y*i},f=X5({source:u,sourcePosition:t,target:d}),h=f.x!==0?"x":"y",p=f[h];let v=[],x,w;const g={x:0,y:0},y={x:0,y:0},[,,m,_]=LN({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[h]*c[h]===-1){h==="x"?(x=s.x??u.x+(d.x-u.x)*o,w=s.y??(u.y+d.y)/2):(x=s.x??(u.x+d.x)/2,w=s.y??u.y+(d.y-u.y)*o);const S=[{x,y:u.y},{x,y:d.y}],P=[{x:u.x,y:w},{x:d.x,y:w}];l[h]===p?v=h==="x"?S:P:v=h==="x"?P:S}else{const S=[{x:u.x,y:d.y}],P=[{x:d.x,y:u.y}];if(h==="x"?v=l.x===p?P:S:v=l.y===p?S:P,t===r){const E=Math.abs(e[h]-n[h]);if(E<=i){const A=Math.min(i-1,i-E);l[h]===p?g[h]=(u[h]>e[h]?-1:1)*A:y[h]=(d[h]>n[h]?-1:1)*A}}if(t!==r){const E=h==="x"?"y":"x",A=l[h]===c[E],C=u[E]>d[E],M=u[E]<d[E];(l[h]===1&&(!A&&C||A&&M)||l[h]!==1&&(!A&&M||A&&C))&&(v=h==="x"?S:P)}const $={x:u.x+g.x,y:u.y+g.y},D={x:d.x+y.x,y:d.y+y.y},I=Math.max(Math.abs($.x-v[0].x),Math.abs(D.x-v[0].x)),O=Math.max(Math.abs($.y-v[0].y),Math.abs(D.y-v[0].y));I>=O?(x=($.x+D.x)/2,w=v[0].y):(x=v[0].x,w=($.y+D.y)/2)}const j={x:u.x+g.x,y:u.y+g.y},N={x:d.x+y.x,y:d.y+y.y};return[[e,...j.x!==v[0].x||j.y!==v[0].y?[j]:[],...v,...N.x!==v[v.length-1].x||N.y!==v[v.length-1].y?[N]:[],n],x,w,m,_]}function Z5(e,t,n,r){const s=Math.min(sx(e,t)/2,sx(t,n)/2,r),{x:i,y:o}=t;if(e.x===i&&i===n.x||e.y===o&&o===n.y)return`L${i} ${o}`;if(e.y===o){const u=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${i+s*u},${o}Q ${i},${o} ${i},${o+s*d}`}const l=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${o+s*c}Q ${i},${o} ${i+s*l},${o}`}function Vp({sourceX:e,sourceY:t,sourcePosition:n=re.Bottom,targetX:r,targetY:s,targetPosition:i=re.Top,borderRadius:o=5,centerX:l,centerY:c,offset:u=20,stepPosition:d=.5}){const[f,h,p,v,x]=Q5({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:s},targetPosition:i,center:{x:l,y:c},offset:u,stepPosition:d});let w=`M${f[0].x} ${f[0].y}`;for(let g=1;g<f.length-1;g++)w+=Z5(f[g-1],f[g],f[g+1],o);return w+=`L${f[f.length-1].x} ${f[f.length-1].y}`,[w,h,p,v,x]}function ix(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function J5(e){var f;const{sourceNode:t,targetNode:n}=e;if(!ix(t)||!ix(n))return null;const r=t.internals.handleBounds||ox(t.handles),s=n.internals.handleBounds||ox(n.handles),i=ax((r==null?void 0:r.source)??[],e.sourceHandle),o=ax(e.connectionMode===Ui.Strict?(s==null?void 0:s.target)??[]:((s==null?void 0:s.target)??[]).concat((s==null?void 0:s.source)??[]),e.targetHandle);if(!i||!o)return(f=e.onError)==null||f.call(e,"008",pn.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=(i==null?void 0:i.position)||re.Bottom,c=(o==null?void 0:o.position)||re.Top,u=Rs(t,i,l),d=Rs(n,o,c);return{sourceX:u.x,sourceY:u.y,targetX:d.x,targetY:d.y,sourcePosition:l,targetPosition:c}}function ox(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 Rs(e,t,n=re.Left,r=!1){const s=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,i=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:o,height:l}=t??Ln(e);if(r)return{x:s+o/2,y:i+l/2};switch((t==null?void 0:t.position)??n){case re.Top:return{x:s+o/2,y:i};case re.Right:return{x:s+o,y:i+l/2};case re.Bottom:return{x:s+o/2,y:i+l};case re.Left:return{x:s,y:i+l/2}}}function ax(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Fp(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function eB(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:s}){const i=new Set;return e.reduce((o,l)=>([l.markerStart||r,l.markerEnd||s].forEach(c=>{if(c&&typeof c=="object"){const u=Fp(c,t);i.has(u)||(o.push({id:u,color:c.color||n,...c}),i.add(u))}}),o),[]).sort((o,l)=>o.id.localeCompare(l.id))}const zN=1e3,tB=10,lv={nodeOrigin:[0,0],nodeExtent:Pa,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},nB={...lv,checkEquality:!0};function cv(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function rB(e,t,n){const r=cv(lv,n);for(const s of e.values())if(s.parentId)dv(s,e,t,r);else{const i=tl(s,r.nodeOrigin),o=Is(s.extent)?s.extent:r.nodeExtent,l=Ms(i,o,Ln(s));s.internals.positionAbsolute=l}}function sB(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const s of e.handles){const i={id:s.id,width:s.width??1,height:s.height??1,nodeId:e.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?n.push(i):s.type==="target"&&r.push(i)}return{source:n,target:r}}function uv(e){return e==="manual"}function Bp(e,t,n,r={}){var d,f;const s=cv(nB,r),i={i:0},o=new Map(t),l=s!=null&&s.elevateNodesOnSelect&&!uv(s.zIndexMode)?zN:0;let c=e.length>0,u=!1;t.clear(),n.clear();for(const h of e){let p=o.get(h.id);if(s.checkEquality&&h===(p==null?void 0:p.internals.userNode))t.set(h.id,p);else{const v=tl(h,s.nodeOrigin),x=Is(h.extent)?h.extent:s.nodeExtent,w=Ms(v,x,Ln(h));p={...s.defaults,...h,measured:{width:(d=h.measured)==null?void 0:d.width,height:(f=h.measured)==null?void 0:f.height},internals:{positionAbsolute:w,handleBounds:sB(h,p),z:VN(h,l,s.zIndexMode),userNode:h}},t.set(h.id,p)}(p.measured===void 0||p.measured.width===void 0||p.measured.height===void 0)&&!p.hidden&&(c=!1),h.parentId&&dv(p,t,n,r,i),u||(u=h.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function iB(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 dv(e,t,n,r,s){const{elevateNodesOnSelect:i,nodeOrigin:o,nodeExtent:l,zIndexMode:c}=cv(lv,r),u=e.parentId,d=t.get(u);if(!d){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}iB(e,n),s&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++s.i,d.internals.z=d.internals.z+s.i*tB),s&&d.internals.rootParentIndex!==void 0&&(s.i=d.internals.rootParentIndex);const f=i&&!uv(c)?zN:0,{x:h,y:p,z:v}=oB(e,d,o,l,f,c),{positionAbsolute:x}=e.internals,w=h!==x.x||p!==x.y;(w||v!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:w?{x:h,y:p}:x,z:v}})}function VN(e,t,n){const r=on(e.zIndex)?e.zIndex:0;return uv(n)?r:r+(e.selected?t:0)}function oB(e,t,n,r,s,i){const{x:o,y:l}=t.internals.positionAbsolute,c=Ln(e),u=tl(e,n),d=Is(e.extent)?Ms(u,e.extent,c):u;let f=Ms({x:o+d.x,y:l+d.y},r,c);e.extent==="parent"&&(f=NN(f,c,t));const h=VN(e,s,i),p=t.internals.z??0;return{x:f.x,y:f.y,z:p>=h?p+1:h}}function fv(e,t,n,r=[0,0]){var o;const s=[],i=new Map;for(const l of e){const c=t.get(l.parentId);if(!c)continue;const u=((o=i.get(l.parentId))==null?void 0:o.expandedRect)??Ia(c),d=EN(u,l.rect);i.set(l.parentId,{expandedRect:d,parent:c})}return i.size>0&&i.forEach(({expandedRect:l,parent:c},u)=>{var m;const d=c.internals.positionAbsolute,f=Ln(c),h=c.origin??r,p=l.x<d.x?Math.round(Math.abs(d.x-l.x)):0,v=l.y<d.y?Math.round(Math.abs(d.y-l.y)):0,x=Math.max(f.width,Math.round(l.width)),w=Math.max(f.height,Math.round(l.height)),g=(x-f.width)*h[0],y=(w-f.height)*h[1];(p>0||v>0||g||y)&&(s.push({id:u,type:"position",position:{x:c.position.x-p+g,y:c.position.y-v+y}}),(m=n.get(u))==null||m.forEach(_=>{e.some(j=>j.id===_.id)||s.push({id:_.id,type:"position",position:{x:_.position.x+p,y:_.position.y+v}})})),(f.width<l.width||f.height<l.height||p||v)&&s.push({id:u,type:"dimensions",setAttributes:!0,dimensions:{width:x+(p?h[0]*p-g:0),height:w+(v?h[1]*v-y:0)}})}),s}function aB(e,t,n,r,s,i,o){const l=r==null?void 0:r.querySelector(".xyflow__viewport");let c=!1;if(!l)return{changes:[],updatedInternals:c};const u=[],d=window.getComputedStyle(l),{m22:f}=new window.DOMMatrixReadOnly(d.transform),h=[];for(const p of e.values()){const v=t.get(p.id);if(!v)continue;if(v.hidden){t.set(v.id,{...v,internals:{...v.internals,handleBounds:void 0}}),c=!0;continue}const x=av(p.nodeElement),w=v.measured.width!==x.width||v.measured.height!==x.height;if(!!(x.width&&x.height&&(w||!v.internals.handleBounds||p.force))){const y=p.nodeElement.getBoundingClientRect(),m=Is(v.extent)?v.extent:i;let{positionAbsolute:_}=v.internals;if(v.parentId&&v.extent==="parent"){const N=t.get(v.parentId);N&&(_=NN(_,x,N))}else m&&(_=Ms(_,m,x));const j={...v,measured:x,internals:{...v.internals,positionAbsolute:_,handleBounds:{source:tx("source",p.nodeElement,y,f,v.id),target:tx("target",p.nodeElement,y,f,v.id)}}};t.set(v.id,j),v.parentId&&dv(j,t,n,{nodeOrigin:s,zIndexMode:o}),c=!0,w&&(u.push({id:v.id,type:"dimensions",dimensions:x}),v.expandParent&&v.parentId&&h.push({id:v.id,parentId:v.parentId,rect:Ia(j,s)}))}}if(h.length>0){const p=fv(h,t,n,s);u.push(...p)}return{changes:u,updatedInternals:c}}async function lB({delta:e,panZoom:t,transform:n,translateExtent:r,width:s,height:i}){if(!t||!e.x&&!e.y)return!1;const o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[s,i]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function lx(e,t,n,r,s,i){let o=s;const l=r.get(o)||new Map;r.set(o,l.set(n,t)),o=`${s}-${e}`;const c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),i){o=`${s}-${e}-${i}`;const u=r.get(o)||new Map;r.set(o,u.set(n,t))}}function FN(e,t,n){e.clear(),t.clear();for(const r of n){const{source:s,target:i,sourceHandle:o=null,targetHandle:l=null}=r,c={edgeId:r.id,source:s,target:i,sourceHandle:o,targetHandle:l},u=`${s}-${o}--${i}-${l}`,d=`${i}-${l}--${s}-${o}`;lx("source",c,d,e,s,o),lx("target",c,u,e,i,l),t.set(r.id,r)}}function BN(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:BN(n,t):!1}function cx(e,t,n){var s;let r=e;do{if((s=r==null?void 0:r.matches)!=null&&s.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function cB(e,t,n,r){const s=new Map;for(const[i,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!BN(o,e))&&(o.draggable||t&&typeof o.draggable>"u")){const l=e.get(i);l&&s.set(i,{id:i,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return s}function Pf({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var o,l,c;const s=[];for(const[u,d]of t){const f=(o=n.get(u))==null?void 0:o.internals.userNode;f&&s.push({...f,position:d.position,dragging:r})}if(!e)return[s[0],s];const i=(l=n.get(e))==null?void 0:l.internals.userNode;return[i?{...i,position:((c=t.get(e))==null?void 0:c.position)||i.position,dragging:r}:s[0],s]}function uB({dragItems:e,snapGrid:t,x:n,y:r}){const s=e.values().next().value;if(!s)return null;const i={x:n-s.distance.x,y:r-s.distance.y},o=rl(i,t);return{x:o.x-i.x,y:o.y-i.y}}function dB({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:s}){let i={x:null,y:null},o=0,l=new Map,c=!1,u={x:0,y:0},d=null,f=!1,h=null,p=!1,v=!1,x=null;function w({noDragClassName:y,handleSelector:m,domNode:_,isSelectable:j,nodeId:N,nodeClickDistance:k=0}){h=bt(_);function S({x:I,y:O}){const{nodeLookup:E,nodeExtent:A,snapGrid:C,snapToGrid:M,nodeOrigin:T,onNodeDrag:R,onSelectionDrag:B,onError:L,updateNodePositions:F}=t();i={x:I,y:O};let W=!1;const U=l.size>1,K=U&&A?zp(nl(l)):null,Q=U&&M?uB({dragItems:l,snapGrid:C,x:I,y:O}):null;for(const[J,H]of l){if(!E.has(J))continue;let q={x:I-H.distance.x,y:O-H.distance.y};M&&(q=Q?{x:Math.round(q.x+Q.x),y:Math.round(q.y+Q.y)}:rl(q,C));let ne=null;if(U&&A&&!H.extent&&K){const{positionAbsolute:X}=H.internals,ae=X.x-K.x+A[0][0],pe=X.x+H.measured.width-K.x2+A[1][0],ge=X.y-K.y+A[0][1],Re=X.y+H.measured.height-K.y2+A[1][1];ne=[[ae,ge],[pe,Re]]}const{position:te,positionAbsolute:ee}=kN({nodeId:J,nextPosition:q,nodeLookup:E,nodeExtent:ne||A,nodeOrigin:T,onError:L});W=W||H.position.x!==te.x||H.position.y!==te.y,H.position=te,H.internals.positionAbsolute=ee}if(v=v||W,!!W&&(F(l,!0),x&&(r||R||!N&&B))){const[J,H]=Pf({nodeId:N,dragItems:l,nodeLookup:E});r==null||r(x,l,J,H),R==null||R(x,J,H),N||B==null||B(x,H)}}async function P(){if(!d)return;const{transform:I,panBy:O,autoPanSpeed:E,autoPanOnNodeDrag:A}=t();if(!A){c=!1,cancelAnimationFrame(o);return}const[C,M]=iv(u,d,E);(C!==0||M!==0)&&(i.x=(i.x??0)-C/I[2],i.y=(i.y??0)-M/I[2],await O({x:C,y:M})&&S(i)),o=requestAnimationFrame(P)}function $(I){var U;const{nodeLookup:O,multiSelectionActive:E,nodesDraggable:A,transform:C,snapGrid:M,snapToGrid:T,selectNodesOnDrag:R,onNodeDragStart:B,onSelectionDragStart:L,unselectNodesAndEdges:F}=t();f=!0,(!R||!j)&&!E&&N&&((U=O.get(N))!=null&&U.selected||F()),j&&R&&N&&(e==null||e(N));const W=Yo(I.sourceEvent,{transform:C,snapGrid:M,snapToGrid:T,containerBounds:d});if(i=W,l=cB(O,A,W,N),l.size>0&&(n||B||!N&&L)){const[K,Q]=Pf({nodeId:N,dragItems:l,nodeLookup:O});n==null||n(I.sourceEvent,l,K,Q),B==null||B(I.sourceEvent,K,Q),N||L==null||L(I.sourceEvent,Q)}}const D=sN().clickDistance(k).on("start",I=>{const{domNode:O,nodeDragThreshold:E,transform:A,snapGrid:C,snapToGrid:M}=t();d=(O==null?void 0:O.getBoundingClientRect())||null,p=!1,v=!1,x=I.sourceEvent,E===0&&$(I),i=Yo(I.sourceEvent,{transform:A,snapGrid:C,snapToGrid:M,containerBounds:d}),u=an(I.sourceEvent,d)}).on("drag",I=>{const{autoPanOnNodeDrag:O,transform:E,snapGrid:A,snapToGrid:C,nodeDragThreshold:M,nodeLookup:T}=t(),R=Yo(I.sourceEvent,{transform:E,snapGrid:A,snapToGrid:C,containerBounds:d});if(x=I.sourceEvent,(I.sourceEvent.type==="touchmove"&&I.sourceEvent.touches.length>1||N&&!T.has(N))&&(p=!0),!p){if(!c&&O&&f&&(c=!0,P()),!f){const B=an(I.sourceEvent,d),L=B.x-u.x,F=B.y-u.y;Math.sqrt(L*L+F*F)>M&&$(I)}(i.x!==R.xSnapped||i.y!==R.ySnapped)&&l&&f&&(u=an(I.sourceEvent,d),S(R))}}).on("end",I=>{if(!f||p){p&&l.size>0&&t().updateNodePositions(l,!1);return}if(c=!1,f=!1,cancelAnimationFrame(o),l.size>0){const{nodeLookup:O,updateNodePositions:E,onNodeDragStop:A,onSelectionDragStop:C}=t();if(v&&(E(l,!1),v=!1),s||A||!N&&C){const[M,T]=Pf({nodeId:N,dragItems:l,nodeLookup:O,dragging:!1});s==null||s(I.sourceEvent,l,M,T),A==null||A(I.sourceEvent,M,T),N||C==null||C(I.sourceEvent,T)}}}).filter(I=>{const O=I.target;return!I.button&&(!y||!cx(O,`.${y}`,_))&&(!m||cx(O,m,_))});h.call(D)}function g(){h==null||h.on(".drag",null)}return{update:w,destroy:g}}function fB(e,t,n){const r=[],s={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())ju(s,Ia(i))>0&&r.push(i);return r}const hB=250;function pB(e,t,n,r){var l,c;let s=[],i=1/0;const o=fB(e,n,t+hB);for(const u of o){const d=[...((l=u.internals.handleBounds)==null?void 0:l.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const f of d){if(r.nodeId===f.nodeId&&r.type===f.type&&r.id===f.id)continue;const{x:h,y:p}=Rs(u,f,f.position,!0),v=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(p-e.y,2));v>t||(v<i?(s=[{...f,x:h,y:p}],i=v):v===i&&s.push({...f,x:h,y:p}))}}if(!s.length)return null;if(s.length>1){const u=r.type==="source"?"target":"source";return s.find(d=>d.type===u)??s[0]}return s[0]}function HN(e,t,n,r,s,i=!1){var u,d,f;const o=r.get(e);if(!o)return null;const l=s==="strict"?(u=o.internals.handleBounds)==null?void 0:u[t]:[...((d=o.internals.handleBounds)==null?void 0:d.source)??[],...((f=o.internals.handleBounds)==null?void 0:f.target)??[]],c=(n?l==null?void 0:l.find(h=>h.id===n):l==null?void 0:l[0])??null;return c&&i?{...c,...Rs(o,c,c.position,!0)}:c}function UN(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function mB(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const WN=()=>!0;function gB(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:s,edgeUpdaterType:i,isTarget:o,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:f,panBy:h,cancelConnection:p,onConnectStart:v,onConnect:x,onConnectEnd:w,isValidConnection:g=WN,onReconnectEnd:y,updateConnection:m,getTransform:_,getFromHandle:j,autoPanSpeed:N,dragThreshold:k=1,handleDomNode:S}){const P=MN(e.target);let $=0,D;const{x:I,y:O}=an(e),E=UN(i,S),A=l==null?void 0:l.getBoundingClientRect();let C=!1;if(!A||!E)return;const M=HN(s,E,r,c,t);if(!M)return;let T=an(e,A),R=!1,B=null,L=!1,F=null;function W(){if(!d||!A)return;const[te,ee]=iv(T,A,N);h({x:te,y:ee}),$=requestAnimationFrame(W)}const U={...M,nodeId:s,type:E,position:M.position},K=c.get(s);let J={inProgress:!0,isValid:null,from:Rs(K,U,re.Left,!0),fromHandle:U,fromPosition:U.position,fromNode:K,to:T,toHandle:null,toPosition:Q_[U.position],toNode:null,pointer:T};function H(){C=!0,m(J),v==null||v(e,{nodeId:s,handleId:r,handleType:E})}k===0&&H();function q(te){if(!C){const{x:Re,y:Rt}=an(te),vn=Re-I,yn=Rt-O;if(!(vn*vn+yn*yn>k*k))return;H()}if(!j()||!U){ne(te);return}const ee=_();T=an(te,A),D=pB(sl(T,ee,!1,[1,1]),n,c,U),R||(W(),R=!0);const X=KN(te,{handle:D,connectionMode:t,fromNodeId:s,fromHandleId:r,fromType:o?"target":"source",isValidConnection:g,doc:P,lib:u,flowId:f,nodeLookup:c});F=X.handleDomNode,B=X.connection,L=mB(!!D,X.isValid);const ae=c.get(s),pe=ae?Rs(ae,U,re.Left,!0):J.from,ge={...J,from:pe,isValid:L,to:X.toHandle&&L?Ki({x:X.toHandle.x,y:X.toHandle.y},ee):T,toHandle:X.toHandle,toPosition:L&&X.toHandle?X.toHandle.position:Q_[U.position],toNode:X.toHandle?c.get(X.toHandle.nodeId):null,pointer:T};m(ge),J=ge}function ne(te){if(!("touches"in te&&te.touches.length>0)){if(C){(D||F)&&B&&L&&(x==null||x(B));const{inProgress:ee,...X}=J,ae={...X,toPosition:J.toHandle?J.toPosition:null};w==null||w(te,ae),i&&(y==null||y(te,ae))}p(),cancelAnimationFrame($),R=!1,L=!1,B=null,F=null,P.removeEventListener("mousemove",q),P.removeEventListener("mouseup",ne),P.removeEventListener("touchmove",q),P.removeEventListener("touchend",ne)}}P.addEventListener("mousemove",q),P.addEventListener("mouseup",ne),P.addEventListener("touchmove",q),P.addEventListener("touchend",ne)}function KN(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:i,doc:o,lib:l,flowId:c,isValidConnection:u=WN,nodeLookup:d}){const f=i==="target",h=t?o.querySelector(`.${l}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:p,y:v}=an(e),x=o.elementFromPoint(p,v),w=x!=null&&x.classList.contains(`${l}-flow__handle`)?x:h,g={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const y=UN(void 0,w),m=w.getAttribute("data-nodeid"),_=w.getAttribute("data-handleid"),j=w.classList.contains("connectable"),N=w.classList.contains("connectableend");if(!m||!y)return g;const k={source:f?m:r,sourceHandle:f?_:s,target:f?r:m,targetHandle:f?s:_};g.connection=k;const P=j&&N&&(n===Ui.Strict?f&&y==="source"||!f&&y==="target":m!==r||_!==s);g.isValid=P&&u(k),g.toHandle=HN(m,y,_,d,n,!0)}return g}const Hp={onPointerDown:gB,isValid:KN};function vB({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const s=bt(e);function i({translateExtent:l,width:c,height:u,zoomStep:d=1,pannable:f=!0,zoomable:h=!0,inversePan:p=!1}){const v=m=>{if(m.sourceEvent.type!=="wheel"||!t)return;const _=n(),j=m.sourceEvent.ctrlKey&&Ra()?10:1,N=-m.sourceEvent.deltaY*(m.sourceEvent.deltaMode===1?.05:m.sourceEvent.deltaMode?1:.002)*d,k=_[2]*Math.pow(2,N*j);t.scaleTo(k)};let x=[0,0];const w=m=>{(m.sourceEvent.type==="mousedown"||m.sourceEvent.type==="touchstart")&&(x=[m.sourceEvent.clientX??m.sourceEvent.touches[0].clientX,m.sourceEvent.clientY??m.sourceEvent.touches[0].clientY])},g=m=>{const _=n();if(m.sourceEvent.type!=="mousemove"&&m.sourceEvent.type!=="touchmove"||!t)return;const j=[m.sourceEvent.clientX??m.sourceEvent.touches[0].clientX,m.sourceEvent.clientY??m.sourceEvent.touches[0].clientY],N=[j[0]-x[0],j[1]-x[1]];x=j;const k=r()*Math.max(_[2],Math.log(_[2]))*(p?-1:1),S={x:_[0]-N[0]*k,y:_[1]-N[1]*k},P=[[0,0],[c,u]];t.setViewportConstrained({x:S.x,y:S.y,zoom:_[2]},P,l)},y=_N().on("start",w).on("zoom",f?g:null).on("zoom.wheel",h?v:null);s.call(y,{})}function o(){s.on("zoom",null)}return{update:i,destroy:o,pointer:tn}}const gd=e=>({x:e.x,y:e.y,zoom:e.k}),Mf=({x:e,y:t,zoom:n})=>hd.translate(e,t).scale(n),gi=(e,t)=>e.target.closest(`.${t}`),GN=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),yB=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,If=(e,t=0,n=yB,r=()=>{})=>{const s=typeof t=="number"&&t>0;return s||r(),s?e.transition().duration(t).ease(n).on("end",r):e},qN=e=>{const t=e.ctrlKey&&Ra()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function _B({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:i,zoomOnPinch:o,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(gi(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(d.ctrlKey&&o){const w=tn(d),g=qN(d),y=f*Math.pow(2,g);r.scaleTo(n,y,w,d);return}const h=d.deltaMode===1?20:1;let p=s===_s.Vertical?0:d.deltaX*h,v=s===_s.Horizontal?0:d.deltaY*h;!Ra()&&d.shiftKey&&s!==_s.Vertical&&(p=d.deltaY*h,v=0),r.translateBy(n,-(p/f)*i,-(v/f)*i,{internal:!0});const x=gd(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c==null||c(d,x):(e.isPanScrolling=!0,l==null||l(d,x)),e.panScrollTimeout=setTimeout(()=>{u==null||u(d,x),e.isPanScrolling=!1},150)}}function xB({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,s){const i=r.type==="wheel",o=!t&&i&&!r.ctrlKey,l=gi(r,e);if(r.ctrlKey&&i&&l&&r.preventDefault(),o||l)return null;r.preventDefault(),n.call(this,r,s)}}function wB({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,o,l;if((i=r.sourceEvent)!=null&&i.internal)return;const s=gd(r.transform);e.mouseButton=((o=r.sourceEvent)==null?void 0:o.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=s,((l=r.sourceEvent)==null?void 0:l.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,s))}}function bB({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return i=>{var o,l;e.usedRightMouseButton=!!(n&&GN(t,e.mouseButton??0)),(o=i.sourceEvent)!=null&&o.sync||r([i.transform.x,i.transform.y,i.transform.k]),s&&!((l=i.sourceEvent)!=null&&l.internal)&&(s==null||s(i.sourceEvent,gd(i.transform)))}}function jB({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:s,onPaneContextMenu:i}){return o=>{var l;if(!((l=o.sourceEvent)!=null&&l.internal)&&(e.isZoomingOrPanning=!1,i&&GN(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&i(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),s)){const c=gd(o.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(o.sourceEvent,c)},n?150:0)}}}function SB({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:i,userSelectionActive:o,noWheelClassName:l,noPanClassName:c,lib:u,connectionInProgress:d}){return f=>{var w;const h=e||t,p=n&&f.ctrlKey,v=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(gi(f,`${u}-flow__node`)||gi(f,`${u}-flow__edge`)))return!0;if(!r&&!h&&!s&&!i&&!n||o||d&&!v||gi(f,l)&&v||gi(f,c)&&(!v||s&&v&&!e)||!n&&f.ctrlKey&&v)return!1;if(!n&&f.type==="touchstart"&&((w=f.touches)==null?void 0:w.length)>1)return f.preventDefault(),!1;if(!h&&!s&&!p&&v||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const x=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||v)&&x}}function kB({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:s,onPanZoom:i,onPanZoomStart:o,onPanZoomEnd:l,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect();let f=[[0,0],[d.width,d.height]];const h=typeof ResizeObserver<"u"?new ResizeObserver(O=>{const E=O[0];E&&(f=[[0,0],[E.contentRect.width,E.contentRect.height]])}):null;h==null||h.observe(e);const p=_N().extent(()=>f).scaleExtent([t,n]).translateExtent(r),v=bt(e).call(p);_({x:s.x,y:s.y,zoom:Wi(s.zoom,t,n)},[[0,0],[d.width,d.height]],r);const x=v.on("wheel.zoom"),w=v.on("dblclick.zoom");p.wheelDelta(qN);async function g(O,E){return v?new Promise(A=>{p==null||p.interpolate((E==null?void 0:E.interpolate)==="linear"?qo:yc).transform(If(v,E==null?void 0:E.duration,E==null?void 0:E.ease,()=>A(!0)),O)}):!1}function y({noWheelClassName:O,noPanClassName:E,onPaneContextMenu:A,userSelectionActive:C,panOnScroll:M,panOnDrag:T,panOnScrollMode:R,panOnScrollSpeed:B,preventScrolling:L,zoomOnPinch:F,zoomOnScroll:W,zoomOnDoubleClick:U,zoomActivationKeyPressed:K,lib:Q,onTransformChange:J,connectionInProgress:H,paneClickDistance:q,selectionOnDrag:ne}){C&&!u.isZoomingOrPanning&&m();const te=M&&!K&&!C;p.clickDistance(ne?1/0:!on(q)||q<0?0:q);const ee=te?_B({zoomPanValues:u,noWheelClassName:O,d3Selection:v,d3Zoom:p,panOnScrollMode:R,panOnScrollSpeed:B,zoomOnPinch:F,onPanZoomStart:o,onPanZoom:i,onPanZoomEnd:l}):xB({noWheelClassName:O,preventScrolling:L,d3ZoomHandler:x});v.on("wheel.zoom",ee,{passive:!1});const X=wB({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:o});p.on("start",X);const ae=bB({zoomPanValues:u,panOnDrag:T,onPaneContextMenu:!!A,onPanZoom:i,onTransformChange:J});p.on("zoom",ae);const pe=jB({zoomPanValues:u,panOnDrag:T,panOnScroll:M,onPaneContextMenu:A,onPanZoomEnd:l,onDraggingChange:c});p.on("end",pe);const ge=SB({zoomActivationKeyPressed:K,panOnDrag:T,zoomOnScroll:W,panOnScroll:M,zoomOnDoubleClick:U,zoomOnPinch:F,userSelectionActive:C,noPanClassName:E,noWheelClassName:O,lib:Q,connectionInProgress:H});p.filter(ge),U?v.on("dblclick.zoom",w):v.on("dblclick.zoom",null)}function m(){p.on("zoom",null)}async function _(O,E,A){const C=Mf(O),M=p==null?void 0:p.constrain()(C,E,A);return M&&await g(M),M}async function j(O,E){const A=Mf(O);return await g(A,E),A}function N(O){if(v){const E=Mf(O),A=v.property("__zoom");(A.k!==O.zoom||A.x!==O.x||A.y!==O.y)&&(p==null||p.transform(v,E,null,{sync:!0}))}}function k(){const O=v?yN(v.node()):{x:0,y:0,k:1};return{x:O.x,y:O.y,zoom:O.k}}async function S(O,E){return v?new Promise(A=>{p==null||p.interpolate((E==null?void 0:E.interpolate)==="linear"?qo:yc).scaleTo(If(v,E==null?void 0:E.duration,E==null?void 0:E.ease,()=>A(!0)),O)}):!1}async function P(O,E){return v?new Promise(A=>{p==null||p.interpolate((E==null?void 0:E.interpolate)==="linear"?qo:yc).scaleBy(If(v,E==null?void 0:E.duration,E==null?void 0:E.ease,()=>A(!0)),O)}):!1}function $(O){p==null||p.scaleExtent(O)}function D(O){p==null||p.translateExtent(O)}function I(O){const E=!on(O)||O<0?0:O;p==null||p.clickDistance(E)}return{update:y,destroy:m,setViewport:j,setViewportConstrained:_,getViewport:k,scaleTo:S,scaleBy:P,setScaleExtent:$,setTranslateExtent:D,syncViewport:N,setClickDistance:I}}var Gi;(function(e){e.Line="line",e.Handle="handle"})(Gi||(Gi={}));function NB({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:s,affectsY:i}){const o=e-t,l=n-r,c=[o>0?1:o<0?-1:0,l>0?1:l<0?-1:0];return o&&s&&(c[0]=c[0]*-1),l&&i&&(c[1]=c[1]*-1),c}function ux(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),s=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:s}}function vr(e,t){return Math.max(0,t-e)}function yr(e,t){return Math.max(0,e-t)}function Vl(e,t,n){return Math.max(0,t-e,e-n)}function dx(e,t){return e?!t:t}function EB(e,t,n,r,s,i,o,l){let{affectsX:c,affectsY:u}=t;const{isHorizontal:d,isVertical:f}=t,h=d&&f,{xSnapped:p,ySnapped:v}=n,{minWidth:x,maxWidth:w,minHeight:g,maxHeight:y}=r,{x:m,y:_,width:j,height:N,aspectRatio:k}=e;let S=Math.floor(d?p-e.pointerX:0),P=Math.floor(f?v-e.pointerY:0);const $=j+(c?-S:S),D=N+(u?-P:P),I=-i[0]*j,O=-i[1]*N;let E=Vl($,x,w),A=Vl(D,g,y);if(o){let T=0,R=0;c&&S<0?T=vr(m+S+I,o[0][0]):!c&&S>0&&(T=yr(m+$+I,o[1][0])),u&&P<0?R=vr(_+P+O,o[0][1]):!u&&P>0&&(R=yr(_+D+O,o[1][1])),E=Math.max(E,T),A=Math.max(A,R)}if(l){let T=0,R=0;c&&S>0?T=yr(m+S,l[0][0]):!c&&S<0&&(T=vr(m+$,l[1][0])),u&&P>0?R=yr(_+P,l[0][1]):!u&&P<0&&(R=vr(_+D,l[1][1])),E=Math.max(E,T),A=Math.max(A,R)}if(s){if(d){const T=Vl($/k,g,y)*k;if(E=Math.max(E,T),o){let R=0;!c&&!u||c&&!u&&h?R=yr(_+O+$/k,o[1][1])*k:R=vr(_+O+(c?S:-S)/k,o[0][1])*k,E=Math.max(E,R)}if(l){let R=0;!c&&!u||c&&!u&&h?R=vr(_+$/k,l[1][1])*k:R=yr(_+(c?S:-S)/k,l[0][1])*k,E=Math.max(E,R)}}if(f){const T=Vl(D*k,x,w)/k;if(A=Math.max(A,T),o){let R=0;!c&&!u||u&&!c&&h?R=yr(m+D*k+I,o[1][0])/k:R=vr(m+(u?P:-P)*k+I,o[0][0])/k,A=Math.max(A,R)}if(l){let R=0;!c&&!u||u&&!c&&h?R=vr(m+D*k,l[1][0])/k:R=yr(m+(u?P:-P)*k,l[0][0])/k,A=Math.max(A,R)}}}P=P+(P<0?A:-A),S=S+(S<0?E:-E),s&&(h?$>D*k?P=(dx(c,u)?-S:S)/k:S=(dx(c,u)?-P:P)*k:d?(P=S/k,u=c):(S=P*k,c=u));const C=c?m+S:m,M=u?_+P:_;return{width:j+(c?-S:S),height:N+(u?-P:P),x:i[0]*S*(c?-1:1)+C,y:i[1]*P*(u?-1:1)+M}}const YN={width:0,height:0,x:0,y:0},CB={...YN,pointerX:0,pointerY:0,aspectRatio:1};function AB(e,t,n){const r=t.position.x+e.position.x,s=t.position.y+e.position.y,i=e.measured.width??0,o=e.measured.height??0,l=n[0]*i,c=n[1]*o;return[[r-l,s-c],[r+i-l,s+o-c]]}function TB({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:s}){const i=bt(e);let o={controlDirection:ux("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:u,boundaries:d,keepAspectRatio:f,resizeDirection:h,onResizeStart:p,onResize:v,onResizeEnd:x,shouldResize:w}){let g={...YN},y={...CB};o={boundaries:d,resizeDirection:h,keepAspectRatio:f,controlDirection:ux(u)};let m,_=null,j=[],N,k,S,P=!1;const $=sN().on("start",D=>{const{nodeLookup:I,transform:O,snapGrid:E,snapToGrid:A,nodeOrigin:C,paneDomNode:M}=n();if(m=I.get(t),!m)return;_=(M==null?void 0:M.getBoundingClientRect())??null;const{xSnapped:T,ySnapped:R}=Yo(D.sourceEvent,{transform:O,snapGrid:E,snapToGrid:A,containerBounds:_});g={width:m.measured.width??0,height:m.measured.height??0,x:m.position.x??0,y:m.position.y??0},y={...g,pointerX:T,pointerY:R,aspectRatio:g.width/g.height},N=void 0,k=Is(m.extent)?m.extent:void 0,m.parentId&&(m.extent==="parent"||m.expandParent)&&(N=I.get(m.parentId)),N&&m.extent==="parent"&&(k=[[0,0],[N.measured.width,N.measured.height]]),j=[],S=void 0;for(const[B,L]of I)if(L.parentId===t&&(j.push({id:B,position:{...L.position},extent:L.extent}),L.extent==="parent"||L.expandParent)){const F=AB(L,m,L.origin??C);S?S=[[Math.min(F[0][0],S[0][0]),Math.min(F[0][1],S[0][1])],[Math.max(F[1][0],S[1][0]),Math.max(F[1][1],S[1][1])]]:S=F}p==null||p(D,{...g})}).on("drag",D=>{const{transform:I,snapGrid:O,snapToGrid:E,nodeOrigin:A}=n(),C=Yo(D.sourceEvent,{transform:I,snapGrid:O,snapToGrid:E,containerBounds:_}),M=[];if(!m)return;const{x:T,y:R,width:B,height:L}=g,F={},W=m.origin??A,{width:U,height:K,x:Q,y:J}=EB(y,o.controlDirection,C,o.boundaries,o.keepAspectRatio,W,k,S),H=U!==B,q=K!==L,ne=Q!==T&&H,te=J!==R&&q;if(!ne&&!te&&!H&&!q)return;if((ne||te||W[0]===1||W[1]===1)&&(F.x=ne?Q:g.x,F.y=te?J:g.y,g.x=F.x,g.y=F.y,j.length>0)){const pe=Q-T,ge=J-R;for(const Re of j)Re.position={x:Re.position.x-pe+W[0]*(U-B),y:Re.position.y-ge+W[1]*(K-L)},M.push(Re)}if((H||q)&&(F.width=H&&(!o.resizeDirection||o.resizeDirection==="horizontal")?U:g.width,F.height=q&&(!o.resizeDirection||o.resizeDirection==="vertical")?K:g.height,g.width=F.width,g.height=F.height),N&&m.expandParent){const pe=W[0]*(F.width??0);F.x&&F.x<pe&&(g.x=pe,y.x=y.x-(F.x-pe));const ge=W[1]*(F.height??0);F.y&&F.y<ge&&(g.y=ge,y.y=y.y-(F.y-ge))}const ee=NB({width:g.width,prevWidth:B,height:g.height,prevHeight:L,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),X={...g,direction:ee};(w==null?void 0:w(D,X))!==!1&&(P=!0,v==null||v(D,X),r(F,M))}).on("end",D=>{P&&(x==null||x(D,{...g}),s==null||s({...g}),P=!1)});i.call($)}function c(){i.on(".drag",null)}return{update:l,destroy:c}}var XN={exports:{}},QN={};/**
69
+ * @license React
70
+ * use-sync-external-store-shim/with-selector.production.js
71
+ *
72
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
73
+ *
74
+ * This source code is licensed under the MIT license found in the
75
+ * LICENSE file in the root directory of this source tree.
76
+ */var vd=b,PB=wj;function MB(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var IB=typeof Object.is=="function"?Object.is:MB,RB=PB.useSyncExternalStore,OB=vd.useRef,$B=vd.useEffect,LB=vd.useMemo,DB=vd.useDebugValue;QN.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var i=OB(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=LB(function(){function c(p){if(!u){if(u=!0,d=p,p=r(p),s!==void 0&&o.hasValue){var v=o.value;if(s(v,p))return f=v}return f=p}if(v=f,IB(d,p))return v;var x=r(p);return s!==void 0&&s(v,x)?(d=p,v):(d=p,f=x)}var u=!1,d,f,h=n===void 0?null:n;return[function(){return c(t())},h===null?void 0:function(){return c(h())}]},[t,n,r,s]);var l=RB(e,i[0],i[1]);return $B(function(){o.hasValue=!0,o.value=l},[l]),DB(l),l};XN.exports=QN;var zB=XN.exports;const VB=dw(zB),FB={},fx=e=>{let t;const n=new Set,r=(d,f)=>{const h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){const p=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(v=>v(t,p))}},s=()=>t,c={setState:r,getState:s,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(FB?"local-app":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=t=e(r,s,c);return c},BB=e=>e?fx(e):fx,{useDebugValue:HB}=Zn,{useSyncExternalStoreWithSelector:UB}=VB,WB=e=>e;function ZN(e,t=WB,n){const r=UB(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return HB(r),r}const hx=(e,t)=>{const n=BB(e),r=(s,i=t)=>ZN(n,s,i);return Object.assign(r,n),r},KB=(e,t)=>e?hx(e,t):hx;function Ie(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,s]of e)if(!Object.is(s,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const yd=b.createContext(null),GB=yd.Provider,JN=pn.error001("react");function he(e,t){const n=b.useContext(yd);if(n===null)throw new Error(JN);return ZN(n,e,t)}function Ne(){const e=b.useContext(yd);if(e===null)throw new Error(JN);return b.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const px={display:"none"},qB={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},eE="react-flow__node-desc",tE="react-flow__edge-desc",YB="react-flow__aria-live",XB=e=>e.ariaLiveMessage,QB=e=>e.ariaLabelConfig;function ZB({rfId:e}){const t=he(XB);return a.jsx("div",{id:`${YB}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:qB,children:t})}function JB({rfId:e,disableKeyboardA11y:t}){const n=he(QB);return a.jsxs(a.Fragment,{children:[a.jsx("div",{id:`${eE}-${e}`,style:px,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),a.jsx("div",{id:`${tE}-${e}`,style:px,children:n["edge.a11yDescription.default"]}),!t&&a.jsx(ZB,{rfId:e})]})}const _d=b.forwardRef(({position:e="top-left",children:t,className:n,style:r,...s},i)=>{const o=`${e}`.split("-");return a.jsx("div",{className:Fe(["react-flow__panel",n,...o]),style:r,ref:i,...s,children:t})});_d.displayName="Panel";const mx="https://reactflow.dev?utm_source=attribution";function e6({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:a.jsx(_d,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${mx}`,children:a.jsx("a",{href:mx,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const t6=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}},Fl=e=>e.id;function n6(e,t){return Ie(e.selectedNodes.map(Fl),t.selectedNodes.map(Fl))&&Ie(e.selectedEdges.map(Fl),t.selectedEdges.map(Fl))}function r6({onSelectionChange:e}){const t=Ne(),{selectedNodes:n,selectedEdges:r}=he(t6,n6);return b.useEffect(()=>{const s={nodes:n,edges:r};e==null||e(s),t.getState().onSelectionChangeHandlers.forEach(i=>i(s))},[n,r,e]),null}const s6=e=>!!e.onSelectionChangeHandlers;function i6({onSelectionChange:e}){const t=he(s6);return e||t?a.jsx(r6,{onSelectionChange:e}):null}const nE=[0,0],o6={x:0,y:0,zoom:1},a6=["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"],gx=[...a6,"rfId"],l6=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}),vx={translateExtent:Pa,nodeOrigin:nE,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function c6(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:s,setTranslateExtent:i,setNodeExtent:o,reset:l,setDefaultNodesAndEdges:c}=he(l6,Ie),u=Ne();b.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=vx,l()}),[]);const d=b.useRef(vx);return b.useEffect(()=>{for(const f of gx){const h=e[f],p=d.current[f];h!==p&&(typeof e[f]>"u"||(f==="nodes"?t(h):f==="edges"?n(h):f==="minZoom"?r(h):f==="maxZoom"?s(h):f==="translateExtent"?i(h):f==="nodeExtent"?o(h):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:H5(h)}):f==="fitView"?u.setState({fitViewQueued:h}):f==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[f]:h})))}d.current=e},gx.map(f=>e[f])),null}function yx(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function u6(e){var r;const[t,n]=b.useState(e==="system"?null:e);return b.useEffect(()=>{if(e!=="system"){n(e);return}const s=yx(),i=()=>n(s!=null&&s.matches?"dark":"light");return i(),s==null||s.addEventListener("change",i),()=>{s==null||s.removeEventListener("change",i)}},[e]),t!==null?t:(r=yx())!=null&&r.matches?"dark":"light"}const _x=typeof document<"u"?document:null;function Oa(e=null,t={target:_x,actInsideInputWithModifier:!0}){const[n,r]=b.useState(!1),s=b.useRef(!1),i=b.useRef(new Set([])),[o,l]=b.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
77
+ `).replace(`
78
+
79
+ `,`
80
+ +`).split(`
81
+ `)),d=u.reduce((f,h)=>f.concat(...h),[]);return[u,d]}return[[],[]]},[e]);return b.useEffect(()=>{const c=(t==null?void 0:t.target)??_x,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=p=>{var w,g;if(s.current=p.ctrlKey||p.metaKey||p.shiftKey||p.altKey,(!s.current||s.current&&!u)&&IN(p))return!1;const x=wx(p.code,l);if(i.current.add(p[x]),xx(o,i.current,!1)){const y=((g=(w=p.composedPath)==null?void 0:w.call(p))==null?void 0:g[0])||p.target,m=(y==null?void 0:y.nodeName)==="BUTTON"||(y==null?void 0:y.nodeName)==="A";t.preventDefault!==!1&&(s.current||!m)&&p.preventDefault(),r(!0)}},f=p=>{const v=wx(p.code,l);xx(o,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(p[v]),p.key==="Meta"&&i.current.clear(),s.current=!1},h=()=>{i.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",d),c==null||c.addEventListener("keyup",f),window.addEventListener("blur",h),window.addEventListener("contextmenu",h),()=>{c==null||c.removeEventListener("keydown",d),c==null||c.removeEventListener("keyup",f),window.removeEventListener("blur",h),window.removeEventListener("contextmenu",h)}}},[e,r]),n}function xx(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function wx(e,t){return t.includes(e)?"code":"key"}const d6=()=>{const e=Ne();return b.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,s,i],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??s,zoom:t.zoom??i},n),!0):!1},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:s,minZoom:i,maxZoom:o,panZoom:l}=e.getState(),c=ov(t,r,s,i,o,(n==null?void 0:n.padding)??.1);return l?(await l.setViewport(c,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:s,snapToGrid:i,domNode:o}=e.getState();if(!o)return t;const{x:l,y:c}=o.getBoundingClientRect(),u={x:t.x-l,y:t.y-c},d=n.snapGrid??s,f=n.snapToGrid??i;return sl(u,r,f,d)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:s,y:i}=r.getBoundingClientRect(),o=Ki(t,n);return{x:o.x+s,y:o.y+i}}}),[])};function rE(e,t){const n=[],r=new Map,s=[];for(const i of e)if(i.type==="add"){s.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const o=r.get(i.id);o?o.push(i):r.set(i.id,[i])}for(const i of t){const o=r.get(i.id);if(!o){n.push(i);continue}if(o[0].type==="remove")continue;if(o[0].type==="replace"){n.push({...o[0].item});continue}const l={...i};for(const c of o)f6(c,l);n.push(l)}return s.length&&s.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function f6(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 h6(e,t){return rE(e,t)}function p6(e,t){return rE(e,t)}function os(e,t){return{id:e,type:"select",selected:t}}function vi(e,t=new Set,n=!1){const r=[];for(const[s,i]of e){const o=t.has(s);!(i.selected===void 0&&!o)&&i.selected!==o&&(n&&(i.selected=o),r.push(os(i.id,o)))}return r}function bx({items:e=[],lookup:t}){var s;const n=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,o]of e.entries()){const l=t.get(o.id),c=((s=l==null?void 0:l.internals)==null?void 0:s.userNode)??l;c!==void 0&&c!==o&&n.push({id:o.id,item:o,type:"replace"}),c===void 0&&n.push({item:o,type:"add",index:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function jx(e){return{id:e.id,type:"remove"}}const m6=AN();function g6(e,t,n={}){return Y5(e,t,{...n,onError:n.onError??m6})}const Sx=e=>R5(e),v6=e=>SN(e);function sE(e){return b.forwardRef(e)}const iE=typeof window<"u"?b.useLayoutEffect:b.useEffect;function kx(e){const[t,n]=b.useState(BigInt(0)),[r]=b.useState(()=>y6(()=>n(s=>s+BigInt(1))));return iE(()=>{const s=r.get();s.length&&(e(s),r.reset())},[t]),r}function y6(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const oE=b.createContext(null);function _6({children:e}){const t=Ne(),n=b.useCallback(l=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:d,onNodesChange:f,nodeLookup:h,fitViewQueued:p,onNodesChangeMiddlewareMap:v}=t.getState();let x=c;for(const g of l)x=typeof g=="function"?g(x):g;let w=bx({items:x,lookup:h});for(const g of v.values())w=g(w);d&&u(x),w.length>0?f==null||f(w):p&&window.requestAnimationFrame(()=>{const{fitViewQueued:g,nodes:y,setNodes:m}=t.getState();g&&m(y)})},[]),r=kx(n),s=b.useCallback(l=>{const{edges:c=[],setEdges:u,hasDefaultEdges:d,onEdgesChange:f,edgeLookup:h}=t.getState();let p=c;for(const v of l)p=typeof v=="function"?v(p):v;d?u(p):f&&f(bx({items:p,lookup:h}))},[]),i=kx(s),o=b.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return a.jsx(oE.Provider,{value:o,children:e})}function x6(){const e=b.useContext(oE);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const w6=e=>!!e.panZoom;function hv(){const e=d6(),t=Ne(),n=x6(),r=he(w6),s=b.useMemo(()=>{const i=f=>t.getState().nodeLookup.get(f),o=f=>{n.nodeQueue.push(f)},l=f=>{n.edgeQueue.push(f)},c=f=>{var g,y;const{nodeLookup:h,nodeOrigin:p}=t.getState(),v=Sx(f)?f:h.get(f.id),x=v.parentId?PN(v.position,v.measured,v.parentId,h,p):v.position,w={...v,position:x,width:((g=v.measured)==null?void 0:g.width)??v.width,height:((y=v.measured)==null?void 0:y.height)??v.height};return Ia(w)},u=(f,h,p={replace:!1})=>{o(v=>v.map(x=>{if(x.id===f){const w=typeof h=="function"?h(x):h;return p.replace&&Sx(w)?w:{...x,...w}}return x}))},d=(f,h,p={replace:!1})=>{l(v=>v.map(x=>{if(x.id===f){const w=typeof h=="function"?h(x):h;return p.replace&&v6(w)?w:{...x,...w}}return x}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var h;return(h=i(f))==null?void 0:h.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(h=>({...h}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:o,setEdges:l,addNodes:f=>{const h=Array.isArray(f)?f:[f];n.nodeQueue.push(p=>[...p,...h])},addEdges:f=>{const h=Array.isArray(f)?f:[f];n.edgeQueue.push(p=>[...p,...h])},toObject:()=>{const{nodes:f=[],edges:h=[],transform:p}=t.getState(),[v,x,w]=p;return{nodes:f.map(g=>({...g})),edges:h.map(g=>({...g})),viewport:{x:v,y:x,zoom:w}}},deleteElements:async({nodes:f=[],edges:h=[]})=>{const{nodes:p,edges:v,onNodesDelete:x,onEdgesDelete:w,triggerNodeChanges:g,triggerEdgeChanges:y,onDelete:m,onBeforeDelete:_}=t.getState(),{nodes:j,edges:N}=await z5({nodesToRemove:f,edgesToRemove:h,nodes:p,edges:v,onBeforeDelete:_}),k=N.length>0,S=j.length>0;if(k){const P=N.map(jx);w==null||w(N),y(P)}if(S){const P=j.map(jx);x==null||x(j),g(P)}return(S||k)&&(m==null||m({nodes:j,edges:N})),{deletedNodes:j,deletedEdges:N}},getIntersectingNodes:(f,h=!0,p)=>{const v=J_(f),x=v?f:c(f),w=p!==void 0;return x?(p||t.getState().nodes).filter(g=>{const y=t.getState().nodeLookup.get(g.id);if(y&&!v&&(g.id===f.id||!y.internals.positionAbsolute))return!1;const m=Ia(w?g:y),_=ju(m,x);return h&&_>0||_>=m.width*m.height||_>=x.width*x.height}):[]},isNodeIntersecting:(f,h,p=!0)=>{const x=J_(f)?f:c(f);if(!x)return!1;const w=ju(x,h);return p&&w>0||w>=h.width*h.height||w>=x.width*x.height},updateNode:u,updateNodeData:(f,h,p={replace:!1})=>{u(f,v=>{const x=typeof h=="function"?h(v):h;return p.replace?{...v,data:x}:{...v,data:{...v.data,...x}}},p)},updateEdge:d,updateEdgeData:(f,h,p={replace:!1})=>{d(f,v=>{const x=typeof h=="function"?h(v):h;return p.replace?{...v,data:x}:{...v,data:{...v.data,...x}}},p)},getNodesBounds:f=>{const{nodeLookup:h,nodeOrigin:p}=t.getState();return O5(f,{nodeLookup:h,nodeOrigin:p})},getHandleConnections:({type:f,id:h,nodeId:p})=>{var v;return Array.from(((v=t.getState().connectionLookup.get(`${p}-${f}${h?`-${h}`:""}`))==null?void 0:v.values())??[])},getNodeConnections:({type:f,handleId:h,nodeId:p})=>{var v;return Array.from(((v=t.getState().connectionLookup.get(`${p}${f?h?`-${f}-${h}`:`-${f}`:""}`))==null?void 0:v.values())??[])},fitView:async f=>{const h=t.getState().fitViewResolver??B5();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:h}),n.nodeQueue.push(p=>[...p]),h.promise}}},[]);return b.useMemo(()=>({...s,...e,viewportInitialized:r}),[r])}const Nx=e=>e.selected,b6=typeof window<"u"?window:void 0;function j6({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=Ne(),{deleteElements:r}=hv(),s=Oa(e,{actInsideInputWithModifier:!1}),i=Oa(t,{target:b6});b.useEffect(()=>{if(s){const{edges:o,nodes:l}=n.getState();r({nodes:l.filter(Nx),edges:o.filter(Nx)}),n.setState({nodesSelectionActive:!1})}},[s]),b.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function S6(e){const t=Ne();b.useEffect(()=>{const n=()=>{var s,i,o,l;if(!e.current||!(((i=(s=e.current).checkVisibility)==null?void 0:i.call(s))??!0))return!1;const r=av(e.current);(r.height===0||r.width===0)&&((l=(o=t.getState()).onError)==null||l.call(o,"004",pn.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 xd={position:"absolute",width:"100%",height:"100%",top:0,left:0},k6=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function N6({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:i=_s.Free,zoomOnDoubleClick:o=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:h,preventScrolling:p=!0,children:v,noWheelClassName:x,noPanClassName:w,onViewportChange:g,isControlledViewport:y,paneClickDistance:m,selectionOnDrag:_}){const j=Ne(),N=b.useRef(null),{userSelectionActive:k,lib:S,connectionInProgress:P}=he(k6,Ie),$=Oa(h),D=b.useRef();S6(N);const I=b.useCallback(O=>{g==null||g({x:O[0],y:O[1],zoom:O[2]}),y||j.setState({transform:O})},[g,y]);return b.useEffect(()=>{if(N.current){D.current=kB({domNode:N.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:c,onDraggingChange:C=>j.setState(M=>M.paneDragging===C?M:{paneDragging:C}),onPanZoomStart:(C,M)=>{const{onViewportChangeStart:T,onMoveStart:R}=j.getState();R==null||R(C,M),T==null||T(M)},onPanZoom:(C,M)=>{const{onViewportChange:T,onMove:R}=j.getState();R==null||R(C,M),T==null||T(M)},onPanZoomEnd:(C,M)=>{const{onViewportChangeEnd:T,onMoveEnd:R}=j.getState();R==null||R(C,M),T==null||T(M)}});const{x:O,y:E,zoom:A}=D.current.getViewport();return j.setState({panZoom:D.current,transform:[O,E,A],domNode:N.current.closest(".react-flow")}),()=>{var C;(C=D.current)==null||C.destroy()}}},[]),b.useEffect(()=>{var O;(O=D.current)==null||O.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:i,zoomOnDoubleClick:o,panOnDrag:l,zoomActivationKeyPressed:$,preventScrolling:p,noPanClassName:w,userSelectionActive:k,noWheelClassName:x,lib:S,onTransformChange:I,connectionInProgress:P,selectionOnDrag:_,paneClickDistance:m})},[e,t,n,r,s,i,o,l,$,p,w,k,x,S,I,P,_,m]),a.jsx("div",{className:"react-flow__renderer",ref:N,style:xd,children:v})}const E6=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function C6(){const{userSelectionActive:e,userSelectionRect:t}=he(E6,Ie);return e&&t?a.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const Rf=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},A6=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function T6({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Ma.Full,panOnDrag:r,autoPanOnSelection:s,paneClickDistance:i,selectionOnDrag:o,onSelectionStart:l,onSelectionEnd:c,onPaneClick:u,onPaneContextMenu:d,onPaneScroll:f,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:v,children:x}){const w=b.useRef(0),g=Ne(),{userSelectionActive:y,elementsSelectable:m,dragging:_,panBy:j,autoPanSpeed:N}=he(A6,Ie),k=m&&(e||y),S=b.useRef(null),P=b.useRef(),$=b.useRef(new Set),D=b.useRef(new Set),I=b.useRef(!1),O=b.useRef(!1),E=b.useRef({x:0,y:0}),A=b.useRef(!1),C=H=>{if(O.current||I.current||g.getState().connection.inProgress){O.current=!1,I.current=!1;return}u==null||u(H),g.getState().resetSelectedElements(),g.setState({nodesSelectionActive:!1})},M=H=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){H.preventDefault();return}d==null||d(H)},T=f?H=>f(H):void 0,R=H=>{O.current&&(H.stopPropagation(),O.current=!1)},B=H=>{var Re,Rt;const{domNode:q,transform:ne}=g.getState();if(P.current=q==null?void 0:q.getBoundingClientRect(),!P.current)return;const te=H.target===S.current;if(!te&&!!H.target.closest(".nokey")||!e||!(o&&te||t)||H.button!==0||!H.isPrimary)return;(Rt=(Re=H.target)==null?void 0:Re.setPointerCapture)==null||Rt.call(Re,H.pointerId),O.current=!1;const{x:ae,y:pe}=an(H.nativeEvent,P.current),ge=sl({x:ae,y:pe},ne);g.setState({userSelectionRect:{width:0,height:0,startX:ge.x,startY:ge.y,x:ae,y:pe}}),te||(H.stopPropagation(),H.preventDefault())};function L(H,q){const{userSelectionRect:ne}=g.getState();if(!ne)return;const{transform:te,nodeLookup:ee,edgeLookup:X,connectionLookup:ae,triggerNodeChanges:pe,triggerEdgeChanges:ge,defaultEdgeOptions:Re}=g.getState(),Rt={x:ne.startX,y:ne.startY},{x:vn,y:yn}=Ki(Rt,te),Dn={startX:Rt.x,startY:Rt.y,x:H<vn?H:vn,y:q<yn?q:yn,width:Math.abs(H-vn),height:Math.abs(q-yn)},oo=$.current,Xr=D.current;$.current=new Set(sv(ee,Dn,te,n===Ma.Partial,!0).map(Xt=>Xt.id)),D.current=new Set;const Qr=(Re==null?void 0:Re.selectable)??!0;for(const Xt of $.current){const zn=ae.get(Xt);if(zn)for(const{edgeId:Vn}of zn.values()){const Zr=X.get(Vn);Zr&&(Zr.selectable??Qr)&&D.current.add(Vn)}}if(!ex(oo,$.current)){const Xt=vi(ee,$.current,!0);pe(Xt)}if(!ex(Xr,D.current)){const Xt=vi(X,D.current);ge(Xt)}g.setState({userSelectionRect:Dn,userSelectionActive:!0,nodesSelectionActive:!1})}function F(){if(!s||!P.current)return;const[H,q]=iv(E.current,P.current,N);j({x:H,y:q}).then(ne=>{if(!O.current||!ne){w.current=requestAnimationFrame(F);return}const{x:te,y:ee}=E.current;L(te,ee),w.current=requestAnimationFrame(F)})}const W=()=>{cancelAnimationFrame(w.current),w.current=0,A.current=!1};b.useEffect(()=>()=>W(),[]);const U=H=>{const{userSelectionRect:q,transform:ne,resetSelectedElements:te}=g.getState();if(!P.current||!q)return;const{x:ee,y:X}=an(H.nativeEvent,P.current);E.current={x:ee,y:X};const ae=Ki({x:q.startX,y:q.startY},ne);if(!O.current){const pe=t?0:i;if(Math.hypot(ee-ae.x,X-ae.y)<=pe)return;te(),l==null||l(H)}O.current=!0,A.current||(F(),A.current=!0),L(ee,X)},K=H=>{var q,ne;if(!k){H.target===S.current&&g.getState().connection.inProgress&&(I.current=!0);return}H.button===0&&((ne=(q=H.target)==null?void 0:q.releasePointerCapture)==null||ne.call(q,H.pointerId),!y&&H.target===S.current&&g.getState().userSelectionRect&&(C==null||C(H)),g.setState({userSelectionActive:!1,userSelectionRect:null}),O.current&&(c==null||c(H),g.setState({nodesSelectionActive:$.current.size>0})),W())},Q=H=>{var q,ne;(ne=(q=H.target)==null?void 0:q.releasePointerCapture)==null||ne.call(q,H.pointerId),W()},J=r===!0||Array.isArray(r)&&r.includes(0);return a.jsxs("div",{className:Fe(["react-flow__pane",{draggable:J,dragging:_,selection:e}]),onClick:k?void 0:Rf(C,S),onContextMenu:Rf(M,S),onWheel:Rf(T,S),onPointerEnter:k?void 0:h,onPointerMove:k?U:p,onPointerUp:K,onPointerCancel:k?Q:void 0,onPointerDownCapture:k?B:void 0,onClickCapture:k?R:void 0,onPointerLeave:v,ref:S,style:xd,children:[x,a.jsx(C6,{})]})}function Up({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:o,nodeLookup:l,onError:c}=t.getState(),u=l.get(e);if(!u){c==null||c("012",pn.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&o)&&(i({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var d;return(d=r==null?void 0:r.current)==null?void 0:d.blur()})):s([e])}function aE({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,nodeClickDistance:o}){const l=Ne(),[c,u]=b.useState(!1),d=b.useRef();return b.useEffect(()=>{if(!t)return d.current=dB({getStoreItems:()=>l.getState(),onNodeMouseDown:f=>{Up({id:f,store:l,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}}),()=>{var f;(f=d.current)==null||f.destroy(),d.current=void 0}},[t,l,e]),b.useEffect(()=>{t||!e.current||!d.current||d.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:s,nodeClickDistance:o})},[n,r,t,i,e,s,o]),c}const P6=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function lE(){const e=Ne();return b.useCallback(n=>{const{nodeExtent:r,snapToGrid:s,snapGrid:i,nodesDraggable:o,onError:l,updateNodePositions:c,nodeLookup:u,nodeOrigin:d}=e.getState(),f=new Map,h=P6(o),p=s?i[0]:5,v=s?i[1]:5,x=n.direction.x*p*n.factor,w=n.direction.y*v*n.factor;for(const[,g]of u){if(!h(g))continue;let y={x:g.internals.positionAbsolute.x+x,y:g.internals.positionAbsolute.y+w};s&&(y=rl(y,i));const{position:m,positionAbsolute:_}=kN({nodeId:g.id,nextPosition:y,nodeLookup:u,nodeExtent:r,nodeOrigin:d,onError:l});g.position=m,g.internals.positionAbsolute=_,f.set(g.id,g)}c(f)},[])}const pv=b.createContext(null),M6=pv.Provider;pv.Consumer;const cE=()=>b.useContext(pv),I6=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),uE=b.createContext(null);function R6({children:e}){const t=he(I6,Ie);return a.jsx(uE.Provider,{value:t,children:e})}function O6(){const e=b.useContext(uE);if(!e)throw new Error("useHandleConfig must be used within a HandleConfigProvider");return e}const $6={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},L6=(e,t,n)=>r=>{const{connectionClickStartHandle:s,connectionMode:i,connection:o}=r,{fromHandle:l,toHandle:c,isValid:u}=o;if(!l&&!s)return $6;const d=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===t&&(l==null?void 0:l.type)===n,connectingTo:d,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===n,isPossibleEndHandle:i===Ui.Strict?(l==null?void 0:l.type)!==n:e!==(l==null?void 0:l.nodeId)||t!==(l==null?void 0:l.id),connectionInProcess:!!l,clickConnectionInProcess:!!s,valid:d&&u}};function D6({type:e="source",position:t=re.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:o,onConnect:l,children:c,className:u,onMouseDown:d,onTouchStart:f,...h},p){var A,C;const v=o||null,x=e==="target",w=Ne(),g=cE(),{connectOnClick:y,noPanClassName:m,rfId:_}=O6(),{connectingFrom:j,connectingTo:N,clickConnecting:k,isPossibleEndHandle:S,connectionInProcess:P,clickConnectionInProcess:$,valid:D}=he(L6(g,v,e),Ie);g||(C=(A=w.getState()).onError)==null||C.call(A,"010",pn.error010());const I=M=>{const{defaultEdgeOptions:T,onConnect:R,hasDefaultEdges:B}=w.getState(),L={...T,...M};if(B){const{edges:F,setEdges:W,onError:U}=w.getState();W(g6(L,F,{onError:U}))}R==null||R(L),l==null||l(L)},O=M=>{if(!g)return;const T=RN(M.nativeEvent);if(s&&(T&&M.button===0||!T)){const R=w.getState();Hp.onPointerDown(M.nativeEvent,{handleDomNode:M.currentTarget,autoPanOnConnect:R.autoPanOnConnect,connectionMode:R.connectionMode,connectionRadius:R.connectionRadius,domNode:R.domNode,nodeLookup:R.nodeLookup,lib:R.lib,isTarget:x,handleId:v,nodeId:g,flowId:R.rfId,panBy:R.panBy,cancelConnection:R.cancelConnection,onConnectStart:R.onConnectStart,onConnectEnd:(...B)=>{var L,F;return(F=(L=w.getState()).onConnectEnd)==null?void 0:F.call(L,...B)},updateConnection:R.updateConnection,onConnect:I,isValidConnection:n||((...B)=>{var L,F;return((F=(L=w.getState()).isValidConnection)==null?void 0:F.call(L,...B))??!0}),getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,autoPanSpeed:R.autoPanSpeed,dragThreshold:R.connectionDragThreshold})}T?d==null||d(M):f==null||f(M)},E=M=>{const{onClickConnectStart:T,onClickConnectEnd:R,connectionClickStartHandle:B,connectionMode:L,isValidConnection:F,lib:W,rfId:U,nodeLookup:K,connection:Q}=w.getState();if(!g||!B&&!s)return;if(!B){T==null||T(M.nativeEvent,{nodeId:g,handleId:v,handleType:e}),w.setState({connectionClickStartHandle:{nodeId:g,type:e,id:v}});return}const J=MN(M.target),H=n||F,{connection:q,isValid:ne}=Hp.isValid(M.nativeEvent,{handle:{nodeId:g,id:v,type:e},connectionMode:L,fromNodeId:B.nodeId,fromHandleId:B.id||null,fromType:B.type,isValidConnection:H,flowId:U,doc:J,lib:W,nodeLookup:K});ne&&q&&I(q);const te=structuredClone(Q);delete te.inProgress,te.toPosition=te.toHandle?te.toHandle.position:null,R==null||R(M,te),w.setState({connectionClickStartHandle:null})};return a.jsx("div",{"data-handleid":v,"data-nodeid":g,"data-handlepos":t,"data-id":`${_}-${g}-${v}-${e}`,className:Fe(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",m,u,{source:!x,target:x,connectable:r,connectablestart:s,connectableend:i,clickconnecting:k,connectingfrom:j,connectingto:N,valid:D,connectionindicator:r&&(!P||S)&&(P||$?i:s)}]),onMouseDown:O,onTouchStart:O,onClick:y?E:void 0,ref:p,...h,children:c})}const qi=b.memo(sE(D6));function z6({data:e,isConnectable:t,sourcePosition:n=re.Bottom}){return a.jsxs(a.Fragment,{children:[e==null?void 0:e.label,a.jsx(qi,{type:"source",position:n,isConnectable:t})]})}function V6({data:e,isConnectable:t,targetPosition:n=re.Top,sourcePosition:r=re.Bottom}){return a.jsxs(a.Fragment,{children:[a.jsx(qi,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,a.jsx(qi,{type:"source",position:r,isConnectable:t})]})}function F6(){return null}function B6({data:e,isConnectable:t,targetPosition:n=re.Top}){return a.jsxs(a.Fragment,{children:[a.jsx(qi,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Su={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Ex={input:z6,default:V6,output:B6,group:F6};function H6(e){var t,n,r,s;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((s=e.style)==null?void 0:s.height)}}const U6=e=>{const{width:t,height:n,x:r,y:s}=nl(e.nodeLookup,{filter:i=>!!i.selected});return{width:on(t)?t:null,height:on(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${s}px)`}};function W6({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Ne(),{width:s,height:i,transformString:o,userSelectionActive:l}=he(U6,Ie),c=lE(),u=b.useRef(null);b.useEffect(()=>{var p;n||(p=u.current)==null||p.focus({preventScroll:!0})},[n]);const d=!l&&s!==null&&i!==null;if(aE({nodeRef:u,disabled:!d}),!d)return null;const f=e?p=>{const v=r.getState().nodes.filter(x=>x.selected);e(p,v)}:void 0,h=p=>{Object.prototype.hasOwnProperty.call(Su,p.key)&&(p.preventDefault(),c({direction:Su[p.key],factor:p.shiftKey?4:1}))};return a.jsx("div",{className:Fe(["react-flow__nodesselection","react-flow__container",t]),style:{transform:o},children:a.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:s,height:i}})})}const Cx=typeof window<"u"?window:void 0,K6=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function dE({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:o,paneClickDistance:l,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:d,selectionMode:f,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:v,panActivationKeyCode:x,zoomActivationKeyCode:w,elementsSelectable:g,zoomOnScroll:y,zoomOnPinch:m,panOnScroll:_,panOnScrollSpeed:j,panOnScrollMode:N,zoomOnDoubleClick:k,panOnDrag:S,autoPanOnSelection:P,defaultViewport:$,translateExtent:D,minZoom:I,maxZoom:O,preventScrolling:E,onSelectionContextMenu:A,noWheelClassName:C,noPanClassName:M,disableKeyboardA11y:T,onViewportChange:R,isControlledViewport:B}){const{nodesSelectionActive:L,userSelectionActive:F}=he(K6,Ie),W=Oa(u,{target:Cx}),U=Oa(x,{target:Cx}),K=U||S,Q=U||_,J=d&&K!==!0,H=W||F||J;return j6({deleteKeyCode:c,multiSelectionKeyCode:v}),a.jsx(N6,{onPaneContextMenu:i,elementsSelectable:g,zoomOnScroll:y,zoomOnPinch:m,panOnScroll:Q,panOnScrollSpeed:j,panOnScrollMode:N,zoomOnDoubleClick:k,panOnDrag:!W&&K,defaultViewport:$,translateExtent:D,minZoom:I,maxZoom:O,zoomActivationKeyCode:w,preventScrolling:E,noWheelClassName:C,noPanClassName:M,onViewportChange:R,isControlledViewport:B,paneClickDistance:l,selectionOnDrag:J,children:a.jsxs(T6,{onSelectionStart:h,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:o,panOnDrag:K,autoPanOnSelection:P,isSelecting:!!H,selectionMode:f,selectionKeyPressed:W,paneClickDistance:l,selectionOnDrag:J,children:[e,L&&a.jsx(W6,{onSelectionContextMenu:A,noPanClassName:M,disableKeyboardA11y:T})]})})}dE.displayName="FlowRenderer";const G6=b.memo(dE),q6=e=>t=>e?sv(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 Y6(e){return he(b.useCallback(q6(e),[e]),Ie)}const X6=e=>e.updateNodeInternals;function Q6(){const e=he(X6),[t]=b.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(s=>{const i=s.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:s.target,force:!0})}),e(r)}));return b.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function Z6({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const s=Ne(),i=b.useRef(null),o=b.useRef(null),l=b.useRef(e.sourcePosition),c=b.useRef(e.targetPosition),u=b.useRef(t),d=n&&!!e.internals.handleBounds;return b.useEffect(()=>{i.current&&!e.hidden&&(!d||o.current!==i.current)&&(o.current&&(r==null||r.unobserve(o.current)),r==null||r.observe(i.current),o.current=i.current)},[d,e.hidden]),b.useEffect(()=>()=>{o.current&&(r==null||r.unobserve(o.current),o.current=null)},[]),b.useEffect(()=>{if(i.current){const f=u.current!==t,h=l.current!==e.sourcePosition,p=c.current!==e.targetPosition;(f||h||p)&&(u.current=t,l.current=e.sourcePosition,c.current=e.targetPosition,s.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function J6({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:s,onContextMenu:i,onDoubleClick:o,nodesDraggable:l,elementsSelectable:c,nodesConnectable:u,nodesFocusable:d,resizeObserver:f,noDragClassName:h,noPanClassName:p,disableKeyboardA11y:v,rfId:x,nodeTypes:w,nodeClickDistance:g,onError:y}){const{node:m,internals:_,isParent:j}=he(H=>{const q=H.nodeLookup.get(e),ne=H.parentLookup.has(e);return{node:q,internals:q.internals,isParent:ne}},Ie);let N=m.type||"default",k=(w==null?void 0:w[N])||Ex[N];k===void 0&&(y==null||y("003",pn.error003(N)),N="default",k=(w==null?void 0:w.default)||Ex.default);const S=!!(m.draggable||l&&typeof m.draggable>"u"),P=!!(m.selectable||c&&typeof m.selectable>"u"),$=!!(m.connectable||u&&typeof m.connectable>"u"),D=!!(m.focusable||d&&typeof m.focusable>"u"),I=Ne(),O=TN(m),E=Z6({node:m,nodeType:N,hasDimensions:O,resizeObserver:f}),A=aE({nodeRef:E,disabled:m.hidden||!S,noDragClassName:h,handleSelector:m.dragHandle,nodeId:e,isSelectable:P,nodeClickDistance:g}),C=lE();if(m.hidden)return null;const M=Ln(m),T=H6(m),R=P||S||t||n||r||s,B=n?H=>n(H,{..._.userNode}):void 0,L=r?H=>r(H,{..._.userNode}):void 0,F=s?H=>s(H,{..._.userNode}):void 0,W=i?H=>i(H,{..._.userNode}):void 0,U=o?H=>o(H,{..._.userNode}):void 0,K=H=>{const{selectNodesOnDrag:q,nodeDragThreshold:ne}=I.getState();P&&(!q||!S||ne>0)&&Up({id:e,store:I,nodeRef:E}),t&&t(H,{..._.userNode})},Q=H=>{if(!(IN(H.nativeEvent)||v)){if(xN.includes(H.key)&&P){const q=H.key==="Escape";Up({id:e,store:I,unselect:q,nodeRef:E})}else if(S&&m.selected&&Object.prototype.hasOwnProperty.call(Su,H.key)){H.preventDefault();const{ariaLabelConfig:q}=I.getState();I.setState({ariaLiveMessage:q["node.a11yDescription.ariaLiveMessage"]({direction:H.key.replace("Arrow","").toLowerCase(),x:~~_.positionAbsolute.x,y:~~_.positionAbsolute.y})}),C({direction:Su[H.key],factor:H.shiftKey?4:1})}}},J=()=>{var ae;if(v||!((ae=E.current)!=null&&ae.matches(":focus-visible")))return;const{transform:H,width:q,height:ne,autoPanOnNodeFocus:te,setCenter:ee}=I.getState();if(!te)return;sv(new Map([[e,m]]),{x:0,y:0,width:q,height:ne},H,!0).length>0||ee(m.position.x+M.width/2,m.position.y+M.height/2,{zoom:H[2]})};return a.jsx("div",{className:Fe(["react-flow__node",`react-flow__node-${N}`,{[p]:S},m.className,{selected:m.selected,selectable:P,parent:j,draggable:S,dragging:A}]),ref:E,style:{zIndex:_.z,transform:`translate(${_.positionAbsolute.x}px,${_.positionAbsolute.y}px)`,pointerEvents:R?"all":"none",visibility:O?"visible":"hidden",...m.style,...T},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:B,onMouseMove:L,onMouseLeave:F,onContextMenu:W,onClick:K,onDoubleClick:U,onKeyDown:D?Q:void 0,tabIndex:D?0:void 0,onFocus:D?J:void 0,role:m.ariaRole??(D?"group":void 0),"aria-roledescription":"node","aria-describedby":v?void 0:`${eE}-${x}`,"aria-label":m.ariaLabel,...m.domAttributes,children:a.jsx(M6,{value:e,children:a.jsx(k,{id:e,data:m.data,type:N,positionAbsoluteX:_.positionAbsolute.x,positionAbsoluteY:_.positionAbsolute.y,selected:m.selected??!1,selectable:P,draggable:S,deletable:m.deletable??!0,isConnectable:$,sourcePosition:m.sourcePosition,targetPosition:m.targetPosition,dragging:A,dragHandle:m.dragHandle,zIndex:_.z,parentId:m.parentId,...M})})})}var e8=b.memo(J6);const t8=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function fE(e){const{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:s}=he(t8,Ie),i=Y6(e.onlyRenderVisibleElements),o=Q6();return a.jsx("div",{className:"react-flow__nodes",style:xd,children:i.map(l=>a.jsx(e8,{id:l,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:o,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:s},l))})}fE.displayName="NodeRenderer";const n8=b.memo(fE);function r8(e){return he(b.useCallback(n=>{if(!e)return n.edges.map(s=>s.id);const r=[];if(n.width&&n.height)for(const s of n.edges){const i=n.nodeLookup.get(s.source),o=n.nodeLookup.get(s.target);i&&o&&K5({sourceNode:i,targetNode:o,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[e]),Ie)}const s8=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return a.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},i8=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return a.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Ax={[wu.Arrow]:s8,[wu.ArrowClosed]:i8};function o8(e){const t=Ne();return b.useMemo(()=>{var s,i;return Object.prototype.hasOwnProperty.call(Ax,e)?Ax[e]:((i=(s=t.getState()).onError)==null||i.call(s,"009",pn.error009(e)),null)},[e])}const a8=({id:e,type:t,color:n,width:r=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:o,orient:l="auto-start-reverse"})=>{const c=o8(t);return c?a.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:l,refX:"0",refY:"0",children:a.jsx(c,{color:n,strokeWidth:o})}):null},hE=({defaultColor:e,rfId:t})=>{const n=he(i=>i.edges),r=he(i=>i.defaultEdgeOptions),s=b.useMemo(()=>eB(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return s.length?a.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:a.jsx("defs",{children:s.map(i=>a.jsx(a8,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};hE.displayName="MarkerDefinitions";var l8=b.memo(hE);function pE({x:e,y:t,label:n,labelStyle:r,labelShowBg:s=!0,labelBgStyle:i,labelBgPadding:o=[2,4],labelBgBorderRadius:l=2,children:c,className:u,...d}){const[f,h]=b.useState({x:1,y:0,width:0,height:0}),p=Fe(["react-flow__edge-textwrapper",u]),v=b.useRef(null);return b.useEffect(()=>{if(v.current){const x=v.current.getBBox();h({x:x.x,y:x.y,width:x.width,height:x.height})}},[n]),n?a.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:p,visibility:f.width?"visible":"hidden",...d,children:[s&&a.jsx("rect",{width:f.width+2*o[0],x:-o[0],y:-o[1],height:f.height+2*o[1],className:"react-flow__edge-textbg",style:i,rx:l,ry:l}),a.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:v,style:r,children:n}),c]}):null}pE.displayName="EdgeText";const c8=b.memo(pE);function wd({path:e,labelX:t,labelY:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:o,labelBgPadding:l,labelBgBorderRadius:c,interactionWidth:u=20,...d}){return a.jsxs(a.Fragment,{children:[a.jsx("path",{...d,d:e,fill:"none",className:Fe(["react-flow__edge-path",d.className])}),u?a.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,r&&on(t)&&on(n)?a.jsx(c8,{x:t,y:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:o,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function Tx({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===re.Left||e===re.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function mE({sourceX:e,sourceY:t,sourcePosition:n=re.Bottom,targetX:r,targetY:s,targetPosition:i=re.Top}){const[o,l]=Tx({pos:n,x1:e,y1:t,x2:r,y2:s}),[c,u]=Tx({pos:i,x1:r,y1:s,x2:e,y2:t}),[d,f,h,p]=ON({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:o,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${o},${l} ${c},${u} ${r},${s}`,d,f,h,p]}function gE(e){return b.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:o,targetPosition:l,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:v,markerEnd:x,markerStart:w,interactionWidth:g})=>{const[y,m,_]=mE({sourceX:n,sourceY:r,sourcePosition:o,targetX:s,targetY:i,targetPosition:l}),j=e.isInternal?void 0:t;return a.jsx(wd,{id:j,path:y,labelX:m,labelY:_,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:v,markerEnd:x,markerStart:w,interactionWidth:g})})}const u8=gE({isInternal:!1}),vE=gE({isInternal:!0});u8.displayName="SimpleBezierEdge";vE.displayName="SimpleBezierEdgeInternal";function yE(e){return b.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,sourcePosition:p=re.Bottom,targetPosition:v=re.Top,markerEnd:x,markerStart:w,pathOptions:g,interactionWidth:y})=>{const[m,_,j]=Vp({sourceX:n,sourceY:r,sourcePosition:p,targetX:s,targetY:i,targetPosition:v,borderRadius:g==null?void 0:g.borderRadius,offset:g==null?void 0:g.offset,stepPosition:g==null?void 0:g.stepPosition}),N=e.isInternal?void 0:t;return a.jsx(wd,{id:N,path:m,labelX:_,labelY:j,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:x,markerStart:w,interactionWidth:y})})}const _E=yE({isInternal:!1}),xE=yE({isInternal:!0});_E.displayName="SmoothStepEdge";xE.displayName="SmoothStepEdgeInternal";function wE(e){return b.memo(({id:t,...n})=>{var s;const r=e.isInternal?void 0:t;return a.jsx(_E,{...n,id:r,pathOptions:b.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(s=n.pathOptions)==null?void 0:s.offset])})})}const d8=wE({isInternal:!1}),bE=wE({isInternal:!0});d8.displayName="StepEdge";bE.displayName="StepEdgeInternal";function jE(e){return b.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:v,interactionWidth:x})=>{const[w,g,y]=DN({sourceX:n,sourceY:r,targetX:s,targetY:i}),m=e.isInternal?void 0:t;return a.jsx(wd,{id:m,path:w,labelX:g,labelY:y,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:v,interactionWidth:x})})}const f8=jE({isInternal:!1}),SE=jE({isInternal:!0});f8.displayName="StraightEdge";SE.displayName="StraightEdgeInternal";function kE(e){return b.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:o=re.Bottom,targetPosition:l=re.Top,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:v,markerEnd:x,markerStart:w,pathOptions:g,interactionWidth:y})=>{const[m,_,j]=$N({sourceX:n,sourceY:r,sourcePosition:o,targetX:s,targetY:i,targetPosition:l,curvature:g==null?void 0:g.curvature}),N=e.isInternal?void 0:t;return a.jsx(wd,{id:N,path:m,labelX:_,labelY:j,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:v,markerEnd:x,markerStart:w,interactionWidth:y})})}const h8=kE({isInternal:!1}),NE=kE({isInternal:!0});h8.displayName="BezierEdge";NE.displayName="BezierEdgeInternal";const Px={default:NE,straight:SE,step:bE,smoothstep:xE,simplebezier:vE},Mx={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},p8=(e,t,n)=>n===re.Left?e-t:n===re.Right?e+t:e,m8=(e,t,n)=>n===re.Top?e-t:n===re.Bottom?e+t:e,Ix="react-flow__edgeupdater";function Rx({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:i,onMouseOut:o,type:l}){return a.jsx("circle",{onMouseDown:s,onMouseEnter:i,onMouseOut:o,className:Fe([Ix,`${Ix}-${l}`]),cx:p8(t,r,e),cy:m8(n,r,e),r,stroke:"transparent",fill:"transparent"})}function g8({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:s,targetX:i,targetY:o,sourcePosition:l,targetPosition:c,onReconnect:u,onReconnectStart:d,onReconnectEnd:f,setReconnecting:h,setUpdateHover:p}){const v=Ne(),x=(_,j)=>{if(_.button!==0)return;const{autoPanOnConnect:N,domNode:k,connectionMode:S,connectionRadius:P,lib:$,onConnectStart:D,cancelConnection:I,nodeLookup:O,rfId:E,panBy:A,updateConnection:C}=v.getState(),M=j.type==="target",T=(L,F)=>{h(!1),f==null||f(L,n,j.type,F)},R=L=>u==null?void 0:u(n,L),B=(L,F)=>{h(!0),d==null||d(_,n,j.type),D==null||D(L,F)};Hp.onPointerDown(_.nativeEvent,{autoPanOnConnect:N,connectionMode:S,connectionRadius:P,domNode:k,handleId:j.id,nodeId:j.nodeId,nodeLookup:O,isTarget:M,edgeUpdaterType:j.type,lib:$,flowId:E,cancelConnection:I,panBy:A,isValidConnection:(...L)=>{var F,W;return((W=(F=v.getState()).isValidConnection)==null?void 0:W.call(F,...L))??!0},onConnect:R,onConnectStart:B,onConnectEnd:(...L)=>{var F,W;return(W=(F=v.getState()).onConnectEnd)==null?void 0:W.call(F,...L)},onReconnectEnd:T,updateConnection:C,getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,dragThreshold:v.getState().connectionDragThreshold,handleDomNode:_.currentTarget})},w=_=>x(_,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),g=_=>x(_,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),y=()=>p(!0),m=()=>p(!1);return a.jsxs(a.Fragment,{children:[(e===!0||e==="source")&&a.jsx(Rx,{position:l,centerX:r,centerY:s,radius:t,onMouseDown:w,onMouseEnter:y,onMouseOut:m,type:"source"}),(e===!0||e==="target")&&a.jsx(Rx,{position:c,centerX:i,centerY:o,radius:t,onMouseDown:g,onMouseEnter:y,onMouseOut:m,type:"target"})]})}function v8({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:s,onDoubleClick:i,onContextMenu:o,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,rfId:v,edgeTypes:x,noPanClassName:w,onError:g,disableKeyboardA11y:y}){let m=he(ee=>ee.edgeLookup.get(e));const _=he(ee=>ee.defaultEdgeOptions);m=_?{..._,...m}:m;let j=m.type||"default",N=(x==null?void 0:x[j])||Px[j];N===void 0&&(g==null||g("011",pn.error011(j)),j="default",N=(x==null?void 0:x.default)||Px.default);const k=!!(m.focusable||t&&typeof m.focusable>"u"),S=typeof f<"u"&&(m.reconnectable||n&&typeof m.reconnectable>"u"),P=!!(m.selectable||r&&typeof m.selectable>"u"),$=b.useRef(null),[D,I]=b.useState(!1),[O,E]=b.useState(!1),A=Ne(),{zIndex:C=m.zIndex,sourceX:M,sourceY:T,targetX:R,targetY:B,sourcePosition:L,targetPosition:F}=he(b.useCallback(ee=>{const X=ee.nodeLookup.get(m.source),ae=ee.nodeLookup.get(m.target);if(!X||!ae)return Mx;const pe=J5({id:e,sourceNode:X,targetNode:ae,sourceHandle:m.sourceHandle||null,targetHandle:m.targetHandle||null,connectionMode:ee.connectionMode,onError:g}),ge=W5({selected:m.selected,zIndex:m.zIndex,sourceNode:X,targetNode:ae,elevateOnSelect:ee.elevateEdgesOnSelect,zIndexMode:ee.zIndexMode});return{...pe||Mx,zIndex:ge}},[m.source,m.target,m.sourceHandle,m.targetHandle,m.selected,m.zIndex]),Ie),W=b.useMemo(()=>m.markerStart?`url('#${Fp(m.markerStart,v)}')`:void 0,[m.markerStart,v]),U=b.useMemo(()=>m.markerEnd?`url('#${Fp(m.markerEnd,v)}')`:void 0,[m.markerEnd,v]);if(m.hidden||M===null||T===null||R===null||B===null)return null;const K=ee=>{var ge;const{addSelectedEdges:X,unselectNodesAndEdges:ae,multiSelectionActive:pe}=A.getState();P&&(A.setState({nodesSelectionActive:!1}),m.selected&&pe?(ae({nodes:[],edges:[m]}),(ge=$.current)==null||ge.blur()):X([e])),s&&s(ee,m)},Q=i?ee=>{i(ee,{...m})}:void 0,J=o?ee=>{o(ee,{...m})}:void 0,H=l?ee=>{l(ee,{...m})}:void 0,q=c?ee=>{c(ee,{...m})}:void 0,ne=u?ee=>{u(ee,{...m})}:void 0,te=ee=>{var X;if(!y&&xN.includes(ee.key)&&P){const{unselectNodesAndEdges:ae,addSelectedEdges:pe}=A.getState();ee.key==="Escape"?((X=$.current)==null||X.blur(),ae({edges:[m]})):pe([e])}};return a.jsx("svg",{style:{zIndex:C},children:a.jsxs("g",{className:Fe(["react-flow__edge",`react-flow__edge-${j}`,m.className,w,{selected:m.selected,animated:m.animated,inactive:!P&&!s,updating:D,selectable:P}]),onClick:K,onDoubleClick:Q,onContextMenu:J,onMouseEnter:H,onMouseMove:q,onMouseLeave:ne,onKeyDown:k?te:void 0,tabIndex:k?0:void 0,role:m.ariaRole??(k?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":m.ariaLabel===null?void 0:m.ariaLabel||`Edge from ${m.source} to ${m.target}`,"aria-describedby":k?`${tE}-${v}`:void 0,ref:$,...m.domAttributes,children:[!O&&a.jsx(N,{id:e,source:m.source,target:m.target,type:m.type,selected:m.selected,animated:m.animated,selectable:P,deletable:m.deletable??!0,label:m.label,labelStyle:m.labelStyle,labelShowBg:m.labelShowBg,labelBgStyle:m.labelBgStyle,labelBgPadding:m.labelBgPadding,labelBgBorderRadius:m.labelBgBorderRadius,sourceX:M,sourceY:T,targetX:R,targetY:B,sourcePosition:L,targetPosition:F,data:m.data,style:m.style,sourceHandleId:m.sourceHandle,targetHandleId:m.targetHandle,markerStart:W,markerEnd:U,pathOptions:"pathOptions"in m?m.pathOptions:void 0,interactionWidth:m.interactionWidth}),S&&a.jsx(g8,{edge:m,isReconnectable:S,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,sourceX:M,sourceY:T,targetX:R,targetY:B,sourcePosition:L,targetPosition:F,setUpdateHover:I,setReconnecting:E})]})})}var y8=b.memo(v8);const _8=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function EE({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:s,onReconnect:i,onEdgeContextMenu:o,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:d,reconnectRadius:f,onEdgeDoubleClick:h,onReconnectStart:p,onReconnectEnd:v,disableKeyboardA11y:x}){const{edgesFocusable:w,edgesReconnectable:g,elementsSelectable:y,onError:m}=he(_8,Ie),_=r8(t);return a.jsxs("div",{className:"react-flow__edges",children:[a.jsx(l8,{defaultColor:e,rfId:n}),_.map(j=>a.jsx(y8,{id:j,edgesFocusable:w,edgesReconnectable:g,elementsSelectable:y,noPanClassName:s,onReconnect:i,onContextMenu:o,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,onClick:d,reconnectRadius:f,onDoubleClick:h,onReconnectStart:p,onReconnectEnd:v,rfId:n,onError:m,edgeTypes:r,disableKeyboardA11y:x},j))]})}EE.displayName="EdgeRenderer";const x8=b.memo(EE),Ox=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function w8({children:e}){const t=Ne(),n=b.useRef(null),[r]=b.useState(()=>t.getState().transform);return iE(()=>{let s=null;const i=()=>{const o=t.getState().transform;s&&o[0]===s[0]&&o[1]===s[1]&&o[2]===s[2]||(s=o,n.current&&(n.current.style.transform=Ox(o)))};return i(),t.subscribe(i)},[t]),a.jsx("div",{ref:n,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:Ox(r)},children:e})}function b8(e){const t=hv(),n=b.useRef(!1);b.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const j8=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function S8(e){const t=he(j8),n=Ne();return b.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function k8(e){return e.connection.inProgress?{...e.connection,to:sl(e.connection.to,e.transform)}:{...e.connection}}function N8(e){return k8}function E8(e){const t=N8();return he(t,Ie)}const C8=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function A8({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:s,width:i,height:o,isValid:l,inProgress:c}=he(C8,Ie);return!(i&&s&&c)?null:a.jsx("svg",{style:e,width:i,height:o,className:"react-flow__connectionline react-flow__container",children:a.jsx("g",{className:Fe(["react-flow__connection",jN(l)]),children:a.jsx(CE,{style:t,type:n,CustomComponent:r,isValid:l})})})}const CE=({style:e,type:t=Nr.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:s,from:i,fromNode:o,fromHandle:l,fromPosition:c,to:u,toNode:d,toHandle:f,toPosition:h,pointer:p}=E8();if(!s)return;if(n)return a.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:l,fromX:i.x,fromY:i.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:h,connectionStatus:jN(r),toNode:d,toHandle:f,pointer:p});let v="";const x={sourceX:i.x,sourceY:i.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:h};switch(t){case Nr.Bezier:[v]=$N(x);break;case Nr.SimpleBezier:[v]=mE(x);break;case Nr.Step:[v]=Vp({...x,borderRadius:0});break;case Nr.SmoothStep:[v]=Vp(x);break;default:[v]=DN(x)}return a.jsx("path",{d:v,fill:"none",className:"react-flow__connection-path",style:e})};CE.displayName="ConnectionLine";const T8={};function $x(e=T8){b.useRef(e),Ne(),b.useEffect(()=>{},[e])}function P8(){Ne(),b.useRef(!1),b.useEffect(()=>{},[])}function AE({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:i,onEdgeDoubleClick:o,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,onSelectionContextMenu:f,onSelectionStart:h,onSelectionEnd:p,connectionLineType:v,connectionLineStyle:x,connectionLineComponent:w,connectionLineContainerStyle:g,selectionKeyCode:y,selectionOnDrag:m,selectionMode:_,multiSelectionKeyCode:j,panActivationKeyCode:N,zoomActivationKeyCode:k,deleteKeyCode:S,onlyRenderVisibleElements:P,elementsSelectable:$,defaultViewport:D,translateExtent:I,minZoom:O,maxZoom:E,preventScrolling:A,defaultMarkerColor:C,zoomOnScroll:M,zoomOnPinch:T,panOnScroll:R,panOnScrollSpeed:B,panOnScrollMode:L,zoomOnDoubleClick:F,panOnDrag:W,autoPanOnSelection:U,onPaneClick:K,onPaneMouseEnter:Q,onPaneMouseMove:J,onPaneMouseLeave:H,onPaneScroll:q,onPaneContextMenu:ne,paneClickDistance:te,nodeClickDistance:ee,onEdgeContextMenu:X,onEdgeMouseEnter:ae,onEdgeMouseMove:pe,onEdgeMouseLeave:ge,reconnectRadius:Re,onReconnect:Rt,onReconnectStart:vn,onReconnectEnd:yn,noDragClassName:Dn,noWheelClassName:oo,noPanClassName:Xr,disableKeyboardA11y:Qr,nodeExtent:Xt,rfId:zn,viewport:Vn,onViewportChange:Zr,nodesDraggable:jd}){return $x(e),$x(t),P8(),b8(n),S8(Vn),a.jsx(G6,{onPaneClick:K,onPaneMouseEnter:Q,onPaneMouseMove:J,onPaneMouseLeave:H,onPaneContextMenu:ne,onPaneScroll:q,paneClickDistance:te,deleteKeyCode:S,selectionKeyCode:y,selectionOnDrag:m,selectionMode:_,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:j,panActivationKeyCode:N,zoomActivationKeyCode:k,elementsSelectable:$,zoomOnScroll:M,zoomOnPinch:T,zoomOnDoubleClick:F,panOnScroll:R,panOnScrollSpeed:B,panOnScrollMode:L,panOnDrag:W,autoPanOnSelection:U,defaultViewport:D,translateExtent:I,minZoom:O,maxZoom:E,onSelectionContextMenu:f,preventScrolling:A,noDragClassName:Dn,noWheelClassName:oo,noPanClassName:Xr,disableKeyboardA11y:Qr,onViewportChange:Zr,isControlledViewport:!!Vn,children:a.jsxs(w8,{children:[a.jsx(x8,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:o,onReconnect:Rt,onReconnectStart:vn,onReconnectEnd:yn,onlyRenderVisibleElements:P,onEdgeContextMenu:X,onEdgeMouseEnter:ae,onEdgeMouseMove:pe,onEdgeMouseLeave:ge,reconnectRadius:Re,defaultMarkerColor:C,noPanClassName:Xr,disableKeyboardA11y:Qr,rfId:zn}),a.jsx(A8,{style:x,type:v,component:w,containerStyle:g}),a.jsx("div",{className:"react-flow__edgelabel-renderer"}),a.jsx(n8,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:ee,onlyRenderVisibleElements:P,noPanClassName:Xr,noDragClassName:Dn,disableKeyboardA11y:Qr,nodeExtent:Xt,rfId:zn,nodesDraggable:jd}),a.jsx("div",{className:"react-flow__viewport-portal"})]})})}AE.displayName="GraphView";const M8=b.memo(AE),I8=AN(),Lx=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:o,fitViewOptions:l,minZoom:c=.5,maxZoom:u=2,nodeOrigin:d,nodeExtent:f,zIndexMode:h="basic"}={})=>{const p=new Map,v=new Map,x=new Map,w=new Map,g=r??t??[],y=n??e??[],m=d??[0,0],_=f??Pa;FN(x,w,g);const{nodesInitialized:j}=Bp(y,p,v,{nodeOrigin:m,nodeExtent:_,zIndexMode:h});let N=[0,0,1];if(o&&s&&i){const k=nl(p,{filter:D=>!!((D.width||D.initialWidth)&&(D.height||D.initialHeight))}),{x:S,y:P,zoom:$}=ov(k,s,i,c,u,(l==null?void 0:l.padding)??.1);N=[S,P,$]}return{rfId:"1",width:s??0,height:i??0,transform:N,nodes:y,nodesInitialized:j,nodeLookup:p,parentLookup:v,edges:g,edgeLookup:w,connectionLookup:x,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:Pa,nodeExtent:_,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Ui.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:m,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:l,fitViewResolver:null,connection:{...bN},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:I8,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:wN,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},R8=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:o,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h})=>KB((p,v)=>{async function x(){const{nodeLookup:w,panZoom:g,fitViewOptions:y,fitViewResolver:m,width:_,height:j,minZoom:N,maxZoom:k}=v();g&&(await D5({nodes:w,width:_,height:j,panZoom:g,minZoom:N,maxZoom:k},y),m==null||m.resolve(!0),p({fitViewResolver:null}))}return{...Lx({nodes:e,edges:t,width:s,height:i,fitView:o,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,defaultNodes:n,defaultEdges:r,zIndexMode:h}),setNodes:w=>{const{nodeLookup:g,parentLookup:y,nodeOrigin:m,elevateNodesOnSelect:_,fitViewQueued:j,zIndexMode:N,nodesSelectionActive:k}=v(),{nodesInitialized:S,hasSelectedNodes:P}=Bp(w,g,y,{nodeOrigin:m,nodeExtent:f,elevateNodesOnSelect:_,checkEquality:!0,zIndexMode:N}),$=k&&P;j&&S?(x(),p({nodes:w,nodesInitialized:S,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:$})):p({nodes:w,nodesInitialized:S,nodesSelectionActive:$})},setEdges:w=>{const{connectionLookup:g,edgeLookup:y}=v();FN(g,y,w),p({edges:w})},setDefaultNodesAndEdges:(w,g)=>{if(w){const{setNodes:y}=v();y(w),p({hasDefaultNodes:!0})}if(g){const{setEdges:y}=v();y(g),p({hasDefaultEdges:!0})}},updateNodeInternals:w=>{const{triggerNodeChanges:g,nodeLookup:y,parentLookup:m,domNode:_,nodeOrigin:j,nodeExtent:N,debug:k,fitViewQueued:S,zIndexMode:P}=v(),{changes:$,updatedInternals:D}=aB(w,y,m,_,j,N,P);D&&(rB(y,m,{nodeOrigin:j,nodeExtent:N,zIndexMode:P}),S?(x(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),($==null?void 0:$.length)>0&&(k&&console.log("React Flow: trigger node changes",$),g==null||g($)))},updateNodePositions:(w,g=!1)=>{const y=[];let m=[];const{nodeLookup:_,triggerNodeChanges:j,connection:N,updateConnection:k,onNodesChangeMiddlewareMap:S}=v();for(const[P,$]of w){const D=_.get(P),I=!!(D!=null&&D.expandParent&&(D!=null&&D.parentId)&&($!=null&&$.position)),O={id:P,type:"position",position:I?{x:Math.max(0,$.position.x),y:Math.max(0,$.position.y)}:$.position,dragging:g};if(D&&N.inProgress&&N.fromNode.id===D.id){const E=Rs(D,N.fromHandle,re.Left,!0);k({...N,from:E})}I&&D.parentId&&y.push({id:P,parentId:D.parentId,rect:{...$.internals.positionAbsolute,width:$.measured.width??0,height:$.measured.height??0}}),m.push(O)}if(y.length>0){const{parentLookup:P,nodeOrigin:$}=v(),D=fv(y,_,P,$);m.push(...D)}for(const P of S.values())m=P(m);j(m)},triggerNodeChanges:w=>{const{onNodesChange:g,setNodes:y,nodes:m,hasDefaultNodes:_,debug:j}=v();if(w!=null&&w.length){if(_){const N=h6(w,m);y(N)}j&&console.log("React Flow: trigger node changes",w),g==null||g(w)}},triggerEdgeChanges:w=>{const{onEdgesChange:g,setEdges:y,edges:m,hasDefaultEdges:_,debug:j}=v();if(w!=null&&w.length){if(_){const N=p6(w,m);y(N)}j&&console.log("React Flow: trigger edge changes",w),g==null||g(w)}},addSelectedNodes:w=>{const{multiSelectionActive:g,edgeLookup:y,nodeLookup:m,triggerNodeChanges:_,triggerEdgeChanges:j}=v();if(g){const N=w.map(k=>os(k,!0));_(N);return}_(vi(m,new Set([...w]),!0)),j(vi(y))},addSelectedEdges:w=>{const{multiSelectionActive:g,edgeLookup:y,nodeLookup:m,triggerNodeChanges:_,triggerEdgeChanges:j}=v();if(g){const N=w.map(k=>os(k,!0));j(N);return}j(vi(y,new Set([...w]))),_(vi(m,new Set,!0))},unselectNodesAndEdges:({nodes:w,edges:g}={})=>{const{edges:y,nodes:m,nodeLookup:_,triggerNodeChanges:j,triggerEdgeChanges:N}=v(),k=w||m,S=g||y,P=[];for(const D of k){if(!D.selected)continue;const I=_.get(D.id);I&&(I.selected=!1),P.push(os(D.id,!1))}const $=[];for(const D of S)D.selected&&$.push(os(D.id,!1));j(P),N($)},setMinZoom:w=>{const{panZoom:g,maxZoom:y}=v();g==null||g.setScaleExtent([w,y]),p({minZoom:w})},setMaxZoom:w=>{const{panZoom:g,minZoom:y}=v();g==null||g.setScaleExtent([y,w]),p({maxZoom:w})},setTranslateExtent:w=>{var g;(g=v().panZoom)==null||g.setTranslateExtent(w),p({translateExtent:w})},resetSelectedElements:()=>{const{edges:w,nodes:g,triggerNodeChanges:y,triggerEdgeChanges:m,elementsSelectable:_}=v();if(!_)return;const j=g.reduce((k,S)=>S.selected?[...k,os(S.id,!1)]:k,[]),N=w.reduce((k,S)=>S.selected?[...k,os(S.id,!1)]:k,[]);y(j),m(N)},setNodeExtent:w=>{const{nodes:g,nodeLookup:y,parentLookup:m,nodeOrigin:_,elevateNodesOnSelect:j,nodeExtent:N,zIndexMode:k}=v();w[0][0]===N[0][0]&&w[0][1]===N[0][1]&&w[1][0]===N[1][0]&&w[1][1]===N[1][1]||(Bp(g,y,m,{nodeOrigin:_,nodeExtent:w,elevateNodesOnSelect:j,checkEquality:!1,zIndexMode:k}),p({nodeExtent:w}))},panBy:w=>{const{transform:g,width:y,height:m,panZoom:_,translateExtent:j}=v();return lB({delta:w,panZoom:_,transform:g,translateExtent:j,width:y,height:m})},setCenter:async(w,g,y)=>{const{width:m,height:_,maxZoom:j,panZoom:N}=v();if(!N)return!1;const k=typeof(y==null?void 0:y.zoom)<"u"?y.zoom:j;return await N.setViewport({x:m/2-w*k,y:_/2-g*k,zoom:k},{duration:y==null?void 0:y.duration,ease:y==null?void 0:y.ease,interpolate:y==null?void 0:y.interpolate}),!0},cancelConnection:()=>{p({connection:{...bN}})},updateConnection:w=>{p({connection:w})},reset:()=>p({...Lx()})}},Object.is);function O8({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:i,initialMinZoom:o,initialMaxZoom:l,initialFitViewOptions:c,fitView:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h,children:p}){const[v]=b.useState(()=>R8({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:u,minZoom:o,maxZoom:l,fitViewOptions:c,nodeOrigin:d,nodeExtent:f,zIndexMode:h}));return a.jsx(GB,{value:v,children:a.jsx(_6,{children:a.jsx(R6,{children:p})})})}function $8({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:s,width:i,height:o,fitView:l,fitViewOptions:c,minZoom:u,maxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p}){return b.useContext(yd)?a.jsx(a.Fragment,{children:e}):a.jsx(O8,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:s,initialWidth:i,initialHeight:o,fitView:l,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p,children:e})}const L8={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function D8({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i,edgeTypes:o,onNodeClick:l,onEdgeClick:c,onInit:u,onMove:d,onMoveStart:f,onMoveEnd:h,onConnect:p,onConnectStart:v,onConnectEnd:x,onClickConnectStart:w,onClickConnectEnd:g,onNodeMouseEnter:y,onNodeMouseMove:m,onNodeMouseLeave:_,onNodeContextMenu:j,onNodeDoubleClick:N,onNodeDragStart:k,onNodeDrag:S,onNodeDragStop:P,onNodesDelete:$,onEdgesDelete:D,onDelete:I,onSelectionChange:O,onSelectionDragStart:E,onSelectionDrag:A,onSelectionDragStop:C,onSelectionContextMenu:M,onSelectionStart:T,onSelectionEnd:R,onBeforeDelete:B,connectionMode:L,connectionLineType:F=Nr.Bezier,connectionLineStyle:W,connectionLineComponent:U,connectionLineContainerStyle:K,deleteKeyCode:Q="Backspace",selectionKeyCode:J="Shift",selectionOnDrag:H=!1,selectionMode:q=Ma.Full,panActivationKeyCode:ne="Space",multiSelectionKeyCode:te=Ra()?"Meta":"Control",zoomActivationKeyCode:ee=Ra()?"Meta":"Control",snapToGrid:X,snapGrid:ae,onlyRenderVisibleElements:pe=!1,selectNodesOnDrag:ge,nodesDraggable:Re,autoPanOnNodeFocus:Rt,nodesConnectable:vn,nodesFocusable:yn,nodeOrigin:Dn=nE,edgesFocusable:oo,edgesReconnectable:Xr,elementsSelectable:Qr=!0,defaultViewport:Xt=o6,minZoom:zn=.5,maxZoom:Vn=2,translateExtent:Zr=Pa,preventScrolling:jd=!0,nodeExtent:Sd,defaultMarkerColor:tC="#b1b1b7",zoomOnScroll:nC=!0,zoomOnPinch:rC=!0,panOnScroll:sC=!1,panOnScrollSpeed:iC=.5,panOnScrollMode:oC=_s.Free,zoomOnDoubleClick:aC=!0,panOnDrag:lC=!0,onPaneClick:cC,onPaneMouseEnter:uC,onPaneMouseMove:dC,onPaneMouseLeave:fC,onPaneScroll:hC,onPaneContextMenu:pC,paneClickDistance:mC=1,nodeClickDistance:gC=0,children:vC,onReconnect:yC,onReconnectStart:_C,onReconnectEnd:xC,onEdgeContextMenu:wC,onEdgeDoubleClick:bC,onEdgeMouseEnter:jC,onEdgeMouseMove:SC,onEdgeMouseLeave:kC,reconnectRadius:NC=10,onNodesChange:EC,onEdgesChange:CC,noDragClassName:AC="nodrag",noWheelClassName:TC="nowheel",noPanClassName:vv="nopan",fitView:yv,fitViewOptions:_v,connectOnClick:PC,attributionPosition:MC,proOptions:IC,defaultEdgeOptions:RC,elevateNodesOnSelect:OC=!0,elevateEdgesOnSelect:$C=!1,disableKeyboardA11y:xv=!1,autoPanOnConnect:LC,autoPanOnNodeDrag:DC,autoPanOnSelection:zC=!0,autoPanSpeed:VC,connectionRadius:FC,isValidConnection:BC,onError:HC,style:UC,id:wv,nodeDragThreshold:WC,connectionDragThreshold:KC,viewport:GC,onViewportChange:qC,width:YC,height:XC,colorMode:QC="light",debug:ZC,onScroll:ol,ariaLabelConfig:JC,zIndexMode:bv="basic",...eA},tA){const kd=wv||"1",nA=u6(QC),rA=b.useCallback(jv=>{jv.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),ol==null||ol(jv)},[ol]);return a.jsx("div",{"data-testid":"rf__wrapper",...eA,onScroll:rA,style:{...UC,...L8},ref:tA,className:Fe(["react-flow",s,nA]),id:wv,role:"application",children:a.jsxs($8,{nodes:e,edges:t,width:YC,height:XC,fitView:yv,fitViewOptions:_v,minZoom:zn,maxZoom:Vn,nodeOrigin:Dn,nodeExtent:Sd,zIndexMode:bv,children:[a.jsx(c6,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:v,onConnectEnd:x,onClickConnectStart:w,onClickConnectEnd:g,nodesDraggable:Re,autoPanOnNodeFocus:Rt,nodesConnectable:vn,nodesFocusable:yn,edgesFocusable:oo,edgesReconnectable:Xr,elementsSelectable:Qr,elevateNodesOnSelect:OC,elevateEdgesOnSelect:$C,minZoom:zn,maxZoom:Vn,nodeExtent:Sd,onNodesChange:EC,onEdgesChange:CC,snapToGrid:X,snapGrid:ae,connectionMode:L,translateExtent:Zr,connectOnClick:PC,defaultEdgeOptions:RC,fitView:yv,fitViewOptions:_v,onNodesDelete:$,onEdgesDelete:D,onDelete:I,onNodeDragStart:k,onNodeDrag:S,onNodeDragStop:P,onSelectionDrag:A,onSelectionDragStart:E,onSelectionDragStop:C,onMove:d,onMoveStart:f,onMoveEnd:h,noPanClassName:vv,nodeOrigin:Dn,rfId:kd,autoPanOnConnect:LC,autoPanOnNodeDrag:DC,autoPanSpeed:VC,onError:HC,connectionRadius:FC,isValidConnection:BC,selectNodesOnDrag:ge,nodeDragThreshold:WC,connectionDragThreshold:KC,onBeforeDelete:B,debug:ZC,ariaLabelConfig:JC,zIndexMode:bv}),a.jsx(M8,{onInit:u,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:y,onNodeMouseMove:m,onNodeMouseLeave:_,onNodeContextMenu:j,onNodeDoubleClick:N,nodeTypes:i,edgeTypes:o,connectionLineType:F,connectionLineStyle:W,connectionLineComponent:U,connectionLineContainerStyle:K,selectionKeyCode:J,selectionOnDrag:H,selectionMode:q,deleteKeyCode:Q,multiSelectionKeyCode:te,panActivationKeyCode:ne,zoomActivationKeyCode:ee,onlyRenderVisibleElements:pe,defaultViewport:Xt,translateExtent:Zr,minZoom:zn,maxZoom:Vn,preventScrolling:jd,zoomOnScroll:nC,zoomOnPinch:rC,zoomOnDoubleClick:aC,panOnScroll:sC,panOnScrollSpeed:iC,panOnScrollMode:oC,panOnDrag:lC,autoPanOnSelection:zC,onPaneClick:cC,onPaneMouseEnter:uC,onPaneMouseMove:dC,onPaneMouseLeave:fC,onPaneScroll:hC,onPaneContextMenu:pC,paneClickDistance:mC,nodeClickDistance:gC,onSelectionContextMenu:M,onSelectionStart:T,onSelectionEnd:R,onReconnect:yC,onReconnectStart:_C,onReconnectEnd:xC,onEdgeContextMenu:wC,onEdgeDoubleClick:bC,onEdgeMouseEnter:jC,onEdgeMouseMove:SC,onEdgeMouseLeave:kC,reconnectRadius:NC,defaultMarkerColor:tC,noDragClassName:AC,noWheelClassName:TC,noPanClassName:vv,rfId:kd,disableKeyboardA11y:xv,nodeExtent:Sd,viewport:GC,onViewportChange:qC,nodesDraggable:Re}),a.jsx(i6,{onSelectionChange:O}),vC,a.jsx(e6,{proOptions:IC,position:MC}),a.jsx(JB,{rfId:kd,disableKeyboardA11y:xv})]})})}var z8=sE(D8);function V8({dimensions:e,lineWidth:t,variant:n,className:r}){return a.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Fe(["react-flow__background-pattern",n,r])})}function F8({radius:e,className:t}){return a.jsx("circle",{cx:e,cy:e,r:e,className:Fe(["react-flow__background-pattern","dots",t])})}var sr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(sr||(sr={}));const B8={[sr.Dots]:1,[sr.Lines]:1,[sr.Cross]:6},H8=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function TE({id:e,variant:t=sr.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=0,color:o,bgColor:l,style:c,className:u,patternClassName:d}){const f=b.useRef(null),{transform:h,patternId:p}=he(H8,Ie),v=r||B8[t],x=t===sr.Dots,w=t===sr.Cross,g=Array.isArray(n)?n:[n,n],y=[g[0]*h[2]||1,g[1]*h[2]||1],m=v*h[2],_=Array.isArray(i)?i:[i,i],j=w?[m,m]:y,N=[_[0]*h[2]||1+j[0]/2,_[1]*h[2]||1+j[1]/2],k=`${p}${e||""}`;return a.jsxs("svg",{className:Fe(["react-flow__background",u]),style:{...c,...xd,"--xy-background-color-props":l,"--xy-background-pattern-color-props":o},ref:f,"data-testid":"rf__background",children:[a.jsx("pattern",{id:k,x:h[0]%y[0],y:h[1]%y[1],width:y[0],height:y[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${N[0]},-${N[1]})`,children:x?a.jsx(F8,{radius:m/2,className:d}):a.jsx(V8,{dimensions:j,lineWidth:s,variant:t,className:d})}),a.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${k})`})]})}TE.displayName="Background";const U8=b.memo(TE);function W8(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:a.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function K8(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:a.jsx("path",{d:"M0 0h32v4.2H0z"})})}function G8(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:a.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function q8(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:a.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function Y8(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:a.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function Bl({children:e,className:t,...n}){return a.jsx("button",{type:"button",className:Fe(["react-flow__controls-button",t]),...n,children:e})}const X8=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function PE({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:o,onFitView:l,onInteractiveChange:c,className:u,children:d,position:f="bottom-left",orientation:h="vertical","aria-label":p}){const v=Ne(),{isInteractive:x,minZoomReached:w,maxZoomReached:g,ariaLabelConfig:y}=he(X8,Ie),{zoomIn:m,zoomOut:_,fitView:j}=hv(),N=()=>{m(),i==null||i()},k=()=>{_(),o==null||o()},S=()=>{j(s),l==null||l()},P=()=>{v.setState({nodesDraggable:!x,nodesConnectable:!x,elementsSelectable:!x}),c==null||c(!x)},$=h==="horizontal"?"horizontal":"vertical";return a.jsxs(_d,{className:Fe(["react-flow__controls",$,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":p??y["controls.ariaLabel"],children:[t&&a.jsxs(a.Fragment,{children:[a.jsx(Bl,{onClick:N,className:"react-flow__controls-zoomin",title:y["controls.zoomIn.ariaLabel"],"aria-label":y["controls.zoomIn.ariaLabel"],disabled:g,children:a.jsx(W8,{})}),a.jsx(Bl,{onClick:k,className:"react-flow__controls-zoomout",title:y["controls.zoomOut.ariaLabel"],"aria-label":y["controls.zoomOut.ariaLabel"],disabled:w,children:a.jsx(K8,{})})]}),n&&a.jsx(Bl,{className:"react-flow__controls-fitview",onClick:S,title:y["controls.fitView.ariaLabel"],"aria-label":y["controls.fitView.ariaLabel"],children:a.jsx(G8,{})}),r&&a.jsx(Bl,{className:"react-flow__controls-interactive",onClick:P,title:y["controls.interactive.ariaLabel"],"aria-label":y["controls.interactive.ariaLabel"],children:x?a.jsx(Y8,{}):a.jsx(q8,{})}),d]})}PE.displayName="Controls";const Q8=b.memo(PE);function Z8({id:e,x:t,y:n,width:r,height:s,style:i,color:o,strokeColor:l,strokeWidth:c,className:u,borderRadius:d,shapeRendering:f,selected:h,onClick:p}){const{background:v,backgroundColor:x}=i||{},w=o||v||x;return a.jsx("rect",{className:Fe(["react-flow__minimap-node",{selected:h},u]),x:t,y:n,rx:d,ry:d,width:r,height:s,style:{fill:w,stroke:l,strokeWidth:c},shapeRendering:f,onClick:p?g=>p(g,e):void 0})}const J8=b.memo(Z8),eH=e=>e.nodes.map(t=>t.id),Of=e=>e instanceof Function?e:()=>e;function tH({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:i=J8,onClick:o}){const l=he(eH,Ie),c=Of(t),u=Of(e),d=Of(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return a.jsx(a.Fragment,{children:l.map(h=>a.jsx(rH,{id:h,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:i,onClick:o,shapeRendering:f},h))})}function nH({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:i,shapeRendering:o,NodeComponent:l,onClick:c}){const{node:u,x:d,y:f,width:h,height:p}=he(v=>{const x=v.nodeLookup.get(e);if(!x)return{node:void 0,x:0,y:0,width:0,height:0};const w=x.internals.userNode,{x:g,y}=x.internals.positionAbsolute,{width:m,height:_}=Ln(w);return{node:w,x:g,y,width:m,height:_}},Ie);return!u||u.hidden||!TN(u)?null:a.jsx(l,{x:d,y:f,width:h,height:p,style:u.style,selected:!!u.selected,className:r(u),color:t(u),borderRadius:s,strokeColor:n(u),strokeWidth:i,shapeRendering:o,onClick:c,id:u.id})}const rH=b.memo(nH);var sH=b.memo(tH);const iH=200,oH=150,aH=e=>!e.hidden,lH=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?EN(nl(e.nodeLookup,{filter:aH}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Dx=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,cH=(e,t)=>Dx(e.viewBB,t.viewBB)&&Dx(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig,uH="react-flow__minimap-desc";function ME({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:o,nodeComponent:l,bgColor:c,maskColor:u,maskStrokeColor:d,maskStrokeWidth:f,position:h="bottom-right",onClick:p,onNodeClick:v,pannable:x=!1,zoomable:w=!1,ariaLabel:g,inversePan:y,zoomStep:m=1,offsetScale:_=5}){const j=Ne(),N=b.useRef(null),{boundingRect:k,viewBB:S,rfId:P,panZoom:$,translateExtent:D,flowWidth:I,flowHeight:O,ariaLabelConfig:E}=he(lH,cH),A=(e==null?void 0:e.width)??iH,C=(e==null?void 0:e.height)??oH,M=k.width/A,T=k.height/C,R=Math.max(M,T),B=R*A,L=R*C,F=_*R,W=k.x-(B-k.width)/2-F,U=k.y-(L-k.height)/2-F,K=B+F*2,Q=L+F*2,J=`${uH}-${P}`,H=b.useRef(0),q=b.useRef();H.current=R,b.useEffect(()=>{if(N.current&&$)return q.current=vB({domNode:N.current,panZoom:$,getTransform:()=>j.getState().transform,getViewScale:()=>H.current}),()=>{var X;(X=q.current)==null||X.destroy()}},[$]),b.useEffect(()=>{var X;(X=q.current)==null||X.update({translateExtent:D,width:I,height:O,inversePan:y,pannable:x,zoomStep:m,zoomable:w})},[x,w,y,m,D,I,O]);const ne=p?X=>{var ge;const[ae,pe]=((ge=q.current)==null?void 0:ge.pointer(X))||[0,0];p(X,{x:ae,y:pe})}:void 0,te=v?b.useCallback((X,ae)=>{const pe=j.getState().nodeLookup.get(ae).internals.userNode;v(X,pe)},[]):void 0,ee=g??E["minimap.ariaLabel"];return a.jsx(_d,{position:h,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 d=="string"?d:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*R:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o=="number"?o:void 0},className:Fe(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:a.jsxs("svg",{width:A,height:C,viewBox:`${W} ${U} ${K} ${Q}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":J,ref:N,onClick:ne,children:[ee&&a.jsx("title",{id:J,children:ee}),a.jsx(sH,{onClick:te,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:o,nodeComponent:l}),a.jsx("path",{className:"react-flow__minimap-mask",d:`M${W-F},${U-F}h${K+F*2}v${Q+F*2}h${-K-F*2}z
82
+ M${S.x},${S.y}h${S.width}v${S.height}h${-S.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}ME.displayName="MiniMap";b.memo(ME);const dH=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,fH={[Gi.Line]:"right",[Gi.Handle]:"bottom-right"};function hH({nodeId:e,position:t,variant:n=Gi.Handle,className:r,style:s=void 0,children:i,color:o,minWidth:l=10,minHeight:c=10,maxWidth:u=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:h,autoScale:p=!0,shouldResize:v,onResizeStart:x,onResize:w,onResizeEnd:g}){const y=cE(),m=typeof e=="string"?e:y,_=Ne(),j=b.useRef(null),N=n===Gi.Handle,k=he(b.useCallback(dH(N&&p),[N,p]),Ie),S=b.useRef(null),P=t??fH[n];b.useEffect(()=>{if(!(!j.current||!m))return S.current||(S.current=TB({domNode:j.current,nodeId:m,getStoreItems:()=>{const{nodeLookup:D,transform:I,snapGrid:O,snapToGrid:E,nodeOrigin:A,domNode:C}=_.getState();return{nodeLookup:D,transform:I,snapGrid:O,snapToGrid:E,nodeOrigin:A,paneDomNode:C}},onChange:(D,I)=>{const{triggerNodeChanges:O,nodeLookup:E,parentLookup:A,nodeOrigin:C}=_.getState(),M=[],T={x:D.x,y:D.y},R=E.get(m);if(R&&R.expandParent&&R.parentId){const B=R.origin??C,L=D.width??R.measured.width??0,F=D.height??R.measured.height??0,W={id:R.id,parentId:R.parentId,rect:{width:L,height:F,...PN({x:D.x??R.position.x,y:D.y??R.position.y},{width:L,height:F},R.parentId,E,B)}},U=fv([W],E,A,C);M.push(...U),T.x=D.x?Math.max(B[0]*L,D.x):void 0,T.y=D.y?Math.max(B[1]*F,D.y):void 0}if(T.x!==void 0&&T.y!==void 0){const B={id:m,type:"position",position:{...T}};M.push(B)}if(D.width!==void 0&&D.height!==void 0){const L={id:m,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:D.width,height:D.height}};M.push(L)}for(const B of I){const L={...B,type:"position"};M.push(L)}O(M)},onEnd:({width:D,height:I})=>{const O={id:m,type:"dimensions",resizing:!1,dimensions:{width:D,height:I}};_.getState().triggerNodeChanges([O])}})),S.current.update({controlPosition:P,boundaries:{minWidth:l,minHeight:c,maxWidth:u,maxHeight:d},keepAspectRatio:f,resizeDirection:h,onResizeStart:x,onResize:w,onResizeEnd:g,shouldResize:v}),()=>{var D;(D=S.current)==null||D.destroy()}},[P,l,c,u,d,f,x,w,g,v]);const $=P.split("-");return a.jsx("div",{className:Fe(["react-flow__resize-control","nodrag",...$,n,r]),ref:j,style:{...s,scale:k,...o&&{[N?"backgroundColor":"borderColor"]:o}},children:i})}b.memo(hH);const pH={llm_only:"AI",claude:"Claude",codex:"Codex",qoder:"Qoder",qwenwork:"千问办公"};function mH(e){return e.requiresAgent?{key:e.engine==="llm_only"?"llm":e.engine,label:pH[e.engine]}:null}function gH({data:e,selected:t}){var l;const n=e.step,r=mH(n),s=n.status??"idle",i=n.configStatus==="missing",o=((l=n.missingConfigKeys)==null?void 0:l.length)??0;return a.jsxs(Ye.div,{variants:fz,initial:"hidden",animate:"visible",className:`wf-node is-${s}${t?" is-selected":""}`+(i?" is-config-missing":""),style:{"--engine":r?`var(--agent-${r.key})`:"var(--border-strong)"},children:[a.jsx(qi,{type:"target",position:re.Top,className:"wf-node__handle"}),a.jsx("div",{className:"wf-node__bar"}),a.jsxs("div",{className:"wf-node__body",children:[a.jsxs("div",{className:"wf-node__top",children:[r?a.jsx("span",{className:"wf-node__engine",children:r.label}):a.jsx("span",{}),a.jsxs("div",{className:"wf-node__top-right",children:[i&&a.jsxs("span",{className:"wf-node__config-badge",title:`缺 ${o} 项配置`,children:["⚠ ",o]}),n.needsHuman?a.jsx("span",{className:"wf-node__flag wf-node__flag--human",title:"人工审批",children:a.jsx(V,{name:"user",size:11})}):a.jsx("span",{className:"wf-node__flag",title:"自动",children:a.jsx(V,{name:"bolt",size:11})})]})]}),a.jsx("div",{className:"wf-node__name",children:n.name}),a.jsx("div",{className:"wf-node__recipe",children:n.recipe}),i&&a.jsx("div",{className:"wf-node__config-warn",children:"⚠ 缺少参数 · 点击补齐"})]}),a.jsx(qi,{type:"source",position:re.Bottom,className:"wf-node__handle"})]})}const vH={step:gH};function IE({steps:e,edges:t,selectedId:n,onSelect:r}){const s=b.useMemo(()=>e.map((o,l)=>({id:o.id,type:"step",position:{x:60,y:l*128},data:{step:o},selected:o.id===n,draggable:!0})),[e,n]),i=b.useMemo(()=>t.map(o=>{const l=o.from===n||o.to===n;return{id:`${o.from}-${o.to}`,source:o.from,target:o.to,type:"smoothstep",animated:l,style:{stroke:l?"var(--accent)":"var(--border-strong)",strokeWidth:l?2:1.5}}}),[t,n]);return a.jsx("div",{className:"wf-canvas",children:a.jsxs(z8,{nodes:s,edges:i,nodeTypes:vH,fitView:!0,fitViewOptions:{padding:.25},minZoom:.4,maxZoom:1.5,proOptions:{hideAttribution:!0},onNodeClick:(o,l)=>r(l.id),onPaneClick:()=>r(null),children:[a.jsx(U8,{variant:sr.Dots,gap:16,size:1}),a.jsx(Q8,{showInteractive:!1})]})})}function zx(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function yH(e){if(Array.isArray(e))return e}function _H(e,t,n){return(t=NH(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xH(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function wH(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
83
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Vx(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Fx(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Vx(Object(n),!0).forEach(function(r){_H(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vx(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function bH(e,t){if(e==null)return{};var n,r,s=jH(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function jH(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function SH(e,t){return yH(e)||xH(e,t)||EH(e,t)||wH()}function kH(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function NH(e){var t=kH(e,"string");return typeof t=="symbol"?t:t+""}function EH(e,t){if(e){if(typeof e=="string")return zx(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?zx(e,t):void 0}}function CH(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bx(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Hx(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Bx(Object(n),!0).forEach(function(r){CH(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bx(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function AH(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){return t.reduceRight(function(s,i){return i(s)},r)}}function To(e){return function t(){for(var n=this,r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];return s.length>=e.length?e.apply(this,s):function(){for(var o=arguments.length,l=new Array(o),c=0;c<o;c++)l[c]=arguments[c];return t.apply(n,[].concat(s,l))}}}function ku(e){return{}.toString.call(e).includes("Object")}function TH(e){return!Object.keys(e).length}function $a(e){return typeof e=="function"}function PH(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function MH(e,t){return ku(t)||Dr("changeType"),Object.keys(t).some(function(n){return!PH(e,n)})&&Dr("changeField"),t}function IH(e){$a(e)||Dr("selectorType")}function RH(e){$a(e)||ku(e)||Dr("handlerType"),ku(e)&&Object.values(e).some(function(t){return!$a(t)})&&Dr("handlersType")}function OH(e){e||Dr("initialIsRequired"),ku(e)||Dr("initialType"),TH(e)&&Dr("initialContent")}function $H(e,t){throw new Error(e[t]||e.default)}var LH={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},Dr=To($H)(LH),Hl={changes:MH,selector:IH,handler:RH,initial:OH};function DH(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Hl.initial(e),Hl.handler(t);var n={current:e},r=To(FH)(n,t),s=To(VH)(n),i=To(Hl.changes)(e),o=To(zH)(n);function l(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(d){return d};return Hl.selector(u),u(n.current)}function c(u){AH(r,s,i,o)(u)}return[l,c]}function zH(e,t){return $a(t)?t(e.current):t}function VH(e,t){return e.current=Hx(Hx({},e.current),t),t}function FH(e,t,n){return $a(t)?t(e.current):Object.keys(n).forEach(function(r){var s;return(s=t[r])===null||s===void 0?void 0:s.call(t,e.current[r])}),n}var BH={create:DH},HH={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function UH(e){return function t(){for(var n=this,r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];return s.length>=e.length?e.apply(this,s):function(){for(var o=arguments.length,l=new Array(o),c=0;c<o;c++)l[c]=arguments[c];return t.apply(n,[].concat(s,l))}}}function WH(e){return{}.toString.call(e).includes("Object")}function KH(e){return e||Ux("configIsRequired"),WH(e)||Ux("configType"),e.urls?(GH(),{paths:{vs:e.urls.monacoBase}}):e}function GH(){console.warn(RE.deprecation)}function qH(e,t){throw new Error(e[t]||e.default)}var RE={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
84
+ You are using deprecated way of configuration.
85
+
86
+ Instead of using
87
+ monaco.config({ urls: { monacoBase: '...' } })
88
+ use
89
+ monaco.config({ paths: { vs: '...' } })
90
+
91
+ For more please check the link https://github.com/suren-atoyan/monaco-loader#config
92
+ `},Ux=UH(qH)(RE),YH={config:KH},XH=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return function(s){return n.reduceRight(function(i,o){return o(i)},s)}};function OE(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],OE(e[n],t[n]))}),Fx(Fx({},e),t)}var QH={type:"cancelation",msg:"operation is manually canceled"};function $f(e){var t=!1,n=new Promise(function(r,s){e.then(function(i){return t?s(QH):r(i)}),e.catch(s)});return n.cancel=function(){return t=!0},n}var ZH=["monaco"],JH=BH.create({config:HH,isInitialized:!1,resolve:null,reject:null,monaco:null}),$E=SH(JH,2),il=$E[0],bd=$E[1];function eU(e){var t=YH.config(e),n=t.monaco,r=bH(t,ZH);bd(function(s){return{config:OE(s.config,r),monaco:n}})}function tU(){var e=il(function(t){var n=t.monaco,r=t.isInitialized,s=t.resolve;return{monaco:n,isInitialized:r,resolve:s}});if(!e.isInitialized){if(bd({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),$f(Lf);if(window.monaco&&window.monaco.editor)return LE(window.monaco),e.resolve(window.monaco),$f(Lf);XH(nU,sU)(iU)}return $f(Lf)}function nU(e){return document.body.appendChild(e)}function rU(e){var t=document.createElement("script");return e&&(t.src=e),t}function sU(e){var t=il(function(r){var s=r.config,i=r.reject;return{config:s,reject:i}}),n=rU("".concat(t.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=t.reject,n}function iU(){var e=il(function(n){var r=n.config,s=n.resolve,i=n.reject;return{config:r,resolve:s,reject:i}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(n){var r=n.m||n;LE(r),e.resolve(r)},function(n){e.reject(n)})}function LE(e){il().monaco||bd({monaco:e})}function oU(){return il(function(e){var t=e.monaco;return t})}var Lf=new Promise(function(e,t){return bd({resolve:e,reject:t})}),DE={config:eU,init:tU,__getMonacoInstance:oU},aU={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},Df=aU,lU={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},cU=lU;function uU({children:e}){return Zn.createElement("div",{style:cU.container},e)}var dU=uU,fU=dU;function hU({width:e,height:t,isEditorReady:n,loading:r,_ref:s,className:i,wrapperProps:o}){return Zn.createElement("section",{style:{...Df.wrapper,width:e,height:t},...o},!n&&Zn.createElement(fU,null,r),Zn.createElement("div",{ref:s,style:{...Df.fullWidth,...!n&&Df.hide},className:i}))}var pU=hU,zE=b.memo(pU);function mU(e){b.useEffect(e,[])}var VE=mU;function gU(e,t,n=!0){let r=b.useRef(!0);b.useEffect(r.current||!n?()=>{r.current=!1}:e,t)}var _t=gU;function Xo(){}function yi(e,t,n,r){return vU(e,r)||yU(e,t,n,r)}function vU(e,t){return e.editor.getModel(FE(e,t))}function yU(e,t,n,r){return e.editor.createModel(t,n,r?FE(e,r):void 0)}function FE(e,t){return e.Uri.parse(t)}function _U({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:s,originalModelPath:i,modifiedModelPath:o,keepCurrentOriginalModel:l=!1,keepCurrentModifiedModel:c=!1,theme:u="light",loading:d="Loading...",options:f={},height:h="100%",width:p="100%",className:v,wrapperProps:x={},beforeMount:w=Xo,onMount:g=Xo}){let[y,m]=b.useState(!1),[_,j]=b.useState(!0),N=b.useRef(null),k=b.useRef(null),S=b.useRef(null),P=b.useRef(g),$=b.useRef(w),D=b.useRef(!1);VE(()=>{let A=DE.init();return A.then(C=>(k.current=C)&&j(!1)).catch(C=>(C==null?void 0:C.type)!=="cancelation"&&console.error("Monaco initialization: error:",C)),()=>N.current?E():A.cancel()}),_t(()=>{if(N.current&&k.current){let A=N.current.getOriginalEditor(),C=yi(k.current,e||"",r||n||"text",i||"");C!==A.getModel()&&A.setModel(C)}},[i],y),_t(()=>{if(N.current&&k.current){let A=N.current.getModifiedEditor(),C=yi(k.current,t||"",s||n||"text",o||"");C!==A.getModel()&&A.setModel(C)}},[o],y),_t(()=>{let A=N.current.getModifiedEditor();A.getOption(k.current.editor.EditorOption.readOnly)?A.setValue(t||""):t!==A.getValue()&&(A.executeEdits("",[{range:A.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),A.pushUndoStop())},[t],y),_t(()=>{var A,C;(C=(A=N.current)==null?void 0:A.getModel())==null||C.original.setValue(e||"")},[e],y),_t(()=>{let{original:A,modified:C}=N.current.getModel();k.current.editor.setModelLanguage(A,r||n||"text"),k.current.editor.setModelLanguage(C,s||n||"text")},[n,r,s],y),_t(()=>{var A;(A=k.current)==null||A.editor.setTheme(u)},[u],y),_t(()=>{var A;(A=N.current)==null||A.updateOptions(f)},[f],y);let I=b.useCallback(()=>{var M;if(!k.current)return;$.current(k.current);let A=yi(k.current,e||"",r||n||"text",i||""),C=yi(k.current,t||"",s||n||"text",o||"");(M=N.current)==null||M.setModel({original:A,modified:C})},[n,t,s,e,r,i,o]),O=b.useCallback(()=>{var A;!D.current&&S.current&&(N.current=k.current.editor.createDiffEditor(S.current,{automaticLayout:!0,...f}),I(),(A=k.current)==null||A.editor.setTheme(u),m(!0),D.current=!0)},[f,u,I]);b.useEffect(()=>{y&&P.current(N.current,k.current)},[y]),b.useEffect(()=>{!_&&!y&&O()},[_,y,O]);function E(){var C,M,T,R;let A=(C=N.current)==null?void 0:C.getModel();l||((M=A==null?void 0:A.original)==null||M.dispose()),c||((T=A==null?void 0:A.modified)==null||T.dispose()),(R=N.current)==null||R.dispose()}return Zn.createElement(zE,{width:p,height:h,isEditorReady:y,loading:d,_ref:S,className:v,wrapperProps:x})}var xU=_U;b.memo(xU);function wU(e){let t=b.useRef();return b.useEffect(()=>{t.current=e},[e]),t.current}var bU=wU,Ul=new Map;function jU({defaultValue:e,defaultLanguage:t,defaultPath:n,value:r,language:s,path:i,theme:o="light",line:l,loading:c="Loading...",options:u={},overrideServices:d={},saveViewState:f=!0,keepCurrentModel:h=!1,width:p="100%",height:v="100%",className:x,wrapperProps:w={},beforeMount:g=Xo,onMount:y=Xo,onChange:m,onValidate:_=Xo}){let[j,N]=b.useState(!1),[k,S]=b.useState(!0),P=b.useRef(null),$=b.useRef(null),D=b.useRef(null),I=b.useRef(y),O=b.useRef(g),E=b.useRef(),A=b.useRef(r),C=bU(i),M=b.useRef(!1),T=b.useRef(!1);VE(()=>{let L=DE.init();return L.then(F=>(P.current=F)&&S(!1)).catch(F=>(F==null?void 0:F.type)!=="cancelation"&&console.error("Monaco initialization: error:",F)),()=>$.current?B():L.cancel()}),_t(()=>{var F,W,U,K;let L=yi(P.current,e||r||"",t||s||"",i||n||"");L!==((F=$.current)==null?void 0:F.getModel())&&(f&&Ul.set(C,(W=$.current)==null?void 0:W.saveViewState()),(U=$.current)==null||U.setModel(L),f&&((K=$.current)==null||K.restoreViewState(Ul.get(i))))},[i],j),_t(()=>{var L;(L=$.current)==null||L.updateOptions(u)},[u],j),_t(()=>{!$.current||r===void 0||($.current.getOption(P.current.editor.EditorOption.readOnly)?$.current.setValue(r):r!==$.current.getValue()&&(T.current=!0,$.current.executeEdits("",[{range:$.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),$.current.pushUndoStop(),T.current=!1))},[r],j),_t(()=>{var F,W;let L=(F=$.current)==null?void 0:F.getModel();L&&s&&((W=P.current)==null||W.editor.setModelLanguage(L,s))},[s],j),_t(()=>{var L;l!==void 0&&((L=$.current)==null||L.revealLine(l))},[l],j),_t(()=>{var L;(L=P.current)==null||L.editor.setTheme(o)},[o],j);let R=b.useCallback(()=>{var L;if(!(!D.current||!P.current)&&!M.current){O.current(P.current);let F=i||n,W=yi(P.current,r||e||"",t||s||"",F||"");$.current=(L=P.current)==null?void 0:L.editor.create(D.current,{model:W,automaticLayout:!0,...u},d),f&&$.current.restoreViewState(Ul.get(F)),P.current.editor.setTheme(o),l!==void 0&&$.current.revealLine(l),N(!0),M.current=!0}},[e,t,n,r,s,i,u,d,f,o,l]);b.useEffect(()=>{j&&I.current($.current,P.current)},[j]),b.useEffect(()=>{!k&&!j&&R()},[k,j,R]),A.current=r,b.useEffect(()=>{var L,F;j&&m&&((L=E.current)==null||L.dispose(),E.current=(F=$.current)==null?void 0:F.onDidChangeModelContent(W=>{T.current||m($.current.getValue(),W)}))},[j,m]),b.useEffect(()=>{if(j){let L=P.current.editor.onDidChangeMarkers(F=>{var U;let W=(U=$.current.getModel())==null?void 0:U.uri;if(W&&F.find(K=>K.path===W.path)){let K=P.current.editor.getModelMarkers({resource:W});_==null||_(K)}});return()=>{L==null||L.dispose()}}return()=>{}},[j,_]);function B(){var L,F;(L=E.current)==null||L.dispose(),h?f&&Ul.set(i,$.current.saveViewState()):(F=$.current.getModel())==null||F.dispose(),$.current.dispose()}return Zn.createElement(zE,{width:p,height:v,isEditorReady:j,loading:c,_ref:D,className:x,wrapperProps:w})}var SU=jU,kU=b.memo(SU),NU=kU;const EU=[{id:"claude",name:"Claude Code",vendor:"Anthropic",detected:!0,selected:!0,capabilities:["编码","推理","长上下文"],desc:"本地已检测到 CLI,可作为工作流设计与复杂步骤执行引擎"},{id:"qoder",name:"Qoder",vendor:"Qoder",detected:!0,selected:!0,capabilities:["编码","仓库理解"],desc:"适合把业务流程落成配置、脚本与可审查产物"},{id:"codex",name:"Codex",vendor:"OpenAI",detected:!1,selected:!1,capabilities:["编码","自动修复"],desc:"未检测到,安装 CLI 后可作为候选执行引擎"},{id:"qwenwork",name:"千问办公",vendor:"Alibaba",detected:!1,selected:!1,capabilities:["办公智能体","业务流程"],desc:"启动千问办公桌面应用后可作为候选执行引擎"}],CU=[{id:"classify",name:"信息校验",recipe:"validate-onboarding",engine:"llm_only",auto:!0,inputs:["员工姓名","身份证号","入职日期"],outputs:["校验结论","异常项"]},{id:"investigate",name:"权限准备",recipe:"prepare-access",engine:"qoder",auto:!0,inputs:["员工姓名","部门","岗位","校验结论"],outputs:["权限清单"]},{id:"draft_reply",name:"入职指引草拟",recipe:"draft-onboarding-guide",engine:"llm_only",auto:!0,inputs:["员工姓名","部门","岗位","权限清单"],outputs:["入职指引"]},{id:"quality_check",name:"法务与 HR 复核",recipe:"hr-legal-review",engine:"llm_only",auto:!1,needsHuman:!0,inputs:["入职指引","异常项"],outputs:["复核结论"]},{id:"send_reply",name:"发送入职通知",recipe:"send-onboarding-notice",engine:"llm_only",auto:!0,inputs:["员工姓名","入职指引","复核结论"],outputs:["发送状态"]}],BE=[{id:"fld_employee_name",name:"员工姓名",type:"text",required:!0,group:"business"},{id:"fld_department",name:"部门",type:"text",required:!0,group:"business"},{id:"fld_position",name:"岗位",type:"text",group:"business"},{id:"fld_priority",name:"入职紧急度",type:"single_select",options:["P0-紧急","P1-高","P2-中","P3-低"],group:"business"},{id:"fld_category",name:"事项类型",type:"single_select",options:["入职办理","合同确认","设备申领","权限开通","其他"],group:"business"},{id:"fld_reply_content",name:"入职指引",type:"text",group:"business"},{id:"fld_resolution",name:"权限清单",type:"text",group:"business"},{id:"fld_satisfaction",name:"复核结论",type:"single_select",options:["通过","需补充材料","需法务复核"],group:"business"},{id:"fld_status",name:"状态",type:"single_select",options:["待处理","校验中","权限准备中","草拟指引中","复核中","发送中","已完成"],group:"process"},{id:"fld_current_step",name:"当前步骤",type:"text",group:"process"},{id:"fld_assignee",name:"处理人",type:"user",group:"process"},{id:"fld_sla_deadline",name:"SLA截止时间",type:"datetime",group:"process"},{id:"fld_event_log",name:"事件日志",type:"text",group:"process"}],HE=[{id:"v_grid",name:"全部入职事项",kind:"grid",desc:"全量入职事项列表视图"},{id:"v_kanban",name:"入职进度看板",kind:"kanban",desc:"按状态分列的看板"},{id:"v_form",name:"入职信息提交",kind:"form",desc:"给 HR 或用人团队的提交表单"},{id:"v_calendar",name:"入职日历",kind:"calendar",desc:"按入职日期查看事项"}],mv="ZQYprEoWoPLkorKyuBeBDRd9V1waOeDk",UE="1HixpC7",AU="epHNF75";function WE(e,t,n){const r=new URLSearchParams({entrance:"data",sheetId:t});return n!=null&&n.trim()&&r.set("viewId",n.trim()),`https://alidocs.dingtalk.com/i/nodes/${e}?iframeQuery=${encodeURIComponent(r.toString())}`}WE(mv,UE,AU);const TU=[{id:"hr_partner",name:"HR 业务伙伴",persona:"你是谨慎、温和且注重证据的 HR 业务伙伴。你负责把员工相关流程转化为可执行步骤,先核对制度和人员条件,再给出清晰的处理建议。涉及员工权益、绩效、离职、纪律处分等敏感事项时,必须标出风险点、建议人工复核,并避免使用带倾向性的判断语言。",skills:["policy_interpretation","eligibility_check","document_draft","handoff_summary"],knowledge:["kb_hr_policy","kb_org_people"]},{id:"legal_counsel",name:"法务顾问",persona:"你是业务友好型法务顾问,负责识别合同、合规和隐私风险,并把复杂法务意见转成业务能执行的下一步动作。你不会直接替业务做最终法律承诺;对高风险条款、责任限制、数据出境、劳动争议和监管风险,需要给出风险等级、修改建议和升级路径。",skills:["risk_review","approval_gate","document_draft","handoff_summary"],knowledge:["kb_contract_templates","kb_legal_playbook"]}],PU=`# HR 入职协同 — 工作流模板
93
+ meta:
94
+ name: "HR 入职协同"
95
+ version: "1.0.0"
96
+ domain: hr_onboarding
97
+
98
+ steps:
99
+ - id: classify
100
+ name: "信息校验"
101
+ recipe: validate-onboarding
102
+ engine: llm_only
103
+ auto: true
104
+ input_mapping: { employee: 员工姓名, start_date: 入职日期 }
105
+ output_mapping: { result: 校验结论, issues: 异常项 }
106
+
107
+ - id: investigate
108
+ name: "权限准备"
109
+ recipe: prepare-access
110
+ engine: qoder
111
+ auto: true
112
+ output_mapping: { access: 权限清单 }
113
+
114
+ - id: draft_reply
115
+ name: "入职指引草拟"
116
+ recipe: draft-onboarding-guide
117
+ engine: llm_only
118
+ auto: true
119
+ output_mapping: { guide: 入职指引 }
120
+
121
+ - id: quality_check
122
+ name: "法务与 HR 复核"
123
+ recipe: hr-legal-review
124
+ engine: llm_only
125
+ auto: false # 人工审批节点
126
+ compliance: true
127
+
128
+ - id: send_reply
129
+ name: "发送入职通知"
130
+ recipe: send-onboarding-notice
131
+ engine: llm_only
132
+ auto: true
133
+
134
+ edges:
135
+ - { from: __start__, to: classify }
136
+ - { from: classify, to: investigate }
137
+ - { from: investigate, to: draft_reply }
138
+ - { from: draft_reply, to: quality_check }
139
+ - { from: quality_check, to: send_reply }
140
+ - { from: send_reply, to: __end__ }
141
+ `,MU=`# aitable-workflow.config.yml
142
+ name: "HR 入职协同"
143
+ agent:
144
+ engines: [claude, qoder]
145
+ table:
146
+ space: "人力协同"
147
+ base: "入职流程"
148
+ llm:
149
+ provider: dashscope
150
+ model: qwen-max
151
+ roles:
152
+ - HR 业务伙伴
153
+ - 法务顾问
154
+ sop: |
155
+ 1. 入职通知需经 HR 确认后再发送
156
+ 2. 合同、隐私或跨境事项需法务复核
157
+ `,IU={"validate-onboarding.recipe.ts":`/**
158
+ * Recipe: 信息校验 — 校验入职员工的基本信息与材料完整性
159
+ */
160
+ import type { RecipeDefinition, RecipeContext, RecipeResult } from '../runtime/types';
161
+
162
+ const recipe: RecipeDefinition = {
163
+ meta: {
164
+ id: 'validate-onboarding',
165
+ name: '信息校验',
166
+ role: 'HR 业务伙伴',
167
+ engine: 'llm_only',
168
+ requiresAgent: false,
169
+ timeoutMs: 60_000,
170
+ },
171
+ inputs: [
172
+ { name: 'employee', type: 'string', required: true },
173
+ { name: 'id_number', type: 'string', required: true },
174
+ { name: 'start_date', type: 'string', required: true },
175
+ ],
176
+ outputs: [
177
+ { name: 'result', type: 'string' },
178
+ { name: 'issues', type: 'string' },
179
+ ],
180
+
181
+ async execute(ctx: RecipeContext): Promise<RecipeResult> {
182
+ const { employee, id_number, start_date } = ctx.input;
183
+ ctx.log(\`校验入职信息: \${employee}\`);
184
+ const result = await ctx.toolkit.ai.chatJSON(
185
+ \`你是 HR 信息校验专员。请核对以下入职员工信息是否完整且合规。
186
+ 员工姓名: \${employee}
187
+ 身份证号: \${id_number}
188
+ 入职日期: \${start_date}
189
+ 检查项: 身份信息/学历证明/体检报告/劳动合同/银行账户
190
+ 输出: 校验结论(通过/需补充材料)、异常项列表\`,
191
+ { type: 'object', properties: { result: {}, issues: {} } }
192
+ );
193
+ return { status: 'success', output: result };
194
+ },
195
+ };
196
+
197
+ export default recipe;
198
+ `,"prepare-access.recipe.ts":`/**
199
+ * Recipe: 权限准备 — 调用 coding agent 根据岗位自动开通系统权限
200
+ */
201
+ import type { RecipeDefinition, RecipeContext, RecipeResult } from '../runtime/types';
202
+
203
+ const recipe: RecipeDefinition = {
204
+ meta: {
205
+ id: 'prepare-access',
206
+ name: '权限准备',
207
+ role: 'HR 业务伙伴',
208
+ engine: 'qoder',
209
+ requiresAgent: true,
210
+ timeoutMs: 1_800_000,
211
+ },
212
+ inputs: [
213
+ { name: 'employee', type: 'string', required: true },
214
+ { name: 'department', type: 'string' },
215
+ { name: 'position', type: 'string' },
216
+ { name: 'result', type: 'string' },
217
+ ],
218
+ outputs: [{ name: 'access', type: 'string' }],
219
+
220
+ async execute(ctx: RecipeContext): Promise<RecipeResult> {
221
+ ctx.log('根据岗位查询权限模板并开通…');
222
+ const template = await ctx.toolkit.kb.search(\`\${ctx.input.position} 权限模板\`);
223
+ const access = await ctx.toolkit.coding.run({
224
+ prompt: \`根据岗位「\${ctx.input.position}」和部门「\${ctx.input.department}」,生成权限开通清单。\\n员工: \${ctx.input.employee}\`,
225
+ context: template,
226
+ });
227
+ return { status: 'success', output: { access } };
228
+ },
229
+ };
230
+
231
+ export default recipe;
232
+ `,"draft-onboarding-guide.recipe.ts":`/**
233
+ * Recipe: 入职指引草拟 — 基于权限清单生成个性化入职指引文档
234
+ */
235
+ import type { RecipeDefinition, RecipeContext, RecipeResult } from '../runtime/types';
236
+
237
+ const recipe: RecipeDefinition = {
238
+ meta: { id: 'draft-onboarding-guide', name: '入职指引草拟', engine: 'llm_only', timeoutMs: 60_000 },
239
+ inputs: [
240
+ { name: 'employee', type: 'string' },
241
+ { name: 'department', type: 'string' },
242
+ { name: 'position', type: 'string' },
243
+ { name: 'access', type: 'string' },
244
+ ],
245
+ outputs: [{ name: 'guide', type: 'string' }],
246
+
247
+ async execute(ctx: RecipeContext): Promise<RecipeResult> {
248
+ const guide = await ctx.toolkit.ai.chat(
249
+ \`为新员工 \${ctx.input.employee}(\${ctx.input.department} · \${ctx.input.position})草拟入职指引。
250
+ 包含: 报到流程、系统账号与权限说明、团队介绍、首周安排。
251
+ 权限清单: \${ctx.input.access}\`
252
+ );
253
+ return { status: 'success', output: { guide } };
254
+ },
255
+ };
256
+
257
+ export default recipe;
258
+ `,"hr-legal-review.recipe.ts":`/**
259
+ * Recipe: 法务与 HR 复核 — 人工审批节点(auto: false)
260
+ * AI 先给出合规风险评估,等待法务或 HR 确认后放行
261
+ */
262
+ import type { RecipeDefinition, RecipeContext, RecipeResult } from '../runtime/types';
263
+
264
+ const recipe: RecipeDefinition = {
265
+ meta: { id: 'hr-legal-review', name: '法务与 HR 复核', engine: 'llm_only', needsHuman: true },
266
+ inputs: [
267
+ { name: 'guide', type: 'string' },
268
+ { name: 'issues', type: 'string' },
269
+ ],
270
+ outputs: [{ name: 'approved', type: 'boolean' }],
271
+
272
+ async execute(ctx: RecipeContext): Promise<RecipeResult> {
273
+ const review = await ctx.toolkit.ai.chatJSON(
274
+ \`审核入职指引和校验异常项,评估合规风险(0-1)并给出复核结论。
275
+ 入职指引: \${ctx.input.guide}
276
+ 异常项: \${ctx.input.issues ?? '无'}\`,
277
+ { type: 'object', properties: { risk_score: {}, conclusion: {}, advice: {} } }
278
+ );
279
+ ctx.log(\`合规风险评分: \${review.risk_score},等待法务/HR 审批\`);
280
+ return { status: 'pending_human', output: review };
281
+ },
282
+ };
283
+
284
+ export default recipe;
285
+ `,"send-onboarding-notice.recipe.ts":`/**
286
+ * Recipe: 发送入职通知 — 通过 IM 通道把审核通过的入职指引发给新员工
287
+ */
288
+ import type { RecipeDefinition, RecipeContext, RecipeResult } from '../runtime/types';
289
+
290
+ const recipe: RecipeDefinition = {
291
+ meta: { id: 'send-onboarding-notice', name: '发送入职通知', engine: 'llm_only' },
292
+ inputs: [
293
+ { name: 'employee', type: 'string' },
294
+ { name: 'guide', type: 'string' },
295
+ { name: 'conclusion', type: 'string' },
296
+ ],
297
+ outputs: [{ name: 'sent', type: 'boolean' }],
298
+
299
+ async execute(ctx: RecipeContext): Promise<RecipeResult> {
300
+ await ctx.toolkit.messaging.send({ to: ctx.input.employee, text: ctx.input.guide });
301
+ ctx.log('入职通知已发送至新员工');
302
+ return { status: 'success', output: { sent: true } };
303
+ },
304
+ };
305
+
306
+ export default recipe;
307
+ `},RU={classify:"validate-onboarding.recipe.ts",investigate:"prepare-access.recipe.ts",draft_reply:"draft-onboarding-guide.recipe.ts",quality_check:"hr-legal-review.recipe.ts",send_reply:"send-onboarding-notice.recipe.ts"},OU=[{title:"张三入职办理",customer:"张三 · 产品研发部",category:"入职办理",priority:"P0-紧急"},{title:"李四合同确认",customer:"李四 · 市场营销部",category:"合同确认",priority:"P2-中"},{title:"王五设备申领",customer:"王五 · 数据分析部",category:"设备申领",priority:"P1-高"},{title:"赵六权限开通",customer:"赵六 · 财务部",category:"权限开通",priority:"P1-高"}];function $U(){return ue?null:{workflowYml:PU,configYml:MU,recipeFiles:IU,stepToRecipeFile:RU}}function KE(){return ue?null:{steps:CU,incomingTickets:OU}}function zf(){return ue?null:{fieldCount:BE.length,viewCount:HE.length}}function GE(){return ue?[]:EU}const LU=[{id:"claude",type:"claudecode",name:"Claude Code",vendor:"Anthropic"},{id:"codex",type:"codex",name:"Codex CLI",vendor:"OpenAI"},{id:"qoder",type:"qoder",name:"Qoder CLI",vendor:"Alibaba"},{id:"qwenwork",type:"qwenwork",name:"千问办公",vendor:"Alibaba"}];async function DU(){let e=new Map;try{const t=await XD();e=new Map(t.available.map(n=>[n.type,{version:n.version,cmd:n.cmd}]))}catch{}return LU.map(({id:t,type:n,name:r,vendor:s})=>{const i=e.get(n);return{id:t,name:r,vendor:s,detected:!!i,selected:!!i,capabilities:i?[i.version?`已安装 ${i.version}`:"已安装"]:["未安装"],desc:i?`本地已检测到 CLI(${i.cmd}),可作为工作流设计与执行引擎`:"未检测到本地 CLI,需先安装后使用"}})}function zU(){return ue?[]:TU}function VU(){return ue?"":mv}function FU(){return ue?null:{fields:BE,views:HE,tableBaseId:mv,tableSheetId:UE}}const BU={"workflow.yml":"流程编排","aitable-workflow.config.yml":"运行配置","config.yml":"运行配置","coding-agents.config.json":"执行引擎","views.yml":"视图方案"},Qn=$U(),Wx=Qn?[{path:"workflow.yml",label:"workflow.yml",lang:"yaml",content:Qn.workflowYml,summary:"流程编排"},{path:"config.yml",label:"config.yml",lang:"yaml",content:Qn.configYml,summary:"运行配置"},...Object.entries(Qn.recipeFiles).map(([e,t])=>({path:`recipes/${e}`,label:e,lang:"typescript",content:t,folder:"recipes",summary:"步骤脚本"}))]:[],HU=Qn?Object.fromEntries(Object.entries(Qn.stepToRecipeFile).map(([e,t])=>[`recipes/${t}`,e])):{},UU=ut(function({selectedStepId:t,onPickStep:n}){const r=z.theme,s=z.projectFiles,i=z.workflowFiles,o=z.steps,[l,c]=b.useState("workflow.yml"),[u,d]=b.useState(!1),f=i.length>0?i:s,h=b.useMemo(()=>f.length===0?Wx:f.map(m=>{const _=m.path.split("/").pop()??m.path;return{path:m.path,label:_,lang:m.path.endsWith(".ts")?"typescript":"yaml",content:m.content,folder:m.path.includes("/recipes/")||m.path.startsWith("recipes/")?"recipes":void 0,summary:m.path.includes("/recipes/")||m.path.startsWith("recipes/")?"步骤脚本":BU[_]??"项目文件"}}),[f]),p=b.useMemo(()=>f.length===0?(Qn==null?void 0:Qn.stepToRecipeFile)??{}:Object.fromEntries(o.filter(m=>m.recipe).map(m=>{var j;const _=(j=f.find(N=>N.path.endsWith(`${m.recipe}.recipe.ts`)))==null?void 0:j.path;return[m.id,(_==null?void 0:_.replace(/^recipes\//,""))??`${m.recipe}.recipe.ts`]})),[f,o]),v=b.useMemo(()=>f.length===0?HU:Object.fromEntries(Object.entries(p).map(([m,_])=>[_.startsWith("recipes/")?_:`recipes/${_}`,m])),[f.length,p]);b.useEffect(()=>{t&&p[t]&&c(`recipes/${p[t]}`)},[t,p]);const x=b.useMemo(()=>h.find(m=>m.path===l)??h[0]??Wx[0],[l,h]),w=h.filter(m=>!m.folder),g=h.filter(m=>m.folder==="recipes");function y(m){c(m),n(v[m]??null)}return a.jsxs("div",{className:`code-panel${u?" tree-collapsed":""}`,children:[!u&&a.jsxs("div",{className:"code-tree",children:[a.jsxs("div",{className:"code-tree__bar",children:[a.jsx("span",{className:"code-tree__heading",children:"文件"}),a.jsx("button",{type:"button",className:"code-tree__toggle",onClick:()=>d(!0),title:"收起文件树",children:a.jsx(V,{name:"chevron-left",size:14})})]}),w.map(m=>a.jsxs("button",{type:"button",className:`code-tree__file${l===m.path?" is-active":""}`,onClick:()=>y(m.path),children:[a.jsx(V,{name:"file",size:13}),a.jsxs("span",{className:"code-tree__file-text",children:[a.jsx("span",{className:"code-tree__file-name",children:m.label}),m.summary?a.jsx("span",{className:"code-tree__file-summary",children:m.summary}):null]})]},m.path)),a.jsxs("div",{className:"code-tree__folder",children:[a.jsx(V,{name:"folder",size:13}),"步骤脚本 recipes"]}),g.map(m=>{const _=v[m.path],j=_&&_===t;return a.jsxs("button",{type:"button",className:`code-tree__file is-nested${l===m.path?" is-active":""}${j?" is-linked":""}`,onClick:()=>y(m.path),children:[a.jsx(V,{name:"file",size:13}),a.jsxs("span",{className:"code-tree__file-text",children:[a.jsx("span",{className:"code-tree__file-name",children:m.label}),m.summary?a.jsx("span",{className:"code-tree__file-summary",children:m.summary}):null]})]},m.path)})]}),u&&a.jsx("button",{type:"button",className:"code-tree__expand",onClick:()=>d(!1),title:"展开文件树",children:a.jsx(V,{name:"chevron-right",size:14})}),a.jsxs("div",{className:"code-editor",children:[a.jsxs("div",{className:"code-editor__head",children:[a.jsx(V,{name:"file",size:13}),a.jsx("span",{children:x.path}),a.jsx("span",{className:"code-editor__lang",children:x.lang})]}),a.jsx("div",{className:"code-editor__body",children:a.jsx(NU,{height:"100%",language:x.lang,value:x.content,theme:r==="dark"?"vs-dark":"light",options:{readOnly:!0,minimap:{enabled:!1},fontSize:12.5,lineHeight:20,scrollBeyondLastLine:!1,renderLineHighlight:"none",padding:{top:10},fontFamily:"ui-monospace, 'SF Mono', Menlo, monospace"},loading:a.jsx("div",{className:"code-editor__loading",children:"加载编辑器…"})},x.path)})]})]})});function WU({step:e,fields:t,values:n,onSave:r,onReset:s}){const[i,o]=b.useState({...n});function l(h,p){o(v=>({...v,[h]:p}))}const c=new Map;for(const h of t){const p=h.group??"通用";c.has(p)||c.set(p,[]),c.get(p).push(h)}const u=t.filter(h=>h.isEnvRef),d=new Map;for(const[h,p]of c){const v=p.filter(x=>!x.isEnvRef);v.length>0&&d.set(h,v)}function f(){r(i)}return a.jsxs("div",{className:"step-config-form",children:[a.jsxs("div",{className:"step-config-form__head",children:[a.jsx(V,{name:"bolt",size:14}),a.jsxs("span",{className:"step-config-form__title",children:["步骤配置 · ",e.name]})]}),a.jsx("div",{className:"step-config-form__meta",children:a.jsxs("span",{className:"step-config-form__recipe",children:["recipe: ",e.recipe]})}),a.jsxs("div",{className:"step-config-form__body",children:[Array.from(d.entries()).map(([h,p])=>a.jsxs("fieldset",{className:"step-config-form__group",children:[a.jsx("legend",{className:"step-config-form__group-title",children:h}),p.map(v=>a.jsx(Kx,{field:v,value:i[v.key]??"",onChange:x=>l(v.key,x)},v.key))]},h)),u.length>0&&a.jsxs("fieldset",{className:"step-config-form__group",children:[a.jsx("legend",{className:"step-config-form__group-title",children:"环境变量引用"}),u.map(h=>a.jsxs("div",{className:"step-config-form__env-ref",children:[a.jsxs("span",{className:"step-config-form__env-mapping",children:[h.key," = ","${env.",h.envKey??h.key.toUpperCase(),"}"]}),a.jsx(Kx,{field:{...h,label:h.envKey??h.key.toUpperCase(),type:"secret"},value:i[h.envKey??h.key]??"",onChange:p=>l(h.envKey??h.key,p)})]},h.key))]})]}),a.jsxs("div",{className:"step-config-form__foot",children:[s&&a.jsx("button",{type:"button",className:"step-config-form__btn",onClick:s,children:"恢复默认"}),a.jsx("button",{type:"button",className:"primary step-config-form__btn",onClick:f,children:"保存配置"})]})]})}function Kx({field:e,value:t,onChange:n}){const r=e.required&&!t.trim(),s=`qf-input${r?" is-required-empty":""}`;return a.jsxs("div",{className:"step-config-form__field",children:[a.jsxs("label",{className:"step-config-form__label",children:[e.label,e.required&&a.jsx("span",{className:"qf-required",children:"*"})]}),e.description&&a.jsx("div",{className:"step-config-form__help",children:e.description}),e.type==="select"&&e.options?a.jsxs("select",{className:`qf-select${r?" is-required-empty":""}`,value:t,onChange:i=>n(i.target.value),children:[a.jsx("option",{value:"",children:"请选择…"}),e.options.map(i=>a.jsx("option",{value:i.value,children:i.label},i.value))]}):e.type==="number"?a.jsx("input",{type:"number",className:s,value:t,placeholder:e.defaultValue,onChange:i=>n(i.target.value)}):e.type==="switch"?a.jsxs("label",{className:"qf-switch",children:[a.jsx("input",{type:"checkbox",role:"switch",checked:t==="true",onChange:i=>n(i.target.checked?"true":"false")}),a.jsx("span",{"aria-hidden":!0})]}):e.type==="secret"?a.jsx("input",{type:"password",className:s,value:t,placeholder:"••••••••",onChange:i=>n(i.target.value)}):a.jsx("input",{type:"text",className:s,value:t,placeholder:e.defaultValue??"",onChange:i=>n(i.target.value)}),r&&a.jsx("span",{className:"step-config-form__required-hint",children:"必填"})]})}const KU=ut(function(){const t=z.steps,n=z.edges,[r,s]=b.useState(null),[i,o]=b.useState("preview"),l=t.find(u=>u.id===r)??null,c=l?[{key:"model",label:"model",type:"select",group:"AI (ai)",options:[{label:"Qwen3-Mini",value:"qwen3-mini"},{label:"Qwen3.7-Max",value:"qwen3.7-max"},{label:"DeepSeek-V3",value:"deepseek-v3"}]},{key:"engine",label:"engine",type:"select",required:!0,group:"编程引擎 (coding)",options:[{label:"qoder",value:"qoder"},{label:"codex",value:"codex"},{label:"claude",value:"claude"}]},{key:"target_branch",label:"target_branch",type:"text",group:"业务参数",defaultValue:"master"},{key:"api_key",label:"API Key",type:"secret",required:!0,isEnvRef:!0,envKey:"IDEALAB_API_KEY",group:"环境变量引用"}]:[];return a.jsxs("div",{className:"design-workspace design-workspace--tabbed",children:[a.jsxs("div",{className:"dw-tabs",children:[a.jsxs("button",{type:"button",className:`dw-tabs__tab${i==="preview"?" is-active":""}`,onClick:()=>o("preview"),children:[a.jsx(V,{name:"flow",size:13}),"预览"]}),a.jsxs("button",{type:"button",className:`dw-tabs__tab${i==="code"?" is-active":""}`,onClick:()=>o("code"),children:[a.jsx(V,{name:"file",size:13}),"代码"]})]}),i==="preview"?a.jsxs("div",{className:"dw-preview",children:[a.jsx("section",{className:"dw-panel dw-panel--canvas",style:{flex:1,borderRight:l?"1px solid var(--border)":"none"},children:a.jsx(IE,{steps:t,edges:n,selectedId:r,onSelect:s})}),l&&a.jsx(WU,{step:l,fields:c,values:{},onSave:u=>{console.log("保存配置",l.id,u)},onReset:()=>{}})]}):a.jsx("div",{className:"dw-code-view",children:a.jsx(UU,{selectedStepId:r,onPickStep:s})})]})}),xo={discovery:"理解业务目标与 SOP",generate:"生成流程方案",validate:"校验配置完整性",render:"渲染真实画布与配置"};function qE(e,t){switch(t){case"init":return GU(e);case"design":return YE(e);case"setup":return qU(e);case"adjust":return YU(e);case"test":return XU(e);default:return{ok:!0,missing:[],warnings:[]}}}function GU(e){const t=[],n=[];return it&&!e.init.selectedMachineId&&t.push({code:"ENGINE_NOT_SELECTED",scope:"project",target:"engine",label:"未选择执行引擎",locate:{stage:"init",panel:"engine",focusField:"selectedMachineId"}}),!it&&e.init.agentsSelected.length===0&&t.push({code:"AGENT_NOT_SELECTED",scope:"project",target:"agent",label:"未选择 Agent 引擎",locate:{stage:"init",panel:"agent"}}),e.init.roles.length===0&&t.push({code:"NO_ROLE",scope:"project",target:"role",label:"至少配置一个角色,Design 阶段的 recipe 需要绑定 role",locate:{stage:"init",panel:"role"}}),e.init.sop.trim()||n.push({code:"NO_SOP",scope:"project",target:"sop",label:"未填写 SOP,Design 澄清问题会更多",locate:{stage:"init",panel:"sop"}}),{ok:t.length===0,missing:t,warnings:n}}function YE(e){const t=[],n=[];for(const r of e.steps)if(r.configStatus==="missing"&&r.missingConfigKeys)for(const s of r.missingConfigKeys)t.push({code:"STEP_CONFIG_MISSING",scope:"step",target:r.id,label:`${r.name} 缺 ${s}`,locate:{stage:"design",panel:"step-config",focusField:s}});else r.configStatus==="warning"&&n.push({code:"STEP_CONFIG_WARNING",scope:"step",target:r.id,label:`${r.name} 有可选配置未填写`,locate:{stage:"design",panel:"step-config"}});return{ok:t.length===0,missing:t,warnings:n}}function qU(e){const t=[],n=[];return e.stageRuntime.setup.status!=="succeeded"&&t.push({code:"SETUP_NOT_COMPLETE",scope:"project",target:"setup",label:"搭建阶段尚未完成",locate:{stage:"setup",panel:"setup"}}),{ok:t.length===0,missing:t,warnings:n}}function YU(e){return e.stageRuntime.adjust.status==="succeeded"?{ok:!0,missing:[],warnings:[]}:{ok:!1,missing:[{code:"ADJUST_NOT_COMPLETE",scope:"project",target:"adjust",label:"参数调整尚未完成",locate:{stage:"adjust",panel:"adjust"}}],warnings:[]}}function XU(e){const t=[],n=[];return e.stageRuntime.test.status!=="succeeded"&&t.push({code:"TEST_NOT_PASSED",scope:"project",target:"test",label:"试运行尚未通过",locate:{stage:"test",panel:"test"}}),{ok:t.length===0,missing:t,warnings:n}}async function QU(e,t){const n=YE(t),r=await GD(e).catch(()=>null);if(!r)return{ok:n.ok,missing:n.missing,warnings:[...n.warnings,{code:"BACKEND_VALIDATE_UNAVAILABLE",scope:"project",target:"validate",label:"后端校验不可用,仅以前端配置检查为准",locate:{stage:"design",panel:"validate"}}]};const s=[...n.missing];for(const o of r.errors??[])s.push({code:"DESIGN_FILE_INVALID",scope:"workflow",target:"workflow.yml",label:o,locate:{stage:"design",panel:"files"}});const i=[...n.warnings];for(const o of r.warnings??[])i.push({code:"DESIGN_FILE_WARNING",scope:"workflow",target:"workflow.yml",label:o,locate:{stage:"design",panel:"files"}});return{ok:s.length===0,missing:s,warnings:i}}const Gx="演示模式不提供工作流设计:需求澄清与方案生成都由真实 Agent 完成。请用 pnpm dev(local 形态)或部署形态连上后端服务后再进入本阶段。",ZU=ut(function(){var k;const t=b.useRef();t.current||(t.current=new Gg);const n=t.current,r=b.useRef(null),[s,i]=b.useState(null),[o,l]=b.useState(!1),c=z.view,u=z.projectId,d=z.mode,f=z.steps,h=z.projectFiles,p=c.kind==="design"?c.sub:{kind:"not_started"},v=c.kind==="design"?c.runtime:void 0,x=z.live.designProgressStep;Yg("design",n);async function w(){const S=d==="live"&&u?await QU(u,z.validationContext):qE(z.validationContext,"design");if(z.setValidation("design",S),!S.ok){i(S);return}z.setRoute("setup")}function g(){d!=="live"||!u||(z.patchLive(u,{designMessage:"重新连接真实设计服务",designProgressStep:null,designRound:null,designAgentEvents:0}),Na("design",u,n))}b.useEffect(()=>(n.onFormSubmit=(S,P)=>{d!=="live"||!u||p.kind!=="discovery_waiting_user"||S===p.discovery.form.id&&(async()=>{try{const $=await t3(u,P);z.applyDesignEvent(u,{type:"task.snapshot",task:$.task}),await n.run([{kind:"say",text:"收到。我会把这些答案整理成需求摘要,再启动真实 Agent 生成工作流方案。"}])}catch($){await n.run([{kind:"say",text:`确认需求失败:${$ instanceof Error?$.message:String($)}`}])}})()},()=>{n.onFormSubmit=null}),[n,d,u,p]),b.useEffect(()=>{if(d!=="live"){if(r.current==="mock")return;r.current="mock",n.run([{kind:"say",text:Gx}]);return}if(!u){if(r.current==="missing-project")return;r.current="missing-project",n.run([{kind:"say",text:"缺少真实项目工作区,请先返回 Init 阶段完成真实配置。"}]);return}const S=JU(u,p);if(r.current!==S){if(r.current=S,p.kind==="not_started"){y(u);return}if(p.kind==="discovery_waiting_user"){n.run([{kind:"say",text:`${p.discovery.summary||(v==null?void 0:v.message)||"请确认以下设计约束"} 确认后我会继续生成工作流方案。`},{kind:"form",form:{...p.discovery.form,submitLabel:p.submitLabel}}]);return}if(p.kind==="done"){n.run([{kind:"say",text:`已恢复当前流程 ${u} 的设计产物,不会重复启动生成任务。右侧可继续查看流程与配置。`}]);return}p.kind==="failed"&&n.run([{kind:"say",text:`${p.message}。请重新生成 Design,系统会保留当前可查看的文件。`}])}},[n,d,u,p,v==null?void 0:v.message]);async function y(S){let P=null;l(!0);try{await n.run([{kind:"say",text:"我先把你的 SOP、角色和表格信息交给设计 Agent,它读完后会判断还缺什么——需要澄清就问你,已经清楚就直接开始生成。这一步要等 Agent 跑完,可能需要一两分钟。"}]),P=n.beginTask("交给设计 Agent 判读需求","缺口分析 / 决定是否提问");const $=await e3(S);P("done"),P=null,z.applyDesignEvent(S,{type:$.task.status==="blocked"?"task.blocked":"task.snapshot",task:{...$.task,outputs:{...$.task.outputs,discovery:$.discovery}}}),$.discovery.confirmed&&await n.run([{kind:"say",text:`${$.discovery.summary||"Agent 判断需求已足够明确"},我直接开始生成工作流方案。`}])}catch($){P==null||P("error");const D=$ instanceof Error?$.message:String($);z.patchLive(S,{designMessage:`需求澄清准备失败:${D}`}),await n.run([{kind:"say",text:`需求澄清准备失败:${D}`}])}finally{l(!1)}}const m=o&&p.kind==="not_started",_=h.length>0,j=a.jsxs(a.Fragment,{children:[ue&&a.jsx(Bz,{projectId:u}),p.kind==="discovery_preparing"||p.kind==="generating"?a.jsx(eW,{sub:p,progressStep:x}):f.length>0||_?a.jsx(KU,{}):p.kind==="failed"?a.jsx("div",{className:"work-body",children:a.jsxs("div",{className:"empty-hint",children:[p.message,a.jsx("br",{}),a.jsxs("button",{type:"button",className:"primary",style:{marginTop:14},onClick:g,children:[a.jsx(V,{name:"refresh",size:14,color:"#fff"}),((k=v==null?void 0:v.recoveryAction)==null?void 0:k.label)??"重新生成工作流设计"]})]})}):a.jsx("div",{className:"work-body",children:a.jsx("div",{className:"empty-hint",children:d==="live"?"先确认需求澄清卡片,确认后将启动真实设计生成。":Gx})}),s&&!s.ok&&a.jsx(Bk,{title:"无法进入搭建阶段",missing:s.missing,warnings:s.warnings,onClose:()=>i(null),onLocate:S=>{i(null)}})]}),N=()=>p.kind==="done"?p.rounds!==null?`完成 ${p.rounds} 轮 · ${p.agentEvents} 个 Agent 事件`:f.length?`${f.length} 步 · 真实方案`:"设计已完成":p.kind==="generating"?p.round!==null?`第 ${p.round} 轮进行中 · ${p.agentEvents} 个 Agent 事件`:p.message:p.kind==="discovery_preparing"?p.message:p.kind==="discovery_waiting_user"?"等待确认需求澄清":p.kind==="failed"?p.message:p.kind==="unsupported"?"演示模式不提供":f.length?`${f.length} 步 · ${d==="live"?"真实方案":"演示方案"}`:_?`${h.length} 个文件 · 等待真实设计启动`:d==="live"?"真实生成待启动":"演示待生成";return a.jsx(hu,{chat:n,chatTitle:"工作流设计",chatSubtitle:`需求对齐 → 可视化编排 · ${d==="live"?"真实模式":"演示模式"}`,chatEmptyHint:"agent 正在准备开场问题…",onSend:S=>{n.addUserMessage(S),n.run([{kind:"say",text:"收到,我会据此调整工作流细节。"}])},workHead:a.jsxs("div",{className:"work-head",children:[a.jsx(V,{name:"flow",size:16}),a.jsx("div",{className:"work-head__title",children:"工作流"}),a.jsx("div",{className:"work-head__sub",children:N()}),f.length>0&&a.jsxs("button",{type:"button",className:"primary work-head__cta",onClick:w,children:["进入搭建阶段",a.jsx(V,{name:"chevron-right",size:14,color:"#fff"})]}),p.kind==="failed"&&(f.length>0||_)&&a.jsxs("button",{type:"button",className:"primary work-head__cta",onClick:g,style:{marginLeft:8},children:[a.jsx(V,{name:"refresh",size:14,color:"#fff"}),"重新生成"]})]}),work:j,hideWork:m})});function JU(e,t){const n=t.kind==="discovery_waiting_user"?t.discovery.form.id:"";return`${e}:${t.kind}:${n}`}function eW({sub:e,progressStep:t}){const n=tW(e,t);return a.jsxs("div",{className:"design-progress work-body",children:[a.jsxs("div",{className:"design-progress__hero",children:[a.jsx("span",{className:"design-progress__icon","aria-hidden":!0,children:a.jsx(V,{name:"sparkle",size:18,color:"#fff"})}),a.jsxs("div",{children:[a.jsx("div",{className:"design-progress__title",children:"正在生成工作流设计"}),a.jsx("div",{className:"design-progress__message",children:e.message})]})]}),a.jsx($k,{items:n})]})}function tW(e,t){const n=t??(e.kind==="discovery_preparing"?"discovery":"design"),s={discovery:0,design:1,render:3,done:4}[n];return[{id:"design-discovery",text:xo.discovery,status:Wl(0,s)},{id:"design-generate",text:e.kind==="generating"&&e.round!==null?`${xo.generate}(第 ${e.round} 轮)`:xo.generate,status:Wl(1,s)},{id:"design-validate",text:xo.validate,status:Wl(2,s)},{id:"design-render",text:xo.render,status:Wl(3,s)}]}function Wl(e,t){return t>=4||e<t?"done":e===t?"active":"pending"}const nW=GE();function XE(e){return Kg({id:"init-agents",title:"选择执行引擎",description:"本地已扫描到以下执行引擎,勾选后用于生成和执行工作流。",submitLabel:"确认引擎",questions:[{id:"agents",label:"可用执行引擎",type:"checkbox",required:!0,options:e.map(t=>({label:`${t.name}${t.detected?"":"(未检测)"}`,value:t.id,description:`${t.vendor} · ${t.capabilities.join(" / ")}`})),defaultValue:e.filter(t=>t.selected).map(t=>t.id),help:"未检测到的引擎需先安装 CLI。"}]})}const rW=XE(nW),sW=Kg({id:"init-table",title:"连接 AI 表格",description:"填写目标 Base Id;Table Id 可选,留空将自动新建一张 table。",submitLabel:"连接",questions:[{id:"baseId",label:"Base Id",type:"text",required:!0,placeholder:"如:ZQYprEoWoPLkorKyuBeBDRd9V1waOeDk",defaultValue:VU(),help:"AI 表格所在多维表格(Base)的节点 Id。"},{id:"tableId",label:"Table Id(可选)",type:"text",placeholder:"留空则新建 table",help:"不填时将在该 Base 下新建一张 table。"}]});Kg({id:"init-sop",title:"补充 SOP 指引",description:"SOP 不是越长越好,建议写清楚触发条件、处理步骤、人工把关点、异常升级规则。",submitLabel:"完成配置",questions:[{id:"sop",label:"用户 SOP / 处理规则",type:"textarea",placeholder:`建议格式:
308
+ 1. 什么时候触发流程?
309
+ 2. 每一步输入什么、产出什么?
310
+ 3. 哪些情况必须人工审核?
311
+ 4. 超时、失败、风险命中时通知谁?
312
+ 5. 哪些话术、动作或自动化行为必须避免?`,help:"可以先写要点,不需要一次写完;后续 design 阶段会再基于场景做澄清。"}]});const Kl=zU(),Wp=[{kind:"say",text:"欢迎!我们先做一次性配置,之后就能反复复用。第一步:扫描本地可用的执行引擎。"},{kind:"tool",label:"扫描本地执行引擎",detail:"Claude Code · Qoder · Codex",ms:900},{kind:"form",form:rW},{kind:"say",text:"引擎已就绪。接下来连接你的 AI 表格 —— 这是工作流读写数据的地方。"},{kind:"form",form:sW},{kind:"tool",label:"校验表格连接",detail:"connected",ms:800},{kind:"say",text:Kl.length>0?"表格已连接。接下来先构建角色。右侧已预置 HR 业务伙伴和法务顾问,你可以直接编辑人设、技能与共享知识库;确认角色后再补充 SOP。":"表格已连接。接下来构建角色。请在右侧添加角色并定义人设与共享知识库。参考示例:HR 业务伙伴、法务顾问。"},{kind:"do",run:()=>{if(Kl.length===0)return;const e=z.initDraft.roles,t=e.some(n=>n.name.includes("客服")||n.name.includes("排查")||n.name.includes("质检"));z.patchInitDraft({roles:e.length&&!t?e:Kl})}},{kind:"say",text:Kl.length>0?"角色已预置。请在右侧同一个界面里确认角色人设、技能、知识库,并按需补充 SOP;准备好后点击进入设计阶段。":"准备好后点击「下一步:设计 →」进入设计阶段。"}];function iW(e){const t=e.filter(n=>n.detected).map(n=>n.name);return[{kind:"say",text:"欢迎!我们先做一次性配置,之后就能反复复用。第一步:扫描本机可用的 coding agent。"},{kind:"tool",label:"扫描本机 coding agent",detail:t.join(" · ")||"未检测到已安装的 CLI",ms:400},{kind:"form",form:XE(e)},...Wp.slice(3)]}function oW({roles:e,onChange:t}){var p;const[n,r]=b.useState(((p=e[0])==null?void 0:p.id)??null),s=b.useRef(null),[i,o]=b.useState(null);function l(v,x){t(e.map(w=>w.id===v?{...w,...x}:w))}function c(){const v=`role_${Date.now().toString(36)}`,x={id:v,name:"",persona:"",skills:[],knowledge:[]};t([...e,x]),r(v)}function u(v){t(e.filter(x=>x.id!==v)),n===v&&r(null)}function d(v,x){const w=e.find(g=>g.id===v);w&&l(v,{knowledge:w.knowledge.filter(g=>g!==x)})}function f(v){var x;o(v),(x=s.current)==null||x.click()}function h(v){if(!i||!v.target.files)return;const x=e.find(g=>g.id===i);if(!x)return;const w=new Set(x.knowledge);for(const g of Array.from(v.target.files)){const y=g.webkitRelativePath.split("/");y.length>=1&&w.add(y[0])}l(i,{knowledge:Array.from(w)}),o(null),v.target.value=""}return a.jsxs("div",{className:"role-panel",children:[a.jsx("input",{ref:s,type:"file",style:{display:"none"},webkitdirectory:"",directory:"",multiple:!0,onChange:h}),e.length===0&&a.jsxs("div",{style:{padding:"8px 0"},children:[a.jsx("span",{className:"cfg-muted",children:"暂无角色。点击下方「添加角色」开始配置。"}),a.jsxs("div",{className:"cfg-muted",style:{marginTop:8,fontSize:12,lineHeight:1.6},children:[a.jsx("div",{children:"参考示例:"}),a.jsxs("div",{children:["· ",a.jsx("b",{children:"HR 业务伙伴"})," — 负责员工流程转化、制度核对、入职管理"]}),a.jsxs("div",{children:["· ",a.jsx("b",{children:"法务顾问"})," — 负责合同合规、风险识别、审批把关"]})]})]}),e.map(v=>{const x=n===v.id;return a.jsxs(Ye.div,{className:`role-item${x?" is-open":""}`,variants:St,initial:"hidden",animate:"visible",layout:!0,children:[a.jsxs("div",{className:"role-item__head",children:[a.jsxs("button",{type:"button",className:"role-item__toggle",onClick:()=>r(x?null:v.id),children:[a.jsx(V,{name:x?"chevron-down":"chevron-right",size:14}),a.jsx("span",{className:"role-item__avatar",children:a.jsx(V,{name:"user",size:13})}),a.jsx("input",{className:"role-item__name",value:v.name,onClick:w=>w.stopPropagation(),onChange:w=>l(v.id,{name:w.target.value}),placeholder:"角色名称"})]}),a.jsxs("span",{className:"role-item__summary",children:[v.knowledge.length," 知识库"]}),a.jsx("button",{type:"button",className:"role-item__remove",title:"删除角色",onClick:()=>u(v.id),children:a.jsx(V,{name:"close",size:13})})]}),x&&a.jsxs("div",{className:"role-item__body",children:[a.jsxs("div",{className:"role-field",children:[a.jsx("label",{className:"role-field__label",children:"人设(Persona)"}),a.jsx("textarea",{className:"qf-textarea role-persona",rows:3,value:v.persona,placeholder:"描述角色定位、职责与语气…",onChange:w=>l(v.id,{persona:w.target.value})})]}),a.jsxs("div",{className:"role-field",children:[a.jsx("label",{className:"role-field__label",children:"共享知识库"}),v.knowledge.length>0&&a.jsx("div",{className:"kb-folder-list",children:v.knowledge.map(w=>a.jsxs("span",{className:"kb-folder-chip",children:[a.jsx(V,{name:"file",size:12}),w,a.jsx("button",{type:"button",className:"kb-folder-chip__remove",onClick:()=>d(v.id,w),children:a.jsx(V,{name:"close",size:10})})]},w))}),a.jsxs("button",{type:"button",className:"kb-folder-pick",onClick:()=>f(v.id),children:[a.jsx(V,{name:"plus",size:14}),"选择本地文件夹"]})]})]})]},v.id)}),a.jsxs("button",{type:"button",className:"role-add",onClick:c,children:[a.jsx(V,{name:"plus",size:14})," 添加角色"]})]})}const aW={claude:"Claude",qoder:"Qoder",codex:"Codex",qwenwork:"千问办公",llm:"LLM"},Kp={claudecode:"Claude",codex:"Codex",qoder:"Qoder",codebuddy:"Codebuddy",opencode:"OpenCode",qwen:"Qwen",deepseek:"DeepSeek",trae:"Trae",qwenwork:"千问办公"};function lW(e){return e==="claudecode"?"claude":e==="codex"?"codex":e==="qoder"?"qoder":e==="qwenwork"?"qwenwork":null}function Gl({icon:e,title:t,done:n,wide:r,children:s}){return a.jsxs("div",{className:`cfg-card${n?" is-done":""}${r?" cfg-card--wide":""}`,children:[a.jsxs("div",{className:"cfg-card__head",children:[a.jsx("span",{className:"cfg-card__icon",children:a.jsx(V,{name:e,size:15})}),a.jsx("span",{className:"cfg-card__title",children:t}),a.jsx("span",{className:`cfg-card__status${n?" is-done":""}`,children:n?a.jsxs(a.Fragment,{children:[a.jsx(V,{name:"check",size:12})," 已配置"]}):"待配置"})]}),a.jsx("div",{className:"cfg-card__body",children:s})]})}function cW({machines:e,selectedId:t,onSelect:n,loading:r,error:s,onRetry:i}){const o=e.filter(c=>c.status==="online"),l=e.filter(c=>c.status==="offline");return r?a.jsx("span",{className:"cfg-muted",children:"正在获取执行引擎列表..."}):s?a.jsxs("div",{className:"engine-empty",children:[a.jsx("div",{className:"engine-empty__text",children:"⚠️ 获取执行引擎列表失败,请检查网络或稍后重试。"}),a.jsx("button",{type:"button",className:"engine-empty__link",onClick:i,children:"重试"})]}):e.length===0?a.jsx("div",{className:"engine-empty",children:a.jsxs("div",{className:"engine-empty__text",children:["⚠️ 没有注册的执行引擎。请先前往",a.jsx("button",{type:"button",className:"engine-empty__link",onClick:()=>z.setRoute("engines"),children:"执行引擎管理"}),"注册 daemon 机器。"]})}):o.length===0?a.jsxs("div",{className:"engine-empty",children:[a.jsxs("div",{className:"engine-empty__text",children:["⚠️ 没有在线的执行引擎(共 ",e.length," 台已注册)。请启动 daemon 反连。"]}),a.jsx("button",{type:"button",className:"engine-empty__link",onClick:()=>z.setRoute("engines"),children:"前往执行引擎管理"})]}):a.jsxs("div",{className:"engine-selector",children:[o.length>0&&a.jsxs("div",{className:"engine-selector__group",children:[a.jsxs("div",{className:"engine-selector__label",children:["在线 (",o.length,")"]}),o.map(c=>{const u=(c.runtimes??[]).map(lW).filter(d=>d!==null);return a.jsxs("button",{type:"button",className:`engine-option${t===c.machineId?" is-selected":""}`,onClick:()=>n(c.machineId,u),children:[a.jsx("span",{className:"machine-status machine-status--online"}),a.jsxs("span",{className:"engine-option__info",children:[a.jsx("span",{className:"engine-option__name",children:c.displayName||c.name}),a.jsxs("span",{className:"engine-option__caps",children:[c.runtimes.map(d=>Kp[d]??d).join(" · "),c.hasDws&&" · dws ✓"]})]}),t===c.machineId&&a.jsx(V,{name:"check",size:14,color:"var(--accent)"})]},c.machineId)})]}),l.length>0&&a.jsxs("div",{className:"engine-selector__group",children:[a.jsxs("div",{className:"engine-selector__label",children:["离线 (",l.length,")"]}),l.map(c=>a.jsxs("div",{className:"engine-option engine-option--disabled",children:[a.jsx("span",{className:"machine-status machine-status--offline"}),a.jsxs("span",{className:"engine-option__info",children:[a.jsx("span",{className:"engine-option__name",children:c.displayName||c.name}),a.jsx("span",{className:"engine-option__caps",children:"离线 · 不可选"})]})]},c.machineId))]})]})}const uW=ut(function(){const t=b.useRef();t.current||(t.current=new Gg);const n=t.current,r=b.useRef(!1),s=z.initDraft;z.mode;const i=z.projectId,[o,l]=b.useState(!1),[c,u]=b.useState(!1),d=z.stageRuntime.init.status==="succeeded",[f,h]=b.useState([]),[p,v]=b.useState(it),[x,w]=b.useState(!1),[g,y]=b.useState(GE()),m=b.useCallback(async()=>{v(!0);try{const A=await qg();h(A),w(!1)}catch{w(!0)}finally{v(!1)}},[]);b.useEffect(()=>{it&&m()},[m]);const _=f.find(A=>A.machineId===s.selectedMachineId&&A.status==="online"),j=it&&!p&&!!s.selectedMachineId&&!_,N=it?!p&&!!_&&s.agentsSelected.length>0:!0;b.useEffect(()=>{if(n.onFormSubmit=(A,C)=>{A==="init-agents"?z.patchInitDraft({agentsSelected:C.agents??[]}):A==="init-table"?z.patchInitDraft({tableConnected:!0,tableBaseId:String(C.baseId??""),tableId:String(C.tableId??"")}):A==="init-sop"&&z.patchInitDraft({sop:String(C.sop??"")})},!r.current){r.current=!0;const A=z.stageRuntime.init.status==="succeeded";ue&&A?n.run([{kind:"say",text:"配置已完成,可直接进入设计阶段。"}]):it?n.run([{kind:"say",text:"请在右侧选择执行引擎,然后继续完成后续配置。"}]):ue?(async()=>{const C=await DU();y(C),await n.run(iW(C))})():n.run(Wp)}return()=>{n.onFormSubmit=null}},[n]);const k=b.useRef("");b.useEffect(()=>{if(!it||!N||!_||k.current===_.machineId)return;k.current=_.machineId;const A=Wp.slice(3),C=`${_.displayName||_.name}(${_.runtimes.map(M=>Kp[M]??M).join(" · ")}${_.hasDws?" · dws ✓":""})`;n.run([{kind:"say",text:`✅ 执行引擎已选定:${C}
313
+
314
+ 接下来配置 AI 表格、模型服务、角色和 SOP。`},...A])},[N,_,n]);const S=s.agentsSelected.length>0,P=ue?N&&S&&s.roles.length>0:s.roles.length>0,[$,D]=b.useState(null);function I(A,C){z.patchInitDraft({selectedMachineId:A,agentsSelected:C});const M=z.projectId;M&&lk(M,A)}async function O(){const A=qE(z.validationContext,"init");if(z.setValidation("init",A),!A.ok){D(A);return}if(u(!0),ue){l(!0);try{await ok();let C=i;C||(await n.run([{kind:"tool",label:"创建真实项目工作区",detail:".sandbox/projects",ms:360}]),C=(await $g()).id),await n.run([{kind:"tool",label:"写入真实配置",detail:"config / roles / recipes",ms:420}]);const M={...z.initDraft,machineId:z.initDraft.selectedMachineId||void 0},T=await ZD(C,M);z.setProjects(ka(z.projects,T.project)),await ba(T.project.id,{applyRecommendedStage:!1}),await n.run([{kind:"say",text:T.warnings.length?`真实配置已生成。注意:${T.warnings[0]}`:"真实配置已生成:config、coding agent 配置和 roles 都已落盘。"}])}catch(C){await n.run([{kind:"say",text:`真实 init 失败:${C instanceof Error?C.message:String(C)}`}]),l(!1),u(!1);return}l(!1)}z.setRoute("design")}const E=c?a.jsx("div",{className:"work-body",style:{padding:16},children:a.jsx("div",{className:"empty-hint",children:ue?"正在写入真实配置并准备进入设计阶段…":"正在进入设计阶段…"})}):a.jsxs("div",{className:"work-body",style:{padding:16},children:[a.jsxs("div",{className:"cfg-grid",children:[it&&a.jsx(Gl,{icon:"bolt",title:"执行引擎",done:N,children:N&&_?a.jsxs("div",{className:"engine-selected",children:[a.jsx("span",{className:"machine-status machine-status--online"}),a.jsx("span",{children:_.displayName||_.name}),a.jsx("span",{className:"cfg-muted",style:{marginLeft:8},children:_.runtimes.map(A=>Kp[A]??A).join(" · ")}),a.jsx("button",{type:"button",className:"engine-change-btn",onClick:()=>{z.patchInitDraft({selectedMachineId:"",agentsSelected:[]}),k.current=""},children:"更换"})]}):a.jsxs(a.Fragment,{children:[j&&a.jsx("div",{className:"engine-empty",children:a.jsxs("div",{className:"engine-empty__text",children:["⚠️ 此前绑定的执行引擎当前不可用(已离线或被移除),请重新选择或前往",a.jsx("button",{type:"button",className:"engine-empty__link",onClick:()=>z.setRoute("engines"),children:"执行引擎管理"}),"。"]})}),a.jsx(cW,{machines:f,selectedId:s.selectedMachineId,onSelect:I,loading:p,error:x,onRetry:()=>void m()})]})}),!it&&a.jsx(Gl,{icon:"robot",title:"Agent 引擎",done:S,children:S?a.jsx("div",{className:"agent-chips",children:s.agentsSelected.map(A=>a.jsxs("span",{className:"agent-chip",style:{"--c":`var(--agent-${A})`},children:[a.jsx("span",{className:"agent-chip__dot"}),aW[A]]},A))}):a.jsxs("span",{className:"cfg-muted",children:["待扫描 · ",g.filter(A=>A.detected).length," 个已检测"]})}),a.jsx(Gl,{icon:"user",title:"角色",done:s.roles.length>0,wide:!0,children:a.jsx(oW,{roles:s.roles,onChange:A=>z.patchInitDraft({roles:A})})}),a.jsx(Gl,{icon:"file",title:"SOP 指引",done:!!s.sop,wide:!0,children:a.jsxs("div",{className:"role-field",children:[a.jsx("label",{className:"role-field__label",children:"用户 SOP / 处理规则(可选)"}),a.jsx("textarea",{className:"qf-textarea role-persona",rows:5,value:s.sop,placeholder:`建议格式:
315
+ 1. 什么时候触发流程?
316
+ 2. 每一步输入什么、产出什么?
317
+ 3. 哪些情况必须人工审核?
318
+ 4. 超时、失败、风险命中时通知谁?
319
+ 5. 哪些话术、动作或自动化行为必须避免?`,onChange:A=>z.patchInitDraft({sop:A.target.value})}),a.jsx("span",{className:"cfg-muted",children:"可以先写要点,不需要一次写完;Design 阶段会继续澄清。"})]})}),P||d?a.jsxs("div",{className:"cfg-cta",children:[a.jsxs("div",{className:"cfg-cta__text",children:[a.jsx(V,{name:"check",size:16}),"配置完成,可以进入设计阶段"]}),a.jsx("button",{type:"button",className:"primary cfg-cta__btn",onClick:()=>void O(),disabled:o,children:o?"写入配置中...":"下一步:设计 →"})]}):a.jsxs("div",{className:"cfg-cta cfg-cta--pending",children:[a.jsxs("div",{className:"cfg-cta__text cfg-cta__text--pending",children:[a.jsx(V,{name:"warn",size:16}),s.roles.length===0?"请至少添加一个角色后继续":"请完成上方配置后继续"]}),a.jsx("button",{type:"button",className:"primary cfg-cta__btn",disabled:!0,children:"下一步:设计 →"})]})]}),$&&!$.ok&&a.jsx(Bk,{title:"无法进入设计阶段",missing:$.missing,warnings:$.warnings,onClose:()=>D(null),onLocate:A=>{D(null)}})]});return a.jsx(hu,{chat:n,chatTitle:"一次性配置向导",chatSubtitle:`${it?"执行引擎 · ":""}角色 · SOP · ${ue?"真实模式":"演示模式"}`,work:E})}),ir=FU(),gv=(ir==null?void 0:ir.fields)??[],Vf=(ir==null?void 0:ir.views)??[],qx=gv.filter(e=>e.group==="business"),Yx=gv.filter(e=>e.group==="process");function Xx(e){return[{kind:"do",run:()=>z.addMockField(e)},{kind:"wait",ms:130}]}function dW(e){return[{kind:"do",run:()=>z.addMockView(e)},{kind:"wait",ms:260}]}const fW=[{kind:"say",text:"开始搭建演示 AI 表格。我会依次创建字段、视图,并绑定事件源。"},{kind:"todo",items:["创建业务字段","创建流程字段","创建视图","绑定事件源 · 生成链接"]},{kind:"tool",label:"创建业务字段",detail:`${qx.length} 个`,ms:520},...qx.flatMap(Xx),{kind:"todo-advance"},{kind:"tool",label:"创建流程字段",detail:`${Yx.length} 个`,ms:520},...Yx.flatMap(Xx),{kind:"todo-advance"},{kind:"tool",label:"创建视图",detail:`${Vf.length} 个`,ms:520},...Vf.flatMap(dW),{kind:"todo-advance"},{kind:"tool",label:"绑定事件源 · 新记录触发",detail:"on_record_created",ms:760},{kind:"do",run:()=>{if(!ir)return;const e=z.initDraft,t=e.tableBaseId||ir.tableBaseId,n=e.tableId||ir.tableSheetId;z.setMockTableUrl(WE(t,n))}},{kind:"todo-advance"},{kind:"say",text:`搭建完成:${gv.length} 字段 · ${Vf.length} 视图已就绪,事件源已绑定。可打开 AI 表格,或进入「运行」阶段启动工作流。`}];function Qx(e){return e.isLive?String(e.current):`${e.current}/${e.mockTotal}`}const hW={grid:"表格",kanban:"看板",calendar:"日历",form:"表单",gantt:"甘特"},Zx={text:"文本",single_select:"单选",user:"成员",datetime:"日期",number:"数字"},pW=ut(function(){var I,O,E,A,C;const t=b.useRef();t.current||(t.current=new Gg);const n=t.current,r=b.useRef(!1),[s,i]=b.useState(!1),[o,l]=b.useState(""),[c,u]=b.useState(!1),d=z.view,f=d.kind==="setup"?d:null,h=(f==null?void 0:f.schema.fields)??[],p=(f==null?void 0:f.schema.views)??[],v=(f==null?void 0:f.tableUrl)??null,x=z.mode,w=z.projectId,g=z.stageRuntime.setup,y=x==="live",m=((f==null?void 0:f.gate.kind)??"open")==="open";Yg("setup",n),b.useEffect(()=>{r.current||!m||(r.current=!0,n.run([{kind:"say",text:"工作流已就绪。准备好后点击右侧「开始搭建」,我会自动创建 AI 表格的字段与视图。"}]))},[n,m]),b.useEffect(()=>{(g.status==="blocked"||g.status==="failed"||g.status==="succeeded")&&i(!1)},[g.status]);function _(){if(x==="live"&&!m){n.run([{kind:"say",text:"当前流程还没有完成设计,请先回到设计阶段生成 workflow 和 recipes。"}]);return}const M=g.status==="blocked"||g.status==="failed";if(!(g.status==="running"||s&&!M)){if(i(!0),x==="live"){w?Na("setup",w,n).finally(()=>i(!1)):(i(!1),n.run([{kind:"say",text:"缺少真实项目工作区,请先返回 Init 阶段完成真实配置。"}]));return}n.run(fW).finally(()=>i(!1))}}async function j(){const M=o.trim();if(!(!w||!M||c||s&&g.status==="running")){u(!0);try{const T=await JD(w,M);z.applySnapshotPatch(w,{files:T.files,projectState:T.state}),z.patchInitDraft({tableConnected:!0,tableId:M}),await n.run([{kind:"say",text:`已写回 Table Id:${M},继续搭建字段与视图。`}]),i(!0),await Na("setup",w,n)}catch(T){const R=T instanceof Error?T.message:String(T);await n.run([{kind:"say",text:`写回 Table Id 失败:${R}`}])}finally{u(!1),i(!1)}}}const N=h.filter(M=>M.group==="business"),k=h.filter(M=>M.group==="process"),S=x==="live"?g.status==="succeeded":!!v||g.status==="succeeded",P=s||g.status!=="idle"||S,$=(f==null?void 0:f.recovery)==="manual_table_id";if(!m)return a.jsx(hu,{chat:n,chatTitle:"AI 表格搭建",chatSubtitle:"创建字段 · 视图 · 绑定事件源",chatEmptyHint:"当前流程尚未到达搭建阶段",onSend:M=>{n.addUserMessage(M),n.run([{kind:"say",text:"当前流程还没有完成设计,请先回到设计阶段生成工作流。"}])},workHead:a.jsxs("div",{className:"work-head",children:[a.jsx(V,{name:"table",size:16}),a.jsx("div",{className:"work-head__title",children:"AI 表格"}),a.jsx("div",{className:"work-head__sub",children:"未到达"})]}),work:a.jsx("div",{className:"work-body setup-theater",children:a.jsxs("div",{className:"setup-intro",children:[a.jsx("div",{className:"setup-intro__icon",children:a.jsx(V,{name:"flow",size:30,color:"#fff"})}),a.jsx("h3",{className:"setup-intro__title",children:"当前流程尚未完成设计"}),a.jsx("p",{className:"setup-intro__desc",children:"搭建阶段必须使用当前流程实例生成的 workflow 和 recipes。请先回到设计阶段完成真实工作流生成。"}),a.jsxs("button",{type:"button",className:"primary setup-intro__cta",onClick:()=>z.setRoute("design"),children:[a.jsx(V,{name:"chevron-right",size:15,color:"#fff"}),"返回设计阶段"]})]})})});const D=a.jsx("div",{className:"work-body setup-theater",children:P?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"setup-section",children:[a.jsxs("div",{className:"setup-section__head",children:[a.jsx(V,{name:g.status==="blocked"||g.status==="failed"?"sparkle":"table",size:14}),g.status==="blocked"?"等待授权":g.status==="failed"?"搭建失败":g.status==="succeeded"?"搭建完成":"搭建进度"]}),a.jsx("p",{className:"setup-intro__desc",children:g.message}),((I=g.block)==null?void 0:I.help)&&a.jsx("p",{className:"setup-intro__desc",children:g.block.help}),$&&a.jsxs("div",{className:"setup-recovery-card",children:[a.jsx("div",{className:"setup-recovery-card__title",children:"如果数据表已创建,请填入 Table Id 后继续"}),a.jsx("p",{className:"setup-recovery-card__desc",children:"当前失败点在建表返回值解析,直接重试可能会重复失败。请先到 AI 表格确认目标数据表,复制 table_id 后继续创建字段与视图。"}),a.jsxs("div",{className:"setup-recovery-card__form",children:[a.jsx("input",{value:o,onChange:M=>l(M.target.value),placeholder:"例如:tblxxxxxxxxxxxx","aria-label":"Table Id"}),a.jsxs("button",{type:"button",className:"primary",onClick:()=>{j()},disabled:!o.trim()||c||s&&g.status==="running",children:[a.jsx(V,{name:"play",size:15,color:"#fff"}),c?"保存中…":"保存并继续搭建"]})]})]}),(g.status==="blocked"||g.status==="failed")&&a.jsxs("button",{type:"button",className:"primary setup-intro__cta",onClick:_,children:[a.jsx(V,{name:"play",size:15,color:"#fff"}),((O=g.recoveryAction)==null?void 0:O.label)??((E=g.block)==null?void 0:E.actionLabel)??"重试搭建"]})]}),S&&a.jsxs(Ye.div,{className:"table-link-card",variants:St,initial:"hidden",animate:"visible",children:[a.jsxs("div",{className:"table-link-card__info",children:[a.jsx("span",{className:"table-link-card__badge",children:a.jsx(V,{name:"check",size:13,color:"#fff"})}),a.jsxs("div",{children:[a.jsx("div",{className:"table-link-card__title",children:"AI 表格已就绪"}),a.jsxs("div",{className:"table-link-card__sub",children:[h.length," 字段 · ",p.length," 视图 · 事件源已绑定"]})]})]}),a.jsxs("a",{className:"primary table-link-card__open",href:v??"#",target:"_blank",rel:"noreferrer",children:[a.jsx(V,{name:"link",size:14,color:"#fff"}),"打开 AI 表格"]})]}),a.jsxs("div",{className:"setup-section",children:[a.jsxs("div",{className:"setup-section__head",children:[a.jsx(V,{name:"table",size:14}),"字段",a.jsx("span",{className:"setup-section__count",children:Qx({current:h.length,mockTotal:((A=zf())==null?void 0:A.fieldCount)??0,isLive:y})})]}),N.length>0&&a.jsx("div",{className:"setup-group-label",children:"业务字段"}),a.jsx("div",{className:"field-grid",children:N.map(M=>a.jsxs(Ye.div,{className:"field-chip",variants:St,initial:"hidden",animate:"visible",children:[a.jsx("span",{className:"field-chip__name",children:M.name}),a.jsx("span",{className:"field-chip__type",children:Zx[M.type]??M.type})]},M.id))}),k.length>0&&a.jsx("div",{className:"setup-group-label",children:"流程字段"}),a.jsx("div",{className:"field-grid",children:k.map(M=>a.jsxs(Ye.div,{className:"field-chip field-chip--process",variants:St,initial:"hidden",animate:"visible",children:[a.jsx("span",{className:"field-chip__name",children:M.name}),a.jsx("span",{className:"field-chip__type",children:Zx[M.type]??M.type})]},M.id))})]}),p.length>0&&a.jsxs("div",{className:"setup-section",children:[a.jsxs("div",{className:"setup-section__head",children:[a.jsx(V,{name:"flow",size:14}),"视图",a.jsx("span",{className:"setup-section__count",children:Qx({current:p.length,mockTotal:((C=zf())==null?void 0:C.viewCount)??0,isLive:y})})]}),a.jsx("div",{className:"view-grid",children:p.map(M=>a.jsxs(Ye.div,{className:"view-card",variants:St,initial:"hidden",animate:"visible",children:[a.jsx("span",{className:`view-card__kind view-card__kind--${M.kind}`,children:hW[M.kind]}),a.jsx("div",{className:"view-card__name",children:M.name}),a.jsx("div",{className:"view-card__desc",children:M.desc})]},M.id))})]}),S&&a.jsxs("div",{className:"cfg-cta",children:[a.jsxs("div",{className:"cfg-cta__text",children:[a.jsx(V,{name:"check",size:16}),"表格搭建完成,可进入试运行验证流程。"]}),a.jsxs("button",{type:"button",className:"primary",onClick:()=>z.setRoute("test"),children:["进入试运行",a.jsx(V,{name:"chevron-right",size:15,color:"#fff"})]})]})]}):a.jsxs("div",{className:"setup-intro",children:[a.jsx("div",{className:"setup-intro__icon",children:a.jsx(V,{name:"table",size:30,color:"#fff"})}),a.jsx("h3",{className:"setup-intro__title",children:x==="live"?"搭建真实 AI 表格结构":"搭建演示 AI 表格结构"}),a.jsx("p",{className:"setup-intro__desc",children:x==="live"?"将根据真实工作流方案创建字段与视图,并绑定新记录触发方式。":(()=>{const M=zf();return`将创建 ${(M==null?void 0:M.fieldCount)??0} 个示例字段、${(M==null?void 0:M.viewCount)??0} 个示例视图,并绑定新记录触发方式。`})()}),a.jsxs("button",{type:"button",className:"primary setup-intro__cta",onClick:_,children:[a.jsx(V,{name:"play",size:15,color:"#fff"}),"开始搭建"]})]})});return a.jsx(hu,{chat:n,chatTitle:"AI 表格搭建",chatSubtitle:"创建字段 · 视图 · 绑定事件源",chatEmptyHint:"agent 正在准备建表…",onSend:M=>{n.addUserMessage(M),n.run([{kind:"say",text:"好的,我会据此调整表结构。"}])},workHead:a.jsxs("div",{className:"work-head",children:[a.jsx(V,{name:"table",size:16}),a.jsx("div",{className:"work-head__title",children:"AI 表格"}),a.jsx("div",{className:"work-head__sub",children:S?"已就绪":g.status==="blocked"?"等待授权":g.status==="failed"?"可重试":P?"搭建中":"待搭建"})]}),work:D})}),Ff=e=>new Promise(t=>setTimeout(t,e));async function mW(e,t,n){for(let r=0;r<e.length;r++){if(n!=null&&n.aborted)return;const s=e[r];if(t({type:"step-start",stepIndex:r,step:s}),await Ff(300),n!=null&&n.aborted||(t({type:"step-ai",stepIndex:r,step:s}),await Ff(500),n!=null&&n.aborted)||(t({type:"step-done",stepIndex:r,step:s}),r<e.length-1&&(await Ff(400),n!=null&&n.aborted)))return}t({type:"all-done",stepIndex:e.length-1})}const gW={info:"dot",ai:"sparkle",ok:"check",warn:"warn",error:"close"},vW=ut(function(){const t=z.view,n=t.kind==="test"?t:null,r=z.steps;z.mode,z.projectId;const s=z.tableUrl,i=((n==null?void 0:n.gate.kind)??"open")==="open",[o,l]=b.useState("guide"),[c,u]=b.useState([]),[d,f]=b.useState(-1),[h,p]=b.useState(null),v=b.useRef(null);if(!i)return a.jsx("div",{className:"split split--chatonly",children:a.jsxs("div",{className:"split__work",children:[a.jsxs("div",{className:"work-head",children:[a.jsx(V,{name:"sparkle",size:16}),a.jsx("div",{className:"work-head__title",children:"试运行"}),a.jsx("div",{className:"work-head__sub",children:"未到达"})]}),a.jsx("div",{className:"work-body",children:a.jsxs("div",{className:"test-intro",children:[a.jsx("div",{className:"test-intro__icon",children:a.jsx(V,{name:"table",size:28,color:"#fff"})}),a.jsx("h3",{className:"test-intro__title",children:"当前流程尚未完成搭建"}),a.jsx("p",{className:"test-intro__desc",children:"试运行阶段必须基于已搭建完成的 AI 表格。请先完成搭建阶段。"}),a.jsxs("button",{type:"button",className:"primary test-intro__cta",onClick:()=>z.setRoute("setup"),children:[a.jsx(V,{name:"chevron-right",size:15,color:"#fff"}),"返回搭建阶段"]})]})})]})});async function x(){var g;l("running"),u([]),f(0),p(null),(g=v.current)==null||g.abort();const w=new AbortController;v.current=w,await mW(r,y=>{y.type==="step-start"?(f(y.stepIndex),u(m=>[...m,{id:`log_${y.step.id}_start_${Date.now().toString(36)}`,ts:Date.now(),ticketId:"test",stepId:y.step.id,level:"info",text:`开始执行步骤: ${y.step.name}`}])):y.type==="step-ai"?u(m=>[...m,{id:`log_${y.step.id}_ai_${Date.now().toString(36)}`,ts:Date.now(),ticketId:"test",stepId:y.step.id,level:y.step.requiresAgent?"ai":"info",text:y.step.requiresAgent?`AI Agent 执行 ${y.step.recipe}...`:`自动处理 ${y.step.recipe}...`}]):y.type==="step-done"?u(m=>[...m,{id:`log_${y.step.id}_done_${Date.now().toString(36)}`,ts:Date.now(),ticketId:"test",stepId:y.step.id,level:"ok",text:`步骤 ${y.step.name} 完成`}]):y.type==="all-done"&&(l("success"),f(-1),u(m=>[...m,{id:`log_test_done_${Date.now().toString(36)}`,ts:Date.now(),ticketId:"test",stepId:"test",level:"ok",text:"全部步骤执行成功,试运行通过!"}]))},w.signal)}return a.jsxs("div",{className:"test-stage",children:[a.jsxs("div",{className:"test-main",children:[a.jsxs("div",{className:"test-main__head",children:[a.jsx(V,{name:"sparkle",size:16}),a.jsx("div",{className:"work-head__title",children:"试运行"}),a.jsx("div",{className:"work-head__sub",children:o==="guide"?"待开始":o==="running"?"执行中":o==="success"?"通过":"失败"}),o==="success"&&a.jsxs("button",{type:"button",className:"primary work-head__cta",onClick:()=>z.setRoute("run"),children:["进入正式运行",a.jsx(V,{name:"chevron-right",size:14,color:"#fff"})]})]}),o==="guide"&&a.jsxs("div",{className:"test-guide",children:[a.jsx("div",{className:"test-guide__icon",children:a.jsx(V,{name:"sparkle",size:30,color:"#fff"})}),a.jsx("h3",{className:"test-guide__title",children:"用一条真实记录验证整条流程"}),a.jsxs("div",{className:"test-guide__steps",children:[a.jsxs("div",{className:"test-guide__step",children:[a.jsx("span",{className:"test-guide__step-num",children:"1"}),a.jsx("span",{children:"打开 AI 表格"}),a.jsxs("a",{className:"test-guide__link",href:s??"#",target:"_blank",rel:"noreferrer",children:[a.jsx(V,{name:"link",size:12})," 打开表格"]})]}),a.jsxs("div",{className:"test-guide__step",children:[a.jsx("span",{className:"test-guide__step-num",children:"2"}),a.jsx("span",{children:"新增一条记录,填写必选字段"})]}),a.jsxs("div",{className:"test-guide__step",children:[a.jsx("span",{className:"test-guide__step-num",children:"3"}),a.jsx("span",{children:"回到这里点「开始试运行」"})]})]}),a.jsxs("button",{type:"button",className:"primary test-guide__cta",onClick:()=>void x(),children:[a.jsx(V,{name:"play",size:15,color:"#fff"}),"开始试运行"]})]}),o==="success"&&a.jsxs("div",{className:"test-result test-result--success",children:[a.jsx("span",{className:"test-result__icon test-result__icon--success",children:a.jsx(V,{name:"check",size:24,color:"#fff"})}),a.jsx("h3",{className:"test-result__title",children:"试运行通过"}),a.jsxs("p",{className:"test-result__desc",children:["全部 ",r.length," 个步骤执行成功。可以进入正式运行阶段。"]}),a.jsxs("button",{type:"button",className:"primary test-result__cta",onClick:()=>z.setRoute("run"),children:["进入正式运行",a.jsx(V,{name:"chevron-right",size:14,color:"#fff"})]})]}),o==="failed"&&h&&a.jsxs("div",{className:"test-result test-result--failed",children:[a.jsx("span",{className:"test-result__icon test-result__icon--failed",children:a.jsx(V,{name:"close",size:24,color:"#fff"})}),a.jsxs("h3",{className:"test-result__title",children:["试运行在「",h.step.name,"」步骤失败"]}),a.jsx("p",{className:"test-result__desc",children:h.reason}),a.jsxs("div",{className:"test-result__actions",children:[a.jsx("button",{type:"button",className:"test-result__btn",onClick:()=>{l("guide")},children:"查看完整日志"}),a.jsx("button",{type:"button",className:"primary test-result__btn",onClick:()=>z.setRoute("design"),children:"去修正该步骤配置 →"})]})]})]}),a.jsxs("div",{className:"test-flow",children:[a.jsx("div",{className:"test-flow__head",children:"步骤流转"}),a.jsx("div",{className:"step-chain",children:r.map((w,g)=>{const y=o==="success"||g<d?"done":g===d?"active":"pending";return a.jsxs("div",{className:`chain-node is-${y}`,children:[g>0&&a.jsx("div",{className:`chain-node__line is-${y}`}),a.jsxs("div",{className:"chain-node__row",children:[a.jsx("span",{className:"chain-node__dot",children:y==="done"?a.jsx(V,{name:"check",size:12,color:"#fff"}):y==="active"?a.jsx("span",{className:"chain-node__pulse"}):a.jsx("span",{className:"chain-node__idle"})}),a.jsxs("div",{className:"chain-node__body",children:[a.jsxs("div",{className:"chain-node__name",children:[a.jsx("span",{className:"chain-node__label",children:w.name}),w.requiresAgent&&a.jsx("span",{className:"chain-node__engine",style:{"--c":"var(--agent-llm)"},children:"AI"}),!w.requiresAgent&&a.jsx("span",{className:"pill pill--muted",children:"自动"})]}),a.jsx("div",{className:"chain-node__recipe",children:w.recipe})]})]})]},w.id)})})]}),a.jsxs("div",{className:"test-logs",children:[a.jsxs("div",{className:"test-logs__head",children:[a.jsx(V,{name:"file",size:14}),"试运行日志"]}),a.jsx("div",{className:"test-logs__body",children:c.length===0?a.jsx("div",{className:"empty-hint",style:{padding:20},children:"点击「开始试运行」后,这里会显示实时执行日志"}):a.jsx(Ho,{initial:!1,children:c.map(w=>{var g;return a.jsxs(Ye.div,{layout:!0,variants:St,initial:"hidden",animate:"visible",className:`log-line log-line--${w.level}`,children:[a.jsx("span",{className:"log-line__icon",children:a.jsx(V,{name:gW[w.level],size:11})}),a.jsxs("div",{className:"log-line__content",children:[a.jsx("span",{className:"log-line__step",children:((g=r.find(y=>y.id===w.stepId))==null?void 0:g.name)??w.stepId}),a.jsx("span",{className:"log-line__text",children:w.text})]})]},w.id)})})})]})]})}),yW={classify:[{level:"info",text:"读取工单「{title}」标题与问题描述"},{level:"ai",text:"调用分类模型判定问题类型与紧急程度…"},{level:"ok",text:"判定为「{category}」· {priority}"}],investigate:[{level:"info",text:"检索知识库与历史相似工单"},{level:"ai",text:"Qoder 分析根因,生成排查路径…"},{level:"ok",text:"定位可能原因,产出解决方案草案"}],draft_reply:[{level:"info",text:"载入解决方案与客户「{customer}」信息"},{level:"ai",text:"以「亲和友好」语气生成回复草稿…"},{level:"ok",text:"回复草稿已生成,进入质检"}],quality_check:[{level:"warn",text:"命中人工审核卡点,暂停等待复核"},{level:"info",text:"请在步骤卡片点击「通过」或「驳回」"}],send_reply:[{level:"ai",text:"渲染最终回复并校验敏感词…"},{level:"ok",text:"已发送给客户「{customer}」,工单关闭"}]},_W=[{level:"warn",text:"人工驳回,退回「草拟回复」重写"},{level:"ai",text:"参考驳回意见重新生成回复…"},{level:"ok",text:"新草稿已生成,再次送审"}],xW={classify:1400,investigate:2e3,draft_reply:1700,quality_check:0,send_reply:1400},wW=3200,bW=520;function jW(e,t){return e.replace("{title}",t.title).replace("{customer}",t.customer).replace("{category}",t.category).replace("{priority}",t.priority)}const Ei=KE(),SW=(Ei==null?void 0:Ei.steps)??[],Bf=(Ei==null?void 0:Ei.incomingTickets)??[],Hf=e=>new Promise(t=>setTimeout(t,e));let kW=0;const Jx=e=>`${e}_${(kW++).toString(36)}`;class NW{constructor(){le(this,"state",{running:!1,arrived:0,total:Bf.length});le(this,"listeners",new Set);le(this,"approvals",new Map);le(this,"subscribe",t=>(this.listeners.add(t),()=>this.listeners.delete(t)));le(this,"getState",()=>this.state)}emit(){this.listeners.forEach(t=>t())}set(t){this.state={...this.state,...t},this.emit()}log(t,n,r,s){z.appendLog({id:Jx("log"),ts:Date.now(),ticketId:t,stepId:n,level:r,text:s})}start(){this.state.running||(this.set({running:!0}),this.spawn())}isAwaiting(t){return this.approvals.has(t)}approve(t){var n;(n=this.approvals.get(t))==null||n(!0)}reject(t){var n;(n=this.approvals.get(t))==null||n(!1)}async spawn(){for(let t=0;t<Bf.length;t++){if(!this.state.running)return;const n=Bf[t],r={id:Jx("tk"),title:n.title,customer:n.customer,category:n.category,priority:n.priority,status:"todo",currentStepId:null,doneStepIds:[],createdAt:Date.now()};z.addTicket(r),this.set({arrived:this.state.arrived+1}),this.process(r.id,n),await Hf(wW)}}markDone(t,n){const r=z.live.tickets.find(s=>s.id===t);r&&z.updateTicket(t,{doneStepIds:[...r.doneStepIds,n]})}async streamLogs(t,n,r,s){for(const i of s){if(!this.state.running)return;this.log(t,n,i.level,jW(i.text,r)),await Hf(bW)}}async process(t,n){for(const r of SW){if(!this.state.running)return;const s=r.needsHuman?"review":"running";if(z.updateTicket(t,{currentStepId:r.id,status:s}),await this.streamLogs(t,r.id,n,yW[r.id]??[]),r.needsHuman){let i=!1;for(;!i&&this.state.running;)if(i=await this.awaitApproval(t),!i){z.updateTicket(t,{currentStepId:"draft_reply",status:"running"});const o=z.live.tickets.find(l=>l.id===t);o&&z.updateTicket(t,{doneStepIds:o.doneStepIds.filter(l=>l!=="draft_reply")}),await this.streamLogs(t,"draft_reply",n,_W),this.markDone(t,"draft_reply"),z.updateTicket(t,{currentStepId:r.id,status:"review"})}if(!this.state.running)return}else await Hf(xW[r.id]??1200);this.markDone(t,r.id)}z.updateTicket(t,{status:"done",currentStepId:null})}awaitApproval(t){return new Promise(n=>{this.approvals.set(t,r=>{this.approvals.delete(t),this.emit(),n(r)}),this.emit()})}stop(){this.set({running:!1}),this.approvals.forEach(t=>t(!0)),this.approvals.clear()}}function EW(e){return b.useSyncExternalStore(e.subscribe,e.getState,e.getState)}const ew={todo:{label:"待处理",cls:"muted"},running:{label:"处理中",cls:"blue"},review:{label:"审核中",cls:"amber"},done:{label:"已完成",cls:"green"},blocked:{label:"受阻",cls:"red"}},tw={info:"dot",ai:"sparkle",ok:"check",warn:"warn",error:"close"};function nw(e,t){return e.doneStepIds.includes(t)?"done":e.currentStepId===t?"active":"pending"}const CW=ut(function(){const t=b.useRef();t.current||(t.current=new NW);const n=t.current,r=EW(n),s=z.view,i=s.kind==="run"?s:null,o=(i==null?void 0:i.tickets)??z.live.tickets,l=(i==null?void 0:i.logs)??z.live.logs,c=z.steps,u=z.mode,d=z.projectId,f=z.stageRuntime.run,[h,p]=b.useState(null),[v,x]=b.useState(!1),[w,g]=b.useState(!1),[y,m]=b.useState(null),_=u==="live",j=((i==null?void 0:i.gate.kind)??"open")==="open",N=KE(),k=_||c.length>0?c:(N==null?void 0:N.steps)??[],S=_?f.status==="running"||v:r.running;b.useEffect(()=>{!h&&o.length>0&&p(o[o.length-1].id)},[o,h]);const P=o.find(C=>C.id===h)??null,$=l.filter(C=>C.ticketId===h),D=b.useRef(null);b.useEffect(()=>{var C;(C=D.current)==null||C.scrollIntoView({behavior:"smooth",block:"end"})},[$.length]),Yg("run"),b.useEffect(()=>()=>{d&&I_("run",d)},[d]);const I={running:o.filter(C=>C.status==="running").length,review:o.filter(C=>C.status==="review").length,done:o.filter(C=>C.status==="done").length};function O(){if(_){if(!j)return;if(!d){z.appendLog(Uf("缺少真实项目工作区,请先从配置阶段重新进入真实设计。"));return}if(k.length===0){z.appendLog(Uf("当前流程没有可运行的真实 workflow,请先返回设计阶段重新生成。"));return}x(!0),Na("run",d).finally(()=>x(!1));return}n.start()}async function E(){if(!(!d||w)){g(!0);try{I_("run",d),(await i3(d)).mode==="local"&&await __(d)}catch(C){z.appendLog(Uf(C instanceof Error?C.message:String(C)))}finally{g(!1),x(!1)}}}async function A(C,M){if(!(!d||y)){m(M);try{await u3(d,C,M),await __(d)}catch(T){const R=T instanceof Error?T.message:String(T);z.appendLog({id:`human_action_${Date.now().toString(36)}`,ts:Date.now(),ticketId:C,stepId:(P==null?void 0:P.currentStepId)??"run",level:"error",text:R})}finally{m(null)}}}if(_&&j){const C=l.filter(L=>L.ticketId==="run"),M=P??o[0]??null,T=M?l.filter(L=>L.ticketId===M.id):C,R=f.status==="running"?"blue":f.status==="succeeded"?"green":f.status==="failed"?"red":"muted",B=f.status==="running"?"监听中":f.status==="failed"?"启动失败":f.status==="succeeded"?"已停止":"待启动";return a.jsxs("div",{className:"run-stage run-stage--live",children:[a.jsxs("div",{className:"run-board",children:[a.jsxs("div",{className:"run-board__head",children:[a.jsx("span",{children:"运行记录"}),a.jsx("span",{className:"run-board__stat",children:o.length?`${o.length} 条`:B})]}),a.jsx("div",{className:"run-board__list",children:o.length===0?a.jsxs("button",{type:"button",className:"ticket-card is-selected",children:[a.jsxs("div",{className:"ticket-card__top",children:[a.jsx("span",{className:`pill pill--${R}`,children:B}),a.jsx("span",{className:"ticket-card__prio",children:f.checkpoint??"run"})]}),a.jsx("div",{className:"ticket-card__title",children:"真实 AI 表格监听"}),a.jsx("div",{className:"ticket-card__meta",children:f.message}),a.jsxs("div",{className:"ticket-card__progress",children:[k.length," 个步骤 · ",C.length," 条服务日志"]})]}):o.map(L=>{const F=ew[L.status];return a.jsxs("button",{type:"button",className:`ticket-card${L.id===(M==null?void 0:M.id)?" is-selected":""}`,onClick:()=>p(L.id),children:[a.jsxs("div",{className:"ticket-card__top",children:[a.jsx("span",{className:`pill pill--${F.cls}`,children:F.label}),a.jsx("span",{className:"ticket-card__prio",children:L.priority})]}),a.jsx("div",{className:"ticket-card__title",children:L.title}),a.jsxs("div",{className:"ticket-card__meta",children:[L.customer," · ",L.category]}),a.jsxs("div",{className:"ticket-card__progress",children:[L.doneStepIds.length,"/",k.length," 步",L.status==="review"&&a.jsx("span",{className:"ticket-card__await",children:"待人工"})]})]},L.id)})}),a.jsxs("div",{className:"run-board__foot",children:[a.jsxs("button",{type:"button",className:"primary run-live-start",onClick:O,disabled:S,children:[a.jsx(V,{name:"play",size:15,color:"#fff"}),f.status==="failed"?"重试运行":S?"运行中":"启动运行"]}),S&&a.jsxs("button",{type:"button",className:"ghost run-live-stop",onClick:E,disabled:w,children:[a.jsx(V,{name:"close",size:13}),w?"停止中…":"停止运行"]})]})]}),a.jsxs("div",{className:"run-flow",children:[a.jsxs("div",{className:"run-flow__head",children:[a.jsx("div",{className:"run-flow__title",children:M?M.title:"当前 workflow"}),a.jsx("div",{className:"run-flow__sub",children:M?`${M.customer} · ${M.status}`:`${k.length} 个真实步骤 · ${f.checkpoint??"未启动"}`})]}),a.jsx("div",{className:"step-chain",children:k.map((L,F)=>{const W=!!M&&M.status==="review"&&M.currentStepId===L.id&&!!L.needsHuman,U=M?W?"active":nw(M,L.id):f.status==="succeeded"?"done":f.status==="running"&&F===0?"active":"pending";return a.jsxs("div",{className:`chain-node is-${U}`,children:[F>0&&a.jsx("div",{className:`chain-node__line is-${U}`}),a.jsxs("div",{className:"chain-node__row",children:[a.jsx("span",{className:"chain-node__dot",children:U==="done"?a.jsx(V,{name:"check",size:12,color:"#fff"}):U==="active"?a.jsx("span",{className:"chain-node__pulse"}):a.jsx("span",{className:"chain-node__idle"})}),a.jsxs("div",{className:"chain-node__body",children:[a.jsxs("div",{className:"chain-node__name",children:[a.jsx("span",{className:"chain-node__label",children:L.name}),L.requiresAgent&&a.jsx("span",{className:"chain-node__engine",style:{"--c":"var(--agent-llm)"},children:"AI"}),L.needsHuman&&a.jsx("span",{className:"pill pill--amber",children:"人工"}),!L.requiresAgent&&!L.needsHuman&&a.jsx("span",{className:"pill pill--muted",children:"自动"})]}),a.jsx("div",{className:"chain-node__recipe",children:L.recipe||"自动处理"}),W&&a.jsxs("div",{className:"chain-node__approve",children:[a.jsxs("button",{type:"button",className:"primary btn-approve",disabled:y!==null,onClick:()=>void A(M.id,"confirm"),children:[a.jsx(V,{name:"check",size:13,color:"#fff"})," 确认发送"]}),a.jsxs("button",{type:"button",className:"btn-reject",disabled:y!==null,onClick:()=>void A(M.id,"terminate"),children:[a.jsx(V,{name:"close",size:13})," 终止流程"]})]})]})]})]},L.id)})})]}),a.jsxs("div",{className:"run-logs",children:[a.jsxs("div",{className:"run-logs__head",children:[a.jsx(V,{name:"file",size:14}),M?"记录执行日志":"真实运行日志",a.jsx("span",{className:"run-logs__sub",children:(M==null?void 0:M.title)??f.checkpoint??"run"})]}),a.jsx("div",{className:"run-logs__body",children:T.length===0?a.jsx("div",{className:"empty-hint",style:{padding:20},children:M?"等待该记录的执行日志…":"启动后这里会显示服务端 SSE 返回的真实运行日志"}):a.jsx(Ho,{initial:!1,children:T.map(L=>{var F;return a.jsxs(Ye.div,{layout:!0,variants:St,initial:"hidden",animate:"visible",className:`log-line log-line--${L.level}`,children:[a.jsx("span",{className:"log-line__icon",children:a.jsx(V,{name:tw[L.level],size:11})}),a.jsxs("div",{className:"log-line__content",children:[a.jsx("span",{className:"log-line__step",children:((F=k.find(W=>W.id===L.stepId))==null?void 0:F.name)??L.stepId}),a.jsx("span",{className:"log-line__text",children:L.text})]})]},L.id)})})})]})]})}return j?!S&&o.length===0?a.jsx("div",{className:"split split--chatonly",children:a.jsxs("div",{className:"split__work",children:[a.jsxs("div",{className:"work-head",children:[a.jsx(V,{name:"play",size:16}),a.jsx("div",{className:"work-head__title",children:"运行监控"}),a.jsx("div",{className:"work-head__sub",children:"待启动"})]}),a.jsx("div",{className:"work-body",children:a.jsxs("div",{className:"run-intro",children:[a.jsx("div",{className:"run-intro__icon",children:a.jsx(V,{name:"play",size:28,color:"#fff"})}),a.jsx("h3",{className:"run-intro__title",children:_?"启动真实工作流":"启动模拟工作流"}),a.jsx("p",{className:"run-intro__desc",children:_?"启动后会连接真实运行服务,监听 AI 表格中的待处理记录,并按当前流程方案执行。":"启动后记录将陆续进入,系统自动执行分类、处理、审核与发送,人工把关环节会等待确认。"}),a.jsxs("button",{type:"button",className:"primary run-intro__cta",onClick:O,children:[a.jsx(V,{name:"play",size:15,color:"#fff"}),_?"启动真实运行":"启动模拟运行"]})]})})]})}):a.jsxs("div",{className:"run-stage",children:[a.jsxs("div",{className:"run-board",children:[a.jsxs("div",{className:"run-board__head",children:[a.jsx("span",{children:"工单队列"}),a.jsx("span",{className:"run-board__stat",children:_?S?"1/1 已连接":"0/1 待连接":`${r.arrived}/${r.total} 进入`})]}),a.jsx("div",{className:"run-board__list",children:a.jsx(Ho,{initial:!1,children:o.map(C=>{const M=ew[C.status];return a.jsxs(Ye.button,{type:"button",layout:!0,variants:St,initial:"hidden",animate:"visible",exit:"exit",className:`ticket-card${C.id===h?" is-selected":""}`,onClick:()=>p(C.id),children:[a.jsxs("div",{className:"ticket-card__top",children:[a.jsx("span",{className:`pill pill--${M.cls}`,children:M.label}),a.jsx("span",{className:"ticket-card__prio",children:C.priority})]}),a.jsx("div",{className:"ticket-card__title",children:C.title}),a.jsxs("div",{className:"ticket-card__meta",children:[C.customer," · ",C.category]}),a.jsxs("div",{className:"ticket-card__progress",children:[C.doneStepIds.length,"/",k.length," 步",!_&&n.isAwaiting(C.id)&&a.jsx("span",{className:"ticket-card__await",children:"待审批"})]})]},C.id)})})}),a.jsxs("div",{className:"run-board__foot",children:["处理中 ",I.running," · 审核中 ",I.review," · 已完成 ",I.done]})]}),a.jsxs("div",{className:"run-flow",children:[a.jsx("div",{className:"run-flow__head",children:P?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"run-flow__title",children:P.title}),a.jsx("div",{className:"run-flow__sub",children:P.customer})]}):a.jsx("div",{className:"run-flow__sub",children:"选择左侧工单查看步骤流转"})}),P&&a.jsx("div",{className:"step-chain",children:k.map((C,M)=>{const T=nw(P,C.id),R=!_&&T==="active"&&C.needsHuman&&n.isAwaiting(P.id);return a.jsxs("div",{className:`chain-node is-${T}`,children:[M>0&&a.jsx("div",{className:`chain-node__line is-${T}`}),a.jsxs("div",{className:"chain-node__row",children:[a.jsx("span",{className:"chain-node__dot",children:T==="done"?a.jsx(V,{name:"check",size:12,color:"#fff"}):T==="active"?a.jsx("span",{className:"chain-node__pulse"}):a.jsx("span",{className:"chain-node__idle"})}),a.jsxs("div",{className:"chain-node__body",children:[a.jsxs("div",{className:"chain-node__name",children:[a.jsx("span",{className:"chain-node__label",children:C.name}),C.requiresAgent&&a.jsx("span",{className:"chain-node__engine",style:{"--c":"var(--agent-llm)"},children:"AI"}),C.needsHuman&&a.jsx("span",{className:"pill pill--amber",children:"人工"}),!C.requiresAgent&&!C.needsHuman&&a.jsx("span",{className:"pill pill--muted",children:"自动"})]}),a.jsx("div",{className:"chain-node__recipe",children:C.recipe||"自动处理"}),R&&a.jsxs("div",{className:"chain-node__approve",children:[a.jsxs("button",{type:"button",className:"primary btn-approve",onClick:()=>n.approve(P.id),children:[a.jsx(V,{name:"check",size:13,color:"#fff"})," 通过"]}),a.jsxs("button",{type:"button",className:"btn-reject",onClick:()=>n.reject(P.id),children:[a.jsx(V,{name:"close",size:13})," 驳回"]})]})]})]})]},C.id)})})]}),a.jsxs("div",{className:"run-logs",children:[a.jsxs("div",{className:"run-logs__head",children:[a.jsx(V,{name:"file",size:14}),"执行日志",P&&a.jsx("span",{className:"run-logs__sub",children:P.title})]}),a.jsxs("div",{className:"run-logs__body",children:[$.length===0?a.jsx("div",{className:"empty-hint",style:{padding:20},children:P?"等待执行日志…":"选择工单查看日志"}):a.jsx(Ho,{initial:!1,children:$.map(C=>{const M=k.find(T=>T.id===C.stepId);return a.jsxs(Ye.div,{layout:!0,variants:St,initial:"hidden",animate:"visible",className:`log-line log-line--${C.level}`,children:[a.jsx("span",{className:"log-line__icon",children:a.jsx(V,{name:tw[C.level],size:11})}),a.jsxs("div",{className:"log-line__content",children:[a.jsx("span",{className:"log-line__step",children:(M==null?void 0:M.name)??C.stepId}),a.jsx("span",{className:"log-line__text",children:C.text})]})]},C.id)})}),a.jsx("div",{ref:D})]})]})]}):a.jsx("div",{className:"split split--chatonly",children:a.jsxs("div",{className:"split__work",children:[a.jsxs("div",{className:"work-head",children:[a.jsx(V,{name:"play",size:16}),a.jsx("div",{className:"work-head__title",children:"运行监控"}),a.jsx("div",{className:"work-head__sub",children:"未到达"})]}),a.jsx("div",{className:"work-body",children:a.jsxs("div",{className:"run-intro",children:[a.jsx("div",{className:"run-intro__icon",children:a.jsx(V,{name:"table",size:28,color:"#fff"})}),a.jsx("h3",{className:"run-intro__title",children:"当前流程尚未完成搭建"}),a.jsx("p",{className:"run-intro__desc",children:"运行阶段必须基于当前流程实例已搭建完成的 AI 表格。请先完成搭建阶段,再启动真实运行监听。"}),a.jsxs("button",{type:"button",className:"primary run-intro__cta",onClick:()=>z.setRoute("setup"),children:[a.jsx(V,{name:"chevron-right",size:15,color:"#fff"}),"返回搭建阶段"]})]})})]})})});function Uf(e){return{id:`run_preflight_${Date.now().toString(36)}`,ts:Date.now(),ticketId:"run",stepId:"run",level:"error",text:e}}const rw=[{id:"hr-onboarding",name:"HR 入职协同",steps:[{id:"classify",name:"信息校验",recipe:"validate-onboarding",engine:"llm_only",auto:!0,inputs:["员工姓名","身份证号","入职日期"],outputs:["校验结论","异常项"]},{id:"investigate",name:"权限准备",recipe:"prepare-access",engine:"qoder",auto:!0,inputs:["员工姓名","部门","岗位","校验结论"],outputs:["权限清单"]},{id:"draft_reply",name:"入职指引草拟",recipe:"draft-onboarding-guide",engine:"llm_only",auto:!0,inputs:["员工姓名","部门","岗位","权限清单"],outputs:["入职指引"]},{id:"quality_check",name:"法务与 HR 复核",recipe:"hr-legal-review",engine:"llm_only",auto:!1,needsHuman:!0,inputs:["入职指引","异常项"],outputs:["复核结论"]},{id:"send_reply",name:"发送入职通知",recipe:"send-onboarding-notice",engine:"llm_only",auto:!0,inputs:["员工姓名","入职指引","复核结论"],outputs:["发送状态"]}],edges:[{from:"classify",to:"investigate"},{from:"investigate",to:"draft_reply"},{from:"draft_reply",to:"quality_check"},{from:"quality_check",to:"send_reply"}]},{id:"customer-service",name:"客服工单处理",steps:[{id:"classify",name:"工单分类",recipe:"classify-ticket",engine:"llm_only",auto:!0,inputs:["标题","描述"],outputs:["类型","紧急度"]},{id:"investigate",name:"问题排查",recipe:"investigate",engine:"qoder",auto:!0,inputs:["标题","类型"],outputs:["解决方案"]},{id:"draft_reply",name:"草拟回复",recipe:"draft-reply",engine:"llm_only",auto:!0,inputs:["客户","解决方案"],outputs:["回复内容"]},{id:"quality_check",name:"质量审核",recipe:"quality-check",engine:"llm_only",auto:!1,needsHuman:!0,inputs:["回复内容"],outputs:["审核结论"]},{id:"send_reply",name:"发送回复",recipe:"send-reply",engine:"llm_only",auto:!0,inputs:["客户","回复内容"],outputs:["发送状态"]}],edges:[{from:"classify",to:"investigate"},{from:"investigate",to:"draft_reply"},{from:"draft_reply",to:"quality_check"},{from:"quality_check",to:"send_reply"}]},{id:"message-triage",name:"消息分诊",steps:[{id:"investigate",name:"深度调查",recipe:"investigate",engine:"qoder",auto:!0,inputs:["消息内容","发送人"],outputs:["调查结论"]},{id:"reply",name:"群内回复",recipe:"reply-to-group",engine:"llm_only",auto:!0,inputs:["调查结论","对话ID"],outputs:["回复状态"]}],edges:[{from:"investigate",to:"reply"}]},{id:"daily-digest",name:"每日摘要",steps:[{id:"collect",name:"收集当日数据",recipe:"collect-daily",engine:"llm_only",auto:!0,inputs:["日期"],outputs:["统计数据"]},{id:"generate",name:"生成摘要",recipe:"generate-digest",engine:"llm_only",auto:!0,inputs:["统计数据"],outputs:["摘要内容"]},{id:"send",name:"发送到群",recipe:"send-to-group",engine:"llm_only",auto:!0,inputs:["摘要内容"],outputs:["发送状态"]}],edges:[{from:"collect",to:"generate"},{from:"generate",to:"send"}]},{id:"kb-im",name:"知识库问答",steps:[{id:"check_relevance",name:"判断问题相关性",recipe:"check-relevance",engine:"llm_only",auto:!0,inputs:["消息内容"],outputs:["是否相关"]},{id:"generate_answer",name:"生成回答",recipe:"generate-answer",engine:"qoder",auto:!0,inputs:["消息内容","知识库文章"],outputs:["回答内容"]},{id:"reply_to_group",name:"回复群消息",recipe:"reply-to-group",engine:"llm_only",auto:!0,inputs:["回答内容","群ID"],outputs:["发送状态"]}],edges:[{from:"check_relevance",to:"generate_answer"},{from:"generate_answer",to:"reply_to_group"}]},{id:"discovery-demo",name:"需求发现演示",steps:[{id:"classify",name:"工单分类",recipe:"classify",engine:"llm_only",auto:!0,inputs:["消息内容"],outputs:["问题类型","紧急程度"]},{id:"enrich",name:"信息补全",recipe:"enrich",engine:"qoder",auto:!0,inputs:["消息内容","订单号"],outputs:["客户记录","历史工单"]},{id:"draft",name:"回复草拟",recipe:"draft-reply",engine:"llm_only",auto:!0,inputs:["客户记录","历史工单"],outputs:["回复内容"]},{id:"review",name:"质检审核",recipe:"quality-check",engine:"llm_only",auto:!1,needsHuman:!0,inputs:["回复内容"],outputs:["审核结果"]},{id:"send",name:"发送回复",recipe:"send-reply",engine:"llm_only",auto:!0,inputs:["回复内容"],outputs:["发送状态"]}],edges:[{from:"classify",to:"enrich"},{from:"enrich",to:"draft"},{from:"draft",to:"review"},{from:"review",to:"send"}]},{id:"plugin-i18n-upgrade",name:"插件国际化升级",steps:[{id:"prepare_workspace",name:"准备工作空间",recipe:"prepare-workspace",engine:"qoder",auto:!0,inputs:["插件名称","仓库地址"],outputs:["目标分支"]},{id:"upgrade_i18n",name:"国际化升级",recipe:"upgrade-i18n",engine:"qoder",auto:!0,inputs:["插件名称","目标分支"],outputs:["升级日志"]},{id:"submit_review",name:"提交代码评审",recipe:"submit-review",engine:"qoder",auto:!0,inputs:["目标分支"],outputs:["MR链接"]}],edges:[{from:"prepare_workspace",to:"upgrade_i18n"},{from:"upgrade_i18n",to:"submit_review"}]}];function QE(){return rw}function Wf(e){return QE().find(n=>n.id===e)??null}const sw=/\.(json|ya?ml|ts|js|md|txt)$/i,AW=new Set(["runtime","traces","node_modules"]),iw=/(^|\/)\.(_|DS_Store)/;function ow(e){const t=e.split("/")[0]??"";return AW.has(t)}async function TW(e){const t=Array.from(e),n=[];for(const s of t)if(s.name.toLowerCase().endsWith(".zip")){const o=await Tk(s),l=MW(Object.keys(o));for(const[c,u]of Object.entries(o)){const d=l(c).replace(/^\/+/,"");!d||iw.test(d)||ow(d)||!sw.test(d)||n.push({path:d,content:u})}}else{const o=PW(s);if(!o||iw.test(o)||ow(o)||!sw.test(o))continue;const l=await s.text();n.push({path:o,content:l})}const r=new Map;for(const s of n)r.set(s.path,s);return Array.from(r.values()).sort((s,i)=>s.path.localeCompare(i.path))}function PW(e){var n;const t=(n=e.webkitRelativePath)==null?void 0:n.trim();return t&&t.includes("/")?ZE(t):e.name}function MW(e){if(e.length===0)return s=>s;const t=e.map(s=>s.split("/")).filter(s=>s.length>1).map(s=>s[0]);if(t.length===0)return s=>s;const n=t[0];return t.every(s=>s===n)?s=>ZE(s):s=>s}function ZE(e){const t=e.split("/");return t.length>1?t.slice(1).join("/"):e}function aw(e,t,n){return{id:`imported_${t}`,projectId:e,stage:t,status:"succeeded",attempt:1,startedAt:n,updatedAt:n,completedAt:n,currentAction:"已随包导入",checkpoint:"done"}}function IW(e){const t=[],n=[];for(const o of e)t.push({path:o.path,status:"ok"});if(!e.some(o=>o.path==="aitable-workflow.config.yml"||o.path.endsWith(".config.yml")))t.push({path:"aitable-workflow.config.yml",status:"warning",detail:"缺失主配置文件,导入后可在「配置」阶段补齐"});else{const o=e.find(c=>c.path==="aitable-workflow.config.yml"||c.path.endsWith(".config.yml"));o&&!/^[ \t]*scene[ \t]*:[ \t]*\S/m.test(o.content)&&!/^[ \t]*scene[ \t]*:[ \t]*\|/m.test(o.content)&&t.push({path:"scene",status:"warning",detail:"config 缺少 scene 字段(业务场景描述)"})}return e.some(o=>o.path.startsWith("roles/")&&o.path.endsWith(".role.yml"))||t.push({path:"roles/",status:"warning",detail:"未检测到角色定义,可后续添加"}),e.some(o=>o.path==="workflow.yml"||o.path.endsWith("/workflow.yml"))||t.push({path:"workflow.yml",status:"warning",detail:"未包含工作流,导入后可在「设计」阶段生成"}),{items:t,envMissing:n}}function RW({onClose:e}){const t=QE(),n=b.useRef(null),[r,s]=b.useState("upload"),[i,o]=b.useState(!1),[l,c]=b.useState(!1),[u,d]=b.useState(null),[f,h]=b.useState([]),[p,v]=b.useState([]),[x,w]=b.useState([]),[g,y]=b.useState(null),[m,_]=b.useState(!1),[j,N]=b.useState(!1),[k,S]=b.useState(null),[P,$]=b.useState("");async function D(T){var R,B,L,F,W;c(!0),d(null);try{const U=Array.from(T),K=U.length>=1&&U.every(X=>/\.aitable-workflow\.zip$|\.zip$/i.test(X.name))?await I(U).catch(()=>null):null,Q=(K==null?void 0:K.files)??await TW(T);if(Q.length===0){d("未解析到可导入的文件(仅支持 .json/.yml/.yaml/.ts/.js/.md/.txt,且不能位于 runtime/traces/node_modules)"),o(!1),h([]),v([]),w([]);return}const{items:J,envMissing:H}=IW(Q);for(const X of(K==null?void 0:K.checksumWarnings)??[])J.push({path:X,status:"warning",detail:"checksum 校验"});h(Q),v(J),w(H),o(!0);const q=(R=K==null?void 0:K.title)==null?void 0:R.trim(),ne=(B=Q.find(X=>X.path==="aitable-workflow.config.yml"||X.path.endsWith(".config.yml")))==null?void 0:B.content,te=ne?((L=/^name:\s*(?:"([^"]*)"|'([^']*)'|([^#\n]*))/m.exec(ne))==null?void 0:L[1])??((F=/^name:\s*(?:"([^"]*)"|'([^']*)'|([^#\n]*))/m.exec(ne))==null?void 0:F[3]):null,ee=q||(te!=null&&te.trim()?te.trim():"")||((W=U.find(X=>/\.zip$/i.test(X.name)))==null?void 0:W.name.replace(/\.aitable-workflow\.zip$|\.zip$/i,""))||"导入项目";$(ee)}catch(U){d(U instanceof Error?U.message:String(U)),o(!1)}finally{c(!1)}}async function I(T){const R=[];let B;const L=[];let F=!1;const W=new Map;for(const U of T)try{const K=await U3(U);if(!K.manifest)continue;F=!0,!B&&K.title&&(B=K.title);for(const Q of K.checksumWarnings)L.push(Q);for(const Q of K.files)W.set(Q.path,Q)}catch{}if(!F)return null;for(const U of W.values())R.push(U);return R.sort((U,K)=>U.path.localeCompare(K.path)),{files:R,title:B,checksumWarnings:L}}function O(T){!T.target.files||T.target.files.length===0||(D(T.target.files),T.target.value="")}function E(T){y(T);const R=Wf(T);$((R==null?void 0:R.name)??T),h([]),d(null),v([{path:`examples/${T}/config.yml`,status:"ok"},{path:`examples/${T}/workflow.yml`,status:"ok"},{path:`examples/${T}/recipes/`,status:"ok"},{path:`examples/${T}/roles/`,status:"ok"}]),w([]),o(!0)}function A(){if(!P){const T=g?Wf(g):null;$((T==null?void 0:T.name)??"导入项目")}_(!0)}async function C(){if(N(!0),S(null),ue)try{const{project:F}=await UD(P,f);z.setProjectSource("imported"),await ba(F.id,{fallbackRoute:"init"}),e();return}catch(F){S(F instanceof Error?F.message:String(F)),N(!1);return}const T=`mock-imported-${Date.now()}`,R=g?Wf(g):null,B=((R==null?void 0:R.steps.length)??0)>0,L=new Date().toISOString();z.setProjectSource("imported"),z.applyLoadedProject({snapshot:{...as(),projectId:T,projects:ka(z.projects,{id:T,title:P,dir:"",createdAt:L,updatedAt:L}),files:f,workflow:R?{steps:R.steps,edges:R.edges}:null,projectState:{projectId:T,activeStage:null,stages:{init:{task:aw(T,"init",L)},...B?{design:{task:aw(T,"design",L)}}:{}},updatedAt:L},init:{name:P,agentsSelected:[],selectedMachineId:"",tableConnected:!1,tableBaseId:"",tableId:"",llmProvider:"",llmModel:"",roles:[],sop:""}},route:B?"setup":"design"}),e()}const M=i&&(r==="upload"||g);return a.jsx("div",{className:"modal-overlay",onClick:e,children:a.jsxs("div",{className:"import-panel",onClick:T=>T.stopPropagation(),children:[a.jsxs("div",{className:"import-panel__head",children:[a.jsx("span",{className:"import-panel__title",children:"导入已有项目"}),a.jsx("button",{type:"button",className:"modal-card__close",onClick:e,children:a.jsx(V,{name:"close",size:14})})]}),a.jsx("div",{className:"import-panel__body",children:m?a.jsxs("div",{className:"import-confirm",children:[a.jsx("div",{className:"import-confirm__icon",children:a.jsx(V,{name:"file",size:22})}),a.jsx("h4",{className:"import-confirm__title",children:"确认导入到我的项目?"}),a.jsxs("p",{className:"import-confirm__desc",children:["将在你的账号下新建项目,并导入已解析的工作流配置。",g&&a.jsxs(a.Fragment,{children:[a.jsx("br",{}),a.jsx("span",{className:"cfg-muted",children:"导入后需在「搭建」阶段配置 AI 表格。"})]})]}),a.jsxs("div",{className:"role-field",children:[a.jsx("label",{className:"role-field__label",children:"项目名称"}),a.jsx("input",{className:"import-confirm__input",value:P,onChange:T=>$(T.target.value),placeholder:"输入项目名称"})]}),k&&a.jsxs("div",{className:"import-env-warn",children:[a.jsx(V,{name:"warn",size:13}),k]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"import-panel__sources",children:[a.jsxs("label",{className:`import-source${r==="upload"?" is-selected":""}`,children:[a.jsx("input",{type:"radio",name:"source",checked:r==="upload",onChange:()=>{s("upload"),o(!1),y(null),d(null),h([]),v([])}}),"上传项目包"]}),a.jsxs("label",{className:`import-source${r==="template"?" is-selected":""}`,children:[a.jsx("input",{type:"radio",name:"source",checked:r==="template",onChange:()=>{s("template"),o(!1),d(null),h([])}}),"从模板库选择"]})]}),r==="upload"&&a.jsxs(a.Fragment,{children:[a.jsx("input",{ref:n,type:"file",multiple:!0,accept:".zip,.json,.yml,.yaml,.ts,.js,.md,.txt",style:{display:"none"},onChange:O}),a.jsxs("button",{type:"button",className:"import-drop",disabled:l,onClick:()=>{var T;return(T=n.current)==null?void 0:T.click()},children:[a.jsx(V,{name:"plus",size:20}),a.jsx("span",{children:l?"解析中...":i?"重新选择文件 (.zip / 多选 / 目录)":"拖拽或点击上传 (.zip / 多选)"})]}),u&&a.jsxs("div",{className:"import-env-warn",children:[a.jsx(V,{name:"warn",size:13}),u]})]}),r==="template"&&a.jsx("div",{className:"import-templates",children:t.map(T=>a.jsxs("button",{type:"button",className:`import-template${g===T.id?" is-selected":""}`,onClick:()=>E(T.id),children:[a.jsx("span",{className:"import-template__icon",children:a.jsx(V,{name:"flow",size:14})}),a.jsx("span",{className:"import-template__name",children:T.name}),a.jsxs("span",{className:"cfg-muted",children:["examples/",T.id]})]},T.id))}),i&&a.jsxs("div",{className:"import-preview",children:[a.jsxs("div",{className:"import-preview__title",children:["解析结果预览(",f.length||p.length," 项):"]}),a.jsx("ul",{className:"import-preview__list",children:p.map(T=>a.jsxs("li",{className:`import-preview__item import-preview__item--${T.status}`,children:[a.jsx("span",{className:"import-preview__icon",children:T.status==="ok"?"✓":T.status==="warning"?"⚠":"✗"}),a.jsx("span",{className:"import-preview__path",children:T.path}),T.detail&&a.jsx("span",{className:"import-preview__detail",children:T.detail})]},T.path))}),x.length>0&&a.jsxs("div",{className:"import-env-warn",children:[a.jsx(V,{name:"warn",size:13}),"需要补齐 ",x.length," 个环境变量"]})]})]})}),a.jsx("div",{className:"import-panel__foot",children:m?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"modal-card__btn",onClick:()=>_(!1),children:"返回"}),a.jsx("button",{type:"button",className:"primary modal-card__btn",disabled:!P.trim()||j,onClick:()=>void C(),children:j?"导入中...":"确认导入"})]}):a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"modal-card__btn",onClick:e,children:"取消"}),a.jsx("button",{type:"button",className:"primary modal-card__btn",disabled:!M,onClick:A,children:"下一步 →"})]})})]})})}function OW({summary:e,allPassed:t,saving:n,onComplete:r}){return a.jsxs("div",{className:`cfg-summary${t?" cfg-summary--ok":""}`,children:[a.jsxs("div",{className:"cfg-summary__stats",children:[a.jsxs("span",{className:"cfg-summary__stat",children:[a.jsx(V,{name:"check",size:14,color:"var(--green)"}),e.passedModules,"/",e.totalModules," 模块通过"]}),e.errors>0&&a.jsxs("span",{className:"cfg-summary__stat cfg-summary__stat--error",children:[e.errors," 错误"]}),e.warnings>0&&a.jsxs("span",{className:"cfg-summary__stat cfg-summary__stat--warn",children:[e.warnings," 警告"]})]}),a.jsx("button",{type:"button",className:"primary cfg-summary__btn",disabled:!t||n,onClick:r,children:n?"完成中…":t?"保存配置,继续搭建 →":"请先修复所有错误"})]})}const $W=".md,.txt,.text,.rst,.csv,.json,.yaml,.yml,.xml,.html,.htm,.docx,.pdf,.xlsx",LW=new Set([".docx",".pdf",".xlsx"]);let DW=0;function zW(e){const t=new Uint8Array(e);let n="";for(let r=0;r<t.length;r++)n+=String.fromCharCode(t[r]);return btoa(n)}function VW(e){const t=e.lastIndexOf(".");return t>=0?e.slice(t).toLowerCase():""}function FW({roleId:e,onIngestUrl:t,onUploadFiles:n}){const[r,s]=b.useState([]),[i,o]=b.useState([]),[l,c]=b.useState(!1),u=b.useRef(null),d=b.useRef(null),f=b.useRef(null),h=b.useCallback(()=>{s(_=>[..._,{id:++DW,type:"file",url:"",files:[]}])},[]),p=b.useCallback(_=>{s(j=>j.filter(N=>N.id!==_))},[]),v=b.useCallback((_,j)=>{s(N=>N.map(k=>k.id===_?{...k,type:j,url:"",files:[]}:k))},[]),x=b.useCallback((_,j)=>{s(N=>N.map(k=>k.id===_?{...k,url:j}:k))},[]),w=b.useCallback((_,j)=>{var N,k;f.current=_,j==="folder"?(N=d.current)==null||N.click():(k=u.current)==null||k.click()},[]),g=b.useCallback(_=>{const j=f.current;if(j===null)return;const N=Array.from(_.target.files??[]);N.length>0&&s(k=>k.map(S=>S.id===j?{...S,files:N}:S)),_.target.value=""},[]),y=b.useCallback(async()=>{if(l)return;c(!0);const _=[];for(const j of r)if(j.type==="url"){if(!j.url.trim())continue;try{const N=await t(e,j.url.trim());_.push({ok:N.ok,message:N.message??(N.ok?"导入成功":"导入失败")})}catch(N){_.push({ok:!1,message:N instanceof Error?N.message:"导入失败"})}}else{if(j.files.length===0)continue;try{const N=[];for(const S of j.files){const P=VW(S.name),$=S.webkitRelativePath||S.name;if(LW.has(P)){const D=await S.arrayBuffer();N.push({name:S.name,relativePath:$,content:zW(D),encoding:"base64"})}else{const D=await S.text();N.push({name:S.name,relativePath:$,content:D,encoding:"utf8"})}}const k=await n(e,N);_.push({ok:k.ok,message:k.message??(k.ok?`导入成功 (${j.files.length} 个文件)`:"导入失败")})}catch(N){_.push({ok:!1,message:N instanceof Error?N.message:"文件上传失败"})}}o(j=>[...j,..._]),s([]),c(!1)},[l,r,e,t,n]),m=r.some(_=>_.type==="url"&&_.url.trim()||_.type==="file"&&_.files.length>0);return a.jsxs("div",{className:"kb-panel",children:[a.jsx("input",{ref:u,type:"file",multiple:!0,accept:$W,style:{display:"none"},onChange:g}),a.jsx("input",{ref:d,type:"file",webkitdirectory:"",directory:"",multiple:!0,style:{display:"none"},onChange:g}),i.length>0&&a.jsx("div",{className:"kb-panel__results",children:i.map((_,j)=>a.jsxs("div",{className:`kb-panel__result ${_.ok?"is-ok":"is-error"}`,children:[a.jsx(V,{name:_.ok?"check":"warn",size:12,color:_.ok?"var(--green)":"var(--red)"}),a.jsx("span",{children:_.message})]},j))}),r.length>0&&a.jsx("div",{className:"kb-panel__rows",children:r.map(_=>a.jsxs("div",{className:"kb-panel__row",children:[a.jsxs("select",{className:"kb-panel__type-select",value:_.type,onChange:j=>v(_.id,j.target.value),disabled:l,children:[a.jsx("option",{value:"file",children:"本地文件"}),a.jsx("option",{value:"url",children:"在线文档链接"})]}),_.type==="file"?a.jsxs("div",{className:"kb-panel__file-area",children:[_.files.length>0?a.jsxs("span",{className:"kb-panel__file-info",title:_.files.map(j=>j.name).join(`
320
+ `),children:["已选 ",_.files.length," 个文件"]}):a.jsx("span",{className:"kb-panel__file-placeholder",children:"未选择文件"}),a.jsx("button",{type:"button",className:"kb-panel__file-btn",onClick:()=>w(_.id,"file"),disabled:l,children:"选择文件"}),a.jsx("button",{type:"button",className:"kb-panel__file-btn",onClick:()=>w(_.id,"folder"),disabled:l,children:"选择文件夹"})]}):a.jsx("input",{type:"text",className:"qf-input kb-panel__url-input",value:_.url,placeholder:"输入在线文档链接",onChange:j=>x(_.id,j.target.value),disabled:l}),a.jsx("button",{type:"button",className:"kb-panel__row-remove",onClick:()=>p(_.id),disabled:l,title:"删除此行",children:a.jsx(V,{name:"close",size:12})})]},_.id))}),a.jsxs("div",{className:"kb-panel__actions",children:[a.jsx("button",{type:"button",className:"cfg-item__edit-btn cfg-item__kb-btn",onClick:h,disabled:l,children:r.length>0||i.length>0?"继续添加知识库":"添加知识库"}),r.length>0&&a.jsx("button",{type:"button",className:"primary kb-panel__import-btn",onClick:()=>void y(),disabled:l||!m,children:l?"导入中…":"导入"})]})]})}function BW({fileRef:e}){const[t,n]=b.useState(!1),[r,s]=b.useState(null),[i,o]=b.useState(""),[l,c]=b.useState(!1),[u,d]=b.useState(!1),[f,h]=b.useState(!1),[p,v]=b.useState(null),[x,w]=b.useState(!1);async function g(){if(t){n(!1);return}if(n(!0),r===null){d(!0),v(null);try{const _=await DD(e.path);s(_.content),o(_.content)}catch(_){v(_ instanceof Error?_.message:String(_))}finally{d(!1)}}}async function y(){h(!0),v(null);try{await zD(e.path,i),s(i),c(!1),w(!0),setTimeout(()=>w(!1),2400)}catch(_){v(_ instanceof Error?_.message:String(_))}finally{h(!1)}}const m=(e.summary??[]).map(_=>_.count!==void 0?`${_.key} ${_.count}`:_.key).join(" · ");return a.jsxs("div",{className:"file-ref",children:[a.jsxs("button",{type:"button",className:"file-ref__toggle",onClick:()=>void g(),children:[a.jsx("span",{className:`file-ref__chevron${t?" is-open":""}`,children:a.jsx(V,{name:"chevron-right",size:11})}),a.jsx(V,{name:"file",size:12,color:"var(--text-muted)"}),a.jsx("code",{className:"file-ref__path",children:e.path}),e.exists?m&&a.jsx("span",{className:"file-ref__summary",children:m}):a.jsx("span",{className:"file-ref__missing",children:"文件不存在,展开可创建"})]}),e.exists&&a.jsxs("div",{className:"file-ref__locked-hint",children:[a.jsx(V,{name:"lock",size:11,color:"var(--text-muted)"}),a.jsx("span",{children:"该配置指向上方文件,路径不可改;展开文件编辑其内容"})]}),t&&a.jsxs("div",{className:"file-ref__body",children:[u&&a.jsx("div",{className:"file-ref__hint",children:"读取中…"}),p&&a.jsxs("div",{className:"file-ref__error",children:[a.jsx(V,{name:"warn",size:13,color:"var(--red)"}),a.jsx("span",{children:p})]}),!u&&r!==null&&!l&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:"file-ref__pre",children:r||"(空文件)"}),a.jsxs("div",{className:"file-ref__actions",children:[a.jsx("button",{type:"button",className:"file-ref__btn",onClick:()=>{o(r),c(!0),v(null)},children:"编辑内容"}),x&&a.jsxs("span",{className:"file-ref__saved",children:[a.jsx(V,{name:"check",size:12,color:"var(--green)"})," 已保存"]})]})]}),!u&&l&&a.jsxs(a.Fragment,{children:[a.jsx("textarea",{className:"qf-textarea file-ref__editor",value:i,spellCheck:!1,onChange:_=>o(_.target.value),autoFocus:!0}),a.jsxs("div",{className:"file-ref__actions",children:[a.jsx("button",{type:"button",className:"primary file-ref__btn",onClick:()=>void y(),disabled:f,children:f?"保存中…":`保存${e.format==="json"?" JSON":" YAML"}`}),a.jsx("button",{type:"button",className:"file-ref__btn",onClick:()=>{o(r??""),c(!1),v(null)},disabled:f,children:"取消"}),a.jsxs("span",{className:"file-ref__hint file-ref__hint--inline",children:["保存前会校验",e.format==="json"?" JSON":" YAML","语法,语法错误不会写入"]})]})]})]})]})}const HW=/secret|token|password|api_key/i;let JE=1;function UW(e,t){if(!e.trim())return[];try{const n=JSON.parse(e);return!n||typeof n!="object"||Array.isArray(n)?[]:Object.entries(n).map(([r,s])=>{const i={},o=[...t.valueFields];for(const l of Object.keys(s??{}))o.includes(l)||o.push(l);for(const l of o){const c=(s??{})[l];i[l]=c==null?"":String(c)}return{id:JE++,name:r,fields:i}})}catch{return[]}}function lw(e){const t={};for(const n of e.valueFields)t[n]="";return{id:JE++,name:"",fields:t}}function WW({spec:e,initialValue:t,saving:n,onSave:r,onCancel:s}){const[i,o]=b.useState(()=>{const p=UW(t,e);return p.length>0?p:[lw(e)]}),l=e.keyLabel??"名称",c=b.useMemo(()=>{const p=i.map(v=>v.name.trim());return p.some(v=>!v)?`每一项都需要填写「${l}」`:new Set(p).size!==p.length?`「${l}」不能重复`:null},[i,l]);function u(p,v){o(x=>x.map(w=>w.id===p?{...w,...v}:w))}function d(p,v,x){o(w=>w.map(g=>g.id===p?{...g,fields:{...g.fields,[v]:x}}:g))}function f(p){o(v=>v.filter(x=>x.id!==p))}async function h(){if(c)return;const p={};for(const v of i)p[v.name.trim()]=v.fields;await r(JSON.stringify(p))}return a.jsxs("div",{className:"env-map",children:[a.jsxs("p",{className:"env-map__hint",children:["按项填写,每项包含 ",e.valueFields.map(p=>a.jsx("code",{children:p},p)),",保存后自动写回配置。"]}),i.map((p,v)=>a.jsxs("div",{className:"env-map__entry",children:[a.jsxs("div",{className:"env-map__entry-head",children:[a.jsxs("span",{className:"env-map__entry-index",children:["#",v+1]}),a.jsx("input",{type:"text",className:"qf-input env-map__key-input",placeholder:l,value:p.name,onChange:x=>u(p.id,{name:x.target.value}),autoFocus:!p.name}),a.jsx("button",{type:"button",className:"env-map__remove-btn",title:"删除此项",onClick:()=>f(p.id),disabled:n,children:a.jsx(V,{name:"close",size:13})})]}),a.jsx("div",{className:"env-map__fields",children:Object.keys(p.fields).map(x=>a.jsxs("label",{className:"env-map__field",children:[a.jsx("span",{className:"env-map__field-name",children:x}),a.jsx("input",{type:HW.test(x)?"password":"text",className:"qf-input env-map__field-input",placeholder:`输入 ${x}`,value:p.fields[x]??"",onChange:w=>d(p.id,x,w.target.value)})]},x))})]},p.id)),a.jsxs("button",{type:"button",className:"env-map__add-btn",onClick:()=>o(p=>[...p,lw(e)]),disabled:n,children:[a.jsx(V,{name:"plus",size:13}),"添加一项"]}),c&&i.length>0&&a.jsx("div",{className:"env-map__error",children:c}),a.jsxs("div",{className:"cfg-item__edit-actions",children:[a.jsx("button",{type:"button",className:"primary cfg-item__save-btn",onClick:()=>void h(),disabled:n||!!c||i.length===0,children:n?"保存中…":"保存"}),a.jsx("button",{type:"button",className:"cfg-item__cancel-btn",onClick:s,disabled:n,children:"取消"})]})]})}const cw={ok:{icon:"check",color:"var(--green)"},error:{icon:"warn",color:"var(--red)"},warn:{icon:"warn",color:"var(--amber)"},suggestion:{icon:"dot",color:"var(--blue)"}},uw=".knowledge_scope.kb_collections";function KW(e){if(!e.endsWith(uw))return null;const t=e.slice(0,-uw.length),n=t.lastIndexOf(".");return n>=0?t.slice(n+1):t}function Gn({item:e,onSave:t,onKbIngest:n,onKbUpload:r,suggestedDefault:s}){var N,k,S,P,$,D,I,O,E,A,C,M;const[i,o]=b.useState(!1),[l,c]=b.useState(Po(e)),[u,d]=b.useState(!1),f=((N=e.surface)==null?void 0:N.label)??e.key,h=((k=e.surface)==null?void 0:k.description)??e.message,p=e.writeTarget&&((S=e.surface)==null?void 0:S.editable)!==!1,v=e.sensitive,x=cw[e.status]??cw.suggestion,w=KW(e.key),y=w!==null&&n&&r,m=(P=e.surface)==null?void 0:P.envJsonSpec;async function _(T){if(!(!e.writeTarget||!T.trim())){d(!0);try{await t(e.writeTarget,T),o(!1)}finally{d(!1)}}}async function j(){await _(l)}return a.jsxs("div",{className:`cfg-item cfg-item--${e.status}`,children:[a.jsxs("div",{className:"cfg-item__head",children:[a.jsx("span",{className:"cfg-item__status",children:a.jsx(V,{name:x.icon,size:14,color:x.color})}),a.jsx("span",{className:"cfg-item__label",children:f}),v&&a.jsx("span",{className:"cfg-item__badge cfg-item__badge--sensitive",children:"敏感"}),(($=e.surface)==null?void 0:$.required)&&a.jsx("span",{className:"cfg-item__badge cfg-item__badge--required",children:"必填"})]}),h&&!i&&a.jsx("div",{className:"cfg-item__desc",children:h}),!i&&a.jsxs("div",{className:"cfg-item__value-row",children:[a.jsx("span",{className:`cfg-item__value${((D=e.surface)==null?void 0:D.valueType)==="text"?" cfg-item__value--multiline":""}`,children:m?GW(e,m.keyLabel):v&&e.value?"***":e.value!==void 0&&String(e.value)!==""?String(e.value):"—"}),p&&a.jsx("button",{type:"button",className:"cfg-item__edit-btn",onClick:()=>{c(v?"":Po(e)||s||""),o(!0)},children:"编辑"})]}),!i&&p&&s&&!Po(e)&&a.jsxs("div",{className:"cfg-item__suggest",children:["默认沿用已配置的 Base ID:",a.jsx("code",{children:s}),"(点“编辑”已自动预填,直接保存即可)"]}),!i&&((I=e.surface)==null?void 0:I.fileRef)&&a.jsx(BW,{fileRef:e.surface.fileRef}),i&&m&&a.jsx("div",{className:"cfg-item__edit",children:a.jsx(WW,{spec:m,initialValue:v?"":Po(e),saving:u,onSave:_,onCancel:()=>o(!1)})}),i&&!m&&a.jsxs("div",{className:"cfg-item__edit",children:[((O=e.surface)==null?void 0:O.valueType)==="string[]"||((E=e.surface)==null?void 0:E.valueType)==="text"?a.jsx("textarea",{className:"qf-textarea cfg-item__input",rows:((A=e.surface)==null?void 0:A.valueType)==="text"?10:3,value:l,placeholder:((C=e.surface)==null?void 0:C.valueType)==="text"?`输入 ${f}`:"每行一个值,或用逗号分隔",onChange:T=>c(T.target.value),autoFocus:!0}):a.jsx("input",{type:v?"password":"text",className:"qf-input cfg-item__input",value:l,placeholder:((M=e.surface)==null?void 0:M.description)??`输入 ${f}`,onChange:T=>c(T.target.value),onKeyDown:T=>{T.key==="Enter"&&j()},autoFocus:!0}),a.jsxs("div",{className:"cfg-item__edit-actions",children:[a.jsx("button",{type:"button",className:"primary cfg-item__save-btn",onClick:()=>void j(),disabled:u||!l.trim(),children:u?"保存中…":"保存"}),a.jsx("button",{type:"button",className:"cfg-item__cancel-btn",onClick:()=>o(!1),disabled:u,children:"取消"})]})]}),y&&!p&&a.jsx(FW,{roleId:w,onIngestUrl:n,onUploadFiles:r})]})}function Po(e){return e.value===void 0||e.value===null?"":Array.isArray(e.value)?e.value.join(", "):String(e.value)}function GW(e,t){const n=Po(e);if(!n.trim())return"—";try{const r=JSON.parse(n),s=Object.keys(r);return s.length===0?"—":`已配 ${s.length} 项(${t??"名称"}: ${s.join(", ")})`}catch{return n}}function Nu({items:e}){const[t,n]=b.useState(!1);if(e.length===0)return null;const r=e.map(i=>`[${i.status}] ${i.key}: ${i.message}`).join(`
321
+ `);async function s(){try{await navigator.clipboard.writeText(r),n(!0),setTimeout(()=>n(!1),2e3)}catch{}}return a.jsxs("section",{className:"process-errors",children:[a.jsxs("div",{className:"process-errors__head",children:[a.jsx(V,{name:"warn",size:14,color:"var(--red)"}),a.jsx("span",{children:"过程错误"}),a.jsx("button",{type:"button",className:"process-errors__copy",onClick:()=>void s(),children:t?"已复制":"复制"})]}),e.map((i,o)=>a.jsxs("div",{className:`process-errors__item process-errors__item--${i.status}`,children:[a.jsx("span",{className:"process-errors__icon",children:a.jsx(V,{name:"warn",size:13,color:i.status==="error"?"var(--red)":"var(--amber)"})}),a.jsxs("div",{className:"process-errors__body",children:[i.key&&a.jsx("code",{className:"process-errors__key",children:i.key}),a.jsx("span",{className:"process-errors__msg",children:i.message})]})]},i.key??`pe-${o}`))]})}const qW=new Set(["workflow","agent.engine"]);function YW({config:e,engines:t,projectEnvRefs:n,onSave:r,onBatchSave:s}){const i=e.modules.find(m=>m.id==="project"),o=e.modules.find(m=>m.id==="coding_agent"),l=e.modules.find(m=>m.id==="env"),c=o==null?void 0:o.items.find(m=>m.key==="coding_agent.engine"),u=o==null?void 0:o.items.find(m=>m.key==="coding_agent.config.enabled"),d=c==null?void 0:c.value,[f,h]=b.useState(!1),p=b.useRef(!1),v=b.useCallback(async m=>{if(!(!(c!=null&&c.writeTarget)||!m)){h(!0);try{const _=[{writeTarget:c.writeTarget,value:m}];(u==null?void 0:u.status)==="error"&&u.writeTarget&&_.push({writeTarget:u.writeTarget,value:"true"}),await s(_)}finally{h(!1)}}},[c,u,s]);b.useEffect(()=>{p.current||(c==null?void 0:c.status)==="error"&&d&&t.available.some(m=>m.engine===d)&&c.writeTarget&&(p.current=!0,v(d))},[c,d,t.available,v]);const x=((i==null?void 0:i.items)??[]).filter(m=>!qW.has(m.key)&&(m.status!=="ok"||m.writeTarget)),w=((l==null?void 0:l.items)??[]).filter(m=>m.writeTarget&&(!n||n.includes(m.key))),g=((o==null?void 0:o.items)??[]).filter(m=>m.key!=="coding_agent.engine"&&m.writeTarget&&m.status==="error"),y=[...(i==null?void 0:i.items)??[],...(o==null?void 0:o.items)??[],...e.modules.filter(m=>m.id==="profile").flatMap(m=>m.items),...(l==null?void 0:l.items)??[]].filter(m=>!m.writeTarget&&(m.status==="error"||m.status==="warn"));return a.jsxs("div",{className:"adjust__tab-inner",children:[a.jsxs("section",{className:"adjust__section",children:[a.jsxs("h3",{className:"adjust__section-title",children:[a.jsx(V,{name:"robot",size:15}),"编码引擎"]}),a.jsxs("div",{className:"adjust__engine-row",children:[a.jsxs("select",{className:"qf-select adjust__engine-select",value:d??"",onChange:m=>void v(m.target.value),disabled:f,children:[a.jsx("option",{value:"",children:"请选择…"}),t.available.map(m=>a.jsxs("option",{value:m.engine,children:[m.engine," (",m.cmd,m.version?` v${m.version}`:"",")"]},m.engine)),!t.available.some(m=>m.engine==="llm_only")&&a.jsx("option",{value:"llm_only",children:"llm_only (无需本地 CLI)"})]}),(c==null?void 0:c.status)==="error"&&a.jsxs("span",{className:"adjust__engine-warn",children:[a.jsx(V,{name:"warn",size:13,color:"var(--red)"}),c.message]}),(c==null?void 0:c.status)==="ok"&&a.jsx("span",{className:"adjust__engine-ok",children:a.jsx(V,{name:"check",size:13,color:"var(--green)"})}),f&&a.jsx("span",{className:"adjust__engine-saving",children:"保存中…"})]}),t.recommended&&d!==t.recommended&&a.jsxs("p",{className:"adjust__hint-text",children:["推荐:",t.recommended]})]}),g.length>0&&a.jsxs("section",{className:"adjust__section",children:[a.jsxs("h3",{className:"adjust__section-title",children:[a.jsx(V,{name:"robot",size:15}),"引擎配置"]}),g.map(m=>a.jsx(Gn,{item:m,onSave:r},m.key))]}),(x.length>0||w.length>0)&&a.jsxs("section",{className:"adjust__section",children:[a.jsxs("h3",{className:"adjust__section-title",children:[a.jsx(V,{name:"folder",size:15}),"项目参数"]}),x.map(m=>a.jsx(Gn,{item:m,onSave:r},m.key)),w.map(m=>a.jsx(Gn,{item:m,onSave:r},m.key))]}),x.length===0&&w.length===0&&g.length===0&&(c==null?void 0:c.status)==="ok"&&a.jsxs("div",{className:"adjust__empty",children:[a.jsx(V,{name:"check",size:20,color:"var(--green)"}),a.jsx("span",{children:"项目参数已完整"})]}),a.jsx(Nu,{items:y})]})}const Gp=new Set(["roles.enabled","roles_dir","roles"]);function XW(e){const t=new Map;for(const n of e){if(Gp.has(n.key))continue;const r=n.key.match(/^role\.([^.]+)/);if(!r)continue;const s=r[1];t.has(s)||t.set(s,[]),t.get(s).push(n)}return Array.from(t.entries()).map(([n,r])=>({roleId:n,items:r}))}function QW({config:e,onSave:t,onKbIngest:n,onKbUpload:r}){const s=e.modules.find(u=>u.id==="roles");if(!s)return a.jsx("div",{className:"adjust__empty",children:"角色系统未启用"});const o=s.items.filter(u=>Gp.has(u.key)).find(u=>u.status==="error");if(o){const u=((s==null?void 0:s.items)??[]).filter(d=>!d.writeTarget&&d.status!=="ok"&&d!==o);return a.jsxs("div",{className:"adjust__tab-inner",children:[a.jsxs("div",{className:"adjust__error",children:[a.jsx(V,{name:"warn",size:16,color:"var(--red)"}),a.jsx("span",{children:o.message})]}),a.jsx(Nu,{items:u})]})}const l=XW(s.items);if(l.length===0)return a.jsx("div",{className:"adjust__tab-inner",children:a.jsxs("div",{className:"adjust__empty",children:[a.jsx(V,{name:"user",size:20,color:"var(--text-muted)"}),a.jsx("span",{children:"暂无角色配置"})]})});const c=((s==null?void 0:s.items)??[]).filter(u=>Gp.has(u.key)&&!u.writeTarget&&u.status!=="ok");return a.jsxs("div",{className:"adjust__tab-inner",children:[l.map(u=>a.jsx(ZW,{role:u,onSave:t,onKbIngest:n,onKbUpload:r},u.roleId)),a.jsx(Nu,{items:c})]})}function ZW({role:e,onSave:t,onKbIngest:n,onKbUpload:r}){const s=e.items.find(l=>l.key===`role.${e.roleId}`),i=(s==null?void 0:s.status)==="ok",o=e.items.filter(l=>l.key!==`role.${e.roleId}`);return a.jsxs("div",{className:`role-card${i?" is-ok":""}`,children:[a.jsxs("div",{className:"role-card__head",children:[a.jsx(V,{name:"user",size:15}),a.jsx("span",{className:"role-card__name",children:e.roleId}),a.jsx("span",{className:`role-card__status${i?" is-ok":""}`,children:i?a.jsxs(a.Fragment,{children:[a.jsx(V,{name:"check",size:12})," 通过"]}):"需配置"})]}),o.length>0&&a.jsx("div",{className:"role-card__body",children:o.map(l=>a.jsx(Gn,{item:l,onSave:t,onKbIngest:n,onKbUpload:r},l.key))})]})}function bc(e){const t=e.slice(e.lastIndexOf(".")+1);return t==="base_id"||t==="baseId"}function JW({config:e,workflowTopology:t,onSave:n}){const r=e.modules.find(u=>u.id==="workflow"),s=e.modules.find(u=>u.id==="env"),[i,o]=b.useState(null),l=(r==null?void 0:r.workflows)??[],c=b.useMemo(()=>{for(const u of l)for(const d of u.items)if(bc(d.key)&&typeof d.value=="string"&&d.value.trim())return d.value.trim()},[l]);return l.length===0?a.jsx("div",{className:"adjust__tab-inner",children:a.jsxs("div",{className:"adjust__empty",children:[a.jsx(V,{name:"flow",size:20,color:"var(--text-muted)"}),a.jsx("span",{children:"暂无工作流"})]})}):a.jsx("div",{className:"adjust__tab-inner",children:l.map(u=>a.jsx(e7,{workflow:u,topology:t[u.id],envItems:(s==null?void 0:s.items)??[],suggestedBaseId:c,isOpen:i===u.id,onToggle:()=>o(d=>d===u.id?null:u.id),onSave:n},u.id))})}function e7({workflow:e,topology:t,envItems:n,suggestedBaseId:r,isOpen:s,onToggle:i,onSave:o}){const[l,c]=b.useState(null),u=e.items.filter(k=>k.key==="tracker.base_id"||k.key==="tracker.table_id"),d=e.items.filter(k=>k.key.startsWith("event_source.")&&k.writeTarget),f=b.useMemo(()=>{const k=new Set((t==null?void 0:t.envRefs)??[]);for(const S of Object.values((t==null?void 0:t.stepEnvRefs)??{}))for(const P of S){const $=n.find(D=>D.key===P);$&&$.status==="error"&&k.add(P)}return[...k].map(S=>n.find(P=>P.key===S)).filter(S=>!!S&&!!S.writeTarget)},[t,n]),h=b.useMemo(()=>{const k=new Set((t==null?void 0:t.envRefs)??[]);for(const S of Object.values((t==null?void 0:t.stepEnvRefs)??{}))for(const P of S)k.add(P);return n.filter(S=>k.has(S.key)&&S.status==="error")},[t,n]),p=e.ok&&h.length===0,v=e.items.filter(k=>k.writeTarget&&k.status==="error").length+h.filter(k=>k.writeTarget).length,x=e.items.filter(k=>!k.writeTarget&&k.status==="error").length+h.filter(k=>!k.writeTarget).length,w=b.useMemo(()=>{const k=new Set((t==null?void 0:t.envRefs)??[]);for(const S of Object.values((t==null?void 0:t.stepEnvRefs)??{}))for(const P of S)k.add(P);return[...e.items.filter(S=>!S.writeTarget&&(S.status==="error"||S.status==="warn")),...n.filter(S=>k.has(S.key)&&!S.writeTarget&&(S.status==="error"||S.status==="warn"))]},[t,n,e.items]),g=b.useMemo(()=>t?t.steps.map(k=>{const S=e.items.filter(P=>P.key.startsWith(`step.${k.id}.config.`)&&P.status==="error");return{id:k.id,name:k.name,recipe:k.recipe??"",engine:k.engine??"llm_only",auto:k.auto,inputs:[],outputs:[],configStatus:S.length>0?"missing":"ok",missingConfigKeys:S.map(P=>P.key)}}):[],[t,e.items]),y=b.useMemo(()=>t?t.edges:[],[t]),m=b.useMemo(()=>l?e.items.filter(k=>k.key.startsWith(`step.${l}.config.`)&&k.writeTarget):[],[l,e.items]),_=b.useMemo(()=>!l||!t?[]:(t.stepEnvRefs[l]??[]).map(S=>n.find(P=>P.key===S)).filter(S=>!!S&&S.status!=="ok"),[l,t,n]),j=t==null?void 0:t.steps.find(k=>k.id===l),N=l&&(m.length>0||_.length>0);return a.jsxs("div",{className:`wf-card${p?" is-done":""}`,children:[a.jsxs("button",{type:"button",className:"wf-card__head",onClick:i,children:[a.jsx("span",{className:"wf-card__icon",children:a.jsx(V,{name:"flow",size:15})}),a.jsx("span",{className:"wf-card__name",children:e.name}),v>0&&a.jsxs("span",{className:"wf-card__badge",children:[v," 项需配置"]}),x>0&&a.jsxs("span",{className:"wf-card__badge wf-card__badge--process",children:[x," 项过程错误"]}),a.jsx("span",{className:`wf-card__status${p?" is-ok":""}`,children:p?a.jsxs(a.Fragment,{children:[a.jsx(V,{name:"check",size:12})," 通过"]}):v>0?"需配置":"有异常"}),a.jsx("span",{className:`wf-card__chevron${s?" is-open":""}`,children:a.jsx(V,{name:"chevron-right",size:12})})]}),s&&a.jsxs("div",{className:"wf-card__body",children:[u.length>0&&a.jsx("div",{className:"wf-card__tracker",children:u.map(k=>a.jsx(Gn,{item:k,onSave:o,suggestedDefault:bc(k.key)?r:void 0},k.key))}),t&&g.length>0&&a.jsxs("div",{className:`wf-card__canvas-row${N?" has-panel":""}`,children:[a.jsx("div",{className:"wf-card__canvas",children:a.jsx(IE,{steps:g,edges:y,selectedId:l,onSelect:c})}),N&&j&&a.jsxs("div",{className:"wf-card__panel",children:[a.jsxs("div",{className:"wf-card__panel-head",children:[a.jsx(V,{name:"bolt",size:14}),a.jsxs("span",{children:["步骤配置 · ",j.name]}),a.jsx("button",{type:"button",className:"wf-card__panel-close",onClick:()=>c(null),children:a.jsx(V,{name:"close",size:14})})]}),a.jsxs("div",{className:"wf-card__panel-body",children:[m.map(k=>a.jsx(Gn,{item:k,onSave:o,suggestedDefault:bc(k.key)?r:void 0},k.key)),_.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"wf-card__panel-divider",children:"参数与凭据"}),_.map(k=>a.jsx(Gn,{item:k,onSave:o},k.key))]})]})]}),l&&!N&&j&&a.jsxs("div",{className:"wf-card__panel",children:[a.jsxs("div",{className:"wf-card__panel-head",children:[a.jsx(V,{name:"bolt",size:14}),a.jsxs("span",{children:["步骤配置 · ",j.name]}),a.jsx("button",{type:"button",className:"wf-card__panel-close",onClick:()=>c(null),children:a.jsx(V,{name:"close",size:14})})]}),a.jsx("div",{className:"wf-card__panel-body",children:a.jsxs("div",{className:"adjust__empty",style:{padding:"24px 16px"},children:[a.jsx(V,{name:"check",size:16,color:"var(--green)"}),a.jsx("span",{children:"此步骤配置完整"})]})})]})]}),d.length>0&&a.jsxs("div",{className:"wf-card__events",children:[a.jsxs("div",{className:"wf-card__events-title",children:[a.jsx(V,{name:"bolt",size:13,color:"var(--text-muted)"}),"事件源配置"]}),d.map(k=>a.jsx(Gn,{item:k,onSave:o,suggestedDefault:bc(k.key)?r:void 0},k.key))]}),f.length>0&&a.jsxs("div",{className:"wf-card__events",children:[a.jsxs("div",{className:"wf-card__events-title",children:[a.jsx(V,{name:"lock",size:13,color:"var(--text-muted)"}),"参数与凭据"]}),f.map(k=>a.jsx(Gn,{item:k,onSave:o},k.key))]}),a.jsx(Nu,{items:w})]})]})}const t7=[{id:"project",label:"项目配置",icon:"folder"},{id:"roles",label:"角色配置",icon:"user"},{id:"workflows",label:"工作流配置",icon:"flow"}];function n7(){const[e,t]=b.useState(null),[n,r]=b.useState(!0),[s,i]=b.useState(null),[o,l]=b.useState(!1),[c,u]=b.useState(!1),[d,f]=b.useState("project"),[h,p]=b.useState(!1),v=b.useRef(!1),x=b.useCallback(async()=>{var j,N,k;r(!0),i(null);try{const S=await LD();if(t(S),!S.config.ok){const P=((j=S.config.modules.find(I=>I.id==="project"))==null?void 0:j.ok)??!0,$=((N=S.config.modules.find(I=>I.id==="coding_agent"))==null?void 0:N.ok)??!0,D=((k=S.config.modules.find(I=>I.id==="roles"))==null?void 0:k.ok)??!0;f(!P||!$?"project":D?"workflows":"roles")}}catch(S){i(S instanceof Error?S.message:String(S))}finally{r(!1)}},[]);b.useEffect(()=>{x()},[x]),b.useEffect(()=>{if(e&&!c){const j=N=>{N.preventDefault()};return window.addEventListener("beforeunload",j),()=>window.removeEventListener("beforeunload",j)}},[e,c]);const w=b.useCallback(async()=>{if(!(v.current||c)){v.current=!0,l(!0);try{await RD(),u(!0)}catch(j){i(j instanceof Error?j.message:String(j))}finally{l(!1),v.current=!1}}},[c]),g=b.useCallback(async(j,N)=>{const k=await y_([{writeTarget:j,value:N}]);t(S=>S&&{...S,config:k.recheck})},[]),y=b.useCallback(async j=>{const N=await y_(j);t(k=>k&&{...k,config:N.recheck})},[]),m=b.useCallback(async(j,N)=>{try{const k=await $D(j,N);return t(S=>S&&{...S,config:k.recheck}),{ok:k.ok,message:k.message}}catch(k){const S=k instanceof Error?k.message:"知识库导入失败";return i(S),{ok:!1,message:S}}},[]),_=b.useCallback(async(j,N)=>{try{const k=await OD(j,N);return t(S=>S&&{...S,config:k.recheck}),{ok:k.ok,message:k.message}}catch(k){const S=k instanceof Error?k.message:"文件上传失败";return i(S),{ok:!1,message:S}}},[]);return c?a.jsx("div",{className:"adjust",children:a.jsxs("div",{className:"adjust__done",children:[a.jsx("span",{className:"adjust__done-icon",children:a.jsx(V,{name:"check",size:32,color:"var(--green)"})}),a.jsx("h2",{className:"adjust__done-title",children:"配置完成"}),a.jsx("p",{className:"adjust__done-text",children:"所有配置项已保存到本地文件,CLI 将继续 setup 流程。"}),a.jsx("p",{className:"adjust__done-hint",children:"可以关闭此页面。"})]})}):a.jsxs("div",{className:"adjust",children:[a.jsxs("div",{className:"adjust__head",children:[a.jsx("h1",{className:"adjust__title",children:"参数调整"}),a.jsx("p",{className:"adjust__sub",children:"配置项目参数、角色和工作流"})]}),n&&a.jsx("div",{className:"adjust__loading",children:"正在加载配置状态…"}),s&&a.jsxs("div",{className:"adjust__error",children:[a.jsx(V,{name:"warn",size:16,color:"var(--red)"}),a.jsx("span",{children:s}),a.jsx("button",{type:"button",className:"adjust__retry",onClick:()=>void x(),children:"重试"})]}),e&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"adjust__hint",children:[a.jsx(V,{name:"folder",size:14,color:"var(--text-muted)"}),a.jsx("code",{children:e.config.projectPath})]}),a.jsxs("div",{className:"adjust__tab-area",children:[a.jsx("div",{className:"adjust__tabs",children:t7.map(j=>{var D,I,O,E,A;const N=((D=e.config.modules.find(C=>C.id==="env"))==null?void 0:D.items)??[],k=new Set(e.projectEnvRefs??N.map(C=>C.key)),S=new Set;for(const C of Object.values(e.workflowTopology)){for(const M of C.envRefs??[])S.add(M);for(const M of Object.values(C.stepEnvRefs??{}))for(const T of M)S.add(T)}const P=C=>N.some(M=>M.status==="error"&&C.has(M.key)),$=j.id==="project"?(((I=e.config.modules.find(C=>C.id==="project"))==null?void 0:I.ok)??!0)&&(((O=e.config.modules.find(C=>C.id==="coding_agent"))==null?void 0:O.ok)??!0)&&!P(k):j.id==="roles"?((E=e.config.modules.find(C=>C.id==="roles"))==null?void 0:E.ok)??!0:(((A=e.config.modules.find(C=>C.id==="workflow"))==null?void 0:A.ok)??!0)&&!P(S);return a.jsxs("button",{type:"button",className:`adjust__tab${d===j.id?" is-active":""}${$?"":" has-error"}`,onClick:()=>f(j.id),children:[a.jsx(V,{name:j.icon,size:13}),j.label,!$&&a.jsx("span",{className:"adjust__tab-dot"})]},j.id)})}),a.jsxs("div",{className:"adjust__tab-content",children:[d==="project"&&a.jsx(YW,{config:e.config,engines:e.engines,projectEnvRefs:e.projectEnvRefs,onSave:g,onBatchSave:y}),d==="roles"&&a.jsx(QW,{config:e.config,onSave:g,onKbIngest:m,onKbUpload:_}),d==="workflows"&&a.jsx(JW,{config:e.config,workflowTopology:e.workflowTopology,onSave:g})]})]}),a.jsx(OW,{summary:e.config.summary,allPassed:e.config.ok,saving:o,onComplete:()=>p(!0)}),h&&a.jsx("div",{className:"modal-overlay",onClick:()=>p(!1),children:a.jsxs("div",{className:"modal-card",onClick:j=>j.stopPropagation(),children:[a.jsxs("div",{className:"modal-card__head",children:[a.jsx("span",{className:"modal-card__icon",style:{background:"var(--accent-tint)",color:"var(--accent)"},children:a.jsx(V,{name:"check",size:16})}),a.jsx("span",{className:"modal-card__title",children:"确认进入搭建"}),a.jsx("button",{type:"button",className:"modal-card__close",onClick:()=>p(!1),children:a.jsx(V,{name:"close",size:14})})]}),a.jsx("div",{className:"modal-card__body",children:a.jsx("p",{style:{margin:0,fontSize:14,color:"var(--text)"},children:"确认不再修改配置,进入下一步搭建流程?"})}),a.jsxs("div",{className:"modal-card__foot",children:[a.jsx("button",{type:"button",className:"modal-card__btn",onClick:()=>p(!1),children:"继续修改"}),a.jsx("button",{type:"button",className:"primary modal-card__btn",disabled:o,onClick:()=>{p(!1),w()},children:o?"完成中…":"确认,继续搭建"})]})]})})]})]})}function r7({onSwitchToRegister:e}){const[t,n]=b.useState(""),[r,s]=b.useState(""),[i,o]=b.useState(""),[l,c]=b.useState(!1);async function u(d){if(d.preventDefault(),!(!t||!r)){o(""),c(!0);try{await As.login(t,r)}catch(f){o(f instanceof Error?f.message:String(f))}finally{c(!1)}}}return a.jsx("div",{className:"auth-page",children:a.jsxs("form",{className:"auth-card",onSubmit:u,children:[a.jsxs("div",{className:"auth-card__brand",children:[a.jsx("span",{className:"auth-card__brand-mark",children:a.jsx(V,{name:"sparkle",size:18,color:"#fff"})}),a.jsx("span",{className:"auth-card__brand-name",children:"AITable Agent"})]}),a.jsx("h2",{className:"auth-card__title",children:"登录"}),i&&a.jsx("div",{className:"auth-error",children:i}),a.jsxs("div",{className:"auth-field",children:[a.jsx("label",{className:"auth-field__label",children:"用户名"}),a.jsx("input",{className:"auth-field__input",type:"text",placeholder:"请输入用户名",value:t,onChange:d=>n(d.target.value),autoComplete:"username",autoFocus:!0})]}),a.jsxs("div",{className:"auth-field",children:[a.jsx("label",{className:"auth-field__label",children:"密码"}),a.jsx("input",{className:"auth-field__input",type:"password",placeholder:"请输入密码",value:r,onChange:d=>s(d.target.value),autoComplete:"current-password"})]}),a.jsxs("button",{type:"submit",className:"primary auth-submit",disabled:l||!t||!r,children:[l&&a.jsx("span",{className:"auth-spinner"}),l?"登录中...":"登录"]}),a.jsxs("div",{className:"auth-footer",children:["没有账号?",a.jsx("button",{type:"button",className:"auth-footer__link",onClick:e,children:"注册"})]})]})})}function s7({onSwitchToLogin:e}){const[t,n]=b.useState(""),[r,s]=b.useState(""),[i,o]=b.useState(""),[l,c]=b.useState(""),[u,d]=b.useState({}),[f,h]=b.useState(!1);function p(){const x={};return(t.length<3||t.length>32)&&(x.username="用户名长度需在 3-32 个字符之间"),r.length<6&&(x.password="密码长度至少 6 个字符"),r!==i&&(x.confirm="两次输入的密码不一致"),d(x),Object.keys(x).length===0}async function v(x){if(x.preventDefault(),c(""),!!p()){h(!0);try{await As.register(t,r)}catch(w){c(w instanceof Error?w.message:String(w))}finally{h(!1)}}}return a.jsx("div",{className:"auth-page",children:a.jsxs("form",{className:"auth-card",onSubmit:v,children:[a.jsxs("div",{className:"auth-card__brand",children:[a.jsx("span",{className:"auth-card__brand-mark",children:a.jsx(V,{name:"sparkle",size:18,color:"#fff"})}),a.jsx("span",{className:"auth-card__brand-name",children:"AITable Agent"})]}),a.jsx("h2",{className:"auth-card__title",children:"注册"}),l&&a.jsx("div",{className:"auth-error",children:l}),a.jsxs("div",{className:"auth-field",children:[a.jsx("label",{className:"auth-field__label",children:"用户名"}),a.jsx("input",{className:`auth-field__input${u.username?" is-error":""}`,type:"text",placeholder:"3-32 个字符",value:t,onChange:x=>{n(x.target.value),u.username&&d(w=>({...w,username:void 0}))},autoComplete:"username",autoFocus:!0}),u.username&&a.jsx("div",{className:"auth-field__hint",children:u.username})]}),a.jsxs("div",{className:"auth-field",children:[a.jsx("label",{className:"auth-field__label",children:"密码"}),a.jsx("input",{className:`auth-field__input${u.password?" is-error":""}`,type:"password",placeholder:"至少 6 个字符",value:r,onChange:x=>{s(x.target.value),u.password&&d(w=>({...w,password:void 0}))},autoComplete:"new-password"}),u.password&&a.jsx("div",{className:"auth-field__hint",children:u.password})]}),a.jsxs("div",{className:"auth-field",children:[a.jsx("label",{className:"auth-field__label",children:"确认密码"}),a.jsx("input",{className:`auth-field__input${u.confirm?" is-error":""}`,type:"password",placeholder:"再次输入密码",value:i,onChange:x=>{o(x.target.value),u.confirm&&d(w=>({...w,confirm:void 0}))},autoComplete:"new-password"}),u.confirm&&a.jsx("div",{className:"auth-field__hint",children:u.confirm})]}),a.jsxs("button",{type:"submit",className:"primary auth-submit",disabled:f||!t||!r||!i,children:[f&&a.jsx("span",{className:"auth-spinner"}),f?"注册中...":"注册"]}),a.jsxs("div",{className:"auth-footer",children:["已有账号?",a.jsx("button",{type:"button",className:"auth-footer__link",onClick:e,children:"登录"})]})]})})}function qp({machineKey:e,ownerToken:t,machineName:n,title:r,persistent:s,onClose:i}){const[o,l]=b.useState(!1),[c,u]=b.useState(!1),[d,f]=b.useState(!1),h=!!t,p=t??e??"",v=h?"Owner Token":"Machine Key",x=zz(),w=h?Fz(t,n||void 0):Vz(e??"");function g(y,m){navigator.clipboard.writeText(y).then(()=>{m(!0),setTimeout(()=>m(!1),2e3)})}return a.jsxs("div",{className:"daemon-connect-card",children:[a.jsxs("div",{className:"daemon-connect-card__header",children:[a.jsx(V,{name:"check",size:16,color:"var(--green)"}),a.jsx("span",{className:"daemon-connect-card__title",children:r??(h?"添加执行引擎":`机器「${n??""}」创建成功`)})]}),a.jsxs("div",{className:"daemon-connect-card__warn",children:[a.jsx(V,{name:"warn",size:14}),h?"该 owner-token 是账号级长期凭证,请妥善保管勿外泄(可在账号中心轮换)":s?"该命令含接入密钥,请妥善保管勿外泄":"密钥仅此一次展示,请立即复制保管"]}),a.jsxs("div",{className:"daemon-connect-card__section",children:[a.jsx("div",{className:"daemon-connect-card__label",children:v}),a.jsxs("div",{className:"daemon-connect-card__copyable",children:[a.jsx("code",{className:"daemon-connect-card__code",children:p}),a.jsxs("button",{type:"button",className:"daemon-connect-card__copy-btn",onClick:()=>g(p,l),title:"复制凭证",children:[o?a.jsx(V,{name:"check",size:12}):a.jsx(V,{name:"link",size:12}),o?"已复制":"复制"]})]})]}),a.jsxs("div",{className:"daemon-connect-card__section",children:[a.jsx("div",{className:"daemon-connect-card__label",children:"首次安装(一次性)"}),a.jsxs("div",{className:"daemon-connect-card__copyable daemon-connect-card__copyable--cmd",children:[a.jsx("pre",{className:"daemon-connect-card__pre",children:x}),a.jsxs("button",{type:"button",className:"daemon-connect-card__copy-btn",onClick:()=>g(x,f),title:"复制安装命令",children:[d?a.jsx(V,{name:"check",size:12}):a.jsx(V,{name:"link",size:12}),d?"已复制":"复制"]})]}),a.jsx("div",{className:"daemon-connect-card__hint",children:"仅首次安装或升级 CLI 时执行一次,之后无需重复。"})]}),a.jsxs("div",{className:"daemon-connect-card__section",children:[a.jsx("div",{className:"daemon-connect-card__label",children:"Daemon 接入命令(后台运行)"}),a.jsxs("div",{className:"daemon-connect-card__copyable daemon-connect-card__copyable--cmd",children:[a.jsx("pre",{className:"daemon-connect-card__pre",children:w}),a.jsxs("button",{type:"button",className:"daemon-connect-card__copy-btn",onClick:()=>g(w,u),title:"复制命令",children:[c?a.jsx(V,{name:"check",size:12}):a.jsx(V,{name:"link",size:12}),c?"已复制":"复制"]})]}),a.jsx("div",{className:"daemon-connect-card__hint",children:h?a.jsxs(a.Fragment,{children:["将 ",a.jsx("code",{children:"<此机器名>"})," 改为该机器的稳定名称(相同名字复用同一台,不同名字新增一台), 在目标机器上执行即可:保存凭证 → ",a.jsx("strong",{children:"后台启动 daemon"}),", 终端随后打印 status / logs / stop 等常用命令指引。工作区默认为"," ",a.jsx("code",{children:"~/.aitable-workflow/workspaces/<机器名>"}),",如需自定义可加"," ",a.jsx("code",{children:"--workspace-root <目录>"}),"。",a.jsx("br",{}),"多网关 / 多台机器请为每台使用",a.jsxs("strong",{children:["不同的 ",a.jsx("code",{children:"--name"})]}),"(相同 name 连不同 gateway 会覆盖本机凭证)。"]}):a.jsxs(a.Fragment,{children:["在目标机器上执行即可:保存凭证 → ",a.jsx("strong",{children:"后台启动 daemon"}),", 终端随后打印 status / logs / stop 等常用命令指引。工作区默认为"," ",a.jsx("code",{children:"~/.aitable-workflow/workspaces/<机器名>"}),",如需自定义可加"," ",a.jsx("code",{children:"--workspace-root <目录>"}),"。",a.jsx("br",{}),"多网关 / 多台机器请为每台使用",a.jsxs("strong",{children:["不同的 ",a.jsx("code",{children:"--name"})]}),"(相同 name 连不同 gateway 会覆盖本机凭证)。"]})})]}),a.jsx("div",{className:"daemon-connect-card__actions",children:a.jsx("button",{type:"button",className:"daemon-connect-card__close",onClick:i,children:"我已复制,关闭"})})]})}function i7(e){const t=Date.now(),n=new Date(e).getTime(),r=t-n;if(Number.isNaN(r))return e;const s=Math.floor(r/1e3);if(s<60)return"刚刚";const i=Math.floor(s/60);if(i<60)return`${i}分钟前`;const o=Math.floor(i/60);if(o<24)return`${o}小时前`;const l=Math.floor(o/24);if(l<30)return`${l}天前`;const c=Math.floor(l/30);return c<12?`${c}个月前`:`${Math.floor(c/12)}年前`}function o7(e){return e.length<=12?e:e.slice(0,6)+"..."+e.slice(-4)}const a7={claudecode:"Claude",codex:"Codex",qoder:"Qoder",codebuddy:"Codebuddy",opencode:"OpenCode",qwen:"Qwen",deepseek:"DeepSeek",trae:"Trae",qwenwork:"千问办公"};function l7({machine:e,onRevoke:t,onUpdated:n}){const[r,s]=b.useState(!1),[i,o]=b.useState(!1),[l,c]=b.useState(""),[u,d]=b.useState(!1),[f,h]=b.useState(null),[p,v]=b.useState(null);function x(){navigator.clipboard.writeText(e.machineId).then(()=>{s(!0),setTimeout(()=>s(!1),1500)})}async function w(){d(!0);try{const S=await Vk();h(S)}catch(S){window.alert("获取接入指令失败:"+(S instanceof Error?S.message:String(S)))}finally{d(!1)}}async function g(){if(window.confirm(`确定要为「${e.displayName||e.name}」重新生成密钥吗?旧密钥将立即失效,需用新密钥重新接入。`)){d(!0);try{const P=await Oz(e.machineId);v(P)}catch(P){window.alert("重新生成失败:"+(P instanceof Error?P.message:String(P)))}finally{d(!1)}}}function y(){window.confirm(`确定要撤销执行引擎「${e.displayName||e.name}」吗?撤销后该机器将无法连接。`)&&t(e.machineId)}function m(){c(e.displayName||e.name),o(!0)}async function _(){const S=l.trim();if(S){try{await Rz(e.machineId,{displayName:S}),n==null||n(e.machineId,{displayName:S})}catch(P){window.alert("修改失败:"+(P instanceof Error?P.message:String(P)))}o(!1)}}const j=e.displayName||e.name,N=e.status==="online",k=e.runtimes??[];return a.jsxs("div",{className:"machine-card",children:[a.jsxs("div",{className:"machine-card__header",children:[a.jsx("span",{className:`machine-status ${N?"machine-status--online":"machine-status--offline"}`}),i?a.jsxs("span",{className:"machine-card__edit-row",children:[a.jsx("input",{className:"machine-card__edit-input",type:"text",value:l,onChange:S=>c(S.target.value),onKeyDown:S=>{S.key==="Enter"&&_(),S.key==="Escape"&&o(!1)},autoFocus:!0}),a.jsx("button",{type:"button",className:"machine-card__edit-save",onClick:()=>void _(),title:"保存",children:a.jsx(V,{name:"check",size:12})}),a.jsx("button",{type:"button",className:"machine-card__edit-cancel",onClick:()=>o(!1),title:"取消",children:a.jsx(V,{name:"close",size:12})})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"machine-card__name",onDoubleClick:m,title:"双击编辑名称",children:j}),e.displayName&&e.name!==e.displayName&&a.jsx("span",{className:"machine-card__slug",children:e.name})]})]}),e.description&&a.jsx("div",{className:"machine-card__desc",children:e.description}),k.length>0?a.jsxs("div",{className:`machine-card__runtimes${N?"":" machine-card__runtimes--offline"}`,children:[k.map(S=>a.jsx("span",{className:"machine-card__runtime-tag",children:a7[S]??S},S)),e.hasDws&&a.jsx("span",{className:"machine-card__runtime-tag machine-card__runtime-tag--dws",children:"dws"})]}):a.jsx("div",{className:"machine-card__runtimes machine-card__runtimes--offline",children:a.jsx("span",{className:"machine-card__runtime-hint",children:"未探测到引擎"})}),a.jsxs("div",{className:"machine-card__meta",children:[a.jsxs("span",{className:"machine-card__id",title:e.machineId,children:["ID: ",o7(e.machineId),a.jsx("button",{type:"button",className:"machine-card__copy",onClick:x,title:"复制 Machine ID",children:r?a.jsx(V,{name:"check",size:12}):a.jsx(V,{name:"link",size:12})})]}),a.jsx("span",{className:"machine-card__seen",children:N?"在线":e.lastSeen?`最后在线 ${i7(e.lastSeen)}`:"从未连接"})]}),a.jsxs("div",{className:"machine-card__actions",children:[a.jsxs("button",{type:"button",className:"machine-card__action-btn",onClick:m,title:"编辑名称",children:[a.jsx(V,{name:"file",size:12})," 编辑"]}),a.jsxs("button",{type:"button",className:"machine-card__action-btn",onClick:()=>void w(),disabled:u,title:"查看该机器的接入指令(Key + 启动命令)",children:[a.jsx(V,{name:"link",size:12})," 查看指令"]}),a.jsxs("button",{type:"button",className:"machine-card__action-btn",onClick:()=>void g(),disabled:u,title:"重新生成密钥(旧密钥失效)",children:[a.jsx(V,{name:"refresh",size:12})," 重生成密钥"]}),a.jsx("button",{type:"button",className:"machine-card__revoke",onClick:y,children:"撤销"})]}),f&&a.jsx(qp,{ownerToken:f,machineName:e.name,title:`「${j}」接入指令`,onClose:()=>h(null)}),p&&a.jsx(qp,{machineKey:p,machineName:j,title:`「${j}」新密钥已生成`,onClose:()=>v(null)})]})}function eC(){const[e,t]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(""),[o,l]=b.useState(!1),[c,u]=b.useState(null);async function d(){r(!0),i("");try{const w=await qg();t(w)}catch(w){i(w instanceof Error?w.message:String(w))}finally{r(!1)}}b.useEffect(()=>{d()},[]);async function f(){l(!0);try{const w=await Vk();u(w)}catch(w){window.alert("获取接入指令失败:"+(w instanceof Error?w.message:String(w)))}finally{l(!1)}}async function h(w){try{await Iz(w),t(g=>g.filter(y=>y.machineId!==w))}catch(g){window.alert("撤销失败:"+(g instanceof Error?g.message:String(g)))}}function p(w,g){t(y=>y.map(m=>m.machineId===w?{...m,...g}:m))}if(n)return a.jsx("div",{className:"machine-list__loading",children:"加载中..."});if(s)return a.jsxs("div",{className:"machine-list__error",children:[a.jsx("span",{children:s}),a.jsx("button",{type:"button",className:"machine-list__retry",onClick:()=>void d(),children:"重试"})]});const v=e.filter(w=>w.status==="online"||w.lastSeen),x=v.filter(w=>w.status==="online").length;return a.jsxs("div",{className:"machine-list",children:[a.jsxs("div",{className:"machine-list__header",children:[a.jsxs("span",{className:"machine-list__count",children:["已接入 ",v.length," 台 · 在线 ",x," 台"]}),a.jsxs("div",{className:"machine-list__header-actions",children:[a.jsxs("button",{type:"button",className:"machine-list__refresh",onClick:()=>void d(),title:"刷新(daemon 接入后点此更新列表)",children:[a.jsx(V,{name:"refresh",size:14}),"刷新"]}),a.jsxs("button",{type:"button",className:"primary machine-list__add",onClick:()=>void f(),disabled:o,children:[a.jsx(V,{name:"plus",size:14}),o?"获取中...":"添加引擎"]})]})]}),c&&a.jsx(qp,{ownerToken:c,title:"添加执行引擎",onClose:()=>u(null)}),v.length===0&&!c?a.jsx("div",{className:"machine-list__empty",children:"暂无已接入的执行引擎。点击「添加引擎」获取自注册接入指令,在目标机器上执行 daemon 启动命令(填入机器名);接入成功后点「刷新」即可看到。"}):a.jsx("div",{className:"machine-list__grid",children:v.map(w=>a.jsx(l7,{machine:w,onRevoke:h,onUpdated:p},w.machineId))})]})}const c7={admin:"管理员",user:"普通用户"};function u7(e){try{return new Date(e).toLocaleDateString("zh-CN",{year:"numeric",month:"long",day:"numeric"})}catch{return e}}function d7(){var c,u;const e=Og(),[t,n]=b.useState(null),[r,s]=b.useState(!0);b.useEffect(()=>{(async()=>{try{const d=await Mz();n(d)}catch{}finally{s(!1)}})()},[]);const i=(t==null?void 0:t.username)??((c=e.user)==null?void 0:c.username)??"---",o=(t==null?void 0:t.role)??((u=e.user)==null?void 0:u.role)??"user",l=(t==null?void 0:t.createdAt)??null;return a.jsx("div",{className:"split split--chatonly",children:a.jsxs("div",{className:"split__work",children:[a.jsx("div",{className:"work-head",children:a.jsxs("div",{className:"work-head__left",children:[a.jsxs("button",{type:"button",className:"account-back-btn",onClick:()=>z.setRoute("home"),title:"返回首页",children:[a.jsx(V,{name:"chevron-left",size:16}),"返回"]}),a.jsxs("div",{children:[a.jsx("div",{className:"work-head__title",children:"用户中心"}),a.jsx("div",{className:"work-head__sub",children:"管理账号信息与执行引擎"})]})]})}),a.jsx("div",{className:"work-body",children:a.jsxs("div",{className:"account-page",children:[a.jsxs("section",{className:"account-section",children:[a.jsx("h3",{className:"account-section__title",children:"账号信息"}),a.jsx("div",{className:"account-card",children:r?a.jsx("div",{className:"account-card__loading",children:"加载中..."}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"account-card__row",children:[a.jsx("span",{className:"account-card__avatar",children:a.jsx(V,{name:"user",size:24})}),a.jsxs("div",{className:"account-card__info",children:[a.jsx("span",{className:"account-card__username",children:i}),a.jsx("span",{className:`account-card__role account-card__role--${o}`,children:c7[o]??o})]})]}),l&&a.jsxs("div",{className:"account-card__detail",children:[a.jsx("span",{className:"account-card__label",children:"注册时间"}),a.jsx("span",{className:"account-card__value",children:u7(l)})]})]})})]}),a.jsxs("section",{className:"account-section",children:[a.jsx("h3",{className:"account-section__title",children:"执行引擎管理"}),a.jsx(eC,{})]})]})})]})})}function f7(){return a.jsx("div",{className:"split split--chatonly",children:a.jsxs("div",{className:"split__work",children:[a.jsx("div",{className:"work-head",children:a.jsxs("div",{className:"work-head__left",children:[a.jsxs("button",{type:"button",className:"account-back-btn",onClick:()=>z.setRoute("home"),title:"返回首页",children:[a.jsx(V,{name:"chevron-left",size:16}),"返回"]}),a.jsxs("div",{children:[a.jsx("div",{className:"work-head__title",children:"执行引擎"}),a.jsx("div",{className:"work-head__sub",children:"生成接入密钥、查看启动命令,管理已接入的引擎"})]})]})}),a.jsx("div",{className:"work-body",children:a.jsx("div",{className:"account-page",children:a.jsx("section",{className:"account-section",children:a.jsx(eC,{})})})})]})})}const h7={init:{title:"一次性配置",sub:"Agent · 角色 · SOP"},design:{title:"工作流设计",sub:"需求对齐后可视化编排流程方案"},setup:{title:"AI 表格搭建",sub:"自动创建字段与视图"},adjust:{title:"参数调整",sub:"确认并补全项目配置"},test:{title:"试运行",sub:"用一条真实记录验证整条流程"},run:{title:"运行监控",sub:"任务流转 · 步骤日志 · 人工审批"}};function p7({stage:e}){const t=h7[e];return a.jsx("div",{className:"split split--chatonly",children:a.jsxs("div",{className:"split__work",children:[a.jsx("div",{className:"work-head",children:a.jsxs("div",{children:[a.jsx("div",{className:"work-head__title",children:t.title}),a.jsx("div",{className:"work-head__sub",children:t.sub})]})}),a.jsx("div",{className:"work-body",children:a.jsxs("div",{className:"empty-hint",children:["当前没有可用的项目。",a.jsx("div",{style:{marginTop:16},children:a.jsx("button",{type:"button",className:"primary",onClick:()=>z.setRoute("home"),children:"回到首页"})})]})})]})})}const m7=[{icon:"robot",label:"配置",stage:"init",desc:"发现并接入 Agent、角色、SOP"},{icon:"flow",label:"设计",stage:"design",desc:"问答对齐后可视化编排工作流"},{icon:"table",label:"搭建",stage:"setup",desc:"自动创建字段与视图"},{icon:"sparkle",label:"试运行",stage:"test",desc:"用一条真实记录验证流程"}];function g7(){const[e,t]=b.useState(!1),[n,r]=b.useState(!1);async function s(i){if(!ue){z.beginNewProject(`mock-${Date.now()}`,i);return}const o=await $g();z.beginNewProject(o.id,i),z.setProjects(ka(z.projects,o))}return a.jsxs("div",{className:"home-hero",children:[a.jsx(Ye.span,{className:"home-hero__mark",variants:dz,initial:"hidden",animate:"visible",children:a.jsx(V,{name:"sparkle",size:28,color:"#fff"})}),a.jsx("h1",{className:"home-hero__title",children:"用对话搭建你的 AI 表格工作流"}),a.jsxs("p",{className:"home-hero__desc",children:["从配置、设计、搭建到试运行,全程对话式引导。",a.jsx("br",{}),"以 HR、法务等专业岗位协作为例,四步落地一条可运行的业务流程。"]}),a.jsxs("div",{className:"home-hero__ctas",children:[a.jsxs("button",{type:"button",className:"primary home-hero__cta",onClick:()=>r(!0),children:[a.jsx(V,{name:"play",size:16,color:"#fff"}),"新建项目"]}),a.jsxs("button",{type:"button",className:"home-hero__cta home-hero__cta--ghost",onClick:()=>t(!0),children:[a.jsx(V,{name:"plus",size:16}),"导入已有项目"]})]}),a.jsx(Ye.div,{className:"home-beats",variants:Ik,initial:"hidden",animate:"visible",children:m7.map((i,o)=>a.jsxs(Ye.button,{type:"button",className:"home-beat",variants:St,onClick:()=>z.setRoute(i.stage),children:[a.jsx("span",{className:"home-beat__idx",children:o+1}),a.jsx("span",{className:"home-beat__icon",children:a.jsx(V,{name:i.icon,size:18})}),a.jsx("span",{className:"home-beat__label",children:i.label}),a.jsx("span",{className:"home-beat__desc",children:i.desc})]},i.stage))}),e&&a.jsx(RW,{onClose:()=>t(!1)}),n&&a.jsx(dk,{onConfirm:i=>{s(i),r(!1)},onCancel:()=>r(!1)})]})}const v7=ut(function(){const t=Og(),[n,r]=b.useState("login"),[s]=b.useState(()=>ID());return b.useEffect(()=>{s&&z.setRoute("adjust")},[s]),it&&!t.token&&!s?n==="register"?a.jsx(s7,{onSwitchToLogin:()=>r("login")}):a.jsx(r7,{onSwitchToRegister:()=>r("register")}):a.jsx(y7,{})}),y7=ut(function(){b.useEffect(()=>{if(!ue)return;const n=z.persistedProjectId;!n&&z.route!=="home"||ba(n,{fallbackRoute:z.route})},[]);const t=z.view;return a.jsx(az,{children:t.kind==="loading"?a.jsx(cz,{stage:z.route}):t.kind==="load_error"?a.jsx(uz,{message:t.message,onRetry:()=>void ba(t.projectId,{fallbackRoute:z.route})}):t.kind==="home"?a.jsx(g7,{}):t.kind==="no_project"?a.jsx(p7,{stage:t.intended}):t.kind==="init"?a.jsx(uW,{}):t.kind==="design"?a.jsx(ZU,{},z.projectId??"__no_project__"):t.kind==="setup"?a.jsx(pW,{}):t.kind==="adjust"?a.jsx(n7,{}):t.kind==="test"?a.jsx(vW,{}):t.kind==="run"?a.jsx(CW,{}):t.kind==="account"?a.jsx(d7,{}):a.jsx(f7,{})})});$z();kb(document.getElementById("root")).render(a.jsx(b.StrictMode,{children:a.jsx(v7,{})}));